trunk/src/mame/video/atarimo.c
| r17774 | r17775 | |
| 34 | 34 | running_machine &machine() const { return m_machine; } |
| 35 | 35 | |
| 36 | 36 | UINT32 gfxchanged; /* true if the gfx info has changed */ |
| 37 | | gfx_element * gfxelement[MAX_GFX_ELEMENTS]; /* local copy of graphics elements */ |
| 38 | 37 | int gfxgranularity[MAX_GFX_ELEMENTS]; |
| 39 | 38 | |
| 40 | 39 | bitmap_ind16 *bitmap; /* temporary bitmap to render to */ |
| r17774 | r17775 | |
| 235 | 234 | |
| 236 | 235 | INLINE void init_gfxelement(atarimo_data *mo, int idx) |
| 237 | 236 | { |
| 238 | | mo->gfxelement[idx] = auto_alloc(mo->machine(), gfx_element(mo->machine())); |
| 239 | | memcpy(mo->gfxelement[idx], mo->machine().gfx[idx], sizeof(*mo->gfxelement[idx])); |
| 240 | | mo->gfxgranularity[idx] = mo->gfxelement[idx]->granularity(); |
| 241 | | mo->gfxelement[idx]->set_granularity(1); |
| 242 | | mo->gfxelement[idx]->set_colorbase(0); |
| 243 | | mo->gfxelement[idx]->set_colors(65536); |
| 237 | mo->gfxgranularity[idx] = mo->machine().gfx[idx]->granularity(); |
| 244 | 238 | } |
| 245 | 239 | |
| 246 | 240 | |
| r17774 | r17775 | |
| 742 | 736 | static int mo_render_object(atarimo_data *mo, const atarimo_entry *entry, const rectangle &cliprect) |
| 743 | 737 | { |
| 744 | 738 | int gfxindex = mo->gfxlookup[EXTRACT_DATA(entry, mo->gfxmask)]; |
| 745 | | gfx_element *gfx = mo->gfxelement[gfxindex]; |
| 739 | gfx_element *gfx = mo->machine().gfx[gfxindex]; |
| 746 | 740 | bitmap_ind16 &bitmap = *mo->bitmap; |
| 747 | 741 | int x, y, sx, sy; |
| 748 | 742 | |
| 743 | int save_granularity = gfx->granularity(); |
| 744 | int save_colorbase = gfx->colorbase(); |
| 745 | int save_colors = gfx->colors(); |
| 746 | gfx->set_granularity(1); |
| 747 | gfx->set_colorbase(0); |
| 748 | gfx->set_colors(65536); |
| 749 | |
| 749 | 750 | /* extract data from the various words */ |
| 750 | 751 | int code = mo->codelookup[EXTRACT_DATA(entry, mo->codemask)] | (EXTRACT_DATA(entry, mo->codehighmask) << mo->codehighshift); |
| 751 | 752 | int color = mo->colorlookup[EXTRACT_DATA(entry, mo->colormask)]; |
| r17774 | r17775 | |
| 810 | 811 | /* is this one special? */ |
| 811 | 812 | if (mo->specialmask.mask != 0 && EXTRACT_DATA(entry, mo->specialmask) == mo->specialvalue) |
| 812 | 813 | { |
| 814 | int result = 0; |
| 813 | 815 | if (mo->specialcb) |
| 814 | | return (*mo->specialcb)(bitmap, cliprect, code, color, xpos, ypos, NULL); |
| 815 | | return 0; |
| 816 | result = (*mo->specialcb)(bitmap, cliprect, code, color, xpos, ypos, NULL); |
| 817 | |
| 818 | gfx->set_granularity(save_granularity); |
| 819 | gfx->set_colorbase(save_colorbase); |
| 820 | gfx->set_colors(save_colors); |
| 821 | |
| 822 | return result; |
| 816 | 823 | } |
| 817 | 824 | |
| 818 | 825 | /* adjust for h flip */ |
| r17774 | r17775 | |
| 904 | 911 | } |
| 905 | 912 | } |
| 906 | 913 | |
| 914 | gfx->set_granularity(save_granularity); |
| 915 | gfx->set_colorbase(save_colorbase); |
| 916 | gfx->set_colors(save_colors); |
| 917 | |
| 907 | 918 | return rendered; |
| 908 | 919 | } |
| 909 | 920 | |