mirror of
https://github.com/yquake2/xatrix.git
synced 2024-11-10 06:42:22 +00:00
Merge pull request #98 from BjossiAlfreds/helpmsg-always
Workarounds for naggy help icons
This commit is contained in:
commit
2d6c12b423
3 changed files with 57 additions and 6 deletions
|
@ -7,6 +7,9 @@
|
||||||
|
|
||||||
#include "header/local.h"
|
#include "header/local.h"
|
||||||
|
|
||||||
|
#define TARGET_HELP_PRIMARY 1
|
||||||
|
#define TARGET_HELP_THINK_DELAY 0.3f
|
||||||
|
|
||||||
/* QUAKED target_temp_entity (1 0 0) (-8 -8 -8) (8 8 8)
|
/* QUAKED target_temp_entity (1 0 0) (-8 -8 -8) (8 8 8)
|
||||||
* Fire an origin based temp entity event to the clients.
|
* Fire an origin based temp entity event to the clients.
|
||||||
*
|
*
|
||||||
|
@ -151,24 +154,70 @@ SP_target_speaker(edict_t *ent)
|
||||||
|
|
||||||
/* ========================================================== */
|
/* ========================================================== */
|
||||||
|
|
||||||
|
static void
|
||||||
|
Target_Help_Apply(const char *msg, int is_primary)
|
||||||
|
{
|
||||||
|
char *curr;
|
||||||
|
size_t sz;
|
||||||
|
|
||||||
|
if (!msg)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (is_primary)
|
||||||
|
{
|
||||||
|
curr = game.helpmessage1;
|
||||||
|
sz = sizeof(game.helpmessage1);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
curr = game.helpmessage2;
|
||||||
|
sz = sizeof(game.helpmessage2);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (strcmp(curr, msg) == 0)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Q_strlcpy(curr, msg, sz - 1);
|
||||||
|
|
||||||
|
game.helpchanged++;
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
Use_Target_Help(edict_t *ent, edict_t *other, edict_t *activator)
|
Target_Help_Think(edict_t *ent)
|
||||||
{
|
{
|
||||||
if (!ent)
|
if (!ent)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ent->spawnflags & 1)
|
Target_Help_Apply(ent->message, ent->spawnflags & TARGET_HELP_PRIMARY);
|
||||||
|
ent->think = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
Use_Target_Help(edict_t *ent, edict_t *other /* unused */, edict_t *activator /* unused */)
|
||||||
|
{
|
||||||
|
if (!ent)
|
||||||
{
|
{
|
||||||
strncpy(game.helpmessage1, ent->message, sizeof(game.helpmessage2) - 1);
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (level.time > TARGET_HELP_THINK_DELAY)
|
||||||
|
{
|
||||||
|
Target_Help_Apply(ent->message, ent->spawnflags & TARGET_HELP_PRIMARY);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
strncpy(game.helpmessage2, ent->message, sizeof(game.helpmessage1) - 1);
|
/* The game is still pre-loading so delay the help message a bit,
|
||||||
|
otherwise its changes to game structure will leak past save loads
|
||||||
|
*/
|
||||||
|
ent->think = Target_Help_Think;
|
||||||
|
ent->nextthink = TARGET_HELP_THINK_DELAY;
|
||||||
}
|
}
|
||||||
|
|
||||||
game.helpchanged++;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -869,6 +869,7 @@ extern void SP_target_secret ( edict_t * ent ) ;
|
||||||
extern void use_target_secret ( edict_t * ent , edict_t * other , edict_t * activator ) ;
|
extern void use_target_secret ( edict_t * ent , edict_t * other , edict_t * activator ) ;
|
||||||
extern void SP_target_help ( edict_t * ent ) ;
|
extern void SP_target_help ( edict_t * ent ) ;
|
||||||
extern void Use_Target_Help ( edict_t * ent , edict_t * other , edict_t * activator ) ;
|
extern void Use_Target_Help ( edict_t * ent , edict_t * other , edict_t * activator ) ;
|
||||||
|
extern void Target_Help_Think ( edict_t * ent ) ;
|
||||||
extern void SP_target_speaker ( edict_t * ent ) ;
|
extern void SP_target_speaker ( edict_t * ent ) ;
|
||||||
extern void Use_Target_Speaker ( edict_t * ent , edict_t * other , edict_t * activator ) ;
|
extern void Use_Target_Speaker ( edict_t * ent , edict_t * other , edict_t * activator ) ;
|
||||||
extern void SP_target_temp_entity ( edict_t * ent ) ;
|
extern void SP_target_temp_entity ( edict_t * ent ) ;
|
||||||
|
|
|
@ -869,6 +869,7 @@
|
||||||
{"use_target_secret", (byte *)use_target_secret},
|
{"use_target_secret", (byte *)use_target_secret},
|
||||||
{"SP_target_help", (byte *)SP_target_help},
|
{"SP_target_help", (byte *)SP_target_help},
|
||||||
{"Use_Target_Help", (byte *)Use_Target_Help},
|
{"Use_Target_Help", (byte *)Use_Target_Help},
|
||||||
|
{"Target_Help_Think", (byte *)Target_Help_Think},
|
||||||
{"SP_target_speaker", (byte *)SP_target_speaker},
|
{"SP_target_speaker", (byte *)SP_target_speaker},
|
||||||
{"Use_Target_Speaker", (byte *)Use_Target_Speaker},
|
{"Use_Target_Speaker", (byte *)Use_Target_Speaker},
|
||||||
{"SP_target_temp_entity", (byte *)SP_target_temp_entity},
|
{"SP_target_temp_entity", (byte *)SP_target_temp_entity},
|
||||||
|
|
Loading…
Reference in a new issue