forked from rosebudai/OpenRCT2-Web
Integrate audio related variables (#3322)
This commit is contained in:
1 parent
e5666f214b
commit
c3ba519a6e
8 files changed
+206
-81
No files matched your search
+72
-4
@@ -40,6 +40,7 @@ typedef struct rct_audio_params {
|
||||
|
||||
audio_device *gAudioDevices = NULL;
|
||||
int gAudioDeviceCount;
|
||||
int gAudioCurrentDevice = -1;
|
||||
void *gCrowdSoundChannel = 0;
|
||||
bool gGameSoundsOff = false;
|
||||
void *gRainSoundChannel = 0;
|
||||
@@ -50,6 +51,73 @@ 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;
|
||||
int gVolumeAdjustZoom = 0;
|
||||
|
||||
int _volumeAdjust[SOUND_MAXID] = {
|
||||
0, // SOUND_LIFT_1
|
||||
0, // SOUND_TRACK_FRICTION_1
|
||||
0, // SOUND_LIFT_2
|
||||
0, // SOUND_SCREAM_1
|
||||
0, // SOUND_CLICK_1
|
||||
0, // SOUND_CLICK_2
|
||||
0, // SOUND_PLACE_ITEM
|
||||
0, // SOUND_SCREAM_2
|
||||
0, // SOUND_SCREAM_3
|
||||
0, // SOUND_SCREAM_4
|
||||
0, // SOUND_SCREAM_5
|
||||
0, // SOUND_SCREAM_6
|
||||
0, // SOUND_LIFT_3
|
||||
-400, // SOUND_PURCHASE
|
||||
0, // SOUND_CRASH
|
||||
0, // SOUND_LAYING_OUT_WATER
|
||||
0, // SOUND_WATER_1
|
||||
0, // SOUND_WATER_2
|
||||
0, // SOUND_TRAIN_WHISTLE
|
||||
0, // SOUND_TRAIN_CHUGGING
|
||||
-1000, // SOUND_WATER_SPLASH
|
||||
0, // SOUND_HAMMERING
|
||||
-800, // SOUND_RIDE_LAUNCH_1
|
||||
-1700, // SOUND_RIDE_LAUNCH_2
|
||||
-700, // SOUND_COUGH_1
|
||||
-700, // SOUND_COUGH_2
|
||||
-700, // SOUND_COUGH_3
|
||||
-700, // SOUND_COUGH_4
|
||||
0, // SOUND_RAIN_1
|
||||
0, // SOUND_THUNDER_1
|
||||
0, // SOUND_THUNDER_2
|
||||
0, // SOUND_RAIN_2
|
||||
0, // SOUND_RAIN_3
|
||||
0, // SOUND_BALLOON_POP
|
||||
-700, // SOUND_MECHANIC_FIX
|
||||
0, // SOUND_SCREAM_7
|
||||
-1000, // SOUND_TOILET_FLUSH
|
||||
0, // SOUND_CLICK_3
|
||||
0, // SOUND_QUACK
|
||||
0, // SOUND_NEWS_ITEM
|
||||
0, // SOUND_WINDOW_OPEN
|
||||
-900, // SOUND_LAUGH_1
|
||||
-900, // SOUND_LAUGH_2
|
||||
-900, // SOUND_LAUGH_3
|
||||
0, // SOUND_APPLAUSE
|
||||
-600, // SOUND_HAUNTED_HOUSE_SCARE
|
||||
-700, // SOUND_HAUNTED_HOUSE_SCREAM_1
|
||||
-700, // SOUND_HAUNTED_HOUSE_SCREAM_2
|
||||
-2550, // SOUND_48
|
||||
-2900, // SOUND_49
|
||||
0, // SOUND_ERROR
|
||||
-3400, // SOUND_51
|
||||
0, // SOUND_LIFT_4
|
||||
0, // SOUND_LIFT_5
|
||||
0, // SOUND_TRACK_FRICTION_2
|
||||
0, // SOUND_LIFT_6
|
||||
0, // SOUND_LIFT_7
|
||||
0, // SOUND_TRACK_FRICTION_3
|
||||
0, // SOUND_SCREAM_8
|
||||
0, // SOUND_TRAM
|
||||
-2000, // SOUND_DOOR_OPEN
|
||||
-2700, // SOUND_DOOR_CLOSE
|
||||
-700 // SOUND_62
|
||||
};
|
||||
|
||||
rct_audio_params audio_get_params_from_location(int soundId, const rct_xyz16 *location);
|
||||
void audio_stop_channel(void **channel);
|
||||
@@ -157,7 +225,7 @@ rct_audio_params audio_get_params_from_location(int soundId, const rct_xyz16 *lo
|
||||
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;
|
||||
params.volume = _volumeAdjust[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;
|
||||
@@ -286,7 +354,7 @@ void audio_init_ride_sounds(int device)
|
||||
vehicleSound->id = -1;
|
||||
}
|
||||
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_SOUND_DEVICE, uint32) = device;
|
||||
gAudioCurrentDevice = device;
|
||||
config_save_default();
|
||||
for (int i = 0; i < AUDIO_MAX_RIDE_MUSIC; i++) {
|
||||
rct_ride_music *rideMusic = &gRideMusicList[i];
|
||||
@@ -300,7 +368,7 @@ void audio_close()
|
||||
audio_stop_title_music();
|
||||
audio_stop_ride_music();
|
||||
audio_stop_rain_sound();
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_SOUND_DEVICE, uint32) = -1;
|
||||
gAudioCurrentDevice = -1;
|
||||
}
|
||||
|
||||
void audio_toggle_all_sounds(){
|
||||
@@ -329,7 +397,7 @@ void audio_unpause_sounds()
|
||||
|
||||
void audio_stop_vehicle_sounds()
|
||||
{
|
||||
if (gOpenRCT2Headless || RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_SOUND_DEVICE, sint32) == -1)
|
||||
if (gOpenRCT2Headless || gAudioCurrentDevice == -1)
|
||||
return;
|
||||
|
||||
for (int i = 0; i < countof(gVehicleSoundList); i++) {
|
||||
|
||||
@@ -153,6 +153,7 @@ typedef enum RCT2_SOUND {
|
||||
|
||||
extern audio_device *gAudioDevices;
|
||||
extern int gAudioDeviceCount;
|
||||
extern int gAudioCurrentDevice;
|
||||
extern void *gCrowdSoundChannel;
|
||||
extern bool gGameSoundsOff;
|
||||
extern void *gRainSoundChannel;
|
||||
@@ -164,6 +165,7 @@ 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;
|
||||
extern int gVolumeAdjustZoom;
|
||||
|
||||
/**
|
||||
* Deregisters the audio device.
|
||||
|
||||
@@ -2260,13 +2260,13 @@ void window_update_viewport_ride_music()
|
||||
|
||||
switch (viewport->zoom) {
|
||||
case 0:
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_VOLUME_ADJUST_ZOOM, uint8) = 0;
|
||||
gVolumeAdjustZoom = 0;
|
||||
break;
|
||||
case 1:
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_VOLUME_ADJUST_ZOOM, uint8) = 30;
|
||||
gVolumeAdjustZoom = 30;
|
||||
break;
|
||||
default:
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_VOLUME_ADJUST_ZOOM, uint8) = 60;
|
||||
gVolumeAdjustZoom = 60;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
+2
-2
@@ -248,12 +248,12 @@ bool openrct2_initialise()
|
||||
// TODO move to audio initialise function
|
||||
if (str_is_null_or_empty(gConfigSound.device)) {
|
||||
Mixer_Init(NULL);
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_SOUND_DEVICE, uint32) = 0;
|
||||
gAudioCurrentDevice = 0;
|
||||
} else {
|
||||
Mixer_Init(gConfigSound.device);
|
||||
for (int i = 0; i < gAudioDeviceCount; i++) {
|
||||
if (strcmp(gAudioDevices[i].name, gConfigSound.device) == 0) {
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_SOUND_DEVICE, uint32) = i;
|
||||
gAudioCurrentDevice = i;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+21
-24
@@ -3337,43 +3337,40 @@ void ride_set_map_tooltip(rct_map_element *mapElement)
|
||||
int ride_music_params_update(sint16 x, sint16 y, sint16 z, uint8 rideIndex, uint16 sampleRate, uint32 position, uint8 *tuneId)
|
||||
{
|
||||
if(!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & SCREEN_FLAGS_SCENARIO_EDITOR) && !gGameSoundsOff && RCT2_GLOBAL(0x00F438A4, rct_viewport*) != (rct_viewport*)-1) {
|
||||
RCT2_GLOBAL(0x009AF47C, uint16) = sampleRate;
|
||||
sint16 v11;
|
||||
sint16 v12;
|
||||
rct_xy16 rotatedCoords;
|
||||
|
||||
switch (get_current_rotation()) {
|
||||
case 0:
|
||||
v11 = y - x;
|
||||
v12 = ((y + x) / 2) - z;
|
||||
rotatedCoords.x = y - x;
|
||||
rotatedCoords.y = ((y + x) / 2) - z;
|
||||
break;
|
||||
case 1:
|
||||
v11 = -x - y;
|
||||
v12 = ((y - x) / 2) - z;
|
||||
rotatedCoords.x = -x - y;
|
||||
rotatedCoords.y = ((y - x) / 2) - z;
|
||||
break;
|
||||
case 2:
|
||||
v11 = x - y;
|
||||
v12 = ((-y - x) / 2) - z;
|
||||
rotatedCoords.x = x - y;
|
||||
rotatedCoords.y = ((-y - x) / 2) - z;
|
||||
break;
|
||||
case 3:
|
||||
v11 = y + x;
|
||||
v12 = ((x - y) / 2) - z;
|
||||
rotatedCoords.x = y + x;
|
||||
rotatedCoords.y = ((x - y) / 2) - z;
|
||||
break;
|
||||
}
|
||||
RCT2_GLOBAL(0x009AF5A0, sint16) = v11;
|
||||
RCT2_GLOBAL(0x009AF5A2, sint16) = v12;
|
||||
rct_viewport* viewport = RCT2_GLOBAL(0x00F438A4, rct_viewport*);
|
||||
sint16 view_width = RCT2_GLOBAL(0x00F438A4, rct_viewport*)->view_width;
|
||||
sint16 view_width2 = view_width * 2;
|
||||
sint16 view_x = RCT2_GLOBAL(0x00F438A4, rct_viewport*)->view_x - view_width2;
|
||||
sint16 view_y = RCT2_GLOBAL(0x00F438A4, rct_viewport*)->view_y - view_width;
|
||||
sint16 v16 = view_width2 + view_width2 + RCT2_GLOBAL(0x00F438A4, rct_viewport*)->view_width + view_x;
|
||||
sint16 v17 = view_width + view_width + RCT2_GLOBAL(0x00F438A4, rct_viewport*)->view_height + view_y;
|
||||
if (view_x >= RCT2_GLOBAL(0x009AF5A0, sint16) ||
|
||||
view_y >= RCT2_GLOBAL(0x009AF5A2, sint16) ||
|
||||
v16 < RCT2_GLOBAL(0x009AF5A0, sint16) ||
|
||||
v17 < RCT2_GLOBAL(0x009AF5A2, sint16)) {
|
||||
sint16 view_x2 = view_width2 + view_width2 + RCT2_GLOBAL(0x00F438A4, rct_viewport*)->view_width + view_x;
|
||||
sint16 view_y2 = view_width + view_width + RCT2_GLOBAL(0x00F438A4, rct_viewport*)->view_height + view_y;
|
||||
if (view_x >= rotatedCoords.x ||
|
||||
view_y >= rotatedCoords.y ||
|
||||
view_x2 < rotatedCoords.x ||
|
||||
view_y2 < rotatedCoords.y) {
|
||||
goto label58;
|
||||
}
|
||||
int x2 = RCT2_GLOBAL(0x00F438A4, rct_viewport*)->x + ((RCT2_GLOBAL(0x009AF5A0, sint16) - RCT2_GLOBAL(0x00F438A4, rct_viewport*)->view_x) >> RCT2_GLOBAL(0x00F438A4, rct_viewport*)->zoom);
|
||||
int x2 = RCT2_GLOBAL(0x00F438A4, rct_viewport*)->x + ((rotatedCoords.x - RCT2_GLOBAL(0x00F438A4, rct_viewport*)->view_x) >> RCT2_GLOBAL(0x00F438A4, rct_viewport*)->zoom);
|
||||
x2 <<= 16;
|
||||
uint16 screenwidth = RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_WIDTH, uint16);
|
||||
if (screenwidth < 64) {
|
||||
@@ -3381,7 +3378,7 @@ int ride_music_params_update(sint16 x, sint16 y, sint16 z, uint8 rideIndex, uint
|
||||
}
|
||||
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);
|
||||
int y2 = RCT2_GLOBAL(0x00F438A4, rct_viewport*)->y + ((rotatedCoords.y - RCT2_GLOBAL(0x00F438A4, rct_viewport*)->view_y) >> RCT2_GLOBAL(0x00F438A4, rct_viewport*)->zoom);
|
||||
y2 <<= 16;
|
||||
uint16 screenheight = RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_HEIGHT, uint16);
|
||||
if (screenheight < 64) {
|
||||
@@ -3425,10 +3422,10 @@ int ride_music_params_update(sint16 x, sint16 y, sint16 z, uint8 rideIndex, uint
|
||||
if (vol1 >= vol2) {
|
||||
vol1 = vol2;
|
||||
}
|
||||
if (vol1 < RCT2_GLOBAL(RCT2_ADDRESS_VOLUME_ADJUST_ZOOM, uint8) * 3) {
|
||||
if (vol1 < gVolumeAdjustZoom * 3) {
|
||||
vol1 = 0;
|
||||
} else {
|
||||
vol1 = vol1 - (RCT2_GLOBAL(RCT2_ADDRESS_VOLUME_ADJUST_ZOOM, uint8) * 3);
|
||||
vol1 = vol1 - (gVolumeAdjustZoom * 3);
|
||||
}
|
||||
int v32 = -(((uint8)(-vol1 - 1) * (uint8)(-vol1 - 1)) / 16) - 700;
|
||||
if (vol1 && v32 >= -4000) {
|
||||
@@ -3466,7 +3463,7 @@ int ride_music_params_update(sint16 x, sint16 y, sint16 z, uint8 rideIndex, uint
|
||||
ride_music_params->offset = a1;
|
||||
ride_music_params->volume = v32;
|
||||
ride_music_params->pan = pan_x;
|
||||
ride_music_params->frequency = RCT2_GLOBAL(0x009AF47C, uint16);
|
||||
ride_music_params->frequency = sampleRate;
|
||||
gRideMusicParamsListEnd++;
|
||||
}
|
||||
} else {
|
||||
|
||||
+101
-40
@@ -88,6 +88,71 @@ const uint8 byte_9A3A18[] = {
|
||||
SOUND_SCREAM_3, SOUND_SCREAM_1, SOUND_SCREAM_5, SOUND_SCREAM_6,
|
||||
SOUND_SCREAM_7, SOUND_SCREAM_2, SOUND_SCREAM_4
|
||||
};
|
||||
const uint8 _soundParams[SOUND_MAXID][2] = {
|
||||
{ 1, 0 }, // SOUND_LIFT_1
|
||||
{ 1, 0 }, // SOUND_TRACK_FRICTION_1
|
||||
{ 1, 0 }, // SOUND_LIFT_2
|
||||
{ 0, 1 }, // SOUND_SCREAM_1
|
||||
{ 0, 0 }, // SOUND_CLICK_1
|
||||
{ 0, 0 }, // SOUND_CLICK_2
|
||||
{ 0, 0 }, // SOUND_PLACE_ITEM
|
||||
{ 0, 1 }, // SOUND_SCREAM_2
|
||||
{ 0, 1 }, // SOUND_SCREAM_3
|
||||
{ 0, 1 }, // SOUND_SCREAM_4
|
||||
{ 0, 1 }, // SOUND_SCREAM_5
|
||||
{ 0, 1 }, // SOUND_SCREAM_6
|
||||
{ 1, 0 }, // SOUND_LIFT_3
|
||||
{ 0, 0 }, // SOUND_PURCHASE
|
||||
{ 0, 0 }, // SOUND_CRASH
|
||||
{ 0, 0 }, // SOUND_LAYING_OUT_WATER
|
||||
{ 0, 0 }, // SOUND_WATER_1
|
||||
{ 0, 0 }, // SOUND_WATER_2
|
||||
{ 0, 1 }, // SOUND_TRAIN_WHISTLE
|
||||
{ 0, 1 }, // SOUND_TRAIN_CHUGGING
|
||||
{ 0, 0 }, // SOUND_WATER_SPLASH
|
||||
{ 1, 0 }, // SOUND_HAMMERING
|
||||
{ 0, 0 }, // SOUND_RIDE_LAUNCH_1
|
||||
{ 0, 0 }, // SOUND_RIDE_LAUNCH_2
|
||||
{ 0, 0 }, // SOUND_COUGH_1
|
||||
{ 0, 0 }, // SOUND_COUGH_2
|
||||
{ 0, 0 }, // SOUND_COUGH_3
|
||||
{ 0, 0 }, // SOUND_COUGH_4
|
||||
{ 1, 0 }, // SOUND_RAIN_1
|
||||
{ 0, 0 }, // SOUND_THUNDER_1
|
||||
{ 0, 0 }, // SOUND_THUNDER_2
|
||||
{ 1, 0 }, // SOUND_RAIN_2
|
||||
{ 1, 0 }, // SOUND_RAIN_3
|
||||
{ 0, 0 }, // SOUND_BALLOON_POP
|
||||
{ 0, 0 }, // SOUND_MECHANIC_FIX
|
||||
{ 0, 1 }, // SOUND_SCREAM_7
|
||||
{ 0, 0 }, // SOUND_TOILET_FLUSH
|
||||
{ 0, 0 }, // SOUND_CLICK_3
|
||||
{ 0, 0 }, // SOUND_QUACK
|
||||
{ 0, 0 }, // SOUND_NEWS_ITEM
|
||||
{ 0, 0 }, // SOUND_WINDOW_OPEN
|
||||
{ 0, 0 }, // SOUND_LAUGH_1
|
||||
{ 0, 0 }, // SOUND_LAUGH_2
|
||||
{ 0, 0 }, // SOUND_LAUGH_3
|
||||
{ 0, 0 }, // SOUND_APPLAUSE
|
||||
{ 0, 0 }, // SOUND_HAUNTED_HOUSE_SCARE
|
||||
{ 0, 0 }, // SOUND_HAUNTED_HOUSE_SCREAM_1
|
||||
{ 0, 0 }, // SOUND_HAUNTED_HOUSE_SCREAM_2
|
||||
{ 0, 0 }, // SOUND_48
|
||||
{ 0, 0 }, // SOUND_49
|
||||
{ 0, 0 }, // SOUND_ERROR
|
||||
{ 0, 0 }, // SOUND_51
|
||||
{ 1, 0 }, // SOUND_LIFT_4
|
||||
{ 1, 0 }, // SOUND_LIFT_5
|
||||
{ 1, 0 }, // SOUND_TRACK_FRICTION_2
|
||||
{ 1, 0 }, // SOUND_LIFT_6
|
||||
{ 1, 0 }, // SOUND_LIFT_7
|
||||
{ 1, 2 }, // SOUND_TRACK_FRICTION_3
|
||||
{ 0, 1 }, // SOUND_SCREAM_8
|
||||
{ 0, 1 }, // SOUND_TRAM
|
||||
{ 0, 0 }, // SOUND_DOOR_OPEN
|
||||
{ 0, 0 }, // SOUND_DOOR_CLOSE
|
||||
{ 0, 0 } // SOUND_62
|
||||
};
|
||||
|
||||
const rct_vehicle_info *vehicle_get_move_info(int cd, int typeAndDirection, int offset)
|
||||
{
|
||||
@@ -171,26 +236,22 @@ void vehicle_update_sound_params(rct_vehicle* vehicle)
|
||||
if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & SCREEN_FLAGS_SCENARIO_EDITOR) && (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & SCREEN_FLAGS_TRACK_DESIGNER) || RCT2_GLOBAL(0x0141F570, uint8) == 6)) {
|
||||
if (vehicle->sound1_id != (uint8)-1 || vehicle->sound2_id != (uint8)-1) {
|
||||
if (vehicle->sprite_left != (sint16)0x8000) {
|
||||
RCT2_GLOBAL(0x009AF5A0, sint16) = vehicle->sprite_left;
|
||||
RCT2_GLOBAL(0x009AF5A2, sint16) = vehicle->sprite_top;
|
||||
RCT2_GLOBAL(0x009AF5A4, sint16) = vehicle->sprite_right;
|
||||
RCT2_GLOBAL(0x009AF5A6, sint16) = vehicle->sprite_bottom;
|
||||
sint16 v4 = RCT2_GLOBAL(0x00F438A4, rct_viewport*)->view_x;
|
||||
sint16 v5 = RCT2_GLOBAL(0x00F438A4, rct_viewport*)->view_y;
|
||||
sint16 v6 = RCT2_GLOBAL(0x00F438A4, rct_viewport*)->view_width / 4;
|
||||
sint16 v7 = RCT2_GLOBAL(0x00F438A4, rct_viewport*)->view_height / 4;
|
||||
sint16 x = RCT2_GLOBAL(0x00F438A4, rct_viewport*)->view_x;
|
||||
sint16 y = RCT2_GLOBAL(0x00F438A4, rct_viewport*)->view_y;
|
||||
sint16 w = RCT2_GLOBAL(0x00F438A4, rct_viewport*)->view_width / 4;
|
||||
sint16 h = RCT2_GLOBAL(0x00F438A4, rct_viewport*)->view_height / 4;
|
||||
if (!RCT2_GLOBAL(0x00F438A8, rct_window*)->classification) {
|
||||
v4 -= v6;
|
||||
v5 -= v7;
|
||||
x -= w;
|
||||
y -= h;
|
||||
}
|
||||
if (v4 < RCT2_GLOBAL(0x009AF5A4, sint16) && v5 < RCT2_GLOBAL(0x009AF5A6, sint16)) {
|
||||
sint16 t8 = RCT2_GLOBAL(0x00F438A4, rct_viewport*)->view_width + v4;
|
||||
sint16 t9 = RCT2_GLOBAL(0x00F438A4, rct_viewport*)->view_height + v5;
|
||||
if (x < vehicle->sprite_right && y < vehicle->sprite_bottom) {
|
||||
sint16 w2 = RCT2_GLOBAL(0x00F438A4, rct_viewport*)->view_width + x;
|
||||
sint16 h2 = RCT2_GLOBAL(0x00F438A4, rct_viewport*)->view_height + y;
|
||||
if (!RCT2_GLOBAL(0x00F438A8, rct_window*)->classification) {
|
||||
t8 += v6 + v6;
|
||||
t9 += v7 + v7;
|
||||
w2 += w + w;
|
||||
h2 += h + h;
|
||||
}
|
||||
if (t8 >= RCT2_GLOBAL(0x009AF5A0, sint16) && t9 >= RCT2_GLOBAL(0x009AF5A2, sint16)) {
|
||||
if (w2 >= vehicle->sprite_left && h2 >= vehicle->sprite_top) {
|
||||
uint16 v9 = sub_6BC2F3(vehicle);
|
||||
rct_vehicle_sound_params* i;
|
||||
for (i = &gVehicleSoundParamsList[0]; i < gVehicleSoundParamsListEnd && v9 <= i->var_A; i++);
|
||||
@@ -204,7 +265,7 @@ void vehicle_update_sound_params(rct_vehicle* vehicle)
|
||||
*(j + 1) = *j;
|
||||
}
|
||||
i->var_A = v9;
|
||||
int pan_x = (RCT2_GLOBAL(0x009AF5A0, sint16) / 2) + (RCT2_GLOBAL(0x009AF5A4, sint16) / 2) - RCT2_GLOBAL(0x00F438A4, rct_viewport*)->view_x;
|
||||
int pan_x = (vehicle->sprite_left / 2) + (vehicle->sprite_right / 2) - RCT2_GLOBAL(0x00F438A4, rct_viewport*)->view_x;
|
||||
pan_x >>= RCT2_GLOBAL(0x00F438A4, rct_viewport*)->zoom;
|
||||
pan_x += RCT2_GLOBAL(0x00F438A4, rct_viewport*)->x;
|
||||
|
||||
@@ -214,7 +275,7 @@ void vehicle_update_sound_params(rct_vehicle* vehicle)
|
||||
}
|
||||
i->pan_x = ((((pan_x << 16) / screenwidth) - 0x8000) >> 4);
|
||||
|
||||
int pan_y = (RCT2_GLOBAL(0x009AF5A2, sint16) / 2) + (RCT2_GLOBAL(0x009AF5A6, sint16) / 2) - RCT2_GLOBAL(0x00F438A4, rct_viewport*)->view_y;
|
||||
int pan_y = (vehicle->sprite_top / 2) + (vehicle->sprite_bottom / 2) - RCT2_GLOBAL(0x00F438A4, rct_viewport*)->view_y;
|
||||
pan_y >>= RCT2_GLOBAL(0x00F438A4, rct_viewport*)->zoom;
|
||||
pan_y += RCT2_GLOBAL(0x00F438A4, rct_viewport*)->y;
|
||||
|
||||
@@ -224,23 +285,23 @@ void vehicle_update_sound_params(rct_vehicle* vehicle)
|
||||
}
|
||||
i->pan_y = ((((pan_y << 16) / screenheight) - 0x8000) >> 4);
|
||||
|
||||
sint32 v19 = vehicle->velocity;
|
||||
sint32 v = vehicle->velocity;
|
||||
|
||||
rct_ride_entry* ride_type = get_ride_entry(vehicle->ride_subtype);
|
||||
uint8 test = ride_type->vehicles[vehicle->vehicle_type].var_5A;
|
||||
|
||||
if (test & 1) {
|
||||
v19 *= 2;
|
||||
v *= 2;
|
||||
}
|
||||
if (v19 < 0) {
|
||||
v19 = -v19;
|
||||
if (v < 0) {
|
||||
v = -v;
|
||||
}
|
||||
v19 >>= 5;
|
||||
v19 *= 5512;
|
||||
v19 >>= 14;
|
||||
v19 += 11025;
|
||||
v19 += 16 * vehicle->var_BF;
|
||||
i->frequency = (uint16)v19;
|
||||
v >>= 5;
|
||||
v *= 5512;
|
||||
v >>= 14;
|
||||
v += 11025;
|
||||
v += 16 * vehicle->var_BF;
|
||||
i->frequency = (uint16)v;
|
||||
i->id = vehicle->sprite_index;
|
||||
i->volume = 0;
|
||||
if (vehicle->x != (sint16)0x8000) {
|
||||
@@ -293,7 +354,7 @@ int sub_6BC2F3(rct_vehicle* vehicle)
|
||||
*/
|
||||
void vehicle_sounds_update()
|
||||
{
|
||||
if (RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_SOUND_DEVICE, uint32) != -1 && !gGameSoundsOff && gConfigSound.sound_enabled && !gOpenRCT2Headless) {
|
||||
if (gAudioCurrentDevice != -1 && !gGameSoundsOff && gConfigSound.sound_enabled && !gOpenRCT2Headless) {
|
||||
RCT2_GLOBAL(0x00F438A4, rct_viewport*) = (rct_viewport*)-1;
|
||||
rct_viewport* viewport = (rct_viewport*)-1;
|
||||
rct_window* window = gWindowNextSlot;
|
||||
@@ -311,11 +372,11 @@ void vehicle_sounds_update()
|
||||
if (viewport != (rct_viewport*)-1) {
|
||||
if (window) {
|
||||
RCT2_GLOBAL(0x00F438A8, rct_window*) = window;
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_VOLUME_ADJUST_ZOOM, uint8) = 0;
|
||||
gVolumeAdjustZoom = 0;
|
||||
if (viewport->zoom) {
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_VOLUME_ADJUST_ZOOM, uint8) = 35;
|
||||
gVolumeAdjustZoom = 35;
|
||||
if (viewport->zoom != 1) {
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_VOLUME_ADJUST_ZOOM, uint8) = 70;
|
||||
gVolumeAdjustZoom = 70;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -395,10 +456,10 @@ void vehicle_sounds_update()
|
||||
if (vol1 >= vol2) {
|
||||
vol1 = vol2;
|
||||
}
|
||||
if (vol1 < RCT2_GLOBAL(RCT2_ADDRESS_VOLUME_ADJUST_ZOOM, uint8)) {
|
||||
if (vol1 < gVolumeAdjustZoom) {
|
||||
vol1 = 0;
|
||||
} else {
|
||||
vol1 = vol1 - RCT2_GLOBAL(RCT2_ADDRESS_VOLUME_ADJUST_ZOOM, uint8);
|
||||
vol1 = vol1 - gVolumeAdjustZoom;
|
||||
}
|
||||
|
||||
rct_vehicle_sound* vehicle_sound = &gVehicleSoundList[0];
|
||||
@@ -464,10 +525,10 @@ void vehicle_sounds_update()
|
||||
vehicle_sound->sound1_volume = volume;
|
||||
vehicle_sound->sound1_freq = vehicle_sound_params->frequency;
|
||||
uint16 frequency = vehicle_sound_params->frequency;
|
||||
if (RCT2_ADDRESS(0x009AF51F, uint8)[2 * sprite->vehicle.sound1_id] & 2) {
|
||||
if (_soundParams[sprite->vehicle.sound1_id][1] & 2) {
|
||||
frequency = (frequency / 2) + 4000;
|
||||
}
|
||||
uint8 looping = RCT2_ADDRESS(0x009AF51E, uint8)[2 * sprite->vehicle.sound1_id];
|
||||
uint8 looping = _soundParams[sprite->vehicle.sound1_id][0];
|
||||
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;
|
||||
@@ -483,7 +544,7 @@ void vehicle_sounds_update()
|
||||
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;
|
||||
uint16 frequency = vehicle_sound_params->frequency;
|
||||
if (RCT2_GLOBAL(0x009AF51F, uint8*)[2 * sprite->vehicle.sound1_id] & 2) {
|
||||
if (_soundParams[sprite->vehicle.sound1_id][1] & 2) {
|
||||
frequency = (frequency / 2) + 4000;
|
||||
}
|
||||
Mixer_Channel_Rate(vehicle_sound->sound1_channel, DStoMixerRate(frequency));
|
||||
@@ -515,14 +576,14 @@ void vehicle_sounds_update()
|
||||
vehicle_sound->sound2_volume = volume;
|
||||
vehicle_sound->sound2_freq = vehicle_sound_params->frequency;
|
||||
uint16 frequency = vehicle_sound_params->frequency;
|
||||
if (RCT2_ADDRESS(0x009AF51F, uint8)[2 * sprite->vehicle.sound2_id] & 1) {
|
||||
if (_soundParams[sprite->vehicle.sound2_id][1] & 1) {
|
||||
frequency = 12649;
|
||||
}
|
||||
frequency = (frequency * 2) - 3248;
|
||||
if (frequency > 25700) {
|
||||
frequency = 25700;
|
||||
}
|
||||
uint8 looping = RCT2_ADDRESS(0x009AF51E, uint8)[2 * sprite->vehicle.sound2_id];
|
||||
uint8 looping = _soundParams[sprite->vehicle.sound2_id][0];
|
||||
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;
|
||||
@@ -537,7 +598,7 @@ void vehicle_sounds_update()
|
||||
}
|
||||
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;
|
||||
if (!(RCT2_ADDRESS(0x009AF51F, uint8)[2 * sprite->vehicle.sound2_id] & 1)) {
|
||||
if (!(_soundParams[sprite->vehicle.sound2_id][1] & 1)) {
|
||||
uint16 frequency = (vehicle_sound_params->frequency * 2) - 3248;
|
||||
if (frequency > 25700) {
|
||||
frequency = 25700;
|
||||
|
||||
@@ -981,7 +981,7 @@ static void window_options_mousedown(int widgetIndex, rct_window*w, rct_widget*
|
||||
|
||||
window_options_show_dropdown(w, widget, gAudioDeviceCount);
|
||||
|
||||
dropdown_set_checked(RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_SOUND_DEVICE, uint32), true);
|
||||
dropdown_set_checked(gAudioCurrentDevice, true);
|
||||
break;
|
||||
case WIDX_TITLE_MUSIC_DROPDOWN:
|
||||
num_items = 4;
|
||||
@@ -1313,7 +1313,6 @@ static void window_options_dropdown(rct_window *w, int widgetIndex, int dropdown
|
||||
static void window_options_invalidate(rct_window *w)
|
||||
{
|
||||
rct_widget* widget;
|
||||
sint32 currentSoundDevice;
|
||||
|
||||
colour_scheme_update(w);
|
||||
|
||||
@@ -1428,21 +1427,19 @@ static void window_options_invalidate(rct_window *w)
|
||||
break;
|
||||
|
||||
case WINDOW_OPTIONS_PAGE_AUDIO:
|
||||
currentSoundDevice = RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_SOUND_DEVICE, sint32);
|
||||
|
||||
// sound devices
|
||||
if (currentSoundDevice == -1 || gAudioDeviceCount == 0) {
|
||||
if (gAudioCurrentDevice == -1 || gAudioDeviceCount == 0) {
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS, uint16) = STR_SOUND_NONE;
|
||||
}
|
||||
else {
|
||||
#ifndef __LINUX__
|
||||
if (currentSoundDevice == 0)
|
||||
if (gAudioCurrentDevice == 0)
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS, uint16) = 5510;
|
||||
else
|
||||
#endif // __LINUX__
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS, uint16) = 1170;
|
||||
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 2, uint32) = (uint32)gAudioDevices[currentSoundDevice].name;
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 2, uint32) = (uint32)gAudioDevices[gAudioCurrentDevice].name;
|
||||
}
|
||||
|
||||
// music: on/off
|
||||
|
||||
+1
-1
@@ -236,7 +236,7 @@ static void climate_determine_future_weather(int randomDistribution)
|
||||
*/
|
||||
void climate_update_sound()
|
||||
{
|
||||
if (RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_SOUND_DEVICE, uint32) == 0xFFFFFFFF)
|
||||
if (gAudioCurrentDevice == -1)
|
||||
return;
|
||||
if (gGameSoundsOff)
|
||||
return;
|
||||
|
||||
Reference in new issue
Block a user