diff --git a/config/rel_slices.yml b/config/rel_slices.yml index c6df974f..dda16f0d 100644 --- a/config/rel_slices.yml +++ b/config/rel_slices.yml @@ -34,6 +34,10 @@ m_banti.c: .rodata: [0x80641388, 0x806413E0] .data: [0x8064F548, 0x8064F658] .bss: [0x8125A830, 0x8125AC80] +m_bg_item.c: + .text: [0x80378858, 0x803789F8] + .rodata: [0x806413E0, 0x806413F0] + .bss: [0x81263080, 0x81263088] m_calendar.c: .text: [0x8037D190, 0x8037DA54] m_cockroach.c: diff --git a/include/m_bg_item.h b/include/m_bg_item.h index 3129b4c5..e90fd1c0 100644 --- a/include/m_bg_item.h +++ b/include/m_bg_item.h @@ -2,14 +2,22 @@ #define M_BG_ITEM_H #include "types.h" +#include "m_actor.h" #ifdef __cplusplus extern "C" { #endif +extern ACTOR* mBI_search_bg_item(Actor_info* info); +extern void mBI_make_bg_item(GAME_PLAY* play); +extern void mBI_change_bg_item(GAME_PLAY* play); extern void mBI_ct(); extern void mBI_move(GAME_PLAY* play); +typedef void (*BI_PROC)(GAME_PLAY*); + +extern BI_PROC mBI_make_proc; + #ifdef __cplusplus } #endif diff --git a/rel/m_bg_item.c b/rel/m_bg_item.c new file mode 100644 index 00000000..8263d7a3 --- /dev/null +++ b/rel/m_bg_item.c @@ -0,0 +1,55 @@ +#include "m_bg_item.h" + +#include "m_common_data.h" +#include "m_name_table.h" + +BI_PROC mBI_make_proc; + + +ACTOR* mBI_search_bg_item(Actor_info* info){ + static const s16 name_data[] = { + 0x4f, 0x1, 0x50,0x51 + }; + + int i; + for( i = 0; i < 4; i++){ + if(Actor_info_name_search(info,name_data[i], ACTOR_PART_ITEM) != 0){ + return; + } + } +} + +void mBI_make_bg_item(GAME_PLAY* play){ + + + if(mBI_search_bg_item(&play->actor_info) == NULL){ + + Actor_info_make_actor(&play->actor_info, &play->game, Common_Get(bg_item_profile),0, + 0.0f,0.0f,0,0,0 ,-1, -1,-1, EMPTY_NO,-1,-1,-1); + mBI_make_proc = NULL; + } +} + +void mBI_change_bg_item(GAME_PLAY* play){ + + ACTOR* actor = mBI_search_bg_item(&play->actor_info); + + if(actor != NULL){ + Actor_delete(actor); + mBI_make_proc = mBI_make_bg_item; + Common_Set(bg_item_profile, Common_Get(time.bgitem_profile)); + } +} + +void mBI_ct(){ + + mBI_make_proc = NULL; + +} + +void mBI_move(GAME_PLAY* play){ + + if(mBI_make_proc != NULL){ + mBI_make_proc(play); + } +} \ No newline at end of file