aboutsummaryrefslogtreecommitdiff
path: root/queen
diff options
context:
space:
mode:
authorDavid Eriksson2003-10-16 19:40:29 +0000
committerDavid Eriksson2003-10-16 19:40:29 +0000
commit7f6c294a1e74c34717b2153a436ffe19781b8fad (patch)
treeb00363995e90de0eee20084869b0ca43d19bd78a /queen
parent5e36a5cac8571bc2e1c790df3bd0d190141946e9 (diff)
downloadscummvm-rg350-7f6c294a1e74c34717b2153a436ffe19781b8fad.tar.gz
scummvm-rg350-7f6c294a1e74c34717b2153a436ffe19781b8fad.tar.bz2
scummvm-rg350-7f6c294a1e74c34717b2153a436ffe19781b8fad.zip
Play all intro cutaways (some better than others... :-)
svn-id: r10833
Diffstat (limited to 'queen')
-rw-r--r--queen/cutaway.cpp17
-rw-r--r--queen/display.cpp14
-rw-r--r--queen/logic.h6
-rw-r--r--queen/queen.cpp90
-rw-r--r--queen/queen.h3
-rw-r--r--queen/resource.cpp2
-rw-r--r--queen/structs.h10
-rw-r--r--queen/xref.txt2
8 files changed, 127 insertions, 17 deletions
diff --git a/queen/cutaway.cpp b/queen/cutaway.cpp
index f9be1a57f3..60503b331c 100644
--- a/queen/cutaway.cpp
+++ b/queen/cutaway.cpp
@@ -187,7 +187,7 @@ void Cutaway::loadStrings(byte *ptr) {
ptr = Talk::getString(ptr, _bankNames[j], MAX_FILENAME_LENGTH);
if (_bankNames[j][0]) {
- debug(0, "Bank name %i = '%s'", _bankNames[j]);
+ debug(0, "Bank name %i = '%s'", j, _bankNames[j]);
j++;
}
}
@@ -244,10 +244,15 @@ void Cutaway::dumpCutawayObject(int index, CutawayObject &object)
const char *objectNumberStr;
switch (object.objectNumber) {
- case -1: objectNumberStr = "MESSAGE"; break;
- case 0: objectNumberStr = "Joe"; break;
- default:
- objectNumberStr = _logic->objectName(_logic->objectData(object.objectNumber)->name);
+ case -1:
+ objectNumberStr = "MESSAGE"; break;
+ case 0:
+ objectNumberStr = "Joe"; break;
+ default:
+ if (object.objectNumber > 0)
+ objectNumberStr = _logic->objectName(abs(_logic->objectData(object.objectNumber)->name));
+ else
+ objectNumberStr = "Unknown!";
break;
}
@@ -762,7 +767,7 @@ void Cutaway::run(char *nextFilename) {
break;
default:
- error("Unhandled object type: %i", objectType);
+ warning("Unhandled object type: %i", objectType);
break;
}
diff --git a/queen/display.cpp b/queen/display.cpp
index ee0b37cc14..9e2e85f7e8 100644
--- a/queen/display.cpp
+++ b/queen/display.cpp
@@ -145,11 +145,15 @@ void Display::dynalumInit(Resource *resource, const char *roomName, uint16 roomN
// FIXME: are these tests really needed ?
if (roomNum < 90 || ((roomNum > 94) && (roomNum < 114))) {
char filename[20];
- sprintf(filename, "%s.msk", roomName);
- resource->loadFile(filename, 0, (uint8*)_dynalum.msk);
- sprintf(filename, "%s.lum", roomName);
- resource->loadFile(filename, 0, (uint8*)_dynalum.lum);
- }
+
+ sprintf(filename, "%s.msk", roomName);
+ if (resource->exists(filename))
+ resource->loadFile(filename, 0, (uint8*)_dynalum.msk);
+
+ sprintf(filename, "%s.lum", roomName);
+ if (resource->exists(filename))
+ resource->loadFile(filename, 0, (uint8*)_dynalum.lum);
+ }
}
diff --git a/queen/logic.h b/queen/logic.h
index d1f28a328c..d3960f53b3 100644
--- a/queen/logic.h
+++ b/queen/logic.h
@@ -57,7 +57,13 @@ public:
uint16 currentRoom();
void currentRoom(uint16 room);
+
+ uint16 oldRoom() { return _oldRoom; }
void oldRoom(uint16 room);
+
+ uint16 newRoom() { return _newRoom; }
+ void newRoom(uint16 room) { _newRoom = room; }
+
ObjectData* objectData(int index);
uint16 roomData(int room);
uint16 objMax(int room);
diff --git a/queen/queen.cpp b/queen/queen.cpp
index a4e91c9c0e..ac9a643be4 100644
--- a/queen/queen.cpp
+++ b/queen/queen.cpp
@@ -21,6 +21,10 @@
#include "stdafx.h"
#include "queen/queen.h"
+#include "queen/cutaway.h"
+#include "queen/talk.h"
+#include "queen/walk.h"
+#include "queen/graphics.h"
#include "common/config-manager.h"
#include "common/file.h"
#include "base/gameDetector.h"
@@ -85,13 +89,97 @@ void QueenEngine::errorString(const char *buf1, char *buf2) {
strcpy(buf2, buf1);
}
+void QueenEngine::roomChanged() {
+ // queen.c function SETUP_ROOM, lines 398-428
+
+ // This function uses lots of variables in logic, but we can't move it to
+ // logic because that would cause a circular dependency between Cutaway and
+ // Logic... :-(
+
+ if (_logic->currentRoom() == 7) {
+ warning("Room 7 not yet handled!");
+ // XXX R_MAP();
+ // XXX fadeout(0,223);
+ }
+ else if (_logic->currentRoom() == 95 && _logic->gameState(117) == 0) {
+ char nextFilename[20];
+
+ _logic->roomDisplay(_logic->roomName(_logic->currentRoom()), RDM_FADE_NOJOE, 100, 2, true);
+
+ if (_resource->isDemo()) {
+ if (_resource->exists("pclogo.cut"))
+ Cutaway::run("pclogo.cut", nextFilename, _graphics, _logic, _resource);
+ else
+ Cutaway::run("clogo.cut", nextFilename, _graphics, _logic, _resource);
+ }
+ else {
+ Cutaway::run("copy.cut", nextFilename, _graphics, _logic, _resource);
+ Cutaway::run("clogo.cut", nextFilename, _graphics, _logic, _resource);
+
+ // TODO enable talking for talkie version
+
+ Cutaway::run("cdint.cut", nextFilename, _graphics, _logic, _resource);
+
+ // XXX _graphics->panelLoad();
+
+ Cutaway::run("cred.cut", nextFilename, _graphics, _logic, _resource);
+ }
+
+ _logic->currentRoom(73);
+ // XXX _entryObj = 584;
+
+ Cutaway::run("c70d.cut", nextFilename, _graphics, _logic, _resource);
+
+ _logic->gameState(117) == 1;
+
+ // XXX setupItems();
+ // XXX inventory();
+ }
+ else {
+ _logic->roomDisplay(_logic->roomName(_logic->currentRoom()), RDM_FADE_JOE, 100, 1, false);
+ }
+ // XXX _drawMouseFlag = 1;
+}
+
+
void QueenEngine::go() {
if (!_dump_file)
_dump_file = stdout;
initialise();
-
+
+ _logic->oldRoom(0);
+ _logic->newRoom(_logic->currentRoom());
+
+ for (;;) {
+ // queen.c lines 4080-4104
+ if (_logic->newRoom() > 0) {
+ _graphics->textClear(151, 151);
+ _graphics->update();
+ _logic->oldRoom(_logic->currentRoom());
+ _logic->currentRoom(_logic->newRoom());
+ roomChanged();
+ // XXX _logic->fullScreen(false);
+ if (_logic->currentRoom() == _logic->newRoom())
+ _logic->newRoom(0);
+ }
+ else {
+ if (_logic->joeWalk() == 2) {
+ _logic->joeWalk(0);
+ // XXX executeAction(yes);
+ }
+ else {
+ // XXX if (_parse == 1)
+ // XXX clearCommand(1);
+ _logic->joeWalk(0);
+ // XXX checkPlayer();
+ }
+ }
+
+ break; // XXX don't loop yet
+ }
+
while (1) { //main loop
delay(1000);
}
diff --git a/queen/queen.h b/queen/queen.h
index dee60b953b..68e97ece72 100644
--- a/queen/queen.h
+++ b/queen/queen.h
@@ -68,6 +68,9 @@ protected:
void delay(uint amount);
void go();
+ //! Called when we go from one room to another
+ void roomChanged(); // SETUP_ROOM
+
void initialise();
static int CDECL game_thread_proc(void *param);
diff --git a/queen/resource.cpp b/queen/resource.cpp
index 0ece5e4d38..cff1d9d331 100644
--- a/queen/resource.cpp
+++ b/queen/resource.cpp
@@ -117,7 +117,7 @@ int32 Resource::resourceIndex(const char *filename) {
high = cur;
}
- error("Couldn't find file '%s'", entryName);
+ warning("Couldn't find file '%s'", entryName);
return -1;
}
diff --git a/queen/structs.h b/queen/structs.h
index 90c1a62dfe..1d0234d14f 100644
--- a/queen/structs.h
+++ b/queen/structs.h
@@ -74,10 +74,14 @@ struct Area {
uint16 calcScale(int16 y) const {
uint16 dy = box.y2 - box.y1;
int16 ds = (int16)(topScaleFactor - bottomScaleFactor);
- uint16 scale = ((((y - box.y1) * 100) / dy) * ds) / 100 + bottomScaleFactor;
- if (scale == 0) {
+ uint16 scale = 0;
+
+ if (dy) // Prevent division-by-zero
+ scale = ((((y - box.y1) * 100) / dy) * ds) / 100 + bottomScaleFactor;
+
+ if (scale == 0)
scale = 100;
- }
+
return scale;
}
diff --git a/queen/xref.txt b/queen/xref.txt
index fbc90f41ce..15d520a2de 100644
--- a/queen/xref.txt
+++ b/queen/xref.txt
@@ -167,7 +167,7 @@ SELECT_VERB()
SETUP_BOBS() Graphics::bobSetupControl
SETUP_FURNITURE() Logic::roomSetupFurniture
SETUP_ITEMS()
-SETUP_ROOM()
+SETUP_ROOM() Logic::roomChanged
SETUP_SCRVARS()
update() Graphics::update
USE_UNDERWEAR()