diff options
Diffstat (limited to 'saga')
-rw-r--r-- | saga/actor.cpp | 512 | ||||
-rw-r--r-- | saga/actor.h | 89 | ||||
-rw-r--r-- | saga/actordata.cpp | 369 | ||||
-rw-r--r-- | saga/actordata.h | 13 | ||||
-rw-r--r-- | saga/console.cpp | 18 | ||||
-rw-r--r-- | saga/console.h | 2 | ||||
-rw-r--r-- | saga/interface.cpp | 4 | ||||
-rw-r--r-- | saga/sfuncs.cpp | 32 | ||||
-rw-r--r-- | saga/sthread.cpp | 6 |
9 files changed, 434 insertions, 611 deletions
diff --git a/saga/actor.cpp b/saga/actor.cpp index ebe4663909..da02e3b9c6 100644 --- a/saga/actor.cpp +++ b/saga/actor.cpp @@ -42,16 +42,15 @@ namespace Saga { -static int actorCompare(const ACTOR& actor1, const ACTOR& actor2) { - if (actor1.a_pt.y == actor2.a_pt.y) { +static int actorCompare(const ActorDataPointer& actor1, const ActorDataPointer& actor2) { + if (actor1->a_pt.y == actor2->a_pt.y) { return 0; - } else if (actor1.a_pt.y < actor2.a_pt.y) { + } else if (actor1->a_pt.y < actor2->a_pt.y) { return -1; } else { return 1; } } -static ActorList::iterator zeroActorIterator; ACTIONTIMES ActionTDeltas[] = { { ACTION_IDLE, 80 }, @@ -61,6 +60,7 @@ ACTIONTIMES ActionTDeltas[] = { Actor::Actor(SagaEngine *vm) : _vm(vm) { int i; + ActorData *actor; // Get actor resource file context _actorContext = GAME_GetFileContext(GAME_RESOURCEFILE, 0); @@ -68,54 +68,138 @@ Actor::Actor(SagaEngine *vm) : _vm(vm) { error("Actor::Actor(): Couldn't load actor module resource context."); } - - // Initialize alias table so each index contains itself for (i = 0; i < ACTORCOUNT; i++) { - _aliasTbl[i] = i; + actor = &_actors[i]; + actor->actorId = ACTOR_INDEX_TO_ID(i); + actor->index = i; + debug(0, "init actorId=0x%X index=0x%X", actor->actorId, actor->index); + actor->spriteListResourceId = ActorTable[i].spriteListResourceId; + actor->frameListResourceId = ActorTable[i].frameListResourceId; + actor->flags = ActorTable[i].flags; + actor->speechColor = ActorTable[actor->index].speechColor; + actor->orient = ACTOR_DEFAULT_ORIENT; + actor->def_action = 0; + actor->def_action_flags = 0; + actor->action = 0; + actor->action_flags = 0; + actor->action_time = 0; + actor->action_frame = 0; + if (loadActorResources(actor) != SUCCESS) + error("Error while loading actors resource actorId=0x%X index=0x%X", actor->actorId, actor->index); + _orderList.push_back(actor); } - - _count = 0; } Actor::~Actor() { + int i; + ActorData *actor; + debug(0, "Actor::~Actor()"); + //release resources + for (i = 0; i < ACTORCOUNT; i++) { + actor = &_actors[i]; + free(actor->frames); + _vm->_sprite->freeSprite(actor->spriteList); + } } -bool Actor::isValidActor(int index) { +int Actor::loadActorResources(ActorData * actor) { + byte *resourcePointer; + size_t resourceLength; + int frameCount; + ActorFrame *framesPointer; + int lastFrame; + int i, orient; + int result; + + result = RSC_LoadResource(_actorContext, actor->frameListResourceId, &resourcePointer, &resourceLength); + if (result != SUCCESS) { + warning("Couldn't load sprite action index resource"); + return FAILURE; + } + + frameCount = resourceLength / 16; + debug(0, "Sprite resource contains %d frames", frameCount); - if (!IS_VALID_ACTOR_INDEX(index)) - return false; + framesPointer = (ActorFrame *)malloc(sizeof(ActorFrame) * frameCount); + if (framesPointer == NULL) { + warning("Couldn't allocate memory for sprite frames"); + RSC_FreeResource(resourcePointer); + return MEM; + } + + MemoryReadStreamEndian readS(resourcePointer, resourceLength, IS_BIG_ENDIAN); + + lastFrame = 0; + + for (i = 0; i < frameCount; i++) { + for (orient = 0; orient < ACTOR_ORIENTATION_COUNT; orient++) { + // Load all four orientations + framesPointer[i].dir[orient].frameIndex = readS.readUint16(); + framesPointer[i].dir[orient].frameCount = readS.readUint16(); + if (framesPointer[i].dir[orient].frameIndex > lastFrame) { + lastFrame = framesPointer[i].dir[orient].frameIndex; + } + } + } + + RSC_FreeResource(resourcePointer); + + actor->frames = framesPointer; + actor->frameCount = frameCount; + + + if (_vm->_sprite->loadList(actor->spriteListResourceId, &actor->spriteList) != SUCCESS) { + warning("Unable to load sprite list"); + return FAILURE; + } + + if (lastFrame >= _vm->_sprite->getListLen(actor->spriteList)) { + debug(0, "Appending to sprite list 0x%X", actor->spriteListResourceId); + if (_vm->_sprite->appendList(actor->spriteListResourceId + 1, actor->spriteList) != SUCCESS) { + warning("Unable append sprite list"); + return FAILURE; + } + } - return (_tbl[index] != zeroActorIterator); + return SUCCESS; } -ActorList::iterator Actor::getActorIterator(int index) { +ActorData *Actor::getActor(uint16 actorId) { + if(!IS_VALID_ACTOR_ID(actorId)) + error("Actor::getActor Wrong actorId 0x%X", actorId); + + return &_actors[ACTOR_ID_TO_INDEX(actorId)]; +} - if(!isValidActor(index)) - error("Actor::getActorIterator wrong actor 0x%x", index); +ActorOrderList::iterator Actor::getActorOrderIterator(const ActorData *actor) { + ActorOrderList::iterator actorOrderIterator; + + for (actorOrderIterator = _orderList.begin(); actorOrderIterator != _orderList.end(); ++actorOrderIterator) + if (actor == actorOrderIterator.operator*()) { + return actorOrderIterator; + } - return _tbl[index]; + error("Actor::getActorOrderIterator actor"); } -void Actor::reorderActorUp(int index) { - ActorList::iterator actorIterator; +void Actor::reorderActorUp(ActorData *actor) { + ActorOrderList::iterator actorOrderIterator; - actorIterator = getActorIterator(index); - actorIterator = _list.reorderUp(actorIterator, actorCompare); - _tbl[index] = actorIterator; + actorOrderIterator = getActorOrderIterator(actor); + actorOrderIterator = _orderList.reorderUp(actorOrderIterator, actorCompare); } -void Actor::reorderActorDown(int index) { - ActorList::iterator actorIterator; +void Actor::reorderActorDown(ActorData *actor) { + ActorOrderList::iterator actorOrderIterator; - actorIterator = getActorIterator(index); - actorIterator = _list.reorderDown(actorIterator, actorCompare); - _tbl[index] = actorIterator; + actorOrderIterator = getActorOrderIterator(actor); + actorOrderIterator = _orderList.reorderDown(actorOrderIterator, actorCompare); } int Actor::direct(int msec) { - ActorList::iterator actorIterator; - ACTOR *actor; + ActorOrderList::iterator actorOrderIterator; + ActorData *actor; ActorIntentList::iterator actorIntentIterator; ACTORINTENT *a_intent; @@ -124,8 +208,8 @@ int Actor::direct(int msec) { int action_tdelta; // Walk down the actor list and direct each actor - for (actorIterator = _list.begin(); actorIterator != _list.end(); ++actorIterator) { - actor = actorIterator.operator->(); + for (actorOrderIterator = _orderList.begin(); actorOrderIterator != _orderList.end(); ++actorOrderIterator) { + actor = actorOrderIterator.operator*(); // Process the actor intent list actorIntentIterator = actor->a_intentlist.begin(); @@ -138,13 +222,8 @@ int Actor::direct(int msec) { case INTENT_PATH: // Actor intends to go somewhere. Well good for him { - uint16 actorId = actor->actorId; //backup handleWalkIntent(actor, &a_intent->walkIntent, &a_intent->a_idone, msec); - - actorIterator = getActorIterator(ACTOR_ID_TO_INDEX(actorId)); - actor = actorIterator.operator->(); - actorIntentIterator = actor->a_intentlist.begin(); - a_intent = actorIntentIterator.operator->(); + actorOrderIterator = getActorOrderIterator(actor); } break; case INTENT_SPEAK: @@ -184,7 +263,7 @@ int Actor::direct(int msec) { actor->action_frame++; o_idx = ActorOrientationLUT[actor->orient]; - if (actor->act_tbl[actor->action].dir[o_idx].frame_count <= actor->action_frame) { + if (actor->frames[actor->action].dir[o_idx].frameCount <= actor->action_frame) { if (actor->action_flags & ACTION_LOOP) { actor->action_frame = 0; } else { @@ -198,8 +277,8 @@ int Actor::direct(int msec) { } int Actor::drawList() { - ActorList::iterator actorIterator; - ACTOR *actor; + ActorOrderList::iterator actorOrderIterator; + ActorData *actor; ActorIntentList::iterator actorIntentIterator; ACTORINTENT *a_intent; @@ -216,12 +295,12 @@ int Actor::drawList() { back_buf = _vm->_gfx->getBackBuffer(); - for (actorIterator = _list.begin(); actorIterator != _list.end(); ++actorIterator) { - actor = actorIterator.operator->(); + for (actorOrderIterator = _orderList.begin(); actorOrderIterator != _orderList.end(); ++actorOrderIterator) { + actor = actorOrderIterator.operator*(); o_idx = ActorOrientationLUT[actor->orient]; - sprite_num = actor->act_tbl[actor->action].dir[o_idx].frame_index; + sprite_num = actor->frames[actor->action].dir[o_idx].frameIndex; sprite_num += actor->action_frame; - _vm->_sprite->drawOccluded(back_buf, actor->sl_p, sprite_num, actor->s_pt.x, actor->s_pt.y); + _vm->_sprite->drawOccluded(back_buf, actor->spriteList, sprite_num, actor->s_pt.x, actor->s_pt.y); // If actor's current intent is to speak, oblige him by // displaying his dialogue @@ -235,7 +314,7 @@ int Actor::drawList() { diag_x = actor->s_pt.x; diag_y = actor->s_pt.y; diag_y -= ACTOR_DIALOGUE_HEIGHT; - _vm->textDraw(MEDIUM_FONT_ID, back_buf, a_dialogue->d_string, diag_x, diag_y, actor->a_dcolor, 0, + _vm->textDraw(MEDIUM_FONT_ID, back_buf, a_dialogue->d_string, diag_x, diag_y, actor->speechColor, 0, FONT_OUTLINE | FONT_CENTERED); } } @@ -250,8 +329,8 @@ int Actor::drawList() { // dialogue entry if there is a current speak intent present. int Actor::skipDialogue() { - ActorList::iterator actorIterator; - ACTOR *actor; + ActorOrderList::iterator actorOrderIterator; + ActorData *actor; ActorIntentList::iterator actorIntentIterator; ACTORINTENT *a_intent; @@ -259,8 +338,8 @@ int Actor::skipDialogue() { ActorDialogList::iterator actorDialogIterator; ACTORDIALOGUE *a_dialogue; - for (actorIterator = _list.begin(); actorIterator != _list.end(); ++actorIterator) { - actor = actorIterator.operator->(); + for (actorOrderIterator = _orderList.begin(); actorOrderIterator != _orderList.end(); ++actorOrderIterator) { + actor = actorOrderIterator.operator*(); // Check the actor's current intent for a speak intent actorIntentIterator = actor->a_intentlist.begin(); if (actorIntentIterator != actor->a_intentlist.end()) { @@ -285,101 +364,9 @@ int Actor::skipDialogue() { return SUCCESS; } -void Actor::create(uint16 actorId, int x, int y) { - ACTOR sampleActor; - sampleActor.actorId = actorId; - sampleActor.a_pt.x = x; - sampleActor.a_pt.y = y; - - addActor(&sampleActor); -} - -void Actor::addActor(ACTOR * actor) { - ActorList::iterator actorIterator; - int last_frame; - - actor->index = ACTOR_ID_TO_INDEX(actor->actorId); - - debug(0, "Actor::addActor actorId=0x%X index=0x%X", actor->actorId, actor->index); - - if (!IS_VALID_ACTOR_INDEX(actor->index)) { - error("Wrong Actor actorId=0x%X index=0x%X", actor->actorId, actor->index); - } - - if (_tbl[actor->index] != zeroActorIterator) { - error("Actor::addActor actor already exist actorId=0x%X index=0x%X", actor->actorId, actor->index); - } - - AtoS(&actor->s_pt, &actor->a_pt); - - - actor->sl_rn = ActorTable[actor->index].spritelist_rn; - actor->si_rn = ActorTable[actor->index].spriteindex_rn; - - loadActorSpriteIndex(actor, actor->si_rn, &last_frame); - - if (_vm->_sprite->loadList(actor->sl_rn, &actor->sl_p) != SUCCESS) { - error("Actor::addActor unable to load sprite list actorId=0x%X index=0x%X", actor->actorId, actor->index); - } - - if (last_frame >= _vm->_sprite->getListLen(actor->sl_p)) { - debug(0, "Appending to sprite list %d.", actor->sl_rn); - if (_vm->_sprite->appendList(actor->sl_rn + 1, actor->sl_p) != SUCCESS) { - error("Actor::addActor unable append sprite list actorId=0x%X index=0x%X", actor->actorId, actor->index); - } - } - - actor->flags = ActorTable[actor->index].flags; - actor->a_dcolor = ActorTable[actor->index].color; - actor->orient = ACTOR_DEFAULT_ORIENT; - actor->def_action = 0; - actor->def_action_flags = 0; - actor->action = 0; - actor->action_flags = 0; - actor->action_time = 0; - actor->action_frame = 0; - - actorIterator = _list.pushBack(*actor, actorCompare); - - actor = actorIterator.operator->(); - - _tbl[actor->index] = actorIterator; - _count++; -} - -int Actor::getActorIndex(uint16 actorId) { - int actorIdx = ACTOR_ID_TO_INDEX(actorId); - - if (!IS_VALID_ACTOR_INDEX(actorIdx)) { - error("Wrong Actor actorId=0x%X actorIdx=0x%X", actorId, actorIdx); - } - - if (_tbl[actorIdx] == zeroActorIterator) { - _vm->_console->DebugPrintf(S_WARN_PREFIX "Actor::getActorIndex Actor id 0x%X not found.\n", actorId); - warning("Actor::getActorIndex Actor not found actorId=0x%X actorIdx=0x%X", actorId, actorIdx); - return -1; - } - - return actorIdx; -} - -bool Actor::actorExists(uint16 actorId) { - int actorIdx = ACTOR_ID_TO_INDEX(actorId); - - if (!IS_VALID_ACTOR_INDEX(actorIdx)) { - error("Wrong Actor actorId=0x%X actorIdx=0x%X", actorId, actorIdx); - } - - if (_tbl[actorIdx] == zeroActorIterator) { - return false; - } - - return true; -} - void Actor::speak(uint16 actorId, const char *d_string, uint16 d_voice_rn, SEMAPHORE *sem) { - ActorList::iterator actorIterator; - ACTOR *actor; + ActorOrderList::iterator actorOrderIterator; + ActorData *actor; ActorIntentList::iterator actorIntentIterator; ACTORINTENT *a_intent_p = NULL; ACTORINTENT a_intent; @@ -392,8 +379,7 @@ void Actor::speak(uint16 actorId, const char *d_string, uint16 d_voice_rn, SEMAP a_dialogue.d_sem_held = 1; a_dialogue.d_sem = sem; - actorIterator = getActorIterator(ACTOR_ID_TO_INDEX(actorId)); - actor = actorIterator.operator->(); + actor = getActor(actorId); // If actor's last registered intent is to speak, we can queue the // requested dialogue on that intent context; so examine the last @@ -428,7 +414,7 @@ void Actor::speak(uint16 actorId, const char *d_string, uint16 d_voice_rn, SEMAP } } -int Actor::handleSpeakIntent(ACTOR *actor, SPEAKINTENT *a_speakint, int *complete_p, int msec) { +int Actor::handleSpeakIntent(ActorData *actor, SPEAKINTENT *a_speakint, int *complete_p, int msec) { ActorDialogList::iterator actorDialogIterator; ActorDialogList::iterator nextActorDialogIterator; ACTORDIALOGUE *a_dialogue; @@ -508,11 +494,9 @@ int Actor::getSpeechTime(const char *d_string, uint16 d_voice_rn) { } void Actor::setOrientation(uint16 actorId, int orient) { - ActorList::iterator actorIterator; - ACTOR *actor; + ActorData *actor; - actorIterator = getActorIterator(ACTOR_ID_TO_INDEX(actorId)); - actor = actorIterator.operator->(); + actor = getActor(actorId); if ((orient < 0) || (orient > 7)) { error("Actor::setOrientation wrong orientation 0x%X", orient); @@ -522,13 +506,11 @@ void Actor::setOrientation(uint16 actorId, int orient) { } void Actor::setAction(uint16 actorId, int action_n, uint16 action_flags) { - ActorList::iterator actorIterator; - ACTOR *actor; + ActorData *actor; - actorIterator = getActorIterator(ACTOR_ID_TO_INDEX(actorId)); - actor = actorIterator.operator->(); + actor = getActor(actorId); - if ((action_n < 0) || (action_n >= actor->action_ct)) { + if ((action_n < 0) || (action_n >= actor->frameCount)) { error("Actor::setAction wrong action_n 0x%X", action_n); } @@ -540,107 +522,25 @@ void Actor::setAction(uint16 actorId, int action_n, uint16 action_flags) { } void Actor::setDefaultAction(uint16 actorId, int action_n, uint16 action_flags) { - ActorList::iterator actorIterator; - ACTOR *actor; + ActorData *actor; - actorIterator = getActorIterator(ACTOR_ID_TO_INDEX(actorId)); - actor = actorIterator.operator->(); + actor = getActor(actorId); - if ((action_n < 0) || (action_n >= actor->action_ct)) { + if ((action_n < 0) || (action_n >= actor->frameCount)) { error("Actor::setDefaultAction wrong action_n 0x%X", action_n); } actor->def_action = action_n; actor->def_action_flags = action_flags; } -/* -ACTOR *Actor::lookupActor(int index) { - ActorList::iterator actorIterator; - ACTOR *actor; - - actorIterator = getActorIterator(index); - actor = actorIterator.operator->(); - - return actor; -}*/ - -int Actor::loadActorSpriteIndex(ACTOR * actor, int si_rn, int *last_frame_p) { - byte *res_p; - size_t res_len; - int s_action_ct; - ACTORACTION *action_p; - int last_frame; - int i, orient; - int result; - - result = RSC_LoadResource(_actorContext, si_rn, &res_p, &res_len); - if (result != SUCCESS) { - warning("Couldn't load sprite action index resource"); - return FAILURE; - } - - s_action_ct = res_len / 16; - debug(0, "Sprite resource contains %d sprite actions.", s_action_ct); - action_p = (ACTORACTION *)malloc(sizeof(ACTORACTION) * s_action_ct); - - MemoryReadStreamEndian readS(res_p, res_len, IS_BIG_ENDIAN); - - if (action_p == NULL) { - warning("Couldn't allocate memory for sprite actions"); - RSC_FreeResource(res_p); - return MEM; - } - - last_frame = 0; - - for (i = 0; i < s_action_ct; i++) { - for (orient = 0; orient < 4; orient++) { - // Load all four orientations - action_p[i].dir[orient].frame_index = readS.readUint16(); - action_p[i].dir[orient].frame_count = readS.readUint16(); - if (action_p[i].dir[orient].frame_index > last_frame) { - last_frame = action_p[i].dir[orient].frame_index; - } - } - } - - actor->act_tbl = action_p; - actor->action_ct = s_action_ct; - - RSC_FreeResource(res_p); - - if (last_frame_p != NULL) { - *last_frame_p = last_frame; - } - - return SUCCESS; -} - -void Actor::deleteActor(uint16 actorId) { - ActorList::iterator actorIterator; - ACTOR *actor; - - debug(0, "Actor::deleteActor actorId=0x%X", actorId); - - actorIterator = getActorIterator(ACTOR_ID_TO_INDEX(actorId)); - actor = actorIterator.operator->(); - - _vm->_sprite->freeSprite(actor->sl_p); - - _list.erase(actorIterator); - - _tbl[ACTOR_ID_TO_INDEX(actorId)] = zeroActorIterator; -} void Actor::walkTo(uint16 actorId, const Point *walk_pt, uint16 flags, SEMAPHORE *sem) { ACTORINTENT actor_intent; - ActorList::iterator actorIterator; - ACTOR *actor; + ActorData *actor; assert(walk_pt != NULL); - actorIterator = getActorIterator(ACTOR_ID_TO_INDEX(actorId)); - actor = actorIterator.operator->(); + actor = getActor(actorId); actor_intent.a_itype = INTENT_PATH; actor_intent.a_iflags = 0; @@ -659,7 +559,6 @@ void Actor::walkTo(uint16 actorId, const Point *walk_pt, uint16 flags, SEMAPHORE if (sem != NULL) { _vm->_script->SThreadHoldSem(sem); } - } int Actor::setPathNode(WALKINTENT *walk_int, Point *src_pt, Point *dst_pt, SEMAPHORE *sem) { @@ -678,7 +577,7 @@ int Actor::setPathNode(WALKINTENT *walk_int, Point *src_pt, Point *dst_pt, SEMAP return SUCCESS; } -int Actor::handleWalkIntent(ACTOR *actor, WALKINTENT *a_walkint, int *complete_p, int delta_time) { +int Actor::handleWalkIntent(ActorData *actor, WALKINTENT *a_walkint, int *complete_p, int delta_time) { WalkNodeList::iterator walkNodeIterator; WalkNodeList::iterator nextWalkNodeIterator; @@ -827,136 +726,95 @@ int Actor::handleWalkIntent(ACTOR *actor, WALKINTENT *a_walkint, int *complete_p actor->s_pt.y = actor->a_pt.y >> 2; if (path_slope < 0) { - reorderActorUp(actor->index); + reorderActorUp(actor); } else { - reorderActorDown(actor->index); + reorderActorDown(actor); } - // here "actor" pointer may be invalid + return SUCCESS; } -void Actor::move(uint16 actorId, const Point *move_pt) { - ActorList::iterator actorIterator; - ACTOR *actor; +void Actor::move(uint16 actorId, const Point &movePoint) { + ActorData *actor; - int move_up = 0; + int moveUp = 0; - actorIterator = getActorIterator(ACTOR_ID_TO_INDEX(actorId)); - actor = actorIterator.operator->(); + actor = getActor(actorId); - if (move_pt->y < actor->a_pt.y) { - move_up = 1; + if (movePoint.y < actor->a_pt.y) { + moveUp = 1; } - actor->a_pt.x = move_pt->x; - actor->a_pt.y = move_pt->y; + actor->a_pt = movePoint; - AtoS(&actor->s_pt, &actor->a_pt); + AtoS(actor->s_pt, actor->a_pt); - if (move_up) { - reorderActorUp(actor->index); + if (moveUp) { + reorderActorUp(actor); } else { - reorderActorDown(actor->index); + reorderActorDown(actor); } - // here "actor" pointer may be invalid } -void Actor::moveRelative(uint16 actorId, const Point *move_pt) { - ActorList::iterator actorIterator; - ACTOR *actor; +void Actor::moveRelative(uint16 actorId, const Point &movePoint) { + ActorData *actor; - actorIterator = getActorIterator(ACTOR_ID_TO_INDEX(actorId)); - actor = actorIterator.operator->(); + actor = getActor(actorId); - actor->a_pt.x += move_pt->x; - actor->a_pt.y += move_pt->y; + actor->a_pt.x += movePoint.x; //TODO user rect.h + actor->a_pt.y += movePoint.y; - AtoS(&actor->s_pt, &actor->a_pt); + AtoS(actor->s_pt, actor->a_pt); if (actor->a_pt.y < 0) { - reorderActorUp(actor->index); + reorderActorUp(actor); } else { - reorderActorDown(actor->index); + reorderActorDown(actor); } - // here "actor" pointer may be invalid } - -int Actor::AtoS(Point *screen, const Point *actor) { - screen->x = (actor->x / ACTOR_LMULT); - screen->y = (actor->y / ACTOR_LMULT); - - return SUCCESS; +void Actor::AtoS(Point &screenPoint, const Point &actorPoint) { + screenPoint.x = (actorPoint.x / ACTOR_LMULT); + screenPoint.y = (actorPoint.y / ACTOR_LMULT); } -int Actor::StoA(Point *actor, const Point screen) { - actor->x = (screen.x * ACTOR_LMULT); - actor->y = (screen.y * ACTOR_LMULT); - - return SUCCESS; +void Actor::StoA(Point &actorPoint, const Point &screenPoint) { + actorPoint.x = (screenPoint.x * ACTOR_LMULT); + actorPoint.y = (screenPoint.y * ACTOR_LMULT); } // Console wrappers - must be safe to run // TODO - checkup ALL arguments, cause wrong arguments may fall function with "error" -void Actor::CF_actor_add(int argc, const char **argv) { - uint16 actorId = (uint16) atoi(argv[1]); - int x = atoi(argv[2]); - int y = atoi(argv[3]); - int actorIdx = ACTOR_ID_TO_INDEX(actorId); - - if (!IS_VALID_ACTOR_INDEX(actorIdx)) { - _vm->_console->DebugPrintf("Actor::CF_actor_add Invalid actorId 0x%X.\n",actorId); - return; - } - - if (actorExists(actorId)) { - _vm->_console->DebugPrintf("Actor::CF_actor_add Actor already exist actorId 0x%X.\n",actorId); - return; - } - - create(actorId, x, y); -} - -void Actor::CF_actor_del(int argc, const char **argv) { - uint16 actorId = (uint16) atoi(argv[1]); - - if (!isValidActor(ACTOR_ID_TO_INDEX(actorId))) { - _vm->_console->DebugPrintf("Actor::CF_actor_del Invalid actorId 0x%X.\n",actorId); - return; - } - deleteActor(actorId); -} - void Actor::CF_actor_move(int argc, const char **argv) { uint16 actorId = (uint16) atoi(argv[1]); - Point move_pt; + Point movePoint; - move_pt.x = atoi(argv[2]); - move_pt.y = atoi(argv[3]); + movePoint.x = atoi(argv[2]); + movePoint.y = atoi(argv[3]); - if (!isValidActor(ACTOR_ID_TO_INDEX(actorId))) { - _vm->_console->DebugPrintf("Actor::CF_actor_move Invalid actorId 0x%X.\n",actorId); + if (!IS_VALID_ACTOR_ID(actorId)) { + _vm->_console->DebugPrintf("Actor::CF_actor_move Invalid actorId 0x%X.\n", actorId); return; } - move(actorId, &move_pt); + move(actorId, movePoint); } void Actor::CF_actor_moverel(int argc, const char **argv) { uint16 actorId = (uint16) atoi(argv[1]); - Point move_pt; + Point movePoint; - move_pt.x = atoi(argv[2]); - move_pt.y = atoi(argv[3]); + movePoint.x = atoi(argv[2]); + movePoint.y = atoi(argv[3]); - if (!isValidActor(ACTOR_ID_TO_INDEX(actorId))) { - _vm->_console->DebugPrintf("Actor::CF_actor_moverel Invalid actorId 0x%X.\n",actorId); + if (!IS_VALID_ACTOR_ID(actorId)) { + _vm->_console->DebugPrintf("Actor::CF_actor_moverel Invalid actorId 0x%X.\n", actorId); return; } - moveRelative(actorId, &move_pt); + moveRelative(actorId, movePoint); } void Actor::CF_actor_seto(int argc, const char **argv) { @@ -965,7 +823,7 @@ void Actor::CF_actor_seto(int argc, const char **argv) { orient = atoi(argv[2]); //TODO orient check - if (!isValidActor(ACTOR_ID_TO_INDEX(actorId))) { + if (!IS_VALID_ACTOR_ID(actorId)) { _vm->_console->DebugPrintf("Actor::CF_actor_seto Invalid actorId 0x%X.\n",actorId); return; } @@ -979,7 +837,7 @@ void Actor::CF_actor_setact(int argc, const char **argv) { action_n = atoi(argv[2]); - if (!isValidActor(ACTOR_ID_TO_INDEX(actorId))) { + if (!IS_VALID_ACTOR_ID(actorId)) { _vm->_console->DebugPrintf("Actor::CF_actor_setact Invalid actorId 0x%X.\n",actorId); return; } diff --git a/saga/actor.h b/saga/actor.h index 45ed17b59a..3c06d47aca 100644 --- a/saga/actor.h +++ b/saga/actor.h @@ -36,7 +36,6 @@ namespace Saga { #define ACTOR_BASE_ZMOD 0.5 #define ACTOR_DEFAULT_ORIENT 2 -#define ACTOR_ORIENTMAX 7 #define ACTOR_ACTIONTIME 80 @@ -45,8 +44,12 @@ namespace Saga { #define ACTOR_LMULT 4 +#define ACTOR_ORIENTATION_COUNT 4 + #define IS_VALID_ACTOR_INDEX(index) ((index >= 0) && (index < ACTORCOUNT)) +#define IS_VALID_ACTOR_ID(id) ((id == 1) || (id >= 0x2000) && (id < (0x2000 | ACTORCOUNT))) #define ACTOR_ID_TO_INDEX(id) ((((uint16)id) == 1 ) ? 0 : (int)(((uint16)id) & ~0x2000)) +#define ACTOR_INDEX_TO_ID(index) ((((int)index) == 0 ) ? 1 : (uint16)(((int)index) | 0x2000)) enum ACTOR_INTENTS { INTENT_NONE = 0, @@ -82,13 +85,13 @@ enum ACTOR_ACTIONFLAGS { ACTION_LOOP = 0x01 }; -struct ACTORACTIONITEM { - int frame_index; - int frame_count; +struct ActorOrientation { + int frameIndex; + int frameCount; }; -struct ACTORACTION { - ACTORACTIONITEM dir[4]; +struct ActorFrame { + ActorOrientation dir[ACTOR_ORIENTATION_COUNT]; }; struct WALKNODE { @@ -173,7 +176,7 @@ struct ACTORINTENT { typedef Common::List<ACTORINTENT> ActorIntentList; -struct ACTOR { +struct ActorData { int index; // Actor index uint16 actorId; // Actor id @@ -183,16 +186,20 @@ struct ACTOR { Point a_pt; // Actor's logical coordinates Point s_pt; // Actor's screen coordinates - int sl_rn; // Actor's sprite list res # - int si_rn; // Actor's sprite index res # - SPRITELIST *sl_p; // Actor's sprite list data + SPRITELIST *spriteList; // Actor's sprite list data + int spriteListResourceId; // Actor's sprite list resource id + + ActorFrame *frames; // Actor's frames + int frameCount; // Actor's frames count + int frameListResourceId; // Actor's frame list resource id + + byte speechColor; // Actor dialogue color int idle_time; int orient; int speaking; - int a_dcolor; // Actor dialogue color - + // The actor intent list describes what the actor intends to do; // multiple intents can be queued. The actor must complete an // intent before moving on to the next; thus actor movements, esp @@ -210,32 +217,32 @@ struct ACTOR { int action_frame; int action_time; - ACTORACTION *act_tbl; // Action lookup table - int action_ct; // Number of actions in the action LUT - ACTOR() { + + ActorData() { index = 0; actorId = 0; name_i = 0; flags = 0; - sl_rn = 0; - si_rn = 0; - sl_p = 0; + frames = NULL; + frameCount = 0; + frameListResourceId = 0; + spriteList = NULL; + spriteListResourceId = 0; idle_time = 0; orient = 0; speaking = 0; - a_dcolor = 0; + speechColor = 0; def_action = 0; def_action_flags = 0; action = 0; action_flags = 0; action_frame = 0; action_time = 0; - act_tbl = NULL; - action_ct = 0; } }; -typedef SortedList<ACTOR> ActorList; +typedef ActorData* ActorDataPointer; +typedef SortedList<ActorDataPointer> ActorOrderList; struct ACTIONTIMES { @@ -248,8 +255,6 @@ public: Actor(SagaEngine *vm); ~Actor(); - void CF_actor_add(int argc, const char **argv); - void CF_actor_del(int argc, const char **argv); void CF_actor_move(int argc, const char **argv); void CF_actor_moverel(int argc, const char **argv); void CF_actor_seto(int argc, const char **argv); @@ -257,15 +262,12 @@ public: int direct(int msec); - void create(uint16 actorId, int x, int y); - bool actorExists(uint16 actorId); - int drawList(); - int AtoS(Point *logical, const Point *actor); - int StoA(Point *actor, const Point screen); + void AtoS(Point &screenPoint, const Point &actorPoint); + void StoA(Point &actorPoint, const Point &screenPoint); - void move(uint16 actorId, const Point *move_pt); - void moveRelative(uint16 actorId, const Point *move_pt); + void move(uint16 actorId, const Point &movePoint); + void moveRelative(uint16 actorId, const Point &movePoint); void walkTo(uint16 actorId, const Point *walk_pt, uint16 flags, SEMAPHORE *sem); @@ -278,30 +280,25 @@ public: void setAction(uint16 actorId, int action_n, uint16 action_flags); void setDefaultAction(uint16 actorId, int action_n, uint16 action_flags); - void deleteActor(uint16 actorId); private: - int handleWalkIntent(ACTOR *actor, WALKINTENT *a_walk_int, int *complete_p, int msec); - int handleSpeakIntent(ACTOR *actor, SPEAKINTENT *a_speakint, int *complete_p, int msec); + int handleWalkIntent(ActorData *actor, WALKINTENT *a_walk_int, int *complete_p, int msec); + int handleSpeakIntent(ActorData *actor, SPEAKINTENT *a_speakint, int *complete_p, int msec); int setPathNode(WALKINTENT *walk_int, Point *src_pt, Point *dst_pt, SEMAPHORE *sem); - int loadActorSpriteIndex(ACTOR *actor, int si_rn, int *last_frame_p); - ActorList::iterator getActorIterator(int index); - int getActorIndex(uint16 actorId); + ActorData *getActor(uint16 actorId); - void reorderActorUp(int index); - void reorderActorDown(int index); - bool isValidActor(int index); + int loadActorResources(ActorData * actor); + + ActorOrderList::iterator getActorOrderIterator(const ActorData *actor); + void reorderActorUp(ActorData *actor); + void reorderActorDown(ActorData *actor); - //ACTOR *lookupActor(int index); - void addActor(ACTOR * actor); SagaEngine *_vm; RSCFILE_CONTEXT *_actorContext; - uint16 _count; - int _aliasTbl[ACTORCOUNT]; - ActorList::iterator _tbl[ACTORCOUNT]; - ActorList _list; + ActorOrderList _orderList; + ActorData _actors[ACTORCOUNT]; }; } // End of namespace Saga diff --git a/saga/actordata.cpp b/saga/actordata.cpp index ce4890a76f..f0de002947 100644 --- a/saga/actordata.cpp +++ b/saga/actordata.cpp @@ -30,191 +30,190 @@ namespace Saga { // Lookup table to convert 8 cardinal directions to 4 int ActorOrientationLUT[] = { 2, 0, 0, 0, 3, 1, 1, 1 }; - ACTORTABLE ActorTable[ACTORCOUNT] = { - -// namei sl_rn si_rn col -// ----- ----- ----- --- - {1, kProtagonist, 0, 1, 0, 0, 0, 37, 135, 0, 1, 0, 0, 0}, // map party - {1, kFollower, 1, 0, 0, 0, 0, 0, 0, 1, 132, 0, 0, 0}, // Okk - {1, kFollower, 2, 0, 0, 0, 0, 48, 143, 2, 161, 0, 0, 0}, // Eeah - {1, 0, 3, 0, 240, 480, 0, 115, 206, 0, 25, 0, 0, 0}, // albino ferret - {1, 0, 4, 17, 368, 400, 0, 115, 206, 4, 49, 0, 0, 0}, // moneychanger - {1, 0, 5, 11, 552, 412, 0, 54, 152, 1, 171, 0, 0, 0}, // Sist - {1, 0, 17, 2, 1192, 888, 0, 57, 153, 17, 49, 0, 0, 0}, // worker ferret 1 - {1, 0, 17, 2, 816, 1052, 0, 57, 153, 18, 49, 0, 0, 0}, // worker ferret 2 - {1, 0, 17, 2, 928, 932, 0, 58, 153, 19, 49, 0, 0, 0}, // worker ferret 3 - {1, 0, 17, 2, 1416, 1160, 0, 58, 153, 20, 49, 0, 0, 0}, // worker ferret 4 - {1, 0, 19, 49, 1592, 1336, 0, 92, 175, 15, 162, 0, 0, 0}, // faire merchant 1 (bear) - {1, 0, 20, 49, 744, 824, 0, 63, 156, 19, 112, 0, 4, 4}, // faire merchant 2 (ferret) - {1, 0, 19, 0, 1592, 1336, 0, 92, 175, 0, 171, 0, 0, 0}, // faire merchant 3 - {1, 0, 19, 0, 1592, 1336, 0, 92, 175, 0, 171, 0, 0, 0}, // faire merchant 4 - {1, 0, 9, 49, 1560, 1624, 0, 94, 147, 18, 132, 0, 4, 4}, // faire goer 1a (rat) - {1, 0, 56, 49, 1384, 792, 0, 95, 193, 20, 72, 0, 0, 0}, // faire goer 1b (otter) - {1, 0, 19, 0, 1592, 1336, 0, 92, 175, 0, 171, 0, 0, 0}, // faire goer 2a - {1, 0, 19, 0, 1592, 1336, 0, 92, 175, 0, 171, 0, 0, 0}, // faire goer 2b - {1, 0, 19, 0, 1592, 1336, 0, 92, 175, 0, 171, 0, 0, 0}, // faire goer 3a - {1, 0, 19, 0, 1592, 1336, 0, 92, 175, 0, 171, 0, 0, 0}, // faire goer 3b - {1, 0, 19, 0, 1592, 1336, 0, 92, 175, 0, 171, 0, 0, 0}, // faire goer 4a - {1, 0, 19, 0, 1592, 1336, 0, 92, 175, 0, 171, 0, 0, 0}, // faire goer 4b - {1, 0, 18, 32, 764, 448, 0, 55, 150, 0, 48, 10, 4, 4}, // Scorry - {1, 0, 35, 32, 0, 0, 0, 56, 151, 0, 112, 0, 0, 0}, // grand puzzler - {1, 0, 36, 32, 0, 0, 0, 105, 142, 0, 155, 0, 0, 0}, // Rhene - {1, 0, 32, 32, 0, 0, 0, 91, 190, 0, 98, 0, 0, 0}, // elk captain - {1, 0, 31, 32, 0, 0, 0, 90, 189, 0, 171, 0, 0, 0}, // elk guard 1 - {1, 0, 31, 32, 0, 0, 0, 90, 189, 0, 171, 0, 0, 0}, // elk guard 2 - {1, 0, 31, 32, 0, 0, 0, 90, 189, 0, 171, 0, 0, 0}, // elk guard 3 - {1, 0, 31, 32, 0, 0, 0, 79, 172, 0, 18, 0, 0, 0}, // boar sergeant - {1, 0, 21, 50, 664, 400, 0, 76, 171, 2, 74, 0, 4, 4}, // boar sentry 1 - {1, 0, 21, 50, 892, 428, 0, 76, 171, 2, 74, 0, 4, 4}, // boar sentry 2 - {1, 0, 9, 51, 904, 936, 0, 51, 145, 35, 5, 0, 0, 0}, // hall rat 1 - {1, 0, 9, 51, 872, 840, 0, 51, 145, 36, 5, 0, 0, 0}, // hall rat 2 - {1, 0, 9, 51, 1432, 344, 0, 51, 145, 37, 5, 0, 0, 0}, // hall rat 3 - {1, 0, 9, 51, 664, 472, 0, 51, 145, 38, 5, 0, 0, 0}, // hall rat 4 - {1, 0, 10, 51, 1368, 1464, 0, 80, 146, 39, 147, 0, 0, 0}, // book rat 1 - {1, 0, 10, 51, 1416, 1624, 0, 80, 146, 40, 147, 0, 0, 0}, // book rat 2 - {1, 0, 10, 51, 1752, 120, 0, 80, 146, 41, 147, 0, 0, 0}, // book rat 3 - {1, 0, 10, 51, 984, 408, 0, 80, 146, 42, 147, 0, 0, 0}, // book rat 4 - {1, 0, 14, 52, 856, 376, 0, 82, 174, 8, 73, 0, 0, 0}, // grounds servant 1 - {1, 0, 14, 52, 808, 664, 0, 82, 174, 9, 73, 0, 0, 0}, // grounds servant 2 - {1, 0, 14, 52, 440, 568, 0, 82, 174, 10, 73, 0, 0, 0}, // grounds servant 3 - {1, 0, 14, 52, 392, 776, 0, 82, 174, 11, 73, 0, 0, 0}, // grounds servant 4 - {1, 0, 21, 4, 240, 384, 0, 79, 172, 0, 18, 0, 2, 2}, // boar sentry 3 (by doorway) - {1, 0, 23, 4, 636, 268, 0, 77, 173, 0, 74, 0, 4, 4}, // boar courtier - {1, 0, 22, 4, 900, 320, 0, 78, 179, 0, 60, 0, 4, 4}, // boar king - {1, 0, 14, 4, 788, 264, 0, 75, 170, 0, 171, 0, 2, 2}, // boar servant 1 - {1, 0, 14, 4, 1088, 264, 0, 75, 170, 0, 171, 0, 6, 6}, // boar servant 2 - {1, 0, 24, 19, 728, 396, 0, 65, 181, 47, 146, 0, 6, 6}, // glass master - {1, 0, 24, 21, -20, -20, 0, 66, 182, 0, 146, 0, 4, 4}, // glass master (with orb) - {1, kCycle, 25, 19, 372, 464, 0, 67, 183, 73, 146, 0, 2, 2}, // glass worker - {1, 0, 26, 5, 564, 476, 27, 53, 149, 1, 5, 0, 4, 4}, // door rat - {1, kCycle, 27, 31, 868, 344, 0, 81, 180, 0, 171, 0, 4, 4}, // bees - {1, 0, 28, 73, 568, 380, 0, 83, 176, 30, 120, 0, 4, 4}, // fortune teller - {1, 0, 14, 7, 808, 480, 0, 82, 174, 9, 73, 0, 0, 0}, // orb messenger - {1, 0, 29, 10, 508, 432, 0, 84, 186, 6, 112, 0, 4, 4}, // elk king - {1, 0, 33, 10, 676, 420, 0, 86, 184, 6, 171, 0, 4, 4}, // elk chancellor - {1, 0, 30, 10, 388, 452, 0, 88, 185, 6, 171, 0, 4, 4}, // elk courtier 1 - {1, 0, 30, 10, 608, 444, 0, 89, 185, 6, 171, 0, 4, 4}, // elk courtier 2 - {1, 0, 31, 10, 192, 468, 0, 90, 189, 6, 171, 0, 4, 4}, // elk throne guard 1 - {1, 0, 31, 10, 772, 432, 0, 90, 189, 6, 171, 0, 4, 4}, // elk throne guard 2 - {1, 0, 14, 10, 1340, 444, 0, 87, 188, 6, 171, 0, 4, 4}, // elk servant - {1, 0, 20, 18, 808, 360, 7, 60, 154, 64, 88, 0, 4, 4}, // hardware ferret - {1, 0, 34, 49, 1128, 1256, 0, 96, 191, 16, 35, 0, 4, 4}, // porcupine - {1, 0, 34, 49, 1384, 792, 0, 93, 192, 17, 66, 0, 4, 4}, // faire ram - {1, 0, 24, 21, 0, -40, 0, 65, 181, 50, 146, 0, 6, 6}, // glass master 2 - {1, 0, 3, 21, 0, -40, 0, 64, 158, 49, 112, 0, 0, 0}, // Sakka - {1, 0, 17, 21, 0, -40, 0, 62, 157, 74, 48, 0, 0, 0}, // lodge ferret 1 - {1, 0, 17, 21, 0, -40, 0, 62, 157, 74, 49, 0, 0, 0}, // lodge ferret 2 - {1, 0, 17, 21, 0, -40, 0, 62, 157, 74, 50, 0, 0, 0}, // lodge ferret 3 - {1, 0, 12, 244, 1056, 504, 0, 107, 167, 21, 124, 0, 6, 6}, // Elara - {1, 0, 8, 33, 248, 440, 0, 68, 169, 14, 112, 0, 0, 0}, // Tycho - {1, 0, 11, 23, 308, 424, 0, 106, 166, 6, 48, 0, 2, 2}, // Alamma - {1, 0, 17, 2, 1864, 1336, 0, 58, 153, 21, 49, 0, 0, 0}, // worker ferret 5 - {1, 0, 17, 2, 760, 216, 0, 58, 153, 22, 49, 0, 0, 0}, // worker ferret 6 - {1, 0, 44, 29, 0, 0, 0, 72, 159, 0, 112, 0, 0, 0}, // Prince - {1, 0, 45, 29, 0, 0, 0, 71, 163, 0, 146, 0, 6, 6}, // harem girl 1 - {1, 0, 45, 29, 0, 0, 0, 71, 163, 0, 124, 0, 2, 2}, // harem girl 2 - {1, 0, 45, 29, 0, 0, 0, 71, 163, 0, 169, 0, 0, 0}, // harem girl 3 - {1, 0, 7, 29, 0, 0, 0, 69, 164, 0, 4, 0, 0, 0}, // dog sergeant - {1, 0, 7, 29, 0, 0, 0, 70, 165, 0, 4, 0, 0, 0}, // throne dog guard 1 - {1, 0, 7, 257, 552, 408, 0, 70, 165, 0, 4, 0, 2, 2}, // throne dog guard 2 - {1, 0, 7, 29, 0, 0, 0, 70, 165, 0, 4, 0, 0, 0}, // throne dog guard 3 - {1, 0, 7, 29, 0, 0, 0, 70, 165, 0, 4, 0, 0, 0}, // throne dog guard 4 - {1, 0, 7, 257, 712, 380, 0, 69, 164, 0, 4, 0, 4, 4}, // throne dog guard 5 - {1, 0, 7, 29, 0, 0, 0, 69, 164, 0, 4, 0, 0, 0}, // throne dog guard 6 - {1, 0, 7, 29, 0, 0, 0, 69, 164, 0, 4, 0, 0, 0}, // throne dog guard 7 - {1, 0, 7, 29, 0, 0, 0, 69, 164, 0, 4, 0, 0, 0}, // throne dog guard 8 - {1, 0, 7, 29, 0, 0, 0, 69, 164, 0, 4, 0, 0, 0}, // throne dog guard 9 - {1, 0, 7, 0, 0, 0, 0, 69, 164, 0, 4, 0, 0, 0}, // throne dog guard 10 - {1, 0, 7, 29, 0, 0, 0, 70, 165, 0, 4, 0, 0, 0}, // throne dog guard 11 - {1, 0, 47, 30, 0, 0, 0, 102, 199, 1, 186, 0, 0, 0}, // old wolf ferryman - {1, 0, 48, 69, 0, 0, 0, 109, 202, 35, 26, 0, 0, 0}, // cat village wildcat - {1, 0, 49, 69, 0, 0, 0, 109, 202, 35, 26, 0, 0, 0}, // cat village attendant - {1, 0, 50, 69, 0, 0, 0, 111, 203, 16, 67, 0, 0, 0}, // cat village Prowwa - {1, 0, 51, 20, 0, 0, 0, 112, 204, 15, 26, 0, 0, 0}, // Prowwa hut Mirrhp - {1, 0, 50, 20, 0, 0, 0, 111, 203, 14, 67, 0, 0, 0}, // Prowwa hut Prowwa - {1, 0, 49, 20, 0, 0, 0, 109, 202, 35, 26, 0, 0, 0}, // Prowwa hut attendant - {1, 0, 48, 256, 0, 0, 0, 109, 202, 35, 26, 0, 0, 0}, // wildcat sentry - {1, 0, 21, 32, 0, 0, 0, 76, 171, 0, 171, 0, 0, 0}, // boar warrior 1 - {1, 0, 21, 32, 0, 0, 0, 76, 171, 0, 171, 0, 0, 0}, // boar warrior 2 - {1, 0, 21, 32, 0, 0, 0, 76, 171, 0, 171, 0, 0, 0}, // boar warrior 3 - {1, 0, 52, 15, 152, 400, 0, 108, 168, 19, 48, 10, 2, 2}, // Alamma's voice - {1, 0, 47, 251, 640, 360, 0, 113, 205, 5, 186, 10, 2, 2}, // ferry on ocean - {1, 0, 41, 75, 152, 400, 0, 100, 197, 5, 81, 0, 0, 0}, // Shiala - {1, 0, 44, 9, 0, 0, 0, 73, 160, 54, 112, 0, 0, 0}, // Prince (asleep) - {1, 0, 0, 22, -20, -20, 0, 118, 209, 0, 171, 0, 0, 0}, // Rif and Eeah (at rockslide) - {1, 0, 1, 22, 0, 0, 0, 119, 210, 0, 171, 0, 0, 0}, // Okk (at rockslide) - {1, 0, 0, 22, -20, -20, 0, 118, 209, 0, 171, 0, 0, 0}, // Rif and Eeah (at rockslide w. rope) - {1, 0, 1, 22, 0, 0, 0, 119, 210, 0, 171, 0, 0, 0}, // Okk (at rockslide w. rope) - {1, 0, 53, 42, 640, 400, 0, 104, 201, 8, 141, 0, 0, 0}, // Kylas Honeyfoot - {1, 0, 54, 21, -20, -20, 0, 120, 211, 48, 238, 0, 0, 0}, // Orb of Hands - {1, 0, 0, 4, -20, -20, 0, 42, 140, 0, 1, 0, 0, 0}, // Rif (muddy) - {1, 0, 26, 5, -20, -20, 27, 52, 148, 1, 5, 0, 4, 4}, // door rat (standing) - {1, 0, 36, 4, -20, -20, 0, 116, 207, 0, 155, 0, 0, 0}, // boar with Rhene 1 - {1, 0, 36, 0, -20, -20, 0, 117, 208, 0, 155, 0, 0, 0}, // boar with Rhene 2 - {1, 0, 46, 252, -20, -20, 0, 74, 162, 29, 34, 0, 0, 0}, // dog jailer - {1, 0, 0, 32, -20, -20, 0, 41, 137, 0, 1, 0, 0, 0}, // Rif (tourney) - {1, 0, 0, 259, -20, -20, 0, 44, 138, 0, 1, 0, 0, 0}, // cliff rat - {1, 0, 0, 5, -20, -20, 0, 43, 139, 0, 1, 0, 0, 0}, // Rif (cloaked) - {1, 0, 0, 31, -20, -20, 0, 39, 136, 0, 1, 0, 0, 0}, // Rif (oak tree scene) - {1, 0, 0, 252, -20, -20, 0, 39, 136, 0, 1, 0, 0, 0}, // Rif (jail cell scene) - {1, 0, 0, 15, -20, -20, 0, 39, 136, 0, 1, 0, 0, 0}, // Rif (outside Alamma's) - {1, 0, 0, 20, -20, -20, 0, 39, 136, 0, 1, 0, 0, 0}, // Rif (sick tent) - {1, 0, 0, 25, -20, -20, 0, 39, 136, 0, 1, 0, 0, 0}, // Rif (gem room) - {1, 0, 0, 272, -20, -20, 0, 40, 141, 0, 1, 0, 0, 0}, // Rif (dragon maze) - {1, 0, 0, 50, -20, -20, 0, 39, 136, 0, 1, 0, 0, 0}, // Rif (boar entry gate) - {1, 0, 50, 71, -20, -20, 0, 111, 203, 0, 67, 0, 0, 0}, // Prowwa (dog castle back) - {1, 0, 50, 274, -20, -20, 0, 111, 203, 0, 67, 0, 0, 0}, // Prowwa (cat festival) - {1, 0, 50, 274, -20, -20, 0, 110, 212, 0, 171, 0, 0, 0}, // cat festival dancer 1 - {1, 0, 50, 274, -20, -20, 0, 110, 212, 0, 171, 0, 0, 0}, // cat festival dancer 2 - {1, 0, 50, 274, -20, -20, 0, 110, 212, 0, 171, 0, 0, 0}, // cat festival dancer 3 - {1, 0, 57, 272, 909, 909, 48, 121, 213, 0, 171, 0, 0, 0}, // komodo dragon - {1, 0, 58, 15, -20, -20, 0, 122, 214, 0, 171, 0, 0, 0}, // letter from Elara - {1, 0, 37, 246, -20, -20, 0, 97, 194, 0, 141, 0, 0, 0}, // Gar (wolves' cage) - {1, 0, 38, 246, -20, -20, 0, 98, 195, 0, 27, 0, 0, 0}, // Wrah (wolves' cage) - {1, 0, 59, 246, -20, -20, 0, 103, 200, 0, 26, 0, 0, 0}, // Chota (wolves' cage) - {1, 0, 41, 245, -20, -20, 0, 100, 197, 0, 81, 0, 0, 0}, // Shiala (wolves' cage) - {1, 0, 47, 250, 640, 360, 0, 114, 205, 0, 186, 10, 2, 2}, // ferry on ocean - {1, 0, 0, 278, -20, -20, 0, 40, 141, 0, 1, 0, 0, 0}, // Rif (falling in tunnel trap door) - {1, 0, 0, 272, -20, -20, 0, 40, 141, 0, 1, 0, 0, 0}, // Rif (falling in dragon maze) - {1, 0, 41, 77, -20, -20, 0, 100, 197, 24, 81, 0, 0, 0}, // Shiala (grotto) - {1, 0, 37, 261, -20, -20, 0, 97, 194, 0, 141, 0, 0, 0}, // Gar (ambush) - {1, 0, 38, 261, -20, -20, 0, 98, 195, 0, 27, 0, 0, 0}, // Wrah (ambush) - {1, 0, 39, 261, -20, -20, 0, 99, 196, 0, 5, 0, 0, 0}, // dark claw wolf (ambush) - {1, 0, 39, 261, -20, -20, 0, 99, 196, 0, 5, 0, 0, 0}, // dark claw wolf (ambush) - {1, 0, 39, 261, -20, -20, 0, 99, 196, 0, 5, 0, 0, 0}, // dark claw wolf (ambush) - {1, 0, 39, 261, -20, -20, 0, 99, 196, 0, 5, 0, 0, 0}, // dark claw wolf (ambush) - {1, 0, 59, 279, -20, -20, 0, 103, 200, 0, 26, 0, 0, 0}, // Chota (top of dam) - {1, 0, 38, 279, -20, -20, 0, 98, 195, 0, 27, 0, 0, 0}, // Wrah (top of dam) - {1, 0, 42, 77, -20, -20, 0, 101, 198, 25, 171, 0, 0, 0}, // Shiala's spear - {1, 0, 59, 281, -20, -20, 0, 103, 200, 26, 26, 0, 0, 0}, // Chota (lab) - {1, 0, 59, 279, -20, -20, 0, 123, 215, 0, 1, 0, 0, 0}, // Rif (finale) - {1, 0, 59, 279, -20, -20, 0, 123, 215, 0, 132, 0, 0, 0}, // Okk (finale) - {1, 0, 59, 279, -20, -20, 0, 123, 215, 0, 161, 0, 0, 0}, // Eeah (finale) - {1, 0, 54, 279, -20, -20, 0, 120, 211, 0, 133, 0, 6, 6}, // Orb of Storms (top of dam) - {1, 0, 44, 9, -20, -20, 0, 124, 161, 0, 171, 0, 6, 6}, // Prince's snores - {1, 0, 7, 255, 588, 252, 0, 70, 165, 0, 3, 0, 2, 2}, // hall dog guard 1 - {1, 0, 7, 255, 696, 252, 0, 70, 165, 0, 5, 0, 6, 6}, // hall dog guard 2 - {1, 0, 36, 4, 0, 0, 0, 105, 142, 0, 155, 0, 0, 0}, // Rhene - {1, 0, 44, 272, 1124, 1124, 120, 72, 159, 0, 112, 0, 0, 0}, // Prince (dragon maze) - {1, 0, 7, 272, 1124, 1108, 120, 70, 165, 0, 4, 0, 0, 0}, // dog heckler 1 (dragon maze) - {1, 0, 7, 272, 1108, 1124, 120, 70, 165, 0, 4, 0, 0, 0}, // dog heckler 2 (dragon maze) - {1, 0, 29, 288, 508, 432, 0, 85, 187, 0, 112, 0, 4, 4}, // elk king (finale) - {1, 0, 29, 0, 508, 432, 0, 84, 186, 0, 99, 0, 4, 4}, // crowd voice 1 (finale) - {1, 0, 29, 0, 508, 432, 0, 84, 186, 0, 98, 0, 4, 4}, // crowd voice 2 (finale) - {1, 0, 29, 0, 508, 432, 0, 84, 186, 0, 104, 0, 4, 4}, // crowd voice 3 (finale) - {1, 0, 29, 0, 508, 432, 0, 84, 186, 0, 99, 0, 4, 4}, // crowd voice 4 (finale) - {1, 0, 36, 288, 0, 0, 0, 105, 142, 0, 155, 0, 0, 0}, // Rhene (finale) - {1, 0, 1, 27, -20, -20, 0, 47, 178, 0, 132, 0, 0, 0}, // Okk (temple gate) - {1, 0, 1, 252, -20, -20, 0, 47, 178, 0, 132, 0, 0, 0}, // Okk (jail cell) - {1, 0, 1, 25, -20, -20, 0, 47, 178, 0, 132, 0, 0, 0}, // Okk (gem room) - {1, 0, 1, 259, -20, -20, 0, 47, 178, 0, 132, 0, 0, 0}, // Okk (cliff) - {1, 0, 1, 279, -20, -20, 0, 47, 178, 0, 132, 0, 0, 0}, // Okk (dam top) - {1, 0, 1, 273, -20, -20, 0, 47, 178, 0, 132, 0, 0, 0}, // Okk (human ruins) - {1, 0, 1, 26, -20, -20, 0, 8, 178, 0, 171, 0, 0, 0}, // puzzle pieces - {1, 0, 1, 0, -20, -20, 0, 0, 0, 0, 50, 0, 0, 0}, // poker dog 1 - {1, 0, 1, 0, -20, -20, 0, 0, 0, 0, 82, 0, 0, 0}, // poker dog 2 - {1, 0, 1, 0, -20, -20, 0, 0, 0, 0, 35, 0, 0, 0}, // poker dog 3 - {1, 0, 9, 74, -20, -20, 0, 51, 145, 0, 5, 0, 0, 0} // sundial rat +ACTORTABLE ActorTable[ACTORCOUNT] = { +// flags name scene x y z spr frm scp col +// -------------- --- ---- ---- ----- ---- ---- ---- --- ---- --- -- -- + { kProtagonist , 0, 1, 0, 0, 0, 37, 135, 0, 1, 0, 0, 0}, // map party + { kFollower , 1, 0, 0, 0, 0, 0, 0, 1, 132, 0, 0, 0}, // Okk + { kFollower , 2, 0, 0, 0, 0, 48, 143, 2, 161, 0, 0, 0}, // Eeah + { 0 , 3, 0, 240, 480, 0, 115, 206, 0, 25, 0, 0, 0}, // albino ferret + { 0 , 4, 17, 368, 400, 0, 115, 206, 4, 49, 0, 0, 0}, // moneychanger + { 0 , 5, 11, 552, 412, 0, 54, 152, 1, 171, 0, 0, 0}, // Sist + { 0 , 17, 2, 1192, 888, 0, 57, 153, 17, 49, 0, 0, 0}, // worker ferret 1 + { 0 , 17, 2, 816, 1052, 0, 57, 153, 18, 49, 0, 0, 0}, // worker ferret 2 + { 0 , 17, 2, 928, 932, 0, 58, 153, 19, 49, 0, 0, 0}, // worker ferret 3 + { 0 , 17, 2, 1416, 1160, 0, 58, 153, 20, 49, 0, 0, 0}, // worker ferret 4 + { 0 , 19, 49, 1592, 1336, 0, 92, 175, 15, 162, 0, 0, 0}, // faire merchant 1 (bear) + { 0 , 20, 49, 744, 824, 0, 63, 156, 19, 112, 0, 4, 4}, // faire merchant 2 (ferret) + { 0 , 19, 0, 1592, 1336, 0, 92, 175, 0, 171, 0, 0, 0}, // faire merchant 3 + { 0 , 19, 0, 1592, 1336, 0, 92, 175, 0, 171, 0, 0, 0}, // faire merchant 4 + { 0 , 9, 49, 1560, 1624, 0, 94, 147, 18, 132, 0, 4, 4}, // faire goer 1a (rat) + { 0 , 56, 49, 1384, 792, 0, 95, 193, 20, 72, 0, 0, 0}, // faire goer 1b (otter) + { 0 , 19, 0, 1592, 1336, 0, 92, 175, 0, 171, 0, 0, 0}, // faire goer 2a + { 0 , 19, 0, 1592, 1336, 0, 92, 175, 0, 171, 0, 0, 0}, // faire goer 2b + { 0 , 19, 0, 1592, 1336, 0, 92, 175, 0, 171, 0, 0, 0}, // faire goer 3a + { 0 , 19, 0, 1592, 1336, 0, 92, 175, 0, 171, 0, 0, 0}, // faire goer 3b + { 0 , 19, 0, 1592, 1336, 0, 92, 175, 0, 171, 0, 0, 0}, // faire goer 4a + { 0 , 19, 0, 1592, 1336, 0, 92, 175, 0, 171, 0, 0, 0}, // faire goer 4b + { 0 , 18, 32, 764, 448, 0, 55, 150, 0, 48, 10, 4, 4}, // Scorry + { 0 , 35, 32, 0, 0, 0, 56, 151, 0, 112, 0, 0, 0}, // grand puzzler + { 0 , 36, 32, 0, 0, 0, 105, 142, 0, 155, 0, 0, 0}, // Rhene + { 0 , 32, 32, 0, 0, 0, 91, 190, 0, 98, 0, 0, 0}, // elk captain + { 0 , 31, 32, 0, 0, 0, 90, 189, 0, 171, 0, 0, 0}, // elk guard 1 + { 0 , 31, 32, 0, 0, 0, 90, 189, 0, 171, 0, 0, 0}, // elk guard 2 + { 0 , 31, 32, 0, 0, 0, 90, 189, 0, 171, 0, 0, 0}, // elk guard 3 + { 0 , 31, 32, 0, 0, 0, 79, 172, 0, 18, 0, 0, 0}, // boar sergeant + { 0 , 21, 50, 664, 400, 0, 76, 171, 2, 74, 0, 4, 4}, // boar sentry 1 + { 0 , 21, 50, 892, 428, 0, 76, 171, 2, 74, 0, 4, 4}, // boar sentry 2 + { 0 , 9, 51, 904, 936, 0, 51, 145, 35, 5, 0, 0, 0}, // hall rat 1 + { 0 , 9, 51, 872, 840, 0, 51, 145, 36, 5, 0, 0, 0}, // hall rat 2 + { 0 , 9, 51, 1432, 344, 0, 51, 145, 37, 5, 0, 0, 0}, // hall rat 3 + { 0 , 9, 51, 664, 472, 0, 51, 145, 38, 5, 0, 0, 0}, // hall rat 4 + { 0 , 10, 51, 1368, 1464, 0, 80, 146, 39, 147, 0, 0, 0}, // book rat 1 + { 0 , 10, 51, 1416, 1624, 0, 80, 146, 40, 147, 0, 0, 0}, // book rat 2 + { 0 , 10, 51, 1752, 120, 0, 80, 146, 41, 147, 0, 0, 0}, // book rat 3 + { 0 , 10, 51, 984, 408, 0, 80, 146, 42, 147, 0, 0, 0}, // book rat 4 + { 0 , 14, 52, 856, 376, 0, 82, 174, 8, 73, 0, 0, 0}, // grounds servant 1 + { 0 , 14, 52, 808, 664, 0, 82, 174, 9, 73, 0, 0, 0}, // grounds servant 2 + { 0 , 14, 52, 440, 568, 0, 82, 174, 10, 73, 0, 0, 0}, // grounds servant 3 + { 0 , 14, 52, 392, 776, 0, 82, 174, 11, 73, 0, 0, 0}, // grounds servant 4 + { 0 , 21, 4, 240, 384, 0, 79, 172, 0, 18, 0, 2, 2}, // boar sentry 3 (by doorway) + { 0 , 23, 4, 636, 268, 0, 77, 173, 0, 74, 0, 4, 4}, // boar courtier + { 0 , 22, 4, 900, 320, 0, 78, 179, 0, 60, 0, 4, 4}, // boar king + { 0 , 14, 4, 788, 264, 0, 75, 170, 0, 171, 0, 2, 2}, // boar servant 1 + { 0 , 14, 4, 1088, 264, 0, 75, 170, 0, 171, 0, 6, 6}, // boar servant 2 + { 0 , 24, 19, 728, 396, 0, 65, 181, 47, 146, 0, 6, 6}, // glass master + { 0 , 24, 21, -20, -20, 0, 66, 182, 0, 146, 0, 4, 4}, // glass master (with orb) + { kCycle , 25, 19, 372, 464, 0, 67, 183, 73, 146, 0, 2, 2}, // glass worker + { 0 , 26, 5, 564, 476, 27, 53, 149, 1, 5, 0, 4, 4}, // door rat + { kCycle , 27, 31, 868, 344, 0, 81, 180, 0, 171, 0, 4, 4}, // bees + { 0 , 28, 73, 568, 380, 0, 83, 176, 30, 120, 0, 4, 4}, // fortune teller + { 0 , 14, 7, 808, 480, 0, 82, 174, 9, 73, 0, 0, 0}, // orb messenger + { 0 , 29, 10, 508, 432, 0, 84, 186, 6, 112, 0, 4, 4}, // elk king + { 0 , 33, 10, 676, 420, 0, 86, 184, 6, 171, 0, 4, 4}, // elk chancellor + { 0 , 30, 10, 388, 452, 0, 88, 185, 6, 171, 0, 4, 4}, // elk courtier 1 + { 0 , 30, 10, 608, 444, 0, 89, 185, 6, 171, 0, 4, 4}, // elk courtier 2 + { 0 , 31, 10, 192, 468, 0, 90, 189, 6, 171, 0, 4, 4}, // elk throne guard 1 + { 0 , 31, 10, 772, 432, 0, 90, 189, 6, 171, 0, 4, 4}, // elk throne guard 2 + { 0 , 14, 10, 1340, 444, 0, 87, 188, 6, 171, 0, 4, 4}, // elk servant + { 0 , 20, 18, 808, 360, 7, 60, 154, 64, 88, 0, 4, 4}, // hardware ferret + { 0 , 34, 49, 1128, 1256, 0, 96, 191, 16, 35, 0, 4, 4}, // porcupine + { 0 , 34, 49, 1384, 792, 0, 93, 192, 17, 66, 0, 4, 4}, // faire ram + { 0 , 24, 21, 0, -40, 0, 65, 181, 50, 146, 0, 6, 6}, // glass master 2 + { 0 , 3, 21, 0, -40, 0, 64, 158, 49, 112, 0, 0, 0}, // Sakka + { 0 , 17, 21, 0, -40, 0, 62, 157, 74, 48, 0, 0, 0}, // lodge ferret 1 + { 0 , 17, 21, 0, -40, 0, 62, 157, 74, 49, 0, 0, 0}, // lodge ferret 2 + { 0 , 17, 21, 0, -40, 0, 62, 157, 74, 50, 0, 0, 0}, // lodge ferret 3 + { 0 , 12, 244, 1056, 504, 0, 107, 167, 21, 124, 0, 6, 6}, // Elara + { 0 , 8, 33, 248, 440, 0, 68, 169, 14, 112, 0, 0, 0}, // Tycho + { 0 , 11, 23, 308, 424, 0, 106, 166, 6, 48, 0, 2, 2}, // Alamma + { 0 , 17, 2, 1864, 1336, 0, 58, 153, 21, 49, 0, 0, 0}, // worker ferret 5 + { 0 , 17, 2, 760, 216, 0, 58, 153, 22, 49, 0, 0, 0}, // worker ferret 6 + { 0 , 44, 29, 0, 0, 0, 72, 159, 0, 112, 0, 0, 0}, // Prince + { 0 , 45, 29, 0, 0, 0, 71, 163, 0, 146, 0, 6, 6}, // harem girl 1 + { 0 , 45, 29, 0, 0, 0, 71, 163, 0, 124, 0, 2, 2}, // harem girl 2 + { 0 , 45, 29, 0, 0, 0, 71, 163, 0, 169, 0, 0, 0}, // harem girl 3 + { 0 , 7, 29, 0, 0, 0, 69, 164, 0, 4, 0, 0, 0}, // dog sergeant + { 0 , 7, 29, 0, 0, 0, 70, 165, 0, 4, 0, 0, 0}, // throne dog guard 1 + { 0 , 7, 257, 552, 408, 0, 70, 165, 0, 4, 0, 2, 2}, // throne dog guard 2 + { 0 , 7, 29, 0, 0, 0, 70, 165, 0, 4, 0, 0, 0}, // throne dog guard 3 + { 0 , 7, 29, 0, 0, 0, 70, 165, 0, 4, 0, 0, 0}, // throne dog guard 4 + { 0 , 7, 257, 712, 380, 0, 69, 164, 0, 4, 0, 4, 4}, // throne dog guard 5 + { 0 , 7, 29, 0, 0, 0, 69, 164, 0, 4, 0, 0, 0}, // throne dog guard 6 + { 0 , 7, 29, 0, 0, 0, 69, 164, 0, 4, 0, 0, 0}, // throne dog guard 7 + { 0 , 7, 29, 0, 0, 0, 69, 164, 0, 4, 0, 0, 0}, // throne dog guard 8 + { 0 , 7, 29, 0, 0, 0, 69, 164, 0, 4, 0, 0, 0}, // throne dog guard 9 + { 0 , 7, 0, 0, 0, 0, 69, 164, 0, 4, 0, 0, 0}, // throne dog guard 10 + { 0 , 7, 29, 0, 0, 0, 70, 165, 0, 4, 0, 0, 0}, // throne dog guard 11 + { 0 , 47, 30, 0, 0, 0, 102, 199, 1, 186, 0, 0, 0}, // old wolf ferryman + { 0 , 48, 69, 0, 0, 0, 109, 202, 35, 26, 0, 0, 0}, // cat village wildcat + { 0 , 49, 69, 0, 0, 0, 109, 202, 35, 26, 0, 0, 0}, // cat village attendant + { 0 , 50, 69, 0, 0, 0, 111, 203, 16, 67, 0, 0, 0}, // cat village Prowwa + { 0 , 51, 20, 0, 0, 0, 112, 204, 15, 26, 0, 0, 0}, // Prowwa hut Mirrhp + { 0 , 50, 20, 0, 0, 0, 111, 203, 14, 67, 0, 0, 0}, // Prowwa hut Prowwa + { 0 , 49, 20, 0, 0, 0, 109, 202, 35, 26, 0, 0, 0}, // Prowwa hut attendant + { 0 , 48, 256, 0, 0, 0, 109, 202, 35, 26, 0, 0, 0}, // wildcat sentry + { 0 , 21, 32, 0, 0, 0, 76, 171, 0, 171, 0, 0, 0}, // boar warrior 1 + { 0 , 21, 32, 0, 0, 0, 76, 171, 0, 171, 0, 0, 0}, // boar warrior 2 + { 0 , 21, 32, 0, 0, 0, 76, 171, 0, 171, 0, 0, 0}, // boar warrior 3 + { 0 , 52, 15, 152, 400, 0, 108, 168, 19, 48, 10, 2, 2}, // Alamma's voice + { 0 , 47, 251, 640, 360, 0, 113, 205, 5, 186, 10, 2, 2}, // ferry on ocean + { 0 , 41, 75, 152, 400, 0, 100, 197, 5, 81, 0, 0, 0}, // Shiala + { 0 , 44, 9, 0, 0, 0, 73, 160, 54, 112, 0, 0, 0}, // Prince (asleep) + { 0 , 0, 22, -20, -20, 0, 118, 209, 0, 171, 0, 0, 0}, // Rif and Eeah (at rockslide) + { 0 , 1, 22, 0, 0, 0, 119, 210, 0, 171, 0, 0, 0}, // Okk (at rockslide) + { 0 , 0, 22, -20, -20, 0, 118, 209, 0, 171, 0, 0, 0}, // Rif and Eeah (at rockslide w. rope) + { 0 , 1, 22, 0, 0, 0, 119, 210, 0, 171, 0, 0, 0}, // Okk (at rockslide w. rope) + { 0 , 53, 42, 640, 400, 0, 104, 201, 8, 141, 0, 0, 0}, // Kylas Honeyfoot + { 0 , 54, 21, -20, -20, 0, 120, 211, 48, 238, 0, 0, 0}, // Orb of Hands + { 0 , 0, 4, -20, -20, 0, 42, 140, 0, 1, 0, 0, 0}, // Rif (muddy) + { 0 , 26, 5, -20, -20, 27, 52, 148, 1, 5, 0, 4, 4}, // door rat (standing) + { 0 , 36, 4, -20, -20, 0, 116, 207, 0, 155, 0, 0, 0}, // boar with Rhene 1 + { 0 , 36, 0, -20, -20, 0, 117, 208, 0, 155, 0, 0, 0}, // boar with Rhene 2 + { 0 , 46, 252, -20, -20, 0, 74, 162, 29, 34, 0, 0, 0}, // dog jailer + { 0 , 0, 32, -20, -20, 0, 41, 137, 0, 1, 0, 0, 0}, // Rif (tourney) + { 0 , 0, 259, -20, -20, 0, 44, 138, 0, 1, 0, 0, 0}, // cliff rat + { 0 , 0, 5, -20, -20, 0, 43, 139, 0, 1, 0, 0, 0}, // Rif (cloaked) + { 0 , 0, 31, -20, -20, 0, 39, 136, 0, 1, 0, 0, 0}, // Rif (oak tree scene) + { 0 , 0, 252, -20, -20, 0, 39, 136, 0, 1, 0, 0, 0}, // Rif (jail cell scene) + { 0 , 0, 15, -20, -20, 0, 39, 136, 0, 1, 0, 0, 0}, // Rif (outside Alamma's) + { 0 , 0, 20, -20, -20, 0, 39, 136, 0, 1, 0, 0, 0}, // Rif (sick tent) + { 0 , 0, 25, -20, -20, 0, 39, 136, 0, 1, 0, 0, 0}, // Rif (gem room) + { 0 , 0, 272, -20, -20, 0, 40, 141, 0, 1, 0, 0, 0}, // Rif (dragon maze) + { 0 , 0, 50, -20, -20, 0, 39, 136, 0, 1, 0, 0, 0}, // Rif (boar entry gate) + { 0 , 50, 71, -20, -20, 0, 111, 203, 0, 67, 0, 0, 0}, // Prowwa (dog castle back) + { 0 , 50, 274, -20, -20, 0, 111, 203, 0, 67, 0, 0, 0}, // Prowwa (cat festival) + { 0 , 50, 274, -20, -20, 0, 110, 212, 0, 171, 0, 0, 0}, // cat festival dancer 1 + { 0 , 50, 274, -20, -20, 0, 110, 212, 0, 171, 0, 0, 0}, // cat festival dancer 2 + { 0 , 50, 274, -20, -20, 0, 110, 212, 0, 171, 0, 0, 0}, // cat festival dancer 3 + { 0 , 57, 272, 909, 909, 48, 121, 213, 0, 171, 0, 0, 0}, // komodo dragon + { 0 , 58, 15, -20, -20, 0, 122, 214, 0, 171, 0, 0, 0}, // letter from Elara + { 0 , 37, 246, -20, -20, 0, 97, 194, 0, 141, 0, 0, 0}, // Gar (wolves' cage) + { 0 , 38, 246, -20, -20, 0, 98, 195, 0, 27, 0, 0, 0}, // Wrah (wolves' cage) + { 0 , 59, 246, -20, -20, 0, 103, 200, 0, 26, 0, 0, 0}, // Chota (wolves' cage) + { 0 , 41, 245, -20, -20, 0, 100, 197, 0, 81, 0, 0, 0}, // Shiala (wolves' cage) + { 0 , 47, 250, 640, 360, 0, 114, 205, 0, 186, 10, 2, 2}, // ferry on ocean + { 0 , 0, 278, -20, -20, 0, 40, 141, 0, 1, 0, 0, 0}, // Rif (falling in tunnel trap door) + { 0 , 0, 272, -20, -20, 0, 40, 141, 0, 1, 0, 0, 0}, // Rif (falling in dragon maze) + { 0 , 41, 77, -20, -20, 0, 100, 197, 24, 81, 0, 0, 0}, // Shiala (grotto) + { 0 , 37, 261, -20, -20, 0, 97, 194, 0, 141, 0, 0, 0}, // Gar (ambush) + { 0 , 38, 261, -20, -20, 0, 98, 195, 0, 27, 0, 0, 0}, // Wrah (ambush) + { 0 , 39, 261, -20, -20, 0, 99, 196, 0, 5, 0, 0, 0}, // dark claw wolf (ambush) + { 0 , 39, 261, -20, -20, 0, 99, 196, 0, 5, 0, 0, 0}, // dark claw wolf (ambush) + { 0 , 39, 261, -20, -20, 0, 99, 196, 0, 5, 0, 0, 0}, // dark claw wolf (ambush) + { 0 , 39, 261, -20, -20, 0, 99, 196, 0, 5, 0, 0, 0}, // dark claw wolf (ambush) + { 0 , 59, 279, -20, -20, 0, 103, 200, 0, 26, 0, 0, 0}, // Chota (top of dam) + { 0 , 38, 279, -20, -20, 0, 98, 195, 0, 27, 0, 0, 0}, // Wrah (top of dam) + { 0 , 42, 77, -20, -20, 0, 101, 198, 25, 171, 0, 0, 0}, // Shiala's spear + { 0 , 59, 281, -20, -20, 0, 103, 200, 26, 26, 0, 0, 0}, // Chota (lab) + { 0 , 59, 279, -20, -20, 0, 123, 215, 0, 1, 0, 0, 0}, // Rif (finale) + { 0 , 59, 279, -20, -20, 0, 123, 215, 0, 132, 0, 0, 0}, // Okk (finale) + { 0 , 59, 279, -20, -20, 0, 123, 215, 0, 161, 0, 0, 0}, // Eeah (finale) + { 0 , 54, 279, -20, -20, 0, 120, 211, 0, 133, 0, 6, 6}, // Orb of Storms (top of dam) + { 0 , 44, 9, -20, -20, 0, 124, 161, 0, 171, 0, 6, 6}, // Prince's snores + { 0 , 7, 255, 588, 252, 0, 70, 165, 0, 3, 0, 2, 2}, // hall dog guard 1 + { 0 , 7, 255, 696, 252, 0, 70, 165, 0, 5, 0, 6, 6}, // hall dog guard 2 + { 0 , 36, 4, 0, 0, 0, 105, 142, 0, 155, 0, 0, 0}, // Rhene + { 0 , 44, 272, 1124, 1124, 120, 72, 159, 0, 112, 0, 0, 0}, // Prince (dragon maze) + { 0 , 7, 272, 1124, 1108, 120, 70, 165, 0, 4, 0, 0, 0}, // dog heckler 1 (dragon maze) + { 0 , 7, 272, 1108, 1124, 120, 70, 165, 0, 4, 0, 0, 0}, // dog heckler 2 (dragon maze) + { 0 , 29, 288, 508, 432, 0, 85, 187, 0, 112, 0, 4, 4}, // elk king (finale) + { 0 , 29, 0, 508, 432, 0, 84, 186, 0, 99, 0, 4, 4}, // crowd voice 1 (finale) + { 0 , 29, 0, 508, 432, 0, 84, 186, 0, 98, 0, 4, 4}, // crowd voice 2 (finale) + { 0 , 29, 0, 508, 432, 0, 84, 186, 0, 104, 0, 4, 4}, // crowd voice 3 (finale) + { 0 , 29, 0, 508, 432, 0, 84, 186, 0, 99, 0, 4, 4}, // crowd voice 4 (finale) + { 0 , 36, 288, 0, 0, 0, 105, 142, 0, 155, 0, 0, 0}, // Rhene (finale) + { 0 , 1, 27, -20, -20, 0, 47, 178, 0, 132, 0, 0, 0}, // Okk (temple gate) + { 0 , 1, 252, -20, -20, 0, 47, 178, 0, 132, 0, 0, 0}, // Okk (jail cell) + { 0 , 1, 25, -20, -20, 0, 47, 178, 0, 132, 0, 0, 0}, // Okk (gem room) + { 0 , 1, 259, -20, -20, 0, 47, 178, 0, 132, 0, 0, 0}, // Okk (cliff) + { 0 , 1, 279, -20, -20, 0, 47, 178, 0, 132, 0, 0, 0}, // Okk (dam top) + { 0 , 1, 273, -20, -20, 0, 47, 178, 0, 132, 0, 0, 0}, // Okk (human ruins) + { 0 , 1, 26, -20, -20, 0, 8, 178, 0, 171, 0, 0, 0}, // puzzle pieces + { 0 , 1, 0, -20, -20, 0, 0, 0, 0, 50, 0, 0, 0}, // poker dog 1 + { 0 , 1, 0, -20, -20, 0, 0, 0, 0, 82, 0, 0, 0}, // poker dog 2 + { 0 , 1, 0, -20, -20, 0, 0, 0, 0, 35, 0, 0, 0}, // poker dog 3 + { 0 , 9, 74, -20, -20, 0, 51, 145, 0, 5, 0, 0, 0} // sundial rat }; } // End of namespace Saga diff --git a/saga/actordata.h b/saga/actordata.h index 99698cbe64..c6d1502c53 100644 --- a/saga/actordata.h +++ b/saga/actordata.h @@ -41,17 +41,16 @@ enum { // sure if I got it right. struct ACTORTABLE { - byte type; // Always 1 (remove this?) byte flags; - byte name_index; - int32 scene_index; + byte nameIndex; + int32 sceneIndex; int16 x; int16 y; int16 z; - int32 spritelist_rn; - int32 spriteindex_rn; - byte script_rn; - byte color; + int32 spriteListResourceId; + int32 frameListResourceId; + byte scriptResourceId; + byte speechColor; byte action; byte facing_dir; byte action_dir; diff --git a/saga/console.cpp b/saga/console.cpp index d16ad84972..a70fb77108 100644 --- a/saga/console.cpp +++ b/saga/console.cpp @@ -47,8 +47,6 @@ Console::Console(SagaEngine *vm) : Common::Debugger<Console>() { // CVAR_Register_I(&_musicEnabled, "music", NULL, CVAR_CFG, 0, 1); // Actor commands - DCmd_Register("actor_add", &Console::Cmd_ActorAdd); - DCmd_Register("actor_del", &Console::Cmd_ActorDel); DCmd_Register("actor_move", &Console::Cmd_ActorMove); DCmd_Register("actor_moverel", &Console::Cmd_ActorMoveRel); DCmd_Register("actor_seto", &Console::Cmd_ActorSetO); @@ -137,22 +135,6 @@ bool Console::Cmd_Help(int argc, const char **argv) { return true; } -bool Console::Cmd_ActorAdd(int argc, const char **argv) { - if (argc != 4) - DebugPrintf("Usage: %s <Actor id> <lx> <ly>\n", argv[0]); - else - _vm->_actor->CF_actor_add(argc, argv); - return true; -} - -bool Console::Cmd_ActorDel(int argc, const char **argv) { - if (argc != 2) - DebugPrintf("Usage: %s <Actor id>\n", argv[0]); - else - _vm->_actor->CF_actor_del(argc, argv); - return true; -} - bool Console::Cmd_ActorMove(int argc, const char **argv) { if (argc != 4) DebugPrintf("Usage: %s <Actor id> <lx> <ly>\n", argv[0]); diff --git a/saga/console.h b/saga/console.h index ad522a7af3..3dec60ef9a 100644 --- a/saga/console.h +++ b/saga/console.h @@ -43,8 +43,6 @@ private: bool Cmd_Exit(int argc, const char **argv); bool Cmd_Help(int argc, const char **argv); - bool Cmd_ActorAdd(int argc, const char **argv); - bool Cmd_ActorDel(int argc, const char **argv); bool Cmd_ActorMove(int argc, const char **argv); bool Cmd_ActorMoveRel(int argc, const char **argv); bool Cmd_ActorSetO(int argc, const char **argv); diff --git a/saga/interface.cpp b/saga/interface.cpp index b3c0044caf..1cd90593aa 100644 --- a/saga/interface.cpp +++ b/saga/interface.cpp @@ -573,7 +573,7 @@ int Interface::handlePlayfieldClick(SURFACE *ds, const Point& imousePt) { if (objectNum == -1) { // Player clicked on empty spot - walk here regardless of verb - _vm->_actor->StoA(&iactor_pt, imousePt); + _vm->_actor->StoA(iactor_pt, imousePt); _vm->_actor->walkTo(0, &iactor_pt, 0, NULL); return SUCCESS; } @@ -592,7 +592,7 @@ int Interface::handlePlayfieldClick(SURFACE *ds, const Point& imousePt) { } } else { // Not a normal scene object - walk to it as if it weren't there - _vm->_actor->StoA(&iactor_pt, imousePt); + _vm->_actor->StoA(iactor_pt, imousePt); _vm->_actor->walkTo(0, &iactor_pt, 0, NULL); } diff --git a/saga/sfuncs.cpp b/saga/sfuncs.cpp index e6680cfdbc..d00ab6e8a8 100644 --- a/saga/sfuncs.cpp +++ b/saga/sfuncs.cpp @@ -254,9 +254,6 @@ int Script::SF_setFacing(SCRIPTFUNC_PARAMS) { actorId = _vm->_sdata->readWordS(actor_parm); orientation = _vm->_sdata->readWordS(orient_parm); - if (!_vm->_actor->actorExists(actorId)) { - _vm->_actor->create(actorId, 0, 0); - } _vm->_actor->setOrientation(actorId, orientation); return SUCCESS; } @@ -531,11 +528,7 @@ int Script::SF_moveTo(SCRIPTFUNC_PARAMS) { pt.x = _vm->_sdata->readWordS(x_parm); pt.y = _vm->_sdata->readWordS(y_parm); - if (!_vm->_actor->actorExists(actorId)) { - _vm->_actor->create(actorId, pt.x, pt.y); - } else { - _vm->_actor->move(actorId, &pt); - } + _vm->_actor->move(actorId, pt); return SUCCESS; } @@ -672,19 +665,19 @@ int Script::SF_cycleActorFrames(SCRIPTFUNC_PARAMS) { int Script::SF_setFrame(SCRIPTFUNC_PARAMS) { // INCOMPLETE - SDataWord_T actor_parm; - SDataWord_T frame_parm; - SDataWord_T action_parm; + SDataWord_T actorParam; + SDataWord_T actionParam; + SDataWord_T frameParam; uint16 actorId; int action; - actor_parm = thread->pop(); - action_parm = thread->pop(); - frame_parm = thread->pop(); + actorParam = thread->pop(); + actionParam = thread->pop(); + frameParam = thread->pop(); - actorId = _vm->_sdata->readWordS(actor_parm); - action = _vm->_sdata->readWordS(action_parm); + actorId = _vm->_sdata->readWordS(actorParam); + action = _vm->_sdata->readWordS(actionParam); _vm->_actor->setAction(actorId, action, ACTION_NONE); @@ -783,11 +776,8 @@ int Script::SF_placeActor(SCRIPTFUNC_PARAMS) { pt.y = _vm->_sdata->readWordS(y_parm); action_state = _vm->_sdata->readWordS(action_parm); - if (!_vm->_actor->actorExists(actorId)) { - _vm->_actor->create(actorId, pt.x, pt.y); - } else { - _vm->_actor->move(actorId, &pt); - } + _vm->_actor->move(actorId, pt); + if (action_state < 0) action_state = ACTION_IDLE; _vm->_actor->setDefaultAction(actorId, action_state, ACTION_NONE); diff --git a/saga/sthread.cpp b/saga/sthread.cpp index 2df3ee9633..cca11ec39e 100644 --- a/saga/sthread.cpp +++ b/saga/sthread.cpp @@ -355,7 +355,7 @@ int Script::SThreadRun(SCRIPT_THREAD *thread, int instr_limit) { if (func_num >= SFUNC_NUM) { _vm->_console->DebugPrintf(S_ERROR_PREFIX "Invalid script function number: (%X)\n", func_num); thread->flags |= kTFlagAborted; - debug(9, "Invalid script function number: (%X)\n", func_num); + debug( 9, "Invalid script function number: (%X)\n", func_num); break; } @@ -363,7 +363,7 @@ int Script::SThreadRun(SCRIPT_THREAD *thread, int instr_limit) { sfuncRetVal = (this->*sfunc)(thread, n_args); if (sfuncRetVal != SUCCESS) { _vm->_console->DebugPrintf(S_WARN_PREFIX "%X: Script function %d failed.\n", thread->i_offset, func_num); - debug(9, "%X: Script function %d failed.\n", thread->i_offset, func_num); + debug( 9, "%X: Script function %d failed.\n", thread->i_offset, func_num); } if (func_num == 16) { // SF_gotoScene @@ -393,7 +393,7 @@ int Script::SThreadRun(SCRIPT_THREAD *thread, int instr_limit) { if (thread->stackSize() == 0) { _vm->_console->DebugPrintf("Script execution complete.\n"); thread->flags |= kTFlagFinished; - debug(9, "Script execution complete.\n"); + debug( 9, "Script execution complete.\n"); } else { thread->i_offset = thread->pop(); /* int n_args = */ thread->pop(); |