summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfig02 <fig02srl@gmail.com>2020-03-20 20:42:57 -0400
committerfig02 <fig02srl@gmail.com>2020-03-20 20:42:57 -0400
commitdff17518ef99789195b130378ec90dc4600a73d2 (patch)
treef5cfff0094e854a51631ab04251a74b6a816e4de
parentea075560c876961f042e1be9c2abd7acca828774 (diff)
pr review changes
-rw-r--r--include/z64.h2
-rw-r--r--src/code/z_common_data.c2
-rw-r--r--src/overlays/actors/ovl_En_Dog/z_en_dog.c49
-rw-r--r--src/overlays/actors/ovl_En_Dog/z_en_dog.h12
4 files changed, 31 insertions, 34 deletions
diff --git a/include/z64.h b/include/z64.h
index 59d81d58f..964402a1e 100644
--- a/include/z64.h
+++ b/include/z64.h
@@ -209,7 +209,7 @@ typedef struct
/* 0x1418 */ u8 fade_duration;
/* 0x1419 */ u8 unk_1419; // transition related
/* 0x141A */ u16 environment_time;
- /* 0x141C */ u8 richardIsLost;
+ /* 0x141C */ u8 dogIsLost;
/* 0x141D */ u8 transition_type;
/* 0x141E */ char unk_141E[0x0002];
/* 0x1420 */ s16 world_map_area;
diff --git a/src/code/z_common_data.c b/src/code/z_common_data.c
index 23197ea6c..0625a2b54 100644
--- a/src/code/z_common_data.c
+++ b/src/code/z_common_data.c
@@ -14,7 +14,7 @@ void SaveContext_Init(void)
gSaveContext.chamber_cutscene_num = 0;
gSaveContext.next_day_time = 0xFFFF;
gSaveContext.environment_time = 0;
- gSaveContext.richardIsLost = 1;
+ gSaveContext.dogIsLost = 1;
gSaveContext.transition_type = 0xFF;
gSaveContext.unk_13EE = 50;
}
diff --git a/src/overlays/actors/ovl_En_Dog/z_en_dog.c b/src/overlays/actors/ovl_En_Dog/z_en_dog.c
index 8705647ee..fd57ac46a 100644
--- a/src/overlays/actors/ovl_En_Dog/z_en_dog.c
+++ b/src/overlays/actors/ovl_En_Dog/z_en_dog.c
@@ -105,7 +105,7 @@ extern UNK_PTR D_06001368;
extern UNK_PTR D_06000D78;
extern UNK_PTR D_06000278;
-static void EnDog_WalkSFX(EnDog* this)
+static void EnDog_PlayWalkSFX(EnDog* this)
{
u32* walk = &D_06001368;
if (this->skelAnime.animCurrent == walk)
@@ -117,7 +117,7 @@ static void EnDog_WalkSFX(EnDog* this)
}
}
-static void EnDog_RunSFX(EnDog* this)
+static void EnDog_PlayRunSFX(EnDog* this)
{
u32* run = &D_06000D78;
if (this->skelAnime.animCurrent == run)
@@ -129,7 +129,7 @@ static void EnDog_RunSFX(EnDog* this)
}
}
-static void EnDog_BarkSFX(EnDog* this)
+static void EnDog_PlayBarkSFX(EnDog* this)
{
u32* bark = &D_06000278;
if (this->skelAnime.animCurrent == bark)
@@ -141,7 +141,7 @@ static void EnDog_BarkSFX(EnDog* this)
}
}
-static s32 EnDog_PlayAnimSFX(EnDog* this)
+static s32 EnDog_PlayAnimAndSFX(EnDog* this)
{
s32 animation;
@@ -195,13 +195,13 @@ static s32 EnDog_PlayAnimSFX(EnDog* this)
}
break;
case DOG_WALK:
- EnDog_WalkSFX(this);
+ EnDog_PlayWalkSFX(this);
break;
case DOG_RUN:
- EnDog_RunSFX(this);
+ EnDog_PlayRunSFX(this);
break;
case DOG_BARK:
- EnDog_BarkSFX(this);
+ EnDog_PlayBarkSFX(this);
if (this){} // needed for regalloc
break;
}
@@ -210,9 +210,9 @@ static s32 EnDog_PlayAnimSFX(EnDog* this)
static s8 EnDog_CanFollow(EnDog* this, GlobalContext* globalCtx)
{
- if ((this->collider.base.collideFlags & 2) != 0)
+ if ((this->collider.base.collideFlags & 2))
{
- this->collider.base.collideFlags &= 0xFFFD;
+ this->collider.base.collideFlags &= ~2;
return 2;
}
@@ -221,9 +221,9 @@ static s8 EnDog_CanFollow(EnDog* this, GlobalContext* globalCtx)
return 0;
}
- if ((this->collider.base.maskB & 1) != 0)
+ if ((this->collider.base.maskB & 1))
{
- this->collider.base.maskB &= 0xFFFE;
+ this->collider.base.maskB &= ~1;
if (gSaveContext.dogParams != 0)
{
return 0;
@@ -255,7 +255,7 @@ static EnDog_UpdateWaypoint(EnDog* this, GlobalContext* globalCtx)
this->waypoint += change;
- if (this->reverse != 0)
+ if (this->reverse)
{
if (this->waypoint < 0)
{
@@ -326,16 +326,15 @@ static void EnDog_Init(EnDog* this, GlobalContext* globalCtx)
switch (globalCtx->sceneNum)
{
case SCENE_MARKET_NIGHT:
- if ((gSaveContext.richardIsLost == 0) && (((this->actor.params & 0x0F00) >> 8) == 1))
+ if ((gSaveContext.dogIsLost == 0) && (((this->actor.params & 0x0F00) >> 8) == 1))
{
Actor_Kill(&this->actor);
}
break;
- // Richard's Home
- case SCENE_IMPA:
+ case SCENE_IMPA: // Richard's Home
if ((u32)(this->actor.params & 0x8000) == 0)
{
- if (gSaveContext.richardIsLost == 0)
+ if (gSaveContext.dogIsLost == 0)
{
this->nextBehavior = DOG_SIT;
this->actionFunc = EnDog_Wait;
@@ -349,8 +348,6 @@ static void EnDog_Init(EnDog* this, GlobalContext* globalCtx)
}
}
break;
-
- default: break;
}
if ((u32)(this->actor.params & 0x8000) != 0)
@@ -373,7 +370,7 @@ static void EnDog_Destroy(EnDog* this, GlobalContext* globalCtx)
static void EnDog_FollowPath(EnDog* this, GlobalContext* globalCtx)
{
- s16ArrEntry behaviors[] = { 3, 5, 2 };
+ s16ArrEntry behaviors[] = { DOG_SIT, DOG_BOW, DOG_BARK };
s16ArrEntry unused[] = { 40, 80, 20 };
f32 speed;
s32 frame;
@@ -383,7 +380,7 @@ static void EnDog_FollowPath(EnDog* this, GlobalContext* globalCtx)
this->actionFunc = EnDog_FollowLink;
}
- if(DECR(this->behaviorTimer))
+ if (DECR(this->behaviorTimer) != 0)
{
if (this->nextBehavior == DOG_WALK)
{
@@ -427,7 +424,7 @@ static void EnDog_ChooseMovement(EnDog* this, GlobalContext* globalCtx)
this->actionFunc = EnDog_FollowLink;
}
- if(DECR(this->behaviorTimer) == 0)
+ if (DECR(this->behaviorTimer) == 0)
{
this->behaviorTimer = Math_Rand_S16Offset(200, 100);
if (globalCtx->state.frames % 2)
@@ -441,7 +438,7 @@ static void EnDog_ChooseMovement(EnDog* this, GlobalContext* globalCtx)
if (this->nextBehavior == DOG_RUN)
{
- this->behaviorTimer = (this->behaviorTimer / 2);
+ this->behaviorTimer /= 2;
}
this->actionFunc = EnDog_FollowPath;
}
@@ -533,7 +530,7 @@ static void EnDog_FaceLink(EnDog* this, GlobalContext* globalCtx)
absAngleDiff = fabsf(absAngleDiff);
if (absAngleDiff < 200.0f)
{
- this->nextBehavior = 3;
+ this->nextBehavior = DOG_SIT;
this->actionFunc = EnDog_Wait;
this->actor.speedXZ = 0.0f;
}
@@ -563,10 +560,10 @@ static void EnDog_Update(EnDog* this, GlobalContext* globalCtx)
s32 pad1;
s32 pad2;
- EnDog_PlayAnimSFX(this);
+ EnDog_PlayAnimAndSFX(this);
SkelAnime_FrameUpdateMatrix(&this->skelAnime);
- func_8002E4B4(globalCtx, &this->actor, (f32)this->collider.dim.radius,
- (f32)this->collider.dim.height * 0.5f, 0.0f, 5);
+ func_8002E4B4(globalCtx, &this->actor, this->collider.dim.radius,
+ this->collider.dim.height * 0.5f, 0.0f, 5);
Actor_MoveForward(&this->actor);
this->actionFunc(this, globalCtx);
ActorCollider_Cylinder_Update(&this->actor, &this->collider);
diff --git a/src/overlays/actors/ovl_En_Dog/z_en_dog.h b/src/overlays/actors/ovl_En_Dog/z_en_dog.h
index 64cac152c..56010c68a 100644
--- a/src/overlays/actors/ovl_En_Dog/z_en_dog.h
+++ b/src/overlays/actors/ovl_En_Dog/z_en_dog.h
@@ -14,15 +14,15 @@ typedef struct
/* 0x01E4 */ u8 reverse;
/* 0x01E6 */ s16 waypoint;
/* 0x01E8 */ s16 unusedAngle;
- /* 0x01EA */ char unk_1EA[0x2];
+ /* 0x01EA */ s16 pad1;
/* 0x01EC */ s16 behaviorTimer;
- /* 0x01EE */ char unk_1EE[0x2];
+ /* 0x01EE */ s16 pad2;
/* 0x01F0 */ s16 nextBehavior;
/* 0x01F2 */ s16 behavior;
- /* 0x01F4 */ u8 unk_1F4; //gets passed to skelanime thing
- /* 0x01F5 */ char unk_1F5[0x4D]; //something allocated by skelanime
- /* 0x0242 */ u8 unk_242; //very likley a variable from some skelanime struct
- /* 0x0243 */ char unk_243[0x4D]; //something allocated by skelanime
+ /* 0x01F4 */ u8 unk_1F4; // I believe this and the rest below belong to something skelanime
+ /* 0x01F5 */ char unk_1F5[0x4D];
+ /* 0x0242 */ u8 unk_242;
+ /* 0x0243 */ char unk_243[0x4D];
} EnDog; // size = 0x0290
extern const ActorInit En_Dog_InitVars;