rewitten fullscreen/panel switching code

svn-id: r11296
This commit is contained in:
Gregory Montoir 2003-11-14 14:35:52 +00:00
parent 183b822629
commit 730fd27a19
6 changed files with 40 additions and 44 deletions

View File

@ -1204,8 +1204,18 @@ void Cutaway::run(char *nextFilename) {
_initialRoom = _temporaryRoom = _logic->currentRoom();
if (_comPanel == 0 || _comPanel == 2)
_logic->sceneStart(false);
// 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) {
_logic->sceneStart();
}
byte *ptr = _objectData;
@ -1308,11 +1318,13 @@ void Cutaway::run(char *nextFilename) {
talk(nextFilename);
if (_comPanel == 0 || (_comPanel == 2 && !_anotherCutaway)) {
_logic->sceneStop(true);
_logic->sceneStop();
_comPanel = 0;
}
if (nextFilename[0] == '\0' && !_anotherCutaway) {
_logic->display()->fullscreen(false);
// Lines 2138-2182 in cutaway.c
if (_finalRoom) {
_logic->newRoom(0);
@ -1340,12 +1352,12 @@ void Cutaway::run(char *nextFilename) {
// instead
debug(0, "[Cutaway::run] Not calling SETUP_ROOM here, just setting newRoom to %i", _initialRoom);
_logic->newRoom(_initialRoom);
_logic->display()->fullscreen(true);
}
}
// XXX CUTJOEF=0;
_comPanel = 0;
_logic->display()->fullscreen(false);
// XXX some string animations
int k = 0;

View File

@ -621,37 +621,29 @@ void Display::palCustomFlash() {
void Display::screenMode(int comPanel, bool inCutaway) {
if (comPanel == 2 && inCutaway) {
if (_bdHeight == GAME_SCREEN_HEIGHT) {
_fullscreen = true;
_panel = false;
}
else {
_fullscreen = false;
_panel = true;
}
debug(0, "Display::screenMode(%d, %d)", comPanel, inCutaway);
// FIXME: this is temporary, just to see if my theory is right
if (comPanel == 2 && !inCutaway) {
warning("Display::screenMode() - (comPanel == 2 && !inCutaway)");
}
else {
_fullscreen = 0;
if (comPanel == 1) {
_panel = true;
}
if (comPanel == 2 && inCutaway) {
_fullscreen = (_bdHeight == GAME_SCREEN_HEIGHT);
}
else if (comPanel == 1) {
_fullscreen = false;
}
}
void Display::prepareUpdate() {
if (_panel) {
if (!_fullscreen) {
// draw the panel
memcpy(_buffers[RB_SCREEN] + _bufPitch[RB_SCREEN] * ROOM_ZONE_HEIGHT,
_buffers[RB_PANEL], PANEL_W * PANEL_H);
}
else if (!_fullscreen) {
// clear the panel
memset(_buffers[RB_SCREEN] + _bufPitch[RB_SCREEN] * ROOM_ZONE_HEIGHT,
0, PANEL_W * PANEL_H);
}
// draw the backdrop bitmap
int i;

View File

@ -101,11 +101,9 @@ public:
void horizontalScroll(int16 scroll);
int16 horizontalScroll() const { return _horizontalScroll; }
void fullscreen(bool fs) { _fullscreen = fs; }
void fullscreen(bool fs) { debug(0, "Display::fullscreen(%d)", fs); _fullscreen = fs; }
bool fullscreen() const { return _fullscreen; }
void panel(bool on) { _panel = on; }
void handleTimer();
void waitForTimer();
@ -140,7 +138,6 @@ private:
uint16 _bufPitch[3];
bool _fullscreen;
bool _panel;
uint16 _horizontalScroll;
uint16 _bdWidth, _bdHeight;

View File

@ -1835,7 +1835,9 @@ void Logic::dialogue(const char *dlgFile, int personInRoom, char *cutaway) {
if (cutaway == NULL) {
cutaway = cutawayFile;
}
_display->fullscreen(true);
Talk::talk(dlgFile, personInRoom, cutaway, _graphics, _input, this, _resource, _sound);
_display->fullscreen(false);
}
@ -2507,21 +2509,20 @@ bool Logic::gameLoad(uint16 slot) {
return true;
}
void Logic::sceneStart(bool showMouseCursor) {
void Logic::sceneStart() {
debug(0, "[Logic::sceneStart] _scene = %i", _scene);
_scene++;
_display->mouseCursorShow(showMouseCursor);
_display->mouseCursorShow(false);
if (1 == _scene && _input->cutawayRunning()) {
_display->panel(true);
if (1 == _scene) { // && _input->cutawayRunning()) { // sceneStart is always called when cutaway is running
_display->palFadePanel();
}
update();
}
void Logic::sceneStop(bool showMouseCursor) {
void Logic::sceneStop() {
debug(0, "[Logic::sceneStop] _scene = %i", _scene);
_scene--;
@ -2529,8 +2530,7 @@ void Logic::sceneStop(bool showMouseCursor) {
return;
_display->palSetAllDirty();
_display->panel(true);
_display->mouseCursorShow(showMouseCursor);
_display->mouseCursorShow(true);
zoneSetupPanel();
}

View File

@ -288,10 +288,10 @@ public:
void sceneReset() { _scene = 0; }
//! Make a scene
void sceneStart(bool showMouseCursor);
void sceneStart();
//! Stop making a scene
void sceneStop(bool showMouseCursor);
void sceneStop();
//! Copy data from dummy object to object
void objectCopy(int dummyObjectIndex, int objectIndex);

View File

@ -116,10 +116,6 @@ void Talk::talk(const char *filename, int personInRoom, char *cutawayFilename) {
// XXX SPEAK(JOE_RESPstr[k],"JOE",find_cd_desc(k));
// XXX return;
// XXX }
// XXX panelflag=0;
_wasFullscren = _logic->display()->fullscreen();
_logic->display()->fullscreen(true);
load(filename);
@ -353,7 +349,6 @@ void Talk::talk(const char *filename, int personInRoom, char *cutawayFilename) {
pbs->x = person.actor->x;
pbs->y = person.actor->y;
_logic->display()->fullscreen(_wasFullscren);
// Better kick start the persons anim sequence
pbs->animating = true;
pbs->animReset();
@ -623,8 +618,8 @@ bool Talk::speak(const char *sentence, Person *person, const char *voiceFilePref
person = &joe_person;
}
debug(0, "Sentence '%s' is said by person '%s' and voice files with prefix '%s' played",
sentence, person->name, voiceFilePrefix);
//debug(0, "Sentence '%s' is said by person '%s' and voice files with prefix '%s' played",
// sentence, person->name, voiceFilePrefix);
if (sentence[0] == '\0') {
goto exit;