27 procedure HedgehogStep(Gear: PGear); |
27 procedure HedgehogStep(Gear: PGear); |
28 procedure doStepHedgehogMoving(Gear: PGear); |
28 procedure doStepHedgehogMoving(Gear: PGear); |
29 procedure HedgehogChAngle(HHGear: PGear); |
29 procedure HedgehogChAngle(HHGear: PGear); |
30 procedure PickUp(HH, Gear: PGear); |
30 procedure PickUp(HH, Gear: PGear); |
31 procedure AddPickup(HH: THedgehog; ammo: TAmmoType; cnt, X, Y: LongWord); |
31 procedure AddPickup(HH: THedgehog; ammo: TAmmoType; cnt, X, Y: LongWord); |
|
32 procedure CheckIce(Gear: PGear); inline; |
32 |
33 |
33 implementation |
34 implementation |
34 uses uConsts, uVariables, uFloat, uAmmos, uSound, uCaptions, |
35 uses uConsts, uVariables, uFloat, uAmmos, uSound, uCaptions, |
35 uCommands, uLocale, uUtils, uVisualGears, uStats, uIO, uScript, |
36 uCommands, uLocale, uUtils, uVisualGears, uStats, uIO, uScript, |
36 uGearsList, uGears, uCollisions, uRandom, uStore, uTeams, |
37 uGearsList, uGears, uCollisions, uRandom, uStore, uTeams, |
1211 end; |
1212 end; |
1212 |
1213 |
1213 AllInactive:= false |
1214 AllInactive:= false |
1214 end; |
1215 end; |
1215 |
1216 |
1216 //////////////////////////////////////////////////////////////////////////////// |
1217 procedure CheckIce(Gear: PGear); inline; |
1217 procedure doStepHedgehog(Gear: PGear); |
|
1218 (* |
1218 (* |
1219 var x,y,tx,ty: LongInt; |
1219 var x,y,tx,ty: LongInt; |
1220 tdX, tdY, slope: hwFloat; |
1220 tdX, tdY, slope: hwFloat; |
1221 land: Word; *) |
1221 land: Word; *) |
1222 var slope: hwFloat; |
1222 var slope: hwFloat; |
1223 begin |
1223 begin |
1224 CheckSum:= CheckSum xor Gear^.Hedgehog^.BotLevel; |
1224 if (Gear^.Message and (gmAllStoppable or gmLJump or gmHJump) = 0) |
1225 if (Gear^.Message and gmDestroy) <> 0 then |
1225 and (Gear^.State and (gstHHJumping or gstHHHJump or gstAttacking) = 0) |
1226 begin |
1226 and (not Gear^.dY.isNegative) and (TestCollisionYwithGear(Gear, 1) and lfIce <> 0) then |
1227 DeleteGear(Gear); |
1227 begin |
1228 exit |
1228 slope:= CalcSlopeBelowGear(Gear); |
1229 end; |
1229 if slope.QWordValue > 730144440 then // ignore mild slopes |
1230 if Gear^.Hedgehog^.Effects[heFrozen] > 0 then |
1230 begin |
1231 begin |
1231 Gear^.dX:=Gear^.dX+slope*cGravity*_256; |
1232 if Gear^.Hedgehog^.Effects[heFrozen] > 256 then |
1232 Gear^.State:= Gear^.State or gstMoving |
1233 dec(Gear^.Hedgehog^.Effects[heFrozen]) |
1233 end |
1234 else if GameTicks mod 10 = 0 then |
1234 end; |
1235 dec(Gear^.Hedgehog^.Effects[heFrozen]) |
|
1236 end; |
|
1237 if (Gear^.State and gstHHDriven) = 0 then |
|
1238 doStepHedgehogFree(Gear) |
|
1239 else |
|
1240 begin |
|
1241 with Gear^.Hedgehog^ do |
|
1242 if Team^.hasGone then |
|
1243 TeamGoneEffect(Team^) |
|
1244 else |
|
1245 doStepHedgehogDriven(Gear) |
|
1246 end; |
|
1247 if (Gear^.Message and (gmAllStoppable or gmLJump or gmHJump) = 0) |
|
1248 and (Gear^.State and (gstHHJumping or gstHHHJump or gstAttacking) = 0) |
|
1249 and (not Gear^.dY.isNegative) and (GameTicks mod (100*LongWOrd(hwRound(cMaxWindSpeed*2/cGravity))) = 0) |
|
1250 and (TestCollisionYwithGear(Gear, 1) and lfIce <> 0) then |
|
1251 begin |
|
1252 slope:= CalcSlopeBelowGear(Gear); |
|
1253 Gear^.dX:=Gear^.dX+slope*_0_07; |
|
1254 if slope.QWordValue <> 0 then |
|
1255 Gear^.State:= Gear^.State or gstMoving; |
|
1256 (* |
1235 (* |
1257 x:= hwRound(Gear^.X); |
1236 x:= hwRound(Gear^.X); |
1258 y:= hwRound(Gear^.Y); |
1237 y:= hwRound(Gear^.Y); |
1259 AddVisualGear(x, y, vgtSmokeTrace); |
1238 AddVisualGear(x, y, vgtSmokeTrace); |
1260 AddVisualGear(x - hwRound(_5*slope), y + hwRound(_5*slope), vgtSmokeTrace); |
1239 AddVisualGear(x - hwRound(_5*slope), y + hwRound(_5*slope), vgtSmokeTrace); |
1265 AddVisualGear(x + hwRound(_30 * slope), y - hwRound(_30 * slope), vgtSmokeTrace); |
1244 AddVisualGear(x + hwRound(_30 * slope), y - hwRound(_30 * slope), vgtSmokeTrace); |
1266 AddVisualGear(x - hwRound(_40 * slope), y + hwRound(_40 * slope), vgtSmokeTrace); |
1245 AddVisualGear(x - hwRound(_40 * slope), y + hwRound(_40 * slope), vgtSmokeTrace); |
1267 AddVisualGear(x + hwRound(_40 * slope), y - hwRound(_40 * slope), vgtSmokeTrace); |
1246 AddVisualGear(x + hwRound(_40 * slope), y - hwRound(_40 * slope), vgtSmokeTrace); |
1268 AddVisualGear(x - hwRound(_50 * slope), y + hwRound(_50 * slope), vgtSmokeTrace); |
1247 AddVisualGear(x - hwRound(_50 * slope), y + hwRound(_50 * slope), vgtSmokeTrace); |
1269 AddVisualGear(x + hwRound(_50 * slope), y - hwRound(_50 * slope), vgtSmokeTrace); *) |
1248 AddVisualGear(x + hwRound(_50 * slope), y - hwRound(_50 * slope), vgtSmokeTrace); *) |
1270 end |
1249 end; |
|
1250 |
|
1251 //////////////////////////////////////////////////////////////////////////////// |
|
1252 procedure doStepHedgehog(Gear: PGear); |
|
1253 begin |
|
1254 CheckSum:= CheckSum xor Gear^.Hedgehog^.BotLevel; |
|
1255 if (Gear^.Message and gmDestroy) <> 0 then |
|
1256 begin |
|
1257 DeleteGear(Gear); |
|
1258 exit |
|
1259 end; |
|
1260 if (GameTicks mod (100*LongWord(hwRound(cMaxWindSpeed*2/cGravity))) = 0) then CheckIce(Gear); |
|
1261 if Gear^.Hedgehog^.Effects[heFrozen] > 0 then |
|
1262 begin |
|
1263 if Gear^.Hedgehog^.Effects[heFrozen] > 256 then |
|
1264 dec(Gear^.Hedgehog^.Effects[heFrozen]) |
|
1265 else if GameTicks mod 10 = 0 then |
|
1266 dec(Gear^.Hedgehog^.Effects[heFrozen]) |
|
1267 end; |
|
1268 if (Gear^.State and gstHHDriven) = 0 then |
|
1269 doStepHedgehogFree(Gear) |
|
1270 else |
|
1271 begin |
|
1272 with Gear^.Hedgehog^ do |
|
1273 if Team^.hasGone then |
|
1274 TeamGoneEffect(Team^) |
|
1275 else |
|
1276 doStepHedgehogDriven(Gear) |
|
1277 end; |
1271 end; |
1278 end; |
1272 |
1279 |
1273 end. |
1280 end. |