aboutsummaryrefslogtreecommitdiff
path: root/sky/logic.cpp
diff options
context:
space:
mode:
authorOliver Kiehl2003-05-31 16:25:15 +0000
committerOliver Kiehl2003-05-31 16:25:15 +0000
commit749782873437a7fcd86ef7c6489ea1914830f665 (patch)
tree8c383ecd728f1995fd37098efd9c06ce7c29689b /sky/logic.cpp
parent33030f7bedc9aae06ca89bc35d6a535627f029e8 (diff)
downloadscummvm-rg350-749782873437a7fcd86ef7c6489ea1914830f665.tar.gz
scummvm-rg350-749782873437a7fcd86ef7c6489ea1914830f665.tar.bz2
scummvm-rg350-749782873437a7fcd86ef7c6489ea1914830f665.zip
cleanup, add some doxygen docs
svn-id: r8184
Diffstat (limited to 'sky/logic.cpp')
-rw-r--r--sky/logic.cpp31
1 files changed, 21 insertions, 10 deletions
diff --git a/sky/logic.cpp b/sky/logic.cpp
index 213c15ea32..b8b6d5e4ab 100644
--- a/sky/logic.cpp
+++ b/sky/logic.cpp
@@ -104,6 +104,11 @@ void SkyLogic::engine() {
void SkyLogic::nop() {}
+/**
+ * This function is basicly a wrapper around the real script engine. It runs
+ * the script engine until a script has finished.
+ * @see script()
+ */
void SkyLogic::logicScript() {
// Process the current mega's script
// If the script finishes then drop back a level
@@ -113,9 +118,7 @@ void SkyLogic::logicScript() {
uint16 *scriptNo = SkyCompact::getSub(_compact, mode);
uint16 *offset = SkyCompact::getSub(_compact, mode + 2);
- uint32 scr = script(*scriptNo, *offset);
- *scriptNo = (uint16)(scr & 0xffff);
- *offset = (uint16)(scr >> 16);
+ *offset = script(*scriptNo, *offset);
if (!*offset) // script finished
_compact->mode -= 4;
@@ -920,15 +923,23 @@ void SkyLogic::initScriptVariables() {
memcpy(_scriptVariables + 505, forwardList5b, sizeof(forwardList5b));
}
-uint32 SkyLogic::script(uint16 scriptNo, uint16 offset) {
+/**
+ * \fn uint32 SkyLogic::script(uint16 scriptNo, uint16 offset)
+ * \brief This is the actual script engine.
+ * It interprets script \a scriptNo starting at \a offset
+ *
+ * \param scriptNo The script to interpret.
+ * \li \arg Bits 0-11 - Script number
+ * \li \arg Bits 12-15 - Module number
+ * \param offset At which offset to start interpreting the script.
+ *
+ * @return 0 if script finished. Else offset where to continue.
+ */
+uint16 SkyLogic::script(uint16 scriptNo, uint16 offset) {
script:
// process a script
// low level interface to interpreter
- // scriptNo:
- // Bit 0-11 - Script number
- // Bit 12-15 - Module number
-
uint16 moduleNo = (uint16)((scriptNo & 0xff00) >> 12);
debug(3, "Doing Script %x\n", (offset << 16) | scriptNo);
uint16 *scriptData = _moduleList[moduleNo]; // get module address
@@ -1039,7 +1050,7 @@ script:
_compact = saveCpt;
if (!ret)
- return (((scriptData - moduleStart) << 16) | scriptNo);
+ return (scriptData - moduleStart);
}
break;
case 12: // more_than
@@ -1092,7 +1103,7 @@ script:
}
case 13:
case 19: // script_exit
- return scriptNo;
+ return 0;
case 20: // restart_script
goto script;
default: