SUPERNOVA2: Add the apartment room

This commit is contained in:
Jaromir Wysoglad 2019-06-06 11:24:41 +02:00 committed by Thierry Crozat
parent c23411bb73
commit e90a82ac79
4 changed files with 76 additions and 13 deletions

View File

@ -117,9 +117,9 @@ enum ObjectId {
CUP,JOYSTICK,BOTTLE1,BOTTLE2,BOTTLE3,BOTTLE4,BOX,FACES,
SELLER,POSTER,AXACUSSER,KP_ENTRANCE,CHIP,CARD,
SCRIBBLE1,SCRIBBLE2,BELL,KEYPAD,DOOR_L,DOOR_R,ID_CARD,
MAGNET,UNDER_BED,KEY,VALVE,WARDROBE,DISCMAN,
MAGNET,UNDER_BED,KEY,HATCH,CABINET,DISCMAN,
SMALL_DOOR,BACK_MONEY,WALL,SUCTION_CUP,IMITATION,SP_KEYCARD,ALARM_CRACKER,
ENCRYPTED_DOOR,ALARM_ANLAGE,MUS_STREET,BIG_DOOR,INVESTMENT,
ENCRYPTED_DOOR,ALARM_ANLAGE,MUS_STREET,BIG_DOOR,MUSIC_SYSTEM,
HANDLE,COUNTER,DOOR_SWITCH,SUIT,MANAGEMENT,RMANAGEMENT,
MUSCARD,SKOPF, DISPLAY
};
@ -229,20 +229,20 @@ kStringElevator42, kStringElevator43, kStringElevator44, kStringElevator45, kStr
kStringElevator47, kStringElevator48, kStringElevator49, kStringElevator50, kStringElevator51,
kStringElevator52, kStringElevator53, kStringElevator54, kStringElevator55, kStringElevator56,
kStringElevator57, kStringElevator58, kStringElevator59, kStringElevator60, kStringElevator61,
kStringElevator62, kStringElevator63, kStringElevator64, kStringElevator65, kString519,
kString520, kString521, kString522, kString523, kString524,
kString525, kString526, kString527, kString528, kString529,
kStringElevator62, kStringElevator63, kStringElevator64, kStringElevator65, kStringApartment1,
kStringApartment2, kStringApartment3, kStringApartment4, kStringApartment5, kStringApartment6,
kStringApartment7, kStringApartment8, kString527, kString528, kString529,
kString530, kString531, kString532, kString533, kString534,
kString535, kString536, kString537, kString538, kString539,
kString540, kString541, kString542, kString543, kString544,
kString545, kString546, kStringFascinating, kStringTaxis, kStringTaxisDescription,
kStringAxacussan, kStringParticipationCard, kStringAxacussian, kStringSign1Description, kStringSign2Description,
kStringSign3Description, kStringSign4Description, kStringBell, kStringDisplay, kStringKeypad,
kStringKeypadDescription, kString561, kString562, kString563, kString564,
kString565, kString566, kString567, kString568, kString569,
kString570, kString571, kString572, kString573, kString574,
kString575, kString576, kString577, kString578, kString579,
kString580, kString581, kString582, kString583, kString584,
kStringKeypadDescription, kStringChip, kStringChipDescription, kStringHatch, kStringHatchDescription,
kStringMusicSystem, kStringMusicSystemDescription, kStringSpeakers, kStringSpeakersDescription, kStringPencils,
kStringPencilsDescription, kStringMetalBlocks, kStringMetalBlocksDescription, kStringImage, kStringImageDescription,
kStringCabinet, kStringCabinetDescription, kStringElevator, kStringUnderBed, kStringUnderBedDescription,
kStringKey, kStringKeyDescription, kString582, kString583, kString584,
kString585, kString586, kString587, kString588, kString589,
kStringIntro6, kStringIntro7, kStringIntro8, kStringIntroTV1, kStringIntroTV2,
kStringIntroTV3, kStringIntroTV4, kStringIntroTV5, kStringIntroTV6, kStringIntroTV7,

View File

@ -56,8 +56,8 @@ static const AudioInfo audioInfo[kAudioNumSamples] = {
{53, 5010, 30020},
{55, 18230, -1},
{55, 17020, 18230},
{53, 0, 30020},
{47, 17020, -1}
{53, 0, 5210},
{47, 17020, -1},
};
static const byte mouseNormal[64] = {

View File

@ -1890,9 +1890,26 @@ Apartment::Apartment(Supernova2Engine *vm, GameManager *gm) {
_vm = vm;
_gm = gm;
_fileNumber = 6;
_fileNumber = 25;
_id = APARTMENT;
_shown[0] = kShownTrue;
_shown[1] = kShownFalse;
_shown[2] = kShownFalse;
_shown[3] = kShownTrue;
_objectState[0] = Object(_id, kStringChip, kStringChipDescription, CHIP, TAKE | COMBINABLE, 255, 255, 1);
_objectState[1] = Object(_id, kStringHatch, kStringHatchDescription, HATCH, OPENABLE | CLOSED | COMBINABLE, 0, 1, 1);
_objectState[2] = Object(_id, kStringDefaultDescription, kStringDefaultDescription, NULLOBJECT, NULLTYPE, 255, 255, 0);
_objectState[3] = Object(_id, kStringMusicSystem, kStringMusicSystemDescription, MUSIC_SYSTEM, COMBINABLE, 4, 4, 0);
_objectState[4] = Object(_id, kStringSpeakers, kStringSpeakersDescription, NULLOBJECT, NULLTYPE, 5, 5, 0);
_objectState[5] = Object(_id, kStringPencils, kStringPencilsDescription, NULLOBJECT, UNNECESSARY, 6, 6, 0);
_objectState[6] = Object(_id, kStringMetalBlocks, kStringMetalBlocksDescription, MAGNET, TAKE | COMBINABLE, 10, 10, 3 + 128);
_objectState[7] = Object(_id, kStringImage, kStringImageDescription, NULLOBJECT, UNNECESSARY, 7, 7, 0);
_objectState[8] = Object(_id, kStringCabinet, kStringCabinetDescription, CABINET, OPENABLE | CLOSED, 8, 8, 0);
_objectState[9] = Object(_id, kStringChair, kStringDefaultDescription, NULLOBJECT, NULLTYPE, 9, 9, 0);
_objectState[10] = Object(_id, kStringElevator, kStringDefaultDescription, NULLOBJECT, EXIT, 255, 255, 0, ELEVATOR, 22);
_objectState[11] = Object(_id, kStringUnderBed, kStringUnderBedDescription, UNDER_BED, NULLTYPE, 11, 11, 0);
_objectState[12] = Object(_id, kStringKey, kStringKeyDescription, KEY, TAKE | COMBINABLE, 255, 255, 0);
}
void Apartment::onEntrance() {
@ -1903,6 +1920,51 @@ void Apartment::animation() {
}
bool Apartment::interact(Action verb, Object &obj1, Object &obj2) {
if (verb == ACTION_USE && Object::combine(obj1, obj2, ROD, UNDER_BED)) {
if (_objectState[12]._type & CARRIED)
_vm->renderMessage(kStringApartment1);
else if (_shown[kMaxSection - 1]) {
_vm->renderMessage(kStringApartment2);
_gm->takeObject(_objectState[12]);
_vm->playSound(kAudioSuccess);
} else {
_vm->renderMessage(kStringApartment3);
_gm->waitOnInput(_gm->_messageDuration);
_vm->removeMessage();
_vm->renderMessage(kStringApartment4);
}
} else if (verb == ACTION_USE && Object::combine(obj1, obj2, KEY, HATCH)) {
if (_objectState[1]._type & OPENED)
_vm->renderMessage(kStringApartment5);
else {
_vm->renderImage(1);
_vm->playSound(kAudioTaxiOpen);
_objectState[1]._type |= OPENED;
_objectState[1]._click = 1;
if (!(_objectState[0]._type & CARRIED)) {
_vm->renderImage(2);
_objectState[0]._click = 2;
}
}
} else if (verb == ACTION_CLOSE && obj1._id == HATCH && obj1._type & OPENED) {
_vm->renderImage(1 + 128);
setSectionVisible(2, false);
_vm->playSound(kAudioElevator1);
obj1._type &= ~OPENED;
obj1._click = 0;
if (!(_objectState[0]._type & CARRIED))
_objectState[0]._click = 255;
} else if (verb == ACTION_TAKE && obj1._id == CHIP && !(obj1._type & CARRIED)) {
setSectionVisible(2, kShownFalse);
return false;
} else if (verb == ACTION_USE && Object::combine(obj1, obj2, KEY, CABINET)) {
_vm->renderMessage(kStringApartment6);
} else if (verb == ACTION_USE && Object::combine(obj1, obj2, CHIP, MUSIC_SYSTEM)) {
_vm->renderMessage(kStringApartment7);
} else if (verb == ACTION_PRESS && obj1._id == MUSIC_SYSTEM) {
_vm->renderMessage(kStringApartment8);
} else
return false;
return true;
}

View File

@ -1231,6 +1231,7 @@ bool GameManager::genericInteract(Action verb, Object &obj1, Object &obj2) {
o1->_name = kStringPoleMagnet;
o1->_description = kStringCunning;
_inventory.remove(*o2);
_rooms[APARTMENT]->setSectionVisible(kMaxSection - 1, kShownTrue);
} else if (verb == ACTION_USE && Object::combine(obj1, obj2, CHIP, PLAYER)) {
Object *o1, *o2;
if (obj2._id == CHIP) {