~ubuntu-branches/ubuntu/karmic/xmame/karmic

« back to all changes in this revision

Viewing changes to src/sndhrdw/dkong.c

  • Committer: Bazaar Package Importer
  • Author(s): Bruno Barrera C.
  • Date: 2007-02-16 10:06:54 UTC
  • mfrom: (2.1.5 edgy)
  • Revision ID: james.westby@ubuntu.com-20070216100654-iztas2cl47k5j039
Tags: 0.106-2
* Added Italian debconf templates translation. (closes: #382672)
* Added German debconf templates translation. (closes: #396610)
* Added Japanese debconf templates translation. (closes: #400011)
* Added Portuguese debconf templates translation. (closes: #409960)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
#include "driver.h"
2
2
#include "cpu/i8039/i8039.h"
3
 
 
4
 
static int walk = 0; /* used to determine if dkongjr is walking or climbing? */
 
3
#include "sound/samples.h"
 
4
 
 
5
static UINT8 sh1_state[8];
 
6
static UINT8 sh1_count = 0;
 
7
static UINT8 walk = 0; /* used to determine if dkongjr is walking or climbing? */
 
8
static UINT8 death = 0;
 
9
static UINT8 drop = 0;
 
10
static UINT8 roar = 0;
 
11
static UINT8 land = 0;
 
12
static UINT8 climb = 0;
 
13
static UINT8 sh_climb_count;
 
14
static UINT8 snapjaw = 0;
 
15
 
 
16
 
 
17
SOUND_START( dkong )
 
18
{
 
19
        state_save_register_global_array(sh1_state);
 
20
        state_save_register_global(sh1_count);
 
21
        state_save_register_global(walk);
 
22
        state_save_register_global(death);
 
23
        state_save_register_global(drop);
 
24
        state_save_register_global(roar);
 
25
        state_save_register_global(land);
 
26
        state_save_register_global(climb);
 
27
        state_save_register_global(sh_climb_count);
 
28
        state_save_register_global(snapjaw);
 
29
 
 
30
        memset(sh1_state, 0, sizeof(sh1_state));
 
31
        sh1_count = 0;
 
32
        walk = 0;
 
33
        death = 0;
 
34
        drop = 0;
 
35
        roar = 0;
 
36
        land = 0;
 
37
        climb = 0;
 
38
        sh_climb_count = 0;
 
39
        snapjaw = 0;
 
40
 
 
41
        return 0;
 
42
}
 
43
 
 
44
 
5
45
 
6
46
WRITE8_HANDLER( dkong_sh_w )
7
47
{
13
53
 
14
54
WRITE8_HANDLER( dkong_sh1_w )
15
55
{
16
 
        static int state[8];
 
56
        static const int sample_order[7] = {1,2,1,2,0,1,0};
17
57
 
18
 
        if (state[offset] != data)
 
58
        if (sh1_state[offset] != data)
19
59
        {
20
60
                if (data)
21
 
                        sample_start (offset, offset, 0);
22
 
                state[offset] = data;
 
61
                        {
 
62
                                if (offset)
 
63
                                        sample_start (offset, offset + 2, 0);
 
64
                                else
 
65
                                {
 
66
                                        sample_start (offset, sample_order[sh1_count], 0);
 
67
                                        sh1_count++;
 
68
                                        if (sh1_count == 7)
 
69
                                                sh1_count = 0;
 
70
                                }
 
71
                        }
 
72
                sh1_state[offset] = data;
23
73
        }
24
74
}
25
75
 
26
76
WRITE8_HANDLER( dkongjr_sh_death_w )
27
77
{
28
 
        static int death = 0;
29
 
 
30
78
        if (death != data)
31
79
        {
32
80
                if (data)
33
81
                        sample_stop (7);
34
 
                sample_start (6, 4, 0);
 
82
                sample_start (6, 6, 0);
35
83
                death = data;
36
84
        }
37
85
}
38
86
 
39
87
WRITE8_HANDLER( dkongjr_sh_drop_w )
40
88
{
41
 
        static int drop = 0;
42
 
 
43
89
        if (drop != data)
44
90
        {
45
91
                if (data)
46
 
                        sample_start (7, 5, 0);
 
92
                        sample_start (7, 7, 0);
47
93
                drop = data;
48
94
        }
49
95
}
50
96
 
51
97
WRITE8_HANDLER( dkongjr_sh_roar_w )
52
98
{
53
 
        static int roar = 0;
54
 
 
55
99
        if (roar != data)
56
100
        {
57
101
                if (data)
74
118
 
75
119
WRITE8_HANDLER( dkongjr_sh_land_w )
76
120
{
77
 
        static int land = 0;
78
 
 
79
121
        if (land != data)
80
122
        {
81
123
                if (data)
87
129
 
88
130
WRITE8_HANDLER( dkongjr_sh_climb_w )
89
131
{
90
 
        static int climb = 0;
 
132
        static const int sample_order[7] = {1,2,1,2,0,1,0};
91
133
 
92
134
        if (climb != data)
93
135
        {
94
136
                if (data && walk == 0)
95
137
                {
96
 
                        sample_start (3,3,0);
 
138
                        sample_start (3,sample_order[sh_climb_count]+3,0);
 
139
                        sh_climb_count++;
 
140
                        if (sh_climb_count == 7) sh_climb_count = 0;
97
141
                }
98
142
                else if (data && walk == 1)
99
143
                {
100
 
                        sample_start (3,6,0);
 
144
                        sample_start (3,sample_order[sh_climb_count]+8,0);
 
145
                        sh_climb_count++;
 
146
                        if (sh_climb_count == 7) sh_climb_count = 0;
101
147
                }
102
148
                climb = data;
103
149
        }
105
151
 
106
152
WRITE8_HANDLER( dkongjr_sh_snapjaw_w )
107
153
{
108
 
        static int snapjaw = 0;
109
 
 
110
154
        if (snapjaw != data)
111
155
        {
112
156
                if (data)
113
157
                        sample_stop (7);
114
 
                sample_start (4,7,0);
 
158
                sample_start (4,11,0);
115
159
                snapjaw = data;
116
160
        }
117
161
}