Implement & link all of m_msg

This commit is contained in:
Cuyler36
2024-01-16 00:28:59 -05:00
parent 130ff2e587
commit f081907fe0
14 changed files with 706 additions and 68 deletions
+15
View File
@@ -147,6 +147,21 @@ config/rel.yml:
con_sentaku2_v:
addrs: [0x80650880, 0x806508C0]
type: vtx
# m_msg
msg/con_kaiwa2_w1_tex:
addrs: [0x80657360, 0x80657B60]
msg/con_kaiwa2_w2_tex:
addrs: [0x80657B60, 0x80658B60]
msg/con_kaiwa2_w3_tex:
addrs: [0x80658B60, 0x80659B60]
msg/con_kaiwa2_v:
addrs: [0x80659B60, 0x80659CE0]
type: vtx
msg/con_namefuti_TXT:
addrs: [0x80659D60, 0x8065A160]
msg/con_kaiwaname_v:
addrs: [0x8065A160, 0x8065A1A0]
type: vtx
# ac_boat_demo
aBTD_island_prg:
addrs: [0x8065FD4C, 0x80674F90]
+5
View File
@@ -188,6 +188,11 @@ m_melody.c:
.text: [0x803BF210, 0x803BF464]
.data: [0x806571D8, 0x80657200]
.bss: [0x81297E68, 0x81297E80]
m_msg.c:
.text: [0x803BF464, 0x803C6228]
.rodata: [0x806426E8, 0x80642938]
.data: [0x80657200, 0x8065A280]
.bss: [0x81297E80, 0x81298A00]
m_museum.c:
.text: [0x803C6228, 0x803C74C0]
.rodata: [0x80642938, 0x80642950]
+65 -52
View File
@@ -84,7 +84,7 @@ enum {
#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_NO_ZOOMUP (1 << 2) // 0x000004
#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
@@ -264,60 +264,73 @@ struct message_window_s {
/* 0x460 */ mMsg_Request_Data_c request_data;
};
extern int mMsg_Get_Length_String(u8* buf, int buf_size);
extern mMsg_Window_c* mMsg_Get_base_window_p();
extern void mMsg_Set_free_str(mMsg_Window_c* msg, int free_str_no, u8* str, int str_size);
extern void mMsg_Set_free_str_art(mMsg_Window_c* msg, int free_str_no, u8* str, int str_size, int article_no);
extern void mMsg_Set_item_str_art(mMsg_Window_c* msg, int free_str_no, u8* str, int str_size, int article_no);
extern void mMsg_ct(GAME_PLAY*);
extern void mMsg_dt(GAME_PLAY*);
extern void mMsg_Main(GAME_PLAY*);
extern void mMsg_Draw(GAME_PLAY*);
extern void mMsg_debug_draw(gfxprint_t* gfxprint);
extern void mMsg_aram_init();
extern void mMsg_aram_init2();
extern int mMsg_Check_MainHide(mMsg_Window_c* msg);
extern void mMsg_Set_item_str(mMsg_Window_c* msg_win, int str_no, u8* item_str, int str_len);
extern void mMsg_Set_mail_str(mMsg_Window_c* msg_win, int str_no, u8* str, int str_len);
extern void mMsg_Set_continue_msg_num(mMsg_Window_c* msg_win, int continue_msg_num);
extern int mMsg_Check_MainNormalContinue(mMsg_Window_c* msg_win);
extern int mMsg_Check_main_wait(mMsg_Window_c* msg_win);
extern int mMsg_ChangeMsgData(mMsg_Window_c* msg_win, int msg_no);
extern void mMsg_Set_ForceNext(mMsg_Window_c* msg_win);
extern int mMsg_Check_not_series_main_wait(mMsg_Window_c* msg_win);
extern int mMsg_Check_MainDisappear(mMsg_Window_c* msg_win);
extern int mMsg_request_main_disappear_wait_type1(mMsg_Window_c* msg_win);
extern int mMsg_request_main_appear_wait_type1(mMsg_Window_c* msg_win);
extern void mMsg_Get_BodyParam(u32 table_rom_start, u32 data_rom_start, int entry_no, u32* data_addr, u32* data_size);
extern void mMsg_Set_LockContinue(mMsg_Window_c* msg_win);
extern void mMsg_Unset_LockContinue(mMsg_Window_c* msg_win);
extern int mMsg_Get_msg_num(mMsg_Window_c* msg_win);
extern int mMsg_Check_main_index(mMsg_Window_c* msg_win, int index);
extern int mMsg_request_main_appear(mMsg_Window_c* msg_win, ACTOR* other_actor, int display_name, rgba_t* window_color_p, int msg_no, int request_priority);
extern int mMsg_Check_main_hide(mMsg_Window_c* msg_win);
extern int mMsg_sound_voice_get_for_editor(int code);
extern int mMsg_sound_spec_change_voice(mMsg_Window_c* msg_win);
extern void mMsg_ct(GAME* game);
extern void mMsg_dt(GAME* game);
extern void mMsg_debug_draw(gfxprint_t* gfxprint);
extern void mMsg_Main(GAME* game);
extern void mMsg_Draw(GAME* game);
extern mMsg_Window_c* mMsg_Get_base_window_p();
extern int mMsg_Check_request_priority(mMsg_Window_c* msg_p, int request_priority);
extern int mMsg_Check_main_index(mMsg_Window_c* msg_p, int main_index);
extern int mMsg_Check_main_wait(mMsg_Window_c* msg_p);
extern int mMsg_Check_not_series_main_wait(mMsg_Window_c* msg_p);
extern int mMsg_Check_main_hide(mMsg_Window_c* msg_p);
extern int mMsg_request_main_forceoff();
extern int mMsg_CopyPlayerName(u8* data, int idx, int max_size, u32 capitalize);
extern int mMsg_CopyTalkName(ACTOR* actor, u8* data, int idx, int max_size, u32 capitalize);
extern int mMsg_CopyTail(ACTOR* actor, u8* data, int idx, int max_size, u32 capitalize);
extern int mMsg_CopyYear(u8* data, int idx, int max_size);
extern int mMsg_CopyMonth(u8* data, int idx, int max_size);
extern int mMsg_CopyWeek(u8* data, int idx, int max_size);
extern int mMsg_CopyDay(u8* data, int idx, int max_size);
extern int mMsg_CopyHour(u8* data, int idx, int max_size);
extern int mMsg_CopyMin(u8* data, int idx, int max_size);
extern int mMsg_CopySec(u8* data, int idx, int max_size);
extern int mMsg_CopyFree(mMsg_Window_c* msg_win, int free_idx, u8* data, int idx, int max_size, int article, u32 capitalize);
extern int mMsg_CopyDetermination(mMsg_Window_c* msg_win, u8* data, int idx, int max_size);
extern int mMsg_CopyCountryName(u8* data, int idx, int max_size, u32 capitalize);
extern int mMsg_CopyRamdomNumber2(u8* data, int idx, int max_size);
extern int mMsg_CopyItem(mMsg_Window_c* msg_win, int item_idx, u8* data, int idx, int max_size, int article, u32 capitalize);
extern int mMsg_CopyMail(mMsg_Window_c* msg_win, int mail_idx, u8* data, int idx, int max_size, u32 capitalize);
extern int mMsg_CopyIslandName(u8* data, int idx, int max_size, u32 capitalize);
extern int mMsg_CopyAmPm(mMsg_Window_c* msg_win, u8* data, int idx, int max_size);
extern void mMsg_sound_set_voice_silent(mMsg_Window_c* msg_win, int update_voice_mode);
extern void mMsg_sound_unset_voice_silent(mMsg_Window_c* msg_win, int update_voice_mode);
extern int mMsg_request_main_disappear(mMsg_Window_c* msg_p);
extern int mMsg_request_main_appear(mMsg_Window_c* msg_p, ACTOR* client_actor_p, int show_name, rgba_t* window_color, int msg_no, int request_priority);
extern int mMsg_request_main_disappear_wait_type1(mMsg_Window_c* msg_p);
extern int mMsg_request_main_disappear_wait_type2(mMsg_Window_c* msg_p);
extern int mMsg_request_main_appear_wait_type2(mMsg_Window_c* msg_p, int clear_flag);
extern int mMsg_request_main_appear_wait_type1(mMsg_Window_c* msg_p);
extern void mMsg_Set_free_str(mMsg_Window_c* msg_p, int free_str_no, u8* str, int str_len);
extern void mMsg_Set_free_str_cl(mMsg_Window_c* msg_p, int str_no, u8* str_p, int str_len, int cl_id);
extern void mMsg_Set_free_str_art(mMsg_Window_c* msg_p, int str_no, u8* str_p, int str_len, int article);
extern void mMsg_Set_free_str_cl_art(mMsg_Window_c* msg_p, int str_no, u8* str_p, int str_len, int cl_id, int article);
extern void mMsg_Set_item_str(mMsg_Window_c* msg_p, int item_str_no, u8* str, int str_len);
extern void mMsg_Set_item_str_art(mMsg_Window_c* msg_p, int item_str_no, u8* str, int str_len, int article);
/* @unused extern void mMsg_Get_free_str(mMsg_Window_c* msg_p, int free_str_no, u8* str?) */
/* @unused extern void mMsg_Get_item_str(mMsg_Window_c* msg_p, int item_str_no, u8* str?) */
extern void mMsg_Set_mail_str(mMsg_Window_c* msg_p, int mail_str_no, u8* str, int str_len);
extern void mMsg_Set_continue_msg_num(mMsg_Window_c* msg_p, int msg_no);
extern int mMsg_Get_msg_num(mMsg_Window_c* msg_p);
extern void mMsg_Get_BodyParam(u32 table_addr, u32 data_addr, int index, u32* addr, u32* size);
extern int mMsg_ChangeMsgData(mMsg_Window_c* msg_p, int index);
extern int mMsg_Check_NowUtter();
extern int mMsg_Get_Length_String(u8* str, int str_len);
extern int mMsg_Check_MainNormalContinue(mMsg_Window_c* msg_p);
extern int mMsg_Check_MainNormal(mMsg_Window_c* msg_p);
extern int mMsg_Check_MainHide(mMsg_Window_c* msg_p);
extern int mMsg_Check_MainDisappear(mMsg_Window_c* msg_p);
extern void mMsg_Set_CancelNormalContinue(mMsg_Window_c* msg_p);
extern void mMsg_Unset_CancelNormalContinue(mMsg_Window_c* msg_p);
extern void mMsg_Set_ForceNext(mMsg_Window_c* msg_p);
extern void mMsg_Unset_ForceNext(mMsg_Window_c* msg_p);
// extern int mMsg_Get_LockContinue(mMsg_Window_c* msg_p);
extern void mMsg_Set_LockContinue(mMsg_Window_c* msg_p);
extern void mMsg_Unset_LockContinue(mMsg_Window_c* msg_p);
extern void mMsg_Set_idling_req(mMsg_Window_c* msg_p);
extern int mMsg_Check_idling_now(mMsg_Window_c* msg_p);
extern int mMsg_MoveDataCut(u8* data, int dst_idx, int src_idx, int len, int space_flag);
extern int mMsg_CopyPlayerName(u8* data, int start_idx, int len, u32 capitalize);
extern int mMsg_CopyTalkName(ACTOR* actor_p, u8* data, int start_idx, int len, u32 capitalize);
extern int mMsg_CopyTail(ACTOR* actor_p, u8* data, int start_idx, int len, u32 capitalize);
extern int mMsg_CopyYear(u8* data, int start_idx, int len);
extern int mMsg_CopyMonth(u8* data, int start_idx, int len);
extern int mMsg_CopyWeek(u8* data, int start_idx, int len);
extern int mMsg_CopyDay(u8* data, int start_idx, int len);
extern int mMsg_CopyHour(u8* data, int start_idx, int len);
extern int mMsg_CopyMin(u8* data, int start_idx, int len);
extern int mMsg_CopySec(u8* data, int start_idx, int len);
extern int mMsg_CopyFree(mMsg_Window_c* msg_p, int str_no, u8* data, int start_idx, int len, int article, u32 capitalize);
extern int mMsg_CopyDetermination(mMsg_Window_c* msg_p, u8* data, int start_idx, int len);
extern int mMsg_CopyCountryName(u8 *data, int start_idx, int len, u32 capitalize);
extern int mMsg_CopyIslandName(u8* data, int start_idx, int len, u32 capitalize);
extern int mMsg_CopyAmPm(mMsg_Window_c* msg_p, u8* data, int start_idx, int len);
extern int mMsg_CopyRamdomNumber2(u8* data, int start_idx, int len);
extern int mMsg_CopyItem(mMsg_Window_c* msg_p, int str_no, u8* data, int start_idx, int len, int article, u32 capitalize);
extern int mMsg_CopyMail(mMsg_Window_c* msg_p, int str_no, u8* data, int start_idx, int len, u32 capitalize);
#ifdef __cplusplus
}
+1 -2
View File
@@ -287,8 +287,7 @@ int aNRTC_talk_init(ACTOR* actor, GAME* game) {
break;
}
rtc->npc_class.talk_info.talk_request_proc = mActor_NONE_PROC1;
mMsg_Get_base_window_p();
mMsg_Set_idling_req();
mMsg_Set_idling_req(mMsg_Get_base_window_p());
return 1;
}
+145 -9
View File
@@ -1,30 +1,166 @@
#include "m_msg.h"
#include "main.h"
#include "m_font.h"
#include "m_string.h"
#include "m_handbill.h"
#include "m_common_data.h"
#include "jsyswrap.h"
#include "m_bgm.h"
#include "libforest/emu64/emu64_wrapper.h"
#include "sys_matrix.h"
static u32 Msg_table_rom_start;
static u32 Msg_rom_start;
static u32 Msg_table_rom_start = 0;
static u32 Msg_rom_start = 0;
static mMsg_Data_c mMsg_data;
static mMsg_Window_c mMsg_window;
typedef int (*mMsg_CONTROL_CODE_PROC)(mMsg_Window_c*, int*);
typedef void (*mMsg_MAIN_PROC)(mMsg_Window_c*, GAME*);
/* HACK - assetrip only sees top-level C file includes */
#ifdef MUST_MATCH
#ifndef __INTELLISENSE__
/* Force assetrip to detect these assets. They're used in a .c_inc file. */
FORCESTRIP static u8 __unused_msg0[] = {
#include "assets/msg/con_kaiwa2_w1_tex.inc"
};
FORCESTRIP static u8 __unused_msg1[] = {
#include "assets/msg/con_kaiwa2_w2_tex.inc"
};
FORCESTRIP static u8 __unused_msg2[] = {
#include "assets/msg/con_kaiwa2_w3_tex.inc"
};
FORCESTRIP static Vtx __unused_msg3[] = {
#include "assets/msg/con_kaiwa2_v.inc"
};
FORCESTRIP static u8 __unused_msg4[] = {
#include "assets/msg/con_namefuti_TXT.inc"
};
FORCESTRIP static Vtx __unused_msg5[] = {
#include "assets/msg/con_kaiwaname_v.inc"
};
#endif
#endif
static void mMsg_MainSetup_Window(mMsg_Window_c* msg_p, GAME* game);
#include "m_msg_ctrl.c_inc"
#include "../src/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_hide.c_inc"
#include "m_msg_appear.c_inc"
#include "m_msg_normal.c_inc"
#include "m_msg_cursol.c_inc"
#include "../src/m_msg_main.c_inc"
#include "../src/m_msg_sound.c_inc"
#include "../src/m_msg_hide.c_inc"
#include "../src/m_msg_appear.c_inc"
#include "../src/m_msg_normal.c_inc"
#include "../src/m_msg_cursol.c_inc"
#include "../src/m_msg_disappear.c_inc"
#include "../src/m_msg_appear_wait.c_inc"
#include "../src/m_msg_wait.c_inc"
#include "../src/m_msg_disappear_wait.c_inc"
#include "../src/m_msg_data.c_inc"
#include "../src/m_msg_draw_window.c_inc"
#include "../src/m_msg_draw_font.c_inc"
static void mMsg_MainSetup_Window(mMsg_Window_c* msg_p, GAME* game) {
static mMsg_MAIN_PROC proc[mMsg_INDEX_NUM] = {
&mMsg_MainSetup_Hide,
&mMsg_MainSetup_Appear,
&mMsg_MainSetup_Normal,
&mMsg_MainSetup_Cursol,
&mMsg_MainSetup_Disappear,
&mMsg_MainSetup_Appear_Wait,
&mMsg_MainSetup_Wait,
&mMsg_MainSetup_Disappear_wait
};
int idx = msg_p->requested_main_index;
if (idx >= 0) {
if (idx >= mMsg_INDEX_NUM || proc[idx] == NULL) {
return;
}
(*proc[idx])(msg_p, game);
}
}
static void mMsg_Main_Window(mMsg_Window_c* msg_p, GAME* game) {
static mMsg_MAIN_PROC proc[mMsg_INDEX_NUM] = {
&mMsg_Main_Hide,
&mMsg_Main_Appear,
&mMsg_Main_Normal,
&mMsg_Main_Cursol,
&mMsg_Main_Disappear,
&mMsg_Main_Appear_wait,
&mMsg_Main_Wait,
&mMsg_Main_Disappear_wait
};
int idx = msg_p->main_index;
if (idx >= 0) {
if (idx >= mMsg_INDEX_NUM || proc[idx] == NULL) {
return;
}
(*proc[idx])(msg_p, game);
}
}
static void mMsg_Draw_Window(mMsg_Window_c* msg_p, GAME* game) {
if (msg_p->draw_flag && msg_p->data_loaded) {
mFont_SetMatrix(game->graph, mFont_MODE_FONT);
mMsg_SetMatrix(msg_p, game, mFont_MODE_FONT);
mMsg_DrawWindowBody(msg_p, game, mFont_MODE_FONT);
mMsg_UnSetMatrix();
mFont_UnSetMatrix(game->graph, mFont_MODE_FONT);
if (msg_p->msg_data->data_loaded) {
mMsg_draw_font(msg_p, game);
}
mChoice_Draw(&msg_p->choice_window, game, mFont_MODE_FONT);
}
}
extern void mMsg_aram_init() {
mChoice_aram_init();
mString_aram_init();
mHandbill_aram_init();
}
extern void mMsg_aram_init2() {
Msg_table_rom_start = JW_GetAramAddress(RESOURCE_MESSAGE_TABLE);
Msg_rom_start = JW_GetAramAddress(RESOURCE_MESSAGE);
}
extern void mMsg_ct(GAME* game) {
mMsg_init(game);
mChoice_ct(&mMsg_window.choice_window, game);
}
extern void mMsg_dt(GAME* game) {
mChoice_dt(&mMsg_window.choice_window, game);
}
extern void mMsg_debug_draw(gfxprint_t* gfxprint) {
if (mMsg_window.msg_data != NULL) {
gfxprint_color(gfxprint, 245, 255, 250, 255);
gfxprint_locate8x8(gfxprint, 3, 6);
gfxprint_printf(gfxprint, "%5d", mMsg_window.msg_data->msg_no);
}
}
extern void mMsg_Main(GAME* game) {
mMsg_Main_Window(&mMsg_window, game);
mChoice_Main(&mMsg_window.choice_window, game);
}
extern void mMsg_Draw(GAME* game) {
mMsg_Draw_Window(&mMsg_window, game);
}
+47
View File
@@ -0,0 +1,47 @@
static void mMsg_request_main_index_fromAppear_wait(mMsg_Window_c* msg_p, GAME* game, int scaling_done_flag) {
if (scaling_done_flag) {
mMsg_MainAppearWait_Data_c* main_data = &msg_p->main_data.main_appear_wait;
int saved_main_index = main_data->saved_main_index;
if (saved_main_index == mMsg_INDEX_CURSOL) {
mMsg_request_main_cursol(msg_p, TRUE, 5);
}
else {
mMsg_request_main_normal(msg_p, TRUE, 5);
}
}
}
static void mMsg_Main_Appear_wait(mMsg_Window_c* msg_p, GAME* game) {
int scaling_finished;
if ((msg_p->status_flags & mMsg_STATUS_FLAG_NO_ZOOMUP) == FALSE) {
msg_p->status_flags |= mMsg_STATUS_FLAG_NO_ZOOMUP;
mMsg_sound_ZOOMUP();
mMsg_sound_spec_change_voice(msg_p);
mMsg_sound_voice_mode(msg_p);
}
scaling_finished = mMsg_Main_Appear_SetScale(msg_p, game);
mMsg_request_main_index_fromAppear_wait(msg_p, game, scaling_finished);
mMsg_MainSetup_Window(msg_p, game);
}
static void mMsg_MainSetup_Appear_Wait(mMsg_Window_c* msg_p, GAME* game) {
mMsg_Request_MainAppearWait_Data_c* request_data = &msg_p->request_data.request_main_appear_wait;
mMsg_MainAppearWait_Data_c* main_data = &msg_p->main_data.main_appear_wait;
if ((request_data->setup_flag & 1)) {
mMsg_Clear_CursolIndex(msg_p);
}
main_data->saved_main_index = request_data->last_main_index;
msg_p->main_index = mMsg_INDEX_APPEAR_WAIT;
msg_p->draw_flag = TRUE;
msg_p->window_scale = 0.0f;
msg_p->text_scale = 0.0f;
msg_p->timer = 0.0f;
msg_p->status_flags &= ~(mMsg_STATUS_FLAG_NOT_PAUSE_FRAME | mMsg_STATUS_FLAG_NO_ZOOMUP);
msg_p->requested_main_index = -1;
msg_p->requested_priority = 4;
}
+1 -1
View File
@@ -957,7 +957,7 @@ static int mMsg_Main_Cursol_Proc_ControlCursol(mMsg_Window_c* msg_p, int* idx_p)
u8* data = msg_p->msg_data->text_buf.data;
if (data[*idx_p] == CHAR_CONTROL_CODE) {
static mMsg_CONTROL_CODE_PROC proc[mFont_CONT_CODE_NUM] = {
static const mMsg_CONTROL_CODE_PROC proc[mFont_CONT_CODE_NUM] = {
&mMsg_Main_Cursol_Last_ControlCursol,
&mMsg_Main_Cursol_Continue_ControlCursol,
&mMsg_Main_Cursol_Clear_ControlCursol,
+97
View File
@@ -0,0 +1,97 @@
static u8 con_kaiwa2_w1_tex[] ATTRIBUTE_ALIGN(32) = {
#include "assets/msg/con_kaiwa2_w1_tex.inc"
};
static u8 con_kaiwa2_w2_tex[] ATTRIBUTE_ALIGN(32) = {
#include "assets/msg/con_kaiwa2_w2_tex.inc"
};
static u8 con_kaiwa2_w3_tex[] ATTRIBUTE_ALIGN(32) = {
#include "assets/msg/con_kaiwa2_w3_tex.inc"
};
static Vtx con_kaiwa2_v[] = {
#include "assets/msg/con_kaiwa2_v.inc"
};
static Gfx con_kaiwa2_modelT[] = {
gsSPTexture(0, 0, 0, 0, G_ON),
gsDPLoadTextureBlock_4b_Dolphin(con_kaiwa2_w3_tex, G_IM_FMT_I, 128, 64, 15, GX_CLAMP, GX_CLAMP, 0, 0),
gsSPVertex(&con_kaiwa2_v[0], 24, 0),
gsSPNTrianglesInit_5b(
4, // tri count
0, 1, 2, // tri0
2, 3, 0, // tri1
4, 5, 6 // tri2
),
gsSPNTriangles_5b(
6, 7, 4, // tri0
0, 0, 0, // tri1
0, 0, 0, // tri2
0, 0, 0 // tri3
),
gsDPLoadTextureBlock_4b_Dolphin(con_kaiwa2_w2_tex, G_IM_FMT_I, 128, 64, 15, GX_CLAMP, GX_CLAMP, 0, 0),
gsSPNTrianglesInit_5b(
4, // tri count
8, 9, 10, // tri0
10, 11, 8, // tri1
12, 13, 14 // tri2
),
gsSPNTriangles_5b(
14, 15, 12, // tri0
0, 0, 0, // tri1
0, 0, 0, // tri2
0, 0, 0 // tri3
),
gsDPLoadTextureBlock_4b_Dolphin(con_kaiwa2_w1_tex, G_IM_FMT_I, 64, 64, 15, GX_CLAMP, GX_CLAMP, 0, 0),
gsSPNTrianglesInit_5b(
4, // tri count
16, 17, 18, // tri0
18, 19, 16, // tri1
20, 21, 22 // tri2
),
gsSPNTriangles_5b(
22, 23, 20, // tri0
0, 0, 0, // tri1
0, 0, 0, // tri2
0, 0, 0 // tri3
),
gsSPEndDisplayList(),
};
static u8 con_namefuti_TXT[] ATTRIBUTE_ALIGN(32) = {
#include "assets/msg/con_namefuti_TXT.inc"
};
static Vtx con_kaiwaname_v[] = {
#include "assets/msg/con_kaiwaname_v.inc"
};
static Gfx con_kaiwaname_modelT[] = {
gsSPTexture(0, 0, 0, 0, G_ON),
gsDPLoadTextureBlock_4b_Dolphin(con_namefuti_TXT, G_IM_FMT_I, 64, 32, 15, GX_MIRROR, GX_MIRROR, 0, 0),
gsSPVertex(&con_kaiwaname_v[0], 4, 0),
gsSPNTrianglesInit_5b(
2, // tri count
0, 1, 2, // tri0
2, 3, 0, // tri1
0, 0, 0 // tri2
),
gsSPEndDisplayList(),
};
static Gfx mMsg_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(),
};
+53
View File
@@ -0,0 +1,53 @@
static int mMsg_Main_Disappear_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 = 1.0f - 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 = 0.0f;
msg_p->text_scale = 0.0f;
msg_p->timer = 0.0f;
return TRUE;
}
}
static void mMsg_request_main_index_fromDisappear(mMsg_Window_c* msg_p, int scale_done_flag) {
if (scale_done_flag) {
mMsg_Change_request_main_index(msg_p, mMsg_INDEX_HIDE, 5);
}
}
static void mMsg_Main_Disappear(mMsg_Window_c* msg_p, GAME* game) {
int scaling_done_flag = mMsg_Main_Disappear_SetScale(msg_p, game);
mMsg_request_main_index_fromDisappear(msg_p, scaling_done_flag);
mMsg_MainSetup_Window(msg_p, game);
}
static void mMsg_MainSetup_Disappear(mMsg_Window_c* msg_p, GAME* game) {
mMsg_sound_spec_change_scene(msg_p);
msg_p->main_index = mMsg_INDEX_DISAPPEAR;
msg_p->draw_flag = TRUE;
msg_p->window_scale = 1.0f;
msg_p->text_scale = 1.0f;
msg_p->timer = 0.0f;
msg_p->show_continue_button = FALSE;
if (mDemo_Get_use_zoom_sound()) {
if (mDemo_Get_camera() == FALSE) {
mMsg_sound_ZOOMDOWN_SHORT(msg_p);
}
else {
mMsg_sound_ZOOMDOWN_LONG(msg_p);
}
}
msg_p->requested_main_index = -1;
msg_p->requested_priority = 4;
}
+30
View File
@@ -0,0 +1,30 @@
static void mMsg_request_main_index_fromDisappear_wait(mMsg_Window_c* msg_p, int scaling_done_flag) {
if (scaling_done_flag) {
mMsg_MainDisappearWait_Data_c* main_data = &msg_p->main_data.main_disappear_wait;
int saved_main_index = main_data->saved_main_index;
mMsg_request_main_wait(msg_p, saved_main_index, 5);
}
}
static void mMsg_Main_Disappear_wait(mMsg_Window_c* msg_p, GAME* game) {
int scaling_done = mMsg_Main_Disappear_SetScale(msg_p, game);
mMsg_request_main_index_fromDisappear_wait(msg_p, scaling_done);
mMsg_MainSetup_Window(msg_p, game);
}
static void mMsg_MainSetup_Disappear_wait(mMsg_Window_c* msg_p, GAME* game) {
mMsg_Request_MainDisappearWait_Data_c* request_data = &msg_p->request_data.request_main_disappear_wait;
mMsg_MainDisappearWait_Data_c* main_data = &msg_p->main_data.main_disappear_wait;
main_data->saved_main_index = request_data->last_main_index;
msg_p->main_index = mMsg_INDEX_DISAPPEAR_WAIT;
msg_p->draw_flag = TRUE;
msg_p->window_scale = 1.0f;
msg_p->text_scale = 1.0f;
msg_p->timer = 0.0f;
mMsg_sound_ZOOMDOWN_SHORT(msg_p);
msg_p->requested_main_index = -1;
msg_p->requested_priority = 4;
}
+118
View File
@@ -0,0 +1,118 @@
static void mMsg_draw_font(mMsg_Window_c* msg_p, GAME* game) {
mFontSentence sentence;
u8* last_p = &msg_p->msg_data->text_buf.data[msg_p->end_text_cursor_idx];
u8* start_p = &msg_p->msg_data->text_buf.data[msg_p->start_text_cursor_idx];
int line_num;
u8* cur_p;
u8 code;
u8 cont_type;
int len;
int line_len;
int total_len;
xy_t scale;
xy_t pos;
Gfx* gfx;
int line_end_flag;
int sentence_finished_flag;
u32 sentence_flags;
int sentence_voice_idx = msg_p->voice_sfx_idx - msg_p->start_text_cursor_idx;
int voice = FALSE;
if (fabsf(msg_p->text_scale) < 0.001f) {
return;
}
OPEN_DISP(game->graph);
gfx = NOW_FONT_DISP;
scale.x = msg_p->text_scale;
scale.y = msg_p->text_scale;
pos.x = msg_p->center_x - (96.0f * scale.x);
pos.y = msg_p->center_y - (32.0f * scale.y);
if ((msg_p->status_flags & mMsg_STATUS_FLAG_VOICE_ENTRY)) {
if ((msg_p->status_flags & mMsg_STATUS_FLAG_18)) {
voice = TRUE;
}
else if (!F32_IS_ZERO(msg_p->cursor_timer) || msg_p->force_voice_enable_flag == TRUE) {
voice = TRUE;
}
}
line_num = 0;
sentence_finished_flag = FALSE;
total_len = 0;
while (line_num < msg_p->text_lines && sentence_finished_flag == FALSE) {
for (
line_len = 0, cur_p = start_p, line_end_flag = FALSE;
cur_p < last_p && line_end_flag == FALSE;
len = mFont_CodeSize_get(cur_p), cur_p += len, line_len += len
) {
code = cur_p[0];
if (code == CHAR_NEW_LINE) {
line_end_flag = TRUE;
}
else if (code == CHAR_CONTROL_CODE) {
cont_type = cur_p[1];
if (
cont_type == mFont_CONT_CODE_LAST ||
cont_type == mFont_CONT_CODE_CONTINUE ||
cont_type == mFont_CONT_CODE_MSG_TIME_END
) {
line_end_flag = TRUE;
sentence_finished_flag = TRUE;
}
}
}
if (cur_p >= last_p) {
sentence_finished_flag = TRUE;
}
if (line_num == 0) {
sentence_flags = mFont_SENTENCE_SKIP_DRAW_NEW_LINE | mFont_SENTENCE_FLAG_CUT;
}
else {
sentence_flags = mFont_SENTENCE_SKIP_DRAW_NEW_LINE | mFont_SENTENCE_FLAG_NO_COMBINE | mFont_SENTENCE_FLAG_3 | mFont_SENTENCE_FLAG_CUT;
}
if (
voice &&
sentence_voice_idx >= total_len &&
sentence_voice_idx < (total_len + line_len)
) {
sentence_flags |= mFont_SENTENCE_FLAG_VOICE_SE;
msg_p->status_flags &= ~(mMsg_STATUS_FLAG_18 | mMsg_STATUS_FLAG_VOICE_ENTRY);
}
mFontSentence_set(
&sentence,
start_p,
line_len,
sentence_flags,
&pos,
mFont_LineType_Top,
&scale,
&msg_p->font_color[line_num],
sentence_voice_idx - total_len,
msg_p->voice_idx,
msg_p->voice2_idx,
msg_p->voice3_idx,
msg_p->animal_voice_idx
);
mFontSentence_gppDraw(&sentence, game, &gfx);
pos.y += 16.0f * scale.y;
start_p = cur_p;
line_num++;
total_len += line_len;
}
SET_FONT_DISP(gfx);
CLOSE_DISP(game->graph);
}
+107
View File
@@ -0,0 +1,107 @@
static void mMsg_SetMatrix(mMsg_Window_c* msg_p, GAME* game, int mode) {
GRAPH* graph = game->graph;
f32 scale = msg_p->window_scale;
f32 center_x = ( msg_p->center_x - (SCREEN_WIDTH_F * 0.5f)) * 16.0f;
f32 center_y = (-msg_p->center_y + (SCREEN_HEIGHT_F * 0.5f)) * 16.0f;
Matrix_push();
Matrix_translate(center_x, center_y, 0.0f, 1);
Matrix_scale(scale, scale, scale, 1);
OPEN_DISP(graph);
if (mode == mFont_MODE_FONT) {
gSPMatrix(NOW_FONT_DISP++, _Matrix_to_Mtx_new(graph), G_MTX_MODELVIEW | G_MTX_LOAD | G_MTX_NOPUSH);
}
else {
gSPMatrix(NOW_POLY_OPA_DISP++, _Matrix_to_Mtx_new(graph), G_MTX_MODELVIEW | G_MTX_LOAD | G_MTX_NOPUSH);
}
CLOSE_DISP(graph);
}
static void mMsg_UnSetMatrix() {
Matrix_pull();
}
static void mMsg_DrawNameWindow(mMsg_Window_c* msg_p, GAME* game, int mode) {
GRAPH* graph = game->graph;
OPEN_DISP(graph);
if (mode == mFont_MODE_FONT) {
gDPSetPrimColor(NOW_FONT_DISP++, 0, 255, msg_p->name_background_color.r, msg_p->name_background_color.g, msg_p->name_background_color.b, 255);
gSPDisplayList(NOW_FONT_DISP++, con_kaiwaname_modelT);
}
else {
gDPSetPrimColor(NOW_POLY_OPA_DISP++, 0, 255, msg_p->name_background_color.r, msg_p->name_background_color.g, msg_p->name_background_color.b, 255);
gSPDisplayList(NOW_POLY_OPA_DISP++, con_kaiwaname_modelT);
}
CLOSE_DISP(graph);
}
static void mMsg_DrawWindowClientName(mMsg_Window_c* msg_p, GAME* game, int mode) {
u8 name[ANIMAL_NAME_LEN];
mNpc_GetNpcWorldName(name, msg_p->client_actor_p);
mFont_SetLineStrings_AndSpace(
game,
name, msg_p->client_name_len,
msg_p->nameplate_x, msg_p->nameplate_y,
msg_p->name_text_color.r, msg_p->name_text_color.g, msg_p->name_text_color.b, msg_p->name_text_color.a,
FALSE,
TRUE,
TRUE,
1.0f, 1.0f,
mode
);
}
static void mMsg_DrawWindowTurnButton(mMsg_Window_c* msg_p, GAME* game, int mode) {
if (msg_p->show_continue_button != FALSE && msg_p->lock_continue == FALSE) {
mFont_SetMarkChar(
game,
mFont_MARKTYPE_NEXT,
257.0f, 136.0f,
msg_p->continue_button_color.r, msg_p->continue_button_color.g, msg_p->continue_button_color.b, msg_p->continue_button_color.a,
FALSE,
1.0f, 1.0f,
mode
);
}
}
static void mMsg_DrawWindowBody(mMsg_Window_c* msg_p, GAME* game, int mode) {
GRAPH* graph = game->graph;
rgba_t* window_background_color = &msg_p->window_background_color;
OPEN_DISP(graph);
if (mode == mFont_MODE_FONT) {
gSPDisplayList(NOW_FONT_DISP++, mMsg_init_disp);
gDPSetPrimColor(NOW_FONT_DISP++, 0, 255, window_background_color->r, window_background_color->g, window_background_color->b, window_background_color->a);
gSPDisplayList(NOW_FONT_DISP++, con_kaiwa2_modelT);
if (msg_p->show_actor_name) {
mMsg_DrawNameWindow(msg_p, game, mode);
mMsg_DrawWindowClientName(msg_p, game, mode);
}
mMsg_DrawWindowTurnButton(msg_p, game, mode);
}
else {
gSPDisplayList(NOW_POLY_OPA_DISP++, mMsg_init_disp);
gDPSetPrimColor(NOW_POLY_OPA_DISP++, 0, 255, window_background_color->r, window_background_color->g, window_background_color->b, window_background_color->a);
gSPDisplayList(NOW_POLY_OPA_DISP++, con_kaiwa2_modelT);
if (msg_p->show_actor_name) {
mMsg_DrawNameWindow(msg_p, game, mode);
mMsg_DrawWindowClientName(msg_p, game, mode);
}
mMsg_DrawWindowTurnButton(msg_p, game, mode);
}
CLOSE_DISP(graph);
}
+18
View File
@@ -0,0 +1,18 @@
static void mMsg_Main_Wait(mMsg_Window_c* msg_p, GAME* game) {
mMsg_MainSetup_Window(msg_p, game);
}
static void mMsg_MainSetup_Wait(mMsg_Window_c* msg_p, GAME* game) {
mMsg_Request_MainWait_Data_c* request_data = &msg_p->request_data.request_main_wait;
mMsg_MainWait_Data_c* main_data = &msg_p->main_data.main_wait;
main_data->last_main_index = request_data->last_main_index;
msg_p->main_index = mMsg_INDEX_WAIT;
msg_p->draw_flag = FALSE;
msg_p->window_scale = 0.0f;
msg_p->text_scale = 0.0f;
msg_p->timer = 0.0f;
msg_p->requested_main_index = -1;
msg_p->requested_priority = 4;
msg_p->status_flags &= ~mMsg_STATUS_FLAG_NO_ZOOMDOWN;
}
+4 -4
View File
@@ -379,7 +379,7 @@ void Game_play_fbdemo_proc(GAME_PLAY* play){
void play_cleanup(GAME* game){
GAME_PLAY* play = (GAME_PLAY*)game;
mMsg_dt(play);
mMsg_dt(game);
banti_dt();
play->game.graph->taskEndCallback = NULL;
@@ -515,7 +515,7 @@ void play_init(GAME* game){
mMmd_MakeMuseumDisplayData();
Actor_info_ct(&play->game, &play->actor_info, play->player_data);
play->draw_chk_proc = none_proc1;
mMsg_ct(play);
mMsg_ct(game);
mEv_2nd_init(&play->event);
mTD_player_keydata_init(play);
Balloon_init(play);
@@ -566,7 +566,7 @@ void Game_play_move_fbdemo_not_move(GAME_PLAY* play){
play->game.doing_point = 1;
mCoBG_CalcTimerDecalCircle();
play->game.doing_point = 2;
mMsg_Main(play);
mMsg_Main((GAME*)play);
}
else{
mVibctl_set_force_stop(2);
@@ -774,7 +774,7 @@ int makeBumpTexture(GAME_PLAY* play, GRAPH* graph1, GRAPH* graph2){
if((GETREG(HREG, 80) != 10) || (GETREG(HREG, 85) != 0)){
Actor_info_draw_actor(play, &play->actor_info);
Camera2_draw(play);
mMsg_Draw(play);
mMsg_Draw((GAME*)play);
}
if((GETREG(HREG, 80) != 10) || (GETREG(HREG, 93) != 0)){