Skip to content

Commit

Permalink
port: put instant detonate flow in own function
Browse files Browse the repository at this point in the history
  • Loading branch information
cylonicboom committed Oct 22, 2023
1 parent 05c108a commit 0ea3bea
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 11 deletions.
26 changes: 15 additions & 11 deletions src/game/bondmove.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,20 @@
#include "input.h"
#include "video.h"

static void bgunProcessQuickDetonate(struct movedata *data, u32 c1buttons, u32 c1buttonsthisframe, u32 buttons1, u32 buttons2) {
if ((((c1buttons & (buttons1)) && (c1buttonsthisframe & (buttons2)))
|| ((c1buttons & (buttons2)) && (c1buttonsthisframe & (buttons1))))
&& bgunGetWeaponNum(HAND_RIGHT) == WEAPON_REMOTEMINE) {
data->detonating = true;
data->weaponbackoffset = 0;
data->weaponforwardoffset = 0;
data->btapcount = 0;
amClose();
g_Vars.currentplayer->invdowntime = -2;
g_Vars.currentplayer->usedowntime = -2;
}
}

static void bgunProcessInputAltButton(struct movedata *data, s8 contpad, s32 i)
{
s32 buttons = joyGetButtonsOnSample(i, contpad, 0xffffffff);
Expand Down Expand Up @@ -1734,17 +1748,7 @@ void bmoveProcessInput(bool allowc1x, bool allowc1y, bool allowc1buttons, bool i
g_Vars.currentplayer->usedowntime = -2;
}
#else
if ((((c1buttons & (BUTTON_CANCEL_USE | BUTTON_ACCEPT_USE)) && (c1buttonsthisframe & (BUTTON_WPNBACK | BUTTON_RADIAL)))
|| ((c1buttons & (BUTTON_WPNBACK | BUTTON_RADIAL)) && (c1buttonsthisframe & (BUTTON_CANCEL_USE | BUTTON_ACCEPT_USE))))
&& weaponnum == WEAPON_REMOTEMINE) {
movedata.detonating = true;
movedata.weaponbackoffset = 0;
movedata.weaponforwardoffset = 0;
movedata.btapcount = 0;
amClose();
g_Vars.currentplayer->invdowntime = -2;
g_Vars.currentplayer->usedowntime = -2;
}
bgunProcessQuickDetonate(&movedata, c1buttons, c1buttonsthisframe, (BUTTON_CANCEL_USE | BUTTON_ACCEPT_USE), (BUTTON_WPNBACK | BUTTON_RADIAL));
#endif
}

Expand Down
1 change: 1 addition & 0 deletions src/include/game/bondmove.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ void bmoveGrabProp(struct prop *prop);
void bmoveSetMode(u32 movemode);
void bmoveSetModeForAllPlayers(u32 movemode);
void bmoveHandleActivate(void);
static void bgunProcessQuickDetonate(struct movedata *data, u32 c1buttons, u32 c1buttonsthisframe, u32 buttons1, u32 buttons2);
static void bgunProcessInputAltButton(struct movedata *data, s8 contpad, s32 i);
void bmoveApplyMoveData(struct movedata *data);
void bmoveUpdateSpeedTheta(void);
Expand Down

0 comments on commit 0ea3bea

Please sign in to comment.