mirror of https://github.com/zeldaret/mm.git
Obj_Dora (#779)
* Initial implementation of Obj_Dora * Final function and documentation for Obj Dora * Implemented review feedback * Moved enums inside dora c file, renamed temp to timeHalfHour * Cleaning, renaming, moving and converted float to easily searchable value
This commit is contained in:
parent
776edea91a
commit
c7753f43b0
|
@ -1,17 +1,18 @@
|
|||
<Root>
|
||||
<!-- Object for the Gong and KendoKanban board in the Swordsman's School -->
|
||||
<File Name="object_dora" Segment="6">
|
||||
<DList Name="object_dora_DL_000180" Offset="0x180" />
|
||||
<Texture Name="object_dora_Tex_000280" OutName="tex_000280" Format="rgba16" Width="32" Height="64" Offset="0x280" />
|
||||
<Texture Name="object_dora_Tex_001280" OutName="tex_001280" Format="rgba16" Width="32" Height="32" Offset="0x1280" />
|
||||
<DList Name="object_dora_DL_002080" Offset="0x2080" />
|
||||
<DList Name="object_dora_DL_002180" Offset="0x2180" />
|
||||
<DList Name="object_dora_DL_002280" Offset="0x2280" />
|
||||
<DList Name="object_dora_DL_002380" Offset="0x2380" />
|
||||
<Texture Name="object_dora_Tex_002480" OutName="tex_002480" Format="rgba16" Width="32" Height="64" Offset="0x2480" />
|
||||
<Texture Name="object_dora_Tex_003480" OutName="tex_003480" Format="rgba16" Width="32" Height="32" Offset="0x3480" />
|
||||
<DList Name="object_dora_DL_003FD0" Offset="0x3FD0" />
|
||||
<DList Name="object_dora_DL_004160" Offset="0x4160" />
|
||||
<Texture Name="object_dora_Tex_004208" OutName="tex_004208" Format="rgba16" Width="32" Height="32" Offset="0x4208" />
|
||||
<Texture Name="object_dora_Tex_004A08" OutName="tex_004A08" Format="rgba16" Width="16" Height="64" Offset="0x4A08" />
|
||||
<DList Name="gKendoKanbanDL" Offset="0x180" />
|
||||
<Texture Name="gKendoKanbanFrontTex" OutName="kendo_kanban_front" Format="rgba16" Width="32" Height="64" Offset="0x280" />
|
||||
<Texture Name="gKendoKanbanSideTex" OutName="kendo_kanban_side" Format="rgba16" Width="32" Height="32" Offset="0x1280" />
|
||||
<DList Name="gKendoKanbanTopRightDL" Offset="0x2080" />
|
||||
<DList Name="gKendoKanbanTopLeftDL" Offset="0x2180" />
|
||||
<DList Name="gKendoKanbanBottomLeftDL" Offset="0x2280" />
|
||||
<DList Name="gKendoKanbanBottomRightDL" Offset="0x2380" />
|
||||
<Texture Name="gKendoKanbanSplitFrontTex" OutName="kendo_kanban_front_split_alt" Format="rgba16" Width="32" Height="64" Offset="0x2480" />
|
||||
<Texture Name="gKendoKanbanSplitSideTex" OutName="kendo_kanban_side_split_alt" Format="rgba16" Width="32" Height="32" Offset="0x3480" />
|
||||
<DList Name="gDoraChainDL" Offset="0x3FD0" />
|
||||
<DList Name="gDoraGongDL" Offset="0x4160" />
|
||||
<Texture Name="gDoraGongTex" OutName="dora_gong" Format="rgba16" Width="32" Height="32" Offset="0x4208" />
|
||||
<Texture Name="gDoraChainTex" OutName="dora_chain" Format="rgba16" Width="16" Height="64" Offset="0x4A08" />
|
||||
</File>
|
||||
</Root>
|
||||
|
|
3
spec
3
spec
|
@ -4059,8 +4059,7 @@ beginseg
|
|||
name "ovl_Obj_Dora"
|
||||
compress
|
||||
include "build/src/overlays/actors/ovl_Obj_Dora/z_obj_dora.o"
|
||||
include "build/data/ovl_Obj_Dora/ovl_Obj_Dora.data.o"
|
||||
include "build/data/ovl_Obj_Dora/ovl_Obj_Dora.reloc.o"
|
||||
include "build/src/overlays/actors/ovl_Obj_Dora/ovl_Obj_Dora_reloc.o"
|
||||
endseg
|
||||
|
||||
beginseg
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
*/
|
||||
|
||||
#include "z_obj_dora.h"
|
||||
#include "assets/objects/object_dora/object_dora.h"
|
||||
|
||||
#define FLAGS (ACTOR_FLAG_10)
|
||||
|
||||
|
@ -15,7 +16,25 @@ void ObjDora_Destroy(Actor* thisx, GlobalContext* globalCtx);
|
|||
void ObjDora_Update(Actor* thisx, GlobalContext* globalCtx);
|
||||
void ObjDora_Draw(Actor* thisx, GlobalContext* globalCtx);
|
||||
|
||||
#if 0
|
||||
void ObjDora_SetupWait(ObjDora* this);
|
||||
void ObjDora_Wait(ObjDora* this, GlobalContext* globalCtx);
|
||||
void ObjDora_SetupMoveGong(ObjDora* this);
|
||||
void ObjDora_MoveGong(ObjDora* this, GlobalContext* globalCtx);
|
||||
s32 ObjDora_IsHalfHour(u16 time);
|
||||
void ObjDora_UpdateCollision(ObjDora* this, GlobalContext* globalCtx);
|
||||
|
||||
typedef enum {
|
||||
/* 0x0 */ DORA_HIT_NONE,
|
||||
/* 0x1 */ DORA_HIT_LIGHT,
|
||||
/* 0x2 */ DORA_HIT_STRONG
|
||||
} ObjDoraHitStrength;
|
||||
|
||||
typedef enum {
|
||||
/* 0x0 */ DORA_DMGEFF_NONE,
|
||||
/* 0xE */ DORA_DMGEFF_STRONG = 0xE,
|
||||
/* 0xF */ DORA_DMGEFF_LIGHT
|
||||
} ObjDoraDamageEffect;
|
||||
|
||||
const ActorInit Obj_Dora_InitVars = {
|
||||
ACTOR_OBJ_DORA,
|
||||
ACTORCAT_NPC,
|
||||
|
@ -28,104 +47,306 @@ const ActorInit Obj_Dora_InitVars = {
|
|||
(ActorFunc)ObjDora_Draw,
|
||||
};
|
||||
|
||||
// static ColliderTrisElementInit sTrisElementsInit[6] = {
|
||||
static ColliderTrisElementInit D_80B61310[6] = {
|
||||
static ColliderTrisElementInit sTrisElementsInit[6] = {
|
||||
{
|
||||
{ ELEMTYPE_UNK5, { 0x00000000, 0x00, 0x00 }, { 0x00100000, 0x00, 0x00 }, TOUCH_NONE | TOUCH_SFX_NORMAL, BUMP_ON, OCELEM_NONE, },
|
||||
{
|
||||
ELEMTYPE_UNK5,
|
||||
{ 0x00000000, 0x00, 0x00 },
|
||||
{ 0x00100000, 0x00, 0x00 },
|
||||
TOUCH_NONE | TOUCH_SFX_NORMAL,
|
||||
BUMP_ON,
|
||||
OCELEM_NONE,
|
||||
},
|
||||
{ { { 0.0f, -35.0f, 0.0f }, { 260.0f, -185.0f, 0.0f }, { 0.0f, -335.0f, 0.0f } } },
|
||||
},
|
||||
{
|
||||
{ ELEMTYPE_UNK5, { 0x00000000, 0x00, 0x00 }, { 0x00100000, 0x00, 0x00 }, TOUCH_NONE | TOUCH_SFX_NORMAL, BUMP_ON, OCELEM_NONE, },
|
||||
{
|
||||
ELEMTYPE_UNK5,
|
||||
{ 0x00000000, 0x00, 0x00 },
|
||||
{ 0x00100000, 0x00, 0x00 },
|
||||
TOUCH_NONE | TOUCH_SFX_NORMAL,
|
||||
BUMP_ON,
|
||||
OCELEM_NONE,
|
||||
},
|
||||
{ { { 260.0f, -185.0f, 0.0f }, { 260.0f, -485.0f, 0.0f }, { 0.0f, -335.0f, 0.0f } } },
|
||||
},
|
||||
{
|
||||
{ ELEMTYPE_UNK5, { 0x00000000, 0x00, 0x00 }, { 0xF7CFFFFF, 0x00, 0x00 }, TOUCH_NONE | TOUCH_SFX_NORMAL, BUMP_ON, OCELEM_NONE, },
|
||||
{
|
||||
ELEMTYPE_UNK5,
|
||||
{ 0x00000000, 0x00, 0x00 },
|
||||
{ 0xF7CFFFFF, 0x00, 0x00 },
|
||||
TOUCH_NONE | TOUCH_SFX_NORMAL,
|
||||
BUMP_ON,
|
||||
OCELEM_NONE,
|
||||
},
|
||||
{ { { 260.0f, -485.0f, 0.0f }, { 0.0f, -635.0f, 0.0f }, { 0.0f, -335.0f, 0.0f } } },
|
||||
},
|
||||
{
|
||||
{ ELEMTYPE_UNK5, { 0x00000000, 0x00, 0x00 }, { 0xF7CFFFFF, 0x00, 0x00 }, TOUCH_NONE | TOUCH_SFX_NORMAL, BUMP_ON, OCELEM_NONE, },
|
||||
{
|
||||
ELEMTYPE_UNK5,
|
||||
{ 0x00000000, 0x00, 0x00 },
|
||||
{ 0xF7CFFFFF, 0x00, 0x00 },
|
||||
TOUCH_NONE | TOUCH_SFX_NORMAL,
|
||||
BUMP_ON,
|
||||
OCELEM_NONE,
|
||||
},
|
||||
{ { { 0.0f, -635.0f, 0.0f }, { -260.0f, -485.0f, 0.0f }, { 0.0f, -335.0f, 0.0f } } },
|
||||
},
|
||||
{
|
||||
{ ELEMTYPE_UNK5, { 0x00000000, 0x00, 0x00 }, { 0xF7CFFFFF, 0x00, 0x00 }, TOUCH_NONE | TOUCH_SFX_NORMAL, BUMP_ON, OCELEM_NONE, },
|
||||
{
|
||||
ELEMTYPE_UNK5,
|
||||
{ 0x00000000, 0x00, 0x00 },
|
||||
{ 0xF7CFFFFF, 0x00, 0x00 },
|
||||
TOUCH_NONE | TOUCH_SFX_NORMAL,
|
||||
BUMP_ON,
|
||||
OCELEM_NONE,
|
||||
},
|
||||
{ { { -260.0f, -485.0f, 0.0f }, { -260.0f, -185.0f, 0.0f }, { 0.0f, -335.0f, 0.0f } } },
|
||||
},
|
||||
{
|
||||
{ ELEMTYPE_UNK5, { 0x00000000, 0x00, 0x00 }, { 0xF7CFFFFF, 0x00, 0x00 }, TOUCH_NONE | TOUCH_SFX_NORMAL, BUMP_ON, OCELEM_NONE, },
|
||||
{
|
||||
ELEMTYPE_UNK5,
|
||||
{ 0x00000000, 0x00, 0x00 },
|
||||
{ 0xF7CFFFFF, 0x00, 0x00 },
|
||||
TOUCH_NONE | TOUCH_SFX_NORMAL,
|
||||
BUMP_ON,
|
||||
OCELEM_NONE,
|
||||
},
|
||||
{ { { -260.0f, -185.0f, 0.0f }, { 0.0f, -35.0f, 0.0f }, { 0.0f, -335.0f, 0.0f } } },
|
||||
},
|
||||
};
|
||||
|
||||
// static ColliderTrisInit sTrisInit = {
|
||||
static ColliderTrisInit D_80B61478 = {
|
||||
{ COLTYPE_NONE, AT_NONE, AC_ON | AC_HARD | AC_TYPE_PLAYER, OC1_ON | OC1_TYPE_ALL, OC2_TYPE_1, COLSHAPE_TRIS, },
|
||||
6, D_80B61310, // sTrisElementsInit,
|
||||
static ColliderTrisInit sTrisInit = {
|
||||
{
|
||||
COLTYPE_NONE,
|
||||
AT_NONE,
|
||||
AC_ON | AC_HARD | AC_TYPE_PLAYER,
|
||||
OC1_ON | OC1_TYPE_ALL,
|
||||
OC2_TYPE_1,
|
||||
COLSHAPE_TRIS,
|
||||
},
|
||||
6,
|
||||
sTrisElementsInit,
|
||||
};
|
||||
|
||||
// static DamageTable sDamageTable = {
|
||||
static DamageTable D_80B61488 = {
|
||||
/* Deku Nut */ DMG_ENTRY(0, 0x0),
|
||||
/* Deku Stick */ DMG_ENTRY(2, 0xF),
|
||||
/* Horse trample */ DMG_ENTRY(0, 0x0),
|
||||
/* Explosives */ DMG_ENTRY(0, 0x0),
|
||||
/* Zora boomerang */ DMG_ENTRY(0, 0xF),
|
||||
/* Normal arrow */ DMG_ENTRY(0, 0xF),
|
||||
/* UNK_DMG_0x06 */ DMG_ENTRY(2, 0xF),
|
||||
/* Hookshot */ DMG_ENTRY(0, 0xF),
|
||||
/* Goron punch */ DMG_ENTRY(2, 0xE),
|
||||
/* Sword */ DMG_ENTRY(1, 0xF),
|
||||
/* Goron pound */ DMG_ENTRY(1, 0xF),
|
||||
/* Fire arrow */ DMG_ENTRY(0, 0xF),
|
||||
/* Ice arrow */ DMG_ENTRY(0, 0xF),
|
||||
/* Light arrow */ DMG_ENTRY(0, 0xF),
|
||||
/* Goron spikes */ DMG_ENTRY(1, 0xF),
|
||||
/* Deku spin */ DMG_ENTRY(0, 0xF),
|
||||
/* Deku bubble */ DMG_ENTRY(0, 0x0),
|
||||
/* Deku launch */ DMG_ENTRY(0, 0x0),
|
||||
/* UNK_DMG_0x12 */ DMG_ENTRY(0, 0x0),
|
||||
/* Zora barrier */ DMG_ENTRY(0, 0x0),
|
||||
/* Normal shield */ DMG_ENTRY(0, 0x0),
|
||||
/* Light ray */ DMG_ENTRY(0, 0x0),
|
||||
/* Thrown object */ DMG_ENTRY(1, 0xF),
|
||||
/* Zora punch */ DMG_ENTRY(0, 0xF),
|
||||
/* Spin attack */ DMG_ENTRY(1, 0x0),
|
||||
/* Sword beam */ DMG_ENTRY(0, 0x0),
|
||||
/* Normal Roll */ DMG_ENTRY(0, 0x0),
|
||||
/* UNK_DMG_0x1B */ DMG_ENTRY(0, 0x0),
|
||||
/* UNK_DMG_0x1C */ DMG_ENTRY(0, 0x0),
|
||||
/* Unblockable */ DMG_ENTRY(0, 0x0),
|
||||
/* UNK_DMG_0x1E */ DMG_ENTRY(0, 0x0),
|
||||
/* Powder Keg */ DMG_ENTRY(0, 0x0),
|
||||
static DamageTable sDamageTable = {
|
||||
/* Deku Nut */ DMG_ENTRY(0, DORA_DMGEFF_NONE),
|
||||
/* Deku Stick */ DMG_ENTRY(2, DORA_DMGEFF_LIGHT),
|
||||
/* Horse trample */ DMG_ENTRY(0, DORA_DMGEFF_NONE),
|
||||
/* Explosives */ DMG_ENTRY(0, DORA_DMGEFF_NONE),
|
||||
/* Zora boomerang */ DMG_ENTRY(0, DORA_DMGEFF_LIGHT),
|
||||
/* Normal arrow */ DMG_ENTRY(0, DORA_DMGEFF_LIGHT),
|
||||
/* UNK_DMG_0x06 */ DMG_ENTRY(2, DORA_DMGEFF_LIGHT),
|
||||
/* Hookshot */ DMG_ENTRY(0, DORA_DMGEFF_LIGHT),
|
||||
/* Goron punch */ DMG_ENTRY(2, DORA_DMGEFF_STRONG),
|
||||
/* Sword */ DMG_ENTRY(1, DORA_DMGEFF_LIGHT),
|
||||
/* Goron pound */ DMG_ENTRY(1, DORA_DMGEFF_LIGHT),
|
||||
/* Fire arrow */ DMG_ENTRY(0, DORA_DMGEFF_LIGHT),
|
||||
/* Ice arrow */ DMG_ENTRY(0, DORA_DMGEFF_LIGHT),
|
||||
/* Light arrow */ DMG_ENTRY(0, DORA_DMGEFF_LIGHT),
|
||||
/* Goron spikes */ DMG_ENTRY(1, DORA_DMGEFF_LIGHT),
|
||||
/* Deku spin */ DMG_ENTRY(0, DORA_DMGEFF_LIGHT),
|
||||
/* Deku bubble */ DMG_ENTRY(0, DORA_DMGEFF_NONE),
|
||||
/* Deku launch */ DMG_ENTRY(0, DORA_DMGEFF_NONE),
|
||||
/* UNK_DMG_0x12 */ DMG_ENTRY(0, DORA_DMGEFF_NONE),
|
||||
/* Zora barrier */ DMG_ENTRY(0, DORA_DMGEFF_NONE),
|
||||
/* Normal shield */ DMG_ENTRY(0, DORA_DMGEFF_NONE),
|
||||
/* Light ray */ DMG_ENTRY(0, DORA_DMGEFF_NONE),
|
||||
/* Thrown object */ DMG_ENTRY(1, DORA_DMGEFF_LIGHT),
|
||||
/* Zora punch */ DMG_ENTRY(0, DORA_DMGEFF_LIGHT),
|
||||
/* Spin attack */ DMG_ENTRY(1, DORA_DMGEFF_NONE),
|
||||
/* Sword beam */ DMG_ENTRY(0, DORA_DMGEFF_NONE),
|
||||
/* Normal Roll */ DMG_ENTRY(0, DORA_DMGEFF_NONE),
|
||||
/* UNK_DMG_0x1B */ DMG_ENTRY(0, DORA_DMGEFF_NONE),
|
||||
/* UNK_DMG_0x1C */ DMG_ENTRY(0, DORA_DMGEFF_NONE),
|
||||
/* Unblockable */ DMG_ENTRY(0, DORA_DMGEFF_NONE),
|
||||
/* UNK_DMG_0x1E */ DMG_ENTRY(0, DORA_DMGEFF_NONE),
|
||||
/* Powder Keg */ DMG_ENTRY(0, DORA_DMGEFF_NONE),
|
||||
};
|
||||
|
||||
// sColChkInfoInit
|
||||
static CollisionCheckInfoInit2 D_80B614A8 = { 8, 0, 0, 0, MASS_HEAVY };
|
||||
static CollisionCheckInfoInit2 sColChkInfoInit = { 8, 0, 0, 0, MASS_HEAVY };
|
||||
|
||||
#endif
|
||||
void ObjDora_Init(Actor* thisx, GlobalContext* globalCtx) {
|
||||
ObjDora* this = THIS;
|
||||
s32 i;
|
||||
s32 j;
|
||||
Vec3f vtx[3];
|
||||
s32 buf = 0;
|
||||
s32 buff2 = 0;
|
||||
|
||||
extern ColliderTrisElementInit D_80B61310[6];
|
||||
extern ColliderTrisInit D_80B61478;
|
||||
extern DamageTable D_80B61488;
|
||||
extern CollisionCheckInfoInit2 D_80B614A8;
|
||||
Actor_SetScale(&this->actor, 0.1f);
|
||||
ActorShape_Init(&this->actor.shape, 0.0f, &ActorShadow_DrawCircle, 36.0f);
|
||||
|
||||
extern UNK_TYPE D_06004160;
|
||||
this->gongRotation.x = 0;
|
||||
this->gongRotation.z = 0;
|
||||
this->gongAngle.x = 0;
|
||||
this->gongAngle.z = 0;
|
||||
this->lastGongHitType = DORA_HIT_NONE;
|
||||
this->rupeeDropTimer = 0;
|
||||
this->collisionCooldownTimer = 0;
|
||||
this->unk3AA = 0;
|
||||
this->gongForce.x = 0.0f;
|
||||
this->gongForce.y = 0.0f;
|
||||
this->gongForce.z = 0.0f;
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Dora/ObjDora_Init.s")
|
||||
Collider_InitTris(globalCtx, &this->colliderTris);
|
||||
Collider_SetTris(globalCtx, &this->colliderTris, &this->actor, &sTrisInit, this->colliderTrisElements);
|
||||
CollisionCheck_SetInfo2(&this->actor.colChkInfo, &sDamageTable, &sColChkInfoInit);
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Dora/ObjDora_Destroy.s")
|
||||
Matrix_SetStateRotationAndTranslation(this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z,
|
||||
&this->actor.shape.rot);
|
||||
Matrix_Scale(this->actor.scale.x, this->actor.scale.y, this->actor.scale.z, MTXMODE_APPLY);
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Dora/func_80B60C9C.s")
|
||||
for (i = 0; i < ARRAY_COUNT(this->colliderTrisElements); i++) {
|
||||
for (j = 0; j < ARRAY_COUNT(vtx); j++) {
|
||||
Matrix_MultiplyVector3fByState(&sTrisElementsInit[i].dim.vtx[j], &vtx[j]);
|
||||
}
|
||||
Collider_SetTrisVertices(&this->colliderTris, i, &vtx[0], &vtx[1], &vtx[2]);
|
||||
}
|
||||
ObjDora_SetupWait(this);
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Dora/func_80B60CB0.s")
|
||||
void ObjDora_Destroy(Actor* thisx, GlobalContext* globalCtx) {
|
||||
ObjDora* this = THIS;
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Dora/func_80B60CC0.s")
|
||||
Collider_DestroyTris(globalCtx, &this->colliderTris);
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Dora/func_80B60D34.s")
|
||||
void ObjDora_SetupWait(ObjDora* this) {
|
||||
this->actionFunc = ObjDora_Wait;
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Dora/func_80B60E54.s")
|
||||
void ObjDora_Wait(ObjDora* this, GlobalContext* globalCtx) {
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Dora/func_80B60EE8.s")
|
||||
void ObjDora_SetupMoveGong(ObjDora* this) {
|
||||
if (this->lastGongHitType == DORA_HIT_LIGHT) {
|
||||
this->gongForce.x = 2.0f;
|
||||
this->gongForce.y = 5461.0f;
|
||||
this->gongForce.z = 1820.0f;
|
||||
} else {
|
||||
this->gongForce.x = 4.0f;
|
||||
this->gongForce.y = 12743.0f;
|
||||
this->gongForce.z = 5461.0f;
|
||||
}
|
||||
this->gongAngle.x = 0;
|
||||
this->gongAngle.z = 0;
|
||||
this->actionFunc = ObjDora_MoveGong;
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Dora/ObjDora_Update.s")
|
||||
void ObjDora_MoveGong(ObjDora* this, GlobalContext* globalCtx) {
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Dora/ObjDora_Draw.s")
|
||||
if ((this->gongForce.y < 182.0f) && (this->gongForce.z < 182.0f)) {
|
||||
this->lastGongHitType = DORA_HIT_LIGHT;
|
||||
ObjDora_SetupWait(this);
|
||||
}
|
||||
|
||||
Math_SmoothStepToF(&this->gongForce.x, 0, 0.2f, 0.2f, 0.1f);
|
||||
Math_SmoothStepToF(&this->gongForce.y, 0, 0.5f, 54.0f, 18.0f);
|
||||
Math_SmoothStepToF(&this->gongForce.z, 0, 0.5f, 54.0f, 18.0f);
|
||||
this->gongAngle.x += 0x1555;
|
||||
this->gongAngle.z += 0x238E;
|
||||
this->gongRotation.x = Math_SinS(this->gongAngle.x) * this->gongForce.y;
|
||||
this->gongRotation.z = Math_SinS(this->gongAngle.z) * this->gongForce.z;
|
||||
}
|
||||
|
||||
s32 ObjDora_IsHalfHour(u16 time) {
|
||||
f32 timeHalfHour = time;
|
||||
|
||||
timeHalfHour -= (CLOCK_TIME_F(0, 30) * (s32)(time / CLOCK_TIME_F(0, 30)));
|
||||
if ((timeHalfHour < CLOCK_TIME_F(0, 1)) || (CLOCK_TIME_F(0, 29) < timeHalfHour)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void ObjDora_UpdateCollision(ObjDora* this, GlobalContext* globalCtx) {
|
||||
Actor* itemDrop;
|
||||
u16 time;
|
||||
|
||||
if (this->colliderTris.base.acFlags & AC_HIT) {
|
||||
time = gSaveContext.save.time;
|
||||
this->colliderTris.base.acFlags &= ~AC_HIT;
|
||||
this->collisionCooldownTimer = 5;
|
||||
|
||||
switch (this->actor.colChkInfo.damageEffect) {
|
||||
case DORA_DMGEFF_STRONG:
|
||||
case DORA_DMGEFF_LIGHT:
|
||||
if (this->actor.colChkInfo.damageEffect == DORA_DMGEFF_LIGHT) {
|
||||
Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_DORA_S);
|
||||
this->lastGongHitType = DORA_HIT_LIGHT;
|
||||
} else {
|
||||
Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_DORA_L);
|
||||
this->lastGongHitType = DORA_HIT_STRONG;
|
||||
}
|
||||
|
||||
func_800BC848(&this->actor, globalCtx, 5, 10);
|
||||
ObjDora_SetupMoveGong(this);
|
||||
|
||||
if ((ObjDora_IsHalfHour(time) == true) && (this->rupeeDropTimer == 0)) {
|
||||
Actor_PlaySfxAtPos(&this->actor, NA_SE_SY_TRE_BOX_APPEAR);
|
||||
itemDrop = Item_DropCollectible(globalCtx, &this->actor.world.pos, ITEM00_RUPEE_BLUE);
|
||||
itemDrop->world.rot.y = this->actor.world.rot.y;
|
||||
itemDrop->world.rot.y += (s32)(Rand_Centered() * 90.0f * (0x10000 / 360.0f));
|
||||
itemDrop->velocity.y = 5.0f;
|
||||
itemDrop->gravity = -1.0f;
|
||||
this->rupeeDropTimer = 40;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (this->rupeeDropTimer > 0) {
|
||||
this->rupeeDropTimer--;
|
||||
}
|
||||
|
||||
if (this->collisionCooldownTimer > 0) {
|
||||
this->collisionCooldownTimer--;
|
||||
} else {
|
||||
CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->colliderTris.base);
|
||||
}
|
||||
}
|
||||
|
||||
void ObjDora_Update(Actor* thisx, GlobalContext* globalCtx) {
|
||||
ObjDora* this = THIS;
|
||||
|
||||
this->actionFunc(this, globalCtx);
|
||||
ObjDora_UpdateCollision(this, globalCtx);
|
||||
}
|
||||
|
||||
void ObjDora_Draw(Actor* thisx, GlobalContext* globalCtx) {
|
||||
static Vec3f position = { 0.0f, -61.5f, 0.0f };
|
||||
ObjDora* this = THIS;
|
||||
f32 gongForceX;
|
||||
|
||||
OPEN_DISPS(globalCtx->state.gfxCtx);
|
||||
func_8012C28C(globalCtx->state.gfxCtx);
|
||||
|
||||
if (this->actionFunc == ObjDora_MoveGong) {
|
||||
gongForceX = this->gongForce.x;
|
||||
if ((globalCtx->state.frames % 2) != 0) {
|
||||
gongForceX *= -1.0f;
|
||||
}
|
||||
|
||||
Matrix_StatePush();
|
||||
Matrix_InsertXRotation_s(this->gongRotation.x, MTXMODE_APPLY);
|
||||
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
||||
gSPDisplayList(POLY_OPA_DISP++, &gDoraGongDL);
|
||||
|
||||
Matrix_InsertTranslation(position.x, position.y + gongForceX, position.z + gongForceX, MTXMODE_APPLY);
|
||||
Matrix_InsertXRotation_s(this->gongRotation.z - this->gongRotation.x, MTXMODE_APPLY);
|
||||
Matrix_InsertTranslation(-position.x, -position.y, -position.z, MTXMODE_APPLY);
|
||||
|
||||
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
||||
gSPDisplayList(POLY_OPA_DISP++, &gDoraChainDL);
|
||||
|
||||
Matrix_StatePop();
|
||||
} else {
|
||||
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
||||
gSPDisplayList(POLY_OPA_DISP++, &gDoraChainDL);
|
||||
gSPDisplayList(POLY_OPA_DISP++, &gDoraGongDL);
|
||||
}
|
||||
|
||||
CLOSE_DISPS(globalCtx->state.gfxCtx);
|
||||
}
|
||||
|
|
|
@ -9,9 +9,16 @@ typedef void (*ObjDoraActionFunc)(struct ObjDora*, GlobalContext*);
|
|||
|
||||
typedef struct ObjDora {
|
||||
/* 0x0000 */ Actor actor;
|
||||
/* 0x0144 */ char unk_144[0x248];
|
||||
/* 0x0144 */ ColliderTris colliderTris;
|
||||
/* 0x0164 */ ColliderTrisElement colliderTrisElements[6];
|
||||
/* 0x038C */ ObjDoraActionFunc actionFunc;
|
||||
/* 0x0390 */ char unk_390[0x1C];
|
||||
/* 0x0390 */ Vec3f gongForce;
|
||||
/* 0x039C */ Vec2s gongAngle;
|
||||
/* 0x03A0 */ s16 lastGongHitType;
|
||||
/* 0x03A2 */ Vec2s gongRotation; // gongAngle * gongForce. Used in ObjDora_Draw.
|
||||
/* 0x03A6 */ s16 rupeeDropTimer;
|
||||
/* 0x03A8 */ s16 collisionCooldownTimer;
|
||||
/* 0x03AA */ s16 unk3AA; // Set but not used
|
||||
} ObjDora; // size = 0x3AC
|
||||
|
||||
extern const ActorInit Obj_Dora_InitVars;
|
||||
|
|
|
@ -45,10 +45,10 @@ Vec3f D_80B6669C = { 150.0f, 425.0f, 40.0f };
|
|||
Vec3f D_80B666A8 = { 0.0f, 140.0f, 40.0f };
|
||||
Vec3f D_80B666B4 = { 0.0f, 565.0f, 40.0f };
|
||||
|
||||
Gfx* D_80B666C0 = object_dora_DL_002080;
|
||||
Gfx* D_80B666C4 = object_dora_DL_002180;
|
||||
Gfx* D_80B666C8 = object_dora_DL_002380;
|
||||
Gfx* D_80B666CC = object_dora_DL_002280;
|
||||
Gfx* D_80B666C0 = gKendoKanbanTopRightDL;
|
||||
Gfx* D_80B666C4 = gKendoKanbanTopLeftDL;
|
||||
Gfx* D_80B666C8 = gKendoKanbanBottomRightDL;
|
||||
Gfx* D_80B666CC = gKendoKanbanBottomLeftDL;
|
||||
|
||||
Vec3f D_80B666D0 = { -300.0f, 850.0f, 40.0f };
|
||||
Vec3f D_80B666DC = { 10.0f, 850.0f, 40.0f };
|
||||
|
@ -472,7 +472,7 @@ void ObjKendoKanban_Draw(Actor* thisx, GlobalContext* globalCtx) {
|
|||
|
||||
if (this->unk_30C == OBJKENDOKANBAN_F_0) {
|
||||
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
||||
gSPDisplayList(POLY_OPA_DISP++, object_dora_DL_000180);
|
||||
gSPDisplayList(POLY_OPA_DISP++, gKendoKanbanDL);
|
||||
} else {
|
||||
Matrix_InsertRotationAroundUnitVector_s(this->unk_302, &this->unk_2F0, MTXMODE_APPLY);
|
||||
Matrix_InsertTranslation(-this->unk_2E4.x, -this->unk_2E4.y, -this->unk_2E4.z, MTXMODE_APPLY);
|
||||
|
|
|
@ -1632,11 +1632,6 @@ D_06000F00 = 0x06000F00;
|
|||
D_06000180 = 0x06000180;
|
||||
D_06000BA0 = 0x06000BA0;
|
||||
|
||||
// ovl_Obj_Dora
|
||||
|
||||
D_06003FD0 = 0x06003FD0;
|
||||
D_06004160 = 0x06004160;
|
||||
|
||||
// ovl_Obj_Jgame_Light
|
||||
|
||||
D_060003A0 = 0x060003A0;
|
||||
|
|
Loading…
Reference in New Issue