output: tidy shade constants

This commit is contained in:
Marcin Kurczewski 2025-04-20 21:25:34 +02:00
parent cd67279fc7
commit 962a66a090
24 changed files with 76 additions and 73 deletions

View file

@ -1,6 +1,6 @@
#define WALL_L 1024 #define WALL_L 1024
#define NEUTRAL_SHADE 0x1000 #define SHADE_NEUTRAL 0x1000
#define MAX_SHADE 0x1FFF #define SHADE_MAX 0x1FFF
#define VERT_NO_CAUSTICS 0x01 #define VERT_NO_CAUSTICS 0x01
#define VERT_FLAT_SHADED 0x02 #define VERT_FLAT_SHADED 0x02
@ -35,15 +35,15 @@ float shadeFog(float shade, float depth, vec2 fog)
if (depth < fogBegin) { if (depth < fogBegin) {
return shade + 0.0; return shade + 0.0;
} else if (depth >= fogEnd) { } else if (depth >= fogEnd) {
return shade + float(MAX_SHADE); return shade + float(SHADE_MAX);
} else { } else {
return shade + (depth - fogBegin) * MAX_SHADE / (fogEnd - fogBegin); return shade + (depth - fogBegin) * SHADE_MAX / (fogEnd - fogBegin);
} }
} }
vec3 applyShade(vec3 color, float shade) vec3 applyShade(vec3 color, float shade)
{ {
return color * (2.0 - (shade / NEUTRAL_SHADE)); return color * (2.0 - (shade / SHADE_NEUTRAL));
} }
bool discardTranslucent(sampler2D tex, vec2 uv) bool discardTranslucent(sampler2D tex, vec2 uv)

View file

@ -52,7 +52,7 @@ static void M_CalculateBrightestLight(
} }
#endif #endif
const int32_t ambient = TR_VERSION == 1 ? (0x1FFF - room->ambient) : 0; const int32_t ambient = TR_VERSION == 1 ? (SHADE_MAX - room->ambient) : 0;
for (int32_t i = 0; i < room->num_lights; i++) { for (int32_t i = 0; i < room->num_lights; i++) {
const LIGHT *const light = &room->lights[i]; const LIGHT *const light = &room->lights[i];
const int32_t dx = pos.x - light->pos.x; const int32_t dx = pos.x - light->pos.x;
@ -112,7 +112,7 @@ void Output_CalculateLight(const XYZ_32 pos, const int16_t room_num)
adder = (adder + dynamic_adder) / 2; adder = (adder + dynamic_adder) / 2;
if (TR_VERSION == 1 && (room->num_lights > 0 || dynamic_adder > 0)) { if (TR_VERSION == 1 && (room->num_lights > 0 || dynamic_adder > 0)) {
adder += (0x1FFF - room->ambient) / 2; adder += (SHADE_MAX - room->ambient) / 2;
} }
// TODO: use m_LsAdder and m_LsDivider once ported // TODO: use m_LsAdder and m_LsDivider once ported
@ -123,7 +123,7 @@ void Output_CalculateLight(const XYZ_32 pos, const int16_t room_num)
global_divider = 0; global_divider = 0;
} else { } else {
#if TR_VERSION == 1 #if TR_VERSION == 1
global_adder = 0x1FFF - adder; global_adder = SHADE_MAX - adder;
const int32_t divider = brightest_light.shade == adder const int32_t divider = brightest_light.shade == adder
? adder ? adder
: brightest_light.shade - adder; : brightest_light.shade - adder;
@ -141,7 +141,7 @@ void Output_CalculateLight(const XYZ_32 pos, const int16_t room_num)
const int32_t depth = g_MatrixPtr->_23 >> W2V_SHIFT; const int32_t depth = g_MatrixPtr->_23 >> W2V_SHIFT;
global_adder += Output_CalcFogShade(depth); global_adder += Output_CalcFogShade(depth);
CLAMPG(global_adder, 0x1FFF); CLAMPG(global_adder, SHADE_MAX);
Output_SetLightAdder(global_adder); Output_SetLightAdder(global_adder);
Output_SetLightDivider(global_divider); Output_SetLightDivider(global_divider);
@ -150,10 +150,10 @@ void Output_CalculateLight(const XYZ_32 pos, const int16_t room_num)
void Output_CalculateStaticLight(const int16_t adder) void Output_CalculateStaticLight(const int16_t adder)
{ {
// TODO: use m_LsAdder // TODO: use m_LsAdder
int32_t global_adder = adder - 0x1000; int32_t global_adder = adder - SHADE_NEUTRAL;
const int32_t depth = g_MatrixPtr->_23 >> W2V_SHIFT; const int32_t depth = g_MatrixPtr->_23 >> W2V_SHIFT;
global_adder += Output_CalcFogShade(depth); global_adder += Output_CalcFogShade(depth);
CLAMPG(global_adder, 0x1FFF); CLAMPG(global_adder, SHADE_MAX);
Output_SetLightAdder(global_adder); Output_SetLightAdder(global_adder);
} }

View file

@ -6,4 +6,9 @@
#define TEXTURE_PAGE_HEIGHT 256 #define TEXTURE_PAGE_HEIGHT 256
#define TEXTURE_PAGE_SIZE (TEXTURE_PAGE_WIDTH * TEXTURE_PAGE_HEIGHT) #define TEXTURE_PAGE_SIZE (TEXTURE_PAGE_WIDTH * TEXTURE_PAGE_HEIGHT)
#define SHADE_CAUSTICS 0x300
#define SHADE_MAX 0x1FFF
#define SHADE_LOW 0x1400
#define SHADE_NEUTRAL 0x1000
#define WIBBLE_SIZE 32 #define WIBBLE_SIZE 32

View file

@ -147,7 +147,7 @@ void Effect_Draw(const int16_t effect_num)
Output_DrawSprite( Output_DrawSprite(
effect->interp.result.pos.x, effect->interp.result.pos.y, effect->interp.result.pos.x, effect->interp.result.pos.y,
effect->interp.result.pos.z, obj->mesh_idx - effect->frame_num, effect->interp.result.pos.z, obj->mesh_idx - effect->frame_num,
4096); SHADE_NEUTRAL);
} else { } else {
Matrix_Push(); Matrix_Push();
Matrix_TranslateAbs32(effect->interp.result.pos); Matrix_TranslateAbs32(effect->interp.result.pos);

View file

@ -70,9 +70,9 @@ static void M_DrawItem(
{ {
if (ring->motion.status != RNG_FADING_OUT && ring->motion.status != RNG_DONE if (ring->motion.status != RNG_FADING_OUT && ring->motion.status != RNG_DONE
&& inv_item == ring->list[ring->current_object] && !ring->rotating) { && inv_item == ring->list[ring->current_object] && !ring->rotating) {
Output_SetLightAdder(HIGH_LIGHT); Output_SetLightAdder(SHADE_NEUTRAL);
} else { } else {
Output_SetLightAdder(LOW_LIGHT); Output_SetLightAdder(SHADE_LOW);
} }
Matrix_TranslateRel(0, inv_item->y_trans, inv_item->z_trans); Matrix_TranslateRel(0, inv_item->y_trans, inv_item->z_trans);

View file

@ -150,7 +150,7 @@ int16_t Item_Spawn(const ITEM *const item, const GAME_OBJECT_ID obj_id)
spawn->rot = item->rot; spawn->rot = item->rot;
Item_Initialise(spawn_num); Item_Initialise(spawn_num);
spawn->status = IS_INACTIVE; spawn->status = IS_INACTIVE;
spawn->shade.value_1 = HIGH_LIGHT; spawn->shade.value_1 = SHADE_NEUTRAL;
} }
return spawn_num; return spawn_num;
} }

View file

@ -77,7 +77,7 @@ void Object_DrawSpriteItem(const ITEM *const item)
item->interp.result.pos.x, item->interp.result.pos.y, item->interp.result.pos.x, item->interp.result.pos.y,
item->interp.result.pos.z, item->interp.result.pos.z,
Object_Get(item->object_id)->mesh_idx - item->frame_num, Object_Get(item->object_id)->mesh_idx - item->frame_num,
item->shade.value_1 < 0 ? HIGH_LIGHT : item->shade.value_1); item->shade.value_1 < 0 ? SHADE_NEUTRAL : item->shade.value_1);
} }
void Object_DrawPickupItem(const ITEM *const item) void Object_DrawPickupItem(const ITEM *const item)

View file

@ -346,7 +346,7 @@ static void M_DrawSprite(
const float multiplier = g_Config.visuals.brightness / 16.0f; const float multiplier = g_Config.visuals.brightness / 16.0f;
const SPRITE_TEXTURE *const sprite = Output_GetSpriteTexture(sprite_idx); const SPRITE_TEXTURE *const sprite = Output_GetSpriteTexture(sprite_idx);
float vshade = (MAX_LIGHTING - shade) * multiplier; float vshade = (SHADE_MAX - shade) * multiplier;
CLAMPG(vshade, 255.0f); CLAMPG(vshade, 255.0f);
const float u0 = (sprite->offset & 0xFF) / 256.0f; const float u0 = (sprite->offset & 0xFF) / 256.0f;

View file

@ -210,12 +210,12 @@ static void M_UpdateShades(
for (int32_t i = 0; i < batch->vertex_count; i++) { for (int32_t i = 0; i < batch->vertex_count; i++) {
const int32_t j = light_idx_map[i]; const int32_t j = light_idx_map[i];
int16_t shade = ls_adder + mesh->lighting.lights[j]; int16_t shade = ls_adder + mesh->lighting.lights[j];
CLAMP(shade, 0, 0x1FFF); CLAMP(shade, 0, SHADE_MAX);
out_shades[i] = shade; out_shades[i] = shade;
} }
} else if (ls_divider == 0) { } else if (ls_divider == 0) {
int16_t shade = ls_adder; int16_t shade = ls_adder;
CLAMP(shade, 0, 0x1FFF); CLAMP(shade, 0, SHADE_MAX);
for (int32_t i = 0; i < batch->vertex_count; i++) { for (int32_t i = 0; i < batch->vertex_count; i++) {
out_shades[i] = shade; out_shades[i] = shade;
} }
@ -245,7 +245,7 @@ static void M_UpdateShades(
const XYZ_16 *const normal = &mesh->lighting.normals[j]; const XYZ_16 *const normal = &mesh->lighting.normals[j];
int16_t shade = ls_adder int16_t shade = ls_adder
+ ((normal->x * xv + normal->y * yv + normal->z * zv) >> 16); + ((normal->x * xv + normal->y * yv + normal->z * zv) >> 16);
CLAMP(shade, 0, 0x1FFF); CLAMP(shade, 0, SHADE_MAX);
out_shades[i] = shade; out_shades[i] = shade;
} }
} }

View file

@ -53,9 +53,9 @@ static M_MESH_SHADE M_ShadeCaustics(M_MESH_SHADE source, uint8_t caustic)
if (Output_GetWaterEffect()) { if (Output_GetWaterEffect()) {
source += source +=
m_ShadeTable[((uint8_t)Output_GetTime() + caustic) % WIBBLE_SIZE]; m_ShadeTable[((uint8_t)Output_GetTime() + caustic) % WIBBLE_SIZE];
CLAMP(source, 0, MAX_LIGHTING); CLAMP(source, 0, SHADE_MAX);
} else { } else {
CLAMPG(source, MAX_LIGHTING); CLAMPG(source, SHADE_MAX);
} }
return source; return source;
} }
@ -341,7 +341,7 @@ void Output_Meshes_InitRooms(void)
m_Shader = Output_Meshes_GetShader(); m_Shader = Output_Meshes_GetShader();
for (int32_t i = 0; i < WIBBLE_SIZE; i++) { for (int32_t i = 0; i < WIBBLE_SIZE; i++) {
const int16_t angle = (i * DEG_360) / WIBBLE_SIZE; const int16_t angle = (i * DEG_360) / WIBBLE_SIZE;
m_ShadeTable[i] = Math_Sin(angle) * MAX_SHADE >> W2V_SHIFT; m_ShadeTable[i] = Math_Sin(angle) * SHADE_CAUSTICS >> W2V_SHIFT;
m_CausticsTable[i] = (Random_GetDraw() >> 5) - 0x01FF; m_CausticsTable[i] = (Random_GetDraw() >> 5) - 0x01FF;
} }
} }

View file

@ -389,7 +389,7 @@ static void M_DrawPickup3D(DISPLAY_PICKUP *pu)
Matrix_RotY(pu->rot_y); Matrix_RotY(pu->rot_y);
Output_SetLightDivider(0x6000); Output_SetLightDivider(0x6000);
Output_SetLightAdder(LOW_LIGHT); Output_SetLightAdder(SHADE_LOW);
Output_RotateLight(0, 0); Output_RotateLight(0, 0);
const OBJECT *const obj = Object_Get(Inv_GetItemOption(pu->object_id)); const OBJECT *const obj = Object_Get(Inv_GetItemOption(pu->object_id));
@ -501,7 +501,7 @@ static void M_DrawPickupsSprites(void)
Viewport_GetHeight() - sprite_height - sprite_height * pu->grid_y; Viewport_GetHeight() - sprite_height - sprite_height * pu->grid_y;
const int32_t scale = Screen_GetRenderScaleGLRage(12288); const int32_t scale = Screen_GetRenderScaleGLRage(12288);
const int16_t sprite_num = Object_Get(pu->object_id)->mesh_idx; const int16_t sprite_num = Object_Get(pu->object_id)->mesh_idx;
Output_DrawUISprite(x, y, scale, sprite_num, 4096); Output_DrawUISprite(x, y, scale, sprite_num, SHADE_NEUTRAL);
} }
} }

View file

@ -131,7 +131,7 @@ int16_t Spawn_RocketGun(
effect->object_id = O_MISSILE_3; effect->object_id = O_MISSILE_3;
effect->frame_num = 0; effect->frame_num = 0;
effect->speed = ROCKET_SPEED; effect->speed = ROCKET_SPEED;
effect->shade = HIGH_LIGHT; effect->shade = SHADE_NEUTRAL;
M_ShootAtLara(effect); M_ShootAtLara(effect);
} }
return effect_num; return effect_num;
@ -154,7 +154,7 @@ int16_t Spawn_GunShot(
effect->counter = 3; effect->counter = 3;
effect->frame_num = 0; effect->frame_num = 0;
effect->object_id = O_GUN_FLASH; effect->object_id = O_GUN_FLASH;
effect->shade = HIGH_LIGHT; effect->shade = SHADE_NEUTRAL;
} }
return effect_num; return effect_num;
} }

View file

@ -69,8 +69,6 @@
#define NO_BAD_NEG NO_HEIGHT #define NO_BAD_NEG NO_HEIGHT
#define BAD_JUMP_CEILING ((STEP_L * 3) / 4) // = 192 #define BAD_JUMP_CEILING ((STEP_L * 3) / 4) // = 192
#define MAX_WIBBLE 2 #define MAX_WIBBLE 2
#define MAX_SHADE 0x300
#define MAX_LIGHTING 0x1FFF
#define NO_VERT_MOVE 0x2000 #define NO_VERT_MOVE 0x2000
#define NO_BOX (-1) #define NO_BOX (-1)
#define PASSPORT_FOV 65 #define PASSPORT_FOV 65
@ -89,8 +87,6 @@
#define OPTION_RING_OBJECTS 4 #define OPTION_RING_OBJECTS 4
#define TITLE_RING_OBJECTS 5 #define TITLE_RING_OBJECTS 5
#define CAMERA_2_RING 598 #define CAMERA_2_RING 598
#define LOW_LIGHT 0x1400 // = 5120
#define HIGH_LIGHT 0x1000 // = 4096
#if _MSC_VER > 0x500 #if _MSC_VER > 0x500
#define strdup _strdup // fixes error about POSIX function #define strdup _strdup // fixes error about POSIX function

View file

@ -112,7 +112,7 @@ int16_t Effect_Create(const int16_t room_num)
effect->next_active = m_NextEffectActive; effect->next_active = m_NextEffectActive;
m_NextEffectActive = effect_num; m_NextEffectActive = effect_num;
effect->shade = 0x1000; effect->shade = SHADE_NEUTRAL;
return effect_num; return effect_num;
} }

View file

@ -369,7 +369,7 @@ void Gun_DrawFlash(const LARA_GUN_TYPE weapon_type, const int32_t clip)
switch (weapon_type) { switch (weapon_type) {
case LGT_MAGNUMS: case LGT_MAGNUMS:
shade = HIGH_LIGHT; shade = SHADE_NEUTRAL;
y = 215; y = 215;
z = 65; z = 65;
break; break;
@ -400,7 +400,7 @@ void Gun_DrawFlash(const LARA_GUN_TYPE weapon_type, const int32_t clip)
return; return;
default: default:
shade = LOW_LIGHT; shade = SHADE_LOW;
y = 185; y = 185;
z = 40; z = 40;
break; break;

View file

@ -68,9 +68,9 @@ static void M_DrawItem(
{ {
if (ring->motion.status != RNG_FADING_OUT && ring->motion.status != RNG_DONE if (ring->motion.status != RNG_FADING_OUT && ring->motion.status != RNG_DONE
&& inv_item == ring->list[ring->current_object] && !ring->rotating) { && inv_item == ring->list[ring->current_object] && !ring->rotating) {
Output_SetLightAdder(HIGH_LIGHT); Output_SetLightAdder(SHADE_NEUTRAL);
} else { } else {
Output_SetLightAdder(LOW_LIGHT); Output_SetLightAdder(SHADE_LOW);
} }
Matrix_TranslateRel(0, inv_item->y_trans, inv_item->z_trans); Matrix_TranslateRel(0, inv_item->y_trans, inv_item->z_trans);

View file

@ -64,7 +64,7 @@ void Object_DrawSpriteItem(const ITEM *const item)
{ {
SHADE shade = item->shade; SHADE shade = item->shade;
if (shade.value_1 < 0) { if (shade.value_1 < 0) {
shade.value_1 = HIGH_LIGHT; shade.value_1 = SHADE_NEUTRAL;
} }
Output_CalculateStaticMeshLight( Output_CalculateStaticMeshLight(
item->interp.result.pos, shade, Room_Get(item->room_num)); item->interp.result.pos, shade, Room_Get(item->room_num));
@ -76,7 +76,7 @@ void Object_DrawSpriteItem(const ITEM *const item)
| SPRITE_SHADE, | SPRITE_SHADE,
item->interp.result.pos.x, item->interp.result.pos.y, item->interp.result.pos.x, item->interp.result.pos.y,
item->interp.result.pos.z, obj->mesh_idx - item->frame_num, item->interp.result.pos.z, obj->mesh_idx - item->frame_num,
Output_GetLightAdder() + 4096, 0); Output_GetLightAdder() + SHADE_NEUTRAL, 0);
} }
void Object_Collision( void Object_Collision(

View file

@ -62,7 +62,7 @@ static void M_Control(const int16_t effect_num)
effect->frame_num = 0; effect->frame_num = 0;
effect->counter = 0; effect->counter = 0;
effect->object_id = O_EXPLOSION; effect->object_id = O_EXPLOSION;
effect->shade = HIGH_LIGHT; effect->shade = SHADE_NEUTRAL;
Sound_Effect(SFX_EXPLOSION_1, &effect->pos, SPM_NORMAL); Sound_Effect(SFX_EXPLOSION_1, &effect->pos, SPM_NORMAL);
} else { } else {
Effect_Kill(effect_num); Effect_Kill(effect_num);
@ -78,7 +78,7 @@ static void M_Control(const int16_t effect_num)
effect->frame_num = 0; effect->frame_num = 0;
effect->counter = 0; effect->counter = 0;
effect->object_id = O_EXPLOSION; effect->object_id = O_EXPLOSION;
effect->shade = HIGH_LIGHT; effect->shade = SHADE_NEUTRAL;
Sound_Effect(SFX_EXPLOSION_1, &effect->pos, SPM_NORMAL); Sound_Effect(SFX_EXPLOSION_1, &effect->pos, SPM_NORMAL);
g_Lara.hit_effect_count = 5; g_Lara.hit_effect_count = 5;
g_Lara.hit_effect = effect; g_Lara.hit_effect = effect;

View file

@ -209,7 +209,7 @@ static void M_CalcRoomVertices(const ROOM_MESH *const mesh, int32_t far_clip)
// clip_flags |= (~((uint8_t)(vbuf->zv / 0x155555.p0))) << 8; // clip_flags |= (~((uint8_t)(vbuf->zv / 0x155555.p0))) << 8;
} }
CLAMP(shade, 0, 0x1FFF); CLAMP(shade, 0, SHADE_MAX);
vbuf->g = shade; vbuf->g = shade;
vbuf->clip = clip_flags; vbuf->clip = clip_flags;
} }
@ -359,7 +359,7 @@ static void M_CalcVerticeLight(const OBJECT_MESH *const mesh)
if (mesh->num_lights <= 0) { if (mesh->num_lights <= 0) {
for (int32_t i = 0; i < -mesh->num_lights; i++) { for (int32_t i = 0; i < -mesh->num_lights; i++) {
int16_t shade = m_LsAdder + mesh->lighting.lights[i]; int16_t shade = m_LsAdder + mesh->lighting.lights[i];
CLAMP(shade, 0, 0x1FFF); CLAMP(shade, 0, SHADE_MAX);
g_PhdVBuf[i].g = shade; g_PhdVBuf[i].g = shade;
} }
@ -368,7 +368,7 @@ static void M_CalcVerticeLight(const OBJECT_MESH *const mesh)
if (m_LsDivider == 0) { if (m_LsDivider == 0) {
int16_t shade = m_LsAdder; int16_t shade = m_LsAdder;
CLAMP(shade, 0, 0x1FFF); CLAMP(shade, 0, SHADE_MAX);
for (int32_t i = 0; i < mesh->num_lights; i++) { for (int32_t i = 0; i < mesh->num_lights; i++) {
g_PhdVBuf[i].g = shade; g_PhdVBuf[i].g = shade;
} }
@ -401,7 +401,7 @@ static void M_CalcVerticeLight(const OBJECT_MESH *const mesh)
const XYZ_16 *const normal = &mesh->lighting.normals[i]; const XYZ_16 *const normal = &mesh->lighting.normals[i];
int16_t shade = m_LsAdder int16_t shade = m_LsAdder
+ ((xv * normal->x + yv * normal->y + zv * normal->z) >> 16); + ((xv * normal->x + yv * normal->y + zv * normal->z) >> 16);
CLAMP(shade, 0, 0x1FFF); CLAMP(shade, 0, SHADE_MAX);
g_PhdVBuf[i].g = shade; g_PhdVBuf[i].g = shade;
} }
} }
@ -666,12 +666,12 @@ void Output_DrawSprite(
const int32_t depth = zv >> W2V_SHIFT; const int32_t depth = zv >> W2V_SHIFT;
if (depth > Output_GetFogStart()) { if (depth > Output_GetFogStart()) {
shade += depth - Output_GetFogStart(); shade += depth - Output_GetFogStart();
if (shade > 0x1FFF) { if (shade > SHADE_MAX) {
return; return;
} }
} }
} else { } else {
shade = 0x1000; shade = SHADE_NEUTRAL;
} }
Render_InsertSprite(zv, x0, y0, x1, y1, sprite_idx, shade); Render_InsertSprite(zv, x0, y0, x1, y1, sprite_idx, shade);
@ -899,7 +899,7 @@ void Output_CalculateWibbleTable(void)
for (int32_t i = 0; i < WIBBLE_SIZE; i++) { for (int32_t i = 0; i < WIBBLE_SIZE; i++) {
const int32_t sine = Math_Sin(i * DEG_360 / WIBBLE_SIZE); const int32_t sine = Math_Sin(i * DEG_360 / WIBBLE_SIZE);
m_WibbleTable[i] = (sine * MAX_WIBBLE) >> W2V_SHIFT; m_WibbleTable[i] = (sine * MAX_WIBBLE) >> W2V_SHIFT;
m_ShadesTable[i] = (sine * MAX_SHADE) >> W2V_SHIFT; m_ShadesTable[i] = (sine * SHADE_CAUSTICS) >> W2V_SHIFT;
m_RandomTable[i] = (Random_GetDraw() >> 5) - 0x01FF; m_RandomTable[i] = (Random_GetDraw() >> 5) - 0x01FF;
for (int32_t j = 0; j < WIBBLE_SIZE; j++) { for (int32_t j = 0; j < WIBBLE_SIZE; j++) {
m_RoomLightTables[i].table[j] = (j - (WIBBLE_SIZE / 2)) * i m_RoomLightTables[i].table[j] = (j - (WIBBLE_SIZE / 2)) * i
@ -1089,9 +1089,9 @@ int32_t Output_CalcFogShade(const int32_t depth)
return 0; return 0;
} }
if (depth >= fog_end) { if (depth >= fog_end) {
return 0x1FFF; return SHADE_MAX;
} }
return (depth - fog_start) * 0x1FFF / (fog_end - fog_start); return (depth - fog_start) * SHADE_MAX / (fog_end - fog_start);
} }
int32_t Output_GetRoomLightShade(const ROOM_LIGHT_MODE mode) int32_t Output_GetRoomLightShade(const ROOM_LIGHT_MODE mode)
@ -1127,21 +1127,25 @@ void Output_DrawTextOutline(
const int32_t scale_v = TEXT_BASE_SCALE; const int32_t scale_v = TEXT_BASE_SCALE;
Output_DrawScreenSprite( Output_DrawScreenSprite(
x0, y0, z, scale_h, scale_v, mesh_idx + 0, 0x1000, 0); x0, y0, z, scale_h, scale_v, mesh_idx + 0, SHADE_NEUTRAL, 0);
Output_DrawScreenSprite( Output_DrawScreenSprite(
x1, y0, z, scale_h, scale_v, mesh_idx + 1, 0x1000, 0); x1, y0, z, scale_h, scale_v, mesh_idx + 1, SHADE_NEUTRAL, 0);
Output_DrawScreenSprite( Output_DrawScreenSprite(
x1, y1, z, scale_h, scale_v, mesh_idx + 2, 0x1000, 0); x1, y1, z, scale_h, scale_v, mesh_idx + 2, SHADE_NEUTRAL, 0);
Output_DrawScreenSprite( Output_DrawScreenSprite(
x0, y1, z, scale_h, scale_v, mesh_idx + 3, 0x1000, 0); x0, y1, z, scale_h, scale_v, mesh_idx + 3, SHADE_NEUTRAL, 0);
int32_t w = (width - offset * 2) * TEXT_BASE_SCALE / 8; int32_t w = (width - offset * 2) * TEXT_BASE_SCALE / 8;
int32_t h = (height - offset * 2) * TEXT_BASE_SCALE / 8; int32_t h = (height - offset * 2) * TEXT_BASE_SCALE / 8;
Output_DrawScreenSprite(x0, y0, z, w, scale_v, mesh_idx + 4, 0x1000, 0); Output_DrawScreenSprite(
Output_DrawScreenSprite(x1, y0, z, scale_h, h, mesh_idx + 5, 0x1000, 0); x0, y0, z, w, scale_v, mesh_idx + 4, SHADE_NEUTRAL, 0);
Output_DrawScreenSprite(x0, y1, z, w, scale_v, mesh_idx + 6, 0x1000, 0); Output_DrawScreenSprite(
Output_DrawScreenSprite(x0, y0, z, scale_h, h, mesh_idx + 7, 0x1000, 0); x1, y0, z, scale_h, h, mesh_idx + 5, SHADE_NEUTRAL, 0);
Output_DrawScreenSprite(
x0, y1, z, w, scale_v, mesh_idx + 6, SHADE_NEUTRAL, 0);
Output_DrawScreenSprite(
x0, y0, z, scale_h, h, mesh_idx + 7, SHADE_NEUTRAL, 0);
} }
void Output_DrawTextBackground( void Output_DrawTextBackground(

View file

@ -211,7 +211,8 @@ static void M_DrawAssaultTimer(void)
glyph_info[glyph_type].offset, SCALER_TARGET_ASSAULT_DIGITS); glyph_info[glyph_type].offset, SCALER_TARGET_ASSAULT_DIGITS);
Output_DrawScreenSprite( Output_DrawScreenSprite(
x, y, 0, scale_h, scale_v, x, y, 0, scale_h, scale_v,
Object_Get(O_ASSAULT_DIGITS)->mesh_idx + mesh_num, 0x1000, 0); Object_Get(O_ASSAULT_DIGITS)->mesh_idx + mesh_num, SHADE_NEUTRAL,
0);
x += Scaler_Calc( x += Scaler_Calc(
glyph_info[glyph_type].width, SCALER_TARGET_ASSAULT_DIGITS); glyph_info[glyph_type].width, SCALER_TARGET_ASSAULT_DIGITS);
} }
@ -456,7 +457,7 @@ static void M_DrawPickup3D(const DISPLAY_PICKUP *const pickup)
Matrix_RotY(pickup->rot_y); Matrix_RotY(pickup->rot_y);
Output_SetLightDivider(0x6000); Output_SetLightDivider(0x6000);
Output_SetLightAdder(LOW_LIGHT); Output_SetLightAdder(SHADE_LOW);
Output_RotateLight(0, 0); Output_RotateLight(0, 0);
Matrix_Push(); Matrix_Push();
@ -504,7 +505,7 @@ static void M_DrawPickupSprite(const DISPLAY_PICKUP *const pickup)
// TODO: use proper scaling // TODO: use proper scaling
const int32_t scale = 12288 * g_PhdWinWidth / 640; const int32_t scale = 12288 * g_PhdWinWidth / 640;
const int16_t sprite_num = pickup->object->mesh_idx; const int16_t sprite_num = pickup->object->mesh_idx;
Output_DrawPickup(x, y, scale, sprite_num, 4096); Output_DrawPickup(x, y, scale, sprite_num, SHADE_NEUTRAL);
} }
static void M_DrawPickups(void) static void M_DrawPickups(void)

View file

@ -147,22 +147,22 @@ static void M_ShadeLightColor(
GFX_3D_VERTEX *const target, uint32_t shade, const bool is_textured, GFX_3D_VERTEX *const target, uint32_t shade, const bool is_textured,
uint32_t red, uint32_t green, uint32_t blue, const uint8_t alpha) uint32_t red, uint32_t green, uint32_t blue, const uint8_t alpha)
{ {
CLAMPG(shade, 0x1FFF); CLAMPG(shade, SHADE_MAX);
if (g_Config.rendering.lighting_contrast == LIGHTING_CONTRAST_MEDIUM) { if (g_Config.rendering.lighting_contrast == LIGHTING_CONTRAST_MEDIUM) {
CLAMPL(shade, 0x800); CLAMPL(shade, 0x800);
} }
if (g_Config.rendering.lighting_contrast != LIGHTING_CONTRAST_LOW if (g_Config.rendering.lighting_contrast != LIGHTING_CONTRAST_LOW
&& is_textured) { && is_textured) {
shade = 0x1000 + shade / 2; shade = SHADE_NEUTRAL + shade / 2;
} }
if (g_Config.rendering.lighting_contrast == LIGHTING_CONTRAST_LOW if (g_Config.rendering.lighting_contrast == LIGHTING_CONTRAST_LOW
&& !is_textured) { && !is_textured) {
CLAMPL(shade, 0x1000); CLAMPL(shade, SHADE_NEUTRAL);
} }
if (shade != 0x1000) { if (shade != SHADE_NEUTRAL) {
const int32_t brightness = 0x1FFF - shade; const int32_t brightness = SHADE_MAX - shade;
red = (red * brightness) >> 12; red = (red * brightness) >> 12;
green = (green * brightness) >> 12; green = (green * brightness) >> 12;
blue = (blue * brightness) >> 12; blue = (blue * brightness) >> 12;

View file

@ -134,7 +134,7 @@ int16_t Spawn_GunShot(
effect->counter = 3; effect->counter = 3;
effect->frame_num = 0; effect->frame_num = 0;
effect->object_id = O_GUN_FLASH; effect->object_id = O_GUN_FLASH;
effect->shade = HIGH_LIGHT; effect->shade = SHADE_NEUTRAL;
return effect_num; return effect_num;
} }

View file

@ -100,7 +100,8 @@ void Text_DrawText(TEXTSTRING *const text)
const float sprite_scale = MIN(sprite_scale_h, sprite_scale_v); const float sprite_scale = MIN(sprite_scale_h, sprite_scale_v);
Output_DrawScreenSprite( Output_DrawScreenSprite(
x + M_Scale(10), y, z, M_Scale(glyph->width * sprite_scale), x + M_Scale(10), y, z, M_Scale(glyph->width * sprite_scale),
M_Scale(glyph->width * sprite_scale), sprite_idx, 4096, 0); M_Scale(glyph->width * sprite_scale), sprite_idx, SHADE_NEUTRAL,
0);
x += glyph->width * scale_h / TEXT_BASE_SCALE; x += glyph->width * scale_h / TEXT_BASE_SCALE;
goto loop_end; goto loop_end;
} }
@ -116,7 +117,7 @@ void Text_DrawText(TEXTSTRING *const text)
Output_DrawScreenSprite( Output_DrawScreenSprite(
cx, cy, 0, scale_h, scale_v, cx, cy, 0, scale_h, scale_v,
obj->mesh_idx + glyph->combine_with.mesh_idx, 4096, 0); obj->mesh_idx + glyph->combine_with.mesh_idx, SHADE_NEUTRAL, 0);
} }
if (x >= 0 && x < g_PhdWinWidth && y >= 0 && y < g_PhdWinHeight) { if (x >= 0 && x < g_PhdWinWidth && y >= 0 && y < g_PhdWinHeight) {
@ -125,7 +126,7 @@ void Text_DrawText(TEXTSTRING *const text)
} }
Output_DrawScreenSprite( Output_DrawScreenSprite(
x, y, z, scale_h, scale_v, obj->mesh_idx + glyph->mesh_idx, x, y, z, scale_h, scale_v, obj->mesh_idx + glyph->mesh_idx,
4096, 0); SHADE_NEUTRAL, 0);
} }
if (glyph->role != GLYPH_COMBINING) { if (glyph->role != GLYPH_COMBINING) {

View file

@ -12,7 +12,6 @@
#define STEPUP_HEIGHT ((STEP_L * 3) / 2) // = 384 #define STEPUP_HEIGHT ((STEP_L * 3) / 2) // = 384
#define SLOPE_DIF 60 #define SLOPE_DIF 60
#define MAX_WIBBLE 2 #define MAX_WIBBLE 2
#define MAX_SHADE 0x300
#define LIGHT_MAP_SIZE 32 #define LIGHT_MAP_SIZE 32
#define MAX_ROOM_LIGHT_UNIT (0x2000 / (WIBBLE_SIZE / 2)) #define MAX_ROOM_LIGHT_UNIT (0x2000 / (WIBBLE_SIZE / 2))
@ -147,6 +146,3 @@
#define IDS_DX5_REQUIRED 1 #define IDS_DX5_REQUIRED 1
#define MONK_FRIENDLY_FIRE_THRESHOLD 10 #define MONK_FRIENDLY_FIRE_THRESHOLD 10
#define LOW_LIGHT 5120
#define HIGH_LIGHT 4096