mirror of
https://github.com/zeldaret/oot.git
synced 2025-07-17 13:24:45 +00:00
Decompiles z_bg_spot01_objects2.c (#357)
* Starts z_bg_spot01_objects2 * z_bg_spot01_objects2.c almost finished * Finishes z_bg_spot01_objects2.c * Removes unused asm * PR comments and rebased to master * Addresses PR comments #2 Co-authored-by: i82orbom <i82orbom i82orbom@github> Co-authored-by: i82orbom <i82orbom@github.com>
This commit is contained in:
parent
d44dd61cd6
commit
612980f90c
13 changed files with 111 additions and 345 deletions
|
@ -14,12 +14,10 @@ void BgSpot01Objects2_Init(Actor* thisx, GlobalContext* globalCtx);
|
|||
void BgSpot01Objects2_Destroy(Actor* thisx, GlobalContext* globalCtx);
|
||||
void BgSpot01Objects2_Update(Actor* thisx, GlobalContext* globalCtx);
|
||||
|
||||
// func_808AC22C
|
||||
void func_808AC2BC(BgSpot01Objects2* this, GlobalContext* globalCtx);
|
||||
void func_808AC474(BgSpot01Objects2* this, GlobalContext* globalCtx);
|
||||
void func_808AC4A4(BgSpot01Objects2* this, GlobalContext* globalCtx);
|
||||
void func_808AC4A4(Actor* thisx, GlobalContext* globalCtx);
|
||||
|
||||
/*
|
||||
const ActorInit Bg_Spot01_Objects2_InitVars = {
|
||||
ACTOR_BG_SPOT01_OBJECTS2,
|
||||
ACTORTYPE_BG,
|
||||
|
@ -31,17 +29,112 @@ const ActorInit Bg_Spot01_Objects2_InitVars = {
|
|||
(ActorFunc)BgSpot01Objects2_Update,
|
||||
NULL,
|
||||
};
|
||||
*/
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Spot01_Objects2/BgSpot01Objects2_Init.s")
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Spot01_Objects2/BgSpot01Objects2_Destroy.s")
|
||||
static InitChainEntry sInitChain[] = {
|
||||
ICHAIN_F32(uncullZoneForward, 12800, ICHAIN_CONTINUE),
|
||||
ICHAIN_F32(uncullZoneScale, 2000, ICHAIN_CONTINUE),
|
||||
ICHAIN_F32(uncullZoneDownward, 1500, ICHAIN_CONTINUE),
|
||||
ICHAIN_VEC3F_DIV1000(scale, 100, ICHAIN_STOP),
|
||||
};
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Spot01_Objects2/func_808AC22C.s")
|
||||
Gfx* D_808AC510[] = { 0x06001EB0, 0x06002780, 0x06003078, 0x06001228, 0x06001528 };
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Spot01_Objects2/func_808AC2BC.s")
|
||||
extern UNK_TYPE D_06001A38;
|
||||
extern UNK_TYPE D_06001C58;
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Spot01_Objects2/func_808AC474.s")
|
||||
void BgSpot01Objects2_Init(Actor* thisx, GlobalContext* globalCtx) {
|
||||
BgSpot01Objects2* this = THIS;
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Spot01_Objects2/BgSpot01Objects2_Update.s")
|
||||
switch (this->dyna.actor.params & 7) {
|
||||
case 0:
|
||||
case 1:
|
||||
case 2:
|
||||
this->objectId = OBJECT_SPOT01_MATOYA;
|
||||
break;
|
||||
case 3:
|
||||
this->objectId = OBJECT_SPOT01_MATOYAB;
|
||||
break;
|
||||
case 4:
|
||||
this->objectId = OBJECT_SPOT01_MATOYA;
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Spot01_Objects2/func_808AC4A4.s")
|
||||
if (this->objectId >= 0) {
|
||||
this->objBankIndex = Object_GetIndex(&globalCtx->objectCtx, this->objectId);
|
||||
if (this->objBankIndex < 0) {
|
||||
// There was no bank setting.
|
||||
osSyncPrintf("-----------------------------バンク設定ありませんでした.");
|
||||
Actor_Kill(&this->dyna.actor);
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
Actor_Kill(&this->dyna.actor);
|
||||
}
|
||||
this->actionFunc = func_808AC2BC;
|
||||
Actor_ProcessInitChain(&this->dyna.actor, sInitChain);
|
||||
}
|
||||
|
||||
void BgSpot01Objects2_Destroy(Actor* thisx, GlobalContext* globalCtx) {
|
||||
}
|
||||
|
||||
s32 func_808AC22C(Path* pathList, Vec3f* pos, s32 path, s32 waypoint) {
|
||||
Vec3s* pointPos = &((Vec3s*)SEGMENTED_TO_VIRTUAL((pathList + path)->points))[waypoint];
|
||||
|
||||
pos->x = pointPos->x;
|
||||
pos->y = pointPos->y;
|
||||
pos->z = pointPos->z;
|
||||
return 0;
|
||||
}
|
||||
|
||||
void func_808AC2BC(BgSpot01Objects2* this, GlobalContext* globalCtx) {
|
||||
s32 sp54;
|
||||
Actor* thisx = &this->dyna.actor;
|
||||
s32 pad;
|
||||
Vec3f position;
|
||||
|
||||
sp54 = 0;
|
||||
if (Object_IsLoaded(&globalCtx->objectCtx, this->objBankIndex)) {
|
||||
// ---- Successful bank switching!!
|
||||
osSyncPrintf("-----バンク切り換え成功!!\n");
|
||||
gSegments[6] = VIRTUAL_TO_PHYSICAL(globalCtx->objectCtx.status[this->objBankIndex].segment);
|
||||
|
||||
this->dyna.actor.objBankIndex = this->objBankIndex;
|
||||
DynaPolyInfo_SetActorMove(&this->dyna, DPM_PLAYER);
|
||||
|
||||
switch (this->dyna.actor.params & 7) {
|
||||
case 4: // Shooting gallery
|
||||
DynaPolyInfo_Alloc(&D_06001A38, &sp54);
|
||||
this->dyna.dynaPolyId = DynaPolyInfo_RegisterActor(globalCtx, &globalCtx->colCtx.dyna, thisx, sp54);
|
||||
break;
|
||||
case 3: // Shooting Gallery, spawns Carpenter Sabooro during the day
|
||||
DynaPolyInfo_Alloc(&D_06001C58, &sp54);
|
||||
this->dyna.dynaPolyId = DynaPolyInfo_RegisterActor(globalCtx, &globalCtx->colCtx.dyna, thisx, sp54);
|
||||
if (gSaveContext.nightFlag == 0) {
|
||||
func_808AC22C(globalCtx->setupPathList, &position, ((s32)thisx->params >> 8) & 0xFF, 0);
|
||||
Actor_SpawnAsChild(&globalCtx->actorCtx, thisx, globalCtx, ACTOR_EN_DAIKU_KAKARIKO, position.x,
|
||||
position.y, position.z, thisx->posRot.rot.x, thisx->posRot.rot.y,
|
||||
thisx->posRot.rot.z, ((((s32)thisx->params >> 8) & 0xFF) << 8) + 1);
|
||||
}
|
||||
break;
|
||||
case 0: // Potion Shop Poster
|
||||
case 1: // Shooting gallery Poster
|
||||
case 2: // Bazaar Poster
|
||||
break;
|
||||
}
|
||||
|
||||
this->dyna.actor.draw = func_808AC4A4;
|
||||
this->actionFunc = func_808AC474;
|
||||
}
|
||||
}
|
||||
|
||||
void func_808AC474(BgSpot01Objects2* this, GlobalContext* globalCtx) {
|
||||
}
|
||||
|
||||
void BgSpot01Objects2_Update(Actor* thisx, GlobalContext* globalCtx) {
|
||||
BgSpot01Objects2* this = THIS;
|
||||
|
||||
this->actionFunc(this, globalCtx);
|
||||
}
|
||||
|
||||
void func_808AC4A4(Actor* thisx, GlobalContext* globalCtx) {
|
||||
Gfx_DrawDListOpa(globalCtx, D_808AC510[thisx->params & 7]);
|
||||
}
|
||||
|
|
|
@ -9,12 +9,11 @@ struct BgSpot01Objects2;
|
|||
typedef void (*BgSpot01Objects2ActionFunc)(struct BgSpot01Objects2*, GlobalContext*);
|
||||
|
||||
typedef struct BgSpot01Objects2 {
|
||||
/* 0x0000 */ Actor actor;
|
||||
/* 0x014C */ char unk_14C[0x18];
|
||||
/* 0x0000 */ DynaPolyActor dyna;
|
||||
/* 0x0164 */ BgSpot01Objects2ActionFunc actionFunc;
|
||||
/* 0x0168 */ char unk_168[0x10];
|
||||
/* 0x0178 */ s32 objectId;
|
||||
/* 0x0179 */ char unk_179[0x4];
|
||||
/* 0x017C */ s8 objBankIndex;
|
||||
} BgSpot01Objects2; // size = 0x0180
|
||||
|
||||
extern const ActorInit Bg_Spot01_Objects2_InitVars;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue