[Scummvm-cvs-logs] SF.net SVN: scummvm: [28946] scummvm/trunk/engines/agi
sev at users.sourceforge.net
sev at users.sourceforge.net
Tue Sep 18 22:23:07 CEST 2007
Revision: 28946
http://scummvm.svn.sourceforge.net/scummvm/?rev=28946&view=rev
Author: sev
Date: 2007-09-18 13:23:06 -0700 (Tue, 18 Sep 2007)
Log Message:
-----------
Fix picture drawing in Troll's Tale. Implement room navigation.
Modified Paths:
--------------
scummvm/trunk/engines/agi/picture.cpp
scummvm/trunk/engines/agi/picture.h
scummvm/trunk/engines/agi/preagi_common.cpp
scummvm/trunk/engines/agi/preagi_troll.cpp
scummvm/trunk/engines/agi/preagi_troll.h
Modified: scummvm/trunk/engines/agi/picture.cpp
===================================================================
--- scummvm/trunk/engines/agi/picture.cpp 2007-09-18 20:16:33 UTC (rev 28945)
+++ scummvm/trunk/engines/agi/picture.cpp 2007-09-18 20:23:06 UTC (rev 28946)
@@ -253,11 +253,6 @@
p = _vm->_game.sbuf16c[y * _width + x];
- // FIXME: This overflows stack, but otherwise is a wild guess
- // original has some checks against color 11 (0xB)
- if (_pictureVersion == AGIPIC_V15 && 0)
- return (p & 0x0f) == 0;
-
if (!_priOn && _scrOn && _scrColor != 15)
return (p & 0x0f) == 15;
@@ -811,7 +806,7 @@
* @param clear clear AGI screen before drawing
* @param agi256 load an AGI256 picture resource
*/
-int PictureMgr::decodePicture(int n, int clear, bool agi256, int pic_width, int pic_height) {
+int PictureMgr::decodePicture(int n, int clr, bool agi256, int pic_width, int pic_height) {
debugC(8, kDebugLevelResources, "(%d)", n);
_patCode = 0;
@@ -827,7 +822,7 @@
_width = pic_width;
_height = pic_height;
- if (clear && !agi256) // 256 color pictures should always fill the whole screen, so no clearing for them.
+ if (clr && !agi256) // 256 color pictures should always fill the whole screen, so no clearing for them.
memset(_vm->_game.sbuf16c, 0x4f, _width * _height); // Clear 16 color AGI screen (Priority 4, color white).
if (!agi256) {
@@ -843,9 +838,9 @@
warning("Oversized AGI256 picture resource %d, decoding only %ux%u part of it", n, _width, _height);
}
- if (clear)
+ if (clr)
_vm->clearImageStack();
- _vm->recordImageStackCall(ADD_PIC, n, clear, agi256, 0, 0, 0, 0);
+ _vm->recordImageStackCall(ADD_PIC, n, clr, agi256, 0, 0, 0, 0);
return errOK;
}
@@ -859,7 +854,7 @@
* @param length the size of the picture data buffer
* @param clear clear AGI screen before drawing
*/
-int PictureMgr::decodePicture(byte* data, uint32 length, int clear, int pic_width, int pic_height) {
+int PictureMgr::decodePicture(byte* data, uint32 length, int clr, int pic_width, int pic_height) {
_patCode = 0;
_patNum = 0;
_priOn = _scrOn = false;
@@ -873,7 +868,7 @@
_width = pic_width;
_height = pic_height;
- if (clear) // 256 color pictures should always fill the whole screen, so no clearing for them.
+ if (clr) // 256 color pictures should always fill the whole screen, so no clearing for them.
memset(_vm->_game.sbuf16c, 0x4f, _width * _height); // Clear 16 color AGI screen (Priority 4, color white).
drawPicture(); // Draw 16 color picture.
@@ -900,6 +895,10 @@
return errOK;
}
+void PictureMgr::clear() {
+ memset(_vm->_game.sbuf16c, 0x4f, _width * _height);
+}
+
/**
* Show AGI picture.
* This function copies a ``hidden'' AGI picture to the output device.
Modified: scummvm/trunk/engines/agi/picture.h
===================================================================
--- scummvm/trunk/engines/agi/picture.h 2007-09-18 20:16:33 UTC (rev 28945)
+++ scummvm/trunk/engines/agi/picture.h 2007-09-18 20:23:06 UTC (rev 28946)
@@ -101,6 +101,8 @@
void setPictureFlags(int flags) { _flags = flags; }
+ void clear();
+
void setOffset(int offX, int offY) {
_xOffset = offX;
_yOffset = offY;
Modified: scummvm/trunk/engines/agi/preagi_common.cpp
===================================================================
--- scummvm/trunk/engines/agi/preagi_common.cpp 2007-09-18 20:16:33 UTC (rev 28945)
+++ scummvm/trunk/engines/agi/preagi_common.cpp 2007-09-18 20:23:06 UTC (rev 28946)
@@ -40,7 +40,7 @@
if (overrideDefault)
_defaultColor = attr;
- _gfx->clearScreen((attr & 0xF0) / 0x10);
+ _gfx->clearScreen((attr & 0xF0) / 0x10);
}
void PreAgiEngine::clearGfxScreen(int attr) {
Modified: scummvm/trunk/engines/agi/preagi_troll.cpp
===================================================================
--- scummvm/trunk/engines/agi/preagi_troll.cpp 2007-09-18 20:16:33 UTC (rev 28945)
+++ scummvm/trunk/engines/agi/preagi_troll.cpp 2007-09-18 20:23:06 UTC (rev 28946)
@@ -108,16 +108,18 @@
// Graphics
-void Troll::drawPic(int iPic, bool f3IsCont, bool clear) {
+void Troll::drawPic(int iPic, bool f3IsCont, bool clr) {
uint8 frame[] = {
0xf1, 0x3, 0xf9, 0x0, 0x0, 0x9f, 0x0, 0x9f, 0xa7, 0x0, 0xa7, 0x0, 0x0, 0xff
};
- if (clear)
- _vm->clearScreen(0x0f);
-
_vm->_picture->setDimensions(IDI_TRO_PIC_WIDTH, IDI_TRO_PIC_HEIGHT);
+ if (clr) {
+ _vm->clearScreen(0x0f, false);
+ _vm->_picture->clear();
+ }
+
_vm->_picture->setPictureData(frame, ARRAYSIZE(frame));
_vm->_picture->drawPicture();
@@ -330,6 +332,7 @@
_vm->_system->delayMillis(3200);
// Draw logo
+ _vm->setDefaultTextColor(0x0f);
drawPic(45, false, true);
_vm->_gfx->doUpdate();
@@ -368,7 +371,7 @@
int Troll::drawRoom(char *menu) {
int n;
- drawPic(_currentRoom - 1, false, true);
+ drawPic(_locationDescIndex, false, true);
_vm->_gfx->doUpdate();
// TODO: Troll
@@ -381,7 +384,7 @@
sprintf(tmp, "\n %d.", i);
strcat(menu, tmp);
- strncat(menu, (char *)_gameData + _options[_roomDescs[_currentRoom - 1].options[i]], 35);
+ strncat(menu, (char *)_gameData + _options[_roomDescs[_currentRoom - 1].options[i]- 1], 35);
n = i + 1;
}
@@ -400,6 +403,8 @@
_treasuresLeft = IDI_TRO_MAX_TREASURE;
_haveFlashlight = false;
_locationDescIndex = 0;
+
+ memset(_roomStates, 0, sizeof(_roomStates));
while (!done) {
*menu = 0;
@@ -412,14 +417,13 @@
_moves++;
switch(_roomDescs[_currentRoom - 1].optionTypes[currentOption]) {
- case IDI_TRO_SEL_OPTION_1:
+ case OT_GO:
+ _locationDescIndex = _roomDescs[_currentRoom - 1].roomDescIndex[currentOption];
+ _currentRoom = _roomPicStartIdx[_locationDescIndex];
+ _currentRoom += _roomStates[_locationDescIndex];
break;
- case IDI_TRO_SEL_OPTION_2:
+ default:
break;
- case IDI_TRO_SEL_OPTION_3:
- break;
- case OT_UNKN:
- break;
}
}
@@ -433,6 +437,9 @@
for (i = 0; i < IDI_TRO_NUM_OPTIONS; i++)
_options[i] = READ_LE_UINT16(_gameData + IDO_TRO_OPTIONS + i * 2);
+
+ for (i = 0; i < IDI_TRO_NUM_NUMROOMS; i++)
+ _roomPicStartIdx[i] = _gameData[IDO_TRO_PICSTARTIDX + i];
}
void Troll::fillRoomDescs() {
Modified: scummvm/trunk/engines/agi/preagi_troll.h
===================================================================
--- scummvm/trunk/engines/agi/preagi_troll.h 2007-09-18 20:16:33 UTC (rev 28945)
+++ scummvm/trunk/engines/agi/preagi_troll.h 2007-09-18 20:23:06 UTC (rev 28946)
@@ -119,6 +119,7 @@
#define IDI_TRO_NUM_ROOMDESCS 65
#define IDI_TRO_NUM_OPTIONS 129
+#define IDI_TRO_NUM_NUMROOMS 43
// offsets
@@ -129,6 +130,7 @@
#define IDO_TRO_LOCMESSAGES 0x1F7C
#define IDO_TRO_ROOMDESCS 0x0082
#define IDO_TRO_OPTIONS 0x0364
+#define IDO_TRO_PICSTARTIDX 0x02CD
enum OptionType {
OT_GO,
@@ -190,6 +192,8 @@
private:
int _pictureOffsets[IDI_TRO_PICNUM];
+ int _roomPicStartIdx[IDI_TRO_NUM_NUMROOMS];
+ int _roomStates[IDI_TRO_NUM_NUMROOMS];
};
} // End of namespace Agi
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