mirror of
https://github.com/yquake2/yquake2remaster.git
synced 2025-02-16 17:11:03 +00:00
Move some functions to a better place
This commit is contained in:
parent
6f6c9a1aae
commit
5ed89a0373
4 changed files with 76 additions and 109 deletions
|
@ -605,21 +605,60 @@ Cmd_Drop_f(edict_t *ent)
|
|||
}
|
||||
|
||||
void
|
||||
InventoryMessage(edict_t *ent)
|
||||
Cmd_Score_f(edict_t *ent)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (!ent)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
gi.WriteByte(svc_inventory);
|
||||
ent->client->showinventory = false;
|
||||
ent->client->showhelp = false;
|
||||
|
||||
for (i = 0; i < MAX_ITEMS; i++)
|
||||
if (!deathmatch->value && !coop->value)
|
||||
{
|
||||
gi.WriteShort(ent->client->pers.inventory[i]);
|
||||
return;
|
||||
}
|
||||
|
||||
if (ent->client->showscores)
|
||||
{
|
||||
ent->client->showscores = false;
|
||||
return;
|
||||
}
|
||||
|
||||
ent->client->showscores = true;
|
||||
DeathmatchScoreboardMessage(ent, ent->enemy);
|
||||
gi.unicast(ent, true);
|
||||
}
|
||||
|
||||
void
|
||||
Cmd_Help_f(edict_t *ent)
|
||||
{
|
||||
if (!ent)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
/* this is for backwards compatability */
|
||||
if (deathmatch->value)
|
||||
{
|
||||
Cmd_Score_f(ent);
|
||||
return;
|
||||
}
|
||||
|
||||
ent->client->showinventory = false;
|
||||
ent->client->showscores = false;
|
||||
|
||||
if (ent->client->showhelp)
|
||||
{
|
||||
ent->client->showhelp = false;
|
||||
return;
|
||||
}
|
||||
|
||||
ent->client->showhelp = true;
|
||||
ent->client->pers.helpchanged = 0;
|
||||
HelpComputerMessage(ent);
|
||||
gi.unicast(ent, true);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -572,7 +572,7 @@ extern field_t fields[];
|
|||
extern gitem_t itemlist[];
|
||||
|
||||
/* g_cmds.c */
|
||||
void InventoryMessage(edict_t *client);
|
||||
void Cmd_Help_f(edict_t *ent);
|
||||
|
||||
/* g_items.c */
|
||||
void PrecacheItem(gitem_t *it);
|
||||
|
@ -752,8 +752,7 @@ void G_CheckChaseStats(edict_t *ent);
|
|||
void ValidateSelectedItem(edict_t *ent);
|
||||
void DeathmatchScoreboardMessage(edict_t *client, edict_t *killer);
|
||||
void HelpComputerMessage(edict_t *client);
|
||||
void Cmd_Score_f(edict_t *ent);
|
||||
void Cmd_Help_f(edict_t *ent);
|
||||
void InventoryMessage(edict_t *client);
|
||||
|
||||
/* g_pweapon.c */
|
||||
void PlayerNoise(edict_t *who, vec3_t where, int type);
|
||||
|
|
|
@ -323,52 +323,6 @@ DeathmatchScoreboardMessage(edict_t *ent, edict_t *killer)
|
|||
gi.WriteString(string);
|
||||
}
|
||||
|
||||
/*
|
||||
* Draw instead of help message.
|
||||
* Note that it isn't that hard to
|
||||
* overflow the 1400 byte message limit!
|
||||
*/
|
||||
void
|
||||
DeathmatchScoreboard(edict_t *ent)
|
||||
{
|
||||
if (!ent)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
DeathmatchScoreboardMessage(ent, ent->enemy);
|
||||
gi.unicast(ent, true);
|
||||
}
|
||||
|
||||
/*
|
||||
* Display the scoreboard
|
||||
*/
|
||||
void
|
||||
Cmd_Score_f(edict_t *ent)
|
||||
{
|
||||
if (!ent)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
ent->client->showinventory = false;
|
||||
ent->client->showhelp = false;
|
||||
|
||||
if (!deathmatch->value && !coop->value)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (ent->client->showscores)
|
||||
{
|
||||
ent->client->showscores = false;
|
||||
return;
|
||||
}
|
||||
|
||||
ent->client->showscores = true;
|
||||
DeathmatchScoreboard(ent);
|
||||
}
|
||||
|
||||
void
|
||||
HelpComputerMessage(edict_t *ent)
|
||||
{
|
||||
|
@ -418,52 +372,24 @@ HelpComputerMessage(edict_t *ent)
|
|||
gi.WriteString(string);
|
||||
}
|
||||
|
||||
/*
|
||||
* Draw help computer.
|
||||
*/
|
||||
void
|
||||
HelpComputer(edict_t *ent)
|
||||
InventoryMessage(edict_t *ent)
|
||||
{
|
||||
if (!ent)
|
||||
{
|
||||
return;
|
||||
}
|
||||
int i;
|
||||
|
||||
HelpComputerMessage(ent);
|
||||
gi.unicast(ent, true);
|
||||
if (!ent)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
gi.WriteByte(svc_inventory);
|
||||
|
||||
for (i = 0; i < MAX_ITEMS; i++)
|
||||
{
|
||||
gi.WriteShort(ent->client->pers.inventory[i]);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Display the current help message
|
||||
*/
|
||||
void
|
||||
Cmd_Help_f(edict_t *ent)
|
||||
{
|
||||
if (!ent)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
/* this is for backwards compatability */
|
||||
if (deathmatch->value)
|
||||
{
|
||||
Cmd_Score_f(ent);
|
||||
return;
|
||||
}
|
||||
|
||||
ent->client->showinventory = false;
|
||||
ent->client->showscores = false;
|
||||
|
||||
if (ent->client->showhelp)
|
||||
{
|
||||
ent->client->showhelp = false;
|
||||
return;
|
||||
}
|
||||
|
||||
ent->client->showhelp = true;
|
||||
ent->client->pers.helpchanged = 0;
|
||||
HelpComputer(ent);
|
||||
}
|
||||
|
||||
/* ======================================================================= */
|
||||
|
||||
|
|
|
@ -1365,25 +1365,28 @@ ClientEndServerFrame(edict_t *ent)
|
|||
VectorClear(ent->client->kick_origin);
|
||||
VectorClear(ent->client->kick_angles);
|
||||
|
||||
/* if the scoreboard is up, update it */
|
||||
if (ent->client->showscores && !(level.framenum & 31))
|
||||
if (level.framenum & 31)
|
||||
{
|
||||
DeathmatchScoreboardMessage(ent, ent->enemy);
|
||||
gi.unicast(ent, false);
|
||||
/* if the scoreboard is up, update it */
|
||||
if (ent->client->showscores)
|
||||
{
|
||||
DeathmatchScoreboardMessage(ent, ent->enemy);
|
||||
gi.unicast(ent, false);
|
||||
}
|
||||
|
||||
/* if the help computer is up, update it */
|
||||
if (ent->client->showhelp)
|
||||
{
|
||||
ent->client->pers.helpchanged = 0;
|
||||
HelpComputerMessage(ent);
|
||||
gi.unicast(ent, false);
|
||||
}
|
||||
}
|
||||
|
||||
/* if the inventory is up, update it */
|
||||
if (ent->client->showinventory && !(level.framenum & 1))
|
||||
if (ent->client->showinventory)
|
||||
{
|
||||
InventoryMessage(ent);
|
||||
gi.unicast(ent, false);
|
||||
}
|
||||
|
||||
/* if the help computer is up, update it */
|
||||
if (ent->client->showhelp && !(level.framenum & 31))
|
||||
{
|
||||
ent->client->pers.helpchanged = 0;
|
||||
HelpComputerMessage(ent);
|
||||
gi.unicast(ent, false);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue