ovl_Dm_Tsg: OK (#1458)

* z_dm_tsg Matching

* play2 prototype

* * gSaveContext.save.entrance
* cueChannel constant
* THIS
* i++

* remove actionFunc

* bool

* PR review

* pr review

* DMTSG_UNK_SIZE

* i % 16U

* review
This commit is contained in:
Alejandro Asenjo Nitti 2023-11-03 08:45:35 -03:00 committed by GitHub
parent f276d2b0e6
commit 10a14feb2c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 71 additions and 11 deletions

3
spec
View File

@ -2577,8 +2577,7 @@ beginseg
name "ovl_Dm_Tsg"
compress
include "build/src/overlays/actors/ovl_Dm_Tsg/z_dm_tsg.o"
include "build/data/ovl_Dm_Tsg/ovl_Dm_Tsg.data.o"
include "build/data/ovl_Dm_Tsg/ovl_Dm_Tsg.reloc.o"
include "build/src/overlays/actors/ovl_Dm_Tsg/ovl_Dm_Tsg_reloc.o"
endseg
beginseg

View File

@ -5,6 +5,7 @@
*/
#include "z_dm_tsg.h"
#include "objects/object_open_obj/object_open_obj.h"
#define FLAGS (ACTOR_FLAG_10 | ACTOR_FLAG_20)
@ -13,9 +14,8 @@
void DmTsg_Init(Actor* thisx, PlayState* play);
void DmTsg_Destroy(Actor* thisx, PlayState* play);
void DmTsg_Update(Actor* thisx, PlayState* play);
void DmTsg_Draw(Actor* thisx, PlayState* play);
void DmTsg_Draw(Actor* thisx, PlayState* play2);
#if 0
ActorInit Dm_Tsg_InitVars = {
/**/ ACTOR_DM_TSG,
/**/ ACTORCAT_ITEMACTION,
@ -28,14 +28,66 @@ ActorInit Dm_Tsg_InitVars = {
/**/ DmTsg_Draw,
};
#endif
void DmTsg_Init(Actor* thisx, PlayState* play) {
DmTsg* this = THIS;
s32 i;
extern UNK_TYPE D_06011458;
if (gSaveContext.save.entrance == ENTRANCE(OPENING_DUNGEON, 0)) {
Actor_SetScale(&this->actor, 0.1f);
for (i = 0; i < DMTSG_UNK_SIZE; i++) {
this->unk_78C[i] = Rand_ZeroOne() * 0xFFFF;
this->unk_856[i] = TRUNCF_BINANG(Rand_ZeroOne() * 200.0f) + 100;
}
} else {
Actor_Kill(&this->actor);
}
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Dm_Tsg/DmTsg_Init.s")
void DmTsg_Destroy(Actor* thisx, PlayState* play) {
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Dm_Tsg/DmTsg_Destroy.s")
void DmTsg_Update(Actor* thisx, PlayState* play) {
DmTsg* this = THIS;
s32 cueChannel;
s16 i;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Dm_Tsg/DmTsg_Update.s")
for (i = 0; i < DMTSG_UNK_SIZE; i++) {
this->unk_5F8[i] = (Math_SinS((i % 16U) * this->unk_854) * 60.0f) + 120.0f;
this->unk_148[i].x = Math_CosS(this->unk_78C[i]) * this->unk_5F8[i];
this->unk_148[i].y = this->unk_788 + (i * 16);
this->unk_148[i].z = Math_SinS(this->unk_78C[i]) * this->unk_5F8[i];
this->unk_78C[i] += this->unk_856[i];
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Dm_Tsg/DmTsg_Draw.s")
this->canDraw = false;
this->unk_854 += 40;
if (Cutscene_IsCueInChannel(play, CS_CMD_ACTOR_CUE_514)) {
cueChannel = Cutscene_GetCueChannel(play, CS_CMD_ACTOR_CUE_514);
if (play->csCtx.actorCues[cueChannel]->id != 1) {
this->canDraw = true;
}
Cutscene_ActorTranslateAndYaw(&this->actor, play, cueChannel);
}
}
void DmTsg_Draw(Actor* thisx, PlayState* play2) {
PlayState* play = play2;
DmTsg* this = THIS;
s32 i;
u32 j;
if (this->canDraw) {
for (i = 0, j = 0; i < DMTSG_UNK_SIZE; i++) {
Matrix_Translate(this->unk_148[i].x + this->actor.world.pos.x, this->unk_148[i].y + this->actor.world.pos.y,
this->unk_148[i].z + this->actor.world.pos.z, MTXMODE_NEW);
Matrix_Scale(0.3f, 0.3f, 0.3f, MTXMODE_APPLY);
AnimatedMat_DrawStep(play, Lib_SegmentedToVirtual(object_open_obj_Matanimheader_011458), j++);
Matrix_Mult(&play->billboardMtxF, MTXMODE_APPLY);
Gfx_DrawDListXlu(play, object_open_obj_DL_002D30);
if (j >= 10) {
j = 0;
}
}
}
}

View File

@ -5,9 +5,18 @@
struct DmTsg;
#define DMTSG_UNK_SIZE 100
typedef struct DmTsg {
/* 0x000 */ Actor actor;
/* 0x144 */ char unk_144[0x7DC];
/* 0x144 */ UNK_TYPE1 unk_144[0x4];
/* 0x148 */ Vec3f unk_148[DMTSG_UNK_SIZE];
/* 0x5F8 */ f32 unk_5F8[DMTSG_UNK_SIZE];
/* 0x788 */ f32 unk_788;
/* 0x78C */ s16 unk_78C[DMTSG_UNK_SIZE];
/* 0x854 */ s16 unk_854;
/* 0x856 */ s16 unk_856[DMTSG_UNK_SIZE];
/* 0x91E */ u8 canDraw;
} DmTsg; // size = 0x920
#endif // Z_DM_TSG_H