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

@ -32,7 +32,7 @@ void func_80AE3ECC(EnRd* this, GlobalContext* globalCtx);
const ActorInit En_Rd_InitVars = {
ACTOR_EN_RD,
ACTORTYPE_ENEMY,
ACTORCAT_ENEMY,
FLAGS,
OBJECT_RD,
sizeof(EnRd),
@ -98,7 +98,7 @@ static DamageTable sDamageTable = {
};
static InitChainEntry sInitChain[] = {
ICHAIN_F32(unk_4C, 2000, ICHAIN_CONTINUE),
ICHAIN_F32(targetArrowOffset, 2000, ICHAIN_CONTINUE),
ICHAIN_VEC3F_DIV1000(scale, 10, ICHAIN_CONTINUE),
ICHAIN_F32_DIV1000(gravity, -3500, ICHAIN_STOP),
};
@ -139,12 +139,12 @@ void EnRd_Init(Actor* thisx, GlobalContext* globalCtx) {
EnRd* this = THIS;
Actor_ProcessInitChain(thisx, sInitChain);
thisx->unk_1F = 0;
thisx->targetMode = 0;
thisx->colChkInfo.damageTable = &sDamageTable;
ActorShape_Init(&thisx->shape, 0.0f, NULL, 0.0f);
this->unk_310 = this->unk_30E = 0;
thisx->posRot2.pos = thisx->posRot.pos;
thisx->posRot2.pos.y += 50.0f;
thisx->focus.pos = thisx->world.pos;
thisx->focus.pos.y += 50.0f;
thisx->colChkInfo.mass = MASS_HEAVY;
thisx->colChkInfo.health = 8;
this->unk_314 = this->unk_31D = 0xFF;
@ -192,7 +192,7 @@ void EnRd_Destroy(Actor* thisx, GlobalContext* globalCtx) {
}
void func_80AE2630(GlobalContext* globalCtx, Actor* thisx, s32 arg2) {
Actor* enemyIt = globalCtx->actorCtx.actorList[ACTORTYPE_ENEMY].first;
Actor* enemyIt = globalCtx->actorCtx.actorLists[ACTORCAT_ENEMY].head;
while (enemyIt != NULL) {
if ((enemyIt->id != ACTOR_EN_RD) || (enemyIt == thisx) || (enemyIt->params < 0)) {
@ -219,7 +219,7 @@ void func_80AE269C(EnRd* this) {
this->unk_31B = 0;
this->unk_30C = (Rand_ZeroOne() * 10.0f) + 5.0f;
this->actor.speedXZ = 0.0f;
this->actor.posRot.rot.y = this->actor.shape.rot.y;
this->actor.world.rot.y = this->actor.shape.rot.y;
EnRd_SetupAction(this, func_80AE2744);
}
@ -260,7 +260,7 @@ void func_80AE2744(EnRd* this, GlobalContext* globalCtx) {
}
this->unk_305 = 0;
if ((this->actor.xzDistToLink <= 150.0f) && func_8002DDE4(globalCtx)) {
if ((this->actor.xzDistToPlayer <= 150.0f) && func_8002DDE4(globalCtx)) {
if ((this->actor.params != 2) && (this->unk_305 == 0)) {
func_80AE37BC(this);
} else {
@ -280,7 +280,7 @@ void func_80AE2970(EnRd* this) {
this->unk_30C = 6;
this->actor.shape.rot.x = -0x4000;
this->actor.gravity = 0.0f;
this->actor.shape.unk_08 = 0.0f;
this->actor.shape.yOffset = 0.0f;
this->actor.speedXZ = 0.0f;
EnRd_SetupAction(this, func_80AE2A10);
}
@ -289,16 +289,15 @@ void func_80AE2970(EnRd* this) {
void func_80AE2A10(EnRd* this, GlobalContext* globalCtx) {
if (this->actor.shape.rot.x != -0x4000) {
Math_SmoothStepToS(&this->actor.shape.rot.x, 0, 1, 0x7D0, 0);
if (Math_SmoothStepToF(&this->actor.posRot.pos.y, this->actor.initPosRot.pos.y, 0.3f, 2.0f, 0.3f) == 0.0f) {
if (Math_SmoothStepToF(&this->actor.world.pos.y, this->actor.home.pos.y, 0.3f, 2.0f, 0.3f) == 0.0f) {
this->actor.gravity = -3.5f;
func_80AE269C(this);
}
} else {
if (this->actor.posRot.pos.y == this->actor.initPosRot.pos.y) {
if (this->actor.world.pos.y == this->actor.home.pos.y) {
Audio_PlayActorSound2(&this->actor, NA_SE_EN_REDEAD_CRY);
}
if (Math_SmoothStepToF(&this->actor.posRot.pos.y, this->actor.initPosRot.pos.y + 50.0f, 0.3f, 2.0f, 0.3f) ==
0.0f) {
if (Math_SmoothStepToF(&this->actor.world.pos.y, this->actor.home.pos.y + 50.0f, 0.3f, 2.0f, 0.3f) == 0.0f) {
if (this->unk_30C != 0) {
this->unk_30C--;
Math_SmoothStepToF(&this->actor.speedXZ, 6.0f, 0.3f, 1.0f, 0.3f);
@ -323,27 +322,27 @@ void func_80AE2C1C(EnRd* this, GlobalContext* globalCtx) {
Color_RGBA8 sp3C = D_80AE4928;
Player* player = PLAYER;
s32 pad;
s16 sp32 = this->actor.yawTowardsLink - this->actor.shape.rot.y - this->unk_30E - this->unk_310;
s16 sp32 = this->actor.yawTowardsPlayer - this->actor.shape.rot.y - this->unk_30E - this->unk_310;
this->skelAnime.playSpeed = this->actor.speedXZ;
Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsLink, 1, 0xFA, 0);
Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 1, 0xFA, 0);
Math_SmoothStepToS(&this->unk_30E, 0, 1, 0x64, 0);
Math_SmoothStepToS(&this->unk_310, 0, 1, 0x64, 0);
this->actor.posRot.rot.y = this->actor.shape.rot.y;
this->actor.world.rot.y = this->actor.shape.rot.y;
SkelAnime_Update(&this->skelAnime);
if (func_8002DB6C(&player->actor, &this->actor.initPosRot.pos) >= 150.0f) {
if (Actor_WorldDistXYZToPoint(&player->actor, &this->actor.home.pos) >= 150.0f) {
func_80AE2F50(this, globalCtx);
}
if ((ABS(sp32) < 0x1554) && (func_8002DB48(&this->actor, &player->actor) <= 150.0f)) {
if ((ABS(sp32) < 0x1554) && (Actor_WorldDistXYZToActor(&this->actor, &player->actor) <= 150.0f)) {
if (!(player->stateFlags1 & 0x2C6080) && !(player->stateFlags2 & 0x80)) {
if (this->unk_306 == 0) {
if (!(this->unk_312 & 0x80)) {
player->actor.freezeTimer = 40;
func_8008EEAC(globalCtx, &this->actor);
PLAYER->unk_684 = &this->actor;
func_800AA000(this->actor.xzDistToLink, 0xFF, 0x14, 0x96);
func_800AA000(this->actor.xzDistToPlayer, 0xFF, 0x14, 0x96);
}
this->unk_306 = 0x3C;
Audio_PlayActorSound2(&this->actor, NA_SE_EN_REDEAD_AIM);
@ -355,7 +354,7 @@ void func_80AE2C1C(EnRd* this, GlobalContext* globalCtx) {
DECR(this->unk_307);
if ((this->unk_307 == 0) && (func_8002DB48(&this->actor, &player->actor) <= 45.0f) &&
if ((this->unk_307 == 0) && (Actor_WorldDistXYZToActor(&this->actor, &player->actor) <= 45.0f) &&
(func_8002E084(&this->actor, 0x38E3))) {
player->actor.freezeTimer = 0;
if (globalCtx->grabPlayer(globalCtx, player)) {
@ -387,13 +386,13 @@ void func_80AE2F50(EnRd* this, GlobalContext* globalCtx) {
void func_80AE2FD0(EnRd* this, GlobalContext* globalCtx) {
Player* player = PLAYER;
s32 pad;
s16 targetY = func_8002DAC0(&this->actor, &this->actor.initPosRot.pos);
s16 targetY = Actor_WorldYawTowardPoint(&this->actor, &this->actor.home.pos);
if (func_8002DB6C(&this->actor, &this->actor.initPosRot.pos) >= 5.0f) {
if (Actor_WorldDistXYZToPoint(&this->actor, &this->actor.home.pos) >= 5.0f) {
Math_SmoothStepToS(&this->actor.shape.rot.y, targetY, 1, 0x1C2, 0);
} else {
this->actor.speedXZ = 0.0f;
if (Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.initPosRot.rot.y, 1, 0x1C2, 0) == 0) {
if (Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.home.rot.y, 1, 0x1C2, 0) == 0) {
if (this->actor.params != 2) {
func_80AE269C(this);
} else {
@ -404,12 +403,12 @@ void func_80AE2FD0(EnRd* this, GlobalContext* globalCtx) {
Math_SmoothStepToS(&this->unk_30E, 0, 1, 0x64, 0);
Math_SmoothStepToS(&this->unk_310, 0, 1, 0x64, 0);
this->actor.posRot.rot.y = this->actor.shape.rot.y;
this->actor.world.rot.y = this->actor.shape.rot.y;
SkelAnime_Update(&this->skelAnime);
if (!(player->stateFlags1 & 0x2C6080) && !(player->stateFlags2 & 0x80) &&
(func_8002DB6C(&player->actor, &this->actor.initPosRot.pos) < 150.0f)) {
this->actor.unk_1F = 0;
(Actor_WorldDistXYZToPoint(&player->actor, &this->actor.home.pos) < 150.0f)) {
this->actor.targetMode = 0;
func_80AE2B90(this, globalCtx);
} else if (this->actor.params > 0) {
if (this->actor.parent != NULL) {
@ -438,13 +437,13 @@ void func_80AE3260(EnRd* this, GlobalContext* globalCtx) {
if (this->actor.parent != NULL) {
s32 pad;
s16 targetY;
Vec3f thisPos = this->actor.parent->posRot.pos;
Vec3f thisPos = this->actor.parent->world.pos;
targetY = func_8002DAC0(&this->actor, &thisPos);
targetY = Actor_WorldYawTowardPoint(&this->actor, &thisPos);
Math_SmoothStepToS(&this->actor.shape.rot.y, targetY, 1, 0xFA, 0);
if (func_8002DB6C(&this->actor, &thisPos) >= 45.0f) {
if (Actor_WorldDistXYZToPoint(&this->actor, &thisPos) >= 45.0f) {
this->actor.speedXZ = 0.4f;
} else {
this->actor.speedXZ = 0.0f;
@ -462,7 +461,7 @@ void func_80AE3260(EnRd* this, GlobalContext* globalCtx) {
func_80AE2B90(this, globalCtx);
}
this->actor.posRot.rot.y = this->actor.shape.rot.y;
this->actor.world.rot.y = this->actor.shape.rot.y;
SkelAnime_Update(&this->skelAnime);
if (this->skelAnime.curFrame == 10.0f || this->skelAnime.curFrame == 22.0f) {
@ -494,7 +493,7 @@ void func_80AE3454(EnRd* this, GlobalContext* globalCtx) {
Animation_PlayLoop(&this->skelAnime, &D_06004268);
this->unk_304++;
globalCtx->damagePlayer(globalCtx, -8);
func_800AA000(this->actor.xzDistToLink, 0xFF, 1, 0xC);
func_800AA000(this->actor.xzDistToPlayer, 0xFF, 1, 0xC);
this->unk_319 = 0x14;
case 0:
Math_SmoothStepToS(&this->unk_30E, 0, 1, 0x5DC, 0);
@ -509,16 +508,16 @@ void func_80AE3454(EnRd* this, GlobalContext* globalCtx) {
}
if (LINK_IS_CHILD) {
Math_SmoothStepToF(&this->actor.shape.unk_08, -1500.0f, 1.0f, 150.0f, 0.0f);
Math_SmoothStepToF(&this->actor.shape.yOffset, -1500.0f, 1.0f, 150.0f, 0.0f);
}
Math_SmoothStepToF(&this->actor.posRot.pos.x,
(Math_SinS(player->actor.shape.rot.y) * -25.0f) + player->actor.posRot.pos.x, 1.0f,
10.0f, 0.0f);
Math_SmoothStepToF(&this->actor.posRot.pos.y, player->actor.posRot.pos.y, 1.0f, 10.0f, 0.0f);
Math_SmoothStepToF(&this->actor.posRot.pos.z,
(Math_CosS(player->actor.shape.rot.y) * -25.0f) + player->actor.posRot.pos.z, 1.0f,
10.0f, 0.0f);
Math_SmoothStepToF(&this->actor.world.pos.x,
(Math_SinS(player->actor.shape.rot.y) * -25.0f) + player->actor.world.pos.x, 1.0f, 10.0f,
0.0f);
Math_SmoothStepToF(&this->actor.world.pos.y, player->actor.world.pos.y, 1.0f, 10.0f, 0.0f);
Math_SmoothStepToF(&this->actor.world.pos.z,
(Math_CosS(player->actor.shape.rot.y) * -25.0f) + player->actor.world.pos.z, 1.0f, 10.0f,
0.0f);
Math_SmoothStepToS(&this->actor.shape.rot.y, player->actor.shape.rot.y, 1, 0x1770, 0);
if (this->skelAnime.curFrame == 0.0f) {
@ -528,21 +527,21 @@ void func_80AE3454(EnRd* this, GlobalContext* globalCtx) {
if (this->unk_319 == 0) {
globalCtx->damagePlayer(globalCtx, -8);
func_800AA000(this->actor.xzDistToLink, 0xF0, 1, 0xC);
func_800AA000(this->actor.xzDistToPlayer, 0xF0, 1, 0xC);
this->unk_319 = 0x14;
func_8002F7DC(&player->actor, NA_SE_VO_LI_DAMAGE_S + player->ageProperties->unk_92);
}
break;
case 3:
if (LINK_IS_CHILD) {
Math_SmoothStepToF(&this->actor.shape.unk_08, 0, 1.0f, 400.0f, 0.0f);
Math_SmoothStepToF(&this->actor.shape.yOffset, 0, 1.0f, 400.0f, 0.0f);
}
break;
case 4:
if (LINK_IS_CHILD) {
Math_SmoothStepToF(&this->actor.shape.unk_08, 0, 1.0f, 400.0f, 0.0f);
Math_SmoothStepToF(&this->actor.shape.yOffset, 0, 1.0f, 400.0f, 0.0f);
}
this->actor.unk_1F = 0;
this->actor.targetMode = 0;
this->actor.flags |= 1;
this->unk_306 = 0xA;
this->unk_307 = 0xF;
@ -563,12 +562,12 @@ void func_80AE3834(EnRd* this, GlobalContext* globalCtx) {
Color_RGBA8 sp30 = D_80AE4938;
Color_RGBA8 sp2C = D_80AE493C;
Player* player = PLAYER;
s16 temp_v0 = this->actor.yawTowardsLink - this->actor.shape.rot.y - this->unk_30E - this->unk_310;
s16 temp_v0 = this->actor.yawTowardsPlayer - this->actor.shape.rot.y - this->unk_30E - this->unk_310;
if (ABS(temp_v0) < 0x2008) {
if (!(this->unk_312 & 0x80)) {
player->actor.freezeTimer = 60;
func_800AA000(this->actor.xzDistToLink, 0xFF, 0x14, 0x96);
func_800AA000(this->actor.xzDistToPlayer, 0xFF, 0x14, 0x96);
func_8008EEAC(globalCtx, &this->actor);
}
Audio_PlayActorSound2(&this->actor, NA_SE_EN_REDEAD_AIM);
@ -625,15 +624,15 @@ void func_80AE3B18(EnRd* this, GlobalContext* globalCtx) {
this->actor.speedXZ += 0.15f;
}
this->actor.posRot.rot.y = this->actor.yawTowardsLink;
this->actor.world.rot.y = this->actor.yawTowardsPlayer;
Math_SmoothStepToS(&this->unk_30E, 0, 1, 0x12C, 0);
Math_SmoothStepToS(&this->unk_310, 0, 1, 0x12C, 0);
if (SkelAnime_Update(&this->skelAnime)) {
this->actor.posRot.rot.y = this->actor.shape.rot.y;
this->actor.world.rot.y = this->actor.shape.rot.y;
if (this->actor.parent != NULL) {
func_80AE31DC(this);
} else if (func_8002DB6C(&player->actor, &this->actor.initPosRot.pos) >= 150.0f) {
} else if (Actor_WorldDistXYZToPoint(&player->actor, &this->actor.home.pos) >= 150.0f) {
func_80AE2F50(this, globalCtx);
} else {
func_80AE2B90(this, globalCtx);
@ -654,8 +653,8 @@ void func_80AE3C20(EnRd* this) {
}
void func_80AE3C98(EnRd* this, GlobalContext* globalCtx) {
if (this->actor.type != ACTORTYPE_PROP) {
Actor_ChangeType(globalCtx, &globalCtx->actorCtx, &this->actor, ACTORTYPE_PROP);
if (this->actor.category != ACTORCAT_PROP) {
Actor_ChangeCategory(globalCtx, &globalCtx->actorCtx, &this->actor, ACTORCAT_PROP);
}
Math_SmoothStepToS(&this->unk_30E, 0, 1, 0x7D0, 0);
@ -686,7 +685,7 @@ void func_80AE3C98(EnRd* this, GlobalContext* globalCtx) {
void func_80AE3DE4(EnRd* this) {
this->unk_31B = 1;
this->actor.speedXZ = 0.0f;
this->actor.posRot.rot.y = this->actor.shape.rot.y;
this->actor.world.rot.y = this->actor.shape.rot.y;
if (gSaveContext.unk_1422 != 0) {
this->unk_318 = 1;
this->unk_316 = 0x258;
@ -713,11 +712,11 @@ void func_80AE3ECC(EnRd* this, GlobalContext* globalCtx) {
}
}
if (this->actor.dmgEffectTimer == 0) {
if (this->actor.colorFilterTimer == 0) {
if (this->actor.colChkInfo.health == 0) {
func_80AE2630(globalCtx, &this->actor, 1);
func_80AE3C20(this);
Item_DropCollectibleRandom(globalCtx, &this->actor, &this->actor.posRot.pos, 0x90);
Item_DropCollectibleRandom(globalCtx, &this->actor, &this->actor.world.pos, 0x90);
} else {
func_80AE3A8C(this);
}
@ -729,13 +728,13 @@ void func_80AE3F9C(EnRd* this, GlobalContext* globalCtx) {
s16 temp2;
s16 temp3;
temp1 = this->actor.yawTowardsLink - (s16)(this->actor.shape.rot.y + this->unk_310);
temp1 = this->actor.yawTowardsPlayer - (s16)(this->actor.shape.rot.y + this->unk_310);
temp2 = CLAMP(temp1, -500, 500);
temp1 -= this->unk_30E;
temp3 = CLAMP(temp1, -500, 500);
if ((s16)(this->actor.yawTowardsLink - this->actor.shape.rot.y) >= 0) {
if ((s16)(this->actor.yawTowardsPlayer - this->actor.shape.rot.y) >= 0) {
this->unk_310 += ABS(temp2);
this->unk_30E += ABS(temp3);
} else {
@ -788,7 +787,7 @@ void func_80AE4114(EnRd* this, GlobalContext* globalCtx) {
if (this->actor.colChkInfo.health == 0) {
func_80AE2630(globalCtx, &this->actor, 1);
func_80AE3C20(this);
Item_DropCollectibleRandom(globalCtx, 0, &this->actor.posRot.pos, 0x90);
Item_DropCollectibleRandom(globalCtx, 0, &this->actor.world.pos, 0x90);
} else {
func_80AE3A8C(this);
}
@ -820,7 +819,7 @@ void EnRd_Update(Actor* thisx, GlobalContext* globalCtx) {
}
if ((this->actor.shape.rot.x == 0) && (this->unk_31B != 8) && (this->actor.speedXZ != 0.0f)) {
func_8002E4B4(globalCtx, &this->actor, 30.0f, 20.0f, 35.0f, 0x1D);
Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 30.0f, 20.0f, 35.0f, 0x1D);
}
if (this->unk_31B == 7) {
@ -828,8 +827,8 @@ void EnRd_Update(Actor* thisx, GlobalContext* globalCtx) {
}
}
this->actor.posRot2.pos = this->actor.posRot.pos;
this->actor.posRot2.pos.y += 50.0f;
this->actor.focus.pos = this->actor.world.pos;
this->actor.focus.pos.y += 50.0f;
if ((this->actor.colChkInfo.health > 0) && (this->unk_31B != 8)) {
Collider_UpdateCylinder(&this->actor, &this->collider);
@ -858,7 +857,7 @@ void EnRd_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec
s32 idx = -1;
Vec3f destPos;
if ((this->unk_31A != 0) || ((this->actor.dmgEffectTimer != 0) && (this->actor.dmgEffectParams & 0x4000))) {
if ((this->unk_31A != 0) || ((this->actor.colorFilterTimer != 0) && (this->actor.colorFilterParams & 0x4000))) {
switch (limbIndex - 1) {
case 23:
idx = 0;
@ -904,7 +903,7 @@ void EnRd_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec
void EnRd_Draw(Actor* thisx, GlobalContext* globalCtx) {
s32 pad;
EnRd* this = THIS;
Vec3f thisPos = thisx->posRot.pos;
Vec3f thisPos = thisx->world.pos;
OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_rd.c", 1679);
@ -917,7 +916,7 @@ void EnRd_Draw(Actor* thisx, GlobalContext* globalCtx) {
POLY_OPA_DISP);
func_80033C30(&thisPos, &D_80AE4958, 255, globalCtx);
if (this->unk_31A != 0) {
thisx->dmgEffectTimer++;
thisx->colorFilterTimer++;
this->unk_31A--;
if (this->unk_31A % 4 == 0) {
EffectSsEnFire_SpawnVec3s(globalCtx, thisx, &this->firePos[this->unk_31A >> 2], 0x4B, 0, 0,