2014-04-03 04:08:06 +02:00
|
|
|
/*****************************************************************************
|
|
|
|
* Copyright (c) 2014 Ted John
|
|
|
|
* OpenRCT2, an open source clone of Roller Coaster Tycoon 2.
|
2015-10-20 20:16:30 +02:00
|
|
|
*
|
2014-04-03 04:08:06 +02:00
|
|
|
* This file is part of OpenRCT2.
|
2015-10-20 20:16:30 +02:00
|
|
|
*
|
2014-04-03 04:08:06 +02:00
|
|
|
* OpenRCT2 is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*****************************************************************************/
|
|
|
|
|
|
|
|
#ifndef _VIEWPORT_H_
|
|
|
|
#define _VIEWPORT_H_
|
|
|
|
|
2014-11-10 01:40:59 +01:00
|
|
|
#include "../world/map.h"
|
|
|
|
#include "../world/sprite.h"
|
2014-04-08 18:52:39 +02:00
|
|
|
#include "window.h"
|
|
|
|
|
2014-04-11 03:42:39 +02:00
|
|
|
enum {
|
|
|
|
VIEWPORT_FLAG_UNDERGROUND_INSIDE = (1 << 0),
|
|
|
|
VIEWPORT_FLAG_SEETHROUGH_RIDES = (1 << 1),
|
|
|
|
VIEWPORT_FLAG_SEETHROUGH_SCENERY = (1 << 2),
|
|
|
|
VIEWPORT_FLAG_INVISIBLE_SUPPORTS = (1 << 3),
|
|
|
|
VIEWPORT_FLAG_LAND_HEIGHTS = (1 << 4),
|
|
|
|
VIEWPORT_FLAG_TRACK_HEIGHTS = (1 << 5),
|
|
|
|
VIEWPORT_FLAG_PATH_HEIGHTS = (1 << 6),
|
|
|
|
VIEWPORT_FLAG_GRIDLINES = (1 << 7),
|
|
|
|
VIEWPORT_FLAG_LAND_OWNERSHIP = (1 << 8),
|
2014-04-17 16:12:41 +02:00
|
|
|
VIEWPORT_FLAG_CONSTRUCTION_RIGHTS = (1 << 9),
|
2014-04-16 03:05:49 +02:00
|
|
|
VIEWPORT_FLAG_SOUND_ON = (1 << 10),
|
2014-04-11 03:42:39 +02:00
|
|
|
VIEWPORT_FLAG_INVISIBLE_PEEPS = (1 << 11),
|
|
|
|
VIEWPORT_FLAG_HIDE_BASE = (1 << 12),
|
|
|
|
VIEWPORT_FLAG_HIDE_VERTICAL = (1 << 13),
|
|
|
|
VIEWPORT_FLAG_INVISIBLE_SPRITES = (1 << 14),
|
|
|
|
VIEWPORT_FLAG_15 = (1 << 15)
|
|
|
|
};
|
|
|
|
|
2014-11-05 20:42:19 +01:00
|
|
|
enum {
|
|
|
|
VIEWPORT_INTERACTION_ITEM_NONE,
|
2015-04-16 20:09:07 +02:00
|
|
|
VIEWPORT_INTERACTION_ITEM_TERRAIN,
|
|
|
|
VIEWPORT_INTERACTION_ITEM_SPRITE,
|
2014-11-10 01:40:59 +01:00
|
|
|
VIEWPORT_INTERACTION_ITEM_RIDE,
|
2015-04-16 20:09:07 +02:00
|
|
|
VIEWPORT_INTERACTION_ITEM_WATER,
|
|
|
|
VIEWPORT_INTERACTION_ITEM_SCENERY,
|
2014-11-05 20:42:19 +01:00
|
|
|
VIEWPORT_INTERACTION_ITEM_FOOTPATH,
|
|
|
|
VIEWPORT_INTERACTION_ITEM_FOOTPATH_ITEM,
|
2014-11-10 01:40:59 +01:00
|
|
|
VIEWPORT_INTERACTION_ITEM_PARK,
|
2014-11-05 20:42:19 +01:00
|
|
|
VIEWPORT_INTERACTION_ITEM_WALL,
|
|
|
|
VIEWPORT_INTERACTION_ITEM_LARGE_SCENERY,
|
2015-06-08 19:52:47 +02:00
|
|
|
VIEWPORT_INTERACTION_ITEM_LABEL,
|
|
|
|
VIEWPORT_INTERACTION_ITEM_BANNER,
|
2014-11-05 20:42:19 +01:00
|
|
|
|
|
|
|
};
|
2014-08-06 18:18:42 +02:00
|
|
|
|
2015-04-16 20:09:07 +02:00
|
|
|
enum {
|
|
|
|
VIEWPORT_INTERACTION_MASK_NONE = 0,
|
|
|
|
VIEWPORT_INTERACTION_MASK_TERRAIN = ~(1 << (VIEWPORT_INTERACTION_ITEM_TERRAIN - 1)),
|
|
|
|
VIEWPORT_INTERACTION_MASK_SPRITE = ~(1 << (VIEWPORT_INTERACTION_ITEM_SPRITE - 1)),
|
|
|
|
VIEWPORT_INTERACTION_MASK_RIDE = ~(1 << (VIEWPORT_INTERACTION_ITEM_RIDE - 1)),
|
|
|
|
VIEWPORT_INTERACTION_MASK_WATER = ~(1 << (VIEWPORT_INTERACTION_ITEM_WATER - 1)),
|
|
|
|
VIEWPORT_INTERACTION_MASK_SCENERY = ~(1 << (VIEWPORT_INTERACTION_ITEM_SCENERY - 1)),
|
|
|
|
VIEWPORT_INTERACTION_MASK_FOOTPATH = ~(1 << (VIEWPORT_INTERACTION_ITEM_FOOTPATH - 1)),
|
|
|
|
VIEWPORT_INTERACTION_MASK_FOOTPATH_ITEM = ~(1 << (VIEWPORT_INTERACTION_ITEM_FOOTPATH_ITEM - 1)),
|
|
|
|
VIEWPORT_INTERACTION_MASK_PARK = ~(1 << (VIEWPORT_INTERACTION_ITEM_PARK - 1)),
|
|
|
|
VIEWPORT_INTERACTION_MASK_WALL = ~(1 << (VIEWPORT_INTERACTION_ITEM_WALL - 1)),
|
|
|
|
VIEWPORT_INTERACTION_MASK_LARGE_SCENERY = ~(1 << (VIEWPORT_INTERACTION_ITEM_LARGE_SCENERY - 1)),
|
2015-05-05 20:11:35 +02:00
|
|
|
VIEWPORT_INTERACTION_MASK_BANNER = ~(1 << (VIEWPORT_INTERACTION_ITEM_BANNER - 2)), // Note the -2 for BANNER
|
2015-04-16 20:09:07 +02:00
|
|
|
};
|
|
|
|
|
2014-11-10 01:40:59 +01:00
|
|
|
typedef struct {
|
|
|
|
int type;
|
|
|
|
int x;
|
|
|
|
int y;
|
|
|
|
union {
|
|
|
|
rct_map_element *mapElement;
|
|
|
|
rct_sprite *sprite;
|
|
|
|
rct_peep *peep;
|
|
|
|
rct_vehicle *vehicle;
|
|
|
|
};
|
|
|
|
} viewport_interaction_info;
|
|
|
|
|
2014-07-11 20:00:26 +02:00
|
|
|
// rct2: 0x014234BC
|
|
|
|
extern rct_viewport* g_viewport_list;
|
|
|
|
|
2014-04-03 04:08:06 +02:00
|
|
|
void viewport_init_all();
|
2014-09-04 21:09:54 +02:00
|
|
|
void center_2d_coordinates(int x, int y, int z, int* out_x, int* out_y, rct_viewport* viewport);
|
2014-07-23 19:29:52 +02:00
|
|
|
void viewport_create(rct_window *w, int x, int y, int width, int height, int zoom, int center_x, int center_y, int center_z, char flags, sint16 sprite);
|
2014-04-08 18:52:39 +02:00
|
|
|
void viewport_update_pointers();
|
|
|
|
void viewport_update_position(rct_window *window);
|
2015-07-09 19:00:46 +02:00
|
|
|
void viewport_update_sprite_follow(rct_window *window);
|
2014-04-17 04:19:30 +02:00
|
|
|
void viewport_render(rct_drawpixelinfo *dpi, rct_viewport *viewport, int left, int top, int right, int bottom);
|
2015-02-05 22:15:56 +01:00
|
|
|
void viewport_paint(rct_viewport* viewport, rct_drawpixelinfo* dpi, int left, int top, int right, int bottom);
|
2014-04-03 04:08:06 +02:00
|
|
|
|
2015-04-03 21:11:03 +02:00
|
|
|
void sub_689174(sint16* x, sint16* y, sint16 *z);
|
2014-09-04 21:09:54 +02:00
|
|
|
|
2015-04-03 21:11:03 +02:00
|
|
|
rct_xy16 screen_coord_to_viewport_coord(rct_viewport *viewport, uint16 x, uint16 y);
|
|
|
|
rct_xy16 viewport_coord_to_map_coord(int x, int y, int z);
|
2015-04-04 14:39:46 +02:00
|
|
|
void screen_pos_to_map_pos(sint16 *x, sint16 *y, int *direction);
|
2014-04-17 16:12:41 +02:00
|
|
|
|
|
|
|
void show_gridlines();
|
|
|
|
void hide_gridlines();
|
|
|
|
void show_land_rights();
|
|
|
|
void hide_land_rights();
|
|
|
|
void show_construction_rights();
|
|
|
|
void hide_construction_rights();
|
2014-09-02 19:10:49 +02:00
|
|
|
void viewport_set_visibility(uint8 mode);
|
2014-04-17 16:12:41 +02:00
|
|
|
|
2015-05-27 19:05:57 +02:00
|
|
|
void get_map_coordinates_from_pos(int screenX, int screenY, int flags, sint16 *x, sint16 *y, int *interactionType, rct_map_element **mapElement, rct_viewport **viewport);
|
2014-10-01 03:03:36 +02:00
|
|
|
|
2014-11-10 01:40:59 +01:00
|
|
|
int viewport_interaction_get_item_left(int x, int y, viewport_interaction_info *info);
|
2014-11-05 21:28:51 +01:00
|
|
|
int viewport_interaction_left_over(int x, int y);
|
|
|
|
int viewport_interaction_left_click(int x, int y);
|
2014-11-15 19:22:06 +01:00
|
|
|
int viewport_interaction_get_item_right(int x, int y, viewport_interaction_info *info);
|
2014-11-05 21:28:51 +01:00
|
|
|
int viewport_interaction_right_over(int x, int y);
|
|
|
|
int viewport_interaction_right_click(int x, int y);
|
2015-04-21 19:19:11 +02:00
|
|
|
void sub_68A15E(int screenX, int screenY, short *x, short *y, int *direction, rct_map_element **mapElement);
|
2014-11-05 20:42:19 +01:00
|
|
|
|
2015-06-20 17:24:38 +02:00
|
|
|
void viewport_interaction_remove_park_entrance(rct_map_element *mapElement, int x, int y);
|
|
|
|
|
2015-07-17 17:00:21 +02:00
|
|
|
void sub_68B2B7(int x, int y);
|
2015-07-23 19:45:48 +02:00
|
|
|
void painter_setup();
|
2015-06-27 16:17:54 +02:00
|
|
|
void sub_688485();
|
|
|
|
void sub_688217();
|
|
|
|
|
2015-07-06 19:57:36 +02:00
|
|
|
void viewport_invalidate(rct_viewport *viewport, int left, int top, int right, int bottom);
|
|
|
|
|
2015-07-11 19:23:59 +02:00
|
|
|
void screen_get_map_xy(int screenX, int screenY, sint16 *x, sint16 *y, rct_viewport **viewport);
|
|
|
|
void screen_get_map_xy_with_z(sint16 screenX, sint16 screenY, sint16 z, sint16 *mapX, sint16 *mapY);
|
|
|
|
void screen_get_map_xy_quadrant(sint16 screenX, sint16 screenY, sint16 *mapX, sint16 *mapY, uint8 *quadrant);
|
|
|
|
void screen_get_map_xy_quadrant_with_z(sint16 screenX, sint16 screenY, sint16 z, sint16 *mapX, sint16 *mapY, uint8 *quadrant);
|
|
|
|
void screen_get_map_xy_side(sint16 screenX, sint16 screenY, sint16 *mapX, sint16 *mapY, uint8 *side);
|
|
|
|
void screen_get_map_xy_side_with_z(sint16 screenX, sint16 screenY, sint16 z, sint16 *mapX, sint16 *mapY, uint8 *side);
|
2015-07-10 15:54:02 +02:00
|
|
|
|
2014-04-21 11:27:48 +02:00
|
|
|
#endif
|