Name some SurfaceType_ functions (#1155)

* enums

* renaming functions

* fixes

* SurfaceType_IsSoft

* type fixing

* format

* Update src/code/z_bgcheck.c

Co-authored-by: engineer124 <47598039+engineer124@users.noreply.github.com>

* Update src/code/z_bgcheck.c

Co-authored-by: engineer124 <47598039+engineer124@users.noreply.github.com>

* Update src/overlays/actors/ovl_En_Bom_Chu/z_en_bom_chu.c

Co-authored-by: engineer124 <47598039+engineer124@users.noreply.github.com>

* review

Co-authored-by: engineer124 <engineer124engineer124@gmail.com>

* SurfaceType_GetFloorEffect

Co-authored-by: Dragorn421 <Dragorn421@users.noreply.github.com>

* format

* bss

* cleanups

* extra material docs

* cleanup

* cleanups

* Remove Bg prefix

* minor fixes

* Remove BG_

* SURFACE_MATERIAL_DIRT_SHALLOW

* format

* bss

* bss

* review

Co-authored-by: engineer124 <47598039+engineer124@users.noreply.github.com>

* format

* format again

* bug

* format

* namefixer

* bss

* bss

* bss

* review

---------

Co-authored-by: engineer124 <47598039+engineer124@users.noreply.github.com>
Co-authored-by: engineer124 <engineer124engineer124@gmail.com>
Co-authored-by: Dragorn421 <Dragorn421@users.noreply.github.com>
This commit is contained in:
Anghelo Carvajal
2023-04-18 18:14:36 -04:00
committed by GitHub
parent 4647ebb91b
commit 38d21bbe97
52 changed files with 559 additions and 458 deletions
+2 -2
View File
@@ -802,8 +802,8 @@ void Fault_ThreadEntry(void* arg) {
u32 pad;
OSThread* faultedThread;
osSetEventMesg(10, &sFaultContext->queue, (OSMesg)1);
osSetEventMesg(12, &sFaultContext->queue, (OSMesg)2);
osSetEventMesg(OS_EVENT_CPU_BREAK, &sFaultContext->queue, (OSMesg)1);
osSetEventMesg(OS_EVENT_FAULT, &sFaultContext->queue, (OSMesg)2);
while (1) {
do {
osRecvMesg(&sFaultContext->queue, &msg, OS_MESG_BLOCK);
+1 -1
View File
@@ -161,7 +161,7 @@ void IrqMgr_Init(IrqMgr* irqmgr, void* stack, OSPri pri, u8 retraceCount) {
irqmgr->lastPrenmiTime = 0;
osCreateMesgQueue(&irqmgr->irqQueue, (OSMesg*)irqmgr->irqBuffer, ARRAY_COUNT(irqmgr->irqBuffer));
osSetEventMesg(0xE, &irqmgr->irqQueue, (OSMesg)0x29D);
osSetEventMesg(OS_EVENT_PRENMI, &irqmgr->irqQueue, (OSMesg)0x29D);
osViSetEvent(&irqmgr->irqQueue, (OSMesg)0x29A, retraceCount);
osCreateThread(&irqmgr->thread, Z_THREAD_ID_IRQMGR, IrqMgr_ThreadEntry, irqmgr, stack, pri);
-1
View File
@@ -1,4 +1,3 @@
#include "prevent_bss_reordering.h"
#include "global.h"
#include "stack.h"
#include "stackcheck.h"
-1
View File
@@ -1,4 +1,3 @@
#include "prevent_bss_reordering.h"
#include "global.h"
#include "stackcheck.h"
+9 -8
View File
@@ -234,8 +234,9 @@ void ActorShadow_DrawFeet(Actor* actor, Lights* mapper, PlayState* play) {
if (distToFloor <= 10.0f) {
actor->shape.feetFloorFlags |= spB8;
if ((actor->depthInWater < 0.0f) && (bgId == 0x32) && ((actor->shape.unk_17 & spB8) != 0)) {
if (func_800C9C24(&play->colCtx, poly, bgId, 1)) {
if ((actor->depthInWater < 0.0f) && (bgId == BGCHECK_SCENE) && (actor->shape.unk_17 & spB8)) {
if (SurfaceType_HasMaterialProperty(&play->colCtx, poly, bgId,
MATERIAL_PROPERTY_SOFT_IMPRINT)) {
SkinMatrix_MtxFCopy(&sp13C, &spFC);
SkinMatrix_MulYRotation(&spFC, actor->shape.rot.y);
EffFootmark_Add(play, &spFC, actor, i, feetPosPtr, (actor->shape.shadowScale * 0.3f),
@@ -2183,20 +2184,20 @@ void Actor_PlaySfx(Actor* actor, u16 sfxId) {
}
void func_800B8EF4(PlayState* play, Actor* actor) {
u32 sfxId;
SurfaceSfxOffset surfaceSfxOffset;
if (actor->bgCheckFlags & BGCHECKFLAG_WATER) {
if (actor->depthInWater < 20.0f) {
sfxId = NA_SE_PL_WALK_WATER0 - SFX_FLAG;
surfaceSfxOffset = SURFACE_SFX_OFFSET_WATER_SHALLOW;
} else {
sfxId = NA_SE_PL_WALK_WATER1 - SFX_FLAG;
surfaceSfxOffset = SURFACE_SFX_OFFSET_WATER_DEEP;
}
} else {
sfxId = SurfaceType_GetSfx(&play->colCtx, actor->floorPoly, actor->floorBgId);
surfaceSfxOffset = SurfaceType_GetSfxOffset(&play->colCtx, actor->floorPoly, actor->floorBgId);
}
Audio_PlaySfxAtPos(&actor->projectedPos, NA_SE_EV_BOMB_BOUND);
Audio_PlaySfxAtPos(&actor->projectedPos, sfxId + SFX_FLAG);
Audio_PlaySfxAtPos(&actor->projectedPos, NA_SE_PL_WALK_GROUND + surfaceSfxOffset);
}
void func_800B8F98(Actor* actor, u16 sfxId) {
@@ -2248,7 +2249,7 @@ void func_800B9098(Actor* actor) {
}
s32 func_800B90AC(PlayState* play, Actor* actor, CollisionPoly* polygon, s32 bgId, Vec3f* arg4) {
if (func_800C99D4(&play->colCtx, polygon, bgId) == 8) {
if (SurfaceType_GetFloorType(&play->colCtx, polygon, bgId) == FLOOR_TYPE_8) {
return true;
}
+75 -124
View File
@@ -6,44 +6,51 @@
#define DYNA_RAYCAST_WALLS 2
#define DYNA_RAYCAST_CEILINGS 4
u32 sWallFlags[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,
u32 sWallFlags[WALL_TYPE_MAX] = {
0, // WALL_TYPE_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
};
u16 sSurfaceTypeSfx[] = {
/* 0x00 */ NA_SE_PL_WALK_GROUND - SFX_FLAG,
/* 0x01 */ NA_SE_PL_WALK_SAND - SFX_FLAG,
/* 0x02 */ NA_SE_PL_WALK_CONCRETE - SFX_FLAG,
/* 0x03 */ NA_SE_PL_WALK_DIRT - SFX_FLAG,
/* 0x04 */ NA_SE_PL_WALK_WATER0 - SFX_FLAG,
/* 0x05 */ NA_SE_PL_WALK_WATER1 - SFX_FLAG,
/* 0x06 */ NA_SE_PL_WALK_WATER2 - SFX_FLAG,
/* 0x07 */ NA_SE_PL_WALK_MAGMA - SFX_FLAG,
/* 0x08 */ NA_SE_PL_WALK_GRASS - SFX_FLAG,
/* 0x09 */ NA_SE_PL_WALK_GLASS - SFX_FLAG,
/* 0x0A */ NA_SE_PL_WALK_LADDER - SFX_FLAG,
/* 0x0B */ NA_SE_PL_WALK_GROUND - SFX_FLAG,
/* 0x0C */ NA_SE_PL_WALK_ICE - SFX_FLAG,
/* 0x0D */ NA_SE_PL_WALK_IRON - SFX_FLAG,
/* 0x0E */ NA_SE_PL_WALK_SNOW - SFX_FLAG
u16 sSurfaceSfxOffsets[SURFACE_MATERIAL_MAX] = {
SURFACE_SFX_OFFSET_DIRT, // SURFACE_MATERIAL_DIRT
SURFACE_SFX_OFFSET_SAND, // SURFACE_MATERIAL_SAND
SURFACE_SFX_OFFSET_STONE, // SURFACE_MATERIAL_STONE
SURFACE_SFX_OFFSET_DIRT_SHALLOW, // SURFACE_MATERIAL_DIRT_SHALLOW
SURFACE_SFX_OFFSET_WATER_SHALLOW, // SURFACE_MATERIAL_WATER_SHALLOW
SURFACE_SFX_OFFSET_WATER_DEEP, // SURFACE_MATERIAL_WATER_DEEP
SURFACE_SFX_OFFSET_TALL_GRASS, // SURFACE_MATERIAL_TALL_GRASS
SURFACE_SFX_OFFSET_LAVA, // SURFACE_MATERIAL_LAVA
SURFACE_SFX_OFFSET_GRASS, // SURFACE_MATERIAL_GRASS
SURFACE_SFX_OFFSET_BRIDGE, // SURFACE_MATERIAL_BRIDGE
SURFACE_SFX_OFFSET_WOOD, // SURFACE_MATERIAL_WOOD
SURFACE_SFX_OFFSET_DIRT, // SURFACE_MATERIAL_DIRT_SOFT
SURFACE_SFX_OFFSET_ICE, // SURFACE_MATERIAL_ICE
SURFACE_SFX_OFFSET_CARPET, // SURFACE_MATERIAL_CARPET
SURFACE_SFX_OFFSET_SNOW, // SURFACE_MATERIAL_SNOW
};
u8 D_801B46C0[] = {
/* 0x00 */ 1,
/* 0x01 */ 1,
/* 0x02 */ 0,
/* 0x03 */ 1,
/* 0x04 */ 0,
/* 0x05 */ 0,
/* 0x06 */ 0,
/* 0x07 */ 0,
/* 0x08 */ 0,
/* 0x09 */ 0,
/* 0x0A */ 0,
/* 0x0B */ 0,
/* 0x0C */ 0,
/* 0x0D */ 0,
/* 0x0E */ 1
u8 sSurfaceMaterialProperties[SURFACE_MATERIAL_MAX] = {
MATERIAL_PROPERTY_SOFT_IMPRINT, // SURFACE_MATERIAL_DIRT
MATERIAL_PROPERTY_SOFT_IMPRINT, // SURFACE_MATERIAL_SAND
0, // SURFACE_MATERIAL_STONE
MATERIAL_PROPERTY_SOFT_IMPRINT, // SURFACE_MATERIAL_DIRT_SHALLOW
0, // SURFACE_MATERIAL_WATER_SHALLOW
0, // SURFACE_MATERIAL_WATER_DEEP
0, // SURFACE_MATERIAL_TALL_GRASS
0, // SURFACE_MATERIAL_LAVA
0, // SURFACE_MATERIAL_GRASS
0, // SURFACE_MATERIAL_BRIDGE
0, // SURFACE_MATERIAL_WOOD
0, // SURFACE_MATERIAL_DIRT_SOFT
0, // SURFACE_MATERIAL_ICE
0, // SURFACE_MATERIAL_CARPET
MATERIAL_PROPERTY_SOFT_IMPRINT, // SURFACE_MATERIAL_SNOW
};
s16 sSmallMemSceneIds[] = {
@@ -51,9 +58,9 @@ s16 sSmallMemSceneIds[] = {
};
typedef struct {
s16 sceneId;
u32 memSize;
} BgCheckSceneMemEntry;
/* 0x0 */ s16 sceneId;
/* 0x4 */ u32 memSize;
} BgCheckSceneMemEntry; // size = 0x8
BgCheckSceneMemEntry sSceneMemList[] = {
{ SCENE_00KEIKOKU, 0xC800 },
@@ -1734,7 +1741,7 @@ f32 BgCheck_RaycastFloorImpl(PlayState* play, CollisionContext* colCtx, u16 xpFl
}
}
if ((yIntersect != BGCHECK_Y_MIN) && func_800C9B68(colCtx, *outPoly, *outBgId)) {
if ((yIntersect != BGCHECK_Y_MIN) && SurfaceType_IsSoft(colCtx, *outPoly, *outBgId)) {
yIntersect -= 1.0f;
}
return yIntersect;
@@ -3204,7 +3211,8 @@ f32 BgCheck_RaycastFloorDynaList(DynaRaycast* dynaRaycast, u32 listType) {
(COLPOLY_VIA_FLAG_TEST(polyList[id].flags_vIB, 4) &&
(((dynaRaycast->actor != NULL) && (dynaRaycast->actor->category != ACTORCAT_PLAYER)) ||
((dynaRaycast->actor == NULL) && (dynaRaycast->xpFlags != COLPOLY_IGNORE_CAMERA)))) ||
((dynaRaycast->unk_24 & 0x20) && func_800C9B68(dynaRaycast->colCtx, &polyList[id], dynaRaycast->unk1C))) {
((dynaRaycast->unk_24 & 0x20) &&
SurfaceType_IsSoft(dynaRaycast->colCtx, &polyList[id], dynaRaycast->unk1C))) {
if (curNode->next == SS_NULL) {
break;
} else {
@@ -4187,17 +4195,11 @@ Vec3s* BgCheck_GetBgCamFuncData(CollisionContext* colCtx, CollisionPoly* poly, s
return BgCheck_GetBgCamFuncDataImpl(colCtx, SurfaceType_GetBgCamIndex(colCtx, poly, bgId), bgId);
}
/**
* SurfaceType Get Scene Exit Index
*/
u32 SurfaceType_GetSceneExitIndex(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId) {
return SurfaceType_GetData(colCtx, poly, bgId, 0) >> 8 & 0x1F;
}
/**
* SurfaceType Get ? Property (& 0x0003_E000)
*/
u32 func_800C99D4(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId) {
FloorType SurfaceType_GetFloorType(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId) {
return SurfaceType_GetData(colCtx, poly, bgId, 0) >> 13 & 0x1F;
}
@@ -4208,126 +4210,85 @@ u32 func_800C99FC(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId) {
return SurfaceType_GetData(colCtx, poly, bgId, 0) >> 18 & 7;
}
/**
* SurfaceType Get Wall Property (Internal)
*/
u32 func_800C9A24(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId) {
WallType SurfaceType_GetWallType(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId) {
return SurfaceType_GetData(colCtx, poly, bgId, 0) >> 21 & 0x1F;
}
/**
* SurfaceType Get Wall Flags
*/
s32 func_800C9A4C(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId) {
return sWallFlags[func_800C9A24(colCtx, poly, bgId)];
s32 SurfaceType_GetWallFlags(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId) {
return sWallFlags[SurfaceType_GetWallType(colCtx, poly, bgId)];
}
/**
* SurfaceType Is Wall Flag (1 << 0) Set
*/
s32 func_800C9A7C(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId) {
return (func_800C9A4C(colCtx, poly, bgId) & 1) ? true : false;
s32 SurfaceType_CheckWallFlag0(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId) {
return (SurfaceType_GetWallFlags(colCtx, poly, bgId) & WALL_FLAG_0) ? true : false;
}
/**
* SurfaceType Is Wall Flag (1 << 1) Set
*/
s32 func_800C9AB0(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId) {
return (func_800C9A4C(colCtx, poly, bgId) & 2) ? true : false;
s32 SurfaceType_CheckWallFlag1(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId) {
return (SurfaceType_GetWallFlags(colCtx, poly, bgId) & WALL_FLAG_1) ? true : false;
}
/**
* SurfaceType Is Wall Flag (1 << 2) Set
*/
s32 func_800C9AE4(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId) {
return (func_800C9A4C(colCtx, poly, bgId) & 4) ? true : false;
s32 SurfaceType_CheckWallFlag2(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId) {
return (SurfaceType_GetWallFlags(colCtx, poly, bgId) & WALL_FLAG_2) ? true : false;
}
u32 func_800C9B18(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId) {
FloorProperty SurfaceType_GetFloorProperty2(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId) {
return SurfaceType_GetData(colCtx, poly, bgId, 0) >> 26 & 0xF;
}
/**
* SurfaceType Get Floor Property
*/
u32 func_800C9B40(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId) {
FloorProperty SurfaceType_GetFloorProperty(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId) {
return SurfaceType_GetData(colCtx, poly, bgId, 0) >> 26 & 0xF;
}
/**
* SurfaceType Is Floor Minus 1
*/
u32 func_800C9B68(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId) {
u32 SurfaceType_IsSoft(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId) {
return SurfaceType_GetData(colCtx, poly, bgId, 0) >> 30 & 1;
}
/**
* SurfaceType Is Horse Blocked
*/
u32 SurfaceType_IsHorseBlocked(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId) {
return SurfaceType_GetData(colCtx, poly, bgId, 0) >> 31 & 1;
}
u32 func_800C9BB8(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId) {
SurfaceMaterial SurfaceType_GetMaterial(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId) {
return SurfaceType_GetData(colCtx, poly, bgId, 1) & 0xF;
}
/**
* SurfaceType Get Poly Sfx
*/
u16 SurfaceType_GetSfx(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId) {
s32 id = func_800C9BB8(colCtx, poly, bgId);
u16 SurfaceType_GetSfxOffset(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId) {
SurfaceMaterial surfaceMaterial = SurfaceType_GetMaterial(colCtx, poly, bgId);
if ((id < 0) || (id > 14)) {
return NA_SE_PL_WALK_GROUND - SFX_FLAG;
if ((surfaceMaterial < 0) || (surfaceMaterial >= ARRAY_COUNT(sSurfaceSfxOffsets))) {
return SURFACE_SFX_OFFSET_DIRT;
}
return sSurfaceTypeSfx[id];
return sSurfaceSfxOffsets[surfaceMaterial];
}
/**
* SurfaceType Get ? (same indexer as Get Poly Sfx)
* Checks if the material has the bitwise propertyType
*/
s32 func_800C9C24(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId, s32 arg3) {
s32 id = func_800C9BB8(colCtx, poly, bgId);
s32 SurfaceType_HasMaterialProperty(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId, s32 propertyType) {
SurfaceMaterial surfaceMaterial = SurfaceType_GetMaterial(colCtx, poly, bgId);
if ((id < 0) || (id > 14)) {
if ((surfaceMaterial < 0) || (surfaceMaterial >= ARRAY_COUNT(sSurfaceMaterialProperties))) {
return 0;
}
return D_801B46C0[id] & arg3;
return sSurfaceMaterialProperties[surfaceMaterial] & propertyType;
}
/**
* SurfaceType get terrain slope surface
*/
u32 SurfaceType_GetSlope(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId) {
FloorEffect SurfaceType_GetFloorEffect(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId) {
return SurfaceType_GetData(colCtx, poly, bgId, 1) >> 4 & 3;
}
/**
* SurfaceType get surface lighting setting
*/
u32 SurfaceType_GetLightSettingIndex(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId) {
return SurfaceType_GetData(colCtx, poly, bgId, 1) >> 6 & 0x1F;
}
/**
* SurfaceType get echo
*/
u32 SurfaceType_GetEcho(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId) {
return SurfaceType_GetData(colCtx, poly, bgId, 1) >> 11 & 0x3F;
}
/**
* SurfaceType Is Hookshot Surface
*/
u32 SurfaceType_IsHookshotSurface(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId) {
return SurfaceType_GetData(colCtx, poly, bgId, 1) >> 17 & 1;
}
/**
* CollisionPoly is ignored by entities
* Returns true if poly is ignored by entities, else false
*/
s32 SurfaceType_IsIgnoredByEntities(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId) {
u32 flags;
@@ -4338,10 +4299,6 @@ s32 SurfaceType_IsIgnoredByEntities(CollisionContext* colCtx, CollisionPoly* pol
return !!flags;
}
/**
* CollisionPoly is ignored by projectiles
* Returns true if poly is ignored by projectiles, else false
*/
s32 SurfaceType_IsIgnoredByProjectiles(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId) {
u32 flags;
@@ -4384,10 +4341,7 @@ s32 func_800C9DDC(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId) {
return !!flags;
}
/**
* SurfaceType Get Conveyor Surface Speed
*/
u32 SurfaceType_GetConveyorSpeed(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId) {
ConveyorSpeed SurfaceType_GetConveyorSpeed(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId) {
return SurfaceType_GetData(colCtx, poly, bgId, 1) >> 18 & 7;
}
@@ -4405,9 +4359,6 @@ u32 SurfaceType_GetConveyorDirection(CollisionContext* colCtx, CollisionPoly* po
return data & 0x3F;
}
/**
* SurfaceType is Wall Damage
*/
u32 SurfaceType_IsWallDamage(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId) {
return (SurfaceType_GetData(colCtx, poly, bgId, 1) & 0x8000000) ? true : false;
}
+6 -5
View File
@@ -250,19 +250,20 @@ void EnHy_UpdateCollider(EnHy* enHy, PlayState* play) {
s32 EnHy_PlayWalkingSound(EnHy* enHy, PlayState* play, f32 distAboveThreshold) {
u8 wasLeftFootOnGround = enHy->isLeftFootOnGround;
u8 wasRightFootOnGround = enHy->isRightFootOnGround;
s32 waterSfxId;
SurfaceSfxOffset surfaceSfxOffset;
u16 sfxId;
u8 isFootOnGround;
if (enHy->actor.bgCheckFlags & BGCHECKFLAG_WATER) {
if (enHy->actor.depthInWater < 20.0f) {
waterSfxId = NA_SE_PL_WALK_WATER0 - SFX_FLAG;
surfaceSfxOffset = SURFACE_SFX_OFFSET_WATER_SHALLOW;
} else {
waterSfxId = NA_SE_PL_WALK_WATER1 - SFX_FLAG;
surfaceSfxOffset = SURFACE_SFX_OFFSET_WATER_DEEP;
}
sfxId = waterSfxId + SFX_FLAG;
sfxId = NA_SE_PL_WALK_GROUND + surfaceSfxOffset;
} else {
sfxId = SurfaceType_GetSfx(&play->colCtx, enHy->actor.floorPoly, enHy->actor.floorBgId) + SFX_FLAG;
sfxId = NA_SE_PL_WALK_GROUND +
SurfaceType_GetSfxOffset(&play->colCtx, enHy->actor.floorPoly, enHy->actor.floorBgId);
}
enHy->isLeftFootOnGround = isFootOnGround = SubS_IsFloorAbove(play, &enHy->leftFootPos, distAboveThreshold);
+1 -1
View File
@@ -106,7 +106,7 @@ void Message_CloseTextbox(PlayState* play) {
msgCtx->stateTimer = 2;
msgCtx->msgMode = 0x43;
msgCtx->unk12020 = 0;
play_sound(NA_SE_PL_WALK_GROUND - SFX_FLAG);
play_sound(NA_SE_NONE);
}
}
+1
View File
@@ -1,3 +1,4 @@
#include "prevent_bss_reordering.h"
#include "global.h"
#include "buffers.h"
#include "z64debug_display.h"
+8 -8
View File
@@ -477,13 +477,13 @@ void Distortion_ClearType(s32 type) {
/**
* Checks that the bg surface is an underwater conveyor type and if so, returns the conveyor speed
*/
s32 Distortion_GetUnderwaterCurrentSpeed(Player* player) {
ConveyorSpeed Distortion_GetUnderwaterCurrentSpeed(Player* player) {
if (!SurfaceType_IsFloorConveyor(&sDistortionRequest.play->colCtx, player->actor.floorPoly,
player->actor.floorBgId)) {
return SurfaceType_GetConveyorSpeed(&sDistortionRequest.play->colCtx, player->actor.floorPoly,
player->actor.floorBgId);
}
return 0;
return CONVEYOR_SPEED_DISABLED;
}
void Distortion_Update(void) {
@@ -709,21 +709,21 @@ void Distortion_Update(void) {
rotZ = 0.3f;
switch (Distortion_GetUnderwaterCurrentSpeed(player)) {
case 3:
case CONVEYOR_SPEED_FAST:
xScale = -0.06f;
yScale = 0.1f;
zScale = 0.03f;
speed = 0.33f;
break;
case 2:
case CONVEYOR_SPEED_MEDIUM:
xScale = -0.06f;
yScale = 0.1f;
zScale = 0.03f;
speed = 0.33f;
break;
case 1:
case CONVEYOR_SPEED_SLOW:
xScale = -0.06f;
yScale = 0.1f;
zScale = 0.03f;
@@ -759,21 +759,21 @@ void Distortion_Update(void) {
rotY = 0.0f;
rotZ = 0.0f;
switch (Distortion_GetUnderwaterCurrentSpeed(player)) {
case 3:
case CONVEYOR_SPEED_FAST:
xScale = 0.12f;
yScale = 0.12f;
zScale = 0.08f;
speed = 0.18f;
break;
case 2:
case CONVEYOR_SPEED_MEDIUM:
xScale = 0.12f;
yScale = 0.12f;
zScale = 0.08f;
speed = 0.12f;
break;
case 1:
case CONVEYOR_SPEED_SLOW:
xScale = 0.12f;
yScale = 0.12f;
zScale = 0.08f;
+1 -1
View File
@@ -19,7 +19,7 @@ void osCreatePiManager(OSPri pri, OSMesgQueue* cmdQ, OSMesg* cmdBuf, s32 cmdMsgC
if (!__osPiAccessQueueEnabled) {
__osPiCreateAccessQueue();
}
osSetEventMesg(8, &D_8009E3D0, (OSMesg)0x22222222);
osSetEventMesg(OS_EVENT_PI, &D_8009E3D0, (OSMesg)0x22222222);
oldPri = -1;
myPri = osGetThreadPri(NULL);
if (myPri < pri) {
@@ -336,8 +336,8 @@ void func_80B7F398(BgIkanaBlock* this, PlayState* play) {
if (func_80B7EE70(this, play)) {
Actor_PlaySfx(&this->dyna.actor, NA_SE_EV_BLOCK_BOUND);
Actor_PlaySfx(&this->dyna.actor,
SurfaceType_GetSfx(&play->colCtx, this->dyna.actor.floorPoly, this->dyna.actor.floorBgId) +
SFX_FLAG);
NA_SE_PL_WALK_GROUND + SurfaceType_GetSfxOffset(&play->colCtx, this->dyna.actor.floorPoly,
this->dyna.actor.floorBgId));
func_80B7F0A4(this);
}
}
+1 -1
View File
@@ -648,7 +648,7 @@ void DmStk_PlaySfxForPlayingWithFairiesCutscene(DmStk* this, PlayState* play) {
case 72:
case 77:
case 79:
Actor_PlaySfx(&this->actor, NA_SE_PL_WALK_WATER2);
Actor_PlaySfx(&this->actor, NA_SE_PL_WALK_GROUND + SURFACE_SFX_OFFSET_TALL_GRASS);
Actor_PlaySfx(&this->actor, NA_SE_EN_STALKIDS_WALK);
break;
@@ -47,8 +47,8 @@ void func_808BAAF4(DoorWarp1* this, PlayState* play);
void func_808BABF4(DoorWarp1* this, PlayState* play);
void func_808BB8D4(DoorWarp1* this, PlayState* play, s32 arg2);
static s16 D_808BC000;
static f32 D_808BC004;
s16 D_808BC000;
f32 D_808BC004;
ActorInit Door_Warp1_InitVars = {
ACTOR_DOOR_WARP1,
@@ -211,9 +211,9 @@ void EnBbfall_Thaw(EnBbfall* this, PlayState* play) {
*/
s32 EnBbfall_IsTouchingLava(EnBbfall* this, PlayState* play) {
if (!SurfaceType_IsWallDamage(&play->colCtx, this->actor.floorPoly, this->actor.floorBgId)) {
u32 floorType = func_800C99D4(&play->colCtx, this->actor.floorPoly, this->actor.floorBgId);
FloorType 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)) {
return true;
}
}
+10 -10
View File
@@ -230,7 +230,7 @@ void EnBom_Move(EnBom* this, PlayState* play) {
Math_StepToF(&this->actor.speed, 0.0f, 0.08f);
} else {
Vec3f* sp58;
u32 sp54 = func_800C99D4(&play->colCtx, this->actor.floorPoly, this->actor.floorBgId);
FloorType floorType = SurfaceType_GetFloorType(&play->colCtx, this->actor.floorPoly, this->actor.floorBgId);
Vec3f slopeNormal;
s16 downwardSlopeYaw;
f32 sp40;
@@ -239,11 +239,11 @@ void EnBom_Move(EnBom* this, PlayState* play) {
sp58 = &D_80872E68[this->isPowderKeg];
if (sp54 == 5) {
if (floorType == FLOOR_TYPE_5) {
sp58 = &D_80872E68[2];
}
if ((sp54 == 4) || (sp54 == 14) || (sp54 == 15)) {
if ((floorType == FLOOR_TYPE_4) || (floorType == FLOOR_TYPE_14) || (floorType == FLOOR_TYPE_15)) {
s16 sp36;
Math_ApproachF(&this->actor.shape.yOffset, 0.0f, 0.1f, 50.0f);
@@ -262,8 +262,8 @@ void EnBom_Move(EnBom* this, PlayState* play) {
sp3C += 3.0f * slopeNormal.z;
sp38 = sqrtf(SQ(sp40) + SQ(sp3C));
if ((sp38 < this->actor.speed) ||
(SurfaceType_GetSlope(&play->colCtx, this->actor.floorPoly, this->actor.floorBgId) == 1)) {
if ((sp38 < this->actor.speed) || (SurfaceType_GetFloorEffect(&play->colCtx, this->actor.floorPoly,
this->actor.floorBgId) == FLOOR_EFFECT_1)) {
if (sp38 > 16.0f) {
this->actor.speed = 16.0f;
} else {
@@ -286,7 +286,7 @@ void EnBom_Move(EnBom* this, PlayState* play) {
if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND_TOUCH) {
Actor_PlaySfx(&this->actor, this->isPowderKeg ? NA_SE_EV_TRE_BOX_BOUND : NA_SE_EV_BOMB_BOUND);
if (this->actor.velocity.y < sp58->y) {
if ((sp54 == 4) || (sp54 == 14) || (sp54 == 15)) {
if ((floorType == FLOOR_TYPE_4) || (floorType == FLOOR_TYPE_14) || (floorType == FLOOR_TYPE_15)) {
this->actor.velocity.y = 0.0f;
} else {
this->actor.velocity.y = this->actor.velocity.y * sp58->z;
@@ -327,7 +327,7 @@ void EnBom_Explode(EnBom* this, PlayState* play) {
static Color_RGBA8 D_80872E90 = { 185, 140, 70, 255 };
static Color_RGBA8 D_80872E94 = { 255, 255, 255, 255 };
s32 i;
s32 temp_s0;
FloorType floorType;
f32 temp_f20;
s32 pad;
f32 spCC;
@@ -394,11 +394,11 @@ void EnBom_Explode(EnBom* this, PlayState* play) {
spB4.y = this->actor.world.pos.y + 500.0f;
spB4.z = this->actor.world.pos.z + spC0.z;
if (BgCheck_EntityRaycastFloor3(&play->colCtx, &spB0, &spAC, &spB4) != BGCHECK_Y_MIN) {
temp_s0 = func_800C99D4(&play->colCtx, spB0, spAC);
floorType = SurfaceType_GetFloorType(&play->colCtx, spB0, spAC);
temp_f20 = BgCheck_EntityRaycastFloor1(&play->colCtx, &spB0, &spB4);
if ((temp_s0 == 4) || (temp_s0 == 15) || (temp_s0 == 14)) {
if (temp_s0 == 4) {
if ((floorType == FLOOR_TYPE_4) || (floorType == FLOOR_TYPE_15) || (floorType == FLOOR_TYPE_14)) {
if (floorType == FLOOR_TYPE_4) {
sp84 = D_80872E90;
sp80 = D_80872E90;
} else {
@@ -193,7 +193,7 @@ void EnBomChu_WaitForRelease(EnBomChu* this, PlayState* play) {
s32 EnBomChu_IsOnCollisionPoly(PlayState* play, Vec3f* posA, Vec3f* posB, Vec3f* posResult, CollisionPoly** poly,
s32* bgId) {
if ((BgCheck_EntityLineTest1(&play->colCtx, posA, posB, posResult, poly, true, true, true, true, bgId)) &&
(!(func_800C9A4C(&play->colCtx, *poly, *bgId) & 0x30))) {
!(SurfaceType_GetWallFlags(&play->colCtx, *poly, *bgId) & (WALL_FLAG_4 | WALL_FLAG_5))) {
return true;
}
@@ -358,7 +358,7 @@ void func_80876930(EnDodongo* this, PlayState* play, Vec3f* arg2) {
s16 temp2;
f32 temp3;
if (func_800C9BB8(&play->colCtx, this->actor.floorPoly, this->actor.floorBgId) == COLPOLY_SURFACE_SNOW) {
if (SurfaceType_GetMaterial(&play->colCtx, this->actor.floorPoly, this->actor.floorBgId) == SURFACE_MATERIAL_SNOW) {
sp80 = &D_8087932C;
sp7C = &D_80879330;
} else {
+1 -1
View File
@@ -1090,7 +1090,7 @@ void func_8088EFA4(EnElf* this, PlayState* play) {
}
} else if ((arrayPointerActor != NULL) && (player->targetedActor != NULL)) {
u8 temp = this->unk_269;
u16 targetSfxId = this->unk_269 == 0 ? NA_SE_PL_WALK_GROUND - SFX_FLAG : NA_SE_PL_WALK_GROUND - SFX_FLAG;
u16 targetSfxId = (this->unk_269 == 0) ? NA_SE_NONE : NA_SE_NONE;
if (!temp) {
Actor_PlaySfx(&this->actor, targetSfxId);
@@ -500,7 +500,7 @@ void EnFamos_Chase(EnFamos* this, PlayState* play) {
this->actor.world.rot.x = -Actor_WorldPitchTowardPoint(&this->actor, &abovePlayerPos);
Math_StepToF(&this->actor.speed, 6.0f, 0.5f);
surfaceType = func_800C9B18(&play->colCtx, this->actor.floorPoly, this->actor.floorBgId);
surfaceType = SurfaceType_GetFloorProperty2(&play->colCtx, this->actor.floorPoly, this->actor.floorBgId);
if ((this->actor.xzDistToPlayer < 30.0f) && (this->actor.floorHeight > BGCHECK_Y_MIN) && // close enough
(surfaceType != 0xC && surfaceType != 0xD)) {
EnFamos_SetupAttackAim(this);
@@ -543,7 +543,7 @@ void EnFamos_Attack(EnFamos* this, PlayState* play) {
this->emblemCollider.base.acFlags &= ~AC_ON;
}
surfaceType = func_800C9B18(&play->colCtx, this->actor.floorPoly, this->actor.floorBgId);
surfaceType = SurfaceType_GetFloorProperty2(&play->colCtx, this->actor.floorPoly, this->actor.floorBgId);
hitFloor = this->actor.bgCheckFlags & BGCHECKFLAG_GROUND;
if (hitFloor || (this->actor.floorHeight == BGCHECK_Y_MIN) || (surfaceType == 0xC) || (surfaceType == 0xD)) {
this->collider1.base.atFlags &= ~AT_ON;
@@ -2445,7 +2445,7 @@ void EnFishing_UpdateLure(EnFishing* this, PlayState* play) {
sLureRot.x = 0.0f;
if (CHECK_BTN_ALL(input->press.button, BTN_B)) {
D_809101C0 += 6.0f;
Audio_PlaySfxAtPos(&D_8090D614, NA_SE_PL_WALK_SAND);
Audio_PlaySfxAtPos(&D_8090D614, NA_SE_PL_WALK_GROUND + SURFACE_SFX_OFFSET_SAND);
}
} else {
if (D_809101C0 > 150.0f) {
@@ -1431,7 +1431,7 @@ void EnGoroiwa_Update(Actor* thisx, PlayState* play) {
Vec3f sp50;
f32 sp4C;
s32 sp48 = true;
u32 temp_v0_2;
FloorType floorType;
CollisionPoly* tmp;
if (!(player->stateFlags1 &
@@ -1453,9 +1453,9 @@ void EnGoroiwa_Update(Actor* thisx, PlayState* play) {
if (this->actor.flags & ACTOR_FLAG_40) {
tmp = this->actor.floorPoly;
if (tmp != NULL) {
temp_v0_2 = func_800C99D4(&play->colCtx, tmp, this->actor.floorBgId);
floorType = SurfaceType_GetFloorType(&play->colCtx, tmp, this->actor.floorBgId);
if ((temp_v0_2 == 14) || (temp_v0_2 == 15)) {
if ((floorType == FLOOR_TYPE_14) || (floorType == FLOOR_TYPE_15)) {
if (!(this->unk_1E5 & 0x40)) {
sp50.x = this->actor.world.pos.x;
sp50.y = this->actor.floorHeight;
@@ -3472,7 +3472,7 @@ s32 EnHorse_CalcFloorHeight(EnHorse* this, PlayState* play, Vec3f* pos, Collisio
if ((COLPOLY_GET_NORMAL((*polyFloor)->normal.y) < 0.81915206f) ||
SurfaceType_IsHorseBlocked(&play->colCtx, *polyFloor, *bgId) ||
(func_800C99D4(&play->colCtx, *polyFloor, *bgId) == 7)) {
(SurfaceType_GetFloorType(&play->colCtx, *polyFloor, *bgId) == FLOOR_TYPE_7)) {
return 3; // Horse blocked surface
}
@@ -3619,7 +3619,7 @@ void EnHorse_CheckFloors(EnHorse* this, PlayState* play) {
if ((ny < 0.81915206f) ||
SurfaceType_IsHorseBlocked(&play->colCtx, this->actor.floorPoly, this->actor.floorBgId) ||
(func_800C99D4(&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.speed >= 0.0f) {
EnHorse_ObstructMovement(this, play, 4, galloping);
} else {
@@ -3891,7 +3891,7 @@ void EnHorse_UpdateBgCheckInfo(EnHorse* this, PlayState* play) {
temp_f0 = COLPOLY_GET_NORMAL(obstacleFloor->normal.y);
if ((temp_f0 < 0.81915206f) || SurfaceType_IsHorseBlocked(&play->colCtx, obstacleFloor, bgId) ||
(func_800C99D4(&play->colCtx, obstacleFloor, bgId) == 7)) {
(SurfaceType_GetFloorType(&play->colCtx, obstacleFloor, bgId) == FLOOR_TYPE_7)) {
if ((Math_CosS(sp7E) < 0.9f) && (movingFast == true) && (this->playerControlled == true) &&
(this->action != ENHORSE_ACTION_STOPPING) && (play->sceneId != SCENE_KOEPONARACE)) {
this->stateFlags |= ENHORSE_FORCE_REVERSING;
@@ -3954,7 +3954,7 @@ void EnHorse_UpdateBgCheckInfo(EnHorse* this, PlayState* play) {
temp_f0 = COLPOLY_GET_NORMAL(obstacleFloor->normal.y);
if ((temp_f0 < 0.81915206f) || SurfaceType_IsHorseBlocked(&play->colCtx, obstacleFloor, bgId) ||
(func_800C99D4(&play->colCtx, obstacleFloor, bgId) == 7)) {
(SurfaceType_GetFloorType(&play->colCtx, obstacleFloor, bgId) == FLOOR_TYPE_7)) {
if ((movingFast == true) && (this->playerControlled == true) && (this->action != ENHORSE_ACTION_STOPPING) &&
(play->sceneId != SCENE_KOEPONARACE)) {
this->stateFlags |= ENHORSE_FORCE_REVERSING;
@@ -4122,7 +4122,8 @@ s32 EnHorse_UpdateConveyors(EnHorse* this, PlayState* play) {
s16 conveyorDir;
if ((this->actor.floorPoly == NULL) || (&this->actor != player->rideActor) ||
!SurfaceType_GetConveyorSpeed(&play->colCtx, this->actor.floorPoly, this->actor.floorBgId)) {
(SurfaceType_GetConveyorSpeed(&play->colCtx, this->actor.floorPoly, this->actor.floorBgId) ==
CONVEYOR_SPEED_DISABLED)) {
return false;
}
+4 -4
View File
@@ -169,12 +169,12 @@ s32 func_808F3178(EnIn* this, PlayState* play) {
u8 tmp;
this->unk260 = tmp = SubS_IsFloorAbove(play, &this->unk248, -6.0f);
if (this->unk260 != 0 && prevUnk260 == 0 && tmp) {
Actor_PlaySfx(&this->actor, NA_SE_PL_WALK_CONCRETE);
if ((this->unk260 != 0) && (prevUnk260 == 0) && tmp) {
Actor_PlaySfx(&this->actor, NA_SE_PL_WALK_GROUND + SURFACE_SFX_OFFSET_STONE);
}
this->unk261 = tmp = SubS_IsFloorAbove(play, &this->unk254, -6.0f);
if (this->unk261 != 0 && prevUnk261 == 0 && tmp) {
Actor_PlaySfx(&this->actor, NA_SE_PL_WALK_CONCRETE);
if ((this->unk261 != 0) && (prevUnk261 == 0) && tmp) {
Actor_PlaySfx(&this->actor, NA_SE_PL_WALK_GROUND + SURFACE_SFX_OFFSET_STONE);
}
return 0;
+4 -3
View File
@@ -289,11 +289,12 @@ void func_80AD75A8(EnKame* this, PlayState* play) {
if ((this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) && (this->actor.speed >= 3.0f)) {
if ((play->gameplayFrames % 2) == 0) {
u32 temp_v0 = func_800C9BB8(&play->colCtx, this->actor.floorPoly, this->actor.floorBgId);
SurfaceMaterial surfaceMaterial =
SurfaceType_GetMaterial(&play->colCtx, this->actor.floorPoly, this->actor.floorBgId);
if ((temp_v0 == 0) || (temp_v0 == 1)) {
if ((surfaceMaterial == SURFACE_MATERIAL_DIRT) || (surfaceMaterial == SURFACE_MATERIAL_SAND)) {
func_800B1210(play, &this->actor.world.pos, &D_80AD8E5C, &gZeroVec3f, 550, 100);
} else if (temp_v0 == 14) {
} else if (surfaceMaterial == SURFACE_MATERIAL_SNOW) {
func_800B0DE0(play, &this->actor.world.pos, &D_80AD8E5C, &gZeroVec3f, &D_80AD8E54, &D_80AD8E58, 550,
100);
}
@@ -209,7 +209,7 @@ void EnKanban_Update(Actor* thisx, PlayState* play) {
Vec3f offset;
EnKanban* piece;
EnKanban* signpost;
s32 temp_v0_18;
FloorType floorType;
f32 phi_f0;
s32 pad2;
@@ -517,11 +517,11 @@ void EnKanban_Update(Actor* thisx, PlayState* play) {
}
if (onGround) {
temp_v0_18 = func_800C99D4(&play->colCtx, this->actor.floorPoly, this->actor.floorBgId);
floorType = SurfaceType_GetFloorType(&play->colCtx, this->actor.floorPoly, this->actor.floorBgId);
if ((temp_v0_18 == 15) || (temp_v0_18 == 14)) {
if ((floorType == FLOOR_TYPE_15) || (floorType == FLOOR_TYPE_14)) {
this->unk_197 = 1;
} else if (temp_v0_18 == 5) {
} else if (floorType == FLOOR_TYPE_5) {
this->unk_197 = -1;
}
@@ -623,7 +623,7 @@ void EnKanban_Update(Actor* thisx, PlayState* play) {
if (bounced) {
if (this->unk_197 > 0) {
Actor_PlaySfx(&this->actor, NA_SE_PL_WALK_SNOW);
Actor_PlaySfx(&this->actor, NA_SE_PL_WALK_GROUND + SURFACE_SFX_OFFSET_SNOW);
} else {
Actor_PlaySfx(&this->actor, NA_SE_EV_WOODPLATE_BOUND);
}
+2 -1
View File
@@ -149,7 +149,8 @@ void func_80965DB4(EnMm* this, PlayState* play) {
temp_f2 = sqrtf(SQ(temp_f14) + SQ(temp_f12));
if ((temp_f2 < this->actor.speed) ||
(SurfaceType_GetSlope(&play->colCtx, this->actor.floorPoly, this->actor.floorBgId) == 1)) {
(SurfaceType_GetFloorEffect(&play->colCtx, this->actor.floorPoly, this->actor.floorBgId) ==
FLOOR_EFFECT_1)) {
this->actor.speed = CLAMP_MAX(temp_f2, 16.0f);
this->actor.world.rot.y = Math_Atan2S_XY(temp_f12, temp_f14);
}
@@ -1089,8 +1089,9 @@ void func_80A6B0D8(EnMushi2* this, PlayState* play) {
s32 sp44 = 0;
if (this->poly != NULL) {
u32 temp_v0 = func_800C99D4(&play->colCtx, this->poly, this->polyBgId);
if ((temp_v0 == 5) || (temp_v0 == 14) || (temp_v0 == 15)) {
FloorType floorType = SurfaceType_GetFloorType(&play->colCtx, this->poly, this->polyBgId);
if ((floorType == FLOOR_TYPE_5) || (floorType == FLOOR_TYPE_14) || (floorType == FLOOR_TYPE_15)) {
sp44 = 1;
}
}
@@ -140,11 +140,12 @@ void EnNutsball_Update(Actor* thisx, PlayState* play2) {
UPDBGCHECKINFO_FLAG_1 | UPDBGCHECKINFO_FLAG_2 | UPDBGCHECKINFO_FLAG_4);
if (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) {
if (func_800C9A4C(&play->colCtx, this->actor.wallPoly, this->actor.wallBgId) & 0x30) {
if (SurfaceType_GetWallFlags(&play->colCtx, this->actor.wallPoly, this->actor.wallBgId) &
(WALL_FLAG_4 | WALL_FLAG_5)) {
this->actor.bgCheckFlags &= ~BGCHECKFLAG_WALL;
if (BgCheck_EntityLineTest1(&play->colCtx, &this->actor.prevPos, &worldPos, &this->actor.world.pos,
&poly, true, false, false, true, &bgId)) {
if (func_800C9A4C(&play->colCtx, poly, bgId) & 0x30) {
if (SurfaceType_GetWallFlags(&play->colCtx, poly, bgId) & (WALL_FLAG_4 | WALL_FLAG_5)) {
this->actor.world.pos.x += this->actor.velocity.x * 0.01f;
this->actor.world.pos.z += this->actor.velocity.z * 0.01f;
} else {
+2 -1
View File
@@ -355,7 +355,8 @@ s32 EnRat_IsOnCollisionPoly(PlayState* play, Vec3f* posA, Vec3f* posB, Vec3f* po
}
if (BgCheck_EntityLineTest1(&play->colCtx, posA, posB, posResult, poly, 1, 1, 1, 1, bgId)) {
if (!(func_800C9A4C(&play->colCtx, *poly, *bgId) & 0x30) && (!isOnWater || (waterSurface <= posResult->y))) {
if (!(SurfaceType_GetWallFlags(&play->colCtx, *poly, *bgId) & (WALL_FLAG_4 | WALL_FLAG_5)) &&
(!isOnWater || (waterSurface <= posResult->y))) {
return true;
}
}
+6 -5
View File
@@ -138,7 +138,7 @@ s32 EnRu_ChangeAnim(SkelAnime* skelAnime, s16 animIndex) {
s32 EnRu_PlayWalkingSound(EnRu* this, PlayState* play) {
u8 leftWasGrounded;
u8 rightWasGrounded;
s32 waterSfxId;
SurfaceSfxOffset surfaceSfxOffset;
s16 sfxId;
u8 isFootGrounded;
@@ -147,15 +147,16 @@ s32 EnRu_PlayWalkingSound(EnRu* this, PlayState* play) {
if (this->actor.bgCheckFlags & BGCHECKFLAG_WATER) {
if (this->actor.depthInWater < 20.0f) {
waterSfxId = NA_SE_PL_WALK_WATER0 - SFX_FLAG;
surfaceSfxOffset = SURFACE_SFX_OFFSET_WATER_SHALLOW;
} else {
waterSfxId = NA_SE_PL_WALK_WATER1 - SFX_FLAG;
surfaceSfxOffset = SURFACE_SFX_OFFSET_WATER_DEEP;
}
sfxId = waterSfxId + SFX_FLAG;
sfxId = NA_SE_PL_WALK_GROUND + surfaceSfxOffset;
} else {
sfxId = SurfaceType_GetSfx(&play->colCtx, this->actor.floorPoly, this->actor.floorBgId) + SFX_FLAG;
sfxId = NA_SE_PL_WALK_GROUND +
SurfaceType_GetSfxOffset(&play->colCtx, this->actor.floorPoly, this->actor.floorBgId);
}
this->isLeftFootGrounded = isFootGrounded = SubS_IsFloorAbove(play, &this->leftFootPos, -6.0f);
+1 -1
View File
@@ -352,7 +352,7 @@ s32 func_808D9440(PlayState* play, Vec3f* posA, Vec3f* posB, Vec3f* posResult, C
s32 ret = false;
if (BgCheck_EntityLineTest1(&play->colCtx, posA, posB, posResult, outPoly, true, true, true, true, bgId) &&
!(func_800C9A4C(&play->colCtx, *outPoly, *bgId) & 0x30)) {
!(SurfaceType_GetWallFlags(&play->colCtx, *outPoly, *bgId) & (WALL_FLAG_4 | WALL_FLAG_5))) {
ret = true;
}
return ret;
+6 -5
View File
@@ -161,18 +161,18 @@ void EnTest_Init(Actor* thisx, PlayState* play2) {
PlayState* play = play2;
EnTest* this = THIS;
MtxF sp38;
s32 sp34;
s32 bgId;
this->unk_209 = 0;
this->unk_174 = 0;
if (thisx->params > 0) {
Actor_SetScale(thisx, thisx->params / 100000.0f);
this->unk_20A = 0;
this->surfaceMaterial = SURFACE_MATERIAL_DIRT;
} else {
thisx->floorPoly = NULL;
thisx->world.pos.y += 10.0f;
thisx->floorHeight = BgCheck_EntityRaycastFloor3(&play->colCtx, &thisx->floorPoly, &sp34, &thisx->world.pos);
thisx->floorHeight = BgCheck_EntityRaycastFloor3(&play->colCtx, &thisx->floorPoly, &bgId, &thisx->world.pos);
if ((thisx->floorPoly == NULL) || (thisx->floorHeight == BGCHECK_Y_MIN)) {
Actor_Kill(thisx);
@@ -183,7 +183,7 @@ void EnTest_Init(Actor* thisx, PlayState* play2) {
func_800C0094(thisx->floorPoly, thisx->world.pos.x, thisx->floorHeight, thisx->world.pos.z, &sp38);
Matrix_MtxFToYXZRot(&sp38, &thisx->shape.rot, true);
thisx->world.rot = thisx->shape.rot;
this->unk_20A = func_800C9BB8(&play->colCtx, thisx->floorPoly, sp34);
this->surfaceMaterial = SurfaceType_GetMaterial(&play->colCtx, thisx->floorPoly, bgId);
}
func_80183430(&this->skeletonInfo, &gameplay_keep_Blob_06EB70, &gameplay_keep_Blob_06BB0C, this->unk_178,
@@ -257,7 +257,8 @@ void EnTest_Draw(Actor* thisx, PlayState* play) {
sp2C = 29;
}
if ((this->unk_20A == 15) || (this->unk_20A == 14)) {
//! @bug Checks for non-existent SURFACE_MATERIAL_MAX material
if ((this->surfaceMaterial == SURFACE_MATERIAL_MAX) || (this->surfaceMaterial == SURFACE_MATERIAL_SNOW)) {
AnimatedMat_DrawStep(play, Lib_SegmentedToVirtual(gameplay_keep_Matanimheader_06B730), sp2C);
} else {
AnimatedMat_DrawStep(play, Lib_SegmentedToVirtual(gameplay_keep_Matanimheader_06B6A0), sp2C);
+1 -1
View File
@@ -24,7 +24,7 @@ typedef struct EnTest {
/* 0x1C0 */ Vec3s unk_1C0[12];
/* 0x208 */ u8 unk_208;
/* 0x209 */ u8 unk_209;
/* 0x20A */ u8 unk_20A;
/* 0x20A */ u8 surfaceMaterial;
/* 0x20C */ EnTestStruct unk_20C[20];
} EnTest; // size = 0x6BC
+5 -4
View File
@@ -197,7 +197,7 @@ void func_80893A18(EnTite* this) {
s32 func_80893A34(EnTite* this, PlayState* play) {
if ((this->actor.params == ENTITE_MINUS_2) && (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) &&
(func_800C99D4(&play->colCtx, this->actor.floorPoly, this->actor.floorBgId) == 5)) {
(SurfaceType_GetFloorType(&play->colCtx, this->actor.floorPoly, this->actor.floorBgId) == FLOOR_TYPE_5)) {
return true;
}
return false;
@@ -240,13 +240,14 @@ void func_80893BCC(EnTite* this, PlayState* play) {
s32 j;
if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND_TOUCH) {
u32 surface = func_800C9BB8(&play->colCtx, this->actor.floorPoly, this->actor.floorBgId);
SurfaceMaterial surfaceMaterial =
SurfaceType_GetMaterial(&play->colCtx, this->actor.floorPoly, this->actor.floorBgId);
if ((surface == COLPOLY_SURFACE_GROUND) || (surface == COLPOLY_SURFACE_SAND)) {
if ((surfaceMaterial == SURFACE_MATERIAL_DIRT) || (surfaceMaterial == SURFACE_MATERIAL_SAND)) {
for (i = 5; i < ARRAY_COUNT(this->limbPos); i++) {
func_800BBFB0(play, &this->limbPos[i], 1.0f, 2, 80, 15, 1);
}
} else if (surface == COLPOLY_SURFACE_SNOW) {
} else if (surfaceMaterial == SURFACE_MATERIAL_SNOW) {
Vec3f* ptr;
for (i = 5; i < ARRAY_COUNT(this->limbPos); i++) {
+6 -5
View File
@@ -1035,13 +1035,13 @@ s32 func_80AEE86C(EnTk* this, PlayState* play) {
s32 pad;
s32 ret = false;
s32 pad2;
CollisionPoly* sp38;
s32 sp34;
CollisionPoly* groundPoly;
s32 bgId;
Vec3f sp28;
Lib_Vec3f_TranslateAndRotateY(&this->actor.world.pos, this->actor.shape.rot.y, &D_80AEFA78, &sp28);
if ((BgCheck_EntityRaycastFloor3(&play->colCtx, &sp38, &sp34, &sp28) != BGCHECK_Y_MIN) &&
(func_800C9BB8(&play->colCtx, sp38, sp34) == 1) && (this->unk_2D0 == (u32)1) &&
if ((BgCheck_EntityRaycastFloor3(&play->colCtx, &groundPoly, &bgId, &sp28) != BGCHECK_Y_MIN) &&
(SurfaceType_GetMaterial(&play->colCtx, groundPoly, bgId) == SURFACE_MATERIAL_SAND) && (this->unk_2D0 == 1) &&
(this->actor.xyzDistToPlayerSq <= SQ(115.0f)) &&
func_80AEE7E0(&this->actor.world.pos, 100.0f, this->unk_324, this->unk_36C) &&
(((this->unk_2CA & 2) && (Math_Vec3f_DistXZ(&this->unk_300, &sp28) >= 100.0f)) || !(this->unk_2CA & 2)) &&
@@ -1312,7 +1312,8 @@ void EnTk_Update(Actor* thisx, PlayState* play) {
Actor_MoveWithGravity(&this->actor);
Actor_UpdateBgCheckInfo(play, &this->actor, 10.0f, 10.0f, 0.0f, UPDBGCHECKINFO_FLAG_1 | UPDBGCHECKINFO_FLAG_4);
if ((this->unk_2B0 == 0) && (func_800C9B40(&play->colCtx, this->actor.floorPoly, this->actor.floorBgId) == 12)) {
if ((this->unk_2B0 == 0) && (SurfaceType_GetFloorProperty(&play->colCtx, this->actor.floorPoly,
this->actor.floorBgId) == FLOOR_PROPERTY_12)) {
Math_Vec3f_Copy(&this->actor.world.pos, &this->actor.prevPos);
this->unk_2CA |= 0x200;
this->actor.velocity.y = 0.0f;
+5 -4
View File
@@ -471,14 +471,15 @@ void func_80990C6C(EnWf* this, PlayState* play, s32 arg2) {
static Color_RGBA8 D_809942EC = { 255, 255, 255, 255 };
s32 i;
Vec3f sp88;
u32 temp_v0;
FloorType floorType;
Color_RGBA8* phi_s1;
s16 phi_s6;
if (this->actor.floorPoly != NULL) {
temp_v0 = func_800C99D4(&play->colCtx, this->actor.floorPoly, this->actor.floorBgId);
if (temp_v0 != 5) {
if ((temp_v0 == 15) || (temp_v0 == 14)) {
floorType = SurfaceType_GetFloorType(&play->colCtx, this->actor.floorPoly, this->actor.floorBgId);
if (floorType != FLOOR_TYPE_5) {
if ((floorType == FLOOR_TYPE_15) || (floorType == FLOOR_TYPE_14)) {
phi_s1 = &D_809942EC;
phi_s6 = Rand_ZeroFloat(150.0f) + 350.0f;
arg2 += 2;
+6 -5
View File
@@ -122,7 +122,7 @@ s32 EnZo_ChangeAnim(SkelAnime* skelAnime, s16 animIndex) {
s32 EnZo_PlayWalkingSound(EnZo* this, PlayState* play) {
u8 leftWasGrounded;
u8 rightWasGrounded;
s32 waterSfxId;
SurfaceSfxOffset surfaceSfxOffset;
u16 sfxId;
u8 isFootGrounded;
@@ -131,13 +131,14 @@ s32 EnZo_PlayWalkingSound(EnZo* this, PlayState* play) {
if (this->actor.bgCheckFlags & BGCHECKFLAG_WATER) {
if (this->actor.depthInWater < 20.0f) {
waterSfxId = NA_SE_PL_WALK_WATER0 - SFX_FLAG;
surfaceSfxOffset = SURFACE_SFX_OFFSET_WATER_SHALLOW;
} else {
waterSfxId = NA_SE_PL_WALK_WATER1 - SFX_FLAG;
surfaceSfxOffset = SURFACE_SFX_OFFSET_WATER_DEEP;
}
sfxId = waterSfxId + SFX_FLAG;
sfxId = NA_SE_PL_WALK_GROUND + surfaceSfxOffset;
} else {
sfxId = SurfaceType_GetSfx(&play->colCtx, this->actor.floorPoly, this->actor.floorBgId) + SFX_FLAG;
sfxId = NA_SE_PL_WALK_GROUND +
SurfaceType_GetSfxOffset(&play->colCtx, this->actor.floorPoly, this->actor.floorBgId);
}
this->isLeftFootGrounded = isFootGrounded = SubS_IsFloorAbove(play, &this->leftFootPos, -6.0f);
+3 -3
View File
@@ -781,15 +781,15 @@ void func_80B94A00(EnZog* this, PlayState* play) {
if ((this->unk_304 == 4) &&
(Animation_OnFrame(&this->skelAnime, 136.0f) || Animation_OnFrame(&this->skelAnime, 155.0f))) {
Actor_PlaySfx(&this->actor, NA_SE_PL_WALK_WATER0);
Actor_PlaySfx(&this->actor, NA_SE_PL_WALK_GROUND + SURFACE_SFX_OFFSET_WATER_SHALLOW);
}
if ((this->unk_304 == 5) &&
(Animation_OnFrame(&this->skelAnime, 12.0f) || Animation_OnFrame(&this->skelAnime, 37.0f))) {
if (this->actor.depthInWater > 0.0f) {
Actor_PlaySfx(&this->actor, NA_SE_PL_WALK_WATER0);
Actor_PlaySfx(&this->actor, NA_SE_PL_WALK_GROUND + SURFACE_SFX_OFFSET_WATER_SHALLOW);
} else {
Actor_PlaySfx(&this->actor, NA_SE_PL_WALK_SAND);
Actor_PlaySfx(&this->actor, NA_SE_PL_WALK_GROUND + SURFACE_SFX_OFFSET_SAND);
}
}
}
@@ -629,7 +629,8 @@ s32 func_80A24954(ObjIceblock* this, PlayState* play) {
func_80A262BC(this);
this->unk_2B0 = 3;
} else if (this->unk_1B0 & 4) {
if (func_800C99D4(&play->colCtx, this->dyna.actor.floorPoly, this->dyna.actor.floorBgId) == 5) {
if (SurfaceType_GetFloorType(&play->colCtx, this->dyna.actor.floorPoly, this->dyna.actor.floorBgId) ==
FLOOR_TYPE_5) {
func_80A25FA0(this);
this->unk_2B0 = 2;
} else {
@@ -4,7 +4,6 @@
* Description: Sakon's Hideout Objects (Sun's Mask, doors, etc)
*/
#include "prevent_bss_reordering.h"
#include "z_obj_nozoki.h"
#include "objects/object_secom_obj/object_secom_obj.h"
@@ -554,9 +554,9 @@ void ObjOshihiki_Fall(ObjOshihiki* this, PlayState* play) {
ObjOshihiki_SetupOnActor(this, play);
}
Actor_PlaySfx(&this->dyna.actor, NA_SE_EV_BLOCK_BOUND);
Actor_PlaySfx(&this->dyna.actor, SurfaceType_GetSfx(&play->colCtx, this->floorPolys[this->highestFloor],
this->floorBgIds[this->highestFloor]) +
SFX_FLAG);
Actor_PlaySfx(&this->dyna.actor, NA_SE_PL_WALK_GROUND + SurfaceType_GetSfxOffset(
&play->colCtx, this->floorPolys[this->highestFloor],
this->floorBgIds[this->highestFloor]));
}
}
@@ -614,7 +614,8 @@ void func_80A2264C(ObjSkateblock* this, PlayState* play) {
sp20 = func_80A21548(this, play);
if (sp20 || ((this->unk_160 - this->dyna.actor.world.pos.y) > 300.0f)) {
if (func_800C9B40(&play->colCtx, this->dyna.actor.floorPoly, this->dyna.actor.floorBgId) == 12) {
if (SurfaceType_GetFloorProperty(&play->colCtx, this->dyna.actor.floorPoly, this->dyna.actor.floorBgId) ==
FLOOR_PROPERTY_12) {
func_800C62BC(play, &play->colCtx.dyna, this->dyna.bgId);
this->dyna.actor.draw = NULL;
func_80A22728(this);
@@ -22,7 +22,11 @@ EffectSsInit Effect_Ss_Bubble_InitVars = {
EffectSsBubble_Init,
};
static f32 sVecAdjMaximums[] = { 291.0f, 582.0f, 1600.0f };
static f32 sVecAdjMaximums[] = {
291.0f, // CONVEYOR_SPEED_SLOW
582.0f, // CONVEYOR_SPEED_MEDIUM
1600.0f, // CONVEYOR_SPEED_FAST
};
u32 EffectSsBubble_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx) {
EffectSsBubbleInitParams* initParams = (EffectSsBubbleInitParams*)initParamsx;
@@ -85,17 +89,18 @@ void EffectSsBubble_Update(PlayState* play2, u32 index, EffectSs* this) {
}
if (((play->gameplayFrames + index) % 8) == 0) {
CollisionPoly* colPoly;
u32 speed;
s16 direction;
ConveyorSpeed conveyorSpeed;
s16 conveyorDir;
f32 rVecAdjMax;
BgCheck_EntityRaycastFloor2_1(play, &play->colCtx, &colPoly, &this->pos);
speed = SurfaceType_GetConveyorSpeed(&play->colCtx, colPoly, BGCHECK_SCENE);
if ((speed != 0) && !SurfaceType_IsFloorConveyor(&play->colCtx, colPoly, BGCHECK_SCENE)) {
direction = SurfaceType_GetConveyorDirection(&play->colCtx, colPoly, BGCHECK_SCENE) << 0xA;
rVecAdjMax = sVecAdjMaximums[speed - 1];
this->rVecAdjX = Math_SinS(direction) * rVecAdjMax;
this->rVecAdjZ = Math_CosS(direction) * rVecAdjMax;
conveyorSpeed = SurfaceType_GetConveyorSpeed(&play->colCtx, colPoly, BGCHECK_SCENE);
if ((conveyorSpeed != CONVEYOR_SPEED_DISABLED) &&
!SurfaceType_IsFloorConveyor(&play->colCtx, colPoly, BGCHECK_SCENE)) {
conveyorDir = SurfaceType_GetConveyorDirection(&play->colCtx, colPoly, BGCHECK_SCENE) << 10;
rVecAdjMax = sVecAdjMaximums[conveyorSpeed - 1];
this->rVecAdjX = Math_SinS(conveyorDir) * rVecAdjMax;
this->rVecAdjZ = Math_CosS(conveyorDir) * rVecAdjMax;
}
}
this->vec.x += this->rVecAdjX / 100.0f;