mirror of
https://github.com/HarbourMasters/Shipwright.git
synced 2024-11-25 10:52:19 -05:00
Added DPad support to shops (#139)
* Added DPad support to shops * Wrap changes in CVar * Remove unnesseccary const_cast * Fixed transparent texture making framebuffers also transparent in D3D11. (#84) This happened with the Mirror Shield in the inventory screen preview. * Add save editor * Added DPad support to shops * Fixing rebase conflict * Remove unnesseccary const_cast * Added DPad support to file selection and pause screens (#124) * Added DPad support to file selection and pause screens * Wrap changes behind CVar * Fix merge conflict for real * Remove unnecessary const_cast * Fixed transparent texture making framebuffers also transparent in D3D11. (#84) This happened with the Mirror Shield in the inventory screen preview. * Add save editor * Added DPad support to file selection and pause screens * Fixing rebase conflict * Remove unnecessary const_cast Co-authored-by: MaikelChan <maikelchan88@gmail.com> Co-authored-by: rozlette <Rozelette@users.noreply.github.com> * Added DPad support to shops * Fixing rebase conflict again * Allocate aligned heaps * Formatting fixes * Added DPad support to ocarina and text prompts (#137) * Added DPad support to ocarina playing and text choice selection. * Wrap changes in CVar * Fix mapping not updating if CVar is changed in-game * Remove unnecessary const_cast * Fixed transparent texture making framebuffers also transparent in D3D11. (#84) This happened with the Mirror Shield in the inventory screen preview. * Add save editor * Added DPad support to ocarina playing and text choice selection. * Fixing rebase conflict * Fix mapping not updating if CVar is changed in-game * Remove unnecessary const_cast * Added DPad support to file selection and pause screens (#124) * Added DPad support to file selection and pause screens * Wrap changes behind CVar * Fix merge conflict for real * Remove unnecessary const_cast * Fixed transparent texture making framebuffers also transparent in D3D11. (#84) This happened with the Mirror Shield in the inventory screen preview. * Add save editor * Added DPad support to file selection and pause screens * Fixing rebase conflict * Remove unnecessary const_cast Co-authored-by: MaikelChan <maikelchan88@gmail.com> Co-authored-by: rozlette <Rozelette@users.noreply.github.com> * Added DPad support to ocarina playing and text choice selection. * Fixing rebase conflict again * Fix mapping not updating if CVar is changed in-game Co-authored-by: MaikelChan <maikelchan88@gmail.com> Co-authored-by: rozlette <Rozelette@users.noreply.github.com> * Added DPad support to shops * Fixing rebase conflict for the last time * Totally Fixing rebase conflict again I promise * This has to be the last time I fix this rebase conflict Co-authored-by: MaikelChan <maikelchan88@gmail.com> Co-authored-by: rozlette <Rozelette@users.noreply.github.com> Co-authored-by: GaryOderNichts <12049776+GaryOderNichts@users.noreply.github.com>
This commit is contained in:
parent
03a5c7ed29
commit
e164819339
@ -96,6 +96,9 @@ namespace Game {
|
||||
Settings.controller.dpad_ocarina_text = stob(Conf[ControllerSection]["dpad_ocarina_text"]);
|
||||
CVar_SetS32("gDpadOcarinaText", Settings.controller.dpad_ocarina_text);
|
||||
|
||||
Settings.controller.dpad_shop = stob(Conf[ControllerSection]["dpad_shop"]);
|
||||
CVar_SetS32("gDpadShop", Settings.controller.dpad_shop);
|
||||
|
||||
// Cheats
|
||||
Settings.cheats.debug_mode = stob(Conf[CheatSection]["debug_mode"]);
|
||||
CVar_SetS32("gDebugEnabled", Settings.cheats.debug_mode);
|
||||
@ -157,6 +160,7 @@ namespace Game {
|
||||
Conf[ControllerSection]["input_enabled"] = std::to_string(Settings.controller.input_enabled);
|
||||
Conf[ControllerSection]["dpad_pause_name"] = std::to_string(Settings.controller.dpad_pause_name);
|
||||
Conf[ControllerSection]["dpad_ocarina_text"] = std::to_string(Settings.controller.dpad_ocarina_text);
|
||||
Conf[ControllerSection]["dpad_shop"] = std::to_string(Settings.controller.dpad_shop);
|
||||
|
||||
// Cheats
|
||||
Conf[CheatSection]["debug_mode"] = std::to_string(Settings.cheats.debug_mode);
|
||||
|
@ -36,6 +36,7 @@ struct SoHConfigType {
|
||||
bool input_enabled = false;
|
||||
bool dpad_pause_name = false;
|
||||
bool dpad_ocarina_text = false;
|
||||
bool dpad_shop = false;
|
||||
} controller;
|
||||
|
||||
// Cheats
|
||||
|
@ -365,6 +365,11 @@ namespace SohImGui {
|
||||
needs_save = true;
|
||||
}
|
||||
|
||||
if (ImGui::Checkbox("DPad Support for Browsing Shop Items", &Game::Settings.controller.dpad_shop)) {
|
||||
CVar_SetS32("gDpadShop", Game::Settings.controller.dpad_shop);
|
||||
needs_save = true;
|
||||
}
|
||||
|
||||
ImGui::EndMenu();
|
||||
}
|
||||
|
||||
|
@ -948,7 +948,9 @@ s32 EnOssan_FacingShopkeeperDialogResult(EnOssan* this, GlobalContext* globalCtx
|
||||
}
|
||||
|
||||
void EnOssan_State_FacingShopkeeper(EnOssan* this, GlobalContext* globalCtx, Player* player) {
|
||||
Input* input = &globalCtx->state.input[0];
|
||||
u8 nextIndex;
|
||||
bool dpad = CVar_GetS32("gDpadShop", 0);
|
||||
|
||||
if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_CHOICE) &&
|
||||
!EnOssan_TestEndInteraction(this, globalCtx, &globalCtx->state.input[0])) {
|
||||
@ -957,7 +959,7 @@ void EnOssan_State_FacingShopkeeper(EnOssan* this, GlobalContext* globalCtx, Pla
|
||||
return;
|
||||
}
|
||||
// Stick Left
|
||||
if (this->stickAccumX < 0) {
|
||||
if ((this->stickAccumX < 0) || (dpad && CHECK_BTN_ALL(input->press.button, BTN_DLEFT))) {
|
||||
nextIndex = EnOssan_SetCursorIndexFromNeutral(this, 4);
|
||||
if (nextIndex != CURSOR_INVALID) {
|
||||
this->cursorIndex = nextIndex;
|
||||
@ -966,7 +968,7 @@ void EnOssan_State_FacingShopkeeper(EnOssan* this, GlobalContext* globalCtx, Pla
|
||||
this->stickLeftPrompt.isEnabled = false;
|
||||
func_80078884(NA_SE_SY_CURSOR);
|
||||
}
|
||||
} else if (this->stickAccumX > 0) {
|
||||
} else if ((this->stickAccumX > 0) || (dpad && CHECK_BTN_ALL(input->press.button, BTN_DRIGHT))) {
|
||||
nextIndex = EnOssan_SetCursorIndexFromNeutral(this, 0);
|
||||
if (nextIndex != CURSOR_INVALID) {
|
||||
this->cursorIndex = nextIndex;
|
||||
@ -1023,11 +1025,13 @@ void EnOssan_State_LookToRightShelf(EnOssan* this, GlobalContext* globalCtx, Pla
|
||||
}
|
||||
}
|
||||
|
||||
void EnOssan_CursorUpDown(EnOssan* this) {
|
||||
void EnOssan_CursorUpDown(EnOssan* this, GlobalContext* globalCtx) {
|
||||
Input* input = &globalCtx->state.input[0];
|
||||
u8 curTemp = this->cursorIndex;
|
||||
u8 curScanTemp;
|
||||
bool dpad = CVar_GetS32("gDpadShop", 0);
|
||||
|
||||
if (this->stickAccumY < 0) {
|
||||
if ((this->stickAccumY < 0) || (dpad && CHECK_BTN_ALL(input->press.button, BTN_DDOWN))) {
|
||||
curTemp &= 0xFE;
|
||||
if (this->shelfSlots[curTemp] != NULL) {
|
||||
this->cursorIndex = curTemp;
|
||||
@ -1066,7 +1070,7 @@ void EnOssan_CursorUpDown(EnOssan* this) {
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (this->stickAccumY > 0) {
|
||||
} else if ((this->stickAccumY > 0) || (dpad && CHECK_BTN_ALL(input->press.button, BTN_DUP))) {
|
||||
curTemp |= 1;
|
||||
if (this->shelfSlots[curTemp] != NULL) {
|
||||
this->cursorIndex = curTemp;
|
||||
@ -1172,11 +1176,13 @@ s32 EnOssan_HasPlayerSelectedItem(GlobalContext* globalCtx, EnOssan* this, Input
|
||||
}
|
||||
|
||||
void EnOssan_State_BrowseLeftShelf(EnOssan* this, GlobalContext* globalCtx, Player* player) {
|
||||
Input* input = &globalCtx->state.input[0];
|
||||
s32 a;
|
||||
s32 b;
|
||||
u8 prevIndex = this->cursorIndex;
|
||||
s32 c;
|
||||
s32 d;
|
||||
bool dpad = CVar_GetS32("gDpadShop", 0);
|
||||
|
||||
if (!EnOssan_ReturnItemToShelf(this)) {
|
||||
osSyncPrintf("%s[%d]:" VT_FGCOL(GREEN) "ズーム中!!" VT_RST "\n", "../z_en_oB1.c", 2152);
|
||||
@ -1193,7 +1199,7 @@ void EnOssan_State_BrowseLeftShelf(EnOssan* this, GlobalContext* globalCtx, Play
|
||||
if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT) &&
|
||||
!EnOssan_HasPlayerSelectedItem(globalCtx, this, &globalCtx->state.input[0])) {
|
||||
if (this->moveHorizontal) {
|
||||
if (this->stickAccumX > 0) {
|
||||
if ((this->stickAccumX > 0) || (dpad && CHECK_BTN_ALL(input->press.button, BTN_DRIGHT))) {
|
||||
a = EnOssan_CursorRight(this, this->cursorIndex, 4);
|
||||
if (a != CURSOR_INVALID) {
|
||||
this->cursorIndex = a;
|
||||
@ -1201,14 +1207,14 @@ void EnOssan_State_BrowseLeftShelf(EnOssan* this, GlobalContext* globalCtx, Play
|
||||
EnOssan_SetLookToShopkeeperFromShelf(globalCtx, this);
|
||||
return;
|
||||
}
|
||||
} else if (this->stickAccumX < 0) {
|
||||
} else if ((this->stickAccumX < 0) || (dpad && CHECK_BTN_ALL(input->press.button, BTN_DLEFT))) {
|
||||
b = EnOssan_CursorLeft(this, this->cursorIndex, 8);
|
||||
if (b != CURSOR_INVALID) {
|
||||
this->cursorIndex = b;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (this->stickAccumX > 0 && this->stickAccumX > 500) {
|
||||
if ((this->stickAccumX > 0 && this->stickAccumX > 500) || (dpad && CHECK_BTN_ALL(input->press.button, BTN_DRIGHT))) {
|
||||
c = EnOssan_CursorRight(this, this->cursorIndex, 4);
|
||||
if (c != CURSOR_INVALID) {
|
||||
this->cursorIndex = c;
|
||||
@ -1216,14 +1222,14 @@ void EnOssan_State_BrowseLeftShelf(EnOssan* this, GlobalContext* globalCtx, Play
|
||||
EnOssan_SetLookToShopkeeperFromShelf(globalCtx, this);
|
||||
return;
|
||||
}
|
||||
} else if (this->stickAccumX < 0 && this->stickAccumX < -500) {
|
||||
} else if ((this->stickAccumX < 0 && this->stickAccumX < -500) || (dpad && CHECK_BTN_ALL(input->press.button, BTN_DLEFT))) {
|
||||
d = EnOssan_CursorLeft(this, this->cursorIndex, 8);
|
||||
if (d != CURSOR_INVALID) {
|
||||
this->cursorIndex = d;
|
||||
}
|
||||
}
|
||||
}
|
||||
EnOssan_CursorUpDown(this);
|
||||
EnOssan_CursorUpDown(this, globalCtx);
|
||||
if (this->cursorIndex != prevIndex) {
|
||||
Message_ContinueTextbox(globalCtx, this->shelfSlots[this->cursorIndex]->actor.textId);
|
||||
func_80078884(NA_SE_SY_CURSOR);
|
||||
@ -1232,9 +1238,11 @@ void EnOssan_State_BrowseLeftShelf(EnOssan* this, GlobalContext* globalCtx, Play
|
||||
}
|
||||
|
||||
void EnOssan_State_BrowseRightShelf(EnOssan* this, GlobalContext* globalCtx, Player* player) {
|
||||
Input* input = &globalCtx->state.input[0];
|
||||
s32 pad[2];
|
||||
u8 prevIndex;
|
||||
u8 nextIndex;
|
||||
bool dpad = CVar_GetS32("gDpadShop", 0);
|
||||
|
||||
prevIndex = this->cursorIndex;
|
||||
if (!EnOssan_ReturnItemToShelf(this)) {
|
||||
@ -1252,7 +1260,7 @@ void EnOssan_State_BrowseRightShelf(EnOssan* this, GlobalContext* globalCtx, Pla
|
||||
if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT) &&
|
||||
!EnOssan_HasPlayerSelectedItem(globalCtx, this, &globalCtx->state.input[0])) {
|
||||
if (this->moveHorizontal) {
|
||||
if (this->stickAccumX < 0) {
|
||||
if ((this->stickAccumX < 0) || (dpad && CHECK_BTN_ALL(input->press.button, BTN_DLEFT))) {
|
||||
nextIndex = EnOssan_CursorRight(this, this->cursorIndex, 0);
|
||||
if (nextIndex != CURSOR_INVALID) {
|
||||
this->cursorIndex = nextIndex;
|
||||
@ -1260,14 +1268,14 @@ void EnOssan_State_BrowseRightShelf(EnOssan* this, GlobalContext* globalCtx, Pla
|
||||
EnOssan_SetLookToShopkeeperFromShelf(globalCtx, this);
|
||||
return;
|
||||
}
|
||||
} else if (this->stickAccumX > 0) {
|
||||
} else if ((this->stickAccumX > 0) || (dpad && CHECK_BTN_ALL(input->press.button, BTN_DRIGHT))) {
|
||||
nextIndex = EnOssan_CursorLeft(this, this->cursorIndex, 4);
|
||||
if (nextIndex != CURSOR_INVALID) {
|
||||
this->cursorIndex = nextIndex;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (this->stickAccumX < 0 && this->stickAccumX < -500) {
|
||||
if ((this->stickAccumX < 0 && this->stickAccumX < -500) || (dpad && CHECK_BTN_ALL(input->press.button, BTN_DLEFT))) {
|
||||
nextIndex = EnOssan_CursorRight(this, this->cursorIndex, 0);
|
||||
if (nextIndex != CURSOR_INVALID) {
|
||||
this->cursorIndex = nextIndex;
|
||||
@ -1275,14 +1283,14 @@ void EnOssan_State_BrowseRightShelf(EnOssan* this, GlobalContext* globalCtx, Pla
|
||||
EnOssan_SetLookToShopkeeperFromShelf(globalCtx, this);
|
||||
return;
|
||||
}
|
||||
} else if (this->stickAccumX > 0 && this->stickAccumX > 500) {
|
||||
} else if ((this->stickAccumX > 0 && this->stickAccumX > 500) || (dpad && CHECK_BTN_ALL(input->press.button, BTN_DRIGHT))) {
|
||||
nextIndex = EnOssan_CursorLeft(this, this->cursorIndex, 4);
|
||||
if (nextIndex != CURSOR_INVALID) {
|
||||
this->cursorIndex = nextIndex;
|
||||
}
|
||||
}
|
||||
}
|
||||
EnOssan_CursorUpDown(this);
|
||||
EnOssan_CursorUpDown(this, globalCtx);
|
||||
if (this->cursorIndex != prevIndex) {
|
||||
Message_ContinueTextbox(globalCtx, this->shelfSlots[this->cursorIndex]->actor.textId);
|
||||
func_80078884(NA_SE_SY_CURSOR);
|
||||
|
Loading…
Reference in New Issue
Block a user