mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2026-01-15 11:03:00 +01:00
Reset sprite quadrant placements as part of sprite reset command
This addresses some sources of desyncs in multiplayer.
This commit is contained in:
committed by
Michał Janiszewski
parent
63eb861cbd
commit
dd4e4caeaa
14
src/game.c
14
src/game.c
@@ -270,13 +270,13 @@ void game_update()
|
||||
// make sure client doesn't fall behind the server too much
|
||||
numUpdates += 10;
|
||||
}
|
||||
} else {
|
||||
if (game_is_paused()) {
|
||||
numUpdates = 0;
|
||||
// Update the animation list. Note this does not
|
||||
// increment the map animation.
|
||||
map_animation_invalidate_all();
|
||||
}
|
||||
}
|
||||
|
||||
if (game_is_paused()) {
|
||||
numUpdates = 0;
|
||||
// Update the animation list. Note this does not
|
||||
// increment the map animation.
|
||||
map_animation_invalidate_all();
|
||||
}
|
||||
|
||||
// Update the game one or more times
|
||||
|
||||
@@ -411,7 +411,7 @@ static void openrct2_loop()
|
||||
if (!sprite_should_tween(get_sprite(i)))
|
||||
continue;
|
||||
|
||||
sprite_move(
|
||||
sprite_move_interframe(
|
||||
_spritelocations2[i].x + (sint16)((_spritelocations1[i].x - _spritelocations2[i].x) * nudge),
|
||||
_spritelocations2[i].y + (sint16)((_spritelocations1[i].y - _spritelocations2[i].y) * nudge),
|
||||
_spritelocations2[i].z + (sint16)((_spritelocations1[i].z - _spritelocations2[i].z) * nudge),
|
||||
@@ -434,7 +434,7 @@ static void openrct2_loop()
|
||||
continue;
|
||||
|
||||
invalidate_sprite_2(get_sprite(i));
|
||||
sprite_move(_spritelocations2[i].x, _spritelocations2[i].y, _spritelocations2[i].z, get_sprite(i));
|
||||
sprite_move_interframe(_spritelocations2[i].x, _spritelocations2[i].y, _spritelocations2[i].z, get_sprite(i));
|
||||
}
|
||||
network_update();
|
||||
} else {
|
||||
|
||||
@@ -366,15 +366,12 @@ void S6Importer::Import()
|
||||
throw ObjectLoadException();
|
||||
}
|
||||
map_update_tile_pointers();
|
||||
reset_all_sprite_quadrant_placements();
|
||||
reset_sprite_spatial_index();
|
||||
if (network_get_mode() == NETWORK_MODE_CLIENT)
|
||||
{
|
||||
reset_sprite_spatial_index();
|
||||
game_do_command(0, GAME_COMMAND_FLAG_APPLY, 0, 0, GAME_COMMAND_RESET_SPRITES, 0, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
reset_sprite_spatial_index();
|
||||
}
|
||||
game_convert_strings_to_utf8();
|
||||
if (FixIssues)
|
||||
{
|
||||
|
||||
@@ -162,6 +162,7 @@ void reset_sprite_spatial_index()
|
||||
void game_command_reset_sprites(int* eax, int* ebx, int* ecx, int* edx, int* esi, int* edi, int* ebp)
|
||||
{
|
||||
if (*ebx & GAME_COMMAND_FLAG_APPLY) {
|
||||
reset_all_sprite_quadrant_placements();
|
||||
reset_sprite_spatial_index();
|
||||
}
|
||||
*ebx = 0;
|
||||
@@ -517,6 +518,32 @@ void sprite_move(sint16 x, sint16 y, sint16 z, rct_sprite* sprite){
|
||||
sprite->unknown.z = z;
|
||||
}
|
||||
|
||||
void sprite_move_interframe(sint16 x, sint16 y, sint16 z, rct_sprite* sprite){
|
||||
sint16 new_x = x, new_y = y, start_x = x;
|
||||
switch (get_current_rotation()){
|
||||
case 0:
|
||||
new_x = new_y - new_x;
|
||||
new_y = (new_y + start_x) / 2 - z;
|
||||
break;
|
||||
case 1:
|
||||
new_x = -new_y - new_x;
|
||||
new_y = (new_y - start_x) / 2 - z;
|
||||
break;
|
||||
case 2:
|
||||
new_x = -new_y + new_x;
|
||||
new_y = (-new_y - start_x) / 2 - z;
|
||||
break;
|
||||
case 3:
|
||||
new_x = new_y + new_x;
|
||||
new_y = (-new_y + start_x) / 2 - z;
|
||||
break;
|
||||
}
|
||||
|
||||
sprite->unknown.x = x;
|
||||
sprite->unknown.y = y;
|
||||
sprite->unknown.z = z;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* rct2: 0x0069EDB6
|
||||
|
||||
@@ -401,6 +401,7 @@ void sprite_clear_all_unused();
|
||||
void move_sprite_to_list(rct_sprite *sprite, uint8 cl);
|
||||
void sprite_misc_update_all();
|
||||
void sprite_move(sint16 x, sint16 y, sint16 z, rct_sprite* sprite);
|
||||
void sprite_move_interframe(sint16 x, sint16 y, sint16 z, rct_sprite* sprite);
|
||||
void invalidate_sprite_0(rct_sprite* sprite);
|
||||
void invalidate_sprite_1(rct_sprite *sprite);
|
||||
void invalidate_sprite_2(rct_sprite *sprite);
|
||||
|
||||
Reference in New Issue
Block a user