Skip to content

Commit

Permalink
ZVISION: Implement ActionKill.
Browse files Browse the repository at this point in the history
  • Loading branch information
Marisa-Chan committed Nov 1, 2013
1 parent a359001 commit e1df572
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 1 deletion.
40 changes: 40 additions & 0 deletions engines/zvision/actions.cpp
Expand Up @@ -152,6 +152,46 @@ bool ActionEnableControl::execute() {
}


//////////////////////////////////////////////////////////////////////////////
// ActionKill
//////////////////////////////////////////////////////////////////////////////

ActionKill::ActionKill(ZVision *engine, const Common::String &line) :
ResultAction(engine) {
_key = 0;
_type = 0;
char keytype[25];
sscanf(line.c_str(), "%*[^(](%25s)", keytype);
if (keytype[0] == '"') {
if (!scumm_stricmp(keytype, "\"ANIM\""))
_type = SideFX::SIDEFX_ANIM;
else if (!scumm_stricmp(keytype, "\"AUDIO\""))
_type = SideFX::SIDEFX_AUDIO;
else if (!scumm_stricmp(keytype, "\"DISTORT\""))
_type = SideFX::SIDEFX_DISTORT;
else if (!scumm_stricmp(keytype, "\"PANTRACK\""))
_type = SideFX::SIDEFX_PANTRACK;
else if (!scumm_stricmp(keytype, "\"REGION\""))
_type = SideFX::SIDEFX_REGION;
else if (!scumm_stricmp(keytype, "\"TIMER\""))
_type = SideFX::SIDEFX_TIMER;
else if (!scumm_stricmp(keytype, "\"TTYTEXT\""))
_type = SideFX::SIDEFX_TTYTXT;
else if (!scumm_stricmp(keytype, "\"ALL\""))
_type = SideFX::SIDEFX_ALL;
} else
_key = atoi(keytype);
}

bool ActionKill::execute() {
if (_type)
_engine->getScriptManager()->killSideFxType((SideFX::SideFXType)_type);
else
_engine->getScriptManager()->killSideFx(_key);
return true;
}


//////////////////////////////////////////////////////////////////////////////
// ActionMusic
//////////////////////////////////////////////////////////////////////////////
Expand Down
10 changes: 10 additions & 0 deletions engines/zvision/actions.h
Expand Up @@ -211,6 +211,16 @@ class ActionEnableControl : public ResultAction {
uint32 _key;
};

class ActionKill : public ResultAction {
public:
ActionKill(ZVision *engine, const Common::String &line);
bool execute();

private:
uint32 _key;
uint32 _type;
};

class ActionMusic : public ResultAction {
public:
ActionMusic(ZVision *engine, const Common::String &line);
Expand Down
2 changes: 1 addition & 1 deletion engines/zvision/scr_file_handling.cpp
Expand Up @@ -199,7 +199,7 @@ void ScriptManager::parseResults(Common::SeekableReadStream &stream, Common::Lis
} else if (line.matchString("*:inventory*", true)) {
// TODO: Implement ActionInventory
} else if (line.matchString("*:kill*", true)) {
// TODO: Implement ActionKill
actionList.push_back(new ActionKill(_engine, line));
} else if (line.matchString("*:menu_bar_enable*", true)) {
// TODO: Implement ActionMenuBarEnable
} else if (line.matchString("*:music*", true)) {
Expand Down

0 comments on commit e1df572

Please sign in to comment.