hedgewars/uVariables.pas
changeset 7110 c91d33837b0d
parent 7103 1c1afb5a1565
child 7108 eaef11c0d039
child 7180 53ffc8853008
child 7197 5a9775b97c7e
equal deleted inserted replaced
7020:846cea23aea2 7110:c91d33837b0d
    35     cNewScreenHeight   : LongInt     = 768;
    35     cNewScreenHeight   : LongInt     = 768;
    36     cScreenResizeDelay : LongWord    = 0;
    36     cScreenResizeDelay : LongWord    = 0;
    37     cBits           : LongInt     = 32;
    37     cBits           : LongInt     = 32;
    38     ipcPort         : Word        = 0;
    38     ipcPort         : Word        = 0;
    39     cFullScreen     : boolean     = false;
    39     cFullScreen     : boolean     = false;
    40     isSoundEnabled  : boolean     = true;
       
    41     isMusicEnabled  : boolean     = false;
       
    42     cLocaleFName    : shortstring = 'en.txt';
    40     cLocaleFName    : shortstring = 'en.txt';
    43     cLocale         : shortstring = 'en';
    41     cLocale         : shortstring = 'en';
    44     cInitVolume     : LongInt     = 100;
       
    45     cTimerInterval  : LongInt     = 8;
    42     cTimerInterval  : LongInt     = 8;
    46     PathPrefix      : shortstring = './';
    43     PathPrefix      : shortstring = './';
    47     UserPathPrefix  : shortstring = './';
    44     UserPathPrefix  : shortstring = './';
    48     cShowFPS        : boolean     = false;
    45     cShowFPS        : boolean     = false;
    49     cFlattenFlakes  : boolean     = false;
    46     cFlattenFlakes  : boolean     = false;
    51     cAltDamage      : boolean     = true;
    48     cAltDamage      : boolean     = true;
    52     cReducedQuality : LongWord    = rqNone;
    49     cReducedQuality : LongWord    = rqNone;
    53     UserNick        : shortstring = '';
    50     UserNick        : shortstring = '';
    54     recordFileName  : shortstring = '';
    51     recordFileName  : shortstring = '';
    55     cReadyDelay     : Longword    = 5000;
    52     cReadyDelay     : Longword    = 5000;
    56     cLogfileBase    : shortstring = 'debug';
       
    57     cStereoMode     : TStereoMode = smNone;
    53     cStereoMode     : TStereoMode = smNone;
    58     cOnlyStats      : boolean = False;
    54     cOnlyStats      : boolean = False;
    59 //////////////////////////
    55 //////////////////////////
    60     cMapName        : shortstring = '';
    56     cMapName        : shortstring = '';
    61 
    57 
    62     alsoShutdownFrontend: boolean = false;
       
    63 
       
    64     isCursorVisible : boolean;
    58     isCursorVisible : boolean;
    65     isTerminated    : boolean;
       
    66     isInLag         : boolean;
    59     isInLag         : boolean;
    67     isPaused        : boolean;
    60     isPaused        : boolean;
    68 
       
    69     isSEBackup      : boolean;
       
    70     isInMultiShoot  : boolean;
    61     isInMultiShoot  : boolean;
    71     isSpeed         : boolean;
    62     isSpeed         : boolean;
    72     isFirstFrame    : boolean;
       
    73 
    63 
    74     fastUntilLag    : boolean;
    64     fastUntilLag    : boolean;
    75     autoCameraOn    : boolean;
    65     autoCameraOn    : boolean;
    76 
    66 
       
    67     GameTicks       : LongWord;
    77     GameState       : TGameState;
    68     GameState       : TGameState;
    78     GameType        : TGameType;
    69     GameType        : TGameType;
    79     InputMask       : LongWord;
    70     InputMask       : LongWord;
    80     GameFlags       : Longword;
    71     GameFlags       : Longword;
    81     TurnTimeLeft    : Longword;
    72     TurnTimeLeft    : Longword;
   106     ZoomValue        : GLfloat;
    97     ZoomValue        : GLfloat;
   107 
    98 
   108     cWaterLine       : Word;
    99     cWaterLine       : Word;
   109     cGearScrEdgesDist: LongInt;
   100     cGearScrEdgesDist: LongInt;
   110 
   101 
   111     GameTicks   : LongWord;
       
   112 
       
   113     // originally typed consts
   102     // originally typed consts
   114     CharArray: array[byte] of Char;
       
   115     LastTint: Longword;
       
   116     SocketString: shortstring;
       
   117     VGCounter: Longword;
       
   118     PrevX: LongInt;
       
   119     timedelta: Longword;
       
   120     StartTicks: Longword;
       
   121     Counter: Longword;
       
   122     StepTicks: LongWord;
       
   123     ExplosionBorderColor: LongWord;
   103     ExplosionBorderColor: LongWord;
   124     WaterOpacity: byte;
   104     WaterOpacity: byte;
   125     SDWaterOpacity: byte;
   105     SDWaterOpacity: byte;
   126     prevGState: TGameState;
       
   127     GrayScale: Boolean;
   106     GrayScale: Boolean;
   128 
   107 
   129     // originally from uConsts
   108     // originally from uConsts
   130     Pathz: array[TPathType] of shortstring;
   109     Pathz: array[TPathType] of shortstring;
   131     UserPathz: array[TPathType] of shortstring;
   110     UserPathz: array[TPathType] of shortstring;
   132     CountTexz: array[0..Pred(AMMO_INFINITE)] of PTexture;
   111     CountTexz: array[0..Pred(AMMO_INFINITE)] of PTexture;
   133     LAND_WIDTH       : Word;
   112     LAND_WIDTH       : Word;
   134     LAND_HEIGHT      : Word;
   113     LAND_HEIGHT      : Word;
   135     LAND_WIDTH_MASK  : LongWord;
   114     LAND_WIDTH_MASK  : LongWord;
   136     LAND_HEIGHT_MASK : LongWord;
   115     LAND_HEIGHT_MASK : LongWord;
   137     cMaxCaptions     : LongInt;
       
   138 
   116 
   139     cLeftScreenBorder     : LongInt;
   117     cLeftScreenBorder     : LongInt;
   140     cRightScreenBorder    : LongInt;
   118     cRightScreenBorder    : LongInt;
   141     cScreenSpace          : Longword;
   119     cScreenSpace          : Longword;
   142 
   120 
   151     cInactDelay     : Longword;
   129     cInactDelay     : Longword;
   152 
   130 
   153     bBetweenTurns   : boolean;
   131     bBetweenTurns   : boolean;
   154     bWaterRising    : boolean;
   132     bWaterRising    : boolean;
   155 
   133 
   156     //ShowCrosshair   : boolean;  This variable is inconvenient to set.  Easier to decide when rendering
       
   157     CrosshairX      : LongInt;
   134     CrosshairX      : LongInt;
   158     CrosshairY      : LongInt;
   135     CrosshairY      : LongInt;
   159     CursorMovementX : LongInt;
   136     CursorMovementX : LongInt;
   160     CursorMovementY : LongInt;
   137     CursorMovementY : LongInt;
   161     cDrownSpeed     : hwFloat;
   138     cDrownSpeed     : hwFloat;
   182     RealTicks       : Longword;
   159     RealTicks       : Longword;
   183     AttackBar       : LongInt;
   160     AttackBar       : LongInt;
   184 
   161 
   185     WaterColorArray : array[0..3] of HwColor4f;
   162     WaterColorArray : array[0..3] of HwColor4f;
   186     SDWaterColorArray : array[0..3] of HwColor4f;
   163     SDWaterColorArray : array[0..3] of HwColor4f;
   187     SDMusic         : shortstring;
       
   188     SDTint          : LongInt;
   164     SDTint          : LongInt;
   189 
   165 
   190     CursorPoint     : TPoint;
   166     CursorPoint     : TPoint;
   191     TargetPoint     : TPoint;
   167     TargetPoint     : TPoint;
   192 
   168 
   194     ScreenFadeValue : LongInt;
   170     ScreenFadeValue : LongInt;
   195     ScreenFadeSpeed : LongInt;
   171     ScreenFadeSpeed : LongInt;
   196 
   172 
   197     Theme           : shortstring;
   173     Theme           : shortstring;
   198     disableLandBack : boolean;
   174     disableLandBack : boolean;
   199     conversionFormat: PSDL_PixelFormat;
       
   200 
       
   201 {$IFDEF SDL13}
       
   202     SDLwindow       : PSDL_Window;
       
   203     SDLGLcontext    : PSDL_GLContext;
       
   204 {$ENDIF}
       
   205 
   175 
   206     WorldDx: LongInt;
   176     WorldDx: LongInt;
   207     WorldDy: LongInt;
   177     WorldDy: LongInt;
   208 
   178 
   209     hiTicks: Word;
   179     hiTicks: Word;
   228 
   198 
   229     arrowUp, arrowDown, arrowLeft, arrowRight : TOnScreenWidget;
   199     arrowUp, arrowDown, arrowLeft, arrowRight : TOnScreenWidget;
   230     firebutton, jumpWidget, AMWidget          : TOnScreenWidget;
   200     firebutton, jumpWidget, AMWidget          : TOnScreenWidget;
   231     pauseButton, utilityWidget                : TOnScreenWidget;
   201     pauseButton, utilityWidget                : TOnScreenWidget;
   232 {$ENDIF}
   202 {$ENDIF}
   233     AMAnimType      : LongInt;
   203 
   234 
   204 
   235 
   205 var
   236 const
       
   237     // these consts are here because they would cause circular dependencies in uConsts/uTypes
   206     // these consts are here because they would cause circular dependencies in uConsts/uTypes
   238     cPathz: array[TPathType] of shortstring = (
   207     cPathz: array[TPathType] of shortstring = (
   239         '',                              // ptNone
   208         '',                              // ptNone
   240         '',                              // ptData
   209         '',                              // ptData
   241         'Graphics',                      // ptGraphics
   210         'Graphics',                      // ptGraphics
  2285             (NameId: sidLandGun;
  2254             (NameId: sidLandGun;
  2286             NameTex: nil;
  2255             NameTex: nil;
  2287             Probability: 20;
  2256             Probability: 20;
  2288             NumberInCase: 1;
  2257             NumberInCase: 1;
  2289             Ammo: (Propz: ammoprop_NoRoundEnd or
  2258             Ammo: (Propz: ammoprop_NoRoundEnd or
  2290                           ammoprop_NeedTarget or
       
  2291                           ammoprop_Utility;
  2259                           ammoprop_Utility;
  2292                 Count: 1;
  2260                 Count: 1;
  2293                 NumPerTurn: 0;
  2261                 NumPerTurn: 0;
  2294                 Timer: 5001;
  2262                 Timer: 5001;
  2295                 Pos: 0;
  2263                 Pos: 0;
  2316                           ammoprop_DontHold;
  2284                           ammoprop_DontHold;
  2317                 Count: 1;
  2285                 Count: 1;
  2318                 NumPerTurn: 0;
  2286                 NumPerTurn: 0;
  2319                 Timer: 5001;
  2287                 Timer: 5001;
  2320                 Pos: 0;
  2288                 Pos: 0;
  2321                 AmmoType: amFlamethrower;
  2289                 AmmoType: amIceGun;
  2322                 AttackVoice: sndNone;
  2290                 AttackVoice: sndNone;
  2323                 Bounciness: 1000);
  2291                 Bounciness: 1000);
  2324             Slot: 2;
  2292             Slot: 6;
  2325             TimeAfterTurn: 0;
  2293             TimeAfterTurn: 0;
  2326             minAngle: 0;
  2294             minAngle: 0;
  2327             maxAngle: 0;
  2295             maxAngle: 0;
  2328             isDamaging: true;
  2296             isDamaging: true;
  2329             SkipTurns: 0;
  2297             SkipTurns: 0;
  2404     Land: TCollisionArray;
  2372     Land: TCollisionArray;
  2405     LandPixels: TLandArray;
  2373     LandPixels: TLandArray;
  2406     LandDirty: TDirtyTag;
  2374     LandDirty: TDirtyTag;
  2407     hasBorder: boolean;
  2375     hasBorder: boolean;
  2408     hasGirders: boolean;
  2376     hasGirders: boolean;
  2409     isMap: boolean;
       
  2410     playHeight, playWidth, leftX, rightX, topY, MaxHedgehogs: Longword;  // idea is that a template can specify height/width.  Or, a map, a height/width by the dimensions of the image.  If the map has pixels near top of image, it triggers border.
  2377     playHeight, playWidth, leftX, rightX, topY, MaxHedgehogs: Longword;  // idea is that a template can specify height/width.  Or, a map, a height/width by the dimensions of the image.  If the map has pixels near top of image, it triggers border.
  2411     LandBackSurface: PSDL_Surface;
  2378     LandBackSurface: PSDL_Surface;
  2412     digest: shortstring;
       
  2413     CurAmmoGear: PGear;
  2379     CurAmmoGear: PGear;
  2414     lastGearByUID: PGear;
  2380     lastGearByUID: PGear;
  2415     GearsList: PGear;
  2381     GearsList: PGear;
  2416     AllInactive: boolean;
  2382     AllInactive: boolean;
  2417     PrvInactive: boolean;
  2383     PrvInactive: boolean;
  2418     KilledHHs: Longword;
  2384     KilledHHs: Longword;
  2419     SuddenDeath: Boolean;
  2385     SuddenDeath: Boolean;
  2420     SuddenDeathDmg: Boolean;
  2386     SuddenDeathDmg: Boolean;
  2421     SpeechType: Longword;
  2387     SpeechType: Longword;
  2422     SpeechText: shortstring;
  2388     SpeechText: shortstring;
  2423     skipFlag: boolean;
       
  2424     PlacingHogs: boolean; // a convenience flag to indicate placement of hogs is still in progress
  2389     PlacingHogs: boolean; // a convenience flag to indicate placement of hogs is still in progress
  2425     StepSoundTimer: LongInt;
  2390     StepSoundTimer: LongInt;
  2426     StepSoundChannel: LongInt;
  2391     StepSoundChannel: LongInt;
  2427 
  2392 
  2428     CurrentTeam: PTeam;
  2393     CurrentTeam: PTeam;
  2434     ClansCount: Longword;
  2399     ClansCount: Longword;
  2435     LocalClan: LongInt;  // last non-bot, non-extdriven clan
  2400     LocalClan: LongInt;  // last non-bot, non-extdriven clan
  2436     LocalTeam: LongInt;  // last non-bot, non-extdriven clan first team
  2401     LocalTeam: LongInt;  // last non-bot, non-extdriven clan first team
  2437     LocalAmmo: LongInt;  // last non-bot, non-extdriven clan's first team's ammo index, updated to next upcoming hog for per-hog-ammo
  2402     LocalAmmo: LongInt;  // last non-bot, non-extdriven clan's first team's ammo index, updated to next upcoming hog for per-hog-ammo
  2438     CurMinAngle, CurMaxAngle: Longword;
  2403     CurMinAngle, CurMaxAngle: Longword;
  2439     GameOver: boolean;
       
  2440     NextClan: boolean;
  2404     NextClan: boolean;
  2441 
  2405 
  2442     FollowGear: PGear;
  2406     FollowGear: PGear;
  2443     WindBarWidth: LongInt;
  2407     WindBarWidth: LongInt;
  2444     bShowAmmoMenu: boolean;
  2408     bShowAmmoMenu: boolean;
  2455     cOffsetY: LongInt;
  2419     cOffsetY: LongInt;
  2456     AFRToggle: Boolean;
  2420     AFRToggle: Boolean;
  2457     bAFRRight: Boolean;
  2421     bAFRRight: Boolean;
  2458 
  2422 
  2459 
  2423 
  2460     SDLPrimSurface: PSDL_Surface;
       
  2461     PauseTexture,
  2424     PauseTexture,
  2462     SyncTexture,
  2425     SyncTexture,
  2463     ConfirmTexture: PTexture;
  2426     ConfirmTexture: PTexture;
  2464     cScaleFactor: GLfloat;
  2427     cScaleFactor: GLfloat;
  2465     SupportNPOTT: Boolean;
  2428     SupportNPOTT: Boolean;
  2495     //ControllerBalls: array[0..5] of array[0..19] of array[0..1] of Integer;
  2458     //ControllerBalls: array[0..5] of array[0..19] of array[0..1] of Integer;
  2496     ControllerHats: array[0..5] of array[0..19] of Byte;
  2459     ControllerHats: array[0..5] of array[0..19] of Byte;
  2497     ControllerButtons: array[0..5] of array[0..19] of Byte;
  2460     ControllerButtons: array[0..5] of array[0..19] of Byte;
  2498 
  2461 
  2499     DefaultBinds : TBinds;
  2462     DefaultBinds : TBinds;
       
  2463 
       
  2464     lastTurnChecksum : Longword;
  2500 
  2465 
  2501 var trammo:  array[TAmmoStrId] of ansistring;   // name of the weapon
  2466 var trammo:  array[TAmmoStrId] of ansistring;   // name of the weapon
  2502     trammoc: array[TAmmoStrId] of ansistring;   // caption of the weapon
  2467     trammoc: array[TAmmoStrId] of ansistring;   // caption of the weapon
  2503     trammod: array[TAmmoStrId] of ansistring;   // description of the weapon
  2468     trammod: array[TAmmoStrId] of ansistring;   // description of the weapon
  2504     trmsg:   array[TMsgStrId]  of ansistring;   // message of the event
  2469     trmsg:   array[TMsgStrId]  of ansistring;   // message of the event
  2545     SDWaterColorArray[2].b := 169;
  2510     SDWaterColorArray[2].b := 169;
  2546     SDWaterColorArray[2].a := 255;
  2511     SDWaterColorArray[2].a := 255;
  2547     SDWaterColorArray[1]:= SDWaterColorArray[0];
  2512     SDWaterColorArray[1]:= SDWaterColorArray[0];
  2548     SDWaterColorArray[3]:= SDWaterColorArray[2];
  2513     SDWaterColorArray[3]:= SDWaterColorArray[2];
  2549 
  2514 
  2550     SDMusic:= 'hell.ogg';
       
  2551     SDTint:= $80;
  2515     SDTint:= $80;
  2552 
  2516 
  2553     cDrownSpeed.QWordValue  := 257698038;       // 0.06
  2517     cDrownSpeed.QWordValue  := 257698038;       // 0.06
  2554     cDrownSpeedf            := 0.06;
  2518     cDrownSpeedf            := 0.06;
  2555     cMaxWindSpeed.QWordValue:= 1073742;     // 0.00025
  2519     cMaxWindSpeed.QWordValue:= 1073742;     // 0.00025
  2606     cArtillery      := false;
  2570     cArtillery      := false;
  2607     flagMakeCapture := false;
  2571     flagMakeCapture := false;
  2608     bBetweenTurns   := false;
  2572     bBetweenTurns   := false;
  2609     bWaterRising    := false;
  2573     bWaterRising    := false;
  2610     isCursorVisible := false;
  2574     isCursorVisible := false;
  2611     isTerminated    := false;
       
  2612     isInLag         := false;
  2575     isInLag         := false;
  2613     isPaused        := false;
  2576     isPaused        := false;
  2614     isInMultiShoot  := false;
  2577     isInMultiShoot  := false;
  2615     isSpeed         := false;
  2578     isSpeed         := false;
  2616     fastUntilLag    := false;
  2579     fastUntilLag    := false;
  2617     isFirstFrame    := true;
       
  2618     isSEBackup      := true;
       
  2619     autoCameraOn    := true;
  2580     autoCameraOn    := true;
  2620     cScriptName     := '';
  2581     cScriptName     := '';
  2621     cSeed           := '';
  2582     cSeed           := '';
  2622     cVolumeDelta    := 0;
  2583     cVolumeDelta    := 0;
  2623     cHasFocus       := true;
  2584     cHasFocus       := true;
  2626     
  2587     
  2627     disableLandBack := false;
  2588     disableLandBack := false;
  2628 
  2589 
  2629     ScreenFade      := sfNone;
  2590     ScreenFade      := sfNone;
  2630 
  2591 
  2631 {$IFDEF SDL13}
       
  2632     SDLwindow       := nil;
       
  2633     SDLGLcontext    := nil;
       
  2634 {$ENDIF}
       
  2635 
       
  2636     // those values still are not perfect
  2592     // those values still are not perfect
  2637     cLeftScreenBorder:= round(-cMinZoomLevel * cScreenWidth);
  2593     cLeftScreenBorder:= round(-cMinZoomLevel * cScreenWidth);
  2638     cRightScreenBorder:= round(cMinZoomLevel * cScreenWidth + LAND_WIDTH);
  2594     cRightScreenBorder:= round(cMinZoomLevel * cScreenWidth + LAND_WIDTH);
  2639     cScreenSpace:= cRightScreenBorder - cLeftScreenBorder;
  2595     cScreenSpace:= cRightScreenBorder - cLeftScreenBorder;
  2640 
       
  2641     if isPhone() then
       
  2642         cMaxCaptions:= 3
       
  2643     else
       
  2644         cMaxCaptions:= 4;
       
  2645 
  2596 
  2646     vobFrameTicks:= 99999;
  2597     vobFrameTicks:= 99999;
  2647     vobFramesCount:= 4;
  2598     vobFramesCount:= 4;
  2648     vobCount:= 0;
  2599     vobCount:= 0;
  2649     vobVelocity:= 10;
  2600     vobVelocity:= 10;
  2653     vobSDFramesCount:= 4;
  2604     vobSDFramesCount:= 4;
  2654     vobSDCount:= 30 * cScreenSpace div LAND_WIDTH;
  2605     vobSDCount:= 30 * cScreenSpace div LAND_WIDTH;
  2655     vobSDVelocity:= 15;
  2606     vobSDVelocity:= 15;
  2656     vobSDFallSpeed:= 250;
  2607     vobSDFallSpeed:= 250;
  2657 
  2608 
  2658     PrevX:= 0;
       
  2659     timedelta:= 0;
       
  2660     Counter:= 0;
       
  2661     StepTicks:= 0;
       
  2662     ExplosionBorderColor:= $FF808080;
  2609     ExplosionBorderColor:= $FF808080;
  2663     WaterOpacity:= $80;
  2610     WaterOpacity:= $80;
  2664     SDWaterOpacity:= $80;
  2611     SDWaterOpacity:= $80;
  2665     prevGState:= gsConfirm;
       
  2666     GrayScale:= false;
  2612     GrayScale:= false;
  2667 
  2613 
  2668     LuaGoals:= '';
  2614     LuaGoals:= '';
  2669 end;
  2615 end;
  2670 
  2616 
  2674     cScreenWidth    := 1024;
  2620     cScreenWidth    := 1024;
  2675     cScreenHeight   := 768;
  2621     cScreenHeight   := 768;
  2676     cBits           := 32;
  2622     cBits           := 32;
  2677     ipcPort         := 0;
  2623     ipcPort         := 0;
  2678     cFullScreen     := false;
  2624     cFullScreen     := false;
  2679     isSoundEnabled  := true;
       
  2680     isMusicEnabled  := false;
       
  2681     cLocaleFName    := 'en.txt';
  2625     cLocaleFName    := 'en.txt';
  2682     cInitVolume     := 100;
       
  2683     cTimerInterval  := 8;
  2626     cTimerInterval  := 8;
  2684     PathPrefix      := './';
  2627     PathPrefix      := './';
  2685     UserPathPrefix  := './';
  2628     UserPathPrefix  := './';
  2686     cShowFPS        := false;
  2629     cShowFPS        := false;
  2687     cFlattenFlakes  := false;
  2630     cFlattenFlakes  := false;