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

« back to all changes in this revision

Viewing changes to mess/src/mame/video/suprslam.c

  • Committer: Package Import Robot
  • Author(s): Jordi Mallach, Jordi Mallach, Emmanuel Kasper
  • Date: 2011-12-19 22:56:27 UTC
  • mfrom: (0.1.2)
  • Revision ID: package-import@ubuntu.com-20111219225627-ub5oga1oys4ogqzm
Tags: 0.144-1
[ Jordi Mallach ]
* Fix syntax errors in DEP5 copyright file (lintian).
* Use a versioned copyright Format specification field.
* Update Vcs-* URLs.
* Move transitional packages to the new metapackages section, and make
  them priority extra.
* Remove references to GNU/Linux and MESS sources from copyright.
* Add build variables for s390x.
* Use .xz tarballs as it cuts 4MB for the upstream sources.
* Add nplayers.ini as a patch. Update copyright file to add CC-BY-SA-3.0.

[ Emmanuel Kasper ]
* New upstream release. Closes: #651538.
* Add Free Desktop compliant png icons of various sizes taken from
  the hydroxygen iconset
* Mess is now built from a new source package, to avoid possible source
  incompatibilities between mame and the mess overlay.
* Mame-tools are not built from the mame source package anymore, but
  from the mess source package

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* Super Slams - video, see notes in driver file */
2
 
 
3
 
#include "emu.h"
4
 
#include "video/konicdev.h"
5
 
#include "includes/suprslam.h"
6
 
 
7
 
 
8
 
/* todo, fix zooming correctly, it's _not_ like aerofgt */
9
 
static void draw_sprites( running_machine &machine, bitmap_t *bitmap, const rectangle *cliprect )
10
 
{
11
 
        /* SPRITE INFO
12
 
 
13
 
    Video System hardware, like aerofgt etc.
14
 
 
15
 
    the sprites use 2 areas of ram, one containing a spritelist + sprite attributes, the other
16
 
    contains the sprite tile #'s to use
17
 
 
18
 
    sprite attribute info (4 words per sprite)
19
 
 
20
 
    |  ZZZZ hhhy yyyy yyyy  |  zzzz wwwx xxxx xxxx  |  -fpp pppp ---- ----  |  -ooo oooo oooo oooo  |
21
 
 
22
 
    x  = x position
23
 
    y  = y position
24
 
    w  = width
25
 
    h  = height
26
 
    zZ = y zoom / x zoom
27
 
    f  = xflip
28
 
    p  = palette / colour
29
 
    o  = offset to tile data in other ram area
30
 
 
31
 
    */
32
 
 
33
 
        suprslam_state *state = machine.driver_data<suprslam_state>();
34
 
        const gfx_element *gfx = machine.gfx[1];
35
 
        UINT16 *source = state->m_spriteram;
36
 
        UINT16 *source2 = state->m_spriteram;
37
 
        UINT16 *finish = source + 0x2000/2;
38
 
 
39
 
        while (source < finish)
40
 
        {
41
 
                UINT32 sprnum = source[0] & 0x03ff;
42
 
                if (source[0] == 0x4000) break;
43
 
 
44
 
                sprnum *= 4;
45
 
 
46
 
                source++;
47
 
                /* DRAW START */
48
 
                {
49
 
                        int ypos = source2[sprnum + 0] & 0x1ff;
50
 
                        int high = (source2[sprnum + 0] & 0x0e00) >> 9;
51
 
                        int yzoom = (source2[sprnum + 0] & 0xf000) >> 12;
52
 
 
53
 
                        int xpos = source2[sprnum + 1] & 0x1ff;
54
 
                        int wide = (source2[sprnum + 1] & 0x0e00) >> 9;
55
 
                        int xzoom = (source2[sprnum + 1] & 0xf000) >> 12;
56
 
 
57
 
                        int col = (source2[sprnum + 2] & 0x3f00) >> 8;
58
 
                        int flipx = (source2[sprnum + 2] & 0x4000) >> 14;
59
 
//          int flipy = (source2[sprnum + 2] & 0x8000) >> 15;
60
 
 
61
 
                        int word_offset = source2[sprnum + 3] & 0x7fff;
62
 
                        int xcnt, ycnt;
63
 
 
64
 
                        int loopno = 0;
65
 
 
66
 
                        xzoom = 32 - xzoom;
67
 
                        yzoom = 32 - yzoom;
68
 
 
69
 
                        if (ypos > 0xff) ypos -=0x200;
70
 
 
71
 
                        for (ycnt = 0; ycnt < high+1; ycnt ++)
72
 
                        {
73
 
                                if (!flipx)
74
 
                        {
75
 
                                        for (xcnt = 0; xcnt < wide+1; xcnt ++)
76
 
                                        {
77
 
                                                int tileno = state->m_sp_videoram[word_offset + loopno];
78
 
                                                drawgfxzoom_transpen(bitmap, cliprect, gfx, tileno, col, 0, 0,xpos + xcnt * xzoom/2, ypos + ycnt * yzoom/2,xzoom << 11, yzoom << 11, 15);
79
 
                                                drawgfxzoom_transpen(bitmap, cliprect, gfx, tileno, col, 0, 0,-0x200+xpos + xcnt * xzoom/2, ypos + ycnt * yzoom/2,xzoom << 11, yzoom << 11, 15);
80
 
                                                loopno ++;
81
 
                                        }
82
 
                                }
83
 
                                else
84
 
                                {
85
 
                                        for (xcnt = wide; xcnt >= 0; xcnt --)
86
 
                                        {
87
 
                                                int tileno = state->m_sp_videoram[word_offset + loopno];
88
 
                                                drawgfxzoom_transpen(bitmap, cliprect, gfx, tileno, col, 1, 0,xpos + xcnt * xzoom/2, ypos + ycnt * yzoom/2,xzoom << 11, yzoom << 11, 15);
89
 
                                                drawgfxzoom_transpen(bitmap, cliprect, gfx, tileno, col, 1, 0,-0x200+xpos + xcnt * xzoom/2, ypos + ycnt * yzoom/2,xzoom << 11, yzoom << 11, 15);
90
 
                                                loopno ++;
91
 
                                        }
92
 
                                }
93
 
                        }
94
 
                }
95
 
        }
96
 
}
97
 
 
98
 
/* FG 'SCREEN' LAYER */
99
 
 
100
 
WRITE16_HANDLER( suprslam_screen_videoram_w )
101
 
{
102
 
        suprslam_state *state = space->machine().driver_data<suprslam_state>();
103
 
 
104
 
        state->m_screen_videoram[offset] = data;
105
 
        tilemap_mark_tile_dirty(state->m_screen_tilemap, offset);
106
 
}
107
 
 
108
 
 
109
 
static TILE_GET_INFO( get_suprslam_tile_info )
110
 
{
111
 
        suprslam_state *state = machine.driver_data<suprslam_state>();
112
 
        int tileno = state->m_screen_videoram[tile_index] & 0x0fff;
113
 
        int colour = state->m_screen_videoram[tile_index] & 0xf000;
114
 
 
115
 
        tileno += state->m_screen_bank;
116
 
        colour = colour >> 12;
117
 
 
118
 
        SET_TILE_INFO(0, tileno, colour, 0);
119
 
}
120
 
 
121
 
 
122
 
/* BG LAYER */
123
 
WRITE16_HANDLER( suprslam_bg_videoram_w )
124
 
{
125
 
        suprslam_state *state = space->machine().driver_data<suprslam_state>();
126
 
 
127
 
        state->m_bg_videoram[offset] = data;
128
 
        tilemap_mark_tile_dirty(state->m_bg_tilemap, offset);
129
 
}
130
 
 
131
 
 
132
 
static TILE_GET_INFO( get_suprslam_bg_tile_info )
133
 
{
134
 
        suprslam_state *state = machine.driver_data<suprslam_state>();
135
 
        int tileno = state->m_bg_videoram[tile_index] & 0x0fff;
136
 
        int colour = state->m_bg_videoram[tile_index] & 0xf000;
137
 
 
138
 
        tileno += state->m_bg_bank;
139
 
        colour = colour >> 12;
140
 
 
141
 
        SET_TILE_INFO(2, tileno, colour, 0);
142
 
}
143
 
 
144
 
 
145
 
VIDEO_START( suprslam )
146
 
{
147
 
        suprslam_state *state = machine.driver_data<suprslam_state>();
148
 
 
149
 
        state->m_bg_tilemap = tilemap_create(machine, get_suprslam_bg_tile_info, tilemap_scan_rows, 16, 16, 64, 64);
150
 
        state->m_screen_tilemap = tilemap_create(machine, get_suprslam_tile_info, tilemap_scan_rows, 8, 8, 64, 32);
151
 
 
152
 
        tilemap_set_transparent_pen(state->m_screen_tilemap, 15);
153
 
}
154
 
 
155
 
SCREEN_UPDATE( suprslam )
156
 
{
157
 
        suprslam_state *state = screen->machine().driver_data<suprslam_state>();
158
 
        tilemap_set_scrollx( state->m_screen_tilemap,0, state->m_screen_vregs[0x04/2] );
159
 
 
160
 
        bitmap_fill(bitmap, cliprect, get_black_pen(screen->machine()));
161
 
        k053936_zoom_draw(state->m_k053936, bitmap, cliprect, state->m_bg_tilemap, 0, 0, 1);
162
 
        if(!(state->m_spr_ctrl[0] & 8))
163
 
                draw_sprites(screen->machine(), bitmap, cliprect);
164
 
        tilemap_draw(bitmap, cliprect, state->m_screen_tilemap, 0, 0);
165
 
        if(state->m_spr_ctrl[0] & 8)
166
 
                draw_sprites(screen->machine(), bitmap, cliprect);
167
 
        return 0;
168
 
}
169
 
 
170
 
WRITE16_HANDLER (suprslam_bank_w)
171
 
{
172
 
        suprslam_state *state = space->machine().driver_data<suprslam_state>();
173
 
        UINT16 old_screen_bank, old_bg_bank;
174
 
        old_screen_bank = state->m_screen_bank;
175
 
        old_bg_bank = state->m_bg_bank;
176
 
 
177
 
        state->m_screen_bank = data & 0xf000;
178
 
        state->m_bg_bank = (data & 0x0f00) << 4;
179
 
 
180
 
        if (state->m_screen_bank != old_screen_bank)
181
 
                tilemap_mark_all_tiles_dirty(state->m_screen_tilemap);
182
 
        if (state->m_bg_bank != old_bg_bank)
183
 
                tilemap_mark_all_tiles_dirty(state->m_bg_tilemap);
184
 
}