Skip to content

Commit

Permalink
SPRITE_UNIQUE_ID macro made public
Browse files Browse the repository at this point in the history
  • Loading branch information
Zal0 committed Aug 2, 2019
1 parent 0d8c8a3 commit 0d94342
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 2 additions & 0 deletions common/include/Scroll.h
Expand Up @@ -5,6 +5,8 @@
#include "TilesInfo.h"
#include "MapInfo.h"

#define SPRITE_UNIQUE_ID(TILE_X, TILE_Y) ((0x00FF & TILE_X) | ((0xFF00 & (TILE_Y << 8))))

extern unsigned char* scroll_map;
extern INT16 scroll_x;
extern INT16 scroll_y;
Expand Down
4 changes: 1 addition & 3 deletions common/src/Scroll.c
Expand Up @@ -90,16 +90,14 @@ void UPDATE_TILE(INT16 x, INT16 y, UINT8* t, UINT8* c) {
struct Sprite* s = 0;
UINT8 type = 255u;
UINT16 id = 0u;
UINT16 tmp_y;
c;

if(x < 0 || y < 0 || U_LESS_THAN(scroll_tiles_w - 1, x) || U_LESS_THAN(scroll_tiles_h - 1, y)) {
replacement = 0;
} else {
type = GetTileReplacement(t, &replacement);
if(type != 255u) {
tmp_y = y << 8;
id = (0x00FF & x) | ((0xFF00 & tmp_y)); // (y >> 3) << 8 == y << 5
id = SPRITE_UNIQUE_ID(x, y);
for(i = 0u; i != sprite_manager_updatables[0]; ++i) {
s = sprite_manager_sprites[sprite_manager_updatables[i + 1]];
if((s->unique_id == id) && ((UINT16)s->type == (UINT16)type)) {
Expand Down

0 comments on commit 0d94342

Please sign in to comment.