46 procedure AddMiscGears; |
46 procedure AddMiscGears; |
47 procedure AssignHHCoords; |
47 procedure AssignHHCoords; |
48 function GearByUID(uid : Longword) : PGear; |
48 function GearByUID(uid : Longword) : PGear; |
49 |
49 |
50 implementation |
50 implementation |
51 uses uStore, uSound, uTeams, uRandom, uIO, uLandGraphics, {$IFDEF SDL13}uTouch,{$ENDIF} |
51 uses uStore, uSound, uTeams, uRandom, uIO, uLandGraphics, {$IFDEF SDL2}uTouch,{$ENDIF} |
52 uLocale, uAmmos, uStats, uVisualGears, uScript, uVariables, |
52 uLocale, uAmmos, uStats, uVisualGears, uScript, uVariables, |
53 uCommands, uUtils, uTextures, uRenderUtils, uGearsRender, uCaptions, uDebug, uLandTexture, |
53 uCommands, uUtils, uTextures, uRenderUtils, uGearsRender, uCaptions, uDebug, uLandTexture, |
54 uGearsHedgehog, uGearsUtils, uGearsList, uGearsHandlersRope |
54 uGearsHedgehog, uGearsUtils, uGearsList, uGearsHandlersRope |
55 , uVisualGearsList, uGearsHandlersMess, uAI; |
55 , uVisualGearsList, uGearsHandlersMess, uAI; |
56 |
56 |
149 inc(tmp, 5); |
149 inc(tmp, 5); |
150 if (GameFlags and gfResetHealth) <> 0 then |
150 if (GameFlags and gfResetHealth) <> 0 then |
151 dec(Gear^.Hedgehog^.InitialHealth, 5) |
151 dec(Gear^.Hedgehog^.InitialHealth, 5) |
152 end |
152 end |
153 end; |
153 end; |
154 if tmp > 0 then |
154 if tmp > 0 then |
155 begin |
155 begin |
156 inc(Gear^.Damage, min(tmp, max(0,Gear^.Health - 1 - Gear^.Damage))); |
156 inc(Gear^.Damage, min(tmp, max(0,Gear^.Health - 1 - Gear^.Damage))); |
157 HHHurt(Gear^.Hedgehog, dsPoison); |
157 HHHurt(Gear^.Hedgehog, dsPoison); |
158 end |
158 end |
159 end; |
159 end; |
170 ScriptCall('onGameTick'); |
170 ScriptCall('onGameTick'); |
171 if GameTicks mod 20 = 0 then ScriptCall('onGameTick20'); |
171 if GameTicks mod 20 = 0 then ScriptCall('onGameTick20'); |
172 if GameTicks = NewTurnTick then |
172 if GameTicks = NewTurnTick then |
173 begin |
173 begin |
174 ScriptCall('onNewTurn'); |
174 ScriptCall('onNewTurn'); |
175 {$IFDEF SDL13} |
175 {$IFDEF SDL2} |
176 uTouch.NewTurnBeginning(); |
176 uTouch.NewTurnBeginning(); |
177 {$ENDIF} |
177 {$ENDIF} |
178 end; |
178 end; |
179 |
179 |
180 PrvInactive:= AllInactive; |
180 PrvInactive:= AllInactive; |
199 |
199 |
200 if curHandledGear^.Message and gmDelete <> 0 then |
200 if curHandledGear^.Message and gmDelete <> 0 then |
201 DeleteGear(curHandledGear) |
201 DeleteGear(curHandledGear) |
202 else |
202 else |
203 begin |
203 begin |
204 if curHandledGear^.Message and gmRemoveFromList <> 0 then |
204 if curHandledGear^.Message and gmRemoveFromList <> 0 then |
205 begin |
205 begin |
206 RemoveGearFromList(curHandledGear); |
206 RemoveGearFromList(curHandledGear); |
207 // since I can't think of any good reason this would ever be separate from a remove from list, going to keep it inside this block |
207 // since I can't think of any good reason this would ever be separate from a remove from list, going to keep it inside this block |
208 if curHandledGear^.Message and gmAddToList <> 0 then InsertGearToList(curHandledGear); |
208 if curHandledGear^.Message and gmAddToList <> 0 then InsertGearToList(curHandledGear); |
209 curHandledGear^.Message:= curHandledGear^.Message and (not (gmRemoveFromList or gmAddToList)) |
209 curHandledGear^.Message:= curHandledGear^.Message and (not (gmRemoveFromList or gmAddToList)) |
302 begin |
302 begin |
303 SuddenDeath:= true; |
303 SuddenDeath:= true; |
304 if cHealthDecrease <> 0 then |
304 if cHealthDecrease <> 0 then |
305 begin |
305 begin |
306 SuddenDeathDmg:= true; |
306 SuddenDeathDmg:= true; |
307 |
307 |
308 // flash |
308 // flash |
309 ScreenFade:= sfFromWhite; |
309 ScreenFade:= sfFromWhite; |
310 ScreenFadeValue:= sfMax; |
310 ScreenFadeValue:= sfMax; |
311 ScreenFadeSpeed:= 1; |
311 ScreenFadeSpeed:= 1; |
312 |
312 |
313 ChangeToSDClouds; |
313 ChangeToSDClouds; |
314 ChangeToSDFlakes; |
314 ChangeToSDFlakes; |
315 SetSkyColor(SDSkyColor.r * (SDTint/255) / 255, SDSkyColor.g * (SDTint/255) / 255, SDSkyColor.b * (SDTint/255) / 255); |
315 SetSkyColor(SDSkyColor.r * (SDTint/255) / 255, SDSkyColor.g * (SDTint/255) / 255, SDSkyColor.b * (SDTint/255) / 255); |
316 Ammoz[amTardis].SkipTurns:= 9999; |
316 Ammoz[amTardis].SkipTurns:= 9999; |
317 Ammoz[amTardis].Probability:= 0; |
317 Ammoz[amTardis].Probability:= 0; |
417 end |
417 end |
418 end; |
418 end; |
419 |
419 |
420 if TurnTimeLeft > 0 then |
420 if TurnTimeLeft > 0 then |
421 if CurrentHedgehog^.Gear <> nil then |
421 if CurrentHedgehog^.Gear <> nil then |
422 if ((CurrentHedgehog^.Gear^.State and gstAttacking) = 0) and |
422 if ((CurrentHedgehog^.Gear^.State and gstAttacking) = 0) and |
423 not(isInMultiShoot and (CurrentHedgehog^.CurAmmoType in [amShotgun, amDEagle, amSniperRifle])) then |
423 not(isInMultiShoot and (CurrentHedgehog^.CurAmmoType in [amShotgun, amDEagle, amSniperRifle])) then |
424 begin |
424 begin |
425 if (TurnTimeLeft = 5000) |
425 if (TurnTimeLeft = 5000) |
426 and (cHedgehogTurnTime >= 10000) |
426 and (cHedgehogTurnTime >= 10000) |
427 and (not PlacingHogs) |
427 and (not PlacingHogs) |
516 t^.Health:= t^.Hedgehog^.InitialHealth; |
516 t^.Health:= t^.Hedgehog^.InitialHealth; |
517 RenderHealth(t^.Hedgehog^); |
517 RenderHealth(t^.Hedgehog^); |
518 end; |
518 end; |
519 t:= t^.NextGear |
519 t:= t^.NextGear |
520 end; |
520 end; |
521 |
521 |
522 if ((GameFlags and gfResetWeps) <> 0) and (not PlacingHogs) then |
522 if ((GameFlags and gfResetWeps) <> 0) and (not PlacingHogs) then |
523 ResetWeapons; |
523 ResetWeapons; |
524 |
524 |
525 if (GameFlags and gfResetHealth) <> 0 then |
525 if (GameFlags and gfResetHealth) <> 0 then |
526 for i:= 0 to Pred(TeamsCount) do |
526 for i:= 0 to Pred(TeamsCount) do |
747 function SpawnFakeCrateAt(x, y: LongInt; crate: TCrateType; explode: boolean; poison: boolean): PGear; |
747 function SpawnFakeCrateAt(x, y: LongInt; crate: TCrateType; explode: boolean; poison: boolean): PGear; |
748 begin |
748 begin |
749 FollowGear := AddGear(x, y, gtCase, 0, _0, _0, 0); |
749 FollowGear := AddGear(x, y, gtCase, 0, _0, _0, 0); |
750 cCaseFactor := 0; |
750 cCaseFactor := 0; |
751 FollowGear^.Pos := posCaseDummy; |
751 FollowGear^.Pos := posCaseDummy; |
752 |
752 |
753 if explode then |
753 if explode then |
754 FollowGear^.Pos := FollowGear^.Pos + posCaseExplode; |
754 FollowGear^.Pos := FollowGear^.Pos + posCaseExplode; |
755 if poison then |
755 if poison then |
756 FollowGear^.Pos := FollowGear^.Pos + posCasePoison; |
756 FollowGear^.Pos := FollowGear^.Pos + posCasePoison; |
757 |
757 |
850 if (x < 4) and (TeamsArray[t] <> nil) then |
850 if (x < 4) and (TeamsArray[t] <> nil) then |
851 begin |
851 begin |
852 // if team matches current hedgehog team, default to current hedgehog |
852 // if team matches current hedgehog team, default to current hedgehog |
853 if (i = 0) and (CurrentHedgehog <> nil) and (CurrentHedgehog^.Team = TeamsArray[t]) then |
853 if (i = 0) and (CurrentHedgehog <> nil) and (CurrentHedgehog^.Team = TeamsArray[t]) then |
854 hh:= CurrentHedgehog |
854 hh:= CurrentHedgehog |
855 else |
855 else |
856 begin |
856 begin |
857 // otherwise use the first living hog or the hog amongs the remaining ones indicated by i |
857 // otherwise use the first living hog or the hog amongs the remaining ones indicated by i |
858 j:= 0; |
858 j:= 0; |
859 c:= 0; |
859 c:= 0; |
860 while (j <= cMaxHHIndex) and (hh = nil) do |
860 while (j <= cMaxHHIndex) and (hh = nil) do |