[Scummvm-cvs-logs] SF.net SVN: scummvm: [30339] scummvm/trunk/engines/lure
dreammaster at users.sourceforge.net
dreammaster at users.sourceforge.net
Tue Jan 8 07:13:56 CET 2008
Revision: 30339
http://scummvm.svn.sourceforge.net/scummvm/?rev=30339&view=rev
Author: dreammaster
Date: 2008-01-07 22:13:55 -0800 (Mon, 07 Jan 2008)
Log Message:
-----------
Enhanced NPC walk-to logic to handle separately several special Ids that were previously handled identically
Modified Paths:
--------------
scummvm/trunk/engines/lure/hotspots.cpp
scummvm/trunk/engines/lure/hotspots.h
Modified: scummvm/trunk/engines/lure/hotspots.cpp
===================================================================
--- scummvm/trunk/engines/lure/hotspots.cpp 2008-01-08 06:12:29 UTC (rev 30338)
+++ scummvm/trunk/engines/lure/hotspots.cpp 2008-01-08 06:13:55 UTC (rev 30339)
@@ -959,7 +959,7 @@
(hotspot->characterMode == CHARMODE_WAIT_FOR_PLAYER) ||
(hotspot->characterMode == CHARMODE_WAIT_FOR_INTERACT)) {
// loc_880
- if (characterWalkingCheck(hotspot))
+ if (characterWalkingCheck(hotspot->hotspotId))
return PC_WAIT;
} else {
// loc_886
@@ -974,7 +974,7 @@
((hotspot->actionHotspotId != _hotspotId) &&
(hotspot->characterMode == CHARMODE_WAIT_FOR_PLAYER))) {
// loc_880
- if (characterWalkingCheck(hotspot))
+ if (characterWalkingCheck(hotspot->hotspotId))
return PC_WAIT;
} else if (hotspot->actionHotspotId != _hotspotId) {
@@ -1077,33 +1077,60 @@
return false;
}
-bool Hotspot::characterWalkingCheck(HotspotData *hotspot) {
+bool Hotspot::characterWalkingCheck(uint16 hotspotId) {
+ Resources &res = Resources::getReference();
int16 xp, yp;
+ bool altFlag;
+ HotspotData *hotspot;
- if (hotspot == NULL) {
- // DEBUG for now - hardcoded value for 3E7h (NULL)
+ // Note that several invalid hotspot Ids are used to identify special walk to
+ // coordinates used throughout the game
+
+ _walkFlag = true;
+ altFlag = false;
+
+ switch (hotspotId) {
+ case 997:
+ xp = 169; yp = 146;
+ altFlag = true;
+ break;
+
+ case 998:
+ xp = 124; yp = 169;
+ break;
+
+ case 999:
xp = 78; yp = 162;
- _walkFlag = true;
+ break;
+
+ default:
+ hotspot = res.getHotspot(hotspotId);
+ if (hotspot == NULL) {
+ // Should never come here, as all other constants are handled
+ warning("characterWalkingCheck done on unknown hotspot Id %xh", hotspotId);
+ xp = 78; yp = 162;
+ } else if ((hotspot->walkX == 0) && (hotspot->walkY == 0)) {
+ // The hotspot doesn't have any walk co-ordinates
+ xp = hotspot->startX;
+ yp = hotspot->startY + hotspot->heightCopy - 4;
+ _walkFlag = false;
+ } else {
+ xp = hotspot->walkX;
+ yp = hotspot->walkY & 0x7fff;
+ altFlag = (hotspot->walkY & 0x8000) != 0;
+ }
+ break;
}
- else if ((hotspot->walkX == 0) && (hotspot->walkY == 0)) {
- // The hotspot doesn't have any walk co-ordinates
- xp = hotspot->startX;
- yp = hotspot->startY + hotspot->heightCopy - 4;
- _walkFlag = false;
- } else {
- xp = hotspot->walkX;
- yp = hotspot->walkY & 0x7fff;
- _walkFlag = true;
- if ((hotspot->walkY & 0x8000) != 0) {
- if (((x() >> 3) != (xp >> 3)) ||
- ((((y() + heightCopy()) >> 3) - 1) != (yp >> 3))) {
- // Walk to the specified destination
- walkTo(xp, yp);
- return true;
- } else {
- return false;
- }
+ if (altFlag) {
+ // Alternate walking check
+ if (((x() >> 3) != (xp >> 3)) ||
+ ((((y() + heightCopy()) >> 3) - 1) != (yp >> 3))) {
+ // Walk to the specified destination
+ walkTo(xp, yp);
+ return true;
+ } else {
+ return false;
}
}
@@ -1987,7 +2014,7 @@
fields.setField(ACTIVE_HOTSPOT_ID, hId);
if ((hId < PLAYER_ID) || (hotspot->roomNumber == _roomNumber)) {
- characterWalkingCheck(hotspot);
+ characterWalkingCheck(hId);
}
}
Modified: scummvm/trunk/engines/lure/hotspots.h
===================================================================
--- scummvm/trunk/engines/lure/hotspots.h 2008-01-08 06:12:29 UTC (rev 30338)
+++ scummvm/trunk/engines/lure/hotspots.h 2008-01-08 06:13:55 UTC (rev 30339)
@@ -304,7 +304,7 @@
HotspotPrecheckResult actionPrecheck(HotspotData *hotspot);
BarPlaceResult getBarPlace();
bool findClearBarPlace();
- bool characterWalkingCheck(HotspotData *hotspot);
+ bool characterWalkingCheck(uint16 hotspotId);
bool doorCloseCheck(uint16 doorId);
void resetDirection();
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