diff options
| author | Eugene Sandulenko | 2005-08-10 14:53:17 +0000 |
|---|---|---|
| committer | Eugene Sandulenko | 2005-08-10 14:53:17 +0000 |
| commit | 37f2a10ef6b16320876a1339c3a46c2b74953d75 (patch) | |
| tree | d4f949aa58f3a42d35e142ae22e26395c12500dd | |
| parent | 00d676c3d226d3d4430d7faf294138de895f39d4 (diff) | |
| download | scummvm-rg350-37f2a10ef6b16320876a1339c3a46c2b74953d75.tar.gz scummvm-rg350-37f2a10ef6b16320876a1339c3a46c2b74953d75.tar.bz2 scummvm-rg350-37f2a10ef6b16320876a1339c3a46c2b74953d75.zip | |
Rename Actor class members to _members.
svn-id: r18645
| -rw-r--r-- | saga/actor.cpp | 901 | ||||
| -rw-r--r-- | saga/actor.h | 286 | ||||
| -rw-r--r-- | saga/interface.cpp | 10 | ||||
| -rw-r--r-- | saga/isomap.cpp | 60 | ||||
| -rw-r--r-- | saga/objectmap.cpp | 2 | ||||
| -rw-r--r-- | saga/puzzle.cpp | 8 | ||||
| -rw-r--r-- | saga/rscfile.cpp | 2 | ||||
| -rw-r--r-- | saga/saga.cpp | 4 | ||||
| -rw-r--r-- | saga/script.cpp | 18 | ||||
| -rw-r--r-- | saga/sfuncs.cpp | 224 | ||||
| -rw-r--r-- | saga/sthread.cpp | 2 |
11 files changed, 757 insertions, 760 deletions
diff --git a/saga/actor.cpp b/saga/actor.cpp index f09fc04996..8ed4cf9463 100644 --- a/saga/actor.cpp +++ b/saga/actor.cpp @@ -47,8 +47,8 @@ namespace Saga { static int commonObjectCompare(const CommonObjectDataPointer& obj1, const CommonObjectDataPointer& obj2) { - int p1 = obj1->location.y - obj1->location.z; - int p2 = obj2->location.y - obj2->location.z; + int p1 = obj1->_location.y - obj1->_location.z; + int p2 = obj2->_location.y - obj2->_location.z; if (p1 == p2) return 0; if (p1 < p2) @@ -57,8 +57,8 @@ static int commonObjectCompare(const CommonObjectDataPointer& obj1, const Common } static int tileCommonObjectCompare(const CommonObjectDataPointer& obj1, const CommonObjectDataPointer& obj2) { - int p1 = -obj1->location.u() - obj1->location.v() - obj1->location.z; - int p2 = -obj2->location.u() - obj2->location.v() - obj2->location.z; + int p1 = -obj1->_location.u() - obj1->_location.v() - obj1->_location.z; + int p2 = -obj2->_location.u() - obj2->_location.v() - obj2->_location.z; //TODO: for kObjNotFlat obj Height*3 of sprite should be added to p1 and p2 //if (validObjId(obj1->id)) { @@ -230,52 +230,52 @@ Actor::Actor(SagaEngine *vm) : _vm(vm) { _actors = (ActorData **)malloc(_actorsCount * sizeof(*_actors)); for (i = 0; i < _actorsCount; i++) { actor = _actors[i] = new ActorData(); - actor->id = actorIndexToId(i); - actor->index = i; - debug(9, "init actor id=%d index=%d", actor->id, actor->index); - actor->nameIndex = ITE_ActorTable[i].nameIndex; - actor->scriptEntrypointNumber = ITE_ActorTable[i].scriptEntrypointNumber; - actor->spriteListResourceId = ITE_ActorTable[i].spriteListResourceId; - actor->frameListResourceId = ITE_ActorTable[i].frameListResourceId; - actor->speechColor = ITE_ActorTable[i].speechColor; - actor->sceneNumber = ITE_ActorTable[i].sceneIndex; - actor->flags = ITE_ActorTable[i].flags; - actor->currentAction = ITE_ActorTable[i].currentAction; - actor->facingDirection = ITE_ActorTable[i].facingDirection; - actor->actionDirection = ITE_ActorTable[i].actionDirection; - - actor->location.x = ITE_ActorTable[i].x; - actor->location.y = ITE_ActorTable[i].y; - actor->location.z = ITE_ActorTable[i].z; - - actor->disabled = !loadActorResources(actor); - if (actor->disabled) { - warning("Disabling actor Id=%d index=%d", actor->id, actor->index); + actor->_id = actorIndexToId(i); + actor->_index = i; + debug(9, "init actor id=%d index=%d", actor->_id, actor->_index); + actor->_nameIndex = ITE_ActorTable[i].nameIndex; + actor->_scriptEntrypointNumber = ITE_ActorTable[i].scriptEntrypointNumber; + actor->_spriteListResourceId = ITE_ActorTable[i].spriteListResourceId; + actor->_frameListResourceId = ITE_ActorTable[i].frameListResourceId; + actor->_speechColor = ITE_ActorTable[i].speechColor; + actor->_sceneNumber = ITE_ActorTable[i].sceneIndex; + actor->_flags = ITE_ActorTable[i].flags; + actor->_currentAction = ITE_ActorTable[i].currentAction; + actor->_facingDirection = ITE_ActorTable[i].facingDirection; + actor->_actionDirection = ITE_ActorTable[i].actionDirection; + + actor->_location.x = ITE_ActorTable[i].x; + actor->_location.y = ITE_ActorTable[i].y; + actor->_location.z = ITE_ActorTable[i].z; + + actor->_disabled = !loadActorResources(actor); + if (actor->_disabled) { + warning("Disabling actor Id=%d index=%d", actor->_id, actor->_index); } } _objsCount = ITE_OBJECTCOUNT; _objs = (ObjectData **)malloc(_objsCount * sizeof(*_objs)); for (i = 0; i < _objsCount; i++) { obj = _objs[i] = new ObjectData(); - obj->id = objIndexToId(i); - obj->index = i; - debug(9, "init obj id=%d index=%d", obj->id, obj->index); - obj->nameIndex = ITE_ObjectTable[i].nameIndex; - obj->scriptEntrypointNumber = ITE_ObjectTable[i].scriptEntrypointNumber; - obj->spriteListResourceId = ITE_ObjectTable[i].spriteListResourceId; - obj->sceneNumber = ITE_ObjectTable[i].sceneIndex; - obj->interactBits = ITE_ObjectTable[i].interactBits; - - obj->location.x = ITE_ObjectTable[i].x; - obj->location.y = ITE_ObjectTable[i].y; - obj->location.z = ITE_ObjectTable[i].z; + obj->_id = objIndexToId(i); + obj->_index = i; + debug(9, "init obj id=%d index=%d", obj->_id, obj->_index); + obj->_nameIndex = ITE_ObjectTable[i].nameIndex; + obj->_scriptEntrypointNumber = ITE_ObjectTable[i].scriptEntrypointNumber; + obj->_spriteListResourceId = ITE_ObjectTable[i].spriteListResourceId; + obj->_sceneNumber = ITE_ObjectTable[i].sceneIndex; + obj->_interactBits = ITE_ObjectTable[i].interactBits; + + obj->_location.x = ITE_ObjectTable[i].x; + obj->_location.y = ITE_ObjectTable[i].y; + obj->_location.z = ITE_ObjectTable[i].z; } } else { // TODO. This is causing problems for SYMBIAN os as it does n't like a static class here ActorData dummyActor; - dummyActor.frames = NULL; - dummyActor.walkStepsPoints = NULL; + dummyActor._frames = NULL; + dummyActor._walkStepsPoints = NULL; _protagonist = &dummyActor; } @@ -310,9 +310,9 @@ bool Actor::loadActorResources(ActorData *actor) { int resourceId; bool gotSomething = false; - if (actor->frameListResourceId) { - debug(9, "Loading frame resource id %d", actor->frameListResourceId); - _vm->_resource->loadResource(_actorContext, actor->frameListResourceId, resourcePointer, resourceLength); + if (actor->_frameListResourceId) { + debug(9, "Loading frame resource id %d", actor->_frameListResourceId); + _vm->_resource->loadResource(_actorContext, actor->_frameListResourceId, resourcePointer, resourceLength); framesCount = resourceLength / 16; debug(9, "Frame resource contains %d frames (res length is %d)", framesCount, resourceLength); @@ -339,34 +339,34 @@ bool Actor::loadActorResources(ActorData *actor) { free(resourcePointer); - actor->frames = framesPointer; - actor->framesCount = framesCount; + actor->_frames = framesPointer; + actor->_framesCount = framesCount; gotSomething = true; } else { - warning("Frame List ID = 0 for actor index %d", actor->index); + warning("Frame List ID = 0 for actor index %d", actor->_index); } - resourceId = actor->spriteListResourceId; + resourceId = actor->_spriteListResourceId; if (resourceId) { debug(9, "Loading sprite resource id %d", resourceId); - _vm->_sprite->loadList(resourceId, actor->spriteList); + _vm->_sprite->loadList(resourceId, actor->_spriteList); - i = actor->spriteList.spriteCount; - if (actor->flags & kExtended) { - while ((lastFrame >= actor->spriteList.spriteCount)) { + i = actor->_spriteList.spriteCount; + if (actor->_flags & kExtended) { + while ((lastFrame >= actor->_spriteList.spriteCount)) { resourceId++; debug(9, "Appending to sprite list %d", resourceId); - _vm->_sprite->loadList(resourceId, actor->spriteList); + _vm->_sprite->loadList(resourceId, actor->_spriteList); } } gotSomething = true; } else { - warning("Sprite List ID = 0 for actor index %d", actor->index); + warning("Sprite List ID = 0 for actor index %d", actor->_index); } return gotSomething; @@ -410,23 +410,23 @@ void Actor::loadActorList(int protagonistIdx, int actorCount, int actorsResource _actors = (ActorData **)malloc(_actorsCount * sizeof(*_actors)); for (i = 0; i < _actorsCount; i++) { actor = _actors[i] = new ActorData(); - actor->id = actorIndexToId(i); - actor->index = i; - debug(9, "init actor id=%d index=%d", actor->id, actor->index); + actor->_id = actorIndexToId(i); + actor->_index = i; + debug(9, "init actor id=%d index=%d", actor->_id, actor->_index); actorS.readUint32LE(); //next displayed actorS.readByte(); //type - actor->flags = actorS.readByte(); - actor->nameIndex = actorS.readUint16LE(); - actor->sceneNumber = actorS.readUint32LE(); - actor->location.fromStream(actorS); - actor->screenPosition.x = actorS.readUint16LE(); - actor->screenPosition.y = actorS.readUint16LE(); - actor->screenScale = actorS.readUint16LE(); - actor->screenDepth = actorS.readUint16LE(); - actor->spriteListResourceId = actorS.readUint32LE(); - actor->frameListResourceId = actorS.readUint32LE(); - debug(0, "%d: %d, %d", i, actor->spriteListResourceId, actor->frameListResourceId); - actor->scriptEntrypointNumber = actorS.readUint32LE(); + actor->_flags = actorS.readByte(); + actor->_nameIndex = actorS.readUint16LE(); + actor->_sceneNumber = actorS.readUint32LE(); + actor->_location.fromStream(actorS); + actor->_screenPosition.x = actorS.readUint16LE(); + actor->_screenPosition.y = actorS.readUint16LE(); + actor->_screenScale = actorS.readUint16LE(); + actor->_screenDepth = actorS.readUint16LE(); + actor->_spriteListResourceId = actorS.readUint32LE(); + actor->_frameListResourceId = actorS.readUint32LE(); + debug(0, "%d: %d, %d", i, actor->_spriteListResourceId, actor->_frameListResourceId); + actor->_scriptEntrypointNumber = actorS.readUint32LE(); actorS.readByte(); actorS.readByte(); actorS.readByte(); @@ -435,14 +435,14 @@ void Actor::loadActorList(int protagonistIdx, int actorCount, int actorsResource actorS.readUint16LE(); //RIGHT actorS.readUint16LE(); //TOP actorS.readUint16LE(); //BOTTOM - actor->speechColor = actorS.readByte(); - actor->currentAction = actorS.readByte(); - actor->facingDirection = actorS.readByte(); - actor->actionDirection = actorS.readByte(); - actor->actionCycle = actorS.readUint16LE(); - actor->frameNumber = actorS.readUint16LE(); - actor->finalTarget.fromStream(actorS); - actor->partialTarget.fromStream(actorS); + actor->_speechColor = actorS.readByte(); + actor->_currentAction = actorS.readByte(); + actor->_facingDirection = actorS.readByte(); + actor->_actionDirection = actorS.readByte(); + actor->_actionCycle = actorS.readUint16LE(); + actor->_frameNumber = actorS.readUint16LE(); + actor->_finalTarget.fromStream(actorS); + actor->_partialTarget.fromStream(actorS); movementSpeed = actorS.readUint16LE(); //movement speed if (movementSpeed) { error("Actor::loadActorList movementSpeed != 0"); @@ -466,8 +466,8 @@ void Actor::loadActorList(int protagonistIdx, int actorCount, int actorsResource actorS.readUint32LE(); //sprites actorS.readUint32LE(); //frames actorS.readUint32LE(); //last zone - actor->targetObject = actorS.readUint16LE(); - actor->actorFlags = actorS.readUint16LE(); + actor->_targetObject = actorS.readUint16LE(); + actor->_actorFlags = actorS.readUint16LE(); //no need to check pointers actorS.readUint32LE(); //next in scene actorS.read(acv, 6); @@ -480,15 +480,15 @@ void Actor::loadActorList(int protagonistIdx, int actorCount, int actorsResource } free(actorListData); - _actors[protagonistIdx]->flags |= kProtagonist | kExtended; + _actors[protagonistIdx]->_flags |= kProtagonist | kExtended; for (i = 0; i < _actorsCount; i++) { actor = _actors[i]; - if (actor->flags & kExtended) { + if (actor->_flags & kExtended) { loadActorResources(actor); - if (actor->disabled) { - warning("Disabling actor Id=%d index=%d", actor->id, actor->index); + if (actor->_disabled) { + warning("Disabling actor Id=%d index=%d", actor->_id, actor->_index); } break; } @@ -519,7 +519,7 @@ void Actor::loadActorList(int protagonistIdx, int actorCount, int actorsResource } free(resourcePointer); - _protagonist->frames = &_protagStates[_protagState]; + _protagonist->_frames = &_protagStates[_protagState]; } _protagStatesCount = protagStatesCount; @@ -554,25 +554,25 @@ void Actor::loadObjList(int objectCount, int objectsResourceID) { _objs = (ObjectData **)malloc(_objsCount * sizeof(*_objs)); for (i = 0; i < _objsCount; i++) { object = _objs[i] = new ObjectData(); - object->id = objectIndexToId(kGameObjectObject, i); - object->index = i; - debug(9, "init object id=%d index=%d", object->id, object->index); + object->_id = objectIndexToId(kGameObjectObject, i); + object->_index = i; + debug(9, "init object id=%d index=%d", object->_id, object->_index); objectS.readUint32LE(); //next displayed objectS.readByte(); //type - object->flags = objectS.readByte(); - object->nameIndex = objectS.readUint16LE(); - object->sceneNumber = objectS.readUint32LE(); - object->location.fromStream(objectS); - object->screenPosition.x = objectS.readUint16LE(); - object->screenPosition.y = objectS.readUint16LE(); - object->screenScale = objectS.readUint16LE(); - object->screenDepth = objectS.readUint16LE(); - object->spriteListResourceId = objectS.readUint32LE(); - frameListResourceId = objectS.readUint32LE(); // object->frameListResourceId + object->_flags = objectS.readByte(); + object->_nameIndex = objectS.readUint16LE(); + object->_sceneNumber = objectS.readUint32LE(); + object->_location.fromStream(objectS); + object->_screenPosition.x = objectS.readUint16LE(); + object->_screenPosition.y = objectS.readUint16LE(); + object->_screenScale = objectS.readUint16LE(); + object->_screenDepth = objectS.readUint16LE(); + object->_spriteListResourceId = objectS.readUint32LE(); + frameListResourceId = objectS.readUint32LE(); // object->_frameListResourceId if (frameListResourceId) { error("Actor::loadObjList frameListResourceId != 0"); } - object->scriptEntrypointNumber = objectS.readUint32LE(); + object->_scriptEntrypointNumber = objectS.readUint32LE(); objectS.readByte(); objectS.readByte(); objectS.readByte(); @@ -581,7 +581,7 @@ void Actor::loadObjList(int objectCount, int objectsResourceID) { objectS.readUint16LE(); //RIGHT objectS.readUint16LE(); //TOP objectS.readUint16LE(); //BOTTOM - object->interactBits = objectS.readUint16LE(); + object->_interactBits = objectS.readUint16LE(); } free(objectListData); } @@ -589,7 +589,7 @@ void Actor::loadObjList(int objectCount, int objectsResourceID) { void Actor::takeExit(uint16 actorId, const HitZone *hitZone) { ActorData *actor; actor = getActor(actorId); - actor->lastZone = NULL; + actor->_lastZone = NULL; _vm->_scene->changeScene(hitZone->getSceneNumber(), hitZone->getActorsEntrance(), kTransitionNoFade); if (_vm->_interface->getMode() != kPanelSceneSubstitute) { @@ -609,16 +609,16 @@ void Actor::stepZoneAction(ActorData *actor, const HitZone *hitZone, bool exit, if (!exit) { if (hitZone->getFlags() & kHitZoneAutoWalk) { - actor->currentAction = kActionWalkDir; - actor->actionDirection = actor->facingDirection = hitZone->getDirection(); - actor->walkFrameSequence = kFrameWalk; + actor->_currentAction = kActionWalkDir; + actor->_actionDirection = actor->_facingDirection = hitZone->getDirection(); + actor->_walkFrameSequence = kFrameWalk; return; } } else if (!(hitZone->getFlags() & kHitZoneAutoWalk)) { return; } if (hitZone->getFlags() & kHitZoneExit) { - takeExit(actor->id, hitZone); + takeExit(actor->_id, hitZone); } else if (hitZone->getScriptNumber() > 0) { event.type = ONESHOT_EVENT; event.code = SCRIPT_EVENT; @@ -660,10 +660,10 @@ void Actor::realLocation(Location &location, uint16 objectId, uint16 walkFlags) if (objectId != ID_NOTHING) { if (validActorId(objectId)) { actor = getActor(objectId); - location.addXY(actor->location); + location.addXY(actor->_location); } else if (validObjId(objectId)) { obj = getObj(objectId); - location.addXY(obj->location); + location.addXY(obj->_location); } } } @@ -674,19 +674,19 @@ void Actor::actorFaceTowardsPoint(uint16 actorId, const Location &toLocation) { //debug (8, "Actor::actorFaceTowardsPoint actorId=%i", actorId); actor = getActor(actorId); - toLocation.delta(actor->location, delta); + toLocation.delta(actor->_location, delta); if (_vm->_scene->getFlags() & kSceneFlagISO) { if (delta.u() > 0) { - actor->facingDirection = (delta.v() > 0) ? kDirUp : kDirRight; + actor->_facingDirection = (delta.v() > 0) ? kDirUp : kDirRight; } else { - actor->facingDirection = (delta.v() > 0) ? kDirLeft : kDirDown; + actor->_facingDirection = (delta.v() > 0) ? kDirLeft : kDirDown; } } else { if (ABS(delta.y) > ABS(delta.x * 2)) { - actor->facingDirection = (delta.y > 0) ? kDirDown : kDirUp; + actor->_facingDirection = (delta.y > 0) ? kDirDown : kDirUp; } else { - actor->facingDirection = (delta.x > 0) ? kDirRight : kDirLeft; + actor->_facingDirection = (delta.x > 0) ? kDirRight : kDirLeft; } } } @@ -697,10 +697,10 @@ void Actor::actorFaceTowardsObject(uint16 actorId, uint16 objectId) { if (validActorId(objectId)) { actor = getActor(objectId); - actorFaceTowardsPoint(actorId, actor->location); + actorFaceTowardsPoint(actorId, actor->_location); } else if (validObjId(objectId)) { obj = getObj(objectId); - actorFaceTowardsPoint(actorId, obj->location); + actorFaceTowardsPoint(actorId, obj->_location); } } @@ -713,7 +713,7 @@ ObjectData *Actor::getObj(uint16 objId) { obj = _objs[objIdToIndex(objId)]; - if (obj->disabled) + if (obj->_disabled) error("Actor::getObj disabled objId 0x%X", objId); return obj; @@ -736,7 +736,7 @@ ActorData *Actor::getActor(uint16 actorId) { actor = _actors[actorIdToIndex(actorId)]; - if (actor->disabled) + if (actor->_disabled) error("Actor::getActor disabled actorId 0x%X", actorId); return actor; @@ -758,7 +758,7 @@ void Actor::setProtagState(int state) { _protagState = state; if (_vm->getGameType() == GType_IHNM) - _protagonist->frames = &_protagStates[state]; + _protagonist->_frames = &_protagStates[state]; } void Actor::updateActorsScene(int actorsEntrance) { @@ -781,24 +781,24 @@ void Actor::updateActorsScene(int actorsEntrance) { for (i = 0; i < _actorsCount; i++) { actor = _actors[i]; - actor->inScene = false; - if (actor->disabled) { + actor->_inScene = false; + if (actor->_disabled) { continue; } - if ((actor->flags & (kProtagonist | kFollower)) || (i == 0)) { - if (actor->flags & kProtagonist) { - actor->finalTarget = actor->location; + if ((actor->_flags & (kProtagonist | kFollower)) || (i == 0)) { + if (actor->_flags & kProtagonist) { + actor->_finalTarget = actor->_location; _centerActor = _protagonist = actor; } else if (_vm->getGameType() == GType_ITE && _vm->_scene->currentSceneResourceId() == RID_ITE_OVERMAP_SCENE) { continue; } - actor->sceneNumber = _vm->_scene->currentSceneNumber(); + actor->_sceneNumber = _vm->_scene->currentSceneNumber(); } - if (actor->sceneNumber == _vm->_scene->currentSceneNumber()) { - actor->inScene = true; - actor->actionCycle = (_vm->_rnd.getRandomNumber(7) & 0x7) * 4; // 1/8th chance + if (actor->_sceneNumber == _vm->_scene->currentSceneNumber()) { + actor->_inScene = true; + actor->_actionCycle = (_vm->_rnd.getRandomNumber(7) & 0x7) * 4; // 1/8th chance } } @@ -811,16 +811,16 @@ void Actor::updateActorsScene(int actorsEntrance) { sceneEntry = _vm->_scene->_entryList.getEntry(actorsEntrance); if (_vm->_scene->getFlags() & kSceneFlagISO) { - _protagonist->location = sceneEntry->location; + _protagonist->_location = sceneEntry->location; } else { - _protagonist->location.x = sceneEntry->location.x * ACTOR_LMULT; - _protagonist->location.y = sceneEntry->location.y * ACTOR_LMULT; - _protagonist->location.z = sceneEntry->location.z * ACTOR_LMULT; + _protagonist->_location.x = sceneEntry->location.x * ACTOR_LMULT; + _protagonist->_location.y = sceneEntry->location.y * ACTOR_LMULT; + _protagonist->_location.z = sceneEntry->location.z * ACTOR_LMULT; } - _protagonist->facingDirection = _protagonist->actionDirection = sceneEntry->facing; + _protagonist->_facingDirection = _protagonist->_actionDirection = sceneEntry->facing; } - _protagonist->currentAction = kActionWait; + _protagonist->_currentAction = kActionWait; if (_vm->_scene->getFlags() & kSceneFlagISO) { //nothing? @@ -828,24 +828,24 @@ void Actor::updateActorsScene(int actorsEntrance) { _vm->_scene->initDoorsState(); //TODO: move to _scene } - followerDirection = _protagonist->facingDirection + 3; + followerDirection = _protagonist->_facingDirection + 3; calcScreenPosition(_protagonist); for (i = 0; i < _actorsCount; i++) { actor = _actors[i]; - if (actor->flags & (kFollower)) { - actor->facingDirection = actor->actionDirection = _protagonist->facingDirection; - actor->currentAction = kActionWait; - actor->walkStepsCount = actor->walkStepIndex = 0; - actor->location.z = _protagonist->location.z; + if (actor->_flags & (kFollower)) { + actor->_facingDirection = actor->_actionDirection = _protagonist->_facingDirection; + actor->_currentAction = kActionWait; + actor->_walkStepsCount = actor->_walkStepIndex = 0; + actor->_location.z = _protagonist->_location.z; if (_vm->_scene->getFlags() & kSceneFlagISO) { - _vm->_isoMap->placeOnTileMap(_protagonist->location, actor->location, 3, followerDirection & 0x07); + _vm->_isoMap->placeOnTileMap(_protagonist->_location, actor->_location, 3, followerDirection & 0x07); } else { followerDirection &= 0x07; - possibleLocation = _protagonist->location; + possibleLocation = _protagonist->_location; delta.x = directionLUT[followerDirection][0]; @@ -876,7 +876,7 @@ void Actor::updateActorsScene(int actorsEntrance) { } } - actor->location = possibleLocation; + actor->_location = possibleLocation; } followerDirection += 2; } @@ -894,17 +894,17 @@ ActorFrameRange *Actor::getActorFrameRange(uint16 actorId, int frameType) { int fourDirection; actor = getActor(actorId); - if (actor->disabled) + if (actor->_disabled) error("Actor::getActorFrameRange Wrong actorId 0x%X", actorId); - if (frameType >= actor->framesCount) - error("Actor::getActorFrameRange Wrong frameType 0x%X (%d) actorId 0x%X", frameType, actor->framesCount, actorId); + if (frameType >= actor->_framesCount) + error("Actor::getActorFrameRange Wrong frameType 0x%X (%d) actorId 0x%X", frameType, actor->_framesCount, actorId); - if ((actor->facingDirection < kDirUp) || (actor->facingDirection > kDirUpLeft)) - error("Actor::getActorFrameRange Wrong direction 0x%X actorId 0x%X", actor->facingDirection, actorId); + if ((actor->_facingDirection < kDirUp) || (actor->_facingDirection > kDirUpLeft)) + error("Actor::getActorFrameRange Wrong direction 0x%X actorId 0x%X", actor->_facingDirection, actorId); - fourDirection = actorDirectectionsLUT[actor->facingDirection]; - return &actor->frames[frameType].directions[fourDirection]; + fourDirection = actorDirectectionsLUT[actor->_facingDirection]; + return &actor->_frames[frameType].directions[fourDirection]; } void Actor::handleSpeech(int msec) { @@ -934,7 +934,7 @@ void Actor::handleSpeech(int msec) { if (_activeSpeech.actorIds[0] != 0) { actor = getActor(_activeSpeech.actorIds[0]); if (!(_activeSpeech.speechFlags & kSpeakNoAnimate)) { - actor->currentAction = kActionWait; + actor->_currentAction = kActionWait; } } } @@ -997,8 +997,8 @@ void Actor::handleSpeech(int msec) { if (_activeSpeech.actorIds[0] != 0) { actor = getActor(_activeSpeech.actorIds[0]); if (!(_activeSpeech.speechFlags & kSpeakNoAnimate)) { - actor->currentAction = kActionSpeak; - actor->actionCycle = _vm->_rnd.getRandomNumber(63); + actor->_currentAction = kActionSpeak; + actor->_actionCycle = _vm->_rnd.getRandomNumber(63); } } @@ -1023,7 +1023,7 @@ void Actor::handleSpeech(int msec) { _activeSpeech.drawRect.left = _activeSpeech.speechBox.left; } - height2 = actor->screenPosition.y - 50; + height2 = actor->_screenPosition.y - 50; _activeSpeech.speechBox.top = _activeSpeech.drawRect.top = MAX(10, (height2 - height) / 2); } else { _activeSpeech.drawRect.left = _activeSpeech.speechBox.left; @@ -1052,7 +1052,7 @@ void Actor::handleActions(int msec, bool setup) { for (i = 0; i < _actorsCount; i++) { actor = _actors[i]; - if (!actor->inScene) + if (!actor->_inScene) continue; if ((_vm->getGameType() == GType_ITE) && (i == ACTOR_DRAGON_INDEX)) { @@ -1060,78 +1060,75 @@ void Actor::handleActions(int msec, bool setup) { continue; } -/* if (actor->index == 2) - debug(9, "Action: %d Flags: %x", actor->currentAction, actor->flags);*/ - if (_vm->getGameType() == GType_IHNM) { - if (actor->spriteList.spriteCount == 0) + if (actor->_spriteList.spriteCount == 0) continue; } - switch (actor->currentAction) { + switch (actor->_currentAction) { case kActionWait: - if (!setup && (actor->flags & kFollower)) { + if (!setup && (actor->_flags & kFollower)) { followProtagonist(actor); - if (actor->currentAction != kActionWait) + if (actor->_currentAction != kActionWait) break; } - if (actor->targetObject != ID_NOTHING) { - actorFaceTowardsObject(actor->id, actor->targetObject); + if (actor->_targetObject != ID_NOTHING) { + actorFaceTowardsObject(actor->_id, actor->_targetObject); } - if (actor->flags & kCycle) { - frameRange = getActorFrameRange(actor->id, kFrameStand); + if (actor->_flags & kCycle) { + frameRange = getActorFrameRange(actor->_id, kFrameStand); if (frameRange->frameCount > 0) { - actor->actionCycle++; - actor->actionCycle = (actor->actionCycle) % frameRange->frameCount; + actor->_actionCycle++; + actor->_actionCycle = (actor->_actionCycle) % frameRange->frameCount; } else { - actor->actionCycle = 0; + actor->_actionCycle = 0; } - actor->frameNumber = frameRange->frameIndex + actor->actionCycle; + actor->_frameNumber = frameRange->frameIndex + actor->_actionCycle; break; } - if ((actor->actionCycle & 3) == 0) { + if ((actor->_actionCycle & 3) == 0) { actor->cycleWrap(100); - frameRange = getActorFrameRange(actor->id, kFrameWait); - if ((frameRange->frameCount < 1 || actor->actionCycle > 33)) - frameRange = getActorFrameRange(actor->id, kFrameStand); + frameRange = getActorFrameRange(actor->_id, kFrameWait); + if ((frameRange->frameCount < 1 || actor->_actionCycle > 33)) + frameRange = getActorFrameRange(actor->_id, kFrameStand); if (frameRange->frameCount) { - actor->frameNumber = frameRange->frameIndex + (uint16)_vm->_rnd.getRandomNumber(frameRange->frameCount - 1); + actor->_frameNumber = frameRange->frameIndex + (uint16)_vm->_rnd.getRandomNumber(frameRange->frameCount - 1); } else { - actor->frameNumber = frameRange->frameIndex; + actor->_frameNumber = frameRange->frameIndex; } } - actor->actionCycle++; + actor->_actionCycle++; break; case kActionWalkToPoint: case kActionWalkToLink: if (_vm->_scene->getFlags() & kSceneFlagISO) { - actor->partialTarget.delta(actor->location, delta); + actor->_partialTarget.delta(actor->_location, delta); while ((delta.u() == 0) && (delta.v() == 0)) { if ((actor == _protagonist) && (_vm->mouseButtonPressed())) { _vm->_isoMap->screenPointToTileCoords(_vm->mousePos(), pickLocation); - if (!actorWalkTo(_protagonist->id, pickLocation)) { + if (!actorWalkTo(_protagonist->_id, pickLocation)) { break; } - } else if (!_vm->_isoMap->nextTileTarget(actor) && !actorEndWalk(actor->id, true)) { + } else if (!_vm->_isoMap->nextTileTarget(actor) && !actorEndWalk(actor->_id, true)) { break; } - actor->partialTarget.delta(actor->location, delta); - actor->partialTarget.z = 0; + actor->_partialTarget.delta(actor->_location, delta); + actor->_partialTarget.z = 0; } - if (actor->flags & kFastest) { + if (actor->_flags & kFastest) { speed = 8; - } else if (actor->flags & kFaster) { + } else if (actor->_flags & kFaster) { speed = 6; } else { speed = 4; @@ -1141,7 +1138,7 @@ void Actor::handleActions(int msec, bool setup) { speed = 2; } - if ((actor->actionDirection == 2) || (actor->actionDirection == 6)) { + if ((actor->_actionDirection == 2) || (actor->_actionDirection == 6)) { speed = speed / 2; } @@ -1165,37 +1162,37 @@ void Actor::handleActions(int msec, bool setup) { } } - actor->location.add(addDelta); + actor->_location.add(addDelta); } else { - actor->partialTarget.delta(actor->location, delta); + actor->_partialTarget.delta(actor->_location, delta); while ((delta.x == 0) && (delta.y == 0)) { - if (actor->walkStepIndex >= actor->walkStepsCount) { - actorEndWalk(actor->id, true); + if (actor->_walkStepIndex >= actor->_walkStepsCount) { + actorEndWalk(actor->_id, true); break; } - actor->partialTarget.fromScreenPoint(actor->walkStepsPoints[actor->walkStepIndex++]); - if (actor->partialTarget.x > 224 * 2 * ACTOR_LMULT) { - actor->partialTarget.x -= 256 * 2 * ACTOR_LMULT; + actor->_partialTarget.fromScreenPoint(actor->_walkStepsPoints[actor->_walkStepIndex++]); + if (actor->_partialTarget.x > 224 * 2 * ACTOR_LMULT) { + actor->_partialTarget.x -= 256 * 2 * ACTOR_LMULT; } - actor->partialTarget.delta(actor->location, delta); + actor->_partialTarget.delta(actor->_location, delta); if (ABS(delta.y) > ABS(delta.x)) { - actor->actionDirection = delta.y > 0 ? kDirDown : kDirUp; + actor->_actionDirection = delta.y > 0 ? kDirDown : kDirUp; } else { - actor->actionDirection = delta.x > 0 ? kDirRight : kDirLeft; + actor->_actionDirection = delta.x > 0 ? kDirRight : kDirLeft; } } - speed = (ACTOR_LMULT * 2 * actor->screenScale + 63) / 256; + speed = (ACTOR_LMULT * 2 * actor->_screenScale + 63) / 256; if (speed < 1) { speed = 1; } - if ((actor->actionDirection == kDirUp) || (actor->actionDirection == kDirDown)) { + if ((actor->_actionDirection == kDirUp) || (actor->_actionDirection == kDirDown)) { addDelta.y = clamp(-speed, delta.y, speed); if (addDelta.y == delta.y) { addDelta.x = delta.x; @@ -1203,7 +1200,7 @@ void Actor::handleActions(int msec, bool setup) { addDelta.x = delta.x * addDelta.y; addDelta.x += (addDelta.x > 0) ? (delta.y / 2) : (-delta.y / 2); addDelta.x /= delta.y; - actor->facingDirection = actor->actionDirection; + actor->_facingDirection = actor->_actionDirection; } } else { addDelta.x = clamp(-2 * speed, delta.x, 2 * speed); @@ -1213,74 +1210,74 @@ void Actor::handleActions(int msec, bool setup) { addDelta.y = delta.y * addDelta.x; addDelta.y += (addDelta.y > 0) ? (delta.x / 2) : (-delta.x / 2); addDelta.y /= delta.x; - actor->facingDirection = actor->actionDirection; + actor->_facingDirection = actor->_actionDirection; } } - actor->location.add(addDelta); + actor->_location.add(addDelta); } - if (actor->actorFlags & kActorBackwards) { - actor->facingDirection = (actor->actionDirection + 4) & 7; - actor->actionCycle--; + if (actor->_actorFlags & kActorBackwards) { + actor->_facingDirection = (actor->_actionDirection + 4) & 7; + actor->_actionCycle--; } else { - actor->actionCycle++; + actor->_actionCycle++; } - frameRange = getActorFrameRange(actor->id, actor->walkFrameSequence); + frameRange = getActorFrameRange(actor->_id, actor->_walkFrameSequence); - if (actor->actionCycle < 0) { - actor->actionCycle = frameRange->frameCount - 1; - } else if (actor->actionCycle >= frameRange->frameCount) { - actor->actionCycle = 0; + if (actor->_actionCycle < 0) { + actor->_actionCycle = frameRange->frameCount - 1; + } else if (actor->_actionCycle >= frameRange->frameCount) { + actor->_actionCycle = 0; } - actor->frameNumber = frameRange->frameIndex + actor->actionCycle; + actor->_frameNumber = frameRange->frameIndex + actor->_actionCycle; break; case kActionWalkDir: if (_vm->_scene->getFlags() & kSceneFlagISO) { - actor->location.u() += tileDirectionLUT[actor->actionDirection][0]; - actor->location.v() += tileDirectionLUT[actor->actionDirection][1]; + actor->_location.u() += tileDirectionLUT[actor->_actionDirection][0]; + actor->_location.v() += tileDirectionLUT[actor->_actionDirection][1]; - frameRange = getActorFrameRange(actor->id, actor->walkFrameSequence); + frameRange = getActorFrameRange(actor->_id, actor->_walkFrameSequence); - actor->actionCycle++; + actor->_actionCycle++; actor->cycleWrap(frameRange->frameCount); - actor->frameNumber = frameRange->frameIndex + actor->actionCycle; + actor->_frameNumber = frameRange->frameIndex + actor->_actionCycle; } else { - actor->location.x += directionLUT[actor->actionDirection][0] * 2; - actor->location.y += directionLUT[actor->actionDirection][1] * 2; + actor->_location.x += directionLUT[actor->_actionDirection][0] * 2; + actor->_location.y += directionLUT[actor->_actionDirection][1] * 2; - frameRange = getActorFrameRange(actor->id, actor->walkFrameSequence); - actor->actionCycle++; + frameRange = getActorFrameRange(actor->_id, actor->_walkFrameSequence); + actor->_actionCycle++; actor->cycleWrap(frameRange->frameCount); - actor->frameNumber = frameRange->frameIndex + actor->actionCycle; + actor->_frameNumber = frameRange->frameIndex + actor->_actionCycle; } break; case kActionSpeak: - actor->actionCycle++; + actor->_actionCycle++; actor->cycleWrap(64); - frameRange = getActorFrameRange(actor->id, kFrameGesture); - if (actor->actionCycle >= frameRange->frameCount) { - if (actor->actionCycle & 1) + frameRange = getActorFrameRange(actor->_id, kFrameGesture); + if (actor->_actionCycle >= frameRange->frameCount) { + if (actor->_actionCycle & 1) break; - frameRange = getActorFrameRange(actor->id, kFrameSpeak); + frameRange = getActorFrameRange(actor->_id, kFrameSpeak); state = (uint16)_vm->_rnd.getRandomNumber(frameRange->frameCount); if (state == 0) { - frameRange = getActorFrameRange(actor->id, kFrameStand); + frameRange = getActorFrameRange(actor->_id, kFrameStand); } else { state--; } } else { - state = actor->actionCycle; + state = actor->_actionCycle; } - actor->frameNumber = frameRange->frameIndex + state; + actor->_frameNumber = frameRange->frameIndex + state; break; case kActionAccept: @@ -1289,115 +1286,115 @@ void Actor::handleActions(int msec, bool setup) { case kActionCycleFrames: case kActionPongFrames: - if (actor->cycleTimeCount > 0) { - actor->cycleTimeCount--; + if (actor->_cycleTimeCount > 0) { + actor->_cycleTimeCount--; break; } - actor->cycleTimeCount = actor->cycleDelay; - actor->actionCycle++; + actor->_cycleTimeCount = actor->_cycleDelay; + actor->_actionCycle++; - frameRange = getActorFrameRange(actor->id, actor->cycleFrameSequence); + frameRange = getActorFrameRange(actor->_id, actor->_cycleFrameSequence); - if (actor->currentAction == kActionPongFrames) { - if (actor->actionCycle >= frameRange->frameCount * 2 - 2) { - if (actor->actorFlags & kActorContinuous) { - actor->actionCycle = 0; + if (actor->_currentAction == kActionPongFrames) { + if (actor->_actionCycle >= frameRange->frameCount * 2 - 2) { + if (actor->_actorFlags & kActorContinuous) { + actor->_actionCycle = 0; } else { - actor->currentAction = kActionFreeze; + actor->_currentAction = kActionFreeze; break; } } - state = actor->actionCycle; + state = actor->_actionCycle; if (state >= frameRange->frameCount) { state = frameRange->frameCount * 2 - 2 - state; } } else { - if (actor->actionCycle >= frameRange->frameCount) { - if (actor->actorFlags & kActorContinuous) { - actor->actionCycle = 0; + if (actor->_actionCycle >= frameRange->frameCount) { + if (actor->_actorFlags & kActorContinuous) { + actor->_actionCycle = 0; } else { - actor->currentAction = kActionFreeze; + actor->_currentAction = kActionFreeze; break; } } - state = actor->actionCycle; + state = actor->_actionCycle; } - if (frameRange->frameCount && (actor->actorFlags & kActorRandom)) { + if (frameRange->frameCount && (actor->_actorFlags & kActorRandom)) { state = _vm->_rnd.getRandomNumber(frameRange->frameCount - 1); } - if (actor->actorFlags & kActorBackwards) { - actor->frameNumber = frameRange->frameIndex + frameRange->frameCount - 1 - state; + if (actor->_actorFlags & kActorBackwards) { + actor->_frameNumber = frameRange->frameIndex + frameRange->frameCount - 1 - state; } else { - actor->frameNumber = frameRange->frameIndex + state; + actor->_frameNumber = frameRange->frameIndex + state; } break; case kActionFall: - if (actor->actionCycle > 0) { - framesLeft = actor->actionCycle--; - actor->finalTarget.delta(actor->location, delta); + if (actor->_actionCycle > 0) { + framesLeft = actor->_actionCycle--; + actor->_finalTarget.delta(actor->_location, delta); delta.x /= framesLeft; delta.y /= framesLeft; - actor->location.addXY(delta); - actor->fallVelocity += actor->fallAcceleration; - actor->fallPosition += actor->fallVelocity; - actor->location.z = actor->fallPosition >> 4; + actor->_location.addXY(delta); + actor->_fallVelocity += actor->_fallAcceleration; + actor->_fallPosition += actor->_fallVelocity; + actor->_location.z = actor->_fallPosition >> 4; } else { - actor->location = actor->finalTarget; - actor->currentAction = kActionFreeze; + actor->_location = actor->_finalTarget; + actor->_currentAction = kActionFreeze; _vm->_script->wakeUpActorThread(kWaitTypeWalk, actor); } break; case kActionClimb: - actor->cycleDelay++; - if (actor->cycleDelay & 3) { + actor->_cycleDelay++; + if (actor->_cycleDelay & 3) { break; } - if (actor->location.z >= actor->finalTarget.z + ACTOR_CLIMB_SPEED) { - actor->location.z -= ACTOR_CLIMB_SPEED; - actor->actionCycle--; - } else if (actor->location.z <= actor->finalTarget.z - ACTOR_CLIMB_SPEED) { - actor->location.z += ACTOR_CLIMB_SPEED; - actor->actionCycle++; + if (actor->_location.z >= actor->_finalTarget.z + ACTOR_CLIMB_SPEED) { + actor->_location.z -= ACTOR_CLIMB_SPEED; + actor->_actionCycle--; + } else if (actor->_location.z <= actor->_finalTarget.z - ACTOR_CLIMB_SPEED) { + actor->_location.z += ACTOR_CLIMB_SPEED; + actor->_actionCycle++; } else { - actor->location.z = actor->finalTarget.z; - actor->currentAction = kActionFreeze; + actor->_location.z = actor->_finalTarget.z; + actor->_currentAction = kActionFreeze; _vm->_script->wakeUpActorThread(kWaitTypeWalk, actor); } - frameRange = getActorFrameRange(actor->id, actor->cycleFrameSequence); + frameRange = getActorFrameRange(actor->_id, actor->_cycleFrameSequence); - if (actor->actionCycle < 0) { - actor->actionCycle = frameRange->frameCount - 1; + if (actor->_actionCycle < 0) { + actor->_actionCycle = frameRange->frameCount - 1; } actor->cycleWrap(frameRange->frameCount); - actor->frameNumber = frameRange->frameIndex + actor->actionCycle; + actor->_frameNumber = frameRange->frameIndex + actor->_actionCycle; break; } - if ((actor->currentAction >= kActionWalkToPoint) && (actor->currentAction <= kActionWalkDir)) { + if ((actor->_currentAction >= kActionWalkToPoint) && (actor->_currentAction <= kActionWalkDir)) { hitZone = NULL; if (_vm->_scene->getFlags() & kSceneFlagISO) { - actor->location.toScreenPointUV(hitPoint); + actor->_location.toScreenPointUV(hitPoint); } else { - actor->location.toScreenPointXY(hitPoint); + actor->_location.toScreenPointXY(hitPoint); } hitZoneIndex = _vm->_scene->_actionMap->hitTest(hitPoint); if (hitZoneIndex != -1) { hitZone = _vm->_scene->_actionMap->getHitZone(hitZoneIndex); } - if (hitZone != actor->lastZone) { - if (actor->lastZone) - stepZoneAction( actor, actor->lastZone, true, false); - actor->lastZone = hitZone; + if (hitZone != actor->_lastZone) { + if (actor->_lastZone) + stepZoneAction( actor, actor->_lastZone, true, false); + actor->_lastZone = hitZone; if (hitZone) stepZoneAction( actor, hitZone, false, false); } @@ -1433,32 +1430,32 @@ bool Actor::calcScreenPosition(CommonObjectData *commonObjectData) { int beginSlope, endSlope, middle; bool result; if (_vm->_scene->getFlags() & kSceneFlagISO) { - _vm->_isoMap->tileCoordsToScreenPoint(commonObjectData->location, commonObjectData->screenPosition); - commonObjectData->screenScale = 256; + _vm->_isoMap->tileCoordsToScreenPoint(commonObjectData->_location, commonObjectData->_screenPosition); + commonObjectData->_screenScale = 256; } else { - middle = _vm->getSceneHeight() - commonObjectData->location.y / ACTOR_LMULT; + middle = _vm->getSceneHeight() - commonObjectData->_location.y / ACTOR_LMULT; _vm->_scene->getSlopes(beginSlope, endSlope); - commonObjectData->screenDepth = (14 * middle) / endSlope + 1; + commonObjectData->_screenDepth = (14 * middle) / endSlope + 1; if (middle <= beginSlope) { - commonObjectData->screenScale = 256; + commonObjectData->_screenScale = 256; } else if (middle >= endSlope) { - commonObjectData->screenScale = 1; + commonObjectData->_screenScale = 1; } else { middle -= beginSlope; endSlope -= beginSlope; - commonObjectData->screenScale = 256 - (middle * 256) / endSlope; + commonObjectData->_screenScale = 256 - (middle * 256) / endSlope; } - commonObjectData->location.toScreenPointXYZ(commonObjectData->screenPosition); + commonObjectData->_location.toScreenPointXYZ(commonObjectData->_screenPosition); } - result = commonObjectData->screenPosition.x > -64 && - commonObjectData->screenPosition.x < _vm->getDisplayWidth() + 64 && - commonObjectData->screenPosition.y > -64 && - commonObjectData->screenPosition.y < _vm->getSceneHeight() + 64; + result = commonObjectData->_screenPosition.x > -64 && + commonObjectData->_screenPosition.x < _vm->getDisplayWidth() + 64 && + commonObjectData->_screenPosition.y > -64 && + commonObjectData->_screenPosition.y < _vm->getSceneHeight() + 64; return result; } @@ -1489,8 +1486,8 @@ uint16 Actor::hitTest(const Point &testPoint, bool skipProtagonist) { if (!getSpriteParams(drawObject, frameNumber, spriteList)) { continue; } - if (_vm->_sprite->hitTest(*spriteList, frameNumber, drawObject->screenPosition, drawObject->screenScale, testPoint)) { - return drawObject->id; + if (_vm->_sprite->hitTest(*spriteList, frameNumber, drawObject->_screenPosition, drawObject->_screenScale, testPoint)) { + return drawObject->_id; } } return ID_NOTHING; @@ -1511,7 +1508,7 @@ void Actor::createDrawOrderList() { _drawOrderList.clear(); for (i = 0; i < _actorsCount; i++) { actor = _actors[i]; - if (!actor->inScene) + if (!actor->_inScene) continue; if (calcScreenPosition(actor)) { @@ -1521,10 +1518,10 @@ void Actor::createDrawOrderList() { for (i = 0; i < _objsCount; i++) { obj = _objs[i]; - if (obj->disabled) + if (obj->_disabled) continue; - if (obj->sceneNumber != _vm->_scene->currentSceneNumber()) + if (obj->_sceneNumber != _vm->_scene->currentSceneNumber()) continue; if (calcScreenPosition(obj)) { @@ -1535,22 +1532,22 @@ void Actor::createDrawOrderList() { bool Actor::getSpriteParams(CommonObjectData *commonObjectData, int &frameNumber, SpriteList *&spriteList) { if (_vm->_scene->currentSceneResourceId() == RID_ITE_OVERMAP_SCENE) { - if (!(commonObjectData->flags & kProtagonist)){ + if (!(commonObjectData->_flags & kProtagonist)){ // warning("not protagonist"); return false; } frameNumber = 8; spriteList = &_vm->_sprite->_mainSprites; - } else if (validActorId(commonObjectData->id)) { - spriteList = &((ActorData *)commonObjectData)->spriteList; - frameNumber = ((ActorData *)commonObjectData)->frameNumber; - } else if (validObjId(commonObjectData->id)) { + } else if (validActorId(commonObjectData->_id)) { + spriteList = &((ActorData *)commonObjectData)->_spriteList; + frameNumber = ((ActorData *)commonObjectData)->_frameNumber; + } else if (validObjId(commonObjectData->_id)) { spriteList = &_vm->_sprite->_mainSprites; - frameNumber = commonObjectData->spriteListResourceId; + frameNumber = commonObjectData->_spriteListResourceId; } if ((frameNumber < 0) || (spriteList->spriteCount <= frameNumber)) { - warning("Actor::getSpriteParams frameNumber invalid for object id 0x%X (%d)", commonObjectData->id, frameNumber); + warning("Actor::getSpriteParams frameNumber invalid for object id 0x%X (%d)", commonObjectData->_id, frameNumber); return false; } return true; @@ -1584,9 +1581,9 @@ void Actor::drawActors() { } if (_vm->_scene->getFlags() & kSceneFlagISO) { - _vm->_isoMap->drawSprite(backBuffer, *spriteList, frameNumber, drawObject->location, drawObject->screenPosition, drawObject->screenScale); + _vm->_isoMap->drawSprite(backBuffer, *spriteList, frameNumber, drawObject->_location, drawObject->_screenPosition, drawObject->_screenScale); } else { - _vm->_sprite->drawOccluded(backBuffer, _vm->_scene->getSceneClip(),*spriteList, frameNumber, drawObject->screenPosition, drawObject->screenScale, drawObject->screenDepth); + _vm->_sprite->drawOccluded(backBuffer, _vm->_scene->getSceneClip(),*spriteList, frameNumber, drawObject->_screenPosition, drawObject->_screenScale, drawObject->_screenDepth); } } @@ -1623,8 +1620,8 @@ void Actor::drawSpeech(void) { actor = getActor(_activeSpeech.actorIds[i]); calcScreenPosition(actor); - textPoint.x = clamp( 10, actor->screenPosition.x - width / 2, _vm->getDisplayWidth() - 10 - width); - textPoint.y = clamp( 10, actor->screenPosition.y - 58, _vm->getSceneHeight() - 10 - height); + textPoint.x = clamp( 10, actor->_screenPosition.x - width / 2, _vm->getDisplayWidth() - 10 - width); + textPoint.y = clamp( 10, actor->_screenPosition.y - 58, _vm->getSceneHeight() - 10 - height); _vm->_font->textDraw(kMediumFont, backBuffer, _activeSpeech.strings[0], textPoint, _activeSpeech.speechColor[i], _activeSpeech.outlineColor[i], _activeSpeech.getFontFlags(i)); @@ -1650,8 +1647,8 @@ bool Actor::followProtagonist(ActorData *actor) { assert(_protagonist); - actor->flags &= ~(kFaster | kFastest); - protagonistLocation = _protagonist->location; + actor->_flags &= ~(kFaster | kFastest); + protagonistLocation = _protagonist->_location; calcScreenPosition(_protagonist); if (_vm->_scene->getFlags() & kSceneFlagISO) { @@ -1659,19 +1656,19 @@ bool Actor::followProtagonist(ActorData *actor) { prefV = 60; - actor->location.delta(protagonistLocation, delta); + actor->_location.delta(protagonistLocation, delta); - if (actor->id == actorIndexToId(2)) { + if (actor->_id == actorIndexToId(2)) { prefU = prefV = 48; } if ((delta.u() > prefU) || (delta.u() < -prefU) || (delta.v() > prefV) || (delta.v() < -prefV)) { if ((delta.u() > prefU * 2) || (delta.u() < -prefU * 2) || (delta.v() > prefV * 2) || (delta.v() < -prefV * 2)) { - actor->flags |= kFaster; + actor->_flags |= kFaster; if ((delta.u() > prefU * 3) || (delta.u() < -prefU*3) || (delta.v() > prefV * 3) || (delta.v() < -prefV * 3)) { - actor->flags |= kFastest; + actor->_flags |= kFastest; } } @@ -1685,14 +1682,14 @@ bool Actor::followProtagonist(ActorData *actor) { newLocation.v() = newV + _vm->_rnd.getRandomNumber(prefV - 1) - prefV / 2; newLocation.z = 0; - return actorWalkTo(actor->id, newLocation); + return actorWalkTo(actor->_id, newLocation); } } else { - prefer1.x = (100 * _protagonist->screenScale) >> 8; - prefer1.y = (50 * _protagonist->screenScale) >> 8; + prefer1.x = (100 * _protagonist->_screenScale) >> 8; + prefer1.y = (50 * _protagonist->_screenScale) >> 8; - if (_protagonist->currentAction == kActionWalkDir) { + if (_protagonist->_currentAction == kActionWalkDir) { prefer1.x /= 2; } @@ -1709,23 +1706,23 @@ bool Actor::followProtagonist(ActorData *actor) { prefer3.x = prefer1.x + prefer1.x / 2; prefer3.y = prefer1.y + prefer1.y / 2; - actor->location.delta(protagonistLocation, delta); + actor->_location.delta(protagonistLocation, delta); protagonistBGMaskType = 0; - if (_vm->_scene->isBGMaskPresent() && _vm->_scene->validBGMaskPoint(_protagonist->screenPosition)) { - protagonistBGMaskType = _vm->_scene->getBGMaskType(_protagonist->screenPosition); + if (_vm->_scene->isBGMaskPresent() && _vm->_scene->validBGMaskPoint(_protagonist->_screenPosition)) { + protagonistBGMaskType = _vm->_scene->getBGMaskType(_protagonist->_screenPosition); } if ((_vm->_rnd.getRandomNumber(7) & 0x7) == 0) // 1/8th chance - actor->actorFlags &= ~kActorNoFollow; + actor->_actorFlags &= ~kActorNoFollow; - if (actor->actorFlags & kActorNoFollow) { + if (actor->_actorFlags & kActorNoFollow) { return false; } if ((delta.x > prefer2.x) || (delta.x < -prefer2.x) || (delta.y > prefer2.y) || (delta.y < -prefer2.y) || - ((_protagonist->currentAction == kActionWait) && + ((_protagonist->_currentAction == kActionWait) && (delta.x * 2 < prefer1.x) && (delta.x * 2 > -prefer1.x) && (delta.y < prefer1.y) && (delta.y > -prefer1.y))) { @@ -1750,7 +1747,7 @@ bool Actor::followProtagonist(ActorData *actor) { newLocation.x = clamp(-31*4, newLocation.x, (_vm->getDisplayWidth() + 31) * 4); //fixme - return actorWalkTo(actor->id, newLocation); + return actorWalkTo(actor->_id, newLocation); } } return false; @@ -1764,25 +1761,25 @@ bool Actor::actorEndWalk(uint16 actorId, bool recurse) { Point testPoint; actor = getActor(actorId); - actor->actorFlags &= ~kActorBackwards; + actor->_actorFlags &= ~kActorBackwards; - if (actor->location.distance(actor->finalTarget) > 8 && (actor->flags & kProtagonist) && recurse && !(actor->actorFlags & kActorNoCollide)) { - actor->actorFlags |= kActorNoCollide; - return actorWalkTo(actorId, actor->finalTarget); + if (actor->_location.distance(actor->_finalTarget) > 8 && (actor->_flags & kProtagonist) && recurse && !(actor->_actorFlags & kActorNoCollide)) { + actor->_actorFlags |= kActorNoCollide; + return actorWalkTo(actorId, actor->_finalTarget); } - actor->currentAction = kActionWait; - if (actor->actorFlags & kActorFinalFace) { - actor->facingDirection = actor->actionDirection = (actor->actorFlags >> 6) & 0x07; //? + actor->_currentAction = kActionWait; + if (actor->_actorFlags & kActorFinalFace) { + actor->_facingDirection = actor->_actionDirection = (actor->_actorFlags >> 6) & 0x07; //? } - actor->actorFlags &= ~(kActorNoCollide | kActorCollided | kActorFinalFace | kActorFacingMask); - actor->flags &= ~(kFaster | kFastest); + actor->_actorFlags &= ~(kActorNoCollide | kActorCollided | kActorFinalFace | kActorFacingMask); + actor->_flags &= ~(kFaster | kFastest); if (actor == _protagonist) { _vm->_script->wakeUpActorThread(kWaitTypeWalk, actor); if (_vm->_script->_pendingVerb == kVerbWalkTo) { - actor->location.toScreenPointUV(testPoint); + actor->_location.toScreenPointUV(testPoint); hitZoneIndex = _vm->_scene->_actionMap->hitTest(testPoint); if (hitZoneIndex != -1) { hitZone = _vm->_scene->_actionMap->getHitZone(hitZoneIndex); @@ -1794,7 +1791,7 @@ bool Actor::actorEndWalk(uint16 actorId, bool recurse) { _vm->_script->doVerb(); } } else { - if (recurse && (actor->flags & kFollower)) + if (recurse && (actor->_flags & kFollower)) walkMore = followProtagonist(actor); _vm->_script->wakeUpActorThread(kWaitTypeWalk, actor); @@ -1829,31 +1826,31 @@ bool Actor::actorWalkTo(uint16 actorId, const Location &toLocation) { if (_vm->_scene->getFlags() & kSceneFlagISO) { - if ((_vm->getGameType() == GType_ITE) && (actor->index == ACTOR_DRAGON_INDEX)) { + if ((_vm->getGameType() == GType_ITE) && (actor->_index == ACTOR_DRAGON_INDEX)) { return false; } - actor->finalTarget = toLocation; - actor->walkStepsCount = 0; - _vm->_isoMap->findTilePath(actor, actor->location, toLocation); + actor->_finalTarget = toLocation; + actor->_walkStepsCount = 0; + _vm->_isoMap->findTilePath(actor, actor->_location, toLocation); - if ((actor->walkStepsCount == 0) && (actor->flags & kProtagonist)) { - actor->actorFlags |= kActorNoCollide; - _vm->_isoMap->findTilePath(actor, actor->location, toLocation); + if ((actor->_walkStepsCount == 0) && (actor->_flags & kProtagonist)) { + actor->_actorFlags |= kActorNoCollide; + _vm->_isoMap->findTilePath(actor, actor->_location, toLocation); } - actor->walkStepIndex = 0; + actor->_walkStepIndex = 0; if (_vm->_isoMap->nextTileTarget(actor)) { - actor->currentAction = kActionWalkToPoint; - actor->walkFrameSequence = kFrameWalk; + actor->_currentAction = kActionWalkToPoint; + actor->_walkFrameSequence = kFrameWalk; } else { actorEndWalk( actorId, false); return false; } } else { - actor->location.toScreenPointXY(pointFrom); + actor->_location.toScreenPointXY(pointFrom); pointFrom.x &= ~1; extraStartNode = _vm->_scene->offscreenPath(pointFrom); @@ -1865,8 +1862,8 @@ bool Actor::actorWalkTo(uint16 actorId, const Location &toLocation) { if (_vm->_scene->isBGMaskPresent()) { - if ((((actor->currentAction >= kActionWalkToPoint) && - (actor->currentAction <= kActionWalkDir)) || (actor == _protagonist)) && + if ((((actor->_currentAction >= kActionWalkToPoint) && + (actor->_currentAction <= kActionWalkDir)) || (actor == _protagonist)) && !_vm->_scene->canWalk(pointFrom)) { for (i = 1; i < 8; i++) { pointAdd = pointFrom; @@ -1896,19 +1893,19 @@ bool Actor::actorWalkTo(uint16 actorId, const Location &toLocation) { } } - if (!(actor->actorFlags & kActorNoCollide)) { - collision.x = ACTOR_COLLISION_WIDTH * actor->screenScale / (256 * 2); - collision.y = ACTOR_COLLISION_HEIGHT * actor->screenScale / (256 * 2); + if (!(actor->_actorFlags & kActorNoCollide)) { + collision.x = ACTOR_COLLISION_WIDTH * actor->_screenScale / (256 * 2); + collision.y = ACTOR_COLLISION_HEIGHT * actor->_screenScale / (256 * 2); _barrierCount = 0; for (i = 0; (i < _actorsCount) && (_barrierCount < ACTOR_BARRIERS_MAX); i++) { anotherActor = _actors[i]; - if (!anotherActor->inScene) continue; + if (!anotherActor->_inScene) continue; if (anotherActor == actor ) continue; - anotherActorScreenPosition = anotherActor->screenPosition; + anotherActorScreenPosition = anotherActor->_screenPosition; testBox.left = (anotherActorScreenPosition.x - collision.x) & ~1; testBox.right = (anotherActorScreenPosition.x + collision.x) & ~1 + 1; testBox.top = anotherActorScreenPosition.y - collision.y; @@ -1939,27 +1936,27 @@ bool Actor::actorWalkTo(uint16 actorId, const Location &toLocation) { pointBest = pointTo; - actor->walkStepsCount = 0; + actor->_walkStepsCount = 0; findActorPath(actor, pointFrom, pointTo); - if (actor->walkStepsCount == 0) { - error("actor->walkStepsCount == 0"); + if (actor->_walkStepsCount == 0) { + error("actor->_walkStepsCount == 0"); } if (extraStartNode) { - actor->walkStepIndex = 0; + actor->_walkStepIndex = 0; } else { - actor->walkStepIndex = 1; + actor->_walkStepIndex = 1; } if (extraEndNode) { toLocation.toScreenPointXY(tempPoint); - actor->walkStepsCount--; + actor->_walkStepsCount--; actor->addWalkStepPoint(tempPoint); } - pointBest = actor->walkStepsPoints[actor->walkStepsCount - 1]; + pointBest = actor->_walkStepsPoints[actor->_walkStepsCount - 1]; delta.x = ABS(pointFrom.x - pointTo.x); delta.y = ABS(pointFrom.y - pointTo.y); @@ -1967,31 +1964,31 @@ bool Actor::actorWalkTo(uint16 actorId, const Location &toLocation) { bestDelta.x = ABS(pointBest.x - pointTo.x); bestDelta.y = ABS(pointBest.y - pointTo.y); - if (delta.x + delta.y <= bestDelta.x + bestDelta.y && (actor->flags & kFollower)) { - actor->actorFlags |= kActorNoFollow; + if (delta.x + delta.y <= bestDelta.x + bestDelta.y && (actor->_flags & kFollower)) { + actor->_actorFlags |= kActorNoFollow; } if (pointBest == pointFrom) { - actor->walkStepsCount = 0; + actor->_walkStepsCount = 0; } } else { - actor->walkStepsCount = 0; + actor->_walkStepsCount = 0; actor->addWalkStepPoint(pointTo); - actor->walkStepIndex = 0; + actor->_walkStepIndex = 0; } - actor->partialTarget = actor->location; - actor->finalTarget = toLocation; - if (actor->walkStepsCount == 0) { + actor->_partialTarget = actor->_location; + actor->_finalTarget = toLocation; + if (actor->_walkStepsCount == 0) { actorEndWalk(actorId, false); return false; } else { - if (actor->flags & kProtagonist) { - _actors[1]->actorFlags &= ~kActorNoFollow; // TODO: mark all actors with kFollower flag, not only 1 and 2 - _actors[2]->actorFlags &= ~kActorNoFollow; + if (actor->_flags & kProtagonist) { + _actors[1]->_actorFlags &= ~kActorNoFollow; // TODO: mark all actors with kFollower flag, not only 1 and 2 + _actors[2]->_actorFlags &= ~kActorNoFollow; } - actor->currentAction = (actor->walkStepsCount >= ACTOR_MAX_STEPS_COUNT) ? kActionWalkToLink : kActionWalkToPoint; - actor->walkFrameSequence = kFrameWalk; + actor->_currentAction = (actor->_walkStepsCount >= ACTOR_MAX_STEPS_COUNT) ? kActionWalkToLink : kActionWalkToPoint; + actor->_walkFrameSequence = kFrameWalk; } } @@ -2013,17 +2010,17 @@ void Actor::actorSpeech(uint16 actorId, const char **strings, int stringsCount, _activeSpeech.speechFlags = speechFlags; _activeSpeech.actorsCount = 1; _activeSpeech.actorIds[0] = actorId; - _activeSpeech.speechColor[0] = actor->speechColor; + _activeSpeech.speechColor[0] = actor->_speechColor; _activeSpeech.outlineColor[0] = kITEColorBlack; _activeSpeech.sampleResourceId = sampleResourceId; _activeSpeech.playing = false; _activeSpeech.slowModeCharIndex = 0; - dist = MIN(actor->screenPosition.x - 10, _vm->getDisplayWidth() - 10 - actor->screenPosition.x ); + dist = MIN(actor->_screenPosition.x - 10, _vm->getDisplayWidth() - 10 - actor->_screenPosition.x ); dist = clamp( 60, dist, 150 ); - _activeSpeech.speechBox.left = actor->screenPosition.x - dist; - _activeSpeech.speechBox.right = actor->screenPosition.x + dist; + _activeSpeech.speechBox.left = actor->_screenPosition.x - dist; + _activeSpeech.speechBox.right = actor->_screenPosition.x + dist; if (_activeSpeech.speechBox.left < 10) { _activeSpeech.speechBox.right += 10 - _activeSpeech.speechBox.left; @@ -2061,7 +2058,7 @@ void Actor::simulSpeech(const char *string, uint16 *actorIds, int actorIdsCount, actor = getActor(actorIds[i]); _activeSpeech.actorIds[i] = actorIds[i]; - _activeSpeech.speechColor[i] = actor->speechColor; + _activeSpeech.speechColor[i] = actor->_speechColor; _activeSpeech.outlineColor[i] = 0; // disable outline } _activeSpeech.actorsCount = actorIdsCount; @@ -2096,12 +2093,12 @@ void Actor::moveDragon(ActorData *actor) { Event event; const DragonMove *dragonMove; - if ((actor->actionCycle < 0) || - ((actor->actionCycle == 0) && (actor->dragonMoveType >= ACTOR_DRAGON_TURN_MOVES))) { + if ((actor->_actionCycle < 0) || + ((actor->_actionCycle == 0) && (actor->_dragonMoveType >= ACTOR_DRAGON_TURN_MOVES))) { moveType = kDragonMoveInvalid; - if (actor->location.distance(_protagonist->location) < 24) { - if (_dragonHunt && (_protagonist->currentAction != kActionFall)) { + if (actor->_location.distance(_protagonist->_location) < 24) { + if (_dragonHunt && (_protagonist->_currentAction != kActionFall)) { event.type = ONESHOT_EVENT; event.code = SCRIPT_EVENT; event.op = EVENT_EXEC_NONBLOCKING; @@ -2120,216 +2117,216 @@ void Actor::moveDragon(ActorData *actor) { _dragonHunt = true; } - if (actor->walkStepIndex + 2 > actor->walkStepsCount) { + if (actor->_walkStepIndex + 2 > actor->_walkStepsCount) { - _vm->_isoMap->findDragonTilePath(actor, actor->location, _protagonist->location, actor->actionDirection); + _vm->_isoMap->findDragonTilePath(actor, actor->_location, _protagonist->_location, actor->_actionDirection); - if (actor->walkStepsCount == 0) { - _vm->_isoMap->findDragonTilePath(actor, actor->location, _protagonist->location, 0); + if (actor->_walkStepsCount == 0) { + _vm->_isoMap->findDragonTilePath(actor, actor->_location, _protagonist->_location, 0); } - if (actor->walkStepsCount < 2) { + if (actor->_walkStepsCount < 2) { return; } - actor->partialTarget = actor->location; - actor->finalTarget = _protagonist->location; - actor->walkStepIndex = 0; + actor->_partialTarget = actor->_location; + actor->_finalTarget = _protagonist->_location; + actor->_walkStepIndex = 0; } - dir0 = actor->actionDirection; - dir1 = actor->tileDirections[actor->walkStepIndex++]; - dir2 = actor->tileDirections[actor->walkStepIndex]; - dir3 = actor->tileDirections[actor->walkStepIndex + 1]; + dir0 = actor->_actionDirection; + dir1 = actor->_tileDirections[actor->_walkStepIndex++]; + dir2 = actor->_tileDirections[actor->_walkStepIndex]; + dir3 = actor->_tileDirections[actor->_walkStepIndex + 1]; if (dir0 != dir1){ - actor->actionDirection = dir0 = dir1; + actor->_actionDirection = dir0 = dir1; } - actor->location = actor->partialTarget; + actor->_location = actor->_partialTarget; if ((dir1 != dir2) && (dir1 == dir3)) { switch (dir1) { case kDirUpLeft: - actor->partialTarget.v() += 16; + actor->_partialTarget.v() += 16; moveType = kDragonMoveUpLeft; break; case kDirDownLeft: - actor->partialTarget.u() -= 16; + actor->_partialTarget.u() -= 16; moveType = kDragonMoveDownLeft; break; case kDirDownRight: - actor->partialTarget.v() -= 16; + actor->_partialTarget.v() -= 16; moveType = kDragonMoveDownRight; break; case kDirUpRight: - actor->partialTarget.u() += 16; + actor->_partialTarget.u() += 16; moveType = kDragonMoveUpRight; break; } switch (dir2) { case kDirUpLeft: - actor->partialTarget.v() += 16; + actor->_partialTarget.v() += 16; break; case kDirDownLeft: - actor->partialTarget.u() -= 16; + actor->_partialTarget.u() -= 16; break; case kDirDownRight: - actor->partialTarget.v() -= 16; + actor->_partialTarget.v() -= 16; break; case kDirUpRight: - actor->partialTarget.u() += 16; + actor->_partialTarget.u() += 16; break; } - actor->walkStepIndex++; + actor->_walkStepIndex++; } else { switch (dir1) { case kDirUpLeft: - actor->partialTarget.v() += 16; + actor->_partialTarget.v() += 16; switch (dir2) { case kDirDownLeft: moveType = kDragonMoveUpLeft_Left; - actor->partialTarget.u() -= 16; + actor->_partialTarget.u() -= 16; break; case kDirUpLeft: moveType = kDragonMoveUpLeft; break; case kDirUpRight: - actor->partialTarget.u() += 16; + actor->_partialTarget.u() += 16; moveType = kDragonMoveUpLeft_Right; break; default: - actor->actionDirection = dir1; - actor->walkStepsCount = 0; + actor->_actionDirection = dir1; + actor->_walkStepsCount = 0; break; } break; case kDirDownLeft: - actor->partialTarget.u() -= 16; + actor->_partialTarget.u() -= 16; switch (dir2) { case kDirDownRight: moveType = kDragonMoveDownLeft_Left; - actor->partialTarget.v() -= 16; + actor->_partialTarget.v() -= 16; break; case kDirDownLeft: moveType = kDragonMoveDownLeft; break; case kDirUpLeft: moveType = kDragonMoveDownLeft_Right; - actor->partialTarget.v() += 16; + actor->_partialTarget.v() += 16; break; default: - actor->actionDirection = dir1; - actor->walkStepsCount = 0; + actor->_actionDirection = dir1; + actor->_walkStepsCount = 0; break; } break; case kDirDownRight: - actor->partialTarget.v() -= 16; + actor->_partialTarget.v() -= 16; switch (dir2) { case kDirUpRight: moveType = kDragonMoveDownRight_Left; - actor->partialTarget.u() += 16; + actor->_partialTarget.u() += 16; break; case kDirDownRight: moveType = kDragonMoveDownRight; break; case kDirDownLeft: moveType = kDragonMoveDownRight_Right; - actor->partialTarget.u() -= 16; + actor->_partialTarget.u() -= 16; break; default: - actor->actionDirection = dir1; - actor->walkStepsCount = 0; + actor->_actionDirection = dir1; + actor->_walkStepsCount = 0; break; } break; case kDirUpRight: - actor->partialTarget.u() += 16; + actor->_partialTarget.u() += 16; switch (dir2) { case kDirUpLeft: moveType = kDragonMoveUpRight_Left; - actor->partialTarget.v() += 16; + actor->_partialTarget.v() += 16; break; case kDirUpRight: moveType = kDragonMoveUpRight; break; case kDirDownRight: moveType = kDragonMoveUpRight_Right; - actor->partialTarget.v() -= 16; + actor->_partialTarget.v() -= 16; break; default: - actor->actionDirection = dir1; - actor->walkStepsCount = 0; + actor->_actionDirection = dir1; + actor->_walkStepsCount = 0; break; } break; default: - actor->actionDirection = dir1; - actor->walkStepsCount = 0; + actor->_actionDirection = dir1; + actor->_walkStepsCount = 0; break; } } - actor->dragonMoveType = moveType; + actor->_dragonMoveType = moveType; if (moveType >= ACTOR_DRAGON_TURN_MOVES) { - actor->dragonStepCycle = 0; - actor->actionCycle = 4; - actor->walkStepIndex++; + actor->_dragonStepCycle = 0; + actor->_actionCycle = 4; + actor->_walkStepIndex++; } else { - actor->actionCycle = 4; + actor->_actionCycle = 4; } } - actor->actionCycle--; + actor->_actionCycle--; - if ((actor->walkStepsCount < 1) || (actor->actionCycle < 0)) { + if ((actor->_walkStepsCount < 1) || (actor->_actionCycle < 0)) { return; } - if (actor->dragonMoveType < ACTOR_DRAGON_TURN_MOVES) { + if (actor->_dragonMoveType < ACTOR_DRAGON_TURN_MOVES) { - actor->dragonStepCycle++; - if (actor->dragonStepCycle >= 7) { - actor->dragonStepCycle = 0; + actor->_dragonStepCycle++; + if (actor->_dragonStepCycle >= 7) { + actor->_dragonStepCycle = 0; } - actor->dragonBaseFrame = actor->dragonMoveType * 7; + actor->_dragonBaseFrame = actor->_dragonMoveType * 7; - if (actor->location.u() > actor->partialTarget.u() + 3) { - actor->location.u() -= 4; - } else if (actor->location.u() < actor->partialTarget.u() - 3) { - actor->location.u() += 4; + if (actor->_location.u() > actor->_partialTarget.u() + 3) { + actor->_location.u() -= 4; + } else if (actor->_location.u() < actor->_partialTarget.u() - 3) { + actor->_location.u() += 4; } else { - actor->location.u() = actor->partialTarget.u(); + actor->_location.u() = actor->_partialTarget.u(); } - if (actor->location.v() > actor->partialTarget.v() + 3) { - actor->location.v() -= 4; - } else if (actor->location.v() < actor->partialTarget.v() - 3) { - actor->location.v() += 4; + if (actor->_location.v() > actor->_partialTarget.v() + 3) { + actor->_location.v() -= 4; + } else if (actor->_location.v() < actor->_partialTarget.v() - 3) { + actor->_location.v() += 4; } else { - actor->location.v() = actor->partialTarget.v(); + actor->_location.v() = actor->_partialTarget.v(); } } else { - dragonMove = &dragonMoveTable[actor->dragonMoveType]; - actor->dragonBaseFrame = dragonMove->baseFrame; + dragonMove = &dragonMoveTable[actor->_dragonMoveType]; + actor->_dragonBaseFrame = dragonMove->baseFrame; - actor->location.u() = actor->partialTarget.u() - dragonMove->offset[actor->actionCycle][0]; - actor->location.v() = actor->partialTarget.v() - dragonMove->offset[actor->actionCycle][1]; + actor->_location.u() = actor->_partialTarget.u() - dragonMove->offset[actor->_actionCycle][0]; + actor->_location.v() = actor->_partialTarget.v() - dragonMove->offset[actor->_actionCycle][1]; - actor->dragonStepCycle++; - if (actor->dragonStepCycle >= 3) { - actor->dragonStepCycle = 3; + actor->_dragonStepCycle++; + if (actor->_dragonStepCycle >= 3) { + actor->_dragonStepCycle = 3; } } - actor->frameNumber = actor->dragonBaseFrame + actor->dragonStepCycle; + actor->_frameNumber = actor->_dragonBaseFrame + actor->_dragonStepCycle; } void Actor::findActorPath(ActorData *actor, const Point &fromPoint, const Point &toPoint) { @@ -2343,7 +2340,7 @@ void Actor::findActorPath(ActorData *actor, const Point &fromPoint, const Point _debugPointsCount = 0; #endif - actor->walkStepsCount = 0; + actor->_walkStepsCount = 0; if (fromPoint == toPoint) { actor->addWalkStepPoint(toPoint); return; diff --git a/saga/actor.h b/saga/actor.h index 901b581a0c..cf3eff9530 100644 --- a/saga/actor.h +++ b/saga/actor.h @@ -239,43 +239,43 @@ struct Location { class CommonObjectData { public: //constant - bool disabled; // disabled in init section - int32 index; // index in local array - uint16 id; // object id - int32 scriptEntrypointNumber; // script entrypoint number + bool _disabled; // disabled in init section + int32 _index; // index in local array + uint16 _id; // object id + int32 _scriptEntrypointNumber; // script entrypoint number //variables - uint16 flags; // initial flags - int32 nameIndex; // index in name string list - int32 sceneNumber; // scene - int32 spriteListResourceId; // sprite list resource id - - Location location; // logical coordinates - Point screenPosition; // screen coordinates - int32 screenDepth; // - int32 screenScale; // + uint16 _flags; // initial flags + int32 _nameIndex; // index in name string list + int32 _sceneNumber; // scene + int32 _spriteListResourceId; // sprite list resource id + + Location _location; // logical coordinates + Point _screenPosition; // screen coordinates + int32 _screenDepth; // + int32 _screenScale; // void saveState(Common::OutSaveFile *out) { - out->writeUint16LE(flags); - out->writeSint32LE(nameIndex); - out->writeSint32LE(sceneNumber); - out->writeSint32LE(spriteListResourceId); - location.saveState(out); - out->writeSint16LE(screenPosition.x); - out->writeSint16LE(screenPosition.y); - out->writeSint32LE(screenDepth); - out->writeSint32LE(screenScale); + out->writeUint16LE(_flags); + out->writeSint32LE(_nameIndex); + out->writeSint32LE(_sceneNumber); + out->writeSint32LE(_spriteListResourceId); + _location.saveState(out); + out->writeSint16LE(_screenPosition.x); + out->writeSint16LE(_screenPosition.y); + out->writeSint32LE(_screenDepth); + out->writeSint32LE(_screenScale); } void loadState(Common::InSaveFile *in) { - flags = in->readUint16LE(); - nameIndex = in->readSint32LE(); - sceneNumber = in->readSint32LE(); - spriteListResourceId = in->readSint32LE(); - location.loadState(in); - screenPosition.x = in->readSint16LE(); - screenPosition.y = in->readSint16LE(); - screenDepth = in->readSint32LE(); - screenScale = in->readSint32LE(); + _flags = in->readUint16LE(); + _nameIndex = in->readSint32LE(); + _sceneNumber = in->readSint32LE(); + _spriteListResourceId = in->readSint32LE(); + _location.loadState(in); + _screenPosition.x = in->readSint16LE(); + _screenPosition.y = in->readSint16LE(); + _screenDepth = in->readSint32LE(); + _screenScale = in->readSint32LE(); } }; @@ -286,7 +286,7 @@ typedef SortedList<CommonObjectDataPointer> CommonObjectOrderList; class ObjectData: public CommonObjectData { public: //constant - uint16 interactBits; + uint16 _interactBits; ObjectData() { memset(this, 0, sizeof(*this)); } @@ -295,179 +295,179 @@ public: class ActorData: public CommonObjectData { public: //constant - SpriteList spriteList; // sprite list data + SpriteList _spriteList; // sprite list data - ActorFrameSequence *frames; // Actor's frames - int framesCount; // Actor's frames count - int frameListResourceId; // Actor's frame list resource id + ActorFrameSequence *_frames; // Actor's frames + int _framesCount; // Actor's frames count + int _frameListResourceId; // Actor's frame list resource id - byte speechColor; // Actor dialogue color + byte _speechColor; // Actor dialogue color // - bool inScene; + bool _inScene; //variables - uint16 actorFlags; // dynamic flags - int32 currentAction; // ActorActions type - int32 facingDirection; // orientation - int32 actionDirection; - int32 actionCycle; - uint16 targetObject; - const HitZone *lastZone; + uint16 _actorFlags; // dynamic flags + int32 _currentAction; // ActorActions type + int32 _facingDirection; // orientation + int32 _actionDirection; + int32 _actionCycle; + uint16 _targetObject; + const HitZone *_lastZone; - int32 cycleFrameSequence; - uint8 cycleDelay; - uint8 cycleTimeCount; - uint8 cycleFlags; + int32 _cycleFrameSequence; + uint8 _cycleDelay; + uint8 _cycleTimeCount; + uint8 _cycleFlags; - int16 fallVelocity; - int16 fallAcceleration; - int16 fallPosition; + int16 _fallVelocity; + int16 _fallAcceleration; + int16 _fallPosition; - uint8 dragonBaseFrame; - uint8 dragonStepCycle; - uint8 dragonMoveType; + uint8 _dragonBaseFrame; + uint8 _dragonStepCycle; + uint8 _dragonMoveType; - int32 frameNumber; // current frame number + int32 _frameNumber; // current frame number - int32 tileDirectionsAlloced; - byte *tileDirections; + int32 _tileDirectionsAlloced; + byte *_tileDirections; - int32 walkStepsAlloced; - Point *walkStepsPoints; + int32 _walkStepsAlloced; + Point *_walkStepsPoints; - int32 walkStepsCount; - int32 walkStepIndex; + int32 _walkStepsCount; + int32 _walkStepIndex; - Location finalTarget; - Location partialTarget; - int32 walkFrameSequence; + Location _finalTarget; + Location _partialTarget; + int32 _walkFrameSequence; public: void saveState(Common::OutSaveFile *out) { int i = 0; CommonObjectData::saveState(out); - out->writeUint16LE(actorFlags); - out->writeSint32LE(currentAction); - out->writeSint32LE(facingDirection); - out->writeSint32LE(actionDirection); - out->writeSint32LE(actionCycle); - out->writeUint16LE(targetObject); - - out->writeSint32LE(cycleFrameSequence); - out->writeByte(cycleDelay); - out->writeByte(cycleTimeCount); - out->writeByte(cycleFlags); - out->writeSint16LE(fallVelocity); - out->writeSint16LE(fallAcceleration); - out->writeSint16LE(fallPosition); - out->writeByte(dragonBaseFrame); - out->writeByte(dragonStepCycle); - out->writeByte(dragonMoveType); - out->writeSint32LE(frameNumber); - - out->writeSint32LE(tileDirectionsAlloced); - for (i = 0; i < tileDirectionsAlloced; i++) { - out->writeByte(tileDirections[i]); + out->writeUint16LE(_actorFlags); + out->writeSint32LE(_currentAction); + out->writeSint32LE(_facingDirection); + out->writeSint32LE(_actionDirection); + out->writeSint32LE(_actionCycle); + out->writeUint16LE(_targetObject); + + out->writeSint32LE(_cycleFrameSequence); + out->writeByte(_cycleDelay); + out->writeByte(_cycleTimeCount); + out->writeByte(_cycleFlags); + out->writeSint16LE(_fallVelocity); + out->writeSint16LE(_fallAcceleration); + out->writeSint16LE(_fallPosition); + out->writeByte(_dragonBaseFrame); + out->writeByte(_dragonStepCycle); + out->writeByte(_dragonMoveType); + out->writeSint32LE(_frameNumber); + + out->writeSint32LE(_tileDirectionsAlloced); + for (i = 0; i < _tileDirectionsAlloced; i++) { + out->writeByte(_tileDirections[i]); } - out->writeSint32LE(walkStepsAlloced); - for (i = 0; i < walkStepsAlloced; i++) { - out->writeSint16LE(walkStepsPoints[i].x); - out->writeSint16LE(walkStepsPoints[i].y); + out->writeSint32LE(_walkStepsAlloced); + for (i = 0; i < _walkStepsAlloced; i++) { + out->writeSint16LE(_walkStepsPoints[i].x); + out->writeSint16LE(_walkStepsPoints[i].y); } - out->writeSint32LE(walkStepsCount); - out->writeSint32LE(walkStepIndex); - finalTarget.saveState(out); - partialTarget.saveState(out); - out->writeSint32LE(walkFrameSequence); + out->writeSint32LE(_walkStepsCount); + out->writeSint32LE(_walkStepIndex); + _finalTarget.saveState(out); + _partialTarget.saveState(out); + out->writeSint32LE(_walkFrameSequence); } void loadState(uint32 version, Common::InSaveFile *in) { int i = 0; CommonObjectData::loadState(in); - actorFlags = in->readUint16LE(); - currentAction = in->readSint32LE(); - facingDirection = in->readSint32LE(); - actionDirection = in->readSint32LE(); - actionCycle = in->readSint32LE(); - targetObject = in->readUint16LE(); - - lastZone = NULL; - cycleFrameSequence = in->readSint32LE(); - cycleDelay = in->readByte(); - cycleTimeCount = in->readByte(); - cycleFlags = in->readByte(); + _actorFlags = in->readUint16LE(); + _currentAction = in->readSint32LE(); + _facingDirection = in->readSint32LE(); + _actionDirection = in->readSint32LE(); + _actionCycle = in->readSint32LE(); + _targetObject = in->readUint16LE(); + + _lastZone = NULL; + _cycleFrameSequence = in->readSint32LE(); + _cycleDelay = in->readByte(); + _cycleTimeCount = in->readByte(); + _cycleFlags = in->readByte(); if (version > 1) { - fallVelocity = in->readSint16LE(); - fallAcceleration = in->readSint16LE(); - fallPosition = in->readSint16LE(); + _fallVelocity = in->readSint16LE(); + _fallAcceleration = in->readSint16LE(); + _fallPosition = in->readSint16LE(); } else { - fallVelocity = fallAcceleration = fallPosition = 0; + _fallVelocity = _fallAcceleration = _fallPosition = 0; } if (version > 2) { - dragonBaseFrame = in->readByte(); - dragonStepCycle = in->readByte(); - dragonMoveType = in->readByte(); + _dragonBaseFrame = in->readByte(); + _dragonStepCycle = in->readByte(); + _dragonMoveType = in->readByte(); } else { - dragonBaseFrame = dragonStepCycle = dragonMoveType = 0; + _dragonBaseFrame = _dragonStepCycle = _dragonMoveType = 0; } - frameNumber = in->readSint32LE(); + _frameNumber = in->readSint32LE(); setTileDirectionsSize(in->readSint32LE(), true); - for (i = 0; i < tileDirectionsAlloced; i++) { - tileDirections[i] = in->readByte(); + for (i = 0; i < _tileDirectionsAlloced; i++) { + _tileDirections[i] = in->readByte(); } setWalkStepsPointsSize(in->readSint32LE(), true); - for (i = 0; i < walkStepsAlloced; i++) { - walkStepsPoints[i].x = in->readSint16LE(); - walkStepsPoints[i].y = in->readSint16LE(); + for (i = 0; i < _walkStepsAlloced; i++) { + _walkStepsPoints[i].x = in->readSint16LE(); + _walkStepsPoints[i].y = in->readSint16LE(); } - walkStepsCount = in->readSint32LE(); - walkStepIndex = in->readSint32LE(); - finalTarget.loadState(in); - partialTarget.loadState(in); - walkFrameSequence = in->readSint32LE(); + _walkStepsCount = in->readSint32LE(); + _walkStepIndex = in->readSint32LE(); + _finalTarget.loadState(in); + _partialTarget.loadState(in); + _walkFrameSequence = in->readSint32LE(); } void setTileDirectionsSize(int size, bool forceRealloc) { - if ((size <= tileDirectionsAlloced) && !forceRealloc) { + if ((size <= _tileDirectionsAlloced) && !forceRealloc) { return; } - tileDirectionsAlloced = size; - tileDirections = (byte*)realloc(tileDirections, tileDirectionsAlloced * sizeof(*tileDirections)); + _tileDirectionsAlloced = size; + _tileDirections = (byte*)realloc(_tileDirections, _tileDirectionsAlloced * sizeof(*_tileDirections)); } void cycleWrap(int cycleLimit) { - if (actionCycle >= cycleLimit) - actionCycle = 0; + if (_actionCycle >= cycleLimit) + _actionCycle = 0; } void setWalkStepsPointsSize(int size, bool forceRealloc) { - if ((size <= walkStepsAlloced) && !forceRealloc) { + if ((size <= _walkStepsAlloced) && !forceRealloc) { return; } - walkStepsAlloced = size; - walkStepsPoints = (Point*)realloc(walkStepsPoints, walkStepsAlloced * sizeof(*walkStepsPoints)); + _walkStepsAlloced = size; + _walkStepsPoints = (Point*)realloc(_walkStepsPoints, _walkStepsAlloced * sizeof(*_walkStepsPoints)); } void addWalkStepPoint(const Point &point) { - setWalkStepsPointsSize(walkStepsCount + 1, false); - walkStepsPoints[walkStepsCount++] = point; + setWalkStepsPointsSize(_walkStepsCount + 1, false); + _walkStepsPoints[_walkStepsCount++] = point; } ActorData() { memset(this, 0, sizeof(*this)); } ~ActorData() { - free(frames); - free(tileDirections); - free(walkStepsPoints); - spriteList.freeMem(); + free(_frames); + free(_tileDirections); + free(_walkStepsPoints); + _spriteList.freeMem(); } }; @@ -531,7 +531,7 @@ public: if (!(objectType & (kGameObjectObject | kGameObjectActor))) { error("Actor::getObjectScriptEntrypointNumber wrong id 0x%X", id); } - return (objectType == kGameObjectObject) ? getObj(id)->scriptEntrypointNumber : getActor(id)->scriptEntrypointNumber; + return (objectType == kGameObjectObject) ? getObj(id)->_scriptEntrypointNumber : getActor(id)->_scriptEntrypointNumber; } int getObjectFlags(uint16 id) { int objectType; @@ -539,7 +539,7 @@ public: if (!(objectType & (kGameObjectObject | kGameObjectActor))) { error("Actor::getObjectFlags wrong id 0x%X", id); } - return (objectType == kGameObjectObject) ? getObj(id)->flags : getActor(id)->flags; + return (objectType == kGameObjectObject) ? getObj(id)->_flags : getActor(id)->_flags; } void direct(int msec); diff --git a/saga/interface.cpp b/saga/interface.cpp index 3bf66224da..4b33cc3d05 100644 --- a/saga/interface.cpp +++ b/saga/interface.cpp @@ -210,7 +210,7 @@ int Interface::activate() { if (!_active) { _active = true; _vm->_script->_skipSpeeches = false; - _vm->_actor->_protagonist->targetObject = ID_NOTHING; + _vm->_actor->_protagonist->_targetObject = ID_NOTHING; _vm->_gfx->showCursor(true); unlockMode(); if (_panelMode == kPanelMain){ @@ -1197,12 +1197,12 @@ void Interface::handleChapterSelectionClick(const Point& mousePoint) { case kGameObjectActor: a = _vm->_actor->getActor(obj); - script = a->scriptEntrypointNumber; + script = a->_scriptEntrypointNumber; break; case kGameObjectObject: o = _vm->_actor->getObj(obj); - script = o->scriptEntrypointNumber; + script = o->_scriptEntrypointNumber; break; } @@ -1465,7 +1465,7 @@ void Interface::handleMainClick(const Point& mousePoint) { _vm->_script->hitObject(_vm->leftMouseButtonPressed()); } if (_vm->_script->_pendingVerb) { - _vm->_actor->_protagonist->currentAction = kActionWait; + _vm->_actor->_protagonist->_currentAction = kActionWait; _vm->_script->doVerb(); } } @@ -1646,7 +1646,7 @@ void Interface::drawInventory(Surface *backBuffer) { if (ci < _inventoryCount) { obj = _vm->_actor->getObj(_inventory[ci]); - _vm->_sprite->draw(backBuffer, _vm->getDisplayClip(), _vm->_sprite->_mainSprites, obj->spriteListResourceId, rect, 256); + _vm->_sprite->draw(backBuffer, _vm->getDisplayClip(), _vm->_sprite->_mainSprites, obj->_spriteListResourceId, rect, 256); } ci++; diff --git a/saga/isomap.cpp b/saga/isomap.cpp index 31369b99d1..fc0c66a587 100644 --- a/saga/isomap.cpp +++ b/saga/isomap.cpp @@ -283,7 +283,7 @@ void IsoMap::adjustScroll(bool jump) { Point maxScrollPos; - tileCoordsToScreenPoint(_vm->_actor->_centerActor->location, playerPoint); + tileCoordsToScreenPoint(_vm->_actor->_centerActor->_location, playerPoint); if (_vm->_scene->currentSceneResourceId() == RID_ITE_OVERMAP_SCENE) { _mapPosition.x = (playerPoint.x + _viewScroll.x) * 30 / 100 - (381); @@ -327,7 +327,7 @@ void IsoMap::adjustScroll(bool jump) { uint16 objectId; objectId = _vm->_actor->objIndexToId(ITE_OBJ_MAP); obj = _vm->_actor->getObj(objectId); - if (obj->sceneNumber != ITE_SCENE_INV) { + if (obj->_sceneNumber != ITE_SCENE_INV) { _viewScroll.x = 1552 + 8; _viewScroll.y = 1456 + 8; } @@ -1093,7 +1093,7 @@ void IsoMap::testPossibleDirections(int16 u, int16 v, uint16 terraComp[8], int s #define TEST_TILE_EPILOG(index) \ } else { \ - if (_vm->_actor->_protagonist->location.z > 0) { \ + if (_vm->_actor->_protagonist->_location.z > 0) { \ terraComp[index] = SAGA_IMPASSABLE; \ } \ } @@ -1192,16 +1192,16 @@ void IsoMap::placeOnTileMap(const Location &start, Location &result, int16 dista bestU = SAGA_SEARCH_CENTER; bestV = SAGA_SEARCH_CENTER; - _platformHeight = _vm->_actor->_protagonist->location.z / 8; + _platformHeight = _vm->_actor->_protagonist->_location.z / 8; memset( &_searchArray, 0, sizeof(_searchArray)); for (i = 0; i < _vm->_actor->_actorsCount; i++) { actor = _vm->_actor->_actors[i]; - if (!actor->inScene) continue; + if (!actor->_inScene) continue; - u = (actor->location.u() >> 4) - uBase; - v = (actor->location.v() >> 4) - vBase; + u = (actor->_location.u() >> 4) - uBase; + v = (actor->_location.v() >> 4) - vBase; if ((u >= 0) && (u < SAGA_SEARCH_DIAMETER) && (v >= 0) && (v < SAGA_SEARCH_DIAMETER) && ((u != SAGA_SEARCH_CENTER) || (v != SAGA_SEARCH_CENTER))) { @@ -1360,7 +1360,7 @@ void IsoMap::findDragonTilePath(ActorData* actor,const Location &start, const Lo uFinish = (end.u() >> 4) - uBase; vFinish = (end.v() >> 4) - vBase; - _platformHeight = _vm->_actor->_protagonist->location.z / 8; + _platformHeight = _vm->_actor->_protagonist->_location.z / 8; memset( &_dragonSearchArray, 0, sizeof(_dragonSearchArray)); @@ -1475,10 +1475,10 @@ void IsoMap::findDragonTilePath(ActorData* actor,const Location &start, const Lo i = 64; }*/ - actor->walkStepsCount = i; + actor->_walkStepsCount = i; if (i) { actor->setTileDirectionsSize(i, false); - memcpy(actor->tileDirections, res, i ); + memcpy(actor->_tileDirections, res, i ); } } @@ -1516,21 +1516,21 @@ void IsoMap::findTilePath(ActorData* actor, const Location &start, const Locatio uFinish = (end.u() >> 4) - uBase; vFinish = (end.v() >> 4) - vBase; - _platformHeight = _vm->_actor->_protagonist->location.z / 8; + _platformHeight = _vm->_actor->_protagonist->_location.z / 8; memset( &_searchArray, 0, sizeof(_searchArray)); - if (!(actor->actorFlags & kActorNoCollide) && + if (!(actor->_actorFlags & kActorNoCollide) && (_vm->_scene->currentSceneResourceId() != RID_ITE_OVERMAP_SCENE)) { for (i = 0; i < _vm->_actor->_actorsCount; i++) { other = _vm->_actor->_actors[i]; - if (!other->inScene) continue; - if (other==actor) continue; + if (!other->_inScene) continue; + if (other == actor) continue; - u = (other->location.u() >> 4) - uBase; - v = (other->location.v() >> 4) - vBase; + u = (other->_location.u() >> 4) - uBase; + v = (other->_location.v() >> 4) - vBase; if ((u >= 1) && (u < SAGA_SEARCH_DIAMETER) && (v >= 1) && (v < SAGA_SEARCH_DIAMETER) && ((u != SAGA_SEARCH_CENTER) || (v != SAGA_SEARCH_CENTER))) { @@ -1607,10 +1607,10 @@ void IsoMap::findTilePath(ActorData* actor, const Location &start, const Locatio /* if (i > 64) { i = 64; }*/ - actor->walkStepsCount = i; + actor->_walkStepsCount = i; if (i) { actor->setTileDirectionsSize(i, false); - memcpy(actor->tileDirections, res, i ); + memcpy(actor->_tileDirections, res, i ); } } @@ -1641,30 +1641,30 @@ static const int16 directions[8][2] = { bool IsoMap::nextTileTarget(ActorData* actor) { uint16 dir; - if (actor->walkStepIndex >= actor->walkStepsCount) { + if (actor->_walkStepIndex >= actor->_walkStepsCount) { return false; } - actor->actionDirection = dir = actor->tileDirections[actor->walkStepIndex++]; + actor->_actionDirection = dir = actor->_tileDirections[actor->_walkStepIndex++]; - actor->partialTarget.u() = - (actor->location.u() & ~0x0f) + 8 + directions[dir][0]; + actor->_partialTarget.u() = + (actor->_location.u() & ~0x0f) + 8 + directions[dir][0]; - actor->partialTarget.v() = - (actor->location.v() & ~0x0f) + 8 + directions[dir][1]; + actor->_partialTarget.v() = + (actor->_location.v() & ~0x0f) + 8 + directions[dir][1]; if (dir == 0) { - actor->facingDirection = kDirUp; + actor->_facingDirection = kDirUp; } else { if (dir == 4) { - actor->facingDirection = kDirDown; + actor->_facingDirection = kDirDown; } else { if (dir < 4) { - actor->facingDirection = kDirRight; + actor->_facingDirection = kDirRight; } else { - actor->facingDirection = kDirLeft; + actor->_facingDirection = kDirLeft; } } } @@ -1683,11 +1683,11 @@ void IsoMap::screenPointToTileCoords(const Point &position, Location &location) } x = mPos.x + _viewScroll.x - (128 * SAGA_TILEMAP_W) - 16; - y = mPos.y + _viewScroll.y - (128 * SAGA_TILEMAP_W) + _vm->_actor->_protagonist->location.z; + y = mPos.y + _viewScroll.y - (128 * SAGA_TILEMAP_W) + _vm->_actor->_protagonist->_location.z; location.u() = (x - y * 2) >> 1; location.v() = - (x + y * 2) >> 1; - location.z = _vm->_actor->_protagonist->location.z; + location.z = _vm->_actor->_protagonist->_location.z; } } // End of namespace Saga diff --git a/saga/objectmap.cpp b/saga/objectmap.cpp index 849dfa4f0f..a70339cdd9 100644 --- a/saga/objectmap.cpp +++ b/saga/objectmap.cpp @@ -227,7 +227,7 @@ void ObjectMap::draw(Surface *ds, const Point& testPoint, int color, int color2) pickPoint = testPoint; if (_vm->_scene->getFlags() & kSceneFlagISO) { assert(_vm->_actor->_protagonist); - pickPoint.y -= _vm->_actor->_protagonist->location.z; + pickPoint.y -= _vm->_actor->_protagonist->_location.z; _vm->_isoMap->screenPointToTileCoords(pickPoint, pickLocation); pickLocation.toScreenPointUV(pickPoint); } diff --git a/saga/puzzle.cpp b/saga/puzzle.cpp index a8fdc5cfaa..26ef8ca518 100644 --- a/saga/puzzle.cpp +++ b/saga/puzzle.cpp @@ -250,7 +250,7 @@ void Puzzle::initPieces(void) { SpriteInfo *spI; for (int i = 0; i < PUZZLE_PIECES; i++) { - spI = &puzzle->spriteList.infoList[i]; + spI = &puzzle->_spriteList.infoList[i]; _pieceInfo[i].offX = (byte)(spI->width >> 1); _pieceInfo[i].offY = (byte)(spI->height >> 1); @@ -271,7 +271,7 @@ void Puzzle::showPieces(void) { int num = _piecePriority[j]; if (_puzzlePiece != num) { - _vm->_sprite->draw(backBuffer, _vm->getDisplayClip(), puzzle->spriteList, num, Point(_pieceInfo[num].curX, _pieceInfo[num].curY), 256); + _vm->_sprite->draw(backBuffer, _vm->getDisplayClip(), puzzle->_spriteList, num, Point(_pieceInfo[num].curX, _pieceInfo[num].curY), 256); } } } @@ -280,7 +280,7 @@ void Puzzle::drawCurrentPiece() { ActorData *puzzle = _vm->_actor->getActor(_vm->_actor->actorIndexToId(ITE_ACTOR_PUZZLE)); Surface *backBuffer = _vm->_gfx->getBackBuffer(); - _vm->_sprite->draw(backBuffer, _vm->_scene->getSceneClip(), puzzle->spriteList, _puzzlePiece, + _vm->_sprite->draw(backBuffer, _vm->_scene->getSceneClip(), puzzle->_spriteList, _puzzlePiece, Point(_pieceInfo[_puzzlePiece].curX, _pieceInfo[_puzzlePiece].curY), 256); } @@ -416,7 +416,7 @@ void Puzzle::dropPiece(Point mousePt) { if (newy < boxy) newy = PUZZLE_Y_OFFSET; - spI = &puzzle->spriteList.infoList[_puzzlePiece]; + spI = &puzzle->_spriteList.infoList[_puzzlePiece]; if (newx + spI->width > boxw) newx = boxw - spI->width ; diff --git a/saga/rscfile.cpp b/saga/rscfile.cpp index f079c9aaec..bd03068541 100644 --- a/saga/rscfile.cpp +++ b/saga/rscfile.cpp @@ -478,7 +478,7 @@ void Resource::loadGlobalResources(int chapter, int actorsEntrance) { _metaResource.actorsResourceID, _metaResource.protagStatesCount, _metaResource.protagStatesResourceID); - _vm->_actor->_protagonist->sceneNumber = _metaResource.sceneIndex; + _vm->_actor->_protagonist->_sceneNumber = _metaResource.sceneIndex; // TODO: field_16 diff --git a/saga/saga.cpp b/saga/saga.cpp index b0d8945151..9677754518 100644 --- a/saga/saga.cpp +++ b/saga/saga.cpp @@ -376,11 +376,11 @@ const char *SagaEngine::getObjectName(uint16 objectId) { switch (objectTypeId(objectId)) { case kGameObjectObject: obj = _actor->getObj(objectId); - return _script->_mainStrings.getString(obj->nameIndex); + return _script->_mainStrings.getString(obj->_nameIndex); break; case kGameObjectActor: actor = _actor->getActor(objectId); - return _actor->_actorsStrings.getString(actor->nameIndex); + return _actor->_actorsStrings.getString(actor->_nameIndex); break; case kGameObjectHitZone: hitZone = _scene->_objectMap->getHitZone(objectIdToIndex(objectId)); diff --git a/saga/script.cpp b/saga/script.cpp index 9d24584b14..6b962e63ec 100644 --- a/saga/script.cpp +++ b/saga/script.cpp @@ -514,10 +514,10 @@ void Script::playfieldClick(const Point& mousePoint, bool leftButton) { _vm->_actor->abortSpeech(); - if ((_vm->_actor->_protagonist->currentAction != kActionWait) && - (_vm->_actor->_protagonist->currentAction != kActionFreeze) && - (_vm->_actor->_protagonist->currentAction != kActionWalkToLink) && - (_vm->_actor->_protagonist->currentAction != kActionWalkToPoint)) { + if ((_vm->_actor->_protagonist->_currentAction != kActionWait) && + (_vm->_actor->_protagonist->_currentAction != kActionFreeze) && + (_vm->_actor->_protagonist->_currentAction != kActionWalkToLink) && + (_vm->_actor->_protagonist->_currentAction != kActionWalkToPoint)) { return; } if (_pendingVerb > kVerbNone) { @@ -567,7 +567,7 @@ void Script::playfieldClick(const Point& mousePoint, bool leftButton) { if (_vm->_scene->getFlags() & kSceneFlagISO) { pickLocation.u() = specialPoint.x; pickLocation.v() = specialPoint.y; - pickLocation.z = _vm->_actor->_protagonist->location.z; + pickLocation.z = _vm->_actor->_protagonist->_location.z; } else { pickLocation.fromScreenPoint(specialPoint); } @@ -616,7 +616,7 @@ void Script::whichObject(const Point& mousePoint) { _leftButtonVerb = _currentVerb; newRightButtonVerb = kVerbNone; - if (_vm->_actor->_protagonist->currentAction != kActionWalkDir) { + if (_vm->_actor->_protagonist->_currentAction != kActionWalkDir) { if (_vm->getSceneHeight() >= mousePoint.y) { newObjectId = _vm->_actor->hitTest(mousePoint, true); @@ -640,7 +640,7 @@ void Script::whichObject(const Point& mousePoint) { (_currentVerb == kVerbOpen) || (_currentVerb == kVerbClose) || ((_currentVerb == kVerbGive) && !_firstObjectSet) || - ((_currentVerb == kVerbUse) && !(actor->flags & kFollower))) { + ((_currentVerb == kVerbUse) && !(actor->_flags & kFollower))) { objectId = ID_NOTHING; newObjectId = ID_NOTHING; } @@ -652,7 +652,7 @@ void Script::whichObject(const Point& mousePoint) { pickPoint = mousePoint; if (_vm->_scene->getFlags() & kSceneFlagISO) { - pickPoint.y -= _vm->_actor->_protagonist->location.z; + pickPoint.y -= _vm->_actor->_protagonist->_location.z; _vm->_isoMap->screenPointToTileCoords(pickPoint, pickLocation); pickLocation.toScreenPointUV(pickPoint); } @@ -705,7 +705,7 @@ void Script::whichObject(const Point& mousePoint) { if (objectId != 0) { obj = _vm->_actor->getObj(objectId); newRightButtonVerb = kVerbLookAt; - if (obj->interactBits & kObjUseWith) { + if (obj->_interactBits & kObjUseWith) { objectFlags = kObjUseWith; } } diff --git a/saga/sfuncs.cpp b/saga/sfuncs.cpp index e8b6e35ac0..bf64bbb1cd 100644 --- a/saga/sfuncs.cpp +++ b/saga/sfuncs.cpp @@ -273,8 +273,8 @@ void Script::sfTakeObject(SCRIPTFUNC_PARAMS) { uint16 objectId = thread->pop(); ObjectData *obj; obj = _vm->_actor->getObj(objectId); - if (obj->sceneNumber != ITE_SCENE_INV) { - obj->sceneNumber = ITE_SCENE_INV; + if (obj->_sceneNumber != ITE_SCENE_INV) { + obj->_sceneNumber = ITE_SCENE_INV; //4debug for (int j=0;j<17;j++) _vm->_interface->addToInventory(objectId); } @@ -287,7 +287,7 @@ void Script::sfIsCarried(SCRIPTFUNC_PARAMS) { CommonObjectData *object; if (_vm->_actor->validObjId(objectId)) { object = _vm->_actor->getObj(objectId); - thread->_returnValue = (object->sceneNumber == ITE_SCENE_INV) ? 1 : 0; + thread->_returnValue = (object->_sceneNumber == ITE_SCENE_INV) ? 1 : 0; } else { thread->_returnValue = 0; } @@ -330,9 +330,9 @@ void Script::sfScriptWalkTo(SCRIPTFUNC_PARAMS) { actorLocation.y = thread->pop(); actor = _vm->_actor->getActor(actorId); - actorLocation.z = actor->location.z; + actorLocation.z = actor->_location.z; - actor->flags &= ~kFollower; + actor->_flags &= ~kFollower; if (_vm->_actor->actorWalkTo(actorId, actorLocation)) { thread->waitWalk(actor); @@ -364,7 +364,7 @@ void Script::sfScriptDoAction(SCRIPTFUNC_PARAMS) { switch (objectTypeId(objectId)) { case kGameObjectObject: obj = _vm->_actor->getObj(objectId); - scriptEntryPointNumber = obj->scriptEntrypointNumber; + scriptEntryPointNumber = obj->_scriptEntrypointNumber; if (scriptEntryPointNumber <= 0) { return; } @@ -372,11 +372,11 @@ void Script::sfScriptDoAction(SCRIPTFUNC_PARAMS) { break; case kGameObjectActor: actor = _vm->_actor->getActor(objectId); - scriptEntryPointNumber = actor->scriptEntrypointNumber; + scriptEntryPointNumber = actor->_scriptEntrypointNumber; if (scriptEntryPointNumber <= 0) { return; } - if (actor->flags & (kProtagonist | kFollower)) { + if (actor->_flags & (kProtagonist | kFollower)) { moduleNumber = 0; } else { moduleNumber = _vm->_scene->getScriptModuleNumber(); @@ -422,8 +422,8 @@ void Script::sfSetActorFacing(SCRIPTFUNC_PARAMS) { actorDirection = thread->pop(); actor = _vm->_actor->getActor(actorId); - actor->facingDirection = actor->actionDirection = actorDirection; - actor->targetObject = ID_NOTHING; + actor->_facingDirection = actor->_actionDirection = actorDirection; + actor->_targetObject = ID_NOTHING; } // Script function #9 (0x09) @@ -508,7 +508,7 @@ void Script::sfFaceTowards(SCRIPTFUNC_PARAMS) { targetObject = thread->pop(); actor = _vm->_actor->getActor(actorId); - actor->targetObject = targetObject; + actor->_targetObject = targetObject; } // Script function #15 (0x0F) @@ -526,12 +526,12 @@ void Script::sfSetFollower(SCRIPTFUNC_PARAMS) { debug(1, "sfSetFollower(%d, %d) [%d]", actorId, targetObject, _vm->_actor->actorIdToIndex(actorId)); actor = _vm->_actor->getActor(actorId); - actor->targetObject = targetObject; + actor->_targetObject = targetObject; if (targetObject != ID_NOTHING) { - actor->flags |= kFollower; - actor->actorFlags &= ~kActorNoFollow; + actor->_flags |= kFollower; + actor->_actorFlags &= ~kActorNoFollow; } else { - actor->flags &= ~kFollower; + actor->_flags &= ~kFollower; } } @@ -577,7 +577,7 @@ void Script::sfSetObjImage(SCRIPTFUNC_PARAMS) { spriteId = thread->pop(); obj = _vm->_actor->getObj(objectId); - obj->spriteListResourceId = OBJ_SPRITE_BASE + spriteId; + obj->_spriteListResourceId = OBJ_SPRITE_BASE + spriteId; _vm->_interface->refreshInventory(); } @@ -593,7 +593,7 @@ void Script::sfSetObjName(SCRIPTFUNC_PARAMS) { nameIdx = thread->pop(); obj = _vm->_actor->getObj(objectId); - obj->nameIndex = nameIdx; + obj->_nameIndex = nameIdx; } // Script function #19 (0x13) @@ -607,9 +607,9 @@ void Script::sfGetObjImage(SCRIPTFUNC_PARAMS) { obj = _vm->_actor->getObj(objectId); if (_vm->getGameType() == GType_IHNM) - thread->_returnValue = obj->spriteListResourceId; + thread->_returnValue = obj->_spriteListResourceId; else - thread->_returnValue = obj->spriteListResourceId - OBJ_SPRITE_BASE; + thread->_returnValue = obj->_spriteListResourceId - OBJ_SPRITE_BASE; } // Script function #20 (0x14) @@ -709,9 +709,9 @@ void Script::sfScriptWalkToAsync(SCRIPTFUNC_PARAMS) { actorLocation.y = thread->pop(); actor = _vm->_actor->getActor(actorId); - actorLocation.z = actor->location.z; + actorLocation.z = actor->_location.z; - actor->flags &= ~kFollower; + actor->_flags &= ~kFollower; _vm->_actor->actorWalkTo(actorId, actorLocation); } @@ -732,7 +732,7 @@ void Script::sfEnableZone(SCRIPTFUNC_PARAMS) { hitZone->setFlag(kHitZoneEnabled); } else { hitZone->clearFlag(kHitZoneEnabled); - _vm->_actor->_protagonist->lastZone = NULL; + _vm->_actor->_protagonist->_lastZone = NULL; } } @@ -752,8 +752,8 @@ void Script::sfSetActorState(SCRIPTFUNC_PARAMS) { if ((currentAction >= kActionWalkToPoint) && (currentAction <= kActionWalkToPoint)) { wakeUpActorThread(kWaitTypeWalk, actor); } - actor->currentAction = currentAction; - actor->actorFlags &= ~kActorBackwards; + actor->_currentAction = currentAction; + actor->_actorFlags &= ~kActorBackwards; } // Script function #30 (0x1E) nonblocking @@ -773,13 +773,13 @@ void Script::sfScriptMoveTo(SCRIPTFUNC_PARAMS) { if (_vm->_actor->validActorId(objectId)) { actor = _vm->_actor->getActor(objectId); - actor->location.x = location.x; - actor->location.y = location.y; + actor->_location.x = location.x; + actor->_location.y = location.y; } else { if (_vm->_actor->validObjId(objectId)) { obj = _vm->_actor->getObj(objectId); - obj->location.x = location.x; - obj->location.y = location.y; + obj->_location.x = location.x; + obj->_location.y = location.y; } } } @@ -810,19 +810,19 @@ void Script::sfDropObject(SCRIPTFUNC_PARAMS) { obj = _vm->_actor->getObj(objectId); - if (obj->sceneNumber == ITE_SCENE_INV) { + if (obj->_sceneNumber == ITE_SCENE_INV) { _vm->_interface->removeFromInventory(objectId); } - obj->sceneNumber = _vm->_scene->currentSceneNumber(); + obj->_sceneNumber = _vm->_scene->currentSceneNumber(); if (_vm->getGameType() == GType_IHNM) - obj->spriteListResourceId = spriteId; + obj->_spriteListResourceId = spriteId; else - obj->spriteListResourceId = OBJ_SPRITE_BASE + spriteId; + obj->_spriteListResourceId = OBJ_SPRITE_BASE + spriteId; - obj->location.x = x; - obj->location.y = y; + obj->_location.x = x; + obj->_location.y = y; } // Script function #33 (0x21) @@ -849,15 +849,15 @@ void Script::sfSwapActors(SCRIPTFUNC_PARAMS) { actor1 = _vm->_actor->getActor(actorId1); actor2 = _vm->_actor->getActor(actorId2); - SWAP(actor1->location, actor2->location); + SWAP(actor1->_location, actor2->_location); - if (actor1->flags & kProtagonist) { - actor1->flags &= ~kProtagonist; - actor2->flags |= kProtagonist; + if (actor1->_flags & kProtagonist) { + actor1->_flags &= ~kProtagonist; + actor2->_flags |= kProtagonist; _vm->_actor->_protagonist = _vm->_actor->_centerActor = actor2; - } else if (actor2->flags & kProtagonist) { - actor2->flags &= ~kProtagonist; - actor1->flags |= kProtagonist; + } else if (actor2->_flags & kProtagonist) { + actor2->_flags &= ~kProtagonist; + actor1->_flags |= kProtagonist; _vm->_actor->_protagonist = _vm->_actor->_centerActor = actor1; } @@ -922,21 +922,21 @@ void Script::sfScriptWalk(SCRIPTFUNC_PARAMS) { walkFlags = thread->pop(); actor = _vm->_actor->getActor(actorId); - actorLocation.z = actor->location.z; + actorLocation.z = actor->_location.z; _vm->_actor->realLocation(actorLocation, ID_NOTHING, walkFlags); - actor->flags &= ~kFollower; + actor->_flags &= ~kFollower; if (_vm->_actor->actorWalkTo(actorId, actorLocation) && !(walkFlags & kWalkAsync)) { thread->waitWalk(actor); } if (walkFlags & kWalkBackPedal) { - actor->actorFlags |= kActorBackwards; + actor->_actorFlags |= kActorBackwards; } - actor->actorFlags = (actor->actorFlags & ~kActorFacingMask) | (walkFlags & kActorFacingMask); + actor->_actorFlags = (actor->_actorFlags & ~kActorFacingMask) | (walkFlags & kActorFacingMask); } // Script function #37 (0x25) nonblocking @@ -959,27 +959,27 @@ void Script::sfCycleFrames(SCRIPTFUNC_PARAMS) { actor = _vm->_actor->getActor(actorId); if (flags & kCyclePong) { - actor->currentAction = kActionPongFrames; + actor->_currentAction = kActionPongFrames; } else { - actor->currentAction = kActionCycleFrames; + actor->_currentAction = kActionCycleFrames; } - actor->actorFlags &= ~(kActorContinuous | kActorRandom | kActorBackwards); + actor->_actorFlags &= ~(kActorContinuous | kActorRandom | kActorBackwards); if (!(flags & kCycleOnce)) { - actor->actorFlags |= kActorContinuous; + actor->_actorFlags |= kActorContinuous; } if (flags & kCycleRandom) { - actor->actorFlags |= kActorRandom; + actor->_actorFlags |= kActorRandom; } if (flags & kCycleReverse) { - actor->actorFlags |= kActorBackwards; + actor->_actorFlags |= kActorBackwards; } - actor->cycleFrameSequence = cycleFrameSequence; - actor->cycleTimeCount = 0; - actor->cycleDelay = cycleDelay; - actor->actionCycle = 0; + actor->_cycleFrameSequence = cycleFrameSequence; + actor->_cycleTimeCount = 0; + actor->_cycleDelay = cycleDelay; + actor->_actionCycle = 0; } @@ -1002,10 +1002,10 @@ void Script::sfSetFrame(SCRIPTFUNC_PARAMS) { frameRange = _vm->_actor->getActorFrameRange(actorId, frameType); - actor->frameNumber = frameRange->frameIndex + frameOffset; + actor->_frameNumber = frameRange->frameIndex + frameOffset; - if (actor->currentAction != kActionFall) { - actor->currentAction = kActionFreeze; + if (actor->_currentAction != kActionFall) { + actor->_currentAction = kActionFreeze; } } @@ -1065,11 +1065,11 @@ void Script::sfScriptSpecialWalk(SCRIPTFUNC_PARAMS) { walkFrameSequence = thread->pop(); actor = _vm->_actor->getActor(actorId); - actorLocation.z = actor->location.z; + actorLocation.z = actor->_location.z; _vm->_actor->actorWalkTo(actorId, actorLocation); - actor->walkFrameSequence = walkFrameSequence; + actor->_walkFrameSequence = walkFrameSequence; } // Script function #43 (0x2B) nonblocking @@ -1099,9 +1099,9 @@ void Script::sfPlaceActor(SCRIPTFUNC_PARAMS) { actorLocation.y, actorDirection, frameType, frameOffset); actor = _vm->_actor->getActor(actorId); - actor->location.x = actorLocation.x; - actor->location.y = actorLocation.y; - actor->facingDirection = actor->actionDirection = actorDirection; + actor->_location.x = actorLocation.x; + actor->_location.y = actorLocation.y; + actor->_facingDirection = actor->_actionDirection = actorDirection; if (frameType >= 0) { frameRange = _vm->_actor->getActorFrameRange(actorId, frameType); @@ -1110,13 +1110,13 @@ void Script::sfPlaceActor(SCRIPTFUNC_PARAMS) { error("Wrong frameOffset 0x%X", frameOffset); } - actor->frameNumber = frameRange->frameIndex + frameOffset; - actor->currentAction = kActionFreeze; + actor->_frameNumber = frameRange->frameIndex + frameOffset; + actor->_currentAction = kActionFreeze; } else { - actor->currentAction = kActionWait; + actor->_currentAction = kActionWait; } - actor->targetObject = ID_NOTHING; + actor->_targetObject = ID_NOTHING; } @@ -1148,21 +1148,21 @@ void Script::sfScriptWalkRelative(SCRIPTFUNC_PARAMS) { walkFlags = thread->pop(); actor = _vm->_actor->getActor(actorId); - actorLocation.z = actor->location.z; + actorLocation.z = actor->_location.z; _vm->_actor->realLocation(actorLocation, objectId, walkFlags); - actor->flags &= ~kFollower; + actor->_flags &= ~kFollower; if (_vm->_actor->actorWalkTo(actorId, actorLocation) && !(walkFlags & kWalkAsync)) { thread->waitWalk(actor); } if (walkFlags & kWalkBackPedal) { - actor->actorFlags |= kActorBackwards; + actor->_actorFlags |= kActorBackwards; } - actor->actorFlags = (actor->actorFlags & ~kActorFacingMask) | (walkFlags & kActorFacingMask); + actor->_actorFlags = (actor->_actorFlags & ~kActorFacingMask) | (walkFlags & kActorFacingMask); } // Script function #46 (0x2E) @@ -1185,13 +1185,13 @@ void Script::sfScriptMoveRelative(SCRIPTFUNC_PARAMS) { walkFlags = thread->pop(); actor = _vm->_actor->getActor(actorId); - actorLocation.z = actor->location.z; + actorLocation.z = actor->_location.z; _vm->_actor->realLocation(actorLocation, objectId, walkFlags); - actor->location = actorLocation; - actor->actorFlags = (actor->actorFlags & ~kActorFacingMask) | (walkFlags & kActorFacingMask); + actor->_location = actorLocation; + actor->_actorFlags = (actor->_actorFlags & ~kActorFacingMask) | (walkFlags & kActorFacingMask); } // Script function #47 (0x2F) @@ -1449,15 +1449,15 @@ void Script::sfThrowActor(SCRIPTFUNC_PARAMS) { flags = thread->pop(); actor = _vm->_actor->getActor(actorId); - location.z = actor->location.z; - actor->currentAction = kActionFall; - actor->actionCycle = actionCycle; - actor->fallAcceleration = -20; - actor->fallVelocity = - (actor->fallAcceleration * actor->actionCycle) / 2; - actor->fallPosition = actor->location.z << 4; - - actor->finalTarget = location; - actor->actionCycle--; + location.z = actor->_location.z; + actor->_currentAction = kActionFall; + actor->_actionCycle = actionCycle; + actor->_fallAcceleration = -20; + actor->_fallVelocity = - (actor->_fallAcceleration * actor->_actionCycle) / 2; + actor->_fallPosition = actor->_location.z << 4; + + actor->_finalTarget = location; + actor->_actionCycle--; if (!(flags & kWalkAsync)) { thread->waitWalk(actor); } @@ -1473,9 +1473,9 @@ void Script::sfWaitWalk(SCRIPTFUNC_PARAMS) { actorId = thread->pop(); actor = _vm->_actor->getActor(actorId); - if ((actor->currentAction == kActionWalkToPoint) || - (actor->currentAction == kActionWalkToLink) || - (actor->currentAction == kActionFall)) { + if ((actor->_currentAction == kActionWalkToPoint) || + (actor->_currentAction == kActionWalkToLink) || + (actor->_currentAction == kActionFall)) { thread->waitWalk(actor); } } @@ -1496,7 +1496,7 @@ void Script::sfChangeActorScene(SCRIPTFUNC_PARAMS) { actorId = thread->pop(); sceneNumber = thread->pop(); actor = _vm->_actor->getActor(actorId); - actor->sceneNumber = sceneNumber; + actor->_sceneNumber = sceneNumber; } // Script function #56 (0x38) @@ -1517,11 +1517,11 @@ void Script::sfScriptClimb(SCRIPTFUNC_PARAMS) { flags = thread->pop(); actor = _vm->_actor->getActor(actorId); - actor->finalTarget.z = z; - actor->flags &= ~kFollower; - actor->actionCycle = 1; - actor->cycleFrameSequence = cycleFrameSequence; - actor->currentAction = kActionClimb; + actor->_finalTarget.z = z; + actor->_flags &= ~kFollower; + actor->_actionCycle = 1; + actor->_cycleFrameSequence = cycleFrameSequence; + actor->_currentAction = kActionClimb; if (!(flags & kWalkAsync)) { thread->waitWalk(actor); } @@ -1558,11 +1558,11 @@ void Script::sfSetActorZ(SCRIPTFUNC_PARAMS) { if (_vm->_actor->validActorId(objectId)) { actor = _vm->_actor->getActor(objectId); - actor->location.z = z; + actor->_location.z = z; } else { if (_vm->_actor->validObjId(objectId)) { obj = _vm->_actor->getObj(objectId); - obj->location.z = z; + obj->_location.z = z; } } } @@ -1607,7 +1607,7 @@ void Script::sfGetActorX(SCRIPTFUNC_PARAMS) { actorId = thread->pop(); actor = _vm->_actor->getActor(actorId); - thread->_returnValue = actor->location.x >> 2; + thread->_returnValue = actor->_location.x >> 2; } // Script function #61 (0x3D) @@ -1619,7 +1619,7 @@ void Script::sfGetActorY(SCRIPTFUNC_PARAMS) { actorId = thread->pop(); actor = _vm->_actor->getActor(actorId); - thread->_returnValue = actor->location.y >> 2; + thread->_returnValue = actor->_location.y >> 2; } // Script function #62 (0x3E) @@ -1663,9 +1663,9 @@ void Script::sfPickClimbOutPos(SCRIPTFUNC_PARAMS) { v = (_vm->_rnd.getRandomNumber(63) & 63) + 40; t = _vm->_isoMap->getTileIndex(u, v, 6); if (t == 65) { - protagonist->location.u() = (u << 4) + 4; - protagonist->location.v() = (v << 4) + 4; - protagonist->location.z = 48; + protagonist->_location.u() = (u << 4) + 4; + protagonist->_location.v() = (v << 4) + 4; + protagonist->_location.z = 48; break; } @@ -1678,22 +1678,22 @@ void Script::sfTossRif(SCRIPTFUNC_PARAMS) { uint16 direction; ActorData *protagonist = _vm->_actor->_protagonist; - uc = protagonist->location.u() >> 4; - vc = protagonist->location.v() >> 4; + uc = protagonist->_location.u() >> 4; + vc = protagonist->_location.v() >> 4; if (_vm->_isoMap->findNearestChasm(uc, vc, direction)) { uc <<= 4; vc <<= 4; - protagonist->facingDirection = direction; - - protagonist->finalTarget.u() = uc; - protagonist->finalTarget.v() = vc; - protagonist->finalTarget.z = -40; - protagonist->currentAction = kActionFall; - protagonist->actionCycle = 24; - protagonist->fallAcceleration = - 20; - protagonist->fallVelocity = - (protagonist->fallAcceleration * 16) / 2 - (44 / 12); - protagonist->fallPosition = protagonist->location.z << 4; - protagonist->actionCycle--; + protagonist->_facingDirection = direction; + + protagonist->_finalTarget.u() = uc; + protagonist->_finalTarget.v() = vc; + protagonist->_finalTarget.z = -40; + protagonist->_currentAction = kActionFall; + protagonist->_actionCycle = 24; + protagonist->_fallAcceleration = - 20; + protagonist->_fallVelocity = - (protagonist->_fallAcceleration * 16) / 2 - (44 / 12); + protagonist->_fallPosition = protagonist->_location.z << 4; + protagonist->_actionCycle--; } } diff --git a/saga/sthread.cpp b/saga/sthread.cpp index 4e5f912eb9..a61074f3ea 100644 --- a/saga/sthread.cpp +++ b/saga/sthread.cpp @@ -148,7 +148,7 @@ void Script::executeThreads(uint msec) { { ActorData *actor; actor = (ActorData *)thread->_threadObj; - if (actor->currentAction == kActionWait) { + if (actor->_currentAction == kActionWait) { thread->_flags &= ~kTFlagWaiting; } } |
