Add bounds checks to skybox get/set functions

This commit is contained in:
Agent X 2024-06-22 17:30:54 -04:00
parent bc4e893f2d
commit 69cb215219

View file

@ -2,6 +2,7 @@
#include "pc/gfx/gfx_pc.h" #include "pc/gfx/gfx_pc.h"
#include "game/rendering_graph_node.h" #include "game/rendering_graph_node.h"
#include "game/skybox.h" #include "game/skybox.h"
#include "geo_commands.h"
void set_override_fov(f32 fov) { void set_override_fov(f32 fov) {
gOverrideFOV = fov; gOverrideFOV = fov;
@ -76,10 +77,12 @@ void set_fog_intensity(f32 intensity) {
/// ///
s8 get_skybox(void) { s8 get_skybox(void) {
if (gOverrideBackground != -1) { return gOverrideBackground; }
return gReadOnlyBackground; return gReadOnlyBackground;
} }
void set_override_skybox(s8 background) { void set_override_skybox(s8 background) {
if (background < -1 || background > BACKGROUND_CUSTOM) { return; }
gOverrideBackground = background; gOverrideBackground = background;
} }