aboutsummaryrefslogtreecommitdiff
path: root/engines/made/scriptfuncs.cpp
diff options
context:
space:
mode:
authorBenjamin Haisch2009-02-04 19:15:12 +0000
committerBenjamin Haisch2009-02-04 19:15:12 +0000
commit22812367aa3db0f31856ad910f250cea83d609a4 (patch)
tree8cf550bf1520900ff2a9a8ecc99123961aced947 /engines/made/scriptfuncs.cpp
parent9de91ecdeaf5fc1e7b32094ba72076eca1d3f875 (diff)
downloadscummvm-rg350-22812367aa3db0f31856ad910f250cea83d609a4.tar.gz
scummvm-rg350-22812367aa3db0f31856ad910f250cea83d609a4.tar.bz2
scummvm-rg350-22812367aa3db0f31856ad910f250cea83d609a4.zip
- Fixed/completed cd audio support (sfPlayCd and sfGetCdTime) for Manhole:N&E and RtZ CD
svn-id: r36217
Diffstat (limited to 'engines/made/scriptfuncs.cpp')
-rw-r--r--engines/made/scriptfuncs.cpp20
1 files changed, 14 insertions, 6 deletions
diff --git a/engines/made/scriptfuncs.cpp b/engines/made/scriptfuncs.cpp
index a548aff15f..7a07550b6f 100644
--- a/engines/made/scriptfuncs.cpp
+++ b/engines/made/scriptfuncs.cpp
@@ -580,8 +580,13 @@ int16 ScriptFunctions::sfPlayVoice(int16 argc, int16 *argv) {
}
int16 ScriptFunctions::sfPlayCd(int16 argc, int16 *argv) {
- AudioCD.play(argv[0], -1, 0, 0);
- return 0;
+ AudioCD.play(argv[0] - 1, 1, 0, 0);
+ _vm->_cdTimeStart = _vm->_system->getMillis();
+ if (AudioCD.isPlaying()) {
+ return 1;
+ } else {
+ return 0;
+ }
}
int16 ScriptFunctions::sfStopCd(int16 argc, int16 *argv) {
@@ -598,10 +603,13 @@ int16 ScriptFunctions::sfGetCdStatus(int16 argc, int16 *argv) {
}
int16 ScriptFunctions::sfGetCdTime(int16 argc, int16 *argv) {
- // This one is called loads of times, so it has been commented out to reduce spam
- //warning("Unimplemented opcode: sfGetCdTime");
- // TODO
- return 32000;
+ if (AudioCD.isPlaying()) {
+ uint32 deltaTime = _vm->_system->getMillis() - _vm->_cdTimeStart;
+ // This basically converts the time from milliseconds to MSF format to MADE's format
+ return (deltaTime / 1000 * 30) + (deltaTime % 1000 / 75 * 30 / 75);
+ } else {
+ return 32000;
+ }
}
int16 ScriptFunctions::sfPlayCdSegment(int16 argc, int16 *argv) {