Implement ghost drawing for special vehicles

This commit is contained in:
Ted John 2019-05-08 17:55:53 +01:00
parent 5f1f428bce
commit 5c8aa743f6
6 changed files with 89 additions and 63 deletions

View File

@ -196,10 +196,14 @@ void vehicle_visual_virginia_reel(
const vehicle_boundbox* bb = &_virginiaReelBoundbox[j]; const vehicle_boundbox* bb = &_virginiaReelBoundbox[j];
image_id = baseImage_id | SPRITE_ID_PALETTE_COLOUR_2(vehicle->colours.body_colour, vehicle->colours.trim_colour); image_id = baseImage_id | SPRITE_ID_PALETTE_COLOUR_2(vehicle->colours.body_colour, vehicle->colours.trim_colour);
if (vehicle->IsGhost())
{
image_id = (image_id & 0x7FFFF) | CONSTRUCTION_MARKER;
}
sub_98197C( sub_98197C(
session, image_id, 0, 0, bb->length_x, bb->length_y, bb->length_z, z, bb->offset_x, bb->offset_y, bb->offset_z + z); session, image_id, 0, 0, bb->length_x, bb->length_y, bb->length_z, z, bb->offset_x, bb->offset_y, bb->offset_z + z);
if (session->DPI.zoom_level < 2 && vehicle->num_peeps > 0) if (session->DPI.zoom_level < 2 && vehicle->num_peeps > 0 && !vehicle->IsGhost())
{ {
uint8_t riding_peep_sprites[4] = { 0xFF, 0xFF, 0xFF, 0xFF }; uint8_t riding_peep_sprites[4] = { 0xFF, 0xFF, 0xFF, 0xFF };
for (int32_t i = 0; i < vehicle->num_peeps; i++) for (int32_t i = 0; i < vehicle->num_peeps; i++)

View File

@ -54,8 +54,11 @@ void vehicle_visual_observation_tower(
baseImage_id = (vehicle->animation_frame * 2) + vehicleEntry->base_image_id + 8; baseImage_id = (vehicle->animation_frame * 2) + vehicleEntry->base_image_id + 8;
} }
image_id = baseImage_id | (vehicle->colours.body_colour << 19) | (vehicle->colours.trim_colour << 24) image_id = baseImage_id | SPRITE_ID_PALETTE_COLOUR_3(vehicle->colours.body_colour, vehicle->colours.trim_colour << 24);
| IMAGE_TYPE_REMAP_2_PLUS; if (vehicle->IsGhost())
{
image_id = (image_id & 0x7FFFF) | CONSTRUCTION_MARKER;
}
paint_struct* ps = sub_98197C(session, image_id, 0, 0, 2, 2, 41, z, -11, -11, z + 1); paint_struct* ps = sub_98197C(session, image_id, 0, 0, 2, 2, 41, z, -11, -11, z + 1);
if (ps != nullptr) if (ps != nullptr)
{ {

View File

@ -35,48 +35,49 @@ void vehicle_visual_launched_freefall(
paint_session* session, int32_t x, int32_t imageDirection, int32_t y, int32_t z, const rct_vehicle* vehicle, paint_session* session, int32_t x, int32_t imageDirection, int32_t y, int32_t z, const rct_vehicle* vehicle,
const rct_ride_entry_vehicle* vehicleEntry) const rct_ride_entry_vehicle* vehicleEntry)
{ {
int32_t image_id; auto imageFlags = SPRITE_ID_PALETTE_COLOUR_2(vehicle->colours.body_colour, vehicle->colours.trim_colour);
int32_t baseImage_id = vehicleEntry->base_image_id + ((vehicle->restraints_position / 64) * 2); if (vehicle->IsGhost())
{
imageFlags = CONSTRUCTION_MARKER;
}
// Draw back: // Draw back:
image_id = (baseImage_id + 2) | SPRITE_ID_PALETTE_COLOUR_2(vehicle->colours.body_colour, vehicle->colours.trim_colour); int32_t baseImage_id = vehicleEntry->base_image_id + ((vehicle->restraints_position / 64) * 2);
auto image_id = (baseImage_id + 2) | imageFlags;
sub_98197C(session, image_id, 0, 0, 2, 2, 41, z, -11, -11, z + 1); sub_98197C(session, image_id, 0, 0, 2, 2, 41, z, -11, -11, z + 1);
// Draw front: // Draw front:
image_id = (baseImage_id + 1) | SPRITE_ID_PALETTE_COLOUR_2(vehicle->colours.body_colour, vehicle->colours.trim_colour); image_id = (baseImage_id + 1) | imageFlags;
sub_98197C(session, image_id, 0, 0, 16, 16, 41, z, -5, -5, z + 1); sub_98197C(session, image_id, 0, 0, 16, 16, 41, z, -5, -5, z + 1);
// Draw peeps: // Draw peeps:
if (session->DPI.zoom_level < 2) if (session->DPI.zoom_level < 2 && vehicle->num_peeps > 0 && !vehicle->IsGhost())
{ {
if (vehicle->num_peeps > 0) baseImage_id = vehicleEntry->base_image_id + 9;
if ((vehicle->restraints_position / 64) == 3)
{ {
baseImage_id = vehicleEntry->base_image_id + 9; baseImage_id += 2; // Draw peeps sitting without transparent area between them for restraints
if ((vehicle->restraints_position / 64) == 3) }
{ image_id = (baseImage_id + ((((imageDirection / 8) + 0) & 3) * 3))
baseImage_id += 2; // Draw peeps sitting without transparent area between them for restraints | SPRITE_ID_PALETTE_COLOUR_2(vehicle->peep_tshirt_colours[0], vehicle->peep_tshirt_colours[1]);
} sub_98199C(session, image_id, 0, 0, 16, 16, 41, z, -5, -5, z + 1);
image_id = (baseImage_id + ((((imageDirection / 8) + 0) & 3) * 3)) if (vehicle->num_peeps > 2)
| SPRITE_ID_PALETTE_COLOUR_2(vehicle->peep_tshirt_colours[0], vehicle->peep_tshirt_colours[1]); {
image_id = (baseImage_id + ((((imageDirection / 8) + 1) & 3) * 3))
| SPRITE_ID_PALETTE_COLOUR_2(vehicle->peep_tshirt_colours[2], vehicle->peep_tshirt_colours[3]);
sub_98199C(session, image_id, 0, 0, 16, 16, 41, z, -5, -5, z + 1);
}
if (vehicle->num_peeps > 4)
{
image_id = (baseImage_id + ((((imageDirection / 8) + 2) & 3) * 3))
| SPRITE_ID_PALETTE_COLOUR_2(vehicle->peep_tshirt_colours[4], vehicle->peep_tshirt_colours[5]);
sub_98199C(session, image_id, 0, 0, 16, 16, 41, z, -5, -5, z + 1);
}
if (vehicle->num_peeps > 6)
{
image_id = (baseImage_id + ((((imageDirection / 8) + 3) & 3) * 3))
| SPRITE_ID_PALETTE_COLOUR_2(vehicle->peep_tshirt_colours[6], vehicle->peep_tshirt_colours[7]);
sub_98199C(session, image_id, 0, 0, 16, 16, 41, z, -5, -5, z + 1); sub_98199C(session, image_id, 0, 0, 16, 16, 41, z, -5, -5, z + 1);
if (vehicle->num_peeps > 2)
{
image_id = (baseImage_id + ((((imageDirection / 8) + 1) & 3) * 3))
| SPRITE_ID_PALETTE_COLOUR_2(vehicle->peep_tshirt_colours[2], vehicle->peep_tshirt_colours[3]);
sub_98199C(session, image_id, 0, 0, 16, 16, 41, z, -5, -5, z + 1);
}
if (vehicle->num_peeps > 4)
{
image_id = (baseImage_id + ((((imageDirection / 8) + 2) & 3) * 3))
| SPRITE_ID_PALETTE_COLOUR_2(vehicle->peep_tshirt_colours[4], vehicle->peep_tshirt_colours[5]);
sub_98199C(session, image_id, 0, 0, 16, 16, 41, z, -5, -5, z + 1);
}
if (vehicle->num_peeps > 6)
{
image_id = (baseImage_id + ((((imageDirection / 8) + 3) & 3) * 3))
| SPRITE_ID_PALETTE_COLOUR_2(vehicle->peep_tshirt_colours[6], vehicle->peep_tshirt_colours[7]);
sub_98199C(session, image_id, 0, 0, 16, 16, 41, z, -5, -5, z + 1);
}
} }
} }

View File

@ -35,6 +35,12 @@ void vehicle_visual_roto_drop(
paint_session* session, int32_t x, int32_t imageDirection, int32_t y, int32_t z, const rct_vehicle* vehicle, paint_session* session, int32_t x, int32_t imageDirection, int32_t y, int32_t z, const rct_vehicle* vehicle,
const rct_ride_entry_vehicle* vehicleEntry) const rct_ride_entry_vehicle* vehicleEntry)
{ {
auto imageFlags = SPRITE_ID_PALETTE_COLOUR_2(vehicle->colours.body_colour, vehicle->colours.trim_colour);
if (vehicle->IsGhost())
{
imageFlags = CONSTRUCTION_MARKER;
}
int32_t image_id; int32_t image_id;
int32_t baseImage_id = (vehicleEntry->base_image_id + 4) + ((vehicle->animation_frame / 4) & 0x3); int32_t baseImage_id = (vehicleEntry->base_image_id + 4) + ((vehicle->animation_frame / 4) & 0x3);
if (vehicle->restraints_position >= 64) if (vehicle->restraints_position >= 64)
@ -44,39 +50,42 @@ void vehicle_visual_roto_drop(
} }
// Draw back: // Draw back:
image_id = baseImage_id | SPRITE_ID_PALETTE_COLOUR_2(vehicle->colours.body_colour, vehicle->colours.trim_colour); image_id = baseImage_id | imageFlags;
sub_98197C(session, image_id, 0, 0, 2, 2, 41, z, -11, -11, z + 1); sub_98197C(session, image_id, 0, 0, 2, 2, 41, z, -11, -11, z + 1);
// Draw front: // Draw front:
image_id = (baseImage_id + 4) | SPRITE_ID_PALETTE_COLOUR_2(vehicle->colours.body_colour, vehicle->colours.trim_colour); image_id = (baseImage_id + 4) | imageFlags;
sub_98197C(session, image_id, 0, 0, 16, 16, 41, z, -5, -5, z + 1); sub_98197C(session, image_id, 0, 0, 16, 16, 41, z, -5, -5, z + 1);
uint8_t riding_peep_sprites[64]; if (vehicle->num_peeps > 0 && !vehicle->IsGhost())
std::fill_n(riding_peep_sprites, sizeof(riding_peep_sprites), 0xFF);
for (int32_t i = 0; i < vehicle->num_peeps; i++)
{ {
uint8_t cl = (i & 3) * 16; uint8_t riding_peep_sprites[64];
cl += (i & 0xFC); std::fill_n(riding_peep_sprites, sizeof(riding_peep_sprites), 0xFF);
cl += vehicle->animation_frame / 4; for (int32_t i = 0; i < vehicle->num_peeps; i++)
cl += (imageDirection / 8) * 16;
cl &= 0x3F;
riding_peep_sprites[cl] = vehicle->peep_tshirt_colours[i];
}
// Draw riding peep sprites in back to front order:
for (int32_t j = 0; j <= 48; j++)
{
int32_t i = (j % 2) ? (48 - (j / 2)) : (j / 2);
if (riding_peep_sprites[i] != 0xFF)
{ {
baseImage_id = vehicleEntry->base_image_id + 20 + i; uint8_t cl = (i & 3) * 16;
if (vehicle->restraints_position >= 64) cl += (i & 0xFC);
cl += vehicle->animation_frame / 4;
cl += (imageDirection / 8) * 16;
cl &= 0x3F;
riding_peep_sprites[cl] = vehicle->peep_tshirt_colours[i];
}
// Draw riding peep sprites in back to front order:
for (int32_t j = 0; j <= 48; j++)
{
int32_t i = (j % 2) ? (48 - (j / 2)) : (j / 2);
if (riding_peep_sprites[i] != 0xFF)
{ {
baseImage_id += 64; baseImage_id = vehicleEntry->base_image_id + 20 + i;
baseImage_id += vehicle->restraints_position / 64; if (vehicle->restraints_position >= 64)
{
baseImage_id += 64;
baseImage_id += vehicle->restraints_position / 64;
}
image_id = baseImage_id | SPRITE_ID_PALETTE_COLOUR_1(riding_peep_sprites[i]);
sub_98199C(session, image_id, 0, 0, 16, 16, 41, z, -5, -5, z + 1);
} }
image_id = baseImage_id | SPRITE_ID_PALETTE_COLOUR_1(riding_peep_sprites[i]);
sub_98199C(session, image_id, 0, 0, 16, 16, 41, z, -5, -5, z + 1);
} }
} }

View File

@ -223,10 +223,15 @@ void vehicle_visual_river_rapids(
const vehicle_boundbox* bb = &_riverRapidsBoundbox[j]; const vehicle_boundbox* bb = &_riverRapidsBoundbox[j];
image_id = baseImage_id | SPRITE_ID_PALETTE_COLOUR_2(vehicle->colours.body_colour, vehicle->colours.trim_colour); image_id = baseImage_id | SPRITE_ID_PALETTE_COLOUR_2(vehicle->colours.body_colour, vehicle->colours.trim_colour);
if (vehicle->IsGhost())
{
image_id &= 0x7FFFF;
image_id |= CONSTRUCTION_MARKER;
}
sub_98197C( sub_98197C(
session, image_id, 0, 0, bb->length_x, bb->length_y, bb->length_z, z, bb->offset_x, bb->offset_y, bb->offset_z + z); session, image_id, 0, 0, bb->length_x, bb->length_y, bb->length_z, z, bb->offset_x, bb->offset_y, bb->offset_z + z);
if (session->DPI.zoom_level < 2 && vehicle->num_peeps > 0) if (session->DPI.zoom_level < 2 && vehicle->num_peeps > 0 && !vehicle->IsGhost())
{ {
// Draw peeps: (this particular vehicle doesn't sort them back to front like others so the back ones sometimes clip, but // Draw peeps: (this particular vehicle doesn't sort them back to front like others so the back ones sometimes clip, but
// that's how the original does it...) // that's how the original does it...)

View File

@ -24,6 +24,12 @@ void vehicle_visual_submarine(
paint_session* session, int32_t x, int32_t imageDirection, int32_t y, int32_t z, const rct_vehicle* vehicle, paint_session* session, int32_t x, int32_t imageDirection, int32_t y, int32_t z, const rct_vehicle* vehicle,
const rct_ride_entry_vehicle* vehicleEntry) const rct_ride_entry_vehicle* vehicleEntry)
{ {
auto imageFlags = SPRITE_ID_PALETTE_COLOUR_3(vehicle->colours.body_colour, vehicle->colours.trim_colour);
if (vehicle->IsGhost())
{
imageFlags = CONSTRUCTION_MARKER;
}
int32_t baseImage_id = imageDirection; int32_t baseImage_id = imageDirection;
int32_t image_id; int32_t image_id;
if (vehicle->restraints_position >= 64) if (vehicle->restraints_position >= 64)
@ -53,8 +59,7 @@ void vehicle_visual_submarine(
vehicle_boundbox bb = VehicleBoundboxes[vehicleEntry->draw_order][imageDirection / 2]; vehicle_boundbox bb = VehicleBoundboxes[vehicleEntry->draw_order][imageDirection / 2];
image_id = baseImage_id | (vehicle->colours.body_colour << 19) | (vehicle->colours.trim_colour << 24) image_id = baseImage_id | imageFlags;
| IMAGE_TYPE_REMAP_2_PLUS;
paint_struct* ps = sub_98197C( paint_struct* ps = sub_98197C(
session, image_id, 0, 0, bb.length_x, bb.length_y, bb.length_z, z, bb.offset_x, bb.offset_y, bb.offset_z + z); session, image_id, 0, 0, bb.length_x, bb.length_y, bb.length_z, z, bb.offset_x, bb.offset_y, bb.offset_z + z);
if (ps != nullptr) if (ps != nullptr)
@ -62,8 +67,7 @@ void vehicle_visual_submarine(
ps->tertiary_colour = vehicle->colours_extended; ps->tertiary_colour = vehicle->colours_extended;
} }
image_id = (baseImage_id + 1) | (vehicle->colours.body_colour << 19) | (vehicle->colours.trim_colour << 24) image_id = (baseImage_id + 1) | imageFlags;
| IMAGE_TYPE_REMAP_2_PLUS;
ps = sub_98197C(session, image_id, 0, 0, bb.length_x, bb.length_y, 2, z, bb.offset_x, bb.offset_y, bb.offset_z + z - 10); ps = sub_98197C(session, image_id, 0, 0, bb.length_x, bb.length_y, 2, z, bb.offset_x, bb.offset_y, bb.offset_z + z - 10);
if (ps != nullptr) if (ps != nullptr)
{ {