mirror of https://github.com/nmlgc/ReC98.git
[Maintenance] [th01] Use a common macro for sloppy unblitting of 8×8 sprites
… treating them as conceptually the same thing allows us to deduplicate these macros. Part of P0153, funded by Ember2528.
This commit is contained in:
parent
308b73524d
commit
18757c33f9
|
@ -410,9 +410,7 @@ void pattern_diamond_cross_to_edges_followed_by_rain(void)
|
|||
|
||||
#define diamonds_unput(i) \
|
||||
for(i = 0; i < DIAMOND_COUNT; i++) { \
|
||||
egc_copy_rect_1_to_0_16( \
|
||||
diamonds.left[i], diamonds.top[i], 16, DIAMOND_H \
|
||||
); \
|
||||
shape8x8_sloppy_unput(diamonds.left[i], diamonds.top[i]); \
|
||||
}
|
||||
|
||||
#define diamonds_put(i) \
|
||||
|
|
|
@ -15,17 +15,12 @@ void invincibility_sprites_update_and_render(bool16 invincible)
|
|||
} invincibility_sprites;
|
||||
#define sprites invincibility_sprites
|
||||
|
||||
#define sloppy_unput(i) \
|
||||
egc_copy_rect_1_to_0_16( \
|
||||
sprites.left[i], sprites.top[i], 16, sSHAPE8X8[0].h() \
|
||||
);
|
||||
|
||||
if(!invincible) {
|
||||
if(sprites.frame[0] == INVINCIBILITY_SPRITES_DONE) {
|
||||
return;
|
||||
}
|
||||
for(i = 0; i < INVINCIBILITY_SPRITE_COUNT; i++) {
|
||||
sloppy_unput(i);
|
||||
shape8x8_sloppy_unput(sprites.left[i], sprites.top[i]);
|
||||
}
|
||||
sprites.frame[0] = INVINCIBILITY_SPRITES_DONE;
|
||||
return;
|
||||
|
@ -43,7 +38,7 @@ void invincibility_sprites_update_and_render(bool16 invincible)
|
|||
(sprites.frame[i] == 0)
|
||||
) {
|
||||
if(sprites.frame[i] == (INVINCIBILITY_SPRITE_FRAMES + 1)) {
|
||||
sloppy_unput(i);
|
||||
shape8x8_sloppy_unput(sprites.left[i], sprites.top[i]);
|
||||
}
|
||||
sprites.left[i] = ((rand() % 48) + (player_left - 8));
|
||||
sprites.top[i] = ((rand() % 48) + (player_top - 16));
|
||||
|
@ -64,6 +59,5 @@ void invincibility_sprites_update_and_render(bool16 invincible)
|
|||
}
|
||||
sprites.frame[i]++;
|
||||
}
|
||||
#undef sloppy_unput
|
||||
#undef sprites
|
||||
}
|
||||
|
|
|
@ -8,6 +8,11 @@ void shape8x8_flake_put(screen_x_t left, vram_y_t top, int col);
|
|||
// position.
|
||||
void shape8x8_invincibility_put(screen_x_t left, vram_y_t top, int cel);
|
||||
|
||||
// Attempts to unblit a 8×8 sprite, but ends up unblitting a 16×8 rectangle
|
||||
// instead.
|
||||
#define shape8x8_sloppy_unput(left, top) \
|
||||
egc_copy_rect_1_to_0_16(left, top, 16, 8);
|
||||
|
||||
void shape_ellipse_arc_put(
|
||||
screen_x_t center_x,
|
||||
vram_y_t center_y,
|
||||
|
|
Loading…
Reference in New Issue