tr1/output: fix splash and bubbles having UW tint
Some checks are pending
Run code linters / Run code linters (push) Waiting to run
Publish a pre-release / Build TR1 (push) Has been skipped
Publish a pre-release / Build TR2 (push) Has been skipped
Publish a pre-release / Create a prerelease (push) Has been skipped

Resolves #2793.
This commit is contained in:
Marcin Kurczewski 2025-04-20 21:35:01 +02:00
parent 962a66a090
commit 9667be9f0e
9 changed files with 35 additions and 8 deletions

View file

@ -10,6 +10,7 @@ extern const GAME_OBJECT_ID g_PickupObjects[];
extern const GAME_OBJECT_ID g_AnimObjects[];
extern const GAME_OBJECT_ID g_NullObjects[];
extern const GAME_OBJECT_ID g_InvObjects[];
extern const GAME_OBJECT_ID g_WaterSpriteObjects[];
extern const GAME_OBJECT_PAIR g_ItemToInvObjectMap[];
extern const GAME_OBJECT_PAIR g_KeyItemToReceptacleMap[];

View file

@ -1,5 +1,6 @@
#include "game/effects.h"
#include "game/objects/vars.h"
#include "game/output.h"
#include "game/room.h"
#include "global/const.h"
@ -144,10 +145,14 @@ void Effect_Draw(const int16_t effect_num)
}
if (obj->mesh_count < 0) {
const RGB_F tint =
Object_IsType(effect->object_id, g_WaterSpriteObjects)
? (RGB_F) { 1.0f, 1.0f, 1.0f }
: Output_GetTint();
Output_DrawSprite(
effect->interp.result.pos.x, effect->interp.result.pos.y,
effect->interp.result.pos.z, obj->mesh_idx - effect->frame_num,
SHADE_NEUTRAL);
SHADE_NEUTRAL, tint);
} else {
Matrix_Push();
Matrix_TranslateAbs32(effect->interp.result.pos);

View file

@ -73,11 +73,12 @@ void Object_DrawDummyItem(const ITEM *const item)
void Object_DrawSpriteItem(const ITEM *const item)
{
const RGB_F tint = Output_GetTint();
Output_DrawSprite(
item->interp.result.pos.x, item->interp.result.pos.y,
item->interp.result.pos.z,
Object_Get(item->object_id)->mesh_idx - item->frame_num,
item->shade.value_1 < 0 ? SHADE_NEUTRAL : item->shade.value_1);
item->shade.value_1 < 0 ? SHADE_NEUTRAL : item->shade.value_1, tint);
}
void Object_DrawPickupItem(const ITEM *const item)

View file

@ -216,6 +216,17 @@ const GAME_OBJECT_ID g_InvObjects[] = {
// clang-format on
};
const GAME_OBJECT_ID g_WaterSpriteObjects[] = {
// clang-format off
O_WATERFALL,
O_SPLASH_1,
O_SPLASH_2,
O_BUBBLES_1,
O_BUBBLES_2,
NO_OBJECT,
// clang-format on
};
const GAME_OBJECT_PAIR g_GunAmmoObjectMap[] = {
// clang-format off
{ O_PISTOL_ITEM, O_PISTOL_AMMO_ITEM },

View file

@ -56,7 +56,7 @@ void Output_DrawCentreGradientScreenBox(
void Output_DrawScreenFBox(int32_t sx, int32_t sy, int32_t w, int32_t h);
void Output_DrawSprite(
int32_t x, int32_t y, int32_t z, int16_t sprnum, int16_t shade);
int32_t x, int32_t y, int32_t z, int16_t sprnum, int16_t shade, RGB_F tint);
void Output_DrawScreenSprite(
int32_t sx, int32_t sy, int32_t z, int32_t scale_h, int32_t scale_v,
int32_t sprnum, int16_t shade, uint16_t flags, int32_t page);

View file

@ -292,11 +292,11 @@ void Output_DrawShadow(
void Output_DrawSprite(
const int32_t x, const int32_t y, const int32_t z, const int16_t sprite_idx,
const int16_t shade)
const int16_t shade, const RGB_F tint)
{
Matrix_Push();
Matrix_TranslateAbs(x, y, z);
Output_Sprites_RenderSingleSprite(
g_MatrixPtr, (XYZ_32) { 0, 0, 0 }, sprite_idx, shade);
g_MatrixPtr, (XYZ_32) { 0, 0, 0 }, sprite_idx, shade, tint);
Matrix_Pop();
}

View file

@ -414,13 +414,13 @@ void Output_Sprites_RenderRoomSprites(
void Output_Sprites_RenderSingleSprite(
const MATRIX *const matrix, const XYZ_32 pos, const int32_t sprite_idx,
const uint16_t shade)
const uint16_t shade, const RGB_F tint)
{
const M_DYNAMIC_SPRITE sprite = {
.matrix = *matrix,
.pos = pos,
.sprite_idx = sprite_idx,
.tint = Output_GetTint(),
.tint = tint,
.shade = shade,
};
Vector_Add(m_Dynamic.source, &sprite);

View file

@ -15,5 +15,6 @@ void Output_Sprites_RenderBegin(void);
void Output_Sprites_RenderRoomSprites(
const MATRIX *matrix, RGB_F tint, const ROOM *room);
void Output_Sprites_RenderSingleSprite(
const MATRIX *matrix, XYZ_32 pos, int32_t sprite_idx, uint16_t shade);
const MATRIX *matrix, XYZ_32 pos, int32_t sprite_idx, uint16_t shade,
RGB_F tint);
bool Output_Sprites_Flush(void);

View file

@ -242,6 +242,14 @@ const GAME_OBJECT_ID g_InvObjects[] = {
// clang-format on
};
const GAME_OBJECT_ID g_WaterSpriteObjects[] = {
// clang-format off
O_WATERFALL,
O_SPLASH,
O_BUBBLE,
// clang-format on
};
const GAME_OBJECT_PAIR g_ItemToInvObjectMap[] = {
// clang-format off
{ O_COMPASS_ITEM, O_COMPASS_OPTION },