Add "Alternate Weapon" key similar to Shadow Warrior Classic Redux.

When pressed it switches between pipebomb / detonator or shrinker / expander.

New event "EVENT_ALTWEAPON"

Akin to "EVENT_PREVIOUSWEAPON" and "EVENT_NEXTWEAPON". RETURN is set to 12.

Patch from Fox.

git-svn-id: https://svn.eduke32.com/eduke32@6594 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
hendricks266 2018-01-26 04:35:23 +00:00
parent 8744a70dcf
commit a96613f496
7 changed files with 34 additions and 5 deletions

View file

@ -109,12 +109,13 @@ char gamefunctions[NUMGAMEFUNCTIONS][MAXGAMEFUNCLEN] =
"Show_Multiplayer_Scores", "Show_Multiplayer_Scores",
#endif #endif
"Dpad_Select", "Dpad_Select",
"Dpad_Aiming" "Dpad_Aiming",
"Alternate_Weapon",
}; };
#ifdef __SETUP__ #ifdef __SETUP__
#define NUMKEYENTRIES 56 #define NUMKEYENTRIES 57
const char keydefaults[NUMGAMEFUNCTIONS*2][MAXGAMEFUNCLEN] = const char keydefaults[NUMGAMEFUNCTIONS*2][MAXGAMEFUNCLEN] =
{ {
@ -174,6 +175,7 @@ const char keydefaults[NUMGAMEFUNCTIONS*2][MAXGAMEFUNCLEN] =
"", "", "", "",
"", "", "", "",
"", "", "", "",
"", "",
}; };
const char oldkeydefaults[NUMGAMEFUNCTIONS*2][MAXGAMEFUNCLEN] = const char oldkeydefaults[NUMGAMEFUNCTIONS*2][MAXGAMEFUNCLEN] =
@ -234,6 +236,7 @@ const char oldkeydefaults[NUMGAMEFUNCTIONS*2][MAXGAMEFUNCLEN] =
"", "", "", "",
"", "", "", "",
"", "", "", "",
"", "",
}; };
static const char * mousedefaults[MAXMOUSEBUTTONS] = static const char * mousedefaults[MAXMOUSEBUTTONS] =

View file

@ -140,6 +140,7 @@ enum GameEvent_t {
EVENT_ENDLEVELSCREEN, EVENT_ENDLEVELSCREEN,
EVENT_EXITGAMESCREEN, EVENT_EXITGAMESCREEN,
EVENT_EXITPROGRAMSCREEN, EVENT_EXITPROGRAMSCREEN,
EVENT_ALTWEAPON,
#ifdef LUNATIC #ifdef LUNATIC
EVENT_ANIMATEALLSPRITES, EVENT_ANIMATEALLSPRITES,
#endif #endif

View file

@ -34,8 +34,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
extern "C" { extern "C" {
#endif #endif
#define NUMKEYENTRIES 56 #define NUMKEYENTRIES 57
#define NUMGAMEFUNCTIONS 56 #define NUMGAMEFUNCTIONS 57
#define MAXGAMEFUNCLEN 32 #define MAXGAMEFUNCLEN 32
extern char gamefunctions[NUMGAMEFUNCTIONS][MAXGAMEFUNCLEN]; extern char gamefunctions[NUMGAMEFUNCTIONS][MAXGAMEFUNCLEN];
@ -99,7 +99,8 @@ enum GameFunction_t
gamefunc_Show_Console, gamefunc_Show_Console,
gamefunc_Show_DukeMatch_Scores, gamefunc_Show_DukeMatch_Scores,
gamefunc_Dpad_Select, gamefunc_Dpad_Select,
gamefunc_Dpad_Aiming gamefunc_Dpad_Aiming,
gamefunc_Alt_Weapon,
}; };
#ifdef __cplusplus #ifdef __cplusplus
} }

View file

@ -7169,4 +7169,5 @@ static void G_SetupGameButtons(void)
CONTROL_DefineFlag(gamefunc_Quick_Kick,FALSE); CONTROL_DefineFlag(gamefunc_Quick_Kick,FALSE);
CONTROL_DefineFlag(gamefunc_Next_Weapon,FALSE); CONTROL_DefineFlag(gamefunc_Next_Weapon,FALSE);
CONTROL_DefineFlag(gamefunc_Previous_Weapon,FALSE); CONTROL_DefineFlag(gamefunc_Previous_Weapon,FALSE);
CONTROL_DefineFlag(gamefunc_Alt_Weapon,FALSE);
} }

View file

@ -736,6 +736,7 @@ const char *EventNames[MAXEVENTS] =
"EVENT_ENDLEVELSCREEN", "EVENT_ENDLEVELSCREEN",
"EVENT_EXITGAMESCREEN", "EVENT_EXITGAMESCREEN",
"EVENT_EXITPROGRAMSCREEN", "EVENT_EXITPROGRAMSCREEN",
"EVENT_ALTWEAPON",
#ifdef LUNATIC #ifdef LUNATIC
"EVENT_ANIMATEALLSPRITES", "EVENT_ANIMATEALLSPRITES",
#endif #endif

View file

@ -2971,6 +2971,9 @@ void P_GetInput(int playerNum)
if (BUTTON(gamefunc_Next_Weapon) || (BUTTON(gamefunc_Dpad_Select) && staticInput.fvel > 0)) if (BUTTON(gamefunc_Next_Weapon) || (BUTTON(gamefunc_Dpad_Select) && staticInput.fvel > 0))
weaponSelection = 12; weaponSelection = 12;
if (BUTTON(gamefunc_Alt_Weapon))
weaponSelection = 13;
if (BUTTON(gamefunc_Jump) && pPlayer->on_ground) if (BUTTON(gamefunc_Jump) && pPlayer->on_ground)
g_emuJumpTics = 4; g_emuJumpTics = 4;

View file

@ -2552,6 +2552,9 @@ CHECKINV1:
case 11: case 11:
weaponNum = VM_OnEventWithReturn(EVENT_NEXTWEAPON,pPlayer->i,playerNum, weaponNum); weaponNum = VM_OnEventWithReturn(EVENT_NEXTWEAPON,pPlayer->i,playerNum, weaponNum);
break; break;
case 12:
weaponNum = VM_OnEventWithReturn(EVENT_ALTWEAPON,pPlayer->i,playerNum, weaponNum);
break;
} }
// NOTE: it is assumed that the above events return either -1 or a // NOTE: it is assumed that the above events return either -1 or a
@ -2644,6 +2647,22 @@ CHECKINV1:
pPlayer->subweapon |= (1<<GROW_WEAPON); pPlayer->subweapon |= (1<<GROW_WEAPON);
} }
if (weaponNum == 12)
{
switch (pPlayer->curr_weapon)
{
case HANDREMOTE_WEAPON:
weaponNum = HANDBOMB_WEAPON;
break;
case GROW_WEAPON:
weaponNum = SHRINKER_WEAPON;
break;
default:
weaponNum = pPlayer->curr_weapon;
break;
}
}
P_SetWeaponGamevars(playerNum, pPlayer); P_SetWeaponGamevars(playerNum, pPlayer);
weaponNum = VM_OnEventWithReturn(EVENT_SELECTWEAPON,pPlayer->i,playerNum, weaponNum); weaponNum = VM_OnEventWithReturn(EVENT_SELECTWEAPON,pPlayer->i,playerNum, weaponNum);