SAGA2: Fix duplicated enums

This commit is contained in:
Eugene Sandulenko 2021-05-27 16:25:36 +02:00
parent b036dddc9d
commit 97fa02d7b8
No known key found for this signature in database
GPG Key ID: 014D387312D34F08
9 changed files with 43 additions and 60 deletions

View File

@ -194,7 +194,7 @@ bool ActorProto::openAction(ObjectID dObj, ObjectID) {
cn = CreateContainerNode(dObj, FALSE, openMindType);
cn->markForShow(); // Deferred open
dObjPtr->objectFlags |= GameObject::objectOpen; // Set open bit;
dObjPtr->objectFlags |= objectOpen; // Set open bit;
return TRUE;
}
@ -214,7 +214,7 @@ bool ActorProto::closeAction(ObjectID dObj, ObjectID) {
cn->markForDelete();
// Clear open bit
dObjPtr->objectFlags &= ~GameObject::objectOpen;
dObjPtr->objectFlags &= ~objectOpen;
return TRUE;
}

View File

@ -1645,7 +1645,7 @@ void ContainerList::doDeferredActions(void) {
if (obj->world() != world
|| (obj->getWorldLocation() - tp).quickHDistance() > maxOpenDistance) {
// Close object image and window (silently)
obj->setFlags(0, GameObject::objectOpen);
obj->setFlags(0, objectOpen);
delete n;
continue;
}

View File

@ -252,16 +252,6 @@ enum effectDrainsTypes {
};
//
// Object Effects - effects that apply only to non-actor objects
//
enum effectObjectTypes {
objectLocked = 1 << 1,
objectInvisible = 1 << 4,
};
//
// TAG Effects - effects that apply when a TAG is the target
//
@ -280,6 +270,24 @@ enum effectLocationTypes {
locateDummy = 1,
};
enum objectFlags {
objectOpen = (1 << 0), // object is in the "open" state
objectLocked = (1 << 1), // object cannot be opened
objectImportant = (1 << 2), // object must be recycled when trashed
objectGhosted = (1 << 3), // object drawn translucent
objectInvisible = (1 << 4), // object cannot be seen
objectObscured = (1 << 5), // object obscured by terrain
objectMoving = (1 << 6), // object has attached motion task
objectScavengable = (1 << 7), // object can be deleted
objectFloating = (1 << 8), // object not affected by Gravity
objectNoRecycle = (1 << 9), // object is referred to by script, don't delete
objectActivated = (1 << 10), // object is activated
objectAlias = (1 << 11), // object is not real, just a copy of another object
objectTriggeringTAG = (1 << 12), // object has triggerred TAG upon which it rests
objectOnScreen = (1 << 13), // object is on display list
objectSightedByCenter = (1 << 14), // there is a line of sight to center actor
};
//
// Special Effects - these are spells that need to be handled manually
@ -333,7 +341,7 @@ inline uint16 makeEnchantmentID(effectOthersTypes othtyp, bool damamt) {
return (effectOthers << 13) | (othtyp << 8) + (damamt + 128);
}
inline uint16 makeEnchantmentID(effectObjectTypes othtyp, bool damamt) {
inline uint16 makeEnchantmentID(objectFlags othtyp, bool damamt) {
return (effectNonActor << 13) | (othtyp << 8) + (damamt + 128);
}

View File

@ -241,11 +241,11 @@ void evalObjectEnchantments(GameObject *obj) {
// have to do this a bit differently...
if (FindObjectEnchantment(obj->thisID(), makeEnchantmentID(effectNonActor, objectInvisible, TRUE)))
obj->setFlags((uint8) - 1, GameObject::objectInvisible);
obj->setFlags((uint8) - 1, objectInvisible);
else
obj->setFlags(0, GameObject::objectInvisible);
obj->setFlags(0, objectInvisible);
if (FindObjectEnchantment(obj->thisID(), makeEnchantmentID(effectNonActor, objectLocked, FALSE)))
obj->setFlags((uint8) - 1, GameObject::objectLocked);
obj->setFlags((uint8) - 1, objectLocked);
}
//-------------------------------------------------------------------

View File

@ -510,7 +510,7 @@ MotionTask *MotionTaskList::newTask(GameObject *obj) {
if (isActor(obj))((Actor *)obj)->moveTask = mt;
}
}
obj->objectFlags |= GameObject::objectMoving;
obj->objectFlags |= objectMoving;
return mt;
}
@ -1213,11 +1213,11 @@ void MotionTask::remove(int16 returnVal) {
if (nextMT == this)
nextMT = (MotionTask *)next();
object->objectFlags &= ~GameObject::objectMoving;
object->objectFlags &= ~objectMoving;
if (objObscured(object))
object->objectFlags |= GameObject::objectObscured;
object->objectFlags |= objectObscured;
else
object->objectFlags &= ~GameObject::objectObscured;
object->objectFlags &= ~objectObscured;
if (isActor(object)) {
Actor *a = (Actor *)object;
@ -4709,7 +4709,7 @@ bool MotionTask::freeFall(TilePoint &newPos, StandingTileInfo &sti) {
tHeight = tileSlopeHeight(newPos, object, &sti);
if (object->objectFlags & GameObject::objectFloating) return FALSE;
if (object->objectFlags & objectFloating) return FALSE;
velocity.u = (newPos.u - object->location.u) * 2 / 3;
velocity.v = (newPos.v - object->location.v) * 2 / 3;

View File

@ -2212,11 +2212,11 @@ void GameObject::evalEnchantments(void) {
}
}
#define noMergeFlags (GameObject::objectImportant|\
GameObject::objectGhosted|\
GameObject::objectInvisible|\
GameObject::objectFloating|\
GameObject::objectNoRecycle)
#define noMergeFlags (objectImportant|\
objectGhosted|\
objectInvisible|\
objectFloating|\
objectNoRecycle)
int32 GameObject::canStackOrMerge(GameObject *dropObj, GameObject *target) {
int32 cSet = dropObj->proto()->containmentSet();

View File

@ -96,7 +96,6 @@ void initActors(void);
void saveActors(SaveFileConstructor &);
void loadActors(SaveFileReader &);
void cleanupActors(void);
class GameObject {
friend void initWorlds(void);
@ -180,30 +179,6 @@ public:
uint8 reserved[ 2 ];
// 32 bytes
// If we had to add anything, it would be:
// thisID <-- id of this object
// prevSiblingID <-- id of previous sibling
enum objectFlags {
objectOpen = (1 << 0), // object is in the "open" state
objectLocked = (1 << 1), // object cannot be opened
objectImportant = (1 << 2), // object must be recycled when trashed
objectGhosted = (1 << 3), // object drawn translucent
objectInvisible = (1 << 4), // object cannot be seen
objectObscured = (1 << 5), // object obscured by terrain
objectMoving = (1 << 6), // object has attached motion task
objectScavengable = (1 << 7), // object can be deleted
objectFloating = (1 << 8), // object not affected by Gravity
objectNoRecycle = (1 << 9), // object is referred to by script, don't delete
objectActivated = (1 << 10), // object is activated
objectAlias = (1 << 11), // object is not real, just a copy of another object
objectTriggeringTAG = (1 << 12), // object has triggerred TAG upon which it rests
objectOnScreen = (1 << 13), // object is on display list
objectSightedByCenter = (1 << 14), // there is a line of sight to center actor
};
// Default constructor
GameObject(void);

View File

@ -1238,7 +1238,7 @@ bool PhysicalContainerProto::useAction(ObjectID dObj, ObjectID enactor) {
bool result;
GameObject *dObjPtr = GameObject::objectAddress(dObj);
if (dObjPtr->objectFlags & GameObject::objectOpen)
if (dObjPtr->objectFlags & objectOpen)
result = close(dObj, enactor);
else
result = open(dObj, enactor);
@ -1263,7 +1263,7 @@ bool PhysicalContainerProto::openAction(ObjectID dObj, ObjectID) {
cn = CreateContainerNode(dObj, FALSE);
cn->markForShow(); // Deferred open
dObjPtr->objectFlags |= GameObject::objectOpen; // Set open bit;
dObjPtr->objectFlags |= objectOpen; // Set open bit;
globalContainerList.setUpdate(dObjPtr->IDParent());
return TRUE;
}
@ -1279,7 +1279,7 @@ bool PhysicalContainerProto::closeAction(ObjectID dObj, ObjectID) {
cn->markForDelete();
// Clear open bit
dObjPtr->objectFlags &= ~GameObject::objectOpen;
dObjPtr->objectFlags &= ~objectOpen;
globalContainerList.setUpdate(dObjPtr->IDParent());
return TRUE;
}
@ -1301,7 +1301,7 @@ bool PhysicalContainerProto::acceptLockToggleAction(
GameObject *dObjPtr = GameObject::objectAddress(dObj);
// Toggle locked bit
dObjPtr->objectFlags ^= GameObject::objectLocked;
dObjPtr->objectFlags ^= objectLocked;
return TRUE;
}
@ -1319,7 +1319,7 @@ bool PhysicalContainerProto::acceptInsertionAction(
GameObject *itemPtr = GameObject::objectAddress(item);
// Place the object in the container (if possible)
if ((dObjPtr->objectFlags & GameObject::objectLocked)
if ((dObjPtr->objectFlags & objectLocked)
|| !dObjPtr->placeObject(enactor, item, TRUE, num)) {
if (isWorld(dObjPtr->IDParent()))
dObjPtr->dropInventoryObject(itemPtr, num);
@ -2986,7 +2986,7 @@ bool IntangibleContainerProto::useAction(ObjectID dObj, ObjectID enactor) {
bool result;
GameObject *dObjPtr = GameObject::objectAddress(dObj);
if (dObjPtr->objectFlags & GameObject::objectOpen)
if (dObjPtr->objectFlags & objectOpen)
result = close(dObj, enactor);
else
result = open(dObj, enactor);

View File

@ -645,7 +645,7 @@ int16 scriptActorSetImportant(int16 *args) {
OBJLOG(SetImportant);
((GameObject *)thisThread->thisObject)->setFlags(
args[0 ] ? (int16) 0xffff : (int16) 0,
GameObject::objectImportant);
objectImportant);
return 0;
}
@ -653,7 +653,7 @@ int16 scriptActorSetScavengable(int16 *args) {
OBJLOG(SetScavengable);
((GameObject *)thisThread->thisObject)->setFlags(
args[0 ] ? (int16) 0xffff : (int16) 0,
GameObject::objectScavengable);
objectScavengable);
return 0;
}