Merge branch 'master' of https://github.com/finalburnneo/FBNeo into finalburnneo-master

This commit is contained in:
barbudreadmon 2019-11-06 07:40:54 +01:00
commit b169ba02af
5 changed files with 1339 additions and 1493 deletions

View File

@ -10,16 +10,9 @@ static UINT8 *AllMem;
static UINT8 *MemEnd;
static UINT8 *AllRam;
static UINT8 *RamEnd;
static UINT8 *DrvZ80ROM0;
static UINT8 *DrvZ80ROM1;
static UINT8 *DrvDecROM0;
static UINT8 *DrvGfxROM0;
static UINT8 *DrvGfxROM1;
static UINT8 *DrvGfxROM2;
static UINT8 *DrvGfxROM3;
static UINT8 *DrvGfxROM4;
static UINT8 *DrvZ80RAM0;
static UINT8 *DrvZ80RAM1;
static UINT8 *DrvZ80ROM[3];
static UINT8 *DrvGfxROM[5];
static UINT8 *DrvZ80RAM[2];
static UINT8 *DrvPalRAM;
static UINT8 *DrvVidRAM;
static UINT8 *DrvSprRAM;
@ -27,6 +20,11 @@ static UINT8 *DrvSprRAM;
static UINT32 *DrvPalette;
static UINT8 DrvRecalc;
static UINT8 *bg_base;
static UINT8 soundlatch;
static UINT8 flipscreen;
static UINT8 calorie_bg;
static UINT8 DrvJoy1[8];
static UINT8 DrvJoy2[8];
static UINT8 DrvJoy3[8];
@ -34,10 +32,6 @@ static UINT8 DrvDips[2];
static UINT8 DrvReset;
static UINT8 DrvInputs[3];
static UINT8 *soundlatch;
static UINT8 *flipscreen;
static UINT8 *calorie_bg;
static struct BurnInputInfo CalorieInputList[] = {
{"P1 Coin", BIT_DIGITAL, DrvJoy3 + 2, "p1 coin" },
{"P1 Start", BIT_DIGITAL, DrvJoy3 + 0, "p1 start" },
@ -66,82 +60,92 @@ STDINPUTINFO(Calorie)
static struct BurnDIPInfo CalorieDIPList[]=
{
// Default Values
{0x11, 0xff, 0xff, 0x30, NULL },
{0x12, 0xff, 0xff, 0x40, NULL },
{0x11, 0xff, 0xff, 0x30, NULL },
{0x12, 0xff, 0xff, 0x40, NULL },
{0 , 0xfe, 0 , 4, "Coin A" },
{0x11, 0x01, 0x03, 0x00, "1 Coin 1 Credits " },
{0x11, 0x01, 0x03, 0x01, "1 Coin 2 Credits " },
{0x11, 0x01, 0x03, 0x02, "1 Coin 3 Credits " },
{0x11, 0x01, 0x03, 0x03, "1 Coin 6 Credits " },
{0 , 0xfe, 0 , 4, "Coin A" },
{0x11, 0x01, 0x03, 0x00, "1 Coin 1 Credits" },
{0x11, 0x01, 0x03, 0x01, "1 Coin 2 Credits" },
{0x11, 0x01, 0x03, 0x02, "1 Coin 3 Credits" },
{0x11, 0x01, 0x03, 0x03, "1 Coin 6 Credits" },
{0 , 0xfe, 0 , 4, "Coin B" },
{0x11, 0x01, 0x0c, 0x0c, "2 Coins 1 Credits " },
{0x11, 0x01, 0x0c, 0x00, "1 Coin 1 Credits " },
{0x11, 0x01, 0x0c, 0x04, "1 Coin 2 Credits " },
{0x11, 0x01, 0x0c, 0x08, "1 Coin 3 Credits " },
{0 , 0xfe, 0 , 4, "Coin B" },
{0x11, 0x01, 0x0c, 0x0c, "2 Coins 1 Credits" },
{0x11, 0x01, 0x0c, 0x00, "1 Coin 1 Credits" },
{0x11, 0x01, 0x0c, 0x04, "1 Coin 2 Credits" },
{0x11, 0x01, 0x0c, 0x08, "1 Coin 3 Credits" },
{0 , 0xfe, 0 , 2, "Cabinet" },
{0x11, 0x01, 0x10, 0x10, "Upright" },
{0x11, 0x01, 0x10, 0x00, "Cocktail" },
{0 , 0xfe, 0 , 2, "Cabinet" },
{0x11, 0x01, 0x10, 0x10, "Upright" },
{0x11, 0x01, 0x10, 0x00, "Cocktail" },
{0 , 0xfe, 0 , 2, "Demo Sounds" },
{0x11, 0x01, 0x20, 0x00, "Off" },
{0x11, 0x01, 0x20, 0x20, "On" },
{0 , 0xfe, 0 , 2, "Demo Sounds" },
{0x11, 0x01, 0x20, 0x00, "Off" },
{0x11, 0x01, 0x20, 0x20, "On" },
{0 , 0xfe, 0 , 4, "Lives" },
{0x11, 0x01, 0xc0, 0xc0, "2" },
{0x11, 0x01, 0xc0, 0x00, "3" },
{0x11, 0x01, 0xc0, 0x40, "4" },
{0x11, 0x01, 0xc0, 0x80, "5" },
{0 , 0xfe, 0 , 4, "Lives" },
{0x11, 0x01, 0xc0, 0xc0, "2" },
{0x11, 0x01, 0xc0, 0x00, "3" },
{0x11, 0x01, 0xc0, 0x40, "4" },
{0x11, 0x01, 0xc0, 0x80, "5" },
{0 , 0xfe, 0 , 3, "Bonus Life" },
{0x12, 0x01, 0x03, 0x00, "None" },
{0x12, 0x01, 0x03, 0x01, "20,000 Only" },
{0x12, 0x01, 0x03, 0x03, "20,000 and 60,000" },
{0 , 0xfe, 0 , 3, "Bonus Life" },
{0x12, 0x01, 0x03, 0x00, "None" },
{0x12, 0x01, 0x03, 0x01, "20,000 Only" },
{0x12, 0x01, 0x03, 0x03, "20,000 and 60,000" },
{0 , 0xfe, 0 , 2, "Number of Bombs" },
{0x12, 0x01, 0x04, 0x00, "3" },
{0x12, 0x01, 0x04, 0x04, "5" },
{0 , 0xfe, 0 , 2, "Number of Bombs" },
{0x12, 0x01, 0x04, 0x00, "3" },
{0x12, 0x01, 0x04, 0x04, "5" },
{0 , 0xfe, 0 , 2, "Difficulty - Mogura Nian" },
{0x12, 0x01, 0x08, 0x00, "Normal" },
{0x12, 0x01, 0x08, 0x08, "Hard" },
{0 , 0xfe, 0 , 2, "Difficulty - Mogura Nian" },
{0x12, 0x01, 0x08, 0x00, "Normal" },
{0x12, 0x01, 0x08, 0x08, "Hard" },
{0 , 0xfe, 0 , 4, "Difficulty - Select of Mogura"},
{0x12, 0x01, 0x30, 0x00, "Easy" },
{0x12, 0x01, 0x30, 0x20, "Normal" },
{0x12, 0x01, 0x30, 0x10, "Hard" },
{0x12, 0x01, 0x30, 0x30, "Hardest" },
{0x12, 0x01, 0x30, 0x00, "Easy" },
{0x12, 0x01, 0x30, 0x20, "Normal" },
{0x12, 0x01, 0x30, 0x10, "Hard" },
{0x12, 0x01, 0x30, 0x30, "Hardest" },
{0 , 0xfe, 0 , 0, "Infinite Lives" },
{0x12, 0x01, 0x80, 0x00, "Off" },
{0x12, 0x01, 0x80, 0x80, "On" },
{0 , 0xfe, 0 , 0, "Infinite Lives" },
{0x12, 0x01, 0x80, 0x00, "Off" },
{0x12, 0x01, 0x80, 0x80, "On" },
};
STDDIPINFO(Calorie)
static void palette_write(INT32 offset)
{
offset &= 0xfe;
INT32 r = DrvPalRAM[offset + 0] & 0xf;
INT32 g = DrvPalRAM[offset + 0] >> 4;
INT32 b = DrvPalRAM[offset + 1] & 0xf;
DrvPalette[offset / 2] = BurnHighCol(r + (r * 16), g + (g * 16), b + (b * 16), 0);
}
static void __fastcall calorie_write(UINT16 address, UINT8 data)
{
if ((address & 0xff00) == 0xdc00) {
DrvPalRAM[address & 0x0ff] = data;
DrvRecalc = 1;
palette_write(address);
return;
}
switch (address)
{
case 0xde00:
*calorie_bg = data;
calorie_bg = data;
return;
case 0xf004:
*flipscreen = data & 1;
flipscreen = data & 1;
return;
case 0xf800:
*soundlatch = data;
soundlatch = data;
return;
}
}
@ -174,8 +178,8 @@ static UINT8 __fastcall calorie_sound_read(UINT16 address)
switch (address)
{
case 0xc000:
UINT8 latch = *soundlatch;
*soundlatch = 0;
UINT8 latch = soundlatch;
soundlatch = 0;
return latch;
}
@ -187,10 +191,8 @@ static UINT8 __fastcall calorie_sound_in(UINT16 port)
switch (port & 0xff)
{
case 0x01:
return AY8910Read(0);
case 0x11:
return AY8910Read(1);
return AY8910Read((port >> 4) & 1);
}
return 0;
@ -209,6 +211,22 @@ static void __fastcall calorie_sound_out(UINT16 port, UINT8 data)
}
}
static tilemap_callback( bg )
{
INT32 attr = bg_base[offs + 0x100];
INT32 code = bg_base[offs] | ((attr << 4) & 0x100);
TILE_SET_INFO(3, code, attr, (attr & 0x40) ? TILE_FLIPX : 0);
}
static tilemap_callback( fg )
{
INT32 attr = DrvVidRAM[offs + 0x400];
INT32 code = DrvVidRAM[offs] | ((attr << 4) & 0x300);
TILE_SET_INFO(2, code, attr, TILE_FLIPYX(attr >> 6));
}
static INT32 DrvDoReset()
{
memset (AllRam, 0, RamEnd - AllRam);
@ -224,6 +242,10 @@ static INT32 DrvDoReset()
AY8910Reset(0);
AY8910Reset(1);
soundlatch = 0;
flipscreen = 0;
calorie_bg = 0;
return 0;
}
@ -231,44 +253,40 @@ static INT32 MemIndex()
{
UINT8 *Next; Next = AllMem;
DrvZ80ROM0 = Next; Next += 0x010000;
DrvDecROM0 = Next; Next += 0x010000;
DrvZ80ROM1 = Next; Next += 0x010000;
DrvZ80ROM[0] = Next; Next += 0x010000;
DrvZ80ROM[2] = Next; Next += 0x010000;
DrvZ80ROM[1] = Next; Next += 0x010000;
DrvGfxROM4 = Next; Next += 0x002000;
DrvGfxROM0 = Next; Next += 0x020000;
DrvGfxROM1 = Next; Next += 0x020000;
DrvGfxROM2 = Next; Next += 0x020000;
DrvGfxROM3 = Next; Next += 0x020000;
DrvGfxROM[4] = Next; Next += 0x002000;
DrvGfxROM[0] = Next; Next += 0x020000;
DrvGfxROM[1] = Next; Next += 0x020000;
DrvGfxROM[2] = Next; Next += 0x020000;
DrvGfxROM[3] = Next; Next += 0x020000;
DrvPalette = (UINT32*)Next; Next += 0x0200 * sizeof(INT32);
DrvPalette = (UINT32*)Next; Next += 0x0080 * sizeof(INT32);
AllRam = Next;
AllRam = Next;
DrvSprRAM = Next; Next += 0x000400;
DrvPalRAM = Next; Next += 0x000100;
DrvVidRAM = Next; Next += 0x000800;
DrvSprRAM = Next; Next += 0x000400;
DrvPalRAM = Next; Next += 0x000100;
DrvVidRAM = Next; Next += 0x000800;
DrvZ80RAM0 = Next; Next += 0x001000;
DrvZ80RAM1 = Next; Next += 0x000800;
DrvZ80RAM[0] = Next; Next += 0x001000;
DrvZ80RAM[1] = Next; Next += 0x000800;
soundlatch = Next; Next += 0x000001;
flipscreen = Next; Next += 0x000001;
calorie_bg = Next; Next += 0x000001;
RamEnd = Next;
RamEnd = Next;
MemEnd = Next;
MemEnd = Next;
return 0;
}
static INT32 DrvGfxDecode()
{
INT32 Plane[3] = { RGN_FRAC(0xc000, 0, 3), RGN_FRAC(0xc000, 1, 3), RGN_FRAC(0xc000, 2, 3) };
INT32 Plane6000[3] = { RGN_FRAC(0x6000, 0, 3), RGN_FRAC(0x6000, 1, 3), RGN_FRAC(0x6000, 2, 3) };
INT32 Plane0[3] = { RGN_FRAC(0xc000, 0, 3), RGN_FRAC(0xc000, 1, 3), RGN_FRAC(0xc000, 2, 3) };
INT32 Plane1[3] = { RGN_FRAC(0x6000, 0, 3), RGN_FRAC(0x6000, 1, 3), RGN_FRAC(0x6000, 2, 3) };
INT32 XOffs[32] = { STEP8(0,1), STEP8(64,1), STEP8(256,1), STEP8(256+64, 1) };
INT32 XOffs[32] = { STEP8(0,1), STEP8(64,1), STEP8(256,1), STEP8(256+64,1) };
INT32 YOffs[32] = { STEP8(0,8), STEP8(128,8), STEP8(512,8), STEP8(640,8) };
UINT8 *tmp = (UINT8*)BurnMalloc(0xc000);
@ -276,18 +294,18 @@ static INT32 DrvGfxDecode()
return 1;
}
memcpy (tmp, DrvGfxROM0, 0xc000);
memcpy (tmp, DrvGfxROM[0], 0xc000);
GfxDecode(0x0200, 3, 16, 16, Plane, XOffs, YOffs, 0x100, tmp, DrvGfxROM0);
GfxDecode(0x0080, 3, 32, 32, Plane, XOffs, YOffs, 0x400, tmp, DrvGfxROM1);
GfxDecode(0x0200, 3, 16, 16, Plane0, XOffs, YOffs, 0x100, tmp, DrvGfxROM[0]);
GfxDecode(0x0080, 3, 32, 32, Plane0, XOffs, YOffs, 0x400, tmp, DrvGfxROM[1]);
memcpy (tmp, DrvGfxROM2, 0xc000);
memcpy (tmp, DrvGfxROM[2], 0xc000);
GfxDecode(0x0400, 3, 8, 8, Plane6000, XOffs, YOffs, 0x040, tmp, DrvGfxROM2);
GfxDecode(0x0400, 3, 8, 8, Plane1, XOffs, YOffs, 0x040, tmp, DrvGfxROM[2]);
memcpy (tmp, DrvGfxROM3, 0xc000);
memcpy (tmp, DrvGfxROM[3], 0xc000);
GfxDecode(0x0200, 3, 16, 16, Plane, XOffs, YOffs, 0x100, tmp, DrvGfxROM3);
GfxDecode(0x0200, 3, 16, 16, Plane0, XOffs, YOffs, 0x100, tmp, DrvGfxROM[3]);
BurnFree (tmp);
@ -304,25 +322,25 @@ static INT32 DrvInit(void (*pInitCallback)())
MemIndex();
{
if (BurnLoadRom(DrvZ80ROM0 + 0x0000, 0, 1)) return 1;
if (BurnLoadRom(DrvZ80ROM0 + 0x4000, 1, 1)) return 1;
if (BurnLoadRom(DrvZ80ROM0 + 0x8000, 2, 1)) return 1;
if (BurnLoadRom(DrvZ80ROM[0] + 0x0000, 0, 1)) return 1;
if (BurnLoadRom(DrvZ80ROM[0] + 0x4000, 1, 1)) return 1;
if (BurnLoadRom(DrvZ80ROM[0] + 0x8000, 2, 1)) return 1;
if (BurnLoadRom(DrvZ80ROM1 + 0x0000, 3, 1)) return 1;
if (BurnLoadRom(DrvZ80ROM[1] + 0x0000, 3, 1)) return 1;
if (BurnLoadRom(DrvGfxROM4 + 0x0000, 4, 1)) return 1;
if (BurnLoadRom(DrvGfxROM[4] + 0x0000, 4, 1)) return 1;
if (BurnLoadRom(DrvGfxROM0 + 0x0000, 5, 1)) return 1;
if (BurnLoadRom(DrvGfxROM0 + 0x4000, 6, 1)) return 1;
if (BurnLoadRom(DrvGfxROM0 + 0x8000, 7, 1)) return 1;
if (BurnLoadRom(DrvGfxROM[0] + 0x0000, 5, 1)) return 1;
if (BurnLoadRom(DrvGfxROM[0] + 0x4000, 6, 1)) return 1;
if (BurnLoadRom(DrvGfxROM[0] + 0x8000, 7, 1)) return 1;
if (BurnLoadRom(DrvGfxROM2 + 0x0000, 8, 1)) return 1;
if (BurnLoadRom(DrvGfxROM2 + 0x2000, 9, 1)) return 1;
if (BurnLoadRom(DrvGfxROM2 + 0x4000, 10, 1)) return 1;
if (BurnLoadRom(DrvGfxROM[2] + 0x0000, 8, 1)) return 1;
if (BurnLoadRom(DrvGfxROM[2] + 0x2000, 9, 1)) return 1;
if (BurnLoadRom(DrvGfxROM[2] + 0x4000, 10, 1)) return 1;
if (BurnLoadRom(DrvGfxROM3 + 0x0000, 11, 1)) return 1;
if (BurnLoadRom(DrvGfxROM3 + 0x4000, 12, 1)) return 1;
if (BurnLoadRom(DrvGfxROM3 + 0x8000, 13, 1)) return 1;
if (BurnLoadRom(DrvGfxROM[3] + 0x0000, 11, 1)) return 1;
if (BurnLoadRom(DrvGfxROM[3] + 0x4000, 12, 1)) return 1;
if (BurnLoadRom(DrvGfxROM[3] + 0x8000, 13, 1)) return 1;
DrvGfxDecode();
}
@ -333,9 +351,9 @@ static INT32 DrvInit(void (*pInitCallback)())
ZetInit(0);
ZetOpen(0);
ZetMapMemory(DrvZ80ROM0, 0x0000, 0xbfff, MAP_ROM);
ZetMapMemory(DrvDecROM0, 0x0000, 0x7fff, MAP_FETCHOP); // ?
ZetMapMemory(DrvZ80RAM0, 0xc000, 0xcfff, MAP_RAM);
ZetMapMemory(DrvZ80ROM[0], 0x0000, 0xbfff, MAP_ROM);
ZetMapMemory(DrvZ80ROM[2], 0x0000, 0x7fff, MAP_FETCHOP);
ZetMapMemory(DrvZ80RAM[0], 0xc000, 0xcfff, MAP_RAM);
ZetMapMemory(DrvVidRAM, 0xd000, 0xd7ff, MAP_RAM);
ZetMapMemory(DrvSprRAM, 0xd800, 0xdbff, MAP_RAM);
ZetSetWriteHandler(calorie_write);
@ -344,8 +362,8 @@ static INT32 DrvInit(void (*pInitCallback)())
ZetInit(1);
ZetOpen(1);
ZetMapMemory(DrvZ80ROM1, 0x0000, 0x3fff, MAP_ROM);
ZetMapMemory(DrvZ80RAM1, 0x8000, 0x87ff, MAP_RAM);
ZetMapMemory(DrvZ80ROM[1], 0x0000, 0x3fff, MAP_ROM);
ZetMapMemory(DrvZ80RAM[1], 0x8000, 0x87ff, MAP_RAM);
ZetSetReadHandler(calorie_sound_read);
ZetSetOutHandler(calorie_sound_out);
ZetSetInHandler(calorie_sound_in);
@ -358,6 +376,14 @@ static INT32 DrvInit(void (*pInitCallback)())
AY8910SetBuffered(ZetTotalCycles, 3000000);
GenericTilesInit();
GenericTilemapInit(0, TILEMAP_SCAN_ROWS, bg_map_callback, 16, 16, 16, 16);
GenericTilemapInit(1, TILEMAP_SCAN_ROWS, fg_map_callback, 8, 8, 32, 32);
GenericTilemapSetGfx(0, DrvGfxROM[0], 3, 16, 16, 0x20000, 0, 0xf);
GenericTilemapSetGfx(1, DrvGfxROM[1], 3, 32, 32, 0x20000, 0, 0xf);
GenericTilemapSetGfx(2, DrvGfxROM[2], 3, 8, 8, 0x20000, 0, 0xf);
GenericTilemapSetGfx(3, DrvGfxROM[3], 3, 16, 16, 0x20000, 0, 0xf);
GenericTilemapSetTransparent(1, 0);
GenericTilemapSetOffsets(TMAP_GLOBAL, 0, -16);
DrvDoReset();
@ -378,70 +404,6 @@ static INT32 DrvExit()
return 0;
}
static void draw_bg_layer()
{
INT32 bg_base = (*calorie_bg & 0x0f) * 0x200;
for (INT32 offs = 0; offs < 16 * 16; offs++)
{
INT32 sx = (offs & 0x0f) << 4;
INT32 sy = offs & 0xf0;
INT32 attr = DrvGfxROM4[bg_base + offs + 0x100];
INT32 code = DrvGfxROM4[bg_base + offs] | ((attr & 0x10) << 4);
INT32 color = attr & 0x0f;
INT32 flipx = attr & 0x40;
sy -= 16;
if (*flipscreen) {
if (!flipx) {
Render16x16Tile_FlipXY_Clip(pTransDraw, code, sx, sy, color, 3, 0, DrvGfxROM3);
} else {
Render16x16Tile_FlipY_Clip(pTransDraw, code, sx, sy, color, 3, 0, DrvGfxROM3);
}
} else {
if (flipx) {
Render16x16Tile_FlipX_Clip(pTransDraw, code, sx, sy, color, 3, 0, DrvGfxROM3);
} else {
Render16x16Tile_Clip(pTransDraw, code, sx, sy, color, 3, 0, DrvGfxROM3);
}
}
}
}
static void draw_fg_layer()
{
for (INT32 offs = 0; offs < 32 * 32; offs++)
{
INT32 sx = (offs & 0x1f) << 3;
INT32 sy = (offs >> 5) << 3;
INT32 attr = DrvVidRAM[offs + 0x400];
INT32 code = ((attr & 0x30) << 4) | DrvVidRAM[offs];
INT32 color = attr & 0x0f;
INT32 flipy = attr & 0x80;
INT32 flipx = attr & 0x40;
sy -= 16;
if (flipy) {
if (flipx) {
Render8x8Tile_Mask_FlipXY_Clip(pTransDraw, code, sx, sy, color, 3, 0, 0, DrvGfxROM2);
} else {
Render8x8Tile_Mask_FlipY_Clip(pTransDraw, code, sx, sy, color, 3, 0, 0, DrvGfxROM2);
}
} else {
if (flipx) {
Render8x8Tile_Mask_FlipX_Clip(pTransDraw, code, sx, sy, color, 3, 0, 0, DrvGfxROM2);
} else {
Render8x8Tile_Mask_Clip(pTransDraw, code, sx, sy, color, 3, 0, 0, DrvGfxROM2);
}
}
}
}
static void draw_sprites()
{
for (INT32 x = 0x400; x >= 0; x -= 4)
@ -449,11 +411,12 @@ static void draw_sprites()
INT32 code = DrvSprRAM[x+0];
INT32 color = DrvSprRAM[x+1] & 0x0f;
INT32 flipx = DrvSprRAM[x+1] & 0x40;
INT32 size =(DrvSprRAM[x+1] & 0x10) >> 4;
INT32 flipy = 0;
INT32 sy = 0xff - DrvSprRAM[x+2];
INT32 sx = DrvSprRAM[x+3];
if(*flipscreen)
if (flipscreen)
{
if (DrvSprRAM[x+1] & 0x10 )
sy = 0xff - sy + 32;
@ -464,74 +427,42 @@ static void draw_sprites()
flipx = !flipx;
flipy = !flipy;
}
sy -= 16;
if(DrvSprRAM[x+1] & 0x10 )
{
GenericTilesGfx *gfx = &GenericGfxData[size];
if (size) {
code |= 0x40;
sy -= 31;
if (flipy) {
if (flipx) {
Render32x32Tile_Mask_FlipXY_Clip(pTransDraw, code, sx, sy, color, 3, 0, 0, DrvGfxROM1);
} else {
Render32x32Tile_Mask_FlipY_Clip(pTransDraw, code, sx, sy, color, 3, 0, 0, DrvGfxROM1);
}
} else {
if (flipx) {
Render32x32Tile_Mask_FlipX_Clip(pTransDraw, code, sx, sy, color, 3, 0, 0, DrvGfxROM1);
} else {
Render32x32Tile_Mask_Clip(pTransDraw, code, sx, sy, color, 3, 0, 0, DrvGfxROM1);
}
}
sy -= 16;
}
else
{
sy -= 15;
if (flipy) {
if (flipx) {
Render16x16Tile_Mask_FlipXY_Clip(pTransDraw, code, sx, sy, color, 3, 0, 0, DrvGfxROM0);
} else {
Render16x16Tile_Mask_FlipY_Clip(pTransDraw, code, sx, sy, color, 3, 0, 0, DrvGfxROM0);
}
} else {
if (flipx) {
Render16x16Tile_Mask_FlipX_Clip(pTransDraw, code, sx, sy, color, 3, 0, 0, DrvGfxROM0);
} else {
Render16x16Tile_Mask_Clip(pTransDraw, code, sx, sy, color, 3, 0, 0, DrvGfxROM0);
}
}
}
DrawCustomMaskTile(pTransDraw, gfx->width, gfx->height, code % gfx->code_mask, sx, sy - 31, flipx, flipy, color & gfx->color_mask, gfx->depth, 0, gfx->color_offset, gfx->gfxbase);
}
}
static INT32 DrvDraw()
{
if (DrvRecalc) {
for (INT32 i = 0; i < 0x100; i+=2) {
INT32 p = (DrvPalRAM[i+0] << 0) | (DrvPalRAM[i+1] << 8);
INT32 r = (p >> 0) & 0x0f;
INT32 g = (p >> 4) & 0x0f;
INT32 b = (p >> 8) & 0x0f;
DrvPalette[i/2] = BurnHighCol((r << 4) | r, (g << 4) | g, (b << 4) | b, 0);
palette_write(i);
}
DrvRecalc = 0;
}
if (*calorie_bg & 0x10)
bg_base = DrvGfxROM[4] + (calorie_bg & 0x0f) * 0x200;
GenericTilemapSetFlip(0, flipscreen);
if (calorie_bg & 0x10)
{
draw_bg_layer();
draw_fg_layer();
GenericTilemapDraw(0, pTransDraw, 0);
}
else
{
BurnTransferClear();
draw_fg_layer();
}
GenericTilemapDraw(1, pTransDraw, 0);
draw_sprites();
BurnTransferCopy(DrvPalette);
@ -539,7 +470,6 @@ static INT32 DrvDraw()
return 0;
}
static INT32 DrvFrame()
{
if (DrvReset) {
@ -549,7 +479,8 @@ static INT32 DrvFrame()
ZetNewFrame();
{
memset (DrvInputs, 0, 3);
memset (DrvInputs, 0, sizeof(DrvInputs));
for (INT32 i = 0; i < 8; i++) {
DrvInputs[0] ^= (DrvJoy1[i] & 1) << i;
DrvInputs[1] ^= (DrvJoy2[i] & 1) << i;
@ -579,7 +510,7 @@ static INT32 DrvFrame()
}
if (pBurnDraw) {
DrvDraw();
BurnDrvRedraw();
}
return 0;
@ -602,12 +533,43 @@ static INT32 DrvScan(INT32 nAction, INT32 *pnMin)
ZetScan(nAction);
AY8910Scan(nAction, pnMin);
SCAN_VAR(soundlatch);
SCAN_VAR(flipscreen);
SCAN_VAR(calorie_bg);
}
return 0;
}
// Calorie Kun vs Moguranian
static struct BurnRomInfo calorieRomDesc[] = {
{ "epr10072.1j", 0x4000, 0xade792c1, 1 | BRF_PRG | BRF_ESS }, // 0 Z80 #0 Code (Encrypted)
{ "epr10073.1k", 0x4000, 0xb53e109f, 1 | BRF_PRG | BRF_ESS }, // 1
{ "epr10074.1m", 0x4000, 0xa08da685, 1 | BRF_PRG | BRF_ESS }, // 2
{ "epr10075.4d", 0x4000, 0xca547036, 2 | BRF_PRG | BRF_ESS }, // 3 Z80 #1 Code
{ "epr10079.8d", 0x2000, 0x3c61a42c, 3 | BRF_GRA }, // 4 Background Tilemap
{ "epr10071.7m", 0x4000, 0x5f55527a, 4 | BRF_GRA }, // 5 Sprites (16x16 & 32x32)
{ "epr10070.7k", 0x4000, 0x97f35a23, 4 | BRF_GRA }, // 6
{ "epr10069.7j", 0x4000, 0xc0c3deaf, 4 | BRF_GRA }, // 7
{ "epr10082.5r", 0x2000, 0x5984ea44, 5 | BRF_GRA }, // 8 Foreground Tiles
{ "epr10081.4r", 0x2000, 0xe2d45dd8, 5 | BRF_GRA }, // 9
{ "epr10080.3r", 0x2000, 0x42edfcfe, 5 | BRF_GRA }, // 10
{ "epr10078.7d", 0x4000, 0x5b8eecce, 6 | BRF_GRA }, // 11 Background Tiles
{ "epr10077.6d", 0x4000, 0x01bcb609, 6 | BRF_GRA }, // 12
{ "epr10076.5d", 0x4000, 0xb1529782, 6 | BRF_GRA }, // 13
};
STD_ROM_PICK(calorie)
STD_ROM_FN(calorie)
static void calorie_decode()
{
static const UINT8 swaptable[24][4] =
@ -641,29 +603,14 @@ static void calorie_decode()
static const INT32 data_swap_select[1+64] =
{
7,
1,11,23,17,23, 0,15,19,
20,12,10, 0,18,18, 5,20,
13, 0,18,14, 5, 6,10,21,
1,11, 9, 3,21, 4, 1,17,
5, 7,16,13,19,23,20, 2,
10,23,23,15,10,12, 0,22,
14, 6,15,11,17,15,21, 0,
6, 1, 1,18, 5,15,15,20,
7, 1,11,23,17,23, 0,15,19,20,12,10, 0,18,18, 5,20, 13, 0,18,14, 5, 6,10,21, 1,11, 9, 3,21, 4, 1,17,
5, 7,16,13,19,23,20, 2, 10,23,23,15,10,12, 0,22, 14, 6,15,11,17,15,21, 0, 6, 1, 1,18, 5,15,15,20,
};
static const INT32 opcode_swap_select[2+64] =
{
7,
12,
18, 8,21, 0,22,21,13,21,
20,13,20,14, 6, 3, 5,20,
8,20, 4, 8,17,22, 0, 0,
6,17,17, 9, 0,16,13,21,
3, 2,18, 6,11, 3, 3,18,
18,19, 3, 0, 5, 0,11, 8,
8, 1, 7, 2,10, 8,10, 2,
1, 3,12,16, 0,17,10, 1,
7, 12, 18, 8,21, 0,22,21,13,21, 20,13,20,14, 6, 3, 5,20, 8,20, 4, 8,17,22, 0, 0, 6,17,17, 9, 0,16,13,21,
3, 2,18, 6,11, 3, 3,18, 18,19, 3, 0, 5, 0,11, 8, 8, 1, 7, 2,10, 8,10, 2, 1, 3,12,16, 0,17,10, 1,
};
for (INT32 A = 0x0000; A < 0x8000; A++)
@ -671,10 +618,10 @@ static void calorie_decode()
INT32 row = BITSWAP16(A, 15, 13, 11, 10, 8, 7, 5, 4, 2, 1, 14, 12, 9, 6, 3, 0) & 0x3f;
const UINT8 *tbl = swaptable[opcode_swap_select[row]];
DrvDecROM0[A] = BITSWAP08(DrvZ80ROM0[A],7,tbl[0],5,tbl[1],3,tbl[2],1,tbl[3]) ^ opcode_xor[row];
DrvZ80ROM[2][A] = BITSWAP08(DrvZ80ROM[0][A],7,tbl[0],5,tbl[1],3,tbl[2],1,tbl[3]) ^ opcode_xor[row];
tbl = swaptable[data_swap_select[row]];
DrvZ80ROM0[A] = BITSWAP08(DrvZ80ROM0[A],7,tbl[0],5,tbl[1],3,tbl[2],1,tbl[3]) ^ data_xor[row];
DrvZ80ROM[0][A] = BITSWAP08(DrvZ80ROM[0][A],7,tbl[0],5,tbl[1],3,tbl[2],1,tbl[3]) ^ data_xor[row];
}
}
@ -683,53 +630,6 @@ static INT32 CalorieInit()
return DrvInit(calorie_decode);
}
static void calorieb_decode()
{
memset (DrvZ80ROM0, 0x00, 0x10000);
BurnLoadRom(DrvDecROM0 + 0x0000, 0, 1);
memcpy (DrvZ80ROM0 + 0x0000, DrvDecROM0 + 0x4000, 0x4000);
BurnLoadRom(DrvDecROM0 + 0x4000, 1, 1);
memcpy (DrvZ80ROM0 + 0x4000, DrvDecROM0 + 0x8000, 0x4000);
BurnLoadRom(DrvZ80ROM0 + 0x8000, 2, 1);
memset (DrvDecROM0 + 0x8000, 0x00, 0x4000);
}
static INT32 CaloriebInit()
{
return DrvInit(calorieb_decode);
}
// Calorie Kun vs Moguranian
static struct BurnRomInfo calorieRomDesc[] = {
{ "epr10072.1j", 0x4000, 0xade792c1, 1 | BRF_PRG | BRF_ESS }, // 0 maincpu
{ "epr10073.1k", 0x4000, 0xb53e109f, 1 | BRF_PRG | BRF_ESS }, // 1
{ "epr10074.1m", 0x4000, 0xa08da685, 1 | BRF_PRG | BRF_ESS }, // 2
{ "epr10075.4d", 0x4000, 0xca547036, 2 | BRF_PRG | BRF_ESS }, // 3 audiocpu
{ "epr10079.8d", 0x2000, 0x3c61a42c, 3 | BRF_GRA }, // 4 user1
{ "epr10071.7m", 0x4000, 0x5f55527a, 4 | BRF_GRA }, // 5 gfx1
{ "epr10070.7k", 0x4000, 0x97f35a23, 4 | BRF_GRA }, // 6
{ "epr10069.7j", 0x4000, 0xc0c3deaf, 4 | BRF_GRA }, // 7
{ "epr10082.5r", 0x2000, 0x5984ea44, 5 | BRF_GRA }, // 8 gfx2
{ "epr10081.4r", 0x2000, 0xe2d45dd8, 5 | BRF_GRA }, // 9
{ "epr10080.3r", 0x2000, 0x42edfcfe, 5 | BRF_GRA }, // 10
{ "epr10078.7d", 0x4000, 0x5b8eecce, 6 | BRF_GRA }, // 11 gfx3
{ "epr10077.6d", 0x4000, 0x01bcb609, 6 | BRF_GRA }, // 12
{ "epr10076.5d", 0x4000, 0xb1529782, 6 | BRF_GRA }, // 13
};
STD_ROM_PICK(calorie)
STD_ROM_FN(calorie)
struct BurnDriver BurnDrvCalorie = {
"calorie", NULL, NULL, NULL, "1986",
"Calorie Kun vs Moguranian\0", NULL, "Sega", "Miscellaneous",
@ -744,23 +644,23 @@ struct BurnDriver BurnDrvCalorie = {
// Calorie Kun vs Moguranian (bootleg)
static struct BurnRomInfo caloriebRomDesc[] = {
{ "12.bin", 0x8000, 0xcf5fa69e, 1 | BRF_PRG | BRF_ESS }, // 0 maincpu
{ "13.bin", 0x8000, 0x52e7263f, 1 | BRF_PRG | BRF_ESS }, // 1
{ "12.bin", 0x8000, 0xcf5fa69e, 1 | BRF_PRG | BRF_ESS }, // 0 Z80 #0 Code
{ "13.bin", 0x8000, 0x52e7263f, 1 | BRF_PRG | BRF_ESS }, // 1
{ "epr10074.1m", 0x4000, 0xa08da685, 1 | BRF_PRG | BRF_ESS }, // 2
{ "epr10075.4d", 0x4000, 0xca547036, 2 | BRF_PRG | BRF_ESS }, // 3 audiocpu
{ "epr10075.4d", 0x4000, 0xca547036, 2 | BRF_PRG | BRF_ESS }, // 3 Z80 #1 Code
{ "epr10079.8d", 0x2000, 0x3c61a42c, 3 | BRF_GRA }, // 4 user1
{ "epr10079.8d", 0x2000, 0x3c61a42c, 3 | BRF_GRA }, // 4 Background Tilemap
{ "epr10071.7m", 0x4000, 0x5f55527a, 4 | BRF_GRA }, // 5 gfx1
{ "epr10071.7m", 0x4000, 0x5f55527a, 4 | BRF_GRA }, // 5 Sprites (16x16 & 32x32)
{ "epr10070.7k", 0x4000, 0x97f35a23, 4 | BRF_GRA }, // 6
{ "epr10069.7j", 0x4000, 0xc0c3deaf, 4 | BRF_GRA }, // 7
{ "epr10082.5r", 0x2000, 0x5984ea44, 5 | BRF_GRA }, // 8 gfx2
{ "epr10082.5r", 0x2000, 0x5984ea44, 5 | BRF_GRA }, // 8 Foreground Tiles
{ "epr10081.4r", 0x2000, 0xe2d45dd8, 5 | BRF_GRA }, // 9
{ "epr10080.3r", 0x2000, 0x42edfcfe, 5 | BRF_GRA }, // 10
{ "epr10078.7d", 0x4000, 0x5b8eecce, 6 | BRF_GRA }, // 11 gfx3
{ "epr10078.7d", 0x4000, 0x5b8eecce, 6 | BRF_GRA }, // 11 Background Tiles
{ "epr10077.6d", 0x4000, 0x01bcb609, 6 | BRF_GRA }, // 12
{ "epr10076.5d", 0x4000, 0xb1529782, 6 | BRF_GRA }, // 13
};
@ -768,6 +668,26 @@ static struct BurnRomInfo caloriebRomDesc[] = {
STD_ROM_PICK(calorieb)
STD_ROM_FN(calorieb)
static void calorieb_decode()
{
memset (DrvZ80ROM[0], 0x00, 0x10000);
BurnLoadRom(DrvZ80ROM[2] + 0x0000, 0, 1);
memcpy (DrvZ80ROM[0] + 0x0000, DrvZ80ROM[2] + 0x4000, 0x4000);
BurnLoadRom(DrvZ80ROM[2] + 0x4000, 1, 1);
memcpy (DrvZ80ROM[0] + 0x4000, DrvZ80ROM[2] + 0x8000, 0x4000);
BurnLoadRom(DrvZ80ROM[0] + 0x8000, 2, 1);
memset (DrvZ80ROM[2] + 0x8000, 0x00, 0x4000);
}
static INT32 CaloriebInit()
{
return DrvInit(calorieb_decode);
}
struct BurnDriver BurnDrvCalorieb = {
"calorieb", "calorie", NULL, NULL, "1986",
"Calorie Kun vs Moguranian (bootleg)\0", NULL, "bootleg", "Miscellaneous",
@ -777,4 +697,3 @@ struct BurnDriver BurnDrvCalorieb = {
CaloriebInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x80,
256, 224, 4, 3
};

File diff suppressed because it is too large Load Diff

View File

@ -41,6 +41,7 @@ static UINT16 *bg_scroll_y;
static UINT8 DrvRecalc;
static INT32 bestri = 0;
static INT32 bestria = 0;
static INT32 pitapat = 0;
static struct BurnInputInfo CrospangInputList[] = {
@ -208,30 +209,7 @@ static void __fastcall crospang_write_byte(UINT32 address, UINT8 data)
static void __fastcall crospang_write_word(UINT32 address, UINT16 data)
{
if (bestri == 0) {
switch (address)
{
case 0x100002:
*fg_scroll_y = (data + 8) & 0x1ff;
return;
case 0x100004:
*bg_scroll_x = (data + 4) & 0x1ff;
return;
case 0x100006:
*bg_scroll_y = (data + 8) & 0x1ff;
return;
case 0x100008:
*fg_scroll_x = (data + 0) & 0x1ff;
return;
case 0x270000:
*soundlatch = data & 0xff;
return;
}
} else {
if (bestri == 1) {
switch (address)
{
case 0x100004:
@ -250,6 +228,52 @@ static void __fastcall crospang_write_word(UINT32 address, UINT16 data)
*bg_scroll_x = ((data ^ 0x0000) - 60) & 0x1ff;
return;
case 0x270000:
*soundlatch = data & 0xff;
return;
}
} else if (bestria == 1) {
switch (address)
{
case 0x100006:
*fg_scroll_x = ((data ^ 0x0000) + 32) & 0x1ff;
return;
case 0x100008:
*fg_scroll_y = ((data ^ 0xff54) + 7) & 0x1ff;
return;
case 0x10000a:
*bg_scroll_x = ((data ^ 0x0000) - 60) & 0x1ff;
return;
case 0x10000c:
*bg_scroll_y = ((data ^ 0xfeaa) + 7) & 0x1ff;
return;
case 0x270000:
*soundlatch = data & 0xff;
return;
}
} else {
switch (address)
{
case 0x100002:
*fg_scroll_y = (data + 8) & 0x1ff;
return;
case 0x100004:
*bg_scroll_x = (data + 4) & 0x1ff;
return;
case 0x100006:
*bg_scroll_y = (data + 8) & 0x1ff;
return;
case 0x100008:
*fg_scroll_x = (data + 0) & 0x1ff;
return;
case 0x270000:
*soundlatch = data & 0xff;
return;
@ -507,6 +531,7 @@ static INT32 DrvInit(INT32 (*pRomLoadCallback)())
SekMapMemory(DrvSprRAM, 0x210000, 0x2107ff, MAP_RAM);
SekMapMemory(Drv68KRAM, 0x320000, 0x32ffff, MAP_RAM); // crospang, heuksun
SekMapMemory(Drv68KRAM, 0x3a0000, 0x3affff, MAP_RAM); // bestri
SekMapMemory(Drv68KRAM, 0x340000, 0x34ffff, MAP_RAM); // bestria
SekMapMemory(Drv68KRAM, 0x300000, 0x30ffff, MAP_RAM); // pitapat
SekSetWriteByteHandler(0, crospang_write_byte);
SekSetWriteWordHandler(0, crospang_write_word);
@ -550,6 +575,7 @@ static INT32 DrvExit()
MSM6295ROM = NULL;
bestri = 0;
bestria = 0;
pitapat = 0;
return 0;
@ -805,7 +831,7 @@ struct BurnDriver BurnDrvHeuksun = {
};
// Bestri (Korea)
// Bestri (Korea, set 1)
static struct BurnRomInfo bestriRomDesc[] = {
{ "ua02.i3", 0x80000, 0x9e94023d, 1 | BRF_PRG | BRF_ESS }, // 0 68k Code
@ -838,8 +864,8 @@ static INT32 bestriInit()
struct BurnDriver BurnDrvBestri = {
"bestri", NULL, NULL, NULL, "1998",
"Bestri (Korea)\0", NULL, "F2 System", "Miscellaneous",
L"Bestri\0\uBCA0\uC2A4\uD2B8\uB77C\uC774 (Korea)\0", NULL, NULL, NULL,
"Bestri (Korea, set 1)\0", NULL, "F2 System", "Miscellaneous",
L"Bestri\0\uBCA0\uC2A4\uD2B8\uB77C\uC774 (Korea, set 1)\0", NULL, NULL, NULL,
BDF_GAME_WORKING, 2, HARDWARE_MISC_POST90S, GBF_MINIGAMES, 0,
NULL, bestriRomInfo, bestriRomName, NULL, NULL, NULL, NULL, CrospangInputInfo, BestriDIPInfo,
bestriInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x300,
@ -847,6 +873,48 @@ struct BurnDriver BurnDrvBestri = {
};
// Bestri (Korea, set 2)
static struct BurnRomInfo bestriaRomDesc[] = {
{ "o_ua02.i3", 0x80000, 0x035c86f6, 1 | BRF_PRG | BRF_ESS }, // 0 68k Code
{ "e_ua03.i5", 0x80000, 0x7c53d9f8, 1 | BRF_PRG | BRF_ESS }, // 1
{ "us02.p3", 0x10000, 0xc7cc05fa, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 Code
{ "us08.q7", 0x40000, 0x85d8f3de, 3 | BRF_SND }, // 3 Oki Samples
{ "2_uc08.m12", 0x80000, 0x23778472, 4 | BRF_GRA }, // 4 Background Tiles
{ "0_uc07.p12", 0x80000, 0x7aad194c, 4 | BRF_GRA }, // 5
{ "3_uc29.k12", 0x80000, 0x2f5b244f, 4 | BRF_GRA }, // 6
{ "1_uc28.n12", 0x80000, 0x4f737007, 4 | BRF_GRA }, // 7
{ "a_ud14.j12", 0x80000, 0x3502f71b, 5 | BRF_GRA }, // 8 Sprites
{ "b_ud15.h12", 0x80000, 0x2636b837, 5 | BRF_GRA }, // 9
{ "c_ud16.g12", 0x80000, 0x68b0ff81, 5 | BRF_GRA }, // 10
{ "d_ud17.e12", 0x80000, 0x60082aed, 5 | BRF_GRA }, // 11
};
STD_ROM_PICK(bestria)
STD_ROM_FN(bestria)
static INT32 bestriaInit()
{
bestria = 1;
return DrvInit(bestriLoadRoms);
}
struct BurnDriver BurnDrvBestria = {
"bestria", "bestri", NULL, NULL, "1998",
"Bestri (Korea, set 2)\0", NULL, "F2 System", "Miscellaneous",
L"Bestri\0\uBCA0\uC2A4\uD2B8\uB77C\uC774 (Korea, set 2)\0", NULL, NULL, NULL,
BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_MISC_POST90S, GBF_MINIGAMES, 0,
NULL, bestriaRomInfo, bestriaRomName, NULL, NULL, NULL, NULL, CrospangInputInfo, BestriDIPInfo,
bestriaInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x300,
320, 240, 4, 3
};
// Pitapat Puzzle
static struct BurnRomInfo pitapatRomDesc[] = {

View File

@ -1,6 +1,7 @@
#include "tiles_generic.h"
#define MAX_TILEMAPS 32 // number of tile maps allowed
#define MAX_GFXNUM
struct GenericTilemap {
UINT8 initialized;
@ -25,6 +26,7 @@ struct GenericTilemap {
INT32 transcolor;
UINT8 *dirty_tiles; // 1 skip, 0 draw
INT32 dirty_tiles_enable;
UINT8 *skip_tiles[MAX_GFX];
};
static GenericTilemap maps[MAX_TILEMAPS];
@ -94,6 +96,10 @@ void GenericTilemapInit(INT32 which, INT32 (*pScan)(INT32 col, INT32 row), void
cur_map->dirty_tiles = NULL; // disable by default
cur_map->dirty_tiles_enable = 0; // disable by default
for (INT32 i = 0; i < MAX_GFX; i++) {
cur_map->skip_tiles[i] = NULL; // disable by default
}
}
void GenericTilemapSetGfx(INT32 num, UINT8 *gfxbase, INT32 depth, INT32 tile_width, INT32 tile_height, INT32 gfxlen, UINT32 color_offset, UINT32 color_mask)
@ -152,6 +158,12 @@ void GenericTilemapExit()
if (cur_map->scrollx_table) BurnFree(cur_map->scrollx_table);
if (cur_map->transparent[0]) BurnFree(cur_map->transparent[0]);
if (cur_map->dirty_tiles) BurnFree(cur_map->dirty_tiles);
for (INT32 j = 0; j < MAX_GFX; j++) {
if (cur_map->skip_tiles[j]) {
BurnFree(cur_map->skip_tiles[j]);
}
}
}
// wipe everything else out
@ -232,6 +244,70 @@ void GenericTilemapSetTransparent(INT32 which, UINT32 transparent)
cur_map->flags |= TMAP_TRANSPARENT;
}
void GenericTilemapBuildSkipTable(INT32 which, INT32 gfxnum, INT32 transparent)
{
#if defined FBNEO_DEBUG
if (which < 0 || which >= MAX_TILEMAPS) {
bprintf (PRINT_ERROR, _T("GenericTilemapBuildSkipTable(%d, %d, 0x%x); called with impossible tilemap number!\n"), which, gfxnum, transparent);
return;
}
if (gfxnum >= MAX_GFX) {
bprintf (PRINT_ERROR, _T("GenericTilemapBuildSkipTable(%d, %d, 0x%x); called with impossible gfxnum number (max is %d!)\n"), which, gfxnum, transparent, MAX_GFX);
return;
}
#endif
cur_map = &maps[which];
#if defined FBNEO_DEBUG
if (cur_map->initialized == 0) {
bprintf (PRINT_ERROR, _T("GenericTilemapBuildSkipTable(%d, %d, 0x%x); called without initialized tilemap!\n"), which, gfxnum, transparent);
return;
}
#endif
GenericTilesGfx *gfx = &GenericGfxData[gfxnum];
#if defined FBNEO_DEBUG
if (gfx->gfxbase == NULL) {
bprintf (PRINT_ERROR,_T("GenericTilemapBuildSkipTable(%d, %d, 0x%x); gfx[%d] not initialized!\n"), which, gfxnum, transparent, gfxnum);
return;
}
INT32 maxtrans = (1 << gfx->depth) - 1;
if (maxtrans < transparent) {
bprintf (PRINT_ERROR, _T("GenericTilemapBuildSkipTable(%d, %d, 0x%x); called with invalid transparent color (max is %x)!\n"), which, gfxnum, transparent, maxtrans);
return;
}
#endif
INT32 one_tile = gfx->width * gfx->height;
if (cur_map->skip_tiles[gfxnum] == NULL) {
cur_map->skip_tiles[gfxnum] = (UINT8*)BurnMalloc(gfx->gfx_len / one_tile);
}
UINT8 *gfxptr = gfx->gfxbase;
for (UINT32 i = 0; i < gfx->gfx_len / one_tile; i++)
{
cur_map->skip_tiles[gfxnum][i] = 1; // skip
for (INT32 j = 0; j < one_tile; j++)
{
if (gfxptr[j] != transparent)
{
cur_map->skip_tiles[gfxnum][i] = 0;
break;
}
}
gfxptr += one_tile;
}
}
void GenericTilemapSetTransSplit(INT32 which, INT32 category, UINT16 layer0, UINT16 layer1)
{
#if defined FBNEO_DEBUG
@ -817,8 +893,29 @@ void GenericTilemapDraw(INT32 which, UINT16 *Bitmap, INT32 priority, INT32 prior
}
}
GenericTilesGfx *gfx = &GenericGfxData[gfxnum];
#if defined FBNEO_DEBUG
if (gfx->gfxbase == NULL) {
bprintf (PRINT_ERROR,_T("GenericTilemapDraw(%d) gfx[%d] not initialized!\n"), which, gfxnum);
continue;
}
if (((UINT32)gfx->width != cur_map->twidth) || ((UINT32)gfx->height != cur_map->theight))
{
bprintf (PRINT_ERROR,_T("GenericTilemapDraw(%d) gfx[%d] tile dimensions (%dx%d do not match tilemap tile dimensions (%dx%d)!\n"), which, gfxnum, gfx->width, gfx->height, cur_map->twidth, cur_map->theight);
continue;
}
#endif
code %= gfx->code_mask;
if (opaque == 0)
{
if (cur_map->skip_tiles[gfxnum] && (cur_map->flags & TMAP_TRANSPARENT)) // skip this tile
if (cur_map->skip_tiles[gfxnum][code])
continue;
if (flags & TILE_SKIP) continue; // skip this tile
if (flags & TILE_GROUP_ENABLE) {
@ -830,15 +927,7 @@ void GenericTilemapDraw(INT32 which, UINT16 *Bitmap, INT32 priority, INT32 prior
}
}
GenericTilesGfx *gfx = &GenericGfxData[gfxnum];
if (gfx->gfxbase == NULL) {
bprintf (PRINT_ERROR,_T("GenericTilemapDraw(%d) gfx[%d] not initialized!\n"), which, gfxnum);
continue;
}
color = ((color & gfx->color_mask) << gfx->depth) + gfx->color_offset;
code %= gfx->code_mask;
INT32 flipx = flags & TILE_FLIPX;
INT32 flipy = flags & TILE_FLIPY;
@ -915,8 +1004,29 @@ void GenericTilemapDraw(INT32 which, UINT16 *Bitmap, INT32 priority, INT32 prior
}
}
GenericTilesGfx *gfx = &GenericGfxData[gfxnum];
#if defined FBNEO_DEBUG
if (gfx->gfxbase == NULL) {
bprintf (PRINT_ERROR,_T("GenericTilemapDraw(%d) gfx[%d] not initialized!\n"), which, gfxnum);
continue;
}
if (((UINT32)gfx->width != cur_map->twidth) || ((UINT32)gfx->height != cur_map->theight))
{
bprintf (PRINT_ERROR,_T("GenericTilemapDraw(%d) gfx[%d] tile dimensions (%dx%d do not match tilemap tile dimensions (%dx%d)!\n"), which, gfxnum, gfx->width, gfx->height, cur_map->twidth, cur_map->theight);
continue;
}
#endif
code %= gfx->code_mask;
if (opaque == 0)
{
if (cur_map->skip_tiles[gfxnum] && (cur_map->flags & TMAP_TRANSPARENT)) // skip this tile
if (cur_map->skip_tiles[gfxnum][code])
continue;
if (flags & TILE_SKIP) continue; // skip this tile
if (flags & TILE_GROUP_ENABLE) {
@ -928,15 +1038,7 @@ void GenericTilemapDraw(INT32 which, UINT16 *Bitmap, INT32 priority, INT32 prior
}
}
GenericTilesGfx *gfx = &GenericGfxData[gfxnum];
if (gfx->gfxbase == NULL) {
bprintf (PRINT_ERROR,_T("GenericTilemapDraw(%d) gfx[%d] not initialized!\n"), which, gfxnum);
continue;
}
color = ((color & gfx->color_mask) << gfx->depth) + gfx->color_offset;
code %= gfx->code_mask;
INT32 flipx = flags & TILE_FLIPX;
INT32 flipy = flags & TILE_FLIPY;
@ -1008,7 +1110,7 @@ void GenericTilemapDraw(INT32 which, UINT16 *Bitmap, INT32 priority, INT32 prior
INT32 endx = maxx + cur_map->twidth;
INT32 endy = maxy + cur_map->theight;
#if 0
// akka arrh buggy (clipclipderp) fix
// akka arrh buggy (clip) fix
// after reimpl, test:
// bwings, zaviga, squaitsa, botanicf, bagman
// if they are weirdly-offset, something is wrong.
@ -1051,8 +1153,31 @@ void GenericTilemapDraw(INT32 which, UINT16 *Bitmap, INT32 priority, INT32 prior
}
}
GenericTilesGfx *gfx = &GenericGfxData[gfxnum];
#if defined FBNEO_DEBUG
if (gfx->gfxbase == NULL) {
bprintf (PRINT_ERROR,_T("GenericTilemapDraw(%d) gfx[%d] not initialized!\n"), which, gfxnum);
continue;
}
if (((UINT32)gfx->width != cur_map->twidth) || ((UINT32)gfx->height != cur_map->theight))
{
bprintf (PRINT_ERROR,_T("GenericTilemapDraw(%d) gfx[%d] tile dimensions (%dx%d do not match tilemap tile dimensions (%dx%d)!\n"), which, gfxnum, gfx->width, gfx->height, cur_map->twidth, cur_map->theight);
continue;
}
#endif
code %= gfx->code_mask;
if (opaque == 0)
{
if (cur_map->skip_tiles[gfxnum] && (cur_map->flags & TMAP_TRANSPARENT)) { // skip this tile
if (cur_map->skip_tiles[gfxnum][code]) {
continue;
}
}
if (flags & TILE_SKIP) continue; // skip this tile
if (flags & TILE_GROUP_ENABLE) {
@ -1064,15 +1189,7 @@ void GenericTilemapDraw(INT32 which, UINT16 *Bitmap, INT32 priority, INT32 prior
}
}
GenericTilesGfx *gfx = &GenericGfxData[gfxnum];
if (gfx->gfxbase == NULL) {
bprintf (PRINT_ERROR,_T("GenericTilemapDraw(%d) gfx[%d] not initialized!\n"), which, gfxnum);
continue;
}
color &= gfx->color_mask;
code %= gfx->code_mask;
INT32 sy = y - syshift;
INT32 sx = x - sxshift;
@ -1081,14 +1198,14 @@ void GenericTilemapDraw(INT32 which, UINT16 *Bitmap, INT32 priority, INT32 prior
INT32 flipy = flags & TILE_FLIPY;
if (cur_map->flags & TMAP_FLIPY) {
// part of clipclipderp fix (save for reimpl)
// part of clip fix (save for reimpl)
//sy = ((cur_map->mheight - 1) * cur_map->theight) - sy;
sy = ((maxy - miny) - cur_map->theight) - sy;
flipy ^= TILE_FLIPY;
}
if (cur_map->flags & TMAP_FLIPX) {
// part of clipclipderp fix (save for reimpl)
// part of clipc fix (save for reimpl)
//sx = ((cur_map->mwidth - 1) * cur_map->twidth) - sx;
sx = ((maxx - minx) - cur_map->twidth) - sx;
flipx ^= TILE_FLIPX;
@ -1231,8 +1348,29 @@ void GenericTilemapDraw(INT32 which, UINT16 *Bitmap, INT32 priority, INT32 prior
}
}
GenericTilesGfx *gfx = &GenericGfxData[gfxnum];
#if defined FBNEO_DEBUG
if (gfx->gfxbase == NULL) {
bprintf (PRINT_ERROR,_T("GenericTilemapDraw(%d) gfx[%d] not initialized!\n"), which, gfxnum);
continue;
}
if (((UINT32)gfx->width != cur_map->twidth) || ((UINT32)gfx->height != cur_map->theight))
{
bprintf (PRINT_ERROR,_T("GenericTilemapDraw(%d) gfx[%d] tile dimensions (%dx%d do not match tilemap tile dimensions (%dx%d)!\n"), which, gfxnum, gfx->width, gfx->height, cur_map->twidth, cur_map->theight);
continue;
}
#endif
code %= gfx->code_mask;
if (opaque == 0)
{
if (cur_map->skip_tiles[gfxnum] && (cur_map->flags & TMAP_TRANSPARENT)) // skip this tile
if (cur_map->skip_tiles[gfxnum][code])
continue;
if (flags & TILE_SKIP) continue; // skip this tile
if (flags & TILE_GROUP_ENABLE) {
@ -1244,15 +1382,7 @@ void GenericTilemapDraw(INT32 which, UINT16 *Bitmap, INT32 priority, INT32 prior
}
}
GenericTilesGfx *gfx = &GenericGfxData[gfxnum];
if (gfx->gfxbase == NULL) {
bprintf (PRINT_ERROR,_T("GenericTilemapDraw(%d) gfx[%d] not initialized!\n"), which, gfxnum);
continue;
}
color &= gfx->color_mask;
code %= gfx->code_mask;
INT32 sx = col * cur_map->twidth;
INT32 sy = row * cur_map->theight;

View File

@ -115,6 +115,9 @@ void GenericTilemapSetTransMask(INT32 which, INT32 category, UINT16 transmask);
// Set a Transmask Split. Specify TMAP_DRAWLAYER0 or TMAP_DRAWLAYER1 in draw flags, set "*category = layernum;" in callback.
void GenericTilemapSetTransSplit(INT32 which, INT32 category, UINT16 layer0, UINT16 layer1);
// Build a table of fully transparent tiles
void GenericTilemapBuildSkipTable(INT32 which, INT32 gfxnum, INT32 transparent);
// Set scroll x (horizontal) or y (vertical) for the tilemap
void GenericTilemapSetScrollX(INT32 which, INT32 scrollx);
void GenericTilemapSetScrollY(INT32 which, INT32 scrolly);