Skip to content

Commit

Permalink
WAGE: Fixed uservar addressing
Browse files Browse the repository at this point in the history
  • Loading branch information
sev- committed Dec 27, 2015
1 parent 423d364 commit 878d1dc
Showing 1 changed file with 4 additions and 11 deletions.
15 changes: 4 additions & 11 deletions engines/wage/script.cpp
Expand Up @@ -225,9 +225,7 @@ Script::Operand *Script::readOperand() {
case 0xFF:
{
// user variable
int value = _data->readSByte();
if (value < 0)
value += 256;
int value = _data->readByte();

// TODO: Verify that we're using the right index.
return new Operand(cont->_userVariables[value - 1], Operand::NUMBER);
Expand Down Expand Up @@ -283,13 +281,8 @@ void Script::assign(byte operandType, int uservar, uint16 value) {

switch (operandType) {
case 0xFF:
{
// user variable
if (uservar < 0)
uservar += 256;

cont->_userVariables[uservar - 1] = value;
}
cont->_userVariables[uservar - 1] = value;
break;
case 0xD0:
cont->_statVariables[Context::PHYS_STR_BAS] = value;
break;
Expand Down Expand Up @@ -421,7 +414,7 @@ void Script::processLet() {
int uservar = 0;

if (operandType == 0xff)
uservar = _data->readSByte();
uservar = _data->readByte();

_data->readByte(); // skip "=" operator
do {
Expand Down

0 comments on commit 878d1dc

Please sign in to comment.