Merge branch 'network' into develop

This commit is contained in:
IntelOrca committed 2015-08-14 16:52:40 +01:00
commit 44b71240f4
43 files changed
+2300 -103

No files matched your search

+6
View File
@@ -3831,3 +3831,9 @@ STR_5489 :{SMALLFONT}{BLACK}Show only tracked guests
STR_5490 :Disable audio on focus loss
STR_5491 :Inventions list
STR_5492 :Scenario options
STR_6000 :Send Message
STR_6001 :Type the message you would like to send.
STR_6002 :Player List
STR_6003 :Player:
STR_6004 :Ping:
+9 -3
View File
@@ -44,6 +44,7 @@
<ClCompile Include="..\src\game.c" />
<ClCompile Include="..\src\hook.c" />
<ClCompile Include="..\src\input.c" />
<ClCompile Include="..\src\interface\chat.c" />
<ClCompile Include="..\src\interface\themes.c">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
</ExcludedFromBuild>
@@ -74,6 +75,7 @@
<ClCompile Include="..\src\management\news_item.c" />
<ClCompile Include="..\src\management\research.c" />
<ClCompile Include="..\src\network\http.cpp" />
<ClCompile Include="..\src\network\network.cpp" />
<ClCompile Include="..\src\network\twitch.cpp" />
<ClCompile Include="..\src\object.c" />
<ClCompile Include="..\src\object_list.c" />
@@ -96,6 +98,8 @@
<ClCompile Include="..\src\scenario.c" />
<ClCompile Include="..\src\scenario_list.c" />
<ClCompile Include="..\src\windows\changelog.c" />
<ClCompile Include="..\src\windows\network_status.c" />
<ClCompile Include="..\src\windows\player_list.c" />
<ClCompile Include="..\src\windows\title_command_editor.c" />
<ClCompile Include="..\src\windows\title_editor.c">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release with Tests|Win32'">
@@ -202,6 +206,7 @@
<ClInclude Include="..\src\game.h" />
<ClInclude Include="..\src\hook.h" />
<ClInclude Include="..\src\input.h" />
<ClInclude Include="..\src\interface\chat.h" />
<ClInclude Include="..\src\interface\themes.h">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
</ExcludedFromBuild>
@@ -230,6 +235,7 @@
<ClInclude Include="..\src\management\research.h" />
<ClInclude Include="..\src\network\http.h" />
<ClInclude Include="..\src\network\twitch.h" />
<ClInclude Include="..\src\network\network.h" />
<ClInclude Include="..\src\object.h" />
<ClInclude Include="..\src\openrct2.h" />
<ClInclude Include="..\src\peep\peep.h" />
@@ -341,7 +347,7 @@
<Optimization>Disabled</Optimization>
<SDLCheck>true</SDLCheck>
<StructMemberAlignment>1Byte</StructMemberAlignment>
<PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;HAVE_CONFIG_H;_USE_MATH_DEFINES;CURL_STATICLIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;HAVE_CONFIG_H;_CURL_STATICLIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<ObjectFileName>$(IntDir)fake\%(RelativeDir)</ObjectFileName>
@@ -372,7 +378,7 @@ xcopy /YS "$(SolutionDir)\..\Data" "$(TargetDir)\Data"</Command>
<OmitFramePointers>
</OmitFramePointers>
<BufferSecurityCheck>false</BufferSecurityCheck>
<PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;HAVE_CONFIG_H;_USE_MATH_DEFINES;CURL_STATICLIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;HAVE_CONFIG_H;CURL_STATICLIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ObjectFileName>$(IntDir)fake\%(RelativeDir)</ObjectFileName>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
@@ -412,7 +418,7 @@ xcopy /YS "$(SolutionDir)\..\Data" "$(TargetDir)\Data"</Command>
<OmitFramePointers>
</OmitFramePointers>
<BufferSecurityCheck>false</BufferSecurityCheck>
<PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;HAVE_CONFIG_H;_USE_MATH_DEFINES;CURL_STATICLIB;ENABLE_TESTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;HAVE_CONFIG_H;CURL_STATICLIB;ENABLE_TESTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ObjectFileName>$(IntDir)fake\%(RelativeDir)</ObjectFileName>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
</ClCompile>
+10
View File
@@ -498,6 +498,13 @@
<ClCompile Include="..\src\localisation\convert.c">
<Filter>Source\Localisation</Filter>
</ClCompile>
<ClCompile Include="..\src\network\network.c">
<ClCompile Include="..\src\network\network.cpp">
<Filter>Source\Network</Filter>
</ClCompile>
<ClCompile Include="..\src\windows\network.c">
<Filter>Source\Windows</Filter>
</ClCompile>
<ClCompile Include="..\src\drawing\scrolling_text.c">
<Filter>Source\Drawing</Filter>
</ClCompile>
@@ -740,5 +747,8 @@
<ClInclude Include="..\src\drawing\font.h">
<Filter>Source\Drawing</Filter>
</ClInclude>
<ClInclude Include="..\src\network\network.h">
<Filter>Source\Network</Filter>
</ClInclude>
</ItemGroup>
</Project>
+9 -7
View File
@@ -1,21 +1,23 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<ShowAllFiles>false</ShowAllFiles>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LocalDebuggerCommand>$(TargetDir)\openrct2.exe</LocalDebuggerCommand>
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
<LocalDebuggerWorkingDirectory>$(TargetDir)</LocalDebuggerWorkingDirectory>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LocalDebuggerWorkingDirectory>$(TargetDir)</LocalDebuggerWorkingDirectory>
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
<LocalDebuggerCommand>$(TargetDir)\openrct2.exe</LocalDebuggerCommand>
<LocalDebuggerCommandArguments>
</LocalDebuggerCommandArguments>
<LocalDebuggerCommandArguments>"C:\Program Files (x86)\Infogrames\RollerCoaster Tycoon 2\Scenarios\Crazy Castle.SC6" --port 5552 --server 127.0.0.1</LocalDebuggerCommandArguments>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release with Tests|Win32'">
<LocalDebuggerWorkingDirectory>$(TargetDir)</LocalDebuggerWorkingDirectory>
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
<LocalDebuggerCommand>$(TargetDir)\openrct2.exe</LocalDebuggerCommand>
<LocalDebuggerCommandArguments>
</LocalDebuggerCommandArguments>
</PropertyGroup>
<PropertyGroup>
<ShowAllFiles>false</ShowAllFiles>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LocalDebuggerCommand>$(TargetDir)\openrct2.exe</LocalDebuggerCommand>
+6
View File
@@ -780,6 +780,9 @@ void Mixer_Init(const char* device)
void* Mixer_Play_Effect(int id, int loop, int volume, float pan, double rate, int deleteondone)
{
if (!gConfigSound.sound) {
return 0;
}
if (id >= countof(gMixer.css1sources)) {
return 0;
}
@@ -842,6 +845,9 @@ void Mixer_Channel_SetGroup(void* channel, int group)
void* Mixer_Play_Music(int pathid, int loop, int streaming)
{
if (!gConfigSound.sound) {
return 0;
}
if (streaming) {
const char* filename = get_file_path(pathid);
+19 -1
View File
@@ -23,6 +23,7 @@
#include "addresses.h"
#include "cmdline.h"
#include "interface/screenshot.h"
#include "network/network.h"
#include "openrct2.h"
#include "platform/platform.h"
#include "util/util.h"
@@ -45,6 +46,10 @@ typedef int (*cmdline_action)(const char **argv, int argc);
int gExitCode = 0;
int gNetworkStart = NETWORK_MODE_NONE;
char gNetworkStartHost[128];
int gNetworkStartPort = NETWORK_DEFAULT_PORT;
static void print_launch_information();
static int cmdline_call_action(const char **argv, int argc);
@@ -64,13 +69,16 @@ static const char *const usage[] = {
int cmdline_run(const char **argv, int argc)
{
//
int version = 0, verbose = 0, width = 0, height = 0;
int version = 0, verbose = 0, width = 0, height = 0, port = 0;
char *server = NULL;
argparse_option_t options[] = {
OPT_HELP(),
OPT_BOOLEAN('v', "version", &version, "show version information and exit"),
OPT_BOOLEAN(0, "verbose", &verbose, "log verbose messages"),
OPT_INTEGER('m', "mode", &sprite_mode, "the type of sprite conversion. 0 = default, 1 = simple closest pixel match, 2 = dithering"),
OPT_STRING(0, "server", &server, "server to connect to"),
OPT_INTEGER(0, "port", &port, "port"),
OPT_END()
};
@@ -88,6 +96,16 @@ int cmdline_run(const char **argv, int argc)
if (verbose)
_log_levels[DIAGNOSTIC_LEVEL_VERBOSE] = 1;
if (port != 0) {
gNetworkStart = NETWORK_MODE_SERVER;
gNetworkStartPort = port;
}
if (server != NULL) {
gNetworkStart = NETWORK_MODE_CLIENT;
strncpy(gNetworkStartHost, server, sizeof(gNetworkStartHost));
}
if (argc != 0) {
gExitCode = cmdline_call_action(argv, argc);
if (gExitCode != 0)
+4
View File
@@ -28,6 +28,10 @@ extern int gExitCode;
int sprite_mode;
extern int gNetworkStart;
extern char gNetworkStartHost[128];
extern int gNetworkStartPort;
int cmdline_run(const char **argv, int argc);
int cmdline_for_sprite(const char **argv, int argc);
+1
View File
@@ -986,6 +986,7 @@ static const uint16 _defaultShortcutKeys[SHORTCUT_COUNT] = {
SDL_SCANCODE_EQUALS, // SHORTCUT_INCREASE_GAME_SPEED,
CTRL | ALT | SDL_SCANCODE_C, // SHORTCUT_OPEN_CHEAT_WINDOW,
SDL_SCANCODE_T, // SHORTCUT_REMOVE_TOP_BOTTOM_TOOLBAR_TOGGLE,
SDL_SCANCODE_C, // SHORTCUT_OPEN_CHAT_WINDOW
SDL_SCANCODE_UP, // SHORTCUT_SCROLL_MAP_UP
SDL_SCANCODE_LEFT, // SHORTCUT_SCROLL_MAP_LEFT
SDL_SCANCODE_DOWN, // SHORTCUT_SCROLL_MAP_DOWN
+1
View File
@@ -72,6 +72,7 @@ enum {
SHORTCUT_INCREASE_GAME_SPEED,
SHORTCUT_OPEN_CHEAT_WINDOW,
SHORTCUT_REMOVE_TOP_BOTTOM_TOOLBAR_TOGGLE,
SHORTCUT_OPEN_CHAT_WINDOW,
SHORTCUT_SCROLL_MAP_UP,
SHORTCUT_SCROLL_MAP_LEFT,
SHORTCUT_SCROLL_MAP_DOWN,
+1
View File
@@ -135,6 +135,7 @@ void draw_string_right_underline(rct_drawpixelinfo *dpi, int format, void *args,
int string_get_height_raw(char *buffer);
void gfx_draw_string_centred_wrapped_partial(rct_drawpixelinfo *dpi, int x, int y, int width, int colour, rct_string_id format, void *args, int ticks);
void gfx_draw_string_with_y_offsets(rct_drawpixelinfo *dpi, utf8 *text, int colour, int x, int y, const sint8 *yOffsets);
int gfx_clip_string(char* buffer, int width);
bool ttf_initialise();
void ttf_dispose();
+12 -12
View File
@@ -167,8 +167,8 @@ void update_rain_animation()
*/
static void draw_light_rain(int left, int top, int width, int height)
{
int x_start = -RCT2_GLOBAL(RCT2_ADDRESS_SCENARIO_TICKS, int) + 8;
int y_start = (RCT2_GLOBAL(RCT2_ADDRESS_SCENARIO_TICKS, int) * 3) + 7;
int x_start = -(int)RCT2_GLOBAL(RCT2_ADDRESS_SCENARIO_TICKS, uint32) + 8;
int y_start = (RCT2_GLOBAL(RCT2_ADDRESS_SCENARIO_TICKS, uint32) * 3) + 7;
y_start = -y_start;
x_start += left;
@@ -176,8 +176,8 @@ static void draw_light_rain(int left, int top, int width, int height)
gfx_draw_rain(left, top, width, height, x_start, y_start);
x_start = -RCT2_GLOBAL(RCT2_ADDRESS_SCENARIO_TICKS, int) + 0x18;
y_start = (RCT2_GLOBAL(RCT2_ADDRESS_SCENARIO_TICKS, int) * 4) + 0x0D;
x_start = -(int)RCT2_GLOBAL(RCT2_ADDRESS_SCENARIO_TICKS, uint32) + 0x18;
y_start = (RCT2_GLOBAL(RCT2_ADDRESS_SCENARIO_TICKS, uint32) * 4) + 0x0D;
y_start = -y_start;
x_start += left;
@@ -191,8 +191,8 @@ static void draw_light_rain(int left, int top, int width, int height)
*/
static void draw_heavy_rain(int left, int top, int width, int height)
{
int x_start = -RCT2_GLOBAL(RCT2_ADDRESS_SCENARIO_TICKS, int);
int y_start = RCT2_GLOBAL(RCT2_ADDRESS_SCENARIO_TICKS, int) * 5;
int x_start = -(int)RCT2_GLOBAL(RCT2_ADDRESS_SCENARIO_TICKS, uint32);
int y_start = RCT2_GLOBAL(RCT2_ADDRESS_SCENARIO_TICKS, uint32) * 5;
y_start = -y_start;
x_start += left;
@@ -200,8 +200,8 @@ static void draw_heavy_rain(int left, int top, int width, int height)
gfx_draw_rain(left, top, width, height, x_start, y_start);
x_start = -RCT2_GLOBAL(RCT2_ADDRESS_SCENARIO_TICKS, int) + 0x10;
y_start = (RCT2_GLOBAL(RCT2_ADDRESS_SCENARIO_TICKS, int) * 6) + 5;
x_start = -(int)RCT2_GLOBAL(RCT2_ADDRESS_SCENARIO_TICKS, uint32) + 0x10;
y_start = (RCT2_GLOBAL(RCT2_ADDRESS_SCENARIO_TICKS, uint32) * 6) + 5;
y_start = -y_start;
x_start += left;
@@ -209,8 +209,8 @@ static void draw_heavy_rain(int left, int top, int width, int height)
gfx_draw_rain(left, top, width, height, x_start, y_start);
x_start = -RCT2_GLOBAL(RCT2_ADDRESS_SCENARIO_TICKS, int) + 8;
y_start = (RCT2_GLOBAL(RCT2_ADDRESS_SCENARIO_TICKS, int) * 3) + 7;
x_start = -(int)RCT2_GLOBAL(RCT2_ADDRESS_SCENARIO_TICKS, uint32) + 8;
y_start = (RCT2_GLOBAL(RCT2_ADDRESS_SCENARIO_TICKS, uint32) * 3) + 7;
y_start = -y_start;
x_start += left;
@@ -218,8 +218,8 @@ static void draw_heavy_rain(int left, int top, int width, int height)
gfx_draw_rain(left, top, width, height, x_start, y_start);
x_start = -RCT2_GLOBAL(RCT2_ADDRESS_SCENARIO_TICKS, int) + 0x18;
y_start = (RCT2_GLOBAL(RCT2_ADDRESS_SCENARIO_TICKS, int) * 4) + 0x0D;
x_start = -(int)RCT2_GLOBAL(RCT2_ADDRESS_SCENARIO_TICKS, uint32) + 0x18;
y_start = (RCT2_GLOBAL(RCT2_ADDRESS_SCENARIO_TICKS, uint32) * 4) + 0x0D;
y_start = -y_start;
x_start += left;
+143 -11
View File
@@ -34,6 +34,7 @@
#include "management/marketing.h"
#include "management/news_item.h"
#include "management/research.h"
#include "network/network.h"
#include "object.h"
#include "openrct2.h"
#include "peep/peep.h"
@@ -60,6 +61,30 @@
int gGameSpeed = 1;
float gDayNightCycle = 0;
GAME_COMMAND_CALLBACK_POINTER* game_command_callback = 0;
GAME_COMMAND_CALLBACK_POINTER* game_command_callback_table[] = {
0,
game_command_callback_ride_construct_new,
};
int game_command_callback_get_index(GAME_COMMAND_CALLBACK_POINTER* callback)
{
for (int i = 0; i < countof(game_command_callback_table); i++ ) {
if (game_command_callback_table[i] == callback) {
return i;
}
}
return 0;
}
GAME_COMMAND_CALLBACK_POINTER* game_command_callback_get_callback(int index)
{
if (index < countof(game_command_callback_table)) {
return game_command_callback_table[index];
}
return 0;
}
void game_increase_game_speed()
{
gGameSpeed = min(gConfigGeneral.debugging_tools ? 5 : 4, gGameSpeed + 1);
@@ -232,6 +257,13 @@ void game_update()
numUpdates = clamp(1, numUpdates, 4);
}
if (network_get_mode() == NETWORK_MODE_CLIENT) {
if (network_get_server_tick() - RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_TICKS, uint32) >= 10) {
// make sure client doesn't fall behind the server too much
numUpdates += 10;
}
}
// Update the game one or more times
if (RCT2_GLOBAL(RCT2_ADDRESS_GAME_PAUSED, uint8) == 0) {
for (i = 0; i < numUpdates; i++) {
@@ -270,7 +302,7 @@ void game_update()
// the flickering frequency is reduced by 4, compared to the original
// it was done due to inability to reproduce original frequency
// and decision that the original one looks too fast
if (RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_TICKS, sint32) % 4 == 0)
if (RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_TICKS, uint32) % 4 == 0)
RCT2_GLOBAL(RCT2_ADDRESS_WINDOW_MAP_FLASHING_FLAGS, uint16) ^= (1 << 15);
// Handle guest map flashing
@@ -287,8 +319,6 @@ void game_update()
window_map_tooltip_update_visibility();
RCT2_GLOBAL(0x01388698, uint16)++;
// Input
RCT2_GLOBAL(0x0141F568, uint8) = RCT2_GLOBAL(0x0013CA740, uint8);
game_handle_input();
@@ -302,8 +332,16 @@ void game_update()
void game_logic_update()
{
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_TICKS, sint32)++;
RCT2_GLOBAL(RCT2_ADDRESS_SCENARIO_TICKS, sint32)++;
network_update();
if (network_get_mode() == NETWORK_MODE_CLIENT) {
if (RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_TICKS, uint32) == network_get_server_tick()) {
// dont run past the server
return;
}
}
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_TICKS, uint32)++;
RCT2_GLOBAL(RCT2_ADDRESS_SCENARIO_TICKS, uint32)++;
RCT2_GLOBAL(0x009DEA66, sint16)++;
if (RCT2_GLOBAL(0x009DEA66, sint16) == 0)
RCT2_GLOBAL(0x009DEA66, sint16)--;
@@ -327,6 +365,8 @@ void game_logic_update()
climate_update_sound();
editor_open_windows_for_current_step();
RCT2_GLOBAL(0x01388698, uint16)++;
// Update windows
//window_dispatch_update_all();
@@ -402,6 +442,16 @@ int game_do_command_p(int command, int *eax, int *ebx, int *ecx, int *edx, int *
// Increment nest count
RCT2_GLOBAL(0x009A8C28, uint8)++;
// Remove ghost scenery so it doesn't interfere with incoming network command
if ((flags & GAME_COMMAND_FLAG_NETWORKED) && !(flags & GAME_COMMAND_FLAG_GHOST) &&
(command == GAME_COMMAND_PLACE_FENCE ||
command == GAME_COMMAND_PLACE_SCENERY ||
command == GAME_COMMAND_PLACE_LARGE_SCENERY ||
command == GAME_COMMAND_PLACE_BANNER ||
command == GAME_COMMAND_PLACE_PATH)) {
scenery_remove_ghost_tool_placement();
}
*ebx &= ~GAME_COMMAND_FLAG_APPLY;
// Primary command
@@ -415,7 +465,7 @@ int game_do_command_p(int command, int *eax, int *ebx, int *ecx, int *edx, int *
if (cost != MONEY32_UNDEFINED) {
// Check funds
insufficientFunds = 0;
if (RCT2_GLOBAL(0x009A8C28, uint8) == 1 && !(flags & 4) && !(flags & 0x20) && cost != 0)
if (RCT2_GLOBAL(0x009A8C28, uint8) == 1 && !(flags & GAME_COMMAND_FLAG_2) && !(flags & GAME_COMMAND_FLAG_5) && cost != 0)
insufficientFunds = game_check_affordability(cost);
if (insufficientFunds != MONEY32_UNDEFINED) {
@@ -425,18 +475,34 @@ int game_do_command_p(int command, int *eax, int *ebx, int *ecx, int *edx, int *
*edi = original_edi;
*ebp = original_ebp;
if (!(flags & 1)) {
if (!(flags & GAME_COMMAND_FLAG_APPLY)) {
// Decrement nest count
RCT2_GLOBAL(0x009A8C28, uint8)--;
return cost;
}
if (network_get_mode() != NETWORK_MODE_NONE && !(flags & GAME_COMMAND_FLAG_NETWORKED) && !(flags & GAME_COMMAND_FLAG_GHOST) && !(flags & GAME_COMMAND_FLAG_5) && RCT2_GLOBAL(0x009A8C28, uint8) == 1) {
network_send_gamecmd(*eax, *ebx, *ecx, *edx, *esi, *edi, *ebp, game_command_callback_get_index(game_command_callback));
if (network_get_mode() == NETWORK_MODE_CLIENT) {
game_command_callback = 0;
// Decrement nest count
RCT2_GLOBAL(0x009A8C28, uint8)--;
return cost;
}
}
// Secondary command
if (game_do_command_table[command] == 0) {
new_game_command_table[command](eax, ebx, ecx, edx, esi, edi, ebp);
} else {
RCT2_CALLFUNC_X(game_do_command_table[command], eax, ebx, ecx, edx, esi, edi, ebp);
}
if (game_command_callback) {
game_command_callback(*eax, *ebx, *ecx, *edx, *esi, *edi, *ebp);
game_command_callback = 0;
}
*edx = *ebx;
if (*edx != MONEY32_UNDEFINED && *edx < cost)
@@ -468,7 +534,7 @@ int game_do_command_p(int command, int *eax, int *ebx, int *ecx, int *edx, int *
RCT2_GLOBAL(0x009A8C28, uint8)--;
// Show error window
if (RCT2_GLOBAL(0x009A8C28, uint8) == 0 && (flags & 1) && RCT2_GLOBAL(0x0141F568, uint8) == RCT2_GLOBAL(0x013CA740, uint8) && !(flags & 8))
if (RCT2_GLOBAL(0x009A8C28, uint8) == 0 && (flags & GAME_COMMAND_FLAG_APPLY) && RCT2_GLOBAL(0x0141F568, uint8) == RCT2_GLOBAL(0x013CA740, uint8) && !(flags & GAME_COMMAND_FLAG_ALLOW_DURING_PAUSED))
window_error_open(RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TITLE, uint16), RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, uint16));
return MONEY32_UNDEFINED;
@@ -714,14 +780,69 @@ int game_load_sv6(SDL_RWops* rw)
return 1;
}
// Load game state for multiplayer
int game_load_network(SDL_RWops* rw)
{
int i, j;
rct_s6_header *s6Header = (rct_s6_header*)0x009E34E4;
rct_s6_info *s6Info = (rct_s6_info*)0x0141F570;
// Read first chunk
sawyercoding_read_chunk(rw, (uint8*)s6Header);
if (s6Header->type == S6_TYPE_SAVEDGAME) {
// Read packed objects
if (s6Header->num_packed_objects > 0) {
j = 0;
for (i = 0; i < s6Header->num_packed_objects; i++)
j += object_load_packed(rw);
if (j > 0)
object_list_load();
}
}
uint8 load_success = object_read_and_load_entries(rw);
// Read flags (16 bytes)
sawyercoding_read_chunk(rw, (uint8*)RCT2_ADDRESS_CURRENT_MONTH_YEAR);
// Read map elements
memset((void*)RCT2_ADDRESS_MAP_ELEMENTS, 0, MAX_MAP_ELEMENTS * sizeof(rct_map_element));
sawyercoding_read_chunk(rw, (uint8*)RCT2_ADDRESS_MAP_ELEMENTS);
// Read game data, including sprites
sawyercoding_read_chunk(rw, (uint8*)0x010E63B8);
// Read checksum
uint32 checksum;
SDL_RWread(rw, &checksum, sizeof(uint32), 1);
if (!load_success){
set_load_objects_fail_reason();
if (RCT2_GLOBAL(RCT2_ADDRESS_INPUT_FLAGS, uint32) & INPUT_FLAG_5){
RCT2_GLOBAL(0x14241BC, uint32) = 2;
//call 0x0040705E Sets cursor position and something else. Calls maybe wind func 8 probably pointless
RCT2_GLOBAL(0x14241BC, uint32) = 0;
RCT2_GLOBAL(RCT2_ADDRESS_INPUT_FLAGS, uint32) &= ~INPUT_FLAG_5;
}
return 0;//This never gets called
}
// The rest is the same as in scenario load and play
reset_loaded_objects();
map_update_tile_pointers();
reset_0x69EBE4();
openrct2_reset_object_tween_locations();
return 1;
}
/**
*
* rct2: 0x00675E1B
*/
int game_load_save(const char *path)
{
rct_window *mainWindow;
log_verbose("loading saved game, %s", path);
strcpy((char*)0x0141EF68, path);
@@ -746,6 +867,17 @@ int game_load_save(const char *path)
}
SDL_RWclose(rw);
game_load_init();
if (network_get_mode() == NETWORK_MODE_SERVER) {
network_send_map();
}
return 1;
}
void game_load_init()
{
rct_window *mainWindow;
RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) = SCREEN_FLAGS_PLAYING;
viewport_init_all();
game_create_windows();
@@ -780,11 +912,11 @@ int game_load_save(const char *path)
load_palette();
gfx_invalidate_screen();
window_update_all();
gGameSpeed = 1;
scenario_set_filename((char*)0x0135936C);
return 1;
}
/*
+20 -2
View File
@@ -86,11 +86,27 @@ enum GAME_COMMAND {
GAME_COMMAND_CLEAR_SCENERY
};
// If this flag is set, the command is applied, otherwise only the cost is retrieved
#define GAME_COMMAND_FLAG_APPLY (1 << 0)
enum {
GAME_COMMAND_FLAG_APPLY = (1 << 0), // If this flag is set, the command is applied, otherwise only the cost is retrieved
GAME_COMMAND_FLAG_2 = (1 << 2),
GAME_COMMAND_FLAG_ALLOW_DURING_PAUSED = (1 << 3), // Allow while paused
GAME_COMMAND_FLAG_4 = (1 << 4),
GAME_COMMAND_FLAG_5 = (1 << 5),
GAME_COMMAND_FLAG_GHOST = (1 << 6),
GAME_COMMAND_FLAG_NETWORKED = (1 << 31) // Game command is coming from network
};
typedef void (GAME_COMMAND_POINTER)(int* eax, int* ebx, int* ecx, int* edx, int* esi, int* edi, int* ebp);
typedef void (GAME_COMMAND_CALLBACK_POINTER)(int eax, int ebx, int ecx, int edx, int esi, int edi, int ebp);
extern GAME_COMMAND_CALLBACK_POINTER* game_command_callback;
int game_command_callback_get_index(GAME_COMMAND_CALLBACK_POINTER* callback);
GAME_COMMAND_CALLBACK_POINTER* game_command_callback_get_callback(int index);
extern int gGameSpeed;
extern float gDayNightCycle;
@@ -111,7 +127,9 @@ void game_reduce_game_speed();
void game_load_or_quit_no_save_prompt();
int game_load_sv6(SDL_RWops* rw);
int game_load_network(SDL_RWops* rw);
int game_load_save(const char *path);
void game_load_init();
void game_pause_toggle(int *eax, int *ebx, int *ecx, int *edx, int *esi, int *edi, int *ebp);
void pause_toggle();
int save_game();
+4
View File
@@ -25,6 +25,7 @@
#include "cursors.h"
#include "game.h"
#include "input.h"
#include "interface/chat.h"
#include "interface/console.h"
#include "interface/keyboard_shortcut.h"
#include "interface/viewport.h"
@@ -1344,6 +1345,9 @@ void game_handle_keyboard_input()
} else if (gConsoleOpen) {
console_input(key);
continue;
} else if (gChatOpen) {
chat_input(key);
continue;
}
key |= RCT2_GLOBAL(RCT2_ADDRESS_PLACE_OBJECT_MODIFIER, uint8) << 8;
+134
View File
@@ -0,0 +1,134 @@
#include "../addresses.h"
#include "../audio/audio.h"
#include "../audio/mixer.h"
#include "../localisation/localisation.h"
#include "../network/network.h"
#include "../platform/platform.h"
#include "chat.h"
#define CHAT_HISTORY_SIZE 10
#define CHAT_INPUT_SIZE 256
bool gChatOpen = false;
char _chatCurrentLine[CHAT_INPUT_SIZE];
char _chatHistory[CHAT_HISTORY_SIZE][CHAT_INPUT_SIZE];
uint32 _chatHistoryTime[CHAT_HISTORY_SIZE];
unsigned int _chatHistoryIndex = 0;
uint32 _chatCaretTicks = 0;
int _chatLeft;
int _chatTop;
int _chatRight;
int _chatBottom;
static const char* chat_history_get(unsigned int index);
static uint32 chat_history_get_time(unsigned int index);
static void chat_clear_input();
void chat_open()
{
gChatOpen = true;
platform_start_text_input(_chatCurrentLine, sizeof(_chatCurrentLine));
}
void chat_close()
{
gChatOpen = false;
platform_stop_text_input();
}
void chat_toggle()
{
if (gChatOpen) {
chat_close();
} else {
chat_open();
}
}
void chat_init()
{
memset(_chatHistory, 0, sizeof(_chatHistory));
memset(_chatHistoryTime, 0, sizeof(_chatHistoryTime));
}
void chat_update()
{
// Flash the caret
_chatCaretTicks = (_chatCaretTicks + 1) % 30;
}
void chat_draw()
{
rct_drawpixelinfo *dpi = (rct_drawpixelinfo*)RCT2_ADDRESS_SCREEN_DPI;
_chatLeft = 10;
_chatTop = RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_HEIGHT, uint16) - 40 - ((CHAT_HISTORY_SIZE + 1) * 10);
_chatRight = RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_WIDTH, uint16) - 10;
_chatBottom = RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_HEIGHT, uint16) - 40;
char lineBuffer[CHAT_INPUT_SIZE + 10];
char* lineCh = lineBuffer;
int x = _chatLeft;
int y = _chatBottom - (10 * 2);
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_FONT_SPRITE_BASE, uint16) = 224;
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_FONT_FLAGS, uint16) = 0;
for (int i = 0; i < CHAT_HISTORY_SIZE; i++, y -= 10) {
if (!gChatOpen && SDL_TICKS_PASSED(SDL_GetTicks(), chat_history_get_time(i) + 10000)) {
break;
}
strcpy(lineBuffer, chat_history_get(i));
gfx_set_dirty_blocks(x, y, x + gfx_get_string_width(lineBuffer), y + 12);
gfx_draw_string(dpi, lineBuffer, 255, x, y);
}
if (gChatOpen) {
lineCh = utf8_write_codepoint(lineCh, FORMAT_OUTLINE);
lineCh = utf8_write_codepoint(lineCh, FORMAT_CELADON);
strcpy(lineCh, _chatCurrentLine);
y = _chatBottom - 10;
gfx_set_dirty_blocks(x, y, x + gfx_get_string_width(lineBuffer) + 7, y + 12);
if (_chatCaretTicks < 15) {
int caretX = x + gfx_get_string_width(lineBuffer);
int caretY = y + 10;
gfx_fill_rect(dpi, caretX, caretY, caretX + 6, caretY + 1, 0x38);
}
gfx_draw_string(dpi, lineBuffer, 255, x, y);
}
}
void chat_history_add(const char *src)
{
int index = _chatHistoryIndex % CHAT_HISTORY_SIZE;
memset(_chatHistory[index], 0, CHAT_INPUT_SIZE);
memcpy(_chatHistory[index], src, min(strlen(src), CHAT_INPUT_SIZE));
_chatHistoryTime[index] = SDL_GetTicks();
_chatHistoryIndex++;
Mixer_Play_Effect(SOUND_NEWS_ITEM, 0, SDL_MIX_MAXVOLUME, 0, 1.5f, true);
}
void chat_input(int c)
{
switch (c) {
case SDL_SCANCODE_RETURN:
network_send_chat(_chatCurrentLine);
chat_clear_input();
chat_close();
break;
case SDL_SCANCODE_ESCAPE:
chat_close();
break;
}
}
static const char* chat_history_get(unsigned int index)
{
return _chatHistory[(_chatHistoryIndex + CHAT_HISTORY_SIZE - index - 1) % CHAT_HISTORY_SIZE];
}
static uint32 chat_history_get_time(unsigned int index)
{
return _chatHistoryTime[(_chatHistoryIndex + CHAT_HISTORY_SIZE - index - 1) % CHAT_HISTORY_SIZE];
}
static void chat_clear_input()
{
_chatCurrentLine[0] = 0;
}
+21
View File
@@ -0,0 +1,21 @@
#ifndef _CHAT_H_
#define _CHAT_H_
#include "../common.h"
#include "../drawing/drawing.h"
extern bool gChatOpen;
void chat_open();
void chat_close();
void chat_toggle();
void chat_init();
void chat_update();
void chat_draw();
void chat_history_add(const char *src);
void chat_input(int c);
#endif
+8
View File
@@ -21,8 +21,10 @@
#include "../addresses.h"
#include "../config.h"
#include "../game.h"
#include "../interface/chat.h"
#include "../input.h"
#include "../localisation/localisation.h"
#include "../network/network.h"
#include "keyboard_shortcut.h"
#include "viewport.h"
#include "window.h"
@@ -493,6 +495,11 @@ static void shortcut_open_cheat_window()
window_cheats_open();
}
static void shortcut_open_chat_window()
{
chat_toggle();
}
static const shortcut_action shortcut_table[SHORTCUT_COUNT] = {
shortcut_close_top_most_window,
shortcut_close_all_floating_windows,
@@ -533,6 +540,7 @@ static const shortcut_action shortcut_table[SHORTCUT_COUNT] = {
shortcut_increase_game_speed,
shortcut_open_cheat_window,
shortcut_remove_top_bottom_toolbar_toggle,
shortcut_open_chat_window,
NULL,
NULL,
NULL,
+5 -1
View File
@@ -446,12 +446,14 @@ enum {
WC_CHANGELOG = 121,
WC_TITLE_EDITOR = 122,
WC_TITLE_COMMAND_EDITOR = 123,
WC_CHAT_HOST = 124,
WC_PLAYER_LIST = 125,
WC_NETWORK_STATUS = 126,
// Only used for colour schemes
WC_STAFF = 220,
WC_EDITOR_TRACK_BOTTOM_TOOLBAR = 221,
WC_EDITOR_SCENARIO_BOTTOM_TOOLBAR = 222,
} WINDOW_CLASS;
enum PROMPT_MODE {
@@ -611,6 +613,8 @@ void window_banner_open(rct_windownumber number);
void window_sign_open(rct_windownumber number);
void window_sign_small_open(rct_windownumber number);
void window_cheats_open();
void window_player_list_open();
void window_network_status_open(const char* text);
void window_research_open();
void window_research_development_page_paint(rct_window *w, rct_drawpixelinfo *dpi, int baseWidgetIndex);
+1 -1
View File
@@ -48,5 +48,5 @@ void date_reset()
{
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_MONTH_YEAR, sint16) = MONTH_MARCH;
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_MONTH_TICKS, sint16) = 0;
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_TICKS, sint32) = 0;
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_TICKS, uint32) = 0;
}
-1
View File
@@ -18,7 +18,6 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*****************************************************************************/
#include <windows.h>
#include "../addresses.h"
#include "../config.h"
#include "../game.h"
+4
View File
@@ -2030,6 +2030,10 @@ enum {
STR_DEBUG_DROPDOWN_INVENTIONS_LIST = 5491,
STR_DEBUG_DROPDOWN_SCENARIO_OPTIONS = 5492,
STR_PLAYER_LIST = 6002,
STR_PLAYER = 6003,
STR_PING = 6004,
// Have to include resource strings (from scenarios and objects) for the time being now that language is partially working
STR_COUNT = 32768
};
+17
View File
@@ -434,3 +434,20 @@ void news_item_disable_news(uint8 type, uint32 assoc)
}
}
void news_item_add_to_queue_custom(rct_news_item *newNewsItem)
{
int i = 0;
rct_news_item *newsItem = RCT2_ADDRESS(RCT2_ADDRESS_NEWS_ITEM_LIST, rct_news_item);
// Find first open slot
while (newsItem->type != NEWS_ITEM_NULL) {
if (newsItem + 1 >= (rct_news_item*)0x013CB1CC)
news_item_close_current();
else
newsItem++;
}
*newsItem = *newNewsItem;
newsItem++;
newsItem->type = 0;
}
+2
View File
@@ -66,4 +66,6 @@ bool news_item_is_empty(int index);
bool news_item_is_queue_empty();
bool news_item_is_valid_idx(int index);
void news_item_add_to_queue_custom(rct_news_item *newNewsItem);
#endif
File diff suppressed because it is too large. Load diff
+238
View File
@@ -0,0 +1,238 @@
/*****************************************************************************
* Copyright (c) 2014 Ted John
* 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/>.
*****************************************************************************/
#ifndef _NETWORK_H_
#define _NETWORK_H_
#ifndef DISABLE_NETWORK
#define NETWORK_DEFAULT_PORT 11753
enum {
NETWORK_MODE_NONE,
NETWORK_MODE_CLIENT,
NETWORK_MODE_SERVER
};
enum {
NETWORK_AUTH_NONE,
NETWORK_AUTH_REQUESTED,
NETWORK_AUTH_OK,
NETWORK_AUTH_BADVERSION,
NETWORK_AUTH_BADNAME,
NETWORK_AUTH_BADPASSWORD
};
enum {
NETWORK_PLAYER_FLAG_ISSERVER = 1 << 0,
};
#ifdef __cplusplus
#include <list>
#include <memory>
#include <vector>
#include <SDL.h>
extern "C" {
#include "../common.h"
#include "../platform/platform.h"
}
template <std::size_t size>
struct ByteSwapT { };
template <>
struct ByteSwapT<1> { static uint8 SwapBE(uint8 value) { return value; } };
template <>
struct ByteSwapT<2> { static uint16 SwapBE(uint16 value) { return SDL_SwapBE16(value); } };
template <>
struct ByteSwapT<4> { static uint32 SwapBE(uint32 value) { return SDL_SwapBE32(value); } };
template <typename T>
T ByteSwapBE(const T& value) { return ByteSwapT<sizeof(T)>::SwapBE(value); }
class NetworkPacket
{
public:
NetworkPacket();
static std::unique_ptr<NetworkPacket> Allocate();
static std::unique_ptr<NetworkPacket> Duplicate(NetworkPacket& packet);
uint8* GetData();
template <typename T>
NetworkPacket& operator<<(T value) { T swapped = ByteSwapBE(value); uint8* bytes = (uint8*)&swapped; data->insert(data->end(), bytes, bytes + sizeof(value)); return *this; }
void Write(uint8* bytes, unsigned int size);
void WriteString(const char* string);
template <typename T>
NetworkPacket& operator>>(T& value) { if (read + sizeof(value) > size) { value = 0; } else { value = ByteSwapBE(*((T*)&GetData()[read])); read += sizeof(value); } return *this; };
const uint8* Read(unsigned int size);
const char* ReadString();
void Clear();
uint16 size;
std::shared_ptr<std::vector<uint8>> data;
int transferred;
int read;
};
class NetworkPlayer
{
public:
NetworkPlayer(const char* name);
uint8 id;
uint8 name[32 + 1];
uint16 ping;
uint32 flags;
};
class NetworkConnection
{
public:
NetworkConnection();
int ReadPacket();
void QueuePacket(std::unique_ptr<NetworkPacket> packet);
void SendQueuedPackets();
SOCKET socket;
NetworkPacket inboundpacket;
int authstatus;
NetworkPlayer* player;
uint32 ping_time;
private:
int SendPacket(NetworkPacket& packet);
std::list<std::unique_ptr<NetworkPacket>> outboundpackets;
};
class Network
{
public:
Network();
~Network();
bool Init();
void Close();
bool BeginClient(const char* host, unsigned short port);
bool BeginServer(unsigned short port);
int GetMode();
int GetAuthStatus();
uint32 GetServerTick();
uint8 GetPlayerID();
void Update();
NetworkPlayer* GetPlayerByID(int id);
const char* FormatChat(NetworkPlayer* fromplayer, const char* text);
void SendPacketToClients(NetworkPacket& packet);
bool CheckSRAND(uint32 tick, uint32 srand0);
void Client_Send_AUTH(const char* gameversion, const char* name, const char* password);
void Server_Send_MAP(NetworkConnection* connection = nullptr);
void Client_Send_CHAT(const char* text);
void Server_Send_CHAT(const char* text);
void Client_Send_GAMECMD(uint32 eax, uint32 ebx, uint32 ecx, uint32 edx, uint32 esi, uint32 edi, uint32 ebp, uint8 callback);
void Server_Send_GAMECMD(uint32 eax, uint32 ebx, uint32 ecx, uint32 edx, uint32 esi, uint32 edi, uint32 ebp, uint8 playerid, uint8 callback);
void Server_Send_TICK();
void Server_Send_PLAYERLIST();
void Client_Send_PING();
void Server_Send_PING();
void Server_Send_PINGLIST();
std::vector<std::unique_ptr<NetworkPlayer>> player_list;
private:
bool ProcessConnection(NetworkConnection& connection);
void ProcessPacket(NetworkConnection& connection, NetworkPacket& packet);
void ProcessGameCommandQueue();
void AddClient(SOCKET socket);
void RemoveClient(std::unique_ptr<NetworkConnection>& connection);
NetworkPlayer* AddPlayer(const char* name);
void PrintError();
struct GameCommand
{
GameCommand(uint32 t, uint32* args, uint8 p, uint8 cb) { tick = t, eax = args[0], ebx = args[1], ecx = args[2], edx = args[3], esi = args[4], edi = args[5], ebp = args[6]; playerid = p; callback = cb; };
uint32 tick;
uint32 eax, ebx, ecx, edx, esi, edi, ebp;
uint8 playerid;
uint8 callback;
bool operator<(const GameCommand& comp) const {
return tick < comp.tick;
}
};
int mode;
bool wsa_initialized;
SOCKET server_socket;
SOCKET listening_socket;
NetworkConnection server_connection;
uint32 last_tick_sent_time;
uint32 last_ping_sent_time;
uint32 server_tick;
uint32 server_srand0;
uint32 server_srand0_tick;
uint8 player_id;
std::list<std::unique_ptr<NetworkConnection>> client_connection_list;
std::multiset<GameCommand> game_command_queue;
std::vector<uint8> chunk_buffer;
char password[33];
private:
std::vector<int (Network::*)(NetworkConnection& connection, NetworkPacket& packet)> client_command_handlers;
std::vector<int (Network::*)(NetworkConnection& connection, NetworkPacket& packet)> server_command_handlers;
int Client_Handle_AUTH(NetworkConnection& connection, NetworkPacket& packet);
int Server_Handle_AUTH(NetworkConnection& connection, NetworkPacket& packet);
int Client_Handle_MAP(NetworkConnection& connection, NetworkPacket& packet);
int Client_Handle_CHAT(NetworkConnection& connection, NetworkPacket& packet);
int Server_Handle_CHAT(NetworkConnection& connection, NetworkPacket& packet);
int Client_Handle_GAMECMD(NetworkConnection& connection, NetworkPacket& packet);
int Server_Handle_GAMECMD(NetworkConnection& connection, NetworkPacket& packet);
int Client_Handle_TICK(NetworkConnection& connection, NetworkPacket& packet);
int Client_Handle_PLAYERLIST(NetworkConnection& connection, NetworkPacket& packet);
int Client_Handle_PING(NetworkConnection& connection, NetworkPacket& packet);
int Server_Handle_PING(NetworkConnection& connection, NetworkPacket& packet);
int Client_Handle_PINGLIST(NetworkConnection& connection, NetworkPacket& packet);
};
extern "C" {
#endif
int network_init();
void network_close();
int network_begin_client(const char *host, int port);
int network_begin_server(int port);
void network_update();
int network_get_mode();
int network_get_authstatus();
uint32 network_get_server_tick();
uint8 network_get_player_id();
int network_get_num_players();
const char* network_get_player_name(unsigned int index);
uint32 network_get_player_flags(unsigned int index);
int network_get_player_ping(unsigned int index);
void network_send_map();
void network_send_chat(const char* text);
void network_send_gamecmd(uint32 eax, uint32 ebx, uint32 ecx, uint32 edx, uint32 esi, uint32 edi, uint32 ebp, uint8 callback);
void network_print_error();
#ifdef __cplusplus
}
#endif
#endif /* DISABLE_NETWORK */
#endif
+18 -5
View File
@@ -26,10 +26,12 @@
#include "editor.h"
#include "game.h"
#include "hook.h"
#include "interface/chat.h"
#include "interface/window.h"
#include "interface/viewport.h"
#include "localisation/localisation.h"
#include "network/http.h"
#include "network/network.h"
#include "openrct2.h"
#include "platform/platform.h"
#include "ride/ride.h"
@@ -168,10 +170,10 @@ bool openrct2_initialise()
config_save_default();
// TODO add configuration option to allow multiple instances
if (!gOpenRCT2Headless && !platform_lock_single_instance()) {
log_fatal("OpenRCT2 is already running.");
return false;
}
// if (!gOpenRCT2Headless && !platform_lock_single_instance()) {
// log_fatal("OpenRCT2 is already running.");
// return false;
// }
get_system_info();
if (!gOpenRCT2Headless) {
@@ -200,6 +202,8 @@ bool openrct2_initialise()
if (!rct2_init())
return false;
chat_init();
openrct2_copy_original_user_files_over();
// TODO move to audio initialise function
@@ -248,7 +252,14 @@ void openrct2_launch()
editor_load_landscape(gOpenRCT2StartupActionPath);
}
break;
}
}
if (gNetworkStart == NETWORK_MODE_CLIENT) {
network_begin_client(gNetworkStartHost, gNetworkStartPort);
} else if (gNetworkStart == NETWORK_MODE_SERVER) {
network_begin_server(gNetworkStartPort);
}
openrct2_loop();
}
openrct2_dispose();
@@ -259,6 +270,7 @@ void openrct2_launch()
void openrct2_dispose()
{
network_close();
http_dispose();
language_close_all();
platform_free();
@@ -360,6 +372,7 @@ static void openrct2_loop()
invalidate_sprite(&g_sprite_list[i]);
sprite_move(_spritelocations2[i].x, _spritelocations2[i].y, _spritelocations2[i].z, &g_sprite_list[i]);
}
network_update();
} else {
uncapTick = 0;
currentTick = SDL_GetTicks();
+1 -1
View File
@@ -3739,7 +3739,7 @@ static void peep_update_entering_park(rct_peep* peep){
peep_window_state_update(peep);
peep->var_2A = 0;
peep->time_in_park = RCT2_GLOBAL(RCT2_ADDRESS_SCENARIO_TICKS, sint32);
peep->time_in_park = RCT2_GLOBAL(RCT2_ADDRESS_SCENARIO_TICKS, uint32);
RCT2_GLOBAL(RCT2_ADDRESS_GUESTS_IN_PARK, uint16)++;
RCT2_GLOBAL(RCT2_ADDRESS_GUESTS_HEADING_FOR_PARK, uint16)--;
RCT2_GLOBAL(RCT2_ADDRESS_BTM_TOOLBAR_DIRTY_FLAGS, uint16) |= BTM_TB_DIRTY_FLAG_PEEP_COUNT;
+4 -1
View File
@@ -29,6 +29,7 @@
#include "drawing/drawing.h"
#include "editor.h"
#include "game.h"
#include "interface/chat.h"
#include "interface/console.h"
#include "interface/viewport.h"
#include "intro.h"
@@ -74,7 +75,7 @@ int rct2_init()
{
log_verbose("initialising game");
RCT2_GLOBAL(RCT2_ADDRESS_SCENARIO_TICKS, int) = 0;
RCT2_GLOBAL(RCT2_ADDRESS_SCENARIO_TICKS, uint32) = 0;
RCT2_GLOBAL(0x009AC310, char*) = RCT2_GLOBAL(RCT2_ADDRESS_CMDLINE, char*);
get_system_time();
srand((unsigned int)time(0));
@@ -228,6 +229,7 @@ void rct2_draw()
update_rain_animation();
update_palette_effects();
chat_draw();
console_draw(RCT2_ADDRESS(RCT2_ADDRESS_SCREEN_DPI, rct_drawpixelinfo));
if (RCT2_GLOBAL(RCT2_ADDRESS_RUN_INTRO_TICK_PART, uint8) != 0) {
@@ -381,6 +383,7 @@ void rct2_update_2()
stop_completed_sounds(); // removes other sounds that are no longer playing in directsound
twitch_update();
chat_update();
console_update();
}
+14 -3
View File
@@ -32,6 +32,7 @@
#include "../management/finance.h"
#include "../management/marketing.h"
#include "../management/news_item.h"
#include "../network/network.h"
#include "../peep/peep.h"
#include "../peep/staff.h"
#include "../rct1.h"
@@ -812,7 +813,7 @@ int ride_create_ride(ride_list_item listItem)
edx = *((uint16*)&listItem);
eax = 0;
ecx = 0;
ebx = 1;
ebx = GAME_COMMAND_FLAG_APPLY;
edi = 0;
esi = 0;
@@ -831,9 +832,12 @@ void ride_construct_new(ride_list_item listItem)
{
int rideIndex;
game_command_callback = game_command_callback_ride_construct_new;
rideIndex = ride_create_ride(listItem);
if (rideIndex != -1)
ride_construct(rideIndex);
// moved to game_command_callback_ride_construct_new:
/*if (rideIndex != -1)
ride_construct(rideIndex);*/
}
/**
@@ -5072,6 +5076,13 @@ void game_command_create_ride(int *eax, int *ebx, int *ecx, int *edx, int *esi,
*ebx = ride_create(*edx & 0xFF, (*edx >> 8) & 0xFF, *ebx & 0xFF, edi);
}
void game_command_callback_ride_construct_new(int eax, int ebx, int ecx, int edx, int esi, int edi, int ebp)
{
int rideIndex = edi;
if (rideIndex != -1)
ride_construct(rideIndex);
}
/**
*
* rct2: 0x006B49D9
+2 -1
View File
@@ -858,7 +858,7 @@ enum {
#define STATION_DEPART_MASK (~STATION_DEPART_FLAG)
// rct2: 0x009ACFA4
rct_ride_type **gRideTypeList;
extern rct_ride_type **gRideTypeList;
// rct2: 0x013628F8
extern rct_ride* g_ride_list;
@@ -960,6 +960,7 @@ void game_command_set_ride_name(int *eax, int *ebx, int *ecx, int *edx, int *esi
void game_command_set_ride_setting(int *eax, int *ebx, int *ecx, int *edx, int *esi, int *edi, int *ebp);
int ride_get_refund_price(int ride_id);
void game_command_create_ride(int *eax, int *ebx, int *ecx, int *edx, int *esi, int *edi, int *ebp);
void game_command_callback_ride_construct_new(int eax, int ebx, int ecx, int edx, int esi, int edi, int ebp);
void game_command_demolish_ride(int *eax, int *ebx, int *ecx, int *edx, int *esi, int *edi, int *ebp);
void game_command_set_ride_appearance(int *eax, int *ebx, int *ecx, int *edx, int *esi, int *edi, int *ebp);
void game_command_set_ride_price(int *eax, int *ebx, int *ecx, int *edx, int *esi, int *edi, int *ebp);
+9 -9
View File
@@ -1963,7 +1963,7 @@ int sub_6D2189(int* cost, uint8* ride_id){
entry_index = 0xFF;
int eax = 0, ebx, ecx = 0, edx, esi, edi = 0, ebp = 0;
ebx = 41;
ebx = GAME_COMMAND_FLAG_APPLY | GAME_COMMAND_FLAG_ALLOW_DURING_PAUSED | GAME_COMMAND_FLAG_5;
edx = track_design->type | (entry_index << 8);
esi = GAME_COMMAND_CREATE_RIDE;
@@ -3185,7 +3185,7 @@ void game_command_place_track_design(int* eax, int* ebx, int* ecx, int* edx, int
RCT2_GLOBAL(0x009DEA60, sint16) = y + 16;
RCT2_GLOBAL(0x009DEA62, sint16) = z;
if (!(flags & (1 << 3))){
if (!(flags & GAME_COMMAND_FLAG_ALLOW_DURING_PAUSED)){
if (RCT2_GLOBAL(RCT2_ADDRESS_GAME_PAUSED, uint8) != 0 && !gConfigCheat.build_in_pause_mode){
RCT2_GLOBAL(0x00141E9AC, rct_string_id) = STR_CONSTRUCTION_NOT_POSSIBLE_WHILE_GAME_IS_PAUSED;
*ebx = MONEY32_UNDEFINED;
@@ -3232,7 +3232,7 @@ void game_command_place_track_design(int* eax, int* ebx, int* ecx, int* edx, int
}
else{
uint8 bl = 0;
if (flags & (1 << 6)){
if (flags & GAME_COMMAND_FLAG_GHOST){
bl = 4;
}
else{
@@ -3506,7 +3506,7 @@ static money32 track_place(int rideIndex, int type, int originX, int originY, in
if (!sub_68B044()) {
return MONEY32_UNDEFINED;
}
if (!(flags & (1 << 3))) {
if (!(flags & GAME_COMMAND_FLAG_ALLOW_DURING_PAUSED)) {
if (RCT2_GLOBAL(RCT2_ADDRESS_GAME_PAUSED, uint8) != 0 && !gConfigCheat.build_in_pause_mode) {
RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, rct_string_id) = STR_CONSTRUCTION_NOT_POSSIBLE_WHILE_GAME_IS_PAUSED;
return MONEY32_UNDEFINED;
@@ -3638,7 +3638,7 @@ static money32 track_place(int rideIndex, int type, int originX, int originY, in
RCT2_GLOBAL(0x00F44060, void*) = &clearance_struct;
if (!gCheatsDisableClearanceChecks) {
if (!gCheatsDisableClearanceChecks || flags & GAME_COMMAND_FLAG_GHOST){
if (!map_can_construct_with_clear_at(x, y, baseZ, clearanceZ, (void*)0x006C5A5F, bl))
return MONEY32_UNDEFINED;
}
@@ -3649,7 +3649,7 @@ static money32 track_place(int rideIndex, int type, int originX, int originY, in
// push baseZ and clearanceZ
int cur_z = baseZ * 8;
if ((flags & GAME_COMMAND_FLAG_APPLY) && !(flags & (1 << 3))) {
if ((flags & GAME_COMMAND_FLAG_APPLY) && !(flags & GAME_COMMAND_FLAG_ALLOW_DURING_PAUSED)) {
footpath_remove_litter(x, y, z);
// push bl bh??
if (rideTypeFlags & RIDE_TYPE_FLAG_18) {
@@ -3755,7 +3755,7 @@ static money32 track_place(int rideIndex, int type, int originX, int originY, in
if (entranceDirections & 0x20) {
entranceDirections &= 0x0F;
if (entranceDirections != 0) {
if (!(flags & GAME_COMMAND_FLAG_APPLY) && !(flags & 0x40)) {
if (!(flags & GAME_COMMAND_FLAG_APPLY) && !(flags & GAME_COMMAND_FLAG_GHOST)) {
uint8 _bl = entranceDirections;
for (int dl = bitscanforward(_bl); dl != -1; dl = bitscanforward(_bl)){
_bl &= ~(1 << dl);
@@ -3836,7 +3836,7 @@ static money32 track_place(int rideIndex, int type, int originX, int originY, in
entranceDirections = 0;
if (ride->overall_view != 0xFFFF){
if (!(flags & (1 << 5))){
if (!(flags & GAME_COMMAND_FLAG_5)){
if (ride_type_has_flag(ride->type, RIDE_TYPE_FLAG_FLAT_RIDE)) {
entranceDirections = RCT2_ADDRESS(0x0099CA64, uint8)[type * 16];
}
@@ -3863,7 +3863,7 @@ static money32 track_place(int rideIndex, int type, int originX, int originY, in
mapElement->properties.track.ride_index = rideIndex;
mapElement->properties.track.type = type;
mapElement->properties.track.colour = 0;
if (flags & (1 << 6)){
if (flags & GAME_COMMAND_FLAG_GHOST){
mapElement->flags |= MAP_ELEMENT_FLAG_GHOST;
}
+66
View File
@@ -979,6 +979,72 @@ int scenario_save(SDL_RWops* rw, int flags)
return 1;
}
// Save game state without modifying any of the state for multiplayer
int scenario_save_network(SDL_RWops* rw)
{
rct_window *w;
rct_viewport *viewport;
int viewX, viewY, viewZoom, viewRotation;
/*map_reorganise_elements();
reset_0x69EBE4();
sprite_clear_all_unused();
sub_677552();
sub_674BCF();*/
// Set saved view
w = window_get_main();
if (w != NULL) {
viewport = w->viewport;
viewX = viewport->view_width / 2 + viewport->view_x;
viewY = viewport->view_height / 2 + viewport->view_y;
viewZoom = viewport->zoom;
viewRotation = RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_ROTATION, uint8);
} else {
viewX = 0;
viewY = 0;
viewZoom = 0;
viewRotation = 0;
}
RCT2_GLOBAL(RCT2_ADDRESS_SAVED_VIEW_X, uint16) = viewX;
RCT2_GLOBAL(RCT2_ADDRESS_SAVED_VIEW_Y, uint16) = viewY;
RCT2_GLOBAL(RCT2_ADDRESS_SAVED_VIEW_ZOOM_AND_ROTATION, uint16) = viewZoom | (viewRotation << 8);
// Prepare S6
rct_s6_data *s6 = malloc(sizeof(rct_s6_data));
s6->header.type = S6_TYPE_SAVEDGAME;
s6->header.num_packed_objects = scenario_get_num_packed_objects_to_write();
s6->header.version = S6_RCT2_VERSION;
s6->header.magic_number = S6_MAGIC_NUMBER;
memcpy(&s6->info, (rct_s6_info*)0x0141F570, sizeof(rct_s6_info));
for (int i = 0; i < 721; i++) {
uint32 chunkPtr = RCT2_ADDRESS(0x009ACFA4, uint32)[i];
rct_object_entry_extended *entry = &(RCT2_ADDRESS(0x00F3F03C, rct_object_entry_extended)[i]);
if (RCT2_ADDRESS(0x009ACFA4, uint32)[i] == 0xFFFFFFFF) {
memset(&s6->objects[i], 0xFF, sizeof(rct_object_entry));
} else {
s6->objects[i] = *((rct_object_entry*)entry);
}
}
memcpy(&s6->elapsed_months, (void*)0x00F663A8, 16);
memcpy(s6->map_elements, (void*)0x00F663B8, 0x180000);
memcpy(&s6->dword_010E63B8, (void*)0x010E63B8, 0x2E8570);
scenario_fix_ghosts(s6);
scenario_save_s6(rw, s6);
free(s6);
gfx_invalidate_screen();
return 1;
}
bool scenario_save_s6(SDL_RWops* rw, rct_s6_data *s6)
{
char *buffer;
+1
View File
@@ -427,6 +427,7 @@ unsigned int scenario_rand();
unsigned int scenario_rand_max(unsigned int max);
int scenario_prepare_for_save();
int scenario_save(SDL_RWops* rw, int flags);
int scenario_save_network(SDL_RWops* rw);
bool scenario_save_s6(SDL_RWops* rw, rct_s6_data *s6);
void scenario_set_filename(const char *value);
void scenario_failure();
+1 -1
View File
@@ -420,7 +420,7 @@ static void window_game_bottom_toolbar_draw_park_rating(rct_drawpixelinfo *dpi,
bar_width = (factor * (90 + WIDTH_MOD)) / 256;
gfx_fill_rect_inset(dpi, x, y + 1, x + (93 + WIDTH_MOD), y + 9, w->colours[1], 48);
if (!(colour & 0x80000000) || RCT2_GLOBAL(RCT2_ADDRESS_GAME_PAUSED, uint8) != 0 || (RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_TICKS, uint8) & 8)) {
if (!(colour & 0x80000000) || RCT2_GLOBAL(RCT2_ADDRESS_GAME_PAUSED, uint8) != 0 || (RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_TICKS, uint32) & 8)) {
if (bar_width > 2)
gfx_fill_rect_inset(dpi, x + 2, y + 2, x + bar_width - 1, y + 8, colour & 0x7FFFFFFF, 0);
}
+145
View File
@@ -0,0 +1,145 @@
/*****************************************************************************
* Copyright (c) 2014 Ted John
* 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 "../interface/themes.h"
#include "../interface/widget.h"
#include "../interface/window.h"
#include "../localisation/localisation.h"
#include "../network/network.h"
enum WINDOW_NETWORK_STATUS_WIDGET_IDX {
WIDX_BACKGROUND,
WIDX_TITLE,
WIDX_CLOSE,
};
static rct_widget window_network_status_widgets[] = {
{ WWT_FRAME, 0, 0, 340, 0, 90, 0x0FFFFFFFF, STR_NONE }, // panel / background
{ WWT_CAPTION, 0, 1, 338, 1, 14, STR_NONE, STR_WINDOW_TITLE_TIP }, // title bar
{ WWT_CLOSEBOX, 0, 327, 337, 2, 13, STR_CLOSE_X, STR_CLOSE_WINDOW_TIP }, // close x button
{ WIDGETS_END },
};
static char window_network_status_text[1024];
static void window_network_status_mouseup(rct_window *w, int widgetIndex);
static void window_network_status_update(rct_window *w);
static void window_network_status_invalidate(rct_window *w);
static void window_network_status_paint(rct_window *w, rct_drawpixelinfo *dpi);
static rct_window_event_list window_network_status_events = {
NULL,
window_network_status_mouseup,
NULL,
NULL,
NULL,
NULL,
window_network_status_update,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
window_network_status_invalidate,
window_network_status_paint,
NULL
};
void window_network_status_open(const char* text)
{
rct_window* window;
strncpy(window_network_status_text, text, sizeof(window_network_status_text));
// Check if window is already open
window = window_bring_to_front_by_class(WC_NETWORK_STATUS);
if (window != NULL)
return;
window = window_create_centred(320, 90, &window_network_status_events, WC_NETWORK_STATUS, WF_10 | WF_TRANSPARENT);
window->widgets = window_network_status_widgets;
window->enabled_widgets = 1 << WIDX_CLOSE;
window_init_scroll_widgets(window);
window->no_list_items = 0;
window->selected_list_item = -1;
window->frame_no = 0;
window->min_width = 320;
window->min_height = 90;
window->max_width = window->min_width;
window->max_height = window->min_height;
window->page = 0;
window->list_information_type = 0;
window->colours[0] = 7;
window->colours[1] = 7;
window->colours[2] = 7;
}
static void window_network_status_mouseup(rct_window *w, int widgetIndex)
{
switch (widgetIndex) {
case WIDX_CLOSE:
window_close(w);
break;
}
}
static void window_network_status_update(rct_window *w)
{
widget_invalidate(w, WIDX_BACKGROUND);
}
static void window_network_status_invalidate(rct_window *w)
{
window_network_status_widgets[WIDX_BACKGROUND].right = w->width - 1;
window_network_status_widgets[WIDX_BACKGROUND].bottom = w->height - 1;
window_network_status_widgets[WIDX_TITLE].right = w->width - 2;
window_network_status_widgets[WIDX_CLOSE].left = w->width - 2 - 0x0B;
window_network_status_widgets[WIDX_CLOSE].right = w->width - 2 - 0x0B + 0x0A;
}
static void window_network_status_paint(rct_window *w, rct_drawpixelinfo *dpi)
{
window_draw_widgets(w, dpi);
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_FONT_SPRITE_BASE, uint16) = 224;
char buffer[sizeof(window_network_status_text) + 10];
char* lineCh = buffer;
lineCh = utf8_write_codepoint(lineCh, FORMAT_BLACK);
strcpy(lineCh, window_network_status_text);
gfx_clip_string(buffer, 230);
int x = w->x + (w->width / 2);
int y = w->y + (w->height / 2);
x -= gfx_get_string_width(buffer) / 2;
gfx_draw_string(dpi, buffer, 0, x, y);
}
+269
View File
@@ -0,0 +1,269 @@
/*****************************************************************************
* Copyright (c) 2014 Ted John
* 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 "../interface/themes.h"
#include "../interface/widget.h"
#include "../interface/window.h"
#include "../localisation/localisation.h"
#include "../network/network.h"
enum WINDOW_PLAYER_LIST_WIDGET_IDX {
WIDX_BACKGROUND,
WIDX_TITLE,
WIDX_CLOSE,
WIDX_CONTENT_PANEL,
WIDX_TAB1,
WIDX_LIST,
};
static rct_widget window_player_list_widgets[] = {
{ WWT_FRAME, 0, 0, 339, 0, 239, 0x0FFFFFFFF, STR_NONE }, // panel / background
{ WWT_CAPTION, 0, 1, 338, 1, 14, STR_PLAYER_LIST, STR_WINDOW_TITLE_TIP }, // title bar
{ WWT_CLOSEBOX, 0, 327, 337, 2, 13, STR_CLOSE_X, STR_CLOSE_WINDOW_TIP }, // close x button
{ WWT_RESIZE, 1, 0, 339, 43, 239, 0x0FFFFFFFF, STR_NONE }, // content panel
{ WWT_TAB, 1, 3, 33, 17, 43, 0x02000144E, STR_NONE }, // tab
{ WWT_SCROLL, 1, 3, 336, 60, 236, 2, STR_NONE }, // list
{ WIDGETS_END },
};
static void window_player_list_mouseup(rct_window *w, int widgetIndex);
static void window_player_list_resize(rct_window *w);
static void window_player_list_mousedown(int widgetIndex, rct_window* w, rct_widget* widget);
static void window_player_list_update(rct_window *w);
static void window_player_list_scrollgetsize(rct_window *w, int scrollIndex, int *width, int *height);
static void window_player_list_scrollmouseover(rct_window *w, int scrollIndex, int x, int y);
static void window_player_list_invalidate(rct_window *w);
static void window_player_list_paint(rct_window *w, rct_drawpixelinfo *dpi);
static void window_player_list_scrollpaint(rct_window *w, rct_drawpixelinfo *dpi, int scrollIndex);
static rct_window_event_list window_player_list_events = {
NULL,
window_player_list_mouseup,
window_player_list_resize,
window_player_list_mousedown,
NULL,
NULL,
window_player_list_update,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
window_player_list_scrollgetsize,
NULL,
NULL,
window_player_list_scrollmouseover,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
window_player_list_invalidate,
window_player_list_paint,
window_player_list_scrollpaint
};
static void window_player_list_refresh_list(rct_window *w);
void window_player_list_open()
{
rct_window* window;
// Check if window is already open
window = window_bring_to_front_by_class(WC_PLAYER_LIST);
if (window != NULL)
return;
window = window_create_auto_pos(320, 144, &window_player_list_events, WC_PLAYER_LIST, WF_10 | WF_RESIZABLE);
window->widgets = window_player_list_widgets;
window->enabled_widgets = 1 << WIDX_CLOSE;
window_init_scroll_widgets(window);
window->no_list_items = 0;
window->selected_list_item = -1;
window->frame_no = 0;
window->min_width = 320;
window->min_height = 124;
window->max_width = 500;
window->max_height = 450;
window->page = 0;
window->list_information_type = 0;
window->colours[0] = 7;
window->colours[1] = 7;
window->colours[2] = 7;
}
static void window_player_list_mouseup(rct_window *w, int widgetIndex)
{
switch (widgetIndex) {
case WIDX_CLOSE:
window_close(w);
break;
}
}
static void window_player_list_resize(rct_window *w)
{
if (w->width < w->min_width) {
window_invalidate(w);
w->width = w->min_width;
}
if (w->height < w->min_height) {
window_invalidate(w);
w->height = w->min_height;
}
window_player_list_refresh_list(w);
}
static void window_player_list_mousedown(int widgetIndex, rct_window* w, rct_widget* widget)
{
switch (widgetIndex) {
case WIDX_TAB1:
if (w->page != widgetIndex - WIDX_TAB1) {
w->page = widgetIndex - WIDX_TAB1;
w->no_list_items = 0;
w->frame_no = 0;
w->selected_list_item = -1;
window_invalidate(w);
}
break;
}
}
static void window_player_list_update(rct_window *w)
{
widget_invalidate(w, WIDX_TAB1 + w->page);
}
static void window_player_list_scrollgetsize(rct_window *w, int scrollIndex, int *width, int *height)
{
int i;
if (w->selected_list_item != -1) {
w->selected_list_item = -1;
window_invalidate(w);
}
*height = network_get_num_players() * 10;
i = *height - window_player_list_widgets[WIDX_LIST].bottom + window_player_list_widgets[WIDX_LIST].top + 21;
if (i < 0)
i = 0;
if (i < w->scrolls[0].v_top) {
w->scrolls[0].v_top = i;
window_invalidate(w);
}
}
static void window_player_list_scrollmouseover(rct_window *w, int scrollIndex, int x, int y)
{
int index;
index = y / 10;
if (index >= w->no_list_items)
return;
w->selected_list_item = index;
window_invalidate(w);
}
static void window_player_list_invalidate(rct_window *w)
{
for (int i = 0; i < 1; i++)
w->pressed_widgets &= ~(1 << (WIDX_TAB1 + i));
w->pressed_widgets |= 1LL << (WIDX_TAB1 + w->page);
window_player_list_widgets[WIDX_BACKGROUND].right = w->width - 1;
window_player_list_widgets[WIDX_BACKGROUND].bottom = w->height - 1;
window_player_list_widgets[WIDX_CONTENT_PANEL].right = w->width - 1;
window_player_list_widgets[WIDX_CONTENT_PANEL].bottom = w->height - 1;
window_player_list_widgets[WIDX_TITLE].right = w->width - 2;
window_player_list_widgets[WIDX_CLOSE].left = w->width - 2 - 0x0B;
window_player_list_widgets[WIDX_CLOSE].right = w->width - 2 - 0x0B + 0x0A;
window_player_list_widgets[WIDX_LIST].right = w->width - 4;
window_player_list_widgets[WIDX_LIST].bottom = w->height - 0x0F;
}
static void window_player_list_paint(rct_window *w, rct_drawpixelinfo *dpi)
{
window_draw_widgets(w, dpi);
gfx_draw_string_left(dpi, STR_PLAYER, w, w->colours[2], w->x + 6, 58 - 12 + w->y + 1);
gfx_draw_string_left(dpi, STR_PING, w, w->colours[2], w->x + 246, 58 - 12 + w->y + 1);
}
static void window_player_list_scrollpaint(rct_window *w, rct_drawpixelinfo *dpi, int scrollIndex)
{
int y;
gfx_fill_rect(dpi, dpi->x, dpi->y, dpi->x + dpi->width - 1, dpi->y + dpi->height - 1, ((char*)0x0141FC48)[w->colours[1] * 8]);
y = 0;
for (int i = 0; i < network_get_num_players(); i++) {
if (y > dpi->y + dpi->height) {
break;
}
if (y + 11 >= dpi->y) {
char buffer[300];
char* lineCh = buffer;
int colour = 0;
if (i == w->selected_list_item) {
gfx_fill_rect(dpi, 0, y, 800, y + 9, 0x02000031);
strcpy(&buffer[0], network_get_player_name(i));
colour = w->colours[2];
} else {
if (network_get_player_flags(i) & NETWORK_PLAYER_FLAG_ISSERVER) {
lineCh = utf8_write_codepoint(lineCh, FORMAT_BABYBLUE);
} else {
lineCh = utf8_write_codepoint(lineCh, FORMAT_BLACK);
}
strcpy(lineCh, network_get_player_name(i));
}
gfx_clip_string(buffer, 230);
gfx_draw_string(dpi, buffer, colour, 0, y - 1);
lineCh = buffer;
int ping = network_get_player_ping(i);
if (ping <= 100) {
lineCh = utf8_write_codepoint(lineCh, FORMAT_GREEN);
} else
if (ping <= 250) {
lineCh = utf8_write_codepoint(lineCh, FORMAT_YELLOW);
} else {
lineCh = utf8_write_codepoint(lineCh, FORMAT_RED);
}
sprintf(lineCh, "%d ms", ping);
gfx_draw_string(dpi, buffer, colour, 240, y - 1);
}
y += 10;
}
}
static void window_player_list_refresh_list(rct_window *w)
{
w->no_list_items = network_get_num_players();
w->list_item_positions[0] = 0;
w->selected_list_item = -1;
window_invalidate(w);
}
+2 -1
View File
@@ -29,6 +29,7 @@
#include "../interface/widget.h"
#include "../interface/window.h"
#include "../localisation/localisation.h"
#include "../network/network.h"
#include "../ride/track.h"
#include "dropdown.h"
@@ -579,7 +580,7 @@ static void window_ride_construction_close(rct_window *w)
hide_gridlines();
uint8 rideIndex = _currentRideIndex;
if (sub_6CAF80(rideIndex, &mapElement)) {
if (sub_6CAF80(rideIndex, &mapElement) || network_get_mode() == NETWORK_MODE_CLIENT) {
window_ride_main_open(rideIndex);
} else {
int eax = RCT2_GLOBAL(RCT2_ADDRESS_GAME_PAUSED, uint8);
+51 -10
View File
@@ -65,6 +65,7 @@ enum {
WIDX_FINANCES,
WIDX_RESEARCH,
WIDX_NEWS,
WIDX_NETWORK,
WIDX_SEPARATOR,
};
@@ -105,6 +106,10 @@ typedef enum {
DDIDX_SCENARIO_OPTIONS = 4
} TOP_TOOLBAR_DEBUG_DDIDX;
typedef enum {
DDIDX_PLAYER_LIST = 0
} TOP_TOOLBAR_NETWORK_DDIDX;
enum {
DDIDX_CHEATS,
DDIDX_ENABLE_SANDBOX_MODE = 2,
@@ -129,6 +134,7 @@ static const int left_aligned_widgets_order[] = {
WIDX_ROTATE,
WIDX_VIEW_MENU,
WIDX_MAP,
WIDX_NETWORK,
};
// from right to left
@@ -179,6 +185,7 @@ static rct_widget window_top_toolbar_widgets[] = {
{ WWT_TRNBTN, 3, 0x001E, 0x003B, 0, 27, 0x20000000 | 0x15F9, 3235 }, // Finances
{ WWT_TRNBTN, 3, 0x001E, 0x003B, 0, 27, 0x20000000 | 0x15F9, 2275 }, // Research
{ WWT_TRNBTN, 3, 0x001E, 0x003B, 0, 27, 0x20000000 | 0x15F9, STR_SHOW_RECENT_MESSAGES_TIP }, // News
{ WWT_TRNBTN, 1, 0x001E, 0x003B, 0, 27, 0x20000000 | 0x15F9, 2276 }, // Network
{ WWT_EMPTY, 0, 0, 10-1, 0, 0, 0xFFFFFFFF, STR_NONE }, // Artificial widget separator
{ WIDGETS_END },
@@ -234,6 +241,8 @@ void top_toolbar_init_rotate_menu(rct_window *window, rct_widget *widget);
void top_toolbar_rotate_menu_dropdown(short dropdownIndex);
void top_toolbar_init_debug_menu(rct_window *window, rct_widget *widget);
void top_toolbar_debug_menu_dropdown(short dropdownIndex);
void top_toolbar_init_network_menu(rct_window *window, rct_widget *widget);
void top_toolbar_network_menu_dropdown(short dropdownIndex);
void toggle_footpath_window();
void toggle_land_window(rct_window *topToolbar, int widgetIndex);
@@ -461,6 +470,9 @@ static void window_top_toolbar_mousedown(int widgetIndex, rct_window*w, rct_widg
case WIDX_DEBUG:
top_toolbar_init_debug_menu(w, widget);
break;
case WIDX_NETWORK:
top_toolbar_init_network_menu(w, widget);
break;
}
}
@@ -560,6 +572,9 @@ static void window_top_toolbar_dropdown(rct_window *w, int widgetIndex, int drop
case WIDX_DEBUG:
top_toolbar_debug_menu_dropdown(dropdownIndex);
break;
case WIDX_NETWORK:
top_toolbar_network_menu_dropdown(dropdownIndex);
break;
}
}
@@ -598,6 +613,7 @@ static void window_top_toolbar_invalidate(rct_window *w)
window_top_toolbar_widgets[WIDX_CHEATS].type = WWT_TRNBTN;
window_top_toolbar_widgets[WIDX_DEBUG].type = gConfigGeneral.debugging_tools ? WWT_TRNBTN : WWT_EMPTY;
window_top_toolbar_widgets[WIDX_NEWS].type = WWT_TRNBTN;
window_top_toolbar_widgets[WIDX_NETWORK].type = WWT_TRNBTN;
if (RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & (SCREEN_FLAGS_SCENARIO_EDITOR | SCREEN_FLAGS_TRACK_DESIGNER | SCREEN_FLAGS_TRACK_MANAGER)) {
window_top_toolbar_widgets[WIDX_PAUSE].type = WWT_EMPTY;
@@ -645,7 +661,7 @@ static void window_top_toolbar_invalidate(rct_window *w)
}
enabledWidgets = 0;
for (i = WIDX_PAUSE; i <= WIDX_NEWS; i++)
for (i = WIDX_PAUSE; i <= WIDX_NETWORK; i++)
if (window_top_toolbar_widgets[i].type != WWT_EMPTY)
enabledWidgets |= (1 << i);
w->enabled_widgets = enabledWidgets;
@@ -1637,13 +1653,11 @@ void top_toolbar_tool_update_scenery_clear(sint16 x, sint16 y){
if (!state_changed)
return;
money32 cost = map_clear_scenery(
RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_A_X, sint16),
RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_A_Y, sint16),
RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_B_X, sint16),
RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_B_Y, sint16),
0
);
int eax = RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_A_X, sint16);
int ecx = RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_A_Y, sint16);
int edi = RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_B_X, sint16);
int ebp = RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_B_Y, sint16);
money32 cost = game_do_command(eax, 0, ecx, 0, GAME_COMMAND_CLEAR_SCENERY, edi, ebp);
if (RCT2_GLOBAL(0x00F1AD62, money32) != cost){
RCT2_GLOBAL(0x00F1AD62, money32) = cost;
@@ -2472,7 +2486,7 @@ static void window_top_toolbar_tool_down(rct_window* w, int widgetIndex, int x,
RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_A_X, sint16),
1,
RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_A_Y, sint16),
0,
(gClearSmallScenery | gClearLargeScenery << 1 | gClearFootpath << 2),
GAME_COMMAND_CLEAR_SCENERY,
RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_B_X, sint16),
RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_B_Y, sint16)
@@ -2681,7 +2695,7 @@ static void window_top_toolbar_tool_drag(rct_window* w, int widgetIndex, int x,
RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_A_X, sint16),
1,
RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_A_Y, sint16),
0,
(gClearSmallScenery | gClearLargeScenery << 1 | gClearFootpath << 2),
GAME_COMMAND_CLEAR_SCENERY,
RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_B_X, sint16),
RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_B_Y, sint16)
@@ -2862,6 +2876,21 @@ void top_toolbar_init_debug_menu(rct_window* w, rct_widget* widget) {
RCT2_GLOBAL(0x9DEBA2, uint16) = 0;
}
void top_toolbar_init_network_menu(rct_window* w, rct_widget* widget) {
gDropdownItemsFormat[0] = STR_PLAYER_LIST;
window_dropdown_show_text(
w->x + widget->left,
w->y + widget->top,
widget->bottom - widget->top + 1,
w->colours[1] | 0x80,
0,
1
);
RCT2_GLOBAL(0x9DEBA2, uint16) = 0;
}
void top_toolbar_debug_menu_dropdown(short dropdownIndex) {
if (dropdownIndex == -1) dropdownIndex = RCT2_GLOBAL(0x9DEBA2, uint16);
rct_window* w = window_get_main();
@@ -2887,6 +2916,18 @@ void top_toolbar_debug_menu_dropdown(short dropdownIndex) {
}
}
void top_toolbar_network_menu_dropdown(short dropdownIndex) {
if (dropdownIndex == -1) dropdownIndex = RCT2_GLOBAL(0x9DEBA2, uint16);
rct_window* w = window_get_main();
if (w) {
switch (dropdownIndex) {
case DDIDX_PLAYER_LIST:
window_player_list_open();
break;
}
}
}
/**
*
* rct2: 0x0066CDE4
+1 -1
View File
@@ -168,7 +168,7 @@ void climate_update()
RCT2_GLOBAL(RCT2_ADDRESS_CLIMATE_UPDATE_TIMER, sint16)--;
} else if (!(RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_TICKS, sint32) & 0x7F)) {
} else if (!(RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_TICKS, uint32) & 0x7F)) {
if (temperature == target_temperature) {
if (cur_gloom == next_gloom) {
+11 -12
View File
@@ -34,10 +34,6 @@ void footpath_interrupt_peeps(int x, int y, int z);
void sub_6A7642(int x, int y, rct_map_element *mapElement);
void sub_6A76E9(int rideIndex);
enum {
FOOTPATH_CONSTRUCTION_FLAG_ALLOW_DURING_PAUSED = 1 << 3
};
const rct_xy16 word_981D6C[4] = {
{ -1, 0 },
{ 0, 1 },
@@ -148,7 +144,7 @@ static money32 footpath_element_insert(int type, int x, int y, int z, int slope,
if (!sub_68B044())
return MONEY32_UNDEFINED;
if ((flags & GAME_COMMAND_FLAG_APPLY) && !(flags & (FOOTPATH_CONSTRUCTION_FLAG_ALLOW_DURING_PAUSED | (1 << 6))))
if ((flags & GAME_COMMAND_FLAG_APPLY) && !(flags & (GAME_COMMAND_FLAG_ALLOW_DURING_PAUSED | GAME_COMMAND_FLAG_GHOST)))
footpath_remove_litter(x, y, RCT2_GLOBAL(0x009DEA62, uint16));
// loc_6A649D:
@@ -320,7 +316,7 @@ static money32 footpath_place_real(int type, int x, int y, int z, int slope, int
RCT2_GLOBAL(0x009DEA60, uint16) = y + 16;
RCT2_GLOBAL(0x009DEA62, uint16) = z * 8;
if (!(flags & FOOTPATH_CONSTRUCTION_FLAG_ALLOW_DURING_PAUSED) && RCT2_GLOBAL(RCT2_ADDRESS_GAME_PAUSED, uint8) != 0 && !gConfigCheat.build_in_pause_mode) {
if (!(flags & GAME_COMMAND_FLAG_ALLOW_DURING_PAUSED) && RCT2_GLOBAL(RCT2_ADDRESS_GAME_PAUSED, uint8) != 0 && !gConfigCheat.build_in_pause_mode) {
RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, rct_string_id) = STR_CONSTRUCTION_NOT_POSSIBLE_WHILE_GAME_IS_PAUSED;
return MONEY32_UNDEFINED;
}
@@ -355,10 +351,13 @@ static money32 footpath_place_real(int type, int x, int y, int z, int slope, int
return MONEY32_UNDEFINED;
}
footpath_provisional_remove();
mapElement = map_get_footpath_element_slope((x / 32), (y / 32), z, slope);
return mapElement == NULL ?
footpath_element_insert(type, x, y, z, slope, flags) :
footpath_element_update(x, y, mapElement, type, flags);
if (mapElement == NULL) {
return footpath_element_insert(type, x, y, z, slope, flags);
} else {
return footpath_element_update(x, y, mapElement, type, flags);
}
}
/* rct2: 0x006BA23E */
@@ -381,7 +380,7 @@ money32 footpath_remove_real(int x, int y, int z, int flags)
RCT2_GLOBAL(0x009DEA60, uint16) = y + 16;
RCT2_GLOBAL(0x009DEA62, uint16) = z * 8;
if (!(flags & FOOTPATH_CONSTRUCTION_FLAG_ALLOW_DURING_PAUSED) && RCT2_GLOBAL(RCT2_ADDRESS_GAME_PAUSED, uint8) != 0 && !gConfigCheat.build_in_pause_mode) {
if (!(flags & GAME_COMMAND_FLAG_ALLOW_DURING_PAUSED) && RCT2_GLOBAL(RCT2_ADDRESS_GAME_PAUSED, uint8) != 0 && !gConfigCheat.build_in_pause_mode) {
RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, rct_string_id) = STR_CONSTRUCTION_NOT_POSSIBLE_WHILE_GAME_IS_PAUSED;
return MONEY32_UNDEFINED;
}
@@ -453,7 +452,7 @@ money32 footpath_provisional_set(int type, int x, int y, int z, int slope)
footpath_provisional_remove();
cost = footpath_place(type, x, y, z, slope, (1 << 6) | (1 << 5) | (1 << 4) | FOOTPATH_CONSTRUCTION_FLAG_ALLOW_DURING_PAUSED | GAME_COMMAND_FLAG_APPLY);
cost = footpath_place(type, x, y, z, slope, GAME_COMMAND_FLAG_GHOST | GAME_COMMAND_FLAG_5 | GAME_COMMAND_FLAG_4 | GAME_COMMAND_FLAG_ALLOW_DURING_PAUSED | GAME_COMMAND_FLAG_APPLY);
if (cost != MONEY32_UNDEFINED) {
RCT2_GLOBAL(RCT2_ADDRESS_PROVISIONAL_PATH_X, uint16) = x;
RCT2_GLOBAL(RCT2_ADDRESS_PROVISIONAL_PATH_Y, uint16) = y;
@@ -479,7 +478,7 @@ void footpath_provisional_remove()
RCT2_GLOBAL(RCT2_ADDRESS_PROVISIONAL_PATH_X, uint16),
RCT2_GLOBAL(RCT2_ADDRESS_PROVISIONAL_PATH_Y, uint16),
RCT2_GLOBAL(RCT2_ADDRESS_PROVISIONAL_PATH_Z, uint16),
(1 << 0) | FOOTPATH_CONSTRUCTION_FLAG_ALLOW_DURING_PAUSED | (1 << 5)
GAME_COMMAND_FLAG_APPLY | GAME_COMMAND_FLAG_ALLOW_DURING_PAUSED | GAME_COMMAND_FLAG_5
);
}
}
+21 -17
View File
@@ -1370,7 +1370,7 @@ void game_command_set_banner_colour(int* eax, int* ebx, int* ecx, int* edx, int*
*
* rct2: 0x0068DFE4
*/
money32 map_clear_scenery_from_tile(int x, int y, int flags)
money32 map_clear_scenery_from_tile(int x, int y, int clear, int flags)
{
int type;
money32 cost, totalCost;
@@ -1384,8 +1384,14 @@ restart_from_beginning:
type = map_element_get_type(mapElement);
switch (type) {
case MAP_ELEMENT_TYPE_PATH:
if (gClearFootpath) {
cost = footpath_remove_real(x * 32, y * 32, mapElement->base_height, flags);
if (clear & (1 << 2)) {
int eax = x * 32;
int ebx = flags;
int ecx = y * 32;
int edx = mapElement->base_height;
int edi, ebp;
cost = game_do_command(eax, ebx, ecx, edx, GAME_COMMAND_REMOVE_PATH, edi, ebp);
if (cost == MONEY32_UNDEFINED)
return MONEY32_UNDEFINED;
@@ -1394,14 +1400,13 @@ restart_from_beginning:
goto restart_from_beginning;
} break;
case MAP_ELEMENT_TYPE_SCENERY:
if (gClearSmallScenery) {
if (clear & (1 << 0)) {
int eax = x * 32;
int ebx = (mapElement->type << 8) | flags;
int ecx = y * 32;
int edx = (mapElement->properties.scenery.type << 8) | (mapElement->base_height);
int esi, edi, ebp;
game_command_remove_scenery(&eax, &ebx, &ecx, &edx, &esi, &edi, &ebp);
cost = ebx;
int edi, ebp;
cost = game_do_command(eax, ebx, ecx, edx, GAME_COMMAND_REMOVE_SCENERY, edi, ebp);
if (cost == MONEY32_UNDEFINED)
return MONEY32_UNDEFINED;
@@ -1412,14 +1417,13 @@ restart_from_beginning:
} break;
case MAP_ELEMENT_TYPE_FENCE:
if (gClearSmallScenery) {
if (clear & (1 << 0)) {
int eax = x * 32;
int ebx = flags;
int ecx = y * 32;
int edx = (mapElement->base_height << 8) | (mapElement->type & MAP_ELEMENT_DIRECTION_MASK);
int esi, edi, ebp;
game_command_remove_fence(&eax, &ebx, &ecx, &edx, &esi, &edi, &ebp);
cost = ebx;
int edi, ebp;
cost = game_do_command(eax, ebx, ecx, edx, GAME_COMMAND_REMOVE_FENCE, edi, ebp);
if (cost == MONEY32_UNDEFINED)
return MONEY32_UNDEFINED;
@@ -1430,14 +1434,13 @@ restart_from_beginning:
} break;
case MAP_ELEMENT_TYPE_SCENERY_MULTIPLE:
if (gClearLargeScenery) {
if (clear & (1 << 1)) {
int eax = x * 32;
int ebx = flags | ((mapElement->type & MAP_ELEMENT_DIRECTION_MASK) << 8);
int ecx = y * 32;
int edx = mapElement->base_height | ((mapElement->properties.scenerymultiple.type >> 10) << 8);
int esi, edi, ebp;
game_command_remove_large_scenery(&eax, &ebx, &ecx, &edx, &esi, &edi, &ebp);
cost = ebx;
int edi, ebp;
cost = game_do_command(eax, ebx, ecx, edx, GAME_COMMAND_REMOVE_LARGE_SCENERY, edi, ebp);
if (cost == MONEY32_UNDEFINED)
return MONEY32_UNDEFINED;
@@ -1454,7 +1457,7 @@ restart_from_beginning:
return totalCost;
}
money32 map_clear_scenery(int x0, int y0, int x1, int y1, int flags)
money32 map_clear_scenery(int x0, int y0, int x1, int y1, int clear, int flags)
{
int x, y, z;
money32 totalCost, cost;
@@ -1479,7 +1482,7 @@ money32 map_clear_scenery(int x0, int y0, int x1, int y1, int flags)
for (y = y0; y <= y1; y += 32) {
for (x = x0; x <= x1; x += 32) {
if ((RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & SCREEN_FLAGS_SCENARIO_EDITOR) || gCheatsSandboxMode || map_is_location_owned_or_has_rights(x, y)) {
cost = map_clear_scenery_from_tile(x / 32, y / 32, flags);
cost = map_clear_scenery_from_tile(x / 32, y / 32, clear, flags);
if (cost != MONEY32_UNDEFINED) {
noValidTiles = false;
totalCost += cost;
@@ -1504,6 +1507,7 @@ void game_command_clear_scenery(int* eax, int* ebx, int* ecx, int* edx, int* esi
(sint16)(*ecx & 0xFFFF),
(sint16)(*edi & 0xFFFF),
(sint16)(*ebp & 0xFFFF),
*edx,
*ebx & 0xFF
);
}
+1 -1
View File
@@ -301,7 +301,7 @@ int map_can_construct_with_clear_at(int x, int y, int zLow, int zHigh, void *cle
int map_can_construct_at(int x, int y, int zLow, int zHigh, uint8 bl);
void rotate_map_coordinates(sint16 *x, sint16 *y, int rotation);
rct_xy16 coordinate_3d_to_2d(const rct_xyz16* coordinate_3d, int rotation);
money32 map_clear_scenery(int x0, int y0, int x1, int y1, int flags);
money32 map_clear_scenery(int x0, int y0, int x1, int y1, int clear, 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);
money32 map_place_fence(int type, int x, int y, int z, int edge, int primaryColour, int secondaryColour, int tertiaryColour, int flags);
+1 -1
View File
@@ -539,7 +539,7 @@ void park_update()
return;
// Every 5 seconds approximately
if (RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_TICKS, uint8) % 512 == 0) {
if (RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_TICKS, uint32) % 512 == 0) {
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_PARK_RATING, uint16) = calculate_park_rating();
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_PARK_VALUE, money32) = calculate_park_value();
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_COMPANY_VALUE, money32) = calculate_company_value();