# HG changeset patch # User koda # Date 1263487610 0 # Node ID ed789a7ef68d8314ec41acb5aef678ad7c45de96 # Parent dcd248e04f3d3208aae8acd5ddbbd85b453e7f90 makes freepascal code compatible with OBJFPC mode diff -r dcd248e04f3d -r ed789a7ef68d hedgewars/CCHandlers.inc --- a/hedgewars/CCHandlers.inc Thu Jan 14 16:38:43 2010 +0000 +++ b/hedgewars/CCHandlers.inc Thu Jan 14 16:46:50 2010 +0000 @@ -17,15 +17,15 @@ *) function CheckNoTeamOrHH: boolean; -var Result: boolean; +var bRes: boolean; begin -Result:= (CurrentTeam = nil) or (CurrentHedgehog^.Gear = nil); +bRes:= (CurrentTeam = nil) or (CurrentHedgehog^.Gear = nil); {$IFDEF DEBUGFILE} -if Result then +if bRes then if CurrentTeam = nil then AddFileLog('CONSOLE: CurTeam = nil') else AddFileLog('CONSOLE: CurTeam <> nil, Gear = nil'); {$ENDIF} -CheckNoTeamOrHH:= Result +CheckNoTeamOrHH:= bRes; end; //////////////////////////////////////////////////////////////////////////////// procedure chQuit(var s: shortstring); diff -r dcd248e04f3d -r ed789a7ef68d hedgewars/options.inc --- a/hedgewars/options.inc Thu Jan 14 16:38:43 2010 +0000 +++ b/hedgewars/options.inc Thu Jan 14 16:46:50 2010 +0000 @@ -28,6 +28,7 @@ {$DEFINE TOUCHINPUT} {$DEFINE LOWRES} {$DEFINE SDL_IMAGE_NEWER} + {$MODE OBJFPC} {$ENDIF} {$IFNDEF DARWIN} diff -r dcd248e04f3d -r ed789a7ef68d hedgewars/uAI.pas --- a/hedgewars/uAI.pas Thu Jan 14 16:38:43 2010 +0000 +++ b/hedgewars/uAI.pas Thu Jan 14 16:46:50 2010 +0000 @@ -135,10 +135,10 @@ end; function Push(Ticks: Longword; const Actions: TActions; const Me: TGear; Dir: integer): boolean; - var Result: boolean; + var bRes: boolean; begin - Result:= (Stack.Count < cBranchStackSize) and (Actions.Count < MAXACTIONS - 5); - if Result then + bRes:= (Stack.Count < cBranchStackSize) and (Actions.Count < MAXACTIONS - 5); + if bRes then with Stack.States[Stack.Count] do begin WastedTicks:= Ticks; @@ -147,7 +147,7 @@ Hedgehog.Message:= Dir; inc(Stack.Count) end; - Push:= Result + Push:= bRes end; procedure Pop(var Ticks: Longword; var Actions: TActions; var Me: TGear); diff -r dcd248e04f3d -r ed789a7ef68d hedgewars/uAIAmmoTests.pas --- a/hedgewars/uAIAmmoTests.pas Thu Jan 14 16:38:43 2010 +0000 +++ b/hedgewars/uAIAmmoTests.pas Thu Jan 14 16:46:50 2010 +0000 @@ -104,12 +104,12 @@ var Vx, Vy, r: hwFloat; rTime: LongInt; Score, EX, EY: LongInt; - Result: LongInt; + valueResult: LongInt; function CheckTrace: LongInt; var x, y, dX, dY: hwFloat; t: LongInt; - Result: LongInt; + value: LongInt; begin x:= Me^.X; y:= Me^.Y; @@ -125,16 +125,16 @@ until TestCollExcludingMe(Me, hwRound(x), hwRound(y), 5) or (t <= 0); EX:= hwRound(x); EY:= hwRound(y); - Result:= RateExplosion(Me, EX, EY, 101); - if Result = 0 then Result:= - Metric(Targ.X, Targ.Y, EX, EY) div 64; - CheckTrace:= Result + value:= RateExplosion(Me, EX, EY, 101); + if value = 0 then value:= - Metric(Targ.X, Targ.Y, EX, EY) div 64; + CheckTrace:= value; end; begin ap.Time:= 0; rTime:= 350; ap.ExplR:= 0; -Result:= BadTurn; +valueResult:= BadTurn; repeat rTime:= rTime + 300 + Level * 50 + random(300); Vx:= - cWindSpeed * rTime * _0_5 + (int2hwFloat(Targ.X + AIrndSign(2)) - Me^.X) / int2hwFloat(rTime); @@ -143,24 +143,24 @@ if not (r > _1) then begin Score:= CheckTrace; - if Result <= Score then + if valueResult <= Score then begin ap.Angle:= DxDy2AttackAngle(Vx, Vy) + AIrndSign(random((Level - 1) * 9)); ap.Power:= hwRound(r * cMaxPower) - random((Level - 1) * 17 + 1); ap.ExplR:= 100; ap.ExplX:= EX; ap.ExplY:= EY; - Result:= Score + valueResult:= Score end; end until (rTime > 4250); -TestBazooka:= Result +TestBazooka:= valueResult end; function TestGrenade(Me: PGear; Targ: TPoint; Level: LongInt; var ap: TAttackParams): LongInt; const tDelta = 24; var Vx, Vy, r: hwFloat; - Score, EX, EY, Result: LongInt; + Score, EX, EY, valueResult: LongInt; TestTime: Longword; function CheckTrace: LongInt; @@ -184,7 +184,7 @@ end; begin -Result:= BadTurn; +valueResult:= BadTurn; TestTime:= 0; ap.ExplR:= 0; repeat @@ -195,7 +195,7 @@ if not (r > _1) then begin Score:= CheckTrace; - if Result < Score then + if valueResult < Score then begin ap.Angle:= DxDy2AttackAngle(Vx, Vy) + AIrndSign(random(Level)); ap.Power:= hwRound(r * cMaxPower) + AIrndSign(random(Level) * 15); @@ -203,22 +203,22 @@ ap.ExplR:= 100; ap.ExplX:= EX; ap.ExplY:= EY; - Result:= Score + valueResult:= Score end; end until (TestTime = 4000); -TestGrenade:= Result +TestGrenade:= valueResult end; function TestMortar(Me: PGear; Targ: TPoint; Level: LongInt; var ap: TAttackParams): LongInt; const tDelta = 24; var Vx, Vy: hwFloat; - Score, EX, EY, Result: LongInt; + Score, EX, EY, valueResult: LongInt; TestTime: Longword; function CheckTrace: LongInt; var x, y, dY: hwFloat; - Result: LongInt; + value: LongInt; begin x:= Me^.X; y:= Me^.Y; @@ -234,18 +234,18 @@ if (EY < 1000) and not dY.isNegative then begin - Result:= RateExplosion(Me, EX, EY, 91); - if (Result = 0) then + value:= RateExplosion(Me, EX, EY, 91); + if (value = 0) then if (dY > _0_15) then - Result:= - abs(Targ.Y - EY) div 32 + value:= - abs(Targ.Y - EY) div 32 else - Result:= BadTurn - else if (Result < 0) then Result:= BadTurn + value:= BadTurn + else if (value < 0) then value:= BadTurn end else - Result:= BadTurn; + value:= BadTurn; - CheckTrace:= Result + CheckTrace:= value; end; function Solve: LongWord; @@ -268,7 +268,7 @@ end; begin -Result:= BadTurn; +valueResult:= BadTurn; ap.ExplR:= 0; if (Level > 2) then exit(BadTurn); @@ -281,17 +281,17 @@ Vy:= cGravity * (TestTime div 2) - (int2hwFloat(Targ.Y) - Me^.Y) / int2hwFloat(TestTime); Score:= CheckTrace; - if Result < Score then + if valueResult < Score then begin ap.Angle:= DxDy2AttackAngle(Vx, Vy) + AIrndSign(random(Level)); ap.Power:= 1; ap.ExplR:= 100; ap.ExplX:= EX; ap.ExplY:= EY; - Result:= Score + valueResult:= Score end; -TestMortar:= Result +TestMortar:= valueResult; end; function TestShotgun(Me: PGear; Targ: TPoint; Level: LongInt; var ap: TAttackParams): LongInt; @@ -299,7 +299,7 @@ MIN_RANGE = 80; MAX_RANGE = 400; var Vx, Vy, x, y: hwFloat; - rx, ry, Result: LongInt; + rx, ry, valueResult: LongInt; range: integer; begin ap.ExplR:= 0; @@ -321,10 +321,10 @@ begin x:= x + vX * 8; y:= y + vY * 8; - Result:= RateShotgun(Me, rx, ry) * 2; - if Result = 0 then Result:= - Metric(Targ.X, Targ.Y, rx, ry) div 64 - else dec(Result, Level * 4000); - exit(Result) + valueResult:= RateShotgun(Me, rx, ry) * 2; + if valueResult = 0 then valueResult:= - Metric(Targ.X, Targ.Y, rx, ry) div 64 + else dec(valueResult, Level * 4000); + exit(valueResult) end until (Abs(Targ.X - hwRound(x)) + Abs(Targ.Y - hwRound(y)) < 4) or (x.isNegative) or (y.isNegative) or (x.Round > LAND_WIDTH) or (y.Round > LAND_HEIGHT); TestShotgun:= BadTurn @@ -333,7 +333,7 @@ function TestDesertEagle(Me: PGear; Targ: TPoint; Level: LongInt; var ap: TAttackParams): LongInt; var Vx, Vy, x, y, t: hwFloat; d: Longword; - Result: LongInt; + valueResult: LongInt; begin ap.ExplR:= 0; ap.Time:= 0; @@ -355,13 +355,13 @@ and (Land[hwRound(y), hwRound(x)] <> 0) then inc(d); until (Abs(Targ.X - hwRound(x)) + Abs(Targ.Y - hwRound(y)) < 4) or (x.isNegative) or (y.isNegative) or (x.Round > LAND_WIDTH) or (y.Round > LAND_HEIGHT) or (d > 200); -if Abs(Targ.X - hwRound(x)) + Abs(Targ.Y - hwRound(y)) < 3 then Result:= max(0, (4 - d div 50) * 7 * 1024) - else Result:= BadTurn; -TestDesertEagle:= Result +if Abs(Targ.X - hwRound(x)) + Abs(Targ.Y - hwRound(y)) < 3 then valueResult:= max(0, (4 - d div 50) * 7 * 1024) + else valueResult:= BadTurn; +TestDesertEagle:= valueResult end; function TestBaseballBat(Me: PGear; Targ: TPoint; Level: LongInt; var ap: TAttackParams): LongInt; -var Result: LongInt; +var valueResult: LongInt; begin ap.ExplR:= 0; if (Level > 2) or (Abs(hwRound(Me^.X) - Targ.X) + Abs(hwRound(Me^.Y) - Targ.Y) > 25) then @@ -371,13 +371,13 @@ ap.Power:= 1; if (Targ.X) - hwRound(Me^.X) >= 0 then ap.Angle:= cMaxAngle div 4 else ap.Angle:= - cMaxAngle div 4; -Result:= RateShove(Me, hwRound(Me^.X) + 10 * hwSign(int2hwFloat(Targ.X) - Me^.X), hwRound(Me^.Y), 15, 30); -if Result <= 0 then Result:= BadTurn else inc(Result); -TestBaseballBat:= Result +valueResult:= RateShove(Me, hwRound(Me^.X) + 10 * hwSign(int2hwFloat(Targ.X) - Me^.X), hwRound(Me^.Y), 15, 30); +if valueResult <= 0 then valueResult:= BadTurn else inc(valueResult); +TestBaseballBat:= valueResult; end; function TestFirePunch(Me: PGear; Targ: TPoint; Level: LongInt; var ap: TAttackParams): LongInt; -var i, Result: LongInt; +var i, valueResult: LongInt; begin ap.ExplR:= 0; ap.Time:= 0; @@ -388,22 +388,22 @@ begin if TestColl(hwRound(Me^.Y), hwRound(Me^.Y) - 16, 6) and (RateShove(Me, hwRound(Me^.X) + 10 * hwSign(Me^.dX), hwRound(Me^.Y) - 40, 30, 30) = 0) then - Result:= Succ(BadTurn) + valueResult:= Succ(BadTurn) else - Result:= BadTurn; - exit(Result) + valueResult:= BadTurn; + exit(valueResult) end; -Result:= 0; +valueResult:= 0; for i:= 0 to 4 do - Result:= Result + RateShove(Me, hwRound(Me^.X) + 10 * hwSign(int2hwFloat(Targ.X) - Me^.X), + valueResult:= valueResult + RateShove(Me, hwRound(Me^.X) + 10 * hwSign(int2hwFloat(Targ.X) - Me^.X), hwRound(Me^.Y) - 20 * i - 5, 10, 30); -if Result <= 0 then - Result:= BadTurn +if valueResult <= 0 then + valueResult:= BadTurn else - inc(Result); + inc(valueResult); -TestFirePunch:= Result +TestFirePunch:= valueResult; end; function TestAirAttack(Me: PGear; Targ: TPoint; Level: LongInt; var ap: TAttackParams): LongInt; @@ -412,7 +412,7 @@ b: array[0..9] of boolean; dmg: array[0..9] of LongInt; fexit: boolean; - i, t, Result: LongInt; + i, t, valueResult: LongInt; begin ap.ExplR:= 0; ap.Time:= 0; @@ -431,7 +431,7 @@ b[i]:= true; dmg[i]:= 0 end; -Result:= 0; +valueResult:= 0; repeat X:= X + cBombsSpeed; @@ -452,23 +452,23 @@ end; until fexit or (Y > _1024); -for i:= 0 to 5 do inc(Result, dmg[i]); -t:= Result; +for i:= 0 to 5 do inc(valueResult, dmg[i]); +t:= valueResult; ap.AttackPutX:= Targ.X - 60; for i:= 0 to 3 do begin dec(t, dmg[i]); inc(t, dmg[i + 6]); - if t > Result then + if t > valueResult then begin - Result:= t; + valueResult:= t; ap.AttackPutX:= Targ.X - 30 - cShift + i * 30 end end; -if Result <= 0 then Result:= BadTurn; -TestAirAttack:= Result +if valueResult <= 0 then valueResult:= BadTurn; +TestAirAttack:= valueResult; end; end. diff -r dcd248e04f3d -r ed789a7ef68d hedgewars/uAIMisc.pas --- a/hedgewars/uAIMisc.pas Thu Jan 14 16:38:43 2010 +0000 +++ b/hedgewars/uAIMisc.pas Thu Jan 14 16:46:50 2010 +0000 @@ -162,17 +162,17 @@ function RatePlace(Gear: PGear): LongInt; var i, r: LongInt; - Result: LongInt; + rate: LongInt; begin -Result:= 0; +rate:= 0; for i:= 0 to Pred(bonuses.Count) do with bonuses.ar[i] do begin r:= hwRound(Distance(Gear^.X - int2hwFloat(X), Gear^.Y - int2hwFloat(Y))); if r < Radius then - inc(Result, Score * (Radius - r)) + inc(rate, Score * (Radius - r)) end; - RatePlace:= Result + RatePlace:= rate; end; // Wrapper to test various approaches. If it works reasonably, will just replace. @@ -204,9 +204,9 @@ end; function RateExplosion(Me: PGear; x, y, r: LongInt): LongInt; -var i, dmg, Result: LongInt; +var i, dmg, rate: LongInt; begin -Result:= 0; +rate:= 0; // add our virtual position with Targets.ar[Targets.Count] do begin @@ -223,20 +223,20 @@ begin dmg:= min(dmg div 2, r); if dmg >= abs(Score) then - if Score > 0 then inc(Result, KillScore) - else dec(Result, KillScore * friendlyfactor div 100) + if Score > 0 then inc(rate, KillScore) + else dec(rate, KillScore * friendlyfactor div 100) else - if Score > 0 then inc(Result, dmg) - else dec(Result, dmg * friendlyfactor div 100) + if Score > 0 then inc(rate, dmg) + else dec(rate, dmg * friendlyfactor div 100) end; end; -RateExplosion:= Result * 1024 +RateExplosion:= rate * 1024; end; function RateShove(Me: PGear; x, y, r, power: LongInt): LongInt; -var i, dmg, Result: LongInt; +var i, dmg, rate: LongInt; begin -Result:= 0; +rate:= 0; for i:= 0 to Pred(Targets.Count) do with Targets.ar[i] do begin @@ -244,22 +244,22 @@ if dmg > 0 then begin if power >= abs(Score) then - if Score > 0 then inc(Result, KillScore) - else dec(Result, KillScore * friendlyfactor div 100) + if Score > 0 then inc(rate, KillScore) + else dec(rate, KillScore * friendlyfactor div 100) else - if Score > 0 then inc(Result, power) - else dec(Result, power * friendlyfactor div 100) + if Score > 0 then inc(rate, power) + else dec(rate, power * friendlyfactor div 100) end; end; -RateShove:= Result * 1024 +RateShove:= rate * 1024 end; function RateShotgun(Me: PGear; x, y: LongInt): LongInt; const REUSE_BONUS = 1.35; -var i, dmg, Result: LongInt; +var i, dmg, rate: LongInt; begin -Result:= 0; +rate:= 0; // add our virtual position with Targets.ar[Targets.Count] do begin @@ -276,31 +276,31 @@ if dmg > 0 then begin if dmg >= abs(Score) then dmg := KillScore; - if Score > 0 then inc(Result, dmg) - else dec(Result, dmg * friendlyfactor div 100); + if Score > 0 then inc(rate, dmg) + else dec(rate, dmg * friendlyfactor div 100); end; end; -RateShotgun:= Result * 1024 +RateShotgun:= rate * 1024; end; function HHJump(Gear: PGear; JumpType: TJumpType; var GoInfo: TGoInfo): boolean; var bX, bY: LongInt; - Result: boolean; + bRes: boolean; begin -Result:= false; +bRes:= false; GoInfo.Ticks:= 0; GoInfo.FallPix:= 0; GoInfo.JumpType:= jmpNone; bX:= hwRound(Gear^.X); bY:= hwRound(Gear^.Y); case JumpType of - jmpNone: exit(Result); + jmpNone: exit(bRes); jmpHJump: if not TestCollisionYwithGear(Gear, -1) then begin Gear^.dY:= -_0_2; SetLittle(Gear^.dX); Gear^.State:= Gear^.State or gstMoving or gstHHJumping; - end else exit(Result); + end else exit(bRes); jmpLJump: begin if not TestCollisionYwithGear(Gear, -1) then if not TestCollisionXwithXYShift(Gear, _0, -2, hwSign(Gear^.dX)) then Gear^.Y:= Gear^.Y - int2hwFloat(2) else @@ -311,12 +311,12 @@ Gear^.dY:= -_0_15; Gear^.dX:= SignAs(_0_15, Gear^.dX); Gear^.State:= Gear^.State or gstMoving or gstHHJumping - end else exit(Result) + end else exit(bRes) end end; repeat -if not (hwRound(Gear^.Y) + cHHRadius < cWaterLine) then exit(Result); +if not (hwRound(Gear^.Y) + cHHRadius < cWaterLine) then exit(bRes); if (Gear^.State and gstMoving) <> 0 then begin if (GoInfo.Ticks = 350) then @@ -329,7 +329,7 @@ Gear^.X:= Gear^.X + Gear^.dX; inc(GoInfo.Ticks); Gear^.dY:= Gear^.dY + cGravity; - if Gear^.dY > _0_4 then exit(Result); + if Gear^.dY > _0_4 then exit(bRes); if (Gear^.dY.isNegative)and TestCollisionYwithGear(Gear, -1) then Gear^.dY:= _0; Gear^.Y:= Gear^.Y + Gear^.dY; if (not Gear^.dY.isNegative)and TestCollisionYwithGear(Gear, 1) then @@ -339,18 +339,18 @@ case JumpType of jmpHJump: if bY - hwRound(Gear^.Y) > 5 then begin - Result:= true; + bRes:= true; GoInfo.JumpType:= jmpHJump; inc(GoInfo.Ticks, 300 + 300) // 300 before jump, 300 after end; jmpLJump: if abs(bX - hwRound(Gear^.X)) > 30 then begin - Result:= true; + bRes:= true; GoInfo.JumpType:= jmpLJump; inc(GoInfo.Ticks, 300 + 300) // 300 before jump, 300 after end; end; - exit(Result) + exit(bRes) end; end; until false @@ -358,9 +358,9 @@ function HHGo(Gear, AltGear: PGear; var GoInfo: TGoInfo): boolean; var pX, pY: LongInt; - Result: boolean; + bRes: boolean; begin -Result:= false; +bRes:= false; AltGear^:= Gear^; GoInfo.Ticks:= 0; @@ -378,7 +378,7 @@ begin Goinfo.FallPix:= 0; HHJump(AltGear, jmpLJump, GoInfo); // try ljump instead of fall with damage - exit(Result) + exit(bRes) end; Gear^.Y:= Gear^.Y + Gear^.dY; if hwRound(Gear^.Y) > pY then inc(GoInfo.FallPix); @@ -387,14 +387,14 @@ inc(GoInfo.Ticks, 410); Gear^.State:= Gear^.State and not (gstMoving or gstHHJumping); Gear^.dY:= _0; - Result:= true; + bRes:= true; HHJump(AltGear, jmpLJump, GoInfo); // try ljump instead of fall - exit(Result) + exit(bRes) end; continue end; if (Gear^.Message and gm_Left )<>0 then Gear^.dX:= -cLittle else - if (Gear^.Message and gm_Right )<>0 then Gear^.dX:= cLittle else exit(Result); + if (Gear^.Message and gm_Right )<>0 then Gear^.dX:= cLittle else exit(bRes); if TestCollisionXwithGear(Gear, hwSign(Gear^.dX)) then begin if not (TestCollisionXwithXYShift(Gear, _0, -6, hwSign(Gear^.dX)) @@ -450,7 +450,7 @@ exit(true); until (pX = hwRound(Gear^.X)) and (pY = hwRound(Gear^.Y)) and ((Gear^.State and gstMoving) = 0); HHJump(AltGear, jmpHJump, GoInfo); -HHGo:= Result +HHGo:= bRes; end; function AIrndSign(num: LongInt): LongInt; diff -r dcd248e04f3d -r ed789a7ef68d hedgewars/uConsole.pas --- a/hedgewars/uConsole.pas Thu Jan 14 16:38:43 2010 +0000 +++ b/hedgewars/uConsole.pas Thu Jan 14 16:46:50 2010 +0000 @@ -65,23 +65,23 @@ end; function RegisterVariable(Name: string; VType: TVariableType; p: pointer; Trusted: boolean): PVariable; -var Result: PVariable; +var value: PVariable; begin -New(Result); -TryDo(Result <> nil, 'RegisterVariable: Result = nil', true); -FillChar(Result^, sizeof(TVariable), 0); -Result^.Name:= Name; -Result^.VType:= VType; -Result^.Handler:= p; -Result^.Trusted:= Trusted; +New(value); +TryDo(value <> nil, 'RegisterVariable: value = nil', true); +FillChar(value^, sizeof(TVariable), 0); +value^.Name:= Name; +value^.VType:= VType; +value^.Handler:= p; +value^.Trusted:= Trusted; -if Variables = nil then Variables:= Result +if Variables = nil then Variables:= value else begin - Result^.Next:= Variables; - Variables:= Result + value^.Next:= Variables; + Variables:= value end; -RegisterVariable:= Result +RegisterVariable:= value; end; procedure FreeVariablesList; @@ -201,18 +201,18 @@ end; function GetLastConsoleLine: shortstring; -var Result: shortstring; +var valueStr: shortstring; i: LongWord; begin i:= (CurrLine + cLinesCount - 2) mod cLinesCount; -Result:= ConsoleLines[i].s; +valueStr:= ConsoleLines[i].s; -Result:= Result + #10; +valueStr:= valueStr + #10; i:= (CurrLine + cLinesCount - 1) mod cLinesCount; -Result:= Result + ConsoleLines[i].s; +valueStr:= valueStr + ConsoleLines[i].s; -GetLastConsoleLine:= Result +GetLastConsoleLine:= valueStr; end; procedure StopMessages(Message: Longword); diff -r dcd248e04f3d -r ed789a7ef68d hedgewars/uGears.pas --- a/hedgewars/uGears.pas Thu Jan 14 16:38:43 2010 +0000 +++ b/hedgewars/uGears.pas Thu Jan 14 16:46:50 2010 +0000 @@ -209,213 +209,213 @@ function AddGear(X, Y: LongInt; Kind: TGearType; State: Longword; dX, dY: hwFloat; Timer: LongWord): PGear; const Counter: Longword = 0; -var Result: PGear; +var gear: PGear; begin inc(Counter); {$IFDEF DEBUGFILE} AddFileLog('AddGear: #' + inttostr(Counter) + ' (' + inttostr(x) + ',' + inttostr(y) + '), d(' + floattostr(dX) + ',' + floattostr(dY) + ') type = ' + inttostr(ord(Kind))); {$ENDIF} -New(Result); -FillChar(Result^, sizeof(TGear), 0); -Result^.X:= int2hwFloat(X); -Result^.Y:= int2hwFloat(Y); -Result^.Kind := Kind; -Result^.State:= State; -Result^.Active:= true; -Result^.dX:= dX; -Result^.dY:= dY; -Result^.doStep:= doStepHandlers[Kind]; -Result^.CollisionIndex:= -1; -Result^.Timer:= Timer; -Result^.Z:= cUsualZ; -Result^.FlightTime:= 0; -Result^.uid:= Counter; +New(gear); +FillChar(gear^, sizeof(TGear), 0); +gear^.X:= int2hwFloat(X); +gear^.Y:= int2hwFloat(Y); +gear^.Kind := Kind; +gear^.State:= State; +gear^.Active:= true; +gear^.dX:= dX; +gear^.dY:= dY; +gear^.doStep:= doStepHandlers[Kind]; +gear^.CollisionIndex:= -1; +gear^.Timer:= Timer; +gear^.Z:= cUsualZ; +gear^.FlightTime:= 0; +gear^.uid:= Counter; if CurrentTeam <> nil then begin - Result^.Hedgehog:= CurrentHedgehog; - Result^.IntersectGear:= CurrentHedgehog^.Gear + gear^.Hedgehog:= CurrentHedgehog; + gear^.IntersectGear:= CurrentHedgehog^.Gear end; case Kind of gtAmmo_Bomb, gtClusterBomb: begin - Result^.Radius:= 4; - Result^.Elasticity:= _0_6; - Result^.Friction:= _0_96; - Result^.RenderTimer:= true; - if Result^.Timer = 0 then Result^.Timer:= 3000 + gear^.Radius:= 4; + gear^.Elasticity:= _0_6; + gear^.Friction:= _0_96; + gear^.RenderTimer:= true; + if gear^.Timer = 0 then gear^.Timer:= 3000 end; gtWatermelon: begin - Result^.Radius:= 4; - Result^.Elasticity:= _0_8; - Result^.Friction:= _0_995; - Result^.RenderTimer:= true; - if Result^.Timer = 0 then Result^.Timer:= 3000 + gear^.Radius:= 4; + gear^.Elasticity:= _0_8; + gear^.Friction:= _0_995; + gear^.RenderTimer:= true; + if gear^.Timer = 0 then gear^.Timer:= 3000 end; gtHedgehog: begin - Result^.Radius:= cHHRadius; - Result^.Elasticity:= _0_35; - Result^.Friction:= _0_999; - Result^.Angle:= cMaxAngle div 2; - Result^.Z:= cHHZ; + gear^.Radius:= cHHRadius; + gear^.Elasticity:= _0_35; + gear^.Friction:= _0_999; + gear^.Angle:= cMaxAngle div 2; + gear^.Z:= cHHZ; end; gtAmmo_Grenade: begin // bazooka - Result^.Radius:= 4; + gear^.Radius:= 4; end; gtHealthTag: begin - Result^.Timer:= 1500; - Result^.Z:= 2002; + gear^.Timer:= 1500; + gear^.Z:= 2002; end; gtGrave: begin - Result^.Radius:= 10; - Result^.Elasticity:= _0_6; + gear^.Radius:= 10; + gear^.Elasticity:= _0_6; end; gtUFO: begin - Result^.Radius:= 5; - Result^.Timer:= 500; - Result^.RenderTimer:= true; - Result^.Elasticity:= _0_9 + gear^.Radius:= 5; + gear^.Timer:= 500; + gear^.RenderTimer:= true; + gear^.Elasticity:= _0_9 end; gtShotgunShot: begin - Result^.Timer:= 900; - Result^.Radius:= 2 + gear^.Timer:= 900; + gear^.Radius:= 2 end; gtPickHammer: begin - Result^.Radius:= 10; - Result^.Timer:= 4000 + gear^.Radius:= 10; + gear^.Timer:= 4000 end; gtSmokeTrace, gtEvilTrace: begin - Result^.X:= Result^.X - _16; - Result^.Y:= Result^.Y - _16; - Result^.State:= 8; - Result^.Z:= cSmokeZ + gear^.X:= gear^.X - _16; + gear^.Y:= gear^.Y - _16; + gear^.State:= 8; + gear^.Z:= cSmokeZ end; gtRope: begin - Result^.Radius:= 3; - Result^.Friction:= _450; + gear^.Radius:= 3; + gear^.Friction:= _450; RopePoints.Count:= 0; end; gtExplosion: begin - Result^.X:= Result^.X; - Result^.Y:= Result^.Y; + gear^.X:= gear^.X; + gear^.Y:= gear^.Y; end; gtMine: begin - Result^.State:= Result^.State or gstMoving; - Result^.Radius:= 2; - Result^.Elasticity:= _0_55; - Result^.Friction:= _0_995; + gear^.State:= gear^.State or gstMoving; + gear^.Radius:= 2; + gear^.Elasticity:= _0_55; + gear^.Friction:= _0_995; if cMinesTime < 0 then - Result^.Timer:= getrandom(4)*1000 + gear^.Timer:= getrandom(4)*1000 else - Result^.Timer:= cMinesTime*1; + gear^.Timer:= cMinesTime*1; end; gtCase: begin - Result^.Radius:= 16; - Result^.Elasticity:= _0_3 + gear^.Radius:= 16; + gear^.Elasticity:= _0_3 end; gtDEagleShot: begin - Result^.Radius:= 1; - Result^.Health:= 50 + gear^.Radius:= 1; + gear^.Health:= 50 end; gtSniperRifleShot: begin - Result^.Radius:= 1; - Result^.Health:= 50 + gear^.Radius:= 1; + gear^.Health:= 50 end; gtDynamite: begin - Result^.Radius:= 3; - Result^.Elasticity:= _0_55; - Result^.Friction:= _0_03; - Result^.Timer:= 5000; + gear^.Radius:= 3; + gear^.Elasticity:= _0_55; + gear^.Friction:= _0_03; + gear^.Timer:= 5000; end; gtCluster: begin - Result^.Radius:= 2; - Result^.RenderTimer:= true + gear^.Radius:= 2; + gear^.RenderTimer:= true end; - gtShover: Result^.Radius:= 20; + gtShover: gear^.Radius:= 20; gtFlame: begin - Result^.Tag:= GetRandom(32); - Result^.Radius:= 1; - Result^.Health:= 5; - if (Result^.dY.QWordValue = 0) and (Result^.dX.QWordValue = 0) then + gear^.Tag:= GetRandom(32); + gear^.Radius:= 1; + gear^.Health:= 5; + if (gear^.dY.QWordValue = 0) and (gear^.dX.QWordValue = 0) then begin - Result^.dY:= (getrandom - _0_8) * _0_03; - Result^.dX:= (getrandom - _0_5) * _0_4 + gear^.dY:= (getrandom - _0_8) * _0_03; + gear^.dX:= (getrandom - _0_5) * _0_4 end end; gtFirePunch: begin - Result^.Radius:= 15; - Result^.Tag:= Y + gear^.Radius:= 15; + gear^.Tag:= Y end; gtAirBomb: begin - Result^.Radius:= 5; + gear^.Radius:= 5; end; gtBlowTorch: begin - Result^.Radius:= cHHRadius + cBlowTorchC; - Result^.Timer:= 7500 + gear^.Radius:= cHHRadius + cBlowTorchC; + gear^.Timer:= 7500 end; gtSwitcher: begin - Result^.Z:= cCurrHHZ + gear^.Z:= cCurrHHZ end; gtTarget: begin - Result^.Radius:= 10; - Result^.Elasticity:= _0_3; - Result^.Timer:= 0 + gear^.Radius:= 10; + gear^.Elasticity:= _0_3; + gear^.Timer:= 0 end; gtMortar: begin - Result^.Radius:= 4; - Result^.Elasticity:= _0_2; - Result^.Friction:= _0_08 + gear^.Radius:= 4; + gear^.Elasticity:= _0_2; + gear^.Friction:= _0_08 end; - gtWhip: Result^.Radius:= 20; + gtWhip: gear^.Radius:= 20; gtKamikaze: begin - Result^.Health:= 2048; - Result^.Radius:= 20 + gear^.Health:= 2048; + gear^.Radius:= 20 end; gtCake: begin - Result^.Health:= 2048; - Result^.Radius:= 7; - Result^.Z:= cOnHHZ; - Result^.RenderTimer:= true; - if not dX.isNegative then Result^.Angle:= 1 else Result^.Angle:= 3 + gear^.Health:= 2048; + gear^.Radius:= 7; + gear^.Z:= cOnHHZ; + gear^.RenderTimer:= true; + if not dX.isNegative then gear^.Angle:= 1 else gear^.Angle:= 3 end; gtHellishBomb: begin - Result^.Radius:= 4; - Result^.Elasticity:= _0_5; - Result^.Friction:= _0_96; - Result^.RenderTimer:= true; - Result^.Timer:= 5000 + gear^.Radius:= 4; + gear^.Elasticity:= _0_5; + gear^.Friction:= _0_96; + gear^.RenderTimer:= true; + gear^.Timer:= 5000 end; gtDrill: begin - Result^.Timer:= 5000; - Result^.Radius:= 4 + gear^.Timer:= 5000; + gear^.Radius:= 4 end; gtBall: begin - Result^.Radius:= 5; - Result^.Tag:= random(8); - Result^.Timer:= 5000; - Result^.Elasticity:= _0_7; - Result^.Friction:= _0_995; + gear^.Radius:= 5; + gear^.Tag:= random(8); + gear^.Timer:= 5000; + gear^.Elasticity:= _0_7; + gear^.Friction:= _0_995; end; gtBallgun: begin - Result^.Timer:= 5001; + gear^.Timer:= 5001; end; gtRCPlane: begin - Result^.Timer:= 15000; - Result^.Health:= 3; - Result^.Radius:= 8 + gear^.Timer:= 15000; + gear^.Health:= 3; + gear^.Radius:= 8 end; gtJetpack: begin - Result^.Health:= 2000; + gear^.Health:= 2000; end; gtMolotov: begin - Result^.Radius:= 8; + gear^.Radius:= 8; end; end; -InsertGearToList(Result); -AddGear:= Result +InsertGearToList(gear); +AddGear:= gear; end; procedure DeleteGear(Gear: PGear); @@ -1858,16 +1858,16 @@ function CountGears(Kind: TGearType): Longword; var t: PGear; - Result: Longword; + count: Longword = 0; begin -Result:= 0; + t:= GearsList; while t <> nil do begin - if t^.Kind = Kind then inc(Result); + if t^.Kind = Kind then inc(count); t:= t^.NextGear end; -CountGears:= Result +CountGears:= count; end; procedure SpawnBoxOfSmth; @@ -1957,17 +1957,16 @@ function CountNonZeroz(x, y, r, c: LongInt): LongInt; var i: LongInt; - Result: LongInt; + count: LongInt = 0; begin - Result:= 0; if (y and LAND_HEIGHT_MASK) = 0 then for i:= max(x - r, 0) to min(x + r, LAND_WIDTH - 4) do if Land[y, i] <> 0 then begin - inc(Result); - if Result = c then exit(Result) + inc(count); + if count = c then exit(count) end; - CountNonZeroz:= Result + CountNonZeroz:= count; end; var x: LongInt; diff -r dcd248e04f3d -r ed789a7ef68d hedgewars/uIO.pas --- a/hedgewars/uIO.pas Thu Jan 14 16:38:43 2010 +0000 +++ b/hedgewars/uIO.pas Thu Jan 14 16:46:50 2010 +0000 @@ -65,23 +65,23 @@ function AddCmd(Time: Word; str: shortstring): PCmd; -var Result: PCmd; +var command: PCmd; begin -new(Result); -FillChar(Result^, sizeof(TCmd), 0); -Result^.loTime:= Time; -Result^.str:= str; -if Result^.cmd <> 'F' then dec(Result^.len, 2); // cut timestamp +new(command); +FillChar(command^, sizeof(TCmd), 0); +command^.loTime:= Time; +command^.str:= str; +if command^.cmd <> 'F' then dec(command^.len, 2); // cut timestamp if headcmd = nil then begin - headcmd:= Result; - lastcmd:= Result + headcmd:= command; + lastcmd:= command end else begin - lastcmd^.Next:= Result; - lastcmd:= Result + lastcmd^.Next:= command; + lastcmd:= command end; -AddCmd:= Result +AddCmd:= command; end; procedure RemoveCmd; diff -r dcd248e04f3d -r ed789a7ef68d hedgewars/uKeys.pas --- a/hedgewars/uKeys.pas Thu Jan 14 16:38:43 2010 +0000 +++ b/hedgewars/uKeys.pas Thu Jan 14 16:46:50 2010 +0000 @@ -17,8 +17,6 @@ *) {$INCLUDE "options.inc"} -{$IFDEF IPHONEOS} {$MODE OBJFPC} {$ENDIF} -// TODO: insert the above line in options.inc unit uKeys; interface diff -r dcd248e04f3d -r ed789a7ef68d hedgewars/uLandGraphics.pas --- a/hedgewars/uLandGraphics.pas Thu Jan 14 16:38:43 2010 +0000 +++ b/hedgewars/uLandGraphics.pas Thu Jan 14 16:46:50 2010 +0000 @@ -549,9 +549,9 @@ function SweepDirty: boolean; var x, y, xx, yy: LongInt; - Result, updateBlock, resweep: boolean; + bRes, updateBlock, resweep: boolean; begin -Result:= false; +bRes:= false; for y:= 0 to LAND_HEIGHT div 32 - 1 do begin @@ -569,7 +569,7 @@ for xx:= x * 32 to x * 32 + 31 do if Despeckle(xx, yy) then begin - Result:= true; + bRes:= true; updateBlock:= true; resweep:= true; end; @@ -580,7 +580,7 @@ end; end; -SweepDirty:= Result +SweepDirty:= bRes; end; // Return true if outside of land or not the value tested, used right now for some X/Y movement that does not use normal hedgehog movement in GSHandlers.inc diff -r dcd248e04f3d -r ed789a7ef68d hedgewars/uLandObjects.pas --- a/hedgewars/uLandObjects.pas Thu Jan 14 16:38:43 2010 +0000 +++ b/hedgewars/uLandObjects.pas Thu Jan 14 16:46:50 2010 +0000 @@ -127,34 +127,34 @@ function CheckIntersect(x1, y1, w1, h1: LongInt): boolean; var i: Longword; - Result: boolean; + res: boolean = false; begin -Result:= false; + i:= 0; if RectCount > 0 then repeat with Rects^[i] do - Result:= (x < x1 + w1) and (x1 < x + w) and + res:= (x < x1 + w1) and (x1 < x + w) and (y < y1 + h1) and (y1 < y + h); inc(i) - until (i = RectCount) or (Result); -CheckIntersect:= Result + until (i = RectCount) or (res); +CheckIntersect:= res; end; function AddGirder(gX: LongInt): boolean; var tmpsurf: PSDL_Surface; x1, x2, y, k, i: LongInt; rr: TSDL_Rect; - Result: boolean; + bRes: boolean; function CountNonZeroz(x, y: LongInt): Longword; var i: LongInt; - Result: Longword; + lRes: Longword; begin - Result:= 0; + lRes:= 0; for i:= y to y + 15 do - if Land[i, x] <> 0 then inc(Result); - CountNonZeroz:= Result + if Land[i, x] <> 0 then inc(lRes); + CountNonZeroz:= lRes; end; begin @@ -188,8 +188,8 @@ until y > (LAND_HEIGHT-125); if x1 > 0 then - begin - Result:= true; +begin + bRes:= true; tmpsurf:= LoadImage(Pathz[ptCurrTheme] + '/Girder', ifTransparent or ifIgnoreCaps); if tmpsurf = nil then tmpsurf:= LoadImage(Pathz[ptGraphics] + '/Girder', ifCritical or ifTransparent or ifIgnoreCaps); @@ -202,54 +202,54 @@ SDL_FreeSurface(tmpsurf); AddRect(x1 - 8, y - 32, x2 - x1 + 16, 80); - end else Result:= false; +end +else bRes:= false; -AddGirder:= Result +AddGirder:= bRes; end; function CheckLand(rect: TSDL_Rect; dX, dY, Color: Longword): boolean; var i: Longword; - Result: boolean; + bRes: boolean = true; begin -Result:= true; inc(rect.x, dX); inc(rect.y, dY); i:= 0; {$WARNINGS OFF} -while (i <= rect.w) and Result do +while (i <= rect.w) and bRes do begin - Result:= (Land[rect.y, rect.x + i] = Color) and (Land[rect.y + rect.h, rect.x + i] = Color); + bRes:= (Land[rect.y, rect.x + i] = Color) and (Land[rect.y + rect.h, rect.x + i] = Color); inc(i) end; i:= 0; -while (i <= rect.h) and Result do +while (i <= rect.h) and bRes do begin - Result:= (Land[rect.y + i, rect.x] = Color) and (Land[rect.y + i, rect.x + rect.w] = Color); + bRes:= (Land[rect.y + i, rect.x] = Color) and (Land[rect.y + i, rect.x + rect.w] = Color); inc(i) end; {$WARNINGS ON} -CheckLand:= Result +CheckLand:= bRes; end; function CheckCanPlace(x, y: Longword; var Obj: TThemeObject): boolean; var i: Longword; - Result: boolean; + bRes: boolean; begin with Obj do if CheckLand(inland, x, y, COLOR_LAND) then begin - Result:= true; + bRes:= true; i:= 1; - while Result and (i <= rectcnt) do + while bRes and (i <= rectcnt) do begin - Result:= CheckLand(outland[i], x, y, 0); + bRes:= CheckLand(outland[i], x, y, 0); inc(i) end; - if Result then - Result:= not CheckIntersect(x, y, Width, Height) + if bRes then + bRes:= not CheckIntersect(x, y, Width, Height) end else - Result:= false; -CheckCanPlace:= Result + bRes:= false; +CheckCanPlace:= bRes; end; function TryPut(var Obj: TThemeObject): boolean; overload; @@ -257,7 +257,7 @@ var x, y: Longword; ar: array[0..MaxPointsIndex] of TPoint; cnt, i: Longword; - Result: boolean; + bRes: boolean; begin cnt:= 0; Obj.Maxcnt:= (Obj.Maxcnt * MaxHedgehogs) div 18; @@ -284,8 +284,8 @@ until y > LAND_HEIGHT - 1 - Height; inc(x, getrandom(6) + 3) until x > LAND_WIDTH - 1 - Width; - Result:= cnt <> 0; - if Result then + bRes:= cnt <> 0; + if bRes then begin i:= getrandom(cnt); BlitImageAndGenerateCollisionInfo(ar[i].x, ar[i].y, 0, Obj.Surf); @@ -293,7 +293,7 @@ dec(Maxcnt) end else Maxcnt:= 0 end; -TryPut:= Result +TryPut:= bRes; end; function TryPut(var Obj: TSprayObject; Surface: PSDL_Surface): boolean; overload; @@ -302,7 +302,7 @@ ar: array[0..MaxPointsIndex] of TPoint; cnt, i: Longword; r: TSDL_Rect; - Result: boolean; + bRes: boolean; begin cnt:= 0; Obj.Maxcnt:= (Obj.Maxcnt * MaxHedgehogs) div 18; @@ -334,8 +334,8 @@ until y > LAND_HEIGHT - 1 - Height - 8; inc(x, getrandom(12) + 12) until x > LAND_WIDTH - 1 - Width; - Result:= cnt <> 0; - if Result then + bRes:= cnt <> 0; + if bRes then begin i:= getrandom(cnt); r.x:= ar[i].X; @@ -347,7 +347,7 @@ dec(Maxcnt) end else Maxcnt:= 0 end; -TryPut:= Result +TryPut:= bRes; end; procedure ReadThemeInfo(var ThemeObjects: TThemeObjects; var SprayObjects: TSprayObjects); diff -r dcd248e04f3d -r ed789a7ef68d hedgewars/uStore.pas --- a/hedgewars/uStore.pas Thu Jan 14 16:38:43 2010 +0000 +++ b/hedgewars/uStore.pas Thu Jan 14 16:46:50 2010 +0000 @@ -114,28 +114,28 @@ var w, h: LongInt; tmpsurf: PSDL_Surface; clr: TSDL_Color; - Result: TSDL_Rect; + finalRect: TSDL_Rect; begin TTF_SizeUTF8(Fontz[Font].Handle, Str2PChar(s), w, h); -Result.x:= X; -Result.y:= Y; -Result.w:= w + FontBorder * 2 + 4; -Result.h:= h + FontBorder * 2; -DrawRoundRect(@Result, cWhiteColor, endian(cNearBlackColorChannels.value), Surface, true); +finalRect.x:= X; +finalRect.y:= Y; +finalRect.w:= w + FontBorder * 2 + 4; +finalRect.h:= h + FontBorder * 2; +DrawRoundRect(@finalRect, cWhiteColor, endian(cNearBlackColorChannels.value), Surface, true); clr.r:= (Color shr 16) and $FF; clr.g:= (Color shr 8) and $FF; clr.b:= Color and $FF; tmpsurf:= TTF_RenderUTF8_Blended(Fontz[Font].Handle, Str2PChar(s), clr); -Result.x:= X + FontBorder + 2; -Result.y:= Y + FontBorder; +finalRect.x:= X + FontBorder + 2; +finalRect.y:= Y + FontBorder; SDLTry(tmpsurf <> nil, true); -SDL_UpperBlit(tmpsurf, nil, Surface, @Result); +SDL_UpperBlit(tmpsurf, nil, Surface, @finalRect); SDL_FreeSurface(tmpsurf); -Result.x:= X; -Result.y:= Y; -Result.w:= w + FontBorder * 2 + 4; -Result.h:= h + FontBorder * 2; -WriteInRoundRect:= Result +finalRect.x:= X; +finalRect.y:= Y; +finalRect.w:= w + FontBorder * 2 + 4; +finalRect.h:= h + FontBorder * 2; +WriteInRoundRect:= finalRect; end; procedure StoreLoad; @@ -790,29 +790,29 @@ function RenderStringTex(s: string; Color: Longword; font: THWFont): PTexture; var w, h : LongInt; - Result: PSDL_Surface; + finalSurface: PSDL_Surface; begin if length(s) = 0 then s:= ' '; font:= CheckCJKFont(s, font); TTF_SizeUTF8(Fontz[font].Handle, Str2PChar(s), w, h); -Result:= SDL_CreateRGBSurface(SDL_SWSURFACE, w + FontBorder * 2 + 4, h + FontBorder * 2, +finalSurface:= SDL_CreateRGBSurface(SDL_SWSURFACE, w + FontBorder * 2 + 4, h + FontBorder * 2, 32, RMask, GMask, BMask, AMask); -TryDo(Result <> nil, 'RenderString: fail to create surface', true); +TryDo(finalSurface <> nil, 'RenderString: fail to create surface', true); -WriteInRoundRect(Result, 0, 0, Color, font, s); +WriteInRoundRect(finalSurface, 0, 0, Color, font, s); -TryDo(SDL_SetColorKey(Result, SDL_SRCCOLORKEY, 0) = 0, errmsgTransparentSet, true); +TryDo(SDL_SetColorKey(finalSurface, SDL_SRCCOLORKEY, 0) = 0, errmsgTransparentSet, true); -RenderStringTex:= Surface2Tex(Result, false); +RenderStringTex:= Surface2Tex(finalSurface, false); -SDL_FreeSurface(Result) +SDL_FreeSurface(finalSurface); end; function RenderSpeechBubbleTex(s: string; SpeechType: Longword; font: THWFont): PTexture; var textWidth, textHeight, x, y, w, h, i, j, pos, prevpos, line, numLines, edgeWidth, edgeHeight, cornerWidth, cornerHeight: LongInt; - Result, tmpsurf, rotatedEdge: PSDL_Surface; + finalSurface, tmpsurf, rotatedEdge: PSDL_Surface; rect: TSDL_Rect; chars: TSysCharSet = [#9,' ','.',';',':','?','!',',']; substr: shortstring; @@ -888,27 +888,27 @@ rect.h:= textHeight + cornerHeight*2 - edgeHeight + SpritesData[tail].Height; //s:= inttostr(w) + ' ' + inttostr(numlines) + ' ' + inttostr(rect.x) + ' '+inttostr(rect.y) + ' ' + inttostr(rect.w) + ' ' + inttostr(rect.h); -Result:= SDL_CreateRGBSurface(SDL_SWSURFACE, rect.w, rect.h, 32, RMask, GMask, BMask, AMask); +finalSurface:= SDL_CreateRGBSurface(SDL_SWSURFACE, rect.w, rect.h, 32, RMask, GMask, BMask, AMask); -TryDo(Result <> nil, 'RenderString: fail to create surface', true); +TryDo(finalSurface <> nil, 'RenderString: fail to create surface', true); //////////////////////////////// CORNERS /////////////////////////////// -copyToXY(SpritesData[corner].Surface, Result, 0, 0); /////////////////// NW +copyToXY(SpritesData[corner].Surface, finalSurface, 0, 0); /////////////////// NW flipSurface(SpritesData[corner].Surface, true); // store all 4 versions in memory to avoid repeated flips? x:= 0; y:= textHeight + cornerHeight -1; -copyToXY(SpritesData[corner].Surface, Result, x, y); /////////////////// SW +copyToXY(SpritesData[corner].Surface, finalSurface, x, y); /////////////////// SW flipSurface(SpritesData[corner].Surface, false); x:= rect.w-cornerWidth-1; y:= textHeight + cornerHeight -1; -copyToXY(SpritesData[corner].Surface, Result, x, y); /////////////////// SE +copyToXY(SpritesData[corner].Surface, finalSurface, x, y); /////////////////// SE flipSurface(SpritesData[corner].Surface, true); x:= rect.w-cornerWidth-1; y:= 0; -copyToXY(SpritesData[corner].Surface, Result, x, y); /////////////////// NE +copyToXY(SpritesData[corner].Surface, finalSurface, x, y); /////////////////// NE flipSurface(SpritesData[corner].Surface, false); // restore original position //////////////////////////////// END CORNERS /////////////////////////////// @@ -917,7 +917,7 @@ y:= 0; while x < rect.w-cornerWidth-1 do begin - copyToXY(SpritesData[edge].Surface, Result, x, y); ///////////////// top edge + copyToXY(SpritesData[edge].Surface, finalSurface, x, y); ///////////////// top edge inc(x,edgeWidth); end; flipSurface(SpritesData[edge].Surface, true); @@ -925,7 +925,7 @@ y:= textHeight + cornerHeight*2 - edgeHeight-1; while x < rect.w-cornerWidth-1 do begin - copyToXY(SpritesData[edge].Surface, Result, x, y); ///////////////// bottom edge + copyToXY(SpritesData[edge].Surface, finalSurface, x, y); ///////////////// bottom edge inc(x,edgeWidth); end; flipSurface(SpritesData[edge].Surface, true); // restore original position @@ -937,7 +937,7 @@ copyRotatedSurface(SpritesData[edge].Surface,rotatedEdge); while y < textHeight + cornerHeight do begin - copyToXY(rotatedEdge, Result, x, y); + copyToXY(rotatedEdge, finalSurface, x, y); inc(y,edgeWidth); end; flipSurface(rotatedEdge, false); // restore original position @@ -945,14 +945,14 @@ y:= cornerHeight; while y < textHeight + cornerHeight do begin - copyToXY(rotatedEdge, Result, x, y); + copyToXY(rotatedEdge, finalSurface, x, y); inc(y,edgeWidth); end; //////////////////////////////// END EDGES ////////////////////////////////////// x:= cornerWidth; y:= textHeight + cornerHeight * 2 - edgeHeight - 1; -copyToXY(SpritesData[tail].Surface, Result, x, y); +copyToXY(SpritesData[tail].Surface, finalSurface, x, y); rect.x:= edgeHeight; rect.y:= edgeHeight; @@ -960,7 +960,7 @@ rect.h:= textHeight + cornerHeight * 2 - edgeHeight * 2; i:= rect.w; j:= rect.h; -SDL_FillRect(Result, @rect, cWhiteColor); +SDL_FillRect(finalSurface, @rect, cWhiteColor); pos:= 1; prevpos:= 0; line:= 0; while pos <= length(s) do @@ -977,7 +977,7 @@ // trying to more evenly position the text, vertically rect.y:= edgeHeight + ((j-(numLines*h)) div 2) + line * h; SDLTry(tmpsurf <> nil, true); - SDL_UpperBlit(tmpsurf, nil, Result, @rect); + SDL_UpperBlit(tmpsurf, nil, finalSurface, @rect); SDL_FreeSurface(tmpsurf); inc(line); prevpos:= pos; @@ -986,11 +986,11 @@ inc(pos); end; -//TryDo(SDL_SetColorKey(Result, SDL_SRCCOLORKEY, 0) = 0, errmsgTransparentSet, true); -RenderSpeechBubbleTex:= Surface2Tex(Result, true); +//TryDo(SDL_SetColorKey(finalSurface, SDL_SRCCOLORKEY, 0) = 0, errmsgTransparentSet, true); +RenderSpeechBubbleTex:= Surface2Tex(finalSurface, true); SDL_FreeSurface(rotatedEdge); -SDL_FreeSurface(Result) +SDL_FreeSurface(finalSurface); end; procedure RenderHealth(var Hedgehog: THedgehog); diff -r dcd248e04f3d -r ed789a7ef68d hedgewars/uTeams.pas --- a/hedgewars/uTeams.pas Thu Jan 14 16:38:43 2010 +0000 +++ b/hedgewars/uTeams.pas Thu Jan 14 16:46:50 2010 +0000 @@ -249,45 +249,45 @@ end; function AddTeam(TeamColor: Longword): PTeam; -var Result: PTeam; +var team: PTeam; c: LongInt; begin TryDo(TeamsCount < cMaxTeams, 'Too many teams', true); -New(Result); -TryDo(Result <> nil, 'AddTeam: Result = nil', true); -FillChar(Result^, sizeof(TTeam), 0); -Result^.AttackBar:= 2; -Result^.CurrHedgehog:= cMaxHHIndex; +New(team); +TryDo(team <> nil, 'AddTeam: team = nil', true); +FillChar(team^, sizeof(TTeam), 0); +team^.AttackBar:= 2; +team^.CurrHedgehog:= cMaxHHIndex; -TeamsArray[TeamsCount]:= Result; +TeamsArray[TeamsCount]:= team; inc(TeamsCount); c:= Pred(ClansCount); while (c >= 0) and (ClansArray[c]^.Color <> TeamColor) do dec(c); if c < 0 then begin - new(Result^.Clan); - FillChar(Result^.Clan^, sizeof(TClan), 0); - ClansArray[ClansCount]:= Result^.Clan; + new(team^.Clan); + FillChar(team^.Clan^, sizeof(TClan), 0); + ClansArray[ClansCount]:= team^.Clan; inc(ClansCount); - with Result^.Clan^ do + with team^.Clan^ do begin ClanIndex:= Pred(ClansCount); Color:= TeamColor end end else begin - Result^.Clan:= ClansArray[c]; + team^.Clan:= ClansArray[c]; end; -with Result^.Clan^ do +with team^.Clan^ do begin - Teams[TeamsNumber]:= Result; + Teams[TeamsNumber]:= team; inc(TeamsNumber) end; -CurrentTeam:= Result; -AddTeam:= Result +CurrentTeam:= team; +AddTeam:= team; end; procedure FreeTeamsList; @@ -323,12 +323,12 @@ end; function TeamSize(p: PTeam): Longword; -var i, Result: Longword; +var i, value: Longword; begin -Result:= 0; +value:= 0; for i:= 0 to cMaxHHIndex do - if p^.Hedgehogs[i].Gear <> nil then inc(Result); -TeamSize:= Result + if p^.Hedgehogs[i].Gear <> nil then inc(value); +TeamSize:= value; end; procedure RecountClanHealth(clan: PClan); diff -r dcd248e04f3d -r ed789a7ef68d hedgewars/uVisualGears.pas --- a/hedgewars/uVisualGears.pas Thu Jan 14 16:38:43 2010 +0000 +++ b/hedgewars/uVisualGears.pas Thu Jan 14 16:46:50 2010 +0000 @@ -336,7 +336,7 @@ ); function AddVisualGear(X, Y: LongInt; Kind: TVisualGearType): PVisualGear; -var Result: PVisualGear; +var gear: PVisualGear; t: Longword; sp: hwFloat; begin @@ -356,14 +356,14 @@ exit end; -New(Result); -FillChar(Result^, sizeof(TVisualGear), 0); -Result^.X:= int2hwFloat(X); -Result^.Y:= int2hwFloat(Y); -Result^.Kind := Kind; -Result^.doStep:= doStepHandlers[Kind]; +New(gear); +FillChar(gear^, sizeof(TVisualGear), 0); +gear^.X:= int2hwFloat(X); +gear^.Y:= int2hwFloat(Y); +gear^.Kind := Kind; +gear^.doStep:= doStepHandlers[Kind]; -with Result^ do +with gear^ do case Kind of vgtFlake: begin FrameTicks:= random(vobFrameTicks); @@ -405,7 +405,7 @@ Frame:= random(8) end; vgtSmallDamageTag: begin - Result^.FrameTicks:= 1100 + gear^.FrameTicks:= 1100 end; vgtBubble: begin dx.isNegative:= random(2) = 0; @@ -434,12 +434,12 @@ if VisualGearsList <> nil then begin - VisualGearsList^.PrevGear:= Result; - Result^.NextGear:= VisualGearsList + VisualGearsList^.PrevGear:= gear; + gear^.NextGear:= VisualGearsList end; -VisualGearsList:= Result; +VisualGearsList:= gear; -AddVisualGear:= Result +AddVisualGear:= gear; end; procedure DeleteVisualGear(Gear: PVisualGear);