~ubuntu-branches/debian/sid/mame/sid

« back to all changes in this revision

Viewing changes to src/mame/audio/astrof.c

  • Committer: Bazaar Package Importer
  • Author(s): Jordi Mallach, Emmanuel Kasper, Félix Arreola Rodríguez, Jordi Mallach
  • Date: 2011-05-11 21:06:50 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20110511210650-jizvh8a6x117y9hr
Tags: 0.142-1
[ Emmanuel Kasper ]
* New upstream release
* Set NOWERROR=1 to allow compiling with gcc-4.6
* Remove fix_powerpc_build.patch, as upstream has taken it in this release
* Add gnome-video-arcade front end as a suggested package

[ Félix Arreola Rodríguez ]
* Add kfreebsd-build.patch to quilt series, to fix build on kfreebsd

[ Jordi Mallach ]
* Remove unneeded and bogus addition of --with-quilt to the dh invocation.
* Add Cesare Falco (long time Ubuntu maintainer) to Uploaders, and wrap
  them into multiple lines.

Show diffs side-by-side

added added

removed removed

Lines of Context:
34
34
 
35
35
WRITE8_HANDLER( astrof_audio_1_w )
36
36
{
37
 
        astrof_state *state = space->machine->driver_data<astrof_state>();
38
 
        UINT8 rising_bits = data & ~state->port_1_last;
39
 
 
40
 
        if (state->astrof_death_playing)
41
 
                state->astrof_death_playing = sample_playing(state->samples, CHANNEL_EXPLOSION);
42
 
 
43
 
        if (state->astrof_bosskill_playing)
44
 
                state->astrof_bosskill_playing = sample_playing(state->samples, CHANNEL_EXPLOSION);
 
37
        astrof_state *state = space->machine().driver_data<astrof_state>();
 
38
        UINT8 rising_bits = data & ~state->m_port_1_last;
 
39
 
 
40
        if (state->m_astrof_death_playing)
 
41
                state->m_astrof_death_playing = sample_playing(state->m_samples, CHANNEL_EXPLOSION);
 
42
 
 
43
        if (state->m_astrof_bosskill_playing)
 
44
                state->m_astrof_bosskill_playing = sample_playing(state->m_samples, CHANNEL_EXPLOSION);
45
45
 
46
46
        /* D2 - explosion */
47
47
        if (rising_bits & 0x04)
48
48
        {
49
49
                /* I *know* that the effect select port will be written shortly
50
50
           after this one, so this works */
51
 
                state->astrof_start_explosion = 1;
 
51
                state->m_astrof_start_explosion = 1;
52
52
        }
53
53
 
54
54
        /* D0,D1,D3 - background noise */
55
 
        if ((data & 0x08) && (~state->port_1_last & 0x08))
 
55
        if ((data & 0x08) && (~state->m_port_1_last & 0x08))
56
56
        {
57
57
                int sample = SAMPLE_WAVE + (data & 3);
58
 
                sample_start(state->samples, CHANNEL_WAVE, sample, 1);
 
58
                sample_start(state->m_samples, CHANNEL_WAVE, sample, 1);
59
59
        }
60
60
 
61
 
        if ((~data & 0x08) && (state->port_1_last & 0x08))
62
 
                sample_stop(state->samples, CHANNEL_WAVE);
 
61
        if ((~data & 0x08) && (state->m_port_1_last & 0x08))
 
62
                sample_stop(state->m_samples, CHANNEL_WAVE);
63
63
 
64
64
        /* D4 - boss laser */
65
 
        if ((rising_bits & 0x10) && !state->astrof_bosskill_playing)
66
 
                sample_start(state->samples, CHANNEL_BOSSFIRE, SAMPLE_BOSSFIRE, 0);
 
65
        if ((rising_bits & 0x10) && !state->m_astrof_bosskill_playing)
 
66
                sample_start(state->m_samples, CHANNEL_BOSSFIRE, SAMPLE_BOSSFIRE, 0);
67
67
 
68
68
        /* D5 - fire */
69
 
        if ((rising_bits & 0x20) && !state->astrof_bosskill_playing)
70
 
                sample_start(state->samples, CHANNEL_FIRE, SAMPLE_FIRE, 0);
 
69
        if ((rising_bits & 0x20) && !state->m_astrof_bosskill_playing)
 
70
                sample_start(state->m_samples, CHANNEL_FIRE, SAMPLE_FIRE, 0);
71
71
 
72
72
        /* D6 - don't know. Probably something to do with the explosion sounds */
73
73
 
74
74
        /* D7 - sound enable bit */
75
 
        sound_global_enable(space->machine, data & 0x80);
 
75
        space->machine().sound().system_enable(data & 0x80);
76
76
 
77
 
        state->port_1_last = data;
 
77
        state->m_port_1_last = data;
78
78
}
79
79
 
80
80
 
81
81
WRITE8_HANDLER( astrof_audio_2_w )
82
82
{
83
 
        astrof_state *state = space->machine->driver_data<astrof_state>();
84
 
        UINT8 rising_bits = data & ~state->port_2_last;
 
83
        astrof_state *state = space->machine().driver_data<astrof_state>();
 
84
        UINT8 rising_bits = data & ~state->m_port_2_last;
85
85
 
86
86
        /* D0-D2 - explosion select (triggered by D2 of the other port */
87
 
        if (state->astrof_start_explosion)
 
87
        if (state->m_astrof_start_explosion)
88
88
        {
89
89
                /* this is really a compound effect, made up of I believe 3 sound
90
90
           effects, but since our sample contains them all, disable playing
93
93
                logerror("Explosion: %x\n", data);
94
94
                if (data & 0x04)
95
95
                {
96
 
                        if (!state->astrof_bosskill_playing)
 
96
                        if (!state->m_astrof_bosskill_playing)
97
97
                        {
98
 
                                sample_start(state->samples, CHANNEL_EXPLOSION, SAMPLE_BOSSKILL, 0);
99
 
                                state->astrof_bosskill_playing = 1;
 
98
                                sample_start(state->m_samples, CHANNEL_EXPLOSION, SAMPLE_BOSSKILL, 0);
 
99
                                state->m_astrof_bosskill_playing = 1;
100
100
                        }
101
101
                }
102
102
                else if (data & 0x02)
103
 
                        sample_start(state->samples, CHANNEL_EXPLOSION, SAMPLE_BOSSHIT, 0);
 
103
                        sample_start(state->m_samples, CHANNEL_EXPLOSION, SAMPLE_BOSSHIT, 0);
104
104
                else if (data & 0x01)
105
 
                        sample_start(state->samples, CHANNEL_EXPLOSION, SAMPLE_EKILLED, 0);
 
105
                        sample_start(state->m_samples, CHANNEL_EXPLOSION, SAMPLE_EKILLED, 0);
106
106
                else
107
107
                {
108
 
                        if (!state->astrof_death_playing)
 
108
                        if (!state->m_astrof_death_playing)
109
109
                        {
110
 
                                sample_start(state->samples, CHANNEL_EXPLOSION, SAMPLE_DEATH, 0);
111
 
                                state->astrof_death_playing = 1;
 
110
                                sample_start(state->m_samples, CHANNEL_EXPLOSION, SAMPLE_DEATH, 0);
 
111
                                state->m_astrof_death_playing = 1;
112
112
                        }
113
113
                }
114
114
 
115
 
                state->astrof_start_explosion = 0;
 
115
                state->m_astrof_start_explosion = 0;
116
116
        }
117
117
 
118
118
        /* D3 - low fuel warning */
119
119
        if (rising_bits & 0x08)
120
 
                sample_start(state->samples, CHANNEL_FUEL, SAMPLE_FUEL, 0);
 
120
                sample_start(state->m_samples, CHANNEL_FUEL, SAMPLE_FUEL, 0);
121
121
 
122
 
        state->port_2_last = data;
 
122
        state->m_port_2_last = data;
123
123
}
124
124
 
125
125
 
184
184
 
185
185
WRITE8_HANDLER( tomahawk_audio_w )
186
186
{
187
 
        astrof_state *state = space->machine->driver_data<astrof_state>();
 
187
        astrof_state *state = space->machine().driver_data<astrof_state>();
188
188
 
189
189
        /* D0 - sonar */
190
190
 
197
197
        /* D4 - UFO */
198
198
 
199
199
        /* D5 - UFO under water */
200
 
        sn76477_enable_w(state->sn, (~data >> 5) & 0x01);
 
200
        sn76477_enable_w(state->m_sn, (~data >> 5) & 0x01);
201
201
 
202
202
        /* D6 - explosion */
203
203
 
204
204
        /* D7 - sound enable bit */
205
 
        sound_global_enable(space->machine, data & 0x80);
 
205
        space->machine().sound().system_enable(data & 0x80);
206
206
}
207
207
 
208
208