CHEWY: Use the new video playing code for special videos 9 and 10

This commit is contained in:
Filippos Karapetis 2022-02-24 21:50:33 +02:00 committed by Paul Gilbert
parent cb3983d102
commit 97cde7eba9
4 changed files with 28 additions and 83 deletions

View File

@ -930,6 +930,7 @@ void flic_cut(int16 nr) {
FCUT_113, FCUT_106, FCUT_103, FCUT_118, FCUT_120
};
int16 i, ret = 0;
bool keepPlaying = true;
_G(out)->set_pointer(nullptr);
_G(det)->disable_room_sound();
@ -943,48 +944,11 @@ void flic_cut(int16 nr) {
if (_G(Ci).Handle) {
switch (nr) {
case FCUT_009:
#ifndef NEW_VIDEO_CODE
_G(mem)->file->select_pool_item(_G(Ci).Handle, nr);
_G(flc)->set_custom_user_function(Room11::cut_serv);
_G(flc)->custom_play(&_G(Ci));
_G(flc)->remove_custom_user_function();
#else
g_engine->_video->playVideo(nr);
#endif
break;
case FCUT_010:
#ifndef NEW_VIDEO_CODE
_G(mem)->file->select_pool_item(_G(Ci).Handle, nr);
_G(flc)->set_custom_user_function(Room11::cut_serv_2);
_G(flc)->custom_play(&_G(Ci));
_G(flc)->remove_custom_user_function();
#else
g_engine->_video->playVideo(nr);
#endif
break;
case FCUT_SPACECHASE_18:
case FCUT_SPACECHASE_19:
case FCUT_SPACECHASE_20:
case FCUT_SPACECHASE_21:
case FCUT_SPACECHASE_22:
case FCUT_SPACECHASE_23:
case FCUT_SPACECHASE_24:
case FCUT_SPACECHASE_25:
case FCUT_SPACECHASE_26:
case FCUT_SPACECHASE_27:
case FCUT_SPACECHASE_28:
_G(sndPlayer)->stopMod();
_G(currentSong) = -1;
nr = FCUT_SPACECHASE_18;
_G(sndPlayer)->setLoopMode(1);
for (i = 0; i < 11; i++) {
g_engine->_video->playVideo(FCUT_SPACECHASE_18 + i);
SHOULD_QUIT_RETURN;
for (i = 0; i < 11 && keepPlaying; i++) {
keepPlaying = g_engine->_video->playVideo(FCUT_SPACECHASE_18 + i);
}
_G(sndPlayer)->fadeOut(0);
@ -1001,12 +965,6 @@ void flic_cut(int16 nr) {
case FCUT_037:
case FCUT_040:
// TV
if (nr == FCUT_034) {
_G(sndPlayer)->stopMod();
_G(currentSong) = -1;
}
if (nr != FCUT_036)
_G(flc)->set_custom_user_function(Room39::setup_func);

View File

@ -204,36 +204,5 @@ void Room11::put_card() {
}
}
int16 Room11::cut_serv(int16 frame) {
if (_G(spieler).R11DoorRightF)
_G(det)->plot_static_details(0, 0, 0, 0);
if (_G(spieler).R11DoorRightB)
_G(det)->plot_static_details(0, 0, 6, 6);
if (_G(spieler).R45MagOk)
_G(det)->plot_static_details(0, 0, 7, 7);
return 0;
}
int16 Room11::cut_serv_2(int16 frame) {
if (_G(spieler).R11DoorRightF)
_G(det)->plot_static_details(0, 0, 0, 0);
if (_G(spieler).R11DoorRightB)
_G(det)->plot_static_details(0, 0, 6, 6);
if (_G(spieler).R6DoorRightB)
_G(det)->plot_static_details(0, 0, 7, 7);
_G(atds)->print_aad(_G(spieler).scrollx, _G(spieler).scrolly);
if (frame == 43)
start_aad(106, 0);
return 0;
}
} // namespace Rooms
} // namespace Chewy

View File

@ -39,9 +39,6 @@ public:
static void put_card();
static int16 scanner();
static void talk_debug();
static int16 cut_serv(int16 frame);
static int16 cut_serv_2(int16 frame);
};
} // namespace Rooms

View File

@ -50,7 +50,7 @@ bool VideoPlayer::playVideo(uint num, bool stopMusic) {
bool skipVideo = false;
byte curPalette[256 * 3];
uint32 curFrame = 0;
bool customExit = false;
bool keepPlaying = true;
g_system->getPaletteManager()->grabPalette(curPalette, 0, 256);
//save_palette(curPalette);
@ -63,7 +63,7 @@ bool VideoPlayer::playVideo(uint num, bool stopMusic) {
cfoDecoder->start();
while (!g_engine->shouldQuit() && !cfoDecoder->endOfVideo() && !skipVideo && !customExit) {
while (!g_engine->shouldQuit() && !cfoDecoder->endOfVideo() && !skipVideo && keepPlaying) {
if (cfoDecoder->needsUpdate()) {
const ::Graphics::Surface *frame = cfoDecoder->decodeNextFrame();
if (frame) {
@ -71,7 +71,7 @@ bool VideoPlayer::playVideo(uint num, bool stopMusic) {
byte *destP = (byte *)g_screen->getPixels();
Common::copy(srcP, srcP + (SCREEN_WIDTH * SCREEN_HEIGHT), destP);
g_screen->markAllDirty();
customExit = !handleCustom(num, curFrame);
keepPlaying = handleCustom(num, curFrame);
curFrame = cfoDecoder->getCurFrame();
if (cfoDecoder->hasDirtyPalette())
@ -83,7 +83,10 @@ bool VideoPlayer::playVideo(uint num, bool stopMusic) {
}
while (g_system->getEventManager()->pollEvent(event)) {
if ((event.type == Common::EVENT_KEYDOWN && event.kbd.keycode == Common::KEYCODE_ESCAPE) || event.type == Common::EVENT_LBUTTONUP)
// FIXME: We ignore mouse events because the game checks
// for left mouse down, instead of up, so releasing the
// mouse button results in video skipping
if ((event.type == Common::EVENT_KEYDOWN && event.kbd.keycode == Common::KEYCODE_ESCAPE) /*|| event.type == Common::EVENT_LBUTTONUP*/)
skipVideo = true;
}
@ -113,6 +116,24 @@ bool VideoPlayer::handleCustom(uint num, uint frame) {
if (frame == 31)
start_aad(107, 0);
break;
case FCUT_009:
case FCUT_010:
// Room11::cut_serv and Room11::cut_serv_2
if (_G(spieler).R11DoorRightF)
_G(det)->plot_static_details(0, 0, 0, 0);
if (_G(spieler).R11DoorRightB)
_G(det)->plot_static_details(0, 0, 6, 6);
if (_G(spieler).R6DoorRightB)
_G(det)->plot_static_details(0, 0, 7, 7);
if (num == FCUT_010) {
_G(atds)->print_aad(_G(spieler).scrollx, _G(spieler).scrolly);
if (frame == 43)
start_aad(106, 0);
}
break;
case FCUT_094:
//Room87::proc3
return (frame >= 12) ? false : true;