aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJaromir Wysoglad2019-06-06 18:34:23 +0200
committerThierry Crozat2019-07-28 15:09:14 +0100
commit8c6515182fce38efc7a051317919eb7024b57bf3 (patch)
treeab91732d380a51c967d54c04402c89680f6a84c7
parent925784f01b6121084b3797df56da4dc72e160fc5 (diff)
downloadscummvm-rg350-8c6515182fce38efc7a051317919eb7024b57bf3.tar.gz
scummvm-rg350-8c6515182fce38efc7a051317919eb7024b57bf3.tar.bz2
scummvm-rg350-8c6515182fce38efc7a051317919eb7024b57bf3.zip
SUPERNOVA2: Add part of Pyramid room
-rw-r--r--engines/supernova2/ms2_def.h10
-rw-r--r--engines/supernova2/rooms.cpp100
-rw-r--r--engines/supernova2/state.cpp21
-rw-r--r--engines/supernova2/state.h8
4 files changed, 133 insertions, 6 deletions
diff --git a/engines/supernova2/ms2_def.h b/engines/supernova2/ms2_def.h
index 70f83e8749..4afbd757ba 100644
--- a/engines/supernova2/ms2_def.h
+++ b/engines/supernova2/ms2_def.h
@@ -147,14 +147,14 @@ kString85, kString86, kString87, kString88, kString89,
kString90, kString91, kString92, kString93, kString94,
kStringEntrance, kStringDoor, kString97, kString98, kString99,
kString100, kString101, kString102, kStringDinosaurHead, kString104,
-kString105, kStringSuctionCup, kString107, kString108, kString109,
-kString110, kString111, kString112, kString113, kString114,
-kString115, kString116, kString117, kString118, kString119,
+kString105, kStringSuctionCup, kString107, kStringOpening, kString109,
+kString110, kString111, kString112, kStringPyramid1, kStringPyramid2,
+kStringPyramid3, kString116, kString117, kString118, kString119,
kString120, kString121, kString122, kString123, kString124,
kString125, kString126, kString127, kString128, kString129,
kString130, kString131, kString132, kString133, kString134,
-kString135, kString136, kStringSign, kString138, kString139,
-kString140, kString141, kString142, kString143, kString144,
+kString135, kStringRope, kStringSign, kStringSignDescription, kStringEntrance1Description,
+kStringPyramid, kStringPyramidDescription, kStringSun, kStringSunDescription, kString144,
kString145, kString146, kString147, kString148, kString149,
kString150, kString151, kString152, kString153, kString154,
kString155, kString156, kString157, kString158, kString159,
diff --git a/engines/supernova2/rooms.cpp b/engines/supernova2/rooms.cpp
index b858619058..7bbd537397 100644
--- a/engines/supernova2/rooms.cpp
+++ b/engines/supernova2/rooms.cpp
@@ -2164,6 +2164,37 @@ Pyramid::Pyramid(Supernova2Engine *vm, GameManager *gm) {
_fileNumber = 6;
_id = PYRAMID;
_shown[0] = kShownTrue;
+
+ _objectState[0] = Object(_id, kStringRope, kStringDefaultDescription, ROPE, TAKE | COMBINABLE, 255, 255, 1 + 128);
+ _objectState[1] = Object(_id, kStringSign, kStringSignDescription, SIGN, COMBINABLE, 25, 25, 0);
+ _objectState[2] = Object(_id, kStringEntrance, kStringEntrance1Description, PYRA_ENTRANCE, EXIT, 27, 27, 0, PYR_ENTRANCE, 19);
+ _objectState[3] = Object(_id, kStringPyramid, kStringPyramidDescription, NULLOBJECT, NULLTYPE, 26, 26, 0);
+ _objectState[4] = Object(_id, kStringSun, kStringSunDescription, SUN, NULLTYPE, 28, 28, 0);
+ _objectState[5] = Object(_id, kStringOpening, kStringDefaultDescription, HOLE1, COMBINABLE, 0, 0, 0);
+ _objectState[6] = Object(_id, kStringOpening, kStringDefaultDescription, HOLE2, COMBINABLE, 1, 0, 0);
+ _objectState[7] = Object(_id, kStringOpening, kStringDefaultDescription, HOLE3, COMBINABLE, 2, 0, 0);
+ _objectState[8] = Object(_id, kStringOpening, kStringDefaultDescription, HOLE4, COMBINABLE, 3, 0, 0);
+ _objectState[9] = Object(_id, kStringOpening, kStringDefaultDescription, HOLE5, COMBINABLE, 4, 0, 0);
+ _objectState[10] = Object(_id, kStringOpening, kStringDefaultDescription, HOLE6, COMBINABLE, 5, 0, 0);
+ _objectState[11] = Object(_id, kStringOpening, kStringDefaultDescription, HOLE7, COMBINABLE, 6, 0, 0);
+ _objectState[12] = Object(_id, kStringOpening, kStringDefaultDescription, HOLE8, COMBINABLE, 7, 0, 0);
+ _objectState[13] = Object(_id, kStringOpening, kStringDefaultDescription, HOLE9, COMBINABLE, 8, 0, 0);
+ _objectState[14] = Object(_id, kStringOpening, kStringDefaultDescription, HOLE10, COMBINABLE, 9, 0, 0);
+ _objectState[15] = Object(_id, kStringOpening, kStringDefaultDescription, HOLE11, COMBINABLE, 10, 0, 0);
+ _objectState[16] = Object(_id, kStringOpening, kStringDefaultDescription, HOLE12, COMBINABLE, 11, 0, 0);
+ _objectState[17] = Object(_id, kStringOpening, kStringDefaultDescription, HOLE13, COMBINABLE, 12, 0, 0);
+ _objectState[18] = Object(_id, kStringOpening, kStringDefaultDescription, HOLE14, COMBINABLE, 13, 0, 0);
+ _objectState[19] = Object(_id, kStringOpening, kStringDefaultDescription, HOLE15, COMBINABLE, 14, 0, 0);
+ _objectState[20] = Object(_id, kStringOpening, kStringDefaultDescription, HOLE16, COMBINABLE, 15, 0, 0);
+ _objectState[21] = Object(_id, kStringOpening, kStringDefaultDescription, HOLE17, COMBINABLE, 16, 0, 0);
+ _objectState[22] = Object(_id, kStringOpening, kStringDefaultDescription, HOLE18, COMBINABLE, 17, 0, 0);
+ _objectState[23] = Object(_id, kStringOpening, kStringDefaultDescription, HOLE19, COMBINABLE, 18, 0, 0);
+ _objectState[24] = Object(_id, kStringOpening, kStringDefaultDescription, HOLE20, COMBINABLE, 19, 0, 0);
+ _objectState[25] = Object(_id, kStringOpening, kStringDefaultDescription, HOLE21, COMBINABLE, 20, 0, 0);
+ _objectState[26] = Object(_id, kStringOpening, kStringDefaultDescription, HOLE22, COMBINABLE, 21, 0, 0);
+ _objectState[27] = Object(_id, kStringOpening, kStringDefaultDescription, HOLE23, COMBINABLE, 22, 0, 0);
+ _objectState[28] = Object(_id, kStringOpening, kStringDefaultDescription, HOLE24, COMBINABLE, 23, 0, 0);
+ _objectState[29] = Object(_id, kStringOpening, kStringDefaultDescription, HOLE25, COMBINABLE, 24, 0, 0);
}
void Pyramid::onEntrance() {
@@ -2174,6 +2205,75 @@ void Pyramid::animation() {
}
bool Pyramid::interact(Action verb, Object &obj1, Object &obj2) {
+ Object *rope, *hole;
+ rope = hole = nullptr;
+
+ if (obj1._id == ROPE)
+ rope = &obj1;
+ if (obj2._id == ROPE)
+ rope = &obj2;
+ if (obj1._id >= HOLE1 && obj1._id <= HOLE25)
+ hole = &obj1;
+ if (obj2._id >= HOLE1 && obj2._id <= HOLE25)
+ hole = &obj2;
+
+ if (verb == ACTION_WALK && obj1._id == PYRA_ENTRANCE) {
+ _gm->_state._eventCallback = kPyramidEndFn;
+ _gm->_state._eventTime = g_system->getMillis() + 3600000; //hour
+ _gm->_state._pyraS = 4;
+ _gm->_state._pyraZ = 10;
+ _gm->_state._pyraDirection = 0;
+ _gm->passageConstruction();
+ return false;
+ } else if (verb == ACTION_USE && Object::combine(obj1, obj2, ROPE, SIGN)) {
+ if (rope->_type & CARRIED) {
+ _vm->renderImage(1);
+ _gm->_inventory.remove(*rope);
+ _objectState[0]._click = 29;
+ }
+ else
+ _vm->renderMessage(kStringPyramid1);
+ } else if (verb == ACTION_USE && hole != nullptr && rope != nullptr) {
+ if (rope->_type & CARRIED)
+ _vm->renderMessage(kStringPyramid2);
+ else {
+ int number = hole->_id - HOLE1;
+ int start = number / 5 * 5 + 2;
+ for (int i = 1; i <= 26; i++)
+ _vm->renderImage(i + 128);
+ for (int i = start; i <= start + number % 5; i++)
+ _vm->renderImage(i);
+ _objectState[0]._click = 30;
+ if (number == 18) {
+ _gm->_rooms[HOLE_ROOM]->setSectionVisible(16, kShownTrue);
+ _gm->_rooms[HOLE_ROOM]->getObject(2)->_click = 5;
+ _gm->_rooms[HOLE_ROOM]->getObject(3)->_type = EXIT;
+ } else {
+ _gm->_rooms[HOLE_ROOM]->setSectionVisible(16, kShownFalse);
+ _gm->_rooms[HOLE_ROOM]->getObject(2)->_click = 255;
+ _gm->_rooms[HOLE_ROOM]->getObject(3)->_type = NULLTYPE;
+ }
+ }
+ } else if (verb == ACTION_PULL && rope != nullptr && !(rope->_type & CARRIED) &&
+ !isSectionVisible(1)) {
+ for (int i = 2; i <= 26; i++)
+ _vm->renderImage(i + 128);
+ _vm->renderImage(1);
+ _objectState[0]._click = 29;
+ _gm->_rooms[HOLE_ROOM]->setSectionVisible(16, kShownFalse);
+ _gm->_rooms[HOLE_ROOM]->getObject(2)->_click = 255;
+ _gm->_rooms[HOLE_ROOM]->getObject(3)->_type = NULLTYPE;
+ } else if (verb == ACTION_TAKE && rope != nullptr && !(rope->_type & CARRIED)) {
+ for (int i = 2; i <= 26; i++)
+ _vm->renderImage(i + 128);
+ _gm->takeObject(*rope);
+ _gm->_rooms[HOLE_ROOM]->setSectionVisible(16, kShownFalse);
+ _gm->_rooms[HOLE_ROOM]->getObject(2)->_click = 255;
+ _gm->_rooms[HOLE_ROOM]->getObject(3)->_type = NULLTYPE;
+ } else if (verb == ACTION_WALK && obj1._type == SUN) {
+ _vm->renderMessage(kStringPyramid3);
+ } else
+ return false;
return true;
}
diff --git a/engines/supernova2/state.cpp b/engines/supernova2/state.cpp
index cbd3fdcd9e..d5decdeb3a 100644
--- a/engines/supernova2/state.cpp
+++ b/engines/supernova2/state.cpp
@@ -46,6 +46,10 @@ bool GameManager::serialize(Common::WriteStream *out) {
out->writeByte(_state._elevatorE);
out->writeByte(_state._elevatorNumber);
out->writeByte(_state._toMuseum);
+ out->writeByte(_state._pyraE);
+ out->writeByte(_state._pyraS);
+ out->writeByte(_state._pyraZ);
+ out->writeByte(_state._pyraDirection);
out->writeUint32LE(_state._eventTime);
out->writeSint32LE(_state._eventCallback);
@@ -84,6 +88,10 @@ bool GameManager::deserialize(Common::ReadStream *in, int version) {
_state._elevatorE = in->readByte();
_state._elevatorNumber = in->readByte();
_state._toMuseum = in->readByte();
+ _state._pyraE = in->readByte();
+ _state._pyraS = in->readByte();
+ _state._pyraZ = in->readByte();
+ _state._pyraDirection = in->readByte();
_state._eventTime = in->readUint32LE();
_state._eventCallback = (EventFunction)in->readSint32LE();
_vm->setGameString(kStringMoney, Common::String::format("%d Xa", _state._money));
@@ -356,6 +364,10 @@ void GameManager::initState() {
_state._elevatorE = 0;
_state._elevatorNumber = 0;
_state._toMuseum = false;
+ _state._pyraE = 0;
+ _state._pyraS = 4;
+ _state._pyraZ = 10;
+ _state._pyraDirection = 0;
_state._eventTime = kMaxTimerValue;
_state._eventCallback = kNoFn;
}
@@ -493,6 +505,9 @@ void GameManager::updateEvents() {
case kSoberFn:
sober();
break;
+ case kPyramidEndFn:
+ pyramidEnd();
+ break;
}
_vm->_allowLoadGame = true;
_vm->_allowSaveGame = true;
@@ -1722,5 +1737,11 @@ bool GameManager::talkRest(int mod1, int mod2, int rest) {
return true;
}
+void GameManager::pyramidEnd() {
+}
+
+void GameManager::passageConstruction() {
+}
+
}
diff --git a/engines/supernova2/state.h b/engines/supernova2/state.h
index 2834851367..4ea490784e 100644
--- a/engines/supernova2/state.h
+++ b/engines/supernova2/state.h
@@ -33,7 +33,7 @@ namespace Supernova2 {
const int32 kMaxTimerValue = 0x7FFFFFFF;
-enum EventFunction { kNoFn, kSoberFn};
+enum EventFunction { kNoFn, kSoberFn, kPyramidEndFn};
struct GameState {
int16 _money;
@@ -49,6 +49,10 @@ struct GameState {
bool _toMuseum;
EventFunction _eventCallback;
uint32 _eventTime;
+ char _pyraE;
+ char _pyraS;
+ char _pyraZ;
+ char _pyraDirection;
};
class Inventory {
@@ -215,6 +219,8 @@ public:
void drawGUI();
bool talk(int mod1, int mod2, int rest, MessagePosition pos, StringId id);
bool talkRest(int mod1, int mod2, int rest);
+ void pyramidEnd();
+ void passageConstruction();
private:
int _prevImgId;