diff --git a/projects/openrct2.vcxproj b/projects/openrct2.vcxproj index c53fa7bbb8..17fd85d97e 100644 --- a/projects/openrct2.vcxproj +++ b/projects/openrct2.vcxproj @@ -137,6 +137,7 @@ + diff --git a/projects/openrct2.vcxproj.filters b/projects/openrct2.vcxproj.filters index c18e8cbaab..79ac5f6879 100644 --- a/projects/openrct2.vcxproj.filters +++ b/projects/openrct2.vcxproj.filters @@ -368,7 +368,6 @@ Source\Windows - Source\Windows @@ -383,9 +382,6 @@ - - Libraries\libspeex - Source\Drawing @@ -422,6 +418,10 @@ Libraries\argparse + + + Source\World + diff --git a/src/game.c b/src/game.c index 5ec5e6b2d0..154e211323 100644 --- a/src/game.c +++ b/src/game.c @@ -36,6 +36,7 @@ #include "peep/staff.h" #include "platform/osinterface.h" #include "ride/ride.h" +#include "ride/ride_ratings.h" #include "ride/vehicle.h" #include "scenario.h" #include "title.h" @@ -277,18 +278,18 @@ void game_logic_update() sub_68B089(); scenario_update(); climate_update(); - RCT2_CALLPROC_EBPSAFE(0x006646E1); - RCT2_CALLPROC_EBPSAFE(0x006A876D); + fountain_update_all(); + sub_6A876D(); peep_update_all(); vehicle_update_all(); - RCT2_CALLPROC_EBPSAFE(0x00672AA4); // update text effects - RCT2_CALLPROC_EBPSAFE(0x006ABE4C); // update rides + texteffect_update_all(); + ride_update_all(); park_update(); research_update(); - RCT2_CALLPROC_EBPSAFE(0x006B5A2A); // update ride ratings + ride_ratings_update_all(); ride_measurements_update(); - RCT2_CALLPROC_EBPSAFE(0x0068AFAD); - vehicle_sounds_update();//RCT2_CALLPROC_EBPSAFE(0x006BBC6B); // vehicle and scream sounds + map_invalidate_animations(); + vehicle_sounds_update(); peep_update_crowd_noise(); climate_update_sound(); news_item_update_current(); diff --git a/src/ride/ride.c b/src/ride/ride.c index e7931aee4b..486406b05b 100644 --- a/src/ride/ride.c +++ b/src/ride/ride.c @@ -201,8 +201,14 @@ void ride_update_favourited_stat() window_invalidate_by_id(WC_RIDE_LIST, 0); } - - +/** + * + * rct2: 0x006ABE4C + */ +void ride_update_all() +{ + RCT2_CALLPROC_EBPSAFE(0x006ABE4C); +} /** * rct2: 0x006B7C59 diff --git a/src/ride/ride.h b/src/ride/ride.h index 8a93ddf57b..a329bea947 100644 --- a/src/ride/ride.h +++ b/src/ride/ride.h @@ -547,6 +547,7 @@ int ride_get_max_queue_time(rct_ride *ride); void ride_init_all(); void reset_all_ride_build_dates(); void ride_update_favourited_stat(); +void ride_update_all(); void ride_check_all_reachable(); rct_map_element *sub_6CAF80(int rideIndex, int *outX, int *outY); rct_map_element *ride_find_track_gap(rct_map_element *startTrackElement, int *outX, int *outY); diff --git a/src/ride/ride_ratings.c b/src/ride/ride_ratings.c index cf27fa487c..dc90c724da 100644 --- a/src/ride/ride_ratings.c +++ b/src/ride/ride_ratings.c @@ -23,6 +23,14 @@ #include "ride_data.h" #include "ride_ratings.h" +/** + * rct2: 0x006B5A2A + */ +void ride_ratings_update_all() +{ + RCT2_CALLPROC_EBPSAFE(0x006B5A2A); +} + /** * rct2: 0x0065C4D4 * diff --git a/src/ride/ride_ratings.h b/src/ride/ride_ratings.h index 14e158f564..b2f5509e5b 100644 --- a/src/ride/ride_ratings.h +++ b/src/ride/ride_ratings.h @@ -24,6 +24,7 @@ #include "../common.h" #include "ride.h" +void ride_ratings_update_all(); void crooked_house_excitement(rct_ride *ride); void sub_655FD6(rct_ride *ride); ride_rating apply_intensity_penalty(ride_rating excitement, ride_rating intensity); diff --git a/src/world/fountain.c b/src/world/fountain.c new file mode 100644 index 0000000000..70740961f2 --- /dev/null +++ b/src/world/fountain.c @@ -0,0 +1,37 @@ +/***************************************************************************** + * Copyright (c) 2014 Ted John, Peter Hill + * OpenRCT2, an open source clone of Roller Coaster Tycoon 2. + * + * This file is part of OpenRCT2. + * + * 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 . + *****************************************************************************/ + +#include "../addresses.h" +#include "../game.h" +#include "../common.h" + +/** + * + * rct2: 0x006646E1 + */ +void fountain_update_all() +{ + int ignoreScreenFlags = SCREEN_FLAGS_SCENARIO_EDITOR | SCREEN_FLAGS_TRACK_DESIGNER | SCREEN_FLAGS_TRACK_MANAGER; + if (RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & ignoreScreenFlags) + return; + + // Probably not just fountains... may include scenery aging and grass growth. + RCT2_CALLPROC_EBPSAFE(0x006646EE); +} \ No newline at end of file diff --git a/src/world/map.c b/src/world/map.c index 01eb46806b..bcee0c309b 100644 --- a/src/world/map.c +++ b/src/world/map.c @@ -23,7 +23,11 @@ #include "climate.h" #include "map.h" +int _sub_6A876D_save_x; +int _sub_6A876D_save_y; + static void tiles_init(); +static void sub_6A87BB(int x, int y); int map_element_get_terrain(rct_map_element *element) { @@ -112,8 +116,8 @@ void map_init() } RCT2_GLOBAL(0x013B0E70, sint16) = 0; - RCT2_GLOBAL(0x013CE774, sint16) = 0; - RCT2_GLOBAL(0x013CE776, sint16) = 0; + _sub_6A876D_save_x = 0; + _sub_6A876D_save_y = 0; RCT2_GLOBAL(0x01358830, sint16) = 4768; RCT2_GLOBAL(RCT2_ADDRESS_MAP_MAXIMUM_X_Y, sint16) = 5054; RCT2_GLOBAL(RCT2_ADDRESS_MAP_SIZE, sint16) = 150; @@ -380,3 +384,52 @@ int map_coord_is_connected(uint16 tile_idx, uint8 height, uint8 face_direction) return 0; } +/** + * + * rct2: 0x0068AFAD + */ +void map_invalidate_animations() +{ + RCT2_CALLPROC_EBPSAFE(0x0068AFAD); +} + +/** + * + * rct2: 0x006A876D + */ +void sub_6A876D() +{ + int i, x, y; + + if (RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & (SCREEN_FLAGS_TRACK_DESIGNER | SCREEN_FLAGS_TRACK_MANAGER)) + return; + + // Presumebly sub_6A87BB is too computationally expensive to call for every + // tile every update, so word_13CE774 and word_13CE776 store the x and y + // progress. A maximum of 128 calls is done per update. + x = _sub_6A876D_save_x; + y = _sub_6A876D_save_y; + for (i = 0; i < 128; i++) { + sub_6A87BB(x, y); + + // Next x, y tile + x += 32; + if (x >= 8192) { + x = 0; + y += 32; + if (y >= 8192) + y = 0; + } + } + _sub_6A876D_save_x = x; + _sub_6A876D_save_y = y; +} + +/** + * + * rct2: 0x006A87BB + */ +static void sub_6A87BB(int x, int y) +{ + RCT2_CALLPROC_X(0x006A87BB, x, 0, y, 0, 0, 0, 0); +} \ No newline at end of file diff --git a/src/world/map.h b/src/world/map.h index 5ce24b4d84..416fb22ca1 100644 --- a/src/world/map.h +++ b/src/world/map.h @@ -203,6 +203,10 @@ rct_map_element *map_get_surface_element_at(int x, int y); int map_element_height(int x, int y); void sub_68B089(); int map_coord_is_connected(uint16 coordinate, uint8 height, uint8 face_direction); +void map_invalidate_animations(); +void sub_6A876D(); + +void fountain_update_all(); #define GET_MAP_ELEMENT(x) (&(RCT2_ADDRESS(RCT2_ADDRESS_MAP_ELEMENTS, rct_map_element)[x])) #define TILE_MAP_ELEMENT_POINTER(x) (RCT2_ADDRESS(RCT2_ADDRESS_TILE_MAP_ELEMENT_POINTERS, rct_map_element*)[x]) diff --git a/src/world/sprite.c b/src/world/sprite.c index 6c6bf44b2d..85afc6045c 100644 --- a/src/world/sprite.c +++ b/src/world/sprite.c @@ -200,4 +200,13 @@ void move_sprite_to_list(rct_sprite *sprite, uint8 cl) // Decrement old list counter, increment new list counter. --(RCT2_GLOBAL(0x13573C8 + oldListTypeOffset, uint16)); ++(RCT2_GLOBAL(0x13573C8 + cl, uint16)); +} + +/** + * + * rct: 0x00672AA4 + */ +void texteffect_update_all() +{ + RCT2_CALLPROC_EBPSAFE(0x00672AA4); } \ No newline at end of file diff --git a/src/world/sprite.h b/src/world/sprite.h index 28d658371a..3b33862d7b 100644 --- a/src/world/sprite.h +++ b/src/world/sprite.h @@ -101,5 +101,6 @@ rct_sprite *create_sprite(uint8 bl); void reset_sprite_list(); void reset_0x69EBE4(); void move_sprite_to_list(rct_sprite *sprite, uint8 cl); +void texteffect_update_all(); #endif