mirror of https://github.com/OpenRCT2/OpenRCT2.git
refactor update ride more
This commit is contained in:
parent
cf59455d69
commit
19d3852f9c
|
@ -1836,35 +1836,6 @@ void stop_vehicle_sounds()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Update zoom based volume attenuation for ride music and clear music list
|
|
||||||
* rct2: 0x006BC348
|
|
||||||
*/
|
|
||||||
void sub_6BC348()
|
|
||||||
{
|
|
||||||
RCT2_GLOBAL(0x009AF42C, rct_music_info*) = &RCT2_GLOBAL(0x009AF430, rct_music_info);
|
|
||||||
RCT2_GLOBAL(0x00F438A4, rct_viewport*) = (rct_viewport*)-1;
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
if (window->viewport && window->viewport->flags & VIEWPORT_FLAG_SOUND_ON) {
|
|
||||||
RCT2_GLOBAL(0x00F438A4, rct_viewport*) = window->viewport;
|
|
||||||
RCT2_GLOBAL(0x00F438A8, rct_window*) = window;
|
|
||||||
RCT2_GLOBAL(RCT2_ADDRESS_VOLUME_ADJUST_ZOOM, uint8) = 0;
|
|
||||||
if (window->viewport->zoom) {
|
|
||||||
RCT2_GLOBAL(RCT2_ADDRESS_VOLUME_ADJUST_ZOOM, uint8) = 30;
|
|
||||||
if (window->viewport->zoom != 1) {
|
|
||||||
RCT2_GLOBAL(RCT2_ADDRESS_VOLUME_ADJUST_ZOOM, uint8) = 60;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* rct2: 0x006BC3AC
|
* rct2: 0x006BC3AC
|
||||||
|
|
|
@ -213,7 +213,6 @@ void audio_close();
|
||||||
void pause_sounds();
|
void pause_sounds();
|
||||||
void unpause_sounds();
|
void unpause_sounds();
|
||||||
void stop_vehicle_sounds();
|
void stop_vehicle_sounds();
|
||||||
void sub_6BC348();
|
|
||||||
void sub_6BC6D8();
|
void sub_6BC6D8();
|
||||||
int sub_6BC3AC(sint16 x, sint16 y, sint16 z, uint8 rideIndex, uint16 sampleRate, uint32 position, uint8 *tuneId);
|
int sub_6BC3AC(sint16 x, sint16 y, sint16 z, uint8 rideIndex, uint16 sampleRate, uint32 position, uint8 *tuneId);
|
||||||
|
|
||||||
|
|
|
@ -1792,4 +1792,39 @@ void sub_6EA73F()
|
||||||
window_invalidate_pressed_image_buttons(w);
|
window_invalidate_pressed_image_buttons(w);
|
||||||
RCT2_CALLPROC_X(w->event_handlers[WE_RESIZE], 0, 0, 0, 0, (int)w, 0, 0);
|
RCT2_CALLPROC_X(w->event_handlers[WE_RESIZE], 0, 0, 0, 0, (int)w, 0, 0);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update zoom based volume attenuation for ride music and clear music list.
|
||||||
|
* rct2: 0x006BC348
|
||||||
|
*/
|
||||||
|
void window_update_viewport_ride_music()
|
||||||
|
{
|
||||||
|
rct_viewport *viewport;
|
||||||
|
rct_window *w;
|
||||||
|
|
||||||
|
RCT2_GLOBAL(0x009AF42C, rct_music_info*) = (rct_music_info*)0x009AF430;
|
||||||
|
RCT2_GLOBAL(0x00F438A4, rct_viewport*) = (rct_viewport*)-1;
|
||||||
|
|
||||||
|
for (w = RCT2_LAST_WINDOW; w >= g_window_list; w--) {
|
||||||
|
viewport = w->viewport;
|
||||||
|
if (viewport == NULL || !(viewport->flags & VIEWPORT_FLAG_SOUND_ON))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
RCT2_GLOBAL(0x00F438A4, rct_viewport*) = viewport;
|
||||||
|
RCT2_GLOBAL(0x00F438A8, rct_window*) = w;
|
||||||
|
|
||||||
|
switch (viewport->zoom) {
|
||||||
|
case 0:
|
||||||
|
RCT2_GLOBAL(RCT2_ADDRESS_VOLUME_ADJUST_ZOOM, uint8) = 0;
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
RCT2_GLOBAL(RCT2_ADDRESS_VOLUME_ADJUST_ZOOM, uint8) = 30;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
RCT2_GLOBAL(RCT2_ADDRESS_VOLUME_ADJUST_ZOOM, uint8) = 60;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -463,6 +463,8 @@ void tool_cancel();
|
||||||
|
|
||||||
void window_close_construction_windows();
|
void window_close_construction_windows();
|
||||||
|
|
||||||
|
void window_update_viewport_ride_music();
|
||||||
|
|
||||||
// Open window functions
|
// Open window functions
|
||||||
void window_main_open();
|
void window_main_open();
|
||||||
void window_resize_gui(int width, int height);
|
void window_resize_gui(int width, int height);
|
||||||
|
|
|
@ -125,7 +125,6 @@ static int ride_get_new_breakdown_problem(rct_ride *ride);
|
||||||
static void ride_inspection_update(rct_ride *ride);
|
static void ride_inspection_update(rct_ride *ride);
|
||||||
static void ride_mechanic_status_update(int rideIndex, int mechanicStatus);
|
static void ride_mechanic_status_update(int rideIndex, int mechanicStatus);
|
||||||
static void ride_music_update(int rideIndex);
|
static void ride_music_update(int rideIndex);
|
||||||
static void ride_play_music();
|
|
||||||
static void ride_prepare_breakdown(int rideIndex, int breakdownReason);
|
static void ride_prepare_breakdown(int rideIndex, int breakdownReason);
|
||||||
static void ride_shop_connected(rct_ride* ride, int ride_idx);
|
static void ride_shop_connected(rct_ride* ride, int ride_idx);
|
||||||
static void ride_spiral_slide_update(rct_ride *ride);
|
static void ride_spiral_slide_update(rct_ride *ride);
|
||||||
|
@ -513,8 +512,6 @@ void ride_update_all()
|
||||||
rct_ride *ride;
|
rct_ride *ride;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
// RCT2_CALLPROC_EBPSAFE(0x006ABE4C); return;
|
|
||||||
|
|
||||||
// Remove all rides if certain flags are set (possible scenario editor?)
|
// Remove all rides if certain flags are set (possible scenario editor?)
|
||||||
int *esi = (int*)0x9DCE9E;
|
int *esi = (int*)0x9DCE9E;
|
||||||
if (esi[0x1BCA] & 2) {
|
if (esi[0x1BCA] & 2) {
|
||||||
|
@ -524,14 +521,13 @@ void ride_update_all()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Something related to windows
|
window_update_viewport_ride_music();
|
||||||
RCT2_CALLPROC_EBPSAFE(0x006BC348);
|
|
||||||
|
|
||||||
// Update rides
|
// Update rides
|
||||||
FOR_ALL_RIDES(i, ride)
|
FOR_ALL_RIDES(i, ride)
|
||||||
ride_update(i);
|
ride_update(i);
|
||||||
|
|
||||||
ride_play_music();
|
sub_6BC6D8();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1232,15 +1228,6 @@ static void ride_music_update(int rideIndex)
|
||||||
ride->music_position = sub_6BC3AC(x, y, z, rideIndex, sampleRate, ride->music_position, &ride->music_tune_id);
|
ride->music_position = sub_6BC3AC(x, y, z, rideIndex, sampleRate, ride->music_position, &ride->music_tune_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* rct2: 0x006BC6D8
|
|
||||||
*/
|
|
||||||
static void ride_play_music()
|
|
||||||
{
|
|
||||||
RCT2_CALLPROC_EBPSAFE(0x006BC6D8);
|
|
||||||
}
|
|
||||||
|
|
||||||
#pragma endregion
|
#pragma endregion
|
||||||
|
|
||||||
#pragma region Measurement functions
|
#pragma region Measurement functions
|
||||||
|
|
Loading…
Reference in New Issue