From 05c108a950573804617af2ff3dcb9fb146deb83f Mon Sep 17 00:00:00 2001 From: Catherine Reprobate Date: Sun, 22 Oct 2023 11:18:38 -0700 Subject: [PATCH 1/2] fixup: quick detonate --- src/game/bondmove.c | 15 ++------------- src/include/game/bondmove.h | 1 + 2 files changed, 3 insertions(+), 13 deletions(-) diff --git a/src/game/bondmove.c b/src/game/bondmove.c index bceacb72e..d9501b001 100644 --- a/src/game/bondmove.c +++ b/src/game/bondmove.c @@ -1734,8 +1734,8 @@ void bmoveProcessInput(bool allowc1x, bool allowc1y, bool allowc1buttons, bool i g_Vars.currentplayer->usedowntime = -2; } #else - if ((((c1buttons & BUTTON_RADIAL) && (c1buttonsthisframe & BUTTON_CANCEL_USE)) - || ((c1buttons & BUTTON_CANCEL_USE) && (c1buttonsthisframe & BUTTON_RADIAL))) + 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; @@ -1744,17 +1744,6 @@ void bmoveProcessInput(bool allowc1x, bool allowc1y, bool allowc1buttons, bool i amClose(); g_Vars.currentplayer->invdowntime = -2; g_Vars.currentplayer->usedowntime = -2; - g_Vars.currentplayer->amdowntime = 0; - } - if ((((c1buttons & BUTTON_WPNBACK) && (c1buttonsthisframe & BUTTON_CANCEL_USE)) - || ((c1buttons & BUTTON_CANCEL_USE) && (c1buttonsthisframe & BUTTON_WPNBACK))) - && weaponnum == WEAPON_REMOTEMINE) { - movedata.detonating = true; - movedata.weaponbackoffset = 0; - movedata.weaponforwardoffset = 0; - movedata.btapcount = 0; - g_Vars.currentplayer->invdowntime = -2; - g_Vars.currentplayer->usedowntime = -2; } #endif } diff --git a/src/include/game/bondmove.h b/src/include/game/bondmove.h index 7733b613f..fc951649b 100644 --- a/src/include/game/bondmove.h +++ b/src/include/game/bondmove.h @@ -21,6 +21,7 @@ void bmoveGrabProp(struct prop *prop); void bmoveSetMode(u32 movemode); void bmoveSetModeForAllPlayers(u32 movemode); void bmoveHandleActivate(void); +static void bgunProcessInputAltButton(struct movedata *data, s8 contpad, s32 i); void bmoveApplyMoveData(struct movedata *data); void bmoveUpdateSpeedTheta(void); f32 bmoveGetSpeedVertaLimit(f32 value); From 0ea3bea0968e66448ebd8bda1065cf0a1bf964d6 Mon Sep 17 00:00:00 2001 From: Catherine Reprobate Date: Sun, 22 Oct 2023 16:35:30 -0700 Subject: [PATCH 2/2] port: put instant detonate flow in own function --- src/game/bondmove.c | 26 +++++++++++++++----------- src/include/game/bondmove.h | 1 + 2 files changed, 16 insertions(+), 11 deletions(-) diff --git a/src/game/bondmove.c b/src/game/bondmove.c index d9501b001..a7ea7dfbe 100644 --- a/src/game/bondmove.c +++ b/src/game/bondmove.c @@ -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); @@ -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 } diff --git a/src/include/game/bondmove.h b/src/include/game/bondmove.h index fc951649b..a37768377 100644 --- a/src/include/game/bondmove.h +++ b/src/include/game/bondmove.h @@ -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);