diff --git a/config/rel_slices.yml b/config/rel_slices.yml index 69929662..fa3d5813 100644 --- a/config/rel_slices.yml +++ b/config/rel_slices.yml @@ -340,6 +340,13 @@ first_game.c: .text: [0x80629CA8, 0x80629D4C] sys_romcheck.c: .text: [0x80629D4C, 0x80629D8C] +sys_dynamic.c: + .bss: [0x813413F8, 0x81361820] +m_play.c: + .text: [0x80629D8C,0x8062B630] + .rodata: [0x8064D1B8, 0x8064D1C0] + .data: [0x806D46D0, 0x806D4958] + .bss: [0x81361820, 0x8148DA60] second_game.c: .text: [0x8062B630, 0x8062B848] .bss: [0x8148DA60, 0x8148DA68] @@ -363,10 +370,6 @@ audio.c: .rodata: [0x8064D340, 0x8064D360] .data: [0x806D4CB0,0x806D4D40] .bss: [0x8148DA78,0x8148DA7C] -sys_dynamic.c: - .bss: [0x813413F8, 0x81361820] -# ac_aprilfool_control/aPC_actor_dt.c: common_data is pure bs, - # .text: [0x805153f0, 0x8051542C] # dataobject.obj files data/titledemo/pact0.c: diff --git a/include/Famicom/famicom.h b/include/Famicom/famicom.h index f0f5495f..eff1fece 100644 --- a/include/Famicom/famicom.h +++ b/include/Famicom/famicom.h @@ -68,6 +68,9 @@ typedef struct famicom_common_s { /* 0xB4 */ int _b4; } FamicomCommon; + +extern void* my_malloc_current; + typedef u8 (*FAMICOM_GETSAVECHAN_PROC)(int* player_no, int* slot_card_result); extern void famicom_setCallback_getSaveChan(FAMICOM_GETSAVECHAN_PROC getSaveChan_proc); extern int famicom_mount_archive(); diff --git a/include/PreRender.h b/include/PreRender.h index 3be609cd..899ffebd 100644 --- a/include/PreRender.h +++ b/include/PreRender.h @@ -27,6 +27,11 @@ typedef struct prerender_s { u8 _24[0x24]; } PreRender; +extern void PreRender_setup_savebuf(PreRender* render, int arg1, int arg2, int arg3, int arg4, int arg5); +extern void PreRender_init(PreRender* render); +extern void PreRender_setup_renderbuf(PreRender* render, int arg1, int arg2, void* arg3, void* arg4); +extern void PreRender_cleanup(PreRender* render); + #ifdef __cplusplus } #endif diff --git a/include/audio.h b/include/audio.h index 326d97ee..9a3134a1 100644 --- a/include/audio.h +++ b/include/audio.h @@ -91,8 +91,8 @@ extern void sAdo_OngenTrgStartSpeed(f32 speed, u16 s1, xyz_t* pos); extern void sAdo_TrgSeEcho(u8 b); extern void sAdo_LevSeEcho(u8 b); -extern void sAdo_BgmFadeoutCheck(); -extern void sAdo_SeFadeoutCheck(); +extern u8 sAdo_BgmFadeoutCheck(); +extern u8 sAdo_SeFadeoutCheck(); extern void sAdo_RoomType(u8 type); extern void sAdo_Museum(u8 type); diff --git a/include/famicom_emu.h b/include/famicom_emu.h index 86c9a3b6..60ad768a 100644 --- a/include/famicom_emu.h +++ b/include/famicom_emu.h @@ -13,6 +13,8 @@ typedef struct game_famicom_emu_s { /* 0x00 */ GAME game; } GAME_FAMICOM_EMU; +extern void* my_malloc_func[]; + extern void famicom_emu_init(GAME_FAMICOM_EMU* famicom_emu); extern void famicom_emu_cleanup(GAME_FAMICOM_EMU* famicom_emu); diff --git a/include/m_camera2.h b/include/m_camera2.h index 14d0fd78..0dc93e6b 100644 --- a/include/m_camera2.h +++ b/include/m_camera2.h @@ -326,6 +326,10 @@ typedef struct camera_s { xyz_t* Camera2_getMicPos_p(GAME_PLAY*); +void Camera2_ClearActorTalking_Cull(GAME_PLAY*); +void Camera2_process(GAME_PLAY*); +void Init_Camera2(GAME_PLAY*); +void Camera2_draw(GAME_PLAY*); #ifdef __cplusplus } diff --git a/include/m_card.h b/include/m_card.h index f926ab67..de2e91ac 100644 --- a/include/m_card.h +++ b/include/m_card.h @@ -16,6 +16,7 @@ extern void mCD_init_card(); extern void mCD_PrintErrInfo(gfxprint_t* gfxprint); extern void mCD_InitAll(); extern void mCD_LoadLand(); +extern void mCD_toNextLand(); #ifdef __cplusplus } diff --git a/include/m_collision_bg.h b/include/m_collision_bg.h index f6517ddb..9d20ac3f 100644 --- a/include/m_collision_bg.h +++ b/include/m_collision_bg.h @@ -116,6 +116,12 @@ extern void mCoBG_SetPlussOffset(xyz_t wpos, s16 offset, s16 new_attrib); extern int mCoBG_GetLayer(const xyz_t* wpos); extern int mCoBG_BnumUnum2HoleNumber(int block_x, int block_z, int ut_x, int ut_z); +extern void mCoBG_InitMoveBgData(); +extern void mCoBG_InitBlockBgCheckMode(); +extern void mCoBG_InitDecalCircle(); + +extern void mCoBG_CalcTimerDecalCircle(); + extern f32 mCoBG_GetWaterHeight_File(xyz_t wpos, char* file, int line); #define mCoBG_GetWaterHeight(wpos) mCoBG_GetWaterHeight_File(wpos, __FILE__, __LINE__) diff --git a/include/m_common_data.h b/include/m_common_data.h index 13d1a16f..6a0a884d 100644 --- a/include/m_common_data.h +++ b/include/m_common_data.h @@ -200,7 +200,9 @@ typedef struct common_data_s { /* 0x028592 */ s16 demo_profiles[mDemo_CLIP_TYPE_NUM - 1]; /* 0x028596 */ u8 _28596[0x285C0 - 0x28596]; /* 0x0285C0 */ s8 player_decoy_flag; - /* 0x0285C1 */ u8 _285C1[0x028838 - 0x0285C1]; + /* 0x0285C1 */ u8 _285C1[0x0285C6 - 0x0285C1]; + /* 0x0285C6 */ u8 event_id; + /* 0x0285C7 */ u8 _285C3[0x028838 - 0x0285C7]; /* 0x028838 */ s8 player_bee_swell_flag; /* 0x028839 */ s8 player_bee_chase_flag; /* 0x02883A */ u8 goki_shocked_flag; diff --git a/include/m_debug_display.h b/include/m_debug_display.h new file mode 100644 index 00000000..d0c373e5 --- /dev/null +++ b/include/m_debug_display.h @@ -0,0 +1,11 @@ +#ifndef M_DEBUG_DISPLAY_H +#define M_DEBUG_DISPLAY_H + +#include "types.h" +#include "m_play.h" + + +extern void Debug_Display_output(GAME_PLAY*); +extern void Debug_Display_init(); + +#endif \ No newline at end of file diff --git a/include/m_demo.h b/include/m_demo.h index accdac37..d1773f66 100644 --- a/include/m_demo.h +++ b/include/m_demo.h @@ -60,6 +60,8 @@ enum demo_clip_type { mDemo_CLIP_TYPE_NUM }; +extern void mDemo_Init(GAME_PLAY*); +extern void mDemo_Main(GAME_PLAY*); extern int mDemo_Request(int type, ACTOR* actor, mDemo_REQUEST_PROC request_proc); extern void mDemo_Set_msg_num(int msg_num); extern int mDemo_Check(int type, ACTOR* actor); @@ -75,6 +77,7 @@ extern void mDemo_Set_talk_display_name(u8 value); extern void mDemo_Set_camera(u8 value); extern void mDemo_Set_talk_window_color(rgba_t* color); extern int mDemo_CheckDemo(); +extern void mDemo_stock_clear(); #ifdef __cplusplus } diff --git a/include/m_event.h b/include/m_event.h index bc8d9719..e3cd5d7e 100644 --- a/include/m_event.h +++ b/include/m_event.h @@ -240,7 +240,7 @@ extern int mEv_check_status(int event, s16 status); extern s8* mEv_get_common_area(int type, s8 id); extern int mEv_ArbeitPlayer(u32 player_no); extern u16 mEv_get_special_event_type(); -mEv_ClearEventSaveInfo(mEv_event_save_c* event_save_data); +extern int mEv_ClearEventSaveInfo(mEv_event_save_c* event_save_data); extern int mEv_weekday2day(lbRTC_month_t month, int week_type, lbRTC_weekday_t weekday); extern void mEv_ClearEventInfo(); @@ -248,12 +248,16 @@ extern void mEv_ClearEventInfo(); extern void mEv_init(Event_c* event); extern void mEv_2nd_init(Event_c* event); +extern void mEv_run(Event_c* event); +extern void mEv_finish(Event_c* event); + extern int mEv_CheckTitleDemo(); extern void mEv_SetTitleDemo(int titledemo_no); extern void mEv_debug_print4f(gfxprint_t* gfxprint); extern void mEv_sp_debug_print4f(gfxprint_t* gfxprint); + #ifdef __cplusplus } #endif diff --git a/include/m_fbdemo.h b/include/m_fbdemo.h index c227e880..0c0f9d76 100644 --- a/include/m_fbdemo.h +++ b/include/m_fbdemo.h @@ -17,16 +17,16 @@ typedef struct { /* 0x98 */ Mtx modelView2; /* 0xD8 */ Gfx* gfx; // "gfxtbl" /* 0xDC */ u16* zBuffer; -} fbdemo; // size = 0xE0 +} fbdemo_c; // size = 0xE0 -extern void fbdemo_init_gfx(fbdemo*); -extern void fbdemo_init_data(fbdemo*); -extern void fbdemo_cleanup(fbdemo*); -extern fbdemo* fbdemo_init(fbdemo*, int, int); -extern void fbdemo_update(fbdemo*); -extern void fbdemo_draw(fbdemo*, Gfx**); -extern void fbdemo_move(fbdemo*); +extern void fbdemo_init_gfx(fbdemo_c*); +extern void fbdemo_init_data(fbdemo_c*); +extern void fbdemo_cleanup(fbdemo_c*); +extern fbdemo_c* fbdemo_init(fbdemo_c*, int, int); +extern void fbdemo_update(fbdemo_c*); +extern void fbdemo_draw(fbdemo_c*, Gfx**); +extern void fbdemo_move(fbdemo_c*); #endif diff --git a/include/m_fbdemo_fade.h b/include/m_fbdemo_fade.h index f389c7cf..107b0ed8 100644 --- a/include/m_fbdemo_fade.h +++ b/include/m_fbdemo_fade.h @@ -18,6 +18,7 @@ typedef struct { extern fbdemo_fade* fbdemo_fade_init(fbdemo_fade*); extern void fbdemo_fade_move(fbdemo_fade*, int); +extern void fbdemo_fade_draw(fbdemo_fade* this, Gfx** gfxP); extern void fbdemo_fade_startup(fbdemo_fade*); extern void fbdemo_fade_settype(fbdemo_fade*, int); extern void fbdemo_fade_setcolor_rgba8888(fbdemo_fade* this, u32 color); diff --git a/include/m_fbdemo_triforce.h b/include/m_fbdemo_triforce.h index f4653ca8..5cdda014 100644 --- a/include/m_fbdemo_triforce.h +++ b/include/m_fbdemo_triforce.h @@ -26,5 +26,4 @@ extern s8 fbdemo_triforce_is_finish(fbdemo_triforce*); extern void fbdemo_triforce_settype(fbdemo_triforce*, int); extern void fbdemo_triforce_setcolor_rgba8888(void); - #endif \ No newline at end of file diff --git a/include/m_field_make.h b/include/m_field_make.h index 07372ea3..5e696b79 100644 --- a/include/m_field_make.h +++ b/include/m_field_make.h @@ -5,6 +5,7 @@ #include "m_actor_type.h" #include "libforest/gbi_extensions.h" #include "game_h.h" +#include "m_play.h" #ifdef __cplusplus extern "C" { @@ -91,6 +92,8 @@ typedef struct field_info_s { extern u8* g_block_type_p; extern int* g_block_kind_p; +extern void mFM_FieldInit(GAME_PLAY*); +extern void mFM_Field_dt(); extern void mFM_DecideBgTexIdx(u8* bg_tex_idx); extern void mFM_InitFgCombiSaveData(GAME* game); extern mActor_name_t mFM_GetReserveName(int block_x, int block_z); diff --git a/include/m_fuusen.h b/include/m_fuusen.h index eb91afcc..59a76215 100644 --- a/include/m_fuusen.h +++ b/include/m_fuusen.h @@ -20,7 +20,7 @@ enum { extern int fuusen_DEBUG_mode_flag; -extern void Balloon_init(); +extern void Balloon_init(GAME_PLAY*); extern void Balloon_make_fuusen(GAME_PLAY* play); extern void Balloon_chk_make_fuusen(GAME_PLAY* play); extern void Balloon_move(GAME_PLAY* play); diff --git a/include/m_kankyo.h b/include/m_kankyo.h index 14200d95..28d68de4 100644 --- a/include/m_kankyo.h +++ b/include/m_kankyo.h @@ -42,7 +42,11 @@ typedef struct kankyo_s { /* 0xC8 */ Nature nature; } Kankyo; +extern void Global_kankyo_ct(GAME_PLAY*, Kankyo*); extern int mEnv_NowWeather(); +extern int mEnv_WindMove(); +extern void mEnv_ManagePointLight(GAME_PLAY*, Kankyo*, Global_light*); +extern void Global_kankyo_set(GAME_PLAY*, Kankyo*, Global_light*); #ifdef __cplusplus } diff --git a/include/m_msg.h b/include/m_msg.h index fb40c949..989a66d7 100644 --- a/include/m_msg.h +++ b/include/m_msg.h @@ -218,6 +218,10 @@ struct message_window_s { extern int mMsg_Get_Length_String(u8* buf, size_t 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_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(); diff --git a/include/m_notice.h b/include/m_notice.h index 0fff4aff..8f99fe5c 100644 --- a/include/m_notice.h +++ b/include/m_notice.h @@ -17,6 +17,8 @@ typedef struct notice_board_post_s { /* 0xC0 */ lbRTC_time_c post_time; /* date-time of post */ } mNtc_board_post_c; +extern void mNtc_set_auto_nwrite_data(); + #ifdef __cplusplus } #endif diff --git a/include/m_play.h b/include/m_play.h index efbeeddf..b28e8969 100644 --- a/include/m_play.h +++ b/include/m_play.h @@ -16,12 +16,14 @@ #include "m_collision_obj.h" #include "m_play_h.h" #include "m_scene.h" +#include "PreRender.h" #ifdef __cplusplus extern "C" { #endif typedef int (*DRAW_CHK_PROC)(ACTOR*, GAME_PLAY*); +typedef void (*PLAY_WIPE_PROC)(GAME_PLAY*); /* sizeof(struct game_play_s) == 0x2600 */ struct game_play_s { @@ -30,7 +32,8 @@ struct game_play_s { /* 0x00E0 */ s16 scene_id; /* 0x00E4 */ mFI_block_tbl_c block_table; /* 0x00F4 */ mFI_block_tbl_c last_block_table; - /* 0x0104 */ u8 _0104[0x0110 - 0x0104]; + /* 0x0104 */ u8 _0104[0x010C - 0x0104]; + /* 0x010C */ Scene_status_c* current_scene_data; /* 0x0110 */ Object_Exchange_c object_exchange; /* 0x1A68 */ View view; /* 0x1B88 */ Camera2 camera; @@ -39,12 +42,16 @@ struct game_play_s { /* 0x1DA0 */ pause_t pause; /* 0x1DA8 */ Actor_info actor_info; /* 0x1DEC */ Submenu submenu; - /* 0x1FA4 */ u8 _1FA4[0x2008 - 0x1FA4]; + /* 0x1FA4 */ s8 unk1FA4; + /* 0x1FA8 */ u8 _1FA4[0x1FB8 - 0x1FA8]; + /* 0x1FB8 */ PreRender prerender; + /* 0x2000 */ Door_data_c* door_data; + /* 0x2004 */ int _2004; /* 0x2008 */ int next_scene_no; /* 0x200C */ MtxF projection_matrix; - /* 0x204C */ MtxF mtx_204C; - /* 0x208C */ int _208C; - /* 0x2090 */ u32 game_frame; + /* 0x204C */ MtxF billboard_matrix; + /* 0x208C */ Mtx* _208C; + /* 0x2090 */ u32 game_frame; /* 0x2094 */ u8 _2094; /* 0x2095 */ u8 actor_data_num; /* 0x2096 */ u8 ctrl_actor_data_num; @@ -63,12 +70,45 @@ struct game_play_s { /* 0x2318 */ fbdemo_fade color_fade; /* 0x2328 */ CollisionCheck_c collision_check; /* 0x23F8 */ DRAW_CHK_PROC draw_chk_proc; // only used by mikanbox actor - /* 0x23FC */ u8 _23FC[0x2600 - 0x23FC]; + /* 0x23FC */ u32 fade_color_value; + /* 0x2400 */ Scene_status_c* scene_data_2400; + /* 0x2404 */ u8 _2400[0x2600 - 0x2404]; }; +extern fbdemo_c fbdemo; -extern void play_init(GAME_PLAY* play); -extern void play_cleanup(GAME_PLAY* play); +extern void Game_play_Reset_destiny(); +extern void event_title_flag_on(); +extern void event_title_flag_off(); +extern void Game_play_camera_proc(GAME_PLAY *); +extern void Game_play_fbdemo_wipe_destroy(GAME_PLAY *); +extern void Game_play_fbdemo_wipe_create_sub(GAME_PLAY *); +extern void Game_play_fbdemo_wipe_create(GAME_PLAY *); +extern void Game_play_fbdemo_wipe_init(GAME_PLAY *); +extern void Game_play_fbdemo_fade_in_move_end(GAME_PLAY *); +extern void Game_play_fbdemo_fade_out_start_emu_move_end(GAME_PLAY *); +extern void Game_play_fbdemo_fade_out_game_end_move_end(GAME_PLAY *); +extern void Game_play_change_scene_move_end(GAME_PLAY *); +extern void Game_play_fbdemo_wipe_move(GAME_PLAY *); +extern void Game_play_fbdemo_wipe_proc(GAME_PLAY *); +extern Gfx* game_play_set_fog(GAME_PLAY *, Gfx *); +extern void Game_play_fbdemo_proc(GAME_PLAY *); +extern void play_cleanup(GAME *); +extern void VR_Box_ct(GAME_PLAY *); +extern void play_init(GAME *); +extern void Game_play_move_fbdemo_not_move(GAME_PLAY *); +extern void Game_play_move(GAME_PLAY *); +extern void setupFog(GAME_PLAY *, GRAPH *); +extern void setupViewer(GAME_PLAY *); +extern void setupViewMatrix(GAME_PLAY *, GRAPH *, GRAPH *); +extern void copy_efb_to_texture(Gfx **, void *); +extern int makeBumpTexture(GAME_PLAY *, GRAPH *, GRAPH *); +extern void draw_version(GRAPH *); +extern void Game_play_draw(GAME *); +extern void play_main(GAME *); +extern void Gameplay_Scene_Init(GAME_PLAY *); +extern u8 mPl_SceneNo2SoundRoomType(int); +extern void Gameplay_Scene_Read(GAME_PLAY *, s16); #ifdef __cplusplus } diff --git a/include/m_player_lib.h b/include/m_player_lib.h index 18ce0144..51980270 100644 --- a/include/m_player_lib.h +++ b/include/m_player_lib.h @@ -9,9 +9,11 @@ extern "C" { #endif +extern void mPlib_Object_Exchange_keep_Player_dt(GAME_PLAY*); extern PLAYER_ACTOR* get_player_actor_withoutCheck(GAME_PLAY* play); extern void mPlib_SetData1_controller_data_for_title_demo(f32 stick_x, f32 stick_y, int btn_a, int btn_b); extern void mPlib_SetData2_controller_data_for_title_demo(mActor_name_t tool); +extern void mPlib_Clear_controller_data_for_title_demo(); extern void mPlib_request_main_invade_type1(GAME_PLAY* play); extern mActor_name_t mPlib_Get_itemNo_forWindow(); extern int mPlib_check_able_change_camera_normal_index(); diff --git a/include/m_scene.h b/include/m_scene.h index dfbcee91..ab67bdbd 100644 --- a/include/m_scene.h +++ b/include/m_scene.h @@ -2,7 +2,6 @@ #define M_SCENE_H #include "types.h" -#include "m_scene_table.h" #include "m_lib.h" #ifdef __cplusplus @@ -39,8 +38,71 @@ typedef struct object_exchange_s { u8 _1934[0x1958-0x1934]; } Object_Exchange_c; +typedef struct scene_status_s{ + u8 unk0[0x13]; + u8 unk13; +}Scene_status_c; + +extern Scene_status_c test01_info; +extern Scene_status_c test02_info; +extern Scene_status_c test03_info; +extern Scene_status_c water_test_info; +extern Scene_status_c test_step01_info; +extern Scene_status_c test04_info; +extern Scene_status_c npc_room01_info; +extern Scene_status_c test_fd_npc_land_info; +extern Scene_status_c field_tool_field_info; +extern Scene_status_c shop01_info; +extern Scene_status_c BG_TEST01_info; +extern Scene_status_c BG_TEST01_XLU_info; +extern Scene_status_c broker_shop_info; +extern Scene_status_c fg_tool_in_info; +extern Scene_status_c post_office_info; +extern Scene_status_c start_demo1_info; +extern Scene_status_c start_demo2_info; +extern Scene_status_c police_box_info; +extern Scene_status_c buggy_info; +extern Scene_status_c player_select_info; +extern Scene_status_c player_room_s_info; +extern Scene_status_c player_room_m_info; +extern Scene_status_c player_room_l_info; +extern Scene_status_c shop02_info; +extern Scene_status_c shop03_info; +extern Scene_status_c shop04_1f_info; +extern Scene_status_c test05_info; +extern Scene_status_c PLAYER_SELECT2_info; +extern Scene_status_c PLAYER_SELECT3_info; +extern Scene_status_c shop04_2f_info; +extern Scene_status_c event_notification_info; +extern Scene_status_c kamakura_info; +extern Scene_status_c field_tool_field_info; +extern Scene_status_c title_demo_info; +extern Scene_status_c PLAYER_SELECT4_info; +extern Scene_status_c museum_entrance_info; +extern Scene_status_c museum_picture_info; +extern Scene_status_c museum_fossil_info; +extern Scene_status_c museum_insect_info; +extern Scene_status_c museum_fish_info; +extern Scene_status_c player_room_ll1_info; +extern Scene_status_c player_room_ll2_info; +extern Scene_status_c p_room_bm_s_info; +extern Scene_status_c p_room_bm_m_info; +extern Scene_status_c p_room_bm_l_info; +extern Scene_status_c p_room_bm_ll1_info; +extern Scene_status_c NEEDLEWORK_info; +extern Scene_status_c player_room_island_info; +extern Scene_status_c npc_room_island_info; +extern Scene_status_c start_demo3_info; +extern Scene_status_c lighthouse_info; +extern Scene_status_c tent_info; + extern int mSc_bank_regist_check(Object_Exchange_c* exchange, s16 bank_id); extern void mSc_regist_initial_exchange_bank(GAME_PLAY* play); +extern void mSc_dmacopy_data_bank(Object_Exchange_c*); +extern void mSc_data_bank_ct(GAME_PLAY*, Object_Exchange_c*); +extern void Door_info_ct(Door_data_c**); +extern void Scene_ct(GAME_PLAY*, void*); +extern void mSc_decide_exchange_bank(Object_Exchange_c*); #ifdef __cplusplus } diff --git a/include/m_scene_table.h b/include/m_scene_table.h index dfc074f5..0d696412 100644 --- a/include/m_scene_table.h +++ b/include/m_scene_table.h @@ -2,6 +2,7 @@ #define M_SCENE_TABLE_H #include "types.h" +#include "m_scene.h" #ifdef __cplusplus extern "C" { @@ -78,6 +79,9 @@ enum scene_table { SCENE_NUM }; + +extern Scene_status_c scene_data_status[SCENE_NUM]; + #ifdef __cplusplus } #endif diff --git a/include/m_submenu.h b/include/m_submenu.h index 45c639dc..4c81aea4 100644 --- a/include/m_submenu.h +++ b/include/m_submenu.h @@ -104,6 +104,13 @@ struct submenu_s { }; extern void mSM_open_submenu(Submenu* submenu, int menu_type, int arg0, int arg1); +extern void mSM_submenu_dt(Submenu*); +extern void mSM_submenu_ovlptr_cleanup(Submenu*); +extern void mSM_submenu_ovlptr_init(GAME_PLAY*); +extern void mSM_submenu_ct(Submenu*); +extern void mSM_submenu_ctrl(GAME_PLAY*); +extern void mSM_submenu_move(Submenu*); +extern void mSM_submenu_draw(Submenu*, GAME_PLAY*); extern int mSM_CHECK_ALL_FISH_GET(); extern int mSM_CHECK_ALL_INSECT_GET(); diff --git a/include/m_titledemo.h b/include/m_titledemo.h index d9046b2a..d6a90579 100644 --- a/include/m_titledemo.h +++ b/include/m_titledemo.h @@ -25,6 +25,7 @@ extern u16 pact4_head_table[]; extern int mTD_demono_get(); extern void title_demo_move(GAME_PLAY* play); +extern void mTD_player_keydata_init(GAME_PLAY* play); extern void mTD_rtc_set(); extern void mTD_rtc_reserve(); extern int mTD_get_titledemo_no(); diff --git a/include/version.h b/include/version.h new file mode 100644 index 00000000..6d78fc45 --- /dev/null +++ b/include/version.h @@ -0,0 +1,9 @@ +#ifndef VERSION_H +#define VERSION_H + +#include "types.h" + +extern char __Creator__[]; +extern char __DateTime__[]; + +#endif \ No newline at end of file diff --git a/rel/ac_animal_logo_misc.c b/rel/ac_animal_logo_misc.c index b41cf77e..b9970490 100644 --- a/rel/ac_animal_logo_misc.c +++ b/rel/ac_animal_logo_misc.c @@ -9,6 +9,7 @@ #include "m_time.h" #include "m_titledemo.h" #include "m_event.h" +#include "m_scene_table.h" extern void flash_rom_and_player_info_clear() { Save* save = Common_GetPointer(save); diff --git a/rel/audio.c b/rel/audio.c index 6e9472c4..c562f2cb 100644 --- a/rel/audio.c +++ b/rel/audio.c @@ -341,12 +341,12 @@ extern void sAdo_LevSeEcho(u8 b){ Na_LevSeEcho(b); } -extern void sAdo_BgmFadeoutCheck(){ +extern u8 sAdo_BgmFadeoutCheck(){ Na_BgmFadeoutCheck(); } -extern void sAdo_SeFadeoutCheck(){ +extern u8 sAdo_SeFadeoutCheck(){ Na_SeFadeoutCheck(); } diff --git a/rel/m_actor.c b/rel/m_actor.c index a2f64a9a..655fc5ff 100644 --- a/rel/m_actor.c +++ b/rel/m_actor.c @@ -323,7 +323,7 @@ extern void Actor_info_ct(GAME* game, Actor_info* actor_info, Actor_data* player bzero(actor_info, sizeof(Actor_info)); actor_dlftbls_init(); - Matrix_copy_MtxF(&play->mtx_204C, &MtxF_clear); + Matrix_copy_MtxF(&play->billboard_matrix, &MtxF_clear); Matrix_copy_MtxF(&play->projection_matrix, &MtxF_clear); /* Reset the actor dlf table info */ diff --git a/rel/m_all_grow.c b/rel/m_all_grow.c index aec33a24..9715a384 100644 --- a/rel/m_all_grow.c +++ b/rel/m_all_grow.c @@ -9,6 +9,7 @@ #include "m_collision_bg.h" #include "zurumode.h" #include "m_common_data.h" +#include "m_scene_table.h" static mActor_name_t l_tree_max_table[mAGrw_FRUIT_NUM] = { TREE_APPLE_FRUIT, diff --git a/rel/m_all_grow_ovl.c b/rel/m_all_grow_ovl.c index 6e2d1913..485d73b5 100644 --- a/rel/m_all_grow_ovl.c +++ b/rel/m_all_grow_ovl.c @@ -10,6 +10,7 @@ #include "m_house.h" #include "m_snowman.h" #include "m_shop.h" +#include "m_scene_table.h" #ifdef MUST_MATCH #include "ppcdis.h" diff --git a/rel/m_eappli.c b/rel/m_eappli.c index 700af571..b38ead6b 100644 --- a/rel/m_eappli.c +++ b/rel/m_eappli.c @@ -3,7 +3,7 @@ #include "m_common_data.h" #include "m_private.h" #include "lb_rtc.h" -#include "m_scene.h" +#include "m_scene_table.h" #include "m_malloc.h" #include "libjsys/jsyswrapper.h" diff --git a/rel/m_fbdemo.c b/rel/m_fbdemo.c index 7e4caded..efd539ea 100644 --- a/rel/m_fbdemo.c +++ b/rel/m_fbdemo.c @@ -3,6 +3,7 @@ #include "libc64/malloc.h" #include "libc64/sleep.h" #include "libultra/gu.h" +#include "m_play.h" Gfx fbdemo_gfx_init[] = { gsDPPipeSync(), @@ -19,7 +20,7 @@ Gfx fbdemo_gfx_init[] = { gsSPEndDisplayList(), }; -extern void fbdemo_init_gfx(fbdemo* this) { +extern void fbdemo_init_gfx(fbdemo_c* this) { int col; int col2; int colTex; @@ -87,7 +88,7 @@ extern void fbdemo_init_gfx(fbdemo* this) { gSPEndDisplayList(gfx++); } -extern void fbdemo_init_data(fbdemo* this) { +extern void fbdemo_init_data(fbdemo_c* this) { int col; int row; @@ -99,7 +100,7 @@ extern void fbdemo_init_data(fbdemo* this) { } } -extern void fbdemo_cleanup(fbdemo* this) { +extern void fbdemo_cleanup(fbdemo_c* this) { msleep(100); if (this->vtxData != NULL) { @@ -120,7 +121,7 @@ extern void fbdemo_cleanup(fbdemo* this) { } } -extern fbdemo* fbdemo_init(fbdemo* this, int cols, int rows) { +extern fbdemo_c* fbdemo_init(fbdemo_c* this, int cols, int rows) { s32 gridsize; bzero(this, sizeof(fbdemo)); @@ -168,7 +169,7 @@ extern fbdemo* fbdemo_init(fbdemo* this, int cols, int rows) { return this; } -extern void fbdemo_update(fbdemo* this) { +extern void fbdemo_update(fbdemo_c* this) { int col; int row; Vtx* vtx; @@ -186,7 +187,7 @@ extern void fbdemo_update(fbdemo* this) { } } -void fbdemo_draw(fbdemo* this, Gfx** gfxP) { +void fbdemo_draw(fbdemo_c* this, Gfx** gfxP) { Gfx* gfx = *gfxP; gSPDisplayList(gfx++, fbdemo_gfx_init); @@ -204,4 +205,4 @@ void fbdemo_draw(fbdemo* this, Gfx** gfxP) { *gfxP = gfx; } -extern void fbdemo_move(fbdemo* this) {} +extern void fbdemo_move(fbdemo_c* this) {} diff --git a/rel/m_fuusen.c b/rel/m_fuusen.c index 0bbda03f..396b001f 100644 --- a/rel/m_fuusen.c +++ b/rel/m_fuusen.c @@ -9,7 +9,7 @@ int fuusen_DEBUG_mode_flag; -extern void Balloon_init() { +extern void Balloon_init(GAME_PLAY*) { Common_Set(balloon_state, Balloon_STATE_DEAD); Common_Set(balloon_last_spawn_min, 0); Common_Set(balloon_spawn_percent, 0.05f); diff --git a/rel/m_museum_display.c b/rel/m_museum_display.c index ce2a909f..c0d29930 100644 --- a/rel/m_museum_display.c +++ b/rel/m_museum_display.c @@ -2,7 +2,7 @@ #include "m_name_table.h" #include "m_room_type.h" -#include "m_scene.h" +#include "m_scene_table.h" #include "m_common_data.h" extern int mMmd_FossilInfo(int fossil_no) { diff --git a/rel/m_play.c b/rel/m_play.c new file mode 100644 index 00000000..9cd8c971 --- /dev/null +++ b/rel/m_play.c @@ -0,0 +1,1018 @@ +#include "m_play.h" + +#include "m_common_data.h" +#include "libultra/libultra.h" +#include "m_fbdemo_wipe1.h" +#include "m_fbdemo_triforce.h" +#include "m_fbdemo_fade.h" +#include "m_debug.h" +#include "boot.h" +#include "version.h" +#include "m_bgm.h" +#include "m_rcp.h" +#include "m_msg.h" +#include "m_banti.h" +#include "m_event.h" +#include "m_npc.h" +#include "m_huusui_room.h" +#include "m_field_make.h" +#include "m_card.h" +#include "m_eappli.h" +#include "famicom_emu.h" +#include "Famicom/famicom.h" +#include "m_malloc.h" +#include "m_field_info.h" +#include "m_time.h" +#include "m_titledemo.h" +#include "sys_matrix.h" +#include "m_fuusen.h" +#include "m_watch_my_step.h" +#include "m_vibctl.h" +#include "m_train_control.h" +#include "gfxalloc.h" +#include "m_debug_display.h" +#include "jsyswrap.h" +#include "m_trademark.h" +#include "zurumode.h" +#include "m_scene_table.h" + +u16 S_back_title_timer; +u16 S_se_endcheck_timeout; +fbdemo_c fbdemo; +u8 gxbuf[0x140] ATTRIBUTE_ALIGN(32); +u8 prbuf[0x12c000] ATTRIBUTE_ALIGN(32); + +void Game_play_Reset_destiny(){ + lbRTC_time_c* rtc_time = Common_GetPointer(time.rtc_time); + mPr_destiny_c* destiny = &Common_Get(now_private)->destiny; + + if (destiny->type == mPr_DESTINY_NORMAL) { + return; + } + + if( + (rtc_time->year != destiny->received_time.year) || + (rtc_time->month != destiny->received_time.month) || + (rtc_time->day != destiny->received_time.day) + ) { + + Common_Set(now_private->destiny.type, mPr_DESTINY_NORMAL); + } +} + +void event_title_flag_on(){ + if(Common_Get(event_id) != 0){ + Common_Set(event_notification_active,1); + } +} + +void event_title_flag_off(){ + + if(Common_Get(event_id) == 2){ + Common_Set(event_id,0); + Common_Set(event_notification_active,0); + + } +} + +void Game_play_camera_proc(GAME_PLAY* play){ + + Camera2_ClearActorTalking_Cull(play); + Camera2_process(play); +} + +void Game_play_fbdemo_wipe_destroy(GAME_PLAY* play){ + + play->fbdemo_wipe.wipe_procs.cleanup_proc(&play->fbdemo_wipe.wipe_data); + play->fb_wipe_mode = 0; + play->fbdemo_wipe.wipe_type = -1; +} + +void Game_play_fbdemo_wipe_create_sub(GAME_PLAY* play){ + static void* wipe_normal_proc[] = { + fbdemo_wipe1_init, + none_proc1, + fbdemo_wipe1_move, + fbdemo_wipe1_draw, + fbdemo_wipe1_startup, + fbdemo_wipe1_settype, + fbdemo_wipe1_setcolor_rgba8888, + NULL, + fbdemo_wipe1_is_finish, + }; + static void* wipe_triforce_proc[] = { + fbdemo_triforce_init, + none_proc1, + fbdemo_triforce_move, + fbdemo_triforce_draw, + fbdemo_triforce_startup, + fbdemo_triforce_settype, + fbdemo_triforce_setcolor_rgba8888, + NULL, + fbdemo_triforce_is_finish, + }; + static void* wipe_fade_proc[] = { + fbdemo_fade_init, + none_proc1, + fbdemo_fade_move, + fbdemo_fade_draw, + fbdemo_fade_startup, + fbdemo_fade_settype, + fbdemo_fade_setcolor_rgba8888, + NULL, + fbdemo_fade_is_finish, + }; + + static void* wipe_proc[] = { + wipe_normal_proc, + wipe_triforce_proc, + wipe_fade_proc, + wipe_fade_proc, + wipe_triforce_proc, + wipe_triforce_proc, + wipe_fade_proc, + }; + + int type = play->fb_wipe_type; + fbdemo_wipe_proc_c* cur; + + + bzero(&play->fbdemo_wipe, sizeof(fbdemo_wipe)); + + if(type >= 7){ + type = 1; + } + + play->fbdemo_wipe.wipe_type = type; + cur = wipe_proc[type]; + play->fbdemo_wipe.wipe_procs.init_proc = cur->init_proc; + play->fbdemo_wipe.wipe_procs.cleanup_proc = cur->cleanup_proc; + play->fbdemo_wipe.wipe_procs.move_proc = cur->move_proc; + play->fbdemo_wipe.wipe_procs.draw_proc = cur->draw_proc; + play->fbdemo_wipe.wipe_procs.startup_proc = cur->startup_proc; + play->fbdemo_wipe.wipe_procs.settype_proc = cur->settype_proc; + play->fbdemo_wipe.wipe_procs.setcolor_proc = cur->setcolor_proc; + play->fbdemo_wipe.wipe_procs.isfinished_proc = cur->isfinished_proc; +} + +void Game_play_fbdemo_wipe_create(GAME_PLAY* play){ + + Game_play_fbdemo_wipe_create_sub(play); + Game_play_fbdemo_wipe_init(play); +} + +void Game_play_fbdemo_wipe_init(GAME_PLAY* play){ + fbdemo_wipe* wipe = &play->fbdemo_wipe; + u8 type; + + play->fbdemo_wipe.wipe_procs.init_proc(&wipe->wipe_data); + + Common_Set(transWipeSpeed, 28); + Common_Set(transFadeDuration, 30); + + wipe->wipe_procs.setcolor_proc(&wipe->wipe_data,0); + + type = play->fb_fade_type; + + if(wipe->wipe_type == 4){ + type |= 0x80; + } + else if(wipe->wipe_type == 5){ + type |= 0x40; + } + wipe->wipe_procs.settype_proc(&wipe->wipe_data, type); + wipe->wipe_procs.startup_proc(&wipe->wipe_data); + + play->fb_wipe_mode = 3; + + S_back_title_timer = 120; + S_se_endcheck_timeout = 120; +} + +void Game_play_fbdemo_fade_in_move_end(GAME_PLAY* play){ + Game_play_fbdemo_wipe_destroy(play); + + if(play->fb_mode == 3){ + fbdemo_cleanup(&fbdemo); + play->fb_mode = 0; + SetGameFrame(3); + } +} + +void Game_play_fbdemo_fade_out_start_emu_move_end(GAME_PLAY* play){ + + GAME_GOTO_NEXT(&play->game, famicom_emu, FAMICOM_EMU); + +} + +void Game_play_fbdemo_fade_out_game_end_move_end(GAME_PLAY* play){ + + GAME_GOTO_NEXT(&play->game, trademark, TRADEMARK); +} + +void Game_play_change_scene_move_end(GAME_PLAY* play){ + + game_goto_next_game_play(&play->game); + Common_Set(last_scene_no, Save_Get(scene_no)); + Save_Set(scene_no,play->next_scene_no); + +} + +void Game_play_fbdemo_wipe_move(GAME_PLAY* play){ + fbdemo_wipe* wipe = &play->fbdemo_wipe; + s16 wipet = FALSE; + int isDone = TRUE; + + if(wipe->wipe_procs.isfinished_proc(&wipe->wipe_data) != 0) { + if((play->fb_fade_type != 1) && (play->fb_fade_type != 11)){ + if(S_se_endcheck_timeout != 0){ + S_se_endcheck_timeout--; + } + + if((sAdo_SeFadeoutCheck() == 0) && (S_se_endcheck_timeout != 0)){ + isDone = FALSE; + } + else{ + sAdo_Set_ongenpos_refuse_fg(1); + } + } + if(play->fb_fade_type == 11){ + sAdo_Set_ongenpos_refuse_fg(2); + } + + if(isDone == TRUE){ + switch(play->fb_fade_type){ + case 1: + Game_play_fbdemo_fade_in_move_end(play); + break; + + case 3: + if(S_back_title_timer != 0){ + S_back_title_timer--; + } + + if((sAdo_BgmFadeoutCheck() == 1) || (S_back_title_timer == 0)){ + Game_play_fbdemo_fade_out_start_emu_move_end(play); + } + else{ + wipet = TRUE; + } + break; + + case 4: + case 6: + if(S_back_title_timer == 120){ + mBGMPsComp_make_ps_wipe(360); + } + case 5: + case 10: + if(S_back_title_timer != 0){ + S_back_title_timer--; + } + + if((sAdo_BgmFadeoutCheck() == 1) || (S_back_title_timer == 0)){ + Game_play_fbdemo_fade_out_game_end_move_end(play); + } + else{ + wipet = TRUE; + } + break; + + case 8: + if(S_back_title_timer != 0){ + S_back_title_timer--; + } + + if((sAdo_BgmFadeoutCheck() == 1) || (S_back_title_timer == 0)){ + if((Common_Get(clip.animal_logo_clip) != NULL) && + (Common_Get(clip.animal_logo_clip->data_init_proc) != NULL)){ + Common_Get(clip.animal_logo_clip->data_init_proc)(play); + Game_play_change_scene_move_end(play); + } + } + else{ + wipet = TRUE; + } + break; + + case 9: + if(S_back_title_timer != 0){ + S_back_title_timer--; + } + + if((sAdo_BgmFadeoutCheck() == 1) || (S_back_title_timer == 0)){ + Game_play_change_scene_move_end(play); + } + else{ + wipet = TRUE; + } + break; + + case 11: + case 12: + Game_play_change_scene_move_end(play); + break; + + + default: + if(S_back_title_timer != 0){ + S_back_title_timer--; + } + + if((sAdo_BgmFadeoutCheck() == 1) || (S_back_title_timer == 0)){ + Game_play_change_scene_move_end(play); + } + else{ + wipet = TRUE; + } + break; + } + if(!wipet){ + play->fb_fade_type = 0; + } + } + } + else { + wipe->wipe_procs.move_proc(&wipe->wipe_data, game_GameFrame); + } +} + + +void Game_play_fbdemo_wipe_proc(GAME_PLAY* play){ + static PLAY_WIPE_PROC wipe_proc[] = { + (PLAY_WIPE_PROC)none_proc1,Game_play_fbdemo_wipe_create, + Game_play_fbdemo_wipe_init,Game_play_fbdemo_wipe_move + }; + + if((play->fb_wipe_mode == 0) && (play->fb_fade_type != 0)){ + play->fb_wipe_mode = 1; + } + + wipe_proc[play->fb_wipe_mode](play); +} + +Gfx* game_play_set_fog(GAME_PLAY* play, Gfx* gfx){ + + return gfx_set_fog_nosync(gfx, play->global_light.fogColor[0], play->global_light.fogColor[1], + play->global_light.fogColor[2], 0, play->global_light.fogNear, play->global_light.fogFar); +} + +void Game_play_fbdemo_proc(GAME_PLAY* play){ + + switch(play->fb_mode){ + case 2: + if(fbdemo_init(&fbdemo, 10, 7) == 0){ + play->fb_mode = 0; + } + else{ + play->fb_mode = 3; + SetGameFrame(1); + } + break; + + case 3: + fbdemo_move(&fbdemo); + break; + } +} + +void play_cleanup(GAME* game){ + GAME_PLAY* play = (GAME_PLAY*)game; + + mMsg_dt(play); + banti_dt(); + + play->game.graph->taskEndCallback = NULL; + play->game.graph->taskEndData = NULL; + play->submenu.mode = 0; + + PreRender_cleanup(&play->prerender); + CollisionCheck_dt(play, &play->collision_check); + + if(play->fb_mode == 3){ + fbdemo_cleanup(&fbdemo); + play->fb_mode = 0; + } + + if(play->fb_wipe_mode == 3){ + Game_play_fbdemo_wipe_destroy(play); + } + + Actor_info_dt(&play->actor_info, play); + mEv_finish(&play->event); + mNpc_ClearEventNpc(); + mNpc_ClearMaskNpc(); + + mSM_submenu_dt(&play->submenu); + play->unk1FA4 = -1; + mSM_submenu_ovlptr_cleanup(&play->submenu); + + mPlib_Object_Exchange_keep_Player_dt(play); + + mHsRm_GetHuusuiRoom(NULL, Common_Get(player_no)); + mFM_Field_dt(); + mCD_toNextLand(); + mEA_CleanCardDLProgram(); + + if(my_malloc_current == my_malloc_func){ + my_malloc_current = NULL; + } + + zelda_CleanupArena(); + +} + +void VR_Box_ct(GAME_PLAY* play){ + + Global_kankyo_ct(play, &play->kankyo); +} + +void play_init(GAME* game){ + GAME_PLAY* play = (GAME_PLAY*)game; + + GRAPH* graph = play->game.graph; + int type; + fbdemo_fade* fade; + int freebytes; + u32 alloc; + u32 aligned; + u32 size; + + game_resize_hyral(&play->game, 0xFFFC1800); + Common_Set(rhythym_updated,0); + + mFI_ChangeClimate_ForEventNotice(); + mTM_time_init(); + sAdo_Set_ongenpos_refuse_fg(0); + event_title_flag_on(); + mTD_rtc_set(); + mTM_set_season(); + mPlib_Clear_controller_data_for_title_demo(); + + mSM_submenu_ovlptr_init(play); + mDemo_Init(play); + mEv_init(&play->event); + + initView(&play->view, graph); + Init_Camera2(play); + CollisionCheck_ct(play, &play->collision_check); + + mCoBG_InitMoveBgData(); + mCoBG_InitBlockBgCheckMode(); + mCoBG_InitDecalCircle(); + + play->unk1FA4 = -1; + + Gameplay_Scene_Read(play, Save_Get(scene_no)); + + mSM_submenu_ct(&play->submenu); + play->submenu.mode = 0; + + PreRender_init(&play->prerender); + PreRender_setup_savebuf(&play->prerender, SCREEN_WIDTH * 2 ,SCREEN_HEIGHT * 2, 0, 0, 0 ); + PreRender_setup_renderbuf(&play->prerender, SCREEN_WIDTH * 2, SCREEN_HEIGHT * 2, 0,0); + + play->fb_mode = 0; + type = 1; + + play->fb_wipe_mode = 0; + play->fb_fade_type = 1; + + if(Common_Get(wipeType) != 0xFF){ + type = Common_Get(wipeType); + Common_Set(wipeType, 0xFF); + } + + play->fb_wipe_type = type; + + Pause_ct(&play->pause); + new_Matrix(&play->game); + + fade = &play->color_fade; + + play->game.exec = play_main; + play->game.cleanup = play_cleanup; + fbdemo_fade_init(fade); + fbdemo_fade_settype(fade, 7); + fbdemo_fade_setcolor_rgba8888(fade, 0xA0A0A0FF); + fbdemo_fade_startup(fade); + + play->fade_color_value = 0; + + freebytes = game_getFreeBytes(&play->game); + alloc = (u32)THA_alloc16(&play->game.tha, freebytes); + aligned = ALIGN_NEXT(alloc, 16); + size = aligned - alloc; + + zelda_InitArena((void*)aligned, freebytes - size); + + if(my_malloc_current == NULL){ + my_malloc_current = my_malloc_func; + } + + mFM_FieldInit(play); + VR_Box_ct(play); + mMmd_MakeMuseumDisplayData(); + Actor_info_ct(&play->game, &play->actor_info, play->player_data); + play->draw_chk_proc = none_proc1; + mMsg_ct(play); + mEv_2nd_init(&play->event); + mTD_player_keydata_init(play); + Balloon_init(play); + mNtc_set_auto_nwrite_data(); + banti_ct(); + watch_my_step_ct(); + event_title_flag_off(); + mEA_GetCardDLProgram(); +} + +void Game_play_move_fbdemo_not_move(GAME_PLAY* play){ + + play->game.doing_point = 0; + play->game.doing_point_specific = 0x8F; + play->game.doing_point = 1; + + mSM_submenu_ctrl(play); + + if(play->submenu.process_status == 0){ + + play->game.doing_point = 2; + mDemo_Main(play); + play->game.doing_point = 3; + mEv_run(&play->event); + } + + play->game.doing_point = 4; + mDemo_stock_clear(); + play->game.doing_point = 5; + mSc_dmacopy_data_bank(&play->object_exchange); + play->game.doing_point = 6; + mSM_submenu_move(&play->submenu); + + if(play->submenu.process_status == 0){ + + play->game_frame++; + mVibctl_clr_force_stop(2); + play->game.doing_point = 7; + CollisionCheck_OC(play, &play->collision_check); + play->game.doing_point = 8; + CollisionCheck_clear(play, &play->collision_check); + play->game.doing_point = 9; + play->game.doing_point = 0; + play->game.doing_point_specific = 0x90; + Actor_info_call_actor(play, &play->actor_info); + play->game.doing_point = 0; + play->game.doing_point_specific = 0x91; + play->game.doing_point = 1; + mCoBG_CalcTimerDecalCircle(); + play->game.doing_point = 2; + mMsg_Main(play); + } + else{ + mVibctl_set_force_stop(2); + } + + fbdemo_fade_move(&play->color_fade, game_GameFrame); + +} + +void Game_play_move(GAME_PLAY* play){ + + int debug; + + play->game.doing_point = 0; + play->game.doing_point_specific = 0x8D; + play->game.doing_point = 1; + Game_play_Reset_destiny(); + play->game.doing_point = 2; + + debug = (zurumode_flag >= 2) ? (Pause_proc(&play->pause, &play->game.pads[1]) == 0) : 0; + + play->game.doing_point = 0; + play->game.doing_point_specific = 0x8E; + + if(debug == 0){ + + play->game.doing_point = 1; + Game_play_fbdemo_wipe_proc(play); + play->game.doing_point = 2; + Game_play_fbdemo_proc(play); + play->game.doing_point = 3; + + if(play->fb_mode != 3){ + Game_play_move_fbdemo_not_move(play); + } + } + + if(play->submenu.process_status == 0){ + + play->game.doing_point = 0; + play->game.doing_point_specific = 0x92; + play->game.doing_point = 1; + Game_play_camera_proc(play); + play->game.doing_point = 2; + mPO_business_proc(play); + play->game.doing_point = 3; + mTRC_move(play); + play->game.doing_point = 4; + Balloon_move(play); + mEnv_ManagePointLight(play, &play->kankyo, &play->global_light); + + } + + play->game.doing_point = 0; + play->game.doing_point_specific = 0x93; + play->game.doing_point = 1; + Global_kankyo_set(play, &play->kankyo, &play->global_light); + play->game.doing_point = 2; + mEnv_WindMove(); + play->game.doing_point = 3; + watch_my_step_move(play); + play->game.doing_point = 4; + banti_move(play); + play->game.doing_point = 5; + title_demo_move(play); + play->game.doing_point = 0; + play->game.doing_point_specific = 0x95; + +} + + +void setupFog(GAME_PLAY* play, GRAPH* graph){ + + OPEN_DISP(graph); + + SET_POLY_OPA_DISP(game_play_set_fog(play, NOW_POLY_OPA_DISP)); + SET_POLY_XLU_DISP(game_play_set_fog(play, NOW_POLY_XLU_DISP)); + + + CLOSE_DISP(graph); +} + +void setupViewer(GAME_PLAY* play) { + + showView(&play->view, 0xF); +} + +void setupViewMatrix(GAME_PLAY* play, GRAPH* graph1, GRAPH* graph2){ + Mtx* t; + + OPEN_DISP(graph1); + + + Matrix_MtxtoMtxF(&play->view.mtx_viewing, &play->billboard_matrix); + Matrix_MtxtoMtxF(&play->view.mtx_projection, &play->projection_matrix); + Skin_Matrix_MulMatrix(&play->projection_matrix, &play->billboard_matrix, &play->projection_matrix); + + play->billboard_matrix.mf[0][3] = 0.0f; + play->billboard_matrix.mf[1][3] = 0.0f; + play->billboard_matrix.mf[2][3] = 0.0f; + play->billboard_matrix.mf[3][0] = 0.0f; + play->billboard_matrix.mf[3][1] = 0.0f; + play->billboard_matrix.mf[3][2] = 0.0f; + + Matrix_reverse(&play->billboard_matrix); + + t = _MtxF_to_Mtx(&play->billboard_matrix, GRAPH_ALLOC(graph2, sizeof(MtxF) * 1)); + play->_208C = t; + + gSPSegment(NEXT_BG_OPA_DISP, 7, play->_208C); + gSPSegment(NEXT_POLY_OPA_DISP, 7, play->_208C); + + + CLOSE_DISP(graph1); +} + + void copy_efb_to_texture(Gfx** graph, void* buf){ + u32 dl; + + GXBeginDisplayList(gxbuf, sizeof(gxbuf)); + GXSetTexCopySrc(0,0,SCREEN_WIDTH * 2,SCREEN_HEIGHT * 2); + GXSetTexCopyDst(SCREEN_WIDTH * 2, SCREEN_HEIGHT *2, GX_TF_RGB565, 0); + GXSetCopyFilter(0,0,0,0); + GXCopyTex(buf, 0); + dl = GXEndDisplayList(); + gGXCallDisplayList((*graph)++, gxbuf ,dl); + } + +int makeBumpTexture(GAME_PLAY* play, GRAPH* graph1, GRAPH* graph2){ + + Gfx* newdisp; + Gfx* polydisp; + Gfx* rect_disp; + View* v; + Gfx* fbdemo_disp; + Gfx* fb_disp; + Gfx* old_fb; + Gfx* poly; + View view; + rect rect; + + OPEN_DISP(graph1); + + if((GETREG(HREG, 80) != 10) || (GETREG(HREG, 92) != 0)){ + + newdisp = NOW_POLY_OPA_DISP; + polydisp = gfxopen(newdisp); + + gSPDisplayList(NEXT_OVERLAY_DISP, polydisp); + + if(play->fb_wipe_mode == 3){ + v = &view; + initView(v, graph2); + v->flag = 10; + rect.top = 0; + rect.bottom = SCREEN_HEIGHT; + rect.l = 0; + rect.r = SCREEN_WIDTH; + setScissorView(v, &rect); + showView1(v, 15, &polydisp); + play->fbdemo_wipe.wipe_procs.draw_proc(&play->fbdemo_wipe.wipe_data, &polydisp); + } + + fbdemo_fade_draw(&play->color_fade, &polydisp); + fade_rgba8888_draw(&polydisp, play->fade_color_value); + + gSPEndDisplayList(polydisp++); + + gfxclose(newdisp, polydisp); + + SET_POLY_OPA_DISP(polydisp); + } + + if(play->fb_mode == 3){ + fbdemo_disp = NOW_POLY_OPA_DISP; + fbdemo_draw(&fbdemo, &fbdemo_disp); + SET_POLY_OPA_DISP(fbdemo_disp); + return 1; + } + + if(play->submenu.mode == 2){ + play->submenu.mode = 3; + SETREG(SREG, 3, -(GETREG(SREG, 3))); + } + else if(play->submenu.mode >= 5){ + play->submenu.mode = 0; + } + + if(play->submenu.mode == 3){ + poly = NOW_POLY_OPA_DISP; + + gDPPipeSync(poly++); + rect_disp = gfx_rect_moji(poly++); + gDPSetOtherMode(rect_disp++, G_AD_PATTERN | G_CD_MAGICSQ | G_CK_NONE | G_TC_CONV | G_TF_POINT | + G_TT_NONE | G_TL_TILE | G_TD_CLAMP | G_TP_NONE | G_CYC_COPY | G_PM_NPRIMITIVE, + G_AC_NONE | G_ZS_PIXEL | G_RM_NOOP | G_RM_NOOP2); + gDPSetTextureImage_Dolphin(rect_disp++, G_IM_FMT_I, G_IM_SIZ_16b, 480, 640, prbuf); + gDPSetTile_Dolphin(rect_disp++, G_DOLPHIN_TLUT_DEFAULT_MODE, 0, 0, 0, 0, 0, 0); + gSPTextureRectangle(rect_disp++, 0, 0, (640-1) << 2, (480-1) << 2, G_TX_RENDERTILE, 0, 0, (256) << 2, (256) << 2); + + SET_POLY_OPA_DISP(rect_disp); + return 1; + } + + if((GETREG(HREG, 80) != 10) || (GETREG(HREG, 85) != 0)){ + Actor_info_draw_actor(play, &play->actor_info); + Camera2_draw(play); + mMsg_Draw(play); + } + + if((GETREG(HREG, 80) != 10) || (GETREG(HREG, 93) != 0)){ + Debug_Display_output(play); + } + + if((play->submenu.mode == 1) || (play->fb_mode == 1)){ + + old_fb = NOW_POLY_OPA_DISP; + fb_disp = gfxopen(old_fb); + + gSPDisplayList(NEXT_LIGHT_DISP, fb_disp); + copy_efb_to_texture(&fb_disp, &prbuf); + gSPEndDisplayList(fb_disp++); + + gfxclose(old_fb, fb_disp); + + SET_POLY_OPA_DISP(fb_disp); + + if(play->submenu.mode == 1){ + play->submenu.mode = 2; + SETREG(SREG, 3, -(GETREG(SREG, 3))); + } + else { + play->fb_mode = 2; + } + return 1; + } + return 1; + CLOSE_DISP(graph1); +} + +void draw_version(GRAPH*) { + JW_JUTReport(0x82, 0x172, 1, "[CopyDate:%.19s]", boot_copyDate); + JW_JUTReport(0x82, 0x180, 1, "[Date:%s]" , &__DateTime__); + JW_JUTReport(0x82, 0x18E, 1, "[Creator:%s]", &__Creator__); +} + +void Game_play_draw(GAME* game){ + GRAPH* graph = game->graph; + GAME_PLAY* play = (GAME_PLAY*)game; + + + DisplayList_initialize(graph, 0,0,0,&play->game); + + if((GETREG(HREG, 80) != 10) || (GETREG(HREG, 82) != 0)){ + + setupFog(play, graph); + setupViewer(play); + setupViewMatrix(play, graph, graph); + + if((makeBumpTexture(play, graph, graph) == 1) && ((GETREG(HREG, 80) != 10) || (GETREG(HREG, 89) != 0))){ + + watch_my_step_draw(play); + banti_draw(play); + mSM_submenu_draw(&play->submenu, play); + } + } + if (zurumode_flag != 0) { + switch (mEv_CheckTitleDemo()) { + case -9: + case -1: + default: + draw_version(graph); + break; + + case 0: + break; + } + } +} + +void play_main(GAME* game) { + GAME_PLAY* play = (GAME_PLAY*)game; + + GRAPH* graph; + + game->doing_point = 0; + game->doing_point_specific = 0x6E; + fqrand(); + game->doing_point = 0; + game->doing_point_specific = 0x78; + mCon_main(game); + game->doing_point = 0; + game->doing_point_specific = 0x82; + Debug_Display_init(); + + if((GETREG(HREG, 80) == 10) && (GETREG(HREG, 94) != 10)){ + SETREG(HREG, 81,1); + SETREG(HREG, 82,1); + SETREG(HREG, 83,1); + SETREG(HREG, 84,3); + SETREG(HREG, 85,1); + SETREG(HREG, 86,1); + SETREG(HREG, 87,1); + SETREG(HREG, 88,1); + SETREG(HREG, 89,1); + SETREG(HREG, 90,15); + SETREG(HREG, 91,1); + SETREG(HREG, 92,1); + SETREG(HREG, 93,1); + SETREG(HREG, 94,10); + + } + + game->doing_point = 0; + game->doing_point_specific = 0x8C; + + if((GETREG(HREG, 80) != 10) || (GETREG(HREG, 81) != 0)){ + Game_play_move(play); + } + game->doing_point = 0; + game->doing_point_specific = 0xAA; + Game_play_draw(game); + + game->doing_point = 0; + game->doing_point_specific = 0xB4; + + graph = game->graph; + game_debug_draw_last(game, graph); + game_draw_last(graph); + + game->doing_point = 0; + game->doing_point_specific = 0XBe; +} + +void Gameplay_Scene_Init(GAME_PLAY* play){ + + play->player_data = NULL; + play->actor_data_num = 0; + play->ctrl_actor_data_num = 0; + play->obj_bank_data_num = 0; + play->_20A8 = 0; + + mSc_data_bank_ct(play, &play->object_exchange); + Global_light_ct(&play->global_light); + Door_info_ct(&play->door_data); + common_data_clear(); + Scene_ct(play, play->current_scene_data); + mSc_decide_exchange_bank(&play->object_exchange); + +} + +u8 mPl_SceneNo2SoundRoomType(int scene) { + switch (scene) { + case 20: + return 1; + + case 6: + case 9: + case 12: + case 14: + case 18: + case 21: + case 31: + case 41: + case 51: + return 2; + + case 22: + case 23: + case 24: + case 25: + case 29: + case 40: + case 47: + case 17: + return 3; + + default: + return 0; + } +} + +void Gameplay_Scene_Read(GAME_PLAY* play, s16 idx){ + static Scene_status_c* scene_word_data[SCENE_NUM] = { + &test01_info, + &test02_info, + &test03_info, + &water_test_info, + &test_step01_info, + &test04_info, + &npc_room01_info, + &test_fd_npc_land_info, + &field_tool_field_info, + &shop01_info, + &BG_TEST01_info, + &BG_TEST01_XLU_info, + &broker_shop_info, + &fg_tool_in_info, + &post_office_info, + &start_demo1_info, + &start_demo2_info, + &police_box_info, + &buggy_info, + &player_select_info, + &player_room_s_info, + &player_room_m_info, + &player_room_l_info, + &shop02_info, + &shop03_info, + &shop04_1f_info, + &test05_info, + &PLAYER_SELECT2_info, + &PLAYER_SELECT3_info, + &shop04_2f_info, + &event_notification_info, + &kamakura_info, + &field_tool_field_info, + &title_demo_info, + &PLAYER_SELECT4_info, + &museum_entrance_info, + &museum_picture_info, + &museum_fossil_info, + &museum_insect_info, + &museum_fish_info, + &player_room_ll1_info, + &player_room_ll2_info, + &p_room_bm_s_info, + &p_room_bm_m_info, + &p_room_bm_l_info, + &p_room_bm_ll1_info, + &NEEDLEWORK_info, + &player_room_island_info, + &npc_room_island_info, + &start_demo3_info, + &lighthouse_info, + &tent_info, + }; + + Scene_status_c* current = &scene_data_status[idx]; + + current->unk13 = 0; + play->scene_data_2400 = current; + play->scene_id = idx; + play->current_scene_data = scene_word_data[idx]; + current->unk13 = 0; + Gameplay_Scene_Init(play); + sAdo_RoomType(mPl_SceneNo2SoundRoomType(Save_Get(scene_no))); + +} \ No newline at end of file diff --git a/rel/m_post_office.c b/rel/m_post_office.c index dac9dbcd..de5390b0 100644 --- a/rel/m_post_office.c +++ b/rel/m_post_office.c @@ -14,6 +14,7 @@ #include "m_play.h" #include "libultra/libultra.h" #include "m_common_data.h" +#include "m_scene_table.h" static int mPO_keep_contents(Mail_c* mail) { int res = FALSE; diff --git a/rel/m_random_field.c b/rel/m_random_field.c index bc08dd4b..4b45e58e 100644 --- a/rel/m_random_field.c +++ b/rel/m_random_field.c @@ -4,7 +4,7 @@ #include "m_collision_bg.h" #include "m_field_info.h" #include "m_common_data.h" -#include "m_scene.h" +#include "m_scene_table.h" extern void mRF_MakeRandomField(mFM_combination_c* combi_table, mFM_combo_info_c* combo_info, int combo_count, GAME* game) { mRF_MakeRandomField_ovl(combi_table, combo_info, combo_count, game); diff --git a/rel/m_select.c b/rel/m_select.c index 04dfaf89..43ca8c45 100644 --- a/rel/m_select.c +++ b/rel/m_select.c @@ -6,7 +6,7 @@ #include "m_kabu_manager.h" #include "m_font.h" #include "m_time.h" -#include "m_scene.h" +#include "m_scene_table.h" #include "m_controller.h" #include "m_kankyo.h" #include "audio.h" diff --git a/rel/m_start_data_init.c b/rel/m_start_data_init.c index 3ce3e60d..5d9177d6 100644 --- a/rel/m_start_data_init.c +++ b/rel/m_start_data_init.c @@ -7,7 +7,7 @@ #include "m_font.h" #include "m_field_info.h" #include "m_field_make.h" -#include "m_scene.h" +#include "m_scene_table.h" #include "libultra/libultra.h" #include "m_cockroach.h" #include "m_melody.h" diff --git a/rel/m_titledemo.c b/rel/m_titledemo.c index 9ea77864..c94eb7e4 100644 --- a/rel/m_titledemo.c +++ b/rel/m_titledemo.c @@ -40,7 +40,7 @@ extern int mTD_demono_get() { return S_now_demono; } -static void mTD_player_keydata_init(GAME_PLAY* play) { +extern void mTD_player_keydata_init(GAME_PLAY* play) { PLAYER_ACTOR* player = get_player_actor_withoutCheck(play); if (mEv_CheckTitleDemo() > 0) { diff --git a/rel/m_trademark.c b/rel/m_trademark.c index 364e4718..6c2d4067 100644 --- a/rel/m_trademark.c +++ b/rel/m_trademark.c @@ -1,6 +1,6 @@ #include "m_trademark.h" -#include "m_scene.h" +#include "m_scene_table.h" #include "m_name_table.h" #include "m_npc.h" #include "m_kankyo.h" diff --git a/rel/m_watch_my_step.c b/rel/m_watch_my_step.c index adc0e001..a70085a8 100644 --- a/rel/m_watch_my_step.c +++ b/rel/m_watch_my_step.c @@ -16,7 +16,7 @@ #include "m_room_type.h" #include "m_msg.h" #include "audio.h" -#include "m_scene.h" +#include "m_scene_table.h" #include "m_private.h" typedef struct watch_my_step_s { diff --git a/src/version.c b/src/version.c index e8a523c0..8360da8d 100644 --- a/src/version.c +++ b/src/version.c @@ -1,10 +1,10 @@ -#include "types.h" +#include "version.h" -u8 __Creator__[] = { +char __Creator__[] = { #include "assets/__Creator__.inc" }; -u8 __DateTime__[] = { +char __DateTime__[] = { #include "assets/__DateTime__.inc" };