summaryrefslogtreecommitdiffstatshomepage
path: root/src/mame/video/funkyjet.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/mame/video/funkyjet.c')
-rw-r--r--src/mame/video/funkyjet.c90
1 files changed, 90 insertions, 0 deletions
diff --git a/src/mame/video/funkyjet.c b/src/mame/video/funkyjet.c
new file mode 100644
index 00000000000..94f87f28c08
--- /dev/null
+++ b/src/mame/video/funkyjet.c
@@ -0,0 +1,90 @@
+/***************************************************************************
+
+ Funky Jet Video emulation - Bryan McPhail, mish@tendril.co.uk
+
+***************************************************************************/
+
+#include "driver.h"
+#include "deco16ic.h"
+
+/******************************************************************************/
+
+VIDEO_START( funkyjet )
+{
+ deco16_1_video_init();
+}
+
+static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect)
+{
+ int offs;
+
+ for (offs = 0;offs < 0x400;offs += 4)
+ {
+ int x,y,sprite,colour,multi,fx,fy,inc,flash,mult;
+
+ sprite = spriteram16[offs+1] & 0x3fff;
+
+ y = spriteram16[offs];
+ flash=y&0x1000;
+ if (flash && (cpu_getcurrentframe() & 1)) continue;
+
+ x = spriteram16[offs+2];
+ colour = (x >>9) & 0x1f;
+
+ fx = y & 0x2000;
+ fy = y & 0x4000;
+ multi = (1 << ((y & 0x0600) >> 9)) - 1; /* 1x, 2x, 4x, 8x height */
+
+ x = x & 0x01ff;
+ y = y & 0x01ff;
+ if (x >= 320) x -= 512;
+ if (y >= 256) y -= 512;
+ y = 240 - y;
+ x = 304 - x;
+
+ if (x>320) continue;
+
+ sprite &= ~multi;
+ if (fy)
+ inc = -1;
+ else
+ {
+ sprite += multi;
+ inc = 1;
+ }
+
+ if (flip_screen)
+ {
+ y=240-y;
+ x=304-x;
+ if (fx) fx=0; else fx=1;
+ if (fy) fy=0; else fy=1;
+ mult=16;
+ }
+ else mult=-16;
+
+ while (multi >= 0)
+ {
+ drawgfx(bitmap,machine->gfx[2],
+ sprite - multi * inc,
+ colour,
+ fx,fy,
+ x,y + mult * multi,
+ cliprect,TRANSPARENCY_PEN,0);
+
+ multi--;
+ }
+ }
+}
+
+VIDEO_UPDATE( funkyjet )
+{
+ flip_screen_set( deco16_pf12_control[0]&0x80 );
+ deco16_pf12_update(deco16_pf1_rowscroll,deco16_pf2_rowscroll);
+
+ fillbitmap(bitmap,machine->pens[768],cliprect);
+ deco16_tilemap_2_draw(bitmap,cliprect,TILEMAP_DRAW_OPAQUE,0);
+ deco16_tilemap_1_draw(bitmap,cliprect,0,0);
+ draw_sprites(machine,bitmap,cliprect);
+ return 0;
+}