1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2025-01-14 12:17:08 +00:00

Doc, macros, enums for SurfaceType.data (#1293)

* `SURFACETYPE`0/1 getter macros

* Cleanup/assess/revert existing names

* `SURFACETYPE0_30` -> "soft"

* `SURFACETYPE0_`13/26 -> floortype/floorproperty

* Introduce `SURFACETYPE_FLOORTYPE_` enum

* Introduce `SURFACETYPE_FLOORPROPERTY_` enum

* `SURFACETYPE0_21` -> "wall type", and maps to "wall flags"

* Introduce `SURFACETYPE_WALLTYPE_` enum

* Introduce `SURFACETYPE_WALLFLAG_` defines

* `SURFACETYPE1_0` -> "sfx type"

* `SurfaceType_GetSfx` -> `GetSfxId` and cleanup

* Introduce `SURFACETYPE_SFXTYPE_` enum

* Note oddity on `Player.unk_89E` (more docs needed)

* `SURFACETYPE1_4` -> "floor effect" (not 100% set on the name, just something different from type and property)

* Introduce `SURFACETYPE_FLOOREFFECT_` enum

* Introduce `SURFACETYPE_CONVEYORSPEED_` enum

* Add `SURFACETYPE_CONVEYORDIRECTION_TO_BINANG` macro

* `wallDamage` -> `hasFlag27`

* Be more underscore-happy

* Revert "`SURFACETYPE`0/1 getter macros"

This reverts commit e61cccf2e6.

* remove mention to removed define

* Remove surfacetype_ prefix, `SFX_TYPE_` -> `SURFACE_SFX_TYPE_`, `FLOOREFFECT_` -> `FLOOR_EFFECT_`

* Formatting

* 0-pad litteral to 8 nibbles
This commit is contained in:
Dragorn421 2022-07-31 20:57:18 +02:00 committed by GitHub
parent 6889c275cb
commit 706d5596bf
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
24 changed files with 302 additions and 247 deletions

View file

@ -634,28 +634,28 @@ u16 BgCheck_GetBgCamSetting(CollisionContext* colCtx, CollisionPoly* poly, s32 b
u16 BgCheck_GetBgCamCount(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId); u16 BgCheck_GetBgCamCount(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId);
Vec3s* BgCheck_GetBgCamFuncDataImpl(CollisionContext* colCtx, s32 bgCamIndex, s32 bgId); Vec3s* BgCheck_GetBgCamFuncDataImpl(CollisionContext* colCtx, s32 bgCamIndex, s32 bgId);
Vec3s* BgCheck_GetBgCamFuncData(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId); Vec3s* BgCheck_GetBgCamFuncData(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId);
u32 SurfaceType_GetSceneExitIndex(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId); u32 SurfaceType_GetExitIndex(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId);
u32 func_80041D4C(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId); u32 SurfaceType_GetFloorType(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId);
u32 func_80041D70(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId); u32 func_80041D70(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 SurfaceType_CheckWallFlag0(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId);
s32 func_80041E18(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId); s32 SurfaceType_CheckWallFlag1(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId);
s32 func_80041E4C(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId); s32 SurfaceType_CheckWallFlag2(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId);
u32 func_80041EA4(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId); u32 SurfaceType_GetFloorProperty(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId);
u32 func_80041EC8(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId); u32 SurfaceType_IsSoft(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId);
u32 SurfaceType_IsHorseBlocked(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId); u32 SurfaceType_IsHorseBlocked(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId);
u32 func_80041F10(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId); u32 SurfaceType_GetSfxType(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId);
u16 SurfaceType_GetSfx(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId); u16 SurfaceType_GetSfxId(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId);
u32 SurfaceType_GetSlope(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId); u32 SurfaceType_GetFloorEffect(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId);
u32 SurfaceType_GetLightSettingIndex(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId); u32 SurfaceType_GetLightSetting(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId);
u32 SurfaceType_GetEcho(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId); u32 SurfaceType_GetEcho(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId);
u32 SurfaceType_IsHookshotSurface(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId); u32 SurfaceType_CanHookshot(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId);
s32 SurfaceType_IsIgnoredByEntities(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId); s32 SurfaceType_IsIgnoredByEntities(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId);
s32 SurfaceType_IsIgnoredByProjectiles(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId); s32 SurfaceType_IsIgnoredByProjectiles(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId);
s32 SurfaceType_IsFloorConveyor(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId); s32 SurfaceType_IsFloorConveyor(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId);
u32 SurfaceType_GetConveyorSpeed(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId); u32 SurfaceType_GetConveyorSpeed(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId);
u32 SurfaceType_GetConveyorDirection(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId); u32 SurfaceType_GetConveyorDirection(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId);
u32 SurfaceType_IsWallDamage(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId); u32 func_80042108(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId);
s32 WaterBox_GetSurface1(PlayState* play, CollisionContext* colCtx, f32 x, f32 z, f32* ySurface, s32 WaterBox_GetSurface1(PlayState* play, CollisionContext* colCtx, f32 x, f32 z, f32* ySurface,
WaterBox** outWaterBox); WaterBox** outWaterBox);
s32 WaterBox_GetSurface2(PlayState* play, CollisionContext* colCtx, Vec3f* pos, f32 surfaceChkDist, s32 WaterBox_GetSurface2(PlayState* play, CollisionContext* colCtx, Vec3f* pos, f32 surfaceChkDist,

View file

@ -87,11 +87,94 @@ typedef struct {
// 0x0000_00FF = BgCam Index // 0x0000_00FF = BgCam Index
} WaterBox; // size = 0x10 } WaterBox; // size = 0x10
typedef enum {
/* 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 {
/* 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_1 (1 << 1)
#define WALL_FLAG_2 (1 << 2)
#define WALL_FLAG_3 (1 << 3)
#define WALL_FLAG_4 (1 << 4)
#define WALL_FLAG_5 (1 << 5)
#define WALL_FLAG_6 (1 << 6)
typedef enum {
/* 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 {
/* 0 */ SURFACE_SFX_TYPE_0,
/* 1 */ SURFACE_SFX_TYPE_1,
/* 2 */ SURFACE_SFX_TYPE_2,
/* 3 */ SURFACE_SFX_TYPE_3,
/* 4 */ SURFACE_SFX_TYPE_4,
/* 5 */ SURFACE_SFX_TYPE_5,
/* 6 */ SURFACE_SFX_TYPE_6,
/* 7 */ SURFACE_SFX_TYPE_7,
/* 8 */ SURFACE_SFX_TYPE_8,
/* 9 */ SURFACE_SFX_TYPE_9,
/* 10 */ SURFACE_SFX_TYPE_10,
/* 11 */ SURFACE_SFX_TYPE_11,
/* 12 */ SURFACE_SFX_TYPE_12,
/* 13 */ SURFACE_SFX_TYPE_13,
/* 14 */ SURFACE_SFX_TYPE_MAX
} SurfaceSfxType;
typedef enum {
/* 0 */ FLOOR_EFFECT_0,
/* 1 */ FLOOR_EFFECT_1,
/* 2 */ FLOOR_EFFECT_2
} FloorEffect;
typedef enum {
/* 0 */ CONVEYOR_SPEED_DISABLED,
/* 1 */ CONVEYOR_SPEED_SLOW,
/* 2 */ CONVEYOR_SPEED_MEDIUM,
/* 3 */ CONVEYOR_SPEED_FAST,
/* 4 */ CONVEYOR_SPEED_MAX
} ConveyorSpeed;
#define CONVEYOR_DIRECTION_TO_BINANG(conveyorDirection) ((conveyorDirection) * (0x10000 / 64))
typedef struct { typedef struct {
u32 data[2]; u32 data[2];
// Type 1
// 0x0800_0000 = wall damage
} SurfaceType; } SurfaceType;
typedef struct { typedef struct {

View file

@ -1705,7 +1705,7 @@ void func_8002F850(PlayState* play, Actor* actor) {
sfxId = NA_SE_PL_WALK_WATER1 - SFX_FLAG; sfxId = NA_SE_PL_WALK_WATER1 - SFX_FLAG;
} }
} else { } else {
sfxId = SurfaceType_GetSfx(&play->colCtx, actor->floorPoly, actor->floorBgId); sfxId = SurfaceType_GetSfxId(&play->colCtx, actor->floorPoly, actor->floorBgId);
} }
func_80078914(&actor->projectedPos, NA_SE_EV_BOMB_BOUND); func_80078914(&actor->projectedPos, NA_SE_EV_BOMB_BOUND);
@ -1749,7 +1749,7 @@ void func_8002F994(Actor* actor, s32 arg1) {
// Tests if something hit Jabu Jabu surface, displaying hit splash and playing sfx if true // Tests if something hit Jabu Jabu surface, displaying hit splash and playing sfx if true
s32 func_8002F9EC(PlayState* play, Actor* actor, CollisionPoly* poly, s32 bgId, Vec3f* pos) { s32 func_8002F9EC(PlayState* play, Actor* actor, CollisionPoly* poly, s32 bgId, Vec3f* pos) {
if (func_80041D4C(&play->colCtx, poly, bgId) == 8) { if (SurfaceType_GetFloorType(&play->colCtx, poly, bgId) == FLOOR_TYPE_8) {
play->roomCtx.unk_74[0] = 1; play->roomCtx.unk_74[0] = 1;
CollisionCheck_BlueBlood(play, NULL, pos); CollisionCheck_BlueBlood(play, NULL, pos);
Audio_PlayActorSfx2(actor, NA_SE_IT_WALL_HIT_BUYO); Audio_PlayActorSfx2(actor, NA_SE_IT_WALL_HIT_BUYO);

View file

@ -24,18 +24,32 @@
#define COLPOLY_IGNORE_ENTITY (1 << 1) #define COLPOLY_IGNORE_ENTITY (1 << 1)
#define COLPOLY_IGNORE_PROJECTILES (1 << 2) #define COLPOLY_IGNORE_PROJECTILES (1 << 2)
// func_80041DB8, SurfaceType wall properties s32 D_80119D90[WALL_TYPE_MAX] = {
s32 D_80119D90[32] = { 0, // WALL_TYPE_0
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, WALL_FLAG_0, // WALL_TYPE_1
WALL_FLAG_0 | WALL_FLAG_1, // WALL_TYPE_2
WALL_FLAG_0 | WALL_FLAG_2, // WALL_TYPE_3
WALL_FLAG_3, // WALL_TYPE_4
WALL_FLAG_4, // WALL_TYPE_5
WALL_FLAG_5, // WALL_TYPE_6
WALL_FLAG_6, // WALL_TYPE_7
}; };
// SurfaceType_GetSfx u16 D_80119E10[SURFACE_SFX_TYPE_MAX] = {
u16 D_80119E10[14] = { NA_SE_PL_WALK_GROUND - SFX_FLAG, // SURFACE_SFX_TYPE_0
NA_SE_PL_WALK_GROUND - SFX_FLAG, NA_SE_PL_WALK_SAND - SFX_FLAG, NA_SE_PL_WALK_CONCRETE - SFX_FLAG, NA_SE_PL_WALK_SAND - SFX_FLAG, // SURFACE_SFX_TYPE_1
NA_SE_PL_WALK_DIRT - SFX_FLAG, NA_SE_PL_WALK_WATER0 - SFX_FLAG, NA_SE_PL_WALK_WATER1 - SFX_FLAG, NA_SE_PL_WALK_CONCRETE - SFX_FLAG, // SURFACE_SFX_TYPE_2
NA_SE_PL_WALK_WATER2 - SFX_FLAG, NA_SE_PL_WALK_MAGMA - SFX_FLAG, NA_SE_PL_WALK_GRASS - SFX_FLAG, NA_SE_PL_WALK_DIRT - SFX_FLAG, // SURFACE_SFX_TYPE_3
NA_SE_PL_WALK_GLASS - SFX_FLAG, NA_SE_PL_WALK_LADDER - SFX_FLAG, NA_SE_PL_WALK_GROUND - SFX_FLAG, NA_SE_PL_WALK_WATER0 - SFX_FLAG, // SURFACE_SFX_TYPE_4
NA_SE_PL_WALK_ICE - SFX_FLAG, NA_SE_PL_WALK_IRON - SFX_FLAG, NA_SE_PL_WALK_WATER1 - SFX_FLAG, // SURFACE_SFX_TYPE_5
NA_SE_PL_WALK_WATER2 - SFX_FLAG, // SURFACE_SFX_TYPE_6
NA_SE_PL_WALK_MAGMA - SFX_FLAG, // SURFACE_SFX_TYPE_7
NA_SE_PL_WALK_GRASS - SFX_FLAG, // SURFACE_SFX_TYPE_8
NA_SE_PL_WALK_GLASS - SFX_FLAG, // SURFACE_SFX_TYPE_9
NA_SE_PL_WALK_LADDER - SFX_FLAG, // SURFACE_SFX_TYPE_10
NA_SE_PL_WALK_GROUND - SFX_FLAG, // SURFACE_SFX_TYPE_11
NA_SE_PL_WALK_ICE - SFX_FLAG, // SURFACE_SFX_TYPE_12
NA_SE_PL_WALK_IRON - SFX_FLAG, // SURFACE_SFX_TYPE_13
}; };
/** /**
@ -602,7 +616,7 @@ f32 BgCheck_RaycastFloorStatic(StaticLookup* lookup, CollisionContext* colCtx, u
/** /**
* Compute wall displacement on `posX` and `posZ` * Compute wall displacement on `posX` and `posZ`
* sets `wallPolyPtr` to `poly` if `wallPolyPtr` is NULL or not a damage wall * sets `wallPolyPtr` to `poly` if `wallPolyPtr` is NULL or doesn't have `surfaceData[0] & 0x08000000` set
* returns true if `wallPolyPtr` was changed * returns true if `wallPolyPtr` was changed
* `invXZlength` is 1 / sqrt( sq(poly.normal.x) + sq(poly.normal.z) ) * `invXZlength` is 1 / sqrt( sq(poly.normal.x) + sq(poly.normal.z) )
*/ */
@ -610,7 +624,7 @@ s32 BgCheck_ComputeWallDisplacement(CollisionContext* colCtx, CollisionPoly* pol
f32 nz, f32 invXZlength, f32 planeDist, f32 radius, CollisionPoly** wallPolyPtr) { f32 nz, f32 invXZlength, f32 planeDist, f32 radius, CollisionPoly** wallPolyPtr) {
CollisionPoly* wallPoly; CollisionPoly* wallPoly;
u32 surfaceData; u32 surfaceData;
u32 wallDamage; u32 hasFlag27;
f32 displacement = (radius - planeDist) * invXZlength; f32 displacement = (radius - planeDist) * invXZlength;
*posX += displacement * nx; *posX += displacement * nx;
@ -623,9 +637,9 @@ s32 BgCheck_ComputeWallDisplacement(CollisionContext* colCtx, CollisionPoly* pol
} }
surfaceData = colCtx->colHeader->surfaceTypeList[wallPoly->type].data[1]; surfaceData = colCtx->colHeader->surfaceTypeList[wallPoly->type].data[1];
wallDamage = surfaceData & 0x08000000 ? 1 : 0; hasFlag27 = surfaceData & 0x08000000 ? 1 : 0;
if (!wallDamage) { if (!hasFlag27) {
*wallPolyPtr = poly; *wallPolyPtr = poly;
return true; return true;
} }
@ -1707,7 +1721,7 @@ f32 BgCheck_RaycastFloorImpl(PlayState* play, CollisionContext* colCtx, u16 xpFl
yIntersect = yIntersectDyna; yIntersect = yIntersectDyna;
} }
if (yIntersect != BGCHECK_Y_MIN && func_80041EC8(colCtx, *outPoly, *outBgId)) { if (yIntersect != BGCHECK_Y_MIN && SurfaceType_IsSoft(colCtx, *outPoly, *outBgId)) {
yIntersect -= 1.0f; yIntersect -= 1.0f;
} }
return yIntersect; return yIntersect;
@ -3832,9 +3846,6 @@ u32 SurfaceType_GetData(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId,
return surfaceTypes[poly->type].data[dataIdx]; return surfaceTypes[poly->type].data[dataIdx];
} }
/**
* SurfaceType get index of bgCam
*/
u32 SurfaceType_GetBgCamIndex(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId) { u32 SurfaceType_GetBgCamIndex(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId) {
return SurfaceType_GetData(colCtx, poly, bgId, 0) & 0xFF; return SurfaceType_GetData(colCtx, poly, bgId, 0) & 0xFF;
} }
@ -3971,17 +3982,11 @@ Vec3s* BgCheck_GetBgCamFuncData(CollisionContext* colCtx, CollisionPoly* poly, s
return BgCheck_GetBgCamFuncDataImpl(colCtx, SurfaceType_GetBgCamIndex(colCtx, poly, bgId), bgId); return BgCheck_GetBgCamFuncDataImpl(colCtx, SurfaceType_GetBgCamIndex(colCtx, poly, bgId), bgId);
} }
/** u32 SurfaceType_GetExitIndex(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId) {
* SurfaceType Get Scene Exit Index
*/
u32 SurfaceType_GetSceneExitIndex(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId) {
return SurfaceType_GetData(colCtx, poly, bgId, 0) >> 8 & 0x1F; return SurfaceType_GetData(colCtx, poly, bgId, 0) >> 8 & 0x1F;
} }
/** u32 SurfaceType_GetFloorType(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId) {
* SurfaceType Get ? Property (& 0x0003 E000)
*/
u32 func_80041D4C(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId) {
return SurfaceType_GetData(colCtx, poly, bgId, 0) >> 13 & 0x1F; return SurfaceType_GetData(colCtx, poly, bgId, 0) >> 13 & 0x1F;
} }
@ -3992,110 +3997,68 @@ u32 func_80041D70(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId) {
return SurfaceType_GetData(colCtx, poly, bgId, 0) >> 18 & 7; return SurfaceType_GetData(colCtx, poly, bgId, 0) >> 18 & 7;
} }
/** u32 SurfaceType_GetWallType(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId) {
* SurfaceType Get Wall Property (Internal)
*/
u32 func_80041D94(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId) {
return SurfaceType_GetData(colCtx, poly, bgId, 0) >> 21 & 0x1F; return SurfaceType_GetData(colCtx, poly, bgId, 0) >> 21 & 0x1F;
} }
/** s32 SurfaceType_GetWallFlags(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId) {
* SurfaceType Get Wall Flags return D_80119D90[SurfaceType_GetWallType(colCtx, poly, bgId)];
*/
s32 func_80041DB8(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId) {
return D_80119D90[func_80041D94(colCtx, poly, bgId)];
} }
/** s32 SurfaceType_CheckWallFlag0(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId) {
* SurfaceType Is Wall Flag (1 << 0) Set return (SurfaceType_GetWallFlags(colCtx, poly, bgId) & WALL_FLAG_0) ? true : false;
*/
s32 func_80041DE4(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId) {
return (func_80041DB8(colCtx, poly, bgId) & 1) ? true : false;
} }
/** s32 SurfaceType_CheckWallFlag1(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId) {
* SurfaceType Is Wall Flag (1 << 1) Set return (SurfaceType_GetWallFlags(colCtx, poly, bgId) & WALL_FLAG_1) ? true : false;
*/
s32 func_80041E18(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId) {
return (func_80041DB8(colCtx, poly, bgId) & 2) ? true : false;
} }
/** s32 SurfaceType_CheckWallFlag2(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId) {
* SurfaceType Is Wall Flag (1 << 2) Set return (SurfaceType_GetWallFlags(colCtx, poly, bgId) & WALL_FLAG_2) ? true : false;
*/
s32 func_80041E4C(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId) {
return (func_80041DB8(colCtx, poly, bgId) & 4) ? true : false;
} }
/** u32 SurfaceType_GetFloorProperty2(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId) {
* unused
*/
u32 func_80041E80(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId) {
return SurfaceType_GetData(colCtx, poly, bgId, 0) >> 26 & 0xF; return SurfaceType_GetData(colCtx, poly, bgId, 0) >> 26 & 0xF;
} }
/** u32 SurfaceType_GetFloorProperty(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId) {
* SurfaceType Get Floor Property
*/
u32 func_80041EA4(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId) {
return SurfaceType_GetData(colCtx, poly, bgId, 0) >> 26 & 0xF; return SurfaceType_GetData(colCtx, poly, bgId, 0) >> 26 & 0xF;
} }
/** u32 SurfaceType_IsSoft(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId) {
* SurfaceType Is Floor Minus 1
*/
u32 func_80041EC8(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId) {
return SurfaceType_GetData(colCtx, poly, bgId, 0) >> 30 & 1; return SurfaceType_GetData(colCtx, poly, bgId, 0) >> 30 & 1;
} }
/**
* SurfaceType Is Horse Blocked
*/
u32 SurfaceType_IsHorseBlocked(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId) { u32 SurfaceType_IsHorseBlocked(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId) {
return SurfaceType_GetData(colCtx, poly, bgId, 0) >> 31 & 1; return SurfaceType_GetData(colCtx, poly, bgId, 0) >> 31 & 1;
} }
u32 func_80041F10(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId) { u32 SurfaceType_GetSfxType(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId) {
return SurfaceType_GetData(colCtx, poly, bgId, 1) & 0xF; return SurfaceType_GetData(colCtx, poly, bgId, 1) & 0xF;
} }
/** u16 SurfaceType_GetSfxId(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId) {
* SurfaceType Get Poly Sfx s32 sfxType = SurfaceType_GetSfxType(colCtx, poly, bgId);
*/
u16 SurfaceType_GetSfx(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId) {
s32 id = func_80041F10(colCtx, poly, bgId);
if (id < 0 || id > 13) { if (sfxType < 0 || sfxType >= ARRAY_COUNT(D_80119E10)) {
return NA_SE_PL_WALK_GROUND - SFX_FLAG; return NA_SE_PL_WALK_GROUND - SFX_FLAG;
} }
return D_80119E10[id]; return D_80119E10[sfxType];
} }
/** u32 SurfaceType_GetFloorEffect(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId) {
* SurfaceType get terrain slope surface
*/
u32 SurfaceType_GetSlope(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId) {
return SurfaceType_GetData(colCtx, poly, bgId, 1) >> 4 & 3; return SurfaceType_GetData(colCtx, poly, bgId, 1) >> 4 & 3;
} }
/** u32 SurfaceType_GetLightSetting(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId) {
* SurfaceType get surface lighting setting
*/
u32 SurfaceType_GetLightSettingIndex(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId) {
return SurfaceType_GetData(colCtx, poly, bgId, 1) >> 6 & 0x1F; return SurfaceType_GetData(colCtx, poly, bgId, 1) >> 6 & 0x1F;
} }
/**
* SurfaceType get echo
*/
u32 SurfaceType_GetEcho(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId) { u32 SurfaceType_GetEcho(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId) {
return SurfaceType_GetData(colCtx, poly, bgId, 1) >> 11 & 0x3F; return SurfaceType_GetData(colCtx, poly, bgId, 1) >> 11 & 0x3F;
} }
/** u32 SurfaceType_CanHookshot(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId) {
* SurfaceType Is Hookshot Surface
*/
u32 SurfaceType_IsHookshotSurface(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId) {
return SurfaceType_GetData(colCtx, poly, bgId, 1) >> 17 & 1; return SurfaceType_GetData(colCtx, poly, bgId, 1) >> 17 & 1;
} }
@ -4146,26 +4109,19 @@ s32 SurfaceType_IsFloorConveyor(CollisionContext* colCtx, CollisionPoly* poly, s
return !!flags; return !!flags;
} }
/**
* SurfaceType Get Conveyor Surface Speed
*/
u32 SurfaceType_GetConveyorSpeed(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId) { u32 SurfaceType_GetConveyorSpeed(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId) {
return SurfaceType_GetData(colCtx, poly, bgId, 1) >> 18 & 7; return SurfaceType_GetData(colCtx, poly, bgId, 1) >> 18 & 7;
} }
/** /**
* SurfaceType Get Conveyor Direction
* returns a value between 0-63, representing 360 / 64 degrees of rotation * returns a value between 0-63, representing 360 / 64 degrees of rotation
*/ */
u32 SurfaceType_GetConveyorDirection(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId) { u32 SurfaceType_GetConveyorDirection(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId) {
return SurfaceType_GetData(colCtx, poly, bgId, 1) >> 21 & 0x3F; return SurfaceType_GetData(colCtx, poly, bgId, 1) >> 21 & 0x3F;
} }
/** u32 func_80042108(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId) {
* SurfaceType is Wall Damage return (SurfaceType_GetData(colCtx, poly, bgId, 1) & 0x08000000) ? 1 : 0;
*/
u32 SurfaceType_IsWallDamage(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId) {
return (SurfaceType_GetData(colCtx, poly, bgId, 1) & 0x8000000) ? 1 : 0;
} }
/** /**

View file

@ -427,7 +427,7 @@ f32 Camera_GetFloorYLayer(Camera* camera, Vec3f* norm, Vec3f* pos, s32* bgId) {
norm->z = 0.0f; norm->z = 0.0f;
floorY = BGCHECK_Y_MIN; floorY = BGCHECK_Y_MIN;
break; break;
} else if (func_80041D4C(colCtx, floorPoly, *bgId) == 1) { } else if (SurfaceType_GetFloorType(colCtx, floorPoly, *bgId) == FLOOR_TYPE_1) {
// floor is not solid, check below that floor. // floor is not solid, check below that floor.
pos->y = floorY - 10.0f; pos->y = floorY - 10.0f;
continue; continue;

View file

@ -1037,9 +1037,9 @@ void func_8008F87C(PlayState* play, Player* this, SkelAnime* skelAnime, Vec3f* p
skelAnime->jointTable[shinLimbIndex].z = skelAnime->jointTable[shinLimbIndex].z + temp1; skelAnime->jointTable[shinLimbIndex].z = skelAnime->jointTable[shinLimbIndex].z + temp1;
skelAnime->jointTable[footLimbIndex].z = skelAnime->jointTable[footLimbIndex].z + temp2 - temp1; skelAnime->jointTable[footLimbIndex].z = skelAnime->jointTable[footLimbIndex].z + temp2 - temp1;
temp3 = func_80041D4C(&play->colCtx, sp88, sp84); temp3 = SurfaceType_GetFloorType(&play->colCtx, sp88, sp84);
if ((temp3 >= 2) && (temp3 < 4) && !SurfaceType_IsWallDamage(&play->colCtx, sp88, sp84)) { if ((temp3 >= FLOOR_TYPE_2) && (temp3 <= FLOOR_TYPE_3) && !func_80042108(&play->colCtx, sp88, sp84)) {
footprintPos.y = sp80; footprintPos.y = sp80;
EffectSsGFire_Spawn(play, &footprintPos); EffectSsGFire_Spawn(play, &footprintPos);
} }

View file

@ -266,7 +266,7 @@ void ArmsHook_Shoot(ArmsHook* this, PlayState* play) {
this->actor.world.pos.x += 10.0f * polyNormalX; this->actor.world.pos.x += 10.0f * polyNormalX;
this->actor.world.pos.z += 10.0f * polyNormalZ; this->actor.world.pos.z += 10.0f * polyNormalZ;
this->timer = 0; this->timer = 0;
if (SurfaceType_IsHookshotSurface(&play->colCtx, poly, bgId)) { if (SurfaceType_CanHookshot(&play->colCtx, poly, bgId)) {
if (bgId != BGCHECK_SCENE) { if (bgId != BGCHECK_SCENE) {
dynaPolyActor = DynaPoly_GetActor(&play->colCtx, bgId); dynaPolyActor = DynaPoly_GetActor(&play->colCtx, bgId);
if (dynaPolyActor != NULL) { if (dynaPolyActor != NULL) {

View file

@ -251,9 +251,9 @@ void func_8088B79C(BgHidanRock* this, PlayState* play) {
} }
Audio_PlayActorSfx2(&this->dyna.actor, NA_SE_EV_BLOCK_BOUND); Audio_PlayActorSfx2(&this->dyna.actor, NA_SE_EV_BLOCK_BOUND);
Audio_PlayActorSfx2(&this->dyna.actor, Audio_PlayActorSfx2(
SurfaceType_GetSfx(&play->colCtx, this->dyna.actor.floorPoly, this->dyna.actor.floorBgId) + &this->dyna.actor,
SFX_FLAG); SurfaceType_GetSfxId(&play->colCtx, this->dyna.actor.floorPoly, this->dyna.actor.floorBgId) + SFX_FLAG);
} }
this->unk_16C -= 0.5f; this->unk_16C -= 0.5f;

View file

@ -719,7 +719,7 @@ void func_80986570(DemoIm* this, PlayState* play) {
if (Animation_OnFrame(&this->skelAnime, 7.0f) && (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND)) { if (Animation_OnFrame(&this->skelAnime, 7.0f) && (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND)) {
u32 sfxId = SFX_FLAG; u32 sfxId = SFX_FLAG;
sfxId += SurfaceType_GetSfx(&play->colCtx, this->actor.floorPoly, this->actor.floorBgId); sfxId += SurfaceType_GetSfxId(&play->colCtx, this->actor.floorPoly, this->actor.floorBgId);
Audio_PlaySfxGeneral(sfxId, &this->actor.projectedPos, 4, &gSfxDefaultFreqAndVolScale, Audio_PlaySfxGeneral(sfxId, &this->actor.projectedPos, 4, &gSfxDefaultFreqAndVolScale,
&gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb);
} }

View file

@ -693,9 +693,9 @@ void EnBb_Down(EnBb* this, PlayState* play) {
} }
if (this->actor.bgCheckFlags & (BGCHECKFLAG_GROUND | BGCHECKFLAG_GROUND_TOUCH)) { if (this->actor.bgCheckFlags & (BGCHECKFLAG_GROUND | BGCHECKFLAG_GROUND_TOUCH)) {
if (this->actor.params == ENBB_RED) { if (this->actor.params == ENBB_RED) {
s32 floorType = func_80041D4C(&play->colCtx, this->actor.floorPoly, this->actor.floorBgId); s32 floorType = SurfaceType_GetFloorType(&play->colCtx, this->actor.floorPoly, this->actor.floorBgId);
if ((floorType == 2) || (floorType == 3) || (floorType == 9)) { if ((floorType == FLOOR_TYPE_2) || (floorType == FLOOR_TYPE_3) || (floorType == FLOOR_TYPE_9)) {
this->moveMode = BBMOVE_HIDDEN; this->moveMode = BBMOVE_HIDDEN;
this->timer = 10; this->timer = 10;
this->actionState++; this->actionState++;
@ -812,8 +812,8 @@ void EnBb_Red(EnBb* this, PlayState* play) {
this->actor.bgCheckFlags &= ~BGCHECKFLAG_WALL; this->actor.bgCheckFlags &= ~BGCHECKFLAG_WALL;
} }
if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) {
floorType = func_80041D4C(&play->colCtx, this->actor.floorPoly, this->actor.floorBgId); floorType = SurfaceType_GetFloorType(&play->colCtx, this->actor.floorPoly, this->actor.floorBgId);
if ((floorType == 2) || (floorType == 3) || (floorType == 9)) { if ((floorType == FLOOR_TYPE_2) || (floorType == FLOOR_TYPE_3) || (floorType == FLOOR_TYPE_9)) {
this->moveMode = BBMOVE_HIDDEN; this->moveMode = BBMOVE_HIDDEN;
this->timer = 10; this->timer = 10;
this->actionState++; this->actionState++;

View file

@ -275,7 +275,8 @@ void EnBomChu_Move(EnBomChu* this, PlayState* play) {
if (BgCheck_EntityLineTest1(&play->colCtx, &posA, &posB, &posUpDown, &polyUpDown, true, true, true, true, if (BgCheck_EntityLineTest1(&play->colCtx, &posA, &posB, &posUpDown, &polyUpDown, true, true, true, true,
&bgIdUpDown) && &bgIdUpDown) &&
!(func_80041DB8(&play->colCtx, polyUpDown, bgIdUpDown) & 0x30) && // && not crawl space? !(SurfaceType_GetWallFlags(&play->colCtx, polyUpDown, bgIdUpDown) &
(WALL_FLAG_4 | WALL_FLAG_5)) && // && not crawl space?
!SurfaceType_IsIgnoredByProjectiles(&play->colCtx, polyUpDown, bgIdUpDown)) { !SurfaceType_IsIgnoredByProjectiles(&play->colCtx, polyUpDown, bgIdUpDown)) {
// forwards // forwards
posB.x = (this->axisForwards.x * lineLength) + posA.x; posB.x = (this->axisForwards.x * lineLength) + posA.x;
@ -284,7 +285,7 @@ void EnBomChu_Move(EnBomChu* this, PlayState* play) {
if (BgCheck_EntityLineTest1(&play->colCtx, &posA, &posB, &posSide, &polySide, true, true, true, true, if (BgCheck_EntityLineTest1(&play->colCtx, &posA, &posB, &posSide, &polySide, true, true, true, true,
&bgIdSide) && &bgIdSide) &&
!(func_80041DB8(&play->colCtx, polySide, bgIdSide) & 0x30) && !(SurfaceType_GetWallFlags(&play->colCtx, polySide, bgIdSide) & (WALL_FLAG_4 | WALL_FLAG_5)) &&
!SurfaceType_IsIgnoredByProjectiles(&play->colCtx, polySide, bgIdSide)) { !SurfaceType_IsIgnoredByProjectiles(&play->colCtx, polySide, bgIdSide)) {
EnBomChu_UpdateFloorPoly(this, polySide, play); EnBomChu_UpdateFloorPoly(this, polySide, play);
this->actor.world.pos = posSide; this->actor.world.pos = posSide;
@ -323,7 +324,7 @@ void EnBomChu_Move(EnBomChu* this, PlayState* play) {
if (BgCheck_EntityLineTest1(&play->colCtx, &posA, &posB, &posSide, &polySide, true, true, true, true, if (BgCheck_EntityLineTest1(&play->colCtx, &posA, &posB, &posSide, &polySide, true, true, true, true,
&bgIdSide) && &bgIdSide) &&
!(func_80041DB8(&play->colCtx, polySide, bgIdSide) & 0x30) && !(SurfaceType_GetWallFlags(&play->colCtx, polySide, bgIdSide) & (WALL_FLAG_4 | WALL_FLAG_5)) &&
!SurfaceType_IsIgnoredByProjectiles(&play->colCtx, polySide, bgIdSide)) { !SurfaceType_IsIgnoredByProjectiles(&play->colCtx, polySide, bgIdSide)) {
EnBomChu_UpdateFloorPoly(this, polySide, play); EnBomChu_UpdateFloorPoly(this, polySide, play);
this->actor.world.pos = posSide; this->actor.world.pos = posSide;

View file

@ -455,8 +455,8 @@ void func_809CF984(EnBw* this, PlayState* play) {
} }
SkelAnime_Update(&this->skelAnime); SkelAnime_Update(&this->skelAnime);
if (this->actor.bgCheckFlags & (BGCHECKFLAG_GROUND | BGCHECKFLAG_GROUND_TOUCH)) { if (this->actor.bgCheckFlags & (BGCHECKFLAG_GROUND | BGCHECKFLAG_GROUND_TOUCH)) {
floorPolyType = func_80041D4C(&play->colCtx, this->actor.floorPoly, this->actor.floorBgId); floorPolyType = SurfaceType_GetFloorType(&play->colCtx, this->actor.floorPoly, this->actor.floorBgId);
if ((floorPolyType == 2) || (floorPolyType == 3) || (floorPolyType == 9)) { if ((floorPolyType == FLOOR_TYPE_2) || (floorPolyType == FLOOR_TYPE_3) || (floorPolyType == FLOOR_TYPE_9)) {
Actor_Kill(&this->actor); Actor_Kill(&this->actor);
return; return;
} }

View file

@ -107,8 +107,8 @@ void EnEncount1_SpawnLeevers(EnEncount1* this, PlayState* play) {
if ((this->timer == 0) && (play->csCtx.state == CS_STATE_IDLE) && (this->curNumSpawn <= this->maxCurSpawns) && if ((this->timer == 0) && (play->csCtx.state == CS_STATE_IDLE) && (this->curNumSpawn <= this->maxCurSpawns) &&
(this->curNumSpawn < 5)) { (this->curNumSpawn < 5)) {
floorType = func_80041D4C(&play->colCtx, player->actor.floorPoly, player->actor.floorBgId); floorType = SurfaceType_GetFloorType(&play->colCtx, player->actor.floorPoly, player->actor.floorBgId);
if ((floorType != 4) && (floorType != 7) && (floorType != 12)) { if ((floorType != FLOOR_TYPE_4) && (floorType != FLOOR_TYPE_7) && (floorType != FLOOR_TYPE_12)) {
this->numLeeverSpawns = 0; this->numLeeverSpawns = 0;
} else if (!(this->reduceLeevers && (this->actor.xzDistToPlayer > 1300.0f))) { } else if (!(this->reduceLeevers && (this->actor.xzDistToPlayer > 1300.0f))) {
spawnLimit = 5; spawnLimit = 5;
@ -241,7 +241,7 @@ void EnEncount1_SpawnStalchildOrWolfos(EnEncount1* this, PlayState* play) {
if ((this->curNumSpawn < this->maxCurSpawns) && (this->totalNumSpawn < this->maxTotalSpawns)) { if ((this->curNumSpawn < this->maxCurSpawns) && (this->totalNumSpawn < this->maxTotalSpawns)) {
while ((this->curNumSpawn < this->maxCurSpawns) && (this->totalNumSpawn < this->maxTotalSpawns)) { while ((this->curNumSpawn < this->maxCurSpawns) && (this->totalNumSpawn < this->maxTotalSpawns)) {
if (play->sceneNum == SCENE_SPOT00) { if (play->sceneNum == SCENE_SPOT00) {
if ((player->unk_89E == 0) || (player->actor.floorBgId != BGCHECK_SCENE) || if ((player->unk_89E == SURFACE_SFX_TYPE_0) || (player->actor.floorBgId != BGCHECK_SCENE) ||
!(player->actor.bgCheckFlags & BGCHECKFLAG_GROUND) || (player->stateFlags1 & PLAYER_STATE1_27)) { !(player->actor.bgCheckFlags & BGCHECKFLAG_GROUND) || (player->stateFlags1 & PLAYER_STATE1_27)) {
this->fieldSpawnTimer = 60; this->fieldSpawnTimer = 60;

View file

@ -2854,7 +2854,7 @@ s32 EnHorse_CalcFloorHeight(EnHorse* this, PlayState* play, Vec3f* pos, Collisio
if ((*floorPoly)->normal.y * COLPOLY_NORMAL_FRAC < 0.81915206f || // cos(35 degrees) if ((*floorPoly)->normal.y * COLPOLY_NORMAL_FRAC < 0.81915206f || // cos(35 degrees)
SurfaceType_IsHorseBlocked(&play->colCtx, *floorPoly, bgId) || SurfaceType_IsHorseBlocked(&play->colCtx, *floorPoly, bgId) ||
func_80041D4C(&play->colCtx, *floorPoly, bgId) == 7) { SurfaceType_GetFloorType(&play->colCtx, *floorPoly, bgId) == FLOOR_TYPE_7) {
return 3; // Horse blocked surface return 3; // Horse blocked surface
} }
return 0; return 0;
@ -2983,7 +2983,7 @@ void EnHorse_CheckFloors(EnHorse* this, PlayState* play) {
if (ny < 0.81915206f || // cos(35 degrees) if (ny < 0.81915206f || // cos(35 degrees)
SurfaceType_IsHorseBlocked(&play->colCtx, this->actor.floorPoly, this->actor.floorBgId) || SurfaceType_IsHorseBlocked(&play->colCtx, this->actor.floorPoly, this->actor.floorBgId) ||
func_80041D4C(&play->colCtx, this->actor.floorPoly, this->actor.floorBgId) == 7) { SurfaceType_GetFloorType(&play->colCtx, this->actor.floorPoly, this->actor.floorBgId) == FLOOR_TYPE_7) {
if (this->actor.speedXZ >= 0.0f) { if (this->actor.speedXZ >= 0.0f) {
EnHorse_ObstructMovement(this, play, 4, galloping); EnHorse_ObstructMovement(this, play, 4, galloping);
} else { } else {
@ -3252,7 +3252,7 @@ void EnHorse_UpdateBgCheckInfo(EnHorse* this, PlayState* play) {
ny = obstacleFloor->normal.y * COLPOLY_NORMAL_FRAC; ny = obstacleFloor->normal.y * COLPOLY_NORMAL_FRAC;
if (ny < 0.81915206f || // cos(35 degrees) if (ny < 0.81915206f || // cos(35 degrees)
(SurfaceType_IsHorseBlocked(&play->colCtx, obstacleFloor, bgId) != 0) || (SurfaceType_IsHorseBlocked(&play->colCtx, obstacleFloor, bgId) != 0) ||
(func_80041D4C(&play->colCtx, obstacleFloor, bgId) == 7)) { (SurfaceType_GetFloorType(&play->colCtx, obstacleFloor, bgId) == FLOOR_TYPE_7)) {
if (movingFast == true && this->action != ENHORSE_ACT_STOPPING) { if (movingFast == true && this->action != ENHORSE_ACT_STOPPING) {
this->stateFlags |= ENHORSE_FORCE_REVERSING; this->stateFlags |= ENHORSE_FORCE_REVERSING;
EnHorse_StartBraking(this, play); EnHorse_StartBraking(this, play);
@ -3289,7 +3289,7 @@ void EnHorse_UpdateBgCheckInfo(EnHorse* this, PlayState* play) {
ny = obstacleFloor->normal.y * COLPOLY_NORMAL_FRAC; ny = obstacleFloor->normal.y * COLPOLY_NORMAL_FRAC;
if (ny < 0.81915206f || // cos(35 degrees) if (ny < 0.81915206f || // cos(35 degrees)
SurfaceType_IsHorseBlocked(&play->colCtx, obstacleFloor, bgId) || SurfaceType_IsHorseBlocked(&play->colCtx, obstacleFloor, bgId) ||
func_80041D4C(&play->colCtx, obstacleFloor, bgId) == 7) { SurfaceType_GetFloorType(&play->colCtx, obstacleFloor, bgId) == FLOOR_TYPE_7) {
if (movingFast == true && this->action != ENHORSE_ACT_STOPPING) { if (movingFast == true && this->action != ENHORSE_ACT_STOPPING) {
this->stateFlags |= ENHORSE_FORCE_REVERSING; this->stateFlags |= ENHORSE_FORCE_REVERSING;
EnHorse_StartBraking(this, play); EnHorse_StartBraking(this, play);
@ -3460,7 +3460,7 @@ s32 EnHorse_UpdateConveyors(EnHorse* this, PlayState* play) {
return 0; return 0;
} }
conveyorDir = SurfaceType_GetConveyorDirection(&play->colCtx, this->actor.floorPoly, this->actor.floorBgId); conveyorDir = SurfaceType_GetConveyorDirection(&play->colCtx, this->actor.floorPoly, this->actor.floorBgId);
conveyorDir = (conveyorDir * (0x10000 / 64)) - this->actor.world.rot.y; conveyorDir = CONVEYOR_DIRECTION_TO_BINANG(conveyorDir) - this->actor.world.rot.y;
if (conveyorDir > 800.0f) { if (conveyorDir > 800.0f) {
this->actor.world.rot.y += 800.0f; this->actor.world.rot.y += 800.0f;
} else if (conveyorDir < -800.0f) { } else if (conveyorDir < -800.0f) {

View file

@ -174,7 +174,7 @@ void EnJs_Update(Actor* thisx, PlayState* play) {
Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, UPDBGCHECKINFO_FLAG_2); Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, UPDBGCHECKINFO_FLAG_2);
if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) {
if (SurfaceType_GetSfx(&play->colCtx, this->actor.floorPoly, this->actor.floorBgId) == if (SurfaceType_GetSfxId(&play->colCtx, this->actor.floorPoly, this->actor.floorBgId) ==
(NA_SE_PL_WALK_SAND - SFX_FLAG)) { (NA_SE_PL_WALK_SAND - SFX_FLAG)) {
Math_ApproachF(&this->actor.shape.yOffset, sREG(80) + -2000.0f, 1.0f, (sREG(81) / 10.0f) + 50.0f); Math_ApproachF(&this->actor.shape.yOffset, sREG(80) + -2000.0f, 1.0f, (sREG(81) / 10.0f) + 50.0f);
} }

View file

@ -133,9 +133,9 @@ void EnReeba_Init(Actor* thisx, PlayState* play) {
UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2 | UPDBGCHECKINFO_FLAG_3 | UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2 | UPDBGCHECKINFO_FLAG_3 |
UPDBGCHECKINFO_FLAG_4); UPDBGCHECKINFO_FLAG_4);
surfaceType = func_80041D4C(&play->colCtx, this->actor.floorPoly, this->actor.floorBgId); surfaceType = SurfaceType_GetFloorType(&play->colCtx, this->actor.floorPoly, this->actor.floorBgId);
if ((surfaceType != 4) && (surfaceType != 7)) { if ((surfaceType != FLOOR_TYPE_4) && (surfaceType != FLOOR_TYPE_7)) {
Actor_Kill(&this->actor); Actor_Kill(&this->actor);
return; return;
} }
@ -251,9 +251,9 @@ void func_80AE5270(EnReeba* this, PlayState* play) {
Math_ApproachF(&this->actor.shape.shadowScale, 12.0f, 3.0f, 1.0f); Math_ApproachF(&this->actor.shape.shadowScale, 12.0f, 3.0f, 1.0f);
} }
surfaceType = func_80041D4C(&play->colCtx, this->actor.floorPoly, this->actor.floorBgId); surfaceType = SurfaceType_GetFloorType(&play->colCtx, this->actor.floorPoly, this->actor.floorBgId);
if ((surfaceType != 4) && (surfaceType != 7)) { if ((surfaceType != FLOOR_TYPE_4) && (surfaceType != FLOOR_TYPE_7)) {
this->actor.speedXZ = 0.0f; this->actor.speedXZ = 0.0f;
this->actionfunc = func_80AE5688; this->actionfunc = func_80AE5688;
} else if ((this->unk_272 == 0) || (this->actor.xzDistToPlayer < 30.0f) || (this->actor.xzDistToPlayer > 400.0f) || } else if ((this->unk_272 == 0) || (this->actor.xzDistToPlayer < 30.0f) || (this->actor.xzDistToPlayer > 400.0f) ||
@ -282,9 +282,9 @@ void func_80AE53AC(EnReeba* this, PlayState* play) {
Math_ApproachF(&this->actor.shape.shadowScale, 12.0f, 3.0f, 1.0f); Math_ApproachF(&this->actor.shape.shadowScale, 12.0f, 3.0f, 1.0f);
} }
surfaceType = func_80041D4C(&play->colCtx, this->actor.floorPoly, this->actor.floorBgId); surfaceType = SurfaceType_GetFloorType(&play->colCtx, this->actor.floorPoly, this->actor.floorBgId);
if (((surfaceType != 4) && (surfaceType != 7)) || (this->actor.xzDistToPlayer > 400.0f) || if (((surfaceType != FLOOR_TYPE_4) && (surfaceType != FLOOR_TYPE_7)) || (this->actor.xzDistToPlayer > 400.0f) ||
(this->actor.bgCheckFlags & BGCHECKFLAG_WALL)) { (this->actor.bgCheckFlags & BGCHECKFLAG_WALL)) {
this->actionfunc = func_80AE5688; this->actionfunc = func_80AE5688;
} else { } else {

View file

@ -208,10 +208,10 @@ void EnRiverSound_Update(Actor* thisx, PlayState* play) {
// Get the river sfx frequency based on the speed of the river current under the actor // Get the river sfx frequency based on the speed of the river current under the actor
this->sfxFreqIndex = SurfaceType_GetConveyorSpeed(&play->colCtx, thisx->floorPoly, bgId); this->sfxFreqIndex = SurfaceType_GetConveyorSpeed(&play->colCtx, thisx->floorPoly, bgId);
} else { } else {
this->sfxFreqIndex = 0; this->sfxFreqIndex = CONVEYOR_SPEED_DISABLED;
} }
if (this->sfxFreqIndex == 0) { if (this->sfxFreqIndex == CONVEYOR_SPEED_DISABLED) {
if (thisx->params == RS_RIVER_DEFAULT_MEDIUM_FREQ) { if (thisx->params == RS_RIVER_DEFAULT_MEDIUM_FREQ) {
this->sfxFreqIndex = 0; this->sfxFreqIndex = 0;
} else if (thisx->params == RS_RIVER_DEFAULT_LOW_FREQ) { } else if (thisx->params == RS_RIVER_DEFAULT_LOW_FREQ) {
@ -222,7 +222,7 @@ void EnRiverSound_Update(Actor* thisx, PlayState* play) {
} }
} else { } else {
this->sfxFreqIndex--; this->sfxFreqIndex--;
this->sfxFreqIndex = CLAMP_MAX(this->sfxFreqIndex, 2); this->sfxFreqIndex = CLAMP_MAX(this->sfxFreqIndex, CONVEYOR_SPEED_MAX - 2);
} }
} }
} else if ((thisx->params == RS_GORON_CITY_SARIAS_SONG) || (thisx->params == RS_GREAT_FAIRY)) { } else if ((thisx->params == RS_GORON_CITY_SARIAS_SONG) || (thisx->params == RS_GREAT_FAIRY)) {
@ -257,10 +257,14 @@ void EnRiverSound_Draw(Actor* thisx, PlayState* play) {
NA_SE_EV_TORCH - SFX_FLAG, NA_SE_EV_TORCH - SFX_FLAG,
NA_SE_EV_COW_CRY_LV - SFX_FLAG, NA_SE_EV_COW_CRY_LV - SFX_FLAG,
}; };
static f32 sfxFreqs[] = { 0.7f, 1.0f, 1.4f }; static f32 sfxFreqs[CONVEYOR_SPEED_MAX - 1] = {
0.7f, // CONVEYOR_SPEED_SLOW
1.0f, // CONVEYOR_SPEED_MEDIUM
1.4f, // CONVEYOR_SPEED_FAST
};
EnRiverSound* this = (EnRiverSound*)thisx; EnRiverSound* this = (EnRiverSound*)thisx;
if (!(this->playSfx)) { if (!this->playSfx) {
this->playSfx = true; this->playSfx = true;
} else if ((this->actor.params == RS_RIVER_DEFAULT_LOW_FREQ) || } else if ((this->actor.params == RS_RIVER_DEFAULT_LOW_FREQ) ||
(this->actor.params == RS_RIVER_DEFAULT_MEDIUM_FREQ) || (this->actor.params == RS_RIVER_DEFAULT_MEDIUM_FREQ) ||

View file

@ -122,7 +122,7 @@ CollisionPoly* func_80B0C020(PlayState* play, Vec3f* arg1, Vec3f* arg2, Vec3f* a
return NULL; return NULL;
} }
if (func_80041DB8(&play->colCtx, sp3C, *arg4) & 0x30) { if (SurfaceType_GetWallFlags(&play->colCtx, sp3C, *arg4) & (WALL_FLAG_4 | WALL_FLAG_5)) {
return NULL; return NULL;
} }

View file

@ -1723,10 +1723,10 @@ void EnTest_Update(Actor* thisx, PlayState* play) {
this->actor.floorHeight = this->actor.home.pos.y; this->actor.floorHeight = this->actor.home.pos.y;
} }
} else if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND_TOUCH) { } else if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND_TOUCH) {
floorProperty = func_80041EA4(&play->colCtx, this->actor.floorPoly, this->actor.floorBgId); floorProperty = SurfaceType_GetFloorProperty(&play->colCtx, this->actor.floorPoly, this->actor.floorBgId);
if ((floorProperty == 5) || (floorProperty == 0xC) || if ((floorProperty == FLOOR_PROPERTY_5) || (floorProperty == FLOOR_PROPERTY_12) ||
func_80041D4C(&play->colCtx, this->actor.floorPoly, this->actor.floorBgId) == 9) { SurfaceType_GetFloorType(&play->colCtx, this->actor.floorPoly, this->actor.floorBgId) == FLOOR_TYPE_9) {
Actor_Kill(&this->actor); Actor_Kill(&this->actor);
return; return;
} }

View file

@ -372,7 +372,7 @@ void EnXc_SetWalkingSFX(EnXc* this, PlayState* play) {
if (Animation_OnFrame(&this->skelAnime, 11.0f) || Animation_OnFrame(&this->skelAnime, 23.0f)) { if (Animation_OnFrame(&this->skelAnime, 11.0f) || Animation_OnFrame(&this->skelAnime, 23.0f)) {
if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) {
sfxId = SFX_FLAG; sfxId = SFX_FLAG;
sfxId += SurfaceType_GetSfx(&play->colCtx, this->actor.floorPoly, this->actor.floorBgId); sfxId += SurfaceType_GetSfxId(&play->colCtx, this->actor.floorPoly, this->actor.floorBgId);
func_80078914(&this->actor.projectedPos, sfxId); func_80078914(&this->actor.projectedPos, sfxId);
} }
} }
@ -386,7 +386,7 @@ void EnXc_SetNutThrowSFX(EnXc* this, PlayState* play) {
if (Animation_OnFrame(&this->skelAnime, 7.0f)) { if (Animation_OnFrame(&this->skelAnime, 7.0f)) {
if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) {
sfxId = SFX_FLAG; sfxId = SFX_FLAG;
sfxId += SurfaceType_GetSfx(&play->colCtx, this->actor.floorPoly, this->actor.floorBgId); sfxId += SurfaceType_GetSfxId(&play->colCtx, this->actor.floorPoly, this->actor.floorBgId);
func_80078914(&this->actor.projectedPos, sfxId); func_80078914(&this->actor.projectedPos, sfxId);
} }
} }
@ -402,7 +402,7 @@ void EnXc_SetLandingSFX(EnXc* this, PlayState* play) {
if ((gSaveContext.sceneLayer != 4) || (sceneNum != SCENE_SPOT11)) { if ((gSaveContext.sceneLayer != 4) || (sceneNum != SCENE_SPOT11)) {
if (Animation_OnFrame(&this->skelAnime, 11.0f)) { if (Animation_OnFrame(&this->skelAnime, 11.0f)) {
sfxId = SFX_FLAG; sfxId = SFX_FLAG;
sfxId += SurfaceType_GetSfx(&play->colCtx, this->actor.floorPoly, this->actor.floorBgId); sfxId += SurfaceType_GetSfxId(&play->colCtx, this->actor.floorPoly, this->actor.floorBgId);
func_80078914(&this->actor.projectedPos, sfxId); func_80078914(&this->actor.projectedPos, sfxId);
} }
} }

View file

@ -1437,7 +1437,7 @@ void func_80B51D24(EnZl2* this, PlayState* play) {
if (Animation_OnFrame(skelAnime, 6.0f) || Animation_OnFrame(skelAnime, 0.0f)) { if (Animation_OnFrame(skelAnime, 6.0f) || Animation_OnFrame(skelAnime, 0.0f)) {
if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) {
sfxId = SFX_FLAG; sfxId = SFX_FLAG;
sfxId += SurfaceType_GetSfx(&play->colCtx, this->actor.floorPoly, this->actor.floorBgId); sfxId += SurfaceType_GetSfxId(&play->colCtx, this->actor.floorPoly, this->actor.floorBgId);
func_80078914(&this->actor.projectedPos, sfxId); func_80078914(&this->actor.projectedPos, sfxId);
} }
} }

View file

@ -1558,7 +1558,7 @@ void func_80B56E38(EnZl3* this, PlayState* play) {
if ((Animation_OnFrame(sp20, 6.0f) || Animation_OnFrame(sp20, 0.0f)) && if ((Animation_OnFrame(sp20, 6.0f) || Animation_OnFrame(sp20, 0.0f)) &&
(this->actor.bgCheckFlags & BGCHECKFLAG_GROUND)) { (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND)) {
sfxId = 0x800; sfxId = 0x800;
sfxId += SurfaceType_GetSfx(&play->colCtx, this->actor.floorPoly, this->actor.floorBgId); sfxId += SurfaceType_GetSfxId(&play->colCtx, this->actor.floorPoly, this->actor.floorBgId);
func_80078914(&this->actor.projectedPos, sfxId); func_80078914(&this->actor.projectedPos, sfxId);
} }
} }

View file

@ -604,8 +604,8 @@ void ObjOshihiki_Fall(ObjOshihiki* this, PlayState* play) {
ObjOshihiki_SetupOnActor(this, play); ObjOshihiki_SetupOnActor(this, play);
} }
Audio_PlayActorSfx2(&this->dyna.actor, NA_SE_EV_BLOCK_BOUND); Audio_PlayActorSfx2(&this->dyna.actor, NA_SE_EV_BLOCK_BOUND);
Audio_PlayActorSfx2(&this->dyna.actor, SurfaceType_GetSfx(&play->colCtx, this->floorPolys[this->highestFloor], Audio_PlayActorSfx2(&this->dyna.actor, SurfaceType_GetSfxId(&play->colCtx, this->floorPolys[this->highestFloor],
this->floorBgIds[this->highestFloor]) + this->floorBgIds[this->highestFloor]) +
SFX_FLAG); SFX_FLAG);
} }
} }

View file

@ -467,15 +467,15 @@ static f32 D_808535D4 = 0.0f;
static s16 D_808535D8 = 0; static s16 D_808535D8 = 0;
static s16 D_808535DC = 0; static s16 D_808535DC = 0;
static s32 D_808535E0 = 0; static s32 D_808535E0 = 0;
static s32 D_808535E4 = 0; static s32 D_808535E4 = FLOOR_TYPE_0;
static f32 D_808535E8 = 1.0f; static f32 D_808535E8 = 1.0f;
static f32 D_808535EC = 1.0f; static f32 D_808535EC = 1.0f;
static u32 D_808535F0 = 0; static u32 D_808535F0 = 0;
static u32 sConveyorSpeedIndex = 0; static u32 sConveyorSpeedIndex = CONVEYOR_SPEED_DISABLED;
static s16 sIsFloorConveyor = false; static s16 sIsFloorConveyor = false;
static s16 sConveyorYaw = 0; static s16 sConveyorYaw = 0;
static f32 D_80853600 = 0.0f; static f32 D_80853600 = 0.0f;
static s32 D_80853604 = 0; static s32 D_80853604 = FLOOR_PROPERTY_0;
static s32 D_80853608 = 0; static s32 D_80853608 = 0;
static s32 D_8085360C = 0; static s32 D_8085360C = 0;
static s16 D_80853610 = 0; static s16 D_80853610 = 0;
@ -3713,9 +3713,9 @@ void func_80837C0C(PlayState* play, Player* this, s32 arg2, f32 arg3, f32 arg4,
} }
s32 func_80838144(s32 arg0) { s32 func_80838144(s32 arg0) {
s32 temp = arg0 - 2; s32 temp = arg0 - FLOOR_TYPE_2;
if ((temp >= 0) && (temp < 2)) { if ((temp >= 0) && (temp <= (FLOOR_TYPE_3 - FLOOR_TYPE_2))) {
return temp; return temp;
} else { } else {
return -1; return -1;
@ -3723,7 +3723,7 @@ s32 func_80838144(s32 arg0) {
} }
s32 func_8083816C(s32 arg0) { s32 func_8083816C(s32 arg0) {
return (arg0 == 4) || (arg0 == 7) || (arg0 == 12); return (arg0 == FLOOR_TYPE_4) || (arg0 == FLOOR_TYPE_7) || (arg0 == FLOOR_TYPE_12);
} }
void func_8083819C(Player* this, PlayState* play) { void func_8083819C(Player* this, PlayState* play) {
@ -3771,7 +3771,7 @@ s32 func_808382DC(Player* this, PlayState* play) {
} else { } else {
sp68 = ((Player_GetHeight(this) - 8.0f) < (this->unk_6C4 * this->actor.scale.y)); sp68 = ((Player_GetHeight(this) - 8.0f) < (this->unk_6C4 * this->actor.scale.y));
if (sp68 || (this->actor.bgCheckFlags & BGCHECKFLAG_CRUSHED) || (D_808535E4 == 9) || if (sp68 || (this->actor.bgCheckFlags & BGCHECKFLAG_CRUSHED) || (D_808535E4 == FLOOR_TYPE_9) ||
(this->stateFlags2 & PLAYER_STATE2_31)) { (this->stateFlags2 & PLAYER_STATE2_31)) {
func_80832698(this, NA_SE_VO_LI_DAMAGE_S); func_80832698(this, NA_SE_VO_LI_DAMAGE_S);
@ -3898,9 +3898,8 @@ s32 func_808382DC(Player* this, PlayState* play) {
s32 sp48 = func_80838144(D_808535E4); s32 sp48 = func_80838144(D_808535E4);
if (((this->actor.wallPoly != NULL) && if (((this->actor.wallPoly != NULL) &&
SurfaceType_IsWallDamage(&play->colCtx, this->actor.wallPoly, this->actor.wallBgId)) || func_80042108(&play->colCtx, this->actor.wallPoly, this->actor.wallBgId)) ||
((sp48 >= 0) && ((sp48 >= 0) && func_80042108(&play->colCtx, this->actor.floorPoly, this->actor.floorBgId) &&
SurfaceType_IsWallDamage(&play->colCtx, this->actor.floorPoly, this->actor.floorBgId) &&
(this->unk_A79 >= D_808544F4[sp48])) || (this->unk_A79 >= D_808544F4[sp48])) ||
((sp48 >= 0) && ((sp48 >= 0) &&
((this->currentTunic != PLAYER_TUNIC_GORON) || (this->unk_A79 >= D_808544F4[sp48])))) { ((this->currentTunic != PLAYER_TUNIC_GORON) || (this->unk_A79 >= D_808544F4[sp48])))) {
@ -3964,7 +3963,7 @@ s32 func_80838A14(Player* this, PlayState* play) {
return 0; return 0;
} }
if ((this->actor.wallBgId != BGCHECK_SCENE) && (D_808535F0 & 0x40)) { if ((this->actor.wallBgId != BGCHECK_SCENE) && (D_808535F0 & WALL_FLAG_6)) {
if (this->unk_88D >= 6) { if (this->unk_88D >= 6) {
this->stateFlags2 |= PLAYER_STATE2_2; this->stateFlags2 |= PLAYER_STATE2_2;
if (CHECK_BTN_ALL(sControlInput->press.button, BTN_A)) { if (CHECK_BTN_ALL(sControlInput->press.button, BTN_A)) {
@ -4136,9 +4135,8 @@ s32 func_80839034(PlayState* play, Player* this, CollisionPoly* poly, u32 bgId)
if (!(this->stateFlags1 & PLAYER_STATE1_7) && (play->transitionTrigger == TRANS_TRIGGER_OFF) && if (!(this->stateFlags1 & PLAYER_STATE1_7) && (play->transitionTrigger == TRANS_TRIGGER_OFF) &&
(this->csMode == 0) && !(this->stateFlags1 & PLAYER_STATE1_0) && (this->csMode == 0) && !(this->stateFlags1 & PLAYER_STATE1_0) &&
(((poly != NULL) && (((poly != NULL) && (exitIndex = SurfaceType_GetExitIndex(&play->colCtx, poly, bgId), exitIndex != 0)) ||
(exitIndex = SurfaceType_GetSceneExitIndex(&play->colCtx, poly, bgId), exitIndex != 0)) || (func_8083816C(D_808535E4) && (this->unk_A7A == FLOOR_PROPERTY_12)))) {
(func_8083816C(D_808535E4) && (this->unk_A7A == 12)))) {
sp34 = this->unk_A84 - (s32)this->actor.world.pos.y; sp34 = this->unk_A84 - (s32)this->actor.world.pos.y;
@ -4165,7 +4163,7 @@ s32 func_80839034(PlayState* play, Player* this, CollisionPoly* poly, u32 bgId)
play->curSpawn]; play->curSpawn];
Scene_SetTransitionForNextEntrance(play); Scene_SetTransitionForNextEntrance(play);
} else { } else {
if (SurfaceType_GetSlope(&play->colCtx, poly, bgId) == 2) { if (SurfaceType_GetFloorEffect(&play->colCtx, poly, bgId) == FLOOR_EFFECT_2) {
gSaveContext.respawn[RESPAWN_MODE_DOWN].entranceIndex = play->nextEntranceIndex; gSaveContext.respawn[RESPAWN_MODE_DOWN].entranceIndex = play->nextEntranceIndex;
Play_TriggerVoidOut(play); Play_TriggerVoidOut(play);
gSaveContext.respawnFlag = -2; gSaveContext.respawnFlag = -2;
@ -4180,10 +4178,10 @@ s32 func_80839034(PlayState* play, Player* this, CollisionPoly* poly, u32 bgId)
if (!(this->stateFlags1 & (PLAYER_STATE1_23 | PLAYER_STATE1_29)) && if (!(this->stateFlags1 & (PLAYER_STATE1_23 | PLAYER_STATE1_29)) &&
!(this->stateFlags2 & PLAYER_STATE2_18) && !func_808332B8(this) && !(this->stateFlags2 & PLAYER_STATE2_18) && !func_808332B8(this) &&
(temp = func_80041D4C(&play->colCtx, poly, bgId), (temp != 10)) && (temp = SurfaceType_GetFloorType(&play->colCtx, poly, bgId), (temp != FLOOR_TYPE_10)) &&
((sp34 < 100) || (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND))) { ((sp34 < 100) || (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND))) {
if (temp == 11) { if (temp == FLOOR_TYPE_11) {
func_800788CC(NA_SE_OC_SECRET_HOLE_OUT); func_800788CC(NA_SE_OC_SECRET_HOLE_OUT);
func_800F6964(5); func_800F6964(5);
gSaveContext.seqId = (u8)NA_BGM_DISABLED; gSaveContext.seqId = (u8)NA_BGM_DISABLED;
@ -4202,7 +4200,7 @@ s32 func_80839034(PlayState* play, Player* this, CollisionPoly* poly, u32 bgId)
gSaveContext.entranceSpeed = linearVel; gSaveContext.entranceSpeed = linearVel;
} }
if (sConveyorSpeedIndex != 0) { if (sConveyorSpeedIndex != CONVEYOR_SPEED_DISABLED) {
yaw = sConveyorYaw; yaw = sConveyorYaw;
} else { } else {
yaw = this->actor.world.rot.y; yaw = this->actor.world.rot.y;
@ -4224,13 +4222,13 @@ s32 func_80839034(PlayState* play, Player* this, CollisionPoly* poly, u32 bgId)
if (play->transitionTrigger == TRANS_TRIGGER_OFF) { if (play->transitionTrigger == TRANS_TRIGGER_OFF) {
if ((this->actor.world.pos.y < -4000.0f) || if ((this->actor.world.pos.y < -4000.0f) ||
(((this->unk_A7A == 5) || (this->unk_A7A == 12)) && (((this->unk_A7A == FLOOR_PROPERTY_5) || (this->unk_A7A == FLOOR_PROPERTY_12)) &&
((D_80853600 < 100.0f) || (this->fallDistance > 400.0f) || ((D_80853600 < 100.0f) || (this->fallDistance > 400.0f) ||
((play->sceneNum != SCENE_HAKADAN) && (this->fallDistance > 200.0f)))) || ((play->sceneNum != SCENE_HAKADAN) && (this->fallDistance > 200.0f)))) ||
((play->sceneNum == SCENE_GANON_FINAL) && (this->fallDistance > 320.0f))) { ((play->sceneNum == SCENE_GANON_FINAL) && (this->fallDistance > 320.0f))) {
if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) {
if (this->unk_A7A == 5) { if (this->unk_A7A == FLOOR_PROPERTY_5) {
Play_TriggerRespawn(play); Play_TriggerRespawn(play);
} else { } else {
Play_TriggerVoidOut(play); Play_TriggerVoidOut(play);
@ -4240,7 +4238,7 @@ s32 func_80839034(PlayState* play, Player* this, CollisionPoly* poly, u32 bgId)
} else { } else {
func_80838F5C(play, this); func_80838F5C(play, this);
this->unk_850 = 9999; this->unk_850 = 9999;
if (this->unk_A7A == 5) { if (this->unk_A7A == FLOOR_PROPERTY_5) {
this->unk_84F = -1; this->unk_84F = -1;
} else { } else {
this->unk_84F = 1; this->unk_84F = 1;
@ -4700,8 +4698,8 @@ s32 func_8083A6AC(Player* this, PlayState* play) {
sp54 = Math3D_UDistPlaneToPos(nx, ny, nz, sp84->dist, &this->actor.world.pos); sp54 = Math3D_UDistPlaneToPos(nx, ny, nz, sp84->dist, &this->actor.world.pos);
sp50 = D_80853604 == 6; sp50 = D_80853604 == FLOOR_PROPERTY_6;
if (!sp50 && (func_80041DB8(&play->colCtx, sp84, sp80) & 8)) { if (!sp50 && (SurfaceType_GetWallFlags(&play->colCtx, sp84, sp80) & WALL_FLAG_3)) {
sp50 = 1; sp50 = 1;
} }
@ -4753,7 +4751,7 @@ void func_8083AA10(Player* this, PlayState* play) {
if (!(this->stateFlags1 & (PLAYER_STATE1_27 | PLAYER_STATE1_29)) && if (!(this->stateFlags1 & (PLAYER_STATE1_27 | PLAYER_STATE1_29)) &&
!(this->actor.bgCheckFlags & BGCHECKFLAG_GROUND)) { !(this->actor.bgCheckFlags & BGCHECKFLAG_GROUND)) {
if (!func_80838FB8(play, this)) { if (!func_80838FB8(play, this)) {
if (D_80853604 == 8) { if (D_80853604 == FLOOR_PROPERTY_8) {
this->actor.world.pos.x = this->actor.prevPos.x; this->actor.world.pos.x = this->actor.prevPos.x;
this->actor.world.pos.z = this->actor.prevPos.z; this->actor.world.pos.z = this->actor.prevPos.z;
return; return;
@ -4762,7 +4760,7 @@ void func_8083AA10(Player* this, PlayState* play) {
if (!(this->stateFlags3 & PLAYER_STATE3_1) && !(this->skelAnime.moveFlags & 0x80) && if (!(this->stateFlags3 & PLAYER_STATE3_1) && !(this->skelAnime.moveFlags & 0x80) &&
(func_8084411C != this->func_674) && (func_80844A44 != this->func_674)) { (func_8084411C != this->func_674) && (func_80844A44 != this->func_674)) {
if ((D_80853604 == 7) || (this->meleeWeaponState != 0)) { if ((D_80853604 == FLOOR_PROPERTY_7) || (this->meleeWeaponState != 0)) {
Math_Vec3f_Copy(&this->actor.world.pos, &this->actor.prevPos); Math_Vec3f_Copy(&this->actor.world.pos, &this->actor.prevPos);
func_80832210(this); func_80832210(this);
return; return;
@ -4770,7 +4768,7 @@ void func_8083AA10(Player* this, PlayState* play) {
if (this->hoverBootsTimer != 0) { if (this->hoverBootsTimer != 0) {
this->actor.velocity.y = 1.0f; this->actor.velocity.y = 1.0f;
D_80853604 = 9; D_80853604 = FLOOR_PROPERTY_9;
return; return;
} }
@ -4782,10 +4780,10 @@ void func_8083AA10(Player* this, PlayState* play) {
this->unk_89E = this->unk_A82; this->unk_89E = this->unk_A82;
if ((this->actor.bgCheckFlags & BGCHECKFLAG_GROUND_LEAVE) && !(this->stateFlags1 & PLAYER_STATE1_27) && if ((this->actor.bgCheckFlags & BGCHECKFLAG_GROUND_LEAVE) && !(this->stateFlags1 & PLAYER_STATE1_27) &&
(D_80853604 != 6) && (D_80853604 != 9) && (D_80853600 > 20.0f) && (this->meleeWeaponState == 0) && (D_80853604 != FLOOR_PROPERTY_6) && (D_80853604 != FLOOR_PROPERTY_9) && (D_80853600 > 20.0f) &&
(ABS(sp5C) < 0x2000) && (this->linearVelocity > 3.0f)) { (this->meleeWeaponState == 0) && (ABS(sp5C) < 0x2000) && (this->linearVelocity > 3.0f)) {
if ((D_80853604 == 11) && !(this->stateFlags1 & PLAYER_STATE1_11)) { if ((D_80853604 == FLOOR_PROPERTY_11) && !(this->stateFlags1 & PLAYER_STATE1_11)) {
sp40 = func_808396F4(play, this, &D_8085451C, &sp44, &sp58, &sp54); sp40 = func_808396F4(play, this, &D_8085451C, &sp44, &sp58, &sp54);
sp3C = this->actor.world.pos.y; sp3C = this->actor.world.pos.y;
@ -4802,7 +4800,8 @@ void func_8083AA10(Player* this, PlayState* play) {
return; return;
} }
if ((D_80853604 == 9) || (D_80853600 <= this->ageProperties->unk_34) || !func_8083A6AC(this, play)) { if ((D_80853604 == FLOOR_PROPERTY_9) || (D_80853600 <= this->ageProperties->unk_34) ||
!func_8083A6AC(this, play)) {
func_80832284(play, this, &gPlayerAnim_003040); func_80832284(play, this, &gPlayerAnim_003040);
return; return;
} }
@ -5180,7 +5179,7 @@ s32 func_8083BB20(Player* this) {
} }
s32 func_8083BBA0(Player* this, PlayState* play) { s32 func_8083BBA0(Player* this, PlayState* play) {
if (func_8083BB20(this) && (D_808535E4 != 7)) { if (func_8083BB20(this) && (D_808535E4 != FLOOR_TYPE_7)) {
func_8083BA90(play, this, PLAYER_MWA_JUMPSLASH_START, 3.0f, 4.5f); func_8083BA90(play, this, PLAYER_MWA_JUMPSLASH_START, 3.0f, 4.5f);
return 1; return 1;
} }
@ -5195,7 +5194,7 @@ void func_8083BC04(Player* this, PlayState* play) {
} }
s32 func_8083BC7C(Player* this, PlayState* play) { s32 func_8083BC7C(Player* this, PlayState* play) {
if ((this->unk_84B[this->unk_846] == 0) && (D_808535E4 != 7)) { if ((this->unk_84B[this->unk_846] == 0) && (D_808535E4 != FLOOR_TYPE_7)) {
func_8083BC04(this, play); func_8083BC04(this, play);
return 1; return 1;
} }
@ -5223,8 +5222,8 @@ s32 func_8083BDBC(Player* this, PlayState* play) {
s32 sp2C; s32 sp2C;
if (CHECK_BTN_ALL(sControlInput->press.button, BTN_A) && if (CHECK_BTN_ALL(sControlInput->press.button, BTN_A) &&
(play->roomCtx.curRoom.behaviorType1 != ROOM_BEHAVIOR_TYPE1_2) && (D_808535E4 != 7) && (play->roomCtx.curRoom.behaviorType1 != ROOM_BEHAVIOR_TYPE1_2) && (D_808535E4 != FLOOR_TYPE_7) &&
(SurfaceType_GetSlope(&play->colCtx, this->actor.floorPoly, this->actor.floorBgId) != 1)) { (SurfaceType_GetFloorEffect(&play->colCtx, this->actor.floorPoly, this->actor.floorBgId) != FLOOR_EFFECT_1)) {
sp2C = this->unk_84B[this->unk_846]; sp2C = this->unk_84B[this->unk_846];
if (sp2C <= 0) { if (sp2C <= 0) {
@ -5795,7 +5794,7 @@ void func_8083D6EC(PlayState* play, Player* this) {
temp1 = fabsf(this->linearVelocity) * 20.0f; temp1 = fabsf(this->linearVelocity) * 20.0f;
temp3 = 0.0f; temp3 = 0.0f;
if (D_808535E4 == 4) { if (D_808535E4 == FLOOR_TYPE_4) {
if (this->unk_6C4 > 1300.0f) { if (this->unk_6C4 > 1300.0f) {
temp2 = this->unk_6C4; temp2 = this->unk_6C4;
} else { } else {
@ -5810,7 +5809,7 @@ void func_8083D6EC(PlayState* play, Player* this) {
temp2 = 20000.0f; temp2 = 20000.0f;
if (this->currentBoots != PLAYER_BOOTS_HOVER) { if (this->currentBoots != PLAYER_BOOTS_HOVER) {
temp1 += temp1; temp1 += temp1;
} else if ((D_808535E4 == 7) || (this->currentBoots == PLAYER_BOOTS_IRON)) { } else if ((D_808535E4 == FLOOR_TYPE_7) || (this->currentBoots == PLAYER_BOOTS_IRON)) {
temp1 = 0; temp1 = 0;
} }
} }
@ -5912,7 +5911,7 @@ void func_8083DC54(Player* this, PlayState* play) {
return; return;
} }
if (D_808535E4 == 11) { if (D_808535E4 == FLOOR_TYPE_11) {
Math_SmoothStepToS(&this->actor.focus.rot.x, -20000, 10, 4000, 800); Math_SmoothStepToS(&this->actor.focus.rot.x, -20000, 10, 4000, 800);
} else { } else {
sp46 = 0; sp46 = 0;
@ -6042,7 +6041,7 @@ s32 func_8083E318(PlayState* play, Player* this, CollisionPoly* floorPoly) {
s16 velYawToDownwardSlope; s16 velYawToDownwardSlope;
if (!Player_InBlockingCsMode(play, this) && (func_8084F390 != this->func_674) && if (!Player_InBlockingCsMode(play, this) && (func_8084F390 != this->func_674) &&
(SurfaceType_GetSlope(&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 // Get direction of movement relative to the downward direction of the slope
playerVelYaw = Math_Atan2S(this->actor.velocity.z, this->actor.velocity.x); playerVelYaw = Math_Atan2S(this->actor.velocity.z, this->actor.velocity.x);
@ -6245,9 +6244,10 @@ s32 func_8083EC18(Player* this, PlayState* play, u32 arg2) {
if (this->wallHeight >= 79.0f) { if (this->wallHeight >= 79.0f) {
if (!(this->stateFlags1 & PLAYER_STATE1_27) || (this->currentBoots == PLAYER_BOOTS_IRON) || if (!(this->stateFlags1 & PLAYER_STATE1_27) || (this->currentBoots == PLAYER_BOOTS_IRON) ||
(this->actor.yDistToWater < this->ageProperties->unk_2C)) { (this->actor.yDistToWater < this->ageProperties->unk_2C)) {
s32 sp8C = (arg2 & 8) ? 2 : 0; s32 sp8C = (arg2 & WALL_FLAG_3) ? 2 : 0;
if ((sp8C != 0) || (arg2 & 2) || func_80041E4C(&play->colCtx, this->actor.wallPoly, this->actor.wallBgId)) { if ((sp8C != 0) || (arg2 & WALL_FLAG_1) ||
SurfaceType_CheckWallFlag2(&play->colCtx, this->actor.wallPoly, this->actor.wallBgId)) {
f32 phi_f20; f32 phi_f20;
CollisionPoly* wallPoly = this->actor.wallPoly; CollisionPoly* wallPoly = this->actor.wallPoly;
f32 sp80; f32 sp80;
@ -6312,7 +6312,7 @@ s32 func_8083EC18(Player* this, PlayState* play, u32 arg2) {
this->stateFlags1 |= PLAYER_STATE1_21; this->stateFlags1 |= PLAYER_STATE1_21;
this->stateFlags1 &= ~PLAYER_STATE1_27; this->stateFlags1 &= ~PLAYER_STATE1_27;
if ((sp8C != 0) || (arg2 & 2)) { if ((sp8C != 0) || (arg2 & WALL_FLAG_1)) {
if ((this->unk_84F = sp8C) != 0) { if ((this->unk_84F = sp8C) != 0) {
if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) {
sp30 = &gPlayerAnim_002D80; sp30 = &gPlayerAnim_002D80;
@ -6363,7 +6363,7 @@ s32 func_8083F0C8(Player* this, PlayState* play, u32 arg2) {
f32 phi_f12; f32 phi_f12;
s32 i; s32 i;
if (!LINK_IS_ADULT && !(this->stateFlags1 & PLAYER_STATE1_27) && (arg2 & 0x30)) { if (!LINK_IS_ADULT && !(this->stateFlags1 & PLAYER_STATE1_27) && (arg2 & (WALL_FLAG_4 | WALL_FLAG_5))) {
wallPoly = this->actor.wallPoly; wallPoly = this->actor.wallPoly;
CollisionPoly_GetVerticesByBgId(wallPoly, this->actor.wallBgId, &play->colCtx, sp50); CollisionPoly_GetVerticesByBgId(wallPoly, this->actor.wallBgId, &play->colCtx, sp50);
@ -6443,7 +6443,7 @@ s32 func_8083F360(PlayState* play, Player* this, f32 arg1, f32 arg2, f32 arg3, f
this->actor.bgCheckFlags |= BGCHECKFLAG_PLAYER_WALL_INTERACT; this->actor.bgCheckFlags |= BGCHECKFLAG_PLAYER_WALL_INTERACT;
this->actor.wallBgId = sp78; this->actor.wallBgId = sp78;
D_808535F0 = func_80041DB8(&play->colCtx, wallPoly, sp78); D_808535F0 = SurfaceType_GetWallFlags(&play->colCtx, wallPoly, sp78);
wallPolyNormalX = COLPOLY_GET_NORMAL(wallPoly->normal.x); wallPolyNormalX = COLPOLY_GET_NORMAL(wallPoly->normal.x);
wallPolyNormalZ = COLPOLY_GET_NORMAL(wallPoly->normal.z); wallPolyNormalZ = COLPOLY_GET_NORMAL(wallPoly->normal.z);
@ -6469,7 +6469,8 @@ s32 func_8083F524(PlayState* play, Player* this) {
s32 func_8083F570(Player* this, PlayState* play) { s32 func_8083F570(Player* this, PlayState* play) {
s16 temp; s16 temp;
if ((this->linearVelocity != 0.0f) && (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) && (D_808535F0 & 0x30)) { if ((this->linearVelocity != 0.0f) && (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) &&
(D_808535F0 & (WALL_FLAG_4 | WALL_FLAG_5))) {
temp = this->actor.shape.rot.y - this->actor.wallYaw; temp = this->actor.shape.rot.y - this->actor.wallYaw;
if (this->linearVelocity < 0.0f) { if (this->linearVelocity < 0.0f) {
@ -6525,7 +6526,8 @@ s32 func_8083F7BC(Player* this, PlayState* play) {
} }
if (!func_808332B8(this) && ((this->linearVelocity == 0.0f) || !(this->stateFlags2 & PLAYER_STATE2_2)) && if (!func_808332B8(this) && ((this->linearVelocity == 0.0f) || !(this->stateFlags2 & PLAYER_STATE2_2)) &&
(D_808535F0 & 0x40) && (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) && (this->wallHeight >= 39.0f)) { (D_808535F0 & WALL_FLAG_6) && (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) &&
(this->wallHeight >= 39.0f)) {
this->stateFlags2 |= PLAYER_STATE2_0; this->stateFlags2 |= PLAYER_STATE2_0;
@ -6609,8 +6611,8 @@ void func_8083FB7C(Player* this, PlayState* play) {
s32 func_8083FBC0(Player* this, PlayState* play) { s32 func_8083FBC0(Player* this, PlayState* play) {
if (!CHECK_BTN_ALL(sControlInput->press.button, BTN_A) && if (!CHECK_BTN_ALL(sControlInput->press.button, BTN_A) &&
(this->actor.bgCheckFlags & BGCHECKFLAG_PLAYER_WALL_INTERACT) && (this->actor.bgCheckFlags & BGCHECKFLAG_PLAYER_WALL_INTERACT) &&
((D_808535F0 & 8) || (D_808535F0 & 2) || ((D_808535F0 & WALL_FLAG_3) || (D_808535F0 & WALL_FLAG_1) ||
func_80041E4C(&play->colCtx, this->actor.wallPoly, this->actor.wallBgId))) { SurfaceType_CheckWallFlag2(&play->colCtx, this->actor.wallPoly, this->actor.wallBgId))) {
return 0; return 0;
} }
@ -7591,7 +7593,7 @@ static Vec3f D_808545C0 = { 0.0f, 0.0f, 0.0f };
s32 func_8084269C(PlayState* play, Player* this) { s32 func_8084269C(PlayState* play, Player* this) {
Vec3f sp2C; Vec3f sp2C;
if ((this->unk_89E == 0) || (this->unk_89E == 1)) { if ((this->unk_89E == SURFACE_SFX_TYPE_0) || (this->unk_89E == SURFACE_SFX_TYPE_1)) {
func_8084260C(&this->actor.shape.feetPos[FOOT_LEFT], &sp2C, func_8084260C(&this->actor.shape.feetPos[FOOT_LEFT], &sp2C,
this->actor.floorHeight - this->actor.shape.feetPos[FOOT_LEFT].y, 7.0f, 5.0f); this->actor.floorHeight - this->actor.shape.feetPos[FOOT_LEFT].y, 7.0f, 5.0f);
func_800286CC(play, &sp2C, &D_808545B4, &D_808545C0, 50, 30); func_800286CC(play, &sp2C, &D_808545B4, &D_808545C0, 50, 30);
@ -7758,7 +7760,7 @@ s32 func_80842DF4(PlayState* play, Player* this) {
if (BgCheck_EntityLineTest1(&play->colCtx, &sp68, &this->meleeWeaponInfo[0].tip, &sp5C, &sp78, true, if (BgCheck_EntityLineTest1(&play->colCtx, &sp68, &this->meleeWeaponInfo[0].tip, &sp5C, &sp78, true,
false, false, true, &sp74) && false, false, true, &sp74) &&
!SurfaceType_IsIgnoredByEntities(&play->colCtx, sp78, sp74) && !SurfaceType_IsIgnoredByEntities(&play->colCtx, sp78, sp74) &&
(func_80041D4C(&play->colCtx, sp78, sp74) != 6) && (SurfaceType_GetFloorType(&play->colCtx, sp78, sp74) != FLOOR_TYPE_6) &&
(func_8002F9EC(play, &this->actor, sp78, sp74, &sp5C) == 0)) { (func_8002F9EC(play, &this->actor, sp78, sp74, &sp5C) == 0)) {
if (this->heldItemActionParam == PLAYER_AP_HAMMER) { if (this->heldItemActionParam == PLAYER_AP_HAMMER) {
@ -7769,13 +7771,13 @@ s32 func_80842DF4(PlayState* play, Player* this) {
} }
if (this->linearVelocity >= 0.0f) { if (this->linearVelocity >= 0.0f) {
sp48 = func_80041F10(&play->colCtx, sp78, sp74); sp48 = SurfaceType_GetSfxType(&play->colCtx, sp78, sp74);
if (sp48 == 0xA) { if (sp48 == SURFACE_SFX_TYPE_10) {
CollisionCheck_SpawnShieldParticlesWood(play, &sp5C, &this->actor.projectedPos); CollisionCheck_SpawnShieldParticlesWood(play, &sp5C, &this->actor.projectedPos);
} else { } else {
CollisionCheck_SpawnShieldParticles(play, &sp5C); CollisionCheck_SpawnShieldParticles(play, &sp5C);
if (sp48 == 0xB) { if (sp48 == SURFACE_SFX_TYPE_11) {
func_8002F7DC(&this->actor, NA_SE_IT_WALL_HIT_SOFT); func_8002F7DC(&this->actor, NA_SE_IT_WALL_HIT_SOFT);
} else { } else {
func_8002F7DC(&this->actor, NA_SE_IT_WALL_HIT_HARD); func_8002F7DC(&this->actor, NA_SE_IT_WALL_HIT_HARD);
@ -8090,9 +8092,9 @@ static struct_80832924 D_808545F0[] = {
void func_80843CEC(Player* this, PlayState* play) { void func_80843CEC(Player* this, PlayState* play) {
if (this->currentTunic != PLAYER_TUNIC_GORON) { if (this->currentTunic != PLAYER_TUNIC_GORON) {
if ((play->roomCtx.curRoom.behaviorType2 == ROOM_BEHAVIOR_TYPE2_3) || (D_808535E4 == 9) || if ((play->roomCtx.curRoom.behaviorType2 == ROOM_BEHAVIOR_TYPE2_3) || (D_808535E4 == FLOOR_TYPE_9) ||
((func_80838144(D_808535E4) >= 0) && ((func_80838144(D_808535E4) >= 0) &&
!SurfaceType_IsWallDamage(&play->colCtx, this->actor.floorPoly, this->actor.floorBgId))) { !func_80042108(&play->colCtx, this->actor.floorPoly, this->actor.floorBgId))) {
func_8083821C(this); func_8083821C(this);
} }
} }
@ -8131,7 +8133,7 @@ static FallImpactInfo D_80854600[] = {
s32 func_80843E64(PlayState* play, Player* this) { s32 func_80843E64(PlayState* play, Player* this) {
s32 sp34; s32 sp34;
if ((D_808535E4 == 6) || (D_808535E4 == 9)) { if ((D_808535E4 == FLOOR_TYPE_6) || (D_808535E4 == FLOOR_TYPE_9)) {
sp34 = 0; sp34 = 0;
} else { } else {
sp34 = this->fallDistance; sp34 = this->fallDistance;
@ -8175,7 +8177,7 @@ s32 func_80843E64(PlayState* play, Player* this) {
func_8083264C(this, (u8)sp34, (u8)(sp34 * 0.1f), (u8)sp34, 0); func_8083264C(this, (u8)sp34, (u8)(sp34 * 0.1f), (u8)sp34, 0);
if (D_808535E4 == 6) { if (D_808535E4 == FLOOR_TYPE_6) {
func_80832698(this, NA_SE_VO_LI_CLIMB_END); func_80832698(this, NA_SE_VO_LI_CLIMB_END);
} }
} }
@ -8853,7 +8855,7 @@ void func_80845CA4(Player* this, PlayState* play) {
if (this->stateFlags1 & PLAYER_STATE1_0) { if (this->stateFlags1 & PLAYER_STATE1_0) {
sp34 = gSaveContext.entranceSpeed; sp34 = gSaveContext.entranceSpeed;
if (sConveyorSpeedIndex != 0) { if (sConveyorSpeedIndex != CONVEYOR_SPEED_DISABLED) {
this->unk_450.x = (Math_SinS(sConveyorYaw) * 400.0f) + this->actor.world.pos.x; this->unk_450.x = (Math_SinS(sConveyorYaw) * 400.0f) + this->actor.world.pos.x;
this->unk_450.z = (Math_CosS(sConveyorYaw) * 400.0f) + this->actor.world.pos.z; this->unk_450.z = (Math_CosS(sConveyorYaw) * 400.0f) + this->actor.world.pos.z;
} }
@ -9538,7 +9540,7 @@ void func_808473D4(PlayState* play, Player* this) {
!Player_IsChildWithHylianShield(this))) { !Player_IsChildWithHylianShield(this))) {
if ((!(this->stateFlags1 & PLAYER_STATE1_14) && (sp20 <= 0) && if ((!(this->stateFlags1 & PLAYER_STATE1_14) && (sp20 <= 0) &&
(func_8008E9C4(this) || (func_8008E9C4(this) ||
((D_808535E4 != 7) && ((D_808535E4 != FLOOR_TYPE_7) &&
(func_80833B2C(this) || ((play->roomCtx.curRoom.behaviorType1 != ROOM_BEHAVIOR_TYPE1_2) && (func_80833B2C(this) || ((play->roomCtx.curRoom.behaviorType1 != ROOM_BEHAVIOR_TYPE1_2) &&
!(this->stateFlags1 & PLAYER_STATE1_22) && (sp20 == 0))))))) { !(this->stateFlags1 & PLAYER_STATE1_22) && (sp20 == 0))))))) {
doAction = DO_ACTION_ATTACK; doAction = DO_ACTION_ATTACK;
@ -9599,7 +9601,7 @@ s32 func_80847A78(Player* this) {
return false; return false;
} }
D_808535E4 = 0; D_808535E4 = FLOOR_TYPE_0;
this->unk_898 = this->unk_89A = D_80853610 = 0; this->unk_898 = this->unk_89A = D_80853610 = 0;
return true; return true;
@ -9663,25 +9665,26 @@ void func_80847BA0(PlayState* play, Player* this) {
} }
D_80853600 = this->actor.world.pos.y - this->actor.floorHeight; D_80853600 = this->actor.world.pos.y - this->actor.floorHeight;
sConveyorSpeedIndex = 0; sConveyorSpeedIndex = CONVEYOR_SPEED_DISABLED;
floorPoly = this->actor.floorPoly; floorPoly = this->actor.floorPoly;
if (floorPoly != NULL) { if (floorPoly != NULL) {
this->unk_A7A = func_80041EA4(&play->colCtx, floorPoly, this->actor.floorBgId); this->unk_A7A = SurfaceType_GetFloorProperty(&play->colCtx, floorPoly, this->actor.floorBgId);
this->unk_A82 = this->unk_89E; this->unk_A82 = this->unk_89E;
if (this->actor.bgCheckFlags & BGCHECKFLAG_WATER) { if (this->actor.bgCheckFlags & BGCHECKFLAG_WATER) {
if (this->actor.yDistToWater < 20.0f) { if (this->actor.yDistToWater < 20.0f) {
this->unk_89E = 4; this->unk_89E = SURFACE_SFX_TYPE_4;
} else { } else {
this->unk_89E = 5; this->unk_89E = SURFACE_SFX_TYPE_5;
} }
} else { } else {
if (this->stateFlags2 & PLAYER_STATE2_9) { if (this->stateFlags2 & PLAYER_STATE2_9) {
this->unk_89E = 1; this->unk_89E = SURFACE_SFX_TYPE_1;
} else { } else {
this->unk_89E = SurfaceType_GetSfx(&play->colCtx, floorPoly, this->actor.floorBgId); // unk_89E is a sfxType, but SurfaceType_GetSfxId returns a sfxId?
this->unk_89E = SurfaceType_GetSfxId(&play->colCtx, floorPoly, this->actor.floorBgId);
} }
} }
@ -9690,7 +9693,7 @@ void func_80847BA0(PlayState* play, Player* this) {
if (this->actor.floorBgId == BGCHECK_SCENE) { if (this->actor.floorBgId == BGCHECK_SCENE) {
Environment_ChangeLightSetting( Environment_ChangeLightSetting(
play, SurfaceType_GetLightSettingIndex(&play->colCtx, floorPoly, this->actor.floorBgId)); play, SurfaceType_GetLightSetting(&play->colCtx, floorPoly, this->actor.floorBgId));
} else { } else {
DynaPoly_SetPlayerAbove(&play->colCtx, this->actor.floorBgId); DynaPoly_SetPlayerAbove(&play->colCtx, this->actor.floorBgId);
} }
@ -9698,15 +9701,15 @@ void func_80847BA0(PlayState* play, Player* this) {
// This block extracts the conveyor properties from the floor poly // This block extracts the conveyor properties from the floor poly
sConveyorSpeedIndex = SurfaceType_GetConveyorSpeed(&play->colCtx, floorPoly, this->actor.floorBgId); sConveyorSpeedIndex = SurfaceType_GetConveyorSpeed(&play->colCtx, floorPoly, this->actor.floorBgId);
if (sConveyorSpeedIndex != 0) { if (sConveyorSpeedIndex != CONVEYOR_SPEED_DISABLED) {
sIsFloorConveyor = SurfaceType_IsFloorConveyor(&play->colCtx, floorPoly, this->actor.floorBgId); sIsFloorConveyor = SurfaceType_IsFloorConveyor(&play->colCtx, floorPoly, this->actor.floorBgId);
if ((!sIsFloorConveyor && (this->actor.yDistToWater > 20.0f) && if ((!sIsFloorConveyor && (this->actor.yDistToWater > 20.0f) &&
(this->currentBoots != PLAYER_BOOTS_IRON)) || (this->currentBoots != PLAYER_BOOTS_IRON)) ||
(sIsFloorConveyor && (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND))) { (sIsFloorConveyor && (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND))) {
sConveyorYaw = sConveyorYaw = CONVEYOR_DIRECTION_TO_BINANG(
SurfaceType_GetConveyorDirection(&play->colCtx, floorPoly, this->actor.floorBgId) * (0x10000 / 64); SurfaceType_GetConveyorDirection(&play->colCtx, floorPoly, this->actor.floorBgId));
} else { } else {
sConveyorSpeedIndex = 0; sConveyorSpeedIndex = CONVEYOR_SPEED_DISABLED;
} }
} }
} }
@ -9736,7 +9739,7 @@ void func_80847BA0(PlayState* play, Player* this) {
sp9A = this->actor.shape.rot.y - (s16)(this->actor.wallYaw + 0x8000); sp9A = this->actor.shape.rot.y - (s16)(this->actor.wallYaw + 0x8000);
D_808535F0 = func_80041DB8(&play->colCtx, this->actor.wallPoly, this->actor.wallBgId); D_808535F0 = SurfaceType_GetWallFlags(&play->colCtx, this->actor.wallPoly, this->actor.wallBgId);
D_80853608 = ABS(sp9A); D_80853608 = ABS(sp9A);
@ -9793,9 +9796,9 @@ void func_80847BA0(PlayState* play, Player* this) {
if (func_80839768(play, this, &D_80854798, &sp78, &sp74, &D_80858AA8) && if (func_80839768(play, this, &D_80854798, &sp78, &sp74, &D_80858AA8) &&
(temp3 = this->actor.wallYaw - Math_Atan2S(sp78->normal.z, sp78->normal.x), (temp3 = this->actor.wallYaw - Math_Atan2S(sp78->normal.z, sp78->normal.x),
ABS(temp3) < 0x4000) && ABS(temp3) < 0x4000) &&
!func_80041E18(&play->colCtx, sp78, sp74)) { !SurfaceType_CheckWallFlag1(&play->colCtx, sp78, sp74)) {
this->wallHeight = 399.96002f; this->wallHeight = 399.96002f;
} else if (func_80041DE4(&play->colCtx, wallPoly, this->actor.wallBgId) == 0) { } else if (SurfaceType_CheckWallFlag0(&play->colCtx, wallPoly, this->actor.wallBgId) == 0) {
if (this->ageProperties->unk_1C <= this->wallHeight) { if (this->ageProperties->unk_1C <= this->wallHeight) {
if (ABS(sp7C->normal.y) > 28000) { if (ABS(sp7C->normal.y) > 28000) {
if (this->ageProperties->unk_14 <= this->wallHeight) { if (this->ageProperties->unk_14 <= this->wallHeight) {
@ -9829,7 +9832,7 @@ void func_80847BA0(PlayState* play, Player* this) {
} }
if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) {
D_808535E4 = func_80041D4C(&play->colCtx, floorPoly, this->actor.floorBgId); D_808535E4 = SurfaceType_GetFloorType(&play->colCtx, floorPoly, this->actor.floorBgId);
if (!func_80847A78(this)) { if (!func_80847A78(this)) {
f32 floorPolyNormalX; f32 floorPolyNormalX;
@ -10112,8 +10115,16 @@ static s8 D_808547C4[] = {
static Vec3f D_80854814 = { 0.0f, 0.0f, 200.0f }; static Vec3f D_80854814 = { 0.0f, 0.0f, 200.0f };
static f32 sWaterConveyorSpeeds[] = { 2.0f, 4.0f, 7.0f }; static f32 sWaterConveyorSpeeds[CONVEYOR_SPEED_MAX - 1] = {
static f32 sFloorConveyorSpeeds[] = { 0.5f, 1.0f, 3.0f }; 2.0f, // CONVEYOR_SPEED_SLOW
4.0f, // CONVEYOR_SPEED_MEDIUM
7.0f, // CONVEYOR_SPEED_FAST
};
static f32 sFloorConveyorSpeeds[CONVEYOR_SPEED_MAX - 1] = {
0.5f, // CONVEYOR_SPEED_SLOW
1.0f, // CONVEYOR_SPEED_MEDIUM
3.0f, // CONVEYOR_SPEED_FAST
};
void Player_UpdateCommon(Player* this, PlayState* play, Input* input) { void Player_UpdateCommon(Player* this, PlayState* play, Input* input) {
s32 pad; s32 pad;
@ -10238,7 +10249,7 @@ void Player_UpdateCommon(Player* this, PlayState* play, Input* input) {
} }
if (!(this->skelAnime.moveFlags & 0x80)) { if (!(this->skelAnime.moveFlags & 0x80)) {
if (((this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) && (D_808535E4 == 5) && if (((this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) && (D_808535E4 == FLOOR_TYPE_5) &&
(this->currentBoots != PLAYER_BOOTS_IRON)) || (this->currentBoots != PLAYER_BOOTS_IRON)) ||
((this->currentBoots == PLAYER_BOOTS_HOVER) && ((this->currentBoots == PLAYER_BOOTS_HOVER) &&
!(this->stateFlags1 & (PLAYER_STATE1_27 | PLAYER_STATE1_29)))) { !(this->stateFlags1 & (PLAYER_STATE1_27 | PLAYER_STATE1_29)))) {
@ -10285,8 +10296,8 @@ void Player_UpdateCommon(Player* this, PlayState* play, Input* input) {
func_8002D7EC(&this->actor); func_8002D7EC(&this->actor);
func_80847BA0(play, this); func_80847BA0(play, this);
} else { } else {
D_808535E4 = 0; D_808535E4 = FLOOR_TYPE_0;
this->unk_A7A = 0; this->unk_A7A = FLOOR_PROPERTY_0;
if (!(this->stateFlags1 & PLAYER_STATE1_0) && (this->stateFlags1 & PLAYER_STATE1_23)) { if (!(this->stateFlags1 & PLAYER_STATE1_0) && (this->stateFlags1 & PLAYER_STATE1_23)) {
EnHorse* rideActor = (EnHorse*)this->rideActor; EnHorse* rideActor = (EnHorse*)this->rideActor;
@ -10310,12 +10321,12 @@ void Player_UpdateCommon(Player* this, PlayState* play, Input* input) {
} }
} }
sConveyorSpeedIndex = 0; sConveyorSpeedIndex = CONVEYOR_SPEED_DISABLED;
this->pushedSpeed = 0.0f; this->pushedSpeed = 0.0f;
} }
// This block applies the bg conveyor to pushedSpeed // This block applies the bg conveyor to pushedSpeed
if ((sConveyorSpeedIndex != 0) && (this->currentBoots != PLAYER_BOOTS_IRON)) { if ((sConveyorSpeedIndex != CONVEYOR_SPEED_DISABLED) && (this->currentBoots != PLAYER_BOOTS_IRON)) {
f32 conveyorSpeed; f32 conveyorSpeed;
// converts 1-index to 0-index // converts 1-index to 0-index
@ -11406,7 +11417,7 @@ void func_8084C5F8(Player* this, PlayState* play) {
sp24.y = this->actor.world.pos.y + 20.0f; sp24.y = this->actor.world.pos.y + 20.0f;
sp24.z = this->actor.world.pos.z; sp24.z = this->actor.world.pos.z;
if (BgCheck_EntityRaycastFloor3(&play->colCtx, &sp34, &sp30, &sp24) != 0.0f) { if (BgCheck_EntityRaycastFloor3(&play->colCtx, &sp34, &sp30, &sp24) != 0.0f) {
this->unk_89E = func_80041F10(&play->colCtx, sp34, sp30); this->unk_89E = SurfaceType_GetSfxType(&play->colCtx, sp34, sp30);
func_808328A0(this); func_808328A0(this);
} }
} }
@ -12617,7 +12628,7 @@ void func_8084F390(Player* this, PlayState* play) {
sp4C = (sp50 * sp50) * 0.015f; sp4C = (sp50 * sp50) * 0.015f;
sp48 = slopeNormal.y * 0.01f; sp48 = slopeNormal.y * 0.01f;
if (SurfaceType_GetSlope(&play->colCtx, floorPoly, this->actor.floorBgId) != 1) { if (SurfaceType_GetFloorEffect(&play->colCtx, floorPoly, this->actor.floorBgId) != FLOOR_EFFECT_1) {
sp50 = 0; sp50 = 0;
sp48 = slopeNormal.y * 10.0f; sp48 = slopeNormal.y * 10.0f;
} }