stadhero: Make stage music selection and various other things more random

This commit is contained in:
AJR 2019-10-06 21:09:40 -04:00
parent 545f8069ef
commit 880f2b7ae1
2 changed files with 15 additions and 7 deletions

View File

@ -32,7 +32,6 @@ TODO : RNG issue? Some behavior isn't correct (ex: BGM randomizer).
#include "sound/3812intf.h"
#include "sound/okim6295.h"
#include "emupal.h"
#include "screen.h"
#include "speaker.h"
@ -43,6 +42,13 @@ WRITE16_MEMBER(stadhero_state::int_ack_w)
m_maincpu->set_input_line(M68K_IRQ_5, CLEAR_LINE);
}
uint8_t stadhero_state::mystery_r()
{
// Polled, very frequently at times, to randomly determine stage music
// selection, attract mode teams, base-stealing attempts, etc. etc.
return m_screen->hpos() / 2;
}
/******************************************************************************/
@ -54,7 +60,8 @@ void stadhero_state::main_map(address_map &map)
map(0x240010, 0x240017).w(m_tilegen, FUNC(deco_bac06_device::pf_control_1_w));
map(0x260000, 0x261fff).rw(m_tilegen, FUNC(deco_bac06_device::pf_data_r), FUNC(deco_bac06_device::pf_data_w));
map(0x30c000, 0x30c001).portr("INPUTS");
map(0x30c002, 0x30c003).lr8("30c002", [this]() { return uint8_t(m_coin->read()); });
map(0x30c002, 0x30c002).lr8("30c002", [this]() { return uint8_t(m_coin->read()); });
map(0x30c003, 0x30c003).r(FUNC(stadhero_state::mystery_r));
map(0x30c004, 0x30c005).portr("DSW").w(FUNC(stadhero_state::int_ack_w));
map(0x30c007, 0x30c007).w(m_soundlatch, FUNC(generic_latch_8_device::write));
map(0x310000, 0x3107ff).ram().w("palette", FUNC(palette_device::write16)).share("palette");
@ -132,11 +139,8 @@ static INPUT_PORTS_START( stadhero )
PORT_DIPUNUSED( 0x4000, IP_ACTIVE_LOW )
PORT_DIPUNUSED( 0x8000, IP_ACTIVE_LOW )
PORT_START("COIN") /* 0x30c002 & 0x30c003 */
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN ) /* related to music/sound */
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN ) /* related to music/sound */
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN ) /* related to music/sound */
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN ) /* related to music/sound */
PORT_START("COIN") /* 0x30c002 */
PORT_BIT( 0x0f, IP_ACTIVE_LOW, IPT_UNUSED )
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_COIN1 )
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_COIN2 )
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_SERVICE1 )

View File

@ -4,6 +4,7 @@
#include "machine/gen_latch.h"
#include "video/decbac06.h"
#include "video/decmxc06.h"
#include "screen.h"
#include "tilemap.h"
class stadhero_state : public driver_device
@ -17,6 +18,7 @@ public:
m_spritegen(*this, "spritegen"),
m_gfxdecode(*this, "gfxdecode"),
m_soundlatch(*this, "soundlatch"),
m_screen(*this, "screen"),
m_spriteram(*this, "spriteram"),
m_pf1_data(*this, "pf1_data"),
m_coin(*this, "COIN")
@ -32,6 +34,7 @@ private:
required_device<deco_mxc06_device> m_spritegen;
required_device<gfxdecode_device> m_gfxdecode;
required_device<generic_latch_8_device> m_soundlatch;
required_device<screen_device> m_screen;
required_shared_ptr<uint16_t> m_spriteram;
required_shared_ptr<uint16_t> m_pf1_data;
@ -42,6 +45,7 @@ private:
DECLARE_WRITE16_MEMBER(int_ack_w);
DECLARE_WRITE16_MEMBER(pf1_data_w);
uint8_t mystery_r();
virtual void video_start() override;