author  Wuzzy <Wuzzy2@mail.ru> 
Tue, 22 Jan 2019 18:17:19 +0100  
changeset 14663  fb73852e6f4d 
parent 14656  db05d9bf7466 
child 14736  8563cc40fc1e 
permissions  rwrr 
4976  1 
(* 
2 
* Hedgewars, a free turn based strategy game 

11046  3 
* Copyright (c) 20042015 Andrey Korotaev <unC0Rr@gmail.com> 
4976  4 
* 
5 
* This program is free software; you can redistribute it and/or modify 

6 
* it under the terms of the GNU General Public License as published by 

7 
* the Free Software Foundation; version 2 of the License 

8 
* 

10443
42dadeb6e8ae
Remove switching of hog's hat to chef. do it in draw instead.
nemo
parents:
10441
diff
changeset

9 
* This program is distributed in the hope that it will be useful, 
4976  10 
* but WITHOUT ANY WARRANTY; without even the implied warranty of 
11 
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 

12 
* GNU General Public License for more details. 

13 
* 

14 
* You should have received a copy of the GNU General Public License 

15 
* along with this program; if not, write to the Free Software 

10108
c68cf030eded
update FSF address. note: two sdl include files (by Sam Lantinga) still have the old FSF address in their copyright  but I ain't gonna touch their copyright headers
sheepluva
parents:
10082
diff
changeset

16 
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 021101301 USA 
4976  17 
*) 
18 

4388  19 
{$INCLUDE "options.inc"} 
4976  20 

4388  21 
unit uGearsRender; 
22 

23 
interface 

7671  24 
uses uTypes, uConsts, GLunit, uFloat, SDLh; 
4388  25 

8026
4a4f21070479
merge xymeng's gsoc engine with a few updates (and further checks on symbol definitions)
koda
parents:
7978
diff
changeset

26 
type 
10015  27 
Tar = record 
8330  28 
X, Y: hwFloat; 
29 
dLen: hwFloat; 

30 
b : boolean; 

31 
end; 

8026
4a4f21070479
merge xymeng's gsoc engine with a few updates (and further checks on symbol definitions)
koda
parents:
7978
diff
changeset

32 
TRopePoints = record 
8330  33 
Count : Longword; 
34 
HookAngle : GLfloat; 

35 
ar : array[0..MAXROPEPOINTS] of Tar; 

36 
rounded : array[0..MAXROPEPOINTS + 2] of TVertex2f; 

37 
end; 

4388  38 
procedure RenderGear(Gear: PGear; x, y: LongInt); 
12210
442bab755bb4
Render gear timers in front of water
Wuzzy <almikes@aol.com>
parents:
12193
diff
changeset

39 
procedure RenderGearTimer(Gear: PGear; x, y: LongInt); 
13634
73c2a669c1fd
Make sure gear fuel and alt weapon overlays are always drawn on top
Wuzzy <Wuzzy2@mail.ru>
parents:
13605
diff
changeset

40 
procedure RenderHHGuiExtras(Gear: PGear; ox, oy: LongInt); 
10866  41 
procedure DrawHHOrder(); 
4388  42 

43 
var RopePoints: record 

44 
Count: Longword; 

45 
HookAngle: GLfloat; 

46 
ar: array[0..MAXROPEPOINTS] of record 

6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6508
diff
changeset

47 
X, Y: hwFloat; 
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6508
diff
changeset

48 
dLen: hwFloat; 
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6508
diff
changeset

49 
b: boolean; 
8733
b6002f1956d5
Hard math to fix issue 571. Well, not really hard math,
unc0rr
parents:
8689
diff
changeset

50 
sx, sy, sb: boolean; 
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6508
diff
changeset

51 
end; 
4388  52 
rounded: array[0..MAXROPEPOINTS + 2] of TVertex2f; 
53 
end; 

54 

55 
implementation 

9285  56 
uses uRender, uUtils, uVariables, uAmmos, Math, uVisualGearsList; 
4388  57 

58 
procedure DrawRopeLinesRQ(Gear: PGear); 

10523
00ac079fa51f
fix some nasty rendering issues reported by Nexia  thanks a lot!
sheepluva
parents:
10443
diff
changeset

59 
var n: LongInt; 
4388  60 
begin 
61 
with RopePoints do 

62 
begin 

63 
rounded[Count].X:= hwRound(Gear^.X); 

64 
rounded[Count].Y:= hwRound(Gear^.Y); 

65 
rounded[Count + 1].X:= hwRound(Gear^.Hedgehog^.Gear^.X); 

66 
rounded[Count + 1].Y:= hwRound(Gear^.Hedgehog^.Gear^.Y); 

67 
end; 

68 

69 
if (RopePoints.Count > 0) or (Gear^.Elasticity.QWordValue > 0) then 

70 
begin 

10523
00ac079fa51f
fix some nasty rendering issues reported by Nexia  thanks a lot!
sheepluva
parents:
10443
diff
changeset

71 
EnableTexture(false); 
10848  72 

73 
Tint(Gear^.Tint shr 24 div 3, Gear^.Tint shr 16 and $FF div 3, Gear^.Tint shr 8 and $FF div 3, Gear^.Tint and $FF); 

10523
00ac079fa51f
fix some nasty rendering issues reported by Nexia  thanks a lot!
sheepluva
parents:
10443
diff
changeset

74 

00ac079fa51f
fix some nasty rendering issues reported by Nexia  thanks a lot!
sheepluva
parents:
10443
diff
changeset

75 
n:= RopePoints.Count + 2; 
00ac079fa51f
fix some nasty rendering issues reported by Nexia  thanks a lot!
sheepluva
parents:
10443
diff
changeset

76 

00ac079fa51f
fix some nasty rendering issues reported by Nexia  thanks a lot!
sheepluva
parents:
10443
diff
changeset

77 
SetVertexPointer(@RopePoints.rounded[0], n); 
4388  78 

10523
00ac079fa51f
fix some nasty rendering issues reported by Nexia  thanks a lot!
sheepluva
parents:
10443
diff
changeset

79 
openglPushMatrix(); 
00ac079fa51f
fix some nasty rendering issues reported by Nexia  thanks a lot!
sheepluva
parents:
10443
diff
changeset

80 
openglTranslatef(WorldDx, WorldDy, 0); 
4388  81 

10523
00ac079fa51f
fix some nasty rendering issues reported by Nexia  thanks a lot!
sheepluva
parents:
10443
diff
changeset

82 
glLineWidth(3.0 * cScaleFactor); 
00ac079fa51f
fix some nasty rendering issues reported by Nexia  thanks a lot!
sheepluva
parents:
10443
diff
changeset

83 
glDrawArrays(GL_LINE_STRIP, 0, n); 
10848  84 
Tint(Gear^.Tint); 
10264
cb4331b032f4
use cScaleFactor where I incorrectly used the variable zoom in the past. i was young and needed the money
sheepluva
parents:
10142
diff
changeset

85 
glLineWidth(2.0 * cScaleFactor); 
10523
00ac079fa51f
fix some nasty rendering issues reported by Nexia  thanks a lot!
sheepluva
parents:
10443
diff
changeset

86 
glDrawArrays(GL_LINE_STRIP, 0, n); 
4388  87 

9666
8dcb25112d96
 Bring back white dot in the center of crosshair. Crosshair is blurred now!
unc0rr
parents:
9655
diff
changeset

88 
untint; 
4388  89 

10523
00ac079fa51f
fix some nasty rendering issues reported by Nexia  thanks a lot!
sheepluva
parents:
10443
diff
changeset

90 
openglPopMatrix(); 
4388  91 

10523
00ac079fa51f
fix some nasty rendering issues reported by Nexia  thanks a lot!
sheepluva
parents:
10443
diff
changeset

92 
EnableTexture(true); 
4388  93 
end 
94 
end; 

95 

96 

6508
bf5db4517148
Fix regression from 6480 too. Extra assignments might make this slightly less efficient.
nemo
parents:
6490
diff
changeset

97 
function DrawRopeLine(X1, Y1, X2, Y2, roplen: LongInt): LongInt; 
6490  98 
var eX, eY, dX, dY: LongInt; 
99 
i, sX, sY, x, y, d: LongInt; 

100 
b: boolean; 

101 
begin 

4388  102 
if (X1 = X2) and (Y1 = Y2) then 
6490  103 
begin 
104 
//OutError('WARNING: zero length rope line!', false); 

10015  105 
DrawRopeLine:= 0; 
6490  106 
exit 
107 
end; 

4388  108 
eX:= 0; 
109 
eY:= 0; 

110 
dX:= X2  X1; 

111 
dY:= Y2  Y1; 

112 

6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6508
diff
changeset

113 
if (dX > 0) then 
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6508
diff
changeset

114 
sX:= 1 
4388  115 
else 
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6508
diff
changeset

116 
if (dX < 0) then 
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6508
diff
changeset

117 
begin 
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6508
diff
changeset

118 
sX:= 1; 
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6508
diff
changeset

119 
dX:= dX 
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6508
diff
changeset

120 
end 
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6508
diff
changeset

121 
else sX:= dX; 
4388  122 

8689  123 
if (dY > 0) then 
6490  124 
sY:= 1 
4388  125 
else 
6490  126 
if (dY < 0) then 
4388  127 
begin 
6490  128 
sY:= 1; 
129 
dY:= dY 

6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6508
diff
changeset

130 
end 
8689  131 
else 
6490  132 
sY:= dY; 
133 

6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6508
diff
changeset

134 
if (dX > dY) then 
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6508
diff
changeset

135 
d:= dX 
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6508
diff
changeset

136 
else 
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6508
diff
changeset

137 
d:= dY; 
6490  138 

139 
x:= X1; 

140 
y:= Y1; 

141 

142 
for i:= 0 to d do 

143 
begin 

144 
inc(eX, dX); 

145 
inc(eY, dY); 

146 
b:= false; 

147 
if (eX > d) then 

148 
begin 

149 
dec(eX, d); 

150 
inc(x, sX); 

151 
b:= true 

152 
end; 

153 
if (eY > d) then 

154 
begin 

155 
dec(eY, d); 

156 
inc(y, sY); 

157 
b:= true 

158 
end; 

159 
if b then 

160 
begin 

161 
inc(roplen); 

6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6508
diff
changeset

162 
if (roplen mod 4) = 0 then 
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6508
diff
changeset

163 
DrawSprite(sprRopeNode, x  2, y  2, 0) 
6490  164 
end 
6508
bf5db4517148
Fix regression from 6480 too. Extra assignments might make this slightly less efficient.
nemo
parents:
6490
diff
changeset

165 
end; 
10015  166 
DrawRopeLine:= roplen; 
6490  167 
end; 
168 

169 
procedure DrawRope(Gear: PGear); 

10562  170 
var roplen, i: LongInt; 
4388  171 
begin 
10682  172 
if Gear^.Hedgehog^.Gear = nil then exit; 
10848  173 
if (Gear^.Tag = 1) or ((cReducedQuality and rqSimpleRope) <> 0) then 
4388  174 
DrawRopeLinesRQ(Gear) 
175 
else 

176 
begin 

177 
roplen:= 0; 

178 
if RopePoints.Count > 0 then 

179 
begin 

180 
i:= 0; 

181 
while i < Pred(RopePoints.Count) do 

182 
begin 

6508
bf5db4517148
Fix regression from 6480 too. Extra assignments might make this slightly less efficient.
nemo
parents:
6490
diff
changeset

183 
roplen:= DrawRopeLine(hwRound(RopePoints.ar[i].X) + WorldDx, hwRound(RopePoints.ar[i].Y) + WorldDy, 
6490  184 
hwRound(RopePoints.ar[Succ(i)].X) + WorldDx, hwRound(RopePoints.ar[Succ(i)].Y) + WorldDy, roplen); 
4388  185 
inc(i) 
186 
end; 

6508
bf5db4517148
Fix regression from 6480 too. Extra assignments might make this slightly less efficient.
nemo
parents:
6490
diff
changeset

187 
roplen:= DrawRopeLine(hwRound(RopePoints.ar[i].X) + WorldDx, hwRound(RopePoints.ar[i].Y) + WorldDy, 
6490  188 
hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, roplen); 
6508
bf5db4517148
Fix regression from 6480 too. Extra assignments might make this slightly less efficient.
nemo
parents:
6490
diff
changeset

189 
roplen:= DrawRopeLine(hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, 
6490  190 
hwRound(Gear^.Hedgehog^.Gear^.X) + WorldDx, hwRound(Gear^.Hedgehog^.Gear^.Y) + WorldDy, roplen); 
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6508
diff
changeset

191 
end 
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6508
diff
changeset

192 
else 
4388  193 
if Gear^.Elasticity.QWordValue > 0 then 
6508
bf5db4517148
Fix regression from 6480 too. Extra assignments might make this slightly less efficient.
nemo
parents:
6490
diff
changeset

194 
roplen:= DrawRopeLine(hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, 
6490  195 
hwRound(Gear^.Hedgehog^.Gear^.X) + WorldDx, hwRound(Gear^.Hedgehog^.Gear^.Y) + WorldDy, roplen); 
4388  196 
end; 
197 

198 

199 
if RopePoints.Count > 0 then 

6999  200 
DrawSpriteRotated(sprRopeHook, hwRound(RopePoints.ar[0].X) + WorldDx, hwRound(RopePoints.ar[0].Y) + WorldDy, 1, RopePoints.HookAngle) 
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6508
diff
changeset

201 
else 
4388  202 
if Gear^.Elasticity.QWordValue > 0 then 
6999  203 
DrawSpriteRotated(sprRopeHook, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, 0, DxDy2Angle(Gear^.dY, Gear^.dX)); 
4388  204 
end; 
205 

206 

207 
procedure DrawAltWeapon(Gear: PGear; sx, sy: LongInt); 

208 
begin 

209 
with Gear^.Hedgehog^ do 

210 
begin 

211 
if not (((Ammoz[CurAmmoType].Ammo.Propz and ammoprop_AltUse) <> 0) and ((Gear^.State and gstAttacked) = 0)) then 

212 
exit; 

213 
DrawTexture(sx + 16, sy + 16, ropeIconTex); 

214 
DrawTextureF(SpritesData[sprAMAmmos].Texture, 0.75, sx + 30, sy + 30, ord(CurAmmoType)  1, 1, 32, 32); 

215 
end; 

216 
end; 

217 

10866  218 
procedure DrawHHOrder(); 
219 
var HHGear: PGear; 

220 
hh: PHedgehog; 

221 
c, i, t, x, y, sprH, sprW, fSprOff: LongInt; 

222 
begin 

223 
t:= LocalTeam; 

224 

13838
2b6702777c8c
Backed out changeset 6e4e745f42bb. Devs are hating it for ... reasons
Wuzzy <Wuzzy2@mail.ru>
parents:
13837
diff
changeset

225 
if not CurrentTeam^.ExtDriven then 
10866  226 
for i:= 0 to Pred(TeamsCount) do 
227 
if (TeamsArray[i] = CurrentTeam) then 

228 
t:= i; 

229 

10867
36ca7a39f34d
fix segfault caused by last commit if spectating
sheepluva
parents:
10866
diff
changeset

230 
if t < 0 then 
36ca7a39f34d
fix segfault caused by last commit if spectating
sheepluva
parents:
10866
diff
changeset

231 
exit; 
36ca7a39f34d
fix segfault caused by last commit if spectating
sheepluva
parents:
10866
diff
changeset

232 

10866  233 
if TeamsArray[t] <> nil then 
234 
begin 

235 
sprH:= SpritesData[sprBigDigit].Height; 

236 
sprW:= SpritesData[sprBigDigit].Width; 

237 
fSprOff:= sprW div 4 + SpritesData[sprFrame].Width div 4  1; //  1 for overlap to avoid artifacts 

238 
i:= 0; 

239 
c:= 0; 

240 
repeat 

241 
hh:= @TeamsArray[t]^.Hedgehogs[i]; 

242 
inc(i); 

243 
if (hh <> nil) and (hh^.Gear <> nil) then 

244 
begin 

245 
inc(c); 

246 
HHGear:= hh^.Gear; 

247 
x:= hwRound(HHGear^.X) + WorldDx; 

248 
y:= hwRound(HHGear^.Y) + WorldDy  2; 

10992  249 
DrawTextureF(SpritesData[sprFrame].Texture, 0.5, x  fSprOff, y, 0, 1, SpritesData[sprFrame].Width, SpritesData[sprFrame].Height); 
250 
DrawTextureF(SpritesData[sprFrame].Texture, 0.5, x + fSprOff, y, 1, 1, SpritesData[sprFrame].Width, SpritesData[sprFrame].Height); 

251 
DrawTextureF(SpritesData[sprBigDigit].Texture, 0.5, x, y, c, 1, sprW, sprH); 

252 
if SpeechHogNumber = c then 

10869  253 
DrawCircle(x, y, 20, 3, 0, $FF, $FF, $80); 
10866  254 
end; 
255 
until (i > cMaxHHIndex); 

256 
end 

257 

258 
end; 

259 

13634
73c2a669c1fd
Make sure gear fuel and alt weapon overlays are always drawn on top
Wuzzy <Wuzzy2@mail.ru>
parents:
13605
diff
changeset

260 
// Render some informational GUI next to hedgehog, like fuel and alternate weapon 
73c2a669c1fd
Make sure gear fuel and alt weapon overlays are always drawn on top
Wuzzy <Wuzzy2@mail.ru>
parents:
13605
diff
changeset

261 
procedure RenderHHGuiExtras(Gear: PGear; ox, oy: LongInt); 
73c2a669c1fd
Make sure gear fuel and alt weapon overlays are always drawn on top
Wuzzy <Wuzzy2@mail.ru>
parents:
13605
diff
changeset

262 
var HH: PHedgehog; 
14655
bf37a416ad8f
Move finger rendering to RenderHHGuiExtras
Wuzzy <Wuzzy2@mail.ru>
parents:
14598
diff
changeset

263 
sx, sy, tx, ty, t, sign, m: LongInt; 
bf37a416ad8f
Move finger rendering to RenderHHGuiExtras
Wuzzy <Wuzzy2@mail.ru>
parents:
14598
diff
changeset

264 
dAngle: real; 
13634
73c2a669c1fd
Make sure gear fuel and alt weapon overlays are always drawn on top
Wuzzy <Wuzzy2@mail.ru>
parents:
13605
diff
changeset

265 
begin 
73c2a669c1fd
Make sure gear fuel and alt weapon overlays are always drawn on top
Wuzzy <Wuzzy2@mail.ru>
parents:
13605
diff
changeset

266 
HH:= Gear^.Hedgehog; 
73c2a669c1fd
Make sure gear fuel and alt weapon overlays are always drawn on top
Wuzzy <Wuzzy2@mail.ru>
parents:
13605
diff
changeset

267 
sx:= ox + 1; // this offset is very common 
73c2a669c1fd
Make sure gear fuel and alt weapon overlays are always drawn on top
Wuzzy <Wuzzy2@mail.ru>
parents:
13605
diff
changeset

268 
sy:= oy  3; 
73c2a669c1fd
Make sure gear fuel and alt weapon overlays are always drawn on top
Wuzzy <Wuzzy2@mail.ru>
parents:
13605
diff
changeset

269 
if HH^.Unplaced then 
73c2a669c1fd
Make sure gear fuel and alt weapon overlays are always drawn on top
Wuzzy <Wuzzy2@mail.ru>
parents:
13605
diff
changeset

270 
exit; 
73c2a669c1fd
Make sure gear fuel and alt weapon overlays are always drawn on top
Wuzzy <Wuzzy2@mail.ru>
parents:
13605
diff
changeset

271 
if (Gear^.State and gstHHDeath) <> 0 then 
73c2a669c1fd
Make sure gear fuel and alt weapon overlays are always drawn on top
Wuzzy <Wuzzy2@mail.ru>
parents:
13605
diff
changeset

272 
exit; 
73c2a669c1fd
Make sure gear fuel and alt weapon overlays are always drawn on top
Wuzzy <Wuzzy2@mail.ru>
parents:
13605
diff
changeset

273 
if (Gear^.State and gstHHGone) <> 0 then 
73c2a669c1fd
Make sure gear fuel and alt weapon overlays are always drawn on top
Wuzzy <Wuzzy2@mail.ru>
parents:
13605
diff
changeset

274 
exit; 
14656
db05d9bf7466
Hide hog GUI extras in scripted cinematic, also suppress some voices
Wuzzy <Wuzzy2@mail.ru>
parents:
14655
diff
changeset

275 
if (CinematicScript) then 
db05d9bf7466
Hide hog GUI extras in scripted cinematic, also suppress some voices
Wuzzy <Wuzzy2@mail.ru>
parents:
14655
diff
changeset

276 
exit; 
13634
73c2a669c1fd
Make sure gear fuel and alt weapon overlays are always drawn on top
Wuzzy <Wuzzy2@mail.ru>
parents:
13605
diff
changeset

277 

14655
bf37a416ad8f
Move finger rendering to RenderHHGuiExtras
Wuzzy <Wuzzy2@mail.ru>
parents:
14598
diff
changeset

278 
// render finger (pointing arrow) 
bf37a416ad8f
Move finger rendering to RenderHHGuiExtras
Wuzzy <Wuzzy2@mail.ru>
parents:
14598
diff
changeset

279 
if bShowFinger and ((Gear^.State and gstHHDriven) <> 0) then 
bf37a416ad8f
Move finger rendering to RenderHHGuiExtras
Wuzzy <Wuzzy2@mail.ru>
parents:
14598
diff
changeset

280 
begin 
bf37a416ad8f
Move finger rendering to RenderHHGuiExtras
Wuzzy <Wuzzy2@mail.ru>
parents:
14598
diff
changeset

281 
ty := oy  32; 
bf37a416ad8f
Move finger rendering to RenderHHGuiExtras
Wuzzy <Wuzzy2@mail.ru>
parents:
14598
diff
changeset

282 
// move finger higher up if tags are above hog 
bf37a416ad8f
Move finger rendering to RenderHHGuiExtras
Wuzzy <Wuzzy2@mail.ru>
parents:
14598
diff
changeset

283 
if (cTagsMask and htTeamName) <> 0 then 
bf37a416ad8f
Move finger rendering to RenderHHGuiExtras
Wuzzy <Wuzzy2@mail.ru>
parents:
14598
diff
changeset

284 
ty := ty  HH^.Team^.NameTagTex^.h  2; 
bf37a416ad8f
Move finger rendering to RenderHHGuiExtras
Wuzzy <Wuzzy2@mail.ru>
parents:
14598
diff
changeset

285 
if (cTagsMask and htName) <> 0 then 
bf37a416ad8f
Move finger rendering to RenderHHGuiExtras
Wuzzy <Wuzzy2@mail.ru>
parents:
14598
diff
changeset

286 
ty := ty  HH^.NameTagTex^.h  2; 
bf37a416ad8f
Move finger rendering to RenderHHGuiExtras
Wuzzy <Wuzzy2@mail.ru>
parents:
14598
diff
changeset

287 
if (cTagsMask and htHealth) <> 0 then 
bf37a416ad8f
Move finger rendering to RenderHHGuiExtras
Wuzzy <Wuzzy2@mail.ru>
parents:
14598
diff
changeset

288 
ty := ty  HH^.HealthTagTex^.h  2; 
bf37a416ad8f
Move finger rendering to RenderHHGuiExtras
Wuzzy <Wuzzy2@mail.ru>
parents:
14598
diff
changeset

289 
tx := ox; 
bf37a416ad8f
Move finger rendering to RenderHHGuiExtras
Wuzzy <Wuzzy2@mail.ru>
parents:
14598
diff
changeset

290 

bf37a416ad8f
Move finger rendering to RenderHHGuiExtras
Wuzzy <Wuzzy2@mail.ru>
parents:
14598
diff
changeset

291 
// don't go offscreen 
bf37a416ad8f
Move finger rendering to RenderHHGuiExtras
Wuzzy <Wuzzy2@mail.ru>
parents:
14598
diff
changeset

292 
t:= 32; 
bf37a416ad8f
Move finger rendering to RenderHHGuiExtras
Wuzzy <Wuzzy2@mail.ru>
parents:
14598
diff
changeset

293 
tx := min(max(tx, ViewLeftX + t), ViewRightX  t); 
bf37a416ad8f
Move finger rendering to RenderHHGuiExtras
Wuzzy <Wuzzy2@mail.ru>
parents:
14598
diff
changeset

294 
ty := min(ty, ViewBottomY  96); 
bf37a416ad8f
Move finger rendering to RenderHHGuiExtras
Wuzzy <Wuzzy2@mail.ru>
parents:
14598
diff
changeset

295 
// don't overlap with HH or HH tags 
bf37a416ad8f
Move finger rendering to RenderHHGuiExtras
Wuzzy <Wuzzy2@mail.ru>
parents:
14598
diff
changeset

296 
if ty < ViewTopY + t then 
bf37a416ad8f
Move finger rendering to RenderHHGuiExtras
Wuzzy <Wuzzy2@mail.ru>
parents:
14598
diff
changeset

297 
begin 
bf37a416ad8f
Move finger rendering to RenderHHGuiExtras
Wuzzy <Wuzzy2@mail.ru>
parents:
14598
diff
changeset

298 
if abs(tx  ox) < abs(ty  oy) then 
bf37a416ad8f
Move finger rendering to RenderHHGuiExtras
Wuzzy <Wuzzy2@mail.ru>
parents:
14598
diff
changeset

299 
ty:= max(ViewTopY + t, oy + t) 
bf37a416ad8f
Move finger rendering to RenderHHGuiExtras
Wuzzy <Wuzzy2@mail.ru>
parents:
14598
diff
changeset

300 
else 
bf37a416ad8f
Move finger rendering to RenderHHGuiExtras
Wuzzy <Wuzzy2@mail.ru>
parents:
14598
diff
changeset

301 
ty:= max(ViewTopY + t, ty); 
bf37a416ad8f
Move finger rendering to RenderHHGuiExtras
Wuzzy <Wuzzy2@mail.ru>
parents:
14598
diff
changeset

302 
end; 
bf37a416ad8f
Move finger rendering to RenderHHGuiExtras
Wuzzy <Wuzzy2@mail.ru>
parents:
14598
diff
changeset

303 

bf37a416ad8f
Move finger rendering to RenderHHGuiExtras
Wuzzy <Wuzzy2@mail.ru>
parents:
14598
diff
changeset

304 
dAngle := DxDy2Angle(int2hwfloat(ty  oy), int2hwfloat(tx  ox)) + 90; 
bf37a416ad8f
Move finger rendering to RenderHHGuiExtras
Wuzzy <Wuzzy2@mail.ru>
parents:
14598
diff
changeset

305 

bf37a416ad8f
Move finger rendering to RenderHHGuiExtras
Wuzzy <Wuzzy2@mail.ru>
parents:
14598
diff
changeset

306 
Tint(HH^.Team^.Clan^.Color shl 8 or $FF); 
bf37a416ad8f
Move finger rendering to RenderHHGuiExtras
Wuzzy <Wuzzy2@mail.ru>
parents:
14598
diff
changeset

307 
DrawSpriteRotatedF(sprFinger, tx, ty, RealTicks div 32 mod 16, 1, dAngle); 
bf37a416ad8f
Move finger rendering to RenderHHGuiExtras
Wuzzy <Wuzzy2@mail.ru>
parents:
14598
diff
changeset

308 
untint; 
bf37a416ad8f
Move finger rendering to RenderHHGuiExtras
Wuzzy <Wuzzy2@mail.ru>
parents:
14598
diff
changeset

309 
end; 
bf37a416ad8f
Move finger rendering to RenderHHGuiExtras
Wuzzy <Wuzzy2@mail.ru>
parents:
14598
diff
changeset

310 

14553
5ae97eab70eb
Make sure to render crosshair above render
Wuzzy <Wuzzy2@mail.ru>
parents:
14552
diff
changeset

311 
// render crosshair 
14579
42f3d6860971
Fix crosshair sometimes not getting removed
Wuzzy <Wuzzy2@mail.ru>
parents:
14572
diff
changeset

312 
if (CrosshairGear <> nil) and (Gear = CrosshairGear) then 
14553
5ae97eab70eb
Make sure to render crosshair above render
Wuzzy <Wuzzy2@mail.ru>
parents:
14552
diff
changeset

313 
begin 
5ae97eab70eb
Make sure to render crosshair above render
Wuzzy <Wuzzy2@mail.ru>
parents:
14552
diff
changeset

314 
sign:= hwSign(Gear^.dX); 
5ae97eab70eb
Make sure to render crosshair above render
Wuzzy <Wuzzy2@mail.ru>
parents:
14552
diff
changeset

315 
m:= 1; 
5ae97eab70eb
Make sure to render crosshair above render
Wuzzy <Wuzzy2@mail.ru>
parents:
14552
diff
changeset

316 
if ((Gear^.State and gstHHHJump) <> 0) and (HH^.Effects[heArtillery] = 0) then 
5ae97eab70eb
Make sure to render crosshair above render
Wuzzy <Wuzzy2@mail.ru>
parents:
14552
diff
changeset

317 
m:= 1; 
5ae97eab70eb
Make sure to render crosshair above render
Wuzzy <Wuzzy2@mail.ru>
parents:
14552
diff
changeset

318 
setTintAdd(true); 
5ae97eab70eb
Make sure to render crosshair above render
Wuzzy <Wuzzy2@mail.ru>
parents:
14552
diff
changeset

319 
Tint(HH^.Team^.Clan^.Color shl 8 or $FF); 
5ae97eab70eb
Make sure to render crosshair above render
Wuzzy <Wuzzy2@mail.ru>
parents:
14552
diff
changeset

320 
DrawTextureRotated(CrosshairTexture, 
5ae97eab70eb
Make sure to render crosshair above render
Wuzzy <Wuzzy2@mail.ru>
parents:
14552
diff
changeset

321 
12, 12, CrosshairX + WorldDx, CrosshairY + WorldDy, 0, 
5ae97eab70eb
Make sure to render crosshair above render
Wuzzy <Wuzzy2@mail.ru>
parents:
14552
diff
changeset

322 
sign * m * (Gear^.Angle * 180.0) / cMaxAngle); 
5ae97eab70eb
Make sure to render crosshair above render
Wuzzy <Wuzzy2@mail.ru>
parents:
14552
diff
changeset

323 
untint; 
5ae97eab70eb
Make sure to render crosshair above render
Wuzzy <Wuzzy2@mail.ru>
parents:
14552
diff
changeset

324 
setTintAdd(false); 
5ae97eab70eb
Make sure to render crosshair above render
Wuzzy <Wuzzy2@mail.ru>
parents:
14552
diff
changeset

325 
end; 
5ae97eab70eb
Make sure to render crosshair above render
Wuzzy <Wuzzy2@mail.ru>
parents:
14552
diff
changeset

326 

5ae97eab70eb
Make sure to render crosshair above render
Wuzzy <Wuzzy2@mail.ru>
parents:
14552
diff
changeset

327 
// render gearrelated extras: alt weapon, fuel, other 
13634
73c2a669c1fd
Make sure gear fuel and alt weapon overlays are always drawn on top
Wuzzy <Wuzzy2@mail.ru>
parents:
13605
diff
changeset

328 
if ((Gear^.State and gstHHDriven) <> 0) and (CurAmmoGear <> nil) then 
73c2a669c1fd
Make sure gear fuel and alt weapon overlays are always drawn on top
Wuzzy <Wuzzy2@mail.ru>
parents:
13605
diff
changeset

329 
begin 
73c2a669c1fd
Make sure gear fuel and alt weapon overlays are always drawn on top
Wuzzy <Wuzzy2@mail.ru>
parents:
13605
diff
changeset

330 
case CurAmmoGear^.Kind of 
73c2a669c1fd
Make sure gear fuel and alt weapon overlays are always drawn on top
Wuzzy <Wuzzy2@mail.ru>
parents:
13605
diff
changeset

331 
gtJetpack: begin 
14552
05b929808585
Render contour of flying saucer is in (mostly) opaque
Wuzzy <Wuzzy2@mail.ru>
parents:
14395
diff
changeset

332 
// render jetpack contour if underwater 
05b929808585
Render contour of flying saucer is in (mostly) opaque
Wuzzy <Wuzzy2@mail.ru>
parents:
14395
diff
changeset

333 
if (((not SuddenDeathDmg) and (WaterOpacity > 179)) or (SuddenDeathDmg and (SDWaterOpacity > 179))) and 
05b929808585
Render contour of flying saucer is in (mostly) opaque
Wuzzy <Wuzzy2@mail.ru>
parents:
14395
diff
changeset

334 
((cWaterLine < (hwRound(Gear^.Y) + Gear^.Radius  16)) or 
05b929808585
Render contour of flying saucer is in (mostly) opaque
Wuzzy <Wuzzy2@mail.ru>
parents:
14395
diff
changeset

335 
((WorldEdge = weSea) and ((hwRound(Gear^.X) < LeftX) or (hwRound(Gear^.X) > RightX)))) then 
05b929808585
Render contour of flying saucer is in (mostly) opaque
Wuzzy <Wuzzy2@mail.ru>
parents:
14395
diff
changeset

336 
DrawSprite(sprJetpack, sx32, sy32, 4); 
13634
73c2a669c1fd
Make sure gear fuel and alt weapon overlays are always drawn on top
Wuzzy <Wuzzy2@mail.ru>
parents:
13605
diff
changeset

337 
if CurAmmoGear^.Tex <> nil then 
73c2a669c1fd
Make sure gear fuel and alt weapon overlays are always drawn on top
Wuzzy <Wuzzy2@mail.ru>
parents:
13605
diff
changeset

338 
DrawTextureCentered(sx, sy  40, CurAmmoGear^.Tex); 
73c2a669c1fd
Make sure gear fuel and alt weapon overlays are always drawn on top
Wuzzy <Wuzzy2@mail.ru>
parents:
13605
diff
changeset

339 
DrawAltWeapon(Gear, sx, sy); 
73c2a669c1fd
Make sure gear fuel and alt weapon overlays are always drawn on top
Wuzzy <Wuzzy2@mail.ru>
parents:
13605
diff
changeset

340 
end; 
73c2a669c1fd
Make sure gear fuel and alt weapon overlays are always drawn on top
Wuzzy <Wuzzy2@mail.ru>
parents:
13605
diff
changeset

341 
gtRope: DrawAltWeapon(Gear, sx, sy); 
73c2a669c1fd
Make sure gear fuel and alt weapon overlays are always drawn on top
Wuzzy <Wuzzy2@mail.ru>
parents:
13605
diff
changeset

342 
gtParachute: DrawAltWeapon(Gear, sx, sy); 
73c2a669c1fd
Make sure gear fuel and alt weapon overlays are always drawn on top
Wuzzy <Wuzzy2@mail.ru>
parents:
13605
diff
changeset

343 
gtLandGun: if CurAmmoGear^.Tex <> nil then 
73c2a669c1fd
Make sure gear fuel and alt weapon overlays are always drawn on top
Wuzzy <Wuzzy2@mail.ru>
parents:
13605
diff
changeset

344 
DrawTextureCentered(sx, sy  40, CurAmmoGear^.Tex); 
73c2a669c1fd
Make sure gear fuel and alt weapon overlays are always drawn on top
Wuzzy <Wuzzy2@mail.ru>
parents:
13605
diff
changeset

345 
gtFlamethrower: if CurAmmoGear^.Tex <> nil then 
73c2a669c1fd
Make sure gear fuel and alt weapon overlays are always drawn on top
Wuzzy <Wuzzy2@mail.ru>
parents:
13605
diff
changeset

346 
DrawTextureCentered(sx, sy  40, CurAmmoGear^.Tex); 
73c2a669c1fd
Make sure gear fuel and alt weapon overlays are always drawn on top
Wuzzy <Wuzzy2@mail.ru>
parents:
13605
diff
changeset

347 
gtIceGun: if CurAmmoGear^.Tex <> nil then 
73c2a669c1fd
Make sure gear fuel and alt weapon overlays are always drawn on top
Wuzzy <Wuzzy2@mail.ru>
parents:
13605
diff
changeset

348 
DrawTextureCentered(sx, sy  40, CurAmmoGear^.Tex); 
73c2a669c1fd
Make sure gear fuel and alt weapon overlays are always drawn on top
Wuzzy <Wuzzy2@mail.ru>
parents:
13605
diff
changeset

349 
end; 
73c2a669c1fd
Make sure gear fuel and alt weapon overlays are always drawn on top
Wuzzy <Wuzzy2@mail.ru>
parents:
13605
diff
changeset

350 
end; 
73c2a669c1fd
Make sure gear fuel and alt weapon overlays are always drawn on top
Wuzzy <Wuzzy2@mail.ru>
parents:
13605
diff
changeset

351 
end; 
4388  352 

353 
procedure DrawHH(Gear: PGear; ox, oy: LongInt); 

354 
var i, t: LongInt; 

355 
amt: TAmmoType; 

5615
104f69e798bb
changed aiming to be triggered when touching the crosshair
Xeli
parents:
5561
diff
changeset

356 
sign, hx, hy, tx, ty, sx, sy, m: LongInt; // hedgehog, crosshair, temp, sprite, direction 
4388  357 
dx, dy, ax, ay, aAngle, dAngle, hAngle, lx, ly: real; // laser, change 
13573
e896ff1b1d96
Make laser sight work properly through wrap world edge
Wuzzy <Wuzzy2@mail.ru>
parents:
13572
diff
changeset

358 
wraps: LongWord; // numbe of wraps for laser in world wrap 
13776
720dc03600c9
Fix engine crash when using lasersight outside the world bounds
alfadur
parents:
13634
diff
changeset

359 
defaultPos, HatVisible, inWorldBounds: boolean; 
4388  360 
HH: PHedgehog; 
361 
CurWeapon: PAmmo; 

8557  362 
iceOffset:Longint; 
363 
r:TSDL_Rect; 

10443
42dadeb6e8ae
Remove switching of hog's hat to chef. do it in draw instead.
nemo
parents:
10441
diff
changeset

364 
curhat: PTexture; 
4388  365 
begin 
366 
HH:= Gear^.Hedgehog; 

14579
42f3d6860971
Fix crosshair sometimes not getting removed
Wuzzy <Wuzzy2@mail.ru>
parents:
14572
diff
changeset

367 
CrosshairGear:= nil; 
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6508
diff
changeset

368 
if HH^.Unplaced then 
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6508
diff
changeset

369 
exit; 
10443
42dadeb6e8ae
Remove switching of hog's hat to chef. do it in draw instead.
nemo
parents:
10441
diff
changeset

370 
if (HH^.CurAmmoType = amKnife) and (HH = CurrentHedgehog) then 
42dadeb6e8ae
Remove switching of hog's hat to chef. do it in draw instead.
nemo
parents:
10441
diff
changeset

371 
curhat:= ChefHatTexture 
42dadeb6e8ae
Remove switching of hog's hat to chef. do it in draw instead.
nemo
parents:
10441
diff
changeset

372 
else curhat:= HH^.HatTex; 
4388  373 
m:= 1; 
13096
d78e65c66573
Add hedgehog effect heArtillery, allows to set perhedgehog artillery mode
Wuzzy <Wuzzy2@mail.ru>
parents:
12898
diff
changeset

374 
if ((Gear^.State and gstHHHJump) <> 0) and (HH^.Effects[heArtillery] = 0) then 
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6508
diff
changeset

375 
m:= 1; 
4388  376 
sx:= ox + 1; // this offset is very common 
377 
sy:= oy  3; 

378 
sign:= hwSign(Gear^.dX); 

379 

380 
if (Gear^.State and gstHHDeath) <> 0 then 

381 
begin 

382 
DrawSprite(sprHHDeath, ox  16, oy  26, Gear^.Pos); 

4810  383 
Tint(HH^.Team^.Clan^.Color shl 8 or $FF); 
4388  384 
DrawSprite(sprHHDeath, ox  16, oy  26, Gear^.Pos + 8); 
9666
8dcb25112d96
 Bring back white dot in the center of crosshair. Crosshair is blurred now!
unc0rr
parents:
9655
diff
changeset

385 
untint; 
4388  386 
exit 
387 
end 

388 
else if (Gear^.State and gstHHGone) <> 0 then 

389 
begin 

6999  390 
DrawSpriteRotatedF(sprTeleport, sx, sy, Gear^.Pos, sign, 0); 
4388  391 
exit 
392 
end; 

393 

394 
defaultPos:= true; 

395 
HatVisible:= false; 

396 

8560  397 
if HH^.Effects[heFrozen] > 0 then 
8656
a8282143a8df
use opacity to indicate thawing. not totally happy w/ effect, but argument was made to indicate some progress towards thaw. drop "exit" since it really wasn't helpful, and not rendering tags, was more annoying than fun.
nemo
parents:
8628
diff
changeset

398 
if HH^.Effects[heFrozen] < 150000 then 
8560  399 
begin 
400 
DrawHedgehog(sx, sy, 

401 
sign, 

402 
0, 

403 
0, 

404 
0); 

405 
defaultPos:= false; 

8656
a8282143a8df
use opacity to indicate thawing. not totally happy w/ effect, but argument was made to indicate some progress towards thaw. drop "exit" since it really wasn't helpful, and not rendering tags, was more annoying than fun.
nemo
parents:
8628
diff
changeset

406 
if HH^.Effects[heFrozen] < 256 then 
a8282143a8df
use opacity to indicate thawing. not totally happy w/ effect, but argument was made to indicate some progress towards thaw. drop "exit" since it really wasn't helpful, and not rendering tags, was more annoying than fun.
nemo
parents:
8628
diff
changeset

407 
HatVisible:= true 
a8282143a8df
use opacity to indicate thawing. not totally happy w/ effect, but argument was made to indicate some progress towards thaw. drop "exit" since it really wasn't helpful, and not rendering tags, was more annoying than fun.
nemo
parents:
8628
diff
changeset

408 
else HatVisible:= false 
8560  409 
end 
8689  410 
else 
8560  411 
begin 
412 
DrawHedgehog(sx, sy, 

413 
sign, 

414 
2, 

415 
4, 

416 
0); 

417 
defaultPos:= false; 

8656
a8282143a8df
use opacity to indicate thawing. not totally happy w/ effect, but argument was made to indicate some progress towards thaw. drop "exit" since it really wasn't helpful, and not rendering tags, was more annoying than fun.
nemo
parents:
8628
diff
changeset

418 
HatVisible:= false 
8560  419 
end; 
420 

4388  421 

7010
10a0a31804f3
Switch effects to longint for convenience of tracking ice states. I could add a new Hedgehog value, but since we have this effects list being all useless as booleans anyway...
nemo
parents:
6999
diff
changeset

422 
if HH^.Effects[hePoisoned] <> 0 then 
4388  423 
begin 
424 
Tint($00, $FF, $40, $40); 

10142  425 
DrawTextureRotatedF(SpritesData[sprSmokeWhite].texture, 2, 0, 0, sx, sy, 0, 1, 22, 22, (RealTicks shr 4) mod 360); 
9666
8dcb25112d96
 Bring back white dot in the center of crosshair. Crosshair is blurred now!
unc0rr
parents:
9655
diff
changeset

426 
untint 
4388  427 
end; 
428 

8557  429 

4388  430 
if ((Gear^.State and gstWinner) <> 0) and 
431 
((CurAmmoGear = nil) or (CurAmmoGear^.Kind <> gtPickHammer)) then 

432 
begin 

433 
DrawHedgehog(sx, sy, 

434 
sign, 

435 
2, 

436 
0, 

437 
0); 

438 
defaultPos:= false 

439 
end; 

440 
if (Gear^.State and gstDrowning) <> 0 then 

441 
begin 

442 
DrawHedgehog(sx, sy, 

443 
sign, 

444 
1, 

445 
7, 

446 
0); 

447 
defaultPos:= false 

448 
end else 

449 
if (Gear^.State and gstLoser) <> 0 then 

450 
begin 

451 
DrawHedgehog(sx, sy, 

452 
sign, 

453 
2, 

454 
3, 

455 
0); 

456 
defaultPos:= false 

457 
end else 

458 

459 
if (Gear^.State and gstHHDriven) <> 0 then 

460 
begin 

5145
120f4271f197
adjust crosshair criteria again. this should take care of sniper rifle and crosshair after attacking
nemo
parents:
5137
diff
changeset

461 
if ((Gear^.State and (gstHHThinking or gstAnimation)) = 0) and 
5136
948da1e50205
Fix a few crosshair bugs. Disable ShowCrosshair and just decide when drawing.
nemo
parents:
5041
diff
changeset

462 
/// If current ammo is active, and current ammo has alt attack and uses a crosshair (rope, basically, right now, with no crosshair for parachute/saucer 
14572
34e810295d08
Remove a bunch of dead outcommented code
Wuzzy <Wuzzy2@mail.ru>
parents:
14553
diff
changeset

463 
(((CurAmmoGear <> nil) and 
10390  464 
// don't render crosshair/laser during kamikaze 
465 
((CurAmmoGear^.AmmoType <> amKamikaze) or ((Gear^.State and gstAttacking) = 0)) and 

5136
948da1e50205
Fix a few crosshair bugs. Disable ShowCrosshair and just decide when drawing.
nemo
parents:
5041
diff
changeset

466 
((Ammoz[CurAmmoGear^.AmmoType].Ammo.Propz and ammoprop_NoCrossHair) = 0)) or 
948da1e50205
Fix a few crosshair bugs. Disable ShowCrosshair and just decide when drawing.
nemo
parents:
5041
diff
changeset

467 
/// If no current ammo is active, and the selected ammo uses a crosshair 
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6508
diff
changeset

468 
((CurAmmoGear = nil) and ((Ammoz[HH^.CurAmmoType].Ammo.Propz and ammoprop_NoCrosshair) = 0) and ((Gear^.State and gstAttacked) = 0))) then 
4388  469 
begin 
470 
(* These calculations are a little complex for a few reasons: 

471 
1: I need to draw the laser from weapon origin to nearest land 

472 
2: I need to start the beam outside the hedgie for attractiveness. 

473 
3: I need to extend the beam beyond land. 

474 
This routine perhaps should be pushed into uStore or somesuch instead of continuuing the increase in size of this function. 

475 
*) 

476 
dx:= sign * m * Sin(Gear^.Angle * pi / cMaxAngle); 

477 
dy:= Cos(Gear^.Angle * pi / cMaxAngle); 

12306
cdd884397760
Fix sniper rifle disabling laser sight utility after shooting
Wuzzy <almikes@aol.com>
parents:
12211
diff
changeset

478 
if cLaserSighting or cLaserSightingSniper then 
4388  479 
begin 
480 
lx:= GetLaunchX(HH^.CurAmmoType, sign * m, Gear^.Angle); 

481 
ly:= GetLaunchY(HH^.CurAmmoType, Gear^.Angle); 

482 

483 
// ensure we start outside the hedgehog (he's solid after all) 

484 
while abs(lx * lx + ly * ly) < (Gear^.radius * Gear^.radius) do 

485 
begin 

486 
lx:= lx + dx; 

487 
ly:= ly + dy 

488 
end; 

489 

490 
// add hog's position 

491 
lx:= lx + ox  WorldDx; 

492 
ly:= ly + oy  WorldDy; 

493 

494 
// decrease number of iterations required 

495 
ax:= dx * 4; 

496 
ay:= dy * 4; 

497 

498 
tx:= round(lx); 

499 
ty:= round(ly); 

500 
hx:= tx; 

501 
hy:= ty; 

13573
e896ff1b1d96
Make laser sight work properly through wrap world edge
Wuzzy <Wuzzy2@mail.ru>
parents:
13572
diff
changeset

502 
wraps:= 0; 
13776
720dc03600c9
Fix engine crash when using lasersight outside the world bounds
alfadur
parents:
13634
diff
changeset

503 
inWorldBounds := ((ty and LAND_HEIGHT_MASK) or (tx and LAND_WIDTH_MASK)) = 0; 
720dc03600c9
Fix engine crash when using lasersight outside the world bounds
alfadur
parents:
13634
diff
changeset

504 
while inWorldBounds and ((Land[ty, tx] and lfAll) = 0) do 
4388  505 
begin 
13573
e896ff1b1d96
Make laser sight work properly through wrap world edge
Wuzzy <Wuzzy2@mail.ru>
parents:
13572
diff
changeset

506 
if wraps > cMaxLaserSightWraps then 
e896ff1b1d96
Make laser sight work properly through wrap world edge
Wuzzy <Wuzzy2@mail.ru>
parents:
13572
diff
changeset

507 
break; 
4388  508 
lx:= lx + ax; 
509 
ly:= ly + ay; 

510 
tx:= round(lx); 

13573
e896ff1b1d96
Make laser sight work properly through wrap world edge
Wuzzy <Wuzzy2@mail.ru>
parents:
13572
diff
changeset

511 
ty:= round(ly); 
e896ff1b1d96
Make laser sight work properly through wrap world edge
Wuzzy <Wuzzy2@mail.ru>
parents:
13572
diff
changeset

512 
// reached edge of land. 
e896ff1b1d96
Make laser sight work properly through wrap world edge
Wuzzy <Wuzzy2@mail.ru>
parents:
13572
diff
changeset

513 
if ((ty and LAND_HEIGHT_MASK) <> 0) then 
e896ff1b1d96
Make laser sight work properly through wrap world edge
Wuzzy <Wuzzy2@mail.ru>
parents:
13572
diff
changeset

514 
begin 
e896ff1b1d96
Make laser sight work properly through wrap world edge
Wuzzy <Wuzzy2@mail.ru>
parents:
13572
diff
changeset

515 
// assume infinite beam. Extend it way out past camera 
e896ff1b1d96
Make laser sight work properly through wrap world edge
Wuzzy <Wuzzy2@mail.ru>
parents:
13572
diff
changeset

516 
tx:= round(lx + ax * (max(LAND_WIDTH,4096) div 2)); 
e896ff1b1d96
Make laser sight work properly through wrap world edge
Wuzzy <Wuzzy2@mail.ru>
parents:
13572
diff
changeset

517 
ty:= round(ly + ay * (max(LAND_WIDTH,4096) div 2)); 
e896ff1b1d96
Make laser sight work properly through wrap world edge
Wuzzy <Wuzzy2@mail.ru>
parents:
13572
diff
changeset

518 
break; 
e896ff1b1d96
Make laser sight work properly through wrap world edge
Wuzzy <Wuzzy2@mail.ru>
parents:
13572
diff
changeset

519 
end; 
e896ff1b1d96
Make laser sight work properly through wrap world edge
Wuzzy <Wuzzy2@mail.ru>
parents:
13572
diff
changeset

520 

e896ff1b1d96
Make laser sight work properly through wrap world edge
Wuzzy <Wuzzy2@mail.ru>
parents:
13572
diff
changeset

521 
if ((sign*m < 0) and (tx < LeftX)) or ((sign*m > 0) and (tx >= RightX)) then 
e896ff1b1d96
Make laser sight work properly through wrap world edge
Wuzzy <Wuzzy2@mail.ru>
parents:
13572
diff
changeset

522 
if (WorldEdge = weWrap) then 
e896ff1b1d96
Make laser sight work properly through wrap world edge
Wuzzy <Wuzzy2@mail.ru>
parents:
13572
diff
changeset

523 
// wrap beam 
e896ff1b1d96
Make laser sight work properly through wrap world edge
Wuzzy <Wuzzy2@mail.ru>
parents:
13572
diff
changeset

524 
begin 
e896ff1b1d96
Make laser sight work properly through wrap world edge
Wuzzy <Wuzzy2@mail.ru>
parents:
13572
diff
changeset

525 
if (sign*m) < 0 then 
e896ff1b1d96
Make laser sight work properly through wrap world edge
Wuzzy <Wuzzy2@mail.ru>
parents:
13572
diff
changeset

526 
lx:= RightX  (ax  (lx  LeftX)) 
e896ff1b1d96
Make laser sight work properly through wrap world edge
Wuzzy <Wuzzy2@mail.ru>
parents:
13572
diff
changeset

527 
else 
e896ff1b1d96
Make laser sight work properly through wrap world edge
Wuzzy <Wuzzy2@mail.ru>
parents:
13572
diff
changeset

528 
lx:= LeftX + (ax  (RightX  lx)); 
e896ff1b1d96
Make laser sight work properly through wrap world edge
Wuzzy <Wuzzy2@mail.ru>
parents:
13572
diff
changeset

529 
tx:= round(lx); 
e896ff1b1d96
Make laser sight work properly through wrap world edge
Wuzzy <Wuzzy2@mail.ru>
parents:
13572
diff
changeset

530 
inc(wraps); 
e896ff1b1d96
Make laser sight work properly through wrap world edge
Wuzzy <Wuzzy2@mail.ru>
parents:
13572
diff
changeset

531 
end 
e896ff1b1d96
Make laser sight work properly through wrap world edge
Wuzzy <Wuzzy2@mail.ru>
parents:
13572
diff
changeset

532 
else if (WorldEdge = weBounce) then 
e896ff1b1d96
Make laser sight work properly through wrap world edge
Wuzzy <Wuzzy2@mail.ru>
parents:
13572
diff
changeset

533 
// just stop 
e896ff1b1d96
Make laser sight work properly through wrap world edge
Wuzzy <Wuzzy2@mail.ru>
parents:
13572
diff
changeset

534 
break; 
e896ff1b1d96
Make laser sight work properly through wrap world edge
Wuzzy <Wuzzy2@mail.ru>
parents:
13572
diff
changeset

535 

e896ff1b1d96
Make laser sight work properly through wrap world edge
Wuzzy <Wuzzy2@mail.ru>
parents:
13572
diff
changeset

536 
if ((tx and LAND_WIDTH_MASK) <> 0) then 
e896ff1b1d96
Make laser sight work properly through wrap world edge
Wuzzy <Wuzzy2@mail.ru>
parents:
13572
diff
changeset

537 
begin 
e896ff1b1d96
Make laser sight work properly through wrap world edge
Wuzzy <Wuzzy2@mail.ru>
parents:
13572
diff
changeset

538 
if (WorldEdge <> weWrap) and (WorldEdge <> weBounce) then 
e896ff1b1d96
Make laser sight work properly through wrap world edge
Wuzzy <Wuzzy2@mail.ru>
parents:
13572
diff
changeset

539 
// assume infinite beam. Extend it way out past camera 
e896ff1b1d96
Make laser sight work properly through wrap world edge
Wuzzy <Wuzzy2@mail.ru>
parents:
13572
diff
changeset

540 
begin 
e896ff1b1d96
Make laser sight work properly through wrap world edge
Wuzzy <Wuzzy2@mail.ru>
parents:
13572
diff
changeset

541 
tx:= round(lx + ax * (max(LAND_WIDTH,4096) div 2)); 
e896ff1b1d96
Make laser sight work properly through wrap world edge
Wuzzy <Wuzzy2@mail.ru>
parents:
13572
diff
changeset

542 
ty:= round(ly + ay * (max(LAND_WIDTH,4096) div 2)); 
e896ff1b1d96
Make laser sight work properly through wrap world edge
Wuzzy <Wuzzy2@mail.ru>
parents:
13572
diff
changeset

543 
end; 
e896ff1b1d96
Make laser sight work properly through wrap world edge
Wuzzy <Wuzzy2@mail.ru>
parents:
13572
diff
changeset

544 
break; 
e896ff1b1d96
Make laser sight work properly through wrap world edge
Wuzzy <Wuzzy2@mail.ru>
parents:
13572
diff
changeset

545 
end; 
4388  546 
end; 
547 

13573
e896ff1b1d96
Make laser sight work properly through wrap world edge
Wuzzy <Wuzzy2@mail.ru>
parents:
13572
diff
changeset

548 
DrawLineWrapped(hx, hy, tx, ty, 1.0, (sign*m) < 0, wraps, $FF, $00, $00, $C0); 
4388  549 
end; 
14579
42f3d6860971
Fix crosshair sometimes not getting removed
Wuzzy <Wuzzy2@mail.ru>
parents:
14572
diff
changeset

550 

14553
5ae97eab70eb
Make sure to render crosshair above render
Wuzzy <Wuzzy2@mail.ru>
parents:
14552
diff
changeset

551 
// calculate crosshair position 
5615
104f69e798bb
changed aiming to be triggered when touching the crosshair
Xeli
parents:
5561
diff
changeset

552 
CrosshairX := Round(hwRound(Gear^.X) + dx * 80 + GetLaunchX(HH^.CurAmmoType, sign * m, Gear^.Angle)); 
104f69e798bb
changed aiming to be triggered when touching the crosshair
Xeli
parents:
5561
diff
changeset

553 
CrosshairY := Round(hwRound(Gear^.Y) + dy * 80 + GetLaunchY(HH^.CurAmmoType, Gear^.Angle)); 
14553
5ae97eab70eb
Make sure to render crosshair above render
Wuzzy <Wuzzy2@mail.ru>
parents:
14552
diff
changeset

554 
// crosshair will be rendered in RenderHHGuiExtras 
5ae97eab70eb
Make sure to render crosshair above render
Wuzzy <Wuzzy2@mail.ru>
parents:
14552
diff
changeset

555 
CrosshairGear := Gear; 
4388  556 
end; 
9666
8dcb25112d96
 Bring back white dot in the center of crosshair. Crosshair is blurred now!
unc0rr
parents:
9655
diff
changeset

557 

4388  558 
hx:= ox + 8 * sign; 
559 
hy:= oy  2; 

560 
aangle:= Gear^.Angle * 180 / cMaxAngle  90; 

5935  561 
if (CurAmmoGear <> nil) and (CurAmmoGear^.Kind <> gtTardis) then 
4388  562 
begin 
563 
case CurAmmoGear^.Kind of 

564 
gtShotgunShot: begin 

565 
if (CurAmmoGear^.State and gstAnimation <> 0) then 

6999  566 
DrawSpriteRotated(sprShotgun, hx, hy, sign, aangle) 
4388  567 
else 
6999  568 
DrawSpriteRotated(sprHandShotgun, hx, hy, sign, aangle); 
4388  569 
end; 
6999  570 
gtDEagleShot: DrawSpriteRotated(sprDEagle, hx, hy, sign, aangle); 
4388  571 
gtSniperRifleShot: begin 
572 
if (CurAmmoGear^.State and gstAnimation <> 0) then 

6999  573 
DrawSpriteRotatedF(sprSniperRifle, hx, hy, 1, sign, aangle) 
4388  574 
else 
6999  575 
DrawSpriteRotatedF(sprSniperRifle, hx, hy, 0, sign, aangle) 
4388  576 
end; 
6999  577 
gtBallgun: DrawSpriteRotated(sprHandBallgun, hx, hy, sign, aangle); 
4388  578 
gtRCPlane: begin 
6999  579 
DrawSpriteRotated(sprHandPlane, hx, hy, sign, 0); 
4388  580 
defaultPos:= false 
581 
end; 

582 
gtRope: begin 

583 
if Gear^.X < CurAmmoGear^.X then 

584 
begin 

585 
dAngle:= 0; 

586 
hAngle:= 180; 

587 
i:= 1 

6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6508
diff
changeset

588 
end 
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6508
diff
changeset

589 
else 
4388  590 
begin 
591 
dAngle:= 180; 

592 
hAngle:= 0; 

593 
i:= 1 

594 
end; 

7547  595 
if ((Gear^.State and gstWinner) = 0) then 
596 
begin 

597 
DrawHedgehog(ox, oy, 

598 
i, 

599 
1, 

600 
0, 

601 
DxDy2Angle(CurAmmoGear^.dY, CurAmmoGear^.dX) + dAngle); 

602 
with HH^ do 

10443
42dadeb6e8ae
Remove switching of hog's hat to chef. do it in draw instead.
nemo
parents:
10441
diff
changeset

603 
if (curhat <> nil) then 
4388  604 
begin 
10443
42dadeb6e8ae
Remove switching of hog's hat to chef. do it in draw instead.
nemo
parents:
10441
diff
changeset

605 
DrawTextureRotatedF(curhat, 1.0, 1.0, 6.0, ox, oy, 0, i, 32, 32, 
4388  606 
i*DxDy2Angle(CurAmmoGear^.dY, CurAmmoGear^.dX) + hAngle); 
13233
bb73d6d3348a
Fix simple team hats (32×64) not tinting correctly while on rope or using blowtorch
Wuzzy <Wuzzy2@mail.ru>
parents:
13214
diff
changeset

607 
if (curhat^.w > 64) or ((curhat^.w = 64) and (curhat^.h = 32)) then 
7547  608 
begin 
13233
bb73d6d3348a
Fix simple team hats (32×64) not tinting correctly while on rope or using blowtorch
Wuzzy <Wuzzy2@mail.ru>
parents:
13214
diff
changeset

609 
if ((curhat^.w = 64) and (curhat^.h = 32)) then 
bb73d6d3348a
Fix simple team hats (32×64) not tinting correctly while on rope or using blowtorch
Wuzzy <Wuzzy2@mail.ru>
parents:
13214
diff
changeset

610 
tx := 1 
bb73d6d3348a
Fix simple team hats (32×64) not tinting correctly while on rope or using blowtorch
Wuzzy <Wuzzy2@mail.ru>
parents:
13214
diff
changeset

611 
else 
bb73d6d3348a
Fix simple team hats (32×64) not tinting correctly while on rope or using blowtorch
Wuzzy <Wuzzy2@mail.ru>
parents:
13214
diff
changeset

612 
tx := 32; 
7547  613 
Tint(HH^.Team^.Clan^.Color shl 8 or $FF); 
13233
bb73d6d3348a
Fix simple team hats (32×64) not tinting correctly while on rope or using blowtorch
Wuzzy <Wuzzy2@mail.ru>
parents:
13214
diff
changeset

614 
DrawTextureRotatedF(curhat, 1.0, 1.0, 6.0, ox, oy, tx, i, 32, 32, 
7547  615 
i*DxDy2Angle(CurAmmoGear^.dY, CurAmmoGear^.dX) + hAngle); 
9666
8dcb25112d96
 Bring back white dot in the center of crosshair. Crosshair is blurred now!
unc0rr
parents:
9655
diff
changeset

616 
untint 
7547  617 
end 
4388  618 
end 
619 
end; 

620 
defaultPos:= false 

621 
end; 

6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6508
diff
changeset

622 
gtBlowTorch: 
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6508
diff
changeset

623 
begin 
6999  624 
DrawSpriteRotated(sprBlowTorch, hx, hy, sign, aangle); 
4388  625 
DrawHedgehog(sx, sy, 
626 
sign, 

627 
3, 

628 
HH^.visStepPos div 2, 

629 
0); 

630 
with HH^ do 

10443
42dadeb6e8ae
Remove switching of hog's hat to chef. do it in draw instead.
nemo
parents:
10441
diff
changeset

631 
if (curhat <> nil) then 
4388  632 
begin 
10443
42dadeb6e8ae
Remove switching of hog's hat to chef. do it in draw instead.
nemo
parents:
10441
diff
changeset

633 
DrawTextureF(curhat, 
4388  634 
1, 
635 
sx, 

636 
sy  5, 

637 
0, 

638 
sign, 

639 
32, 

640 
32); 

13233
bb73d6d3348a
Fix simple team hats (32×64) not tinting correctly while on rope or using blowtorch
Wuzzy <Wuzzy2@mail.ru>
parents:
13214
diff
changeset

641 
if (curhat^.w > 64) or ((curhat^.w = 64) and (curhat^.h = 32)) then 
4388  642 
begin 
13233
bb73d6d3348a
Fix simple team hats (32×64) not tinting correctly while on rope or using blowtorch
Wuzzy <Wuzzy2@mail.ru>
parents:
13214
diff
changeset

643 
if ((curhat^.w = 64) and (curhat^.h = 32)) then 
bb73d6d3348a
Fix simple team hats (32×64) not tinting correctly while on rope or using blowtorch
Wuzzy <Wuzzy2@mail.ru>
parents:
13214
diff
changeset

644 
tx := 1 
bb73d6d3348a
Fix simple team hats (32×64) not tinting correctly while on rope or using blowtorch
Wuzzy <Wuzzy2@mail.ru>
parents:
13214
diff
changeset

645 
else 
bb73d6d3348a
Fix simple team hats (32×64) not tinting correctly while on rope or using blowtorch
Wuzzy <Wuzzy2@mail.ru>
parents:
13214
diff
changeset

646 
tx := 32; 
4810  647 
Tint(HH^.Team^.Clan^.Color shl 8 or $FF); 
10443
42dadeb6e8ae
Remove switching of hog's hat to chef. do it in draw instead.
nemo
parents:
10441
diff
changeset

648 
DrawTextureF(curhat, 
4388  649 
1, 
650 
sx, 

651 
sy  5, 

13233
bb73d6d3348a
Fix simple team hats (32×64) not tinting correctly while on rope or using blowtorch
Wuzzy <Wuzzy2@mail.ru>
parents:
13214
diff
changeset

652 
tx, 
4388  653 
sign, 
654 
32, 

655 
32); 

9666
8dcb25112d96
 Bring back white dot in the center of crosshair. Crosshair is blurred now!
unc0rr
parents:
9655
diff
changeset

656 
untint 
4388  657 
end 
658 
end; 

659 
defaultPos:= false 

660 
end; 

6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6508
diff
changeset

661 
gtFirePunch: 
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6508
diff
changeset

662 
begin 
4388  663 
DrawHedgehog(sx, sy, 
664 
sign, 

665 
1, 

666 
4, 

667 
0); 

668 
defaultPos:= false 

669 
end; 

6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6508
diff
changeset

670 
gtPickHammer: 
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6508
diff
changeset

671 
begin 
4388  672 
defaultPos:= false; 
673 
dec(sy,20); 

674 
end; 

675 
gtTeleport: defaultPos:= false; 

6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6508
diff
changeset

676 
gtWhip: 
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6508
diff
changeset

677 
begin 
6999  678 
DrawSpriteRotatedF(sprWhip, 
4388  679 
sx, 
680 
sy, 

681 
1, 

682 
sign, 

683 
0); 

684 
defaultPos:= false 

685 
end; 

6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6508
diff
changeset

686 
gtHammer: 
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6508
diff
changeset

687 
begin 
6999  688 
DrawSpriteRotatedF(sprHammer, 
4388  689 
sx, 
690 
sy, 

691 
1, 

692 
sign, 

693 
0); 

694 
defaultPos:= false 

695 
end; 

6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6508
diff
changeset

696 
gtResurrector: 
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6508
diff
changeset

697 
begin 
6999  698 
DrawSpriteRotated(sprHandResurrector, sx, sy, 0, 0); 
4388  699 
defaultPos:= false 
700 
end; 

6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6508
diff
changeset

701 
gtKamikaze: 
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6508
diff
changeset

702 
begin 
4388  703 
if CurAmmoGear^.Pos = 0 then 
704 
DrawHedgehog(sx, sy, 

705 
sign, 

706 
1, 

707 
6, 

708 
0) 

709 
else 

6999  710 
DrawSpriteRotatedF(sprKamikaze, 
4388  711 
ox, oy, 
712 
CurAmmoGear^.Pos  1, 

713 
sign, 

714 
aangle); 

715 
defaultPos:= false 

716 
end; 

6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6508
diff
changeset

717 
gtSeduction: 
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6508
diff
changeset

718 
begin 
4388  719 
if CurAmmoGear^.Pos >= 6 then 
720 
DrawHedgehog(sx, sy, 

721 
sign, 

722 
2, 

723 
2, 

724 
0) 

725 
else 

726 
begin 

6999  727 
DrawSpriteRotatedF(sprDress, 
4388  728 
ox, oy, 
729 
CurAmmoGear^.Pos, 

730 
sign, 

731 
0); 

13150
2f7c25bf4201
When using seduction, only show “CENSORED” text in English locale
Wuzzy <Wuzzy2@mail.ru>
parents:
13096
diff
changeset

732 
// sprCensored contains English text, so only show it for English locales 
2f7c25bf4201
When using seduction, only show “CENSORED” text in English locale
Wuzzy <Wuzzy2@mail.ru>
parents:
13096
diff
changeset

733 
// TODO: Make text translatable. But how? 
14598
62dea281e4d5
Refactor hwengine: Rename cLocale to cLanguage
Wuzzy <Wuzzy2@mail.ru>
parents:
14579
diff
changeset

734 
if Copy(cLanguage, 1, 2) = 'en' then 
13150
2f7c25bf4201
When using seduction, only show “CENSORED” text in English locale
Wuzzy <Wuzzy2@mail.ru>
parents:
13096
diff
changeset

735 
DrawSprite(sprCensored, ox  32, oy  20, 0); 
4388  736 
end; 
737 
defaultPos:= false 

738 
end; 

13634
73c2a669c1fd
Make sure gear fuel and alt weapon overlays are always drawn on top
Wuzzy <Wuzzy2@mail.ru>
parents:
13605
diff
changeset

739 
gtFlamethrower: DrawSpriteRotatedF(sprHandFlamethrower, hx, hy, (RealTicks div 125) mod 4, sign, aangle); 
73c2a669c1fd
Make sure gear fuel and alt weapon overlays are always drawn on top
Wuzzy <Wuzzy2@mail.ru>
parents:
13605
diff
changeset

740 
gtLandGun: DrawSpriteRotated(sprHandBallgun, hx, hy, sign, aangle); 
73c2a669c1fd
Make sure gear fuel and alt weapon overlays are always drawn on top
Wuzzy <Wuzzy2@mail.ru>
parents:
13605
diff
changeset

741 
gtIceGun: DrawSpriteRotated(sprIceGun, hx, hy, sign, aangle); 
4388  742 
end; 
743 

744 
case CurAmmoGear^.Kind of 

745 
gtShotgunShot, 

746 
gtDEagleShot, 

12119  747 
gtSniperRifleShot: 
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6508
diff
changeset

748 
begin 
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6508
diff
changeset

749 
DrawHedgehog(sx, sy, sign, 0, 4, 0); 
4388  750 
defaultPos:= false; 
751 
HatVisible:= true 

12119  752 
end; 
12898  753 
gtShover, gtMinigun: 
12119  754 
begin 
755 
DrawHedgehog(sx, sy, sign, 0, 5, 0); 

756 
defaultPos:= false; 

757 
HatVisible:= true 

758 
end 

4388  759 
end 
760 
end else 

761 

762 
if ((Gear^.State and gstHHJumping) <> 0) then 

763 
begin 

764 
DrawHedgehog(sx, sy, 

765 
sign*m, 

766 
1, 

767 
1, 

768 
0); 

769 
HatVisible:= true; 

770 
defaultPos:= false 

771 
end else 

772 

773 
if (Gear^.Message and (gmLeft or gmRight) <> 0) and (not isCursorVisible) then 

774 
begin 

775 
DrawHedgehog(sx, sy, 

776 
sign, 

777 
0, 

778 
HH^.visStepPos div 2, 

779 
0); 

780 
defaultPos:= false; 

781 
HatVisible:= true 

782 
end 

783 
else 

784 

785 
if ((Gear^.State and gstAnimation) <> 0) then 

786 
begin 

10560  787 
if (Gear^.Tag < LongInt(ord(Low(TWave)))) or (Gear^.Tag > LongInt(ord(High(TWave)))) then 
4388  788 
begin 
6453
11c578d30bd3
Countless imporvements to the parser and countless help to the parser in sources.
unc0rr
parents:
6328
diff
changeset

789 
Gear^.State:= Gear^.State and (not gstAnimation); 
4388  790 
end 
791 
else 

792 
begin 

6999  793 
DrawSpriteRotatedF(Wavez[TWave(Gear^.Tag)].Sprite, 
4388  794 
sx, 
795 
sy, 

796 
Gear^.Pos, 

797 
sign, 

798 
0.0); 

799 
defaultPos:= false 

800 
end 

801 
end 

802 
else 

803 
if ((Gear^.State and gstAttacked) = 0) then 

804 
begin 

805 
if HH^.Timer > 0 then 

806 
begin 

807 
// There must be a tidier way to do this. Anyone? 

6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6508
diff
changeset

808 
if aangle <= 90 then 
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6508
diff
changeset

809 
aangle:= aangle+360; 
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6508
diff
changeset

810 
if Gear^.dX > _0 then 
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6508
diff
changeset

811 
aangle:= aangle((aangle240)*HH^.Timer/10) 
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6508
diff
changeset

812 
else 
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6508
diff
changeset

813 
aangle:= aangle+((240aangle)*HH^.Timer/10); 
4388  814 
dec(HH^.Timer) 
815 
end; 

816 
amt:= CurrentHedgehog^.CurAmmoType; 

6924  817 
CurWeapon:= GetCurAmmoEntry(HH^); 
4388  818 
case amt of 
6999  819 
amBazooka: DrawSpriteRotated(sprHandBazooka, hx, hy, sign, aangle); 
820 
amSnowball: DrawSpriteRotated(sprHandSnowball, hx, hy, sign, aangle); 

821 
amMortar: DrawSpriteRotated(sprHandMortar, hx, hy, sign, aangle); 

822 
amMolotov: DrawSpriteRotated(sprHandMolotov, hx, hy, sign, aangle); 

823 
amBallgun: DrawSpriteRotated(sprHandBallgun, hx, hy, sign, aangle); 

824 
amDrill: DrawSpriteRotated(sprHandDrill, hx, hy, sign, aangle); 

825 
amRope: DrawSpriteRotated(sprHandRope, hx, hy, sign, aangle); 

826 
amShotgun: DrawSpriteRotated(sprHandShotgun, hx, hy, sign, aangle); 

827 
amDEagle: DrawSpriteRotated(sprHandDEagle, hx, hy, sign, aangle); 

828 
amSineGun: DrawSpriteRotatedF(sprHandSinegun, hx, hy, 73 + (sign * LongInt(RealTicks div 73)) mod 8, sign, aangle); 

8689  829 

6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6508
diff
changeset

830 
amPortalGun: 
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6508
diff
changeset

831 
if (CurWeapon^.Timer and 2) <> 0 then // Add a new Hedgehog value instead of abusing timer? 
6999  832 
DrawSpriteRotatedF(sprPortalGun, hx, hy, 0, sign, aangle) 
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6508
diff
changeset

833 
else 
6999  834 
DrawSpriteRotatedF(sprPortalGun, hx, hy, 1+CurWeapon^.Pos, sign, aangle); 
8689  835 

6999  836 
amSniperRifle: DrawSpriteRotatedF(sprSniperRifle, hx, hy, 0, sign, aangle); 
837 
amBlowTorch: DrawSpriteRotated(sprHandBlowTorch, hx, hy, sign, aangle); 

838 
amCake: DrawSpriteRotated(sprHandCake, hx, hy, sign, aangle); 

839 
amGrenade: DrawSpriteRotated(sprHandGrenade, hx, hy, sign, aangle); 

840 
amWatermelon: DrawSpriteRotated(sprHandMelon, hx, hy, sign, aangle); 

841 
amSkip: DrawSpriteRotated(sprHandSkip, hx, hy, sign, aangle); 

842 
amClusterBomb: DrawSpriteRotated(sprHandCluster, hx, hy, sign, aangle); 

843 
amDynamite: DrawSpriteRotated(sprHandDynamite, hx, hy, sign, aangle); 

13851
f01798038c2e
Rename amDuck and related symbols to amCreeper, gtCreeper, etc.
Wuzzy <Wuzzy2@mail.ru>
parents:
13838
diff
changeset

844 
amCreeper: DrawSpriteRotatedF(sprHandCreeper, hx, hy, 0, sign, aangle); 
6999  845 
amHellishBomb: DrawSpriteRotated(sprHandHellish, hx, hy, sign, aangle); 
846 
amGasBomb: DrawSpriteRotated(sprHandCheese, hx, hy, sign, aangle); 

847 
amMine: DrawSpriteRotated(sprHandMine, hx, hy, sign, aangle); 

11174  848 
amAirMine: DrawSpriteRotated(sprHandAirMine, hx, hy, sign, aangle); 
6999  849 
amSMine: DrawSpriteRotated(sprHandSMine, hx, hy, sign, aangle); 
7730
2013733f9ca9
A bit more on the knife. Also add missing files to CMakeLists
nemo
parents:
7721
diff
changeset

850 
amKnife: DrawSpriteRotatedF(sprHandKnife, hx, hy, 0, sign, aangle); 
5525  851 
amSeduction: begin 
6999  852 
DrawSpriteRotated(sprHandSeduction, hx, hy, sign, aangle); 
8689  853 
DrawCircle(ox, oy, 248, 4, $FF, $00, $00, $AA); 
5525  854 
end; 
6999  855 
amVampiric: DrawSpriteRotatedF(sprHandVamp, hx, hy, (RealTicks div 125) mod 4, sign, aangle); 
4388  856 
amRCPlane: begin 
6999  857 
DrawSpriteRotated(sprHandPlane, hx, hy, sign, 0); 
4388  858 
defaultPos:= false 
859 
end; 

9768
08799c901a42
Add rubber utility. Graphics are still incomplete. Also flag snow/ice in theme config.
nemo
parents:
9685
diff
changeset

860 
amRubber, 
4388  861 
amGirder: begin 
6999  862 
DrawSpriteRotated(sprHandConstruction, hx, hy, sign, aangle); 
11059
659427d9fd17
display circle for custom build dist values, display nothing if no limit. map borders are not taken into account at this point
sheepluva
parents:
11046
diff
changeset

863 
if cBuildMaxDist = cDefaultBuildMaxDist then 
9505
56e0cca99e20
Allow girder construction to wrap. Makes wrapping w/ large bodies of water a bit more interesting.
nemo
parents:
9285
diff
changeset

864 
begin 
11059
659427d9fd17
display circle for custom build dist values, display nothing if no limit. map borders are not taken into account at this point
sheepluva
parents:
11046
diff
changeset

865 
if WorldEdge = weWrap then 
659427d9fd17
display circle for custom build dist values, display nothing if no limit. map borders are not taken into account at this point
sheepluva
parents:
11046
diff
changeset

866 
begin 
14282
6015b74eea55
overall, using LongInt for leftX/rightX results in fewer casts, since most comparisons are against ints.
nemo
parents:
14200
diff
changeset

867 
if hwRound(Gear^.X) < leftX + 256 then 
11059
659427d9fd17
display circle for custom build dist values, display nothing if no limit. map borders are not taken into account at this point
sheepluva
parents:
11046
diff
changeset

868 
DrawSpriteClipped(sprGirder, 
659427d9fd17
display circle for custom build dist values, display nothing if no limit. map borders are not taken into account at this point
sheepluva
parents:
11046
diff
changeset

869 
rightX+(oxleftX)256, 
659427d9fd17
display circle for custom build dist values, display nothing if no limit. map borders are not taken into account at this point
sheepluva
parents:
11046
diff
changeset

870 
oy256, 
14286  871 
topY+WorldDy, 
14282
6015b74eea55
overall, using LongInt for leftX/rightX results in fewer casts, since most comparisons are against ints.
nemo
parents:
14200
diff
changeset

872 
rightX+WorldDx, 
11059
659427d9fd17
display circle for custom build dist values, display nothing if no limit. map borders are not taken into account at this point
sheepluva
parents:
11046
diff
changeset

873 
cWaterLine+WorldDy, 
14282
6015b74eea55
overall, using LongInt for leftX/rightX results in fewer casts, since most comparisons are against ints.
nemo
parents:
14200
diff
changeset

874 
leftX+WorldDx); 
6015b74eea55
overall, using LongInt for leftX/rightX results in fewer casts, since most comparisons are against ints.
nemo
parents:
14200
diff
changeset

875 
if hwRound(Gear^.X) > rightX  256 then 
11059
659427d9fd17
display circle for custom build dist values, display nothing if no limit. map borders are not taken into account at this point
sheepluva
parents:
11046
diff
changeset

876 
DrawSpriteClipped(sprGirder, 
659427d9fd17
display circle for custom build dist values, display nothing if no limit. map borders are not taken into account at this point
sheepluva
parents:
11046
diff
changeset

877 
leftX(rightXox)256, 
659427d9fd17
display circle for custom build dist values, display nothing if no limit. map borders are not taken into account at this point
sheepluva
parents:
11046
diff
changeset

878 
oy256, 
14286  879 
topY+WorldDy, 
14282
6015b74eea55
overall, using LongInt for leftX/rightX results in fewer casts, since most comparisons are against ints.
nemo
parents:
14200
diff
changeset

880 
rightX+WorldDx, 
11059
659427d9fd17
display circle for custom build dist values, display nothing if no limit. map borders are not taken into account at this point
sheepluva
parents:
11046
diff
changeset

881 
cWaterLine+WorldDy, 
14282
6015b74eea55
overall, using LongInt for leftX/rightX results in fewer casts, since most comparisons are against ints.
nemo
parents:
14200
diff
changeset

882 
leftX+WorldDx) 
11059
659427d9fd17
display circle for custom build dist values, display nothing if no limit. map borders are not taken into account at this point
sheepluva
parents:
11046
diff
changeset

883 
end; 
659427d9fd17
display circle for custom build dist values, display nothing if no limit. map borders are not taken into account at this point
sheepluva
parents:
11046
diff
changeset

884 
DrawSpriteClipped(sprGirder, 
659427d9fd17
display circle for custom build dist values, display nothing if no limit. map borders are not taken into account at this point
sheepluva
parents:
11046
diff
changeset

885 
ox256, 
659427d9fd17
display circle for custom build dist values, display nothing if no limit. map borders are not taken into account at this point
sheepluva
parents:
11046
diff
changeset

886 
oy256, 
14286  887 
topY+WorldDy, 
14282
6015b74eea55
overall, using LongInt for leftX/rightX results in fewer casts, since most comparisons are against ints.
nemo
parents:
14200
diff
changeset

888 
rightX+WorldDx, 
11059
659427d9fd17
display circle for custom build dist values, display nothing if no limit. map borders are not taken into account at this point
sheepluva
parents:
11046
diff
changeset

889 
cWaterLine+WorldDy, 
14282
6015b74eea55
overall, using LongInt for leftX/rightX results in fewer casts, since most comparisons are against ints.
nemo
parents:
14200
diff
changeset

890 
leftX+WorldDx) 
11059
659427d9fd17
display circle for custom build dist values, display nothing if no limit. map borders are not taken into account at this point
sheepluva
parents:
11046
diff
changeset

891 
end 
659427d9fd17
display circle for custom build dist values, display nothing if no limit. map borders are not taken into account at this point
sheepluva
parents:
11046
diff
changeset

892 
else if cBuildMaxDist > 0 then 
659427d9fd17
display circle for custom build dist values, display nothing if no limit. map borders are not taken into account at this point
sheepluva
parents:
11046
diff
changeset

893 
begin 
659427d9fd17
display circle for custom build dist values, display nothing if no limit. map borders are not taken into account at this point
sheepluva
parents:
11046
diff
changeset

894 
DrawCircle(hx, hy, cBuildMaxDist, 3, $FF, 0, 0, $80); 
9505
56e0cca99e20
Allow girder construction to wrap. Makes wrapping w/ large bodies of water a bit more interesting.
nemo
parents:
9285
diff
changeset

895 
end; 
4388  896 
end; 
6999  897 
amBee: DrawSpriteRotatedF(sprHandBee, hx, hy, (RealTicks div 125) mod 4, sign, aangle); 
898 
amFlamethrower: DrawSpriteRotatedF(sprHandFlamethrower, hx, hy, (RealTicks div 125) mod 4, sign, aangle); 

899 
amLandGun: DrawSpriteRotated(sprHandBallgun, hx, hy, sign, aangle); 

8554  900 
amIceGun: DrawSpriteRotated(sprIceGun, hx, hy, sign, aangle); 
4388  901 
amResurrector: DrawCircle(ox, oy, 98, 4, $F5, $DB, $35, $AA); // I'd rather not like to hardcode 100 here 
902 
end; 

903 

904 
case amt of 

905 
amAirAttack, 

12681
4e5e725f2c56
Fix hog holding nothing in hand when choosing napalm or piano strike
Wuzzy <almikes@aol.com>
parents:
12376
diff
changeset

906 
amNapalm, 
4388  907 
amMineStrike, 
6999  908 
amDrillStrike: DrawSpriteRotated(sprHandAirAttack, sx, oy, sign, 0); 
4388  909 
amPickHammer: DrawHedgehog(sx, sy, 
910 
sign, 

911 
1, 

912 
2, 

913 
0); 

12681
4e5e725f2c56
Fix hog holding nothing in hand when choosing napalm or piano strike
Wuzzy <almikes@aol.com>
parents:
12376
diff
changeset

914 
amTeleport, 
4e5e725f2c56
Fix hog holding nothing in hand when choosing napalm or piano strike
Wuzzy <almikes@aol.com>
parents:
12376
diff
changeset

915 
amPiano: DrawSpriteRotatedF(sprTeleport, sx, sy, 0, sign, 0); 
4388  916 
amKamikaze: DrawHedgehog(sx, sy, 
917 
sign, 

918 
1, 

919 
5, 

920 
0); 

6999  921 
amWhip: DrawSpriteRotatedF(sprWhip, 
4388  922 
sx, 
923 
sy, 

924 
0, 

925 
sign, 

926 
0); 

6999  927 
amHammer: DrawSpriteRotatedF(sprHammer, 
4388  928 
sx, 
929 
sy, 

930 
0, 

931 
sign, 

932 
0); 

12898  933 
amBaseballBat, amMinigun: 
12376
c80c51f59a98
Make hogs keep their hat when holding the baseball bat
alfadur
parents:
12306
diff
changeset

934 
begin 
c80c51f59a98
Make hogs keep their hat when holding the baseball bat
alfadur
parents:
12306
diff
changeset

935 
HatVisible:= true; 
c80c51f59a98
Make hogs keep their hat when holding the baseball bat
alfadur
parents:
12306
diff
changeset

936 
DrawHedgehog(sx, sy, 
12119  937 
sign, 
938 
0, 

939 
5, 

940 
0); 

12376
c80c51f59a98
Make hogs keep their hat when holding the baseball bat
alfadur
parents:
12306
diff
changeset

941 
end 
4388  942 
else 
943 
DrawHedgehog(sx, sy, 

944 
sign, 

945 
0, 

946 
4, 

947 
0); 

948 

949 
HatVisible:= true; 

950 
end; 

951 

952 
defaultPos:= false 

953 
end; 

954 

955 
end else // not gstHHDriven 

956 
begin 

11506
24bef86e3f3a
add some dust effect to rolling/sliding hedgehogs
sheepluva
parents:
11317
diff
changeset

957 
// check if hedgehog is sliding/rolling 
8681
d0fc1dca739c
yeah. this was a bad idea. the minor difference in thaw speed vs last hog of team never unthawing.
nemo
parents:
8656
diff
changeset

958 
if (Gear^.Damage > 0) and (HH^.Effects[heFrozen] = 0) 
4388  959 
and (hwSqr(Gear^.dX) + hwSqr(Gear^.dY) > _0_003) then 
960 
begin 

10526
b43d175d1577
Avoid promoting violence to hedgehogs. At least once a year.
nemo
parents:
10523
diff
changeset

961 
defaultPos:= false; 
b43d175d1577
Avoid promoting violence to hedgehogs. At least once a year.
nemo
parents:
10523
diff
changeset

962 
DrawHedgehog(sx, sy, 
b43d175d1577
Avoid promoting violence to hedgehogs. At least once a year.
nemo
parents:
10523
diff
changeset

963 
sign, 
b43d175d1577
Avoid promoting violence to hedgehogs. At least once a year.
nemo
parents:
10523
diff
changeset

964 
2, 
b43d175d1577
Avoid promoting violence to hedgehogs. At least once a year.
nemo
parents:
10523
diff
changeset

965 
1, 
b43d175d1577
Avoid promoting violence to hedgehogs. At least once a year.
nemo
parents:
10523
diff
changeset

966 
Gear^.DirAngle); 
11506
24bef86e3f3a
add some dust effect to rolling/sliding hedgehogs
sheepluva
parents:
11317
diff
changeset

967 

24bef86e3f3a
add some dust effect to rolling/sliding hedgehogs
sheepluva
parents:
11317
diff
changeset

968 
// dust effect 
24bef86e3f3a
add some dust effect to rolling/sliding hedgehogs
sheepluva
parents:
11317
diff
changeset

969 
// TODO fix: this gives different results based on framerate 
24bef86e3f3a
add some dust effect to rolling/sliding hedgehogs
sheepluva
parents:
11317
diff
changeset

970 
if (sx mod 8) = 0 then 
24bef86e3f3a
add some dust effect to rolling/sliding hedgehogs
sheepluva
parents:
11317
diff
changeset

971 
begin 
24bef86e3f3a
add some dust effect to rolling/sliding hedgehogs
sheepluva
parents:
11317
diff
changeset

972 
if Gear^.dX.isNegative then 
24bef86e3f3a
add some dust effect to rolling/sliding hedgehogs
sheepluva
parents:
11317
diff
changeset

973 
tx := hwRound(Gear^.X) + cHHRadius 
24bef86e3f3a
add some dust effect to rolling/sliding hedgehogs
sheepluva
parents:
11317
diff
changeset

974 
else 
24bef86e3f3a
add some dust effect to rolling/sliding hedgehogs
sheepluva
parents:
11317
diff
changeset

975 
tx := hwRound(Gear^.X)  cHHRadius; 
24bef86e3f3a
add some dust effect to rolling/sliding hedgehogs
sheepluva
parents:
11317
diff
changeset

976 
ty:= hwRound(Gear^.Y) + cHHRadius + 2; 
24bef86e3f3a
add some dust effect to rolling/sliding hedgehogs
sheepluva
parents:
11317
diff
changeset

977 
if ((tx and LAND_WIDTH_MASK) = 0) and 
24bef86e3f3a
add some dust effect to rolling/sliding hedgehogs
sheepluva
parents:
11317
diff
changeset

978 
((ty and LAND_HEIGHT_MASK) = 0) and 
24bef86e3f3a
add some dust effect to rolling/sliding hedgehogs
sheepluva
parents:
11317
diff
changeset

979 
(Land[ty, tx] <> 0) then 
24bef86e3f3a
add some dust effect to rolling/sliding hedgehogs
sheepluva
parents:
11317
diff
changeset

980 
AddVisualGear(tx  2 + Random(4), ty  8, vgtDust); 
24bef86e3f3a
add some dust effect to rolling/sliding hedgehogs
sheepluva
parents:
11317
diff
changeset

981 
end; 
24bef86e3f3a
add some dust effect to rolling/sliding hedgehogs
sheepluva
parents:
11317
diff
changeset

982 

24bef86e3f3a
add some dust effect to rolling/sliding hedgehogs
sheepluva
parents:
11317
diff
changeset

983 
// draw april's fool hat 
10526
b43d175d1577
Avoid promoting violence to hedgehogs. At least once a year.
nemo
parents:
10523
diff
changeset

984 
if AprilOne and (curhat <> nil) then 
b43d175d1577
Avoid promoting violence to hedgehogs. At least once a year.
nemo
parents:
10523
diff
changeset

985 
DrawTextureRotatedF(curhat, 1.0, 1.0, 0, sx, sy, 18, sign, 32, 32, 
b43d175d1577
Avoid promoting violence to hedgehogs. At least once a year.
nemo
parents:
10523
diff
changeset

986 
sign*Gear^.DirAngle) 
b43d175d1577
Avoid promoting violence to hedgehogs. At least once a year.
nemo
parents:
10523
diff
changeset

987 
end; 
10528  988 

4388  989 

990 
if ((Gear^.State and gstHHJumping) <> 0) then 

991 
begin 

992 
DrawHedgehog(sx, sy, 

993 
sign*m, 

994 
1, 

995 
1, 

996 
0); 

997 
defaultPos:= false 

998 
end; 

999 
end; 

1000 

1001 
with HH^ do 

1002 
begin 

1003 
if defaultPos then 

1004 
begin 

10441
d2f599997b54
Revert hog tinting from rdb65298717da since it wasn't sufficiently complete for a release. More sprites need converting, and there's a slight bug in hog tinting, for away hogs with hats I believe.
nemo
parents:
10390
diff
changeset

1005 
if HH^.Team^.hasGone then Tint($FFFFFF80); 
6999  1006 
DrawSpriteRotatedF(sprHHIdle, 
4388  1007 
sx, 
1008 
sy, 

1009 
(RealTicks div 128 + Gear^.Pos) mod 19, 

1010 
sign, 

1011 
0); 

1012 
HatVisible:= true; 

1013 
end; 

1014 

1015 
if HatVisible then 

1016 
if HatVisibility < 1.0 then 

1017 
HatVisibility:= HatVisibility + 0.2 

1018 
else 

1019 
else 

1020 
if HatVisibility > 0.0 then 

1021 
HatVisibility:= HatVisibility  0.2; 

1022 

10443
42dadeb6e8ae
Remove switching of hog's hat to chef. do it in draw instead.
nemo
parents:
10441
diff
changeset

1023 
if (curhat <> nil) 
4388  1024 
and (HatVisibility > 0) then 
1025 
if DefaultPos then 

1026 
begin 

11882
bbd0cb0564c5
Simplify the hat format for unanimated hats
Wuzzy <almikes@aol.com>
parents:
11876
diff
changeset

1027 
// Simple hat with automatic offset 
bbd0cb0564c5
Simplify the hat format for unanimated hats
Wuzzy <almikes@aol.com>
parents:
11876
diff
changeset

1028 
if (curhat^.h = 32) and ((curhat^.w = 32) or (curhat^.w = 64)) then 
4388  1029 
begin 
11882
bbd0cb0564c5
Simplify the hat format for unanimated hats
Wuzzy <almikes@aol.com>
parents:
11876
diff
changeset

1030 
// Frame 
bbd0cb0564c5
Simplify the hat format for unanimated hats
Wuzzy <almikes@aol.com>
parents:
11876
diff
changeset

1031 
tx := (RealTicks div 128 + Gear^.Pos) mod 19; 
bbd0cb0564c5
Simplify the hat format for unanimated hats
Wuzzy <almikes@aol.com>
parents:
11876
diff
changeset

1032 
// Hat offset 
bbd0cb0564c5
Simplify the hat format for unanimated hats
Wuzzy <almikes@aol.com>
parents:
11876
diff
changeset

1033 
ty := 0; 
bbd0cb0564c5
Simplify the hat format for unanimated hats
Wuzzy <almikes@aol.com>
parents:
11876
diff
changeset

1034 
if (tx = 2) or (tx = 7) or (tx = 12) then 
bbd0cb0564c5
Simplify the hat format for unanimated hats
Wuzzy <almikes@aol.com>
parents:
11876
diff
changeset

1035 
ty := 1 
bbd0cb0564c5
Simplify the hat format for unanimated hats
Wuzzy <almikes@aol.com>
parents:
11876
diff
changeset

1036 
else if tx = 16 then 
bbd0cb0564c5
Simplify the hat format for unanimated hats
Wuzzy <almikes@aol.com>
parents:
11876
diff
changeset

1037 
ty := 1; 
bbd0cb0564c5
Simplify the hat format for unanimated hats
Wuzzy <almikes@aol.com>
parents:
11876
diff
changeset

1038 
// First frame: No tint 
bbd0cb0564c5
Simplify the hat format for unanimated hats
Wuzzy <almikes@aol.com>
parents:
11876
diff
changeset

1039 
DrawTextureF(curhat, 
bbd0cb0564c5
Simplify the hat format for unanimated hats
Wuzzy <almikes@aol.com>
parents:
11876
diff
changeset

1040 
HatVisibility, 
bbd0cb0564c5
Simplify the hat format for unanimated hats
Wuzzy <almikes@aol.com>
parents:
11876
diff
changeset

1041 
sx, 
bbd0cb0564c5
Simplify the hat format for unanimated hats
Wuzzy <almikes@aol.com>
parents:
11876
diff
changeset

1042 
sy  5 + ty, 
bbd0cb0564c5
Simplify the hat format for unanimated hats
Wuzzy <almikes@aol.com>
parents:
11876
diff
changeset

1043 
0, 
bbd0cb0564c5
Simplify the hat format for unanimated hats
Wuzzy <almikes@aol.com>
parents:
11876
diff
changeset

1044 
sign, 
bbd0cb0564c5
Simplify the hat format for unanimated hats
Wuzzy <almikes@aol.com>
parents:
11876
diff
changeset

1045 
32, 
bbd0cb0564c5
Simplify the hat format for unanimated hats
Wuzzy <almikes@aol.com>
parents:
11876
diff
changeset

1046 
32); 
bbd0cb0564c5
Simplify the hat format for unanimated hats
Wuzzy <almikes@aol.com>
parents:
11876
diff
changeset

1047 
// Second frame: Clan tint (if present) 
bbd0cb0564c5
Simplify the hat format for unanimated hats
Wuzzy <almikes@aol.com>
parents:
11876
diff
changeset

1048 
if (curhat^.w = 64) then 
bbd0cb0564c5
Simplify the hat format for unanimated hats
Wuzzy <almikes@aol.com>
parents:
11876
diff
changeset

1049 
begin 
bbd0cb0564c5
Simplify the hat format for unanimated hats
Wuzzy <almikes@aol.com>
parents:
11876
diff
changeset

1050 
Tint(HH^.Team^.Clan^.Color shl 8 or $FF); 
bbd0cb0564c5
Simplify the hat format for unanimated hats
Wuzzy <almikes@aol.com>
parents:
11876
diff
changeset

1051 
DrawTextureF(curhat, 
bbd0cb0564c5
Simplify the hat format for unanimated hats
Wuzzy <almikes@aol.com>
parents:
11876
diff
changeset

1052 
HatVisibility, 
bbd0cb0564c5
Simplify the hat format for unanimated hats
Wuzzy <almikes@aol.com>
parents:
11876
diff
changeset

1053 
sx, 
bbd0cb0564c5
Simplify the hat format for unanimated hats
Wuzzy <almikes@aol.com>
parents:
11876
diff
changeset

1054 
sy  5 + ty, 
bbd0cb0564c5
Simplify the hat format for unanimated hats
Wuzzy <almikes@aol.com>
parents:
11876
diff
changeset

1055 
1, 
bbd0cb0564c5
Simplify the hat format for unanimated hats
Wuzzy <almikes@aol.com>
parents:
11876
diff
changeset

1056 
sign, 
bbd0cb0564c5
Simplify the hat format for unanimated hats
Wuzzy <almikes@aol.com>
parents:
11876
diff
changeset

1057 
32, 
bbd0cb0564c5
Simplify the hat format for unanimated hats
Wuzzy <almikes@aol.com>
parents:
11876
diff
changeset

1058 
32); 
bbd0cb0564c5
Simplify the hat format for unanimated hats
Wuzzy <almikes@aol.com>
parents:
11876
diff
changeset

1059 
untint 
bbd0cb0564c5
Simplify the hat format for unanimated hats
Wuzzy <almikes@aol.com>
parents:
11876
diff
changeset

1060 
end 
bbd0cb0564c5
Simplify the hat format for unanimated hats
Wuzzy <almikes@aol.com>
parents:
11876
diff
changeset

1061 
end 
bbd0cb0564c5
Simplify the hat format for unanimated hats
Wuzzy <almikes@aol.com>
parents:
11876
diff
changeset

1062 
else 
bbd0cb0564c5
Simplify the hat format for unanimated hats
Wuzzy <almikes@aol.com>
parents:
11876
diff
changeset

1063 
// Classic animated hat (all frames drawn manually) 
bbd0cb0564c5
Simplify the hat format for unanimated hats
Wuzzy <almikes@aol.com>
parents:
11876
diff
changeset

1064 
begin 
10443
42dadeb6e8ae
Remove switching of hog's hat to chef. do it in draw instead.
nemo
parents:
10441
diff
changeset

1065 
DrawTextureF(curhat, 
4388  1066 
HatVisibility, 
1067 
sx, 

1068 
sy  5, 

11882
bbd0cb0564c5
Simplify the hat format for unanimated hats
Wuzzy <almikes@aol.com>
parents:
11876
diff
changeset

1069 
(RealTicks div 128 + Gear^.Pos) mod 19, 
4388  1070 
sign, 
1071 
32, 

1072 
32); 

11882
bbd0cb0564c5
Simplify the hat format for unanimated hats
Wuzzy <almikes@aol.com>
parents:
11876
diff
changeset

1073 
// Apply clan tint 
bbd0cb0564c5
Simplify the hat format for unanimated hats
Wuzzy <almikes@aol.com>
parents:
11876
diff
changeset

1074 
if curhat^.w > 64 then 
bbd0cb0564c5
Simplify the hat format for unanimated hats
Wuzzy <almikes@aol.com>
parents:
11876
diff
changeset

1075 
begin 
bbd0cb0564c5
Simplify the hat format for unanimated hats
Wuzzy <almikes@aol.com>
parents:
11876
diff
changeset

1076 
Tint(HH^.Team^.Clan^.Color shl 8 or $FF); 
bbd0cb0564c5
Simplify the hat format for unanimated hats
Wuzzy <almikes@aol.com>
parents:
11876
diff
changeset

1077 
DrawTextureF(curhat, 
bbd0cb0564c5
Simplify the hat format for unanimated hats
Wuzzy <almikes@aol.com>
parents:
11876
diff
changeset

1078 
HatVisibility, 
bbd0cb0564c5
Simplify the hat format for unanimated hats
Wuzzy <almikes@aol.com>
parents:
11876
diff
changeset

1079 
sx, 
bbd0cb0564c5
Simplify the hat format for unanimated hats
Wuzzy <almikes@aol.com>
parents:
11876
diff
changeset

1080 
sy  5, 
bbd0cb0564c5
Simplify the hat format for unanimated hats
Wuzzy <almikes@aol.com>
parents:
11876
diff
changeset

1081 
(RealTicks div 128 + Gear^.Pos) mod 19 + 32, 
bbd0cb0564c5
Simplify the hat format for unanimated hats
Wuzzy <almikes@aol.com>
parents:
11876
diff
changeset

1082 
sign, 
bbd0cb0564c5
Simplify the hat format for unanimated hats
Wuzzy <almikes@aol.com>
parents:
11876
diff
changeset

1083 
32, 
bbd0cb0564c5
Simplify the hat format for unanimated hats
Wuzzy <almikes@aol.com>
parents:
11876
diff
changeset

1084 
32); 
bbd0cb0564c5
Simplify the hat format for unanimated hats
Wuzzy <almikes@aol.com>
parents:
11876
diff
changeset

1085 
untint 
bbd0cb0564c5
Simplify the hat format for unanimated hats
Wuzzy <almikes@aol.com>
parents:
11876
diff
changeset

1086 
end 
7978  1087 
end; 
9666
8dcb25112d96
 Bring back white dot in the center of crosshair. Crosshair is blurred now!
unc0rr
parents:
9655
diff
changeset

1088 
if HH^.Team^.hasGone then untint 
4388  1089 
end 
1090 
else 

1091 
begin 

10443
42dadeb6e8ae
Remove switching of hog's hat to chef. do it in draw instead.
nemo
parents:
10441
diff
changeset

1092 
DrawTextureF(curhat, 
4388  1093 
HatVisibility, 
1094 
sx, 

1095 
sy  5, 

1096 
0, 

1097 
sign*m, 

1098 
32, 

1099 
32); 

11882
bbd0cb0564c5
Simplify the hat format for unanimated hats
Wuzzy <almikes@aol.com>
parents:
11876
diff
changeset

1100 
if (curhat^.w > 64) or ((curhat^.w = 64) and (curhat^.h = 32)) then 
4388  1101 
begin 
11882
bbd0cb0564c5
Simplify the hat format for unanimated hats
Wuzzy <almikes@aol.com>
parents:
11876
diff
changeset

1102 
if ((curhat^.w = 64) and (curhat^.h = 32)) then 
bbd0cb0564c5
Simplify the hat format for unanimated hats
Wuzzy <almikes@aol.com>
parents:
11876
diff
changeset

1103 
tx := 1 
bbd0cb0564c5
Simplify the hat format for unanimated hats
Wuzzy <almikes@aol.com>
parents:
11876
diff
changeset

1104 
else 
bbd0cb0564c5
Simplify the hat format for unanimated hats
Wuzzy <almikes@aol.com>
parents:
11876
diff
changeset

1105 
tx := 32; 
4810  1106 
Tint(HH^.Team^.Clan^.Color shl 8 or $FF); 
10443
42dadeb6e8ae
Remove switching of hog's hat to chef. do it in draw instead.
nemo
parents:
10441
diff
changeset

1107 
DrawTextureF(curhat, 
4388  1108 
HatVisibility, 
1109 
sx, 

1110 
sy  5, 

11882
bbd0cb0564c5
Simplify the hat format for unanimated hats
Wuzzy <almikes@aol.com>
parents:
11876
diff
changeset

1111 
tx, 
4388  1112 
sign*m, 
1113 
32, 

1114 
32); 

9666
8dcb25112d96
 Bring back white dot in the center of crosshair. Crosshair is blurred now!
unc0rr
parents:
9655
diff
changeset

1115 
untint 
4388  1116 
end 
1117 
end 

1118 
end; 

12898  1119 

4388  1120 
if (Gear^.State and gstHHDriven) <> 0 then 
1121 
begin 

12376
c80c51f59a98
Make hogs keep their hat when holding the baseball bat
alfadur
parents:
12306
diff
changeset

1122 
if (CurAmmoGear = nil) then 
c80c51f59a98
Make hogs keep their hat when holding the baseball bat
alfadur
parents:
12306
diff
changeset

1123 
begin 
12898  1124 
if ((Gear^.State and (gstAttacked or gstAnimation or gstHHJumping)) = 0) 
1125 
and (Gear^.Message and (gmLeft or gmRight) = 0) then 

1126 
begin 

12376
c80c51f59a98
Make hogs keep their hat when holding the baseball bat
alfadur
parents:
12306
diff
changeset

1127 
amt:= CurrentHedgehog^.CurAmmoType; 
12898  1128 
case amt of 
1129 
amBaseballBat: DrawSpritePivotedF(sprHandBaseball, 

1130 
sx + 9 * sign, sy + 2, 0, sign, 8, 1, aangle); 

1131 
amMinigun: DrawSpritePivotedF(sprMinigun, 

1132 
sx + 20 * sign, sy + 4, 0, sign, 18, 2, aangle); 

1133 
end; 

12376
c80c51f59a98
Make hogs keep their hat when holding the baseball bat
alfadur
parents:
12306
diff
changeset

1134 
end; 
c80c51f59a98
Make hogs keep their hat when holding the baseball bat
alfadur
parents:
12306
diff
changeset

1135 
end 
c80c51f59a98
Make hogs keep their hat when holding the baseball bat
alfadur
parents:
12306
diff
changeset

1136 
else 
4388  1137 
begin 
12119  1138 
aangle:= Gear^.Angle * 180 / cMaxAngle  90; 
4388  1139 
case CurAmmoGear^.Kind of 
1140 
gtJetpack: begin 

1141 
DrawSprite(sprJetpack, sx32, sy32, 0); 

1142 
if cWaterLine > hwRound(Gear^.Y) + Gear^.Radius then 

1143 
begin 

6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6508
diff
changeset

1144 
if (CurAmmoGear^.MsgParam and gmUp) <> 0 then 
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6508
diff
changeset

1145 
DrawSprite(sprJetpack, sx32, sy28, 1); 
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6508
diff
changeset

1146 
if (CurAmmoGear^.MsgParam and gmLeft) <> 0 then 
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6508
diff
changeset

1147 
DrawSprite(sprJetpack, sx28, sy28, 2); 
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6508
diff
changeset

1148 
if (CurAmmoGear^.MsgParam and gmRight) <> 0 then 
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6508
diff
changeset

1149 
DrawSprite(sprJetpack, sx36, sy28, 3) 
4388  1150 
end; 
1151 
end; 

12898  1152 
gtShover: DrawSpritePivotedF(sprHandBaseball, 
1153 
sx + 9 * sign, sy + 2, CurAmmoGear^.Tag, sign, 8, 1, aangle); 

1154 
gtMinigun: DrawSpritePivotedF(sprMinigun, 

1155 
sx + 20 * sign, sy + 4, CurAmmoGear^.Tag, sign, 18, 2, aangle); 

4388  1156 
end; 
1157 
end 

1158 
end; 

1159 

1160 
with HH^ do 

1161 
begin 

6453
11c578d30bd3
Countless imporvements to the parser and countless help to the parser in sources.
unc0rr
parents:
6328
diff
changeset

1162 
if ((Gear^.State and (not gstWinner)) = 0) 
4388  1163 
or ((Gear^.State = gstWait) and (Gear^.dY.QWordValue = 0)) 
1164 
or (bShowFinger and ((Gear^.State and gstHHDriven) <> 0)) then 

1165 
begin 

1166 
t:= sy  cHHRadius  9; 

1167 
if (cTagsMask and htTransparent) <> 0 then 

1168 
Tint($FF, $FF, $FF, $80); 

1169 
if ((cTagsMask and htHealth) <> 0) then 

1170 
begin 

1171 
dec(t, HealthTagTex^.h + 2); 

6999  1172 
DrawTextureCentered(ox, t, HealthTagTex) 
4388  1173 
end; 
1174 
if (cTagsMask and htName) <> 0 then 

1175 
begin 

1176 
dec(t, NameTagTex^.h + 2); 

6999  1177 
DrawTextureCentered(ox, t, NameTagTex) 
4388  1178 
end; 
1179 
if (cTagsMask and htTeamName) <> 0 then 

1180 
begin 

1181 
dec(t, Team^.NameTagTex^.h + 2); 

6999  1182 
DrawTextureCentered(ox, t, Team^.NameTagTex) 
4388  1183 
end; 
1184 
if (cTagsMask and htTransparent) <> 0 then 

9666
8dcb25112d96
 Bring back white dot in the center of crosshair. Crosshair is blurred now!
unc0rr
parents:
9655
diff
changeset

1185 
untint 
4388  1186 
end; 
1187 
if (Gear^.State and gstHHDriven) <> 0 then // Current hedgehog 

1188 
begin 

4394  1189 
if (CurAmmoGear <> nil) and (CurAmmoGear^.Kind = gtResurrector) then 
6999  1190 
DrawTextureCentered(ox, sy  cHHRadius  7  HealthTagTex^.h, HealthTagTex); 
4394  1191 

4388  1192 
if (Gear^.State and gstDrowning) = 0 then 
14663
fb73852e6f4d
Don't render AI hog thinking bubble in cut scenes
Wuzzy <Wuzzy2@mail.ru>
parents:
14656
diff
changeset

1193 
if ((Gear^.State and gstHHThinking) <> 0) and (not CinematicScript) then 
4388  1194 
DrawSprite(sprQuestion, ox  10, oy  cHHRadius  34, (RealTicks shr 9) mod 8) 
1195 
end 

1196 
end; 

1197 

7010
10a0a31804f3
Switch effects to longint for convenience of tracking ice states. I could add a new Hedgehog value, but since we have this effects list being all useless as booleans anyway...
nemo
parents:
6999
diff
changeset

1198 
if HH^.Effects[hePoisoned] <> 0 then 
4388  1199 
begin 
1200 
Tint($00, $FF, $40, $80); 

10142  1201 
DrawTextureRotatedF(SpritesData[sprSmokeWhite].texture, 1.5, 0, 0, sx, sy, 0, 1, 22, 22, 360  (RealTicks shr 5) mod 360); 
4388  1202 
end; 
7010
10a0a31804f3
Switch effects to longint for convenience of tracking ice states. I could add a new Hedgehog value, but since we have this effects list being all useless as booleans anyway...
nemo
parents:
6999
diff
changeset

1203 
if HH^.Effects[heResurrected] <> 0 then 
4388  1204 
begin 
1205 
Tint($f5, $db, $35, $20); 

1206 
DrawSprite(sprVampiric, sx  24, sy  24, 0); 

1207 
end; 

1208 

9685
7d925e82e572
Tweak trophyrace to work better w/ skip (probably, needs testing), drop Invulnerable in favour of effects  heInvulnerable is already in effects,
nemo
parents:
9667
diff
changeset

1209 
if (Gear^.Hedgehog^.Effects[heInvulnerable] <> 0) then 
4388  1210 
begin 
1211 
Tint($FF, $FF, $FF, max($40, round($FF * abs(1  ((RealTicks div 2 + Gear^.uid * 491) mod 1500) / 750)))); 

1212 
DrawSprite(sprInvulnerable, sx  24, sy  24, 0); 

1213 
end; 

8557  1214 

8656
a8282143a8df
use opacity to indicate thawing. not totally happy w/ effect, but argument was made to indicate some progress towards thaw. drop "exit" since it really wasn't helpful, and not rendering tags, was more annoying than fun.
nemo
parents:
8628
diff
changeset

1215 
if HH^.Effects[heFrozen] < 150000 then 
8557  1216 
begin 
8656
a8282143a8df
use opacity to indicate thawing. not totally happy w/ effect, but argument was made to indicate some progress towards thaw. drop "exit" since it really wasn't helpful, and not rendering tags, was more annoying than fun.
nemo
parents:
8628
diff
changeset

1217 
if HH^.Effects[heFrozen] < 150000 then 
8681
d0fc1dca739c
yeah. this was a bad idea. the minor difference in thaw speed vs last hog of team never unthawing.
nemo
parents:
8656
diff
changeset

1218 
Tint($FF, $FF, $FF, min(255,127+HH^.Effects[heFrozen] div 800)); 
8656
a8282143a8df
use opacity to indicate thawing. not totally happy w/ effect, but argument was made to indicate some progress towards thaw. drop "exit" since it really wasn't helpful, and not rendering tags, was more annoying than fun.
nemo
parents:
8628
diff
changeset

1219 

8684  1220 
iceOffset:= min(32, HH^.Effects[heFrozen] div 8); 
8560  1221 
r.x := 128; 
8684  1222 
r.y := 96  iceOffset; 
1223 
r.w := 32; 

8689  1224 
r.h := iceOffset; 
10324
5d90d8ca9657
tweak code of DrawTextureFromRectDir a bit, removing issue with different x offset depending on dir. also removing the workaround wrt that issue in the frozen hog code
sheepluva
parents:
10313
diff
changeset

1225 
DrawTextureFromRectDir(sx  16 + sign*2, sy + 16  iceoffset, r.w, r.h, @r, HHTexture, sign); 
8684  1226 

8557  1227 

8656
a8282143a8df
use opacity to indicate thawing. not totally happy w/ effect, but argument was made to indicate some progress towards thaw. drop "exit" since it really wasn't helpful, and not rendering tags, was more annoying than fun.
nemo
parents:
8628
diff
changeset

1228 
if HH^.Effects[heFrozen] < 150000 then 
9666
8dcb25112d96
 Bring back white dot in the center of crosshair. Crosshair is blurred now!
unc0rr
parents:
9655
diff
changeset

1229 
untint; 
8557  1230 
end; 
1231 

1232 

4388  1233 
if cVampiric and 
1234 
(CurrentHedgehog^.Gear <> nil) and 

1235 
(CurrentHedgehog^.Gear = Gear) then 

1236 
begin 

1237 
Tint($FF, 0, 0, max($40, round($FF * abs(1  (RealTicks mod 1500) / 750)))); 

1238 
DrawSprite(sprVampiric, sx  24, sy  24, 0); 

1239 
end; 

9666
8dcb25112d96
 Bring back white dot in the center of crosshair. Crosshair is blurred now!
unc0rr
parents:
9655
diff
changeset

1240 
untint 
4388  1241 
end; 
1242 

1243 

1244 
procedure RenderGear(Gear: PGear; x, y: LongInt); 

1245 
var 

1246 
HHGear: PGear; 

7093  1247 
vg: PVisualGear; 
4388  1248 
i: Longword; 
6788
88036f0e0a92
I think this is a little more efficient than dxdy, and easier to read. We call DxDy2 a lot, can any of those use Angle/DirAngle?
nemo
parents:
6700
diff
changeset

1249 
aAngle: real; 
4388  1250 
startX, endX, startY, endY: LongInt; 
1251 
begin 

14572
34e810295d08
Remove a bunch of dead outcommented code
Wuzzy <Wuzzy2@mail.ru>
parents:
14553
diff
changeset

1252 
// airmine has its own sprite 
13404
8ce83caec236
Make mine active/hunting glow a bit more obvious. Add frozen sprite, increase ice beam mine "hit" radius a bit
nemo
parents:
13399
diff
changeset

1253 
if (Gear^.State and gstFrozen <> 0) and (Gear^.Kind <> gtAirMine) then Tint($A0, $A0, $FF, $FF); 
5612
2638dec1b323
This really should have been a TPoint for consistency
nemo
parents:
5561
diff
changeset

1254 
if Gear^.Target.X <> NoPointX then 
5507
1040c0946ef8
This should make bee/airstrikes play nicer with infinite attack mode
nemo
parents:
5472
diff
changeset

1255 
if Gear^.AmmoType = amBee then 
6999  1256 
DrawSpriteRotatedF(sprTargetBee, Gear^.Target.X + WorldDx, Gear^.Target.Y + WorldDy, 0, 0, (RealTicks shr 3) mod 360) 
8689  1257 
else if Gear^.AmmoType = amIceGun then 
7093  1258 
DrawTextureRotatedF(SpritesData[sprSnowDust].Texture, 1/(1+(RealTicks shr 8) mod 5), 0, 0, Gear^.Target.X + WorldDx, Gear^.Target.Y + WorldDy, (RealTicks shr 2) mod 8, 1, 22, 22, (RealTicks shr 3) mod 360) 
7010
10a0a31804f3
Switch effects to longint for convenience of tracking ice states. I could add a new Hedgehog value, but since we have this effects list being all useless as booleans anyway...
nemo
parents:
6999
diff
changeset

1259 
else 
14395
f39d34d78028
Colorize switching arrows, pointing arrow and target cross in clan color
Wuzzy <Wuzzy2@mail.ru>
parents:
14341
diff
changeset

1260 
begin 
f39d34d78028
Colorize switching arrows, pointing arrow and target cross in clan color
Wuzzy <Wuzzy2@mail.ru>
parents:
14341
diff
changeset

1261 
if CurrentHedgehog <> nil then 
f39d34d78028
Colorize switching arrows, pointing arrow and target cross in clan color
Wuzzy <Wuzzy2@mail.ru>
parents:
14341
diff
changeset

1262 
Tint(CurrentHedgehog^.Team^.Clan^.Color shl 8 or $FF); 
7010
10a0a31804f3
Switch effects to longint for convenience of tracking ice states. I could add a new Hedgehog value, but since we have this effects list being all useless as booleans anyway...
nemo
parents:
6999
diff
changeset

1263 
DrawSpriteRotatedF(sprTargetP, Gear^.Target.X + WorldDx, Gear^.Target.Y + WorldDy, 0, 0, (RealTicks shr 3) mod 360); 
14395
f39d34d78028
Colorize switching arrows, pointing arrow and target cross in clan color
Wuzzy <Wuzzy2@mail.ru>
parents:
14341
diff
changeset

1264 
if CurrentHedgehog <> nil then 
f39d34d78028
Colorize switching arrows, pointing arrow and target cross in clan color
Wuzzy <Wuzzy2@mail.ru>
parents:
14341
diff
changeset

1265 
untint; 
f39d34d78028
Colorize switching arrows, pointing arrow and target cross in clan color
Wuzzy <Wuzzy2@mail.ru>
parents:
14341
diff
changeset

1266 
end; 
5507
1040c0946ef8
This should make bee/airstrikes play nicer with infinite attack mode
nemo
parents:
5472
diff
changeset

1267 

4388  1268 
case Gear^.Kind of 
6999  1269 
gtGrenade: DrawSpriteRotated(sprBomb, x, y, 0, Gear^.DirAngle); 
1270 
gtSnowball: DrawSpriteRotated(sprSnowball, x, y, 0, Gear^.DirAngle); 

1271 
gtGasBomb: DrawSpriteRotated(sprCheese, x, y, 0, Gear^.DirAngle); 

8689  1272 

5871
09daa06191d7
Since we are tweaking molotov. make the flame flickery and add a drowning frame
nemo
parents:
5787
diff
changeset

1273 
gtMolotov: if (Gear^.State and gstDrowning) = 0 then 
6999  1274 
DrawSpriteRotatedF(sprMolotov, x, y, (RealTicks div 125) mod 8, hwSign(Gear^.dX), Gear^.DirAngle * hwSign(Gear^.dX)) 
5871
09daa06191d7
Since we are tweaking molotov. make the flame flickery and add a drowning frame
nemo
parents:
5787
diff
changeset

1275 
else DrawSprite(sprMolotov, x, y, 8); 
4388  1276 

1277 
gtRCPlane: begin 

6788
88036f0e0a92
I think this is a little more efficient than dxdy, and easier to read. We call DxDy2 a lot, can any of those use Angle/DirAngle?
nemo
parents:
6700
diff
changeset

1278 
aangle:= Gear^.Angle * 360 / 4096; 
88036f0e0a92
I think this is a little more efficient than dxdy, and easier to read. We call DxDy2 a lot, can any of those use Angle/DirAngle?
nemo
parents:
6700
diff
changeset

1279 
if Gear^.Tag < 0 then aangle:= 360aangle; 
10032
db65298717da
This adds idle hog tinting. Active hog tinting still needed.
nemo
parents:
10001
diff
changeset

1280 
Tint(Gear^.Tint); 
6999  1281 
DrawSpriteRotatedF(sprPlane, x, y, 0, Gear^.Tag, aangle  90); 
9666
8dcb25112d96
 Bring back white dot in the center of crosshair. Crosshair is blurred now!
unc0rr
parents:
9655
diff
changeset

1282 
untint; 
6999  1283 
DrawSpriteRotatedF(sprPlane, x, y, 1, Gear^.Tag, aangle  90) 
4388  1284 
end; 
6999  1285 
gtBall: DrawSpriteRotatedF(sprBalls, x, y, Gear^.Tag,0, Gear^.DirAngle); 
4388  1286 

13282
b13071610c07
Flying portal balls now spawn a few spark effects
Wuzzy <Wuzzy2@mail.ru>
parents:
13233
diff
changeset

1287 
gtPortal: begin 
b13071610c07
Flying portal balls now spawn a few spark effects
Wuzzy <Wuzzy2@mail.ru>
parents:
13233
diff
changeset

1288 
if ((Gear^.Tag and 1) = 0) // still moving? 
7272
71df899c4163
Second part of the change. Make collision check use the new mask bit.
nemo
parents:
7168
diff
changeset

1289 
or (Gear^.LinkedGear = nil) or (Gear^.LinkedGear^.LinkedGear <> Gear) // not linked&backlinked? 
71df899c4163
Second part of the change. Make collision check use the new mask bit.
nemo
parents:
7168
diff
changeset

1290 
or ((Gear^.LinkedGear^.Tag and 1) = 0) then // linked portal still moving? 
13282
b13071610c07
Flying portal balls now spawn a few spark effects
Wuzzy <Wuzzy2@mail.ru>
parents:
13233
diff
changeset

1291 
DrawSpriteRotatedF(sprPortal, x, y, Gear^.Tag, hwSign(Gear^.dX), Gear^.DirAngle) 
b13071610c07
Flying portal balls now spawn a few spark effects
Wuzzy <Wuzzy2@mail.ru>
parents:
13233
diff
changeset

1292 
else 
b13071610c07
Flying portal balls now spawn a few spark effects
Wuzzy <Wuzzy2@mail.ru>
parents:
13233
diff
changeset

1293 
DrawSpriteRotatedF(sprPortal, x, y, 4 + Gear^.Tag div 2, hwSign(Gear^.dX), Gear^.DirAngle); 
b13071610c07
Flying portal balls now spawn a few spark effects
Wuzzy <Wuzzy2@mail.ru>
parents:
13233
diff
changeset

1294 

b13071610c07
Flying portal balls now spawn a few spark effects
Wuzzy <Wuzzy2@mail.ru>
parents:
13233
diff
changeset

1295 
// Portal ball trace effects 
b13071610c07
Flying portal balls now spawn a few spark effects
Wuzzy <Wuzzy2@mail.ru>
parents:
13233
diff
changeset

1296 
if ((Gear^.Tag and 1) = 0) and ((GameTicks mod 4) = 0) and (not isPaused) then 
b13071610c07
Flying portal balls now spawn a few spark effects
Wuzzy <Wuzzy2@mail.ru>
parents:
13233
diff
changeset

1297 
begin 
b13071610c07
Flying portal balls now spawn a few spark effects
Wuzzy <Wuzzy2@mail.ru>
parents:
13233
diff
changeset

1298 
vg:= AddVisualGear(hwRound(Gear^.X), hwRound(Gear^.Y), vgtDust, 1); 
13328
2489c36c61b7
Fix crash when firing portal gun at low quality graphics
Wuzzy <Wuzzy2@mail.ru>
parents:
13282
diff
changeset

1299 
if vg <> nil then 
2489c36c61b7
Fix crash when firing portal gun at low quality graphics
Wuzzy <Wuzzy2@mail.ru>
parents:
13282
diff
changeset

1300 
if Gear^.Tag = 0 then 
2489c36c61b7
Fix crash when firing portal gun at low quality graphics
Wuzzy <Wuzzy2@mail.ru>
parents:
13282
diff
changeset

1301 
vg^.Tint:= $fab02ab0 
2489c36c61b7
Fix crash when firing portal gun at low quality graphics
Wuzzy <Wuzzy2@mail.ru>
parents:
13282
diff
changeset

1302 
else if Gear^.Tag = 2 then 
2489c36c61b7
Fix crash when firing portal gun at low quality graphics
Wuzzy <Wuzzy2@mail.ru>
parents:
13282
diff
changeset

1303 
vg^.Tint:= $364df7b0; 
13282
b13071610c07
Flying portal balls now spawn a few spark effects
Wuzzy <Wuzzy2@mail.ru>
parents:
13233
diff
changeset

1304 
end; 
b13071610c07
Flying portal balls now spawn a few spark effects
Wuzzy <Wuzzy2@mail.ru>
parents:
13233
diff
changeset

1305 
end; 
4388  1306 

1307 
gtDrill: if (Gear^.State and gsttmpFlag) <> 0 then 

6999  1308 
DrawSpriteRotated(sprAirDrill, x, y, 0, DxDy2Angle(Gear^.dY, Gear^.dX)) 
4388  1309 
else 
6999  1310 
DrawSpriteRotated(sprDrill, x, y, 0, DxDy2Angle(Gear^.dY, Gear^.dX)); 
4388  1311 

1312 
gtHedgehog: DrawHH(Gear, x, y); 

1313 

6999  1314 
gtShell: DrawSpriteRotated(sprBazookaShell, x, y, 0, DxDy2Angle(Gear^.dY, Gear^.dX)); 
4388  1315 

1316 
gtGrave: begin 

12849
40c410cd6402
rock the duck a bit  also replace a few other values with realtick that seemed like they should probably animate in pause
nemo
parents:
12764
diff
changeset

1317 
DrawTextureF(Gear^.Hedgehog^.Team^.GraveTex, 1, x, y, (RealTicks shr 7+Gear^.uid) and 15, 1, 32, 32); 
4388  1318 
if Gear^.Health > 0 then 
1319 
begin 

12849
40c410cd6402
rock the duck a bit  also replace a few other values with realtick that seemed like they should probably animate in pause
nemo
parents:
12764
diff
changeset

1320 
Tint($f5, $db, $35, max($40, round($FF * abs(1  (RealTicks mod 1500) / (750 + Gear^.Health))))); 
4388  1321 
DrawSprite(sprVampiric, x  24, y  24, 0); 
9666
8dcb25112d96
 Bring back white dot in the center of crosshair. Crosshair is blurred now!
unc0rr
parents:
9655
diff
changeset

1322 
untint 
4388  1323 
end 
1324 
end; 

12849
40c410cd6402
rock the duck a bit  also replace a few other values with realtick that seemed like they should probably animate in pause
nemo
parents:
12764
diff
changeset

1325 
gtBee: DrawSpriteRotatedF(sprBee, x, y, (RealTicks shr 5) mod 2, 0, DxDy2Angle(Gear^.dY, Gear^.dX)); 
4388  1326 
gtPickHammer: DrawSprite(sprPHammer, x  16, y  50 + LongInt(((GameTicks shr 5) and 1) * 2), 0); 
1327 
gtRope: DrawRope(Gear); 

8689  1328 

9041
aefe46d64dd9
Make frozen crates uncollectable, add some tinting to frozen items. Suggestions needed for what should happen to explosives
nemo
parents:
8854
diff
changeset

1329 
gtMine: begin 
aefe46d64dd9
Make frozen crates uncollectable, add some tinting to frozen items. Suggestions needed for what should happen to explosives
nemo
parents:
8854
diff
changeset

1330 
if (((Gear^.State and gstAttacking) = 0)or((Gear^.Timer and $3FF) < 420)) and (Gear^.Health <> 0) then 
6999  1331 
DrawSpriteRotated(sprMineOff, x, y, 0, Gear^.DirAngle) 
9041
aefe46d64dd9
Make frozen crates uncollectable, add some tinting to frozen items. Suggestions needed for what should happen to explosives
nemo
parents:
8854
diff
changeset

1332 
else if Gear^.Health <> 0 then 
aefe46d64dd9
Make frozen crates uncollectable, add some tinting to frozen items. Suggestions needed for what should happen to explosives
nemo
parents:
8854
diff
changeset

1333 
DrawSpriteRotated(sprMineOn, x, y, 0, Gear^.DirAngle) 
aefe46d64dd9
Make frozen crates uncollectable, add some tinting to frozen items. Suggestions needed for what should happen to explosives
nemo
parents:
8854
diff
changeset

1334 
else DrawSpriteRotated(sprMineDead, x, y, 0, Gear^.DirAngle); 
aefe46d64dd9
Make frozen crates uncollectable, add some tinting to frozen items. Suggestions needed for what should happen to explosives
nemo
parents:
8854
diff
changeset

1335 
end; 
13404
8ce83caec236
Make mine active/hunting glow a bit more obvious. Add frozen sprite, increase ice beam mine "hit" radius a bit
nemo
parents:
13399
diff
changeset

1336 
gtAirMine: 
14341
d5317635f368
fix bounds check, make out of bounds air mines fall since there's no land to check them into
nemo
parents:
14286
diff
changeset

1337 
if (Gear^.State and gstFrozen <> 0) then 
d5317635f368
fix bounds check, make out of bounds air mines fall since there's no land to check them into
nemo
parents:
14286
diff
changeset

1338 
DrawSprite(sprFrozenAirMine, x16, y16, 0) 
d5317635f368
fix bounds check, make out of bounds air mines fall since there's no land to check them into
nemo
parents:
14286
diff
changeset

1339 
else if (Gear^.Tag <> 0) then 
14200  1340 
DrawSprite(sprAirMine, x16, y16, 16 + ((RealTicks div 50 + Gear^.Uid) mod 16)) 
13404
8ce83caec236
Make mine active/hunting glow a bit more obvious. Add frozen sprite, increase ice beam mine "hit" radius a bit
nemo
parents:
13399
diff
changeset

1341 
else if (Gear^.State and gstTmpFlag = 0) then // mine is inactive 
10807
66cde98f8cbe
Make the various mine states a bit clearer (inactive, active but not in seek mode, seek mode, chasing target)
nemo
parents:
10800
diff
changeset

1342 
begin 
13399  1343 
if (Gear^.State and gstTmpFlag = 0) then Tint(150,150,150,255); 
10807
66cde98f8cbe
Make the various mine states a bit clearer (inactive, active but not in seek mode, seek mode, chasing target)
nemo
parents:
10800
diff
changeset

1344 
DrawSprite(sprAirMine, x16, y16, 15); 
66cde98f8cbe
Make the various mine states a bit clearer (inactive, active but not in seek mode, seek mode, chasing target)
nemo
parents:
10800
diff
changeset

1345 
untint 
66cde98f8cbe
Make the various mine states a bit clearer (inactive, active but not in seek mode, seek mode, chasing target)
nemo
parents:
10800
diff
changeset

1346 
end 
66cde98f8cbe
Make the various mine states a bit clearer (inactive, active but 