mirror of
https://github.com/HarbourMasters/Shipwright.git
synced 2025-08-20 21:33:40 -07:00
Frame Advance Alternative Control Scheme
* Remaps Frame Advance controls. Uses Controller Port 4. * Push START button to toggle Frame Advance. * Push A button to advance a frame. * Hold L button to run the game normally until L button is released. * Hold R button to advance a frame every half second.
This commit is contained in:
parent
7b4df9bdb2
commit
a78a943312
3 changed files with 52 additions and 13 deletions
|
@ -105,6 +105,13 @@ void SohMenu::AddMenuDevTools() {
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.SameLine(true);
|
.SameLine(true);
|
||||||
|
AddWidget(path, "Frame Advance Alternative Control Scheme", WIDGET_CVAR_CHECKBOX)
|
||||||
|
.CVar(CVAR_DEVELOPER_TOOLS("FrameAdvanceAltScheme"))
|
||||||
|
.Options(CheckboxOptions().Tooltip("Remaps Frame Advance controls. Uses Controller Port 4.\n"
|
||||||
|
"Push START button to toggle Frame Advance.\n"
|
||||||
|
"Push A button to advance a frame.\n"
|
||||||
|
"Hold L button to run the game normally until L button is released.\n"
|
||||||
|
"Hold R button to advance a frame every half second."));
|
||||||
AddWidget(path, "Log Level", WIDGET_CVAR_COMBOBOX)
|
AddWidget(path, "Log Level", WIDGET_CVAR_COMBOBOX)
|
||||||
.CVar(CVAR_DEVELOPER_TOOLS("LogLevel"))
|
.CVar(CVAR_DEVELOPER_TOOLS("LogLevel"))
|
||||||
.Options(ComboboxOptions()
|
.Options(ComboboxOptions()
|
||||||
|
|
|
@ -14,6 +14,30 @@ void FrameAdvance_Init(FrameAdvanceContext* frameAdvCtx) {
|
||||||
* This function returns true when frame advance is not active (game will run normally)
|
* This function returns true when frame advance is not active (game will run normally)
|
||||||
*/
|
*/
|
||||||
s32 FrameAdvance_Update(FrameAdvanceContext* frameAdvCtx, Input* input) {
|
s32 FrameAdvance_Update(FrameAdvanceContext* frameAdvCtx, Input* input) {
|
||||||
|
if (CVarGetInteger(CVAR_DEVELOPER_TOOLS("FrameAdvanceAltScheme"), 0) != 0) {
|
||||||
|
// Frame Advance Alternative Control Scheme
|
||||||
|
|
||||||
|
// Push START to toggle the frame advance mode.
|
||||||
|
if (CHECK_BTN_ALL(input->press.button, BTN_START)) {
|
||||||
|
frameAdvCtx->enabled = !frameAdvCtx->enabled;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Push A to advance one frame.
|
||||||
|
// Hold L to run normally until L is released.
|
||||||
|
// Hold R to advance a frame every half second.
|
||||||
|
if (!frameAdvCtx->enabled || CVarGetInteger(CVAR_DEVELOPER_TOOLS("FrameAdvanceTick"), 0) ||
|
||||||
|
CHECK_BTN_ALL(input->press.button, BTN_A) || CHECK_BTN_ALL(input->cur.button, BTN_L) ||
|
||||||
|
CHECK_BTN_ALL(input->press.button, BTN_R) ||
|
||||||
|
(CHECK_BTN_ALL(input->cur.button, BTN_R) && (++frameAdvCtx->timer >= 9))) {
|
||||||
|
CVarClear(CVAR_DEVELOPER_TOOLS("FrameAdvanceTick"));
|
||||||
|
frameAdvCtx->timer = 0;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
// Frame Advance Original Control Scheme
|
||||||
|
|
||||||
if (CHECK_BTN_ALL(input->cur.button, BTN_R) && CHECK_BTN_ALL(input->press.button, BTN_DDOWN)) {
|
if (CHECK_BTN_ALL(input->cur.button, BTN_R) && CHECK_BTN_ALL(input->press.button, BTN_DDOWN)) {
|
||||||
frameAdvCtx->enabled = !frameAdvCtx->enabled;
|
frameAdvCtx->enabled = !frameAdvCtx->enabled;
|
||||||
}
|
}
|
||||||
|
@ -29,3 +53,4 @@ s32 FrameAdvance_Update(FrameAdvanceContext* frameAdvCtx, Input* input) {
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -693,6 +693,7 @@ void Play_Update(PlayState* play) {
|
||||||
Input* input = play->state.input;
|
Input* input = play->state.input;
|
||||||
s32 isPaused;
|
s32 isPaused;
|
||||||
s32 pad1;
|
s32 pad1;
|
||||||
|
s32 frameAdvanceInputPort;
|
||||||
|
|
||||||
if ((SREG(1) < 0) || (DREG(0) != 0)) {
|
if ((SREG(1) < 0) || (DREG(0) != 0)) {
|
||||||
SREG(1) = 0;
|
SREG(1) = 0;
|
||||||
|
@ -730,7 +731,13 @@ void Play_Update(PlayState* play) {
|
||||||
gSegments[5] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[play->objectCtx.subKeepIndex].segment);
|
gSegments[5] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[play->objectCtx.subKeepIndex].segment);
|
||||||
gSegments[2] = VIRTUAL_TO_PHYSICAL(play->sceneSegment);
|
gSegments[2] = VIRTUAL_TO_PHYSICAL(play->sceneSegment);
|
||||||
|
|
||||||
if (FrameAdvance_Update(&play->frameAdvCtx, &input[1])) {
|
if (CVarGetInteger(CVAR_DEVELOPER_TOOLS("FrameAdvanceAltScheme"), 0) != 0) {
|
||||||
|
frameAdvanceInputPort = 3; // Frame Advance Alternative Control Scheme. Uses P4 port.
|
||||||
|
} else {
|
||||||
|
frameAdvanceInputPort = 1; // Frame Advance Original Control Scheme. Uses P2 port.
|
||||||
|
}
|
||||||
|
|
||||||
|
if (FrameAdvance_Update(&play->frameAdvCtx, &input[frameAdvanceInputPort])) {
|
||||||
if ((play->transitionMode == TRANS_MODE_OFF) && (play->transitionTrigger != TRANS_TRIGGER_OFF)) {
|
if ((play->transitionMode == TRANS_MODE_OFF) && (play->transitionTrigger != TRANS_TRIGGER_OFF)) {
|
||||||
play->transitionMode = TRANS_MODE_SETUP;
|
play->transitionMode = TRANS_MODE_SETUP;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue