forked from rosebudai/OpenRCT2-Web
Merge pull request #2325 from BodrickLight/refactor
Refactor audio.c and audio.h
This commit is contained in:
commit
e36ed5e732
39 files changed
+556
-494
No files matched your search
+216
-232
@@ -32,25 +32,37 @@
|
||||
#include "../openrct2.h"
|
||||
#include "../util/util.h"
|
||||
|
||||
int gAudioDeviceCount;
|
||||
typedef struct rct_audio_params {
|
||||
bool in_range;
|
||||
int volume;
|
||||
int pan;
|
||||
} rct_audio_params;
|
||||
|
||||
audio_device *gAudioDevices = NULL;
|
||||
int gAudioDeviceCount;
|
||||
void *gCrowdSoundChannel = 0;
|
||||
bool gGameSoundsOff = false;
|
||||
void *gRainSoundChannel = 0;
|
||||
rct_ride_music gRideMusicList[AUDIO_MAX_RIDE_MUSIC];
|
||||
rct_ride_music_info *gRideMusicInfoList[NUM_DEFAULT_MUSIC_TRACKS];
|
||||
rct_ride_music_params gRideMusicParamsList[AUDIO_MAX_RIDE_MUSIC];
|
||||
rct_ride_music_params *gRideMusicParamsListEnd;
|
||||
void *gTitleMusicChannel = 0;
|
||||
rct_vehicle_sound gVehicleSoundList[AUDIO_MAX_VEHICLE_SOUNDS];
|
||||
rct_vehicle_sound_params gVehicleSoundParamsList[AUDIO_MAX_VEHICLE_SOUNDS];
|
||||
rct_vehicle_sound_params *gVehicleSoundParamsListEnd;
|
||||
rct_ride_music gRideMusicList[AUDIO_MAX_RIDE_MUSIC];
|
||||
rct_ride_music_params gRideMusicParamsList[AUDIO_MAX_RIDE_MUSIC];
|
||||
rct_ride_music_params *gRideMusicParamsListEnd;
|
||||
void *gCrowdSoundChannel = 0;
|
||||
void *gTitleMusicChannel = 0;
|
||||
void *gRainSoundChannel = 0;
|
||||
bool gGameSoundsOff = false;
|
||||
|
||||
void audio_init(int i)
|
||||
rct_audio_params audio_get_params_from_location(int soundId, const rct_xyz16 *location);
|
||||
void audio_stop_channel(void **channel);
|
||||
|
||||
void audio_init()
|
||||
{
|
||||
if (SDL_Init(SDL_INIT_AUDIO) < 0) {
|
||||
log_fatal("SDL_Init %s", SDL_GetError());
|
||||
exit(-1);
|
||||
}
|
||||
int result = SDL_Init(SDL_INIT_AUDIO);
|
||||
if (result >= 0)
|
||||
return;
|
||||
|
||||
log_fatal("SDL_Init %s", SDL_GetError());
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
void audio_quit()
|
||||
@@ -58,298 +70,270 @@ void audio_quit()
|
||||
SDL_QuitSubSystem(SDL_INIT_AUDIO);
|
||||
}
|
||||
|
||||
/**
|
||||
* Populates audio devices.
|
||||
*/
|
||||
void audio_get_devices()
|
||||
void audio_populate_devices()
|
||||
{
|
||||
int i;
|
||||
|
||||
if (gAudioDevices != NULL)
|
||||
free(gAudioDevices);
|
||||
|
||||
gAudioDeviceCount = SDL_GetNumAudioDevices(SDL_FALSE);
|
||||
if (gAudioDeviceCount > 0) {
|
||||
gAudioDeviceCount++;
|
||||
gAudioDevices = malloc(gAudioDeviceCount * sizeof(audio_device));
|
||||
if (gAudioDeviceCount <= 0)
|
||||
return;
|
||||
|
||||
safe_strncpy(gAudioDevices[0].name, language_get_string(5510), AUDIO_DEVICE_NAME_SIZE);
|
||||
for (i = 1; i < gAudioDeviceCount; i++) {
|
||||
const char *utf8_name = SDL_GetAudioDeviceName(i - 1, SDL_FALSE);
|
||||
if (utf8_name == NULL)
|
||||
utf8_name = language_get_string(5511);
|
||||
gAudioDeviceCount++;
|
||||
gAudioDevices = malloc(gAudioDeviceCount * sizeof(audio_device));
|
||||
safe_strncpy(gAudioDevices[0].name, language_get_string(5510), AUDIO_DEVICE_NAME_SIZE);
|
||||
|
||||
safe_strncpy(gAudioDevices[i].name, utf8_name, AUDIO_DEVICE_NAME_SIZE);
|
||||
}
|
||||
for (int i = 1; i < gAudioDeviceCount; i++) {
|
||||
const char *utf8Name = SDL_GetAudioDeviceName(i - 1, SDL_FALSE);
|
||||
if (utf8Name == NULL)
|
||||
utf8Name = language_get_string(5511);
|
||||
|
||||
safe_strncpy(gAudioDevices[i].name, utf8Name, AUDIO_DEVICE_NAME_SIZE);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* rct2: 0x006BB76E
|
||||
*
|
||||
* @param sound_id (eax)
|
||||
* @param ebx (ebx)
|
||||
* @param x (cx)
|
||||
* @param y (dx)
|
||||
* @param z (bp)
|
||||
*/
|
||||
int sound_play_panned(int sound_id, int ebx, sint16 x, sint16 y, sint16 z)
|
||||
int audio_play_sound_panned(int soundId, int pan, sint16 x, sint16 y, sint16 z)
|
||||
{
|
||||
if (!gGameSoundsOff) {
|
||||
int volumedown = 0;
|
||||
int volume = 0;
|
||||
if (ebx == 0x8001) {
|
||||
rct_map_element* mapelement = map_get_surface_element_at(x / 32, y / 32);
|
||||
if (mapelement) {
|
||||
if ((mapelement->base_height * 8) - 5 > z) {
|
||||
volumedown = 10;
|
||||
}
|
||||
}
|
||||
sint16 rx;
|
||||
sint16 ry;
|
||||
switch (get_current_rotation()) {
|
||||
case 0:
|
||||
rx = y - x;
|
||||
ry = ((y + x) / 2) - z;
|
||||
break;
|
||||
case 1:
|
||||
rx = -x - y;
|
||||
ry = ((y - x) / 2) - z;
|
||||
break;
|
||||
case 2:
|
||||
rx = x - y;
|
||||
ry = ((-y - x) / 2) - z;
|
||||
break;
|
||||
case 3:
|
||||
rx = y + x;
|
||||
ry = ((x - y) / 2) - z;
|
||||
break;
|
||||
}
|
||||
rct_window* window = RCT2_GLOBAL(RCT2_ADDRESS_NEW_WINDOW_PTR, rct_window*);
|
||||
while (1) {
|
||||
window--;
|
||||
if (window < RCT2_ADDRESS(RCT2_ADDRESS_WINDOW_LIST, rct_window)) {
|
||||
break;
|
||||
}
|
||||
rct_viewport* viewport = window->viewport;
|
||||
if (viewport && viewport->flags & VIEWPORT_FLAG_SOUND_ON) {
|
||||
sint16 vy = ry - viewport->view_y;
|
||||
sint16 vx = rx - viewport->view_x;
|
||||
ebx = viewport->x + (vx >> viewport->zoom);
|
||||
volume = RCT2_ADDRESS(0x0099282C, int)[sound_id] + ((-1024 * viewport->zoom - 1) << volumedown) + 1;
|
||||
if (vy < 0 || vy >= viewport->view_height || vx < 0 || vx >= viewport->view_width || volume < -10000) {
|
||||
return sound_id;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (pan == AUDIO_PLAY_AT_LOCATION)
|
||||
return audio_play_sound_at_location(soundId, x, y, z);
|
||||
|
||||
return audio_play_sound(soundId, 0, pan);
|
||||
}
|
||||
|
||||
int audio_play_sound_at_location(int soundId, sint16 x, sint16 y, sint16 z)
|
||||
{
|
||||
if (gGameSoundsOff)
|
||||
return 0;
|
||||
|
||||
rct_xyz16 location;
|
||||
location.x = x;
|
||||
location.y = y;
|
||||
location.z = z;
|
||||
|
||||
rct_audio_params params = audio_get_params_from_location(soundId, &location);
|
||||
if (!params.in_range)
|
||||
return soundId;
|
||||
|
||||
return audio_play_sound(soundId, params.volume, params.pan);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the audio parameters to use when playing the specified sound at a virtual location.
|
||||
* @param soundId The sound effect to be played.
|
||||
* @param location The location at which the sound effect is to be played.
|
||||
* @return The audio parameters to be used when playing this sound effect.
|
||||
*/
|
||||
rct_audio_params audio_get_params_from_location(int soundId, const rct_xyz16 *location)
|
||||
{
|
||||
int volumeDown = 0;
|
||||
rct_audio_params params;
|
||||
params.in_range = true;
|
||||
|
||||
rct_map_element *element = map_get_surface_element_at(location->x / 32, location->y / 32);
|
||||
if (element && (element->base_height * 8) - 5 > location->z)
|
||||
volumeDown = 10;
|
||||
|
||||
uint8 rotation = get_current_rotation();
|
||||
rct_xy16 pos2 = coordinate_3d_to_2d(location, rotation);
|
||||
rct_window *window = RCT2_GLOBAL(RCT2_ADDRESS_NEW_WINDOW_PTR, rct_window*);
|
||||
while (true) {
|
||||
window--;
|
||||
if (window < RCT2_ADDRESS(RCT2_ADDRESS_WINDOW_LIST, rct_window))
|
||||
break;
|
||||
|
||||
rct_viewport *viewport = window->viewport;
|
||||
if (!viewport || !(viewport->flags & VIEWPORT_FLAG_SOUND_ON))
|
||||
continue;
|
||||
|
||||
sint16 vy = pos2.y - viewport->view_y;
|
||||
sint16 vx = pos2.x - viewport->view_x;
|
||||
params.pan = viewport->x + (vx >> viewport->zoom);
|
||||
params.volume = RCT2_ADDRESS(0x0099282C, int)[soundId] + ((-1024 * viewport->zoom - 1) << volumeDown) + 1;
|
||||
|
||||
if (vy < 0 || vy >= viewport->view_height || vx < 0 || vx >= viewport->view_width || params.volume < -10000) {
|
||||
params.in_range = false;
|
||||
return params;
|
||||
}
|
||||
int pan;
|
||||
if (ebx == (sint16)0x8000) {
|
||||
pan = 0;
|
||||
} else {
|
||||
int x2 = ebx << 16;
|
||||
uint16 screenwidth = RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_WIDTH, uint16);
|
||||
if (screenwidth < 64) {
|
||||
screenwidth = 64;
|
||||
}
|
||||
pan = ((x2 / screenwidth) - 0x8000) >> 4;
|
||||
}
|
||||
Mixer_Play_Effect(sound_id, MIXER_LOOP_NONE, DStoMixerVolume(volume), DStoMixerPan(pan), 1, 1);
|
||||
}
|
||||
|
||||
return params;
|
||||
}
|
||||
|
||||
int audio_play_sound(int soundId, int volume, int pan)
|
||||
{
|
||||
if (gGameSoundsOff)
|
||||
return 0;
|
||||
|
||||
int mixerPan = 0;
|
||||
if (pan != AUDIO_PLAY_AT_CENTRE) {
|
||||
int x2 = pan << 16;
|
||||
uint16 screenWidth = max(64, RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_WIDTH, uint16));
|
||||
mixerPan = ((x2 / screenWidth) - 0x8000) >> 4;
|
||||
}
|
||||
|
||||
Mixer_Play_Effect(soundId, MIXER_LOOP_NONE, DStoMixerVolume(volume), DStoMixerPan(mixerPan), 1, 1);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* rct2: 0x006BD0F8
|
||||
*/
|
||||
void start_title_music()
|
||||
void audio_start_title_music()
|
||||
{
|
||||
int musicPathId;
|
||||
switch (gConfigSound.title_music) {
|
||||
default:
|
||||
if (gGameSoundsOff || !(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & SCREEN_FLAGS_TITLE_DEMO)) {
|
||||
audio_stop_title_music();
|
||||
return;
|
||||
}
|
||||
|
||||
if (gTitleMusicChannel)
|
||||
return;
|
||||
|
||||
int pathId;
|
||||
switch (gConfigSound.title_music) {
|
||||
case 1:
|
||||
musicPathId = PATH_ID_CSS50;
|
||||
pathId = PATH_ID_CSS50;
|
||||
break;
|
||||
case 2:
|
||||
musicPathId = PATH_ID_CSS17;
|
||||
pathId = PATH_ID_CSS17;
|
||||
break;
|
||||
case 3:
|
||||
if (rand() & 1)
|
||||
musicPathId = PATH_ID_CSS50;
|
||||
pathId = PATH_ID_CSS50;
|
||||
else
|
||||
musicPathId = PATH_ID_CSS17;
|
||||
pathId = PATH_ID_CSS17;
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
|
||||
if (!gGameSoundsOff && RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & SCREEN_FLAGS_TITLE_DEMO) {
|
||||
if (!gTitleMusicChannel) {
|
||||
gTitleMusicChannel = Mixer_Play_Music(musicPathId, MIXER_LOOP_INFINITE, true);
|
||||
}
|
||||
} else {
|
||||
stop_title_music();
|
||||
}
|
||||
gTitleMusicChannel = Mixer_Play_Music(pathId, MIXER_LOOP_INFINITE, true);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* rct2: 0x006BCA9F
|
||||
*/
|
||||
void stop_ride_music()
|
||||
void audio_stop_ride_music()
|
||||
{
|
||||
for (int i = 0; i < AUDIO_MAX_RIDE_MUSIC; i++) {
|
||||
rct_ride_music* ride_music = &gRideMusicList[i];
|
||||
if (ride_music->rideid != (uint8)-1) {
|
||||
if (ride_music->sound_channel) {
|
||||
Mixer_Stop_Channel(ride_music->sound_channel);
|
||||
}
|
||||
ride_music->rideid = -1;
|
||||
}
|
||||
rct_ride_music *rideMusic = &gRideMusicList[i];
|
||||
if (rideMusic->ride_id == (uint8)-1)
|
||||
continue;
|
||||
|
||||
if (rideMusic->sound_channel)
|
||||
Mixer_Stop_Channel(rideMusic->sound_channel);
|
||||
|
||||
rideMusic->ride_id = -1;
|
||||
}
|
||||
}
|
||||
|
||||
void audio_stop_crowd_sound()
|
||||
{
|
||||
audio_stop_channel(&gCrowdSoundChannel);
|
||||
}
|
||||
|
||||
void audio_stop_title_music()
|
||||
{
|
||||
audio_stop_channel(&gTitleMusicChannel);
|
||||
}
|
||||
|
||||
void audio_stop_rain_sound()
|
||||
{
|
||||
audio_stop_channel(&gRainSoundChannel);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* rct2: 0x006BD07F
|
||||
* Stops the specified audio channel from playing.
|
||||
* @param channel The channel to stop.
|
||||
*/
|
||||
void stop_crowd_sound()
|
||||
void audio_stop_channel(void **channel)
|
||||
{
|
||||
if (gCrowdSoundChannel) {
|
||||
Mixer_Stop_Channel(gCrowdSoundChannel);
|
||||
gCrowdSoundChannel = 0;
|
||||
}
|
||||
if (!*channel)
|
||||
return;
|
||||
|
||||
Mixer_Stop_Channel(*channel);
|
||||
*channel = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* rct2: 0x006BD0BD
|
||||
*/
|
||||
void stop_title_music()
|
||||
void audio_init_ride_sounds_and_info()
|
||||
{
|
||||
if (gTitleMusicChannel) {
|
||||
Mixer_Stop_Channel(gTitleMusicChannel);
|
||||
gTitleMusicChannel = 0;
|
||||
}
|
||||
}
|
||||
int deviceNum = 0;
|
||||
audio_init_ride_sounds(deviceNum);
|
||||
|
||||
void stop_rain_sound()
|
||||
{
|
||||
if (gRainSoundChannel) {
|
||||
Mixer_Stop_Channel(gRainSoundChannel);
|
||||
gRainSoundChannel = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* rct2: 0x006BA8E0
|
||||
*/
|
||||
void audio_init1()
|
||||
{
|
||||
int devicenum = 0;
|
||||
audio_init2(devicenum);
|
||||
|
||||
for(int m = 0; m < countof(ride_music_info_list); m++) {
|
||||
rct_ride_music_info* ride_music_info = ride_music_info_list[m];
|
||||
const utf8* path = get_file_path(ride_music_info->pathid);
|
||||
for (int m = 0; m < countof(gRideMusicInfoList); m++) {
|
||||
rct_ride_music_info *rideMusicInfo = gRideMusicInfoList[m];
|
||||
const utf8 *path = get_file_path(rideMusicInfo->path_id);
|
||||
SDL_RWops *file = SDL_RWFromFile(path, "rb");
|
||||
if (file != NULL) {
|
||||
uint32 head;
|
||||
SDL_RWread(file, &head, sizeof(head), 1);
|
||||
SDL_RWclose(file);
|
||||
RCT2_GLOBAL(0x014241BC, uint32) = 0;
|
||||
if (head == 0x78787878) {
|
||||
ride_music_info->length = 0;
|
||||
}
|
||||
}
|
||||
if (file == NULL)
|
||||
continue;
|
||||
|
||||
uint32 head;
|
||||
SDL_RWread(file, &head, sizeof(head), 1);
|
||||
SDL_RWclose(file);
|
||||
RCT2_GLOBAL(0x014241BC, uint32) = 0;
|
||||
if (head == 0x78787878)
|
||||
rideMusicInfo->length = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* rct2: 0x006BA9B5
|
||||
*/
|
||||
void audio_init2(int device)
|
||||
void audio_init_ride_sounds(int device)
|
||||
{
|
||||
audio_close();
|
||||
for (int i = 0; i < AUDIO_MAX_VEHICLE_SOUNDS; i++) {
|
||||
rct_vehicle_sound* vehicle_sound = &gVehicleSoundList[i];
|
||||
vehicle_sound->id = -1;
|
||||
rct_vehicle_sound *vehicleSound = &gVehicleSoundList[i];
|
||||
vehicleSound->id = -1;
|
||||
}
|
||||
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_SOUND_DEVICE, uint32) = device;
|
||||
config_save_default();
|
||||
for (int i = 0; i < AUDIO_MAX_RIDE_MUSIC; i++) {
|
||||
rct_ride_music* ride_music = &gRideMusicList[i];
|
||||
ride_music->rideid = -1;
|
||||
rct_ride_music *rideMusic = &gRideMusicList[i];
|
||||
rideMusic->ride_id = -1;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* rct2: 0x006BAB21
|
||||
*/
|
||||
void audio_close()
|
||||
{
|
||||
stop_crowd_sound();
|
||||
stop_title_music();
|
||||
stop_ride_music();
|
||||
stop_rain_sound();
|
||||
audio_stop_crowd_sound();
|
||||
audio_stop_title_music();
|
||||
audio_stop_ride_music();
|
||||
audio_stop_rain_sound();
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_SOUND_DEVICE, uint32) = -1;
|
||||
}
|
||||
|
||||
/* rct2: 0x006BAB8A */
|
||||
void toggle_all_sounds(){
|
||||
void audio_toggle_all_sounds(){
|
||||
gConfigSound.sound = !gConfigSound.sound;
|
||||
if (!gConfigSound.sound) {
|
||||
stop_title_music();
|
||||
pause_sounds();
|
||||
} else {
|
||||
unpause_sounds();
|
||||
if (gConfigSound.sound)
|
||||
audio_unpause_sounds();
|
||||
else {
|
||||
audio_stop_title_music();
|
||||
audio_pause_sounds();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* rct2: 0x006BABB4
|
||||
*/
|
||||
void pause_sounds()
|
||||
void audio_pause_sounds()
|
||||
{
|
||||
gGameSoundsOff = true;
|
||||
stop_vehicle_sounds();
|
||||
stop_ride_music();
|
||||
stop_crowd_sound();
|
||||
stop_rain_sound();
|
||||
audio_stop_vehicle_sounds();
|
||||
audio_stop_ride_music();
|
||||
audio_stop_crowd_sound();
|
||||
audio_stop_rain_sound();
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* rct2: 0x006BABD8
|
||||
*/
|
||||
void unpause_sounds()
|
||||
void audio_unpause_sounds()
|
||||
{
|
||||
gGameSoundsOff = false;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* rct2: 0x006BABDF
|
||||
*/
|
||||
void stop_vehicle_sounds()
|
||||
void audio_stop_vehicle_sounds()
|
||||
{
|
||||
if (!gOpenRCT2Headless && RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_SOUND_DEVICE, sint32) != -1) {
|
||||
for (int i = 0; i < countof(gVehicleSoundList); i++) {
|
||||
rct_vehicle_sound* vehicle_sound = &gVehicleSoundList[i];
|
||||
if (vehicle_sound->id != 0xFFFF) {
|
||||
if (vehicle_sound->sound1_id != 0xFFFF) {
|
||||
Mixer_Stop_Channel(vehicle_sound->sound1_channel);
|
||||
}
|
||||
if (vehicle_sound->sound2_id != 0xFFFF) {
|
||||
Mixer_Stop_Channel(vehicle_sound->sound2_channel);
|
||||
}
|
||||
}
|
||||
vehicle_sound->id = 0xFFFF;
|
||||
}
|
||||
if (gOpenRCT2Headless || RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_SOUND_DEVICE, sint32) == -1)
|
||||
return;
|
||||
|
||||
for (int i = 0; i < countof(gVehicleSoundList); i++) {
|
||||
rct_vehicle_sound *vehicleSound = &gVehicleSoundList[i];
|
||||
if (vehicleSound->id == 0xFFFF)
|
||||
continue;
|
||||
|
||||
if (vehicleSound->sound1_id != 0xFFFF)
|
||||
Mixer_Stop_Channel(vehicleSound->sound1_channel);
|
||||
|
||||
if (vehicleSound->sound2_id != 0xFFFF)
|
||||
Mixer_Stop_Channel(vehicleSound->sound2_channel);
|
||||
|
||||
vehicleSound->id = 0xFFFF;
|
||||
}
|
||||
}
|
||||
+152
-64
@@ -25,22 +25,42 @@
|
||||
#include "../world/sprite.h"
|
||||
|
||||
#define AUDIO_DEVICE_NAME_SIZE 256
|
||||
#define AUDIO_MAX_RIDE_MUSIC 2
|
||||
#define AUDIO_MAX_VEHICLE_SOUNDS 14
|
||||
#define NUM_DEFAULT_MUSIC_TRACKS 46
|
||||
#define AUDIO_PLAY_AT_CENTRE 0x8000
|
||||
#define AUDIO_PLAY_AT_LOCATION 0x8001
|
||||
|
||||
typedef struct {
|
||||
typedef struct audio_device {
|
||||
char name[AUDIO_DEVICE_NAME_SIZE];
|
||||
} audio_device;
|
||||
|
||||
extern int gAudioDeviceCount;
|
||||
extern audio_device *gAudioDevices;
|
||||
typedef struct rct_ride_music {
|
||||
uint8 ride_id;
|
||||
uint8 tune_id;
|
||||
sint16 volume;
|
||||
sint16 pan;
|
||||
uint16 frequency;
|
||||
void* sound_channel;
|
||||
} rct_ride_music;
|
||||
|
||||
#define AUDIO_MAX_VEHICLE_SOUNDS 14
|
||||
#define AUDIO_MAX_RIDE_MUSIC 2
|
||||
typedef struct rct_ride_music_info {
|
||||
uint32 length;
|
||||
uint32 offset;
|
||||
uint8 path_id;
|
||||
uint8 var_9;
|
||||
} rct_ride_music_info;
|
||||
|
||||
void audio_init();
|
||||
void audio_quit();
|
||||
void audio_get_devices();
|
||||
typedef struct rct_ride_music_params {
|
||||
uint8 ride_id;
|
||||
uint8 tune_id;
|
||||
sint32 offset;
|
||||
sint16 volume;
|
||||
sint16 pan;
|
||||
uint16 frequency;
|
||||
} rct_ride_music_params;
|
||||
|
||||
typedef struct {
|
||||
typedef struct rct_vehicle_sound {
|
||||
uint16 id;
|
||||
sint16 volume;
|
||||
uint16 sound1_id;
|
||||
@@ -55,67 +75,16 @@ typedef struct {
|
||||
void* sound2_channel;
|
||||
} rct_vehicle_sound;
|
||||
|
||||
typedef struct {
|
||||
typedef struct rct_vehicle_sound_params {
|
||||
uint16 id;
|
||||
sint16 panx;
|
||||
sint16 pany;
|
||||
sint16 pan_x;
|
||||
sint16 pan_y;
|
||||
uint16 frequency;
|
||||
sint16 volume;
|
||||
uint16 var_A;
|
||||
} rct_vehicle_sound_params;
|
||||
|
||||
typedef struct {
|
||||
uint8 rideid;
|
||||
uint8 tuneid;
|
||||
sint32 offset;
|
||||
sint16 volume;
|
||||
sint16 pan;
|
||||
uint16 freq;
|
||||
} rct_ride_music_params;
|
||||
|
||||
typedef struct {
|
||||
uint8 rideid;
|
||||
uint8 tuneid;
|
||||
sint16 volume;
|
||||
sint16 pan;
|
||||
uint16 freq;
|
||||
void* sound_channel;
|
||||
} rct_ride_music;
|
||||
|
||||
typedef struct {
|
||||
uint32 length;
|
||||
uint32 offset;
|
||||
uint8 pathid;
|
||||
uint8 var_9;
|
||||
} rct_ride_music_info;
|
||||
|
||||
#define NUM_DEFAULT_MUSIC_TRACKS 46
|
||||
extern rct_ride_music_info* ride_music_info_list[NUM_DEFAULT_MUSIC_TRACKS];
|
||||
extern rct_vehicle_sound gVehicleSoundList[AUDIO_MAX_VEHICLE_SOUNDS];
|
||||
extern rct_vehicle_sound_params gVehicleSoundParamsList[AUDIO_MAX_VEHICLE_SOUNDS];
|
||||
extern rct_vehicle_sound_params *gVehicleSoundParamsListEnd;
|
||||
extern rct_ride_music gRideMusicList[AUDIO_MAX_RIDE_MUSIC];
|
||||
extern rct_ride_music_params gRideMusicParamsList[AUDIO_MAX_RIDE_MUSIC];
|
||||
extern rct_ride_music_params *gRideMusicParamsListEnd;
|
||||
extern void *gCrowdSoundChannel;
|
||||
extern void *gTitleMusicChannel;
|
||||
extern void *gRainSoundChannel;
|
||||
extern bool gGameSoundsOff;
|
||||
|
||||
int sound_play_panned(int sound_id, int ebx, sint16 x, sint16 y, sint16 z);
|
||||
void start_title_music();
|
||||
void stop_ride_music();
|
||||
void stop_crowd_sound();
|
||||
void stop_title_music();
|
||||
void audio_init1();
|
||||
void audio_init2(int device);
|
||||
void audio_close();
|
||||
void pause_sounds();
|
||||
void toggle_all_sounds();
|
||||
void unpause_sounds();
|
||||
void stop_vehicle_sounds();
|
||||
|
||||
typedef enum {
|
||||
typedef enum RCT2_SOUND {
|
||||
SOUND_LIFT_1 = 0,
|
||||
SOUND_TRACK_FRICTION_1 = 1,
|
||||
SOUND_LIFT_2 = 2,
|
||||
@@ -182,4 +151,123 @@ typedef enum {
|
||||
SOUND_MAXID
|
||||
} RCT2_SOUND;
|
||||
|
||||
extern audio_device *gAudioDevices;
|
||||
extern int gAudioDeviceCount;
|
||||
extern void *gCrowdSoundChannel;
|
||||
extern bool gGameSoundsOff;
|
||||
extern void *gRainSoundChannel;
|
||||
extern rct_ride_music gRideMusicList[AUDIO_MAX_RIDE_MUSIC];
|
||||
extern rct_ride_music_info *gRideMusicInfoList[NUM_DEFAULT_MUSIC_TRACKS];
|
||||
extern rct_ride_music_params gRideMusicParamsList[AUDIO_MAX_RIDE_MUSIC];
|
||||
extern rct_ride_music_params *gRideMusicParamsListEnd;
|
||||
extern void *gTitleMusicChannel;
|
||||
extern rct_vehicle_sound gVehicleSoundList[AUDIO_MAX_VEHICLE_SOUNDS];
|
||||
extern rct_vehicle_sound_params gVehicleSoundParamsList[AUDIO_MAX_VEHICLE_SOUNDS];
|
||||
extern rct_vehicle_sound_params *gVehicleSoundParamsListEnd;
|
||||
|
||||
/**
|
||||
* Deregisters the audio device.
|
||||
* rct2: 0x006BAB21
|
||||
*/
|
||||
void audio_close();
|
||||
/*
|
||||
* Initialises the audio subsystem.
|
||||
*/
|
||||
void audio_init();
|
||||
/**
|
||||
* Loads the ride sounds and info.
|
||||
* rct2: 0x006BA8E0
|
||||
*/
|
||||
void audio_init_ride_sounds_and_info();
|
||||
/**
|
||||
* Loads the ride sounds.
|
||||
* rct2: 0x006BA9B5
|
||||
*/
|
||||
void audio_init_ride_sounds(int device);
|
||||
/**
|
||||
* Temporarily stops playing sounds until audio_unpause_sounds() is called.
|
||||
* rct2: 0x006BABB4
|
||||
*/
|
||||
void audio_pause_sounds();
|
||||
/**
|
||||
* Plays the specified sound.
|
||||
* @param soundId The sound effect to play.
|
||||
* @param volume The volume at which the sound effect should be played.
|
||||
* @param pan The pan at which the sound effect should be played. If set to anything other than AUDIO_PLAY_AT_CENTRE, plays the
|
||||
* sound at a position relative to the centre of the viewport.
|
||||
* @return 0 if the sound was not out of range; otherwise, soundId.
|
||||
*/
|
||||
int audio_play_sound(int soundId, int volume, int pan);
|
||||
/**
|
||||
* Plays the specified sound at a virtual location.
|
||||
* @param soundId The sound effect to play.
|
||||
* @param x The x coordinate of the location.
|
||||
* @param y The y coordinate of the location.
|
||||
* @param z The z coordinate of the location.
|
||||
* @return 0 if the sound was not out of range; otherwise, soundId.
|
||||
*/
|
||||
int audio_play_sound_at_location(int soundId, sint16 x, sint16 y, sint16 z);
|
||||
/**
|
||||
* rct2: 0x006BB76E
|
||||
* @deprecated Use audio_play_sound_at_location or audio_play_sound instead.
|
||||
* Plays the specified sound effect at a location specified by the pan parameter.
|
||||
* @param soundId (eax) The sound effect to play.
|
||||
* @param pan (ebx) If set to AUDIO_PLAY_AT_LOCATION, play the sound at the specified location; if set to AUDIO_PLAY_AT_CENTRE,
|
||||
* play the sound at the centre of the viewport; if set to anything else, use the value of pan as a relative position to the
|
||||
* centre of the viewport.
|
||||
* @param x (cx) The x coordinate of the location.
|
||||
* @param y (dx) The y coordinate of the location.
|
||||
* @param z (bp) The z coordinate of the location.
|
||||
* @return 0 if the sound was not out of range; otherwise, soundId.
|
||||
*/
|
||||
int audio_play_sound_panned(int soundId, int pan, sint16 x, sint16 y, sint16 z);
|
||||
/**
|
||||
* Populates the gAudioDevices array with the available audio devices.
|
||||
*/
|
||||
void audio_populate_devices();
|
||||
/**
|
||||
* Terminates the audio subsystem.
|
||||
* This appears to be unused.
|
||||
*/
|
||||
void audio_quit();
|
||||
/**
|
||||
* Starts playing the title music.
|
||||
* rct2: 0x006BD0F8
|
||||
*/
|
||||
void audio_start_title_music();
|
||||
/**
|
||||
* Stops the crowd sound effect from playing.
|
||||
* rct2: 0x006BD07F
|
||||
*/
|
||||
void audio_stop_crowd_sound();
|
||||
/**
|
||||
* Stops the rain sound effect from playing.
|
||||
*/
|
||||
void audio_stop_rain_sound();
|
||||
/**
|
||||
* Stops ride music from playing.
|
||||
* rct2: 0x006BCA9F
|
||||
*/
|
||||
void audio_stop_ride_music();
|
||||
/**
|
||||
* Stops the title music from playing.
|
||||
* rct2: 0x006BD0BD
|
||||
*/
|
||||
void audio_stop_title_music();
|
||||
/**
|
||||
* Stops vehicle sounds from playing.
|
||||
* rct2: 0x006BABDF
|
||||
*/
|
||||
void audio_stop_vehicle_sounds();
|
||||
/**
|
||||
* Toggles whether all sounds should be played.
|
||||
* rct2: 0x006BAB8A
|
||||
*/
|
||||
void audio_toggle_all_sounds();
|
||||
/**
|
||||
* Resumes playing sounds that had been paused by a call to audio_pause_sounds().
|
||||
* rct2: 0x006BABD8
|
||||
*/
|
||||
void audio_unpause_sounds();
|
||||
|
||||
#endif
|
||||
+10
-10
@@ -530,20 +530,20 @@ void Mixer::Stop(Channel& channel)
|
||||
Unlock();
|
||||
}
|
||||
|
||||
bool Mixer::LoadMusic(int pathid)
|
||||
bool Mixer::LoadMusic(int pathId)
|
||||
{
|
||||
if (pathid >= countof(musicsources)) {
|
||||
if (pathId >= countof(musicsources)) {
|
||||
return false;
|
||||
}
|
||||
if (!musicsources[pathid]) {
|
||||
const char* filename = get_file_path(pathid);
|
||||
if (!musicsources[pathId]) {
|
||||
const char* filename = get_file_path(pathId);
|
||||
Source_Sample* source_sample = new Source_Sample;
|
||||
if (source_sample->LoadWAV(filename)) {
|
||||
musicsources[pathid] = source_sample;
|
||||
musicsources[pathId] = source_sample;
|
||||
return true;
|
||||
} else {
|
||||
delete source_sample;
|
||||
musicsources[pathid] = &source_null;
|
||||
musicsources[pathId] = &source_null;
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
@@ -880,7 +880,7 @@ void Mixer_Channel_SetGroup(void* channel, int group)
|
||||
((Channel*)channel)->SetGroup(group);
|
||||
}
|
||||
|
||||
void* Mixer_Play_Music(int pathid, int loop, int streaming)
|
||||
void* Mixer_Play_Music(int pathId, int loop, int streaming)
|
||||
{
|
||||
if (gOpenRCT2Headless) return 0;
|
||||
|
||||
@@ -888,7 +888,7 @@ void* Mixer_Play_Music(int pathid, int loop, int streaming)
|
||||
return 0;
|
||||
}
|
||||
if (streaming) {
|
||||
const utf8 *filename = get_file_path(pathid);
|
||||
const utf8 *filename = get_file_path(pathId);
|
||||
|
||||
SDL_RWops* rw = SDL_RWFromFile(filename, "rb");
|
||||
if (rw == NULL) {
|
||||
@@ -908,8 +908,8 @@ void* Mixer_Play_Music(int pathid, int loop, int streaming)
|
||||
return 0;
|
||||
}
|
||||
} else {
|
||||
if (gMixer.LoadMusic(pathid)) {
|
||||
Channel* channel = gMixer.Play(*gMixer.musicsources[pathid], MIXER_LOOP_INFINITE, false, false);
|
||||
if (gMixer.LoadMusic(pathId)) {
|
||||
Channel* channel = gMixer.Play(*gMixer.musicsources[pathId], MIXER_LOOP_INFINITE, false, false);
|
||||
if (channel) {
|
||||
channel->SetGroup(MIXER_GROUP_MUSIC);
|
||||
}
|
||||
|
||||
+1
-1
@@ -210,7 +210,7 @@ int Mixer_Channel_IsPlaying(void* channel);
|
||||
unsigned long Mixer_Channel_GetOffset(void* channel);
|
||||
int Mixer_Channel_SetOffset(void* channel, unsigned long offset);
|
||||
void Mixer_Channel_SetGroup(void* channel, int group);
|
||||
void* Mixer_Play_Music(int pathid, int loop, int streaming);
|
||||
void* Mixer_Play_Music(int pathId, int loop, int streaming);
|
||||
void Mixer_SetVolume(float volume);
|
||||
|
||||
static int DStoMixerVolume(int volume) { return (int)(SDL_MIX_MAXVOLUME * (SDL_pow(10, (float)volume / 2000))); };
|
||||
|
||||
+2
-2
@@ -60,8 +60,8 @@ void editor_load()
|
||||
{
|
||||
rct_window *mainWindow;
|
||||
|
||||
pause_sounds();
|
||||
unpause_sounds();
|
||||
audio_pause_sounds();
|
||||
audio_unpause_sounds();
|
||||
object_unload_all();
|
||||
map_init(150);
|
||||
banner_init();
|
||||
|
||||
+10
-10
@@ -275,7 +275,7 @@ void game_update()
|
||||
// Update the game one or more times
|
||||
for (i = 0; i < numUpdates; i++) {
|
||||
game_logic_update();
|
||||
start_title_music();
|
||||
audio_start_title_music();
|
||||
|
||||
if (gGameSpeed > 1)
|
||||
continue;
|
||||
@@ -549,10 +549,10 @@ void pause_toggle()
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_GAME_PAUSED, uint32) ^= 1;
|
||||
window_invalidate_by_class(WC_TOP_TOOLBAR);
|
||||
if (RCT2_GLOBAL(RCT2_ADDRESS_GAME_PAUSED, uint32) & 1) {
|
||||
pause_sounds();
|
||||
unpause_sounds();
|
||||
audio_pause_sounds();
|
||||
audio_unpause_sounds();
|
||||
} else {
|
||||
unpause_sounds();
|
||||
audio_unpause_sounds();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -601,9 +601,9 @@ static int open_landscape_file_dialog()
|
||||
format_string((char*)RCT2_ADDRESS_COMMON_STRING_FORMAT_BUFFER, STR_LOAD_LANDSCAPE_DIALOG_TITLE, 0);
|
||||
safe_strncpy((char*)0x0141EF68, (char*)RCT2_ADDRESS_LANDSCAPES_PATH, MAX_PATH);
|
||||
format_string((char*)0x0141EE68, STR_RCT2_LANDSCAPE_FILE, 0);
|
||||
pause_sounds();
|
||||
audio_pause_sounds();
|
||||
result = platform_open_common_file_dialog(1, (char*)RCT2_ADDRESS_COMMON_STRING_FORMAT_BUFFER, (char*)0x0141EF68, "*.SV6;*.SV4;*.SC6", (char*)0x0141EE68);
|
||||
unpause_sounds();
|
||||
audio_unpause_sounds();
|
||||
// window_proc
|
||||
return result;
|
||||
}
|
||||
@@ -618,9 +618,9 @@ static int open_load_game_dialog()
|
||||
format_string((char*)RCT2_ADDRESS_COMMON_STRING_FORMAT_BUFFER, STR_LOAD_GAME_DIALOG_TITLE, 0);
|
||||
safe_strncpy((char*)0x0141EF68, (char*)RCT2_ADDRESS_SAVED_GAMES_PATH, MAX_PATH);
|
||||
format_string((char*)0x0141EE68, STR_RCT2_SAVED_GAME, 0);
|
||||
pause_sounds();
|
||||
audio_pause_sounds();
|
||||
result = platform_open_common_file_dialog(1, (char*)RCT2_ADDRESS_COMMON_STRING_FORMAT_BUFFER, (char*)0x0141EF68, "*.SV6", (char*)0x0141EE68);
|
||||
unpause_sounds();
|
||||
audio_unpause_sounds();
|
||||
// window_proc
|
||||
return result;
|
||||
}
|
||||
@@ -1020,9 +1020,9 @@ static int show_save_game_dialog(char *resultPath)
|
||||
safe_strncpy(filename, RCT2_ADDRESS(RCT2_ADDRESS_SAVED_GAMES_PATH_2, char), MAX_PATH);
|
||||
format_string(filterName, STR_RCT2_SAVED_GAME, NULL);
|
||||
|
||||
pause_sounds();
|
||||
audio_pause_sounds();
|
||||
result = platform_open_common_file_dialog(0, title, filename, "*.SV6", filterName);
|
||||
unpause_sounds();
|
||||
audio_unpause_sounds();
|
||||
|
||||
if (result)
|
||||
safe_strncpy(resultPath, filename, MAX_PATH);
|
||||
|
||||
+2
-2
@@ -1021,7 +1021,7 @@ static void input_widget_left(int x, int y, rct_window *w, int widgetIndex)
|
||||
break;
|
||||
default:
|
||||
if (widget_is_enabled(w, widgetIndex) && !widget_is_disabled(w, widgetIndex)) {
|
||||
sound_play_panned(SOUND_CLICK_1, w->x + (widget->left + widget->right) / 2, 0, 0, 0);
|
||||
audio_play_sound_panned(SOUND_CLICK_1, w->x + (widget->left + widget->right) / 2, 0, 0, 0);
|
||||
|
||||
// Set new cursor down widget
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_CURSOR_DOWN_WINDOWCLASS, rct_windowclass) = windowClass;
|
||||
@@ -1267,7 +1267,7 @@ void input_state_widget_pressed(int x, int y, int state, int widgetIndex, rct_wi
|
||||
break;
|
||||
|
||||
int mid_point_x = (widget->left + widget->right) / 2 + w->x;
|
||||
sound_play_panned(5, mid_point_x, 0, 0, 0);
|
||||
audio_play_sound_panned(5, mid_point_x, 0, 0, 0);
|
||||
if (cursor_w_class != w->classification || cursor_w_number != w->number || widgetIndex != cursor_widgetIndex)
|
||||
break;
|
||||
|
||||
|
||||
@@ -397,7 +397,7 @@ rct_window *window_create(int x, int y, int width, int height, rct_window_event_
|
||||
// Play sounds and flash the window
|
||||
if (!(flags & (WF_STICK_TO_BACK | WF_STICK_TO_FRONT))){
|
||||
w->flags |= WF_WHITE_BORDER_MASK;
|
||||
sound_play_panned(SOUND_WINDOW_OPEN, x + (width / 2), 0, 0, 0);
|
||||
audio_play_sound_panned(SOUND_WINDOW_OPEN, x + (width / 2), 0, 0, 0);
|
||||
}
|
||||
|
||||
w->number = 0;
|
||||
|
||||
@@ -85,7 +85,7 @@ static void news_item_tick_current()
|
||||
// Only play news item sound when in normal playing mode
|
||||
if (ticks == 1 && (RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) == SCREEN_FLAGS_PLAYING)) {
|
||||
// Play sound
|
||||
sound_play_panned(SOUND_NEWS_ITEM, RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_WIDTH, uint16) / 2, 0, 0, 0);
|
||||
audio_play_sound_panned(SOUND_NEWS_ITEM, RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_WIDTH, uint16) / 2, 0, 0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+9
-9
@@ -249,7 +249,7 @@ bool openrct2_initialise()
|
||||
get_system_info();
|
||||
if (!gOpenRCT2Headless) {
|
||||
audio_init();
|
||||
audio_get_devices();
|
||||
audio_populate_devices();
|
||||
}
|
||||
if (!language_open(gConfigGeneral.language))
|
||||
{
|
||||
@@ -635,14 +635,14 @@ static bool openrct2_release_rct2_segment()
|
||||
*/
|
||||
static void openrct2_setup_rct2_hooks()
|
||||
{
|
||||
addhook(0x006E732D, (int)gfx_set_dirty_blocks, 0, (int[]){ EAX, EBX, EDX, EBP, END }, 0, 0); // remove when all callers are decompiled
|
||||
addhook(0x006E7499, (int)gfx_redraw_screen_rect, 0, (int[]){ EAX, EBX, EDX, EBP, END }, 0, 0); // remove when 0x6E7FF3 is decompiled
|
||||
addhook(0x006B752C, (int)ride_crash, 0, (int[]){ EDX, EBX, END }, 0, 0); // remove when all callers are decompiled
|
||||
addhook(0x0069A42F, (int)peep_window_state_update, 0, (int[]){ ESI, END }, 0, 0); // remove when all callers are decompiled
|
||||
addhook(0x006BB76E, (int)sound_play_panned, 0, (int[]){EAX, EBX, ECX, EDX, EBP, END}, EAX, 0); // remove when all callers are decompiled
|
||||
addhook(0x006C42D9, (int)scrolling_text_setup, 0, (int[]){EAX, ECX, EBP, END}, 0, EBX); // remove when all callers are decompiled
|
||||
addhook(0x006C2321, (int)gfx_get_string_width, 0, (int[]){ESI, END}, 0, ECX); // remove when all callers are decompiled
|
||||
addhook(0x006C2555, (int)format_string, 0, (int[]){EDI, EAX, ECX, END}, 0, 0); // remove when all callers are decompiled
|
||||
addhook(0x006E732D, (int)gfx_set_dirty_blocks, 0, (int[]){ EAX, EBX, EDX, EBP, END }, 0, 0); // remove when all callers are decompiled
|
||||
addhook(0x006E7499, (int)gfx_redraw_screen_rect, 0, (int[]){ EAX, EBX, EDX, EBP, END }, 0, 0); // remove when 0x6E7FF3 is decompiled
|
||||
addhook(0x006B752C, (int)ride_crash, 0, (int[]){ EDX, EBX, END }, 0, 0); // remove when all callers are decompiled
|
||||
addhook(0x0069A42F, (int)peep_window_state_update, 0, (int[]){ ESI, END }, 0, 0); // remove when all callers are decompiled
|
||||
addhook(0x006BB76E, (int)audio_play_sound_panned, 0, (int[]){EAX, EBX, ECX, EDX, EBP, END}, EAX, 0); // remove when all callers are decompiled
|
||||
addhook(0x006C42D9, (int)scrolling_text_setup, 0, (int[]){EAX, ECX, EBP, END}, 0, EBX); // remove when all callers are decompiled
|
||||
addhook(0x006C2321, (int)gfx_get_string_width, 0, (int[]){ESI, END}, 0, ECX); // remove when all callers are decompiled
|
||||
addhook(0x006C2555, (int)format_string, 0, (int[]){EDI, EAX, ECX, END}, 0, 0); // remove when all callers are decompiled
|
||||
}
|
||||
|
||||
#if _MSC_VER >= 1900
|
||||
|
||||
+7
-7
@@ -392,7 +392,7 @@ static void sub_68F41A(rct_peep *peep, int index)
|
||||
}
|
||||
|
||||
if (peep->flags & PEEP_FLAGS_EXPLODE && peep->x != (sint16)0x8000){
|
||||
sound_play_panned(SOUND_CRASH, 0x8001, peep->x, peep->y, peep->z);
|
||||
audio_play_sound_at_location(SOUND_CRASH, peep->x, peep->y, peep->z);
|
||||
|
||||
sprite_misc_3_create(peep->x, peep->y, peep->z + 16);
|
||||
sprite_misc_5_create(peep->x, peep->y, peep->z + 16);
|
||||
@@ -1029,7 +1029,7 @@ int peep_update_action(sint16* x, sint16* y, sint16* xy_distance, rct_peep* peep
|
||||
litter_create(peep->x, peep->y, peep->z, peep->sprite_direction, peep->sprite_index & 1);
|
||||
|
||||
int sound_id = SOUND_COUGH_1 + (scenario_rand() & 3);
|
||||
sound_play_panned(sound_id, 0x8001, peep->x, peep->y, peep->z);
|
||||
audio_play_sound_at_location(sound_id, peep->x, peep->y, peep->z);
|
||||
|
||||
invalidate_sprite_2((rct_sprite*)peep);
|
||||
*x = peep->x;
|
||||
@@ -1141,7 +1141,7 @@ void peep_update_sprite_type(rct_peep* peep)
|
||||
) {
|
||||
|
||||
bl = 1;
|
||||
sound_play_panned(SOUND_BALLOON_POP, 0x8001, peep->x, peep->y, peep->z);
|
||||
audio_play_sound_at_location(SOUND_BALLOON_POP, peep->x, peep->y, peep->z);
|
||||
}
|
||||
|
||||
if (peep->x != SPRITE_LOCATION_NULL) {
|
||||
@@ -3161,7 +3161,7 @@ static void peep_update_ride_sub_state_20(rct_peep* peep){
|
||||
return;
|
||||
}
|
||||
|
||||
sound_play_panned(SOUND_TOILET_FLUSH, 0x8001, peep->x, peep->y, peep->z);
|
||||
audio_play_sound_at_location(SOUND_TOILET_FLUSH, peep->x, peep->y, peep->z);
|
||||
|
||||
peep->sub_state++;
|
||||
|
||||
@@ -5265,7 +5265,7 @@ void peep_applause()
|
||||
}
|
||||
|
||||
// Play applause noise
|
||||
sound_play_panned(SOUND_APPLAUSE, RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_WIDTH, uint16) / 2, 0, 0, 0);
|
||||
audio_play_sound_panned(SOUND_APPLAUSE, RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_WIDTH, uint16) / 2, 0, 0, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -7523,7 +7523,7 @@ static void peep_spend_money(rct_peep *peep, money16 *peep_expend_type, money32
|
||||
RCT2_GLOBAL(0x00141F568, uint8) = RCT2_GLOBAL(0x0013CA740, uint8);
|
||||
finance_payment(-amount, RCT2_GLOBAL(RCT2_ADDRESS_NEXT_EXPENDITURE_TYPE, uint8) / 4);
|
||||
|
||||
sound_play_panned(SOUND_PURCHASE, 0x8001, peep->x, peep->y, peep->z);
|
||||
audio_play_sound_at_location(SOUND_PURCHASE, peep->x, peep->y, peep->z);
|
||||
}
|
||||
|
||||
static void peep_set_has_ridden(rct_peep *peep, int rideIndex)
|
||||
@@ -7851,7 +7851,7 @@ static void peep_on_exit_ride(rct_peep *peep, int rideIndex)
|
||||
|
||||
int laugh = scenario_rand() & 7;
|
||||
if (laugh < 3) {
|
||||
sound_play_panned(SOUND_LAUGH_1 + laugh, 0x8001, peep->x, peep->y, peep->z);
|
||||
audio_play_sound_at_location(SOUND_LAUGH_1 + laugh, peep->x, peep->y, peep->z);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+3
-3
@@ -104,7 +104,7 @@ int rct2_init()
|
||||
font_sprite_initialise_characters();
|
||||
if (!gOpenRCT2Headless) {
|
||||
platform_init();
|
||||
audio_init1();
|
||||
audio_init_ride_sounds_and_info();
|
||||
}
|
||||
viewport_init_all();
|
||||
news_item_init_queue();
|
||||
@@ -326,12 +326,12 @@ int check_file_path(int pathId)
|
||||
|
||||
case PATH_ID_CUSTOM1:
|
||||
if (file != NULL)
|
||||
ride_music_info_list[36]->length = (uint32)SDL_RWsize(file); // Store file size in music_custom1_size @ 0x009AF164
|
||||
gRideMusicInfoList[36]->length = (uint32)SDL_RWsize(file); // Store file size in music_custom1_size @ 0x009AF164
|
||||
break;
|
||||
|
||||
case PATH_ID_CUSTOM2:
|
||||
if (file != NULL)
|
||||
ride_music_info_list[37]->length = (uint32)SDL_RWsize(file); // Store file size in music_custom2_size @ 0x009AF16E
|
||||
gRideMusicInfoList[37]->length = (uint32)SDL_RWsize(file); // Store file size in music_custom2_size @ 0x009AF16E
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
+39
-39
@@ -3278,7 +3278,7 @@ int ride_music_params_update(sint16 x, sint16 y, sint16 z, uint8 rideIndex, uint
|
||||
if (screenwidth < 64) {
|
||||
screenwidth = 64;
|
||||
}
|
||||
int panx = ((x2 / screenwidth) - 0x8000) >> 4;
|
||||
int pan_x = ((x2 / screenwidth) - 0x8000) >> 4;
|
||||
|
||||
int y2 = RCT2_GLOBAL(0x00F438A4, rct_viewport*)->y + ((RCT2_GLOBAL(0x009AF5A2, sint16) - RCT2_GLOBAL(0x00F438A4, rct_viewport*)->view_y) >> RCT2_GLOBAL(0x00F438A4, rct_viewport*)->zoom);
|
||||
y2 <<= 16;
|
||||
@@ -3286,12 +3286,12 @@ int ride_music_params_update(sint16 x, sint16 y, sint16 z, uint8 rideIndex, uint
|
||||
if (screenheight < 64) {
|
||||
screenheight = 64;
|
||||
}
|
||||
int pany = ((y2 / screenheight) - 0x8000) >> 4;
|
||||
int pan_y = ((y2 / screenheight) - 0x8000) >> 4;
|
||||
|
||||
uint8 vol1 = -1;
|
||||
uint8 vol2 = -1;
|
||||
int panx2 = panx;
|
||||
int pany2 = pany;
|
||||
int panx2 = pan_x;
|
||||
int pany2 = pan_y;
|
||||
if (pany2 < 0) {
|
||||
pany2 = -pany2;
|
||||
}
|
||||
@@ -3331,20 +3331,20 @@ int ride_music_params_update(sint16 x, sint16 y, sint16 z, uint8 rideIndex, uint
|
||||
}
|
||||
int v32 = -(((uint8)(-vol1 - 1) * (uint8)(-vol1 - 1)) / 16) - 700;
|
||||
if (vol1 && v32 >= -4000) {
|
||||
if (panx > 10000) {
|
||||
panx = 10000;
|
||||
if (pan_x > 10000) {
|
||||
pan_x = 10000;
|
||||
}
|
||||
if (panx < -10000) {
|
||||
panx = -10000;
|
||||
if (pan_x < -10000) {
|
||||
pan_x = -10000;
|
||||
}
|
||||
rct_ride_music* ride_music = &gRideMusicList[0];
|
||||
int channel = 0;
|
||||
uint32 a1;
|
||||
while (ride_music->rideid != rideIndex || ride_music->tuneid != *tuneId) {
|
||||
while (ride_music->ride_id != rideIndex || ride_music->tune_id != *tuneId) {
|
||||
ride_music++;
|
||||
channel++;
|
||||
if (channel >= AUDIO_MAX_RIDE_MUSIC) {
|
||||
rct_ride_music_info* ride_music_info = ride_music_info_list[*tuneId];
|
||||
rct_ride_music_info* ride_music_info = gRideMusicInfoList[*tuneId];
|
||||
a1 = position + ride_music_info->offset;
|
||||
goto label51;
|
||||
}
|
||||
@@ -3356,16 +3356,16 @@ int ride_music_params_update(sint16 x, sint16 y, sint16 z, uint8 rideIndex, uint
|
||||
}
|
||||
a1 = Mixer_Channel_GetOffset(gRideMusicList[channel].sound_channel);
|
||||
label51:
|
||||
if (a1 < ride_music_info_list[*tuneId]->length) {
|
||||
if (a1 < gRideMusicInfoList[*tuneId]->length) {
|
||||
position = a1;
|
||||
rct_ride_music_params* ride_music_params = gRideMusicParamsListEnd;
|
||||
if (ride_music_params < &gRideMusicParamsList[AUDIO_MAX_RIDE_MUSIC]) {
|
||||
ride_music_params->rideid = rideIndex;
|
||||
ride_music_params->tuneid = *tuneId;
|
||||
ride_music_params->ride_id = rideIndex;
|
||||
ride_music_params->tune_id = *tuneId;
|
||||
ride_music_params->offset = a1;
|
||||
ride_music_params->volume = v32;
|
||||
ride_music_params->pan = panx;
|
||||
ride_music_params->freq = RCT2_GLOBAL(0x009AF47C, uint16);
|
||||
ride_music_params->pan = pan_x;
|
||||
ride_music_params->frequency = RCT2_GLOBAL(0x009AF47C, uint16);
|
||||
gRideMusicParamsListEnd++;
|
||||
}
|
||||
} else {
|
||||
@@ -3375,7 +3375,7 @@ int ride_music_params_update(sint16 x, sint16 y, sint16 z, uint8 rideIndex, uint
|
||||
} else {
|
||||
label58:
|
||||
;
|
||||
rct_ride_music_info* ride_music_info = ride_music_info_list[*tuneId];
|
||||
rct_ride_music_info* ride_music_info = gRideMusicInfoList[*tuneId];
|
||||
position += ride_music_info->offset;
|
||||
if (position < ride_music_info->length) {
|
||||
return position;
|
||||
@@ -3388,10 +3388,10 @@ int ride_music_params_update(sint16 x, sint16 y, sint16 z, uint8 rideIndex, uint
|
||||
return position;
|
||||
}
|
||||
|
||||
#define INIT_MUSIC_INFO(pathid, offset, length, unknown) (rct_ride_music_info[]){length, offset, pathid, unknown}
|
||||
#define INIT_MUSIC_INFO(path_id, offset, length, unknown) (rct_ride_music_info[]){length, offset, path_id, unknown}
|
||||
|
||||
//0x009AF1C8
|
||||
rct_ride_music_info* ride_music_info_list[NUM_DEFAULT_MUSIC_TRACKS] = {
|
||||
rct_ride_music_info* gRideMusicInfoList[NUM_DEFAULT_MUSIC_TRACKS] = {
|
||||
INIT_MUSIC_INFO(PATH_ID_CSS4, 1378, 8139054, 0),
|
||||
INIT_MUSIC_INFO(PATH_ID_CSS5, 1378, 7796656, 0),
|
||||
INIT_MUSIC_INFO(PATH_ID_CSS6, 1378, 15787850, 0),
|
||||
@@ -3456,9 +3456,9 @@ void ride_music_update_final()
|
||||
int v9 = 1;
|
||||
rct_ride_music_params* ride_music_params = &gRideMusicParamsList[0];
|
||||
while (ride_music_params < gRideMusicParamsListEnd) {
|
||||
if (ride_music_params->rideid != (uint8)-1) {
|
||||
rct_ride_music_info* ride_music_info = ride_music_info_list[ride_music_params->tuneid];
|
||||
if (RCT2_ADDRESS(0x009AA0B1, uint8*)[ride_music_info->pathid]) { // file_on_cdrom[]
|
||||
if (ride_music_params->ride_id != (uint8)-1) {
|
||||
rct_ride_music_info* ride_music_info = gRideMusicInfoList[ride_music_params->tune_id];
|
||||
if (RCT2_ADDRESS(0x009AA0B1, uint8*)[ride_music_info->path_id]) { // file_on_cdrom[]
|
||||
v8++;
|
||||
if (v9 >= ride_music_params->volume) {
|
||||
v9 = ride_music_params->volume;
|
||||
@@ -3471,14 +3471,14 @@ void ride_music_update_final()
|
||||
if (v8 <= 1) {
|
||||
break;
|
||||
}
|
||||
edi->rideid = -1;
|
||||
edi->ride_id = -1;
|
||||
}
|
||||
while (1) {
|
||||
int v8 = 0;
|
||||
int v9 = 1;
|
||||
rct_ride_music_params* ride_music_params = &gRideMusicParamsList[0];
|
||||
while (ride_music_params < gRideMusicParamsListEnd) {
|
||||
if (ride_music_params->rideid != (uint8)-1) {
|
||||
if (ride_music_params->ride_id != (uint8)-1) {
|
||||
v8++;
|
||||
if (v9 >= ride_music_params->volume) {
|
||||
v9 = ride_music_params->volume;
|
||||
@@ -3490,17 +3490,17 @@ void ride_music_update_final()
|
||||
if (v8 <= 2) {
|
||||
break;
|
||||
}
|
||||
edi->rideid = -1;
|
||||
edi->ride_id = -1;
|
||||
}
|
||||
|
||||
// stop currently playing music that is not in music params list or not playing?
|
||||
rct_ride_music* ride_music = &gRideMusicList[0];
|
||||
int channel = 0;
|
||||
do {
|
||||
if (ride_music->rideid != (uint8)-1) {
|
||||
if (ride_music->ride_id != (uint8)-1) {
|
||||
rct_ride_music_params* ride_music_params = &gRideMusicParamsList[0];
|
||||
while (ride_music_params < gRideMusicParamsListEnd) {
|
||||
if (ride_music_params->rideid == ride_music->rideid && ride_music_params->tuneid == ride_music->tuneid) {
|
||||
if (ride_music_params->ride_id == ride_music->ride_id && ride_music_params->tune_id == ride_music->tune_id) {
|
||||
int isplaying = Mixer_Channel_IsPlaying(gRideMusicList[channel].sound_channel);
|
||||
if (isplaying) {
|
||||
goto label32;
|
||||
@@ -3510,7 +3510,7 @@ void ride_music_update_final()
|
||||
ride_music_params++;
|
||||
}
|
||||
Mixer_Stop_Channel(gRideMusicList[channel].sound_channel);
|
||||
ride_music->rideid = -1;
|
||||
ride_music->ride_id = -1;
|
||||
}
|
||||
label32:
|
||||
ride_music++;
|
||||
@@ -3518,28 +3518,28 @@ void ride_music_update_final()
|
||||
} while(channel < AUDIO_MAX_RIDE_MUSIC);
|
||||
|
||||
for (rct_ride_music_params* ride_music_params = &gRideMusicParamsList[0]; ride_music_params < gRideMusicParamsListEnd; ride_music_params++) {
|
||||
if (ride_music_params->rideid != (uint8)-1) {
|
||||
if (ride_music_params->ride_id != (uint8)-1) {
|
||||
rct_ride_music* ride_music = &gRideMusicList[0];
|
||||
int channel = 0;
|
||||
while (ride_music_params->rideid != ride_music->rideid || ride_music_params->tuneid != ride_music->tuneid) {
|
||||
if (ride_music->rideid == (uint8)-1) {
|
||||
while (ride_music_params->ride_id != ride_music->ride_id || ride_music_params->tune_id != ride_music->tune_id) {
|
||||
if (ride_music->ride_id == (uint8)-1) {
|
||||
ebx = channel;
|
||||
}
|
||||
ride_music++;
|
||||
channel++;
|
||||
if (channel >= AUDIO_MAX_RIDE_MUSIC) {
|
||||
rct_ride_music_info* ride_music_info = ride_music_info_list[ride_music_params->tuneid];
|
||||
rct_ride_music_info* ride_music_info = gRideMusicInfoList[ride_music_params->tune_id];
|
||||
rct_ride_music* ride_music = &gRideMusicList[ebx];
|
||||
ride_music->sound_channel = Mixer_Play_Music(ride_music_info->pathid, MIXER_LOOP_NONE, true);
|
||||
ride_music->sound_channel = Mixer_Play_Music(ride_music_info->path_id, MIXER_LOOP_NONE, true);
|
||||
if (ride_music->sound_channel) {
|
||||
ride_music->volume = ride_music_params->volume;
|
||||
ride_music->pan = ride_music_params->pan;
|
||||
ride_music->freq = ride_music_params->freq;
|
||||
ride_music->rideid = ride_music_params->rideid;
|
||||
ride_music->tuneid = ride_music_params->tuneid;
|
||||
ride_music->frequency = ride_music_params->frequency;
|
||||
ride_music->ride_id = ride_music_params->ride_id;
|
||||
ride_music->tune_id = ride_music_params->tune_id;
|
||||
Mixer_Channel_Volume(ride_music->sound_channel, DStoMixerVolume(ride_music->volume));
|
||||
Mixer_Channel_Pan(ride_music->sound_channel, DStoMixerPan(ride_music->pan));
|
||||
Mixer_Channel_Rate(ride_music->sound_channel, DStoMixerRate(ride_music->freq));
|
||||
Mixer_Channel_Rate(ride_music->sound_channel, DStoMixerRate(ride_music->frequency));
|
||||
int offset = ride_music_params->offset - 10000;
|
||||
if (offset < 0) {
|
||||
offset = 0;
|
||||
@@ -3558,9 +3558,9 @@ void ride_music_update_final()
|
||||
ride_music->pan = ride_music_params->pan;
|
||||
Mixer_Channel_Pan(ride_music->sound_channel, DStoMixerPan(ride_music->pan));
|
||||
}
|
||||
if (ride_music_params->freq != ride_music->freq) {
|
||||
ride_music->freq = ride_music_params->freq;
|
||||
Mixer_Channel_Rate(ride_music->sound_channel, DStoMixerRate(ride_music->freq));
|
||||
if (ride_music_params->frequency != ride_music->frequency) {
|
||||
ride_music->frequency = ride_music_params->frequency;
|
||||
Mixer_Channel_Rate(ride_music->sound_channel, DStoMixerRate(ride_music->frequency));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+2
-2
@@ -3047,7 +3047,7 @@ int save_track_design(uint8 rideIndex){
|
||||
// Track design files
|
||||
format_string(RCT2_ADDRESS(0x141EE68, char), 2305, NULL);
|
||||
|
||||
pause_sounds();
|
||||
audio_pause_sounds();
|
||||
|
||||
int result = platform_open_common_file_dialog(
|
||||
0,
|
||||
@@ -3056,7 +3056,7 @@ int save_track_design(uint8 rideIndex){
|
||||
"*.TD?",
|
||||
RCT2_ADDRESS(0x141EE68, char));
|
||||
|
||||
unpause_sounds();
|
||||
audio_unpause_sounds();
|
||||
|
||||
if (result == 0){
|
||||
ride_list_item item = { .type = 0xFD, .entry_index = 0 };
|
||||
|
||||
+44
-44
@@ -75,25 +75,25 @@ void vehicle_update_sound_params(rct_vehicle* vehicle)
|
||||
*(j + 1) = *j;
|
||||
}
|
||||
i->var_A = v9;
|
||||
int panx = (RCT2_GLOBAL(0x009AF5A0, sint16) / 2) + (RCT2_GLOBAL(0x009AF5A4, sint16) / 2) - RCT2_GLOBAL(0x00F438A4, rct_viewport*)->view_x;
|
||||
panx >>= RCT2_GLOBAL(0x00F438A4, rct_viewport*)->zoom;
|
||||
panx += RCT2_GLOBAL(0x00F438A4, rct_viewport*)->x;
|
||||
int pan_x = (RCT2_GLOBAL(0x009AF5A0, sint16) / 2) + (RCT2_GLOBAL(0x009AF5A4, sint16) / 2) - RCT2_GLOBAL(0x00F438A4, rct_viewport*)->view_x;
|
||||
pan_x >>= RCT2_GLOBAL(0x00F438A4, rct_viewport*)->zoom;
|
||||
pan_x += RCT2_GLOBAL(0x00F438A4, rct_viewport*)->x;
|
||||
|
||||
uint16 screenwidth = RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_WIDTH, uint16);
|
||||
if (screenwidth < 64) {
|
||||
screenwidth = 64;
|
||||
}
|
||||
i->panx = ((((panx << 16) / screenwidth) - 0x8000) >> 4);
|
||||
i->pan_x = ((((pan_x << 16) / screenwidth) - 0x8000) >> 4);
|
||||
|
||||
int pany = (RCT2_GLOBAL(0x009AF5A2, sint16) / 2) + (RCT2_GLOBAL(0x009AF5A6, sint16) / 2) - RCT2_GLOBAL(0x00F438A4, rct_viewport*)->view_y;
|
||||
pany >>= RCT2_GLOBAL(0x00F438A4, rct_viewport*)->zoom;
|
||||
pany += RCT2_GLOBAL(0x00F438A4, rct_viewport*)->y;
|
||||
int pan_y = (RCT2_GLOBAL(0x009AF5A2, sint16) / 2) + (RCT2_GLOBAL(0x009AF5A6, sint16) / 2) - RCT2_GLOBAL(0x00F438A4, rct_viewport*)->view_y;
|
||||
pan_y >>= RCT2_GLOBAL(0x00F438A4, rct_viewport*)->zoom;
|
||||
pan_y += RCT2_GLOBAL(0x00F438A4, rct_viewport*)->y;
|
||||
|
||||
uint16 screenheight = RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_HEIGHT, uint16);
|
||||
if (screenheight < 64) {
|
||||
screenheight = 64;
|
||||
}
|
||||
i->pany = ((((pany << 16) / screenheight) - 0x8000) >> 4);
|
||||
i->pan_y = ((((pan_y << 16) / screenheight) - 0x8000) >> 4);
|
||||
|
||||
sint32 v19 = vehicle->velocity;
|
||||
|
||||
@@ -221,43 +221,43 @@ void vehicle_sounds_update()
|
||||
}
|
||||
uint8 vol1 = 0xFF;
|
||||
uint8 vol2 = 0xFF;
|
||||
sint16 pany = vehicle_sound_params->pany;
|
||||
if (pany < 0) {
|
||||
pany = -pany;
|
||||
sint16 pan_y = vehicle_sound_params->pan_y;
|
||||
if (pan_y < 0) {
|
||||
pan_y = -pan_y;
|
||||
}
|
||||
if (pany > 0xFFF) {
|
||||
pany = 0xFFF;
|
||||
if (pan_y > 0xFFF) {
|
||||
pan_y = 0xFFF;
|
||||
}
|
||||
pany -= 0x800;
|
||||
if (pany > 0) {
|
||||
pany -= 0x400;
|
||||
pany = -pany;
|
||||
pany = pany / 4;
|
||||
vol1 = LOBYTE(pany);
|
||||
if ((sint8)HIBYTE(pany) != 0) {
|
||||
pan_y -= 0x800;
|
||||
if (pan_y > 0) {
|
||||
pan_y -= 0x400;
|
||||
pan_y = -pan_y;
|
||||
pan_y = pan_y / 4;
|
||||
vol1 = LOBYTE(pan_y);
|
||||
if ((sint8)HIBYTE(pan_y) != 0) {
|
||||
vol1 = 0xFF;
|
||||
if ((sint8)HIBYTE(pany) < 0) {
|
||||
if ((sint8)HIBYTE(pan_y) < 0) {
|
||||
vol1 = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
sint16 panx = vehicle_sound_params->panx;
|
||||
if (panx < 0) {
|
||||
panx = -panx;
|
||||
sint16 pan_x = vehicle_sound_params->pan_x;
|
||||
if (pan_x < 0) {
|
||||
pan_x = -pan_x;
|
||||
}
|
||||
if (panx > 0xFFF) {
|
||||
panx = 0xFFF;
|
||||
if (pan_x > 0xFFF) {
|
||||
pan_x = 0xFFF;
|
||||
}
|
||||
panx -= 0x800;
|
||||
if (panx > 0) {
|
||||
panx -= 0x400;
|
||||
panx = -panx;
|
||||
panx = panx / 4;
|
||||
vol2 = LOBYTE(panx);
|
||||
if ((sint8)HIBYTE(panx) != 0) {
|
||||
pan_x -= 0x800;
|
||||
if (pan_x > 0) {
|
||||
pan_x -= 0x400;
|
||||
pan_x = -pan_x;
|
||||
pan_x = pan_x / 4;
|
||||
vol2 = LOBYTE(pan_x);
|
||||
if ((sint8)HIBYTE(pan_x) != 0) {
|
||||
vol2 = 0xFF;
|
||||
if ((sint8)HIBYTE(panx) < 0) {
|
||||
if ((sint8)HIBYTE(pan_x) < 0) {
|
||||
vol2 = 0;
|
||||
}
|
||||
}
|
||||
@@ -331,7 +331,7 @@ void vehicle_sounds_update()
|
||||
Mixer_Stop_Channel(vehicle_sound->sound1_channel);
|
||||
label69:
|
||||
vehicle_sound->sound1_id = sprite->vehicle.sound1_id;
|
||||
vehicle_sound->sound1_pan = vehicle_sound_params->panx;
|
||||
vehicle_sound->sound1_pan = vehicle_sound_params->pan_x;
|
||||
vehicle_sound->sound1_volume = volume;
|
||||
vehicle_sound->sound1_freq = vehicle_sound_params->frequency;
|
||||
uint16 frequency = vehicle_sound_params->frequency;
|
||||
@@ -339,7 +339,7 @@ void vehicle_sounds_update()
|
||||
frequency = (frequency / 2) + 4000;
|
||||
}
|
||||
uint8 looping = RCT2_ADDRESS(0x009AF51E, uint8)[2 * sprite->vehicle.sound1_id];
|
||||
int pan = vehicle_sound_params->panx;
|
||||
int pan = vehicle_sound_params->pan_x;
|
||||
vehicle_sound->sound1_channel = Mixer_Play_Effect(sprite->vehicle.sound1_id, looping ? MIXER_LOOP_INFINITE : MIXER_LOOP_NONE, DStoMixerVolume(volume), DStoMixerPan(pan), DStoMixerRate(frequency), 0);
|
||||
goto label87;
|
||||
}
|
||||
@@ -347,9 +347,9 @@ void vehicle_sounds_update()
|
||||
vehicle_sound->sound1_volume = volume;
|
||||
Mixer_Channel_Volume(vehicle_sound->sound1_channel, DStoMixerVolume(volume));
|
||||
}
|
||||
if (vehicle_sound_params->panx != vehicle_sound->sound1_pan) {
|
||||
vehicle_sound->sound1_pan = vehicle_sound_params->panx;
|
||||
Mixer_Channel_Pan(vehicle_sound->sound1_channel, DStoMixerPan(vehicle_sound_params->panx));
|
||||
if (vehicle_sound_params->pan_x != vehicle_sound->sound1_pan) {
|
||||
vehicle_sound->sound1_pan = vehicle_sound_params->pan_x;
|
||||
Mixer_Channel_Pan(vehicle_sound->sound1_channel, DStoMixerPan(vehicle_sound_params->pan_x));
|
||||
}
|
||||
if (!(RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_TICKS, uint32) & 3) && vehicle_sound_params->frequency != vehicle_sound->sound1_freq) {
|
||||
vehicle_sound->sound1_freq = vehicle_sound_params->frequency;
|
||||
@@ -382,7 +382,7 @@ void vehicle_sounds_update()
|
||||
Mixer_Stop_Channel(vehicle_sound->sound2_channel);
|
||||
label93:
|
||||
vehicle_sound->sound2_id = sprite->vehicle.sound2_id;
|
||||
vehicle_sound->sound2_pan = vehicle_sound_params->panx;
|
||||
vehicle_sound->sound2_pan = vehicle_sound_params->pan_x;
|
||||
vehicle_sound->sound2_volume = volume;
|
||||
vehicle_sound->sound2_freq = vehicle_sound_params->frequency;
|
||||
uint16 frequency = vehicle_sound_params->frequency;
|
||||
@@ -394,7 +394,7 @@ void vehicle_sounds_update()
|
||||
frequency = 25700;
|
||||
}
|
||||
uint8 looping = RCT2_ADDRESS(0x009AF51E, uint8)[2 * sprite->vehicle.sound2_id];
|
||||
int pan = vehicle_sound_params->panx;
|
||||
int pan = vehicle_sound_params->pan_x;
|
||||
vehicle_sound->sound2_channel = Mixer_Play_Effect(sprite->vehicle.sound2_id, looping ? MIXER_LOOP_INFINITE : MIXER_LOOP_NONE, DStoMixerVolume(volume), DStoMixerPan(pan), DStoMixerRate(frequency), 0);
|
||||
goto label114;
|
||||
}
|
||||
@@ -402,9 +402,9 @@ void vehicle_sounds_update()
|
||||
Mixer_Channel_Volume(vehicle_sound->sound2_channel, DStoMixerVolume(volume));
|
||||
vehicle_sound->sound2_volume = volume;
|
||||
}
|
||||
if (vehicle_sound_params->panx != vehicle_sound->sound2_pan) {
|
||||
vehicle_sound->sound2_pan = vehicle_sound_params->panx;
|
||||
Mixer_Channel_Pan(vehicle_sound->sound2_channel, DStoMixerPan(vehicle_sound_params->panx));
|
||||
if (vehicle_sound_params->pan_x != vehicle_sound->sound2_pan) {
|
||||
vehicle_sound->sound2_pan = vehicle_sound_params->pan_x;
|
||||
Mixer_Channel_Pan(vehicle_sound->sound2_channel, DStoMixerPan(vehicle_sound_params->pan_x));
|
||||
}
|
||||
if (!(RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_TICKS, uint32) & 3) && vehicle_sound_params->frequency != vehicle_sound->sound2_freq) {
|
||||
vehicle_sound->sound2_freq = vehicle_sound_params->frequency;
|
||||
|
||||
+3
-3
@@ -125,8 +125,8 @@ void title_load()
|
||||
window_staff_list_init_vars();
|
||||
map_update_tile_pointers();
|
||||
reset_0x69EBE4();
|
||||
stop_ride_music();
|
||||
stop_crowd_sound();
|
||||
audio_stop_ride_music();
|
||||
audio_stop_crowd_sound();
|
||||
//stop_other_sounds();
|
||||
viewport_init_all();
|
||||
news_item_init_queue();
|
||||
@@ -505,7 +505,7 @@ void title_update()
|
||||
for (i = 0; i < numUpdates; i++) {
|
||||
game_logic_update();
|
||||
}
|
||||
start_title_music();
|
||||
audio_start_title_music();
|
||||
}
|
||||
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_INPUT_FLAGS, uint32) &= ~0x80;
|
||||
|
||||
@@ -336,9 +336,9 @@ static int show_save_scenario_dialog(char *resultPath)
|
||||
strcat(filename, ".SC6");
|
||||
format_string(filterName, STR_RCT2_SCENARIO_FILE, NULL);
|
||||
|
||||
pause_sounds();
|
||||
audio_pause_sounds();
|
||||
result = platform_open_common_file_dialog(0, title, filename, "*.SC6", filterName);
|
||||
unpause_sounds();
|
||||
audio_unpause_sounds();
|
||||
|
||||
if (result)
|
||||
safe_strncpy(resultPath, filename, MAX_PATH);
|
||||
|
||||
@@ -973,7 +973,7 @@ static void window_editor_object_selection_scroll_mousedown(rct_window *w, int s
|
||||
|
||||
window_invalidate(w);
|
||||
|
||||
sound_play_panned(SOUND_CLICK_1, RCT2_GLOBAL(0x142406C,uint32), 0, 0, 0);
|
||||
audio_play_sound_panned(SOUND_CLICK_1, RCT2_GLOBAL(0x142406C,uint32), 0, 0, 0);
|
||||
|
||||
|
||||
if (RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & SCREEN_FLAGS_TRACK_MANAGER) {
|
||||
|
||||
+1
-1
@@ -138,7 +138,7 @@ void window_error_open(rct_string_id title, rct_string_id message)
|
||||
w->widgets = window_error_widgets;
|
||||
w->error.var_480 = 0;
|
||||
if (!(RCT2_GLOBAL(0x009A8C29, uint8) & 1))
|
||||
sound_play_panned(SOUND_ERROR, 0, w->x + (w->width / 2), 0, 0);
|
||||
audio_play_sound_panned(SOUND_ERROR, 0, w->x + (w->width / 2), 0, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -768,7 +768,7 @@ static void window_footpath_place_path_at_point(int x, int y)
|
||||
// bp = RCT2_ADDRESS_COMMAND_MAP_Z
|
||||
// dx = RCT2_ADDRESS_COMMAND_MAP_Y
|
||||
// cx = RCT2_ADDRESS_COMMAND_MAP_X
|
||||
sound_play_panned(SOUND_PLACE_ITEM, 0x8001, RCT2_GLOBAL(RCT2_ADDRESS_COMMAND_MAP_X, uint16), RCT2_GLOBAL(RCT2_ADDRESS_COMMAND_MAP_Y, uint16), RCT2_GLOBAL(RCT2_ADDRESS_COMMAND_MAP_Z, uint16));
|
||||
audio_play_sound_at_location(SOUND_PLACE_ITEM, RCT2_GLOBAL(RCT2_ADDRESS_COMMAND_MAP_X, uint16), RCT2_GLOBAL(RCT2_ADDRESS_COMMAND_MAP_Y, uint16), RCT2_GLOBAL(RCT2_ADDRESS_COMMAND_MAP_Z, uint16));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -852,9 +852,8 @@ static void window_footpath_construct()
|
||||
cost = footpath_place(type, x, y, z, slope, GAME_COMMAND_FLAG_APPLY);
|
||||
|
||||
if (cost != MONEY32_UNDEFINED) {
|
||||
sound_play_panned(
|
||||
audio_play_sound_at_location(
|
||||
SOUND_PLACE_ITEM,
|
||||
0x8001,
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_CONSTRUCT_PATH_FROM_X, uint16),
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_CONSTRUCT_PATH_FROM_Y, uint16),
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_CONSTRUCT_PATH_FROM_Z, uint16)
|
||||
|
||||
@@ -159,7 +159,7 @@ static void window_install_track_select(rct_window *w, int index)
|
||||
|
||||
w->track_list.var_480 = index;
|
||||
|
||||
sound_play_panned(SOUND_CLICK_1, w->x + (w->width / 2), 0, 0, 0);
|
||||
audio_play_sound_panned(SOUND_CLICK_1, w->x + (w->width / 2), 0, 0, 0);
|
||||
if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & SCREEN_FLAGS_TRACK_MANAGER) && index == 0) {
|
||||
window_close(w);
|
||||
ride_construct_new(_window_install_track_item);
|
||||
|
||||
+1
-2
@@ -1289,9 +1289,8 @@ static void window_map_place_park_entrance_tool_down(int x, int y)
|
||||
if (price == MONEY32_UNDEFINED)
|
||||
return;
|
||||
|
||||
sound_play_panned(
|
||||
audio_play_sound_at_location(
|
||||
SOUND_PLACE_ITEM,
|
||||
0x8001,
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_COMMAND_MAP_Z, uint16),
|
||||
RCT2_GLOBAL(0x009DEA64, uint16),
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_AGE, uint16)
|
||||
|
||||
@@ -371,9 +371,8 @@ static void window_maze_construction_entrance_tooldown(int x, int y, rct_window*
|
||||
if (cost == MONEY32_UNDEFINED)
|
||||
return;
|
||||
|
||||
sound_play_panned(
|
||||
audio_play_sound_at_location(
|
||||
SOUND_PLACE_ITEM,
|
||||
0x8001,
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_COMMAND_MAP_X, sint16),
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_COMMAND_MAP_Y, sint16),
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_COMMAND_MAP_Z, uint16));
|
||||
@@ -509,6 +508,6 @@ static void window_maze_construction_construct(int direction)
|
||||
_currentTrackBeginX = x;
|
||||
_currentTrackBeginY = y;
|
||||
if (_rideConstructionState != 7) {
|
||||
sound_play_panned(SOUND_PLACE_ITEM, 0x8001, x, y, z);
|
||||
audio_play_sound_at_location(SOUND_PLACE_ITEM, x, y, z);
|
||||
}
|
||||
}
|
||||
@@ -688,7 +688,7 @@ static void window_new_ride_scrollmousedown(rct_window *w, int scrollIndex, int
|
||||
RCT2_ADDRESS(RCT2_ADDRESS_WINDOW_RIDE_LIST_HIGHLIGHTED_ITEM, ride_list_item)[_window_new_ride_current_tab] = item;
|
||||
w->new_ride.selected_ride_id = *((sint16*)&item);
|
||||
|
||||
sound_play_panned(SOUND_CLICK_1, w->x + (w->width / 2), 0, 0, 0);
|
||||
audio_play_sound_panned(SOUND_CLICK_1, w->x + (w->width / 2), 0, 0, 0);
|
||||
w->new_ride.selected_ride_countdown = 8;
|
||||
window_invalidate(w);
|
||||
}
|
||||
|
||||
+2
-2
@@ -147,7 +147,7 @@ static void window_news_update(rct_window *w)
|
||||
return;
|
||||
|
||||
window_invalidate(w);
|
||||
sound_play_panned(SOUND_CLICK_2, w->x + (w->width / 2), 0, 0, 0);
|
||||
audio_play_sound_panned(SOUND_CLICK_2, w->x + (w->width / 2), 0, 0, 0);
|
||||
|
||||
j = w->news.var_480;
|
||||
w->news.var_480 = -1;
|
||||
@@ -239,7 +239,7 @@ static void window_news_scrollmousedown(rct_window *w, int scrollIndex, int x, i
|
||||
w->news.var_482 = buttonIndex;
|
||||
w->news.var_484 = 4;
|
||||
window_invalidate(w);
|
||||
sound_play_panned(SOUND_CLICK_1, w->x + (w->width / 2), 0, 0, 0);
|
||||
audio_play_sound_panned(SOUND_CLICK_1, w->x + (w->width / 2), 0, 0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -552,14 +552,14 @@ static void window_options_mouseup(rct_window *w, int widgetIndex)
|
||||
case WINDOW_OPTIONS_PAGE_AUDIO:
|
||||
switch (widgetIndex) {
|
||||
case WIDX_SOUND_CHECKBOX:
|
||||
toggle_all_sounds();
|
||||
audio_toggle_all_sounds();
|
||||
config_save_default();
|
||||
window_invalidate(w);
|
||||
break;
|
||||
case WIDX_MUSIC_CHECKBOX:
|
||||
gConfigSound.ride_music = !gConfigSound.ride_music;
|
||||
if (!gConfigSound.ride_music) {
|
||||
stop_ride_music();
|
||||
audio_stop_ride_music();
|
||||
}
|
||||
config_save_default();
|
||||
window_invalidate(w);
|
||||
@@ -852,7 +852,7 @@ static void window_options_mousedown(int widgetIndex, rct_window*w, rct_widget*
|
||||
case WINDOW_OPTIONS_PAGE_AUDIO:
|
||||
switch (widgetIndex) {
|
||||
case WIDX_SOUND_DROPDOWN:
|
||||
audio_get_devices();
|
||||
audio_populate_devices();
|
||||
|
||||
// populate the list with the sound devices
|
||||
for (i = 0; i < gAudioDeviceCount; i++) {
|
||||
@@ -1069,7 +1069,7 @@ static void window_options_dropdown(rct_window *w, int widgetIndex, int dropdown
|
||||
case WINDOW_OPTIONS_PAGE_AUDIO:
|
||||
switch (widgetIndex) {
|
||||
case WIDX_SOUND_DROPDOWN:
|
||||
audio_init2(dropdownIndex);
|
||||
audio_init_ride_sounds(dropdownIndex);
|
||||
if (dropdownIndex < gAudioDeviceCount) {
|
||||
if (dropdownIndex == 0) {
|
||||
Mixer_Init(NULL);
|
||||
@@ -1095,9 +1095,9 @@ static void window_options_dropdown(rct_window *w, int widgetIndex, int dropdown
|
||||
window_invalidate(w);
|
||||
}
|
||||
|
||||
stop_title_music();
|
||||
audio_stop_title_music();
|
||||
if (dropdownIndex != 0)
|
||||
start_title_music();
|
||||
audio_start_title_music();
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
+4
-4
@@ -4433,9 +4433,9 @@ static void window_ride_music_mousedown(int widgetIndex, rct_window *w, rct_widg
|
||||
for (i = 0; i < countof(MusicStyleOrder); i++)
|
||||
window_ride_current_music_style_order[numItems++] = MusicStyleOrder[i];
|
||||
|
||||
if (ride_music_info_list[36]->length != 0)
|
||||
if (gRideMusicInfoList[36]->length != 0)
|
||||
window_ride_current_music_style_order[numItems++] = MUSIC_STYLE_CUSTOM_MUSIC_1;
|
||||
if (ride_music_info_list[37]->length != 0)
|
||||
if (gRideMusicInfoList[37]->length != 0)
|
||||
window_ride_current_music_style_order[numItems++] = MUSIC_STYLE_CUSTOM_MUSIC_2;
|
||||
}
|
||||
|
||||
@@ -4550,7 +4550,7 @@ static void window_ride_music_paint(rct_window *w, rct_drawpixelinfo *dpi)
|
||||
static void cancel_scenery_selection(){
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_GAME_PAUSED, uint8) &= ~(1 << 2);
|
||||
RCT2_GLOBAL(0x9DEA6F, uint8) &= ~(1 << 0);
|
||||
unpause_sounds();
|
||||
audio_unpause_sounds();
|
||||
|
||||
rct_window* main_w = window_get_main();
|
||||
|
||||
@@ -4579,7 +4579,7 @@ static void setup_scenery_selection(rct_window* w){
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_GAME_PAUSED, uint8) |= (1 << 2);
|
||||
RCT2_GLOBAL(0x009DEA6F, uint8) |= 1;
|
||||
|
||||
pause_sounds();
|
||||
audio_pause_sounds();
|
||||
|
||||
rct_window* w_main = window_get_main();
|
||||
|
||||
|
||||
@@ -1594,7 +1594,7 @@ static void window_ride_construction_construct(rct_window *w)
|
||||
return;
|
||||
}
|
||||
|
||||
sound_play_panned(SOUND_PLACE_ITEM, 0x8001, x, y, z);
|
||||
audio_play_sound_at_location(SOUND_PLACE_ITEM, x, y, z);
|
||||
|
||||
if (RCT2_GLOBAL(RCT2_ADDRESS_ABOVE_GROUND_FLAGS, uint8) & TRACK_ELEMENT_LOCATION_IS_UNDERGROUND) {
|
||||
viewport_set_visibility(1);
|
||||
@@ -3554,7 +3554,7 @@ void ride_construction_tooldown_construct(int screenX, int screenY)
|
||||
zAttempts == 0 ||
|
||||
z < 0
|
||||
) {
|
||||
sound_play_panned(SOUND_ERROR, RCT2_GLOBAL(0x0142406C, sint32), x, y, z);
|
||||
audio_play_sound_panned(SOUND_ERROR, RCT2_GLOBAL(0x0142406C, sint32), x, y, z);
|
||||
w = window_find_by_class(WC_RIDE_CONSTRUCTION);
|
||||
if (w != NULL){
|
||||
tool_set(w, 23, 12);
|
||||
@@ -3571,7 +3571,7 @@ void ride_construction_tooldown_construct(int screenX, int screenY)
|
||||
}
|
||||
else {
|
||||
window_close_by_class(WC_ERROR);
|
||||
sound_play_panned(SOUND_PLACE_ITEM, 0x8001, _currentTrackBeginX, _currentTrackBeginY, _currentTrackBeginZ);
|
||||
audio_play_sound_at_location(SOUND_PLACE_ITEM, _currentTrackBeginX, _currentTrackBeginY, _currentTrackBeginZ);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -3626,7 +3626,7 @@ void ride_construction_tooldown_construct(int screenX, int screenY)
|
||||
_currentTrackCovered = saveCurrentTrackCovered;
|
||||
_currentTrackLiftHill = saveCurrentTrackLiftHill;
|
||||
|
||||
sound_play_panned(SOUND_ERROR, RCT2_GLOBAL(0x0142406C, sint32), x, y, z);
|
||||
audio_play_sound_panned(SOUND_ERROR, RCT2_GLOBAL(0x0142406C, sint32), x, y, z);
|
||||
break;
|
||||
} else if (zAttempts >= 0) {
|
||||
z += 16;
|
||||
@@ -3680,9 +3680,8 @@ static void ride_construction_tooldown_entrance_exit(int screenX, int screenY)
|
||||
return;
|
||||
}
|
||||
|
||||
sound_play_panned(
|
||||
audio_play_sound_at_location(
|
||||
SOUND_PLACE_ITEM,
|
||||
0x8001,
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_COMMAND_MAP_X, uint16),
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_COMMAND_MAP_Y, uint16),
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_COMMAND_MAP_Z, uint16)
|
||||
|
||||
@@ -192,7 +192,7 @@ void window_save_prompt_open()
|
||||
|
||||
// Pause the game
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_GAME_PAUSED, uint8) |= 2;
|
||||
pause_sounds();
|
||||
audio_pause_sounds();
|
||||
window_invalidate_by_class(WC_TOP_TOOLBAR);
|
||||
|
||||
stringId = prompt_mode + STR_LOAD_GAME_PROMPT_TITLE;
|
||||
@@ -212,7 +212,7 @@ static void window_save_prompt_close(rct_window *w)
|
||||
{
|
||||
// Unpause the game
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_GAME_PAUSED, uint8) &= ~2;
|
||||
unpause_sounds();
|
||||
audio_unpause_sounds();
|
||||
window_invalidate_by_class(WC_TOP_TOOLBAR);
|
||||
}
|
||||
|
||||
|
||||
@@ -795,7 +795,7 @@ void window_scenery_scrollmousedown(rct_window *w, int scrollIndex, int x, int y
|
||||
window_scenery_selected_scenery_by_tab[tabIndex] = sceneryId;
|
||||
|
||||
window_scenery_is_repaint_scenery_tool_on &= 0xFE;
|
||||
sound_play_panned(4, (w->width >> 1) + w->x, 0, 0, 0);
|
||||
audio_play_sound_panned(4, (w->width >> 1) + w->x, 0, 0, 0);
|
||||
w->scenery.hover_counter = -16;
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_SCENERY_COST, uint32) = MONEY32_UNDEFINED;
|
||||
window_invalidate(w);
|
||||
|
||||
@@ -215,7 +215,7 @@ static void window_scenarioselect_scrollmousedown(rct_window *w, int scrollIndex
|
||||
if (y >= 0)
|
||||
continue;
|
||||
|
||||
sound_play_panned(SOUND_CLICK_1, w->width / 2 + w->x, 0, 0, 0);
|
||||
audio_play_sound_panned(SOUND_CLICK_1, w->width / 2 + w->x, 0, 0, 0);
|
||||
scenario_load_and_play(scenario);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -1479,7 +1479,7 @@ static void window_top_toolbar_scenery_tool_down(short x, short y, rct_window *w
|
||||
|
||||
if (cost != MONEY32_UNDEFINED){
|
||||
window_close_by_class(WC_ERROR);
|
||||
sound_play_panned(SOUND_PLACE_ITEM, 0x8001, RCT2_GLOBAL(RCT2_ADDRESS_COMMAND_MAP_X, uint16), RCT2_GLOBAL(RCT2_ADDRESS_COMMAND_MAP_Y, uint16), RCT2_GLOBAL(RCT2_ADDRESS_COMMAND_MAP_Z, uint16));
|
||||
audio_play_sound_at_location(SOUND_PLACE_ITEM, RCT2_GLOBAL(RCT2_ADDRESS_COMMAND_MAP_X, uint16), RCT2_GLOBAL(RCT2_ADDRESS_COMMAND_MAP_Y, uint16), RCT2_GLOBAL(RCT2_ADDRESS_COMMAND_MAP_Z, uint16));
|
||||
success = true;
|
||||
break;
|
||||
}
|
||||
@@ -1507,7 +1507,7 @@ static void window_top_toolbar_scenery_tool_down(short x, short y, rct_window *w
|
||||
if (successfulPlacements > 0) {
|
||||
window_close_by_class(WC_ERROR);
|
||||
} else {
|
||||
sound_play_panned(SOUND_ERROR, 0x8001, RCT2_GLOBAL(RCT2_ADDRESS_COMMAND_MAP_X, uint16), RCT2_GLOBAL(RCT2_ADDRESS_COMMAND_MAP_Y, uint16), RCT2_GLOBAL(RCT2_ADDRESS_COMMAND_MAP_Z, uint16));
|
||||
audio_play_sound_at_location(SOUND_ERROR, RCT2_GLOBAL(RCT2_ADDRESS_COMMAND_MAP_X, uint16), RCT2_GLOBAL(RCT2_ADDRESS_COMMAND_MAP_Y, uint16), RCT2_GLOBAL(RCT2_ADDRESS_COMMAND_MAP_Z, uint16));
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -1518,7 +1518,7 @@ static void window_top_toolbar_scenery_tool_down(short x, short y, rct_window *w
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TITLE, rct_string_id) = STR_CANT_POSITION_THIS_HERE;
|
||||
int cost = game_do_command(gridX, flags, gridY, parameter_2, GAME_COMMAND_PLACE_PATH, parameter_3, 0);
|
||||
if (cost != MONEY32_UNDEFINED) {
|
||||
sound_play_panned(SOUND_PLACE_ITEM, 0x8001, RCT2_GLOBAL(RCT2_ADDRESS_COMMAND_MAP_X, uint16), RCT2_GLOBAL(RCT2_ADDRESS_COMMAND_MAP_Y, uint16), RCT2_GLOBAL(RCT2_ADDRESS_COMMAND_MAP_Z, uint16));
|
||||
audio_play_sound_at_location(SOUND_PLACE_ITEM, RCT2_GLOBAL(RCT2_ADDRESS_COMMAND_MAP_X, uint16), RCT2_GLOBAL(RCT2_ADDRESS_COMMAND_MAP_Y, uint16), RCT2_GLOBAL(RCT2_ADDRESS_COMMAND_MAP_Z, uint16));
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -1542,7 +1542,7 @@ static void window_top_toolbar_scenery_tool_down(short x, short y, rct_window *w
|
||||
|
||||
if (cost != MONEY32_UNDEFINED){
|
||||
window_close_by_class(WC_ERROR);
|
||||
sound_play_panned(SOUND_PLACE_ITEM, 0x8001, RCT2_GLOBAL(RCT2_ADDRESS_COMMAND_MAP_X, uint16), RCT2_GLOBAL(RCT2_ADDRESS_COMMAND_MAP_Y, uint16), RCT2_GLOBAL(RCT2_ADDRESS_COMMAND_MAP_Z, uint16));
|
||||
audio_play_sound_at_location(SOUND_PLACE_ITEM, RCT2_GLOBAL(RCT2_ADDRESS_COMMAND_MAP_X, uint16), RCT2_GLOBAL(RCT2_ADDRESS_COMMAND_MAP_Y, uint16), RCT2_GLOBAL(RCT2_ADDRESS_COMMAND_MAP_Z, uint16));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1556,7 +1556,7 @@ static void window_top_toolbar_scenery_tool_down(short x, short y, rct_window *w
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_SCENERY_Z_COORDINATE, sint16) += 8;
|
||||
}
|
||||
|
||||
sound_play_panned(SOUND_ERROR, 0x8001, RCT2_GLOBAL(RCT2_ADDRESS_COMMAND_MAP_X, uint16), RCT2_GLOBAL(RCT2_ADDRESS_COMMAND_MAP_Y, uint16), RCT2_GLOBAL(RCT2_ADDRESS_COMMAND_MAP_Z, uint16));
|
||||
audio_play_sound_at_location(SOUND_ERROR, RCT2_GLOBAL(RCT2_ADDRESS_COMMAND_MAP_X, uint16), RCT2_GLOBAL(RCT2_ADDRESS_COMMAND_MAP_Y, uint16), RCT2_GLOBAL(RCT2_ADDRESS_COMMAND_MAP_Z, uint16));
|
||||
break;
|
||||
}
|
||||
case SCENERY_TYPE_LARGE:
|
||||
@@ -1579,7 +1579,7 @@ static void window_top_toolbar_scenery_tool_down(short x, short y, rct_window *w
|
||||
|
||||
if (cost != MONEY32_UNDEFINED){
|
||||
window_close_by_class(WC_ERROR);
|
||||
sound_play_panned(SOUND_PLACE_ITEM, 0x8001, RCT2_GLOBAL(RCT2_ADDRESS_COMMAND_MAP_X, uint16), RCT2_GLOBAL(RCT2_ADDRESS_COMMAND_MAP_Y, uint16), RCT2_GLOBAL(RCT2_ADDRESS_COMMAND_MAP_Z, uint16));
|
||||
audio_play_sound_at_location(SOUND_PLACE_ITEM, RCT2_GLOBAL(RCT2_ADDRESS_COMMAND_MAP_X, uint16), RCT2_GLOBAL(RCT2_ADDRESS_COMMAND_MAP_Y, uint16), RCT2_GLOBAL(RCT2_ADDRESS_COMMAND_MAP_Z, uint16));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1593,7 +1593,7 @@ static void window_top_toolbar_scenery_tool_down(short x, short y, rct_window *w
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_SCENERY_Z_COORDINATE, sint16) += 8;
|
||||
}
|
||||
|
||||
sound_play_panned(SOUND_ERROR, 0x8001, RCT2_GLOBAL(RCT2_ADDRESS_COMMAND_MAP_X, uint16), RCT2_GLOBAL(RCT2_ADDRESS_COMMAND_MAP_Y, uint16), RCT2_GLOBAL(RCT2_ADDRESS_COMMAND_MAP_Z, uint16));
|
||||
audio_play_sound_at_location(SOUND_ERROR, RCT2_GLOBAL(RCT2_ADDRESS_COMMAND_MAP_X, uint16), RCT2_GLOBAL(RCT2_ADDRESS_COMMAND_MAP_Y, uint16), RCT2_GLOBAL(RCT2_ADDRESS_COMMAND_MAP_Z, uint16));
|
||||
break;
|
||||
}
|
||||
case SCENERY_TYPE_BANNER:
|
||||
@@ -1613,7 +1613,7 @@ static void window_top_toolbar_scenery_tool_down(short x, short y, rct_window *w
|
||||
if (cost != MONEY32_UNDEFINED) {
|
||||
int bannerId = regs.edi;
|
||||
|
||||
sound_play_panned(SOUND_PLACE_ITEM, 0x8001, RCT2_GLOBAL(RCT2_ADDRESS_COMMAND_MAP_X, uint16), RCT2_GLOBAL(RCT2_ADDRESS_COMMAND_MAP_Y, uint16), RCT2_GLOBAL(RCT2_ADDRESS_COMMAND_MAP_Z, uint16));
|
||||
audio_play_sound_at_location(SOUND_PLACE_ITEM, RCT2_GLOBAL(RCT2_ADDRESS_COMMAND_MAP_X, uint16), RCT2_GLOBAL(RCT2_ADDRESS_COMMAND_MAP_Y, uint16), RCT2_GLOBAL(RCT2_ADDRESS_COMMAND_MAP_Z, uint16));
|
||||
window_banner_open(bannerId);
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -158,7 +158,7 @@ static void window_track_list_select(rct_window *w, int index)
|
||||
|
||||
w->track_list.var_480 = index;
|
||||
|
||||
sound_play_panned(SOUND_CLICK_1, w->x + (w->width / 2), 0, 0, 0);
|
||||
audio_play_sound_panned(SOUND_CLICK_1, w->x + (w->width / 2), 0, 0, 0);
|
||||
if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & SCREEN_FLAGS_TRACK_MANAGER) && index == 0) {
|
||||
window_close(w);
|
||||
ride_construct_new(_window_track_list_item);
|
||||
|
||||
@@ -541,7 +541,7 @@ static void window_track_place_tooldown(rct_window* w, int widgetIndex, int x, i
|
||||
|
||||
if (cost != MONEY32_UNDEFINED) {
|
||||
window_close_by_class(WC_ERROR);
|
||||
sound_play_panned(SOUND_PLACE_ITEM, 0x8001, mapX, mapY, mapZ);
|
||||
audio_play_sound_at_location(SOUND_PLACE_ITEM, mapX, mapY, mapZ);
|
||||
|
||||
RCT2_GLOBAL(0x00F440A7, uint8) = rideIndex;
|
||||
if (RCT2_GLOBAL(0x00F4414E, uint8) & 1) {
|
||||
@@ -563,7 +563,7 @@ static void window_track_place_tooldown(rct_window* w, int widgetIndex, int x, i
|
||||
}
|
||||
|
||||
// Unable to build track
|
||||
sound_play_panned(SOUND_ERROR, 0x8001, mapX, mapY, mapZ);
|
||||
audio_play_sound_at_location(SOUND_ERROR, mapX, mapY, mapZ);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+1
-1
@@ -26,7 +26,7 @@ void balloon_pop(rct_balloon *balloon)
|
||||
{
|
||||
balloon->popped = 1;
|
||||
balloon->var_26 = 0;
|
||||
sound_play_panned(SOUND_BALLOON_POP, 0x8001, balloon->x, balloon->y, balloon->z);
|
||||
audio_play_sound_at_location(SOUND_BALLOON_POP, balloon->x, balloon->y, balloon->z);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+2
-8
@@ -108,10 +108,7 @@ void climate_reset(int climate)
|
||||
_lightningTimer = 0;
|
||||
_thunderTimer = 0;
|
||||
if (_rainVolume != 1){
|
||||
if (gRainSoundChannel) {
|
||||
Mixer_Stop_Channel(gRainSoundChannel);
|
||||
gRainSoundChannel = 0;
|
||||
}
|
||||
audio_stop_rain_sound();
|
||||
_rainVolume = 1;
|
||||
}
|
||||
|
||||
@@ -272,10 +269,7 @@ static void climate_update_rain_sound()
|
||||
Mixer_Channel_Volume(gRainSoundChannel, DStoMixerVolume(_rainVolume));
|
||||
}
|
||||
} else {
|
||||
if (gRainSoundChannel) {
|
||||
Mixer_Stop_Channel(gRainSoundChannel);
|
||||
gRainSoundChannel = 0;
|
||||
}
|
||||
audio_stop_rain_sound();
|
||||
_rainVolume = 1;
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -288,7 +288,7 @@ static void duck_update_fly_away(rct_duck *duck)
|
||||
*/
|
||||
void duck_press(rct_duck *duck)
|
||||
{
|
||||
sound_play_panned(SOUND_QUACK, 0x8001, duck->x, duck->y, duck->z);
|
||||
audio_play_sound_at_location(SOUND_QUACK, duck->x, duck->y, duck->z);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+6
-6
@@ -1606,7 +1606,7 @@ money32 map_set_land_ownership(uint8 flags, sint16 x1, sint16 y1, sint16 x2, sin
|
||||
y += 16;
|
||||
|
||||
sint16 z = map_element_height(x, y) & 0xFFFF;
|
||||
sound_play_panned(SOUND_PLACE_ITEM, 0x8001, x, y, z);
|
||||
audio_play_sound_at_location(SOUND_PLACE_ITEM, x, y, z);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1629,7 +1629,7 @@ money32 raise_land(int flags, int x, int y, int z, int ax, int ay, int bx, int b
|
||||
money32 cost = 0;
|
||||
|
||||
if ((flags & GAME_COMMAND_FLAG_APPLY) && RCT2_GLOBAL(0x009A8C28, uint8) == 1) {
|
||||
sound_play_panned(SOUND_PLACE_ITEM, 0x8001, x, y, z);
|
||||
audio_play_sound_at_location(SOUND_PLACE_ITEM, x, y, z);
|
||||
}
|
||||
|
||||
uint8 min_height = 0xFF;
|
||||
@@ -1685,7 +1685,7 @@ money32 lower_land(int flags, int x, int y, int z, int ax, int ay, int bx, int b
|
||||
money32 cost = 0;
|
||||
|
||||
if ((flags & GAME_COMMAND_FLAG_APPLY) && RCT2_GLOBAL(0x009A8C28, uint8) == 1) {
|
||||
sound_play_panned(SOUND_PLACE_ITEM, 0x8001, x, y, z);
|
||||
audio_play_sound_at_location(SOUND_PLACE_ITEM, x, y, z);
|
||||
}
|
||||
|
||||
uint8 max_height = 0;
|
||||
@@ -1808,7 +1808,7 @@ money32 raise_water(sint16 x0, sint16 y0, sint16 x1, sint16 y1, uint8 flags)
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_COMMAND_MAP_X, uint32) = x;
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_COMMAND_MAP_Y, uint32) = y;
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_COMMAND_MAP_Z, uint32) = z;
|
||||
sound_play_panned(SOUND_LAYING_OUT_WATER, 0x8001, x, y, z);
|
||||
audio_play_sound_at_location(SOUND_LAYING_OUT_WATER, x, y, z);
|
||||
}
|
||||
|
||||
// Force ride construction to recheck area
|
||||
@@ -1873,7 +1873,7 @@ money32 lower_water(sint16 x0, sint16 y0, sint16 x1, sint16 y1, uint8 flags)
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_COMMAND_MAP_X, uint32) = x;
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_COMMAND_MAP_Y, uint32) = y;
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_COMMAND_MAP_Z, uint32) = z;
|
||||
sound_play_panned(SOUND_LAYING_OUT_WATER, 0x8001, x, y, z);
|
||||
audio_play_sound_at_location(SOUND_LAYING_OUT_WATER, x, y, z);
|
||||
}
|
||||
|
||||
// Force ride construction to recheck area
|
||||
@@ -2030,7 +2030,7 @@ money32 smooth_land(int flags, int centreX, int centreY, int mapLeft, int mapTop
|
||||
|
||||
// Play sound (only once)
|
||||
if ((flags & GAME_COMMAND_FLAG_APPLY) && RCT2_GLOBAL(0x009A8C28, uint8) == 1) {
|
||||
sound_play_panned(SOUND_PLACE_ITEM, 0x8001, centreX, centreY, centreZ);
|
||||
audio_play_sound_at_location(SOUND_PLACE_ITEM, centreX, centreY, centreZ);
|
||||
}
|
||||
|
||||
money32 totalCost = 0;
|
||||
|
||||
@@ -71,7 +71,7 @@ void crashed_vehicle_particle_update(rct_crashed_vehicle_particle *particle)
|
||||
|
||||
if (waterZ != 0 && particle->z >= waterZ && z <= waterZ) {
|
||||
// Splash
|
||||
sound_play_panned(SOUND_WATER_2, 0x8001, particle->x, particle->y, waterZ);
|
||||
audio_play_sound_at_location(SOUND_WATER_2, particle->x, particle->y, waterZ);
|
||||
crash_splash_create(particle->x, particle->y, waterZ);
|
||||
sprite_remove((rct_sprite*)particle);
|
||||
return;
|
||||
|
||||
Reference in new issue
Block a user