X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?a=blobdiff_plain;f=src%2Fgame.c;h=87edac7dbeeaf28f663db391728f459067b6970e;hb=08dc7cfecb35a6893f7f8d96196859593272da3b;hp=97c1895be7f7647790e37fbbba43332d541b3a0b;hpb=87c45ef8c82a3925719cbf2024e5932208b244ce;p=retrocrawl diff --git a/src/game.c b/src/game.c index 97c1895..87edac7 100644 --- a/src/game.c +++ b/src/game.c @@ -1,7 +1,10 @@ +#include #include #include "game.h" #include "gfx.h" +#include "copper.h" #include "data.h" +#include "sprite.h" #include "hwregs.h" /* XXX */ @@ -10,9 +13,17 @@ 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; + + printf("hello world\n"); + REG_COLOR0 = 0x221; REG_COLOR1 = 0x222; REG_COLOR2 = 0x332; @@ -22,6 +33,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 +73,10 @@ void game_draw(void) } yoffs += TILE_H / 2; } + + begin_sprites(); + draw_sprite(&test_sprite, 160, 100); + end_sprites(); }