Previous 199869 Revisions Next

r21826 Wednesday 13th March, 2013 at 10:17:20 UTC by David Haywood
popobear - better layer enables / scrolling.
[src/mame/drivers]popobear.c

trunk/src/mame/drivers/popobear.c
r21825r21826
88    - auto-animation speed is erratic (way too fast);
99    - tilemap effects (scrolling, colscroll, linescroll);
1010     (high score table?)
11   - BMC logo isn't copied correctly after an attract loop, RAM not cleared on a reset either?
1211    - BGM seems quite off, YM2413 core bug?
1312    - I/Os;
1413    - IRQ generation;
r21825r21826
116115   virtual void video_start();
117116   UINT32 screen_update_popobear(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
118117   TIMER_DEVICE_CALLBACK_MEMBER(popobear_irq);
119   void draw_layer(bitmap_ind16 &bitmap,const rectangle &cliprect, UINT8 layer_n);
120118   void draw_sprites(bitmap_ind16 &bitmap,const rectangle &cliprect);
121119
122120   int m_gfx_index;
r21825r21826
230228}
231229
232230
233void popobear_state::draw_layer(bitmap_ind16 &bitmap,const rectangle &cliprect, UINT8 layer_n)
234{
235   UINT16* vreg = (UINT16 *)m_vregs;
236   const UINT8 vreg_base[] = { 0x10/2, 0x14/2 };
237   int xscroll,yscroll;
238231
239   if(layer_n & 2)
240   {
241      xscroll = vreg[vreg_base[(layer_n & 1) ^ 1]+2/2] & 0x1ff;
242      yscroll = vreg[vreg_base[(layer_n & 1) ^ 1]+0/2] & 0x1ff;
243   }
244   else
245   {
246      xscroll = 0;
247      yscroll = 0;
248   }
249   popmessage("%04x %04x",vreg[vreg_base[0]+0/2],vreg[vreg_base[1]+0/2]);
250232
251
252   m_bg_tilemap[layer_n]->set_scrolly(0, yscroll);
253   m_bg_tilemap[layer_n]->set_scrollx(0, xscroll);
254
255
256
257   m_bg_tilemap[layer_n]->draw(bitmap, cliprect, 0, 0);
258
259}
260
261
262233void popobear_state::draw_sprites(bitmap_ind16 &bitmap,const rectangle &cliprect)
263234{
264235   // ERROR: This cast is NOT endian-safe without the use of BYTE/WORD/DWORD_XOR_* macros!
r21825r21826
321292   bitmap.fill(0, cliprect);
322293
323294   //popmessage("%04x",m_vregs[0/2]);
295   UINT16* vreg = m_vregs;
324296
325   draw_layer(bitmap,cliprect,3);
326   draw_layer(bitmap,cliprect,2);
327   draw_layer(bitmap,cliprect,1);
328   draw_layer(bitmap,cliprect,0);
297   popmessage("%04x %04x %04x %04x %04x %04x %04x - %04x - %04x %04x",vreg[0x00],vreg[0x01],vreg[0x02],vreg[0x03],vreg[0x04],vreg[0x05],vreg[0x06], vreg[0x0b],vreg[0x0e],vreg[0x0f]);
298   
299
300
301   // these are more than just enable, they get written with 0x0d and 0x1f (and 0x00 when a layer is off)
302   // it might relate to the linescroll modes or sizes?
303   int enable0 = (m_vregs[0x0c] & 0xff00)>>8;
304   int enable1 = (m_vregs[0x0c] & 0x00ff)>>0;
305   int enable2 = (m_vregs[0x0d] & 0xff00)>>8;
306   int enable3 = (m_vregs[0x0d] & 0x00ff)>>0;
307
308   if ((enable0 != 0x00) && (enable0 != 0x0d) && (enable0 != 0x1f)) printf("unknown enable0 value %02x\n", enable0);
309   if ((enable1 != 0x00) && (enable1 != 0x0d) && (enable1 != 0x1f)) printf("unknown enable1 value %02x\n", enable1);
310   if ((enable2 != 0x00) && (enable2 != 0x0d) && (enable2 != 0x1f)) printf("unknown enable2 value %02x\n", enable2);
311   if ((enable3 != 0x00) && (enable3 != 0x0d) && (enable3 != 0x1f)) printf("unknown enable3 value %02x\n", enable3);
312
313   m_bg_tilemap[2]->set_scrollx(0, vreg[0x07]);
314   m_bg_tilemap[2]->set_scrolly(0, vreg[0x08]);
315
316   m_bg_tilemap[3]->set_scrollx(0, vreg[0x09]);
317   m_bg_tilemap[3]->set_scrolly(0, vreg[0x0a]);
318
319
320   if (enable3) m_bg_tilemap[3]->draw(bitmap, cliprect, 0, 0);
321   if (enable2) m_bg_tilemap[2]->draw(bitmap, cliprect, 0, 0);
322   if (enable1) m_bg_tilemap[1]->draw(bitmap, cliprect, 0, 0);
323   if (enable0) m_bg_tilemap[0]->draw(bitmap, cliprect, 0, 0);
329324   draw_sprites(bitmap,cliprect);
330325
331326   return 0;

Previous 199869 Revisions Next


© 1997-2024 The MAME Team