Decomp, naming (OnePointCS, itemAction, blure, wall/floor types) (#7007)

This commit is contained in:
djevangelia
2026-07-31 18:56:30 +02:00
committed by GitHub
parent 988b536651
commit 5a57a0cbc3
22 changed files with 348 additions and 256 deletions
+13 -13
View File
@@ -224,9 +224,9 @@ void EffectSs_Insert(PlayState* play, EffectSs* effectSs);
void EffectSs_Spawn(PlayState* play, s32 type, s32 priority, void* initParams);
void EffectSs_UpdateAll(PlayState* play);
void EffectSs_DrawAll(PlayState* play);
s16 func_80027DD4(s16 arg0, s16 arg1, s32 arg2);
s16 func_80027E34(s16 arg0, s16 arg1, f32 arg2);
u8 func_80027E84(u8 arg0, u8 arg1, f32 arg2);
s16 EffectSs_LerpInv(s16 a, s16 b, s32 weightInv);
s16 EffectSs_LerpS16(s16 a, s16 b, f32 weight);
u8 EffectSs_LerpU8(u8 a, u8 b, f32 weight);
void EffectSs_DrawGEffect(PlayState* play, EffectSs* this, void* texture);
void EffectSsDust_Spawn(PlayState* play, u16 drawFlags, Vec3f* pos, Vec3f* velocity, Vec3f* accel,
Color_RGBA8* primColor, Color_RGBA8* envColor, s16 scale, s16 scaleStep, s16 life,
@@ -683,7 +683,7 @@ u32 SurfaceType_GetSceneExitIndex(CollisionContext* colCtx, CollisionPoly* poly,
u32 SurfaceType_GetFloorType(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId);
u32 func_80041D70(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId);
u32 func_80041D94(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId);
s32 func_80041DB8(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId);
s32 SurfaceType_GetWallFlags(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId);
s32 func_80041DE4(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId);
s32 func_80041E18(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId);
s32 func_80041E4C(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId);
@@ -1047,8 +1047,8 @@ VecSph* OLib_Vec3fToVecSphGeo(VecSph* arg0, Vec3f* arg1);
VecSph* OLib_Vec3fDiffToVecSphGeo(VecSph* arg0, Vec3f* a, Vec3f* b);
Vec3f* OLib_Vec3fDiffRad(Vec3f* dest, Vec3f* a, Vec3f* b);
void OnePointCutscene_SetCsCamPoints(Camera* camera, s16 actionParameters, s16 initTimer, CutsceneCameraPoint* atPoints, CutsceneCameraPoint* eyePoints);
s16 OnePointCutscene_Init(PlayState* play, s16 csId, s16 timer, Actor* actor, s16 camIdx);
s16 OnePointCutscene_EndCutscene(PlayState* play, s16 camIdx);
s16 OnePointCutscene_Init(PlayState* play, s16 csId, s16 timer, Actor* actor, s16 parentCamId);
s16 OnePointCutscene_EndCutscene(PlayState* play, s16 subCamId);
s32 OnePointCutscene_Attention(PlayState* play, Actor* actor);
s32 OnePointCutscene_AttentionSetSfx(PlayState* play, Actor* actor, s32 sfxId);
void OnePointCutscene_EnableAttention(void);
@@ -1114,13 +1114,13 @@ s32 Player_TryCsAction(PlayState* play, Actor* actor, s32 csAction);
s32 Player_InCsMode(PlayState* play);
s32 Player_CheckHostileLockOn(Player* player);
s32 Player_IsChildWithHylianShield(Player* player);
s32 Player_ActionToModelGroup(Player* player, s32 actionParam);
s32 Player_ActionToModelGroup(Player* player, s32 itemAction);
void Player_SetModelsForHoldingShield(Player* player);
void Player_SetModels(Player* player, s32 modelGroup);
void Player_SetModelGroup(Player* player, s32 modelGroup);
void func_8008EC70(Player* player);
void Player_SetEquipmentData(PlayState* play, Player* player);
void Player_UpdateBottleHeld(PlayState* play, Player* player, s32 item, s32 actionParam);
void Player_UpdateBottleHeld(PlayState* play, Player* player, s32 item, s32 itemAction);
void func_80837C0C(PlayState* play, Player* this, s32 arg2, f32 arg3, f32 arg4, s16 arg5, s32 arg6);
void Player_ReleaseLockOn(Player* player);
void Player_ClearZTargeting(Player* player);
@@ -1132,21 +1132,21 @@ u8 Player_GetMask(PlayState* play);
Player* Player_UnsetMask(PlayState* play);
s32 Player_HasMirrorShieldEquipped(PlayState* play);
s32 Player_HasMirrorShieldSetToDraw(PlayState* play);
s32 Player_ActionToMagicSpell(Player* player, s32 actionParam);
s32 Player_ActionToMagicSpell(Player* player, s32 itemAction);
void Player_DrawHookshotReticle(PlayState* play, Player* player, f32 hookshotRange);
s32 Player_HoldsHookshot(Player* player);
s32 Player_HoldsBow(Player* player);
s32 Player_HoldsSlingshot(Player* player);
s32 func_8008F128(Player* player);
s32 Player_ActionToMeleeWeapon(s32 actionParam);
s32 Player_ActionToMeleeWeapon(s32 itemAction);
s32 Player_GetMeleeWeaponHeld(Player* player);
s32 Player_HoldsTwoHandedWeapon(Player* player);
s32 Player_HoldsBrokenKnife(Player* player);
s32 Player_ActionToBottle(Player* player, s32 actionParam);
s32 Player_ActionToBottle(Player* player, s32 itemAction);
s32 Player_GetBottleHeld(Player* player);
s32 Player_ActionToExplosive(Player* player, s32 actionParam);
s32 Player_ActionToExplosive(Player* player, s32 itemAction);
s32 Player_GetExplosiveHeld(Player* player);
s32 func_8008F2BC(Player* player, s32 actionParam);
s32 func_8008F2BC(Player* player, s32 itemAction);
s32 Player_GetEnvironmentalHazard(PlayState* play);
void Player_DrawImpl(PlayState* play, void** skeleton, Vec3s* jointTable, s32 dListCount, s32 lod, s32 tunic,
s32 boots, s32 face, OverrideLimbDrawOpa overrideLimbDraw, PostLimbDrawOpa postLimbDraw, void* this);
+59
View File
@@ -71,6 +71,65 @@ typedef struct {
// 0x0000_00FF = CamData index
} WaterBox; // size = 0x10
typedef enum FloorType {
/* 0 */ FLOOR_TYPE_0,
/* 1 */ FLOOR_TYPE_1,
/* 2 */ FLOOR_TYPE_2,
/* 3 */ FLOOR_TYPE_3,
/* 4 */ FLOOR_TYPE_4,
/* 5 */ FLOOR_TYPE_5,
/* 6 */ FLOOR_TYPE_6,
/* 7 */ FLOOR_TYPE_7,
/* 8 */ FLOOR_TYPE_8,
/* 9 */ FLOOR_TYPE_9,
/* 10 */ FLOOR_TYPE_10,
/* 11 */ FLOOR_TYPE_11,
/* 12 */ FLOOR_TYPE_12
} FloorType;
typedef enum WallType {
/* 0 */ WALL_TYPE_0,
/* 1 */ WALL_TYPE_1,
/* 2 */ WALL_TYPE_2,
/* 3 */ WALL_TYPE_3,
/* 4 */ WALL_TYPE_4,
/* 5 */ WALL_TYPE_5,
/* 6 */ WALL_TYPE_6,
/* 7 */ WALL_TYPE_7,
/* 8 */ WALL_TYPE_8,
/* 9 */ WALL_TYPE_9,
/* 10 */ WALL_TYPE_10,
/* 11 */ WALL_TYPE_11,
/* 12 */ WALL_TYPE_12,
/* 32 */ WALL_TYPE_MAX = 32
} WallType;
#define WALL_FLAG_0 (1 << 0)
#define WALL_FLAG_LADDER (1 << 1)
#define WALL_FLAG_LADDER_TOP (1 << 2)
#define WALL_FLAG_CLIMBABLE (1 << 3)
#define WALL_FLAG_CRAWLSPACE_1 (1 << 4)
#define WALL_FLAG_CRAWLSPACE_2 (1 << 5)
#define WALL_FLAG_GRABBABLE (1 << 6) // Grabbable dynapoly such as blocks
#define WALL_FLAG_CRAWLSPACE (WALL_FLAG_CRAWLSPACE_1 | WALL_FLAG_CRAWLSPACE_2)
typedef enum FloorProperty {
/* 0 */ FLOOR_PROPERTY_0,
/* 5 */ FLOOR_PROPERTY_5 = 5,
/* 6 */ FLOOR_PROPERTY_6,
/* 7 */ FLOOR_PROPERTY_7,
/* 8 */ FLOOR_PROPERTY_8,
/* 9 */ FLOOR_PROPERTY_9,
/* 11 */ FLOOR_PROPERTY_11 = 11,
/* 12 */ FLOOR_PROPERTY_12
} FloorProperty;
typedef enum FloorEffect {
/* 0 */ FLOOR_EFFECT_0,
/* 1 */ FLOOR_EFFECT_1, // Slope/sliding
/* 2 */ FLOOR_EFFECT_2 // Transition
} FloorEffect;
typedef struct {
u32 data[2];
+9 -3
View File
@@ -12,8 +12,14 @@
#define NUM_CAMS 4
#define CAM_ID_MAIN 0
#define CAM_ID_SUB_FIRST 1
// Camera IDs are indices into `PlayState.cameraPtrs`
#define CAM_ID_MAIN 0 // The index of the main camera
#define CAM_ID_SUB_FIRST 1 // The index sub cameras start at
#define CAM_ID_NONE -1 // Used to indicate no camera. Can be used to default to the active camera in some scenarios
#define SUB_CAM_ID_DONE 0 // Used in some actors for variables holding sub camera IDs to indicate "subcam is finished"
// Older decomp names
#define SUBCAM_FREE 0
#define SUBCAM_NONE -1
#define SUBCAM_ACTIVE -1
@@ -107,7 +113,7 @@ typedef enum {
/* 0x05 */ CAM_MODE_CLIMB,
/* 0x06 */ CAM_MODE_FIRST_PERSON, // "SUBJECT"
/* 0x07 */ CAM_MODE_AIM_ADULT,
/* 0x08 */ CAM_MODE_BOWARROWZ,
/* 0x08 */ CAM_MODE_Z_AIM,
/* 0x09 */ CAM_MODE_HOOKSHOT, // "FOOKSHOT"
/* 0x0A */ CAM_MODE_AIM_BOOMERANG,
/* 0x0B */ CAM_MODE_AIM_CHILD, // "PACHINCO"
+4 -2
View File
@@ -3,6 +3,7 @@
extern "C" {
#include "functions.h"
#include "z64bgcheck.h"
}
static void RegisterFixVineFall() {
@@ -22,7 +23,7 @@ static void RegisterFixVineFall() {
* margin to make sure it still hits a climbable poly. Then update the flags
* in touchedWallFlags again and proceed as normal.
*/
if (*touchedWallFlags & 8) {
if (*touchedWallFlags & WALL_FLAG_CLIMBABLE) {
Vec3f checkPosA;
Vec3f checkPosB;
Vec3f raycastResult;
@@ -62,7 +63,8 @@ static void RegisterFixVineFall() {
player->actor.wallYaw = Math_Atan2S(wallPoly->normal.z, wallPoly->normal.x);
*yawDiff = player->actor.shape.rot.y - (s16)(player->actor.wallYaw + 0x8000);
*touchedWallFlags = func_80041DB8(&play->colCtx, player->actor.wallPoly, player->actor.wallBgId);
*touchedWallFlags =
SurfaceType_GetWallFlags(&play->colCtx, player->actor.wallPoly, player->actor.wallBgId);
}
}
});
+1 -1
View File
@@ -401,7 +401,7 @@ void DrawDynapoly(std::vector<Gfx>& dl, CollisionHeader* col, int32_t bgId) {
} else if (SurfaceType_GetFloorType(&gPlayState->colCtx, poly, bgId) != 0 ||
SurfaceType_IsWallDamage(&gPlayState->colCtx, poly, bgId)) {
color = CVarGetColor(CVAR_DEVELOPER_TOOLS("ColViewer.ColorSpecialSurface.Value"), { 192, 255, 192, 255 });
} else if (SurfaceType_GetFloorEffect(&gPlayState->colCtx, poly, bgId) == 0x01) {
} else if (SurfaceType_GetFloorEffect(&gPlayState->colCtx, poly, bgId) == FLOOR_EFFECT_1) {
color = CVarGetColor(CVAR_DEVELOPER_TOOLS("ColViewer.ColorSlope.Value"), { 255, 255, 128, 255 });
} else {
color = CVarGetColor(CVAR_DEVELOPER_TOOLS("ColViewer.ColorNormal.Value"), { 255, 255, 255, 255 });
@@ -2496,7 +2496,7 @@ typedef enum {
// #### `result`
// ```c
// SurfaceType_GetFloorEffect(&play->colCtx, poly, bgId) == 2
// SurfaceType_GetFloorEffect(&play->colCtx, poly, bgId) == FLOOR_EFFECT_2
// ```
// #### `args`
// - `*int16_t` - original next entrance index (`play->setupExitList[exitIndex - 1]`)
+2 -2
View File
@@ -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);
+17 -10
View File
@@ -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;
+2 -2
View File
@@ -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;
+49 -49
View File
@@ -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++;
}
}
+15 -6
View File
@@ -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;
}
+58 -58
View File
@@ -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
+24 -21
View File
@@ -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)];
@@ -280,7 +280,7 @@ void EnBomChu_Move(EnBomChu* this, PlayState* play) {
if (BgCheck_EntityLineTest1(&play->colCtx, &posA, &posB, &posUpDown, &polyUpDown, true, true, true, true,
&bgIdUpDown) &&
!(func_80041DB8(&play->colCtx, polyUpDown, bgIdUpDown) & 0x30) && // && not crawl space?
!(SurfaceType_GetWallFlags(&play->colCtx, polyUpDown, bgIdUpDown) & WALL_FLAG_CRAWLSPACE) &&
!SurfaceType_IsIgnoredByProjectiles(&play->colCtx, polyUpDown, bgIdUpDown)) {
// forwards
posB.x = (this->axisForwards.x * lineLength) + posA.x;
@@ -289,7 +289,7 @@ void EnBomChu_Move(EnBomChu* this, PlayState* play) {
if (BgCheck_EntityLineTest1(&play->colCtx, &posA, &posB, &posSide, &polySide, true, true, true, true,
&bgIdSide) &&
!(func_80041DB8(&play->colCtx, polySide, bgIdSide) & 0x30) &&
!(SurfaceType_GetWallFlags(&play->colCtx, polySide, bgIdSide) & WALL_FLAG_CRAWLSPACE) &&
!SurfaceType_IsIgnoredByProjectiles(&play->colCtx, polySide, bgIdSide)) {
EnBomChu_UpdateFloorPoly(this, polySide, play);
this->actor.world.pos = posSide;
@@ -328,7 +328,7 @@ void EnBomChu_Move(EnBomChu* this, PlayState* play) {
if (BgCheck_EntityLineTest1(&play->colCtx, &posA, &posB, &posSide, &polySide, true, true, true, true,
&bgIdSide) &&
!(func_80041DB8(&play->colCtx, polySide, bgIdSide) & 0x30) &&
!(SurfaceType_GetWallFlags(&play->colCtx, polySide, bgIdSide) & WALL_FLAG_CRAWLSPACE) &&
!SurfaceType_IsIgnoredByProjectiles(&play->colCtx, polySide, bgIdSide)) {
EnBomChu_UpdateFloorPoly(this, polySide, play);
this->actor.world.pos = posSide;
+2 -2
View File
@@ -475,7 +475,7 @@ void func_80A79C78(EnIn* this, PlayState* play) {
player->actor.freezeTimer = 10;
this->actor.flags &= ~ACTOR_FLAG_ATTENTION_ENABLED;
Letterbox_SetSizeTarget(0x20);
Interface_ChangeHudVisibilityMode(2);
Interface_ChangeHudVisibilityMode(HUD_VISIBILITY_NOTHING_ALT);
}
static s32 D_80A7B998 = 0;
@@ -803,7 +803,7 @@ void func_80A7AA40(EnIn* this, PlayState* play) {
this->unk_1FC = 0;
play->csCtx.frames = 0;
Letterbox_SetSizeTarget(0x20);
Interface_ChangeHudVisibilityMode(2);
Interface_ChangeHudVisibilityMode(HUD_VISIBILITY_NOTHING_ALT);
this->actionFunc = func_80A7ABD4;
}
+1 -1
View File
@@ -125,7 +125,7 @@ CollisionPoly* func_80B0C020(PlayState* play, Vec3f* arg1, Vec3f* arg2, Vec3f* a
return NULL;
}
if (func_80041DB8(&play->colCtx, sp3C, *arg4) & 0x30) {
if (SurfaceType_GetWallFlags(&play->colCtx, sp3C, *arg4) & WALL_FLAG_CRAWLSPACE) {
return NULL;
}
@@ -1730,7 +1730,7 @@ void EnTest_Update(Actor* thisx, PlayState* play) {
} else if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND_TOUCH) {
floorProperty = func_80041EA4(&play->colCtx, this->actor.floorPoly, this->actor.floorBgId);
if ((floorProperty == 5) || (floorProperty == 0xC) ||
if ((floorProperty == FLOOR_PROPERTY_5) || (floorProperty == FLOOR_PROPERTY_12) ||
SurfaceType_GetFloorType(&play->colCtx, this->actor.floorPoly, this->actor.floorBgId) == 9) {
Actor_Kill(&this->actor);
GameInteractor_ExecuteOnEnemyDefeat(&this->actor);
@@ -185,7 +185,7 @@ void func_80B4B010(EnZl1* this, PlayState* play) {
Play_CameraSetAtEye(play, this->subCamId, &vec1, &vec2);
Play_CameraSetFov(play, this->subCamId, 30.0f);
Letterbox_SetSizeTarget(0x20);
Interface_ChangeHudVisibilityMode(2);
Interface_ChangeHudVisibilityMode(HUD_VISIBILITY_NOTHING_ALT);
player->actor.world.pos = playerPos;
player->actor.speedXZ = 0.0f;
this->unk_1E2 = 0;
@@ -336,7 +336,7 @@ s32 EnZl4_SetupFromLegendCs(EnZl4* this, PlayState* play) {
EnZl4_SetCsCameraMove(play, 5);
Letterbox_SetSizeTarget(0x20);
Interface_ChangeHudVisibilityMode(2);
Interface_ChangeHudVisibilityMode(HUD_VISIBILITY_NOTHING_ALT);
this->talkTimer2 = 0;
return true;
}
@@ -1147,7 +1147,7 @@ void EnZl4_Cutscene(EnZl4* this, PlayState* play) {
this->mouthExpression = ZL4_MOUTH_SURPRISED;
Audio_PlayFanfare(NA_BGM_APPEAR);
EnZl4_SetCsCameraAngle(play, 0);
Interface_ChangeHudVisibilityMode(2);
Interface_ChangeHudVisibilityMode(HUD_VISIBILITY_NOTHING_ALT);
Letterbox_SetSizeTarget(0x20);
this->talkState = 0;
this->csState++;
@@ -539,7 +539,7 @@ static u32 sConveyorSpeed = 0;
static s16 sIsFloorConveyor = false;
static s16 sConveyorYaw = 0;
static f32 sYDistToFloor = 0.0f;
static s32 sPrevFloorProperty = 0; // floor property from the previous frame
static s32 sPrevFloorProperty = FLOOR_PROPERTY_0; // floor property from the previous frame
static s32 sShapeYawToTouchedWall = 0;
static s32 sWorldYawToTouchedWall = 0;
static s16 sFloorShapePitch = 0;
@@ -4943,7 +4943,7 @@ s32 Player_ActionHandler_12(Player* this, PlayState* play) {
return 0;
}
if ((this->actor.wallBgId != BGCHECK_SCENE) && (sTouchedWallFlags & 0x40)) {
if ((this->actor.wallBgId != BGCHECK_SCENE) && (sTouchedWallFlags & WALL_FLAG_GRABBABLE)) {
if (this->ledgeClimbDelayTimer >= 6) {
this->stateFlags2 |= PLAYER_STATE2_DO_ACTION_CLIMB;
if (CHECK_BTN_ALL(sControlInput->press.button, BTN_A)) {
@@ -5118,7 +5118,7 @@ s32 Player_HandleExitsAndVoids(PlayState* play, Player* this, CollisionPoly* pol
(this->csAction == PLAYER_CSACTION_NONE) && !(this->stateFlags1 & PLAYER_STATE1_LOADING) &&
(((poly != NULL) &&
(exitIndex = SurfaceType_GetSceneExitIndex(&play->colCtx, poly, bgId), exitIndex != 0)) ||
(func_8083816C(sFloorType) && (this->floorProperty == 12)))) {
(func_8083816C(sFloorType) && (this->floorProperty == FLOOR_PROPERTY_12)))) {
sp34 = this->unk_A84 - (s32)this->actor.world.pos.y;
@@ -5161,7 +5161,7 @@ s32 Player_HandleExitsAndVoids(PlayState* play, Player* this, CollisionPoly* pol
Scene_SetTransitionForNextEntrance(play);
} else {
if (GameInteractor_Should(VB_SET_VOIDOUT_FROM_SURFACE,
SurfaceType_GetFloorEffect(&play->colCtx, poly, bgId) == 2,
SurfaceType_GetFloorEffect(&play->colCtx, poly, bgId) == FLOOR_EFFECT_2,
play->setupExitList[exitIndex - 1])) {
gSaveContext.respawn[RESPAWN_MODE_DOWN].entranceIndex = play->nextEntranceIndex;
if (GameInteractor_Should(VB_TRIGGER_VOIDOUT, true, this)) {
@@ -5221,13 +5221,13 @@ s32 Player_HandleExitsAndVoids(PlayState* play, Player* this, CollisionPoly* pol
if (play->transitionTrigger == TRANS_TRIGGER_OFF) {
if ((this->actor.world.pos.y < -4000.0f) ||
(((this->floorProperty == 5) || (this->floorProperty == 12)) &&
(((this->floorProperty == FLOOR_PROPERTY_5) || (this->floorProperty == FLOOR_PROPERTY_12)) &&
((sYDistToFloor < 100.0f) || (this->fallDistance > 400.0f) ||
((play->sceneNum != SCENE_SHADOW_TEMPLE) && (this->fallDistance > 200.0f)))) ||
((play->sceneNum == SCENE_GANONS_TOWER_COLLAPSE_EXTERIOR) && (this->fallDistance > 320.0f))) {
if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) {
if (this->floorProperty == 5) {
if (this->floorProperty == FLOOR_PROPERTY_5) {
Play_TriggerRespawn(play);
} else if (GameInteractor_Should(VB_TRIGGER_VOIDOUT, true, this)) {
Play_TriggerVoidOut(play);
@@ -5237,7 +5237,7 @@ s32 Player_HandleExitsAndVoids(PlayState* play, Player* this, CollisionPoly* pol
} else {
func_80838F5C(play, this);
this->av2.actionVar2 = 9999;
if (this->floorProperty == 5) {
if (this->floorProperty == FLOOR_PROPERTY_5) {
this->av1.actionVar1 = -1;
} else {
this->av1.actionVar1 = 1;
@@ -5723,8 +5723,8 @@ s32 func_8083A6AC(Player* this, PlayState* play) {
sp54 = Math3D_UDistPlaneToPos(nx, ny, nz, sp84->dist, &this->actor.world.pos);
sp50 = (sPrevFloorProperty == 6);
if (!sp50 && (func_80041DB8(&play->colCtx, sp84, sp80) & 8)) {
sp50 = (sPrevFloorProperty == FLOOR_PROPERTY_6);
if (!sp50 && (SurfaceType_GetWallFlags(&play->colCtx, sp84, sp80) & WALL_FLAG_CLIMBABLE)) {
sp50 = 1;
}
@@ -5777,7 +5777,7 @@ void func_8083AA10(Player* this, PlayState* play) {
if (!(this->stateFlags1 & (PLAYER_STATE1_IN_WATER | PLAYER_STATE1_IN_CUTSCENE)) &&
!(this->actor.bgCheckFlags & BGCHECKFLAG_GROUND)) {
if (!func_80838FB8(play, this)) {
if (sPrevFloorProperty == 8) {
if (sPrevFloorProperty == FLOOR_PROPERTY_8) {
this->actor.world.pos.x = this->actor.prevPos.x;
this->actor.world.pos.z = this->actor.prevPos.z;
return;
@@ -5786,7 +5786,7 @@ void func_8083AA10(Player* this, PlayState* play) {
if (!(this->stateFlags3 & PLAYER_STATE3_MIDAIR) && !(this->skelAnime.movementFlags & 0x80) &&
(Player_Action_8084411C != this->actionFunc) && (Player_Action_80844A44 != this->actionFunc)) {
if ((sPrevFloorProperty == 7) || (this->meleeWeaponState != 0)) {
if ((sPrevFloorProperty == FLOOR_PROPERTY_7) || (this->meleeWeaponState != 0)) {
Math_Vec3f_Copy(&this->actor.world.pos, &this->actor.prevPos);
Player_ZeroSpeedXZ(this);
return;
@@ -5796,7 +5796,7 @@ void func_8083AA10(Player* this, PlayState* play) {
this->actor.velocity.y = 1.0f;
if (GameInteractor_Should(VB_SET_STATIC_PREV_FLOOR_TYPE, true, this)) {
sPrevFloorProperty = 9;
sPrevFloorProperty = FLOOR_PROPERTY_9;
}
return;
}
@@ -5809,11 +5809,12 @@ void func_8083AA10(Player* this, PlayState* play) {
this->floorSfxOffset = this->prevFloorSfxOffset;
if ((this->actor.bgCheckFlags & BGCHECKFLAG_GROUND_LEAVE) &&
!(this->stateFlags1 & PLAYER_STATE1_IN_WATER) && (sPrevFloorProperty != 6) &&
(sPrevFloorProperty != 9) && (sYDistToFloor > 20.0f) && (this->meleeWeaponState == 0) &&
(ABS(sp5C) < 0x2000) && (this->linearVelocity > 3.0f)) {
!(this->stateFlags1 & PLAYER_STATE1_IN_WATER) && (sPrevFloorProperty != FLOOR_PROPERTY_6) &&
(sPrevFloorProperty != FLOOR_PROPERTY_9) && (sYDistToFloor > 20.0f) &&
(this->meleeWeaponState == 0) && (ABS(sp5C) < 0x2000) && (this->linearVelocity > 3.0f)) {
if ((sPrevFloorProperty == 11) && !(this->stateFlags1 & PLAYER_STATE1_CARRYING_ACTOR)) {
if ((sPrevFloorProperty == FLOOR_PROPERTY_11) &&
!(this->stateFlags1 & PLAYER_STATE1_CARRYING_ACTOR)) {
sp40 = func_808396F4(play, this, &D_8085451C, &sp44, &sp58, &sp54);
sp3C = this->actor.world.pos.y;
@@ -5831,7 +5832,7 @@ void func_8083AA10(Player* this, PlayState* play) {
return;
}
if ((sPrevFloorProperty == 9) || (sYDistToFloor <= this->ageProperties->unk_34) ||
if ((sPrevFloorProperty == FLOOR_PROPERTY_9) || (sYDistToFloor <= this->ageProperties->unk_34) ||
!func_8083A6AC(this, play)) {
Player_AnimPlayLoop(play, this, &gPlayerAnim_link_normal_landing_wait);
return;
@@ -6344,7 +6345,7 @@ s32 Player_ActionHandler_10(Player* this, PlayState* play) {
if (CHECK_BTN_ALL(sControlInput->press.button, BTN_A) &&
(play->roomCtx.curRoom.behaviorType1 != ROOM_BEHAVIOR_TYPE1_2) && (sFloorType != 7) &&
(SurfaceType_GetFloorEffect(&play->colCtx, this->actor.floorPoly, this->actor.floorBgId) != 1)) {
(SurfaceType_GetFloorEffect(&play->colCtx, this->actor.floorPoly, this->actor.floorBgId) != FLOOR_EFFECT_1)) {
controlStickDirection = this->controlStickDirections[this->controlStickDataIndex];
if (controlStickDirection <= PLAYER_STICK_DIR_FORWARD) {
@@ -7221,7 +7222,7 @@ s32 Player_HandleSlopes(PlayState* play, Player* this, CollisionPoly* floorPoly)
s16 velYawToDownwardSlope;
if (!Player_InBlockingCsMode(play, this) && (Player_Action_SlideOnSlope != this->actionFunc) &&
(SurfaceType_GetFloorEffect(&play->colCtx, floorPoly, this->actor.floorBgId) == 1)) {
(SurfaceType_GetFloorEffect(&play->colCtx, floorPoly, this->actor.floorBgId) == FLOOR_EFFECT_1)) {
// Get direction of movement relative to the downward direction of the slope
playerVelYaw = Math_Atan2S(this->actor.velocity.z, this->actor.velocity.x);
Player_GetSlopeDirection(floorPoly, &slopeNormal, &downwardSlopeYaw);
@@ -7496,9 +7497,9 @@ s32 func_8083EC18(Player* this, PlayState* play, u32 wallFlags) {
if (this->yDistToLedge >= 79.0f) {
if (!(this->stateFlags1 & PLAYER_STATE1_IN_WATER) || (this->currentBoots == PLAYER_BOOTS_IRON) ||
(this->actor.yDistToWater < this->ageProperties->unk_2C)) {
s32 sp8C = (wallFlags & 8) ? 2 : 0;
s32 sp8C = (wallFlags & WALL_FLAG_CLIMBABLE) ? 2 : 0;
if ((sp8C != 0) || (wallFlags & 2) ||
if ((sp8C != 0) || (wallFlags & WALL_FLAG_LADDER) ||
func_80041E4C(&play->colCtx, this->actor.wallPoly, this->actor.wallBgId)) {
f32 phi_f20;
CollisionPoly* wallPoly = this->actor.wallPoly;
@@ -7564,7 +7565,7 @@ s32 func_8083EC18(Player* this, PlayState* play, u32 wallFlags) {
this->stateFlags1 |= PLAYER_STATE1_CLIMBING_LADDER;
this->stateFlags1 &= ~PLAYER_STATE1_IN_WATER;
if ((sp8C != 0) || (wallFlags & 2)) {
if ((sp8C != 0) || (wallFlags & WALL_FLAG_LADDER)) {
if ((this->av1.actionVar1 = sp8C) != 0) {
if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) {
anim = &gPlayerAnim_link_normal_Fclimb_startA;
@@ -7610,15 +7611,15 @@ void Player_SetupDismountLadder(Player* this, LinkAnimationHeader* anim, PlaySta
* @return true if Player chooses to enter crawlspace
*/
s32 Player_TryEnteringCrawlspace(Player* this, PlayState* play, u32 interactWallFlags) {
CollisionPoly* wallPoly;
Vec3f wallVertices[3];
f32 xVertex1;
f32 xVertex2;
f32 zVertex1;
f32 zVertex2;
s32 i;
if (!LINK_IS_ADULT && !(this->stateFlags1 & PLAYER_STATE1_IN_WATER) && (interactWallFlags & WALL_FLAG_CRAWLSPACE)) {
CollisionPoly* wallPoly;
Vec3f wallVertices[3];
f32 xVertex1;
f32 xVertex2;
f32 zVertex1;
f32 zVertex2;
s32 i;
if (!LINK_IS_ADULT && !(this->stateFlags1 & PLAYER_STATE1_IN_WATER) && (interactWallFlags & 0x30)) {
if (!GameInteractor_Should(VB_CRAWL, true)) {
return false;
}
@@ -7713,7 +7714,7 @@ s32 func_8083F360(PlayState* play, Player* this, f32 arg1, f32 arg2, f32 arg3, f
this->actor.bgCheckFlags |= 0x200;
this->actor.wallBgId = wallBgId;
sTouchedWallFlags = func_80041DB8(&play->colCtx, wallPoly, wallBgId);
sTouchedWallFlags = SurfaceType_GetWallFlags(&play->colCtx, wallPoly, wallBgId);
wallPolyNormalX = COLPOLY_GET_NORMAL(wallPoly->normal.x);
wallPolyNormalZ = COLPOLY_GET_NORMAL(wallPoly->normal.z);
@@ -7745,7 +7746,8 @@ s32 func_8083F524(PlayState* play, Player* this) {
s32 Player_TryLeavingCrawlspace(Player* this, PlayState* play) {
s16 yawToWall;
if ((this->linearVelocity != 0.0f) && (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) && (sTouchedWallFlags & 0x30)) {
if ((this->linearVelocity != 0.0f) && (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) &&
(sTouchedWallFlags & WALL_FLAG_CRAWLSPACE)) {
// The exit wallYaws will always point inward on the crawlline
// Interacting with the exit wall in front will have a yaw diff of 0x8000
@@ -7805,12 +7807,12 @@ s32 Player_ActionHandler_5(Player* this, PlayState* play) {
if (((this->linearVelocity > 0.0f) && func_8083EC18(this, play, sTouchedWallFlags)) ||
Player_TryEnteringCrawlspace(this, play, sTouchedWallFlags)) {
return 1;
return true;
}
if (!func_808332B8(this) &&
((this->linearVelocity == 0.0f) || !(this->stateFlags2 & PLAYER_STATE2_DO_ACTION_CLIMB)) &&
(sTouchedWallFlags & 0x40) && (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) &&
(sTouchedWallFlags & WALL_FLAG_GRABBABLE) && (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) &&
(this->yDistToLedge >= 39.0f)) {
this->stateFlags2 |= PLAYER_STATE2_DO_ACTION_GRAB;
@@ -7822,7 +7824,7 @@ s32 Player_ActionHandler_5(Player* this, PlayState* play) {
if (wallPolyActor->actor.id == ACTOR_BG_HEAVY_BLOCK) {
if (Player_GetStrength() < PLAYER_STR_GOLD_G) {
return 0;
return false;
}
Player_SetupWaitForPutAway(play, this, func_8083A0F4);
@@ -7833,7 +7835,7 @@ s32 Player_ActionHandler_5(Player* this, PlayState* play) {
this->yaw = this->actor.wallYaw + 0x8000;
func_80832224(this);
return 1;
return true;
}
this->unk_3C4 = &wallPolyActor->actor;
@@ -7843,12 +7845,12 @@ s32 Player_ActionHandler_5(Player* this, PlayState* play) {
func_8083F72C(this, &gPlayerAnim_link_normal_push_wait, play);
return 1;
return true;
}
}
}
return 0;
return false;
}
s32 func_8083F9D0(PlayState* play, Player* this) {
@@ -7896,7 +7898,7 @@ void func_8083FB7C(Player* this, PlayState* play) {
s32 func_8083FBC0(Player* this, PlayState* play) {
if (!CHECK_BTN_ALL(sControlInput->press.button, BTN_A) &&
(this->actor.bgCheckFlags & BGCHECKFLAG_PLAYER_WALL_INTERACT) &&
((sTouchedWallFlags & 8) || (sTouchedWallFlags & 2) ||
((sTouchedWallFlags & WALL_FLAG_CLIMBABLE) || (sTouchedWallFlags & WALL_FLAG_LADDER) ||
func_80041E4C(&play->colCtx, this->actor.wallPoly, this->actor.wallBgId))) {
return false;
}
@@ -11290,7 +11292,7 @@ void Player_ProcessSceneCollision(PlayState* play, Player* this) {
yawDiff = this->actor.shape.rot.y - (s16)(this->actor.wallYaw + 0x8000);
sTouchedWallFlags = func_80041DB8(&play->colCtx, this->actor.wallPoly, this->actor.wallBgId);
sTouchedWallFlags = SurfaceType_GetWallFlags(&play->colCtx, this->actor.wallPoly, this->actor.wallBgId);
GameInteractor_Should(VB_REVALIDATE_CLIMBED_WALL, true, play, this, &sTouchedWallFlags, &yawDiff);
@@ -11501,7 +11503,7 @@ void Player_UpdateCamAndSeqModes(PlayState* play, Player* this) {
}
} else if (this->stateFlags1 & (PLAYER_STATE1_PARALLEL | PLAYER_STATE1_LOCK_ON_FORCED_TO_RELEASE)) {
if (func_8002DD78(this) || func_808334B4(this)) {
camMode = CAM_MODE_BOWARROWZ;
camMode = CAM_MODE_Z_AIM;
} else if (this->stateFlags1 & PLAYER_STATE1_CLIMBING_LADDER) {
camMode = CAM_MODE_CLIMBZ;
} else {
@@ -12185,7 +12187,7 @@ void Player_UpdateCommon(Player* this, PlayState* play, Input* input) {
Collider_ResetQuadAT(play, &this->shieldQuad.base);
}
static Vec3f D_80854838 = { 0.0f, 0.0f, -30.0f };
static Vec3f sDogSpawnOffset = { 0.0f, 0.0f, -30.0f };
s32 Player_UpdateNoclip(Player* this, PlayState* play);
@@ -12194,8 +12196,7 @@ void Player_Update(Actor* thisx, PlayState* play) {
Player* this = (Player*)thisx;
s32 dogParams;
s32 pad;
Input sp44;
Actor* dog;
Input input;
if (Player_UpdateNoclip(this, play)) {
if (gSaveContext.dogParams < 0) {
@@ -12204,8 +12205,10 @@ void Player_Update(Actor* thisx, PlayState* play) {
!CVarGetInteger(CVAR_ENHANCEMENT("DogFollowsEverywhere"), 0)) {
gSaveContext.dogParams = 0;
} else {
Actor* dog;
gSaveContext.dogParams &= 0x7FFF;
Player_GetRelativePosition(this, &this->actor.world.pos, &D_80854838, &sDogSpawnPos);
Player_GetRelativePosition(this, &this->actor.world.pos, &sDogSpawnOffset, &sDogSpawnPos);
dogParams = gSaveContext.dogParams;
dog = Actor_Spawn(&play->actorCtx, play, ACTOR_EN_DOG, sDogSpawnPos.x, sDogSpawnPos.y, sDogSpawnPos.z,
@@ -12226,12 +12229,12 @@ void Player_Update(Actor* thisx, PlayState* play) {
}
if (this->stateFlags1 & (PLAYER_STATE1_INPUT_DISABLED | PLAYER_STATE1_IN_CUTSCENE)) {
memset(&sp44, 0, sizeof(sp44));
memset(&input, 0, sizeof(input));
} else {
sp44 = play->state.input[0];
input = play->state.input[0];
if (this->textboxBtnCooldownTimer != 0) {
sp44.cur.button &= ~(BTN_A | BTN_B | BTN_CUP);
sp44.press.button &= ~(BTN_A | BTN_B | BTN_CUP);
input.cur.button &= ~(BTN_A | BTN_B | BTN_CUP);
input.press.button &= ~(BTN_A | BTN_B | BTN_CUP);
}
}
@@ -12245,7 +12248,7 @@ void Player_Update(Actor* thisx, PlayState* play) {
}
}
Player_UpdateCommon(this, play, &sp44);
Player_UpdateCommon(this, play, &input);
}
MREG(52) = this->actor.world.pos.x;
@@ -12253,6 +12256,8 @@ void Player_Update(Actor* thisx, PlayState* play) {
MREG(54) = this->actor.world.pos.z;
MREG(55) = this->actor.world.rot.y;
// SoH: Everything below
// Make Link normal size when going through doors and crawlspaces and when climbing ladders.
// Otherwise Link can glitch out, being in unloaded rooms or falling OoB.
if (this->stateFlags1 & PLAYER_STATE1_CLIMBING_LADDER || this->stateFlags1 & PLAYER_STATE1_IN_CUTSCENE ||
@@ -12880,10 +12885,10 @@ s32 func_8084B4D4(PlayState* play, Player* this) {
func_8084B498(this);
this->unk_6AD = 4;
Player_ActionHandler_13(this, play);
return 1;
return true;
}
return 0;
return false;
}
void Player_Action_Talk(Player* this, PlayState* play) {
@@ -14711,7 +14716,7 @@ void Player_Action_SlideOnSlope(Player* this, PlayState* play) {
xzSpeedIncrStep = SQ(xzSpeedTarget) * 0.015f;
xzSpeedDecrStep = slopeNormal.y * 0.01f;
if (SurfaceType_GetFloorEffect(&play->colCtx, floorPoly, this->actor.floorBgId) != 1) {
if (SurfaceType_GetFloorEffect(&play->colCtx, floorPoly, this->actor.floorBgId) != FLOOR_EFFECT_1) {
xzSpeedTarget = 0;
xzSpeedDecrStep = slopeNormal.y * 10.0f;
}
@@ -14909,7 +14914,7 @@ void Player_Action_8084FBF4(Player* this, PlayState* play) {
* With Noclip enabled, another button combination can be pressed to set all "temp clear" flags
* in the current room. To do so hold L and press D-pad left.
*
* @return true if Noclip is disabled, false if enabled
* @return true if Noclip is disabled, false if enabled
*/
s32 Player_UpdateNoclip(Player* this, PlayState* play) {
sControlInput = &play->state.input[0];
@@ -14921,7 +14926,7 @@ s32 Player_UpdateNoclip(Player* this, PlayState* play) {
sNoclipEnabled ^= 1;
if (sNoclipEnabled) {
Camera_ChangeMode(Play_GetCamera(play, 0), CAM_MODE_BOWARROWZ);
Camera_ChangeMode(Play_GetCamera(play, CAM_ID_MAIN), CAM_MODE_Z_AIM);
}
}
@@ -16473,7 +16478,7 @@ s32 Player_StartFishing(PlayState* play) {
func_80832564(play, this);
Player_UseItem(play, this, ITEM_FISHING_POLE);
return 1;
return true;
}
s32 func_80852F38(PlayState* play, Player* this) {
@@ -16524,15 +16529,16 @@ s32 Player_InflictDamage(PlayState* play, s32 damage) {
return Player_InflictDamageModified(play, damage, true);
}
// SoH
s32 Player_InflictDamageModified(PlayState* play, s32 damage, u8 modified) {
Player* this = GET_PLAYER(play);
if (!Player_InBlockingCsMode(play, this) && !func_80837B18_modified(play, this, damage, modified)) {
this->stateFlags2 &= ~PLAYER_STATE2_GRABBED_BY_ENEMY;
return 1;
return true;
}
return 0;
return false;
}
/**
@@ -176,21 +176,21 @@ void EffectSsBomb2_Update(PlayState* play, u32 index, EffectSs* this) {
if ((this->life < 23) && (this->life > 13)) {
divisor = this->life - 13;
this->rPrimColorR = func_80027DD4(this->rPrimColorR, 255, divisor);
this->rPrimColorG = func_80027DD4(this->rPrimColorG, 255, divisor);
this->rPrimColorB = func_80027DD4(this->rPrimColorB, 150, divisor);
this->rPrimColorA = func_80027DD4(this->rPrimColorA, 255, divisor);
this->rEnvColorR = func_80027DD4(this->rEnvColorR, 150, divisor);
this->rEnvColorG = func_80027DD4(this->rEnvColorG, 0, divisor);
this->rEnvColorB = func_80027DD4(this->rEnvColorB, 0, divisor);
this->rPrimColorR = EffectSs_LerpInv(this->rPrimColorR, 255, divisor);
this->rPrimColorG = EffectSs_LerpInv(this->rPrimColorG, 255, divisor);
this->rPrimColorB = EffectSs_LerpInv(this->rPrimColorB, 150, divisor);
this->rPrimColorA = EffectSs_LerpInv(this->rPrimColorA, 255, divisor);
this->rEnvColorR = EffectSs_LerpInv(this->rEnvColorR, 150, divisor);
this->rEnvColorG = EffectSs_LerpInv(this->rEnvColorG, 0, divisor);
this->rEnvColorB = EffectSs_LerpInv(this->rEnvColorB, 0, divisor);
} else if ((this->life < 14) && (this->life > -1)) {
divisor = this->life + 1;
this->rPrimColorR = func_80027DD4(this->rPrimColorR, 50, divisor);
this->rPrimColorG = func_80027DD4(this->rPrimColorG, 50, divisor);
this->rPrimColorB = func_80027DD4(this->rPrimColorB, 50, divisor);
this->rPrimColorA = func_80027DD4(this->rPrimColorA, 150, divisor);
this->rEnvColorR = func_80027DD4(this->rEnvColorR, 10, divisor);
this->rEnvColorG = func_80027DD4(this->rEnvColorG, 10, divisor);
this->rEnvColorB = func_80027DD4(this->rEnvColorB, 10, divisor);
this->rPrimColorR = EffectSs_LerpInv(this->rPrimColorR, 50, divisor);
this->rPrimColorG = EffectSs_LerpInv(this->rPrimColorG, 50, divisor);
this->rPrimColorB = EffectSs_LerpInv(this->rPrimColorB, 50, divisor);
this->rPrimColorA = EffectSs_LerpInv(this->rPrimColorA, 150, divisor);
this->rEnvColorR = EffectSs_LerpInv(this->rEnvColorR, 10, divisor);
this->rEnvColorG = EffectSs_LerpInv(this->rEnvColorG, 10, divisor);
this->rEnvColorB = EffectSs_LerpInv(this->rEnvColorB, 10, divisor);
}
}
@@ -112,11 +112,11 @@ void EffectSsHitMark_Update(PlayState* play, u32 index, EffectSs* this) {
if (this->rTexIdx != 0) {
colorIdx = this->rType * 4 + 2;
this->rPrimColorR = func_80027DD4(this->rPrimColorR, sColors[colorIdx].r, this->life + 1);
this->rPrimColorG = func_80027DD4(this->rPrimColorG, sColors[colorIdx].g, this->life + 1);
this->rPrimColorB = func_80027DD4(this->rPrimColorB, sColors[colorIdx].b, this->life + 1);
this->rEnvColorR = func_80027DD4(this->rEnvColorR, sColors[colorIdx + 1].r, this->life + 1);
this->rEnvColorG = func_80027DD4(this->rEnvColorG, sColors[colorIdx + 1].g, this->life + 1);
this->rEnvColorB = func_80027DD4(this->rEnvColorB, sColors[colorIdx + 1].b, this->life + 1);
this->rPrimColorR = EffectSs_LerpInv(this->rPrimColorR, sColors[colorIdx].r, this->life + 1);
this->rPrimColorG = EffectSs_LerpInv(this->rPrimColorG, sColors[colorIdx].g, this->life + 1);
this->rPrimColorB = EffectSs_LerpInv(this->rPrimColorB, sColors[colorIdx].b, this->life + 1);
this->rEnvColorR = EffectSs_LerpInv(this->rEnvColorR, sColors[colorIdx + 1].r, this->life + 1);
this->rEnvColorG = EffectSs_LerpInv(this->rEnvColorG, sColors[colorIdx + 1].g, this->life + 1);
this->rEnvColorB = EffectSs_LerpInv(this->rEnvColorB, sColors[colorIdx + 1].b, this->life + 1);
}
}