1 (* Copyright (C) Doom 2D: Forever Developers
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, version 3 of the License ONLY.
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
12 * You should have received a copy of the GNU General Public License
13 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 {$INCLUDE ../../shared/a_modes.inc}
20 uses g_player
, g_base
; // TPlayer, TRGB
22 procedure r_Player_DrawAll
;
23 procedure r_Player_DrawDebug (p
: TPlayer
);
24 procedure r_Player_DrawHealth
;
26 procedure r_Player_DrawCorpses
;
27 procedure r_Player_DrawShells
;
29 procedure r_Player_Draw (p
: TPlayer
);
30 procedure r_Player_DrawIndicator (p
: TPlayer
; Color
: TRGB
);
31 procedure r_Player_DrawBubble (p
: TPlayer
);
32 procedure r_Player_DrawAim (p
: TPlayer
);
33 procedure r_Player_DrawGUI (pl
: TPlayer
);
34 procedure r_Player_DrawRulez (p
: TPlayer
);
35 procedure r_Player_DrawPain (p
: TPlayer
);
36 procedure r_Player_DrawPickup (p
: TPlayer
);
38 procedure r_Player_DrawCorpse (p
: TCorpse
);
43 SysUtils
, Classes
, Math
,
45 g_basic
, g_game
, g_phys
, g_map
, g_textures
, g_menu
, g_language
, g_weapons
, g_items
, g_net
, g_options
,
46 {$IFDEF ENABLE_HOLMES}
49 r_playermodel
, r_graphics
52 procedure r_Player_DrawAll
;
55 if gPlayers
<> nil then
56 for i
:= 0 to High(gPlayers
) do
57 if gPlayers
[i
] <> nil then
58 r_Player_Draw(gPlayers
[i
])
61 procedure r_Player_DrawDebug (p
: TPlayer
);
66 if (@p
.Obj
) = nil then Exit
;
68 e_TextureFontGetSize(gStdFont
, fW
, fH
);
70 e_TextureFontPrint(0, 0 , 'Pos X: ' + IntToStr(p
.Obj
.X
), gStdFont
);
71 e_TextureFontPrint(0, fH
, 'Pos Y: ' + IntToStr(p
.Obj
.Y
), gStdFont
);
72 e_TextureFontPrint(0, fH
* 2, 'Vel X: ' + IntToStr(p
.Obj
.Vel
.X
), gStdFont
);
73 e_TextureFontPrint(0, fH
* 3, 'Vel Y: ' + IntToStr(p
.Obj
.Vel
.Y
), gStdFont
);
74 e_TextureFontPrint(0, fH
* 4, 'Acc X: ' + IntToStr(p
.Obj
.Accel
.X
), gStdFont
);
75 e_TextureFontPrint(0, fH
* 5, 'Acc Y: ' + IntToStr(p
.Obj
.Accel
.Y
), gStdFont
);
76 e_TextureFontPrint(0, fH
* 6, 'Old X: ' + IntToStr(p
.Obj
.oldX
), gStdFont
);
77 e_TextureFontPrint(0, fH
* 7, 'Old Y: ' + IntToStr(p
.Obj
.oldY
), gStdFont
);
80 procedure r_Player_DrawHealth
;
85 if gPlayers
= nil then Exit
;
86 e_TextureFontGetSize(gStdFont
, fW
, fH
);
88 for i
:= 0 to High(gPlayers
) do
89 if gPlayers
[i
] <> nil then
91 e_TextureFontPrint(gPlayers
[i
].Obj
.X
+ gPlayers
[i
].Obj
.Rect
.X
,
92 gPlayers
[i
].Obj
.Y
+ gPlayers
[i
].Obj
.Rect
.Y
+ gPlayers
[i
].Obj
.Rect
.Height
- fH
* 2,
93 IntToStr(gPlayers
[i
].Health
), gStdFont
);
94 e_TextureFontPrint(gPlayers
[i
].Obj
.X
+ gPlayers
[i
].Obj
.Rect
.X
,
95 gPlayers
[i
].Obj
.Y
+ gPlayers
[i
].Obj
.Rect
.Y
+ gPlayers
[i
].Obj
.Rect
.Height
- fH
,
96 IntToStr(gPlayers
[i
].Armor
), gStdFont
);
100 procedure r_Player_DrawCorpses
;
106 for i
:= 0 to High(gGibs
) do
107 if gGibs
[i
].alive
then
110 if not g_Obj_Collide(sX
, sY
, sWidth
, sHeight
, @Obj
) then
113 Obj
.lerp(gLerpFactor
, fX
, fY
);
115 a
.X
:= Obj
.Rect
.X
+(Obj
.Rect
.Width
div 2);
116 a
.y
:= Obj
.Rect
.Y
+(Obj
.Rect
.Height
div 2);
118 e_DrawAdv(ID
, fX
, fY
, 0, True, False, RAngle
, @a
, TMirrorType
.None
);
121 e_DrawAdv(MaskID
, fX
, fY
, 0, True, False, RAngle
, @a
, TMirrorType
.None
);
127 if gCorpses
<> nil then
128 for i
:= 0 to High(gCorpses
) do
129 if gCorpses
[i
] <> nil then
130 r_Player_DrawCorpse(gCorpses
[i
])
133 procedure r_Player_DrawShells
;
138 if gShells
<> nil then
139 for i
:= 0 to High(gShells
) do
140 if gShells
[i
].alive
then
143 if not g_Obj_Collide(sX
, sY
, sWidth
, sHeight
, @Obj
) then
146 Obj
.lerp(gLerpFactor
, fX
, fY
);
151 e_DrawAdv(SpriteID
, fX
, fY
, 0, True, False, RAngle
, @a
, TMirrorType
.None
);
155 procedure r_Player_DrawIndicator (p
: TPlayer
; Color
: TRGB
);
157 indX
, indY
, fX
, fY
, fSlope
: Integer;
167 p
.Obj
.lerp(gLerpFactor
, fX
, fY
);
168 fSlope
:= nlerp(p
.SlopeOld
, p
.Obj
.slopeUpLeft
, gLerpFactor
);
170 case gPlayerIndicatorStyle
of
173 if g_Texture_Get('TEXTURE_PLAYER_INDICATOR', ID
) then
175 e_GetTextureSize(ID
, @indW
, @indH
);
179 if (p
.Obj
.X
+ p
.Obj
.Rect
.X
) < 0 then
182 indX
:= fX
+ p
.Obj
.Rect
.X
+ p
.Obj
.Rect
.Width
;
183 indY
:= fY
+ p
.Obj
.Rect
.Y
+ (p
.Obj
.Rect
.Height
- indW
) div 2;
186 else if (p
.Obj
.X
+ p
.Obj
.Rect
.X
+ p
.Obj
.Rect
.Width
) > Max(gMapInfo
.Width
, gPlayerScreenSize
.X
) then
189 indX
:= fX
+ p
.Obj
.Rect
.X
- indH
;
190 indY
:= fY
+ p
.Obj
.Rect
.Y
+ (p
.Obj
.Rect
.Height
- indW
) div 2;
193 else if (p
.Obj
.Y
- indH
) < 0 then
196 indX
:= fX
+ p
.Obj
.Rect
.X
+ (p
.Obj
.Rect
.Width
- indW
) div 2;
197 indY
:= fY
+ p
.Obj
.Rect
.Y
+ p
.Obj
.Rect
.Height
;
203 indX
:= fX
+ p
.Obj
.Rect
.X
+ (p
.Obj
.Rect
.Width
- indW
) div 2;
207 indY
:= indY
+ fSlope
;
208 indX
:= EnsureRange(indX
, 0, Max(gMapInfo
.Width
, gPlayerScreenSize
.X
) - indW
);
209 indY
:= EnsureRange(indY
, 0, Max(gMapInfo
.Height
, gPlayerScreenSize
.Y
) - indH
);
213 e_DrawAdv(ID
, indX
, indY
, 0, True, False, indA
, @a
);
220 e_TextureFontGetSize(gStdFont
, nW
, nH
);
221 indX
:= fX
+ p
.Obj
.Rect
.X
+ (p
.Obj
.Rect
.Width
- Length(p
.Name
) * nW
) div 2;
222 indY
:= fY
- nH
+ fSlope
;
223 e_TextureFontPrintEx(indX
, indY
, p
.Name
, gStdFont
, Color
.R
, Color
.G
, Color
.B
, 1.0, True);
229 procedure r_Player_DrawBubble (p
: TPlayer
);
231 bubX
, bubY
, fX
, fY
: Integer;
234 Rw
, Gw
, Bw
: SmallInt;
238 CObj
:= p
.getCameraObj();
239 CObj
.lerp(gLerpFactor
, fX
, fY
);
240 // NB: _F_Obj.Rect is used to keep the bubble higher; this is not a mistake
241 bubX
:= fX
+ p
.Obj
.Rect
.X
+ IfThen(p
.Direction
= TDirection
.D_LEFT
, -4, 18);
242 bubY
:= fY
+ p
.Obj
.Rect
.Y
- 18;
250 1: // simple textual non-bubble
252 bubX
:= fX
+ p
.Obj
.Rect
.X
- 11;
253 bubY
:= fY
+ p
.Obj
.Rect
.Y
- 17;
254 e_TextureFontPrint(bubX
, bubY
, '[...]', gStdFont
);
257 2: // advanced pixel-perfect bubble
259 if p
.Team
= TEAM_RED
then
262 if p
.Team
= TEAM_BLUE
then
267 Rb
:= p
.Model
.Color
.R
;
268 Gb
:= p
.Model
.Color
.G
;
269 Bb
:= p
.Model
.Color
.B
;
270 Rw
:= Min(Rb
* 2 + 64, 255);
271 Gw
:= Min(Gb
* 2 + 64, 255);
272 Bw
:= Min(Bb
* 2 + 64, 255);
273 if (Abs(Rw
- Rb
) < 32)
274 or (Abs(Gw
- Gb
) < 32)
275 or (Abs(Bw
- Bb
) < 32) then
277 Rb
:= Max(Rw
div 2 - 16, 0);
278 Gb
:= Max(Gw
div 2 - 16, 0);
279 Bb
:= Max(Bw
div 2 - 16, 0);
282 4: // custom textured bubble
284 if g_Texture_Get('TEXTURE_PLAYER_TALKBUBBLE', ID
) then
285 if p
.Direction
= TDirection
.D_RIGHT
then
286 e_Draw(ID
, bubX
- 6, bubY
- 7, 0, True, False)
288 e_Draw(ID
, bubX
- 6, bubY
- 7, 0, True, False, TMirrorType
.Horizontal
);
294 e_DrawQuad(bubX
+ 1, bubY
, bubX
+ 18, bubY
+ 13, Rb
, Gb
, Bb
);
295 e_DrawQuad(bubX
, bubY
+ 1, bubX
+ 19, bubY
+ 12, Rb
, Gb
, Bb
);
297 e_DrawFillQuad(bubX
+ 1, bubY
+ 1, bubX
+ 18, bubY
+ 12, Rw
, Gw
, Bw
, 0);
300 Dot
:= IfThen(p
.Direction
= TDirection
.D_LEFT
, 14, 5);
301 e_DrawLine(1, bubX
+ Dot
, bubY
+ 14, bubX
+ Dot
, bubY
+ 16, Rb
, Gb
, Bb
);
302 e_DrawLine(1, bubX
+ IfThen(p
.Direction
= TDirection
.D_LEFT
, Dot
- 1, Dot
+ 1), bubY
+ 13, bubX
+ IfThen(p
.Direction
= TDirection
.D_LEFT
, Dot
- 1, Dot
+ 1), bubY
+ 15, Rw
, Gw
, Bw
);
303 e_DrawLine(1, bubX
+ IfThen(p
.Direction
= TDirection
.D_LEFT
, Dot
- 2, Dot
+ 2), bubY
+ 13, bubX
+ IfThen(p
.Direction
= TDirection
.D_LEFT
, Dot
- 2, Dot
+ 2), bubY
+ 14, Rw
, Gw
, Bw
);
304 e_DrawLine(1, bubX
+ IfThen(p
.Direction
= TDirection
.D_LEFT
, Dot
- 3, Dot
+ 3), bubY
+ 13, bubX
+ IfThen(p
.Direction
= TDirection
.D_LEFT
, Dot
- 3, Dot
+ 3), bubY
+ 13, Rw
, Gw
, Bw
);
305 e_DrawLine(1, bubX
+ IfThen(p
.Direction
= TDirection
.D_LEFT
, Dot
- 3, Dot
+ 3), bubY
+ 14, bubX
+ IfThen(p
.Direction
= TDirection
.D_LEFT
, Dot
- 1, Dot
+ 1), bubY
+ 16, Rb
, Gb
, Bb
);
309 e_DrawFillQuad(bubX
+ Dot
, bubY
+ 8, bubX
+ Dot
+ 1, bubY
+ 9, Rb
, Gb
, Bb
, 0);
310 e_DrawFillQuad(bubX
+ Dot
+ 3, bubY
+ 8, bubX
+ Dot
+ 4, bubY
+ 9, Rb
, Gb
, Bb
, 0);
311 e_DrawFillQuad(bubX
+ Dot
+ 6, bubY
+ 8, bubX
+ Dot
+ 7, bubY
+ 9, Rb
, Gb
, Bb
, 0);
314 procedure r_Player_Draw (p
: TPlayer
);
320 fX
, fY
, fSlope
: Integer;
322 p
.Obj
.lerp(gLerpFactor
, fX
, fY
);
323 fSlope
:= nlerp(p
.SlopeOld
, p
.Obj
.slopeUpLeft
, gLerpFactor
);
327 if p
.Direction
= TDirection
.D_RIGHT
then
328 Mirror
:= TMirrorType
.None
330 Mirror
:= TMirrorType
.Horizontal
;
332 if p
.PunchAnim
<> nil then
334 p
.PunchAnim
.Draw(fX
+ IfThen(p
.Direction
= TDirection
.D_LEFT
, 15 - p
.Obj
.Rect
.X
, p
.Obj
.Rect
.X
- 15), fY
+ fSlope
+ p
.Obj
.Rect
.Y
- 11, Mirror
);
335 if p
.PunchAnim
.played
then
342 if (p
.FMegaRulez
[MR_INVUL
] > gTime
) and ((gPlayerDrawn
<> p
) or (p
.SpawnInvul
>= gTime
)) then
343 if g_Texture_Get('TEXTURE_PLAYER_INVULPENTA', ID
) then
345 e_GetTextureSize(ID
, @w
, @h
);
346 if p
.Direction
= TDirection
.D_LEFT
then
347 e_Draw(ID
, fX
+ p
.Obj
.Rect
.X
+ (p
.Obj
.Rect
.Width
div 2) - (w
div 2) + 4,
348 fY
+ p
.Obj
.Rect
.Y
+ (p
.Obj
.Rect
.Height
div 2) - (h
div 2) - 7 + fSlope
, 0, True, False)
350 e_Draw(ID
, fX
+ p
.Obj
.Rect
.X
+ (p
.Obj
.Rect
.Width
div 2) - (w
div 2) - 2,
351 fY
+ p
.Obj
.Rect
.Y
+ (p
.Obj
.Rect
.Height
div 2) - (h
div 2) - 7 + fSlope
, 0, True, False)
354 if p
.FMegaRulez
[MR_INVIS
] > gTime
then
356 if (gPlayerDrawn
<> nil) and ((p
= gPlayerDrawn
) or
357 ((p
.Team
= gPlayerDrawn
.Team
) and (gGameSettings
.GameMode
<> GM_DM
))) then
359 if (p
.FMegaRulez
[MR_INVIS
] - gTime
) <= 2100 then
360 dr
:= not Odd((p
.FMegaRulez
[MR_INVIS
] - gTime
) div 300)
364 r_PlayerModel_Draw(p
.Model
, fX
, fY
+ fSlope
, 200)
366 r_PlayerModel_Draw(p
.Model
, fX
, fY
+ fSlope
);
369 r_PlayerModel_Draw(p
.Model
, fX
, fY
+ fSlope
, 254);
372 r_PlayerModel_Draw(p
.Model
, fX
, fY
+ fSlope
);
375 if g_debug_Frames
then
377 e_DrawQuad(p
.Obj
.X
+ p
.Obj
.Rect
.X
,
378 p
.Obj
.Y
+ p
.Obj
.Rect
.Y
,
379 p
.Obj
.X
+ p
.Obj
.Rect
.X
+ p
.Obj
.Rect
.Width
- 1,
380 p
.Obj
.Y
+ p
.Obj
.Rect
.Y
+ p
.Obj
.Rect
.Height
- 1,
384 if (gChatBubble
> 0) and (p
.FKeys
[KEY_CHAT
].Pressed
) and not p
.Ghost
then
385 if (p
.FMegaRulez
[MR_INVIS
] <= gTime
) or ((gPlayerDrawn
<> nil) and ((p
= gPlayerDrawn
) or
386 ((p
.Team
= gPlayerDrawn
.Team
) and (gGameSettings
.GameMode
<> GM_DM
)))) then
387 r_Player_DrawBubble(p
);
389 // e_DrawPoint(5, 335, 288, 255, 0, 0); // DL, UR, DL, UR
390 if gAimLine
and p
.Alive
and ((p
= gPlayer1
) or (p
= gPlayer2
)) then
394 procedure r_Player_DrawAim (p
: TPlayer
);
396 procedure drawCast (sz
: Integer; ax0
, ay0
, ax1
, ay1
: Integer);
401 {$IFDEF ENABLE_HOLMES}
402 if p
.isValidViewPort() and (p
= gPlayer1
) then
404 g_Holmes_plrLaser(ax0
, ay0
, ax1
, ay1
);
408 e_DrawLine(sz
, ax0
, ay0
, ax1
, ay1
, 255, 0, 0, 96);
409 if (g_Map_traceToNearestWall(ax0
, ay0
, ax1
, ay1
, @ex
, @ey
) <> nil) then
411 e_DrawLine(sz
, ax0
, ay0
, ex
, ey
, 0, 255, 0, 96);
415 e_DrawLine(sz
, ax0
, ay0
, ex
, ey
, 0, 0, 255, 96);
420 wx
, wy
, xx
, yy
: Integer;
424 wx
:= p
.Obj
.X
+ WEAPONPOINT
[p
.Direction
].X
+ IfThen(p
.Direction
= TDirection
.D_LEFT
, 7, -7);
425 wy
:= p
.Obj
.Y
+ WEAPONPOINT
[p
.Direction
].Y
;
441 if angle
= ANGLE_RIGHTUP
then Dec(angle
, 2);
442 if angle
= ANGLE_RIGHTDOWN
then Inc(angle
, 4);
443 if angle
= ANGLE_LEFTUP
then Inc(angle
, 2);
444 if angle
= ANGLE_LEFTDOWN
then Dec(angle
, 4);
449 if angle
= ANGLE_RIGHTUP
then Dec(angle
, 2);
450 if angle
= ANGLE_RIGHTDOWN
then Inc(angle
, 4);
451 if angle
= ANGLE_LEFTUP
then Inc(angle
, 2);
452 if angle
= ANGLE_LEFTDOWN
then Dec(angle
, 4);
454 4: begin // Double Shotgun
457 if angle
= ANGLE_RIGHTUP
then Dec(angle
, 2);
458 if angle
= ANGLE_RIGHTDOWN
then Inc(angle
, 4);
459 if angle
= ANGLE_LEFTUP
then Inc(angle
, 2);
460 if angle
= ANGLE_LEFTDOWN
then Dec(angle
, 4);
465 if angle
= ANGLE_RIGHTUP
then Dec(angle
, 2);
466 if angle
= ANGLE_RIGHTDOWN
then Inc(angle
, 4);
467 if angle
= ANGLE_LEFTUP
then Inc(angle
, 2);
468 if angle
= ANGLE_LEFTDOWN
then Dec(angle
, 4);
470 6: begin // Rocket Launcher
473 if angle
= ANGLE_RIGHTUP
then Inc(angle
, 2);
474 if angle
= ANGLE_RIGHTDOWN
then Inc(angle
, 4);
475 if angle
= ANGLE_LEFTUP
then Dec(angle
, 2);
476 if angle
= ANGLE_LEFTDOWN
then Dec(angle
, 4);
478 7: begin // Plasmagun
481 if angle
= ANGLE_RIGHTUP
then Inc(angle
);
482 if angle
= ANGLE_RIGHTDOWN
then Inc(angle
, 3);
483 if angle
= ANGLE_LEFTUP
then Dec(angle
);
484 if angle
= ANGLE_LEFTDOWN
then Dec(angle
, 3);
489 if angle
= ANGLE_RIGHTUP
then Inc(angle
, 1);
490 if angle
= ANGLE_RIGHTDOWN
then Inc(angle
, 2);
491 if angle
= ANGLE_LEFTUP
then Dec(angle
, 1);
492 if angle
= ANGLE_LEFTDOWN
then Dec(angle
, 2);
494 9: begin // Super Chaingun
497 if angle
= ANGLE_RIGHTUP
then Dec(angle
, 2);
498 if angle
= ANGLE_RIGHTDOWN
then Inc(angle
, 4);
499 if angle
= ANGLE_LEFTUP
then Inc(angle
, 2);
500 if angle
= ANGLE_LEFTDOWN
then Dec(angle
, 4);
503 xx
:= Trunc(Cos(-DegToRad(angle
)) * len
) + wx
;
504 yy
:= Trunc(Sin(-DegToRad(angle
)) * len
) + wy
;
505 {$IF DEFINED(D2F_DEBUG)}
506 drawCast(sz
, wx
, wy
, xx
, yy
);
508 e_DrawLine(sz
, wx
, wy
, xx
, yy
, 255, 0, 0, 96);
512 procedure r_Player_DrawGUI (pl
: TPlayer
);
515 X
, Y
, SY
, a
, p
, m
: Integer;
519 stat
: TPlayerStatArray
;
521 X
:= gPlayerScreenSize
.X
;
522 SY
:= gPlayerScreenSize
.Y
;
525 if gShowScore
and (gGameSettings
.GameMode
in [GM_TDM
, GM_CTF
]) then
527 if gGameSettings
.GameMode
= GM_CTF
then
531 if gGameSettings
.GameMode
= GM_CTF
then
533 s
:= 'TEXTURE_PLAYER_REDFLAG';
534 if gFlags
[FLAG_RED
].State
= FLAG_STATE_CAPTURED
then
535 s
:= 'TEXTURE_PLAYER_REDFLAG_S';
536 if gFlags
[FLAG_RED
].State
= FLAG_STATE_DROPPED
then
537 s
:= 'TEXTURE_PLAYER_REDFLAG_D';
538 if g_Texture_Get(s
, ID
) then
539 e_Draw(ID
, X
-16-32, 240-72-4, 0, True, False);
542 s
:= IntToStr(gTeamStat
[TEAM_RED
].Score
);
543 e_CharFont_GetSize(gMenuFont
, s
, tw
, th
);
544 e_CharFont_PrintEx(gMenuFont
, X
-16-a
-tw
, 240-72-4, s
, TEAMCOLOR
[TEAM_RED
]);
546 if gGameSettings
.GameMode
= GM_CTF
then
548 s
:= 'TEXTURE_PLAYER_BLUEFLAG';
549 if gFlags
[FLAG_BLUE
].State
= FLAG_STATE_CAPTURED
then
550 s
:= 'TEXTURE_PLAYER_BLUEFLAG_S';
551 if gFlags
[FLAG_BLUE
].State
= FLAG_STATE_DROPPED
then
552 s
:= 'TEXTURE_PLAYER_BLUEFLAG_D';
553 if g_Texture_Get(s
, ID
) then
554 e_Draw(ID
, X
-16-32, 240-32-4, 0, True, False);
557 s
:= IntToStr(gTeamStat
[TEAM_BLUE
].Score
);
558 e_CharFont_GetSize(gMenuFont
, s
, tw
, th
);
559 e_CharFont_PrintEx(gMenuFont
, X
-16-a
-tw
, 240-32-4, s
, TEAMCOLOR
[TEAM_BLUE
]);
562 if g_Texture_Get('TEXTURE_PLAYER_HUDBG', ID
) then
563 e_DrawFill(ID
, X
, 0, 1, (gPlayerScreenSize
.Y
div 256)+IfThen(gPlayerScreenSize
.Y
mod 256 > 0, 1, 0),
566 if g_Texture_Get('TEXTURE_PLAYER_HUD', ID
) then
567 e_Draw(ID
, X
+2, Y
, 0, True, False);
569 if gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
, GT_CLIENT
] then
573 s
:= IntToStr(pl
.Frags
);
574 e_CharFont_GetSize(gMenuFont
, s
, tw
, th
);
575 e_CharFont_PrintEx(gMenuFont
, X
-16-tw
, Y
, s
, _RGB(255, 0, 0));
580 stat
:= g_Player_GetStats();
585 for a
:= 0 to High(stat
) do
586 if stat
[a
].Name
<> pl
.Name
then
588 if stat
[a
].Frags
> m
then m
:= stat
[a
].Frags
;
589 if stat
[a
].Frags
> pl
.Frags
then p
:= p
+1;
593 s
:= IntToStr(p
)+' / '+IntToStr(Length(stat
))+' ';
594 if pl
.Frags
>= m
then s
:= s
+'+' else s
:= s
+'-';
595 s
:= s
+IntToStr(Abs(pl
.Frags
-m
));
597 e_CharFont_GetSize(gMenuSmallFont
, s
, tw
, th
);
598 e_CharFont_PrintEx(gMenuSmallFont
, X
-16-tw
, Y
+32, s
, _RGB(255, 0, 0));
601 if gLMSRespawn
> LMS_RESPAWN_NONE
then
603 s
:= _lc
[I_GAME_WARMUP
];
604 e_CharFont_GetSize(gMenuFont
, s
, tw
, th
);
605 s
:= s
+ ': ' + IntToStr((gLMSRespawnTime
- gTime
) div 1000);
606 e_CharFont_PrintEx(gMenuFont
, X
-64-tw
, SY
-32, s
, _RGB(0, 255, 0));
608 else if gShowLives
and (gGameSettings
.MaxLives
> 0) then
610 s
:= IntToStr(pl
.Lives
);
611 e_CharFont_GetSize(gMenuFont
, s
, tw
, th
);
612 e_CharFont_PrintEx(gMenuFont
, X
-16-tw
, SY
-32, s
, _RGB(0, 255, 0));
616 e_CharFont_GetSize(gMenuSmallFont
, pl
.Name
, tw
, th
);
617 e_CharFont_PrintEx(gMenuSmallFont
, X
+98-(tw
div 2), Y
+8, pl
.Name
, _RGB(255, 0, 0));
619 if R_BERSERK
in pl
.FRulez
then
620 e_Draw(gItemsTexturesID
[ITEM_MEDKIT_BLACK
], X
+37, Y
+45, 0, True, False)
622 e_Draw(gItemsTexturesID
[ITEM_MEDKIT_LARGE
], X
+37, Y
+45, 0, True, False);
624 if g_Texture_Get('TEXTURE_PLAYER_ARMORHUD', ID
) then
625 e_Draw(ID
, X
+36, Y
+77, 0, True, False);
627 s
:= IntToStr(IfThen(pl
.Health
> 0, pl
.Health
, 0));
628 e_CharFont_GetSize(gMenuFont
, s
, tw
, th
);
629 e_CharFont_PrintEx(gMenuFont
, X
+178-tw
, Y
+40, s
, _RGB(255, 0, 0));
631 s
:= IntToStr(pl
.Armor
);
632 e_CharFont_GetSize(gMenuFont
, s
, tw
, th
);
633 e_CharFont_PrintEx(gMenuFont
, X
+178-tw
, Y
+68, s
, _RGB(255, 0, 0));
635 s
:= IntToStr(pl
.GetAmmoByWeapon(pl
.CurrWeap
));
641 ID
:= gItemsTexturesID
[ITEM_WEAPON_KASTET
];
646 ID
:= gItemsTexturesID
[ITEM_WEAPON_SAW
];
648 WEAPON_PISTOL
: ID
:= gItemsTexturesID
[ITEM_WEAPON_PISTOL
];
649 WEAPON_CHAINGUN
: ID
:= gItemsTexturesID
[ITEM_WEAPON_CHAINGUN
];
650 WEAPON_SHOTGUN1
: ID
:= gItemsTexturesID
[ITEM_WEAPON_SHOTGUN1
];
651 WEAPON_SHOTGUN2
: ID
:= gItemsTexturesID
[ITEM_WEAPON_SHOTGUN2
];
652 WEAPON_SUPERPULEMET
: ID
:= gItemsTexturesID
[ITEM_WEAPON_SUPERPULEMET
];
653 WEAPON_ROCKETLAUNCHER
: ID
:= gItemsTexturesID
[ITEM_WEAPON_ROCKETLAUNCHER
];
654 WEAPON_PLASMA
: ID
:= gItemsTexturesID
[ITEM_WEAPON_PLASMA
];
655 WEAPON_BFG
: ID
:= gItemsTexturesID
[ITEM_WEAPON_BFG
];
656 WEAPON_FLAMETHROWER
: ID
:= gItemsTexturesID
[ITEM_WEAPON_FLAMETHROWER
];
659 e_CharFont_GetSize(gMenuFont
, s
, tw
, th
);
660 e_CharFont_PrintEx(gMenuFont
, X
+178-tw
, Y
+158, s
, _RGB(255, 0, 0));
661 e_Draw(ID
, X
+20, Y
+160, 0, True, False);
663 if R_KEY_RED
in pl
.FRulez
then
664 e_Draw(gItemsTexturesID
[ITEM_KEY_RED
], X
+78, Y
+214, 0, True, False);
666 if R_KEY_GREEN
in pl
.FRulez
then
667 e_Draw(gItemsTexturesID
[ITEM_KEY_GREEN
], X
+95, Y
+214, 0, True, False);
669 if R_KEY_BLUE
in pl
.FRulez
then
670 e_Draw(gItemsTexturesID
[ITEM_KEY_BLUE
], X
+112, Y
+214, 0, True, False);
672 if pl
.JetFuel
> 0 then
674 if g_Texture_Get('TEXTURE_PLAYER_HUDAIR', ID
) then
675 e_Draw(ID
, X
+2, Y
+116, 0, True, False);
676 if g_Texture_Get('TEXTURE_PLAYER_HUDJET', ID
) then
677 e_Draw(ID
, X
+2, Y
+126, 0, True, False);
678 e_DrawLine(4, X
+16, Y
+122, X
+16+Trunc(168*IfThen(pl
.Air
> 0, pl
.Air
, 0)/AIR_MAX
), Y
+122, 0, 0, 196);
679 e_DrawLine(4, X
+16, Y
+132, X
+16+Trunc(168*pl
.JetFuel
/JET_MAX
), Y
+132, 208, 0, 0);
683 if g_Texture_Get('TEXTURE_PLAYER_HUDAIR', ID
) then
684 e_Draw(ID
, X
+2, Y
+124, 0, True, False);
685 e_DrawLine(4, X
+16, Y
+130, X
+16+Trunc(168*IfThen(pl
.Air
> 0, pl
.Air
, 0)/AIR_MAX
), Y
+130, 0, 0, 196);
688 if gShowPing
and g_Game_IsClient
then
690 s
:= _lc
[I_GAME_PING_HUD
] + IntToStr(NetPeer
.lastRoundTripTime
) + _lc
[I_NET_SLIST_PING_MS
];
691 e_TextureFontPrint(X
+ 4, Y
+ 242, s
, gStdFont
);
697 e_TextureFontPrint(X
+ 4, Y
+ 242, _lc
[I_PLAYER_SPECT
], gStdFont
);
698 e_TextureFontPrint(X
+ 4, Y
+ 258, _lc
[I_PLAYER_SPECT2
], gStdFont
);
699 e_TextureFontPrint(X
+ 4, Y
+ 274, _lc
[I_PLAYER_SPECT1
], gStdFont
);
702 e_TextureFontGetSize(gStdFont
, cw
, ch
);
703 s
:= _lc
[I_PLAYER_SPECT4
];
704 e_TextureFontPrintEx(gScreenWidth
div 2 - cw
*(Length(s
) div 2),
705 gScreenHeight
-4-ch
, s
, gStdFont
, 255, 255, 255, 1, True);
706 e_TextureFontPrint(X
+ 4, Y
+ 290, _lc
[I_PLAYER_SPECT1S
], gStdFont
);
712 procedure r_Player_DrawRulez (p
: TPlayer
);
716 // При взятии неуязвимости рисуется инверсионный белый фон
717 if (p
.FMegaRulez
[MR_INVUL
] >= gTime
) and (p
.SpawnInvul
< gTime
) then
719 if (p
.FMegaRulez
[MR_INVUL
]-gTime
) <= 2100 then
720 dr
:= not Odd((p
.FMegaRulez
[MR_INVUL
]-gTime
) div 300)
725 e_DrawFillQuad(0, 0, gPlayerScreenSize
.X
-1, gPlayerScreenSize
.Y
-1,
726 191, 191, 191, 0, TBlending
.Invert
);
729 // При взятии защитного костюма рисуется зеленоватый фон
730 if p
.FMegaRulez
[MR_SUIT
] >= gTime
then
732 if (p
.FMegaRulez
[MR_SUIT
]-gTime
) <= 2100 then
733 dr
:= not Odd((p
.FMegaRulez
[MR_SUIT
]-gTime
) div 300)
738 e_DrawFillQuad(0, 0, gPlayerScreenSize
.X
-1, gPlayerScreenSize
.Y
-1,
739 0, 96, 0, 200, TBlending
.None
);
742 // При взятии берсерка рисуется красноватый фон
743 if (p
.Berserk
>= 0) and (LongWord(p
.Berserk
) >= gTime
) and (gFlash
= 2) then
745 e_DrawFillQuad(0, 0, gPlayerScreenSize
.X
-1, gPlayerScreenSize
.Y
-1,
746 255, 0, 0, 200, TBlending
.None
);
750 procedure r_Player_DrawPain (p
: TPlayer
);
754 if p
.Pain
= 0 then Exit
;
758 if a
< 15 then h
:= 0
759 else if a
< 35 then h
:= 1
760 else if a
< 55 then h
:= 2
761 else if a
< 75 then h
:= 3
762 else if a
< 95 then h
:= 4
765 //if a > 255 then a := 255;
767 e_DrawFillQuad(0, 0, gPlayerScreenSize
.X
-1, gPlayerScreenSize
.Y
-1, 255, 0, 0, 255-h
*50);
768 //e_DrawFillQuad(0, 0, gPlayerScreenSize.X-1, gPlayerScreenSize.Y-1, 255-min(128, a), 255-a, 255-a, 0, B_FILTER);
771 procedure r_Player_DrawPickup (p
: TPlayer
);
775 if p
.Pickup
= 0 then Exit
;
779 if a
< 15 then h
:= 1
780 else if a
< 35 then h
:= 2
781 else if a
< 55 then h
:= 3
782 else if a
< 75 then h
:= 4
785 e_DrawFillQuad(0, 0, gPlayerScreenSize
.X
-1, gPlayerScreenSize
.Y
-1, 150, 200, 150, 255-h
*50);
788 procedure r_Player_DrawCorpse (p
: TCorpse
);
792 if p
.State
= CORPSE_STATE_REMOVEME
then
795 p
.Obj
.lerp(gLerpFactor
, fX
, fY
);
797 if p
.Animation
<> nil then
798 p
.Animation
.Draw(fX
, fY
, TMirrorType
.None
);
800 if p
.AnimationMask
<> nil then
803 p
.AnimationMask
.Draw(fX
, fY
, TMirrorType
.None
);