hedgewars/uVariables.pas
branchsdl2transition
changeset 11342 ed5a6478e710
parent 11317 62287d4044e7
child 11343 9006e158a81f
equal deleted inserted replaced
11340:31570b766315 11342:ed5a6478e710
     1 (*
     1 (*
     2  * Hedgewars, a free turn based strategy game
     2  * Hedgewars, a free turn based strategy game
     3  * Copyright (c) 2004-2013 Andrey Korotaev <unC0Rr@gmail.com>
     3  * Copyright (c) 2004-2015 Andrey Korotaev <unC0Rr@gmail.com>
     4  *
     4  *
     5  * This program is free software; you can redistribute it and/or modify
     5  * This program is free software; you can redistribute it and/or modify
     6  * it under the terms of the GNU General Public License as published by
     6  * it under the terms of the GNU General Public License as published by
     7  * the Free Software Foundation; version 2 of the License
     7  * the Free Software Foundation; version 2 of the License
     8  *
     8  *
    11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    12  * GNU General Public License for more details.
    12  * GNU General Public License for more details.
    13  *
    13  *
    14  * You should have received a copy of the GNU General Public License
    14  * You should have received a copy of the GNU General Public License
    15  * along with this program; if not, write to the Free Software
    15  * along with this program; if not, write to the Free Software
    16  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
    16  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
    17  *)
    17  *)
    18 
    18 
    19 {$INCLUDE "options.inc"}
    19 {$INCLUDE "options.inc"}
    20 
    20 
    21 unit uVariables;
    21 unit uVariables;
    22 interface
    22 interface
    23 
    23 
    24 uses SDLh, uTypes, uFloat, GLunit, uConsts, Math;
    24 uses SDLh, uTypes, uFloat, GLunit, uConsts, Math, uUtils{$IFDEF GL2}, uMatrix{$ENDIF};
    25 
    25 
    26 var
    26 var
    27 /////// init flags ///////
    27 /////// init flags ///////
    28     cMinScreenWidth    : LongInt;
    28     cMinScreenWidth    : LongInt;
    29     cMinScreenHeight   : LongInt;
    29     cMinScreenHeight   : LongInt;
    35     cScreenHeight      : LongInt;
    35     cScreenHeight      : LongInt;
    36     cNewScreenWidth    : LongInt;
    36     cNewScreenWidth    : LongInt;
    37     cNewScreenHeight   : LongInt;
    37     cNewScreenHeight   : LongInt;
    38     cScreenResizeDelay : LongWord;
    38     cScreenResizeDelay : LongWord;
    39     ipcPort            : Word;
    39     ipcPort            : Word;
       
    40     AprilOne           : boolean;
    40     cFullScreen        : boolean;
    41     cFullScreen        : boolean;
    41     cLocaleFName       : shortstring;
    42     cLocaleFName       : shortstring;
    42     cLocale            : shortstring;
    43     cLocale            : shortstring;
    43     cTimerInterval     : LongInt;
    44     cTimerInterval     : LongInt;
    44     PathPrefix         : shortstring;
    45     PathPrefix         : ansistring;
    45     UserPathPrefix     : shortstring;
    46     UserPathPrefix     : ansistring;
    46     cShowFPS           : boolean;
    47     cShowFPS           : boolean;
    47     cFlattenFlakes     : boolean;
    48     cFlattenFlakes     : boolean;
    48     cFlattenClouds     : boolean;
    49     cFlattenClouds     : boolean;
    49     cIce               : boolean;
    50     cIce               : boolean;
    50     cSnow              : boolean;
    51     cSnow              : boolean;
    95     ReadyTimeLeft   : Longword;
    96     ReadyTimeLeft   : Longword;
    96     cSuddenDTurns   : LongInt;
    97     cSuddenDTurns   : LongInt;
    97     cDamagePercent  : LongInt;
    98     cDamagePercent  : LongInt;
    98     cMineDudPercent : LongWord;
    99     cMineDudPercent : LongWord;
    99     cTemplateFilter : LongInt;
   100     cTemplateFilter : LongInt;
   100     cMapGen         : LongInt;
   101     cFeatureSize    : LongInt;
       
   102     cMapGen         : TMapGen;
   101     cRopePercent    : LongWord;
   103     cRopePercent    : LongWord;
   102     cGetAwayTime    : LongWord;
   104     cGetAwayTime    : LongWord;
       
   105 
       
   106     cAdvancedMapGenMode: boolean;
   103 
   107 
   104     cHedgehogTurnTime: Longword;
   108     cHedgehogTurnTime: Longword;
   105     cMinesTime       : LongInt;
   109     cMinesTime       : LongInt;
   106     cMaxAIThinkTime  : Longword;
   110     cMaxAIThinkTime  : Longword;
   107 
   111 
   120     cWaterLine       : LongInt;
   124     cWaterLine       : LongInt;
   121     cGearScrEdgesDist: LongInt;
   125     cGearScrEdgesDist: LongInt;
   122     isAudioMuted     : boolean;
   126     isAudioMuted     : boolean;
   123 
   127 
   124     // originally typed consts
   128     // originally typed consts
   125     ExplosionBorderColor: LongWord;
   129     ExplosionBorderColorR,
       
   130     ExplosionBorderColorG,
       
   131     ExplosionBorderColorB,
       
   132     ExplosionBorderColorNoA,
       
   133     ExplosionBorderColor:  LongWord;
   126     IceColor            : LongWord;
   134     IceColor            : LongWord;
   127     IceEdgeColor        : LongWord;
   135     IceEdgeColor        : LongWord;
   128     WaterOpacity: byte;
   136     WaterOpacity: byte;
   129     SDWaterOpacity: byte;
   137     SDWaterOpacity: byte;
   130     GrayScale: Boolean;
   138     GrayScale: Boolean;
   133     LAND_WIDTH       : LongInt;
   141     LAND_WIDTH       : LongInt;
   134     LAND_HEIGHT      : LongInt;
   142     LAND_HEIGHT      : LongInt;
   135     LAND_WIDTH_MASK  : LongWord;
   143     LAND_WIDTH_MASK  : LongWord;
   136     LAND_HEIGHT_MASK : LongWord;
   144     LAND_HEIGHT_MASK : LongWord;
   137 
   145 
       
   146     ChefHatTexture : PTexture;
   138     CrosshairTexture : PTexture;
   147     CrosshairTexture : PTexture;
   139     GenericHealthTexture : PTexture;
   148     GenericHealthTexture : PTexture;
   140 
   149 
   141     cLeftScreenBorder     : LongInt;
   150     cLeftScreenBorder     : LongInt;
   142     cRightScreenBorder    : LongInt;
   151     cRightScreenBorder    : LongInt;
   143     cScreenSpace          : Longword;
   152     cScreenSpace          : Longword;
   144 
   153 
   145     cCaseFactor     : Longword;
   154     cCaseFactor     : Longword;
   146     cLandMines      : Longword;
   155     cLandMines      : Longword;
       
   156     cAirMines       : Longword;
   147     cExplosives     : Longword;
   157     cExplosives     : Longword;
   148 
   158 
   149     cScriptName     : shortstring;
   159     cScriptName     : shortstring;
       
   160     cScriptParam    : shortstring;
   150     cSeed           : shortstring;
   161     cSeed           : shortstring;
   151     cVolumeDelta    : LongInt;
   162     cVolumeDelta    : LongInt;
   152     cHasFocus       : boolean;
   163     cHasFocus       : boolean;
   153     cInactDelay     : Longword;
   164     cInactDelay     : Longword;
   154 
   165 
   157 
   168 
   158     CrosshairX      : LongInt;
   169     CrosshairX      : LongInt;
   159     CrosshairY      : LongInt;
   170     CrosshairY      : LongInt;
   160     CursorMovementX : LongInt;
   171     CursorMovementX : LongInt;
   161     CursorMovementY : LongInt;
   172     CursorMovementY : LongInt;
       
   173     cWaveHeight     : LongInt;
   162     cDrownSpeed     : hwFloat;
   174     cDrownSpeed     : hwFloat;
   163     cDrownSpeedf    : real;
   175     cDrownSpeedf    : real;
   164     cMaxWindSpeed   : hwFloat;
   176     cMaxWindSpeed   : hwFloat;
   165     cWindSpeed      : hwFloat;
   177     cWindSpeed      : hwFloat;
   166     cWindSpeedf     : real;
   178     cWindSpeedf     : real;
   167     cElastic        : hwFloat;
   179     cElastic        : hwFloat;
   168     cGravity        : hwFloat;
   180     cGravity        : hwFloat;
   169     cGravityf       : real;
   181     cGravityf       : real;
       
   182     cBuildMaxDist   : LongInt;
   170     cDamageModifier : hwFloat;
   183     cDamageModifier : hwFloat;
   171     cLaserSighting  : boolean;
   184     cLaserSighting  : boolean;
   172     cVampiric       : boolean;
   185     cVampiric       : boolean;
   173     cArtillery      : boolean;
   186     cArtillery      : boolean;
   174     WeaponTooltipTex: PTexture;
   187     WeaponTooltipTex: PTexture;
   175     AmmoMenuInvalidated: boolean;
   188     AmmoMenuInvalidated: boolean;
   176     AmmoRect		: TSDL_Rect;
   189     AmmoRect        : TSDL_Rect;
   177     HHTexture       : PTexture;
   190     HHTexture       : PTexture;
   178     cMaxZoomLevel   : real;
   191     cMaxZoomLevel   : real;
   179     cMinZoomLevel   : real;
   192     cMinZoomLevel   : real;
   180     cZoomDelta      : real;
   193     cZoomDelta      : real;
   181     cMinMaxZoomLevelDelta : real;
   194     cMinMaxZoomLevelDelta : real;
   182 
   195 
   183 
   196 
   184     flagMakeCapture : boolean;
   197     flagMakeCapture : boolean;
       
   198     flagDumpLand    : boolean;
   185 
   199 
   186     InitStepsFlags  : Longword;
   200     InitStepsFlags  : Longword;
   187     RealTicks       : Longword;
   201     RealTicks       : Longword;
   188     AttackBar       : LongInt;
   202     AttackBar       : LongInt;
   189 
   203 
   190     WaterColorArray : array[0..3] of HwColor4f;
   204     WaterColorArray : array[0..7] of HwColor4f;
   191     SDWaterColorArray : array[0..3] of HwColor4f;
   205     SDWaterColorArray : array[0..7] of HwColor4f;
   192     SDTint          : LongInt;
   206     SDTint          : LongInt;
   193 
   207 
   194     TargetCursorPoint     : TPoint;
   208     TargetCursorPoint     : TPoint;
   195     CursorPoint           : TPoint;
   209     CursorPoint           : TPoint;
   196     TargetPoint           : TPoint;
   210     TargetPoint           : TPoint;
   206     disableLandBack : boolean;
   220     disableLandBack : boolean;
   207 
   221 
   208     WorldDx: LongInt;
   222     WorldDx: LongInt;
   209     WorldDy: LongInt;
   223     WorldDy: LongInt;
   210 
   224 
       
   225     SpeechHogNumber: LongInt;
       
   226 
       
   227     // for tracking the limits of the visible grid based on cScaleFactor
       
   228     ViewLeftX, ViewRightX, ViewBottomY, ViewTopY, ViewWidth, ViewHeight: LongInt;
       
   229 
       
   230     // for debugging the view limits visually
       
   231     cViewLimitsDebug: boolean;
       
   232 
       
   233     dirtyLandTexCount: LongInt;
       
   234 
   211     hiTicks: Word;
   235     hiTicks: Word;
   212 
   236 
   213     LuaGoals        : shortstring;
   237     LuaGoals        : shortstring;
   214 
   238 
   215     LuaTemplateNumber : LongWord;
   239     LuaTemplateNumber : LongWord;
   216 
   240 
   217     LastVoice : TVoice = ( snd: sndNone; voicepack: nil );
   241     LastVoice : TVoice;
   218 
   242 
   219     mobileRecord: TMobileRecord;
   243     mobileRecord: TMobileRecord;
       
   244 
       
   245     MaxTextureSize: LongInt;
       
   246 
       
   247     ChatPasteBuffer: shortstring;
   220 
   248 
   221 /////////////////////////////////////
   249 /////////////////////////////////////
   222 //Buttons
   250 //Buttons
   223 {$IFDEF USE_TOUCH_INTERFACE}
   251 {$IFDEF USE_TOUCH_INTERFACE}
   224     buttonScale: GLFloat;
   252     buttonScale: GLFloat;
   229 {$ENDIF}
   257 {$ENDIF}
   230 
   258 
   231 
   259 
   232 var
   260 var
   233     // these consts are here because they would cause circular dependencies in uConsts/uTypes
   261     // these consts are here because they would cause circular dependencies in uConsts/uTypes
   234     cPathz: array[TPathType] of shortstring = (
   262     cPathz: array[TPathType] of shortstring;
       
   263 
       
   264 const
       
   265     cPathzInit: array[TPathType] of shortstring = (
   235         '',                              // ptNone
   266         '',                              // ptNone
   236         '/',                             // ptData
   267         '//',                            // ptData
   237         '/Graphics',                     // ptGraphics
   268         '/Graphics',                     // ptGraphics
   238         '/Themes',                       // ptThemes
   269         '/Themes',                       // ptThemes
   239         '/Themes/Bamboo',                // ptCurrTheme
   270         '/Themes/Bamboo',                // ptCurrTheme
   240         '/Teams',                        // ptTeams
   271         '/Teams',                        // ptTeams
   241         '/Maps',                         // ptMaps
   272         '/Maps',                         // ptMaps
   251         '/Sounds/voices',                // ptVoices
   282         '/Sounds/voices',                // ptVoices
   252         '/Graphics/Hats',                // ptHats
   283         '/Graphics/Hats',                // ptHats
   253         '/Graphics/Flags',               // ptFlags
   284         '/Graphics/Flags',               // ptFlags
   254         '/Missions/Maps',                // ptMissionMaps
   285         '/Missions/Maps',                // ptMissionMaps
   255         '/Graphics/SuddenDeath',         // ptSuddenDeath
   286         '/Graphics/SuddenDeath',         // ptSuddenDeath
   256         '/Graphics/Buttons'              // ptButton
   287         '/Graphics/Buttons',             // ptButton
       
   288         '/Shaders'                       // ptShaders
   257     );
   289     );
   258 
   290 
   259     Fontz: array[THWFont] of THHFont = (
   291 var
       
   292     Fontz: array[THWFont] of THHFont;
       
   293 
       
   294 const
       
   295     FontzInit: array[THWFont] of THHFont = (
   260             (Handle: nil;
   296             (Handle: nil;
   261             Height: 12;
   297             Height: 12;
   262             style: TTF_STYLE_NORMAL;
   298             style: TTF_STYLE_NORMAL;
   263             Name: 'DejaVuSans-Bold.ttf'),
   299             Name: 'DejaVuSans-Bold.ttf'),
   264             (Handle: nil;
   300             (Handle: nil;
   284             Name: 'wqy-zenhei.ttc')
   320             Name: 'wqy-zenhei.ttc')
   285             {$ENDIF}
   321             {$ENDIF}
   286             );
   322             );
   287 
   323 
   288 var
   324 var
   289     SpritesData: array[TSprite] of record
   325     SpritesData: array[TSprite] of TSpriteData;
   290             FileName: string[15];
   326 
   291             Path, AltPath: TPathType;
   327 const
   292             Texture: PTexture;
   328     SpritesDataInit: array[TSprite] of TSpriteData = (
   293             Surface: PSDL_Surface;
       
   294             Width, Height, imageWidth, imageHeight: LongInt;
       
   295             saveSurf: boolean;
       
   296             priority: GLfloat;
       
   297             getDimensions, getImageDimensions: boolean;
       
   298             end = (
       
   299             (FileName:  'BlueWater'; Path: ptCurrTheme;AltPath: ptGraphics; Texture: nil; Surface: nil;
   329             (FileName:  'BlueWater'; Path: ptCurrTheme;AltPath: ptGraphics; Texture: nil; Surface: nil;
   300             Width:   0; Height:  0; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: true; getImageDimensions: true),// sprWater
   330             Width:   0; Height:  0; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: true; getImageDimensions: true),// sprWater
   301             (FileName:     'Clouds'; Path: ptCurrTheme;AltPath: ptGraphics; Texture: nil; Surface: nil;
   331             (FileName:     'Clouds'; Path: ptCurrTheme;AltPath: ptGraphics; Texture: nil; Surface: nil;
   302             Width: 256; Height:128; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpHigh; getDimensions: false; getImageDimensions: true),// sprCloud
   332             Width: 256; Height:128; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpHigh; getDimensions: false; getImageDimensions: true),// sprCloud
   303             (FileName:       'Bomb'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil;
   333             (FileName:       'Bomb'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil;
   343             (FileName:      'Flame'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil;
   373             (FileName:      'Flame'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil;
   344             Width:  16; Height: 16; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpHighest; getDimensions: false; getImageDimensions: true),// sprFlame
   374             Width:  16; Height: 16; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpHighest; getDimensions: false; getImageDimensions: true),// sprFlame
   345             (FileName:   'horizont'; Path: ptCurrTheme;AltPath: ptNone; Texture: nil; Surface: nil;
   375             (FileName:   'horizont'; Path: ptCurrTheme;AltPath: ptNone; Texture: nil; Surface: nil;
   346             Width:   0; Height:  0; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpHigh; getDimensions: true; getImageDimensions: true),// sprHorizont
   376             Width:   0; Height:  0; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpHigh; getDimensions: true; getImageDimensions: true),// sprHorizont
   347             (FileName:  'horizontL'; Path: ptCurrTheme;AltPath: ptNone; Texture: nil; Surface: nil;
   377             (FileName:  'horizontL'; Path: ptCurrTheme;AltPath: ptNone; Texture: nil; Surface: nil;
   348             Width:   0; Height:  0; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpHigh; getDimensions: true; getImageDimensions: true),// sprHorizont
   378             Width:   0; Height:  0; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpHigh; getDimensions: true; getImageDimensions: true),// sprHorizontL
   349             (FileName:  'horizontR'; Path: ptCurrTheme;AltPath: ptNone; Texture: nil; Surface: nil;
   379             (FileName:  'horizontR'; Path: ptCurrTheme;AltPath: ptNone; Texture: nil; Surface: nil;
   350             Width:   0; Height:  0; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpHigh; getDimensions: true; getImageDimensions: true),// sprHorizont
   380             Width:   0; Height:  0; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpHigh; getDimensions: true; getImageDimensions: true),// sprHorizontR
   351             (FileName:        'Sky'; Path: ptCurrTheme;AltPath: ptNone; Texture: nil; Surface: nil;
   381             (FileName:        'Sky'; Path: ptCurrTheme;AltPath: ptNone; Texture: nil; Surface: nil;
   352             Width:   0; Height:  0; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpHigh; getDimensions: true; getImageDimensions: true),// sprSky
   382             Width:   0; Height:  0; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpHigh; getDimensions: true; getImageDimensions: true),// sprSky
   353             (FileName:       'SkyL'; Path: ptCurrTheme;AltPath: ptNone; Texture: nil; Surface: nil;
   383             (FileName:       'SkyL'; Path: ptCurrTheme;AltPath: ptNone; Texture: nil; Surface: nil;
   354             Width:   0; Height:  0; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpHigh; getDimensions: true; getImageDimensions: true),// sprSky
   384             Width:   0; Height:  0; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpHigh; getDimensions: true; getImageDimensions: true),// sprSkyL
   355             (FileName:       'SkyR'; Path: ptCurrTheme;AltPath: ptNone; Texture: nil; Surface: nil;
   385             (FileName:       'SkyR'; Path: ptCurrTheme;AltPath: ptNone; Texture: nil; Surface: nil;
   356             Width:   0; Height:  0; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpHigh; getDimensions: true; getImageDimensions: true),// sprSky
   386             Width:   0; Height:  0; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpHigh; getDimensions: true; getImageDimensions: true),// sprSkyR
   357             (FileName:   'Slot'; Path: ptAmmoMenu; AltPath: ptNone; Texture: nil; Surface: nil;
   387             (FileName:   'Slot'; Path: ptAmmoMenu; AltPath: ptNone; Texture: nil; Surface: nil;
   358             Width: 32; Height: 32; imageWidth: 0; imageHeight: 0; saveSurf: true; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprAMSlot
   388             Width: 32; Height: 32; imageWidth: 0; imageHeight: 0; saveSurf: true; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprAMSlot
   359             (FileName:      'Ammos'; Path: ptAmmoMenu; AltPath: ptNone; Texture: nil; Surface: nil;
   389             (FileName:      'Ammos'; Path: ptAmmoMenu; AltPath: ptNone; Texture: nil; Surface: nil;
   360             Width:  32; Height: 32; imageWidth: 0; imageHeight: 0; saveSurf: true; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprAMAmmos
   390             Width:  32; Height: 32; imageWidth: 0; imageHeight: 0; saveSurf: true; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprAMAmmos
   361             (FileName:   'Ammos_bw'; Path: ptAmmoMenu; AltPath: ptNone; Texture: nil; Surface: nil;
   391             (FileName:   'Ammos_bw'; Path: ptAmmoMenu; AltPath: ptNone; Texture: nil; Surface: nil;
   395             (FileName:      'WindR'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil;
   425             (FileName:      'WindR'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil;
   396             Width:  80; Height: 13; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprWindR
   426             Width:  80; Height: 13; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprWindR
   397 {$IFDEF USE_TOUCH_INTERFACE}
   427 {$IFDEF USE_TOUCH_INTERFACE}
   398             (FileName: 'firebutton'; Path: ptButtons; AltPath: ptNone; Texture: nil; Surface: nil;
   428             (FileName: 'firebutton'; Path: ptButtons; AltPath: ptNone; Texture: nil; Surface: nil;
   399             Width: 128; Height: 128; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpHigh; getDimensions: false; getImageDimensions: true), // sprFireButton
   429             Width: 128; Height: 128; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpHigh; getDimensions: false; getImageDimensions: true), // sprFireButton
   400             (FileName: 'arrowUp'; Path: ptButtons; AltPath: ptNone; Texture: nil; Surface: nil;
   430             (FileName: 'arrowup'; Path: ptButtons; AltPath: ptNone; Texture: nil; Surface: nil;
   401             Width: 100; Height: 100; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpHigh; getDimensions: false; getImageDimensions: true), // sprArrowUp
   431             Width: 100; Height: 100; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpHigh; getDimensions: false; getImageDimensions: true), // sprArrowUp
   402             (FileName: 'arrowDown'; Path: ptButtons; AltPath: ptNone; Texture: nil; Surface: nil;
   432             (FileName: 'arrowdown'; Path: ptButtons; AltPath: ptNone; Texture: nil; Surface: nil;
   403             Width: 100; Height: 100; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpHigh; getDimensions: false; getImageDimensions: true), // sprArrowDown
   433             Width: 100; Height: 100; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpHigh; getDimensions: false; getImageDimensions: true), // sprArrowDown
   404             (FileName: 'arrowLeft'; Path: ptButtons; AltPath: ptNone; Texture: nil; Surface: nil;
   434             (FileName: 'arrowleft'; Path: ptButtons; AltPath: ptNone; Texture: nil; Surface: nil;
   405             Width: 100; Height: 100; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpHigh; getDimensions: false; getImageDimensions: true), // sprArrowLeft
   435             Width: 100; Height: 100; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpHigh; getDimensions: false; getImageDimensions: true), // sprArrowLeft
   406             (FileName: 'arrowRight'; Path: ptButtons; AltPath: ptNone; Texture: nil; Surface: nil;
   436             (FileName: 'arrowright'; Path: ptButtons; AltPath: ptNone; Texture: nil; Surface: nil;
   407             Width: 100; Height: 100; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpHigh; getDimensions: false; getImageDimensions: true), // sprArrowRight
   437             Width: 100; Height: 100; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpHigh; getDimensions: false; getImageDimensions: true), // sprArrowRight
   408             (FileName: 'forwardjump'; Path: ptButtons; AltPath: ptNone; Texture: nil; Surface: nil;
   438             (FileName: 'forwardjump'; Path: ptButtons; AltPath: ptNone; Texture: nil; Surface: nil;
   409             Width: 128; Height: 128; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpHigh; getDimensions: false; getImageDimensions: true), // sprAMWidget
   439             Width: 128; Height: 128; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpHigh; getDimensions: false; getImageDimensions: true), // sprAMWidget
   410             (FileName: 'backjump'; Path: ptButtons; AltPath: ptNone; Texture: nil; Surface: nil;
   440             (FileName: 'backjump'; Path: ptButtons; AltPath: ptNone; Texture: nil; Surface: nil;
   411             Width: 128; Height: 128; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpHigh; getDimensions: false; getImageDimensions: true), // sprJumpWidget
   441             Width: 128; Height: 128; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpHigh; getDimensions: false; getImageDimensions: true), // sprJumpWidget
   412             (FileName: 'pause'; Path: ptButtons; AltPath: ptNone; Texture: nil; Surface: nil;
   442             (FileName: 'pause'; Path: ptButtons; AltPath: ptNone; Texture: nil; Surface: nil;
   413             Width: 120; Height: 100; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpHigh; getDimensions: false; getImageDimensions: true), // sprPauseButton
   443             Width: 120; Height: 100; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpHigh; getDimensions: false; getImageDimensions: true), // sprPauseButton
   414             (FileName: 'pause'; Path: ptButtons; AltPath: ptNone; Texture: nil; Surface: nil;//TODO correct image
   444             (FileName: 'timerbutton'; Path: ptButtons; AltPath: ptNone; Texture: nil; Surface: nil;
   415             Width: 120; Height: 128; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpHigh; getDimensions: false; getImageDimensions: true), // sprTimerButton
   445             Width: 128; Height: 128; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpHigh; getDimensions: false; getImageDimensions: true), // sprTimerButton
   416             (FileName: 'forwardjump'; Path: ptButtons; AltPath: ptNone; Texture: nil; Surface: nil;//TODO correct image
   446             (FileName: 'targetbutton'; Path: ptButtons; AltPath: ptNone; Texture: nil; Surface: nil;
   417             Width: 120; Height: 128; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpHigh; getDimensions: false; getImageDimensions: true), // sprTargetButton
   447             Width: 128; Height: 128; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpHigh; getDimensions: false; getImageDimensions: true), // sprTargetButton
       
   448             (FileName: 'switchbutton'; Path: ptButtons; AltPath: ptNone; Texture: nil; Surface: nil;
       
   449             Width: 128; Height: 128; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpHigh; getDimensions: false; getImageDimensions: true), // sprSwitchButton
   418 {$ENDIF}
   450 {$ENDIF}
   419             (FileName:      'Flake'; Path:ptCurrTheme; AltPath: ptNone; Texture: nil; Surface: nil;
   451             (FileName:      'Flake'; Path:ptCurrTheme; AltPath: ptNone; Texture: nil; Surface: nil;
   420             Width:  64; Height: 64; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpHighest; getDimensions: false; getImageDimensions: true),// sprFlake
   452             Width:  64; Height: 64; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpHighest; getDimensions: false; getImageDimensions: true),// sprFlake
   421             (FileName:     'amRope'; Path: ptHedgehog; AltPath: ptNone; Texture: nil; Surface: nil;
   453             (FileName:     'amRope'; Path: ptHedgehog; AltPath: ptNone; Texture: nil; Surface: nil;
   422             Width:  32; Height: 32; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprHandRope
   454             Width:  32; Height: 32; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprHandRope
   663             Width: 256; Height:128; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpHigh; getDimensions: false; getImageDimensions: true),// sprSDCloud
   695             Width: 256; Height:128; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpHigh; getDimensions: false; getImageDimensions: true),// sprSDCloud
   664             (FileName:   'SDSplash'; Path: ptCurrTheme; AltPath: ptSuddenDeath; Texture: nil; Surface: nil;
   696             (FileName:   'SDSplash'; Path: ptCurrTheme; AltPath: ptSuddenDeath; Texture: nil; Surface: nil;
   665             Width:  80; Height: 50; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprSDSplash
   697             Width:  80; Height: 50; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprSDSplash
   666             (FileName:  'SDDroplet'; Path: ptCurrTheme; AltPath: ptSuddenDeath; Texture: nil; Surface: nil;
   698             (FileName:  'SDDroplet'; Path: ptCurrTheme; AltPath: ptSuddenDeath; Texture: nil; Surface: nil;
   667             Width:  16; Height: 16; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpHighest; getDimensions: false; getImageDimensions: true),// sprSDDroplet
   699             Width:  16; Height: 16; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpHighest; getDimensions: false; getImageDimensions: true),// sprSDDroplet
   668             (FileName:  'TARDIS'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil;
   700             (FileName:  'Timebox'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil;
   669             Width:  48; Height: 79; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpHighest; getDimensions: false; getImageDimensions: true),// sprTardis
   701             Width:  50; Height: 81; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpHighest; getDimensions: false; getImageDimensions: true),// sprTardis
   670             (FileName:  'slider'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil;
   702             (FileName:  'slider'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil;
   671             Width: 3; Height: 17; imageWidth: 3; imageHeight: 17; saveSurf: false; priority: tpLow; getDimensions: false; getImageDimensions: false), // sprSlider
   703             Width: 3; Height: 17; imageWidth: 3; imageHeight: 17; saveSurf: false; priority: tpLow; getDimensions: false; getImageDimensions: false), // sprSlider
   672             (FileName:  'botlevels'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil;
   704             (FileName:  'botlevels'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil;
   673             Width: 22; Height: 15; imageWidth: 22; imageHeight: 15; saveSurf: true; priority: tpLow; getDimensions: false; getImageDimensions: false), // sprBotlevels
   705             Width: 22; Height: 15; imageWidth: 22; imageHeight: 15; saveSurf: true; priority: tpLow; getDimensions: false; getImageDimensions: false), // sprBotlevels
   674             (FileName:  'amCleaver'; Path: ptHedgehog; AltPath: ptNone; Texture: nil; Surface: nil;
   706             (FileName:  'amCleaver'; Path: ptHedgehog; AltPath: ptNone; Texture: nil; Surface: nil;
   684             (FileName:  'amFrozenHog'; Path: ptHedgehog; AltPath: ptNone; Texture: nil; Surface: nil;
   716             (FileName:  'amFrozenHog'; Path: ptHedgehog; AltPath: ptNone; Texture: nil; Surface: nil;
   685             Width: 64; Height: 64; imageWidth: 64; imageHeight: 64; saveSurf: false; priority: tpLow; getDimensions: false; getImageDimensions: false), // sprFrozenHog
   717             Width: 64; Height: 64; imageWidth: 64; imageHeight: 64; saveSurf: false; priority: tpLow; getDimensions: false; getImageDimensions: false), // sprFrozenHog
   686             (FileName:   'amRubber'; Path: ptCurrTheme; AltPath: ptGraphics; Texture: nil; Surface: nil;
   718             (FileName:   'amRubber'; Path: ptCurrTheme; AltPath: ptGraphics; Texture: nil; Surface: nil;
   687             Width: 160; Height:160; imageWidth: 0; imageHeight: 0; saveSurf:  true; priority: tpMedium; getDimensions: false; getImageDimensions: true), // sprAmRubber
   719             Width: 160; Height:160; imageWidth: 0; imageHeight: 0; saveSurf:  true; priority: tpMedium; getDimensions: false; getImageDimensions: true), // sprAmRubber
   688             (FileName:  'boing'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil;
   720             (FileName:  'boing'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil;
   689             Width: 101; Height: 97; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpLow; getDimensions: false; getImageDimensions: false) // sprBoing
   721             Width: 101; Height: 97; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpLow; getDimensions: false; getImageDimensions: false), // sprBoing
       
   722             (FileName:       'custom1'; Path: ptCurrTheme;AltPath: ptGraphics; Texture: nil; Surface: nil;
       
   723             Width:   0; Height:  0; imageWidth: 0; imageHeight: 0; saveSurf: true; priority: tpLow; getDimensions: true; getImageDimensions: true), // sprCustom1
       
   724             (FileName:       'custom2'; Path: ptCurrTheme;AltPath: ptGraphics; Texture: nil; Surface: nil;
       
   725             Width:   0; Height:  0; imageWidth: 0; imageHeight: 0; saveSurf: true; priority: tpLow; getDimensions: true; getImageDimensions: true), // sprCustom2
       
   726             (FileName:      'AirMine'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil;
       
   727             Width:  32; Height: 32; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpHighest; getDimensions: false; getImageDimensions: true), // sprAirMine
       
   728             (FileName:  'amAirMine'; Path: ptHedgehog; AltPath: ptNone; Texture: nil; Surface: nil;
       
   729             Width:  64; Height: 64; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true) // sprHandAirMine
   690             );
   730             );
   691 
   731 
   692 const
   732 const
   693     Wavez: array [TWave] of record
   733     Wavez: array [TWave] of record
   694             Sprite: TSprite;
   734             Sprite: TSprite;
   705             (Sprite: sprLemonade; FramesCount: 24; Interval: 125; cmd: '/ilovelotsoflemonade'; Voice: sndNone; VoiceDelay: 0),
   745             (Sprite: sprLemonade; FramesCount: 24; Interval: 125; cmd: '/ilovelotsoflemonade'; Voice: sndNone; VoiceDelay: 0),
   706             (Sprite:    sprShrug; FramesCount: 24; Interval: 125; cmd: '/shrug'; Voice: sndNone; VoiceDelay: 0),
   746             (Sprite:    sprShrug; FramesCount: 24; Interval: 125; cmd: '/shrug'; Voice: sndNone; VoiceDelay: 0),
   707             (Sprite:   sprJuggle; FramesCount: 49; Interval:  38; cmd: '/juggle'; Voice: sndNone; VoiceDelay: 0)
   747             (Sprite:   sprJuggle; FramesCount: 49; Interval:  38; cmd: '/juggle'; Voice: sndNone; VoiceDelay: 0)
   708             );
   748             );
   709 
   749 
   710 var
   750 type
   711     Ammoz: array [TAmmoType] of record
   751     TAmmozRec = record
   712             NameId: TAmmoStrId;
   752             NameId: TAmmoStrId;
   713             NameTex: PTexture;
   753             NameTex: PTexture;
   714             Probability, NumberInCase: Longword;
   754             Probability, NumberInCase: Longword;
   715             Ammo: TAmmo;
   755             Ammo: TAmmo;
   716             Slot: 0..cMaxSlotIndex;
   756             Slot: 0..cMaxSlotIndex;
   717             TimeAfterTurn: Longword;
   757             TimeAfterTurn: Longword;
   718             minAngle, maxAngle: Longword;
   758             minAngle, maxAngle: Longword;
   719             isDamaging: boolean;
   759             isDamaging: boolean;
   720             SkipTurns: Longword;
   760             SkipTurns: LongWord;
   721             PosCount: Longword;
   761             PosCount: Longword;
   722             PosSprite: TSprite;
   762             PosSprite: TSprite;
   723             ejectX, ejectY: Longint;
   763             ejectX, ejectY: Longint;
   724             end = (
   764             end;
       
   765 
       
   766 var
       
   767     Ammoz: array [TAmmoType] of TAmmozRec;
       
   768 
       
   769 const
       
   770     AmmozInit: array [TAmmoType] of TAmmozRec = (
   725             (NameId: sidNothing;
   771             (NameId: sidNothing;
   726             NameTex: nil;
   772             NameTex: nil;
   727             Probability: 0;
   773             Probability: 0;
   728             NumberInCase: 0;
   774             NumberInCase: 0;
   729             Ammo: (Propz: ammoprop_NoCrosshair or ammoprop_DontHold or ammoprop_Effect;
   775             Ammo: (Propz: ammoprop_NoCrosshair or ammoprop_DontHold or ammoprop_Effect;
   748 // Grenade
   794 // Grenade
   749             (NameId: sidGrenade;
   795             (NameId: sidGrenade;
   750             NameTex: nil;
   796             NameTex: nil;
   751             Probability: 0;
   797             Probability: 0;
   752             NumberInCase: 1;
   798             NumberInCase: 1;
   753             Ammo: (Propz: ammoprop_Timerable or 
   799             Ammo: (Propz: ammoprop_Timerable or
   754                           ammoprop_Power or 
   800                           ammoprop_Power or
   755                           ammoprop_AltUse or 
   801                           ammoprop_AltUse or
   756                           ammoprop_SetBounce or
   802                           ammoprop_SetBounce or
   757                           ammoprop_NeedUpDown;
   803                           ammoprop_NeedUpDown;
   758                 Count: AMMO_INFINITE;
   804                 Count: AMMO_INFINITE;
   759                 NumPerTurn: 0;
   805                 NumPerTurn: 0;
   760                 Timer: 3000;
   806                 Timer: 3000;
   776 // ClusterBomb
   822 // ClusterBomb
   777             (NameId: sidClusterBomb;
   823             (NameId: sidClusterBomb;
   778             NameTex: nil;
   824             NameTex: nil;
   779             Probability: 100;
   825             Probability: 100;
   780             NumberInCase: 3;
   826             NumberInCase: 3;
   781             Ammo: (Propz: ammoprop_Timerable or 
   827             Ammo: (Propz: ammoprop_Timerable or
   782                           ammoprop_Power or 
   828                           ammoprop_Power or
   783                           ammoprop_AltUse or 
   829                           ammoprop_AltUse or
   784                           ammoprop_SetBounce or
   830                           ammoprop_SetBounce or
   785                           ammoprop_NeedUpDown;
   831                           ammoprop_NeedUpDown;
   786                 Count: 5;
   832                 Count: 5;
   787                 NumPerTurn: 0;
   833                 NumPerTurn: 0;
   788                 Timer: 3000;
   834                 Timer: 3000;
   804 // Bazooka
   850 // Bazooka
   805             (NameId: sidBazooka;
   851             (NameId: sidBazooka;
   806             NameTex: nil;
   852             NameTex: nil;
   807             Probability: 0;
   853             Probability: 0;
   808             NumberInCase: 1;
   854             NumberInCase: 1;
   809             Ammo: (Propz: ammoprop_Power or 
   855             Ammo: (Propz: ammoprop_Power or
   810                           ammoprop_AltUse or
   856                           ammoprop_AltUse or
   811                           ammoprop_NeedUpDown;
   857                           ammoprop_NeedUpDown;
   812                 Count: AMMO_INFINITE;
   858                 Count: AMMO_INFINITE;
   813                 NumPerTurn: 0;
   859                 NumPerTurn: 0;
   814                 Timer: 0;
   860                 Timer: 0;
   830 // Bee
   876 // Bee
   831             (NameId: sidBee;
   877             (NameId: sidBee;
   832             NameTex: nil;
   878             NameTex: nil;
   833             Probability: 100;
   879             Probability: 100;
   834             NumberInCase: 1;
   880             NumberInCase: 1;
   835             Ammo: (Propz: ammoprop_Power or 
   881             Ammo: (Propz: ammoprop_Power or
   836                           ammoprop_NeedTarget or 
   882                           ammoprop_NeedTarget or
   837                           ammoprop_DontHold or
   883                           ammoprop_DontHold or
   838                           ammoprop_NeedUpDown;
   884                           ammoprop_NeedUpDown;
   839                 Count: 2;
   885                 Count: 2;
   840                 NumPerTurn: 0;
   886                 NumPerTurn: 0;
   841                 Timer: 0;
   887                 Timer: 0;
   883 // PickHammer
   929 // PickHammer
   884             (NameId: sidPickHammer;
   930             (NameId: sidPickHammer;
   885             NameTex: nil;
   931             NameTex: nil;
   886             Probability: 0;
   932             Probability: 0;
   887             NumberInCase: 1;
   933             NumberInCase: 1;
   888             Ammo: (Propz: ammoprop_ForwMsgs or 
   934             Ammo: (Propz: ammoprop_ForwMsgs or
   889                           ammoprop_AttackInMove or 
   935                           ammoprop_AttackInMove or
   890                           ammoprop_NoCrosshair or 
   936                           ammoprop_NoCrosshair or
   891                           ammoprop_DontHold;
   937                           ammoprop_DontHold;
   892                 Count: 2;
   938                 Count: 2;
   893                 NumPerTurn: 0;
   939                 NumPerTurn: 0;
   894                 Timer: 0;
   940                 Timer: 0;
   895                 Pos: 0;
   941                 Pos: 0;
   910 // Skip
   956 // Skip
   911             (NameId: sidSkip;
   957             (NameId: sidSkip;
   912             NameTex: nil;
   958             NameTex: nil;
   913             Probability: 0;
   959             Probability: 0;
   914             NumberInCase: 1;
   960             NumberInCase: 1;
   915             Ammo: (Propz: ammoprop_NoCrosshair or 
   961             Ammo: (Propz: ammoprop_NoCrosshair or
       
   962                           ammoprop_AttackInMove or
   916                           ammoprop_DontHold;
   963                           ammoprop_DontHold;
   917                 Count: AMMO_INFINITE;
   964                 Count: AMMO_INFINITE;
   918                 NumPerTurn: 0;
   965                 NumPerTurn: 0;
   919                 Timer: 0;
   966                 Timer: 0;
   920                 Pos: 0;
   967                 Pos: 0;
   965 // Mine
  1012 // Mine
   966             (NameId: sidMine;
  1013             (NameId: sidMine;
   967             NameTex: nil;
  1014             NameTex: nil;
   968             Probability: 100;
  1015             Probability: 100;
   969             NumberInCase: 1;
  1016             NumberInCase: 1;
   970             Ammo: (Propz: ammoprop_NoCrosshair or 
  1017             Ammo: (Propz: ammoprop_NoCrosshair or
   971                           ammoprop_AttackInMove or 
  1018                           ammoprop_AttackInMove or
   972                           ammoprop_DontHold or 
  1019                           ammoprop_DontHold or
   973                           ammoprop_AltUse or 
  1020                           ammoprop_AltUse or
   974                           ammoprop_SetBounce;
  1021                           ammoprop_SetBounce;
   975                 Count: 2;
  1022                 Count: 2;
   976                 NumPerTurn: 0;
  1023                 NumPerTurn: 0;
   977                 Timer: 0;
  1024                 Timer: 0;
   978                 Pos: 0;
  1025                 Pos: 0;
  1017 // Dynamite
  1064 // Dynamite
  1018             (NameId: sidDynamite;
  1065             (NameId: sidDynamite;
  1019             NameTex: nil;
  1066             NameTex: nil;
  1020             Probability: 100;
  1067             Probability: 100;
  1021             NumberInCase: 1;
  1068             NumberInCase: 1;
  1022             Ammo: (Propz: ammoprop_NoCrosshair or 
  1069             Ammo: (Propz: ammoprop_NoCrosshair or
  1023                           ammoprop_AttackInMove or 
  1070                           ammoprop_AttackInMove or
  1024                           ammoprop_DontHold or 
  1071                           ammoprop_DontHold or
  1025                           ammoprop_AltUse;
  1072                           ammoprop_AltUse;
  1026                 Count: 1;
  1073                 Count: 1;
  1027                 NumPerTurn: 0;
  1074                 NumPerTurn: 0;
  1028                 Timer: 0;
  1075                 Timer: 0;
  1029                 Pos: 0;
  1076                 Pos: 0;
  1044 // FirePunch
  1091 // FirePunch
  1045             (NameId: sidFirePunch;
  1092             (NameId: sidFirePunch;
  1046             NameTex: nil;
  1093             NameTex: nil;
  1047             Probability: 0;
  1094             Probability: 0;
  1048             NumberInCase: 1;
  1095             NumberInCase: 1;
  1049             Ammo: (Propz: ammoprop_NoCrosshair or 
  1096             Ammo: (Propz: ammoprop_NoCrosshair or
  1050                           ammoprop_ForwMsgs or 
  1097                           ammoprop_ForwMsgs or
  1051                           ammoprop_AttackInMove;
  1098                           ammoprop_AttackInMove;
  1052                 Count: AMMO_INFINITE;
  1099                 Count: AMMO_INFINITE;
  1053                 NumPerTurn: 0;
  1100                 NumPerTurn: 0;
  1054                 Timer: 0;
  1101                 Timer: 0;
  1055                 Pos: 0;
  1102                 Pos: 0;
  1316 // Mortar
  1363 // Mortar
  1317             (NameId: sidMortar;
  1364             (NameId: sidMortar;
  1318             NameTex: nil;
  1365             NameTex: nil;
  1319             Probability: 100;
  1366             Probability: 100;
  1320             NumberInCase: 4;
  1367             NumberInCase: 4;
  1321             Ammo: (Propz: 0;
  1368             Ammo: (Propz: ammoprop_NeedUpDown;
  1322                 Count: 4;
  1369                 Count: 4;
  1323                 NumPerTurn: 0;
  1370                 NumPerTurn: 0;
  1324                 Timer: 0;
  1371                 Timer: 0;
  1325                 Pos: 0;
  1372                 Pos: 0;
  1326                 AmmoType: amMortar;
  1373                 AmmoType: amMortar;
  1340 // Kamikaze
  1387 // Kamikaze
  1341             (NameId: sidKamikaze;
  1388             (NameId: sidKamikaze;
  1342             NameTex: nil;
  1389             NameTex: nil;
  1343             Probability: 100;
  1390             Probability: 100;
  1344             NumberInCase: 1;
  1391             NumberInCase: 1;
  1345             Ammo: (Propz: ammoprop_ForwMsgs or 
  1392             Ammo: (Propz: ammoprop_ForwMsgs or
  1346                           ammoprop_DontHold or 
  1393                           ammoprop_DontHold or
  1347                           ammoprop_NeedUpDown or
  1394                           ammoprop_NeedUpDown or
  1348                           ammoprop_AttackInMove;
  1395                           ammoprop_AttackInMove;
  1349                 Count: 1;
  1396                 Count: 1;
  1350                 NumPerTurn: 0;
  1397                 NumPerTurn: 0;
  1351                 Timer: 0;
  1398                 Timer: 0;
  1367 // Cake
  1414 // Cake
  1368             (NameId: sidCake;
  1415             (NameId: sidCake;
  1369             NameTex: nil;
  1416             NameTex: nil;
  1370             Probability: 100;
  1417             Probability: 100;
  1371             NumberInCase: 1;
  1418             NumberInCase: 1;
  1372             Ammo: (Propz: ammoprop_ForwMsgs or 
  1419             Ammo: (Propz: ammoprop_ForwMsgs or
  1373                           ammoprop_NoCrosshair or 
  1420                           ammoprop_NoCrosshair or
  1374                           ammoprop_DontHold or
  1421                           ammoprop_DontHold or
  1375                           ammoprop_Track;
  1422                           ammoprop_Track;
  1376                 Count: 1;
  1423                 Count: 1;
  1377                 NumPerTurn: 0;
  1424                 NumPerTurn: 0;
  1378                 Timer: 0;
  1425                 Timer: 0;
  1394 // Seduction
  1441 // Seduction
  1395             (NameId: sidSeduction;
  1442             (NameId: sidSeduction;
  1396             NameTex: nil;
  1443             NameTex: nil;
  1397             Probability: 100;
  1444             Probability: 100;
  1398             NumberInCase: 1;
  1445             NumberInCase: 1;
  1399             Ammo: (Propz: ammoprop_ForwMsgs or 
  1446             Ammo: (Propz: ammoprop_ForwMsgs or
  1400                           ammoprop_DontHold or
  1447                           ammoprop_DontHold or
  1401                           ammoprop_NoCrosshair;
  1448                           ammoprop_NoCrosshair;
  1402                 Count: 1;
  1449                 Count: 1;
  1403                 NumPerTurn: 0;
  1450                 NumPerTurn: 0;
  1404                 Timer: 0;
  1451                 Timer: 0;
  1420 // Watermelon
  1467 // Watermelon
  1421             (NameId: sidWatermelon;
  1468             (NameId: sidWatermelon;
  1422             NameTex: nil;
  1469             NameTex: nil;
  1423             Probability: 400;
  1470             Probability: 400;
  1424             NumberInCase: 1;
  1471             NumberInCase: 1;
  1425             Ammo: (Propz: ammoprop_Timerable or 
  1472             Ammo: (Propz: ammoprop_Timerable or
  1426                           ammoprop_Power or 
  1473                           ammoprop_Power or
  1427                           ammoprop_NeedUpDown or
  1474                           ammoprop_NeedUpDown or
  1428                           ammoprop_AltUse;
  1475                           ammoprop_AltUse;
  1429                 Count: 0;
  1476                 Count: 0;
  1430                 NumPerTurn: 0;
  1477                 NumPerTurn: 0;
  1431                 Timer: 3000;
  1478                 Timer: 3000;
  1447 // HellishBomb ("Hellish Hand-Grenade")
  1494 // HellishBomb ("Hellish Hand-Grenade")
  1448             (NameId: sidHellishBomb;
  1495             (NameId: sidHellishBomb;
  1449             NameTex: nil;
  1496             NameTex: nil;
  1450             Probability: 400;
  1497             Probability: 400;
  1451             NumberInCase: 1;
  1498             NumberInCase: 1;
  1452             Ammo: (Propz: ammoprop_Power or 
  1499             Ammo: (Propz: ammoprop_Power or
  1453                           ammoprop_NeedUpDown or
  1500                           ammoprop_NeedUpDown or
  1454                           ammoprop_AltUse;
  1501                           ammoprop_AltUse;
  1455                 Count: 0;
  1502                 Count: 0;
  1456                 NumPerTurn: 0;
  1503                 NumPerTurn: 0;
  1457                 Timer: 5000;
  1504                 Timer: 5000;
  1501 // Drill ("Drill Rocket")
  1548 // Drill ("Drill Rocket")
  1502             (NameId: sidDrill;
  1549             (NameId: sidDrill;
  1503             NameTex: nil;
  1550             NameTex: nil;
  1504             Probability: 300;
  1551             Probability: 300;
  1505             NumberInCase: 1;
  1552             NumberInCase: 1;
  1506             Ammo: (Propz: ammoprop_Power or 
  1553             Ammo: (Propz: ammoprop_Power or
  1507                           ammoprop_NeedUpDown or
  1554                           ammoprop_NeedUpDown or
  1508                           ammoprop_AltUse;
  1555                           ammoprop_AltUse;
  1509                 Count: AMMO_INFINITE;
  1556                 Count: AMMO_INFINITE;
  1510                 NumPerTurn: 0;
  1557                 NumPerTurn: 0;
  1511                 Timer: 0;
  1558                 Timer: 0;
  1527 // Ballgun
  1574 // Ballgun
  1528             (NameId: sidBallgun;
  1575             (NameId: sidBallgun;
  1529             NameTex: nil;
  1576             NameTex: nil;
  1530             Probability: 400;
  1577             Probability: 400;
  1531             NumberInCase: 1;
  1578             NumberInCase: 1;
  1532             Ammo: (Propz: ammoprop_ForwMsgs or 
  1579             Ammo: (Propz: ammoprop_ForwMsgs or
  1533                           ammoprop_NeedUpDown or
  1580                           ammoprop_NeedUpDown or
  1534                           ammoprop_DontHold;
  1581                           ammoprop_DontHold;
  1535                 Count: AMMO_INFINITE;
  1582                 Count: AMMO_INFINITE;
  1536                 NumPerTurn: 0;
  1583                 NumPerTurn: 0;
  1537                 Timer: 5001;
  1584                 Timer: 5001;
  1812 // Molotov
  1859 // Molotov
  1813             (NameId: sidMolotov;
  1860             (NameId: sidMolotov;
  1814             NameTex: nil;
  1861             NameTex: nil;
  1815             Probability: 0;
  1862             Probability: 0;
  1816             NumberInCase: 1;
  1863             NumberInCase: 1;
  1817             Ammo: (Propz: ammoprop_Power or 
  1864             Ammo: (Propz: ammoprop_Power or
  1818                           ammoprop_NeedUpDown or
  1865                           ammoprop_NeedUpDown or
  1819                           ammoprop_AltUse;
  1866                           ammoprop_AltUse;
  1820                 Count: AMMO_INFINITE;
  1867                 Count: AMMO_INFINITE;
  1821                 NumPerTurn: 0;
  1868                 NumPerTurn: 0;
  1822                 Timer: 3000;
  1869                 Timer: 3000;
  1921 // GasBomb
  1968 // GasBomb
  1922             (NameId: sidGasBomb;
  1969             (NameId: sidGasBomb;
  1923             NameTex: nil;
  1970             NameTex: nil;
  1924             Probability: 0;
  1971             Probability: 0;
  1925             NumberInCase: 1;
  1972             NumberInCase: 1;
  1926             Ammo: (Propz: ammoprop_Timerable or 
  1973             Ammo: (Propz: ammoprop_Timerable or
  1927                           ammoprop_Power or 
  1974                           ammoprop_Power or
  1928                           ammoprop_AltUse or 
  1975                           ammoprop_AltUse or
  1929                           ammoprop_NeedUpDown or
  1976                           ammoprop_NeedUpDown or
  1930                           ammoprop_SetBounce;
  1977                           ammoprop_SetBounce;
  1931                 Count: AMMO_INFINITE;
  1978                 Count: AMMO_INFINITE;
  1932                 NumPerTurn: 0;
  1979                 NumPerTurn: 0;
  1933                 Timer: 3000;
  1980                 Timer: 3000;
  1974 // Flamethrower
  2021 // Flamethrower
  1975             (NameId: sidFlamethrower;
  2022             (NameId: sidFlamethrower;
  1976             NameTex: nil;
  2023             NameTex: nil;
  1977             Probability: 20;
  2024             Probability: 20;
  1978             NumberInCase: 1;
  2025             NumberInCase: 1;
  1979             Ammo: (Propz: ammoprop_ForwMsgs or 
  2026             Ammo: (Propz: ammoprop_ForwMsgs or
  1980                           ammoprop_NeedUpDown or
  2027                           ammoprop_NeedUpDown or
  1981                           ammoprop_DontHold;
  2028                           ammoprop_DontHold;
  1982                 Count: 1;
  2029                 Count: 1;
  1983                 NumPerTurn: 0;
  2030                 NumPerTurn: 0;
  1984                 Timer: 5001;
  2031                 Timer: 5001;
  2105 // Snowball/Mudball
  2152 // Snowball/Mudball
  2106             (NameId: sidSnowball;
  2153             (NameId: sidSnowball;
  2107             NameTex: nil;
  2154             NameTex: nil;
  2108             Probability: 0;
  2155             Probability: 0;
  2109             NumberInCase: 1;
  2156             NumberInCase: 1;
  2110             Ammo: (Propz: ammoprop_Power or 
  2157             Ammo: (Propz: ammoprop_Power or
  2111                           ammoprop_AltUse or
  2158                           ammoprop_AltUse or
       
  2159                           ammoprop_NeedUpDown or
  2112                           ammoprop_NoRoundEnd;
  2160                           ammoprop_NoRoundEnd;
  2113                 Count: 2;
  2161                 Count: 2;
  2114                 NumPerTurn: 0;
  2162                 NumPerTurn: 0;
  2115                 Timer: 0;
  2163                 Timer: 0;
  2116                 Pos: 0;
  2164                 Pos: 0;
  2123             maxAngle: 0;
  2171             maxAngle: 0;
  2124             isDamaging: false;
  2172             isDamaging: false;
  2125             SkipTurns: 0;
  2173             SkipTurns: 0;
  2126             PosCount: 1;
  2174             PosCount: 1;
  2127             PosSprite: sprWater;
  2175             PosSprite: sprWater;
  2128             ejectX: 0; 
  2176             ejectX: 0;
  2129             ejectY: 0),
  2177             ejectY: 0),
  2130 
  2178 
  2131 // Tardis
  2179 // Tardis
  2132             (NameId: sidTardis;
  2180             (NameId: sidTardis;
  2133             NameTex: nil;
  2181             NameTex: nil;
  2153             PosCount: 2;
  2201             PosCount: 2;
  2154             PosSprite: sprAmTeleport;
  2202             PosSprite: sprAmTeleport;
  2155             ejectX: 0;
  2203             ejectX: 0;
  2156             ejectY: 0),
  2204             ejectY: 0),
  2157 
  2205 
  2158 // Structure      
  2206 // Structure
  2159 {
  2207 {
  2160             (NameId: sidStructure;
  2208             (NameId: sidStructure;
  2161             NameTex: nil;
  2209             NameTex: nil;
  2162             Probability: 0;
  2210             Probability: 0;
  2163             NumberInCase: 1;
  2211             NumberInCase: 1;
  2181             PosCount: 1;
  2229             PosCount: 1;
  2182             PosSprite: sprWater;
  2230             PosSprite: sprWater;
  2183             ejectX: 0;
  2231             ejectX: 0;
  2184             ejectY: 0),
  2232             ejectY: 0),
  2185 }
  2233 }
  2186             
  2234 
  2187 // Land Gun
  2235 // Land Gun
  2188             (NameId: sidLandGun;
  2236             (NameId: sidLandGun;
  2189             NameTex: nil;
  2237             NameTex: nil;
  2190             Probability: 20;
  2238             Probability: 20;
  2191             NumberInCase: 1;
  2239             NumberInCase: 1;
  2192             Ammo: (Propz: ammoprop_NoRoundEnd or
  2240             Ammo: (Propz: ammoprop_NoRoundEnd or
       
  2241                           ammoprop_NeedUpDown or
  2193                           ammoprop_Utility;
  2242                           ammoprop_Utility;
  2194                 Count: 1;
  2243                 Count: 1;
  2195                 NumPerTurn: 0;
  2244                 NumPerTurn: 0;
  2196                 Timer: 5001;
  2245                 Timer: 5001;
  2197                 Pos: 0;
  2246                 Pos: 0;
  2211 // Freezer
  2260 // Freezer
  2212             (NameId: sidIceGun;
  2261             (NameId: sidIceGun;
  2213             NameTex: nil;
  2262             NameTex: nil;
  2214             Probability: 20;
  2263             Probability: 20;
  2215             NumberInCase: 1;
  2264             NumberInCase: 1;
  2216             Ammo: (Propz: ammoprop_ForwMsgs or 
  2265             Ammo: (Propz: ammoprop_ForwMsgs or
  2217                           ammoprop_NeedUpDown or
  2266                           ammoprop_NeedUpDown or
  2218                           ammoprop_DontHold;
  2267                           ammoprop_DontHold;
  2219                 Count: 1;
  2268                 Count: 1;
  2220                 NumPerTurn: 0;
  2269                 NumPerTurn: 0;
  2221                 Timer: 5001;
  2270                 Timer: 5001;
  2281             maxAngle: 0;
  2330             maxAngle: 0;
  2282             isDamaging: false;
  2331             isDamaging: false;
  2283             SkipTurns: 0;
  2332             SkipTurns: 0;
  2284             PosCount: 4;
  2333             PosCount: 4;
  2285             PosSprite: sprAmRubber;
  2334             PosSprite: sprAmRubber;
       
  2335             ejectX: 0;
       
  2336             ejectY: 0),
       
  2337 // Air Mine
       
  2338             (NameId: sidAirMine;
       
  2339             NameTex: nil;
       
  2340             Probability: 100;
       
  2341             NumberInCase: 1;
       
  2342             Ammo: (Propz: ammoprop_Power or
       
  2343                           ammoprop_AltUse or
       
  2344                           ammoprop_NeedUpDown;
       
  2345                 Count: 2;
       
  2346                 NumPerTurn: 0;
       
  2347                 Timer: 0;
       
  2348                 Pos: 0;
       
  2349                 AmmoType: amAirMine;
       
  2350                 AttackVoice: sndLaugh;
       
  2351                 Bounciness: 1000);
       
  2352             Slot: 5;
       
  2353             TimeAfterTurn: 5000;
       
  2354             minAngle: 0;
       
  2355             maxAngle: 0;
       
  2356             isDamaging: true;
       
  2357             SkipTurns: 0;
       
  2358             PosCount: 1;
       
  2359             PosSprite: sprWater;
  2286             ejectX: 0;
  2360             ejectX: 0;
  2287             ejectY: 0)
  2361             ejectY: 0)
  2288         );
  2362         );
  2289 
  2363 
  2290 var
  2364 var
  2338     PauseTexture,
  2412     PauseTexture,
  2339     AFKTexture,
  2413     AFKTexture,
  2340     SyncTexture,
  2414     SyncTexture,
  2341     ConfirmTexture: PTexture;
  2415     ConfirmTexture: PTexture;
  2342     cScaleFactor: GLfloat;
  2416     cScaleFactor: GLfloat;
       
  2417     cStereoDepth: GLfloat;
  2343     SupportNPOTT: Boolean;
  2418     SupportNPOTT: Boolean;
  2344     Step: LongInt;
  2419     Step: LongInt;
  2345     MissionIcons: PSDL_Surface;
  2420     MissionIcons: PSDL_Surface;
  2346     ropeIconTex: PTexture;
  2421     ropeIconTex: PTexture;
  2347 
  2422 
  2361 
  2436 
  2362     DefaultBinds : TBinds;
  2437     DefaultBinds : TBinds;
  2363 
  2438 
  2364     lastTurnChecksum : Longword;
  2439     lastTurnChecksum : Longword;
  2365 
  2440 
       
  2441     mModelview: TMatrix4x4f;
       
  2442     mProjection: TMatrix4x4f;
       
  2443     vBuffer: GLuint; // vertex buffer
       
  2444     tBuffer: GLuint; // texture coords buffer
       
  2445     cBuffer: GLuint; // color buffer
       
  2446 
       
  2447     uCurrentMVPLocation: GLint;
       
  2448 
       
  2449     uMainMVPLocation: GLint;
       
  2450     uMainTintLocation: GLint;
       
  2451 
       
  2452     uWaterMVPLocation: GLint;
       
  2453 
       
  2454     aVertex: GLint;
       
  2455     aTexCoord: GLint;
       
  2456     aColor: GLint;
       
  2457 
  2366 var trammo:  array[TAmmoStrId] of ansistring;   // name of the weapon
  2458 var trammo:  array[TAmmoStrId] of ansistring;   // name of the weapon
  2367     trammoc: array[TAmmoStrId] of ansistring;   // caption of the weapon
  2459     trammoc: array[TAmmoStrId] of ansistring;   // caption of the weapon
  2368     trammod: array[TAmmoStrId] of ansistring;   // description of the weapon
  2460     trammod: array[TAmmoStrId] of ansistring;   // description of the weapon
  2369     trmsg:   array[TMsgStrId]  of ansistring;   // message of the event
  2461     trmsg:   array[TMsgStrId]  of ansistring;   // message of the event
  2370     trgoal:  array[TGoalStrId] of ansistring;   // message of the goal
  2462     trgoal:  array[TGoalStrId] of ansistring;   // message of the goal
       
  2463     cTestLua : Boolean;
  2371 
  2464 
  2372 procedure preInitModule;
  2465 procedure preInitModule;
  2373 procedure initModule;
  2466 procedure initModule;
  2374 procedure freeModule;
  2467 procedure freeModule;
  2375 
  2468 
  2376 implementation
  2469 implementation
  2377 uses strutils;
       
  2378 
  2470 
  2379 procedure preInitModule;
  2471 procedure preInitModule;
  2380 begin
  2472 begin
  2381     // initialisation flags - they are going to be overwritten by program args
  2473     // initialisation flags - they are going to be overwritten by program args
  2382 
  2474 
  2401     cStereoMode     := smNone;
  2493     cStereoMode     := smNone;
  2402     GrayScale       := false;
  2494     GrayScale       := false;
  2403     PathPrefix      := './';
  2495     PathPrefix      := './';
  2404     GameType        := gmtLocal;
  2496     GameType        := gmtLocal;
  2405     cOnlyStats      := False;
  2497     cOnlyStats      := False;
       
  2498     cScriptName     := '';
       
  2499     cScriptParam    := '';
       
  2500     cTestLua        := False;
  2406 
  2501 
  2407 {$IFDEF USE_VIDEO_RECORDING}
  2502 {$IFDEF USE_VIDEO_RECORDING}
  2408     RecPrefix          := '';
  2503     RecPrefix          := '';
  2409     cAVFormat          := '';
  2504     cAVFormat          := '';
  2410     cVideoCodec        := '';
  2505     cVideoCodec        := '';
  2411     cVideoFramerateNum := 0;
  2506     cVideoFramerateNum := 0;
  2412     cVideoFramerateDen := 0;
  2507     cVideoFramerateDen := 0;
  2413     cVideoQuality      := 0;
  2508     cVideoQuality      := 0;
  2414     cAudioCodec        := '';
  2509     cAudioCodec        := '';
  2415 {$ENDIF}
  2510 {$ENDIF}
       
  2511 
       
  2512     cTagsMask:= htTeamName or htName or htHealth;
  2416 end;
  2513 end;
  2417 
  2514 
  2418 procedure initModule;
  2515 procedure initModule;
       
  2516 var s: shortstring;
       
  2517     i: integer;
  2419 begin
  2518 begin
  2420     // TODO: we could just have one cLocale variables and drop strutils
  2519     // init LastVoice
  2421     cLocale:= ExtractDelimited(1, cLocaleFName, StdWordDelims);
  2520     LastVoice.snd:= sndNone;
       
  2521     LastVoice.voicepack:= nil;
       
  2522 
       
  2523     // init arrays
       
  2524     Move(cPathzInit, cPathz, sizeof(cPathz));
       
  2525     Move(FontzInit, Fontz, sizeof(Fontz));
       
  2526     Move(SpritesDataInit, SpritesData, sizeof(SpritesData));
       
  2527     Move(AmmozInit, Ammoz, sizeof(Ammoz));
       
  2528 
       
  2529 
       
  2530     cLocale:= cLocaleFName;
       
  2531     SplitByChar(cLocale, s, '.');
  2422 
  2532 
  2423     cFlattenFlakes      := false;
  2533     cFlattenFlakes      := false;
  2424     cFlattenClouds      := false;
  2534     cFlattenClouds      := false;
  2425     cIce                := false;
  2535     cIce                := false;
  2426     cSnow               := false;
  2536     cSnow               := false;
  2446         LAND_HEIGHT:= 2048;
  2556         LAND_HEIGHT:= 2048;
  2447         LAND_WIDTH_MASK:= $FFFFF000;
  2557         LAND_WIDTH_MASK:= $FFFFF000;
  2448         LAND_HEIGHT_MASK:= $FFFFF800
  2558         LAND_HEIGHT_MASK:= $FFFFF800
  2449         end;
  2559         end;
  2450 
  2560 
  2451     SDWaterColorArray[0].r := 182;
  2561     // default sudden death water
  2452     SDWaterColorArray[0].g := 144;
  2562 
  2453     SDWaterColorArray[0].b := 201;
  2563     // deep water
       
  2564     SDWaterColorArray[0].r := 150;
       
  2565     SDWaterColorArray[0].g := 112;
       
  2566     SDWaterColorArray[0].b := 169;
  2454     SDWaterColorArray[0].a := 255;
  2567     SDWaterColorArray[0].a := 255;
  2455     SDWaterColorArray[2].r := 150;
  2568     SDWaterColorArray[2]:= SDWaterColorArray[0];
  2456     SDWaterColorArray[2].g := 112;
  2569     SDWaterColorArray[4]:= SDWaterColorArray[0];
  2457     SDWaterColorArray[2].b := 169;
  2570     SDWaterColorArray[6]:= SDWaterColorArray[0];
  2458     SDWaterColorArray[2].a := 255;
  2571     // water surface
  2459     SDWaterColorArray[1]:= SDWaterColorArray[0];
  2572     SDWaterColorArray[1].r := 182;
  2460     SDWaterColorArray[3]:= SDWaterColorArray[2];
  2573     SDWaterColorArray[1].g := 144;
       
  2574     SDWaterColorArray[1].b := 201;
       
  2575     SDWaterColorArray[1].a := 255;
       
  2576     SDWaterColorArray[3]:= SDWaterColorArray[1];
       
  2577     SDWaterColorArray[5]:= SDWaterColorArray[1];
       
  2578     SDWaterColorArray[7]:= SDWaterColorArray[1];
       
  2579 
  2461     SDWaterOpacity:= $80;
  2580     SDWaterOpacity:= $80;
       
  2581 
  2462     SDTint:= $80;
  2582     SDTint:= $80;
       
  2583     ExplosionBorderColorR:= 80;
       
  2584     ExplosionBorderColorG:= 80;
       
  2585     ExplosionBorderColorB:= 80;
  2463     ExplosionBorderColor:= $FF808080;
  2586     ExplosionBorderColor:= $FF808080;
       
  2587     ExplosionBorderColorNoA:= ExplosionBorderColor and (not AMask);
  2464     IceColor:= ($44 shl RShift) or ($97 shl GShift) or ($A9 shl BShift) or ($A0 shl AShift);
  2588     IceColor:= ($44 shl RShift) or ($97 shl GShift) or ($A9 shl BShift) or ($A0 shl AShift);
  2465     IceEdgeColor:= ($8A shl RShift) or ($AF shl GShift) or ($B2 shl BShift) or ($FF shl AShift);
  2589     IceEdgeColor:= ($8A shl RShift) or ($AF shl GShift) or ($B2 shl BShift) or ($FF shl AShift);
  2466 
  2590 
  2467     WaterOpacity:= $80;
  2591     WaterOpacity:= $80;
  2468 
  2592 
       
  2593     cWaveHeight             := 32;
  2469     cDrownSpeed.QWordValue  := 257698038;   // 0.06
  2594     cDrownSpeed.QWordValue  := 257698038;   // 0.06
  2470     cDrownSpeedf            := 0.06;
  2595     cDrownSpeedf            := 0.06;
  2471     cMaxWindSpeed.QWordValue:= 1073742;     // 0.00025
  2596     cMaxWindSpeed.QWordValue:= 1073742;     // 0.00025
  2472     cWindSpeed.QWordValue   := 0;           // 0.0
  2597     cWindSpeed.QWordValue   := 0;           // 0.0
  2473     cWindSpeedf             := 0.0;
  2598     cWindSpeedf             := 0.0;
  2474     cElastic                := _0_9;
  2599     cElastic                := _0_9;
  2475     cGravity                := cMaxWindSpeed * 2;
  2600     cGravity                := cMaxWindSpeed * 2;
  2476     cGravityf               := 0.00025 * 2;
  2601     cGravityf               := 0.00025 * 2;
       
  2602     cBuildMaxDist           := cDefaultBuildMaxDist;
  2477     cDamageModifier         := _1;
  2603     cDamageModifier         := _1;
  2478     TargetPoint             := cTargetPointRef;
  2604     TargetPoint             := cTargetPointRef;
  2479 
  2605 
  2480 {$IFDEF MOBILE}
  2606 {$IFDEF MOBILE}
  2481     cMaxZoomLevel:= 0.5;
  2607     cMaxZoomLevel:= 0.5;
  2509     cDamagePercent      := 100;
  2635     cDamagePercent      := 100;
  2510     cRopePercent        := 100;
  2636     cRopePercent        := 100;
  2511     cGetAwayTime        := 100;
  2637     cGetAwayTime        := 100;
  2512     cMineDudPercent     := 0;
  2638     cMineDudPercent     := 0;
  2513     cTemplateFilter     := 0;
  2639     cTemplateFilter     := 0;
  2514     cMapGen             := 0;   // MAPGEN_REGULAR
  2640     cFeatureSize        := 50;
       
  2641     cMapGen             := mgRandom;
  2515     cHedgehogTurnTime   := 45000;
  2642     cHedgehogTurnTime   := 45000;
  2516     cMinesTime          := 3000;
  2643     cMinesTime          := 3000;
  2517     cMaxAIThinkTime     := 9000;
  2644     cMaxAIThinkTime     := 9000;
  2518     cCloudsNumber       := 9;
  2645     cCloudsNumber       := 9;
  2519     cSDCloudsNumber     := 9;
  2646     cSDCloudsNumber     := 9;
  2520     cHealthCaseProb     := 35;
  2647     cHealthCaseProb     := 35;
  2521     cHealthCaseAmount   := 25;
  2648     cHealthCaseAmount   := 25;
  2522     cWaterRise          := 47;
  2649     cWaterRise          := 47;
  2523     cHealthDecrease     := 5;
  2650     cHealthDecrease     := 5;
       
  2651     cAdvancedMapGenMode := false;
  2524 
  2652 
  2525     InitStepsFlags  := 0;
  2653     InitStepsFlags  := 0;
  2526     RealTicks       := 0;
  2654     RealTicks       := 0;
  2527     AttackBar       := 0; // 0 - none, 1 - just bar at the right-down corner, 2 - from weapon
  2655     AttackBar       := 0; // 0 - none, 1 - just bar at the right-down corner, 2 - from weapon
  2528     cCaseFactor     := 5;  {0..9}
  2656     cCaseFactor     := 5;  {0..9}
  2529     cLandMines      := 4;
  2657     cLandMines      := 4;
       
  2658     cAirMines       := 0;
  2530     cExplosives     := 2;
  2659     cExplosives     := 2;
  2531 
  2660 
  2532     GameState       := Low(TGameState);
  2661     GameState       := Low(TGameState);
  2533     zoom            := cDefaultZoomLevel;
  2662     zoom            := cDefaultZoomLevel;
  2534     ZoomValue       := cDefaultZoomLevel;
  2663     ZoomValue       := cDefaultZoomLevel;
  2535     WeaponTooltipTex:= nil;
  2664     WeaponTooltipTex:= nil;
  2536     cLaserSighting  := false;
  2665     cLaserSighting  := false;
  2537     cVampiric       := false;
  2666     cVampiric       := false;
  2538     cArtillery      := false;
  2667     cArtillery      := false;
  2539     flagMakeCapture := false;
  2668     flagMakeCapture := false;
       
  2669     flagDumpLand    := false;
  2540     bBetweenTurns   := false;
  2670     bBetweenTurns   := false;
  2541     bWaterRising    := false;
  2671     bWaterRising    := false;
  2542     isCursorVisible := false;
  2672     isCursorVisible := false;
  2543     isInLag         := false;
  2673     isInLag         := false;
  2544     isPaused        := false;
  2674     isPaused        := false;
  2547     isAFK           := false;
  2677     isAFK           := false;
  2548     SpeedStart      := 0;
  2678     SpeedStart      := 0;
  2549     fastUntilLag    := false;
  2679     fastUntilLag    := false;
  2550     fastScrolling   := false;
  2680     fastScrolling   := false;
  2551     autoCameraOn    := true;
  2681     autoCameraOn    := true;
  2552     cScriptName     := '';
       
  2553     cSeed           := '';
  2682     cSeed           := '';
  2554     cVolumeDelta    := 0;
  2683     cVolumeDelta    := 0;
  2555     cHasFocus       := true;
  2684     cHasFocus       := true;
  2556     cInactDelay     := 100;
  2685     cInactDelay     := 100;
  2557     ReadyTimeLeft   := 0;
  2686     ReadyTimeLeft   := 0;
  2558     
  2687 
  2559     disableLandBack := false;
  2688     disableLandBack := false;
  2560     ScreenFade      := sfNone;
  2689     ScreenFade      := sfNone;
  2561 
  2690 
  2562     // those values still are not perfect
  2691     // those values still are not perfect
  2563     cLeftScreenBorder:= round(-cMinZoomLevel * cScreenWidth);
  2692     cLeftScreenBorder:= round(-cMinZoomLevel * cScreenWidth);
  2564     cRightScreenBorder:= round(cMinZoomLevel * cScreenWidth + LAND_WIDTH);
  2693     cRightScreenBorder:= round(cMinZoomLevel * cScreenWidth + LAND_WIDTH);
  2565     cScreenSpace:= cRightScreenBorder - cLeftScreenBorder;
  2694     cScreenSpace:= cRightScreenBorder - cLeftScreenBorder;
  2566 
  2695 
  2567     vobFrameTicks:= 99999;
  2696     dirtyLandTexCount:= 0;
       
  2697 
       
  2698     vobFrameTicks:= 0;
  2568     vobFramesCount:= 4;
  2699     vobFramesCount:= 4;
  2569     vobCount:= 0;
  2700     vobCount:= 0;
  2570     vobVelocity:= 10;
  2701     vobVelocity:= 10;
  2571     vobFallSpeed:= 100;
  2702     vobFallSpeed:= 100;
  2572 
  2703 
  2573     vobSDFrameTicks:= 99999;
  2704     vobSDFrameTicks:= 0;
  2574     vobSDFramesCount:= 4;
  2705     vobSDFramesCount:= 4;
  2575     vobSDCount:= 30 * cScreenSpace div LAND_WIDTH;
  2706     vobSDCount:= 30 * cScreenSpace div LAND_WIDTH;
  2576     vobSDVelocity:= 15;
  2707     vobSDVelocity:= 15;
  2577     vobSDFallSpeed:= 250;
  2708     vobSDFallSpeed:= 250;
  2578 
  2709 
       
  2710 {$IFDEF MOBILE}
       
  2711     cMinScreenWidth  := min(cScreenWidth, 480);
       
  2712     cMinScreenHeight := min(cScreenHeight, 320);
       
  2713 {$ELSE}
  2579     cMinScreenWidth  := min(cScreenWidth, 640);
  2714     cMinScreenWidth  := min(cScreenWidth, 640);
  2580     cMinScreenHeight := min(cScreenHeight, 480);
  2715     cMinScreenHeight := min(cScreenHeight, 480);
       
  2716 {$ENDIF}
  2581 
  2717 
  2582     cNewScreenWidth    := cScreenWidth;
  2718     cNewScreenWidth    := cScreenWidth;
  2583     cNewScreenHeight   := cScreenHeight;
  2719     cNewScreenHeight   := cScreenHeight;
  2584     cScreenResizeDelay := 0;
  2720     cScreenResizeDelay := 0;
  2585 
  2721 
  2587     if cFullscreenWidth = 0 then
  2723     if cFullscreenWidth = 0 then
  2588         cFullscreenWidth:= min(cWindowedWidth, 640);
  2724         cFullscreenWidth:= min(cWindowedWidth, 640);
  2589     if cFullscreenHeight = 0 then
  2725     if cFullscreenHeight = 0 then
  2590         cFullscreenHeight:= min(cWindowedHeight, 480);
  2726         cFullscreenHeight:= min(cWindowedHeight, 480);
  2591 
  2727 
       
  2728     SpeechHogNumber:= -1;
  2592 
  2729 
  2593     LuaGoals:= '';
  2730     LuaGoals:= '';
  2594     cMapName:= '';
  2731     cMapName:= '';
  2595 
  2732 
  2596     LuaTemplateNumber:= 0;
  2733     LuaTemplateNumber:= 0;
  2597 
  2734 
  2598     UIDisplay:= uiAll;
  2735     UIDisplay:= uiAll;
  2599     LocalMessage:= 0;
  2736     LocalMessage:= 0;
       
  2737 
       
  2738     cStereoDepth:= 0;
       
  2739     cViewLimitsDebug:= false;
       
  2740     AprilOne := false;
       
  2741 
       
  2742     ChatPasteBuffer:= '';
       
  2743 
       
  2744     // initialize pointers to nil
       
  2745     // (don't rely on implicit init of fpc, because that one only happens ONCE when used as lib)
       
  2746     CurAmmoGear:= nil;
       
  2747     lastGearByUID:= nil;
       
  2748     GearsList:= nil;
       
  2749     CurrentTeam:= nil;
       
  2750     PreviousTeam:= nil;
       
  2751     CurrentHedgehog:= nil;
       
  2752     FollowGear:= nil;
       
  2753     lastVisualGearByUID:= nil;
       
  2754 
       
  2755     ChefHatTexture:= nil;
       
  2756     CrosshairTexture:= nil;
       
  2757     GenericHealthTexture:= nil;
       
  2758     WeaponTooltipTex:= nil;
       
  2759     HHTexture:= nil;
       
  2760     LandBackSurface:= nil;
       
  2761     ConfirmTexture:= nil;
       
  2762     MissionIcons:= nil;
       
  2763     ropeIconTex:= nil;
       
  2764 
       
  2765     for i:= Low(ClansArray) to High(ClansArray) do
       
  2766         begin
       
  2767         ClansArray[i]:= nil;
       
  2768         end;
       
  2769 
       
  2770     for i:= Low(TeamsArray) to High(TeamsArray) do
       
  2771         begin
       
  2772         TeamsArray[i]:= nil;
       
  2773         end;
       
  2774 
       
  2775     for i:= Low(CountTexz) to High(CountTexz) do
       
  2776         begin
       
  2777         CountTexz[i]:= nil;
       
  2778         end;
       
  2779 
  2600 end;
  2780 end;
  2601 
  2781 
  2602 procedure freeModule;
  2782 procedure freeModule;
  2603 begin
  2783 begin
  2604 end;
  2784 end;