Added DPad support to shops
parent
3e8c48c116
commit
6d9b09e720
soh/src/overlays/actors/ovl_En_Ossan
|
@ -948,6 +948,7 @@ 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;
|
||||
|
||||
if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_CHOICE) &&
|
||||
|
@ -957,7 +958,7 @@ void EnOssan_State_FacingShopkeeper(EnOssan* this, GlobalContext* globalCtx, Pla
|
|||
return;
|
||||
}
|
||||
// Stick Left
|
||||
if (this->stickAccumX < 0) {
|
||||
if ((this->stickAccumX < 0) || CHECK_BTN_ALL(input->press.button, BTN_DLEFT)) {
|
||||
nextIndex = EnOssan_SetCursorIndexFromNeutral(this, 4);
|
||||
if (nextIndex != CURSOR_INVALID) {
|
||||
this->cursorIndex = nextIndex;
|
||||
|
@ -966,7 +967,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) || CHECK_BTN_ALL(input->press.button, BTN_DRIGHT)) {
|
||||
nextIndex = EnOssan_SetCursorIndexFromNeutral(this, 0);
|
||||
if (nextIndex != CURSOR_INVALID) {
|
||||
this->cursorIndex = nextIndex;
|
||||
|
@ -1023,11 +1024,12 @@ 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;
|
||||
|
||||
if (this->stickAccumY < 0) {
|
||||
if ((this->stickAccumY < 0) || CHECK_BTN_ALL(input->press.button, BTN_DDOWN)) {
|
||||
curTemp &= 0xFE;
|
||||
if (this->shelfSlots[curTemp] != NULL) {
|
||||
this->cursorIndex = curTemp;
|
||||
|
@ -1066,7 +1068,7 @@ void EnOssan_CursorUpDown(EnOssan* this) {
|
|||
}
|
||||
}
|
||||
}
|
||||
} else if (this->stickAccumY > 0) {
|
||||
} else if ((this->stickAccumY > 0) || CHECK_BTN_ALL(input->press.button, BTN_DUP)) {
|
||||
curTemp |= 1;
|
||||
if (this->shelfSlots[curTemp] != NULL) {
|
||||
this->cursorIndex = curTemp;
|
||||
|
@ -1172,6 +1174,7 @@ 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;
|
||||
|
@ -1193,7 +1196,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) || CHECK_BTN_ALL(input->press.button, BTN_DRIGHT)) {
|
||||
a = EnOssan_CursorRight(this, this->cursorIndex, 4);
|
||||
if (a != CURSOR_INVALID) {
|
||||
this->cursorIndex = a;
|
||||
|
@ -1201,14 +1204,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) || 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) || CHECK_BTN_ALL(input->press.button, BTN_DRIGHT)) {
|
||||
c = EnOssan_CursorRight(this, this->cursorIndex, 4);
|
||||
if (c != CURSOR_INVALID) {
|
||||
this->cursorIndex = c;
|
||||
|
@ -1216,14 +1219,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) || 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,6 +1235,7 @@ 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;
|
||||
|
@ -1252,7 +1256,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) || CHECK_BTN_ALL(input->press.button, BTN_DLEFT)) {
|
||||
nextIndex = EnOssan_CursorRight(this, this->cursorIndex, 0);
|
||||
if (nextIndex != CURSOR_INVALID) {
|
||||
this->cursorIndex = nextIndex;
|
||||
|
@ -1260,14 +1264,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) || 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) || CHECK_BTN_ALL(input->press.button, BTN_DLEFT)) {
|
||||
nextIndex = EnOssan_CursorRight(this, this->cursorIndex, 0);
|
||||
if (nextIndex != CURSOR_INVALID) {
|
||||
this->cursorIndex = nextIndex;
|
||||
|
@ -1275,14 +1279,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) || 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