mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-11-11 07:11:39 +00:00
Add gamefunc for switching to your last used weapon
git-svn-id: https://svn.eduke32.com/eduke32@6723 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
ea391a9b83
commit
7fa0abda26
4 changed files with 18 additions and 5 deletions
|
@ -111,11 +111,12 @@ char gamefunctions[NUMGAMEFUNCTIONS][MAXGAMEFUNCLEN] =
|
|||
"Dpad_Select",
|
||||
"Dpad_Aiming",
|
||||
"Alternate_Weapon",
|
||||
"Last_Used_Weapon"
|
||||
};
|
||||
|
||||
#ifdef __SETUP__
|
||||
|
||||
#define NUMKEYENTRIES 57
|
||||
#define NUMKEYENTRIES 58
|
||||
|
||||
const char keydefaults[NUMGAMEFUNCTIONS*2][MAXGAMEFUNCLEN] =
|
||||
{
|
||||
|
@ -176,6 +177,7 @@ const char keydefaults[NUMGAMEFUNCTIONS*2][MAXGAMEFUNCLEN] =
|
|||
"", "",
|
||||
"", "",
|
||||
"", "",
|
||||
"", "",
|
||||
};
|
||||
|
||||
const char oldkeydefaults[NUMGAMEFUNCTIONS*2][MAXGAMEFUNCLEN] =
|
||||
|
@ -237,6 +239,7 @@ const char oldkeydefaults[NUMGAMEFUNCTIONS*2][MAXGAMEFUNCLEN] =
|
|||
"", "",
|
||||
"", "",
|
||||
"", "",
|
||||
"", "",
|
||||
};
|
||||
|
||||
static const char * mousedefaults[MAXMOUSEBUTTONS] =
|
||||
|
|
|
@ -34,8 +34,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define NUMKEYENTRIES 57
|
||||
#define NUMGAMEFUNCTIONS 57
|
||||
#define NUMKEYENTRIES 58
|
||||
#define NUMGAMEFUNCTIONS 58
|
||||
#define MAXGAMEFUNCLEN 32
|
||||
|
||||
extern char gamefunctions[NUMGAMEFUNCTIONS][MAXGAMEFUNCLEN];
|
||||
|
@ -101,6 +101,7 @@ enum GameFunction_t
|
|||
gamefunc_Dpad_Select,
|
||||
gamefunc_Dpad_Aiming,
|
||||
gamefunc_Alt_Weapon,
|
||||
gamefunc_Last_Weapon,
|
||||
};
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
@ -7152,4 +7152,5 @@ static void G_SetupGameButtons(void)
|
|||
CONTROL_DefineFlag(gamefunc_Next_Weapon,FALSE);
|
||||
CONTROL_DefineFlag(gamefunc_Previous_Weapon,FALSE);
|
||||
CONTROL_DefineFlag(gamefunc_Alt_Weapon,FALSE);
|
||||
CONTROL_DefineFlag(gamefunc_Last_Weapon, FALSE);
|
||||
}
|
||||
|
|
|
@ -2811,6 +2811,7 @@ enddisplayweapon:
|
|||
int32_t g_myAimMode = 0, g_myAimStat = 0, g_oldAimStat = 0;
|
||||
int32_t mouseyaxismode = -1;
|
||||
int32_t g_emuJumpTics = 0;
|
||||
int32_t g_lastWeapon = 0;
|
||||
|
||||
void P_GetInput(int playerNum)
|
||||
{
|
||||
|
@ -2974,6 +2975,9 @@ void P_GetInput(int playerNum)
|
|||
if (BUTTON(gamefunc_Alt_Weapon))
|
||||
weaponSelection = 13;
|
||||
|
||||
if (BUTTON(gamefunc_Last_Weapon))
|
||||
weaponSelection = g_lastWeapon + 1;
|
||||
|
||||
if (BUTTON(gamefunc_Jump) && pPlayer->on_ground)
|
||||
g_emuJumpTics = 4;
|
||||
|
||||
|
@ -3344,13 +3348,17 @@ static void P_ChangeWeapon(DukePlayer_t * const pPlayer, int const weaponNum)
|
|||
pPlayer->last_weapon = -1;
|
||||
}
|
||||
|
||||
#ifdef __ANDROID__
|
||||
if (currentWeapon != pPlayer->curr_weapon &&
|
||||
// p->last_weapon != -1 &&
|
||||
!(PWEAPON(playerNum, currentWeapon, WorksLike) == HANDREMOTE_WEAPON && PWEAPON(playerNum, pPlayer->curr_weapon, WorksLike) == HANDBOMB_WEAPON) &&
|
||||
!(PWEAPON(playerNum, currentWeapon, WorksLike) == HANDBOMB_WEAPON && PWEAPON(playerNum, pPlayer->curr_weapon, WorksLike) == HANDREMOTE_WEAPON))
|
||||
CONTROL_Android_SetLastWeapon(PWEAPON(playerNum, currentWeapon, WorksLike) == HANDREMOTE_WEAPON ? (int)HANDBOMB_WEAPON : currentWeapon);
|
||||
{
|
||||
g_lastWeapon = PWEAPON(playerNum, currentWeapon, WorksLike) == HANDREMOTE_WEAPON ? (int) HANDBOMB_WEAPON : currentWeapon;
|
||||
if (g_lastWeapon == GROW_WEAPON) g_lastWeapon = SHRINKER_WEAPON;
|
||||
#ifdef __ANDROID__
|
||||
CONTROL_Android_SetLastWeapon(g_lastWeapon);
|
||||
#endif
|
||||
}
|
||||
|
||||
pPlayer->kickback_pic = 0;
|
||||
|
||||
|
|
Loading…
Reference in a new issue