aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGregory Montoir2003-12-06 13:15:17 +0000
committerGregory Montoir2003-12-06 13:15:17 +0000
commita17c49d9a7e1522c5f259d7e89eb15ed81f326c3 (patch)
tree82d8bc72dbb328b04f289617f60cf88ebc3ecb34
parent31411c9fc23f6c03c472dce627297bf3b161a652 (diff)
downloadscummvm-rg350-a17c49d9a7e1522c5f259d7e89eb15ed81f326c3.tar.gz
scummvm-rg350-a17c49d9a7e1522c5f259d7e89eb15ed81f326c3.tar.bz2
scummvm-rg350-a17c49d9a7e1522c5f259d7e89eb15ed81f326c3.zip
- handle person bank number hack slighlty differently (fix it when loading, not in personSetData)
- remove some useless checks as there are no invalid bob numbers in actor data - minor cleanups in Area svn-id: r11520
-rw-r--r--queen/logic.cpp47
-rw-r--r--queen/structs.h30
-rw-r--r--queen/walk.cpp11
-rw-r--r--queen/xref.txt4
4 files changed, 42 insertions, 50 deletions
diff --git a/queen/logic.cpp b/queen/logic.cpp
index 52ec46aea1..9476cbf20c 100644
--- a/queen/logic.cpp
+++ b/queen/logic.cpp
@@ -1299,37 +1299,30 @@ void Logic::personSetData(int16 noun, const char *actorName, bool loadBank, Pers
}
}
- if (!actor) {
- warning("Actor '%s' not found, using default", actorName);
- actor = 1;
- }
+ if (actor != 0) {
- pp->actor = &_actorData[actor];
- pp->bankNum = pp->actor->bankNum;
- pp->name = _aName[pp->actor->name];
- if (pp->actor->anim != 0) {
- pp->anim = _aAnim[pp->actor->anim];
- }
- else {
- pp->anim = NULL;
- }
-
- if (loadBank) {
- const char *actorFile = _aFile[pp->actor->actorFile];
- if (actorFile) {
- _graphics->bankLoad(actorFile, pp->bankNum);
+ pp->actor = &_actorData[actor];
+ pp->name = _aName[pp->actor->name];
+ if (pp->actor->anim != 0) {
+ pp->anim = _aAnim[pp->actor->anim];
}
else {
- pp->bankNum = 15;
- }
- }
+ pp->anim = NULL;
+ }
+
+ debug(0, "Logic::personSetData() - name=%s n=%d", pp->name, actor);
+
+ if (loadBank) {
+ const char *actorFile = _aFile[pp->actor->actorFile];
+ if (actorFile) {
+ _graphics->bankLoad(actorFile, pp->actor->bankNum);
+ }
+ // if actorFile is null, the person data is already loaded as
+ // it is contained in objects room bank (.bbk)
+ }
- if (pp->actor->bobNum >= 1 && pp->actor->bobNum <= 3) {
pp->bobFrame = 29 + FRAMES_JOE_XTRA + pp->actor->bobNum;
}
- else {
- warning("Logic::personSetData() - The bob number for actor is not in the [1:3] range");
- }
}
@@ -1351,7 +1344,7 @@ uint16 Logic::personSetup(uint16 noun, uint16 curImage) {
return curImage;
}
- _graphics->bankUnpack(pad->bobFrameStanding, p.bobFrame, p.bankNum);
+ _graphics->bankUnpack(pad->bobFrameStanding, p.bobFrame, p.actor->bankNum);
bool xflip = false;
uint16 person = _roomData[_currentRoom] + noun;
if (_objectData[person].image == -3) {
@@ -1480,7 +1473,7 @@ uint16 Logic::animCreate(uint16 curImage, const Person *person) {
for (i = 1; i <= 255; ++i) {
if (allocatedFrames[i] != 0) {
++curImage;
- _graphics->bankUnpack(i, curImage, person->bankNum);
+ _graphics->bankUnpack(i, curImage, person->actor->bankNum);
}
}
diff --git a/queen/structs.h b/queen/structs.h
index 6577e290fc..74332c7ed7 100644
--- a/queen/structs.h
+++ b/queen/structs.h
@@ -88,8 +88,8 @@ struct Area {
}
uint16 calcScale(int16 y) const {
- uint16 dy = box.y2 - box.y1;
- int16 ds = (int16)(topScaleFactor - bottomScaleFactor);
+ uint16 dy = box.yDiff();
+ int16 ds = scaleDiff();
uint16 scale = 0;
if (dy) // Prevent division-by-zero
@@ -353,8 +353,13 @@ struct ActorData {
anim = READ_BE_UINT16(ptr); ptr += 2;
bankNum = READ_BE_UINT16(ptr); ptr += 2;
actorFile = READ_BE_UINT16(ptr); ptr += 2;
+ // Fix the actor data (see queen.c - l.1518-1519). When there is no
+ // valid actor file, we must load the data from the objects room bank.
+ // This bank has number 15 (not 10 as in the data files).
+ if (actorFile == 0) {
+ bankNum = 15;
+ }
}
-
};
@@ -430,12 +435,12 @@ struct CmdArea {
//! area to turn off/on (<0: off, >0: on)
int16 area;
//! room in which the area must be changed
- int16 room;
+ uint16 room;
void readFrom(byte *&ptr) {
id = (int16)READ_BE_UINT16(ptr); ptr += 2;
area = (int16)READ_BE_UINT16(ptr); ptr += 2;
- room = (int16)READ_BE_UINT16(ptr); ptr += 2;
+ room = READ_BE_UINT16(ptr); ptr += 2;
}
};
@@ -538,14 +543,13 @@ struct AnimFrame {
struct Person {
//! actor settings to use
- const ActorData *actor; // P_ROOM, P_BNUM, P_GAMES, P_VALUE, P_COLOR, P_STAND, P_X, P_Y
- //! name of the actor
- const char *name; // P_NAMEstr
- //! string animation
- const char *anim; // P_ANIMstr
- uint16 bobFrame; // SFRAME
- //! As the bank number may change, we can't re-use actor->bankNum
- uint16 bankNum; // P_BANK
+ const ActorData *actor;
+ //! actor name
+ const char *name;
+ //! animation string
+ const char *anim;
+ //! current frame
+ uint16 bobFrame;
};
diff --git a/queen/walk.cpp b/queen/walk.cpp
index e287faa627..d5df70a5f1 100644
--- a/queen/walk.cpp
+++ b/queen/walk.cpp
@@ -361,7 +361,7 @@ int16 Walk::movePerson(const Person *pp, int16 endx, int16 endy, uint16 curImage
initWalkData();
uint16 bobNum = pp->actor->bobNum;
- uint16 bankNum = pp->bankNum;
+ uint16 bankNum = pp->actor->bankNum;
uint16 oldx = _graphics->bob(bobNum)->x;
uint16 oldy = _graphics->bob(bobNum)->y;
@@ -390,13 +390,8 @@ int16 Walk::movePerson(const Person *pp, int16 endx, int16 endy, uint16 curImage
can = -1;
}
- uint16 standingFrame = 0;
- if (bobNum <= 3) {
- standingFrame = 29 + FRAMES_JOE_XTRA + bobNum;
- }
- else {
- warning("Walk::movePerson() - Wrong bob number : %d", bobNum);
- }
+ uint16 standingFrame = 29 + FRAMES_JOE_XTRA + bobNum;
+
// make other person face the right direction
BobSlot *pbs = _graphics->bob(bobNum);
pbs->endx = endx;
diff --git a/queen/xref.txt b/queen/xref.txt
index 19ed749b39..61f522ccb3 100644
--- a/queen/xref.txt
+++ b/queen/xref.txt
@@ -281,11 +281,11 @@ PERSON_FACE
PERSON_FACE_MAX
PERSON_FRAMES Logic::_personFrames
P_ANIMstr Person.anim
-P_BANK Person.bankNum
P_NAMEstr Person.name
P_STAND,P_BNUM,P_ROOM Person.actor->*
-P_X,P_Y,P_COLOR Person.actor->*
+P_BANK,P_X,P_Y,P_COLOR Person.actor->*
P_VALUE,P_GAMES Person.actor->*
+SFRAME Person.bobFrame
RESOURCE