Skip to content

Commit

Permalink
fix issues in scene when disabled
Browse files Browse the repository at this point in the history
  • Loading branch information
Yanis002 committed Jan 5, 2025
1 parent 0e68aab commit 95f0860
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 22 deletions.
6 changes: 0 additions & 6 deletions include/z64scene.h
Original file line number Diff line number Diff line change
Expand Up @@ -556,10 +556,8 @@ typedef enum SceneDrawConfig {
/* 50 */ SDC_FISHING_POND,
/* 51 */ SDC_GANONS_TOWER_COLLAPSE_INTERIOR,
/* 52 */ SDC_INSIDE_GANONS_CASTLE_COLLAPSE,
#if ENABLE_ANIMATED_MATERIALS
/* 53 */ SDC_MAT_ANIM,
/* 54 */ SDC_MAT_ANIM_MANUAL_STEP,
#endif
/* 55 */ SDC_MAX
} SceneDrawConfig;

Expand Down Expand Up @@ -612,9 +610,7 @@ typedef enum SceneCommandTypeID {
#if ENABLE_F3DEX3
SCENE_CMD_ID_OCC_PLANE_CAND_LIST,
#endif
#if ENABLE_ANIMATED_MATERIALS
SCENE_CMD_ID_ANIMATED_MATERIAL_LIST,
#endif
/* 0x1A */ SCENE_CMD_ID_MAX
} SceneCommandTypeID;

Expand Down Expand Up @@ -702,10 +698,8 @@ typedef enum SceneCommandTypeID {
{ SCENE_CMD_ID_OCC_PLANE_CAND_LIST, numPlanes, CMD_PTR(planeList) }
#endif

#if ENABLE_ANIMATED_MATERIALS
#define SCENE_CMD_ANIMATED_MATERIAL_LIST(matAnimList) \
{ SCENE_CMD_ID_ANIMATED_MATERIAL_LIST, 0, CMD_PTR(matAnimList) }
#endif


s32 Scene_ExecuteCommands(struct PlayState* play, SceneCmd* sceneCmd);
Expand Down
8 changes: 2 additions & 6 deletions src/code/z_scene.c
Original file line number Diff line number Diff line change
Expand Up @@ -527,13 +527,11 @@ void Scene_SetTransitionForNextEntrance(PlayState* play) {
play->transitionType = ENTRANCE_INFO_START_TRANS_TYPE(gEntranceTable[entranceIndex].field);
}

#if ENABLE_ANIMATED_MATERIALS

void Scene_CommandAnimatedMaterials(PlayState* play, SceneCmd* cmd) {
#if ENABLE_ANIMATED_MATERIALS
play->sceneMaterialAnims = SEGMENTED_TO_VIRTUAL(cmd->textureAnimations.segment);
}

#endif
}

SceneCmdHandlerFunc sSceneCmdHandlers[SCENE_CMD_ID_MAX] = {
Scene_CommandPlayerEntryList, // SCENE_CMD_ID_SPAWN_LIST
Expand Down Expand Up @@ -565,9 +563,7 @@ SceneCmdHandlerFunc sSceneCmdHandlers[SCENE_CMD_ID_MAX] = {
#if ENABLE_F3DEX3
Scene_CommandOccPlaneCandList, // SCENE_CMD_ID_OCC_PLANE_CAND_LIST
#endif
#if ENABLE_ANIMATED_MATERIALS
Scene_CommandAnimatedMaterials, // SCENE_CMD_ID_ANIMATED_MATERIAL_LIST
#endif
};

RomFile sNaviQuestHintFiles[] = {
Expand Down
20 changes: 10 additions & 10 deletions src/code/z_scene_table.c
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,8 @@ void Scene_DrawConfigFishingPond(PlayState* play);
void Scene_DrawConfigGanonsTowerCollapseInterior(PlayState* play);
void Scene_DrawConfigInsideGanonsCastleCollapse(PlayState* play);

#if ENABLE_ANIMATED_MATERIALS
void Scene_DrawConfigMatAnim(PlayState* play);
void Scene_DrawConfigMatAnimManualStep(PlayState* play);
#endif

// Entrance Table definition
#define DEFINE_ENTRANCE(_0, sceneId, spawn, continueBgm, displayTitleCard, endTransType, startTransType) \
Expand Down Expand Up @@ -198,10 +196,8 @@ SceneDrawConfigFunc sSceneDrawConfigs[SDC_MAX] = {
Scene_DrawConfigFishingPond, // SDC_FISHING_POND
Scene_DrawConfigGanonsTowerCollapseInterior, // SDC_GANONS_TOWER_COLLAPSE_INTERIOR
Scene_DrawConfigInsideGanonsCastleCollapse, // SDC_INSIDE_GANONS_CASTLE_COLLAPSE
#if ENABLE_ANIMATED_MATERIALS
Scene_DrawConfigMatAnim, // SDC_MAT_ANIM
Scene_DrawConfigMatAnimManualStep, // SDC_MAT_ANIM_MANUAL_STEP
#endif
Scene_DrawConfigMatAnim, // SDC_MAT_ANIM
Scene_DrawConfigMatAnimManualStep, // SDC_MAT_ANIM_MANUAL_STEP
};

#if PLATFORM_N64 // Scene_Draw is at end of file in GC/iQue versions
Expand Down Expand Up @@ -1713,24 +1709,28 @@ void Scene_DrawConfigBesitu(PlayState* play) {
CLOSE_DISPS(play->state.gfxCtx, "../z_scene_table.c", 7910);
}

#if ENABLE_ANIMATED_MATERIALS

/**
* Allows the usage of the animated material system in scenes.
*/
void Scene_DrawConfigMatAnim(PlayState* play) {
#if ENABLE_ANIMATED_MATERIALS
AnimatedMat_Draw(play, play->sceneMaterialAnims);
#else
Scene_DrawConfigDefault(play);
#endif
}

/**
* This is a special draw config for Sakon's Hideout, as well as the Music Box House. Its step value is set manually
* rather than always animating like `Scene_DrawConfigMatAnim`.
*/
void Scene_DrawConfigMatAnimManualStep(PlayState* play) {
#if ENABLE_ANIMATED_MATERIALS
AnimatedMat_DrawStep(play, play->sceneMaterialAnims, play->roomCtx.drawParams[0]);
}

#else
Scene_DrawConfigDefault(play);
#endif
}

#if !PLATFORM_N64 // Scene_Draw is at beginning of file in N64 versions

Expand Down

0 comments on commit 95f0860

Please sign in to comment.