You've already forked HackerSM64
mirror of
https://github.com/HackerN64/HackerSM64.git
synced 2026-01-21 10:35:32 -08:00
Clamp constant falloff to 8 minimum (#840)
This commit is contained in:
@@ -770,13 +770,13 @@ static s32 bhv_cmd_set_light_color(void) {
|
||||
// Command 0x39: Sets an object's light falloff
|
||||
// Usage: SET_LIGHT_FALLOFF(constant, linear, quadratic)
|
||||
static s32 bhv_cmd_set_light_falloff(void) {
|
||||
s32 constantFalloff = BHV_CMD_GET_2ND_S16(0);
|
||||
s32 linearFalloff = BHV_CMD_GET_1ST_S16(1);
|
||||
s32 quadraticFalloff = BHV_CMD_GET_2ND_S16(1);
|
||||
u32 constantFalloff = BHV_CMD_GET_2ND_S16(0);
|
||||
u32 linearFalloff = BHV_CMD_GET_1ST_S16(1);
|
||||
u32 quadraticFalloff = BHV_CMD_GET_2ND_S16(1);
|
||||
|
||||
gCurrentObject->oLightQuadraticFalloff = quadraticFalloff;
|
||||
gCurrentObject->oLightLinearFalloff = linearFalloff;
|
||||
gCurrentObject->oLightConstantFalloff = constantFalloff;
|
||||
gCurrentObject->oLightConstantFalloff = MAX(constantFalloff, 8U);
|
||||
|
||||
gCurBhvCommand += 2;
|
||||
return BHV_PROC_CONTINUE;
|
||||
|
||||
@@ -775,7 +775,7 @@ void emit_light(Vec3f pos, s32 red, s32 green, s32 blue, u32 quadraticFalloff, u
|
||||
gPointLights[gPointLightCount].l.pl.colc[0] = gPointLights[gPointLightCount].l.pl.col[0] = red;
|
||||
gPointLights[gPointLightCount].l.pl.colc[1] = gPointLights[gPointLightCount].l.pl.col[1] = green;
|
||||
gPointLights[gPointLightCount].l.pl.colc[2] = gPointLights[gPointLightCount].l.pl.col[2] = blue;
|
||||
gPointLights[gPointLightCount].l.pl.constant_attenuation = (constantFalloff == 0) ? 8 : constantFalloff;
|
||||
gPointLights[gPointLightCount].l.pl.constant_attenuation = MAX(constantFalloff, 8U);
|
||||
gPointLights[gPointLightCount].l.pl.linear_attenuation = linearFalloff;
|
||||
gPointLights[gPointLightCount].l.pl.quadratic_attenuation = quadraticFalloff;
|
||||
gPointLights[gPointLightCount].worldPos[0] = pos[0];
|
||||
@@ -1507,7 +1507,7 @@ void geo_process_scene_light(struct GraphNodeSceneLight *node)
|
||||
|
||||
node->light->l.pl.quadratic_attenuation = node->a;
|
||||
node->light->l.pl.linear_attenuation = node->b;
|
||||
node->light->l.pl.constant_attenuation = (node->c == 0) ? 8 : node->c;
|
||||
node->light->l.pl.constant_attenuation = MAX(node->c, 8U);
|
||||
break;
|
||||
case LIGHT_TYPE_AMBIENT:
|
||||
if (!gOverrideAmbientLight)
|
||||
|
||||
Reference in New Issue
Block a user