Merge pull request #78 from Cuyler36/m_msg_defs

Add m_msg & m_choice structure definitions
This commit is contained in:
Cuyler36
2023-07-09 08:55:35 -04:00
committed by GitHub
2 changed files with 291 additions and 2 deletions
+86 -1
View File
@@ -7,17 +7,102 @@
extern "C" {
#endif
typedef struct choice_s mChoice_c; // TODO
#define mChoice_CHOICE_STRING_LEN 16
typedef struct choice_s mChoice_c;
typedef struct choice_data_s mChoice_Data_c;
enum choice {
mChoice_CHOICE0,
mChoice_CHOICE1,
mChoice_CHOICE2,
mChoice_CHOICE3,
mChoice_CHOICE4,
mChoice_CHOICE5,
mChoice_CHOICE_NUM
};
enum {
mChoice_AUTOMOVE_STOPPED,
mChoice_AUTOMOVE_INCREMENT_WAIT,
mChoice_AUTOMOVE_INCREMENT,
mChoice_AUTOMOVE_DECREMENT_WAIT,
mChoice_AUTOMOVE_DECREMENT,
mChoice_AUTOMOVE_NUM
};
enum {
mChoice_MAIN_HIDE,
mChoice_MAIN_APPEAR,
mChoice_MAIN_NORMAL,
mChoice_MAIN_DISAPPEAR,
mChoice_MAIN_INDEX_NUM
};
struct choice_data_s {
u8 strings[mChoice_CHOICE_NUM][mChoice_CHOICE_STRING_LEN];
int string_lens[mChoice_CHOICE_NUM];
u8 determination_string[mChoice_CHOICE_STRING_LEN];
int determination_len;
int choice_num;
int selected_choice_idx;
};
struct choice_s {
/* Current XY position (centered) */
f32 center_x;
f32 center_y;
/* Initial XY position */
f32 center_x_begin;
f32 center_y_begin;
/* Target XY position */
f32 center_x_target;
f32 center_y_target;
/* Text settings */
rgba_t text_color;
f32 text_scale_x;
f32 text_scale_y;
f32 text_x;
f32 text_y;
/* Window scaling XY */
f32 scale_x;
f32 scale_y;
/* Text related data */
mChoice_Data_c data;
int selected_choice_idx;
rgba_t selected_choice_text_color;
rgba_t background_color;
f32 _D4;
f32 _D8;
f32 scale; // total choice window scaling percentage
int main_index;
int requested_main_index;
int window_visible_flag;
int font_visible_flag;
int choice_automove_type;
f32 choice_automove_timer;
f32 timer;
u8 no_b_flag; // can't press B to select last option
u8 no_close_flag; // pressing B won't auto-cancel the choice selection?
};
extern mChoice_c* mChoice_Get_base_window_p();
extern int mChoice_Get_ChoseNum(mChoice_c* choice);
+205 -1
View File
@@ -3,13 +3,217 @@
#include "types.h"
#include "libu64/gfxprint.h"
#include "m_choice.h"
#ifdef __cplusplus
extern "C" {
#endif
/* TODO: fill out message struct */
#define mMsg_MSG_BUF_SIZE 1600
#define mMsg_FREE_STRING_LEN 16
#define mMsg_MAIL_STRING_LEN 132
enum {
mMsg_FREE_STR0,
mMsg_FREE_STR1,
mMsg_FREE_STR2,
mMsg_FREE_STR3,
mMsg_FREE_STR4,
mMsg_FREE_STR5,
mMsg_FREE_STR6,
mMsg_FREE_STR7,
mMsg_FREE_STR8,
mMsg_FREE_STR9,
mMsg_FREE_STR10,
mMsg_FREE_STR11,
mMsg_FREE_STR12,
mMsg_FREE_STR13,
mMsg_FREE_STR14,
mMsg_FREE_STR15,
mMsg_FREE_STR16,
mMsg_FREE_STR17,
mMsg_FREE_STR18,
mMsg_FREE_STR19,
mMsg_FREE_STR_NUM
};
enum {
mMsg_ITEM_STR0,
mMsg_ITEM_STR1,
mMsg_ITEM_STR2,
mMsg_ITEM_STR3,
mMsg_ITEM_STR4,
mMsg_ITEM_STR_NUM
};
enum {
mMsg_MAIL_STR0,
mMsg_MAIL_STR_NUM
};
typedef struct message_window_s mMsg_Window_c;
typedef struct message_data_s mMsg_Data_c;
/* These are hinted at due to the 8-byte alignment forced onto these structs */
typedef struct {
int saved_main_index;
} mMsg_MainAppearWait_Data_c;
typedef struct {
int saved_main_index;
} mMsg_MainDisappearWait_Data_c;
typedef struct {
int saved_main_index;
} mMsg_MainWait_Data_c;
typedef union {
mMsg_MainAppearWait_Data_c main_appear_wait;
mMsg_MainDisappearWait_Data_c main_disappear_wait;
mMsg_MainWait_Data_c main_wait;
u64 align;
} mMsg_Main_Data_c;
typedef struct {
ACTOR* speaker_actor;
int msg_no;
int name_shown_flag;
rgba_t window_color;
} mMsg_Request_MainAppear_Data_c;
typedef struct {
int saved_main_index;
int init_flags;
} mMsg_Request_MainAppearWait_Data_c;
typedef struct {
int init_flags;
} mMsg_Request_MainCursor_Data_c;
typedef struct {
int init_flags;
} mMsg_Request_MainDisappearWait_Data_c;
typedef struct {
int init_flags;
} mMsg_Request_MainNormal_Data_c;
typedef struct {
int saved_main_index;
} mMsg_Request_MainWait_Data_c;
typedef union {
mMsg_Request_MainAppear_Data_c request_main_appear;
mMsg_Request_MainAppearWait_Data_c request_main_appear_wait;
mMsg_Request_MainCursor_Data_c request_main_cursor;
mMsg_Request_MainDisappearWait_Data_c request_main_disappear_wait;
mMsg_Request_MainNormal_Data_c request_main_normal;
mMsg_Request_MainWait_Data_c request_main_wait;
u64 align;
} mMsg_Request_Data_c;
typedef union {
u8 data[mMsg_MSG_BUF_SIZE];
u64 align;
} mMsg_MsgBuf_c;
struct message_data_s {
int data_loaded;
int msg_no;
int msg_len;
int cut;
mMsg_MsgBuf_c text_buf;
};
struct message_window_s {
int data_loaded;
int msg_no;
int _008;
mMsg_Data_c* msg_data;
f32 center_x;
f32 center_y;
f32 width;
f32 height;
ACTOR* talk_actor;
int show_actor_name;
int actor_name_len;
int nameplate_x;
int nameplay_y;
int show_continue_button;
u8 free_str[mMsg_FREE_STR_NUM][mMsg_FREE_STRING_LEN];
int free_str_article[mMsg_FREE_STR_NUM];
u8 item_str[mMsg_ITEM_STR_NUM][mMsg_FREE_STRING_LEN];
int item_str_article[mMsg_ITEM_STR_NUM];
u8 mail_str[mMsg_MAIL_STR_NUM][mMsg_MAIL_STRING_LEN];
rgba_t name_text_color;
rgba_t name_background_color;
rgba_t window_background_color;
rgba_t font_color[4];
rgba_t continue_button_color;
f32 font_scale_x;
f32 font_scale_y;
int _2D8;
int _2DC;
int text_lines;
int current_line;
mChoice_c choice_window;
int _3E8;
u16 end_timer;
s16 animal_voice_idx;
int voice_sfx_idx;
u8 voice_idx;
u8 voice2_idx;
u8 voice3_idx;
s8 hide_choice_window_timer;
int spec;
u8 free_str_color_idx[4];
u8 _404[8]; // unused?
u32 status_flags;
f32 timer;
f32 cursor_timer;
f32 continue_button_timer;
int start_text_cursor_idx;
int end_text_cursor_idx;
f32 window_scale;
f32 text_scale;
int requested_main_index;
int requested_priority;
int main_index;
int draw_flag;
int cancel_flag;
int cancelable_flag;
int continue_msg_no;
int continue_cancel_flag;
int force_next;
int lock_continue;
s8 now_utter;
mMsg_Main_Data_c main_data;
mMsg_Request_Data_c request_data;
};
extern int mMsg_Get_Length_String(u8* buf, size_t buf_size);
extern mMsg_Window_c* mMsg_Get_base_window_p();