projects
/
mdlife
/ blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
history
|
raw
|
HEAD
constrained parallax scrolling
[mdlife]
/
src
/
sprite.c
1
#include <string.h>
2
#include "sprite.h"
3
#include "vdp.h"
4
5
struct hwsprite spr_shadow[MAX_HWSPRITES];
6
short spr_count;
7
8
void spr_begin(void)
9
{
10
memset(spr_shadow, 0, sizeof spr_shadow[0]);
11
spr_count = 0;
12
}
13
14
void spr_add(int x, int y, unsigned int tile, int sprsz)
15
{
16
short id;
17
struct hwsprite *spr;
18
19
if(spr_count >= MAX_HWSPRITES) {
20
return;
21
}
22
id = spr_count++;
23
spr = spr_shadow + id;
24
if(id > 0) {
25
spr[-1].next = id;
26
}
27
28
spr->x = x + 128;
29
spr->y = y + 128;
30
spr->sz = sprsz;
31
spr->tile = tile;
32
spr->next = 0;
33
}