Decompile vehicle_visual_river_rapids and vehicle_visual_splash_effect

This commit is contained in:
zsilencer 2016-05-08 03:10:14 -06:00
parent f75e0c1d77
commit 414829a2ea
5 changed files with 132 additions and 10 deletions

View File

@ -19,6 +19,20 @@
#include "../../interface/viewport.h"
#include "../../world/sprite.h"
#include "../../paint/paint.h"
#include "../vehicle_paint.h"
// 0x009927E6:
static const vehicle_boundbox _virginiaReelBoundbox[] = {
{ -11, -11, 1, 22, 22, 13 },
{ -11, -11, 1, 22, 22, 13 },
{ -11, -11, 1, 22, 22, 13 },
{ -11, -11, 1, 22, 22, 13 },
{ -11, -11, 1, 22, 22, 13 },
{ -11, -11, 1, 22, 22, 13 },
{ -11, -11, 1, 22, 22, 13 },
{ -11, -11, 1, 22, 22, 13 },
{ -11, -11, 1, 22, 22, 13 },
};
/**
*
@ -56,14 +70,9 @@ void vehicle_visual_virginia_reel(int x, int imageDirection, int y, int z, rct_v
}
baseImage_id += vehicleEntry->base_image_id;
sint16 bbo_x = RCT2_ADDRESS(0x009927E6, sint8)[j * 8];
sint16 bbo_y = RCT2_ADDRESS(0x009927E7, sint8)[j * 8];
sint16 bbo_z = RCT2_ADDRESS(0x009927E8, sint8)[j * 8] + z;
uint16 bbl_x = RCT2_ADDRESS(0x009927E9, uint8)[j * 8];
uint16 bbl_y = RCT2_ADDRESS(0x009927EA, uint8)[j * 8];
uint8 bbl_z = RCT2_ADDRESS(0x009927EB, uint8)[j * 8];
vehicle_boundbox bb = _virginiaReelBoundbox[j];
image_id = baseImage_id | (vehicle->colours.body_colour << 19) | (vehicle->colours.trim_colour << 24) | 0xA0000000;
sub_98197C(image_id, 0, 0, bbl_x, bbl_y, bbl_z, z, bbo_x, bbo_y, bbo_z, get_current_rotation());
sub_98197C(image_id, 0, 0, bb.length_x, bb.length_y, bb.length_z, z, bb.offset_x, bb.offset_y, bb.offset_z + z, get_current_rotation());
if (RCT2_GLOBAL(0x140E9A8, rct_drawpixelinfo*)->zoom_level < 2 && vehicle->num_peeps > 0) {
uint8 riding_peep_sprites[4] = {0xFF, 0xFF, 0xFF, 0xFF};
@ -74,7 +83,7 @@ void vehicle_visual_virginia_reel(int x, int imageDirection, int y, int z, rct_v
for (int i = 0; i < countof(draw_order); i++) {
if (riding_peep_sprites[draw_order[i]] != 0xFF) {
image_id = (baseImage_id + ((draw_order[i] + 1) * 72)) | (riding_peep_sprites[draw_order[i]] << 19) | 0x20000000;
sub_98199C(image_id, 0, 0, bbl_x, bbl_y, bbl_z, z, bbo_x, bbo_y, bbo_z, get_current_rotation());
sub_98199C(image_id, 0, 0, bb.length_x, bb.length_y, bb.length_z, z, bb.offset_x, bb.offset_y, bb.offset_z + z, get_current_rotation());
}
}
}

View File

@ -330,6 +330,7 @@ enum {
VEHICLE_VISUAL_REVERSER,
VEHICLE_VISUAL_SPLASH_BOATS_OR_WATER_COASTER,
VEHICLE_VISUAL_ROTO_DROP,
VEHICLE_VISUAL_SPLASH_EFFECT = 11,
VEHICLE_VISUAL_VIRGINIA_REEL = 15,
VEHICLE_VISUAL_SUBMARINE
};

View File

@ -19,6 +19,7 @@
#include "../world/sprite.h"
#include "../ride/ride_data.h"
#include "../interface/viewport.h"
#include "../game.h"
#include "vehicle_paint.h"
// 0x0098E52C:
@ -886,6 +887,25 @@ const vehicle_boundbox VehicleBoundboxes[16][224] = {
}
};
/**
*
* rct2: 0x006D5696
*/
void vehicle_visual_splash_effect(int x, int imageDirection, int y, int z, rct_vehicle *vehicle, const rct_ride_entry_vehicle *vehicleEntry)
{
if (vehicle->sprite_direction & 7) {
return;
}
if (vehicle->vehicle_sprite_type != 0) {
return;
}
if (vehicle->velocity <= 0x50000) {
return;
}
int image_id = 29046 + ((((vehicle->sprite_direction / 8) + get_current_rotation()) & 3) * 8) + ((gCurrentTicks / 2) & 7);
sub_98199C(image_id, 0, 0, 0, 0, 0, z, 0, 0, z, get_current_rotation());
}
/**
*
* rct2: 0x006D4244
@ -923,14 +943,14 @@ void vehicle_paint(rct_vehicle *vehicle, int imageDirection)
case VEHICLE_VISUAL_DEFAULT: RCT2_CALLPROC_X(0x006D45F8, x, imageDirection, y, z, (int)vehicle, rct2VehiclePtrFormat, 0); break;
case VEHICLE_VISUAL_LAUNCHED_FREEFALL: vehicle_visual_launched_freefall(x, imageDirection, y, z, vehicle, vehicleEntry); break;
case VEHICLE_VISUAL_OBSERVATION_TOWER: vehicle_visual_observation_tower(x, imageDirection, y, z, vehicle, vehicleEntry); break;
case VEHICLE_VISUAL_RIVER_RAPIDS: RCT2_CALLPROC_X(0x006D5889, x, imageDirection, y, z, (int)vehicle, rct2VehiclePtrFormat, 0); break;
case VEHICLE_VISUAL_RIVER_RAPIDS: vehicle_visual_river_rapids(x, imageDirection, y, z, vehicle, vehicleEntry); break;
case VEHICLE_VISUAL_MINI_GOLF_PLAYER: RCT2_CALLPROC_X(0x006D42F0, x, imageDirection, y, z, (int)vehicle, rct2VehiclePtrFormat, 0); break;
case VEHICLE_VISUAL_MINI_GOLF_BALL: RCT2_CALLPROC_X(0x006D43C6, x, imageDirection, y, z, (int)vehicle, rct2VehiclePtrFormat, 0); break;
case VEHICLE_VISUAL_REVERSER: RCT2_CALLPROC_X(0x006D4453, x, imageDirection, y, z, (int)vehicle, rct2VehiclePtrFormat, 0); break;
case VEHICLE_VISUAL_SPLASH_BOATS_OR_WATER_COASTER: RCT2_CALLPROC_X(0x006D4295, x, imageDirection, y, z, (int)vehicle, rct2VehiclePtrFormat, 0); break;
case VEHICLE_VISUAL_ROTO_DROP: vehicle_visual_roto_drop(x, imageDirection, y, z, vehicle, vehicleEntry); break;
case 10: RCT2_CALLPROC_X(0x006D5600, x, imageDirection, y, z, (int)vehicle, rct2VehiclePtrFormat, 0); break;
case 11: RCT2_CALLPROC_X(0x006D5696, x, imageDirection, y, z, (int)vehicle, rct2VehiclePtrFormat, 0); break;
case VEHICLE_VISUAL_SPLASH_EFFECT: vehicle_visual_splash_effect(x, imageDirection, y, z, vehicle, vehicleEntry); break;
case 12: RCT2_CALLPROC_X(0x006D57EE, x, imageDirection, y, z, (int)vehicle, rct2VehiclePtrFormat, 0); break;
case 13: RCT2_CALLPROC_X(0x006D5783, x, imageDirection, y, z, (int)vehicle, rct2VehiclePtrFormat, 0); break;
case 14: RCT2_CALLPROC_X(0x006D5701, x, imageDirection, y, z, (int)vehicle, rct2VehiclePtrFormat, 0); break;

View File

@ -34,7 +34,9 @@ void vehicle_paint(rct_vehicle *vehicle, int imageDirection);
void vehicle_visual_roto_drop(int x, int imageDirection, int y, int z, rct_vehicle *vehicle, const rct_ride_entry_vehicle *vehicleEntry);
void vehicle_visual_observation_tower(int x, int imageDirection, int y, int z, rct_vehicle *vehicle, const rct_ride_entry_vehicle *vehicleEntry);
void vehicle_visual_river_rapids(int x, int imageDirection, int y, int z, rct_vehicle *vehicle, const rct_ride_entry_vehicle *vehicleEntry);
void vehicle_visual_launched_freefall(int x, int imageDirection, int y, int z, rct_vehicle *vehicle, const rct_ride_entry_vehicle *vehicleEntry);
void vehicle_visual_splash_effect(int x, int imageDirection, int y, int z, rct_vehicle *vehicle, const rct_ride_entry_vehicle *vehicleEntry);
void vehicle_visual_virginia_reel(int x, int imageDirection, int y, int z, rct_vehicle *vehicle, const rct_ride_entry_vehicle *vehicleEntry);
void vehicle_visual_submarine(int x, int imageDirection, int y, int z, rct_vehicle *vehicle, const rct_ride_entry_vehicle *vehicleEntry);

View File

@ -13,3 +13,93 @@
* A full copy of the GNU General Public License can be found in licence.txt
*****************************************************************************/
#pragma endregion
#include "../../addresses.h"
#include "../../config.h"
#include "../../interface/viewport.h"
#include "../../world/sprite.h"
#include "../../paint/paint.h"
#include "../vehicle_paint.h"
#include "../../game.h"
// 0x0099279E:
static const vehicle_boundbox _riverRapidsBoundbox[] = {
{ -13, -13, 1, 26, 26, 13 },
{ -13, -13, 1, 26, 26, 13 },
{ -13, -13, 1, 26, 26, 13 },
{ -13, -13, 1, 26, 26, 13 },
{ -13, -13, 1, 26, 26, 13 },
{ -13, -13, 1, 26, 26, 13 },
{ -13, -13, 1, 26, 26, 13 },
{ -13, -13, 1, 26, 26, 13 },
{ -13, -13, 1, 26, 26, 13 }
};
/**
*
* rct2: 0x006D5889
*/
void vehicle_visual_river_rapids(int x, int imageDirection, int y, int z, rct_vehicle *vehicle, const rct_ride_entry_vehicle *vehicleEntry)
{
int image_id;
int baseImage_id = imageDirection;
int ecx = ((vehicle->var_BA / 8) + (get_current_rotation() * 8)) & 31;
int j = 0;
if (vehicle->vehicle_sprite_type == 0) {
baseImage_id = ecx & 7;
} else {
if (vehicle->vehicle_sprite_type == 1 || vehicle->vehicle_sprite_type == 5) {
if (vehicle->vehicle_sprite_type == 5){
baseImage_id = imageDirection ^ 16;
}
baseImage_id &= 24;
j = (baseImage_id / 8) + 1;
baseImage_id += (ecx & 7);
baseImage_id += 8;
} else
if (vehicle->vehicle_sprite_type == 2 || vehicle->vehicle_sprite_type == 6) {
if (vehicle->vehicle_sprite_type == 6){
baseImage_id = imageDirection ^ 16;
}
baseImage_id &= 24;
j = (baseImage_id / 8) + 5;
baseImage_id += (ecx & 7);
baseImage_id += 40;
} else {
baseImage_id = ecx & 7;
}
}
baseImage_id += vehicleEntry->base_image_id;
vehicle_boundbox bb = _riverRapidsBoundbox[j];
image_id = baseImage_id | (vehicle->colours.body_colour << 19) | (vehicle->colours.trim_colour << 24) | 0xA0000000;
sub_98197C(image_id, 0, 0, bb.length_x, bb.length_y, bb.length_z, z, bb.offset_x, bb.offset_y, bb.offset_z + z, get_current_rotation());
if (RCT2_GLOBAL(0x140E9A8, rct_drawpixelinfo*)->zoom_level < 2 && vehicle->num_peeps > 0) {
// Draw peeps: (this particular vehicle doesn't sort them back to front like others so the back ones sometimes clip, but thats how the original does it...)
int peeps = ((ecx / 8) + 0) & 3;
image_id = (baseImage_id + ((peeps + 1) * 72)) | (vehicle->peep_tshirt_colours[0] << 19) | (vehicle->peep_tshirt_colours[1] << 24) | 0xA0000000;
sub_98199C(image_id, 0, 0, bb.length_x, bb.length_y, bb.length_z, z, bb.offset_x, bb.offset_y, bb.offset_z + z, get_current_rotation());
if (vehicle->num_peeps > 2) {
peeps = ((ecx / 8) + 2) & 3;
image_id = (baseImage_id + ((peeps + 1) * 72)) | (vehicle->peep_tshirt_colours[2] << 19) | (vehicle->peep_tshirt_colours[3] << 24) | 0xA0000000;
sub_98199C(image_id, 0, 0, bb.length_x, bb.length_y, bb.length_z, z, bb.offset_x, bb.offset_y, bb.offset_z + z, get_current_rotation());
}
if (vehicle->num_peeps > 4) {
peeps = ((ecx / 8) + 1) & 3;
image_id = (baseImage_id + ((peeps + 1) * 72)) | (vehicle->peep_tshirt_colours[4] << 19) | (vehicle->peep_tshirt_colours[5] << 24) | 0xA0000000;
sub_98199C(image_id, 0, 0, bb.length_x, bb.length_y, bb.length_z, z, bb.offset_x, bb.offset_y, bb.offset_z + z, get_current_rotation());
}
if (vehicle->num_peeps > 6) {
peeps = ((ecx / 8) + 3) & 3;
image_id = (baseImage_id + ((peeps + 1) * 72)) | (vehicle->peep_tshirt_colours[6] << 19) | (vehicle->peep_tshirt_colours[7] << 24) | 0xA0000000;
sub_98199C(image_id, 0, 0, bb.length_x, bb.length_y, bb.length_z, z, bb.offset_x, bb.offset_y, bb.offset_z + z, get_current_rotation());
}
}
switch (vehicleEntry->pad_5E) {
case 1: /* nullsub */ break;
case VEHICLE_VISUAL_SPLASH_EFFECT: vehicle_visual_splash_effect(x, imageDirection, y, z, vehicle, vehicleEntry); break;
default: assert(false); break;
}
}