[Scummvm-cvs-logs] SF.net SVN: scummvm:[42203] scummvm/branches/gsoc2009-16bit
Kirben at users.sourceforge.net
Kirben at users.sourceforge.net
Tue Jul 7 09:09:56 CEST 2009
Revision: 42203
http://scummvm.svn.sourceforge.net/scummvm/?rev=42203&view=rev
Author: Kirben
Date: 2009-07-07 07:09:56 +0000 (Tue, 07 Jul 2009)
Log Message:
-----------
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
........
Modified Paths:
--------------
scummvm/branches/gsoc2009-16bit/engines/agos/agos.cpp
scummvm/branches/gsoc2009-16bit/engines/agos/agos.h
scummvm/branches/gsoc2009-16bit/engines/agos/charset-fontdata.cpp
scummvm/branches/gsoc2009-16bit/engines/agos/charset.cpp
scummvm/branches/gsoc2009-16bit/engines/agos/draw.cpp
scummvm/branches/gsoc2009-16bit/engines/agos/event.cpp
scummvm/branches/gsoc2009-16bit/engines/agos/gfx.cpp
scummvm/branches/gsoc2009-16bit/engines/agos/icons.cpp
scummvm/branches/gsoc2009-16bit/engines/agos/menus.cpp
scummvm/branches/gsoc2009-16bit/engines/agos/oracle.cpp
scummvm/branches/gsoc2009-16bit/engines/agos/verb.cpp
scummvm/branches/gsoc2009-16bit/engines/agos/vga.cpp
scummvm/branches/gsoc2009-16bit/engines/agos/vga_e2.cpp
scummvm/branches/gsoc2009-16bit/engines/agos/vga_pn.cpp
scummvm/branches/gsoc2009-16bit/engines/agos/vga_s2.cpp
scummvm/branches/gsoc2009-16bit/engines/agos/vga_ww.cpp
scummvm/branches/gsoc2009-16bit/engines/agos/window.cpp
scummvm/branches/gsoc2009-16bit/engines/cruise/cruise_main.cpp
scummvm/branches/gsoc2009-16bit/engines/cruise/function.cpp
scummvm/branches/gsoc2009-16bit/engines/cruise/gfxModule.cpp
scummvm/branches/gsoc2009-16bit/engines/gob/hotspots.cpp
scummvm/branches/gsoc2009-16bit/engines/gob/hotspots.h
scummvm/branches/gsoc2009-16bit/engines/groovie/roq.cpp
scummvm/branches/gsoc2009-16bit/engines/kyra/kyra_mr.cpp
scummvm/branches/gsoc2009-16bit/engines/sci/console.cpp
scummvm/branches/gsoc2009-16bit/engines/sci/detection.cpp
scummvm/branches/gsoc2009-16bit/engines/sci/engine/game.cpp
scummvm/branches/gsoc2009-16bit/engines/sci/engine/gc.cpp
scummvm/branches/gsoc2009-16bit/engines/sci/engine/grammar.cpp
scummvm/branches/gsoc2009-16bit/engines/sci/engine/kernel.cpp
scummvm/branches/gsoc2009-16bit/engines/sci/engine/kernel.h
scummvm/branches/gsoc2009-16bit/engines/sci/engine/kevent.cpp
scummvm/branches/gsoc2009-16bit/engines/sci/engine/kfile.cpp
scummvm/branches/gsoc2009-16bit/engines/sci/engine/kgraphics.cpp
scummvm/branches/gsoc2009-16bit/engines/sci/engine/kmisc.cpp
scummvm/branches/gsoc2009-16bit/engines/sci/engine/kmovement.cpp
scummvm/branches/gsoc2009-16bit/engines/sci/engine/kpathing.cpp
scummvm/branches/gsoc2009-16bit/engines/sci/engine/ksound.cpp
scummvm/branches/gsoc2009-16bit/engines/sci/engine/kstring.cpp
scummvm/branches/gsoc2009-16bit/engines/sci/engine/memobj.cpp
scummvm/branches/gsoc2009-16bit/engines/sci/engine/said.cpp
scummvm/branches/gsoc2009-16bit/engines/sci/engine/said.y
scummvm/branches/gsoc2009-16bit/engines/sci/engine/savegame.cpp
scummvm/branches/gsoc2009-16bit/engines/sci/engine/script.cpp
scummvm/branches/gsoc2009-16bit/engines/sci/engine/script.h
scummvm/branches/gsoc2009-16bit/engines/sci/engine/scriptdebug.cpp
scummvm/branches/gsoc2009-16bit/engines/sci/engine/seg_manager.cpp
scummvm/branches/gsoc2009-16bit/engines/sci/engine/vm.cpp
scummvm/branches/gsoc2009-16bit/engines/sci/gfx/font.cpp
scummvm/branches/gsoc2009-16bit/engines/sci/gfx/gfx_driver.cpp
scummvm/branches/gsoc2009-16bit/engines/sci/gfx/gfx_gui.cpp
scummvm/branches/gsoc2009-16bit/engines/sci/gfx/gfx_pixmap_scale.cpp
scummvm/branches/gsoc2009-16bit/engines/sci/gfx/gfx_resmgr.cpp
scummvm/branches/gsoc2009-16bit/engines/sci/gfx/gfx_state_internal.h
scummvm/branches/gsoc2009-16bit/engines/sci/gfx/gfx_support.cpp
scummvm/branches/gsoc2009-16bit/engines/sci/gfx/gfx_system.h
scummvm/branches/gsoc2009-16bit/engines/sci/gfx/gfx_tools.cpp
scummvm/branches/gsoc2009-16bit/engines/sci/gfx/gfx_widgets.cpp
scummvm/branches/gsoc2009-16bit/engines/sci/gfx/menubar.cpp
scummvm/branches/gsoc2009-16bit/engines/sci/gfx/operations.cpp
scummvm/branches/gsoc2009-16bit/engines/sci/gfx/res_cursor.cpp
scummvm/branches/gsoc2009-16bit/engines/sci/gfx/res_font.cpp
scummvm/branches/gsoc2009-16bit/engines/sci/gfx/res_pal.cpp
scummvm/branches/gsoc2009-16bit/engines/sci/gfx/res_pic.cpp
scummvm/branches/gsoc2009-16bit/engines/sci/gfx/res_view.cpp
scummvm/branches/gsoc2009-16bit/engines/sci/resource.cpp
scummvm/branches/gsoc2009-16bit/engines/sci/sci.cpp
scummvm/branches/gsoc2009-16bit/engines/sci/sci.h
scummvm/branches/gsoc2009-16bit/engines/sci/sfx/iterator.cpp
scummvm/branches/gsoc2009-16bit/engines/sci/sfx/seq/map-mt32-to-gm.cpp
scummvm/branches/gsoc2009-16bit/engines/sci/sfx/softseq/amiga.cpp
scummvm/branches/gsoc2009-16bit/engines/sci/sfx/songlib.cpp
scummvm/branches/gsoc2009-16bit/engines/sci/tools.cpp
scummvm/branches/gsoc2009-16bit/engines/sci/tools.h
scummvm/branches/gsoc2009-16bit/engines/sci/vocabulary.cpp
scummvm/branches/gsoc2009-16bit/engines/sci/vocabulary.h
Property Changed:
----------------
scummvm/branches/gsoc2009-16bit/
Property changes on: scummvm/branches/gsoc2009-16bit
___________________________________________________________________
Modified: svnmerge-integrated
- /scummvm/trunk:1-42162 /scummvm/branches/gsoc2008-tfmx:1-31765 /scummvm/branches/gsoc2008-gui:1-31703
+ /scummvm/trunk:1-42200 /scummvm/branches/gsoc2008-tfmx:1-31765 /scummvm/branches/gsoc2008-gui:1-31703
Modified: scummvm/branches/gsoc2009-16bit/engines/agos/agos.cpp
===================================================================
--- scummvm/branches/gsoc2009-16bit/engines/agos/agos.cpp 2009-07-07 07:02:04 UTC (rev 42202)
+++ scummvm/branches/gsoc2009-16bit/engines/agos/agos.cpp 2009-07-07 07:09:56 UTC (rev 42203)
@@ -33,6 +33,8 @@
#include "agos/agos.h"
#include "agos/vga.h"
+#include "graphics/surface.h"
+
#include "sound/mididrv.h"
#include "sound/mods/protracker.h"
#include "sound/audiocd.h"
@@ -182,8 +184,6 @@
_subroutineList = 0;
- _dxSurfacePitch = 0;
-
_recursionDepth = 0;
_lastVgaTick = 0;
@@ -490,12 +490,12 @@
_backGroundBuf = 0;
_backBuf = 0;
_scaleBuf = 0;
+ _window4BackScn = 0;
+ _window6BackScn = 0;
_window3Flag = 0;
_window4Flag = 0;
_window6Flag = 0;
- _window4BackScn = 0;
- _window6BackScn = 0;
_moveXMin = 0;
_moveYMin = 0;
@@ -580,26 +580,34 @@
syncSoundSettings();
// allocate buffers
- _backGroundBuf = (byte *)calloc(_screenWidth * _screenHeight, 1);
+ _backGroundBuf = new Graphics::Surface();
+ _backGroundBuf->create(_screenWidth, _screenHeight, 1);
if (getGameType() == GType_FF || getGameType() == GType_PP) {
- _backBuf = (byte *)calloc(_screenWidth * _screenHeight, 1);
- _scaleBuf = (byte *)calloc(_screenWidth * _screenHeight, 1);
+ _backBuf = new Graphics::Surface();
+ _backBuf->create(_screenWidth, _screenHeight, 1);
+ _scaleBuf = new Graphics::Surface();
+ _scaleBuf->create(_screenWidth, _screenHeight, 1);
}
if (getGameType() == GType_SIMON2) {
- _window4BackScn = (byte *)calloc(_screenWidth * _screenHeight, 1);
+ _window4BackScn = new Graphics::Surface();
+ _window4BackScn->create(_screenWidth, _screenHeight, 1);
} else if (getGameType() == GType_SIMON1) {
- _window4BackScn = (byte *)calloc(_screenWidth * 134, 1);
+ _window4BackScn = new Graphics::Surface();
+ _window4BackScn->create(_screenWidth, 134, 1);
} else if (getGameType() == GType_WW || getGameType() == GType_ELVIRA2) {
- _window4BackScn = (byte *)calloc(224 * 127, 1);
+ _window4BackScn = new Graphics::Surface();
+ _window4BackScn->create(224, 127, 1);
} else if (getGameType() == GType_ELVIRA1) {
+ _window4BackScn = new Graphics::Surface();
if (getPlatform() == Common::kPlatformAmiga && (getFeatures() & GF_DEMO)) {
- _window4BackScn = (byte *)calloc(224 * 196, 1);
+ _window4BackScn->create(224, 196, 1);
} else {
- _window4BackScn = (byte *)calloc(224 * 144, 1);
+ _window4BackScn->create(224, 144, 1);
}
- _window6BackScn = (byte *)calloc(48 * 80, 1);
+ _window6BackScn = new Graphics::Surface();
+ _window6BackScn->create(48, 80, 1);
}
setupGame();
Modified: scummvm/branches/gsoc2009-16bit/engines/agos/agos.h
===================================================================
--- scummvm/branches/gsoc2009-16bit/engines/agos/agos.h 2009-07-07 07:02:04 UTC (rev 42202)
+++ scummvm/branches/gsoc2009-16bit/engines/agos/agos.h 2009-07-07 07:09:56 UTC (rev 42203)
@@ -276,8 +276,6 @@
Subroutine *_subroutineList;
- uint16 _dxSurfacePitch;
-
uint8 _recursionDepth;
uint32 _lastVgaTick;
@@ -527,8 +525,6 @@
uint8 _window3Flag;
uint8 _window4Flag;
uint8 _window6Flag;
- byte *_window4BackScn;
- byte *_window6BackScn;
uint16 _moveXMin, _moveYMin;
uint16 _moveXMax, _moveYMax;
@@ -566,9 +562,11 @@
byte _saveLoadType, _saveLoadSlot;
char _saveLoadName[108];
- byte *_backGroundBuf;
- byte *_backBuf;
- byte *_scaleBuf;
+ Graphics::Surface *_backGroundBuf;
+ Graphics::Surface *_backBuf;
+ Graphics::Surface *_scaleBuf;
+ Graphics::Surface *_window4BackScn;
+ Graphics::Surface *_window6BackScn;
Common::RandomSource _rnd;
Modified: scummvm/branches/gsoc2009-16bit/engines/agos/charset-fontdata.cpp
===================================================================
--- scummvm/branches/gsoc2009-16bit/engines/agos/charset-fontdata.cpp 2009-07-07 07:02:04 UTC (rev 42202)
+++ scummvm/branches/gsoc2009-16bit/engines/agos/charset-fontdata.cpp 2009-07-07 07:09:56 UTC (rev 42203)
@@ -2090,7 +2090,7 @@
void AGOSEngine::windowDrawChar(WindowBlock *window, uint x, uint y, byte chr) {
const byte *src;
byte color, *dst;
- uint h, w, i;
+ uint dstPitch, h, w, i;
if (_noOracleScroll)
return;
@@ -2100,7 +2100,8 @@
Graphics::Surface *screen = _system->lockScreen();
if (getGameType() == GType_FF || getGameType() == GType_PP) {
- dst = getBackGround() + y * _dxSurfacePitch + x + window->textColumnOffset;
+ dst = getBackGround();
+ dstPitch = _backGroundBuf->pitch;
h = 13;
w = getFeebleFontSize(chr);
@@ -2109,7 +2110,8 @@
else
src = feeble_windowFont + (chr - 32) * 13;
} else if (getGameType() == GType_SIMON1 || getGameType() == GType_SIMON2) {
- dst = (byte *)screen->pixels + y * _dxSurfacePitch + x + window->textColumnOffset;
+ dst = (byte *)screen->pixels;
+ dstPitch = screen->pitch;
h = 8;
w = 6;
@@ -2145,7 +2147,8 @@
error("windowDrawChar: Unknown language %d", _language);
}
} else if (getGameType() == GType_ELVIRA2 || getGameType() == GType_WW) {
- dst = (byte *)screen->pixels + y * _dxSurfacePitch + x + window->textColumnOffset;
+ dst = (byte *)screen->pixels;
+ dstPitch = screen->pitch;
h = 8;
w = 6;
@@ -2169,18 +2172,21 @@
error("windowDrawChar: Unknown language %d", _language);
}
} else if (getGameType() == GType_ELVIRA1) {
- dst = (byte *)screen->pixels + y * _dxSurfacePitch + x + window->textColumnOffset;
+ dst = (byte *)screen->pixels;
+ dstPitch = screen->pitch;
h = 8;
w = 6;
src = english_elvira1Font + (chr - 32) * 8;
} else {
- dst = (byte *)screen->pixels + y * _dxSurfacePitch + x + window->textColumnOffset;
+ dst = (byte *)screen->pixels;
+ dstPitch = screen->pitch;
h = 8;
w = 8;
src = english_pnFont + (chr - 32) * 8;
}
+ dst += y * dstPitch + x + window->textColumnOffset;
color = window->textColor;
if (getGameType() == GType_ELVIRA2 || getGameType() == GType_WW)
@@ -2201,7 +2207,7 @@
b <<= 1;
} while (++i != w);
- dst += _dxSurfacePitch;
+ dst += dstPitch;
} while (--h);
_system->unlockScreen();
Modified: scummvm/branches/gsoc2009-16bit/engines/agos/charset.cpp
===================================================================
--- scummvm/branches/gsoc2009-16bit/engines/agos/charset.cpp 2009-07-07 07:02:04 UTC (rev 42202)
+++ scummvm/branches/gsoc2009-16bit/engines/agos/charset.cpp 2009-07-07 07:09:56 UTC (rev 42203)
@@ -639,13 +639,13 @@
w = window->width * 8;
h = (window->height -1) * 8;
- dst = (byte *)screen->pixels + window->y * _screenWidth + window->x * 8;
- src = dst + 8 * _screenWidth;
+ dst = (byte *)screen->pixels + window->y * screen->pitch + window->x * 8;
+ src = dst + 8 * screen->pitch;
do {
memcpy(dst, src, w);
- src += _screenWidth;
- dst += _screenWidth;
+ src += screen->pitch;
+ dst += screen->pitch;
} while (--h);
_system->unlockScreen();
Modified: scummvm/branches/gsoc2009-16bit/engines/agos/draw.cpp
===================================================================
--- scummvm/branches/gsoc2009-16bit/engines/agos/draw.cpp 2009-07-07 07:02:04 UTC (rev 42202)
+++ scummvm/branches/gsoc2009-16bit/engines/agos/draw.cpp 2009-07-07 07:09:56 UTC (rev 42203)
@@ -35,18 +35,15 @@
namespace AGOS {
byte *AGOSEngine::getBackBuf() {
- _dxSurfacePitch = _screenWidth;
- return _backBuf;
+ return (byte *)_backBuf->pixels;
}
byte *AGOSEngine::getBackGround() {
- _dxSurfacePitch = _screenWidth;
- return _backGroundBuf;
+ return (byte *)_backGroundBuf->pixels;
}
byte *AGOSEngine::getScaleBuf() {
- _dxSurfacePitch = _screenWidth;
- return _scaleBuf;
+ return (byte *)_scaleBuf->pixels;
}
void AGOSEngine_Feeble::animateSpritesByY() {
@@ -166,7 +163,7 @@
_wallOn--;
VC10_state state;
- state.srcPtr = getBackGround() + 3 * _screenWidth + 3 * 16;
+ state.srcPtr = getBackGround() + 3 * _backGroundBuf->pitch + 3 * 16;
state.height = state.draw_height = 127;
state.width = state.draw_width = 14;
state.y = 0;
@@ -230,7 +227,7 @@
debug(0, "Using special wall");
uint8 color, h, len;
- byte *dst = _window4BackScn;
+ byte *dst = (byte *)_window4BackScn->pixels;
color = (_variableArray[293] & 1) ? 13 : 15;
_wallOn = 2;
@@ -260,7 +257,7 @@
} else if (getGameType() == GType_ELVIRA2 && _variableArray[71] & 2) {
// Used by the Unholy Barrier spell
uint8 color, h, len;
- byte *dst = _window4BackScn;
+ byte *dst = (byte *)_window4BackScn->pixels;
color = 1;
_wallOn = 2;
@@ -495,11 +492,11 @@
int16 y = vsp->y - _scrollY;
if (_window3Flag == 1) {
- animTable->srcPtr = (const byte *)_window4BackScn;
+ animTable->srcPtr = (const byte *)_window4BackScn->pixels;
} else {
int xoffs = (_videoWindows[vsp->windowNum * 4 + 0] * 2 + x) * 8;
int yoffs = (_videoWindows[vsp->windowNum * 4 + 1] + y);
- animTable->srcPtr = getBackGround() + xoffs + yoffs * _screenWidth;
+ animTable->srcPtr = getBackGround() + yoffs * _backGroundBuf->pitch + xoffs;
}
animTable->x = x;
@@ -571,39 +568,39 @@
dst = (byte *)screen->pixels;
- dst += (((_dxSurfacePitch / 4) * y_) * 4) + x_;
+ dst += (((screen->pitch / 4) * y_) * 4) + x_;
- b = _dxSurfacePitch;
+ b = screen->pitch;
dst[4] = color;
dst[b+1] = color;
dst[b+4] = color;
dst[b+7] = color;
- b += _dxSurfacePitch;
+ b += screen->pitch;
dst[b+2] = color;
dst[b+4] = color;
dst[b+6] = color;
- b += _dxSurfacePitch;
+ b += screen->pitch;
dst[b+3] = color;
dst[b+5] = color;
- b += _dxSurfacePitch;
+ b += screen->pitch;
dst[b] = color;
dst[b+1] = color;
dst[b+2] = color;
dst[b+6] = color;
dst[b+7] = color;
dst[b+8] = color;
- b += _dxSurfacePitch;
+ b += screen->pitch;
dst[b+3] = color;
dst[b+5] = color;
- b += _dxSurfacePitch;
+ b += screen->pitch;
dst[b+2] = color;
dst[b+4] = color;
dst[b+6] = color;
- b += _dxSurfacePitch;
+ b += screen->pitch;
dst[b+1] = color;
dst[b+4] = color;
dst[b+7] = color;
- b += _dxSurfacePitch;
+ b += screen->pitch;
dst[b+4] = color;
}
} while (ha++, --count);
@@ -645,7 +642,7 @@
}
src = _scrollImage + y / 2;
- decodeRow(dst, src + readUint32Wrapper(src), _scrollWidth, _dxSurfacePitch);
+ decodeRow(dst, src + readUint32Wrapper(src), _scrollWidth, _backGroundBuf->pitch);
_scrollY += _scrollFlag;
vcWriteVar(250, _scrollY);
@@ -670,13 +667,19 @@
src = _scrollImage + x / 2;
else
src = _scrollImage + x * 4;
- decodeColumn(dst, src + readUint32Wrapper(src), _scrollHeight, _dxSurfacePitch);
+ decodeColumn(dst, src + readUint32Wrapper(src), _scrollHeight, _backGroundBuf->pitch);
_scrollX += _scrollFlag;
vcWriteVar(251, _scrollX);
if (getGameType() == GType_SIMON2) {
- memcpy(_window4BackScn, _backGroundBuf, _scrollHeight * _screenWidth);
+ src = getBackGround();
+ dst = (byte *)_window4BackScn->pixels;
+ for (int i = 0; i < _scrollHeight; i++) {
+ memcpy(dst, src, _screenWidth);
+ src += _backGroundBuf->pitch;
+ dst += _window4BackScn->pitch;
+ }
} else {
fillBackFromBackGround(_scrollHeight, _screenWidth);
}
@@ -707,27 +710,53 @@
_system->fillScreen(0);
if (_backBuf) {
- memset(_backBuf, 0, _screenHeight * _screenWidth);
+ memset(getBackBuf(), 0, _backBuf->h * _backBuf->pitch);
}
}
void AGOSEngine::fillBackFromBackGround(uint16 height, uint16 width) {
- memcpy(_backBuf, _backGroundBuf, height * width);
+ byte *src = getBackGround();
+ byte *dst = getBackBuf();
+ for (int i = 0; i < height; i++) {
+ memcpy(dst, src, width);
+ src += _backGroundBuf->pitch;
+ dst += _backBuf->pitch;
+ }
}
void AGOSEngine::fillBackFromFront() {
Graphics::Surface *screen = _system->lockScreen();
- memcpy(_backBuf, (byte *)screen->pixels, _screenHeight * _screenWidth);
+ byte *src = (byte *)screen->pixels;
+ byte *dst = getBackBuf();
+
+ for (int i = 0; i < _screenHeight; i++) {
+ memcpy(dst, src, _screenWidth);
+ src += screen->pitch;
+ dst += _backBuf->pitch;
+ }
_system->unlockScreen();
}
void AGOSEngine::fillBackGroundFromBack() {
- memcpy(_backGroundBuf, _backBuf, _screenHeight * _screenWidth);
+ byte *src = getBackBuf();
+ byte *dst = getBackGround();
+ for (int i = 0; i < _screenHeight; i++) {
+ memcpy(dst, src, _screenWidth);
+ src += _backBuf->pitch;
+ dst += _backGroundBuf->pitch;
+ }
}
void AGOSEngine::fillBackGroundFromFront() {
Graphics::Surface *screen = _system->lockScreen();
- memcpy(_backGroundBuf, (byte *)screen->pixels, _screenHeight * _screenWidth);
+ byte *src = (byte *)screen->pixels;
+ byte *dst = getBackGround();
+
+ for (int i = 0; i < _screenHeight; i++) {
+ memcpy(dst, src, _screenWidth);
+ src += screen->pitch;
+ dst += _backGroundBuf->pitch;
+ }
_system->unlockScreen();
}
@@ -756,8 +785,13 @@
Graphics::Surface *screen = _system->lockScreen();
if (getGameType() == GType_PP || getGameType() == GType_FF) {
- memcpy((byte *)screen->pixels, getBackBuf(), _screenWidth * _screenHeight);
-
+ byte *src = getBackBuf();
+ byte *dst = (byte *)screen->pixels;
+ for (int i = 0; i < _screenHeight; i++) {
+ memcpy(dst, src, _screenWidth);
+ src += _backBuf->pitch;
+ dst += screen->pitch;
+ }
if (getGameId() != GID_DIMP)
fillBackFromBackGround(_screenHeight, _screenWidth);
} else {
@@ -767,12 +801,12 @@
uint16 srcWidth, width, height;
byte *dst = (byte *)screen->pixels;
- const byte *src = _window4BackScn;
+ const byte *src = (const byte *)_window4BackScn->pixels;
if (_window3Flag == 1) {
src = getBackGround();
}
- dst += (_moveYMin + _videoWindows[17]) * _screenWidth;
+ dst += (_moveYMin + _videoWindows[17]) * screen->pitch;
dst += (_videoWindows[16] * 16) + _moveXMin;
src += (_videoWindows[18] * 16 * _moveYMin);
@@ -785,7 +819,7 @@
for (; height > 0; height--) {
memcpy(dst, src, width);
- dst += _screenWidth;
+ dst += screen->pitch;
src += srcWidth;
}
@@ -798,12 +832,12 @@
if (_window6Flag == 2) {
_window6Flag = 0;
- byte *src = _window6BackScn;
- byte *dst = (byte *)screen->pixels + 16320;
+ byte *src = (byte *)_window6BackScn->pixels;
+ byte *dst = (byte *)screen->pixels + 51 * screen->pitch;
for (int i = 0; i < 80; i++) {
- memcpy(dst, src, 48);
- dst += _screenWidth;
- src += 48;
+ memcpy(dst, src, _window6BackScn->w);
+ dst += screen->pitch;
+ src += _window6BackScn->pitch;
}
}
}
Modified: scummvm/branches/gsoc2009-16bit/engines/agos/event.cpp
===================================================================
--- scummvm/branches/gsoc2009-16bit/engines/agos/event.cpp 2009-07-07 07:02:04 UTC (rev 42202)
+++ scummvm/branches/gsoc2009-16bit/engines/agos/event.cpp 2009-07-07 07:09:56 UTC (rev 42203)
@@ -367,12 +367,12 @@
const uint8 y = (getPlatform() == Common::kPlatformAtariST) ? 132 : 135;
Graphics::Surface *screen = _system->lockScreen();
- byte *dst = (byte *)screen->pixels + y * _screenWidth + xoffs;
+ byte *dst = (byte *)screen->pixels + y * screen->pitch + xoffs;
for (uint h = 0; h < 6; h++) {
memcpy(dst, src, 4);
src += 4;
- dst += _screenWidth;
+ dst += screen->pitch;
}
_system->unlockScreen();
Modified: scummvm/branches/gsoc2009-16bit/engines/agos/gfx.cpp
===================================================================
--- scummvm/branches/gsoc2009-16bit/engines/agos/gfx.cpp 2009-07-07 07:02:04 UTC (rev 42202)
+++ scummvm/branches/gsoc2009-16bit/engines/agos/gfx.cpp 2009-07-07 07:09:56 UTC (rev 42203)
@@ -272,13 +272,13 @@
byte *src = getScaleBuf();
byte *dst = getBackBuf();
- dst += _dxSurfacePitch * dstRect.top + dstRect.left;
+ dst += dstRect.top * _backBuf->pitch + dstRect.left;
for (int dstY = 0; dstY < scaledH; dstY++) {
if (dstRect.top + dstY >= 0 && dstRect.top + dstY < _screenHeight) {
int srcY = (dstY * h) / scaledH;
- byte *srcPtr = src + _dxSurfacePitch * srcY;
- byte *dstPtr = dst + _dxSurfacePitch * dstY;
+ byte *srcPtr = src + _scaleBuf->pitch * srcY;
+ byte *dstPtr = dst + _backBuf->pitch * dstY;
for (int dstX = 0; dstX < scaledW; dstX++) {
if (dstRect.left + dstX >= 0 && dstRect.left + dstX < _screenWidth) {
int srcX = (dstX * w) / scaledW;
@@ -292,12 +292,12 @@
void AGOSEngine_Feeble::drawImage(VC10_state *state) {
state->surf_addr = getBackBuf();
- state->surf_pitch = _dxSurfacePitch;
+ state->surf_pitch = _backBuf->pitch;
if (state->flags & kDFCompressed) {
if (state->flags & kDFScaled) {
state->surf_addr = getScaleBuf();
- state->surf_pitch = _dxSurfacePitch;
+ state->surf_pitch = _scaleBuf->pitch;
uint w, h;
byte *src, *dst, *dstPtr;
@@ -314,7 +314,7 @@
h = 0;
do {
*dst = *src;
- dst += _screenWidth;
+ dst += state->surf_pitch;
src++;
} while (++h != state->draw_height);
dstPtr++;
@@ -330,7 +330,7 @@
}
} else if (state->flags & kDFOverlayed) {
state->surf_addr = getScaleBuf();
- state->surf_pitch = _dxSurfacePitch;
+ state->surf_pitch = _scaleBuf->pitch;
state->surf_addr += (state->x + _scrollX) + (state->y + _scrollY) * state->surf_pitch;
uint w, h;
@@ -352,7 +352,7 @@
color = *src;
if (color != 0)
*dst = color;
- dst += _screenWidth;
+ dst += state->surf_pitch;
src++;
} while (++h != state->draw_height);
dstPtr++;
@@ -406,7 +406,7 @@
color = *src;
if (color)
*dst = color;
- dst += _screenWidth;
+ dst += state->surf_pitch;
src++;
} while (++h != state->draw_height);
dstPtr++;
@@ -425,7 +425,7 @@
color = *src;
if ((state->flags & kDFNonTrans) || color != 0)
*dst = color;
- dst += _screenWidth;
+ dst += state->surf_pitch;
src++;
} while (++h != state->draw_height);
dstPtr++;
@@ -456,7 +456,7 @@
dst[count] = color;
}
}
- dst += _screenWidth;
+ dst += state->surf_pitch;
src += state->width;
} while (--state->draw_height);
}
@@ -557,8 +557,8 @@
dst[count * 2 + 1] = src[count * 2 + 1];
}
}
- src += _screenWidth;
- dst += _screenWidth;
+ src += state->surf2_pitch;
+ dst += state->surf_pitch;
mask += state->width * 8;
} while (--state->draw_height);
}
@@ -615,7 +615,7 @@
dst += 8;
src += 5;
} while (--count);
- dstPtr += _screenWidth;
+ dstPtr += state->surf_pitch;
} while (--state->draw_height);
} else {
src = state->srcPtr + (state->width * state->y_skip * 16) + (state->x_skip * 8);
@@ -628,7 +628,7 @@
for (i = 0; i != state->draw_width; i++)
if ((state->flags & kDFNonTrans) || src[i])
dst[i] = src[i] + state->paletteMod;
- dst += _screenWidth;
+ dst += state->surf_pitch;
src += state->width * 16;
} while (--h);
}
@@ -648,10 +648,10 @@
uint16 xoffs, yoffs;
if (getGameType() == GType_SIMON2) {
state->surf2_addr = getBackGround();
- state->surf2_pitch = _screenWidth;
+ state->surf2_pitch = _backGroundBuf->pitch;
- state->surf_addr = _window4BackScn;
- state->surf_pitch = _screenWidth;
+ state->surf_addr = (byte *)_window4BackScn->pixels;
+ state->surf_pitch = _window4BackScn->pitch;
xoffs = ((vlut[0] - _videoWindows[16]) * 2 + state->x) * 8;
yoffs = (vlut[1] - _videoWindows[17] + state->y);
@@ -665,9 +665,9 @@
// The DOS Floppy demo was based off Waxworks engine
if (_windowNum == 4 || (_windowNum >= 10 && _windowNum <= 27)) {
state->surf2_addr = getBackGround();
- state->surf2_pitch = _screenWidth;
+ state->surf2_pitch = _backGroundBuf->pitch;
- state->surf_addr = _window4BackScn;
+ state->surf_addr = (byte *)_window4BackScn;
state->surf_pitch = _videoWindows[18] * 16;
xoffs = ((vlut[0] - _videoWindows[16]) * 2 + state->x) * 8;
@@ -680,7 +680,7 @@
_window4Flag = 1;
} else {
state->surf_addr = (byte *)screen->pixels;
- state->surf_pitch = _screenWidth;
+ state->surf_pitch = screen->pitch;
xoffs = (vlut[0] * 2 + state->x) * 8;
yoffs = vlut[1] + state->y;
@@ -689,16 +689,16 @@
if (_windowNum == 3 || _windowNum == 4 || _windowNum >= 10) {
if (_window3Flag == 1) {
state->surf2_addr = getBackGround();
- state->surf2_pitch = _screenWidth;
+ state->surf2_pitch = _backGroundBuf->pitch;
state->surf_addr = getBackGround();
- state->surf_pitch = _screenWidth;
+ state->surf_pitch = _backGroundBuf->pitch;
} else {
state->surf2_addr = getBackGround();
- state->surf2_pitch = _screenWidth;
+ state->surf2_pitch = _backGroundBuf->pitch;
- state->surf_addr = _window4BackScn;
- state->surf_pitch = _screenWidth;
+ state->surf_addr = (byte *)_window4BackScn->pixels;
+ state->surf_pitch = _window4BackScn->pitch;
}
xoffs = ((vlut[0] - _videoWindows[16]) * 2 + state->x) * 8;
@@ -711,10 +711,10 @@
_window4Flag = 1;
} else {
state->surf2_addr = getBackGround();
- state->surf2_pitch = _screenWidth;
+ state->surf2_pitch = _backGroundBuf->pitch;
state->surf_addr = (byte *)screen->pixels;
- state->surf_pitch = _screenWidth;
+ state->surf_pitch = screen->pitch;
xoffs = (vlut[0] * 2 + state->x) * 8;
yoffs = vlut[1] + state->y;
@@ -862,7 +862,7 @@
uint16 xoffs = 0, yoffs = 0;
if (getGameType() == GType_WW) {
if (_windowNum == 4 || (_windowNum >= 10 && _windowNum <= 27)) {
- state->surf_addr = _window4BackScn;
+ state->surf_addr = (byte *)_window4BackScn->pixels;
state->surf_pitch = _videoWindows[18] * 16;
xoffs = ((vlut[0] - _videoWindows[16]) * 2 + state->x) * 8;
@@ -875,14 +875,14 @@
_window4Flag = 1;
} else {
state->surf_addr = (byte *)screen->pixels;
- state->surf_pitch = _screenWidth;
+ state->surf_pitch = screen->pitch;
xoffs = (vlut[0] * 2 + state->x) * 8;
yoffs = vlut[1] + state->y;
}
} else if (getGameType() == GType_ELVIRA2) {
if (_windowNum == 4 || _windowNum >= 10) {
- state->surf_addr = _window4BackScn;
+ state->surf_addr = (byte *)_window4BackScn->pixels;
state->surf_pitch = _videoWindows[18] * 16;
xoffs = ((vlut[0] - _videoWindows[16]) * 2 + state->x) * 8;
@@ -895,26 +895,26 @@
_window4Flag = 1;
} else {
state->surf_addr = (byte *)screen->pixels;
- state->surf_pitch = _screenWidth;
+ state->surf_pitch = screen->pitch;
xoffs = (vlut[0] * 2 + state->x) * 8;
yoffs = vlut[1] + state->y;
}
} else if (getGameType() == GType_ELVIRA1) {
if (_windowNum == 6) {
- state->surf_addr = _window6BackScn;
- state->surf_pitch = 48;
+ state->surf_addr = (byte *)_window6BackScn->pixels;
+ state->surf_pitch = _window6BackScn->pitch;
xoffs = state->x * 8;
yoffs = state->y;
} else if (_windowNum == 2 || _windowNum == 3) {
state->surf_addr = (byte *)screen->pixels;
- state->surf_pitch = _screenWidth;
+ state->surf_pitch = screen->pitch;
xoffs = (vlut[0] * 2 + state->x) * 8;
yoffs = vlut[1] + state->y;
} else {
- state->surf_addr = _window4BackScn;
+ state->surf_addr = (byte *)_window4BackScn->pixels;
state->surf_pitch = _videoWindows[18] * 16;
xoffs = ((vlut[0] - _videoWindows[16]) * 2 + state->x) * 8;
@@ -928,7 +928,7 @@
}
} else {
state->surf_addr = (byte *)screen->pixels;
- state->surf_pitch = _screenWidth;
+ state->surf_pitch = screen->pitch;
xoffs = (vlut[0] * 2 + state->x) * 8;
yoffs = vlut[1] + state->y;
@@ -957,7 +957,7 @@
void AGOSEngine::horizontalScroll(VC10_state *state) {
const byte *src;
byte *dst;
- int w;
+ int dstPitch, w;
if (getGameType() == GType_FF)
_scrollXMax = state->width - 640;
@@ -974,9 +974,11 @@
vcWriteVar(251, _scrollX);
if (getGameType() == GType_SIMON2) {
- dst = _window4BackScn;
+ dst = (byte *)_window4BackScn->pixels;
+ dstPitch = _window4BackScn->pitch;
} else {
dst = getBackBuf();
+ dstPitch = _backBuf->pitch;
}
if (getGameType() == GType_FF)
@@ -985,7 +987,7 @@
src = state->srcPtr + _scrollX * 4;
for (w = 0; w < _screenWidth; w += 8) {
- decodeColumn(dst, src + readUint32Wrapper(src), state->height, _dxSurfacePitch);
+ decodeColumn(dst, src + readUint32Wrapper(src), state->height, dstPitch);
dst += 8;
src += 4;
}
@@ -1015,7 +1017,7 @@
src = state->srcPtr + _scrollY / 2;
for (h = 0; h < _screenHeight; h += 8) {
- decodeRow(dst, src + READ_LE_UINT32(src), state->width, _dxSurfacePitch);
+ decodeRow(dst, src + READ_LE_UINT32(src), state->width, _backBuf->pitch);
dst += 8 * state->width;
src += 4;
}
@@ -1366,21 +1368,21 @@
uint height = _videoWindows[updateWindow * 4 + 3];
Graphics::Surface *screen = _system->lockScreen();
- byte *dst = getBackGround() + xoffs + yoffs * _screenWidth;
+ byte *dst = (byte *)_backGroundBuf->getBasePtr(xoffs, yoffs);
byte *src = 0;
uint srcWidth = 0;
if (getGameType() == GType_SIMON2) {
- src = _window4BackScn + xoffs + yoffs * 320;
+ src = (byte *)_window4BackScn->getBasePtr(xoffs, yoffs);
srcWidth = 320;
} else if (getGameType() == GType_SIMON1 && (getFeatures() & GF_DEMO)) {
// The DOS Floppy demo was based off Waxworks engine
if (updateWindow == 4 || updateWindow >= 10) {
- src = _window4BackScn;
+ src = (byte *)_window4BackScn->pixels;
srcWidth = _videoWindows[18] * 16;
} else if (updateWindow == 3 || updateWindow == 9) {
- src = (byte *)screen->pixels + xoffs + yoffs * _screenWidth;
- srcWidth = _screenWidth;
+ src = (byte *)screen->pixels + yoffs * screen->pitch + xoffs;
+ srcWidth = screen->pitch;
} else {
_system->unlockScreen();
_videoLockOut &= ~0x20;
@@ -1388,14 +1390,14 @@
}
} else if (getGameType() == GType_SIMON1) {
if (updateWindow == 4) {
- src = _window4BackScn;
+ src = (byte *)_window4BackScn->pixels;
srcWidth = _videoWindows[18] * 16;
} else if (updateWindow >= 10) {
- src = _window4BackScn + xoffs + yoffs * 320;
+ src = (byte *)_window4BackScn->pixels + xoffs + yoffs * 320;
srcWidth = _videoWindows[18] * 16;
} else if (updateWindow == 0) {
- src = (byte *)screen->pixels + xoffs + yoffs * _screenWidth;
- srcWidth = _screenWidth;
+ src = (byte *)screen->pixels + yoffs * screen->pitch + xoffs;
+ srcWidth = screen->pitch;
} else {
_system->unlockScreen();
_videoLockOut &= ~0x20;
@@ -1403,11 +1405,11 @@
}
} else if (getGameType() == GType_WW) {
if (updateWindow == 4 || updateWindow >= 10) {
- src = _window4BackScn;
+ src = (byte *)_window4BackScn->pixels;
srcWidth = _videoWindows[18] * 16;
} else if (updateWindow == 3 || updateWindow == 9) {
- src = (byte *)screen->pixels + xoffs + yoffs * _screenWidth;
- srcWidth = _screenWidth;
+ src = (byte *)screen->pixels + yoffs * screen->pitch + xoffs;
+ srcWidth = screen->pitch;
} else {
_system->unlockScreen();
_videoLockOut &= ~0x20;
@@ -1415,11 +1417,11 @@
}
} else if (getGameType() == GType_ELVIRA2) {
if (updateWindow == 4 || updateWindow >= 10) {
- src = _window4BackScn;
+ src = (byte *)_window4BackScn->pixels;
srcWidth = _videoWindows[18] * 16;
} else if (updateWindow == 3) {
- src = (byte *)screen->pixels + xoffs + yoffs * _screenWidth;
- srcWidth = _screenWidth;
+ src = (byte *)screen->pixels + yoffs * screen->pitch + xoffs;
+ srcWidth = screen->pitch;
} else {
_system->unlockScreen();
_videoLockOut &= ~0x20;
@@ -1428,25 +1430,25 @@
} else if (getGameType() == GType_ELVIRA1) {
if (updateWindow == 6) {
_window6Flag = 1;
- src = _window6BackScn;
+ src = (byte *)_window6BackScn->pixels;
srcWidth = 48;
} else if (updateWindow == 2 || updateWindow == 3) {
- src = (byte *)screen->pixels + xoffs + yoffs * _screenWidth;
- srcWidth = _screenWidth;
+ src = (byte *)screen->pixels + yoffs * screen->pitch + xoffs;
+ srcWidth = screen->pitch;
} else {
- src = _window4BackScn;
+ src = (byte *)_window4BackScn->pixels;
srcWidth = _videoWindows[18] * 16;
}
} else {
- src = (byte *)screen->pixels + xoffs + yoffs * _screenWidth;
- srcWidth = _screenWidth;
+ src = (byte *)screen->pixels + yoffs * screen->pitch + xoffs;
+ srcWidth = screen->pitch;
}
_boxStarHeight = height;
for (; height > 0; height--) {
memcpy(dst, src, width);
- dst += _screenWidth;
+ dst += _backGroundBuf->pitch;
src += srcWidth;
}
@@ -1455,15 +1457,15 @@
dst = (byte *)screen->pixels + 48;
memset(dst, color, 224);
- dst = (byte *)screen->pixels + 132 * _screenWidth + 48;
+ dst = (byte *)screen->pixels + 132 * screen->pitch + 48;
memset(dst, color, 224);
} else if (getGameType() == GType_ELVIRA1 && updateWindow == 3 && _bottomPalette) {
- dst = (byte *)screen->pixels + 133 * _screenWidth;
- int size = 67 * _screenWidth;
+ dst = (byte *)screen->pixels + 133 * screen->pitch;
- while (size--) {
- *dst += 0x10;
- dst++;
+ for (int h = 0; h < 67; h++) {
+ for (int w = 0; w < _screenWidth; w++)
+ dst[w] += 0x10;
+ dst += screen->pitch;
}
}
@@ -1480,16 +1482,16 @@
Graphics::Surface *screen = _system->lockScreen();
- dst = (byte *)screen->pixels + 136 * _screenWidth;
+ dst = (byte *)screen->pixels + 136 * screen->pitch;
uint8 len = 52;
while (len--) {
dst[0] = color;
dst[319] = color;
- dst += _screenWidth;
+ dst += screen->pitch;
}
- dst = (byte *)screen->pixels + 187 * _screenWidth;
+ dst = (byte *)screen->pixels + 187 * screen->pitch;
memset(dst, color, _screenWidth);
_system->unlockScreen();
Modified: scummvm/branches/gsoc2009-16bit/engines/agos/icons.cpp
===================================================================
--- scummvm/branches/gsoc2009-16bit/engines/agos/icons.cpp 2009-07-07 07:02:04 UTC (rev 42202)
+++ scummvm/branches/gsoc2009-16bit/engines/agos/icons.cpp 2009-07-07 07:09:56 UTC (rev 42203)
@@ -211,15 +211,15 @@
dst += 110;
dst += x;
- dst += (y + window->y) * _dxSurfacePitch;
+ dst += (y + window->y) * screen->pitch;
src = _iconFilePtr;
src += READ_LE_UINT16(src + icon * 4 + 0);
- decompressIcon(dst, src, 20, 10, 224, _dxSurfacePitch);
+ decompressIcon(dst, src, 20, 10, 224, screen->pitch);
src = _iconFilePtr;
src += READ_LE_UINT16(src + icon * 4 + 2);
- decompressIcon(dst, src, 20, 10, 208, _dxSurfacePitch);
+ decompressIcon(dst, src, 20, 10, 208, screen->pitch);
_system->unlockScreen();
@@ -236,17 +236,17 @@
dst = (byte *)screen->pixels;
dst += (x + window->x) * 8;
- dst += (y * 25 + window->y) * _dxSurfacePitch;
+ dst += (y * 25 + window->y) * screen->pitch;
if (getPlatform() == Common::kPlatformAmiga) {
src = _iconFilePtr;
src += READ_BE_UINT32(src + icon * 4);
uint8 color = (getFeatures() & GF_32COLOR) ? 224 : 240;
- decompressIconPlanar(dst, src, 24, 12, color, _dxSurfacePitch);
+ decompressIconPlanar(dst, src, 24, 12, color, screen->pitch);
} else {
src = _iconFilePtr;
src += READ_LE_UINT16(src + icon * 2);
- decompressIcon(dst, src, 24, 12, 224, _dxSurfacePitch);
+ decompressIcon(dst, src, 24, 12, 224, screen->pitch);
}
_system->unlockScreen();
@@ -264,17 +264,17 @@
dst = (byte *)screen->pixels;
dst += (x + window->x) * 8;
- dst += (y * 20 + window->y) * _dxSurfacePitch;
+ dst += (y * 20 + window->y) * screen->pitch;
uint8 color = dst[0] & 0xF0;
if (getPlatform() == Common::kPlatformAmiga) {
src = _iconFilePtr;
src += READ_BE_UINT32(src + icon * 4);
- decompressIconPlanar(dst, src, 24, 10, color, _dxSurfacePitch);
+ decompressIconPlanar(dst, src, 24, 10, color, screen->pitch);
} else {
src = _iconFilePtr;
src += READ_LE_UINT16(src + icon * 2);
- decompressIcon(dst, src, 24, 10, color, _dxSurfacePitch);
+ decompressIcon(dst, src, 24, 10, color, screen->pitch);
}
_system->unlockScreen();
@@ -292,17 +292,17 @@
dst = (byte *)screen->pixels;
dst += (x + window->x) * 8;
- dst += (y * 8 + window->y) * _dxSurfacePitch;
+ dst += (y * 8 + window->y) * screen->pitch;
uint color = dst[0] & 0xF0;
if (getFeatures() & GF_PLANAR) {
src = _iconFilePtr;
src += READ_BE_UINT32(src + icon * 4);
- decompressIconPlanar(dst, src, 24, 12, color, _dxSurfacePitch);
+ decompressIconPlanar(dst, src, 24, 12, color, screen->pitch);
} else {
src = _iconFilePtr;
src += READ_LE_UINT16(src + icon * 2);
- decompressIcon(dst, src, 24, 12, color, _dxSurfacePitch);
+ decompressIcon(dst, src, 24, 12, color, screen->pitch);
}
_system->unlockScreen();
@@ -320,16 +320,16 @@
dst = (byte *)screen->pixels;
dst += (x + window->x) * 8;
- dst += (y * 8 + window->y) * _dxSurfacePitch;
+ dst += (y * 8 + window->y) * screen->pitch;
if (getFeatures() & GF_PLANAR) {
src = _iconFilePtr;
src += READ_BE_UINT16(src + icon * 2);
- decompressIconPlanar(dst, src, 24, 12, 16, _dxSurfacePitch);
+ decompressIconPlanar(dst, src, 24, 12, 16, screen->pitch);
} else {
src = _iconFilePtr;
src += icon * 288;
- decompressIconPlanar(dst, src, 24, 12, 16, _dxSurfacePitch, false);
+ decompressIconPlanar(dst, src, 24, 12, 16, screen->pitch, false);
}
_system->unlockScreen();
@@ -344,14 +344,14 @@
_videoLockOut |= 0x8000;
Graphics::Surface *screen = _system->lockScreen();
- dst = (byte *)screen->pixels + y * _dxSurfacePitch + x * 8;
+ dst = (byte *)screen->pixels + y * screen->pitch + x * 8;
src = _iconFilePtr + icon * 146;
if (icon == 0xFF) {
// Draw Blank Icon
for (int yp = 0; yp < 24; yp++) {
memset(dst, 0, 24);
- dst += _dxSurfacePitch;
+ dst += screen->pitch;
}
} else {
uint8 palette[4];
@@ -364,7 +364,7 @@
uint32 v1 = (READ_BE_UINT16(src) << 8) | *(src + 4);
uint32 v2 = (READ_BE_UINT16(src + 2) << 8) | *(src + 5);
for (int xp = 0; xp < 24; ++xp, v1 >>= 1, v2 >>= 1) {
- dst[yp * _screenWidth + (23 - xp)] = palette[((v1 & 1) << 1) | (v2 & 1)];
+ dst[yp * screen->pitch + (23 - xp)] = palette[((v1 & 1) << 1) | (v2 & 1)];
}
}
}
@@ -952,7 +952,7 @@
}
Graphics::Surface *screen = _system->lockScreen();
- byte *dst = (byte *)screen->pixels + y * _screenWidth + x * 8;
+ byte *dst = (byte *)screen->pixels + y * screen->pitch + x * 8;
for (h = 0; h < 19; h++) {
for (w = 0; w < 16; w++) {
@@ -960,7 +960,7 @@
}
src += dir;
- dst+= _screenWidth;
+ dst+= screen->pitch;
}
_system->unlockScreen();
@@ -1043,7 +1043,7 @@
// Personal Nightmare specific
void AGOSEngine_PN::drawIconHitBar() {
Graphics::Surface *screen = _system->lockScreen();
- byte *dst = (byte *)screen->pixels + 3 * _dxSurfacePitch + 6 * 8;
+ byte *dst = (byte *)screen->pixels + 3 * screen->pitch + 6 * 8;
const byte *src = hitBarData;
uint8 color = (getPlatform() == Common::kPlatformPC) ? 7 : 15;
@@ -1058,7 +1058,7 @@
b <<= 1;
}
}
- dst += _dxSurfacePitch;
+ dst += screen->pitch;
}
_system->unlockScreen();
Modified: scummvm/branches/gsoc2009-16bit/engines/agos/menus.cpp
===================================================================
--- scummvm/branches/gsoc2009-16bit/engines/agos/menus.cpp 2009-07-07 07:02:04 UTC (rev 42202)
+++ scummvm/branches/gsoc2009-16bit/engines/agos/menus.cpp 2009-07-07 07:09:56 UTC (rev 42203)
@@ -170,7 +170,7 @@
mouseOff();
Graphics::Surface *screen = _system->lockScreen();
- src = (byte *)screen->pixels + 2832;
+ src = (byte *)screen->pixels + 8 * screen->pitch + 272;
w = 48;
h = 82;
@@ -179,7 +179,7 @@
if (src[i] != 0)
src[i] = 14;
}
- src += _dxSurfacePitch;
+ src += screen->pitch;
} while (--h);
for (i = 120; i != 130; i++)
@@ -198,7 +198,7 @@
mouseOff();
Graphics::Surface *screen = _system->lockScreen();
- src = (byte *)screen->pixels + ha->y * _dxSurfacePitch + ha->x;
+ src = (byte *)screen->pixels + ha->y * screen->pitch + ha->x;
w = ha->width;
h = ha->height;
@@ -207,7 +207,7 @@
if (src[i] == 14)
src[i] = 15;
}
- src += _dxSurfacePitch;
+ src += screen->pitch;
} while (--h);
_system->unlockScreen();
Modified: scummvm/branches/gsoc2009-16bit/engines/agos/oracle.cpp
===================================================================
--- scummvm/branches/gsoc2009-16bit/engines/agos/oracle.cpp 2009-07-07 07:02:04 UTC (rev 42202)
+++ scummvm/branches/gsoc2009-16bit/engines/agos/oracle.cpp 2009-07-07 07:09:56 UTC (rev 42203)
@@ -246,28 +246,28 @@
byte *src, *dst;
uint16 w, h;
- dst = getBackGround() + 103 * _screenWidth + 136;
- src = getBackGround() + 106 * _screenWidth + 136;
+ dst = getBackGround() + 103 * _backGroundBuf->pitch + 136;
+ src = getBackGround() + 106 * _backGroundBuf->pitch + 136;
for (h = 0; h < 21; h++) {
for (w = 0; w < 360; w++) {
if (dst[w] == 0 || dst[w] == 113 || dst[w] == 116 || dst[w] == 252)
dst[w] = src[w];
}
- dst += _screenWidth;
- src += _screenWidth;
+ dst += _backGroundBuf->pitch;
+ src += _backGroundBuf->pitch;
}
for (h = 0; h < 80; h++) {
memcpy(dst, src, 360);
- dst += _screenWidth;
- src += _screenWidth;
+ dst += _backGroundBuf->pitch;
+ src += _backGroundBuf->pitch;
}
for (h = 0; h < 3; h++) {
memset(dst, 0, 360);
- dst += _screenWidth;
- src += _screenWidth;
+ dst += _backGroundBuf->pitch;
+ src += _backGroundBuf->pitch;
}
}
@@ -275,13 +275,13 @@
byte *src, *dst;
uint16 w, h;
- src = getBackGround() + 203 * _screenWidth + 136;
- dst = getBackGround() + 206 * _screenWidth + 136;
+ src = getBackGround() + 203 * _backGroundBuf->pitch + 136;
+ dst = getBackGround() + 206 * _backGroundBuf->pitch + 136;
for (h = 0; h < 77; h++) {
memcpy(dst, src, 360);
- dst -= _screenWidth;
- src -= _screenWidth;
+ dst -= _backGroundBuf->pitch;
+ src -= _backGroundBuf->pitch;
}
for (h = 0; h < 24; h++) {
@@ -294,8 +294,8 @@
src[w] = 0;
}
}
- dst -= _screenWidth;
- src -= _screenWidth;
+ dst -= _backGroundBuf->pitch;
+ src -= _backGroundBuf->pitch;
}
}
@@ -315,7 +315,7 @@
srcRect.bottom = 43;
src = _iconFilePtr;
- dst = getBackBuf() + _screenWidth * dstRect.top + dstRect.left;
+ dst = getBackBuf() + _backBuf->pitch * dstRect.top + dstRect.left;
for (h = 0; h < dstRect.height(); h++) {
for (w = 0; w < dstRect.width(); w++) {
@@ -323,7 +323,7 @@
dst[w] = src[w];
}
src += 336;
- dst += _screenWidth;
+ dst += _backBuf->pitch;
}
}
@@ -355,7 +355,7 @@
srcRect.right = srcRect.left + 42;
src = _iconFilePtr + srcRect.top * 336 + srcRect.left;
- dst = getBackBuf() + _screenWidth * dstRect.top + dstRect.left;
+ dst = getBackBuf() + _backBuf->pitch * dstRect.top + dstRect.left;
for (h = 0; h < dstRect.height(); h++) {
for (w = 0; w < dstRect.width(); w++) {
@@ -363,7 +363,7 @@
dst[w] = src[w];
}
src += 336;
- dst += _screenWidth;
+ dst += _backBuf->pitch;
}
}
@@ -506,14 +506,14 @@
x = window->x + window->textColumn;
y = window->y + window->textRow;
- dst = getBackGround() + _dxSurfacePitch * y + x;
+ dst = getBackGround() + _backGroundBuf->pitch * y + x;
for (h = 0; h < 13; h++) {
for (w = 0; w < 8; w++) {
if (dst[w] == 113 || dst[w] == 116 || dst[w] == 252)
dst[w] = 0;
}
- dst += _screenWidth;
+ dst += _backGroundBuf->pitch;
}
_videoLockOut &= ~0x8000;
Modified: scummvm/branches/gsoc2009-16bit/engines/agos/verb.cpp
===================================================================
--- scummvm/branches/gsoc2009-16bit/engines/agos/verb.cpp 2009-07-07 07:02:04 UTC (rev 42202)
+++ scummvm/branches/gsoc2009-16bit/engines/agos/verb.cpp 2009-07-07 07:09:56 UTC (rev 42203)
@@ -967,7 +967,7 @@
_videoLockOut |= 0x8000;
Graphics::Surface *screen = _system->lockScreen();
- src = (byte *)screen->pixels + ha->y * _dxSurfacePitch + ha->x;
+ src = (byte *)screen->pixels + ha->y * screen->pitch + ha->x;
// WORKAROUND: Hitareas for saved game names aren't adjusted for scrolling locations
if (getGameType() == GType_SIMON2 && ha->id >= 208 && ha->id <= 213) {
@@ -1019,7 +1019,7 @@
}
}
}
- src += _dxSurfacePitch;
+ src += screen->pitch;
} while (--h);
_system->unlockScreen();
Modified: scummvm/branches/gsoc2009-16bit/engines/agos/vga.cpp
===================================================================
--- scummvm/branches/gsoc2009-16bit/engines/agos/vga.cpp 2009-07-07 07:02:04 UTC (rev 42202)
+++ scummvm/branches/gsoc2009-16bit/engines/agos/vga.cpp 2009-07-07 07:09:56 UTC (rev 42203)
@@ -1182,11 +1182,12 @@
void AGOSEngine::vc32_saveScreen() {
if (getGameType() == GType_PN) {
Graphics::Surface *screen = _system->lockScreen();
-
byte *dst = getBackGround();
byte *src = (byte *)screen->pixels;
- memcpy(dst, src, 64000);
-
+ for (int i = 0; i < _screenHeight; i++) {
+ memcpy(dst, src, _screenWidth);
+ dst += screen->pitch;
+ }
_system->unlockScreen();
} else {
uint16 xoffs = _videoWindows[4 * 4 + 0] * 16;
@@ -1194,12 +1195,12 @@
uint16 width = _videoWindows[4 * 4 + 2] * 16;
uint16 height = _videoWindows[4 * 4 + 3];
- byte *dst = getBackGround() + xoffs + yoffs * _screenWidth;
- byte *src = _window4BackScn;
+ byte *dst = (byte *)_backGroundBuf->getBasePtr(xoffs, yoffs);
+ byte *src = (byte *)_window4BackScn->pixels;;
uint16 srcWidth = _videoWindows[4 * 4 + 2] * 16;
for (; height > 0; height--) {
memcpy(dst, src, width);
- dst += _screenWidth;
+ dst += _backGroundBuf->pitch;
src += srcWidth;
}
}
@@ -1228,11 +1229,11 @@
void AGOSEngine::clearVideoBackGround(uint16 num, uint16 color) {
const uint16 *vlut = &_videoWindows[num * 4];
- byte *dst = getBackGround() + vlut[0] * 16 + vlut[1] * _dxSurfacePitch;
+ byte *dst = (byte *)_backGroundBuf->getBasePtr(vlut[0] * 16, vlut[1]);
for (uint h = 0; h < vlut[3]; h++) {
memset(dst, color, vlut[2] * 16);
- dst += _screenWidth;
+ dst += _backGroundBuf->pitch;
}
}
@@ -1250,14 +1251,18 @@
if (getGameType() == GType_ELVIRA1 && num == 3) {
Graphics::Surface *screen = _system->lockScreen();
- memset((byte *)screen->pixels, color, _screenWidth * _screenHeight);
+ byte *dst = (byte *)screen->pixels;
+ for (int i = 0; i < _screenHeight; i++) {
+ memset(dst, color, _screenWidth);
+ dst += screen->pitch;
+ }
_system->unlockScreen();
} else if (num == 4) {
const uint16 *vlut = &_videoWindows[num * 4];
uint16 xoffs = (vlut[0] - _videoWindows[16]) * 16;
uint16 yoffs = (vlut[1] - _videoWindows[17]);
uint16 dstWidth = _videoWindows[18] * 16;
- byte *dst = _window4BackScn + xoffs + yoffs * dstWidth;
+ byte *dst = (byte *)_window4BackScn->pixels + xoffs + yoffs * dstWidth;
setMoveRect(0, 0, vlut[2] * 16, vlut[3]);
Modified: scummvm/branches/gsoc2009-16bit/engines/agos/vga_e2.cpp
===================================================================
--- scummvm/branches/gsoc2009-16bit/engines/agos/vga_e2.cpp 2009-07-07 07:02:04 UTC (rev 42202)
+++ scummvm/branches/gsoc2009-16bit/engines/agos/vga_e2.cpp 2009-07-07 07:09:56 UTC (rev 42203)
@@ -77,7 +77,7 @@
uint8 height = vlut[3];
if (num == 4) {
- byte *dst = _window4BackScn;
+ byte *dst = (byte *)_window4BackScn->pixels;
for (uint8 h = 0; h < height; h++) {
for (uint8 w = 0; w < width; w++) {
@@ -90,7 +90,7 @@
}
} else {
Graphics::Surface *screen = _system->lockScreen();
- byte *dst = (byte *)screen->pixels + vlut[0] * 16 + vlut[1] * _dxSurfacePitch;
+ byte *dst = (byte *)screen->getBasePtr(vlut[0] * 16, vlut[1]);
if (getGameType() == GType_ELVIRA2 && num == 7) {
dst -= 8;
@@ -104,7 +104,7 @@
val |= color * 16;
WRITE_LE_UINT16(dst + w * 2, val);
}
- dst += _dxSurfacePitch;
+ dst += screen->pitch;
}
_system->unlockScreen();
@@ -218,18 +218,19 @@
uint16 dissolveDelay = dissolveCheck * 2 / speed;
uint16 dissolveCount = dissolveCheck * 2 / speed;
+ Graphics::Surface *screen = _system->lockScreen();
+
int16 xoffs = _videoWindows[num * 4 + 0] * 16;
int16 yoffs = _videoWindows[num * 4 + 1];
- int16 offs = xoffs + yoffs * _screenWidth;
+ int16 offs = xoffs + yoffs * screen->pitch;
uint16 count = dissolveCheck * 2;
while (count--) {
- Graphics::Surface *screen = _system->lockScreen();
byte *dstPtr = (byte *)screen->pixels + offs;
yoffs = _rnd.getRandomNumber(dissolveY);
- dst = dstPtr + yoffs * _screenWidth;
- src = _window4BackScn + yoffs * 224;
+ dst = dstPtr + yoffs * screen->pitch;
+ src = (byte *)_window4BackScn->pixels + yoffs * _window4BackScn->pitch;
xoffs = _rnd.getRandomNumber(dissolveX);
dst += xoffs;
@@ -252,15 +253,15 @@
dstOffs2 = dst;
yoffs = (dissolveY - 1) * 2 - (yoffs * 2);
- src = srcOffs + yoffs * 224;
- dst = dstOffs + yoffs * _screenWidth;
+ src = srcOffs + yoffs * _window4BackScn->pitch;
+ dst = dstOffs + yoffs * screen->pitch;
color = 0xF0;
*dst &= color;
*dst |= *src & 0xF;
- dst = dstOffs2 + yoffs * _screenWidth;
- src = srcOffs2 + yoffs * 224;
+ dst = dstOffs2 + yoffs * screen->pitch;
+ src = srcOffs2 + yoffs * _window4BackScn->pitch;
*dst &= color;
*dst |= *src & 0xF;
@@ -291,19 +292,20 @@
uint16 dissolveDelay = dissolveCheck * 2 / speed;
uint16 dissolveCount = dissolveCheck * 2 / speed;
+ Graphics::Surface *screen = _system->lockScreen();
+
int16 xoffs = _videoWindows[num * 4 + 0] * 16;
int16 yoffs = _videoWindows[num * 4 + 1];
- int16 offs = xoffs + yoffs * _screenWidth;
+ int16 offs = xoffs + yoffs * screen->pitch;
uint16 count = dissolveCheck * 2;
while (count--) {
- Graphics::Surface *screen = _system->lockScreen();
byte *dstPtr = (byte *)screen->pixels + offs;
color |= dstPtr[0] & 0xF0;
yoffs = _rnd.getRandomNumber(dissolveY);
xoffs = _rnd.getRandomNumber(dissolveX);
- dst = dstPtr + xoffs + yoffs * _screenWidth;
+ dst = dstPtr + xoffs + yoffs * screen->pitch;
*dst = color;
dstOffs = dst;
@@ -313,7 +315,7 @@
*dst = color;
yoffs = (dissolveY - 1) * 2 - (yoffs * 2);
- dst = dstOffs + yoffs * _screenWidth;
+ dst = dstOffs + yoffs * screen->pitch;
*dst = color;
dst += xoffs;
@@ -354,18 +356,22 @@
}
void AGOSEngine::vc56_fullScreen() {
+ uint8 palette[1024];
+
Graphics::Surface *screen = _system->lockScreen();
-
byte *dst = (byte *)screen->pixels;
- byte *src = _curVgaFile2 + 32;
+ byte *src = _curVgaFile2 + 800;
- memcpy(dst, src + 768, _screenHeight * _screenWidth);
-
+ for (int i = 0; i < _screenHeight; i++) {
+ memcpy(dst, src, _screenWidth);
+ src += 320;
+ dst += screen->pitch;
+ }
_system->unlockScreen();
//fullFade();
- uint8 palette[1024];
+ src = _curVgaFile2 + 32;
for (int i = 0; i < 256; i++) {
palette[i * 4 + 0] = *src++ * 4;
palette[i * 4 + 1] = *src++ * 4;
Modified: scummvm/branches/gsoc2009-16bit/engines/agos/vga_pn.cpp
===================================================================
--- scummvm/branches/gsoc2009-16bit/engines/agos/vga_pn.cpp 2009-07-07 07:02:04 UTC (rev 42202)
+++ scummvm/branches/gsoc2009-16bit/engines/agos/vga_pn.cpp 2009-07-07 07:09:56 UTC (rev 42203)
@@ -168,7 +168,7 @@
if (dst[w] == 15)
dst[w] = 4;
}
- dst += _screenWidth;
+ dst += screen->pitch;
}
_system->unlockScreen();
} else if (num == 2) {
Modified: scummvm/branches/gsoc2009-16bit/engines/agos/vga_s2.cpp
===================================================================
--- scummvm/branches/gsoc2009-16bit/engines/agos/vga_s2.cpp 2009-07-07 07:02:04 UTC (rev 42202)
+++ scummvm/branches/gsoc2009-16bit/engines/agos/vga_s2.cpp 2009-07-07 07:09:56 UTC (rev 42203)
@@ -28,6 +28,8 @@
#include "agos/agos.h"
#include "agos/intern.h"
+#include "graphics/surface.h"
+
namespace AGOS {
void AGOSEngine_Simon2::setupVideoOpcodes(VgaOpcodeProc *op) {
@@ -215,7 +217,7 @@
uint16 xoffs = vlut[0] * 16;
uint16 yoffs = vlut[1];
uint16 dstWidth = _videoWindows[18] * 16;
- byte *dst = _window4BackScn + xoffs + yoffs * dstWidth;
+ byte *dst = (byte *)_window4BackScn->pixels + xoffs + yoffs * dstWidth;
setMoveRect(0, 0, vlut[2] * 16, vlut[3]);
Modified: scummvm/branches/gsoc2009-16bit/engines/agos/vga_ww.cpp
===================================================================
--- scummvm/branches/gsoc2009-16bit/engines/agos/vga_ww.cpp 2009-07-07 07:02:04 UTC (rev 42202)
+++ scummvm/branches/gsoc2009-16bit/engines/agos/vga_ww.cpp 2009-07-07 07:09:56 UTC (rev 42203)
@@ -145,14 +145,19 @@
uint h, tmp;
Graphics::Surface *screen = _system->lockScreen();
+ dstPtr = (byte *)screen->pixels;
if (a == 6) {
src = _curVgaFile2 + 800;
- dstPtr = (byte *)screen->pixels;
- memcpy(dstPtr, src, 64000);
+
+ for (int i = 0; i < _screenHeight; i++) {
+ memcpy(dst, src, _screenWidth);
+ src += 320;
+ dst += screen->pitch;
+ }
+
tmp = 4 - 1;
} else {
- dstPtr = (byte *)screen->pixels;
tmp = a - 1;
}
@@ -160,15 +165,14 @@
while (tmp--)
src += 1536 * 16 + 1712;
-
src += 800;
if (a != 5) {
- dst = dstPtr + 7448;
+ dst = dstPtr + 23 * screen->pitch + 88;
for (h = 0; h < 177; h++) {
memcpy(dst, src, 144);
src += 144;
- dst += _screenWidth;
+ dst += screen->pitch;
}
if (a != 6) {
@@ -179,11 +183,11 @@
src = _curVgaFile2 + 9984 * 16 + 15344;
}
- dst = dstPtr + 50296;
+ dst = dstPtr + 157 * screen->pitch + 56;
for (h = 0; h < 17; h++) {
memcpy(dst, src, 208);
src += 208;
- dst += _screenWidth;
+ dst += screen->pitch;
}
_system->unlockScreen();
Modified: scummvm/branches/gsoc2009-16bit/engines/agos/window.cpp
===================================================================
--- scummvm/branches/gsoc2009-16bit/engines/agos/window.cpp 2009-07-07 07:02:04 UTC (rev 42202)
+++ scummvm/branches/gsoc2009-16bit/engines/agos/window.cpp 2009-07-07 07:09:56 UTC (rev 42203)
@@ -128,14 +128,14 @@
_videoLockOut |= 0x8000;
- dst = getBackGround() + _dxSurfacePitch * window->y + window->x;
+ dst = getBackGround() + _backGroundBuf->pitch * window->y + window->x;
for (h = 0; h < window->height; h++) {
for (w = 0; w < window->width; w++) {
if (dst[w] == 113 || dst[w] == 116 || dst[w] == 252)
dst[w] = window->fillColor;
}
- dst += _screenWidth;
+ dst += _backGroundBuf->pitch;
}
_videoLockOut &= ~0x8000;
@@ -171,7 +171,7 @@
_videoLockOut |= 0x8000;
Graphics::Surface *screen = _system->lockScreen();
- byte *dst = (byte *)screen->pixels + y * _screenWidth + x;
+ byte *dst = (byte *)screen->pixels + y * screen->pitch + x;
uint8 color = window->fillColor;
if (getGameType() == GType_ELVIRA2 || getGameType() == GType_WW)
@@ -179,7 +179,7 @@
do {
memset(dst, color, w);
- dst += _screenWidth;
+ dst += screen->pitch;
} while (--h);
_system->unlockScreen();
@@ -236,8 +236,8 @@
dst = (byte *)screen->pixels;
src = getBackGround();
- dst += y * _dxSurfacePitch;
- src += y * _dxSurfacePitch;
+ dst += y * screen->pitch;
+ src += y * _backGroundBuf->pitch;
uint8 paletteMod = 0;
if (getGameType() == GType_ELVIRA1 && !(getFeatures() & GF_DEMO) && y >= 133)
@@ -247,8 +247,8 @@
for (i = x; i < w; i++)
dst[i] = src[i] + paletteMod;
y++;
- dst += _dxSurfacePitch;
- src += _dxSurfacePitch;
+ dst += screen->pitch;
+ src += _backGroundBuf->pitch;
}
_system->unlockScreen();
Modified: scummvm/branches/gsoc2009-16bit/engines/cruise/cruise_main.cpp
===================================================================
--- scummvm/branches/gsoc2009-16bit/engines/cruise/cruise_main.cpp 2009-07-07 07:02:04 UTC (rev 42202)
+++ scummvm/branches/gsoc2009-16bit/engines/cruise/cruise_main.cpp 2009-07-07 07:09:56 UTC (rev 42203)
@@ -40,8 +40,6 @@
gfxEntryStruct* linkedMsgList = NULL;
-extern bool isBlack;
-
void drawBlackSolidBoxSmall() {
// gfxModuleData.drawSolidBox(64,100,256,117,0);
drawSolidBox(64, 100, 256, 117, 0);
@@ -514,6 +512,7 @@
strcpy(lastOverlay, "AUTO00");
_gameSpeed = GAME_FRAME_DELAY_1;
+ _speedFlag = false;
return;
}
@@ -1293,11 +1292,6 @@
buttonDown = 0;
}
- if (userDelay && !userWait) {
- userDelay--;
- return 0;
- }
-
// Check for Exit 'X' key
if (keyboardCode == Common::KEYCODE_x)
return 1;
@@ -1343,6 +1337,8 @@
// Check for left mouse button click or Space to end user waiting
if ((keyboardCode == Common::KEYCODE_SPACE) || (button == MB_LEFT))
userWait = 0;
+
+ keyboardCode = Common::KEYCODE_INVALID;
return 0;
}
@@ -1784,36 +1780,36 @@
// t_start=Osystem_GetTicks();
// readKeyboard();
- bool isUserWait = userWait != 0;
+ bool isUserWait = userWait != 0;
playerDontAskQuit = processInput();
if (playerDontAskQuit)
break;
- if (isUserWait && !userWait) {
- // User waiting has ended
- changeScriptParamInList(-1, -1, &procHead, 9999, 0);
- changeScriptParamInList(-1, -1, &relHead, 9999, 0);
-
- mainDraw(0);
- flipScreen();
- }
-
if (enableUser) {
userEnabled = 1;
enableUser = 0;
}
- if (userWait < 1) {
- manageScripts(&relHead);
- manageScripts(&procHead);
+ if (userDelay && !userWait) {
+ userDelay--;
+ continue;
+ }
- removeFinishedScripts(&relHead);
- removeFinishedScripts(&procHead);
+ if (isUserWait & !userWait) {
+ // User waiting has ended
+ changeScriptParamInList(-1, -1, &procHead, 9999, 0);
+ changeScriptParamInList(-1, -1, &relHead, 9999, 0);
+ }
- processAnimation();
- }
+ manageScripts(&relHead);
+ manageScripts(&procHead);
+ removeFinishedScripts(&relHead);
+ removeFinishedScripts(&procHead);
+
+ processAnimation();
+
if (remdo) {
// ASSERT(0);
/* main3 = 0;
@@ -1837,10 +1833,8 @@
PCFadeFlag = 0;
/*if (!PCFadeFlag)*/
- if (!isUserWait) {
- mainDraw(0);
- flipScreen();
- }
+ mainDraw(userWait);
+ flipScreen();
if (userEnabled && !userWait && !autoTrack) {
if (currentActiveMenu == -1) {
@@ -1874,38 +1868,9 @@
changeCursor(CURSOR_NORMAL);
}
- if (isUserWait) {
- // User Wait handling
- if (userWait == 1) {
- // Initial step
- do {
- // Make sure any previous mouse press is released
- getMouseStatus(&main10, &mouseX, &mouseButton, &mouseY);
- } while (mouseButton != 0);
-
- ++userWait;
-// mainDraw(0);
-// flipScreen();
- } else {
- // Standard handling
-/*
- manageScripts(&relHead);
- manageScripts(&procHead);
-
- removeFinishedScripts(&relHead);
- removeFinishedScripts(&procHead);
-*/
- if (isBlack) {
- // This is a bit of a hack to ensure that user waits directly after a palette fade
- // have time to restore the palette before waiting starts
- mainDraw(0);
- flipScreen();
- } else {
- // Draw the next screen
- processAnimation();
- gfxModuleData_flipScreen();
- }
- }
+ if (userWait == 1) {
+ // Waiting for press - original wait loop has been integrated into the
+ // main event loop
continue;
}
@@ -1917,12 +1882,8 @@
char* pText = getText(autoMsg, autoOvl);
- if (strlen(pText)) {
+ if (strlen(pText))
userWait = 1;
-
- mainDraw(0);
- flipScreen();
- }
}
changeScriptParamInList(-1, -1, &relHead, 9998, 0);
Modified: scummvm/branches/gsoc2009-16bit/engines/cruise/function.cpp
===================================================================
--- scummvm/branches/gsoc2009-16bit/engines/cruise/function.cpp 2009-07-07 07:02:04 UTC (rev 42202)
+++ scummvm/branches/gsoc2009-16bit/engines/cruise/function.cpp 2009-07-07 07:09:56 UTC (rev 42203)
@@ -709,9 +709,7 @@
getMouseStatus(&dummy, &mouseX, &mouseButton, &mouseY);
- if (mouseButton)
- return 1;
- return 0;
+ return mouseButton;
}
int16 Op_AddCell(void) {
@@ -817,6 +815,11 @@
createTextObject(&cellHead, overlayIdx, var_8, var_6, var_4, var_2, color, masterScreen, currentScriptPtr->overlayNumber, currentScriptPtr->scriptNumber);
+ // WORKAROUND: The first message in the 'shooting cutscene' goes too fast on newer systems,
+ // so this introduces a delay so the user has more time to read the message
+ if ((overlayIdx == 46) && (var_8 == 0))
+ userDelay = 3 * (1000 / GAME_FRAME_DELAY_2);
+
return 0;
}
Modified: scummvm/branches/gsoc2009-16bit/engines/cruise/gfxModule.cpp
===================================================================
--- scummvm/branches/gsoc2009-16bit/engines/cruise/gfxModule.cpp 2009-07-07 07:02:04 UTC (rev 42202)
+++ scummvm/branches/gsoc2009-16bit/engines/cruise/gfxModule.cpp 2009-07-07 07:09:56 UTC (rev 42203)
@@ -40,7 +40,6 @@
int palDirtyMin = 256;
int palDirtyMax = -1;
-bool isBlack = false;
gfxModuleDataStruct gfxModuleData = {
0, // use Tandy
@@ -238,12 +237,6 @@
g_system->setPalette(paletteRGBA + palDirtyMin*4, palDirtyMin, palDirtyMax - palDirtyMin + 1);
palDirtyMin = 256;
palDirtyMax = -1;
-
- isBlack = true;
- for (i = 0; i < 256; ++i) {
- isBlack = (lpalette[i].R == 0) && (lpalette[i].G == 0) && (lpalette[i].B == 0);
- if (!isBlack) break;
- }
}
g_system->copyRectToScreen(globalScreen, 320, 0, 0, 320, 200);
Modified: scummvm/branches/gsoc2009-16bit/engines/gob/hotspots.cpp
===================================================================
--- scummvm/branches/gsoc2009-16bit/engines/gob/hotspots.cpp 2009-07-07 07:02:04 UTC (rev 42202)
+++ scummvm/branches/gsoc2009-16bit/engines/gob/hotspots.cpp 2009-07-07 07:09:56 UTC (rev 42203)
@@ -128,6 +128,16 @@
return true;
}
+bool Hotspots::Hotspot::isInputLeave() const {
+ if (!isInput())
+ return false;
+
+ if (!(getType() & 1))
+ return true;
+
+ return false;
+}
+
bool Hotspots::Hotspot::isFilled() const {
return getState() & kStateFilled;
}
@@ -518,7 +528,7 @@
// Check where the mouse was moved to
for (int i = 0; (i < kHotspotCount) && !_hotspots[i].isEnd(); i++) {
- Hotspot &spot = _hotspots[i];
+ const Hotspot &spot = _hotspots[i];
if (spot.isDisabled())
// Only consider enabled hotspots
@@ -548,7 +558,7 @@
// Check if something was clicked
for (int i = 0; (i < kHotspotCount) && !_hotspots[i].isEnd(); i++) {
- Hotspot &spot = _hotspots[i];
+ const Hotspot &spot = _hotspots[i];
if (spot.isDisabled())
// Only consider enabled hotspots
@@ -646,7 +656,7 @@
// Update display
_vm->_draw->blitInvalidated();
- _vm->_video->retrace();
+ _vm->_video->waitRetrace();
uint16 key = 0;
while (key == 0) {
@@ -914,7 +924,8 @@
switch (key) {
case kKeyRight:
// If possible, move the cursor right
- if ((pos > strlen(str)) || (pos > (editSize - 1)) || (editSize == 0)) {
+ if (((editSize != 0) && ((pos > strlen(str)) || (pos > (editSize - 1)))) ||
+ ((editSize == 0) && (pos > strlen(str)))) {
pos++;
continue;
}
@@ -1138,7 +1149,7 @@
}
void Hotspots::evaluateNew(uint16 i, uint16 *ids, InputDesc *inputs,
- uint16 &validId, bool &hasInput, uint16 &inputCount) {
+ uint16 &inputId, bool &hasInput, uint16 &inputCount) {
ids[i] = 0;
@@ -1300,7 +1311,7 @@
break;
case 20:
- validId = i;
+ inputId = i;
// Fall through to case 2
case kTypeClick:
key = _vm->_game->_script->readInt16();
@@ -1334,13 +1345,62 @@
flags, key, funcEnter, funcLeave, funcPos);
}
+bool Hotspots::evaluateFind(uint16 key, int16 timeVal, const uint16 *ids,
+ uint16 hotspotIndex1, uint16 hotspotIndex2, uint16 endIndex,
+ int16 &duration, uint16 &id, uint16 &index, bool &finished) {
+
+ if (id != 0)
+ // We already found a hotspot, nothing to do
+ return true;
+
+ if (key != 0) {
+ // We've got a key
+
+ // Find the hotspot with that key associated
+ findKey(key, id, index);
+ if (id != 0)
+ // Found it
+ return true;
+
+ // Try it case insensitively
+ findKeyCaseInsensitive(key, id, index);
+ if (id != 0)
+ // Found it
+ return true;
+
+ return false;
+ }
+
+ if (duration != 0) {
+ // We've got a time duration
+
+ if (hotspotIndex1 != 0) {
+ finished =
+ leaveNthPlain(hotspotIndex1, endIndex, timeVal, ids, id, index, duration);
+ } else if (hotspotIndex2 != 0) {
+ findNthPlain(hotspotIndex2, endIndex, id, index);
+ } else {
+ findNthPlain(0, 0, id, index);
+
+ // Leave the current hotspot
+ if ((_currentKey != 0) && (_hotspots[_currentIndex].funcLeave != 0))
+ call(_hotspots[_currentIndex].funcLeave);
+
+ _currentKey = 0;
+ }
+
+ if (id != 0)
+ return true;
+
+ return false;
+ }
+
+ return false;
+}
+
void Hotspots::evaluate() {
InputDesc inputs[20];
uint16 ids[kHotspotCount];
- int16 counter;
- int16 var_24;
- int16 var_26;
- int16 collStackPos;
// Push all local hotspots
push(0);
@@ -1360,14 +1420,14 @@
// Parameters of this block
_vm->_game->_handleMouse = _vm->_game->_script->peekByte(0);
int16 duration = _vm->_game->_script->peekByte(1);
- byte stackPos2 = _vm->_game->_script->peekByte(3);
- byte descIndex = _vm->_game->_script->peekByte(4);
+ byte hotspotIndex1 = _vm->_game->_script->peekByte(3);
+ byte hotspotIndex2 = _vm->_game->_script->peekByte(4);
bool needRecalculation = _vm->_game->_script->peekByte(5) != 0;
// Seconds -> Milliseconds
duration *= 1000;
- if ((stackPos2 != 0) || (descIndex != 0)) {
+ if ((hotspotIndex1 != 0) || (hotspotIndex2 != 0)) {
duration /= 100;
if (_vm->_game->_script->peekByte(1) == 100)
duration = 2;
@@ -1377,14 +1437,12 @@
_vm->_game->_script->skip(6);
- // Clear current ID
- WRITE_VAR(16, 0);
+ setCurrentHotspot(0, 0);
- byte var_41 = 0;
- int16 var_46 = 0;
+ bool finishedDuration = false;
uint16 id = 0;
- uint16 validId = 0xFFFF;
+ uint16 inputId = 0xFFFF;
uint16 index = 0;
bool hasInput = false;
@@ -1392,7 +1450,7 @@
// Adding new hotspots
for (uint16 i = 0; i < count; i++)
- evaluateNew(i, ids, inputs, validId, hasInput, inputCount);
+ evaluateNew(i, ids, inputs, inputId, hasInput, inputCount);
// Recalculate all hotspots if requested
if (needRecalculation)
@@ -1401,7 +1459,7 @@
_vm->_game->_forceHandleMouse = 0;
_vm->_util->clearKeyBuf();
- do {
+ while ((id == 0) && !_vm->_inter->_terminate && !_vm->shouldQuit()) {
uint16 key = 0;
if (hasInput) {
// Input
@@ -1411,193 +1469,23 @@
key = handleInputs(duration, inputCount, curInput, inputs, id, index);
// Notify the script of the current input index
- WRITE_VAR(55, curInput);
+ WRITE_VAR(17 + 38, curInput);
if (key == kKeyReturn) {
// Return pressed, invoke input leave
- for (int i = 0; (i < kHotspotCount) && !_hotspots[i].isEnd(); i++) {
- Hotspot &spot = _hotspots[i];
-
- if (!spot.isFilledEnabled())
- // Not filled or disabled
- continue;
-
- if ((spot.getType() & 1) != 0)
- // Not an input with a leave function
- continue;
-
- if (spot.getType() <= kTypeClick)
- // Not an input
- continue;
-
- id = spot.id;
- validId = spot.id & 0x7FFF;
- index = i;
- break;
- }
+ findFirstInputLeave(id, inputId, index);
break;
}
} else
// Normal move or click check
key = check(_vm->_game->_handleMouse, -duration, id, index);
- // Handle special number keys
- if (((key & 0xFF) >= ' ') && ((key & 0xFF) <= 0xFF) &&
- ((key >> 8) > 1) && ((key >> 8) < 12))
- key = '0' + (((key >> 8) - 1) % 10) + (key & 0xFF00);
+ key = convertSpecialKey(key);
- if (id == 0) {
- // No hotspot area
+ // Try to find a fitting hotspot
+ Hotspots::evaluateFind(key, timeVal, ids, hotspotIndex1, hotspotIndex2, endIndex,
+ duration, id, index, finishedDuration);
- if (key != 0) {
- // But a key
-
- // Find the hotspot with that key associated
- for (int i = 0; (i < kHotspotCount) && !_hotspots[i].isEnd(); i++) {
- Hotspot &spot = _hotspots[i];
-
- if (!spot.isFilledEnabled())
- // Not filled or disabled
- continue;
-
- // Key match Catch all
- if ((spot.key == key) || (spot.key == 0x7FFF)) {
- id = spot.id;
- index = i;
- break;
- }
- }
-
- if (id == 0) {
- // Didn't find such a hotspot
-
- // Try it again, this time case insensitively
- for (int i = 0; (i < kHotspotCount) && !_hotspots[i].isEnd(); i++) {
- Hotspot &spot = _hotspots[i];
-
- if (!spot.isFilledEnabled())
- continue;
-
- if ((spot.key & 0xFF00) != 0)
- continue;
-
- if (spot.key == 0)
- continue;
-
- if (toupper(key & 0xFF) == toupper(spot.key)) {
- id = spot.id;
- index = i;
- break;
- }
- }
- }
- } else if (duration != 0) {
- if (stackPos2 != 0) {
- collStackPos = 0;
-
- for (int i = endIndex; (i < kHotspotCount) && !_hotspots[i].isEnd(); i++) {
- Hotspot &spot = _hotspots[i];
-
- if (!spot.isFilledNew())
- continue;
-
- collStackPos++;
- if (collStackPos != stackPos2)
- // Isn't yet the one wanted
- continue;
-
- id = spot.id;
- index = i;
- _vm->_inter->storeMouse();
- if (VAR(16) != 0)
- // We already handle a hotspot
- break;
-
- // Notify the scripts that we now handle this hotspot
- if (Hotspot::getState(id) == kStateFilled)
- WRITE_VAR(16, ids[id & 0xFFF]);
- else
- WRITE_VAR(16, id & 0xFFF);
-
- if (spot.funcLeave != 0) {
- // It has a leave function
-
- uint32 timeKey = _vm->_util->getTimeKey();
- call(spot.funcLeave);
-
- if (timeVal != 2) {
- // Rest time we have left = time we had - time the leave took
- duration = timeVal - (_vm->_util->getTimeKey() - timeKey);
-
- // Remove the buffer time
- if ((duration - var_46) < 3) {
- var_46 -= (duration - 3);
- duration = 3;
- } else if (var_46 != 0) {
- duration -= var_46;
- var_46 = 0;
- }
-
- // Clamp
- if (duration > timeVal)
- duration = timeVal;
-
- } else
- duration = 2;
-
- }
-
- if (VAR(16) == 0)
- // Didn't find anything
- id = 0;
- else
- var_41 = 1;
-
- break;
- }
-
- } else {
- if (descIndex != 0) {
-
- counter = 0;
- // Enter the nth hotspot
- for (int i = endIndex; (i < kHotspotCount) && !_hotspots[i].isEnd(); i++) {
- Hotspot &spot = _hotspots[i];
-
- if (spot.isFilledNew()) {
- if (++counter == descIndex) {
- id = spot.id;
- index = i;
- break;
- }
- }
-
- }
-
- } else {
-
- // Enter the first hotspot
- for (int i = 0; (i < kHotspotCount) && !_hotspots[i].isEnd(); i++) {
- Hotspot &spot = _hotspots[i];
-
- if (spot.isFilledNew()) {
- id = spot.id;
- index = i;
- break;
- }
- }
-
- // Leave the current hotspot
- if ((_currentKey != 0) && (_hotspots[_currentIndex].funcLeave != 0))
- call(_hotspots[_currentIndex].funcLeave);
-
- _currentKey = 0;
- }
-
- }
- }
- }
-
- if (var_41 != 0)
+ if (finishedDuration)
break;
if ((id == 0) || (_hotspots[index].funcLeave != 0))
@@ -1606,114 +1494,30 @@
_vm->_inter->storeMouse();
- // Notify the scripts of the currently handled hotspot
- if (Hotspot::getState(id) == kStateFilled)
- WRITE_VAR(16, ids[id & 0xFFF]);
- else
- WRITE_VAR(16, id & 0xFFF);
+ setCurrentHotspot(ids, id);
// Enter it
if (_hotspots[index].funcEnter != 0)
call(_hotspots[index].funcEnter);
- WRITE_VAR(16, 0);
+ setCurrentHotspot(0, 0);
id = 0;
}
- while ((id == 0) && !_vm->_inter->_terminate && !_vm->shouldQuit());
- char tempStr[256];
- if ((id & 0xFFF) == validId) {
- collStackPos = 0;
- var_24 = 0;
- var_26 = 1;
- for (int i = 0; i < kHotspotCount; i++) {
- Hotspot &spot = _hotspots[i];
+ if ((id & 0xFFF) == inputId)
+ matchInputStrings(inputs);
- // Looking for all enabled inputs
- if (spot.isEnd())
- continue;
- if (!spot.isFilledEnabled())
- continue;
- if (!spot.isInput())
- continue;
-
- // Clean up numerical floating values
- if (spot.getType() >= kTypeInputFloatNoLeave) {
- // Get the string
- char *ptr;
- strncpy0(tempStr, GET_VARO_STR(spot.key), 255);
-
- // Remove spaces
- while ((ptr = strchr(tempStr, ' ')))
- _vm->_util->cutFromStr(tempStr, (ptr - tempStr), 1);
-
- // Exchange decimal separator if needed
- if (_vm->_global->_language == kLanguageBritish)
- while ((ptr = strchr(tempStr, '.')))
- *ptr = ',';
-
- // Write it back
- WRITE_VARO_STR(spot.key, tempStr);
- }
-
- if ((spot.getType() >= kTypeInput2NoLeave) && (spot.getType() <= kTypeInput3Leave)) {
- const char *str = inputs[var_24].str;
-
- strncpy0(tempStr, GET_VARO_STR(spot.key), 255);
-
- if (spot.getType() < kTypeInput3NoLeave)
- _vm->_util->cleanupStr(tempStr);
-
- // Look if we find a match between the wanted and the typed string
- int16 pos = 0;
- do {
- char spotStr[256];
-
- strncpy0(spotStr, str, 255);
- pos += strlen(str) + 1;
-
- str += strlen(str) + 1;
-
- if (spot.getType() < kTypeInput3NoLeave)
- _vm->_util->cleanupStr(spotStr);
-
- // Compare the entered string with the string we wanted
- if (strcmp(tempStr, spotStr) == 0) {
- WRITE_VAR(17, VAR(17) + 1);
- WRITE_VAR(17 + var_26, 1);
- break;
- }
- } while (inputs[var_24].length > pos);
-
- collStackPos++;
- } else
- WRITE_VAR(17 + var_26, 2);
-
- var_24++;
- var_26++;
- }
-
- // Notify the scripts if we reached the requested hotspot
- if (collStackPos != (int16) VAR(17))
- WRITE_VAR(17, 0);
- else
- WRITE_VAR(17, 1);
- }
-
if (_vm->_game->_handleMouse == 1)
_vm->_draw->blitCursor();
- if (!_vm->_inter->_terminate && (var_41 == 0)) {
+ if (!_vm->_inter->_terminate && (!finishedDuration)) {
_vm->_game->_script->seek(_hotspots[index].funcLeave);
_vm->_inter->storeMouse();
- if (VAR(16) == 0) {
+ if (getCurrentHotspot() == 0) {
// No hotspot currently handled, now we'll handle the newly found one
- if (Hotspot::getState(id) == kStateFilled)
- WRITE_VAR(16, ids[id & 0xFFF]);
- else
- WRITE_VAR(16, id & 0xFFF);
+ setCurrentHotspot(ids, id);
}
} else
_vm->_game->_script->setFinished(true);
@@ -1737,7 +1541,7 @@
int16 cursor = 0;
for (int i = 0; (i < kHotspotCount) && !_hotspots[i].isEnd(); i++) {
- Hotspot &spot = _hotspots[i];
+ const Hotspot &spot = _hotspots[i];
if ((spot.getWindow() != 0) || spot.isDisabled())
// Ignore disabled and non-main-windowed hotspots
@@ -1767,7 +1571,7 @@
uint16 Hotspots::inputToHotspot(uint16 input) const {
uint16 inputIndex = 0;
for (int i = 0; i < kHotspotCount; i++) {
- Hotspot &spot = _hotspots[i];
+ const Hotspot &spot = _hotspots[i];
if (!spot.isActiveInput())
// Not an active input
@@ -1789,7 +1593,7 @@
uint16 input = 0;
for (int i = 0; i < kHotspotCount; i++) {
- Hotspot &spot = _hotspots[i];
+ const Hotspot &spot = _hotspots[i];
if (!spot.isActiveInput())
// Not an active input
@@ -1808,7 +1612,7 @@
uint16 Hotspots::findClickedInput(uint16 index) const {
for (int i = 0; (i < kHotspotCount) && !_hotspots[i].isEnd(); i++) {
- Hotspot &spot = _hotspots[i];
+ const Hotspot &spot = _hotspots[i];
if (spot.getWindow() != 0)
// Ignore other windows
@@ -1837,6 +1641,255 @@
return index;
}
+bool Hotspots::findFirstInputLeave(uint16 &id, uint16 &inputId, uint16 &index) const {
+ for (int i = 0; (i < kHotspotCount) && !_hotspots[i].isEnd(); i++) {
+ const Hotspot &spot = _hotspots[i];
+
+ if (!spot.isFilledEnabled())
+ // Not filled or disabled
+ continue;
+
+ if (!spot.isInputLeave())
+ // Not an input with a leave function
+ continue;
+
+ id = spot.id;
+ inputId = spot.id & 0x7FFF;
+ index = i;
+ return true;
+ }
+
+ return false;
+}
+
+bool Hotspots::findKey(uint16 key, uint16 &id, uint16 &index) const {
+ id = 0;
+ index = 0;
+
+ for (int i = 0; (i < kHotspotCount) && !_hotspots[i].isEnd(); i++) {
+ const Hotspot &spot = _hotspots[i];
+
+ if (!spot.isFilledEnabled())
+ // Not filled or disabled
+ continue;
+
+ // Key match Catch all
+ if ((spot.key == key) || (spot.key == 0x7FFF)) {
+ id = spot.id;
+ index = i;
+ return true;
+ }
+ }
+
+ return false;
+}
+
+bool Hotspots::findKeyCaseInsensitive(uint16 key, uint16 &id, uint16 &index) const {
+ id = 0;
+ index = 0;
+
+ for (int i = 0; (i < kHotspotCount) && !_hotspots[i].isEnd(); i++) {
+ const Hotspot &spot = _hotspots[i];
+
+ if (!spot.isFilledEnabled())
+ // Not filled or disabled, ignore
+ continue;
+
+ if ((spot.key & 0xFF00) != 0)
+ continue;
+
+ if (spot.key == 0)
+ // No associated key, ignore
+ continue;
+
+ // Compare
+ if (toupper(key & 0xFF) == toupper(spot.key)) {
+ id = spot.id;
+ index = i;
+ return true;
+ }
+ }
+
+ return false;
+}
+
+bool Hotspots::findNthPlain(uint16 n, uint16 startIndex, uint16 &id, uint16 &index) const {
+ id = 0;
+ index = 0;
+
+ uint16 counter = 0;
+ for (int i = startIndex; (i < kHotspotCount) && !_hotspots[i].isEnd(); i++) {
+ const Hotspot &spot = _hotspots[i];
+
+ if (!spot.isFilledNew())
+ // Not filled, ignore
+ continue;
+
+ if (++counter != n)
+ // Not yet the one we want
+ continue;
+
+ id = spot.id;
+ index = i;
+ return true;
+ }
+
+ return false;
+}
+
+bool Hotspots::leaveNthPlain(uint16 n, uint16 startIndex, int16 timeVal, const uint16 *ids,
+ uint16 &id, uint16 &index, int16 &duration) {
+
+ id = 0;
+ index = 0;
+
+ if (!findNthPlain(n, startIndex, id, index))
+ // Doesn't exist
+ return false;
+
+ _vm->_inter->storeMouse();
+
+ if (getCurrentHotspot() != 0)
+ // We already handle a hotspot
+ return false;
+
+ setCurrentHotspot(ids, id);
+
+ const Hotspot &spot = _hotspots[index];
+ if (spot.funcLeave != 0) {
+ // It has a leave function
+
+ uint32 startTime, callTime;
+
+ // Call the leave and time it
+ startTime = _vm->_util->getTimeKey();
+ call(spot.funcLeave);
+ callTime = _vm->_util->getTimeKey() - startTime;
+
+ // Remove the time it took from the time we have available
+ duration = CLIP<int>(timeVal - callTime, 2, timeVal);
+ }
+
+ if (getCurrentHotspot() == 0) {
+ id = 0;
+ index = 0;
+ }
+
+ return getCurrentHotspot() != 0;
+}
+
+void Hotspots::setCurrentHotspot(const uint16 *ids, uint16 id) const {
+ if (!ids) {
+ WRITE_VAR(16, 0);
+ return;
+ }
+
+ if (Hotspot::getState(id) == kStateFilled)
+ WRITE_VAR(16, ids[id & 0xFFF]);
+ else
+ WRITE_VAR(16, id & 0xFFF);
+}
+
+uint32 Hotspots::getCurrentHotspot() const {
+ return VAR(16);
+}
+
+void Hotspots::cleanFloatString(const Hotspot &spot) const {
+ char *to, *from;
+
+ to = from = GET_VARO_STR(spot.key);
+ for (int i = 0; (i < 257) && (*from != '\0'); i++, from++) {
+ char c = *from;
+
+ // Skip spaces
+ if (c == ' ')
+ continue;
+
+ // Convert decimal separator if necessary
+ if ((_vm->_global->_language == kLanguageBritish) && (c == '.'))
+ c = ',';
+
+ *to++ = c;
+ }
+
+ *to = '\0';
+}
+
+void Hotspots::checkStringMatch(const Hotspot &spot, const InputDesc &input,
+ uint16 inputPos) const {
+
+ const char *str = input.str;
+
+ char tempStr[256];
+ char spotStr[256];
+
+ strncpy0(tempStr, GET_VARO_STR(spot.key), 255);
+
+ if (spot.getType() < kTypeInput3NoLeave)
+ _vm->_util->cleanupStr(tempStr);
+
+ uint16 pos = 0;
+ do {
+ strncpy0(spotStr, str, 255);
+
+ pos += strlen(str) + 1;
+ str += strlen(str) + 1;
+
+ if (spot.getType() < kTypeInput3NoLeave)
+ _vm->_util->cleanupStr(spotStr);
+
+ // Compare the entered string with the string we wanted
+ if (strcmp(tempStr, spotStr) == 0) {
+ WRITE_VAR(17, VAR(17) + 1);
+ WRITE_VAR(17 + inputPos, 1);
+ break;
+ }
+ } while (input.length > pos);
+}
+
+void Hotspots::matchInputStrings(const InputDesc *inputs) const {
+ uint16 strInputCount = 0;
+ uint16 inputIndex = 0;
+ uint16 inputPos = 1;
+
+ for (int i = 0; i < kHotspotCount; i++) {
+ const Hotspot &spot = _hotspots[i];
+
+ // Looking for all enabled inputs
+ if (spot.isEnd())
+ continue;
+ if (!spot.isFilledEnabled())
+ continue;
+ if (!spot.isInput())
+ continue;
+
+ if (spot.getType() >= kTypeInputFloatNoLeave)
+ cleanFloatString(spot);
+
+ if ((spot.getType() >= kTypeInput2NoLeave) && (spot.getType() <= kTypeInput3Leave)) {
+
+ // Look if we find a match between the wanted and the typed string
+ checkStringMatch(spot, inputs[inputIndex], inputPos);
+ strInputCount++;
+ } else
+ WRITE_VAR(17 + inputPos, 2);
+
+ inputIndex++;
+ inputPos++;
+ }
+
+ // Notify the scripts if we reached the requested hotspot
+ WRITE_VAR(17, (uint32) (strInputCount == ((uint16) VAR(17))));
+}
+
+uint16 Hotspots::convertSpecialKey(uint16 key) const {
+ if (((key & 0xFF) >= ' ') && ((key & 0xFF) <= 0xFF) &&
+ ((key >> 8) > 1) && ((key >> 8) < 12))
+ key = '0' + (((key >> 8) - 1) % 10) + (key & 0xFF00);
+
+ return key;
+}
+
void Hotspots::getTextCursorPos(const Video::FontDesc &font, const char *str,
uint32 pos, uint16 x, uint16 y, uint16 width, uint16 height,
uint16 &cursorX, uint16 &cursorY, uint16 &cursorWidth, uint16 &cursorHeight) const {
Modified: scummvm/branches/gsoc2009-16bit/engines/gob/hotspots.h
===================================================================
--- scummvm/branches/gsoc2009-16bit/engines/gob/hotspots.h 2009-07-07 07:02:04 UTC (rev 42202)
+++ scummvm/branches/gsoc2009-16bit/engines/gob/hotspots.h 2009-07-07 07:09:56 UTC (rev 42203)
@@ -121,22 +121,23 @@
void clear();
- Type getType() const;
+ Type getType () const;
MouseButtons getButton() const;
- uint8 getWindow() const;
- uint8 getCursor() const;
- uint8 getState() const;
+ uint8 getWindow() const;
+ uint8 getCursor() const;
+ uint8 getState () const;
/** Is this hotspot the block end marker? */
bool isEnd() const;
- bool isInput() const;
+ bool isInput () const;
bool isActiveInput() const;
+ bool isInputLeave () const;
- bool isFilled() const;
+ bool isFilled () const;
bool isFilledEnabled() const;
- bool isFilledNew() const;
- bool isDisabled() const;
+ bool isFilledNew () const;
+ bool isDisabled () const;
/** Are the specified coordinates in the hotspot? */
bool isIn(uint16 x, uint16 y) const;
@@ -146,7 +147,7 @@
static uint8 getState(uint16 id);
void disable();
- void enable();
+ void enable ();
};
struct StackEntry {
@@ -213,15 +214,44 @@
/** Evaluate adding new hotspots script commands. */
void evaluateNew(uint16 i, uint16 *ids, InputDesc *inputs,
- uint16 &validId, bool &hasInput, uint16 &inputCount);
+ uint16 &inputId, bool &hasInput, uint16 &inputCount);
+ /** Find the hotspot requested by script commands. */
+ bool evaluateFind(uint16 key, int16 timeVal, const uint16 *ids,
+ uint16 hotspotIndex1, uint16 hotspotIndex2, uint16 endIndex,
+ int16 &duration, uint16 &id, uint16 &index, bool &finished);
+ // Finding specific hotspots
/** Find the hotspot index that corresponds to the input index. */
uint16 inputToHotspot(uint16 input) const;
/** Find the input index that corresponds to the hotspot index. */
uint16 hotspotToInput(uint16 hotspot) const;
/** Find the input that was clicked on. */
uint16 findClickedInput(uint16 index) const;
+ /** Find the first input hotspot with a leave function. */
+ bool findFirstInputLeave(uint16 &id, uint16 &inputId, uint16 &index) const;
+ /** Find the hotspot with the matching key, case sensitively. */
+ bool findKey(uint16 key, uint16 &id, uint16 &index) const;
+ /** Find the hotspot with the matching key, case insensitively. */
+ bool findKeyCaseInsensitive(uint16 key, uint16 &id, uint16 &index) const;
+ /** Find the nth plain (without Type1 or Type2 state) hotspot. */
+ bool findNthPlain(uint16 n, uint16 startIndex, uint16 &id, uint16 &index) const;
+ /** Leave the nth plain (without Type1 or Type2 state) hotspot. */
+ bool leaveNthPlain(uint16 n, uint16 startIndex, int16 timeVal, const uint16 *ids,
+ uint16 &id, uint16 &index, int16 &duration);
+
+ // Hotspot ID variable access
+ void setCurrentHotspot(const uint16 *ids, uint16 id) const;
+ uint32 getCurrentHotspot() const;
+
+ // String input functions
+ void cleanFloatString(const Hotspot &spot) const;
+ void checkStringMatch(const Hotspot &spot, const InputDesc &input,
+ uint16 inputPos) const;
+ void matchInputStrings(const InputDesc *inputs) const;
+
+ uint16 convertSpecialKey(uint16 key) const;
+
/** Calculate the graphical cursor position. */
void getTextCursorPos(const Video::FontDesc &font, const char *str,
uint32 pos, uint16 x, uint16 y, uint16 width, uint16 height,
Modified: scummvm/branches/gsoc2009-16bit/engines/groovie/roq.cpp
===================================================================
--- scummvm/branches/gsoc2009-16bit/engines/groovie/roq.cpp 2009-07-07 07:02:04 UTC (rev 42202)
+++ scummvm/branches/gsoc2009-16bit/engines/groovie/roq.cpp 2009-07-07 07:09:56 UTC (rev 42203)
@@ -277,6 +277,7 @@
break;
case 0x1013: // Hang
assert(blockHeader.size == 0 && blockHeader.param == 0);
+ endframe = true;
break;
case 0x1020: // Mono sound samples
ok = processBlockSoundMono(blockHeader);
Modified: scummvm/branches/gsoc2009-16bit/engines/kyra/kyra_mr.cpp
===================================================================
--- scummvm/branches/gsoc2009-16bit/engines/kyra/kyra_mr.cpp 2009-07-07 07:02:04 UTC (rev 42202)
+++ scummvm/branches/gsoc2009-16bit/engines/kyra/kyra_mr.cpp 2009-07-07 07:09:56 UTC (rev 42203)
@@ -310,16 +310,19 @@
break;
case 3:
- default:
fadeOutMusic(60);
_screen->fadeToBlack(60);
uninitMainMenu();
quitGame();
running = false;
+ break;
+
+ default:
+ break;
}
}
- if (_showOutro)
+ if (_showOutro && !shouldQuit())
playVQA("CREDITS");
return Common::kNoError;
Modified: scummvm/branches/gsoc2009-16bit/engines/sci/console.cpp
===================================================================
--- scummvm/branches/gsoc2009-16bit/engines/sci/console.cpp 2009-07-07 07:02:04 UTC (rev 42202)
+++ scummvm/branches/gsoc2009-16bit/engines/sci/console.cpp 2009-07-07 07:09:56 UTC (rev 42203)
@@ -461,6 +461,7 @@
int parseNodes(EngineState *s, int *i, int *pos, int type, int nr, int argc, const char **argv) {
int nextToken = 0, nextValue = 0, newPos = 0, oldPos = 0;
+ Console *con = ((SciEngine *)g_engine)->getSciDebugger();
if (type == kParseNil)
return 0;
@@ -471,11 +472,11 @@
return *pos;
}
if (type == kParseEndOfInput) {
- sciprintf("Unbalanced parentheses\n");
+ con->DebugPrintf("Unbalanced parentheses\n");
return -1;
}
if (type == kParseClosingParenthesis) {
- sciprintf("Syntax error at token %d\n", *i);
+ con->DebugPrintf("Syntax error at token %d\n", *i);
return -1;
}
@@ -505,7 +506,7 @@
const char *token = argv[(*i)++];
if (strcmp(token, ")"))
- sciprintf("Expected ')' at token %d\n", *i);
+ con->DebugPrintf("Expected ')' at token %d\n", *i);
return oldPos;
}
@@ -2032,7 +2033,7 @@
bool Console::cmdBacktrace(int argc, const char **argv) {
DebugPrintf("Dumping the send/self/super/call/calle/callb stack:\n");
- DebugPrintf("Call stack (current base: 0x%x):\n", _vm->_gamestate->execution_stack_base);
+ printf("Call stack (current base: 0x%x):\n", _vm->_gamestate->execution_stack_base);
Common::List<ExecStack>::iterator iter;
uint i = 0;
@@ -2045,17 +2046,17 @@
switch (call.type) {
case EXEC_STACK_TYPE_CALL: {// Normal function
- sciprintf(" %x:[%x] %s::%s(", i, call.origin, objname, (call.selector == -1) ? "<call[be]?>" :
+ printf(" %x:[%x] %s::%s(", i, call.origin, objname, (call.selector == -1) ? "<call[be]?>" :
selector_name(_vm->_gamestate, call.selector));
}
break;
case EXEC_STACK_TYPE_KERNEL: // Kernel function
- sciprintf(" %x:[%x] k%s(", i, call.origin, _vm->_gamestate->_kernel->getKernelName(-(call.selector) - 42).c_str());
+ printf(" %x:[%x] k%s(", i, call.origin, _vm->_gamestate->_kernel->getKernelName(-(call.selector) - 42).c_str());
break;
case EXEC_STACK_TYPE_VARSELECTOR:
- sciprintf(" %x:[%x] vs%s %s::%s (", i, call.origin, (call.argc) ? "write" : "read",
+ printf(" %x:[%x] vs%s %s::%s (", i, call.origin, (call.argc) ? "write" : "read",
objname, _vm->_gamestate->_kernel->getSelectorName(call.selector).c_str());
break;
}
@@ -2066,31 +2067,31 @@
totalparamc = 16;
for (paramc = 1; paramc <= totalparamc; paramc++) {
- sciprintf("%04x:%04x", PRINT_REG(call.variables_argp[paramc]));
+ printf("%04x:%04x", PRINT_REG(call.variables_argp[paramc]));
if (paramc < call.argc)
- sciprintf(", ");
+ printf(", ");
}
if (call.argc > 16)
- sciprintf("...");
+ printf("...");
- sciprintf(")\n obj@%04x:%04x", PRINT_REG(call.objp));
+ printf(")\n obj@%04x:%04x", PRINT_REG(call.objp));
if (call.type == EXEC_STACK_TYPE_CALL) {
- sciprintf(" pc=%04x:%04x", PRINT_REG(call.addr.pc));
+ printf(" pc=%04x:%04x", PRINT_REG(call.addr.pc));
if (call.sp == CALL_SP_CARRY)
- sciprintf(" sp,fp:carry");
+ printf(" sp,fp:carry");
else {
- sciprintf(" sp=ST:%04x", (unsigned)(call.sp - _vm->_gamestate->stack_base));
- sciprintf(" fp=ST:%04x", (unsigned)(call.fp - _vm->_gamestate->stack_base));
+ printf(" sp=ST:%04x", (unsigned)(call.sp - _vm->_gamestate->stack_base));
+ printf(" fp=ST:%04x", (unsigned)(call.fp - _vm->_gamestate->stack_base));
}
} else
- sciprintf(" pc:none");
+ printf(" pc:none");
- sciprintf(" argp:ST:%04x", (unsigned)(call.variables_argp - _vm->_gamestate->stack_base));
+ printf(" argp:ST:%04x", (unsigned)(call.variables_argp - _vm->_gamestate->stack_base));
if (call.type == EXEC_STACK_TYPE_CALL)
- sciprintf(" script: %d", (*(Script *)_vm->_gamestate->seg_manager->_heap[call.addr.pc.segment]).nr);
- sciprintf("\n");
+ printf(" script: %d", (*(Script *)_vm->_gamestate->seg_manager->_heap[call.addr.pc.segment]).nr);
+ printf("\n");
}
return 0;
@@ -2290,21 +2291,21 @@
selector_id = _vm->_gamestate->_kernel->findSelector(selector_name);
if (selector_id < 0) {
- sciprintf("Unknown selector: \"%s\"\n", selector_name);
- return 1;
+ DebugPrintf("Unknown selector: \"%s\"\n", selector_name);
+ return true;
}
o = obj_get(_vm->_gamestate, object);
if (o == NULL) {
- sciprintf("Address \"%04x:%04x\" is not an object\n", PRINT_REG(object));
- return 1;
+ DebugPrintf("Address \"%04x:%04x\" is not an object\n", PRINT_REG(object));
+ return true;
}
SelectorType selector_type = lookup_selector(_vm->_gamestate, object, selector_id, 0, &fptr);
if (selector_type == kSelectorNone) {
- sciprintf("Object does not support selector: \"%s\"\n", selector_name);
- return 1;
+ DebugPrintf("Object does not support selector: \"%s\"\n", selector_name);
+ return true;
}
stackframe[0] = make_reg(0, selector_id);
@@ -3043,42 +3044,43 @@
Object *obj = obj_get(s, pos);
Object *var_container = obj;
int i;
+ Console *con = ((SciEngine *)g_engine)->getSciDebugger();
if (!obj) {
- sciprintf("[%04x:%04x]: Not an object.", PRINT_REG(pos));
+ con->DebugPrintf("[%04x:%04x]: Not an object.", PRINT_REG(pos));
return 1;
}
// Object header
- sciprintf("[%04x:%04x] %s : %3d vars, %3d methods\n", PRINT_REG(pos), obj_get_name(s, pos),
+ printf("[%04x:%04x] %s : %3d vars, %3d methods\n", PRINT_REG(pos), obj_get_name(s, pos),
obj->_variables.size(), obj->methods_nr);
if (!(obj->_variables[SCRIPT_INFO_SELECTOR].offset & SCRIPT_INFO_CLASS))
var_container = obj_get(s, obj->_variables[SCRIPT_SUPERCLASS_SELECTOR]);
- sciprintf(" -- member variables:\n");
+ printf(" -- member variables:\n");
for (i = 0; (uint)i < obj->_variables.size(); i++) {
- sciprintf(" ");
+ printf(" ");
if (i < var_container->variable_names_nr) {
- sciprintf("[%03x] %s = ", VM_OBJECT_GET_VARSELECTOR(var_container, i), selector_name(s, VM_OBJECT_GET_VARSELECTOR(var_container, i)));
+ printf("[%03x] %s = ", VM_OBJECT_GET_VARSELECTOR(var_container, i), selector_name(s, VM_OBJECT_GET_VARSELECTOR(var_container, i)));
} else
- sciprintf("p#%x = ", i);
+ printf("p#%x = ", i);
reg_t val = obj->_variables[i];
- sciprintf("%04x:%04x", PRINT_REG(val));
+ printf("%04x:%04x", PRINT_REG(val));
Object *ref = obj_get(s, val);
if (ref)
- sciprintf(" (%s)", obj_get_name(s, val));
+ printf(" (%s)", obj_get_name(s, val));
- sciprintf("\n");
+ printf("\n");
}
- sciprintf(" -- methods:\n");
+ printf(" -- methods:\n");
for (i = 0; i < obj->methods_nr; i++) {
reg_t fptr = VM_OBJECT_READ_FUNCTION(obj, i);
- sciprintf(" [%03x] %s = %04x:%04x\n", VM_OBJECT_GET_FUNCSELECTOR(obj, i), selector_name(s, VM_OBJECT_GET_FUNCSELECTOR(obj, i)), PRINT_REG(fptr));
+ printf(" [%03x] %s = %04x:%04x\n", VM_OBJECT_GET_FUNCSELECTOR(obj, i), selector_name(s, VM_OBJECT_GET_FUNCSELECTOR(obj, i)), PRINT_REG(fptr));
}
if (s->seg_manager->_heap[pos.segment]->getType() == MEM_OBJ_SCRIPT)
- sciprintf("\nOwner script:\t%d\n", s->seg_manager->getScript(pos.segment)->nr);
+ printf("\nOwner script:\t%d\n", s->seg_manager->getScript(pos.segment)->nr);
return 0;
}
@@ -3129,39 +3131,39 @@
GETRECT(view, loop, signal, cel);
- sciprintf("\n-- View information:\ncel %d/%d/%d at ", view, loop, cel);
+ printf("\n-- View information:\ncel %d/%d/%d at ", view, loop, cel);
x = GET_SELECTOR(pos, x);
y = GET_SELECTOR(pos, y);
priority = GET_SELECTOR(pos, priority);
if (s->_kernel->_selectorMap.z > 0) {
z = GET_SELECTOR(pos, z);
- sciprintf("(%d,%d,%d)\n", x, y, z);
+ printf("(%d,%d,%d)\n", x, y, z);
} else
- sciprintf("(%d,%d)\n", x, y);
+ printf("(%d,%d)\n", x, y);
if (priority == -1)
- sciprintf("No priority.\n\n");
+ printf("No priority.\n\n");
else
- sciprintf("Priority = %d (band starts at %d)\n\n", priority, PRIORITY_BAND_FIRST(priority));
+ printf("Priority = %d (band starts at %d)\n\n", priority, PRIORITY_BAND_FIRST(priority));
if (have_rects) {
- sciprintf("nsRect: [%d..%d]x[%d..%d]\n", nsLeft, nsRight, nsTop, nsBottom);
- sciprintf("lsRect: [%d..%d]x[%d..%d]\n", lsLeft, lsRight, lsTop, lsBottom);
- sciprintf("brRect: [%d..%d]x[%d..%d]\n", brLeft, brRight, brTop, brBottom);
+ printf("nsRect: [%d..%d]x[%d..%d]\n", nsLeft, nsRight, nsTop, nsBottom);
+ printf("lsRect: [%d..%d]x[%d..%d]\n", lsLeft, lsRight, lsTop, lsBottom);
+ printf("brRect: [%d..%d]x[%d..%d]\n", brLeft, brRight, brTop, brBottom);
}
nsrect = get_nsrect(s, pos, 0);
nsrect_clipped = get_nsrect(s, pos, 1);
brrect = set_base(s, pos);
- sciprintf("new nsRect: [%d..%d]x[%d..%d]\n", nsrect.x, nsrect.xend, nsrect.y, nsrect.yend);
- sciprintf("new clipped nsRect: [%d..%d]x[%d..%d]\n", nsrect_clipped.x, nsrect_clipped.xend, nsrect_clipped.y, nsrect_clipped.yend);
- sciprintf("new brRect: [%d..%d]x[%d..%d]\n", brrect.x, brrect.xend, brrect.y, brrect.yend);
- sciprintf("\n signals = %04x:\n", signal);
+ printf("new nsRect: [%d..%d]x[%d..%d]\n", nsrect.x, nsrect.xend, nsrect.y, nsrect.yend);
+ printf("new clipped nsRect: [%d..%d]x[%d..%d]\n", nsrect_clipped.x, nsrect_clipped.xend, nsrect_clipped.y, nsrect_clipped.yend);
+ printf("new brRect: [%d..%d]x[%d..%d]\n", brrect.x, brrect.xend, brrect.y, brrect.yend);
+ printf("\n signals = %04x:\n", signal);
for (i = 0; i < 16; i++)
if (signal & (1 << i))
- sciprintf(" %04x: %s\n", 1 << i, signals[i]);
+ printf(" %04x: %s\n", 1 << i, signals[i]);
}
#endif
#undef GETRECT
@@ -3183,17 +3185,17 @@
int brLeft, brRight, brBottom, brTop;
if (!s) {
- sciprintf("Not in debug state!\n");
+ printf("Not in debug state!\n");
return 1;
}
if ((pos < 4) || (pos > 0xfff0)) {
- sciprintf("Invalid address.\n");
+ printf("Invalid address.\n");
return 1;
}
if (((int16)READ_LE_UINT16(s->heap + pos + SCRIPT_OBJECT_MAGIC_OFFSET)) != SCRIPT_OBJECT_MAGIC_NUMBER) {
- sciprintf("Not an object.\n");
+ printf("Not an object.\n");
return 0;
}
@@ -3204,7 +3206,7 @@
(lookup_selector(s, pos, s->_kernel->_selectorMap.nsTop, NULL) == kSelectorVariable);
if (!is_view) {
- sciprintf("Not a dynamic View object.\n");
+ printf("Not a dynamic View object.\n");
return 0;
}
@@ -3239,7 +3241,7 @@
int opcode, opnumber;
if (!g_debugstate_valid) {
- sciprintf("Not in debug state\n");
+ printf("Not in debug state\n");
return 1;
}
Modified: scummvm/branches/gsoc2009-16bit/engines/sci/detection.cpp
===================================================================
--- scummvm/branches/gsoc2009-16bit/engines/sci/detection.cpp 2009-07-07 07:02:04 UTC (rev 42202)
+++ scummvm/branches/gsoc2009-16bit/engines/sci/detection.cpp 2009-07-07 07:09:56 UTC (rev 42203)
@@ -949,8 +949,8 @@
{"resource.004", 0, "9ae2a13708d691cd42f9129173c4b39d", 820443},
{NULL, 0, NULL, 0}}, Common::EN_ANY, Common::kPlatformAmiga, 0, GUIO_NOSPEECH},
0,
- SCI_VERSION_01,
- SCI_VERSION_01
+ SCI_VERSION_01_EGA,
+ SCI_VERSION_01_EGA
},
// King's Quest 1 SCI Remake - English DOS Non-Interactive Demo
@@ -1241,7 +1241,7 @@
{"resource.000", 0, "233394a5f33b475ae5975e7e9a420865", 8376352},
{NULL, 0, NULL, 0}}, Common::EN_ANY, Common::kPlatformPC, 0, GUIO_NONE},
0,
- 7,
+ SCI_VERSION_1_1,
SCI_VERSION_1_1
},
@@ -2066,8 +2066,8 @@
{"resource.001", 0, "9e33566515b18bee7915db448063bba2", 871853},
{NULL, 0, NULL, 0}}, Common::EN_ANY, Common::kPlatformPC, ADGF_DEMO, GUIO_NOSPEECH},
0,
- SCI_VERSION_01,
- SCI_VERSION_01
+ SCI_VERSION_01_EGA,
+ SCI_VERSION_01_EGA
},
// Mixed-Up Fairy Tales v1.000 - English DOS (supplied by markcoolio in bug report #2723791)
@@ -2081,8 +2081,8 @@
{"resource.004", 0, "f79daa70390d73746742ffcfc3dc4471", 937580},
{NULL, 0, NULL, 0}}, Common::EN_ANY, Common::kPlatformPC, 0, GUIO_NOSPEECH},
0,
- SCI_VERSION_01,
- SCI_VERSION_01
+ SCI_VERSION_01_EGA,
+ SCI_VERSION_01_EGA
},
// Mixed-Up Fairy Tales - English DOS Floppy (from jvprat)
@@ -2095,8 +2095,8 @@
{"resource.003", 0, "dd6cef0c592eadb7e6be9a25307c57a2", 1344719},
{NULL, 0, NULL, 0}}, Common::EN_ANY, Common::kPlatformPC, 0, GUIO_NOSPEECH},
0,
- SCI_VERSION_01,
- SCI_VERSION_01
+ SCI_VERSION_01_EGA,
+ SCI_VERSION_01_EGA
},
// Mixed-Up Mother Goose - English Amiga (from www.back2roots.org)
@@ -2108,8 +2108,8 @@
{"resource.002", 0, "fb552ae550ca1dac19ed8f6a3767612d", 817191},
{NULL, 0, NULL, 0}}, Common::EN_ANY, Common::kPlatformAmiga, 0, GUIO_NOSPEECH},
0,
- SCI_VERSION_01,
- SCI_VERSION_01
+ SCI_VERSION_01_EGA,
+ SCI_VERSION_01_EGA
},
// Mixed-Up Mother Goose v2.000 - English DOS Floppy (supplied by markcoolio in bug report #2723795)
@@ -2119,8 +2119,8 @@
{"resource.000", 0, "b7ecd8ae9e254e80310b5a668b276e6e", 2948975},
{NULL, 0, NULL, 0}}, Common::EN_ANY, Common::kPlatformPC, 0, GUIO_NOSPEECH},
0,
- SCI_VERSION_01,
- SCI_VERSION_01
+ SCI_VERSION_01_EGA,
+ SCI_VERSION_01_EGA
},
// Mixed-Up Mother Goose - English DOS CD (from jvprat)
@@ -2520,7 +2520,7 @@
{NULL, 0, NULL, 0}}, Common::JA_JPN, Common::kPlatformPC98, 0, GUIO_NOSPEECH},
0,
SCI_VERSION_AUTODETECT,
- SCI_VERSION_01
+ SCI_VERSION_01_EGA
},
// Quest for Glory 1 - Japanese PC-98 5.25" Floppy
@@ -2533,7 +2533,7 @@
{NULL, 0, NULL, 0}}, Common::JA_JPN, Common::kPlatformPC98, 0, GUIO_NOSPEECH},
0,
SCI_VERSION_AUTODETECT,
- SCI_VERSION_01
+ SCI_VERSION_01_EGA
},
// Quest for Glory 1 - English Amiga
@@ -2606,7 +2606,7 @@
{NULL, 0, NULL, 0}}, Common::EN_ANY, Common::kPlatformAmiga, 0, GUIO_NOSPEECH},
0,
SCI_VERSION_AUTODETECT,
- SCI_VERSION_01
+ SCI_VERSION_01_EGA
},
// Quest for Glory 2 - English (from FRG)
@@ -2621,7 +2621,7 @@
{NULL, 0, NULL, 0}}, Common::EN_ANY, Common::kPlatformPC, 0, GUIO_NOSPEECH},
0,
SCI_VERSION_AUTODETECT,
- SCI_VERSION_01
+ SCI_VERSION_01_EGA
},
// Quest for Glory 2 - English DOS
@@ -2639,7 +2639,7 @@
{NULL, 0, NULL, 0}}, Common::EN_ANY, Common::kPlatformPC, 0, GUIO_NOSPEECH},
0,
SCI_VERSION_AUTODETECT,
- SCI_VERSION_01
+ SCI_VERSION_01_EGA
},
// Quest for Glory 3 - English DOS Non-Interactive Demo (from FRG)
Modified: scummvm/branches/gsoc2009-16bit/engines/sci/engine/game.cpp
===================================================================
--- scummvm/branches/gsoc2009-16bit/engines/sci/engine/game.cpp 2009-07-07 07:02:04 UTC (rev 42202)
+++ scummvm/branches/gsoc2009-16bit/engines/sci/engine/game.cpp 2009-07-07 07:09:56 UTC (rev 42203)
@@ -43,7 +43,7 @@
gfx_color_t transparent = { PaletteEntry(), 0, -1, -1, 0 };
debug(2, "Initializing graphics");
- if (s->resmgr->_sciVersion <= SCI_VERSION_01 || (s->_flags & GF_SCI1_EGA)) {
+ if (s->resmgr->_sciVersion <= SCI_VERSION_01_EGA || (s->_flags & GF_SCI1_EGA)) {
int i;
for (i = 0; i < 16; i++) {
@@ -181,7 +181,7 @@
}
int game_init_sound(EngineState *s, int sound_flags) {
- if (s->resmgr->_sciVersion >= SCI_VERSION_01)
+ if (s->resmgr->_sciVersion >= SCI_VERSION_01_EGA)
sound_flags |= SFX_STATE_FLAG_MULTIPLAY;
s->sfx_init_flags = sound_flags;
Modified: scummvm/branches/gsoc2009-16bit/engines/sci/engine/gc.cpp
===================================================================
--- scummvm/branches/gsoc2009-16bit/engines/sci/engine/gc.cpp 2009-07-07 07:02:04 UTC (rev 42202)
+++ scummvm/branches/gsoc2009-16bit/engines/sci/engine/gc.cpp 2009-07-07 07:09:56 UTC (rev 42203)
@@ -29,7 +29,6 @@
namespace Sci {
//#define DEBUG_GC
-//#define DEBUG_GC_VERBOSE
struct WorklistManager {
Common::Array<reg_t> _worklist;
@@ -39,9 +38,7 @@
if (!reg.segment) // No numbers
return;
- #ifdef DEBUG_GC_VERBOSE
- sciprintf("[GC] Adding %04x:%04x\n", PRINT_REG(reg));
- #endif
+ debugC(2, kDebugLevelGC, "[GC] Adding %04x:%04x\n", PRINT_REG(reg));
if (_map.contains(reg))
return; // already dealt with it
@@ -92,10 +89,9 @@
for (pos = s->stack_base; pos < xs.sp; pos++)
wm.push(*pos);
}
-#ifdef DEBUG_GC_VERBOSE
- sciprintf("[GC] -- Finished adding value stack");
-#endif
+ debugC(2, kDebugLevelGC, "[GC] -- Finished adding value stack");
+
// Init: Execution Stack
Common::List<ExecStack>::iterator iter;
for (iter = s->_executionStack.begin();
@@ -109,10 +105,9 @@
wm.push(*(es.getVarPointer(s)));
}
}
-#ifdef DEBUG_GC_VERBOSE
- sciprintf("[GC] -- Finished adding execution stack");
-#endif
+ debugC(2, kDebugLevelGC, "[GC] -- Finished adding execution stack");
+
// Init: Explicitly loaded scripts
for (i = 1; i < sm->_heap.size(); i++)
if (sm->_heap[i]
@@ -129,18 +124,15 @@
}
}
}
-#ifdef DEBUG_GC_VERBOSE
- sciprintf("[GC] -- Finished explicitly loaded scripts, done with root set");
-#endif
+ debugC(2, kDebugLevelGC, "[GC] -- Finished explicitly loaded scripts, done with root set\n");
+
// Run Worklist Algorithm
while (!wm._worklist.empty()) {
reg_t reg = wm._worklist.back();
wm._worklist.pop_back();
if (reg.segment != s->stack_segment) { // No need to repeat this one
-#ifdef DEBUG_GC_VERBOSE
- sciprintf("[GC] Checking %04x:%04x\n", PRINT_REG(reg));
-#endif
+ debugC(2, kDebugLevelGC, "[GC] Checking %04x:%04x\n", PRINT_REG(reg));
if (reg.segment < sm->_heap.size() && sm->_heap[reg.segment])
sm->_heap[reg.segment]->listAllOutgoingReferences(s, reg, &wm, add_outgoing_refs);
}
@@ -170,7 +162,7 @@
// Not found -> we can free it
deallocator->mobj->freeAtAddress(deallocator->segmgr, addr);
#ifdef DEBUG_GC
- sciprintf("[GC] Deallocating %04x:%04x\n", PRINT_REG(addr));
+ debugC(2, kDebugLevelGC, "[GC] Deallocating %04x:%04x\n", PRINT_REG(addr));
deallocator->segcount[deallocator->mobj->getType()]++;
#endif
}
@@ -183,7 +175,7 @@
SegManager *sm = s->seg_manager;
#ifdef DEBUG_GC
- sciprintf("[GC] Running...\n");
+ debugC(2, kDebugLevelGC, "[GC] Running...\n");
memset(&(deallocator.segcount), 0, sizeof(int) * (MEM_OBJ_MAX + 1));
#endif
@@ -205,10 +197,10 @@
#ifdef DEBUG_GC
{
int i;
- sciprintf("[GC] Summary:\n");
+ debugC(2, kDebugLevelGC, "[GC] Summary:\n");
for (i = 0; i <= MEM_OBJ_MAX; i++)
if (deallocator.segcount[i])
- sciprintf("\t%d\t* %s\n", deallocator.segcount[i], deallocator.segnames[i]);
+ debugC(2, kDebugLevelGC, "\t%d\t* %s\n", deallocator.segcount[i], deallocator.segnames[i]);
}
#endif
}
Modified: scummvm/branches/gsoc2009-16bit/engines/sci/engine/grammar.cpp
===================================================================
--- scummvm/branches/gsoc2009-16bit/engines/sci/engine/grammar.cpp 2009-07-07 07:02:04 UTC (rev 42202)
+++ scummvm/branches/gsoc2009-16bit/engines/sci/engine/grammar.cpp 2009-07-07 07:09:56 UTC (rev 42203)
@@ -51,51 +51,51 @@
int wspace = 0;
if (!rule) {
- sciprintf("NULL rule");
+ warning("NULL rule");
return;
}
- sciprintf("[%03x] -> ", rule->id);
+ printf("[%03x] -> ", rule->id);
if (!rule->length)
- sciprintf("e");
+ printf("e");
for (i = 0; i < rule->length; i++) {
uint token = rule->data[i];
if (token == TOKEN_OPAREN) {
if (i == rule->first_special)
- sciprintf("_");
+ printf("_");
- sciprintf("(");
+ printf("(");
wspace = 0;
} else if (token == TOKEN_CPAREN) {
if (i == rule->first_special)
- sciprintf("_");
+ printf("_");
- sciprintf(")");
+ printf(")");
wspace = 0;
} else {
if (wspace)
- sciprintf(" ");
+ printf(" ");
if (i == rule->first_special)
- sciprintf("_");
+ printf("_");
if (token & TOKEN_TERMINAL_CLASS)
- sciprintf("C(%04x)", token & 0xffff);
+ printf("C(%04x)", token & 0xffff);
else if (token & TOKEN_TERMINAL_GROUP)
- sciprintf("G(%04x)", token & 0xffff);
+ printf("G(%04x)", token & 0xffff);
else if (token & TOKEN_STUFFING_WORD)
- sciprintf("%03x", token & 0xffff);
+ printf("%03x", token & 0xffff);
else
- sciprintf("[%03x]", token); /* non-terminal */
+ printf("[%03x]", token); /* non-terminal */
wspace = 1;
}
if (i == rule->first_special)
- sciprintf("_");
+ printf("_");
}
- sciprintf(" [%d specials]", rule->specials_nr);
+ printf(" [%d specials]", rule->specials_nr);
}
static void _vfree(parse_rule_t *rule) {
@@ -287,12 +287,12 @@
static void _vprl(parse_rule_list_t *list, int pos) {
if (list) {
- sciprintf("R%03d: ", pos);
+ printf("R%03d: ", pos);
vocab_print_rule(list->rule);
- sciprintf("\n");
+ printf("\n");
_vprl(list->next, pos + 1);
} else {
- sciprintf("%d rules total.\n", pos);
+ printf("%d rules total.\n", pos);
}
}
@@ -466,9 +466,9 @@
else
writepos = _vbpt_append(nodes, pos, writepos, token & 0xffff);
} else {
- sciprintf("\nError in parser (grammar.cpp, _vbpt_write_subexpression()): Rule data broken in rule ");
+ printf("\nError in parser (grammar.cpp, _vbpt_write_subexpression()): Rule data broken in rule ");
vocab_print_rule(rule);
- sciprintf(", at token position %d\n", *pos);
@@ Diff output truncated at 100000 characters. @@
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list