mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2025-12-10 09:32:29 +01:00
Refactor sprite_set_coordinates
This commit is contained in:
@@ -411,7 +411,7 @@ static void openrct2_loop()
|
||||
if (!sprite_should_tween(get_sprite(i)))
|
||||
continue;
|
||||
|
||||
sprite_move_interframe(
|
||||
sprite_set_coordinates(
|
||||
_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_interframe(_spritelocations2[i].x, _spritelocations2[i].y, _spritelocations2[i].z, get_sprite(i));
|
||||
sprite_set_coordinates(_spritelocations2[i].x, _spritelocations2[i].y, _spritelocations2[i].z, get_sprite(i));
|
||||
}
|
||||
network_update();
|
||||
} else {
|
||||
|
||||
@@ -518,27 +518,7 @@ 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;
|
||||
}
|
||||
|
||||
void sprite_set_coordinates(sint16 x, sint16 y, sint16 z, rct_sprite *sprite){
|
||||
sprite->unknown.x = x;
|
||||
sprite->unknown.y = y;
|
||||
sprite->unknown.z = z;
|
||||
|
||||
@@ -401,7 +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 sprite_set_coordinates(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