mirror of
https://github.com/ACreTeam/ac-decomp
synced 2026-05-23 06:34:18 -04:00
Implement & match m_msg_cursol.c_inc
This commit is contained in:
@@ -15,6 +15,17 @@ typedef struct audio_tempo_beat_s {
|
||||
/* 0x01 */ s8 beat;
|
||||
} TempoBeat_c;
|
||||
|
||||
enum {
|
||||
VOICE_STATUS_NORMAL,
|
||||
VOICE_STATUS_ANGRY,
|
||||
VOICE_STATUS_SAD,
|
||||
VOICE_STATUS_FUN,
|
||||
VOICE_STATUS_SLEEPY,
|
||||
VOICE_STATUS_GLOOMY,
|
||||
|
||||
VOICE_STATUS_NUM
|
||||
};
|
||||
|
||||
extern void sAdo_Calc_MicPosition_forTrig(f32* fcalc, u16* scalc, xyz_t* pos);
|
||||
extern void sAdo_Calc_MicPosition_forLevel(f32* fcalc, u16* scalc, xyz_t* pos);
|
||||
|
||||
|
||||
+18
-8
@@ -18,6 +18,8 @@ extern "C" {
|
||||
#define mMsg_MAIL_STRING_LEN 132
|
||||
#define mMsg_MAX_LINE 4
|
||||
|
||||
#define mMsg_BUTTON_TURN_TIME 60.0f
|
||||
|
||||
enum {
|
||||
mMsg_INDEX_HIDE,
|
||||
mMsg_INDEX_APPEAR,
|
||||
@@ -72,23 +74,31 @@ enum {
|
||||
mMsg_MAIL_STR_NUM
|
||||
};
|
||||
|
||||
#define mMsg_STATUS_SOUND_CUT (1 << 0) // 0x000001
|
||||
#define mMsg_STATUS_FLAG_1 (1 << 1) // 0x000002
|
||||
enum {
|
||||
mMsg_RESULT_VOID,
|
||||
mMsg_RESULT_FALSE,
|
||||
mMsg_RESULT_TRUE,
|
||||
|
||||
mMsg_RESULT_NUM
|
||||
};
|
||||
|
||||
#define mMsg_STATUS_FLAG_SOUND_CUT (1 << 0) // 0x000001
|
||||
#define mMsg_STATUS_FLAG_NO_SE_PAGE_OKURI (1 << 1) // 0x000002
|
||||
#define mMsg_STATUS_FLAG_2 (1 << 2) // 0x000004
|
||||
#define mMsg_STATUS_FLAG_3 (1 << 3) // 0x000008
|
||||
#define mMsg_STATUS_FLAG_LAST_DELAY (1 << 3) // 0x000008
|
||||
#define mMsg_STATUS_FLAG_SPEC_VOICE (1 << 4) // 0x000010
|
||||
#define mMsg_STATUS_FLAG_VOICE_ENTRY (1 << 5) // 0x000020
|
||||
#define mMsg_STATUS_FLAG_IDLING_REQ (1 << 6) // 0x000040
|
||||
#define mMsg_STATUS_FLAG_IDLING_NOW (1 << 7) // 0x000080
|
||||
#define mMsg_STATUS_FLAG_8 (1 << 8) // 0x000100
|
||||
#define mMsg_STATUS_FLAG_9 (1 << 9) // 0x000200
|
||||
#define mMsg_STATUS_FLAG_10 (1 << 10) // 0x000400
|
||||
#define mMsg_STATUS_FLAG_FAST_TEXT (1 << 8) // 0x000100
|
||||
#define mMsg_STATUS_FLAG_NOT_PAUSE_FRAME (1 << 9) // 0x000200
|
||||
#define mMsg_STATUS_FLAG_UTTER (1 << 10) // 0x000400
|
||||
#define mMsg_STATUS_FLAG_NO_ZOOMDOWN (1 << 11) /* When set, mMsg_sound_ZOOMDOWN_[SHORT, LONG]() sfx will not play */
|
||||
#define mMsg_STATUS_FLAG_VOICE_CLICK (1 << 12) // 0x001000
|
||||
#define mMsg_STATUS_FLAG_VOICE_SILENT (1 << 13) // 0x002000
|
||||
#define mMsg_STATUS_FLAG_CURSOL_JUST (1 << 14) /* Sets cursor justification */
|
||||
#define mMsg_STATUS_FLAG_15 (1 << 15) // 0x008000
|
||||
#define mMsg_STATUS_FLAG_16 (1 << 16) // 0x010000
|
||||
#define mMsg_STATUS_FLAG_CUT_ARTICLE (1 << 15) // 0x008000
|
||||
#define mMsg_STATUS_FLAG_CAPITALIZE (1 << 16) // 0x010000
|
||||
#define mMsg_STATUS_FLAG_USE_AM (1 << 17) /* 'AM' when set, 'PM' when not set */
|
||||
#define mMsg_STATUS_FLAG_18 (1 << 18) // 0x040000
|
||||
|
||||
|
||||
+14
-1
@@ -5,6 +5,7 @@
|
||||
#include "m_common_data.h"
|
||||
#include "jsyswrap.h"
|
||||
#include "m_bgm.h"
|
||||
#include "libforest/emu64/emu64_wrapper.h"
|
||||
|
||||
static u32 Msg_table_rom_start;
|
||||
static u32 Msg_rom_start;
|
||||
@@ -12,6 +13,18 @@ static u32 Msg_rom_start;
|
||||
static mMsg_Data_c mMsg_data;
|
||||
static mMsg_Window_c mMsg_window;
|
||||
|
||||
typedef int (*mMsg_CONTROL_CODE_PROC)(mMsg_Window_c*, int*);
|
||||
|
||||
static void mMsg_MainSetup_Window(mMsg_Window_c* msg_p, GAME* game);
|
||||
|
||||
#include "m_msg_ctrl.c_inc"
|
||||
|
||||
static void mMsg_sound_MessageSpeedForce(f32 timer);
|
||||
static void mMsg_sound_MessageStatus(u8 status);
|
||||
|
||||
#include "m_msg_main.c_inc"
|
||||
#include "m_msg_sound.c_inc"
|
||||
#include "m_msg_sound.c_inc"
|
||||
#include "m_msg_hide.c_inc"
|
||||
#include "m_msg_appear.c_inc"
|
||||
#include "m_msg_normal.c_inc"
|
||||
#include "m_msg_cursol.c_inc"
|
||||
|
||||
@@ -0,0 +1,93 @@
|
||||
static int mMsg_Main_Appear_SetScale(mMsg_Window_c* msg_p, GAME* game) {
|
||||
const f32 max = 18.0f;
|
||||
|
||||
if (msg_p->timer < max) {
|
||||
f32 scale;
|
||||
|
||||
msg_p->timer += 1.0f;
|
||||
scale = get_percent_forAccelBrake(msg_p->timer, 0.0f, max, 0.0f, 0.0f);
|
||||
msg_p->window_scale = scale;
|
||||
msg_p->text_scale = scale;
|
||||
return FALSE;
|
||||
}
|
||||
else {
|
||||
msg_p->window_scale = 1.0f;
|
||||
msg_p->text_scale = 1.0f;
|
||||
msg_p->timer = 0.0f;
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
static void mMsg_request_main_index_fromAppear(mMsg_Window_c* msg_p, GAME* game, int scale_done_flag) {
|
||||
if (scale_done_flag && mMsg_request_main_cursol(msg_p, FALSE, 5)) {
|
||||
mMsg_SetTimer(msg_p, 20.0f);
|
||||
}
|
||||
}
|
||||
|
||||
static void mMsg_Main_Appear(mMsg_Window_c* msg_p, GAME* game) {
|
||||
int scaling_done_flag = mMsg_Main_Appear_SetScale(msg_p, game);
|
||||
mMsg_request_main_index_fromAppear(msg_p, game, scaling_done_flag);
|
||||
mMsg_MainSetup_Window(msg_p, game);
|
||||
}
|
||||
|
||||
static void mMsg_MainSetup_Appear(mMsg_Window_c* msg_p, GAME* game) {
|
||||
mMsg_Request_MainAppear_Data_c* appear_data = &msg_p->request_data.request_main_appear;
|
||||
int msg_no = appear_data->msg_no;
|
||||
|
||||
if (mMsg_LoadMsgData(msg_p->msg_data, msg_no, FALSE)) {
|
||||
ACTOR* actor = appear_data->speaker_actor;
|
||||
int show_name = appear_data->name_shown_flag;
|
||||
|
||||
mMsg_Set_client_actor_p(msg_p, actor, show_name);
|
||||
msg_p->window_background_color = appear_data->window_color;
|
||||
mMsg_sound_spec_change_voice(msg_p);
|
||||
mMsg_sound_voice_mode(msg_p);
|
||||
msg_p->main_index = mMsg_INDEX_APPEAR;
|
||||
msg_p->draw_flag = TRUE;
|
||||
msg_p->window_scale = 0.0f;
|
||||
msg_p->text_scale = 0.0f;
|
||||
msg_p->timer = 0.0f;
|
||||
msg_p->show_continue_button = FALSE;
|
||||
msg_p->requested_main_index = -1;
|
||||
msg_p->requested_priority = 4;
|
||||
msg_p->start_text_cursor_idx = 0;
|
||||
msg_p->end_text_cursor_idx = 0;
|
||||
|
||||
if (msg_p->client_actor_p != NULL) {
|
||||
switch (mNpc_GetNpcSex(msg_p->client_actor_p)) {
|
||||
case mPr_SEX_MALE:
|
||||
msg_p->name_background_color.r = 70;
|
||||
msg_p->name_background_color.g = 245;
|
||||
msg_p->name_background_color.b = 255;
|
||||
msg_p->name_text_color.r = 0;
|
||||
msg_p->name_text_color.g = 0;
|
||||
msg_p->name_text_color.b = 15;
|
||||
break;
|
||||
|
||||
case mPr_SEX_FEMALE:
|
||||
msg_p->name_background_color.r = 235;
|
||||
msg_p->name_background_color.g = 140;
|
||||
msg_p->name_background_color.b = 210;
|
||||
msg_p->name_text_color.r = 45;
|
||||
msg_p->name_text_color.g = 0;
|
||||
msg_p->name_text_color.b = 30;
|
||||
break;
|
||||
|
||||
default:
|
||||
msg_p->name_background_color.r = 185;
|
||||
msg_p->name_background_color.g = 255;
|
||||
msg_p->name_background_color.b = 0;
|
||||
msg_p->name_text_color.r = 0;
|
||||
msg_p->name_text_color.g = 30;
|
||||
msg_p->name_text_color.b = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
msg_p->data_loaded = TRUE;
|
||||
emu64_refresh();
|
||||
}
|
||||
else {
|
||||
msg_p->data_loaded = FALSE;
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,8 @@
|
||||
static void mMsg_Main_Hide(mMsg_Window_c* msg_p, GAME* game) {
|
||||
mMsg_MainSetup_Window(msg_p, game);
|
||||
}
|
||||
|
||||
static void mMsg_MainSetup_Hide(mMsg_Window_c* msg_p, GAME* game) {
|
||||
mMsg_init(game);
|
||||
emu64_refresh();
|
||||
}
|
||||
@@ -464,10 +464,10 @@ static void mMsg_init(GAME* game) {
|
||||
mMsg_sound_MessageSpeedForce(0.0f);
|
||||
mMsg_sound_MessageStatus(0);
|
||||
mMsg_window.status_flags &= ~(
|
||||
mMsg_STATUS_SOUND_CUT |
|
||||
mMsg_STATUS_FLAG_SOUND_CUT |
|
||||
mMsg_STATUS_FLAG_IDLING_REQ |
|
||||
mMsg_STATUS_FLAG_IDLING_NOW |
|
||||
mMsg_STATUS_FLAG_9 |
|
||||
mMsg_STATUS_FLAG_NOT_PAUSE_FRAME |
|
||||
mMsg_STATUS_FLAG_NO_ZOOMDOWN |
|
||||
mMsg_STATUS_FLAG_VOICE_CLICK |
|
||||
mMsg_STATUS_FLAG_VOICE_SILENT |
|
||||
|
||||
@@ -0,0 +1,132 @@
|
||||
static int mMsg_Check_ScrollOrder(mMsg_Window_c* msg_p) {
|
||||
return (chkTrigger(BUTTON_A) || chkTrigger(BUTTON_B));
|
||||
}
|
||||
|
||||
static int mMsg_MsgTimeEnd_dec(mMsg_Window_c* msg_p) {
|
||||
if (msg_p->end_timer == 0) {
|
||||
return FALSE;
|
||||
}
|
||||
else if (msg_p->end_timer == 1) {
|
||||
return TRUE;
|
||||
}
|
||||
else {
|
||||
msg_p->end_timer--;
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
static int mMsg_end_to_disappear(mMsg_Window_c* msg_p) {
|
||||
if (mMsg_Change_request_main_index(msg_p, mMsg_INDEX_DISAPPEAR, 5)) {
|
||||
mMsg_Clear_CursolIndex(msg_p);
|
||||
mMsg_Unset_ForceNext(msg_p);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void mMsg_request_main_index_fromNormal(mMsg_Window_c* msg_p, GAME* game) {
|
||||
if (mMsg_MsgTimeEnd_dec(msg_p) && mMsg_Check_NextIndex_MsgTimeEndCode(msg_p)) {
|
||||
mMsg_end_to_disappear(msg_p);
|
||||
}
|
||||
else if ((mMsg_Check_ScrollOrder(msg_p) || msg_p->force_next) && msg_p->lock_continue == FALSE) {
|
||||
int last = FALSE;
|
||||
|
||||
if (mMsg_Check_NextIndex_ContinueCode(msg_p) && msg_p->continue_cancel_flag == FALSE) {
|
||||
int continue_msg = msg_p->continue_msg_no;
|
||||
|
||||
if (continue_msg >= 0 && continue_msg < MSG_MAX && mMsg_ChangeMsgData(msg_p, continue_msg)) {
|
||||
if (mMsg_request_main_cursol(msg_p, FALSE, 5) && msg_p->force_next == FALSE && mMsg_Check_NextIndex_SetSelectWindowCode(msg_p) == FALSE) {
|
||||
if ((msg_p->status_flags & mMsg_STATUS_FLAG_NO_SE_PAGE_OKURI) == 0) {
|
||||
mMsg_sound_PAGE_OKURI();
|
||||
}
|
||||
}
|
||||
|
||||
mMsg_Unset_ForceNext(msg_p);
|
||||
mMsg_Set_continue_msg_num(msg_p, -1);
|
||||
}
|
||||
}
|
||||
else if (
|
||||
(mMsg_Check_NextIndex_ContinueCode(msg_p) && msg_p->continue_cancel_flag) ||
|
||||
(last = mMsg_Check_NextIndex_LastCode(msg_p)) || // hate this but it works
|
||||
mMsg_Check_NextIndex_MsgTimeEndCode(msg_p)
|
||||
) {
|
||||
if ((msg_p->status_flags & mMsg_STATUS_FLAG_IDLING_NOW) == 0) {
|
||||
if (last && (msg_p->status_flags & mMsg_STATUS_FLAG_IDLING_REQ)) {
|
||||
msg_p->status_flags |= mMsg_STATUS_FLAG_IDLING_NOW;
|
||||
}
|
||||
else {
|
||||
mMsg_end_to_disappear(msg_p);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (mMsg_request_main_cursol(msg_p, FALSE, 5)) {
|
||||
if (
|
||||
msg_p->force_next == FALSE &&
|
||||
mMsg_Check_NextIndex_SetSelectWindowCode(msg_p) == FALSE &&
|
||||
(msg_p->status_flags & mMsg_STATUS_FLAG_NO_SE_PAGE_OKURI) == 0
|
||||
) {
|
||||
mMsg_sound_PAGE_OKURI();
|
||||
}
|
||||
|
||||
mMsg_Unset_ForceNext(msg_p);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void mMsg_Set_display_button_turn_color(mMsg_Window_c* msg_p, GAME* game) {
|
||||
f32* timer = &msg_p->continue_button_timer;
|
||||
f32 target;
|
||||
|
||||
(*timer) += 1.0f;
|
||||
if (*timer >= mMsg_BUTTON_TURN_TIME) {
|
||||
*timer = 0.0f;
|
||||
}
|
||||
|
||||
target = (*timer - mMsg_BUTTON_TURN_TIME * 0.5f) / (mMsg_BUTTON_TURN_TIME * 0.5f);
|
||||
target = target <= 0.0f ? 1.0f + target : 1.0f - target;
|
||||
|
||||
if (target < 0.0f) {
|
||||
target = 0.0f;
|
||||
}
|
||||
else if (target > 1.0f) {
|
||||
target = 1.0f;
|
||||
}
|
||||
|
||||
msg_p->continue_button_color.a = (int)(target * 255.0f);
|
||||
}
|
||||
|
||||
static void mMsg_Main_Normal(mMsg_Window_c* msg_p, GAME* game) {
|
||||
mMsg_Set_display_button_turn_color(msg_p, game);
|
||||
mMsg_request_main_index_fromNormal(msg_p, game);
|
||||
mMsg_MainSetup_Window(msg_p, game);
|
||||
|
||||
if (msg_p->main_index != mMsg_INDEX_NORMAL) {
|
||||
msg_p->status_flags &= ~mMsg_STATUS_FLAG_NO_SE_PAGE_OKURI;
|
||||
}
|
||||
}
|
||||
|
||||
static void mMsg_MainSetup_Normal(mMsg_Window_c* msg_p, GAME* game) {
|
||||
mMsg_Request_MainNormal_Data_c* normal_data = &msg_p->request_data.request_main_normal;
|
||||
int wait_flag = normal_data->wait_flag;
|
||||
|
||||
msg_p->main_index = mMsg_INDEX_NORMAL;
|
||||
msg_p->draw_flag = TRUE;
|
||||
msg_p->requested_main_index = -1;
|
||||
msg_p->requested_priority = 4;
|
||||
msg_p->status_flags &= ~mMsg_STATUS_FLAG_IDLING_NOW;
|
||||
|
||||
if (wait_flag != TRUE) {
|
||||
msg_p->continue_button_timer = 0.0f;
|
||||
msg_p->continue_button_color.a = 0;
|
||||
|
||||
if (msg_p->end_timer == 0) {
|
||||
msg_p->show_continue_button = TRUE;
|
||||
}
|
||||
else {
|
||||
msg_p->show_continue_button = FALSE;
|
||||
}
|
||||
|
||||
msg_p->cancel_flag = FALSE;
|
||||
}
|
||||
}
|
||||
@@ -132,7 +132,7 @@ static int mMsg_sound_CodeVoice(mMsg_Window_c* msg_p, int idx) {
|
||||
if (voice_id < 0) {
|
||||
return FALSE;
|
||||
}
|
||||
else if ((msg_p->status_flags & mMsg_STATUS_SOUND_CUT) != 0) {
|
||||
else if ((msg_p->status_flags & mMsg_STATUS_FLAG_SOUND_CUT) != 0) {
|
||||
int voice_mode = Save_Get(config).voice_mode;
|
||||
|
||||
if (voice_mode != Config_VOICE_MODE_SILENT) {
|
||||
|
||||
Reference in New Issue
Block a user