2009-02-17 15:17:01 +00:00
|
|
|
/* ScummVM - Graphic Adventure Engine
|
|
|
|
*
|
|
|
|
* ScummVM is the legal property of its developers, whose names
|
|
|
|
* are too numerous to list here. Please refer to the COPYRIGHT
|
|
|
|
* file distributed with this source distribution.
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
|
*
|
|
|
|
* $URL$
|
|
|
|
* $Id$
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2009-02-15 08:34:13 +00:00
|
|
|
#include "common/scummsys.h"
|
|
|
|
#include "common/system.h"
|
2009-07-03 14:18:20 +00:00
|
|
|
#include "graphics/cursorman.h"
|
2009-02-23 09:39:09 +00:00
|
|
|
#include "graphics/primitives.h"
|
2009-06-26 22:30:52 +00:00
|
|
|
#include "graphics/surface.h"
|
2009-02-15 06:10:59 +00:00
|
|
|
|
2009-03-07 17:32:11 +00:00
|
|
|
#include "sci/sci.h"
|
2009-02-21 19:33:01 +00:00
|
|
|
#include "sci/gfx/gfx_driver.h"
|
|
|
|
#include "sci/gfx/gfx_tools.h"
|
2009-02-15 06:10:59 +00:00
|
|
|
|
2009-06-26 22:30:52 +00:00
|
|
|
|
2009-02-21 10:23:36 +00:00
|
|
|
namespace Sci {
|
|
|
|
|
2009-06-26 22:30:52 +00:00
|
|
|
GfxDriver::GfxDriver(int xfact, int yfact, Graphics::PixelFormat format) {
|
2009-02-15 06:10:59 +00:00
|
|
|
int i;
|
|
|
|
|
2009-06-26 22:30:52 +00:00
|
|
|
_mode = gfx_new_mode(xfact, yfact, format, format.bytesPerPixel == 1 ? new Palette(256) : 0, 0);
|
2009-06-06 10:21:48 +00:00
|
|
|
_mode->xsize = xfact * 320;
|
|
|
|
_mode->ysize = yfact * 200;
|
2009-02-15 06:10:59 +00:00
|
|
|
|
|
|
|
for (i = 0; i < 2; i++) {
|
2009-06-06 10:21:48 +00:00
|
|
|
_priority[i] = gfx_pixmap_alloc_index_data(gfx_new_pixmap(_mode->xsize, _mode->ysize, GFX_RESID_NONE, -i, -777));
|
|
|
|
if (!_priority[i]) {
|
|
|
|
error("Out of memory: Could not allocate priority maps! (%dx%d)\n", _mode->xsize, _mode->ysize);
|
2009-02-15 06:10:59 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
// create the visual buffers
|
2009-02-24 12:01:28 +00:00
|
|
|
for (i = 0; i < 2; i++) {
|
2009-06-06 10:21:48 +00:00
|
|
|
_visual[i] = NULL;
|
2009-06-26 22:30:52 +00:00
|
|
|
_visual[i] = new byte[_mode->xsize * _mode->ysize * _mode->bytespp];
|
2009-06-06 10:21:48 +00:00
|
|
|
if (!_visual[i]) {
|
|
|
|
error("Out of memory: Could not allocate visual buffers! (%dx%d)\n", _mode->xsize, _mode->ysize);
|
2009-02-15 06:10:59 +00:00
|
|
|
}
|
2009-06-26 22:30:52 +00:00
|
|
|
memset(_visual[i], 0, _mode->xsize * _mode->ysize * _mode->bytespp);
|
2009-02-15 06:10:59 +00:00
|
|
|
}
|
|
|
|
|
2009-06-26 22:30:52 +00:00
|
|
|
if (_mode->palette)
|
|
|
|
_mode->palette->name = "global";
|
2009-02-15 06:10:59 +00:00
|
|
|
}
|
|
|
|
|
2009-06-06 10:21:48 +00:00
|
|
|
GfxDriver::~GfxDriver() {
|
2009-02-15 06:10:59 +00:00
|
|
|
int i;
|
2009-06-06 10:21:48 +00:00
|
|
|
for (i = 0; i < 2; i++) {
|
|
|
|
gfx_free_pixmap(_priority[i]);
|
|
|
|
_priority[i] = NULL;
|
|
|
|
}
|
2009-02-15 06:10:59 +00:00
|
|
|
|
2009-06-06 10:21:48 +00:00
|
|
|
for (i = 0; i < 2; i++) {
|
|
|
|
delete[] _visual[i];
|
|
|
|
_visual[i] = NULL;
|
2009-02-15 06:10:59 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Drawing operations
|
|
|
|
|
2009-06-26 22:30:52 +00:00
|
|
|
template<int COPY_BYTES, typename SIZETYPE, int EXTRA_BYTE_OFFSET>
|
2009-02-23 09:39:09 +00:00
|
|
|
static void drawProc(int x, int y, int c, void *data) {
|
2009-06-06 10:21:48 +00:00
|
|
|
GfxDriver *drv = (GfxDriver *)data;
|
2009-06-06 10:40:32 +00:00
|
|
|
byte *p = drv->getVisual0();
|
2009-06-26 22:30:52 +00:00
|
|
|
SIZETYPE col = c << (EXTRA_BYTE_OFFSET * 8);
|
|
|
|
memcpy(p + (y * 320* drv->getMode()->xfact + x) * COPY_BYTES, &col, COPY_BYTES);
|
2009-02-15 06:10:59 +00:00
|
|
|
}
|
|
|
|
|
2009-08-31 14:24:35 +00:00
|
|
|
void GfxDriver::drawLine(Common::Point start, Common::Point end, gfx_color_t color,
|
2009-06-06 10:21:48 +00:00
|
|
|
gfx_line_mode_t line_mode, gfx_line_style_t line_style) {
|
2009-03-08 20:17:01 +00:00
|
|
|
uint32 scolor = color.visual.parent_index;
|
2009-06-06 10:21:48 +00:00
|
|
|
int xfact = (line_mode == GFX_LINE_MODE_FINE)? 1: _mode->xfact;
|
|
|
|
int yfact = (line_mode == GFX_LINE_MODE_FINE)? 1: _mode->yfact;
|
|
|
|
int xsize = _mode->xsize;
|
|
|
|
int ysize = _mode->ysize;
|
2009-02-15 06:10:59 +00:00
|
|
|
|
2009-06-26 22:30:52 +00:00
|
|
|
void (*modeDrawProc)(int,int,int,void*);
|
|
|
|
switch (_mode->bytespp) {
|
|
|
|
case 1:
|
|
|
|
modeDrawProc = drawProc<1, uint8, 0>;
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
modeDrawProc = drawProc<2, uint16, 0>;
|
|
|
|
break;
|
|
|
|
case 3:
|
|
|
|
#ifdef SCUMM_BIG_ENDIAN
|
|
|
|
modeDrawProc = drawProc<3, uint32, 1>;
|
|
|
|
#else
|
|
|
|
modeDrawProc = drawProc<3, uint32, 0>;
|
|
|
|
#endif
|
|
|
|
break;
|
|
|
|
case 4:
|
|
|
|
modeDrawProc = drawProc<4, uint32, 0>;
|
|
|
|
break;
|
|
|
|
default:
|
Merged revisions 42163-42164,42167-42181,42196-42200 via svnmerge from
https://scummvm.svn.sourceforge.net/svnroot/scummvm/scummvm/trunk
........
r42163 | Kirben | 2009-07-06 16:21:59 +1000 (Mon, 06 Jul 2009) | 1 line
Use graphics surfaces for screen buffers, and always use correct pitch when writing to the frameBuffer.
........
r42164 | Kirben | 2009-07-06 16:24:04 +1000 (Mon, 06 Jul 2009) | 1 line
Ooops, remove debug code.
........
r42167 | thebluegr | 2009-07-06 20:39:22 +1000 (Mon, 06 Jul 2009) | 1 line
Replaced sciprintf() calls with printf, DebugPrintf, warning and error calls
........
r42168 | thebluegr | 2009-07-06 21:10:35 +1000 (Mon, 06 Jul 2009) | 1 line
Fixed compilation
........
r42169 | thebluegr | 2009-07-06 21:15:42 +1000 (Mon, 06 Jul 2009) | 1 line
Added seChanged the warning displayed when a selector can't be mapped to a debugC - it's perfectly normal not to find certain selectors in certain SCI versions. Also, fixed the SCI version enums
........
r42170 | thebluegr | 2009-07-06 21:19:19 +1000 (Mon, 06 Jul 2009) | 1 line
Assigned several unimplemented/unused kernel functions as stubs, so that we know when they're used and how they're called
........
r42171 | drmccoy | 2009-07-06 21:19:37 +1000 (Mon, 06 Jul 2009) | 1 line
Splitting up the big evaluate() function
........
r42172 | thebluegr | 2009-07-06 21:33:28 +1000 (Mon, 06 Jul 2009) | 1 line
When a song isn't found, send a "stop handle" event so that the engine won't wait forever (e.g. in SQ4CD, perhaps others)
........
r42173 | dreammaster | 2009-07-06 22:33:05 +1000 (Mon, 06 Jul 2009) | 1 line
Removed all the current special cases coding for user (mouse press) waiting, and reimplemented it exactly the way the original did
........
r42174 | thebluegr | 2009-07-06 22:44:55 +1000 (Mon, 06 Jul 2009) | 1 line
Proper handling of sound effects marked as music resources
........
r42175 | joostp | 2009-07-06 23:09:50 +1000 (Mon, 06 Jul 2009) | 2 lines
add workaround for PSP compiler ICE
........
r42176 | drmccoy | 2009-07-06 23:52:47 +1000 (Mon, 06 Jul 2009) | 1 line
Loop over the string instead of copying and then editing it (hopefully, the PSP GCC won't ICE again here :P)
........
r42177 | jvprat | 2009-07-07 01:23:50 +1000 (Tue, 07 Jul 2009) | 2 lines
Groovie: Improve ROQ timing and audio sync (noticeable at least in the Clandestiny trailer)
........
r42178 | thebluegr | 2009-07-07 01:30:07 +1000 (Tue, 07 Jul 2009) | 1 line
KQ6CD should be working correctly again
........
r42179 | thebluegr | 2009-07-07 01:50:44 +1000 (Tue, 07 Jul 2009) | 1 line
Swapped the music and audio resource check for SCI1.1 games. Digital sound effects are now preferred over the synthesized ones
........
r42180 | lordhoto | 2009-07-07 02:17:03 +1000 (Tue, 07 Jul 2009) | 1 line
Fix RTL from Kyra3 main menu. (It now doesn't quit ScummVM anymore)
........
r42181 | thebluegr | 2009-07-07 02:22:14 +1000 (Tue, 07 Jul 2009) | 1 line
Renamed SCI_VERSION_01 -> SCI_VERSION_01_EGA
........
r42196 | dreammaster | 2009-07-07 11:14:55 +1000 (Tue, 07 Jul 2009) | 1 line
Bugfix so the game speed will correctly change after showing the credits when the game is restarted
........
r42197 | dreammaster | 2009-07-07 12:49:33 +1000 (Tue, 07 Jul 2009) | 1 line
Bugfix so that user delays work correctly
........
r42198 | dreammaster | 2009-07-07 12:51:42 +1000 (Tue, 07 Jul 2009) | 1 line
Added workaround to briefly pause when displaying the first message of the shooting cut-scene, so it can be read properly
........
r42199 | dreammaster | 2009-07-07 16:23:09 +1000 (Tue, 07 Jul 2009) | 1 line
Fix to the return values of the Op_GetMouseButton library function now allows the game's "Fisticuffs path" to work properly
........
r42200 | thebluegr | 2009-07-07 16:29:07 +1000 (Tue, 07 Jul 2009) | 1 line
Removed unused define
........
svn-id: r42203
2009-07-07 07:09:56 +00:00
|
|
|
error("Invalid mode->bytespp=%d", _mode->bytespp);
|
2009-06-26 22:30:52 +00:00
|
|
|
}
|
|
|
|
|
2009-02-15 06:10:59 +00:00
|
|
|
if (color.mask & GFX_MASK_VISUAL) {
|
2009-02-17 19:15:37 +00:00
|
|
|
Common::Point nstart, nend;
|
2009-02-15 06:10:59 +00:00
|
|
|
|
2009-02-23 22:36:39 +00:00
|
|
|
for (int xc = 0; xc < xfact; xc++) {
|
|
|
|
for (int yc = 0; yc < yfact; yc++) {
|
2009-02-15 06:10:59 +00:00
|
|
|
|
2009-02-23 22:36:39 +00:00
|
|
|
nstart.x = CLIP<int16>(start.x + xc, 0, xsize);
|
|
|
|
nstart.y = CLIP<int16>(start.y + yc, 0, ysize);
|
|
|
|
nend.x = CLIP<int16>(end.x + xc, 0, xsize - 1);
|
|
|
|
nend.y = CLIP<int16>(end.y + yc, 0, ysize - 1);
|
2009-02-15 06:10:59 +00:00
|
|
|
|
2009-06-26 22:30:52 +00:00
|
|
|
Graphics::drawLine(nstart.x, nstart.y, nend.x, nend.y, scolor, modeDrawProc, this);
|
2009-02-23 22:36:39 +00:00
|
|
|
|
|
|
|
if (color.mask & GFX_MASK_PRIORITY) {
|
2009-06-06 10:21:48 +00:00
|
|
|
gfx_draw_line_pixmap_i(_priority[0], nstart, nend, color.priority);
|
2009-02-23 22:36:39 +00:00
|
|
|
}
|
|
|
|
}
|
2009-02-15 06:10:59 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-08-31 14:24:35 +00:00
|
|
|
void GfxDriver::drawFilledRect(rect_t rect, gfx_color_t color1, gfx_color_t color2,
|
2009-02-22 13:11:43 +00:00
|
|
|
gfx_rectangle_fill_t shade_mode) {
|
2009-02-15 06:10:59 +00:00
|
|
|
if (color1.mask & GFX_MASK_VISUAL) {
|
2009-03-16 00:07:12 +00:00
|
|
|
for (int i = rect.y; i < rect.y + rect.height; i++) {
|
2009-06-26 22:30:52 +00:00
|
|
|
memset(_visual[0] + (i * _mode->xsize + rect.x) * _mode->bytespp,
|
|
|
|
color1.visual.parent_index, rect.width * _mode->bytespp);
|
2009-02-15 06:10:59 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (color1.mask & GFX_MASK_PRIORITY)
|
2009-06-06 10:21:48 +00:00
|
|
|
gfx_draw_box_pixmap_i(_priority[0], rect, color1.priority);
|
2009-02-15 06:10:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Pixmap operations
|
|
|
|
|
2009-08-31 14:24:35 +00:00
|
|
|
void GfxDriver::drawPixmap(gfx_pixmap_t *pxm, int priority, rect_t src, rect_t dest, gfx_buffer_t buffer) {
|
2009-02-24 12:01:28 +00:00
|
|
|
int bufnr = (buffer == GFX_BUFFER_STATIC) ? 1 : 0;
|
2009-02-15 06:10:59 +00:00
|
|
|
|
2009-03-16 00:07:12 +00:00
|
|
|
if (dest.width != src.width || dest.height != src.height) {
|
2009-08-31 14:24:35 +00:00
|
|
|
warning("Attempt to scale pixmap (%dx%d)->(%dx%d): Not supported\n", src.width, src.height, dest.width, dest.height);
|
|
|
|
return;
|
2009-02-15 06:10:59 +00:00
|
|
|
}
|
|
|
|
|
2009-06-26 22:30:52 +00:00
|
|
|
gfx_crossblit_pixmap(_mode, pxm, priority, src, dest, _visual[bufnr],
|
|
|
|
_mode->xsize * _mode->bytespp,
|
|
|
|
_priority[bufnr]->index_data,
|
|
|
|
_priority[bufnr]->index_width, 1, 0);
|
2009-02-15 06:10:59 +00:00
|
|
|
}
|
|
|
|
|
2009-08-31 14:24:35 +00:00
|
|
|
void GfxDriver::grabPixmap(rect_t src, gfx_pixmap_t *pxm, gfx_map_mask_t map) {
|
|
|
|
if (src.x < 0 || src.y < 0)
|
|
|
|
error("Attempt to grab pixmap from invalid coordinates (%d,%d)", src.x, src.y);
|
2009-02-15 06:10:59 +00:00
|
|
|
|
2009-08-31 14:24:35 +00:00
|
|
|
if (!pxm->data)
|
|
|
|
error("Attempt to grab pixmap to unallocated memory");
|
2009-02-15 06:10:59 +00:00
|
|
|
|
|
|
|
switch (map) {
|
|
|
|
|
|
|
|
case GFX_MASK_VISUAL:
|
2009-03-16 00:07:12 +00:00
|
|
|
pxm->width = src.width;
|
|
|
|
pxm->height = src.height;
|
|
|
|
for (int i = 0; i < src.height; i++) {
|
2009-06-26 22:30:52 +00:00
|
|
|
memcpy(pxm->data + i * src.width * _mode->bytespp,
|
|
|
|
_visual[0] + _mode->bytespp * ((i + src.y) * _mode->xsize + src.x),
|
|
|
|
src.width * _mode->bytespp);
|
2009-02-15 06:10:59 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GFX_MASK_PRIORITY:
|
2009-08-31 14:24:35 +00:00
|
|
|
warning("FIXME: priority map grab not implemented yet");
|
2009-02-15 06:10:59 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
2009-08-31 14:24:35 +00:00
|
|
|
error("Attempt to grab pixmap from invalid map 0x%02x", map);
|
2009-02-15 06:10:59 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Buffer operations
|
|
|
|
|
2009-08-31 14:24:35 +00:00
|
|
|
void GfxDriver::update(rect_t src, Common::Point dest, gfx_buffer_t buffer) {
|
2009-02-15 06:10:59 +00:00
|
|
|
//TODO
|
|
|
|
|
|
|
|
/*
|
|
|
|
if (src.x != dest.x || src.y != dest.y) {
|
2009-03-16 00:07:12 +00:00
|
|
|
printf("Updating %d (%d,%d)(%dx%d) to (%d,%d) on %d\n", buffer, src.x, src.y, src.width, src.height, dest.x, dest.y, data_dest);
|
2009-02-15 06:10:59 +00:00
|
|
|
} else {
|
2009-03-16 00:07:12 +00:00
|
|
|
printf("Updating %d (%d,%d)(%dx%d) to %d\n", buffer, src.x, src.y, src.width, src.height, data_dest);
|
2009-02-15 06:10:59 +00:00
|
|
|
}
|
|
|
|
*/
|
|
|
|
|
|
|
|
switch (buffer) {
|
|
|
|
case GFX_BUFFER_BACK:
|
2009-03-16 00:07:12 +00:00
|
|
|
for (int i = 0; i < src.height; i++) {
|
2009-06-26 22:30:52 +00:00
|
|
|
memcpy(_visual[0] + _mode->bytespp * ( (dest.y + i) * _mode->xsize + dest.x),
|
|
|
|
_visual[1] + _mode->bytespp * ( (src.y + i) * _mode->xsize + src.x), src.width * _mode->bytespp );
|
2009-02-15 06:10:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if ((src.x == dest.x) && (src.y == dest.y))
|
2009-06-06 10:21:48 +00:00
|
|
|
gfx_copy_pixmap_box_i(_priority[0], _priority[1], src);
|
2009-02-15 06:10:59 +00:00
|
|
|
break;
|
2009-06-26 22:30:52 +00:00
|
|
|
case GFX_BUFFER_FRONT: {
|
|
|
|
g_system->copyRectToScreen(_visual[0] + _mode->bytespp * (src.x + src.y * _mode->xsize), _mode->xsize * _mode->bytespp, dest.x, dest.y, src.width, src.height);
|
2009-02-24 12:01:28 +00:00
|
|
|
g_system->updateScreen();
|
2009-02-15 06:10:59 +00:00
|
|
|
break;
|
2009-06-26 22:30:52 +00:00
|
|
|
}
|
2009-02-15 06:10:59 +00:00
|
|
|
default:
|
2009-07-06 10:39:22 +00:00
|
|
|
error("Invalid buffer %d in update", buffer);
|
2009-02-15 06:10:59 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-08-31 14:24:35 +00:00
|
|
|
void GfxDriver::setStaticBuffer(gfx_pixmap_t *pic, gfx_pixmap_t *priority) {
|
2009-06-26 22:30:52 +00:00
|
|
|
memcpy(_visual[1], pic->data, _mode->xsize * _mode->ysize * _mode->bytespp);
|
2009-06-06 10:21:48 +00:00
|
|
|
gfx_copy_pixmap_box_i(_priority[1], priority, gfx_rect(0, 0, _mode->xsize, _mode->ysize));
|
2009-02-15 06:10:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Mouse pointer operations
|
|
|
|
|
2009-02-23 23:49:11 +00:00
|
|
|
// Scale cursor and map its colors to the global palette
|
2009-06-06 10:21:48 +00:00
|
|
|
byte *GfxDriver::createCursor(gfx_pixmap_t *pointer) {
|
2009-03-16 00:07:12 +00:00
|
|
|
int linewidth = pointer->width;
|
|
|
|
int lines = pointer->height;
|
2009-06-06 10:40:32 +00:00
|
|
|
byte *data = new byte[linewidth*lines];
|
2009-06-06 10:21:48 +00:00
|
|
|
byte *linebase = data, *pos;
|
|
|
|
byte *src = pointer->index_data;
|
2009-02-23 22:36:19 +00:00
|
|
|
|
2009-03-16 00:07:12 +00:00
|
|
|
for (int yc = 0; yc < pointer->index_height; yc++) {
|
2009-02-23 22:36:19 +00:00
|
|
|
pos = linebase;
|
|
|
|
|
2009-03-16 00:07:12 +00:00
|
|
|
for (int xc = 0; xc < pointer->index_width; xc++) {
|
2009-06-06 10:40:32 +00:00
|
|
|
byte color = *src;
|
2009-04-24 14:30:27 +00:00
|
|
|
// FIXME: The palette size check is a workaround for cursors using non-palette colour GFX_CURSOR_TRANSPARENT
|
2009-05-27 16:45:42 +00:00
|
|
|
// Note that some cursors don't have a palette in SQ5
|
|
|
|
if (pointer->palette && color < pointer->palette->size())
|
2009-03-08 20:17:01 +00:00
|
|
|
color = pointer->palette->getColor(color).parent_index;
|
2009-06-06 10:21:48 +00:00
|
|
|
for (int scalectr = 0; scalectr < _mode->xfact; scalectr++) {
|
2009-02-23 23:49:11 +00:00
|
|
|
*pos++ = color;
|
2009-02-23 22:36:19 +00:00
|
|
|
}
|
|
|
|
src++;
|
|
|
|
}
|
2009-06-06 10:21:48 +00:00
|
|
|
for (int scalectr = 1; scalectr < _mode->yfact; scalectr++)
|
2009-02-23 22:36:19 +00:00
|
|
|
memcpy(linebase + linewidth * scalectr, linebase, linewidth);
|
2009-06-06 10:21:48 +00:00
|
|
|
linebase += linewidth * _mode->yfact;
|
2009-02-23 22:36:19 +00:00
|
|
|
}
|
|
|
|
return data;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-08-31 14:24:35 +00:00
|
|
|
void GfxDriver::setPointer(gfx_pixmap_t *pointer, Common::Point *hotspot) {
|
2009-04-24 12:30:57 +00:00
|
|
|
if ((pointer == NULL) || (hotspot == NULL)) {
|
2009-07-03 14:18:20 +00:00
|
|
|
CursorMan.showMouse(false);
|
2009-02-15 06:10:59 +00:00
|
|
|
} else {
|
2009-06-06 10:40:32 +00:00
|
|
|
byte *cursorData = createCursor(pointer);
|
2009-04-24 14:30:27 +00:00
|
|
|
|
2009-07-04 17:39:43 +00:00
|
|
|
// FIXME: The palette size check is a workaround for cursors using non-palette color GFX_CURSOR_TRANSPARENT
|
|
|
|
// Note that some cursors don't have a palette (e.g. in SQ5 and QFG3)
|
2009-06-06 10:40:32 +00:00
|
|
|
byte color_key = GFX_CURSOR_TRANSPARENT;
|
2009-05-27 16:45:42 +00:00
|
|
|
if ((pointer->color_key != GFX_PIXMAP_COLOR_KEY_NONE) && (pointer->palette && (unsigned int)pointer->color_key < pointer->palette->size()))
|
2009-04-24 14:30:27 +00:00
|
|
|
color_key = pointer->palette->getColor(pointer->color_key).parent_index;
|
2009-07-04 17:39:43 +00:00
|
|
|
// Some cursors don't have a palette, so we set the color key directly
|
2009-05-27 16:45:42 +00:00
|
|
|
if (!pointer->palette)
|
2009-07-04 17:39:43 +00:00
|
|
|
color_key = pointer->color_key;
|
2009-04-24 14:30:27 +00:00
|
|
|
|
2009-07-03 14:18:20 +00:00
|
|
|
CursorMan.replaceCursor(cursorData, pointer->width, pointer->height, hotspot->x, hotspot->y, color_key);
|
|
|
|
CursorMan.showMouse(true);
|
2009-06-05 23:08:35 +00:00
|
|
|
|
|
|
|
delete[] cursorData;
|
|
|
|
cursorData = 0;
|
2009-02-15 06:10:59 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-02-21 10:23:36 +00:00
|
|
|
} // End of namespace Sci
|