mirror of
https://github.com/ACreTeam/ac-decomp
synced 2026-08-05 00:59:18 -04:00
m_bg_item fixes & refactor
This commit is contained in:
@@ -8,16 +8,12 @@
|
||||
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
|
||||
|
||||
+55
-43
@@ -3,53 +3,65 @@
|
||||
#include "m_common_data.h"
|
||||
#include "m_name_table.h"
|
||||
|
||||
BI_PROC mBI_make_proc;
|
||||
static BI_PROC mBI_make_proc;
|
||||
|
||||
static ACTOR* mBI_search_bg_item(Actor_info* info) {
|
||||
static const s16 name_data[] = {
|
||||
mAc_PROFILE_BGCHERRYITEM,
|
||||
mAc_PROFILE_BGITEM,
|
||||
mAc_PROFILE_BGWINTERITEM,
|
||||
mAc_PROFILE_BGXMASITEM
|
||||
};
|
||||
|
||||
ACTOR* actor;
|
||||
int i;
|
||||
|
||||
ACTOR* mBI_search_bg_item(Actor_info* info){
|
||||
static const s16 name_data[] = {
|
||||
0x4f, 0x1, 0x50,0x51
|
||||
};
|
||||
for (i = 0; i < 4; i++) {
|
||||
actor = Actor_info_name_search(info,name_data[i], ACTOR_PART_ITEM);
|
||||
if (actor != NULL) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return actor;
|
||||
}
|
||||
|
||||
static 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.0f, 0.0f, 0.0f,
|
||||
0, 0, 0,
|
||||
-1, -1,
|
||||
-1,
|
||||
EMPTY_NO,
|
||||
-1,
|
||||
-1,
|
||||
-1
|
||||
);
|
||||
|
||||
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){
|
||||
extern 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));
|
||||
}
|
||||
}
|
||||
|
||||
if(mBI_make_proc != NULL){
|
||||
mBI_make_proc(play);
|
||||
}
|
||||
}
|
||||
extern void mBI_ct() {
|
||||
mBI_make_proc = NULL;
|
||||
}
|
||||
|
||||
extern void mBI_move(GAME_PLAY* play) {
|
||||
if (mBI_make_proc != NULL) {
|
||||
(*mBI_make_proc)(play);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
#include "m_scene.h"
|
||||
#include "m_play.h"
|
||||
|
||||
/* @unused ? mScn_Dma2Bank(...) */
|
||||
|
||||
static void mScn_KeepMyRoomBankNew(Object_Exchange_c* exchange, s16 bank_id, size_t size) {
|
||||
Object_Bank_c* bank = exchange->banks + exchange->bank_idx;
|
||||
|
||||
@@ -30,6 +32,8 @@ extern void mScn_ObtainCarpetBank(GAME_PLAY* play) {
|
||||
}
|
||||
}
|
||||
|
||||
/* @unused extern ? mScn_ObtainFurnitureBank(...) */
|
||||
|
||||
extern void mScn_ObtainMyRoomBank(GAME_PLAY* play) {
|
||||
mScn_ObtainCarpetBank(play);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user