hedgewars/uVariables.pas
changeset 7848 775a72905708
parent 7780 a066a52411bc
child 7896 67217e6108fd
equal deleted inserted replaced
7847:a595d4f4837d 7848:775a72905708
    23 
    23 
    24 uses SDLh, uTypes, uFloat, GLunit, uConsts, Math, uMobile;
    24 uses SDLh, uTypes, uFloat, GLunit, uConsts, Math, uMobile;
    25 
    25 
    26 var
    26 var
    27 /////// init flags ///////
    27 /////// init flags ///////
    28     cMinScreenWidth    : LongInt     = 640;
    28     cMinScreenWidth    : LongInt;
    29     cMinScreenHeight   : LongInt     = 480;
    29     cMinScreenHeight   : LongInt;
    30     cScreenWidth       : LongInt     = 1024;
    30     cScreenWidth       : LongInt;
    31     cScreenHeight      : LongInt     = 768;
    31     cScreenHeight      : LongInt;
    32     cOrigScreenWidth   : LongInt     = 1024;
    32     cOrigScreenWidth   : LongInt;
    33     cOrigScreenHeight  : LongInt     = 768;
    33     cOrigScreenHeight  : LongInt;
    34     cNewScreenWidth    : LongInt     = 1024;
    34     cNewScreenWidth    : LongInt;
    35     cNewScreenHeight   : LongInt     = 768;
    35     cNewScreenHeight   : LongInt;
    36     cScreenResizeDelay : LongWord    = 0;
    36     cScreenResizeDelay : LongWord;
    37     cBits           : LongInt     = 32;
    37     cBits              : LongInt;
    38     ipcPort         : Word        = 0;
    38     ipcPort            : Word;
    39     cFullScreen     : boolean     = false;
    39     cFullScreen        : boolean;
    40     cLocaleFName    : shortstring = 'en.txt';
    40     cLocaleFName       : shortstring;
    41     cLocale         : shortstring = 'en';
    41     cLocale            : shortstring;
    42     cTimerInterval  : LongInt     = 8;
    42     cTimerInterval     : LongInt;
    43     PathPrefix      : shortstring = './';
    43     PathPrefix         : shortstring;
    44     UserPathPrefix  : shortstring = './';
    44     UserPathPrefix     : shortstring;
    45     cShowFPS        : boolean     = false;
    45     cShowFPS           : boolean;
    46     cFlattenFlakes  : boolean     = false;
    46     cFlattenFlakes     : boolean;
    47     cFlattenClouds  : boolean     = false;
    47     cFlattenClouds     : boolean;
    48     cAltDamage      : boolean     = true;
    48     cAltDamage         : boolean;
    49     cReducedQuality : LongWord    = rqNone;
    49     cReducedQuality    : LongWord;
    50     UserNick        : shortstring = '';
    50     UserNick           : shortstring;
    51     recordFileName  : shortstring = '';
    51     recordFileName     : shortstring;
    52     cReadyDelay     : Longword    = 5000;
    52     cReadyDelay        : Longword;
    53     cStereoMode     : TStereoMode = smNone;
    53     cStereoMode        : TStereoMode;
    54     cOnlyStats      : boolean = False;
    54     cOnlyStats         : boolean;
    55 {$IFDEF USE_VIDEO_RECORDING}
    55 {$IFDEF USE_VIDEO_RECORDING}
    56     RecPrefix      : shortstring;
    56     RecPrefix          : shortstring;
    57     cAVFormat       : shortstring;
    57     cAVFormat          : shortstring;
    58     cVideoCodec     : shortstring;
    58     cVideoCodec        : shortstring;
    59     cVideoFramerateNum : LongInt;
    59     cVideoFramerateNum : LongInt;
    60     cVideoFramerateDen : LongInt;
    60     cVideoFramerateDen : LongInt;
    61     cVideoQuality      : LongInt;
    61     cVideoQuality      : LongInt;
    62     cAudioCodec     : shortstring;
    62     cAudioCodec        : shortstring;
    63 {$ENDIF}
    63 {$ENDIF}
    64 //////////////////////////
    64 //////////////////////////
    65     cMapName        : shortstring = '';
    65     cMapName        : shortstring;
    66 
       
    67     isCursorVisible : boolean;
    66     isCursorVisible : boolean;
    68     isInLag         : boolean;
    67     isInLag         : boolean;
    69     isPaused        : boolean;
    68     isPaused        : boolean;
    70     isInMultiShoot  : boolean;
    69     isInMultiShoot  : boolean;
    71     isSpeed         : boolean;
    70     isSpeed         : boolean;
   109     zoom             : GLfloat;
   108     zoom             : GLfloat;
   110     ZoomValue        : GLfloat;
   109     ZoomValue        : GLfloat;
   111 
   110 
   112     cWaterLine       : Word;
   111     cWaterLine       : Word;
   113     cGearScrEdgesDist: LongInt;
   112     cGearScrEdgesDist: LongInt;
   114 	isAudioMuted     : boolean;
   113     isAudioMuted     : boolean;
   115 
   114 
   116     // originally typed consts
   115     // originally typed consts
   117     ExplosionBorderColor: LongWord;
   116     ExplosionBorderColor: LongWord;
   118     WaterOpacity: byte;
   117     WaterOpacity: byte;
   119     SDWaterOpacity: byte;
   118     SDWaterOpacity: byte;
  2509     vobVelocity, vobFallSpeed: LongInt;
  2508     vobVelocity, vobFallSpeed: LongInt;
  2510     vobSDFrameTicks, vobSDFramesCount, vobSDCount: Longword;
  2509     vobSDFrameTicks, vobSDFramesCount, vobSDCount: Longword;
  2511     vobSDVelocity, vobSDFallSpeed: LongInt;
  2510     vobSDVelocity, vobSDFallSpeed: LongInt;
  2512 
  2511 
  2513     hideAmmoMenu: boolean;
  2512     hideAmmoMenu: boolean;
  2514     wheelUp: boolean;
       
  2515     wheelDown: boolean;
       
  2516 
  2513 
  2517     ControllerNumControllers: Integer;
  2514     ControllerNumControllers: Integer;
  2518     ControllerEnabled: Integer;
  2515     ControllerEnabled: Integer;
  2519     ControllerNumAxes: array[0..5] of Integer;
  2516     ControllerNumAxes: array[0..5] of Integer;
  2520     //ControllerNumBalls: array[0..5] of Integer;
  2517     //ControllerNumBalls: array[0..5] of Integer;
  2541 implementation
  2538 implementation
  2542 
  2539 
  2543 
  2540 
  2544 procedure initModule;
  2541 procedure initModule;
  2545 begin
  2542 begin
       
  2543     // initialisation flags - they are going to be overwritten by args or by msgs
       
  2544     cScreenWidth    := 1024;
       
  2545     cScreenHeight   := 768;
       
  2546     cBits           := 32;
       
  2547     ipcPort         := 0;
       
  2548     cFullScreen     := false;
       
  2549     cLocaleFName    := 'en.txt';
       
  2550     cLocale         := 'en';
       
  2551     cTimerInterval  := 8;
       
  2552     PathPrefix      := './';
       
  2553     UserPathPrefix  := './';
       
  2554     cShowFPS        := false;
       
  2555     cFlattenFlakes  := false;
       
  2556     cFlattenClouds  := false;
       
  2557     cAltDamage      := true;
       
  2558     cReducedQuality := rqNone;
       
  2559     UserNick        := '';
       
  2560     recordFileName  := '';
       
  2561     cScriptName     := '';
       
  2562     cReadyDelay     := 5000;
       
  2563     cStereoMode     := smNone;
       
  2564     GrayScale       := false;
       
  2565 
       
  2566     cFlattenFlakes  := false;
       
  2567     cFlattenClouds  := false;
       
  2568     cOnlyStats      := False;
  2546     lastVisualGearByUID:= nil;
  2569     lastVisualGearByUID:= nil;
  2547     lastGearByUID:= nil;
  2570     lastGearByUID:= nil;
  2548     
  2571     
  2549     Pathz:= cPathz;
  2572     Pathz:= cPathz;
  2550         {*  REFERENCE
  2573         {*  REFERENCE
  2575     SDWaterColorArray[2].g := 112;
  2598     SDWaterColorArray[2].g := 112;
  2576     SDWaterColorArray[2].b := 169;
  2599     SDWaterColorArray[2].b := 169;
  2577     SDWaterColorArray[2].a := 255;
  2600     SDWaterColorArray[2].a := 255;
  2578     SDWaterColorArray[1]:= SDWaterColorArray[0];
  2601     SDWaterColorArray[1]:= SDWaterColorArray[0];
  2579     SDWaterColorArray[3]:= SDWaterColorArray[2];
  2602     SDWaterColorArray[3]:= SDWaterColorArray[2];
  2580 
  2603     SDWaterOpacity:= $80;
  2581     SDTint:= $80;
  2604     SDTint:= $80;
       
  2605     ExplosionBorderColor:= $FF808080;
       
  2606     WaterOpacity:= $80;
  2582 
  2607 
  2583     cDrownSpeed.QWordValue  := 257698038;       // 0.06
  2608     cDrownSpeed.QWordValue  := 257698038;       // 0.06
  2584     cDrownSpeedf            := 0.06;
  2609     cDrownSpeedf            := 0.06;
  2585     cMaxWindSpeed.QWordValue:= 1073742;     // 0.00025
  2610     cMaxWindSpeed.QWordValue:= 1073742;     // 0.00025
  2586     cWindSpeed.QWordValue   := 0;      // 0.0
  2611     cWindSpeed.QWordValue   := 0;      // 0.0
  2626     cCaseFactor     := 5;  {0..9}
  2651     cCaseFactor     := 5;  {0..9}
  2627     cLandMines      := 4;
  2652     cLandMines      := 4;
  2628     cExplosives     := 2;
  2653     cExplosives     := 2;
  2629 
  2654 
  2630     GameState       := Low(TGameState);
  2655     GameState       := Low(TGameState);
  2631 //    GameType        := gmtLocal;
       
  2632     zoom            := cDefaultZoomLevel;
  2656     zoom            := cDefaultZoomLevel;
  2633     ZoomValue       := cDefaultZoomLevel;
  2657     ZoomValue       := cDefaultZoomLevel;
  2634     WeaponTooltipTex:= nil;
  2658     WeaponTooltipTex:= nil;
  2635     cLaserSighting  := false;
  2659     cLaserSighting  := false;
  2636     cVampiric       := false;
  2660     cVampiric       := false;
  2673     vobSDFramesCount:= 4;
  2697     vobSDFramesCount:= 4;
  2674     vobSDCount:= 30 * cScreenSpace div LAND_WIDTH;
  2698     vobSDCount:= 30 * cScreenSpace div LAND_WIDTH;
  2675     vobSDVelocity:= 15;
  2699     vobSDVelocity:= 15;
  2676     vobSDFallSpeed:= 250;
  2700     vobSDFallSpeed:= 250;
  2677 
  2701 
  2678     ExplosionBorderColor:= $FF808080;
  2702     cMinScreenWidth    := 640;
  2679     WaterOpacity:= $80;
  2703     cMinScreenHeight   := 480;
  2680     SDWaterOpacity:= $80;
  2704     cScreenWidth       := 1024;
       
  2705     cScreenHeight      := 768;
       
  2706     cOrigScreenWidth   := 1024;
       
  2707     cOrigScreenHeight  := 768;
       
  2708     cNewScreenWidth    := 1024;
       
  2709     cNewScreenHeight   := 768;
       
  2710     cScreenResizeDelay := 0;
  2681 
  2711 
  2682     LuaGoals:= '';
  2712     LuaGoals:= '';
       
  2713     cMapName:= '';
  2683 
  2714 
  2684     LuaTemplateNumber:= 0;
  2715     LuaTemplateNumber:= 0;
  2685     hiddenHedgehogsNumber:=0;
  2716     hiddenHedgehogsNumber:=0;
  2686 end;
  2717 end;
  2687 
  2718 
  2688 procedure freeModule;
  2719 procedure freeModule;
  2689 begin
  2720 begin
  2690     // re-init flags so they will always contain safe values
       
  2691     cScreenWidth    := 1024;
       
  2692     cScreenHeight   := 768;
       
  2693     cBits           := 32;
       
  2694     ipcPort         := 0;
       
  2695     cFullScreen     := false;
       
  2696     cLocaleFName    := 'en.txt';
       
  2697     cTimerInterval  := 8;
       
  2698     PathPrefix      := './';
       
  2699     UserPathPrefix  := './';
       
  2700     cShowFPS        := false;
       
  2701     cFlattenFlakes  := false;
       
  2702     cFlattenClouds  := false;
       
  2703     cAltDamage      := true;
       
  2704     cReducedQuality := rqNone;
       
  2705     UserNick        := '';
       
  2706     recordFileName  := '';
       
  2707     cScriptName     := '';
       
  2708     cReadyDelay     := 5000;
       
  2709     cStereoMode     := smNone;
       
  2710     GrayScale       := false;
       
  2711 end;
  2721 end;
  2712 
  2722 
  2713 end.
  2723 end.