X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?a=blobdiff_plain;f=src%2Fgame.c;h=89b4e5a0b27fd13aea363a5eb57108c310e3e006;hb=fa6997608f790933b3d4bb9f55d17084f77dfc16;hp=97c1895be7f7647790e37fbbba43332d541b3a0b;hpb=87c45ef8c82a3925719cbf2024e5932208b244ce;p=retrocrawl diff --git a/src/game.c b/src/game.c index 97c1895..89b4e5a 100644 --- a/src/game.c +++ b/src/game.c @@ -1,7 +1,9 @@ #include #include "game.h" #include "gfx.h" +#include "copper.h" #include "data.h" +#include "sprite.h" #include "hwregs.h" /* XXX */ @@ -10,9 +12,15 @@ void draw_tile(int tid, int x, int y, int light); +static uint16_t *sprdata[NUM_HWSPRITES]; + +/* hardcoded test sprite */ +static struct sprite test_sprite; int game_init(void) { + int i; + REG_COLOR0 = 0x221; REG_COLOR1 = 0x222; REG_COLOR2 = 0x332; @@ -22,6 +30,26 @@ int game_init(void) REG_COLOR6 = 0x654; REG_COLOR7 = 0x765; + for(i=0; i<16; i++) { + REG_COLOR_PTR[i + 16] = sprpal[i]; + } + + sprdata[0] = spr0a; + sprdata[1] = spr0b; + sprdata[2] = spr1a; + sprdata[3] = spr1b; + sprdata[4] = spr2a; + sprdata[5] = spr2b; + + test_sprite.width = test_sprite.height = 48; + test_sprite.origx = 24; + test_sprite.origy = 24; + test_sprite.img = test_sprite.mask = 0; + test_sprite.hwslices = 3; + for(i=0; i<8; i++) { + test_sprite.hwspr[i] = i < 6 ? sprdata[i] : 0; + } + return 0; } @@ -42,6 +70,10 @@ void game_draw(void) } yoffs += TILE_H / 2; } + + begin_sprites(); + draw_sprite(&test_sprite, 160, 100); + end_sprites(); }