mirror of
https://github.com/ACreTeam/ac-decomp
synced 2026-07-08 20:24:49 -04:00
Merge pull request #201 from Cuyler36/m_choice
Implement & link m_choice.c
This commit is contained in:
+121
@@ -0,0 +1,121 @@
|
||||
#include "m_choice.h"
|
||||
|
||||
#include "audio.h"
|
||||
#include "jsyswrap.h"
|
||||
#include "libultra/libultra.h"
|
||||
#include "m_common_data.h"
|
||||
#include "m_font.h"
|
||||
#include "m_msg.h"
|
||||
#include "sys_matrix.h"
|
||||
|
||||
typedef void (*mChoice_MAIN_PROC)(mChoice_c*, GAME*);
|
||||
|
||||
static void mChoice_MainSetup(mChoice_c* choice, GAME* game);
|
||||
|
||||
static u32 Choice_table_rom_start = 0;
|
||||
static u32 Choice_rom_start = 0;
|
||||
|
||||
#ifdef MUST_MATCH
|
||||
/* Force assetrip to detect these assets. They're used in a .c_inc file. */
|
||||
static u8 unused_con_waku_swaku3_tex[] = {
|
||||
#ifndef __INTELLISENSE__
|
||||
#include "assets/con_waku_swaku3_tex.inc"
|
||||
#endif
|
||||
};
|
||||
|
||||
static Vtx unused_con_sentaku2_v[] = {
|
||||
#ifndef __INTELLISENSE__
|
||||
#include "assets/con_sentaku2_v.inc"
|
||||
#endif
|
||||
};
|
||||
#endif
|
||||
|
||||
static void mChoice_MainSetup_Hide(mChoice_c*, GAME*);
|
||||
static void mChoice_MainSetup_Appear(mChoice_c*, GAME*);
|
||||
static void mChoice_MainSetup_Normal(mChoice_c*, GAME*);
|
||||
static void mChoice_MainSetup_Disappear(mChoice_c*, GAME*);
|
||||
|
||||
static void mChoice_init(mChoice_c* choice, GAME* game);
|
||||
static void mChoice_check_ct(mChoice_c* choice);
|
||||
static void mChoice_SetMatrix(mChoice_c* choice, GAME* game, int type);
|
||||
static void mChoice_SetMatrixDisplay(mChoice_c* choice, GAME* game, int type);
|
||||
static void mChoice_UnSetMatrix();
|
||||
static void mChoice_UnSetMatrixDisplay(GAME* game, int type);
|
||||
static void mChoice_DrawWindowBody(mChoice_c* choice, GAME* game, int type);
|
||||
static void mChoice_DrawFont(mChoice_c* choice, GAME* game, int type);
|
||||
|
||||
static void mChoice_Main_Hide(mChoice_c*, GAME*);
|
||||
static void mChoice_Main_Appear(mChoice_c*, GAME*);
|
||||
static void mChoice_Main_Normal(mChoice_c*, GAME*);
|
||||
static void mChoice_Main_Disappear(mChoice_c*, GAME*);
|
||||
|
||||
static void mChoice_MainSetup(mChoice_c* choice, GAME* game) {
|
||||
static mChoice_MAIN_PROC proc[mChoice_MAIN_INDEX_NUM] = {
|
||||
&mChoice_MainSetup_Hide,
|
||||
&mChoice_MainSetup_Appear,
|
||||
&mChoice_MainSetup_Normal,
|
||||
&mChoice_MainSetup_Disappear
|
||||
};
|
||||
|
||||
int index = choice->requested_main_index;
|
||||
|
||||
/* This is necessary lol */
|
||||
if (index < 0) {
|
||||
return;
|
||||
}
|
||||
else if (index < 0 || index >= mChoice_MAIN_INDEX_NUM || proc[index] == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
(*proc[index])(choice, game);
|
||||
}
|
||||
|
||||
extern void mChoice_Main(mChoice_c* choice, GAME* game) {
|
||||
static mChoice_MAIN_PROC proc[mChoice_MAIN_INDEX_NUM] = {
|
||||
&mChoice_Main_Hide,
|
||||
&mChoice_Main_Appear,
|
||||
&mChoice_Main_Normal,
|
||||
&mChoice_Main_Disappear
|
||||
};
|
||||
|
||||
int index = choice->main_index;
|
||||
|
||||
if (index < 0 || index >= mChoice_MAIN_INDEX_NUM || proc[index] == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
(*proc[index])(choice, game);
|
||||
}
|
||||
|
||||
extern void mChoice_Draw(mChoice_c* choice, GAME* game, int mode) {
|
||||
if (choice->window_visible_flag) {
|
||||
mFont_SetMatrix(game->graph, mode);
|
||||
mChoice_SetMatrix(choice, game, mode);
|
||||
mChoice_SetMatrixDisplay(choice, game, mode);
|
||||
mChoice_DrawWindowBody(choice, game, mode);
|
||||
mChoice_UnSetMatrixDisplay(game, mode);
|
||||
mChoice_DrawFont(choice, game, mode);
|
||||
mChoice_UnSetMatrix();
|
||||
mFont_UnSetMatrix(game->graph, mode);
|
||||
}
|
||||
}
|
||||
|
||||
extern void mChoice_aram_init() {
|
||||
Choice_table_rom_start = JW_GetAramAddress(RESOURCE_SELECT_TABLE);
|
||||
Choice_rom_start = JW_GetAramAddress(RESOURCE_SELECT);
|
||||
}
|
||||
|
||||
extern void mChoice_ct(mChoice_c* choice, GAME* game) {
|
||||
mChoice_check_ct(choice);
|
||||
mChoice_init(choice, game);
|
||||
}
|
||||
|
||||
extern void mChoice_dt(mChoice_c* choice, GAME* game) { }
|
||||
|
||||
#include "../src/m_choice_main.c_inc"
|
||||
#include "../src/m_choice_sound.c_inc"
|
||||
#include "../src/m_choice_main_hide.c_inc"
|
||||
#include "../src/m_choice_main_appear.c_inc"
|
||||
#include "../src/m_choice_main_normal.c_inc"
|
||||
#include "../src/m_choice_main_disappear.c_inc"
|
||||
#include "../src/m_choice_draw.c_inc"
|
||||
@@ -0,0 +1,168 @@
|
||||
static void mChoice_SetMatrix(mChoice_c* choice, GAME* game, int type) {
|
||||
GRAPH* graph = game->graph;
|
||||
f32 scale = choice->scale;
|
||||
f32 x = ( choice->center_x - 160.0f) * 16.0f;
|
||||
f32 y = (-choice->center_y + 120.0f) * 16.0f;
|
||||
|
||||
Matrix_push();
|
||||
Matrix_translate(x, y, 0.0f, 1);
|
||||
Matrix_scale(scale, scale, 1.0f, 1);
|
||||
|
||||
OPEN_DISP(graph);
|
||||
|
||||
if (type == mFont_MODE_FONT) {
|
||||
gSPMatrix(NOW_FONT_DISP++, _Matrix_to_Mtx_new(graph), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
||||
}
|
||||
else {
|
||||
gSPMatrix(NOW_POLY_OPA_DISP++, _Matrix_to_Mtx_new(graph), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
||||
}
|
||||
|
||||
CLOSE_DISP(graph);
|
||||
}
|
||||
|
||||
static void mChoice_SetMatrixDisplay(mChoice_c* choice, GAME* game, int type) {
|
||||
GRAPH* graph = game->graph;
|
||||
f32 scale_x = choice->scale_x;
|
||||
f32 scale_y = choice->scale_y;
|
||||
|
||||
Matrix_push();
|
||||
Matrix_scale(scale_x, scale_y, 1.0f, 1);
|
||||
|
||||
OPEN_DISP(graph);
|
||||
|
||||
if (type == mFont_MODE_FONT) {
|
||||
gSPMatrix(NOW_FONT_DISP++, _Matrix_to_Mtx_new(graph), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
||||
}
|
||||
else {
|
||||
gSPMatrix(NOW_POLY_OPA_DISP++, _Matrix_to_Mtx_new(graph), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
||||
}
|
||||
|
||||
CLOSE_DISP(graph);
|
||||
}
|
||||
|
||||
static void mChoice_UnSetMatrix() {
|
||||
Matrix_pull();
|
||||
}
|
||||
|
||||
static void mChoice_UnSetMatrixDisplay(GAME* game, int type) {
|
||||
GRAPH* graph = game->graph;
|
||||
|
||||
Matrix_pull();
|
||||
|
||||
OPEN_DISP(graph);
|
||||
|
||||
if (type == mFont_MODE_FONT) {
|
||||
gSPMatrix(NOW_FONT_DISP++, _Matrix_to_Mtx_new(graph), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
||||
}
|
||||
else {
|
||||
gSPMatrix(NOW_POLY_OPA_DISP++, _Matrix_to_Mtx_new(graph), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
||||
}
|
||||
|
||||
CLOSE_DISP(graph);
|
||||
}
|
||||
|
||||
static u8 con_waku_swaku3_tex[] ATTRIBUTE_ALIGN(32) = {
|
||||
#ifndef __INTELLISENSE__
|
||||
#include "assets/con_waku_swaku3_tex.inc"
|
||||
#endif
|
||||
};
|
||||
|
||||
static Vtx con_sentaku2_v[] = {
|
||||
#ifndef __INTELLISENSE__
|
||||
#include "assets/con_sentaku2_v.inc"
|
||||
#endif
|
||||
};
|
||||
|
||||
static Gfx con_sentaku2_modelT[] = {
|
||||
gsSPTexture(0, 0, 0, 0, G_ON),
|
||||
gsDPSetPrimColor(0, 255, 255, 255, 155, 255),
|
||||
gsDPLoadTextureBlock_4b_Dolphin(con_waku_swaku3_tex, G_IM_FMT_I, 128, 64, 15, GX_MIRROR, GX_MIRROR, 0, 0),
|
||||
gsSPVertex(&con_sentaku2_v[0], 4, 0),
|
||||
gsSPNTrianglesInit_5b(
|
||||
2, // tri count
|
||||
0, 1, 2, // tri0
|
||||
0, 2, 3, // tri1
|
||||
0, 0, 0 // tri2
|
||||
),
|
||||
gsSPEndDisplayList()
|
||||
};
|
||||
|
||||
static Gfx mChoice_init_disp[] = {
|
||||
gsDPPipeSync(),
|
||||
gsSPClearGeometryMode(G_ZBUFFER | G_SHADE | G_CULL_BOTH | G_FOG | G_LIGHTING | G_TEXTURE_GEN | G_TEXTURE_GEN_LINEAR | G_LOD | G_SHADING_SMOOTH),
|
||||
gsDPSetTextureLOD(G_TL_TILE),
|
||||
gsDPSetTextureConvert(G_TC_FILT),
|
||||
gsDPSetTextureFilter(G_TF_BILERP),
|
||||
gsDPSetCycleType(G_CYC_1CYCLE),
|
||||
gsDPSetTexturePersp(G_TP_PERSP),
|
||||
gsDPSetAlphaDither(G_AD_DISABLE),
|
||||
gsDPSetColorDither(G_CD_DISABLE),
|
||||
gsDPSetCombineKey(G_CK_NONE),
|
||||
gsDPSetCombineLERP(0, 0, 0, PRIMITIVE, 0, 0, 0, TEXEL0, 0, 0, 0, PRIMITIVE, 0, 0, 0, TEXEL0),
|
||||
gsDPSetRenderMode(G_RM_XLU_SURF, G_RM_XLU_SURF2),
|
||||
gsSPEndDisplayList()
|
||||
};
|
||||
|
||||
static void mChoice_DrawWindowBody(mChoice_c* choice, GAME* game, int type) {
|
||||
GRAPH* graph = game->graph;
|
||||
|
||||
OPEN_DISP(graph);
|
||||
|
||||
if (type == mFont_MODE_FONT) {
|
||||
gSPDisplayList(NOW_FONT_DISP++, mChoice_init_disp);
|
||||
gSPDisplayList(NOW_FONT_DISP++, con_sentaku2_modelT);
|
||||
}
|
||||
else {
|
||||
gSPDisplayList(NOW_POLY_OPA_DISP++, mChoice_init_disp);
|
||||
gSPDisplayList(NOW_POLY_OPA_DISP++, con_sentaku2_modelT);
|
||||
}
|
||||
|
||||
CLOSE_DISP(graph);
|
||||
}
|
||||
|
||||
static void mChoice_DrawFont(mChoice_c* choice, GAME* game, int type) {
|
||||
int i;
|
||||
int choice_num = choice->data.choice_num;
|
||||
f32 x = choice->text_x;
|
||||
f32 y = choice->text_y;
|
||||
int selected_idx = choice->selected_choice_idx;
|
||||
int r;
|
||||
int g;
|
||||
int b;
|
||||
|
||||
for (i = 0; i < choice_num; i++) {
|
||||
if (i == selected_idx) {
|
||||
r = choice->selected_choice_text_color.r;
|
||||
g = choice->selected_choice_text_color.g;
|
||||
b = choice->selected_choice_text_color.b;
|
||||
mFont_SetMarkChar(
|
||||
game,
|
||||
mFont_MARKTYPE_CHOICE,
|
||||
x - 16.0f, y,
|
||||
choice->background_color.r, choice->background_color.g, choice->background_color.b, 255,
|
||||
FALSE,
|
||||
1.0f, 1.0f,
|
||||
type
|
||||
);
|
||||
}
|
||||
else {
|
||||
r = choice->text_color.r;
|
||||
g = choice->text_color.g;
|
||||
b = choice->text_color.b;
|
||||
}
|
||||
|
||||
mFont_SetLineStrings_AndSpace(
|
||||
game,
|
||||
choice->data.strings[i], choice->data.string_lens[i],
|
||||
x, y,
|
||||
r, g, b, 255,
|
||||
FALSE,
|
||||
TRUE,
|
||||
0,
|
||||
1.0f, 1.0f,
|
||||
type
|
||||
);
|
||||
|
||||
y += 16.0f;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,583 @@
|
||||
extern mChoice_c* mChoice_Get_base_window_p() {
|
||||
return &mMsg_Get_base_window_p()->choice_window;
|
||||
}
|
||||
|
||||
static void mChoice_init(mChoice_c* choice, GAME* game) {
|
||||
choice->center_x = 191.0f;
|
||||
choice->center_y = 83.0f;
|
||||
choice->text_color.r = 180;
|
||||
choice->text_color.g = 150;
|
||||
choice->text_color.b = 110;
|
||||
choice->text_color.a = 255;
|
||||
choice->text_scale_x = 1.0f;
|
||||
choice->text_scale_y = 1.0f;
|
||||
choice->text_x = 104.0f;
|
||||
choice->text_y = 96.0f;
|
||||
choice->scale_x = 1.0f;
|
||||
choice->scale_y = 1.0f;
|
||||
choice->data.choice_num = mChoice_CHOICE_NUM;
|
||||
choice->selected_choice_idx = mChoice_CHOICE0;
|
||||
choice->selected_choice_text_color.r = 120;
|
||||
choice->selected_choice_text_color.g = 50;
|
||||
choice->selected_choice_text_color.b = 50;
|
||||
choice->selected_choice_text_color.a = 255;
|
||||
choice->background_color.r = 0;
|
||||
choice->background_color.g = 195;
|
||||
choice->background_color.b = 185;
|
||||
choice->background_color.a = 255;
|
||||
choice->choice_automove_timer = 0.0f;
|
||||
choice->_D4 = 232.0f;
|
||||
choice->_D8 = 104.0f;
|
||||
choice->scale = 0.0f;
|
||||
choice->main_index = mChoice_MAIN_HIDE;
|
||||
choice->requested_main_index = -1;
|
||||
choice->window_visible_flag = FALSE;
|
||||
choice->font_visible_flag = FALSE;
|
||||
choice->choice_automove_type = mChoice_AUTOMOVE_STOPPED;
|
||||
choice->choice_automove_timer = 0.0f; // duplicate set
|
||||
choice->timer = 0.0f;
|
||||
choice->no_b_flag = FALSE;
|
||||
choice->no_close_flag = FALSE;
|
||||
}
|
||||
|
||||
extern void mChoice_Change_request_main_index(mChoice_c* choice, int request_main_index) {
|
||||
choice->requested_main_index = request_main_index;
|
||||
}
|
||||
|
||||
extern int mChoice_check_main_index(mChoice_c* choice) {
|
||||
return choice->main_index;
|
||||
}
|
||||
|
||||
extern int mChoice_check_main_normal(mChoice_c* choice) {
|
||||
if (mChoice_check_main_index(choice) == mChoice_MAIN_NORMAL) {
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void mChoice_Init_choice_data(mChoice_c* choice) {
|
||||
choice->data.choice_num = 0;
|
||||
}
|
||||
|
||||
static int mChoice_Add_choice_data(mChoice_c* choice, u8* str, int max_len) {
|
||||
if (str != NULL && max_len > 0 && max_len <= mChoice_CHOICE_STRING_LEN) {
|
||||
int num = choice->data.choice_num;
|
||||
|
||||
if (num < mChoice_CHOICE_NUM) {
|
||||
int len = mMsg_Get_Length_String(str, max_len);
|
||||
u8* dst = choice->data.strings[num];
|
||||
int i;
|
||||
|
||||
for (i = 0; i < len; i++) {
|
||||
*dst++ = *str++;
|
||||
}
|
||||
|
||||
choice->data.string_lens[num] = len;
|
||||
choice->data.choice_num++;
|
||||
return num;
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
extern void mChoice_Set_choice_data(
|
||||
mChoice_c* choice,
|
||||
u8* str0, int str0_len,
|
||||
u8* str1, int str1_len,
|
||||
u8* str2, int str2_len,
|
||||
u8* str3, int str3_len,
|
||||
u8* str4, int str4_len,
|
||||
u8* str5, int str5_len
|
||||
) {
|
||||
mChoice_Init_choice_data(choice);
|
||||
|
||||
if (str0 != NULL && str0_len > 0 && str0_len <= mChoice_CHOICE_STRING_LEN) {
|
||||
mChoice_Add_choice_data(choice, str0, str0_len);
|
||||
}
|
||||
|
||||
if (str1 != NULL && str1_len > 0 && str1_len <= mChoice_CHOICE_STRING_LEN) {
|
||||
mChoice_Add_choice_data(choice, str1, str1_len);
|
||||
}
|
||||
|
||||
if (str2 != NULL && str2_len > 0 && str2_len <= mChoice_CHOICE_STRING_LEN) {
|
||||
mChoice_Add_choice_data(choice, str2, str2_len);
|
||||
}
|
||||
|
||||
if (str3 != NULL && str3_len > 0 && str3_len <= mChoice_CHOICE_STRING_LEN) {
|
||||
mChoice_Add_choice_data(choice, str3, str3_len);
|
||||
}
|
||||
|
||||
if (str4 != NULL && str4_len > 0 && str4_len <= mChoice_CHOICE_STRING_LEN) {
|
||||
mChoice_Add_choice_data(choice, str4, str4_len);
|
||||
}
|
||||
|
||||
if (str5 != NULL && str5_len > 0 && str5_len <= mChoice_CHOICE_STRING_LEN) {
|
||||
mChoice_Add_choice_data(choice, str5, str5_len);
|
||||
}
|
||||
}
|
||||
|
||||
static int mChoice_Get_MaxStringDotWidth(mChoice_c* choice) {
|
||||
int i;
|
||||
int choice_num = choice->data.choice_num;
|
||||
int max_width = 0;
|
||||
|
||||
for (i = 0; i < choice_num; i++) {
|
||||
u8* str = choice->data.strings[i];
|
||||
int len = choice->data.string_lens[i];
|
||||
int width = mFont_GetStringWidth(str, len, TRUE);
|
||||
|
||||
if (width > max_width) {
|
||||
max_width = width;
|
||||
}
|
||||
}
|
||||
|
||||
return max_width;
|
||||
}
|
||||
|
||||
static int mChoice_Get_MaxStringDotHeight(mChoice_c* choice) {
|
||||
return choice->data.choice_num * 16;
|
||||
}
|
||||
|
||||
static void mChoice_Set_DisplayScaleAndDisplayPos(mChoice_c* choice) {
|
||||
int dw = mChoice_Get_MaxStringDotWidth(choice);
|
||||
f32 dotW = ((f32)dw - 24.0f) / 96.0f;
|
||||
int dh = mChoice_Get_MaxStringDotHeight(choice);
|
||||
f32 dotH = ((f32)dh - 32.0f) / 32.0f;
|
||||
f32 scaleX = (dotW * 0.5833333730697632f) + (1.0f/2.4f);
|
||||
f32 scaleY = (dotH * 0.3142857f) + (0.6857143f);
|
||||
int choice_num = choice->data.choice_num;
|
||||
f32 tempDotH;
|
||||
|
||||
choice->scale_x = scaleX;
|
||||
choice->scale_y = scaleY;
|
||||
tempDotH = dotH * -20.057144f;
|
||||
choice->text_x = (dotW * -48.0f) + 152.0f;
|
||||
|
||||
if (choice_num > 4) {
|
||||
choice->text_y = tempDotH + 105.0f + (f32)(choice_num - 3) * 2.0f;
|
||||
}
|
||||
else {
|
||||
choice->text_y = tempDotH + 105.0f;
|
||||
}
|
||||
|
||||
tempDotH = dotH * 20.057144f;
|
||||
choice->center_x = 242.0f;
|
||||
choice->center_x_begin = 242.0f;
|
||||
choice->center_x_target = 242.0f + (dotW * -35.0f);
|
||||
|
||||
choice->center_y = 169.0f;
|
||||
choice->center_y_begin = 169.0f;
|
||||
|
||||
if (choice_num > 4) {
|
||||
choice->center_y_target = (169.0f + tempDotH) - (f32)(choice_num - 4) * 16.0f;
|
||||
}
|
||||
else {
|
||||
choice->center_y_target = 169.0f + tempDotH;
|
||||
}
|
||||
}
|
||||
|
||||
extern int mChoice_Get_ChoseNum(mChoice_c* choice) {
|
||||
return choice->data.selected_choice_idx;
|
||||
}
|
||||
|
||||
extern void mChoice_Clear_ChoseNum(mChoice_c* choice) {
|
||||
choice->data.selected_choice_idx = -1;
|
||||
}
|
||||
|
||||
static void mChoice_check_ct(mChoice_c* choice) { }
|
||||
|
||||
static void mChoice_Get_StringDataAddressAndSize(int idx, u32* addr, u32* size) {
|
||||
mMsg_Get_BodyParam(Choice_table_rom_start, Choice_rom_start, idx, addr, size);
|
||||
}
|
||||
|
||||
static int mChoice_Put_String_PLAYER_NAME(u8* data, int idx, int max_size, ACTOR* actor) {
|
||||
return mMsg_CopyPlayerName(data, idx, max_size, FALSE);
|
||||
}
|
||||
|
||||
static int mChoice_Put_String_TALK_NAME(u8* data, int idx, int max_size, ACTOR* actor) {
|
||||
return mMsg_CopyTalkName(actor, data, idx, max_size, FALSE);
|
||||
}
|
||||
|
||||
static int mChoice_Put_String_TAIL(u8* data, int idx, int max_size, ACTOR* actor) {
|
||||
return mMsg_CopyTail(actor, data, idx, max_size, FALSE);
|
||||
}
|
||||
|
||||
static int mChoice_Put_String_YEAR(u8* data, int idx, int max_size, ACTOR* actor) {
|
||||
return mMsg_CopyYear(data, idx, max_size);
|
||||
}
|
||||
|
||||
static int mChoice_Put_String_MONTH(u8* data, int idx, int max_size, ACTOR* actor) {
|
||||
return mMsg_CopyMonth(data, idx, max_size);
|
||||
}
|
||||
|
||||
static int mChoice_Put_String_WEEK(u8* data, int idx, int max_size, ACTOR* actor) {
|
||||
return mMsg_CopyWeek(data, idx, max_size);
|
||||
}
|
||||
|
||||
static int mChoice_Put_String_DAY(u8* data, int idx, int max_size, ACTOR* actor) {
|
||||
return mMsg_CopyDay(data, idx, max_size);
|
||||
}
|
||||
|
||||
static int mChoice_Put_String_HOUR(u8* data, int idx, int max_size, ACTOR* actor) {
|
||||
mMsg_Window_c* msg_p = mMsg_Get_base_window_p();
|
||||
int hour = Common_Get(time.rtc_time.hour);
|
||||
|
||||
if (hour < 12) {
|
||||
msg_p->status_flags |= mMsg_STATUS_FLAG_USE_AM;
|
||||
}
|
||||
else {
|
||||
msg_p->status_flags &= ~mMsg_STATUS_FLAG_USE_AM;
|
||||
}
|
||||
|
||||
return mMsg_CopyHour(data, idx, max_size);
|
||||
}
|
||||
|
||||
static int mChoice_Put_String_MIN(u8* data, int idx, int max_size, ACTOR* actor) {
|
||||
return mMsg_CopyMin(data, idx, max_size);
|
||||
}
|
||||
|
||||
static int mChoice_Put_String_SEC(u8* data, int idx, int max_size, ACTOR* actor) {
|
||||
return mMsg_CopySec(data, idx, max_size);
|
||||
}
|
||||
|
||||
static int mChoice_Put_String_FREE(u8* data, int idx, int max_size, ACTOR* actor, int free_idx) {
|
||||
return mMsg_CopyFree(mMsg_Get_base_window_p(), free_idx, data, idx, max_size, mIN_ARTICLE_NUM, FALSE);
|
||||
}
|
||||
|
||||
static int mChoice_Put_String_FREE0(u8* data, int idx, int max_size, ACTOR* actor) {
|
||||
return mChoice_Put_String_FREE(data, idx, max_size, actor, mMsg_FREE_STR0);
|
||||
}
|
||||
|
||||
static int mChoice_Put_String_FREE1(u8* data, int idx, int max_size, ACTOR* actor) {
|
||||
return mChoice_Put_String_FREE(data, idx, max_size, actor, mMsg_FREE_STR1);
|
||||
}
|
||||
|
||||
static int mChoice_Put_String_FREE2(u8* data, int idx, int max_size, ACTOR* actor) {
|
||||
return mChoice_Put_String_FREE(data, idx, max_size, actor, mMsg_FREE_STR2);
|
||||
}
|
||||
|
||||
static int mChoice_Put_String_FREE3(u8* data, int idx, int max_size, ACTOR* actor) {
|
||||
return mChoice_Put_String_FREE(data, idx, max_size, actor, mMsg_FREE_STR3);
|
||||
}
|
||||
|
||||
static int mChoice_Put_String_FREE4(u8* data, int idx, int max_size, ACTOR* actor) {
|
||||
return mChoice_Put_String_FREE(data, idx, max_size, actor, mMsg_FREE_STR4);
|
||||
}
|
||||
|
||||
static int mChoice_Put_String_FREE5(u8* data, int idx, int max_size, ACTOR* actor) {
|
||||
return mChoice_Put_String_FREE(data, idx, max_size, actor, mMsg_FREE_STR5);
|
||||
}
|
||||
|
||||
static int mChoice_Put_String_FREE6(u8* data, int idx, int max_size, ACTOR* actor) {
|
||||
return mChoice_Put_String_FREE(data, idx, max_size, actor, mMsg_FREE_STR6);
|
||||
}
|
||||
|
||||
static int mChoice_Put_String_FREE7(u8* data, int idx, int max_size, ACTOR* actor) {
|
||||
return mChoice_Put_String_FREE(data, idx, max_size, actor, mMsg_FREE_STR7);
|
||||
}
|
||||
|
||||
static int mChoice_Put_String_FREE8(u8* data, int idx, int max_size, ACTOR* actor) {
|
||||
return mChoice_Put_String_FREE(data, idx, max_size, actor, mMsg_FREE_STR8);
|
||||
}
|
||||
|
||||
static int mChoice_Put_String_FREE9(u8* data, int idx, int max_size, ACTOR* actor) {
|
||||
return mChoice_Put_String_FREE(data, idx, max_size, actor, mMsg_FREE_STR9);
|
||||
}
|
||||
|
||||
static int mChoice_Put_String_FREE10(u8* data, int idx, int max_size, ACTOR* actor) {
|
||||
return mChoice_Put_String_FREE(data, idx, max_size, actor, mMsg_FREE_STR10);
|
||||
}
|
||||
|
||||
static int mChoice_Put_String_FREE11(u8* data, int idx, int max_size, ACTOR* actor) {
|
||||
return mChoice_Put_String_FREE(data, idx, max_size, actor, mMsg_FREE_STR11);
|
||||
}
|
||||
|
||||
static int mChoice_Put_String_FREE12(u8* data, int idx, int max_size, ACTOR* actor) {
|
||||
return mChoice_Put_String_FREE(data, idx, max_size, actor, mMsg_FREE_STR12);
|
||||
}
|
||||
|
||||
static int mChoice_Put_String_FREE13(u8* data, int idx, int max_size, ACTOR* actor) {
|
||||
return mChoice_Put_String_FREE(data, idx, max_size, actor, mMsg_FREE_STR13);
|
||||
}
|
||||
|
||||
static int mChoice_Put_String_FREE14(u8* data, int idx, int max_size, ACTOR* actor) {
|
||||
return mChoice_Put_String_FREE(data, idx, max_size, actor, mMsg_FREE_STR14);
|
||||
}
|
||||
|
||||
static int mChoice_Put_String_FREE15(u8* data, int idx, int max_size, ACTOR* actor) {
|
||||
return mChoice_Put_String_FREE(data, idx, max_size, actor, mMsg_FREE_STR15);
|
||||
}
|
||||
|
||||
static int mChoice_Put_String_FREE16(u8* data, int idx, int max_size, ACTOR* actor) {
|
||||
return mChoice_Put_String_FREE(data, idx, max_size, actor, mMsg_FREE_STR16);
|
||||
}
|
||||
|
||||
static int mChoice_Put_String_FREE17(u8* data, int idx, int max_size, ACTOR* actor) {
|
||||
return mChoice_Put_String_FREE(data, idx, max_size, actor, mMsg_FREE_STR17);
|
||||
}
|
||||
|
||||
static int mChoice_Put_String_FREE18(u8* data, int idx, int max_size, ACTOR* actor) {
|
||||
return mChoice_Put_String_FREE(data, idx, max_size, actor, mMsg_FREE_STR18);
|
||||
}
|
||||
|
||||
static int mChoice_Put_String_FREE19(u8* data, int idx, int max_size, ACTOR* actor) {
|
||||
return mChoice_Put_String_FREE(data, idx, max_size, actor, mMsg_FREE_STR19);
|
||||
}
|
||||
|
||||
static int mChoice_Put_String_DETERMINATION(u8* data, int idx, int max_size, ACTOR* actor) {
|
||||
return mMsg_CopyDetermination(mMsg_Get_base_window_p(), data, idx, max_size);
|
||||
}
|
||||
|
||||
static int mChoice_Put_String_COUNTRY_NAME(u8* data, int idx, int max_size, ACTOR* actor) {
|
||||
return mMsg_CopyCountryName(data, idx, max_size, FALSE);
|
||||
}
|
||||
|
||||
static int mChoice_Put_String_RAMDOM_NUMBER2(u8* data, int idx, int max_size, ACTOR* actor) {
|
||||
return mMsg_CopyRamdomNumber2(data, idx, max_size);
|
||||
}
|
||||
|
||||
static int mChoice_Put_String_ITEM(u8* data, int idx, int max_size, ACTOR* actor, int item_idx) {
|
||||
return mMsg_CopyItem(mMsg_Get_base_window_p(), item_idx, data, idx, max_size, mIN_ARTICLE_NUM, FALSE);
|
||||
}
|
||||
|
||||
static int mChoice_Put_String_ITEM0(u8* data, int idx, int max_size, ACTOR* actor) {
|
||||
return mChoice_Put_String_ITEM(data, idx, max_size, actor, mMsg_ITEM_STR0);
|
||||
}
|
||||
|
||||
static int mChoice_Put_String_ITEM1(u8* data, int idx, int max_size, ACTOR* actor) {
|
||||
return mChoice_Put_String_ITEM(data, idx, max_size, actor, mMsg_ITEM_STR1);
|
||||
}
|
||||
|
||||
static int mChoice_Put_String_ITEM2(u8* data, int idx, int max_size, ACTOR* actor) {
|
||||
return mChoice_Put_String_ITEM(data, idx, max_size, actor, mMsg_ITEM_STR2);
|
||||
}
|
||||
|
||||
static int mChoice_Put_String_ITEM3(u8* data, int idx, int max_size, ACTOR* actor) {
|
||||
return mChoice_Put_String_ITEM(data, idx, max_size, actor, mMsg_ITEM_STR3);
|
||||
}
|
||||
|
||||
static int mChoice_Put_String_ITEM4(u8* data, int idx, int max_size, ACTOR* actor) {
|
||||
return mChoice_Put_String_ITEM(data, idx, max_size, actor, mMsg_ITEM_STR4);
|
||||
}
|
||||
|
||||
static int mChoice_Put_String_ISLAND_NAME(u8* data, int idx, int max_size, ACTOR* actor) {
|
||||
return mMsg_CopyIslandName(data, idx, max_size, FALSE);
|
||||
}
|
||||
|
||||
static int mChoice_Put_String_AMPM(u8* data, int idx, int max_size, ACTOR* actor) {
|
||||
return mMsg_CopyAmPm(mMsg_Get_base_window_p(), data, idx, max_size);
|
||||
}
|
||||
|
||||
typedef int (*mChoice_PUT_STRING_PROC)(u8*, int, int, ACTOR*);
|
||||
|
||||
static int mChoice_Put_String(u8* data, int idx, int max_size, ACTOR* actor) {
|
||||
static const mChoice_PUT_STRING_PROC proc[mFont_CONT_CODE_NUM] = {
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
&mChoice_Put_String_PLAYER_NAME,
|
||||
&mChoice_Put_String_TALK_NAME,
|
||||
&mChoice_Put_String_TAIL,
|
||||
&mChoice_Put_String_YEAR,
|
||||
&mChoice_Put_String_MONTH,
|
||||
&mChoice_Put_String_WEEK,
|
||||
&mChoice_Put_String_DAY,
|
||||
&mChoice_Put_String_HOUR,
|
||||
&mChoice_Put_String_MIN,
|
||||
&mChoice_Put_String_SEC,
|
||||
&mChoice_Put_String_FREE0,
|
||||
&mChoice_Put_String_FREE1,
|
||||
&mChoice_Put_String_FREE2,
|
||||
&mChoice_Put_String_FREE3,
|
||||
&mChoice_Put_String_FREE4,
|
||||
&mChoice_Put_String_FREE5,
|
||||
&mChoice_Put_String_FREE6,
|
||||
&mChoice_Put_String_FREE7,
|
||||
&mChoice_Put_String_FREE8,
|
||||
&mChoice_Put_String_FREE9,
|
||||
&mChoice_Put_String_DETERMINATION,
|
||||
&mChoice_Put_String_COUNTRY_NAME,
|
||||
&mChoice_Put_String_RAMDOM_NUMBER2,
|
||||
&mChoice_Put_String_ITEM0,
|
||||
&mChoice_Put_String_ITEM1,
|
||||
&mChoice_Put_String_ITEM2,
|
||||
&mChoice_Put_String_ITEM3,
|
||||
&mChoice_Put_String_ITEM4,
|
||||
&mChoice_Put_String_FREE10,
|
||||
&mChoice_Put_String_FREE11,
|
||||
&mChoice_Put_String_FREE12,
|
||||
&mChoice_Put_String_FREE13,
|
||||
&mChoice_Put_String_FREE14,
|
||||
&mChoice_Put_String_FREE15,
|
||||
&mChoice_Put_String_FREE16,
|
||||
&mChoice_Put_String_FREE17,
|
||||
&mChoice_Put_String_FREE18,
|
||||
&mChoice_Put_String_FREE19,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
&mChoice_Put_String_ISLAND_NAME,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
&mChoice_Put_String_AMPM,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL
|
||||
};
|
||||
|
||||
int type = data[idx + 1];
|
||||
|
||||
if (type >= 0 && type < mFont_CONT_CODE_NUM && proc[type] != NULL) {
|
||||
return (*proc[type])(data, idx, max_size, actor);
|
||||
}
|
||||
|
||||
return max_size;
|
||||
}
|
||||
|
||||
static void mChoice_Change_ControlCode(u8* data, int max_size, ACTOR* actor) {
|
||||
u8* src_p = data;
|
||||
int new_max_size = max_size;
|
||||
int idx = 0;
|
||||
u8 code;
|
||||
|
||||
while (idx < new_max_size) {
|
||||
code = *src_p;
|
||||
|
||||
if (code == CHAR_CONTROL_CODE) {
|
||||
new_max_size = mChoice_Put_String(data, idx, new_max_size, actor);
|
||||
}
|
||||
else {
|
||||
idx++;
|
||||
src_p++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
extern void mChoice_Load_ChoseStringFromRom(mChoice_c* choice, u8* str, int str_no, ACTOR* actor) {
|
||||
if (str_no >= 0 && str_no < mChoice_SELECT_STR_NUM) {
|
||||
u32 addr;
|
||||
u32 size;
|
||||
|
||||
mChoice_Get_StringDataAddressAndSize(str_no, &addr, &size);
|
||||
|
||||
if (size == 0) {
|
||||
mem_clear(str, mChoice_CHOICE_STRING_LEN, CHAR_SPACE);
|
||||
}
|
||||
else if (addr != 0) {
|
||||
static u8 buff[80] ATTRIBUTE_ALIGN(32);
|
||||
u32 align_addr = ALIGN_PREV(addr, 32);
|
||||
u32 ofs = addr - align_addr;
|
||||
u32 align_size = ALIGN_NEXT(ofs + size, 32);
|
||||
int max;
|
||||
int i;
|
||||
u8* src_p;
|
||||
u8* dst_p;
|
||||
|
||||
_JW_GetResourceAram(align_addr, buff, align_size);
|
||||
|
||||
max = mChoice_CHOICE_STRING_LEN;
|
||||
if (size < mChoice_CHOICE_STRING_LEN) {
|
||||
max = size;
|
||||
}
|
||||
|
||||
src_p = &buff[ofs];
|
||||
dst_p = str;
|
||||
|
||||
/* Copy string from the temp aligned buffer to the destination */
|
||||
for (i = 0; i < max; i++) {
|
||||
*dst_p++ = *src_p++;
|
||||
}
|
||||
|
||||
/* Fill remaining space with space characters */
|
||||
for (i; i < mChoice_CHOICE_STRING_LEN; i++) {
|
||||
*dst_p++ = CHAR_SPACE;
|
||||
}
|
||||
|
||||
/* Process any control codes */
|
||||
mChoice_Change_ControlCode(str, mChoice_CHOICE_STRING_LEN, actor);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
extern void mChoice_no_b_set(mChoice_c* choice) {
|
||||
choice->no_b_flag = TRUE;
|
||||
}
|
||||
|
||||
extern void mChoice_no_b_close_set(mChoice_c* choice) {
|
||||
choice->no_b_flag = TRUE;
|
||||
choice->no_close_flag = TRUE;
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
static int mChoice_Main_Appear_SetScale(mChoice_c* choice, GAME* game) {
|
||||
int res;
|
||||
const f32 max = 10.2f;
|
||||
|
||||
if (choice->timer < max) {
|
||||
f32 scale;
|
||||
|
||||
choice->timer += 1.0f;
|
||||
scale = get_percent_forAccelBrake(choice->timer, 0.0f, max, 0.0f, 0.0f);
|
||||
choice->scale = scale;
|
||||
choice->center_x = choice->center_x_begin + scale * (choice->center_x_target - choice->center_x_begin);
|
||||
choice->center_y = choice->center_y_begin + scale * (choice->center_y_target - choice->center_y_begin);
|
||||
res = FALSE;
|
||||
}
|
||||
else {
|
||||
choice->timer = 0.0f;
|
||||
choice->scale = 1.0f;
|
||||
choice->center_x = choice->center_x_target;
|
||||
choice->center_y = choice->center_y_target;
|
||||
res = TRUE;
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
static void mChoice_request_main_index_fromAppear(mChoice_c* choice, GAME* game, int open_flag) {
|
||||
if (open_flag) {
|
||||
mChoice_Change_request_main_index(choice, mChoice_MAIN_NORMAL);
|
||||
}
|
||||
}
|
||||
|
||||
static void mChoice_Main_Appear(mChoice_c* choice, GAME* game) {
|
||||
int open_flag = mChoice_Main_Appear_SetScale(choice, game);
|
||||
|
||||
mChoice_request_main_index_fromAppear(choice, game, open_flag);
|
||||
mChoice_MainSetup(choice, game);
|
||||
}
|
||||
|
||||
static void mChoice_MainSetup_Appear(mChoice_c* choice, GAME* game) {
|
||||
choice->scale = 0.0f;
|
||||
choice->main_index = mChoice_MAIN_APPEAR;
|
||||
choice->requested_main_index = -1;
|
||||
choice->window_visible_flag = TRUE;
|
||||
choice->timer = 0.0f;
|
||||
mChoice_Clear_ChoseNum(choice);
|
||||
mChoice_sound_SENTAKU_OPEN();
|
||||
mChoice_Set_DisplayScaleAndDisplayPos(choice);
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
static int mChoice_Main_Disappear_SetScale(mChoice_c* choice, GAME* game) {
|
||||
const f32 max = 10.2f;
|
||||
|
||||
if (choice->timer < max) {
|
||||
f32 scale;
|
||||
|
||||
choice->timer += 1.0f;
|
||||
scale = 1.0f - get_percent_forAccelBrake(choice->timer, 0.0f, max, 0.0f, 0.0f);
|
||||
choice->scale = scale;
|
||||
choice->center_x = choice->center_x_begin + scale * (choice->center_x_target - choice->center_x_begin);
|
||||
choice->center_y = choice->center_y_begin + scale * (choice->center_y_target - choice->center_y_begin);
|
||||
return FALSE;
|
||||
}
|
||||
else {
|
||||
choice->timer = 0.0f;
|
||||
choice->scale = 0.0f;
|
||||
choice->center_x = choice->center_x_begin;
|
||||
choice->center_y = choice->center_y_begin;
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
static void mChoice_request_main_index_fromDisappear(mChoice_c* choice, GAME* game, int closed_flag) {
|
||||
if (closed_flag) {
|
||||
mChoice_Change_request_main_index(choice, mChoice_MAIN_HIDE);
|
||||
}
|
||||
}
|
||||
|
||||
static void mChoice_Main_Disappear(mChoice_c* choice, GAME* game) {
|
||||
int closed_flag = mChoice_Main_Disappear_SetScale(choice, game);
|
||||
|
||||
mChoice_request_main_index_fromDisappear(choice, game, closed_flag);
|
||||
mChoice_MainSetup(choice, game);
|
||||
}
|
||||
|
||||
static void mChoice_MainSetup_Disappear(mChoice_c* choice, GAME* game) {
|
||||
if (choice->no_b_flag && choice->selected_choice_idx == (choice->data.choice_num - 1)) {
|
||||
if (choice->no_close_flag) {
|
||||
mChoice_sound_ZOOMDOWN_LONG();
|
||||
mMsg_Get_base_window_p()->status_flags |= mMsg_STATUS_FLAG_ZOOMDOWN_LONG;
|
||||
}
|
||||
else {
|
||||
mChoice_sound_ZOOMDOWN_SHORT();
|
||||
}
|
||||
}
|
||||
else {
|
||||
mChoice_sound_SENTAKU_KETTEI();
|
||||
}
|
||||
|
||||
choice->scale = 1.0f;
|
||||
choice->main_index = mChoice_MAIN_DISAPPEAR;
|
||||
choice->requested_main_index = -1;
|
||||
choice->window_visible_flag = TRUE;
|
||||
choice->timer = 0.0f;
|
||||
choice->font_visible_flag = FALSE;
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
static void mChoice_Main_Hide(mChoice_c* choice, GAME* game) {
|
||||
mChoice_MainSetup(choice, game);
|
||||
}
|
||||
|
||||
static void mChoice_MainSetup_Hide(mChoice_c* choice, GAME* game) {
|
||||
mChoice_init(choice, game);
|
||||
}
|
||||
@@ -0,0 +1,162 @@
|
||||
static void mChoice_determimation_set(mChoice_c* choice) {
|
||||
mChoice_Data_c* choice_data = &choice->data;
|
||||
int idx = choice->selected_choice_idx;
|
||||
|
||||
bcopy(choice_data->strings[idx], choice_data->determination_string, mChoice_CHOICE_STRING_LEN);
|
||||
choice_data->determination_len = choice_data->string_lens[idx];
|
||||
choice_data->selected_choice_idx = idx;
|
||||
}
|
||||
|
||||
static int mChoice_Main_Normal_SetChoice(mChoice_c* choice, GAME* game) {
|
||||
int res = FALSE;
|
||||
|
||||
if (chkTrigger(BUTTON_A)) {
|
||||
mChoice_determimation_set(choice);
|
||||
res = TRUE;
|
||||
}
|
||||
else if (choice->no_b_flag && chkTrigger(BUTTON_B)) {
|
||||
choice->selected_choice_idx = choice->data.choice_num - 1;
|
||||
mChoice_determimation_set(choice);
|
||||
res = TRUE;
|
||||
}
|
||||
else {
|
||||
f32 percent = gamePT->mcon.adjusted_pY;
|
||||
int* choice_automove_p = &choice->choice_automove_type;
|
||||
f32* choice_automove_timer_p = &choice->choice_automove_timer;
|
||||
int* selected_idx_p = &choice->selected_choice_idx;
|
||||
int cursor_sfx = FALSE;
|
||||
|
||||
switch (*choice_automove_p) {
|
||||
case mChoice_AUTOMOVE_INCREMENT_WAIT:
|
||||
{
|
||||
if (percent < 0.0f || chkButton(BUTTON_CDOWN)) {
|
||||
(*choice_automove_timer_p) += 1.0f;
|
||||
|
||||
if (*choice_automove_timer_p >= 18.0f) {
|
||||
*choice_automove_timer_p = 0.0f;
|
||||
*choice_automove_p = mChoice_AUTOMOVE_INCREMENT;
|
||||
(*selected_idx_p)++;
|
||||
cursor_sfx = TRUE;
|
||||
}
|
||||
}
|
||||
else {
|
||||
*choice_automove_p = mChoice_AUTOMOVE_STOPPED;
|
||||
*choice_automove_timer_p = 0.0f;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case mChoice_AUTOMOVE_INCREMENT:
|
||||
{
|
||||
if (percent < 0.0f || chkButton(BUTTON_CDOWN)) {
|
||||
(*choice_automove_timer_p) += 1.0f;
|
||||
|
||||
if (*choice_automove_timer_p >= 9.0f) {
|
||||
*choice_automove_timer_p = 0.0f;
|
||||
(*selected_idx_p)++;
|
||||
cursor_sfx = TRUE;
|
||||
}
|
||||
}
|
||||
else {
|
||||
*choice_automove_p = mChoice_AUTOMOVE_STOPPED;
|
||||
*choice_automove_timer_p = 0.0f;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case mChoice_AUTOMOVE_DECREMENT_WAIT:
|
||||
{
|
||||
if (percent > 0.0f || chkButton(BUTTON_CUP)) {
|
||||
(*choice_automove_timer_p) += 1.0f;
|
||||
|
||||
if (*choice_automove_timer_p >= 18.0f) {
|
||||
*choice_automove_timer_p = 0.0f;
|
||||
*choice_automove_p = mChoice_AUTOMOVE_DECREMENT;
|
||||
(*selected_idx_p)--;
|
||||
cursor_sfx = TRUE;
|
||||
}
|
||||
}
|
||||
else {
|
||||
*choice_automove_p = mChoice_AUTOMOVE_STOPPED;
|
||||
*choice_automove_timer_p = 0.0f;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case mChoice_AUTOMOVE_DECREMENT:
|
||||
{
|
||||
if (percent > 0.0f || chkButton(BUTTON_CUP)) {
|
||||
(*choice_automove_timer_p) += 1.0f;
|
||||
|
||||
if (*choice_automove_timer_p >= 9.0f) {
|
||||
*choice_automove_timer_p = 0.0f;
|
||||
(*selected_idx_p)--;
|
||||
cursor_sfx = TRUE;
|
||||
}
|
||||
}
|
||||
else {
|
||||
*choice_automove_p = mChoice_AUTOMOVE_STOPPED;
|
||||
*choice_automove_timer_p = 0.0f;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
{
|
||||
if (percent > 0.0f || chkTrigger(BUTTON_CUP)) {
|
||||
*choice_automove_p = mChoice_AUTOMOVE_DECREMENT_WAIT;
|
||||
*choice_automove_timer_p = 0.0f;
|
||||
(*selected_idx_p)--;
|
||||
cursor_sfx = TRUE;
|
||||
}
|
||||
else if (percent < 0.0f || chkTrigger(BUTTON_CDOWN)) {
|
||||
*choice_automove_p = mChoice_AUTOMOVE_INCREMENT_WAIT;
|
||||
*choice_automove_timer_p = 0.0f;
|
||||
(*selected_idx_p)++;
|
||||
cursor_sfx = TRUE;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ((*selected_idx_p) < 0) {
|
||||
*selected_idx_p = 0;
|
||||
}
|
||||
else if ((*selected_idx_p) >= choice->data.choice_num) {
|
||||
*selected_idx_p = choice->data.choice_num - 1;
|
||||
}
|
||||
else {
|
||||
if (cursor_sfx) {
|
||||
mChoice_sound_CURSOL();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
static void mChoice_request_main_index_fromNormal(mChoice_c* choice, GAME* game, int close_flag) {
|
||||
if (close_flag) {
|
||||
mChoice_Change_request_main_index(choice, mChoice_MAIN_DISAPPEAR);
|
||||
}
|
||||
}
|
||||
|
||||
static void mChoice_Main_Normal(mChoice_c* choice, GAME* game) {
|
||||
int close_flag = mChoice_Main_Normal_SetChoice(choice, game);
|
||||
|
||||
mChoice_request_main_index_fromNormal(choice, game, close_flag);
|
||||
mChoice_MainSetup(choice, game);
|
||||
}
|
||||
|
||||
static void mChoice_MainSetup_Normal(mChoice_c* choice, GAME* game) {
|
||||
choice->scale = 1.0f;
|
||||
choice->timer = 0.0f;
|
||||
choice->requested_main_index = -1;
|
||||
choice->main_index = mChoice_MAIN_NORMAL;
|
||||
choice->font_visible_flag = TRUE;
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
static void mChoice_sound_SENTAKU_KETTEI() {
|
||||
sAdo_SysTrgStart(0xD);
|
||||
}
|
||||
|
||||
static void mChoice_sound_SENTAKU_OPEN() {
|
||||
sAdo_SysTrgStart(0xC);
|
||||
}
|
||||
|
||||
static void mChoice_sound_CURSOL() {
|
||||
sAdo_SysTrgStart(0x1);
|
||||
}
|
||||
|
||||
static void mChoice_sound_ZOOMDOWN_SHORT() {
|
||||
sAdo_SysTrgStart(0x8005);
|
||||
}
|
||||
|
||||
static void mChoice_sound_ZOOMDOWN_LONG() {
|
||||
sAdo_SysTrgStart(0x8015);
|
||||
}
|
||||
Reference in New Issue
Block a user