forked from Ports/perfect_dark
port: possibly fix reloading and some altmodes in N64 schemes
This commit is contained in:
1 parent
228851f867
commit
626b5937ce
3 files changed
+49
-19
No files matched your search
+28
-6
@@ -11719,25 +11719,43 @@ void bgunSetTriggerOn(s32 handnum, bool on)
|
||||
*/
|
||||
s32 bgunConsiderToggleGunFunction(s32 usedowntime, bool trigpressed, bool fromactivemenu, bool fromdedicatedbutton)
|
||||
{
|
||||
#ifndef PLATFORM_N64
|
||||
const bool extcontrols = PLAYER_EXTCFG().extcontrols;
|
||||
#endif
|
||||
switch (bgunGetWeaponNum(HAND_RIGHT)) {
|
||||
case WEAPON_SNIPERRIFLE:
|
||||
if (usedowntime < 0) {
|
||||
if (extcontrols && usedowntime < 0) {
|
||||
return USETIMER_CONTINUE;
|
||||
}
|
||||
// g_Vars.currentplayer->gunctrl.invertgunfunc = !g_Vars.currentplayer->gunctrl.invertgunfunc;
|
||||
|
||||
// At 25 ticks (or B+Z), start showing the new function
|
||||
g_Vars.currentplayer->gunctrl.invertgunfunc = true;
|
||||
|
||||
// B+Z immediately triggers crouch or stand
|
||||
if (trigpressed) {
|
||||
g_Vars.currentplayer->hands[HAND_RIGHT].activatesecondary = true;
|
||||
if (extcontrols) {
|
||||
g_Vars.currentplayer->hands[HAND_RIGHT].activatesecondary = true;
|
||||
}
|
||||
return USETIMER_STOP;
|
||||
}
|
||||
|
||||
if (fromdedicatedbutton) {
|
||||
g_Vars.currentplayer->hands[HAND_RIGHT].activatesecondary = true;
|
||||
return USETIMER_CONTINUE;
|
||||
}
|
||||
|
||||
if (ABS(usedowntime) < 0) {
|
||||
#ifndef PLATFORM_N64
|
||||
bool docontinue;
|
||||
if (extcontrols) {
|
||||
docontinue = (ABS(usedowntime) < 0);
|
||||
} else {
|
||||
// Don't do anything if B hasn't been held for 50/60ths of a second
|
||||
docontinue = (usedowntime < TICKS(50));
|
||||
}
|
||||
if (docontinue) {
|
||||
#else
|
||||
if (usedowntime < TICKS(50)) {
|
||||
#endif
|
||||
return USETIMER_CONTINUE;
|
||||
}
|
||||
|
||||
@@ -11747,13 +11765,17 @@ s32 bgunConsiderToggleGunFunction(s32 usedowntime, bool trigpressed, bool fromac
|
||||
|
||||
// Do crouch or stand
|
||||
g_Vars.currentplayer->hands[HAND_RIGHT].activatesecondary = true;
|
||||
return USETIMER_STOP;
|
||||
return (extcontrols ? USETIMER_STOP : USETIMER_REPEAT);
|
||||
case WEAPON_RCP120:
|
||||
case WEAPON_LAPTOPGUN:
|
||||
case WEAPON_DRAGON:
|
||||
case WEAPON_REMOTEMINE:
|
||||
// These weapons use temporary alt functions
|
||||
g_Vars.currentplayer->gunctrl.invertgunfunc = !g_Vars.currentplayer->gunctrl.invertgunfunc;
|
||||
if (extcontrols) {
|
||||
g_Vars.currentplayer->gunctrl.invertgunfunc = !g_Vars.currentplayer->gunctrl.invertgunfunc;
|
||||
} else {
|
||||
g_Vars.currentplayer->gunctrl.invertgunfunc = true;
|
||||
}
|
||||
|
||||
if (fromactivemenu && bgunIsUsingSecondaryFunction() == true) {
|
||||
g_Vars.currentplayer->hands[HAND_RIGHT].activatesecondary = true;
|
||||
|
||||
+2
-1
@@ -1806,7 +1806,8 @@ void bmoveProcessInput(bool allowc1x, bool allowc1y, bool allowc1buttons, bool i
|
||||
if (controlmode == CONTROLMODE_PC) {
|
||||
g_Vars.currentplayer->bondactivateorreload = g_Vars.currentplayer->bondactivateorreload | JO_ACTION_ACTIVATE;
|
||||
} else {
|
||||
g_Vars.currentplayer->bondactivateorreload = movedata.btapcount;
|
||||
g_Vars.currentplayer->bondactivateorreload = movedata.btapcount ?
|
||||
(g_Vars.currentplayer->bondactivateorreload | JO_ACTION_ACTIVATE | JO_ACTION_RELOAD) : 0;
|
||||
}
|
||||
|
||||
bmoveHandleActivate();
|
||||
|
||||
+19
-12
@@ -1287,23 +1287,30 @@ Gfx *lvRender(Gfx *gdl)
|
||||
}
|
||||
|
||||
// Handle opening doors and reloading
|
||||
if (g_Vars.currentplayer->bondactivateorreload & JO_ACTION_RELOAD) {
|
||||
if (g_Vars.currentplayer->hands[HAND_RIGHT].state != HANDSTATE_RELOAD) {
|
||||
bgunReloadIfPossible(HAND_RIGHT);
|
||||
}
|
||||
|
||||
if (g_Vars.currentplayer->hands[HAND_LEFT].state != HANDSTATE_RELOAD) {
|
||||
bgunReloadIfPossible(HAND_LEFT);
|
||||
}
|
||||
|
||||
g_Vars.currentplayer->bondactivateorreload = (g_Vars.currentplayer->bondactivateorreload & ~JO_ACTION_RELOAD) | (g_Vars.currentplayer->bondactivateorreload & 0x0);
|
||||
}
|
||||
if (g_Vars.currentplayer->bondactivateorreload & JO_ACTION_ACTIVATE) {
|
||||
currentPlayerInteract(false);
|
||||
if (!currentPlayerInteract(false)) {
|
||||
#ifndef PLATFORM_N64
|
||||
// n64 behavior: interact sucessful, cancel reload
|
||||
if (!PLAYER_EXTCFG().extcontrols) {
|
||||
g_Vars.currentplayer->bondactivateorreload = (g_Vars.currentplayer->bondactivateorreload & ~JO_ACTION_RELOAD);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
} else if (g_Vars.currentplayer->eyespy
|
||||
&& g_Vars.currentplayer->eyespy->active
|
||||
&& g_Vars.currentplayer->eyespy->opendoor) {
|
||||
currentPlayerInteract(true);
|
||||
g_Vars.currentplayer->bondactivateorreload = (g_Vars.currentplayer->bondactivateorreload & ~JO_ACTION_RELOAD);
|
||||
}
|
||||
|
||||
if (g_Vars.currentplayer->bondactivateorreload & JO_ACTION_RELOAD) {
|
||||
if (g_Vars.currentplayer->hands[HAND_RIGHT].state != HANDSTATE_RELOAD) {
|
||||
bgunReloadIfPossible(HAND_RIGHT);
|
||||
}
|
||||
if (g_Vars.currentplayer->hands[HAND_LEFT].state != HANDSTATE_RELOAD) {
|
||||
bgunReloadIfPossible(HAND_LEFT);
|
||||
}
|
||||
g_Vars.currentplayer->bondactivateorreload = (g_Vars.currentplayer->bondactivateorreload & ~JO_ACTION_RELOAD);
|
||||
}
|
||||
|
||||
propsTestForPickup();
|
||||
|
||||
Reference in new issue
Block a user