📄 p_hud.pas
字号:
Exit;
if (ent.client.showscores) then
begin
ent.client.showscores := false;
{$IFDEF CTF} //only CTF
ent.client.update_chase := true;
{$ENDIF}
Exit;
end;
ent.client.showscores := true;
DeathmatchScoreboard (ent);
end;//procedure (GAME <> CTF)
// (GAME=CTF)
{*
==================
HelpComputer
Draw help computer.
==================
*}
procedure HelpComputer (edict_t *ent);
var
char string[1024];
char *sk;
begin
if (skill.value = 0)
then sk := 'easy'
else
if (skill.value = 1)
then sk := 'medium'
else
if (skill.value = 2)
then sk := 'hard'
else sk := 'hard+';
(*
//Y-code
Case skill.value od
0:
1:
2:
else
end;
*)
// send the layout
(* Com_sprintf (string, sizeof(string),
"xv 32 yv 8 picn help " // background
"xv 202 yv 12 string2 \"%s\" " // skill
"xv 0 yv 24 cstring2 \"%s\" " // level name
"xv 0 yv 54 cstring2 \"%s\" " // help 1
"xv 0 yv 110 cstring2 \"%s\" " // help 2
"xv 50 yv 164 string2 \" kills goals secrets\" "
"xv 50 yv 172 string2 \"%3i/%3i %i/%i %i/%i\" ",
sk,
level.level_name,
game.helpmessage1,
game.helpmessage2,
level.killed_monsters, level.total_monsters,
level.found_goals, level.total_goals,
level.found_secrets, level.total_secrets);*)
//Y-check: EOL-marker???
Com_sprintf (string, sizeof(string),
'xv 32 yv 8 picn help ' // background
'xv 202 yv 12 string2 \"%s\" ' // skill
'xv 0 yv 24 cstring2 \"%s\" ' // level name
'xv 0 yv 54 cstring2 \"%s\" ' // help 1
'xv 0 yv 110 cstring2 \"%s\" ' // help 2
'xv 50 yv 164 string2 \" kills goals secrets\" '
'xv 50 yv 172 string2 \"%3i/%3i %i/%i %i/%i\" ',
[sk,
level.level_name,
game.helpmessage1,
game.helpmessage2,
level.killed_monsters, level.total_monsters,
level.found_goals, level.total_goals,
level.found_secrets, level.total_secrets]);
gi.WriteByte (svc_layout);
gi.WriteString (string);
gi.unicast (ent, true);
end;//procedure (GAME=CTF)
// GAME <> CTF
{*
==================
Cmd_Help_f
Display the current help message
==================
*}
procedure Cmd_Help_f (edict_t *ent);
begin
// this is for backwards compatability
if (deathmatch.value) then
begin
Cmd_Score_f (ent);
Exit;
end;
ent.client.showinventory := false;
ent.client.showscores := false;
{$IFDEF CTF}
if (ent.client.showhelp AND (ent.client.resp.game_helpchanged = game.helpchanged)) then
{$ELSE}
if (ent.client.showhelp AND (ent.client.pers.game_helpchanged = game.helpchanged)) then
{$ENDIF}
begin
ent.client.showhelp := false;
Exit;
end;
ent.client.showhelp := true;
{$IFDEF CTF}
ent.client.resp.helpchanged := 0;
{$ELSE}
ent.client.pers.helpchanged := 0;
{$ENDIF}
HelpComputer (ent);
end;//procedure (GAME <> CTF)
//=======================================================================
// GAME <> CTF
{*
===============
G_SetStats
===============
*}
procedure G_SetStats (edict_t *ent)
var
gitem_t *item;
index, cells,
power_armor_type : integer;
begin
//
// health
//
ent.client.ps.stats[STAT_HEALTH_ICON] := level.pic_health;
ent.client.ps.stats[STAT_HEALTH] := ent.health;
//
// ammo
//
if (!ent.client.ammo_index (*idsoft/* || !ent->client->pers.inventory[ent->client->ammo_index] */*))
then
ent.client.ps.stats[STAT_AMMO_ICON] := 0;
ent.client.ps.stats[STAT_AMMO] := 0;
end
else begin
item = &itemlist[ent.client.ammo_index];
ent.client.ps.stats[STAT_AMMO_ICON] := gi.imageindex (item.icon);
ent.client.ps.stats[STAT_AMMO] := ent.client.pers.inventory[ent.client.ammo_index];
end;
//
// armor
//
power_armor_type := PowerArmorType (ent);
if (power_armor_type) then
begin
cells := ent.client.pers.inventory[ITEM_INDEX(FindItem ('cells'))];
if (cells = 0) then
begin
// ran out of cells for power armor
// ent->flags &= ~FL_POWER_ARMOR;
ent.flags := ent.flags AND (NOT FL_POWER_ARMOR);
gi.sound(ent, CHAN_ITEM, gi.soundindex('misc/power2.wav'), 1, ATTN_NORM, 0);
power_armor_type := 0;;
end;
end;
index := ArmorIndex (ent);
if (power_armor_type AND (!index OR (level.framenum AND 8) ) )
then begin
// flash between power armor and other armor icon
ent.client.ps.stats[STAT_ARMOR_ICON] := gi.imageindex ('i_powershield');
ent.client.ps.stats[STAT_ARMOR] := cells;
end
else
if (index<>0)
then begin
item = GetItemByIndex (index);
ent.client.ps.stats[STAT_ARMOR_ICON] := gi.imageindex (item.icon);
ent.client.ps.stats[STAT_ARMOR] := ent.client.pers.inventory[index];
end
else begin
ent.client.ps.stats[STAT_ARMOR_ICON] := 0;
ent.client.ps.stats[STAT_ARMOR] := 0;
end;
//
// pickup message
//
if (level.time > ent.client.pickup_msg_time) then
begin
ent.client.ps.stats[STAT_PICKUP_ICON] := 0;
ent.client.ps.stats[STAT_PICKUP_STRING] := 0;
end;
//
// timers
//
if (ent.client.quad_framenum > level.framenum)
then begin
ent.client.ps.stats[STAT_TIMER_ICON] := gi.imageindex ('p_quad');
ent.client.ps.stats[STAT_TIMER] := (ent.client.quad_framenum - level.framenum)/10;
end
else
if (ent.client.invincible_framenum > level.framenum)
then begin
ent.client.ps.stats[STAT_TIMER_ICON] := gi.imageindex ('p_invulnerability');
ent.client.ps.stats[STAT_TIMER] := (ent.client.invincible_framenum - level.framenum)/10;
end
else
if (ent.client.enviro_framenum > level.framenum)
then begin
ent.client.ps.stats[STAT_TIMER_ICON] := gi.imageindex ('p_envirosuit');
ent.client.ps.stats[STAT_TIMER] := (ent.client.enviro_framenum - level.framenum)/10;
end
else
if (ent.client.breather_framenum > level.framenum)
then begin
ent.client.ps.stats[STAT_TIMER_ICON] := gi.imageindex ('p_rebreather');
ent.client.ps.stats[STAT_TIMER] := (ent.client.breather_framenum - level.framenum)/10;
end
else begin
ent.client.ps.stats[STAT_TIMER_ICON] := 0;
ent.client.ps.stats[STAT_TIMER] := 0;
end;
//
// selected item
//
if (ent.client.pers.selected_item = -1)
then ent.client.ps.stats[STAT_SELECTED_ICON] := 0
else ent.client.ps.stats[STAT_SELECTED_ICON] := gi.imageindex (itemlist[ent.client.pers.selected_item].icon);
ent.client.ps.stats[STAT_SELECTED_ITEM] := ent.client.pers.selected_item;
//
// layouts
//
ent.client.ps.stats[STAT_LAYOUTS] := 0;
if (deathmatch.value)
then begin
if (ent.client.pers.health <= 0 OR level.intermissiontime OR ent.client.showscores) then
ent.client.ps.stats[STAT_LAYOUTS] := ent.client.ps.stats[STAT_LAYOUTS] OR 1;
if (ent.client.showinventory AND ent.client.pers.health > 0) then
ent.client.ps.stats[STAT_LAYOUTS] := ent.client.ps.stats[STAT_LAYOUTS] OR 2;
end
else begin
if (ent.client.showscores OR ent.client.showhelp) then
ent.client.ps.stats[STAT_LAYOUTS] := ent.client.ps.stats[STAT_LAYOUTS] OR 1;
if (ent.client.showinventory AND ent.client.pers.health > 0) then
ent.client.ps.stats[STAT_LAYOUTS] := ent.client.ps.stats[STAT_LAYOUTS] OR 2;
end;
//
// frags
//
ent.client.ps.stats[STAT_FRAGS] := ent.client.resp.score;
//
// help icon / current weapon if not shown
//
{$IFDEF CTF}
if (ent.client.resp.helpchanged && (level.framenum&8) )
{$ELSE}
if (ent.client.pers.helpchanged && (level.framenum&8) )
{$ENDIF}
then ent.client.ps.stats[STAT_HELPICON] := gi.imageindex ('i_help');
else
if ( (ent.client.pers.hand = CENTER_HANDED OR ent.client.ps.fov > 91) && ent.client.pers.weapon)
then ent.client.ps.stats[STAT_HELPICON] := gi.imageindex (ent.client.pers.weapon.icon);
else ent.client.ps.stats[STAT_HELPICON] := 0;
{$IFDEF CTF}
//ZOID
SetCTFStats(ent);
//ZOID
{$ELSE}
ent.client.ps.stats[STAT_SPECTATOR] := 0;
{$ENDIF}
end;//procedure (GAME <> CTF)
{$IFNEF CTF}
{*
===============
G_CheckChaseStats
===============
*}
//only GAME
procedure G_CheckChaseStats (edict_t *ent);
var
i : integer;
gclient_t *cl;
begin
for i:=1 to maxclients.value do
begin
cl := g_edicts[i].client;
if (!g_edicts[i].inuse) OR (cl.chase_target <> ent)
Continue;
memcpy(cl->ps.stats, ent->client->ps.stats, sizeof(cl->ps.stats));
G_SetSpectatorStats(g_edicts + i);
end;
end;//procedure (onlyGAME)
//only GAME
{*
===============
G_SetSpectatorStats
===============
*}
procedure G_SetSpectatorStats (edict_t *ent);
begin
gclient_t *cl = ent->client;
if (!cl.chase_target) then
G_SetStats (ent);
cl.ps.stats[STAT_SPECTATOR] := 1;
// layouts are independant in spectator
cl.ps.stats[STAT_LAYOUTS] := 0;
if (cl.pers.health <= 0 OR level.intermissiontime OR cl.showscores) then
cl.ps.stats[STAT_LAYOUTS] := cl.ps.stats[STAT_LAYOUTS] OR 1;
if (cl.showinventory AND cl.pers.health > 0) then
cl.ps.stats[STAT_LAYOUTS] := cl.ps.stats[STAT_LAYOUTS] OR 2;
if (cl.chase_target && cl.chase_target.inuse)
then cl.ps.stats[STAT_CHASE] := CS_PLAYERSKINS + (cl.chase_target - g_edicts) - 1
else cl.ps.stats[STAT_CHASE] := 0;
end;//procedure (onlyGAME)
{$ENDIF}
// End of file
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -