summaryrefslogtreecommitdiff
path: root/soh/src/code
diff options
context:
space:
mode:
Diffstat (limited to 'soh/src/code')
-rw-r--r--soh/src/code/db_camera.c4
-rw-r--r--soh/src/code/z_bgcheck.c27
-rw-r--r--soh/src/code/z_camera.c4
-rw-r--r--soh/src/code/z_eff_blure.c98
-rw-r--r--soh/src/code/z_effect_soft_sprite.c21
-rw-r--r--soh/src/code/z_onepointdemo.c116
-rw-r--r--soh/src/code/z_player_lib.c45
7 files changed, 167 insertions, 148 deletions
diff --git a/soh/src/code/db_camera.c b/soh/src/code/db_camera.c
index 364721160..2cfe47003 100644
--- a/soh/src/code/db_camera.c
+++ b/soh/src/code/db_camera.c
@@ -2065,14 +2065,14 @@ s32 DbCamera_UpdateDemoControl(DbCamera* dbCamera, Camera* cam) {
sDbCamAnim.unk_04 = 0;
} else if (CHECK_BTN_ALL(sPlayState->state.input[2].press.button, BTN_CLEFT)) {
sDbCamAnim.unk_0A = 0;
- Interface_ChangeHudVisibilityMode(2);
+ Interface_ChangeHudVisibilityMode(HUD_VISIBILITY_NOTHING_ALT);
Letterbox_SetSizeTarget(0);
D_8016110C = 0;
return 2;
}
if (func_800B91B0(cam, dbCamera) == 0) {
- Interface_ChangeHudVisibilityMode(2);
+ Interface_ChangeHudVisibilityMode(HUD_VISIBILITY_NOTHING_ALT);
Letterbox_SetSizeTarget(0);
Audio_PlaySoundGeneral(NA_SE_SY_GET_RUPY, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale,
&gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb);
diff --git a/soh/src/code/z_bgcheck.c b/soh/src/code/z_bgcheck.c
index 7339ef9d6..536947a05 100644
--- a/soh/src/code/z_bgcheck.c
+++ b/soh/src/code/z_bgcheck.c
@@ -29,9 +29,16 @@
#define COLPOLY_IGNORE_ENTITY (1 << 1)
#define COLPOLY_IGNORE_PROJECTILES (1 << 2)
-// func_80041DB8, SurfaceType wall properties
-s32 D_80119D90[32] = {
- 0, 1, 3, 5, 8, 16, 32, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+// SurfaceType_GetWallFlags, SurfaceType wall types
+s32 D_80119D90[WALL_TYPE_MAX] = {
+ 0, // WALL_TYPE_0
+ WALL_FLAG_0, // WALL_TYPE_1
+ WALL_FLAG_0 | WALL_FLAG_LADDER, // WALL_TYPE_2
+ WALL_FLAG_0 | WALL_FLAG_LADDER_TOP, // WALL_TYPE_3
+ WALL_FLAG_CLIMBABLE, // WALL_TYPE_4
+ WALL_FLAG_CRAWLSPACE_1, // WALL_TYPE_5
+ WALL_FLAG_CRAWLSPACE_2, // WALL_TYPE_6
+ WALL_FLAG_GRABBABLE, // WALL_TYPE_7
};
// SurfaceType_GetSfx
@@ -4002,7 +4009,7 @@ u32 func_80041D70(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId) {
}
/**
- * SurfaceType Get Wall Property (Internal)
+ * SurfaceType Get Wall Type (Internal)
*/
u32 func_80041D94(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId) {
return SurfaceType_GetData(colCtx, poly, bgId, 0) >> 21 & 0x1F;
@@ -4011,9 +4018,9 @@ u32 func_80041D94(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId) {
/**
* SurfaceType Get Wall Flags
*/
-s32 func_80041DB8(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId) {
+s32 SurfaceType_GetWallFlags(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId) {
if (GameInteractor_Should(VB_SURFACE_IS_CLIMBABLE, false)) {
- return (1 << 3) | D_80119D90[func_80041D94(colCtx, poly, bgId)];
+ return WALL_FLAG_CLIMBABLE | D_80119D90[func_80041D94(colCtx, poly, bgId)];
} else {
return D_80119D90[func_80041D94(colCtx, poly, bgId)];
}
@@ -4023,21 +4030,21 @@ s32 func_80041DB8(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId) {
* SurfaceType Is Wall Flag (1 << 0) Set
*/
s32 func_80041DE4(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId) {
- return (func_80041DB8(colCtx, poly, bgId) & 1) ? true : false;
+ return (SurfaceType_GetWallFlags(colCtx, poly, bgId) & WALL_FLAG_0) ? true : false;
}
/**
* SurfaceType Is Wall Flag (1 << 1) Set
*/
s32 func_80041E18(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId) {
- return (func_80041DB8(colCtx, poly, bgId) & 2) ? true : false;
+ return (SurfaceType_GetWallFlags(colCtx, poly, bgId) & WALL_FLAG_LADDER) ? true : false;
}
/**
* SurfaceType Is Wall Flag (1 << 2) Set
*/
s32 func_80041E4C(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId) {
- return (func_80041DB8(colCtx, poly, bgId) & 4) ? true : false;
+ return (SurfaceType_GetWallFlags(colCtx, poly, bgId) & WALL_FLAG_LADDER_TOP) ? true : false;
}
/**
@@ -4085,7 +4092,7 @@ u16 SurfaceType_GetSfx(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId)
}
/**
- * SurfaceType get terrain slope surface
+ * SurfaceType get terrain slope surface or transition
*/
u32 SurfaceType_GetFloorEffect(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId) {
return SurfaceType_GetData(colCtx, poly, bgId, 1) >> 4 & 3;
diff --git a/soh/src/code/z_camera.c b/soh/src/code/z_camera.c
index e2886629e..663b4602d 100644
--- a/soh/src/code/z_camera.c
+++ b/soh/src/code/z_camera.c
@@ -7864,7 +7864,7 @@ s32 Camera_ChangeModeFlags(Camera* camera, s16 mode, u8 flags) {
break;
case CAM_MODE_TARGET:
case CAM_MODE_TALK:
- case CAM_MODE_BOWARROWZ:
+ case CAM_MODE_Z_AIM:
case CAM_MODE_HANGZ:
case CAM_MODE_PUSHPULL:
modeChangeFlags = 2;
@@ -7898,7 +7898,7 @@ s32 Camera_ChangeModeFlags(Camera* camera, s16 mode, u8 flags) {
}
modeChangeFlags |= 1;
break;
- case CAM_MODE_BOWARROWZ:
+ case CAM_MODE_Z_AIM:
case CAM_MODE_HANGZ:
case CAM_MODE_PUSHPULL:
modeChangeFlags |= 1;
diff --git a/soh/src/code/z_eff_blure.c b/soh/src/code/z_eff_blure.c
index f63f8a80c..28534cb6b 100644
--- a/soh/src/code/z_eff_blure.c
+++ b/soh/src/code/z_eff_blure.c
@@ -72,7 +72,7 @@ void EffectBlure_AddVertex(EffectBlure* this, Vec3f* p1, Vec3f* p2) {
}
}
-// dumb doo doo command to change the type of an object's blur on the fly. Link's Swords with unique trail colors.
+// SoH: dumb doo doo command to change the type of a weapon's blur on the fly. Link's Swords with unique trail colors.
void EffectBlure_ChangeType(EffectBlure* this, int type) {
this->trailType = type;
}
@@ -434,9 +434,9 @@ void EffectBlure_GetComputedValues(EffectBlure* this, s32 index, f32 ratio, Vec3
switch (this->calcMode) {
case 1:
- vec1->x = func_80027E34(elem->p1.x, elem->p2.x, ratio);
- vec1->y = func_80027E34(elem->p1.y, elem->p2.y, ratio);
- vec1->z = func_80027E34(elem->p1.z, elem->p2.z, ratio);
+ vec1->x = EffectSs_LerpS16(elem->p1.x, elem->p2.x, ratio);
+ vec1->y = EffectSs_LerpS16(elem->p1.y, elem->p2.y, ratio);
+ vec1->z = EffectSs_LerpS16(elem->p1.z, elem->p2.z, ratio);
vec2->x = elem->p2.x;
vec2->y = elem->p2.y;
vec2->z = elem->p2.z;
@@ -446,19 +446,19 @@ void EffectBlure_GetComputedValues(EffectBlure* this, s32 index, f32 ratio, Vec3
vec1->x = elem->p1.x;
vec1->y = elem->p1.y;
vec1->z = elem->p1.z;
- vec2->x = func_80027E34(elem->p2.x, elem->p1.x, ratio);
- vec2->y = func_80027E34(elem->p2.y, elem->p1.y, ratio);
- vec2->z = func_80027E34(elem->p2.z, elem->p1.z, ratio);
+ vec2->x = EffectSs_LerpS16(elem->p2.x, elem->p1.x, ratio);
+ vec2->y = EffectSs_LerpS16(elem->p2.y, elem->p1.y, ratio);
+ vec2->z = EffectSs_LerpS16(elem->p2.z, elem->p1.z, ratio);
break;
case 3:
ratio *= 0.5f;
- vec1->x = func_80027E34(elem->p1.x, elem->p2.x, ratio);
- vec1->y = func_80027E34(elem->p1.y, elem->p2.y, ratio);
- vec1->z = func_80027E34(elem->p1.z, elem->p2.z, ratio);
- vec2->x = func_80027E34(elem->p2.x, elem->p1.x, ratio);
- vec2->y = func_80027E34(elem->p2.y, elem->p1.y, ratio);
- vec2->z = func_80027E34(elem->p2.z, elem->p1.z, ratio);
+ vec1->x = EffectSs_LerpS16(elem->p1.x, elem->p2.x, ratio);
+ vec1->y = EffectSs_LerpS16(elem->p1.y, elem->p2.y, ratio);
+ vec1->z = EffectSs_LerpS16(elem->p1.z, elem->p2.z, ratio);
+ vec2->x = EffectSs_LerpS16(elem->p2.x, elem->p1.x, ratio);
+ vec2->y = EffectSs_LerpS16(elem->p2.y, elem->p1.y, ratio);
+ vec2->z = EffectSs_LerpS16(elem->p2.z, elem->p1.z, ratio);
ratio *= 2.0f;
break;
@@ -494,14 +494,14 @@ void EffectBlure_GetComputedValues(EffectBlure* this, s32 index, f32 ratio, Vec3
color1->r = color1->g = color1->b = color1->a = 255;
color2->r = color2->g = color2->b = color2->a = 255;
} else {
- color1->r = func_80027E84(this->p1StartColor.r, this->p1EndColor.r, ratio);
- color1->g = func_80027E84(this->p1StartColor.g, this->p1EndColor.g, ratio);
- color1->b = func_80027E84(this->p1StartColor.b, this->p1EndColor.b, ratio);
- color1->a = func_80027E84(this->p1StartColor.a, this->p1EndColor.a, ratio);
- color2->r = func_80027E84(this->p2StartColor.r, this->p2EndColor.r, ratio);
- color2->g = func_80027E84(this->p2StartColor.g, this->p2EndColor.g, ratio);
- color2->b = func_80027E84(this->p2StartColor.b, this->p2EndColor.b, ratio);
- color2->a = func_80027E84(this->p2StartColor.a, this->p2EndColor.a, ratio);
+ color1->r = EffectSs_LerpU8(this->p1StartColor.r, this->p1EndColor.r, ratio);
+ color1->g = EffectSs_LerpU8(this->p1StartColor.g, this->p1EndColor.g, ratio);
+ color1->b = EffectSs_LerpU8(this->p1StartColor.b, this->p1EndColor.b, ratio);
+ color1->a = EffectSs_LerpU8(this->p1StartColor.a, this->p1EndColor.a, ratio);
+ color2->r = EffectSs_LerpU8(this->p2StartColor.r, this->p2EndColor.r, ratio);
+ color2->g = EffectSs_LerpU8(this->p2StartColor.g, this->p2EndColor.g, ratio);
+ color2->b = EffectSs_LerpU8(this->p2StartColor.b, this->p2EndColor.b, ratio);
+ color2->a = EffectSs_LerpU8(this->p2StartColor.a, this->p2EndColor.a, ratio);
}
}
@@ -752,18 +752,18 @@ void EffectBlure_DrawElemHermiteInterpolation(EffectBlure* this, EffectBlureElem
vtx[j1].v.ob[0] = Math_FNearbyIntF(sp158.x);
vtx[j1].v.ob[1] = Math_FNearbyIntF(sp158.y);
vtx[j1].v.ob[2] = Math_FNearbyIntF(sp158.z);
- vtx[j1].v.cn[0] = func_80027E84(sp1A4.r, sp19C.r, temp_f28);
- vtx[j1].v.cn[1] = func_80027E84(sp1A4.g, sp19C.g, temp_f28);
- vtx[j1].v.cn[2] = func_80027E84(sp1A4.b, sp19C.b, temp_f28);
- vtx[j1].v.cn[3] = func_80027E84(sp1A4.a, sp19C.a, temp_f28);
+ vtx[j1].v.cn[0] = EffectSs_LerpU8(sp1A4.r, sp19C.r, temp_f28);
+ vtx[j1].v.cn[1] = EffectSs_LerpU8(sp1A4.g, sp19C.g, temp_f28);
+ vtx[j1].v.cn[2] = EffectSs_LerpU8(sp1A4.b, sp19C.b, temp_f28);
+ vtx[j1].v.cn[3] = EffectSs_LerpU8(sp1A4.a, sp19C.a, temp_f28);
vtx[j2].v.ob[0] = Math_FNearbyIntF(sp14C.x);
vtx[j2].v.ob[1] = Math_FNearbyIntF(sp14C.y);
vtx[j2].v.ob[2] = Math_FNearbyIntF(sp14C.z);
- vtx[j2].v.cn[0] = func_80027E84(sp1A0.r, sp198.r, temp_f28);
- vtx[j2].v.cn[1] = func_80027E84(sp1A0.g, sp198.g, temp_f28);
- vtx[j2].v.cn[2] = func_80027E84(sp1A0.b, sp198.b, temp_f28);
- vtx[j2].v.cn[3] = func_80027E84(sp1A0.a, sp198.a, temp_f28);
+ vtx[j2].v.cn[0] = EffectSs_LerpU8(sp1A0.r, sp198.r, temp_f28);
+ vtx[j2].v.cn[1] = EffectSs_LerpU8(sp1A0.g, sp198.g, temp_f28);
+ vtx[j2].v.cn[2] = EffectSs_LerpU8(sp1A0.b, sp198.b, temp_f28);
+ vtx[j2].v.cn[3] = EffectSs_LerpU8(sp1A0.a, sp198.a, temp_f28);
}
gSPVertex(POLY_XLU_DISP++, vtx, 16, 0);
@@ -1097,9 +1097,9 @@ void EffectBlure_Draw(void* thisx, GraphicsContext* gfxCtx) {
switch (this->calcMode) {
case 1:
- vtx[j].v.ob[0] = func_80027E34(elem->p1.x, elem->p2.x, ratio);
- vtx[j].v.ob[1] = func_80027E34(elem->p1.y, elem->p2.y, ratio);
- vtx[j].v.ob[2] = func_80027E34(elem->p1.z, elem->p2.z, ratio);
+ vtx[j].v.ob[0] = EffectSs_LerpS16(elem->p1.x, elem->p2.x, ratio);
+ vtx[j].v.ob[1] = EffectSs_LerpS16(elem->p1.y, elem->p2.y, ratio);
+ vtx[j].v.ob[2] = EffectSs_LerpS16(elem->p1.z, elem->p2.z, ratio);
vtx[j + 1].v.ob[0] = elem->p2.x;
vtx[j + 1].v.ob[1] = elem->p2.y;
vtx[j + 1].v.ob[2] = elem->p2.z;
@@ -1108,18 +1108,18 @@ void EffectBlure_Draw(void* thisx, GraphicsContext* gfxCtx) {
vtx[j].v.ob[0] = elem->p1.x;
vtx[j].v.ob[1] = elem->p1.y;
vtx[j].v.ob[2] = elem->p1.z;
- vtx[j + 1].v.ob[0] = func_80027E34(elem->p2.x, elem->p1.x, ratio);
- vtx[j + 1].v.ob[1] = func_80027E34(elem->p2.y, elem->p1.y, ratio);
- vtx[j + 1].v.ob[2] = func_80027E34(elem->p2.z, elem->p1.z, ratio);
+ vtx[j + 1].v.ob[0] = EffectSs_LerpS16(elem->p2.x, elem->p1.x, ratio);
+ vtx[j + 1].v.ob[1] = EffectSs_LerpS16(elem->p2.y, elem->p1.y, ratio);
+ vtx[j + 1].v.ob[2] = EffectSs_LerpS16(elem->p2.z, elem->p1.z, ratio);
break;
case 3:
ratio = ratio * 0.5f;
- vtx[j].v.ob[0] = func_80027E34(elem->p1.x, elem->p2.x, ratio);
- vtx[j].v.ob[1] = func_80027E34(elem->p1.y, elem->p2.y, ratio);
- vtx[j].v.ob[2] = func_80027E34(elem->p1.z, elem->p2.z, ratio);
- vtx[j + 1].v.ob[0] = func_80027E34(elem->p2.x, elem->p1.x, ratio);
- vtx[j + 1].v.ob[1] = func_80027E34(elem->p2.y, elem->p1.y, ratio);
- vtx[j + 1].v.ob[2] = func_80027E34(elem->p2.z, elem->p1.z, ratio);
+ vtx[j].v.ob[0] = EffectSs_LerpS16(elem->p1.x, elem->p2.x, ratio);
+ vtx[j].v.ob[1] = EffectSs_LerpS16(elem->p1.y, elem->p2.y, ratio);
+ vtx[j].v.ob[2] = EffectSs_LerpS16(elem->p1.z, elem->p2.z, ratio);
+ vtx[j + 1].v.ob[0] = EffectSs_LerpS16(elem->p2.x, elem->p1.x, ratio);
+ vtx[j + 1].v.ob[1] = EffectSs_LerpS16(elem->p2.y, elem->p1.y, ratio);
+ vtx[j + 1].v.ob[2] = EffectSs_LerpS16(elem->p2.z, elem->p1.z, ratio);
ratio = ratio + ratio;
break;
case 0:
@@ -1136,19 +1136,19 @@ void EffectBlure_Draw(void* thisx, GraphicsContext* gfxCtx) {
vtx[j].v.flag = 0;
vtx[j].v.tc[0] = 0;
vtx[j].v.tc[1] = 0;
- vtx[j].v.cn[0] = func_80027E84(this->p1StartColor.r, this->p1EndColor.r, ratio);
- vtx[j].v.cn[1] = func_80027E84(this->p1StartColor.g, this->p1EndColor.g, ratio);
- vtx[j].v.cn[2] = func_80027E84(this->p1StartColor.b, this->p1EndColor.b, ratio);
- vtx[j].v.cn[3] = func_80027E84(this->p1StartColor.a, this->p1EndColor.a, ratio);
+ vtx[j].v.cn[0] = EffectSs_LerpU8(this->p1StartColor.r, this->p1EndColor.r, ratio);
+ vtx[j].v.cn[1] = EffectSs_LerpU8(this->p1StartColor.g, this->p1EndColor.g, ratio);
+ vtx[j].v.cn[2] = EffectSs_LerpU8(this->p1StartColor.b, this->p1EndColor.b, ratio);
+ vtx[j].v.cn[3] = EffectSs_LerpU8(this->p1StartColor.a, this->p1EndColor.a, ratio);
j++;
vtx[j].v.flag = 0;
vtx[j].v.tc[0] = 0;
vtx[j].v.tc[1] = 0;
- vtx[j].v.cn[0] = func_80027E84(this->p2StartColor.r, this->p2EndColor.r, ratio);
- vtx[j].v.cn[1] = func_80027E84(this->p2StartColor.g, this->p2EndColor.g, ratio);
- vtx[j].v.cn[2] = func_80027E84(this->p2StartColor.b, this->p2EndColor.b, ratio);
- vtx[j].v.cn[3] = func_80027E84(this->p2StartColor.a, this->p2EndColor.a, ratio);
+ vtx[j].v.cn[0] = EffectSs_LerpU8(this->p2StartColor.r, this->p2EndColor.r, ratio);
+ vtx[j].v.cn[1] = EffectSs_LerpU8(this->p2StartColor.g, this->p2EndColor.g, ratio);
+ vtx[j].v.cn[2] = EffectSs_LerpU8(this->p2StartColor.b, this->p2EndColor.b, ratio);
+ vtx[j].v.cn[3] = EffectSs_LerpU8(this->p2StartColor.a, this->p2EndColor.a, ratio);
j++;
}
}
diff --git a/soh/src/code/z_effect_soft_sprite.c b/soh/src/code/z_effect_soft_sprite.c
index 06263304c..ee3882f8e 100644
--- a/soh/src/code/z_effect_soft_sprite.c
+++ b/soh/src/code/z_effect_soft_sprite.c
@@ -330,16 +330,25 @@ void EffectSs_DrawAll(PlayState* play) {
}
}
-s16 func_80027DD4(s16 arg0, s16 arg1, s32 arg2) {
- s16 ret = (arg2 == 0) ? arg1 : (arg0 + (s32)((arg1 - arg0) / (f32)arg2));
+/**
+ * Lerp from `a` (weightInv == inf) to `b` (weightInv == 1 or 0).
+ */
+s16 EffectSs_LerpInv(s16 a, s16 b, s32 weightInv) {
+ s16 ret = (weightInv == 0) ? b : (a + (s32)((b - a) / (f32)weightInv));
return ret;
}
-s16 func_80027E34(s16 arg0, s16 arg1, f32 arg2) {
- return (arg1 - arg0) * arg2 + arg0;
+/**
+ * Lerp from `a` (weight == 0) to `b` (weight == 1).
+ */
+s16 EffectSs_LerpS16(s16 a, s16 b, f32 weight) {
+ return (b - a) * weight + a;
}
-u8 func_80027E84(u8 arg0, u8 arg1, f32 arg2) {
- return arg2 * ((f32)arg1 - (f32)arg0) + arg0;
+/**
+ * Lerp from `a` (weight == 0) to `b` (weight == 1).
+ */
+u8 EffectSs_LerpU8(u8 a, u8 b, f32 weight) {
+ return weight * ((f32)b - (f32)a) + a;
}
diff --git a/soh/src/code/z_onepointdemo.c b/soh/src/code/z_onepointdemo.c
index 3b3f87fc8..c036f7652 100644
--- a/soh/src/code/z_onepointdemo.c
+++ b/soh/src/code/z_onepointdemo.c
@@ -1184,116 +1184,116 @@ s32 OnePointCutscene_RemoveCamera(PlayState* play, s16 camIdx) {
return nextCamIdx;
}
-#define vChildCamIdx temp2
-#define vCsStatus temp1
-#define vCurCamIdx temp2
-#define vNextCamIdx temp1
+#define vChildCamId temp2
+#define vSubCamStatus temp1
+#define vCurCamId temp2
+#define vNextCamId temp1
/**
* Creates a cutscene subcamera with the specified ID, duration, and targeted actor. The camera is placed into the
* cutscene queue in front of the specified camera, then all lower priority demos in front of it are removed from the
* queue.
*/
-s16 OnePointCutscene_Init(PlayState* play, s16 csId, s16 timer, Actor* actor, s16 parentCamIdx) {
+s16 OnePointCutscene_Init(PlayState* play, s16 csId, s16 timer, Actor* actor, s16 parentCamId) {
+ Camera* subCam;
+ s16 subCamId;
s16 temp1;
s16 temp2;
- s16 csCamIdx;
- Camera* csCam;
if (actor != NULL && actor->id != ACTOR_PLAYER) {
if (!GameInteractor_Should(VB_PLAY_ONEPOINT_ACTOR_CS, true, actor)) {
- return SUBCAM_NONE;
+ return CAM_ID_NONE;
}
} else {
if (!GameInteractor_Should(VB_PLAY_ONEPOINT_CS, true, &csId)) {
- return SUBCAM_NONE;
+ return CAM_ID_NONE;
}
}
- if (parentCamIdx == SUBCAM_ACTIVE) {
- parentCamIdx = play->activeCamera;
+ if (parentCamId == CAM_ID_NONE) {
+ parentCamId = play->activeCamera;
}
- csCamIdx = Play_CreateSubCamera(play);
- if (csCamIdx == SUBCAM_NONE) {
+ subCamId = Play_CreateSubCamera(play);
+ if (subCamId == CAM_ID_NONE) {
osSyncPrintf(VT_COL(RED, WHITE) "onepoint demo: error: too many cameras ... give up! type=%d\n" VT_RST, csId);
- return SUBCAM_NONE;
+ return CAM_ID_NONE;
}
// Inserts the cutscene camera into the cutscene queue in front of parentCam
- vChildCamIdx = play->cameraPtrs[parentCamIdx]->childCamIdx;
- vCsStatus = CAM_STAT_ACTIVE;
- if (vChildCamIdx >= CAM_ID_SUB_FIRST) {
- OnePointCutscene_SetAsChild(play, vChildCamIdx, csCamIdx);
- vCsStatus = CAM_STAT_WAIT;
+ vChildCamId = play->cameraPtrs[parentCamId]->childCamIdx;
+ vSubCamStatus = CAM_STAT_ACTIVE;
+ if (vChildCamId >= CAM_ID_SUB_FIRST) {
+ OnePointCutscene_SetAsChild(play, vChildCamId, subCamId);
+ vSubCamStatus = CAM_STAT_WAIT;
} else {
- Interface_ChangeHudVisibilityMode(2);
+ Interface_ChangeHudVisibilityMode(HUD_VISIBILITY_NOTHING_ALT);
}
- OnePointCutscene_SetAsChild(play, csCamIdx, parentCamIdx);
+ OnePointCutscene_SetAsChild(play, subCamId, parentCamId);
- csCam = play->cameraPtrs[csCamIdx];
+ subCam = play->cameraPtrs[subCamId];
- csCam->timer = timer;
- csCam->target = actor;
+ subCam->timer = timer;
+ subCam->target = actor;
- csCam->at = play->view.lookAt;
- csCam->eye = play->view.eye;
- csCam->fov = play->view.fovy;
+ subCam->at = play->view.lookAt;
+ subCam->eye = play->view.eye;
+ subCam->fov = play->view.fovy;
- csCam->csId = csId;
+ subCam->csId = csId;
- if (parentCamIdx == CAM_ID_MAIN) {
- Play_ChangeCameraStatus(play, parentCamIdx, CAM_STAT_UNK3);
+ if (parentCamId == CAM_ID_MAIN) {
+ Play_ChangeCameraStatus(play, parentCamId, CAM_STAT_UNK3);
} else {
- Play_ChangeCameraStatus(play, parentCamIdx, CAM_STAT_WAIT);
+ Play_ChangeCameraStatus(play, parentCamId, CAM_STAT_WAIT);
}
- OnePointCutscene_SetInfo(play, csCamIdx, csId, actor, timer);
- Play_ChangeCameraStatus(play, csCamIdx, vCsStatus);
+ OnePointCutscene_SetInfo(play, subCamId, csId, actor, timer);
+ Play_ChangeCameraStatus(play, subCamId, vSubCamStatus);
// Removes all lower priority cutscenes in front of this cutscene from the queue.
- vCurCamIdx = csCamIdx;
- vNextCamIdx = play->cameraPtrs[csCamIdx]->childCamIdx;
+ vCurCamId = subCamId;
+ vNextCamId = play->cameraPtrs[subCamId]->childCamIdx;
- while (vNextCamIdx >= CAM_ID_SUB_FIRST) {
- s16 nextCsId = play->cameraPtrs[vNextCamIdx]->csId;
- s16 thisCsId = play->cameraPtrs[csCamIdx]->csId;
+ while (vNextCamId >= CAM_ID_SUB_FIRST) {
+ s16 nextCsId = play->cameraPtrs[vNextCamId]->csId;
+ s16 thisCsId = play->cameraPtrs[subCamId]->csId;
if ((nextCsId / 100) < (thisCsId / 100)) {
osSyncPrintf(VT_COL(YELLOW, BLACK) "onepointdemo camera[%d]: killed 'coz low priority (%d < %d)\n" VT_RST,
- vNextCamIdx, nextCsId, thisCsId);
- if (play->cameraPtrs[vNextCamIdx]->csId != 5010) {
- if ((vNextCamIdx = OnePointCutscene_RemoveCamera(play, vNextCamIdx)) != SUBCAM_NONE) {
- Play_ChangeCameraStatus(play, vNextCamIdx, CAM_STAT_ACTIVE);
+ vNextCamId, nextCsId, thisCsId);
+ if (play->cameraPtrs[vNextCamId]->csId != 5010) {
+ if ((vNextCamId = OnePointCutscene_RemoveCamera(play, vNextCamId)) != CAM_ID_NONE) {
+ Play_ChangeCameraStatus(play, vNextCamId, CAM_STAT_ACTIVE);
}
} else {
- vCurCamIdx = vNextCamIdx;
- OnePointCutscene_EndCutscene(play, vNextCamIdx);
+ vCurCamId = vNextCamId;
+ OnePointCutscene_EndCutscene(play, vNextCamId);
}
} else {
- vCurCamIdx = vNextCamIdx;
+ vCurCamId = vNextCamId;
}
- vNextCamIdx = play->cameraPtrs[vCurCamIdx]->childCamIdx;
+ vNextCamId = play->cameraPtrs[vCurCamId]->childCamIdx;
}
- return csCamIdx;
+ return subCamId;
}
/**
- * Ends the cutscene in camIdx by setting its timer to 0. For attention cutscenes, it is set to 5 instead.
+ * Ends the cutscene in subCamId by setting its timer to 0. For attention cutscenes, it is set to 5 instead.
*/
-s16 OnePointCutscene_EndCutscene(PlayState* play, s16 camIdx) {
- if (camIdx == SUBCAM_ACTIVE) {
- camIdx = play->activeCamera;
+s16 OnePointCutscene_EndCutscene(PlayState* play, s16 subCamId) {
+ if (subCamId == CAM_ID_NONE) {
+ subCamId = play->activeCamera;
}
- if (play->cameraPtrs[camIdx] != NULL) {
- osSyncPrintf("onepointdemo camera[%d]: delete timer=%d next=%d\n", camIdx, play->cameraPtrs[camIdx]->timer,
- play->cameraPtrs[camIdx]->parentCamIdx);
- if (play->cameraPtrs[camIdx]->csId == 5010) {
- play->cameraPtrs[camIdx]->timer = 5;
+ if (play->cameraPtrs[subCamId] != NULL) {
+ osSyncPrintf("onepointdemo camera[%d]: delete timer=%d next=%d\n", subCamId, play->cameraPtrs[subCamId]->timer,
+ play->cameraPtrs[subCamId]->parentCamIdx);
+ if (play->cameraPtrs[subCamId]->csId == 5010) {
+ play->cameraPtrs[subCamId]->timer = 5;
} else {
- play->cameraPtrs[camIdx]->timer = 0;
+ play->cameraPtrs[subCamId]->timer = 0;
}
}
- return camIdx;
+ return subCamId;
}
#define vTargetCat temp1
diff --git a/soh/src/code/z_player_lib.c b/soh/src/code/z_player_lib.c
index 36fec39b9..fe2f783f0 100644
--- a/soh/src/code/z_player_lib.c
+++ b/soh/src/code/z_player_lib.c
@@ -495,7 +495,7 @@ void Player_SetBootData(PlayState* play, Player* this) {
}
}
-// Custom method used to determine if we're using a custom model for link
+// SoH: Custom method used to determine if we're using a custom model for link
uint8_t Player_IsCustomLinkModel() {
return (LINK_IS_ADULT && ResourceGetIsCustomByName(gLinkAdultSkel)) ||
(LINK_IS_CHILD && ResourceGetIsCustomByName(gLinkChildSkel));
@@ -529,8 +529,8 @@ s32 Player_IsChildWithHylianShield(Player* this) {
return gSaveContext.linkAge != 0 && (this->currentShield == PLAYER_SHIELD_HYLIAN);
}
-s32 Player_ActionToModelGroup(Player* this, s32 actionParam) {
- s32 modelGroup = sActionModelGroups[actionParam];
+s32 Player_ActionToModelGroup(Player* this, s32 itemAction) {
+ s32 modelGroup = sActionModelGroups[itemAction];
if ((modelGroup == PLAYER_MODELGROUP_SWORD_AND_SHIELD) && Player_IsChildWithHylianShield(this)) {
// child, using kokiri sword with hylian shield equipped
@@ -686,16 +686,16 @@ void Player_SetEquipmentData(PlayState* play, Player* this) {
}
}
-void Player_UpdateBottleHeld(PlayState* play, Player* this, s32 item, s32 actionParam) {
+void Player_UpdateBottleHeld(PlayState* play, Player* this, s32 item, s32 itemAction) {
Inventory_UpdateBottleItem(play, item, this->heldItemButton);
if (item != ITEM_BOTTLE) {
this->heldItemId = item;
- this->heldItemAction = actionParam;
+ this->heldItemAction = itemAction;
}
if (GameInteractor_Should(VB_PLAYER_UPDATE_BOTTLE_HELD, true, this)) {
- this->itemAction = actionParam;
+ this->itemAction = itemAction;
}
}
@@ -817,8 +817,8 @@ s32 Player_HasMirrorShieldSetToDraw(PlayState* play) {
return (this->rightHandType == PLAYER_MODELTYPE_RH_SHIELD) && (this->currentShield == PLAYER_SHIELD_MIRROR);
}
-s32 Player_ActionToMagicSpell(Player* this, s32 actionParam) {
- s32 magicSpell = actionParam - PLAYER_IA_MAGIC_SPELL_15;
+s32 Player_ActionToMagicSpell(Player* this, s32 itemAction) {
+ s32 magicSpell = itemAction - PLAYER_IA_MAGIC_SPELL_15;
if ((magicSpell >= 0) && (magicSpell < 6)) {
return magicSpell;
@@ -831,6 +831,7 @@ s32 Player_HoldsHookshot(Player* this) {
return (this->heldItemAction == PLAYER_IA_HOOKSHOT) || (this->heldItemAction == PLAYER_IA_LONGSHOT);
}
+// SoH
s32 Player_HoldsBow(Player* this) {
switch (this->heldItemAction) {
case PLAYER_IA_BOW:
@@ -843,6 +844,7 @@ s32 Player_HoldsBow(Player* this) {
}
}
+// SoH
s32 Player_HoldsSlingshot(Player* this) {
return this->heldItemAction == PLAYER_IA_SLINGSHOT;
}
@@ -851,8 +853,8 @@ s32 func_8008F128(Player* this) {
return Player_HoldsHookshot(this) && (this->heldActor == NULL);
}
-s32 Player_ActionToMeleeWeapon(s32 actionParam) {
- s32 sword = actionParam - PLAYER_IA_FISHING_POLE;
+s32 Player_ActionToMeleeWeapon(s32 itemAction) {
+ s32 sword = itemAction - PLAYER_IA_FISHING_POLE;
if ((sword > 0) && (sword < 6)) {
return sword;
@@ -867,9 +869,9 @@ s32 Player_GetMeleeWeaponHeld(Player* this) {
s32 Player_HoldsTwoHandedWeapon(Player* this) {
if ((this->heldItemAction >= PLAYER_IA_SWORD_BIGGORON) && (this->heldItemAction <= PLAYER_IA_HAMMER)) {
- return 1;
+ return true;
} else {
- return 0;
+ return false;
}
}
@@ -877,8 +879,8 @@ s32 Player_HoldsBrokenKnife(Player* this) {
return (this->heldItemAction == PLAYER_IA_SWORD_BIGGORON) && (gSaveContext.swordHealth <= 0.0f);
}
-s32 Player_ActionToBottle(Player* this, s32 actionParam) {
- s32 bottle = actionParam - PLAYER_IA_BOTTLE;
+s32 Player_ActionToBottle(Player* this, s32 itemAction) {
+ s32 bottle = itemAction - PLAYER_IA_BOTTLE;
if ((bottle >= 0) && (bottle < 13)) {
return bottle;
@@ -891,8 +893,8 @@ s32 Player_GetBottleHeld(Player* this) {
return Player_ActionToBottle(this, this->heldItemAction);
}
-s32 Player_ActionToExplosive(Player* this, s32 actionParam) {
- s32 explosive = actionParam - PLAYER_IA_BOMB;
+s32 Player_ActionToExplosive(Player* this, s32 itemAction) {
+ s32 explosive = itemAction - PLAYER_IA_BOMB;
if ((explosive >= 0) && (explosive < 2)) {
return explosive;
@@ -905,11 +907,11 @@ s32 Player_GetExplosiveHeld(Player* this) {
return Player_ActionToExplosive(this, this->heldItemAction);
}
-s32 func_8008F2BC(Player* this, s32 actionParam) {
+s32 func_8008F2BC(Player* this, s32 itemAction) {
s32 sword = 0;
- if (actionParam != PLAYER_IA_SWORD_CS) {
- sword = actionParam - PLAYER_IA_SWORD_MASTER;
+ if (itemAction != PLAYER_IA_SWORD_CS) {
+ sword = itemAction - PLAYER_IA_SWORD_MASTER;
if ((sword < 0) || (sword >= 3)) {
goto return_neg;
}
@@ -1731,7 +1733,8 @@ void Player_DrawHookshotReticle(PlayState* play, Player* this, f32 hookshotRange
}
}
-Vec3f D_801260D4 = { 1100.0f, -700.0f, 0.0f };
+// Coordinates of the player focus position, in the head limb's own model space.
+Vec3f sPlayerFocusOffsetFromHead = { 1100.0f, -700.0f, 0.0f };
f32 sMeleeWeaponLengths[] = {
0.0f, 4000.0f, 3000.0f, 5500.0f, 0.0f, 2500.0f,
@@ -1981,7 +1984,7 @@ void Player_PostLimbDrawGameplay(PlayState* play, s32 limbIndex, Gfx** dList, Ve
Matrix_Get(&this->shieldMf);
}
} else if (limbIndex == PLAYER_LIMB_HEAD) {
- Matrix_MultVec3f(&D_801260D4, &this->actor.focus.pos);
+ Matrix_MultVec3f(&sPlayerFocusOffsetFromHead, &this->actor.focus.pos);
} else {
Vec3f* vec = &sLeftRightFootLimbModelFootPos[(gSaveContext.linkAge)];