1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2025-08-06 06:10:21 +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

@ -41,7 +41,7 @@ s16 D_80A9C1DC = 0;
const ActorInit En_Kusa_InitVars = {
ACTOR_EN_KUSA,
ACTORTYPE_PROP,
ACTORCAT_PROP,
FLAGS,
OBJECT_GAMEPLAY_KEEP,
sizeof(EnKusa),
@ -106,15 +106,15 @@ s32 EnKusa_SnapToFloor(EnKusa* this, GlobalContext* globalCtx, f32 yOffset) {
s32 bgId;
f32 floorY;
pos.x = this->actor.posRot.pos.x;
pos.y = this->actor.posRot.pos.y + 30.0f;
pos.z = this->actor.posRot.pos.z;
pos.x = this->actor.world.pos.x;
pos.y = this->actor.world.pos.y + 30.0f;
pos.z = this->actor.world.pos.z;
floorY = BgCheck_EntityRaycastFloor4(&globalCtx->colCtx, &poly, &bgId, &this->actor, &pos);
if (floorY > BGCHECK_Y_MIN) {
this->actor.posRot.pos.y = floorY + yOffset;
Math_Vec3f_Copy(&this->actor.initPosRot.pos, &this->actor.posRot.pos);
this->actor.world.pos.y = floorY + yOffset;
Math_Vec3f_Copy(&this->actor.home.pos, &this->actor.world.pos);
return true;
} else {
osSyncPrintf(VT_COL(YELLOW, BLACK));
@ -136,13 +136,13 @@ void EnKusa_DropCollectible(EnKusa* this, GlobalContext* globalCtx) {
if (dropParams >= 0xD) {
dropParams = 0;
}
Item_DropCollectibleRandom(globalCtx, NULL, &this->actor.posRot.pos, dropParams << 4);
Item_DropCollectibleRandom(globalCtx, NULL, &this->actor.world.pos, dropParams << 4);
break;
case 1:
if (Rand_ZeroOne() < 0.5f) {
Item_DropCollectible(globalCtx, &this->actor.posRot.pos, ITEM00_SEEDS);
Item_DropCollectible(globalCtx, &this->actor.world.pos, ITEM00_SEEDS);
} else {
Item_DropCollectible(globalCtx, &this->actor.posRot.pos, ITEM00_HEART);
Item_DropCollectible(globalCtx, &this->actor.world.pos, ITEM00_HEART);
}
break;
}
@ -180,9 +180,9 @@ void EnKusa_SpawnFragments(EnKusa* this, GlobalContext* globalCtx) {
for (i = 0; i < ARRAY_COUNT(D_80A9C23C); i++) {
scale = &D_80A9C23C[i];
pos.x = this->actor.posRot.pos.x + (scale->x * this->actor.scale.x * 20.0f);
pos.y = this->actor.posRot.pos.y + (scale->y * this->actor.scale.y * 20.0f) + 10.0f;
pos.z = this->actor.posRot.pos.z + (scale->z * this->actor.scale.z * 20.0f);
pos.x = this->actor.world.pos.x + (scale->x * this->actor.scale.x * 20.0f);
pos.y = this->actor.world.pos.y + (scale->y * this->actor.scale.y * 20.0f) + 10.0f;
pos.z = this->actor.world.pos.z + (scale->z * this->actor.scale.z * 20.0f);
velocity.x = (Rand_ZeroOne() - 0.5f) * 8.0f;
velocity.y = Rand_ZeroOne() * 10.0f;
@ -193,9 +193,9 @@ void EnKusa_SpawnFragments(EnKusa* this, GlobalContext* globalCtx) {
EffectSsKakera_Spawn(globalCtx, &pos, &velocity, &pos, -100, 64, 40, 3, 0, D_80A9C26C[index], 0, 0, 80,
KAKERA_COLOR_NONE, OBJECT_GAMEPLAY_KEEP, D_040355E0);
pos.x = this->actor.posRot.pos.x + (scale->x * this->actor.scale.x * 40.0f);
pos.y = this->actor.posRot.pos.y + (scale->y * this->actor.scale.y * 40.0f) + 10.0f;
pos.z = this->actor.posRot.pos.z + (scale->z * this->actor.scale.z * 40.0f);
pos.x = this->actor.world.pos.x + (scale->x * this->actor.scale.x * 40.0f);
pos.y = this->actor.world.pos.y + (scale->y * this->actor.scale.y * 40.0f) + 10.0f;
pos.z = this->actor.world.pos.z + (scale->z * this->actor.scale.z * 40.0f);
velocity.x = (Rand_ZeroOne() - 0.5f) * 6.0f;
velocity.y = Rand_ZeroOne() * 10.0f;
@ -212,8 +212,8 @@ void EnKusa_SpawnBugs(EnKusa* this, GlobalContext* globalCtx) {
s32 i;
for (i = 0; i < 3; i++) {
Actor* bug = Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_INSECT, this->actor.posRot.pos.x,
this->actor.posRot.pos.y, this->actor.posRot.pos.z, 0, Rand_ZeroOne() * 0xFFFF, 0, 1);
Actor* bug = Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_INSECT, this->actor.world.pos.x,
this->actor.world.pos.y, this->actor.world.pos.z, 0, Rand_ZeroOne() * 0xFFFF, 0, 1);
if (bug == NULL) {
break;
@ -244,8 +244,8 @@ void EnKusa_Init(Actor* thisx, GlobalContext* globalCtx) {
if (this->actor.shape.rot.y == 0) {
s16 rand = Rand_ZeroFloat(0x10000);
this->actor.posRot.rot.y = rand;
this->actor.initPosRot.rot.y = rand;
this->actor.world.rot.y = rand;
this->actor.home.rot.y = rand;
this->actor.shape.rot.y = rand;
}
@ -301,12 +301,12 @@ void func_80A9B8D8(EnKusa* this, GlobalContext* globalCtx) {
if (Actor_HasParent(&this->actor, globalCtx)) {
EnKusa_SetupLiftedUp(this);
Audio_PlaySoundAtPosition(globalCtx, &this->actor.posRot.pos, 20, NA_SE_PL_PULL_UP_PLANT);
Audio_PlaySoundAtPosition(globalCtx, &this->actor.world.pos, 20, NA_SE_PL_PULL_UP_PLANT);
} else if (this->collider.base.acFlags & AC_HIT) {
this->collider.base.acFlags &= ~AC_HIT;
EnKusa_SpawnFragments(this, globalCtx);
EnKusa_DropCollectible(this, globalCtx);
Audio_PlaySoundAtPosition(globalCtx, &this->actor.posRot.pos, 20, NA_SE_EV_PLANT_BROKEN);
Audio_PlaySoundAtPosition(globalCtx, &this->actor.world.pos, 20, NA_SE_EV_PLANT_BROKEN);
if ((this->actor.params >> 4) & 1) {
EnKusa_SpawnBugs(this, globalCtx);
@ -320,17 +320,17 @@ void func_80A9B8D8(EnKusa* this, GlobalContext* globalCtx) {
func_80A9BEAC(this);
this->actor.flags |= 0x800;
} else {
if (!(this->collider.base.ocFlags1 & OC1_TYPE_PLAYER) && (this->actor.xzDistToLink > 12.0f)) {
if (!(this->collider.base.ocFlags1 & OC1_TYPE_PLAYER) && (this->actor.xzDistToPlayer > 12.0f)) {
this->collider.base.ocFlags1 |= OC1_TYPE_PLAYER;
}
if (this->actor.xzDistToLink < 600.0f) {
if (this->actor.xzDistToPlayer < 600.0f) {
Collider_UpdateCylinder(&this->actor, &this->collider);
CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base);
if (this->actor.xzDistToLink < 400.0f) {
if (this->actor.xzDistToPlayer < 400.0f) {
CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base);
if (this->actor.xzDistToLink < 100.0f) {
if (this->actor.xzDistToPlayer < 100.0f) {
func_8002F580(&this->actor, globalCtx);
}
}
@ -348,14 +348,14 @@ void EnKusa_LiftedUp(EnKusa* this, GlobalContext* globalCtx) {
if (Actor_HasNoParent(&this->actor, globalCtx)) {
this->actor.room = globalCtx->roomCtx.curRoom.num;
func_80A9BBB0(this);
this->actor.velocity.x = this->actor.speedXZ * Math_SinS(this->actor.posRot.rot.y);
this->actor.velocity.z = this->actor.speedXZ * Math_CosS(this->actor.posRot.rot.y);
this->actor.velocity.x = this->actor.speedXZ * Math_SinS(this->actor.world.rot.y);
this->actor.velocity.z = this->actor.speedXZ * Math_CosS(this->actor.world.rot.y);
this->actor.colChkInfo.mass = 240;
this->actor.gravity = -0.1f;
EnKusa_Fall(this);
func_80A9B174(&this->actor.velocity, 0.005f);
func_8002D7EC(&this->actor);
func_8002E4B4(globalCtx, &this->actor, 7.5f, 35.0f, 0.0f, 0xC5);
Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 7.5f, 35.0f, 0.0f, 0xC5);
this->actor.gravity = -3.2f;
}
}
@ -374,7 +374,7 @@ void func_80A9BC1C(EnKusa* this, GlobalContext* globalCtx) {
if (this->actor.bgCheckFlags & 11) {
if (!(this->actor.bgCheckFlags & 32)) {
Audio_PlaySoundAtPosition(globalCtx, &this->actor.posRot.pos, 20, NA_SE_EV_PLANT_BROKEN);
Audio_PlaySoundAtPosition(globalCtx, &this->actor.world.pos, 20, NA_SE_EV_PLANT_BROKEN);
}
EnKusa_SpawnFragments(this, globalCtx);
EnKusa_DropCollectible(this, globalCtx);
@ -390,9 +390,9 @@ void func_80A9BC1C(EnKusa* this, GlobalContext* globalCtx) {
}
} else {
if (this->actor.bgCheckFlags & 0x40) {
contactPos.x = this->actor.posRot.pos.x;
contactPos.y = this->actor.posRot.pos.y + this->actor.yDistToWater;
contactPos.z = this->actor.posRot.pos.z;
contactPos.x = this->actor.world.pos.x;
contactPos.y = this->actor.world.pos.y + this->actor.yDistToWater;
contactPos.z = this->actor.world.pos.z;
EffectSsGSplash_Spawn(globalCtx, &contactPos, NULL, NULL, 0, 400);
EffectSsGRipple_Spawn(globalCtx, &contactPos, 150, 650, 0);
EffectSsGRipple_Spawn(globalCtx, &contactPos, 400, 800, 4);
@ -403,7 +403,7 @@ void func_80A9BC1C(EnKusa* this, GlobalContext* globalCtx) {
D_80A9C1DC >>= 1;
D_80A9C1D8 >>= 1;
this->actor.bgCheckFlags &= ~0x40;
Audio_PlaySoundAtPosition(globalCtx, &this->actor.posRot.pos, 40, NA_SE_EV_DIVE_INTO_WATER_L);
Audio_PlaySoundAtPosition(globalCtx, &this->actor.world.pos, 40, NA_SE_EV_DIVE_INTO_WATER_L);
}
EnKusa_Fall(this);
Math_StepToS(&D_80A9C1D4, D_80A9C1D0, 0x1F4);
@ -412,7 +412,7 @@ void func_80A9BC1C(EnKusa* this, GlobalContext* globalCtx) {
this->actor.shape.rot.y += D_80A9C1DC;
func_80A9B174(&this->actor.velocity, 0.05f);
func_8002D7EC(&this->actor);
func_8002E4B4(globalCtx, &this->actor, 7.5f, 35.0f, 0.0f, 0xC5);
Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 7.5f, 35.0f, 0.0f, 0xC5);
Collider_UpdateCylinder(&this->actor, &this->collider);
CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base);
}
@ -439,17 +439,17 @@ void func_80A9BF30(EnKusa* this, GlobalContext* globalCtx) {
}
void func_80A9BF3C(EnKusa* this) {
this->actor.posRot.pos.x = this->actor.initPosRot.pos.x;
this->actor.posRot.pos.y = this->actor.initPosRot.pos.y - 9.0f;
this->actor.posRot.pos.z = this->actor.initPosRot.pos.z;
this->actor.world.pos.x = this->actor.home.pos.x;
this->actor.world.pos.y = this->actor.home.pos.y - 9.0f;
this->actor.world.pos.z = this->actor.home.pos.z;
EnKusa_SetScale(this);
this->actor.shape.rot = this->actor.initPosRot.rot;
this->actor.shape.rot = this->actor.home.rot;
EnKusa_SetupAction(this, func_80A9BFA8);
}
void func_80A9BFA8(EnKusa* this, GlobalContext* globalCtx) {
if (this->timer > 120) {
if ((Math_StepToF(&this->actor.posRot.pos.y, this->actor.initPosRot.pos.y, 0.6f)) && (this->timer >= 170)) {
if ((Math_StepToF(&this->actor.world.pos.y, this->actor.home.pos.y, 0.6f)) && (this->timer >= 170)) {
func_80A9C00C(this);
}
}
@ -458,7 +458,7 @@ void func_80A9BFA8(EnKusa* this, GlobalContext* globalCtx) {
void func_80A9C00C(EnKusa* this) {
EnKusa_SetupAction(this, func_80A9C068);
EnKusa_SetScale(this);
this->actor.shape.rot = this->actor.initPosRot.rot;
this->actor.shape.rot = this->actor.home.rot;
this->actor.flags &= ~0x800;
}
@ -484,9 +484,9 @@ void EnKusa_Update(Actor* thisx, GlobalContext* globalCtx) {
this->actionFunc(this, globalCtx);
if (this->actor.flags & 0x800) {
this->actor.shape.unk_08 = -6.25f;
this->actor.shape.yOffset = -6.25f;
} else {
this->actor.shape.unk_08 = 0.0f;
this->actor.shape.yOffset = 0.0f;
}
}