aboutsummaryrefslogtreecommitdiff
path: root/engines/mohawk/riven_vars.cpp
diff options
context:
space:
mode:
authorJohannes Schickel2010-10-13 03:57:44 +0000
committerJohannes Schickel2010-10-13 03:57:44 +0000
commit75e8452b6e6a2bf4fb2f588aa00b428a60d873b5 (patch)
treef29541d55309487a94bd1d38e8b53bb3dde9aec6 /engines/mohawk/riven_vars.cpp
parent48ee83b88957dab86bc763e9ef21a70179fa8679 (diff)
parente9f50882ea5b6beeefa994040be9d3bab6a1f107 (diff)
downloadscummvm-rg350-75e8452b6e6a2bf4fb2f588aa00b428a60d873b5.tar.gz
scummvm-rg350-75e8452b6e6a2bf4fb2f588aa00b428a60d873b5.tar.bz2
scummvm-rg350-75e8452b6e6a2bf4fb2f588aa00b428a60d873b5.zip
OPENGL: Merged from trunk, from rev 52105 to 53396.
This includes an rather hacky attempt to merge all the recent gp2x backend changes into the branch. I suppose the gp2x backend and probably all new backends, i.e. gph, dingux etc., might not compile anymore. Since I have no way of testing those it would be nice if porters could look into getting those up to speed in this branch. svn-id: r53399
Diffstat (limited to 'engines/mohawk/riven_vars.cpp')
-rw-r--r--engines/mohawk/riven_vars.cpp55
1 files changed, 26 insertions, 29 deletions
diff --git a/engines/mohawk/riven_vars.cpp b/engines/mohawk/riven_vars.cpp
index b6d2dff315..ae06afef01 100644
--- a/engines/mohawk/riven_vars.cpp
+++ b/engines/mohawk/riven_vars.cpp
@@ -271,7 +271,7 @@ static const char *variableNames[] = {
};
uint32 *MohawkEngine_Riven::getLocalVar(uint32 index) {
- return matchVarToString(getName(VariableNames, index));
+ return getVar(getName(VariableNames, index));
}
uint32 MohawkEngine_Riven::getGlobalVar(uint32 index) {
@@ -279,18 +279,15 @@ uint32 MohawkEngine_Riven::getGlobalVar(uint32 index) {
}
Common::String MohawkEngine_Riven::getGlobalVarName(uint32 index) {
- return Common::String(variableNames[index]);
+ return variableNames[index];
}
-uint32 *MohawkEngine_Riven::matchVarToString(Common::String varName) {
- return matchVarToString(varName.c_str());
-}
-
-uint32 *MohawkEngine_Riven::matchVarToString(const char *varName) {
+uint32 *MohawkEngine_Riven::getVar(const Common::String &varName) {
for (uint32 i = 0; i < _varCount; i++)
- if (!scumm_stricmp(varName, variableNames[i]))
+ if (varName.equalsIgnoreCase(variableNames[i]))
return &_vars[i];
- error ("Unknown variable: \'%s\'", varName);
+
+ error ("Unknown variable: '%s'", varName.c_str());
return NULL;
}
@@ -304,33 +301,33 @@ void MohawkEngine_Riven::initVars() {
_vars[i] = 0;
// Init Variables to their correct starting state.
- *matchVarToString("ttelescope") = 5;
- *matchVarToString("tgatestate") = 1;
- *matchVarToString("jbridge1") = 1;
- *matchVarToString("jbridge4") = 1;
- *matchVarToString("jgallows") = 1;
- *matchVarToString("jiconcorrectorder") = 12068577;
- *matchVarToString("bblrvalve") = 1;
- *matchVarToString("bblrwtr") = 1;
- *matchVarToString("bfans") = 1;
- *matchVarToString("bytrap") = 2;
- *matchVarToString("aatruspage") = 1;
- *matchVarToString("acathpage") = 1;
- *matchVarToString("bheat") = 1;
- *matchVarToString("waterenabled") = 1;
- *matchVarToString("ogehnpage") = 1;
- *matchVarToString("bblrsw") = 1;
- *matchVarToString("ocage") = 1;
+ *getVar("ttelescope") = 5;
+ *getVar("tgatestate") = 1;
+ *getVar("jbridge1") = 1;
+ *getVar("jbridge4") = 1;
+ *getVar("jgallows") = 1;
+ *getVar("jiconcorrectorder") = 12068577;
+ *getVar("bblrvalve") = 1;
+ *getVar("bblrwtr") = 1;
+ *getVar("bfans") = 1;
+ *getVar("bytrap") = 2;
+ *getVar("aatruspage") = 1;
+ *getVar("acathpage") = 1;
+ *getVar("bheat") = 1;
+ *getVar("waterenabled") = 1;
+ *getVar("ogehnpage") = 1;
+ *getVar("bblrsw") = 1;
+ *getVar("ocage") = 1;
// Randomize the telescope combination
- uint32 *teleCombo = matchVarToString("tcorrectorder");
+ uint32 *teleCombo = getVar("tcorrectorder");
for (byte i = 0; i < 5; i++) {
*teleCombo *= 10;
*teleCombo += _rnd->getRandomNumberRng(1, 5); // 5 buttons
}
// Randomize the prison combination
- uint32 *prisonCombo = matchVarToString("pcorrectorder");
+ uint32 *prisonCombo = getVar("pcorrectorder");
for (byte i = 0; i < 5; i++) {
*prisonCombo *= 10;
*prisonCombo += _rnd->getRandomNumberRng(1, 3); // 3 buttons/sounds
@@ -338,7 +335,7 @@ void MohawkEngine_Riven::initVars() {
// Randomize the dome combination -- each bit represents a slider position,
// the highest bit (1 << 24) represents 1, (1 << 23) represents 2, etc.
- uint32 *domeCombo = matchVarToString("adomecombo");
+ uint32 *domeCombo = getVar("adomecombo");
for (byte bitsSet = 0; bitsSet < 5;) {
uint32 randomBit = 1 << (24 - _rnd->getRandomNumber(24));