mirror of https://github.com/OpenRCT2/OpenRCT2.git
Merge pull request #2718 from OpenRCT2/normalise-platform-guards
Normalise platform guards with SDL2
This commit is contained in:
commit
45225cfa06
|
@ -21,38 +21,14 @@
|
||||||
#ifndef _ADDRESSES_H_
|
#ifndef _ADDRESSES_H_
|
||||||
#define _ADDRESSES_H_
|
#define _ADDRESSES_H_
|
||||||
|
|
||||||
|
#include "common.h"
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
#pragma warning(disable : 4731)
|
#pragma warning(disable : 4731)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define RCT2_ADDRESS(address, type) ((type*)(address))
|
#define RCT2_ADDRESS(address, type) ((type*)(address))
|
||||||
#define RCT2_GLOBAL(address, type) (*((type*)(address)))
|
#define RCT2_GLOBAL(address, type) (*((type*)(address)))
|
||||||
#ifdef _WIN32
|
|
||||||
#define RCT2_CALLPROC(address) (((void(*)())(address))())
|
|
||||||
#define RCT2_CALLFUNC(address, returnType) (((returnType(*)())(address))())
|
|
||||||
|
|
||||||
#define RCT2_CALLFUNC_1(address, returnType, a1, v1) (((returnType(*)(a1))(address))(v1))
|
|
||||||
#define RCT2_CALLFUNC_2(address, returnType, a1, a2, v1, v2) (((returnType(*)(a1, a2))(address))(v1, v2))
|
|
||||||
#define RCT2_CALLFUNC_3(address, returnType, a1, a2, a3, v1, v2, v3) (((returnType(*)(a1, a2, a3))(address))(v1, v2, v3))
|
|
||||||
#define RCT2_CALLFUNC_4(address, returnType, a1, a2, a3, a4, v1, v2, v3, v4) (((returnType(*)(a1, a2, a3, a4))(address))(v1, v2, v3, v4))
|
|
||||||
#define RCT2_CALLFUNC_5(address, returnType, a1, a2, a3, a4, a5, v1, v2, v3, v4, v5) (((returnType(*)(a1, a2, a3, a4, a5))(address))(v1, v2, v3, v4, v5))
|
|
||||||
#define RCT2_CALLFUNC_6(address, returnType, a1, a2, a3, a4, a5, a6, v1, v2, v3, v4, v5, v6) (((returnType(*)(a1, a2, a3, a4, a5, a6))(address))(v1, v2, v3, v4, v5, v6))
|
|
||||||
#else
|
|
||||||
#define RCT2_CALLPROC(address)
|
|
||||||
#define RCT2_CALLFUNC(address, returnType)
|
|
||||||
#define RCT2_CALLFUNC_1(address, returnType, a1, v1)
|
|
||||||
#define RCT2_CALLFUNC_2(address, returnType, a1, a2, v1, v2)
|
|
||||||
#define RCT2_CALLFUNC_3(address, returnType, a1, a2, a3, v1, v2, v3)
|
|
||||||
#define RCT2_CALLFUNC_4(address, returnType, a1, a2, a3, a4, v1, v2, v3, v4)
|
|
||||||
#define RCT2_CALLFUNC_5(address, returnType, a1, a2, a3, a4, a5, v1, v2, v3, v4, v5)
|
|
||||||
#define RCT2_CALLFUNC_6(address, returnType, a1, a2, a3, a4, a5, a6, v1, v2, v3, v4, v5, v6)
|
|
||||||
#endif // _WIN32
|
|
||||||
|
|
||||||
#define RCT2_CALLPROC_1(address, a1, v1) RCT2_CALLFUNC_1(address, void, a1, v1)
|
|
||||||
#define RCT2_CALLPROC_2(address, a1, a2, v1, v2) RCT2_CALLFUNC_2(address, void, a1, a2, v1, v2)
|
|
||||||
#define RCT2_CALLPROC_3(address, a1, a2, a3, v1, v2, v3) RCT2_CALLFUNC_3(address, void, a1, a2, a3, v1, v2, v3)
|
|
||||||
#define RCT2_CALLPROC_4(address, a1, a2, a3, a4, v1, v2, v3, v4) RCT2_CALLFUNC_4(address, void, a1, a2, a3, a4, v1, v2, v3, v4)
|
|
||||||
#define RCT2_CALLPROC_5(address, a1, a2, a3, a4, a5, v1, v2, v3, v4, v5) RCT2_CALLFUNC_5(address, void, a1, a2, a3, a4, a5, v1, v2, v3, v4, v5)
|
|
||||||
|
|
||||||
#pragma region Memory locations
|
#pragma region Memory locations
|
||||||
|
|
||||||
|
|
|
@ -86,7 +86,7 @@ void audio_populate_devices()
|
||||||
|
|
||||||
safe_strncpy(systemAudioDevices[i].name, utf8Name, AUDIO_DEVICE_NAME_SIZE);
|
safe_strncpy(systemAudioDevices[i].name, utf8Name, AUDIO_DEVICE_NAME_SIZE);
|
||||||
}
|
}
|
||||||
#ifndef __linux__
|
#ifndef __LINUX__
|
||||||
gAudioDeviceCount++;
|
gAudioDeviceCount++;
|
||||||
gAudioDevices = malloc(gAudioDeviceCount * sizeof(audio_device));
|
gAudioDevices = malloc(gAudioDeviceCount * sizeof(audio_device));
|
||||||
safe_strncpy(gAudioDevices[0].name, language_get_string(5510), AUDIO_DEVICE_NAME_SIZE);
|
safe_strncpy(gAudioDevices[0].name, language_get_string(5510), AUDIO_DEVICE_NAME_SIZE);
|
||||||
|
@ -94,7 +94,7 @@ void audio_populate_devices()
|
||||||
#else
|
#else
|
||||||
gAudioDevices = malloc(gAudioDeviceCount * sizeof(audio_device));
|
gAudioDevices = malloc(gAudioDeviceCount * sizeof(audio_device));
|
||||||
memcpy(gAudioDevices, systemAudioDevices, gAudioDeviceCount * sizeof(audio_device));
|
memcpy(gAudioDevices, systemAudioDevices, gAudioDeviceCount * sizeof(audio_device));
|
||||||
#endif // __linux__
|
#endif // __LINUX__
|
||||||
|
|
||||||
free(systemAudioDevices);
|
free(systemAudioDevices);
|
||||||
}
|
}
|
||||||
|
|
|
@ -510,7 +510,7 @@ namespace CommandLine
|
||||||
|
|
||||||
static bool HandleSpecialArgument(const char * argument)
|
static bool HandleSpecialArgument(const char * argument)
|
||||||
{
|
{
|
||||||
#if defined(__APPLE__) && defined(__MACH__)
|
#ifdef __MACOSX__
|
||||||
if (String::Equals(argument, "-NSDocumentRevisionsDebugMode"))
|
if (String::Equals(argument, "-NSDocumentRevisionsDebugMode"))
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -895,7 +895,7 @@ void config_apply_to_old_addresses()
|
||||||
#define CTRL 0x200
|
#define CTRL 0x200
|
||||||
#define ALT 0x400
|
#define ALT 0x400
|
||||||
#define CMD 0x800
|
#define CMD 0x800
|
||||||
#if defined(__APPLE__) && defined(__MACH__)
|
#ifdef __MACOSX__
|
||||||
#define PLATFORM_MODIFIER CMD
|
#define PLATFORM_MODIFIER CMD
|
||||||
#else
|
#else
|
||||||
#define PLATFORM_MODIFIER CTRL
|
#define PLATFORM_MODIFIER CTRL
|
||||||
|
|
|
@ -19,7 +19,7 @@ namespace Path
|
||||||
|
|
||||||
utf8 * GetAbsolute(utf8 *buffer, size_t bufferSize, const utf8 * relativePath)
|
utf8 * GetAbsolute(utf8 *buffer, size_t bufferSize, const utf8 * relativePath)
|
||||||
{
|
{
|
||||||
#if _WIN32
|
#if __WINDOWS__
|
||||||
wchar_t * relativePathW = utf8_to_widechar(relativePath);
|
wchar_t * relativePathW = utf8_to_widechar(relativePath);
|
||||||
wchar_t absolutePathW[MAX_PATH];
|
wchar_t absolutePathW[MAX_PATH];
|
||||||
DWORD length = GetFullPathNameW(relativePathW, Util::CountOf(absolutePathW), absolutePathW, NULL);
|
DWORD length = GetFullPathNameW(relativePathW, Util::CountOf(absolutePathW), absolutePathW, NULL);
|
||||||
|
|
|
@ -338,57 +338,53 @@ void gfx_redraw_screen_rect(short left, short top, short right, short bottom)
|
||||||
* height (dx)
|
* height (dx)
|
||||||
* drawpixelinfo (edi)
|
* drawpixelinfo (edi)
|
||||||
*/
|
*/
|
||||||
rct_drawpixelinfo* clip_drawpixelinfo(rct_drawpixelinfo* dpi, int left, int width, int top, int height)
|
bool clip_drawpixelinfo(rct_drawpixelinfo *dst, rct_drawpixelinfo *src, int x, int y, int width, int height)
|
||||||
{
|
{
|
||||||
rct_drawpixelinfo* newDrawPixelInfo = rct2_malloc(sizeof(rct_drawpixelinfo));
|
int right = x + width;
|
||||||
|
int bottom = y + height;
|
||||||
|
|
||||||
int right = left + width;
|
dst->bits = src->bits;
|
||||||
int bottom = top + height;
|
dst->x = src->x;
|
||||||
|
dst->y = src->y;
|
||||||
|
dst->width = src->width;
|
||||||
|
dst->height = src->height;
|
||||||
|
dst->pitch = src->pitch;
|
||||||
|
dst->zoom_level = 0;
|
||||||
|
|
||||||
newDrawPixelInfo->bits = dpi->bits;
|
if (x > dst->x) {
|
||||||
newDrawPixelInfo->x = dpi->x;
|
uint16 clippedFromLeft = x - dst->x;
|
||||||
newDrawPixelInfo->y = dpi->y;
|
dst->width -= clippedFromLeft;
|
||||||
newDrawPixelInfo->width = dpi->width;
|
dst->x = x;
|
||||||
newDrawPixelInfo->height = dpi->height;
|
dst->pitch += clippedFromLeft;
|
||||||
newDrawPixelInfo->pitch = dpi->pitch;
|
dst->bits += clippedFromLeft;
|
||||||
newDrawPixelInfo->zoom_level = 0;
|
|
||||||
|
|
||||||
if (left > newDrawPixelInfo->x) {
|
|
||||||
uint16 clippedFromLeft = left - newDrawPixelInfo->x;
|
|
||||||
newDrawPixelInfo->width -= clippedFromLeft;
|
|
||||||
newDrawPixelInfo->x = left;
|
|
||||||
newDrawPixelInfo->pitch += clippedFromLeft;
|
|
||||||
newDrawPixelInfo->bits += clippedFromLeft;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int stickOutWidth = newDrawPixelInfo->x + newDrawPixelInfo->width - right;
|
int stickOutWidth = dst->x + dst->width - right;
|
||||||
if (stickOutWidth > 0) {
|
if (stickOutWidth > 0) {
|
||||||
newDrawPixelInfo->width -= stickOutWidth;
|
dst->width -= stickOutWidth;
|
||||||
newDrawPixelInfo->pitch += stickOutWidth;
|
dst->pitch += stickOutWidth;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (top > newDrawPixelInfo->y) {
|
if (y > dst->y) {
|
||||||
uint16 clippedFromTop = top - newDrawPixelInfo->y;
|
uint16 clippedFromTop = y - dst->y;
|
||||||
newDrawPixelInfo->height -= clippedFromTop;
|
dst->height -= clippedFromTop;
|
||||||
newDrawPixelInfo->y = top;
|
dst->y = y;
|
||||||
uint32 bitsPlus = (newDrawPixelInfo->pitch + newDrawPixelInfo->width) * clippedFromTop;
|
uint32 bitsPlus = (dst->pitch + dst->width) * clippedFromTop;
|
||||||
newDrawPixelInfo->bits += bitsPlus;
|
dst->bits += bitsPlus;
|
||||||
}
|
}
|
||||||
|
|
||||||
int bp = newDrawPixelInfo->y + newDrawPixelInfo->height - bottom;
|
int bp = dst->y + dst->height - bottom;
|
||||||
if (bp > 0) {
|
if (bp > 0) {
|
||||||
newDrawPixelInfo->height -= bp;
|
dst->height -= bp;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (newDrawPixelInfo->width > 0 && newDrawPixelInfo->height > 0) {
|
if (dst->width > 0 && dst->height > 0) {
|
||||||
newDrawPixelInfo->x -= left;
|
dst->x -= x;
|
||||||
newDrawPixelInfo->y -= top;
|
dst->y -= y;
|
||||||
|
return true;
|
||||||
return newDrawPixelInfo;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
rct2_free(newDrawPixelInfo);
|
return false;
|
||||||
return NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/***
|
/***
|
||||||
|
|
|
@ -93,7 +93,7 @@ extern rct_g1_element *g1Elements;
|
||||||
extern rct_gx g2;
|
extern rct_gx g2;
|
||||||
|
|
||||||
//
|
//
|
||||||
rct_drawpixelinfo* clip_drawpixelinfo(rct_drawpixelinfo* dpi, int left, int width, int top, int height);
|
bool clip_drawpixelinfo(rct_drawpixelinfo *dst, rct_drawpixelinfo *src, int x, int y, int width, int height);
|
||||||
void gfx_set_dirty_blocks(sint16 left, sint16 top, sint16 right, sint16 bottom);
|
void gfx_set_dirty_blocks(sint16 left, sint16 top, sint16 right, sint16 bottom);
|
||||||
void gfx_draw_all_dirty_blocks();
|
void gfx_draw_all_dirty_blocks();
|
||||||
void gfx_redraw_screen_rect(short left, short top, short right, short bottom);
|
void gfx_redraw_screen_rect(short left, short top, short right, short bottom);
|
||||||
|
|
|
@ -54,7 +54,7 @@ int gfx_load_g1()
|
||||||
SDL_RWread(file, g1Elements, header.num_entries * sizeof(rct_g1_element), 1);
|
SDL_RWread(file, g1Elements, header.num_entries * sizeof(rct_g1_element), 1);
|
||||||
|
|
||||||
// Read element data
|
// Read element data
|
||||||
_g1Buffer = rct2_malloc(header.total_size);
|
_g1Buffer = malloc(header.total_size);
|
||||||
SDL_RWread(file, _g1Buffer, header.total_size, 1);
|
SDL_RWread(file, _g1Buffer, header.total_size, 1);
|
||||||
|
|
||||||
SDL_RWclose(file);
|
SDL_RWclose(file);
|
||||||
|
|
19
src/hook.c
19
src/hook.c
|
@ -18,11 +18,14 @@
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
#ifdef _WIN32
|
#include "common.h"
|
||||||
|
|
||||||
|
#ifdef __WINDOWS__
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#else
|
#else
|
||||||
#include <sys/mman.h>
|
#include <sys/mman.h>
|
||||||
#endif // _WIN32
|
#endif // __WINDOWS__
|
||||||
|
|
||||||
#include "hook.h"
|
#include "hook.h"
|
||||||
#include "platform/platform.h"
|
#include "platform/platform.h"
|
||||||
|
|
||||||
|
@ -200,19 +203,19 @@ void hookfunc(int address, int newaddress, int stacksize, int registerargs[], in
|
||||||
|
|
||||||
data[i++] = 0xC3; // retn
|
data[i++] = 0xC3; // retn
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef __WINDOWS__
|
||||||
WriteProcessMemory(GetCurrentProcess(), (LPVOID)address, data, i, 0);
|
WriteProcessMemory(GetCurrentProcess(), (LPVOID)address, data, i, 0);
|
||||||
#else
|
#else
|
||||||
// We own the pages with PROT_WRITE | PROT_EXEC, we can simply just memcpy the data
|
// We own the pages with PROT_WRITE | PROT_EXEC, we can simply just memcpy the data
|
||||||
memcpy((void *)address, data, i);
|
memcpy((void *)address, data, i);
|
||||||
#endif // _WIN32
|
#endif // __WINDOWS__
|
||||||
}
|
}
|
||||||
|
|
||||||
void addhook(int address, int newaddress, int stacksize, int registerargs[], int registersreturned, int eaxDestinationRegister)
|
void addhook(int address, int newaddress, int stacksize, int registerargs[], int registersreturned, int eaxDestinationRegister)
|
||||||
{
|
{
|
||||||
if (!g_hooktableaddress) {
|
if (!g_hooktableaddress) {
|
||||||
size_t size = g_maxhooks * 100;
|
size_t size = g_maxhooks * 100;
|
||||||
#ifdef _WIN32
|
#ifdef __WINDOWS__
|
||||||
g_hooktableaddress = VirtualAllocEx(GetCurrentProcess(), NULL, size, MEM_COMMIT, PAGE_EXECUTE_READWRITE);
|
g_hooktableaddress = VirtualAllocEx(GetCurrentProcess(), NULL, size, MEM_COMMIT, PAGE_EXECUTE_READWRITE);
|
||||||
#else
|
#else
|
||||||
g_hooktableaddress = mmap(NULL, size, PROT_EXEC | PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
|
g_hooktableaddress = mmap(NULL, size, PROT_EXEC | PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
|
||||||
|
@ -221,7 +224,7 @@ void addhook(int address, int newaddress, int stacksize, int registerargs[], int
|
||||||
perror("mmap");
|
perror("mmap");
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
#endif // _WIN32
|
#endif // __WINDOWS__
|
||||||
}
|
}
|
||||||
if (g_hooktableoffset > g_maxhooks) {
|
if (g_hooktableoffset > g_maxhooks) {
|
||||||
return;
|
return;
|
||||||
|
@ -235,12 +238,12 @@ void addhook(int address, int newaddress, int stacksize, int registerargs[], int
|
||||||
i += 4;
|
i += 4;
|
||||||
|
|
||||||
data[i++] = 0xC3; // retn
|
data[i++] = 0xC3; // retn
|
||||||
#ifdef _WIN32
|
#ifdef __WINDOWS__
|
||||||
WriteProcessMemory(GetCurrentProcess(), (LPVOID)address, data, i, 0);
|
WriteProcessMemory(GetCurrentProcess(), (LPVOID)address, data, i, 0);
|
||||||
#else
|
#else
|
||||||
// We own the pages with PROT_WRITE | PROT_EXEC, we can simply just memcpy the data
|
// We own the pages with PROT_WRITE | PROT_EXEC, we can simply just memcpy the data
|
||||||
memcpy((void *)address, data, i);
|
memcpy((void *)address, data, i);
|
||||||
#endif // _WIN32
|
#endif // __WINDOWS__
|
||||||
hookfunc(hookaddress, newaddress, stacksize, registerargs, registersreturned, eaxDestinationRegister);
|
hookfunc(hookaddress, newaddress, stacksize, registerargs, registersreturned, eaxDestinationRegister);
|
||||||
g_hooktableoffset++;
|
g_hooktableoffset++;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1391,7 +1391,7 @@ void title_handle_keyboard_input()
|
||||||
gInputPlaceObjectModifier |= PLACE_OBJECT_MODIFIER_COPY_Z;
|
gInputPlaceObjectModifier |= PLACE_OBJECT_MODIFIER_COPY_Z;
|
||||||
if (gKeysState[SDL_SCANCODE_LALT] || gKeysState[SDL_SCANCODE_RALT])
|
if (gKeysState[SDL_SCANCODE_LALT] || gKeysState[SDL_SCANCODE_RALT])
|
||||||
gInputPlaceObjectModifier |= 4;
|
gInputPlaceObjectModifier |= 4;
|
||||||
#if defined(__APPLE__) && defined(__MACH__)
|
#ifdef __MACOSX__
|
||||||
if (gKeysState[SDL_SCANCODE_LGUI] || gKeysState[SDL_SCANCODE_RGUI]) {
|
if (gKeysState[SDL_SCANCODE_LGUI] || gKeysState[SDL_SCANCODE_RGUI]) {
|
||||||
gInputPlaceObjectModifier |= 8;
|
gInputPlaceObjectModifier |= 8;
|
||||||
}
|
}
|
||||||
|
@ -1456,7 +1456,7 @@ void game_handle_keyboard_input()
|
||||||
if (gKeysState[SDL_SCANCODE_LALT] || gKeysState[SDL_SCANCODE_RALT]) {
|
if (gKeysState[SDL_SCANCODE_LALT] || gKeysState[SDL_SCANCODE_RALT]) {
|
||||||
gInputPlaceObjectModifier |= 4;
|
gInputPlaceObjectModifier |= 4;
|
||||||
}
|
}
|
||||||
#if defined(__APPLE__) && defined(__MACH__)
|
#ifdef __MACOSX__
|
||||||
if (gKeysState[SDL_SCANCODE_LGUI] || gKeysState[SDL_SCANCODE_RGUI]) {
|
if (gKeysState[SDL_SCANCODE_LGUI] || gKeysState[SDL_SCANCODE_RGUI]) {
|
||||||
gInputPlaceObjectModifier |= 8;
|
gInputPlaceObjectModifier |= 8;
|
||||||
}
|
}
|
||||||
|
@ -1661,7 +1661,7 @@ void game_handle_key_scroll()
|
||||||
if (shortcutKey & ALT) {
|
if (shortcutKey & ALT) {
|
||||||
if (!gKeysState[SDL_SCANCODE_LALT] && !gKeysState[SDL_SCANCODE_RALT]) continue;
|
if (!gKeysState[SDL_SCANCODE_LALT] && !gKeysState[SDL_SCANCODE_RALT]) continue;
|
||||||
}
|
}
|
||||||
#if defined(__APPLE__) && defined(__MACH__)
|
#ifdef __MACOSX__
|
||||||
if (shortcutKey & CMD) {
|
if (shortcutKey & CMD) {
|
||||||
if (!gKeysState[SDL_SCANCODE_LGUI] && !gKeysState[SDL_SCANCODE_RGUI]) continue;
|
if (!gKeysState[SDL_SCANCODE_LGUI] && !gKeysState[SDL_SCANCODE_RGUI]) continue;
|
||||||
}
|
}
|
||||||
|
|
|
@ -97,7 +97,7 @@ void keyboard_shortcut_format_string(char *buffer, uint16 shortcutKey)
|
||||||
strcat(buffer, formatBuffer);
|
strcat(buffer, formatBuffer);
|
||||||
}
|
}
|
||||||
if (shortcutKey & 0x400) {
|
if (shortcutKey & 0x400) {
|
||||||
#if defined(__APPLE__) && defined(__MACH__)
|
#ifdef __MACOSX__
|
||||||
format_string(formatBuffer, STR_OPTION_PLUS, NULL);
|
format_string(formatBuffer, STR_OPTION_PLUS, NULL);
|
||||||
#else
|
#else
|
||||||
format_string(formatBuffer, STR_ALT_PLUS, NULL);
|
format_string(formatBuffer, STR_ALT_PLUS, NULL);
|
||||||
|
|
|
@ -18,12 +18,15 @@
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
#ifdef _WIN32
|
#include "../common.h"
|
||||||
|
|
||||||
|
#ifdef __WINDOWS__
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#else
|
#else
|
||||||
#include <iconv.h>
|
#include <iconv.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#endif // _WIN32
|
#endif // __WINDOWS__
|
||||||
|
|
||||||
#include "../addresses.h"
|
#include "../addresses.h"
|
||||||
#include "../config.h"
|
#include "../config.h"
|
||||||
#include "../game.h"
|
#include "../game.h"
|
||||||
|
@ -936,7 +939,7 @@ int win1252_to_utf8(utf8string dst, const char *src, size_t maxBufferLength)
|
||||||
{
|
{
|
||||||
size_t srcLength = strlen(src);
|
size_t srcLength = strlen(src);
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef __WINDOWS__
|
||||||
utf16 stackBuffer[256];
|
utf16 stackBuffer[256];
|
||||||
utf16 *heapBuffer = NULL;
|
utf16 *heapBuffer = NULL;
|
||||||
utf16 *intermediateBuffer = stackBuffer;
|
utf16 *intermediateBuffer = stackBuffer;
|
||||||
|
@ -1005,7 +1008,7 @@ int win1252_to_utf8(utf8string dst, const char *src, size_t maxBufferLength)
|
||||||
//log_warning("converted %s of size %d, %d", dst, byte_diff, strlen(dst));
|
//log_warning("converted %s of size %d, %d", dst, byte_diff, strlen(dst));
|
||||||
int result = byte_diff;
|
int result = byte_diff;
|
||||||
free(buffer_orig);
|
free(buffer_orig);
|
||||||
#endif // _WIN32
|
#endif // __WINDOWS__
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,11 +10,12 @@ void http_dispose() { }
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
#include <SDL.h>
|
|
||||||
#include "../core/Math.hpp"
|
#include "../core/Math.hpp"
|
||||||
|
|
||||||
|
#ifdef __WINDOWS__
|
||||||
// cURL includes windows.h, but we don't need all of it.
|
// cURL includes windows.h, but we don't need all of it.
|
||||||
#define WIN32_LEAN_AND_MEAN
|
#define WIN32_LEAN_AND_MEAN
|
||||||
|
#endif
|
||||||
#include <curl/curl.h>
|
#include <curl/curl.h>
|
||||||
|
|
||||||
#define MIME_TYPE_APPLICATION_JSON "application/json"
|
#define MIME_TYPE_APPLICATION_JSON "application/json"
|
||||||
|
@ -117,7 +118,7 @@ http_json_response *http_request_json(const http_json_request *request)
|
||||||
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
|
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
|
||||||
curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, true);
|
curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, true);
|
||||||
curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, true);
|
curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, true);
|
||||||
#ifdef _WIN32
|
#ifdef __WINDOWS__
|
||||||
// On GNU/Linux (and OS X), curl will use the system certs by default
|
// On GNU/Linux (and OS X), curl will use the system certs by default
|
||||||
curl_easy_setopt(curl, CURLOPT_CAINFO, "curl-ca-bundle.crt");
|
curl_easy_setopt(curl, CURLOPT_CAINFO, "curl-ca-bundle.crt");
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -306,7 +306,7 @@ bool NetworkConnection::SetNonBlocking(bool on)
|
||||||
|
|
||||||
bool NetworkConnection::SetNonBlocking(SOCKET socket, bool on)
|
bool NetworkConnection::SetNonBlocking(SOCKET socket, bool on)
|
||||||
{
|
{
|
||||||
#ifdef _WIN32
|
#ifdef __WINDOWS__
|
||||||
u_long nonblocking = on;
|
u_long nonblocking = on;
|
||||||
return ioctlsocket(socket, FIONBIO, &nonblocking) == 0;
|
return ioctlsocket(socket, FIONBIO, &nonblocking) == 0;
|
||||||
#else
|
#else
|
||||||
|
@ -429,7 +429,7 @@ Network::~Network()
|
||||||
|
|
||||||
bool Network::Init()
|
bool Network::Init()
|
||||||
{
|
{
|
||||||
#ifdef _WIN32
|
#ifdef __WINDOWS__
|
||||||
if (!wsa_initialized) {
|
if (!wsa_initialized) {
|
||||||
log_verbose("Initialising WSA");
|
log_verbose("Initialising WSA");
|
||||||
WSADATA wsa_data;
|
WSADATA wsa_data;
|
||||||
|
@ -468,7 +468,7 @@ void Network::Close()
|
||||||
game_command_queue.clear();
|
game_command_queue.clear();
|
||||||
player_list.clear();
|
player_list.clear();
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef __WINDOWS__
|
||||||
if (wsa_initialized) {
|
if (wsa_initialized) {
|
||||||
WSACleanup();
|
WSACleanup();
|
||||||
wsa_initialized = false;
|
wsa_initialized = false;
|
||||||
|
@ -1249,7 +1249,7 @@ NetworkPlayer* Network::AddPlayer(const char* name)
|
||||||
|
|
||||||
void Network::PrintError()
|
void Network::PrintError()
|
||||||
{
|
{
|
||||||
#ifdef _WIN32
|
#ifdef __WINDOWS__
|
||||||
wchar_t *s = NULL;
|
wchar_t *s = NULL;
|
||||||
FormatMessageW(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, LAST_SOCKET_ERROR(), MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPWSTR)&s, 0, NULL);
|
FormatMessageW(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, LAST_SOCKET_ERROR(), MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPWSTR)&s, 0, NULL);
|
||||||
fprintf(stderr, "%S\n", s);
|
fprintf(stderr, "%S\n", s);
|
||||||
|
|
|
@ -63,7 +63,7 @@ extern "C" {
|
||||||
|
|
||||||
#ifndef DISABLE_NETWORK
|
#ifndef DISABLE_NETWORK
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef __WINDOWS__
|
||||||
#include <winsock2.h>
|
#include <winsock2.h>
|
||||||
#include <ws2tcpip.h>
|
#include <ws2tcpip.h>
|
||||||
#define LAST_SOCKET_ERROR() WSAGetLastError()
|
#define LAST_SOCKET_ERROR() WSAGetLastError()
|
||||||
|
@ -88,7 +88,7 @@ extern "C" {
|
||||||
#define LAST_SOCKET_ERROR() errno
|
#define LAST_SOCKET_ERROR() errno
|
||||||
#define closesocket close
|
#define closesocket close
|
||||||
#define ioctlsocket ioctl
|
#define ioctlsocket ioctl
|
||||||
#endif // _WIN32
|
#endif // __WINDOWS__
|
||||||
|
|
||||||
// Fixes issues on OS X
|
// Fixes issues on OS X
|
||||||
#if defined(_RCT2_H_) && !defined(_MSC_VER)
|
#if defined(_RCT2_H_) && !defined(_MSC_VER)
|
||||||
|
|
36
src/object.c
36
src/object.c
|
@ -859,8 +859,8 @@ static bool object_type_small_scenery_test(void *objectEntry)
|
||||||
static void object_type_small_scenery_paint(void *objectEntry, rct_drawpixelinfo *dpi, sint32 x, sint32 y)
|
static void object_type_small_scenery_paint(void *objectEntry, rct_drawpixelinfo *dpi, sint32 x, sint32 y)
|
||||||
{
|
{
|
||||||
rct_scenery_entry* sceneryEntry = (rct_scenery_entry*)objectEntry;
|
rct_scenery_entry* sceneryEntry = (rct_scenery_entry*)objectEntry;
|
||||||
dpi = clip_drawpixelinfo(dpi, x - 56, 112, y - 56, 112);
|
rct_drawpixelinfo clipDPI;
|
||||||
if (dpi == NULL) {
|
if (!clip_drawpixelinfo(&clipDPI, dpi, x - 56, y - 56, 112, 112)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -880,14 +880,14 @@ static void object_type_small_scenery_paint(void *objectEntry, rct_drawpixelinfo
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
gfx_draw_sprite(dpi, imageId, x, y, 0);
|
gfx_draw_sprite(&clipDPI, imageId, x, y, 0);
|
||||||
if (sceneryEntry->small_scenery.flags & SMALL_SCENERY_FLAG10) {
|
if (sceneryEntry->small_scenery.flags & SMALL_SCENERY_FLAG10) {
|
||||||
imageId = sceneryEntry->image + 0x44500004;
|
imageId = sceneryEntry->image + 0x44500004;
|
||||||
if (sceneryEntry->small_scenery.flags & SMALL_SCENERY_FLAG_HAS_SECONDARY_COLOUR) {
|
if (sceneryEntry->small_scenery.flags & SMALL_SCENERY_FLAG_HAS_SECONDARY_COLOUR) {
|
||||||
imageId |= 0x92000000;
|
imageId |= 0x92000000;
|
||||||
}
|
}
|
||||||
|
|
||||||
gfx_draw_sprite(dpi, imageId, x, y, 0);
|
gfx_draw_sprite(&clipDPI, imageId, x, y, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sceneryEntry->small_scenery.flags & SMALL_SCENERY_FLAG8) {
|
if (sceneryEntry->small_scenery.flags & SMALL_SCENERY_FLAG8) {
|
||||||
|
@ -896,10 +896,8 @@ static void object_type_small_scenery_paint(void *objectEntry, rct_drawpixelinfo
|
||||||
imageId |= 0x92000000;
|
imageId |= 0x92000000;
|
||||||
}
|
}
|
||||||
|
|
||||||
gfx_draw_sprite(dpi, imageId, x, y, 0);
|
gfx_draw_sprite(&clipDPI, imageId, x, y, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
rct2_free(dpi);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static rct_string_id object_type_small_scenery_desc(void *objectEntry)
|
static rct_string_id object_type_small_scenery_desc(void *objectEntry)
|
||||||
|
@ -1059,8 +1057,8 @@ static bool object_type_wall_test(void *objectEntry)
|
||||||
static void object_type_wall_paint(void *objectEntry, rct_drawpixelinfo *dpi, sint32 x, sint32 y)
|
static void object_type_wall_paint(void *objectEntry, rct_drawpixelinfo *dpi, sint32 x, sint32 y)
|
||||||
{
|
{
|
||||||
rct_scenery_entry* sceneryEntry = (rct_scenery_entry*)objectEntry;
|
rct_scenery_entry* sceneryEntry = (rct_scenery_entry*)objectEntry;
|
||||||
dpi = clip_drawpixelinfo(dpi, x - 56, 112, y - 56, 112);
|
rct_drawpixelinfo clipDPI;
|
||||||
if (dpi == NULL) {
|
if (!clip_drawpixelinfo(&clipDPI, dpi, x - 56, y - 56, 112, 112)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1072,17 +1070,15 @@ static void object_type_wall_paint(void *objectEntry, rct_drawpixelinfo *dpi, si
|
||||||
|
|
||||||
x = 70;
|
x = 70;
|
||||||
y = sceneryEntry->wall.height * 2 + 72;
|
y = sceneryEntry->wall.height * 2 + 72;
|
||||||
gfx_draw_sprite(dpi, imageId, x, y, 0);
|
gfx_draw_sprite(&clipDPI, imageId, x, y, 0);
|
||||||
|
|
||||||
if (sceneryEntry->wall.flags & WALL_SCENERY_FLAG2){
|
if (sceneryEntry->wall.flags & WALL_SCENERY_FLAG2){
|
||||||
imageId = sceneryEntry->image + 0x44500006;
|
imageId = sceneryEntry->image + 0x44500006;
|
||||||
gfx_draw_sprite(dpi, imageId, x, y, 0);
|
gfx_draw_sprite(&clipDPI, imageId, x, y, 0);
|
||||||
} else if (sceneryEntry->wall.flags & WALL_SCENERY_FLAG5){
|
} else if (sceneryEntry->wall.flags & WALL_SCENERY_FLAG5){
|
||||||
imageId++;
|
imageId++;
|
||||||
gfx_draw_sprite(dpi, imageId, x, y, 0);
|
gfx_draw_sprite(&clipDPI, imageId, x, y, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
rct2_free(dpi);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static rct_string_id object_type_wall_desc(void *objectEntry)
|
static rct_string_id object_type_wall_desc(void *objectEntry)
|
||||||
|
@ -1428,17 +1424,15 @@ static void object_type_park_entrance_paint(void *objectEntry, rct_drawpixelinfo
|
||||||
{
|
{
|
||||||
rct_entrance_type *entranceType = (rct_entrance_type*)objectEntry;
|
rct_entrance_type *entranceType = (rct_entrance_type*)objectEntry;
|
||||||
|
|
||||||
dpi = clip_drawpixelinfo(dpi, x - 56, 112, y - 56, 112);
|
rct_drawpixelinfo clipDPI;
|
||||||
if (dpi == NULL) {
|
if (!clip_drawpixelinfo(&clipDPI, dpi, x - 56, y - 56, 112, 112)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
int imageId = entranceType->image_id;
|
int imageId = entranceType->image_id;
|
||||||
gfx_draw_sprite(dpi, imageId + 1, 24, 68, 0);
|
gfx_draw_sprite(&clipDPI, imageId + 1, 24, 68, 0);
|
||||||
gfx_draw_sprite(dpi, imageId, 56, 84, 0);
|
gfx_draw_sprite(&clipDPI, imageId, 56, 84, 0);
|
||||||
gfx_draw_sprite(dpi, imageId + 2, 88, 100, 0);
|
gfx_draw_sprite(&clipDPI, imageId + 2, 88, 100, 0);
|
||||||
|
|
||||||
rct2_free(dpi);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static rct_string_id object_type_park_entrance_desc(void *objectEntry)
|
static rct_string_id object_type_park_entrance_desc(void *objectEntry)
|
||||||
|
|
|
@ -517,7 +517,7 @@ bool openrct2_setup_rct2_segment()
|
||||||
if (err != 0)
|
if (err != 0)
|
||||||
{
|
{
|
||||||
err = errno;
|
err = errno;
|
||||||
#ifdef __linux__
|
#ifdef __LINUX__
|
||||||
// On Linux ENOMEM means all requested range is unmapped
|
// On Linux ENOMEM means all requested range is unmapped
|
||||||
if (err != ENOMEM)
|
if (err != ENOMEM)
|
||||||
{
|
{
|
||||||
|
@ -527,7 +527,7 @@ bool openrct2_setup_rct2_segment()
|
||||||
#else
|
#else
|
||||||
pagesMissing = true;
|
pagesMissing = true;
|
||||||
perror("mincore");
|
perror("mincore");
|
||||||
#endif // __linux__
|
#endif // __LINUX__
|
||||||
} else {
|
} else {
|
||||||
for (int i = 0; i < numPages; i++)
|
for (int i = 0; i < numPages; i++)
|
||||||
{
|
{
|
||||||
|
|
|
@ -18,13 +18,15 @@
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
#if defined(__linux__)
|
#include "../common.h"
|
||||||
|
|
||||||
|
#ifdef __LINUX__
|
||||||
|
|
||||||
#include "platform.h"
|
|
||||||
#include <dlfcn.h>
|
#include <dlfcn.h>
|
||||||
#include <stdlib.h>
|
#include <fontconfig/fontconfig.h>
|
||||||
|
|
||||||
#include "../util/util.h"
|
#include "../util/util.h"
|
||||||
#include "fontconfig/fontconfig.h"
|
#include "platform.h"
|
||||||
|
|
||||||
// See http://syprog.blogspot.ru/2011/12/listing-loaded-shared-objects-in-linux.html
|
// See http://syprog.blogspot.ru/2011/12/listing-loaded-shared-objects-in-linux.html
|
||||||
struct lmap {
|
struct lmap {
|
||||||
|
|
|
@ -21,20 +21,21 @@
|
||||||
#ifndef _PLATFORM_H_
|
#ifndef _PLATFORM_H_
|
||||||
#define _PLATFORM_H_
|
#define _PLATFORM_H_
|
||||||
|
|
||||||
#ifdef _WIN32
|
#include "../common.h"
|
||||||
|
|
||||||
|
#ifdef __WINDOWS__
|
||||||
#define HAVE_MATH_H
|
#define HAVE_MATH_H
|
||||||
#endif // _WIN32
|
#endif // __WINDOWS__
|
||||||
|
|
||||||
#include <SDL.h>
|
#include <SDL.h>
|
||||||
|
|
||||||
#include "../common.h"
|
|
||||||
#include "../drawing/font.h"
|
#include "../drawing/font.h"
|
||||||
|
|
||||||
#ifndef MAX_PATH
|
#ifndef MAX_PATH
|
||||||
#define MAX_PATH 260
|
#define MAX_PATH 260
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(__APPLE__) && defined(__MACH__)
|
#ifdef __MACOSX__
|
||||||
#define KEYBOARD_PRIMARY_MODIFIER KMOD_GUI
|
#define KEYBOARD_PRIMARY_MODIFIER KMOD_GUI
|
||||||
#else
|
#else
|
||||||
#define KEYBOARD_PRIMARY_MODIFIER KMOD_CTRL
|
#define KEYBOARD_PRIMARY_MODIFIER KMOD_CTRL
|
||||||
|
@ -171,7 +172,7 @@ bool platform_check_steam_overlay_attached();
|
||||||
datetime64 platform_get_datetime_now_utc();
|
datetime64 platform_get_datetime_now_utc();
|
||||||
|
|
||||||
// Windows specific definitions
|
// Windows specific definitions
|
||||||
#ifdef _WIN32
|
#ifdef __WINDOWS__
|
||||||
#ifndef WIN32_LEAN_AND_MEAN
|
#ifndef WIN32_LEAN_AND_MEAN
|
||||||
#define WIN32_LEAN_AND_MEAN
|
#define WIN32_LEAN_AND_MEAN
|
||||||
#endif
|
#endif
|
||||||
|
@ -179,6 +180,6 @@ datetime64 platform_get_datetime_now_utc();
|
||||||
|
|
||||||
int windows_get_registry_install_info(rct2_install_info *installInfo, char *source, char *font, uint8 charset);
|
int windows_get_registry_install_info(rct2_install_info *installInfo, char *source, char *font, uint8 charset);
|
||||||
HWND windows_get_window_handle();
|
HWND windows_get_window_handle();
|
||||||
#endif // _WIN32
|
#endif // __WINDOWS__
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -902,7 +902,7 @@ void platform_set_cursor(char cursor)
|
||||||
static void platform_load_cursors()
|
static void platform_load_cursors()
|
||||||
{
|
{
|
||||||
RCT2_GLOBAL(0x14241BC, uint32) = 2;
|
RCT2_GLOBAL(0x14241BC, uint32) = 2;
|
||||||
#ifdef _WIN32
|
#ifdef __WINDOWS__
|
||||||
HINSTANCE hInst = RCT2_GLOBAL(RCT2_ADDRESS_HINSTANCE, HINSTANCE);
|
HINSTANCE hInst = RCT2_GLOBAL(RCT2_ADDRESS_HINSTANCE, HINSTANCE);
|
||||||
RCT2_GLOBAL(RCT2_ADDRESS_HCURSOR_ARROW, HCURSOR) = LoadCursor(hInst, MAKEINTRESOURCE(0x74));
|
RCT2_GLOBAL(RCT2_ADDRESS_HCURSOR_ARROW, HCURSOR) = LoadCursor(hInst, MAKEINTRESOURCE(0x74));
|
||||||
RCT2_GLOBAL(RCT2_ADDRESS_HCURSOR_BLANK, HCURSOR) = LoadCursor(hInst, MAKEINTRESOURCE(0xA1));
|
RCT2_GLOBAL(RCT2_ADDRESS_HCURSOR_BLANK, HCURSOR) = LoadCursor(hInst, MAKEINTRESOURCE(0xA1));
|
||||||
|
@ -933,7 +933,7 @@ static void platform_load_cursors()
|
||||||
RCT2_GLOBAL(RCT2_ADDRESS_HCURSOR_HAND_CLOSED, HCURSOR) = LoadCursor(hInst, MAKEINTRESOURCE(0xA5));
|
RCT2_GLOBAL(RCT2_ADDRESS_HCURSOR_HAND_CLOSED, HCURSOR) = LoadCursor(hInst, MAKEINTRESOURCE(0xA5));
|
||||||
#else
|
#else
|
||||||
STUB();
|
STUB();
|
||||||
#endif // _WIN32
|
#endif // __WINDOWS__
|
||||||
|
|
||||||
_cursors[0] = SDL_CreateSystemCursor(SDL_SYSTEM_CURSOR_ARROW);
|
_cursors[0] = SDL_CreateSystemCursor(SDL_SYSTEM_CURSOR_ARROW);
|
||||||
_cursors[1] = SDL_CreateCursor(blank_cursor_data, blank_cursor_mask, 32, 32, BLANK_CURSOR_HOTX, BLANK_CURSOR_HOTY);
|
_cursors[1] = SDL_CreateCursor(blank_cursor_data, blank_cursor_mask, 32, 32, BLANK_CURSOR_HOTX, BLANK_CURSOR_HOTY);
|
||||||
|
|
|
@ -18,7 +18,9 @@
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
#ifdef _WIN32
|
#include "../common.h"
|
||||||
|
|
||||||
|
#ifdef __WINDOWS__
|
||||||
|
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <psapi.h>
|
#include <psapi.h>
|
||||||
|
|
52
src/rct2.c
52
src/rct2.c
|
@ -498,7 +498,7 @@ const utf8 *get_file_path(int pathId)
|
||||||
*/
|
*/
|
||||||
void get_system_info()
|
void get_system_info()
|
||||||
{
|
{
|
||||||
#ifdef _WIN32
|
#ifdef __WINDOWS__
|
||||||
OSVERSIONINFO versionInfo;
|
OSVERSIONINFO versionInfo;
|
||||||
SYSTEM_INFO sysInfo;
|
SYSTEM_INFO sysInfo;
|
||||||
MEMORYSTATUS memInfo;
|
MEMORYSTATUS memInfo;
|
||||||
|
@ -510,12 +510,12 @@ void get_system_info()
|
||||||
RCT2_GLOBAL(RCT2_ADDRESS_OS_MINOR_VERSION, uint32) = versionInfo.dwMinorVersion;
|
RCT2_GLOBAL(RCT2_ADDRESS_OS_MINOR_VERSION, uint32) = versionInfo.dwMinorVersion;
|
||||||
RCT2_GLOBAL(RCT2_ADDRESS_OS_BUILD_NUMBER, uint32) = versionInfo.dwBuildNumber;
|
RCT2_GLOBAL(RCT2_ADDRESS_OS_BUILD_NUMBER, uint32) = versionInfo.dwBuildNumber;
|
||||||
} else {
|
} else {
|
||||||
#endif // _WIN32
|
#endif // __WINDOWS__
|
||||||
RCT2_GLOBAL(RCT2_ADDRESS_OS_PLATFORM_ID, uint32) = -1;
|
RCT2_GLOBAL(RCT2_ADDRESS_OS_PLATFORM_ID, uint32) = -1;
|
||||||
RCT2_GLOBAL(RCT2_ADDRESS_OS_MAJOR_VERSION, uint32) = 0;
|
RCT2_GLOBAL(RCT2_ADDRESS_OS_MAJOR_VERSION, uint32) = 0;
|
||||||
RCT2_GLOBAL(RCT2_ADDRESS_OS_MINOR_VERSION, uint32) = 0;
|
RCT2_GLOBAL(RCT2_ADDRESS_OS_MINOR_VERSION, uint32) = 0;
|
||||||
RCT2_GLOBAL(RCT2_ADDRESS_OS_BUILD_NUMBER, uint32) = 0;
|
RCT2_GLOBAL(RCT2_ADDRESS_OS_BUILD_NUMBER, uint32) = 0;
|
||||||
#ifdef _WIN32
|
#ifdef __WINDOWS__
|
||||||
}
|
}
|
||||||
|
|
||||||
GetSystemInfo(&sysInfo);
|
GetSystemInfo(&sysInfo);
|
||||||
|
@ -558,7 +558,7 @@ void get_system_info()
|
||||||
RCT2_GLOBAL(0x01423C20, uint32) = (SDL_HasMMX() == SDL_TRUE);
|
RCT2_GLOBAL(0x01423C20, uint32) = (SDL_HasMMX() == SDL_TRUE);
|
||||||
#else
|
#else
|
||||||
STUB();
|
STUB();
|
||||||
#endif // _WIN32
|
#endif // __WINDOWS__
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -587,47 +587,3 @@ void get_local_time()
|
||||||
RCT2_GLOBAL(RCT2_ADDRESS_OS_TIME_HOUR, sint16) = t.hour;
|
RCT2_GLOBAL(RCT2_ADDRESS_OS_TIME_HOUR, sint16) = t.hour;
|
||||||
RCT2_GLOBAL(RCT2_ADDRESS_OS_TIME_MINUTE, sint16) = t.minute;
|
RCT2_GLOBAL(RCT2_ADDRESS_OS_TIME_MINUTE, sint16) = t.minute;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* RCT2 and this DLL can not free each other's allocated memory blocks. Use this to allocate memory if RCT2 is still able to
|
|
||||||
* free it.
|
|
||||||
* rct2: 0x004068B2
|
|
||||||
*/
|
|
||||||
void *rct2_malloc(size_t numBytes)
|
|
||||||
{
|
|
||||||
#ifdef _WIN32
|
|
||||||
return RCT2_CALLFUNC_1(0x004068B2, void*, size_t, numBytes);
|
|
||||||
#else
|
|
||||||
//log_warning("call rct's function");
|
|
||||||
return malloc(numBytes);
|
|
||||||
#endif // _WIN32
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* RCT2 and this DLL can not free each other's allocated memory blocks. Use this to reallocate memory if RCT2 is still able to
|
|
||||||
* free it.
|
|
||||||
* rct2: 0x004068BD
|
|
||||||
*/
|
|
||||||
void *rct2_realloc(void *block, size_t numBytes)
|
|
||||||
{
|
|
||||||
#ifdef _WIN32
|
|
||||||
return RCT2_CALLFUNC_2(0x004068BD, void*, void*, size_t, block, numBytes);
|
|
||||||
#else
|
|
||||||
//log_warning("call rct's function");
|
|
||||||
return realloc(block, numBytes);
|
|
||||||
#endif // _WIN32
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* RCT2 and this DLL can not free each other's allocated memory blocks. Use this to free memory that was allocated by RCT2.
|
|
||||||
* rct2: 0x004068CD
|
|
||||||
*/
|
|
||||||
void rct2_free(void *block)
|
|
||||||
{
|
|
||||||
#ifdef _WIN32
|
|
||||||
RCT2_CALLPROC_1(0x004068CD, void*, block);
|
|
||||||
#else
|
|
||||||
//log_warning("call rct's function");
|
|
||||||
free(block);
|
|
||||||
#endif // _WIN32
|
|
||||||
}
|
|
||||||
|
|
|
@ -21,6 +21,8 @@
|
||||||
#ifndef _RCT2_H_
|
#ifndef _RCT2_H_
|
||||||
#define _RCT2_H_
|
#define _RCT2_H_
|
||||||
|
|
||||||
|
#include <SDL_platform.h>
|
||||||
|
|
||||||
#ifndef _USE_MATH_DEFINES
|
#ifndef _USE_MATH_DEFINES
|
||||||
#define _USE_MATH_DEFINES
|
#define _USE_MATH_DEFINES
|
||||||
#endif
|
#endif
|
||||||
|
@ -270,9 +272,6 @@ const char *get_file_path(int pathId);
|
||||||
void get_system_info();
|
void get_system_info();
|
||||||
void get_system_time();
|
void get_system_time();
|
||||||
void get_local_time();
|
void get_local_time();
|
||||||
void *rct2_malloc(size_t numBytes);
|
|
||||||
void *rct2_realloc(void *block, size_t numBytes);
|
|
||||||
void rct2_free(void *block);
|
|
||||||
void rct2_quit();
|
void rct2_quit();
|
||||||
|
|
||||||
int rct2_open_file(const char *path);
|
int rct2_open_file(const char *path);
|
||||||
|
|
|
@ -1,18 +1,20 @@
|
||||||
#ifndef _VERSION_H_
|
#ifndef _VERSION_H_
|
||||||
#define _VERSION_H_
|
#define _VERSION_H_
|
||||||
|
|
||||||
|
#include "common.h"
|
||||||
|
|
||||||
#define OPENRCT2_NAME "OpenRCT2"
|
#define OPENRCT2_NAME "OpenRCT2"
|
||||||
#define OPENRCT2_VERSION "0.0.4"
|
#define OPENRCT2_VERSION "0.0.4"
|
||||||
#define OPENRCT2_ARCHITECTURE "x86"
|
#define OPENRCT2_ARCHITECTURE "x86"
|
||||||
|
|
||||||
// Platform
|
// Platform
|
||||||
#ifdef _WIN32
|
#ifdef __WINDOWS__
|
||||||
#define OPENRCT2_PLATFORM "Windows"
|
#define OPENRCT2_PLATFORM "Windows"
|
||||||
#endif // _WIN32
|
#endif
|
||||||
#ifdef __linux__
|
#ifdef __LINUX__
|
||||||
#define OPENRCT2_PLATFORM "Linux"
|
#define OPENRCT2_PLATFORM "Linux"
|
||||||
#endif
|
#endif
|
||||||
#if defined(__APPLE__) && defined(__MACH__)
|
#ifdef __MACOSX__
|
||||||
#define OPENRCT2_PLATFORM "OS X"
|
#define OPENRCT2_PLATFORM "OS X"
|
||||||
#endif
|
#endif
|
||||||
#ifndef OPENRCT2_PLATFORM
|
#ifndef OPENRCT2_PLATFORM
|
||||||
|
|
|
@ -667,7 +667,7 @@ static void setup_in_use_selection_flags(){
|
||||||
static int sub_6AB211(){
|
static int sub_6AB211(){
|
||||||
uint32 total_objects = gInstalledObjectsCount;
|
uint32 total_objects = gInstalledObjectsCount;
|
||||||
|
|
||||||
RCT2_GLOBAL(RCT2_ADDRESS_EDITOR_OBJECT_FLAGS_LIST, uint8*) = rct2_malloc(total_objects);
|
RCT2_GLOBAL(RCT2_ADDRESS_EDITOR_OBJECT_FLAGS_LIST, uint8*) = malloc(total_objects);
|
||||||
|
|
||||||
if (RCT2_GLOBAL(RCT2_ADDRESS_EDITOR_OBJECT_FLAGS_LIST, uint8*) == NULL){
|
if (RCT2_GLOBAL(RCT2_ADDRESS_EDITOR_OBJECT_FLAGS_LIST, uint8*) == NULL){
|
||||||
log_error("Failed to allocate memory for object flag list.");
|
log_error("Failed to allocate memory for object flag list.");
|
||||||
|
@ -717,12 +717,9 @@ static int sub_6AB211(){
|
||||||
*
|
*
|
||||||
* rct2: 0x006AB316
|
* rct2: 0x006AB316
|
||||||
*/
|
*/
|
||||||
static void editor_object_flags_free(){
|
static void editor_object_flags_free()
|
||||||
if (RCT2_GLOBAL(RCT2_ADDRESS_EDITOR_OBJECT_FLAGS_LIST, uint8*) == NULL){
|
{
|
||||||
return;
|
SafeFree(RCT2_GLOBAL(RCT2_ADDRESS_EDITOR_OBJECT_FLAGS_LIST, uint8*));
|
||||||
}
|
|
||||||
rct2_free(RCT2_GLOBAL(RCT2_ADDRESS_EDITOR_OBJECT_FLAGS_LIST, uint8*));
|
|
||||||
RCT2_GLOBAL(RCT2_ADDRESS_EDITOR_OBJECT_FLAGS_LIST, uint8*) = NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -537,8 +537,10 @@ static void window_game_bottom_toolbar_draw_news_item(rct_drawpixelinfo *dpi, rc
|
||||||
if (newsItem->flags & 1)
|
if (newsItem->flags & 1)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
rct_drawpixelinfo* cliped_dpi = clip_drawpixelinfo(dpi, x + 1, 22, y + 1, 22);
|
rct_drawpixelinfo cliped_dpi;
|
||||||
if (!cliped_dpi) break;
|
if (!clip_drawpixelinfo(&cliped_dpi, dpi, x + 1, y + 1, 22, 22)) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
rct_peep* peep = GET_PEEP(newsItem->assoc);
|
rct_peep* peep = GET_PEEP(newsItem->assoc);
|
||||||
int clip_x = 10, clip_y = 19;
|
int clip_x = 10, clip_y = 19;
|
||||||
|
@ -556,28 +558,26 @@ static void window_game_bottom_toolbar_draw_news_item(rct_drawpixelinfo *dpi, rc
|
||||||
uint32 image_id = image_id_base;
|
uint32 image_id = image_id_base;
|
||||||
image_id |= 0xA0000000 | (peep->tshirt_colour << 19) | (peep->trousers_colour << 24);
|
image_id |= 0xA0000000 | (peep->tshirt_colour << 19) | (peep->trousers_colour << 24);
|
||||||
|
|
||||||
gfx_draw_sprite(cliped_dpi, image_id, clip_x, clip_y, 0);
|
gfx_draw_sprite(&cliped_dpi, image_id, clip_x, clip_y, 0);
|
||||||
|
|
||||||
if (image_id_base >= 0x2A1D && image_id_base < 0x2A3D){
|
if (image_id_base >= 0x2A1D && image_id_base < 0x2A3D){
|
||||||
image_id_base += 32;
|
image_id_base += 32;
|
||||||
image_id_base |= 0x20000000 | (peep->balloon_colour << 19);
|
image_id_base |= 0x20000000 | (peep->balloon_colour << 19);
|
||||||
|
|
||||||
gfx_draw_sprite(cliped_dpi, image_id_base, clip_x, clip_y, 0);
|
gfx_draw_sprite(&cliped_dpi, image_id_base, clip_x, clip_y, 0);
|
||||||
}
|
}
|
||||||
else if (image_id_base >= 0x2BBD && image_id_base < 0x2BDD){
|
else if (image_id_base >= 0x2BBD && image_id_base < 0x2BDD){
|
||||||
image_id_base += 32;
|
image_id_base += 32;
|
||||||
image_id_base |= 0x20000000 | (peep->umbrella_colour << 19);
|
image_id_base |= 0x20000000 | (peep->umbrella_colour << 19);
|
||||||
|
|
||||||
gfx_draw_sprite(cliped_dpi, image_id_base, clip_x, clip_y, 0);
|
gfx_draw_sprite(&cliped_dpi, image_id_base, clip_x, clip_y, 0);
|
||||||
}
|
}
|
||||||
else if (image_id_base >= 0x29DD && image_id_base < 0x29FD){
|
else if (image_id_base >= 0x29DD && image_id_base < 0x29FD){
|
||||||
image_id_base += 32;
|
image_id_base += 32;
|
||||||
image_id_base |= 0x20000000 | (peep->hat_colour << 19);
|
image_id_base |= 0x20000000 | (peep->hat_colour << 19);
|
||||||
|
|
||||||
gfx_draw_sprite(cliped_dpi, image_id_base, clip_x, clip_y, 0);
|
gfx_draw_sprite(&cliped_dpi, image_id_base, clip_x, clip_y, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
rct2_free(cliped_dpi);
|
|
||||||
break;
|
break;
|
||||||
case NEWS_ITEM_MONEY:
|
case NEWS_ITEM_MONEY:
|
||||||
gfx_draw_sprite(dpi, SPR_FINANCE, x, y, 0);
|
gfx_draw_sprite(dpi, SPR_FINANCE, x, y, 0);
|
||||||
|
|
|
@ -819,8 +819,10 @@ void window_guest_overview_tab_paint(rct_window* w, rct_drawpixelinfo* dpi){
|
||||||
int y = widget->top + 1 + w->y;
|
int y = widget->top + 1 + w->y;
|
||||||
if (w->page == WINDOW_GUEST_OVERVIEW) height++;
|
if (w->page == WINDOW_GUEST_OVERVIEW) height++;
|
||||||
|
|
||||||
rct_drawpixelinfo* clip_dpi = clip_drawpixelinfo(dpi, x, width, y, height );
|
rct_drawpixelinfo clip_dpi;
|
||||||
if (!clip_dpi) return;
|
if (!clip_drawpixelinfo(&clip_dpi, dpi, x, y, width, height)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
x = 14;
|
x = 14;
|
||||||
y = 20;
|
y = 20;
|
||||||
|
@ -841,30 +843,28 @@ void window_guest_overview_tab_paint(rct_window* w, rct_drawpixelinfo* dpi){
|
||||||
ebx += eax;
|
ebx += eax;
|
||||||
|
|
||||||
int sprite_id = ebx | (peep->tshirt_colour << 19) | (peep->trousers_colour << 24) | 0xA0000000;
|
int sprite_id = ebx | (peep->tshirt_colour << 19) | (peep->trousers_colour << 24) | 0xA0000000;
|
||||||
gfx_draw_sprite( clip_dpi, sprite_id, x, y, 0);
|
gfx_draw_sprite(&clip_dpi, sprite_id, x, y, 0);
|
||||||
|
|
||||||
// If holding a balloon
|
// If holding a balloon
|
||||||
if (ebx >= 0x2A1D && ebx < 0x2A3D){
|
if (ebx >= 0x2A1D && ebx < 0x2A3D){
|
||||||
ebx += 32;
|
ebx += 32;
|
||||||
ebx |= (peep->balloon_colour << 19) | 0x20000000;
|
ebx |= (peep->balloon_colour << 19) | 0x20000000;
|
||||||
gfx_draw_sprite( clip_dpi, ebx, x, y, 0);
|
gfx_draw_sprite(&clip_dpi, ebx, x, y, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
// If holding umbrella
|
// If holding umbrella
|
||||||
if (ebx >= 0x2BBD && ebx < 0x2BDD){
|
if (ebx >= 0x2BBD && ebx < 0x2BDD){
|
||||||
ebx += 32;
|
ebx += 32;
|
||||||
ebx |= (peep->umbrella_colour << 19) | 0x20000000;
|
ebx |= (peep->umbrella_colour << 19) | 0x20000000;
|
||||||
gfx_draw_sprite(clip_dpi, ebx, x, y, 0);
|
gfx_draw_sprite(&clip_dpi, ebx, x, y, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
// If wearing hat
|
// If wearing hat
|
||||||
if (ebx >= 0x29DD && ebx < 0x29FD){
|
if (ebx >= 0x29DD && ebx < 0x29FD){
|
||||||
ebx += 32;
|
ebx += 32;
|
||||||
ebx |= (peep->hat_colour << 19) | 0x20000000;
|
ebx |= (peep->hat_colour << 19) | 0x20000000;
|
||||||
gfx_draw_sprite( clip_dpi, ebx, x, y, 0);
|
gfx_draw_sprite(&clip_dpi, ebx, x, y, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
rct2_free(clip_dpi);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1016,14 +1016,15 @@ void window_guest_overview_paint(rct_window *w, rct_drawpixelinfo *dpi)
|
||||||
int left = widget->left + 2 + w->x;
|
int left = widget->left + 2 + w->x;
|
||||||
int top = widget->top + w->y;
|
int top = widget->top + w->y;
|
||||||
int height = widget->bottom - widget->top;
|
int height = widget->bottom - widget->top;
|
||||||
rct_drawpixelinfo* dpi_marquee = clip_drawpixelinfo(dpi, left, width, top, height);
|
rct_drawpixelinfo dpi_marquee;
|
||||||
|
if (!clip_drawpixelinfo(&dpi_marquee, dpi, left, top, width, height)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (!dpi_marquee)return;
|
|
||||||
int i = 0;
|
int i = 0;
|
||||||
for (; i < PEEP_MAX_THOUGHTS; ++i){
|
for (; i < PEEP_MAX_THOUGHTS; ++i){
|
||||||
if (peep->thoughts[i].type == PEEP_THOUGHT_TYPE_NONE){
|
if (peep->thoughts[i].type == PEEP_THOUGHT_TYPE_NONE){
|
||||||
w->list_information_type = 0;
|
w->list_information_type = 0;
|
||||||
rct2_free(dpi_marquee);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (peep->thoughts[i].var_2 == 1){ // If a fresh thought
|
if (peep->thoughts[i].var_2 == 1){ // If a fresh thought
|
||||||
|
@ -1032,7 +1033,6 @@ void window_guest_overview_paint(rct_window *w, rct_drawpixelinfo *dpi)
|
||||||
}
|
}
|
||||||
if (i == PEEP_MAX_THOUGHTS){
|
if (i == PEEP_MAX_THOUGHTS){
|
||||||
w->list_information_type = 0;
|
w->list_information_type = 0;
|
||||||
rct2_free(dpi_marquee);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1043,9 +1043,7 @@ void window_guest_overview_paint(rct_window *w, rct_drawpixelinfo *dpi)
|
||||||
RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 8, uint16) = 0;
|
RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 8, uint16) = 0;
|
||||||
|
|
||||||
x = widget->right - widget->left - w->list_information_type;
|
x = widget->right - widget->left - w->list_information_type;
|
||||||
gfx_draw_string_left(dpi_marquee, 1193, (void*)RCT2_ADDRESS_COMMON_FORMAT_ARGS, 0, x, 0);
|
gfx_draw_string_left(&dpi_marquee, 1193, (void*)RCT2_ADDRESS_COMMON_FORMAT_ARGS, 0, x, 0);
|
||||||
|
|
||||||
rct2_free(dpi_marquee);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -328,8 +328,10 @@ static void window_news_scrollpaint(rct_window *w, rct_drawpixelinfo *dpi, int s
|
||||||
case NEWS_ITEM_PEEP:
|
case NEWS_ITEM_PEEP:
|
||||||
case NEWS_ITEM_PEEP_ON_RIDE:
|
case NEWS_ITEM_PEEP_ON_RIDE:
|
||||||
{
|
{
|
||||||
rct_drawpixelinfo* cliped_dpi = clip_drawpixelinfo(dpi, x + 1, 22, yy + 1, 22);
|
rct_drawpixelinfo cliped_dpi;
|
||||||
if (!cliped_dpi) break;
|
if (!clip_drawpixelinfo(&cliped_dpi, dpi, x + 1, yy + 1, 22, 22)) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
rct_peep* peep = GET_PEEP(newsItem->assoc);
|
rct_peep* peep = GET_PEEP(newsItem->assoc);
|
||||||
int clip_x = 10, clip_y = 19;
|
int clip_x = 10, clip_y = 19;
|
||||||
|
@ -348,9 +350,7 @@ static void window_news_scrollpaint(rct_window *w, rct_drawpixelinfo *dpi, int s
|
||||||
image_id += 0xA0000001;
|
image_id += 0xA0000001;
|
||||||
image_id |= (peep->tshirt_colour << 19) | (peep->trousers_colour << 24);
|
image_id |= (peep->tshirt_colour << 19) | (peep->trousers_colour << 24);
|
||||||
|
|
||||||
gfx_draw_sprite(cliped_dpi, image_id, clip_x, clip_y, 0);
|
gfx_draw_sprite(&cliped_dpi, image_id, clip_x, clip_y, 0);
|
||||||
|
|
||||||
rct2_free(cliped_dpi);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case NEWS_ITEM_MONEY:
|
case NEWS_ITEM_MONEY:
|
||||||
|
|
|
@ -522,7 +522,7 @@ static void window_options_mouseup(rct_window *w, int widgetIndex)
|
||||||
break;
|
break;
|
||||||
case WIDX_HARDWARE_DISPLAY_CHECKBOX:
|
case WIDX_HARDWARE_DISPLAY_CHECKBOX:
|
||||||
gConfigGeneral.hardware_display ^= 1;
|
gConfigGeneral.hardware_display ^= 1;
|
||||||
#ifdef _WIN32
|
#ifdef __WINDOWS__
|
||||||
// Windows is apparently able to switch to hardware rendering on the fly although
|
// Windows is apparently able to switch to hardware rendering on the fly although
|
||||||
// using the same window in an unaccelerated and accelerated context is unsupported by SDL2
|
// using the same window in an unaccelerated and accelerated context is unsupported by SDL2
|
||||||
gHardwareDisplay = gConfigGeneral.hardware_display;
|
gHardwareDisplay = gConfigGeneral.hardware_display;
|
||||||
|
@ -1316,11 +1316,11 @@ static void window_options_invalidate(rct_window *w)
|
||||||
RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS, uint16) = STR_SOUND_NONE;
|
RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS, uint16) = STR_SOUND_NONE;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
#ifndef __linux__
|
#ifndef __LINUX__
|
||||||
if (currentSoundDevice == 0)
|
if (currentSoundDevice == 0)
|
||||||
RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS, uint16) = 5510;
|
RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS, uint16) = 5510;
|
||||||
else
|
else
|
||||||
#endif // __linux__
|
#endif // __LINUX__
|
||||||
RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS, uint16) = 1170;
|
RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS, uint16) = 1170;
|
||||||
|
|
||||||
RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 2, uint32) = (uint32)gAudioDevices[currentSoundDevice].name;
|
RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 2, uint32) = (uint32)gAudioDevices[currentSoundDevice].name;
|
||||||
|
|
|
@ -1028,9 +1028,10 @@ static void window_ride_draw_tab_vehicle(rct_drawpixelinfo *dpi, rct_window *w)
|
||||||
x += w->x;
|
x += w->x;
|
||||||
y += w->y;
|
y += w->y;
|
||||||
|
|
||||||
dpi = clip_drawpixelinfo(dpi, x, width, y, height);
|
rct_drawpixelinfo clipDPI;
|
||||||
if (dpi == NULL)
|
if (!clip_drawpixelinfo(&clipDPI, dpi, x, y, width, height)) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
x = (widget->right - widget->left) / 2;
|
x = (widget->right - widget->left) / 2;
|
||||||
y = (widget->bottom - widget->top) - 12;
|
y = (widget->bottom - widget->top) - 12;
|
||||||
|
@ -1042,13 +1043,13 @@ static void window_ride_draw_tab_vehicle(rct_drawpixelinfo *dpi, rct_window *w)
|
||||||
|
|
||||||
rideEntry = ride_get_entry(ride);
|
rideEntry = ride_get_entry(ride);
|
||||||
if (rideEntry->flags & RIDE_ENTRY_FLAG_0) {
|
if (rideEntry->flags & RIDE_ENTRY_FLAG_0) {
|
||||||
dpi->zoom_level = 1;
|
clipDPI.zoom_level = 1;
|
||||||
dpi->width *= 2;
|
clipDPI.width *= 2;
|
||||||
dpi->height *= 2;
|
clipDPI.height *= 2;
|
||||||
x *= 2;
|
x *= 2;
|
||||||
y *= 2;
|
y *= 2;
|
||||||
dpi->x *= 2;
|
clipDPI.x *= 2;
|
||||||
dpi->y *= 2;
|
clipDPI.y *= 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
rct_ride_type_vehicle* rideVehicleEntry = &rideEntry->vehicles[trainLayout[rideEntry->tab_vehicle]];
|
rct_ride_type_vehicle* rideVehicleEntry = &rideEntry->vehicles[trainLayout[rideEntry->tab_vehicle]];
|
||||||
|
@ -1066,8 +1067,7 @@ static void window_ride_draw_tab_vehicle(rct_drawpixelinfo *dpi, rct_window *w)
|
||||||
spriteIndex |= (vehicleColour.additional_1 << 24) | (vehicleColour.main << 19);
|
spriteIndex |= (vehicleColour.additional_1 << 24) | (vehicleColour.main << 19);
|
||||||
spriteIndex |= 0x80000000;
|
spriteIndex |= 0x80000000;
|
||||||
|
|
||||||
gfx_draw_sprite(dpi, spriteIndex, x, y, vehicleColour.additional_2);
|
gfx_draw_sprite(&clipDPI, spriteIndex, x, y, vehicleColour.additional_2);
|
||||||
rct2_free(dpi);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4208,7 +4208,7 @@ static void window_ride_colour_invalidate(rct_window *w)
|
||||||
*/
|
*/
|
||||||
static void window_ride_colour_paint(rct_window *w, rct_drawpixelinfo *dpi)
|
static void window_ride_colour_paint(rct_window *w, rct_drawpixelinfo *dpi)
|
||||||
{
|
{
|
||||||
rct_drawpixelinfo *clippedDpi;
|
rct_drawpixelinfo clippedDpi;
|
||||||
rct_widget *widget;
|
rct_widget *widget;
|
||||||
rct_ride *ride;
|
rct_ride *ride;
|
||||||
rct_ride_type *rideEntry;
|
rct_ride_type *rideEntry;
|
||||||
|
@ -4265,11 +4265,15 @@ static void window_ride_colour_paint(rct_window *w, rct_drawpixelinfo *dpi)
|
||||||
trackColour = ride_get_track_colour(ride, 0);
|
trackColour = ride_get_track_colour(ride, 0);
|
||||||
widget = &w->widgets[WIDX_ENTRANCE_PREVIEW];
|
widget = &w->widgets[WIDX_ENTRANCE_PREVIEW];
|
||||||
if (widget->type != WWT_EMPTY) {
|
if (widget->type != WWT_EMPTY) {
|
||||||
clippedDpi = clip_drawpixelinfo(
|
if (clip_drawpixelinfo(
|
||||||
dpi, w->x + widget->left + 1, widget->right - widget->left, w->y + widget->top + 1, widget->bottom - widget->top
|
&clippedDpi,
|
||||||
);
|
dpi,
|
||||||
if (clippedDpi != NULL) {
|
w->x + widget->left + 1,
|
||||||
gfx_clear(clippedDpi, 0x0C0C0C0C);
|
w->y + widget->top + 1,
|
||||||
|
widget->right - widget->left,
|
||||||
|
widget->bottom - widget->top
|
||||||
|
)) {
|
||||||
|
gfx_clear(&clippedDpi, 0x0C0C0C0C);
|
||||||
|
|
||||||
if (ride->entrance_style != RIDE_ENTRANCE_STYLE_NONE) {
|
if (ride->entrance_style != RIDE_ENTRANCE_STYLE_NONE) {
|
||||||
const rct_ride_entrance_definition *entranceStyle = &RideEntranceDefinitions[ride->entrance_style];
|
const rct_ride_entrance_definition *entranceStyle = &RideEntranceDefinitions[ride->entrance_style];
|
||||||
|
@ -4284,17 +4288,15 @@ static void window_ride_colour_paint(rct_window *w, rct_drawpixelinfo *dpi)
|
||||||
spriteIndex += RideEntranceDefinitions[ride->entrance_style].sprite_index;
|
spriteIndex += RideEntranceDefinitions[ride->entrance_style].sprite_index;
|
||||||
|
|
||||||
// Back
|
// Back
|
||||||
gfx_draw_sprite(clippedDpi, spriteIndex, 34, 20, terniaryColour);
|
gfx_draw_sprite(&clippedDpi, spriteIndex, 34, 20, terniaryColour);
|
||||||
|
|
||||||
// Front
|
// Front
|
||||||
gfx_draw_sprite(clippedDpi, spriteIndex + 4, 34, 20, terniaryColour);
|
gfx_draw_sprite(&clippedDpi, spriteIndex + 4, 34, 20, terniaryColour);
|
||||||
|
|
||||||
// ?
|
// ?
|
||||||
if (terniaryColour != 0)
|
if (terniaryColour != 0)
|
||||||
gfx_draw_sprite(clippedDpi, ((spriteIndex + 20) & 0x7FFFF) + terniaryColour, 34, 20, terniaryColour);
|
gfx_draw_sprite(&clippedDpi, ((spriteIndex + 20) & 0x7FFFF) + terniaryColour, 34, 20, terniaryColour);
|
||||||
}
|
}
|
||||||
|
|
||||||
rct2_free(clippedDpi);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2094,7 +2094,7 @@ static void window_ride_construction_invalidate(rct_window *w)
|
||||||
*/
|
*/
|
||||||
static void window_ride_construction_paint(rct_window *w, rct_drawpixelinfo *dpi)
|
static void window_ride_construction_paint(rct_window *w, rct_drawpixelinfo *dpi)
|
||||||
{
|
{
|
||||||
rct_drawpixelinfo *clipdpi;
|
rct_drawpixelinfo clipdpi;
|
||||||
rct_widget *widget;
|
rct_widget *widget;
|
||||||
int x, y, width, height;
|
int x, y, width, height;
|
||||||
|
|
||||||
|
@ -2113,10 +2113,8 @@ static void window_ride_construction_paint(rct_window *w, rct_drawpixelinfo *dpi
|
||||||
y = w->y + widget->top + 1;
|
y = w->y + widget->top + 1;
|
||||||
width = widget->right - widget->left - 1;
|
width = widget->right - widget->left - 1;
|
||||||
height = widget->bottom - widget->top - 1;
|
height = widget->bottom - widget->top - 1;
|
||||||
clipdpi = clip_drawpixelinfo(dpi, x, width, y, height);
|
if (clip_drawpixelinfo(&clipdpi, dpi, x, y, width, height)) {
|
||||||
if (clipdpi != NULL) {
|
window_ride_construction_draw_track_piece(w, &clipdpi, rideIndex, trackType, trackDirection, edxRS16, width, height);
|
||||||
window_ride_construction_draw_track_piece(w, clipdpi, rideIndex, trackType, trackDirection, edxRS16, width, height);
|
|
||||||
rct2_free(clipdpi);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Draw cost
|
// Draw cost
|
||||||
|
|
|
@ -1091,8 +1091,8 @@ void window_scenery_scrollpaint(rct_window *w, rct_drawpixelinfo *dpi, int scrol
|
||||||
gfx_draw_sprite(dpi, imageId, left + 0x21, top, w->colours[1]);
|
gfx_draw_sprite(dpi, imageId, left + 0x21, top, w->colours[1]);
|
||||||
} else if (currentSceneryGlobalId >= 0x200) {
|
} else if (currentSceneryGlobalId >= 0x200) {
|
||||||
sceneryEntry = g_wallSceneryEntries[currentSceneryGlobalId - 0x200];
|
sceneryEntry = g_wallSceneryEntries[currentSceneryGlobalId - 0x200];
|
||||||
rct_drawpixelinfo* clipdpi = clip_drawpixelinfo(dpi, left + 1, 64, top + 1, 78);
|
rct_drawpixelinfo clipdpi;
|
||||||
if (clipdpi != NULL) {
|
if (clip_drawpixelinfo(&clipdpi, dpi, left + 1, top + 1, 64, 78)) {
|
||||||
uint32 imageId = sceneryEntry->image;
|
uint32 imageId = sceneryEntry->image;
|
||||||
uint8 tertiaryColour = w->colours[1];
|
uint8 tertiaryColour = w->colours[1];
|
||||||
|
|
||||||
|
@ -1102,11 +1102,11 @@ void window_scenery_scrollpaint(rct_window *w, rct_drawpixelinfo *dpi, int scrol
|
||||||
if (sceneryEntry->wall.flags & WALL_SCENERY_HAS_SECONDARY_COLOUR) {
|
if (sceneryEntry->wall.flags & WALL_SCENERY_HAS_SECONDARY_COLOUR) {
|
||||||
imageId |= (window_scenery_secondary_colour << 24) | 0x80000000;
|
imageId |= (window_scenery_secondary_colour << 24) | 0x80000000;
|
||||||
}
|
}
|
||||||
gfx_draw_sprite(clipdpi, imageId, 0x2F, (sceneryEntry->wall.height * 2) + 0x32,
|
gfx_draw_sprite(&clipdpi, imageId, 0x2F, (sceneryEntry->wall.height * 2) + 0x32,
|
||||||
tertiaryColour);
|
tertiaryColour);
|
||||||
|
|
||||||
imageId = (sceneryEntry->image + 0x40000006) | ((window_scenery_primary_colour + 0x70) << 19);
|
imageId = (sceneryEntry->image + 0x40000006) | ((window_scenery_primary_colour + 0x70) << 19);
|
||||||
gfx_draw_sprite(clipdpi, imageId, 0x2F, (sceneryEntry->wall.height * 2) + 0x32,
|
gfx_draw_sprite(&clipdpi, imageId, 0x2F, (sceneryEntry->wall.height * 2) + 0x32,
|
||||||
tertiaryColour);
|
tertiaryColour);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -1121,17 +1121,14 @@ void window_scenery_scrollpaint(rct_window *w, rct_drawpixelinfo *dpi, int scrol
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
gfx_draw_sprite(clipdpi, imageId, 0x2F, (sceneryEntry->wall.height * 2) + 0x32,
|
gfx_draw_sprite(&clipdpi, imageId, 0x2F, (sceneryEntry->wall.height * 2) + 0x32,
|
||||||
tertiaryColour);
|
tertiaryColour);
|
||||||
|
|
||||||
if (sceneryEntry->wall.flags & WALL_SCENERY_FLAG5){
|
if (sceneryEntry->wall.flags & WALL_SCENERY_FLAG5){
|
||||||
gfx_draw_sprite(clipdpi, imageId + 1, 0x2F, (sceneryEntry->wall.height * 2) + 0x32,
|
gfx_draw_sprite(&clipdpi, imageId + 1, 0x2F, (sceneryEntry->wall.height * 2) + 0x32,
|
||||||
tertiaryColour);
|
tertiaryColour);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
rct2_free(clipdpi);
|
|
||||||
}
|
}
|
||||||
} else if (currentSceneryGlobalId >= 0x100) {
|
} else if (currentSceneryGlobalId >= 0x100) {
|
||||||
sceneryEntry = g_pathBitSceneryEntries[currentSceneryGlobalId - 0x100];
|
sceneryEntry = g_pathBitSceneryEntries[currentSceneryGlobalId - 0x100];
|
||||||
|
@ -1140,9 +1137,8 @@ void window_scenery_scrollpaint(rct_window *w, rct_drawpixelinfo *dpi, int scrol
|
||||||
gfx_draw_sprite(dpi, imageId, left + 0x0B, top + 0x10, w->colours[1]);
|
gfx_draw_sprite(dpi, imageId, left + 0x0B, top + 0x10, w->colours[1]);
|
||||||
} else {
|
} else {
|
||||||
sceneryEntry = g_smallSceneryEntries[currentSceneryGlobalId];
|
sceneryEntry = g_smallSceneryEntries[currentSceneryGlobalId];
|
||||||
rct_drawpixelinfo* clipdpi = clip_drawpixelinfo(dpi, left + 1, SCENERY_BUTTON_WIDTH - 2, top + 1, SCENERY_BUTTON_HEIGHT - 2);
|
rct_drawpixelinfo clipdpi;
|
||||||
if (clipdpi != NULL) {
|
if (clip_drawpixelinfo(&clipdpi, dpi, left + 1, top + 1, SCENERY_BUTTON_WIDTH - 2, SCENERY_BUTTON_HEIGHT - 2)) {
|
||||||
|
|
||||||
uint32 imageId = sceneryEntry->image + window_scenery_rotation;
|
uint32 imageId = sceneryEntry->image + window_scenery_rotation;
|
||||||
|
|
||||||
if (sceneryEntry->small_scenery.flags & SMALL_SCENERY_FLAG_HAS_PRIMARY_COLOUR) {
|
if (sceneryEntry->small_scenery.flags & SMALL_SCENERY_FLAG_HAS_PRIMARY_COLOUR) {
|
||||||
|
@ -1160,21 +1156,19 @@ void window_scenery_scrollpaint(rct_window *w, rct_drawpixelinfo *dpi, int scrol
|
||||||
spriteTop -= 0x0C;
|
spriteTop -= 0x0C;
|
||||||
}
|
}
|
||||||
|
|
||||||
gfx_draw_sprite(clipdpi, imageId, 0x20, spriteTop, w->colours[1]);
|
gfx_draw_sprite(&clipdpi, imageId, 0x20, spriteTop, w->colours[1]);
|
||||||
|
|
||||||
if (sceneryEntry->small_scenery.flags & 0x200) {
|
if (sceneryEntry->small_scenery.flags & 0x200) {
|
||||||
imageId = ((sceneryEntry->image + window_scenery_rotation) + 0x40000004) +
|
imageId = ((sceneryEntry->image + window_scenery_rotation) + 0x40000004) +
|
||||||
((window_scenery_primary_colour + 0x70) << 19);
|
((window_scenery_primary_colour + 0x70) << 19);
|
||||||
|
|
||||||
gfx_draw_sprite(clipdpi, imageId, 0x20, spriteTop, w->colours[1]);
|
gfx_draw_sprite(&clipdpi, imageId, 0x20, spriteTop, w->colours[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sceneryEntry->small_scenery.flags & SMALL_SCENERY_FLAG8) {
|
if (sceneryEntry->small_scenery.flags & SMALL_SCENERY_FLAG8) {
|
||||||
imageId = (sceneryEntry->image + window_scenery_rotation) + 4;
|
imageId = (sceneryEntry->image + window_scenery_rotation) + 4;
|
||||||
gfx_draw_sprite(clipdpi, imageId, 0x20, spriteTop, w->colours[1]);
|
gfx_draw_sprite(&clipdpi, imageId, 0x20, spriteTop, w->colours[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
rct2_free(clipdpi);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -976,8 +976,10 @@ void window_staff_overview_tab_paint(rct_window* w, rct_drawpixelinfo* dpi)
|
||||||
int y = widget->top + 1 + w->y;
|
int y = widget->top + 1 + w->y;
|
||||||
if (w->page == WINDOW_STAFF_OVERVIEW) height++;
|
if (w->page == WINDOW_STAFF_OVERVIEW) height++;
|
||||||
|
|
||||||
rct_drawpixelinfo* clip_dpi = clip_drawpixelinfo(dpi, x, width, y, height);
|
rct_drawpixelinfo clip_dpi;
|
||||||
if (!clip_dpi) return;
|
if (!clip_drawpixelinfo(&clip_dpi, dpi, x, y, width, height)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
x = 14;
|
x = 14;
|
||||||
y = 20;
|
y = 20;
|
||||||
|
@ -998,30 +1000,28 @@ void window_staff_overview_tab_paint(rct_window* w, rct_drawpixelinfo* dpi)
|
||||||
ebx += eax;
|
ebx += eax;
|
||||||
|
|
||||||
int sprite_id = ebx | (peep->tshirt_colour << 19) | (peep->trousers_colour << 24) | 0xA0000000;
|
int sprite_id = ebx | (peep->tshirt_colour << 19) | (peep->trousers_colour << 24) | 0xA0000000;
|
||||||
gfx_draw_sprite(clip_dpi, sprite_id, x, y, 0);
|
gfx_draw_sprite(&clip_dpi, sprite_id, x, y, 0);
|
||||||
|
|
||||||
// If holding a balloon
|
// If holding a balloon
|
||||||
if (ebx >= 0x2A1D && ebx < 0x2A3D){
|
if (ebx >= 0x2A1D && ebx < 0x2A3D){
|
||||||
ebx += 32;
|
ebx += 32;
|
||||||
ebx |= (peep->balloon_colour << 19) | 0x20000000;
|
ebx |= (peep->balloon_colour << 19) | 0x20000000;
|
||||||
gfx_draw_sprite(clip_dpi, ebx, x, y, 0);
|
gfx_draw_sprite(&clip_dpi, ebx, x, y, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
// If holding umbrella
|
// If holding umbrella
|
||||||
if (ebx >= 0x2BBD && ebx < 0x2BDD){
|
if (ebx >= 0x2BBD && ebx < 0x2BDD){
|
||||||
ebx += 32;
|
ebx += 32;
|
||||||
ebx |= (peep->umbrella_colour << 19) | 0x20000000;
|
ebx |= (peep->umbrella_colour << 19) | 0x20000000;
|
||||||
gfx_draw_sprite(clip_dpi, ebx, x, y, 0);
|
gfx_draw_sprite(&clip_dpi, ebx, x, y, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
// If wearing hat
|
// If wearing hat
|
||||||
if (ebx >= 0x29DD && ebx < 0x29FD){
|
if (ebx >= 0x29DD && ebx < 0x29FD){
|
||||||
ebx += 32;
|
ebx += 32;
|
||||||
ebx |= (peep->hat_colour << 19) | 0x20000000;
|
ebx |= (peep->hat_colour << 19) | 0x20000000;
|
||||||
gfx_draw_sprite(clip_dpi, ebx, x, y, 0);
|
gfx_draw_sprite(&clip_dpi, ebx, x, y, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
rct2_free(clip_dpi);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -574,27 +574,19 @@ void window_staff_list_paint(rct_window *w, rct_drawpixelinfo *dpi)
|
||||||
window_staff_list_widgets[WIDX_STAFF_LIST_SECURITY_TAB].bottom - 6 + w->y, 0
|
window_staff_list_widgets[WIDX_STAFF_LIST_SECURITY_TAB].bottom - 6 + w->y, 0
|
||||||
);
|
);
|
||||||
|
|
||||||
rct_drawpixelinfo* sprite_dpi = clip_drawpixelinfo(
|
rct_drawpixelinfo sprite_dpi;
|
||||||
|
if (clip_drawpixelinfo(
|
||||||
|
&sprite_dpi,
|
||||||
dpi,
|
dpi,
|
||||||
window_staff_list_widgets[WIDX_STAFF_LIST_ENTERTAINERS_TAB].left + w->x + 1,
|
window_staff_list_widgets[WIDX_STAFF_LIST_ENTERTAINERS_TAB].left + w->x + 1,
|
||||||
window_staff_list_widgets[WIDX_STAFF_LIST_ENTERTAINERS_TAB].right - window_staff_list_widgets[WIDX_STAFF_LIST_ENTERTAINERS_TAB].left - 1,
|
|
||||||
window_staff_list_widgets[WIDX_STAFF_LIST_ENTERTAINERS_TAB].top + w->y + 1,
|
window_staff_list_widgets[WIDX_STAFF_LIST_ENTERTAINERS_TAB].top + w->y + 1,
|
||||||
|
window_staff_list_widgets[WIDX_STAFF_LIST_ENTERTAINERS_TAB].right - window_staff_list_widgets[WIDX_STAFF_LIST_ENTERTAINERS_TAB].left - 1,
|
||||||
window_staff_list_widgets[WIDX_STAFF_LIST_ENTERTAINERS_TAB].bottom - window_staff_list_widgets[WIDX_STAFF_LIST_ENTERTAINERS_TAB].top - 1
|
window_staff_list_widgets[WIDX_STAFF_LIST_ENTERTAINERS_TAB].bottom - window_staff_list_widgets[WIDX_STAFF_LIST_ENTERTAINERS_TAB].top - 1
|
||||||
);
|
)) {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (sprite_dpi != NULL) {
|
|
||||||
// Entertainers tab image
|
// Entertainers tab image
|
||||||
i = (selectedTab == 3 ? w->list_information_type & 0x0FFFFFFFC : 0);
|
i = (selectedTab == 3 ? w->list_information_type & 0x0FFFFFFFC : 0);
|
||||||
i += RCT2_ADDRESS(RCT2_GLOBAL(0x00982738, int), int)[0] + 1;
|
i += RCT2_ADDRESS(RCT2_GLOBAL(0x00982738, int), int)[0] + 1;
|
||||||
gfx_draw_sprite(
|
gfx_draw_sprite(&sprite_dpi, i, 0x0F, 0x17, 0);
|
||||||
sprite_dpi,
|
|
||||||
i,
|
|
||||||
0x0F,
|
|
||||||
0x17, 0
|
|
||||||
);
|
|
||||||
rct2_free(sprite_dpi);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(RCT2_GLOBAL(RCT2_ADDRESS_PARK_FLAGS, uint32) & PARK_FLAGS_NO_MONEY)) {
|
if (!(RCT2_GLOBAL(RCT2_ADDRESS_PARK_FLAGS, uint32) & PARK_FLAGS_NO_MONEY)) {
|
||||||
|
|
|
@ -595,14 +595,13 @@ static void window_track_place_invalidate(rct_window *w)
|
||||||
*/
|
*/
|
||||||
static void window_track_place_paint(rct_window *w, rct_drawpixelinfo *dpi)
|
static void window_track_place_paint(rct_window *w, rct_drawpixelinfo *dpi)
|
||||||
{
|
{
|
||||||
rct_drawpixelinfo *clippedDpi;
|
rct_drawpixelinfo clippedDpi;
|
||||||
rct_g1_element tmpElement, *substituteElement;
|
rct_g1_element tmpElement, *substituteElement;
|
||||||
|
|
||||||
window_draw_widgets(w, dpi);
|
window_draw_widgets(w, dpi);
|
||||||
|
|
||||||
// Draw mini tile preview
|
// Draw mini tile preview
|
||||||
clippedDpi = clip_drawpixelinfo(dpi, w->x + 4, 168, w->y + 18, 78);
|
if (clip_drawpixelinfo(&clippedDpi, dpi, w->x + 4, 168, w->y + 18, 78)) {
|
||||||
if (clippedDpi != NULL) {
|
|
||||||
substituteElement = &g1Elements[0];
|
substituteElement = &g1Elements[0];
|
||||||
tmpElement = *substituteElement;
|
tmpElement = *substituteElement;
|
||||||
substituteElement->offset = _window_track_place_mini_preview;
|
substituteElement->offset = _window_track_place_mini_preview;
|
||||||
|
@ -611,10 +610,8 @@ static void window_track_place_paint(rct_window *w, rct_drawpixelinfo *dpi)
|
||||||
substituteElement->x_offset = 0;
|
substituteElement->x_offset = 0;
|
||||||
substituteElement->y_offset = 0;
|
substituteElement->y_offset = 0;
|
||||||
substituteElement->flags = 0;
|
substituteElement->flags = 0;
|
||||||
gfx_draw_sprite(clippedDpi, 0, 0, 0, 0);
|
gfx_draw_sprite(&clippedDpi, 0, 0, 0, 0);
|
||||||
*substituteElement = tmpElement;
|
*substituteElement = tmpElement;
|
||||||
|
|
||||||
rct2_free(clippedDpi);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Price
|
// Price
|
||||||
|
|
|
@ -3654,7 +3654,7 @@ void map_reorganise_elements()
|
||||||
{
|
{
|
||||||
platform_set_cursor(CURSOR_ZZZ);
|
platform_set_cursor(CURSOR_ZZZ);
|
||||||
|
|
||||||
rct_map_element* new_map_elements = rct2_malloc(0x30000 * sizeof(rct_map_element));
|
rct_map_element* new_map_elements = malloc(0x30000 * sizeof(rct_map_element));
|
||||||
rct_map_element* new_elements_pointer = new_map_elements;
|
rct_map_element* new_elements_pointer = new_map_elements;
|
||||||
|
|
||||||
if (new_map_elements == NULL || new_map_elements == (rct_map_element*)-1){
|
if (new_map_elements == NULL || new_map_elements == (rct_map_element*)-1){
|
||||||
|
@ -3680,7 +3680,7 @@ void map_reorganise_elements()
|
||||||
memcpy(RCT2_ADDRESS(RCT2_ADDRESS_MAP_ELEMENTS, rct_map_element), new_map_elements, num_elements * sizeof(rct_map_element));
|
memcpy(RCT2_ADDRESS(RCT2_ADDRESS_MAP_ELEMENTS, rct_map_element), new_map_elements, num_elements * sizeof(rct_map_element));
|
||||||
memset(RCT2_ADDRESS(RCT2_ADDRESS_MAP_ELEMENTS, rct_map_element) + num_elements, 0, (0x30000 - num_elements) * sizeof(rct_map_element));
|
memset(RCT2_ADDRESS(RCT2_ADDRESS_MAP_ELEMENTS, rct_map_element) + num_elements, 0, (0x30000 - num_elements) * sizeof(rct_map_element));
|
||||||
|
|
||||||
rct2_free(new_map_elements);
|
free(new_map_elements);
|
||||||
|
|
||||||
map_update_tile_pointers();
|
map_update_tile_pointers();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue