mirror of
https://github.com/OpenRCT2/OpenRCT2.git
synced 2025-01-24 11:22:02 -05:00
Merge pull request #5705 from Broxzier/hardcoded-values
Replace -1 with SPR_NONE for viewport sprite, sort some includes
This commit is contained in:
commit
fd2eda921f
11 changed files with 21 additions and 22 deletions
|
@ -14,36 +14,36 @@
|
|||
*****************************************************************************/
|
||||
#pragma endregion
|
||||
|
||||
#include "rct2/addresses.h"
|
||||
#include "audio/audio.h"
|
||||
#include "drawing/drawing.h"
|
||||
#include "editor.h"
|
||||
#include "game.h"
|
||||
#include "interface/window.h"
|
||||
#include "interface/viewport.h"
|
||||
#include "interface/window.h"
|
||||
#include "localisation/date.h"
|
||||
#include "localisation/localisation.h"
|
||||
#include "management/finance.h"
|
||||
#include "management/news_item.h"
|
||||
#include "network/network.h"
|
||||
#include "object.h"
|
||||
#include "object/ObjectManager.h"
|
||||
#include "peep/staff.h"
|
||||
#include "platform/platform.h"
|
||||
#include "rct1.h"
|
||||
#include "rct2/addresses.h"
|
||||
#include "ride/ride.h"
|
||||
#include "ParkImporter.h"
|
||||
#include "scenario/scenario.h"
|
||||
#include "util/sawyercoding.h"
|
||||
#include "util/util.h"
|
||||
#include "world/banner.h"
|
||||
#include "world/Climate.h"
|
||||
#include "world/footpath.h"
|
||||
#include "world/banner.h"
|
||||
#include "world/entrance.h"
|
||||
#include "world/footpath.h"
|
||||
#include "world/map.h"
|
||||
#include "world/park.h"
|
||||
#include "world/scenery.h"
|
||||
#include "world/sprite.h"
|
||||
#include "network/network.h"
|
||||
|
||||
uint8 _editorSelectedRides[128];
|
||||
uint8 _editorSelectedSmallScenery[252];
|
||||
|
@ -411,7 +411,7 @@ static void editor_finalise_main_view()
|
|||
rct_window *w = window_get_main();
|
||||
rct_viewport *viewport = w->viewport;
|
||||
|
||||
w->viewport_target_sprite = -1;
|
||||
w->viewport_target_sprite = SPRITE_INDEX_NULL;
|
||||
w->saved_view_x = gSavedViewX;
|
||||
w->saved_view_y = gSavedViewY;
|
||||
gCurrentRotation = gSavedViewRotation;
|
||||
|
|
|
@ -1154,7 +1154,7 @@ void game_load_init()
|
|||
game_create_windows();
|
||||
mainWindow = window_get_main();
|
||||
|
||||
mainWindow->viewport_target_sprite = -1;
|
||||
mainWindow->viewport_target_sprite = SPRITE_INDEX_NULL;
|
||||
mainWindow->saved_view_x = gSavedViewX;
|
||||
mainWindow->saved_view_y = gSavedViewY;
|
||||
uint8 zoomDifference = gSavedViewZoom - mainWindow->viewport->zoom;
|
||||
|
|
|
@ -26,7 +26,6 @@
|
|||
#include "../rct2.h"
|
||||
#include "../ride/ride_data.h"
|
||||
#include "../ride/track_data.h"
|
||||
#include "../sprites.h"
|
||||
#include "../world/banner.h"
|
||||
#include "../world/Climate.h"
|
||||
#include "../world/entrance.h"
|
||||
|
@ -193,7 +192,7 @@ void viewport_create(rct_window *w, sint32 x, sint32 y, sint32 width, sint32 hei
|
|||
centre_z = centre_sprite->unknown.z;
|
||||
}
|
||||
else{
|
||||
w->viewport_target_sprite = SPR_NONE;
|
||||
w->viewport_target_sprite = SPRITE_INDEX_NULL;
|
||||
}
|
||||
|
||||
sint32 view_x, view_y;
|
||||
|
@ -520,7 +519,7 @@ void viewport_update_position(rct_window *window)
|
|||
rct_viewport* viewport = window->viewport;
|
||||
if (!viewport)return;
|
||||
|
||||
if (window->viewport_target_sprite != -1) {
|
||||
if (window->viewport_target_sprite != SPRITE_INDEX_NULL) {
|
||||
viewport_update_sprite_follow(window);
|
||||
return;
|
||||
}
|
||||
|
@ -605,7 +604,7 @@ void viewport_update_position(rct_window *window)
|
|||
|
||||
void viewport_update_sprite_follow(rct_window *window)
|
||||
{
|
||||
if (window->viewport_target_sprite != -1 && window->viewport){
|
||||
if (window->viewport_target_sprite != SPRITE_INDEX_NULL && window->viewport) {
|
||||
rct_sprite* sprite = get_sprite(window->viewport_target_sprite);
|
||||
|
||||
sint32 height = (map_element_height(0xFFFF & sprite->unknown.x, 0xFFFF & sprite->unknown.y) & 0xFFFF) - 16;
|
||||
|
|
|
@ -15,14 +15,15 @@
|
|||
#pragma endregion
|
||||
|
||||
#include "../audio/audio.h"
|
||||
#include "../config/Config.h"
|
||||
#include "../Context.h"
|
||||
#include "../core/Guard.hpp"
|
||||
#include "../drawing/drawing.h"
|
||||
#include "../editor.h"
|
||||
#include "../game.h"
|
||||
#include "../input.h"
|
||||
#include "../interface/themes.h"
|
||||
#include "../interface/Cursors.h"
|
||||
#include "../interface/themes.h"
|
||||
#include "../localisation/localisation.h"
|
||||
#include "../localisation/string_ids.h"
|
||||
#include "../platform/platform.h"
|
||||
|
@ -31,7 +32,6 @@
|
|||
#include "viewport.h"
|
||||
#include "widget.h"
|
||||
#include "window.h"
|
||||
#include "../config/Config.h"
|
||||
|
||||
#define RCT2_FIRST_WINDOW (g_window_list)
|
||||
#define RCT2_LAST_WINDOW (gWindowNextSlot - 1)
|
||||
|
@ -1402,7 +1402,7 @@ void window_scroll_to_location(rct_window *w, sint32 x, sint32 y, sint32 z)
|
|||
}
|
||||
}
|
||||
// rct2: 0x006E7C76
|
||||
if (w->viewport_target_sprite == -1) {
|
||||
if (w->viewport_target_sprite == SPRITE_INDEX_NULL) {
|
||||
if (!(w->flags & WF_NO_SCROLLING)) {
|
||||
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]);
|
||||
|
|
|
@ -300,7 +300,7 @@ typedef struct rct_window {
|
|||
uint8 var_498[0x14];
|
||||
sint16 selected_tab; // 0x4AC
|
||||
sint16 var_4AE;
|
||||
sint16 viewport_target_sprite; // 0x4B0 viewport target sprite?
|
||||
uint16 viewport_target_sprite; // 0x4B0 viewport target sprite
|
||||
sint16 saved_view_x; // 0x4B2
|
||||
sint16 saved_view_y; // 0x4B4
|
||||
rct_windowclass classification; // 0x4B6
|
||||
|
|
|
@ -43,9 +43,9 @@
|
|||
#include "../world/scenery.h"
|
||||
#include "../world/sprite.h"
|
||||
#include "../world/water.h"
|
||||
#include "scenario.h"
|
||||
#include "ScenarioRepository.h"
|
||||
#include "ScenarioSources.h"
|
||||
#include "scenario.h"
|
||||
|
||||
const rct_string_id ScenarioCategoryStringIds[SCENARIO_CATEGORY_COUNT] = {
|
||||
STR_BEGINNER_PARKS,
|
||||
|
@ -151,7 +151,7 @@ void scenario_begin()
|
|||
game_create_windows();
|
||||
mainWindow = window_get_main();
|
||||
|
||||
mainWindow->viewport_target_sprite = -1;
|
||||
mainWindow->viewport_target_sprite = SPRITE_INDEX_NULL;
|
||||
mainWindow->saved_view_x = gSavedViewX;
|
||||
mainWindow->saved_view_y = gSavedViewY;
|
||||
|
||||
|
|
|
@ -404,7 +404,7 @@ private:
|
|||
void PrepareParkForPlayback()
|
||||
{
|
||||
rct_window * w = window_get_main();
|
||||
w->viewport_target_sprite = -1;
|
||||
w->viewport_target_sprite = SPRITE_INDEX_NULL;
|
||||
w->saved_view_x = gSavedViewX;
|
||||
w->saved_view_y = gSavedViewY;
|
||||
|
||||
|
|
|
@ -719,7 +719,7 @@ void window_guest_viewport_init(rct_window* w){
|
|||
rct_peep* peep = GET_PEEP(w->number);
|
||||
|
||||
if (peep->state == PEEP_STATE_PICKED){
|
||||
focus.sprite.sprite_id = -1;
|
||||
focus.sprite.sprite_id = SPRITE_INDEX_NULL;
|
||||
}
|
||||
else{
|
||||
uint8 final_check = 1;
|
||||
|
|
|
@ -1777,7 +1777,7 @@ static void window_ride_init_viewport(rct_window *w)
|
|||
focus.coordinate.x = 0;
|
||||
focus.coordinate.y = 0;
|
||||
focus.coordinate.z = 0;
|
||||
focus.sprite.sprite_id = -1;
|
||||
focus.sprite.sprite_id = SPRITE_INDEX_NULL;
|
||||
focus.coordinate.zoom = 0;
|
||||
focus.coordinate.rotation = get_current_rotation();
|
||||
focus.coordinate.width = 0;
|
||||
|
|
|
@ -1220,7 +1220,7 @@ void window_staff_viewport_init(rct_window* w){
|
|||
rct_peep* peep = GET_PEEP(w->number);
|
||||
|
||||
if (peep->state == PEEP_STATE_PICKED){
|
||||
focus.sprite_id = -1;
|
||||
focus.sprite_id = SPRITE_INDEX_NULL;
|
||||
}
|
||||
else{
|
||||
focus.type |= VIEWPORT_FOCUS_TYPE_SPRITE | VIEWPORT_FOCUS_TYPE_COORDINATE;
|
||||
|
|
|
@ -166,7 +166,7 @@ void reset_sprite_list()
|
|||
*/
|
||||
void reset_sprite_spatial_index()
|
||||
{
|
||||
memset(gSpriteSpatialIndex, -1, sizeof(gSpriteSpatialIndex));
|
||||
memset(gSpriteSpatialIndex, SPRITE_INDEX_NULL, sizeof(gSpriteSpatialIndex));
|
||||
for (size_t i = 0; i < MAX_SPRITES; i++) {
|
||||
rct_sprite *spr = get_sprite(i);
|
||||
if (spr->unknown.sprite_identifier != SPRITE_IDENTIFIER_NULL) {
|
||||
|
|
Loading…
Add table
Reference in a new issue