35 ar : array[0..MAXROPEPOINTS] of Tar; |
35 ar : array[0..MAXROPEPOINTS] of Tar; |
36 rounded : array[0..MAXROPEPOINTS + 2] of TVertex2f; |
36 rounded : array[0..MAXROPEPOINTS + 2] of TVertex2f; |
37 end; |
37 end; |
38 procedure RenderGear(Gear: PGear; x, y: LongInt); |
38 procedure RenderGear(Gear: PGear; x, y: LongInt); |
39 |
39 |
40 var RopePoints: TRopePoints; |
40 var RopePoints: record |
|
41 Count: Longword; |
|
42 HookAngle: GLfloat; |
|
43 ar: array[0..MAXROPEPOINTS] of record |
|
44 X, Y: hwFloat; |
|
45 dLen: hwFloat; |
|
46 b: boolean; |
|
47 sx, sy, sb: boolean; |
|
48 end; |
|
49 rounded: array[0..MAXROPEPOINTS + 2] of TVertex2f; |
|
50 end; |
41 |
51 |
42 implementation |
52 implementation |
43 uses uRender, uUtils, uVariables, uAmmos, Math, uVisualGears; |
53 uses uRender, uUtils, uVariables, uAmmos, Math, uVisualGears; |
44 |
54 |
45 const |
55 const |
213 sign, hx, hy, tx, ty, sx, sy, m: LongInt; // hedgehog, crosshair, temp, sprite, direction |
223 sign, hx, hy, tx, ty, sx, sy, m: LongInt; // hedgehog, crosshair, temp, sprite, direction |
214 dx, dy, ax, ay, aAngle, dAngle, hAngle, lx, ly: real; // laser, change |
224 dx, dy, ax, ay, aAngle, dAngle, hAngle, lx, ly: real; // laser, change |
215 defaultPos, HatVisible: boolean; |
225 defaultPos, HatVisible: boolean; |
216 HH: PHedgehog; |
226 HH: PHedgehog; |
217 CurWeapon: PAmmo; |
227 CurWeapon: PAmmo; |
|
228 iceOffset:Longint; |
|
229 r:TSDL_Rect; |
218 begin |
230 begin |
219 HH:= Gear^.Hedgehog; |
231 HH:= Gear^.Hedgehog; |
220 if HH^.Unplaced then |
232 if HH^.Unplaced then |
221 exit; |
233 exit; |
222 m:= 1; |
234 m:= 1; |
241 end; |
253 end; |
242 |
254 |
243 defaultPos:= true; |
255 defaultPos:= true; |
244 HatVisible:= false; |
256 HatVisible:= false; |
245 |
257 |
|
258 if HH^.Effects[heFrozen] > 0 then |
|
259 if HH^.Effects[heFrozen] < 150000 then |
|
260 begin |
|
261 DrawHedgehog(sx, sy, |
|
262 sign, |
|
263 0, |
|
264 0, |
|
265 0); |
|
266 defaultPos:= false; |
|
267 if HH^.Effects[heFrozen] < 256 then |
|
268 HatVisible:= true |
|
269 else HatVisible:= false |
|
270 end |
|
271 else |
|
272 begin |
|
273 DrawHedgehog(sx, sy, |
|
274 sign, |
|
275 2, |
|
276 4, |
|
277 0); |
|
278 defaultPos:= false; |
|
279 HatVisible:= false |
|
280 end; |
|
281 |
246 |
282 |
247 if HH^.Effects[hePoisoned] <> 0 then |
283 if HH^.Effects[hePoisoned] <> 0 then |
248 begin |
284 begin |
249 Tint($00, $FF, $40, $40); |
285 Tint($00, $FF, $40, $40); |
250 DrawTextureRotatedF(SpritesData[sprSmokeWhite].texture, 2, 0, 0, sx, sy, 0, 1, 22, 22, (RealTicks shr 36) mod 360); |
286 DrawTextureRotatedF(SpritesData[sprSmokeWhite].texture, 2, 0, 0, sx, sy, 0, 1, 22, 22, (RealTicks shr 36) mod 360); |
251 Tint($FF, $FF, $FF, $FF) |
287 Tint($FF, $FF, $FF, $FF) |
252 end; |
288 end; |
|
289 |
253 |
290 |
254 if ((Gear^.State and gstWinner) <> 0) and |
291 if ((Gear^.State and gstWinner) <> 0) and |
255 ((CurAmmoGear = nil) or (CurAmmoGear^.Kind <> gtPickHammer)) then |
292 ((CurAmmoGear = nil) or (CurAmmoGear^.Kind <> gtPickHammer)) then |
256 begin |
293 begin |
257 DrawHedgehog(sx, sy, |
294 DrawHedgehog(sx, sy, |
540 begin DrawSpriteRotated(sprHandBallgun, hx, hy, sign, aangle); |
577 begin DrawSpriteRotated(sprHandBallgun, hx, hy, sign, aangle); |
541 if CurAmmoGear^.Tex <> nil then |
578 if CurAmmoGear^.Tex <> nil then |
542 DrawTextureCentered(sx, sy - 40, CurAmmoGear^.Tex) |
579 DrawTextureCentered(sx, sy - 40, CurAmmoGear^.Tex) |
543 end; |
580 end; |
544 gtIceGun: |
581 gtIceGun: |
545 begin DrawSpriteRotated(sprHandBallgun, hx, hy, sign, aangle); |
582 begin DrawSpriteRotated(sprIceGun, hx, hy, sign, aangle); |
546 if CurAmmoGear^.Tex <> nil then |
583 if CurAmmoGear^.Tex <> nil then |
547 DrawTextureCentered(sx, sy - 40, CurAmmoGear^.Tex) |
584 DrawTextureCentered(sx, sy - 40, CurAmmoGear^.Tex) |
548 end; |
585 end; |
549 end; |
586 end; |
550 |
587 |
671 LongInt(leftX)+WorldDx) |
708 LongInt(leftX)+WorldDx) |
672 end; |
709 end; |
673 amBee: DrawSpriteRotatedF(sprHandBee, hx, hy, (RealTicks div 125) mod 4, sign, aangle); |
710 amBee: DrawSpriteRotatedF(sprHandBee, hx, hy, (RealTicks div 125) mod 4, sign, aangle); |
674 amFlamethrower: DrawSpriteRotatedF(sprHandFlamethrower, hx, hy, (RealTicks div 125) mod 4, sign, aangle); |
711 amFlamethrower: DrawSpriteRotatedF(sprHandFlamethrower, hx, hy, (RealTicks div 125) mod 4, sign, aangle); |
675 amLandGun: DrawSpriteRotated(sprHandBallgun, hx, hy, sign, aangle); |
712 amLandGun: DrawSpriteRotated(sprHandBallgun, hx, hy, sign, aangle); |
676 amIceGun: DrawSpriteRotated(sprHandBallgun, hx, hy, sign, aangle); |
713 amIceGun: DrawSpriteRotated(sprIceGun, hx, hy, sign, aangle); |
677 amResurrector: DrawCircle(ox, oy, 98, 4, $F5, $DB, $35, $AA); // I'd rather not like to hardcode 100 here |
714 amResurrector: DrawCircle(ox, oy, 98, 4, $F5, $DB, $35, $AA); // I'd rather not like to hardcode 100 here |
678 end; |
715 end; |
679 |
716 |
680 case amt of |
717 case amt of |
681 amAirAttack, |
718 amAirAttack, |
919 if Gear^.Invulnerable then |
956 if Gear^.Invulnerable then |
920 begin |
957 begin |
921 Tint($FF, $FF, $FF, max($40, round($FF * abs(1 - ((RealTicks div 2 + Gear^.uid * 491) mod 1500) / 750)))); |
958 Tint($FF, $FF, $FF, max($40, round($FF * abs(1 - ((RealTicks div 2 + Gear^.uid * 491) mod 1500) / 750)))); |
922 DrawSprite(sprInvulnerable, sx - 24, sy - 24, 0); |
959 DrawSprite(sprInvulnerable, sx - 24, sy - 24, 0); |
923 end; |
960 end; |
|
961 |
|
962 if HH^.Effects[heFrozen] < 150000 then |
|
963 begin |
|
964 if HH^.Effects[heFrozen] < 150000 then |
|
965 Tint($FF, $FF, $FF, min(255,127+HH^.Effects[heFrozen] div 800)); |
|
966 |
|
967 iceOffset:= min(32, HH^.Effects[heFrozen] div 8); |
|
968 r.x := 128; |
|
969 r.y := 96 - iceOffset; |
|
970 r.w := 32; |
|
971 r.h := iceOffset; |
|
972 if sign = -1 then |
|
973 DrawTextureFromRectDir(sx + sign*2, sy+16-iceoffset, r.w, r.h, @r, HHTexture, sign) |
|
974 else |
|
975 DrawTextureFromRectDir(sx-16 + sign*2, sy+16-iceoffset, r.w, r.h, @r, HHTexture, sign); |
|
976 |
|
977 |
|
978 if HH^.Effects[heFrozen] < 150000 then |
|
979 Tint($FF, $FF, $FF, $FF); |
|
980 end; |
|
981 |
|
982 |
924 if cVampiric and |
983 if cVampiric and |
925 (CurrentHedgehog^.Gear <> nil) and |
984 (CurrentHedgehog^.Gear <> nil) and |
926 (CurrentHedgehog^.Gear = Gear) then |
985 (CurrentHedgehog^.Gear = Gear) then |
927 begin |
986 begin |
928 Tint($FF, 0, 0, max($40, round($FF * abs(1 - (RealTicks mod 1500) / 750)))); |
987 Tint($FF, 0, 0, max($40, round($FF * abs(1 - (RealTicks mod 1500) / 750)))); |
1230 end; |
1289 end; |
1231 if RealTicks mod 2 = 0 then |
1290 if RealTicks mod 2 = 0 then |
1232 begin |
1291 begin |
1233 i:= random(100)+100; |
1292 i:= random(100)+100; |
1234 if Gear^.Target.X <> NoPointX then |
1293 if Gear^.Target.X <> NoPointX then |
1235 DrawLine(Gear^.Target.X, Gear^.Target.Y, hwRound(HHGear^.X), hwRound(HHGear^.Y), 4.0, i, i, $FF, $40) |
1294 begin |
1236 else DrawLine(hwRound(HHGear^.X), hwRound(HHGear^.Y), hwRound(Gear^.X), hwRound(Gear^.Y), 4.0, i, i, $FF, $40); |
1295 DrawLine(Gear^.Target.X, Gear^.Target.Y, hwRound(HHGear^.X), hwRound(HHGear^.Y), 4.0, i, i, $FF, $40); |
|
1296 end |
|
1297 else |
|
1298 begin |
|
1299 DrawLine(hwRound(HHGear^.X), hwRound(HHGear^.Y), hwRound(Gear^.X), hwRound(Gear^.Y), 4.0, i, i, $FF, $40); |
|
1300 end; |
1237 end |
1301 end |
1238 end |
1302 end |
1239 end; |
1303 end; |
1240 gtGenericFaller: DrawCircle(x, y, 3, 3, $FF, $00, $00, $FF); // debug |
1304 gtGenericFaller: DrawCircle(x, y, 3, 3, $FF, $00, $00, $FF); // debug |
1241 end; |
1305 end; |