public static void tilemap_initC() { int i; ttmap = new Tmap[3]; ttmap[0] = new Tmap(); ttmap[0].tilewidth = 8; ttmap[0].tileheight = 8; ttmap[0].width = 0x200; ttmap[0].height = 0x200; ttmap[0].scrollrows = 1; ttmap[0].pixmap = new ushort[0x200 * 0x200]; ttmap[0].flagsmap = new byte[0x200, 0x200]; ttmap[0].tileflags = new byte[0x40, 0x40]; ttmap[0].pen_to_flags = new byte[4, 16]; ttmap[0].pen_data = new byte[0x40]; ttmap[1] = new Tmap(); ttmap[1].tilewidth = 0x10; ttmap[1].tileheight = 0x10; ttmap[1].width = 0x400; ttmap[1].height = 0x400; ttmap[1].scrollrows = 0x400; ttmap[1].pixmap = new ushort[0x400 * 0x400]; ttmap[1].flagsmap = new byte[0x400, 0x400]; ttmap[1].tileflags = new byte[0x40, 0x40]; ttmap[1].pen_to_flags = new byte[4, 16]; ttmap[1].pen_data = new byte[0x100]; ttmap[2] = new Tmap(); ttmap[2].tilewidth = 0x20; ttmap[2].tileheight = 0x20; ttmap[2].width = 0x800; ttmap[2].height = 0x800; ttmap[2].scrollrows = 1; ttmap[2].pixmap = new ushort[0x800 * 0x800]; ttmap[2].flagsmap = new byte[0x800, 0x800]; ttmap[2].tileflags = new byte[0x40, 0x40]; ttmap[2].pen_to_flags = new byte[4, 16]; ttmap[2].pen_data = new byte[0x400]; for (i = 0; i < 3; i++) { ttmap[i].rows = 0x40; ttmap[i].cols = 0x40; ttmap[i].enable = true; ttmap[i].all_tiles_dirty = true; ttmap[i].scrollcols = 1; ttmap[i].rowscroll = new int[ttmap[i].scrollrows]; ttmap[i].colscroll = new int[ttmap[i].scrollcols]; ttmap[i].tilemap_draw_instance3 = ttmap[i].tilemap_draw_instanceC; ttmap[i].tilemap_draw_instance4 = ttmap[i].tilemap_draw_instanceC4; ttmap[i].tilemap_set_scrolldx(0, 0); ttmap[i].tilemap_set_scrolldy(0x100, 0); } ttmap[0].tile_update3 = ttmap[0].tile_updateC0; ttmap[1].tile_update3 = ttmap[1].tile_updateC1; ttmap[2].tile_update3 = ttmap[2].tile_updateC2; ttmap[0].total_elements = CPS.gfxrom.Length / 0x40; ttmap[1].total_elements = CPS.gfxrom.Length / 0x80; ttmap[2].total_elements = CPS.gfxrom.Length / 0x200; }
public static void tilemap_initPgm() { int i; pgm_tx_tilemap = new Tmap(); pgm_tx_tilemap.rows = 32; pgm_tx_tilemap.cols = 64; pgm_tx_tilemap.tilewidth = 8; pgm_tx_tilemap.tileheight = 8; pgm_tx_tilemap.width = 0x200; pgm_tx_tilemap.height = 0x100; pgm_tx_tilemap.enable = true; pgm_tx_tilemap.all_tiles_dirty = true; pgm_tx_tilemap.pixmap = new ushort[0x100 * 0x200]; pgm_tx_tilemap.flagsmap = new byte[0x100, 0x200]; pgm_tx_tilemap.tileflags = new byte[0x20, 0x40]; pgm_tx_tilemap.tile_update3 = pgm_tx_tilemap.tile_updatePgmtx; pgm_tx_tilemap.tilemap_draw_instance3 = pgm_tx_tilemap.tilemap_draw_instancePgmtx; pgm_tx_tilemap.total_elements = 0x800000 / 0x20; pgm_tx_tilemap.pen_data = new byte[0x40]; pgm_tx_tilemap.pen_to_flags = new byte[1, 16]; for (i = 0; i < 15; i++) { pgm_tx_tilemap.pen_to_flags[0, i] = 0x10; } pgm_tx_tilemap.pen_to_flags[0, 15] = 0; pgm_tx_tilemap.scrollrows = 1; pgm_tx_tilemap.scrollcols = 1; pgm_tx_tilemap.rowscroll = new int[pgm_tx_tilemap.scrollrows]; pgm_tx_tilemap.colscroll = new int[pgm_tx_tilemap.scrollcols]; pgm_bg_tilemap = new Tmap(); pgm_bg_tilemap.cols = 64; pgm_bg_tilemap.rows = 64; pgm_bg_tilemap.tilewidth = 32; pgm_bg_tilemap.tileheight = 32; pgm_bg_tilemap.width = 0x800; pgm_bg_tilemap.height = 0x800; pgm_bg_tilemap.enable = true; pgm_bg_tilemap.all_tiles_dirty = true; pgm_bg_tilemap.pixmap = new ushort[0x800 * 0x800]; pgm_bg_tilemap.flagsmap = new byte[0x800, 0x800]; pgm_bg_tilemap.tileflags = new byte[0x40, 0x40]; pgm_bg_tilemap.tile_update3 = pgm_bg_tilemap.tile_updatePgmbg; pgm_bg_tilemap.tilemap_draw_instance3 = pgm_bg_tilemap.tilemap_draw_instancePgmbg; pgm_bg_tilemap.total_elements = 0x3333; pgm_bg_tilemap.pen_data = new byte[0x400]; pgm_bg_tilemap.pen_to_flags = new byte[1, 32]; for (i = 0; i < 31; i++) { pgm_bg_tilemap.pen_to_flags[0, i] = 0x10; } pgm_bg_tilemap.pen_to_flags[0, 31] = 0; pgm_bg_tilemap.scrollrows = 64 * 32; pgm_bg_tilemap.scrollcols = 1; pgm_bg_tilemap.rowscroll = new int[pgm_bg_tilemap.scrollrows]; pgm_bg_tilemap.colscroll = new int[pgm_bg_tilemap.scrollcols]; }
public static void tilemap_initNa() { int i; ttmap = new Tmap[6]; ttmap[0] = new Tmap(); ttmap[0].rows = 64; ttmap[0].cols = 64; ttmap[0].videoram_offset = 0x0000; ttmap[1] = new Tmap(); ttmap[1].rows = 64; ttmap[1].cols = 64; ttmap[1].videoram_offset = 0x2000; ttmap[2] = new Tmap(); ttmap[2].rows = 64; ttmap[2].cols = 64; ttmap[2].videoram_offset = 0x4000; ttmap[3] = new Tmap(); ttmap[3].rows = 32; ttmap[3].cols = 64; ttmap[3].videoram_offset = 0x6000; ttmap[4] = new Tmap(); ttmap[4].rows = 28; ttmap[4].cols = 36; ttmap[4].videoram_offset = 0x7010; ttmap[5] = new Tmap(); ttmap[5].rows = 28; ttmap[5].cols = 36; ttmap[5].videoram_offset = 0x7810; for (i = 0; i < 6; i++) { ttmap[i].tilewidth = 8; ttmap[i].tileheight = 8; ttmap[i].width = ttmap[i].cols * ttmap[i].tilewidth; ttmap[i].height = ttmap[i].rows * ttmap[i].tileheight; ttmap[i].enable = true; ttmap[i].all_tiles_dirty = true; ttmap[i].scrollrows = 1; ttmap[i].scrollcols = 1; ttmap[i].rowscroll = new int[ttmap[i].scrollrows]; ttmap[i].colscroll = new int[ttmap[i].scrollcols]; ttmap[i].pixmap = new ushort[0x200 * 0x200]; ttmap[i].flagsmap = new byte[0x200, 0x200]; ttmap[i].tileflags = new byte[0x40, 0x40]; ttmap[i].tile_update3 = ttmap[i].tile_updateNa; ttmap[i].tilemap_draw_instance3 = ttmap[i].tilemap_draw_instanceNa; } }
public static byte TILEMAP_FLIPY = TILE_FLIPY; /* draw the tilemap vertically flipped */ public static void tilemap_init() { int i, j; switch (Machine.sBoard) { case "CPS-1": case "CPS-1(QSound)": case "CPS2": Tmap.tilemap_initC(); break; case "Namco System 1": Tmap.tilemap_initNa(); break; case "PGM": Tmap.tilemap_initPgm(); break; } screen_width = 0x200; screen_height = 0x200; priority_bitmap = new byte[0x200, 0x200]; bb01 = new byte[1, 0x200]; bbFF = new byte[0x40, 0x40]; empty_tile = new byte[0x400]; for (i = 0; i < 0x200; i++) { bb01[0, i] = 0x01; } for (i = 0; i < 0x40; i++) { for (j = 0; j < 0x40; j++) { bbFF[i, j] = 0xff; } } for (i = 0; i < 0x400; i++) { empty_tile[i] = 0x0f; } videovisarea.min_x = 0; videovisarea.max_x = 0x1ff; videovisarea.min_y = 0; videovisarea.max_y = 0x1ff; }
public static void tilemap_init() { int i; bg_tilemap = new Tmap(); bg_tilemap.rows = 64; bg_tilemap.cols = 64; bg_tilemap.tilewidth = 8; bg_tilemap.tileheight = 8; bg_tilemap.width = 0x200; bg_tilemap.height = 0x200; bg_tilemap.enable = true; bg_tilemap.all_tiles_dirty = true; bg_tilemap.pixmap = new ushort[0x200 * 0x200]; bg_tilemap.flagsmap = new byte[0x200, 0x200]; bg_tilemap.tileflags = new byte[0x40, 0x40]; bg_tilemap.total_elements = M72.gfx21rom.Length / 0x40; bg_tilemap.pen_data = new byte[0x40]; bg_tilemap.pen_to_flags = new byte[3, 16]; for (i = 0; i < 16; i++) { bg_tilemap.pen_to_flags[0, i] = 0x20; } for (i = 0; i < 8; i++) { bg_tilemap.pen_to_flags[1, i] = 0x20; } for (i = 8; i < 16; i++) { bg_tilemap.pen_to_flags[1, i] = 0x10; } bg_tilemap.pen_to_flags[2, 0] = 0x20; for (i = 1; i < 16; i++) { bg_tilemap.pen_to_flags[2, i] = 0x10; } bg_tilemap.scrollrows = 1; bg_tilemap.scrollcols = 1; bg_tilemap.rowscroll = new int[bg_tilemap.scrollrows]; bg_tilemap.colscroll = new int[bg_tilemap.scrollcols]; bg_tilemap.tilemap_draw_instance3 = bg_tilemap.tilemap_draw_instanceM72; fg_tilemap = new Tmap(); fg_tilemap.cols = 64; fg_tilemap.rows = 64; fg_tilemap.tilewidth = 8; fg_tilemap.tileheight = 8; fg_tilemap.width = 0x200; fg_tilemap.height = 0x200; fg_tilemap.enable = true; fg_tilemap.all_tiles_dirty = true; fg_tilemap.pixmap = new ushort[0x200 * 0x200]; fg_tilemap.flagsmap = new byte[0x200, 0x200]; fg_tilemap.tileflags = new byte[0x40, 0x40]; fg_tilemap.total_elements = M72.gfx21rom.Length / 0x40; fg_tilemap.pen_data = new byte[0x400]; fg_tilemap.pen_to_flags = new byte[3, 32]; fg_tilemap.pen_to_flags[0, 0] = 0; for (i = 1; i < 16; i++) { fg_tilemap.pen_to_flags[0, i] = 0x20; } fg_tilemap.pen_to_flags[1, 0] = 0; for (i = 1; i < 8; i++) { fg_tilemap.pen_to_flags[1, i] = 0x20; } for (i = 8; i < 16; i++) { fg_tilemap.pen_to_flags[1, i] = 0x10; } fg_tilemap.pen_to_flags[2, 0] = 0; for (i = 1; i < 16; i++) { fg_tilemap.pen_to_flags[2, i] = 0x10; } fg_tilemap.scrollrows = 1; fg_tilemap.scrollcols = 1; fg_tilemap.rowscroll = new int[fg_tilemap.scrollrows]; fg_tilemap.colscroll = new int[fg_tilemap.scrollcols]; fg_tilemap.tilemap_draw_instance3 = fg_tilemap.tilemap_draw_instanceM72; switch (Machine.sName) { case "airduel": case "airduelm72": bg_tilemap.tile_update3 = bg_tilemap.tile_updateM72_bg_m72; fg_tilemap.tile_update3 = fg_tilemap.tile_updateM72_fg_m72; break; case "ltswords": case "kengo": case "kengoa": bg_tilemap.tile_update3 = bg_tilemap.tile_updateM72_bg_rtype2; fg_tilemap.tile_update3 = fg_tilemap.tile_updateM72_fg_rtype2; break; } }
public static void video_update_namcos1() { int i, j, scrollx, scrolly; byte priority; RECT new_clip = new RECT(); new_clip.min_x = 0x49; new_clip.max_x = 0x168; new_clip.min_y = 0x10; new_clip.max_y = 0xef; Video.flip_screen_set_no_update((namcos1_spriteram[0x800 + 0x07f6] & 1) != 0); Tmap.tilemap_set_flip(Video.flip_screen_get() ? (byte)(Tilemap.TILEMAP_FLIPY | Tilemap.TILEMAP_FLIPX) : (byte)0); Array.Copy(uu1FFF, Video.bitmapbaseNa[Video.curbitmap], 0x40000); i = ((namcos1_cus116[0] << 8) | namcos1_cus116[1]) - 1; if (new_clip.min_x < i) { new_clip.min_x = i; } i = ((namcos1_cus116[2] << 8) | namcos1_cus116[3]) - 1 - 1; if (new_clip.max_x > i) { new_clip.max_x = i; } i = ((namcos1_cus116[4] << 8) | namcos1_cus116[5]) - 0x11; if (new_clip.min_y < i) { new_clip.min_y = i; } i = ((namcos1_cus116[6] << 8) | namcos1_cus116[7]) - 0x11 - 1; if (new_clip.max_y > i) { new_clip.max_y = i; } if (new_clip.max_x < new_clip.min_x || new_clip.max_y < new_clip.min_y) { return; } for (i = 0; i < 6; i++) { Tmap.ttmap[i].tilemap_set_palette_offset((namcos1_playfield_control[i + 24] & 7) * 256); } for (i = 0; i < 4; i++) { int[] disp_x = new int[] { 25, 27, 28, 29 }; j = i << 2; scrollx = (namcos1_playfield_control[j + 1] + (namcos1_playfield_control[j + 0] << 8)) - disp_x[i]; scrolly = (namcos1_playfield_control[j + 3] + (namcos1_playfield_control[j + 2] << 8)) + 8; if (Video.flip_screen_get()) { scrollx = -scrollx; scrolly = -scrolly; } Tmap.ttmap[i].tilemap_set_scrollx(0, scrollx); Tmap.ttmap[i].tilemap_set_scrolly(0, scrolly); } Array.Clear(Tilemap.priority_bitmap, 0, 0x40000); for (i = 0; i < 0x200; i++) { for (j = 0; j < 0x200; j++) { Tilemap.priority_bitmap[i, j] = 0; } } for (priority = 0; priority < 8; priority++) { for (i = 0; i < 6; i++) { if (namcos1_playfield_control[16 + i] == priority) { Tmap.ttmap[i].tilemap_draw_primask(new_clip, priority); } } } draw_sprites(Video.curbitmap, new_clip); }