Add Crouch Toggle gamefunc

git-svn-id: https://svn.eduke32.com/eduke32@7978 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
hendricks266 2019-08-14 03:03:27 +00:00 committed by Christoph Oelckers
parent 04811f21f4
commit ba730be6b6
7 changed files with 20 additions and 3 deletions

View file

@ -116,6 +116,7 @@ char gamefunctions[NUMGAMEFUNCTIONS][MAXGAMEFUNCLEN] =
"Quick_Load", "Quick_Load",
"Alt_Weapon", "Alt_Weapon",
"Third_Person_View", "Third_Person_View",
"Crouch_Toggle",
}; };
#ifdef __SETUP__ #ifdef __SETUP__
@ -184,6 +185,7 @@ const char keydefaults[NUMGAMEFUNCTIONS*2][MAXGAMEFUNCLEN] =
"F9", "", "F9", "",
"", "", "", "",
"F7", "", "F7", "",
"", "",
}; };
const char oldkeydefaults[NUMGAMEFUNCTIONS*2][MAXGAMEFUNCLEN] = const char oldkeydefaults[NUMGAMEFUNCTIONS*2][MAXGAMEFUNCLEN] =
@ -250,6 +252,7 @@ const char oldkeydefaults[NUMGAMEFUNCTIONS*2][MAXGAMEFUNCLEN] =
"F9", "", "F9", "",
"", "", "", "",
"F7", "", "F7", "",
"", "",
}; };
static const char * mousedefaults[MAXMOUSEBUTTONS] = static const char * mousedefaults[MAXMOUSEBUTTONS] =

View file

@ -34,7 +34,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
extern "C" { extern "C" {
#endif #endif
#define NUMGAMEFUNCTIONS 62 #define NUMGAMEFUNCTIONS 63
#define MAXGAMEFUNCLEN 32 #define MAXGAMEFUNCLEN 32
extern char gamefunctions[NUMGAMEFUNCTIONS][MAXGAMEFUNCLEN]; extern char gamefunctions[NUMGAMEFUNCTIONS][MAXGAMEFUNCLEN];
@ -105,6 +105,7 @@ enum GameFunction_t
gamefunc_Quick_Load, gamefunc_Quick_Load,
gamefunc_Alt_Weapon, gamefunc_Alt_Weapon,
gamefunc_Third_Person_View, gamefunc_Third_Person_View,
gamefunc_Crouch_Toggle,
}; };
#ifdef __cplusplus #ifdef __cplusplus
} }

View file

@ -5060,6 +5060,12 @@ FAKE_F3:
P_DoQuote(QUOTE_RUN_MODE_OFF + ud.auto_run, &myplayer); P_DoQuote(QUOTE_RUN_MODE_OFF + ud.auto_run, &myplayer);
} }
if (BUTTON(gamefunc_Crouch_Toggle))
{
CONTROL_ClearButton(gamefunc_Crouch_Toggle);
myplayer.crouch_toggle = !myplayer.crouch_toggle;
}
if (BUTTON(gamefunc_Map)) if (BUTTON(gamefunc_Map))
{ {
CONTROL_ClearButton(gamefunc_Map); CONTROL_ClearButton(gamefunc_Map);
@ -7392,4 +7398,5 @@ static void G_SetupGameButtons(void)
CONTROL_DefineFlag(gamefunc_Quick_Load, FALSE); CONTROL_DefineFlag(gamefunc_Quick_Load, FALSE);
CONTROL_DefineFlag(gamefunc_Alt_Weapon,FALSE); CONTROL_DefineFlag(gamefunc_Alt_Weapon,FALSE);
CONTROL_DefineFlag(gamefunc_Third_Person_View, FALSE); CONTROL_DefineFlag(gamefunc_Third_Person_View, FALSE);
CONTROL_DefineFlag(gamefunc_Crouch_Toggle, FALSE);
} }

View file

@ -450,6 +450,7 @@ enum PlayerLabel_t
PLAYER_DEATHS, PLAYER_DEATHS,
PLAYER_LAST_USED_WEAPON, PLAYER_LAST_USED_WEAPON,
PLAYER_BSUBWEAPON, PLAYER_BSUBWEAPON,
PLAYER_CROUCH_TOGGLE,
PLAYER_END PLAYER_END
}; };

View file

@ -544,6 +544,7 @@ const memberlabel_t PlayerLabels[]=
{ "deaths", PLAYER_DEATHS, 0, 0, -1 }, { "deaths", PLAYER_DEATHS, 0, 0, -1 },
{ "last_used_weapon", PLAYER_LAST_USED_WEAPON, 0, 0, -1 }, { "last_used_weapon", PLAYER_LAST_USED_WEAPON, 0, 0, -1 },
{ "bsubweapon", PLAYER_BSUBWEAPON, LABEL_HASPARM2, MAX_WEAPONS, -1 }, { "bsubweapon", PLAYER_BSUBWEAPON, LABEL_HASPARM2, MAX_WEAPONS, -1 },
{ "crouch_toggle", PLAYER_CROUCH_TOGGLE, 0, 0, -1 },
}; };
int32_t __fastcall VM_GetPlayer(int const playerNum, int32_t labelNum, int const lParm2) int32_t __fastcall VM_GetPlayer(int const playerNum, int32_t labelNum, int const lParm2)
@ -592,6 +593,7 @@ int32_t __fastcall VM_GetPlayer(int const playerNum, int32_t labelNum, int const
case PLAYER_CHEAT_PHASE: labelNum = ps.cheat_phase; break; case PLAYER_CHEAT_PHASE: labelNum = ps.cheat_phase; break;
case PLAYER_CLIPDIST: labelNum = ps.clipdist; break; case PLAYER_CLIPDIST: labelNum = ps.clipdist; break;
case PLAYER_CRACK_TIME: labelNum = ps.crack_time; break; case PLAYER_CRACK_TIME: labelNum = ps.crack_time; break;
case PLAYER_CROUCH_TOGGLE: labelNum = ps.crouch_toggle; break;
case PLAYER_CURR_WEAPON: labelNum = ps.curr_weapon; break; case PLAYER_CURR_WEAPON: labelNum = ps.curr_weapon; break;
case PLAYER_CURSECTNUM: labelNum = ps.cursectnum; break; case PLAYER_CURSECTNUM: labelNum = ps.cursectnum; break;
case PLAYER_CUSTOMEXITSOUND: labelNum = ps.customexitsound; break; case PLAYER_CUSTOMEXITSOUND: labelNum = ps.customexitsound; break;
@ -785,6 +787,7 @@ void __fastcall VM_SetPlayer(int const playerNum, int const labelNum, int const
case PLAYER_CHEAT_PHASE: ps.cheat_phase = newValue; break; case PLAYER_CHEAT_PHASE: ps.cheat_phase = newValue; break;
case PLAYER_CLIPDIST: ps.clipdist = newValue; break; case PLAYER_CLIPDIST: ps.clipdist = newValue; break;
case PLAYER_CRACK_TIME: ps.crack_time = newValue; break; case PLAYER_CRACK_TIME: ps.crack_time = newValue; break;
case PLAYER_CROUCH_TOGGLE: ps.crouch_toggle = newValue; break;
case PLAYER_CURR_WEAPON: ps.curr_weapon = newValue; break; case PLAYER_CURR_WEAPON: ps.curr_weapon = newValue; break;
case PLAYER_CURSECTNUM: ps.cursectnum = newValue; break; case PLAYER_CURSECTNUM: ps.cursectnum = newValue; break;
case PLAYER_CUSTOMEXITSOUND: ps.customexitsound = newValue; break; case PLAYER_CUSTOMEXITSOUND: ps.customexitsound = newValue; break;

View file

@ -3051,7 +3051,7 @@ void P_GetInput(int const playerNum)
localInput.bits |= (BUTTON(gamefunc_Open) << SK_OPEN); localInput.bits |= (BUTTON(gamefunc_Open) << SK_OPEN);
localInput.bits |= (BUTTON(gamefunc_Jump) << SK_JUMP) | (BUTTON(gamefunc_Crouch) << SK_CROUCH); localInput.bits |= (BUTTON(gamefunc_Jump) << SK_JUMP) | ((BUTTON(gamefunc_Crouch)|pPlayer->crouch_toggle) << SK_CROUCH);
localInput.bits |= (BUTTON(gamefunc_Aim_Up) || (BUTTON(gamefunc_Dpad_Aiming) && input.fvel > 0)) << SK_AIM_UP; localInput.bits |= (BUTTON(gamefunc_Aim_Up) || (BUTTON(gamefunc_Dpad_Aiming) && input.fvel > 0)) << SK_AIM_UP;
localInput.bits |= (BUTTON(gamefunc_Aim_Down) || (BUTTON(gamefunc_Dpad_Aiming) && input.fvel < 0)) << SK_AIM_DOWN; localInput.bits |= (BUTTON(gamefunc_Aim_Down) || (BUTTON(gamefunc_Dpad_Aiming) && input.fvel < 0)) << SK_AIM_DOWN;

View file

@ -215,7 +215,9 @@ typedef struct {
// anywhere (like with spritetype_t): g_player[i].ps->wa.idx == i. // anywhere (like with spritetype_t): g_player[i].ps->wa.idx == i.
struct { int32_t idx; } wa; struct { int32_t idx; } wa;
#endif #endif
int8_t padding_[2];
int8_t crouch_toggle;
int8_t padding_[1];
} DukePlayer_t; } DukePlayer_t;
// KEEPINSYNC lunatic/_defs_game.lua // KEEPINSYNC lunatic/_defs_game.lua