mirror of
https://github.com/scummvm/scummvm.git
synced 2026-06-20 05:45:29 +00:00
CHEWY: Switch the TV videos to the new video code
This also adds handling for rewindable videos, which keep looping until the current dialog finishes. Furthermore, events are now correctly pushed to the engine code
This commit is contained in:
committed by
Paul Gilbert
parent
3f5f2c0bbf
commit
b9aabf3353
@@ -958,43 +958,6 @@ void flic_cut(int16 nr) {
|
||||
_G(sndPlayer)->setLoopMode(_G(spieler).soundLoopMode);
|
||||
break;
|
||||
|
||||
case FCUT_032:
|
||||
case FCUT_034:
|
||||
case FCUT_035:
|
||||
case FCUT_036:
|
||||
case FCUT_037:
|
||||
case FCUT_040:
|
||||
// TV
|
||||
if (nr != FCUT_036)
|
||||
_G(flc)->set_custom_user_function(Room39::setup_func);
|
||||
|
||||
do {
|
||||
#ifndef NEW_VIDEO_CODE
|
||||
_G(mem)->file->select_pool_item(_G(Ci).Handle, nr);
|
||||
ret = _G(flc)->custom_play(&_G(Ci));
|
||||
#else
|
||||
ret = g_engine->_video->playVideo(nr) ? 0 : -1;
|
||||
#endif
|
||||
SHOULD_QUIT_RETURN;
|
||||
} while (_G(atds)->aad_get_status() != -1 && ret != -1);
|
||||
|
||||
if (nr != FCUT_036)
|
||||
_G(flc)->remove_custom_user_function();
|
||||
break;
|
||||
|
||||
case FCUT_038:
|
||||
case FCUT_039:
|
||||
// TV
|
||||
#ifndef NEW_VIDEO_CODE
|
||||
_G(mem)->file->select_pool_item(_G(Ci).Handle, nr);
|
||||
_G(flc)->set_custom_user_function(Room39::setup_func);
|
||||
_G(flc)->custom_play(&_G(Ci));
|
||||
_G(flc)->remove_custom_user_function();
|
||||
#else
|
||||
g_engine->_video->playVideo(nr);
|
||||
#endif
|
||||
break;
|
||||
|
||||
case FCUT_047:
|
||||
case FCUT_048:
|
||||
#ifndef NEW_VIDEO_CODE
|
||||
|
||||
@@ -261,7 +261,7 @@ void Room28::set_pump() {
|
||||
load_chewy_taf(CHEWY_PUMPKIN);
|
||||
_G(spieler).R28ChewyPump = true;
|
||||
|
||||
if (_G(spieler).R39TransMensch) {
|
||||
if (_G(spieler).R39TranslatorUsed) {
|
||||
_G(spieler).room_e_obj[69].Attribut = AUSGANG_OBEN;
|
||||
} else {
|
||||
_G(atds)->set_ats_str(209, 1, ATS_DATEI);
|
||||
|
||||
@@ -50,8 +50,6 @@ static const AniBlock ABLOCK29[2] = {
|
||||
{ 9, 4, ANI_VOR, ANI_WAIT, 0 },
|
||||
};
|
||||
|
||||
bool Room39::_flag;
|
||||
|
||||
void Room39::entry() {
|
||||
if (!_G(spieler).R41Einbruch) {
|
||||
if (_G(spieler).R39HowardDa) {
|
||||
@@ -197,7 +195,7 @@ int16 Room39::use_tv() {
|
||||
set_tv();
|
||||
cls_flag = true;
|
||||
|
||||
if (!_G(spieler).R39TransMensch) {
|
||||
if (!_G(spieler).R39TranslatorUsed) {
|
||||
ani_nr = CH_TALK11;
|
||||
dia_nr = 78;
|
||||
} else if (!_G(spieler).R39TvKanal && _G(spieler).R39ClintNews < 3) {
|
||||
@@ -217,7 +215,7 @@ int16 Room39::use_tv() {
|
||||
action_flag = true;
|
||||
if (_G(spieler).R39TvOn) {
|
||||
start_spz_wait(CH_TRANS, 1, false, P_CHEWY);
|
||||
_G(spieler).R39TransMensch = true;
|
||||
_G(spieler).R39TranslatorUsed = true;
|
||||
_G(flags).NoPalAfterFlc = true;
|
||||
flic_cut(FCUT_041);
|
||||
_G(spieler).R39TvKanal = 0;
|
||||
@@ -248,7 +246,7 @@ int16 Room39::use_tv() {
|
||||
} else if (is_cur_inventar(RECORDER_INV) && _G(spieler).ChewyAni != CHEWY_ROCKER) {
|
||||
action_flag = true;
|
||||
if (_G(spieler).R39TvOn) {
|
||||
if (_G(spieler).R39TransMensch) {
|
||||
if (_G(spieler).R39TranslatorUsed) {
|
||||
start_spz(CH_TALK3, 255, ANI_VOR, P_CHEWY);
|
||||
start_aad_wait(98, -1);
|
||||
_G(spieler).PersonHide[P_CHEWY] = true;
|
||||
@@ -288,8 +286,6 @@ int16 Room39::use_tv() {
|
||||
}
|
||||
|
||||
void Room39::look_tv(bool cls_mode) {
|
||||
_flag = false;
|
||||
|
||||
if (_G(spieler).R39TvOn) {
|
||||
if (!_G(flags).AutoAniPlay) {
|
||||
_G(flags).AutoAniPlay = true;
|
||||
@@ -313,11 +309,9 @@ void Room39::look_tv(bool cls_mode) {
|
||||
_G(flags).NoPalAfterFlc = true;
|
||||
}
|
||||
|
||||
if (_G(spieler).R39TransMensch) {
|
||||
if (_G(spieler).R39TranslatorUsed) {
|
||||
if (dia_nr != 85)
|
||||
start_aad(dia_nr, -1);
|
||||
else
|
||||
_flag = true;
|
||||
}
|
||||
|
||||
flic_cut(flic_nr);
|
||||
@@ -329,7 +323,7 @@ void Room39::look_tv(bool cls_mode) {
|
||||
_G(out)->setPalette(_G(pal));
|
||||
_G(flags).NoPalAfterFlc = false;
|
||||
|
||||
if (_G(spieler).R39TransMensch && dia_nr == 85)
|
||||
if (_G(spieler).R39TranslatorUsed && dia_nr == 85)
|
||||
start_aad_wait(dia_nr, -1);
|
||||
}
|
||||
}
|
||||
@@ -351,7 +345,7 @@ void Room39::set_tv() {
|
||||
_G(det)->show_static_spr(_G(spieler).R39TvKanal + 4);
|
||||
}
|
||||
|
||||
if (_G(spieler).R39TransMensch) {
|
||||
if (_G(spieler).R39TranslatorUsed) {
|
||||
_G(atds)->set_ats_str(229, TXT_MARK_LOOK, 2 + _G(spieler).R39TvKanal, ATS_DATEI);
|
||||
} else {
|
||||
_G(atds)->set_ats_str(229, TXT_MARK_LOOK, 1, ATS_DATEI);
|
||||
@@ -359,40 +353,5 @@ void Room39::set_tv() {
|
||||
}
|
||||
}
|
||||
|
||||
int16 Room39::setup_func(int16 frame) {
|
||||
int16 action_ret = _G(in)->get_switch_code() == Common::KEYCODE_ESCAPE ? -1 : 0;
|
||||
|
||||
if (_flag) {
|
||||
switch (frame) {
|
||||
case 121:
|
||||
start_aad(599, -1);
|
||||
break;
|
||||
case 247:
|
||||
start_aad(600, -1);
|
||||
break;
|
||||
case 267:
|
||||
start_aad(601, 0);
|
||||
break;
|
||||
case 297:
|
||||
_G(in)->_hotkey = 1;
|
||||
break;
|
||||
case 171:
|
||||
case 266:
|
||||
case 370:
|
||||
_G(atds)->stop_aad();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
_G(atds)->print_aad(_G(spieler).scrollx, _G(spieler).scrolly);
|
||||
|
||||
if (!_flag && _G(atds)->aad_get_status() == -1)
|
||||
action_ret = -1;
|
||||
|
||||
return action_ret;
|
||||
}
|
||||
|
||||
} // namespace Rooms
|
||||
} // namespace Chewy
|
||||
|
||||
@@ -27,7 +27,7 @@ namespace Rooms {
|
||||
|
||||
class Room39 {
|
||||
private:
|
||||
static bool _flag;
|
||||
static bool _watchingGaspHorrorShow;
|
||||
|
||||
static void ok();
|
||||
static void set_tv();
|
||||
@@ -38,8 +38,6 @@ public:
|
||||
static short use_howard();
|
||||
static void talk_howard();
|
||||
static void look_tv(bool cls_mode);
|
||||
|
||||
static int16 setup_func(int16 frame);
|
||||
};
|
||||
|
||||
} // namespace Rooms
|
||||
|
||||
@@ -172,7 +172,7 @@ struct SpielerFlags {
|
||||
bool R37HundScham : 1;
|
||||
bool R37Kloppe : 1;
|
||||
bool R37Mes : 1;
|
||||
bool R39TransMensch : 1;
|
||||
bool R39TranslatorUsed : 1;
|
||||
bool R39TvOn : 1;
|
||||
bool R39ScriptOk : 1;
|
||||
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
|
||||
#include "chewy/video/cfo_decoder.h"
|
||||
#include "chewy/video/video_player.h"
|
||||
#include "chewy/events.h"
|
||||
#include "chewy/globals.h"
|
||||
#include "chewy/resource.h"
|
||||
#include "chewy/sound.h"
|
||||
@@ -71,26 +72,30 @@ 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();
|
||||
keepPlaying = handleCustom(num, curFrame);
|
||||
curFrame = cfoDecoder->getCurFrame();
|
||||
|
||||
if (cfoDecoder->hasDirtyPalette())
|
||||
g_system->getPaletteManager()->setPalette(cfoDecoder->getPalette(), 0, 256);
|
||||
//setScummVMPalette(cfoDecoder->getPalette(), 0, 256);
|
||||
|
||||
keepPlaying = handleCustom(num, curFrame, cfoDecoder);
|
||||
curFrame = cfoDecoder->getCurFrame();
|
||||
|
||||
g_screen->update();
|
||||
}
|
||||
}
|
||||
|
||||
while (g_system->getEventManager()->pollEvent(event)) {
|
||||
// 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;
|
||||
}
|
||||
g_events->update();
|
||||
|
||||
g_system->delayMillis(10);
|
||||
// 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 (_G(in)->get_switch_code() == Common::KEYCODE_ESCAPE)
|
||||
skipVideo = true;
|
||||
|
||||
// Clear any pending keys
|
||||
_G(in)->_hotkey = 0;
|
||||
_G(kbinfo).key_code = '\0';
|
||||
_G(kbinfo).scan_code = 0;
|
||||
}
|
||||
|
||||
cfoDecoder->close();
|
||||
@@ -105,7 +110,7 @@ bool VideoPlayer::playVideo(uint num, bool stopMusic) {
|
||||
return !skipVideo;
|
||||
}
|
||||
|
||||
bool VideoPlayer::handleCustom(uint num, uint frame) {
|
||||
bool VideoPlayer::handleCustom(uint num, uint frame, CfoDecoder *cfoDecoder) {
|
||||
switch (num) {
|
||||
case FCUT_004:
|
||||
// Room6::cut_serv1
|
||||
@@ -134,11 +139,52 @@ bool VideoPlayer::handleCustom(uint num, uint frame) {
|
||||
start_aad(106, 0);
|
||||
}
|
||||
break;
|
||||
case FCUT_032:
|
||||
case FCUT_034:
|
||||
case FCUT_035:
|
||||
case FCUT_036:
|
||||
case FCUT_037:
|
||||
case FCUT_038:
|
||||
case FCUT_039:
|
||||
case FCUT_040:
|
||||
// Room39::setup_func
|
||||
if (!_G(spieler).R39TranslatorUsed)
|
||||
return false;
|
||||
|
||||
if (num == FCUT_034) {
|
||||
switch (frame) {
|
||||
case 121:
|
||||
start_aad(599, -1);
|
||||
break;
|
||||
case 247:
|
||||
start_aad(600, -1);
|
||||
break;
|
||||
case 267:
|
||||
start_aad(601, 0);
|
||||
break;
|
||||
case 297:
|
||||
_G(in)->_hotkey = 1;
|
||||
break;
|
||||
case 171:
|
||||
case 266:
|
||||
case 370:
|
||||
_G(atds)->stop_aad();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
_G(atds)->print_aad(_G(spieler).scrollx, _G(spieler).scrolly);
|
||||
|
||||
if (cfoDecoder->endOfVideo() && _G(atds)->aad_get_status() != -1)
|
||||
cfoDecoder->rewind();
|
||||
break;
|
||||
case FCUT_094:
|
||||
//Room87::proc3
|
||||
// Room87::proc3
|
||||
return (frame >= 12) ? false : true;
|
||||
case FCUT_112:
|
||||
//Room56::proc1
|
||||
// Room56::proc1
|
||||
return (_G(in)->get_switch_code() == 1) ? false : true;
|
||||
default:
|
||||
return true;
|
||||
|
||||
@@ -24,17 +24,20 @@
|
||||
|
||||
namespace Chewy {
|
||||
|
||||
class CfoDecoder;
|
||||
|
||||
class VideoPlayer {
|
||||
public:
|
||||
/**
|
||||
* @Plays a video file
|
||||
* @param num - the video file number
|
||||
* @param stopMusic - stop music before starting the video
|
||||
* @return - true if played, false if skipped
|
||||
*/
|
||||
bool playVideo(uint num, bool stopMusic = true);
|
||||
|
||||
private:
|
||||
bool handleCustom(uint num, uint frame);
|
||||
bool handleCustom(uint num, uint frame, CfoDecoder *cfoDecoder);
|
||||
};
|
||||
|
||||
} // End of namespace Chewy
|
||||
|
||||
Reference in New Issue
Block a user