mirror of
https://github.com/libretro/scummvm.git
synced 2025-01-29 23:01:58 +00:00
Even more array code cleanup
svn-id: r14407
This commit is contained in:
parent
c87d33a102
commit
2d5bfca892
@ -1191,16 +1191,16 @@ void ScummEngine_v6he::o6_redimArray() {
|
||||
newY = pop();
|
||||
newX = pop();
|
||||
|
||||
if (newY == 0)
|
||||
if (newY == 0)
|
||||
SWAP(newX, newY);
|
||||
|
||||
subcode = fetchScriptByte();
|
||||
switch (subcode) {
|
||||
case 199:
|
||||
redimArray(fetchScriptWord(), newX, newY, rtInventory);
|
||||
redimArray(fetchScriptWord(), newX, newY, kIntArray);
|
||||
break;
|
||||
case 202:
|
||||
redimArray(fetchScriptWord(), newX, newY, rtCostume);
|
||||
redimArray(fetchScriptWord(), newX, newY, kByteArray);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@ -1209,7 +1209,7 @@ void ScummEngine_v6he::o6_redimArray() {
|
||||
|
||||
void ScummEngine_v6he::redimArray(int arrayId, int newX, int newY, int type) {
|
||||
// Used in mini game at Cosmic Dust Diner in puttmoon
|
||||
int var_2, var_4, ax, cx;
|
||||
int newSize, oldSize;
|
||||
|
||||
if (readVar(arrayId) == 0)
|
||||
error("redimArray: Reference to zeroed array pointer");
|
||||
@ -1219,20 +1219,13 @@ void ScummEngine_v6he::redimArray(int arrayId, int newX, int newY, int type) {
|
||||
if (!ah)
|
||||
error("redimArray: Invalid array (%d) reference", readVar(arrayId));
|
||||
|
||||
if (type == rtInventory)
|
||||
var_2 = 2;
|
||||
else // rtCostume
|
||||
var_2 = 1;
|
||||
newSize = (type == kIntArray) ? 2 : 1;
|
||||
oldSize = (ah->type == kIntArray) ? 2 : 1;
|
||||
|
||||
if (FROM_LE_16(ah->type) == rtInventory)
|
||||
var_4 = 2;
|
||||
else
|
||||
var_4 = 1;
|
||||
newSize *= (newX + 1) * (newY + 1);
|
||||
oldSize *= FROM_LE_16(ah->dim1) * FROM_LE_16(ah->dim2);
|
||||
|
||||
cx = var_2 * (newX + 1) * (newY + 1);
|
||||
ax = var_4 * FROM_LE_16(ah->dim1) * FROM_LE_16(ah->dim2);
|
||||
|
||||
if (ax != cx)
|
||||
if (newSize != oldSize)
|
||||
error("redimArray: array %d redim mismatch", readVar(arrayId));
|
||||
|
||||
ah->type = TO_LE_16(type);
|
||||
|
Loading…
x
Reference in New Issue
Block a user