mirror of
https://github.com/yquake2/yquake2remaster.git
synced 2025-02-16 17:11:03 +00:00
Fix help computer and inventory updates when already opened
This commit is contained in:
parent
909e69462f
commit
6f6c9a1aae
4 changed files with 55 additions and 17 deletions
|
@ -605,9 +605,26 @@ Cmd_Drop_f(edict_t *ent)
|
|||
}
|
||||
|
||||
void
|
||||
Cmd_Inven_f(edict_t *ent)
|
||||
InventoryMessage(edict_t *ent)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (!ent)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
gi.WriteByte(svc_inventory);
|
||||
|
||||
for (i = 0; i < MAX_ITEMS; i++)
|
||||
{
|
||||
gi.WriteShort(ent->client->pers.inventory[i]);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
Cmd_Inven_f(edict_t *ent)
|
||||
{
|
||||
gclient_t *cl;
|
||||
|
||||
if (!ent)
|
||||
|
@ -628,13 +645,7 @@ Cmd_Inven_f(edict_t *ent)
|
|||
|
||||
cl->showinventory = true;
|
||||
|
||||
gi.WriteByte(svc_inventory);
|
||||
|
||||
for (i = 0; i < MAX_ITEMS; i++)
|
||||
{
|
||||
gi.WriteShort(cl->pers.inventory[i]);
|
||||
}
|
||||
|
||||
InventoryMessage(ent);
|
||||
gi.unicast(ent, true);
|
||||
}
|
||||
|
||||
|
|
|
@ -572,8 +572,7 @@ extern field_t fields[];
|
|||
extern gitem_t itemlist[];
|
||||
|
||||
/* g_cmds.c */
|
||||
void Cmd_Help_f(edict_t *ent);
|
||||
void Cmd_Score_f(edict_t *ent);
|
||||
void InventoryMessage(edict_t *client);
|
||||
|
||||
/* g_items.c */
|
||||
void PrecacheItem(gitem_t *it);
|
||||
|
@ -752,6 +751,9 @@ void G_SetSpectatorStats(edict_t *ent);
|
|||
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);
|
||||
|
||||
/* g_pweapon.c */
|
||||
void PlayerNoise(edict_t *who, vec3_t where, int type);
|
||||
|
|
|
@ -217,7 +217,7 @@ DeathmatchScoreboardMessage(edict_t *ent, edict_t *killer)
|
|||
edict_t *cl_ent;
|
||||
char *tag;
|
||||
|
||||
if (!ent || !killer)
|
||||
if (!ent)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -369,11 +369,8 @@ Cmd_Score_f(edict_t *ent)
|
|||
DeathmatchScoreboard(ent);
|
||||
}
|
||||
|
||||
/*
|
||||
* Draw help computer.
|
||||
*/
|
||||
void
|
||||
HelpComputer(edict_t *ent)
|
||||
HelpComputerMessage(edict_t *ent)
|
||||
{
|
||||
char string[1024];
|
||||
char *sk;
|
||||
|
@ -419,6 +416,20 @@ HelpComputer(edict_t *ent)
|
|||
|
||||
gi.WriteByte(svc_layout);
|
||||
gi.WriteString(string);
|
||||
}
|
||||
|
||||
/*
|
||||
* Draw help computer.
|
||||
*/
|
||||
void
|
||||
HelpComputer(edict_t *ent)
|
||||
{
|
||||
if (!ent)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
HelpComputerMessage(ent);
|
||||
gi.unicast(ent, true);
|
||||
}
|
||||
|
||||
|
@ -443,8 +454,7 @@ Cmd_Help_f(edict_t *ent)
|
|||
ent->client->showinventory = false;
|
||||
ent->client->showscores = false;
|
||||
|
||||
if (ent->client->showhelp &&
|
||||
(ent->client->pers.game_helpchanged == game.helpchanged))
|
||||
if (ent->client->showhelp)
|
||||
{
|
||||
ent->client->showhelp = false;
|
||||
return;
|
||||
|
|
|
@ -1371,4 +1371,19 @@ ClientEndServerFrame(edict_t *ent)
|
|||
DeathmatchScoreboardMessage(ent, ent->enemy);
|
||||
gi.unicast(ent, false);
|
||||
}
|
||||
|
||||
/* if the inventory is up, update it */
|
||||
if (ent->client->showinventory && !(level.framenum & 1))
|
||||
{
|
||||
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