mirror of
https://github.com/fabiangreffrath/woof.git
synced 2025-09-24 21:38:39 -04:00
Blink missing keys (#1438)
* Blink missing keys * Keep all cancel conditions in `ST_updateWidgets()` * Reformat blinking code * Cosmetic tweaks * Change conditions, disable by default Due to the change in conditions, the feature now applies to the classic Status Bar, and doesn't apply to `hud_active == 0`, therefore assuming that `hud_active != 0` means that the key widget is being displayed. * Add menu item * Implement Crispy's `st_keyorskull[]` * Use `st_keyorskull[]` for Boom HUD too * Factor blinking code out * Change CVAR description * Blink keys after possessed keys in Boom HUD Additionally, some reformatting. * Add comment
This commit is contained in:
parent
f3b9f69ba5
commit
6d3c3930ff
@ -82,6 +82,17 @@ typedef enum
|
||||
weapswitch_raising,
|
||||
} weapswitch_t;
|
||||
|
||||
|
||||
// [crispy] blinking key or skull in the status bar
|
||||
typedef enum
|
||||
{
|
||||
KEYBLINK_NONE,
|
||||
KEYBLINK_CARD,
|
||||
KEYBLINK_SKULL,
|
||||
KEYBLINK_BOTH,
|
||||
KEYBLINK_EITHER,
|
||||
} keyblink_t;
|
||||
|
||||
//
|
||||
// Extended player object info: player_t
|
||||
//
|
||||
@ -181,6 +192,10 @@ typedef struct player_s
|
||||
// [Woof!] show centered "A secret is revealed!" message
|
||||
char* secretmessage;
|
||||
|
||||
// [crispy] blinking key or skull in the status bar
|
||||
keyblink_t keyblinkkeys[3];
|
||||
int keyblinktics;
|
||||
|
||||
int btuse, btuse_tics;
|
||||
|
||||
// [crispy] free look / mouse look
|
||||
|
@ -1385,6 +1385,8 @@ static void G_PlayerFinishLevel(int player)
|
||||
p->bonuscount = 0;
|
||||
// [crispy] reset additional player properties
|
||||
p->btuse_tics = 0;
|
||||
memset(p->keyblinkkeys, 0, sizeof p->keyblinkkeys);
|
||||
p->keyblinktics = 0;
|
||||
p->oldpitch = p->pitch = 0;
|
||||
p->centering = false;
|
||||
p->slope = 0;
|
||||
|
@ -991,6 +991,37 @@ static void HU_widget_build_keys (void)
|
||||
hud_keysstr[i++] = ' '; // spacing
|
||||
hud_keysstr[i++] = ' ';
|
||||
}
|
||||
|
||||
// [Alaux] Blink missing keys *after* possessed keys
|
||||
for (k = 0; k < 6; k++)
|
||||
{
|
||||
if (plr->cards[k])
|
||||
continue;
|
||||
|
||||
switch (ST_BlinkKey(plr, k % 3))
|
||||
{
|
||||
case KEYBLINK_CARD:
|
||||
if (k >= 3)
|
||||
continue;
|
||||
break;
|
||||
|
||||
case KEYBLINK_SKULL:
|
||||
if (k < 3)
|
||||
continue;
|
||||
break;
|
||||
|
||||
case KEYBLINK_BOTH:
|
||||
break;
|
||||
|
||||
default:
|
||||
continue;
|
||||
}
|
||||
|
||||
hud_keysstr[i++] = HU_FONTEND + k + 1;
|
||||
hud_keysstr[i++] = ' ';
|
||||
hud_keysstr[i++] = ' ';
|
||||
}
|
||||
|
||||
hud_keysstr[i] = '\0';
|
||||
|
||||
// transfer the built string (frags or key title) to the widget
|
||||
|
@ -3242,6 +3242,7 @@ setup_menu_t stat_settings1[] = // Status Bar and HUD Settings screen
|
||||
{"Backpack Shifts Ammo Color", S_YESNO, m_null, M_X, M_SPC, {"hud_backpack_thresholds"}},
|
||||
{"Armor Color Matches Type", S_YESNO, m_null, M_X, M_SPC, {"hud_armor_type"}},
|
||||
{"Animated Health/Armor Count", S_YESNO, m_null, M_X, M_SPC, {"hud_animated_counts"}},
|
||||
{"Blink Missing Keys", S_YESNO, m_null, M_X, M_SPC, {"hud_blink_keys"}},
|
||||
|
||||
MI_RESET,
|
||||
|
||||
|
@ -2601,6 +2601,13 @@ default_t defaults[] = {
|
||||
"1 to disable doubled card and skull key display on status bar"
|
||||
},
|
||||
|
||||
{
|
||||
"hud_blink_keys",
|
||||
(config_t *) &hud_blink_keys, NULL,
|
||||
{0}, {0,1}, number, ss_none, wad_yes,
|
||||
"1 to make missing keys blink when trying to trigger linedef actions"
|
||||
},
|
||||
|
||||
{
|
||||
"st_solidbackground",
|
||||
(config_t *) &st_solidbackground, NULL,
|
||||
|
@ -25,6 +25,7 @@
|
||||
#include "r_main.h"
|
||||
#include "dstrings.h"
|
||||
#include "d_deh.h" // Ty 03/27/98 - externalized
|
||||
#include "st_stuff.h"
|
||||
|
||||
///////////////////////////////////////////////////////////////
|
||||
//
|
||||
@ -250,6 +251,7 @@ int EV_DoLockedDoor(line_t *line, vldoor_e type, mobj_t *thing)
|
||||
{
|
||||
doomprintf(p, MESSAGES_NONE, "%s", s_PD_BLUEO); // Ty 03/27/98 - externalized
|
||||
S_StartSound(p->mo,sfx_oof); // killough 3/20/98
|
||||
ST_SetKeyBlink(p, KEYBLINK_EITHER, KEYBLINK_NONE, KEYBLINK_NONE);
|
||||
return 0;
|
||||
}
|
||||
break;
|
||||
@ -260,6 +262,7 @@ int EV_DoLockedDoor(line_t *line, vldoor_e type, mobj_t *thing)
|
||||
{
|
||||
doomprintf(p, MESSAGES_NONE, "%s", s_PD_REDO); // Ty 03/27/98 - externalized
|
||||
S_StartSound(p->mo,sfx_oof); // killough 3/20/98
|
||||
ST_SetKeyBlink(p, KEYBLINK_NONE, KEYBLINK_NONE, KEYBLINK_EITHER);
|
||||
return 0;
|
||||
}
|
||||
break;
|
||||
@ -270,6 +273,7 @@ int EV_DoLockedDoor(line_t *line, vldoor_e type, mobj_t *thing)
|
||||
{
|
||||
doomprintf(p, MESSAGES_NONE, "%s", s_PD_YELLOWO); // Ty 03/27/98 - externalized
|
||||
S_StartSound(p->mo,sfx_oof); // killough 3/20/98
|
||||
ST_SetKeyBlink(p, KEYBLINK_NONE, KEYBLINK_EITHER, KEYBLINK_NONE);
|
||||
return 0;
|
||||
}
|
||||
break;
|
||||
@ -397,6 +401,7 @@ int EV_VerticalDoor(line_t *line, mobj_t *thing)
|
||||
{
|
||||
doomprintf(player, MESSAGES_NONE, "%s", s_PD_BLUEK); // Ty 03/27/98 - externalized
|
||||
S_StartSound(player->mo,sfx_oof); // killough 3/20/98
|
||||
ST_SetKeyBlink(player, KEYBLINK_EITHER, KEYBLINK_NONE, KEYBLINK_NONE);
|
||||
return 0;
|
||||
}
|
||||
break;
|
||||
@ -409,6 +414,7 @@ int EV_VerticalDoor(line_t *line, mobj_t *thing)
|
||||
{
|
||||
doomprintf(player, MESSAGES_NONE, "%s", s_PD_YELLOWK); // Ty 03/27/98 - externalized
|
||||
S_StartSound(player->mo,sfx_oof); // killough 3/20/98
|
||||
ST_SetKeyBlink(player, KEYBLINK_NONE, KEYBLINK_EITHER, KEYBLINK_NONE);
|
||||
return 0;
|
||||
}
|
||||
break;
|
||||
@ -421,6 +427,7 @@ int EV_VerticalDoor(line_t *line, mobj_t *thing)
|
||||
{
|
||||
doomprintf(player, MESSAGES_NONE, "%s", s_PD_REDK); // Ty 03/27/98 - externalized
|
||||
S_StartSound(player->mo,sfx_oof); // killough 3/20/98
|
||||
ST_SetKeyBlink(player, KEYBLINK_NONE, KEYBLINK_NONE, KEYBLINK_EITHER);
|
||||
return 0;
|
||||
}
|
||||
break;
|
||||
|
31
src/p_mobj.c
31
src/p_mobj.c
@ -1306,6 +1306,37 @@ spawnit:
|
||||
{
|
||||
mobj->health = 1000 + musid;
|
||||
}
|
||||
|
||||
// [crispy] blinking key or skull in the status bar
|
||||
switch (mobj->sprite)
|
||||
{
|
||||
case SPR_BKEY:
|
||||
st_keyorskull[it_bluecard] |= KEYBLINK_CARD;
|
||||
break;
|
||||
|
||||
case SPR_BSKU:
|
||||
st_keyorskull[it_bluecard] |= KEYBLINK_SKULL;
|
||||
break;
|
||||
|
||||
case SPR_RKEY:
|
||||
st_keyorskull[it_redcard] |= KEYBLINK_CARD;
|
||||
break;
|
||||
|
||||
case SPR_RSKU:
|
||||
st_keyorskull[it_redcard] |= KEYBLINK_SKULL;
|
||||
break;
|
||||
|
||||
case SPR_YKEY:
|
||||
st_keyorskull[it_yellowcard] |= KEYBLINK_CARD;
|
||||
break;
|
||||
|
||||
case SPR_YSKU:
|
||||
st_keyorskull[it_yellowcard] |= KEYBLINK_SKULL;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -37,6 +37,7 @@
|
||||
#include "m_misc2.h" // [FG] M_StringJoin()
|
||||
#include "m_swap.h"
|
||||
#include "nano_bsp.h"
|
||||
#include "st_stuff.h"
|
||||
|
||||
// [FG] support maps with NODES in uncompressed XNOD/XGLN or compressed ZNOD/ZGLN formats, or DeePBSP format
|
||||
#include "p_extnodes.h"
|
||||
@ -1648,6 +1649,8 @@ void P_SetupLevel(int episode, int map, int playermask, skill_t skill)
|
||||
|
||||
// [crispy] fix long wall wobble
|
||||
P_SegLengths(false);
|
||||
// [crispy] blinking key or skull in the status bar
|
||||
memset(st_keyorskull, 0, sizeof(st_keyorskull));
|
||||
|
||||
// Note: you don't need to clear player queue slots --
|
||||
// a much simpler fix is in g_game.c -- killough 10/98
|
||||
|
10
src/p_spec.c
10
src/p_spec.c
@ -49,6 +49,7 @@
|
||||
#include "m_swap.h"
|
||||
#include "i_video.h" // [FG] uncapped
|
||||
#include "m_misc2.h"
|
||||
#include "st_stuff.h"
|
||||
|
||||
//
|
||||
// Animating textures and planes
|
||||
@ -802,6 +803,7 @@ boolean P_CanUnlockGenDoor(line_t *line, player_t *player)
|
||||
{
|
||||
doomprintf(player, MESSAGES_NONE, "%s", s_PD_ANY); // Ty 03/27/98 - externalized
|
||||
S_StartSound(player->mo,sfx_oof); // killough 3/20/98
|
||||
ST_SetKeyBlink(player, KEYBLINK_EITHER, KEYBLINK_EITHER, KEYBLINK_EITHER);
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
@ -811,6 +813,7 @@ boolean P_CanUnlockGenDoor(line_t *line, player_t *player)
|
||||
{
|
||||
doomprintf(player, MESSAGES_NONE, "%s", skulliscard? s_PD_REDK : s_PD_REDC); // Ty 03/27/98 - externalized
|
||||
S_StartSound(player->mo,sfx_oof); // killough 3/20/98
|
||||
ST_SetKeyBlink(player, KEYBLINK_NONE, KEYBLINK_NONE, skulliscard ? KEYBLINK_EITHER : KEYBLINK_CARD);
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
@ -820,6 +823,7 @@ boolean P_CanUnlockGenDoor(line_t *line, player_t *player)
|
||||
{
|
||||
doomprintf(player, MESSAGES_NONE, "%s", skulliscard? s_PD_BLUEK : s_PD_BLUEC); // Ty 03/27/98 - externalized
|
||||
S_StartSound(player->mo,sfx_oof); // killough 3/20/98
|
||||
ST_SetKeyBlink(player, skulliscard ? KEYBLINK_EITHER : KEYBLINK_CARD, KEYBLINK_NONE, KEYBLINK_NONE);
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
@ -829,6 +833,7 @@ boolean P_CanUnlockGenDoor(line_t *line, player_t *player)
|
||||
{
|
||||
doomprintf(player, MESSAGES_NONE, "%s", skulliscard? s_PD_YELLOWK : s_PD_YELLOWC); // Ty 03/27/98 - externalized
|
||||
S_StartSound(player->mo,sfx_oof); // killough 3/20/98
|
||||
ST_SetKeyBlink(player, KEYBLINK_NONE, skulliscard ? KEYBLINK_EITHER : KEYBLINK_CARD, KEYBLINK_NONE);
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
@ -838,6 +843,7 @@ boolean P_CanUnlockGenDoor(line_t *line, player_t *player)
|
||||
{
|
||||
doomprintf(player, MESSAGES_NONE, "%s", skulliscard? s_PD_REDK : s_PD_REDS); // Ty 03/27/98 - externalized
|
||||
S_StartSound(player->mo,sfx_oof); // killough 3/20/98
|
||||
ST_SetKeyBlink(player, KEYBLINK_NONE, KEYBLINK_NONE, skulliscard ? KEYBLINK_EITHER : KEYBLINK_SKULL);
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
@ -847,6 +853,7 @@ boolean P_CanUnlockGenDoor(line_t *line, player_t *player)
|
||||
{
|
||||
doomprintf(player, MESSAGES_NONE, "%s", skulliscard? s_PD_BLUEK : s_PD_BLUES); // Ty 03/27/98 - externalized
|
||||
S_StartSound(player->mo,sfx_oof); // killough 3/20/98
|
||||
ST_SetKeyBlink(player, skulliscard ? KEYBLINK_EITHER : KEYBLINK_SKULL, KEYBLINK_NONE, KEYBLINK_NONE);
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
@ -856,6 +863,7 @@ boolean P_CanUnlockGenDoor(line_t *line, player_t *player)
|
||||
{
|
||||
doomprintf(player, MESSAGES_NONE, "%s", skulliscard? s_PD_YELLOWK : s_PD_YELLOWS); // Ty 03/27/98 - externalized
|
||||
S_StartSound(player->mo,sfx_oof); // killough 3/20/98
|
||||
ST_SetKeyBlink(player, KEYBLINK_NONE, skulliscard ? KEYBLINK_EITHER : KEYBLINK_SKULL, KEYBLINK_NONE);
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
@ -870,6 +878,7 @@ boolean P_CanUnlockGenDoor(line_t *line, player_t *player)
|
||||
{
|
||||
doomprintf(player, MESSAGES_NONE, "%s", s_PD_ALL6); // Ty 03/27/98 - externalized
|
||||
S_StartSound(player->mo,sfx_oof); // killough 3/20/98
|
||||
ST_SetKeyBlink(player, KEYBLINK_BOTH, KEYBLINK_BOTH, KEYBLINK_BOTH);
|
||||
return false;
|
||||
}
|
||||
if (skulliscard &&
|
||||
@ -881,6 +890,7 @@ boolean P_CanUnlockGenDoor(line_t *line, player_t *player)
|
||||
{
|
||||
doomprintf(player, MESSAGES_NONE, "%s", s_PD_ALL3); // Ty 03/27/98 - externalized
|
||||
S_StartSound(player->mo,sfx_oof); // killough 3/20/98
|
||||
ST_SetKeyBlink(player, KEYBLINK_EITHER, KEYBLINK_EITHER, KEYBLINK_EITHER);
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
|
105
src/st_stuff.c
105
src/st_stuff.c
@ -35,6 +35,8 @@
|
||||
#include "m_misc2.h"
|
||||
#include "m_swap.h"
|
||||
#include "i_printf.h"
|
||||
#include "s_sound.h"
|
||||
#include "sounds.h"
|
||||
|
||||
// [crispy] immediately redraw status bar after help screens have been shown
|
||||
extern boolean inhelpscreens;
|
||||
@ -301,6 +303,8 @@ static int st_faceindex = 0;
|
||||
|
||||
// holds key-type for each key box on bar
|
||||
static int keyboxes[3];
|
||||
// [crispy] blinking key or skull in the status bar
|
||||
int st_keyorskull[3];
|
||||
|
||||
// a random number per tick
|
||||
static int st_randomnumber;
|
||||
@ -677,6 +681,65 @@ void ST_updateFaceWidget(void)
|
||||
}
|
||||
|
||||
int sts_traditional_keys; // killough 2/28/98: traditional status bar keys
|
||||
int hud_blink_keys; // [crispy] blinking key or skull in the status bar
|
||||
|
||||
void ST_SetKeyBlink(player_t* player, int blue, int yellow, int red)
|
||||
{
|
||||
int i;
|
||||
// Init array with args to iterate through
|
||||
const int keys[3] = { blue, yellow, red };
|
||||
|
||||
player->keyblinktics = KEYBLINKTICS;
|
||||
|
||||
for (i = 0; i < 3; i++)
|
||||
{
|
||||
if ( ((keys[i] == KEYBLINK_EITHER) && !(player->cards[i] || player->cards[i+3]))
|
||||
|| ((keys[i] == KEYBLINK_CARD) && !(player->cards[i]))
|
||||
|| ((keys[i] == KEYBLINK_SKULL) && !(player->cards[i+3]))
|
||||
|| ((keys[i] == KEYBLINK_BOTH) && !(player->cards[i] && player->cards[i+3])))
|
||||
{
|
||||
player->keyblinkkeys[i] = keys[i];
|
||||
}
|
||||
else
|
||||
{
|
||||
player->keyblinkkeys[i] = KEYBLINK_NONE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int ST_BlinkKey(player_t* player, int index)
|
||||
{
|
||||
const keyblink_t keyblink = player->keyblinkkeys[index];
|
||||
|
||||
if (!keyblink)
|
||||
return KEYBLINK_NONE;
|
||||
|
||||
if (player->keyblinktics & KEYBLINKMASK)
|
||||
{
|
||||
if (keyblink == KEYBLINK_EITHER)
|
||||
{
|
||||
if (st_keyorskull[index] && st_keyorskull[index] != KEYBLINK_BOTH)
|
||||
{
|
||||
return st_keyorskull[index];
|
||||
}
|
||||
else if ( (player->keyblinktics & (2*KEYBLINKMASK)) &&
|
||||
!(player->keyblinktics & (4*KEYBLINKMASK)))
|
||||
{
|
||||
return KEYBLINK_SKULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
return KEYBLINK_CARD;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return keyblink;
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
void ST_updateWidgets(void)
|
||||
{
|
||||
@ -718,6 +781,48 @@ void ST_updateWidgets(void)
|
||||
keyboxes[i] = keyboxes[i]==-1 || sts_traditional_keys ? i+3 : i+6;
|
||||
}
|
||||
|
||||
// [crispy] blinking key or skull in the status bar
|
||||
if (plyr->keyblinktics)
|
||||
{
|
||||
if (!hud_blink_keys ||
|
||||
!(st_classicstatusbar || (hud_displayed && hud_active > 0)))
|
||||
{
|
||||
plyr->keyblinktics = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!(plyr->keyblinktics & (2*KEYBLINKMASK - 1)))
|
||||
S_StartSound(NULL, sfx_itemup);
|
||||
|
||||
plyr->keyblinktics--;
|
||||
|
||||
for (i = 0; i < 3; i++)
|
||||
{
|
||||
switch (ST_BlinkKey(plyr, i))
|
||||
{
|
||||
case KEYBLINK_NONE:
|
||||
continue;
|
||||
|
||||
case KEYBLINK_CARD:
|
||||
keyboxes[i] = i;
|
||||
break;
|
||||
|
||||
case KEYBLINK_SKULL:
|
||||
keyboxes[i] = i + 3;
|
||||
break;
|
||||
|
||||
case KEYBLINK_BOTH:
|
||||
keyboxes[i] = i + 6;
|
||||
break;
|
||||
|
||||
default:
|
||||
keyboxes[i] = -1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// refresh everything if this is him coming back to life
|
||||
ST_updateFaceWidget();
|
||||
|
||||
|
@ -76,6 +76,14 @@ extern int sts_always_red;// status numbers do not change colors
|
||||
extern int sts_pct_always_gray;// status percents do not change colors
|
||||
extern int sts_traditional_keys; // display keys the traditional way
|
||||
|
||||
// [crispy] blinking key or skull in the status bar
|
||||
extern int hud_blink_keys;
|
||||
#define KEYBLINKMASK 0x8
|
||||
#define KEYBLINKTICS (7*KEYBLINKMASK)
|
||||
extern void ST_SetKeyBlink(player_t* player, int blue, int yellow, int red);
|
||||
extern int ST_BlinkKey(player_t* player, int index);
|
||||
extern int st_keyorskull[3];
|
||||
|
||||
extern int hud_backpack_thresholds; // backpack changes thresholds
|
||||
extern int hud_armor_type; // color of armor depends on type
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user