ovl_Obj_Swprize OK (#1021)

* ovl_Obj_Swprize OK

* Co-authored-by: mzxrules mzxrules@users.noreply.github.com

* pr review

* pr review

* pr review
This commit is contained in:
SonicDcer 2022-09-28 22:47:38 -03:00 committed by GitHub
parent 5e860dd3e7
commit cc52da9952
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 109 additions and 21 deletions

3
spec
View File

@ -5097,8 +5097,7 @@ beginseg
name "ovl_Obj_Swprize"
compress
include "build/src/overlays/actors/ovl_Obj_Swprize/z_obj_swprize.o"
include "build/data/ovl_Obj_Swprize/ovl_Obj_Swprize.data.o"
include "build/data/ovl_Obj_Swprize/ovl_Obj_Swprize.reloc.o"
include "build/src/overlays/actors/ovl_Obj_Swprize/ovl_Obj_Swprize_reloc.o"
endseg
beginseg

View File

@ -14,12 +14,15 @@ void ObjSwprize_Init(Actor* thisx, PlayState* play);
void ObjSwprize_Destroy(Actor* thisx, PlayState* play);
void ObjSwprize_Update(Actor* thisx, PlayState* play);
void ObjSwprize_DoNothing(ObjSwprize* this, PlayState* play);
void func_80C25654(ObjSwprize* this, PlayState* play);
void func_80C25640(ObjSwprize* this);
void func_80C25698(ObjSwprize* this);
void func_80C256AC(ObjSwprize* this, PlayState* play);
void func_80C25710(ObjSwprize* this);
void func_80C2572C(ObjSwprize* this, PlayState* play);
void func_80C25794(ObjSwprize* this, PlayState* play);
void ObjSwprize_SetupDoNothing(ObjSwprize* this);
#if 0
const ActorInit Obj_Swprize_InitVars = {
ACTOR_OBJ_SWPRIZE,
ACTORCAT_PROP,
@ -32,30 +35,113 @@ const ActorInit Obj_Swprize_InitVars = {
(ActorFunc)NULL,
};
#endif
s16 D_80C257F0[] = { 2, 0x14, 1, 8 };
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Swprize/func_80C25360.s")
s16 D_80C257F8[] = { -0x888, 0, 0x888 };
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Swprize/func_80C253D0.s")
void func_80C25360(ObjSwprize* this, Vec3f* vec) {
Matrix_Push();
Matrix_RotateYS(this->actor.shape.rot.y, MTXMODE_NEW);
Matrix_RotateXS(this->actor.shape.rot.x, MTXMODE_APPLY);
Matrix_RotateZS(this->actor.shape.rot.z, MTXMODE_APPLY);
Matrix_MultVecY(1.0f, vec);
Matrix_Pop();
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Swprize/ObjSwprize_Init.s")
void func_80C253D0(ObjSwprize* this, PlayState* play) {
Actor* thisx = &this->actor;
s32 i;
Actor* collectible;
Vec3f sp78;
s32 type = OBJ_SWPRIZE_GET_TYPE(thisx);
s32 temp_s0 = D_80C257F0[type];
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Swprize/ObjSwprize_Destroy.s")
func_80C25360(this, &sp78);
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Swprize/func_80C25640.s")
if (type == 2) {
for (i = 0; i < 3; i++) {
collectible = Item_DropCollectible(play, &thisx->world.pos, temp_s0);
if (collectible != NULL) {
if (sp78.y < 0.98f) {
collectible->velocity.y = (sp78.y + 1.0f) * 4.0f;
collectible->speedXZ = (2.0f * (1.0f - fabsf(sp78.y))) + 2.0f;
collectible->world.rot.y = Math_FAtan2F(sp78.z, sp78.x) + D_80C257F8[i];
} else {
collectible->world.rot.y = i * (0x10000 / 3);
}
}
}
} else {
collectible = Item_DropCollectible(play, &thisx->world.pos, temp_s0);
if ((collectible != NULL) && (sp78.y < 0.98f)) {
collectible->velocity.y = (sp78.y + 1.0f) * 4.0f;
collectible->speedXZ = (2.0f * (1.0f - fabsf(sp78.y))) + 2.0f;
collectible->world.rot.y = Math_FAtan2F(sp78.z, sp78.x);
}
}
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Swprize/func_80C25654.s")
void ObjSwprize_Init(Actor* thisx, PlayState* play) {
ObjSwprize* this = THIS;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Swprize/func_80C25698.s")
if (Flags_GetSwitch(play, OBJ_SWPRIZE_GET_SWITCH_FLAG(&this->actor))) {
ObjSwprize_SetupDoNothing(this);
} else {
func_80C25640(this);
}
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Swprize/func_80C256AC.s")
void ObjSwprize_Destroy(Actor* thisx, PlayState* play) {
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Swprize/func_80C25710.s")
void func_80C25640(ObjSwprize* this) {
this->actionFunc = func_80C25654;
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Swprize/func_80C2572C.s")
void func_80C25654(ObjSwprize* this, PlayState* play) {
if (Flags_GetSwitch(play, OBJ_SWPRIZE_GET_SWITCH_FLAG(&this->actor))) {
func_80C25698(this);
}
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Swprize/func_80C25780.s")
void func_80C25698(ObjSwprize* this) {
this->actionFunc = func_80C256AC;
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Swprize/func_80C25794.s")
void func_80C256AC(ObjSwprize* this, PlayState* play) {
if (ActorCutscene_GetCanPlayNext(this->actor.cutscene)) {
ActorCutscene_StartAndSetUnkLinkFields(this->actor.cutscene, &this->actor);
func_80C253D0(this, play);
func_80C25710(this);
} else {
ActorCutscene_SetIntentToPlay(this->actor.cutscene);
}
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Swprize/ObjSwprize_Update.s")
void func_80C25710(ObjSwprize* this) {
this->timer = 40;
this->actionFunc = func_80C2572C;
}
void func_80C2572C(ObjSwprize* this, PlayState* play) {
if (this->timer > 0) {
this->timer--;
if (this->timer == 0) {
ActorCutscene_Stop(this->actor.cutscene);
ObjSwprize_SetupDoNothing(this);
}
}
}
void ObjSwprize_SetupDoNothing(ObjSwprize* this) {
this->actionFunc = ObjSwprize_DoNothing;
}
void ObjSwprize_DoNothing(ObjSwprize* this, PlayState* play) {
}
void ObjSwprize_Update(Actor* thisx, PlayState* play) {
ObjSwprize* this = THIS;
this->actionFunc(this, play);
}

View File

@ -3,6 +3,9 @@
#include "global.h"
#define OBJ_SWPRIZE_GET_SWITCH_FLAG(thisx) ((thisx)->params & 0x7F)
#define OBJ_SWPRIZE_GET_TYPE(thisx) (((thisx)->params >> 8) & 3)
struct ObjSwprize;
typedef void (*ObjSwprizeActionFunc)(struct ObjSwprize*, PlayState*);
@ -10,7 +13,7 @@ typedef void (*ObjSwprizeActionFunc)(struct ObjSwprize*, PlayState*);
typedef struct ObjSwprize {
/* 0x000 */ Actor actor;
/* 0x144 */ ObjSwprizeActionFunc actionFunc;
/* 0x148 */ char unk_148[0x4];
/* 0x148 */ s16 timer;
} ObjSwprize; // size = 0x14C
extern const ActorInit Obj_Swprize_InitVars;

View File

@ -17125,8 +17125,8 @@
0x80C256AC:("func_80C256AC",),
0x80C25710:("func_80C25710",),
0x80C2572C:("func_80C2572C",),
0x80C25780:("func_80C25780",),
0x80C25794:("func_80C25794",),
0x80C25780:("ObjSwprize_SetupDoNothing",),
0x80C25794:("ObjSwprize_DoNothing",),
0x80C257A4:("ObjSwprize_Update",),
0x80C258A0:("func_80C258A0",),
0x80C2590C:("func_80C2590C",),