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

Refactor 1-tile corner drawing

This commit is contained in:
Marijn van der Werf
2016-05-19 15:12:01 +02:00
parent 915c3a52b6
commit 87f60b6ba4
4 changed files with 78 additions and 61 deletions

View File

@@ -23,40 +23,6 @@
#include "../ride_data.h"
#include "../../world/map.h"
enum
{
SPR_STATION_PLATFORM_SW_NE = 22362,
SPR_STATION_PLATFORM_NW_SE = 22363,
SPR_STATION_PLATFORM_FENCED_SW_NE = 22364,
SPR_STATION_PLATFORM_FENCED_NW_SE = 22365,
SPR_STATION_PLATFORM_BEGIN_FENCED_SW_NE = 22366,
SPR_STATION_PLATFORM_BEGIN_FENCED_NW_SE = 22367,
SPR_STATION_PLATFORM_BEGIN_SW_NE = 22368,
SPR_STATION_PLATFORM_BEGIN_NW_SE = 22369,
SPR_STATION_FENCE_SW_NE = 22370,
SPR_STATION_FENCE_NW_SE = 22371,
SPR_STATION_BEGIN_ANGLE_FENCE_SW_NE = 22372,
SPR_STATION_BEGIN_ANGLE_FENCE_NW_SE = 22373,
SPR_STATION_FENCE_SMALL_NW_SE = 22374,
SPR_STATION_FENCE_SMALL_SW_NE = 22375,
SPR_STATION_PLATFORM_FENCED_END_RED_LIGHT_SW_NE = 22380,
SPR_STATION_PLATFORM_FENCED_END_RED_LIGHT_NW_SE = 22381,
SPR_STATION_PLATFORM_FENCED_END_GREEN_LIGHT_SW_NE = 22382,
SPR_STATION_PLATFORM_FENCED_END_GREEN_LIGHT_NW_SE = 22383,
SPR_STATION_LIGHT_BACK_NE_SW = 22384,
SPR_STATION_LIGHT_BACK_NW_SE = 22385,
SPR_STATION_LIGHT_BACK_ANGLE_FENCED_NE_SW = 22386,
SPR_STATION_LIGHT_BACK_ANGLE_FENCED_NW_SE = 22387,
SPR_STATION_PLATFORM_END_RED_LIGHT_SW_NE = 22388,
SPR_STATION_PLATFORM_END_RED_LIGHT_NW_SE = 22389,
SPR_STATION_PLATFORM_END_GREEN_LIGHT_SW_NE = 22390,
SPR_STATION_PLATFORM_END_GREEN_LIGHT_NW_SE = 22391,
SPR_STATION_BASE_B_SW_NE = 22428,
SPR_STATION_BASE_B_NW_SE = 22429,
};
/** rct2: 0x */
static void paint_mini_helicopters_track_station(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element * mapElement)
{
@@ -388,26 +354,16 @@ static void paint_mini_helicopters_track_right_quarter_turn_3_tiles(uint8 rideIn
/** rct2: 0x0081F408 */
static void paint_mini_helicopters_track_left_quarter_turn_1_tile(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element * mapElement)
{
uint32 imageId;
track_paint_util_paint_left_quarter_turn_1_tile(height, direction, RCT2_GLOBAL(0x00F44198, uint32), trackSpritesSubmarineRideMiniHelicoptersQuarterTurn1Tile, get_current_rotation());
switch (direction) {
case 0:
imageId = SPR_TRACK_SUBMARINE_RIDE_MINI_HELICOPTERS_FLAT_QUARTER_TURN_1_TILE_SW_NW | RCT2_GLOBAL(0x00F44198, uint32);
sub_98197C(imageId, 0, 0, 26, 24, 1, height, 6, 2, height, get_current_rotation());
paint_util_push_tunnel_left(height, TUNNEL_0);
break;
case 1:
imageId = SPR_TRACK_SUBMARINE_RIDE_MINI_HELICOPTERS_FLAT_QUARTER_TURN_1_TILE_NW_NE | RCT2_GLOBAL(0x00F44198, uint32);
sub_98197C(imageId, 0, 0, 26, 26, 1, height, 0, 0, height, get_current_rotation());
break;
case 2:
imageId = SPR_TRACK_SUBMARINE_RIDE_MINI_HELICOPTERS_FLAT_QUARTER_TURN_1_TILE_NE_SE | RCT2_GLOBAL(0x00F44198, uint32);
sub_98197C(imageId, 0, 0, 24, 26, 1, height, 2, 6, height, get_current_rotation());
paint_util_push_tunnel_right(height, TUNNEL_0);
break;
case 3:
imageId = SPR_TRACK_SUBMARINE_RIDE_MINI_HELICOPTERS_FLAT_QUARTER_TURN_1_TILE_SE_SW | RCT2_GLOBAL(0x00F44198, uint32);
sub_98197C(imageId, 0, 0, 24, 24, 1, height, 6, 6, height, get_current_rotation());
paint_util_push_tunnel_right(height, TUNNEL_0);
paint_util_push_tunnel_left(height, TUNNEL_0);
break;

View File

@@ -126,6 +126,33 @@ const uint32 fenceSpritesMetalB[] = {
SPR_FENCE_METAL_B_NW
};
const uint32 trackSpritesSubmarineRideMiniHelicoptersQuarterTurn3Tiles[4][3] = {
{
SPR_TRACK_SUBMARINE_RIDE_MINI_HELICOPTERS_FLAT_QUARTER_TURN_3_TILES_SW_SE_PART_0,
SPR_TRACK_SUBMARINE_RIDE_MINI_HELICOPTERS_FLAT_QUARTER_TURN_3_TILES_SW_SE_PART_1,
SPR_TRACK_SUBMARINE_RIDE_MINI_HELICOPTERS_FLAT_QUARTER_TURN_3_TILES_SW_SE_PART_2
}, {
SPR_TRACK_SUBMARINE_RIDE_MINI_HELICOPTERS_FLAT_QUARTER_TURN_3_TILES_NW_SW_PART_0,
SPR_TRACK_SUBMARINE_RIDE_MINI_HELICOPTERS_FLAT_QUARTER_TURN_3_TILES_NW_SW_PART_1,
SPR_TRACK_SUBMARINE_RIDE_MINI_HELICOPTERS_FLAT_QUARTER_TURN_3_TILES_NW_SW_PART_2
}, {
SPR_TRACK_SUBMARINE_RIDE_MINI_HELICOPTERS_FLAT_QUARTER_TURN_3_TILES_NE_NW_PART_0,
SPR_TRACK_SUBMARINE_RIDE_MINI_HELICOPTERS_FLAT_QUARTER_TURN_3_TILES_NE_NW_PART_1,
SPR_TRACK_SUBMARINE_RIDE_MINI_HELICOPTERS_FLAT_QUARTER_TURN_3_TILES_NE_NW_PART_2
}, {
SPR_TRACK_SUBMARINE_RIDE_MINI_HELICOPTERS_FLAT_QUARTER_TURN_3_TILES_SE_NE_PART_0,
SPR_TRACK_SUBMARINE_RIDE_MINI_HELICOPTERS_FLAT_QUARTER_TURN_3_TILES_SE_NE_PART_1,
SPR_TRACK_SUBMARINE_RIDE_MINI_HELICOPTERS_FLAT_QUARTER_TURN_3_TILES_SE_NE_PART_2
}
};
const uint32 trackSpritesSubmarineRideMiniHelicoptersQuarterTurn1Tile[4] = {
SPR_TRACK_SUBMARINE_RIDE_MINI_HELICOPTERS_FLAT_QUARTER_TURN_1_TILE_SW_NW,
SPR_TRACK_SUBMARINE_RIDE_MINI_HELICOPTERS_FLAT_QUARTER_TURN_1_TILE_NW_NE,
SPR_TRACK_SUBMARINE_RIDE_MINI_HELICOPTERS_FLAT_QUARTER_TURN_1_TILE_NE_SE,
SPR_TRACK_SUBMARINE_RIDE_MINI_HELICOPTERS_FLAT_QUARTER_TURN_1_TILE_SE_SW,
};
enum
{
SPR_STATION_COVER_OFFSET_NE_SW_BACK_0 = 0,
@@ -275,6 +302,18 @@ bool track_paint_util_draw_station_covers(enum edge edge, bool hasFence, const r
return true;
}
void track_paint_util_paint_left_quarter_turn_1_tile(sint16 height, int direction, uint32 colourFlags, const uint32 * sprites, uint8 rotation)
{
uint32 imageId = sprites[direction] | colourFlags;
switch (direction) {
case 0: sub_98197C(imageId, 0, 0, 26, 24, 1, height, 6, 2, height, rotation); break;
case 1: sub_98197C(imageId, 0, 0, 26, 26, 1, height, 0, 0, height, rotation); break;
case 2: sub_98197C(imageId, 0, 0, 24, 26, 1, height, 2, 6, height, rotation); break;
case 3: sub_98197C(imageId, 0, 0, 24, 24, 1, height, 6, 6, height, rotation); break;
}
}
/**
*
* rct2: 0x006C4794

View File

@@ -84,8 +84,33 @@ enum {
SPR_FENCE_ROPE_SW = 22140,
SPR_FENCE_ROPE_NW = 22141,
SPR_STATION_PLATFORM_SW_NE = 22362,
SPR_STATION_PLATFORM_NW_SE = 22363,
SPR_STATION_PLATFORM_FENCED_SW_NE = 22364,
SPR_STATION_PLATFORM_FENCED_NW_SE = 22365,
SPR_STATION_PLATFORM_BEGIN_FENCED_SW_NE = 22366,
SPR_STATION_PLATFORM_BEGIN_FENCED_NW_SE = 22367,
SPR_STATION_PLATFORM_BEGIN_SW_NE = 22368,
SPR_STATION_PLATFORM_BEGIN_NW_SE = 22369,
SPR_STATION_FENCE_SW_NE = 22370,
SPR_STATION_FENCE_NW_SE = 22371,
SPR_STATION_BEGIN_ANGLE_FENCE_SW_NE = 22372,
SPR_STATION_BEGIN_ANGLE_FENCE_NW_SE = 22373,
SPR_STATION_FENCE_SMALL_NW_SE = 22374,
SPR_STATION_FENCE_SMALL_SW_NE = 22375,
SPR_STATION_PLATFORM_FENCED_END_RED_LIGHT_SW_NE = 22380,
SPR_STATION_PLATFORM_FENCED_END_RED_LIGHT_NW_SE = 22381,
SPR_STATION_PLATFORM_FENCED_END_GREEN_LIGHT_SW_NE = 22382,
SPR_STATION_PLATFORM_FENCED_END_GREEN_LIGHT_NW_SE = 22383,
SPR_STATION_LIGHT_BACK_NE_SW = 22384,
SPR_STATION_LIGHT_BACK_NW_SE = 22385,
SPR_STATION_LIGHT_BACK_ANGLE_FENCED_NE_SW = 22386,
SPR_STATION_LIGHT_BACK_ANGLE_FENCED_NW_SE = 22387,
SPR_STATION_PLATFORM_END_RED_LIGHT_SW_NE = 22388,
SPR_STATION_PLATFORM_END_RED_LIGHT_NW_SE = 22389,
SPR_STATION_PLATFORM_END_GREEN_LIGHT_SW_NE = 22390,
SPR_STATION_PLATFORM_END_GREEN_LIGHT_NW_SE = 22391,
SPR_STATION_PIER_EDGE_SE = 22404,
SPR_STATION_PIER_EDGE_SW = 22405,
@@ -102,6 +127,9 @@ enum {
SPR_STATION_NARROW_EDGE_NW = 22416,
SPR_STATION_NARROW_EDGE_NE = 22417,
SPR_STATION_BASE_B_SW_NE = 22428,
SPR_STATION_BASE_B_NW_SE = 22429,
SPR_ON_RIDE_PHOTO_CAMERA_N = 25615,
SPR_ON_RIDE_PHOTO_CAMERA_E = 25616,
SPR_ON_RIDE_PHOTO_CAMERA_S = 25617,
@@ -121,12 +149,17 @@ extern const uint32 floorSpritesCork[];
extern const uint32 fenceSpritesRope[];
extern const uint32 fenceSpritesMetalB[];
extern const uint32 trackSpritesSubmarineRideMiniHelicoptersQuarterTurn3Tiles[4][3];
extern const uint32 trackSpritesSubmarineRideMiniHelicoptersQuarterTurn1Tile[4];
bool track_paint_util_has_fence(enum edge edge, rct_xy16 position, rct_map_element * mapElement, rct_ride * ride, uint8 rotation);
void track_paint_util_paint_floor(uint8 edges, uint32 colourFlags, uint16 height, const uint32 floorSprites[4], uint8 rotation);
void track_paint_util_paint_fences(uint8 edges, rct_xy16 position, rct_map_element * mapElement, rct_ride * ride, uint32 colourFlags, uint16 height, const uint32 fenceSprites[4], uint8 rotation);
bool track_paint_util_draw_station_covers(enum edge edge, bool hasFence, const rct_ride_entrance_definition * entranceStyle, uint8 direction, uint16 height);
bool track_paint_util_should_paint_supports(rct_xy16 position);
void track_paint_util_paint_left_quarter_turn_1_tile(sint16 height, int direction, uint32 colourFlags, const uint32 * sprites, uint8 rotation);
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);

View File

@@ -306,29 +306,18 @@ static void submarine_ride_paint_track_right_quarter_turn_3_tiles(uint8 rideInde
static void submarine_ride_paint_track_left_quarter_turn_1_tile(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element * mapElement)
{
int heightLower = height - 16;
uint32 imageId;
track_paint_util_paint_left_quarter_turn_1_tile(height - 16, direction, RCT2_GLOBAL(0x00F44198, uint32), trackSpritesSubmarineRideMiniHelicoptersQuarterTurn1Tile, get_current_rotation());
switch (direction) {
case 0:
imageId = SPR_TRACK_SUBMARINE_RIDE_MINI_HELICOPTERS_FLAT_QUARTER_TURN_1_TILE_SW_NW | RCT2_GLOBAL(0x00F44198, uint32);
sub_98197C(imageId, 0, 0, 26, 24, 1, heightLower, 6, 2, heightLower, get_current_rotation());
paint_util_push_tunnel_left(heightLower, TUNNEL_0);
break;
case 1:
imageId = SPR_TRACK_SUBMARINE_RIDE_MINI_HELICOPTERS_FLAT_QUARTER_TURN_1_TILE_NW_NE | RCT2_GLOBAL(0x00F44198, uint32);
sub_98197C(imageId, 0, 0, 26, 26, 1, heightLower, 0, 0, heightLower, get_current_rotation());
paint_util_push_tunnel_left(height - 16, TUNNEL_0);
break;
case 2:
imageId = SPR_TRACK_SUBMARINE_RIDE_MINI_HELICOPTERS_FLAT_QUARTER_TURN_1_TILE_NE_SE | RCT2_GLOBAL(0x00F44198, uint32);
sub_98197C(imageId, 0, 0, 24, 26, 1, heightLower, 2, 6, heightLower, get_current_rotation());
paint_util_push_tunnel_right(heightLower, TUNNEL_0);
paint_util_push_tunnel_right(height - 16, TUNNEL_0);
break;
case 3:
imageId = SPR_TRACK_SUBMARINE_RIDE_MINI_HELICOPTERS_FLAT_QUARTER_TURN_1_TILE_SE_SW | RCT2_GLOBAL(0x00F44198, uint32);
sub_98197C(imageId, 0, 0, 24, 24, 1, heightLower, 6, 6, heightLower, get_current_rotation());
paint_util_push_tunnel_right(heightLower, TUNNEL_0);
paint_util_push_tunnel_left(heightLower, TUNNEL_0);
paint_util_push_tunnel_right(height - 16, TUNNEL_0);
paint_util_push_tunnel_left(height - 16, TUNNEL_0);
break;
}