mirror of
https://github.com/libretro/scummvm.git
synced 2024-12-13 21:31:53 +00:00
Add var difference in later HE games
svn-id: r14789
This commit is contained in:
parent
e967fdbb2a
commit
3b7d3120c1
@ -2429,6 +2429,7 @@ void ScummEngine::allocateArrays() {
|
||||
_inventory = (uint16 *)calloc(_numInventory, sizeof(uint16));
|
||||
_verbs = (VerbSlot *)calloc(_numVerbs, sizeof(VerbSlot));
|
||||
_objs = (ObjectData *)calloc(_numLocalObjects, sizeof(ObjectData));
|
||||
_roomVars = (int32 *)calloc(_numBitVariables, sizeof(int32));
|
||||
_scummVars = (int32 *)calloc(_numVariables, sizeof(int32));
|
||||
_bitVars = (byte *)calloc(_numBitVariables >> 3, 1);
|
||||
_images = (uint16 *)calloc(_numImages, sizeof(uint16));
|
||||
|
@ -477,13 +477,6 @@ int ScummEngine::fetchScriptWordSigned() {
|
||||
}
|
||||
|
||||
int ScummEngine::readVar(uint var) {
|
||||
// HACK Seems to variable difference
|
||||
// Correct values for now
|
||||
if (_gameId == GID_PAJAMA && var == 32770)
|
||||
return 5;
|
||||
else if (_gameId == GID_WATER && var == 32770)
|
||||
return 23
|
||||
;
|
||||
int a;
|
||||
static byte copyprotbypassed;
|
||||
if (!_copyProtection)
|
||||
@ -523,7 +516,12 @@ int ScummEngine::readVar(uint var) {
|
||||
}
|
||||
|
||||
if (var & 0x8000) {
|
||||
if ((_gameId == GID_ZAK256) || (_features & GF_OLD_BUNDLE) ||
|
||||
if (_gameId == GID_PAJAMA) {
|
||||
var &= 0xFFF;
|
||||
checkRange(_numBitVariables, 0, var, "Room variable %d out of range(w)");
|
||||
return _roomVars[var];
|
||||
|
||||
} else if ((_gameId == GID_ZAK256) || (_features & GF_OLD_BUNDLE) ||
|
||||
(_gameId == GID_LOOM && (_features & GF_FMTOWNS))) {
|
||||
int bit = var & 0xF;
|
||||
var = (var >> 4) & 0xFF;
|
||||
@ -557,7 +555,10 @@ int ScummEngine::readVar(uint var) {
|
||||
var &= 0xFFF;
|
||||
}
|
||||
|
||||
checkRange(20, 0, var, "Local variable %d out of range(r)");
|
||||
if (_heversion >= 72)
|
||||
checkRange(24, 0, var, "Local variable %d out of range(r)");
|
||||
else
|
||||
checkRange(20, 0, var, "Local variable %d out of range(r)");
|
||||
return vm.localvar[_currentScript][var];
|
||||
}
|
||||
|
||||
@ -598,7 +599,12 @@ void ScummEngine::writeVar(uint var, int value) {
|
||||
}
|
||||
|
||||
if (var & 0x8000) {
|
||||
if ((_gameId == GID_ZAK256) || (_features & GF_OLD_BUNDLE) ||
|
||||
if (_gameId == GID_PAJAMA) {
|
||||
var &= 0xFFF;
|
||||
checkRange(_numBitVariables, 0, var, "Room variable %d out of range(w)");
|
||||
_roomVars[var] = value;
|
||||
|
||||
} else if ((_gameId == GID_ZAK256) || (_features & GF_OLD_BUNDLE) ||
|
||||
(_gameId == GID_LOOM && (_features & GF_FMTOWNS))) {
|
||||
// In the old games, the bit variables were using the same memory
|
||||
// as the normal variables!
|
||||
@ -628,7 +634,11 @@ void ScummEngine::writeVar(uint var, int value) {
|
||||
var &= 0xFFF;
|
||||
}
|
||||
|
||||
checkRange(20, 0, var, "Local variable %d out of range(w)");
|
||||
if (_heversion >= 72)
|
||||
checkRange(24, 0, var, "Local variable %d out of range(w)");
|
||||
else
|
||||
checkRange(20, 0, var, "Local variable %d out of range(w)");
|
||||
|
||||
vm.localvar[_currentScript][var] = value;
|
||||
return;
|
||||
}
|
||||
|
@ -491,6 +491,7 @@ ScummEngine::ScummEngine(GameDetector *detector, OSystem *syst, const ScummGameS
|
||||
_inventory = NULL;
|
||||
_newNames = NULL;
|
||||
_scummVars = NULL;
|
||||
_roomVars = NULL;
|
||||
_varwatch = 0;
|
||||
_bitVars = NULL;
|
||||
_numVariables = 0;
|
||||
|
@ -472,6 +472,7 @@ public:
|
||||
|
||||
protected:
|
||||
int16 _varwatch;
|
||||
int32 *_roomVars;
|
||||
int32 *_scummVars;
|
||||
byte *_bitVars;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user