cinemat.cpp: Add internal layout for Speed Freak. Clean up gearing logic. (#7010)

This commit is contained in:
Aaron Giles 2020-07-27 20:59:51 -07:00 committed by GitHub
parent ff5144809c
commit c1804a45ec
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 185 additions and 63 deletions

View File

@ -37,6 +37,7 @@
#include "demon.lh"
#include "starcas.lh"
#include "solarq.lh"
#include "speedfrk.lh"
#include "sundance.lh"
#include "tailg.lh"
#include "warrior.lh"
@ -82,15 +83,15 @@ void cinemat_state::machine_reset()
*
*************************************/
uint8_t cinemat_state::inputs_r(offs_t offset)
u8 cinemat_state::inputs_r(offs_t offset)
{
return (m_inputs->read() >> offset) & 1;
}
uint8_t cinemat_state::switches_r(offs_t offset)
u8 cinemat_state::switches_r(offs_t offset)
{
static const uint8_t switch_shuffle[8] = { 2,5,4,3,0,1,6,7 };
static const u8 switch_shuffle[8] = { 2,5,4,3,0,1,6,7 };
return (m_switches->read() >> switch_shuffle[offset]) & 1;
}
@ -110,7 +111,7 @@ INPUT_CHANGED_MEMBER(cinemat_state::coin_inserted)
}
uint8_t cinemat_state::coin_input_r()
u8 cinemat_state::coin_input_r()
{
return !m_coin_detected;
}
@ -144,13 +145,13 @@ WRITE_LINE_MEMBER(cinemat_state::mux_select_w)
*
*************************************/
uint8_t cinemat_state::joystick_read()
u8 cinemat_state::joystick_read()
{
if (machine().phase() != machine_phase::RUNNING)
return 0;
else
{
int const xval = int16_t(m_maincpu->state_int(ccpu_cpu_device::CCPU_X) << 4) >> 4;
int const xval = s16(m_maincpu->state_int(ccpu_cpu_device::CCPU_X) << 4) >> 4;
return ((m_mux_select ? m_analog_x : m_analog_y).read_safe(0) - xval) < 0x800;
}
}
@ -163,13 +164,13 @@ uint8_t cinemat_state::joystick_read()
*
*************************************/
uint8_t cinemat_state::speedfrk_wheel_r(offs_t offset)
u8 cinemat_state::speedfrk_wheel_r(offs_t offset)
{
static const uint8_t speedfrk_steer[] = {0xe, 0x6, 0x2, 0x0, 0x3, 0x7, 0xf};
static const u8 speedfrk_steer[] = {0xe, 0x6, 0x2, 0x0, 0x3, 0x7, 0xf};
int delta_wheel;
/* the shift register is cleared once per 'frame' */
delta_wheel = int8_t(m_wheel->read()) / 8;
delta_wheel = s8(m_wheel->read()) / 8;
if (delta_wheel > 3)
delta_wheel = 3;
else if (delta_wheel < -3)
@ -179,23 +180,14 @@ uint8_t cinemat_state::speedfrk_wheel_r(offs_t offset)
}
uint8_t cinemat_state::speedfrk_gear_r(offs_t offset)
u8 cinemat_state::speedfrk_gear_r(offs_t offset)
{
int gearval = m_gear_input->read();
/* check the fake gear input port and determine the bit settings for the gear */
if ((gearval & 0x0f) != 0x0f)
m_gear = gearval & 0x0f;
/* add the start key into the mix -- note that it overlaps 4th gear */
if (!(m_inputs->read() & 0x80))
m_gear &= ~0x08;
return (m_gear >> offset) & 1;
return (m_gear != offset);
}
/*************************************
*
* Sundance inputs
@ -205,7 +197,7 @@ uint8_t cinemat_state::speedfrk_gear_r(offs_t offset)
static const struct
{
const char *portname;
uint16_t bitmask;
u16 bitmask;
} sundance_port_map[16] =
{
{ "PAD1", 0x155 }, /* bit 0 is set if P1 1,3,5,7,9 is pressed */
@ -230,7 +222,7 @@ static const struct
};
uint8_t cinemat_16level_state::sundance_inputs_r(offs_t offset)
u8 cinemat_16level_state::sundance_inputs_r(offs_t offset)
{
/* handle special keys first */
if (sundance_port_map[offset].portname)
@ -247,7 +239,7 @@ uint8_t cinemat_16level_state::sundance_inputs_r(offs_t offset)
*
*************************************/
uint8_t cinemat_color_state::boxingb_dial_r(offs_t offset)
u8 cinemat_color_state::boxingb_dial_r(offs_t offset)
{
int value = ioport("DIAL")->read();
if (!m_mux_select) offset += 4;
@ -262,7 +254,7 @@ uint8_t cinemat_color_state::boxingb_dial_r(offs_t offset)
*
*************************************/
uint8_t qb3_state::qb3_frame_r()
u8 qb3_state::qb3_frame_r()
{
attotime next_update = m_screen->time_until_update();
attotime frame_period = m_screen->frame_period();
@ -273,7 +265,7 @@ uint8_t qb3_state::qb3_frame_r()
}
void qb3_state::qb3_ram_bank_w(uint8_t data)
void qb3_state::qb3_ram_bank_w(u8 data)
{
membank("bank1")->set_entry(m_maincpu->state_int(ccpu_cpu_device::CCPU_P) & 3);
}
@ -480,10 +472,13 @@ static INPUT_PORTS_START( speedfrk )
PORT_BIT( 0xff, 0x00, IPT_DIAL ) PORT_SENSITIVITY(100) PORT_KEYDELTA(10) PORT_RESET
PORT_START("GEAR")
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_NAME("1st gear") PORT_PLAYER(2)
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_NAME("2nd gear") PORT_PLAYER(2)
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_NAME("3rd gear") PORT_PLAYER(2)
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_NAME("4th gear") PORT_PLAYER(2)
PORT_BIT (0x03, IP_ACTIVE_HIGH, IPT_CUSTOM ) PORT_CUSTOM_MEMBER(cinemat_state, speedfrk_gear_number_r)
PORT_START("GEARRAW")
PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_NAME("1st gear") PORT_PLAYER(2) PORT_WRITE_LINE_MEMBER(cinemat_state, speedfrk_gear_change_w<0>)
PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_NAME("2nd gear") PORT_PLAYER(2) PORT_WRITE_LINE_MEMBER(cinemat_state, speedfrk_gear_change_w<1>)
PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_NAME("3rd gear") PORT_PLAYER(2) PORT_WRITE_LINE_MEMBER(cinemat_state, speedfrk_gear_change_w<2>)
PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_NAME("4th gear") PORT_PLAYER(2) PORT_WRITE_LINE_MEMBER(cinemat_state, speedfrk_gear_change_w<3>)
INPUT_PORTS_END
@ -1504,7 +1499,6 @@ ROM_END
void cinemat_state::init_speedfrk()
{
m_gear = 0xe;
m_maincpu->space(AS_IO).install_read_handler(0x00, 0x03, read8sm_delegate(*this, FUNC(cinemat_state::speedfrk_wheel_r)));
m_maincpu->space(AS_IO).install_read_handler(0x04, 0x06, read8sm_delegate(*this, FUNC(cinemat_state::speedfrk_gear_r)));
save_item(NAME(m_gear));
@ -1542,7 +1536,7 @@ void qb3_state::init_qb3()
GAME( 1977, spacewar, 0, spacewar, spacewar, cinemat_state, empty_init, ORIENTATION_FLIP_Y, "Cinematronics", "Space Wars", MACHINE_SUPPORTS_SAVE )
GAME( 1978, spaceshp, spacewar, spacewar, spaceshp, cinemat_state, empty_init, ORIENTATION_FLIP_Y, "Cinematronics (Sega license)", "Space Ship", MACHINE_SUPPORTS_SAVE )
GAMEL( 1979, barrier, 0, barrier, barrier, cinemat_state, empty_init, ORIENTATION_FLIP_X ^ ROT270, "Cinematronics (Vectorbeam license)", "Barrier", MACHINE_SUPPORTS_SAVE, layout_barrier ) // developed by Cinematronics, then (when they noticed it wasn't going to be a successful game) sold to Vectorbeam, and ultimately back in the hands of Cinematronics again after they bought the dying company Vectorbeam
GAME( 1979, speedfrk, 0, speedfrk, speedfrk, cinemat_state, init_speedfrk, ORIENTATION_FLIP_Y, "Vectorbeam", "Speed Freak", MACHINE_SUPPORTS_SAVE )
GAMEL( 1979, speedfrk, 0, speedfrk, speedfrk, cinemat_state, init_speedfrk, ORIENTATION_FLIP_Y, "Vectorbeam", "Speed Freak", MACHINE_SUPPORTS_SAVE, layout_speedfrk )
GAME( 1979, starhawk, 0, starhawk, starhawk, cinemat_state, empty_init, ORIENTATION_FLIP_Y, "Cinematronics", "Star Hawk", MACHINE_SUPPORTS_SAVE )
GAMEL( 1979, sundance, 0, sundance, sundance, cinemat_16level_state, init_sundance, ORIENTATION_FLIP_X ^ ROT270, "Cinematronics", "Sundance", MACHINE_SUPPORTS_SAVE, layout_sundance )
GAMEL( 1979, tailg, 0, tailg, tailg, cinemat_state, empty_init, ORIENTATION_FLIP_Y, "Cinematronics", "Tailgunner", MACHINE_SUPPORTS_SAVE, layout_tailg )

View File

@ -31,12 +31,18 @@ public:
, m_rambase(*this, "rambase")
, m_inputs(*this, "INPUTS")
, m_switches(*this, "SWITCHES")
, m_gear_input(*this, "GEAR")
, m_wheel(*this, "WHEEL")
, m_analog_x(*this, "ANALOGX")
, m_analog_y(*this, "ANALOGY")
, m_led(*this, "led")
, m_pressed(*this, "pressed%u", 0U)
, m_coin_detected(0)
, m_coin_last_reset(0)
, m_mux_select(0)
, m_gear(0)
, m_vector_color(255, 255, 255)
, m_lastx(0)
, m_lasty(0)
{ }
required_device<ccpu_cpu_device> m_maincpu;
@ -44,11 +50,10 @@ public:
required_device<ls259_device> m_outlatch;
required_device<vector_device> m_vector;
required_device<screen_device> m_screen;
optional_shared_ptr<uint16_t> m_rambase;
optional_shared_ptr<s16> m_rambase;
required_ioport m_inputs;
required_ioport m_switches;
optional_ioport m_gear_input;
optional_ioport m_wheel;
optional_ioport m_analog_x;
optional_ioport m_analog_y;
@ -56,27 +61,27 @@ public:
output_finder<> m_led;
output_finder<10> m_pressed;
uint8_t m_coin_detected;
uint8_t m_coin_last_reset;
uint8_t m_mux_select;
int m_gear;
u8 m_coin_detected;
u8 m_coin_last_reset;
u8 m_mux_select;
u8 m_gear;
rgb_t m_vector_color;
int16_t m_lastx;
int16_t m_lasty;
uint8_t inputs_r(offs_t offset);
uint8_t switches_r(offs_t offset);
uint8_t coin_input_r();
s16 m_lastx;
s16 m_lasty;
u8 inputs_r(offs_t offset);
u8 switches_r(offs_t offset);
u8 coin_input_r();
WRITE_LINE_MEMBER(coin_reset_w);
WRITE_LINE_MEMBER(mux_select_w);
uint8_t speedfrk_wheel_r(offs_t offset);
uint8_t speedfrk_gear_r(offs_t offset);
u8 speedfrk_wheel_r(offs_t offset);
u8 speedfrk_gear_r(offs_t offset);
virtual DECLARE_WRITE_LINE_MEMBER(vector_control_w);
uint8_t joystick_read();
u8 joystick_read();
DECLARE_INPUT_CHANGED_MEMBER(coin_inserted);
void init_speedfrk();
uint32_t screen_update_cinemat(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
uint32_t screen_update_spacewar(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
void cinemat_vector_callback(int16_t sx, int16_t sy, int16_t ex, int16_t ey, uint8_t shift);
u32 screen_update_cinemat(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
u32 screen_update_spacewar(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
void cinemat_vector_callback(s16 sx, s16 sy, s16 ex, s16 ey, u8 shift);
void ripoff(machine_config &config);
void wotw(machine_config &config);
void speedfrk(machine_config &config);
@ -88,6 +93,18 @@ public:
void barrier(machine_config &config);
void armora(machine_config &config);
template<int _N>
DECLARE_WRITE_LINE_MEMBER(speedfrk_gear_change_w)
{
if (state)
m_gear = _N;
}
ioport_value speedfrk_gear_number_r()
{
return m_gear;
}
protected:
virtual void machine_start() override;
virtual void machine_reset() override;
@ -121,7 +138,7 @@ public:
protected:
virtual DECLARE_WRITE_LINE_MEMBER(vector_control_w) override;
uint8_t sundance_inputs_r(offs_t offset);
u8 sundance_inputs_r(offs_t offset);
};
@ -151,7 +168,7 @@ public:
protected:
virtual DECLARE_WRITE_LINE_MEMBER(vector_control_w) override;
uint8_t boxingb_dial_r(offs_t offset);
u8 boxingb_dial_r(offs_t offset);
};
@ -165,10 +182,10 @@ public:
protected:
TIMER_CALLBACK_MEMBER(synced_sound_w);
DECLARE_WRITE_LINE_MEMBER(demon_sound4_w);
uint8_t sound_porta_r();
uint8_t sound_portb_r();
void sound_portb_w(uint8_t data);
void sound_output_w(uint8_t data);
u8 sound_porta_r();
u8 sound_portb_r();
void sound_portb_w(u8 data);
void sound_output_w(u8 data);
virtual void sound_start() override;
virtual void sound_reset() override;
@ -179,10 +196,10 @@ protected:
void demon_sound_ports(address_map &map);
private:
uint8_t m_sound_fifo[16];
uint8_t m_sound_fifo_in;
uint8_t m_sound_fifo_out;
uint8_t m_last_portb_write;
u8 m_sound_fifo[16];
u8 m_sound_fifo_in;
u8 m_sound_fifo_out;
u8 m_last_portb_write;
};
@ -197,9 +214,9 @@ public:
protected:
virtual DECLARE_WRITE_LINE_MEMBER(vector_control_w) override;
uint8_t qb3_frame_r();
void qb3_ram_bank_w(uint8_t data);
void qb3_sound_fifo_w(uint8_t data);
u8 qb3_frame_r();
void qb3_ram_bank_w(u8 data);
void qb3_sound_fifo_w(u8 data);
virtual void sound_reset() override;

View File

@ -0,0 +1,111 @@
<?xml version="1.0"?>
<!--
license:CC0
-->
<mamelayout version="2">
<element name="shifter" defstate="0">
<rect>
<bounds left="0" right="64" top="0" bottom="64" />
<color red="0.85" green="0.4" blue="0.3" />
</rect>
<rect>
<bounds left="2" right="62" top="2" bottom="62" />
<color red="0.14" green="0.17" blue="0.2" />
</rect>
<rect>
<bounds left="14" right="18" top="15" bottom="49" />
<color red="0.44" green="0.47" blue="0.5" />
</rect>
<rect>
<bounds left="46" right="50" top="15" bottom="49" />
<color red="0.44" green="0.47" blue="0.5" />
</rect>
<rect>
<bounds left="14" right="50" top="30" bottom="34" />
<color red="0.44" green="0.47" blue="0.5" />
</rect>
<disk>
<bounds left="14" right="18" top="13" bottom="17" />
<color red="0.44" green="0.47" blue="0.5" />
</disk>
<disk>
<bounds left="46" right="50" top="13" bottom="17" />
<color red="0.44" green="0.47" blue="0.5" />
</disk>
<disk>
<bounds left="14" right="18" top="47" bottom="51" />
<color red="0.44" green="0.47" blue="0.5" />
</disk>
<disk>
<bounds left="46" right="50" top="47" bottom="51" />
<color red="0.44" green="0.47" blue="0.5" />
</disk>
<text string="1">
<bounds left="3" right="29" top="2" bottom="12" />
<color red="1.0" green="1.0" blue="1.0" />
</text>
<text string="2">
<bounds left="3" right="29" top="52" bottom="62" />
<color red="1.0" green="1.0" blue="1.0" />
</text>
<text string="3">
<bounds left="34" right="61" top="2" bottom="12" />
<color red="1.0" green="1.0" blue="1.0" />
</text>
<text string="4">
<bounds left="34" right="61" top="52" bottom="62" />
<color red="1.0" green="1.0" blue="1.0" />
</text>
<text string="1" state="0">
<bounds left="3" right="29" top="2" bottom="12" />
<color red="1.0" green="1.0" blue="0.4" />
</text>
<text string="2" state="1">
<bounds left="3" right="29" top="52" bottom="62" />
<color red="1.0" green="1.0" blue="0.4" />
</text>
<text string="3" state="2">
<bounds left="34" right="61" top="2" bottom="12" />
<color red="1.0" green="1.0" blue="0.4" />
</text>
<text string="4" state="3">
<bounds left="34" right="61" top="52" bottom="62" />
<color red="1.0" green="1.0" blue="0.4" />
</text>
<disk state="0">
<bounds left="9" right="23" top="14" bottom="28" />
<color red="0.85" green="0.4" blue="0.3" />
</disk>
<disk state="1">
<bounds left="9" right="23" top="36" bottom="50" />
<color red="0.85" green="0.4" blue="0.3" />
</disk>
<disk state="2">
<bounds left="41" right="55" top="14" bottom="28" />
<color red="0.85" green="0.4" blue="0.3" />
</disk>
<disk state="3">
<bounds left="41" right="55" top="36" bottom="50" />
<color red="0.85" green="0.4" blue="0.3" />
</disk>
</element>
<view name="Shifter-R">
<screen index="0">
<bounds x="0" y="0" width="640" height="480" />
</screen>
<element ref="shifter" inputtag="GEAR" inputmask="0x0f" inputraw="1">
<bounds x="574" y="414" width="64" height="64" />
<color alpha="0.6" />
</element>
</view>
<view name="Shifter-L">
<screen index="0">
<bounds x="0" y="0" width="640" height="480" />
</screen>
<element ref="shifter" inputtag="GEAR" inputmask="0x0f" inputraw="1">
<bounds x="2" y="414" width="64" height="64" />
<color alpha="0.6" />
</element>
</view>
</mamelayout>