1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2025-08-06 06:10:21 +00:00

En_Arrow OK (#648)

* fix colliderinit typo

* fix initchain

* start init

* match init

* progress

* progress

* more funcs

* match func_809B3DD8

* progress

* last func almost done

* enum

* name some more types

* progress

* all but one

* fix warning

* remove undefined syms

* match arrows

* review

* spec

* remove asm
This commit is contained in:
fig02 2021-02-02 20:30:21 -05:00 committed by GitHub
parent 6221723aad
commit dff2dfef0f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
29 changed files with 513 additions and 1609 deletions

View file

@ -166,7 +166,7 @@ void ArrowFire_Fly(ArrowFire* this, GlobalContext* globalCtx) {
}
func_80865ECC(&this->unkPos, &this->actor.world.pos, 0.05f);
if (arrow->hitWall & 1) {
if (arrow->hitFlags & 1) {
Audio_PlayActorSound2(&this->actor, NA_SE_IT_EXPLOSION_FRAME);
ArrowFire_SetupAction(this, ArrowFire_Hit);
this->timer = 32;
@ -203,7 +203,7 @@ void ArrowFire_Draw(Actor* thisx, GlobalContext* globalCtx) {
if ((arrow != NULL) && (arrow->actor.update != NULL) && (this->timer < 255)) {
if (1) {}
tranform = (arrow->hitWall & 2) ? &this->actor : &arrow->actor;
tranform = (arrow->hitFlags & 2) ? &this->actor : &arrow->actor;
OPEN_DISPS(globalCtx->state.gfxCtx, "../z_arrow_fire.c", 618);

View file

@ -167,7 +167,7 @@ void ArrowIce_Fly(ArrowIce* this, GlobalContext* globalCtx) {
}
func_80867E8C(&this->unkPos, &this->actor.world.pos, 0.05f);
if (arrow->hitWall & 1) {
if (arrow->hitFlags & 1) {
Audio_PlayActorSound2(&this->actor, NA_SE_IT_EXPLOSION_ICE);
ArrowIce_SetupAction(this, ArrowIce_Hit);
this->timer = 32;
@ -204,7 +204,7 @@ void ArrowIce_Draw(Actor* thisx, GlobalContext* globalCtx) {
if ((arrow != NULL) && (arrow->actor.update != NULL) && (this->timer < 255)) {
if (1) {}
tranform = (arrow->hitWall & 2) ? &this->actor : &arrow->actor;
tranform = (arrow->hitFlags & 2) ? &this->actor : &arrow->actor;
OPEN_DISPS(globalCtx->state.gfxCtx, "../z_arrow_ice.c", 610);

View file

@ -167,7 +167,7 @@ void ArrowLight_Fly(ArrowLight* this, GlobalContext* globalCtx) {
}
func_80869E6C(&this->unkPos, &this->actor.world.pos, 0.05f);
if (arrow->hitWall & 1) {
if (arrow->hitFlags & 1) {
Audio_PlayActorSound2(&this->actor, NA_SE_IT_EXPLOSION_LIGHT);
ArrowLight_SetupAction(this, ArrowLight_Hit);
this->timer = 32;
@ -204,7 +204,7 @@ void ArrowLight_Draw(Actor* thisx, GlobalContext* globalCtx) {
if ((arrow != NULL) && (arrow->actor.update != NULL) && (this->timer < 255)) {
if (1) {}
tranform = (arrow->hitWall & 2) ? &this->actor : &arrow->actor;
tranform = (arrow->hitFlags & 2) ? &this->actor : &arrow->actor;
OPEN_DISPS(globalCtx->state.gfxCtx, "../z_arrow_light.c", 598);

View file

@ -5,7 +5,7 @@
*/
#include "z_demo_im.h"
#include "overlays/actors/ovl_En_Arrow/z_en_arrow.h"
#include "vt.h"
#define FLAGS 0x00000011
@ -750,7 +750,7 @@ void func_809865F8(DemoIm* this, GlobalContext* globalCtx, s32 arg2) {
f32 spawnPosZ = thisPos->z + (Math_CosS(shapeRotY) * 30.0f);
Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_ARROW, spawnPosX, spawnPosY, spawnPosZ, 0xFA0,
this->actor.shape.rot.y, 0, 0xFFF6);
this->actor.shape.rot.y, 0, ARROW_CS_NUT);
this->unk_27C = 1;
}
} else {
@ -1160,18 +1160,17 @@ s32 DemoIm_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList
}
}
if (*unk_2D0 != 0) {
if (limbIndex == 15) {
*dList = D_0600EDE8;
}
if ((*unk_2D0 != 0) && (limbIndex == 15)) {
*dList = D_0600EDE8;
}
return false;
}
void DemoIm_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) {
DemoIm* this = THIS;
if (limbIndex == 0x10) {
if (limbIndex == 16) {
Vec3f sp28 = D_809887D8;
Vec3f dest;

View file

@ -5,7 +5,7 @@
*/
#include "z_en_arow_trap.h"
#include "overlays/actors/ovl_En_Arrow/z_en_arrow.h"
#define FLAGS 0x00000010
#define THIS ((EnArowTrap*)thisx)
@ -47,7 +47,7 @@ void EnArowTrap_Update(Actor* thisx, GlobalContext* globalCtx) {
if (this->attackTimer == 0) {
Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_ARROW, this->actor.world.pos.x,
this->actor.world.pos.y, this->actor.world.pos.z, this->actor.shape.rot.x,
this->actor.shape.rot.y, this->actor.shape.rot.z, -1);
this->actor.shape.rot.y, this->actor.shape.rot.z, ARROW_NORMAL_SILENT);
this->attackTimer = 80;
}
}

View file

@ -1,7 +1,7 @@
/*
* File: z_en_arrow.c
* Overlay: ovl_En_Arrow
* Description: Arrows
* Description: Arrow, Deku Seed, and Deku Nut Projectile
*/
#include "z_en_arrow.h"
@ -16,7 +16,11 @@ void EnArrow_Destroy(Actor* thisx, GlobalContext* globalCtx);
void EnArrow_Update(Actor* thisx, GlobalContext* globalCtx);
void EnArrow_Draw(Actor* thisx, GlobalContext* globalCtx);
/*
void EnArrow_Shoot(EnArrow* this, GlobalContext* globalCtx);
void EnArrow_Fly(EnArrow* this, GlobalContext* globalCtx);
void func_809B45E0(EnArrow* this, GlobalContext* globalCtx);
void func_809B4640(EnArrow* this, GlobalContext* globalCtx);
const ActorInit En_Arrow_InitVars = {
ACTOR_EN_ARROW,
ACTORCAT_ITEMACTION,
@ -29,7 +33,7 @@ const ActorInit En_Arrow_InitVars = {
(ActorFunc)EnArrow_Draw,
};
static ColliderQuadInit D_809B4D50 = {
static ColliderQuadInit sColliderInit = {
{
COLTYPE_NONE,
AT_ON | AT_TYPE_PLAYER,
@ -48,27 +52,447 @@ static ColliderQuadInit D_809B4D50 = {
},
{ { { 0.0f, 0.0f, 0.0f }, { 0.0f, 0.0f, 0.0f }, { 0.0f, 0.0f, 0.0f }, { 0.0f, 0.0f, 0.0f } } },
};
*/
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Arrow/func_809B3920.s")
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Arrow/EnArrow_Init.s")
static InitChainEntry sInitChain[] = {
ICHAIN_F32(minVelocityY, 65386, ICHAIN_STOP),
};
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Arrow/EnArrow_Destroy.s")
void EnArrow_SetupAction(EnArrow* this, EnArrowActionFunc actionFunc) {
this->actionFunc = actionFunc;
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Arrow/func_809B3BD4.s")
void EnArrow_Init(Actor* thisx, GlobalContext* globalCtx) {
static EffectBlureInit2 blureNormal = {
0, 4, 0, { 0, 255, 200, 255 }, { 0, 255, 255, 255 }, { 0, 255, 200, 0 }, { 0, 255, 255, 0 }, 16,
0, 1, 0, { 255, 255, 170, 255 }, { 0, 150, 0, 0 },
};
static EffectBlureInit2 blureFire = {
0, 4, 0, { 0, 255, 200, 255 }, { 0, 255, 255, 255 }, { 0, 255, 200, 0 }, { 0, 255, 255, 0 }, 16,
0, 1, 0, { 255, 200, 0, 255 }, { 255, 0, 0, 0 },
};
static EffectBlureInit2 blureIce = {
0, 4, 0, { 0, 255, 200, 255 }, { 0, 255, 255, 255 }, { 0, 255, 200, 0 }, { 0, 255, 255, 0 }, 16,
0, 1, 0, { 170, 255, 255, 255 }, { 0, 100, 255, 0 },
};
static EffectBlureInit2 blureLight = {
0, 4, 0, { 0, 255, 200, 255 }, { 0, 255, 255, 255 }, { 0, 255, 200, 0 }, { 0, 255, 255, 0 }, 16,
0, 1, 0, { 255, 255, 170, 255 }, { 255, 255, 0, 0 },
};
static u32 dmgFlags[] = {
0x00000800, 0x00000020, 0x00000020, 0x00000800, 0x00001000,
0x00002000, 0x00010000, 0x00004000, 0x00008000, 0x00000004,
};
EnArrow* this = THIS;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Arrow/func_809B3CEC.s")
Actor_ProcessInitChain(&this->actor, sInitChain);
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Arrow/func_809B3DD8.s")
if (this->actor.params == ARROW_CS_NUT) {
this->isCsNut = true;
this->actor.params = ARROW_NUT;
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Arrow/func_809B3FDC.s")
if (this->actor.params <= ARROW_SEED) {
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Arrow/func_809B45E0.s")
if (this->actor.params <= ARROW_0E) {
SkelAnime_Init(globalCtx, &this->skelAnime, &gArrowSkel, &gArrow2Anim, NULL, NULL, 0);
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Arrow/func_809B4640.s")
if (this->actor.params <= ARROW_NORMAL) {
if (this->actor.params == ARROW_NORMAL_HORSE) {
blureNormal.elemDuration = 4;
} else {
blureNormal.elemDuration = 16;
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Arrow/EnArrow_Update.s")
Effect_Add(globalCtx, &this->effectIndex, EFFECT_BLURE2, 0, 0, &blureNormal);
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Arrow/func_809B4800.s")
} else if (this->actor.params == ARROW_FIRE) {
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Arrow/EnArrow_Draw.s")
Effect_Add(globalCtx, &this->effectIndex, EFFECT_BLURE2, 0, 0, &blureFire);
} else if (this->actor.params == ARROW_ICE) {
Effect_Add(globalCtx, &this->effectIndex, EFFECT_BLURE2, 0, 0, &blureIce);
} else if (this->actor.params == ARROW_LIGHT) {
Effect_Add(globalCtx, &this->effectIndex, EFFECT_BLURE2, 0, 0, &blureLight);
}
Collider_InitQuad(globalCtx, &this->collider);
Collider_SetQuad(globalCtx, &this->collider, &this->actor, &sColliderInit);
if (this->actor.params <= ARROW_NORMAL) {
this->collider.info.toucherFlags &= ~0x18;
this->collider.info.toucherFlags |= 0;
}
if (this->actor.params < 0) {
this->collider.base.atFlags = (AT_ON | AT_TYPE_ENEMY);
} else if (this->actor.params <= ARROW_SEED) {
this->collider.info.toucher.dmgFlags = dmgFlags[this->actor.params];
LOG_HEX("this->at_info.cl_elem.at_btl_info.at_type", this->collider.info.toucher.dmgFlags, "../z_en_arrow.c",
707);
}
}
EnArrow_SetupAction(this, EnArrow_Shoot);
}
void EnArrow_Destroy(Actor* thisx, GlobalContext* globalCtx) {
EnArrow* this = THIS;
if (this->actor.params <= ARROW_LIGHT) {
Effect_Delete(globalCtx, this->effectIndex);
}
SkelAnime_Free(&this->skelAnime, globalCtx);
Collider_DestroyQuad(globalCtx, &this->collider);
if ((this->hitActor != NULL) && (this->hitActor->update != NULL)) {
this->hitActor->flags &= ~0x8000;
}
}
void EnArrow_Shoot(EnArrow* this, GlobalContext* globalCtx) {
Player* player = PLAYER;
if (this->actor.parent == NULL) {
if ((this->actor.params != ARROW_NUT) && (player->unk_A73 == 0)) {
Actor_Kill(&this->actor);
return;
}
switch (this->actor.params) {
case ARROW_SEED:
func_8002F7DC(&player->actor, NA_SE_IT_SLING_SHOT);
break;
case ARROW_NORMAL_LIT:
case ARROW_NORMAL_HORSE:
case ARROW_NORMAL:
func_8002F7DC(&player->actor, NA_SE_IT_ARROW_SHOT);
break;
case ARROW_FIRE:
case ARROW_ICE:
case ARROW_LIGHT:
func_8002F7DC(&player->actor, NA_SE_IT_MAGIC_ARROW_SHOT);
break;
}
EnArrow_SetupAction(this, EnArrow_Fly);
Math_Vec3f_Copy(&this->unk_210, &this->actor.world.pos);
if (this->actor.params >= ARROW_SEED) {
func_8002D9A4(&this->actor, 80.0f);
this->timer = 15;
this->actor.shape.rot.x = this->actor.shape.rot.y = this->actor.shape.rot.z = 0;
} else {
func_8002D9A4(&this->actor, 150.0f);
this->timer = 12;
}
}
}
void func_809B3CEC(GlobalContext* globalCtx, EnArrow* this) {
EnArrow_SetupAction(this, func_809B4640);
Animation_PlayOnce(&this->skelAnime, &gArrow1Anim);
this->actor.world.rot.y += (s32)(24576.0f * (Rand_ZeroOne() - 0.5f)) + 0x8000;
this->actor.velocity.y += (this->actor.speedXZ * (0.4f + (0.4f * Rand_ZeroOne())));
this->actor.speedXZ *= (0.04f + 0.3f * Rand_ZeroOne());
this->timer = 50;
this->actor.gravity = -1.5f;
}
void EnArrow_CarryActor(EnArrow* this, GlobalContext* globalCtx) {
CollisionPoly* hitPoly;
Vec3f posDiffLastFrame;
Vec3f actorNextPos;
Vec3f hitPos;
f32 temp_f12;
f32 scale;
s32 bgId;
Math_Vec3f_Diff(&this->actor.world.pos, &this->unk_210, &posDiffLastFrame);
temp_f12 = ((this->actor.world.pos.x - this->hitActor->world.pos.x) * posDiffLastFrame.x) +
((this->actor.world.pos.y - this->hitActor->world.pos.y) * posDiffLastFrame.y) +
((this->actor.world.pos.z - this->hitActor->world.pos.z) * posDiffLastFrame.z);
if (!(temp_f12 < 0.0f)) {
scale = Math3D_Vec3fMagnitudeSq(&posDiffLastFrame);
if (!(scale < 1.0f)) {
scale = temp_f12 / scale;
Math_Vec3f_Scale(&posDiffLastFrame, scale);
Math_Vec3f_Sum(&this->hitActor->world.pos, &posDiffLastFrame, &actorNextPos);
if (BgCheck_EntityLineTest1(&globalCtx->colCtx, &this->hitActor->world.pos, &actorNextPos, &hitPos,
&hitPoly, true, true, true, true, &bgId)) {
this->hitActor->world.pos.x = hitPos.x + ((actorNextPos.x <= hitPos.x) ? 1.0f : -1.0f);
this->hitActor->world.pos.y = hitPos.y + ((actorNextPos.y <= hitPos.y) ? 1.0f : -1.0f);
this->hitActor->world.pos.z = hitPos.z + ((actorNextPos.z <= hitPos.z) ? 1.0f : -1.0f);
} else {
Math_Vec3f_Copy(&this->hitActor->world.pos, &actorNextPos);
}
}
}
}
void EnArrow_Fly(EnArrow* this, GlobalContext* globalCtx) {
CollisionPoly* hitPoly;
s32 bgId;
Vec3f hitPoint;
Vec3f posCopy;
s32 atTouched;
u16 sfxId;
Actor* hitActor;
Vec3f sp60;
Vec3f sp54;
if (DECR(this->timer) == 0) {
Actor_Kill(&this->actor);
return;
}
if (this->timer < 7.2000003f) {
this->actor.gravity = -0.4f;
}
atTouched = (this->actor.params != ARROW_NORMAL_LIT) && (this->actor.params <= ARROW_SEED) &&
(this->collider.base.atFlags & AT_HIT);
if (atTouched || this->touchedPoly) {
if (this->actor.params >= ARROW_SEED) {
if (atTouched) {
this->actor.world.pos.x = (this->actor.world.pos.x + this->actor.prevPos.x) * 0.5f;
this->actor.world.pos.y = (this->actor.world.pos.y + this->actor.prevPos.y) * 0.5f;
this->actor.world.pos.z = (this->actor.world.pos.z + this->actor.prevPos.z) * 0.5f;
}
if (this->actor.params == ARROW_NUT) {
iREG(50) = -1;
Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_M_FIRE1, this->actor.world.pos.x,
this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, 0);
sfxId = NA_SE_IT_DEKU;
} else {
sfxId = NA_SE_IT_SLING_REFLECT;
}
EffectSsStone1_Spawn(globalCtx, &this->actor.world.pos, 0);
Audio_PlaySoundAtPosition(globalCtx, &this->actor.world.pos, 20, sfxId);
Actor_Kill(&this->actor);
} else {
EffectSsHitMark_SpawnCustomScale(globalCtx, 0, 150, &this->actor.world.pos);
if (atTouched && (this->collider.info.atHitInfo->elemType != ELEMTYPE_UNK4)) {
hitActor = this->collider.base.at;
if ((hitActor->update != NULL) && (!(this->collider.base.atFlags & AT_BOUNCED)) &&
(hitActor->flags & 0x4000)) {
this->hitActor = hitActor;
EnArrow_CarryActor(this, globalCtx);
Math_Vec3f_Diff(&hitActor->world.pos, &this->actor.world.pos, &this->unk_250);
hitActor->flags |= 0x8000;
this->collider.base.atFlags &= ~AT_HIT;
this->actor.speedXZ /= 2.0f;
this->actor.velocity.y /= 2.0f;
} else {
this->hitFlags |= 1;
this->hitFlags |= 2;
if (this->collider.info.atHitInfo->bumperFlags & 2) {
this->actor.world.pos.x = this->collider.info.atHitInfo->bumper.hitPos.x;
this->actor.world.pos.y = this->collider.info.atHitInfo->bumper.hitPos.y;
this->actor.world.pos.z = this->collider.info.atHitInfo->bumper.hitPos.z;
}
func_809B3CEC(globalCtx, this);
Audio_PlayActorSound2(&this->actor, NA_SE_IT_ARROW_STICK_CRE);
}
} else if (this->touchedPoly) {
EnArrow_SetupAction(this, func_809B45E0);
Animation_PlayOnce(&this->skelAnime, &gArrow2Anim);
if (this->actor.params >= ARROW_NORMAL_LIT) {
this->timer = 60;
} else {
this->timer = 20;
}
Audio_PlayActorSound2(&this->actor, NA_SE_IT_ARROW_STICK_OBJ);
this->hitFlags |= 1;
}
}
} else {
Math_Vec3f_Copy(&this->unk_210, &this->actor.world.pos);
Actor_MoveForward(&this->actor);
if (this->touchedPoly =
BgCheck_ProjectileLineTest(&globalCtx->colCtx, &this->actor.prevPos, &this->actor.world.pos, &hitPoint,
&this->actor.wallPoly, true, true, true, true, &bgId)) {
func_8002F9EC(globalCtx, &this->actor, this->actor.wallPoly, bgId, &hitPoint);
Math_Vec3f_Copy(&posCopy, &this->actor.world.pos);
Math_Vec3f_Copy(&this->actor.world.pos, &hitPoint);
}
if (this->actor.params <= ARROW_0E) {
this->actor.shape.rot.x = Math_Atan2S(this->actor.speedXZ, -this->actor.velocity.y);
}
}
if (this->hitActor != NULL) {
if (this->hitActor->update != NULL) {
Math_Vec3f_Sum(&this->unk_210, &this->unk_250, &sp60);
Math_Vec3f_Sum(&this->actor.world.pos, &this->unk_250, &sp54);
if (BgCheck_EntityLineTest1(&globalCtx->colCtx, &sp60, &sp54, &hitPoint, &hitPoly, true, true, true, true,
&bgId)) {
this->hitActor->world.pos.x = hitPoint.x + ((sp54.x <= hitPoint.x) ? 1.0f : -1.0f);
this->hitActor->world.pos.y = hitPoint.y + ((sp54.y <= hitPoint.y) ? 1.0f : -1.0f);
this->hitActor->world.pos.z = hitPoint.z + ((sp54.z <= hitPoint.z) ? 1.0f : -1.0f);
Math_Vec3f_Diff(&this->hitActor->world.pos, &this->actor.world.pos, &this->unk_250);
this->hitActor->flags &= ~0x8000;
this->hitActor = NULL;
} else {
Math_Vec3f_Sum(&this->actor.world.pos, &this->unk_250, &this->hitActor->world.pos);
}
if (this->touchedPoly && (this->hitActor != NULL)) {
this->hitActor->flags &= ~0x8000;
this->hitActor = NULL;
}
} else {
this->hitActor = NULL;
}
}
}
void func_809B45E0(EnArrow* this, GlobalContext* globalCtx) {
SkelAnime_Update(&this->skelAnime);
if (DECR(this->timer) == 0) {
Actor_Kill(&this->actor);
}
}
void func_809B4640(EnArrow* this, GlobalContext* globalCtx) {
SkelAnime_Update(&this->skelAnime);
Actor_MoveForward(&this->actor);
if (DECR(this->timer) == 0) {
Actor_Kill(&this->actor);
}
}
void EnArrow_Update(Actor* thisx, GlobalContext* globalCtx) {
s32 pad;
EnArrow* this = THIS;
Player* player = PLAYER;
if (this->isCsNut || ((this->actor.params >= ARROW_NORMAL_LIT) && (player->unk_A73 != 0)) ||
!Player_InBlockingCsMode(globalCtx, player)) {
this->actionFunc(this, globalCtx);
}
if ((this->actor.params >= ARROW_FIRE) && (this->actor.params <= ARROW_0E)) {
s16 elementalActorIds[] = { ACTOR_ARROW_FIRE, ACTOR_ARROW_ICE, ACTOR_ARROW_LIGHT,
ACTOR_ARROW_FIRE, ACTOR_ARROW_FIRE, ACTOR_ARROW_FIRE };
if (this->actor.child == NULL) {
Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, elementalActorIds[this->actor.params - 3],
this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0,
0);
}
} else if (this->actor.params == ARROW_NORMAL_LIT) {
static Vec3f velocity = { 0.0f, 0.5f, 0.0f };
static Vec3f accel = { 0.0f, 0.5f, 0.0f };
static Color_RGBA8 primColor = { 255, 255, 100, 255 };
static Color_RGBA8 envColor = { 255, 50, 0, 0 };
// spawn dust for the flame
func_8002836C(globalCtx, &this->unk_21C, &velocity, &accel, &primColor, &envColor, 100, 0, 8);
}
}
void func_809B4800(EnArrow* this, GlobalContext* globalCtx) {
static Vec3f D_809B4E88 = { 0.0f, 400.0f, 1500.0f };
static Vec3f D_809B4E94 = { 0.0f, -400.0f, 1500.0f };
static Vec3f D_809B4EA0 = { 0.0f, 0.0f, -300.0f };
Vec3f sp44;
Vec3f sp38;
s32 addBlureVertex;
Matrix_MultVec3f(&D_809B4EA0, &this->unk_21C);
if (EnArrow_Fly == this->actionFunc) {
Matrix_MultVec3f(&D_809B4E88, &sp44);
Matrix_MultVec3f(&D_809B4E94, &sp38);
if (this->actor.params <= ARROW_SEED) {
addBlureVertex = this->actor.params <= ARROW_LIGHT;
if (this->hitActor == NULL) {
addBlureVertex &= func_80090480(globalCtx, &this->collider, &this->weaponInfo, &sp44, &sp38);
} else {
if (addBlureVertex) {
if ((sp44.x == this->weaponInfo.tip.x) && (sp44.y == this->weaponInfo.tip.y) &&
(sp44.z == this->weaponInfo.tip.z) && (sp38.x == this->weaponInfo.base.x) &&
(sp38.y == this->weaponInfo.base.y) && (sp38.z == this->weaponInfo.base.z)) {
addBlureVertex = false;
}
}
}
if (addBlureVertex) {
EffectBlure_AddVertex(Effect_GetByIndex(this->effectIndex), &sp44, &sp38);
}
}
}
}
void EnArrow_Draw(Actor* thisx, GlobalContext* globalCtx) {
s32 pad;
EnArrow* this = THIS;
u8 alpha;
f32 scale;
if (this->actor.params <= ARROW_0E) {
func_80093D18(globalCtx->state.gfxCtx);
SkelAnime_DrawLod(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, NULL, NULL, this,
(this->actor.projectedPos.z < MREG(95)) ? 0 : 1);
} else if (this->actor.speedXZ != 0.0f) {
alpha = (Math_CosS(this->timer * 5000) * 127.5f) + 127.5f;
OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_arrow.c", 1346);
func_80093C14(globalCtx->state.gfxCtx);
if (this->actor.params == ARROW_SEED) {
gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 255, 255);
gDPSetEnvColor(POLY_XLU_DISP++, 0, 255, 255, alpha);
scale = 50.0f;
} else {
gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 12, 0, 0, 255);
gDPSetEnvColor(POLY_XLU_DISP++, 250, 250, 0, alpha);
scale = 150.0f;
}
Matrix_Push();
Matrix_Mult(&globalCtx->mf_11DA0, MTXMODE_APPLY);
// redundant check because this is contained in an if block for non-zero speed
Matrix_RotateZ((this->actor.speedXZ == 0.0f) ? 0.0f
: ((globalCtx->gameplayFrames & 0xFF) * 4000) * (M_PI / 32768),
MTXMODE_APPLY);
Matrix_Scale(scale, scale, scale, MTXMODE_APPLY);
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_arrow.c", 1374),
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPDisplayList(POLY_XLU_DISP++, gEffSparklesDL);
Matrix_Pull();
Matrix_RotateY(this->actor.world.rot.y * (M_PI / 32768), MTXMODE_APPLY);
CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_arrow.c", 1381);
}
func_809B4800(this, globalCtx);
}

View file

@ -6,16 +6,41 @@
struct EnArrow;
typedef void (*EnArrowActionFunc)(struct EnArrow*, GlobalContext*);
typedef struct EnArrow {
/* 0x0000 */ Actor actor;
/* 0x014C */ char unk_14C[0x5C];
/* 0x01A8 */ s32 unk_1A8; // related to arrows being on fire
/* 0x01AC */ char unk_1AC[0x9C];
/* 0x014C */ SkelAnime skelAnime;
/* 0x0190 */ ColliderQuad collider;
/* 0x0210 */ Vec3f unk_210;
/* 0x021C */ Vec3f unk_21C;
/* 0x0228 */ s32 effectIndex;
/* 0x022C */ WeaponInfo weaponInfo;
/* 0x0248 */ u8 timer; // used for dissapearing when flying or hitting a wall
/* 0x0249 */ u8 hitWall;
/* 0x024A */ char unk_24A[0x16];
/* 0x0249 */ u8 hitFlags;
/* 0x024A */ u8 touchedPoly;
/* 0x024B */ u8 isCsNut;
/* 0x024C */ Actor* hitActor;
/* 0x0250 */ Vec3f unk_250;
/* 0x025C */ EnArrowActionFunc actionFunc;
} EnArrow; // size = 0x0260
typedef enum {
/* -10 */ ARROW_CS_NUT = -10, // cutscene deku nuts are allowed to update in blocking mode
/* -1 */ ARROW_NORMAL_SILENT = -1, // normal arrow that does not make a sound when being shot
/* 0 */ ARROW_NORMAL_LIT, // normal arrow lit on fire
/* 1 */ ARROW_NORMAL_HORSE, // normal arrow shot while riding a horse
/* 2 */ ARROW_NORMAL,
/* 3 */ ARROW_FIRE,
/* 4 */ ARROW_ICE,
/* 5 */ ARROW_LIGHT,
/* 6 */ ARROW_0C,
/* 7 */ ARROW_0D,
/* 8 */ ARROW_0E,
/* 9 */ ARROW_SEED,
/* 10 */ ARROW_NUT
} ArrowType;
extern const ActorInit En_Arrow_InitVars;
#endif

View file

@ -9,15 +9,15 @@ struct EnBoom;
typedef void (*EnBoomActionFunc)(struct EnBoom*, GlobalContext*);
typedef struct EnBoom {
/* 0x0000 */ Actor actor;
/* 0x014C */ ColliderQuad collider;
/* 0x01CC */ Actor* moveTo; // actor boomerang moves toward
/* 0x01D0 */ Actor* grabbed; // actor grabbed by the boomerang
/* 0x01D4 */ u8 returnTimer; // returns to Link when 0
/* 0x01D5 */ u8 activeTimer; // increments once every update
/* 0x01D8 */ s32 effectIndex; // set by Effect_Add
/* 0x01DC */ WeaponInfo boomerangInfo;
/* 0x01F8 */ EnBoomActionFunc actionFunc;
/* 0x0000 */ Actor actor;
/* 0x014C */ ColliderQuad collider;
/* 0x01CC */ Actor* moveTo; // actor boomerang moves toward
/* 0x01D0 */ Actor* grabbed; // actor grabbed by the boomerang
/* 0x01D4 */ u8 returnTimer; // returns to Link when 0
/* 0x01D5 */ u8 activeTimer; // increments once every update
/* 0x01D8 */ s32 effectIndex;
/* 0x01DC */ WeaponInfo boomerangInfo;
/* 0x01F8 */ EnBoomActionFunc actionFunc;
} EnBoom; // size = 0x01FC
extern const ActorInit En_Boom_InitVars;

View file

@ -197,7 +197,7 @@ void ObjSyokudai_Update(Actor* thisx, GlobalContext* globalCtx2) {
arrow = (EnArrow*)this->colliderFlame.base.ac;
if ((arrow->actor.update != NULL) && (arrow->actor.id == ACTOR_EN_ARROW)) {
arrow->actor.params = 0;
arrow->unk_1A8 = 0x800;
arrow->collider.info.toucher.dmgFlags = 0x800;
}
}
if ((0 <= this->litTimer) && (this->litTimer < (50 * litTimeScale + 100)) && (torchType != 0)) {

View file

@ -10,6 +10,7 @@
#include "overlays/actors/ovl_Bg_Heavy_Block/z_bg_heavy_block.h"
#include "overlays/actors/ovl_Door_Shutter/z_door_shutter.h"
#include "overlays/actors/ovl_En_Boom/z_en_boom.h"
#include "overlays/actors/ovl_En_Arrow/z_en_arrow.h"
#include "overlays/actors/ovl_En_Box/z_en_box.h"
#include "overlays/actors/ovl_En_Door/z_en_door.h"
#include "overlays/actors/ovl_En_Elf/z_en_elf.h"
@ -33,7 +34,8 @@ typedef struct {
#define CHEST_ANIM_SHORT 0
#define CHEST_ANIM_LONG 1
#define GET_ITEM_NONE { ITEM_NONE, 0, 0, 0, 0 }
#define GET_ITEM_NONE \
{ ITEM_NONE, 0, 0, 0, 0 }
typedef struct {
/* 0x00 */ u8 itemId;
@ -1931,13 +1933,13 @@ s32 func_80834380(GlobalContext* globalCtx, Player* this, s32* itemPtr, s32* typ
if (LINK_IS_ADULT) {
*itemPtr = ITEM_BOW;
if (this->stateFlags1 & 0x800000) {
*typePtr = 1;
*typePtr = ARROW_NORMAL_HORSE;
} else {
*typePtr = this->heldItemActionParam - 6;
}
} else {
*itemPtr = ITEM_SLINGSHOT;
*typePtr = 9;
*typePtr = ARROW_SEED;
}
if (gSaveContext.minigameState == 1) {
@ -1967,12 +1969,12 @@ s32 func_8083442C(Player* this, GlobalContext* globalCtx) {
func_8002F7DC(&this->actor, D_80854398[ABS(this->unk_860) - 1]);
if (!Player_HoldsHookshot(this) && (func_80834380(globalCtx, this, &item, &arrowType) > 0)) {
magicArrowType = arrowType - 3;
magicArrowType = arrowType - ARROW_FIRE;
if (this->unk_860 >= 0) {
if ((magicArrowType >= 0) && (magicArrowType < 3) &&
if ((magicArrowType >= 0) && (magicArrowType <= 2) &&
!func_80087708(globalCtx, sMagicArrowCosts[magicArrowType], 0)) {
arrowType = 2;
arrowType = ARROW_NORMAL;
}
this->heldActor = Actor_SpawnAsChild(
@ -9034,7 +9036,8 @@ void Player_Init(Actor* thisx, GlobalContext* globalCtx2) {
titleFileSize = scene->titleFile.vromEnd - scene->titleFile.vromStart;
if ((titleFileSize != 0) && gSaveContext.showTitleCard) {
if ((gSaveContext.sceneSetupIndex < 4) &&
(gEntranceTable[((void)0, gSaveContext.entranceIndex) + ((void)0, gSaveContext.sceneSetupIndex)].field & 0x4000) &&
(gEntranceTable[((void)0, gSaveContext.entranceIndex) + ((void)0, gSaveContext.sceneSetupIndex)].field &
0x4000) &&
((globalCtx->sceneNum != SCENE_DDAN) || (gSaveContext.eventChkInf[11] & 1)) &&
((globalCtx->sceneNum != SCENE_NIGHT_SHOP) || (gSaveContext.eventChkInf[2] & 0x20))) {
TitleCard_InitPlaceName(globalCtx, &globalCtx->actorCtx.titleCtx, this->giObjectSegment, 0xA0, 0x78,

View file

@ -41,12 +41,12 @@ u32 EffectSsKiraKira_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, v
if ((this->life = initParams->life) < 0) {
this->life = -this->life;
this->gfx = SEGMENTED_TO_VIRTUAL(gEffFairySparklesDL);
this->gfx = SEGMENTED_TO_VIRTUAL(gEffSparklesDL);
this->update = func_809AAD6C;
this->rEnvColorA = initParams->scale;
this->rScale = 0;
} else {
this->gfx = SEGMENTED_TO_VIRTUAL(gEffFairySparklesDL);
this->gfx = SEGMENTED_TO_VIRTUAL(gEffSparklesDL);
if (initParams->updateMode == 0) {
this->update = func_809AABF0;