Merge pull request #970 from duncanspumpkin/fix_on_ride_photo

Fix on ride photo and station lights
This commit is contained in:
Ted John 2015-03-27 11:12:18 +00:00
commit c70c2f6057
3 changed files with 28 additions and 11 deletions

View File

@ -89,7 +89,8 @@ static void ride_update_station_bumpercar(rct_ride *ride, int stationIndex)
{ {
int i, dx, dl, dh; int i, dx, dl, dh;
rct_vehicle *vehicle; rct_vehicle *vehicle;
// Change of station depart flag should really call invalidate_station_start
// but since bumpercars do not have station lights there is no point.
if ( if (
ride->status == RIDE_STATUS_CLOSED || ride->status == RIDE_STATUS_CLOSED ||
(ride->lifecycle_flags & (RIDE_LIFECYCLE_BROKEN_DOWN | RIDE_LIFECYCLE_CRASHED)) (ride->lifecycle_flags & (RIDE_LIFECYCLE_BROKEN_DOWN | RIDE_LIFECYCLE_CRASHED))
@ -142,21 +143,24 @@ static void ride_update_station_normal(rct_ride *ride, int stationIndex)
time = ride->station_depart[stationIndex] & STATION_DEPART_MASK; time = ride->station_depart[stationIndex] & STATION_DEPART_MASK;
if ( if (
(ride->lifecycle_flags & (RIDE_LIFECYCLE_BROKEN_DOWN | RIDE_LIFECYCLE_CRASHED)) && (ride->lifecycle_flags & (RIDE_LIFECYCLE_BROKEN_DOWN | RIDE_LIFECYCLE_CRASHED)) ||
(ride->status == RIDE_STATUS_CLOSED && ride->num_riders == 0) (ride->status == RIDE_STATUS_CLOSED && ride->num_riders == 0)
) { ) {
if (time != 0 && time != 127 && !(RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_TICKS, uint32) & 7)) if (time != 0 && time != 127 && !(RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_TICKS, uint32) & 7))
time--; time--;
ride->station_depart[stationIndex] = time; ride->station_depart[stationIndex] = time;
ride_invalidate_station_start(ride, stationIndex, 0);
} else { } else {
if (time == 0) { if (time == 0) {
ride->station_depart[stationIndex] |= STATION_DEPART_FLAG; ride->station_depart[stationIndex] |= STATION_DEPART_FLAG;
ride_invalidate_station_start(ride, stationIndex, 1);
} else { } else {
if (time != 127 && !(RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_TICKS, uint32) & 31)) if (time != 127 && !(RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_TICKS, uint32) & 31))
time--; time--;
ride->station_depart[stationIndex] = time; ride->station_depart[stationIndex] = time;
ride_invalidate_station_start(ride, stationIndex, 0);
} }
} }
} }
@ -175,7 +179,10 @@ static void ride_update_station_race(rct_ride *ride, int stationIndex)
ride->status == RIDE_STATUS_CLOSED || ride->status == RIDE_STATUS_CLOSED ||
(ride->lifecycle_flags & (RIDE_LIFECYCLE_BROKEN_DOWN | RIDE_LIFECYCLE_CRASHED)) (ride->lifecycle_flags & (RIDE_LIFECYCLE_BROKEN_DOWN | RIDE_LIFECYCLE_CRASHED))
) { ) {
ride->station_depart[stationIndex] &= ~STATION_DEPART_FLAG; if (ride->station_depart[stationIndex] & STATION_DEPART_FLAG){
ride->station_depart[stationIndex] &= ~STATION_DEPART_FLAG;
ride_invalidate_station_start(ride, stationIndex, 0);
}
return; return;
} }
@ -193,7 +200,10 @@ static void ride_update_station_race(rct_ride *ride, int stationIndex)
// Race is over // Race is over
ride->lifecycle_flags &= ~RIDE_LIFECYCLE_PASS_STATION_NO_STOPPING; ride->lifecycle_flags &= ~RIDE_LIFECYCLE_PASS_STATION_NO_STOPPING;
ride->station_depart[stationIndex] &= ~STATION_DEPART_FLAG; if (ride->station_depart[stationIndex] & STATION_DEPART_FLAG){
ride->station_depart[stationIndex] &= ~STATION_DEPART_FLAG;
ride_invalidate_station_start(ride, stationIndex, 0);
}
return; return;
} }
} }
@ -205,7 +215,10 @@ static void ride_update_station_race(rct_ride *ride, int stationIndex)
for (i = 0; i < ride->num_vehicles; i++) { for (i = 0; i < ride->num_vehicles; i++) {
vehicle = &(g_sprite_list[ride->vehicles[i]].vehicle); vehicle = &(g_sprite_list[ride->vehicles[i]].vehicle);
if (vehicle->status != VEHICLE_STATUS_WAITING_TO_DEPART && vehicle->status != VEHICLE_STATUS_DEPARTING) { if (vehicle->status != VEHICLE_STATUS_WAITING_TO_DEPART && vehicle->status != VEHICLE_STATUS_DEPARTING) {
ride->station_depart[stationIndex] &= ~STATION_DEPART_FLAG; if (ride->station_depart[stationIndex] & STATION_DEPART_FLAG){
ride->station_depart[stationIndex] &= ~STATION_DEPART_FLAG;
ride_invalidate_station_start(ride, stationIndex, 0);
}
return; return;
} }
} }
@ -213,7 +226,10 @@ static void ride_update_station_race(rct_ride *ride, int stationIndex)
// Begin the race // Begin the race
ride_race_init_vehicle_speeds(ride); ride_race_init_vehicle_speeds(ride);
ride->lifecycle_flags |= RIDE_LIFECYCLE_PASS_STATION_NO_STOPPING; ride->lifecycle_flags |= RIDE_LIFECYCLE_PASS_STATION_NO_STOPPING;
ride->station_depart[stationIndex] |= STATION_DEPART_FLAG; if (!(ride->station_depart[stationIndex] & STATION_DEPART_FLAG)){
ride->station_depart[stationIndex] |= STATION_DEPART_FLAG;
ride_invalidate_station_start(ride, stationIndex, 1);
}
ride->window_invalidate_flags |= RIDE_INVALIDATE_RIDE_MAIN | RIDE_INVALIDATE_RIDE_LIST; ride->window_invalidate_flags |= RIDE_INVALIDATE_RIDE_MAIN | RIDE_INVALIDATE_RIDE_LIST;
} }
} }

View File

@ -35,7 +35,7 @@ static void vehicle_update(rct_vehicle *vehicle);
*/ */
void vehicle_update_sound_params(rct_vehicle* vehicle) void vehicle_update_sound_params(rct_vehicle* vehicle)
{ {
if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & 2) && (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & 4) || RCT2_GLOBAL(0x0141F570, uint8) == 6)) { 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->sound1_id != (uint8)-1 || vehicle->sound2_id != (uint8)-1) {
if (vehicle->sprite_left != 0x8000) { if (vehicle->sprite_left != 0x8000) {
RCT2_GLOBAL(0x009AF5A0, sint16) = vehicle->sprite_left; RCT2_GLOBAL(0x009AF5A0, sint16) = vehicle->sprite_left;
@ -549,10 +549,10 @@ void vehicle_update_all()
uint16 sprite_index; uint16 sprite_index;
rct_vehicle *vehicle; rct_vehicle *vehicle;
if (RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & 2) if (RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & SCREEN_FLAGS_SCENARIO_EDITOR)
return; return;
if ((RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & 4) && RCT2_GLOBAL(0x0141F570, uint8) != 6) if ((RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & SCREEN_FLAGS_TRACK_DESIGNER) && RCT2_GLOBAL(0x0141F570, uint8) != 6)
return; return;

View File

@ -55,7 +55,8 @@ void map_animation_create(int type, int x, int y, int z)
continue; continue;
if (aobj->baseZ != z) if (aobj->baseZ != z)
continue; continue;
if (aobj->type != type)
continue;
// Animation already exists // Animation already exists
return; return;
} }
@ -82,7 +83,7 @@ void map_animation_invalidate_all()
RCT2_GLOBAL(0x0138B580, uint16)--; RCT2_GLOBAL(0x0138B580, uint16)--;
numAnimatedObjects--; numAnimatedObjects--;
if (numAnimatedObjects > 0) if (numAnimatedObjects > 0)
memmove(aobj, aobj + 1, numAnimatedObjects); memmove(aobj, aobj + 1, numAnimatedObjects * sizeof(rct_map_animation));
} else { } else {
numAnimatedObjects--; numAnimatedObjects--;
aobj++; aobj++;