mirror of
https://github.com/zeldaret/mm.git
synced 2026-08-21 22:10:51 -04:00
Obj_KIbako cleanup (#280)
* Modify Kibako to use the same ID/FLAG macros as Kibako2 * Define KIBAKO_BANK_INDEX * Add explanatory comment at the top of the file * Add Kibako function names to functions.txt * Define KIBAKO_BOMBER_CAN_HIDE_IN_BOX
This commit is contained in:
@@ -1,3 +1,9 @@
|
||||
/*
|
||||
* File: z_obj_kibako.c
|
||||
* Overlay: ovl_Obj_Kibako
|
||||
* Description: Small grabbable crate
|
||||
*/
|
||||
|
||||
#include "z_obj_kibako.h"
|
||||
|
||||
#define FLAGS 0x04000010
|
||||
@@ -80,9 +86,10 @@ void ObjKibako_SpawnCollectible(ObjKibako* this, GlobalContext* globalCtx) {
|
||||
s32 collectible;
|
||||
|
||||
if (this->isDropCollected == 0) {
|
||||
collectible = func_800A8150(this->actor.params & 0x3F);
|
||||
collectible = func_800A8150(KIBAKO_COLLECTIBLE_ID(&this->actor));
|
||||
if (collectible >= 0) {
|
||||
Item_DropCollectible(globalCtx, &this->actor.world.pos, collectible | GET_KIBAKO_COLLECTIBLE_ID(this));
|
||||
Item_DropCollectible(globalCtx, &this->actor.world.pos,
|
||||
collectible | KIBAKO_COLLECTIBLE_FLAG(&this->actor) << 8);
|
||||
this->isDropCollected = 1;
|
||||
}
|
||||
}
|
||||
@@ -131,7 +138,7 @@ void ObjKibako_Init(Actor* thisx, GlobalContext* globalCtx2) {
|
||||
GlobalContext* globalCtx = globalCtx2;
|
||||
s32 whichBankIndex;
|
||||
|
||||
whichBankIndex = (this->actor.params >> 0xF) & 1;
|
||||
whichBankIndex = KIBAKO_BANK_INDEX(thisx);
|
||||
Actor_ProcessInitChain(&this->actor, sInitChain);
|
||||
Actor_SetScale(&this->actor, 0.15f);
|
||||
if (whichBankIndex == 0) {
|
||||
@@ -192,7 +199,7 @@ void ObjKibako_AirBreak(ObjKibako* this, GlobalContext* globalCtx) {
|
||||
|
||||
EffectSsKakera_Spawn(
|
||||
globalCtx, &pos, &velocity, worldPos, -200, phi_s0, 20, 0, 0, (Rand_ZeroOne() * 38.0f) + 10.0f, 0, 0, 60,
|
||||
-1, sObjectIdList[(this->actor.params >> 0xF) & 1], sKakeraDisplayLists[(this->actor.params >> 0xF) & 1]);
|
||||
-1, sObjectIdList[KIBAKO_BANK_INDEX(&this->actor)], sKakeraDisplayLists[KIBAKO_BANK_INDEX(&this->actor)]);
|
||||
}
|
||||
|
||||
func_800BBFB0(globalCtx, worldPos, 40.0f, 3, 0x32, 0x8C, 1);
|
||||
@@ -236,7 +243,7 @@ void ObjKibako_WaterBreak(ObjKibako* this, GlobalContext* globalCtx) {
|
||||
|
||||
EffectSsKakera_Spawn(
|
||||
globalCtx, &pos, &velocity, worldPos, -180, phi_s0, 50, 5, 0, (Rand_ZeroOne() * 35.0f) + 10.0f, 0, 0, 70,
|
||||
-1, sObjectIdList[(this->actor.params >> 0xF) & 1], sKakeraDisplayLists[(this->actor.params >> 0xF) & 1]);
|
||||
-1, sObjectIdList[KIBAKO_BANK_INDEX(&this->actor)], sKakeraDisplayLists[KIBAKO_BANK_INDEX(&this->actor)]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -266,7 +273,7 @@ void ObjKibako_Idle(ObjKibako* this, GlobalContext* globalCtx) {
|
||||
ObjKibako_SetupHeld(this);
|
||||
this->actor.room = -1;
|
||||
this->actor.colChkInfo.mass = 0x78;
|
||||
if (func_800A817C(this->actor.params & 0x3F)) {
|
||||
if (func_800A817C(KIBAKO_COLLECTIBLE_ID(&this->actor))) {
|
||||
ObjKibako_SpawnCollectible(this, globalCtx);
|
||||
}
|
||||
func_800B8E58(&this->actor, NA_SE_PL_PULL_UP_WOODBOX);
|
||||
@@ -297,7 +304,7 @@ void ObjKibako_Idle(ObjKibako* this, GlobalContext* globalCtx) {
|
||||
|
||||
this->collider.base.acFlags &= ~AC_HIT;
|
||||
|
||||
if ((this->actor.params >> 7) & 1) {
|
||||
if (KIBAKO_BOMBER_CAN_HIDE_IN_BOX(&this->actor)) {
|
||||
Collider_UpdateCylinder(&this->actor, &this->collider);
|
||||
CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base);
|
||||
|
||||
@@ -411,5 +418,5 @@ void ObjKibako_Update(Actor* thisx, GlobalContext* globalCtx) {
|
||||
}
|
||||
|
||||
void ObjKibako_Draw(Actor* thisx, GlobalContext* globalCtx) {
|
||||
func_800BDFC0(globalCtx, sDisplayLists[((thisx->params >> 0xF) & 1)]);
|
||||
func_800BDFC0(globalCtx, sDisplayLists[KIBAKO_BANK_INDEX(thisx)]);
|
||||
}
|
||||
|
||||
@@ -3,7 +3,10 @@
|
||||
|
||||
#include "global.h"
|
||||
|
||||
#define GET_KIBAKO_COLLECTIBLE_ID(x) (((x->actor.params >> 0x8) & 0x7F) << 8)
|
||||
#define KIBAKO_COLLECTIBLE_ID(thisx) ((thisx)->params & 0x3F)
|
||||
#define KIBAKO_COLLECTIBLE_FLAG(thisx) (((thisx)->params >> 0x8) & 0x7F)
|
||||
#define KIBAKO_BANK_INDEX(thisx) (((thisx)->params >> 0xF) & 1)
|
||||
#define KIBAKO_BOMBER_CAN_HIDE_IN_BOX(thisx) (((thisx)->params >> 7) & 1)
|
||||
|
||||
struct ObjKibako;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user