[Scummvm-cvs-logs] SF.net SVN: scummvm: [29526] scummvm/trunk/engines/lure
dreammaster at users.sourceforge.net
dreammaster at users.sourceforge.net
Sat Nov 17 07:53:13 CET 2007
Revision: 29526
http://scummvm.svn.sourceforge.net/scummvm/?rev=29526&view=rev
Author: dreammaster
Date: 2007-11-16 22:53:13 -0800 (Fri, 16 Nov 2007)
Log Message:
-----------
Bugfixes to the fighting animations and proper reset of fight data between save sessions
Modified Paths:
--------------
scummvm/trunk/engines/lure/fights.cpp
scummvm/trunk/engines/lure/fights.h
scummvm/trunk/engines/lure/game.cpp
scummvm/trunk/engines/lure/game.h
scummvm/trunk/engines/lure/room.cpp
Modified: scummvm/trunk/engines/lure/fights.cpp
===================================================================
--- scummvm/trunk/engines/lure/fights.cpp 2007-11-17 06:52:35 UTC (rev 29525)
+++ scummvm/trunk/engines/lure/fights.cpp 2007-11-17 06:53:13 UTC (rev 29526)
@@ -30,7 +30,7 @@
namespace Lure {
// Three records containing initial states for player, pig, and Skorl
-FighterRecord fighterList[3] = {
+const FighterRecord initialFighterList[3] = {
{0x23C, 0x440, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0},
{0, 0x441, 0x1092, 0, 3, 0, 0, 0, 0xB94, 8, 0xA34, 0x8D4, 0xD06, 0,
0, 0, 0, 0, 0xDDC, PLAYER_ID},
@@ -44,6 +44,7 @@
int_fights = this;
_fightData = NULL;
_mouseFlags = 0;
+ reset();
}
FightsManager::~FightsManager() {
@@ -57,9 +58,9 @@
}
FighterRecord &FightsManager::getDetails(uint16 hotspotId) {
- if (hotspotId == PLAYER_ID) return fighterList[0];
- else if (hotspotId == PIG_ID) return fighterList[1];
- else if (hotspotId == SKORL_FIGHTER_ID) return fighterList[2];
+ if (hotspotId == PLAYER_ID) return _fighterList[0];
+ else if (hotspotId == PIG_ID) return _fighterList[1];
+ else if (hotspotId == SKORL_FIGHTER_ID) return _fighterList[2];
error("Unknown NPC %d attempted to fight", hotspotId);
}
@@ -108,6 +109,7 @@
void FightsManager::fightLoop() {
Resources &res = Resources::getReference();
+ Game &game = Game::getReference();
Events &events = Events::getReference();
FighterRecord &playerFight = getDetails(PLAYER_ID);
@@ -120,13 +122,16 @@
res.delayList().tick();
Screen::getReference().update();
+ if (game.debugger().isAttached())
+ game.debugger().onFrame();
+
g_system->delayMillis(20);
}
}
void FightsManager::saveToStream(Common::WriteStream *stream) {
for (int fighterCtr = 0; fighterCtr < 3; ++fighterCtr) {
- FighterRecord &rec = fighterList[fighterCtr];
+ FighterRecord &rec = _fighterList[fighterCtr];
stream->writeUint16LE(rec.fwseq_no);
stream->writeUint16LE(rec.fwseq_ad);
@@ -138,8 +143,10 @@
}
void FightsManager::loadFromStream(Common::ReadStream *stream) {
+ reset();
+
for (int fighterCtr = 0; fighterCtr < 3; ++fighterCtr) {
- FighterRecord &rec = fighterList[fighterCtr];
+ FighterRecord &rec = _fighterList[fighterCtr];
rec.fwseq_no = stream->readUint16LE();
rec.fwseq_ad = stream->readUint16LE();
@@ -150,6 +157,12 @@
}
}
+void FightsManager::reset() {
+ _fighterList[0] = initialFighterList[0];
+ _fighterList[1] = initialFighterList[1];
+ _fighterList[2] = initialFighterList[2];
+}
+
const CursorType moveList[] = {CURSOR_LEFT_ARROW, CURSOR_FIGHT_UPPER,
CURSOR_FIGHT_MIDDLE, CURSOR_FIGHT_LOWER, CURSOR_RIGHT_ARROW};
@@ -165,6 +178,7 @@
{Common::KEYCODE_INVALID, 0}};
void FightsManager::checkEvents() {
+ Game &game = Game::getReference();
Events &events = Events::getReference();
if (!events.pollEvent()) return;
FighterRecord &rec = getDetails(PLAYER_ID);
@@ -179,6 +193,12 @@
events.quitFlag = true;
break;
+ case Common::KEYCODE_d:
+ if (events.event().kbd.flags == Common::KBD_CTRL)
+ // Activate the debugger
+ game.debugger().attach();
+ break;
+
default:
// Scan through the mapping list for a move for the keypress
const KeyMapping *keyPtr = &keyList[0];
@@ -326,10 +346,13 @@
if (fighter.fwweapon != 0) {
Hotspot *weaponHotspot = res.getActiveHotspot(fighter.fwweapon);
assert(weaponHotspot);
- weaponHotspot->setFrameNumber(getWord(moveOffset + 4));
- weaponHotspot->setPosition(weaponHotspot->x() +
- (int16)getWord(moveOffset + 6),
- weaponHotspot->y() + getWord(moveOffset + 8));
+
+ uint16 newFrameNumber = getWord(moveOffset + 4);
+ int16 xChange = (int16)getWord(moveOffset + 6);
+ int16 yChange = (int16)getWord(moveOffset + 8);
+
+ weaponHotspot->setFrameNumber(newFrameNumber);
+ weaponHotspot->setPosition(h.x() + xChange, h.y() + yChange);
}
moveOffset += 5 * sizeof(uint16);
Modified: scummvm/trunk/engines/lure/fights.h
===================================================================
--- scummvm/trunk/engines/lure/fights.h 2007-11-17 06:52:35 UTC (rev 29525)
+++ scummvm/trunk/engines/lure/fights.h 2007-11-17 06:53:13 UTC (rev 29526)
@@ -67,6 +67,7 @@
MemoryBlock *_fightData;
Common::RandomSource _rnd;
uint8 _mouseFlags;
+ FighterRecord _fighterList[3];
FighterRecord &getDetails(uint16 hotspotId);
uint16 fetchFighterDistance(FighterRecord &f1, FighterRecord &f2);
@@ -99,6 +100,7 @@
void fightLoop();
void saveToStream(Common::WriteStream *stream);
void loadFromStream(Common::ReadStream *stream);
+ void reset();
void fighterAnimHandler(Hotspot &h);
void playerAnimHandler(Hotspot &h);
Modified: scummvm/trunk/engines/lure/game.cpp
===================================================================
--- scummvm/trunk/engines/lure/game.cpp 2007-11-17 06:52:35 UTC (rev 29525)
+++ scummvm/trunk/engines/lure/game.cpp 2007-11-17 06:53:13 UTC (rev 29526)
@@ -142,6 +142,7 @@
if ((_state & GS_RESTART) != 0) {
res.reset();
+ Fights.reset();
if (!initialRestart) room.reset();
setState(0);
Modified: scummvm/trunk/engines/lure/game.h
===================================================================
--- scummvm/trunk/engines/lure/game.h 2007-11-17 06:52:35 UTC (rev 29525)
+++ scummvm/trunk/engines/lure/game.h 2007-11-17 06:53:13 UTC (rev 29526)
@@ -80,6 +80,7 @@
bool &preloadFlag() { return _preloadFlag; }
bool fastTextFlag() { return _fastTextFlag; }
bool soundFlag() { return _soundFlag; }
+ Debugger &debugger() { return *_debugger; }
// Menu item support methods
void doDebugMenu();
Modified: scummvm/trunk/engines/lure/room.cpp
===================================================================
--- scummvm/trunk/engines/lure/room.cpp 2007-11-17 06:52:35 UTC (rev 29525)
+++ scummvm/trunk/engines/lure/room.cpp 2007-11-17 06:53:13 UTC (rev 29526)
@@ -533,18 +533,22 @@
_roomData = res.getRoom(newRoomNumber);
if (!_roomData)
error("Tried to change to non-existant room: %d", newRoomNumber);
- bool leaveFlag = (newRoomNumber != _roomNumber) && (_roomNumber != 0);
+ bool fadeFlag = (newRoomNumber != _roomNumber) && (_roomNumber != 0);
+ bool leaveFlag = _roomNumber != 999;
+
_roomNumber = _roomData->roomNumber;
_descId = _roomData->descId;
- if (leaveFlag) {
+ if (fadeFlag) {
// Fade out all the colours except the high index 0FFh, which is used to show the
// disk cursor as a room changes
_screen.paletteFadeOut(GAME_COLOURS - 1);
- leaveRoom();
- Sound.removeSounds();
+ if (leaveFlag) {
+ leaveRoom();
+ Sound.removeSounds();
+ }
}
_screen.empty();
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