1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2025-08-07 06:40:15 +00:00
* Approx. half of en_rl matched

* More En_Rl work

* 5 functions left

* One function left

* En_Rl OK and all matching

* Formatted and cleaned up style things.

* Deleted asm and fixed spec

* Forgot to delete the stuff in the data folder again

* Made all requested changes.

* Forgot one requested change

* Implemented dragorn's documentation suggestions

* Implemented dragorn's documentation suggestions

* Made further requested changes

Co-authored-by: fig02 <fig02srl@gmail.com>
This commit is contained in:
fullgrowngaming 2020-10-04 07:09:20 -07:00 committed by GitHub
parent 269aa0f36f
commit 85cf70bcd3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
39 changed files with 397 additions and 1190 deletions

View file

@ -1,4 +1,11 @@
/*
* File: z_en_rl.c
* Overlay: En_Rl
* Description: Rauru
*/
#include "z_en_rl.h"
#include "vt.h"
#define FLAGS 0x00000010
@ -9,7 +16,376 @@ void EnRl_Destroy(Actor* thisx, GlobalContext* globalCtx);
void EnRl_Update(Actor* thisx, GlobalContext* globalCtx);
void EnRl_Draw(Actor* thisx, GlobalContext* globalCtx);
/*
void func_80AE7798(EnRl* this, GlobalContext* globalCtx);
void func_80AE77B8(EnRl* this, GlobalContext* globalCtx);
void func_80AE77F8(EnRl* this, GlobalContext* globalCtx);
void func_80AE7838(EnRl* this, GlobalContext* globalCtx);
void func_80AE7C64(EnRl* this, GlobalContext* globalCtx);
void func_80AE7C94(EnRl* this, GlobalContext* globalCtx);
void func_80AE7CE8(EnRl* this, GlobalContext* globalCtx);
void func_80AE7D40(EnRl* this, GlobalContext* globalCtx);
void func_80AE7FD0(EnRl* this, GlobalContext* globalCtx);
void func_80AE7FDC(EnRl* this, GlobalContext* globalCtx);
void func_80AE7D94(EnRl* this, GlobalContext* globalCtx);
UNK_PTR D_80AE81A0[] = { 0x06003620, 0x06003960, 0x06003B60 };
extern SkeletonHeader D_06007B38;
extern AnimationHeader D_06000A3C;
extern AnimationHeader D_06000830;
extern AnimationHeader D_0600040C;
void EnRl_Destroy(Actor* thisx, GlobalContext* globalCtx) {
EnRl* this = THIS;
SkelAnime_Free(&this->skelAnime, globalCtx);
}
void func_80AE72D0(EnRl* this) {
s32 pad[3];
s16* timer = &this->timer;
s16* eyeTextureIndex = &this->eyeTextureIndex;
if (DECR(*timer) == 0) {
*timer = Math_Rand_S16Offset(60, 60);
}
*eyeTextureIndex = *timer;
if (*eyeTextureIndex > 2) {
*eyeTextureIndex = 0;
}
}
void func_80AE7358(EnRl* this) {
SkelAnime_ChangeAnim(&this->skelAnime, &D_06000A3C, 1.0f, 0.0f, SkelAnime_GetFrameCount(&D_06000A3C.genericHeader),
0, 0.0f);
this->action = 4;
this->drawConfig = 0;
this->alpha = 0;
this->lightBallSpawned = 0;
this->actor.shape.unk_14 = 0;
this->unk_19C = 0.0f;
}
void func_80AE73D8(EnRl* this, GlobalContext* globalCtx) {
static s32 D_80AE81AC = 0;
if (globalCtx->csCtx.state == 0) {
if (D_80AE81AC) {
if (this->actor.params == 2) {
func_80AE7358(this);
}
D_80AE81AC = 0;
}
} else if (!D_80AE81AC) {
D_80AE81AC = 1;
}
}
void func_80AE744C(EnRl* this, GlobalContext* globalCtx) {
func_8002E4B4(globalCtx, &this->actor, 75.0f, 30.0f, 30.0f, 5);
}
s32 func_80AE7494(EnRl* this) {
return SkelAnime_FrameUpdateMatrix(&this->skelAnime);
}
s32 func_80AE74B4(EnRl* this, GlobalContext* globalCtx, u16 arg2, s32 arg3) {
CsCmdActorAction* csCmdActorAction;
if (globalCtx->csCtx.state != 0) {
csCmdActorAction = globalCtx->csCtx.npcActions[arg3];
if (csCmdActorAction != NULL && csCmdActorAction->action == arg2) {
return 1;
}
}
return 0;
}
s32 func_80AE74FC(EnRl* this, GlobalContext* globalCtx, u16 arg2, s32 arg3) {
CsCmdActorAction* csCmdActorAction;
if (globalCtx->csCtx.state != 0) {
csCmdActorAction = globalCtx->csCtx.npcActions[arg3];
if (csCmdActorAction != NULL && csCmdActorAction->action != arg2) {
return 1;
}
}
return 0;
}
void func_80AE7544(EnRl* this, GlobalContext* globalCtx) {
SkelAnime_InitSV(globalCtx, &this->skelAnime, &D_06007B38, &D_06000A3C, 0, 0, 0);
}
void func_80AE7590(EnRl* this, GlobalContext* globalCtx) {
s32 pad;
Player* player;
Vec3f pos;
s16 sceneNum = globalCtx->sceneNum;
if (gSaveContext.sceneSetupIndex == 4 && sceneNum == SCENE_KENJYANOMA && globalCtx->csCtx.state != 0 &&
globalCtx->csCtx.npcActions[6] != NULL && globalCtx->csCtx.npcActions[6]->action == 2 &&
!this->lightMedallionGiven) {
player = PLAYER;
pos.x = player->actor.posRot.pos.x;
pos.y = player->actor.posRot.pos.y + 80.0f;
pos.z = player->actor.posRot.pos.z;
Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_DEMO_EFFECT, pos.x, pos.y, pos.z, 0, 0, 0, 0xE);
Item_Give(globalCtx, ITEM_MEDALLION_LIGHT);
this->lightMedallionGiven = 1;
}
}
void func_80AE7668(EnRl* this, GlobalContext* globalCtx) {
Player* player = PLAYER;
this->drawConfig = 1;
this->action = 1;
player->actor.posRot.rot.y = player->actor.shape.rot.y = this->actor.posRot.rot.y + 0x8000;
}
void func_80AE7698(EnRl* this, GlobalContext* globalCtx) {
CsCmdActorAction* csCmdActorAction;
if (globalCtx->csCtx.state != 0) {
csCmdActorAction = globalCtx->csCtx.npcActions[0];
if (csCmdActorAction != NULL && csCmdActorAction->action == 3) {
SkelAnime_ChangeAnim(&this->skelAnime, &D_0600040C, 1.0f, 0.0f,
SkelAnime_GetFrameCount(&D_0600040C.genericHeader), 2, 0.0f);
this->action = 2;
}
}
}
void func_80AE772C(EnRl* this, s32 arg1) {
if (arg1) {
SkelAnime_ChangeAnim(&this->skelAnime, &D_06000830, 1.0f, 0.0f,
SkelAnime_GetFrameCount(&D_06000830.genericHeader), 0, 0.0f);
this->action = 3;
}
}
void func_80AE7798(EnRl* this, GlobalContext* globalCtx) {
func_80AE7668(this, globalCtx);
}
void func_80AE77B8(EnRl* this, GlobalContext* globalCtx) {
func_80AE744C(this, globalCtx);
func_80AE7494(this);
func_80AE72D0(this);
func_80AE7698(this, globalCtx);
}
void func_80AE77F8(EnRl* this, GlobalContext* globalCtx) {
s32 temp;
func_80AE744C(this, globalCtx);
temp = func_80AE7494(this);
func_80AE72D0(this);
func_80AE772C(this, temp);
}
void func_80AE7838(EnRl* this, GlobalContext* globalCtx) {
func_80AE744C(this, globalCtx);
func_80AE7494(this);
func_80AE72D0(this);
func_80AE7590(this, globalCtx);
}
void func_80AE7878(EnRl* this, GlobalContext* globalCtx) {
SkelAnime_InitSV(globalCtx, &this->skelAnime, &D_06007B38, &D_06000A3C, 0, 0, 0);
this->action = 4;
this->actor.shape.unk_14 = 0;
}
void func_80AE78D4(EnRl* this, GlobalContext* globalCtx) {
Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_DEMO_6K, this->actor.posRot.pos.x,
kREG(18) + 22.0f + this->actor.posRot.pos.y, this->actor.posRot.pos.z, 0, 0, 0, 5);
}
void func_80AE7954(EnRl* this, GlobalContext* globalCtx) {
if (func_80AE74B4(this, globalCtx, 4, 0)) {
this->action = 5;
this->drawConfig = 2;
this->alpha = 0;
this->actor.shape.unk_14 = 0;
this->unk_19C = 0.0f;
}
}
void func_80AE79A4(EnRl* this, GlobalContext* globalCtx) {
f32* unk_19C = &this->unk_19C;
s32 alpha = 255;
if (func_80AE74B4(this, globalCtx, 4, 0)) {
*unk_19C += 1.0f;
if (*unk_19C >= kREG(5) + 10.0f) {
this->action = 7;
this->drawConfig = 1;
*unk_19C = kREG(5) + 10.0f;
this->alpha = alpha;
this->actor.shape.unk_14 = alpha;
return;
}
} else {
*unk_19C -= 1.0f;
if (*unk_19C <= 0.0f) {
this->action = 4;
this->drawConfig = 0;
*unk_19C = 0.0f;
this->alpha = 0;
this->actor.shape.unk_14 = 0;
return;
}
}
alpha = (*unk_19C / (kREG(5) + 10.0f)) * 255.0f;
this->alpha = alpha;
this->actor.shape.unk_14 = alpha;
}
void func_80AE7AF8(EnRl* this, GlobalContext* globalCtx) {
if (func_80AE74B4(this, globalCtx, 3, 0)) {
SkelAnime_ChangeAnim(&this->skelAnime, &D_0600040C, 1.0f, 0.0f,
SkelAnime_GetFrameCount(&D_0600040C.genericHeader), 2, -8.0f);
this->action = 6;
} else if (func_80AE74FC(this, globalCtx, 4, 0)) {
this->action = 5;
this->drawConfig = 2;
this->unk_19C = kREG(5) + 10.0f;
this->alpha = 255;
if (!this->lightBallSpawned) {
func_80AE78D4(this, globalCtx);
this->lightBallSpawned = 1;
}
this->actor.shape.unk_14 = 0xFF;
}
}
void func_80AE7BF8(EnRl* this, s32 arg1) {
if (arg1 != 0) {
SkelAnime_ChangeAnim(&this->skelAnime, &D_06000830, 1.0f, 0.0f,
SkelAnime_GetFrameCount(&D_06000830.genericHeader), 0, 0.0f);
this->action = 7;
}
}
void func_80AE7C64(EnRl* this, GlobalContext* globalCtx) {
func_80AE7954(this, globalCtx);
func_80AE73D8(this, globalCtx);
}
void func_80AE7C94(EnRl* this, GlobalContext* globalCtx) {
func_80AE744C(this, globalCtx);
func_80AE7494(this);
func_80AE72D0(this);
func_80AE79A4(this, globalCtx);
func_80AE73D8(this, globalCtx);
}
void func_80AE7CE8(EnRl* this, GlobalContext* globalCtx) {
s32 temp;
func_80AE744C(this, globalCtx);
temp = func_80AE7494(this);
func_80AE72D0(this);
func_80AE7BF8(this, temp);
func_80AE73D8(this, globalCtx);
}
void func_80AE7D40(EnRl* this, GlobalContext* globalCtx) {
func_80AE744C(this, globalCtx);
func_80AE7494(this);
func_80AE72D0(this);
func_80AE7AF8(this, globalCtx);
func_80AE73D8(this, globalCtx);
}
void func_80AE7D94(EnRl* this, GlobalContext* globalCtx) {
s32 pad[2];
s16 temp = this->eyeTextureIndex;
s32 addr = D_80AE81A0[temp];
SkelAnime* skelAnime = &this->skelAnime;
OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_rl_inKenjyanomaDemo02.c", 304);
func_80093D84(globalCtx->state.gfxCtx);
gSPSegment(oGfxCtx->polyXlu.p++, 0x08, SEGMENTED_TO_VIRTUAL(addr));
gSPSegment(oGfxCtx->polyXlu.p++, 0x09, SEGMENTED_TO_VIRTUAL(addr));
gDPSetEnvColor(oGfxCtx->polyXlu.p++, 0, 0, 0, this->alpha);
gSPSegment(oGfxCtx->polyXlu.p++, 0x0C, D_80116280);
oGfxCtx->polyXlu.p = SkelAnime_DrawSV2(globalCtx, skelAnime->skeleton, skelAnime->limbDrawTbl,
skelAnime->dListCount, NULL, NULL, NULL, oGfxCtx->polyXlu.p);
CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_rl_inKenjyanomaDemo02.c", 331);
}
EnRlActionFunc sActionFuncs[] = {
func_80AE7798, func_80AE77B8, func_80AE77F8, func_80AE7838,
func_80AE7C64, func_80AE7C94, func_80AE7CE8, func_80AE7D40,
};
void EnRl_Update(Actor* thisx, GlobalContext* globalCtx) {
EnRl* this = THIS;
if ((this->action < 0) || (this->action > 7) || (sActionFuncs[this->action] == NULL)) {
osSyncPrintf(VT_FGCOL(RED) "メインモードがおかしい!!!!!!!!!!!!!!!!!!!!!!!!!\n" VT_RST);
return;
}
sActionFuncs[this->action](this, globalCtx);
}
void EnRl_Init(Actor* thisx, GlobalContext* globalCtx) {
EnRl* this = THIS;
ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawFunc_Circle, 50.0f);
if (this->actor.params == 2) {
func_80AE7878(this, globalCtx);
} else {
func_80AE7544(this, globalCtx);
}
}
void func_80AE7FD0(EnRl* this, GlobalContext* globalCtx) {
}
void func_80AE7FDC(EnRl* this, GlobalContext* globalCtx) {
s32 pad[2];
s16 temp = this->eyeTextureIndex;
s32 addr = D_80AE81A0[temp];
SkelAnime* skelAnime = &this->skelAnime;
OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_rl.c", 416);
func_80093D18(globalCtx->state.gfxCtx);
gSPSegment(oGfxCtx->polyOpa.p++, 0x08, SEGMENTED_TO_VIRTUAL(addr));
gSPSegment(oGfxCtx->polyOpa.p++, 0x09, SEGMENTED_TO_VIRTUAL(addr));
gDPSetEnvColor(oGfxCtx->polyOpa.p++, 0, 0, 0, 255);
gSPSegment(oGfxCtx->polyOpa.p++, 0x0C, &D_80116280[2]);
SkelAnime_DrawSV(globalCtx, skelAnime->skeleton, skelAnime->limbDrawTbl, skelAnime->dListCount, NULL, NULL,
&this->actor);
CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_rl.c", 437);
}
EnRlDrawFunc sDrawFuncs[] = {
func_80AE7FD0,
func_80AE7FDC,
func_80AE7D94,
};
void EnRl_Draw(Actor* thisx, GlobalContext* globalCtx) {
EnRl* this = THIS;
if (this->drawConfig < 0 || this->drawConfig >= 3 || sDrawFuncs[this->drawConfig] == NULL) {
osSyncPrintf(VT_FGCOL(RED) "描画モードがおかしい!!!!!!!!!!!!!!!!!!!!!!!!!\n" VT_RST);
return;
}
sDrawFuncs[this->drawConfig](this, globalCtx);
}
const ActorInit En_Rl_InitVars = {
ACTOR_EN_RL,
ACTORTYPE_NPC,
@ -20,70 +396,4 @@ const ActorInit En_Rl_InitVars = {
(ActorFunc)EnRl_Destroy,
(ActorFunc)EnRl_Update,
(ActorFunc)EnRl_Draw,
};
*/
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Rl/EnRl_Destroy.s")
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Rl/func_80AE72D0.s")
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Rl/func_80AE7358.s")
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Rl/func_80AE73D8.s")
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Rl/func_80AE744C.s")
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Rl/func_80AE7494.s")
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Rl/func_80AE74B4.s")
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Rl/func_80AE74FC.s")
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Rl/func_80AE7544.s")
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Rl/func_80AE7590.s")
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Rl/func_80AE7668.s")
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Rl/func_80AE7698.s")
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Rl/func_80AE772C.s")
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Rl/func_80AE7798.s")
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Rl/func_80AE77B8.s")
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Rl/func_80AE77F8.s")
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Rl/func_80AE7838.s")
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Rl/func_80AE7878.s")
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Rl/func_80AE78D4.s")
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Rl/func_80AE7954.s")
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Rl/func_80AE79A4.s")
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Rl/func_80AE7AF8.s")
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Rl/func_80AE7BF8.s")
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Rl/func_80AE7C64.s")
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Rl/func_80AE7C94.s")
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Rl/func_80AE7CE8.s")
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Rl/func_80AE7D40.s")
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Rl/func_80AE7D94.s")
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Rl/EnRl_Update.s")
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Rl/EnRl_Init.s")
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Rl/func_80AE7FD0.s")
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Rl/func_80AE7FDC.s")
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Rl/EnRl_Draw.s")
};

View file

@ -6,9 +6,20 @@
struct EnRl;
typedef void (*EnRlActionFunc)(struct EnRl*, GlobalContext*);
typedef void (*EnRlDrawFunc)(struct EnRl*, GlobalContext*);
typedef struct EnRl {
/* 0x0000 */ Actor actor;
/* 0x014C */ char unk_14C[0x60];
/* 0x014C */ SkelAnime skelAnime;
/* 0x0190 */ s16 eyeTextureIndex;
/* 0x0192 */ s16 timer;
/* 0x0194 */ s32 action;
/* 0x0198 */ s32 drawConfig;
/* 0x019C */ f32 unk_19C;
/* 0x01A0 */ s32 alpha;
/* 0x01A4 */ u32 lightBallSpawned;
/* 0x01A8 */ s32 lightMedallionGiven;
} EnRl; // size = 0x01AC
extern const ActorInit En_Rl_InitVars;