mirror of https://github.com/OpenRCT2/OpenRCT2.git
Merge remote-tracking branch 'upstream/master' into scenery-window
This commit is contained in:
commit
10c2f10a24
|
@ -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
|
||||
|
|
89
src/audio.c
89
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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
26
src/audio.h
26
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
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -25,7 +25,7 @@ enum GAME_COMMAND {
|
|||
GAME_COMMAND_0,
|
||||
GAME_COMMAND_1,
|
||||
GAME_COMMAND_TOGGLE_PAUSE, // 2
|
||||
GAME_COMMAND_3,
|
||||
GAME_COMMAND_3, //Has something to do with ride construction
|
||||
GAME_COMMAND_4,
|
||||
GAME_COMMAND_LOAD_OR_QUIT, // 5
|
||||
GAME_COMMAND_6,
|
||||
|
|
|
@ -21,9 +21,9 @@
|
|||
#include <stdio.h>
|
||||
#include <shlobj.h>
|
||||
#include <tchar.h>
|
||||
#include <windows.h>
|
||||
#include <SDL.h>
|
||||
#include <SDL_syswm.h>
|
||||
#include <windows.h>
|
||||
|
||||
#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
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
43
src/ride.c
43
src/ride.c
|
@ -20,6 +20,7 @@
|
|||
|
||||
#include <windows.h>
|
||||
#include "addresses.h"
|
||||
#include "game.h"
|
||||
#include "map.h"
|
||||
#include "news_item.h"
|
||||
#include "sprite.h"
|
||||
|
@ -422,6 +423,48 @@ rct_map_element *ride_find_track_gap(rct_map_element *startTrackElement, int *ou
|
|||
return (rct_map_element*)esi;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* rct2: 0x006B4800
|
||||
*/
|
||||
void ride_construct_new(int list_item)
|
||||
{
|
||||
int eax, ebx, ecx, edx, esi, edi, ebp;
|
||||
edx = list_item;
|
||||
eax = 0;
|
||||
ecx = 0;
|
||||
ebx = 1;
|
||||
edi = 0;
|
||||
esi = 0;
|
||||
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TITLE, uint16) = 0x3DC;
|
||||
|
||||
esi = GAME_COMMAND_6;
|
||||
game_do_command_p(esi, &eax, &ebx, &ecx, &edx, &esi, &edi, &ebp);
|
||||
if (ebx == 0x80000000) {
|
||||
return;
|
||||
}
|
||||
|
||||
//Looks like edi became the ride index after the command.
|
||||
eax = edi;
|
||||
rct_window *w;
|
||||
short widgetIndex;
|
||||
|
||||
//TODO: replace with window_ride_main_open(eax)
|
||||
// window_ride_main_open(eax);
|
||||
RCT2_CALLFUNC_X(0x006ACC28, &eax, &ebx, &ecx, &edx, &esi, &edi, &ebp);
|
||||
window_get_register(w);
|
||||
|
||||
ecx = w->classification;
|
||||
edx = 0x13;
|
||||
ebp = (int)w;
|
||||
//TODO: replace with window_ride_main_mouseup() after ride-window_merge
|
||||
// window_ride_main_mouseup();
|
||||
RCT2_CALLFUNC_X(0x006AF17E, &eax, &ebx, &ecx, &edx, &esi, &edi, &ebp);
|
||||
rct_window *ride_window = window_find_by_id(w->classification, w->number); //class here
|
||||
window_close(ride_window);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* rct2: 0x006CC056
|
||||
|
|
|
@ -384,6 +384,7 @@ void ride_update_favourited_stat();
|
|||
void ride_check_all_reachable();
|
||||
rct_map_element *sub_6CAF80(int rideIndex, int *outX, int *outY);
|
||||
rct_map_element *ride_find_track_gap(rct_map_element *startTrackElement, int *outX, int *outY);
|
||||
void ride_construct_new(int list_item);
|
||||
int ride_try_construct(rct_map_element *trackMapElement);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -1039,3 +1039,50 @@ void hide_construction_rights()
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* rct2: 0x006CB70A
|
||||
*/
|
||||
void viewport_set_visibility(uint8 mode)
|
||||
{
|
||||
rct_window* window = window_get_main();
|
||||
|
||||
if(window != NULL) {
|
||||
rct_viewport* edi = window->viewport;
|
||||
uint32 invalidate = 0;
|
||||
|
||||
switch(mode) {
|
||||
case 0: { //Set all these flags to 0, and invalidate if any were active
|
||||
uint16 mask = VIEWPORT_FLAG_UNDERGROUND_INSIDE | VIEWPORT_FLAG_SEETHROUGH_RIDES |
|
||||
VIEWPORT_FLAG_SEETHROUGH_SCENERY | VIEWPORT_FLAG_INVISIBLE_SUPPORTS |
|
||||
VIEWPORT_FLAG_LAND_HEIGHTS | VIEWPORT_FLAG_TRACK_HEIGHTS |
|
||||
VIEWPORT_FLAG_PATH_HEIGHTS | VIEWPORT_FLAG_INVISIBLE_PEEPS |
|
||||
VIEWPORT_FLAG_HIDE_BASE | VIEWPORT_FLAG_HIDE_VERTICAL;
|
||||
|
||||
invalidate += edi->flags & mask;
|
||||
edi->flags &= ~mask;
|
||||
break;
|
||||
}
|
||||
case 1: //6CB79D
|
||||
case 4: //6CB7C4
|
||||
//Set underground on, invalidate if it was off
|
||||
invalidate += !(edi->flags & VIEWPORT_FLAG_UNDERGROUND_INSIDE);
|
||||
edi->flags |= VIEWPORT_FLAG_UNDERGROUND_INSIDE;
|
||||
break;
|
||||
case 2: //6CB7EB
|
||||
//Set track heights on, invalidate if off
|
||||
invalidate += !(edi->flags & VIEWPORT_FLAG_TRACK_HEIGHTS);
|
||||
edi->flags |= VIEWPORT_FLAG_TRACK_HEIGHTS;
|
||||
break;
|
||||
case 3: //6CB7B1
|
||||
case 5: //6CB7D8
|
||||
//Set underground off, invalidate if it was on
|
||||
invalidate += edi->flags & VIEWPORT_FLAG_UNDERGROUND_INSIDE;
|
||||
edi->flags &= ~((uint16)VIEWPORT_FLAG_UNDERGROUND_INSIDE);
|
||||
break;
|
||||
}
|
||||
if (invalidate != 0)
|
||||
window_invalidate(window);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -60,5 +60,6 @@ void show_land_rights();
|
|||
void hide_land_rights();
|
||||
void show_construction_rights();
|
||||
void hide_construction_rights();
|
||||
void viewport_set_visibility(uint8 mode);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -226,7 +226,7 @@ static void window_footpath_close()
|
|||
window_get_register(w);
|
||||
|
||||
RCT2_CALLPROC_EBPSAFE(0x006A7831);
|
||||
RCT2_CALLPROC_X(0x006CB70A, 0, 0, 0, 0, 0, 0, 0);
|
||||
viewport_set_visibility(0);
|
||||
RCT2_CALLPROC_EBPSAFE(0x0068AB1B);
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_FLAGS, uint16) &= ~2;
|
||||
window_invalidate_by_id(WC_TOP_TOOLBAR, 0);
|
||||
|
@ -677,7 +677,7 @@ static int window_footpath_set_provisional_path(int type, int x, int y, int z, i
|
|||
eax = 3;
|
||||
if (RCT2_GLOBAL(0x00F3EFA4, uint8) & 2)
|
||||
eax = 1;
|
||||
RCT2_CALLPROC_X(0x006CB70A, eax, 0, 0, 0, 0, 0, 0);
|
||||
viewport_set_visibility((uint8)eax);
|
||||
}
|
||||
|
||||
return cost;
|
||||
|
|
|
@ -989,5 +989,6 @@ static void window_new_ride_select(rct_window *w)
|
|||
}
|
||||
|
||||
// Show ride construction window
|
||||
RCT2_CALLPROC_X(0x006B4800, *((sint16*)&item), 0, 0, 0, 0, 0, 0);
|
||||
//RCT2_CALLPROC_X(0x006B4800, *((sint16*)&item), 0, 0, 0, 0, 0, 0);
|
||||
ride_construct_new(*((sint16*)&item));
|
||||
}
|
|
@ -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:
|
||||
|
|
Loading…
Reference in New Issue