From 1f4a1b7d1c8642cc585d5093fcc17ea8f40522b5 Mon Sep 17 00:00:00 2001 From: lahm86 <33758420+lahm86@users.noreply.github.com> Date: Sat, 1 Feb 2025 20:32:21 +0000 Subject: [PATCH] output: rename depthQ and gouraud This renames depthQ to light_map and gouraud to shade_map; --- src/libtrx/game/level/common.c | 14 +++--- src/libtrx/game/output/textures.c | 12 ++--- src/libtrx/include/libtrx/game/level/common.h | 2 +- .../include/libtrx/game/output/textures.h | 4 +- src/libtrx/include/libtrx/game/output/types.h | 4 +- src/tr1/game/level.c | 2 +- src/tr2/game/level.c | 2 +- src/tr2/game/render/swr.c | 46 ++++++++++--------- 8 files changed, 44 insertions(+), 42 deletions(-) diff --git a/src/libtrx/game/level/common.c b/src/libtrx/game/level/common.c index 570c7e8b2..b7cadd956 100644 --- a/src/libtrx/game/level/common.c +++ b/src/libtrx/game/level/common.c @@ -562,20 +562,20 @@ void Level_ReadAnimatedTextureRanges( } } -void Level_ReadDepthQ(VFILE *const file) +void Level_ReadLightMap(VFILE *const file) { BENCHMARK *const benchmark = Benchmark_Start(); for (int32_t i = 0; i < 32; i++) { - DEPTHQ_ENTRY *const depth = Output_GetDepthQ(i); - VFile_Read(file, depth->index, sizeof(uint8_t) * 256); - depth->index[0] = 0; + LIGHT_MAP *const light_map = Output_GetLightMap(i); + VFile_Read(file, light_map->index, sizeof(uint8_t) * 256); + light_map->index[0] = 0; } for (int32_t i = 0; i < 32; i++) { - const DEPTHQ_ENTRY *const depth = Output_GetDepthQ(i); + const LIGHT_MAP *const light_map = Output_GetLightMap(i); for (int32_t j = 0; j < 256; j++) { - GOURAUD_ENTRY *const gouraud = Output_GetGouraud(j); - gouraud->index[i] = depth->index[j]; + SHADE_MAP *const shade_map = Output_GetShadeMap(j); + shade_map->index[i] = light_map->index[j]; } } diff --git a/src/libtrx/game/output/textures.c b/src/libtrx/game/output/textures.c index 9938d99a7..f54add4bf 100644 --- a/src/libtrx/game/output/textures.c +++ b/src/libtrx/game/output/textures.c @@ -14,8 +14,8 @@ static int32_t m_PaletteSize = 0; static RGB_888 *m_Palette8 = nullptr; static RGB_888 *m_Palette16 = nullptr; -static DEPTHQ_ENTRY m_DepthQTable[32]; -static GOURAUD_ENTRY m_GouraudTable[256]; +static LIGHT_MAP m_LightMap[32]; +static SHADE_MAP m_ShadeMap[256]; static int32_t m_ObjectTextureCount = 0; static OBJECT_TEXTURE *m_ObjectTextures = nullptr; @@ -127,14 +127,14 @@ RGB_888 Output_GetPaletteColor16(const uint16_t idx) return m_Palette16[idx]; } -DEPTHQ_ENTRY *Output_GetDepthQ(const uint8_t idx) +LIGHT_MAP *Output_GetLightMap(const uint8_t idx) { - return &m_DepthQTable[idx]; + return &m_LightMap[idx]; } -GOURAUD_ENTRY *Output_GetGouraud(const uint8_t idx) +SHADE_MAP *Output_GetShadeMap(const uint8_t idx) { - return &m_GouraudTable[idx]; + return &m_ShadeMap[idx]; } int32_t Output_GetObjectTextureCount(void) diff --git a/src/libtrx/include/libtrx/game/level/common.h b/src/libtrx/include/libtrx/game/level/common.h index fe9cc7e51..28e72d1d5 100644 --- a/src/libtrx/include/libtrx/game/level/common.h +++ b/src/libtrx/include/libtrx/game/level/common.h @@ -27,6 +27,6 @@ void Level_ReadSpriteTextures( int32_t base_idx, int16_t base_page_idx, int32_t num_textures, VFILE *file); void Level_ReadSpriteSequences(int32_t num_sequences, VFILE *file); void Level_ReadAnimatedTextureRanges(int32_t num_ranges, VFILE *file); -void Level_ReadDepthQ(VFILE *file); +void Level_ReadLightMap(VFILE *file); void Level_LoadTexturePages(LEVEL_INFO *info); void Level_LoadPalettes(LEVEL_INFO *info); diff --git a/src/libtrx/include/libtrx/game/output/textures.h b/src/libtrx/include/libtrx/game/output/textures.h index 3f03035ca..2f7aa1aa8 100644 --- a/src/libtrx/include/libtrx/game/output/textures.h +++ b/src/libtrx/include/libtrx/game/output/textures.h @@ -15,8 +15,8 @@ RGBA_8888 *Output_GetTexturePage32(int32_t page_idx); int32_t Output_GetPaletteSize(void); RGB_888 Output_GetPaletteColor8(uint16_t idx); RGB_888 Output_GetPaletteColor16(uint16_t idx); -DEPTHQ_ENTRY *Output_GetDepthQ(uint8_t idx); -GOURAUD_ENTRY *Output_GetGouraud(uint8_t idx); +LIGHT_MAP *Output_GetLightMap(uint8_t idx); +SHADE_MAP *Output_GetShadeMap(uint8_t idx); int32_t Output_GetObjectTextureCount(void); OBJECT_TEXTURE *Output_GetObjectTexture(int32_t texture_idx); SPRITE_TEXTURE *Output_GetSpriteTexture(int32_t texture_idx); diff --git a/src/libtrx/include/libtrx/game/output/types.h b/src/libtrx/include/libtrx/game/output/types.h index 1413782b2..8a13b2863 100644 --- a/src/libtrx/include/libtrx/game/output/types.h +++ b/src/libtrx/include/libtrx/game/output/types.h @@ -70,8 +70,8 @@ typedef struct { typedef struct { uint8_t index[256]; -} DEPTHQ_ENTRY; +} LIGHT_MAP; typedef struct { uint8_t index[32]; -} GOURAUD_ENTRY; +} SHADE_MAP; diff --git a/src/tr1/game/level.c b/src/tr1/game/level.c index 1550f8fa1..e8ad5dd29 100644 --- a/src/tr1/game/level.c +++ b/src/tr1/game/level.c @@ -242,7 +242,7 @@ static void M_LoadFromFile(const GF_LEVEL *const level) M_LoadAnimatedTextures(file); M_LoadItems(file); Stats_ObserveItemsLoad(); - Level_ReadDepthQ(file); + Level_ReadLightMap(file); if (layout != LEVEL_LAYOUT_TR1_DEMO_PC) { Level_ReadPalettes(&m_LevelInfo, file); diff --git a/src/tr2/game/level.c b/src/tr2/game/level.c index cf12e61e0..327660f51 100644 --- a/src/tr2/game/level.c +++ b/src/tr2/game/level.c @@ -628,7 +628,7 @@ static void M_LoadFromFile(const GF_LEVEL *const level) M_LoadAnimatedTextures(file); M_LoadItems(file); - Level_ReadDepthQ(file); + Level_ReadLightMap(file); M_LoadCinematic(file); M_LoadDemo(file); M_LoadSamples(file); diff --git a/src/tr2/game/render/swr.c b/src/tr2/game/render/swr.c index 0ac66b58a..1b5ee570a 100644 --- a/src/tr2/game/render/swr.c +++ b/src/tr2/game/render/swr.c @@ -246,7 +246,7 @@ static void M_TransA( const int32_t alpha_stride = alpha_surface->desc.pitch; PIX_FMT *target_ptr = target_surface->buffer + y1 * target_stride; ALPHA_FMT *alpha_ptr = alpha_surface->buffer + y1 * alpha_stride; - const DEPTHQ_ENTRY *qt = Output_GetDepthQ(depth); + const LIGHT_MAP *const map = Output_GetLightMap(depth); while (y_size > 0) { const int32_t x = xbuf->x1 / PHD_ONE; @@ -258,7 +258,7 @@ static void M_TransA( PIX_FMT *target_line_ptr = target_ptr + x; ALPHA_FMT *alpha_line_ptr = alpha_ptr + x; while (x_size > 0) { - *target_line_ptr = MAKE_PAL_IDX(qt->index[*target_line_ptr]); + *target_line_ptr = MAKE_PAL_IDX(map->index[*target_line_ptr]); target_line_ptr++; *alpha_line_ptr++ = 255; x_size--; @@ -286,7 +286,7 @@ static void M_GourA( const int32_t alpha_stride = alpha_surface->desc.pitch; PIX_FMT *target_ptr = target_surface->buffer + y1 * target_stride; ALPHA_FMT *alpha_ptr = alpha_surface->buffer + y1 * alpha_stride; - const GOURAUD_ENTRY *gt = Output_GetGouraud(color_idx); + const SHADE_MAP *const map = Output_GetShadeMap(color_idx); while (y_size > 0) { const int32_t x = xbuf->x1 / PHD_ONE; @@ -301,7 +301,7 @@ static void M_GourA( PIX_FMT *target_line_ptr = target_ptr + x; ALPHA_FMT *alpha_line_ptr = alpha_ptr + x; while (x_size > 0) { - *target_line_ptr++ = MAKE_PAL_IDX(gt->index[MAKE_Q_ID(g)]); + *target_line_ptr++ = MAKE_PAL_IDX(map->index[MAKE_Q_ID(g)]); *alpha_line_ptr++ = 255; g += g_add; x_size--; @@ -348,8 +348,8 @@ static void M_GTMapA( ALPHA_FMT *alpha_line_ptr = alpha_ptr + x; while (x_size > 0) { uint8_t color_idx = tex_page[MAKE_TEX_ID(v, u)]; - *target_line_ptr++ = - MAKE_PAL_IDX(Output_GetDepthQ(MAKE_Q_ID(g))->index[color_idx]); + *target_line_ptr++ = MAKE_PAL_IDX( + Output_GetLightMap(MAKE_Q_ID(g))->index[color_idx]); *alpha_line_ptr++ = 255; g += g_add; u += u_add; @@ -400,7 +400,7 @@ static void M_WGTMapA( const uint8_t color_idx = tex_page[MAKE_TEX_ID(v, u)]; if (color_idx != 0) { *target_line_ptr = MAKE_PAL_IDX( - Output_GetDepthQ(MAKE_Q_ID(g))->index[color_idx]); + Output_GetLightMap(MAKE_Q_ID(g))->index[color_idx]); *alpha_line_ptr = 255; } target_line_ptr++; @@ -479,7 +479,7 @@ static void M_GTMapPersp32FP( while (batch_counter--) { const uint8_t color_idx = tex_page[MAKE_TEX_ID(v0, u0)]; const uint8_t color = - Output_GetDepthQ(MAKE_Q_ID(g))->index[color_idx]; + Output_GetLightMap(MAKE_Q_ID(g))->index[color_idx]; *target_line_ptr++ = MAKE_PAL_IDX(color); *target_line_ptr++ = MAKE_PAL_IDX(color); *alpha_line_ptr++ = 255; @@ -493,7 +493,7 @@ static void M_GTMapPersp32FP( while (batch_counter--) { const uint8_t color_idx = tex_page[MAKE_TEX_ID(v0, u0)]; const uint8_t color = - Output_GetDepthQ(MAKE_Q_ID(g))->index[color_idx]; + Output_GetLightMap(MAKE_Q_ID(g))->index[color_idx]; *target_line_ptr++ = MAKE_PAL_IDX(color); *alpha_line_ptr++ = 255; g += g_add; @@ -522,7 +522,7 @@ static void M_GTMapPersp32FP( while (batch_counter--) { const uint8_t color_idx = tex_page[MAKE_TEX_ID(v0, u0)]; const uint8_t color = - Output_GetDepthQ(MAKE_Q_ID(g))->index[color_idx]; + Output_GetLightMap(MAKE_Q_ID(g))->index[color_idx]; *target_line_ptr++ = MAKE_PAL_IDX(color); *target_line_ptr++ = MAKE_PAL_IDX(color); *alpha_line_ptr++ = 255; @@ -536,7 +536,7 @@ static void M_GTMapPersp32FP( while (batch_counter--) { const uint8_t color_idx = tex_page[MAKE_TEX_ID(v0, u0)]; const uint8_t color = - Output_GetDepthQ(MAKE_Q_ID(g))->index[color_idx]; + Output_GetLightMap(MAKE_Q_ID(g))->index[color_idx]; *target_line_ptr++ = MAKE_PAL_IDX(color); *alpha_line_ptr++ = 255; g += g_add; @@ -549,7 +549,7 @@ static void M_GTMapPersp32FP( if (x_size == 1) { const uint8_t color_idx = tex_page[MAKE_TEX_ID(v0, u0)]; const uint8_t color = - Output_GetDepthQ(MAKE_Q_ID(g))->index[color_idx]; + Output_GetLightMap(MAKE_Q_ID(g))->index[color_idx]; *target_line_ptr = MAKE_PAL_IDX(color); *alpha_line_ptr = 255; } @@ -622,8 +622,9 @@ static void M_WGTMapPersp32FP( while (batch_counter--) { const uint8_t color_idx = tex_page[MAKE_TEX_ID(v0, u0)]; if (color_idx != 0) { - const uint8_t color = Output_GetDepthQ(MAKE_Q_ID(g)) - ->index[color_idx]; + const uint8_t color = + Output_GetLightMap(MAKE_Q_ID(g)) + ->index[color_idx]; target_line_ptr[0] = MAKE_PAL_IDX(color); target_line_ptr[1] = MAKE_PAL_IDX(color); alpha_line_ptr[0] = 255; @@ -640,8 +641,9 @@ static void M_WGTMapPersp32FP( while (batch_counter--) { const uint8_t color_idx = tex_page[MAKE_TEX_ID(v0, u0)]; if (color_idx != 0) { - const uint8_t color = Output_GetDepthQ(MAKE_Q_ID(g)) - ->index[color_idx]; + const uint8_t color = + Output_GetLightMap(MAKE_Q_ID(g)) + ->index[color_idx]; *target_line_ptr = MAKE_PAL_IDX(color); *alpha_line_ptr = 255; } @@ -674,7 +676,7 @@ static void M_WGTMapPersp32FP( const uint8_t color_idx = tex_page[MAKE_TEX_ID(v0, u0)]; if (color_idx != 0) { const uint8_t color = - Output_GetDepthQ(MAKE_Q_ID(g))->index[color_idx]; + Output_GetLightMap(MAKE_Q_ID(g))->index[color_idx]; target_line_ptr[0] = MAKE_PAL_IDX(color); target_line_ptr[1] = MAKE_PAL_IDX(color); alpha_line_ptr[0] = 255; @@ -692,7 +694,7 @@ static void M_WGTMapPersp32FP( const uint8_t color_idx = tex_page[MAKE_TEX_ID(v0, u0)]; if (color_idx != 0) { const uint8_t color = - Output_GetDepthQ(MAKE_Q_ID(g))->index[color_idx]; + Output_GetLightMap(MAKE_Q_ID(g))->index[color_idx]; *target_line_ptr = MAKE_PAL_IDX(color); *alpha_line_ptr = 255; } @@ -709,7 +711,7 @@ static void M_WGTMapPersp32FP( const uint8_t color_idx = tex_page[MAKE_TEX_ID(v0, u0)]; if (color_idx != 0) { const uint8_t color = - Output_GetDepthQ(MAKE_Q_ID(g))->index[color_idx]; + Output_GetLightMap(MAKE_Q_ID(g))->index[color_idx]; *target_line_ptr = MAKE_PAL_IDX(color); *alpha_line_ptr = 255; } @@ -1242,7 +1244,7 @@ static void M_DrawScaledSpriteC( return; } - const DEPTHQ_ENTRY *const depth = Output_GetDepthQ(shade >> 8); + const LIGHT_MAP *const map = Output_GetLightMap(shade >> 8); const SPRITE_TEXTURE *const sprite = Output_GetSpriteTexture(sprite_idx); int32_t u_base = 0x4000; @@ -1271,7 +1273,7 @@ static void M_DrawScaledSpriteC( ALPHA_FMT *alpha_ptr = &alpha_surface->buffer[y0 * target_stride + x0]; const int32_t dst_add = target_stride - width; - const bool is_depth_q = depth != Output_GetDepthQ(16); + const bool use_light_map = map != Output_GetLightMap(16); for (int32_t i = 0; i < height; i++) { int32_t u = u_base; @@ -1279,7 +1281,7 @@ static void M_DrawScaledSpriteC( for (int32_t j = 0; j < width; j++) { const uint8_t pix = src[u >> 16]; if (pix != 0) { - *target_ptr = is_depth_q ? depth->index[pix] : pix; + *target_ptr = use_light_map ? map->index[pix] : pix; *alpha_ptr = 255; } u += u_add;