mirror of
https://github.com/HarbourMasters/Shipwright.git
synced 2025-08-22 22:33:43 -07:00
more touch work
This commit is contained in:
parent
12a70386cc
commit
381fd652fd
10 changed files with 143 additions and 48 deletions
|
@ -2,6 +2,7 @@
|
||||||
#include "GlobalCtx2.h"
|
#include "GlobalCtx2.h"
|
||||||
#include "stox.h"
|
#include "stox.h"
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
#include <SDL2/SDL_events.h>
|
||||||
|
|
||||||
namespace Ship {
|
namespace Ship {
|
||||||
Controller::Controller(int32_t dwControllerNumber) : dwControllerNumber(dwControllerNumber) {
|
Controller::Controller(int32_t dwControllerNumber) : dwControllerNumber(dwControllerNumber) {
|
||||||
|
@ -16,6 +17,29 @@ namespace Ship {
|
||||||
void Controller::Read(OSContPad* pad) {
|
void Controller::Read(OSContPad* pad) {
|
||||||
ReadFromSource();
|
ReadFromSource();
|
||||||
|
|
||||||
|
// Mouse Inputs
|
||||||
|
int x, y;
|
||||||
|
Uint32 buttons;
|
||||||
|
SDL_PumpEvents();
|
||||||
|
buttons = SDL_GetMouseState(&x, &y);
|
||||||
|
|
||||||
|
wTouchX = x;
|
||||||
|
wTouchY = y;
|
||||||
|
|
||||||
|
if ((buttons & SDL_BUTTON_LMASK) != 0) {
|
||||||
|
wLeftClick = 1;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
wLeftClick = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((buttons & SDL_BUTTON_RMASK) != 0) {
|
||||||
|
wRightClick = 1;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
wRightClick = 0;
|
||||||
|
}
|
||||||
|
|
||||||
pad->button |= dwPressedButtons & 0xFFFF;
|
pad->button |= dwPressedButtons & 0xFFFF;
|
||||||
|
|
||||||
if (pad->stick_x == 0) {
|
if (pad->stick_x == 0) {
|
||||||
|
@ -47,8 +71,8 @@ namespace Ship {
|
||||||
|
|
||||||
pad->touch_x = wTouchX;
|
pad->touch_x = wTouchX;
|
||||||
pad->touch_y = wTouchY;
|
pad->touch_y = wTouchY;
|
||||||
|
pad->left_click = wLeftClick;
|
||||||
pad->touch = wTouching;
|
pad->right_click = wRightClick;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Controller::SetButtonMapping(const std::string& szButtonName, int32_t dwScancode) {
|
void Controller::SetButtonMapping(const std::string& szButtonName, int32_t dwScancode) {
|
||||||
|
|
|
@ -38,7 +38,9 @@ namespace Ship {
|
||||||
int8_t wStickY;
|
int8_t wStickY;
|
||||||
float wGyroX;
|
float wGyroX;
|
||||||
float wGyroY;
|
float wGyroY;
|
||||||
bool wTouching;
|
|
||||||
|
bool wLeftClick;
|
||||||
|
bool wRightClick;
|
||||||
float wTouchX;
|
float wTouchX;
|
||||||
float wTouchY;
|
float wTouchY;
|
||||||
|
|
||||||
|
|
|
@ -114,10 +114,11 @@ typedef struct {
|
||||||
/* 0x04 */ u8 err_no;
|
/* 0x04 */ u8 err_no;
|
||||||
/* 0x05 */ f32 gyro_x;
|
/* 0x05 */ f32 gyro_x;
|
||||||
/* 0x09 */ f32 gyro_y;
|
/* 0x09 */ f32 gyro_y;
|
||||||
/* 0x0A */ u8 touch;
|
/* 0x0A */ u8 left_click;
|
||||||
/* 0x0B */ f32 touch_x;
|
/* 0x0B */ u8 right_click;
|
||||||
/* 0x0F */ f32 touch_y;
|
/* 0x0C */ f32 touch_x;
|
||||||
} OSContPad; // size = 0x13
|
/* 0x10 */ f32 touch_y;
|
||||||
|
} OSContPad; // size = 0x14
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
/* 0x00 */ u8 rumble;
|
/* 0x00 */ u8 rumble;
|
||||||
|
|
|
@ -227,21 +227,6 @@ namespace Ship {
|
||||||
|
|
||||||
wGyroX *= gyro_sensitivity;
|
wGyroX *= gyro_sensitivity;
|
||||||
wGyroY *= gyro_sensitivity;
|
wGyroY *= gyro_sensitivity;
|
||||||
|
|
||||||
int x, y;
|
|
||||||
Uint32 buttons;
|
|
||||||
SDL_PumpEvents();
|
|
||||||
buttons = SDL_GetMouseState(&x, &y);
|
|
||||||
|
|
||||||
wTouchX = x;
|
|
||||||
wTouchY = y;
|
|
||||||
|
|
||||||
if ((buttons & SDL_BUTTON_LMASK) != 0) {
|
|
||||||
wTouching = 1;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
wTouching = 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int32_t i = SDL_CONTROLLER_BUTTON_A; i < SDL_CONTROLLER_BUTTON_MAX; i++) {
|
for (int32_t i = SDL_CONTROLLER_BUTTON_A; i < SDL_CONTROLLER_BUTTON_MAX; i++) {
|
||||||
|
|
|
@ -120,10 +120,11 @@ typedef struct {
|
||||||
/* 0x04 */ uint8_t err_no;
|
/* 0x04 */ uint8_t err_no;
|
||||||
/* 0x05 */ float gyro_x;
|
/* 0x05 */ float gyro_x;
|
||||||
/* 0x09 */ float gyro_y;
|
/* 0x09 */ float gyro_y;
|
||||||
/* 0x0A */ uint8_t touch;
|
/* 0x0A */ uint8_t left_click;
|
||||||
/* 0x0B */ float touch_x;
|
/* 0x0B */ uint8_t right_click;
|
||||||
/* 0x0F */ float touch_y;
|
/* 0x0C */ float touch_x;
|
||||||
} OSContPad; // size = 0x13
|
/* 0x10 */ float touch_y;
|
||||||
|
} OSContPad; // size = 0x14
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
/* 0x00 */ uint8_t rumble;
|
/* 0x00 */ uint8_t rumble;
|
||||||
|
|
|
@ -247,7 +247,8 @@ void PadMgr_ProcessInputs(PadMgr* padMgr) {
|
||||||
input->cur.button = 0;
|
input->cur.button = 0;
|
||||||
input->cur.stick_x = 0;
|
input->cur.stick_x = 0;
|
||||||
input->cur.stick_y = 0;
|
input->cur.stick_y = 0;
|
||||||
input->cur.touch = 0;
|
input->cur.left_click = 0;
|
||||||
|
input->cur.right_click = 0;
|
||||||
input->cur.err_no = padnow1->err_no;
|
input->cur.err_no = padnow1->err_no;
|
||||||
if (padMgr->ctrlrIsConnected[i]) {
|
if (padMgr->ctrlrIsConnected[i]) {
|
||||||
padMgr->ctrlrIsConnected[i] = false;
|
padMgr->ctrlrIsConnected[i] = false;
|
||||||
|
@ -272,9 +273,13 @@ void PadMgr_ProcessInputs(PadMgr* padMgr) {
|
||||||
input->press.stick_y += (s8)(input->cur.stick_y - input->prev.stick_y);
|
input->press.stick_y += (s8)(input->cur.stick_y - input->prev.stick_y);
|
||||||
|
|
||||||
u8 buttonDiff2;
|
u8 buttonDiff2;
|
||||||
buttonDiff2 = input->prev.touch != input->cur.touch;
|
buttonDiff2 = input->prev.left_click != input->cur.left_click;
|
||||||
input->press.touch = (u8)(input->cur.touch && buttonDiff2);
|
input->press.left_click = (u8)(input->cur.left_click && buttonDiff2);
|
||||||
input->rel.touch = (u8)(!input->cur.touch && buttonDiff2);
|
input->rel.left_click = (u8)(!input->cur.left_click && buttonDiff2);
|
||||||
|
|
||||||
|
buttonDiff2 = input->prev.right_click != input->cur.right_click;
|
||||||
|
input->press.right_click = (u8)(input->cur.right_click && buttonDiff2);
|
||||||
|
input->rel.right_click = (u8)(!input->cur.right_click && buttonDiff2);
|
||||||
}
|
}
|
||||||
|
|
||||||
controllerCallback.rumble = CVar_GetS32("gRumbleEnabled", 0) && (padMgr->rumbleEnable[0] > 0);
|
controllerCallback.rumble = CVar_GetS32("gRumbleEnabled", 0) && (padMgr->rumbleEnable[0] > 0);
|
||||||
|
|
|
@ -341,7 +341,7 @@ void EnMag_Update(Actor* thisx, GlobalContext* globalCtx) {
|
||||||
if (this->globalState < MAG_STATE_DISPLAY) {
|
if (this->globalState < MAG_STATE_DISPLAY) {
|
||||||
if (CHECK_BTN_ALL(globalCtx->state.input[0].press.button, BTN_START) ||
|
if (CHECK_BTN_ALL(globalCtx->state.input[0].press.button, BTN_START) ||
|
||||||
CHECK_BTN_ALL(globalCtx->state.input[0].press.button, BTN_A) ||
|
CHECK_BTN_ALL(globalCtx->state.input[0].press.button, BTN_A) ||
|
||||||
CHECK_BTN_ALL(globalCtx->state.input[0].press.button, BTN_B) || globalCtx->state.input[0].press.touch) {
|
CHECK_BTN_ALL(globalCtx->state.input[0].press.button, BTN_B) || globalCtx->state.input[0].press.left_click) {
|
||||||
|
|
||||||
Audio_PlaySoundGeneral(NA_SE_SY_PIECE_OF_HEART, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8);
|
Audio_PlaySoundGeneral(NA_SE_SY_PIECE_OF_HEART, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8);
|
||||||
|
|
||||||
|
@ -368,7 +368,7 @@ void EnMag_Update(Actor* thisx, GlobalContext* globalCtx) {
|
||||||
if (CHECK_BTN_ALL(globalCtx->state.input[0].press.button, BTN_START) ||
|
if (CHECK_BTN_ALL(globalCtx->state.input[0].press.button, BTN_START) ||
|
||||||
CHECK_BTN_ALL(globalCtx->state.input[0].press.button, BTN_A) ||
|
CHECK_BTN_ALL(globalCtx->state.input[0].press.button, BTN_A) ||
|
||||||
CHECK_BTN_ALL(globalCtx->state.input[0].press.button, BTN_B) ||
|
CHECK_BTN_ALL(globalCtx->state.input[0].press.button, BTN_B) ||
|
||||||
globalCtx->state.input[0].press.touch) {
|
globalCtx->state.input[0].press.left_click) {
|
||||||
|
|
||||||
if (globalCtx->sceneLoadFlag != 20) {
|
if (globalCtx->sceneLoadFlag != 20) {
|
||||||
Audio_SetCutsceneFlag(0);
|
Audio_SetCutsceneFlag(0);
|
||||||
|
|
|
@ -214,6 +214,11 @@ void FileChoose_DrawOptions(GameState* thisx);
|
||||||
void FileChoose_DrawNameEntry(GameState* thisx);
|
void FileChoose_DrawNameEntry(GameState* thisx);
|
||||||
void FileChoose_DrawCharacter(GraphicsContext* gfxCtx, void* texture, s16 vtx);
|
void FileChoose_DrawCharacter(GraphicsContext* gfxCtx, void* texture, s16 vtx);
|
||||||
|
|
||||||
|
void HandleMouseInput(Input* input);
|
||||||
|
u8 HandleMouseCursor(FileChooseContext* this, Input* input, int minx, int miny, int maxx, int maxy);
|
||||||
|
Vec2f HandleMouseCursorSplit(FileChooseContext* this, Input* input, int minx, int miny, int maxx, int maxy, int countx,
|
||||||
|
int county);
|
||||||
|
|
||||||
extern s16 D_808123F0[];
|
extern s16 D_808123F0[];
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -164,7 +164,7 @@ void FileChoose_FinishFadeIn(GameState* thisx) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void HandleMouseInput(Input* input) {
|
void HandleMouseInput(Input* input) {
|
||||||
if (input->press.touch) {
|
if (input->press.left_click) {
|
||||||
input->press.button = BTN_A;
|
input->press.button = BTN_A;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -175,8 +175,8 @@ u8 HandleMouseCursor(FileChooseContext* this, Input* input, int minx, int miny,
|
||||||
|
|
||||||
float newX = ((240.0f * ratio) - (240.0f * ogratio)) / 2.0f;
|
float newX = ((240.0f * ratio) - (240.0f * ogratio)) / 2.0f;
|
||||||
|
|
||||||
float pos_x = ((input->cur.touch_x / OTRGetCurrentWidth()) * (240.0f * ratio) - newX);
|
uint32_t pos_x = ((input->cur.touch_x / OTRGetCurrentWidth()) * (240.0f * ratio) - newX);
|
||||||
float pos_y = (input->cur.touch_y / OTRGetCurrentHeight()) * 240.0f;
|
uint32_t pos_y = (input->cur.touch_y / OTRGetCurrentHeight()) * 240.0f;
|
||||||
|
|
||||||
if (pos_x >= minx && pos_x <= minx + maxx) {
|
if (pos_x >= minx && pos_x <= minx + maxx) {
|
||||||
if (pos_y >= miny && pos_y <= miny + maxy) {
|
if (pos_y >= miny && pos_y <= miny + maxy) {
|
||||||
|
@ -187,6 +187,46 @@ u8 HandleMouseCursor(FileChooseContext* this, Input* input, int minx, int miny,
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Vec2f HandleMouseCursorSplit(FileChooseContext* this, Input* input, int minx, int miny, int maxx, int maxy, int countx, int county) {
|
||||||
|
float ogratio = 320.0f / 240.0f;
|
||||||
|
float ratio = (float)OTRGetCurrentWidth() / (float)OTRGetCurrentHeight();
|
||||||
|
|
||||||
|
float newX = ((240.0f * ratio) - (240.0f * ogratio)) / 2.0f;
|
||||||
|
|
||||||
|
uint32_t pos_x = ((input->cur.touch_x / OTRGetCurrentWidth()) * (240.0f * ratio) - newX);
|
||||||
|
uint32_t pos_y = (input->cur.touch_y / OTRGetCurrentHeight()) * 240.0f;
|
||||||
|
|
||||||
|
Vec2f pos;
|
||||||
|
|
||||||
|
if (pos_x < minx || pos_x > minx + maxx || pos_y < miny || pos_y > miny + maxy) {
|
||||||
|
pos.x = -1;
|
||||||
|
pos.y = -1;
|
||||||
|
return pos;
|
||||||
|
}
|
||||||
|
|
||||||
|
int pointerx = (pos_x - minx) / 16.3f;
|
||||||
|
int pointery = (pos_y - miny) / 16.0f;
|
||||||
|
|
||||||
|
if (pointerx <= 0) {
|
||||||
|
pointerx = 0;
|
||||||
|
}
|
||||||
|
if (pointery <= 0) {
|
||||||
|
pointery = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (pointerx >= countx - 1) {
|
||||||
|
pointerx = countx - 1;
|
||||||
|
}
|
||||||
|
if (pointery >= county - 1) {
|
||||||
|
pointery = county - 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
pos.x = pointerx;
|
||||||
|
pos.y = pointery;
|
||||||
|
|
||||||
|
return pos;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update the cursor and wait for the player to select a button to change menus accordingly.
|
* Update the cursor and wait for the player to select a button to change menus accordingly.
|
||||||
* If an empty file is selected, enter the name entry config mode.
|
* If an empty file is selected, enter the name entry config mode.
|
||||||
|
@ -202,23 +242,21 @@ void FileChoose_UpdateMainMenu(GameState* thisx) {
|
||||||
Input* input = &this->state.input[0];
|
Input* input = &this->state.input[0];
|
||||||
bool dpad = CVar_GetS32("gDpadPauseName", 0);
|
bool dpad = CVar_GetS32("gDpadPauseName", 0);
|
||||||
|
|
||||||
if (HandleMouseCursor(this, input, 57, 74, 66, 17)) {
|
if (HandleMouseCursor(this, input, 57, 74, 66, 17) == 1) {
|
||||||
if (this->buttonIndex != FS_BTN_MAIN_FILE_1) {
|
if (this->buttonIndex != FS_BTN_MAIN_FILE_1) {
|
||||||
this->buttonIndex = FS_BTN_MAIN_FILE_1;
|
this->buttonIndex = FS_BTN_MAIN_FILE_1;
|
||||||
Audio_PlaySoundGeneral(NA_SE_SY_FSEL_CURSOR, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8);
|
Audio_PlaySoundGeneral(NA_SE_SY_FSEL_CURSOR, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8);
|
||||||
}
|
}
|
||||||
|
|
||||||
HandleMouseInput(input);
|
HandleMouseInput(input);
|
||||||
}
|
} else if (HandleMouseCursor(this, input, 57, 91, 66, 17) == 1) {
|
||||||
else if (HandleMouseCursor(this, input, 57, 91, 66, 17)) {
|
|
||||||
if (this->buttonIndex != FS_BTN_MAIN_FILE_2) {
|
if (this->buttonIndex != FS_BTN_MAIN_FILE_2) {
|
||||||
this->buttonIndex = FS_BTN_MAIN_FILE_2;
|
this->buttonIndex = FS_BTN_MAIN_FILE_2;
|
||||||
Audio_PlaySoundGeneral(NA_SE_SY_FSEL_CURSOR, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8);
|
Audio_PlaySoundGeneral(NA_SE_SY_FSEL_CURSOR, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8);
|
||||||
}
|
}
|
||||||
|
|
||||||
HandleMouseInput(input);
|
HandleMouseInput(input);
|
||||||
}
|
} else if (HandleMouseCursor(this, input, 57, 107, 66, 17) == 1) {
|
||||||
else if (HandleMouseCursor(this, input, 57, 107, 66, 17)) {
|
|
||||||
if (this->buttonIndex != FS_BTN_MAIN_FILE_3) {
|
if (this->buttonIndex != FS_BTN_MAIN_FILE_3) {
|
||||||
this->buttonIndex = FS_BTN_MAIN_FILE_3;
|
this->buttonIndex = FS_BTN_MAIN_FILE_3;
|
||||||
Audio_PlaySoundGeneral(NA_SE_SY_FSEL_CURSOR, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8);
|
Audio_PlaySoundGeneral(NA_SE_SY_FSEL_CURSOR, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8);
|
||||||
|
@ -1367,6 +1405,22 @@ void FileChoose_ConfirmFile(GameState* thisx) {
|
||||||
Input* input = &this->state.input[0];
|
Input* input = &this->state.input[0];
|
||||||
bool dpad = CVar_GetS32("gDpadPauseName", 0);
|
bool dpad = CVar_GetS32("gDpadPauseName", 0);
|
||||||
|
|
||||||
|
if (HandleMouseCursor(this, input, 57, 156, 66, 17) == 1) {
|
||||||
|
if (this->confirmButtonIndex != FS_BTN_CONFIRM_YES) {
|
||||||
|
this->confirmButtonIndex = FS_BTN_CONFIRM_YES;
|
||||||
|
Audio_PlaySoundGeneral(NA_SE_SY_FSEL_CURSOR, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8);
|
||||||
|
}
|
||||||
|
|
||||||
|
HandleMouseInput(input);
|
||||||
|
} else if (HandleMouseCursor(this, input, 57, 173, 66, 17) == 1) {
|
||||||
|
if (this->confirmButtonIndex != FS_BTN_CONFIRM_QUIT) {
|
||||||
|
this->confirmButtonIndex = FS_BTN_CONFIRM_QUIT;
|
||||||
|
Audio_PlaySoundGeneral(NA_SE_SY_FSEL_CURSOR, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8);
|
||||||
|
}
|
||||||
|
|
||||||
|
HandleMouseInput(input);
|
||||||
|
}
|
||||||
|
|
||||||
if (CHECK_BTN_ALL(input->press.button, BTN_START) || (CHECK_BTN_ALL(input->press.button, BTN_A))) {
|
if (CHECK_BTN_ALL(input->press.button, BTN_START) || (CHECK_BTN_ALL(input->press.button, BTN_A))) {
|
||||||
if (this->confirmButtonIndex == FS_BTN_CONFIRM_YES) {
|
if (this->confirmButtonIndex == FS_BTN_CONFIRM_YES) {
|
||||||
func_800AA000(300.0f, 180, 20, 100);
|
func_800AA000(300.0f, 180, 20, 100);
|
||||||
|
@ -1377,7 +1431,7 @@ void FileChoose_ConfirmFile(GameState* thisx) {
|
||||||
Audio_PlaySoundGeneral(NA_SE_SY_FSEL_CLOSE, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8);
|
Audio_PlaySoundGeneral(NA_SE_SY_FSEL_CLOSE, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8);
|
||||||
this->selectMode++;
|
this->selectMode++;
|
||||||
}
|
}
|
||||||
} else if (CHECK_BTN_ALL(input->press.button, BTN_B)) {
|
} else if (CHECK_BTN_ALL(input->press.button, BTN_B) || input->press.right_click) {
|
||||||
Audio_PlaySoundGeneral(NA_SE_SY_FSEL_CLOSE, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8);
|
Audio_PlaySoundGeneral(NA_SE_SY_FSEL_CLOSE, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8);
|
||||||
this->selectMode++;
|
this->selectMode++;
|
||||||
} else if ((ABS(this->stickRelY) >= 30) || (dpad && CHECK_BTN_ANY(input->press.button, BTN_DDOWN | BTN_DUP))) {
|
} else if ((ABS(this->stickRelY) >= 30) || (dpad && CHECK_BTN_ANY(input->press.button, BTN_DDOWN | BTN_DUP))) {
|
||||||
|
|
|
@ -347,19 +347,36 @@ void FileChoose_DrawNameEntry(GameState* thisx) {
|
||||||
PRIMITIVE, 0);
|
PRIMITIVE, 0);
|
||||||
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 255, 255, 255, 255);
|
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 255, 255, 255, 255);
|
||||||
|
|
||||||
if (HandleMouseCursor(this, input, 193, 169, 28, 17)) {
|
if (HandleMouseCursor(this, input, 193, 169, 28, 17) == 1) {
|
||||||
if (this->kbdButton != FS_KBD_BTN_BACKSPACE) {
|
if (this->kbdButton != FS_KBD_BTN_BACKSPACE) {
|
||||||
this->kbdButton = FS_KBD_BTN_BACKSPACE;
|
this->charIndex = 0;
|
||||||
|
this->kbdX = 3;
|
||||||
|
this->kbdY = 5;
|
||||||
Audio_PlaySoundGeneral(NA_SE_SY_FSEL_CURSOR, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8);
|
Audio_PlaySoundGeneral(NA_SE_SY_FSEL_CURSOR, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8);
|
||||||
}
|
}
|
||||||
|
|
||||||
HandleMouseInput(input);
|
HandleMouseInput(input);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (HandleMouseCursor(this, input, 226, 169, 44, 17)) {
|
if (HandleMouseCursor(this, input, 226, 169, 44, 17) == 1) {
|
||||||
if (this->kbdY != 5 && this->kbdX != 4) {
|
if (this->kbdButton != FS_KBD_BTN_END) {
|
||||||
this->kbdY = 5;
|
this->charIndex = 0;
|
||||||
this->kbdX = 4;
|
this->kbdX = 4;
|
||||||
|
this->kbdY = 5;
|
||||||
|
Audio_PlaySoundGeneral(NA_SE_SY_FSEL_CURSOR, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8);
|
||||||
|
}
|
||||||
|
|
||||||
|
HandleMouseInput(input);
|
||||||
|
}
|
||||||
|
|
||||||
|
Vec2f namePos = HandleMouseCursorSplit(this, input, 60, 79, 211, 79, 13, 5);
|
||||||
|
if (namePos.x != -1 && namePos.y != -1) {
|
||||||
|
int index = namePos.x + (namePos.y * 13);
|
||||||
|
if (this->charIndex != index) {
|
||||||
|
this->kbdButton = 99;
|
||||||
|
this->kbdX = 0;
|
||||||
|
this->kbdY = 0;
|
||||||
|
this->charIndex = index;
|
||||||
Audio_PlaySoundGeneral(NA_SE_SY_FSEL_CURSOR, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8);
|
Audio_PlaySoundGeneral(NA_SE_SY_FSEL_CURSOR, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -372,7 +389,7 @@ void FileChoose_DrawNameEntry(GameState* thisx) {
|
||||||
// place cursor on END button
|
// place cursor on END button
|
||||||
this->kbdY = 5;
|
this->kbdY = 5;
|
||||||
this->kbdX = 4;
|
this->kbdX = 4;
|
||||||
} else if (CHECK_BTN_ALL(input->press.button, BTN_B)) {
|
} else if (CHECK_BTN_ALL(input->press.button, BTN_B) || input->press.right_click) {
|
||||||
if ((this->newFileNameCharCount == 7) && (this->fileNames[this->buttonIndex][7] != 0x3E)) {
|
if ((this->newFileNameCharCount == 7) && (this->fileNames[this->buttonIndex][7] != 0x3E)) {
|
||||||
for (i = this->newFileNameCharCount; i < 7; i++) {
|
for (i = this->newFileNameCharCount; i < 7; i++) {
|
||||||
this->fileNames[this->buttonIndex][i] = this->fileNames[this->buttonIndex][i + 1];
|
this->fileNames[this->buttonIndex][i] = this->fileNames[this->buttonIndex][i + 1];
|
||||||
|
@ -416,7 +433,8 @@ void FileChoose_DrawNameEntry(GameState* thisx) {
|
||||||
this->newFileNameCharCount = 7;
|
this->newFileNameCharCount = 7;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (CHECK_BTN_ALL(input->press.button, BTN_A) && (this->charPage != this->kbdButton)) {
|
} else if (CHECK_BTN_ALL(input->press.button, BTN_A) &&
|
||||||
|
(this->charPage != this->kbdButton)) {
|
||||||
if (this->kbdButton == FS_KBD_BTN_BACKSPACE) {
|
if (this->kbdButton == FS_KBD_BTN_BACKSPACE) {
|
||||||
if ((this->newFileNameCharCount == 7) && (this->fileNames[this->buttonIndex][7] != 0x3E)) {
|
if ((this->newFileNameCharCount == 7) && (this->fileNames[this->buttonIndex][7] != 0x3E)) {
|
||||||
for (i = this->newFileNameCharCount; i < 7; i++) {
|
for (i = this->newFileNameCharCount; i < 7; i++) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue