diff --git a/docs/lua/functions-3.md b/docs/lua/functions-3.md index 31ce79ac4..05ed93131 100644 --- a/docs/lua/functions-3.md +++ b/docs/lua/functions-3.md @@ -6366,7 +6366,7 @@ Removes a lighting engine point light corresponding to `id` - None ### C Prototype -`void le_remove_light(s16 id);` +`void le_remove_light(s32 id);` [:arrow_up_small:](#) @@ -6417,7 +6417,7 @@ Sets a lighting engine point light's color to `r`, `g`, `b` - None ### C Prototype -`void le_set_light_color(s16 id, u8 r, u8 g, u8 b);` +`void le_set_light_color(s32 id, u8 r, u8 g, u8 b);` [:arrow_up_small:](#) @@ -6441,7 +6441,7 @@ Sets a lighting engine point light's `intensity` - None ### C Prototype -`void le_set_light_intensity(s16 id, f32 intensity);` +`void le_set_light_intensity(s32 id, f32 intensity);` [:arrow_up_small:](#) @@ -6467,7 +6467,7 @@ Sets a lighting engine point light's position to `x`, `y`, `z` - None ### C Prototype -`void le_set_light_pos(s16 id, f32 x, f32 y, f32 z);` +`void le_set_light_pos(s32 id, f32 x, f32 y, f32 z);` [:arrow_up_small:](#) @@ -6491,7 +6491,7 @@ Sets a lighting engine point light's `radius` - None ### C Prototype -`void le_set_light_radius(s16 id, f32 radius);` +`void le_set_light_radius(s32 id, f32 radius);` [:arrow_up_small:](#) diff --git a/src/engine/lighting_engine.c b/src/engine/lighting_engine.c index b27839df5..0a6711525 100644 --- a/src/engine/lighting_engine.c +++ b/src/engine/lighting_engine.c @@ -86,7 +86,7 @@ void le_calculate_lighting_dir(Vec3f pos, Vec3f out) { if (sLights == NULL) { return; } Vec3f lightingDir = { 0, 0, 0 }; - s16 count = 1; + s32 count = 1; for (struct LELight* light = hmap_begin(sLights); light != NULL; light = hmap_next(sLights)) { f32 diffX = light->posX - pos[0]; f32 diffY = light->posY - pos[1]; @@ -136,7 +136,7 @@ s32 le_add_light(f32 x, f32 y, f32 z, u8 r, u8 g, u8 b, f32 radius, f32 intensit return sLightID; } -void le_remove_light(s16 id) { +void le_remove_light(s32 id) { if (sLights == NULL || id <= 0) { return; } free(hmap_get(sLights, id)); @@ -152,7 +152,7 @@ void le_set_ambient_color(u8 r, u8 g, u8 b) { color_set(sAmbientColor, r, g, b); } -void le_set_light_pos(s16 id, f32 x, f32 y, f32 z) { +void le_set_light_pos(s32 id, f32 x, f32 y, f32 z) { if (sLights == NULL || id <= 0) { return; } struct LELight* light = hmap_get(sLights, id); @@ -162,7 +162,7 @@ void le_set_light_pos(s16 id, f32 x, f32 y, f32 z) { light->posZ = z; } -void le_set_light_color(s16 id, u8 r, u8 g, u8 b) { +void le_set_light_color(s32 id, u8 r, u8 g, u8 b) { if (sLights == NULL || id <= 0) { return; } struct LELight* light = hmap_get(sLights, id); @@ -172,7 +172,7 @@ void le_set_light_color(s16 id, u8 r, u8 g, u8 b) { light->colorB = b; } -void le_set_light_radius(s16 id, f32 radius) { +void le_set_light_radius(s32 id, f32 radius) { if (sLights == NULL || id <= 0) { return; } struct LELight* light = hmap_get(sLights, id); @@ -180,7 +180,7 @@ void le_set_light_radius(s16 id, f32 radius) { light->radius = radius; } -void le_set_light_intensity(s16 id, f32 intensity) { +void le_set_light_intensity(s32 id, f32 intensity) { if (sLights == NULL || id <= 0) { return; } struct LELight* light = hmap_get(sLights, id); diff --git a/src/engine/lighting_engine.h b/src/engine/lighting_engine.h index 5708722df..d0a99dc9e 100644 --- a/src/engine/lighting_engine.h +++ b/src/engine/lighting_engine.h @@ -23,19 +23,19 @@ void le_calculate_lighting_dir(Vec3f pos, Vec3f out); /* |description|Adds a lighting engine point light at `x`, `y`, `z` with color `r`, `g`, `b` and `radius` with `intensity`|descriptionEnd| */ s32 le_add_light(f32 x, f32 y, f32 z, u8 r, u8 g, u8 b, f32 radius, f32 intensity); /* |description|Removes a lighting engine point light corresponding to `id`|descriptionEnd| */ -void le_remove_light(s16 id); +void le_remove_light(s32 id); /* |description|Gets the total number of lights currently loaded in the lighting engine|descriptionEnd| */ s32 le_get_light_count(void); /* |description|Sets the lighting engine ambient color|descriptionEnd| */ void le_set_ambient_color(u8 r, u8 g, u8 b); /* |description|Sets a lighting engine point light's position to `x`, `y`, `z`|descriptionEnd| */ -void le_set_light_pos(s16 id, f32 x, f32 y, f32 z); +void le_set_light_pos(s32 id, f32 x, f32 y, f32 z); /* |description|Sets a lighting engine point light's color to `r`, `g`, `b`|descriptionEnd| */ -void le_set_light_color(s16 id, u8 r, u8 g, u8 b); +void le_set_light_color(s32 id, u8 r, u8 g, u8 b); /* |description|Sets a lighting engine point light's `radius`|descriptionEnd| */ -void le_set_light_radius(s16 id, f32 radius); +void le_set_light_radius(s32 id, f32 radius); /* |description|Sets a lighting engine point light's `intensity`|descriptionEnd| */ -void le_set_light_intensity(s16 id, f32 intensity); +void le_set_light_intensity(s32 id, f32 intensity); void le_clear(void); void le_shutdown(void); diff --git a/src/pc/lua/smlua_functions_autogen.c b/src/pc/lua/smlua_functions_autogen.c index edbe878be..be2f78710 100644 --- a/src/pc/lua/smlua_functions_autogen.c +++ b/src/pc/lua/smlua_functions_autogen.c @@ -15121,7 +15121,7 @@ int smlua_func_le_remove_light(lua_State* L) { return 0; } - s16 id = smlua_to_integer(L, 1); + s32 id = smlua_to_integer(L, 1); if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "le_remove_light"); return 0; } le_remove_light(id); @@ -15159,7 +15159,7 @@ int smlua_func_le_set_light_color(lua_State* L) { return 0; } - s16 id = smlua_to_integer(L, 1); + s32 id = smlua_to_integer(L, 1); if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "le_set_light_color"); return 0; } u8 r = smlua_to_integer(L, 2); if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "le_set_light_color"); return 0; } @@ -15182,7 +15182,7 @@ int smlua_func_le_set_light_intensity(lua_State* L) { return 0; } - s16 id = smlua_to_integer(L, 1); + s32 id = smlua_to_integer(L, 1); if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "le_set_light_intensity"); return 0; } f32 intensity = smlua_to_number(L, 2); if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "le_set_light_intensity"); return 0; } @@ -15201,7 +15201,7 @@ int smlua_func_le_set_light_pos(lua_State* L) { return 0; } - s16 id = smlua_to_integer(L, 1); + s32 id = smlua_to_integer(L, 1); if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "le_set_light_pos"); return 0; } f32 x = smlua_to_number(L, 2); if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "le_set_light_pos"); return 0; } @@ -15224,7 +15224,7 @@ int smlua_func_le_set_light_radius(lua_State* L) { return 0; } - s16 id = smlua_to_integer(L, 1); + s32 id = smlua_to_integer(L, 1); if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "le_set_light_radius"); return 0; } f32 radius = smlua_to_number(L, 2); if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "le_set_light_radius"); return 0; }