Skip to content

Commit b2e592e

Browse files
committed
jaleco/bestleag.cpp: cleanups
1 parent 347d50a commit b2e592e

File tree

1 file changed

+56
-71
lines changed

1 file changed

+56
-71
lines changed

src/mame/jaleco/bestleag.cpp

Lines changed: 56 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,17 @@
11
// license:BSD-3-Clause
2-
// copyright-holders:Angelo Salese, David Haywood
3-
/*******************************************************************************************
2+
// copyright-holders:Angelo Salese, David Haywood, Pierpaolo Prazzoli
3+
/**************************************************************************************************
44
55
Best League (c) 1993
66
77
A Big Striker Italian bootleg (made by Playmark?) running on a different hardware.
88
9-
driver by David Haywood & Angelo Salese
10-
11-
Changes 29/03/2005 - Pierpaolo Prazzoli
12-
- Fixed tilemaps and sprites offset
13-
- Fixed visible area
14-
- Fixed dip-switches
15-
- Added oki banking
16-
- Added sprites wraparound
17-
- Added sprites color masking
18-
19-
Dip Locations added according to Service Mode
20-
21-
*******************************************************************************************/
9+
**************************************************************************************************/
2210

2311
#include "emu.h"
2412
#include "cpu/m68000/m68000.h"
2513
#include "sound/okim6295.h"
14+
2615
#include "emupal.h"
2716
#include "screen.h"
2817
#include "speaker.h"
@@ -34,19 +23,31 @@ namespace {
3423
class bestleag_state : public driver_device
3524
{
3625
public:
37-
bestleag_state(const machine_config &mconfig, device_type type, const char *tag) :
38-
driver_device(mconfig, type, tag),
39-
m_maincpu(*this, "maincpu"),
40-
m_oki(*this, "oki"),
41-
m_gfxdecode(*this, "gfxdecode"),
42-
m_palette(*this, "palette"),
43-
m_bgram(*this, "bgram"),
44-
m_fgram(*this, "fgram"),
45-
m_txram(*this, "txram"),
46-
m_vregs(*this, "vregs"),
47-
m_spriteram(*this, "spriteram")
26+
bestleag_state(const machine_config &mconfig, device_type type, const char *tag)
27+
: driver_device(mconfig, type, tag)
28+
, m_vregs(*this, "vregs")
29+
, m_maincpu(*this, "maincpu")
30+
, m_oki(*this, "oki")
31+
, m_gfxdecode(*this, "gfxdecode")
32+
, m_palette(*this, "palette")
33+
, m_bgram(*this, "bgram")
34+
, m_fgram(*this, "fgram")
35+
, m_txram(*this, "txram")
36+
, m_spriteram(*this, "spriteram")
4837
{ }
4938

39+
void bestleag(machine_config &config);
40+
41+
protected:
42+
tilemap_t *m_tx_tilemap = nullptr;
43+
tilemap_t *m_bg_tilemap = nullptr;
44+
tilemap_t *m_fg_tilemap = nullptr;
45+
void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect);
46+
47+
virtual uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
48+
required_shared_ptr<uint16_t> m_vregs;
49+
50+
private:
5051
required_device<cpu_device> m_maincpu;
5152
required_device<okim6295_device> m_oki;
5253
required_device<gfxdecode_device> m_gfxdecode;
@@ -55,12 +56,8 @@ class bestleag_state : public driver_device
5556
required_shared_ptr<uint16_t> m_bgram;
5657
required_shared_ptr<uint16_t> m_fgram;
5758
required_shared_ptr<uint16_t> m_txram;
58-
required_shared_ptr<uint16_t> m_vregs;
5959
required_shared_ptr<uint16_t> m_spriteram;
6060

61-
tilemap_t *m_tx_tilemap = nullptr;
62-
tilemap_t *m_bg_tilemap = nullptr;
63-
tilemap_t *m_fg_tilemap = nullptr;
6461

6562
void txram_w(offs_t offset, uint16_t data);
6663
void bgram_w(offs_t offset, uint16_t data);
@@ -70,20 +67,23 @@ class bestleag_state : public driver_device
7067
TILE_GET_INFO_MEMBER(get_tx_tile_info);
7168
TILE_GET_INFO_MEMBER(get_bg_tile_info);
7269
TILE_GET_INFO_MEMBER(get_fg_tile_info);
73-
TILEMAP_MAPPER_MEMBER(bsb_bg_scan);
70+
TILEMAP_MAPPER_MEMBER(bg_scan);
7471

7572
virtual void video_start() override ATTR_COLD;
7673

77-
uint32_t screen_update_bestleag(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
78-
uint32_t screen_update_bestleaw(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
79-
void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect);
80-
void bestleag(machine_config &config);
81-
void bestleaw(machine_config &config);
82-
void bestleag_map(address_map &map) ATTR_COLD;
74+
void main_map(address_map &map) ATTR_COLD;
8375
};
8476

77+
class bestleaw_state : public bestleag_state
78+
{
79+
public:
80+
bestleaw_state(const machine_config &mconfig, device_type type, const char *tag)
81+
: bestleag_state(mconfig, type, tag)
82+
{ }
8583

86-
/* Video Handling */
84+
protected:
85+
virtual uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) override ATTR_COLD;
86+
};
8787

8888

8989
TILE_GET_INFO_MEMBER(bestleag_state::get_tx_tile_info)
@@ -116,7 +116,7 @@ TILE_GET_INFO_MEMBER(bestleag_state::get_fg_tile_info)
116116
0);
117117
}
118118

119-
TILEMAP_MAPPER_MEMBER(bestleag_state::bsb_bg_scan)
119+
TILEMAP_MAPPER_MEMBER(bestleag_state::bg_scan)
120120
{
121121
int offset;
122122

@@ -130,22 +130,19 @@ TILEMAP_MAPPER_MEMBER(bestleag_state::bsb_bg_scan)
130130
void bestleag_state::video_start()
131131
{
132132
m_tx_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(bestleag_state::get_tx_tile_info)), TILEMAP_SCAN_COLS, 8, 8, 256, 32);
133-
m_bg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(bestleag_state::get_bg_tile_info)), tilemap_mapper_delegate(*this, FUNC(bestleag_state::bsb_bg_scan)), 16, 16, 128, 64);
134-
m_fg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(bestleag_state::get_fg_tile_info)), tilemap_mapper_delegate(*this, FUNC(bestleag_state::bsb_bg_scan)), 16, 16, 128, 64);
133+
m_bg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(bestleag_state::get_bg_tile_info)), tilemap_mapper_delegate(*this, FUNC(bestleag_state::bg_scan)), 16, 16, 128, 64);
134+
m_fg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(bestleag_state::get_fg_tile_info)), tilemap_mapper_delegate(*this, FUNC(bestleag_state::bg_scan)), 16, 16, 128, 64);
135135

136136
m_tx_tilemap->set_transparent_pen(15);
137137
m_fg_tilemap->set_transparent_pen(15);
138138
}
139139

140+
/*
141+
* Sprites are the same to sslam, but using 16x16 sprites instead of 8x8,
142+
* moved start address to 0x16/2?
143+
*/
140144
void bestleag_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect)
141145
{
142-
/*
143-
Sprites are the same to sslam, but using 16x16 sprites instead of 8x8
144-
145-
Note: sprite chip is different than the other Big Striker sets and they
146-
include several similiarities with other Playmark games (including
147-
the sprite end code and the data being offset (i.e. spriteram starting from 0x16/2))
148-
*/
149146
for (int offs = 0x16/2; offs < m_spriteram.length() - 3; offs += 4)
150147
{
151148
int code = m_spriteram[offs+3] & 0xfff;
@@ -189,7 +186,7 @@ void bestleag_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprec
189186
}
190187
}
191188

192-
uint32_t bestleag_state::screen_update_bestleag(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
189+
uint32_t bestleag_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
193190
{
194191
m_bg_tilemap->set_scrollx(0,(m_vregs[0x00/2] & 0xfff) + (m_vregs[0x08/2] & 0x7) - 3);
195192
m_bg_tilemap->set_scrolly(0,m_vregs[0x02/2]);
@@ -205,7 +202,7 @@ uint32_t bestleag_state::screen_update_bestleag(screen_device &screen, bitmap_in
205202
return 0;
206203
}
207204

208-
uint32_t bestleag_state::screen_update_bestleaw(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
205+
uint32_t bestleaw_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
209206
{
210207
m_bg_tilemap->set_scrollx(0,m_vregs[0x08/2]);
211208
m_bg_tilemap->set_scrolly(0,m_vregs[0x0a/2]);
@@ -245,9 +242,8 @@ void bestleag_state::oki_bank_w(uint16_t data)
245242
}
246243

247244

248-
/* Memory Map */
249245

250-
void bestleag_state::bestleag_map(address_map &map)
246+
void bestleag_state::main_map(address_map &map)
251247
{
252248
map(0x000000, 0x03ffff).rom();
253249
map(0x0d2000, 0x0d3fff).noprw(); // left over from the original game (only read / written in memory test)
@@ -346,15 +342,15 @@ static INPUT_PORTS_START( bestleag )
346342
PORT_SERVICE_DIPLOC( 0x80, IP_ACTIVE_LOW, "SW.B:8")
347343
INPUT_PORTS_END
348344

349-
/* GFX Decode */
345+
350346
static const gfx_layout bestleag_charlayout =
351347
{
352348
8,8,
353349
RGN_FRAC(1,4),
354350
4,
355351
{ RGN_FRAC(3,4), RGN_FRAC(2,4), RGN_FRAC(1,4), RGN_FRAC(0,4) },
356-
{ 0, 1, 2, 3, 4, 5, 6, 7 },
357-
{ 0*8, 2*8, 4*8, 6*8,1*8,3*8,5*8,7*8},
352+
{ STEP8(0, 1) },
353+
{ 0*8, 2*8, 4*8, 6*8, 1*8, 3*8, 5*8, 7*8},
358354
8*8
359355
};
360356

@@ -364,9 +360,8 @@ static const gfx_layout bestleag_char16layout =
364360
RGN_FRAC(1,4),
365361
4,
366362
{ RGN_FRAC(3,4), RGN_FRAC(2,4), RGN_FRAC(1,4), RGN_FRAC(0,4) },
367-
{ 0,1,2, 3, 4, 5, 6, 7,
368-
128+0,128+1,128+2,128+3,128+4,128+5,128+6,128+7 },
369-
{ 0*8,1*8,2*8,3*8,4*8,5*8,6*8,7*8,8*8,9*8,10*8,11*8,12*8,13*8,14*8,15*8 },
363+
{ STEP8(0, 1), STEP8(128, 1) },
364+
{ STEP16(0, 8) },
370365
16*16
371366
};
372367

@@ -379,15 +374,15 @@ GFXDECODE_END
379374
void bestleag_state::bestleag(machine_config &config)
380375
{
381376
M68000(config, m_maincpu, 12000000);
382-
m_maincpu->set_addrmap(AS_PROGRAM, &bestleag_state::bestleag_map);
377+
m_maincpu->set_addrmap(AS_PROGRAM, &bestleag_state::main_map);
383378
m_maincpu->set_vblank_int("screen", FUNC(bestleag_state::irq6_line_hold));
384379

385380
screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER));
386381
screen.set_refresh_hz(60);
387382
screen.set_vblank_time(ATTOSECONDS_IN_USEC(0));
388383
screen.set_size(32*8, 32*8);
389384
screen.set_visarea(0*8, 32*8-1, 2*8, 30*8-1);
390-
screen.set_screen_update(FUNC(bestleag_state::screen_update_bestleag));
385+
screen.set_screen_update(FUNC(bestleag_state::screen_update));
391386
screen.set_palette(m_palette);
392387

393388
GFXDECODE(config, m_gfxdecode, m_palette, gfx_bestleag);
@@ -401,14 +396,6 @@ void bestleag_state::bestleag(machine_config &config)
401396
m_oki->add_route(ALL_OUTPUTS, "rspeaker", 1.00);
402397
}
403398

404-
void bestleag_state::bestleaw(machine_config &config)
405-
{
406-
bestleag(config);
407-
subdevice<screen_device>("screen")->set_screen_update(FUNC(bestleag_state::screen_update_bestleaw));
408-
}
409-
410-
411-
/* Rom Loading */
412399

413400
ROM_START( bestleag )
414401
ROM_REGION( 0x40000, "maincpu", 0 ) /* 68000 Code */
@@ -478,7 +465,5 @@ ROM_END
478465
} // anonymous namespace
479466

480467

481-
/* GAME drivers */
482-
483468
GAME( 1993, bestleag, bigstrik, bestleag, bestleag, bestleag_state, empty_init, ROT0, "bootleg", "Best League (bootleg of Big Striker, Italian Serie A)", MACHINE_NO_COCKTAIL | MACHINE_SUPPORTS_SAVE )
484-
GAME( 1993, bestleaw, bigstrik, bestleaw, bestleag, bestleag_state, empty_init, ROT0, "bootleg", "Best League (bootleg of Big Striker, World Cup)", MACHINE_NO_COCKTAIL | MACHINE_SUPPORTS_SAVE )
469+
GAME( 1993, bestleaw, bigstrik, bestleag, bestleag, bestleaw_state, empty_init, ROT0, "bootleg", "Best League (bootleg of Big Striker, World Cup)", MACHINE_NO_COCKTAIL | MACHINE_SUPPORTS_SAVE )

0 commit comments

Comments
 (0)