DREAMWEB: Name some DynObject/SetObject fields

Also change getAnyAd() behaviour to be consistent between Free/Ex and
Set objects, diverging from the original.
This commit is contained in:
Willem Jan Palenstijn 2011-12-17 21:02:31 +01:00
parent b8ab0e6217
commit 5958d2d29a
3 changed files with 17 additions and 13 deletions

View File

@ -311,11 +311,11 @@ byte DreamGenContext::getOpenedSizeCPP() {
byte obj = data.byte(kOpenedob);
switch (data.byte(kOpenedtype)) {
case 4:
return getExAd(obj)->b8;
return getExAd(obj)->slotCount;
case 2:
return getFreeAd(obj)->b8;
return getFreeAd(obj)->slotCount;
default:
return getSetAd(obj)->b4;
return getSetAd(obj)->slotCount;
}
}

View File

@ -76,8 +76,8 @@ struct SetObject {
uint8 b0;
uint8 b1;
uint8 b2;
uint8 b3;
uint8 b4;
uint8 slotSize;
uint8 slotCount;
uint8 priority;
uint8 b6;
uint8 delay;
@ -125,8 +125,8 @@ struct DynObject {
uint8 currentLocation;
uint8 index;
uint8 mapad[5];
uint8 b7;
uint8 b8;
uint8 slotSize;
uint8 slotCount;
uint8 b9;
uint8 b10;
uint8 initialLocation;

View File

@ -1363,18 +1363,22 @@ DynObject *DreamBase::getEitherAdCPP() {
void *DreamBase::getAnyAd(uint8 *value1, uint8 *value2) {
if (data.byte(kObjecttype) == 4) {
DynObject *exObject = getExAd(data.byte(kCommand));
*value1 = exObject->b7;
*value2 = exObject->b8;
*value1 = exObject->slotSize;
*value2 = exObject->slotCount;
return exObject;
} else if (data.byte(kObjecttype) == 2) {
DynObject *freeObject = getFreeAd(data.byte(kCommand));
*value1 = freeObject->b7;
*value2 = freeObject->b8;
*value1 = freeObject->slotSize;
*value2 = freeObject->slotCount;
return freeObject;
} else {
SetObject *setObject = getSetAd(data.byte(kCommand));
*value1 = setObject->b4;
*value2 = setObject->priority;
// Note: the original returned slotCount/priority (bytes 4 and 5)
// instead of slotSize/slotCount (bytes 3 and 4).
// Changed this for consistency with the Ex/Free cases, and also
// with getOpenedSize()
*value1 = setObject->slotSize;
*value2 = setObject->slotCount;
return setObject;
}
}