ovl_Oceff_Storm OK (#1010)

* all functions matching

* all functions matching

* all functions matching (for real this time)

* data extracted and imported

* ovl_Oceff_Storm OK

* reloc

* pr review

* texture name

* renamings

* renamings

* Magic_Reset

* pr review

* gSPTextureRectangle

* pr review
This commit is contained in:
SonicDcer
2022-10-04 05:03:53 +01:00
committed by GitHub
parent 362a73a017
commit 4833c08364
5 changed files with 208 additions and 19 deletions
+12
View File
@@ -0,0 +1,12 @@
<Root>
<ExternalFile XmlPath="objects/gameplay_keep.xml" OutPath="assets/objects/gameplay_keep/"/>
<File Name="ovl_Oceff_Storm" BaseAddress="0x80981760" RangeStart="0x830" RangeEnd="0x1BC0">
<Texture Name="sSongOfStormsEffectTex" OutName="song_of_storms_effect" Format="i8" Width="64" Height="64" Offset="0x830"/>
<DList Name="sSongOfStormsMaterialDL" Offset="0x1830"/>
<Array Name="sSongOfStormsCylinderVtx" Count="27" Offset="0x18D8">
<Vtx/>
</Array>
<DList Name="sSongOfStormsCylinderMaterialDL" Offset="0x1A88"/>
<DList Name="sSongOfStormsCylinderModelDL" Offset="0x1B30"/>
</File>
</Root>
+1 -2
View File
@@ -1938,8 +1938,7 @@ beginseg
name "ovl_Oceff_Storm"
compress
include "build/src/overlays/actors/ovl_Oceff_Storm/z_oceff_storm.o"
include "build/data/ovl_Oceff_Storm/ovl_Oceff_Storm.data.o"
include "build/data/ovl_Oceff_Storm/ovl_Oceff_Storm.reloc.o"
include "build/src/overlays/actors/ovl_Oceff_Storm/ovl_Oceff_Storm_reloc.o"
endseg
beginseg
@@ -15,12 +15,10 @@ void OceffStorm_Destroy(Actor* thisx, PlayState* play);
void OceffStorm_Update(Actor* thisx, PlayState* play);
void OceffStorm_Draw(Actor* thisx, PlayState* play);
void func_80981928(OceffStorm* this, PlayState* play);
void OceffStorm_DefaultAction(OceffStorm* this, PlayState* play);
void func_80981B48(OceffStorm* this, PlayState* play);
void OceffStorm_Draw2(Actor* thisx, PlayState* play);
void OceffStorm_SetupAction(OceffStorm* this, OceffStormActionFunc actionFunc);
#if 0
const ActorInit Oceff_Storm_InitVars = {
ACTOR_OCEFF_STORM,
ACTORCAT_ITEMACTION,
@@ -33,22 +31,194 @@ const ActorInit Oceff_Storm_InitVars = {
(ActorFunc)OceffStorm_Draw,
};
#endif
void OceffStorm_SetupAction(OceffStorm* this, OceffStormActionFunc actionFunc) {
this->actionFunc = actionFunc;
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Oceff_Storm/OceffStorm_SetupAction.s")
s32 func_8098176C(PlayState* play) {
s32 ret = false;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Oceff_Storm/func_8098176C.s")
switch (play->sceneId) {
case SCENE_13HUBUKINOMITI:
case SCENE_11GORONNOSATO:
case SCENE_10YUKIYAMANOMURA:
case SCENE_14YUKIDAMANOMITI:
case SCENE_12HAKUGINMAE:
case SCENE_17SETUGEN:
case SCENE_GORONRACE:
if (gSaveContext.sceneLayer == 0) {
ret = true;
}
break;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Oceff_Storm/OceffStorm_Init.s")
case SCENE_10YUKIYAMANOMURA2:
if (gSaveContext.sceneLayer == 1) {
ret = true;
}
break;
}
return ret;
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Oceff_Storm/OceffStorm_Destroy.s")
void OceffStorm_Init(Actor* thisx, PlayState* play) {
s32 pad[2];
Player* player = GET_PLAYER(play);
OceffStorm* this = THIS;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Oceff_Storm/func_80981928.s")
OceffStorm_SetupAction(this, OceffStorm_DefaultAction);
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Oceff_Storm/func_80981B48.s")
this->posYOffAdd = 0;
this->counter = 0;
this->primColorAlpha = 0;
this->vtxAlpha = 0;
this->actor.scale.y = 0.0f;
this->actor.scale.z = 0.0f;
this->actor.scale.x = 0.0f;
this->posYOff = this->posYOffAdd;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Oceff_Storm/OceffStorm_Update.s")
if (this->actor.params == OCEFF_STORM_ACTION_PARAM_1) {
OceffStorm_SetupAction(this, func_80981B48);
this->actor.draw = OceffStorm_Draw2;
} else {
this->actor.world.pos.y = player->actor.world.pos.y;
this->actor.world.pos.x = player->bodyPartsPos[0].x;
this->actor.world.pos.z = player->bodyPartsPos[0].z;
gSaveContext.jinxTimer = 0;
if ((play->interfaceCtx.restrictions.songOfStorms == 0) && !func_8098176C(play)) {
Actor_Spawn(&play->actorCtx, play, ACTOR_EN_OKARINA_EFFECT, this->actor.world.pos.x,
this->actor.world.pos.y - 30.0f, this->actor.world.pos.z, 0, 0, 0, 1);
}
}
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Oceff_Storm/func_80981BB8.s")
void OceffStorm_Destroy(Actor* thisx, PlayState* play) {
OceffStorm* this = THIS;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Oceff_Storm/OceffStorm_Draw.s")
Magic_Reset(play);
}
void OceffStorm_DefaultAction(OceffStorm* this, PlayState* play) {
f32 cylinderScale;
switch (gSaveContext.save.playerForm) {
default:
cylinderScale = 1.0f;
break;
case PLAYER_FORM_DEKU:
cylinderScale = 1.3f;
break;
case PLAYER_FORM_ZORA:
cylinderScale = 1.2f;
break;
case PLAYER_FORM_GORON:
cylinderScale = 2.0f;
break;
}
if (this->counter < 10) {
this->primColorAlpha = (s8)(this->counter * 10.0f);
} else if (this->counter > 60) {
this->primColorAlpha = (s8)((70 - this->counter) * 10.0f);
} else {
this->primColorAlpha = 100;
}
if ((this->counter < 10) || (this->counter >= 60)) {
this->vtxAlpha = 0;
} else if (this->counter <= 40) {
if (this->vtxAlpha <= 200) {
this->vtxAlpha += 10;
}
this->actor.scale.x = this->actor.scale.z = 0.4f * cylinderScale;
this->actor.scale.y = 0.3f;
} else if (this->counter > 40) {
this->vtxAlpha = (60 - this->counter) * 10;
} else {
this->actor.scale.x = this->actor.scale.z = 0.4f * cylinderScale;
this->vtxAlpha = -1;
}
if (this->counter > 40) {
this->actor.world.pos.y += this->posYOff * 0.01f;
this->posYOff += this->posYOffAdd;
this->posYOffAdd += 10;
}
if (this->counter < 70) {
this->counter++;
} else {
Actor_MarkForDeath(&this->actor);
}
}
void func_80981B48(OceffStorm* this, PlayState* play) {
if (this->primColorAlpha < 100) {
this->primColorAlpha += 5;
}
//! @bug Actor_Kill is never called so the actor will stay alive forever
}
void OceffStorm_Update(Actor* thisx, PlayState* play) {
OceffStorm* this = THIS;
this->actor.shape.rot.y = Camera_GetCamDirYaw(GET_ACTIVE_CAM(play));
this->actionFunc(this, play);
}
#include "assets/overlays/ovl_Oceff_Storm/ovl_Oceff_Storm.c"
void OceffStorm_Draw2(Actor* thisx, PlayState* play) {
s32 scroll = play->state.frames & 0xFFF;
OceffStorm* this = THIS;
OPEN_DISPS(play->state.gfxCtx);
gDPPipeSync(POLY_XLU_DISP++);
POLY_XLU_DISP = func_8012C3A4(POLY_XLU_DISP);
gDPSetAlphaDither(POLY_XLU_DISP++, G_AD_NOISE);
gDPSetColorDither(POLY_XLU_DISP++, G_CD_NOISE);
gDPSetPrimColor(POLY_XLU_DISP++, 0x80, 0x80, 200, 200, 150, this->primColorAlpha);
gSPDisplayList(POLY_XLU_DISP++, &sSongOfStormsMaterialDL);
gSPDisplayList(POLY_XLU_DISP++, Gfx_TwoTexScroll(play->state.gfxCtx, G_TX_RENDERTILE, scroll * 8, scroll * 4, 64,
64, 1, scroll * 4, scroll * 4, 64, 64));
gSPTextureRectangle(POLY_XLU_DISP++, 0, 0, SCREEN_WIDTH << 2, SCREEN_HEIGHT << 2, G_TX_RENDERTILE, 0, 0,
(s32)(0.13671875 * (1 << 10)), (s32)(-0.13671875 * (1 << 10)));
CLOSE_DISPS(play->state.gfxCtx);
}
void OceffStorm_Draw(Actor* thisx, PlayState* play) {
u32 scroll = play->state.frames & 0xFFF;
OceffStorm* this = (OceffStorm*)thisx;
Vtx* vtxPtr = sSongOfStormsCylinderVtx;
OPEN_DISPS(play->state.gfxCtx);
func_8012C2DC(play->state.gfxCtx);
gDPSetPrimColor(POLY_XLU_DISP++, 0x80, 0x80, 255, 255, 200, 255);
gDPSetEnvColor(POLY_XLU_DISP++, 150, 150, 0, 128);
gDPSetAlphaDither(POLY_XLU_DISP++, G_AD_NOISE);
gDPSetColorDither(POLY_XLU_DISP++, G_CD_NOISE);
vtxPtr[0].v.cn[3] = vtxPtr[6].v.cn[3] = vtxPtr[16].v.cn[3] = vtxPtr[25].v.cn[3] = this->vtxAlpha >> 1;
vtxPtr[10].v.cn[3] = vtxPtr[22].v.cn[3] = this->vtxAlpha;
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPDisplayList(POLY_XLU_DISP++, &sSongOfStormsCylinderMaterialDL);
gSPDisplayList(POLY_XLU_DISP++, Gfx_TwoTexScroll(play->state.gfxCtx, G_TX_RENDERTILE, scroll * 4, (0 - scroll) * 8,
32, 32, 1, scroll * 8, (0 - scroll) * 12, 32, 32));
gSPDisplayList(POLY_XLU_DISP++, &sSongOfStormsCylinderModelDL);
CLOSE_DISPS(play->state.gfxCtx);
OceffStorm_Draw2(&this->actor, play);
}
@@ -9,10 +9,18 @@ typedef void (*OceffStormActionFunc)(struct OceffStorm*, PlayState*);
typedef struct OceffStorm {
/* 0x000 */ Actor actor;
/* 0x144 */ char unk_144[0x8];
/* 0x144 */ u16 counter;
/* 0x146 */ u8 primColorAlpha;
/* 0x147 */ u8 vtxAlpha;
/* 0x148 */ s16 posYOff;
/* 0x14A */ s16 posYOffAdd;
/* 0x14C */ OceffStormActionFunc actionFunc;
} OceffStorm; // size = 0x150
extern const ActorInit Oceff_Storm_InitVars;
typedef enum {
/* 1 */ OCEFF_STORM_ACTION_PARAM_1 = 1
} OceffStormActionParams;
#endif // Z_OCEFF_STORM_H
+2 -2
View File
@@ -8245,10 +8245,10 @@
0x8098176C:("func_8098176C",),
0x809817E4:("OceffStorm_Init",),
0x80981904:("OceffStorm_Destroy",),
0x80981928:("func_80981928",),
0x80981928:("OceffStorm_DefaultAction",),
0x80981B48:("func_80981B48",),
0x80981B68:("OceffStorm_Update",),
0x80981BB8:("func_80981BB8",),
0x80981BB8:("OceffStorm_Draw2",),
0x80981D68:("OceffStorm_Draw",),
0x80983520:("ObjDemo_Init",),
0x80983634:("func_80983634",),