Initial commit
This commit is contained in:
271
engines/pegasus/items/biochips/aichip.cpp
Normal file
271
engines/pegasus/items/biochips/aichip.cpp
Normal file
@@ -0,0 +1,271 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* Additional copyright for this file:
|
||||
* Copyright (C) 1995-1997 Presto Studios, Inc.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "pegasus/energymonitor.h"
|
||||
#include "pegasus/gamestate.h"
|
||||
#include "pegasus/pegasus.h"
|
||||
#include "pegasus/ai/ai_area.h"
|
||||
#include "pegasus/items/biochips/aichip.h"
|
||||
#include "pegasus/neighborhood/neighborhood.h"
|
||||
|
||||
namespace Pegasus {
|
||||
|
||||
// indexed by [number of hints][number of solves (0, 1, or 2)][which button to highlight]
|
||||
static const ItemState s_highlightState[4][3][7] = {
|
||||
{
|
||||
{kAI000, -1, -1, -1, -1, kAI005, kAI006},
|
||||
{kAI010, -1, -1, -1, -1, kAI015, kAI016},
|
||||
{kAI020, -1, -1, -1, kAI024, -1, -1}
|
||||
},
|
||||
{
|
||||
{kAI100, kAI101, -1, -1, -1, kAI105, kAI106},
|
||||
{kAI110, kAI111, -1, -1, -1, kAI115, kAI116},
|
||||
{kAI120, kAI121, -1, -1, kAI124, kAI125, kAI126}
|
||||
},
|
||||
{
|
||||
{kAI200, kAI201, kAI202, -1, -1, kAI205, kAI206},
|
||||
{kAI210, kAI211, kAI212, -1, -1, kAI215, kAI216},
|
||||
{kAI220, kAI221, kAI222, -1, kAI224, kAI225, kAI226}
|
||||
},
|
||||
{
|
||||
{kAI300, kAI301, kAI302, kAI303, -1, kAI305, kAI306},
|
||||
{kAI310, kAI311, kAI312, kAI313, -1, kAI315, kAI316},
|
||||
{kAI320, kAI321, kAI322, kAI323, kAI324, kAI325, kAI326}
|
||||
}
|
||||
};
|
||||
|
||||
AIChip *g_AIChip = nullptr;
|
||||
|
||||
AIChip::AIChip(const ItemID id, const NeighborhoodID neighborhood, const RoomID room, const DirectionConstant direction) :
|
||||
BiochipItem(id, neighborhood, room, direction), _briefingSpot(kAIBriefingSpotID), _scanSpot(kAIScanSpotID),
|
||||
_hint1Spot(kAIHint1SpotID), _hint2Spot(kAIHint2SpotID), _hint3Spot(kAIHint3SpotID), _solveSpot(kAISolveSpotID) {
|
||||
_briefingSpot.setArea(Common::Rect(kAIMiddleAreaLeft + 10, kAIMiddleAreaTop + 27, kAIMiddleAreaLeft + 10 + 81, kAIMiddleAreaTop + 27 + 31));
|
||||
_briefingSpot.setHotspotFlags(kAIBiochipSpotFlag);
|
||||
g_allHotspots.push_back(&_briefingSpot);
|
||||
|
||||
_scanSpot.setArea(Common::Rect(kAIMiddleAreaLeft + 100, kAIMiddleAreaTop + 27, kAIMiddleAreaLeft + 100 + 81, kAIMiddleAreaTop + 27 + 31));
|
||||
_scanSpot.setHotspotFlags(kAIBiochipSpotFlag);
|
||||
g_allHotspots.push_back(&_scanSpot);
|
||||
|
||||
_hint1Spot.setArea(Common::Rect(kAIMiddleAreaLeft + 70, kAIMiddleAreaTop + 67, kAIMiddleAreaLeft + 70 + 21, kAIMiddleAreaTop + 67 + 21));
|
||||
_hint1Spot.setHotspotFlags(kAIBiochipSpotFlag);
|
||||
g_allHotspots.push_back(&_hint1Spot);
|
||||
|
||||
_hint2Spot.setArea(Common::Rect(kAIMiddleAreaLeft + 91, kAIMiddleAreaTop + 67, kAIMiddleAreaLeft + 91 + 20, kAIMiddleAreaTop + 67 + 21));
|
||||
_hint2Spot.setHotspotFlags(kAIBiochipSpotFlag);
|
||||
g_allHotspots.push_back(&_hint2Spot);
|
||||
|
||||
_hint3Spot.setArea(Common::Rect(kAIMiddleAreaLeft + 111, kAIMiddleAreaTop + 67, kAIMiddleAreaLeft + 111 + 20, kAIMiddleAreaTop + 67 + 21));
|
||||
_hint3Spot.setHotspotFlags(kAIBiochipSpotFlag);
|
||||
g_allHotspots.push_back(&_hint3Spot);
|
||||
|
||||
_solveSpot.setArea(Common::Rect(kAIMiddleAreaLeft + 131, kAIMiddleAreaTop + 67, kAIMiddleAreaLeft + 131 + 50, kAIMiddleAreaTop + 67 + 21));
|
||||
_solveSpot.setHotspotFlags(kAIBiochipSpotFlag);
|
||||
g_allHotspots.push_back(&_solveSpot);
|
||||
|
||||
_playingMovie = false;
|
||||
setItemState(kAI000);
|
||||
|
||||
g_AIChip = this;
|
||||
}
|
||||
|
||||
AIChip::~AIChip() {
|
||||
g_AIChip = nullptr;
|
||||
|
||||
g_allHotspots.removeOneHotspot(kAIBriefingSpotID);
|
||||
g_allHotspots.removeOneHotspot(kAIScanSpotID);
|
||||
g_allHotspots.removeOneHotspot(kAIHint1SpotID);
|
||||
g_allHotspots.removeOneHotspot(kAIHint2SpotID);
|
||||
g_allHotspots.removeOneHotspot(kAIHint3SpotID);
|
||||
g_allHotspots.removeOneHotspot(kAISolveSpotID);
|
||||
}
|
||||
|
||||
void AIChip::select() {
|
||||
BiochipItem::select();
|
||||
setUpAIChip();
|
||||
}
|
||||
|
||||
void AIChip::takeSharedArea() {
|
||||
setUpAIChip();
|
||||
}
|
||||
|
||||
void AIChip::setUpAIChip() {
|
||||
if (!_playingMovie) {
|
||||
uint numSolves;
|
||||
if (GameState.getWalkthroughMode()) {
|
||||
if (g_vm->canSolve())
|
||||
numSolves = 2;
|
||||
else
|
||||
numSolves = 1;
|
||||
} else {
|
||||
numSolves = 0;
|
||||
}
|
||||
|
||||
setItemState(s_highlightState[g_vm->getNumHints()][numSolves][0]);
|
||||
}
|
||||
}
|
||||
|
||||
// Only does something when there are hints or solves available.
|
||||
void AIChip::setUpAIChipRude() {
|
||||
if (!_playingMovie) {
|
||||
uint numSolves;
|
||||
if (GameState.getWalkthroughMode()) {
|
||||
if (g_vm->canSolve())
|
||||
numSolves = 2;
|
||||
else
|
||||
numSolves = 1;
|
||||
} else {
|
||||
numSolves = 0;
|
||||
}
|
||||
|
||||
uint numHints = g_vm->getNumHints();
|
||||
if (numSolves == 2 || numHints != 0)
|
||||
setItemState(s_highlightState[numHints][numSolves][0]);
|
||||
}
|
||||
}
|
||||
|
||||
void AIChip::activateAIHotspots() {
|
||||
_briefingSpot.setActive();
|
||||
_scanSpot.setActive();
|
||||
|
||||
switch (g_vm->getNumHints()) {
|
||||
case 3:
|
||||
_hint3Spot.setActive();
|
||||
// fall through
|
||||
case 2:
|
||||
_hint2Spot.setActive();
|
||||
// fall through
|
||||
case 1:
|
||||
_hint1Spot.setActive();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (GameState.getWalkthroughMode() && g_vm->canSolve())
|
||||
_solveSpot.setActive();
|
||||
}
|
||||
|
||||
void AIChip::showBriefingClicked() {
|
||||
_playingMovie = true;
|
||||
|
||||
uint numSolves;
|
||||
if (GameState.getWalkthroughMode()) {
|
||||
if (g_vm->canSolve())
|
||||
numSolves = 2;
|
||||
else
|
||||
numSolves = 1;
|
||||
} else {
|
||||
numSolves = 0;
|
||||
}
|
||||
|
||||
ItemState newState = s_highlightState[g_vm->getNumHints()][numSolves][kAIBriefingSpotID - kAIHint1SpotID + 1];
|
||||
if (newState != -1)
|
||||
setItemState(newState);
|
||||
}
|
||||
|
||||
void AIChip::showEnvScanClicked() {
|
||||
_playingMovie = true;
|
||||
|
||||
uint numSolves;
|
||||
if (GameState.getWalkthroughMode()) {
|
||||
if (g_vm->canSolve())
|
||||
numSolves = 2;
|
||||
else
|
||||
numSolves = 1;
|
||||
} else {
|
||||
numSolves = 0;
|
||||
}
|
||||
|
||||
ItemState newState = s_highlightState[g_vm->getNumHints()][numSolves][kAIScanSpotID - kAIHint1SpotID + 1];
|
||||
|
||||
if (newState != -1)
|
||||
setItemState(newState);
|
||||
}
|
||||
|
||||
void AIChip::clearClicked() {
|
||||
_playingMovie = false;
|
||||
setUpAIChip();
|
||||
}
|
||||
|
||||
void AIChip::clickInAIHotspot(HotSpotID id) {
|
||||
Common::Path movieName;
|
||||
|
||||
switch (id) {
|
||||
case kAIBriefingSpotID:
|
||||
movieName = g_vm->getBriefingMovie();
|
||||
break;
|
||||
case kAIScanSpotID:
|
||||
movieName = g_vm->getEnvScanMovie();
|
||||
break;
|
||||
case kAIHint1SpotID:
|
||||
movieName = g_vm->getHintMovie(1);
|
||||
break;
|
||||
case kAIHint2SpotID:
|
||||
movieName = g_vm->getHintMovie(2);
|
||||
break;
|
||||
case kAIHint3SpotID:
|
||||
movieName = g_vm->getHintMovie(3);
|
||||
break;
|
||||
case kAISolveSpotID:
|
||||
g_neighborhood->doSolve();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
ItemState state = getItemState();
|
||||
|
||||
if (!movieName.empty()) {
|
||||
_playingMovie = true;
|
||||
|
||||
uint numSolves;
|
||||
if (GameState.getWalkthroughMode()) {
|
||||
if (g_vm->canSolve())
|
||||
numSolves = 2;
|
||||
else
|
||||
numSolves = 1;
|
||||
} else {
|
||||
numSolves = 0;
|
||||
}
|
||||
|
||||
ItemState newState = s_highlightState[g_vm->getNumHints()][numSolves][id - kAIHint1SpotID + 1];
|
||||
|
||||
if (newState != -1)
|
||||
setItemState(newState);
|
||||
|
||||
if (g_AIArea) {
|
||||
g_vm->prepareForAIHint(movieName);
|
||||
g_AIArea->playAIMovie(kRightAreaSignature, movieName, false, kHintInterruption);
|
||||
g_vm->cleanUpAfterAIHint(movieName);
|
||||
}
|
||||
|
||||
if (newState != -1)
|
||||
setItemState(state);
|
||||
|
||||
_playingMovie = false;
|
||||
}
|
||||
}
|
||||
|
||||
} // End of namespace Pegasus
|
||||
68
engines/pegasus/items/biochips/aichip.h
Normal file
68
engines/pegasus/items/biochips/aichip.h
Normal file
@@ -0,0 +1,68 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* Additional copyright for this file:
|
||||
* Copyright (C) 1995-1997 Presto Studios, Inc.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef PEGASUS_ITEMS_BIOCHIPS_AICHIP_H
|
||||
#define PEGASUS_ITEMS_BIOCHIPS_AICHIP_H
|
||||
|
||||
#include "pegasus/hotspot.h"
|
||||
#include "pegasus/items/biochips/biochipitem.h"
|
||||
|
||||
namespace Pegasus {
|
||||
|
||||
class AIChip : public BiochipItem {
|
||||
public:
|
||||
AIChip(const ItemID, const NeighborhoodID, const RoomID, const DirectionConstant);
|
||||
~AIChip() override;
|
||||
|
||||
void select() override;
|
||||
|
||||
void setUpAIChip();
|
||||
|
||||
// Called to set up the AI chip when the AI chip is the current chip but does not
|
||||
// own the center area.
|
||||
void setUpAIChipRude();
|
||||
void activateAIHotspots();
|
||||
void clickInAIHotspot(HotSpotID);
|
||||
|
||||
void takeSharedArea() override;
|
||||
|
||||
void showBriefingClicked();
|
||||
void showEnvScanClicked();
|
||||
void clearClicked();
|
||||
|
||||
protected:
|
||||
Hotspot _briefingSpot;
|
||||
Hotspot _scanSpot;
|
||||
Hotspot _hint1Spot;
|
||||
Hotspot _hint2Spot;
|
||||
Hotspot _hint3Spot;
|
||||
Hotspot _solveSpot;
|
||||
bool _playingMovie;
|
||||
};
|
||||
|
||||
extern AIChip *g_AIChip;
|
||||
|
||||
} // End of namespace Pegasus
|
||||
|
||||
#endif
|
||||
270
engines/pegasus/items/biochips/arthurchip.cpp
Normal file
270
engines/pegasus/items/biochips/arthurchip.cpp
Normal file
@@ -0,0 +1,270 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* Additional copyright for this file:
|
||||
* Copyright (C) 1995-1997 Presto Studios, Inc.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "pegasus/pegasus.h"
|
||||
#include "pegasus/ai/ai_area.h"
|
||||
#include "pegasus/items/biochips/arthurchip.h"
|
||||
|
||||
namespace Common {
|
||||
DECLARE_SINGLETON(Pegasus::ArthurManager);
|
||||
}
|
||||
|
||||
namespace Pegasus {
|
||||
|
||||
static const char *kArthurWisdomMovies[] = {
|
||||
"Images/AI/Globals/XGLOBA01",
|
||||
"Images/AI/Globals/XGLOBA03",
|
||||
"Images/AI/Globals/XGLOBA06",
|
||||
"Images/AI/Globals/XGLOBA07",
|
||||
"Images/AI/Globals/XGLOBA09",
|
||||
"Images/AI/Globals/XGLOBA17",
|
||||
"Images/AI/Globals/XGLOBA18",
|
||||
"Images/AI/Globals/XGLOBA25",
|
||||
"Images/AI/Globals/XGLOBA26",
|
||||
"Images/AI/Globals/XGLOBA27",
|
||||
"Images/AI/Globals/XGLOBA28",
|
||||
"Images/AI/Globals/XGLOBA30",
|
||||
"Images/AI/Globals/XGLOBA34",
|
||||
"Images/AI/Globals/XGLOBA35",
|
||||
"Images/AI/Globals/XGLOBA43",
|
||||
"Images/AI/Globals/XGLOBA50",
|
||||
"Images/AI/Globals/XGLOBA56",
|
||||
"Images/AI/Globals/XGLOBA59",
|
||||
"Images/AI/Globals/XGLOBA63",
|
||||
"Images/AI/Globals/XGLOBB10",
|
||||
"Images/AI/Globals/XGLOBB11",
|
||||
"Images/AI/Globals/XGLOBB12",
|
||||
"Images/AI/Globals/XGLOBB13",
|
||||
"Images/AI/Globals/XGLOBB14",
|
||||
"Images/AI/Globals/XGLOBB15",
|
||||
"Images/AI/Globals/XGLOBB16",
|
||||
"Images/AI/Globals/XGLOBB17",
|
||||
"Images/AI/Globals/XGLOBB18",
|
||||
"Images/AI/Globals/XGLOBB19",
|
||||
"Images/AI/Globals/XGLOBB20",
|
||||
"Images/AI/Globals/XGLOBB21",
|
||||
"Images/AI/Globals/XGLOBB22",
|
||||
"Images/AI/Globals/XGLOBB23",
|
||||
"Images/AI/Globals/XGLOBB24",
|
||||
"Images/AI/Globals/XGLOBB25",
|
||||
"Images/AI/Globals/XGLOBB26",
|
||||
"Images/AI/Globals/XGLOBB27",
|
||||
"Images/AI/Globals/XGLOBB28",
|
||||
"Images/AI/Globals/XGLOBB29",
|
||||
"Images/AI/Globals/XGLOBB30",
|
||||
"Images/AI/Globals/XGLOBB31",
|
||||
"Images/AI/Globals/XGLOBB32",
|
||||
"Images/AI/Globals/XGLOBB33",
|
||||
"Images/AI/Globals/XGLOBB34",
|
||||
"Images/AI/Globals/XGLOBB35",
|
||||
"Images/AI/Globals/XGLOBB36",
|
||||
"Images/AI/Globals/XGLOBB37",
|
||||
"Images/AI/Globals/XGLOBB38",
|
||||
"Images/AI/Globals/XGLOBB39",
|
||||
"Images/AI/Globals/XGLOBB43",
|
||||
"Images/AI/Globals/XGLOBB44",
|
||||
"Images/AI/Globals/XGLOBA62"
|
||||
};
|
||||
|
||||
ArthurChip *g_arthurChip = nullptr;
|
||||
|
||||
ArthurChip::ArthurChip(const ItemID id, const NeighborhoodID neighborhood, const RoomID room, const DirectionConstant direction) :
|
||||
BiochipItem(id, neighborhood, room, direction), _arthurWisdomHotspot(kArthurWisdomSpotID),
|
||||
_chattyArthurHotspot(kChattyArthurSpotID), _chattyAIHotspot(kChattyAISpotID),
|
||||
_arthurHeadHotspot(kArthurHeadSpotID) {
|
||||
_lastArthurMovie = "";
|
||||
|
||||
_arthurWisdomHotspot.setArea(Common::Rect(kAIMiddleAreaLeft + 20, kAIMiddleAreaTop + 27, kAIMiddleAreaLeft + 20 + 161, kAIMiddleAreaTop + 27 + 30));
|
||||
_arthurWisdomHotspot.setHotspotFlags(kArthurBiochipSpotFlag);
|
||||
g_allHotspots.push_back(&_arthurWisdomHotspot);
|
||||
|
||||
_chattyArthurHotspot.setArea(Common::Rect(kAIMiddleAreaLeft + 100, kAIMiddleAreaTop + 67, kAIMiddleAreaLeft + 100 + 20, kAIMiddleAreaTop + 67 + 20));
|
||||
_chattyArthurHotspot.setHotspotFlags(kArthurBiochipSpotFlag);
|
||||
g_allHotspots.push_back(&_chattyArthurHotspot);
|
||||
|
||||
_chattyAIHotspot.setArea(Common::Rect(kAIMiddleAreaLeft + 130, kAIMiddleAreaTop + 67, kAIMiddleAreaLeft + 130 + 20, kAIMiddleAreaTop + 67 + 20));
|
||||
_chattyAIHotspot.setHotspotFlags(kArthurBiochipSpotFlag);
|
||||
g_allHotspots.push_back(&_chattyAIHotspot);
|
||||
|
||||
_arthurHeadHotspot.setArea(Common::Rect(kAIRightAreaLeft, kAIRightAreaTop, kAIRightAreaLeft + kAIRightAreaWidth, kAIRightAreaTop + kAIRightAreaHeight));
|
||||
_arthurHeadHotspot.setHotspotFlags(kArthurBiochipSpotFlag);
|
||||
g_allHotspots.push_back(&_arthurHeadHotspot);
|
||||
|
||||
setItemState(kArthur000);
|
||||
|
||||
g_arthurChip = this;
|
||||
}
|
||||
|
||||
ArthurChip::~ArthurChip() {
|
||||
g_arthurChip = nullptr;
|
||||
|
||||
g_allHotspots.removeOneHotspot(kArthurWisdomSpotID);
|
||||
g_allHotspots.removeOneHotspot(kChattyArthurSpotID);
|
||||
g_allHotspots.removeOneHotspot(kChattyAISpotID);
|
||||
g_allHotspots.removeOneHotspot(kArthurHeadSpotID);
|
||||
}
|
||||
|
||||
void ArthurChip::select() {
|
||||
BiochipItem::select();
|
||||
setUpArthurChip();
|
||||
}
|
||||
|
||||
void ArthurChip::setUpArthurChip() {
|
||||
ItemState state = getItemState();
|
||||
|
||||
if (g_vm->isChattyArthur()) {
|
||||
if (g_AIArea && g_vm->isChattyAI()) {
|
||||
if (state != kArthur002)
|
||||
setItemState(kArthur000);
|
||||
} else if (state != kArthur102) {
|
||||
setItemState(kArthur100);
|
||||
}
|
||||
} else {
|
||||
if (g_AIArea && g_vm->isChattyAI()) {
|
||||
if (state != kArthur012)
|
||||
setItemState(kArthur010);
|
||||
} else if (state != kArthur112) {
|
||||
setItemState(kArthur110);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ArthurChip::activateArthurHotspots() {
|
||||
_arthurWisdomHotspot.setActive();
|
||||
_chattyArthurHotspot.setActive();
|
||||
_chattyAIHotspot.setActive();
|
||||
_arthurHeadHotspot.setActive();
|
||||
}
|
||||
|
||||
void ArthurChip::clickInArthurHotspot(HotSpotID id) {
|
||||
ItemState state, newState;
|
||||
|
||||
if (id == kArthurHeadSpotID) {
|
||||
if (_lastArthurMovie != "")
|
||||
playArthurMovie(_lastArthurMovie);
|
||||
return;
|
||||
}
|
||||
|
||||
newState = state = getItemState();
|
||||
switch (state) {
|
||||
case kArthur000:
|
||||
switch (id) {
|
||||
case kArthurWisdomSpotID:
|
||||
newState = kArthur002;
|
||||
break;
|
||||
case kChattyArthurSpotID:
|
||||
newState = kArthur010;
|
||||
break;
|
||||
case kChattyAISpotID:
|
||||
newState = kArthur100;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case kArthur010:
|
||||
switch (id) {
|
||||
case kArthurWisdomSpotID:
|
||||
newState = kArthur012;
|
||||
break;
|
||||
case kChattyArthurSpotID:
|
||||
newState = kArthur000;
|
||||
break;
|
||||
case kChattyAISpotID:
|
||||
newState = kArthur110;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case kArthur100:
|
||||
switch (id) {
|
||||
case kArthurWisdomSpotID:
|
||||
newState = kArthur102;
|
||||
break;
|
||||
case kChattyArthurSpotID:
|
||||
newState = kArthur110;
|
||||
break;
|
||||
case kChattyAISpotID:
|
||||
newState = kArthur010;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case kArthur110:
|
||||
switch (id) {
|
||||
case kArthurWisdomSpotID:
|
||||
newState = kArthur112;
|
||||
break;
|
||||
case kChattyArthurSpotID:
|
||||
newState = kArthur100;
|
||||
break;
|
||||
case kChattyAISpotID:
|
||||
newState = kArthur010;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
setItemState(newState);
|
||||
switch (id) {
|
||||
case kArthurWisdomSpotID:
|
||||
playArthurMovie(kArthurWisdomMovies[g_vm->getRandomNumber((
|
||||
sizeof(kArthurWisdomMovies) / sizeof(const char *)) - 1)]);
|
||||
break;
|
||||
case kChattyArthurSpotID:
|
||||
g_vm->setChattyArthur(!g_vm->isChattyArthur());
|
||||
break;
|
||||
case kChattyAISpotID:
|
||||
g_vm->setChattyAI(!g_vm->isChattyAI());
|
||||
break;
|
||||
}
|
||||
|
||||
setItemState(state);
|
||||
}
|
||||
|
||||
void ArthurChip::playArthurMovie(const Common::Path &movieName) {
|
||||
if (g_AIArea) {
|
||||
g_AIArea->playAIMovie(kRightAreaSignature, movieName, false, kHintInterruption);
|
||||
if (movieName != "Images/AI/Globals/XGLOB00" &&
|
||||
movieName != "Images/AI/Globals/XGLOB01" &&
|
||||
movieName != "Images/AI/Globals/XGLOBAA0" &&
|
||||
movieName != "Images/AI/Globals/XGLOBAA1" &&
|
||||
movieName != "Images/AI/Globals/XGLOBAA2")
|
||||
_lastArthurMovie = movieName;
|
||||
}
|
||||
}
|
||||
|
||||
bool ArthurChip::playArthurMovieForEvent(const Common::Path &movieName, ArthurEvent event) {
|
||||
if (g_vm->isDVD() && g_vm->playerHasItemID(kArthurBiochip) &&
|
||||
g_vm->isChattyArthur() && !Arthur._arthurFlags.getFlag(event)) {
|
||||
Arthur._arthurFlags.setFlag(event, true);
|
||||
playArthurMovie(movieName);
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
void ArthurManager::resetArthurState() {
|
||||
bool savedGameFlag = _arthurFlags.getFlag(kArthurLoadedSavedGame);
|
||||
_arthurFlags.clearAllFlags();
|
||||
_arthurFlags.setFlag(kArthurLoadedSavedGame, savedGameFlag);
|
||||
}
|
||||
|
||||
} // End of namespace Pegasus
|
||||
221
engines/pegasus/items/biochips/arthurchip.h
Normal file
221
engines/pegasus/items/biochips/arthurchip.h
Normal file
@@ -0,0 +1,221 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* Additional copyright for this file:
|
||||
* Copyright (C) 1995-1997 Presto Studios, Inc.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef PEGASUS_ITEMS_BIOCHIPS_ARTHURCHIP_H
|
||||
#define PEGASUS_ITEMS_BIOCHIPS_ARTHURCHIP_H
|
||||
|
||||
#include "pegasus/hotspot.h"
|
||||
#include "pegasus/util.h"
|
||||
#include "pegasus/items/biochips/biochipitem.h"
|
||||
|
||||
namespace Pegasus {
|
||||
|
||||
enum ArthurEvent {
|
||||
kArthurLoadedSavedGame,
|
||||
kArthurAttemptedLockedDoor,
|
||||
kArthurAttemptedLockedDoorAgain,
|
||||
kArthurDestroyedInventoryItem,
|
||||
kArthurDisabledAI,
|
||||
|
||||
kArthurCaldoriaFinishedJoyride,
|
||||
kArthurCaldoriaSelectedStickyBuns,
|
||||
kArthurCaldoriaCreatedCornbread,
|
||||
kArthurCaldoriaDrankOJ,
|
||||
kArthurCaldoriaZoomedToLaundry,
|
||||
kArthurCaldoriaReachedToilet,
|
||||
kArthurCaldoriaReadPaper,
|
||||
kArthurCaldoriaChoseAgencyHairStyle,
|
||||
kArthurCaldoriaSawVacantApartment,
|
||||
kArthurCaldoriaLookThroughTelescope,
|
||||
kArthurCaldoriaRoofDoor,
|
||||
kArthurCaldoriaUsedCardBomb,
|
||||
kArthurCaldoriaBlownDoor,
|
||||
kArthurCaldoriaSawVoiceAnalysis,
|
||||
kArthurCaldoriaStunningSinclair,
|
||||
kArthurCaldoriaSeeRoofBomb,
|
||||
kArthurCaldoriaDisarmedNuke,
|
||||
|
||||
kArthurTSAEnteredCave,
|
||||
kArthurTSASawAgent3,
|
||||
kArthurTSASawBust,
|
||||
kArthurTSAReachedJunction,
|
||||
kArthurTSAClickedRobot1,
|
||||
kArthurTSAClickedRobot2,
|
||||
kArthurTSAOpenTBPMonitor,
|
||||
kArthurTSASawJourneymanKey,
|
||||
kArthurTSASawBiochips,
|
||||
kArthurTSAUsedPegasus,
|
||||
kArthurTSAConfinedByBaldwin,
|
||||
kArthurTSARedirectedRobots,
|
||||
kArthurTSAUsedTurbolift,
|
||||
kArthurTSASawFirstOpMemMovie,
|
||||
kArthurTSAInPegasusNoVideo,
|
||||
kArthurTSASawBaldwinSayGo,
|
||||
kArthurTSALeaving,
|
||||
|
||||
kArthurGoToPrehistoric,
|
||||
|
||||
kArthurPrehistoricReachedJunction,
|
||||
kArthurPrehistoricSawBreaker,
|
||||
kArthurPrehistoricBreakerThrown,
|
||||
kArthurPrehistoricAtCliffEdge,
|
||||
kArthurPrehistoricSawEggs,
|
||||
kArthurPrehistoricZoomedToVault,
|
||||
kArthurPrehistoricAttemptedBridge,
|
||||
kArthurPrehistoricExtendedBridge,
|
||||
kArthurPrehistoricCrossedBridge,
|
||||
kArthurPrehistoricUnlockedVault,
|
||||
|
||||
kArthurMarsReadyForKiosk,
|
||||
kArthurMarsLookedAtGuards,
|
||||
kArthurMarsZoomedToKeyCard,
|
||||
kArthurMarsTurnedOnTransport,
|
||||
kArthurMarsCantFillMask,
|
||||
kArthurMarsSawWelcomeVideos,
|
||||
kArthurMarsRobotThrownPlayerWithMask,
|
||||
kArthurMarsLeftPodNoCrowBar,
|
||||
kArthurMarsLookAtEmptyTracks,
|
||||
kArthurMarsEnteredReactor,
|
||||
kArthurMarsSawLockedPanel,
|
||||
kArthurMarsSawLockedPanelNoNitrogen,
|
||||
kArthurMarsUsedLiquidNitrogen,
|
||||
kArthurMarsFoundCardBomb,
|
||||
kArthurMarsSolvedReactorGame,
|
||||
kArthurMarsDeactivatedCardBomb,
|
||||
kArthurMarsExitedReactorWithCardBomb,
|
||||
kArthurMarsInAirlockNoOxygen,
|
||||
kArthurMarsMazeReachedJunction,
|
||||
kArthurMarsOxygen50Warning,
|
||||
kArthurMarsOxygen25Warning,
|
||||
kArthurMarsOxygen5Warning,
|
||||
kArthurMarsFoundBuckets,
|
||||
kArthurMarsApproachedBuckets,
|
||||
kArthurMarsEnteredGearRoom,
|
||||
kArthurMarsLookAtGears,
|
||||
kArthurMarsExitedGearRoom,
|
||||
kArthurMarsFoundNoShuttlePresent,
|
||||
kArthurMarsEnteredShuttle,
|
||||
kArthurMarsFoundDeadRobot,
|
||||
kArthurMarsRobotHeadOpen,
|
||||
|
||||
kArthurWSCRemovedDart,
|
||||
kArthurWSCPoisonedDuringGame,
|
||||
kArthurWSCFailedMolecule,
|
||||
kArthurWSCDesignedAntidote,
|
||||
kArthurWSCSawAresHologram,
|
||||
kArthurWSCLookAtMorphExperiment,
|
||||
kArthurWSCStartMorphExperiment,
|
||||
kArthurWSCSawMorphExperiment,
|
||||
kArthurWSCLeftLabNoKeyOrCanisters,
|
||||
kArthurWSCAtOppositeDoor,
|
||||
kArthurWSCReadyForMap,
|
||||
kArthurWSCAttemptedLockedDoor,
|
||||
kArthurWSCSawSinclairDoor,
|
||||
kArthurWSCSawSinclairDoorNoKey,
|
||||
kArthurWSCAttemptedSinclairDoorNoKey,
|
||||
kArthurWSCZoomedToSnake,
|
||||
kArthurWSCActivatedComputer,
|
||||
kArthurWSCZoomedToSinclairMessages,
|
||||
kArthurWSCPlayedEasterEggMessage,
|
||||
kArthurWSCGotMachineGun,
|
||||
kArthurWSCSeenNerd,
|
||||
kArthurWSCSawBrokenDoor,
|
||||
kArthurWSCSawBrokenDoorNoCrowBar,
|
||||
kArthurWSCUsedCrowBar,
|
||||
kArthurWSCDidPlasmaDodge,
|
||||
kArthurWSCEnteredAuditorium,
|
||||
kArthurWSCSawSinclairLecture,
|
||||
kArthurWSCEnteredPassage,
|
||||
kArthurWSCInPassage,
|
||||
kArthurWSCExitedPassage,
|
||||
kArthurWSCSawCatwalkDoor,
|
||||
kArthurWSCRobotHeadOpen,
|
||||
|
||||
kArthurNoradAtSecurityMonitor,
|
||||
kArthurNoradSawFillingStation,
|
||||
kArthurNoradSawIntakeWarning,
|
||||
kArthurNoradDidntFillCanisters,
|
||||
kArthurNoradSawUnconsciousOperator,
|
||||
kArthurNoradAttemptedLockedDoor,
|
||||
kArthurNoradAttemptedLockedDoorAgain,
|
||||
kArthurNoradReachedPressureDoor,
|
||||
kArthurNoradSawSubMessage,
|
||||
kArthurNoradSawClawMonitor,
|
||||
kArthurNoradPlayedWithClaw,
|
||||
kArthurNoradEnteredSub,
|
||||
kArthurNoradExitedSub,
|
||||
kArthurNoradApproachedDamagedDoor,
|
||||
kArthurNoradAtRetScanNoBiochip,
|
||||
kArthurNoradStartGlobeGame,
|
||||
kArthurNoradSelectedIncorrectSilo,
|
||||
kArthurNoradFinishedGlobeGame,
|
||||
kArthurNoradThreatenedByRobot,
|
||||
kArthurNoradBeatRobotWithClaw,
|
||||
kArthurNoradRobotHeadOpen,
|
||||
|
||||
kNumArthurFlags
|
||||
};
|
||||
|
||||
class ArthurChip : public BiochipItem {
|
||||
public:
|
||||
ArthurChip(const ItemID, const NeighborhoodID, const RoomID, const DirectionConstant);
|
||||
virtual ~ArthurChip();
|
||||
|
||||
void select();
|
||||
|
||||
void setUpArthurChip();
|
||||
void activateArthurHotspots();
|
||||
void clickInArthurHotspot(HotSpotID);
|
||||
void playArthurMovie(const Common::Path &);
|
||||
bool playArthurMovieForEvent(const Common::Path &, ArthurEvent event);
|
||||
|
||||
protected:
|
||||
Hotspot _arthurWisdomHotspot;
|
||||
Hotspot _chattyArthurHotspot;
|
||||
Hotspot _chattyAIHotspot;
|
||||
Hotspot _arthurHeadHotspot;
|
||||
Common::Path _lastArthurMovie;
|
||||
};
|
||||
|
||||
class ArthurManager : public Common::Singleton<ArthurManager> {
|
||||
public:
|
||||
ArthurManager() { resetArthurState(); }
|
||||
|
||||
void resetArthurState();
|
||||
|
||||
protected:
|
||||
friend class Common::Singleton<SingletonBaseType>;
|
||||
friend class ArthurChip;
|
||||
|
||||
private:
|
||||
FlagsArray<byte, kNumArthurFlags> _arthurFlags;
|
||||
};
|
||||
|
||||
extern ArthurChip *g_arthurChip;
|
||||
|
||||
} // End of namespace Pegasus
|
||||
|
||||
#define Arthur (::Pegasus::ArthurManager::instance())
|
||||
|
||||
#endif
|
||||
92
engines/pegasus/items/biochips/biochipitem.cpp
Normal file
92
engines/pegasus/items/biochips/biochipitem.cpp
Normal file
@@ -0,0 +1,92 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* Additional copyright for this file:
|
||||
* Copyright (C) 1995-1997 Presto Studios, Inc.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#include "common/stream.h"
|
||||
|
||||
#include "pegasus/pegasus.h"
|
||||
#include "pegasus/ai/ai_area.h"
|
||||
#include "pegasus/items/biochips/biochipitem.h"
|
||||
|
||||
namespace Pegasus {
|
||||
|
||||
BiochipItem::BiochipItem(const ItemID id, const NeighborhoodID neighborhood, const RoomID room, const DirectionConstant direction) :
|
||||
Item(id, neighborhood, room, direction) {
|
||||
|
||||
Common::SeekableReadStream *biochipInfo = g_vm->_resFork->getResource(MKTAG('B', 'i', 'o', 'I'), kItemBaseResID + id);
|
||||
if (biochipInfo) {
|
||||
_biochipInfoPanelTime = biochipInfo->readUint32BE();
|
||||
delete biochipInfo;
|
||||
} else {
|
||||
_biochipInfoPanelTime = 0;
|
||||
}
|
||||
|
||||
Common::SeekableReadStream *rightInfo = g_vm->_resFork->getResource(MKTAG('R', 'g', 'h', 't'), kItemBaseResID + id);
|
||||
if (!rightInfo)
|
||||
error("Could not find right info for biochip %d", id);
|
||||
|
||||
_rightAreaInfo = readItemState(rightInfo);
|
||||
delete rightInfo;
|
||||
|
||||
setItemState(kNormalItem);
|
||||
}
|
||||
|
||||
BiochipItem::~BiochipItem() {
|
||||
delete[] _rightAreaInfo.entries;
|
||||
}
|
||||
|
||||
ItemType BiochipItem::getItemType() {
|
||||
return kBiochipItemType;
|
||||
}
|
||||
|
||||
TimeValue BiochipItem::getRightAreaTime() const {
|
||||
if (!_rightAreaInfo.entries)
|
||||
return 0xffffffff;
|
||||
|
||||
TimeValue time;
|
||||
ItemState state;
|
||||
|
||||
findItemStateEntryByState(_rightAreaInfo, _itemState, time);
|
||||
if (time == 0xffffffff)
|
||||
getItemStateEntry(_rightAreaInfo, 0, state, time);
|
||||
|
||||
return time;
|
||||
}
|
||||
|
||||
// Must affect images in right area.
|
||||
void BiochipItem::select() {
|
||||
Item::select();
|
||||
|
||||
if (g_AIArea)
|
||||
g_AIArea->setAIAreaToTime(kBiochipSignature, kRightAreaSignature, getRightAreaTime());
|
||||
}
|
||||
|
||||
void BiochipItem::deselect() {
|
||||
Item::deselect();
|
||||
|
||||
if (g_AIArea)
|
||||
g_AIArea->setAIAreaToTime(kBiochipSignature, kRightAreaSignature, 0xffffffff);
|
||||
}
|
||||
|
||||
} // End of namespace Pegasus
|
||||
53
engines/pegasus/items/biochips/biochipitem.h
Normal file
53
engines/pegasus/items/biochips/biochipitem.h
Normal file
@@ -0,0 +1,53 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* Additional copyright for this file:
|
||||
* Copyright (C) 1995-1997 Presto Studios, Inc.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef PEGASUS_ITEMS_BIOCHIPS_BIOCHIPITEM_H
|
||||
#define PEGASUS_ITEMS_BIOCHIPS_BIOCHIPITEM_H
|
||||
|
||||
#include "pegasus/items/item.h"
|
||||
|
||||
namespace Pegasus {
|
||||
|
||||
class BiochipItem : public Item {
|
||||
public:
|
||||
BiochipItem(const ItemID, const NeighborhoodID, const RoomID, const DirectionConstant);
|
||||
~BiochipItem() override;
|
||||
|
||||
ItemType getItemType() override;
|
||||
|
||||
TimeValue getPanelTime() const { return _biochipInfoPanelTime; }
|
||||
TimeValue getRightAreaTime() const;
|
||||
|
||||
// Must affect images in right area.
|
||||
void select() override;
|
||||
void deselect() override;
|
||||
|
||||
protected:
|
||||
TimeValue _biochipInfoPanelTime;
|
||||
ItemStateInfo _rightAreaInfo;
|
||||
};
|
||||
|
||||
} // End of namespace Pegasus
|
||||
|
||||
#endif
|
||||
105
engines/pegasus/items/biochips/mapchip.cpp
Normal file
105
engines/pegasus/items/biochips/mapchip.cpp
Normal file
@@ -0,0 +1,105 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* Additional copyright for this file:
|
||||
* Copyright (C) 1995-1997 Presto Studios, Inc.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "pegasus/gamestate.h"
|
||||
#include "pegasus/ai/ai_area.h"
|
||||
#include "pegasus/items/biochips/mapchip.h"
|
||||
#include "pegasus/neighborhood/neighborhood.h"
|
||||
|
||||
namespace Pegasus {
|
||||
|
||||
MapChip *g_map = nullptr;
|
||||
|
||||
MapChip::MapChip(const ItemID id, const NeighborhoodID neighborhood, const RoomID room, const DirectionConstant direction) :
|
||||
BiochipItem(id, neighborhood, room, direction) {
|
||||
g_map = this;
|
||||
setItemState(kMapUnavailable);
|
||||
}
|
||||
|
||||
MapChip::~MapChip() {
|
||||
g_map = nullptr;
|
||||
}
|
||||
|
||||
void MapChip::writeToStream(Common::WriteStream *stream) {
|
||||
return _image.writeToStream(stream);
|
||||
}
|
||||
|
||||
void MapChip::readFromStream(Common::ReadStream *stream) {
|
||||
return _image.readFromStream(stream);
|
||||
}
|
||||
|
||||
void MapChip::select() {
|
||||
BiochipItem::select();
|
||||
moveToMapLocation(GameState.getCurrentNeighborhood(), GameState.getCurrentRoom(), GameState.getCurrentDirection());
|
||||
_image.show();
|
||||
}
|
||||
|
||||
void MapChip::takeSharedArea() {
|
||||
_image.show();
|
||||
}
|
||||
|
||||
void MapChip::giveUpSharedArea() {
|
||||
_image.hide();
|
||||
}
|
||||
|
||||
void MapChip::deselect() {
|
||||
BiochipItem::deselect();
|
||||
_image.unloadImage();
|
||||
}
|
||||
|
||||
void MapChip::moveToMapLocation(const NeighborhoodID neighborhood, const RoomID room, const DirectionConstant dir) {
|
||||
AirQuality airQuality;
|
||||
|
||||
if (g_neighborhood)
|
||||
airQuality = g_neighborhood->getAirQuality(room);
|
||||
else
|
||||
airQuality = kAirQualityGood;
|
||||
|
||||
switch (neighborhood) {
|
||||
case kMarsID:
|
||||
if (airQuality == kAirQualityVacuum) {
|
||||
if (room >= kMars35 && room <= kMars39) {
|
||||
setItemState(kMapEngaged);
|
||||
if (isSelected() && g_AIArea && g_AIArea->getMiddleAreaOwner() == kBiochipSignature)
|
||||
_image.loadGearRoomIfNecessary();
|
||||
} else {
|
||||
setItemState(kMapEngaged);
|
||||
if (isSelected() && g_AIArea && g_AIArea->getMiddleAreaOwner() == kBiochipSignature)
|
||||
_image.loadMazeIfNecessary();
|
||||
}
|
||||
|
||||
_image.moveToMapLocation(neighborhood, room, dir);
|
||||
} else {
|
||||
_image.unloadImage();
|
||||
setItemState(kMapUnavailable);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
_image.unloadImage();
|
||||
setItemState(kMapUnavailable);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
} // End of namespace Pegasus
|
||||
63
engines/pegasus/items/biochips/mapchip.h
Normal file
63
engines/pegasus/items/biochips/mapchip.h
Normal file
@@ -0,0 +1,63 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* Additional copyright for this file:
|
||||
* Copyright (C) 1995-1997 Presto Studios, Inc.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef PEGASUS_ITEMS_BIOCHIPS_MAPCHIP_H
|
||||
#define PEGASUS_ITEMS_BIOCHIPS_MAPCHIP_H
|
||||
|
||||
#include "pegasus/items/biochips/biochipitem.h"
|
||||
#include "pegasus/items/biochips/mapimage.h"
|
||||
|
||||
namespace Common {
|
||||
class ReadStream;
|
||||
class WriteStream;
|
||||
}
|
||||
|
||||
namespace Pegasus {
|
||||
|
||||
class MapChip : public BiochipItem {
|
||||
public:
|
||||
MapChip(const ItemID, const NeighborhoodID, const RoomID, const DirectionConstant);
|
||||
~MapChip() override;
|
||||
|
||||
void select() override;
|
||||
void deselect() override;
|
||||
void takeSharedArea() override;
|
||||
void giveUpSharedArea() override;
|
||||
|
||||
void moveToMapLocation(const NeighborhoodID, const RoomID, const DirectionConstant);
|
||||
|
||||
void writeToStream(Common::WriteStream *) override;
|
||||
void readFromStream(Common::ReadStream *) override;
|
||||
|
||||
bool beenToMaze() { return _image.anyFlagSet(); }
|
||||
|
||||
protected:
|
||||
MapImage _image;
|
||||
};
|
||||
|
||||
extern MapChip *g_map;
|
||||
|
||||
} // End of namespace Pegasus
|
||||
|
||||
#endif
|
||||
444
engines/pegasus/items/biochips/mapimage.cpp
Normal file
444
engines/pegasus/items/biochips/mapimage.cpp
Normal file
@@ -0,0 +1,444 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* Additional copyright for this file:
|
||||
* Copyright (C) 1995-1997 Presto Studios, Inc.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "pegasus/gamestate.h"
|
||||
#include "pegasus/pegasus.h"
|
||||
#include "pegasus/items/biochips/mapimage.h"
|
||||
|
||||
namespace Pegasus {
|
||||
|
||||
#define FLAG_TO_INDEX(flag) ((flag) >> 2)
|
||||
#define INDEX_TO_FLAG(index) ((index) << 2)
|
||||
|
||||
#define ROOM_TO_INDEX(room) \
|
||||
(((room) >= kMars35 && (room) <= kMars39) ? ((room) - kMars35) : \
|
||||
(((room) == kMars60) ? (kMars39 - kMars35 + 1) : \
|
||||
((room) - kMarsMaze004 + kMars39 - kMars35 + 2)))
|
||||
|
||||
#define INDEX_TO_ROOM(index) \
|
||||
(((index) <= ROOM_TO_INDEX(kMars39)) ? \
|
||||
(((index) - ROOM_TO_INDEX(kMars35)) + kMars35) : \
|
||||
((index) <= ROOM_TO_INDEX(kMars60,)) ? kMars60 : \
|
||||
((((index) - ROOM_TO_INDEX(kMarsMaze004))) + kMarsMaze004))
|
||||
|
||||
#define ROOM_TO_FLAG(room, dir) (INDEX_TO_FLAG(ROOM_TO_INDEX(room)) | (dir))
|
||||
|
||||
#define FLAG_TO_ROOM(flag) (INDEX_TO_ROOM(FLAG_TO_INDEX(flag)))
|
||||
|
||||
#define FLAG_TO_DIRECTION(flag) ((flag) & 3)
|
||||
|
||||
static const int kGearRoomFlagLow = ROOM_TO_FLAG(kMars35, kNorth);
|
||||
static const int kGearRoomFlagHigh = ROOM_TO_FLAG(kMars39, kWest);
|
||||
|
||||
static const int kMazeFlagLow = ROOM_TO_FLAG(kMars60, kNorth);
|
||||
static const int kMazeFlagHigh = ROOM_TO_FLAG(kMarsMaze200, kWest);
|
||||
|
||||
static const CoordType kGearRoomScreenOffsetX = 49;
|
||||
static const CoordType kGearRoomScreenOffsetY = 47;
|
||||
|
||||
static const CoordType kGearRoomGridOriginX = 1;
|
||||
static const CoordType kGearRoomGridOriginY = 4;
|
||||
|
||||
static const CoordType kMazeScreenOffsetX = 16;
|
||||
static const CoordType kMazeScreenOffsetY = 20;
|
||||
|
||||
static const CoordType kMazeGridOriginX = 6;
|
||||
static const CoordType kMazeGridOriginY = 1;
|
||||
|
||||
static const CoordType kGridWidth = 4;
|
||||
static const CoordType kGridHeight = 4;
|
||||
|
||||
static const uint16 kMapOfMazePICTID = 906;
|
||||
static const uint16 kMapOfGearRoomPICTID = 907;
|
||||
|
||||
static const int s_mapCoords[MapImage::kNumMappingRooms][2] = {
|
||||
/* kMars35 */ { 0, 0 },
|
||||
/* kMars36 */ { 1, 0 },
|
||||
/* kMars37 */ { 2, 0 },
|
||||
/* kMars38 */ { 3, 0 },
|
||||
/* kMars39 */ { 4, 0 },
|
||||
/* kMars60 */ { 19, 9 },
|
||||
/* kMarsMaze004 */ { 18, 9 },
|
||||
/* kMarsMaze005 */ { 18, 10 },
|
||||
/* kMarsMaze006 */ { 17, 10 },
|
||||
/* kMarsMaze007 */ { 16, 10 },
|
||||
/* kMarsMaze008 */ { 15, 10 },
|
||||
/* kMarsMaze009 */ { 14, 10 },
|
||||
/* kMarsMaze010 */ { 14, 9 },
|
||||
/* kMarsMaze011 */ { 14, 8 },
|
||||
/* kMarsMaze012 */ { 14, 7 },
|
||||
/* kMarsMaze015 */ { 16, 7 },
|
||||
/* kMarsMaze016 */ { 14, 11 },
|
||||
/* kMarsMaze017 */ { 14, 12 },
|
||||
/* kMarsMaze018 */ { 15, 12 },
|
||||
/* kMarsMaze019 */ { 16, 12 },
|
||||
/* kMarsMaze020 */ { 16, 13 },
|
||||
/* kMarsMaze021 */ { 16, 14 },
|
||||
/* kMarsMaze022 */ { 16, 15 },
|
||||
/* kMarsMaze023 */ { 17, 15 },
|
||||
/* kMarsMaze024 */ { 18, 15 },
|
||||
/* kMarsMaze025 */ { 18, 14 },
|
||||
/* kMarsMaze026 */ { 18, 13 },
|
||||
/* kMarsMaze027 */ { 18, 12 },
|
||||
/* kMarsMaze028 */ { 18, 11 },
|
||||
/* kMarsMaze031 */ { 19, 14 },
|
||||
/* kMarsMaze032 */ { 20, 14 },
|
||||
/* kMarsMaze033 */ { 20, 13 },
|
||||
/* kMarsMaze034 */ { 20, 12 },
|
||||
/* kMarsMaze035 */ { 20, 11 },
|
||||
/* kMarsMaze036 */ { 21, 11 },
|
||||
/* kMarsMaze037 */ { 15, 15 },
|
||||
/* kMarsMaze038 */ { 14, 15 },
|
||||
/* kMarsMaze039 */ { 13, 15 },
|
||||
/* kMarsMaze042 */ { 10, 15 },
|
||||
/* kMarsMaze043 */ { 9, 15 },
|
||||
/* kMarsMaze044 */ { 8, 15 },
|
||||
/* kMarsMaze045 */ { 7, 15 },
|
||||
/* kMarsMaze046 */ { 6, 15 },
|
||||
/* kMarsMaze047 */ { 5, 15 },
|
||||
/* kMarsMaze049 */ { 13, 14 },
|
||||
/* kMarsMaze050 */ { 12, 14 },
|
||||
/* kMarsMaze051 */ { 11, 14 },
|
||||
/* kMarsMaze052 */ { 10, 14 },
|
||||
/* kMarsMaze053 */ { 10, 13 },
|
||||
/* kMarsMaze054 */ { 9, 13 },
|
||||
/* kMarsMaze055 */ { 8, 13 },
|
||||
/* kMarsMaze056 */ { 8, 12 },
|
||||
/* kMarsMaze057 */ { 7, 12 },
|
||||
/* kMarsMaze058 */ { 12, 13 },
|
||||
/* kMarsMaze059 */ { 12, 12 },
|
||||
/* kMarsMaze060 */ { 12, 11 },
|
||||
/* kMarsMaze061 */ { 12, 10 },
|
||||
/* kMarsMaze063 */ { 12, 9 },
|
||||
/* kMarsMaze064 */ { 12, 8 },
|
||||
/* kMarsMaze065 */ { 12, 7 },
|
||||
/* kMarsMaze066 */ { 13, 7 },
|
||||
/* kMarsMaze067 */ { 15, 7 },
|
||||
/* kMarsMaze068 */ { 17, 7 },
|
||||
/* kMarsMaze069 */ { 18, 7 },
|
||||
/* kMarsMaze070 */ { 19, 7 },
|
||||
/* kMarsMaze071 */ { 20, 7 },
|
||||
/* kMarsMaze072 */ { 20, 6 },
|
||||
/* kMarsMaze074 */ { 20, 5 },
|
||||
/* kMarsMaze076 */ { 20, 4 },
|
||||
/* kMarsMaze078 */ { 20, 3 },
|
||||
/* kMarsMaze079 */ { 20, 2 },
|
||||
/* kMarsMaze081 */ { 20, 2 },
|
||||
/* kMarsMaze083 */ { 20, 0 },
|
||||
/* kMarsMaze084 */ { 19, 0 },
|
||||
/* kMarsMaze085 */ { 18, 0 },
|
||||
/* kMarsMaze086 */ { 17, 0 },
|
||||
/* kMarsMaze087 */ { 16, 0 },
|
||||
/* kMarsMaze088 */ { 15, 0 },
|
||||
/* kMarsMaze089 */ { 14, 0 },
|
||||
/* kMarsMaze090 */ { 13, 0 },
|
||||
/* kMarsMaze091 */ { 12, 0 },
|
||||
/* kMarsMaze092 */ { 11, 0 },
|
||||
/* kMarsMaze093 */ { 10, 0 },
|
||||
/* kMarsMaze098 */ { 10, 1 },
|
||||
/* kMarsMaze099 */ { 8, 2 },
|
||||
/* kMarsMaze100 */ { 9, 2 },
|
||||
/* kMarsMaze101 */ { 10, 2 },
|
||||
/* kMarsMaze104 */ { 13, 2 },
|
||||
/* kMarsMaze105 */ { 13, 3 },
|
||||
/* kMarsMaze106 */ { 13, 4 },
|
||||
/* kMarsMaze107 */ { 13, 5 },
|
||||
/* kMarsMaze108 */ { 14, 5 },
|
||||
/* kMarsMaze111 */ { 15, 5 },
|
||||
/* kMarsMaze113 */ { 16, 5 },
|
||||
/* kMarsMaze114 */ { 17, 5 },
|
||||
/* kMarsMaze115 */ { 18, 5 },
|
||||
/* kMarsMaze116 */ { 18, 4 },
|
||||
/* kMarsMaze117 */ { 18, 3 },
|
||||
/* kMarsMaze118 */ { 19, 3 },
|
||||
/* kMarsMaze119 */ { 18, 2 },
|
||||
/* kMarsMaze120 */ { 17, 2 },
|
||||
/* kMarsMaze121 */ { 16, 2 },
|
||||
/* kMarsMaze122 */ { 15, 2 },
|
||||
/* kMarsMaze123 */ { 15, 1 },
|
||||
/* kMarsMaze124 */ { 12, 4 },
|
||||
/* kMarsMaze125 */ { 11, 4 },
|
||||
/* kMarsMaze126 */ { 10, 4 },
|
||||
/* kMarsMaze127 */ { 10, 5 },
|
||||
/* kMarsMaze128 */ { 10, 6 },
|
||||
/* kMarsMaze129 */ { 9, 6 },
|
||||
/* kMarsMaze130 */ { 8, 6 },
|
||||
/* kMarsMaze131 */ { 7, 6 },
|
||||
/* kMarsMaze132 */ { 7, 7 },
|
||||
/* kMarsMaze133 */ { 7, 8 },
|
||||
/* kMarsMaze136 */ { 7, 11 },
|
||||
/* kMarsMaze137 */ { 6, 11 },
|
||||
/* kMarsMaze138 */ { 5, 11 },
|
||||
/* kMarsMaze139 */ { 5, 12 },
|
||||
/* kMarsMaze140 */ { 4, 12 },
|
||||
/* kMarsMaze141 */ { 5, 13 },
|
||||
/* kMarsMaze142 */ { 5, 14 },
|
||||
/* kMarsMaze143 */ { 4, 14 },
|
||||
/* kMarsMaze144 */ { 3, 14 },
|
||||
/* kMarsMaze145 */ { 3, 13 },
|
||||
/* kMarsMaze146 */ { 2, 13 },
|
||||
/* kMarsMaze147 */ { 1, 13 },
|
||||
/* kMarsMaze148 */ { 1, 14 },
|
||||
/* kMarsMaze149 */ { 1, 15 },
|
||||
/* kMarsMaze152 */ { 1, 12 },
|
||||
/* kMarsMaze153 */ { 1, 11 },
|
||||
/* kMarsMaze154 */ { 1, 10 },
|
||||
/* kMarsMaze155 */ { 1, 9 },
|
||||
/* kMarsMaze156 */ { 1, 8 },
|
||||
/* kMarsMaze157 */ { 2, 10 },
|
||||
/* kMarsMaze159 */ { 2, 8 },
|
||||
/* kMarsMaze160 */ { 2, 7 },
|
||||
/* kMarsMaze161 */ { 2, 6 },
|
||||
/* kMarsMaze162 */ { 3, 10 },
|
||||
/* kMarsMaze163 */ { 3, 9 },
|
||||
/* kMarsMaze164 */ { 3, 8 },
|
||||
/* kMarsMaze165 */ { 4, 8 },
|
||||
/* kMarsMaze166 */ { 5, 8 },
|
||||
/* kMarsMaze167 */ { 6, 8 },
|
||||
/* kMarsMaze168 */ { 3, 6 },
|
||||
/* kMarsMaze169 */ { 4, 6 },
|
||||
/* kMarsMaze170 */ { 5, 6 },
|
||||
/* kMarsMaze171 */ { 5, 5 },
|
||||
/* kMarsMaze172 */ { 5, 4 },
|
||||
/* kMarsMaze173 */ { 4, 4 },
|
||||
/* kMarsMaze174 */ { 3, 4 },
|
||||
/* kMarsMaze175 */ { 3, 5 },
|
||||
/* kMarsMaze177 */ { 8, 4 },
|
||||
/* kMarsMaze178 */ { 8, 3 },
|
||||
/* kMarsMaze179 */ { 7, 4 },
|
||||
/* kMarsMaze180 */ { 6, 4 },
|
||||
/* kMarsMaze181 */ { 6, 3 },
|
||||
/* kMarsMaze182 */ { 6, 2 },
|
||||
/* kMarsMaze183 */ { 6, 1 },
|
||||
/* kMarsMaze184 */ { 6, 0 },
|
||||
/* kMarsMaze187 */ { 3, 0 },
|
||||
/* kMarsMaze188 */ { 2, 0 },
|
||||
/* kMarsMaze189 */ { 1, 0 },
|
||||
/* kMarsMaze190 */ { 1, 1 },
|
||||
/* kMarsMaze191 */ { 1, 2 },
|
||||
/* kMarsMaze192 */ { 5, 2 },
|
||||
/* kMarsMaze193 */ { 4, 2 },
|
||||
/* kMarsMaze194 */ { 3, 2 },
|
||||
/* kMarsMaze195 */ { 3, 1 },
|
||||
/* kMarsMaze198 */ { 1, 3 },
|
||||
/* kMarsMaze199 */ { 1, 4 },
|
||||
/* kMarsMaze200 */ { 0, 4 }
|
||||
};
|
||||
|
||||
MapImage::MapImage() : DisplayElement(kNoDisplayElement) {
|
||||
_whichArea = kMapNoArea;
|
||||
setBounds(kAIMiddleAreaLeft, kAIMiddleAreaTop, kAIMiddleAreaLeft + kAIMiddleAreaWidth, kAIMiddleAreaTop + kAIMiddleAreaHeight);
|
||||
setDisplayOrder(kAIMiddleAreaOrder + 10);
|
||||
startDisplaying();
|
||||
|
||||
_darkGreen = g_system->getScreenFormat().RGBToColor(64, 150, 10);
|
||||
_lightGreen = g_system->getScreenFormat().RGBToColor(102, 239, 0);
|
||||
}
|
||||
|
||||
void MapImage::writeToStream(Common::WriteStream *stream) {
|
||||
_mappedRooms.writeToStream(stream);
|
||||
}
|
||||
|
||||
void MapImage::readFromStream(Common::ReadStream *stream) {
|
||||
_mappedRooms.readFromStream(stream);
|
||||
}
|
||||
|
||||
void MapImage::loadGearRoomIfNecessary() {
|
||||
if (_whichArea != kMapGearRoom) {
|
||||
_mapImage.getImageFromPICTResource(g_vm->_resFork, kMapOfGearRoomPICTID);
|
||||
|
||||
Common::Rect bounds;
|
||||
_mapImage.getSurfaceBounds(bounds);
|
||||
_mapMask.allocateSurface(bounds);
|
||||
_whichArea = kMapGearRoom;
|
||||
|
||||
GraphicsManager *gfx = g_vm->_gfx;
|
||||
gfx->setCurSurface(_mapMask.getSurface());
|
||||
|
||||
gfx->getCurSurface()->fillRect(bounds, g_system->getScreenFormat().RGBToColor(0xff, 0xff, 0xff));
|
||||
|
||||
for (int i = kGearRoomFlagLow; i <= kGearRoomFlagHigh; i++)
|
||||
if (_mappedRooms.getFlag(i))
|
||||
addFlagToMask(i);
|
||||
|
||||
gfx->setCurSurface(gfx->getWorkArea());
|
||||
show();
|
||||
}
|
||||
}
|
||||
|
||||
void MapImage::loadMazeIfNecessary() {
|
||||
if (_whichArea != kMapMaze) {
|
||||
_mapImage.getImageFromPICTResource(g_vm->_resFork, kMapOfMazePICTID);
|
||||
|
||||
Common::Rect bounds;
|
||||
_mapImage.getSurfaceBounds(bounds);
|
||||
_mapMask.allocateSurface(bounds);
|
||||
_whichArea = kMapMaze;
|
||||
|
||||
GraphicsManager *gfx = g_vm->_gfx;
|
||||
gfx->setCurSurface(_mapMask.getSurface());
|
||||
|
||||
gfx->getCurSurface()->fillRect(bounds, g_system->getScreenFormat().RGBToColor(0xff, 0xff, 0xff));
|
||||
|
||||
for (int i = kMazeFlagLow; i <= kMazeFlagHigh; i++)
|
||||
if (_mappedRooms.getFlag(i))
|
||||
addFlagToMask(i);
|
||||
|
||||
gfx->setCurSurface(gfx->getWorkArea());
|
||||
show();
|
||||
}
|
||||
}
|
||||
|
||||
void MapImage::unloadImage() {
|
||||
_mapImage.deallocateSurface();
|
||||
_mapMask.deallocateSurface();
|
||||
hide();
|
||||
_whichArea = kMapNoArea;
|
||||
}
|
||||
|
||||
void MapImage::moveToMapLocation(const NeighborhoodID, const RoomID room, const DirectionConstant dir) {
|
||||
GraphicsManager *gfx = g_vm->_gfx;
|
||||
|
||||
int flag = ROOM_TO_FLAG(room, dir);
|
||||
|
||||
if (!_mappedRooms.getFlag(flag)) {
|
||||
_mappedRooms.setFlag(flag, true);
|
||||
|
||||
if (_mapMask.isSurfaceValid()) {
|
||||
gfx->setCurSurface(_mapMask.getSurface());
|
||||
addFlagToMask(flag);
|
||||
gfx->setCurSurface(gfx->getWorkArea());
|
||||
}
|
||||
}
|
||||
|
||||
if (isDisplaying())
|
||||
triggerRedraw();
|
||||
}
|
||||
|
||||
void MapImage::addFlagToMask(const int flag) {
|
||||
Common::Rect r1;
|
||||
getRevealedRects(flag, r1);
|
||||
g_vm->_gfx->getCurSurface()->fillRect(r1, g_system->getScreenFormat().RGBToColor(0, 0, 0));
|
||||
}
|
||||
|
||||
// This function can even be sensitive to open doors.
|
||||
// clone2727 notices that it's not, though
|
||||
void MapImage::getRevealedRects(const uint32 flag, Common::Rect &r1) {
|
||||
CoordType gridX, gridY;
|
||||
|
||||
switch (_whichArea) {
|
||||
case kMapMaze:
|
||||
gridX = kMazeGridOriginX;
|
||||
gridY = kMazeGridOriginY;
|
||||
break;
|
||||
case kMapGearRoom:
|
||||
gridX = kGearRoomGridOriginX;
|
||||
gridY = kGearRoomGridOriginY;
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
|
||||
int index = FLAG_TO_INDEX(flag);
|
||||
gridX += s_mapCoords[index][0] * kGridWidth;
|
||||
gridY += s_mapCoords[index][1] * kGridHeight;
|
||||
|
||||
r1 = Common::Rect(gridX - 1, gridY - 1, gridX + kGridWidth + 1, gridY + kGridHeight + 1);
|
||||
}
|
||||
|
||||
void MapImage::drawPlayer() {
|
||||
Graphics::Surface *screen = g_vm->_gfx->getCurSurface();
|
||||
|
||||
CoordType gridX, gridY;
|
||||
|
||||
switch (_whichArea) {
|
||||
case kMapMaze:
|
||||
gridX = _bounds.left + kMazeScreenOffsetX + kMazeGridOriginX;
|
||||
gridY = _bounds.top + kMazeScreenOffsetY + kMazeGridOriginY;
|
||||
break;
|
||||
case kMapGearRoom:
|
||||
gridX = _bounds.left + kGearRoomScreenOffsetX + kGearRoomGridOriginX;
|
||||
gridY = _bounds.top + kGearRoomScreenOffsetY + kGearRoomGridOriginY;
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
|
||||
int index = ROOM_TO_INDEX(GameState.getCurrentRoom());
|
||||
gridX += s_mapCoords[index][0] * kGridWidth;
|
||||
gridY += s_mapCoords[index][1] * kGridHeight;
|
||||
|
||||
// This was intended to make little arrows
|
||||
switch (GameState.getCurrentDirection()) {
|
||||
case kNorth:
|
||||
screen->drawLine(gridX + 1, gridY, gridX + 2, gridY, _darkGreen);
|
||||
screen->drawLine(gridX, gridY + 1, gridX + 3, gridY + 1, _darkGreen);
|
||||
screen->drawLine(gridX + 1, gridY + 1, gridX + 2, gridY + 1, _lightGreen);
|
||||
screen->drawLine(gridX, gridY + 2, gridX + 3, gridY + 2, _lightGreen);
|
||||
break;
|
||||
case kSouth:
|
||||
screen->drawLine(gridX + 1, gridY + 3, gridX + 2, gridY + 3, _darkGreen);
|
||||
screen->drawLine(gridX, gridY + 2, gridX + 3, gridY + 2, _darkGreen);
|
||||
screen->drawLine(gridX + 1, gridY + 2, gridX + 2, gridY + 2, _lightGreen);
|
||||
screen->drawLine(gridX, gridY + 1, gridX + 3, gridY + 1, _lightGreen);
|
||||
break;
|
||||
case kEast:
|
||||
screen->drawLine(gridX + 3, gridY + 1, gridX + 3, gridY + 2, _darkGreen);
|
||||
screen->drawLine(gridX + 2, gridY, gridX + 2, gridY + 3, _darkGreen);
|
||||
screen->drawLine(gridX + 2, gridY + 1, gridX + 2, gridY + 2, _lightGreen);
|
||||
screen->drawLine(gridX + 1, gridY, gridX + 1, gridY + 3, _lightGreen);
|
||||
break;
|
||||
case kWest:
|
||||
screen->drawLine(gridX, gridY + 1, gridX, gridY + 2, _darkGreen);
|
||||
screen->drawLine(gridX + 1, gridY, gridX + 1, gridY + 3, _darkGreen);
|
||||
screen->drawLine(gridX + 1, gridY + 1, gridX + 1, gridY + 2, _lightGreen);
|
||||
screen->drawLine(gridX + 2, gridY, gridX + 2, gridY + 3, _lightGreen);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void MapImage::draw(const Common::Rect &) {
|
||||
Common::Rect r1;
|
||||
_mapImage.getSurfaceBounds(r1);
|
||||
|
||||
Common::Rect r2 = r1;
|
||||
switch (_whichArea) {
|
||||
case kMapMaze:
|
||||
r2.moveTo(_bounds.left + kMazeScreenOffsetX, _bounds.top + kMazeScreenOffsetY);
|
||||
break;
|
||||
case kMapGearRoom:
|
||||
r2.moveTo(_bounds.left + kGearRoomScreenOffsetX, _bounds.top + kGearRoomScreenOffsetY);
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
|
||||
_mapImage.copyToCurrentPortMasked(r1, r2, &_mapMask);
|
||||
|
||||
drawPlayer();
|
||||
}
|
||||
|
||||
} // End of namespace Pegasus
|
||||
83
engines/pegasus/items/biochips/mapimage.h
Normal file
83
engines/pegasus/items/biochips/mapimage.h
Normal file
@@ -0,0 +1,83 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* Additional copyright for this file:
|
||||
* Copyright (C) 1995-1997 Presto Studios, Inc.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef PEGASUS_ITEMS_BIOCHIPS_MAPIMAGE_H
|
||||
#define PEGASUS_ITEMS_BIOCHIPS_MAPIMAGE_H
|
||||
|
||||
#include "pegasus/elements.h"
|
||||
#include "pegasus/surface.h"
|
||||
#include "pegasus/util.h"
|
||||
#include "pegasus/neighborhood/mars/constants.h"
|
||||
|
||||
namespace Common {
|
||||
class ReadStream;
|
||||
class WriteStream;
|
||||
}
|
||||
|
||||
namespace Pegasus {
|
||||
|
||||
class MapImage : public DisplayElement {
|
||||
public:
|
||||
MapImage();
|
||||
~MapImage() override {}
|
||||
|
||||
void writeToStream(Common::WriteStream *);
|
||||
void readFromStream(Common::ReadStream *);
|
||||
|
||||
void loadGearRoomIfNecessary();
|
||||
void loadMazeIfNecessary();
|
||||
void unloadImage();
|
||||
void moveToMapLocation(const NeighborhoodID, const RoomID, const DirectionConstant);
|
||||
|
||||
void draw(const Common::Rect &) override;
|
||||
|
||||
bool anyFlagSet() { return _mappedRooms.anyFlagSet(); }
|
||||
|
||||
static const uint32 kNumMappingRooms = (kMars39 - kMars35 + 1) + (kMars60 - kMars60 + 1) +
|
||||
(kMarsMaze200 - kMarsMaze004 + 1);
|
||||
static const uint32 kNumMappingFlags = kNumMappingRooms * 4;
|
||||
|
||||
protected:
|
||||
enum MapArea {
|
||||
kMapNoArea,
|
||||
kMapMaze,
|
||||
kMapGearRoom
|
||||
};
|
||||
|
||||
void addFlagToMask(const int flag);
|
||||
void getRevealedRects(const uint32, Common::Rect &);
|
||||
void drawPlayer();
|
||||
|
||||
MapArea _whichArea;
|
||||
|
||||
FlagsArray<byte, kNumMappingFlags> _mappedRooms;
|
||||
|
||||
uint32 _darkGreen, _lightGreen;
|
||||
|
||||
Surface _mapImage, _mapMask;
|
||||
};
|
||||
|
||||
} // End of namespace Pegasus
|
||||
|
||||
#endif
|
||||
200
engines/pegasus/items/biochips/opticalchip.cpp
Normal file
200
engines/pegasus/items/biochips/opticalchip.cpp
Normal file
@@ -0,0 +1,200 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* Additional copyright for this file:
|
||||
* Copyright (C) 1995-1997 Presto Studios, Inc.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "pegasus/pegasus.h"
|
||||
#include "pegasus/ai/ai_area.h"
|
||||
#include "pegasus/items/biochips/opticalchip.h"
|
||||
|
||||
namespace Pegasus {
|
||||
|
||||
OpticalChip *g_opticalChip = nullptr;
|
||||
|
||||
OpticalChip::OpticalChip(const ItemID id, const NeighborhoodID neighborhood, const RoomID room, const DirectionConstant direction) :
|
||||
BiochipItem(id, neighborhood, room, direction), _ariesHotspot(kAriesSpotID), _mercuryHotspot(kMercurySpotID),
|
||||
_poseidonHotspot(kPoseidonSpotID) {
|
||||
_ariesHotspot.setArea(Common::Rect(kAIMiddleAreaLeft + 60, kAIMiddleAreaTop + 27, kAIMiddleAreaLeft + 60 + 121, kAIMiddleAreaTop + 27 + 20));
|
||||
_ariesHotspot.setHotspotFlags(kOpticalBiochipSpotFlag);
|
||||
g_allHotspots.push_back(&_ariesHotspot);
|
||||
|
||||
_mercuryHotspot.setArea(Common::Rect(kAIMiddleAreaLeft + 60, kAIMiddleAreaTop + 47, kAIMiddleAreaLeft + 60 + 121, kAIMiddleAreaTop + 47 + 20));
|
||||
_mercuryHotspot.setHotspotFlags(kOpticalBiochipSpotFlag);
|
||||
g_allHotspots.push_back(&_mercuryHotspot);
|
||||
|
||||
_poseidonHotspot.setArea(Common::Rect(kAIMiddleAreaLeft + 60, kAIMiddleAreaTop + 67, kAIMiddleAreaLeft + 60 + 121, kAIMiddleAreaTop + 67 + 20));
|
||||
_poseidonHotspot.setHotspotFlags(kOpticalBiochipSpotFlag);
|
||||
g_allHotspots.push_back(&_poseidonHotspot);
|
||||
|
||||
setItemState(kOptical000);
|
||||
|
||||
g_opticalChip = this;
|
||||
}
|
||||
|
||||
OpticalChip::~OpticalChip() {
|
||||
g_allHotspots.removeOneHotspot(kAriesSpotID);
|
||||
g_allHotspots.removeOneHotspot(kMercurySpotID);
|
||||
g_allHotspots.removeOneHotspot(kPoseidonSpotID);
|
||||
}
|
||||
|
||||
void OpticalChip::writeToStream(Common::WriteStream *stream) {
|
||||
BiochipItem::writeToStream(stream);
|
||||
_opticalFlags.writeToStream(stream);
|
||||
}
|
||||
|
||||
void OpticalChip::readFromStream(Common::ReadStream *stream) {
|
||||
BiochipItem::readFromStream(stream);
|
||||
_opticalFlags.readFromStream(stream);
|
||||
}
|
||||
|
||||
void OpticalChip::addAries() {
|
||||
_opticalFlags.setFlag(kOpticalAriesExposed, true);
|
||||
setUpOpticalChip();
|
||||
}
|
||||
|
||||
void OpticalChip::addMercury() {
|
||||
_opticalFlags.setFlag(kOpticalMercuryExposed, true);
|
||||
setUpOpticalChip();
|
||||
}
|
||||
|
||||
void OpticalChip::addPoseidon() {
|
||||
_opticalFlags.setFlag(kOpticalPoseidonExposed, true);
|
||||
setUpOpticalChip();
|
||||
}
|
||||
|
||||
void OpticalChip::setUpOpticalChip() {
|
||||
if (_opticalFlags.getFlag(kOpticalAriesExposed)) {
|
||||
if (_opticalFlags.getFlag(kOpticalMercuryExposed)) {
|
||||
if (_opticalFlags.getFlag(kOpticalPoseidonExposed))
|
||||
setItemState(kOptical111);
|
||||
else
|
||||
setItemState(kOptical011);
|
||||
} else {
|
||||
if (_opticalFlags.getFlag(kOpticalPoseidonExposed))
|
||||
setItemState(kOptical101);
|
||||
else
|
||||
setItemState(kOptical001);
|
||||
}
|
||||
} else {
|
||||
if (_opticalFlags.getFlag(kOpticalMercuryExposed)) {
|
||||
if (_opticalFlags.getFlag(kOpticalPoseidonExposed))
|
||||
setItemState(kOptical110);
|
||||
else
|
||||
setItemState(kOptical010);
|
||||
} else {
|
||||
if (_opticalFlags.getFlag(kOpticalPoseidonExposed))
|
||||
setItemState(kOptical100);
|
||||
else
|
||||
setItemState(kOptical000);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void OpticalChip::activateOpticalHotspots() {
|
||||
if (_opticalFlags.getFlag(kOpticalAriesExposed))
|
||||
_ariesHotspot.setActive();
|
||||
if (_opticalFlags.getFlag(kOpticalMercuryExposed))
|
||||
_mercuryHotspot.setActive();
|
||||
if (_opticalFlags.getFlag(kOpticalPoseidonExposed))
|
||||
_poseidonHotspot.setActive();
|
||||
}
|
||||
|
||||
void OpticalChip::clickInOpticalHotspot(HotSpotID id) {
|
||||
playOpMemMovie(id);
|
||||
}
|
||||
|
||||
void OpticalChip::playOpMemMovie(HotSpotID id) {
|
||||
Common::Path movieName;
|
||||
switch (id) {
|
||||
case kAriesSpotID:
|
||||
// WORKAROUND: The original CD release played the ares video even
|
||||
// when you destroyed the shuttle. For the DVD release, we have
|
||||
// some new videos that can be played instead to workaround a plot
|
||||
// loophole.
|
||||
if (!g_vm->isDVD() || _opticalFlags.getFlag(kOpticalAriesExposed))
|
||||
movieName = "Images/AI/Globals/OMAI";
|
||||
else if (_itemOwnerID == kPlayerID)
|
||||
movieName = "Images/AI/Globals/OMN1";
|
||||
else
|
||||
movieName = "Images/AI/Globals/OMN0";
|
||||
break;
|
||||
case kMercurySpotID:
|
||||
movieName = "Images/AI/Globals/OMMI";
|
||||
break;
|
||||
case kPoseidonSpotID:
|
||||
movieName = "Images/AI/Globals/OMPI";
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
ItemState state = getItemState(), newState;
|
||||
switch (state) {
|
||||
case kOptical001:
|
||||
newState = kOptical002;
|
||||
break;
|
||||
case kOptical010:
|
||||
newState = kOptical020;
|
||||
break;
|
||||
case kOptical011:
|
||||
if (id == kAriesSpotID)
|
||||
newState = kOptical012;
|
||||
else
|
||||
newState = kOptical021;
|
||||
break;
|
||||
case kOptical100:
|
||||
newState = kOptical200;
|
||||
break;
|
||||
case kOptical101:
|
||||
if (id == kAriesSpotID)
|
||||
newState = kOptical102;
|
||||
else
|
||||
newState = kOptical201;
|
||||
break;
|
||||
case kOptical110:
|
||||
if (id == kMercurySpotID)
|
||||
newState = kOptical120;
|
||||
else
|
||||
newState = kOptical210;
|
||||
break;
|
||||
case kOptical111:
|
||||
if (id == kAriesSpotID)
|
||||
newState = kOptical112;
|
||||
else if (id == kMercurySpotID)
|
||||
newState = kOptical121;
|
||||
else
|
||||
newState = kOptical211;
|
||||
break;
|
||||
case kOptical000: // Can never happen.
|
||||
default:
|
||||
error("Invalid optical chip state");
|
||||
}
|
||||
|
||||
setItemState(newState);
|
||||
|
||||
if (g_AIArea)
|
||||
g_AIArea->playAIMovie(kRightAreaSignature, movieName, false, kOpticalInterruption);
|
||||
|
||||
setItemState(state);
|
||||
}
|
||||
|
||||
} // End of namespace Pegasus
|
||||
70
engines/pegasus/items/biochips/opticalchip.h
Normal file
70
engines/pegasus/items/biochips/opticalchip.h
Normal file
@@ -0,0 +1,70 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* Additional copyright for this file:
|
||||
* Copyright (C) 1995-1997 Presto Studios, Inc.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef PEGASUS_ITEMS_BIOCHIPS_OPTICALCHIP_H
|
||||
#define PEGASUS_ITEMS_BIOCHIPS_OPTICALCHIP_H
|
||||
|
||||
#include "pegasus/hotspot.h"
|
||||
#include "pegasus/util.h"
|
||||
#include "pegasus/items/biochips/biochipitem.h"
|
||||
|
||||
namespace Pegasus {
|
||||
|
||||
class OpticalChip : public BiochipItem {
|
||||
public:
|
||||
OpticalChip(const ItemID, const NeighborhoodID, const RoomID, const DirectionConstant);
|
||||
~OpticalChip() override;
|
||||
|
||||
void writeToStream(Common::WriteStream *) override;
|
||||
void readFromStream(Common::ReadStream *) override;
|
||||
|
||||
void addAries();
|
||||
void addMercury();
|
||||
void addPoseidon();
|
||||
|
||||
void activateOpticalHotspots();
|
||||
void clickInOpticalHotspot(HotSpotID);
|
||||
void playOpMemMovie(HotSpotID);
|
||||
|
||||
protected:
|
||||
enum {
|
||||
kOpticalAriesExposed,
|
||||
kOpticalMercuryExposed,
|
||||
kOpticalPoseidonExposed,
|
||||
kNumOpticalChipFlags
|
||||
};
|
||||
|
||||
void setUpOpticalChip();
|
||||
|
||||
FlagsArray<byte, kNumOpticalChipFlags> _opticalFlags;
|
||||
Hotspot _ariesHotspot;
|
||||
Hotspot _mercuryHotspot;
|
||||
Hotspot _poseidonHotspot;
|
||||
};
|
||||
|
||||
extern OpticalChip *g_opticalChip;
|
||||
|
||||
} // End of namespace Pegasus
|
||||
|
||||
#endif
|
||||
206
engines/pegasus/items/biochips/pegasuschip.cpp
Normal file
206
engines/pegasus/items/biochips/pegasuschip.cpp
Normal file
@@ -0,0 +1,206 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* Additional copyright for this file:
|
||||
* Copyright (C) 1995-1997 Presto Studios, Inc.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "pegasus/energymonitor.h"
|
||||
#include "pegasus/gamestate.h"
|
||||
#include "pegasus/pegasus.h"
|
||||
#include "pegasus/items/biochips/pegasuschip.h"
|
||||
#include "pegasus/neighborhood/tsa/fulltsa.h"
|
||||
#include "pegasus/neighborhood/tsa/tinytsa.h"
|
||||
|
||||
namespace Pegasus {
|
||||
|
||||
PegasusChip::PegasusChip(const ItemID id, const NeighborhoodID neighborhood, const RoomID room, const DirectionConstant direction) :
|
||||
BiochipItem(id, neighborhood, room, direction), _recallSpot(kPegasusRecallSpotID) {
|
||||
_recallSpot.setArea(Common::Rect(kAIMiddleAreaLeft + 116, kAIMiddleAreaTop + 63, kAIMiddleAreaLeft + 184, kAIMiddleAreaTop + 91));
|
||||
_recallSpot.setHotspotFlags(kPegasusBiochipSpotFlag);
|
||||
g_allHotspots.push_back(&_recallSpot);
|
||||
setItemState(kPegasusTSA00);
|
||||
}
|
||||
|
||||
PegasusChip::~PegasusChip() {
|
||||
g_allHotspots.removeOneHotspot(kPegasusRecallSpotID);
|
||||
}
|
||||
|
||||
void PegasusChip::select() {
|
||||
BiochipItem::select();
|
||||
setUpPegasusChip();
|
||||
}
|
||||
|
||||
void PegasusChip::takeSharedArea() {
|
||||
BiochipItem::takeSharedArea();
|
||||
setUpPegasusChip();
|
||||
}
|
||||
|
||||
void PegasusChip::setUpPegasusChip() {
|
||||
switch (GameState.getCurrentNeighborhood()) {
|
||||
case kCaldoriaID:
|
||||
setItemState(kPegasusCaldoria);
|
||||
break;
|
||||
case kFullTSAID:
|
||||
case kFinalTSAID:
|
||||
case kTinyTSAID:
|
||||
setItemState(kPegasusTSA10);
|
||||
break;
|
||||
case kPrehistoricID:
|
||||
if (g_vm->playerHasItemID(kHistoricalLog))
|
||||
setItemState(kPegasusPrehistoric00);
|
||||
else
|
||||
setItemState(kPegasusPrehistoric10);
|
||||
break;
|
||||
case kMarsID:
|
||||
if (GameState.getMarsFinished())
|
||||
setItemState(kPegasusMars00);
|
||||
else
|
||||
setItemState(kPegasusMars10);
|
||||
break;
|
||||
case kWSCID:
|
||||
if (GameState.getWSCFinished())
|
||||
setItemState(kPegasusWSC00);
|
||||
else
|
||||
setItemState(kPegasusWSC10);
|
||||
break;
|
||||
case kNoradAlphaID:
|
||||
case kNoradDeltaID:
|
||||
if (GameState.getNoradFinished())
|
||||
setItemState(kPegasusNorad00);
|
||||
else
|
||||
setItemState(kPegasusNorad10);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Only does something if the chip should be announcing that the time zone is finished...
|
||||
void PegasusChip::setUpPegasusChipRude() {
|
||||
switch (GameState.getCurrentNeighborhood()) {
|
||||
case kPrehistoricID:
|
||||
if (g_vm->playerHasItemID(kHistoricalLog))
|
||||
setItemState(kPegasusPrehistoric00);
|
||||
break;
|
||||
case kMarsID:
|
||||
if (GameState.getMarsFinished())
|
||||
setItemState(kPegasusMars00);
|
||||
break;
|
||||
case kWSCID:
|
||||
if (GameState.getWSCFinished())
|
||||
setItemState(kPegasusWSC00);
|
||||
break;
|
||||
case kNoradAlphaID:
|
||||
case kNoradDeltaID:
|
||||
if (GameState.getNoradFinished())
|
||||
setItemState(kPegasusNorad00);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void PegasusChip::activatePegasusHotspots() {
|
||||
switch (GameState.getCurrentNeighborhood()) {
|
||||
case kPrehistoricID:
|
||||
// WORKAROUND: Don't allow the player to recall if they don't have
|
||||
// the historical log. Otherwise, gameplay is broken when returning
|
||||
// to the TSA.
|
||||
if (!g_vm->playerHasItemID(kHistoricalLog))
|
||||
return;
|
||||
// fall through
|
||||
case kMarsID:
|
||||
case kWSCID:
|
||||
case kNoradAlphaID:
|
||||
case kNoradDeltaID:
|
||||
_recallSpot.setActive();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void PegasusChip::clickInPegasusHotspot() {
|
||||
ItemState thisState = getItemState();
|
||||
ItemState hiliteState;
|
||||
|
||||
switch (thisState) {
|
||||
case kPegasusPrehistoric00:
|
||||
hiliteState = kPegasusPrehistoric01;
|
||||
break;
|
||||
case kPegasusPrehistoric10:
|
||||
hiliteState = kPegasusPrehistoric11;
|
||||
break;
|
||||
case kPegasusMars00:
|
||||
hiliteState = kPegasusMars01;
|
||||
break;
|
||||
case kPegasusMars10:
|
||||
hiliteState = kPegasusMars11;
|
||||
break;
|
||||
case kPegasusNorad00:
|
||||
hiliteState = kPegasusNorad01;
|
||||
break;
|
||||
case kPegasusNorad10:
|
||||
hiliteState = kPegasusNorad11;
|
||||
break;
|
||||
case kPegasusWSC00:
|
||||
hiliteState = kPegasusWSC01;
|
||||
break;
|
||||
case kPegasusWSC10:
|
||||
hiliteState = kPegasusWSC11;
|
||||
break;
|
||||
default:
|
||||
error("Invalid pegasus chip state");
|
||||
}
|
||||
|
||||
// WORKAROUND: The original called setItemState() here. However,
|
||||
// since we're overriding select() to call setUpPegasusChip(),
|
||||
// the highlighted frame is never displayed! So, we're manually
|
||||
// setting the state and selecting the item. Also of note is that
|
||||
// setItemState() for this class is effectively useless since it
|
||||
// always gets overriden in the select() function. The only reason
|
||||
// that this doesn't end in infinite recursion is because setItemState()
|
||||
// has a check against the current state to make sure you don't call
|
||||
// select() again. </rant>
|
||||
_itemState = hiliteState;
|
||||
BiochipItem::select();
|
||||
|
||||
uint32 time = g_system->getMillis();
|
||||
while (g_system->getMillis() < time + 500) {
|
||||
g_vm->refreshDisplay();
|
||||
g_system->delayMillis(10);
|
||||
}
|
||||
|
||||
setItemState(thisState);
|
||||
|
||||
if (!((Neighborhood *)g_neighborhood)->okayToJump())
|
||||
return;
|
||||
|
||||
if (g_energyMonitor)
|
||||
g_energyMonitor->stopEnergyDraining();
|
||||
|
||||
if (GameState.getTSAState() == kPlayerWentToPrehistoric || GameState.allTimeZonesFinished())
|
||||
g_vm->jumpToNewEnvironment(kFullTSAID, kTSA37, kNorth);
|
||||
else
|
||||
g_vm->jumpToNewEnvironment(kTinyTSAID, kTinyTSA37, kNorth);
|
||||
}
|
||||
|
||||
} // End of namespace Pegasus
|
||||
56
engines/pegasus/items/biochips/pegasuschip.h
Normal file
56
engines/pegasus/items/biochips/pegasuschip.h
Normal file
@@ -0,0 +1,56 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* Additional copyright for this file:
|
||||
* Copyright (C) 1995-1997 Presto Studios, Inc.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef PEGASUS_ITEMS_BIOCHIPS_PEGASUSCHIP_H
|
||||
#define PEGASUS_ITEMS_BIOCHIPS_PEGASUSCHIP_H
|
||||
|
||||
#include "pegasus/hotspot.h"
|
||||
#include "pegasus/items/biochips/biochipitem.h"
|
||||
|
||||
namespace Pegasus {
|
||||
|
||||
class PegasusChip : public BiochipItem {
|
||||
public:
|
||||
PegasusChip(const ItemID, const NeighborhoodID, const RoomID, const DirectionConstant);
|
||||
~PegasusChip() override;
|
||||
|
||||
void select() override;
|
||||
|
||||
void takeSharedArea() override;
|
||||
|
||||
void setUpPegasusChip();
|
||||
|
||||
// Called to set up the Pegasus chip when the Pegasus chip is the current chip but does not
|
||||
// own the center area.
|
||||
void setUpPegasusChipRude();
|
||||
void activatePegasusHotspots();
|
||||
void clickInPegasusHotspot();
|
||||
|
||||
protected:
|
||||
Hotspot _recallSpot;
|
||||
};
|
||||
|
||||
} // End of namespace Pegasus
|
||||
|
||||
#endif
|
||||
48
engines/pegasus/items/biochips/retscanchip.cpp
Normal file
48
engines/pegasus/items/biochips/retscanchip.cpp
Normal file
@@ -0,0 +1,48 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* Additional copyright for this file:
|
||||
* Copyright (C) 1995-1997 Presto Studios, Inc.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "pegasus/ai/ai_area.h"
|
||||
#include "pegasus/items/biochips/retscanchip.h"
|
||||
|
||||
namespace Pegasus {
|
||||
|
||||
RetScanChip::RetScanChip(const ItemID id, const NeighborhoodID neighborhood, const RoomID room, const DirectionConstant direction) :
|
||||
BiochipItem(id, neighborhood, room, direction) {
|
||||
}
|
||||
|
||||
void RetScanChip::searchForLaser() {
|
||||
ItemExtraEntry entry;
|
||||
findItemExtra(kRetinalScanSearching, entry);
|
||||
|
||||
if (g_AIArea)
|
||||
g_AIArea->playAIAreaSequence(kBiochipSignature, kMiddleAreaSignature, entry.extraStart, entry.extraStop);
|
||||
|
||||
findItemExtra(kRetinalScanActivated, entry);
|
||||
if (g_AIArea)
|
||||
g_AIArea->playAIAreaSequence(kBiochipSignature, kRightAreaSignature, entry.extraStart, entry.extraStop);
|
||||
|
||||
setItemState(kRetinalSimulating);
|
||||
}
|
||||
|
||||
} // End of namespace Pegasus
|
||||
42
engines/pegasus/items/biochips/retscanchip.h
Normal file
42
engines/pegasus/items/biochips/retscanchip.h
Normal file
@@ -0,0 +1,42 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* Additional copyright for this file:
|
||||
* Copyright (C) 1995-1997 Presto Studios, Inc.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef PEGASUS_ITEMS_BIOCHIPS_RETSCANCHIP_H
|
||||
#define PEGASUS_ITEMS_BIOCHIPS_RETSCANCHIP_H
|
||||
|
||||
#include "pegasus/items/biochips/biochipitem.h"
|
||||
|
||||
namespace Pegasus {
|
||||
|
||||
class RetScanChip : public BiochipItem {
|
||||
public:
|
||||
RetScanChip(const ItemID, const NeighborhoodID, const RoomID, const DirectionConstant);
|
||||
~RetScanChip() override {}
|
||||
|
||||
void searchForLaser();
|
||||
};
|
||||
|
||||
} // End of namespace Pegasus
|
||||
|
||||
#endif
|
||||
52
engines/pegasus/items/biochips/shieldchip.cpp
Normal file
52
engines/pegasus/items/biochips/shieldchip.cpp
Normal file
@@ -0,0 +1,52 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* Additional copyright for this file:
|
||||
* Copyright (C) 1995-1997 Presto Studios, Inc.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "pegasus/gamestate.h"
|
||||
#include "pegasus/items/biochips/shieldchip.h"
|
||||
#include "pegasus/neighborhood/neighborhood.h"
|
||||
|
||||
namespace Pegasus {
|
||||
|
||||
ShieldChip *g_shield = nullptr;
|
||||
|
||||
ShieldChip::ShieldChip(const ItemID id, const NeighborhoodID neighborhood, const RoomID room, const DirectionConstant direction) :
|
||||
BiochipItem(id, neighborhood, room, direction) {
|
||||
g_shield = this;
|
||||
}
|
||||
|
||||
void ShieldChip::select() {
|
||||
BiochipItem::select();
|
||||
GameState.setShieldOn(true);
|
||||
if (g_neighborhood)
|
||||
g_neighborhood->shieldOn();
|
||||
}
|
||||
|
||||
void ShieldChip::deselect() {
|
||||
BiochipItem::deselect();
|
||||
GameState.setShieldOn(false);
|
||||
if (g_neighborhood)
|
||||
g_neighborhood->shieldOff();
|
||||
}
|
||||
|
||||
} // End of namespace Pegasus
|
||||
45
engines/pegasus/items/biochips/shieldchip.h
Normal file
45
engines/pegasus/items/biochips/shieldchip.h
Normal file
@@ -0,0 +1,45 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* Additional copyright for this file:
|
||||
* Copyright (C) 1995-1997 Presto Studios, Inc.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef PEGASUS_ITEMS_BIOCHIPS_SHIELDCHIP_H
|
||||
#define PEGASUS_ITEMS_BIOCHIPS_SHIELDCHIP_H
|
||||
|
||||
#include "pegasus/items/biochips/biochipitem.h"
|
||||
|
||||
namespace Pegasus {
|
||||
|
||||
class ShieldChip : public BiochipItem {
|
||||
public:
|
||||
ShieldChip(const ItemID, const NeighborhoodID, const RoomID, const DirectionConstant);
|
||||
~ShieldChip() override {}
|
||||
|
||||
void select() override;
|
||||
void deselect() override;
|
||||
};
|
||||
|
||||
extern ShieldChip *g_shield;
|
||||
|
||||
} // End of namespace Pegasus
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user