# HG changeset patch # User smxx # Date 1272837650 0 # Node ID dcc129c4352e3a3753a42059cf32861b28afd1b1 # Parent f4bdebced0423a01fd70263831734c1478fceab3 Engine: * Fixed/removed lots of compiler notes/hints (unused units, 64 bit results, unused parameters, possible overflows, ...) * Fixed visible water tinting the whole screen and/or gears and parts of the ui CMake: * No longer force FPC to write its compilation log to disk diff -r f4bdebced042 -r dcc129c4352e CMakeLists.txt --- a/CMakeLists.txt Sun May 02 20:30:23 2010 +0000 +++ b/CMakeLists.txt Sun May 02 22:00:50 2010 +0000 @@ -135,7 +135,7 @@ set(CMAKE_CXX_FLAGS_RELEASE ${CMAKE_C_FLAGS_RELEASE}) set(CMAKE_CXX_FLAGS_DEBUG ${CMAKE_C_FLAGS_DEBUG}) -set(pascal_compiler_flags_cmn "-B" "-FE../bin" "-Cs2000000" "-vwi" ${pascal_compiler_flags_cmn}) +set(pascal_compiler_flags_cmn "-B" "-FE../bin" "-Cs2000000" "-vewn" ${pascal_compiler_flags_cmn}) if(LOWRES) set(pascal_compiler_flags_cmn "-dLOWRES" ${pascal_compiler_flags_cmn}) add_definitions(-DLOWRES) @@ -145,7 +145,7 @@ set(pascal_compiler_flags_cmn "-O2" "-Xs" "-Si" ${pascal_compiler_flags_cmn}) set(haskell_compiler_flags_cmn "-O2" "-w") else(Optz) - set(pascal_compiler_flags_cmn "-O-" "-ghl" "-dDEBUGFILE" "-vwnv" ${pascal_compiler_flags_cmn}) + set(pascal_compiler_flags_cmn "-O-" "-ghl" "-dDEBUGFILE" ${pascal_compiler_flags_cmn}) set(haskell_compiler_flags_cmn "-Wall" "-debug" "-dcore-lint") endif(Optz) diff -r f4bdebced042 -r dcc129c4352e hedgewars/CCHandlers.inc --- a/hedgewars/CCHandlers.inc Sun May 02 20:30:23 2010 +0000 +++ b/hedgewars/CCHandlers.inc Sun May 02 22:00:50 2010 +0000 @@ -31,6 +31,7 @@ procedure chQuit(var s: shortstring); const prevGState: TGameState = gsConfirm; begin +s:= s; // avoid compiler hint if GameState <> gsConfirm then begin prevGState:= GameState; @@ -41,6 +42,7 @@ procedure chConfirm(var s: shortstring); begin +s:= s; // avoid compiler hint if GameState = gsConfirm then begin SendIPC('Q'); @@ -75,6 +77,8 @@ var Color: Longword; ts, cs: shortstring; begin +cs:= ''; +ts:= ''; if isDeveloperMode then begin SplitBySpace(s, cs); @@ -96,6 +100,7 @@ procedure chTeamLocal(var s: shortstring); begin +s:= s; // avoid compiler hint if not isDeveloperMode then exit; if CurrentTeam = nil then OutError(errmsgIncorrectUse + ' "/rdriven"', true); CurrentTeam^.ExtDriven:= true @@ -144,6 +149,7 @@ var s: shortstring; Gear: PGear; begin +s:= ''; if (not isDeveloperMode) or (CurrentTeam = nil) then exit; with CurrentTeam^ do begin @@ -183,6 +189,7 @@ var y: shortstring; t: Longint; begin +y:= ''; if (not isDeveloperMode) or (CurrentHedgehog = nil) or (CurrentHedgehog^.Gear = nil) then exit; SplitBySpace(x, y); val(x, t); @@ -213,6 +220,7 @@ procedure chAddAmmoStore(var descr: shortstring); begin +descr:= ''; // avoid compiler hint AddAmmoStore end; @@ -220,6 +228,7 @@ var s: shortstring; b: LongInt; begin +s:= ''; if CurrentTeam = nil then exit; SplitBySpace(id, s); if s[1]='"' then Delete(s, 1, 1); @@ -231,46 +240,55 @@ procedure chCurU_p(var s: shortstring); begin +s:= s; // avoid compiler hint CursorMovementY:= -1; end; procedure chCurU_m(var s: shortstring); begin +s:= s; // avoid compiler hint CursorMovementY:= 0; end; procedure chCurD_p(var s: shortstring); begin +s:= s; // avoid compiler hint CursorMovementY:= 1; end; procedure chCurD_m(var s: shortstring); begin +s:= s; // avoid compiler hint CursorMovementY:= 0; end; procedure chCurL_p(var s: shortstring); begin +s:= s; // avoid compiler hint CursorMovementX:= -1; end; procedure chCurL_m(var s: shortstring); begin +s:= s; // avoid compiler hint CursorMovementX:= 0; end; procedure chCurR_p(var s: shortstring); begin +s:= s; // avoid compiler hint CursorMovementX:= 1; end; procedure chCurR_m(var s: shortstring); begin +s:= s; // avoid compiler hint CursorMovementX:= 0; end; procedure chLeft_p(var s: shortstring); begin +s:= s; // avoid compiler hint if CheckNoTeamOrHH or isPaused then exit; bShowFinger:= false; if not CurrentTeam^.ExtDriven then SendIPC('L'); @@ -280,6 +298,7 @@ procedure chLeft_m(var s: shortstring); begin +s:= s; // avoid compiler hint if CheckNoTeamOrHH then exit; if not CurrentTeam^.ExtDriven then SendIPC('l'); with CurrentHedgehog^.Gear^ do @@ -288,6 +307,7 @@ procedure chRight_p(var s: shortstring); begin +s:= s; // avoid compiler hint if CheckNoTeamOrHH or isPaused then exit; bShowFinger:= false; if not CurrentTeam^.ExtDriven then SendIPC('R'); @@ -297,6 +317,7 @@ procedure chRight_m(var s: shortstring); begin +s:= s; // avoid compiler hint if CheckNoTeamOrHH then exit; if not CurrentTeam^.ExtDriven then SendIPC('r'); with CurrentHedgehog^.Gear^ do @@ -305,6 +326,7 @@ procedure chUp_p(var s: shortstring); begin +s:= s; // avoid compiler hint if CheckNoTeamOrHH or isPaused then exit; bShowFinger:= false; if not CurrentTeam^.ExtDriven then SendIPC('U'); @@ -314,6 +336,7 @@ procedure chUp_m(var s: shortstring); begin +s:= s; // avoid compiler hint if CheckNoTeamOrHH then exit; if not CurrentTeam^.ExtDriven then SendIPC('u'); with CurrentHedgehog^.Gear^ do @@ -322,6 +345,7 @@ procedure chDown_p(var s: shortstring); begin +s:= s; // avoid compiler hint if CheckNoTeamOrHH or isPaused then exit; bShowFinger:= false; if not CurrentTeam^.ExtDriven then SendIPC('D'); @@ -331,6 +355,7 @@ procedure chDown_m(var s: shortstring); begin +s:= s; // avoid compiler hint if CheckNoTeamOrHH then exit; if not CurrentTeam^.ExtDriven then SendIPC('d'); with CurrentHedgehog^.Gear^ do @@ -339,6 +364,7 @@ procedure chPrecise_p(var s: shortstring); begin +s:= s; // avoid compiler hint if CheckNoTeamOrHH or isPaused then exit; bShowFinger:= false; if not CurrentTeam^.ExtDriven then SendIPC('Z'); @@ -348,6 +374,7 @@ procedure chPrecise_m(var s: shortstring); begin +s:= s; // avoid compiler hint if CheckNoTeamOrHH then exit; if not CurrentTeam^.ExtDriven then SendIPC('z'); with CurrentHedgehog^.Gear^ do @@ -356,6 +383,7 @@ procedure chLJump(var s: shortstring); begin +s:= s; // avoid compiler hint if CheckNoTeamOrHH or isPaused then exit; bShowFinger:= false; if not CurrentTeam^.ExtDriven then SendIPC('j'); @@ -365,6 +393,7 @@ procedure chHJump(var s: shortstring); begin +s:= s; // avoid compiler hint if CheckNoTeamOrHH or isPaused then exit; bShowFinger:= false; if not CurrentTeam^.ExtDriven then SendIPC('J'); @@ -374,6 +403,7 @@ procedure chAttack_p(var s: shortstring); begin +s:= s; // avoid compiler hint if CheckNoTeamOrHH or isPaused then exit; bShowFinger:= false; with CurrentHedgehog^.Gear^ do @@ -390,6 +420,7 @@ procedure chAttack_m(var s: shortstring); begin +s:= s; // avoid compiler hint if CheckNoTeamOrHH then exit; with CurrentHedgehog^.Gear^ do begin @@ -401,6 +432,7 @@ procedure chSwitch(var s: shortstring); begin +s:= s; // avoid compiler hint if CheckNoTeamOrHH or isPaused then exit; if not CurrentTeam^.ExtDriven then SendIPC('S'); with CurrentHedgehog^.Gear^ do @@ -409,6 +441,7 @@ procedure chNextTurn(var s: shortstring); begin +s:= s; // avoid compiler hint TryDo(AllInactive, '/nextturn called when not all gears are inactive', true); if not CurrentTeam^.ExtDriven then SendIPC('N'); @@ -579,16 +612,19 @@ procedure chPut(var s: shortstring); begin +s:= s; // avoid compiler hint doPut(0, 0, false) end; procedure chCapture(var s: shortstring); begin +s:= s; // avoid compiler hint flagMakeCapture:= true end; procedure chSkip(var s: shortstring); begin +s:= s; // avoid compiler hint if not CurrentTeam^.ExtDriven then SendIPC(','); uStats.Skipped; skipFlag:= true @@ -624,6 +660,7 @@ procedure chAmmoMenu(var s: shortstring); begin +s:= s; // avoid compiler hint if CheckNoTeamOrHH then bShowAmmoMenu:= true else @@ -649,6 +686,8 @@ window: PSDL_Window; {$ENDIF} begin + s:= s; // avoid compiler hint + buf[0]:= char(0); // avoid compiler hint if Length(s) = 0 then cFullScreen:= not cFullScreen else cFullScreen:= s = '1'; @@ -717,16 +756,19 @@ procedure chVol_p(var s: shortstring); begin +s:= s; // avoid compiler hint inc(cVolumeDelta, 3) end; procedure chVol_m(var s: shortstring); begin +s:= s; // avoid compiler hint dec(cVolumeDelta, 3) end; procedure chFindhh(var s: shortstring); begin +s:= s; // avoid compiler hint if CheckNoTeamOrHH or isPaused then exit; bShowFinger:= true; FollowGear:= CurrentHedgehog^.Gear @@ -734,6 +776,7 @@ procedure chPause(var s: shortstring); begin +s:= s; // avoid compiler hint if gameType <> gmtNet then isPaused:= not isPaused; SDL_ShowCursor(ord(isPaused)) @@ -741,21 +784,25 @@ procedure chRotateMask(var s: shortstring); begin +s:= s; // avoid compiler hint if ((GameFlags and gfInvulnerable) = 0) then cTagsMask:= cTagsMasks[cTagsMask] else cTagsMask:= cTagsMasksNoHealth[cTagsMask]; end; procedure chSpeedup_p(var s: shortstring); begin +s:= s; // avoid compiler hint isSpeed:= true end; procedure chSpeedup_m(var s: shortstring); begin +s:= s; // avoid compiler hint isSpeed:= false end; procedure chZoomIn(var s: shortstring); begin +s:= s; // avoid compiler hint {$IFDEF IPHONEOS} if ZoomValue < 3.5 then {$ELSE} @@ -766,6 +813,7 @@ procedure chZoomOut(var s: shortstring); begin +s:= s; // avoid compiler hint {$IFDEF IPHONEOS} if ZoomValue > 0.5 then {$ELSE} @@ -776,16 +824,19 @@ procedure chZoomReset(var s: shortstring); begin +s:= s; // avoid compiler hint ZoomValue:= 2.0 end; procedure chChat(var s: shortstring); begin +s:= s; // avoid compiler hint GameState:= gsChat; KeyPressChat(27) end; procedure chHistory(var s: shortstring); begin +s:= s; // avoid compiler hint uChat.showAll:= not uChat.showAll end; diff -r f4bdebced042 -r dcc129c4352e hedgewars/GSHandlers.inc --- a/hedgewars/GSHandlers.inc Sun May 02 20:30:23 2010 +0000 +++ b/hedgewars/GSHandlers.inc Sun May 02 22:00:50 2010 +0000 @@ -3042,7 +3042,7 @@ //////////////////////////////////////////////////////////////////////////////// procedure doStepPortal(Gear: PGear); -var tmpGear, iterator: PGear; +var iterator: PGear; begin if (Land[hwRound(Gear^.Y), hwRound(Gear^.X)] and $FF00) = 0 then DeleteGear(Gear); if not AllInactive and (Gear^.IntersectGear <> nil) then @@ -3081,6 +3081,7 @@ Gear^.Y:= Gear^.Y + Gear^.dY; x:= hwRound(Gear^.X); y:= hwRound(Gear^.Y); +tx:= 0; ty:= 0; // avoid compiler hints if ((y and LAND_HEIGHT_MASK) = 0) and ((x and LAND_WIDTH_MASK) = 0) and ((Land[y, x] and $FF00) <> 0) then begin @@ -3218,7 +3219,7 @@ //////////////////////////////////////////////////////////////////////////////// procedure doStepSineGunShotWork(Gear: PGear); -var x, y, rX, rY, t, tmp, initHealth: LongWord; +var x, y, rX, rY, t, tmp, initHealth: LongInt; oX, oY, ldX, ldY, sdX, sdY, sine, lx, ly, amp: hwFloat; justCollided: boolean; begin @@ -3304,7 +3305,7 @@ // add some fire to the tunnel if getRandom(6) = 0 then - AddGear(x-Gear^.Radius+getRandom(2*Gear^.Radius), y-getRandom(Gear^.Radius+1), gtFlame, gsttmpFlag, _0, _0, 0); + AddGear(x - Gear^.Radius + LongInt(getRandom(2 * Gear^.Radius)), y - getRandom(Gear^.Radius + 1), gtFlame, gsttmpFlag, _0, _0, 0); end; if getRandom(100) = 0 then diff -r f4bdebced042 -r dcc129c4352e hedgewars/GearDrawing.inc --- a/hedgewars/GearDrawing.inc Sun May 02 20:30:23 2010 +0000 +++ b/hedgewars/GearDrawing.inc Sun May 02 22:00:50 2010 +0000 @@ -700,7 +700,7 @@ else startX:= max(-LAND_WIDTH - 1024, endX - 2048); startY:= endY - 256; - DrawTextureF(SpritesData[sprBirdy].Texture, 1, startX + WorldDx + trunc((endX - startX) * (-power(2, -10 * LongInt(Gear^.Timer)/2000) + 1)), startY + WorldDy + trunc((endY - startY) * sqrt(1 - power((LongInt(Gear^.Timer)/2000)-1, 2))), ((Gear^.Pos shr 6) or (RealTicks shr 8)) mod 2, Gear^.Tag, 75, 75); + DrawTextureF(SpritesData[sprBirdy].Texture, 1, startX + WorldDx + floor((endX - startX) * (-power(2, -10 * LongInt(Gear^.Timer)/2000) + 1)), startY + WorldDy + floor((endY - startY) * sqrt(1 - power((LongInt(Gear^.Timer)/2000)-1, 2))), ((Gear^.Pos shr 6) or (RealTicks shr 8)) mod 2, Gear^.Tag, 75, 75); end else // Disappearing begin @@ -711,7 +711,7 @@ else endX:= max(-LAND_WIDTH - 1024, startX - 2048); endY:= startY + 256; - DrawTextureF(SpritesData[sprBirdy].Texture, 1, startX + WorldDx + trunc((endX - startX) * power(2, 10 * (LongInt(Gear^.Timer)/2000 - 1))) + hwRound(Gear^.dX * Gear^.Timer), startY + WorldDy + trunc((endY - startY) * cos(LongInt(Gear^.Timer)/2000 * (Pi/2)) - (endY - startY)) + hwRound(Gear^.dY * Gear^.Timer), ((Gear^.Pos shr 6) or (RealTicks shr 8)) mod 2, Gear^.Tag, 75, 75); + DrawTextureF(SpritesData[sprBirdy].Texture, 1, startX + WorldDx + floor((endX - startX) * power(2, 10 * (LongInt(Gear^.Timer)/2000 - 1))) + hwRound(Gear^.dX * Gear^.Timer), startY + WorldDy + floor((endY - startY) * cos(LongInt(Gear^.Timer)/2000 * (Pi/2)) - (endY - startY)) + hwRound(Gear^.dY * Gear^.Timer), ((Gear^.Pos shr 6) or (RealTicks shr 8)) mod 2, Gear^.Tag, 75, 75); end; end else diff -r f4bdebced042 -r dcc129c4352e hedgewars/HHHandlers.inc --- a/hedgewars/HHHandlers.inc Sun May 02 20:30:23 2010 +0000 +++ b/hedgewars/HHHandlers.inc Sun May 02 22:00:50 2010 +0000 @@ -304,7 +304,7 @@ if (Ammo^[CurSlot, CurAmmo].NumPerTurn >= MultiShootAttacks) then begin - s:= inttostr(Ammo^[CurSlot, CurAmmo].NumPerTurn + 1 - MultiShootAttacks); + s:= inttostr(Ammo^[CurSlot, CurAmmo].NumPerTurn - MultiShootAttacks + 1); AddCaption(format(trmsg[sidRemaining], s), cWhiteColor, capgrpAmmostate); end; @@ -454,7 +454,7 @@ with Ammo^[CurSlot, CurAmmo] do begin if (Gear^.Message and gm_Left ) <> 0 then - Pos:= (Pos + Ammoz[AmmoType].PosCount - 1) mod Ammoz[AmmoType].PosCount + Pos:= (Pos - 1 + Ammoz[AmmoType].PosCount) mod Ammoz[AmmoType].PosCount else if (Gear^.Message and gm_Right ) <> 0 then Pos:= (Pos + 1) mod Ammoz[AmmoType].PosCount diff -r f4bdebced042 -r dcc129c4352e hedgewars/LuaPas.pas --- a/hedgewars/LuaPas.pas Sun May 02 20:30:23 2010 +0000 +++ b/hedgewars/LuaPas.pas Sun May 02 22:00:50 2010 +0000 @@ -1,3 +1,5 @@ +{$HINTS OFF} + unit LuaPas; (* @@ -1045,3 +1047,4 @@ end. +{$HINTS ON} diff -r f4bdebced042 -r dcc129c4352e hedgewars/hwengine.pas --- a/hedgewars/hwengine.pas Sun May 02 20:30:23 2010 +0000 +++ b/hedgewars/hwengine.pas Sun May 02 22:00:50 2010 +0000 @@ -28,6 +28,7 @@ {$ELSE} program hwengine; {$ENDIF} + uses SDLh in 'SDLh.pas', uConsts in 'uConsts.pas', @@ -423,7 +424,7 @@ {$IFNDEF HWLIBRARY} //////////////////////////////// -procedure Resize(w, h: LongInt); +(*procedure Resize(w, h: LongInt); begin cScreenWidth:= w; cScreenHeight:= h; @@ -431,7 +432,7 @@ ParseCommand('/fullscr 1', true) else ParseCommand('/fullscr 0', true); -end; +end;*) ///////////////////// procedure DisplayUsage; diff -r f4bdebced042 -r dcc129c4352e hedgewars/uAI.pas --- a/hedgewars/uAI.pas Sun May 02 20:30:23 2010 +0000 +++ b/hedgewars/uAI.pas Sun May 02 22:00:50 2010 +0000 @@ -30,7 +30,7 @@ implementation uses uTeams, uConsts, SDLh, uAIMisc, uGears, uAIAmmoTests, uAIActions, uMisc, - uAmmos, uConsole, uCollisions, SysUtils{$IFDEF UNIX}, cthreads{$ENDIF}; + uAmmos, uConsole, SysUtils{$IFDEF UNIX}, cthreads{$ENDIF}; var BestActions: TActions; CanUseAmmo: array [TAmmoType] of boolean; @@ -60,7 +60,7 @@ end; procedure TestAmmos(var Actions: TActions; Me: PGear; isMoved: boolean); -var BotLevel: Longword; +var BotLevel: Byte; ap: TAttackParams; Score, i: LongInt; a, aa: TAmmoType; @@ -77,9 +77,11 @@ if (CanUseAmmo[a]) and ((not isMoved) or ((AmmoTests[a].flags and amtest_OnTurn) = 0)) then begin +{$HINTS OFF} Score:= AmmoTests[a].proc(Me, Targets.ar[i].Point, BotLevel, ap); +{$HINTS ON} if Actions.Score + Score > BestActions.Score then - if (BestActions.Score < 0) or (Actions.Score + Score > BestActions.Score + LongInt(BotLevel) * 2048) then + if (BestActions.Score < 0) or (Actions.Score + Score > BestActions.Score + Byte(BotLevel) * 2048) then begin BestActions:= Actions; inc(BestActions.Score, Score); @@ -180,12 +182,14 @@ var Actions: TActions; - ticks, maxticks, steps, BotLevel, tmp: Longword; + ticks, maxticks, steps, tmp: Longword; BaseRate, BestRate, Rate: integer; GoInfo: TGoInfo; CanGo: boolean; AltMe: TGear; + BotLevel: Byte; begin +ticks:= 0; // avoid compiler hint Actions.Count:= 0; Actions.Pos:= 0; Actions.Score:= 0; @@ -196,7 +200,7 @@ Push(0, Actions, Me^, tmp); Push(0, Actions, Me^, tmp xor 3); -if (Me^.State and gstAttacked) = 0 then maxticks:= max(0, TurnTimeLeft - 5000 - 4000 * BotLevel) +if (Me^.State and gstAttacked) = 0 then maxticks:= max(0, TurnTimeLeft - 5000 - LongWord(4000 * BotLevel)) else maxticks:= TurnTimeLeft; if (Me^.State and gstAttacked) = 0 then TestAmmos(Actions, Me, false); @@ -214,7 +218,9 @@ while (not StopThinking) and (not PosInThinkStack(Me)) do begin +{$HINTS OFF} CanGo:= HHGo(Me, @AltMe, GoInfo); +{$HINTS ON} inc(ticks, GoInfo.Ticks); if ticks > maxticks then break; diff -r f4bdebced042 -r dcc129c4352e hedgewars/uAIActions.pas --- a/hedgewars/uAIActions.pas Sun May 02 20:30:23 2010 +0000 +++ b/hedgewars/uAIActions.pas Sun May 02 22:00:50 2010 +0000 @@ -62,7 +62,7 @@ procedure ProcessAction(var Actions: TActions; Me: PGear); implementation -uses uMisc, uTeams, uConsts, uConsole, uAIMisc, uAI, uAmmos; +uses uMisc, uConsts, uConsole, uAIMisc, uAI, uAmmos; const ActionIdToStr: array[0..6] of string[16] = ( {aia_none} '', diff -r f4bdebced042 -r dcc129c4352e hedgewars/uAIAmmoTests.pas --- a/hedgewars/uAIAmmoTests.pas Sun May 02 20:30:23 2010 +0000 +++ b/hedgewars/uAIAmmoTests.pas Sun May 02 22:00:50 2010 +0000 @@ -378,7 +378,7 @@ end; function TestMortar(Me: PGear; Targ: TPoint; Level: LongInt; var ap: TAttackParams): LongInt; -const tDelta = 24; +//const tDelta = 24; var Vx, Vy: hwFloat; Score, EX, EY, valueResult: LongInt; TestTime: Longword; @@ -502,6 +502,7 @@ d: Longword; valueResult: LongInt; begin +Level:= Level; // avoid compiler hint ap.ExplR:= 0; ap.Time:= 0; ap.Power:= 1; @@ -530,6 +531,7 @@ function TestBaseballBat(Me: PGear; Targ: TPoint; Level: LongInt; var ap: TAttackParams): LongInt; var valueResult: LongInt; begin +Level:= Level; // avoid compiler hint ap.ExplR:= 0; if (Level > 2) or (Abs(hwRound(Me^.X) - Targ.X) + Abs(hwRound(Me^.Y) - Targ.Y) > 25) then exit(BadTurn); @@ -546,6 +548,7 @@ function TestFirePunch(Me: PGear; Targ: TPoint; Level: LongInt; var ap: TAttackParams): LongInt; var i, valueResult: LongInt; begin +Level:= Level; // avoid compiler hint ap.ExplR:= 0; ap.Time:= 0; ap.Power:= 1; @@ -643,6 +646,7 @@ var i, failNum: longword; begin + Level:= Level; // avoid compiler hint FillBonuses(true, [gtCase]); if bonuses.Count = 0 then begin if Me^.Health <= 100 then begin diff -r f4bdebced042 -r dcc129c4352e hedgewars/uAIMisc.pas --- a/hedgewars/uAIMisc.pas Sun May 02 20:30:23 2010 +0000 +++ b/hedgewars/uAIMisc.pas Sun May 02 22:00:50 2010 +0000 @@ -246,6 +246,7 @@ function RateShove(Me: PGear; x, y, r, power: LongInt): LongInt; var i, dmg, rate: LongInt; begin +Me:= Me; // avoid compiler hint rate:= 0; for i:= 0 to Pred(Targets.Count) do with Targets.ar[i] do diff -r f4bdebced042 -r dcc129c4352e hedgewars/uAmmos.pas --- a/hedgewars/uAmmos.pas Sun May 02 20:30:23 2010 +0000 +++ b/hedgewars/uAmmos.pas Sun May 02 22:00:50 2010 +0000 @@ -57,7 +57,9 @@ var mi: array[0..cMaxSlotIndex] of byte; a: TAmmoType; begin +{$HINTS OFF} FillChar(mi, sizeof(mi), 0); +{$HINTS ON} FillChar(Ammo^, sizeof(Ammo^), 0); for a:= Low(TAmmoType) to High(TAmmoType) do begin @@ -172,7 +174,9 @@ slot, ami: LongInt; hhammo: PHHAmmo; begin +{$HINTS OFF} FillChar(ammos, sizeof(ammos), 0); +{$HINTS ON} hhammo:= Hedgehog.Ammo; for slot:= 0 to cMaxSlotIndex do diff -r f4bdebced042 -r dcc129c4352e hedgewars/uChat.pas --- a/hedgewars/uChat.pas Sun May 02 20:30:23 2010 +0000 +++ b/hedgewars/uChat.pas Sun May 02 22:00:50 2010 +0000 @@ -85,6 +85,7 @@ end; font:= CheckCJKFont(str, fnt16); +w:= 0; h:= 0; // avoid compiler hints TTF_SizeUTF8(Fontz[font].Handle, Str2PChar(str), w, h); resSurface:= SDL_CreateRGBSurface(0, toPowerOf2(w), toPowerOf2(h), 32, RMask, GMask, BMask, AMask); diff -r f4bdebced042 -r dcc129c4352e hedgewars/uCollisions.pas --- a/hedgewars/uCollisions.pas Sun May 02 20:30:23 2010 +0000 +++ b/hedgewars/uCollisions.pas Sun May 02 22:00:50 2010 +0000 @@ -52,7 +52,7 @@ function calcSlopeNormal(Gear: PGear; collisionX, collisionY: LongInt; var deltaX, deltaY: LongInt; TestWord: LongWord): Boolean; implementation -uses uMisc, uConsts, uLand, uLandGraphics, uConsole; +uses uMisc, uConsts, uLand, uLandGraphics; type TCollisionEntry = record X, Y, Radius: LongInt; diff -r f4bdebced042 -r dcc129c4352e hedgewars/uConsole.pas --- a/hedgewars/uConsole.pas Sun May 02 20:30:23 2010 +0000 +++ b/hedgewars/uConsole.pas Sun May 02 22:00:50 2010 +0000 @@ -37,8 +37,8 @@ procedure doPut(putX, putY: LongInt; fromAI: boolean); implementation -uses uMisc, uStore, Types, uConsts, uGears, uTeams, uIO, uKeys, uWorld, uLand, - uRandom, uAmmos, uStats, uGame, uChat, SDLh, uSound, uVisualGears, uScript; +uses uMisc, uStore, Types, uConsts, uGears, uTeams, uIO, uKeys, uWorld, + uRandom, uAmmos, uStats, uChat, SDLh, uSound, uVisualGears, uScript; const cLineWidth: LongInt = 0; cLinesCount = 256; @@ -132,7 +132,6 @@ end; procedure ParseCommand(CmdStr: shortstring; TrustedSource: boolean); -type PhwFloat = ^hwFloat; var ii: LongInt; s: shortstring; t: PVariable; @@ -143,6 +142,7 @@ {$IFDEF DEBUGFILE}AddFileLog('ParseCommand "' + CmdStr + '"');{$ENDIF} c:= CmdStr[1]; if c in ['/', '$'] then Delete(CmdStr, 1, 1) else c:= '/'; +s:= ''; SplitBySpace(CmdStr, s); t:= Variables; while t <> nil do diff -r f4bdebced042 -r dcc129c4352e hedgewars/uFloat.pas --- a/hedgewars/uFloat.pas Sun May 02 20:30:23 2010 +0000 +++ b/hedgewars/uFloat.pas Sun May 02 22:00:50 2010 +0000 @@ -143,7 +143,7 @@ {$ENDIF} implementation -uses uConsts, uMisc; +uses uMisc; {$IFDEF FPC} diff -r f4bdebced042 -r dcc129c4352e hedgewars/uGame.pas --- a/hedgewars/uGame.pas Sun May 02 20:30:23 2010 +0000 +++ b/hedgewars/uGame.pas Sun May 02 22:00:50 2010 +0000 @@ -20,14 +20,13 @@ unit uGame; interface -uses uFloat; procedure DoGameTick(Lag: LongInt); //////////////////// implementation //////////////////// -uses uMisc, uConsts, uWorld, uKeys, uTeams, uIO, uAI, uGears, uConsole, uScript; +uses uMisc, uConsts, uKeys, uTeams, uIO, uAI, uGears, uScript; procedure DoGameTick(Lag: LongInt); var i: LongInt; diff -r f4bdebced042 -r dcc129c4352e hedgewars/uGears.pas --- a/hedgewars/uGears.pas Sun May 02 20:30:23 2010 +0000 +++ b/hedgewars/uGears.pas Sun May 02 22:00:50 2010 +0000 @@ -1607,10 +1607,7 @@ repeat inc(x, Delta); cnt:= 0; - if topY > 1024 then - y:= 1024-Gear^.Radius * 2 - else - y:= topY-Gear^.Radius * 2; + y:= min(1024, topY) - 2 * Gear^.Radius; while y < LAND_HEIGHT do begin repeat diff -r f4bdebced042 -r dcc129c4352e hedgewars/uIO.pas --- a/hedgewars/uIO.pas Sun May 02 20:30:23 2010 +0000 +++ b/hedgewars/uIO.pas Sun May 02 22:00:50 2010 +0000 @@ -104,7 +104,9 @@ SDLTry(fds <> nil, true); WriteLnToConsole(msgOK); WriteToConsole('Establishing IPC connection... '); +{$HINTS OFF} SDLTry(SDLNet_ResolveHost(ipaddr, '127.0.0.1', ipcPort) = 0, true); +{$HINTS ON} IPCSock:= SDLNet_TCP_Open(ipaddr); SDLTry(IPCSock <> nil, true); WriteLnToConsole(msgOK) @@ -182,6 +184,8 @@ assign(f, fileName); reset(f, 1); +i:= 0; // avoid compiler hints +buf[0]:= 0; repeat BlockRead(f, buf[1], 255 - Length(ss), i); if i > 0 then diff -r f4bdebced042 -r dcc129c4352e hedgewars/uKeys.pas --- a/hedgewars/uKeys.pas Sun May 02 20:30:23 2010 +0000 +++ b/hedgewars/uKeys.pas Sun May 02 22:00:50 2010 +0000 @@ -90,8 +90,8 @@ procedure setiPhoneBinds; {$ENDIF} implementation -uses uTeams, uConsole, uMisc, uStore; -const KeyNumber = 1024; +uses uTeams, uConsole, uMisc; +//const KeyNumber = 1024; var tkbd, tkbdn: TKeyboardState; KeyNames: array [0..cKeyMaxIndex] of string[15]; diff -r f4bdebced042 -r dcc129c4352e hedgewars/uLand.pas --- a/hedgewars/uLand.pas Sun May 02 20:30:23 2010 +0000 +++ b/hedgewars/uLand.pas Sun May 02 22:00:50 2010 +0000 @@ -51,7 +51,7 @@ function LandBackPixel(x, y: LongInt): LongWord; implementation -uses uConsole, uStore, uMisc, uRandom, uTeams, uLandObjects, uSHA, uIO, uAmmos, uLandTexture; +uses uConsole, uStore, uMisc, uRandom, uTeams, uLandObjects, uSHA, uIO, uLandTexture; operator=(const a, b: direction) c: Boolean; begin @@ -68,7 +68,9 @@ dig: TSHA1Digest; s: shortstring; begin +{$HINTS OFF} SHA1Init(ctx); +{$HINTS ON} SHA1UpdateLongwords(ctx, @Land, sizeof(Land)); dig:= SHA1Final(ctx); s:='M{'+inttostr(dig[0])+':' @@ -192,7 +194,9 @@ pi:= EndI; i:= StartI; ni:= Succ(StartI); +{$HINTS OFF} Vector(opa.ar[pi], opa.ar[i], opa.ar[ni], NVx, NVy); +{$HINTS ON} repeat inc(pi); if pi > EndI then pi:= StartI; @@ -296,6 +300,7 @@ xr:= x; Push(xl, xr, y, -1); Push(xl, xr, y, 1); +dir:= 0; while Stack.Count > 0 do begin Pop(xl, xr, y, dir); @@ -405,7 +410,7 @@ pa.ar[i].x:= BasePoints^[i].x + LongInt(GetRandom(BasePoints^[i].w)); if pa.ar[i].x <> NTPX then pa.ar[i].x:= pa.ar[i].x + ((LAND_WIDTH - Template.TemplateWidth) div 2); - pa.ar[i].y:= BasePoints^[i].y + LongInt(GetRandom(BasePoints^[i].h)) + LAND_HEIGHT - Template.TemplateHeight + pa.ar[i].y:= BasePoints^[i].y + LongInt(GetRandom(BasePoints^[i].h)) + LAND_HEIGHT - LongInt(Template.TemplateHeight) end; if canMirror then @@ -552,7 +557,9 @@ for x:= 0 to LAND_WIDTH - 1 do Land[y, x]:= COLOR_LAND; +{$HINTS OFF} SetPoints(Template, pa); +{$HINTS ON} for i:= 1 to Template.BezierizeCount do begin BezierizeEdge(pa, _0_5); diff -r f4bdebced042 -r dcc129c4352e hedgewars/uLandObjects.pas --- a/hedgewars/uLandObjects.pas Sun May 02 20:30:23 2010 +0000 +++ b/hedgewars/uLandObjects.pas Sun May 02 22:00:50 2010 +0000 @@ -29,7 +29,7 @@ procedure AddOnLandObjects(Surface: PSDL_Surface); implementation -uses uLand, uStore, uConsts, uMisc, uConsole, uRandom, uVisualGears, uFloat, uSound, uWorld, GLunit; +uses uLand, uStore, uConsts, uMisc, uConsole, uRandom, uVisualGears, uSound, GLunit; const MaxRects = 512; MAXOBJECTRECTS = 16; @@ -205,7 +205,7 @@ end; function CheckLand(rect: TSDL_Rect; dX, dY, Color: Longword): boolean; -var i: Longword; +var i: LongInt; bRes: boolean = true; begin inc(rect.x, dX); diff -r f4bdebced042 -r dcc129c4352e hedgewars/uLocale.pas --- a/hedgewars/uLocale.pas Sun May 02 20:30:23 2010 +0000 +++ b/hedgewars/uLocale.pas Sun May 02 22:00:50 2010 +0000 @@ -58,7 +58,7 @@ function GetEventString(e: TEventId): ansistring; implementation -uses uMisc, uRandom, uConsole; +uses uMisc, uRandom; var trevt: array[TEventId] of array [0..Pred(MAX_EVENT_STRINGS)] of ansistring; trevt_n: array[TEventId] of integer; diff -r f4bdebced042 -r dcc129c4352e hedgewars/uMisc.pas --- a/hedgewars/uMisc.pas Sun May 02 20:30:23 2010 +0000 +++ b/hedgewars/uMisc.pas Sun May 02 22:00:50 2010 +0000 @@ -170,7 +170,7 @@ {$ENDIF} implementation -uses Math, uConsole, uStore, uIO, uRandom, uSound, typinfo; +uses Math, uConsole, uStore, uIO, uSound, typinfo; var KBnum: Longword; {$IFDEF DEBUGFILE} @@ -246,14 +246,15 @@ procedure OutError(Msg: shortstring; isFatalError: boolean); begin -{$IFDEF DEBUGFILE}AddFileLog(Msg);{$ENDIF} +// obsolete? written in WriteLnToConsole() anyway +// {$IFDEF DEBUGFILE}AddFileLog(Msg);{$ENDIF} WriteLnToConsole(Msg); if isFatalError then -begin -SendIPC('E' + GetLastConsoleLine); -SDL_Quit; -halt(1) -end + begin + SendIPC('E' + GetLastConsoleLine); + SDL_Quit; + halt(1) + end end; procedure TryDo(Assert: boolean; Msg: shortstring; isFatal: boolean); diff -r f4bdebced042 -r dcc129c4352e hedgewars/uRandom.pas --- a/hedgewars/uRandom.pas Sun May 02 20:30:23 2010 +0000 +++ b/hedgewars/uRandom.pas Sun May 02 22:00:50 2010 +0000 @@ -35,7 +35,7 @@ {$ENDIF} implementation -uses uMisc{$IFDEF DEBUGFILE},uConsole{$ENDIF}; +uses uMisc; var cirbuf: array[0..63] of Longword; n: byte; diff -r f4bdebced042 -r dcc129c4352e hedgewars/uSHA.pas --- a/hedgewars/uSHA.pas Sun May 02 20:30:23 2010 +0000 +++ b/hedgewars/uSHA.pas Sun May 02 22:00:50 2010 +0000 @@ -68,7 +68,9 @@ W: array[0..79] of LongWord; i, t: LongWord; begin +{$HINTS OFF} move(Context.H, S, sizeof(S)); +{$HINTS ON} for i:= 0 to 15 do SDLNet_Write32(PLongWordArray(@Context.Buf)^[i], @W[i]); diff -r f4bdebced042 -r dcc129c4352e hedgewars/uScript.pas --- a/hedgewars/uScript.pas Sun May 02 20:30:23 2010 +0000 +++ b/hedgewars/uScript.pas Sun May 02 22:00:50 2010 +0000 @@ -105,6 +105,7 @@ function lc_hidemission(L : Plua_State) : LongInt; Cdecl; begin + L:= L; // avoid compiler hint HideMission; lc_hidemission:= 0; end; @@ -372,6 +373,7 @@ function lc_endgame(L : Plua_State) : LongInt; Cdecl; begin + L:= L; // avoid compiler hint GameState:= gsExit; lc_endgame:= 0 end; @@ -569,6 +571,7 @@ // import locale s:= cLocaleFName; +t:= ''; SplitByChar(s, t, '.'); ScriptSetString('L', s); diff -r f4bdebced042 -r dcc129c4352e hedgewars/uStore.pas --- a/hedgewars/uStore.pas Sun May 02 20:30:23 2010 +0000 +++ b/hedgewars/uStore.pas Sun May 02 22:00:50 2010 +0000 @@ -20,7 +20,7 @@ unit uStore; interface -uses sysutils, uConsts, uTeams, SDLh, uFloat, GLunit; +uses sysutils, uConsts, uTeams, SDLh, GLunit; var PixelFormat: PSDL_PixelFormat; @@ -83,7 +83,7 @@ procedure Tint(r, g, b, a: Byte); inline; implementation -uses uMisc, uConsole, uLand, uLocale, uWorld{$IFDEF IPHONEOS}, PascalExports{$ENDIF}; +uses uMisc, uConsole, uLocale{$IFDEF IPHONEOS}, PascalExports{$ENDIF}; type TGPUVendor = (gvUnknown, gvNVIDIA, gvATI, gvIntel, gvApple); @@ -137,6 +137,7 @@ clr: TSDL_Color; finalRect: TSDL_Rect; begin +w:= 0; h:= 0; // avoid compiler hints TTF_SizeUTF8(Fontz[Font].Handle, Str2PChar(s), w, h); finalRect.x:= X; finalRect.y:= Y; @@ -165,6 +166,7 @@ clr: TSDL_Color; finalRect: TSDL_Rect; begin +w:= 0; h:= 0; // avoid compiler hints TTF_SizeUTF8(Fontz[Font].Handle, Str2PChar(s), w, h); finalRect.x:= X + FontBorder + 2; finalRect.y:= Y + FontBorder; @@ -845,11 +847,12 @@ end; function RenderStringTex(s: ansistring; Color: Longword; font: THWFont): PTexture; -var w, h : LongInt; +var w, h: LongInt; finalSurface: PSDL_Surface; begin if length(s) = 0 then s:= ' '; font:= CheckCJKFont(s, font); +w:= 0; h:= 0; // avoid compiler hints TTF_SizeUTF8(Fontz[font].Handle, Str2PChar(s), w, h); finalSurface:= SDL_CreateRGBSurface(SDL_SWSURFACE, w + FontBorder * 2 + 4, h + FontBorder * 2, @@ -905,6 +908,7 @@ if length(s) = 0 then s:= '...'; font:= CheckCJKFont(s, font); +w:= 0; h:= 0; // avoid compiler hints TTF_SizeUTF8(Fontz[font].Handle, Str2PChar(s), w, h); if w<8 then w:= 8; j:= 0; @@ -1062,7 +1066,18 @@ var tmpsurf: PSDL_Surface; s: shortstring; begin - WriteToConsole(msgLoading + filename + ' [flags: ' + inttostr(imageFlags) + ']... '); + WriteToConsole(msgLoading + filename + '.png [flags:'); + if imageFlags = ifNone then + WriteToConsole(' None') + else + begin + if (imageFlags and ifAlpha) <> 0 then WriteToConsole(' Alpha'); + if (imageFlags and ifCritical) <> 0 then WriteToConsole(' Critical'); + if (imageFlags and ifTransparent) <> 0 then WriteToConsole(' Transparent'); + if (imageFlags and ifIgnoreCaps) <> 0 then WriteToConsole(' IgnoreCaps'); + if (imageFlags and ifLowRes) <> 0 then WriteToConsole(' LowRes'); + end; + WriteToConsole('] '); s:= filename + '.png'; tmpsurf:= IMG_Load(Str2PChar(s)); @@ -1109,8 +1124,7 @@ if (imageFlags and ifTransparent) <> 0 then TryDo(SDL_SetColorKey(tmpsurf, SDL_SRCCOLORKEY, 0) = 0, errmsgTransparentSet, true); - WriteLnToConsole('(' + inttostr(tmpsurf^.w) + ',' + inttostr(tmpsurf^.h) + ') '); - WriteLnToConsole(msgOK); + WriteLnToConsole(msgOK + ' (' + inttostr(tmpsurf^.w) + 'x' + inttostr(tmpsurf^.h) + ')'); LoadImage:= tmpsurf //Result end; @@ -1353,7 +1367,11 @@ begin SDL_GetRGBA(destPixels^[i], dest^.format, @r0, @g0, @b0, @a0); SDL_GetRGBA(srcPixels^[j], src^.format, @r1, @g1, @b1, @a1); - destPixels^[i]:= SDL_MapRGBA(dest^.format, (r0 * (255 - a1) + r1 * a1) div 255, (g0 * (255 - a1) + g1 * a1) div 255, (b0 * (255 - a1) + b1 * a1) div 255, (a0 * (255 - a1) + a1 * a1) div 255); + r0:= (r0 * (255 - LongInt(a1)) + r1 * LongInt(a1)) div 255; + g0:= (g0 * (255 - LongInt(a1)) + g1 * LongInt(a1)) div 255; + b0:= (b0 * (255 - LongInt(a1)) + b1 * LongInt(a1)) div 255; + a0:= (a0 * (255 - LongInt(a1)) + a1 * LongInt(a1)) div 255; + destPixels^[i]:= SDL_MapRGBA(dest^.format, r0, g0, b0, a0); end; end; end; @@ -1400,6 +1418,8 @@ wa:= FontBorder * 2 + 4; ha:= FontBorder * 2; +i:= 0; j:= 0; // avoid compiler hints + // TODO: Recheck height/position calculation // get caption's dimensions @@ -1467,6 +1487,7 @@ r:= WriteInRect(tmpsurf, FontBorder + 2, r.y + r.h, $ff707070, font, tmpline); // render highlighted caption (if there's a ':') + tmpline2:= ''; SplitByChar(tmpline, tmpline2, ':'); if tmpline2 <> '' then WriteInRect(tmpsurf, FontBorder + 2, r2.y + r2.h, $ffc7c7c7, font, tmpline + ':'); diff -r f4bdebced042 -r dcc129c4352e hedgewars/uTeams.pas --- a/hedgewars/uTeams.pas Sun May 02 20:30:23 2010 +0000 +++ b/hedgewars/uTeams.pas Sun May 02 22:00:50 2010 +0000 @@ -20,7 +20,7 @@ unit uTeams; interface -uses SDLh, uConsts, uKeys, uGears, uRandom, uFloat, uStats, uVisualGears, uCollisions, uLand, GLunit, uSound; +uses uConsts, uKeys, uGears, uRandom, uFloat, uStats, uVisualGears, uCollisions, GLunit, uSound; type PHHAmmo = ^THHAmmo; THHAmmo = array[0..cMaxSlotIndex, 0..cMaxSlotAmmoIndex] of TAmmo; @@ -42,7 +42,7 @@ Team: PTeam; MultiShootAttacks: Longword; visStepPos: LongWord; - BotLevel : LongWord; // 0 - Human player + BotLevel : Byte; // 0 - Human player HatVisibility: GLfloat; stats: TStatistics; Hat: shortstring; @@ -114,7 +114,7 @@ function GetTeamStatString(p: PTeam): shortstring; implementation -uses uMisc, uWorld, uAI, uLocale, uConsole, uAmmos, uChat; +uses uMisc, uWorld, uLocale, uAmmos, uChat; const MaxTeamHealth: LongInt = 0; function CheckForWin: boolean; diff -r f4bdebced042 -r dcc129c4352e hedgewars/uVisualGears.pas --- a/hedgewars/uVisualGears.pas Sun May 02 20:30:23 2010 +0000 +++ b/hedgewars/uVisualGears.pas Sun May 02 22:00:50 2010 +0000 @@ -20,7 +20,7 @@ unit uVisualGears; interface -uses SDLh, uConsts, uFloat, Math, GLunit; +uses uConsts, uFloat, Math, GLunit; type PVisualGear = ^TVisualGear; TVGearStepProcedure = procedure (Gear: PVisualGear; Steps: Longword); @@ -375,8 +375,8 @@ with thexchar[i] do begin {$WARNINGS OFF} - team^.DrawHealthY:= ny + dy * Gear^.Timer div 640; - team^.TeamHealthBarWidth:= team^.NewTeamHealthBarWidth + dw * Gear^.Timer div cSorterWorkTime; + team^.DrawHealthY:= ny + dy * LongInt(Gear^.Timer div 640); + team^.TeamHealthBarWidth:= team^.NewTeamHealthBarWidth + dw * LongInt(Gear^.Timer div cSorterWorkTime); {$WARNINGS ON} end; @@ -394,6 +394,7 @@ b: boolean; t: LongInt; begin +Steps:= Steps; // avoid compiler hint for t:= 0 to Pred(TeamsCount) do with thexchar[t] do begin @@ -453,6 +454,8 @@ procedure doStepSpeechBubble(Gear: PVisualGear; Steps: Longword); begin +Steps:= Steps; // avoid compiler hint + with PHedgehog(Gear^.Hedgehog)^ do if SpeechGear <> nil then SpeechGear^.Timer:= 0; diff -r f4bdebced042 -r dcc129c4352e hedgewars/uWorld.pas --- a/hedgewars/uWorld.pas Sun May 02 20:30:23 2010 +0000 +++ b/hedgewars/uWorld.pas Sun May 02 22:00:50 2010 +0000 @@ -51,7 +51,7 @@ procedure ShakeCamera(amount: LongWord); implementation -uses uStore, uMisc, uTeams, uIO, uConsole, uKeys, uLocale, uSound, uAmmos, uVisualGears, uChat, uLandTexture, uLand, GLunit; +uses uStore, uMisc, uTeams, uIO, uKeys, uLocale, uSound, uAmmos, uVisualGears, uChat, uLandTexture, uLand, GLunit; type TCaptionStr = record Tex: PTexture; @@ -380,7 +380,7 @@ glDisableClientState(GL_VERTEX_ARRAY); glDisableClientState(GL_COLOR_ARRAY); - Tint($FF, $FF, $FF, $FF); // disable coloring + glColor4ub($FF, $FF, $FF, $FF); // must not be Tint() as color array seems to stay active and color reset is required glEnable(GL_TEXTURE_2D); end; end; @@ -392,10 +392,10 @@ lw:= wScreen / cScaleFactor; waves:= lw * 2 / cWaveWidth; -Tint((tnt * WaterColorArray[2].r div 255) + (255-tnt), - (tnt * WaterColorArray[2].g div 255) + (255-tnt), - (tnt * WaterColorArray[2].b div 255) + (255-tnt), - 255 +Tint(LongInt(tnt) * WaterColorArray[2].r div 255 + 255 - tnt, + LongInt(tnt) * WaterColorArray[2].g div 255 + 255 - tnt, + LongInt(tnt) * WaterColorArray[2].b div 255 + 255 - tnt, + 255 ); glBindTexture(GL_TEXTURE_2D, SpritesData[sprWater].Texture^.id); @@ -767,7 +767,7 @@ if WindBarWidth < 0 then begin {$WARNINGS OFF} - r.x:= (WindBarWidth + RealTicks shr 6) mod 8; + r.x:= (Longword(WindBarWidth) + RealTicks shr 6) mod 8; {$WARNINGS ON} r.y:= 0; r.w:= - WindBarWidth; @@ -806,13 +806,16 @@ if cShowFPS or (GameType = gmtDemo) then inc(CountTicks, Lag); if (GameType = gmtDemo) and (CountTicks >= 1000) then begin - i:=GameTicks div 60000; - t:=(GameTicks-(i*60000)) div 1000; - s:=''; - if i<10 then s:='0'; - s:= s+inttostr(i)+':'; - if t<10 then s:=s+'0'; - s:= s+inttostr(t); + i:=GameTicks div 1000; + t:= i mod 60; + s:= inttostr(t); + if t < 10 then s:= '0' + s; + i:= i div 60; + t:= i mod 60; + s:= inttostr(t) + ':' + s; + if t < 10 then s:= '0' + s; + s:= inttostr(i div 60) + ':' + s; + if timeTexture <> nil then FreeTexture(timeTexture); tmpSurface:= TTF_RenderUTF8_Blended(Fontz[fnt16].Handle, Str2PChar(s), cWhiteColorChannels); tmpSurface:= doSurfaceConversion(tmpSurface);