mirror of
https://github.com/libretro/scummvm.git
synced 2024-12-15 06:08:35 +00:00
* Changed Game::_variables to public since the GPL interpreter needs to use it and made it int instead of uint16
* Implemented variable accessing by the math evaluator * Fixed bug from previous commit (should have used && when checking for ending instructions, not ||) svn-id: r42242
This commit is contained in:
parent
318d406242
commit
b6b1402368
@ -96,7 +96,7 @@ Game::Game(DraciEngine *vm) : _vm(vm) {
|
||||
file = initArchive.getFile(2);
|
||||
unsigned int numVariables = file->_length / sizeof (int16);
|
||||
|
||||
_variables = new int16[numVariables];
|
||||
_variables = new int[numVariables];
|
||||
Common::MemoryReadStream variableData(file->_data, file->_length);
|
||||
|
||||
for (i = 0; i < numVariables; ++i) {
|
||||
|
@ -131,13 +131,14 @@ public:
|
||||
|
||||
GameObject *getObject(uint objNum);
|
||||
|
||||
int *_variables;
|
||||
|
||||
private:
|
||||
DraciEngine *_vm;
|
||||
|
||||
GameInfo *_info;
|
||||
Person *_persons;
|
||||
uint16 *_dialogOffsets;
|
||||
int16 *_variables;
|
||||
byte *_itemStatus;
|
||||
GameObject *_objects;
|
||||
Room _currentRoom;
|
||||
|
@ -297,8 +297,11 @@ int Script::handleMathExpression(Common::MemoryReadStream &reader) {
|
||||
|
||||
case kMathVariable:
|
||||
value = reader.readUint16LE();
|
||||
stk.push(value);
|
||||
debugC(3, kDraciBytecodeDebugLevel, "\t\tvariable: %d", value);
|
||||
|
||||
stk.push(_vm->_game->_variables[value-1]);
|
||||
|
||||
debugC(3, kDraciBytecodeDebugLevel, "\t\tvariable: %d (%d)", value,
|
||||
_vm->_game->_variables[value-1]);
|
||||
break;
|
||||
|
||||
case kMathFunctionCall:
|
||||
@ -458,7 +461,7 @@ int Script::run(GPL2Program program, uint16 offset) {
|
||||
(this->*(cmd->_handler))(params);
|
||||
}
|
||||
|
||||
} while (cmd->_name != "gplend" || cmd->_name != "exit");
|
||||
} while (cmd->_name != "gplend" && cmd->_name != "exit");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user