1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-28 09:14:58 +01:00

Add get_current_rotation function and DEBUG_LEVEL macros

This commit is contained in:
Michał Janiszewski
2015-10-30 11:00:35 +01:00
parent be32b5e5f4
commit c0e2a5c7be
26 changed files with 209 additions and 139 deletions

View File

@@ -3539,28 +3539,28 @@ void map_get_bounding_box(int ax, int ay, int bx, int by, int *left, int *top, i
int x, y;
x = ax;
y = ay;
translate_3d_to_2d(RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_ROTATION, uint32), &x, &y);
translate_3d_to_2d(get_current_rotation(), &x, &y);
*left = x;
*right = x;
*top = y;
*bottom = y;
x = bx;
y = ay;
translate_3d_to_2d(RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_ROTATION, uint32), &x, &y);
translate_3d_to_2d(get_current_rotation(), &x, &y);
if (x < *left) *left = x;
if (x > *right) *right = x;
if (y > *bottom) *bottom = y;
if (y < *top) *top = y;
x = bx;
y = by;
translate_3d_to_2d(RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_ROTATION, uint32), &x, &y);
translate_3d_to_2d(get_current_rotation(), &x, &y);
if (x < *left) *left = x;
if (x > *right) *right = x;
if (y > *bottom) *bottom = y;
if (y < *top) *top = y;
x = ax;
y = by;
translate_3d_to_2d(RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_ROTATION, uint32), &x, &y);
translate_3d_to_2d(get_current_rotation(), &x, &y);
if (x < *left) *left = x;
if (x > *right) *right = x;
if (y > *bottom) *bottom = y;
@@ -4431,7 +4431,7 @@ void map_invalidate_tile_under_zoom(int x, int y, int z0, int z1, int maxZoom)
x += 16;
y += 16;
translate_3d_to_2d(RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_ROTATION, uint32), &x, &y);
translate_3d_to_2d(get_current_rotation(), &x, &y);
x1 = x - 32;
y1 = y - 32 - z1;

View File

@@ -22,6 +22,7 @@
#include "../ride/ride.h"
#include "../ride/ride_data.h"
#include "../ride/track.h"
#include "../interface/viewport.h"
#include "map_animation.h"
#include "map.h"
#include "scenery.h"
@@ -150,7 +151,7 @@ static bool map_animation_invalidate_queue_banner(int x, int y, int baseZ)
if (!(mapElement->properties.path.type & PATH_FLAG_QUEUE_BANNER))
continue;
int direction = ((mapElement->type >> 6) + RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_ROTATION, uint8)) & 3;
int direction = ((mapElement->type >> 6) + get_current_rotation()) & 3;
if (direction == MAP_ELEMENT_DIRECTION_NORTH || direction == MAP_ELEMENT_DIRECTION_EAST) {
baseZ = mapElement->base_height * 8;
map_invalidate_tile_zoom1(x, y, baseZ + 16, baseZ + 30);
@@ -542,4 +543,4 @@ static const map_animation_invalidate_event_handler _animatedObjectEventHandlers
map_animation_invalidate_large_scenery,
map_animation_invalidate_wall_unknown,
map_animation_invalidate_wall
};
};

View File

@@ -96,8 +96,8 @@ void money_effect_update(rct_money_effect *moneyEffect)
return;
moneyEffect->move_delay = 0;
int x = moneyEffect->x + _moneyEffectMoveOffset[RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_ROTATION, uint8)].x;
int y = moneyEffect->y + _moneyEffectMoveOffset[RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_ROTATION, uint8)].y;
int x = moneyEffect->x + _moneyEffectMoveOffset[get_current_rotation()].x;
int y = moneyEffect->y + _moneyEffectMoveOffset[get_current_rotation()].y;
int z = moneyEffect->z;
sprite_move(x, y, z, (rct_sprite*)moneyEffect);

View File

@@ -451,7 +451,7 @@ void sprite_move(sint16 x, sint16 y, sint16 z, rct_sprite* sprite){
return;
}
sint16 new_x = x, new_y = y, start_x = x;
switch (RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_ROTATION, uint32)){
switch (get_current_rotation()){
case 0:
new_x = new_y - new_x;
new_y = (new_y + start_x) / 2 - z;