AVALANCHE: Some renaming in Animation.

This commit is contained in:
uruk 2013-09-08 11:34:21 +02:00
parent 1b25defe34
commit aafaaef37f
9 changed files with 54 additions and 183 deletions

View file

@ -407,7 +407,7 @@ void Acci::storeInterrogation(byte interrogation) {
_vm->_gyro->_dna._spareEvening.clear();
_vm->_gyro->_dna._spareEvening = _vm->_parser->_inputText;
_vm->_visa->displayScrollChain('z', 5); // His closing statement...
_vm->_animation->tr[1].walkto(4); // The end of the drawbridge
_vm->_animation->tr[1].walkTo(4); // The end of the drawbridge
_vm->_animation->tr[1]._vanishIfStill = true; // Then go away!
_vm->_gyro->_magics[1]._operation = _vm->_gyro->kMagicNothing;
_vm->_gyro->_dna._cardiffQuestionNum = 5;
@ -1042,7 +1042,7 @@ void Acci::notInOrder() {
void Acci::goToCauldron() {
_vm->_animation->tr[1]._callEachStepFl = false; // Stops Geida_Procs.
_vm->_timeout->addTimer(1, _vm->_timeout->kProcSpludwickGoesToCauldron, _vm->_timeout->kReasonSpludWalk);
_vm->_animation->tr[1].walkto(2);
_vm->_animation->tr[1].walkTo(2);
}
/**
@ -1702,7 +1702,7 @@ void Acci::doThat() {
else {
_vm->_animation->tr[1].init(1, false, _vm->_animation); // Avaricius
_vm->_animation->apped(2, 4);
_vm->_animation->tr[1].walkto(5);
_vm->_animation->tr[1].walkTo(5);
_vm->_animation->tr[1]._callEachStepFl = true;
_vm->_animation->tr[1]._eachStepProc = _vm->_animation->kProcBackAndForth;
_vm->_gyro->_dna._avariciusTalk = 14;
@ -1861,7 +1861,7 @@ void Acci::doThat() {
_vm->_lucerna->refreshObjectList();
_vm->_gyro->_magics[11]._operation = _vm->_gyro->kMagicNothing;
_vm->_lucerna->incScore(7);
_vm->_animation->tr[1].walkto(2);
_vm->_animation->tr[1].walkTo(2);
_vm->_animation->tr[1]._vanishIfStill = true;
_vm->_animation->tr[1]._callEachStepFl = false;
_vm->_gyro->_whereIs[7] = 177;
@ -1984,7 +1984,7 @@ void Acci::doThat() {
if (_vm->_gyro->_dna._sittingInPub)
_vm->_scrolls->displayText("You're already sitting!");
else {
_vm->_animation->tr[0].walkto(4); // Move Avvy to the place, and sit him down.
_vm->_animation->tr[0].walkTo(4); // Move Avvy to the place, and sit him down.
_vm->_timeout->addTimer(1, _vm->_timeout->kProcAvvySitDown, _vm->_timeout->kReasonSittingDown);
}
} else { // Default doodah.

View file

@ -192,15 +192,13 @@ void AnimationType::walk() {
r._y1 = _y - 2;
r._x2 = ((_x + _info._xLength) / 8) + 1;
r._y2 = _y + _info._yLength + 2;
_tr->getset[1 - _tr->_vm->_gyro->_cp].remember(r);
}
if (!_tr->_vm->_gyro->_doingSpriteRun) {
_oldX[_tr->_vm->_gyro->_cp] = _x;
_oldY[_tr->_vm->_gyro->_cp] = _y;
if (_homing)
homestep();
homeStep();
_x += _moveX;
_y += _moveY;
}
@ -275,7 +273,7 @@ int8 AnimationType::sgn(int16 val) {
return 0;
}
void AnimationType::walkto(byte pednum) {
void AnimationType::walkTo(byte pednum) {
pednum--; // Pascal -> C conversion: different array indexes.
speed(sgn(_tr->_vm->_gyro->_peds[pednum]._x - _x) * 4, sgn(_tr->_vm->_gyro->_peds[pednum]._y - _y));
_homingX = _tr->_vm->_gyro->_peds[pednum]._x - _info._xLength / 2;
@ -287,7 +285,7 @@ void AnimationType::stophoming() {
_homing = false;
}
void AnimationType::homestep() {
void AnimationType::homeStep() {
int16 temp;
if ((_homingX == _x) && (_homingY == _y)) {
@ -349,73 +347,7 @@ void AnimationType::chatter() {
_tr->_vm->_gyro->_talkBackgroundColor = _stat._bgBubbleCol;
}
/**
* Init Saver structure
* @remarks Originally called 'set_up_saver'
*/
void AnimationType::setupSaver(AnimationSaver &sav) {
sav._id = _id;
sav._facingDir = _facingDir;
sav._stepNum = _stepNum;
sav._x = _x;
sav._y = _y;
sav._moveX = _moveX;
sav._moveY = _moveY;
sav._visible = _visible;
sav._homing = _homing;
sav._doCheck = _doCheck;
sav._count = _count;
sav._xWidth = _info._xWidth;
sav._speedX = _speedX;
sav._speedY = _speedY;
sav._animCount = _animCount;
sav._homingX = _homingX;
sav._homingY = _homingY;
sav._callEachStepFl = _callEachStepFl;
sav._eachStepProc = _eachStepProc;
sav._vanishIfStill = _vanishIfStill;
}
void AnimationType::unload_saver(AnimationSaver sav) {
_id = sav._id;
_facingDir = sav._facingDir;
_stepNum = sav._stepNum;
_x = sav._x;
_y = sav._y;
_moveX = sav._moveX;
_moveY = sav._moveY;
_visible = sav._visible;
_homing = sav._homing;
_doCheck = sav._doCheck;
_count = sav._count;
_info._xWidth = sav._xWidth;
_speedX = sav._speedX;
_speedY = sav._speedY;
_animCount = sav._animCount;
_homingX = sav._homingX;
_homingY = sav._homingY;
_callEachStepFl = sav._callEachStepFl;
_eachStepProc = sav._eachStepProc;
_vanishIfStill = sav._vanishIfStill;
}
void AnimationType::savedata(Common::File &f) {
warning("STUB: triptype::savedata()");
}
void AnimationType::loaddata(Common::File &f) {
warning("STUB: triptype::loaddata()");
}
void AnimationType::save_data_to_mem(uint16 &where) {
warning("STUB: triptype::save_data_to_mem()");
}
void AnimationType::load_data_from_mem(uint16 &where) {
warning("STUB: triptype::load_data_from_mem()");
}
AnimationType *AnimationType::done() {
void AnimationType::done() {
_animCount--;
_info._xWidth = _info._xLength / 8;
if ((_info._xLength % 8) > 0)
@ -429,30 +361,11 @@ AnimationType *AnimationType::done() {
_quick = false;
_id = 177;
return this;
}
getsettype *getsettype::init() {
numleft = 0; // initialize array pointer
return this;
}
void getsettype::remember(ByteField r) {
numleft++;
//if (numleft > maxgetset)
// error("Trip::remember() : runerr_Getset_Overflow");
gs[numleft] = r;
}
void getsettype::recall(ByteField &r) {
r = gs[numleft];
numleft--;
}
Animation::Animation(AvalancheEngine *vm) {
_vm = vm;
getsetclear();
mustexclaim = false;
}
@ -863,7 +776,7 @@ void Animation::call_special(uint16 which) {
if (!_vm->_gyro->_dna._arrowTriggered) {
_vm->_gyro->_dna._arrowTriggered = true;
apped(2, 4); // The dart starts at ped 4, and...
tr[1].walkto(5); // flies to ped 5.
tr[1].walkTo(5); // flies to ped 5.
tr[1]._facingDir = kDirUp; // Only face.
// Should call some kind of Eachstep procedure which will deallocate
// the sprite when it hits the wall, and replace it with the chunk
@ -891,7 +804,7 @@ void Animation::call_special(uint16 which) {
_vm->_visa->displayScrollChain('q', 36);
_vm->_gyro->_dna._tiedUp = true;
_vm->_gyro->_dna._friarWillTieYouUp = false;
tr[1].walkto(3);
tr[1].walkTo(3);
tr[1]._vanishIfStill = true;
tr[1]._doCheck = true; // One of them must have Check_Me switched on.
_vm->_gyro->_whereIs[_vm->_gyro->kPeopleFriarTuck - 150] = 177; // Not here, then.
@ -928,7 +841,7 @@ void Animation::call_special(uint16 which) {
if (!_vm->_gyro->_dna._geidaFollows)
return; // DOESN'T COUNT: no Geida.
tr[1]._callEachStepFl = false; // She no longer follows Avvy around.
tr[1].walkto(4); // She walks to somewhere...
tr[1].walkTo(4); // She walks to somewhere...
tr[0].done(); // Lose Avvy.
_vm->_gyro->_dna._userMovesAvvy = false;
_vm->_timeout->addTimer(40, _vm->_timeout->kProcRobinHoodAndGeida, _vm->_timeout->kReasonRobinHoodAndGeida);
@ -1074,10 +987,6 @@ void Animation::newspeed() {
_vm->_graphics->_surface.drawLine(371, 199, 373, 199, kColorLightblue);
//setactivepage(1 - cp);
for (byte i = 0; i <= 1; i++)
getset[i].remember(lightspace);
}
void Animation::rwsp(byte t, byte dir) {
@ -1173,9 +1082,9 @@ void Animation::follow_avvy_y(byte tripnum) {
void Animation::back_and_forth(byte tripnum) {
if (!tr[tripnum]._homing) {
if (tr[tripnum]._facingDir == kDirRight)
tr[tripnum].walkto(4);
tr[tripnum].walkTo(4);
else
tr[tripnum].walkto(5);
tr[tripnum].walkTo(5);
}
}
@ -1438,11 +1347,6 @@ void Animation::readstick() {
warning("STUB: Trip::readstick()");
}
void Animation::getsetclear() {
for (byte fv = 0; fv <= 1; fv++)
getset[fv].init();
}
/**
* Hide in the cupboard
* @remarks Originally called 'hide_in_the_cupboard'
@ -1493,7 +1397,6 @@ void Animation::fliproom(byte room, byte ped) {
_vm->_lucerna->exitRoom(_vm->_gyro->_dna._room);
_vm->_lucerna->dusk();
getsetclear();
for (int16 i = 1; i < kSpriteNumbMax; i++) {
if (tr[i]._quick)

View file

@ -76,45 +76,35 @@ class AnimationType {
public:
SpriteInfo _info;
adxtype _stat; // vital statistics
adxtype _stat; // Vital statistics.
byte _facingDir, _stepNum;
int16 _x, _y; // current xy coords
int16 _oldX[2], _oldY[2]; // last xy coords
int8 _moveX, _moveY; // amount to move sprite by, each step
int16 _x, _y; // Current xy coords.
int16 _oldX[2], _oldY[2]; // Last xy coords.
int8 _moveX, _moveY; // Amount to move sprite by, each step.
byte _id;
bool _quick, _visible, _homing, _doCheck;
int16 _homingX, _homingY; // homing x & y coords
byte _count; // counts before changing step
byte _speedX, _speedY; // x & y speed
byte _animCount; // total number of sprites
int16 _homingX, _homingY; // Homing x & y coords.
byte _count; // Counts before changing step.
byte _speedX, _speedY; // x & y speed.
byte _animCount; // Total number of sprites.
bool _vanishIfStill; // Do we show this sprite if it's still?
bool _callEachStepFl; // Do we call the eachstep procedure?
byte _eachStepProc;
void init(byte spritenum, bool doCheck, Animation *tr);
// loads & sets up the sprite
void original(); // just sets Quick to false
void andexor(); // drops sprite onto screen
void turn(byte whichway); // turns him round
void appear(int16 wx, int16 wy, byte wf); // switches him on
void bounce(); // bounces off walls.
void walk(); // prepares for andexor, etc.
void walkto(byte pednum); // home in on a point
void stophoming(); // self-explanatory
void homestep(); // calculates ix & iy for one homing step
void speed(int8 xx, int8 yy); // sets ix & iy, non-homing, etc
void stopWalk(); // Stops the sprite from moving
void chatter(); // Sets up talk vars
void setupSaver(AnimationSaver &sav);
void unload_saver(AnimationSaver sav);
void savedata(Common::File &f); // Self-explanatory,
void loaddata(Common::File &f); // really.
void save_data_to_mem(uint16 &where);
void load_data_from_mem(uint16 &where);
AnimationType *done();
void init(byte spritenum, bool doCheck, Animation *tr); // Loads & sets up the sprite.
void original(); // Just sets 'quick' to false.
void andexor(); // Drops sprite onto screen.
void turn(byte whichway); // Turns character round.
void appear(int16 wx, int16 wy, byte wf); // Switches it on.
void bounce(); // Bounces off walls.
void walk(); // Prepares for andexor, etc.
void walkTo(byte pednum); // Home in on a point.
void stophoming(); // Self-explanatory.
void homeStep(); // Calculates ix & iy for one homing step.
void speed(int8 xx, int8 yy); // Sets ix & iy, non-homing, etc.
void stopWalk(); // Stops the sprite from moving.
void chatter(); // Sets up talk vars.
void done();
private:
Animation *_tr;
@ -123,18 +113,6 @@ private:
int8 sgn(int16 val);
};
const int16 maxgetset = 35;
class getsettype {
public:
ByteField gs[maxgetset];
byte numleft;
getsettype *init();
void remember(ByteField r);
void recall(ByteField &r);
};
class Animation {
public:
friend class AnimationType;
@ -184,7 +162,6 @@ public:
void handleMoveKey(const Common::Event &event); // To replace tripkey().
AnimationType tr[kSpriteNumbMax];
getsettype getset[2];
byte aa[1600];
bool mustexclaim;
@ -209,7 +186,6 @@ private:
void spin(byte whichway, byte &tripnum);
void geida_procs(byte tripnum);
void call_andexors();
void getsetclear();
};
} // End of namespace Avalanche.

View file

@ -365,9 +365,6 @@ void Celer::drawBackgroundSprite(int16 destX, int16 destY, byte which) {
//setactivepage(1 - cp);
warning("STUB: Celer::show_one()");
for (byte i = 0; i < 2; i++)
_vm->_animation->getset[i].remember(_r);
}

View file

@ -243,9 +243,6 @@ void MenuBar::draw() {
for (byte i = 0; i < _menuNum; i++)
_menuItems[i].draw();
for (byte page = 0; page <= 1; page++)
_dr->_vm->_animation->getset[page].remember(menuspace);
_dr->_vm->_gyro->_cp = savecp;
}

View file

@ -449,7 +449,7 @@ void Lucerna::enterRoom(byte room, byte ped) {
if (_vm->_gyro->_dna._roomCount[r__outsideyours] == 1) {
_vm->_animation->apped(2, 4); // Start on the right-hand side of the screen.
_vm->_animation->tr[1].walkto(5); // Walks up to greet you.
_vm->_animation->tr[1].walkTo(5); // Walks up to greet you.
} else {
_vm->_animation->apped(2, 5); // Starts where he was before.
_vm->_animation->tr[1]._facingDir = Animation::kDirLeft;
@ -463,7 +463,7 @@ void Lucerna::enterRoom(byte room, byte ped) {
if (_vm->_gyro->_dna._crapulusWillTell) {
_vm->_animation->tr[1].init(8, false, _vm->_animation);
_vm->_animation->apped(2, 2);
_vm->_animation->tr[1].walkto(4);
_vm->_animation->tr[1].walkTo(4);
_vm->_timeout->addTimer(20, _vm->_timeout->kProcCrapulusSpludOut, _vm->_timeout->kReasonCrapulusSaysSpludwickOut);
_vm->_gyro->_dna._crapulusWillTell = false;
}
@ -508,7 +508,7 @@ void Lucerna::enterRoom(byte room, byte ped) {
if (_vm->_gyro->_dna._roomCount[r__brummieroad] == 1) { // First time here...
_vm->_animation->apped(2, 2); // He appears on the right of the screen...
_vm->_animation->tr[1].walkto(4); // ...and he walks up...
_vm->_animation->tr[1].walkTo(4); // ...and he walks up...
} else {
// You've been here before.
_vm->_animation->apped(2, 4); // He's standing in your way straight away...
@ -523,7 +523,7 @@ void Lucerna::enterRoom(byte room, byte ped) {
(_vm->_gyro->_dna._roomCount[r__argentroad] > 3)) {
_vm->_animation->tr[1].init(4, false, _vm->_animation); // 4 = Cwytalot again
_vm->_animation->apped(2, 1);
_vm->_animation->tr[1].walkto(2);
_vm->_animation->tr[1].walkTo(2);
_vm->_animation->tr[1]._vanishIfStill = true;
_vm->_gyro->_dna._passedCwytalotInHerts = true;
// _vm->_gyro->whereis[#157] = r__Nowhere; // can we fit this in?
@ -547,7 +547,7 @@ void Lucerna::enterRoom(byte room, byte ped) {
// A welcome party... or maybe not...
_vm->_animation->tr[1].init(6, false, _vm->_animation);
_vm->_animation->apped(2, 2);
_vm->_animation->tr[1].walkto(3);
_vm->_animation->tr[1].walkTo(3);
_vm->_timeout->addTimer(36, _vm->_timeout->kProcGetTiedUp, _vm->_timeout->kReasonGettingTiedUp);
}
}
@ -571,7 +571,7 @@ void Lucerna::enterRoom(byte room, byte ped) {
case 0 : { // You've answered NONE of his questions.
_vm->_animation->tr[1].init(9, false, _vm->_animation);
_vm->_animation->apped(2, 2);
_vm->_animation->tr[1].walkto(3);
_vm->_animation->tr[1].walkTo(3);
_vm->_timeout->addTimer(47, _vm->_timeout->kProcCardiffSurvey, _vm->_timeout->kReasonCardiffsurvey);
}
break;
@ -710,7 +710,7 @@ void Lucerna::enterRoom(byte room, byte ped) {
_vm->_animation->tr[1].init(11, false, _vm->_animation);
if ((_vm->_gyro->_dna._roomCount[r__wisewomans] == 1) && (ped > 0)) {
_vm->_animation->apped(2, 2); // Start on the right-hand side of the screen.
_vm->_animation->tr[1].walkto(4); // Walks up to greet you.
_vm->_animation->tr[1].walkTo(4); // Walks up to greet you.
} else {
_vm->_animation->apped(2, 4); // Starts where she was before.
_vm->_animation->tr[1]._facingDir = Animation::kDirLeft;

View file

@ -155,8 +155,6 @@ void Parser::drawCursor() {
bf._x2 = _inputTextPos + 2;
bf._y1 = 168;
bf._y2 = 168;
for (byte fv = 0; fv <= 1; fv++)
_vm->_animation->getset[fv].remember(bf);
}
void Parser::wipeText() {

View file

@ -274,7 +274,7 @@ void Timeout::bang2() {
void Timeout::stairs() {
_vm->_gyro->blip();
_vm->_animation->tr[0].walkto(4);
_vm->_animation->tr[0].walkTo(4);
_vm->_celer->drawBackgroundSprite(-1, -1, 2);
_vm->_gyro->_dna._brummieStairs = 2;
_vm->_gyro->_magics[10]._operation = _vm->_gyro->kMagicSpecial;
@ -315,8 +315,8 @@ void Timeout::getTiedUp() {
}
void Timeout::getTiedUp2() {
_vm->_animation->tr[0].walkto(4);
_vm->_animation->tr[1].walkto(5);
_vm->_animation->tr[0].walkTo(4);
_vm->_animation->tr[1].walkTo(5);
_vm->_gyro->_magics[3]._operation = _vm->_gyro->kMagicNothing; // No effect when you touch the boundaries.
_vm->_gyro->_dna._friarWillTieYouUp = true;
}
@ -327,14 +327,14 @@ void Timeout::hangAround() {
_vm->_gyro->_whereIs[_vm->_gyro->kPeopleRobinHood - 150] = r__robins;
_vm->_animation->apped(1, 2);
_vm->_visa->displayScrollChain('q', 39);
_vm->_animation->tr[0].walkto(7);
_vm->_animation->tr[0].walkTo(7);
addTimer(55, kProcHangAround2, kReasonHangingAround);
}
void Timeout::hangAround2() {
_vm->_visa->displayScrollChain('q', 40);
_vm->_animation->tr[1]._vanishIfStill = false;
_vm->_animation->tr[1].walkto(4);
_vm->_animation->tr[1].walkTo(4);
_vm->_gyro->_whereIs[_vm->_gyro->kPeopleFriarTuck - 150] = r__robins;
_vm->_visa->displayScrollChain('q', 41);
_vm->_animation->tr[0].done();
@ -425,7 +425,7 @@ void Timeout::jacquesWakesUp() {
void Timeout::naughtyDuke() { // This is when the Duke comes in and takes your money.
_vm->_animation->tr[1].init(9, false, _vm->_animation); // Here comes the Duke.
_vm->_animation->apped(2, 1); // He starts at the door...
_vm->_animation->tr[1].walkto(3); // He walks over to you.
_vm->_animation->tr[1].walkTo(3); // He walks over to you.
// Let's get the door opening.
_vm->_celer->drawBackgroundSprite(-1, -1, 1);
@ -437,7 +437,7 @@ void Timeout::naughtyDuke() { // This is when the Duke comes in and takes your m
void Timeout::naughtyDuke2() {
_vm->_visa->displayScrollChain('q', 48); // "Ha ha, it worked again!"
_vm->_animation->tr[1].walkto(1); // Walk to the door.
_vm->_animation->tr[1].walkTo(1); // Walk to the door.
_vm->_animation->tr[1]._vanishIfStill = true; // Then go away!
addTimer(32, kProcNaughtyDuke3, kReasonNaughtyDuke);
}
@ -575,7 +575,7 @@ void Timeout::riseUpOubliette() {
void Timeout::robinHoodAndGeida() {
_vm->_animation->tr[0].init(7, true, _vm->_animation);
_vm->_animation->apped(1, 7);
_vm->_animation->tr[0].walkto(6);
_vm->_animation->tr[0].walkTo(6);
_vm->_animation->tr[1].stopWalk();
_vm->_animation->tr[1]._facingDir = Animation::kDirLeft;
addTimer(20, kProcRobinHoodAndGeidaTalk, kReasonRobinHoodAndGeida);
@ -584,8 +584,8 @@ void Timeout::robinHoodAndGeida() {
void Timeout::robinHoodAndGeidaTalk() {
_vm->_visa->displayScrollChain('q', 66);
_vm->_animation->tr[0].walkto(2);
_vm->_animation->tr[1].walkto(2);
_vm->_animation->tr[0].walkTo(2);
_vm->_animation->tr[1].walkTo(2);
_vm->_animation->tr[0]._vanishIfStill = true;
_vm->_animation->tr[1]._vanishIfStill = true;
addTimer(162, kProcAvalotReturns, kReasonRobinHoodAndGeida);

View file

@ -268,7 +268,7 @@ void Visa::talkTo(byte whom) {
_vm->_gyro->_whereIs[_vm->_gyro->kPeopleCrapulus - 150] = 177; // Crapulus walks off.
_vm->_animation->tr[1]._vanishIfStill = true;
_vm->_animation->tr[1].walkto(3); // Walks away.
_vm->_animation->tr[1].walkTo(3); // Walks away.
_vm->_lucerna->incScore(2);
}