41c519be71b9c70166ac045bb43a5e4f5423f29b
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_Load
;
23 procedure r_Player_Free
;
25 procedure r_Player_DrawAll
;
26 procedure r_Player_DrawDebug (p
: TPlayer
);
27 procedure r_Player_DrawHealth
;
29 procedure r_Player_DrawCorpses
;
30 procedure r_Player_DrawShells
;
32 procedure r_Player_Draw (p
: TPlayer
);
33 procedure r_Player_DrawIndicator (p
: TPlayer
; Color
: TRGB
);
34 procedure r_Player_DrawBubble (p
: TPlayer
);
35 procedure r_Player_DrawAim (p
: TPlayer
);
36 procedure r_Player_DrawGUI (pl
: TPlayer
);
37 procedure r_Player_DrawRulez (p
: TPlayer
);
38 procedure r_Player_DrawPain (p
: TPlayer
);
39 procedure r_Player_DrawPickup (p
: TPlayer
);
44 SysUtils
, Classes
, Math
,
46 g_basic
, g_game
, g_phys
, g_map
, g_menu
, g_language
, g_weapons
, g_items
, g_net
, g_options
,
47 {$IFDEF ENABLE_HOLMES}
50 r_playermodel
, r_graphics
, r_animations
, r_textures
, r_items
54 PunchFrames
: array [Boolean, 0..2] of DWORD
;
56 procedure r_Player_Load
;
58 g_Frames_CreateWAD(@PunchFrames
[False, 0], 'FRAMES_PUNCH', GameWAD
+ ':WEAPONS\PUNCH', 64, 64, 4, False);
59 g_Frames_CreateWAD(@PunchFrames
[False, 1], 'FRAMES_PUNCH_UP', GameWAD
+ ':WEAPONS\PUNCH_UP', 64, 64, 4, False);
60 g_Frames_CreateWAD(@PunchFrames
[False, 2], 'FRAMES_PUNCH_DN', GameWAD
+ ':WEAPONS\PUNCH_DN', 64, 64, 4, False);
61 g_Frames_CreateWAD(@PunchFrames
[True, 0], 'FRAMES_PUNCH_BERSERK', GameWAD
+ ':WEAPONS\PUNCHB', 64, 64, 4, False);
62 g_Frames_CreateWAD(@PunchFrames
[True, 1], 'FRAMES_PUNCH_BERSERK_UP', GameWAD
+ ':WEAPONS\PUNCHB_UP', 64, 64, 4, False);
63 g_Frames_CreateWAD(@PunchFrames
[True, 2], 'FRAMES_PUNCH_BERSERK_DN', GameWAD
+ ':WEAPONS\PUNCHB_DN', 64, 64, 4, False);
66 procedure r_Player_Free
;
68 g_Frames_DeleteByName('FRAMES_PUNCH');
69 g_Frames_DeleteByName('FRAMES_PUNCH_UP');
70 g_Frames_DeleteByName('FRAMES_PUNCH_DN');
71 g_Frames_DeleteByName('FRAMES_PUNCH_BERSERK');
72 g_Frames_DeleteByName('FRAMES_PUNCH_BERSERK_UP');
73 g_Frames_DeleteByName('FRAMES_PUNCH_BERSERK_DN');
76 procedure r_Player_DrawAll
;
79 if gPlayers
<> nil then
80 for i
:= 0 to High(gPlayers
) do
81 if gPlayers
[i
] <> nil then
82 r_Player_Draw(gPlayers
[i
])
85 procedure r_Player_DrawDebug (p
: TPlayer
);
90 if (@p
.Obj
) = nil then Exit
;
92 e_TextureFontGetSize(gStdFont
, fW
, fH
);
94 e_TextureFontPrint(0, 0 , 'Pos X: ' + IntToStr(p
.Obj
.X
), gStdFont
);
95 e_TextureFontPrint(0, fH
, 'Pos Y: ' + IntToStr(p
.Obj
.Y
), gStdFont
);
96 e_TextureFontPrint(0, fH
* 2, 'Vel X: ' + IntToStr(p
.Obj
.Vel
.X
), gStdFont
);
97 e_TextureFontPrint(0, fH
* 3, 'Vel Y: ' + IntToStr(p
.Obj
.Vel
.Y
), gStdFont
);
98 e_TextureFontPrint(0, fH
* 4, 'Acc X: ' + IntToStr(p
.Obj
.Accel
.X
), gStdFont
);
99 e_TextureFontPrint(0, fH
* 5, 'Acc Y: ' + IntToStr(p
.Obj
.Accel
.Y
), gStdFont
);
100 e_TextureFontPrint(0, fH
* 6, 'Old X: ' + IntToStr(p
.Obj
.oldX
), gStdFont
);
101 e_TextureFontPrint(0, fH
* 7, 'Old Y: ' + IntToStr(p
.Obj
.oldY
), gStdFont
);
104 procedure r_Player_DrawHealth
;
109 if gPlayers
= nil then Exit
;
110 e_TextureFontGetSize(gStdFont
, fW
, fH
);
112 for i
:= 0 to High(gPlayers
) do
113 if gPlayers
[i
] <> nil then
115 e_TextureFontPrint(gPlayers
[i
].Obj
.X
+ gPlayers
[i
].Obj
.Rect
.X
,
116 gPlayers
[i
].Obj
.Y
+ gPlayers
[i
].Obj
.Rect
.Y
+ gPlayers
[i
].Obj
.Rect
.Height
- fH
* 2,
117 IntToStr(gPlayers
[i
].Health
), gStdFont
);
118 e_TextureFontPrint(gPlayers
[i
].Obj
.X
+ gPlayers
[i
].Obj
.Rect
.X
,
119 gPlayers
[i
].Obj
.Y
+ gPlayers
[i
].Obj
.Rect
.Y
+ gPlayers
[i
].Obj
.Rect
.Height
- fH
,
120 IntToStr(gPlayers
[i
].Armor
), gStdFont
);
124 procedure r_Player_DrawCorpse (p
: TCorpse
);
127 if (p
.State
<> CORPSE_STATE_REMOVEME
) and (p
.Model
<> nil) then
129 p
.Obj
.lerp(gLerpFactor
, fX
, fY
);
130 r_PlayerModel_Draw(p
.Model
, fX
, fY
)
134 procedure r_Player_DrawCorpses
;
137 if gCorpses
<> nil then
138 for i
:= 0 to High(gCorpses
) do
139 if gCorpses
[i
] <> nil then
140 r_Player_DrawCorpse(gCorpses
[i
])
143 procedure r_Player_DrawShells
;
148 if gShells
<> nil then
149 for i
:= 0 to High(gShells
) do
150 if gShells
[i
].alive
then
153 if not g_Obj_Collide(sX
, sY
, sWidth
, sHeight
, @Obj
) then
156 Obj
.lerp(gLerpFactor
, fX
, fY
);
161 e_DrawAdv(SpriteID
, fX
, fY
, 0, True, False, RAngle
, @a
, TMirrorType
.None
);
165 procedure r_Player_DrawIndicator (p
: TPlayer
; Color
: TRGB
);
167 indX
, indY
, fX
, fY
, fSlope
: Integer;
177 p
.Obj
.lerp(gLerpFactor
, fX
, fY
);
178 fSlope
:= nlerp(p
.SlopeOld
, p
.Obj
.slopeUpLeft
, gLerpFactor
);
180 case gPlayerIndicatorStyle
of
183 if g_Texture_Get('TEXTURE_PLAYER_INDICATOR', ID
) then
185 e_GetTextureSize(ID
, @indW
, @indH
);
189 if (p
.Obj
.X
+ p
.Obj
.Rect
.X
) < 0 then
192 indX
:= fX
+ p
.Obj
.Rect
.X
+ p
.Obj
.Rect
.Width
;
193 indY
:= fY
+ p
.Obj
.Rect
.Y
+ (p
.Obj
.Rect
.Height
- indW
) div 2;
196 else if (p
.Obj
.X
+ p
.Obj
.Rect
.X
+ p
.Obj
.Rect
.Width
) > Max(gMapInfo
.Width
, gPlayerScreenSize
.X
) then
199 indX
:= fX
+ p
.Obj
.Rect
.X
- indH
;
200 indY
:= fY
+ p
.Obj
.Rect
.Y
+ (p
.Obj
.Rect
.Height
- indW
) div 2;
203 else if (p
.Obj
.Y
- indH
) < 0 then
206 indX
:= fX
+ p
.Obj
.Rect
.X
+ (p
.Obj
.Rect
.Width
- indW
) div 2;
207 indY
:= fY
+ p
.Obj
.Rect
.Y
+ p
.Obj
.Rect
.Height
;
213 indX
:= fX
+ p
.Obj
.Rect
.X
+ (p
.Obj
.Rect
.Width
- indW
) div 2;
217 indY
:= indY
+ fSlope
;
218 indX
:= EnsureRange(indX
, 0, Max(gMapInfo
.Width
, gPlayerScreenSize
.X
) - indW
);
219 indY
:= EnsureRange(indY
, 0, Max(gMapInfo
.Height
, gPlayerScreenSize
.Y
) - indH
);
223 e_DrawAdv(ID
, indX
, indY
, 0, True, False, indA
, @a
);
230 e_TextureFontGetSize(gStdFont
, nW
, nH
);
231 indX
:= fX
+ p
.Obj
.Rect
.X
+ (p
.Obj
.Rect
.Width
- Length(p
.Name
) * nW
) div 2;
232 indY
:= fY
- nH
+ fSlope
;
233 e_TextureFontPrintEx(indX
, indY
, p
.Name
, gStdFont
, Color
.R
, Color
.G
, Color
.B
, 1.0, True);
239 procedure r_Player_DrawBubble (p
: TPlayer
);
241 bubX
, bubY
, fX
, fY
: Integer;
244 Rw
, Gw
, Bw
: SmallInt;
248 CObj
:= p
.getCameraObj();
249 CObj
.lerp(gLerpFactor
, fX
, fY
);
250 // NB: _F_Obj.Rect is used to keep the bubble higher; this is not a mistake
251 bubX
:= fX
+ p
.Obj
.Rect
.X
+ IfThen(p
.Direction
= TDirection
.D_LEFT
, -4, 18);
252 bubY
:= fY
+ p
.Obj
.Rect
.Y
- 18;
260 1: // simple textual non-bubble
262 bubX
:= fX
+ p
.Obj
.Rect
.X
- 11;
263 bubY
:= fY
+ p
.Obj
.Rect
.Y
- 17;
264 e_TextureFontPrint(bubX
, bubY
, '[...]', gStdFont
);
267 2: // advanced pixel-perfect bubble
269 if p
.Team
= TEAM_RED
then
272 if p
.Team
= TEAM_BLUE
then
277 Rb
:= p
.Model
.Color
.R
;
278 Gb
:= p
.Model
.Color
.G
;
279 Bb
:= p
.Model
.Color
.B
;
280 Rw
:= Min(Rb
* 2 + 64, 255);
281 Gw
:= Min(Gb
* 2 + 64, 255);
282 Bw
:= Min(Bb
* 2 + 64, 255);
283 if (Abs(Rw
- Rb
) < 32)
284 or (Abs(Gw
- Gb
) < 32)
285 or (Abs(Bw
- Bb
) < 32) then
287 Rb
:= Max(Rw
div 2 - 16, 0);
288 Gb
:= Max(Gw
div 2 - 16, 0);
289 Bb
:= Max(Bw
div 2 - 16, 0);
292 4: // custom textured bubble
294 if g_Texture_Get('TEXTURE_PLAYER_TALKBUBBLE', ID
) then
295 if p
.Direction
= TDirection
.D_RIGHT
then
296 e_Draw(ID
, bubX
- 6, bubY
- 7, 0, True, False)
298 e_Draw(ID
, bubX
- 6, bubY
- 7, 0, True, False, TMirrorType
.Horizontal
);
304 e_DrawQuad(bubX
+ 1, bubY
, bubX
+ 18, bubY
+ 13, Rb
, Gb
, Bb
);
305 e_DrawQuad(bubX
, bubY
+ 1, bubX
+ 19, bubY
+ 12, Rb
, Gb
, Bb
);
307 e_DrawFillQuad(bubX
+ 1, bubY
+ 1, bubX
+ 18, bubY
+ 12, Rw
, Gw
, Bw
, 0);
310 Dot
:= IfThen(p
.Direction
= TDirection
.D_LEFT
, 14, 5);
311 e_DrawLine(1, bubX
+ Dot
, bubY
+ 14, bubX
+ Dot
, bubY
+ 16, Rb
, Gb
, Bb
);
312 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
);
313 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
);
314 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
);
315 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
);
319 e_DrawFillQuad(bubX
+ Dot
, bubY
+ 8, bubX
+ Dot
+ 1, bubY
+ 9, Rb
, Gb
, Bb
, 0);
320 e_DrawFillQuad(bubX
+ Dot
+ 3, bubY
+ 8, bubX
+ Dot
+ 4, bubY
+ 9, Rb
, Gb
, Bb
, 0);
321 e_DrawFillQuad(bubX
+ Dot
+ 6, bubY
+ 8, bubX
+ Dot
+ 7, bubY
+ 9, Rb
, Gb
, Bb
, 0);
324 procedure r_Player_Draw (p
: TPlayer
);
330 fX
, fY
, fSlope
: Integer;
332 p
.Obj
.lerp(gLerpFactor
, fX
, fY
);
333 fSlope
:= nlerp(p
.SlopeOld
, p
.Obj
.slopeUpLeft
, gLerpFactor
);
337 if p
.Direction
= TDirection
.D_RIGHT
then
338 Mirror
:= TMirrorType
.None
340 Mirror
:= TMirrorType
.Horizontal
;
342 if p
.PunchAnim
.enabled
then
344 if p
.FKeys
[KEY_DOWN
].Pressed
then ID
:= PunchFrames
[R_BERSERK
in p
.FRulez
, 2]
345 else if p
.FKeys
[KEY_UP
].Pressed
then ID
:= PunchFrames
[R_BERSERK
in p
.FRulez
, 1]
346 else ID
:= PunchFrames
[R_BERSERK
in p
.FRulez
, 0];
347 r_AnimationState_Draw(ID
, p
.PunchAnim
, 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
);
350 if (p
.FMegaRulez
[MR_INVUL
] > gTime
) and ((gPlayerDrawn
<> p
) or (p
.SpawnInvul
>= gTime
)) then
351 if g_Texture_Get('TEXTURE_PLAYER_INVULPENTA', ID
) then
353 e_GetTextureSize(ID
, @w
, @h
);
354 if p
.Direction
= TDirection
.D_LEFT
then
355 e_Draw(ID
, fX
+ p
.Obj
.Rect
.X
+ (p
.Obj
.Rect
.Width
div 2) - (w
div 2) + 4,
356 fY
+ p
.Obj
.Rect
.Y
+ (p
.Obj
.Rect
.Height
div 2) - (h
div 2) - 7 + fSlope
, 0, True, False)
358 e_Draw(ID
, fX
+ p
.Obj
.Rect
.X
+ (p
.Obj
.Rect
.Width
div 2) - (w
div 2) - 2,
359 fY
+ p
.Obj
.Rect
.Y
+ (p
.Obj
.Rect
.Height
div 2) - (h
div 2) - 7 + fSlope
, 0, True, False)
362 if p
.FMegaRulez
[MR_INVIS
] > gTime
then
364 if (gPlayerDrawn
<> nil) and ((p
= gPlayerDrawn
) or
365 ((p
.Team
= gPlayerDrawn
.Team
) and (gGameSettings
.GameMode
<> GM_DM
))) then
367 if (p
.FMegaRulez
[MR_INVIS
] - gTime
) <= 2100 then
368 dr
:= not Odd((p
.FMegaRulez
[MR_INVIS
] - gTime
) div 300)
372 r_PlayerModel_Draw(p
.Model
, fX
, fY
+ fSlope
, 200)
374 r_PlayerModel_Draw(p
.Model
, fX
, fY
+ fSlope
);
377 r_PlayerModel_Draw(p
.Model
, fX
, fY
+ fSlope
, 254);
380 r_PlayerModel_Draw(p
.Model
, fX
, fY
+ fSlope
);
383 if g_debug_Frames
then
385 e_DrawQuad(p
.Obj
.X
+ p
.Obj
.Rect
.X
,
386 p
.Obj
.Y
+ p
.Obj
.Rect
.Y
,
387 p
.Obj
.X
+ p
.Obj
.Rect
.X
+ p
.Obj
.Rect
.Width
- 1,
388 p
.Obj
.Y
+ p
.Obj
.Rect
.Y
+ p
.Obj
.Rect
.Height
- 1,
392 if (gChatBubble
> 0) and (p
.FKeys
[KEY_CHAT
].Pressed
) and not p
.Ghost
then
393 if (p
.FMegaRulez
[MR_INVIS
] <= gTime
) or ((gPlayerDrawn
<> nil) and ((p
= gPlayerDrawn
) or
394 ((p
.Team
= gPlayerDrawn
.Team
) and (gGameSettings
.GameMode
<> GM_DM
)))) then
395 r_Player_DrawBubble(p
);
397 // e_DrawPoint(5, 335, 288, 255, 0, 0); // DL, UR, DL, UR
398 if gAimLine
and p
.Alive
and ((p
= gPlayer1
) or (p
= gPlayer2
)) then
402 procedure r_Player_DrawAim (p
: TPlayer
);
404 procedure drawCast (sz
: Integer; ax0
, ay0
, ax1
, ay1
: Integer);
409 {$IFDEF ENABLE_HOLMES}
410 if p
.isValidViewPort() and (p
= gPlayer1
) then
412 g_Holmes_plrLaser(ax0
, ay0
, ax1
, ay1
);
416 e_DrawLine(sz
, ax0
, ay0
, ax1
, ay1
, 255, 0, 0, 96);
417 if (g_Map_traceToNearestWall(ax0
, ay0
, ax1
, ay1
, @ex
, @ey
) <> nil) then
419 e_DrawLine(sz
, ax0
, ay0
, ex
, ey
, 0, 255, 0, 96);
423 e_DrawLine(sz
, ax0
, ay0
, ex
, ey
, 0, 0, 255, 96);
428 wx
, wy
, xx
, yy
: Integer;
432 wx
:= p
.Obj
.X
+ WEAPONPOINT
[p
.Direction
].X
+ IfThen(p
.Direction
= TDirection
.D_LEFT
, 7, -7);
433 wy
:= p
.Obj
.Y
+ WEAPONPOINT
[p
.Direction
].Y
;
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);
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);
462 4: begin // Double Shotgun
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);
473 if angle
= ANGLE_RIGHTUP
then Dec(angle
, 2);
474 if angle
= ANGLE_RIGHTDOWN
then Inc(angle
, 4);
475 if angle
= ANGLE_LEFTUP
then Inc(angle
, 2);
476 if angle
= ANGLE_LEFTDOWN
then Dec(angle
, 4);
478 6: begin // Rocket Launcher
481 if angle
= ANGLE_RIGHTUP
then Inc(angle
, 2);
482 if angle
= ANGLE_RIGHTDOWN
then Inc(angle
, 4);
483 if angle
= ANGLE_LEFTUP
then Dec(angle
, 2);
484 if angle
= ANGLE_LEFTDOWN
then Dec(angle
, 4);
486 7: begin // Plasmagun
489 if angle
= ANGLE_RIGHTUP
then Inc(angle
);
490 if angle
= ANGLE_RIGHTDOWN
then Inc(angle
, 3);
491 if angle
= ANGLE_LEFTUP
then Dec(angle
);
492 if angle
= ANGLE_LEFTDOWN
then Dec(angle
, 3);
497 if angle
= ANGLE_RIGHTUP
then Inc(angle
, 1);
498 if angle
= ANGLE_RIGHTDOWN
then Inc(angle
, 2);
499 if angle
= ANGLE_LEFTUP
then Dec(angle
, 1);
500 if angle
= ANGLE_LEFTDOWN
then Dec(angle
, 2);
502 9: begin // Super Chaingun
505 if angle
= ANGLE_RIGHTUP
then Dec(angle
, 2);
506 if angle
= ANGLE_RIGHTDOWN
then Inc(angle
, 4);
507 if angle
= ANGLE_LEFTUP
then Inc(angle
, 2);
508 if angle
= ANGLE_LEFTDOWN
then Dec(angle
, 4);
511 xx
:= Trunc(Cos(-DegToRad(angle
)) * len
) + wx
;
512 yy
:= Trunc(Sin(-DegToRad(angle
)) * len
) + wy
;
513 {$IF DEFINED(D2F_DEBUG)}
514 drawCast(sz
, wx
, wy
, xx
, yy
);
516 e_DrawLine(sz
, wx
, wy
, xx
, yy
, 255, 0, 0, 96);
520 procedure r_Player_DrawGUI (pl
: TPlayer
);
523 X
, Y
, SY
, a
, p
, m
: Integer;
527 stat
: TPlayerStatArray
;
529 X
:= gPlayerScreenSize
.X
;
530 SY
:= gPlayerScreenSize
.Y
;
533 if gShowScore
and (gGameSettings
.GameMode
in [GM_TDM
, GM_CTF
]) then
535 if gGameSettings
.GameMode
= GM_CTF
then
539 if gGameSettings
.GameMode
= GM_CTF
then
541 s
:= 'TEXTURE_PLAYER_REDFLAG';
542 if gFlags
[FLAG_RED
].State
= FLAG_STATE_CAPTURED
then
543 s
:= 'TEXTURE_PLAYER_REDFLAG_S';
544 if gFlags
[FLAG_RED
].State
= FLAG_STATE_DROPPED
then
545 s
:= 'TEXTURE_PLAYER_REDFLAG_D';
546 if g_Texture_Get(s
, ID
) then
547 e_Draw(ID
, X
-16-32, 240-72-4, 0, True, False);
550 s
:= IntToStr(gTeamStat
[TEAM_RED
].Score
);
551 e_CharFont_GetSize(gMenuFont
, s
, tw
, th
);
552 e_CharFont_PrintEx(gMenuFont
, X
-16-a
-tw
, 240-72-4, s
, TEAMCOLOR
[TEAM_RED
]);
554 if gGameSettings
.GameMode
= GM_CTF
then
556 s
:= 'TEXTURE_PLAYER_BLUEFLAG';
557 if gFlags
[FLAG_BLUE
].State
= FLAG_STATE_CAPTURED
then
558 s
:= 'TEXTURE_PLAYER_BLUEFLAG_S';
559 if gFlags
[FLAG_BLUE
].State
= FLAG_STATE_DROPPED
then
560 s
:= 'TEXTURE_PLAYER_BLUEFLAG_D';
561 if g_Texture_Get(s
, ID
) then
562 e_Draw(ID
, X
-16-32, 240-32-4, 0, True, False);
565 s
:= IntToStr(gTeamStat
[TEAM_BLUE
].Score
);
566 e_CharFont_GetSize(gMenuFont
, s
, tw
, th
);
567 e_CharFont_PrintEx(gMenuFont
, X
-16-a
-tw
, 240-32-4, s
, TEAMCOLOR
[TEAM_BLUE
]);
570 if g_Texture_Get('TEXTURE_PLAYER_HUDBG', ID
) then
571 e_DrawFill(ID
, X
, 0, 1, (gPlayerScreenSize
.Y
div 256)+IfThen(gPlayerScreenSize
.Y
mod 256 > 0, 1, 0),
574 if g_Texture_Get('TEXTURE_PLAYER_HUD', ID
) then
575 e_Draw(ID
, X
+2, Y
, 0, True, False);
577 if gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
, GT_CLIENT
] then
581 s
:= IntToStr(pl
.Frags
);
582 e_CharFont_GetSize(gMenuFont
, s
, tw
, th
);
583 e_CharFont_PrintEx(gMenuFont
, X
-16-tw
, Y
, s
, _RGB(255, 0, 0));
588 stat
:= g_Player_GetStats();
593 for a
:= 0 to High(stat
) do
594 if stat
[a
].Name
<> pl
.Name
then
596 if stat
[a
].Frags
> m
then m
:= stat
[a
].Frags
;
597 if stat
[a
].Frags
> pl
.Frags
then p
:= p
+1;
601 s
:= IntToStr(p
)+' / '+IntToStr(Length(stat
))+' ';
602 if pl
.Frags
>= m
then s
:= s
+'+' else s
:= s
+'-';
603 s
:= s
+IntToStr(Abs(pl
.Frags
-m
));
605 e_CharFont_GetSize(gMenuSmallFont
, s
, tw
, th
);
606 e_CharFont_PrintEx(gMenuSmallFont
, X
-16-tw
, Y
+32, s
, _RGB(255, 0, 0));
609 if gLMSRespawn
> LMS_RESPAWN_NONE
then
611 s
:= _lc
[I_GAME_WARMUP
];
612 e_CharFont_GetSize(gMenuFont
, s
, tw
, th
);
613 s
:= s
+ ': ' + IntToStr((gLMSRespawnTime
- gTime
) div 1000);
614 e_CharFont_PrintEx(gMenuFont
, X
-64-tw
, SY
-32, s
, _RGB(0, 255, 0));
616 else if gShowLives
and (gGameSettings
.MaxLives
> 0) then
618 s
:= IntToStr(pl
.Lives
);
619 e_CharFont_GetSize(gMenuFont
, s
, tw
, th
);
620 e_CharFont_PrintEx(gMenuFont
, X
-16-tw
, SY
-32, s
, _RGB(0, 255, 0));
624 e_CharFont_GetSize(gMenuSmallFont
, pl
.Name
, tw
, th
);
625 e_CharFont_PrintEx(gMenuSmallFont
, X
+98-(tw
div 2), Y
+8, pl
.Name
, _RGB(255, 0, 0));
627 if R_BERSERK
in pl
.FRulez
then
628 e_Draw(gItemsTexturesID
[ITEM_MEDKIT_BLACK
], X
+37, Y
+45, 0, True, False)
630 e_Draw(gItemsTexturesID
[ITEM_MEDKIT_LARGE
], X
+37, Y
+45, 0, True, False);
632 if g_Texture_Get('TEXTURE_PLAYER_ARMORHUD', ID
) then
633 e_Draw(ID
, X
+36, Y
+77, 0, True, False);
635 s
:= IntToStr(IfThen(pl
.Health
> 0, pl
.Health
, 0));
636 e_CharFont_GetSize(gMenuFont
, s
, tw
, th
);
637 e_CharFont_PrintEx(gMenuFont
, X
+178-tw
, Y
+40, s
, _RGB(255, 0, 0));
639 s
:= IntToStr(pl
.Armor
);
640 e_CharFont_GetSize(gMenuFont
, s
, tw
, th
);
641 e_CharFont_PrintEx(gMenuFont
, X
+178-tw
, Y
+68, s
, _RGB(255, 0, 0));
643 s
:= IntToStr(pl
.GetAmmoByWeapon(pl
.CurrWeap
));
649 ID
:= gItemsTexturesID
[ITEM_WEAPON_KASTET
];
654 ID
:= gItemsTexturesID
[ITEM_WEAPON_SAW
];
656 WEAPON_PISTOL
: ID
:= gItemsTexturesID
[ITEM_WEAPON_PISTOL
];
657 WEAPON_CHAINGUN
: ID
:= gItemsTexturesID
[ITEM_WEAPON_CHAINGUN
];
658 WEAPON_SHOTGUN1
: ID
:= gItemsTexturesID
[ITEM_WEAPON_SHOTGUN1
];
659 WEAPON_SHOTGUN2
: ID
:= gItemsTexturesID
[ITEM_WEAPON_SHOTGUN2
];
660 WEAPON_SUPERPULEMET
: ID
:= gItemsTexturesID
[ITEM_WEAPON_SUPERPULEMET
];
661 WEAPON_ROCKETLAUNCHER
: ID
:= gItemsTexturesID
[ITEM_WEAPON_ROCKETLAUNCHER
];
662 WEAPON_PLASMA
: ID
:= gItemsTexturesID
[ITEM_WEAPON_PLASMA
];
663 WEAPON_BFG
: ID
:= gItemsTexturesID
[ITEM_WEAPON_BFG
];
664 WEAPON_FLAMETHROWER
: ID
:= gItemsTexturesID
[ITEM_WEAPON_FLAMETHROWER
];
667 e_CharFont_GetSize(gMenuFont
, s
, tw
, th
);
668 e_CharFont_PrintEx(gMenuFont
, X
+178-tw
, Y
+158, s
, _RGB(255, 0, 0));
669 e_Draw(ID
, X
+20, Y
+160, 0, True, False);
671 if R_KEY_RED
in pl
.FRulez
then
672 e_Draw(gItemsTexturesID
[ITEM_KEY_RED
], X
+78, Y
+214, 0, True, False);
674 if R_KEY_GREEN
in pl
.FRulez
then
675 e_Draw(gItemsTexturesID
[ITEM_KEY_GREEN
], X
+95, Y
+214, 0, True, False);
677 if R_KEY_BLUE
in pl
.FRulez
then
678 e_Draw(gItemsTexturesID
[ITEM_KEY_BLUE
], X
+112, Y
+214, 0, True, False);
680 if pl
.JetFuel
> 0 then
682 if g_Texture_Get('TEXTURE_PLAYER_HUDAIR', ID
) then
683 e_Draw(ID
, X
+2, Y
+116, 0, True, False);
684 if g_Texture_Get('TEXTURE_PLAYER_HUDJET', ID
) then
685 e_Draw(ID
, X
+2, Y
+126, 0, True, False);
686 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);
687 e_DrawLine(4, X
+16, Y
+132, X
+16+Trunc(168*pl
.JetFuel
/JET_MAX
), Y
+132, 208, 0, 0);
691 if g_Texture_Get('TEXTURE_PLAYER_HUDAIR', ID
) then
692 e_Draw(ID
, X
+2, Y
+124, 0, True, False);
693 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);
696 if gShowPing
and g_Game_IsClient
then
698 s
:= _lc
[I_GAME_PING_HUD
] + IntToStr(NetPeer
.lastRoundTripTime
) + _lc
[I_NET_SLIST_PING_MS
];
699 e_TextureFontPrint(X
+ 4, Y
+ 242, s
, gStdFont
);
705 e_TextureFontPrint(X
+ 4, Y
+ 242, _lc
[I_PLAYER_SPECT
], gStdFont
);
706 e_TextureFontPrint(X
+ 4, Y
+ 258, _lc
[I_PLAYER_SPECT2
], gStdFont
);
707 e_TextureFontPrint(X
+ 4, Y
+ 274, _lc
[I_PLAYER_SPECT1
], gStdFont
);
710 e_TextureFontGetSize(gStdFont
, cw
, ch
);
711 s
:= _lc
[I_PLAYER_SPECT4
];
712 e_TextureFontPrintEx(gScreenWidth
div 2 - cw
*(Length(s
) div 2),
713 gScreenHeight
-4-ch
, s
, gStdFont
, 255, 255, 255, 1, True);
714 e_TextureFontPrint(X
+ 4, Y
+ 290, _lc
[I_PLAYER_SPECT1S
], gStdFont
);
720 procedure r_Player_DrawRulez (p
: TPlayer
);
724 // При взятии неуязвимости рисуется инверсионный белый фон
725 if (p
.FMegaRulez
[MR_INVUL
] >= gTime
) and (p
.SpawnInvul
< gTime
) then
727 if (p
.FMegaRulez
[MR_INVUL
]-gTime
) <= 2100 then
728 dr
:= not Odd((p
.FMegaRulez
[MR_INVUL
]-gTime
) div 300)
733 e_DrawFillQuad(0, 0, gPlayerScreenSize
.X
-1, gPlayerScreenSize
.Y
-1,
734 191, 191, 191, 0, TBlending
.Invert
);
737 // При взятии защитного костюма рисуется зеленоватый фон
738 if p
.FMegaRulez
[MR_SUIT
] >= gTime
then
740 if (p
.FMegaRulez
[MR_SUIT
]-gTime
) <= 2100 then
741 dr
:= not Odd((p
.FMegaRulez
[MR_SUIT
]-gTime
) div 300)
746 e_DrawFillQuad(0, 0, gPlayerScreenSize
.X
-1, gPlayerScreenSize
.Y
-1,
747 0, 96, 0, 200, TBlending
.None
);
750 // При взятии берсерка рисуется красноватый фон
751 if (p
.Berserk
>= 0) and (LongWord(p
.Berserk
) >= gTime
) and (gFlash
= 2) then
753 e_DrawFillQuad(0, 0, gPlayerScreenSize
.X
-1, gPlayerScreenSize
.Y
-1,
754 255, 0, 0, 200, TBlending
.None
);
758 procedure r_Player_DrawPain (p
: TPlayer
);
762 if p
.Pain
= 0 then Exit
;
766 if a
< 15 then h
:= 0
767 else if a
< 35 then h
:= 1
768 else if a
< 55 then h
:= 2
769 else if a
< 75 then h
:= 3
770 else if a
< 95 then h
:= 4
773 //if a > 255 then a := 255;
775 e_DrawFillQuad(0, 0, gPlayerScreenSize
.X
-1, gPlayerScreenSize
.Y
-1, 255, 0, 0, 255-h
*50);
776 //e_DrawFillQuad(0, 0, gPlayerScreenSize.X-1, gPlayerScreenSize.Y-1, 255-min(128, a), 255-a, 255-a, 0, B_FILTER);
779 procedure r_Player_DrawPickup (p
: TPlayer
);
783 if p
.Pickup
= 0 then Exit
;
787 if a
< 15 then h
:= 1
788 else if a
< 35 then h
:= 2
789 else if a
< 55 then h
:= 3
790 else if a
< 75 then h
:= 4
793 e_DrawFillQuad(0, 0, gPlayerScreenSize
.X
-1, gPlayerScreenSize
.Y
-1, 150, 200, 150, 255-h
*50);