19 {$INCLUDE "options.inc"} |
19 {$INCLUDE "options.inc"} |
20 |
20 |
21 unit uGearsRender; |
21 unit uGearsRender; |
22 |
22 |
23 interface |
23 interface |
24 uses uTypes, uConsts, GLunit, uFloat, SDLh; |
24 uses uTypes, uConsts, GLunit, uFloat, SDLh, uRandom; |
25 |
25 |
26 procedure RenderGear(Gear: PGear; x, y: LongInt); |
26 procedure RenderGear(Gear: PGear; x, y: LongInt); |
27 |
27 |
28 var RopePoints: record |
28 var RopePoints: record |
29 Count: Longword; |
29 Count: Longword; |
285 *) |
285 *) |
286 dx:= sign * m * Sin(Gear^.Angle * pi / cMaxAngle); |
286 dx:= sign * m * Sin(Gear^.Angle * pi / cMaxAngle); |
287 dy:= -Cos(Gear^.Angle * pi / cMaxAngle); |
287 dy:= -Cos(Gear^.Angle * pi / cMaxAngle); |
288 if cLaserSighting then |
288 if cLaserSighting then |
289 begin |
289 begin |
|
290 GetRandom(2); // no, this does not prevent it, just makes things harder |
290 lx:= GetLaunchX(HH^.CurAmmoType, sign * m, Gear^.Angle); |
291 lx:= GetLaunchX(HH^.CurAmmoType, sign * m, Gear^.Angle); |
291 ly:= GetLaunchY(HH^.CurAmmoType, Gear^.Angle); |
292 ly:= GetLaunchY(HH^.CurAmmoType, Gear^.Angle); |
292 |
293 |
293 // ensure we start outside the hedgehog (he's solid after all) |
294 // ensure we start outside the hedgehog (he's solid after all) |
294 while abs(lx * lx + ly * ly) < (Gear^.radius * Gear^.radius) do |
295 while abs(lx * lx + ly * ly) < (Gear^.radius * Gear^.radius) do |
1211 if Gear^.Target.X <> NoPointX then |
1212 if Gear^.Target.X <> NoPointX then |
1212 DrawLine(Gear^.Target.X, Gear^.Target.Y, hwRound(HHGear^.X), hwRound(HHGear^.Y), 4.0, i, i, $FF, $40) |
1213 DrawLine(Gear^.Target.X, Gear^.Target.Y, hwRound(HHGear^.X), hwRound(HHGear^.Y), 4.0, i, i, $FF, $40) |
1213 else DrawLine(hwRound(HHGear^.X), hwRound(HHGear^.Y), hwRound(Gear^.X), hwRound(Gear^.Y), 4.0, i, i, $FF, $40); |
1214 else DrawLine(hwRound(HHGear^.X), hwRound(HHGear^.Y), hwRound(Gear^.X), hwRound(Gear^.Y), 4.0, i, i, $FF, $40); |
1214 end |
1215 end |
1215 end |
1216 end |
1216 end |
1217 end; |
1217 |
1218 gtGenericFaller: DrawCircle(x, y, 3, 3, $FF, $00, $00, $FF); // debug |
1218 |
|
1219 end; |
1219 end; |
1220 if Gear^.RenderTimer and (Gear^.Tex <> nil) then |
1220 if Gear^.RenderTimer and (Gear^.Tex <> nil) then |
1221 DrawTextureCentered(x + 8, y + 8, Gear^.Tex); |
1221 DrawTextureCentered(x + 8, y + 8, Gear^.Tex); |
1222 end; |
1222 end; |
1223 |
1223 |