Paint launched freefall (#3678)

This commit is contained in:
Marijn van der Werf 2016-05-20 09:11:04 +02:00 committed by Ted John
parent 00aeaaff7e
commit b8383af253
3 changed files with 108 additions and 2 deletions

View File

@ -14,11 +14,29 @@
*****************************************************************************/
#pragma endregion
#include "../../common.h"
#include "../../addresses.h"
#include "../../config.h"
#include "../../interface/viewport.h"
#include "../../world/sprite.h"
#include "../../paint/paint.h"
#include "../track_paint.h"
#include "../track.h"
#include "../../paint/supports.h"
enum
{
SPR_LAUNCHED_FREEFALL_TOWER_BASE = 14564,
SPR_LAUNCHED_FREEFALL_TOWER_SEGMENT = 14565,
SPR_LAUNCHED_FREEFALL_TOWER_SEGMENT_TOP = 14566,
};
static const uint32 launched_freefall_fence_sprites[] = {
SPR_FENCE_METAL_NE,
SPR_FENCE_METAL_SE,
SPR_FENCE_METAL_SW,
SPR_FENCE_METAL_NW
};
/**
*
@ -64,3 +82,90 @@ void vehicle_visual_launched_freefall(int x, int imageDirection, int y, int z, r
assert(vehicleEntry->effect_visual == 1);
}
/** rct2: 0x006FD1F8 */
static void paint_launched_freefall_base(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element * mapElement)
{
trackSequence = track_map_3x3[direction][trackSequence];
int edges = edges_3x3[trackSequence];
rct_ride * ride = get_ride(rideIndex);
rct_xy16 position = {RCT2_GLOBAL(0x009DE56A, sint16), RCT2_GLOBAL(0x009DE56E, sint16)};
wooden_a_supports_paint_setup((direction & 1), 0, height, RCT2_GLOBAL(0x00F441A0, uint32), NULL);
uint32 imageId = SPR_FLOOR_METAL | RCT2_GLOBAL(0x00F4419C, uint32);
sub_98197C(imageId, 0, 0, 32, 32, 1, height, 0, 0, height, get_current_rotation());
track_paint_util_paint_fences(edges, position, mapElement, ride, RCT2_GLOBAL(0x00F44198, uint32), height, launched_freefall_fence_sprites, get_current_rotation());
if (trackSequence == 0) {
imageId = SPR_LAUNCHED_FREEFALL_TOWER_BASE | RCT2_GLOBAL(0x00F44198, uint32);
sub_98197C(imageId, 0, 0, 2, 2, 27, height, 8, 8, height + 3, get_current_rotation());
height += 32;
imageId = SPR_LAUNCHED_FREEFALL_TOWER_SEGMENT | RCT2_GLOBAL(0x00F44198, uint32);
sub_98197C(imageId, 0, 0, 2, 2, 30, height, 8, 8, height, get_current_rotation());
height += 32;
imageId = SPR_LAUNCHED_FREEFALL_TOWER_SEGMENT | RCT2_GLOBAL(0x00F44198, uint32);
sub_98197C(imageId, 0, 0, 2, 2, 30, height, 8, 8, height, get_current_rotation());
RCT2_GLOBAL(0x9E323C, uint16) = (((height + 32) >> 4) & 0x00FF) | (6 << 8);
height -= 64;
}
int blockedSegments = 0;
switch (trackSequence) {
case 0: blockedSegments = SEGMENTS_ALL; break;
case 1: blockedSegments = SEGMENT_B8 | SEGMENT_C8 | SEGMENT_B4 | SEGMENT_CC | SEGMENT_BC; break;
case 2: blockedSegments = SEGMENT_B4 | SEGMENT_CC | SEGMENT_BC; break;
case 3: blockedSegments = SEGMENT_B4 | SEGMENT_CC | SEGMENT_BC | SEGMENT_D4 | SEGMENT_C0; break;
case 4: blockedSegments = SEGMENT_B4 | SEGMENT_C8 | SEGMENT_B8; break;
case 5: blockedSegments = SEGMENT_BC | SEGMENT_D4 | SEGMENT_C0; break;
case 6: blockedSegments = SEGMENT_B4 | SEGMENT_C8 | SEGMENT_B8 | SEGMENT_D0 | SEGMENT_C0; break;
case 7: blockedSegments = SEGMENT_B8 | SEGMENT_D0 | SEGMENT_C0 | SEGMENT_D4 | SEGMENT_BC; break;
case 8: blockedSegments = SEGMENT_B8 | SEGMENT_D0 | SEGMENT_C0; break;
}
paint_util_set_segment_support_height(blockedSegments, 0xFFFF, 0);
paint_util_set_segment_support_height(SEGMENTS_ALL & ~blockedSegments, height + 2, 0x20);
paint_util_set_general_support_height(height + 32, 0x20);
}
/** rct2: 0x006FD208 */
static void paint_launched_freefall_tower_section(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element * mapElement)
{
if (trackSequence == 1) {
return;
}
uint32 imageId = SPR_LAUNCHED_FREEFALL_TOWER_SEGMENT | RCT2_GLOBAL(0x00F44198, uint32);
sub_98197C(imageId, 0, 0, 2, 2, 30, height, 8, 8, height, get_current_rotation());
rct_map_element * nextMapElement = mapElement + 1;
if (map_element_is_last_for_tile(mapElement) || mapElement->clearance_height != nextMapElement->base_height) {
uint32 imageId = SPR_LAUNCHED_FREEFALL_TOWER_SEGMENT_TOP | RCT2_GLOBAL(0x00F44198, uint32);
sub_98199C(imageId, 0, 0, 2, 2, 30, height, 8, 8, height, get_current_rotation());
}
paint_util_set_segment_support_height(SEGMENTS_ALL, 0xFFFF, 0);
RCT2_GLOBAL(0x9E323C, uint16) = (((height + 32) >> 4) & 0x00FF) | (6 << 8);
paint_util_set_general_support_height(height + 32, 0x20);
}
/**
* rct2: 0x006FD0E8
*/
TRACK_PAINT_FUNCTION get_track_paint_function_launched_freefall(int trackType, int direction) {
switch(trackType) {
case TRACK_ELEM_TOWER_BASE:
return paint_launched_freefall_base;
case TRACK_ELEM_TOWER_SECTION:
return paint_launched_freefall_tower_section;
}
return NULL;
}

View File

@ -5479,7 +5479,7 @@ const uint32 RideTypeTrackPaintFunctionsOld[91] = {
0x008A534C, // RIDE_TYPE_WOODEN_WILD_MOUSE
0x008A5634, // RIDE_TYPE_STEEPLECHASE
0x006F7000, // RIDE_TYPE_CAR_RIDE
0x006FD0E8, // RIDE_TYPE_LAUNCHED_FREEFALL
0, // RIDE_TYPE_LAUNCHED_FREEFALL
0x006FE240, // RIDE_TYPE_BOBSLEIGH_COASTER
0, // RIDE_TYPE_OBSERVATION_TOWER
0x008A5B88, // RIDE_TYPE_LOOPING_ROLLER_COASTER
@ -5574,7 +5574,7 @@ const TRACK_PAINT_FUNCTION_GETTER RideTypeTrackPaintFunctions[91] = {
0, // RIDE_TYPE_WOODEN_WILD_MOUSE
0, // RIDE_TYPE_STEEPLECHASE
0, // RIDE_TYPE_CAR_RIDE
0, // RIDE_TYPE_LAUNCHED_FREEFALL
get_track_paint_function_launched_freefall, // RIDE_TYPE_LAUNCHED_FREEFALL
0, // RIDE_TYPE_BOBSLEIGH_COASTER
get_track_paint_function_observation_tower, // RIDE_TYPE_OBSERVATION_TOWER
0, // RIDE_TYPE_LOOPING_ROLLER_COASTER

View File

@ -166,6 +166,7 @@ void track_paint_util_left_quarter_turn_1_tile_tunnel(sint16 height, uint8 direc
typedef void (*TRACK_PAINT_FUNCTION)(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element* mapElement);
typedef TRACK_PAINT_FUNCTION (*TRACK_PAINT_FUNCTION_GETTER)(int trackType, int direction);
TRACK_PAINT_FUNCTION get_track_paint_function_launched_freefall(int trackType, int direction);
TRACK_PAINT_FUNCTION get_track_paint_function_observation_tower(int trackType, int direction);
TRACK_PAINT_FUNCTION get_track_paint_function_chairlift(int trackType, int direction);
TRACK_PAINT_FUNCTION get_track_paint_function_maze(int trackType, int direction);