[Maintenance] [th01] Merge invincibility sprites into the regular 8×8 shapes

They have the same size, their hardcoded sprites are stored next to
each other in the code, and…

Part of P0153, funded by Ember2528.
This commit is contained in:
nmlgc 2021-08-15 18:31:15 +02:00
parent cd969d543b
commit 308b73524d
10 changed files with 25 additions and 32 deletions

View File

@ -33,7 +33,6 @@ BMP2ARR = bin\\Pipeline\\bmp2arr.exe
: th01/sprites/pellet.bmp |> !bmp2arr -sym sPELLET -of c -sw 8 -sh 8 -pshf inner |> th01/sprites/pellet.csp
: th01/sprites/pellet_c.bmp |> !bmp2arr -sym _sPELLET_CLOUD -of asm -sw 16 -sh 16 |> th01/sprites/pellet_c.asp
: th01/sprites/shape8x8.bmp |> !bmp2arr -sym _sSHAPE8X8 -of asm -sw 8 -sh 8 |> th01/sprites/shape8x8.asp
: th01/sprites/shape_in.bmp |> !bmp2arr -sym _sSHAPE_INVINCIBILITY -of asm -sw 8 -sh 8 |> th01/sprites/shape_in.asp
: th02/sprites/pellet.bmp |> !bmp2arr -sym _sPELLET -of asm -sw 8 -sh 8 -pshf outer |> th02/sprites/pellet.asp
: th02/sprites/sparks.bmp |> !bmp2arr -sym _sSPARKS -of asm -sw 8 -sh 8 -pshf outer |> th02/sprites/sparks.asp
: th02/sprites/pointnum.bmp |> !bmp2arr -sym _sPOINTNUMS -of asm -sw 8 -sh 8 |> th02/sprites/pointnum.asp
@ -62,7 +61,6 @@ BMP2ARR = bin\\Pipeline\\bmp2arr.exe
th01/sprites/laser_s.asp \
th01/sprites/pellet_c.asp \
th01/sprites/shape8x8.asp \
th01/sprites/shape_in.asp \
|> !as |> bin\\th01\\reiiden.obj
: th01_fuuin.asm |> !as |> bin\\th01\\fuuin.obj

View File

@ -8,7 +8,6 @@ bin\\Pipeline\\bmp2arr.exe -q -i th01/sprites/laser_s.bmp -o th01/sprites/laser_
bin\\Pipeline\\bmp2arr.exe -q -i th01/sprites/pellet.bmp -o th01/sprites/pellet.csp -sym sPELLET -of c -sw 8 -sh 8 -pshf inner
bin\\Pipeline\\bmp2arr.exe -q -i th01/sprites/pellet_c.bmp -o th01/sprites/pellet_c.asp -sym _sPELLET_CLOUD -of asm -sw 16 -sh 16
bin\\Pipeline\\bmp2arr.exe -q -i th01/sprites/shape8x8.bmp -o th01/sprites/shape8x8.asp -sym _sSHAPE8X8 -of asm -sw 8 -sh 8
bin\\Pipeline\\bmp2arr.exe -q -i th01/sprites/shape_in.bmp -o th01/sprites/shape_in.asp -sym _sSHAPE_INVINCIBILITY -of asm -sw 8 -sh 8
bin\\Pipeline\\bmp2arr.exe -q -i th02/sprites/pellet.bmp -o th02/sprites/pellet.asp -sym _sPELLET -of asm -sw 8 -sh 8 -pshf outer
bin\\Pipeline\\bmp2arr.exe -q -i th02/sprites/sparks.bmp -o th02/sprites/sparks.asp -sym _sSPARKS -of asm -sw 8 -sh 8 -pshf outer
bin\\Pipeline\\bmp2arr.exe -q -i th02/sprites/pointnum.bmp -o th02/sprites/pointnum.asp -sym _sPOINTNUMS -of asm -sw 8 -sh 8

View File

@ -1,4 +1,4 @@
#include "th01/sprites/shape_in.hpp"
#include "th01/sprites/shape8x8.hpp"
#include "th01/main/shape.hpp"
static const int INVINCIBILITY_SPRITE_COUNT = 8;
@ -17,7 +17,7 @@ void invincibility_sprites_update_and_render(bool16 invincible)
#define sloppy_unput(i) \
egc_copy_rect_1_to_0_16( \
sprites.left[i], sprites.top[i], 16, SHAPE_INVINCIBILITY_H \
sprites.left[i], sprites.top[i], 16, sSHAPE8X8[0].h() \
);
if(!invincible) {
@ -52,12 +52,12 @@ void invincibility_sprites_update_and_render(bool16 invincible)
// ZUN bug: Did you mean: `sprites.left[i]`?
if(
(sprites.top[i] >= 0) &&
(sprites.top[i] < (RES_X - SHAPE_INVINCIBILITY_W))
(sprites.top[i] < (RES_X - sSHAPE8X8[0].w()))
) {
shape_invincibility_put(
shape8x8_invincibility_put(
sprites.left[i],
sprites.top[i],
(sprites.frame[i] <= SHAPE_INVINCIBILITY_COUNT)
(sprites.frame[i] <= SHAPE8X8_INVINCIBILITY_CELS)
? (sprites.frame[i] - 1)
: (INVINCIBILITY_SPRITE_FRAMES - sprites.frame[i])
);

View File

@ -1,5 +1,4 @@
#include "th01/sprites/shape8x8.hpp"
#include "th01/sprites/shape_in.hpp"
#include "th01/main/shape.hpp"
#define shape8x8_put(shape, left, top, col) \
@ -102,27 +101,27 @@ void shape_ellipse_arc_sloppy_unput(
}
}
void shape_invincibility_put_with_mask_from_B_plane(
void shape8x8_invincibility_put_with_mask_from_B_plane(
screen_x_t left, vram_y_t top, int cel
);
void shape_invincibility_put(screen_x_t left, vram_y_t top, int cel)
void shape8x8_invincibility_put(screen_x_t left, vram_y_t top, int cel)
{
if(left < 0) {
return;
}
shape_invincibility_put_with_mask_from_B_plane(left, top, cel);
shape8x8_invincibility_put_with_mask_from_B_plane(left, top, cel);
vram_offset_t vram_offset = vram_offset_divmul(left, top);
int first_bit = (left % BYTE_DOTS);
if(cel > (SHAPE_INVINCIBILITY_COUNT - 1)) {
if(cel > (SHAPE8X8_INVINCIBILITY_CELS - 1)) {
return;
}
grcg_setcolor_rmw(10);
for(pixel_t y = 0; y < SHAPE_INVINCIBILITY_H; y++) {
#define sprite sSHAPE_INVINCIBILITY[cel][y]
for(pixel_t y = 0; y < sSHAPE8X8[0].h(); y++) {
#define sprite sSHAPE8X8[SHAPE8X8_INVINCIBILITY + cel][y]
if(first_bit == 0) {
grcg_put(vram_offset, sprite, 8);
@ -161,7 +160,7 @@ void shape_invincibility_put(screen_x_t left, vram_y_t top, int cel)
// result, this unblitting attempt actually blits the sprite again, masked by
// whatever was in VRAM plane B at the given position before calling this
// function.
void shape_invincibility_put_with_mask_from_B_plane(
void shape8x8_invincibility_put_with_mask_from_B_plane(
screen_x_t left, vram_y_t top, int cel
)
{
@ -172,13 +171,13 @@ void shape_invincibility_put_with_mask_from_B_plane(
vram_offset_t vram_offset = vram_offset_divmul(left, top);
int first_bit = (left % BYTE_DOTS);
if(cel > (SHAPE_INVINCIBILITY_COUNT - 1)) {
if(cel > (SHAPE8X8_INVINCIBILITY_CELS - 1)) {
return;
}
grcg_setcolor_rmw(10);
for(pixel_t y = 0; y < SHAPE_INVINCIBILITY_H; y++) {
#define sprite sSHAPE_INVINCIBILITY[cel][y]
for(pixel_t y = 0; y < sSHAPE8X8[0].h(); y++) {
#define sprite sSHAPE8X8[SHAPE8X8_INVINCIBILITY + cel][y]
if(first_bit == 0) {
dots8_t bg_B;

View File

@ -4,6 +4,10 @@ void shape8x8_diamond_put(screen_x_t left, vram_y_t top, int col);
void shape8x8_star_put(screen_x_t left, vram_y_t top, int col);
void shape8x8_flake_put(screen_x_t left, vram_y_t top, int col);
// Blits the given [cel] of the hardcoded invincibility sprites to the given
// position.
void shape8x8_invincibility_put(screen_x_t left, vram_y_t top, int cel);
void shape_ellipse_arc_put(
screen_x_t center_x,
vram_y_t center_y,
@ -27,7 +31,3 @@ void shape_ellipse_arc_sloppy_unput(
unsigned char angle_start,
unsigned char angle_end
);
// Blits the given [cel] of the hardcoded invincibility sprites to
// (left, top).
void shape_invincibility_put(screen_x_t left, vram_y_t top, int cel);

Binary file not shown.

Before

Width:  |  Height:  |  Size: 94 B

After

Width:  |  Height:  |  Size: 126 B

View File

@ -1,7 +1,13 @@
static const int SHAPE8X8_INVINCIBILITY_CELS = 4;
typedef enum {
SHAPE8X8_DIAMOND,
SHAPE8X8_STAR,
SHAPE8X8_FLAKE,
SHAPE8X8_INVINCIBILITY,
SHAPE8X8_INVINCIBILITY_last = (
SHAPE8X8_INVINCIBILITY + SHAPE8X8_INVINCIBILITY_CELS - 1
),
SHAPE8X8_COUNT
} shape8x8_t;

Binary file not shown.

Before

Width:  |  Height:  |  Size: 94 B

View File

@ -1,7 +0,0 @@
static const int SHAPE_INVINCIBILITY_COUNT = 4;
#define SHAPE_INVINCIBILITY_W 8
#define SHAPE_INVINCIBILITY_H 8
extern const dot_rect_t(
SHAPE_INVINCIBILITY_W, SHAPE_INVINCIBILITY_H
) sSHAPE_INVINCIBILITY[SHAPE_INVINCIBILITY_COUNT];

View File

@ -6647,7 +6647,6 @@ main_23_TEXT segment byte public 'CODE' use16
extern @shape8x8_flake_put$qiii:proc
extern @shape_ellipse_arc_put$qiiiiiucucuc:proc
extern @shape_ellipse_arc_sloppy_unput$qiiiiucucuc:proc
extern @shape_invincibility_put$qiii:proc
extern _graph_r_lineloop_put:proc
extern _graph_r_lineloop_unput:proc
main_23_TEXT ends
@ -41463,7 +41462,6 @@ include th01/hiscore/regist[data].asm
include th01/main/boss/entity_a[data].asm
include th01/formats/pf[data].asm
include th01/sprites/shape8x8.asp
include th01/sprites/shape_in.asp
aBomb db 'Bomb',0
aExtend db 'Extend!!',0
aVpf db 'PäÝ',0