hedgewars/uVariables.pas
branchphysfslayer
changeset 8520 1dedcc37bfe8
parent 8373 209c9ba77a09
child 8444 75db7bb8dce8
child 8548 b98631bf2066
equal deleted inserted replaced
8056:d5d5e1698554 8520:1dedcc37bfe8
    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, uMobile, uUtils;
    24 uses SDLh, uTypes, uFloat, GLunit, uConsts, Math, uUtils;
    25 
    25 
    26 var
    26 var
    27 /////// init flags ///////
    27 /////// init flags ///////
    28     cMinScreenWidth    : LongInt;
    28     cMinScreenWidth    : LongInt;
    29     cMinScreenHeight   : LongInt;
    29     cMinScreenHeight   : LongInt;
       
    30     cFullscreenWidth   : LongInt;
       
    31     cFullscreenHeight  : LongInt;
       
    32     cWindowedWidth     : LongInt;
       
    33     cWindowedHeight    : LongInt;
    30     cScreenWidth       : LongInt;
    34     cScreenWidth       : LongInt;
    31     cScreenHeight      : LongInt;
    35     cScreenHeight      : LongInt;
    32     cOrigScreenWidth   : LongInt;
       
    33     cOrigScreenHeight  : LongInt;
       
    34     cNewScreenWidth    : LongInt;
    36     cNewScreenWidth    : LongInt;
    35     cNewScreenHeight   : LongInt;
    37     cNewScreenHeight   : LongInt;
    36     cScreenResizeDelay : LongWord;
    38     cScreenResizeDelay : LongWord;
    37     cBits              : LongInt;
       
    38     ipcPort            : Word;
    39     ipcPort            : Word;
    39     cFullScreen        : boolean;
    40     cFullScreen        : boolean;
    40     cLocaleFName       : shortstring;
    41     cLocaleFName       : shortstring;
    41     cLocale            : shortstring;
    42     cLocale            : shortstring;
    42     cTimerInterval     : LongInt;
    43     cTimerInterval     : LongInt;
   155     cDamageModifier : hwFloat;
   156     cDamageModifier : hwFloat;
   156     cLaserSighting  : boolean;
   157     cLaserSighting  : boolean;
   157     cVampiric       : boolean;
   158     cVampiric       : boolean;
   158     cArtillery      : boolean;
   159     cArtillery      : boolean;
   159     WeaponTooltipTex: PTexture;
   160     WeaponTooltipTex: PTexture;
   160     AmmoMenuTex     : PTexture;
       
   161     AmmoMenuInvalidated: boolean;
   161     AmmoMenuInvalidated: boolean;
   162     AmmoRect		: TSDL_Rect;
   162     AmmoRect		: TSDL_Rect;
   163     HHTexture       : PTexture;
   163     HHTexture       : PTexture;
   164     cMaxZoomLevel   : real;
   164     cMaxZoomLevel   : real;
   165     cMinZoomLevel   : real;
   165     cMinZoomLevel   : real;
   175 
   175 
   176     WaterColorArray : array[0..3] of HwColor4f;
   176     WaterColorArray : array[0..3] of HwColor4f;
   177     SDWaterColorArray : array[0..3] of HwColor4f;
   177     SDWaterColorArray : array[0..3] of HwColor4f;
   178     SDTint          : LongInt;
   178     SDTint          : LongInt;
   179 
   179 
   180     CursorPoint     : TPoint;
   180     TargetCursorPoint     : TPoint;
   181     TargetPoint     : TPoint;
   181     CursorPoint           : TPoint;
       
   182     TargetPoint           : TPoint;
   182 
   183 
   183     ScreenFade      : TScreenFade;
   184     ScreenFade      : TScreenFade;
   184     ScreenFadeValue : LongInt;
   185     ScreenFadeValue : LongInt;
   185     ScreenFadeSpeed : LongInt;
   186     ScreenFadeSpeed : LongInt;
   186 
   187 
   194 
   195 
   195     LuaGoals        : shortstring;
   196     LuaGoals        : shortstring;
   196 
   197 
   197     LuaTemplateNumber : LongWord;
   198     LuaTemplateNumber : LongWord;
   198 
   199 
   199     VoiceList : array[0..7] of TVoice =  (
       
   200                     ( snd: sndNone; voicepack: nil),
       
   201                     ( snd: sndNone; voicepack: nil),
       
   202                     ( snd: sndNone; voicepack: nil),
       
   203                     ( snd: sndNone; voicepack: nil),
       
   204                     ( snd: sndNone; voicepack: nil),
       
   205                     ( snd: sndNone; voicepack: nil),
       
   206                     ( snd: sndNone; voicepack: nil),
       
   207                     ( snd: sndNone; voicepack: nil));
       
   208     LastVoice : TVoice = ( snd: sndNone; voicepack: nil );
   200     LastVoice : TVoice = ( snd: sndNone; voicepack: nil );
       
   201 
       
   202     mobileRecord: TMobileRecord;
   209 
   203 
   210 /////////////////////////////////////
   204 /////////////////////////////////////
   211 //Buttons
   205 //Buttons
   212 {$IFDEF USE_TOUCH_INTERFACE}
   206 {$IFDEF USE_TOUCH_INTERFACE}
   213     buttonScale: GLFloat;
   207     buttonScale: GLFloat;
   688             (Sprite: sprLemonade; FramesCount: 24; Interval: 125; cmd: '/ilovelotsoflemonade'; Voice: sndNone; VoiceDelay: 0),
   682             (Sprite: sprLemonade; FramesCount: 24; Interval: 125; cmd: '/ilovelotsoflemonade'; Voice: sndNone; VoiceDelay: 0),
   689             (Sprite:    sprShrug; FramesCount: 24; Interval: 125; cmd: '/shrug'; Voice: sndNone; VoiceDelay: 0),
   683             (Sprite:    sprShrug; FramesCount: 24; Interval: 125; cmd: '/shrug'; Voice: sndNone; VoiceDelay: 0),
   690             (Sprite:   sprJuggle; FramesCount: 49; Interval:  38; cmd: '/juggle'; Voice: sndNone; VoiceDelay: 0)
   684             (Sprite:   sprJuggle; FramesCount: 49; Interval:  38; cmd: '/juggle'; Voice: sndNone; VoiceDelay: 0)
   691             );
   685             );
   692 
   686 
   693     Soundz: array[TSound] of record
       
   694             FileName: string[31];
       
   695             Path    : TPathType;
       
   696             end = (
       
   697             (FileName:                         ''; Path: ptNone  ),// sndNone
       
   698             (FileName:        'grenadeimpact.ogg'; Path: ptSounds),// sndGrenadeImpact
       
   699             (FileName:            'explosion.ogg'; Path: ptSounds),// sndExplosion
       
   700             (FileName:         'throwpowerup.ogg'; Path: ptSounds),// sndThrowPowerUp
       
   701             (FileName:         'throwrelease.ogg'; Path: ptSounds),// sndThrowRelease
       
   702             (FileName:               'splash.ogg'; Path: ptSounds),// sndSplash
       
   703             (FileName:        'shotgunreload.ogg'; Path: ptSounds),// sndShotgunReload
       
   704             (FileName:          'shotgunfire.ogg'; Path: ptSounds),// sndShotgunFire
       
   705             (FileName:          'graveimpact.ogg'; Path: ptSounds),// sndGraveImpact
       
   706             (FileName:           'mineimpact.ogg'; Path: ptSounds),// sndMineImpact
       
   707             (FileName:             'minetick.ogg'; Path: ptSounds),// sndMineTicks
       
   708             (FileName:             'Droplet1.ogg'; Path: ptSounds),// sndMudballImpact
       
   709             (FileName:           'pickhammer.ogg'; Path: ptSounds),// sndPickhammer
       
   710             (FileName:                  'gun.ogg'; Path: ptSounds),// sndGun
       
   711             (FileName:                  'bee.ogg'; Path: ptSounds),// sndBee
       
   712             (FileName:                'Jump1.ogg'; Path: ptVoices),// sndJump1
       
   713             (FileName:                'Jump2.ogg'; Path: ptVoices),// sndJump2
       
   714             (FileName:                'Jump3.ogg'; Path: ptVoices),// sndJump3
       
   715             (FileName:               'Yessir.ogg'; Path: ptVoices),// sndYesSir
       
   716             (FileName:                'Laugh.ogg'; Path: ptVoices),// sndLaugh
       
   717             (FileName:            'Illgetyou.ogg'; Path: ptVoices),// sndIllGetYou
       
   718             (FileName:          'JustYouWait.ogg'; Path: ptVoices),// sndJustYouWait
       
   719             (FileName:             'Incoming.ogg'; Path: ptVoices),// sndIncoming
       
   720             (FileName:               'Missed.ogg'; Path: ptVoices),// sndMissed
       
   721             (FileName:               'Stupid.ogg'; Path: ptVoices),// sndStupid
       
   722             (FileName:           'Firstblood.ogg'; Path: ptVoices),// sndFirstBlood
       
   723             (FileName:               'Boring.ogg'; Path: ptVoices),// sndBoring
       
   724             (FileName:               'Byebye.ogg'; Path: ptVoices),// sndByeBye
       
   725             (FileName:             'Sameteam.ogg'; Path: ptVoices),// sndSameTeam
       
   726             (FileName:               'Nutter.ogg'; Path: ptVoices),// sndNutter
       
   727             (FileName:       'Reinforcements.ogg'; Path: ptVoices),// sndReinforce
       
   728             (FileName:              'Traitor.ogg'; Path: ptVoices),// sndTraitor
       
   729             (FileName:      'Youllregretthat.ogg'; Path: ptVoices),// sndRegret
       
   730             (FileName:            'Enemydown.ogg'; Path: ptVoices),// sndEnemyDown
       
   731             (FileName:               'Coward.ogg'; Path: ptVoices),// sndCoward
       
   732             (FileName:                'Hurry.ogg'; Path: ptVoices),// sndHurry
       
   733             (FileName:              'Watchit.ogg'; Path: ptVoices),// sndWatchIt
       
   734             (FileName:             'Kamikaze.ogg'; Path: ptVoices),// sndKamikaze
       
   735             (FileName:                'cake2.ogg'; Path: ptSounds),// sndCake
       
   736             (FileName:                  'Ow1.ogg'; Path: ptVoices),// sndOw1
       
   737             (FileName:                  'Ow2.ogg'; Path: ptVoices),// sndOw2
       
   738             (FileName:                  'Ow3.ogg'; Path: ptVoices),// sndOw3
       
   739             (FileName:                  'Ow4.ogg'; Path: ptVoices),// sndOw4
       
   740             (FileName:           'Firepunch1.ogg'; Path: ptVoices),// sndFirepunch1
       
   741             (FileName:           'Firepunch2.ogg'; Path: ptVoices),// sndFirepunch2
       
   742             (FileName:           'Firepunch3.ogg'; Path: ptVoices),// sndFirepunch3
       
   743             (FileName:           'Firepunch4.ogg'; Path: ptVoices),// sndFirepunch4
       
   744             (FileName:           'Firepunch5.ogg'; Path: ptVoices),// sndFirepunch5
       
   745             (FileName:           'Firepunch6.ogg'; Path: ptVoices),// sndFirepunch6
       
   746             (FileName:                'Melon.ogg'; Path: ptVoices),// sndMelon
       
   747             (FileName:              'Hellish.ogg'; Path: ptSounds),// sndHellish
       
   748             (FileName:               'Yoohoo.ogg'; Path: ptSounds),// sndYoohoo
       
   749             (FileName:              'rcplane.ogg'; Path: ptSounds),// sndRCPlane
       
   750             (FileName:            'whipcrack.ogg'; Path: ptSounds),// sndWhipCrack
       
   751             (FileName:'ride_of_the_valkyries.ogg'; Path: ptSounds),// sndRideOfTheValkyries
       
   752             (FileName:               'denied.ogg'; Path: ptSounds),// sndDenied
       
   753             (FileName:               'placed.ogg'; Path: ptSounds),// sndPlaced
       
   754             (FileName:          'baseballbat.ogg'; Path: ptSounds),// sndBaseballBat
       
   755             (FileName:                'steam.ogg'; Path: ptSounds),// sndVaporize
       
   756             (FileName:                 'warp.ogg'; Path: ptSounds),// sndWarp
       
   757             (FileName:          'suddendeath.ogg'; Path: ptSounds),// sndSuddenDeath
       
   758             (FileName:               'mortar.ogg'; Path: ptSounds),// sndMortar
       
   759             (FileName:         'shutterclick.ogg'; Path: ptSounds),// sndShutter
       
   760             (FileName:              'homerun.ogg'; Path: ptSounds),// sndHomerun
       
   761             (FileName:              'molotov.ogg'; Path: ptSounds),// sndMolotov
       
   762             (FileName:            'Takecover.ogg'; Path: ptVoices),// sndCover
       
   763             (FileName:                'Uh-oh.ogg'; Path: ptVoices),// sndUhOh
       
   764             (FileName:                 'Oops.ogg'; Path: ptVoices),// sndOops
       
   765             (FileName:                 'Nooo.ogg'; Path: ptVoices),// sndNooo
       
   766             (FileName:                'Hello.ogg'; Path: ptVoices),// sndHello
       
   767             (FileName:             'ropeshot.ogg'; Path: ptSounds),// sndRopeShot
       
   768             (FileName:           'ropeattach.ogg'; Path: ptSounds),// sndRopeAttach
       
   769             (FileName:          'roperelease.ogg'; Path: ptSounds),// sndRopeRelease
       
   770             (FileName:            'switchhog.ogg'; Path: ptSounds),// sndSwitchHog
       
   771             (FileName:              'Victory.ogg'; Path: ptVoices),// sndVictory
       
   772             (FileName:             'Flawless.ogg'; Path: ptVoices),// sndFlawless
       
   773             (FileName:         'sniperreload.ogg'; Path: ptSounds),// sndSniperReload
       
   774             (FileName:                'steps.ogg'; Path: ptSounds),// sndSteps
       
   775             (FileName:           'lowgravity.ogg'; Path: ptSounds),// sndLowGravity
       
   776             (FileName:           'hell_growl.ogg'; Path: ptSounds),// sndHellishImpact1
       
   777             (FileName:            'hell_ooff.ogg'; Path: ptSounds),// sndHellishImpact2
       
   778             (FileName:              'hell_ow.ogg'; Path: ptSounds),// sndHellishImpact3
       
   779             (FileName:             'hell_ugh.ogg'; Path: ptSounds),// sndHellishImpact4
       
   780             (FileName:          'melonimpact.ogg'; Path: ptSounds),// sndMelonImpact
       
   781             (FileName:             'Droplet1.ogg'; Path: ptSounds),// sndDroplet1
       
   782             (FileName:             'Droplet2.ogg'; Path: ptSounds),// sndDroplet2
       
   783             (FileName:             'Droplet3.ogg'; Path: ptSounds),// sndDroplet3
       
   784             (FileName:                  'egg.ogg'; Path: ptSounds),// sndEggBreak
       
   785             (FileName:             'drillgun.ogg'; Path: ptSounds),// sndDrillRocket
       
   786             (FileName:          'PoisonCough.ogg'; Path: ptVoices),// sndPoisonCough
       
   787             (FileName:           'PoisonMoan.ogg'; Path: ptVoices),// sndPoisonMoan
       
   788             (FileName:             'BirdyLay.ogg'; Path: ptSounds),// sndBirdyLay
       
   789             (FileName:              'Whistle.ogg'; Path: ptSounds),// sndWhistle
       
   790             (FileName:             'beewater.ogg'; Path: ptSounds),// sndBeeWater
       
   791             (FileName:                   '1C.ogg'; Path: ptSounds),// sndPiano0
       
   792             (FileName:                   '2D.ogg'; Path: ptSounds),// sndPiano1
       
   793             (FileName:                   '3E.ogg'; Path: ptSounds),// sndPiano2
       
   794             (FileName:                   '4F.ogg'; Path: ptSounds),// sndPiano3
       
   795             (FileName:                   '5G.ogg'; Path: ptSounds),// sndPiano4
       
   796             (FileName:                   '6A.ogg'; Path: ptSounds),// sndPiano5
       
   797             (FileName:                   '7B.ogg'; Path: ptSounds),// sndPiano6
       
   798             (FileName:                   '8C.ogg'; Path: ptSounds),// sndPiano7
       
   799             (FileName:                   '9D.ogg'; Path: ptSounds),// sndPiano8
       
   800             (FileName:                 'skip.ogg'; Path: ptSounds),// sndSkip
       
   801             (FileName:              'sinegun.ogg'; Path: ptSounds),// sndSineGun
       
   802             (FileName:                'Ooff1.ogg'; Path: ptVoices),// sndOoff1
       
   803             (FileName:                'Ooff2.ogg'; Path: ptVoices),// sndOoff2
       
   804             (FileName:                'Ooff3.ogg'; Path: ptVoices),// sndOoff3
       
   805             (FileName:               'hammer.ogg'; Path: ptSounds),// sndWhack
       
   806             (FileName:           'Comeonthen.ogg'; Path: ptVoices),// sndComeonthen
       
   807             (FileName:            'parachute.ogg'; Path: ptSounds),// sndParachute
       
   808             (FileName:                 'bump.ogg'; Path: ptSounds),// sndBump
       
   809             (FileName:            'hogchant3.ogg'; Path: ptSounds),// sndResurrector
       
   810             (FileName:                'plane.ogg'; Path: ptSounds),// sndPlane
       
   811             (FileName:               'TARDIS.ogg'; Path: ptSounds) // sndTardis
       
   812             );
       
   813 var
   687 var
   814     Ammoz: array [TAmmoType] of record
   688     Ammoz: array [TAmmoType] of record
   815             NameId: TAmmoStrId;
   689             NameId: TAmmoStrId;
   816             NameTex: PTexture;
   690             NameTex: PTexture;
   817             Probability, NumberInCase: Longword;
   691             Probability, NumberInCase: Longword;
  2255             PosSprite: sprAmTeleport;
  2129             PosSprite: sprAmTeleport;
  2256             ejectX: 0;
  2130             ejectX: 0;
  2257             ejectY: 0),
  2131             ejectY: 0),
  2258 
  2132 
  2259 // Structure      
  2133 // Structure      
       
  2134 {
  2260             (NameId: sidStructure;
  2135             (NameId: sidStructure;
  2261             NameTex: nil;
  2136             NameTex: nil;
  2262             Probability: 0;
  2137             Probability: 0;
  2263             NumberInCase: 1;
  2138             NumberInCase: 1;
  2264             Ammo: (Propz: ammoprop_ForwMsgs or
  2139             Ammo: (Propz: ammoprop_ForwMsgs or
  2280             SkipTurns: 0;
  2155             SkipTurns: 0;
  2281             PosCount: 1;
  2156             PosCount: 1;
  2282             PosSprite: sprWater;
  2157             PosSprite: sprWater;
  2283             ejectX: 0;
  2158             ejectX: 0;
  2284             ejectY: 0),
  2159             ejectY: 0),
       
  2160 }
  2285             
  2161             
  2286 // Land Gun
  2162 // Land Gun
  2287             (NameId: sidLandGun;
  2163             (NameId: sidLandGun;
  2288             NameTex: nil;
  2164             NameTex: nil;
  2289             Probability: 20;
  2165             Probability: 20;
  2356             PosCount: 1;
  2232             PosCount: 1;
  2357             PosSprite: sprWater;
  2233             PosSprite: sprWater;
  2358             ejectX: 0;
  2234             ejectX: 0;
  2359             ejectY: 0)
  2235             ejectY: 0)
  2360         );
  2236         );
  2361 
       
  2362 const
       
  2363     GearKindAmmoTypeMap : array [TGearType] of TAmmoType = (    
       
  2364 (*          gtFlame *)   amNothing
       
  2365 (*       gtHedgehog *) , amNothing
       
  2366 (*           gtMine *) , amMine
       
  2367 (*           gtCase *) , amNothing
       
  2368 (*     gtExplosives *) , amNothing
       
  2369 (*        gtGrenade *) , amGrenade
       
  2370 (*          gtShell *) , amBazooka
       
  2371 (*          gtGrave *) , amNothing
       
  2372 (*            gtBee *) , amBee
       
  2373 (*    gtShotgunShot *) , amShotgun
       
  2374 (*     gtPickHammer *) , amPickHammer
       
  2375 (*           gtRope *) , amRope
       
  2376 (*     gtDEagleShot *) , amDEagle
       
  2377 (*       gtDynamite *) , amDynamite
       
  2378 (*    gtClusterBomb *) , amClusterBomb
       
  2379 (*        gtCluster *) , amClusterBomb
       
  2380 (*         gtShover *) , amBaseballBat  // Shover is only used for baseball bat right now
       
  2381 (*      gtFirePunch *) , amFirePunch
       
  2382 (*    gtATStartGame *) , amNothing
       
  2383 (*   gtATFinishGame *) , amNothing
       
  2384 (*      gtParachute *) , amParachute
       
  2385 (*      gtAirAttack *) , amAirAttack
       
  2386 (*        gtAirBomb *) , amAirAttack
       
  2387 (*      gtBlowTorch *) , amBlowTorch
       
  2388 (*         gtGirder *) , amGirder
       
  2389 (*       gtTeleport *) , amTeleport
       
  2390 (*       gtSwitcher *) , amSwitch
       
  2391 (*         gtTarget *) , amNothing
       
  2392 (*         gtMortar *) , amMortar
       
  2393 (*           gtWhip *) , amWhip
       
  2394 (*       gtKamikaze *) , amKamikaze
       
  2395 (*           gtCake *) , amCake
       
  2396 (*      gtSeduction *) , amSeduction
       
  2397 (*     gtWatermelon *) , amWatermelon
       
  2398 (*     gtMelonPiece *) , amWatermelon
       
  2399 (*    gtHellishBomb *) , amHellishBomb
       
  2400 (*        gtWaterUp *) , amNothing
       
  2401 (*          gtDrill *) , amDrill
       
  2402 (*        gtBallGun *) , amBallgun
       
  2403 (*           gtBall *) , amBallgun
       
  2404 (*        gtRCPlane *) , amRCPlane
       
  2405 (*gtSniperRifleShot *) , amSniperRifle
       
  2406 (*        gtJetpack *) , amJetpack
       
  2407 (*        gtMolotov *) , amMolotov
       
  2408 (*          gtBirdy *) , amBirdy
       
  2409 (*            gtEgg *) , amBirdy
       
  2410 (*         gtPortal *) , amPortalGun
       
  2411 (*          gtPiano *) , amPiano
       
  2412 (*        gtGasBomb *) , amGasBomb
       
  2413 (*    gtSineGunShot *) , amSineGun
       
  2414 (*   gtFlamethrower *) , amFlamethrower
       
  2415 (*          gtSMine *) , amSMine
       
  2416 (*    gtPoisonCloud *) , amNothing
       
  2417 (*         gtHammer *) , amHammer
       
  2418 (*      gtHammerHit *) , amHammer
       
  2419 (*    gtResurrector *) , amResurrector
       
  2420 (*    gtPoisonCloud *) , amNothing
       
  2421 (*       gtSnowball *) , amSnowball
       
  2422 (*          gtFlake *) , amNothing
       
  2423 (*      gtStructure *) , amStructure  // TODO - This will undoubtedly change once there is more than one structure
       
  2424 (*        gtLandGun *) , amLandGun
       
  2425 (*         gtTardis *) , amTardis
       
  2426 (*         gtIceGun *) , amIceGun
       
  2427 (*        gtAddAmmo *) , amNothing
       
  2428 (*  gtGenericFaller *) , amNothing
       
  2429 (*          gtKnife *) , amKnife
       
  2430     );
       
  2431 
  2237 
  2432 var
  2238 var
  2433     Land: TCollisionArray;
  2239     Land: TCollisionArray;
  2434     LandPixels: TLandArray;
  2240     LandPixels: TLandArray;
  2435     LandDirty: TDirtyTag;
  2241     LandDirty: TDirtyTag;
  2460     ClansCount: Longword;
  2266     ClansCount: Longword;
  2461     LocalClan: LongInt;  // last non-bot, non-extdriven clan
  2267     LocalClan: LongInt;  // last non-bot, non-extdriven clan
  2462     LocalTeam: LongInt;  // last non-bot, non-extdriven clan first team
  2268     LocalTeam: LongInt;  // last non-bot, non-extdriven clan first team
  2463     LocalAmmo: LongInt;  // last non-bot, non-extdriven clan's first team's ammo index, updated to next upcoming hog for per-hog-ammo
  2269     LocalAmmo: LongInt;  // last non-bot, non-extdriven clan's first team's ammo index, updated to next upcoming hog for per-hog-ammo
  2464     CurMinAngle, CurMaxAngle: Longword;
  2270     CurMinAngle, CurMaxAngle: Longword;
  2465     NextClan: boolean;
       
  2466 
  2271 
  2467     FollowGear: PGear;
  2272     FollowGear: PGear;
  2468     WindBarWidth: LongInt;
  2273     WindBarWidth: LongInt;
  2469     bShowAmmoMenu: boolean;
  2274     bShowAmmoMenu: boolean;
  2470     bSelected: boolean;
  2275     bSelected: boolean;
  2471     bShowFinger: boolean;
  2276     bShowFinger: boolean;
  2472     Frames: Longword;
  2277     Frames: Longword;
  2473     WaterColor, DeepWaterColor: TSDL_Color;
  2278     WaterColor, DeepWaterColor: TSDL_Color;
  2474     SkyColor, RQSkyColor, SDSkyColor: TSDL_Color;
  2279     SkyColor, RQSkyColor, SDSkyColor: TSDL_Color;
  2475     SkyOffset: LongInt;
  2280     SkyOffset: LongInt;
  2476     HorizontOffset: LongInt;
       
  2477 {$IFDEF COUNTTICKS}
  2281 {$IFDEF COUNTTICKS}
  2478     cntTicks: LongWord;
  2282     cntTicks: LongWord;
  2479 {$ENDIF}
  2283 {$ENDIF}
  2480     cOffsetY: LongInt;
       
  2481     AFRToggle: Boolean;
       
  2482     bAFRRight: Boolean;
       
  2483 
  2284 
  2484 
  2285 
  2485     PauseTexture,
  2286     PauseTexture,
  2486     SyncTexture,
  2287     SyncTexture,
  2487     ConfirmTexture: PTexture;
  2288     ConfirmTexture: PTexture;
  2488     cScaleFactor: GLfloat;
  2289     cScaleFactor: GLfloat;
  2489     SupportNPOTT: Boolean;
  2290     SupportNPOTT: Boolean;
  2490     Step: LongInt;
  2291     Step: LongInt;
  2491     squaresize : LongInt;
       
  2492     numsquares : LongInt;
       
  2493     ProgrTex: PTexture;
       
  2494     MissionIcons: PSDL_Surface;
  2292     MissionIcons: PSDL_Surface;
  2495     ropeIconTex: PTexture;
  2293     ropeIconTex: PTexture;
  2496 
  2294 
  2497     // stereoscopic framebuffer and textures
  2295     // stereoscopic framebuffer and textures
  2498     framel, framer, depthl, depthr: GLuint;
  2296     framel, framer, depthl, depthr: GLuint;
  2500 
  2298 
  2501     // video recorder framebuffer and texture
  2299     // video recorder framebuffer and texture
  2502     defaultFrame, depthv: GLuint;
  2300     defaultFrame, depthv: GLuint;
  2503     texv: GLuint;
  2301     texv: GLuint;
  2504 
  2302 
  2505     VisualGearLayers: array[0..6] of PVisualGear;
       
  2506     lastVisualGearByUID: PVisualGear;
  2303     lastVisualGearByUID: PVisualGear;
  2507     vobFrameTicks, vobFramesCount, vobCount: Longword;
  2304     vobFrameTicks, vobFramesCount, vobCount: Longword;
  2508     vobVelocity, vobFallSpeed: LongInt;
  2305     vobVelocity, vobFallSpeed: LongInt;
  2509     vobSDFrameTicks, vobSDFramesCount, vobSDCount: Longword;
  2306     vobSDFrameTicks, vobSDFramesCount, vobSDCount: Longword;
  2510     vobSDVelocity, vobSDFallSpeed: LongInt;
  2307     vobSDVelocity, vobSDFallSpeed: LongInt;
  2511 
  2308 
  2512     ControllerNumControllers: Integer;
       
  2513     ControllerEnabled: Integer;
       
  2514     ControllerNumAxes: array[0..5] of Integer;
       
  2515     //ControllerNumBalls: array[0..5] of Integer;
       
  2516     ControllerNumHats: array[0..5] of Integer;
       
  2517     ControllerNumButtons: array[0..5] of Integer;
       
  2518     ControllerAxes: array[0..5] of array[0..19] of Integer;
       
  2519     //ControllerBalls: array[0..5] of array[0..19] of array[0..1] of Integer;
       
  2520     ControllerHats: array[0..5] of array[0..19] of Byte;
       
  2521     ControllerButtons: array[0..5] of array[0..19] of Byte;
       
  2522 
       
  2523     DefaultBinds : TBinds;
  2309     DefaultBinds : TBinds;
  2524 
  2310 
  2525     lastTurnChecksum : Longword;
  2311     lastTurnChecksum : Longword;
  2526 
  2312 
  2527 var trammo:  array[TAmmoStrId] of ansistring;   // name of the weapon
  2313 var trammo:  array[TAmmoStrId] of ansistring;   // name of the weapon
  2539 
  2325 
  2540 procedure preInitModule;
  2326 procedure preInitModule;
  2541 begin
  2327 begin
  2542     // initialisation flags - they are going to be overwritten by program args
  2328     // initialisation flags - they are going to be overwritten by program args
  2543 
  2329 
  2544     cScreenWidth    := 1024;
  2330     cFullscreenWidth  := 0;
  2545     cScreenHeight   := 768;
  2331     cFullscreenHeight := 0;
  2546     cBits           := 32;
  2332     cWindowedWidth    := 1024;
       
  2333     cWindowedHeight   := 768;
       
  2334     cScreenWidth      := cWindowedWidth;
       
  2335     cScreenHeight     := cWindowedHeight;
       
  2336 
  2547     cShowFPS        := false;
  2337     cShowFPS        := false;
  2548     cAltDamage      := true;
  2338     cAltDamage      := true;
  2549     cTimerInterval  := 8;
  2339     cTimerInterval  := 8;
  2550     cReducedQuality := rqNone;
  2340     cReducedQuality := rqNone;
  2551     cLocaleFName    := 'en.txt';
  2341     cLocaleFName    := 'en.txt';
  2557     UserNick        := '';
  2347     UserNick        := '';
  2558     cStereoMode     := smNone;
  2348     cStereoMode     := smNone;
  2559     GrayScale       := false;
  2349     GrayScale       := false;
  2560     PathPrefix      := './';
  2350     PathPrefix      := './';
  2561     GameType        := gmtLocal;
  2351     GameType        := gmtLocal;
       
  2352     cOnlyStats      := False;
  2562 
  2353 
  2563 {$IFDEF USE_VIDEO_RECORDING}
  2354 {$IFDEF USE_VIDEO_RECORDING}
  2564     RecPrefix          := '';
  2355     RecPrefix          := '';
  2565     cAVFormat          := '';
  2356     cAVFormat          := '';
  2566     cVideoCodec        := '';
  2357     cVideoCodec        := '';
  2577     cLocale:= cLocaleFName;
  2368     cLocale:= cLocaleFName;
  2578     SplitByChar(cLocale, s, '.');
  2369     SplitByChar(cLocale, s, '.');
  2579 
  2370 
  2580     cFlattenFlakes      := false;
  2371     cFlattenFlakes      := false;
  2581     cFlattenClouds      := false;
  2372     cFlattenClouds      := false;
  2582     cOnlyStats          := False;
       
  2583     lastVisualGearByUID := nil;
  2373     lastVisualGearByUID := nil;
  2584     lastGearByUID       := nil;
  2374     lastGearByUID       := nil;
  2585     cReadyDelay         := 5000;
  2375     cReadyDelay         := 5000;
  2586 
  2376 
  2587         {*  REFERENCE
  2377         {*  REFERENCE
  2722     vobSDFramesCount:= 4;
  2512     vobSDFramesCount:= 4;
  2723     vobSDCount:= 30 * cScreenSpace div LAND_WIDTH;
  2513     vobSDCount:= 30 * cScreenSpace div LAND_WIDTH;
  2724     vobSDVelocity:= 15;
  2514     vobSDVelocity:= 15;
  2725     vobSDFallSpeed:= 250;
  2515     vobSDFallSpeed:= 250;
  2726 
  2516 
  2727     cMinScreenWidth:= min(cScreenWidth, 640);
  2517     cMinScreenWidth  := min(cScreenWidth, 640);
  2728     cMinScreenHeight:= min(cScreenHeight, 480);
  2518     cMinScreenHeight := min(cScreenHeight, 480);
  2729     cOrigScreenWidth:= cScreenWidth;
       
  2730     cOrigScreenHeight:= cScreenHeight;
       
  2731 
  2519 
  2732     cNewScreenWidth    := cScreenWidth;
  2520     cNewScreenWidth    := cScreenWidth;
  2733     cNewScreenHeight   := cScreenHeight;
  2521     cNewScreenHeight   := cScreenHeight;
  2734     cScreenResizeDelay := 0;
  2522     cScreenResizeDelay := 0;
  2735 
  2523 
       
  2524     // make sure fullscreen resolution is always initialised somehow
       
  2525     if cFullscreenWidth = 0 then
       
  2526         cFullscreenWidth:= min(cWindowedWidth, 640);
       
  2527     if cFullscreenHeight = 0 then
       
  2528         cFullscreenHeight:= min(cWindowedHeight, 480);
       
  2529 
       
  2530 
  2736     LuaGoals:= '';
  2531     LuaGoals:= '';
  2737     cMapName:= '';
  2532     cMapName:= '';
  2738 
  2533 
  2739     LuaTemplateNumber:= 0;
  2534     LuaTemplateNumber:= 0;
       
  2535 
       
  2536     mobileRecord.getScreenDPI:= @getScreenDPI; //TODO: define external function.
       
  2537     {$IFDEF IPHONEOS}
       
  2538     mobileRecord.PerformRumble:= @AudioServicesPlaySystemSound;
       
  2539     mobileRecord.GameLoading:= @startLoadingIndicator;
       
  2540     mobileRecord.GameLoaded:= @stopLoadingIndicator;
       
  2541     mobileRecord.SaveLoadingEnded:= @saveFinishedSynching;
       
  2542     {$ELSE}
       
  2543     mobileRecord.PerformRumble:= nil;
       
  2544     mobileRecord.GameLoading:= nil;
       
  2545     mobileRecord.GameLoaded:= nil;
       
  2546     mobileRecord.SaveLoadingEnded:= nil;
       
  2547     {$ENDIF}
  2740 end;
  2548 end;
  2741 
  2549 
  2742 procedure freeModule;
  2550 procedure freeModule;
  2743 begin
  2551 begin
  2744 end;
  2552 end;