X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?a=blobdiff_plain;f=src%2Fgame.c;h=8afa769917fde9acf224589baffc5c8a001aa407;hb=HEAD;hp=a4dc4c70067e142ae6a54c94db54a7f3068600f0;hpb=bba694e9bc50fb24ffe4b3c8f7b5d33f01b3ea4d;p=retrocrawl diff --git a/src/game.c b/src/game.c index a4dc4c7..8afa769 100644 --- a/src/game.c +++ b/src/game.c @@ -1,40 +1,97 @@ +#include #include #include "game.h" -#include "data_test.h" #include "gfx.h" +#include "copper.h" +#include "data.h" +#include "sprite.h" #include "hwregs.h" /* XXX */ -#define TILE_W 32 -#define TILE_H 16 +#define TILE_W 64 +#define TILE_H 32 void draw_tile(int tid, int x, int y, int light); -void convert_tile_data(unsigned char *dest, const char *src); -static unsigned char test_tiles[2][TILE_W * TILE_H / 8 * NBPL]; -static unsigned char tile_mask[TILE_W * TILE_H / 8 * NBPL]; +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; - for(i=0; i<2; i++) { - convert_tile_data(test_tiles[i], test_tiles_cpix[i][0]); + printf("hello world\n"); + + REG_COLOR0 = 0x221; + REG_COLOR1 = 0x222; + REG_COLOR2 = 0x332; + REG_COLOR3 = 0x433; + REG_COLOR4 = 0x543; + REG_COLOR5 = 0x554; + 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; } - convert_tile_data(tile_mask, tile_mask_cpix[0]); + return 0; } +#define XTILES 5 +#define YTILES 13 + void game_draw(void) { - draw_tile(0, 32, 16, 0); + int i, j, xoffs, yoffs, ntiles; + + yoffs = 0; + for(i=0; i>= 1; - - if((j & 7) == 7) { - bptr[k]++; - } - } - } - - for(j=0; j