[Lapetus-cvs] lapetus vdp.h, 1.6, 1.7 vdp1.c, 1.1, 1.2 vdpinit.c, 1.4, 1.5
Status: Inactive
Brought to you by:
cyberwarriorx
From: Theo B. <cyb...@us...> - 2007-07-07 03:37:45
|
Update of /cvsroot/lapetus/lapetus In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv5042 Modified Files: vdp.h vdp1.c vdpinit.c Log Message: -Added polygon/polyline/line VDP1 draw functions -Fixed a bug where sprites/polygons weren't being drawn correctly using 16-bit color -Fixed a bug in RGB16 define Index: vdp1.c =================================================================== RCS file: /cvsroot/lapetus/lapetus/vdp1.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- vdp1.c 4 Jul 2007 02:32:43 -0000 1.1 +++ vdp1.c 7 Jul 2007 03:37:41 -0000 1.2 @@ -133,6 +133,68 @@ ////////////////////////////////////////////////////////////////////////////// +void VdpDrawPolygon(sprite_struct *sprite) +{ + volatile vdp1cmd_struct *tbl=(volatile vdp1cmd_struct *)(VDP1_RAM+(commandnum * 0x20)); + + tbl->CMDCTRL = ((sprite->attr >> 12) & 0x7FF0) | 0x0004; + tbl->CMDLINK = sprite->linkaddr / 8; + tbl->CMDPMOD.all = (u16)sprite->attr | 0xC0 ; + tbl->CMDCOLR = sprite->bank; + tbl->CMDXA = sprite->x; + tbl->CMDYA = sprite->y; + tbl->CMDXB = sprite->x2; + tbl->CMDYB = sprite->y2; + tbl->CMDXC = sprite->x3; + tbl->CMDYC = sprite->y3; + tbl->CMDXD = sprite->x4; + tbl->CMDYD = sprite->y4; + tbl->CMDGRDA = sprite->gouraudaddr / 8; + commandnum++; +} + +////////////////////////////////////////////////////////////////////////////// + +void VdpDrawPolyLine(sprite_struct *sprite) +{ + volatile vdp1cmd_struct *tbl=(volatile vdp1cmd_struct *)(VDP1_RAM+(commandnum * 0x20)); + + tbl->CMDCTRL = ((sprite->attr >> 12) & 0x7FF0) | 0x0005; + tbl->CMDLINK = sprite->linkaddr / 8; + tbl->CMDPMOD.all = (u16)sprite->attr | 0xC0; + tbl->CMDCOLR = sprite->bank; + tbl->CMDXA = sprite->x; + tbl->CMDYA = sprite->y; + tbl->CMDXB = sprite->x2; + tbl->CMDYB = sprite->y2; + tbl->CMDXC = sprite->x3; + tbl->CMDYC = sprite->y3; + tbl->CMDXD = sprite->x4; + tbl->CMDYD = sprite->y4; + tbl->CMDGRDA = sprite->gouraudaddr / 8; + commandnum++; +} + +////////////////////////////////////////////////////////////////////////////// + +void VdpDrawLine(sprite_struct *sprite) +{ + volatile vdp1cmd_struct *tbl=(volatile vdp1cmd_struct *)(VDP1_RAM+(commandnum * 0x20)); + + tbl->CMDCTRL = ((sprite->attr >> 12) & 0x7FF0) | 0x0005; + tbl->CMDLINK = sprite->linkaddr / 8; + tbl->CMDPMOD.all = (u16)sprite->attr | 0xC0; + tbl->CMDCOLR = sprite->bank; + tbl->CMDXA = sprite->x; + tbl->CMDYA = sprite->y; + tbl->CMDXB = sprite->x2; + tbl->CMDYB = sprite->y2; + tbl->CMDGRDA = sprite->gouraudaddr / 8; + commandnum++; +} + +////////////////////////////////////////////////////////////////////////////// + void VdpStartDrawList() { commandnum = 0; Index: vdpinit.c =================================================================== RCS file: /cvsroot/lapetus/lapetus/vdpinit.c,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- vdpinit.c 4 Jul 2007 02:29:36 -0000 1.4 +++ vdpinit.c 7 Jul 2007 03:37:41 -0000 1.5 @@ -126,6 +126,9 @@ EWRR |= 256; VDP1_REG_EWRR = EWRR; + + // Setup Sprite data to be both RGB and palette + VDP2_REG_SPCTL = 0x0020; VDP1_REG_PTMR = 0x0002; // Clear VDP2 Ram Index: vdp.h =================================================================== RCS file: /cvsroot/lapetus/lapetus/vdp.h,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- vdp.h 4 Jul 2007 02:32:43 -0000 1.6 +++ vdp.h 7 Jul 2007 03:37:41 -0000 1.7 @@ -862,7 +862,7 @@ #define SPRITE_8BPP256COLOR 0x00000020 #define SPRITE_16BPP 0x00000028 -#define RGB16(r, g, b) (0x8000 | (((b) & 0x1F) << 10) | (((g) & 0x1F) << 10) | ((r) & 0x1F)) +#define RGB16(r, g, b) (0x8000 | (((b) & 0x1F) << 10) | (((g) & 0x1F) << 5) | ((r) & 0x1F)) typedef struct { @@ -950,6 +950,9 @@ void VdpDrawNormalSprite(sprite_struct *sprite); void VdpDrawScaledSprite(sprite_struct *sprite); void VdpDrawDistortedSprite(sprite_struct *sprite); +void VdpDrawPolygon(sprite_struct *sprite); +void VdpDrawPolyLine(sprite_struct *sprite); +void VdpDrawLine(sprite_struct *sprite); void VdpStartDrawList(); void VdpEndDrawList(); |