36 rounded : array[0..MAXROPEPOINTS + 2] of TVertex2f; |
36 rounded : array[0..MAXROPEPOINTS + 2] of TVertex2f; |
37 end; |
37 end; |
38 procedure RenderGear(Gear: PGear; x, y: LongInt); |
38 procedure RenderGear(Gear: PGear; x, y: LongInt); |
39 procedure RenderGearTimer(Gear: PGear; x, y: LongInt); |
39 procedure RenderGearTimer(Gear: PGear; x, y: LongInt); |
40 procedure RenderGearHealth(Gear: PGear; x, y: LongInt); |
40 procedure RenderGearHealth(Gear: PGear; x, y: LongInt); |
|
41 procedure RenderFinger(Gear: PGear; ox, oy: LongInt); |
41 procedure RenderHHGuiExtras(Gear: PGear; ox, oy: LongInt); |
42 procedure RenderHHGuiExtras(Gear: PGear; ox, oy: LongInt); |
42 procedure RenderAirMineGuiExtras(Gear: PGear; ox, oy: LongInt); |
43 procedure RenderAirMineGuiExtras(Gear: PGear; ox, oy: LongInt); |
43 procedure DrawHHOrder(); |
44 procedure DrawHHOrder(); |
44 |
45 |
45 var RopePoints: record |
46 var RopePoints: record |
236 until (i > cMaxHHIndex); |
237 until (i > cMaxHHIndex); |
237 end |
238 end |
238 |
239 |
239 end; |
240 end; |
240 |
241 |
|
242 procedure RenderFinger(Gear: PGear; ox, oy: LongInt); |
|
243 var HH: PHedgehog; |
|
244 tx, ty, t: LongInt; |
|
245 dAngle: real; |
|
246 begin |
|
247 HH:= Gear^.Hedgehog; |
|
248 if HH^.Unplaced then |
|
249 exit; |
|
250 if (Gear^.State and gstHHDeath) <> 0 then |
|
251 exit; |
|
252 if (Gear^.State and gstHHGone) <> 0 then |
|
253 exit; |
|
254 if (CinematicScript) then |
|
255 exit; |
|
256 |
|
257 // render finger (arrow pointing to hog) |
|
258 if bShowFinger and ((Gear^.State and gstHHDriven) <> 0) then |
|
259 begin |
|
260 ty := oy - 32; |
|
261 // move finger higher up if tags or switching arrows are above hog |
|
262 if (cTagsMask and htTeamName) <> 0 then |
|
263 ty := ty - HH^.Team^.NameTagTex^.h - 2; |
|
264 if (cTagsMask and htName) <> 0 then |
|
265 ty := ty - HH^.NameTagTex^.h - 2; |
|
266 if (cTagsMask and htHealth) <> 0 then |
|
267 ty := ty - HH^.HealthTagTex^.h - 2; |
|
268 if bShowSwitcher then |
|
269 ty := ty - SpritesData[sprSwitch].Height - 4; |
|
270 tx := ox; |
|
271 |
|
272 // don't go offscreen |
|
273 t:= 32; |
|
274 tx := min(max(tx, ViewLeftX + t), ViewRightX - t); |
|
275 ty := min(ty, ViewBottomY - 96); |
|
276 // don't overlap with HH or HH tags |
|
277 if ty < ViewTopY + t then |
|
278 begin |
|
279 if abs(tx - ox) < abs(ty - oy) then |
|
280 ty:= max(ViewTopY + t, oy + t) |
|
281 else |
|
282 ty:= max(ViewTopY + t, ty); |
|
283 end; |
|
284 |
|
285 dAngle := DxDy2Angle(int2hwfloat(ty - oy), int2hwfloat(tx - ox)) + 90; |
|
286 |
|
287 if (IsTooDarkToRead(HH^.Team^.Clan^.Color)) then |
|
288 DrawSpriteRotatedF(sprFingerBackInv, tx, ty, RealTicks div 32 mod 16, 1, dAngle) |
|
289 else |
|
290 DrawSpriteRotatedF(sprFingerBack, tx, ty, RealTicks div 32 mod 16, 1, dAngle); |
|
291 Tint(HH^.Team^.Clan^.Color shl 8 or $FF); |
|
292 DrawSpriteRotatedF(sprFinger, tx, ty, RealTicks div 32 mod 16, 1, dAngle); |
|
293 untint; |
|
294 end; |
|
295 end; |
|
296 |
|
297 |
241 // Render some informational GUI next to hedgehog, like fuel and alternate weapon |
298 // Render some informational GUI next to hedgehog, like fuel and alternate weapon |
242 procedure RenderHHGuiExtras(Gear: PGear; ox, oy: LongInt); |
299 procedure RenderHHGuiExtras(Gear: PGear; ox, oy: LongInt); |
243 var HH: PHedgehog; |
300 var HH: PHedgehog; |
244 sx, sy, tx, ty, t, hogLR: LongInt; |
301 sx, sy, hogLR: LongInt; |
245 dAngle: real; |
|
246 begin |
302 begin |
247 HH:= Gear^.Hedgehog; |
303 HH:= Gear^.Hedgehog; |
248 sx:= ox + 1; // this offset is very common |
304 sx:= ox + 1; // this offset is very common |
249 sy:= oy - 3; |
305 sy:= oy - 3; |
250 if HH^.Unplaced then |
306 if HH^.Unplaced then |
253 exit; |
309 exit; |
254 if (Gear^.State and gstHHGone) <> 0 then |
310 if (Gear^.State and gstHHGone) <> 0 then |
255 exit; |
311 exit; |
256 if (CinematicScript) then |
312 if (CinematicScript) then |
257 exit; |
313 exit; |
258 |
|
259 // render finger (pointing arrow) |
|
260 if bShowFinger and ((Gear^.State and gstHHDriven) <> 0) then |
|
261 begin |
|
262 ty := oy - 32; |
|
263 // move finger higher up if tags are above hog |
|
264 if (cTagsMask and htTeamName) <> 0 then |
|
265 ty := ty - HH^.Team^.NameTagTex^.h - 2; |
|
266 if (cTagsMask and htName) <> 0 then |
|
267 ty := ty - HH^.NameTagTex^.h - 2; |
|
268 if (cTagsMask and htHealth) <> 0 then |
|
269 ty := ty - HH^.HealthTagTex^.h - 2; |
|
270 tx := ox; |
|
271 |
|
272 // don't go offscreen |
|
273 t:= 32; |
|
274 tx := min(max(tx, ViewLeftX + t), ViewRightX - t); |
|
275 ty := min(ty, ViewBottomY - 96); |
|
276 // don't overlap with HH or HH tags |
|
277 if ty < ViewTopY + t then |
|
278 begin |
|
279 if abs(tx - ox) < abs(ty - oy) then |
|
280 ty:= max(ViewTopY + t, oy + t) |
|
281 else |
|
282 ty:= max(ViewTopY + t, ty); |
|
283 end; |
|
284 |
|
285 dAngle := DxDy2Angle(int2hwfloat(ty - oy), int2hwfloat(tx - ox)) + 90; |
|
286 |
|
287 if (IsTooDarkToRead(HH^.Team^.Clan^.Color)) then |
|
288 DrawSpriteRotatedF(sprFingerBackInv, tx, ty, RealTicks div 32 mod 16, 1, dAngle) |
|
289 else |
|
290 DrawSpriteRotatedF(sprFingerBack, tx, ty, RealTicks div 32 mod 16, 1, dAngle); |
|
291 Tint(HH^.Team^.Clan^.Color shl 8 or $FF); |
|
292 DrawSpriteRotatedF(sprFinger, tx, ty, RealTicks div 32 mod 16, 1, dAngle); |
|
293 untint; |
|
294 end; |
|
295 |
314 |
296 // render crosshair |
315 // render crosshair |
297 if (CrosshairGear <> nil) and (Gear = CrosshairGear) then |
316 if (CrosshairGear <> nil) and (Gear = CrosshairGear) then |
298 begin |
317 begin |
299 hogLR:= 1; |
318 hogLR:= 1; |
1294 var |
1313 var |
1295 HHGear: PGear; |
1314 HHGear: PGear; |
1296 vg: PVisualGear; |
1315 vg: PVisualGear; |
1297 i: Longword; |
1316 i: Longword; |
1298 aAngle: real; |
1317 aAngle: real; |
1299 startX, endX, startY, endY: LongInt; |
1318 startX, endX, startY, endY, ty: LongInt; |
1300 begin |
1319 begin |
1301 // airmine has its own sprite |
1320 // airmine has its own sprite |
1302 if (Gear^.State and gstFrozen <> 0) and (Gear^.Kind <> gtAirMine) then Tint($A0, $A0, $FF, $FF); |
1321 if (Gear^.State and gstFrozen <> 0) and (Gear^.Kind <> gtAirMine) then Tint($A0, $A0, $FF, $FF); |
1303 if Gear^.Target.X <> NoPointX then |
1322 if Gear^.Target.X <> NoPointX then |
1304 if Gear^.AmmoType = amBee then |
1323 if Gear^.AmmoType = amBee then |
1541 DrawSpriteRotatedF(sprTeleport, hwRound(HHGear^.X) + 1 + WorldDx, hwRound(HHGear^.Y) - 3 + WorldDy, 11 - Gear^.Pos, hwSign(HHGear^.dX), 0) |
1560 DrawSpriteRotatedF(sprTeleport, hwRound(HHGear^.X) + 1 + WorldDx, hwRound(HHGear^.Y) - 3 + WorldDy, 11 - Gear^.Pos, hwSign(HHGear^.dX), 0) |
1542 end |
1561 end |
1543 end; |
1562 end; |
1544 gtSwitcher: begin |
1563 gtSwitcher: begin |
1545 setTintAdd(true); |
1564 setTintAdd(true); |
|
1565 if IsTooDarkToRead(Gear^.Hedgehog^.Team^.Clan^.Color) then |
|
1566 Tint($FFFFFFFF) |
|
1567 else |
|
1568 Tint($000000FF); |
|
1569 |
|
1570 ty := y - SpritesData[sprSwitch].Height; |
|
1571 // Move higher up if hedgehog tags are visible. |
|
1572 // This happens when finger is active. The finger is then moved above the switching arrows. |
|
1573 if bShowFinger then |
|
1574 begin |
|
1575 if (cTagsMask and htTeamName) <> 0 then |
|
1576 ty := ty - Gear^.Hedgehog^.Team^.NameTagTex^.h - 2; |
|
1577 if (cTagsMask and htName) <> 0 then |
|
1578 ty := ty - Gear^.Hedgehog^.NameTagTex^.h - 2; |
|
1579 if (cTagsMask and htHealth) <> 0 then |
|
1580 ty := ty - Gear^.Hedgehog^.HealthTagTex^.h - 2; |
|
1581 if (cTagsMask and (htTeamName or htName or htHealth)) <> 0 then |
|
1582 ty := ty - 4; |
|
1583 end; |
|
1584 |
|
1585 DrawSpriteRotatedF(sprSwitch, x + 1, ty, 1, 0, (RealTicks div 5) mod 360); |
|
1586 |
1546 Tint(Gear^.Hedgehog^.Team^.Clan^.Color shl 8 or $FF); |
1587 Tint(Gear^.Hedgehog^.Team^.Clan^.Color shl 8 or $FF); |
1547 DrawSprite(sprSwitch, x - 16, y - 56, (RealTicks shr 6) mod 12); |
1588 DrawSpriteRotatedF(sprSwitch, x + 1, ty, 0, 0, (RealTicks div 5) mod 360); |
1548 untint; |
1589 untint; |
1549 setTintAdd(false); |
1590 setTintAdd(false); |
1550 end; |
1591 end; |
1551 gtTarget: begin |
1592 gtTarget: begin |
1552 Tint($FF, $FF, $FF, round($FF * Gear^.Timer / 1000)); |
1593 Tint($FF, $FF, $FF, round($FF * Gear^.Timer / 1000)); |