X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?a=blobdiff_plain;f=src%2Fgame.c;h=8afa769917fde9acf224589baffc5c8a001aa407;hb=3f381738bd1f53bace45c8bf9ffc6d772ff90aab;hp=97c1895be7f7647790e37fbbba43332d541b3a0b;hpb=87c45ef8c82a3925719cbf2024e5932208b244ce;p=retrocrawl diff --git a/src/game.c b/src/game.c index 97c1895..8afa769 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,19 @@ void draw_tile(int tid, int x, int y, int light); +static uint16_t *sprdata[NUM_HWSPRITES]; +static uint16_t *sprdata2[NUM_HWSPRITES]; + +/* hardcoded test sprite */ +static struct sprite test_sprite; +static struct sprite test_sprite2; int game_init(void) { + int i; + + printf("hello world\n"); + REG_COLOR0 = 0x221; REG_COLOR1 = 0x222; REG_COLOR2 = 0x332; @@ -22,6 +35,31 @@ 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] = sprdata2[0] = spr0a; + sprdata[1] = sprdata2[1] = spr0b; + sprdata[2] = sprdata2[2] = spr1a; + sprdata[3] = sprdata2[3] = spr1b; + sprdata[4] = sprdata2[4] = spr2a; + sprdata[5] = sprdata2[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; + } + + test_sprite2 = test_sprite; + for(i=0; i<8; i++) { + test_sprite2.hwspr[i] = i < 6 ? sprdata2[i] : 0; + } + return 0; } @@ -42,6 +80,11 @@ void game_draw(void) } yoffs += TILE_H / 2; } + + begin_sprites(); + draw_sprite(&test_sprite, 160, 80); + draw_sprite(&test_sprite2, 160, 160); + end_sprites(); }