1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2025-12-17 13:02:27 +01:00

refactor game_logic_update

This commit is contained in:
IntelOrca
2014-10-09 20:31:58 +01:00
parent 3cf28d6ef8
commit 70a33f6593
12 changed files with 137 additions and 15 deletions

View File

@@ -137,6 +137,7 @@
<ClCompile Include="..\src\windows\track_place.c" />
<ClCompile Include="..\src\windows\water.c" />
<ClCompile Include="..\src\world\climate.c" />
<ClCompile Include="..\src\world\fountain.c" />
<ClCompile Include="..\src\world\map.c" />
<ClCompile Include="..\src\world\park.c" />
<ClCompile Include="..\src\world\sprite.c" />

View File

@@ -368,7 +368,6 @@
<ClCompile Include="..\src\windows\guest.c">
<Filter>Source\Windows</Filter>
</ClCompile>
<ClCompile Include="..\lib\lodepng\lodepng.c" />
<ClCompile Include="..\src\windows\shortcut_key_change.c">
<Filter>Source\Windows</Filter>
</ClCompile>
@@ -383,9 +382,6 @@
<ClCompile Include="..\lib\lodepng\lodepng.c" />
<ClCompile Include="..\lib\lodepng\lodepng.c" />
<ClCompile Include="..\lib\lodepng\lodepng.c" />
<ClCompile Include="..\lib\libspeex\resample.c">
<Filter>Libraries\libspeex</Filter>
</ClCompile>
<ClCompile Include="..\lib\lodepng\lodepng.c" />
<ClCompile Include="..\src\drawing\rain.c">
<Filter>Source\Drawing</Filter>
@@ -422,6 +418,10 @@
<Filter>Libraries\argparse</Filter>
</ClCompile>
<ClCompile Include="..\lib\libspeex\resample.c;..\lib\lodepng\lodepng.c" />
<ClCompile Include="..\lib\libspeex\resample.c;..\lib\lodepng\lodepng.c" />
<ClCompile Include="..\src\world\fountain.c">
<Filter>Source\World</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\src\management\award.h">

View File

@@ -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();

View File

@@ -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

View File

@@ -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);

View File

@@ -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
*

View File

@@ -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);

37
src/world/fountain.c Normal file
View File

@@ -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 <http://www.gnu.org/licenses/>.
*****************************************************************************/
#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);
}

View File

@@ -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);
}

View File

@@ -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])

View File

@@ -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);
}

View File

@@ -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