- moved QueenEngine::roomChanged to Logic and enabled call from Cutaway code (this fixes the 2 irons bars being displayed at the end of c39a.cut)

- moved my 'panel being hidden after the head room display' fix
- fix problem in joeCutFacing / joeFacing in cutaway code

svn-id: r11553
This commit is contained in:
Gregory Montoir 2003-12-10 15:36:44 +00:00
parent d947a6ea77
commit ed2baf283e
7 changed files with 88 additions and 87 deletions

View file

@ -150,6 +150,9 @@ void Cutaway::load(const char *filename) {
_nextSentence = Talk::getString(_nextSentence, entryString, MAX_STRING_LENGTH);
debug(0, "Entry string = '%s'", entryString);
_logic->joeCutFacing(_logic->joeFacing());
_logic->joeFace();
if (entryString[0] == '*' &&
entryString[1] == 'F' &&
entryString[3] == '\0') {
@ -403,6 +406,12 @@ void Cutaway::changeRooms(CutawayObject &object) {
comPanel = 1;
}
// FIXME: in the original engine, panel is hidden after displaying head. We do
// it before.
if(object.room == FAYE_HEAD || object.room == AZURA_HEAD || object.room == FRANK_HEAD) {
comPanel = 2;
}
RoomDisplayMode mode;
if (!_logic->joeX() && !_logic->joeY()) {
@ -865,18 +874,8 @@ void Cutaway::run(char *nextFilename) {
_input->cutawayRunning(true);
_logic->joeCutFacing(_logic->joeFacing());
_logic->joeFace();
_initialRoom = _temporaryRoom = _logic->currentRoom();
// FIXME: hack to hide the panel *before* displaying a talking head.
// This was not handled in the original game, but I think it is
// better like that.
if (_talkTo != 0) {
_comPanel = 2;
}
_logic->display()->screenMode(_comPanel, true);
if (_comPanel == 0 || _comPanel == 2) {
@ -1012,17 +1011,14 @@ void Cutaway::run(char *nextFilename) {
}
if (_logic->currentRoom() != _initialRoom) {
// XXX should call SETUP_ROOM here but that would introduce a
// circual dependency, so we try to set newRoom to the room
// instead
debug(0, "[Cutaway::run] Not calling SETUP_ROOM here, just setting newRoom to %i", _initialRoom);
_logic->newRoom(_initialRoom);
_logic->display()->fullscreen(true);
}
else {
_logic->joeX(0);
_logic->joeY(0);
_logic->currentRoom(_initialRoom);
_logic->changeRoom();
if (_logic->currentRoom() == _logic->newRoom()) {
_logic->newRoom(0);
}
}
_logic->joeX(0);
_logic->joeY(0);
}
_logic->joeCutFacing(0);

View file

@ -290,7 +290,6 @@ class Cutaway {
//! Dump CutawayAnum data with debug()
static void dumpCutawayAnim(CutawayAnim &anim);
};
} // End of namespace Queen

View file

@ -400,6 +400,10 @@ void Logic::initialise() {
ObjectData* Logic::objectData(int index) const {
if (index < 0) {
warning("Logic::objectData() called with negative object index: %i", index);
}
index = ABS(index); // cyx: is that really necessary ?
if (index <= _numObjects)
return &_objectData[index];
@ -2571,6 +2575,63 @@ void Logic::sceneStop() {
}
void Logic::changeRoom() {
if (currentRoom() == ROOM_JUNGLE_PINNACLE) {
handlePinnacleRoom();
}
else if (currentRoom() == FOTAQ_LOGO && gameState(VAR_INTRO_PLAYED) == 0) {
// FIXME: this should be rewritten in a more elegant way
bool pcGamesDemo = _resource->isDemo() && !_resource->exists("pclogo.cut");
if (pcGamesDemo) {
currentRoom(79);
}
roomDisplay(currentRoom(), RDM_FADE_NOJOE, 100, 2, true);
if (_resource->isDemo()) {
if (pcGamesDemo) {
playCutaway("clogo.cut");
}
else {
playCutaway("pclogo.cut");
}
}
else {
playCutaway("copy.cut");
playCutaway("clogo.cut");
// TODO enable talking for talkie version
playCutaway("cdint.cut");
// restore palette colors ranging from 144 to 256
_graphics->loadPanel();
playCutaway("cred.cut");
}
// Ugly fix from original code
sceneReset();
currentRoom(ROOM_HOTEL_LOBBY);
entryObj(584);
roomDisplay(currentRoom(), RDM_FADE_JOE, 100, 2, true);
playCutaway("c70d.cut");
gameState(VAR_INTRO_PLAYED, 1);
inventorySetup();
inventoryRefresh();
}
else {
roomDisplay(currentRoom(), RDM_FADE_JOE, 100, 1, false);
}
_display->showMouseCursor(true); // _drawMouseFlag = 1;
}
void Logic::useJournal() {
if (_resource->isDemo()) {

View file

@ -296,6 +296,8 @@ public:
//! Stop making a scene
void sceneStop();
void changeRoom();
void useJournal();
void executeSpecialMove(uint16 sm);

View file

@ -122,71 +122,18 @@ 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() == ROOM_JUNGLE_PINNACLE) {
_logic->handlePinnacleRoom();
}
else if (_logic->currentRoom() == FOTAQ_LOGO && _logic->gameState(VAR_INTRO_PLAYED) == 0) {
bool pcGamesDemo = _resource->isDemo() && !_resource->exists("pclogo.cut");
if (pcGamesDemo) {
_logic->currentRoom(79);
}
_logic->roomDisplay(_logic->currentRoom(), RDM_FADE_NOJOE, 100, 2, true);
if (_resource->isDemo()) {
if (pcGamesDemo) {
_logic->playCutaway("clogo.cut");
}
else {
_logic->playCutaway("pclogo.cut");
}
}
else {
_logic->playCutaway("copy.cut");
_logic->playCutaway("clogo.cut");
// TODO enable talking for talkie version
_logic->playCutaway("cdint.cut");
// restore palette colors ranging from 144 to 256
_graphics->loadPanel();
_logic->playCutaway("cred.cut");
}
// Ugly fix from original code
_logic->sceneReset();
_logic->currentRoom(ROOM_HOTEL_LOBBY);
_logic->entryObj(584);
_logic->roomDisplay(_logic->currentRoom(), RDM_FADE_JOE, 100, 2, true);
_logic->playCutaway("c70d.cut");
_logic->gameState(VAR_INTRO_PLAYED, 1);
_logic->inventorySetup();
_logic->inventoryRefresh();
}
else {
_logic->roomDisplay(_logic->currentRoom(), RDM_FADE_JOE, 100, 1, false);
}
_display->showMouseCursor(true); // _drawMouseFlag = 1;
}
void QueenEngine::go() {
initialise();
_input->fastMode(true);
//_logic->currentRoom(69);
//_logic->roomDisplay(_logic->currentRoom(), RDM_FADE_JOE, 100, 2, true);
//_graphics->initFightBamScene();
//_logic->playCutaway("c69g.CUT");
_logic->oldRoom(0);
_logic->newRoom(_logic->currentRoom());
@ -197,7 +144,7 @@ void QueenEngine::go() {
_logic->update();
_logic->oldRoom(_logic->currentRoom());
_logic->currentRoom(_logic->newRoom());
roomChanged();
_logic->changeRoom();
_display->fullscreen(false);
if (_logic->currentRoom() == _logic->newRoom()) {
_logic->newRoom(0);

View file

@ -45,9 +45,6 @@ protected:
void errorString(const char *buf_input, char *buf_output);
//! Called when we go from one room to another
void roomChanged(); // SETUP_ROOM
void go();
void initialise();
@ -55,7 +52,6 @@ protected:
static void timerHandler(void *ptr);
void gotTimerTick();
Graphics *_graphics;
Input *_input;
Resource *_resource;

View file

@ -220,7 +220,7 @@ REDISP_OBJECT() Logic::roomRefreshObject
restart_game()
SETUP_BOBS() Graphics::bobSetupControl
SETUP_FURNITURE() Logic::roomSetupFurniture
SETUP_ROOM() QueenEngine::roomChanged
SETUP_ROOM() Logic::changeRoom
SETUP_SCREENS() *not needed* (only calls Graphics::loadPanel)
SETUP_VARS() *not needed* (equivalent to Command::clear(), SCENE=0, clear(gamestate))
update() Logic::update