mirror of https://github.com/OpenRCT2/OpenRCT2.git
Merge pull request #1418 from duncanspumpkin/viewport_refactor
Viewport refactor and further implementation
This commit is contained in:
commit
2c762e97f1
|
@ -55,6 +55,10 @@
|
|||
|
||||
#define RCT2_ADDRESS_EASTEREGG_NAMES 0x00988C20
|
||||
|
||||
// An array of pointers to the start of a way to
|
||||
// translate between scroll positions for drawing
|
||||
#define RCT2_ADDRESS_SCROLLING_MODE_POSITIONS 0x00992FB8
|
||||
|
||||
#define RCT2_ADDRESS_RIDE_PROPERTIES 0x00997C9D
|
||||
#define RCT2_ADDRESS_LAND_TOOL_SIZE 0x009A9800
|
||||
#define RCT2_ADDRESS_SAVE_PROMPT_MODE 0x009A9802
|
||||
|
@ -158,6 +162,10 @@
|
|||
|
||||
#define RCT2_ADDRESS_VEHICLE_SOUND_LIST 0x009AF288
|
||||
|
||||
#define RCT2_ADDRESS_DRAW_SCROLL_LIST 0x009C3840
|
||||
|
||||
#define RCT2_ADDRESS_DRAW_SCROLL_NEXT_ID 0x009D7A80
|
||||
|
||||
#define RCT2_ADDRESS_INPUT_FLAGS 0x009DE518
|
||||
#define RCT2_ADDRESS_CURENT_CURSOR 0x009DE51C
|
||||
#define RCT2_ADDRESS_INPUT_STATE 0x009DE51D
|
||||
|
@ -193,6 +201,9 @@
|
|||
#define RCT2_ADDRESS_CURSOR_OVER_WINDOWNUMBER 0x009DE55E
|
||||
#define RCT2_ADDRESS_CURSOR_OVER_WIDGETINDEX 0x009DE560
|
||||
|
||||
// Of type viewport interaction
|
||||
#define RCT2_ADDRESS_PAINT_SETUP_CURRENT_TYPE 0x009DE570
|
||||
|
||||
#define RCT2_ADDRESS_PALETTE_EFFECT_FRAME_NO 0x009DE584
|
||||
|
||||
// Flags:
|
||||
|
@ -304,6 +315,11 @@
|
|||
|
||||
#define RCT2_ADDRESS_STAFF_HIGHLIGHTED_INDEX 0x00F43908
|
||||
|
||||
// Each character is painted onto a drawing surface
|
||||
// any coloured pixels are marked in this bitmap
|
||||
// 8 x 8 in size.
|
||||
#define RCT2_ADDRESS_CHARACTER_BITMAP 0x00F4393C
|
||||
|
||||
#define RCT2_ADDRESS_TRACK_PREVIEW_ROTATION 0x00F440AE
|
||||
|
||||
#define RCT2_ADDRESS_TRACK_PREVIEW_X_MIN 0x00F440F9
|
||||
|
|
|
@ -57,6 +57,17 @@ enum{
|
|||
IMAGE_TYPE_UNKNOWN = (1<<3)
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
uint32 num_entries;
|
||||
uint32 total_size;
|
||||
} rct_g1_header;
|
||||
|
||||
typedef struct {
|
||||
rct_g1_header header;
|
||||
rct_g1_element *elements;
|
||||
void *data;
|
||||
} rct_gx;
|
||||
|
||||
extern const uint16 palette_to_g1_offset[];
|
||||
extern const uint8 peep_palette[];
|
||||
extern uint8 text_palette[];
|
||||
|
@ -65,6 +76,7 @@ extern int gLastDrawStringX;
|
|||
extern int gLastDrawStringY;
|
||||
|
||||
extern rct_g1_element *g1Elements;
|
||||
extern rct_gx g2;
|
||||
|
||||
//
|
||||
rct_drawpixelinfo* clip_drawpixelinfo(rct_drawpixelinfo* dpi, int left, int width, int top, int height);
|
||||
|
|
|
@ -25,19 +25,8 @@
|
|||
#include "../platform/platform.h"
|
||||
#include "../openrct2.h"
|
||||
|
||||
typedef struct {
|
||||
uint32 num_entries;
|
||||
uint32 total_size;
|
||||
} rct_g1_header;
|
||||
|
||||
void *_g1Buffer = NULL;
|
||||
|
||||
typedef struct {
|
||||
rct_g1_header header;
|
||||
rct_g1_element *elements;
|
||||
void *data;
|
||||
} rct_gx;
|
||||
|
||||
rct_gx g2;
|
||||
|
||||
rct_g1_element *g1Elements = (rct_g1_element*)RCT2_ADDRESS_G1_ELEMENTS;
|
||||
|
|
|
@ -69,7 +69,7 @@ void gfx_load_character_widths(){
|
|||
val |= 0x80;
|
||||
}
|
||||
}
|
||||
RCT2_ADDRESS(0xF4393C, uint8)[i * 8 + x] = val;
|
||||
RCT2_ADDRESS(RCT2_ADDRESS_CHARACTER_BITMAP, uint8)[i * 8 + x] = val;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -56,7 +56,8 @@ enum {
|
|||
VIEWPORT_INTERACTION_ITEM_PARK,
|
||||
VIEWPORT_INTERACTION_ITEM_WALL,
|
||||
VIEWPORT_INTERACTION_ITEM_LARGE_SCENERY,
|
||||
VIEWPORT_INTERACTION_ITEM_BANNER = 12,
|
||||
VIEWPORT_INTERACTION_ITEM_LABEL,
|
||||
VIEWPORT_INTERACTION_ITEM_BANNER,
|
||||
|
||||
};
|
||||
|
||||
|
|
|
@ -1270,6 +1270,12 @@ void window_scroll_to_viewport(rct_window *w)
|
|||
*/
|
||||
void window_scroll_to_location(rct_window *w, int x, int y, int z)
|
||||
{
|
||||
rct_xyz16 location_3d = {
|
||||
.x = x,
|
||||
.y = y,
|
||||
.z = z
|
||||
};
|
||||
|
||||
if (w->viewport) {
|
||||
sint16 height = map_element_height(x, y);
|
||||
if (z < height - 16) {
|
||||
|
@ -1283,26 +1289,9 @@ void window_scroll_to_location(rct_window *w, int x, int y, int z)
|
|||
window_invalidate(w);
|
||||
}
|
||||
}
|
||||
sint16 sx;
|
||||
sint16 sy;
|
||||
switch (RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_ROTATION, uint8)) {
|
||||
case 0:
|
||||
sx = y - x;
|
||||
sy = ((x + y) / 2) - z;
|
||||
break;
|
||||
case 1:
|
||||
sx = -y - x;
|
||||
sy = ((-x + y) / 2) - z;
|
||||
break;
|
||||
case 2:
|
||||
sx = -y + x;
|
||||
sy = ((-x - y) / 2) - z;
|
||||
break;
|
||||
case 3:
|
||||
sx = y + x;
|
||||
sy = ((x - y) / 2) - z;
|
||||
break;
|
||||
}
|
||||
|
||||
rct_xy16 map_coordinate = coordinate_3d_to_2d(&location_3d, RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_ROTATION, uint8));
|
||||
|
||||
int i = 0;
|
||||
if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & SCREEN_FLAGS_TITLE_DEMO)) {
|
||||
int found = 0;
|
||||
|
@ -1336,8 +1325,8 @@ void window_scroll_to_location(rct_window *w, int x, int y, int z)
|
|||
// rct2: 0x006E7C76
|
||||
if (w->viewport_target_sprite == -1) {
|
||||
if (!(w->flags & WF_2)) {
|
||||
w->saved_view_x = sx - (sint16)(w->viewport->view_width * window_scroll_locations[i][0]);
|
||||
w->saved_view_y = sy - (sint16)(w->viewport->view_height * window_scroll_locations[i][1]);
|
||||
w->saved_view_x = map_coordinate.x - (sint16)(w->viewport->view_width * window_scroll_locations[i][0]);
|
||||
w->saved_view_y = map_coordinate.y - (sint16)(w->viewport->view_height * window_scroll_locations[i][1]);
|
||||
w->flags |= WF_SCROLLING_TO_LOCATION;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -324,6 +324,9 @@ enum {
|
|||
STR_OPTIONS_TITLE = 1168,
|
||||
STR_SOUND_NONE = 1169,
|
||||
|
||||
STR_RIDE_ENTRANCE_CLOSED = 1171,
|
||||
STR_RIDE_ENTRANCE_NAME = 1172,
|
||||
|
||||
STR_BUILD_FOOTPATH_TIP = 1173,
|
||||
|
||||
STR_BANNER_SIGN_IN_THE_WAY = 1174,
|
||||
|
@ -518,6 +521,8 @@ enum {
|
|||
STR_CANT_OPEN_PARK = 1723,
|
||||
STR_CANT_CLOSE_PARK = 1724,
|
||||
|
||||
STR_BANNER_TEXT = 1731,
|
||||
|
||||
STR_NUMBER_OF_LAPS = 1734,
|
||||
STR_NUMBER_OF_LAPS_TIP = 1735,
|
||||
|
||||
|
@ -1146,6 +1151,7 @@ enum {
|
|||
STR_MUSIC_ACKNOWLEDGEMENTS = 2863,
|
||||
|
||||
STR_TOO_MANY_BANNERS_IN_GAME = 2980,
|
||||
STR_NO_ENTRY = 2981,
|
||||
|
||||
STR_CHANGE_BANNER_TEXT_TIP = 2986,
|
||||
STR_SET_AS_NO_ENTRY_BANNER_TIP = 2987,
|
||||
|
|
|
@ -26,8 +26,8 @@
|
|||
typedef struct {
|
||||
rct_string_id string_idx; // 0x00
|
||||
uint32 image_id; // 0x02
|
||||
uint8 var_06;
|
||||
uint8 var_07;
|
||||
uint8 scrolling_mode; // 0x06
|
||||
uint8 text_height; // 0x07
|
||||
} rct_entrance_type;
|
||||
|
||||
#endif
|
|
@ -87,6 +87,30 @@ void rotate_map_coordinates(sint16* x, sint16* y, uint8 rotation){
|
|||
}
|
||||
}
|
||||
|
||||
rct_xy16 coordinate_3d_to_2d(const rct_xyz16* coordinate_3d, uint8 rotation){
|
||||
rct_xy16 coordinate_2d;
|
||||
|
||||
switch (rotation){
|
||||
case 0:
|
||||
coordinate_2d.x = coordinate_3d->y - coordinate_3d->x;
|
||||
coordinate_2d.y = (coordinate_3d->y + coordinate_3d->x) / 2 - coordinate_3d->z;
|
||||
break;
|
||||
case 1:
|
||||
coordinate_2d.x = -coordinate_3d->y - coordinate_3d->x;
|
||||
coordinate_2d.y = (coordinate_3d->y - coordinate_3d->x) / 2 - coordinate_3d->z;
|
||||
break;
|
||||
case 2:
|
||||
coordinate_2d.x = -coordinate_3d->y + coordinate_3d->x;
|
||||
coordinate_2d.y = (-coordinate_3d->y - coordinate_3d->x) / 2 - coordinate_3d->z;
|
||||
break;
|
||||
case 3:
|
||||
coordinate_2d.x = coordinate_3d->y + coordinate_3d->x;
|
||||
coordinate_2d.y = (-coordinate_3d->y + coordinate_3d->x) / 2 - coordinate_3d->z;
|
||||
break;
|
||||
}
|
||||
return coordinate_2d;
|
||||
}
|
||||
|
||||
void map_element_iterator_begin(map_element_iterator *it)
|
||||
{
|
||||
it->x = 0;
|
||||
|
@ -904,6 +928,7 @@ void game_command_set_scenery_colour(int* eax, int* ebx, int* ecx, int* edx, int
|
|||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if((*ebx & 0x40) && !(map_element->flags & MAP_ELEMENT_FLAG_GHOST)){
|
||||
*ebx = 0;
|
||||
return;
|
||||
|
|
|
@ -283,6 +283,7 @@ rct_map_element *map_element_insert(int x, int y, int z, int flags);
|
|||
int map_can_construct_with_clear_at(int x, int y, int zLow, int zHigh, void *clearFunc, uint8 bl);
|
||||
int map_can_construct_at(int x, int y, int zLow, int zHigh, uint8 bl);
|
||||
void rotate_map_coordinates(sint16* x, sint16* y, uint8 rotation);
|
||||
rct_xy16 coordinate_3d_to_2d(const rct_xyz16* coordinate_3d, uint8 rotation);
|
||||
money32 map_clear_scenery(int x0, int y0, int x1, int y1, int flags);
|
||||
money32 lower_water(sint16 x0, sint16 y0, sint16 x1, sint16 y1, uint8 flags);
|
||||
money32 raise_water(sint16 x0, sint16 y0, sint16 x1, sint16 y1, uint8 flags);
|
||||
|
|
|
@ -115,7 +115,7 @@ typedef struct {
|
|||
} rct_path_bit_scenery_entry;
|
||||
|
||||
typedef struct {
|
||||
uint8 var_06;
|
||||
uint8 scrolling_mode; // 0x06
|
||||
uint8 flags; // 0x07
|
||||
sint16 price; // 0x08
|
||||
uint8 scenery_tab_id; // 0x0A
|
||||
|
|
|
@ -79,7 +79,7 @@ typedef struct {
|
|||
|
||||
typedef struct {
|
||||
uint8 sprite_identifier; // 0x00
|
||||
uint8 var_01; // 0x01
|
||||
uint8 type; // 0x01
|
||||
uint16 next_in_quadrant; // 0x02
|
||||
uint16 next; // 0x04
|
||||
uint16 previous; // 0x06
|
||||
|
|
Loading…
Reference in New Issue