aboutsummaryrefslogtreecommitdiff
path: root/engines/pegasus
diff options
context:
space:
mode:
authorMatthew Hoops2011-09-08 13:12:26 -0400
committerMatthew Hoops2011-09-08 13:12:26 -0400
commit0e14012edd8341842c8f14fbe7eeec266fdb17b5 (patch)
tree403f8278ea8a7eb99c5545d3dcb3246f6e7dbcd2 /engines/pegasus
parent715c95ecfc30f53bdf2f35ab883654ea80ee154b (diff)
downloadscummvm-rg350-0e14012edd8341842c8f14fbe7eeec266fdb17b5.tar.gz
scummvm-rg350-0e14012edd8341842c8f14fbe7eeec266fdb17b5.tar.bz2
scummvm-rg350-0e14012edd8341842c8f14fbe7eeec266fdb17b5.zip
PEGASUS: Begin loading items
Diffstat (limited to 'engines/pegasus')
-rw-r--r--engines/pegasus/pegasus.cpp48
-rw-r--r--engines/pegasus/pegasus.h23
2 files changed, 42 insertions, 29 deletions
diff --git a/engines/pegasus/pegasus.cpp b/engines/pegasus/pegasus.cpp
index 466945e211..d6b3d541fa 100644
--- a/engines/pegasus/pegasus.cpp
+++ b/engines/pegasus/pegasus.cpp
@@ -35,6 +35,8 @@
#include "pegasus/gamestate.h"
#include "pegasus/pegasus.h"
#include "pegasus/timers.h"
+#include "pegasus/items/biochips/biochipitem.h"
+#include "pegasus/items/inventory/inventoryitem.h"
//#define RUN_SUB_MOVIE // :D :D :D :D :D :D
//#define RUN_INTERFACE_TEST
@@ -76,7 +78,7 @@ Common::Error PegasusEngine::run() {
if (!_biochipLid->open("Images/Lids/Biochip Lid Sequence") || !_biochipLid->hasResFork())
error("Could not open Biochip Lid Sequence");
- loadItemLocationData();
+ createItems();
if (!isDemo() && !detectOpeningClosingDirectory()) {
Common::String message = "Missing intro directory. ";
@@ -191,25 +193,51 @@ bool PegasusEngine::detectOpeningClosingDirectory() {
return true;
}
-void PegasusEngine::loadItemLocationData() {
+void PegasusEngine::createItems() {
Common::SeekableReadStream *res = _resFork->getResource(MKTAG('N', 'I', 't', 'm'), 0x80);
uint16 entryCount = res->readUint16BE();
for (uint16 i = 0; i < entryCount; i++) {
- ItemLocationData loc;
- loc.id = res->readUint16BE(); // Which is always == i, anyway
- loc.location = (ItemLocation)res->readUint16BE();
- loc.u0 = res->readUint16BE();
- loc.u1 = res->readByte();
- debug(1, "Item[%d]: ID = %d, location = %x, u0 = %d, u1 = %d", i, loc.id, loc.location, loc.u0, loc.u1);
- res->readByte();
- _itemLocationData.push_back(loc);
+ tItemID itemID = res->readUint16BE();
+ tNeighborhoodID neighborhoodID = res->readUint16BE();
+ tRoomID roomID = res->readUint16BE();
+ tDirectionConstant direction = res->readByte();
+ res->readByte(); // alignment
+
+ createItem(itemID, neighborhoodID, roomID, direction);
}
delete res;
}
+void PegasusEngine::createItem(tItemID itemID, tNeighborhoodID neighborhoodID, tRoomID roomID, tDirectionConstant direction) {
+ switch (itemID) {
+ case kInterfaceBiochip:
+ // Unused in game, but still in the data - no need to load it
+ break;
+ case kMapBiochip:
+ case kAIBiochip:
+ case kPegasusBiochip:
+ case kRetinalScanBiochip:
+ case kShieldBiochip:
+ case kOpticalBiochip:
+ // TODO: Specialized biochip classes
+ new BiochipItem(itemID, neighborhoodID, roomID, direction);
+ break;
+ case kAirMask:
+ case kKeyCard:
+ case kGasCanister:
+ // TODO: Specialized inventory item classes
+ new InventoryItem(itemID, neighborhoodID, roomID, direction);
+ break;
+ default:
+ // Everything else is a normal inventory item
+ new InventoryItem(itemID, neighborhoodID, roomID, direction);
+ break;
+ }
+}
+
void PegasusEngine::runIntro() {
_video->playMovieCentered(_introDirectory + "/BandaiLogo.movie");
VideoHandle handle = _video->playBackgroundMovie(_introDirectory + "/Big Movie.movie");
diff --git a/engines/pegasus/pegasus.h b/engines/pegasus/pegasus.h
index 53593c1c1b..e0135657bd 100644
--- a/engines/pegasus/pegasus.h
+++ b/engines/pegasus/pegasus.h
@@ -49,25 +49,8 @@ class VideoManager;
class GraphicsManager;
class Idler;
-enum ItemLocation {
- kItemLocationCaldoria = 0,
- kItemLocationTSA = 1,
- kItemLocationNorad = 4, // ???
- kItemLocationMars = 5,
- kItemLocationWSC = 6,
- kItemLocationPrehistoric = 7,
- kItemLocationBuiltIn = 0xffff
-};
-
static const int kViewScreenOffset = 64;
-struct ItemLocationData {
- uint16 id;
- ItemLocation location;
- uint16 u0;
- byte u1;
-};
-
struct OverviewHotspot {
Common::Rect rect;
uint32 time;
@@ -128,7 +111,6 @@ private:
// Main Game Functions
void mainGameLoop();
- void loadItemLocationData();
void changeLocation(tNeighborhoodID neighborhood);
// Misc Functions
@@ -138,7 +120,6 @@ private:
// Game Variables
bool _adventureMode;
GameMode _gameMode;
- Common::Array<ItemLocationData> _itemLocationData;
// Console
PegasusConsole *_console;
@@ -150,6 +131,10 @@ private:
// Idlers
Common::List<Idler *> _idlers;
void giveIdleTime();
+
+ // Items
+ void createItems();
+ void createItem(tItemID itemID, tNeighborhoodID neighborhoodID, tRoomID roomID, tDirectionConstant direction);
};
} // End of namespace Pegasus