[Scummvm-cvs-logs] SF.net SVN: scummvm:[35309] scummvm/trunk/engines/gob
drmccoy at users.sourceforge.net
drmccoy at users.sourceforge.net
Fri Dec 12 01:10:40 CET 2008
Revision: 35309
http://scummvm.svn.sourceforge.net/scummvm/?rev=35309&view=rev
Author: drmccoy
Date: 2008-12-12 00:10:39 +0000 (Fri, 12 Dec 2008)
Log Message:
-----------
Working cursor in Urban Runner
Modified Paths:
--------------
scummvm/trunk/engines/gob/draw_v1.cpp
scummvm/trunk/engines/gob/draw_v2.cpp
scummvm/trunk/engines/gob/game.cpp
scummvm/trunk/engines/gob/game.h
scummvm/trunk/engines/gob/init.cpp
scummvm/trunk/engines/gob/inter_v1.cpp
scummvm/trunk/engines/gob/inter_v6.cpp
scummvm/trunk/engines/gob/video_v6.cpp
Modified: scummvm/trunk/engines/gob/draw_v1.cpp
===================================================================
--- scummvm/trunk/engines/gob/draw_v1.cpp 2008-12-11 21:57:47 UTC (rev 35308)
+++ scummvm/trunk/engines/gob/draw_v1.cpp 2008-12-12 00:10:39 UTC (rev 35309)
@@ -324,8 +324,6 @@
void Draw_v1::spriteOperation(int16 operation) {
uint16 id;
byte *dataBuf;
- Game::TotResItem *itemPtr;
- int32 offset;
int16 len;
int16 x, y;
int16 perLine;
@@ -409,25 +407,11 @@
_destSpriteX + _spriteRight - 1, _destSpriteY + _spriteBottom - 1);
delete[] dataBuf;
break;
- } else if (id >= _vm->_game->_totResourceTable->itemsCount) {
- warning("Trying to load non-existent sprite (id = %d, count = %d)", id,
- _vm->_game->_totResourceTable->itemsCount);
- break;
}
- // Load from .TOT resources
- itemPtr = &_vm->_game->_totResourceTable->items[id];
- offset = itemPtr->offset;
- if (offset >= 0) {
- dataBuf = _vm->_game->_totResourceTable->dataPtr +
- szGame_TotResTable + szGame_TotResItem *
- _vm->_game->_totResourceTable->itemsCount + offset;
- } else {
- dataBuf = _vm->_game->_imFileData +
- (int32) READ_LE_UINT32(&((int32 *) _vm->_game->_imFileData)[-offset - 1]);
- }
- _spriteRight = itemPtr->width;
- _spriteBottom = itemPtr->height;
+ if (!(dataBuf = _vm->_game->loadTotResource(id, 0, &_spriteRight, &_spriteBottom)))
+ break;
+
_vm->_video->drawPackedSprite(dataBuf,
_spriteRight, _spriteBottom,
_destSpriteX, _destSpriteY,
Modified: scummvm/trunk/engines/gob/draw_v2.cpp
===================================================================
--- scummvm/trunk/engines/gob/draw_v2.cpp 2008-12-11 21:57:47 UTC (rev 35308)
+++ scummvm/trunk/engines/gob/draw_v2.cpp 2008-12-12 00:10:39 UTC (rev 35309)
@@ -49,11 +49,13 @@
_backSurface = _spritesArray[21];
_vm->_video->clearSurf(_backSurface);
- initSpriteSurf(23, 32, 16, 2);
- _cursorSpritesBack = _spritesArray[23];
- _cursorSprites = _cursorSpritesBack;
- _scummvmCursor =
- _vm->_video->initSurfDesc(_vm->_global->_videoMode, 16, 16, SCUMMVM_CURSOR);
+ if (!_spritesArray[23]) {
+ initSpriteSurf(23, 32, 16, 2);
+ _cursorSpritesBack = _spritesArray[23];
+ _cursorSprites = _cursorSpritesBack;
+ _scummvmCursor =
+ _vm->_video->initSurfDesc(_vm->_global->_videoMode, 16, 16, SCUMMVM_CURSOR);
+ }
_spritesArray[20] = _frontSurface;
_spritesArray[21] = _backSurface;
@@ -62,10 +64,10 @@
}
void Draw_v2::closeScreen() {
- freeSprite(23);
- _cursorSprites = 0;
- _cursorSpritesBack = 0;
- _scummvmCursor = 0;
+ //freeSprite(23);
+ //_cursorSprites = 0;
+ //_cursorSpritesBack = 0;
+ //_scummvmCursor = 0;
freeSprite(21);
}
@@ -609,8 +611,6 @@
void Draw_v2::spriteOperation(int16 operation) {
uint16 id;
byte *dataBuf;
- Game::TotResItem *itemPtr;
- int32 offset;
int16 len;
int16 x, y;
SurfaceDesc *sourceSurf, *destSurf;
@@ -756,6 +756,7 @@
case DRAW_LOADSPRITE:
id = _spriteLeft;
+ warning("Loadsprite %d to %d", id, _destSurface);
if ((id >= 30000) || (_vm->_game->_lomHandle >= 0)) {
dataBuf = 0;
@@ -779,19 +780,9 @@
}
// Load from .TOT resources
- itemPtr = &_vm->_game->_totResourceTable->items[id];
- offset = itemPtr->offset;
- if (offset >= 0) {
- dataBuf = _vm->_game->_totResourceTable->dataPtr +
- szGame_TotResTable + szGame_TotResItem *
- _vm->_game->_totResourceTable->itemsCount + offset;
- } else {
- dataBuf = _vm->_game->_imFileData +
- (int32) READ_LE_UINT32(&((int32 *) _vm->_game->_imFileData)[-offset - 1]);
- }
+ if (!(dataBuf = _vm->_game->loadTotResource(id, 0, &_spriteRight, &_spriteBottom)))
+ break;
- _spriteRight = itemPtr->width;
- _spriteBottom = itemPtr->height;
_vm->_video->drawPackedSprite(dataBuf,
_spriteRight, _spriteBottom,
_destSpriteX, _destSpriteY,
@@ -802,6 +793,11 @@
break;
case DRAW_PRINTTEXT:
+ if (_vm->getGameType() == kGameTypeUrban) {
+ warning("Urban Stub: Print text \"%s\"", _textToPrint);
+ break;
+ }
+
len = strlen(_textToPrint);
left = _destSpriteX;
Modified: scummvm/trunk/engines/gob/game.cpp
===================================================================
--- scummvm/trunk/engines/gob/game.cpp 2008-12-11 21:57:47 UTC (rev 35308)
+++ scummvm/trunk/engines/gob/game.cpp 2008-12-12 00:10:39 UTC (rev 35309)
@@ -103,6 +103,16 @@
}
Game::~Game() {
+ delete[] _vm->_game->_totFileData;
+ if (_vm->_game->_totTextData) {
+ if (_vm->_game->_totTextData->items)
+ delete[] _vm->_game->_totTextData->items;
+ delete _vm->_game->_totTextData;
+ }
+ if (_vm->_game->_totResourceTable) {
+ delete[] _vm->_game->_totResourceTable->items;
+ delete _vm->_game->_totResourceTable;
+ }
}
byte *Game::loadExtData(int16 itemId, int16 *pResWidth,
@@ -268,14 +278,27 @@
_vm->_draw->freeSprite(30 + _captureCount);
}
-byte *Game::loadTotResource(int16 id, int16 *dataSize) {
+byte *Game::loadTotResource(int16 id,
+ int16 *dataSize, int16 *width, int16 *height) {
+
TotResItem *itemPtr;
int32 offset;
+ if (id >= _vm->_game->_totResourceTable->itemsCount) {
+ warning("Trying to load non-existent TOT resource (%s, %d/%d)",
+ _curTotFile, id, _totResourceTable->itemsCount - 1);
+ return 0;
+ }
+
itemPtr = &_totResourceTable->items[id];
offset = itemPtr->offset;
+
if (dataSize)
*dataSize = itemPtr->size;
+ if (width)
+ *width = itemPtr->width;
+ if (height)
+ *height = itemPtr->height;
if (offset < 0) {
offset = (-offset - 1) * 4;
Modified: scummvm/trunk/engines/gob/game.h
===================================================================
--- scummvm/trunk/engines/gob/game.h 2008-12-11 21:57:47 UTC (rev 35308)
+++ scummvm/trunk/engines/gob/game.h 2008-12-12 00:10:39 UTC (rev 35309)
@@ -48,38 +48,6 @@
uint16 funcSub;
} PACKED_STRUCT;
-#define szGame_TotResItem (4 + 2 + 2 + 2)
- struct TotResItem {
- int32 offset; // if > 0, then offset from end of resource table.
- // If < 0, then -offset-1 is index in .IM file table
- int16 size;
- int16 width;
- int16 height;
- } PACKED_STRUCT;
-
-#define szGame_TotResTable (2 + 1)
- struct TotResTable {
- int16 itemsCount;
- byte unknown;
- TotResItem *items;
- byte *dataPtr;
- } PACKED_STRUCT;
-
-#define szGame_ExtItem (4 + 2 + 2 + 2)
- struct ExtItem {
- int32 offset; // offset from the table end
- uint16 size;
- int16 width; // width & 0x7FFF: width, width & 0x8000: pack flag
- int16 height; // not zero
- } PACKED_STRUCT;
-
-#define szGame_ExtTable (2 + 1)
- struct ExtTable {
- int16 itemsCount;
- byte unknown;
- ExtItem *items;
- } PACKED_STRUCT;
-
#define szGame_TotTextItem (2 + 2)
struct TotTextItem {
int16 offset;
@@ -102,7 +70,6 @@
#include "common/pack-end.h" // END STRUCT PACKING
- TotResTable *_totResourceTable;
Collision *_collisionAreas;
Collision *_collStack[5];
@@ -131,7 +98,7 @@
virtual ~Game();
byte *loadExtData(int16 dataId, int16 *pResWidth, int16 *pResHeight, uint32 *dataSize = 0);
- byte *loadTotResource(int16 id, int16 *dataSize = 0);
+ byte *loadTotResource(int16 id, int16 *dataSize = 0, int16 *width = 0, int16 *height = 0);
void capturePush(int16 left, int16 top, int16 width, int16 height);
void capturePop(char doDraw);
@@ -166,6 +133,42 @@
virtual void prepareStart(void) = 0;
protected:
+#include "common/pack-start.h" // START STRUCT PACKING
+
+#define szGame_TotResItem (4 + 2 + 2 + 2)
+ struct TotResItem {
+ int32 offset; // if > 0, then offset from end of resource table.
+ // If < 0, then -offset-1 is index in .IM file table
+ int16 size;
+ int16 width;
+ int16 height;
+ } PACKED_STRUCT;
+
+#define szGame_TotResTable (2 + 1)
+ struct TotResTable {
+ int16 itemsCount;
+ byte unknown;
+ TotResItem *items;
+ byte *dataPtr;
+ } PACKED_STRUCT;
+
+#define szGame_ExtItem (4 + 2 + 2 + 2)
+ struct ExtItem {
+ int32 offset; // offset from the table end
+ uint16 size;
+ int16 width; // width & 0x7FFF: width, width & 0x8000: pack flag
+ int16 height; // not zero
+ } PACKED_STRUCT;
+
+#define szGame_ExtTable (2 + 1)
+ struct ExtTable {
+ int16 itemsCount;
+ byte unknown;
+ ExtItem *items;
+ } PACKED_STRUCT;
+
+#include "common/pack-end.h" // END STRUCT PACKING
+
int16 _lastCollKey;
int16 _lastCollAreaIndex;
int16 _lastCollId;
@@ -178,6 +181,7 @@
char _tempStr[256];
+ TotResTable *_totResourceTable;
ExtTable *_extTable;
char _curImaFile[18];
Modified: scummvm/trunk/engines/gob/init.cpp
===================================================================
--- scummvm/trunk/engines/gob/init.cpp 2008-12-11 21:57:47 UTC (rev 35308)
+++ scummvm/trunk/engines/gob/init.cpp 2008-12-12 00:10:39 UTC (rev 35309)
@@ -89,7 +89,6 @@
_vm->_game->_totTextData = 0;
_vm->_game->_totFileData = 0;
- _vm->_game->_totResourceTable = 0;
_palDesc = new Video::PalDesc;
_vm->validateVideoMode(_vm->_global->_videoMode);
@@ -208,16 +207,6 @@
_vm->_sound->cdStop();
_vm->_sound->cdUnloadLIC();
- delete[] _vm->_game->_totFileData;
- if (_vm->_game->_totTextData) {
- if (_vm->_game->_totTextData->items)
- delete[] _vm->_game->_totTextData->items;
- delete _vm->_game->_totTextData;
- }
- if (_vm->_game->_totResourceTable) {
- delete[] _vm->_game->_totResourceTable->items;
- delete _vm->_game->_totResourceTable;
- }
}
for (int i = 0; i < 4; i++) {
Modified: scummvm/trunk/engines/gob/inter_v1.cpp
===================================================================
--- scummvm/trunk/engines/gob/inter_v1.cpp 2008-12-11 21:57:47 UTC (rev 35308)
+++ scummvm/trunk/engines/gob/inter_v1.cpp 2008-12-12 00:10:39 UTC (rev 35309)
@@ -798,6 +798,7 @@
_vm->_draw->adjustCoords(0, &width, &height);
count = load16();
+
if (count < 2)
count = 2;
@@ -1163,10 +1164,8 @@
}
bool Inter_v1::o1_loadCursor(OpFuncParams ¶ms) {
- Game::TotResItem *itemPtr;
int16 width, height;
byte *dataBuf;
- int32 offset;
int16 id;
int8 index;
@@ -1176,21 +1175,8 @@
if ((index * _vm->_draw->_cursorWidth) >= _vm->_draw->_cursorSprites->getWidth())
return false;
- itemPtr = &_vm->_game->_totResourceTable->items[id];
- offset = itemPtr->offset;
+ dataBuf = _vm->_game->loadTotResource(id, 0, &width, &height);
- if (offset < 0) {
- offset = (-offset - 1) * 4;
- dataBuf = _vm->_game->_imFileData +
- (int32) READ_LE_UINT32(_vm->_game->_imFileData + offset);
- } else
- dataBuf = _vm->_game->_totResourceTable->dataPtr + szGame_TotResTable +
- szGame_TotResItem * _vm->_game->_totResourceTable->itemsCount +
- offset;
-
- width = itemPtr->width;
- height = itemPtr->height;
-
_vm->_video->fillRect(_vm->_draw->_cursorSprites,
index * _vm->_draw->_cursorWidth, 0,
index * _vm->_draw->_cursorWidth + _vm->_draw->_cursorWidth - 1,
@@ -1896,6 +1882,7 @@
_vm->_draw->_destSpriteY = _vm->_parse->parseValExpr();
_vm->_draw->_transparency = load16();
+
_vm->_draw->spriteOperation(DRAW_BLITSURF);
return false;
}
Modified: scummvm/trunk/engines/gob/inter_v6.cpp
===================================================================
--- scummvm/trunk/engines/gob/inter_v6.cpp 2008-12-11 21:57:47 UTC (rev 35308)
+++ scummvm/trunk/engines/gob/inter_v6.cpp 2008-12-12 00:10:39 UTC (rev 35309)
@@ -650,10 +650,8 @@
}
bool Inter_v6::o6_loadCursor(OpFuncParams ¶ms) {
- Game::TotResItem *itemPtr;
int16 width, height;
byte *dataBuf;
- int32 offset;
int16 id;
int8 index;
@@ -686,21 +684,8 @@
if ((index * _vm->_draw->_cursorWidth) >= _vm->_draw->_cursorSprites->getWidth())
return false;
- itemPtr = &_vm->_game->_totResourceTable->items[id];
- offset = itemPtr->offset;
+ dataBuf = _vm->_game->loadTotResource(id, 0, &width, &height);
- if (offset < 0) {
- offset = (-offset - 1) * 4;
- dataBuf = _vm->_game->_imFileData +
- (int32) READ_LE_UINT32(_vm->_game->_imFileData + offset);
- } else
- dataBuf = _vm->_game->_totResourceTable->dataPtr + szGame_TotResTable +
- szGame_TotResItem * _vm->_game->_totResourceTable->itemsCount +
- offset;
-
- width = itemPtr->width;
- height = itemPtr->height;
-
_vm->_video->fillRect(_vm->_draw->_cursorSprites,
index * _vm->_draw->_cursorWidth, 0,
index * _vm->_draw->_cursorWidth + _vm->_draw->_cursorWidth - 1,
Modified: scummvm/trunk/engines/gob/video_v6.cpp
===================================================================
--- scummvm/trunk/engines/gob/video_v6.cpp 2008-12-11 21:57:47 UTC (rev 35308)
+++ scummvm/trunk/engines/gob/video_v6.cpp 2008-12-12 00:10:39 UTC (rev 35309)
@@ -58,10 +58,12 @@
int16 height = READ_LE_UINT16(data + 2);
data += 4;
+ warning("drawPacked: %d, %d, %d, %d", x, y, width, height);
+
const byte *srcData = data;
byte *uncBuf = 0;
- if (*data++ != 0) {
+ if (*srcData++ != 0) {
uint32 size = READ_LE_UINT32(data);
uncBuf = new byte[size];
@@ -88,6 +90,8 @@
if (dataHeight & 0xF)
dataHeight = (dataHeight & 0xFFF0) + 16;
+ warning("drawYUVData: %d, %d, %d, %d, %d, %d", x, y, width, height, dataWidth, dataHeight);
+
const byte *dataY = srcData;
const byte *dataU = dataY + (dataWidth * dataHeight);
const byte *dataV = dataU + ((dataWidth * dataHeight) >> 4);
@@ -114,11 +118,16 @@
int16 dataWidth, int16 dataHeight, int16 width, int16 height,
const byte *dataY, const byte *dataU, const byte *dataV) {
- byte *vidMem = destDesc->getVidMem() + y * width + x;
+ warning("drawYUV: %dx%d->%d+%d (%dx%d) (%dx%d)", width, height, x, y, dataWidth, dataHeight,
+ destDesc->getWidth(), destDesc->getHeight());
- width = MIN(width, destDesc->getWidth());
- height = MIN(height, destDesc->getHeight());
+ byte *vidMem = destDesc->getVidMem() + y * destDesc->getWidth() + x;
+ if ((x + width - 1) >= destDesc->getWidth())
+ width = destDesc->getWidth() - x;
+ if ((y + height - 1) >= destDesc->getHeight())
+ height = destDesc->getHeight() - y;
+
SierraLight *dither = new SierraLight(width, height, _palLUT);
for (int i = 0; i < height; i++) {
@@ -136,7 +145,7 @@
}
dither->nextLine();
- vidMem += width;
+ vidMem += destDesc->getWidth();
}
}
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