Merge pull request #3399 from zsilencer/paint-setup/submarine

Submarine paint setup
This commit is contained in:
Duncan
2016-05-08 05:28:27 +01:00
3 changed files with 929 additions and 1 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -19,11 +19,23 @@
#include "vehicle.h"
typedef struct {
sint8 offset_x;
sint8 offset_y;
sint8 offset_z;
uint8 length_x;
uint8 length_y;
uint8 length_z;
} vehicle_boundbox;
extern const vehicle_boundbox VehicleBoundboxes[16][224];
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_launched_freefall(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);
#endif

View File

@@ -13,3 +13,54 @@
* 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"
/**
*
* rct2: 0x006D44D5
*/
void vehicle_visual_submarine(int x, int imageDirection, int y, int z, rct_vehicle *vehicle, const rct_ride_entry_vehicle *vehicleEntry)
{
int baseImage_id = imageDirection;
int image_id;
if (vehicle->restraints_position >= 64) {
if ((vehicleEntry->sprite_flags & 0x2000) && !(imageDirection & 3)) {
baseImage_id /= 8;
baseImage_id += ((vehicle->restraints_position - 64) / 64) * 4;
baseImage_id *= vehicleEntry->var_16;
baseImage_id += vehicleEntry->var_1C;
}
} else {
if (vehicleEntry->flags_a & 0x800) {
baseImage_id /= 2;
}
if (vehicleEntry->sprite_flags & 0x8000) {
baseImage_id /= 8;
}
baseImage_id *= vehicleEntry->var_16;
baseImage_id += vehicleEntry->base_image_id;
baseImage_id += vehicle->var_4A;
}
vehicle_boundbox bb = VehicleBoundboxes[vehicleEntry->draw_order][imageDirection / 2];
image_id = baseImage_id | (vehicle->colours.body_colour << 19) | (vehicle->colours.trim_colour << 24) | 0x80000000;
if (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())) {
paint_struct* ps = RCT2_GLOBAL(0xEE7888, paint_struct*) - 1; // sub_98197C increments this but need original
ps->tertiary_colour = vehicle->colours_extended;
}
image_id = (baseImage_id + 1) | (vehicle->colours.body_colour << 19) | (vehicle->colours.trim_colour << 24) | 0x80000000;
if (sub_98197C(image_id, 0, 0, bb.length_x, bb.length_y, 2, z, bb.offset_x, bb.offset_y, bb.offset_z + z - 10, get_current_rotation())) {
paint_struct* ps = RCT2_GLOBAL(0xEE7888, paint_struct*) - 1; // sub_98197C increments this but need original
ps->tertiary_colour = vehicle->colours_extended;
}
assert(vehicleEntry->pad_5E == 1);
}