AVALANCHE: More index conversion in inField()

This commit is contained in:
Strangerke 2013-09-16 00:26:36 +02:00
parent d6be9ed7db
commit 23ba373c91
4 changed files with 17 additions and 19 deletions

View file

@ -1071,7 +1071,7 @@ void Acci::openDoor() {
// Special cases. // Special cases.
switch (_vm->_gyro->_room) { switch (_vm->_gyro->_room) {
case kRoomYours: case kRoomYours:
if (_vm->_animation->inField(2)) { if (_vm->_animation->inField(1)) {
// Opening the box. // Opening the box.
_thing = 54; // The box. _thing = 54; // The box.
_person = kPardon; _person = kPardon;
@ -1091,7 +1091,7 @@ void Acci::openDoor() {
return; // No doors can open if you can't move Avvy. return; // No doors can open if you can't move Avvy.
for (byte i = 0; i < 7; i++) { for (byte i = 0; i < 7; i++) {
if (_vm->_animation->inField(i + 9)) { if (_vm->_animation->inField(i + 8)) {
MagicType *portal = &_vm->_gyro->_portals[i]; MagicType *portal = &_vm->_gyro->_portals[i];
switch (portal->_operation) { switch (portal->_operation) {
case Gyro::kMagicExclaim: case Gyro::kMagicExclaim:
@ -1293,15 +1293,13 @@ void Acci::cardiffClimbing() {
_vm->_scrolls->displayText("You climb down, back onto the floor."); _vm->_scrolls->displayText("You climb down, back onto the floor.");
_vm->_gyro->_standingOnDais = false; _vm->_gyro->_standingOnDais = false;
_vm->_animation->appearPed(0, 2); _vm->_animation->appearPed(0, 2);
} else { // Clamber down. } else if (_vm->_animation->inField(0)) { // Clamber down
if (_vm->_animation->inField(1)) {
_vm->_scrolls->displayText("You clamber up onto the dais."); _vm->_scrolls->displayText("You clamber up onto the dais.");
_vm->_gyro->_standingOnDais = true; _vm->_gyro->_standingOnDais = true;
_vm->_animation->appearPed(0, 1); _vm->_animation->appearPed(0, 1);
} else } else
_vm->_scrolls->displayText("Get a bit closer, Avvy."); _vm->_scrolls->displayText("Get a bit closer, Avvy.");
} }
}
void Acci::already() { void Acci::already() {
_vm->_scrolls->displayText("You're already standing!"); _vm->_scrolls->displayText("You're already standing!");
@ -1350,7 +1348,7 @@ void Acci::standUp() {
void Acci::getProc(char thing) { void Acci::getProc(char thing) {
switch (_vm->_gyro->_room) { switch (_vm->_gyro->_room) {
case kRoomYours: case kRoomYours:
if (_vm->_animation->inField(2)) { if (_vm->_animation->inField(1)) {
if (_vm->_gyro->_boxContent == thing) { if (_vm->_gyro->_boxContent == thing) {
_vm->_celer->drawBackgroundSprite(-1, -1, 5); _vm->_celer->drawBackgroundSprite(-1, -1, 5);
_vm->_scrolls->displayText("OK, I've got it."); _vm->_scrolls->displayText("OK, I've got it.");
@ -1368,7 +1366,7 @@ void Acci::getProc(char thing) {
case kRoomInsideCardiffCastle: case kRoomInsideCardiffCastle:
switch (thing) { switch (thing) {
case Gyro::kObjectPen: case Gyro::kObjectPen:
if (_vm->_animation->inField(2)) { // Standing on the dais. if (_vm->_animation->inField(1)) { // Standing on the dais.
if (_vm->_gyro->_takenPen) if (_vm->_gyro->_takenPen)
_vm->_scrolls->displayText("It's not there, Avvy."); _vm->_scrolls->displayText("It's not there, Avvy.");
else { else {
@ -1393,7 +1391,7 @@ void Acci::getProc(char thing) {
} }
break; break;
case kRoomRobins: case kRoomRobins:
if ((thing == Gyro::kObjectMushroom) & (_vm->_animation->inField(1)) & (_vm->_gyro->_mushroomGrowing)) { if ((thing == Gyro::kObjectMushroom) & (_vm->_animation->inField(0)) & (_vm->_gyro->_mushroomGrowing)) {
_vm->_celer->drawBackgroundSprite(-1, -1, 3); _vm->_celer->drawBackgroundSprite(-1, -1, 3);
_vm->_scrolls->displayText("Got it!"); _vm->_scrolls->displayText("Got it!");
_vm->_gyro->_mushroomGrowing = false; _vm->_gyro->_mushroomGrowing = false;
@ -1428,7 +1426,7 @@ void Acci::giveGeidaTheLute() {
} }
void Acci::playHarp() { void Acci::playHarp() {
if (_vm->_animation->inField(7)) if (_vm->_animation->inField(6))
_vm->_scrolls->musicalScroll(); _vm->_scrolls->musicalScroll();
else else
_vm->_scrolls->displayText("Get a bit closer to it, Avvy!"); _vm->_scrolls->displayText("Get a bit closer to it, Avvy!");
@ -1884,7 +1882,7 @@ void Acci::doThat() {
if (_vm->_gyro->_avariciusTalk > 0) if (_vm->_gyro->_avariciusTalk > 0)
_vm->_scrolls->displayScrollChain('q', 19); _vm->_scrolls->displayScrollChain('q', 19);
else { else {
if ((_vm->_gyro->_room == kRoomSpludwicks) & (_vm->_animation->inField(2))) { // Avaricius appears! if ((_vm->_gyro->_room == kRoomSpludwicks) & (_vm->_animation->inField(1))) { // Avaricius appears!
_vm->_scrolls->displayScrollChain('q', 17); _vm->_scrolls->displayScrollChain('q', 17);
if (_vm->_gyro->_whereIs[1] == kRoomSpludwicks) if (_vm->_gyro->_whereIs[1] == kRoomSpludwicks)
_vm->_scrolls->displayScrollChain('q', 18); _vm->_scrolls->displayScrollChain('q', 18);
@ -1940,7 +1938,7 @@ void Acci::doThat() {
case kVerbCodeBuy: // What are they trying to buy? case kVerbCodeBuy: // What are they trying to buy?
switch (_vm->_gyro->_room) { switch (_vm->_gyro->_room) {
case kRoomArgentPub: case kRoomArgentPub:
if (_vm->_animation->inField(6)) { // We're in a pub, and near the bar. if (_vm->_animation->inField(5)) { // We're in a pub, and near the bar.
switch (_thing) { switch (_thing) {
case 51: case 51:
case 53: case 53:
@ -2001,7 +1999,7 @@ void Acci::doThat() {
break; break;
case kRoomOutsideDucks: case kRoomOutsideDucks:
if (_vm->_animation->inField(6)) { if (_vm->_animation->inField(5)) {
if (_thing == Gyro::kObjectOnion) { if (_thing == Gyro::kObjectOnion) {
if (_vm->_gyro->_objects[Gyro::kObjectOnion - 1]) if (_vm->_gyro->_objects[Gyro::kObjectOnion - 1])
_vm->_scrolls->displayScrollChain('D', 10); // Not planning to juggle with the things! _vm->_scrolls->displayScrollChain('D', 10); // Not planning to juggle with the things!

View file

@ -1350,7 +1350,7 @@ void Animation::flipRoom(byte room, byte ped) {
} }
bool Animation::inField(byte which) { bool Animation::inField(byte which) {
FieldType *curField = &_vm->_gyro->_fields[which - 1]; // Pascal -> C: different array indexes. FieldType *curField = &_vm->_gyro->_fields[which];
int16 yy = _sprites[0]._y + _sprites[0]._info._yLength; int16 yy = _sprites[0]._y + _sprites[0]._info._yLength;
return (_sprites[0]._x >= curField->_x1) && (_sprites[0]._x <= curField->_x2) && (yy >= curField->_y1) && (yy <= curField->_y2); return (_sprites[0]._x >= curField->_x1) && (_sprites[0]._x <= curField->_x2) && (yy >= curField->_y1) && (yy <= curField->_y2);

View file

@ -530,7 +530,7 @@ Common::String Gyro::f5Does() {
return Common::String::format("%cSSit down", Acci::kVerbCodeSit); return Common::String::format("%cSSit down", Acci::kVerbCodeSit);
break; break;
case kRoomMusicRoom: case kRoomMusicRoom:
if (_vm->_animation->inField(7)) if (_vm->_animation->inField(5))
return Common::String::format("%cPPlay the harp", Acci::kVerbCodePlay); return Common::String::format("%cPPlay the harp", Acci::kVerbCodePlay);
break; break;
} }

View file

@ -487,7 +487,7 @@ void Timer::jump() {
if ((_vm->_gyro->_jumpStatus == 10) // You're at the highest point of your jump. if ((_vm->_gyro->_jumpStatus == 10) // You're at the highest point of your jump.
&& (_vm->_gyro->_room == kRoomInsideCardiffCastle) && (_vm->_gyro->_room == kRoomInsideCardiffCastle)
&& (_vm->_gyro->_arrowInTheDoor == true) && (_vm->_gyro->_arrowInTheDoor == true)
&& (_vm->_animation->inField(3))) { // Beside the wall && (_vm->_animation->inField(2))) { // Beside the wall
// Grab the arrow! // Grab the arrow!
if (_vm->_gyro->_carryNum >= kCarryLimit) if (_vm->_gyro->_carryNum >= kCarryLimit)
_vm->_scrolls->displayText("You fail to grab it, because your hands are full."); _vm->_scrolls->displayText("You fail to grab it, because your hands are full.");