mirror of https://github.com/zeldaret/mm.git
En_Encount3 decompiled (#1405)
* data * some matches * draw func * Update func * improvements * forgot extern * improvements * improvements * improvements * improvements
This commit is contained in:
parent
9d043f0197
commit
f6a2f4492a
3
spec
3
spec
|
@ -2163,8 +2163,7 @@ beginseg
|
|||
name "ovl_En_Encount3"
|
||||
compress
|
||||
include "build/src/overlays/actors/ovl_En_Encount3/z_en_encount3.o"
|
||||
include "build/data/ovl_En_Encount3/ovl_En_Encount3.data.o"
|
||||
include "build/data/ovl_En_Encount3/ovl_En_Encount3.reloc.o"
|
||||
include "build/src/overlays/actors/ovl_En_Encount3/ovl_En_Encount3_reloc.o"
|
||||
endseg
|
||||
|
||||
beginseg
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
*/
|
||||
|
||||
#include "z_en_encount3.h"
|
||||
#include "objects/object_big_fwall/object_big_fwall.h"
|
||||
|
||||
#define FLAGS (ACTOR_FLAG_10 | ACTOR_FLAG_20 | ACTOR_FLAG_CANT_LOCK_ON)
|
||||
|
||||
|
@ -12,14 +13,15 @@
|
|||
|
||||
void EnEncount3_Init(Actor* thisx, PlayState* play);
|
||||
void EnEncount3_Destroy(Actor* thisx, PlayState* play);
|
||||
void EnEncount3_Update(Actor* thisx, PlayState* play);
|
||||
void EnEncount3_Update(Actor* thisx, PlayState* play2);
|
||||
void EnEncount3_Draw(Actor* thisx, PlayState* play);
|
||||
|
||||
void func_809AD058(EnEncount3* this);
|
||||
|
||||
void func_809AD084(EnEncount3* this, PlayState* play);
|
||||
void func_809AD194(EnEncount3* this, PlayState* play);
|
||||
void func_809AD1EC(EnEncount3* this, PlayState* play);
|
||||
|
||||
#if 0
|
||||
ActorInit En_Encount3_InitVars = {
|
||||
ACTOR_EN_ENCOUNT3,
|
||||
ACTORCAT_ENEMY,
|
||||
|
@ -32,22 +34,174 @@ ActorInit En_Encount3_InitVars = {
|
|||
(ActorFunc)EnEncount3_Draw,
|
||||
};
|
||||
|
||||
#endif
|
||||
s32 D_809AD810 = false;
|
||||
|
||||
extern UNK_TYPE D_060009A0;
|
||||
void EnEncount3_Init(Actor* thisx, PlayState* play) {
|
||||
EnEncount3* this = THIS;
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Encount3/EnEncount3_Init.s")
|
||||
this->unk14A = ENCOUNT3_GET_SPAWN_INDEX(thisx);
|
||||
this->childParams = ENCOUNT3_GET_PARAM_F80(thisx);
|
||||
this->switchFlag = ENCOUNT3_GET_SWITCH_FLAG(thisx);
|
||||
this->csId = this->actor.csId;
|
||||
this->unk16C = ENCOUNT3_GET_ROTZ(thisx) * 10.0f;
|
||||
if (this->unk16C < 10.0f) {
|
||||
this->unk16C = 10.0f;
|
||||
} else if (this->unk16C > 1000.0f) {
|
||||
this->unk16C = 1000.0f;
|
||||
}
|
||||
if (this->switchFlag == 0x7F) {
|
||||
this->switchFlag = -1;
|
||||
}
|
||||
if ((this->switchFlag >= 0) && Flags_GetSwitch(play, this->switchFlag)) {
|
||||
Actor_Kill(&this->actor);
|
||||
}
|
||||
this->actor.flags |= ACTOR_FLAG_CANT_LOCK_ON;
|
||||
this->actor.flags &= ~ACTOR_FLAG_TARGETABLE;
|
||||
func_809AD058(this);
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Encount3/EnEncount3_Destroy.s")
|
||||
void EnEncount3_Destroy(Actor* thisx, PlayState* play) {
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Encount3/func_809AD058.s")
|
||||
void func_809AD058(EnEncount3* this) {
|
||||
this->childActorId = ACTOR_EN_JSO;
|
||||
this->unk150 = 1;
|
||||
this->timer = 30;
|
||||
this->actionFunc = func_809AD084;
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Encount3/func_809AD084.s")
|
||||
void func_809AD084(EnEncount3* this, PlayState* play) {
|
||||
if ((this->switchFlag >= 0) && Flags_GetSwitch(play, this->switchFlag)) {
|
||||
Actor_Kill(&this->actor);
|
||||
return;
|
||||
}
|
||||
if (!(this->unk16C < this->actor.xzDistToPlayer) && (Player_GetMask(play) == PLAYER_MASK_GARO) && !D_809AD810) {
|
||||
if (this->timer > 0) {
|
||||
this->timer--;
|
||||
} else {
|
||||
this->child =
|
||||
Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, this->childActorId, this->actor.world.pos.x,
|
||||
this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, this->childParams);
|
||||
if (this->child != NULL) {
|
||||
this->unk14E++;
|
||||
D_809AD810 = true;
|
||||
this->actionFunc = func_809AD194;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Encount3/func_809AD194.s")
|
||||
void func_809AD194(EnEncount3* this, PlayState* play) {
|
||||
if (this->unk14E == 0) {
|
||||
this->unk178 = 0.0f;
|
||||
if (this->switchFlag >= 0) {
|
||||
Flags_SetSwitch(play, this->switchFlag);
|
||||
}
|
||||
this->actionFunc = func_809AD1EC;
|
||||
}
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Encount3/func_809AD1EC.s")
|
||||
void func_809AD1EC(EnEncount3* this, PlayState* play) {
|
||||
if (this->unk174 < 0.002f) {
|
||||
D_809AD810 = false;
|
||||
Actor_Kill(&this->actor);
|
||||
}
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Encount3/EnEncount3_Update.s")
|
||||
void EnEncount3_Update(Actor* thisx, PlayState* play2) {
|
||||
EnEncount3* this = THIS;
|
||||
f32 new_var;
|
||||
PlayState* play = play2;
|
||||
Player* player = GET_PLAYER(play);
|
||||
f32 sp3C;
|
||||
f32 sp38;
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Encount3/EnEncount3_Draw.s")
|
||||
this->actionFunc(this, play);
|
||||
if (this->actionFunc == func_809AD194) {
|
||||
new_var = this->unk16C * 0.52f;
|
||||
if (new_var < this->actor.xzDistToPlayer) {
|
||||
this->unk178 = ((this->unk16C * 0.03125f) * 0.001f) + 0.1f;
|
||||
} else {
|
||||
this->unk178 = 0.06f;
|
||||
}
|
||||
|
||||
if (((this->unk16C + 50.0f) + BREG(0)) < this->actor.xzDistToPlayer) {
|
||||
if (this->actionFunc == func_809AD194) {
|
||||
this->unk148 = 0;
|
||||
this->unk178 = 0.0f;
|
||||
D_809AD810 = false;
|
||||
if (((this->child != NULL) && (this->child->update != NULL)) && (this->child->colChkInfo.health > 0)) {
|
||||
Actor_Kill(this->child);
|
||||
this->child = NULL;
|
||||
}
|
||||
func_809AD058(this);
|
||||
}
|
||||
} else if (this->unk16C < this->actor.xzDistToPlayer) {
|
||||
s16 i;
|
||||
|
||||
for (i = 0; i < PLAYER_BODYPART_MAX; i++) {
|
||||
player->flameTimers[i] = Rand_S16Offset(0, 200);
|
||||
}
|
||||
player->isBurning = true;
|
||||
|
||||
sp3C = this->actor.world.pos.x - player->actor.world.pos.x;
|
||||
sp38 = this->actor.world.pos.z - player->actor.world.pos.z;
|
||||
if (!Play_InCsMode(play)) {
|
||||
func_800B8D50(play, &this->actor, 10.0f, Math_Atan2S_XY(sp38, sp3C), 0.0f, 1);
|
||||
}
|
||||
}
|
||||
this->child->colChkInfo = this->child->colChkInfo;
|
||||
}
|
||||
|
||||
this->unk168 = this->unk16C;
|
||||
this->unk168 /= 7666.0f;
|
||||
if (this->actionFunc != func_809AD194) {
|
||||
Math_ApproachZeroF(&this->unk170, 0.3f, 10.0f);
|
||||
Math_ApproachZeroF(&this->unk160, 0.3f, 5.0f);
|
||||
if (this->unk160 < 1.0f) {
|
||||
play->unk_18880 = 0;
|
||||
}
|
||||
} else if (this->unk148 != 0) {
|
||||
Math_ApproachF(&this->unk170, 255.0f, 0.4f, 10.0f);
|
||||
Math_ApproachF(&this->unk160, 60.0f, 0.3f, 5.0f);
|
||||
}
|
||||
Math_ApproachF(&this->unk174, this->unk178, 0.3f, 0.03f);
|
||||
|
||||
this->unk164 = this->unk160 / 60.0f;
|
||||
if (this->unk164 != 0.0f) {
|
||||
play->envCtx.lightSettings.fogNear = (960 - play->envCtx.unk_C4.fogNear) * this->unk164;
|
||||
play->envCtx.lightSettings.fogColor[0] = (40.0f - play->envCtx.unk_C4.fogColor[0]) * this->unk164;
|
||||
play->envCtx.lightSettings.fogColor[1] = (10.0f - play->envCtx.unk_C4.fogColor[1]) * this->unk164;
|
||||
play->envCtx.lightSettings.fogColor[2] = (0.0f - play->envCtx.unk_C4.fogColor[2]) * this->unk164;
|
||||
}
|
||||
}
|
||||
|
||||
void EnEncount3_Draw(Actor* thisx, PlayState* play) {
|
||||
EnEncount3* this = THIS;
|
||||
s32 pad;
|
||||
|
||||
if (this->unk170 > 0.0f) {
|
||||
OPEN_DISPS(play->state.gfxCtx);
|
||||
|
||||
Gfx_SetupDL25_Xlu(play->state.gfxCtx);
|
||||
Matrix_Push();
|
||||
|
||||
gDPPipeSync(POLY_XLU_DISP++);
|
||||
gSPSegment(POLY_XLU_DISP++, 0x08,
|
||||
Gfx_TwoTexScroll(play->state.gfxCtx, 0, (s32)play->gameplayFrames, 0, 0x20, 0x40, 1,
|
||||
(s32)play->gameplayFrames * -2, (s32)play->gameplayFrames * -8, 0x20, 0x20));
|
||||
|
||||
gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 200, 0, (s8)this->unk170);
|
||||
gDPSetEnvColor(POLY_XLU_DISP++, 255, 0, 0, 128);
|
||||
|
||||
Matrix_Translate(this->actor.world.pos.x, this->actor.world.pos.y - 40.0f, this->actor.world.pos.z,
|
||||
MTXMODE_NEW);
|
||||
Matrix_Scale(this->unk168, this->unk174, this->unk168, MTXMODE_APPLY);
|
||||
|
||||
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
||||
gSPDisplayList(POLY_XLU_DISP++, object_big_fwall_DL_0009A0);
|
||||
|
||||
Matrix_Pop();
|
||||
CLOSE_DISPS(play->state.gfxCtx);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,10 +7,36 @@ struct EnEncount3;
|
|||
|
||||
typedef void (*EnEncount3ActionFunc)(struct EnEncount3*, PlayState*);
|
||||
|
||||
#define ENCOUNT3_GET_SPAWN_INDEX(thisx) (((thisx)->params >> 0xC) & 0xF)
|
||||
#define ENCOUNT3_GET_PARAM_F80(thisx) (((thisx)->params >> 7) & 0x1F)
|
||||
#define ENCOUNT3_GET_SWITCH_FLAG(thisx) ((thisx)->params & 0x7F)
|
||||
|
||||
#define ENCOUNT3_GET_ROTZ(thisx) ((thisx)->world.rot.z)
|
||||
|
||||
typedef struct EnEncount3 {
|
||||
/* 0x000 */ Actor actor;
|
||||
/* 0x144 */ EnEncount3ActionFunc actionFunc;
|
||||
/* 0x148 */ char unk_148[0x84];
|
||||
/* 0x148 */ u8 unk148;
|
||||
/* 0x14A */ s16 unk14A;
|
||||
/* 0x14C */ UNK_TYPE1 pad14C[0x2];
|
||||
/* 0x14E */ s16 unk14E;
|
||||
/* 0x150 */ s16 unk150;
|
||||
/* 0x152 */ s16 unk152;
|
||||
/* 0x154 */ s16 childActorId;
|
||||
/* 0x156 */ s16 unk156;
|
||||
/* 0x158 */ s16 childParams;
|
||||
/* 0x15A */ s16 csId;
|
||||
/* 0x15C */ s16 switchFlag;
|
||||
/* 0x15E */ s16 timer;
|
||||
/* 0x160 */ f32 unk160;
|
||||
/* 0x164 */ f32 unk164;
|
||||
/* 0x168 */ f32 unk168;
|
||||
/* 0x16C */ f32 unk16C;
|
||||
/* 0x170 */ f32 unk170;
|
||||
/* 0x174 */ f32 unk174;
|
||||
/* 0x178 */ f32 unk178;
|
||||
/* 0x17C */ Actor* child;
|
||||
/* 0x180 */ UNK_TYPE1 unk180[0x4C];
|
||||
} EnEncount3; // size = 0x1CC
|
||||
|
||||
#endif // Z_EN_ENCOUNT3_H
|
||||
|
|
Loading…
Reference in New Issue