* En_Kbt

* PR

* a
This commit is contained in:
Maide 2022-03-27 15:27:09 +01:00 committed by GitHub
parent 35bc48de54
commit 38eef9252e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 549 additions and 29 deletions

View File

@ -42,7 +42,13 @@
<Texture Name="object_kbt_Tex_00A2F8" OutName="tex_00A2F8" Format="ci8" Width="8" Height="8" Offset="0xA2F8" />
<Texture Name="object_kbt_Tex_00A338" OutName="tex_00A338" Format="rgba16" Width="8" Height="8" Offset="0xA338" />
<Texture Name="object_kbt_Tex_00A3B8" OutName="tex_00A3B8" Format="ci8" Width="16" Height="32" Offset="0xA3B8" />
<!-- <Blob Name="object_kbt_Blob_00A5B8" Size="0x3800" Offset="0xA5B8" /> -->
<Texture Name="object_kbt_Tex_00A5B8" OutName="tex_00A5B8" Format="rgba16" Width="32" Height="32" Offset="0xA5B8" />
<Texture Name="object_kbt_Tex_00ADB8" OutName="tex_00ADB8" Format="rgba16" Width="32" Height="32" Offset="0xADB8" />
<Texture Name="object_kbt_Tex_00B5B8" OutName="tex_00B5B8" Format="rgba16" Width="32" Height="32" Offset="0xB5B8" />
<Texture Name="object_kbt_Tex_00BDB8" OutName="tex_00BDB8" Format="rgba16" Width="32" Height="32" Offset="0xBDB8" />
<Texture Name="object_kbt_Tex_00C5B8" OutName="tex_00C5B8" Format="rgba16" Width="32" Height="32" Offset="0xC5B8" />
<Texture Name="object_kbt_Tex_00CDB8" OutName="tex_00CDB8" Format="rgba16" Width="32" Height="32" Offset="0xCDB8" />
<Texture Name="object_kbt_Tex_00D5B8" OutName="tex_00D5B8" Format="rgba16" Width="32" Height="32" Offset="0xD5B8" />
<Limb Name="object_kbt_Standardlimb_00DDB8" Type="Standard" EnumName="OBJECT_KBT_LIMB_01" Offset="0xDDB8" />
<Limb Name="object_kbt_Standardlimb_00DDC4" Type="Standard" EnumName="OBJECT_KBT_LIMB_02" Offset="0xDDC4" />
<Limb Name="object_kbt_Standardlimb_00DDD0" Type="Standard" EnumName="OBJECT_KBT_LIMB_03" Offset="0xDDD0" />

3
spec
View File

@ -3978,8 +3978,7 @@ beginseg
name "ovl_En_Kbt"
compress
include "build/src/overlays/actors/ovl_En_Kbt/z_en_kbt.o"
include "build/data/ovl_En_Kbt/ovl_En_Kbt.data.o"
include "build/data/ovl_En_Kbt/ovl_En_Kbt.reloc.o"
include "build/src/overlays/actors/ovl_En_Kbt/ovl_En_Kbt_reloc.o"
endseg
beginseg

View File

@ -15,10 +15,13 @@ void EnKbt_Destroy(Actor* thisx, GlobalContext* globalCtx);
void EnKbt_Update(Actor* thisx, GlobalContext* globalCtx);
void EnKbt_Draw(Actor* thisx, GlobalContext* globalCtx);
s32 func_80B33E64(GlobalContext* globalCtx);
s32 func_80B33E8C(GlobalContext* globalCtx);
void func_80B33EF0(EnKbt* this, s16 arg1);
Actor* func_80B3403C(GlobalContext* globalCtx);
void func_80B34314(EnKbt* this, GlobalContext* globalCtx);
void func_80B34598(EnKbt* this, GlobalContext* globalCtx);
#if 0
const ActorInit En_Kbt_InitVars = {
ACTOR_EN_KBT,
ACTORCAT_NPC,
@ -31,36 +34,543 @@ const ActorInit En_Kbt_InitVars = {
(ActorFunc)EnKbt_Draw,
};
#endif
void EnKbt_Init(Actor* thisx, GlobalContext* globalCtx) {
EnKbt* this = THIS;
extern UNK_TYPE D_06004274;
Actor_SetScale(&this->actor, 0.01f);
SkelAnime_InitFlex(globalCtx, &this->skelAnime, &object_kbt_Skel_00DEE8, &object_kbt_Anim_004274, this->jointTable,
this->morphTable, OBJECT_KBT_LIMB_MAX);
this->unk_27C = 0;
this->actor.home.rot.z = 0;
this->unk_27E = 4;
this->unk_27F = 0;
this->unk_280 = 13;
this->unk_282 = 13;
this->unk_278 = func_80B3403C(globalCtx);
this->unk_284 = 0;
this->actor.textId = 0;
if (func_80B33E64(globalCtx)) {
func_80B33EF0(this, 6);
this->unk_282 = 11;
if (func_80B33E8C(globalCtx)) {
this->actor.textId = 0xC50;
} else {
this->actor.textId = 0xC4E;
this->unk_27C |= 1;
}
this->actionFunc = func_80B34314;
} else {
func_80B33EF0(this, 0);
this->unk_282 = 0;
this->actionFunc = func_80B34598;
}
this->actor.flags &= ~ACTOR_FLAG_1;
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Kbt/EnKbt_Init.s")
void EnKbt_Destroy(Actor* thisx, GlobalContext* globalCtx) {
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Kbt/EnKbt_Destroy.s")
s32 func_80B33E64(GlobalContext* globalCtx) {
return gSaveContext.permanentSceneFlags[globalCtx->sceneNum].unk_14 & 1;
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Kbt/func_80B33E64.s")
s32 func_80B33E8C(GlobalContext* globalCtx) {
if ((CURRENT_DAY == 3) ||
((CURRENT_DAY == 2) && (gSaveContext.permanentSceneFlags[globalCtx->sceneNum].unk_14 & 2))) {
return true;
}
return false;
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Kbt/func_80B33E8C.s")
void func_80B33EF0(EnKbt* this, s16 arg1) {
static AnimationHeader* sAnimations[] = {
&object_kbt_Anim_000670, &object_kbt_Anim_001674, &object_kbt_Anim_002084, &object_kbt_Anim_000FE8,
&object_kbt_Anim_001940, &object_kbt_Anim_00E7BC, &object_kbt_Anim_00F0C8, &object_kbt_Anim_002710,
&object_kbt_Anim_002DE0, &object_kbt_Anim_003414, &object_kbt_Anim_003D24, &object_kbt_Anim_001BF4,
&object_kbt_Anim_002084,
};
u8 sp38[] = {
ANIMMODE_LOOP, ANIMMODE_LOOP, ANIMMODE_ONCE, ANIMMODE_LOOP, ANIMMODE_ONCE, ANIMMODE_LOOP, ANIMMODE_LOOP,
ANIMMODE_LOOP, ANIMMODE_LOOP, ANIMMODE_LOOP, ANIMMODE_LOOP, ANIMMODE_ONCE, ANIMMODE_ONCE,
};
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Kbt/func_80B33EF0.s")
if (arg1 != this->unk_280) {
if (arg1 >= 12) {
Animation_Change(&this->skelAnime, sAnimations[arg1], -1.0f,
Animation_GetLastFrame(sAnimations[arg1]) - 1.0f, 0.0f, sp38[arg1], -5.0f);
} else {
Animation_Change(&this->skelAnime, sAnimations[arg1], 1.0f, 0.0f, Animation_GetLastFrame(sAnimations[arg1]),
sp38[arg1], -5.0f);
}
this->unk_280 = arg1;
}
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Kbt/func_80B3403C.s")
Actor* func_80B3403C(GlobalContext* globalCtx) {
Actor* npc = globalCtx->actorCtx.actorLists[ACTORCAT_NPC].first;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Kbt/func_80B34078.s")
while (npc != NULL) {
if (npc->id == ACTOR_EN_KGY) {
return npc;
}
npc = npc->next;
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Kbt/func_80B3415C.s")
return NULL;
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Kbt/func_80B34314.s")
void func_80B34078(EnKbt* this) {
if (SkelAnime_Update(&this->skelAnime)) {
if (this->unk_284 > 0) {
this->unk_284--;
} else {
switch (this->unk_280) {
case 2:
switch (this->unk_282) {
case 0:
func_80B33EF0(this, 12);
break;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Kbt/func_80B34574.s")
case 5:
this->actor.home.rot.z = 0;
break;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Kbt/func_80B34598.s")
default:
func_80B33EF0(this, 5);
break;
}
break;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Kbt/EnKbt_Update.s")
case 12:
func_80B33EF0(this, 0);
this->actor.home.rot.z = 0;
break;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Kbt/func_80B349C8.s")
case 4:
func_80B33EF0(this, 1);
this->unk_27E = 2;
this->actor.home.rot.z = 0;
break;
}
}
}
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Kbt/func_80B34A00.s")
void func_80B3415C(EnKbt* this) {
if (this->unk_27C & 2) {
if (this->unk_284 > 0) {
this->unk_284--;
} else {
this->unk_27F = 0;
this->unk_282 = 3;
this->unk_27C &= ~2;
}
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Kbt/EnKbt_Draw.s")
switch (this->unk_282) {
case 0:
if ((this->unk_280 != 2) && (this->unk_280 != 12)) {
func_80B33EF0(this, 0);
}
break;
case 1:
func_80B33EF0(this, 2);
this->unk_282 = 0;
break;
case 2:
if (this->unk_280 != 12) {
func_80B33EF0(this, 3);
}
break;
case 3:
if (this->unk_280 != 1) {
func_80B33EF0(this, 4);
}
break;
case 10:
func_80B33EF0(this, 11);
break;
case 4:
func_80B33EF0(this, 2);
this->unk_282 = 6;
break;
case 6:
if (this->unk_280 != 2) {
func_80B33EF0(this, 5);
}
break;
case 11:
func_80B33EF0(this, 6);
break;
case 7:
if (this->unk_280 != 2) {
func_80B33EF0(this, 7);
}
break;
case 8:
if (this->unk_280 != 2) {
func_80B33EF0(this, 8);
}
break;
case 9:
if (this->unk_280 != 2) {
func_80B33EF0(this, 9);
}
break;
case 12:
func_80B33EF0(this, 10);
break;
}
}
void func_80B34314(EnKbt* this, GlobalContext* globalCtx) {
s32 playerForm;
func_80B34078(this);
if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) {
this->actionFunc = func_80B34598;
Actor_ChangeFocus(&this->actor, globalCtx, this->unk_278);
this->unk_278->textId = this->actor.textId;
this->unk_27C &= ~4;
if (this->actor.textId == 0xC4E) {
this->unk_27C |= 0x10;
}
} else if (this->actor.xzDistToPlayer < 250.0f) {
if ((this->unk_278 != NULL) && (this->unk_278->xzDistToPlayer < 250.0f)) {
if (this->unk_27C & 4) {
playerForm = gSaveContext.playerForm;
if (((playerForm ^ 0) != PLAYER_FORM_HUMAN) || ((CUR_FORM_EQUIP(EQUIP_SLOT_B) != ITEM_SWORD_KOKIRI) &&
(CUR_FORM_EQUIP(EQUIP_SLOT_B) != ITEM_SWORD_RAZOR) &&
(CUR_FORM_EQUIP(EQUIP_SLOT_B) != ITEM_SWORD_GILDED))) {
this->actor.textId = 0xC38;
} else if (CURRENT_DAY == 3) {
this->actor.textId = 0xC39;
} else if (this->unk_27C & 8) {
this->actor.textId = 0xC3E;
} else {
this->actor.textId = 0xC3A;
}
}
if (this->actor.textId != 0xC37) {
if (((this->actor.textId == 0xC4E) || (this->actor.textId == 0xC4F) || (this->actor.textId == 0xC50)) &&
(gSaveContext.playerForm != PLAYER_FORM_HUMAN)) {
this->actor.textId = 0xC37;
}
} else if (gSaveContext.playerForm == PLAYER_FORM_HUMAN) {
if (func_80B33E8C(globalCtx)) {
this->actor.textId = 0xC50;
} else {
this->actor.textId = 0xC4E;
}
}
func_800B8614(&this->actor, globalCtx, 260.0f);
}
}
func_80B3415C(this);
}
void func_80B34574(EnKbt* this) {
this->unk_27E = 0;
this->unk_27F = 0;
this->unk_282 = 6;
this->actionFunc = func_80B34314;
}
void func_80B34598(EnKbt* this, GlobalContext* globalCtx) {
func_80B34078(this);
switch (this->actor.textId) {
case 0x1:
this->unk_27E = 4;
this->unk_27F = 0;
this->unk_282 = 0;
break;
case 0x2:
func_80B34574(this);
this->actor.textId = 0xC3E;
this->unk_27C |= 0x4;
this->unk_27C |= 0x8;
return;
case 0x3:
func_80B34574(this);
this->actor.textId = 0xC58;
return;
case 0x4:
func_80B34574(this);
this->actor.textId = 0xC4B;
return;
case 0x5:
this->unk_27E = 4;
this->unk_27F = 0;
this->unk_282 = 0;
func_80B33EF0(this, 12);
break;
case 0x6:
func_80B34574(this);
this->actor.textId = 0xC3A;
this->unk_27C |= 4;
return;
case 0x7:
this->unk_27E = 4;
this->unk_27F = 0;
this->unk_282 = 11;
if (func_80B33E8C(globalCtx)) {
this->actor.textId = 0xC50;
} else if (this->unk_27C & 0x10) {
this->actor.textId = 0xC4F;
} else {
this->actor.textId = 0xC4E;
}
this->actionFunc = func_80B34314;
return;
case 0x8:
func_80B34574(this);
this->actor.textId = 0xC56;
return;
case 0xC1E:
this->unk_27E = 2;
this->unk_27F = 1;
break;
case 0xC1F:
case 0xC2E:
this->unk_27E = 2;
this->unk_27F = 1;
this->unk_282 = 1;
this->unk_284 = 20;
break;
case 0xC20:
case 0xC23:
case 0xC2F:
this->unk_27E = 0;
this->unk_282 = 2;
break;
case 0xC21:
case 0xC29:
this->unk_284 = 10;
this->unk_27C |= 2;
break;
case 0xC22:
case 0xC2A:
this->unk_27F = 1;
break;
case 0xC2C:
this->unk_27E = 0;
this->unk_27F = 0;
this->unk_282 = 2;
break;
case 0xC31:
this->unk_27E = 2;
this->unk_27F = 1;
this->unk_282 = 4;
break;
case 0xC32:
this->unk_27E = 1;
this->unk_282 = 7;
break;
case 0xC34:
this->unk_27E = 0;
this->unk_282 = 8;
break;
case 0xC35:
this->unk_27E = 4;
this->unk_27F = 0;
func_80B33EF0(this, 2);
this->unk_282 = 5;
break;
case 0xC36:
this->unk_27E = 1;
this->unk_27F = 1;
func_80B33EF0(this, 7);
this->unk_282 = 7;
break;
case 0xC37:
func_80B33EF0(this, 10);
this->unk_27E = 0;
this->unk_27F = 1;
break;
case 0xC38:
case 0xC39:
func_80B33EF0(this, 7);
this->unk_27E = 0;
this->unk_27F = 1;
break;
case 0xC3A:
case 0xC4D:
case 0xC58:
this->unk_27E = 0;
this->unk_27F = 1;
this->unk_282 = 8;
break;
case 0xC3C:
case 0xC57:
this->unk_27E = 1;
this->unk_282 = 7;
break;
case 0xC3D:
this->unk_27E = 0;
break;
case 0xC3E:
this->unk_27F = 1;
this->unk_282 = 8;
break;
case 0xC3F:
case 0xC47:
case 0xC4C:
this->unk_27E = 1;
this->unk_27F = 1;
this->unk_282 = 7;
break;
case 0xC40:
this->unk_27E = 3;
this->unk_282 = 6;
break;
case 0xC45:
case 0xC4B:
case 0xC56:
this->unk_27E = 0;
this->unk_27F = 1;
this->unk_282 = 7;
break;
case 0xC46:
this->unk_27E = 1;
this->unk_27F = 1;
this->unk_282 = 9;
break;
case 0xC48:
this->unk_27E = 2;
this->unk_27F = 0;
this->unk_282 = 10;
break;
case 0xC49:
this->unk_27F = 1;
break;
case 0xC4A:
this->unk_27E = 0;
this->unk_282 = 7;
break;
case 0xC4E:
this->unk_27E = 1;
this->unk_27F = 1;
this->unk_282 = 12;
break;
case 0xC4F:
this->unk_27E = 2;
this->unk_27F = 1;
this->unk_282 = 12;
break;
case 0xC50:
this->unk_27E = 0;
this->unk_27F = 1;
this->unk_282 = 12;
break;
}
this->actor.textId = 0;
func_80B3415C(this);
}
void EnKbt_Update(Actor* thisx, GlobalContext* globalCtx) {
EnKbt* this = THIS;
this->actionFunc(this, globalCtx);
}
s32 EnKbt_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) {
EnKbt* this = THIS;
if (!(this->unk_27C & 1) && (limbIndex == OBJECT_KBT_LIMB_0E)) {
*dList = NULL;
}
return false;
}
Vec3f D_80B34B84 = { 500.0f, 500.0f, 0.0f };
void EnKbt_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) {
EnKbt* this = THIS;
if (limbIndex == OBJECT_KBT_LIMB_09) {
Matrix_MultiplyVector3fByState(&D_80B34B84, &this->actor.focus.pos);
}
}
TexturePtr D_80B34B90[] = {
object_kbt_Tex_00A5B8,
object_kbt_Tex_00ADB8,
};
TexturePtr D_80B34B98[] = {
object_kbt_Tex_00B5B8, object_kbt_Tex_00BDB8, object_kbt_Tex_00C5B8, object_kbt_Tex_00CDB8, object_kbt_Tex_00D5B8,
};
void EnKbt_Draw(Actor* thisx, GlobalContext* globalCtx) {
EnKbt* this = THIS;
Gfx* gfx;
TexturePtr tex;
OPEN_DISPS(globalCtx->state.gfxCtx);
func_8012C28C(globalCtx->state.gfxCtx);
gfx = POLY_OPA_DISP;
tex = Lib_SegmentedToVirtual(D_80B34B98[this->unk_27E]);
gSPSegment(&gfx[0], 0x08, tex);
tex = Lib_SegmentedToVirtual(D_80B34B90[this->unk_27F]);
gSPSegment(&gfx[1], 0x09, tex);
POLY_OPA_DISP = &gfx[2];
CLOSE_DISPS(globalCtx->state.gfxCtx);
SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount,
EnKbt_OverrideLimbDraw, EnKbt_PostLimbDraw, &this->actor);
}

View File

@ -2,6 +2,7 @@
#define Z_EN_KBT_H
#include "global.h"
#include "objects/object_kbt/object_kbt.h"
struct EnKbt;
@ -9,7 +10,16 @@ typedef void (*EnKbtActionFunc)(struct EnKbt*, GlobalContext*);
typedef struct EnKbt {
/* 0x0000 */ Actor actor;
/* 0x0144 */ char unk_144[0x144];
/* 0x0144 */ SkelAnime skelAnime;
/* 0x0188 */ Vec3s jointTable[OBJECT_KBT_LIMB_MAX];
/* 0x0200 */ Vec3s morphTable[OBJECT_KBT_LIMB_MAX];
/* 0x0278 */ Actor* unk_278;
/* 0x027C */ u16 unk_27C;
/* 0x027E */ u8 unk_27E;
/* 0x027F */ u8 unk_27F;
/* 0x0280 */ s16 unk_280;
/* 0x0282 */ s16 unk_282;
/* 0x0284 */ s16 unk_284;
/* 0x0288 */ EnKbtActionFunc actionFunc;
} EnKbt; // size = 0x28C

View File

@ -13501,8 +13501,8 @@
0x80B34574:("func_80B34574",),
0x80B34598:("func_80B34598",),
0x80B349A4:("EnKbt_Update",),
0x80B349C8:("func_80B349C8",),
0x80B34A00:("func_80B34A00",),
0x80B349C8:("EnKbt_OverrideLimbDraw",),
0x80B34A00:("EnKbt_PostLimbDraw",),
0x80B34A40:("EnKbt_Draw",),
0x80B34F70:("func_80B34F70",),
0x80B34FB4:("func_80B34FB4",),

View File

@ -1370,11 +1370,6 @@ D_0600D828 = 0x0600D828;
D_06000C30 = 0x06000C30;
D_06001630 = 0x06001630;
// ovl_En_Kbt
D_06004274 = 0x06004274;
D_0600DEE8 = 0x0600DEE8;
// ovl_En_Kitan
D_06000CE8 = 0x06000CE8;