From 0421c59effab8d0bb1d493dc743520718095c53a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Janiszewski?= Date: Mon, 25 Jul 2016 20:18:35 +0200 Subject: [PATCH] Refactor `sprite_set_coordinates` --- src/openrct2.c | 4 ++-- src/world/sprite.c | 22 +--------------------- src/world/sprite.h | 2 +- 3 files changed, 4 insertions(+), 24 deletions(-) diff --git a/src/openrct2.c b/src/openrct2.c index 55e449c22a..d3554430eb 100644 --- a/src/openrct2.c +++ b/src/openrct2.c @@ -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 { diff --git a/src/world/sprite.c b/src/world/sprite.c index f493207660..6749cbcf20 100644 --- a/src/world/sprite.c +++ b/src/world/sprite.c @@ -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; diff --git a/src/world/sprite.h b/src/world/sprite.h index f8fb5dd009..8efe20e79f 100644 --- a/src/world/sprite.h +++ b/src/world/sprite.h @@ -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);