78 *) |
78 *) |
79 dx:= hwSign(Gear^.dX) * m * Sin(Gear^.Angle * pi / cMaxAngle); |
79 dx:= hwSign(Gear^.dX) * m * Sin(Gear^.Angle * pi / cMaxAngle); |
80 dy:= -Cos(Gear^.Angle * pi / cMaxAngle); |
80 dy:= -Cos(Gear^.Angle * pi / cMaxAngle); |
81 if cLaserSighting then |
81 if cLaserSighting then |
82 begin |
82 begin |
83 lx:= hwRound(Gear^.X) + GetLaunchX(HH^.Ammo^[HH^.CurSlot, HH^.CurAmmo].AmmoType, hwSign(Gear^.dX), Gear^.Angle); |
83 lx:= GetLaunchX(HH^.Ammo^[HH^.CurSlot, HH^.CurAmmo].AmmoType, hwSign(Gear^.dX) * m, Gear^.Angle); |
84 ly:= hwRound(Gear^.Y) + GetLaunchY(HH^.Ammo^[HH^.CurSlot, HH^.CurAmmo].AmmoType, Gear^.Angle); |
84 ly:= GetLaunchY(HH^.Ammo^[HH^.CurSlot, HH^.CurAmmo].AmmoType, Gear^.Angle); |
85 |
85 |
|
86 // ensure we start outside the hedgehog (he's solid after all) |
|
87 while abs(lx * lx + ly * ly) < (Gear^.radius * Gear^.radius) do |
|
88 begin |
|
89 lx:= lx + dx; |
|
90 ly:= ly + dy |
|
91 end; |
|
92 |
|
93 // add hog's position |
|
94 lx:= lx + hwRound(Gear^.X); |
|
95 ly:= ly + hwRound(Gear^.Y); |
|
96 |
|
97 // decrease number of iterations required |
86 ax:= dx * 4; |
98 ax:= dx * 4; |
87 ay:= dy * 4; |
99 ay:= dy * 4; |
88 |
100 |
89 tx:= round(lx); |
101 tx:= round(lx); |
90 ty:= round(ly); |
102 ty:= round(ly); |
91 hx:= tx; |
103 hx:= tx; |
92 hy:= ty; |
104 hy:= ty; |
93 while ((ty and LAND_HEIGHT_MASK) = 0) and |
105 while ((ty and LAND_HEIGHT_MASK) = 0) and |
94 ((tx and LAND_WIDTH_MASK) = 0) and |
106 ((tx and LAND_WIDTH_MASK) = 0) and |
95 (Land[ty, tx] = 0) do |
107 (Land[ty, tx] = 0) do // TODO: check for constant variable instead |
96 begin |
108 begin |
97 lx:= lx + ax; |
109 lx:= lx + ax; |
98 ly:= ly + ay; |
110 ly:= ly + ay; |
99 tx:= round(lx); |
111 tx:= round(lx); |
100 ty:= round(ly) |
112 ty:= round(ly) |
126 glEnable(GL_TEXTURE_2D); |
138 glEnable(GL_TEXTURE_2D); |
127 glDisable(GL_LINE_SMOOTH); |
139 glDisable(GL_LINE_SMOOTH); |
128 end; |
140 end; |
129 end; |
141 end; |
130 // draw crosshair |
142 // draw crosshair |
131 cx:= Round(hwRound(Gear^.X) + dx * 80 + GetLaunchX(HH^.Ammo^[HH^.CurSlot, HH^.CurAmmo].AmmoType, hwSign(Gear^.dX), Gear^.Angle)); |
143 cx:= Round(hwRound(Gear^.X) + dx * 80 + GetLaunchX(HH^.Ammo^[HH^.CurSlot, HH^.CurAmmo].AmmoType, hwSign(Gear^.dX) * m, Gear^.Angle)); |
132 cy:= Round(hwRound(Gear^.Y) + dy * 80 + GetLaunchY(HH^.Ammo^[HH^.CurSlot, HH^.CurAmmo].AmmoType, Gear^.Angle)); |
144 cy:= Round(hwRound(Gear^.Y) + dy * 80 + GetLaunchY(HH^.Ammo^[HH^.CurSlot, HH^.CurAmmo].AmmoType, Gear^.Angle)); |
133 DrawRotatedTex(HH^.Team^.CrosshairTex, |
145 DrawRotatedTex(HH^.Team^.CrosshairTex, |
134 12, 12, cx + WorldDx, cy + WorldDy, 0, |
146 12, 12, cx + WorldDx, cy + WorldDy, 0, |
135 hwSign(Gear^.dX) * (Gear^.Angle * 180.0) / cMaxAngle); |
147 hwSign(Gear^.dX) * (Gear^.Angle * 180.0) / cMaxAngle); |
136 end; |
148 end; |
137 hx:= hwRound(Gear^.X) + 8 * hwSign(Gear^.dX) + WorldDx; |
149 hx:= hwRound(Gear^.X) + 8 * hwSign(Gear^.dX) + WorldDx; |
138 hy:= hwRound(Gear^.Y) - 2 + WorldDy; |
150 hy:= hwRound(Gear^.Y) - 2 + WorldDy; |
139 aangle:= Gear^.Angle * 180 / cMaxAngle - 90; |
151 aangle:= Gear^.Angle * 180 / cMaxAngle - 90; |
140 |
|
141 if CurAmmoGear <> nil then |
152 if CurAmmoGear <> nil then |
142 begin |
153 begin |
143 case CurAmmoGear^.Kind of |
154 case CurAmmoGear^.Kind of |
144 gtShotgunShot: begin |
155 gtShotgunShot: begin |
145 if (CurAmmoGear^.State and gstAnimation <> 0) then |
156 if (CurAmmoGear^.State and gstAnimation <> 0) then |