📄 p_hud.pas
字号:
//This is "COMMON" file for \GAME\p_hud.pas & \CTF\p_hud.pas
{$DEFINE CTF}
{$IFDEF CTF}
{$ELSE}
{$ENDIF}
// PLEASE, don't modify this file
// 70% complete
{----------------------------------------------------------------------------}
{ }
{ File(s): p_hud.c }
{ }
{ Initial conversion by : YgriK (Igor Karpov) - glYgriK@hotbox.ru }
{ Initial conversion on : 04-Feb-2002 }
{ }
{ This File contains part of convertion of Quake2 source to ObjectPascal. }
{ More information about this project can be found at: }
{ http://www.sulaco.co.za/quake2/ }
{ }
{ Copyright (C) 1997-2001 Id Software, Inc. }
{ }
{ This program is free software; you can redistribute it and/or }
{ modify it under the terms of the GNU General Public License }
{ as published by the Free Software Foundation; either version 2 }
{ of the License, or (at your option) any later version. }
{ }
{ This program is distributed in the hope that it will be useful, }
{ but WITHOUT ANY WARRANTY; without even the implied warranty of }
{ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. }
{ }
{ See the GNU General Public License for more details. }
{ }
{----------------------------------------------------------------------------}
{ Updated on : }
{ Updated by : }
{ }
{----------------------------------------------------------------------------}
{ * Still dependent (to compile correctly) on: }
{ 1) g_local.??? (inc & pas) }
{ }
{----------------------------------------------------------------------------}
{ * TODO: }
{ 1) Do more tests }
{ }
{----------------------------------------------------------------------------}
#include "g_local.h"
{*
======================================================================
INTERMISSION
======================================================================
*}
// GAME=CTF
procedure MoveClientToIntermission (edict_t *ent);
begin
if (deathmatch.value OR coop.value) then
ent.client.showscores := true;
VectorCopy (level.intermission_origin, ent.s.origin);
ent.client.ps.pmove.origin[0] := level.intermission_origin[0] *8;
ent.client.ps.pmove.origin[1] := level.intermission_origin[1] *8;
ent.client.ps.pmove.origin[2] := level.intermission_origin[2] *8;
VectorCopy (level.intermission_angle, ent.client.ps.viewangles);
ent.client.ps.pmove.pm_type := PM_FREEZE;
ent.client.ps.gunindex := 0;
ent.client.ps.blend[3] := 0;
ent.client.ps.rdflags := ent.client.ps.rdflags AND (NOT RDF_UNDERWATER);
// clean up powerup info
ent.client.quad_framenum := 0;
ent.client.invincible_framenum := 0;
ent.client.breather_framenum := 0;
ent.client.enviro_framenum := 0;
ent.client.grenade_blew_up := false;
ent.client.grenade_time := 0;
ent.viewheight := 0;
ent.s.modelindex := 0;
ent.s.modelindex2 := 0;
ent.s.modelindex3 := 0;
ent.s.modelindex := 0;
ent.s.effects := 0;
ent.s.sound := 0;
ent.solid := SOLID_NOT;
// add the layout
if (deathmatch.value OR coop.value) then
begin
DeathmatchScoreboardMessage (ent, Nil);
gi.unicast (ent, true);
end;
end;//procedure (GAME=CTF)
// GAME <> CTF
procedure BeginIntermission (edict_t *targ);
var
i, n : integer;
edict_t *ent, *client;
begin
if (level.intermissiontime) then
Exit; // already activated
{$IFDEF CTF} //only CTF
//ZOID
if (deathmatch.value AND ctf.value) then
CTFCalcScores();
//ZOID
{$ENDIF}
game.autosaved = false;
// respawn any dead clients
for i:=0 to maxclients.value-1 do
begin
client := g_edicts + 1 + i;
if (!client.inuse) then
Continue;
if (client.health <= 0) then
respawn(client);
end;
level.intermissiontime := level.time;
level.changemap := targ.map;
{Y} if (strstr(level.changemap, '*')) then
if (coop.value) then
for i:=0 to maxclients.value-1 do
begin
client := g_edicts + 1 + i;
if (!client.inuse) then
Continue;
// strip players of all keys between units
for n:=0 to MAX_ITEMS-1 do
if ((itemlist[n].flags AND IT_KEY) <> 0)
client.client.pers.inventory[n] := 0;
end;//for
else
if (!deathmatch.value) then
begin
level.exitintermission := 1; // go immediately to the next level
Exit;
end;
level.exitintermission = 0;
// find an intermission spot
ent := G_Find (NULL, FOFS(classname), 'info_player_intermission');
if (!ent)
then begin
// the map creator forgot to put in an intermission point...
ent := G_Find (NULL, FOFS(classname), 'info_player_start');
if (!ent) then
ent := G_Find (NULL, FOFS(classname), 'info_player_deathmatch');
end
else begin
// chose one of four spots
i := random(3);
// while (i--)
while (i <> 0) do
begin
ent := G_Find (ent, FOFS(classname), 'info_player_intermission');
if (!ent) then// wrap around the list
ent := G_Find (ent, FOFS(classname), 'info_player_intermission');
Dec(i);
end;
end;
VectorCopy (ent.s.origin, level.intermission_origin);
VectorCopy (ent.s.angles, level.intermission_angle);
// move all clients to the intermission point
for i:=0 to maxclients.value-1 do
begin
client := g_edicts + 1 + i;
if (!client.inuse) then
Continue;
MoveClientToIntermission (client);
end;
end;//procedure (GAME <> CTF)
{*
==================
DeathmatchScoreboardMessage
==================
*}
// GAME <> CTF
procedure DeathmatchScoreboardMessage (edict_t *ent, edict_t *killer);
var
char entry[1024];
char string[1400];
stringlength,
i, j, k,
score, total,
x, y,
picnum : integer;
sorted,
sortedscores : array [0..MAX_CLIENTS-1] of integer;
gclient_t *cl;
edict_t *cl_ent;
char *tag;
begin
{$IFDEF CTF} //only CTF
//ZOID
if (ctf.value) then
begin
CTFScoreboardMessage (ent, killer);
Exit;
end;
//ZOID
{$ENDIF}
// sort the clients by score
total := 0;
for i:=0 to game.maxclients-1 do
begin
cl_ent := g_edicts + 1 + i;
{$IFDEF CTF}
if (!cl_ent.inuse) then
Continue;
{$ELSE}
if (!cl_ent.inuse OR game.clients[i].resp.spectator) then
Continue;
{$ENDIF}
score := game.clients[i].resp.score;
for j:=0 to total-1 do
if (score > sortedscores[j])
Break;
(*{Y:} for (k=total ; k>j ; k--)
{
sorted[k] := sorted[k-1];
sortedscores[k] := sortedscores[k-1];
}*)
k := total;
while k>j do
begin
sorted[k] := sorted[k-1];
sortedscores[k] := sortedscores[k-1];
Dec(k);
end;
sorted[j] := i;
sortedscores[j] := score;
total++;
end;//for
// print level name and exit rules
string[0] := 0;
stringlength := strlen(string);
// add the clients in sorted order
if (total > 12) then
total := 12;
for i:=0 to total-1 do
begin
cl = &game.clients[sorted[i]];
cl_ent := g_edicts + 1 + sorted[i];
picnum := gi.imageindex ('i_fixme');
(* x = (i>=6) ? 160 : 0;
y = 32 + 32 * (i%6);*)
if (i>=6)
then x := 160
else x := 0;
y := 32 + 32 * (i MOD 6);
// add a dogtag
if (cl_ent = ent)
then tag := 'tag1';
else
if (cl_ent = killer)
then tag := 'tag2';
else tag := NULL;
if (tag) then
begin
Com_sprintf (entry, sizeof(entry), 'xv %i yv %i picn %s ',x+32, y, tag);
j := strlen(entry);
if (stringlength + j > 1024) then
Break;
strcpy (string + stringlength, entry);
stringlength += j;
end;
// send the layout
Com_sprintf (entry, sizeof(entry),
'client %i %i %i %i %i %i ',
x, y, sorted[i], cl.resp.score, cl.ping, (level.framenum - cl.resp.enterframe)/600);
j := strlen(entry);
if (stringlength + j > 1024) then
Break;
strcpy (string + stringlength, entry);
Inc(stringlength, j);
end;//for
gi.WriteByte (svc_layout);
gi.WriteString (string);
end;//procedure (GAME <> CTF)
{*
==================
DeathmatchScoreboard
Draw instead of help message.
Note that it isn't that hard to overflow the 1400 byte message limit!
==================
*}
// (GAME=CTF)
procedure DeathmatchScoreboard (edict_t *ent);
begin
DeathmatchScoreboardMessage (ent, ent.enemy);
gi.unicast (ent, true);
end;//procedure (GAME=CTF)
{*
==================
Cmd_Score_f
Display the scoreboard
==================
*}
// GAME <> CTF
procedure Cmd_Score_f (edict_t *ent);
begin
ent.client.showinventory := false;
ent.client.showhelp := false;
{$IFDEF CTF} //only CTF
//ZOID
if (ent.client.menu) then
PMenu_Close(ent);
//ZOID
{$ENDIF}
if (!deathmatch.value AND !coop.value) then
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -