# HG changeset patch # User unC0Rr # Date 1290005155 -10800 # Node ID 83ef5081553517b480538489fb02efe037a6ba11 # Parent a1fcfc341a52adc1952b7bf4e127173e881aab6c Move variables from uMisc to uVariables diff -r a1fcfc341a52 -r 83ef50815535 hedgewars/hwengine.pas --- a/hedgewars/hwengine.pas Wed Nov 17 17:22:36 2010 +0300 +++ b/hedgewars/hwengine.pas Wed Nov 17 17:45:55 2010 +0300 @@ -31,7 +31,7 @@ uses SDLh, uMisc, uConsole, uGame, uConsts, uLand, uAmmos, uVisualGears, uGears, uStore, uWorld, uKeys, uSound, uScript, uTeams, uStats, uIO, uLocale, uChat, uAI, uAIMisc, uRandom, uLandTexture, uCollisions, uMobile, - sysutils, uTypes; + sysutils, uTypes, uVariables; var isTerminated: boolean = false; alsoShutdownFrontend: boolean = false; @@ -112,6 +112,7 @@ flagMakeCapture:= false; s:= 'hw_' + FormatDateTime('YYYY-MM-DD_HH-mm-ss', Now()) + inttostr(GameTicks); WriteLnToConsole('Saving ' + s + '...'); + playSound(sndShutter); MakeScreenshot(s); //SDL_SaveBMP_RW(SDLPrimSurface, SDL_RWFromFile(Str2PChar(s), 'wb'), 1) end; @@ -319,6 +320,7 @@ // uConsts does not need initialization as they are all consts uMisc.initModule; + uVariables.initModule; uConsole.initModule; // MUST happen after uMisc uLand.initModule; @@ -387,6 +389,7 @@ uLand.freeModule; uConsole.freeModule; + uVariables.freeModule; uMisc.freeModule; // uMisc closes the debug log. end; diff -r a1fcfc341a52 -r 83ef50815535 hedgewars/uAI.pas --- a/hedgewars/uAI.pas Wed Nov 17 17:22:36 2010 +0300 +++ b/hedgewars/uAI.pas Wed Nov 17 17:45:55 2010 +0300 @@ -30,7 +30,8 @@ implementation uses uTeams, uConsts, SDLh, uAIMisc, uAIAmmoTests, uAIActions, uMisc, - uAmmos, uConsole, SysUtils{$IFDEF UNIX}, cthreads{$ENDIF}, uTypes; + uAmmos, uConsole, SysUtils{$IFDEF UNIX}, cthreads{$ENDIF}, uTypes, + uVariables; var BestActions: TActions; CanUseAmmo: array [TAmmoType] of boolean; diff -r a1fcfc341a52 -r 83ef50815535 hedgewars/uAIActions.pas --- a/hedgewars/uAIActions.pas Wed Nov 17 17:22:36 2010 +0300 +++ b/hedgewars/uAIActions.pas Wed Nov 17 17:45:55 2010 +0300 @@ -62,7 +62,7 @@ procedure ProcessAction(var Actions: TActions; Me: PGear); implementation -uses uMisc, uConsole, uAIMisc, uAI, uAmmos; +uses uMisc, uConsole, uAIMisc, uAI, uAmmos, uVariables; const ActionIdToStr: array[0..6] of string[16] = ( {aia_none} '', diff -r a1fcfc341a52 -r 83ef50815535 hedgewars/uAIAmmoTests.pas --- a/hedgewars/uAIAmmoTests.pas Wed Nov 17 17:22:36 2010 +0300 +++ b/hedgewars/uAIAmmoTests.pas Wed Nov 17 17:45:55 2010 +0300 @@ -108,7 +108,7 @@ const BadTurn = Low(LongInt) div 4; implementation -uses uMisc, uAIMisc, uLand; +uses uMisc, uAIMisc, uLand, uVariables; function Metric(x1, y1, x2, y2: LongInt): LongInt; begin diff -r a1fcfc341a52 -r 83ef50815535 hedgewars/uAIMisc.pas --- a/hedgewars/uAIMisc.pas Wed Nov 17 17:22:36 2010 +0300 +++ b/hedgewars/uAIMisc.pas Wed Nov 17 17:45:55 2010 +0300 @@ -68,7 +68,7 @@ end; implementation -uses uTeams, uMisc, uLand, uCollisions; +uses uTeams, uMisc, uLand, uCollisions, uVariables; const KillScore = 200; diff -r a1fcfc341a52 -r 83ef50815535 hedgewars/uAmmos.pas --- a/hedgewars/uAmmos.pas Wed Nov 17 17:22:36 2010 +0300 +++ b/hedgewars/uAmmos.pas Wed Nov 17 17:45:55 2010 +0300 @@ -47,7 +47,7 @@ var StoreCnt: Longword; implementation -uses uMisc, uGears, uWorld, uLocale, uConsole, uMobile; +uses uMisc, uGears, uWorld, uLocale, uConsole, uMobile, uVariables; type TAmmoCounts = array[TAmmoType] of Longword; var StoresList: array[0..Pred(cMaxHHs)] of PHHAmmo; diff -r a1fcfc341a52 -r 83ef50815535 hedgewars/uChat.pas --- a/hedgewars/uChat.pas Wed Nov 17 17:22:36 2010 +0300 +++ b/hedgewars/uChat.pas Wed Nov 17 17:45:55 2010 +0300 @@ -34,7 +34,7 @@ showAll: boolean; implementation -uses uMisc, uStore, uConsts, SDLh, uConsole, uKeys, uTeams, uTypes; +uses uMisc, uStore, uConsts, SDLh, uConsole, uKeys, uTeams, uTypes, uVariables; const MaxStrIndex = 27; diff -r a1fcfc341a52 -r 83ef50815535 hedgewars/uCollisions.pas --- a/hedgewars/uCollisions.pas Wed Nov 17 17:22:36 2010 +0300 +++ b/hedgewars/uCollisions.pas Wed Nov 17 17:45:55 2010 +0300 @@ -52,7 +52,7 @@ function calcSlopeTangent(Gear: PGear; collisionX, collisionY: LongInt; var outDeltaX, outDeltaY: LongInt; TestWord: LongWord): Boolean; implementation -uses uMisc, uConsts, uLand, uLandGraphics; +uses uMisc, uConsts, uLand, uLandGraphics, uVariables; type TCollisionEntry = record X, Y, Radius: LongInt; diff -r a1fcfc341a52 -r 83ef50815535 hedgewars/uConsole.pas --- a/hedgewars/uConsole.pas Wed Nov 17 17:22:36 2010 +0300 +++ b/hedgewars/uConsole.pas Wed Nov 17 17:45:55 2010 +0300 @@ -38,7 +38,8 @@ implementation uses uMisc, uStore, Types, uConsts, uGears, uTeams, uIO, uKeys, uWorld, uMobile, - uRandom, uAmmos, uStats, uChat, SDLh, uSound, uVisualGears, uScript, uTypes; + uRandom, uAmmos, uStats, uChat, SDLh, uSound, uVisualGears, uScript, uTypes, + uVariables; const cLineWidth: LongInt = 0; cLinesCount = 256; diff -r a1fcfc341a52 -r 83ef50815535 hedgewars/uGame.pas --- a/hedgewars/uGame.pas Wed Nov 17 17:22:36 2010 +0300 +++ b/hedgewars/uGame.pas Wed Nov 17 17:45:55 2010 +0300 @@ -26,7 +26,7 @@ //////////////////// implementation //////////////////// -uses uMisc, uKeys, uTeams, uIO, uAI, uGears, uScript, uSound, uMobile, uVisualGears, uTypes; +uses uKeys, uTeams, uIO, uAI, uGears, uScript, uSound, uMobile, uVisualGears, uTypes, uVariables; procedure DoGameTick(Lag: LongInt); var i: LongInt; diff -r a1fcfc341a52 -r 83ef50815535 hedgewars/uGears.pas --- a/hedgewars/uGears.pas Wed Nov 17 17:22:36 2010 +0300 +++ b/hedgewars/uGears.pas Wed Nov 17 17:45:55 2010 +0300 @@ -61,7 +61,7 @@ implementation uses uWorld, uMisc, uStore, uConsole, uSound, uTeams, uRandom, uCollisions, uLand, uIO, uLandGraphics, - uAIMisc, uLocale, uAI, uAmmos, uStats, uVisualGears, uScript, GLunit, uMobile; + uAIMisc, uLocale, uAI, uAmmos, uStats, uVisualGears, uScript, GLunit, uMobile, uVariables; const MAXROPEPOINTS = 384; var RopePoints: record diff -r a1fcfc341a52 -r 83ef50815535 hedgewars/uIO.pas --- a/hedgewars/uIO.pas Wed Nov 17 17:22:36 2010 +0300 +++ b/hedgewars/uIO.pas Wed Nov 17 17:45:55 2010 +0300 @@ -42,7 +42,7 @@ procedure NetGetNextCmd; implementation -uses uConsole, uConsts, uWorld, uMisc, uLand, uChat, uTeams, uTypes; +uses uConsole, uConsts, uWorld, uMisc, uLand, uChat, uTeams, uTypes, uVariables; type PCmd = ^TCmd; TCmd = packed record diff -r a1fcfc341a52 -r 83ef50815535 hedgewars/uKeys.pas --- a/hedgewars/uKeys.pas Wed Nov 17 17:22:36 2010 +0300 +++ b/hedgewars/uKeys.pas Wed Nov 17 17:45:55 2010 +0300 @@ -85,7 +85,7 @@ {$ENDIF} {$ENDIF} implementation -uses uTeams, uConsole, uMisc; +uses uTeams, uConsole, uMisc, uVariables; //const KeyNumber = 1024; var tkbd, tkbdn: TKeyboardState; diff -r a1fcfc341a52 -r 83ef50815535 hedgewars/uLand.pas --- a/hedgewars/uLand.pas Wed Nov 17 17:22:36 2010 +0300 +++ b/hedgewars/uLand.pas Wed Nov 17 17:45:55 2010 +0300 @@ -52,7 +52,8 @@ function LandBackPixel(x, y: LongInt): LongWord; implementation -uses uConsole, uStore, uMisc, uRandom, uTeams, uLandObjects, Adler32, uIO, uLandTexture, sysutils, uTypes; +uses uConsole, uStore, uMisc, uRandom, uTeams, uLandObjects, Adler32, uIO, uLandTexture, sysutils, + uTypes, uVariables; operator=(const a, b: direction) c: Boolean; begin diff -r a1fcfc341a52 -r 83ef50815535 hedgewars/uLandGraphics.pas --- a/hedgewars/uLandGraphics.pas Wed Nov 17 17:22:36 2010 +0300 +++ b/hedgewars/uLandGraphics.pas Wed Nov 17 17:45:55 2010 +0300 @@ -39,7 +39,7 @@ function TryPlaceOnLand(cpX, cpY: LongInt; Obj: TSprite; Frame: LongInt; doPlace: boolean): boolean; implementation -uses SDLh, uMisc, uLand, uLandTexture; +uses SDLh, uMisc, uLand, uLandTexture, uVariables; procedure FillCircleLines(x, y, dx, dy: LongInt; Value: Longword); var i: LongInt; diff -r a1fcfc341a52 -r 83ef50815535 hedgewars/uLandObjects.pas --- a/hedgewars/uLandObjects.pas Wed Nov 17 17:22:36 2010 +0300 +++ b/hedgewars/uLandObjects.pas Wed Nov 17 17:45:55 2010 +0300 @@ -29,7 +29,8 @@ procedure AddOnLandObjects(Surface: PSDL_Surface); implementation -uses uLand, uStore, uConsts, uMisc, uConsole, uRandom, uVisualGears, uSound, GLunit, uTypes; +uses uLand, uStore, uConsts, uMisc, uConsole, uRandom, uVisualGears, uSound, GLunit, + uTypes, uVariables; const MaxRects = 512; MAXOBJECTRECTS = 16; diff -r a1fcfc341a52 -r 83ef50815535 hedgewars/uLandTexture.pas --- a/hedgewars/uLandTexture.pas Wed Nov 17 17:22:36 2010 +0300 +++ b/hedgewars/uLandTexture.pas Wed Nov 17 17:45:55 2010 +0300 @@ -28,7 +28,7 @@ procedure DrawLand(dX, dY: LongInt); implementation -uses uMisc, uLand, uStore, uConsts, GLunit, uTypes; +uses uMisc, uLand, uStore, uConsts, GLunit, uTypes, uVariables; const TEXSIZE = 256; diff -r a1fcfc341a52 -r 83ef50815535 hedgewars/uMisc.pas --- a/hedgewars/uMisc.pas Wed Nov 17 17:22:36 2010 +0300 +++ b/hedgewars/uMisc.pas Wed Nov 17 17:45:55 2010 +0300 @@ -23,144 +23,7 @@ uses SDLh, uConsts, uFloat, GLunit, Math, uTypes; -var -/////// init flags /////// - cScreenWidth : LongInt = 1024; - cScreenHeight : LongInt = 768; - cBits : LongInt = 32; - //ipcPort is in uIO - cFullScreen : boolean = false; - isSoundEnabled : boolean = true; - isMusicEnabled : boolean = false; - cLocaleFName : shortstring = 'en.txt'; - cInitVolume : LongInt = 100; - cTimerInterval : LongInt = 8; - PathPrefix : shortstring = './'; - cShowFPS : boolean = false; - cAltDamage : boolean = true; - cReducedQuality : LongWord = rqNone; - //userNick is in uChat - recordFileName : shortstring = ''; - cReadyDelay : Longword = 0; - cLogfileBase : shortstring = 'debug'; -////////////////////////// - - isCursorVisible : boolean; - isTerminated : boolean; - isInLag : boolean; - isPaused : boolean; - isSEBackup : boolean; - isInMultiShoot : boolean; - isSpeed : boolean; - isFirstFrame : boolean; - - fastUntilLag : boolean; - - GameState : TGameState; - GameType : TGameType; - GameFlags : Longword; - TrainingFlags : Longword; - TurnTimeLeft : Longword; - ReadyTimeLeft : Longword; - cSuddenDTurns : LongInt; - cDamagePercent : LongInt; - cMineDudPercent : LongWord; - cTemplateFilter : LongInt; - cMapGen : LongInt; - cMazeSize : LongInt; - - cHedgehogTurnTime: Longword; - cMinesTime : LongInt; - cMaxAIThinkTime : Longword; - - cHealthCaseProb : LongInt; - cHealthCaseAmount: LongInt; - cWaterRise : LongInt; - cHealthDecrease : LongInt; - - cCloudsNumber : LongInt; - - cTagsMask : byte; - zoom : GLfloat; - ZoomValue : GLfloat; - - cWaterLine : LongInt; - cGearScrEdgesDist: LongInt; - - GameTicks : LongWord; - TrainingTimeInc : Longword; - TrainingTimeInD : Longword; - TrainingTimeInM : Longword; - TrainingTimeMax : Longword; - - TimeTrialStartTime: Longword; - TimeTrialStopTime : Longword; - - // originally from uConsts - Pathz: array[TPathType] of shortstring; - CountTexz: array[1..Pred(AMMO_INFINITE)] of PTexture; - LAND_WIDTH : LongInt; - LAND_HEIGHT : LongInt; - LAND_WIDTH_MASK : LongWord; - LAND_HEIGHT_MASK : LongWord; - cMaxCaptions : LongInt; - - cLeftScreenBorder : LongInt; - cRightScreenBorder : LongInt; - cScreenSpace : LongInt; - - cCaseFactor : Longword; - cLandMines : Longword; - cExplosives : Longword; - - cSeed : shortstring; - cVolumeDelta : LongInt; - cHasFocus : boolean; - cInactDelay : Longword; - - bBetweenTurns : boolean; - bWaterRising : boolean; - - ShowCrosshair : boolean; - CursorMovementX : LongInt; - CursorMovementY : LongInt; - cDrownSpeed : hwFloat; - cDrownSpeedf : float; - cMaxWindSpeed : hwFloat; - cWindSpeed : hwFloat; - cWindSpeedf : float; - cGravity : hwFloat; - cGravityf : float; - cDamageModifier : hwFloat; - cLaserSighting : boolean; - cVampiric : boolean; - cArtillery : boolean; - WeaponTooltipTex : PTexture; - - flagMakeCapture : boolean; - - InitStepsFlags : Longword; - RealTicks : Longword; - AttackBar : LongInt; - - WaterColorArray : array[0..3] of HwColor4f; - - CursorPoint : TPoint; - TargetPoint : TPoint; - - TextureList : PTexture; - - ScreenFade : TScreenFade; - ScreenFadeValue : LongInt; - ScreenFadeSpeed : LongInt; - -{$IFDEF SDL13} - SDLwindow : PSDL_Window; -{$ENDIF} - -procedure initModule; -procedure freeModule; procedure SplitBySpace(var a, b: shortstring); procedure SplitByChar(var a, b: ansistring; c: char); function EnumToStr(const en : TGearType) : shortstring; overload; @@ -200,8 +63,11 @@ {$ENDIF} procedure MakeScreenshot(filename: shortstring); +procedure initModule; +procedure freeModule; + implementation -uses uConsole, uStore, uIO, uSound, typinfo, sysutils, uMobile; +uses uConsole, uStore, uIO, typinfo, sysutils, uVariables; var KBnum: Longword; {$IFDEF DEBUGFILE} @@ -610,8 +476,6 @@ 0, 0, 0, 0 // number of important colors ); begin -playSound(sndShutter); - // flash ScreenFade:= sfFromWhite; ScreenFadeValue:= sfMax; @@ -703,119 +567,7 @@ procedure initModule; {$IFDEF DEBUGFILE}{$IFNDEF IPHONEOS}var i: LongInt;{$ENDIF}{$ENDIF} begin - Pathz:= cPathz; - {* REFERENCE - 4096 -> $FFFFF000 - 2048 -> $FFFFF800 - 1024 -> $FFFFFC00 - 512 -> $FFFFFE00 *} - if (cReducedQuality and rqLowRes) <> 0 then - begin - LAND_WIDTH:= 2048; - LAND_HEIGHT:= 1024; - LAND_WIDTH_MASK:= $FFFFF800; - LAND_HEIGHT_MASK:= $FFFFFC00; - end - else - begin - LAND_WIDTH:= 4096; - LAND_HEIGHT:= 2048; - LAND_WIDTH_MASK:= $FFFFF000; - LAND_HEIGHT_MASK:= $FFFFF800 - end; - - cDrownSpeed.QWordValue := 257698038; // 0.06 - cDrownSpeedf := 0.06; - cMaxWindSpeed.QWordValue:= 1073742; // 0.00025 - cWindSpeed.QWordValue := 429496; // 0.0001 - cWindSpeedf := 0.0001; - cGravity := cMaxWindSpeed * 2; - cGravityf := 0.00025 * 2; - cDamageModifier := _1; - TargetPoint := cTargetPointRef; - TextureList := nil; - - // int, longint longword and byte - CursorMovementX := 0; - CursorMovementY := 0; - GameTicks := 0; - TrainingTimeInc := 10000; - TrainingTimeInD := 500; - TrainingTimeInM := 5000; - TrainingTimeMax := 60000; - TimeTrialStartTime := 0; - TimeTrialStopTime := 0; - cWaterLine := LAND_HEIGHT; - cGearScrEdgesDist := 240; - - GameFlags := 0; - TrainingFlags := 0; - TurnTimeLeft := 0; - cSuddenDTurns := 15; - cDamagePercent := 100; - cMineDudPercent := 0; - cTemplateFilter := 0; - cMapGen := 0; // MAPGEN_REGULAR - cMazeSize := 0; - cHedgehogTurnTime := 45000; - cMinesTime := 3; - cMaxAIThinkTime := 9000; - cCloudsNumber := 9; - cHealthCaseProb := 35; - cHealthCaseAmount := 25; - cWaterRise := 47; - cHealthDecrease := 5; - - cTagsMask := 0; KBnum := 0; - InitStepsFlags := 0; - RealTicks := 0; - AttackBar := 0; // 0 - none, 1 - just bar at the right-down corner, 2 - from weapon - cCaseFactor := 5; {0..9} - cLandMines := 4; - cExplosives := 2; - - GameState := Low(TGameState); - GameType := gmtLocal; - zoom := cDefaultZoomLevel; - ZoomValue := cDefaultZoomLevel; - WeaponTooltipTex:= nil; - cLaserSighting := false; - cVampiric := false; - cArtillery := false; - flagMakeCapture := false; - bBetweenTurns := false; - bWaterRising := false; - isCursorVisible := false; - isTerminated := false; - isInLag := false; - isPaused := false; - isInMultiShoot := false; - isSpeed := false; - fastUntilLag := false; - isFirstFrame := true; - isSEBackup := true; - cSeed := ''; - cVolumeDelta := 0; - cHasFocus := true; - cInactDelay := 1250; - ReadyTimeLeft := 0; - - ScreenFade := sfNone; - -{$IFDEF SDL13} - SDLwindow := nil; -{$ENDIF} - - // those values still aren't perfect - cLeftScreenBorder:= round(-cMinZoomLevel * cScreenWidth); - cRightScreenBorder:= round(cMinZoomLevel * cScreenWidth + LAND_WIDTH); - cScreenSpace:= cRightScreenBorder - cLeftScreenBorder; - - if isPhone() then - cMaxCaptions:= 3 - else - cMaxCaptions:= 4; {$IFDEF DEBUGFILE} {$I-} @@ -862,25 +614,6 @@ flush(f); close(f); {$ENDIF} - - // re-init flags so they will always contain safe values - cScreenWidth := 1024; - cScreenHeight := 768; - cBits := 32; - //ipcPort is in uIO - cFullScreen := false; - isSoundEnabled := true; - isMusicEnabled := false; - cLocaleFName := 'en.txt'; - cInitVolume := 100; - cTimerInterval := 8; - PathPrefix := './'; - cShowFPS := false; - cAltDamage := true; - cReducedQuality := rqNone; - //userNick is in uChat - recordFileName := ''; - cReadyDelay := 0; end; end. diff -r a1fcfc341a52 -r 83ef50815535 hedgewars/uMobile.pas --- a/hedgewars/uMobile.pas Wed Nov 17 17:22:36 2010 +0300 +++ b/hedgewars/uMobile.pas Wed Nov 17 17:45:55 2010 +0300 @@ -42,7 +42,6 @@ procedure perfExt_SaveFinishedSynching; inline; implementation -uses uTeams, uConsole; function isPhone: Boolean; inline; begin diff -r a1fcfc341a52 -r 83ef50815535 hedgewars/uScript.pas --- a/hedgewars/uScript.pas Wed Nov 17 17:22:36 2010 +0300 +++ b/hedgewars/uScript.pas Wed Nov 17 17:45:55 2010 +0300 @@ -54,7 +54,8 @@ uChat, uStats, uRandom, - uTypes; + uTypes, + uVariables; var luaState : Plua_State; ScriptAmmoLoadout : shortstring; diff -r a1fcfc341a52 -r 83ef50815535 hedgewars/uSound.pas --- a/hedgewars/uSound.pas Wed Nov 17 17:22:36 2010 +0300 +++ b/hedgewars/uSound.pas Wed Nov 17 17:45:55 2010 +0300 @@ -52,7 +52,7 @@ implementation -uses uMisc, uConsole; +uses uMisc, uVariables, uConsole; const chanTPU = 32; var Volume: LongInt; diff -r a1fcfc341a52 -r 83ef50815535 hedgewars/uStats.pas --- a/hedgewars/uStats.pas Wed Nov 17 17:22:36 2010 +0300 +++ b/hedgewars/uStats.pas Wed Nov 17 17:45:55 2010 +0300 @@ -55,7 +55,8 @@ procedure SendStats; implementation -uses uTeams, uSound, uMisc, uLocale, uWorld; +uses uTeams, uSound, uMisc, uLocale, uWorld, uVariables; + var DamageGiven : Longword = 0; DamageClan : Longword = 0; DamageTotal : Longword = 0; diff -r a1fcfc341a52 -r 83ef50815535 hedgewars/uStore.pas --- a/hedgewars/uStore.pas Wed Nov 17 17:22:36 2010 +0300 +++ b/hedgewars/uStore.pas Wed Nov 17 17:45:55 2010 +0300 @@ -82,7 +82,7 @@ procedure Tint(c: Longword); inline; implementation -uses uMisc, uConsole, uLocale, uMobile; +uses uMisc, uConsole, uLocale, uMobile, uVariables; type TGPUVendor = (gvUnknown, gvNVIDIA, gvATI, gvIntel, gvApple); diff -r a1fcfc341a52 -r 83ef50815535 hedgewars/uTeams.pas --- a/hedgewars/uTeams.pas Wed Nov 17 17:22:36 2010 +0300 +++ b/hedgewars/uTeams.pas Wed Nov 17 17:45:55 2010 +0300 @@ -119,7 +119,7 @@ function GetTeamStatString(p: PTeam): shortstring; implementation -uses uMisc, uWorld, uLocale, uAmmos, uChat, uMobile; +uses uMisc, uWorld, uLocale, uAmmos, uChat, uMobile, uVariables; const MaxTeamHealth: LongInt = 0; function CheckForWin: boolean; diff -r a1fcfc341a52 -r 83ef50815535 hedgewars/uVariables.pas --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hedgewars/uVariables.pas Wed Nov 17 17:45:55 2010 +0300 @@ -0,0 +1,288 @@ +{$INCLUDE options.inc} + +unit uVariables; +interface + +uses SDLh, uTypes, uFloat, GLunit, uConsts, Math, uMobile; + +var +/////// init flags /////// + cScreenWidth : LongInt = 1024; + cScreenHeight : LongInt = 768; + cBits : LongInt = 32; + //ipcPort is in uIO + cFullScreen : boolean = false; + isSoundEnabled : boolean = true; + isMusicEnabled : boolean = false; + cLocaleFName : shortstring = 'en.txt'; + cInitVolume : LongInt = 100; + cTimerInterval : LongInt = 8; + PathPrefix : shortstring = './'; + cShowFPS : boolean = false; + cAltDamage : boolean = true; + cReducedQuality : LongWord = rqNone; + //userNick is in uChat + recordFileName : shortstring = ''; + cReadyDelay : Longword = 0; + cLogfileBase : shortstring = 'debug'; +////////////////////////// + + isCursorVisible : boolean; + isTerminated : boolean; + isInLag : boolean; + isPaused : boolean; + + isSEBackup : boolean; + isInMultiShoot : boolean; + isSpeed : boolean; + isFirstFrame : boolean; + + fastUntilLag : boolean; + + GameState : TGameState; + GameType : TGameType; + GameFlags : Longword; + TrainingFlags : Longword; + TurnTimeLeft : Longword; + ReadyTimeLeft : Longword; + cSuddenDTurns : LongInt; + cDamagePercent : LongInt; + cMineDudPercent : LongWord; + cTemplateFilter : LongInt; + cMapGen : LongInt; + cMazeSize : LongInt; + + cHedgehogTurnTime: Longword; + cMinesTime : LongInt; + cMaxAIThinkTime : Longword; + + cHealthCaseProb : LongInt; + cHealthCaseAmount: LongInt; + cWaterRise : LongInt; + cHealthDecrease : LongInt; + + cCloudsNumber : LongInt; + + cTagsMask : byte; + zoom : GLfloat; + ZoomValue : GLfloat; + + cWaterLine : LongInt; + cGearScrEdgesDist: LongInt; + + GameTicks : LongWord; + TrainingTimeInc : Longword; + TrainingTimeInD : Longword; + TrainingTimeInM : Longword; + TrainingTimeMax : Longword; + + TimeTrialStartTime: Longword; + TimeTrialStopTime : Longword; + + // originally from uConsts + Pathz: array[TPathType] of shortstring; + CountTexz: array[1..Pred(AMMO_INFINITE)] of PTexture; + LAND_WIDTH : LongInt; + LAND_HEIGHT : LongInt; + LAND_WIDTH_MASK : LongWord; + LAND_HEIGHT_MASK : LongWord; + cMaxCaptions : LongInt; + + cLeftScreenBorder : LongInt; + cRightScreenBorder : LongInt; + cScreenSpace : LongInt; + + cCaseFactor : Longword; + cLandMines : Longword; + cExplosives : Longword; + + cSeed : shortstring; + cVolumeDelta : LongInt; + cHasFocus : boolean; + cInactDelay : Longword; + + bBetweenTurns : boolean; + bWaterRising : boolean; + + ShowCrosshair : boolean; + CursorMovementX : LongInt; + CursorMovementY : LongInt; + cDrownSpeed : hwFloat; + cDrownSpeedf : float; + cMaxWindSpeed : hwFloat; + cWindSpeed : hwFloat; + cWindSpeedf : float; + cGravity : hwFloat; + cGravityf : float; + cDamageModifier : hwFloat; + cLaserSighting : boolean; + cVampiric : boolean; + cArtillery : boolean; + WeaponTooltipTex : PTexture; + + flagMakeCapture : boolean; + + InitStepsFlags : Longword; + RealTicks : Longword; + AttackBar : LongInt; + + WaterColorArray : array[0..3] of HwColor4f; + + CursorPoint : TPoint; + TargetPoint : TPoint; + + TextureList : PTexture; + + ScreenFade : TScreenFade; + ScreenFadeValue : LongInt; + ScreenFadeSpeed : LongInt; + +{$IFDEF SDL13} + SDLwindow : PSDL_Window; +{$ENDIF} + +procedure initModule; +procedure freeModule; + +implementation + + +procedure initModule; +begin + Pathz:= cPathz; + {* REFERENCE + 4096 -> $FFFFF000 + 2048 -> $FFFFF800 + 1024 -> $FFFFFC00 + 512 -> $FFFFFE00 *} + if (cReducedQuality and rqLowRes) <> 0 then + begin + LAND_WIDTH:= 2048; + LAND_HEIGHT:= 1024; + LAND_WIDTH_MASK:= $FFFFF800; + LAND_HEIGHT_MASK:= $FFFFFC00; + end + else + begin + LAND_WIDTH:= 4096; + LAND_HEIGHT:= 2048; + LAND_WIDTH_MASK:= $FFFFF000; + LAND_HEIGHT_MASK:= $FFFFF800 + end; + + cDrownSpeed.QWordValue := 257698038; // 0.06 + cDrownSpeedf := 0.06; + cMaxWindSpeed.QWordValue:= 1073742; // 0.00025 + cWindSpeed.QWordValue := 429496; // 0.0001 + cWindSpeedf := 0.0001; + cGravity := cMaxWindSpeed * 2; + cGravityf := 0.00025 * 2; + cDamageModifier := _1; + TargetPoint := cTargetPointRef; + TextureList := nil; + + // int, longint longword and byte + CursorMovementX := 0; + CursorMovementY := 0; + GameTicks := 0; + TrainingTimeInc := 10000; + TrainingTimeInD := 500; + TrainingTimeInM := 5000; + TrainingTimeMax := 60000; + TimeTrialStartTime := 0; + TimeTrialStopTime := 0; + cWaterLine := LAND_HEIGHT; + cGearScrEdgesDist := 240; + + GameFlags := 0; + TrainingFlags := 0; + TurnTimeLeft := 0; + cSuddenDTurns := 15; + cDamagePercent := 100; + cMineDudPercent := 0; + cTemplateFilter := 0; + cMapGen := 0; // MAPGEN_REGULAR + cMazeSize := 0; + cHedgehogTurnTime := 45000; + cMinesTime := 3; + cMaxAIThinkTime := 9000; + cCloudsNumber := 9; + cHealthCaseProb := 35; + cHealthCaseAmount := 25; + cWaterRise := 47; + cHealthDecrease := 5; + + cTagsMask := 0; + InitStepsFlags := 0; + RealTicks := 0; + AttackBar := 0; // 0 - none, 1 - just bar at the right-down corner, 2 - from weapon + cCaseFactor := 5; {0..9} + cLandMines := 4; + cExplosives := 2; + + GameState := Low(TGameState); + GameType := gmtLocal; + zoom := cDefaultZoomLevel; + ZoomValue := cDefaultZoomLevel; + WeaponTooltipTex:= nil; + cLaserSighting := false; + cVampiric := false; + cArtillery := false; + flagMakeCapture := false; + bBetweenTurns := false; + bWaterRising := false; + isCursorVisible := false; + isTerminated := false; + isInLag := false; + isPaused := false; + isInMultiShoot := false; + isSpeed := false; + fastUntilLag := false; + isFirstFrame := true; + isSEBackup := true; + cSeed := ''; + cVolumeDelta := 0; + cHasFocus := true; + cInactDelay := 1250; + ReadyTimeLeft := 0; + + ScreenFade := sfNone; + +{$IFDEF SDL13} + SDLwindow := nil; +{$ENDIF} + + // those values still aren't perfect + cLeftScreenBorder:= round(-cMinZoomLevel * cScreenWidth); + cRightScreenBorder:= round(cMinZoomLevel * cScreenWidth + LAND_WIDTH); + cScreenSpace:= cRightScreenBorder - cLeftScreenBorder; + + if isPhone() then + cMaxCaptions:= 3 + else + cMaxCaptions:= 4; +end; + +procedure freeModule; +begin + // re-init flags so they will always contain safe values + cScreenWidth := 1024; + cScreenHeight := 768; + cBits := 32; + //ipcPort is in uIO + cFullScreen := false; + isSoundEnabled := true; + isMusicEnabled := false; + cLocaleFName := 'en.txt'; + cInitVolume := 100; + cTimerInterval := 8; + PathPrefix := './'; + cShowFPS := false; + cAltDamage := true; + cReducedQuality := rqNone; + //userNick is in uChat + recordFileName := ''; + cReadyDelay := 0; +end; + +end. \ No newline at end of file diff -r a1fcfc341a52 -r 83ef50815535 hedgewars/uVisualGears.pas --- a/hedgewars/uVisualGears.pas Wed Nov 17 17:22:36 2010 +0300 +++ b/hedgewars/uVisualGears.pas Wed Nov 17 17:45:55 2010 +0300 @@ -62,7 +62,7 @@ vobVelocity, vobFallSpeed: LongInt; implementation -uses uWorld, uMisc, uStore, uTeams, uSound, uMobile; +uses uWorld, uMisc, uStore, uTeams, uSound, uMobile, uVariables; const cExplFrameTicks = 110; {$INCLUDE "VGSHandlers.inc"} diff -r a1fcfc341a52 -r 83ef50815535 hedgewars/uWorld.pas --- a/hedgewars/uWorld.pas Wed Nov 17 17:22:36 2010 +0300 +++ b/hedgewars/uWorld.pas Wed Nov 17 17:45:55 2010 +0300 @@ -51,7 +51,22 @@ procedure MoveCamera; implementation -uses uStore, uMisc, uTeams, uIO, uKeys, uLocale, uSound, uAmmos, uVisualGears, uChat, uLandTexture, uLand, GLunit; +uses + uStore, + uMisc, + uTeams, + uIO, + uKeys, + uLocale, + uSound, + uAmmos, + uVisualGears, + uChat, + uLandTexture, + uLand, + GLunit, + uVariables + ; type TCaptionStr = record Tex: PTexture;