~ubuntu-branches/debian/wheezy/mame/wheezy

« back to all changes in this revision

Viewing changes to src/mame/video/cinemat.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:
29
29
 
30
30
/*************************************
31
31
 *
32
 
 *  Local variables
33
 
 *
34
 
 *************************************/
35
 
 
36
 
static int color_mode;
37
 
static rgb_t vector_color;
38
 
static INT16 lastx, lasty;
39
 
static UINT8 last_control;
40
 
 
41
 
 
42
 
 
43
 
/*************************************
44
 
 *
45
32
 *  Vector rendering
46
33
 *
47
34
 *************************************/
48
35
 
49
36
void cinemat_vector_callback(device_t *device, INT16 sx, INT16 sy, INT16 ex, INT16 ey, UINT8 shift)
50
37
{
51
 
        const rectangle &visarea = device->machine->primary_screen->visible_area();
 
38
        cinemat_state *state = device->machine().driver_data<cinemat_state>();
 
39
        const rectangle &visarea = device->machine().primary_screen->visible_area();
52
40
        int intensity = 0xff;
53
41
 
54
42
        /* adjust for slop */
62
50
                intensity = 0x1ff * shift / 8;
63
51
 
64
52
        /* move to the starting position if we're not there already */
65
 
        if (sx != lastx || sy != lasty)
66
 
                vector_add_point(device->machine, sx << 16, sy << 16, 0, 0);
 
53
        if (sx != state->m_lastx || sy != state->m_lasty)
 
54
                vector_add_point(device->machine(), sx << 16, sy << 16, 0, 0);
67
55
 
68
56
        /* draw the vector */
69
 
        vector_add_point(device->machine, ex << 16, ey << 16, vector_color, intensity);
 
57
        vector_add_point(device->machine(), ex << 16, ey << 16, state->m_vector_color, intensity);
70
58
 
71
59
        /* remember the last point */
72
 
        lastx = ex;
73
 
        lasty = ey;
 
60
        state->m_lastx = ex;
 
61
        state->m_lasty = ey;
74
62
}
75
63
 
76
64
 
83
71
 
84
72
WRITE8_HANDLER(cinemat_vector_control_w)
85
73
{
 
74
        cinemat_state *state = space->machine().driver_data<cinemat_state>();
86
75
        int r, g, b, i;
87
 
        cpu_device *cpu = space->machine->device<cpu_device>("maincpu");
 
76
        cpu_device *cpu = space->machine().device<cpu_device>("maincpu");
88
77
 
89
 
        switch (color_mode)
 
78
        switch (state->m_color_mode)
90
79
        {
91
80
                case COLOR_BILEVEL:
92
81
                        /* color is either bright or dim, selected by the value sent to the port */
93
 
                        vector_color = (data & 1) ? MAKE_RGB(0x80,0x80,0x80) : MAKE_RGB(0xff,0xff,0xff);
 
82
                        state->m_vector_color = (data & 1) ? MAKE_RGB(0x80,0x80,0x80) : MAKE_RGB(0xff,0xff,0xff);
94
83
                        break;
95
84
 
96
85
                case COLOR_16LEVEL:
97
86
                        /* on the rising edge of the data value, latch bits 0-3 of the */
98
87
                        /* X register as the intensity */
99
 
                        if (data != last_control && data)
 
88
                        if (data != state->m_last_control && data)
100
89
                        {
101
90
                                int xval = cpu->state(CCPU_X) & 0x0f;
102
91
                                i = (xval + 1) * 255 / 16;
103
 
                                vector_color = MAKE_RGB(i,i,i);
 
92
                                state->m_vector_color = MAKE_RGB(i,i,i);
104
93
                        }
105
94
                        break;
106
95
 
107
96
                case COLOR_64LEVEL:
108
97
                        /* on the rising edge of the data value, latch bits 2-7 of the */
109
98
                        /* X register as the intensity */
110
 
                        if (data != last_control && data)
 
99
                        if (data != state->m_last_control && data)
111
100
                        {
112
101
                                int xval = cpu->state(CCPU_X);
113
102
                                xval = (~xval >> 2) & 0x3f;
114
103
                                i = (xval + 1) * 255 / 64;
115
 
                                vector_color = MAKE_RGB(i,i,i);
 
104
                                state->m_vector_color = MAKE_RGB(i,i,i);
116
105
                        }
117
106
                        break;
118
107
 
119
108
                case COLOR_RGB:
120
109
                        /* on the rising edge of the data value, latch the X register */
121
110
                        /* as 4-4-4 BGR values */
122
 
                        if (data != last_control && data)
 
111
                        if (data != state->m_last_control && data)
123
112
                        {
124
113
                                int xval = cpu->state(CCPU_X);
125
114
                                r = (~xval >> 0) & 0x0f;
128
117
                                g = g * 255 / 15;
129
118
                                b = (~xval >> 8) & 0x0f;
130
119
                                b = b * 255 / 15;
131
 
                                vector_color = MAKE_RGB(r,g,b);
 
120
                                state->m_vector_color = MAKE_RGB(r,g,b);
132
121
                        }
133
122
                        break;
134
123
 
135
124
                case COLOR_QB3:
136
125
                        {
137
 
                                static int lastx, lasty;
138
 
 
139
126
                                /* on the falling edge of the data value, remember the original X,Y values */
140
127
                                /* they will be restored on the rising edge; this is to simulate the fact */
141
128
                                /* that the Rockola color hardware did not overwrite the beam X,Y position */
142
129
                                /* on an IV instruction if data == 0 here */
143
 
                                if (data != last_control && !data)
 
130
                                if (data != state->m_last_control && !data)
144
131
                                {
145
 
                                        lastx = cpu->state(CCPU_X);
146
 
                                        lasty = cpu->state(CCPU_Y);
 
132
                                        state->m_qb3_lastx = cpu->state(CCPU_X);
 
133
                                        state->m_qb3_lasty = cpu->state(CCPU_Y);
147
134
                                }
148
135
 
149
136
                                /* on the rising edge of the data value, latch the Y register */
150
137
                                /* as 2-3-3 BGR values */
151
 
                                if (data != last_control && data)
 
138
                                if (data != state->m_last_control && data)
152
139
                                {
153
140
                                        int yval = cpu->state(CCPU_Y);
154
141
                                        r = (~yval >> 0) & 0x07;
157
144
                                        g = g * 255 / 7;
158
145
                                        b = (~yval >> 6) & 0x03;
159
146
                                        b = b * 255 / 3;
160
 
                                        vector_color = MAKE_RGB(r,g,b);
 
147
                                        state->m_vector_color = MAKE_RGB(r,g,b);
161
148
 
162
149
                                        /* restore the original X,Y values */
163
 
                                        cpu->set_state(CCPU_X, lastx);
164
 
                                        cpu->set_state(CCPU_Y, lasty);
 
150
                                        cpu->set_state(CCPU_X, state->m_qb3_lastx);
 
151
                                        cpu->set_state(CCPU_Y, state->m_qb3_lasty);
165
152
                                }
166
153
                        }
167
154
                        break;
168
155
        }
169
156
 
170
157
        /* remember the last value */
171
 
        last_control = data;
 
158
        state->m_last_control = data;
172
159
}
173
160
 
174
161
 
181
168
 
182
169
VIDEO_START( cinemat_bilevel )
183
170
{
184
 
        color_mode = COLOR_BILEVEL;
 
171
        cinemat_state *state = machine.driver_data<cinemat_state>();
 
172
        state->m_color_mode = COLOR_BILEVEL;
185
173
        VIDEO_START_CALL(vector);
186
174
}
187
175
 
188
176
 
189
177
VIDEO_START( cinemat_16level )
190
178
{
191
 
        color_mode = COLOR_16LEVEL;
 
179
        cinemat_state *state = machine.driver_data<cinemat_state>();
 
180
        state->m_color_mode = COLOR_16LEVEL;
192
181
        VIDEO_START_CALL(vector);
193
182
}
194
183
 
195
184
 
196
185
VIDEO_START( cinemat_64level )
197
186
{
198
 
        color_mode = COLOR_64LEVEL;
 
187
        cinemat_state *state = machine.driver_data<cinemat_state>();
 
188
        state->m_color_mode = COLOR_64LEVEL;
199
189
        VIDEO_START_CALL(vector);
200
190
}
201
191
 
202
192
 
203
193
VIDEO_START( cinemat_color )
204
194
{
205
 
        color_mode = COLOR_RGB;
 
195
        cinemat_state *state = machine.driver_data<cinemat_state>();
 
196
        state->m_color_mode = COLOR_RGB;
206
197
        VIDEO_START_CALL(vector);
207
198
}
208
199
 
209
200
 
210
201
VIDEO_START( cinemat_qb3color )
211
202
{
212
 
        color_mode = COLOR_QB3;
 
203
        cinemat_state *state = machine.driver_data<cinemat_state>();
 
204
        state->m_color_mode = COLOR_QB3;
213
205
        VIDEO_START_CALL(vector);
214
206
}
215
207
 
221
213
 *
222
214
 *************************************/
223
215
 
224
 
VIDEO_UPDATE( cinemat )
 
216
SCREEN_UPDATE( cinemat )
225
217
{
226
 
        VIDEO_UPDATE_CALL(vector);
 
218
        SCREEN_UPDATE_CALL(vector);
227
219
        vector_clear_list();
228
220
 
229
 
        ccpu_wdt_timer_trigger(screen->machine->device("maincpu"));
 
221
        ccpu_wdt_timer_trigger(screen->machine().device("maincpu"));
230
222
 
231
223
        return 0;
232
224
}
239
231
 *
240
232
 *************************************/
241
233
 
242
 
VIDEO_UPDATE( spacewar )
 
234
SCREEN_UPDATE( spacewar )
243
235
{
244
 
        int sw_option = input_port_read(screen->machine, "INPUTS");
 
236
        int sw_option = input_port_read(screen->machine(), "INPUTS");
245
237
 
246
 
        VIDEO_UPDATE_CALL(cinemat);
 
238
        SCREEN_UPDATE_CALL(cinemat);
247
239
 
248
240
        /* set the state of the artwork */
249
241
        output_set_value("pressed3", (~sw_option >> 0) & 1);