mirror of https://github.com/sm64pc/sm64pc.git
add OPT_BUTTON option type; move Exit Game button from pause to options menu
This commit is contained in:
parent
8b71a1a734
commit
ed59481560
|
@ -2391,12 +2391,6 @@ void render_pause_course_options(s16 x, s16 y, s8 *index, s16 yIndex) {
|
||||||
{ TEXT_EXIT_COURSE_DE }
|
{ TEXT_EXIT_COURSE_DE }
|
||||||
};
|
};
|
||||||
|
|
||||||
u8 textExitGame[][22] ={
|
|
||||||
{ TEXT_EXIT_GAME },
|
|
||||||
{ TEXT_EXIT_GAME_FR },
|
|
||||||
{ TEXT_EXIT_GAME_DE }
|
|
||||||
};
|
|
||||||
|
|
||||||
u8 textCameraAngleR[][24] = {
|
u8 textCameraAngleR[][24] = {
|
||||||
{ TEXT_CAMERA_ANGLE_R },
|
{ TEXT_CAMERA_ANGLE_R },
|
||||||
{ TEXT_CAMERA_ANGLE_R_FR },
|
{ TEXT_CAMERA_ANGLE_R_FR },
|
||||||
|
@ -2404,27 +2398,23 @@ void render_pause_course_options(s16 x, s16 y, s8 *index, s16 yIndex) {
|
||||||
};
|
};
|
||||||
#define textContinue textContinue[gInGameLanguage]
|
#define textContinue textContinue[gInGameLanguage]
|
||||||
#define textExitCourse textExitCourse[gInGameLanguage]
|
#define textExitCourse textExitCourse[gInGameLanguage]
|
||||||
#define textExitGame textExitGame[gInGameLanguage]
|
|
||||||
#define textCameraAngleR textCameraAngleR[gInGameLanguage]
|
#define textCameraAngleR textCameraAngleR[gInGameLanguage]
|
||||||
#else
|
#else
|
||||||
u8 textContinue[] = { TEXT_CONTINUE };
|
u8 textContinue[] = { TEXT_CONTINUE };
|
||||||
u8 textExitCourse[] = { TEXT_EXIT_COURSE };
|
u8 textExitCourse[] = { TEXT_EXIT_COURSE };
|
||||||
u8 textExitGame[] = { TEXT_EXIT_GAME };
|
|
||||||
u8 textCameraAngleR[] = { TEXT_CAMERA_ANGLE_R };
|
u8 textCameraAngleR[] = { TEXT_CAMERA_ANGLE_R };
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
handle_menu_scrolling(MENU_SCROLL_VERTICAL, index, 1, 4); // Index max raised to 4 from 3
|
handle_menu_scrolling(MENU_SCROLL_VERTICAL, index, 1, 3);
|
||||||
|
|
||||||
gSPDisplayList(gDisplayListHead++, dl_ia_text_begin);
|
gSPDisplayList(gDisplayListHead++, dl_ia_text_begin);
|
||||||
gDPSetEnvColor(gDisplayListHead++, 255, 255, 255, gDialogTextAlpha);
|
gDPSetEnvColor(gDisplayListHead++, 255, 255, 255, gDialogTextAlpha);
|
||||||
|
|
||||||
print_generic_string(x + 10, y - 2, textContinue);
|
print_generic_string(x + 10, y - 2, textContinue);
|
||||||
print_generic_string(x + 10, y - 17, textExitCourse);
|
print_generic_string(x + 10, y - 17, textExitCourse);
|
||||||
print_generic_string(x + 10, y - 33, textExitGame);
|
|
||||||
|
|
||||||
|
if (index[0] != 3) {
|
||||||
if (index[0] != 4) {
|
print_generic_string(x + 10, y - 33, textCameraAngleR);
|
||||||
print_generic_string(x + 10, y - 48, textCameraAngleR);
|
|
||||||
gSPDisplayList(gDisplayListHead++, dl_ia_text_end);
|
gSPDisplayList(gDisplayListHead++, dl_ia_text_end);
|
||||||
|
|
||||||
create_dl_translation_matrix(MENU_MTX_PUSH, x - X_VAL8, (y - ((index[0] - 1) * yIndex)) - Y_VAL8, 0);
|
create_dl_translation_matrix(MENU_MTX_PUSH, x - X_VAL8, (y - ((index[0] - 1) * yIndex)) - Y_VAL8, 0);
|
||||||
|
@ -2432,10 +2422,8 @@ void render_pause_course_options(s16 x, s16 y, s8 *index, s16 yIndex) {
|
||||||
gDPSetEnvColor(gDisplayListHead++, 255, 255, 255, gDialogTextAlpha);
|
gDPSetEnvColor(gDisplayListHead++, 255, 255, 255, gDialogTextAlpha);
|
||||||
gSPDisplayList(gDisplayListHead++, dl_draw_triangle);
|
gSPDisplayList(gDisplayListHead++, dl_draw_triangle);
|
||||||
gSPPopMatrix(gDisplayListHead++, G_MTX_MODELVIEW);
|
gSPPopMatrix(gDisplayListHead++, G_MTX_MODELVIEW);
|
||||||
}
|
} else {
|
||||||
|
render_pause_camera_options(x - 42, y - 42, &gDialogCameraAngleIndex, 110);
|
||||||
if (index[0] == 4) {
|
|
||||||
render_pause_camera_options(x - 42, y - 57, &gDialogCameraAngleIndex, 110);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2675,7 +2663,7 @@ s16 render_pause_courses_and_castle(void) {
|
||||||
gDialogBoxState = DIALOG_STATE_OPENING;
|
gDialogBoxState = DIALOG_STATE_OPENING;
|
||||||
gMenuMode = -1;
|
gMenuMode = -1;
|
||||||
|
|
||||||
if (gDialogLineNum == 2 || gDialogLineNum == 3) {
|
if (gDialogLineNum == 2) {
|
||||||
num = gDialogLineNum;
|
num = gDialogLineNum;
|
||||||
} else {
|
} else {
|
||||||
num = 1;
|
num = 1;
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
#include "pc/controller/controller_api.h"
|
#include "pc/controller/controller_api.h"
|
||||||
|
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
u8 optmenu_open = 0;
|
u8 optmenu_open = 0;
|
||||||
|
|
||||||
|
@ -43,6 +44,7 @@ static const u8 menuStr[][64] = {
|
||||||
{ TEXT_OPT_OPTIONS },
|
{ TEXT_OPT_OPTIONS },
|
||||||
{ TEXT_OPT_CAMERA },
|
{ TEXT_OPT_CAMERA },
|
||||||
{ TEXT_OPT_CONTROLS },
|
{ TEXT_OPT_CONTROLS },
|
||||||
|
{ TEXT_EXIT_GAME },
|
||||||
};
|
};
|
||||||
|
|
||||||
static const u8 optsCameraStr[][64] = {
|
static const u8 optsCameraStr[][64] = {
|
||||||
|
@ -82,6 +84,7 @@ enum OptType {
|
||||||
OPT_SCROLL,
|
OPT_SCROLL,
|
||||||
OPT_SUBMENU,
|
OPT_SUBMENU,
|
||||||
OPT_BIND,
|
OPT_BIND,
|
||||||
|
OPT_BUTTON,
|
||||||
};
|
};
|
||||||
|
|
||||||
struct SubMenu;
|
struct SubMenu;
|
||||||
|
@ -104,6 +107,7 @@ struct Option {
|
||||||
u32 scrStep;
|
u32 scrStep;
|
||||||
};
|
};
|
||||||
struct SubMenu *nextMenu;
|
struct SubMenu *nextMenu;
|
||||||
|
void (*actionFn)(struct Option *, s32);
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -116,6 +120,12 @@ struct SubMenu {
|
||||||
s32 scroll;
|
s32 scroll;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/* button action functions */
|
||||||
|
|
||||||
|
static void optmenu_act_exit(UNUSED struct Option *self, s32 arg) {
|
||||||
|
if (!arg) exit(0); // only exit on A press and not directions
|
||||||
|
}
|
||||||
|
|
||||||
/* submenu option lists */
|
/* submenu option lists */
|
||||||
|
|
||||||
static struct Option optsCamera[] = {
|
static struct Option optsCamera[] = {
|
||||||
|
@ -165,6 +175,7 @@ static struct SubMenu menuControls = {
|
||||||
static struct Option optsMain[] = {
|
static struct Option optsMain[] = {
|
||||||
{ .type = OPT_SUBMENU, .label = menuStr[4], .nextMenu = &menuCamera, },
|
{ .type = OPT_SUBMENU, .label = menuStr[4], .nextMenu = &menuCamera, },
|
||||||
{ .type = OPT_SUBMENU, .label = menuStr[5], .nextMenu = &menuControls, },
|
{ .type = OPT_SUBMENU, .label = menuStr[5], .nextMenu = &menuControls, },
|
||||||
|
{ .type = OPT_BUTTON, .label = menuStr[6], .actionFn = optmenu_act_exit, },
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct SubMenu menuMain = {
|
static struct SubMenu menuMain = {
|
||||||
|
@ -223,7 +234,7 @@ static void optmenu_draw_text(s16 x, s16 y, const u8 *str, u8 col) {
|
||||||
static void optmenu_draw_opt(const struct Option *opt, s16 x, s16 y, u8 sel) {
|
static void optmenu_draw_opt(const struct Option *opt, s16 x, s16 y, u8 sel) {
|
||||||
u8 buf[32] = { 0 };
|
u8 buf[32] = { 0 };
|
||||||
|
|
||||||
if (opt->type == OPT_SUBMENU)
|
if (opt->type == OPT_SUBMENU || opt->type == OPT_BUTTON)
|
||||||
y -= 6;
|
y -= 6;
|
||||||
|
|
||||||
optmenu_draw_text(x, y, opt->label, sel);
|
optmenu_draw_text(x, y, opt->label, sel);
|
||||||
|
@ -282,6 +293,11 @@ static void optmenu_opt_change(struct Option *opt, s32 val) {
|
||||||
currentMenu = opt->nextMenu;
|
currentMenu = opt->nextMenu;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case OPT_BUTTON:
|
||||||
|
if (opt->actionFn)
|
||||||
|
opt->actionFn(opt, val);
|
||||||
|
break;
|
||||||
|
|
||||||
case OPT_BIND:
|
case OPT_BIND:
|
||||||
if (val == 0xFF) {
|
if (val == 0xFF) {
|
||||||
// clear the bind
|
// clear the bind
|
||||||
|
|
Loading…
Reference in New Issue