1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2025-08-07 14:50:15 +00:00

Actor Struct Changes (and a few related things) (#617)

* reformat header

* type -> category

* done for now i think

* some more stuff

* first -> head

* focus

* flag comment

* ground -> floor

* remove asm, name wrapper funcs

* name func, format

* review

* targetPriority, format

* git subrepo pull --force tools/ZAPD

subrepo:
  subdir:   "tools/ZAPD"
  merged:   "0305ec2c2"
upstream:
  origin:   "https://github.com/zeldaret/ZAPD.git"
  branch:   "master"
  commit:   "0305ec2c2"
git-subrepo:
  version:  "0.4.3"
  origin:   "https://github.com/ingydotnet/git-subrepo.git"
  commit:   "2f68596"

* comment

* review

* feet flags

* horse shadow
This commit is contained in:
fig02 2021-01-18 16:04:04 -05:00 committed by GitHub
parent 20206fba0d
commit 00a5edea71
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
697 changed files with 8157 additions and 7942 deletions

View file

@ -24,7 +24,7 @@ static Vec3f sZeroVecAccel = { 0.0f, 0.0f, 0.0f };
const ActorInit En_Crow_InitVars = {
ACTOR_EN_CROW,
ACTORTYPE_ENEMY,
ACTORCAT_ENEMY,
FLAGS,
OBJECT_CROW,
sizeof(EnCrow),
@ -104,7 +104,7 @@ static InitChainEntry sInitChain[] = {
ICHAIN_F32(uncullZoneScale, 3000, ICHAIN_CONTINUE),
ICHAIN_S8(naviEnemyId, 88, ICHAIN_CONTINUE),
ICHAIN_F32_DIV1000(gravity, -200, ICHAIN_CONTINUE),
ICHAIN_F32(unk_4C, 2000, ICHAIN_STOP),
ICHAIN_F32(targetArrowOffset, 2000, ICHAIN_STOP),
};
static Vec3f sHeadVec = { 2500.0f, 0.0f, 0.0f };
@ -118,7 +118,7 @@ void EnCrow_Init(Actor* thisx, GlobalContext* globalCtx) {
Collider_SetJntSph(globalCtx, &this->collider, &this->actor, &sJntSphInit, this->colliderItems);
this->collider.elements[0].dim.worldSphere.radius = sJntSphInit.elements[0].dim.modelSphere.radius;
CollisionCheck_SetInfo(&this->actor.colChkInfo, &sDamageTable, &sColChkInfoInit);
ActorShape_Init(&this->actor.shape, 2000.0f, ActorShadow_DrawFunc_Circle, 20.0f);
ActorShape_Init(&this->actor.shape, 2000.0f, ActorShadow_DrawCircle, 20.0f);
sDeathCount = 0;
EnCrow_SetupWait(this);
}
@ -148,22 +148,22 @@ void func_809E03B4(EnCrow* this, GlobalContext* globalCtx) {
f32 scale;
Vec3f iceParticlePos;
this->actor.speedXZ *= Math_CosS(this->actor.posRot.rot.x);
this->actor.speedXZ *= Math_CosS(this->actor.world.rot.x);
this->actor.velocity.y = 0.0f;
Animation_Change(&this->skelAnime, &D_060000F0, 0.4f, 0.0f, 0.0f, ANIMMODE_LOOP_INTERP, -3.0f);
scale = this->actor.scale.x * 100.0f;
this->actor.posRot.pos.y += 20.0f * scale;
this->actor.world.pos.y += 20.0f * scale;
this->actor.bgCheckFlags &= ~1;
this->actor.shape.unk_08 = 0.0f;
this->actor.unk_4C = 0.0f;
this->actor.shape.yOffset = 0.0f;
this->actor.targetArrowOffset = 0.0f;
Audio_PlayActorSound2(&this->actor, NA_SE_EN_KAICHO_DEAD);
if (this->actor.colChkInfo.damageEffect == 3) {
func_8003426C(&this->actor, 0, 255, 0, 40);
for (i = 0; i < 8; i++) {
iceParticlePos.x = ((i & 1 ? 7.0f : -7.0f) * scale) + this->actor.posRot.pos.x;
iceParticlePos.y = ((i & 2 ? 7.0f : -7.0f) * scale) + this->actor.posRot.pos.y;
iceParticlePos.z = ((i & 4 ? 7.0f : -7.0f) * scale) + this->actor.posRot.pos.z;
iceParticlePos.x = ((i & 1 ? 7.0f : -7.0f) * scale) + this->actor.world.pos.x;
iceParticlePos.y = ((i & 2 ? 7.0f : -7.0f) * scale) + this->actor.world.pos.y;
iceParticlePos.z = ((i & 4 ? 7.0f : -7.0f) * scale) + this->actor.world.pos.z;
EffectSsEnIce_SpawnFlyingVec3f(globalCtx, &this->actor, &iceParticlePos, 150, 150, 150, 250, 235, 245, 255,
((Rand_ZeroOne() * 0.15f) + 0.85f) * scale);
}
@ -171,7 +171,7 @@ void func_809E03B4(EnCrow* this, GlobalContext* globalCtx) {
func_8003426C(&this->actor, 0x4000, 255, 0, 40);
for (i = 0; i < 4; i++) {
EffectSsEnFire_SpawnVec3f(globalCtx, &this->actor, &this->actor.posRot.pos, 50.0f * scale, 0, 0, i);
EffectSsEnFire_SpawnVec3f(globalCtx, &this->actor, &this->actor.world.pos, 50.0f * scale, 0, 0, i);
}
} else {
func_8003426C(&this->actor, 0x4000, 255, 0, 40);
@ -188,7 +188,7 @@ void func_809E03B4(EnCrow* this, GlobalContext* globalCtx) {
}
void EnCrow_SetupDie(EnCrow* this) {
this->actor.dmgEffectTimer = 0;
this->actor.colorFilterTimer = 0;
this->actionFunc = EnCrow_Die;
}
@ -196,7 +196,7 @@ void func_809E06E8(EnCrow* this) {
this->timer = 100;
this->actor.speedXZ = 3.5f;
this->aimRotX = -0x1000;
this->aimRotY = this->actor.yawTowardsLink + 0x8000;
this->aimRotY = this->actor.yawTowardsPlayer + 0x8000;
this->skelAnime.playSpeed = 2.0f;
func_8003426C(&this->actor, 0, 255, 0, 5);
Audio_PlayActorSound2(&this->actor, NA_SE_EN_GOMA_JR_FREEZE);
@ -215,12 +215,12 @@ void func_809E0770(EnCrow* this) {
}
Animation_PlayLoop(&this->skelAnime, &D_060000F0);
Math_Vec3f_Copy(&this->actor.posRot.pos, &this->actor.initPosRot.pos);
Math_Vec3f_Copy(&this->actor.world.pos, &this->actor.home.pos);
this->actor.shape.rot.x = 0;
this->actor.shape.rot.z = 0;
this->timer = 300;
this->actor.shape.unk_08 = 2000;
this->actor.unk_4C = 2000.0f;
this->actor.shape.yOffset = 2000;
this->actor.targetArrowOffset = 2000.0f;
this->actor.draw = NULL;
this->actionFunc = func_809E10A8;
}
@ -235,14 +235,14 @@ void EnCrow_Wait(EnCrow* this, GlobalContext* globalCtx) {
this->actor.speedXZ = (Rand_ZeroOne() * 1.5f) + 3.0f;
if (this->actor.bgCheckFlags & 8) {
this->aimRotY = this->actor.wallPolyRot;
} else if (func_8002DBB0(&this->actor, &this->actor.initPosRot.pos) > 300.0f) {
this->aimRotY = func_8002DAC0(&this->actor, &this->actor.initPosRot.pos);
this->aimRotY = this->actor.wallYaw;
} else if (Actor_WorldDistXZToPoint(&this->actor, &this->actor.home.pos) > 300.0f) {
this->aimRotY = Actor_WorldYawTowardPoint(&this->actor, &this->actor.home.pos);
}
if ((Math_SmoothStepToS(&this->actor.shape.rot.y, this->aimRotY, 5, 0x300, 0x10) == 0) && skelanimeUpdated &&
(Rand_ZeroOne() < 0.1f)) {
var = func_8002DAC0(&this->actor, &this->actor.initPosRot.pos) - this->actor.shape.rot.y;
var = Actor_WorldYawTowardPoint(&this->actor, &this->actor.home.pos) - this->actor.shape.rot.y;
if (var > 0) {
this->aimRotY += 0x1000 + (0x1000 * Rand_ZeroOne());
} else {
@ -253,15 +253,15 @@ void EnCrow_Wait(EnCrow* this, GlobalContext* globalCtx) {
if (this->actor.yDistToWater > -40.0f) {
this->aimRotX = -0x1000;
} else if (this->actor.posRot.pos.y < (this->actor.initPosRot.pos.y - 50.0f)) {
} else if (this->actor.world.pos.y < (this->actor.home.pos.y - 50.0f)) {
this->aimRotX = -0x800 - (Rand_ZeroOne() * 0x800);
} else if (this->actor.posRot.pos.y > (this->actor.initPosRot.pos.y + 50.0f)) {
} else if (this->actor.world.pos.y > (this->actor.home.pos.y + 50.0f)) {
this->aimRotX = 0x800 + (Rand_ZeroOne() * 0x800);
}
if ((Math_SmoothStepToS(&this->actor.shape.rot.x, this->aimRotX, 10, 0x100, 8) == 0) && (skelanimeUpdated) &&
(Rand_ZeroOne() < 0.1f)) {
if (this->actor.initPosRot.pos.y < this->actor.posRot.pos.y) {
if (this->actor.home.pos.y < this->actor.world.pos.y) {
this->aimRotX -= (0x400 * Rand_ZeroOne()) + 0x400;
} else {
this->aimRotX += (0x400 * Rand_ZeroOne()) + 0x400;
@ -276,7 +276,7 @@ void EnCrow_Wait(EnCrow* this, GlobalContext* globalCtx) {
if (this->timer != 0) {
this->timer--;
}
if ((this->timer == 0) && (this->actor.xzDistToLink < 300.0f) && !(player->stateFlags1 & 0x00800000) &&
if ((this->timer == 0) && (this->actor.xzDistToPlayer < 300.0f) && !(player->stateFlags1 & 0x00800000) &&
(this->actor.yDistToWater < -40.0f) && (Player_GetMask(globalCtx) != PLAYER_MASK_SKULL)) {
func_809E0384(this);
}
@ -296,10 +296,10 @@ void func_809E0C8C(EnCrow* this, GlobalContext* globalCtx) {
yaw = func_8002E084(&this->actor, 0x2800);
if (yaw != 0) {
pos.x = player->actor.posRot.pos.x;
pos.y = player->actor.posRot.pos.y + 20.0f;
pos.z = player->actor.posRot.pos.z;
target = func_8002DB28(&this->actor, &pos);
pos.x = player->actor.world.pos.x;
pos.y = player->actor.world.pos.y + 20.0f;
pos.z = player->actor.world.pos.z;
target = Actor_WorldPitchTowardPoint(&this->actor, &pos);
if (target > 0x3000) {
target = 0x3000;
}
@ -308,8 +308,8 @@ void func_809E0C8C(EnCrow* this, GlobalContext* globalCtx) {
Math_ApproachS(&this->actor.shape.rot.x, -0x1000, 2, 0x100);
}
if ((yaw != 0) || (this->actor.xzDistToLink > 80.0f)) {
Math_ApproachS(&this->actor.shape.rot.y, this->actor.yawTowardsLink, 4, 0xC00);
if ((yaw != 0) || (this->actor.xzDistToPlayer > 80.0f)) {
Math_ApproachS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 4, 0xC00);
}
if ((this->timer == 0) || (Player_GetMask(globalCtx) == PLAYER_MASK_SKULL) ||
@ -326,15 +326,15 @@ void func_809E0C8C(EnCrow* this, GlobalContext* globalCtx) {
void func_809E0E2C(EnCrow* this, GlobalContext* globalCtx) {
Math_StepToF(&this->actor.speedXZ, 0.0f, 0.5f);
this->actor.dmgEffectTimer = 40;
this->actor.colorFilterTimer = 40;
if (!(this->actor.flags & 0x8000)) {
if (this->actor.dmgEffectParams & 0x4000) {
if (this->actor.colorFilterParams & 0x4000) {
Math_ScaledStepToS(&this->actor.shape.rot.x, 0x4000, 0x200);
this->actor.shape.rot.z += 0x1780;
}
if ((this->actor.bgCheckFlags & 1) || (this->actor.groundY == BGCHECK_Y_MIN)) {
EffectSsDeadDb_Spawn(globalCtx, &this->actor.posRot, &sZeroVecAccel, &sZeroVecAccel,
if ((this->actor.bgCheckFlags & 1) || (this->actor.floorHeight == BGCHECK_Y_MIN)) {
EffectSsDeadDb_Spawn(globalCtx, &this->actor.world, &sZeroVecAccel, &sZeroVecAccel,
this->actor.scale.x * 10000.0f, 0, 255, 255, 255, 255, 255, 0, 0, 1, 9, 1);
EnCrow_SetupDie(this);
}
@ -353,9 +353,9 @@ void EnCrow_Die(EnCrow* this, GlobalContext* globalCtx) {
if (Math_StepToF(&this->actor.scale.x, 0.0f, step)) {
if (this->actor.params == 0) {
sDeathCount++;
Item_DropCollectibleRandom(globalCtx, &this->actor, &this->actor.posRot.pos, 0);
Item_DropCollectibleRandom(globalCtx, &this->actor, &this->actor.world.pos, 0);
} else {
Item_DropCollectible(globalCtx, &this->actor.posRot.pos, ITEM00_RUPEE_RED);
Item_DropCollectible(globalCtx, &this->actor.world.pos, ITEM00_RUPEE_RED);
}
func_809E0770(this);
}
@ -367,9 +367,9 @@ void func_809E1004(EnCrow* this, GlobalContext* globalCtx) {
SkelAnime_Update(&this->skelAnime);
if (this->actor.bgCheckFlags & 8) {
this->aimRotY = this->actor.wallPolyRot;
this->aimRotY = this->actor.wallYaw;
} else {
this->aimRotY = this->actor.yawTowardsLink + 0x8000;
this->aimRotY = this->actor.yawTowardsPlayer + 0x8000;
}
Math_ApproachS(&this->actor.shape.rot.y, this->aimRotY, 3, 0xC00);
@ -434,8 +434,8 @@ void EnCrow_Update(Actor* thisx, GlobalContext* globalCtx) {
func_809E1174(this, globalCtx);
this->actionFunc(this, globalCtx);
scale = this->actor.scale.x * 100.0f;
this->actor.posRot.rot.y = this->actor.shape.rot.y;
this->actor.posRot.rot.x = -this->actor.shape.rot.x;
this->actor.world.rot.y = this->actor.shape.rot.y;
this->actor.world.rot.x = -this->actor.shape.rot.x;
if (this->actionFunc != func_809E10A8) {
if (this->actor.colChkInfo.health != 0) {
@ -445,14 +445,14 @@ void EnCrow_Update(Actor* thisx, GlobalContext* globalCtx) {
height = 0.0f;
Actor_MoveForward(&this->actor);
}
func_8002E4B4(globalCtx, &this->actor, 12.0f * scale, 25.0f * scale, 50.0f * scale, 7);
Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 12.0f * scale, 25.0f * scale, 50.0f * scale, 7);
} else {
height = 0.0f;
}
this->collider.elements[0].dim.worldSphere.center.x = this->actor.posRot.pos.x;
this->collider.elements[0].dim.worldSphere.center.y = this->actor.posRot.pos.y + height;
this->collider.elements[0].dim.worldSphere.center.z = this->actor.posRot.pos.z;
this->collider.elements[0].dim.worldSphere.center.x = this->actor.world.pos.x;
this->collider.elements[0].dim.worldSphere.center.y = this->actor.world.pos.y + height;
this->collider.elements[0].dim.worldSphere.center.z = this->actor.world.pos.z;
if (this->actionFunc == func_809E0C8C) {
CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->collider.base);
@ -466,7 +466,7 @@ void EnCrow_Update(Actor* thisx, GlobalContext* globalCtx) {
CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base);
}
Actor_SetHeight(&this->actor, height);
Actor_SetFocus(&this->actor, height);
if (this->actor.colChkInfo.health != 0 && Animation_OnFrame(&this->skelAnime, 3.0f)) {
Audio_PlayActorSound2(&this->actor, NA_SE_EN_KAICHO_FLUTTER);