Merge branch 'mingw' of https://github.com/anyc/OpenRCT2 into anyc-mingw

This commit is contained in:
IntelOrca 2014-05-22 23:32:45 +01:00
commit fec1edb51e
50 changed files with 1776 additions and 86 deletions

58
CMakeLists.txt Normal file
View File

@ -0,0 +1,58 @@
cmake_minimum_required(VERSION 2.6)
#
# Execute these commands in this directory:
#
# 1. mkdir build/; cd build/
#
# 2. Choose compiler:
# Build with native toolchain:
# cmake -DCMAKE_BUILD_TYPE=Debug ..
#
# Build with mingw:
# cmake -DCMAKE_TOOLCHAIN_FILE=../CMakeLists_mingw.txt -DCMAKE_BUILD_TYPE=Debug ..
#
# 3. make
#
# project title
set (PROJECT openrct2)
# OpenRCT2 resource directory
set (ORCT2_RESOURCE_DIR ${CMAKE_INSTALL_PREFIX}/share/${PROJECT}/)
project(${PROJECT})
add_definitions(-DORCT2_RESOURCE_DIR="${ORCT2_RESOURCE_DIR}")
# include lodepng
include_directories("lodepng/")
file(GLOB_RECURSE ORCT2_SOURCES "src/*.c" "lodepng/*.c")
# build as library for now, replace with add_executable
add_library(${PROJECT} SHARED ${ORCT2_SOURCES})
# install into ${CMAKE_INSTALL_PREFIX}/bin/
install (TARGETS ${PROJECT} DESTINATION bin)
# libopenrct2.dll -> openrct2.dll
set_target_properties(${PROJECT} PROPERTIES PREFIX "")
if (UNIX)
# force 32bit build for now and set necessary flags to compile code as is
set(CMAKE_C_FLAGS "-m32 -masm=intel -std=c99")
set(CMAKE_LDFLAGS_FLAGS "-m32")
# find and include SDL2
INCLUDE(FindPkgConfig)
PKG_SEARCH_MODULE(SDL2 REQUIRED sdl2)
INCLUDE_DIRECTORIES(${SDL2_INCLUDE_DIRS})
TARGET_LINK_LIBRARIES(${PROJECT} ${SDL2_LIBRARIES})
endif (UNIX)
TARGET_LINK_LIBRARIES(${PROJECT} ${SDL2_LIBRARIES})
if (WIN32)
target_link_libraries(${PROJECT} winmm.lib -limm32 -lversion)
endif (WIN32)

31
CMakeLists_mingw.txt Normal file
View File

@ -0,0 +1,31 @@
SET(CMAKE_SYSTEM_NAME Windows)
SET(COMPILER_PREFIX i686-w64-mingw32)
SET(CMAKE_C_COMPILER ${COMPILER_PREFIX}-gcc)
SET(CMAKE_CXX_COMPILER ${COMPILER_PREFIX}-c++)
SET(CMAKE_RC_COMPILER ${COMPILER_PREFIX}-windres)
SET(CMAKE_PKGCONFIG_EXECUTABLE ${COMPILER_PREFIX}-pkg-config)
SET(PKG_CONFIG_EXECUTABLE ${COMPILER_PREFIX}-pkg-config)
# potential flags to make code more similar to MSVC:
# -fshort-wchar -fshort-enums -mms-bitfields -fpack-struct=1
#
set(CMAKE_C_FLAGS "-masm=intel -std=gnu99" CACHE STRING "" FORCE)
set(CMAKE_SHARED_LINKER_FLAGS "-static-libgcc" CACHE STRING "" FORCE)
include_directories("/usr/include/wine/windows/")
# find and include SDL2
INCLUDE(FindPkgConfig)
PKG_SEARCH_MODULE(SDL2 REQUIRED sdl2)
INCLUDE_DIRECTORIES(${SDL2_INCLUDE_DIRS})
# here is the target environment located
SET(CMAKE_FIND_ROOT_PATH /usr/${COMPILER_PREFIX})
# adjust the default behaviour of the FIND_XXX() commands:
# search headers and libraries in the target environment, search
# programs in the host environment
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)

View File

@ -39,7 +39,7 @@
<ClInclude Include="..\src\settings.h" />
<ClInclude Include="..\src\sprite.h" />
<ClInclude Include="..\src\sprites.h" />
<ClInclude Include="..\src\strings.h" />
<ClInclude Include="..\src\string_ids.h" />
<ClInclude Include="..\src\title.h" />
<ClInclude Include="..\src\track.h" />
<ClInclude Include="..\src\tutorial.h" />
@ -74,7 +74,7 @@
<ClCompile Include="..\src\sawyercoding.c" />
<ClCompile Include="..\src\scenario.c" />
<ClCompile Include="..\src\screenshot.c" />
<ClCompile Include="..\src\strings.c" />
<ClCompile Include="..\src\string_ids.c" />
<ClCompile Include="..\src\title.c" />
<ClCompile Include="..\src\track.c" />
<ClCompile Include="..\src\tutorial.c" />
@ -193,4 +193,4 @@
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
</Project>

View File

@ -48,7 +48,7 @@
<ClInclude Include="resource.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\src\strings.h">
<ClInclude Include="..\src\string_ids.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\src\peep.h">
@ -182,7 +182,7 @@
<ClCompile Include="..\src\scenario.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\src\strings.c">
<ClCompile Include="..\src\string_ids.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\src\config.c">
@ -302,4 +302,4 @@
<Filter>Resource Files</Filter>
</None>
</ItemGroup>
</Project>
</Project>

View File

@ -286,13 +286,22 @@
static void RCT2_CALLPROC_EBPSAFE(int address)
{
#ifdef _MSC_VER
__asm push ebp
__asm call address
__asm pop ebp
#else
__asm__ ( "\
push ebp \n\
call %[address] \n\
pop ebp \n\
" : [address] "+m" (address) );
#endif
}
static void RCT2_CALLPROC_X(int address, int _eax, int _ebx, int _ecx, int _edx, int _esi, int _edi, int _ebp)
{
#ifdef _MSC_VER
__asm {
push address
mov eax, _eax
@ -305,10 +314,33 @@ static void RCT2_CALLPROC_X(int address, int _eax, int _ebx, int _ecx, int _edx,
call [esp]
add esp, 4
}
#else
__asm__ ( "\
\n\
push ebx \n\
push ebp \n\
push %[address] \n\
mov eax, %[_eax] \n\
mov ebx, %[_ebx] \n\
mov ecx, %[_ecx] \n\
mov edx, %[_edx] \n\
mov esi, %[_esi] \n\
mov edi, %[_edi] \n\
mov ebp, %[_ebp] \n\
call [esp] \n\
add esp, 4 \n\
pop ebp \n\
pop ebx \n\
" : [address] "+m" (address), [_eax] "+m" (_eax), [_ebx] "+m" (_ebx), [_ecx] "+m" (_ecx), [_edx] "+m" (_edx), [_esi] "+m" (_esi), [_edi] "+m" (_edi), [_ebp] "+m" (_ebp)
:
: "eax","ecx","edx","esi","edi"
);
#endif
}
static void RCT2_CALLFUNC_X(int address, int *_eax, int *_ebx, int *_ecx, int *_edx, int *_esi, int *_edi, int *_ebp)
{
#ifdef _MSC_VER
__asm {
// Store C's base pointer
push ebp
@ -375,6 +407,80 @@ static void RCT2_CALLFUNC_X(int address, int *_eax, int *_ebx, int *_ecx, int *_
add esp, 4
}
#else
__asm__ ( "\
\n\
/* Store C's base pointer*/ \n\
push ebx \n\
push ebp \n\
\n\
/* Store %[address] to call*/ \n\
push %[address] \n\
\n\
/* Set all registers to the input values*/ \n\
mov eax, [%[_eax]] \n\
mov eax, [eax] \n\
mov ebx, [%[_ebx]] \n\
mov ebx, [ebx] \n\
mov ecx, [%[_ecx]] \n\
mov ecx, [ecx] \n\
mov edx, [%[_edx]] \n\
mov edx, [edx] \n\
mov esi, [%[_esi]] \n\
mov esi, [esi] \n\
mov edi, [%[_edi]] \n\
mov edi, [edi] \n\
mov ebp, [%[_ebp]] \n\
mov ebp, [ebp] \n\
\n\
/* Call function*/ \n\
call [esp] \n\
add esp, 4 \n\
\n\
/* Store output eax*/ \n\
push eax \n\
\n\
/* Put original C base pointer into eax*/ \n\
mov eax, [esp+4] \n\
\n\
/* Store output ebp*/ \n\
push ebp \n\
\n\
/* Set ebp to the original C base pointer*/ \n\
mov ebp, eax \n\
\n\
/* Put output ebp into ebp parameter*/ \n\
mov eax, [esp] \n\
push ebx \n\
mov ebx, [%[_ebp]] \n\
mov [ebx], eax \n\
pop ebx \n\
add esp, 4 \n\
\n\
/* Get resulting ebx, ecx, edx, esi, edi registers*/ \n\
mov eax, [%[_edi]] \n\
mov [eax], edi \n\
mov eax, [%[_esi]] \n\
mov [eax], esi \n\
mov eax, [%[_edx]] \n\
mov [eax], edx \n\
mov eax, [%[_ecx]] \n\
mov [eax], ecx \n\
mov eax, [%[_ebx]] \n\
mov [eax], ebx \n\
pop eax \n\
\n\
/* Get resulting eax register*/ \n\
mov ebx, [%[_eax]] \n\
mov [ebx], eax \n\
\n\
add esp, 4 \n\
pop ebx \n\
" : [address] "+m" (address), [_eax] "+m" (_eax), [_ebx] "+m" (_ebx), [_ecx] "+m" (_ecx), [_edx] "+m" (_edx), [_esi] "+m" (_esi), [_edi] "+m" (_edi), [_ebp] "+m" (_ebp)
:
: "eax","ecx","edx","esi","edi"
);
#endif
}
#endif

View File

@ -21,6 +21,7 @@
#include <stdio.h>
#include <shlobj.h>
#include <windows.h>
#include <tchar.h>
#include <SDL_keycode.h>
#include "addresses.h"
#include "config.h"

View File

@ -31,7 +31,7 @@
#include "viewport.h"
#include "finance.h"
#include "audio.h"
#include "strings.h"
#include "string_ids.h"
static void set_all_land_owned();

View File

@ -32,7 +32,7 @@
#include "sawyercoding.h"
#include "scenario.h"
#include "screenshot.h"
#include "strings.h"
#include "string_ids.h"
#include "title.h"
#include "tutorial.h"
#include "viewport.h"
@ -1310,7 +1310,12 @@ static void game_pause_toggle()
{
char input_bl;
#ifdef _MSC_VER
__asm mov input_bl, bl
#else
__asm__ ( "mov %[input_bl], bl " : [input_bl] "+m" (input_bl) );
#endif
if (input_bl & 1) {
RCT2_GLOBAL(0x009DEA6E, uint32) ^= 1;
@ -1321,7 +1326,12 @@ static void game_pause_toggle()
unpause_sounds();
}
#ifdef _MSC_VER
__asm mov ebx, 0
#else
__asm__ ( "mov ebx, 0 " );
#endif
}
/**
@ -1333,9 +1343,24 @@ static void game_load_or_quit()
char input_bl, input_dl;
short input_di;
#ifdef _MSC_VER
__asm mov input_bl, bl
#else
__asm__ ( "mov %[input_bl], bl " : [input_bl] "+m" (input_bl) );
#endif
#ifdef _MSC_VER
__asm mov input_dl, dl
#else
__asm__ ( "mov %[input_dl], dl " : [input_dl] "+m" (input_dl) );
#endif
#ifdef _MSC_VER
__asm mov input_di, di
#else
__asm__ ( "mov %[input_di], di " : [input_di] "+m" (input_di) );
#endif
if (!(input_bl & 1))
return; // 0;
@ -1353,7 +1378,12 @@ static void game_load_or_quit()
break;
}
#ifdef _MSC_VER
__asm mov ebx, 0
#else
__asm__ ( "mov ebx, 0 " );
#endif
}
/**

View File

@ -20,11 +20,13 @@
#include <assert.h>
#include <stdio.h>
#include <stdint.h>
#include <string.h>
#include <windows.h>
#include "addresses.h"
#include "gfx.h"
#include "rct2.h"
#include "strings.h"
#include "string_ids.h"
#include "window.h"
// HACK These were originally passed back through registers

View File

@ -25,7 +25,7 @@
#include "rct2.h"
#include "osinterface.h"
#include "sprites.h"
#include "strings.h"
#include "string_ids.h"
static void screen_intro_process_mouse_input();
static void screen_intro_process_keyboard_input();

View File

@ -18,13 +18,14 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*****************************************************************************/
#include <string.h>
#include "addresses.h"
#include "audio.h"
#include "date.h"
#include "news_item.h"
#include "rct2.h"
#include "ride.h"
#include "strings.h"
#include "string_ids.h"
#include "sprite.h"
#include "window.h"

View File

@ -23,7 +23,7 @@
#include "rct2.h"
#include "map.h"
#include "strings.h"
#include "string_ids.h"
enum {

View File

@ -66,7 +66,7 @@ static void osinterface_create_window()
int width, height;
if (SDL_Init(SDL_INIT_VIDEO) < 0) {
fprintf(stderr, "Error: SDL_Init\n");
RCT2_ERROR("SDL_Init %s", SDL_GetError());
exit(-1);
}
@ -86,9 +86,16 @@ static void osinterface_create_window()
_window = SDL_CreateWindow("OpenRCT2", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, width, height, SDL_WINDOW_RESIZABLE);
if (!_window) {
RCT2_ERROR("SDL_CreateWindow failed %s", SDL_GetError());
exit(-1);
}
// Get the HWND context
SDL_GetWindowWMInfo(_window, &wmInfo);
if (SDL_GetWindowWMInfo(_window, &wmInfo) != SDL_TRUE) {
RCT2_ERROR("SDL_GetWindowWMInfo failed %s", SDL_GetError());
exit(-1);
}
hWnd = wmInfo.info.win.window;
RCT2_GLOBAL(0x009E2D70, HWND) = hWnd;
@ -113,7 +120,15 @@ static void osinterface_resize(int width, int height)
_surface = SDL_CreateRGBSurface(0, width, height, 8, 0, 0, 0, 0);
_palette = SDL_AllocPalette(256);
SDL_SetSurfacePalette(_surface, _palette);
if (!_surface || !_palette) {
RCT2_ERROR("%p || %p == NULL %s", _surface, _palette, SDL_GetError());
exit(-1);
}
if (SDL_SetSurfacePalette(_surface, _palette)) {
RCT2_ERROR("SDL_SetSurfacePalette failed %s", SDL_GetError());
exit(-1);
}
newScreenBufferSize = _surface->pitch * _surface->h;
newScreenBuffer = malloc(newScreenBufferSize);
@ -159,6 +174,10 @@ static void osinterface_update_palette(char* colours, int start_index, int num_c
int i;
surface = SDL_GetWindowSurface(_window);
if (!surface) {
RCT2_ERROR("SDL_GetWindowSurface failed %s", SDL_GetError());
exit(1);
}
for (i = 0; i < 256; i++) {
base[i].r = colours[2];
@ -168,15 +187,20 @@ static void osinterface_update_palette(char* colours, int start_index, int num_c
colours += 4;
}
SDL_SetPaletteColors(_palette, base, 0, 256);
if (SDL_SetPaletteColors(_palette, base, 0, 256)) {
RCT2_ERROR("SDL_SetPaletteColors failed %s", SDL_GetError());
exit(1);
}
}
void osinterface_draw()
{
// Lock the surface before setting its pixels
if (SDL_MUSTLOCK(_surface))
if (SDL_LockSurface(_surface) < 0)
if (SDL_LockSurface(_surface) < 0) {
RCT2_ERROR("locking failed %s", SDL_GetError());
return;
}
// Copy pixels from the virtual screen buffer to the surface
memcpy(_surface->pixels, _screenBuffer, _surface->pitch * _surface->h);
@ -186,8 +210,14 @@ void osinterface_draw()
SDL_UnlockSurface(_surface);
// Copy the surface to the window
SDL_BlitSurface(_surface, NULL, SDL_GetWindowSurface(_window), NULL);
SDL_UpdateWindowSurface(_window);
if (SDL_BlitSurface(_surface, NULL, SDL_GetWindowSurface(_window), NULL)) {
RCT2_ERROR("SDL_BlitSurface %s", SDL_GetError());
exit(1);
}
if (SDL_UpdateWindowSurface(_window)) {
RCT2_ERROR("SDL_UpdateWindowSurface %s", SDL_GetError());
exit(1);
}
}
void osinterface_process_messages()
@ -390,7 +420,8 @@ char* osinterface_open_directory_browser(char *title) {
// Copy the path directory to the buffer
if (SHGetPathFromIDList(pidl, pszBuffer)) {
// Store pszBuffer (and the path) in the outPath
outPath = strcat("", pszBuffer);
outPath = (char*) malloc(strlen(pszBuffer)+1);
strcpy(outPath, pszBuffer);
}
}
CoUninitialize();

View File

@ -18,6 +18,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*****************************************************************************/
#include <windows.h>
#include "addresses.h"
#include "finance.h"
#include "map.h"
@ -26,7 +27,7 @@
#include "ride.h"
#include "scenario.h"
#include "sprite.h"
#include "strings.h"
#include "string_ids.h"
#include "window.h"
int park_is_open()

View File

@ -23,7 +23,7 @@
#include <string.h>
#include <setjmp.h>
#include <windows.h>
#include <ShlObj.h>
#include <shlobj.h>
#include <SDL.h>
#include "addresses.h"
#include "climate.h"
@ -141,7 +141,7 @@ void rct2_init()
title_load();
gfx_clear(RCT2_ADDRESS(RCT2_ADDRESS_SCREEN_DPI, rct_drawpixelinfo), 10);
RCT2_GLOBAL(RCT2_ADDRESS_RUN_INTRO_TICK_PART, int) = gGeneral_config.play_intro ? 8 : 0;
RCT2_GLOBAL(RCT2_ADDRESS_RUN_INTRO_TICK_PART, uint8) = gGeneral_config.play_intro ? 8 : 255;
}
// rct2: 0x00683499
@ -182,17 +182,25 @@ void rct2_startup_checks()
{
// check if game is already running
RCT2_CALLPROC(0x00674C0B);
RCT2_CALLPROC_EBPSAFE(0x00674C0B);
}
void rct2_update()
{
// Set 0x009DE564 to the value of esp
// RCT2 sets the stack pointer to the value of this address when ending the current game tick from anywhere
#ifdef _MSC_VER
__asm {
mov eax, 009DE564h
mov [eax], esp
}
#else
__asm__ ( "\
\n\
mov eax, 0x009DE564 \n\
mov [eax], esp \n\
" : : : "eax" );
#endif
if (!setjmp(_end_update_jump))
rct2_update_2();
@ -330,7 +338,7 @@ void get_system_info()
RCT2_GLOBAL(RCT2_ADDRESS_MEM_TOTAL_PAGEFILE, uint32) = memInfo.dwTotalPageFile;
RCT2_GLOBAL(RCT2_ADDRESS_MEM_TOTAL_VIRTUAL, uint32) = memInfo.dwTotalVirtual;
uint32 size = 80;
DWORD size = 80;
GetUserName((char*)RCT2_ADDRESS_OS_USER_NAME, &size);
size = 80;
GetComputerName((char*)RCT2_ADDRESS_OS_COMPUTER_NAME, &size);
@ -355,7 +363,7 @@ void get_system_info()
else
RCT2_GLOBAL(0x1423C18, sint32) = 1;
RCT2_GLOBAL(0x01423C20, uint32) = RCT2_CALLFUNC(0x406993, uint32); // cpu_has_mmx()
RCT2_GLOBAL(0x01423C20, uint32) = (SDL_HasMMX() == SDL_TRUE);
}

View File

@ -23,6 +23,7 @@
#include <stddef.h>
#include <stdlib.h>
#include <stdio.h>
typedef signed char sint8;
typedef signed short sint16;
@ -44,7 +45,18 @@ typedef unsigned long long uint64;
#define sgn(x) ((x > 0) ? 1 : ((x < 0) ? -1 : 0))
#define clamp(l, x, h) (min(h, max(l, x)))
#define countof(x) _countof(x)
#define countof(x) ((sizeof(x)/sizeof(0[x])) / ((size_t)(!(sizeof(x) % sizeof(0[x])))))
#ifdef _MSC_VER
#define RCT2_ERROR(format,...) fprintf(stderr, "ERROR %s:%s():%d: " format "\n", __FILE__, __FUNCTION__, __LINE__, __VA_ARGS__);
#else
#define RCT2_ERROR(format,...) fprintf(stderr, "ERROR %s:%s():%d: " format "\n", __FILE__, __func__, __LINE__, __VA_ARGS__);
#endif
#ifndef _MSC_VER
// use similar struct packing as MSVC for our structs
#pragma pack(1)
#endif
void rct2_finish();

View File

@ -18,6 +18,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*****************************************************************************/
#include <windows.h>
#include "addresses.h"
#include "ride.h"
#include "sprite.h"

View File

@ -19,6 +19,7 @@
*****************************************************************************/
#include <windows.h>
#include <string.h>
#include "addresses.h"
#include "rct2.h"
#include "sawyercoding.h"
@ -80,9 +81,15 @@ int sawyercoding_read_chunk(HANDLE hFile, uint8 *buffer)
// Read chunk header
ReadFile(hFile, &chunkHeader, sizeof(sawyercoding_chunk_header), &numBytesRead, NULL);
if (sizeof(sawyercoding_chunk_header) != numBytesRead) {
RCT2_ERROR("read error %d != %d\n", sizeof(sawyercoding_chunk_header), numBytesRead);
}
// Read chunk data
ReadFile(hFile, buffer, chunkHeader.length, &numBytesRead, NULL);
if (chunkHeader.length != numBytesRead) {
RCT2_ERROR("read error %d != %d\n", chunkHeader.length, numBytesRead);
}
// Decode chunk data
switch (chunkHeader.encoding) {
@ -110,7 +117,7 @@ int sawyercoding_read_chunk(HANDLE hFile, uint8 *buffer)
static int decode_chunk_rle(char *buffer, int length)
{
int i, j, count;
uint8 *src, *dst, rleCodeByte;
unsigned char *src, *dst, rleCodeByte;
// Backup buffer
src = malloc(length);
@ -134,7 +141,7 @@ static int decode_chunk_rle(char *buffer, int length)
free(src);
// Return final size
return dst - buffer;
return (char*)dst - buffer;
}
/**
@ -144,7 +151,7 @@ static int decode_chunk_rle(char *buffer, int length)
static int decode_chunk_repeat(char *buffer, int length)
{
int i, j, count;
uint8 *src, *dst, *copyOffset;
unsigned char *src, *dst, *copyOffset;
// Backup buffer
src = malloc(length);
@ -166,7 +173,7 @@ static int decode_chunk_repeat(char *buffer, int length)
free(src);
// Return final size
return dst - buffer;
return (char*)dst - buffer;
}
/**

View File

@ -19,6 +19,7 @@
*****************************************************************************/
#include <windows.h>
#include <string.h>
#include "addresses.h"
#include "date.h"
#include "finance.h"
@ -31,7 +32,7 @@
#include "ride.h"
#include "sawyercoding.h"
#include "scenario.h"
#include "strings.h"
#include "string_ids.h"
#include "sprite.h"
#include "viewport.h"
@ -281,6 +282,7 @@ static int scenario_load_basic(char *path)
CloseHandle(hFile);
RCT2_GLOBAL(0x009AA00C, uint8) = 0;
if (s6Info->flags != 255) {
#ifdef _MSC_VER
__asm {
push ebp
mov ebp, 0141F6F8h
@ -290,14 +292,34 @@ static int scenario_load_basic(char *path)
mov _eax, eax
jb loc_67628F
}
#else
__asm__ ( "\
push ebp \n\
mov ebp, 0x0141F6F8 \n\
mov eax, 0x006A9428 \n\
call eax \n\
pop ebp \n\
mov %[_eax], eax \n\
jb loc_67628F \n\
" : [_eax] "+m" (_eax) : : "eax" );
#endif
int ebp = RCT2_GLOBAL(0x009ADAF8, uint32);
format_string(s6Info->name, RCT2_GLOBAL(ebp, sint16), NULL);
format_string(s6Info->details, RCT2_GLOBAL(ebp + 4, sint16), NULL);
RCT2_GLOBAL(0x009AA00C, uint8) = RCT2_GLOBAL(ebp + 6, uint8);
RCT2_CALLPROC(0x006A982D);
#ifdef _MSC_VER
__asm mov _eax, eax
#else
__asm__ ( "mov %[_eax], eax " : [_eax] "+m" (_eax) );
#endif
#ifdef _MSC_VER
loc_67628F :
#else
__asm__ ( "loc_67628F :");
#endif
return _eax;
}
return 1;
@ -878,8 +900,14 @@ void scenario_update()
for (int i = 0; i < 100; ++i) {
int carry;
RCT2_CALLPROC_EBPSAFE(0x006744A9); // clears carry flag on failure -.-
#ifdef _MSC_VER
__asm mov carry, 0;
__asm adc carry, 0;
#else
__asm__ ( "mov %[carry], 0; " : [carry] "+m" (carry) );
__asm__ ( "adc %[carry], 0; " : [carry] "+m" (carry) );
#endif
if (!carry)
break;
}

View File

@ -26,7 +26,7 @@
#include "gfx.h"
#include "rct2.h"
#include "screenshot.h"
#include "strings.h"
#include "string_ids.h"
#include "window_error.h"

View File

@ -21,7 +21,7 @@
#include <stdio.h>
#include "addresses.h"
#include "rct2.h"
#include "strings.h"
#include "string_ids.h"
/**
* Writes a formatted string to a buffer.

View File

@ -18,8 +18,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*****************************************************************************/
#ifndef _STRINGS_H_
#define _STRINGS_H_
#ifndef _STRING_IDS_H_
#define _STRING_IDS_H_
typedef unsigned short rct_string_id;

View File

@ -18,6 +18,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*****************************************************************************/
#include <windows.h>
#include <string.h>
#include <time.h>
#include "addresses.h"
@ -32,7 +33,7 @@
#include "rct2.h"
#include "ride.h"
#include "scenario.h"
#include "strings.h"
#include "string_ids.h"
#include "viewport.h"
#include "editor.h"

View File

@ -18,6 +18,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*****************************************************************************/
#include <string.h>
#include "addresses.h"
#include "tutorial.h"
#include "window_error.h"

View File

@ -21,7 +21,7 @@
#include "addresses.h"
#include "config.h"
#include "gfx.h"
#include "strings.h"
#include "string_ids.h"
#include "viewport.h"
#include "window.h"

View File

@ -18,6 +18,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*****************************************************************************/
#include <windows.h>
#include <memory.h>
#include <stdlib.h>
#include "addresses.h"

View File

@ -18,6 +18,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*****************************************************************************/
#include <string.h>
#include "addresses.h"
#include "audio.h"
#include "gfx.h"
@ -101,6 +102,7 @@ rct_widget *window_get_scroll_widget(rct_window *w, int scrollIndex)
}
static void RCT2_CALLPROC_WE_UPDATE(int address, rct_window* w)
{
#ifdef _MSC_VER
__asm {
push address
push w
@ -108,6 +110,16 @@ static void RCT2_CALLPROC_WE_UPDATE(int address, rct_window* w)
call[esp + 4]
add esp, 8
}
#else
__asm__ ( "\
push %[address]\n\
mov eax, %[w] \n\
push eax \n\
mov esi, %[w] \n\
call [esp+4] \n\
add esp, 8 \n\
" : [address] "+m" (address), [w] "+m" (w) : : "eax", "esi" );
#endif
}
/**
*

View File

@ -18,14 +18,15 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*****************************************************************************/
#include <windows.h>
#include <string.h>
#include "addresses.h"
#include "strings.h"
#include "string_ids.h"
#include "sprites.h"
#include "widget.h"
#include "window.h"
static enum WINDOW_ABOUT_WIDGET_IDX {
enum WINDOW_ABOUT_WIDGET_IDX {
WIDX_BACKGROUND,
WIDX_TITLE,
WIDX_CLOSE,
@ -33,7 +34,7 @@ static enum WINDOW_ABOUT_WIDGET_IDX {
WIDX_PUBLISHER_CREDITS
};
static rct_widget window_about_widgets[] = {
rct_widget window_about_widgets[] = {
{ WWT_FRAME, 0, 0, 399, 0, 329, 0x0FFFFFFFF, STR_NONE }, // panel / background
{ WWT_CAPTION, 0, 1, 398, 1, 14, STR_ROLLERCOASTER_TYCOON_2, STR_WINDOW_TITLE_TIP }, // title bar
{ WWT_CLOSEBOX, 0, 387, 397, 2, 13, STR_CLOSE_X, STR_CLOSE_WINDOW_TIP }, // close x button
@ -117,8 +118,13 @@ static void window_about_mouseup()
short widgetIndex;
rct_window *w;
#ifdef _MSC_VER
__asm mov widgetIndex, dx
__asm mov w, esi
#else
__asm__ ( "mov %[widgetIndex], dx " : [widgetIndex] "+m" (widgetIndex) );
__asm__ ( "mov %[w], esi " : [w] "+m" (w) );
#endif
switch (widgetIndex) {
case WIDX_CLOSE:
@ -143,8 +149,13 @@ static void window_about_paint()
rct_window *w;
rct_drawpixelinfo *dpi;
#ifdef _MSC_VER
__asm mov w, esi
__asm mov dpi, edi
#else
__asm__ ( "mov %[w], esi " : [w] "+m" (w) );
__asm__ ( "mov %[dpi], edi " : [dpi] "+m" (dpi) );
#endif
window_draw_widgets(w, dpi);

View File

@ -21,12 +21,12 @@
#include <string.h>
#include "addresses.h"
#include "config.h"
#include "strings.h"
#include "string_ids.h"
#include "viewport.h"
#include "widget.h"
#include "window.h"
static enum WINDOW_BANNER_WIDGET_IDX {
enum WINDOW_BANNER_WIDGET_IDX {
WIDX_BACKGROUND,
WIDX_TITLE,
WIDX_CLOSE,
@ -39,7 +39,7 @@ static enum WINDOW_BANNER_WIDGET_IDX {
WIDX_TEXT_COLOR_DROPDOWN_BUTTON
};
static rct_widget window_banner_widgets[] = {
rct_widget window_banner_widgets[] = {
{ WWT_FRAME, 0, 0, 112, 0, 95, 0x0FFFFFFFF, 65535}, // panel / background
{ WWT_CAPTION, 0, 1, 111, 1, 14, 0xBA9, STR_WINDOW_TITLE_TIP}, // title bar
{ WWT_CLOSEBOX, 0, 100, 110, 2, 13, 0x338, STR_CLOSE_WINDOW_TIP}, // close x button
@ -153,8 +153,18 @@ static void window_banner_mouseup()
short widgetIndex;
rct_window *w;
#ifdef _MSC_VER
__asm mov widgetIndex, dx
#else
__asm__ ( "mov %[widgetIndex], dx " : [widgetIndex] "+m" (widgetIndex) );
#endif
#ifdef _MSC_VER
__asm mov w, esi
#else
__asm__ ( "mov %[w], esi " : [w] "+m" (w) );
#endif
switch (widgetIndex) {
case WIDX_CLOSE:
@ -176,7 +186,12 @@ static void window_banner_mousedown()
{
short widgetIndex;
#ifdef _MSC_VER
__asm mov widgetIndex, dx
#else
__asm__ ( "mov %[widgetIndex], dx " : [widgetIndex] "+m" (widgetIndex) );
#endif
switch (widgetIndex) {
case WIDX_MAIN_COLOR:
@ -192,7 +207,12 @@ static void window_banner_dropdown()
{
short widgetIndex;
#ifdef _MSC_VER
__asm mov widgetIndex, dx;
#else
__asm__ ( "mov %[widgetIndex], dx; " : [widgetIndex] "+m" (widgetIndex) );
#endif
if (widgetIndex == WIDX_MAIN_COLOR)
RCT2_CALLPROC_EBPSAFE(0x006BA548);
@ -204,7 +224,12 @@ static void window_banner_textinput()
{
short widgetIndex;
#ifdef _MSC_VER
__asm mov widgetIndex, dx;
#else
__asm__ ( "mov %[widgetIndex], dx; " : [widgetIndex] "+m" (widgetIndex) );
#endif
if (widgetIndex == WIDX_BANNER_TEXT) {
RCT2_CALLPROC_EBPSAFE(0x006BA6D8);
@ -221,8 +246,18 @@ static void window_banner_paint()
rct_window *w;
rct_drawpixelinfo *dpi;
#ifdef _MSC_VER
__asm mov w, esi
#else
__asm__ ( "mov %[w], esi " : [w] "+m" (w) );
#endif
#ifdef _MSC_VER
__asm mov dpi, edi
#else
__asm__ ( "mov %[dpi], edi " : [dpi] "+m" (dpi) );
#endif
window_draw_widgets(w, dpi);

View File

@ -18,11 +18,13 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*****************************************************************************/
#include <windows.h>
#include <string.h>
#include <limits.h>
#include "addresses.h"
#include "park.h"
#include "peep.h"
#include "strings.h"
#include "string_ids.h"
#include "sprite.h"
#include "sprites.h"
#include "widget.h"
@ -38,7 +40,7 @@ enum {
WINDOW_CHEATS_PAGE_GUESTS
};
static enum WINDOW_CHEATS_WIDGET_IDX {
enum WINDOW_CHEATS_WIDGET_IDX {
WIDX_BACKGROUND,
WIDX_TITLE,
WIDX_CLOSE,
@ -183,8 +185,18 @@ static void window_cheats_money_mouseup()
short widgetIndex;
rct_window *w;
#ifdef _MSC_VER
__asm mov widgetIndex, dx
#else
__asm__ ( "mov %[widgetIndex], dx " : [widgetIndex] "+m" (widgetIndex) );
#endif
#ifdef _MSC_VER
__asm mov w, esi
#else
__asm__ ( "mov %[w], esi " : [w] "+m" (w) );
#endif
switch (widgetIndex) {
case WIDX_CLOSE:
@ -214,8 +226,18 @@ static void window_cheats_guests_mouseup()
short widgetIndex;
rct_window *w;
#ifdef _MSC_VER
__asm mov widgetIndex, dx
#else
__asm__ ( "mov %[widgetIndex], dx " : [widgetIndex] "+m" (widgetIndex) );
#endif
#ifdef _MSC_VER
__asm mov w, esi
#else
__asm__ ( "mov %[w], esi " : [w] "+m" (w) );
#endif
rct_peep* peep;
uint16 sprite_idx;
@ -245,7 +267,11 @@ static void window_cheats_update(rct_window *w)
{
rct_window *w2;
#ifdef _MSC_VER
__asm mov w2, esi
#else
__asm__ ( "mov %[w2], esi " : [w2] "+m" (w2) );
#endif
w->var_48E++;
widget_invalidate(w->classification, w->number, WIDX_TAB_1+w->page);
@ -256,7 +282,12 @@ static void window_cheats_invalidate()
int i;
rct_window *w;
#ifdef _MSC_VER
__asm mov w, esi
#else
__asm__ ( "mov %[w], esi " : [w] "+m" (w) );
#endif
strcpy((char*)0x009BC677, "Cheats");
rct_widget *widgets = window_cheats_page_widgets[w->page];
@ -276,8 +307,18 @@ static void window_cheats_paint()
rct_window *w;
rct_drawpixelinfo *dpi;
#ifdef _MSC_VER
__asm mov w, esi
#else
__asm__ ( "mov %[w], esi " : [w] "+m" (w) );
#endif
#ifdef _MSC_VER
__asm mov dpi, edi
#else
__asm__ ( "mov %[dpi], edi " : [dpi] "+m" (dpi) );
#endif
window_draw_widgets(w, dpi);
window_cheats_draw_tab_images(dpi, w);

View File

@ -20,12 +20,12 @@
#include "addresses.h"
#include "map.h"
#include "strings.h"
#include "string_ids.h"
#include "sprites.h"
#include "widget.h"
#include "window.h"
static enum WINDOW_CLEAR_SCENERY_WIDGET_IDX {
enum WINDOW_CLEAR_SCENERY_WIDGET_IDX {
WIDX_BACKGROUND,
WIDX_TITLE,
WIDX_CLOSE,
@ -34,7 +34,7 @@ static enum WINDOW_CLEAR_SCENERY_WIDGET_IDX {
WIDX_INCREMENT
};
static rct_widget window_clear_scenery_widgets[] = {
rct_widget window_clear_scenery_widgets[] = {
{ WWT_FRAME, 0, 0, 97, 0, 66, -1, STR_NONE }, // panel / background
{ WWT_CAPTION, 0, 1, 96, 1, 14, STR_CLEAR_SCENERY, STR_WINDOW_TITLE_TIP }, // title bar
{ WWT_CLOSEBOX, 0, 85, 95, 2, 13, STR_CLOSE_X, STR_CLOSE_WINDOW_TIP }, // close x button
@ -129,8 +129,18 @@ static void window_clear_scenery_mouseup()
int limit;
short widgetIndex;
#ifdef _MSC_VER
__asm mov widgetIndex, dx
#else
__asm__ ( "mov %[widgetIndex], dx " : [widgetIndex] "+m" (widgetIndex) );
#endif
#ifdef _MSC_VER
__asm mov w, esi
#else
__asm__ ( "mov %[w], esi " : [w] "+m" (w) );
#endif
switch (widgetIndex) {
case WIDX_CLOSE:
@ -183,7 +193,12 @@ static void window_clear_scenery_invalidate()
{
rct_window *w;
#ifdef _MSC_VER
__asm mov w, esi
#else
__asm__ ( "mov %[w], esi " : [w] "+m" (w) );
#endif
// Set the preview image button to be pressed down
w->pressed_widgets |= (1 << WIDX_PREVIEW);
@ -202,8 +217,18 @@ static void window_clear_scenery_paint()
rct_drawpixelinfo *dpi;
int x, y;
#ifdef _MSC_VER
__asm mov w, esi
#else
__asm__ ( "mov %[w], esi " : [w] "+m" (w) );
#endif
#ifdef _MSC_VER
__asm mov dpi, edi
#else
__asm__ ( "mov %[dpi], edi " : [dpi] "+m" (dpi) );
#endif
window_draw_widgets(w, dpi);

View File

@ -18,10 +18,11 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*****************************************************************************/
#include <windows.h>
#include <memory.h>
#include "addresses.h"
#include "scenario.h"
#include "strings.h"
#include "string_ids.h"
#include "sprites.h"
#include "widget.h"
#include "window.h"
@ -269,8 +270,18 @@ static void window_dropdown_paint()
rct_window *w;
rct_drawpixelinfo *dpi;
#ifdef _MSC_VER
__asm mov w, esi
#else
__asm__ ( "mov %[w], esi " : [w] "+m" (w) );
#endif
#ifdef _MSC_VER
__asm mov dpi, edi
#else
__asm__ ( "mov %[dpi], edi " : [dpi] "+m" (dpi) );
#endif
window_draw_widgets(w, dpi);

View File

@ -23,7 +23,7 @@
#include "audio.h"
#include "game.h"
#include "map.h"
#include "strings.h"
#include "string_ids.h"
#include "sprites.h"
#include "viewport.h"
#include "widget.h"
@ -49,7 +49,7 @@ typedef struct {
uint8 flags; // 0x0B
} rct_path_type;
static enum WINDOW_FOOTPATH_WIDGET_IDX {
enum WINDOW_FOOTPATH_WIDGET_IDX {
WIDX_BACKGROUND,
WIDX_TITLE,
WIDX_CLOSE,
@ -223,7 +223,12 @@ static void window_footpath_close()
{
rct_window *w;
#ifdef _MSC_VER
__asm mov w, esi
#else
__asm__ ( "mov %[w], esi " : [w] "+m" (w) );
#endif
RCT2_CALLPROC_EBPSAFE(0x006A7831);
RCT2_CALLPROC_X(0x006CB70A, 0, 0, 0, 0, 0, 0, 0);
@ -242,8 +247,18 @@ static void window_footpath_mouseup()
short widgetIndex;
rct_window *w;
#ifdef _MSC_VER
__asm mov widgetIndex, dx
#else
__asm__ ( "mov %[widgetIndex], dx " : [widgetIndex] "+m" (widgetIndex) );
#endif
#ifdef _MSC_VER
__asm mov w, esi
#else
__asm__ ( "mov %[w], esi " : [w] "+m" (w) );
#endif
switch (widgetIndex) {
case WIDX_CLOSE:
@ -298,9 +313,24 @@ static void window_footpath_mousedown()
rct_window *w;
rct_widget *widget;
#ifdef _MSC_VER
__asm mov widgetIndex, dx
#else
__asm__ ( "mov %[widgetIndex], dx " : [widgetIndex] "+m" (widgetIndex) );
#endif
#ifdef _MSC_VER
__asm mov w, esi
#else
__asm__ ( "mov %[w], esi " : [w] "+m" (w) );
#endif
#ifdef _MSC_VER
__asm mov widget, edi
#else
__asm__ ( "mov %[widget], edi " : [widget] "+m" (widget) );
#endif
switch (widgetIndex) {
case WIDX_FOOTPATH_TYPE:
@ -345,9 +375,24 @@ static void window_footpath_dropdown()
rct_window *w;
rct_path_type *pathType;
#ifdef _MSC_VER
__asm mov dropdownIndex, ax
#else
__asm__ ( "mov %[dropdownIndex], ax " : [dropdownIndex] "+m" (dropdownIndex) );
#endif
#ifdef _MSC_VER
__asm mov widgetIndex, dx
#else
__asm__ ( "mov %[widgetIndex], dx " : [widgetIndex] "+m" (widgetIndex) );
#endif
#ifdef _MSC_VER
__asm mov w, esi
#else
__asm__ ( "mov %[w], esi " : [w] "+m" (w) );
#endif
if (widgetIndex == WIDX_FOOTPATH_TYPE)
RCT2_GLOBAL(RCT2_ADDRESS_SELECTED_PATH_TYPE, uint8) = SELECTED_PATH_TYPE_NORMAL;
@ -397,10 +442,30 @@ static void window_footpath_toolupdate()
short widgetIndex;
rct_window *w;
#ifdef _MSC_VER
__asm mov x, eax
#else
__asm__ ( "mov %[x], eax " : [x] "+m" (x) );
#endif
#ifdef _MSC_VER
__asm mov y, ebx
#else
__asm__ ( "mov %[y], ebx " : [y] "+m" (y) );
#endif
#ifdef _MSC_VER
__asm mov widgetIndex, dx
#else
__asm__ ( "mov %[widgetIndex], dx " : [widgetIndex] "+m" (widgetIndex) );
#endif
#ifdef _MSC_VER
__asm mov w, esi
#else
__asm__ ( "mov %[w], esi " : [w] "+m" (w) );
#endif
if (widgetIndex == WIDX_CONSTRUCT_ON_LAND) {
window_footpath_set_provisional_path_at_point(x, y);
@ -419,10 +484,30 @@ static void window_footpath_tooldown()
short widgetIndex;
rct_window *w;
#ifdef _MSC_VER
__asm mov x, eax
#else
__asm__ ( "mov %[x], eax " : [x] "+m" (x) );
#endif
#ifdef _MSC_VER
__asm mov y, ebx
#else
__asm__ ( "mov %[y], ebx " : [y] "+m" (y) );
#endif
#ifdef _MSC_VER
__asm mov widgetIndex, dx
#else
__asm__ ( "mov %[widgetIndex], dx " : [widgetIndex] "+m" (widgetIndex) );
#endif
#ifdef _MSC_VER
__asm mov w, esi
#else
__asm__ ( "mov %[w], esi " : [w] "+m" (w) );
#endif
if (widgetIndex == WIDX_CONSTRUCT_ON_LAND) {
window_footpath_place_path_at_point(x, y);
@ -441,10 +526,30 @@ static void window_footpath_tooldrag()
short widgetIndex;
rct_window *w;
#ifdef _MSC_VER
__asm mov x, eax
#else
__asm__ ( "mov %[x], eax " : [x] "+m" (x) );
#endif
#ifdef _MSC_VER
__asm mov y, ebx
#else
__asm__ ( "mov %[y], ebx " : [y] "+m" (y) );
#endif
#ifdef _MSC_VER
__asm mov widgetIndex, dx
#else
__asm__ ( "mov %[widgetIndex], dx " : [widgetIndex] "+m" (widgetIndex) );
#endif
#ifdef _MSC_VER
__asm mov w, esi
#else
__asm__ ( "mov %[w], esi " : [w] "+m" (w) );
#endif
if (widgetIndex == WIDX_CONSTRUCT_ON_LAND) {
RCT2_CALLPROC_X(0x006A82C5, x, y, 0, 0, (int)w, 0, 0);
@ -461,10 +566,30 @@ static void window_footpath_toolup()
short widgetIndex;
rct_window *w;
#ifdef _MSC_VER
__asm mov x, eax
#else
__asm__ ( "mov %[x], eax " : [x] "+m" (x) );
#endif
#ifdef _MSC_VER
__asm mov y, ebx
#else
__asm__ ( "mov %[y], ebx " : [y] "+m" (y) );
#endif
#ifdef _MSC_VER
__asm mov widgetIndex, dx
#else
__asm__ ( "mov %[widgetIndex], dx " : [widgetIndex] "+m" (widgetIndex) );
#endif
#ifdef _MSC_VER
__asm mov w, esi
#else
__asm__ ( "mov %[w], esi " : [w] "+m" (w) );
#endif
if (widgetIndex == WIDX_CONSTRUCT_ON_LAND) {
RCT2_CALLPROC_X(0x006A8380, x, y, 0, 0, (int)w, 0, 0);
@ -510,7 +635,12 @@ static void window_footpath_invalidate()
rct_path_type *pathType;
rct_window *w;
#ifdef _MSC_VER
__asm mov w, esi
#else
__asm__ ( "mov %[w], esi " : [w] "+m" (w) );
#endif
// Press / unpress footpath and queue type buttons
w->pressed_widgets &= ~(1 << WIDX_FOOTPATH_TYPE);
@ -547,8 +677,18 @@ static void window_footpath_paint()
rct_window *w;
rct_drawpixelinfo *dpi;
#ifdef _MSC_VER
__asm mov w, esi
#else
__asm__ ( "mov %[w], esi " : [w] "+m" (w) );
#endif
#ifdef _MSC_VER
__asm mov dpi, edi
#else
__asm__ ( "mov %[dpi], edi " : [dpi] "+m" (dpi) );
#endif
window_draw_widgets(w, dpi);

View File

@ -18,6 +18,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*****************************************************************************/
#include <windows.h>
#include <string.h>
#include "addresses.h"
#include "climate.h"
#include "date.h"
@ -26,11 +28,11 @@
#include "peep.h"
#include "sprite.h"
#include "sprites.h"
#include "strings.h"
#include "string_ids.h"
#include "widget.h"
#include "window.h"
static enum WINDOW_GAME_BOTTOM_TOOLBAR_WIDGET_IDX {
enum WINDOW_GAME_BOTTOM_TOOLBAR_WIDGET_IDX {
WIDX_LEFT_OUTSET,
WIDX_LEFT_INSET,
WIDX_MONEY,
@ -153,8 +155,18 @@ static void window_game_bottom_toolbar_mouseup()
rct_window *w, *mainWindow;
rct_news_item *newsItem;
#ifdef _MSC_VER
__asm mov widgetIndex, dx
#else
__asm__ ( "mov %[widgetIndex], dx " : [widgetIndex] "+m" (widgetIndex) );
#endif
#ifdef _MSC_VER
__asm mov w, esi
#else
__asm__ ( "mov %[w], esi " : [w] "+m" (w) );
#endif
switch (widgetIndex) {
case WIDX_LEFT_OUTSET:
@ -206,8 +218,18 @@ static void window_game_bottom_toolbar_tooltip()
short widgetIndex;
rct_window *w;
#ifdef _MSC_VER
__asm mov widgetIndex, dx
#else
__asm__ ( "mov %[widgetIndex], dx " : [widgetIndex] "+m" (widgetIndex) );
#endif
#ifdef _MSC_VER
__asm mov w, esi
#else
__asm__ ( "mov %[w], esi " : [w] "+m" (w) );
#endif
switch (widgetIndex) {
case WIDX_MONEY:
@ -229,7 +251,12 @@ static void window_game_bottom_toolbar_tooltip()
break;
}
#ifdef _MSC_VER
__asm mov dx, widgetIndex
#else
__asm__ ( "mov dx, %[widgetIndex] " : [widgetIndex] "+m" (widgetIndex) );
#endif
}
/**
@ -242,7 +269,12 @@ static void window_game_bottom_toolbar_invalidate()
rct_window *w;
rct_news_item *newsItem;
#ifdef _MSC_VER
__asm mov w, esi
#else
__asm__ ( "mov %[w], esi " : [w] "+m" (w) );
#endif
// Anchor the middle and right panel to the right
x = RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_WIDTH, sint16);
@ -334,8 +366,18 @@ static void window_game_bottom_toolbar_paint()
rct_window *w;
rct_drawpixelinfo *dpi;
#ifdef _MSC_VER
__asm mov w, esi
#else
__asm__ ( "mov %[w], esi " : [w] "+m" (w) );
#endif
#ifdef _MSC_VER
__asm mov dpi, edi
#else
__asm__ ( "mov %[dpi], edi " : [dpi] "+m" (dpi) );
#endif
// Draw panel grey backgrounds
gfx_fill_rect(
@ -542,7 +584,8 @@ static void window_game_bottom_toolbar_draw_news_item(rct_drawpixelinfo *dpi, rc
_edi = (int)e->paint.dpi;
_cx = x;
_dx = y;
__asm {
#ifdef _MSC_VER
__asm {
mov cx, _cx
mov dx, _dx
mov esi, w
@ -555,6 +598,22 @@ static void window_game_bottom_toolbar_draw_news_item(rct_drawpixelinfo *dpi, rc
after:
pop ebp
}
#else
__asm__ ( "\
\n\
mov cx, %[_cx] \n\
mov dx, %[_dx] \n\
mov esi, %[w] \n\
mov edi, %[_edi] \n\
push ebp \n\
mov ebp, 0x0066C3B8 \n\
push %[after] \n\
push esi \n\
jmp ebp \n\
%[after]: \n\
pop ebp \n\
" : [_cx] "+m" (_cx), [_dx] "+m" (_dx), [w] "+m" (w), [_edi] "+m" (_edi), [after] "+m" (after) );
#endif
break;
*/

View File

@ -18,10 +18,11 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*****************************************************************************/
#include <string.h>
#include "addresses.h"
#include "game.h"
#include "sprites.h"
#include "strings.h"
#include "string_ids.h"
#include "widget.h"
#include "window.h"
#include "window_dropdown.h"
@ -147,8 +148,18 @@ static void window_game_top_toolbar_mouseup()
short widgetIndex;
rct_window *w, *mainWindow;
#ifdef _MSC_VER
__asm mov widgetIndex, dx
#else
__asm__ ( "mov %[widgetIndex], dx " : [widgetIndex] "+m" (widgetIndex) );
#endif
#ifdef _MSC_VER
__asm mov w, esi
#else
__asm__ ( "mov %[w], esi " : [w] "+m" (w) );
#endif
switch (widgetIndex) {
case WIDX_PAUSE:
@ -250,9 +261,24 @@ static void window_game_top_toolbar_mousedown()
rct_widget *widget;
rct_viewport *mainViewport;
#ifdef _MSC_VER
__asm mov widgetIndex, dx
#else
__asm__ ( "mov %[widgetIndex], dx " : [widgetIndex] "+m" (widgetIndex) );
#endif
#ifdef _MSC_VER
__asm mov w, esi
#else
__asm__ ( "mov %[w], esi " : [w] "+m" (w) );
#endif
#ifdef _MSC_VER
__asm mov widget, edi
#else
__asm__ ( "mov %[widget], edi " : [widget] "+m" (widget) );
#endif
if (widgetIndex == WIDX_FILE_MENU) {
gDropdownItemsFormat[0] = 882;
@ -338,8 +364,18 @@ static void window_game_top_toolbar_dropdown()
{
short widgetIndex, dropdownIndex;
#ifdef _MSC_VER
__asm mov widgetIndex, dx
#else
__asm__ ( "mov %[widgetIndex], dx " : [widgetIndex] "+m" (widgetIndex) );
#endif
#ifdef _MSC_VER
__asm mov dropdownIndex, ax
#else
__asm__ ( "mov %[dropdownIndex], ax " : [dropdownIndex] "+m" (dropdownIndex) );
#endif
if (widgetIndex == WIDX_FILE_MENU) {
switch (dropdownIndex) {
@ -361,7 +397,7 @@ static void window_game_top_toolbar_dropdown()
src++;
} while (*src != '.' && *src != '\0');
strcpy(src, ".SV6");
strcpy(RCT2_ADDRESS_SAVED_GAMES_PATH_2, 0x0141EF68);
strcpy((char*) RCT2_ADDRESS_SAVED_GAMES_PATH_2, (char*) 0x0141EF68);
eax = 0;
if (RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_FLAGS, uint8) & 8)
@ -401,7 +437,12 @@ static void window_game_top_toolbar_invalidate()
int x;
rct_window *w;
#ifdef _MSC_VER
__asm mov w, esi
#else
__asm__ ( "mov %[w], esi " : [w] "+m" (w) );
#endif
// Anchor the right half of the buttons to the right
x = RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_WIDTH, sint16);
@ -471,8 +512,18 @@ static void window_game_top_toolbar_paint()
rct_window *w;
rct_drawpixelinfo *dpi;
#ifdef _MSC_VER
__asm mov w, esi
#else
__asm__ ( "mov %[w], esi " : [w] "+m" (w) );
#endif
#ifdef _MSC_VER
__asm mov dpi, edi
#else
__asm__ ( "mov %[dpi], edi " : [dpi] "+m" (dpi) );
#endif
window_draw_widgets(w, dpi);

View File

@ -22,7 +22,7 @@
#include "addresses.h"
#include "game.h"
#include "peep.h"
#include "strings.h"
#include "string_ids.h"
#include "sprite.h"
#include "sprites.h"
#include "widget.h"
@ -187,8 +187,18 @@ static void window_guest_list_mouseup()
short widgetIndex;
rct_window *w;
#ifdef _MSC_VER
__asm mov widgetIndex, dx
#else
__asm__ ( "mov %[widgetIndex], dx " : [widgetIndex] "+m" (widgetIndex) );
#endif
#ifdef _MSC_VER
__asm mov w, esi
#else
__asm__ ( "mov %[w], esi " : [w] "+m" (w) );
#endif
switch (widgetIndex) {
case WIDX_CLOSE:
@ -208,7 +218,12 @@ static void window_guest_list_resize()
{
rct_window *w;
#ifdef _MSC_VER
__asm mov w, esi
#else
__asm__ ( "mov %[w], esi " : [w] "+m" (w) );
#endif
w->min_width = 350;
w->min_height = 330;
@ -233,9 +248,24 @@ static void window_guest_list_mousedown()
rct_window *w;
rct_widget *widget;
#ifdef _MSC_VER
__asm mov widgetIndex, dx
#else
__asm__ ( "mov %[widgetIndex], dx " : [widgetIndex] "+m" (widgetIndex) );
#endif
#ifdef _MSC_VER
__asm mov w, esi
#else
__asm__ ( "mov %[w], esi " : [w] "+m" (w) );
#endif
#ifdef _MSC_VER
__asm mov widget, edi
#else
__asm__ ( "mov %[widget], edi " : [widget] "+m" (widget) );
#endif
switch (widgetIndex) {
case WIDX_TAB_1:
@ -303,9 +333,24 @@ static void window_guest_list_dropdown()
short dropdownIndex, widgetIndex;
rct_window *w;
#ifdef _MSC_VER
__asm mov dropdownIndex, ax
#else
__asm__ ( "mov %[dropdownIndex], ax " : [dropdownIndex] "+m" (dropdownIndex) );
#endif
#ifdef _MSC_VER
__asm mov widgetIndex, dx
#else
__asm__ ( "mov %[widgetIndex], dx " : [widgetIndex] "+m" (widgetIndex) );
#endif
#ifdef _MSC_VER
__asm mov w, esi
#else
__asm__ ( "mov %[w], esi " : [w] "+m" (w) );
#endif
switch (widgetIndex) {
case WIDX_PAGE_DROPDOWN_BUTTON:
@ -347,7 +392,12 @@ static void window_guest_list_scrollgetsize()
rct_window *w;
rct_peep *peep;
#ifdef _MSC_VER
__asm mov w, esi
#else
__asm__ ( "mov %[w], esi " : [w] "+m" (w) );
#endif
switch (_window_guest_list_selected_tab) {
case PAGE_INDIVIDUAL:
@ -400,8 +450,18 @@ static void window_guest_list_scrollgetsize()
window_invalidate(w);
}
#ifdef _MSC_VER
__asm mov ecx, 447
#else
__asm__ ( "mov ecx, 447 " );
#endif
#ifdef _MSC_VER
__asm mov edx, y
#else
__asm__ ( "mov edx, %[y] " : [y] "+m" (y) );
#endif
}
/**
@ -415,8 +475,18 @@ static void window_guest_list_scrollmousedown()
rct_window *w;
rct_peep *peep;
#ifdef _MSC_VER
__asm mov y, dx
#else
__asm__ ( "mov %[y], dx " : [y] "+m" (y) );
#endif
#ifdef _MSC_VER
__asm mov w, esi
#else
__asm__ ( "mov %[w], esi " : [w] "+m" (w) );
#endif
switch (_window_guest_list_selected_tab) {
case PAGE_INDIVIDUAL:
@ -468,8 +538,18 @@ static void window_guest_list_scrollmouseover()
short y;
rct_window *w;
#ifdef _MSC_VER
__asm mov y, dx
#else
__asm__ ( "mov %[y], dx " : [y] "+m" (y) );
#endif
#ifdef _MSC_VER
__asm mov w, esi
#else
__asm__ ( "mov %[w], esi " : [w] "+m" (w) );
#endif
i = y / (_window_guest_list_selected_tab == PAGE_INDIVIDUAL ? 10 : 21);
i += _window_guest_list_selected_page * 3173;
@ -496,7 +576,12 @@ static void window_guest_list_invalidate()
{
rct_window *w;
#ifdef _MSC_VER
__asm mov w, esi
#else
__asm__ ( "mov %[w], esi " : [w] "+m" (w) );
#endif
w->pressed_widgets &= ~(1 << WIDX_TAB_1);
w->pressed_widgets &= ~(1 << WIDX_TAB_2);
@ -530,8 +615,18 @@ static void window_guest_list_paint()
rct_window *w;
rct_drawpixelinfo *dpi;
#ifdef _MSC_VER
__asm mov w, esi
#else
__asm__ ( "mov %[w], esi " : [w] "+m" (w) );
#endif
#ifdef _MSC_VER
__asm mov dpi, edi
#else
__asm__ ( "mov %[dpi], edi " : [dpi] "+m" (dpi) );
#endif
// Widgets
window_draw_widgets(w, dpi);
@ -594,8 +689,18 @@ static void window_guest_list_scrollpaint()
rct_peep *peep;
rct_peep_thought *thought;
#ifdef _MSC_VER
__asm mov w, esi
#else
__asm__ ( "mov %[w], esi " : [w] "+m" (w) );
#endif
#ifdef _MSC_VER
__asm mov dpi, edi
#else
__asm__ ( "mov %[dpi], edi " : [dpi] "+m" (dpi) );
#endif
// Background fill
gfx_fill_rect(dpi, dpi->x, dpi->y, dpi->x + dpi->width - 1, dpi->y + dpi->height - 1, ((char*)0x0141FC48)[w->colours[1] * 8]);

View File

@ -20,13 +20,13 @@
#include "addresses.h"
#include "map.h"
#include "strings.h"
#include "string_ids.h"
#include "sprites.h"
#include "widget.h"
#include "window.h"
#include "window_dropdown.h"
static enum WINDOW_LAND_WIDGET_IDX {
enum WINDOW_LAND_WIDGET_IDX {
WIDX_BACKGROUND,
WIDX_TITLE,
WIDX_CLOSE,
@ -165,8 +165,18 @@ static void window_land_mouseup()
short widgetIndex;
rct_window *w;
#ifdef _MSC_VER
__asm mov widgetIndex, dx
#else
__asm__ ( "mov %[widgetIndex], dx " : [widgetIndex] "+m" (widgetIndex) );
#endif
#ifdef _MSC_VER
__asm mov w, esi
#else
__asm__ ( "mov %[w], esi " : [w] "+m" (w) );
#endif
switch (widgetIndex) {
case WIDX_CLOSE:
@ -214,9 +224,24 @@ static void window_land_mousedown()
rct_window *w;
rct_widget *widget;
#ifdef _MSC_VER
__asm mov widgetIndex, dx
#else
__asm__ ( "mov %[widgetIndex], dx " : [widgetIndex] "+m" (widgetIndex) );
#endif
#ifdef _MSC_VER
__asm mov w, esi
#else
__asm__ ( "mov %[w], esi " : [w] "+m" (w) );
#endif
#ifdef _MSC_VER
__asm mov widget, edi
#else
__asm__ ( "mov %[widget], edi " : [widget] "+m" (widget) );
#endif
switch (widgetIndex) {
case WIDX_FLOOR:
@ -266,9 +291,24 @@ static void window_land_dropdown()
short dropdownIndex, widgetIndex;
rct_window *w;
#ifdef _MSC_VER
__asm mov dropdownIndex, ax
#else
__asm__ ( "mov %[dropdownIndex], ax " : [dropdownIndex] "+m" (dropdownIndex) );
#endif
#ifdef _MSC_VER
__asm mov widgetIndex, dx
#else
__asm__ ( "mov %[widgetIndex], dx " : [widgetIndex] "+m" (widgetIndex) );
#endif
#ifdef _MSC_VER
__asm mov w, esi
#else
__asm__ ( "mov %[w], esi " : [w] "+m" (w) );
#endif
switch (widgetIndex) {
case WIDX_FLOOR:
@ -325,7 +365,12 @@ static void window_land_invalidate()
{
rct_window *w;
#ifdef _MSC_VER
__asm mov w, esi
#else
__asm__ ( "mov %[w], esi " : [w] "+m" (w) );
#endif
w->pressed_widgets = (1 << WIDX_PREVIEW);
if (RCT2_GLOBAL(RCT2_ADDRESS_SELECTED_TERRAIN_SURFACE, uint8) != 255)
@ -350,8 +395,18 @@ static void window_land_paint()
rct_drawpixelinfo *dpi;
int x, y, price, numTiles;
#ifdef _MSC_VER
__asm mov w, esi
#else
__asm__ ( "mov %[w], esi " : [w] "+m" (w) );
#endif
#ifdef _MSC_VER
__asm mov dpi, edi
#else
__asm__ ( "mov %[dpi], edi " : [dpi] "+m" (dpi) );
#endif
window_draw_widgets(w, dpi);

View File

@ -48,6 +48,7 @@ void window_main_open()
window->widgets = main_widgets;
// RCT2_CALLPROC_X(0x006EB009, window->x, window->y, 0x4000000, 0x0FFF0FFF, window, 0, 0);
#ifdef _MSC_VER
__asm {
mov esi, window
mov edx, 0FFF0FFFh
@ -62,6 +63,24 @@ void window_main_open()
pop ebp
or word ptr [edi+12h], 400h
}
#else
__asm__ ( "\
\n\
push ebx \n\
mov esi, %[window] \n\
mov edx, 0x0FFF0FFF \n\
mov eax, [esi+0x2C] \n\
mov ebx, [esi+0x30] \n\
mov ecx, 0x4000000 \n\
push ebp \n\
mov ebp, 0x6EB009 \n\
call ebp \n\
\n\
pop ebp \n\
or word ptr [edi+0x12], 0x400 \n\
pop ebx \n\
" : [window] "+m" (window) : : "esi","edx","eax","ecx" );
#endif
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_ROTATION, sint32) = 0;
RCT2_GLOBAL(0x009E32B0, uint8) = 0;

View File

@ -20,11 +20,11 @@
#include "addresses.h"
#include "sprites.h"
#include "strings.h"
#include "string_ids.h"
#include "widget.h"
#include "window.h"
static enum WINDOW_MAP_WIDGET_IDX {
enum WINDOW_MAP_WIDGET_IDX {
WIDX_BACKGROUND,
WIDX_TITLE,
WIDX_CLOSE,
@ -187,8 +187,18 @@ static void window_map_mouseup()
/*short widgetIndex;
rct_window *w;
#ifdef _MSC_VER
__asm mov widgetIndex, dx
#else
__asm__ ( "mov %[widgetIndex], dx " : [widgetIndex] "+m" (widgetIndex) );
#endif
#ifdef _MSC_VER
__asm mov w, esi
#else
__asm__ ( "mov %[w], esi " : [w] "+m" (w) );
#endif
switch (widgetIndex) {
case WIDX_CLOSE:
@ -243,7 +253,11 @@ static void window_map_invalidate()
uint32 pressed_widgets;
int i, height;
#ifdef _MSC_VER
__asm mov w, esi
#else
__asm__ ( "mov %[w], esi " : [w] "+m" (w) );
#endif
// set the pressed widgets
pressed_widgets = (uint32)w->pressed_widgets;
@ -366,8 +380,18 @@ static void window_map_paint()
int image_id;
int i, x, y;
#ifdef _MSC_VER
__asm mov w, esi
#else
__asm__ ( "mov %[w], esi " : [w] "+m" (w) );
#endif
#ifdef _MSC_VER
__asm mov dpi, edi
#else
__asm__ ( "mov %[dpi], edi " : [dpi] "+m" (dpi) );
#endif
window_draw_widgets(w, dpi);

View File

@ -22,13 +22,13 @@
#include "addresses.h"
#include "audio.h"
#include "news_item.h"
#include "strings.h"
#include "string_ids.h"
#include "sprite.h"
#include "sprites.h"
#include "widget.h"
#include "window.h"
static enum WINDOW_NEWS_WIDGET_IDX {
enum WINDOW_NEWS_WIDGET_IDX {
WIDX_BACKGROUND,
WIDX_TITLE,
WIDX_CLOSE,
@ -129,8 +129,18 @@ static void window_news_mouseup()
short widgetIndex;
rct_window *w;
#ifdef _MSC_VER
__asm mov widgetIndex, dx
#else
__asm__ ( "mov %[widgetIndex], dx " : [widgetIndex] "+m" (widgetIndex) );
#endif
#ifdef _MSC_VER
__asm mov w, esi
#else
__asm__ ( "mov %[w], esi " : [w] "+m" (w) );
#endif
if (widgetIndex == WIDX_CLOSE)
window_close(w);
@ -195,7 +205,12 @@ static void window_news_scrollgetsize()
height += 42;
}
#ifdef _MSC_VER
__asm mov edx, height
#else
__asm__ ( "mov edx, %[height] " : [height] "+m" (height) );
#endif
}
/**
@ -209,9 +224,24 @@ static void window_news_scrollmousedown()
rct_window *w;
rct_news_item *newsItems;
#ifdef _MSC_VER
__asm mov x, cx
#else
__asm__ ( "mov %[x], cx " : [x] "+m" (x) );
#endif
#ifdef _MSC_VER
__asm mov y, dx
#else
__asm__ ( "mov %[y], dx " : [y] "+m" (y) );
#endif
#ifdef _MSC_VER
__asm mov w, esi
#else
__asm__ ( "mov %[w], esi " : [w] "+m" (w) );
#endif
buttonIndex = 0;
newsItems = RCT2_ADDRESS(RCT2_ADDRESS_NEWS_ITEM_LIST, rct_news_item);
@ -274,8 +304,18 @@ static void window_news_paint()
rct_window *w;
rct_drawpixelinfo *dpi;
#ifdef _MSC_VER
__asm mov w, esi
#else
__asm__ ( "mov %[w], esi " : [w] "+m" (w) );
#endif
#ifdef _MSC_VER
__asm mov dpi, edi
#else
__asm__ ( "mov %[dpi], edi " : [dpi] "+m" (dpi) );
#endif
window_draw_widgets(w, dpi);
}
@ -291,8 +331,18 @@ static void window_news_scrollpaint()
rct_drawpixelinfo *dpi;
rct_news_item *newsItems, *newsItem, *newsItem2;
#ifdef _MSC_VER
__asm mov w, esi
#else
__asm__ ( "mov %[w], esi " : [w] "+m" (w) );
#endif
#ifdef _MSC_VER
__asm mov dpi, edi
#else
__asm__ ( "mov %[dpi], edi " : [dpi] "+m" (dpi) );
#endif
y = 0;
newsItems = RCT2_ADDRESS(RCT2_ADDRESS_NEWS_ITEM_LIST, rct_news_item);

View File

@ -22,13 +22,13 @@
#include "audio.h"
#include "config.h"
#include "gfx.h"
#include "strings.h"
#include "string_ids.h"
#include "viewport.h"
#include "widget.h"
#include "window.h"
#include "window_dropdown.h"
static enum WINDOW_OPTIONS_WIDGET_IDX {
enum WINDOW_OPTIONS_WIDGET_IDX {
WIDX_BACKGROUND,
WIDX_TITLE,
WIDX_CLOSE,
@ -107,7 +107,7 @@ static void window_options_mousedown();
static void window_options_dropdown();
static void window_options_update(rct_window *w);
static void window_options_paint();
static void window_options_draw_dropdown_box(w, widget, num_items);
static void window_options_draw_dropdown_box(rct_window *w, rct_widget *widget, int num_items);
static void window_options_update_height_markers();
static void* window_options_events[] = {
@ -199,8 +199,18 @@ static void window_options_mouseup()
short widgetIndex;
rct_window *w;
#ifdef _MSC_VER
__asm mov widgetIndex, dx
#else
__asm__ ( "mov %[widgetIndex], dx " : [widgetIndex] "+m" (widgetIndex) );
#endif
#ifdef _MSC_VER
__asm mov w, esi
#else
__asm__ ( "mov %[w], esi " : [w] "+m" (w) );
#endif
switch (widgetIndex) {
case WIDX_CLOSE:
@ -218,9 +228,19 @@ static void window_options_mouseup()
RCT2_GLOBAL(RCT2_ADDRESS_PARK_FLAGS, uint32) ^= PARK_FLAGS_SHOW_REAL_GUEST_NAMES;
if (RCT2_GLOBAL(RCT2_ADDRESS_PARK_FLAGS, uint32) & PARK_FLAGS_SHOW_REAL_GUEST_NAMES)
__asm xor al, al
#ifdef _MSC_VER
__asm xor al, al
#else
__asm__ ( "xor al, al " );
#endif
else
__asm mov al, 1
#ifdef _MSC_VER
__asm mov al, 1
#else
__asm__ ( "mov al, 1 " );
#endif
RCT2_CALLPROC_EBPSAFE(0x0069C52F);
break;
@ -268,8 +288,18 @@ static void window_options_mousedown()
rct_window *w;
rct_widget *widget;
#ifdef _MSC_VER
__asm mov widgetIndex, dx
#else
__asm__ ( "mov %[widgetIndex], dx " : [widgetIndex] "+m" (widgetIndex) );
#endif
#ifdef _MSC_VER
__asm mov w, esi
#else
__asm__ ( "mov %[w], esi " : [w] "+m" (w) );
#endif
widget = &w->widgets[widgetIndex - 1];
@ -386,16 +416,36 @@ static void window_options_dropdown()
short widgetIndex;
rct_window *w;
#ifdef _MSC_VER
__asm mov dropdownIndex, ax
#else
__asm__ ( "mov %[dropdownIndex], ax " : [dropdownIndex] "+m" (dropdownIndex) );
#endif
#ifdef _MSC_VER
__asm mov widgetIndex, dx
#else
__asm__ ( "mov %[widgetIndex], dx " : [widgetIndex] "+m" (widgetIndex) );
#endif
#ifdef _MSC_VER
__asm mov w, esi
#else
__asm__ ( "mov %[w], esi " : [w] "+m" (w) );
#endif
if (dropdownIndex == -1)
return;
switch (widgetIndex) {
case WIDX_SOUND_DROPDOWN:
__asm movzx ax, dropdownIndex // the switch replaces ax value
#ifdef _MSC_VER
__asm movzx ax, dropdownIndex
#else
__asm__ ( "movzx ax, %[dropdownIndex] " : : [dropdownIndex] "g" ((char)dropdownIndex) );
#endif
// the switch replaces ax value
RCT2_CALLPROC_EBPSAFE(0x006BA9B5); // part of init audio
window_invalidate(w);
break;
@ -434,7 +484,12 @@ static void window_options_dropdown()
window_options_update_height_markers();
break;
case WIDX_RESOLUTION_DROPDOWN:
__asm movzx ax, dropdownIndex // the switch replaces ax value
#ifdef _MSC_VER
__asm movzx ax, dropdownIndex
#else
__asm__ ( "movzx ax, %[dropdownIndex] " : : [dropdownIndex] "g" ((char)dropdownIndex) );
#endif
// the switch replaces ax value
RCT2_CALLPROC_EBPSAFE(0x006BB37D);
break;
case WIDX_TEMPERATURE_DROPDOWN:
@ -461,7 +516,12 @@ static void window_options_dropdown()
static void window_options_update(rct_window *w)
{
//Has use asm verison incase called by WM_INVALIDATE
#ifdef _MSC_VER
__asm mov w, esi
#else
__asm__ ( "mov %[w], esi " : [w] "+m" (w) );
#endif
sint32 format_args = RCT2_GLOBAL(0x009AF280, sint32);
@ -568,8 +628,18 @@ static void window_options_paint()
rct_window *w;
rct_drawpixelinfo *dpi;
#ifdef _MSC_VER
__asm mov w, esi
#else
__asm__ ( "mov %[w], esi " : [w] "+m" (w) );
#endif
#ifdef _MSC_VER
__asm mov dpi, edi
#else
__asm__ ( "mov %[dpi], edi " : [dpi] "+m" (dpi) );
#endif
window_draw_widgets(w, dpi);

View File

@ -18,6 +18,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*****************************************************************************/
#include <string.h>
#include "addresses.h"
#include "config.h"
#include "date.h"
@ -26,7 +27,7 @@
#include "peep.h"
#include "ride.h"
#include "scenario.h"
#include "strings.h"
#include "string_ids.h"
#include "sprite.h"
#include "sprites.h"
#include "util.h"
@ -642,7 +643,12 @@ static void window_park_entrance_close()
{
rct_window *w;
#ifdef _MSC_VER
__asm mov w, esi
#else
__asm__ ( "mov %[w], esi " : [w] "+m" (w) );
#endif
if (RCT2_GLOBAL(0x009DE518, uint32) & (1 << 3))
if (w->classification == RCT2_GLOBAL(RCT2_ADDRESS_TOOL_WINDOWCLASS, rct_windowclass) && w->number == RCT2_GLOBAL(RCT2_ADDRESS_TOOL_WINDOWNUMBER, rct_windownumber))
@ -658,8 +664,18 @@ static void window_park_entrance_mouseup()
short widgetIndex;
rct_window *w;
#ifdef _MSC_VER
__asm mov widgetIndex, dx
#else
__asm__ ( "mov %[widgetIndex], dx " : [widgetIndex] "+m" (widgetIndex) );
#endif
#ifdef _MSC_VER
__asm mov w, esi
#else
__asm__ ( "mov %[w], esi " : [w] "+m" (w) );
#endif
switch (widgetIndex) {
case WIDX_CLOSE:
@ -698,7 +714,12 @@ static void window_park_entrance_resize()
{
rct_window *w;
#ifdef _MSC_VER
__asm mov w, esi
#else
__asm__ ( "mov %[w], esi " : [w] "+m" (w) );
#endif
w->flags |= WF_RESIZABLE;
window_set_resize(w, 230, 174 + 9, 230 * 3, (274 + 9) * 3);
@ -715,9 +736,24 @@ static void window_park_entrance_mousedown()
rct_window *w;
rct_widget *widget;
#ifdef _MSC_VER
__asm mov widgetIndex, dx
#else
__asm__ ( "mov %[widgetIndex], dx " : [widgetIndex] "+m" (widgetIndex) );
#endif
#ifdef _MSC_VER
__asm mov w, esi
#else
__asm__ ( "mov %[w], esi " : [w] "+m" (w) );
#endif
#ifdef _MSC_VER
__asm mov widget, edi
#else
__asm__ ( "mov %[widget], edi " : [widget] "+m" (widget) );
#endif
if (widgetIndex == WIDX_OPEN_OR_CLOSE) {
gDropdownItemsFormat[0] = 1142;
@ -751,8 +787,18 @@ static void window_park_entrance_dropdown()
{
short widgetIndex, dropdownIndex;
#ifdef _MSC_VER
__asm mov dropdownIndex, ax
#else
__asm__ ( "mov %[dropdownIndex], ax " : [dropdownIndex] "+m" (dropdownIndex) );
#endif
#ifdef _MSC_VER
__asm mov widgetIndex, dx
#else
__asm__ ( "mov %[widgetIndex], dx " : [widgetIndex] "+m" (widgetIndex) );
#endif
if (widgetIndex == WIDX_OPEN_OR_CLOSE) {
if (dropdownIndex == -1)
@ -789,10 +835,30 @@ static void window_park_entrance_toolupdate()
short widgetIndex;
rct_window *w;
#ifdef _MSC_VER
__asm mov x, eax
#else
__asm__ ( "mov %[x], eax " : [x] "+m" (x) );
#endif
#ifdef _MSC_VER
__asm mov y, ebx
#else
__asm__ ( "mov %[y], ebx " : [y] "+m" (y) );
#endif
#ifdef _MSC_VER
__asm mov widgetIndex, dx
#else
__asm__ ( "mov %[widgetIndex], dx " : [widgetIndex] "+m" (widgetIndex) );
#endif
#ifdef _MSC_VER
__asm mov w, esi
#else
__asm__ ( "mov %[w], esi " : [w] "+m" (w) );
#endif
if (widgetIndex == WIDX_BUY_LAND_RIGHTS) {
RCT2_CALLPROC_X(0x0068AAE1, x, y, 0, 0, (int)w, 0, 0);
@ -819,10 +885,30 @@ static void window_park_entrance_tooldown()
short x, y, widgetIndex;
rct_window *w;
#ifdef _MSC_VER
__asm mov x, ax
#else
__asm__ ( "mov %[x], ax " : [x] "+m" (x) );
#endif
#ifdef _MSC_VER
__asm mov y, bx
#else
__asm__ ( "mov %[y], bx " : [y] "+m" (y) );
#endif
#ifdef _MSC_VER
__asm mov widgetIndex, dx
#else
__asm__ ( "mov %[widgetIndex], dx " : [widgetIndex] "+m" (widgetIndex) );
#endif
#ifdef _MSC_VER
__asm mov w, esi
#else
__asm__ ( "mov %[w], esi " : [w] "+m" (w) );
#endif
RCT2_CALLPROC_X(0x006681E6, x, y, 0, widgetIndex, (int)w, 0, 0);
}
@ -836,10 +922,30 @@ static void window_park_entrance_tooldrag()
short x, y, widgetIndex;
rct_window *w;
#ifdef _MSC_VER
__asm mov x, ax
#else
__asm__ ( "mov %[x], ax " : [x] "+m" (x) );
#endif
#ifdef _MSC_VER
__asm mov y, bx
#else
__asm__ ( "mov %[y], bx " : [y] "+m" (y) );
#endif
#ifdef _MSC_VER
__asm mov widgetIndex, dx
#else
__asm__ ( "mov %[widgetIndex], dx " : [widgetIndex] "+m" (widgetIndex) );
#endif
#ifdef _MSC_VER
__asm mov w, esi
#else
__asm__ ( "mov %[w], esi " : [w] "+m" (w) );
#endif
RCT2_CALLPROC_X(0x006681FB, x, y, 0, widgetIndex, (int)w, 0, 0);
}
@ -853,8 +959,18 @@ static void window_park_entrance_toolabort()
short widgetIndex;
rct_window *w;
#ifdef _MSC_VER
__asm mov widgetIndex, dx
#else
__asm__ ( "mov %[widgetIndex], dx " : [widgetIndex] "+m" (widgetIndex) );
#endif
#ifdef _MSC_VER
__asm mov w, esi
#else
__asm__ ( "mov %[w], esi " : [w] "+m" (w) );
#endif
if (widgetIndex == WIDX_BUY_LAND_RIGHTS) {
hide_gridlines();
@ -876,10 +992,30 @@ static void window_park_entrance_textinput()
rct_window *w;
char *text;
#ifdef _MSC_VER
__asm mov result, cl
#else
__asm__ ( "mov %[result], cl " : [result] "+m" (result) );
#endif
#ifdef _MSC_VER
__asm mov widgetIndex, dx
#else
__asm__ ( "mov %[widgetIndex], dx " : [widgetIndex] "+m" (widgetIndex) );
#endif
#ifdef _MSC_VER
__asm mov w, esi
#else
__asm__ ( "mov %[w], esi " : [w] "+m" (w) );
#endif
#ifdef _MSC_VER
__asm mov text, edi
#else
__asm__ ( "mov %[text], edi " : [text] "+m" (text) );
#endif
if (widgetIndex == WIDX_RENAME) {
if (result) {
@ -900,7 +1036,12 @@ static void window_park_entrance_invalidate()
int i;
rct_window *w;
#ifdef _MSC_VER
__asm mov w, esi
#else
__asm__ ( "mov %[w], esi " : [w] "+m" (w) );
#endif
w->widgets = window_park_page_widgets[w->page];
window_init_scroll_widgets(w);
@ -952,8 +1093,18 @@ static void window_park_entrance_paint()
rct_drawpixelinfo *dpi;
rct_widget *labelWidget;
#ifdef _MSC_VER
__asm mov w, esi
#else
__asm__ ( "mov %[w], esi " : [w] "+m" (w) );
#endif
#ifdef _MSC_VER
__asm mov dpi, edi
#else
__asm__ ( "mov %[dpi], edi " : [dpi] "+m" (dpi) );
#endif
window_draw_widgets(w, dpi);
window_park_draw_tab_images(dpi, w);
@ -1116,8 +1267,18 @@ static void window_park_rating_mouseup()
short widgetIndex;
rct_window *w;
#ifdef _MSC_VER
__asm mov widgetIndex, dx
#else
__asm__ ( "mov %[widgetIndex], dx " : [widgetIndex] "+m" (widgetIndex) );
#endif
#ifdef _MSC_VER
__asm mov w, esi
#else
__asm__ ( "mov %[w], esi " : [w] "+m" (w) );
#endif
if (widgetIndex == WIDX_CLOSE)
window_close(w);
@ -1133,7 +1294,12 @@ static void window_park_rating_resize()
{
rct_window *w;
#ifdef _MSC_VER
__asm mov w, esi
#else
__asm__ ( "mov %[w], esi " : [w] "+m" (w) );
#endif
window_set_resize(w, 230, 182, 230, 182);
}
@ -1157,7 +1323,12 @@ static void window_park_rating_invalidate()
rct_window *w;
rct_widget *widgets;
#ifdef _MSC_VER
__asm mov w, esi
#else
__asm__ ( "mov %[w], esi " : [w] "+m" (w) );
#endif
widgets = window_park_page_widgets[w->page];
if (w->widgets != widgets) {
@ -1186,8 +1357,18 @@ static void window_park_rating_paint()
rct_widget *widget;
uint8 *history;
#ifdef _MSC_VER
__asm mov w, esi
#else
__asm__ ( "mov %[w], esi " : [w] "+m" (w) );
#endif
#ifdef _MSC_VER
__asm mov dpi, edi
#else
__asm__ ( "mov %[dpi], edi " : [dpi] "+m" (dpi) );
#endif
window_draw_widgets(w, dpi);
window_park_draw_tab_images(dpi, w);
@ -1254,8 +1435,18 @@ static void window_park_guests_mouseup()
short widgetIndex;
rct_window *w;
#ifdef _MSC_VER
__asm mov widgetIndex, dx
#else
__asm__ ( "mov %[widgetIndex], dx " : [widgetIndex] "+m" (widgetIndex) );
#endif
#ifdef _MSC_VER
__asm mov w, esi
#else
__asm__ ( "mov %[w], esi " : [w] "+m" (w) );
#endif
if (widgetIndex == WIDX_CLOSE)
window_close(w);
@ -1271,7 +1462,12 @@ static void window_park_guests_resize()
{
rct_window *w;
#ifdef _MSC_VER
__asm mov w, esi
#else
__asm__ ( "mov %[w], esi " : [w] "+m" (w) );
#endif
window_set_resize(w, 230, 182, 230, 182);
}
@ -1296,7 +1492,12 @@ static void window_park_guests_invalidate()
rct_window *w;
rct_widget *widgets;
#ifdef _MSC_VER
__asm mov w, esi
#else
__asm__ ( "mov %[w], esi " : [w] "+m" (w) );
#endif
widgets = window_park_page_widgets[w->page];
if (w->widgets != widgets) {
@ -1325,8 +1526,18 @@ static void window_park_guests_paint()
rct_widget *widget;
uint8 *history;
#ifdef _MSC_VER
__asm mov w, esi
#else
__asm__ ( "mov %[w], esi " : [w] "+m" (w) );
#endif
#ifdef _MSC_VER
__asm mov dpi, edi
#else
__asm__ ( "mov %[dpi], edi " : [dpi] "+m" (dpi) );
#endif
window_draw_widgets(w, dpi);
window_park_draw_tab_images(dpi, w);
@ -1364,8 +1575,18 @@ static void window_park_price_mouseup()
short widgetIndex;
rct_window *w;
#ifdef _MSC_VER
__asm mov widgetIndex, dx
#else
__asm__ ( "mov %[widgetIndex], dx " : [widgetIndex] "+m" (widgetIndex) );
#endif
#ifdef _MSC_VER
__asm mov w, esi
#else
__asm__ ( "mov %[w], esi " : [w] "+m" (w) );
#endif
if (widgetIndex == WIDX_CLOSE)
window_close(w);
@ -1381,7 +1602,12 @@ static void window_park_price_resize()
{
rct_window *w;
#ifdef _MSC_VER
__asm mov w, esi
#else
__asm__ ( "mov %[w], esi " : [w] "+m" (w) );
#endif
window_set_resize(w, 230, 124, 230, 124);
}
@ -1396,8 +1622,18 @@ static void window_park_price_mousedown()
short widgetIndex;
rct_window *w;
#ifdef _MSC_VER
__asm mov widgetIndex, dx
#else
__asm__ ( "mov %[widgetIndex], dx " : [widgetIndex] "+m" (widgetIndex) );
#endif
#ifdef _MSC_VER
__asm mov w, esi
#else
__asm__ ( "mov %[w], esi " : [w] "+m" (w) );
#endif
switch (widgetIndex) {
case WIDX_CLOSE:
@ -1442,7 +1678,12 @@ static void window_park_price_invalidate()
rct_window *w;
rct_widget *widgets;
#ifdef _MSC_VER
__asm mov w, esi
#else
__asm__ ( "mov %[w], esi " : [w] "+m" (w) );
#endif
widgets = window_park_page_widgets[w->page];
if (w->widgets != widgets) {
@ -1482,8 +1723,18 @@ static void window_park_price_paint()
rct_window *w;
rct_drawpixelinfo *dpi;
#ifdef _MSC_VER
__asm mov w, esi
#else
__asm__ ( "mov %[w], esi " : [w] "+m" (w) );
#endif
#ifdef _MSC_VER
__asm mov dpi, edi
#else
__asm__ ( "mov %[dpi], edi " : [dpi] "+m" (dpi) );
#endif
window_draw_widgets(w, dpi);
window_park_draw_tab_images(dpi, w);
@ -1509,8 +1760,18 @@ static void window_park_stats_mouseup()
short widgetIndex;
rct_window *w;
#ifdef _MSC_VER
__asm mov widgetIndex, dx
#else
__asm__ ( "mov %[widgetIndex], dx " : [widgetIndex] "+m" (widgetIndex) );
#endif
#ifdef _MSC_VER
__asm mov w, esi
#else
__asm__ ( "mov %[w], esi " : [w] "+m" (w) );
#endif
if (widgetIndex == WIDX_CLOSE)
window_close(w);
@ -1526,7 +1787,12 @@ static void window_park_stats_resize()
{
rct_window *w;
#ifdef _MSC_VER
__asm mov w, esi
#else
__asm__ ( "mov %[w], esi " : [w] "+m" (w) );
#endif
window_set_resize(w, 230, 109, 230, 109);
}
@ -1566,7 +1832,12 @@ static void window_park_stats_invalidate()
rct_window *w;
rct_widget *widgets;
#ifdef _MSC_VER
__asm mov w, esi
#else
__asm__ ( "mov %[w], esi " : [w] "+m" (w) );
#endif
widgets = window_park_page_widgets[w->page];
if (w->widgets != widgets) {
@ -1593,8 +1864,18 @@ static void window_park_stats_paint()
rct_window *w;
rct_drawpixelinfo *dpi;
#ifdef _MSC_VER
__asm mov w, esi
#else
__asm__ ( "mov %[w], esi " : [w] "+m" (w) );
#endif
#ifdef _MSC_VER
__asm mov dpi, edi
#else
__asm__ ( "mov %[dpi], edi " : [dpi] "+m" (dpi) );
#endif
window_draw_widgets(w, dpi);
window_park_draw_tab_images(dpi, w);
@ -1676,8 +1957,18 @@ static void window_park_objective_mouseup()
short widgetIndex;
rct_window *w;
#ifdef _MSC_VER
__asm mov widgetIndex, dx
#else
__asm__ ( "mov %[widgetIndex], dx " : [widgetIndex] "+m" (widgetIndex) );
#endif
#ifdef _MSC_VER
__asm mov w, esi
#else
__asm__ ( "mov %[w], esi " : [w] "+m" (w) );
#endif
switch (widgetIndex) {
case WIDX_CLOSE:
@ -1706,7 +1997,12 @@ static void window_park_objective_resize()
{
rct_window *w;
#ifdef _MSC_VER
__asm mov w, esi
#else
__asm__ ( "mov %[w], esi " : [w] "+m" (w) );
#endif
window_set_resize(w, 230, 224, 230, 224);
}
@ -1729,7 +2025,12 @@ static void window_park_objective_invalidate()
{
rct_window *w;
#ifdef _MSC_VER
__asm mov w, esi
#else
__asm__ ( "mov %[w], esi " : [w] "+m" (w) );
#endif
window_park_set_pressed_tab(w);
@ -1757,8 +2058,18 @@ static void window_park_objective_paint()
rct_window *w;
rct_drawpixelinfo *dpi;
#ifdef _MSC_VER
__asm mov w, esi
#else
__asm__ ( "mov %[w], esi " : [w] "+m" (w) );
#endif
#ifdef _MSC_VER
__asm mov dpi, edi
#else
__asm__ ( "mov %[dpi], edi " : [dpi] "+m" (dpi) );
#endif
window_draw_widgets(w, dpi);
window_park_draw_tab_images(dpi, w);
@ -1838,8 +2149,18 @@ static void window_park_awards_mouseup()
short widgetIndex;
rct_window *w;
#ifdef _MSC_VER
__asm mov widgetIndex, dx
#else
__asm__ ( "mov %[widgetIndex], dx " : [widgetIndex] "+m" (widgetIndex) );
#endif
#ifdef _MSC_VER
__asm mov w, esi
#else
__asm__ ( "mov %[w], esi " : [w] "+m" (w) );
#endif
if (widgetIndex == WIDX_CLOSE)
window_close(w);
@ -1855,7 +2176,12 @@ static void window_park_awards_resize()
{
rct_window *w;
#ifdef _MSC_VER
__asm mov w, esi
#else
__asm__ ( "mov %[w], esi " : [w] "+m" (w) );
#endif
window_set_resize(w, 230, 182, 230, 182);
}
@ -1879,7 +2205,12 @@ static void window_park_awards_invalidate()
rct_window *w;
rct_widget *widgets;
#ifdef _MSC_VER
__asm mov w, esi
#else
__asm__ ( "mov %[w], esi " : [w] "+m" (w) );
#endif
widgets = window_park_page_widgets[w->page];
if (w->widgets != widgets) {
@ -1907,8 +2238,18 @@ static void window_park_awards_paint()
rct_drawpixelinfo *dpi;
rct_award *award;
#ifdef _MSC_VER
__asm mov w, esi
#else
__asm__ ( "mov %[w], esi " : [w] "+m" (w) );
#endif
#ifdef _MSC_VER
__asm mov dpi, edi
#else
__asm__ ( "mov %[dpi], edi " : [dpi] "+m" (dpi) );
#endif
window_draw_widgets(w, dpi);
window_park_draw_tab_images(dpi, w);

View File

@ -22,7 +22,7 @@
#include "addresses.h"
#include "game.h"
#include "ride.h"
#include "strings.h"
#include "string_ids.h"
#include "sprites.h"
#include "widget.h"
#include "window.h"
@ -34,7 +34,7 @@ enum {
PAGE_KIOSKS_AND_FACILITIES
};
static enum WINDOW_RIDE_LIST_WIDGET_IDX {
enum WINDOW_RIDE_LIST_WIDGET_IDX {
WIDX_BACKGROUND,
WIDX_TITLE,
WIDX_CLOSE,
@ -178,8 +178,18 @@ static void window_ride_list_mouseup()
short widgetIndex;
rct_window *w;
#ifdef _MSC_VER
__asm mov widgetIndex, dx
#else
__asm__ ( "mov %[widgetIndex], dx " : [widgetIndex] "+m" (widgetIndex) );
#endif
#ifdef _MSC_VER
__asm mov w, esi
#else
__asm__ ( "mov %[w], esi " : [w] "+m" (w) );
#endif
switch (widgetIndex) {
case WIDX_CLOSE:
@ -213,7 +223,12 @@ static void window_ride_list_resize()
{
rct_window *w;
#ifdef _MSC_VER
__asm mov w, esi
#else
__asm__ ( "mov %[w], esi " : [w] "+m" (w) );
#endif
w->min_width = 340;
w->min_height = 124;
@ -240,9 +255,24 @@ static void window_ride_list_mousedown()
rct_window *w;
rct_widget *widget;
#ifdef _MSC_VER
__asm mov widgetIndex, dx
#else
__asm__ ( "mov %[widgetIndex], dx " : [widgetIndex] "+m" (widgetIndex) );
#endif
#ifdef _MSC_VER
__asm mov w, esi
#else
__asm__ ( "mov %[w], esi " : [w] "+m" (w) );
#endif
#ifdef _MSC_VER
__asm mov widget, edi
#else
__asm__ ( "mov %[widget], edi " : [widget] "+m" (widget) );
#endif
if (widgetIndex == WIDX_OPEN_CLOSE_ALL) {
gDropdownItemsFormat[0] = STR_CLOSE_ALL;
@ -275,9 +305,24 @@ static void window_ride_list_dropdown()
short dropdownIndex, widgetIndex;
rct_window *w;
#ifdef _MSC_VER
__asm mov dropdownIndex, ax
#else
__asm__ ( "mov %[dropdownIndex], ax " : [dropdownIndex] "+m" (dropdownIndex) );
#endif
#ifdef _MSC_VER
__asm mov widgetIndex, dx
#else
__asm__ ( "mov %[widgetIndex], dx " : [widgetIndex] "+m" (widgetIndex) );
#endif
#ifdef _MSC_VER
__asm mov w, esi
#else
__asm__ ( "mov %[w], esi " : [w] "+m" (w) );
#endif
if (widgetIndex == WIDX_OPEN_CLOSE_ALL) {
if (dropdownIndex == 0)
@ -314,7 +359,12 @@ static void window_ride_list_scrollgetsize()
int top, height;
rct_window *w;
#ifdef _MSC_VER
__asm mov w, esi
#else
__asm__ ( "mov %[w], esi " : [w] "+m" (w) );
#endif
height = w->var_476 * 10;
if (w->var_47A != -1) {
@ -330,8 +380,18 @@ static void window_ride_list_scrollgetsize()
window_invalidate(w);
}
#ifdef _MSC_VER
__asm mov ecx, 0
#else
__asm__ ( "mov ecx, 0 " );
#endif
#ifdef _MSC_VER
__asm mov edx, height
#else
__asm__ ( "mov edx, %[height] " : [height] "+m" (height) );
#endif
}
/**
@ -344,8 +404,18 @@ static void window_ride_list_scrollmousedown()
short y;
rct_window *w;
#ifdef _MSC_VER
__asm mov y, dx
#else
__asm__ ( "mov %[y], dx " : [y] "+m" (y) );
#endif
#ifdef _MSC_VER
__asm mov w, esi
#else
__asm__ ( "mov %[w], esi " : [w] "+m" (w) );
#endif
index = y / 10;
if (index >= w->var_476)
@ -365,8 +435,18 @@ static void window_ride_list_scrollmouseover()
short y;
rct_window *w;
#ifdef _MSC_VER
__asm mov y, dx
#else
__asm__ ( "mov %[y], dx " : [y] "+m" (y) );
#endif
#ifdef _MSC_VER
__asm mov w, esi
#else
__asm__ ( "mov %[w], esi " : [w] "+m" (w) );
#endif
index = y / 10;
if (index >= w->var_476)
@ -394,7 +474,12 @@ static void window_ride_list_invalidate()
int i;
rct_window *w;
#ifdef _MSC_VER
__asm mov w, esi
#else
__asm__ ( "mov %[w], esi " : [w] "+m" (w) );
#endif
window_ride_list_widgets[WIDX_CURRENT_INFORMATION_TYPE].image = STR_STATUS + _window_ride_list_information_type;
@ -427,8 +512,18 @@ static void window_ride_list_paint()
rct_window *w;
rct_drawpixelinfo *dpi;
#ifdef _MSC_VER
__asm mov w, esi
#else
__asm__ ( "mov %[w], esi " : [w] "+m" (w) );
#endif
#ifdef _MSC_VER
__asm mov dpi, edi
#else
__asm__ ( "mov %[dpi], edi " : [dpi] "+m" (dpi) );
#endif
window_draw_widgets(w, dpi);
window_ride_list_draw_tab_images(dpi, w);
@ -458,8 +553,18 @@ static void window_ride_list_scrollpaint()
rct_drawpixelinfo *dpi;
rct_ride *ride;
#ifdef _MSC_VER
__asm mov w, esi
#else
__asm__ ( "mov %[w], esi " : [w] "+m" (w) );
#endif
#ifdef _MSC_VER
__asm mov dpi, edi
#else
__asm__ ( "mov %[dpi], edi " : [dpi] "+m" (dpi) );
#endif
gfx_fill_rect(dpi, dpi->x, dpi->y, dpi->x + dpi->width, dpi->y + dpi->height, RCT2_GLOBAL(0x0141FC48 + (w->colours[1] * 8), uint8));

View File

@ -21,14 +21,14 @@
#include "addresses.h"
#include "game.h"
#include "rct2.h"
#include "strings.h"
#include "string_ids.h"
#include "sprites.h"
#include "tutorial.h"
#include "widget.h"
#include "window.h"
#include "audio.h"
static enum WINDOW_SAVE_PROMPT_WIDGET_IDX {
enum WINDOW_SAVE_PROMPT_WIDGET_IDX {
WIDX_BACKGROUND,
WIDX_TITLE,
WIDX_CLOSE,
@ -175,8 +175,18 @@ static void window_save_prompt_mouseup()
short widgetIndex;
rct_window *w;
#ifdef _MSC_VER
__asm mov widgetIndex, dx
#else
__asm__ ( "mov %[widgetIndex], dx " : [widgetIndex] "+m" (widgetIndex) );
#endif
#ifdef _MSC_VER
__asm mov w, esi
#else
__asm__ ( "mov %[w], esi " : [w] "+m" (w) );
#endif
// TODO
}
@ -186,8 +196,18 @@ static void window_save_prompt_paint()
rct_window *w;
rct_drawpixelinfo *dpi;
#ifdef _MSC_VER
__asm mov w, esi
#else
__asm__ ( "mov %[w], esi " : [w] "+m" (w) );
#endif
#ifdef _MSC_VER
__asm mov dpi, edi
#else
__asm__ ( "mov %[dpi], edi " : [dpi] "+m" (dpi) );
#endif
window_draw_widgets(w, dpi);
}

View File

@ -21,7 +21,7 @@
#include "addresses.h"
#include "game.h"
#include "sprites.h"
#include "strings.h"
#include "string_ids.h"
#include "widget.h"
#include "window.h"
@ -98,10 +98,19 @@ static void window_title_exit_mouseup()
short widgetIndex;
rct_window *w;
#ifdef _MSC_VER
__asm mov widgetIndex, dx
__asm mov w, esi
#else
__asm__ ( "mov %[widgetIndex], dx " : [widgetIndex] "+m" (widgetIndex) );
#endif
if (RCT2_GLOBAL(RCT2_ADDRESS_RUN_INTRO_TICK_PART, int) != 0)
#ifdef _MSC_VER
__asm mov w, esi
#else
__asm__ ( "mov %[w], esi " : [w] "+m" (w) );
#endif
if (RCT2_GLOBAL(RCT2_ADDRESS_RUN_INTRO_TICK_PART, uint8) != 0)
return;
if (widgetIndex == 0)
@ -117,8 +126,18 @@ static void window_title_exit_paint()
rct_window *w;
rct_drawpixelinfo *dpi;
#ifdef _MSC_VER
__asm mov w, esi
#else
__asm__ ( "mov %[w], esi " : [w] "+m" (w) );
#endif
#ifdef _MSC_VER
__asm mov dpi, edi
#else
__asm__ ( "mov %[dpi], edi " : [dpi] "+m" (dpi) );
#endif
window_draw_widgets(w, dpi);
}

View File

@ -19,7 +19,7 @@
*****************************************************************************/
#include "addresses.h"
#include "strings.h"
#include "string_ids.h"
#include "sprites.h"
#include "widget.h"
#include "window.h"
@ -99,8 +99,18 @@ static void window_title_logo_paint()
rct_window *w;
rct_drawpixelinfo *dpi;
#ifdef _MSC_VER
__asm mov w, esi
#else
__asm__ ( "mov %[w], esi " : [w] "+m" (w) );
#endif
#ifdef _MSC_VER
__asm mov dpi, edi
#else
__asm__ ( "mov %[dpi], edi " : [dpi] "+m" (dpi) );
#endif
gfx_draw_sprite(dpi, SPR_MENU_LOGO, w->x, w->y);

View File

@ -21,7 +21,7 @@
#include "addresses.h"
#include "editor.h"
#include "game.h"
#include "strings.h"
#include "string_ids.h"
#include "sprites.h"
#include "tutorial.h"
#include "widget.h"
@ -109,7 +109,12 @@ static void window_title_menu_mouseup()
{
short widgetIndex;
#ifdef _MSC_VER
__asm mov widgetIndex, dx
#else
__asm__ ( "mov %[widgetIndex], dx " : [widgetIndex] "+m" (widgetIndex) );
#endif
if (widgetIndex == WIDX_START_NEW_GAME) {
window_scenarioselect_open();
} else if (widgetIndex == WIDX_CONTINUE_SAVED_GAME) {
@ -123,9 +128,24 @@ static void window_title_menu_mousedown()
rct_window *w;
rct_widget *widget;
#ifdef _MSC_VER
__asm mov widgetIndex, dx
#else
__asm__ ( "mov %[widgetIndex], dx " : [widgetIndex] "+m" (widgetIndex) );
#endif
#ifdef _MSC_VER
__asm mov w, esi
#else
__asm__ ( "mov %[w], esi " : [w] "+m" (w) );
#endif
#ifdef _MSC_VER
__asm mov widget, edi
#else
__asm__ ( "mov %[widget], edi " : [widget] "+m" (widget) );
#endif
if (widgetIndex == WIDX_SHOW_TUTORIAL) {
gDropdownItemsFormat[0] = STR_TUTORIAL_BEGINNERS;
@ -159,8 +179,18 @@ static void window_title_menu_dropdown()
{
short widgetIndex, dropdownIndex;
#ifdef _MSC_VER
__asm mov widgetIndex, dx
#else
__asm__ ( "mov %[widgetIndex], dx " : [widgetIndex] "+m" (widgetIndex) );
#endif
#ifdef _MSC_VER
__asm mov dropdownIndex, ax
#else
__asm__ ( "mov %[dropdownIndex], ax " : [dropdownIndex] "+m" (dropdownIndex) );
#endif
if (widgetIndex == WIDX_SHOW_TUTORIAL) {
tutorial_start(dropdownIndex);
@ -192,8 +222,18 @@ static void window_title_menu_paint()
rct_window *w;
rct_drawpixelinfo *dpi;
#ifdef _MSC_VER
__asm mov w, esi
#else
__asm__ ( "mov %[w], esi " : [w] "+m" (w) );
#endif
#ifdef _MSC_VER
__asm mov dpi, edi
#else
__asm__ ( "mov %[dpi], edi " : [dpi] "+m" (dpi) );
#endif
window_draw_widgets(w, dpi);
}

View File

@ -18,11 +18,12 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*****************************************************************************/
#include <string.h>
#include "addresses.h"
#include "audio.h"
#include "date.h"
#include "scenario.h"
#include "strings.h"
#include "string_ids.h"
#include "sprites.h"
#include "widget.h"
#include "window.h"
@ -172,8 +173,18 @@ static void window_scenarioselect_mouseup()
short widgetIndex;
rct_window *w;
#ifdef _MSC_VER
__asm mov widgetIndex, dx
#else
__asm__ ( "mov %[widgetIndex], dx " : [widgetIndex] "+m" (widgetIndex) );
#endif
#ifdef _MSC_VER
__asm mov w, esi
#else
__asm__ ( "mov %[w], esi " : [w] "+m" (w) );
#endif
if (widgetIndex == WIDX_CLOSE)
window_close(w);
@ -184,8 +195,18 @@ static void window_scenarioselect_mousedown()
short widgetIndex;
rct_window *w;
#ifdef _MSC_VER
__asm mov widgetIndex, dx
#else
__asm__ ( "mov %[widgetIndex], dx " : [widgetIndex] "+m" (widgetIndex) );
#endif
#ifdef _MSC_VER
__asm mov w, esi
#else
__asm__ ( "mov %[w], esi " : [w] "+m" (w) );
#endif
if (widgetIndex >= WIDX_TAB1 && widgetIndex <= WIDX_TAB5) {
w->selected_tab = widgetIndex - 4;
@ -204,7 +225,12 @@ static void window_scenarioselect_scrollgetsize()
rct_window *w;
rct_scenario_basic *scenario;
#ifdef _MSC_VER
__asm mov w, esi
#else
__asm__ ( "mov %[w], esi " : [w] "+m" (w) );
#endif
height = 0;
for (i = 0; i < RCT2_GLOBAL(RCT2_ADDRESS_NUM_SCENARIOS, sint32); i++) {
@ -215,8 +241,18 @@ static void window_scenarioselect_scrollgetsize()
height += 24;
}
#ifdef _MSC_VER
__asm mov ecx, 0
#else
__asm__ ( "mov ecx, 0 " );
#endif
#ifdef _MSC_VER
__asm mov edx, height
#else
__asm__ ( "mov edx, %[height] " : [height] "+m" (height) );
#endif
}
static void window_scenarioselect_scrollmousedown()
@ -226,9 +262,24 @@ static void window_scenarioselect_scrollmousedown()
rct_window *w;
rct_scenario_basic *scenario;
#ifdef _MSC_VER
__asm mov x, cx
#else
__asm__ ( "mov %[x], cx " : [x] "+m" (x) );
#endif
#ifdef _MSC_VER
__asm mov y, dx
#else
__asm__ ( "mov %[y], dx " : [y] "+m" (y) );
#endif
#ifdef _MSC_VER
__asm mov w, esi
#else
__asm__ ( "mov %[w], esi " : [w] "+m" (w) );
#endif
for (i = 0; i < RCT2_GLOBAL(RCT2_ADDRESS_NUM_SCENARIOS, sint32); i++) {
scenario = &(RCT2_GLOBAL(RCT2_ADDRESS_SCENARIO_LIST, rct_scenario_basic*)[i]);
@ -254,9 +305,24 @@ static void window_scenarioselect_scrollmouseover()
rct_window *w;
rct_scenario_basic *scenario, *selected;
#ifdef _MSC_VER
__asm mov x, cx
#else
__asm__ ( "mov %[x], cx " : [x] "+m" (x) );
#endif
#ifdef _MSC_VER
__asm mov y, dx
#else
__asm__ ( "mov %[y], dx " : [y] "+m" (y) );
#endif
#ifdef _MSC_VER
__asm mov w, esi
#else
__asm__ ( "mov %[w], esi " : [w] "+m" (w) );
#endif
selected = NULL;
for (i = 0; i < RCT2_GLOBAL(RCT2_ADDRESS_NUM_SCENARIOS, sint32); i++) {
@ -283,7 +349,12 @@ static void window_scenarioselect_invalidate()
{
rct_window *w;
#ifdef _MSC_VER
__asm mov w, esi
#else
__asm__ ( "mov %[w], esi " : [w] "+m" (w) );
#endif
w->pressed_widgets &= ~(0x10 | 0x20 | 0x40 | 0x80 | 0x100);
w->pressed_widgets |= 1LL << (w->selected_tab + 4);
@ -297,8 +368,18 @@ static void window_scenarioselect_paint()
rct_widget *widget;
rct_scenario_basic *scenario;
#ifdef _MSC_VER
__asm mov w, esi
#else
__asm__ ( "mov %[w], esi " : [w] "+m" (w) );
#endif
#ifdef _MSC_VER
__asm mov dpi, edi
#else
__asm__ ( "mov %[dpi], edi " : [dpi] "+m" (dpi) );
#endif
window_draw_widgets(w, dpi);
@ -359,8 +440,18 @@ static void window_scenarioselect_scrollpaint()
rct_drawpixelinfo *dpi;
rct_scenario_basic *scenario;
#ifdef _MSC_VER
__asm mov w, esi
#else
__asm__ ( "mov %[w], esi " : [w] "+m" (w) );
#endif
#ifdef _MSC_VER
__asm mov dpi, edi
#else
__asm__ ( "mov %[dpi], edi " : [dpi] "+m" (dpi) );
#endif
colour = ((char*)0x0141FC48)[w->colours[1] * 8];
colour = (colour << 24) | (colour << 16) | (colour << 8) | colour;

View File

@ -18,9 +18,10 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*****************************************************************************/
#include <windows.h>
#include <memory.h>
#include "addresses.h"
#include "strings.h"
#include "string_ids.h"
#include "widget.h"
#include "window.h"
@ -188,8 +189,18 @@ static void window_tooltip_paint()
rct_window *w;
rct_drawpixelinfo *dpi;
#ifdef _MSC_VER
__asm mov w, esi
#else
__asm__ ( "mov %[w], esi " : [w] "+m" (w) );
#endif
#ifdef _MSC_VER
__asm mov dpi, edi
#else
__asm__ ( "mov %[dpi], edi " : [dpi] "+m" (dpi) );
#endif
int left = w->x;
int top = w->y;

View File

@ -20,12 +20,12 @@
#include "addresses.h"
#include "map.h"
#include "strings.h"
#include "string_ids.h"
#include "sprites.h"
#include "widget.h"
#include "window.h"
static enum WINDOW_WATER_WIDGET_IDX {
enum WINDOW_WATER_WIDGET_IDX {
WIDX_BACKGROUND,
WIDX_TITLE,
WIDX_CLOSE,
@ -130,8 +130,18 @@ static void window_water_mouseup()
int limit;
short widgetIndex;
#ifdef _MSC_VER
__asm mov widgetIndex, dx
#else
__asm__ ( "mov %[widgetIndex], dx " : [widgetIndex] "+m" (widgetIndex) );
#endif
#ifdef _MSC_VER
__asm mov w, esi
#else
__asm__ ( "mov %[w], esi " : [w] "+m" (w) );
#endif
switch (widgetIndex) {
case WIDX_CLOSE:
@ -184,7 +194,12 @@ static void window_water_invalidate()
{
rct_window *w;
#ifdef _MSC_VER
__asm mov w, esi
#else
__asm__ ( "mov %[w], esi " : [w] "+m" (w) );
#endif
// Set the preview image button to be pressed down
w->pressed_widgets |= (1 << WIDX_PREVIEW);
@ -203,8 +218,18 @@ static void window_water_paint()
rct_drawpixelinfo *dpi;
int x, y;
#ifdef _MSC_VER
__asm mov w, esi
#else
__asm__ ( "mov %[w], esi " : [w] "+m" (w) );
#endif
#ifdef _MSC_VER
__asm mov dpi, edi
#else
__asm__ ( "mov %[dpi], edi " : [dpi] "+m" (dpi) );
#endif
window_draw_widgets(w, dpi);