diff options
author | Nicola Mettifogo | 2007-03-17 07:52:47 +0000 |
---|---|---|
committer | Nicola Mettifogo | 2007-03-17 07:52:47 +0000 |
commit | 1ef774b2ee7a74e2bbf12db7273771d0ea3b8a4c (patch) | |
tree | e9aa84b954ab90cda5e840373ddc3656a7184190 /engines/parallaction | |
parent | 86ba69f75b20785eed8e88500ba9b5dfa5b021c3 (diff) | |
download | scummvm-rg350-1ef774b2ee7a74e2bbf12db7273771d0ea3b8a4c.tar.gz scummvm-rg350-1ef774b2ee7a74e2bbf12db7273771d0ea3b8a4c.tar.bz2 scummvm-rg350-1ef774b2ee7a74e2bbf12db7273771d0ea3b8a4c.zip |
gathered character related stuff into a new struct Character, and modified calling code accordingly
svn-id: r26158
Diffstat (limited to 'engines/parallaction')
-rw-r--r-- | engines/parallaction/animation.cpp | 2 | ||||
-rw-r--r-- | engines/parallaction/callables.cpp | 4 | ||||
-rw-r--r-- | engines/parallaction/commands.cpp | 2 | ||||
-rw-r--r-- | engines/parallaction/dialogue.cpp | 18 | ||||
-rw-r--r-- | engines/parallaction/inventory.cpp | 13 | ||||
-rw-r--r-- | engines/parallaction/location.cpp | 26 | ||||
-rw-r--r-- | engines/parallaction/parallaction.cpp | 79 | ||||
-rw-r--r-- | engines/parallaction/parallaction.h | 15 | ||||
-rw-r--r-- | engines/parallaction/saveload.cpp | 4 | ||||
-rw-r--r-- | engines/parallaction/walk.cpp | 72 | ||||
-rw-r--r-- | engines/parallaction/zone.cpp | 17 |
11 files changed, 127 insertions, 125 deletions
diff --git a/engines/parallaction/animation.cpp b/engines/parallaction/animation.cpp index 9f331a61af..c2b725562d 100644 --- a/engines/parallaction/animation.cpp +++ b/engines/parallaction/animation.cpp @@ -658,7 +658,7 @@ void sortAnimations() { Node v14; memset(&v14, 0, sizeof(Node)); - _yourself._z = _yourself._cnv._height + _yourself._zone._limits._top; + _vm->_char._yourself._z = _vm->_char._yourself._cnv._height + _vm->_char._yourself._zone._limits._top; Animation *vC = (Animation*)_animations._next; Node *v8; diff --git a/engines/parallaction/callables.cpp b/engines/parallaction/callables.cpp index 1cdf9550b3..3ff553c48d 100644 --- a/engines/parallaction/callables.cpp +++ b/engines/parallaction/callables.cpp @@ -322,7 +322,7 @@ void _c_finito(void *parm) { _vm->_menu->selectCharacter(); } - removeNode(&_yourself._zone._node); + removeNode(&_vm->_char._yourself._zone._node); _vm->_locationNames[0][0] = '\0'; _vm->_numLocations = 0; _commandFlags = 0; @@ -339,7 +339,7 @@ void _c_finito(void *parm) { _engineFlags &= ~kEngineQuit; - addNode(&_animations, &_yourself._zone._node); + addNode(&_animations, &_vm->_char._yourself._zone._node); _score = 0; return; diff --git a/engines/parallaction/commands.cpp b/engines/parallaction/commands.cpp index 898d17007b..d278ee5c0d 100644 --- a/engines/parallaction/commands.cpp +++ b/engines/parallaction/commands.cpp @@ -328,7 +328,7 @@ void runCommands(Command *list, Zone *z) { break; case CMD_MOVE: { // move - if ((_yourself._zone._flags & kFlagsRemove) || (_yourself._zone._flags & kFlagsActive) == 0) { + if ((_vm->_char._yourself._zone._flags & kFlagsRemove) || (_vm->_char._yourself._zone._flags & kFlagsActive) == 0) { continue; } diff --git a/engines/parallaction/dialogue.cpp b/engines/parallaction/dialogue.cpp index c91c9c96b7..3ef4632866 100644 --- a/engines/parallaction/dialogue.cpp +++ b/engines/parallaction/dialogue.cpp @@ -238,7 +238,7 @@ void runDialogue(SpeakData *data) { StaticCnv v5C, v48; if (!scumm_stricmp(data->_name, "yourself") || data->_name[0] == '\0') { - memcpy(&v6E, &_yourTalk, sizeof(Cnv)); + memcpy(&v6E, &_vm->_char._yourTalk, sizeof(Cnv)); debugC(1, kDebugDialogue, "runDialogue: using default character head"); } else { debugC(1, kDebugDialogue, "runDialogue: loading 2nd character head '%s'", _vm->_characterName); @@ -249,8 +249,8 @@ void runDialogue(SpeakData *data) { v5C._width = v6E._width; v5C._height = v6E._height; - v48._width = _yourTalk._width; - v48._height = _yourTalk._height; + v48._width = _vm->_char._yourTalk._width; + v48._height = _vm->_char._yourTalk._height; bool displayedAnswers = false; int16 question_width = 0, question_height = 0; @@ -263,7 +263,7 @@ void runDialogue(SpeakData *data) { v5C._data0 = v6E._array[v60->_mood & 0xF]; v5C._data1 = NULL; // v6E.field_8[v60->_mood & 0xF]; - v48._data0 = _yourTalk._array[0]; + v48._data0 = _vm->_char._yourTalk._array[0]; v48._data1 = NULL; // _yourTalk.field_8[0]; // display Question if any @@ -504,7 +504,7 @@ void runDialogue(SpeakData *data) { _vm->_disk->selectArchive("disk1"); _vm->_disk->loadFrames(_dinoName, &_characterFrames); - memcpy(&_yourself._cnv, &_characterFrames, sizeof(Cnv)); + memcpy(&_vm->_char._yourself._cnv, &_characterFrames, sizeof(Cnv)); debugC(1, kDebugDialogue, "runDialogue: special trick for 'museum' location ok"); } @@ -543,8 +543,8 @@ int16 selectAnswer(Question *q, StaticCnv *cnv) { 0 ); - cnv->_data0 = _yourTalk._array[q->_answer_moods[_di] & 0xF]; -// cnv->_data1 = _yourTalk.field_8[q->_answer_moods[_di] & 0xF]; + cnv->_data0 = _vm->_char._yourTalk._array[q->_answer_moods[_di] & 0xF]; +// cnv->_data1 = _vm->_char._yourTalk.field_8[q->_answer_moods[_di] & 0xF]; _vm->_gfx->flatBlitCnv( cnv, @@ -585,8 +585,8 @@ int16 selectAnswer(Question *q, StaticCnv *cnv) { 0 ); - cnv->_data0 = _yourTalk._array[q->_answer_moods[_si] & 0xF]; -// cnv->_data1 = _yourTalk.field_8[q->_answer_moods[_si] & 0xF]; + cnv->_data0 = _vm->_char._yourTalk._array[q->_answer_moods[_si] & 0xF]; +// cnv->_data1 = _vm->_char._yourTalk.field_8[q->_answer_moods[_si] & 0xF]; _vm->_gfx->flatBlitCnv( cnv, diff --git a/engines/parallaction/inventory.cpp b/engines/parallaction/inventory.cpp index e51a380d9f..d1c3ca1cc9 100644 --- a/engines/parallaction/inventory.cpp +++ b/engines/parallaction/inventory.cpp @@ -51,7 +51,6 @@ namespace Parallaction { #define INVENTORY_HEIGHT (INVENTORY_LINES*INVENTORYITEM_HEIGHT) static byte *_buffer; -extern Cnv _yourObjects; uint16 _numInvLines = 0; static Point _invPosition = { 0, 0 }; @@ -188,8 +187,8 @@ void drawInventoryItem(uint16 pos, InventoryItem *item) { uint16 col = pos % INVENTORY_ITEMS_PER_LINE; // FIXME: this will end up in a general blit function - byte* s = _yourObjects._array[item->_index]; - byte* d = _buffer + col * INVENTORYITEM_WIDTH + line * _yourObjects._height * INVENTORY_WIDTH; + byte* s = _vm->_char._yourObjects._array[item->_index]; + byte* d = _buffer + col * INVENTORYITEM_WIDTH + line * _vm->_char._yourObjects._height * INVENTORY_WIDTH; for (uint32 i = 0; i < INVENTORYITEM_HEIGHT; i++) { memcpy(d, s, INVENTORYITEM_WIDTH); @@ -229,8 +228,8 @@ void highlightInventoryItem(int16 pos, byte color) { uint16 line = pos / INVENTORY_ITEMS_PER_LINE; uint16 col = pos % INVENTORY_ITEMS_PER_LINE; - Common::Rect r(INVENTORYITEM_WIDTH, _yourObjects._height); - r.moveTo(col * INVENTORYITEM_WIDTH, line * _yourObjects._height); + Common::Rect r(INVENTORYITEM_WIDTH, _vm->_char._yourObjects._height); + r.moveTo(col * INVENTORYITEM_WIDTH, line * _vm->_char._yourObjects._height); drawBorder(r, _buffer, color); @@ -248,7 +247,7 @@ void extractInventoryGraphics(int16 pos, byte *dst) { // FIXME: this will end up in a general blit function byte* d = dst; - byte* s = _buffer + col * INVENTORYITEM_WIDTH + line * _yourObjects._height * INVENTORY_WIDTH; + byte* s = _buffer + col * INVENTORYITEM_WIDTH + line * _vm->_char._yourObjects._height * INVENTORY_WIDTH; for (uint32 i = 0; i < INVENTORYITEM_HEIGHT; i++) { memcpy(d, s, INVENTORYITEM_WIDTH); @@ -358,7 +357,7 @@ void redrawInventory() { void initInventory() { _buffer = (byte*)malloc(INVENTORY_WIDTH * INVENTORY_HEIGHT); // this buffer is also used by menu so it must stay this size - _yourObjects._count = 0; + _vm->_char._yourObjects._count = 0; } void cleanInventory() { diff --git a/engines/parallaction/location.cpp b/engines/parallaction/location.cpp index 5cec348e80..d17d24a7dc 100644 --- a/engines/parallaction/location.cpp +++ b/engines/parallaction/location.cpp @@ -92,12 +92,12 @@ void Parallaction::parseLocation(const char *filename) { switchBackground(_location._name, mask); if (_tokens[2][0] != '\0') { - _yourself._zone.pos._position._x = atoi(_tokens[2]); - _yourself._zone.pos._position._y = atoi(_tokens[3]); + _vm->_char._yourself._zone.pos._position._x = atoi(_tokens[2]); + _vm->_char._yourself._zone.pos._position._y = atoi(_tokens[3]); } if (_tokens[4][0] != '\0') { - _yourself._frame = atoi(_tokens[4]); + _vm->_char._yourself._frame = atoi(_tokens[4]); } } if (!scumm_stricmp(_tokens[0], "DISK")) { @@ -237,8 +237,8 @@ void parseWalkNodes(Script& script, Node *list) { if (!scumm_stricmp(_tokens[0], "COORD")) { WalkNode *v4 = (WalkNode*)malloc(sizeof(WalkNode)); - v4->_x = atoi(_tokens[1]) - _yourself._cnv._width/2; - v4->_y = atoi(_tokens[2]) - _yourself._cnv._height; + v4->_x = atoi(_tokens[1]) - _vm->_char._yourself._cnv._width/2; + v4->_y = atoi(_tokens[2]) - _vm->_char._yourself._cnv._height; addNode(list, &v4->_node); @@ -342,7 +342,7 @@ void Parallaction::changeLocation(char *location) { debugC(2, kDebugLocation, "changeLocation: changed cursor"); } - removeNode(&_yourself._zone._node); + removeNode(&_vm->_char._yourself._zone._node); debugC(2, kDebugLocation, "changeLocation: removed character from the animation list"); freeLocation(); @@ -375,7 +375,7 @@ void Parallaction::changeLocation(char *location) { } } - addNode(&_animations, &_yourself._zone._node); + addNode(&_animations, &_vm->_char._yourself._zone._node); debugC(2, kDebugLocation, "changeLocation: new character added to the animation list"); strcpy(_saveData1, list[0].c_str()); @@ -384,14 +384,14 @@ void Parallaction::changeLocation(char *location) { _gfx->copyScreen(Gfx::kBitBack, Gfx::kBit2); debugC(1, kDebugLocation, "changeLocation: new location '%s' parsed", _saveData1); - _yourself._zone.pos._oldposition._x = -1000; - _yourself._zone.pos._oldposition._y = -1000; + _vm->_char._yourself._zone.pos._oldposition._x = -1000; + _vm->_char._yourself._zone.pos._oldposition._y = -1000; - _yourself.field_50 = 0; + _vm->_char._yourself.field_50 = 0; if (_location._startPosition._x != -1000) { - _yourself._zone.pos._position._x = _location._startPosition._x; - _yourself._zone.pos._position._y = _location._startPosition._y; - _yourself._frame = _location._startFrame; + _vm->_char._yourself._zone.pos._position._x = _location._startPosition._x; + _vm->_char._yourself._zone.pos._position._y = _location._startPosition._y; + _vm->_char._yourself._frame = _location._startFrame; _location._startPosition._y = -1000; _location._startPosition._x = -1000; diff --git a/engines/parallaction/parallaction.cpp b/engines/parallaction/parallaction.cpp index eeb29f8bc3..c8edac56c3 100644 --- a/engines/parallaction/parallaction.cpp +++ b/engines/parallaction/parallaction.cpp @@ -58,12 +58,7 @@ uint32 _engineFlags = 0; char *_objectsNames[100]; Zone *_activeZone = NULL; -Animation _yourself; -StaticCnv _yourHead; -Cnv _yourTalk; -Cnv _characterFrames; -static Cnv _miniCharacterFrames; -Cnv _yourObjects; + uint16 _score = 1; @@ -230,32 +225,32 @@ int Parallaction::init() { initWalk(); - _yourTalk._width = 0; - _yourTalk._height = 0; - _yourTalk._count = 0; - _yourTalk._array = NULL; + _vm->_char._yourTalk._width = 0; + _vm->_char._yourTalk._height = 0; + _vm->_char._yourTalk._count = 0; + _vm->_char._yourTalk._array = NULL; - _yourHead._width = 0; - _yourHead._height = 0; - _yourHead._data0 = NULL; - _yourHead._data1 = NULL; + _vm->_char._yourHead._width = 0; + _vm->_char._yourHead._height = 0; + _vm->_char._yourHead._data0 = NULL; + _vm->_char._yourHead._data1 = NULL; - _yourself._zone.pos._position._x = 150; - _yourself._zone.pos._position._y = 100; + _vm->_char._yourself._zone.pos._position._x = 150; + _vm->_char._yourself._zone.pos._position._y = 100; initInventory(); - _yourself._z = 10; + _vm->_char._yourself._z = 10; - _yourself._zone.pos._oldposition._x = -1000; - _yourself._zone.pos._oldposition._y = -1000; - _yourself._frame = 0; + _vm->_char._yourself._zone.pos._oldposition._x = -1000; + _vm->_char._yourself._zone.pos._oldposition._y = -1000; + _vm->_char._yourself._frame = 0; - _yourself._zone._flags = kFlagsActive | kFlagsNoName; - _yourself._zone._type = kZoneYou; + _vm->_char._yourself._zone._flags = kFlagsActive | kFlagsNoName; + _vm->_char._yourself._zone._type = kZoneYou; - _yourself._zone._label._cnv._data0 = NULL; - _yourself._zone._label._text = strdup("yourself"); + _vm->_char._yourself._zone._label._cnv._data0 = NULL; + _vm->_char._yourself._zone._label._text = strdup("yourself"); - addNode(&_animations, &_yourself._zone._node); + addNode(&_animations, &_vm->_char._yourself._zone._node); _gfx = new Gfx(this); int midiDriver = MidiDriver::detectMusicDriver(MDT_MIDI | MDT_ADLIB | MDT_PREFER_MIDI); @@ -300,9 +295,9 @@ void Parallaction::initGame() { parseLocation(_location._name); if (_location._startPosition._x != -1000) { - _yourself._zone.pos._position._x = _location._startPosition._x; - _yourself._zone.pos._position._y = _location._startPosition._y; - _yourself._frame = _location._startFrame; + _vm->_char._yourself._zone.pos._position._x = _location._startPosition._x; + _vm->_char._yourself._zone.pos._position._y = _location._startPosition._y; + _vm->_char._yourself._frame = _location._startFrame; _location._startPosition._y = -1000; _location._startPosition._x = -1000; } @@ -544,8 +539,8 @@ void Parallaction::processInput(InputData *data) { debugC(2, kDebugInput, "processInput: kEvWalk"); _hoverZone = NULL; changeCursor(kCursorArrow); - if (_yourself._zone._flags & kFlagsRemove) break; - if ((_yourself._zone._flags & kFlagsActive) == 0) break; + if (_vm->_char._yourself._zone._flags & kFlagsRemove) break; + if ((_vm->_char._yourself._zone._flags & kFlagsActive) == 0) break; v4 = buildWalkPath(data->_mousePos._x, data->_mousePos._y); addJob(jobWalk, v4, kPriority19); _engineFlags |= kEngineWalking; // inhibits processing of input until walking is over @@ -759,14 +754,14 @@ void Parallaction::changeCursor(int32 index) { void freeCharacterFrames() { - _vm->_gfx->freeCnv(&_characterFrames); + _vm->_gfx->freeCnv(&_vm->_char._characterFrames); if (!IS_DUMMY_CHARACTER(_vm->_characterName)) { - _vm->_gfx->freeCnv(&_miniCharacterFrames); + _vm->_gfx->freeCnv(&_vm->_char._miniCharacterFrames); _vm->freeTable(_objectsNames); - _vm->_gfx->freeCnv(&_yourTalk); - _vm->_gfx->freeStaticCnv(&_yourHead); - _vm->_gfx->freeCnv(&_yourObjects); + _vm->_gfx->freeCnv(&_vm->_char._yourTalk); + _vm->_gfx->freeStaticCnv(&_vm->_char._yourHead); + _vm->_gfx->freeCnv(&_vm->_char._yourObjects); } return; @@ -839,15 +834,15 @@ void Parallaction::changeCharacter(const char *name) { char path[PATH_LEN]; strcpy(path, v32); - _disk->loadFrames(path, &_characterFrames); + _disk->loadFrames(path, &_vm->_char._characterFrames); if (!IS_DUMMY_CHARACTER(name)) { - _disk->loadHead(path, &_yourHead); - _disk->loadTalk(path, &_yourTalk); - _disk->loadObjects(name, &_yourObjects); + _disk->loadHead(path, &_vm->_char._yourHead); + _disk->loadTalk(path, &_vm->_char._yourTalk); + _disk->loadObjects(name, &_vm->_char._yourObjects); sprintf(path, "mini%s", v32); - _disk->loadFrames(path, &_miniCharacterFrames); + _disk->loadFrames(path, &_vm->_char._miniCharacterFrames); sprintf(path, "%s.tab", name); initTable(path, _objectsNames); @@ -860,9 +855,9 @@ void Parallaction::changeCharacter(const char *name) { } if (miniCharacter) - memcpy(&_yourself._cnv, &_miniCharacterFrames, sizeof(Cnv)); + memcpy(&_vm->_char._yourself._cnv, &_vm->_char._miniCharacterFrames, sizeof(Cnv)); else - memcpy(&_yourself._cnv, &_characterFrames, sizeof(Cnv)); + memcpy(&_vm->_char._yourself._cnv, &_vm->_char._characterFrames, sizeof(Cnv)); strcpy(_characterName1, v32); diff --git a/engines/parallaction/parallaction.h b/engines/parallaction/parallaction.h index ebdbb0050b..e103d8ad11 100644 --- a/engines/parallaction/parallaction.h +++ b/engines/parallaction/parallaction.h @@ -28,6 +28,7 @@ #include "parallaction/inventory.h" #include "parallaction/parser.h" #include "parallaction/disk.h" +#include "parallaction/zone.h" #include "common/str.h" #include "gui/dialog.h" #include "gui/widget.h" @@ -103,7 +104,7 @@ extern uint16 _language; extern Zone *_activeZone; extern uint32 _engineFlags; extern callable _callables[]; -extern Animation _yourself; + extern Node _zones; extern Node _animations; extern uint32 _localFlags[]; @@ -122,9 +123,7 @@ extern char _saveData1[]; extern byte _mouseHidden; extern uint32 _commandFlags; -extern Cnv _yourTalk; -extern Cnv _characterFrames; //extern char _locationName[]; //extern Node _walkNodes; @@ -251,6 +250,15 @@ struct Location { }; +struct Character { + Animation _yourself; + StaticCnv _yourHead; + Cnv _yourTalk; + Cnv _characterFrames; + Cnv _miniCharacterFrames; + Cnv _yourObjects; +}; + class Parallaction : public Engine { public: @@ -305,6 +313,7 @@ public: int16 _currentLocationIndex; uint16 _numLocations; + Character _char; Location _location; InventoryItem _activeItem; diff --git a/engines/parallaction/saveload.cpp b/engines/parallaction/saveload.cpp index 9eb548efaf..f1e5cb94c8 100644 --- a/engines/parallaction/saveload.cpp +++ b/engines/parallaction/saveload.cpp @@ -175,9 +175,9 @@ void Parallaction::doSaveGame(uint16 slot, const char* name) { sprintf(s, "%s\n", _saveData1); f->writeString(s); - sprintf(s, "%d\n", _yourself._zone.pos._position._x); + sprintf(s, "%d\n", _vm->_char._yourself._zone.pos._position._x); f->writeString(s); - sprintf(s, "%d\n", _yourself._zone.pos._position._y); + sprintf(s, "%d\n", _vm->_char._yourself._zone.pos._position._y); f->writeString(s); sprintf(s, "%d\n", _score); f->writeString(s); diff --git a/engines/parallaction/walk.cpp b/engines/parallaction/walk.cpp index 8a1f229cb2..8ee5b11ad6 100644 --- a/engines/parallaction/walk.cpp +++ b/engines/parallaction/walk.cpp @@ -95,7 +95,7 @@ WalkNode *buildWalkPath(uint16 x, uint16 y) { if (close == right) { to_x += right; - walkData3 = (_yourself._cnv._count == 20) ? 7 : 9; + walkData3 = (_vm->_char._yourself._cnv._count == 20) ? 7 : 9; } else if (close == left) { to_x -= left; @@ -106,7 +106,7 @@ WalkNode *buildWalkPath(uint16 x, uint16 y) { } else if (close == bottom) { to_y += bottom; - walkData3 = (_yourself._cnv._count == 20) ? 17 : 21; + walkData3 = (_vm->_char._yourself._cnv._count == 20) ? 17 : 21; } } @@ -115,8 +115,8 @@ WalkNode *buildWalkPath(uint16 x, uint16 y) { WalkNode *v48 = (WalkNode*)malloc(sizeof(WalkNode)); WalkNode *v44 = (WalkNode*)malloc(sizeof(WalkNode)); - v48->_x = to_x - _yourself._cnv._width / 2; // target top left coordinates - v48->_y = to_y - _yourself._cnv._height; + v48->_x = to_x - _vm->_char._yourself._cnv._width / 2; // target top left coordinates + v48->_y = to_y - _vm->_char._yourself._cnv._height; v48->_node._next = NULL; memcpy(v44, v48, sizeof(WalkNode)); @@ -152,11 +152,11 @@ WalkNode *buildWalkPath(uint16 x, uint16 y) { v48 = &v58; - v20._x = _yourself._zone.pos._position._x; - v20._y = _yourself._zone.pos._position._y; + v20._x = _vm->_char._yourself._zone.pos._position._x; + v20._y = _vm->_char._yourself._zone.pos._position._y; - v8._x = _si - _yourself._zone.pos._position._x; - v8._y = _di - _yourself._zone.pos._position._y; + v8._x = _si - _vm->_char._yourself._zone.pos._position._x; + v8._y = _di - _vm->_char._yourself._zone.pos._position._y; v34 = v30 = dotProduct(&v8, &v8); // square distance from current position and target while (_closest_node_found != 0) { @@ -245,8 +245,8 @@ uint16 walkFunc1(int16 x, int16 y, WalkNode *Node) { Point v4 = { 0, 0 }; Point foot = { - _yourself._zone.pos._position._x + _yourself._cnv._width/2, - _yourself._zone.pos._position._y + _yourself._cnv._height + _vm->_char._yourself._zone.pos._position._x + _vm->_char._yourself._cnv._width/2, + _vm->_char._yourself._zone.pos._position._y + _vm->_char._yourself._cnv._height }; Point v8 = { @@ -297,8 +297,8 @@ uint16 walkFunc1(int16 x, int16 y, WalkNode *Node) { v8._y = foot._y; } - Node->_x = v4._x - _yourself._cnv._width / 2; - Node->_y = v4._y - _yourself._cnv._height; + Node->_x = v4._x - _vm->_char._yourself._cnv._width / 2; + Node->_y = v4._y - _vm->_char._yourself._cnv._height; return (x - v4._x) * (x - v4._x) + (y - v4._y) * (y - v4._y); } @@ -316,13 +316,13 @@ uint16 walkFunc1(int16 x, int16 y, WalkNode *Node) { void jobWalk(void *parm, Job *j) { WalkNode *node = (WalkNode*)parm; - int16 _si = _yourself._zone.pos._position._x; - int16 _di = _yourself._zone.pos._position._y; + int16 _si = _vm->_char._yourself._zone.pos._position._x; + int16 _di = _vm->_char._yourself._zone.pos._position._y; -// debugC(1, kDebugWalk, "jobWalk to (%i, %i)", node->_x + _yourself._cnv._width / 2, node->_y + _yourself._cnv._height); +// debugC(1, kDebugWalk, "jobWalk to (%i, %i)", node->_x + _vm->_char._yourself._cnv._width / 2, node->_y + _vm->_char._yourself._cnv._height); - _yourself._zone.pos._oldposition._x = _si; - _yourself._zone.pos._oldposition._y = _di; + _vm->_char._yourself._zone.pos._oldposition._x = _si; + _vm->_char._yourself._zone.pos._oldposition._y = _di; if ((node->_x == _si) && (node->_y == _di)) { if (node->_node._next == NULL) { @@ -346,8 +346,8 @@ void jobWalk(void *parm, Job *j) { } Point dist = { - node->_x - _yourself._zone.pos._position._x, - node->_y - _yourself._zone.pos._position._y + node->_x - _vm->_char._yourself._zone.pos._position._x, + node->_y - _vm->_char._yourself._zone.pos._position._y }; if (dist._x < 0) @@ -359,7 +359,7 @@ void jobWalk(void *parm, Job *j) { // walk frame selection int16 v16; - if (_yourself._cnv._count == 20) { + if (_vm->_char._yourself._cnv._count == 20) { if (dist._x > dist._y) { walkData2 = (node->_x > _si) ? 0 : 7; @@ -386,36 +386,36 @@ void jobWalk(void *parm, Job *j) { } // StaticCnv v14; -// v14._width = _yourself._cnv._width; -// v14._height = _yourself._cnv._height; -// v14._data0 = _yourself._cnv._array[_yourself._frame]; -// v14._data1 = _yourself._cnv.field_8[_yourself._frame]; +// v14._width = _vm->_char._yourself._cnv._width; +// v14._height = _vm->_char._yourself._cnv._height; +// v14._data0 = _vm->_char._yourself._cnv._array[_vm->_char._yourself._frame]; +// v14._data1 = _vm->_char._yourself._cnv.field_8[_vm->_char._yourself._frame]; - if ((_si < node->_x) && (_si < SCREEN_WIDTH) && (queryPath(_yourself._cnv._width/2 + _si + 2, _yourself._cnv._height + _di) != 0)) { + if ((_si < node->_x) && (_si < SCREEN_WIDTH) && (queryPath(_vm->_char._yourself._cnv._width/2 + _si + 2, _vm->_char._yourself._cnv._height + _di) != 0)) { // printf("walk right\n"); _si = (_si + 2 < node->_x) ? _si + 2 : node->_x; } - if ((_si > node->_x) && (_si > -20) && (queryPath(_yourself._cnv._width/2 + _si - 2, _yourself._cnv._height + _di) != 0)) { + if ((_si > node->_x) && (_si > -20) && (queryPath(_vm->_char._yourself._cnv._width/2 + _si - 2, _vm->_char._yourself._cnv._height + _di) != 0)) { // printf("walk left\n"); _si = (_si - 2 > node->_x) ? _si - 2 :node->_x; } - if ((_di < node->_y) && (_di < (SCREEN_HEIGHT - _yourself._cnv._height)) && (queryPath(_yourself._cnv._width/2 + _si, _yourself._cnv._height + _di + 2) != 0)) { + if ((_di < node->_y) && (_di < (SCREEN_HEIGHT - _vm->_char._yourself._cnv._height)) && (queryPath(_vm->_char._yourself._cnv._width/2 + _si, _vm->_char._yourself._cnv._height + _di + 2) != 0)) { // printf("walk down\n"); _di = (_di + 2 <= node->_y) ? _di + 2 : node->_y; } - if ((_di > node->_y) && (_di > -20) && (queryPath(_yourself._cnv._width/2 + _si, _yourself._cnv._height + _di - 2) != 0)) { + if ((_di > node->_y) && (_di > -20) && (queryPath(_vm->_char._yourself._cnv._width/2 + _si, _vm->_char._yourself._cnv._height + _di - 2) != 0)) { // printf("walk up\n"); _di = (_di - 2 >= node->_y) ? _di - 2 : node->_y; } // printf("hitZone: %i, %i\n", _si, _di); - _yourself._zone.pos._position._x = _si; - _yourself._zone.pos._position._y = _di; + _vm->_char._yourself._zone.pos._position._x = _si; + _vm->_char._yourself._zone.pos._position._y = _di; - if ((_si == _yourself._zone.pos._oldposition._x) && (_di == _yourself._zone.pos._oldposition._y)) { + if ((_si == _vm->_char._yourself._zone.pos._oldposition._x) && (_di == _vm->_char._yourself._zone.pos._oldposition._y)) { j->_finished = 1; checkDoor(); @@ -423,7 +423,7 @@ void jobWalk(void *parm, Job *j) { } else { - _yourself._frame = v16 + walkData2 + 1; + _vm->_char._yourself._frame = v16 + walkData2 + 1; } @@ -440,7 +440,7 @@ uint16 checkDoor() { } _engineFlags &= ~kEngineWalking; - Zone *z = hitZone(kZoneDoor, _yourself._zone.pos._position._x + _yourself._cnv._width / 2, _yourself._zone.pos._position._y + _yourself._cnv._height); + Zone *z = hitZone(kZoneDoor, _vm->_char._yourself._zone.pos._position._x + _vm->_char._yourself._cnv._width / 2, _vm->_char._yourself._zone.pos._position._y + _vm->_char._yourself._cnv._height); if (z != NULL) { @@ -458,7 +458,7 @@ uint16 checkDoor() { } } - z = hitZone(kZoneTrap, _yourself._zone.pos._position._x + _yourself._cnv._width / 2, _yourself._zone.pos._position._y + _yourself._cnv._height); + z = hitZone(kZoneTrap, _vm->_char._yourself._zone.pos._position._x + _vm->_char._yourself._cnv._width / 2, _vm->_char._yourself._zone.pos._position._y + _vm->_char._yourself._cnv._height); if (z != NULL) { _localFlags[_vm->_currentLocationIndex] |= kFlagsEnter; @@ -475,8 +475,8 @@ uint16 checkDoor() { // printf("done\n"); - _yourself._frame = walkData2; - return _yourself._frame; + _vm->_char._yourself._frame = walkData2; + return _vm->_char._yourself._frame; } uint16 queryPath(uint16 x, uint16 y) { diff --git a/engines/parallaction/zone.cpp b/engines/parallaction/zone.cpp index e6f48d28c1..a234c66123 100644 --- a/engines/parallaction/zone.cpp +++ b/engines/parallaction/zone.cpp @@ -37,7 +37,6 @@ Node _zones = { NULL, NULL }; Node _animations = { NULL, NULL }; extern Node helperNode; -extern StaticCnv _yourHead; Zone *findZone(const char *name) { @@ -367,9 +366,9 @@ void displayCharacterComment(ExamineData *data) { if (data->_description == NULL) return; StaticCnv v3C; - v3C._width = _yourTalk._width; - v3C._height = _yourTalk._height; - v3C._data0 = _yourTalk._array[0]; + v3C._width = _vm->_char._yourTalk._width; + v3C._height = _vm->_char._yourTalk._height; + v3C._data0 = _vm->_char._yourTalk._array[0]; v3C._data1 = NULL; //_yourTalk.field_8[0]; _vm->_gfx->setFont("comic"); @@ -415,7 +414,7 @@ void displayItemComment(ExamineData *data) { Common::Rect r(v6C, v6A); r.moveTo(0, 90); _vm->_gfx->drawBalloon(r, 0); - _vm->_gfx->flatBlitCnv(&_yourHead, 100, 152, Gfx::kBitFront, _yourHead._data1); + _vm->_gfx->flatBlitCnv(&_vm->_char._yourHead, 100, 152, Gfx::kBitFront, _vm->_char._yourHead._data1); _vm->_gfx->displayWrappedString(data->_description, 0, 90, 130, 0); jobEraseAnimations((void*)1, NULL); @@ -609,13 +608,13 @@ Zone *hitZone(uint32 type, uint16 x, uint16 y) { if (z->_limits._left != -1) continue; - if (_si < _yourself._zone.pos._position._x) + if (_si < _vm->_char._yourself._zone.pos._position._x) continue; - if (_si > (_yourself._zone.pos._position._x + _yourself._cnv._width)) + if (_si > (_vm->_char._yourself._zone.pos._position._x + _vm->_char._yourself._cnv._width)) continue; - if (_di < _yourself._zone.pos._position._y) + if (_di < _vm->_char._yourself._zone.pos._position._y) continue; - if (_di > (_yourself._zone.pos._position._y + _yourself._cnv._height)) + if (_di > (_vm->_char._yourself._zone.pos._position._y + _vm->_char._yourself._cnv._height)) continue; } |