Previous 199869 Revisions Next

r24762 Monday 5th August, 2013 at 23:32:31 UTC by David Haywood
casanova seems to want the video buffered (see palette/bg sync in intro, it's ugly and buggy anyway, but t was much worse before).  Also had to change it from ind16 to rgb32 to stop -mt from breaking it even when I do buffer it!
[src/mame/drivers]3x3puzzl.c

trunk/src/mame/drivers/3x3puzzl.c
r24761r24762
5252   required_shared_ptr<UINT16> m_videoram2;
5353   required_shared_ptr<UINT16> m_videoram3;
5454
55   UINT16 m_videoram1_buffer[0x800/2];
56   UINT16 m_videoram2_buffer[0x1000/2];
57   UINT16 m_videoram3_buffer[0x1000/2];
58
5559   // devices
5660   required_device<cpu_device> m_maincpu;
5761   required_device<okim6295_device> m_oki;
5862
5963   // screen updates
60   UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
64   UINT32 screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
6165
6266   /* video-related */
6367   tilemap_t   *m_tilemap1;
6468   tilemap_t   *m_tilemap2;
6569   tilemap_t   *m_tilemap3;
6670
67   DECLARE_WRITE16_MEMBER(videoram1_w);
6871   TILE_GET_INFO_MEMBER(get_tile1_info);
69   DECLARE_WRITE16_MEMBER(videoram2_w);
7072   TILE_GET_INFO_MEMBER(get_tile2_info);
71   DECLARE_WRITE16_MEMBER(videoram3_w);
7273   TILE_GET_INFO_MEMBER(get_tile3_info);
7374
7475   int       m_oki_bank;
76   UINT16   m_gfx_control;
7577
7678   DECLARE_WRITE16_HANDLER(gfx_ctrl_w);
7779   DECLARE_WRITE16_HANDLER(tilemap1_scrollx_w);
7880   DECLARE_WRITE16_HANDLER(tilemap1_scrolly_w);
7981
80
8182protected:
8283   virtual void video_start();
8384   virtual void machine_start();
8485   virtual void machine_reset();
8586};
8687
87WRITE16_MEMBER(_3x3puzzle_state::videoram1_w)
88{
89   COMBINE_DATA(&m_videoram1[offset]);
90   m_tilemap1->mark_tile_dirty(offset);
91}
9288
89
9390TILE_GET_INFO_MEMBER(_3x3puzzle_state::get_tile1_info)
9491{
95   UINT16 code = m_videoram1[tile_index];
92   UINT16 code = m_videoram1_buffer[tile_index];
9693   SET_TILE_INFO_MEMBER(
9794         0,
9895         code,
r24761r24762
10097         0);
10198}
10299
103WRITE16_MEMBER(_3x3puzzle_state::videoram2_w)
104{
105   COMBINE_DATA(&m_videoram2[offset]);
106   m_tilemap2->mark_tile_dirty(offset);
107}
108
109100TILE_GET_INFO_MEMBER(_3x3puzzle_state::get_tile2_info)
110101{
111   UINT16 code = m_videoram2[tile_index];
102   UINT16 code = m_videoram2_buffer[tile_index];
112103   SET_TILE_INFO_MEMBER(
113104         1,
114105         code,
r24761r24762
116107         0);
117108}
118109
119WRITE16_MEMBER(_3x3puzzle_state::videoram3_w)
120{
121   COMBINE_DATA(&m_videoram3[offset]);
122   m_tilemap3->mark_tile_dirty(offset);
123}
124
125110TILE_GET_INFO_MEMBER(_3x3puzzle_state::get_tile3_info)
126111{
127   UINT16 code = m_videoram3[tile_index];
112   UINT16 code = m_videoram3_buffer[tile_index];
128113   SET_TILE_INFO_MEMBER(
129114         2,
130115         code,
r24761r24762
144129   // bit 0 (0x01) set in Casanova intro (could be OKI bank instead of bit 2?)
145130
146131   //printf("%04x\n",data&0xc7);
132   COMBINE_DATA(&m_gfx_control);
147133
148134   if ( BIT(data,4) )
149135   {
r24761r24762
180166   m_tilemap3->set_transparent_pen(0);
181167}
182168
183UINT32 _3x3puzzle_state::screen_update( screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect )
169UINT32 _3x3puzzle_state::screen_update( screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect )
184170{
171
172
185173   m_tilemap1->draw(screen, bitmap, cliprect, 0, 1);
186174   m_tilemap2->draw(screen, bitmap, cliprect, 0, 2);
187175   m_tilemap3->draw(screen, bitmap, cliprect, 0, 3);
176
177   // guess based on register use and Casanova intro
178   if (m_gfx_control&0x20)
179   {
180      for (int offset=0;offset<0x800/2;offset++)
181      {
182         m_videoram1_buffer[offset] = m_videoram1[offset];
183         m_tilemap1->mark_tile_dirty(offset);
184      }
185
186      for (int offset=0;offset<0x1000/2;offset++)
187      {
188         m_videoram2_buffer[offset] = m_videoram2[offset];
189         m_tilemap2->mark_tile_dirty(offset);
190         m_videoram3_buffer[offset] = m_videoram3[offset];
191         m_tilemap3->mark_tile_dirty(offset);
192      }
193   }
194
188195   return 0;
189196}
190197
191198static ADDRESS_MAP_START( _3x3puzzle_map, AS_PROGRAM, 16, _3x3puzzle_state )
192199   AM_RANGE(0x000000, 0x07ffff) AM_ROM
193200   AM_RANGE(0x100000, 0x10ffff) AM_RAM
194   AM_RANGE(0x200000, 0x2007ff) AM_WRITE(videoram1_w) AM_SHARE("videoram1")
195   AM_RANGE(0x201000, 0x201fff) AM_WRITE(videoram2_w) AM_SHARE("videoram2")
196   AM_RANGE(0x202000, 0x202fff) AM_WRITE(videoram3_w) AM_SHARE("videoram3")
201   AM_RANGE(0x200000, 0x2007ff) AM_RAM AM_SHARE("videoram1")
202   AM_RANGE(0x201000, 0x201fff) AM_RAM AM_SHARE("videoram2")
203   AM_RANGE(0x202000, 0x202fff) AM_RAM AM_SHARE("videoram3")
197204   AM_RANGE(0x280000, 0x280001) AM_READ_PORT("VBLANK")
198205   AM_RANGE(0x300000, 0x3005ff) AM_RAM_WRITE(paletteram_xBBBBBGGGGGRRRRR_word_w) AM_SHARE("paletteram")
199206   AM_RANGE(0x400000, 0x400001) AM_WRITE(tilemap1_scrollx_w)

Previous 199869 Revisions Next


© 1997-2024 The MAME Team