mirror of
https://github.com/yquake2/xatrix.git
synced 2024-11-10 06:42:22 +00:00
Fix help computer and inventory updates when already opened
These changes ware originally committed by svdijk into baseq2 as reveison 6f6c9a1 to 20110fa.
This commit is contained in:
parent
3bd64f2da0
commit
f7da445083
6 changed files with 100 additions and 97 deletions
67
src/g_cmds.c
67
src/g_cmds.c
|
@ -632,10 +632,66 @@ Cmd_Drop_f(edict_t *ent)
|
|||
it->drop(ent, it);
|
||||
}
|
||||
|
||||
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;
|
||||
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
|
||||
Cmd_Inven_f(edict_t *ent)
|
||||
{
|
||||
int i;
|
||||
gclient_t *cl;
|
||||
|
||||
if (!ent)
|
||||
|
@ -655,14 +711,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);
|
||||
}
|
||||
|
||||
|
|
|
@ -566,7 +566,6 @@ extern gitem_t itemlist[];
|
|||
|
||||
/* g_cmds.c */
|
||||
void Cmd_Help_f(edict_t *ent);
|
||||
void Cmd_Score_f(edict_t *ent);
|
||||
|
||||
/* g_items.c */
|
||||
void PrecacheItem(gitem_t *it);
|
||||
|
@ -761,6 +760,8 @@ 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 InventoryMessage(edict_t *client);
|
||||
|
||||
/* g_pweapon.c */
|
||||
void PlayerNoise(edict_t *who, vec3_t where, int type);
|
||||
|
|
|
@ -180,7 +180,7 @@ BeginIntermission(edict_t *targ)
|
|||
}
|
||||
|
||||
void
|
||||
DeathmatchScoreboardMessage(edict_t *ent, edict_t *killer)
|
||||
DeathmatchScoreboardMessage(edict_t *ent, edict_t *killer /* can be NULL */)
|
||||
{
|
||||
char entry[1024];
|
||||
char string[1400];
|
||||
|
@ -194,7 +194,7 @@ DeathmatchScoreboardMessage(edict_t *ent, edict_t *killer)
|
|||
edict_t *cl_ent;
|
||||
char *tag;
|
||||
|
||||
if (!ent || !killer)
|
||||
if (!ent)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -298,57 +298,8 @@ 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);
|
||||
}
|
||||
|
||||
/*
|
||||
* Draw help computer.
|
||||
*/
|
||||
void
|
||||
HelpComputer(edict_t *ent)
|
||||
HelpComputerMessage(edict_t *ent)
|
||||
{
|
||||
char string[1024];
|
||||
char *sk;
|
||||
|
@ -394,40 +345,24 @@ HelpComputer(edict_t *ent)
|
|||
|
||||
gi.WriteByte(svc_layout);
|
||||
gi.WriteString(string);
|
||||
gi.unicast(ent, true);
|
||||
}
|
||||
|
||||
/*
|
||||
* Display the current help message
|
||||
*/
|
||||
void
|
||||
Cmd_Help_f(edict_t *ent)
|
||||
InventoryMessage(edict_t *ent)
|
||||
{
|
||||
if (!ent)
|
||||
int i;
|
||||
|
||||
if (!ent)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
/* this is for backwards compatability */
|
||||
if (deathmatch->value)
|
||||
gi.WriteByte(svc_inventory);
|
||||
|
||||
for (i = 0; i < MAX_ITEMS; i++)
|
||||
{
|
||||
Cmd_Score_f(ent);
|
||||
return;
|
||||
gi.WriteShort(ent->client->pers.inventory[i]);
|
||||
}
|
||||
|
||||
ent->client->showinventory = false;
|
||||
ent->client->showscores = false;
|
||||
|
||||
if (ent->client->showhelp &&
|
||||
(ent->client->pers.game_helpchanged == game.helpchanged))
|
||||
{
|
||||
ent->client->showhelp = false;
|
||||
return;
|
||||
}
|
||||
|
||||
ent->client->showhelp = true;
|
||||
ent->client->pers.helpchanged = 0;
|
||||
HelpComputer(ent);
|
||||
}
|
||||
|
||||
/* ======================================================================= */
|
||||
|
|
|
@ -1370,10 +1370,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);
|
||||
/* 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)
|
||||
{
|
||||
InventoryMessage(ent);
|
||||
gi.unicast(ent, false);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -140,10 +140,8 @@ extern void PlayerTrail_Init ( void ) ;
|
|||
extern void G_SetSpectatorStats ( edict_t * ent ) ;
|
||||
extern void G_CheckChaseStats ( edict_t * ent ) ;
|
||||
extern void G_SetStats ( edict_t * ent ) ;
|
||||
extern void Cmd_Help_f ( edict_t * ent ) ;
|
||||
extern void HelpComputer ( edict_t * ent ) ;
|
||||
extern void Cmd_Score_f ( edict_t * ent ) ;
|
||||
extern void DeathmatchScoreboard ( edict_t * ent ) ;
|
||||
extern void InventoryMessage ( edict_t * ent ) ;
|
||||
extern void HelpComputerMessage ( edict_t * ent ) ;
|
||||
extern void DeathmatchScoreboardMessage ( edict_t * ent , edict_t * killer ) ;
|
||||
extern void BeginIntermission ( edict_t * targ ) ;
|
||||
extern void MoveClientToIntermission ( edict_t * ent ) ;
|
||||
|
@ -1194,6 +1192,8 @@ extern void Cmd_WeapNext_f ( edict_t * ent ) ;
|
|||
extern void Cmd_WeapPrev_f ( edict_t * ent ) ;
|
||||
extern void Cmd_InvUse_f ( edict_t * ent ) ;
|
||||
extern void Cmd_Inven_f ( edict_t * ent ) ;
|
||||
extern void Cmd_Help_f ( edict_t * ent ) ;
|
||||
extern void Cmd_Score_f ( edict_t * ent ) ;
|
||||
extern void Cmd_Drop_f ( edict_t * ent ) ;
|
||||
extern void Cmd_Use_f ( edict_t * ent ) ;
|
||||
extern void Cmd_Noclip_f ( edict_t * ent ) ;
|
||||
|
|
|
@ -140,10 +140,8 @@
|
|||
{"G_SetSpectatorStats", (byte *)G_SetSpectatorStats},
|
||||
{"G_CheckChaseStats", (byte *)G_CheckChaseStats},
|
||||
{"G_SetStats", (byte *)G_SetStats},
|
||||
{"Cmd_Help_f", (byte *)Cmd_Help_f},
|
||||
{"HelpComputer", (byte *)HelpComputer},
|
||||
{"Cmd_Score_f", (byte *)Cmd_Score_f},
|
||||
{"DeathmatchScoreboard", (byte *)DeathmatchScoreboard},
|
||||
{"InventoryMessage", (byte *)InventoryMessage},
|
||||
{"HelpComputerMessage", (byte *)HelpComputerMessage},
|
||||
{"DeathmatchScoreboardMessage", (byte *)DeathmatchScoreboardMessage},
|
||||
{"BeginIntermission", (byte *)BeginIntermission},
|
||||
{"MoveClientToIntermission", (byte *)MoveClientToIntermission},
|
||||
|
@ -1194,6 +1192,8 @@
|
|||
{"Cmd_WeapPrev_f", (byte *)Cmd_WeapPrev_f},
|
||||
{"Cmd_InvUse_f", (byte *)Cmd_InvUse_f},
|
||||
{"Cmd_Inven_f", (byte *)Cmd_Inven_f},
|
||||
{"Cmd_Help_f", (byte *)Cmd_Help_f},
|
||||
{"Cmd_Score_f", (byte *)Cmd_Score_f},
|
||||
{"Cmd_Drop_f", (byte *)Cmd_Drop_f},
|
||||
{"Cmd_Use_f", (byte *)Cmd_Use_f},
|
||||
{"Cmd_Noclip_f", (byte *)Cmd_Noclip_f},
|
||||
|
|
Loading…
Reference in a new issue