Rename Actor class members to _members.
svn-id: r18645
This commit is contained in:
parent
00d676c3d2
commit
37f2a10ef6
11 changed files with 748 additions and 751 deletions
895
saga/actor.cpp
895
saga/actor.cpp
File diff suppressed because it is too large
Load diff
278
saga/actor.h
278
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
|
||||
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; //
|
||||
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->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(_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(_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();
|
||||
_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();
|
||||
_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);
|
||||
|
|
|
@ -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++;
|
||||
|
|
|
@ -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->_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
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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 ;
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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));
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
220
saga/sfuncs.cpp
220
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;
|
||||
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--;
|
||||
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->_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->_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--;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue