diff --git a/src/addresses.h b/src/addresses.h index 7bef46848b..98434ec0b9 100644 --- a/src/addresses.h +++ b/src/addresses.h @@ -170,8 +170,11 @@ #define RCT2_ADDRESS_CMDLINE 0x009E2D98 -#define RCT2_ADDRESS_MOUSE_READ_INDEX 0x009E2DE8 #define RCT2_ADDRESS_MOUSE_WRITE_INDEX 0x009E2DE4 +#define RCT2_ADDRESS_MOUSE_READ_INDEX 0x009E2DE8 +#define RCT2_ADDRESS_HFONT 0x009E2DEC +#define RCT2_ADDRESS_PROGRESSBAR_HWND 0x009E2DF8 + #define RCT2_ADDRESS_LAND_RAISE_COST 0x009E2E1C #define RCT2_ADDRESS_LAND_LOWER_COST 0x009E2E20 diff --git a/src/audio.c b/src/audio.c index 6ad888b962..fe46f41668 100644 --- a/src/audio.c +++ b/src/audio.c @@ -23,6 +23,9 @@ #include "addresses.h" #include "config.h" #include "rct2.h" +#include "sprite.h" +#include "viewport.h" +#include "window.h" int gAudioDeviceCount; audio_device *gAudioDevices = NULL; @@ -193,7 +196,7 @@ int sound_load3dparameters() */ int sound_load3dposition() { - /*if (SUCCEEDED(RCT2_GLOBAL(0x009E2BA4, LPDIRECTSOUND3DBUFFER)->lpVtbl->GetPosition(RCT2_GLOBAL(0x009E2BA4, LPDIRECTSOUND3DBUFFER), &RCT2_GLOBAL(0x009A6084, DS3DBUFFER), 1))) { + /*if (SUCCEEDED(RCT2_GLOBAL(0x009E2BA4, LPDIRECTSOUND3DBUFFER)->lpVtbl->GetPosition(RCT2_GLOBAL(0x009E2BA4, LPDIRECTSOUND3DBUFFER), &RCT2_GLOBAL(0x009A6084, D3DVECTOR), 1))) { return 1; }*/ return 0; @@ -732,7 +735,7 @@ void audio_timefunc(UINT uTimerID, UINT uMsg, DWORD_PTR dwUser, DWORD_PTR dw1, D return; } } - if (FAILED(sound_channel->dsbuffer->lpVtbl->Lock(sound_channel->dsbuffer, sound_channel->playpos, var2, (LPVOID*)&buf1, (LPDWORD)&buf1size, (LPVOID*)&buf2, &buf2size, 0))) { + if (FAILED(sound_channel->dsbuffer->lpVtbl->Lock(sound_channel->dsbuffer, sound_channel->playpos, var2, (LPVOID*)&buf1, (LPDWORD)&buf1size, (LPVOID*)&buf2, (LPDWORD)&buf2size, 0))) { // TimeFunc() could not lock DirectSoundBuffer return; } @@ -1178,6 +1181,63 @@ int sound_play_panned(int sound_id, int x) return result; } +/** +* +* rct2: 0x00401B63 +*/ +int sub_401B63(int channel) +{ + if (RCT2_ADDRESS(RCT2_ADDRESS_SOUND_CHANNEL_LIST, rct_sound_channel)[channel].var_0) { + return RCT2_ADDRESS(RCT2_ADDRESS_SOUND_CHANNEL_LIST, rct_sound_channel)[channel].var_160 == 0; + } else { + return 0; + } +} + +/** +* +* rct2: 0x0040194E +*/ +int sound_channel_load_file2(int channel, char* filename, int offset) +{ + if (!RCT2_GLOBAL(0x009E1AA4, int)) { + return 0; + } + if (sub_401B63(channel)) { + sound_channel_stop(channel); + } + if (!sound_channel_load_file(channel, filename, offset)) { + RCT2_ADDRESS(RCT2_ADDRESS_SOUND_CHANNEL_LIST, rct_sound_channel)[channel].var_4 = 0; + return 1; + } + return 0; +} + +/** +* +* rct2: 0x006BD0F8 +*/ +void start_title_music() +{ + if ((RCT2_GLOBAL(0x009AF284, uint32) & (1 << 0)) && RCT2_GLOBAL(0x009AF59D, uint8) & 1 && RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & 1) { + if (!RCT2_GLOBAL(0x009AF600, uint8)) { + RCT2_GLOBAL(0x014241BC, uint32) = 1; + int result = sound_channel_load_file2(3, (char*)get_file_path(PATH_ID_CSS17), 0); + RCT2_GLOBAL(0x014241BC, uint32) = 0; + if (result) { + RCT2_GLOBAL(0x014241BC, uint32) = 1; + sound_channel_play(3, 1, 0, 0, 0); + RCT2_GLOBAL(0x014241BC, uint32) = 0; + } + RCT2_GLOBAL(0x009AF600, uint8) = 1; + } + } else { + if (RCT2_GLOBAL(0x009AF600, uint8)) { + stop_title_music(); + } + } +} + /** * * rct2: 0x00401999 @@ -1241,6 +1301,30 @@ int sound_channel_set_volume(int channel, int volume) return 0; } +/** +* +* rct2: 0x006BB991 +*/ +void stop_completed_sounds() +{ + if (RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_SOUND_DEVICE, uint32) != -1) { + for (int i = 0; i < 7; i++) { + rct_other_sound* other_sound = &RCT2_ADDRESS(0x009AF484, rct_other_sound)[i]; + if (other_sound->id != (uint16)-1) { + RCT2_GLOBAL(0x014241BC, uint32) = 1; + int isplaying = sound_is_playing(&other_sound->sound); + RCT2_GLOBAL(0x014241BC, uint32) = 0; + if (!isplaying) { + RCT2_GLOBAL(0x014241BC, uint32) = 1; + sound_stop(&other_sound->sound); + RCT2_GLOBAL(0x014241BC, uint32) = 0; + other_sound->id = (uint16)-1; + } + } + } + } +} + /** * * rct2: 0x00404E7F @@ -1519,6 +1603,7 @@ void stop_title_music() RCT2_GLOBAL(0x014241BC, uint32) = 0; } } + RCT2_GLOBAL(0x009AF600, uint8) = 0; } /** diff --git a/src/audio.h b/src/audio.h index 6da01639df..c68b059e96 100644 --- a/src/audio.h +++ b/src/audio.h @@ -22,6 +22,7 @@ #define _AUDIO_H_ #include "rct2.h" +#include "sprite.h" typedef struct { char name[256]; @@ -51,7 +52,8 @@ typedef struct { */ typedef struct rct_sound { LPDIRECTSOUNDBUFFER dsbuffer; - int id; + uint16 id; + uint16 var_8; int has_caps; int var_0C; struct rct_sound* next; @@ -99,10 +101,14 @@ typedef struct { uint16 var_2; rct_sound sound1; // 0x04 uint16 var_18; - uint8 pad_1A[0x06]; + uint16 var_1A; + uint16 var_1C; + uint16 var_1D; rct_sound sound2; // 0x20 uint16 var_34; - uint8 pad_36[0x06]; + uint16 pad_36; + uint16 var_38; + uint16 var_3A; } rct_vehicle_sound; typedef struct { @@ -110,6 +116,17 @@ typedef struct { rct_sound sound; } rct_other_sound; +typedef struct { + uint16 id; + uint8 var_2; + uint8 var_3; + uint8 var_4; + uint16 var_5; + uint8 var_7; + uint16 var_8; + uint16 next; // 0xA +} rct_sound_unknown; + int get_dsound_devices(); int dsound_create_primary_buffer(int a, int device, int channels, int samples, int bits); void audio_timefunc(UINT uTimerID, UINT uMsg, DWORD_PTR dwUser, DWORD_PTR dw1, DWORD_PTR dw2, int channel); @@ -134,6 +151,7 @@ int sound_channel_play(int channel, int a2, int volume, int pan, int frequency); int sound_channel_set_frequency(int channel, int frequency); int sound_channel_set_pan(int channel, int pan); int sound_channel_set_volume(int channel, int volume); +int sound_channel_load_file2(int channel, char* filename, int offset); int sound_channel_load_file(int channel, char* filename, int offset); void sound_channel_free(HMMIO* hmmio, HGLOBAL* hmem); int sound_stop(rct_sound *sound); @@ -145,11 +163,13 @@ rct_sound* sound_remove(rct_sound* sound); rct_sound* sound_begin(); rct_sound* sound_next(rct_sound* sound); void pause_sounds(); +void stop_completed_sounds(); void stop_other_sounds(); void stop_vehicle_sounds(); void stop_ride_music(); void stop_peep_sounds(); void stop_title_music(); +void start_title_music(); void unpause_sounds(); // 0x009AF59C probably does the same job diff --git a/src/game.c b/src/game.c index 30f4df92b1..06165b0520 100644 --- a/src/game.c +++ b/src/game.c @@ -306,7 +306,7 @@ void game_update() if (RCT2_GLOBAL(0x009DEA6E, uint8) == 0) { for (; eax > 0; eax--) { game_logic_update(); - RCT2_CALLPROC_EBPSAFE(0x006BD0F8); // play title screen music + start_title_music(); //RCT2_CALLPROC_EBPSAFE(0x006BD0F8); // play title screen music /* if (rctmem->dword_009E2D74 == 1) { @@ -389,7 +389,7 @@ void game_logic_update() news_item_update_current(); RCT2_CALLPROC_EBPSAFE(0x0067009A); // scenario editor opening of windows for a phase - RCT2_CALLPROC_EBPSAFE(0x006BB991); // removes other sounds that are no longer playing, this is normally called somewhere in rct2_init + stop_completed_sounds(); // removes other sounds that are no longer playing, this is normally called somewhere in rct2_init // Update windows window_dispatch_update_all(); diff --git a/src/osinterface.c b/src/osinterface.c index fd6aef4b17..017fa8c551 100644 --- a/src/osinterface.c +++ b/src/osinterface.c @@ -21,9 +21,9 @@ #include #include #include -#include #include #include +#include #include "addresses.h" #include "config.h" @@ -442,6 +442,250 @@ void osinterface_set_fullscreen_mode(int mode){ config_save(); } +/** + * + * rct2: 0x00407978 + */ +int osinterface_407978(rct2_install_info* install_info, char* source, char* font, uint8 charset) +{ + char subkey[MAX_PATH]; + char subkey2[MAX_PATH]; + strcpy(subkey, "Software\\Infogrames\\"); + strcat(subkey, source); + strcpy(subkey2, "Software\\Fish Technology Group\\"); + strcat(subkey2, source); + LOGFONTA lf; + memset(&lf, 0, sizeof(lf)); + lf.lfCharSet = charset; + lf.lfHeight = 12; + lf.lfWeight = 400; + strcpy(lf.lfFaceName, font); + RCT2_GLOBAL(RCT2_ADDRESS_HFONT, HFONT) = CreateFontIndirectA(&lf); + HKEY hkey; + if (RegOpenKeyA(HKEY_LOCAL_MACHINE, subkey, &hkey) != ERROR_SUCCESS && RegOpenKeyA(HKEY_LOCAL_MACHINE, subkey2, &hkey) != ERROR_SUCCESS) { + return 0; + } else { + DWORD type; + DWORD size = 260; + RegQueryValueExA(hkey, "Title", 0, &type, install_info->title, &size); + size = 260; + RegQueryValueExA(hkey, "Path", 0, &type, install_info->path, &size); + install_info->var_20C = 235960; + size = 4; + RegQueryValueExA(hkey, "InstallLevel", 0, &type, (LPBYTE)&install_info->installlevel, &size); + for (int i = 0; i <= 15; i++) { + char name[100]; + sprintf(name, "AddonPack%d", i); + size = sizeof(install_info->addon[i]); + if (RegQueryValueExA(hkey, name, 0, &type, install_info->addon[i], &size) == ERROR_SUCCESS) { + install_info->addons |= (1 << i); + } + } + RegCloseKey(hkey); + return 1; + } +} + +/** + * + * rct2: 0x00407D80 + */ +int osinterface_get_cursor_pos(int* x, int* y) +{ + POINT point; + GetCursorPos(&point); + *x = point.x; + *y = point.y; +} + +/** + * + * rct2: 0x00407E15 + */ +int osinterface_print_window_message(UINT msg, WPARAM wparam, LPARAM lparam) +{ + const char* msgname = "NULL"; + // get the string representation of the msg id, from 190 different values in 0x009A61D8 - 0x009A8873 + // not going to bother reading those since this function is going to be unused and taken out anyways + char temp[1024]; + sprintf(temp, "Message id = %s (%i), wParam = 0x%x, lParam = 0x%x\n", msgname, msg, wparam, lparam); + OutputDebugStringA(temp); + return 1; +} + +/** + * + * rct2: 0x00407E6E + */ +int osinterface_progressbar_create(char* title, int a2) +{ + DWORD style = WS_VISIBLE | WS_BORDER | WS_DLGFRAME; + if (a2) { + style = WS_VISIBLE | WS_BORDER | WS_DLGFRAME | PBS_SMOOTH; + } + int width = 340; + int height = GetSystemMetrics(SM_CYCAPTION) + 24; + HWND hwnd = CreateWindowExA(WS_EX_TOPMOST | WS_EX_DLGMODALFRAME, "msctls_progress32", title, style, (RCT2_GLOBAL(0x01423C08, sint32) - width) / 2, (RCT2_GLOBAL(0x01423C0C, sint32) - height) / 2, width, height, 0, 0, RCT2_GLOBAL(RCT2_ADDRESS_HINSTANCE, HINSTANCE), 0); + RCT2_GLOBAL(RCT2_ADDRESS_PROGRESSBAR_HWND, HWND) = hwnd; + if (hwnd) { + RCT2_GLOBAL(0x009E2DFC, uint32) = 1; + if (RCT2_GLOBAL(RCT2_ADDRESS_HFONT, HFONT)) { + SendMessageA(hwnd, WM_SETFONT, (WPARAM)RCT2_GLOBAL(RCT2_ADDRESS_HFONT, HFONT), 1); + } + SetWindowTextA(hwnd, title); + osinterface_progressbar_setmax(0xFF); + osinterface_progressbar_setpos(0); + return 1; + } else { + return 0; + } +} + +/** + * + * rct2: 0x00407F16 + */ +int osinterface_progressbar_destroy() +{ + if (DestroyWindow(RCT2_GLOBAL(RCT2_ADDRESS_PROGRESSBAR_HWND, HWND))) { + RCT2_GLOBAL(0x009E2DFC, uint32) = 0; + return 1; + } else { + return 0; + } +} + +/** + * + * rct2: 0x00407F2E + */ +void osinterface_progressbar_setmax(int max) +{ + SendMessageA(RCT2_GLOBAL(RCT2_ADDRESS_PROGRESSBAR_HWND, HWND), PBM_SETRANGE, MAKEWPARAM(0, max), 0); + SendMessageA(RCT2_GLOBAL(RCT2_ADDRESS_PROGRESSBAR_HWND, HWND), PBM_SETSTEP, 1, 0); +} + +/** + * + * rct2: 0x00407F60 + */ +void osinterface_progressbar_setpos(int pos) +{ + SendMessageA(RCT2_GLOBAL(RCT2_ADDRESS_PROGRESSBAR_HWND, HWND), PBM_SETPOS, MAKEWPARAM(pos, 0), 0); +} + +/** + * + * rct2: 0x00407F78 + */ +int osinterface_file_seek_from_begin(HANDLE handle, int offset) +{ + return SetFilePointer(handle, offset, 0, FILE_BEGIN); +} + +/** + * + * rct2: 0x00407F8B + */ +int osinterface_file_seek_from_current(HANDLE handle, int offset) +{ + return SetFilePointer(handle, offset, 0, FILE_CURRENT); +} + +/** + * + * rct2: 0x00407F9E + */ +int osinterface_file_seek_from_end(HANDLE handle, int offset) +{ + return SetFilePointer(handle, offset, 0, FILE_END); +} + +/** + * + * rct2: 0x00407FB1 + */ +int osinterface_file_read(HANDLE handle, void* data, int size) +{ + DWORD read; + BOOL result; + if (size == -1) { + DWORD current = SetFilePointer(handle, 0, 0, FILE_CURRENT); + DWORD remaining = SetFilePointer(handle, 0, 0, FILE_END) - current; + result = ReadFile(handle, data, remaining, &read, 0); + } else { + result = ReadFile(handle, data, size, &read, 0); + } + if (result) { + return read; + } else { + return -1; + } +} + +/** + * + * rct2: 0x00408024 + */ +int osinterface_file_write(HANDLE handle, const void* data, int size) +{ + DWORD written; + if (WriteFile(handle, data, size, &written, 0)) { + return written; + } else { + return -1; + } +} + +/** + * + * rct2: 0x0040804A + */ +int osinterface_file_close(HANDLE handle) +{ + if (handle) { + return CloseHandle(handle); + } else { + return 1; + } +} + +/** + * + * rct2: 0x00408060 + */ +HANDLE osinterface_file_open(char* filename) +{ + return CreateFileA(filename, GENERIC_READ, FILE_SHARE_READ, 0, OPEN_EXISTING, FILE_FLAG_RANDOM_ACCESS | FILE_ATTRIBUTE_NORMAL, 0); +} + +/** + * + * rct2: 0x0040807D + */ +HANDLE osinterface_file_create(char* filename) +{ + return CreateFileA(filename, GENERIC_WRITE, FILE_SHARE_READ, 0, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, 0); +} + +/** + * + * rct2: 0x00408099 + */ +int osinterface_file_move(char* srcfilename, char* dstfilename) +{ + return (MoveFileA(srcfilename, dstfilename) != 0) - 1; +} + +/** + * + * rct2: 0x004080AF + */ +int osinterface_file_delete(char* filename) +{ + return (DeleteFileA(filename) != 0) - 1; +} + /** * * rct2: 0x004080EA @@ -597,4 +841,4 @@ int osinterface_ensure_directory_exists(const char *path) char osinterface_get_path_separator() { return '\\'; -} \ No newline at end of file +} diff --git a/src/osinterface.h b/src/osinterface.h index 6d2cade7aa..a9480bb0db 100644 --- a/src/osinterface.h +++ b/src/osinterface.h @@ -21,6 +21,8 @@ #ifndef _SDL_INTERFACE_H_ #define _SDL_INTERFACE_H_ +#include "rct2.h" + enum { CURSOR_UP = 0, CURSOR_DOWN = 1, @@ -66,6 +68,16 @@ typedef struct { int old; } openrct2_cursor; +typedef struct { + uint32 installlevel; + char title[260]; + char path[260]; + uint32 var_20C; + uint8 pad_210[0x100]; + char addon[15][0x80]; + uint32 addons; //0xB10 +} rct2_install_info; + extern openrct2_cursor gCursorState; extern const unsigned char *gKeysState; extern unsigned char *gKeysPressed; @@ -79,6 +91,9 @@ void osinterface_update_palette(char* colours, int start_index, int num_colours) void osinterface_set_fullscreen_mode(int mode); +void osinterface_progressbar_setmax(int max); +void osinterface_progressbar_setpos(int pos); + void osinterface_set_cursor(char cursor); int osinterface_open_common_file_dialog(int type, char *title, char *filename, char *filterPattern, char *filterName); diff --git a/src/peep.c b/src/peep.c index ea85a117e4..447b7c08d1 100644 --- a/src/peep.c +++ b/src/peep.c @@ -330,7 +330,7 @@ void peep_update_crowd_noise() if (visiblePeeps < 0) { // Mute crowd noise if (RCT2_GLOBAL(0x009AF5FC, uint32) != 1) { - RCT2_CALLPROC_1(0x00401A05, int, 2); + sound_channel_stop(2); //RCT2_CALLPROC_1(0x00401A05, int, 2); RCT2_GLOBAL(0x009AF5FC, uint32) = 1; } } else { @@ -345,14 +345,14 @@ void peep_update_crowd_noise() // Check if crowd noise is already playing if (RCT2_GLOBAL(0x009AF5FC, uint32) == 1) { // Load and play crowd noise - if (RCT2_CALLFUNC_3(0x0040194E, int, int, char*, int, 2, (char*)get_file_path(PATH_ID_CSS2), 0)) { - RCT2_CALLPROC_5(0x00401999, int, int, int, int, int, 2, 1, volume, 0, 0); + if (sound_channel_load_file2(2, (char*)get_file_path(PATH_ID_CSS2), 0)) { + sound_channel_play(2, 1, volume, 0, 0); RCT2_GLOBAL(0x009AF5FC, uint32) = volume; } } else { // Alter crowd noise volume if (RCT2_GLOBAL(0x009AF5FC, uint32) != volume) { - RCT2_CALLPROC_2(0x00401AD3, int, int, 2, volume); + sound_channel_set_volume(2, volume);//RCT2_CALLPROC_2(0x00401AD3, int, int, 2, volume); RCT2_GLOBAL(0x009AF5FC, uint32) = volume; } } diff --git a/src/title.c b/src/title.c index adfb25e080..29f7c86774 100644 --- a/src/title.c +++ b/src/title.c @@ -262,7 +262,7 @@ void title_update() if (RCT2_GLOBAL(0x009DEA6E, uint8) == 0) { title_update_showcase(); game_logic_update(); - title_play_music(); + start_title_music();//title_play_music(); } RCT2_GLOBAL(0x009DE518, uint32) &= ~0x80; @@ -304,9 +304,10 @@ void title_update() * * rct2: 0x00678761 */ +// this doesn't seem like it is 0x00678761, supposed to be 0x006BD0F8? static void title_play_music() { - // RCT2_CALLPROC_EBPSAFE(0x006BD0F8); // play title screen music + RCT2_CALLPROC_EBPSAFE(0x006BD0F8); // play title screen music if (!(RCT2_GLOBAL(0x009AF284, uint32) & 1) || !(RCT2_GLOBAL(0x009AF59D, uint8) & 1)) { if (RCT2_GLOBAL(0x009AF600, uint8) != 0) @@ -325,8 +326,8 @@ static void title_play_music() strcat(musicPath, "\\data\\css50.dat"); } - if (RCT2_CALLFUNC_3(0x0040194E, int, int, char*, int, 3, musicPath, 0)) // play music - RCT2_CALLPROC_5(0x00401999, int, int, int, int, int, 3, 1, 0, 0, 0); + if (sound_channel_load_file2(3, musicPath, 0)) // play music + sound_channel_play(3, 1, 0, 0, 0); RCT2_GLOBAL(0x009AF600, uint8) = 1; } diff --git a/src/vehicle.h b/src/vehicle.h index 92ada2f2fd..046d719a34 100644 --- a/src/vehicle.h +++ b/src/vehicle.h @@ -23,6 +23,14 @@ #include "rct2.h" +typedef union { + struct { + uint16 width; + uint16 height; + }; + uint32 both; +} rct_widthheight; + typedef struct { uint8 sprite_identifier; // 0x00 uint8 pad_01[0x03]; @@ -35,8 +43,10 @@ typedef struct { sint16 x; // 0x0E sint16 y; // 0x10 sint16 z; // 0x12 - uint8 pad_14[0x0B]; - uint8 var_1F; + uint8 pad_14[0x02]; + rct_widthheight var_16; + rct_widthheight view; // 0x1A + uint16 var_1E; uint8 pad_20[0x08]; uint32 var_28; uint8 pad_2C[0x04]; @@ -49,10 +59,11 @@ typedef struct { uint8 pad_4A[0x06]; uint8 var_50; uint8 var_51; - uint8 pad_52[0x69]; - uint16 var_BB; - uint16 var_BD; - uint8 pad_BF[0x0D]; + uint8 pad_52[0x2E]; + uint8 var_BB; + uint8 var_BC; + uint8 var_BD; + uint8 pad_BE[0x0E]; uint8 var_CC; uint8 pad_CD[0x09]; uint8 var_D6; diff --git a/src/window.c b/src/window.c index 355d5770bf..4351d90d1a 100644 --- a/src/window.c +++ b/src/window.c @@ -828,6 +828,38 @@ rct_window *window_bring_to_front(rct_window *w) return w; } +/** + * + * rct2: 0x006EE65A + */ +void window_push_others_right(rct_window* window) +{ + + for (rct_window* w = g_window_list; w < RCT2_GLOBAL(RCT2_ADDRESS_NEW_WINDOW_PTR, rct_window*); w++) { + if (w == window) + continue; + if (w->flags & (WF_STICK_TO_BACK | WF_STICK_TO_FRONT)) + continue; + if (w->x >= window->x + window->width) + continue; + if (w->x + w->width <= window->x) + continue; + if (w->y >= window->y + window->height) + continue; + if (w->y + w->height <= window->y) + continue; + + window_invalidate(w); + if (window->x + window->width + 13 >= RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_WIDTH, uint16)) + continue; + uint16 push_amount = window->x + window->width - w->x + 3; + w->x += push_amount; + window_invalidate(w); + if (w->viewport != NULL) + w->viewport->x += push_amount; + } +} + /** * * rct2: 0x006EE6EA @@ -871,6 +903,7 @@ void window_push_others_below(rct_window *w1) } } + /** * * rct2: 0x006EE2E4 @@ -1511,3 +1544,4 @@ void window_align_tabs( rct_window *w, uint8 start_tab_id, uint8 end_tab_id ) } } } + diff --git a/src/window.h b/src/window.h index 1098eba380..86aa034349 100644 --- a/src/window.h +++ b/src/window.h @@ -396,6 +396,7 @@ int window_get_scroll_size(rct_window *w, int scrollIndex, int *width, int *heig rct_window *window_bring_to_front_by_id(rct_windowclass cls, rct_windownumber number); rct_window *window_bring_to_front(rct_window *w); +void window_push_others_right(rct_window *w); void window_push_others_below(rct_window *w1); rct_window *window_get_main(); diff --git a/src/window_footpath.c b/src/window_footpath.c index 451816cb38..01e4db3cb5 100644 --- a/src/window_footpath.c +++ b/src/window_footpath.c @@ -201,7 +201,7 @@ void window_footpath_open() (1 << WIDX_CONSTRUCT_BRIDGE_OR_TUNNEL); window_init_scroll_widgets(window); - RCT2_CALLPROC_EBPSAFE(0x006EE65A); + window_push_others_right(window); show_gridlines(); window->colours[0] = 24; window->colours[1] = 24; @@ -825,4 +825,5 @@ loc_6A78EF: loc_6A79B0: RCT2_CALLPROC_EBPSAFE(0x006A855C); -} \ No newline at end of file +} + diff --git a/src/window_options.c b/src/window_options.c index 926b298c5b..e1bfc20c90 100644 --- a/src/window_options.c +++ b/src/window_options.c @@ -528,7 +528,7 @@ static void window_options_dropdown() case WIDX_MUSIC_DROPDOWN: RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_MUSIC, uint8) = (uint8)dropdownIndex; config_save(); - RCT2_CALLPROC_EBPSAFE(0x006BCA9F); + stop_ride_music();//RCT2_CALLPROC_EBPSAFE(0x006BCA9F); window_invalidate(w); break; case WIDX_SOUND_QUALITY_DROPDOWN: