From 4c290ab4ec328731964493becf12191430635b2b Mon Sep 17 00:00:00 2001 From: terminx Date: Sat, 6 Jul 2019 19:04:59 +0000 Subject: [PATCH] Add gamefunc_Alt_Weapon and EVENT_ALTWEAPON back in git-svn-id: https://svn.eduke32.com/eduke32@7771 1a8010ca-5511-0410-912e-c29ae57300e0 --- source/duke3d/src/_functio.h | 3 +++ source/duke3d/src/events_defs.h | 1 + source/duke3d/src/function.h | 3 ++- source/duke3d/src/game.cpp | 1 + source/duke3d/src/gamedef.cpp | 1 + source/duke3d/src/player.cpp | 3 +++ source/duke3d/src/sector.cpp | 3 +++ 7 files changed, 14 insertions(+), 1 deletion(-) diff --git a/source/duke3d/src/_functio.h b/source/duke3d/src/_functio.h index e3fdf522a..28c1e018c 100644 --- a/source/duke3d/src/_functio.h +++ b/source/duke3d/src/_functio.h @@ -114,6 +114,7 @@ char gamefunctions[NUMGAMEFUNCTIONS][MAXGAMEFUNCLEN] = "Last_Used_Weapon", "Quick_Save", "Quick_Load", + "Alt_Weapon", }; #ifdef __SETUP__ @@ -180,6 +181,7 @@ const char keydefaults[NUMGAMEFUNCTIONS*2][MAXGAMEFUNCLEN] = "", "", "F6", "", "F9", "", + "", "", }; const char oldkeydefaults[NUMGAMEFUNCTIONS*2][MAXGAMEFUNCLEN] = @@ -244,6 +246,7 @@ const char oldkeydefaults[NUMGAMEFUNCTIONS*2][MAXGAMEFUNCLEN] = "", "", "F6", "", "F9", "", + "", "", }; static const char * mousedefaults[MAXMOUSEBUTTONS] = diff --git a/source/duke3d/src/events_defs.h b/source/duke3d/src/events_defs.h index 2946fca28..d710ae29f 100644 --- a/source/duke3d/src/events_defs.h +++ b/source/duke3d/src/events_defs.h @@ -141,6 +141,7 @@ enum GameEvent_t { EVENT_EXITGAMESCREEN, EVENT_EXITPROGRAMSCREEN, EVENT_ALTFIRE, + EVENT_ALTWEAPON, EVENT_DISPLAYOVERHEADMAPPLAYER, EVENT_MENUCURSORLEFT, EVENT_MENUCURSORRIGHT, diff --git a/source/duke3d/src/function.h b/source/duke3d/src/function.h index 69a017bf6..4ac751601 100644 --- a/source/duke3d/src/function.h +++ b/source/duke3d/src/function.h @@ -34,7 +34,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. extern "C" { #endif -#define NUMGAMEFUNCTIONS 60 +#define NUMGAMEFUNCTIONS 61 #define MAXGAMEFUNCLEN 32 extern char gamefunctions[NUMGAMEFUNCTIONS][MAXGAMEFUNCLEN]; @@ -103,6 +103,7 @@ enum GameFunction_t gamefunc_Last_Weapon, gamefunc_Quick_Save, gamefunc_Quick_Load, + gamefunc_Alt_Weapon, }; #ifdef __cplusplus } diff --git a/source/duke3d/src/game.cpp b/source/duke3d/src/game.cpp index 0f389d34e..4429dcd8c 100644 --- a/source/duke3d/src/game.cpp +++ b/source/duke3d/src/game.cpp @@ -7239,4 +7239,5 @@ static void G_SetupGameButtons(void) CONTROL_DefineFlag(gamefunc_Last_Weapon,FALSE); CONTROL_DefineFlag(gamefunc_Quick_Save, FALSE); CONTROL_DefineFlag(gamefunc_Quick_Load, FALSE); + CONTROL_DefineFlag(gamefunc_Alt_Weapon,FALSE); } diff --git a/source/duke3d/src/gamedef.cpp b/source/duke3d/src/gamedef.cpp index 209f4258e..ef4fb1a2c 100644 --- a/source/duke3d/src/gamedef.cpp +++ b/source/duke3d/src/gamedef.cpp @@ -968,6 +968,7 @@ const char *EventNames[MAXEVENTS] = "EVENT_EXITGAMESCREEN", "EVENT_EXITPROGRAMSCREEN", "EVENT_ALTFIRE", + "EVENT_ALTWEAPON", "EVENT_DISPLAYOVERHEADMAPPLAYER", "EVENT_MENUCURSORLEFT", "EVENT_MENUCURSORRIGHT", diff --git a/source/duke3d/src/player.cpp b/source/duke3d/src/player.cpp index e1136bfc3..5060dd204 100644 --- a/source/duke3d/src/player.cpp +++ b/source/duke3d/src/player.cpp @@ -3030,7 +3030,10 @@ void P_GetInput(int const playerNum) } } + if (BUTTON(gamefunc_Last_Weapon)) + weaponSelection = 14; + else if (BUTTON(gamefunc_Alt_Weapon)) weaponSelection = 13; else if (BUTTON(gamefunc_Next_Weapon) || (BUTTON(gamefunc_Dpad_Select) && input.fvel > 0)) weaponSelection = 12; diff --git a/source/duke3d/src/sector.cpp b/source/duke3d/src/sector.cpp index 9186df371..c3505e10a 100644 --- a/source/duke3d/src/sector.cpp +++ b/source/duke3d/src/sector.cpp @@ -2655,6 +2655,9 @@ CHECKINV1: weaponNum = VM_OnEventWithReturn(EVENT_NEXTWEAPON,pPlayer->i,playerNum, weaponNum); break; case 12: + weaponNum = VM_OnEventWithReturn(EVENT_ALTWEAPON,pPlayer->i,playerNum, weaponNum); + break; + case 13: weaponNum = VM_OnEventWithReturn(EVENT_LASTWEAPON,pPlayer->i,playerNum, weaponNum); break; }