mirror of
https://github.com/zeldaret/oot.git
synced 2025-08-07 23:10:22 +00:00
z_en_takara_man OK (#380)
* started * Decompiled z_en_takara_man, added CHOICE_NO and CHOICE_YES defines * use generated reloc * Removed choice index define due to inconsistencies * Made suggested changes
This commit is contained in:
parent
0dca636f4a
commit
7c7d292730
17 changed files with 219 additions and 660 deletions
|
@ -5,6 +5,7 @@
|
|||
*/
|
||||
|
||||
#include "z_en_takara_man.h"
|
||||
#include <vt.h>
|
||||
|
||||
#define FLAGS 0x08000039
|
||||
|
||||
|
@ -15,7 +16,13 @@ void EnTakaraMan_Destroy(Actor* thisx, GlobalContext* globalCtx);
|
|||
void EnTakaraMan_Update(Actor* thisx, GlobalContext* globalCtx);
|
||||
void EnTakaraMan_Draw(Actor* thisx, GlobalContext* globalCtx);
|
||||
|
||||
/*
|
||||
void func_80B176E0(EnTakaraMan* this, GlobalContext* globalCtx);
|
||||
void func_80B1778C(EnTakaraMan* this, GlobalContext* globalCtx);
|
||||
void func_80B17B14(EnTakaraMan* this, GlobalContext* globalCtx);
|
||||
void func_80B17934(EnTakaraMan* this, GlobalContext* globalCtx);
|
||||
void func_80B17A6C(EnTakaraMan* this, GlobalContext* globalCtx);
|
||||
void func_80B17AC4(EnTakaraMan* this, GlobalContext* globalCtx);
|
||||
|
||||
const ActorInit En_Takara_Man_InitVars = {
|
||||
ACTOR_EN_TAKARA_MAN,
|
||||
ACTORTYPE_NPC,
|
||||
|
@ -27,25 +34,201 @@ const ActorInit En_Takara_Man_InitVars = {
|
|||
(ActorFunc)EnTakaraMan_Update,
|
||||
(ActorFunc)EnTakaraMan_Draw,
|
||||
};
|
||||
*/
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Takara_Man/EnTakaraMan_Destroy.s")
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Takara_Man/EnTakaraMan_Init.s")
|
||||
static u8 sTakaraIsInitialized = false;
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Takara_Man/func_80B176E0.s")
|
||||
extern SkeletonHeader D_06004FE0;
|
||||
extern AnimationHeader D_06000498;
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Takara_Man/func_80B1778C.s")
|
||||
void EnTakaraMan_Destroy(Actor* thisx, GlobalContext* globalCtx) {
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Takara_Man/func_80B17934.s")
|
||||
void EnTakaraMan_Init(Actor* thisx, GlobalContext* globalCtx) {
|
||||
EnTakaraMan* this = THIS;
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Takara_Man/func_80B17A6C.s")
|
||||
if (sTakaraIsInitialized) {
|
||||
Actor_Kill(&this->actor);
|
||||
osSyncPrintf(VT_FGCOL(GREEN) "☆☆☆☆☆ もういてる原 ☆☆☆☆☆ \n" VT_RST); // "Already initialized"
|
||||
return;
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Takara_Man/func_80B17AC4.s")
|
||||
sTakaraIsInitialized = true;
|
||||
osSyncPrintf("\n\n");
|
||||
osSyncPrintf(VT_FGCOL(PURPLE) "☆☆☆☆☆ ばぅん! ☆☆☆☆☆ %x\n" VT_RST,
|
||||
globalCtx->actorCtx.flags.chest); // "Bun! %x" (needs a better translation)
|
||||
globalCtx->actorCtx.flags.chest = 0;
|
||||
gSaveContext.dungeonKeys[gSaveContext.mapIndex] = -1;
|
||||
SkelAnime_InitSV(globalCtx, &this->skelAnime, &D_06004FE0, &D_06000498, this->limbDrawTbl, this->transitionDrawTbl,
|
||||
10);
|
||||
thisx->posRot2.pos = thisx->posRot.pos;
|
||||
this->pos = thisx->posRot.pos;
|
||||
thisx->posRot.pos.x = 133.0f;
|
||||
thisx->posRot.pos.y = -12.0f;
|
||||
thisx->posRot.pos.z = 102.0f;
|
||||
Actor_SetScale(&this->actor, 0.013f);
|
||||
this->height = 90.0f;
|
||||
this->originalRoomNum = thisx->room;
|
||||
thisx->room = -1;
|
||||
thisx->posRot.rot.y = thisx->shape.rot.y = -0x4E20;
|
||||
thisx->unk_1F = 1;
|
||||
this->actionFunc = func_80B176E0;
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Takara_Man/func_80B17B14.s")
|
||||
void func_80B176E0(EnTakaraMan* this, GlobalContext* globalCtx) {
|
||||
f32 frameCount = SkelAnime_GetFrameCount(&D_06000498.genericHeader);
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Takara_Man/EnTakaraMan_Update.s")
|
||||
SkelAnime_ChangeAnim(&this->skelAnime, &D_06000498, 1.0f, 0.0f, (s16)frameCount, 0, -10.0f);
|
||||
if (!this->unk_214) {
|
||||
this->actor.textId = 0x6D; // "Open the chest and..Surprise! ... 10 Rupees to play .. Yes/No"
|
||||
this->dialogState = 4;
|
||||
}
|
||||
this->actionFunc = func_80B1778C;
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Takara_Man/func_80B17C4C.s")
|
||||
void func_80B1778C(EnTakaraMan* this, GlobalContext* globalCtx) {
|
||||
s16 absYawDiff;
|
||||
s16 yawDiff;
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Takara_Man/EnTakaraMan_Draw.s")
|
||||
SkelAnime_FrameUpdateMatrix(&this->skelAnime);
|
||||
if (func_8002F194(&this->actor, globalCtx) && this->dialogState != 6) {
|
||||
if (!this->unk_214) {
|
||||
this->actionFunc = func_80B17934;
|
||||
} else {
|
||||
this->actionFunc = func_80B17B14;
|
||||
}
|
||||
} else {
|
||||
yawDiff = this->actor.yawTowardsLink - this->actor.shape.rot.y;
|
||||
if (globalCtx->roomCtx.curRoom.num == 6 && !this->unk_21A) {
|
||||
this->actor.textId = 0x6E; // "Great! You are a real gambler!"
|
||||
this->unk_21A = 1;
|
||||
this->dialogState = 6;
|
||||
}
|
||||
|
||||
if (!this->unk_21A && this->unk_214) {
|
||||
if (Flags_GetSwitch(globalCtx, 0x32)) {
|
||||
this->actor.textId = 0x84; // "Thanks a lot!"
|
||||
this->dialogState = 5;
|
||||
} else {
|
||||
this->actor.textId = 0x704C; // "With that key, proceed to the room ahead. Go, go!"
|
||||
this->dialogState = 6;
|
||||
}
|
||||
}
|
||||
|
||||
absYawDiff = ABS(yawDiff);
|
||||
if (absYawDiff < 0x4300) {
|
||||
if (globalCtx->roomCtx.curRoom.num != this->originalRoomNum) {
|
||||
this->actor.flags &= ~1;
|
||||
this->unk_218 = 0;
|
||||
} else {
|
||||
if (!this->unk_218) {
|
||||
this->actor.flags |= 1;
|
||||
this->unk_218 = 1;
|
||||
}
|
||||
func_8002F2CC(&this->actor, globalCtx, 100.0f);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void func_80B17934(EnTakaraMan* this, GlobalContext* globalCtx) {
|
||||
if (this->dialogState == func_8010BDBC(&globalCtx->msgCtx) && func_80106BC8(globalCtx)) {
|
||||
switch (globalCtx->msgCtx.choiceIndex) {
|
||||
case 0: // Yes
|
||||
if (gSaveContext.rupees >= 10) {
|
||||
func_80106CCC(globalCtx);
|
||||
Rupees_ChangeBy(-10);
|
||||
this->unk_214 = 1;
|
||||
this->actor.parent = NULL;
|
||||
func_8002F434(&this->actor, globalCtx, GI_DOOR_KEY, 2000.0f, 1000.0f);
|
||||
this->actionFunc = func_80B17A6C;
|
||||
} else {
|
||||
func_80106CCC(globalCtx);
|
||||
this->actor.textId = 0x85; // "You don't have enough Rupees!"
|
||||
func_8010B720(globalCtx, this->actor.textId);
|
||||
this->dialogState = 5;
|
||||
this->actionFunc = func_80B17B14;
|
||||
}
|
||||
break;
|
||||
case 1: // No
|
||||
func_80106CCC(globalCtx);
|
||||
this->actor.textId = 0x2D; // "All right. You don't have to play if you don't want to."
|
||||
func_8010B720(globalCtx, this->actor.textId);
|
||||
this->dialogState = 5;
|
||||
this->actionFunc = func_80B17B14;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void func_80B17A6C(EnTakaraMan* this, GlobalContext* globalCtx) {
|
||||
if (Actor_HasParent(&this->actor, globalCtx)) {
|
||||
this->actionFunc = func_80B17AC4;
|
||||
} else {
|
||||
func_8002F434(&this->actor, globalCtx, GI_DOOR_KEY, 2000.0f, 1000.0f);
|
||||
}
|
||||
}
|
||||
|
||||
void func_80B17AC4(EnTakaraMan* this, GlobalContext* globalCtx) {
|
||||
if (func_8010BDBC(&globalCtx->msgCtx) == 6 && func_80106BC8(globalCtx)) {
|
||||
this->actionFunc = func_80B176E0;
|
||||
}
|
||||
}
|
||||
|
||||
void func_80B17B14(EnTakaraMan* this, GlobalContext* globalCtx) {
|
||||
if (this->dialogState == func_8010BDBC(&globalCtx->msgCtx) && func_80106BC8(globalCtx)) {
|
||||
func_80106CCC(globalCtx);
|
||||
this->actionFunc = func_80B176E0;
|
||||
}
|
||||
}
|
||||
|
||||
void EnTakaraMan_Update(Actor* thisx, GlobalContext* globalCtx) {
|
||||
EnTakaraMan* this = THIS;
|
||||
|
||||
if (this->eyeTimer != 0) {
|
||||
this->eyeTimer--;
|
||||
}
|
||||
|
||||
Actor_SetHeight(&this->actor, this->height);
|
||||
func_80038290(globalCtx, &this->actor, &this->unk_22C, &this->unk_232, this->actor.posRot2.pos);
|
||||
if (this->eyeTimer == 0) {
|
||||
this->eyeTextureIdx++;
|
||||
if (this->eyeTextureIdx >= 2) {
|
||||
this->eyeTextureIdx = 0;
|
||||
this->eyeTimer = (s16)Math_Rand_ZeroFloat(60.0f) + 20;
|
||||
}
|
||||
}
|
||||
this->unk_212++;
|
||||
this->actionFunc(this, globalCtx);
|
||||
}
|
||||
|
||||
s32 EnTakaraMan_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot,
|
||||
Actor* thisx) {
|
||||
EnTakaraMan* this = THIS;
|
||||
|
||||
if (limbIndex == 1) {
|
||||
rot->x += this->unk_232.y;
|
||||
}
|
||||
if (limbIndex == 8) {
|
||||
rot->x += this->unk_22C.y;
|
||||
rot->z += this->unk_22C.z;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void EnTakaraMan_Draw(Actor* thisx, GlobalContext* globalCtx) {
|
||||
static UNK_PTR sTakaraEyeTextures[] = {
|
||||
0x06000970,
|
||||
0x06000D70,
|
||||
};
|
||||
|
||||
EnTakaraMan* this = THIS;
|
||||
|
||||
OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_takara_man.c", 528);
|
||||
|
||||
func_80093D18(globalCtx->state.gfxCtx);
|
||||
gSPSegment(oGfxCtx->polyOpa.p++, 0x08, SEGMENTED_TO_VIRTUAL(sTakaraEyeTextures[this->eyeTextureIdx]));
|
||||
SkelAnime_DrawSV(globalCtx, this->skelAnime.skeleton, this->skelAnime.limbDrawTbl, this->skelAnime.dListCount,
|
||||
EnTakaraMan_OverrideLimbDraw, NULL, &this->actor);
|
||||
|
||||
CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_takara_man.c", 544);
|
||||
}
|
||||
|
|
|
@ -6,9 +6,26 @@
|
|||
|
||||
struct EnTakaraMan;
|
||||
|
||||
typedef void (*EnTakaraManActionFunc)(struct EnTakaraMan*, GlobalContext*);
|
||||
|
||||
typedef struct EnTakaraMan {
|
||||
/* 0x0000 */ Actor actor;
|
||||
/* 0x014C */ char unk_14C[0xEC];
|
||||
/* 0x014C */ EnTakaraManActionFunc actionFunc;
|
||||
/* 0x0150 */ SkelAnime skelAnime;
|
||||
/* 0x0194 */ Vec3s limbDrawTbl[10];
|
||||
/* 0x01D0 */ Vec3s transitionDrawTbl[10];
|
||||
/* 0x020C */ s16 dialogState;
|
||||
/* 0x020E */ s16 eyeTextureIdx;
|
||||
/* 0x0210 */ s16 eyeTimer;
|
||||
/* 0x0212 */ s16 unk_212;
|
||||
/* 0x0214 */ s16 unk_214;
|
||||
/* 0x0216 */ s16 originalRoomNum;
|
||||
/* 0x0218 */ s16 unk_218;
|
||||
/* 0x021A */ s16 unk_21A;
|
||||
/* 0x022C */ f32 height;
|
||||
/* 0x0220 */ Vec3f pos;
|
||||
/* 0x022C */ Vec3s unk_22C;
|
||||
/* 0x0232 */ Vec3s unk_232;
|
||||
} EnTakaraMan; // size = 0x0238
|
||||
|
||||
extern const ActorInit En_Takara_Man_InitVars;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue