1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-16 03:23:15 +01:00

Label water object offsets

This commit is contained in:
duncanspumpkin
2017-02-02 18:13:51 +00:00
parent e749285e48
commit 6a9cddf2d8
4 changed files with 24 additions and 20 deletions

View File

@@ -199,24 +199,24 @@ void update_palette_effects()
}
// animate the water/lava/chain movement palette
sint32 q = 0;
uint32 shade = 0;
if (gConfigGeneral.render_weather_gloom) {
uint8 gloom = gClimateCurrentWeatherGloom;
if (gloom != 0) {
FILTER_PALETTE_ID weatherColour = ClimateWeatherGloomColours[gloom];
q = 1;
shade = 1;
if (weatherColour != PALETTE_DARKEN_1) {
q = 2;
shade = 2;
}
}
}
uint32 j = gPaletteEffectFrame;
j = (((uint16)((~j / 2) * 128) * 15) >> 16);
sint32 p = SPR_GAME_PALETTE_WATER;
uint32 waterId = SPR_GAME_PALETTE_WATER;
if ((intptr_t)water_type != -1) {
p = water_type->var_06;
waterId = water_type->palette_index_1;
}
rct_g1_element g1_element = g1Elements[q + p];
rct_g1_element g1_element = g1Elements[shade + waterId];
uint8* vs = &g1_element.offset[j * 3];
uint8* vd = &gGamePalette[230 * 4];
sint32 n = 5;
@@ -231,11 +231,11 @@ void update_palette_effects()
vd += 4;
}
p = SPR_GAME_PALETTE_3;
waterId = SPR_GAME_PALETTE_3;
if ((intptr_t)water_type != -1) {
p = water_type->var_0A;
waterId = water_type->palette_index_2;
}
g1_element = g1Elements[q + p];
g1_element = g1Elements[shade + waterId];
vs = &g1_element.offset[j * 3];
n = 5;
for (sint32 i = 0; i < n; i++) {
@@ -250,8 +250,8 @@ void update_palette_effects()
}
j = ((uint16)(gPaletteEffectFrame * -960) * 3) >> 16;
p = SPR_GAME_PALETTE_4;
g1_element = g1Elements[q + p];
waterId = SPR_GAME_PALETTE_4;
g1_element = g1Elements[shade + waterId];
vs = &g1_element.offset[j * 3];
vd += 12;
n = 3;

View File

@@ -25,9 +25,9 @@ extern "C"
void WaterObject::ReadLegacy(IReadObjectContext * context, IStream * stream)
{
stream->Seek(6, STREAM_SEEK_CURRENT);
_legacyType.var_06 = stream->ReadValue<uint32>();
_legacyType.var_0A = stream->ReadValue<uint32>();
_legacyType.var_0E = stream->ReadValue<uint16>();
_legacyType.palette_index_1 = stream->ReadValue<uint32>();
_legacyType.palette_index_2 = stream->ReadValue<uint32>();
_legacyType.flags = stream->ReadValue<uint16>();
GetStringTable()->Read(context, stream, OBJ_STRING_ID_NAME);
GetImageTable()->Read(context, stream);
@@ -38,8 +38,8 @@ void WaterObject::Load()
GetStringTable()->Sort();
_legacyType.string_idx = language_allocate_object_string(GetName());
_legacyType.image_id = gfx_object_allocate_images(GetImageTable()->GetImages(), GetImageTable()->GetCount());
_legacyType.var_06 = _legacyType.image_id + 1;
_legacyType.var_0A = _legacyType.image_id + 4;
_legacyType.palette_index_1 = _legacyType.image_id + 1;
_legacyType.palette_index_2 = _legacyType.image_id + 4;
load_palette();
gfx_invalidate_screen();

View File

@@ -424,7 +424,7 @@ static void scenario_week_update()
rct_water_type* water_type = (rct_water_type*)object_entry_groups[OBJECT_TYPE_WATER].chunks[0];
if (month <= MONTH_APRIL && (intptr_t)water_type != -1 && water_type->var_0E & 1) {
if (month <= MONTH_APRIL && (intptr_t)water_type != -1 && water_type->flags & WATER_FLAGS_ALLOW_DUCKS) {
// 100 attempts at finding some water to create a few ducks at
for (sint32 i = 0; i < 100; i++) {
if (scenario_create_ducks())

View File

@@ -19,13 +19,17 @@
#include "../common.h"
enum {
WATER_FLAGS_ALLOW_DUCKS = (1 << 0)
};
#pragma pack(push, 1)
typedef struct rct_water_type {
rct_string_id string_idx; // 0x00
uint32 image_id; // 0x02
uint32 var_06;
uint32 var_0A;
uint16 var_0E;
uint32 palette_index_1;
uint32 palette_index_2;
uint16 flags;
} rct_water_type;
assert_struct_size(rct_water_type, 16);
#pragma pack(pop)