Skip to content

Commit

Permalink
Changes backported from f3d048e
Browse files Browse the repository at this point in the history
* [png2c] add definition for number of generated sprites
* [ResetSprites] Reset sprite priorities as well.
  • Loading branch information
cahirwpz committed Dec 16, 2023
1 parent a39b2bf commit 11d671b
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 3 deletions.
1 change: 1 addition & 0 deletions lib/libgfx/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ SOURCES := \
NullSprData.c \
PixmapScramble_4_1.c \
PixmapScramble_4_2.c \
ResetSprites.c \
SetupBitplaneFetch.c \
SetupDisplayWindow.c \
SetupMode.c \
Expand Down
17 changes: 17 additions & 0 deletions lib/libgfx/ResetSprites.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#include <custom.h>
#include <sprite.h>

void ResetSprites(void) {
short i;

DisableDMA(DMAF_SPRITE);

/* Move sprites into foreground. */
custom->bplcon2 = BPLCON2_PF1P2|BPLCON2_PF2P2;

for (i = 0; i < 8; i++) {
custom->sprpt[i] = NullSprData;
custom->spr[i].datab = 0;
custom->spr[i].dataa = 0;
}
}
7 changes: 4 additions & 3 deletions tools/png2c.py
Original file line number Diff line number Diff line change
Expand Up @@ -259,13 +259,14 @@ def do_sprite(im, desc):
stride = ((width + 15) & ~15) // 16
bpl = planar(pix, width, height, depth)

print(f'static const short {name}_height = {height};')
print('')

n = width // 16
if attached:
n *= 2

print(f'#define {name}_height {height}')
print(f'#define {name}_sprites {n}')
print('')

sprites = []

for i in range(n):
Expand Down

0 comments on commit 11d671b

Please sign in to comment.