Replace gamefunc_Alt_Weapon with a gamefunc_Alt_Fire that works as expected

git-svn-id: https://svn.eduke32.com/eduke32@7761 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
terminx 2019-07-06 16:30:43 +00:00 committed by Christoph Oelckers
parent 6f54235b7a
commit 4e81b4e2f0
8 changed files with 22 additions and 31 deletions

View file

@ -110,7 +110,7 @@ char gamefunctions[NUMGAMEFUNCTIONS][MAXGAMEFUNCLEN] =
#endif #endif
"Dpad_Select", "Dpad_Select",
"Dpad_Aiming", "Dpad_Aiming",
"Alternate_Weapon", "Alt_Fire",
"Last_Used_Weapon", "Last_Used_Weapon",
"Quick_Save", "Quick_Save",
"Quick_Load", "Quick_Load",
@ -249,7 +249,7 @@ const char oldkeydefaults[NUMGAMEFUNCTIONS*2][MAXGAMEFUNCLEN] =
static const char * mousedefaults[MAXMOUSEBUTTONS] = static const char * mousedefaults[MAXMOUSEBUTTONS] =
{ {
"Fire", "Fire",
"MedKit", "Alt_Fire",
"Jetpack", "Jetpack",
"", "",
"Previous_Weapon", "Previous_Weapon",

View file

@ -140,7 +140,7 @@ enum GameEvent_t {
EVENT_ENDLEVELSCREEN, EVENT_ENDLEVELSCREEN,
EVENT_EXITGAMESCREEN, EVENT_EXITGAMESCREEN,
EVENT_EXITPROGRAMSCREEN, EVENT_EXITPROGRAMSCREEN,
EVENT_ALTWEAPON, EVENT_ALTFIRE,
EVENT_DISPLAYOVERHEADMAPPLAYER, EVENT_DISPLAYOVERHEADMAPPLAYER,
EVENT_MENUCURSORLEFT, EVENT_MENUCURSORLEFT,
EVENT_MENUCURSORRIGHT, EVENT_MENUCURSORRIGHT,

View file

@ -99,7 +99,7 @@ enum GameFunction_t
gamefunc_Show_DukeMatch_Scores, gamefunc_Show_DukeMatch_Scores,
gamefunc_Dpad_Select, gamefunc_Dpad_Select,
gamefunc_Dpad_Aiming, gamefunc_Dpad_Aiming,
gamefunc_Alt_Weapon, gamefunc_Alt_Fire,
gamefunc_Last_Weapon, gamefunc_Last_Weapon,
gamefunc_Quick_Save, gamefunc_Quick_Save,
gamefunc_Quick_Load, gamefunc_Quick_Load,

View file

@ -7032,15 +7032,13 @@ int G_DoMoveThings(void)
for (bssize_t TRAVERSE_CONNECT(i)) for (bssize_t TRAVERSE_CONNECT(i))
{ {
if (g_player[i].inputBits->extbits&(1<<6)) if (g_player[i].ps->team != g_player[i].pteam && g_gametypeFlags[ud.coop] & GAMETYPE_TDM)
{ {
g_player[i].ps->team = g_player[i].pteam; g_player[i].ps->team = g_player[i].pteam;
if (g_gametypeFlags[ud.coop] & GAMETYPE_TDM)
{
actor[g_player[i].ps->i].picnum = APLAYERTOP; actor[g_player[i].ps->i].picnum = APLAYERTOP;
P_QuickKill(g_player[i].ps); P_QuickKill(g_player[i].ps);
} }
}
if (g_gametypeFlags[ud.coop] & GAMETYPE_TDM) if (g_gametypeFlags[ud.coop] & GAMETYPE_TDM)
g_player[i].ps->palookup = g_player[i].pcolor = G_GetTeamPalette(g_player[i].ps->team); g_player[i].ps->palookup = g_player[i].pcolor = G_GetTeamPalette(g_player[i].ps->team);
@ -7256,7 +7254,7 @@ 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); CONTROL_DefineFlag(gamefunc_Alt_Fire,FALSE);
CONTROL_DefineFlag(gamefunc_Last_Weapon,FALSE); CONTROL_DefineFlag(gamefunc_Last_Weapon,FALSE);
CONTROL_DefineFlag(gamefunc_Quick_Save, FALSE); CONTROL_DefineFlag(gamefunc_Quick_Save, FALSE);
CONTROL_DefineFlag(gamefunc_Quick_Load, FALSE); CONTROL_DefineFlag(gamefunc_Quick_Load, FALSE);

View file

@ -967,7 +967,7 @@ const char *EventNames[MAXEVENTS] =
"EVENT_ENDLEVELSCREEN", "EVENT_ENDLEVELSCREEN",
"EVENT_EXITGAMESCREEN", "EVENT_EXITGAMESCREEN",
"EVENT_EXITPROGRAMSCREEN", "EVENT_EXITPROGRAMSCREEN",
"EVENT_ALTWEAPON", "EVENT_ALTFIRE",
"EVENT_DISPLAYOVERHEADMAPPLAYER", "EVENT_DISPLAYOVERHEADMAPPLAYER",
"EVENT_MENUCURSORLEFT", "EVENT_MENUCURSORLEFT",
"EVENT_MENUCURSORRIGHT", "EVENT_MENUCURSORRIGHT",

View file

@ -2895,7 +2895,6 @@ void P_GetInput(int const playerNum)
Bmemset(&localInput, 0, sizeof(input_t)); Bmemset(&localInput, 0, sizeof(input_t));
localInput.bits = (((int32_t)g_gameQuit) << SK_GAMEQUIT); localInput.bits = (((int32_t)g_gameQuit) << SK_GAMEQUIT);
localInput.extbits = (g_player[playerNum].pteam != pPlayer->team) << 6;
localInput.extbits |= (1<<7); localInput.extbits |= (1<<7);
return; return;
@ -3032,8 +3031,6 @@ void P_GetInput(int const playerNum)
} }
if (BUTTON(gamefunc_Last_Weapon)) if (BUTTON(gamefunc_Last_Weapon))
weaponSelection = 14;
else if (BUTTON(gamefunc_Alt_Weapon))
weaponSelection = 13; weaponSelection = 13;
else if (BUTTON(gamefunc_Next_Weapon) || (BUTTON(gamefunc_Dpad_Select) && input.fvel > 0)) else if (BUTTON(gamefunc_Next_Weapon) || (BUTTON(gamefunc_Dpad_Select) && input.fvel > 0))
weaponSelection = 12; weaponSelection = 12;
@ -3090,15 +3087,9 @@ void P_GetInput(int const playerNum)
localInput.extbits |= (BUTTON(gamefunc_Move_Backward) || (input.fvel < 0)) << 1; localInput.extbits |= (BUTTON(gamefunc_Move_Backward) || (input.fvel < 0)) << 1;
localInput.extbits |= (BUTTON(gamefunc_Strafe_Left) || (input.svel > 0)) << 2; localInput.extbits |= (BUTTON(gamefunc_Strafe_Left) || (input.svel > 0)) << 2;
localInput.extbits |= (BUTTON(gamefunc_Strafe_Right) || (input.svel < 0)) << 3; localInput.extbits |= (BUTTON(gamefunc_Strafe_Right) || (input.svel < 0)) << 3;
if (VM_HaveEvent(EVENT_PROCESSINPUT) || VM_HaveEvent(EVENT_TURNLEFT))
localInput.extbits |= BUTTON(gamefunc_Turn_Left)<<4; localInput.extbits |= BUTTON(gamefunc_Turn_Left)<<4;
if (VM_HaveEvent(EVENT_PROCESSINPUT) || VM_HaveEvent(EVENT_TURNRIGHT))
localInput.extbits |= BUTTON(gamefunc_Turn_Right)<<5; localInput.extbits |= BUTTON(gamefunc_Turn_Right)<<5;
localInput.extbits |= BUTTON(gamefunc_Alt_Fire)<<6;
// used for changing team
localInput.extbits |= (g_player[playerNum].pteam != pPlayer->team)<<6;
if (ud.scrollmode && ud.overhead_on) if (ud.scrollmode && ud.overhead_on)
{ {
@ -3945,9 +3936,11 @@ static void P_ProcessWeapon(int playerNum)
pPlayer->rapid_fire_hold = 0; pPlayer->rapid_fire_hold = 0;
} }
int const doAltFire = g_player[playerNum].inputBits->extbits & (1<<6);
if (playerShrunk || pPlayer->tipincs || pPlayer->access_incs) if (playerShrunk || pPlayer->tipincs || pPlayer->access_incs)
playerBits &= ~BIT(SK_FIRE); playerBits &= ~BIT(SK_FIRE);
else if ((playerBits & (1 << 2)) && (*weaponFrame) == 0 && pPlayer->fist_incs == 0 && else if ((playerBits & BIT(SK_FIRE) || doAltFire) && (*weaponFrame) == 0 && pPlayer->fist_incs == 0 &&
pPlayer->last_weapon == -1 && (pPlayer->weapon_pos == 0 || pPlayer->holster_weapon == 1)) pPlayer->last_weapon == -1 && (pPlayer->weapon_pos == 0 || pPlayer->holster_weapon == 1))
{ {
pPlayer->crack_time = PCRACKTIME; pPlayer->crack_time = PCRACKTIME;
@ -3965,7 +3958,10 @@ static void P_ProcessWeapon(int playerNum)
{ {
P_SetWeaponGamevars(playerNum, pPlayer); P_SetWeaponGamevars(playerNum, pPlayer);
if (VM_OnEvent(EVENT_FIRE, pPlayer->i, playerNum) == 0) if (doAltFire)
VM_OnEvent(EVENT_ALTFIRE, pPlayer->i, playerNum);
if (playerBits & BIT(SK_FIRE) && VM_OnEvent(EVENT_FIRE, pPlayer->i, playerNum) == 0)
{ {
// this event is deprecated // this event is deprecated
VM_OnEvent(EVENT_FIREWEAPON, pPlayer->i, playerNum); VM_OnEvent(EVENT_FIREWEAPON, pPlayer->i, playerNum);

View file

@ -126,7 +126,7 @@ typedef struct {
uint32_t bits; uint32_t bits;
int16_t fvel, svel; int16_t fvel, svel;
fix16_t q16avel, q16horz; fix16_t q16avel, q16horz;
int8_t extbits; uint8_t extbits;
} input_t; } input_t;
#pragma pack(push,1) #pragma pack(push,1)

View file

@ -2655,9 +2655,6 @@ CHECKINV1:
weaponNum = VM_OnEventWithReturn(EVENT_NEXTWEAPON,pPlayer->i,playerNum, weaponNum); weaponNum = VM_OnEventWithReturn(EVENT_NEXTWEAPON,pPlayer->i,playerNum, weaponNum);
break; break;
case 12: case 12:
weaponNum = VM_OnEventWithReturn(EVENT_ALTWEAPON,pPlayer->i,playerNum, weaponNum);
break;
case 13:
weaponNum = VM_OnEventWithReturn(EVENT_LASTWEAPON,pPlayer->i,playerNum, weaponNum); weaponNum = VM_OnEventWithReturn(EVENT_LASTWEAPON,pPlayer->i,playerNum, weaponNum);
break; break;
} }