Merge pull request #501 from zsilencer/master

0x006838BD, 0x006BA8E0
This commit is contained in:
Ted John 2014-10-04 00:53:12 +01:00
commit 2b69e9e914
8 changed files with 223 additions and 66 deletions

View File

@ -52,6 +52,8 @@
#define RCT2_ADDRESS_APP_PATH 0x009AA214
#define RCT2_ADDRESS_DSOUND_GUID 0x009AAC5D
#define RCT2_ADDRESS_CONFIG_SOUND_SW_BUFFER 0x009AAC6E
#define RCT2_ADDRESS_CONFIG_MUSIC 0x009AAC72
@ -166,7 +168,7 @@
#define RCT2_ADDRESS_DSOUND_BUFFERS 0x009E1AB0
#define RCT2_ADDRESS_NUM_DSOUND_DEVICES 0x009E2B88
#define RCT2_ADDRESS_DSOUND_DEVICES 0x009E2B8C
#define RCT2_ADDRESS_SOUND_INFO_LIST_MAPPING 0x009E2B94
#define RCT2_ADDRESS_SOUND_EFFECTS_MAPPING 0x009E2B94
#define RCT2_ADDRESS_SOUNDLIST_BEGIN 0x009E2B98
#define RCT2_ADDRESS_SOUNDLIST_END 0x009E2B9C
#define RCT2_ADDRESS_DIRECTSOUND 0x009E2BA0
@ -217,6 +219,8 @@
#define RCT2_ADDRESS_CONSTRUCT_PATH_FROM_Z 0x00F3EF8E
#define RCT2_ADDRESS_CONSTRUCT_PATH_DIRECTION 0x00F3EF90
#define RCT2_ADDRESS_VOLUME_ADJUST_ZOOM 0x00F438AC
#define RCT2_ADDRESS_STAFF_HIGHLIGHTED_INDEX 0x00F43908
#define RCT2_ADDRESS_CURRENT_MONTH_YEAR 0x00F663A8

View File

@ -98,12 +98,12 @@ int audio_release()
*
* rct2: 0x00404C45
*/
int unmap_sound_info()
int unmap_sound_effects()
{
if (RCT2_GLOBAL(RCT2_ADDRESS_SOUND_INFO_LIST_MAPPING, LPVOID)) {
if (RCT2_GLOBAL(RCT2_ADDRESS_SOUND_EFFECTS_MAPPING, LPVOID)) {
sound_stop_all();
unmap_file(RCT2_GLOBAL(RCT2_ADDRESS_SOUND_INFO_LIST_MAPPING, LPVOID));
RCT2_GLOBAL(RCT2_ADDRESS_SOUND_INFO_LIST_MAPPING, LPVOID) = 0;
unmap_file(RCT2_GLOBAL(RCT2_ADDRESS_SOUND_EFFECTS_MAPPING, LPVOID));
RCT2_GLOBAL(RCT2_ADDRESS_SOUND_EFFECTS_MAPPING, LPVOID) = 0;
return 1;
}
return 0;
@ -173,7 +173,7 @@ void audio_close()
RCT2_GLOBAL(0x014241BC, uint32) = 0;
}
RCT2_GLOBAL(0x014241BC, uint32) = 1;
unmap_sound_info();
unmap_sound_effects();
audio_release();
RCT2_GLOBAL(0x014241BC, uint32) = 0;
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_SOUND_DEVICE, uint32) = -1;
@ -345,13 +345,13 @@ LPVOID map_file(LPCSTR lpFileName, DWORD dwCreationDisposition, DWORD dwNumberOf
*
* rct2: 0x00404C1A
*/
int map_sound_info(const char* filename)
int map_sound_effects(const char* filename)
{
if (RCT2_GLOBAL(RCT2_ADDRESS_SOUND_INFO_LIST_MAPPING, LPVOID)) {
if (RCT2_GLOBAL(RCT2_ADDRESS_SOUND_EFFECTS_MAPPING, LPVOID)) {
return 0;
} else {
RCT2_GLOBAL(RCT2_ADDRESS_SOUND_INFO_LIST_MAPPING, LPVOID) = map_file(filename, 0, 0);
return RCT2_GLOBAL(RCT2_ADDRESS_SOUND_INFO_LIST_MAPPING, LPVOID) != 0;
RCT2_GLOBAL(RCT2_ADDRESS_SOUND_EFFECTS_MAPPING, LPVOID) = map_file(filename, 0, 0);
return RCT2_GLOBAL(RCT2_ADDRESS_SOUND_EFFECTS_MAPPING, LPVOID) != 0;
}
}
@ -892,6 +892,48 @@ int audio_create_timer()
return 1;
}
/**
*
* rct2: 0x006BA8E0
*/
void audio_init1()
{
int devicenum = 0;
if (RCT2_GLOBAL(0x009AAC5C, uint8)) {
rct_dsdevice* dsdevice = &RCT2_GLOBAL(RCT2_ADDRESS_DSOUND_DEVICES, rct_dsdevice*)[0];
while (dsdevice->guid.Data1 != RCT2_GLOBAL(RCT2_ADDRESS_DSOUND_GUID, GUID).Data1 ||
dsdevice->guid.Data2 != RCT2_GLOBAL(RCT2_ADDRESS_DSOUND_GUID, GUID).Data2 ||
dsdevice->guid.Data3 != RCT2_GLOBAL(RCT2_ADDRESS_DSOUND_GUID, GUID).Data3 ||
memcmp(dsdevice->guid.Data4, RCT2_GLOBAL(RCT2_ADDRESS_DSOUND_GUID, GUID).Data4, sizeof(dsdevice->guid.Data4)) != 0) {
dsdevice++;
devicenum++;
if (devicenum >= RCT2_GLOBAL(RCT2_ADDRESS_NUM_DSOUND_DEVICES, int)) {
devicenum = 0;
break;
}
}
}
audio_init2(devicenum);
int m = 0;
do {
rct_music_info3* music_info3 = &RCT2_GLOBAL(0x009AF1C8, rct_music_info3*)[m];
const char* path = get_file_path(music_info3->pathid);
RCT2_GLOBAL(0x014241BC, uint32) = 3;
HANDLE hfile = osinterface_file_open(path);
RCT2_GLOBAL(0x014241BC, uint32) = 0;
if (hfile != INVALID_HANDLE_VALUE) {
RCT2_GLOBAL(0x014241BC, uint32) = 3;
osinterface_file_read(hfile, &RCT2_GLOBAL(0x009AF47E, uint32), 4);
osinterface_file_close(hfile);
RCT2_GLOBAL(0x014241BC, uint32) = 0;
if (RCT2_GLOBAL(0x009AF47E, uint32) == 0x78787878) {
music_info3->var_0 = 0;
}
}
m++;
} while(m + 1 < 0x2E);
}
/**
*
* rct2: 0x006BA9B5
@ -915,7 +957,7 @@ void audio_init2(int device)
}
const char * filepath = get_file_path(2);
RCT2_GLOBAL(0x014241BC, uint32) = 1;
int successmap = map_sound_info(filepath);
int successmap = map_sound_effects(filepath);
RCT2_GLOBAL(0x014241BC, uint32) = 0;
if (!successmap) {
RCT2_GLOBAL(0x014241BC, uint32) = 1;
@ -925,20 +967,17 @@ void audio_init2(int device)
}
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_SOUND_DEVICE, uint32) = device;
rct_dsdevice dsdevice = RCT2_GLOBAL(RCT2_ADDRESS_DSOUND_DEVICES, rct_dsdevice*)[device];
RCT2_GLOBAL(0x009AAC5D, uint32) = dsdevice.guid.Data1;
RCT2_GLOBAL(0x009AAC61, uint32) = dsdevice.guid.Data2;
RCT2_GLOBAL(0x009AAC65, uint32) = dsdevice.guid.Data3;
RCT2_GLOBAL(0x009AAC69, uint32) = (uint32)dsdevice.guid.Data4;
RCT2_GLOBAL(RCT2_ADDRESS_DSOUND_GUID, GUID) = dsdevice.guid;
RCT2_GLOBAL(0x009AAC5C, uint8) = 1;
config_save();
RCT2_GLOBAL(0x014241BC, uint32) = 1;
int successtimer = audio_create_timer();
RCT2_GLOBAL(0x014241BC, uint32) = 0;
if (successtimer) {
if ((RCT2_GLOBAL(0x009AF284, uint32) & (1 << 0))) {
for (int i = 0; i < 2; i++) {
RCT2_GLOBAL(0x009AF46C + (i * 8), uint8) = -1;
}
RCT2_GLOBAL(0x009AF284, uint32) |= (1 << 0);
for (int i = 0; i < 2; i++) {
rct_music_info2* music_info2 = &RCT2_ADDRESS(0x009AF46C, rct_music_info2)[i];
music_info2->id = -1;
}
}
if (!(RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_FLAGS, uint8) & 1 << 4)) {
@ -1047,10 +1086,10 @@ rct_sound* sound_next(rct_sound* sound)
*
* rct2: 0x00405206
*/
rct_sound_info* sound_get_info(uint16 sound_id)
rct_sound_effect* sound_get_effect(uint16 sound_id)
{
if (RCT2_GLOBAL(RCT2_ADDRESS_SOUND_INFO_LIST_MAPPING, LPVOID) && sound_id < RCT2_GLOBAL(RCT2_ADDRESS_SOUND_INFO_LIST_MAPPING, uint32*)[0]) {
return (rct_sound_info*)(RCT2_GLOBAL(RCT2_ADDRESS_SOUND_INFO_LIST_MAPPING, int) + RCT2_GLOBAL(RCT2_ADDRESS_SOUND_INFO_LIST_MAPPING, uint32*)[sound_id + 1]);
if (RCT2_GLOBAL(RCT2_ADDRESS_SOUND_EFFECTS_MAPPING, LPVOID) && sound_id < RCT2_GLOBAL(RCT2_ADDRESS_SOUND_EFFECTS_MAPPING, uint32*)[0]) {
return (rct_sound_effect*)(RCT2_GLOBAL(RCT2_ADDRESS_SOUND_EFFECTS_MAPPING, int) + RCT2_GLOBAL(RCT2_ADDRESS_SOUND_EFFECTS_MAPPING, uint32*)[sound_id + 1]);
}
return 0;
}
@ -1059,11 +1098,11 @@ rct_sound_info* sound_get_info(uint16 sound_id)
*
* rct2: 0x00405054
*/
int sound_info_loadvars(rct_sound_info* sound_info, LPWAVEFORMATEX* waveformat, char** data, DWORD* buffersize)
int sound_effect_loadvars(rct_sound_effect* sound_effect, LPWAVEFORMATEX* waveformat, char** data, DWORD* buffersize)
{
*buffersize = sound_info->size;
*waveformat = &sound_info->format;
*data = (char*)&sound_info->data;
*buffersize = sound_effect->size;
*waveformat = &sound_effect->format;
*data = (char*)&sound_effect->data;
return 1;
}
@ -1112,9 +1151,9 @@ int sound_prepare(int sound_id, rct_sound *sound, int channels, int software)
return 1;
}
}
rct_sound_info* sound_info = sound_get_info(sound_id);
if (sound_info) {
if (sound_info_loadvars(sound_info, &bufferdesc.lpwfxFormat, &buffer, &bufferdesc.dwBufferBytes)) {
rct_sound_effect* sound_effect = sound_get_effect(sound_id);
if (sound_effect) {
if (sound_effect_loadvars(sound_effect, &bufferdesc.lpwfxFormat, &buffer, &bufferdesc.dwBufferBytes)) {
bufferdesc.dwFlags = DSBCAPS_GETCURRENTPOSITION2 | DSBCAPS_STATIC;
if (channels) {
if (channels == 2) {
@ -1631,12 +1670,12 @@ void stop_ride_music()
{
if ((RCT2_GLOBAL(0x009AF284, uint32) & (1 << 0))) {
for (int i = 0; i < 2; i++) {
uint8 * data = RCT2_ADDRESS(0x009AF46C + (i * 8), uint8);
if (data[0] != 0xFF) {
rct_music_info2* music_info2 = &RCT2_ADDRESS(0x009AF46C, rct_music_info2)[i];
if (music_info2->id != (uint8)-1) {
RCT2_GLOBAL(0x014241BC, uint32) = 1;
sound_channel_stop(i);
RCT2_GLOBAL(0x014241BC, uint32) = 0;
data[0] = 0xFF;
music_info2->id = -1;
}
}
}

View File

@ -34,6 +34,7 @@ extern audio_device *gAudioDevices;
void audio_init();
void audio_quit();
void audio_get_devices();
void audio_init1();
void audio_init2(int device);
#include <dsound.h>
@ -84,8 +85,8 @@ typedef struct {
typedef struct {
uint32 size;
WAVEFORMATEX format;
char* data;
} rct_sound_info;
uint8* data;
} rct_sound_effect;
typedef struct {
uint16 id;
@ -155,7 +156,7 @@ void sub_6BC6D8();
int audio_remove_timer();
void audio_close();
LPVOID map_file(LPCSTR lpFileName, DWORD dwCreationDisposition, DWORD dwNumberOfBytesToMap);
int unmap_sound_info();
int unmap_sound_effects();
int sound_prepare(int sound_id, rct_sound *sound, int channels, int software);
int sound_play_panned(int sound_id, int ebx, sint16 x, sint16 y, sint16 z);
int sound_play(rct_sound* sound, int looping, int volume, int pan, int frequency);

View File

@ -140,12 +140,126 @@ void game_create_windows()
}
/**
*
* rct2: 0x006838BD
*/
void update_water_animation()
*
* rct2: 0x006838BD
*/
void update_palette_effects()
{
RCT2_CALLPROC_EBPSAFE(0x006838BD);
if (RCT2_GLOBAL(RCT2_ADDRESS_LIGHTNING_ACTIVE, uint8) == 1) {
// change palette to lighter color during lightning
int palette = 1532;
if (RCT2_GLOBAL(0x009ADAE0, sint32) != -1) {
palette = RCT2_GLOBAL(RCT2_GLOBAL(0x009ADAE0, int) + 2, int);
}
rct_g1_element g1_element = RCT2_ADDRESS(RCT2_ADDRESS_G1_ELEMENTS, rct_g1_element)[palette];
int xoffset = g1_element.x_offset;
xoffset = xoffset * 4;
for (int i = 0; i < g1_element.width; i++) {
RCT2_ADDRESS(0x01424680 + xoffset, uint8)[(i * 4) + 0] = -((0xFF - g1_element.offset[(i * 3) + 0]) / 2) - 1;
RCT2_ADDRESS(0x01424680 + xoffset, uint8)[(i * 4) + 1] = -((0xFF - g1_element.offset[(i * 3) + 1]) / 2) - 1;
RCT2_ADDRESS(0x01424680 + xoffset, uint8)[(i * 4) + 2] = -((0xFF - g1_element.offset[(i * 3) + 2]) / 2) - 1;
}
RCT2_GLOBAL(0x014241BC, uint32) = 2;
osinterface_update_palette(RCT2_ADDRESS(0x01424680, uint8), 10, 236);
RCT2_GLOBAL(0x014241BC, uint32) = 0;
RCT2_GLOBAL(RCT2_ADDRESS_LIGHTNING_ACTIVE, uint8)++;
} else {
if (RCT2_GLOBAL(RCT2_ADDRESS_LIGHTNING_ACTIVE, uint8) == 2) {
// change palette back to normal after lightning
int palette = 1532;
if (RCT2_GLOBAL(0x009ADAE0, sint32) != -1) {
palette = RCT2_GLOBAL(RCT2_GLOBAL(0x009ADAE0, int) + 2, int);
}
rct_g1_element g1_element = RCT2_ADDRESS(RCT2_ADDRESS_G1_ELEMENTS, rct_g1_element)[palette];
int xoffset = g1_element.x_offset;
xoffset = xoffset * 4;
for (int i = 0; i < g1_element.width; i++) {
RCT2_ADDRESS(0x01424680 + xoffset, uint8)[(i * 4) + 0] = g1_element.offset[(i * 3) + 0];
RCT2_ADDRESS(0x01424680 + xoffset, uint8)[(i * 4) + 1] = g1_element.offset[(i * 3) + 1];
RCT2_ADDRESS(0x01424680 + xoffset, uint8)[(i * 4) + 2] = g1_element.offset[(i * 3) + 2];
}
}
// animate the water/lava/chain movement palette
int q = 0;
int weather_colour = RCT2_ADDRESS(0x98195C, uint32)[RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_WEATHER_GLOOM, uint8)];
if (weather_colour != -1) {
q = 1;
if (weather_colour != 0x2000031) {
q = 2;
}
}
uint32 j = RCT2_GLOBAL(0x009DE584, uint32);
j = (((uint16)((~j / 2) * 128) * 15) >> 16);
int p = 1533;
if (RCT2_GLOBAL(0x009ADAE0, int) != -1) {
p = RCT2_GLOBAL(RCT2_GLOBAL(0x009ADAE0, int) + 0x6, int);
}
rct_g1_element g1_element = RCT2_ADDRESS(RCT2_ADDRESS_G1_ELEMENTS, rct_g1_element)[q + p];
uint8* vs = &g1_element.offset[j * 3];
uint8* vd = RCT2_ADDRESS(0x01424A18, uint8);
int n = 5;
for (int i = 0; i < n; i++) {
vd[0] = vs[0];
vd[1] = vs[1];
vd[2] = vs[2];
vs += 9;
if (vs >= &g1_element.offset[9 * n]) {
vs -= 9 * n;
}
vd += 4;
}
p = 1536;
if (RCT2_GLOBAL(0x009ADAE0, int) != -1) {
p = RCT2_GLOBAL(RCT2_GLOBAL(0x009ADAE0, int) + 0xA, int);
}
g1_element = RCT2_ADDRESS(RCT2_ADDRESS_G1_ELEMENTS, rct_g1_element)[q + p];
vs = &g1_element.offset[j * 3];
n = 5;
for (int i = 0; i < n; i++) {
vd[0] = vs[0];
vd[1] = vs[1];
vd[2] = vs[2];
vs += 9;
if (vs >= &g1_element.offset[9 * n]) {
vs -= 9 * n;
}
vd += 4;
}
j = ((uint16)(RCT2_GLOBAL(0x009DE584, uint32) * -960) * 3) >> 16;
p = 1539;
g1_element = RCT2_ADDRESS(RCT2_ADDRESS_G1_ELEMENTS, rct_g1_element)[q + p];
vs = &g1_element.offset[j * 3];
vd += 12;
n = 3;
for (int i = 0; i < n; i++) {
vd[0] = vs[0];
vd[1] = vs[1];
vd[2] = vs[2];
vs += 3;
if (vs >= &g1_element.offset[3 * n]) {
vs -= 3 * n;
}
vd += 4;
}
RCT2_GLOBAL(0x014241BC, uint32) = 2;
osinterface_update_palette(RCT2_ADDRESS(0x01424680, uint8), 230, 16);
RCT2_GLOBAL(0x014241BC, uint32) = 0;
if (RCT2_GLOBAL(RCT2_ADDRESS_LIGHTNING_ACTIVE, uint8) == 2) {
RCT2_GLOBAL(0x014241BC, uint32) = 2;
osinterface_update_palette(RCT2_ADDRESS(0x01424680, uint8), 10, 236);
RCT2_GLOBAL(0x014241BC, uint32) = 0;
RCT2_GLOBAL(RCT2_ADDRESS_LIGHTNING_ACTIVE, uint8) = 0;
}
}
if (RCT2_GLOBAL(0x009E2C4C, uint32) == 2 || RCT2_GLOBAL(0x009E2C4C, uint32) == 1) {
if (RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_CAP_BPP, uint32) != 8) {
RCT2_GLOBAL(0x009E2C78, int) = 1;
}
}
}
/**
@ -350,7 +464,7 @@ void game_update()
RCT2_GLOBAL(0x0141F568, uint8) = RCT2_GLOBAL(0x0013CA740, uint8);
game_handle_input();
update_water_animation();
update_palette_effects();
update_rain_animation();
if (RCT2_GLOBAL(0x009AAC73, uint8) != 255) {

View File

@ -91,7 +91,7 @@ void game_update();
void game_logic_update();
void sub_0x0069E9A7();
void update_rain_animation();
void update_water_animation();
void update_palette_effects();
int game_do_command(int eax, int ebx, int ecx, int edx, int esi, int edi, int ebp);
int game_do_command_p(int command, int *eax, int *ebx, int *ecx, int *edx, int *edi, int *esi, int *ebp);

View File

@ -170,7 +170,7 @@ void rct2_init()
gfx_load_character_widths();
osinterface_init();
RCT2_CALLPROC_EBPSAFE(0x006BA8E0); // init_audio();
audio_init1();//RCT2_CALLPROC_EBPSAFE(0x006BA8E0); // init_audio();
viewport_init_all();
news_item_init_queue();
get_local_time();

View File

@ -290,7 +290,7 @@ void title_update()
// RCT2_CALLPROC_EBPSAFE(0x006EA627); // window_manager_handle_input();
game_handle_input();
update_water_animation();
update_palette_effects();
update_rain_animation();
if (RCT2_GLOBAL(0x009AAC73, uint8) != 255) {

View File

@ -159,7 +159,6 @@ int sub_6BC2F3(rct_vehicle* vehicle)
*/
void vehicle_sounds_update()
{
uint16 result;
if (RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_SOUND_DEVICE, uint32) != -1 && !RCT2_GLOBAL(0x009AF59C, uint8) && RCT2_GLOBAL(0x009AF59D, uint8) & 1) {
RCT2_GLOBAL(0x00F438A4, rct_viewport*) = (rct_viewport*)-1;
rct_window* window = RCT2_GLOBAL(RCT2_ADDRESS_NEW_WINDOW_PTR, rct_window*);
@ -174,11 +173,11 @@ void vehicle_sounds_update()
if (viewport != (rct_viewport*)-1) {
if (window) {
RCT2_GLOBAL(0x00F438A8, rct_window*) = window;
RCT2_GLOBAL(0x00F438AC, uint8) = 0;
RCT2_GLOBAL(RCT2_ADDRESS_VOLUME_ADJUST_ZOOM, uint8) = 0;
if (viewport->zoom) {
RCT2_GLOBAL(0x00F438AC, uint8) = 35;
RCT2_GLOBAL(RCT2_ADDRESS_VOLUME_ADJUST_ZOOM, uint8) = 35;
if (viewport->zoom != 1) {
RCT2_GLOBAL(0x00F438AC, uint8) = 70;
RCT2_GLOBAL(RCT2_ADDRESS_VOLUME_ADJUST_ZOOM, uint8) = 70;
}
}
}
@ -216,7 +215,8 @@ void vehicle_sounds_update()
if (sound_unknown >= RCT2_GLOBAL(0x00F438B0, rct_sound_unknown*)) {
return;
}
result = (uint16)-1;
uint8 vol1 = 0xFF;
uint8 vol2 = 0xFF;
sint16 v = sound_unknown->var_4;
if (v < 0) {
v = -v;
@ -229,11 +229,11 @@ void vehicle_sounds_update()
v -= 0x400;
v = -v;
v = (uint16)v / 4;
result = MAKEWORD(LOBYTE(v), HIBYTE(result));
vol1 = LOBYTE(v);
if (HIBYTE(v) != 0) {
result = MAKEWORD(0xFF, HIBYTE(result));
vol1 = 0xFF;
if (HIBYTE(v) < 0) {
result = MAKEWORD(0, HIBYTE(result));
vol1 = 0;
}
}
}
@ -250,22 +250,22 @@ void vehicle_sounds_update()
w -= 0x400;
w = -w;
w = (uint16)w / 4;
result = MAKEWORD(LOBYTE(result), LOBYTE(w));
vol2 = LOBYTE(w);
if (HIBYTE(w) != 0) {
result = MAKEWORD(LOBYTE(result), 0xFF);
vol2 = 0xFF;
if (HIBYTE(w) < 0) {
result = MAKEWORD(LOBYTE(result), 0);
vol2 = 0;
}
}
}
if (LOBYTE(result) >= HIBYTE(result)) {
result = MAKEWORD(HIBYTE(result), HIBYTE(result));
if (vol1 >= vol2) {
vol1 = vol2;
}
if (LOBYTE(result) < RCT2_GLOBAL(0x00F438AC, uint8)) {
result = MAKEWORD(0, HIBYTE(result));
if (vol1 < RCT2_GLOBAL(RCT2_ADDRESS_VOLUME_ADJUST_ZOOM, uint8)) {
vol1 = 0;
} else {
result = MAKEWORD(LOBYTE(result) - RCT2_GLOBAL(0x00F438AC, uint8), HIBYTE(result));
vol1 = vol1 - RCT2_GLOBAL(RCT2_ADDRESS_VOLUME_ADJUST_ZOOM, uint8);
}
rct_vehicle_sound* vehicle_sound = &RCT2_GLOBAL(RCT2_ADDRESS_VEHICLE_SOUND_LIST, rct_vehicle_sound);
@ -300,16 +300,15 @@ void vehicle_sounds_update()
}
}
vehicle_sound->var_2 = v22;
if (LOBYTE(result) < v22) {
result = MAKEWORD(0, HIBYTE(result));
if (vol1 < v22) {
vol1 = 0;
} else {
result = MAKEWORD(LOBYTE(result) - v22, HIBYTE(result));
vol1 = vol1 - v22;
}
// do sound1 stuff, track noise
RCT2_ADDRESS_SPRITE_LIST;
rct_sprite* sprite = &g_sprite_list[sound_unknown->id];
sint16 volume = sprite->vehicle.var_BC;
volume *= LOBYTE(result);
volume *= vol1;
volume = (uint16)volume / 8;
volume -= 0x1FFF;
if (volume < -10000) {
@ -380,7 +379,7 @@ void vehicle_sounds_update()
label87: // do sound2 stuff, screams
sprite = &g_sprite_list[sound_unknown->id];
volume = sprite->vehicle.var_BE;
volume *= LOBYTE(result);
volume *= vol1;
volume = (uint16)volume / 8;
volume -= 0x1FFF;
if (volume < -10000) {