[Scummvm-git-logs] scummvm master -> 3a49501e20fb16e577ca7854027a221dcd919b78

sev- noreply at scummvm.org
Sun Sep 25 19:37:47 UTC 2022


This automated email contains information about 11 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
e281cde4b6 SAGA2: Use portable struct copying
ef106cf716 SAGA2: Reanme GameObj class members
40d9d2e9b9 SAGA2: Use class copy constuctor instead of memcpy()
2aefa6c30f SAGA2: Rename class members in contain.h
bdb5066b35 SAGA2: Rename class variables in dice.h
f0221d3b8a SAGA2: Renamed class variables in dispnode.h
8527a03f0a SAGA2: Rename class variables in document.h
fe4aca8cd2 SAGA2: Rename class variables in effect.h
5447e8ce5e SAGA2: Rename class variables in enchant.h
e424669f6d SAGA2: Fix class member names in floating.h
3a49501e20 SAGA2: Rename class variables in fta.h


Commit: e281cde4b6e2c12336219ea679cfbdd8916d94d7
    https://github.com/scummvm/scummvm/commit/e281cde4b6e2c12336219ea679cfbdd8916d94d7
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2022-09-25T21:37:26+02:00

Commit Message:
SAGA2: Use portable struct copying

Changed paths:
    engines/saga2/actor.cpp


diff --git a/engines/saga2/actor.cpp b/engines/saga2/actor.cpp
index 6b25e325962..7b7810f8fd2 100644
--- a/engines/saga2/actor.cpp
+++ b/engines/saga2/actor.cpp
@@ -1001,10 +1001,8 @@ void Actor::init(
 	_deactivationCounter = 0;
 	_assignment = nullptr;
 
-	memcpy(
-	    &_effectiveStats,
-	    &((ActorProto *)prototype)->baseStats,
-	    sizeof(_effectiveStats));
+	_effectiveStats = ((ActorProto *)prototype)->baseStats;
+
 	_effectiveStats.vitality = MAX<int16>(_effectiveStats.vitality, 1);
 
 	_actionCounter       = 0;


Commit: ef106cf7165952338ce355e9db450b8eb7408074
    https://github.com/scummvm/scummvm/commit/ef106cf7165952338ce355e9db450b8eb7408074
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2022-09-25T21:37:26+02:00

Commit Message:
SAGA2: Reanme GameObj class members

Changed paths:
    engines/saga2/actor.cpp
    engines/saga2/objects.cpp
    engines/saga2/objects.h


diff --git a/engines/saga2/actor.cpp b/engines/saga2/actor.cpp
index 7b7810f8fd2..3378b6119c7 100644
--- a/engines/saga2/actor.cpp
+++ b/engines/saga2/actor.cpp
@@ -942,7 +942,7 @@ void Actor::init(
 	debugC(1, kDebugActors, "Actor init flags: %d, permanent: %d", initFlags, initFlags & actorPermanent);
 
 	//  Fixup the prototype pointer to point to an actor prototype
-	prototype           = (ProtoObj *)g_vm->_actorProtos[protoIndex];
+	_prototype           = (ProtoObj *)g_vm->_actorProtos[protoIndex];
 
 	//  Initialize object fields
 //	nameIndex = 0;
@@ -1001,7 +1001,7 @@ void Actor::init(
 	_deactivationCounter = 0;
 	_assignment = nullptr;
 
-	_effectiveStats = ((ActorProto *)prototype)->baseStats;
+	_effectiveStats = ((ActorProto *)_prototype)->baseStats;
 
 	_effectiveStats.vitality = MAX<int16>(_effectiveStats.vitality, 1);
 
@@ -1026,7 +1026,7 @@ void Actor::init(
 //  Actor constructor -- copies the resource fields and simply NULL's most
 //	of the rest of the data members
 Actor::Actor() {
-	prototype = nullptr;
+	_prototype = nullptr;
 	_faction             = 0;
 	_colorScheme         = 0;
 	_appearanceID        = 0;
@@ -1093,7 +1093,7 @@ Actor::Actor() {
 
 Actor::Actor(const ResourceActor &res) : GameObject(res) {
 	//  Fixup the prototype pointer to point to an actor prototype
-	prototype   =   prototype != nullptr
+	_prototype  =   _prototype != nullptr
 	                ? (ProtoObj *)g_vm->_actorProtos[getProtoNum()]
 	                :   nullptr;
 
@@ -1140,8 +1140,8 @@ Actor::Actor(const ResourceActor &res) : GameObject(res) {
 	_deactivationCounter = 0;
 	_assignment = nullptr;
 
-	if (prototype)
-		memcpy(&_effectiveStats, &((ActorProto *)prototype)->baseStats, sizeof(_effectiveStats));
+	if (_prototype)
+		memcpy(&_effectiveStats, &((ActorProto *)_prototype)->baseStats, sizeof(_effectiveStats));
 
 	_effectiveStats.vitality = MAX<uint16>(_effectiveStats.vitality, 1);
 
@@ -1166,7 +1166,7 @@ Actor::Actor(const ResourceActor &res) : GameObject(res) {
 
 Actor::Actor(Common::InSaveFile *in) : GameObject(in) {
 	//  Fixup the prototype pointer to point to an actor prototype
-	prototype   =   prototype != nullptr
+	_prototype   =   _prototype != nullptr
 	                ? (ProtoObj *)g_vm->_actorProtos[getProtoNum()]
 	                :   nullptr;
 
@@ -1297,19 +1297,19 @@ int32 Actor::archiveSize() {
 }
 
 void Actor::write(Common::MemoryWriteStreamDynamic *out) {
-	ProtoObj    *holdProto = prototype;
+	ProtoObj    *holdProto = _prototype;
 
 	debugC(3, kDebugSaveload, "Saving actor %d", thisID());
 
 	//  Modify the protoype temporarily so the GameObject::write()
 	//  will store the index correctly
-	if (prototype != nullptr)
-		prototype = g_vm->_objectProtos[getProtoNum()];
+	if (_prototype != nullptr)
+		_prototype = g_vm->_objectProtos[getProtoNum()];
 
 	GameObject::write(out, false);
 
 	//  Restore the prototype pointer
-	prototype = holdProto;
+	_prototype = holdProto;
 
 	out->writeByte(_faction);
 	out->writeByte(_colorScheme);
@@ -1723,7 +1723,7 @@ void Actor::lobotomize() {
 
 ActorAttributes *Actor::getBaseStats() {
 	if (_disposition < dispositionPlayer)
-		return &((ActorProto *)prototype)->baseStats;
+		return &((ActorProto *)_prototype)->baseStats;
 	else
 		return &g_vm->_playerList[_disposition - dispositionPlayer]->baseStats;
 }
@@ -1734,7 +1734,7 @@ ActorAttributes *Actor::getBaseStats() {
 
 uint32 Actor::getBaseEnchantmentEffects() {
 	//if ( disposition < dispositionPlayer )
-	return ((ActorProto *)prototype)->baseEffectFlags;
+	return ((ActorProto *)_prototype)->baseEffectFlags;
 }
 
 //-----------------------------------------------------------------------
@@ -1743,7 +1743,7 @@ uint32 Actor::getBaseEnchantmentEffects() {
 
 uint16 Actor::getBaseResistance() {
 	//if ( disposition < dispositionPlayer )
-	return ((ActorProto *)prototype)->resistance;
+	return ((ActorProto *)_prototype)->resistance;
 }
 
 //-----------------------------------------------------------------------
@@ -1752,7 +1752,7 @@ uint16 Actor::getBaseResistance() {
 
 uint16 Actor::getBaseImmunity() {
 	//if ( disposition < dispositionPlayer )
-	return ((ActorProto *)prototype)->immunity;
+	return ((ActorProto *)_prototype)->immunity;
 }
 
 //-----------------------------------------------------------------------
@@ -2736,7 +2736,7 @@ void Actor::handleOffensiveAct(Actor *attacker) {
 //	damage.
 
 void Actor::handleDamageTaken(uint8 damage) {
-	uint8       combatBehavior = ((ActorProto *)prototype)->combatBehavior;
+	uint8       combatBehavior = ((ActorProto *)_prototype)->combatBehavior;
 
 	if (combatBehavior == behaviorHungry) return;
 
@@ -3045,7 +3045,7 @@ void Actor::removeFollower(Actor *bandMember) {
 
 		for (i = 0; i < _followers->size(); i++) {
 			Actor       *follower = (*_followers)[i];
-			ActorProto  *proto = (ActorProto *)follower->prototype;
+			ActorProto  *proto = (ActorProto *)follower->_prototype;
 			uint8       combatBehavior = proto->combatBehavior;
 
 			if (follower->_currentGoal == actorGoalAttackEnemy
diff --git a/engines/saga2/objects.cpp b/engines/saga2/objects.cpp
index 76c17f685e2..1b132ec3c37 100644
--- a/engines/saga2/objects.cpp
+++ b/engines/saga2/objects.cpp
@@ -180,7 +180,7 @@ struct GameObjectArchive {
 //	Default constructor
 
 GameObject::GameObject() {
-	prototype   = nullptr;
+	_prototype   = nullptr;
 	_data.projectDummy = 0;
 	_data.location    = Nowhere;
 	_data.nameIndex   = 0;
@@ -207,7 +207,7 @@ GameObject::GameObject() {
 //	Constructor -- initial object construction
 
 GameObject::GameObject(const ResourceGameObject &res) {
-	prototype           = g_vm->_objectProtos[res.protoIndex];
+	_prototype           = g_vm->_objectProtos[res.protoIndex];
 	_data.projectDummy = 0;
 	_data.location            = res.location;
 	_data.nameIndex           = res.nameIndex;
@@ -217,8 +217,8 @@ GameObject::GameObject(const ResourceGameObject &res) {
 	_data.script              = res.script;
 	_data.objectFlags         = res.objectFlags;
 	_data.hitPoints           = res.hitPoints;
-	_data.bParam              = prototype->getChargeType() ? prototype->maxCharges : 0;
-	_data.massCount           = res.misc; //prototype->getInitialItemCount();
+	_data.bParam              = _prototype->getChargeType() ? _prototype->maxCharges : 0;
+	_data.massCount           = res.misc; //_prototype->getInitialItemCount();
 	_data.missileFacing       = missileRt;
 	_data.currentTAG          = NoActiveItem;
 	_data.sightCtr            = 0;
@@ -241,7 +241,7 @@ void GameObject::read(Common::InSaveFile *in, bool expandProto) {
 	if (expandProto)
 		in->readSint16LE();
 	//  Convert the protoype index into an object proto pointer
-	prototype = pInd != -1
+	_prototype = pInd != -1
 	            ?   g_vm->_objectProtos[pInd]
 	            :   nullptr;
 
@@ -291,7 +291,7 @@ int32 GameObject::archiveSize() {
 void GameObject::write(Common::MemoryWriteStreamDynamic *out, bool expandProto) {
 	debugC(2, kDebugSaveload, "Saving object %d", thisID());
 
-	int16 pInd = prototype != nullptr ? getProtoNum() : -1;
+	int16 pInd = _prototype != nullptr ? getProtoNum() : -1;
 	out->writeSint16LE(pInd);
 	if (expandProto)
 		out->writeSint16LE(0);
@@ -385,7 +385,7 @@ GameObject *GameObject::objectAddress(ObjectID id) {
 ProtoObj *GameObject::protoAddress(ObjectID id) {
 	GameObject      *obj = objectAddress(id);
 
-	return obj ? obj->prototype : nullptr ;
+	return obj ? obj-> _prototype : nullptr ;
 }
 
 int32 GameObject::nameIndexToID(uint16 ind) {
@@ -393,7 +393,7 @@ int32 GameObject::nameIndexToID(uint16 ind) {
 		if (objectList[i]._data.nameIndex == ind)
 			return objectList[i].thisID();
 
-		if (objectList[i].prototype && objectList[i].prototype->nameIndex == ind)
+		if (objectList[i]._prototype && objectList[i]._prototype->nameIndex == ind)
 			return objectList[i].thisID();
 	}
 
@@ -401,7 +401,7 @@ int32 GameObject::nameIndexToID(uint16 ind) {
 		if (g_vm->_act->_actorList[i]->_data.nameIndex == ind)
 			return g_vm->_act->_actorList[i]->thisID();
 
-		if (g_vm->_act->_actorList[i]->prototype && g_vm->_act->_actorList[i]->prototype->nameIndex == ind)
+		if (g_vm->_act->_actorList[i]-> _prototype && g_vm->_act->_actorList[i]->_prototype->nameIndex == ind)
 			return g_vm->_act->_actorList[i]->thisID();
 	}
 
@@ -409,7 +409,7 @@ int32 GameObject::nameIndexToID(uint16 ind) {
 		if (worldList[i]._data.nameIndex == ind)
 			return worldList[i].thisID();
 
-		if (worldList[i].prototype && worldList[i].prototype->nameIndex == ind)
+		if (worldList[i]._prototype && worldList[i]._prototype->nameIndex == ind)
 			return worldList[i].thisID();
 	}
 
@@ -446,7 +446,7 @@ Common::Array<ObjectID> GameObject::nameToID(Common::String name) {
 
 
 uint16 GameObject::containmentSet() {
-	return  prototype->containmentSet();
+	return  _prototype->containmentSet();
 }
 
 //  Calculates the ID of an object, given it's (implicit) address
@@ -564,13 +564,13 @@ ObjectID GameObject::possessor() {
 bool GameObject::getWorldLocation(Location &loc) {
 	GameObject      *obj = this;
 	ObjectID        id;
-	uint8           objHeight = prototype->height;
+	uint8           objHeight = _prototype->height;
 
 	for (;;) {
 		id = obj->_data.parentID;
 		if (isWorld(id)) {
 			loc = obj->_data.location;
-			loc.z += (obj->prototype->height - objHeight) / 2;
+			loc.z += (obj->_prototype->height - objHeight) / 2;
 			loc.context = id;
 			return true;
 		} else if (id == Nothing) {
@@ -590,14 +590,14 @@ Location GameObject::notGetLocation() {
 Location GameObject::notGetWorldLocation() {
 	GameObject      *obj = this;
 	ObjectID        id;
-	uint8           objHeight = prototype->height;
+	uint8           objHeight = _prototype->height;
 
 	for (;;) {
 		id = obj->_data.parentID;
 		if (isWorld(id)) {
 			TilePoint       loc = obj->_data.location;
 
-			loc.z += (obj->prototype->height - objHeight) / 2;
+			loc.z += (obj->_prototype->height - objHeight) / 2;
 			return Location(loc, obj->_data.parentID);
 		} else if (id == Nothing) return Location(Nowhere, Nothing);
 
@@ -616,10 +616,10 @@ void GameObject::objCursorText(char nameBuf[], const int8 size, int16 count) {
 
 	// check to see if this item is a physical object
 	// if so, then give the count of the item ( if stacked )
-	if (prototype->containmentSet() & ProtoObj::isTangible) {
+	if (_prototype->containmentSet() & ProtoObj::isTangible) {
 		// display charges if item is a chargeable item
-		if (prototype->chargeType != 0
-		        &&  prototype->maxCharges != Permanent
+		if (_prototype->chargeType != 0
+		        &&  _prototype->maxCharges != Permanent
 		        &&  _data.bParam != Permanent) {
 			uint16 charges = _data.bParam;
 
@@ -630,7 +630,7 @@ void GameObject::objCursorText(char nameBuf[], const int8 size, int16 count) {
 			}
 		}
 
-		if (prototype->flags & ResourceObjectPrototype::objPropMergeable) {
+		if (_prototype->flags & ResourceObjectPrototype::objPropMergeable) {
 			// make a buffer that contains the name of
 			// the object and it's count
 			// add only if a mergable item
@@ -649,7 +649,7 @@ void GameObject::objCursorText(char nameBuf[], const int8 size, int16 count) {
 		int16 manaCost = 0;
 
 		// figure out if it's a skill or spell
-		if (prototype->containmentSet() & (ProtoObj::isSkill | ProtoObj::isSpell)) {
+		if (_prototype->containmentSet() & (ProtoObj::isSkill | ProtoObj::isSpell)) {
 			// get skill proto for this spell or skill
 			SkillProto *sProto = skillProtoFromID(thisID());
 
@@ -698,7 +698,7 @@ void GameObject::objCursorText(char nameBuf[], const int8 size, int16 count) {
 
 bool GameObject::isTrueSkill() {
 	// figure out if it's a skill or spell
-	if (prototype->containmentSet() & (ProtoObj::isSkill | ProtoObj::isSpell)) {
+	if (_prototype->containmentSet() & (ProtoObj::isSkill | ProtoObj::isSpell)) {
 		// get skill proto for this spell or skill
 		SkillProto *sProto = skillProtoFromID(thisID());
 
@@ -715,14 +715,14 @@ bool GameObject::isTrueSkill() {
 TilePoint GameObject::getWorldLocation() {
 	GameObject      *obj = this;
 	ObjectID        id;
-	uint8           objHeight = prototype->height;
+	uint8           objHeight = _prototype->height;
 
 	for (;;) {
 		id = obj->_data.parentID;
 		if (isWorld(id)) {
 			TilePoint       loc = obj->_data.location;
 
-			loc.z += (obj->prototype->height - objHeight) / 2;
+			loc.z += (obj->_prototype->height - objHeight) / 2;
 			return loc;
 		} else if (id == Nothing) return Nowhere;
 
@@ -766,7 +766,7 @@ int32 GameObject::getSprOffset(int16 num) {
 	}
 
 	// if this is a mergeable object
-	if (prototype->flags & ResourceObjectPrototype::objPropMergeable) {
+	if (_prototype->flags & ResourceObjectPrototype::objPropMergeable) {
 		if (units >= spriteNumFew) {
 			value = 1;
 		}
@@ -797,8 +797,8 @@ bool GameObject::unstack() {
 	        ||  isWorld(parent())
 	        ||  IDParent() == Nothing
 	        ||  _data.location.z == 1
-	        ||  prototype == nullptr
-	        || (prototype->containmentSet() & ProtoObj::isIntangible)) return false;
+	        ||  _prototype == nullptr
+	        || (_prototype->containmentSet() & ProtoObj::isIntangible)) return false;
 
 	ContainerIterator   iter(parent());
 
@@ -808,7 +808,7 @@ bool GameObject::unstack() {
 	while (iter.next(&item) != Nothing) {
 		if (item->_data.location.u == _data.location.u
 		        &&  item->_data.location.v == _data.location.v
-		        &&  item->prototype  == prototype) {
+		        &&  item-> _prototype  == _prototype) {
 			count++;
 			if (item->_data.location.z != 0) base = item;
 			else zero = item;
@@ -916,9 +916,9 @@ void GameObject::move(const Location &location, int16 num) {
 
 
 int16 GameObject::getChargeType() {
-	assert(prototype);
+	assert(_prototype);
 
-	return prototype->getChargeType();
+	return _prototype->getChargeType();
 }
 
 // this function recharges an object
@@ -1089,7 +1089,7 @@ ObjectID GameObject::extractMerged(const Location &loc, int16 num) {
 
 	// determine whether this object can be merged
 	// with duplicates of it's kind
-	if (prototype->flags & ResourceObjectPrototype::objPropMergeable) {
+	if (_prototype->flags & ResourceObjectPrototype::objPropMergeable) {
 		// get the number requested or all that's there...
 		int16 moveCount = MIN<uint16>(num, _data.massCount);
 
@@ -1117,7 +1117,7 @@ GameObject *GameObject::extractMerged(int16 num) {
 
 	// determine whether this object can be merged
 	// with duplicates of it's kind
-	if (prototype->flags & ResourceObjectPrototype::objPropMergeable) {
+	if (_prototype->flags & ResourceObjectPrototype::objPropMergeable) {
 		Location    loc(0, 0, 0, 0);
 
 		// get the number requested or all that's there...
@@ -1182,7 +1182,7 @@ ObjectID GameObject::copy(const Location &l) {
 	} else {
 		if ((newObj = newObject()) == nullptr) return Nothing;
 
-		newObj->prototype   = prototype;
+		newObj->_prototype   = _prototype;
 		newObj->_data.nameIndex   = _data.nameIndex;
 		newObj->_data.script      = _data.script;
 		newObj->_data.objectFlags = _data.objectFlags;
@@ -1210,7 +1210,7 @@ ObjectID GameObject::copy(const Location &l, int16 num) {
 		if ((newObj = newObject()) == nullptr) return Nothing;
 
 
-		newObj->prototype   = prototype;
+		newObj-> _prototype   = _prototype;
 		newObj->_data.nameIndex   = _data.nameIndex;
 		newObj->_data.script      = _data.script;
 		newObj->_data.objectFlags = _data.objectFlags;
@@ -1270,7 +1270,7 @@ GameObject *GameObject::newObject() {   // get a newly created object
 	}
 
 	obj->remove();
-	obj->prototype      = nullptr;
+	obj-> _prototype      = nullptr;
 	obj->_data.nameIndex      = 0;
 	obj->_data.script         = 0;
 	obj->_data.objectFlags    = 0;
@@ -1354,7 +1354,7 @@ void GameObject::deleteObjectRecursive() {
 	//  If this is an important object let's not delete it but try to drop
 	//  it on the ground instead.
 	if (isImportant()) {
-		assert((prototype->containmentSet() & ProtoObj::isTangible) != 0);
+		assert((_prototype->containmentSet() & ProtoObj::isTangible) != 0);
 
 		//  If the object is already in a world there's nothing to do.
 		if (isWorld(_data.parentID))
@@ -1503,7 +1503,7 @@ void GameObject::updateState() {
 
 	tHeight = tileSlopeHeight(_data.location, this, &sti);
 
-	if (!(_data.location.z >= 0 || prototype->height > 8 - _data.location.z))
+	if (!(_data.location.z >= 0 || _prototype->height > 8 - _data.location.z))
 		drown(this);
 
 	TilePoint subTile((_data.location.u >> kSubTileShift) & kSubTileMask,
@@ -1564,8 +1564,8 @@ TilePoint GameObject::getFirstEmptySlot(GameObject *obj) {
 	ObjectID        objID;
 	GameObject      *item = nullptr;
 	TilePoint       newLoc, temp;
-	uint16          numRows = prototype->getMaxRows(),
-	                numCols = prototype->getMaxCols();
+	uint16          numRows = _prototype->getMaxRows(),
+	                numCols = _prototype->getMaxCols();
 	ProtoObj        *mObjProto = obj->proto();
 	bool            objIsEnchantment = (mObjProto->containmentSet() & INTANGIBLE_MASK);
 	bool            isReadyCont = isActor(this);
@@ -1629,7 +1629,7 @@ bool GameObject::getAvailableSlot(
 	assert(tp != nullptr);
 	assert(!canMerge || mergeObj != nullptr);
 
-	if (prototype == nullptr) return false;
+	if (_prototype == nullptr) return false;
 
 	ProtoObj        *objProto = obj->proto();
 
@@ -1649,7 +1649,7 @@ bool GameObject::getAvailableSlot(
 
 	//  Only actors or containers may contain other objects
 	if (isActor(this)
-	        || (prototype->containmentSet() & ProtoObj::isContainer)) {
+	        || (_prototype->containmentSet() & ProtoObj::isContainer)) {
 		TilePoint       firstEmptySlot;
 
 		if (canMerge) {
@@ -1713,7 +1713,7 @@ void GameObject::dropInventoryObject(GameObject *obj, int16 count) {
 	int16           dist;
 	int16           mapNum = getMapNum();
 
-	dist = prototype->crossSection + obj->proto()->crossSection;
+	dist = _prototype->crossSection + obj->proto()->crossSection;
 
 	//  Iterate until the object is placed
 	for (;;) {
@@ -1779,13 +1779,13 @@ GameObject *GameObject::getIntangibleContainer(int containerType) {
 //	Generic range checking function
 
 bool GameObject::inRange(const TilePoint &tp, uint16 range) {
-	uint8       crossSection = prototype->crossSection;
+	uint8       crossSection = _prototype->crossSection;
 	TilePoint   loc = getLocation();
 
 	loc =   TilePoint(
 	            clamp(loc.u - crossSection, tp.u, loc.u + crossSection),
 	            clamp(loc.v - crossSection, tp.v, loc.v + crossSection),
-	            clamp(loc.z, tp.z, loc.z + prototype->height));
+	            clamp(loc.z, tp.z, loc.z + _prototype->height));
 
 	TilePoint   vector = tp - loc;
 
@@ -2203,12 +2203,12 @@ bool GameObject::canSenseObjectProperty(
 
 int32 GameObject::getProtoNum() {
 	for (uint i = 0; i < g_vm->_actorProtos.size(); ++i) {
-		if (prototype == g_vm->_actorProtos[i])
+		if (_prototype == g_vm->_actorProtos[i])
 			return i;
 	}
 
 	for (uint i = 0; i < g_vm->_objectProtos.size(); ++i) {
-		if (prototype == g_vm->_objectProtos[i])
+		if (_prototype == g_vm->_objectProtos[i])
 			return i;
 	}
 
@@ -2220,12 +2220,12 @@ int32 GameObject::getProtoNum() {
 
 void GameObject::setProtoNum(int32 nProto) {
 	if (isActor(this))
-		prototype = g_vm->_actorProtos[nProto];
+		_prototype = g_vm->_actorProtos[nProto];
 	else {
 		ObjectID    oldParentID = _data.parentID;
 		bool        wasStacked = unstack(); //  Unstack if it was in a stack
 
-		prototype = g_vm->_objectProtos[nProto];
+		_prototype = g_vm->_objectProtos[nProto];
 
 		if (wasStacked) {
 			ObjectID    pos = possessor();
@@ -2362,7 +2362,7 @@ uint16 GameObject::totalContainedMass() {
 		if (!(childObj->containmentSet() & ProtoObj::isTangible))
 			continue;
 
-		objMass = childObj->prototype->mass;
+		objMass = childObj->_prototype->mass;
 		if (childObj->isMergeable())
 			objMass *= childObj->getExtra();
 		total += objMass;
@@ -2388,7 +2388,7 @@ uint16 GameObject::totalContainedBulk() {
 		if (!(childObj->containmentSet() & ProtoObj::isTangible))
 			continue;
 
-		objBulk = childObj->prototype->bulk;
+		objBulk = childObj->_prototype->bulk;
 		if (childObj->isMergeable())
 			objBulk *= childObj->getExtra();
 		total += objBulk;
diff --git a/engines/saga2/objects.h b/engines/saga2/objects.h
index e595018a4db..95ecd93ce62 100644
--- a/engines/saga2/objects.h
+++ b/engines/saga2/objects.h
@@ -169,7 +169,7 @@ protected:
 	void append(ObjectID newParent);         // adds to new list (no remove)
 	void insert(ObjectID newPrev);           // inserts after this item (no remove)
 
-	ProtoObj        *prototype;             // object that defines our behavior
+	ProtoObj        *_prototype;             // object that defines our behavior
 public:
 	ObjectData _data;
 	uint _index;
@@ -303,7 +303,7 @@ public:
 
 	//  check to see if item can be contained by this object
 	bool canContain(ObjectID item) {
-		return prototype->canContain(thisID(), item);
+		return _prototype->canContain(thisID(), item);
 	}
 
 	//  check to see if item is contained by the object
@@ -346,58 +346,58 @@ public:
 
 	//  generic actions
 	bool use(ObjectID enactor) {
-		return prototype->use(thisID(), enactor);
+		return _prototype->use(thisID(), enactor);
 	}
 	bool useOn(ObjectID enactor, ObjectID item) {
-		return prototype->useOn(thisID(), enactor, item);
+		return _prototype->useOn(thisID(), enactor, item);
 	}
 
 	bool useOn(ObjectID enactor, ActiveItem *item) {
-		return prototype->useOn(thisID(), enactor, item);
+		return _prototype->useOn(thisID(), enactor, item);
 	}
 
 	bool useOn(ObjectID enactor, Location &loc) {
-		return prototype->useOn(thisID(), enactor, loc);
+		return _prototype->useOn(thisID(), enactor, loc);
 	}
 
 	//  various verb actions that can take place
 	bool take(ObjectID enactor, int16 num = 1) {
-		return prototype->take(thisID(), enactor, num);
+		return _prototype->take(thisID(), enactor, num);
 	}
 	bool drop(ObjectID enactor, const Location &l, int16 num = 1) {
-		return prototype->drop(thisID(), enactor, l, num);
+		return _prototype->drop(thisID(), enactor, l, num);
 	}
 	//  drop an object onto another object and handle the result.
 	bool dropOn(ObjectID enactor, ObjectID target, int16 num = 1) {
-		return prototype->dropOn(thisID(), enactor, target, num);
+		return _prototype->dropOn(thisID(), enactor, target, num);
 	}
 	//  drop this object on a TAG
 	bool dropOn(ObjectID enactor, ActiveItem *target, const Location &loc, int16 num = 1) {
-		return prototype->dropOn(thisID(), enactor, target, loc, num);
+		return _prototype->dropOn(thisID(), enactor, target, loc, num);
 	}
 	bool open(ObjectID enactor) {
-		return prototype->open(thisID(), enactor);
+		return _prototype->open(thisID(), enactor);
 	}
 	bool close(ObjectID enactor) {
-		return prototype->close(thisID(), enactor);
+		return _prototype->close(thisID(), enactor);
 	}
 	bool strike(ObjectID enactor, ObjectID item) {
-		return prototype->strike(thisID(), enactor, item);
+		return _prototype->strike(thisID(), enactor, item);
 	}
 	bool damage(ObjectID enactor, ObjectID target) {
-		return prototype->damage(thisID(), enactor, target);
+		return _prototype->damage(thisID(), enactor, target);
 	}
 	bool eat(ObjectID enactor) {
-		return prototype->eat(thisID(), enactor);
+		return _prototype->eat(thisID(), enactor);
 	}
 	bool insert(ObjectID enactor, ObjectID item) {
-		return prototype->insert(thisID(), enactor, item);
+		return _prototype->insert(thisID(), enactor, item);
 	}
 	bool remove(ObjectID enactor) {
-		return prototype->remove(thisID(), enactor);
+		return _prototype->remove(thisID(), enactor);
 	}
 	bool acceptDrop(ObjectID enactor, ObjectID droppedObj, int count) {
-		return prototype->acceptDrop(thisID(), enactor, droppedObj, count);
+		return _prototype->acceptDrop(thisID(), enactor, droppedObj, count);
 	}
 	bool acceptDamage(
 	    ObjectID            enactor,
@@ -409,7 +409,7 @@ public:
 		if (_godmode)
 			return false;
 
-		return  prototype->acceptDamage(
+		return  _prototype->acceptDamage(
 		            thisID(),
 		            enactor,
 		            absDamage,
@@ -419,29 +419,29 @@ public:
 		            perDieMod);
 	}
 	bool acceptHealing(ObjectID enactor, int8 absDamage, int8 dice = 0, uint8 sides = 1, int8 perDieMod = 0) {
-		return prototype->acceptHealing(thisID(), enactor, absDamage, dice, sides, perDieMod);
+		return _prototype->acceptHealing(thisID(), enactor, absDamage, dice, sides, perDieMod);
 	}
 	bool acceptStrike(
 	    ObjectID            enactor,
 	    ObjectID            strikingObj,
 	    uint8               skillIndex) {
-		return  prototype->acceptStrike(
+		return  _prototype->acceptStrike(
 		            thisID(),
 		            enactor,
 		            strikingObj,
 		            skillIndex);
 	}
 	bool acceptLockToggle(ObjectID enactor, uint8 keyCode) {
-		return prototype->acceptLockToggle(thisID(), enactor, keyCode);
+		return _prototype->acceptLockToggle(thisID(), enactor, keyCode);
 	}
 	bool acceptMix(ObjectID enactor, ObjectID mixObj) {
-		return prototype->acceptMix(thisID(), enactor, mixObj);
+		return _prototype->acceptMix(thisID(), enactor, mixObj);
 	}
 	bool acceptInsertion(ObjectID enactor, ObjectID item, int16 count) {
-		return prototype->acceptInsertion(thisID(), enactor, item, count);
+		return _prototype->acceptInsertion(thisID(), enactor, item, count);
 	}
 	bool acceptInsertionAt(ObjectID enactor, ObjectID item, const TilePoint &where, int16 num = 1) {
-		return prototype->acceptInsertionAt(thisID(), enactor, item, where, num);
+		return _prototype->acceptInsertionAt(thisID(), enactor, item, where, num);
 	}
 
 	//  query functions:
@@ -449,7 +449,7 @@ public:
 
 	//  Access functions
 	ProtoObj *proto() {
-		return prototype;
+		return _prototype;
 	}
 	TilePoint getLocation() const {
 		return _data.location;
@@ -463,8 +463,8 @@ public:
 	const char *objName() {
 		if (_data.nameIndex > 0)
 			return nameText((int16)_data.nameIndex);
-		else if (prototype)
-			return nameText((int16)prototype->nameIndex);
+		else if (_prototype)
+			return nameText((int16)_prototype->nameIndex);
 
 		return nameText(0);
 	}
@@ -485,7 +485,7 @@ public:
 
 	//  Return the name of this type of object
 	const char *protoName() {
-		return nameText(prototype->nameIndex);
+		return nameText(_prototype->nameIndex);
 	}
 
 	//  Update the state of this object.  This function is called every
@@ -504,11 +504,11 @@ public:
 	}
 	bool isGhosted() {
 		return (_data.objectFlags & objectGhosted)
-		       || (prototype->flags & ResourceObjectPrototype::objPropGhosted);
+		       || (_prototype->flags & ResourceObjectPrototype::objPropGhosted);
 	}
 	bool isInvisible() {
 		return (_data.objectFlags & objectInvisible)
-		       || (prototype->flags & ResourceObjectPrototype::objPropHidden);
+		       || (_prototype->flags & ResourceObjectPrototype::objPropHidden);
 	}
 	bool isMoving() {
 		return (int16)(_data.objectFlags & objectMoving);
@@ -568,7 +568,7 @@ public:
 	}
 
 	bool isMissile() {
-		return prototype->isMissile();
+		return _prototype->isMissile();
 	}
 
 	// image data
@@ -581,8 +581,8 @@ public:
 	uint16 scriptClass() {
 		if (_data.script)
 			return _data.script;
-		if (prototype)
-			return prototype->script;
+		if (_prototype)
+			return _prototype->script;
 		return 0;
 	}
 
@@ -614,7 +614,7 @@ public:
 	//  Builds the color remapping for this object based on the
 	//  prototype's color map
 	void getColorTranslation(ColorTable map) {
-		prototype->getColorTranslation(map);
+		_prototype->getColorTranslation(map);
 	}
 
 	//  Functions to get and set prototype (used by scripts)
@@ -633,7 +633,7 @@ public:
 	void evalEnchantments();
 
 	bool makeSavingThrow() {
-		return prototype->makeSavingThrow();
+		return _prototype->makeSavingThrow();
 	}
 
 	//  Generic range checking function
@@ -641,11 +641,11 @@ public:
 
 	//  Generic function to test if object can be picked up
 	bool isCarryable() {
-		return prototype->mass <= 200 && prototype->bulk <= 200;
+		return _prototype->mass <= 200 && _prototype->bulk <= 200;
 	}
 
 	bool isMergeable() {
-		return (prototype->flags & ResourceObjectPrototype::objPropMergeable) != 0;
+		return (_prototype->flags & ResourceObjectPrototype::objPropMergeable) != 0;
 	}
 
 	//  A timer for this object has ticked
@@ -705,28 +705,28 @@ public:
 	bool stack(ObjectID enactor, ObjectID objToStackID);
 
 	bool canFitBulkwise(GameObject *obj) {
-		return prototype->canFitBulkwise(this, obj);
+		return _prototype->canFitBulkwise(this, obj);
 	}
 	bool canFitMasswise(GameObject *obj) {
-		return prototype->canFitMasswise(this, obj);
+		return _prototype->canFitMasswise(this, obj);
 	}
 
 	uint16 totalContainedMass();
 	uint16 totalContainedBulk();
 
 	uint16 totalMass() {
-		return      prototype->mass * (isMergeable() ? getExtra() : 1)
+		return      _prototype->mass * (isMergeable() ? getExtra() : 1)
 		            +   totalContainedMass();
 	}
 	uint16 totalBulk() {
-		return prototype->bulk * (isMergeable() ? getExtra() : 1);
+		return _prototype->bulk * (isMergeable() ? getExtra() : 1);
 	}
 
 	uint16 massCapacity() {
-		return prototype->massCapacity(this);
+		return _prototype->massCapacity(this);
 	}
 	uint16 bulkCapacity() {
-		return prototype->bulkCapacity(this);
+		return _prototype->bulkCapacity(this);
 	}
 };
 


Commit: 40d9d2e9b9e91362bbdbace20bc9e1f1a12bece2
    https://github.com/scummvm/scummvm/commit/40d9d2e9b9e91362bbdbace20bc9e1f1a12bece2
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2022-09-25T21:37:26+02:00

Commit Message:
SAGA2: Use class copy constuctor instead of memcpy()

Changed paths:
    engines/saga2/actor.cpp


diff --git a/engines/saga2/actor.cpp b/engines/saga2/actor.cpp
index 3378b6119c7..fa2ec9551cc 100644
--- a/engines/saga2/actor.cpp
+++ b/engines/saga2/actor.cpp
@@ -1141,7 +1141,7 @@ Actor::Actor(const ResourceActor &res) : GameObject(res) {
 	_assignment = nullptr;
 
 	if (_prototype)
-		memcpy(&_effectiveStats, &((ActorProto *)_prototype)->baseStats, sizeof(_effectiveStats));
+		_effectiveStats = ((ActorProto *)_prototype)->baseStats;
 
 	_effectiveStats.vitality = MAX<uint16>(_effectiveStats.vitality, 1);
 


Commit: 2aefa6c30fad947d1fd71ac6e658801d1e6a17a3
    https://github.com/scummvm/scummvm/commit/2aefa6c30fad947d1fd71ac6e658801d1e6a17a3
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2022-09-25T21:37:26+02:00

Commit Message:
SAGA2: Rename class members in contain.h

Changed paths:
    engines/saga2/contain.cpp
    engines/saga2/contain.h
    engines/saga2/objects.cpp


diff --git a/engines/saga2/contain.cpp b/engines/saga2/contain.cpp
index 2b382ae6736..d68d7ec0c20 100644
--- a/engines/saga2/contain.cpp
+++ b/engines/saga2/contain.cpp
@@ -212,18 +212,18 @@ ContainerView::ContainerView(
     const ContainerAppearanceDef &app,
     AppFunc         *cmd)
 	: gControl(list, rect, nullptr, 0, cmd),
-	  iconOrigin(app.iconOrigin),
-	  iconSpacing(app.iconSpacing),
-	  visibleRows(app.rows),
-	  visibleCols(app.cols),
-	  node(nd) {
-	containerObject = GameObject::objectAddress(nd.object);
-	scrollPosition  = 0;
-	totalRows       = app.totRows;
+	  _iconOrigin(app.iconOrigin),
+	  _iconSpacing(app.iconSpacing),
+	  _visibleRows(app.rows),
+	  _visibleCols(app.cols),
+	  _node(nd) {
+	_containerObject = GameObject::objectAddress(nd._object);
+	_scrollPosition  = 0;
+	_totalRows       = app.totRows;
 	setMousePoll(true);
-	totalMass = 0;
-	totalBulk = 0;
-	numObjects = 0;
+	_totalMass = 0;
+	_totalBulk = 0;
+	_numObjects = 0;
 }
 
 //  Destructor
@@ -250,13 +250,13 @@ void ContainerView::totalObjects() {
 	ObjectID objID;
 	GameObject *item = nullptr;
 
-	totalMass   = 0;
-	totalBulk   = 0;
-	numObjects  = 0;
+	_totalMass   = 0;
+	_totalBulk   = 0;
+	_numObjects  = 0;
 
-	if (containerObject == nullptr) return;
+	if (_containerObject == nullptr) return;
 
-	RecursiveContainerIterator  iter(containerObject);
+	RecursiveContainerIterator  iter(_containerObject);
 
 	//  See if he has enough currency
 	for (objID = iter.first(&item); objID != Nothing; objID = iter.next(&item)) {
@@ -267,7 +267,7 @@ void ContainerView::totalObjects() {
 
 			ProtoObj *proto = item->proto();
 
-			numObjects++;
+			_numObjects++;
 
 			// if it's mergeable calc using the getExtra method of
 			// quantity calculation
@@ -276,8 +276,8 @@ void ContainerView::totalObjects() {
 				numItems = item->getExtra();
 			else numItems = 1;
 
-			totalMass += proto->mass * numItems;
-			totalBulk += proto->bulk * numItems;
+			_totalMass += proto->mass * numItems;
+			_totalBulk += proto->bulk * numItems;
 		}
 	}
 }
@@ -287,9 +287,9 @@ ObjectID ContainerView::getObject(int16 slotNum) {
 	ObjectID        objID;
 	GameObject      *item;
 
-	if (containerObject == nullptr) return Nothing;
+	if (_containerObject == nullptr) return Nothing;
 
-	ContainerIterator   iter(containerObject);
+	ContainerIterator   iter(_containerObject);
 
 	//  Iterate through all the objects in the container.
 	while ((objID = iter.next(&item)) != Nothing) {
@@ -315,14 +315,14 @@ void ContainerView::drawClipped(
 	                y;
 
 	//  Coordinates for slot 0,0.
-	int16           originX = _extent.x - offset.x + iconOrigin.x,
-	                originY = _extent.y - offset.y + iconOrigin.y;
+	int16           originX = _extent.x - offset.x + _iconOrigin.x,
+	                originY = _extent.y - offset.y + _iconOrigin.y;
 
 	ObjectID        objID;
 	GameObject      *item;
 
 	//  Iterator class for the container.
-	ContainerIterator   iter(containerObject);
+	ContainerIterator   iter(_containerObject);
 
 	//  Color set to draw the object.
 	ColorTable      objColors;
@@ -340,20 +340,20 @@ void ContainerView::drawClipped(
 		if (objLoc.z == 0) continue;
 
 		//  Draw object only if visible and in a visible row & col.
-		if (objLoc.u >= scrollPosition
-		        &&  objLoc.u < scrollPosition + visibleRows
-		        &&  objLoc.v < visibleCols
+		if (objLoc.u >= _scrollPosition
+		        &&  objLoc.u < _scrollPosition + _visibleRows
+		        &&  objLoc.v < _visibleCols
 		        &&  isVisible(item)) {
 			Sprite      *spr;
 			ProtoObj    *proto = item->proto();
 			Point16     sprPos;
 
 			y =     originY
-			        + (objLoc.u - scrollPosition)
-			        * (iconSpacing.y + iconHeight);
+			        + (objLoc.u - _scrollPosition)
+			        * (_iconSpacing.y + iconHeight);
 			x =     originX
 			        +       objLoc.v
-			        * (iconSpacing.x + iconWidth);
+			        * (_iconSpacing.x + iconWidth);
 
 			//  Get the address of the sprite.
 			spr = proto->getSprite(item, ProtoObj::objInContainerView).sp;
@@ -442,7 +442,7 @@ void ContainerView::drawQuantity(
 }
 
 void ContainerView::setContainer(GameObject *containerObj) {
-	containerObject = containerObj;
+	_containerObject = containerObj;
 	totalObjects();
 }
 
@@ -453,9 +453,9 @@ TilePoint ContainerView::pickObjectSlot(const Point16 &pickPos) {
 	Point16     temp;
 
 	//  Compute the u/v of the slot that they clicked on.
-	temp   = pickPos + iconSpacing / 2 - iconOrigin;
-	slot.v = clamp(0, temp.x / (iconWidth  + iconSpacing.x), visibleCols - 1);
-	slot.u = clamp(0, temp.y / (iconHeight + iconSpacing.y), visibleRows - 1) + scrollPosition;
+	temp   = pickPos + _iconSpacing / 2 - _iconOrigin;
+	slot.v = clamp(0, temp.x / (iconWidth  + _iconSpacing.x), _visibleCols - 1);
+	slot.u = clamp(0, temp.y / (iconHeight + _iconSpacing.y), _visibleRows - 1) + _scrollPosition;
 	slot.z = 1;
 	return slot;
 }
@@ -465,7 +465,7 @@ GameObject *ContainerView::getObject(const TilePoint &slot) {
 	GameObject *item;
 	TilePoint   loc;
 
-	item = containerObject->child();
+	item = _containerObject->child();
 
 	while (item != nullptr) {
 		//  Skip objects that are stacked behind other objects
@@ -547,12 +547,12 @@ void ContainerView::pointerMove(gPanelMessage &msg) {
 			GameObject *mouseObject;
 			mouseObject = g_vm->_mouseInfo->getObject();
 
-			if (!node.isAccessable(getCenterActorID())) {
+			if (!_node.isAccessable(getCenterActorID())) {
 				g_vm->_mouseInfo->setDoable(false);
 			} else if (mouseObject == nullptr) {
 				g_vm->_mouseInfo->setDoable(true);
 			} else {
-				g_vm->_mouseInfo->setDoable(containerObject->canContain(mouseObject->thisID()));
+				g_vm->_mouseInfo->setDoable(_containerObject->canContain(mouseObject->thisID()));
 			}
 		}
 
@@ -730,10 +730,10 @@ void ContainerView::dropPhysical(
 	g_vm->_mouseInfo->replaceObject();
 
 	//  test to check if item is accepted by container
-	if (containerObject->canContain(mObj->thisID())) {
+	if (_containerObject->canContain(mObj->thisID())) {
 		Actor       *centerActor = getCenterActor();
 		Location    loc(pickObjectSlot(msg.pickPos),
-		                containerObject->thisID());
+		                _containerObject->thisID());
 
 		//  check if no object in the current slot
 		if (cObj == nullptr) {
@@ -777,7 +777,7 @@ void ContainerView::useConcept(
 	g_vm->_mouseInfo->replaceObject();
 
 	//  Determine if this object can go into this container
-	if (containerObject->canContain(mObj->thisID())) {
+	if (_containerObject->canContain(mObj->thisID())) {
 		ObjectID    centerActorID = getCenterActorID();
 
 		if (cObj == nullptr) {
@@ -785,7 +785,7 @@ void ContainerView::useConcept(
 			//  mouse object here
 
 			Location    loc(pickObjectSlot(msg.pickPos),
-			                containerObject->thisID());
+			                _containerObject->thisID());
 
 			mObj->drop(centerActorID, loc);
 		} else
@@ -885,22 +885,22 @@ ReadyContainerView::ReadyContainerView(
     AppFunc         *cmd)
 	: ContainerView(list, box, nd, readyContainerAppearance, cmd) {
 	//  Over-ride row and column info in appearance record.
-	visibleRows = numRows;
-	visibleCols = numCols;
-	totalRows   = totRows;
+	_visibleRows = numRows;
+	_visibleCols = numCols;
+	_totalRows   = totRows;
 
 	if (backgrounds) {
-		backImages  = backgrounds;
-		numIm       = numRes;
+		_backImages  = backgrounds;
+		_numIm       = numRes;
 	} else {
-		backImages  = nullptr;
-		numIm       = 0;
+		_backImages  = nullptr;
+		_numIm       = 0;
 	}
 }
 
 void ReadyContainerView::setScrollOffset(int8 num) {
 	if (num > 0) {
-		scrollPosition = num;
+		_scrollPosition = num;
 	}
 }
 
@@ -924,8 +924,8 @@ void ReadyContainerView::drawClipped(
 	                y;
 
 	//  Coordinates for slot 0,0.
-	int16           originX = _extent.x - offset.x + iconOrigin.x,
-	                originY = _extent.y - offset.y + iconOrigin.y;
+	int16           originX = _extent.x - offset.x + _iconOrigin.x,
+	                originY = _extent.y - offset.y + _iconOrigin.y;
 
 	//  Row an column number of the inventory slot.
 	int16           col,
@@ -935,7 +935,7 @@ void ReadyContainerView::drawClipped(
 	GameObject      *item;
 
 	//  Iterator class for the container.
-	ContainerIterator   iter(containerObject);
+	ContainerIterator   iter(_containerObject);
 
 	//  Color set to draw the object.
 	ColorTable      objColors;
@@ -945,35 +945,35 @@ void ReadyContainerView::drawClipped(
 
 	//  Draw the boxes for visible rows and cols.
 
-	if (backImages) {
+	if (_backImages) {
 		int16   i;
 		Point16 drawOrg(_extent.x - offset.x + backOriginX,
 		                _extent.y - offset.y + backOriginY);
 
 		for (y = drawOrg.y, row = 0;
-		        row < visibleRows;
-		        row++, y += iconSpacing.y + iconHeight) {
+		        row < _visibleRows;
+		        row++, y += _iconSpacing.y + iconHeight) {
 			// reset y for background image stuff
 			//y = drawOrg.y;
 
 			for (i = 0, x = drawOrg.x, col = 0;
-			        col < visibleCols;
-			        i++, col++, x += iconSpacing.x + iconWidth) {
+			        col < _visibleCols;
+			        i++, col++, x += _iconSpacing.x + iconWidth) {
 				Point16 pos(x, y);
 
-				if (isGhosted()) drawCompressedImageGhosted(port, pos, backImages[i % numIm]);
-				else drawCompressedImage(port, pos, backImages[i % numIm]);
+				if (isGhosted()) drawCompressedImageGhosted(port, pos, _backImages[i % _numIm]);
+				else drawCompressedImage(port, pos, _backImages[i % _numIm]);
 			}
 
 		}
 	} else {
 		for (y = originY, row = 0;
-		        row < visibleRows;
-		        row++, y += iconSpacing.y + iconHeight) {
+		        row < _visibleRows;
+		        row++, y += _iconSpacing.y + iconHeight) {
 
 			for (x = originX, col = 0;
-			        col < visibleCols;
-			        col++, x += iconSpacing.x + iconWidth) {
+			        col < _visibleCols;
+			        col++, x += _iconSpacing.x + iconWidth) {
 				//  REM: We need to come up with some way of
 				//  indicating how to render the pattern data which
 				//  is behind the object...
@@ -1001,16 +1001,16 @@ void ReadyContainerView::drawClipped(
 		if (objLoc.z == 0) continue;
 
 		//  Draw object only if visible and in a visible row & col.
-		if (objLoc.u >= scrollPosition &&
-		        objLoc.u < scrollPosition + visibleRows &&
-		        objLoc.v < visibleCols &&
+		if (objLoc.u >= _scrollPosition &&
+		        objLoc.u < _scrollPosition + _visibleRows &&
+		        objLoc.v < _visibleCols &&
 		        isVisible(item)) {
 			Sprite      *spr;
 			ProtoObj    *proto = item->proto();
 			Point16     sprPos;
 
-			y = originY + (objLoc.u - scrollPosition) * (iconSpacing.y + iconHeight);
-			x = originX + objLoc.v * (iconSpacing.x + iconWidth);
+			y = originY + (objLoc.u - _scrollPosition) * (_iconSpacing.y + iconHeight);
+			x = originX + objLoc.v * (_iconSpacing.x + iconWidth);
 
 			//  Get the address of the sprite.
 			spr = proto->getSprite(item, ProtoObj::objInContainerView).sp;
@@ -1023,9 +1023,9 @@ void ReadyContainerView::drawClipped(
 			if (isGhosted()) return;
 
 			//  Draw the "in use" indicator.
-			if (backImages && proto->isObjectBeingUsed(item)) {
+			if (_backImages && proto->isObjectBeingUsed(item)) {
 				drawCompressedImage(port,
-				                    Point16(x - 4, y - 4), backImages[3]);
+				                    Point16(x - 4, y - 4), _backImages[3]);
 			}
 
 			//  Build the color table.
@@ -1062,12 +1062,12 @@ void ReadyContainerView::drawClipped(
 ContainerWindow::ContainerWindow(ContainerNode &nd,
                                  const ContainerAppearanceDef &app,
                                  const char saveas[])
-	: FloatingWindow(nd.position, 0, saveas, cmdWindowFunc) {
+	: FloatingWindow(nd._position, 0, saveas, cmdWindowFunc) {
 	//  Initialize view to NULL.
-	view = nullptr;
+	_view = nullptr;
 
 	// create the close button for this window
-	closeCompButton = new GfxCompButton(
+	_closeCompButton = new GfxCompButton(
 	                      *this,
 	                      app.closeRect,              // rect for button
 	                      containerRes,               // resource context
@@ -1081,7 +1081,7 @@ ContainerWindow::ContainerWindow(ContainerNode &nd,
 ContainerWindow::~ContainerWindow() {}
 
 ContainerView &ContainerWindow::getView() {
-	return *view;
+	return *_view;
 }
 
 /* ===================================================================== *
@@ -1091,10 +1091,10 @@ ContainerView &ContainerWindow::getView() {
 ScrollableContainerWindow::ScrollableContainerWindow(
     ContainerNode &nd, const ContainerAppearanceDef &app, const char saveas[])
 	: ContainerWindow(nd, app, saveas) {
-	view = new ContainerView(*this, app.viewRect, nd, app);
+	_view = new ContainerView(*this, app.viewRect, nd, app);
 
 	// make the button conected to this window
-	scrollCompButton = new GfxCompButton(
+	_scrollCompButton = new GfxCompButton(
 	                       *this,
 	                       app.scrollRect,                 // rect for button
 	                       containerRes,                   // resource context
@@ -1103,8 +1103,8 @@ ScrollableContainerWindow::ScrollableContainerWindow(
 	                       0,
 	                       cmdScrollFunc);                 // mind app func
 
-	assert(view != nullptr);
-	assert(scrollCompButton != nullptr);
+	assert(_view != nullptr);
+	assert(_scrollCompButton != nullptr);
 }
 
 /* ===================================================================== *
@@ -1116,17 +1116,17 @@ TangibleContainerWindow::TangibleContainerWindow(
 	: ScrollableContainerWindow(nd, app, "ObjectWindow") {
 
 	const int weightIndicatorType = 2;
-	objRect = app.iconRect;
-	deathFlag = nd.getType() == ContainerNode::deadType;
-	containerSpriteImg = nullptr;
+	_objRect = app.iconRect;
+	_deathFlag = nd.getType() == ContainerNode::deadType;
+	_containerSpriteImg = nullptr;
 
 	// setup the mass and weight indicator
-	if (deathFlag) {
+	if (_deathFlag) {
 		// set the decorations for this window
 		setDecorations(deathDecorations,
 		               ARRAYSIZE(deathDecorations),
 		               containerRes, 'F', 'R', 'M');
-		massWeightIndicator = nullptr;
+		_massWeightIndicator = nullptr;
 	} else {
 		const StaticWindow *winDecs[] =  {
 			brassDecorations,
@@ -1134,7 +1134,7 @@ TangibleContainerWindow::TangibleContainerWindow(
 		    steelDecorations,
 		    woodDecorations
 		};
-		uint16      bgndType = view->containerObject->proto()->appearanceType;
+		uint16      bgndType = _view->_containerObject->proto()->appearanceType;
 
 		assert(bgndType < 4);
 
@@ -1147,51 +1147,51 @@ TangibleContainerWindow::TangibleContainerWindow(
 
 		// set the userdata such that we can extract the container object later
 		// through an appfunc.
-		this->userData = view->containerObject;
+		this->userData = _view->_containerObject;
 
-		massWeightIndicator = new CMassWeightIndicator(
+		_massWeightIndicator = new CMassWeightIndicator(
 		                          this,
 		                          Point16(app.massRect.x, app.massRect.y),
 		                          weightIndicatorType,
-		                          deathFlag);
+		                          _deathFlag);
 	}
 }
 
 TangibleContainerWindow::~TangibleContainerWindow() {
-	if (massWeightIndicator)    delete massWeightIndicator;
-	if (containerSpriteImg)     delete containerSpriteImg;
+	if (_massWeightIndicator)    delete _massWeightIndicator;
+	if (_containerSpriteImg)     delete _containerSpriteImg;
 }
 
 void TangibleContainerWindow::setContainerSprite() {
 	// pointer to sprite data that will be drawn
 	Sprite              *spr;
-	ProtoObj            *proto = view->containerObject->proto();
+	ProtoObj            *proto = _view->_containerObject->proto();
 	Point16             sprPos;
 	char                dummy = '\0';
 
 	//  Get the address of the sprite.
-	spr = proto->getSprite(view->containerObject, ProtoObj::objInContainerView).sp;
+	spr = proto->getSprite(_view->_containerObject, ProtoObj::objInContainerView).sp;
 
-	sprPos.x = objRect.x - (spr->size.x >> 1);  //objRect.x + ( spr->size.x >> 1 );
-	sprPos.y = objRect.y - (spr->size.y >> 1);
+	sprPos.x = _objRect.x - (spr->size.x >> 1);  //_objRect.x + ( spr->size.x >> 1 );
+	sprPos.y = _objRect.y - (spr->size.y >> 1);
 
-	containerSpriteImg = new GfxSpriteImage(
+	_containerSpriteImg = new GfxSpriteImage(
 	                         *this,
 	                         Rect16(sprPos.x,
 	                                sprPos.y,
-	                                objRect.height,
-	                                objRect.width),
-	                         view->containerObject,
+	                                _objRect.height,
+	                                _objRect.width),
+	                         _view->_containerObject,
 	                         dummy,
 	                         0,
 	                         nullptr);
 }
 
 void TangibleContainerWindow::massBulkUpdate() {
-	if (massWeightIndicator) {      //  Death container doesn't have MW indicator
+	if (_massWeightIndicator) {      //  Death container doesn't have MW indicator
 		// set the indicators to the correct mass and bulk
-		massWeightIndicator->setMassPie(view->totalMass);
-		massWeightIndicator->setBulkPie(view->totalBulk);
+		_massWeightIndicator->setMassPie(_view->_totalMass);
+		_massWeightIndicator->setBulkPie(_view->_totalBulk);
 	}
 }
 
@@ -1213,7 +1213,7 @@ IntangibleContainerWindow::IntangibleContainerWindow(
     ContainerNode &nd, const ContainerAppearanceDef &app)
 	: ScrollableContainerWindow(nd, app, "MentalWindow") {
 	// make the button conected to this window
-	mindSelectorCompButton = new GfxMultCompButton(
+	_mindSelectorCompButton = new GfxMultCompButton(
 	                             *this,
 	                             Rect16(49, 15 - 13, 52, 67),
 	                             containerRes,
@@ -1221,16 +1221,16 @@ IntangibleContainerWindow::IntangibleContainerWindow(
 	                             0,
 	                             cmdMindContainerFunc);          // mind app func
 
-	assert(mindSelectorCompButton != nullptr);
+	assert(_mindSelectorCompButton != nullptr);
 
-	mindSelectorCompButton->setResponse(false);
+	_mindSelectorCompButton->setResponse(false);
 
 	// set the decorations for this window
 	setDecorations(mentalDecorations,
 	               ARRAYSIZE(mentalDecorations),
 	               containerRes, 'F', 'R', 'M');
 
-	setMindContainer(nd.mindType, *this);
+	setMindContainer(nd._mindType, *this);
 }
 
 /* ===================================================================== *
@@ -1240,10 +1240,10 @@ IntangibleContainerWindow::IntangibleContainerWindow(
 EnchantmentContainerWindow::EnchantmentContainerWindow(
     ContainerNode &nd, const ContainerAppearanceDef &app)
 	: ContainerWindow(nd, app, "EnchantmentWindow") {
-	view = new EnchantmentContainerView(*this, nd, app);
+	_view = new EnchantmentContainerView(*this, nd, app);
 
 	// make the button conected to this window
-	scrollCompButton = new GfxCompButton(
+	_scrollCompButton = new GfxCompButton(
 	                       *this,
 	                       app.scrollRect,                 // rect for button
 	                       containerRes,                   // resource context
@@ -1252,8 +1252,8 @@ EnchantmentContainerWindow::EnchantmentContainerWindow(
 	                       0,
 	                       cmdScrollFunc);                 // mind app func
 
-	assert(view != nullptr);
-	assert(scrollCompButton != nullptr);
+	assert(_view != nullptr);
+	assert(_scrollCompButton != nullptr);
 }
 
 /* ===================================================================== *
@@ -1282,30 +1282,30 @@ ContainerNode::ContainerNode(ContainerManager &cl, ObjectID id, int typ) {
 		break;
 
 	case deadType:
-		position = deathContainerAppearance.defaultWindowPos;
+		_position = deathContainerAppearance.defaultWindowPos;
 		break;
 
 	case mentalType:
-		mindType = 0; //protoClassIdeaContainer;
-		position = mentalContainerAppearance.defaultWindowPos;
+		_mindType = 0; //protoClassIdeaContainer;
+		_position = mentalContainerAppearance.defaultWindowPos;
 		break;
 
 	case physicalType:
-		position = physicalContainerAppearance.defaultWindowPos;
+		_position = physicalContainerAppearance.defaultWindowPos;
 		break;
 
 	case enchantType:
-		position = enchantmentContainerAppearance.defaultWindowPos;
+		_position = enchantmentContainerAppearance.defaultWindowPos;
 		break;
 	}
 
 	//  Fill in the initial values.
-	window      = nullptr;
-	type        = typ;
-	object      = id;
-	owner       = ownerID;
-	action      = 0;
-	mindType    = 0;
+	_window      = nullptr;
+	_type        = typ;
+	_object      = id;
+	_owner       = ownerID;
+	_action      = 0;
+	_mindType    = 0;
 
 	//  Add to container list.
 	cl.add(this);
@@ -1313,12 +1313,12 @@ ContainerNode::ContainerNode(ContainerManager &cl, ObjectID id, int typ) {
 
 //  Return the container window for a container node, if it is visible
 ContainerWindow *ContainerNode::getWindow() {
-	return window;
+	return _window;
 }
 
 //  Return the container view for a container node, if it is visible
 ContainerView   *ContainerNode::getView() {
-	return window ? &window->getView() : nullptr;
+	return _window ? &_window->getView() : nullptr;
 }
 
 //  Destructor
@@ -1332,13 +1332,13 @@ ContainerNode::~ContainerNode() {
 
 void ContainerNode::read(Common::InSaveFile *in) {
 	//  Restore fields
-	object = in->readUint16LE();
-	type = in->readByte();
-	owner = in->readByte();
-	position.read(in);
-	mindType = in->readByte();
-	window = nullptr;
-	action = 0;
+	_object = in->readUint16LE();
+	_type = in->readByte();
+	_owner = in->readByte();
+	_position.read(in);
+	_mindType = in->readByte();
+	_window = nullptr;
+	_action = 0;
 
 	bool shown = in->readUint16LE();
 
@@ -1346,71 +1346,71 @@ void ContainerNode::read(Common::InSaveFile *in) {
 	if (shown)
 		markForShow();
 
-	debugC(4, kDebugSaveload, "... object = %d", object);
-	debugC(4, kDebugSaveload, "... type = %d", type);
-	debugC(4, kDebugSaveload, "... owner = %d", owner);
-	debugC(4, kDebugSaveload, "... position = (%d, %d, %d, %d)", position.x, position.y, position.width, position.height);
-	debugC(4, kDebugSaveload, "... mindType = %d", mindType);
+	debugC(4, kDebugSaveload, "... object = %d", _object);
+	debugC(4, kDebugSaveload, "... type = %d", _type);
+	debugC(4, kDebugSaveload, "... owner = %d", _owner);
+	debugC(4, kDebugSaveload, "... position = (%d, %d, %d, %d)", _position.x, _position.y, _position.width, _position.height);
+	debugC(4, kDebugSaveload, "... _mindType = %d", _mindType);
 	debugC(4, kDebugSaveload, "... shown = %d", shown);
 }
 
 void ContainerNode::write(Common::MemoryWriteStreamDynamic *out) {
 	//  Store fields
-	out->writeUint16LE(object);
-	out->writeByte(type);
-	out->writeByte(owner);
-	position.write(out);
-	out->writeByte(mindType);
-	out->writeUint16LE(window != nullptr);
+	out->writeUint16LE(_object);
+	out->writeByte(_type);
+	out->writeByte(_owner);
+	_position.write(out);
+	out->writeByte(_mindType);
+	out->writeUint16LE(_window != nullptr);
 
-	debugC(4, kDebugSaveload, "... object = %d", object);
-	debugC(4, kDebugSaveload, "... type = %d", type);
-	debugC(4, kDebugSaveload, "... owner = %d", owner);
-	debugC(4, kDebugSaveload, "... position = (%d, %d, %d, %d)", position.x, position.y, position.width, position.height);
-	debugC(4, kDebugSaveload, "... mindType = %d", mindType);
-	debugC(4, kDebugSaveload, "... shown = %d", window != nullptr);
+	debugC(4, kDebugSaveload, "... object = %d", _object);
+	debugC(4, kDebugSaveload, "... type = %d", _type);
+	debugC(4, kDebugSaveload, "... owner = %d", _owner);
+	debugC(4, kDebugSaveload, "... position = (%d, %d, %d, %d)", _position.x, _position.y, _position.width, _position.height);
+	debugC(4, kDebugSaveload, "... _mindType = %d", _mindType);
+	debugC(4, kDebugSaveload, "... shown = %d", _window != nullptr);
 }
 
 //  Close the container window, but leave the node.
 void ContainerNode::hide() {
 	//  close the window, but don't close the object.
-	if (type != readyType && window != nullptr) {
-		position = window->getExtent();     //  Save old window position
-		window->close();
-		delete window;
-		window = nullptr;
+	if (_type != readyType && _window != nullptr) {
+		_position = _window->getExtent();     //  Save old window position
+		_window->close();
+		delete _window;
+		_window = nullptr;
 	}
 }
 
 //  Open the cotainer window, given the node info.
 void ContainerNode::show() {
-	ProtoObj        *proto = GameObject::protoAddress(object);
+	ProtoObj        *proto = GameObject::protoAddress(_object);
 
 	assert(proto);
 
 	//  open the window; Object should already be "open"
-	if (window == nullptr) {
-		switch (type) {
+	if (_window == nullptr) {
+		switch (_type) {
 		case physicalType:
 			physicalContainerAppearance.rows    = proto->getViewableRows();
 			physicalContainerAppearance.cols    = proto->getViewableCols();
 			physicalContainerAppearance.totRows = proto->getMaxRows();
-			window = new TangibleContainerWindow(*this, physicalContainerAppearance);
+			_window = new TangibleContainerWindow(*this, physicalContainerAppearance);
 			break;
 
 		case deadType:
 			deathContainerAppearance.rows       = proto->getViewableRows();
 			deathContainerAppearance.cols       = proto->getViewableCols();
 			deathContainerAppearance.totRows    = proto->getMaxRows();
-			window = new TangibleContainerWindow(*this, deathContainerAppearance);
+			_window = new TangibleContainerWindow(*this, deathContainerAppearance);
 			break;
 
 		case mentalType:
-			window = new IntangibleContainerWindow(*this, mentalContainerAppearance);
+			_window = new IntangibleContainerWindow(*this, mentalContainerAppearance);
 			break;
 
 		case enchantType:
-			window = new EnchantmentContainerWindow(*this, enchantmentContainerAppearance);
+			_window = new EnchantmentContainerWindow(*this, enchantmentContainerAppearance);
 			break;
 
 		case readyType:
@@ -1419,31 +1419,31 @@ void ContainerNode::show() {
 		}
 	}
 
-	window->open();
+	_window->open();
 }
 
 void ContainerNode::update() {
-	if (type == readyType) {
+	if (_type == readyType) {
 		//  Update ready containers if they are enabled
-		if (TrioCviews[owner]->getEnabled())  TrioCviews[owner]->invalidate();
+		if (TrioCviews[_owner]->getEnabled())  TrioCviews[_owner]->invalidate();
 		if (indivCviewTop->getEnabled())        indivCviewTop->invalidate();
 		if (indivCviewBot->getEnabled())        indivCviewBot->invalidate();
 
 		//  If the container to update is the center brother's ready container.
-		if (isIndivMode() && owner == getCenterActorPlayerID()) {
+		if (isIndivMode() && _owner == getCenterActorPlayerID()) {
 			//  Update player's mass & weight indicator...
 			MassWeightIndicator->update();
 		}
-	} else if (window) {
+	} else if (_window) {
 		getView()->invalidate();
-		window->massBulkUpdate();
+		_window->massBulkUpdate();
 	}
 }
 
 //  Find a container node, given a specific object
 ContainerNode *ContainerManager::find(ObjectID id) {
 	for (Common::List<ContainerNode *>::iterator it = _list.begin(); it != _list.end(); ++it)
-		if ((*it)->object == id)
+		if ((*it)->_object == id)
 			return *it;
 
 	return nullptr;
@@ -1451,7 +1451,7 @@ ContainerNode *ContainerManager::find(ObjectID id) {
 
 ContainerNode *ContainerManager::find(ObjectID id, int16 type) {
 	for (Common::List<ContainerNode *>::iterator it = _list.begin(); it != _list.end(); ++it)
-		if ((*it)->object == id && (*it)->type == type)
+		if ((*it)->_object == id && (*it)->_type == type)
 			return *it;
 
 	return nullptr;
@@ -1462,7 +1462,7 @@ ContainerNode *ContainerManager::find(ObjectID id, int16 type) {
 bool ContainerNode::isAccessable(ObjectID enactor) {
 	Actor       *a = (Actor *)GameObject::objectAddress(enactor);
 	ObjectID    holder;
-	GameObject  *obj = GameObject::objectAddress(object);
+	GameObject  *obj = GameObject::objectAddress(_object);
 	int32       dist;
 
 	//  REM: We really ought to do a line-of-sight test here.
@@ -1473,7 +1473,7 @@ bool ContainerNode::isAccessable(ObjectID enactor) {
 	//  If the container object is too far away we can't access any containers.
 	//  Note: Actors are not considered to be in possession of themselves...
 	holder = obj->possessor();
-	if (holder != Nothing || isActor(object)) {
+	if (holder != Nothing || isActor(_object)) {
 		//  "Reach" for other players is further than for other objects
 		if (holder != a->thisID() && dist > 96)
 			return false;
@@ -1485,8 +1485,8 @@ bool ContainerNode::isAccessable(ObjectID enactor) {
 
 //  Change the owner of a ready container (for indiv mode)
 void ContainerNode::changeOwner(int16 newOwner) {
-	owner = newOwner;
-	object = getPlayerActorAddress(newOwner)->getActorID();
+	_owner = newOwner;
+	_object = getPlayerActorAddress(newOwner)->getActorID();
 }
 
 /* ===================================================================== *
@@ -1499,7 +1499,7 @@ void ContainerManager::setPlayerNum(PlayerActorID playerNum) {
 	for (Common::List<ContainerNode *>::iterator it = _list.begin(); it != _list.end(); ++it) {
 		ContainerNode *n = *it;
 
-		if (n->owner != ContainerNode::nobody && n->owner != playerNum)
+		if (n->_owner != ContainerNode::nobody && n->_owner != playerNum)
 			n->hide();
 	}
 
@@ -1507,7 +1507,7 @@ void ContainerManager::setPlayerNum(PlayerActorID playerNum) {
 	for (Common::List<ContainerNode *>::iterator it = _list.begin(); it != _list.end(); ++it) {
 		ContainerNode *n = *it;
 
-		if (n->owner == playerNum)
+		if (n->_owner == playerNum)
 			n->markForShow();
 	}
 }
@@ -1526,10 +1526,10 @@ void ContainerManager::doDeferredActions() {
 		ContainerNode *n = *it;
 
 		//  If the object is not in a player inventory (i.e. on the ground)
-		if (n->owner == ContainerNode::nobody) {
+		if (n->_owner == ContainerNode::nobody) {
 			//  If the object is in a different world, or too far away
 			//  from the protagonist, then quietly close the object.
-			GameObject  *obj = GameObject::objectAddress(n->object);
+			GameObject  *obj = GameObject::objectAddress(n->_object);
 			if (obj->world() != world
 			        || (obj->getWorldLocation() - tp).quickHDistance() > kMaxOpenDistance) {
 				//  Close object image and window (silently)
@@ -1539,19 +1539,19 @@ void ContainerManager::doDeferredActions() {
 			}
 		}
 
-		if (n->action & ContainerNode::actionDelete) {
+		if (n->_action & ContainerNode::actionDelete) {
 			delete n;
 			continue;
 		}
 
-		if (n->action & ContainerNode::actionHide) {
+		if (n->_action & ContainerNode::actionHide) {
 			n->hide();
 		} else {
-			if (n->action & ContainerNode::actionShow) n->show();
-			if (n->action & ContainerNode::actionUpdate) n->update();
+			if (n->_action & ContainerNode::actionShow) n->show();
+			if (n->_action & ContainerNode::actionUpdate) n->update();
 		}
 
-		n->action = 0;
+		n->_action = 0;
 	}
 }
 
@@ -1561,10 +1561,10 @@ void ContainerManager::setUpdate(ObjectID id) {
 	for (Common::List<ContainerNode *>::iterator it = _list.begin(); it != _list.end(); ++it) {
 		ContainerNode *n = *it;
 
-		if (n->object == id)
+		if (n->_object == id)
 			n->update();
-		else if (n->type == ContainerNode::mentalType    //  Special case for mind containers
-		         &&  n->object == GameObject::objectAddress(id)->IDParent())
+		else if (n->_type == ContainerNode::mentalType    //  Special case for mind containers
+		         &&  n->_object == GameObject::objectAddress(id)->IDParent())
 			n->update();
 	}
 }
@@ -1623,7 +1623,7 @@ ContainerNode *OpenMindContainer(PlayerActorID player, int16 open, int16 type) {
 
 	if (!(cn = g_vm->_cnm->find(id, ContainerNode::mentalType))) {
 		cn = new ContainerNode(*g_vm->_cnm, id, ContainerNode::mentalType);
-		cn->mindType = type;
+		cn->_mindType = type;
 
 		//  If node was successfull created, and we wanted it open, and the owner
 		//  is the center actor or no-actor then make the container window visible.
@@ -1633,9 +1633,9 @@ ContainerNode *OpenMindContainer(PlayerActorID player, int16 open, int16 type) {
 	} else {
 		IntangibleContainerWindow   *cw = (IntangibleContainerWindow *)cn->getWindow();
 
-		if (cw && (type != cn->mindType)) {
-			cn->mindType = type;
-			setMindContainer(cn->mindType, *cw);
+		if (cw && (type != cn->_mindType)) {
+			cn->_mindType = type;
+			setMindContainer(cn->_mindType, *cw);
 			cw->update(cw->getView().getExtent());
 		}
 	}
@@ -1775,7 +1775,7 @@ void setMindContainer(int index, IntangibleContainerWindow &cw) {
 		protoClassPsychContainer    // Not used anymore
 	};
 
-	ObjectID        ownerID = cw.getView().node.getObject();
+	ObjectID        ownerID = cw.getView()._node.getObject();
 	GameObject      *object = GameObject::objectAddress(ownerID);
 	ContainerIterator iter(object);
 	GameObject      *item;
@@ -1786,12 +1786,12 @@ void setMindContainer(int index, IntangibleContainerWindow &cw) {
 
 	int             containerClass = classTable[index];
 
-	cw.mindSelectorCompButton->setCurrent(index);
-	cw.mindSelectorCompButton->invalidate();
+	cw._mindSelectorCompButton->setCurrent(index);
+	cw._mindSelectorCompButton->invalidate();
 
 	while ((id = iter.next(&item)) != Nothing) {
 		if (item->proto()->classType == containerClass) {
-			cw.view->setContainer(item);
+			cw._view->setContainer(item);
 			return;
 		}
 	}
@@ -1800,8 +1800,8 @@ void setMindContainer(int index, IntangibleContainerWindow &cw) {
 APPFUNC(cmdMindContainerFunc) {
 	if (ev.panel && ev.eventType == gEventNewValue /* && ev.value */) {
 		IntangibleContainerWindow   *cw = (IntangibleContainerWindow *)ev.window;
-		ContainerNode   &nd = cw->getView().node;
-		int             newMindType = nd.mindType;
+		ContainerNode   &nd = cw->getView()._node;
+		int             newMindType = nd._mindType;
 
 		const Rect16 idea(0, 0, 22, 67),      // idea button click area
 		             skill(22, 0, 11, 67),    // skill area
@@ -1813,9 +1813,9 @@ APPFUNC(cmdMindContainerFunc) {
 		if (memory.ptInside(ev.mouse))  newMindType = 2; //protoClassMemoryContainer;
 //		if (psych.ptInside(ev.mouse))   newMindType = protoClassPsychContainer;
 
-		if (newMindType != nd.mindType) {
-			nd.mindType = newMindType;
-			setMindContainer(nd.mindType, *cw);
+		if (newMindType != nd._mindType) {
+			nd._mindType = newMindType;
+			setMindContainer(nd._mindType, *cw);
 			cw->update(cw->getView().getExtent());
 		}
 	} else if (ev.eventType == gEventMouseMove) {
@@ -1828,14 +1828,14 @@ APPFUNC(cmdMindContainerFunc) {
 
 			const int BUF_SIZE = 64;
 			char    textBuffer[BUF_SIZE];
-			int     mindType = -1;
+			int     _mindType = -1;
 
 
-			if (idea.ptInside(ev.mouse))       mindType = 0;    //protoClassIdeaContainer;
-			if (skill.ptInside(ev.mouse))  mindType = 1;    //protoClassSkillContainer;
-			if (memory.ptInside(ev.mouse)) mindType = 2;    //protoClassMemoryContainer;
+			if (idea.ptInside(ev.mouse))       _mindType = 0;    //protoClassIdeaContainer;
+			if (skill.ptInside(ev.mouse))  _mindType = 1;    //protoClassSkillContainer;
+			if (memory.ptInside(ev.mouse)) _mindType = 2;    //protoClassMemoryContainer;
 
-			switch (mindType) {
+			switch (_mindType) {
 			case 0:
 				sprintf(textBuffer, IDEAS_MENTAL);
 				break;
@@ -1871,8 +1871,8 @@ APPFUNC(cmdCloseButtonFunc) {
 	if (ev.eventType == gEventNewValue && ev.value == 1) {
 		ContainerWindow     *win = (ContainerWindow *)ev.window;
 
-		if (win->getView().node.getType() == ContainerNode::mentalType) {
-			win->getView().node.markForDelete();
+		if (win->getView()._node.getType() == ContainerNode::mentalType) {
+			win->getView()._node.markForDelete();
 		} else {
 			win->containerObject()->close(getCenterActorID());
 		}
diff --git a/engines/saga2/contain.h b/engines/saga2/contain.h
index a458620f173..003d0dc766f 100644
--- a/engines/saga2/contain.h
+++ b/engines/saga2/contain.h
@@ -75,29 +75,29 @@ protected:
 
 public:
 
-	ContainerNode   &node;
+	ContainerNode   &_node;
 
-	Point16         iconOrigin;     //  of the top left icon.
-	Point16         iconSpacing;    //  The spacing between icons (in both X and Y)
+	Point16         _iconOrigin;     //  of the top left icon.
+	Point16         _iconSpacing;    //  The spacing between icons (in both X and Y)
 
 	//  The number of rows and columns of icons that can be seen
-	int16           visibleRows,
-	                visibleCols;
+	int16           _visibleRows,
+	                _visibleCols;
 
 	//  The total number of rows, and the scroll position of the control
-	int16           totalRows,
-	                scrollPosition;
+	int16           _totalRows,
+	                _scrollPosition;
 
 	//  Pointer to the object that this control is showing the
 	//  contents of.
-	GameObject      *containerObject;
+	GameObject      *_containerObject;
 
 	//  Mass and bulk indicators
-	int16           totalMass,
-	                totalBulk;
+	int16           _totalMass,
+	                _totalBulk;
 
 	//  Number of visible objects currently in the container
-	int16           numObjects;
+	int16           _numObjects;
 
 	//  Constructor
 	ContainerView(
@@ -196,8 +196,8 @@ private:
 
 class ReadyContainerView : public ContainerView {
 private:
-	void            **backImages;       // pointers to background imagery
-	int16           numIm;
+	void            **_backImages;       // pointers to background imagery
+	int16           _numIm;
 
 public:
 
@@ -237,8 +237,8 @@ public:
 
 class ContainerWindow : public FloatingWindow {
 protected:
-	GfxCompButton     *closeCompButton;       //  the close button object
-	ContainerView   *view;          //  the container view object
+	GfxCompButton   *_closeCompButton;       //  the close button object
+	ContainerView   *_view;          //  the container view object
 
 public:
 	ContainerWindow(ContainerNode &nd,
@@ -249,7 +249,7 @@ public:
 
 	ContainerView &getView();
 	GameObject *containerObject() {
-		return getView().containerObject;
+		return getView()._containerObject;
 	}
 
 	virtual void massBulkUpdate() {}
@@ -258,7 +258,7 @@ public:
 //  Base class for all container windows with scroll control
 class ScrollableContainerWindow : public ContainerWindow {
 protected:
-	GfxCompButton     *scrollCompButton;
+	GfxCompButton     *_scrollCompButton;
 
 public:
 	ScrollableContainerWindow(ContainerNode &nd,
@@ -266,23 +266,23 @@ public:
 	                          const char saveas[]);
 
 	void scrollUp() {
-		if (view->scrollPosition > 0) view->scrollPosition--;
+		if (_view->_scrollPosition > 0) _view->_scrollPosition--;
 	}
 
 	void scrollDown() {
-		if (view->scrollPosition + view->visibleRows < view->totalRows)
-			view->scrollPosition++;
+		if (_view->_scrollPosition + _view->_visibleRows < _view->_totalRows)
+			_view->_scrollPosition++;
 	}
 };
 
 //  A container window for tangible containers
 class TangibleContainerWindow : public ScrollableContainerWindow {
 private:
-	GfxCompImage      *containerSpriteImg;
-	CMassWeightIndicator *massWeightIndicator;
+	GfxCompImage      *_containerSpriteImg;
+	CMassWeightIndicator *_massWeightIndicator;
 
-	Rect16          objRect;
-	bool            deathFlag;
+	Rect16          _objRect;
+	bool            _deathFlag;
 
 private:
 	void setContainerSprite();
@@ -303,7 +303,7 @@ class IntangibleContainerWindow : public ScrollableContainerWindow {
 protected:
 	friend  void setMindContainer(int index, IntangibleContainerWindow &cw);
 private:
-	GfxMultCompButton *mindSelectorCompButton;
+	GfxMultCompButton *_mindSelectorCompButton;
 
 public:
 
@@ -312,7 +312,7 @@ public:
 
 class EnchantmentContainerWindow : public ContainerWindow {
 protected:
-	GfxCompButton     *scrollCompButton;
+	GfxCompButton     *_scrollCompButton;
 
 public:
 	EnchantmentContainerWindow(ContainerNode &nd,
@@ -378,14 +378,14 @@ public:
 	};
 
 private:
-	ObjectID        object;                 //  Object being viewed
-	uint8           type;                   //  type of container
-	uint8           owner;                  //  which brother owns this container
-	Rect16          position;               //  position of window
-	ContainerWindow *window;                //  window, which may be NULL if hidden.
-	uint8           action;                 //  What action to take on container
+	ObjectID        _object;                 //  Object being viewed
+	uint8           _type;                   //  type of container
+	uint8           _owner;                  //  which brother owns this container
+	Rect16          _position;               //  position of window
+	ContainerWindow *_window;                //  window, which may be NULL if hidden.
+	uint8           _action;                 //  What action to take on container
 public:
-	uint8           mindType;               //  mindContainer type
+	uint8           _mindType;               //  mindContainer type
 
 private:
 	//  Nested structure used to archive ContainerNodes
@@ -400,12 +400,12 @@ private:
 
 public:
 	ContainerNode() {
-		object = 0;
-		type = 0;
-		owner = 0;
-		window = nullptr;
-		action = 0;
-		mindType = 0;
+		_object = 0;
+		_type = 0;
+		_owner = 0;
+		_window = nullptr;
+		_action = 0;
+		_mindType = 0;
 	}
 	ContainerNode(ContainerManager &cl, ObjectID id, int type);
 	~ContainerNode();
@@ -424,18 +424,18 @@ public:
 
 	//  Set for lazy deletion
 	void markForDelete()   {
-		action |= actionDelete;
+		_action |= actionDelete;
 	}
 	void markForShow() {
-		action |= actionShow;
-		action &= ~actionHide;
+		_action |= actionShow;
+		_action &= ~actionHide;
 	}
 	void markForHide() {
-		action |= actionHide;
-		action &= ~actionShow;
+		_action |= actionHide;
+		_action &= ~actionShow;
 	}
 	void markForUpdate()   {
-		action |= actionUpdate;
+		_action |= actionUpdate;
 	}
 
 	//  Find the address of the window and/or view
@@ -444,19 +444,19 @@ public:
 
 	//  Access functions
 	uint8 getType() {
-		return type;
+		return _type;
 	}
 	uint8 getOwnerIndex() {
-		return owner;
+		return _owner;
 	}
 	ObjectID getObject() {
-		return object;
+		return _object;
 	}
 	Rect16 &getPosition() {
-		return position;
+		return _position;
 	}
 	void setObject(ObjectID id) {
-		object = id;
+		_object = id;
 	}
 
 	//  returns true if the object represented by the container can be
diff --git a/engines/saga2/objects.cpp b/engines/saga2/objects.cpp
index 1b132ec3c37..2925c78c6d5 100644
--- a/engines/saga2/objects.cpp
+++ b/engines/saga2/objects.cpp
@@ -4368,13 +4368,13 @@ APPFUNC(cmdBrain) {
 	if (ev.eventType == gEventNewValue) {
 		//WriteStatusF( 4, "Brain Attempt " );
 
-		GameObject          *container = indivCviewTop->containerObject;
+		GameObject          *container = indivCviewTop->_containerObject;
 		ContainerIterator   iter(container);
 		GameObject          *item;
 
 		openMindType = part;
 
-		assert(container == indivCviewBot->containerObject);
+		assert(container == indivCviewBot->_containerObject);
 
 		//  Get the actor's mind container
 		while (iter.next(&item) != Nothing) {


Commit: bdb5066b35c19f86588874711d8a4208148c20a7
    https://github.com/scummvm/scummvm/commit/bdb5066b35c19f86588874711d8a4208148c20a7
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2022-09-25T21:37:26+02:00

Commit Message:
SAGA2: Rename class variables in dice.h

Changed paths:
    engines/saga2/dice.h


diff --git a/engines/saga2/dice.h b/engines/saga2/dice.h
index 232d747bad5..dc9a1a87c2c 100644
--- a/engines/saga2/dice.h
+++ b/engines/saga2/dice.h
@@ -41,19 +41,19 @@ inline int32 diceRoll(int dice, int sides, int perDieMod, int base) {
 }
 
 class RandomDice {
-	int8    dice, side;
+	int8    _dice, _side;
 public:
 	RandomDice(int8 d, int8 s) {
-		dice = d;
-		side = s;
+		_dice = d;
+		_side = s;
 	}
 	RandomDice() {
-		dice = 1;
-		side = 1;
+		_dice = 1;
+		_side = 1;
 	}
 
 	int32 roll(int32 resist = 0) {
-		return diceRoll(dice, side, resist, 0);
+		return diceRoll(_dice, _side, resist, 0);
 	}
 };
 


Commit: f0221d3b8a3e1fff2e0c29d2181fd485108e2055
    https://github.com/scummvm/scummvm/commit/f0221d3b8a3e1fff2e0c29d2181fd485108e2055
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2022-09-25T21:37:26+02:00

Commit Message:
SAGA2: Renamed class variables in dispnode.h

Changed paths:
    engines/saga2/dispnode.cpp
    engines/saga2/dispnode.h
    engines/saga2/spelcast.cpp
    engines/saga2/spellio.cpp


diff --git a/engines/saga2/dispnode.cpp b/engines/saga2/dispnode.cpp
index 9a6a9e301ff..fa3236f1368 100644
--- a/engines/saga2/dispnode.cpp
+++ b/engines/saga2/dispnode.cpp
@@ -35,7 +35,7 @@ namespace Saga2 {
 
 uint8 bubbleColorTable[] = { 1, 0, 0, 0 };
 
-DisplayNode                     *DisplayNodeList::head;
+DisplayNode                     *DisplayNodeList::_head;
 
 bool                            centerActorIndicatorEnabled;
 
@@ -109,48 +109,48 @@ void drawDisplayList() {
 
 void  DisplayNodeList::init(uint16 s) {
 	for (int i = 0; i < s; i++) {
-		displayList[i].efx = nullptr;
-		displayList[i].nextDisplayed = nullptr;
-		displayList[i].object = nullptr;
-		displayList[i].type = nodeTypeObject;
+		_displayList[i]._efx = nullptr;
+		_displayList[i]._nextDisplayed = nullptr;
+		_displayList[i]._object = nullptr;
+		_displayList[i]._type = nodeTypeObject;
 	}
 }
 //-----------------------------------------------------------------------
 // DisplayNode stuff
 
 DisplayNode::DisplayNode() {
-	nextDisplayed = nullptr;
-	sortDepth = 0;
-	object = nullptr;
-	flags = 0;                  // various flags
-	type = nodeTypeObject;
-	efx = nullptr;
+	_nextDisplayed = nullptr;
+	_sortDepth = 0;
+	_object = nullptr;
+	_flags = 0;                  // various flags
+	_type = nodeTypeObject;
+	_efx = nullptr;
 }
 
 TilePoint DisplayNode::SpellPos() {
-	if (efx)
-		return efx->current;
+	if (_efx)
+		return _efx->current;
 	return Nowhere;
 }
 
 
 inline void DisplayNode::updateEffect(const int32 deltaTime) {
-	if (efx)   efx->updateEffect(deltaTime);
+	if (_efx)   _efx->updateEffect(deltaTime);
 }
 
 //-----------------------------------------------------------------------
 //	Update router
 
 void DisplayNodeList::updateOStates(const int32 deltaTime) {
-	if (count)
-		for (uint16 i = 0; i < count; i++)
-			displayList[i].updateObject(deltaTime);
+	if (_count)
+		for (uint16 i = 0; i < _count; i++)
+			_displayList[i].updateObject(deltaTime);
 }
 
 void DisplayNodeList::updateEStates(const int32 deltaTime) {
-	if (count)
-		for (uint16 i = 0; i < count; i++)
-			displayList[i].updateEffect(deltaTime);
+	if (_count)
+		for (uint16 i = 0; i < _count; i++)
+			_displayList[i].updateEffect(deltaTime);
 }
 
 //-----------------------------------------------------------------------
@@ -171,8 +171,8 @@ void DisplayNodeList::draw() {
 			error("Spell sprites have been dumped!\n");
 	}
 
-	for (dn = DisplayNodeList::head; dn; dn = dn->nextDisplayed) {
-		if (dn->type == nodeTypeEffect)
+	for (dn = DisplayNodeList::_head; dn; dn = dn->_nextDisplayed) {
+		if (dn->_type == nodeTypeEffect)
 			dn->drawEffect();
 		else
 			dn->drawObject();
@@ -197,9 +197,9 @@ void DisplayNodeList::buildObjects(bool fromScratch) {
 	//  and put to bed all actors which are too far away from the
 	//  view region.
 
-	for (i = 0; i < count; i++) {
-		DisplayNode *dn = &displayList[i];
-		GameObject  *obj = dn->object;
+	for (i = 0; i < _count; i++) {
+		DisplayNode *dn = &_displayList[i];
+		GameObject  *obj = dn->_object;
 		TilePoint   objLoc = obj->getLocation();
 		int16       dist;
 
@@ -236,7 +236,7 @@ void DisplayNodeList::buildObjects(bool fromScratch) {
 
 	if (fromScratch)
 		//  Reset the list...
-		DisplayNodeList::head = nullptr;
+		DisplayNodeList::_head = nullptr;
 
 	for (id = iter.first(&obj, &dist);
 	        id != Nothing;
@@ -281,45 +281,45 @@ void DisplayNodeList::buildObjects(bool fromScratch) {
 
 	//  Build display nodes for each of the objects.
 
-	count = sortCount;
+	_count = sortCount;
 
 	for (i = 0; i < sortCount; i++) {
-		DisplayNode *dn = &displayList[i];
+		DisplayNode *dn = &_displayList[i];
 		GameObject  *ob = sortList[i];
 		DisplayNode **search;
 		TilePoint oLoc = ob->getLocation();
-		dn->nextDisplayed = nullptr;
-		dn->object = ob;
+		dn->_nextDisplayed = nullptr;
+		dn->_object = ob;
 
-		dn->type = nodeTypeObject;
+		dn->_type = nodeTypeObject;
 
-		dn->flags = 0;
+		dn->_flags = 0;
 		if (centerActorIndicatorEnabled
-		        &&  isActor(dn->object)
-		        && ((Actor *)dn->object) == centerActor)
-			dn->flags |= DisplayNode::displayIndicator;
+		        &&  isActor(dn->_object)
+		        && ((Actor *)dn->_object) == centerActor)
+			dn->_flags |= DisplayNode::displayIndicator;
 
 		//  Various test data
 //		dn->spriteFrame = 0;
 
 		//  Convert object coordinates to screen coords
-		TileToScreenCoords(oLoc, dn->screenCoords);
+		TileToScreenCoords(oLoc, dn->_screenCoords);
 
 		//  REM: At this point we could reject some more off-screen
 		//  objects.
 
 		//  Set the sort depth for this object
-		dn->sortDepth = dn->screenCoords.y + oLoc.z / 2;
+		dn->_sortDepth = dn->_screenCoords.y + oLoc.z / 2;
 
 		//  Find where we belong on the sorted list
-		for (search = &DisplayNodeList::head;
+		for (search = &DisplayNodeList::_head;
 		        *search;
-		        search = &(*search)->nextDisplayed) {
-			if ((*search)->sortDepth >= dn->sortDepth) break;
+		        search = &(*search)->_nextDisplayed) {
+			if ((*search)->_sortDepth >= dn->_sortDepth) break;
 		}
 
 		//  Insert into the sorted list
-		dn->nextDisplayed = *search;
+		dn->_nextDisplayed = *search;
 		*search = dn;
 	}
 }
@@ -328,7 +328,7 @@ void DisplayNodeList::buildObjects(bool fromScratch) {
 //	Update normal objects
 
 void DisplayNode::updateObject(const int32 deltaTime) {
-	GameObject  *obj = object;
+	GameObject  *obj = _object;
 
 	if (obj->isMoving()) return;
 
@@ -356,7 +356,7 @@ void DisplayNode::drawObject() {
 	                rightIndex,             // drawing order of right
 	                partCount;              // number of sprite parts
 	bool            ghostIt = false;
-	GameObject  *obj = object;
+	GameObject  *obj = _object;
 	ProtoObj    *proto = obj->proto();
 	Point16     drawPos;
 	SpriteSet   *ss;
@@ -381,8 +381,8 @@ void DisplayNode::drawObject() {
 		if ((rt = mt->ripTable(g_vm->_currentMapNum)) != nullptr) {
 			if (objCoords.z >= rt->zTable[tCoords.u][tCoords.v]) {
 				//  Disable hit-test on the object's box
-				hitBox.width = -1;
-				hitBox.height = -1;
+				_hitBox.width = -1;
+				_hitBox.height = -1;
 
 				obj->setOnScreen(false);
 				obj->setObscured(false);
@@ -391,10 +391,10 @@ void DisplayNode::drawObject() {
 		}
 	}
 
-	TileToScreenCoords(objCoords, screenCoords);
+	TileToScreenCoords(objCoords, _screenCoords);
 
-	drawPos.x = screenCoords.x + fineScroll.x;
-	drawPos.y = screenCoords.y + fineScroll.y;
+	drawPos.x = _screenCoords.x + fineScroll.x;
+	drawPos.y = _screenCoords.y + fineScroll.y;
 
 	//  If it's an object, then the drawing is fairly straight
 	//  forward.
@@ -407,8 +407,8 @@ void DisplayNode::drawObject() {
 		        || drawPos.y < -32
 		        || drawPos.y > kTileRectY + kTileRectHeight + 100) {
 			//  Disable hit-test on the object's box
-			hitBox.width = -1;
-			hitBox.height = -1;
+			_hitBox.width = -1;
+			_hitBox.height = -1;
 
 			//  Mark as being off screen
 			obj->setOnScreen(false);
@@ -473,8 +473,8 @@ void DisplayNode::drawObject() {
 			objCoords.z = 0;
 
 			//  Disable hit-test on the object's box
-			hitBox.width = -1;
-			hitBox.height = -1;
+			_hitBox.width = -1;
+			_hitBox.height = -1;
 
 			//  Reject any sprites which fall off the edge of the screen.
 			if (drawPos.x < -maxSpriteWidth
@@ -511,8 +511,8 @@ void DisplayNode::drawObject() {
 			        || drawPos.y < -maxSpriteBaseLine
 			        || drawPos.y > kTileRectY + kTileRectHeight + maxSpriteHeight) {
 				//  Disable hit-test on the object's box
-				hitBox.width = -1;
-				hitBox.height = -1;
+				_hitBox.width = -1;
+				_hitBox.height = -1;
 
 				//  Mark as being off screen
 				a->setOnScreen(false);
@@ -523,8 +523,8 @@ void DisplayNode::drawObject() {
 			if (a->hasEffect(actorInvisible)) {
 				if (!isPlayerActor(a)
 				        &&  !(getCenterActor()->hasEffect(actorSeeInvis))) {
-					hitBox.width = -1;
-					hitBox.height = -1;
+					_hitBox.width = -1;
+					_hitBox.height = -1;
 					return;
 				}
 				ghostIt = true;
@@ -780,21 +780,21 @@ void DisplayNode::drawObject() {
 	//  at, in order to facilitate mouse picking functions
 	//  later on in the event loop.
 	bodySprite = scList[bodyIndex].sp;
-	hitBox.x =      drawPos.x
+	_hitBox.x =      drawPos.x
 	                + (scList[bodyIndex].flipped
 	                   ?   -bodySprite->size.x - bodySprite->offset.x
 	                   :   bodySprite->offset.x)
 	                -   fineScroll.x;
-	hitBox.y = drawPos.y + bodySprite->offset.y - fineScroll.y;
-	hitBox.width = bodySprite->size.x;
-	hitBox.height = bodySprite->size.y;
+	_hitBox.y = drawPos.y + bodySprite->offset.y - fineScroll.y;
+	_hitBox.width = bodySprite->size.x;
+	_hitBox.height = bodySprite->size.y;
 
-	if (flags & displayIndicator) {
+	if (_flags & displayIndicator) {
 		Point16     indicatorCoords;
 		gPixelMap   &indicator = *mouseCursors[kMouseCenterActorIndicatorImage];
 
-		indicatorCoords.x = hitBox.x + fineScroll.x + (hitBox.width - indicator.size.x) / 2;
-		indicatorCoords.y = hitBox.y + fineScroll.y - indicator.size.y - 2;
+		indicatorCoords.x = _hitBox.x + fineScroll.x + (_hitBox.width - indicator.size.x) / 2;
+		indicatorCoords.y = _hitBox.y + fineScroll.y - indicator.size.y - 2;
 
 		TBlit(g_vm->_backPort.map, &indicator, indicatorCoords.x, indicatorCoords.y);
 	}
@@ -813,11 +813,11 @@ ObjectID pickObject(const StaticPoint32 &mouse, StaticTilePoint &objPos) {
 	if (objectSet == nullptr)
 		error("Object sprites have been dumped!");
 
-	for (dn = DisplayNodeList::head; dn; dn = dn->nextDisplayed) {
-		if (dn->type == nodeTypeObject) {
-			GameObject  *obj = dn->object;
+	for (dn = DisplayNodeList::_head; dn; dn = dn->_nextDisplayed) {
+		if (dn->_type == nodeTypeObject) {
+			GameObject  *obj = dn->_object;
 
-			if (obj->parent() == currentWorld && dn->hitBox.ptInside(mouse.x, mouse.y)) {
+			if (obj->parent() == currentWorld && dn->_hitBox.ptInside(mouse.x, mouse.y)) {
 				TilePoint   loc = obj->getLocation();
 				int32       newDist = loc.u + loc.v;
 
@@ -829,8 +829,8 @@ ObjectID pickObject(const StaticPoint32 &mouse, StaticTilePoint &objPos) {
 					SpriteSet   *sprPtr = nullptr;
 					bool        flipped = true;
 
-					testPoint.x = mouse.x - dn->hitBox.x;
-					testPoint.y = mouse.y - dn->hitBox.y;
+					testPoint.x = mouse.x - dn->_hitBox.x;
+					testPoint.y = mouse.y - dn->_hitBox.y;
 
 					//  If it's an object, then the test is fairly straight
 					//  forward.
@@ -870,7 +870,7 @@ ObjectID pickObject(const StaticPoint32 &mouse, StaticTilePoint &objPos) {
 
 						testPoint2.y = testPoint.y;
 						minX = MAX(0, testPoint.x - 6);
-						maxX = MIN(dn->hitBox.width - 1, testPoint.x + 6);
+						maxX = MIN(dn->_hitBox.width - 1, testPoint.x + 6);
 
 						//  scan a horizontal strip of the character for a hit.
 						//  If we find a hit, go ahead and set result anyway
@@ -900,28 +900,28 @@ ObjectID pickObject(const StaticPoint32 &mouse, StaticTilePoint &objPos) {
 //         they can also easily be placed in front
 
 void DisplayNodeList::buildEffects(bool) {
-	if (count) {
-		for (int i = 0; i < count; i++) {
-			DisplayNode *dn = DisplayNodeList::head;
+	if (_count) {
+		for (int i = 0; i < _count; i++) {
+			DisplayNode *dn = DisplayNodeList::_head;
 
-			if (displayList[i].efx->isHidden() || displayList[i].efx->isDead())
+			if (_displayList[i]._efx->isHidden() || _displayList[i]._efx->isDead())
 				continue;
 			// make sure it knows it's not a real object
-			displayList[i].type = nodeTypeEffect;
+			_displayList[i]._type = nodeTypeEffect;
 
-			displayList[i].sortDepth = displayList[i].efx->screenCoords.y + displayList[i].efx->current.z / 2;
+			_displayList[i]._sortDepth = _displayList[i]._efx->screenCoords.y + _displayList[i]._efx->current.z / 2;
 			if (dn) {
-				int32 sd = displayList[i].sortDepth;
-				while (dn->nextDisplayed && dn->nextDisplayed->sortDepth <= sd)
-					dn = dn->nextDisplayed;
+				int32 sd = _displayList[i]._sortDepth;
+				while (dn->_nextDisplayed && dn->_nextDisplayed->_sortDepth <= sd)
+					dn = dn->_nextDisplayed;
 			}
 
-			if (dn == DisplayNodeList::head) {
-				displayList[i].nextDisplayed = DisplayNodeList::head;
-				DisplayNodeList::head = &displayList[i];
+			if (dn == DisplayNodeList::_head) {
+				_displayList[i]._nextDisplayed = DisplayNodeList::_head;
+				DisplayNodeList::_head = &_displayList[i];
 			} else {
-				displayList[i].nextDisplayed = dn->nextDisplayed;
-				dn->nextDisplayed = &displayList[i];
+				_displayList[i]._nextDisplayed = dn->_nextDisplayed;
+				dn->_nextDisplayed = &_displayList[i];
 			}
 
 		}
@@ -929,9 +929,9 @@ void DisplayNodeList::buildEffects(bool) {
 }
 
 bool DisplayNodeList::dissipated() {
-	if (count) {
-		for (int i = 0; i < count; i++) {
-			if (displayList[i].efx && !displayList[i].efx->isDead())
+	if (_count) {
+		for (int i = 0; i < _count; i++) {
+			if (_displayList[i]._efx && !_displayList[i]._efx->isDead())
 				return false;
 		}
 	}
@@ -945,7 +945,7 @@ bool DisplayNodeList::dissipated() {
 //         sprites.
 
 void DisplayNode::drawEffect() {
-	if (efx)   efx->drawEffect();
+	if (_efx)   _efx->drawEffect();
 }
 
 void Effectron::drawEffect() {
diff --git a/engines/saga2/dispnode.h b/engines/saga2/dispnode.h
index 6cc4e2e6fa6..6901ae213db 100644
--- a/engines/saga2/dispnode.h
+++ b/engines/saga2/dispnode.h
@@ -50,20 +50,20 @@ class DisplayNode {
 	friend ObjectID pickObject(const StaticPoint32 &mouse, StaticTilePoint &objPos);
 
 private:
-	DisplayNode             *nextDisplayed;         // pointer to next in display list
-	int16                   sortDepth;              // for sorting by depth
-	GameObject              *object;                // the object to display
-	Point16                 screenCoords;           // screen coordinates
-	Rect16                  hitBox;                 // hitbox for clicking this item
-	uint8                   flags;                  // various flags
+	DisplayNode             *_nextDisplayed;         // pointer to next in display list
+	int16                   _sortDepth;              // for sorting by depth
+	GameObject              *_object;                // the object to display
+	Point16                 _screenCoords;           // screen coordinates
+	Rect16                  _hitBox;                 // hitbox for clicking this item
+	uint8                   _flags;                  // various flags
 
 	enum {
 		displayIndicator = (1 << 0)
 	};
 
 public:
-	nodeType                type;
-	Effectron               *efx;
+	nodeType                _type;
+	Effectron               *_efx;
 
 	DisplayNode();
 
@@ -87,27 +87,27 @@ class DisplayNodeList {
 	friend ObjectID pickObject(const StaticPoint32 &mouse, StaticTilePoint &objPos);
 
 public:
-	uint16              count;                  // number of entries in list
-	DisplayNode         *displayList;       // table of displayed objects
-	static DisplayNode  *head;              // head of list
+	uint16              _count;                  // number of entries in list
+	DisplayNode         *_displayList;       // table of displayed objects
+	static DisplayNode  *_head;              // head of list
 
 	DisplayNodeList(uint16 newSize) {
-		displayList = (DisplayNode *)malloc(sizeof(DisplayNode) * newSize);
+		_displayList = (DisplayNode *)malloc(sizeof(DisplayNode) * newSize);
 		init(newSize);
-		count = 0;
+		_count = 0;
 	}
 	DisplayNodeList() {
-		displayList = (DisplayNode *)malloc(sizeof(DisplayNode) * maxDisplayed);
+		_displayList = (DisplayNode *)malloc(sizeof(DisplayNode) * maxDisplayed);
 		init(maxDisplayed);
-		count = 0;
+		_count = 0;
 	}
 	~DisplayNodeList() {
-		free(displayList);
+		free(_displayList);
 	}
 
 	void reset() {
-		count = 0;
-		head = NULL;
+		_count = 0;
+		_head = NULL;
 	}
 
 	void  init(uint16 s);
diff --git a/engines/saga2/spelcast.cpp b/engines/saga2/spelcast.cpp
index 3c362310bb0..a351e2f62c4 100644
--- a/engines/saga2/spelcast.cpp
+++ b/engines/saga2/spelcast.cpp
@@ -633,10 +633,10 @@ SpellInstance::SpellInstance(SpellCaster *newCaster, TilePoint &newTarget, Spell
 SpellInstance::~SpellInstance() {
 	if (age < implementAge && g_vm->_gameRunning)
 		spellBook[spell].implement(caster, target);
-	for (int32 i = 0; i < eList.count; i++) {
-		if (eList.displayList[i].efx)
-			delete eList.displayList[i].efx;
-		eList.displayList[i].efx = nullptr;
+	for (int32 i = 0; i < eList._count; i++) {
+		if (eList._displayList[i]._efx)
+			delete eList._displayList[i]._efx;
+		eList._displayList[i]._efx = nullptr;
 	}
 	if (target)
 		delete target;
@@ -670,11 +670,11 @@ void SpellInstance::init() {
 // common cleanup
 
 void SpellInstance::termEffect() {
-	if (eList.count)
-		for (int32 i = 0; i < eList.count; i++) {
-			if (eList.displayList[i].efx) {
-				delete eList.displayList[i].efx;
-				eList.displayList[i].efx = nullptr;
+	if (eList._count)
+		for (int32 i = 0; i < eList._count; i++) {
+			if (eList._displayList[i]._efx) {
+				delete eList._displayList[i]._efx;
+				eList._displayList[i]._efx = nullptr;
 			}
 		}
 }
@@ -683,11 +683,11 @@ void SpellInstance::termEffect() {
 // visual init
 
 void SpellInstance::initEffect(TilePoint startpoint) {
-	eList.count = effect->nodeCount; //sdp->effCount;
-	if (eList.count)
-		for (int32 i = 0; i < eList.count; i++) {
+	eList._count = effect->nodeCount; //sdp->effCount;
+	if (eList._count)
+		for (int32 i = 0; i < eList._count; i++) {
 			Effectron *e = new Effectron(0, i);
-			eList.displayList[i].efx = e;
+			eList._displayList[i]._efx = e;
 			e->parent = this;
 			e->start = startpoint;
 			e->current = startpoint;
diff --git a/engines/saga2/spellio.cpp b/engines/saga2/spellio.cpp
index cebca63e560..47f9f9be4d9 100644
--- a/engines/saga2/spellio.cpp
+++ b/engines/saga2/spellio.cpp
@@ -265,7 +265,7 @@ StorageSpellInstance::StorageSpellInstance(SpellInstance &si) {
 	spell = si.spell;
 	maxAge = si.maxAge;
 	effSeq = si.effSeq;         // which effect in a sequence is being played
-	eListSize = si.eList.count;
+	eListSize = si.eList._count;
 }
 
 StorageSpellTarget::StorageSpellTarget() {
@@ -420,30 +420,30 @@ void SpellDisplayList::wipe() {
 size_t SpellInstance::saveSize() {
 	size_t total = 0;
 	total += sizeof(StorageSpellInstance);
-	if (eList.count)
-		for (int32 i = 0; i < eList.count; i++) {
+	if (eList._count)
+		for (int32 i = 0; i < eList._count; i++) {
 			total += sizeof(StorageEffectron);
 		}
 	return total;
 }
 
 void SpellInstance::writeEffect(Common::MemoryWriteStreamDynamic *out) {
-	if (eList.count > 0 && !(maxAge > 0 && (age + 1) > maxAge))
-		for (int32 i = 0; i < eList.count; i++) {
-			StorageEffectron se = StorageEffectron(*eList.displayList[i].efx);
+	if (eList._count > 0 && !(maxAge > 0 && (age + 1) > maxAge))
+		for (int32 i = 0; i < eList._count; i++) {
+			StorageEffectron se = StorageEffectron(*eList._displayList[i]._efx);
 			se.write(out);
 		}
 }
 
 void SpellInstance::readEffect(Common::InSaveFile *in, uint16 eListSize) {
 	assert(eListSize == effect->nodeCount);
-	eList.count = effect->nodeCount; //sdp->effCount;
-	if (eList.count)
-		for (int32 i = 0; i < eList.count; i++) {
+	eList._count = effect->nodeCount; //sdp->effCount;
+	if (eList._count)
+		for (int32 i = 0; i < eList._count; i++) {
 			StorageEffectron se;
 			se.read(in);
 			Effectron *e = new Effectron(se, this);
-			eList.displayList[i].efx = e;
+			eList._displayList[i]._efx = e;
 		}
 }
 


Commit: 8527a03f0aaaab5e936b910a09e6d3a35344baa2
    https://github.com/scummvm/scummvm/commit/8527a03f0aaaab5e936b910a09e6d3a35344baa2
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2022-09-25T21:37:27+02:00

Commit Message:
SAGA2: Rename class variables in document.h

Changed paths:
    engines/saga2/document.cpp
    engines/saga2/document.h


diff --git a/engines/saga2/document.cpp b/engines/saga2/document.cpp
index 6065abd1612..485ebd5974f 100644
--- a/engines/saga2/document.cpp
+++ b/engines/saga2/document.cpp
@@ -141,54 +141,54 @@ CDocument::CDocument(CDocumentAppearance &dApp,
                      gFont           *font,          // font of the text
                      uint16          ident,          // control ID
                      AppFunc         *cmd)           // application command func
-	: app(dApp), ModalWindow(dApp.windowPos, ident, cmd) {
+	: _app(dApp), ModalWindow(dApp.windowPos, ident, cmd) {
 	// resource handle
 	hResContext     *decRes;
 
 	// init the resource context handle
-	decRes = resFile->newContext(app.groupID, "docimage context");
+	decRes = resFile->newContext(_app.groupID, "docimage context");
 
 	// init con pointer to NULL
-	illustrationCon = nullptr;
+	_illustrationCon = nullptr;
 
 	// set the maxium string length
-	maxSize = maxPages * maxLines * maxChars;
+	_maxSize = maxPages * maxLines * maxChars;
 
 	// get the org text size
-	textSize = clamp(0, strlen(buffer), maxSize);
+	_textSize = clamp(0, strlen(buffer), _maxSize);
 
 	// set the original text pointer
-	origText = new char[textSize + 1];
+	origText = new char[_textSize + 1];
 
 	// and fill it
-	Common::strlcpy(origText, buffer, textSize + 1);
+	Common::strlcpy(origText, buffer, _textSize + 1);
 
 	// make a working buffer
-	text = new char[textSize + 1];
+	text = new char[_textSize + 1];
 
 	// and fill it
-	Common::strlcpy(text, origText, textSize + 1);
+	Common::strlcpy(text, origText, _textSize + 1);
 
-	textFont        = font;
-	textHeight      = (textFont ? textFont->height : 0);
-	lineWidth       = dApp.pageRect[0].width;
-	pageHeight      = dApp.pageRect[0].height;
-	currentPage     = 0;
-	totalLines      = 0;
-	totalPages      = 0;
-	pageBreakSet    = true;
+	_textFont        = font;
+	_textHeight      = (_textFont ? _textFont->height : 0);
+	_lineWidth       = dApp.pageRect[0].width;
+	_pageHeight      = dApp.pageRect[0].height;
+	_currentPage     = 0;
+	_totalLines      = 0;
+	_totalPages      = 0;
+	_pageBreakSet    = true;
 
 	// null out the image pointer array
 	for (int16 i = 0; i < maxPages; i++) {
-		images[i] = nullptr;
+		_images[i] = nullptr;
 	}
 
 	makePages();
 
 	// attach the graphics for the book
-	setDecorations(app.decoList,
-	               app.numDecos,
-	               decRes, app.decoID);
+	setDecorations(_app.decoList,
+	               _app.numDecos,
+	               decRes, _app.decoID);
 
 	// remove the resource handle
 	if (decRes) resFile->disposeContext(decRes);
@@ -201,8 +201,8 @@ CDocument::~CDocument() {
 	int16   i;
 
 	for (i = 0; i < maxPages; i++) {
-		if (images[i]) {
-			free(images[i]);
+		if (_images[i]) {
+			free(_images[i]);
 		}
 	}
 
@@ -218,8 +218,8 @@ CDocument::~CDocument() {
 	}
 
 	// get rid of the resource context
-	if (illustrationCon)
-		resFile->disposeContext(illustrationCon);
+	if (_illustrationCon)
+		resFile->disposeContext(_illustrationCon);
 }
 
 void CDocument::deactivate() {
@@ -279,7 +279,7 @@ void CDocument::pointerMove(gPanelMessage &msg) {
 	Point16 pos     = msg.pickPos;
 
 	if (msg.inPanel && Rect16(0, 0, _extent.width, _extent.height).ptInside(pos)) {
-		if (app.orientation == pageOrientVertical) {
+		if (_app.orientation == pageOrientVertical) {
 			// find out which end of the book we're on
 			if (pos.y < _extent.height / 2)   setMouseImage(kMousePgUpImage,   -7, -7);
 			else                            setMouseImage(kMousePgDownImage, -7, -7);
@@ -306,14 +306,14 @@ bool CDocument::pointerHit(gPanelMessage &msg) {
 
 	if (msg.inPanel && Rect16(0, 0, _extent.width, _extent.height).ptInside(pos)) {
 		gEvent ev;
-		if (app.orientation == pageOrientVertical) {
+		if (_app.orientation == pageOrientVertical) {
 			// find out which end of the book we're on
-			if (pos.y < _extent.height / 2)   cmdDocumentUp(ev); //gotoPage( currentPage - app.numPages );
-			else                            cmdDocumentDn(ev); //gotoPage( currentPage + app.numPages );
+			if (pos.y < _extent.height / 2)   cmdDocumentUp(ev); //gotoPage( _currentPage - _app.numPages );
+			else                            cmdDocumentDn(ev); //gotoPage( _currentPage + _app.numPages );
 		} else {
 			// find out which side of the book we're on
-			if (pos.x < _extent.width / 2)    cmdDocumentLt(ev); //gotoPage( currentPage - app.numPages );
-			else                            cmdDocumentRt(ev); //gotoPage( currentPage + app.numPages );
+			if (pos.x < _extent.width / 2)    cmdDocumentLt(ev); //gotoPage( _currentPage - _app.numPages );
+			else                            cmdDocumentRt(ev); //gotoPage( _currentPage + _app.numPages );
 		}
 	} else {
 		// mouse hit outside book area, close book
@@ -338,10 +338,10 @@ bool CDocument::pointerHit(gPanelMessage &msg) {
 void CDocument::gotoPage(int8 page) {
 	page = clamp(0, page, maxPages);
 
-	while (page % app.numPages) page++;
+	while (page % _app.numPages) page++;
 
-	if (page != currentPage && page < pages) {
-		currentPage = page;
+	if (page != _currentPage && page < _pages) {
+		_currentPage = page;
 		renderText();
 	}
 }
@@ -363,8 +363,8 @@ bool CDocument::checkForPageBreak(char *string, uint16 index, int32 &offset) {
 		// eat the page breaks chars
 		// tie off the end
 		strIndex[0] = 0;
-		strAfter = new char[textSize];
-		Common::strlcpy(strAfter, &strIndex[3], textSize);
+		strAfter = new char[_textSize];
+		Common::strlcpy(strAfter, &strIndex[3], _textSize);
 
 		// string them together
 		strcat(&strIndex[0], strAfter);
@@ -391,7 +391,7 @@ bool CDocument::checkForImage(char      *string,
 
 
 	// if there was not just a page break
-	if (!pageBreakSet) {
+	if (!_pageBreakSet) {
 		// then the images are going to end up on the next page
 		offPageIndex++;
 	}
@@ -404,10 +404,10 @@ bool CDocument::checkForImage(char      *string,
 		char    *argv = &strIndex[2 + 1];  // array to first element
 
 		// delete context
-		if (illustrationCon) resFile->disposeContext(illustrationCon);
+		if (_illustrationCon) resFile->disposeContext(_illustrationCon);
 
 		// resource handle
-		illustrationCon = resFile->newContext(MKTAG(argv[0], argv[1], argv[2], argv[3]),
+		_illustrationCon = resFile->newContext(MKTAG(argv[0], argv[1], argv[2], argv[3]),
 		                                      "book internal resources");
 		// set image for next page
 		if (offPageIndex < maxPages) {
@@ -418,9 +418,9 @@ bool CDocument::checkForImage(char      *string,
 				uint8   num         = atoi(numSt);
 
 
-				if (!images[offPageIndex]) {
+				if (!_images[offPageIndex]) {
 					// get the image
-					images[offPageIndex] = LoadResource(illustrationCon,
+					_images[offPageIndex] = LoadResource(_illustrationCon,
 					                                      MKTAG(argv[4], argv[5], argv[6], num),
 					                                      "book internal image");
 				}
@@ -428,14 +428,14 @@ bool CDocument::checkForImage(char      *string,
 				// number of chars to eat
 				numEat = 9;
 			} else {
-				images[offPageIndex] = LoadResource(illustrationCon,
+				_images[offPageIndex] = LoadResource(_illustrationCon,
 				                                      MKTAG(argv[4], argv[5], argv[6], argv[7]),
 				                                      "book internal image");
 				numEat = 8;
 			}
 
 			// get the size of the image
-			imageSizes[offPageIndex] = ((ImageHeader *)images[offPageIndex])->size;
+			_imageSizes[offPageIndex] = ((ImageHeader *)_images[offPageIndex])->size;
 
 			// tie off the end
 			strIndex[0] = 0;
@@ -447,8 +447,8 @@ bool CDocument::checkForImage(char      *string,
 			offset = index;
 
 			// set the line offset
-			lineOffset[offPageIndex] =
-				imageSizes[offPageIndex].y / (textHeight + 1) +
+			_lineOffset[offPageIndex] =
+				_imageSizes[offPageIndex].y / (_textHeight + 1) +
 				textPictureOffset;
 		} else {
 			warning("CDocument: Document overflow");
@@ -464,14 +464,14 @@ bool CDocument::checkForImage(char      *string,
 
 void CDocument::makePages() {
 	// copy the original text back to the working buffer
-	Common::strlcpy(text, origText, textSize + 1);
+	Common::strlcpy(text, origText, _textSize + 1);
 
 
 	char    *str            = text;
 	int32   offset          = 0;
 	uint16  lineIndex       = 0;
 	uint16  pageIndex       = 0;
-	uint16  linesPerPage    = pageHeight / (textHeight + 1);
+	uint16  linesPerPage    = _pageHeight / (_textHeight + 1);
 	uint16  dummy;
 	uint16  i;
 	bool    newPage         = false;
@@ -481,7 +481,7 @@ void CDocument::makePages() {
 		while (offset >= 0 &&
 		        lineIndex < linesPerPage &&
 		        !newPage) {
-			offset = GTextWrap(textFont, str, dummy, lineWidth, 0);
+			offset = GTextWrap(_textFont, str, dummy, _lineWidth, 0);
 
 			// check for page breaks and images
 			for (i = 0; i <= offset; i++) {
@@ -490,43 +490,43 @@ void CDocument::makePages() {
 					// page break check
 					if (checkForPageBreak(str, i, offset)) {
 						// if a break did not just occur
-						if (!pageBreakSet) {
+						if (!_pageBreakSet) {
 							newPage         = true;
-							pageBreakSet    = true;
+							_pageBreakSet    = true;
 						} else {
 							// eat the newPage and
 							// reset the flag for a just set break
-							pageBreakSet = false;
+							_pageBreakSet = false;
 						}
 					}
 
 					// image check
 					if (checkForImage(str, i, pageIndex, offset)) {
 						// if a break did not just occur
-						if (!pageBreakSet) {
+						if (!_pageBreakSet) {
 							newPage         = true;
-							pageBreakSet    = true;
+							_pageBreakSet    = true;
 						} else {
 							// eat the newPage and
 							// reset the flag for a just set break
-							pageBreakSet = false;
+							_pageBreakSet = false;
 						}
 
-						lineIndex   = lineOffset[pageIndex];
+						lineIndex   = _lineOffset[pageIndex];
 					}
 				}
 
 				// we got token that was not a page break so reset the flag
-				pageBreakSet = false;
+				_pageBreakSet = false;
 			}
 
 			// set the length of this line
 			if (offset >= 0) {
 				// number of characters on this line
-				lineLen[pageIndex][lineIndex] = offset;
+				_lineLen[pageIndex][lineIndex] = offset;
 			} else {
 				// remaining number of characters in string
-				lineLen[pageIndex][lineIndex] = strlen(str);
+				_lineLen[pageIndex][lineIndex] = strlen(str);
 			}
 
 
@@ -535,14 +535,14 @@ void CDocument::makePages() {
 			lineIndex++;
 		}
 
-		numLines[pageIndex] = lineIndex;
+		_numLines[pageIndex] = lineIndex;
 		pageIndex++;
 		newPage     = false;
 
 		lineIndex = 0;
 	}
 
-	pages = pageIndex;
+	_pages = pageIndex;
 }
 
 // This function will draw the text onto the book.
@@ -551,10 +551,10 @@ void CDocument::renderText() {
 	gPort           &port = window.windowPort;
 	uint16          pageIndex;
 	uint16          lineIndex;
-	uint16          linesPerPage = pageHeight / (textHeight + 1);
+	uint16          linesPerPage = _pageHeight / (_textHeight + 1);
 	char            *str = text;
 
-	assert(textFont);
+	assert(_textFont);
 
 	Rect16  bltRect(0, 0, _extent.width, _extent.height);
 
@@ -574,59 +574,59 @@ void CDocument::renderText() {
 		            Point16(_extent.x, _extent.y),
 		            Rect16(0, 0, _extent.width, _extent.height));
 
-		tPort.setFont(textFont);         // setup the string pointer
-		for (pageIndex = 0; pageIndex < currentPage; pageIndex++) {
-			if (images[pageIndex]) {
-				lineIndex = lineOffset[pageIndex];
+		tPort.setFont(_textFont);         // setup the string pointer
+		for (pageIndex = 0; pageIndex < _currentPage; pageIndex++) {
+			if (_images[pageIndex]) {
+				lineIndex = _lineOffset[pageIndex];
 
 				assert(lineIndex < linesPerPage);
 			} else {
 				lineIndex = 0;
 			}
 
-			for (; lineIndex < numLines[pageIndex]; lineIndex++) {
-				int16   temp = lineLen[pageIndex][lineIndex];
+			for (; lineIndex < _numLines[pageIndex]; lineIndex++) {
+				int16   temp = _lineLen[pageIndex][lineIndex];
 
 				assert(pageIndex < maxPages);
 				assert(temp < 35);
 
-				str += lineLen[pageIndex][lineIndex];
+				str += _lineLen[pageIndex][lineIndex];
 			}
 		}
 
 		// draw the text onto the pages of the book
-		for (pageIndex = currentPage;
-		        pageIndex - currentPage < app.numPages && pageIndex < pages;
+		for (pageIndex = _currentPage;
+		        pageIndex - _currentPage < _app.numPages && pageIndex < _pages;
 		        pageIndex++) {
-			StaticRect *pageRect = &app.pageRect[pageIndex % app.numPages];
+			StaticRect *pageRect = &_app.pageRect[pageIndex % _app.numPages];
 
 			// if there is an image on this page
-			if (images[pageIndex]) {
+			if (_images[pageIndex]) {
 				Point16 pos;
 
-				pos.x = pageRect->x + (pageRect->width - imageSizes[pageIndex].x) / 2;
+				pos.x = pageRect->x + (pageRect->width - _imageSizes[pageIndex].x) / 2;
 				pos.y = pageRect->y;
 
-				drawCompressedImage(tPort, pos, images[pageIndex]);
+				drawCompressedImage(tPort, pos, _images[pageIndex]);
 
-				lineIndex = lineOffset[pageIndex];
+				lineIndex = _lineOffset[pageIndex];
 			} else {
 				lineIndex = 0;
 			}
 
-			for (; lineIndex < numLines[pageIndex]; lineIndex++) {
+			for (; lineIndex < _numLines[pageIndex]; lineIndex++) {
 				assert(pageIndex <= maxPages);
 
-				tPort.moveTo(pageRect->x, pageRect->y + (textHeight * lineIndex) + 1);
-				tPort.setColor(app.textColors[lineIndex]);
-				tPort.drawText(str, lineLen[pageIndex][lineIndex]);
+				tPort.moveTo(pageRect->x, pageRect->y + (_textHeight * lineIndex) + 1);
+				tPort.setColor(_app.textColors[lineIndex]);
+				tPort.drawText(str, _lineLen[pageIndex][lineIndex]);
 
 				// grab the next text offset
-				int16 temp = lineLen[pageIndex][lineIndex];
+				int16 temp = _lineLen[pageIndex][lineIndex];
 
 				assert(temp < 35);
 
-				str += lineLen[pageIndex][lineIndex];
+				str += _lineLen[pageIndex][lineIndex];
 			}
 		}
 
@@ -678,13 +678,13 @@ void CDocument::draw() {         // redraw the window
    Text buffer
  * ===================================================================== */
 
-const int       textSize = 4096;
-char            bookText[textSize] = { "" };
+const int       _textSize = 4096;
+char            bookText[_textSize] = { "" };
 
 void appendBookText(char *string) {
 	if (string) {
-		Common::strlcat(bookText, string, textSize - 1);
-		bookText[textSize - 1] = 0;
+		Common::strlcat(bookText, string, _textSize - 1);
+		bookText[_textSize - 1] = 0;
 	}
 }
 
@@ -887,19 +887,19 @@ APPFUNCV(CDocument::cmdDocumentEsc) {
 }
 
 APPFUNCV(CDocument::cmdDocumentLt) {
-	gotoPage(currentPage - app.numPages);    //draw();
+	gotoPage(_currentPage - _app.numPages);    //draw();
 }
 
 APPFUNCV(CDocument::cmdDocumentRt) {
-	gotoPage(currentPage + app.numPages);   //draw();
+	gotoPage(_currentPage + _app.numPages);   //draw();
 }
 
 APPFUNCV(CDocument::cmdDocumentUp) {
-	gotoPage(currentPage - app.numPages);   //draw();
+	gotoPage(_currentPage - _app.numPages);   //draw();
 }
 
 APPFUNCV(CDocument::cmdDocumentDn) {
-	gotoPage(currentPage + app.numPages);   //draw();
+	gotoPage(_currentPage + _app.numPages);   //draw();
 }
 
 } // end of namespace Saga2
diff --git a/engines/saga2/document.h b/engines/saga2/document.h
index 66da6394524..ffbeb9cc330 100644
--- a/engines/saga2/document.h
+++ b/engines/saga2/document.h
@@ -90,34 +90,34 @@ private:
 		int8        data[2];
 	};
 
-	CDocumentAppearance &app;
+	CDocumentAppearance &_app;
 
 	// image poiner array
-	void            *images[maxPages];
+	void            *_images[maxPages];
 
-	uint16          currentPage,
-	                lineWidth,
-	                pageHeight,
-	                totalLines,
-	                totalPages;
+	uint16          _currentPage,
+	                _lineWidth,
+	                _pageHeight,
+	                _totalLines,
+	                _totalPages;
 
-	gFont           *textFont;
-	uint16          textHeight;
-	uint16          pages;
-	uint16          numLines[maxPages];
-	uint16          lineLen[maxPages][maxLines];
-	uint16          lineOffset[maxPages];
-	Extent16        imageSizes[maxPages];
-	bool            pageBreakSet;
+	gFont           *_textFont;
+	uint16          _textHeight;
+	uint16          _pages;
+	uint16          _numLines[maxPages];
+	uint16          _lineLen[maxPages][maxLines];
+	uint16          _lineOffset[maxPages];
+	Extent16        _imageSizes[maxPages];
+	bool            _pageBreakSet;
 
-	char            *scan;                  // for parsing book text.
+	char            *_scan;                  // for parsing book text.
 
 	// string sizes
-	uint16  maxSize;
-	uint16  textSize;
+	uint16  _maxSize;
+	uint16  _textSize;
 
 	// image context
-	hResContext *illustrationCon;
+	hResContext *_illustrationCon;
 
 private:
 	bool activate(gEventType why);       // activate the control


Commit: fe4aca8cd298799232b34da15ade4d373b371a7e
    https://github.com/scummvm/scummvm/commit/fe4aca8cd298799232b34da15ade4d373b371a7e
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2022-09-25T21:37:27+02:00

Commit Message:
SAGA2: Rename class variables in effect.h

Changed paths:
    engines/saga2/effects.cpp
    engines/saga2/effects.h
    engines/saga2/spelcast.cpp
    engines/saga2/spellio.cpp


diff --git a/engines/saga2/effects.cpp b/engines/saga2/effects.cpp
index 5be67865e80..9d3e4b72127 100644
--- a/engines/saga2/effects.cpp
+++ b/engines/saga2/effects.cpp
@@ -72,20 +72,20 @@ int16 ProtoDamage::getRelevantStat(effectDamageTypes dt, Actor *a) {
 }
 
 // ------------------------------------------------------------------
-// Cause damage to something based on a damage proto-effect
+// Cause damage to something _based on a damage proto-effect
 
 void ProtoDamage::implement(GameObject *cst, SpellTarget *trg, int8 deltaDamage) {
 	int8 totalDice;
 	int8 totalBase;
 	if (isActor(cst)) {
 		Actor *a = (Actor *) cst;
-		totalDice = dice + skillDice * getRelevantStat(type, a);
-		totalBase = base + skillBase * getRelevantStat(type, a);
+		totalDice = _dice + _skillDice * getRelevantStat(_type, a);
+		totalBase = _base + _skillBase * getRelevantStat(_type, a);
 		if (totalDice > 0 && trg->getObject() && isActor(trg->getObject()))
 			offensiveNotification(a, (Actor *) trg->getObject());
 	} else {
-		totalDice = dice;
-		totalBase = base;
+		totalDice = _dice;
+		totalBase = _base;
 		ObjectID pID = cst->possessor();
 		if (pID != Nothing) {
 			Actor *p = (Actor *) GameObject::objectAddress(pID);
@@ -98,14 +98,14 @@ void ProtoDamage::implement(GameObject *cst, SpellTarget *trg, int8 deltaDamage)
 	totalBase -= deltaDamage;
 
 	assert(trg->getType() == SpellTarget::spellTargetObject);
-	if (self)
-		cst->acceptDamage(cst->thisID(), totalBase, type, totalDice, sides);
+	if (_self)
+		cst->acceptDamage(cst->thisID(), totalBase, _type, totalDice, _sides);
 	else
-		trg->getObject()->acceptDamage(cst->thisID(), totalBase, type, totalDice, sides);
+		trg->getObject()->acceptDamage(cst->thisID(), totalBase, _type, totalDice, _sides);
 }
 
 // ------------------------------------------------------------------
-// drain something based on a drainage proto-effect
+// drain something _based on a drainage proto-effect
 
 int16 ProtoDrainage::currentLevel(Actor *a, effectDrainsTypes edt) {
 	switch (edt) {
@@ -165,12 +165,12 @@ void ProtoDrainage::implement(GameObject *cst, SpellTarget *trg, int8) {
 	Actor *ac;
 	if (isActor(cst)) {
 		ac = (Actor *) cst;
-		totalDice = dice + skillDice * ac->getStats()->spellcraft;
+		totalDice = _dice + _skillDice * ac->getStats()->spellcraft;
 		if (totalDice > 0 && trg->getObject() && isActor(trg->getObject()))
 			offensiveNotification(ac, (Actor *) trg->getObject());
 	} else {
 		ac = nullptr;
-		totalDice = dice + 6;
+		totalDice = _dice + 6;
 		ObjectID pID = cst->possessor();
 		if (pID != Nothing) {
 			Actor *p = (Actor *) GameObject::objectAddress(pID);
@@ -184,7 +184,7 @@ void ProtoDrainage::implement(GameObject *cst, SpellTarget *trg, int8) {
 
 	if (!(trg->getType() == SpellTarget::spellTargetObject))
 		return;
-	GameObject *target = self ? cst : trg->getObject();
+	GameObject *target = _self ? cst : trg->getObject();
 	if (!isActor(target))
 		return;
 	a = (Actor *) target;
@@ -193,15 +193,15 @@ void ProtoDrainage::implement(GameObject *cst, SpellTarget *trg, int8) {
 
 	if (totalDamage > 0 && target->makeSavingThrow())
 		totalDamage /= 2;
-	totalDamage = clamp(0, totalDamage, currentLevel(a, type));
+	totalDamage = clamp(0, totalDamage, currentLevel(a, _type));
 
-	drainLevel(cst, a, type, totalDamage);
+	drainLevel(cst, a, _type, totalDamage);
 	if (ac != nullptr)
-		drainLevel(cst, ac, type, -totalDamage);
+		drainLevel(cst, ac, _type, -totalDamage);
 }
 
 // ------------------------------------------------------------------
-// enchant something based on an enchantment proto-effect
+// enchant something _based on an enchantment proto-effect
 
 bool ProtoEnchantment::realSavingThrow(Actor *a) {
 	uint32 power = (a->getBaseStats())->vitality;
@@ -215,30 +215,30 @@ bool ProtoEnchantment::realSavingThrow(Actor *a) {
 void ProtoEnchantment::implement(GameObject *cst, SpellTarget *trg, int8) {
 	if (isActor(trg->getObject())) {
 		// can someone be angry at a wand?
-		if (isHarmful(enchID)) {
+		if (isHarmful(_enchID)) {
 			if (isActor(cst)) {
-				offensiveNotification((Actor *) cst, (Actor *) trg->getObject());
+				offensiveNotification((Actor *)cst, (Actor *) trg->getObject());
 			} else {
 				ObjectID pID = cst->possessor();
 				if (pID != Nothing) {
 					Actor *p = (Actor *) GameObject::objectAddress(pID);
 					assert(isActor(p));
-					offensiveNotification(p, (Actor *) trg->getObject());
+					offensiveNotification(p, (Actor *)trg->getObject());
 				}
 			}
 		}
 
 
 		if (((Actor *)(trg->getObject()))->hasEffect(actorNoEnchant) &&
-		        isHarmful(enchID))
+		        isHarmful(_enchID))
 			return;
 		if (canFail() && realSavingThrow((Actor *)(trg->getObject())))
 			return;
 	}
 
-	if (isHarmful(enchID) && trg->getObject()->makeSavingThrow())
+	if (isHarmful(_enchID) && trg->getObject()->makeSavingThrow())
 		return;
-	EnchantObject(trg->getObject()->thisID(), enchID, minEnch + dice.roll());
+	EnchantObject(trg->getObject()->thisID(), _enchID, _minEnch + _dice.roll());
 }
 
 // ------------------------------------------------------------------
@@ -247,12 +247,12 @@ void ProtoEnchantment::implement(GameObject *cst, SpellTarget *trg, int8) {
 void ProtoTAGEffect::implement(GameObject *cst, SpellTarget *trg, int8) {
 	ActiveItem *tag = trg->getTAG();
 	assert(tag);
-	if (affectBit == settagLocked) {
+	if (_affectBit == settagLocked) {
 		//if ( tag->builtInBehavior()==ActiveItem::builtInDoor )
-		if (tag->isLocked() != onOff)
+		if (tag->isLocked() != _onOff)
 			tag->acceptLockToggle(cst->thisID(), tag->lockType());
-	} else if (affectBit == settagOpen) {
-		tag->trigger(cst->thisID(), onOff);
+	} else if (_affectBit == settagOpen) {
+		tag->trigger(cst->thisID(), _onOff);
 	}
 }
 
@@ -263,7 +263,7 @@ void ProtoObjectEffect::implement(GameObject *, SpellTarget *trg, int8) {
 	GameObject *go = trg->getObject();
 	assert(go);
 	if (!isActor(go))
-		EnchantObject(go->thisID(), affectBit, dice.roll());
+		EnchantObject(go->thisID(), _affectBit, _dice.roll());
 }
 
 // ------------------------------------------------------------------
@@ -278,8 +278,8 @@ void ProtoLocationEffect::implement(GameObject *, SpellTarget *, int8) {
 // use a special spell on something
 
 void ProtoSpecialEffect::implement(GameObject *cst, SpellTarget *trg, int8) {
-	assert(handler);
-	(*handler)(cst, trg);
+	assert(_handler);
+	(*_handler)(cst, trg);
 }
 
 /* ===================================================================== *
@@ -301,7 +301,7 @@ bool ProtoEnchantment::applicable(SpellTarget &trg) {
 	return (trg.getType() == SpellTarget::spellTargetObject ||
 	        trg.getType() == SpellTarget::spellTargetObjectPoint) &&
 	       (isActor(trg.getObject()) ||
-	        getEnchantmentSubType(enchID) == actorInvisible);
+	        getEnchantmentSubType(_enchID) == actorInvisible);
 }
 
 bool ProtoTAGEffect::applicable(SpellTarget &trg) {
diff --git a/engines/saga2/effects.h b/engines/saga2/effects.h
index b826506bf89..7dad47bdc97 100644
--- a/engines/saga2/effects.h
+++ b/engines/saga2/effects.h
@@ -350,14 +350,14 @@ class ProtoEffect {
 	//int imp;                // enchant or immediate
 
 public:
-	ProtoEffect *next;                      // pointer to additional effects
+	ProtoEffect *_next;                      // pointer to additional effects
 
 	ProtoEffect() {
-		next = NULL;
+		_next = NULL;
 	}
 	virtual ~ProtoEffect() {
-		if (next) delete next;
-		next = NULL;
+		if (_next) delete _next;
+		_next = NULL;
 	}
 	//int implementation( void ) { return imp; }
 	virtual bool applicable(SpellTarget &) {
@@ -372,24 +372,24 @@ public:
 //   This class of effects does a range of damage to the target
 
 class ProtoDamage: public ProtoEffect {
-	effectDamageTypes   type;               // damage type
-	int8                dice,               // # of dice to roll
-	                    sides,              // # of sides on dice
-	                    skillDice,          // multiply by spellcraft to get additional dice
-	                    base,               // absolute damage amount
-	                    skillBase;               // absolute damage amount
-	int8                self;               // casts at self
+	effectDamageTypes   _type;               // damage type
+	int8                _dice,               // # of dice to roll
+	                    _sides,              // # of sides on dice
+	                    _skillDice,          // multiply by spellcraft to get additional dice
+	                    _base,               // absolute damage amount
+	                    _skillBase;          // absolute damage amount
+	int8                _self;               // casts at self
 
 public:
 
 	ProtoDamage(int8 d, int8 s, int8 sd, int8 b, effectDamageTypes t, int, bool afSelf = false, int8 sb = 0) {
-		type = t;
-		dice = d;
-		sides = s;
-		skillDice = sd;
-		base = b;
-		self = afSelf;
-		skillBase = sb;
+		_type = t;
+		_dice = d;
+		_sides = s;
+		_skillDice = sd;
+		_base = b;
+		_self = afSelf;
+		_skillBase = sb;
 	}
 
 	bool applicable(SpellTarget &trg);
@@ -405,22 +405,22 @@ public:
 //   mana, money or food supply
 
 class ProtoDrainage: public ProtoEffect {
-	effectDrainsTypes   type;               // damage type
-	int8                dice,               // # of dice to roll
-	                    sides,              // # of sides on dice
-	                    skillDice,          // multiply by spellcraft to get additional dice
-	                    base;               // absolute damage amount
-	int8                self;               // casts at self
+	effectDrainsTypes   _type;               // damage type
+	int8                _dice,               // # of dice to roll
+	                    _sides,              // # of sides on dice
+	                    _skillDice,          // multiply by spellcraft to get additional dice
+	                    _base;               // absolute damage amount
+	int8                _self;               // casts at self
 
 public:
 
 	ProtoDrainage(int8 d, int8 s, int8 sd, int8 b, effectDrainsTypes t, int, bool afSelf = false) {
-		type = t;
-		dice = d;
-		sides = s;
-		skillDice = sd;
-		base = b;
-		self = afSelf;
+		_type = t;
+		_dice = d;
+		_sides = s;
+		_skillDice = sd;
+		_base = b;
+		_self = afSelf;
 	}
 
 	bool applicable(SpellTarget &trg);
@@ -437,15 +437,15 @@ public:
 //
 
 class ProtoEnchantment: public ProtoEffect {
-	uint16              enchID;
-	uint32              minEnch;
-	RandomDice          dice;               // enchantment time
+	uint16              _enchID;
+	uint32              _minEnch;
+	RandomDice          _dice;               // enchantment time
 
 public:
 	ProtoEnchantment(uint16 e, uint32 loTime, uint32 hiTime) {
-		enchID = e;
-		dice = RandomDice(1, hiTime - loTime);
-		minEnch = loTime;
+		_enchID = e;
+		_dice = RandomDice(1, hiTime - loTime);
+		_minEnch = loTime;
 	}
 
 	bool applicable(SpellTarget &trg);
@@ -453,7 +453,7 @@ public:
 	void implement(GameObject *, SpellTarget *trg, int8 deltaDamage = 0);
 
 	bool canFail() {
-		return isSaveable(enchID);
+		return isSaveable(_enchID);
 	}
 
 	static bool realSavingThrow(Actor *a);
@@ -464,15 +464,15 @@ public:
 //   this type of spell sets up spells that are used to alter tags
 
 class ProtoTAGEffect: public ProtoEffect {
-	effectTAGTypes      affectBit;
-	int16               onOff;       // lock/unlock or trigger ID
-	ObjectID            trigger;
+	effectTAGTypes      _affectBit;
+	int16               _onOff;       // lock/unlock or trigger ID
+	ObjectID            _trigger;
 
 public:
 	ProtoTAGEffect(effectTAGTypes ett, int16 v, ObjectID t) {
-		affectBit = ett;
-		onOff = v;
-		trigger = t;
+		_affectBit = ett;
+		_onOff = v;
+		_trigger = t;
 	}
 
 	bool applicable(SpellTarget &trg);
@@ -485,15 +485,15 @@ public:
 //   These effects are used only on non-actor objects.
 
 class ProtoObjectEffect: public ProtoEffect {
-	uint16              affectBit;
-	int16               onOff;
-	RandomDice          dice;               // enchantment time
+	uint16              _affectBit;
+	int16               _onOff;
+	RandomDice          _dice;               // enchantment time
 
 public:
 	ProtoObjectEffect(uint16 e, int16 v, uint32 loT, uint32 hiT) {
-		affectBit = e;
-		onOff = v;
-		dice = RandomDice(loT, hiT);
+		_affectBit = e;
+		_onOff = v;
+		_dice = RandomDice(loT, hiT);
 	}
 
 	bool applicable(SpellTarget &trg);
@@ -506,13 +506,13 @@ public:
 // is where they'll be
 
 class ProtoLocationEffect: public ProtoEffect {
-	effectLocationTypes affectBit;
-	int16               value;
+	effectLocationTypes _affectBit;
+	int16               _value;
 
 public:
 	ProtoLocationEffect(effectLocationTypes elt, int16 v) {
-		affectBit = elt;
-		value = v;
+		_affectBit = elt;
+		_value = v;
 	}
 
 	bool applicable(SpellTarget &)  {
@@ -534,13 +534,13 @@ typedef void SPELLIMPLEMENTATION(GameObject *, SpellTarget *);
 #define SPECIALSPELL(name) void name(GameObject *cst, SpellTarget *trg)
 
 class ProtoSpecialEffect: public ProtoEffect {
-	int16 routineID;
-	SPELLIMPLEMENTATION *handler;
+	int16 _routineID;
+	SPELLIMPLEMENTATION *_handler;
 
 public:
 	ProtoSpecialEffect(SPELLIMPLEMENTATION *newHandler, int16 callID = 0) {
-		handler = newHandler;
-		routineID = callID;
+		_handler = newHandler;
+		_routineID = callID;
 	}
 
 	bool applicable(SpellTarget &) {
diff --git a/engines/saga2/spelcast.cpp b/engines/saga2/spelcast.cpp
index a351e2f62c4..38438d22ce5 100644
--- a/engines/saga2/spelcast.cpp
+++ b/engines/saga2/spelcast.cpp
@@ -119,8 +119,8 @@ void SpellStuff::addEffect(ProtoEffect *pe) {
 		effects = pe;
 	else {
 		ProtoEffect *tail;
-		for (tail = effects; tail->next; tail = tail->next) ;
-		tail->next = pe;
+		for (tail = effects; tail->_next; tail = tail->_next) ;
+		tail->_next = pe;
 	}
 }
 
@@ -180,7 +180,7 @@ void SpellStuff::implement(GameObject *enactor, GameObject *target) {
 	        !canTarget(spellTargCaster))
 		return;
 	if (effects) {
-		for (ProtoEffect *pe = effects; pe; pe = pe->next)
+		for (ProtoEffect *pe = effects; pe; pe = pe->_next)
 			if (pe->applicable(st))
 				pe->implement(enactor, &st);
 	}
@@ -192,7 +192,7 @@ void SpellStuff::implement(GameObject *enactor, GameObject *target) {
 void SpellStuff::implement(GameObject *enactor, ActiveItem *target) {
 	SpellTarget st = SpellTarget(target);
 	if (effects) {
-		for (ProtoEffect *pe = effects; pe; pe = pe->next)
+		for (ProtoEffect *pe = effects; pe; pe = pe->_next)
 			if (pe->applicable(st))
 				pe->implement(enactor, &st);
 	}
@@ -211,7 +211,7 @@ void SpellStuff::implement(GameObject *enactor, Location target) {
 			        t->getObject()->thisID() == enactor->thisID() &&
 			        !canTarget(spellTargCaster))
 				continue;
-			for (ProtoEffect *pe = effects; pe; pe = pe->next)
+			for (ProtoEffect *pe = effects; pe; pe = pe->_next)
 				if (pe->applicable(*t))
 					pe->implement(enactor, t);
 		}
diff --git a/engines/saga2/spellio.cpp b/engines/saga2/spellio.cpp
index 47f9f9be4d9..58447840085 100644
--- a/engines/saga2/spellio.cpp
+++ b/engines/saga2/spellio.cpp
@@ -194,8 +194,8 @@ void SpellStuff::addEffect(ResourceSpellEffect *rse) {
 		effects = pe;
 	else {
 		ProtoEffect *tail;
-		for (tail = effects; tail->next; tail = tail->next) ;
-		tail->next = pe;
+		for (tail = effects; tail->_next; tail = tail->_next) ;
+		tail->_next = pe;
 	}
 }
 


Commit: 5447e8ce5e40d5f161d0e19d49bc4402c471e18a
    https://github.com/scummvm/scummvm/commit/5447e8ce5e40d5f161d0e19d49bc4402c471e18a
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2022-09-25T21:37:27+02:00

Commit Message:
SAGA2: Rename class variables in enchant.h

Changed paths:
    engines/saga2/enchant.cpp
    engines/saga2/enchant.h


diff --git a/engines/saga2/enchant.cpp b/engines/saga2/enchant.cpp
index e18996202c4..73437d8ad50 100644
--- a/engines/saga2/enchant.cpp
+++ b/engines/saga2/enchant.cpp
@@ -245,13 +245,13 @@ void evalObjectEnchantments(GameObject *obj) {
 
 EnchantmentIterator::EnchantmentIterator(GameObject *container) {
 	//  Get the ID of the 1st object in the sector list
-	baseObject = container;
-	wornObject = nullptr;
-	nextID = Nothing;
+	_baseObject = container;
+	_wornObject = nullptr;
+	_nextID = Nothing;
 }
 
 ObjectID EnchantmentIterator::first(GameObject **obj) {
-	nextID = baseObject->IDChild();
+	_nextID = _baseObject->IDChild();
 
 	return next(obj);
 }
@@ -261,13 +261,13 @@ ObjectID EnchantmentIterator::next(GameObject **obj) {
 	ObjectID            id;
 
 	for (;;) {
-		id = nextID;
+		id = _nextID;
 
 		if (id == Nothing) {
 			//  If we were searching a 'worn' object, then pop up a level
-			if (wornObject) {
-				nextID = wornObject->IDNext();
-				wornObject = nullptr;
+			if (_wornObject) {
+				_nextID = _wornObject->IDNext();
+				_wornObject = nullptr;
 				continue;
 			}
 
@@ -281,14 +281,14 @@ ObjectID EnchantmentIterator::next(GameObject **obj) {
 		uint16          cSet = proto->containmentSet();
 
 		if ((cSet & (ProtoObj::isArmor | ProtoObj::isWeapon | ProtoObj::isWearable))
-		        &&  wornObject == nullptr
+		        &&  _wornObject == nullptr
 		        &&  proto->isObjectBeingUsed(object)) {
-			wornObject = object;
-			nextID = object->IDChild();
+			_wornObject = object;
+			_nextID = object->IDChild();
 			continue;
 		}
 
-		nextID = object->IDNext();
+		_nextID = object->IDNext();
 
 		if (cSet & ProtoObj::isEnchantment) break;
 	}
diff --git a/engines/saga2/enchant.h b/engines/saga2/enchant.h
index b16cad075ca..ed7571f5fc9 100644
--- a/engines/saga2/enchant.h
+++ b/engines/saga2/enchant.h
@@ -90,11 +90,11 @@ enum actorEnchantments {
 //	Iterates through all active enchantments on an object or actor
 
 class EnchantmentIterator {
-	ObjectID        nextID;             //  Pointer to ID of next object.
+	ObjectID        _nextID;             //  Pointer to ID of next object.
 
 public:
-	GameObject      *baseObject,        //  Base obj we're searching for enchantments
-	                *wornObject;        //  An object 'worn' by the base object.
+	GameObject      *_baseObject,        //  Base obj we're searching for enchantments
+	                *_wornObject;        //  An object 'worn' by the base object.
 
 	//  Constructor
 	EnchantmentIterator(GameObject *container);


Commit: e424669f6dc1857f25d2912865ea6d08c7ae59ff
    https://github.com/scummvm/scummvm/commit/e424669f6dc1857f25d2912865ea6d08c7ae59ff
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2022-09-25T21:37:27+02:00

Commit Message:
SAGA2: Fix class member names in floating.h

Changed paths:
    engines/saga2/automap.cpp
    engines/saga2/floating.cpp
    engines/saga2/floating.h
    engines/saga2/panel.cpp


diff --git a/engines/saga2/automap.cpp b/engines/saga2/automap.cpp
index 5fee205c94c..da49dda657d 100644
--- a/engines/saga2/automap.cpp
+++ b/engines/saga2/automap.cpp
@@ -399,7 +399,7 @@ void AutoMap::drawClipped(
 
 
 	//  For each "decorative panel" within the frame of the window
-	for (dec = decorations, i = 0; i < numDecorations; i++, dec++) {
+	for (dec = _decorations, i = 0; i < _numDecorations; i++, dec++) {
 		//  If the decorative panel overlaps the area we are
 		//  rendering
 
diff --git a/engines/saga2/floating.cpp b/engines/saga2/floating.cpp
index e6fd72a0104..c62017a23b2 100644
--- a/engines/saga2/floating.cpp
+++ b/engines/saga2/floating.cpp
@@ -67,8 +67,8 @@ extern bool         allPlayerActorsDead;
 //  Constructor for a background window
 DecoratedWindow::DecoratedWindow(const Rect16 &r, uint16 ident, const char saveas[], AppFunc *cmd)
 	: gWindow(r, ident, saveas, cmd) {
-	decorations = nullptr;
-	numDecorations = 0;
+	_decorations = nullptr;
+	_numDecorations = 0;
 }
 
 // destructor for decorated windows
@@ -90,7 +90,7 @@ void DecoratedWindow::drawClipped(
 		if (_extent.overlap(clipRect)) {
 			//  For each "decorative panel" within the frame of the window
 
-			for (dec = decorations, i = 0; i < numDecorations; i++, dec++) {
+			for (dec = _decorations, i = 0; i < _numDecorations; i++, dec++) {
 				//  If the decorative panel overlaps the area we are
 				//  rendering
 
@@ -108,7 +108,7 @@ void DecoratedWindow::drawClipped(
 	// REM: We should also draw the scrolling tiles at this time???
 }
 
-//  Set up the decorations for the window, and load them into the
+//  Set up the _decorations for the window, and load them into the
 //  memory pool
 
 void DecoratedWindow::setDecorations(
@@ -117,22 +117,22 @@ void DecoratedWindow::setDecorations(
     hResContext     *con) {
 	int16           i;
 
-	numDecorations = count;
+	_numDecorations = count;
 
-	if (decorations)
-		delete[] decorations;
+	if (_decorations)
+		delete[] _decorations;
 
-	decorations = new WindowDecoration[numDecorations];
+	_decorations = new WindowDecoration[_numDecorations];
 
 	//  For each "decorative panel" within the frame of the window
 
-	for (i = 0; i < numDecorations; i++, dec++) {
+	for (i = 0; i < _numDecorations; i++, dec++) {
 		// request an image pointer from the image Cache
 		dec->image = g_vm->_imageCache->requestImage(con,
 		                                     MKTAG('B', 'R', 'D', dec->imageNumber));
-		decorations[i].extent = dec->extent;
-		decorations[i].image = dec->image;
-		decorations[i].imageNumber = dec->imageNumber;
+		_decorations[i].extent = dec->extent;
+		_decorations[i].image = dec->image;
+		_decorations[i].imageNumber = dec->imageNumber;
 	}
 }
 
@@ -143,21 +143,21 @@ void DecoratedWindow::setDecorations(
     hResID          id_) {
 	int16           i;
 
-	numDecorations = count;
+	_numDecorations = count;
 
-	if (decorations)
-		delete[] decorations;
+	if (_decorations)
+		delete[] _decorations;
 
-	decorations = new WindowDecoration[numDecorations];
+	_decorations = new WindowDecoration[_numDecorations];
 
 	//  For each "decorative panel" within the frame of the window
 
-	for (i = 0; i < numDecorations; i++, dec++) {
+	for (i = 0; i < _numDecorations; i++, dec++) {
 		// request an image pointer from the image Cache
 		dec->image = g_vm->_imageCache->requestImage(con, id_ | MKTAG(0, 0, 0, dec->imageNumber));
-		decorations[i].extent = dec->extent;
-		decorations[i].image = dec->image;
-		decorations[i].imageNumber = dec->imageNumber;
+		_decorations[i].extent = dec->extent;
+		_decorations[i].image = dec->image;
+		_decorations[i].imageNumber = dec->imageNumber;
 	}
 }
 
@@ -175,12 +175,12 @@ void DecoratedWindow::setDecorations(
     hResContext     *con) {
 	int16           i;
 
-	numDecorations = count;
+	_numDecorations = count;
 
-	if (decorations)
-		delete[] decorations;
+	if (_decorations)
+		delete[] _decorations;
 
-	decorations = new WindowDecoration[numDecorations];
+	_decorations = new WindowDecoration[_numDecorations];
 
 	if (g_vm->getGameId() == GID_DINO) {
 		warning("TODO: setDecorations() for Dino");
@@ -189,12 +189,12 @@ void DecoratedWindow::setDecorations(
 
 	//  For each "decorative panel" within the frame of the window
 
-	for (i = 0; i < numDecorations; i++, dec++) {
+	for (i = 0; i < _numDecorations; i++, dec++) {
 		// request an image pointer from the image Cache
-		decorations[i].extent = dec->extent;
-		decorations[i].image = g_vm->_imageCache->requestImage(con,
+		_decorations[i].extent = dec->extent;
+		_decorations[i].image = g_vm->_imageCache->requestImage(con,
 		                                     MKTAG('B', 'R', 'D', dec->imageNumber));
-		decorations[i].imageNumber = dec->imageNumber;
+		_decorations[i].imageNumber = dec->imageNumber;
 	}
 }
 
@@ -205,20 +205,20 @@ void DecoratedWindow::setDecorations(
     hResID          id_) {
 	int16           i;
 
-	numDecorations = count;
+	_numDecorations = count;
 
-	if (decorations)
-		delete[] decorations;
+	if (_decorations)
+		delete[] _decorations;
 
-	decorations = new WindowDecoration[numDecorations];
+	_decorations = new WindowDecoration[_numDecorations];
 
 	//  For each "decorative panel" within the frame of the window
 
-	for (i = 0; i < numDecorations; i++, dec++) {
+	for (i = 0; i < _numDecorations; i++, dec++) {
 		// request an image pointer from the image Cache
-		decorations[i].extent = dec->extent;
-		decorations[i].image = g_vm->_imageCache->requestImage(con, id_ | MKTAG(0, 0, 0, dec->imageNumber));
-		decorations[i].imageNumber = dec->imageNumber;
+		_decorations[i].extent = dec->extent;
+		_decorations[i].image = g_vm->_imageCache->requestImage(con, id_ | MKTAG(0, 0, 0, dec->imageNumber));
+		_decorations[i].imageNumber = dec->imageNumber;
 	}
 }
 
@@ -230,26 +230,26 @@ void DecoratedWindow::setDecorations(
 	setDecorations(dec, count, con, MKTAG(a, b, c, 0));
 }
 
-//  Free the decorations from the memory pool
+//  Free the _decorations from the memory pool
 
 void DecoratedWindow::removeDecorations() {
 	WindowDecoration *dec;
 	int16           i;
 
 	// release requests made to the Image Cache
-	for (dec = decorations, i = 0; i < numDecorations; i++, dec++) {
+	for (dec = _decorations, i = 0; i < _numDecorations; i++, dec++) {
 		g_vm->_imageCache->releaseImage(dec->image);
 	}
 
-	if (decorations) {
-		delete[] decorations;
-		decorations = nullptr;
+	if (_decorations) {
+		delete[] _decorations;
+		_decorations = nullptr;
 	}
 
-	numDecorations = 0;
+	_numDecorations = 0;
 }
 
-//  Redraw all of the decorations, on the main port only...
+//  Redraw all of the _decorations, on the main port only...
 
 void DecoratedWindow::draw() {               // redraw the window
 	g_vm->_pointer->hide();
@@ -318,10 +318,10 @@ void BackWindow::toFront() {}
    DragBar class member functions
  * ===================================================================== */
 
-StaticPoint16 DragBar::dragOffset = {0, 0};
-StaticPoint16 DragBar::dragPos = {0, 0};
-bool                DragBar::update;
-FloatingWindow      *DragBar::dragWindow;
+StaticPoint16 DragBar::_dragOffset = {0, 0};
+StaticPoint16 DragBar::_dragPos = {0, 0};
+bool                DragBar::_update;
+FloatingWindow      *DragBar::_dragWindow;
 
 DragBar::DragBar(gPanelList &list, const Rect16 &r)
 	: gControl(list, r, nullptr, 0, nullptr) {
@@ -338,9 +338,9 @@ void DragBar::deactivate() {
 bool DragBar::pointerHit(gPanelMessage &msg) {
 	Rect16      wExtent = window.getExtent();
 
-	dragPos.x = wExtent.x;
-	dragPos.y = wExtent.y;
-	dragOffset.set(msg.pickAbsPos.x, msg.pickAbsPos.y);
+	_dragPos.x = wExtent.x;
+	_dragPos.y = wExtent.y;
+	_dragOffset.set(msg.pickAbsPos.x, msg.pickAbsPos.y);
 
 	return true;
 }
@@ -354,22 +354,22 @@ void DragBar::pointerDrag(gPanelMessage &msg) {
 
 	//  Calculate new window position
 
-	pos.x = msg.pickAbsPos.x + ext.x - dragOffset.x;
-	pos.y = msg.pickAbsPos.y + ext.y - dragOffset.y;
+	pos.x = msg.pickAbsPos.x + ext.x - _dragOffset.x;
+	pos.y = msg.pickAbsPos.y + ext.y - _dragOffset.y;
 
 	//  If window position has changed, then signal the drawing loop
 
-	if (pos != dragPos) {
-		dragPos.set(pos.x, pos.y);
-		update = true;
-		dragWindow = (FloatingWindow *)&window;
+	if (pos != _dragPos) {
+		_dragPos.set(pos.x, pos.y);
+		_update = true;
+		_dragWindow = (FloatingWindow *)&window;
 	}
 }
 
 void DragBar::pointerRelease(gPanelMessage &) {
 	deactivate();
-	update = false;             // just in case
-	dragWindow = nullptr;
+	_update = false;             // just in case
+	_dragWindow = nullptr;
 }
 
 
@@ -431,7 +431,7 @@ void gButton::draw() {
  * ===================================================================== */
 
 void gImageButton::drawClipped(gPort &port, const Point16 &offset, const Rect16 &r) {
-	gPixelMap   *currentImage = selected ? selImage : deselImage;
+	gPixelMap   *currentImage = selected ? _selImage : _deselImage;
 
 	if (displayEnabled())
 		if (_extent.overlap(r))
@@ -525,10 +525,10 @@ void LabeledButton::drawClipped(
 
 FloatingWindow::FloatingWindow(const Rect16 &r, uint16 ident, const char saveas[], AppFunc *cmd)
 	: DecoratedWindow(r, ident, saveas, cmd) {
-	db = new DragBar(*this, Rect16(0, 0, r.width, r.height));
+	_db = new DragBar(*this, Rect16(0, 0, r.width, r.height));
 
-	origPos.x = r.x;
-	origPos.y = r.y;
+	_origPos.x = r.x;
+	_origPos.y = r.y;
 
 #if 0
 	decOffset.x = 0;
@@ -548,8 +548,8 @@ void FloatingWindow::drawClipped(
 
 	if (displayEnabled())
 		if (_extent.overlap(r)) {
-			// do'nt do the temp stuff if there are decorations present
-			if (numDecorations == 0) {
+			// do'nt do the temp stuff if there are _decorations present
+			if (_numDecorations == 0) {
 				rect.x -= offset.x;
 				rect.y -= offset.y;
 
@@ -561,7 +561,7 @@ void FloatingWindow::drawClipped(
 			}
 
 			//  For each "decorative panel" within the frame of the window
-			for (dec = decorations, i = 0; i < numDecorations; i++, dec++) {
+			for (dec = _decorations, i = 0; i < _numDecorations; i++, dec++) {
 				Point16 pos(dec->extent.x /* - decOffset.x */ - offset.x + _extent.x,
 				            dec->extent.y /* - decOffset.y */ - offset.y + _extent.y);
 
@@ -574,10 +574,10 @@ void FloatingWindow::drawClipped(
 
 void FloatingWindow::setExtent(const Rect16 &r) {
 	// set an offset from the original position of the window
-	// for the decorations to use in drawing themselves
+	// for the _decorations to use in drawing themselves
 #if 0
-	decOffset.x = origPos.x - r.x;
-	decOffset.y = origPos.y - r.y;
+	decOffset.x = _origPos.x - r.x;
+	decOffset.y = _origPos.y - r.y;
 #endif
 
 	// now reset the extent
@@ -587,7 +587,7 @@ void FloatingWindow::setExtent(const Rect16 &r) {
 }
 
 bool FloatingWindow::open() {
-	db->moveToBack(*this);
+	_db->moveToBack(*this);
 
 	g_vm->_mouseInfo->replaceObject();
 	g_vm->_mouseInfo->clearGauge();
@@ -702,21 +702,21 @@ void drawFloatingWindows(gPort &port, const Point16 &offset, const Rect16 &clip)
 	//  If a floating window is in the process of being dragged,
 	//  then things get a little more complex...
 
-	if (DragBar::update) {
+	if (DragBar::_update) {
 		Rect16          oldExtent,
 		                newExtent;
 
 		//  Calculate the new and old position of the window
 
-		oldExtent = DragBar::dragWindow->getExtent();
+		oldExtent = DragBar::_dragWindow->getExtent();
 		newExtent = oldExtent;
-		newExtent.x = DragBar::dragPos.x;
-		newExtent.y = DragBar::dragPos.y;
+		newExtent.x = DragBar::_dragPos.x;
+		newExtent.y = DragBar::_dragPos.y;
 
 		//  Move the window to the new position
 
-		DragBar::dragWindow->setExtent(newExtent);
-		DragBar::update = false;
+		DragBar::_dragWindow->setExtent(newExtent);
+		DragBar::_update = false;
 
 		if (newExtent.overlap(oldExtent)) {
 			//  If the positions overlap, update them as a single
diff --git a/engines/saga2/floating.h b/engines/saga2/floating.h
index 04e89c497d5..5a02e51fac4 100644
--- a/engines/saga2/floating.h
+++ b/engines/saga2/floating.h
@@ -98,10 +98,10 @@ class FloatingWindow;
 class DragBar : public gControl {
 
 public:
-	static StaticPoint16  dragOffset,             // mouse offset
-	                      dragPos;                // new position of window
-	static bool     update;                 // true = update window pos
-	static FloatingWindow *dragWindow;      // which window to update
+	static StaticPoint16  _dragOffset,             // mouse offset
+	                      _dragPos;                // new position of window
+	static bool     _update;                 // true = update window pos
+	static FloatingWindow *_dragWindow;      // which window to update
 
 	DragBar(gPanelList &, const Rect16 &);
 
@@ -152,19 +152,19 @@ public:
 
 class gImageButton : public gButton {
 protected:
-	gPixelMap   *selImage,
-	            *deselImage;
+	gPixelMap   *_selImage,
+	            *_deselImage;
 
 public:
 	gImageButton(gPanelList &list, const Rect16 &box, gPixelMap &img1, gPixelMap &img2, uint16 ident, AppFunc *cmd = NULL) :
 		gButton(list, box, NULL, ident, cmd) {
-		selImage = &img1;
-		deselImage = &img2;
+		_selImage = &img1;
+		_deselImage = &img2;
 	}
 	gImageButton(gPanelList &list, const Rect16 &box, gPixelMap &img1, gPixelMap &img2, char *title_, uint16 ident, AppFunc *cmd = NULL) :
 		gButton(list, box, title_, ident, cmd) {
-		selImage = &img1;
-		deselImage = &img2;
+		_selImage = &img1;
+		_deselImage = &img2;
 	}
 
 	void drawClipped(gPort &port, const Point16 &offset, const Rect16 &r);
@@ -209,8 +209,8 @@ public:
 
 class DecoratedWindow : public gWindow {
 public:
-	WindowDecoration        *decorations;
-	int16                   numDecorations;
+	WindowDecoration        *_decorations;
+	int16                   _numDecorations;
 
 	//  For a future enhancement where different windows have
 	//  different animated areas.
@@ -271,17 +271,17 @@ public:
 
 class FloatingWindow : public DecoratedWindow {
 
-	DragBar     *db;                    // save address of drag bar
+	DragBar     *_db;                    // save address of drag bar
 
 	void toFront();
 
 	// original extent before movement
-	Point16 origPos;
+	Point16 _origPos;
 
 public:
 
 	// decoration position offset
-	Point16 decOffset;
+	Point16 _decOffset;
 
 	FloatingWindow(const Rect16 &, uint16, const char saveas[], AppFunc *cmd = NULL);
 
@@ -296,7 +296,7 @@ public:
 	// set the extent of the entire window ( including decorations )
 	void    setExtent(const Rect16 &);
 	const Point16 &getDecOffset() {
-		return decOffset;
+		return _decOffset;
 	}
 
 	bool open();
diff --git a/engines/saga2/panel.cpp b/engines/saga2/panel.cpp
index 78670245a13..ae11f56a502 100644
--- a/engines/saga2/panel.cpp
+++ b/engines/saga2/panel.cpp
@@ -458,7 +458,7 @@ void gWindow::close() {
 
 	//  Don't close a window that is being dragged (should never happen,
 	//  but just in case).
-	if (DragBar::dragWindow == (FloatingWindow *)this)
+	if (DragBar::_dragWindow == (FloatingWindow *)this)
 		return;
 
 	openFlag = false;


Commit: 3a49501e20fb16e577ca7854027a221dcd919b78
    https://github.com/scummvm/scummvm/commit/3a49501e20fb16e577ca7854027a221dcd919b78
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2022-09-25T21:37:27+02:00

Commit Message:
SAGA2: Rename class variables in fta.h

Changed paths:
    engines/saga2/display.cpp
    engines/saga2/fta.h
    engines/saga2/gamemode.cpp
    engines/saga2/intrface.cpp
    engines/saga2/main.cpp
    engines/saga2/saveload.cpp
    engines/saga2/timers.cpp
    engines/saga2/towerfta.cpp
    engines/saga2/transit.cpp
    engines/saga2/tromode.cpp
    engines/saga2/uidialog.cpp


diff --git a/engines/saga2/display.cpp b/engines/saga2/display.cpp
index 7bab54c86ff..5980b62f8c5 100644
--- a/engines/saga2/display.cpp
+++ b/engines/saga2/display.cpp
@@ -86,7 +86,7 @@ void niceScreenStartup() {
 		cleanupGameState();
 		loadSavedGameState(ConfMan.getInt("save_slot"));
 
-		if (GameMode::newmodeFlag)
+		if (GameMode::_newmodeFlag)
 			GameMode::update();
 		updateActiveRegions();
 	}
diff --git a/engines/saga2/fta.h b/engines/saga2/fta.h
index a1b9582866e..13512f89a61 100644
--- a/engines/saga2/fta.h
+++ b/engines/saga2/fta.h
@@ -75,22 +75,22 @@ struct gMouseState;
 
 class GameMode {
 public:
-	GameMode        *prev;                  // previous nested mode
-	int16           nestable;               // true if mode nests
-
-	static  GameMode    *modeStackPtr[Max_Modes]; // Array Of Current Mode Stack Pointers to Game Objects
-	static  int         modeStackCtr;       // Counter For Array Of Mode Stack Pointers to Game Objects
-	static  GameMode    *newmodeStackPtr[Max_Modes]; // Array Of New Mode Stack Pointers to Game Objects
-	static  int         newmodeStackCtr;        // Counter For Array Of Mode Stack Pointers to Game Objects
-	static  int         newmodeFlag;        // Flag Telling EventLoop Theres A New Mode So Update
-	static GameMode *currentMode,           // pointer to current mode.
-	       *newMode;               // next mode to run
-
-	void (*setup)();                     // initialize this mode
-	void (*cleanup)();               // deallocate mode resources
-	void (*handleTask)();                // "application task" for mode
-	void (*handleKey)(int16 key, int16 qual);  // handle keystroke from window
-	void (*draw)();                          // handle draw functions for window
+	GameMode        *_prev;                  // previous nested mode
+	int16           _nestable;               // true if mode nests
+
+	static  GameMode    *_modeStackPtr[Max_Modes]; // Array Of Current Mode Stack Pointers to Game Objects
+	static  int         _modeStackCtr;       // Counter For Array Of Mode Stack Pointers to Game Objects
+	static  GameMode    *_newmodeStackPtr[Max_Modes]; // Array Of New Mode Stack Pointers to Game Objects
+	static  int         _newmodeStackCtr;        // Counter For Array Of Mode Stack Pointers to Game Objects
+	static  int         _newmodeFlag;        // Flag Telling EventLoop Theres A New Mode So Update
+	static GameMode *_currentMode,           // pointer to current mode.
+	       *_newMode;               // next mode to run
+
+	void (*_setup)();                     // initialize this mode
+	void (*_cleanup)();               // deallocate mode resources
+	void (*_handleTask)();                // "application task" for mode
+	void (*_handleKey)(int16 key, int16 qual);  // handle keystroke from window
+	void (*_draw)();                          // handle draw functions for window
 
 	static  void modeUnStack();
 	static  void modeUnStack(int StopHere);
@@ -131,8 +131,8 @@ void resumeTimer();                  // resume game clock
 
 class Alarm {
 public:
-	uint32 basetime;                            // timer alarm was set
-	uint32 duration;                            // duration of alarm
+	uint32 _basetime;                            // timer alarm was set
+	uint32 _duration;                            // duration of alarm
 
 	void set(uint32 duration);
 	bool check();
diff --git a/engines/saga2/gamemode.cpp b/engines/saga2/gamemode.cpp
index 431e00e1a17..f1a1715d759 100644
--- a/engines/saga2/gamemode.cpp
+++ b/engines/saga2/gamemode.cpp
@@ -36,29 +36,29 @@ namespace Saga2 {
 
 //Initialize Static GameObject Data Members
 
-GameMode    *GameMode::currentMode = nullptr;  // pointer to current mode.
-GameMode    *GameMode::newMode = nullptr;      // next mode to run
+GameMode    *GameMode::_currentMode = nullptr;  // pointer to current mode.
+GameMode    *GameMode::_newMode = nullptr;      // next mode to run
 
-GameMode       *GameMode::modeStackPtr[Max_Modes] = { nullptr };
-GameMode       *GameMode::newmodeStackPtr[Max_Modes] = { nullptr };
-int         GameMode::modeStackCtr = 0;
-int         GameMode::newmodeStackCtr = 0;
-int         GameMode::newmodeFlag = false;
+GameMode       *GameMode::_modeStackPtr[Max_Modes] = { nullptr };
+GameMode       *GameMode::_newmodeStackPtr[Max_Modes] = { nullptr };
+int         GameMode::_modeStackCtr = 0;
+int         GameMode::_newmodeStackCtr = 0;
+int         GameMode::_newmodeFlag = false;
 
 void GameMode::modeUnStack() {
-	modeStackPtr[modeStackCtr] = nullptr;                        //Always Start Cleanup At modeStackCtr
-	modeStackPtr[modeStackCtr--]->cleanup();
+	_modeStackPtr[_modeStackCtr] = nullptr;                        //Always Start Cleanup At _modeStackCtr
+	_modeStackPtr[_modeStackCtr--]->_cleanup();
 	return;
 }
 
 void GameMode::modeUnStack(int StopHere) {
-	if (!modeStackCtr)   //If Nothing Currently On The Stack
+	if (!_modeStackCtr)   //If Nothing Currently On The Stack
 		return;
-	for (int i = modeStackCtr - 1; i >= StopHere; i--) { //Stop Here Is How Far You Want To Unstack
-		if (modeStackPtr[i] != nullptr)
-			modeStackPtr[i]->cleanup();
-		modeStackPtr[i] = nullptr;                        //Always Start Cleanup At modeStackCtr
-		modeStackCtr--;                        //Always Start Cleanup At modeStackCtr
+	for (int i = _modeStackCtr - 1; i >= StopHere; i--) { //Stop Here Is How Far You Want To Unstack
+		if (_modeStackPtr[i] != nullptr)
+			_modeStackPtr[i]->_cleanup();
+		_modeStackPtr[i] = nullptr;                        //Always Start Cleanup At _modeStackCtr
+		_modeStackCtr--;                        //Always Start Cleanup At _modeStackCtr
 	}
 	return;
 }
@@ -68,56 +68,56 @@ bool GameMode::update() {
 	int             ModeCtr = 0;
 
 
-	newmodeFlag = false;
+	_newmodeFlag = false;
 
-	for (int i = 0; i < newmodeStackCtr; i++, ModeCtr++)
-		if (newmodeStackPtr[i] != modeStackPtr[i])
+	for (int i = 0; i < _newmodeStackCtr; i++, ModeCtr++)
+		if (_newmodeStackPtr[i] != _modeStackPtr[i])
 			break;
 
 	//Now ModeCtr Equals How Deep In The Mode Is Equal
 
 	modeUnStack(ModeCtr);
 
-	for (int i = ModeCtr; i < newmodeStackCtr; i++)
-		modeStack(newmodeStackPtr[i]);
+	for (int i = ModeCtr; i < _newmodeStackCtr; i++)
+		modeStack(_newmodeStackPtr[i]);
 
 	return result;
 
 }
 
 int GameMode::getStack(GameMode **saveStackPtr) {
-	memcpy(saveStackPtr, modeStackPtr, sizeof(GameMode *) * modeStackCtr);
-	return modeStackCtr;
+	memcpy(saveStackPtr, _modeStackPtr, sizeof(GameMode *) * _modeStackCtr);
+	return _modeStackCtr;
 }
 
 void GameMode::SetStack(GameMode *modeFirst, ...) {
 	va_list Modes;
 	va_start(Modes, modeFirst); //Initialize To First Argument Even Though We Dont Use It In The Loop
-	newmodeStackCtr = 0; //reset Ctr For New Mode
+	_newmodeStackCtr = 0; //reset Ctr For New Mode
 	GameMode *thisMode = modeFirst;
 
 	//Put List In New Array Of GameMode Object Pointers
 
 	while (thisMode != nullptr) {
-		newmodeStackPtr[newmodeStackCtr] = thisMode;
-		newmodeStackCtr++;
+		_newmodeStackPtr[_newmodeStackCtr] = thisMode;
+		_newmodeStackCtr++;
 		thisMode  = va_arg(Modes, GameMode *);
 
 	}
 	va_end(Modes); //Clean Up
 
-	newmodeFlag = true;
+	_newmodeFlag = true;
 }
 
 void GameMode::SetStack(GameMode **newStack, int newStackSize) {
-	newmodeStackCtr = newStackSize;
-	memcpy(newmodeStackPtr, newStack, sizeof(GameMode *) * newStackSize);
-	newmodeFlag = true;
+	_newmodeStackCtr = newStackSize;
+	memcpy(_newmodeStackPtr, newStack, sizeof(GameMode *) * newStackSize);
+	_newmodeFlag = true;
 }
 
 void GameMode::modeStack(GameMode *AddThisMode) {
-	modeStackPtr[modeStackCtr++] = AddThisMode;
-	AddThisMode->setup();
+	_modeStackPtr[_modeStackCtr++] = AddThisMode;
+	AddThisMode->_setup();
 	return;
 }
 
diff --git a/engines/saga2/intrface.cpp b/engines/saga2/intrface.cpp
index b8e77045766..74c313c275d 100644
--- a/engines/saga2/intrface.cpp
+++ b/engines/saga2/intrface.cpp
@@ -605,8 +605,8 @@ CStatusLine::CStatusLine(gPanelList         &list,
 		lineQueue[i].text = nullptr;
 		lineQueue[i].frameTime = 0;
 	}
-	waitAlarm.basetime = waitAlarm.duration = 0;
-	minWaitAlarm.basetime = minWaitAlarm.duration = 0;
+	waitAlarm._basetime = waitAlarm._duration = 0;
+	minWaitAlarm._basetime = minWaitAlarm._duration = 0;
 }
 
 CStatusLine::~CStatusLine() {
diff --git a/engines/saga2/main.cpp b/engines/saga2/main.cpp
index 19c763d135e..4451ab92c34 100644
--- a/engines/saga2/main.cpp
+++ b/engines/saga2/main.cpp
@@ -267,7 +267,7 @@ void processEventLoop(bool updateScreen) {
 	audioEventLoop();
 
 	debugC(1, kDebugEventLoop, "EventLoop: game mode update");
-	if (GameMode::newmodeFlag)
+	if (GameMode::_newmodeFlag)
 		GameMode::update();
 
 	Common::Event event;
@@ -315,7 +315,7 @@ void displayUpdate() {
 		//debugC(1, kDebugEventLoop, "EventLoop: daytime transition update loop");
 		dayNightUpdate();
 		//debugC(1, kDebugEventLoop, "EventLoop: Game mode handle task");
-		GameMode::modeStackPtr[GameMode::modeStackCtr - 1]->handleTask();
+		GameMode::_modeStackPtr[GameMode::_modeStackCtr - 1]->_handleTask();
 		g_vm->_lrate->updateFrameCount();
 		loops++;
 		elapsed += (gameTime - lastGameTime);
@@ -855,7 +855,7 @@ APPFUNC(cmdWindowFunc) {
 		key = ev.value & 0xffff;
 		qual = ev.value >> 16;
 
-		GameMode::modeStackPtr[GameMode::modeStackCtr - 1]->handleKey(key, qual);
+		GameMode::_modeStackPtr[GameMode::_modeStackCtr - 1]->_handleKey(key, qual);
 		break;
 
 	default:
diff --git a/engines/saga2/saveload.cpp b/engines/saga2/saveload.cpp
index d3d2521cbc8..a499a4aea17 100644
--- a/engines/saga2/saveload.cpp
+++ b/engines/saga2/saveload.cpp
@@ -520,7 +520,7 @@ void loadGame(int16 saveNo) {
 	cleanupGameState();
 	fadeDown();
 	loadSavedGameState(saveNo);
-	if (GameMode::newmodeFlag)
+	if (GameMode::_newmodeFlag)
 		GameMode::update();
 	updateActiveRegions();
 	enableUserControls();
diff --git a/engines/saga2/timers.cpp b/engines/saga2/timers.cpp
index e4f354ef1fb..902d2ed7880 100644
--- a/engines/saga2/timers.cpp
+++ b/engines/saga2/timers.cpp
@@ -84,28 +84,28 @@ void cleanupTimer() {
  * ====================================================================== */
 
 void Alarm::write(Common::MemoryWriteStreamDynamic *out) {
-	out->writeUint32LE(basetime);
-	out->writeUint32LE(duration);
+	out->writeUint32LE(_basetime);
+	out->writeUint32LE(_duration);
 }
 
 void Alarm::read(Common::InSaveFile *in) {
-	basetime = in->readUint32LE();
-	duration = in->readUint32LE();
+	_basetime = in->readUint32LE();
+	_duration = in->readUint32LE();
 }
 
 void Alarm::set(uint32 dur) {
-	basetime = gameTime;
-	duration = dur;
+	_basetime = gameTime;
+	_duration = dur;
 }
 
 bool Alarm::check() {
-	return ((uint32)(gameTime - basetime) > duration);
+	return ((uint32)(gameTime - _basetime) > _duration);
 }
 
 // time elapsed since alarm set
 
 uint32 Alarm::elapsed() {
-	return (uint32)(gameTime - basetime);
+	return (uint32)(gameTime - _basetime);
 }
 
 /* ===================================================================== *
@@ -135,7 +135,7 @@ void checkTimers() {
 			continue;
 
 		if ((*it)->check()) {
-			debugC(2, kDebugTimers, "Timer tick for %p (%s): %p (duration %d)", (void *)(*it)->getObject(), (*it)->getObject()->objName(), (void *)(*it), (*it)->getInterval());
+			debugC(2, kDebugTimers, "Timer tick for %p (%s): %p (_duration %d)", (void *)(*it)->getObject(), (*it)->getObject()->objName(), (void *)(*it), (*it)->getInterval());
 			(*it)->reset();
 			(*it)->getObject()->timerTick((*it)->thisID());
 		}
diff --git a/engines/saga2/towerfta.cpp b/engines/saga2/towerfta.cpp
index 39eb3ae7483..09f33a9a29f 100644
--- a/engines/saga2/towerfta.cpp
+++ b/engines/saga2/towerfta.cpp
@@ -444,7 +444,7 @@ TERMINATOR(termDynamicGameData) {
 INITIALIZER(initGameMode) {
 	GameMode *gameModes[] = {&PlayMode, &TileMode};
 	GameMode::SetStack(gameModes, 2);
-	if (GameMode::newmodeFlag)
+	if (GameMode::_newmodeFlag)
 		GameMode::update();
 	return true;
 }
diff --git a/engines/saga2/transit.cpp b/engines/saga2/transit.cpp
index a97c4931bff..f4f72677767 100644
--- a/engines/saga2/transit.cpp
+++ b/engines/saga2/transit.cpp
@@ -42,11 +42,11 @@ bool isModalMode() {
 	uint16  i;
 	bool    modalFlag = false;
 
-	for (i = 0; i < GameMode::modeStackCtr; i++) {
+	for (i = 0; i < GameMode::_modeStackCtr; i++) {
 		// go through each stacked mode
 		// and if modal mode is one of them,
 		// then set the modal flag
-		if (GameMode::modeStackPtr[i] == &ModalMode) {
+		if (GameMode::_modeStackPtr[i] == &ModalMode) {
 			modalFlag = true;
 		}
 	}
diff --git a/engines/saga2/tromode.cpp b/engines/saga2/tromode.cpp
index 361b2181c35..3aa1d0379d1 100644
--- a/engines/saga2/tromode.cpp
+++ b/engines/saga2/tromode.cpp
@@ -116,7 +116,7 @@ void dumpGBASE(char *msg);
 void setLostroMode() {
 	abortFlag = false;
 	allPlayerActorsDead = false;
-	if (GameMode::newmodeFlag)
+	if (GameMode::_newmodeFlag)
 		GameMode::update();
 
 	if (!abortFlag) {
diff --git a/engines/saga2/uidialog.cpp b/engines/saga2/uidialog.cpp
index ac51b3c4710..34b40102ea4 100644
--- a/engines/saga2/uidialog.cpp
+++ b/engines/saga2/uidialog.cpp
@@ -722,7 +722,7 @@ int16 FileDialog(int16 fileProcess) {
 	win->userData = &rInfo;
 	win->open();
 
-	if (GameMode::newmodeFlag)
+	if (GameMode::_newmodeFlag)
 		GameMode::update();
 
 	win->invalidate();
@@ -936,7 +936,7 @@ int16 OptionsDialog(bool disableSaveResume) {
 		else {
 			loadSavedGameState(deferredLoadID);
 		}
-		if (GameMode::newmodeFlag)
+		if (GameMode::_newmodeFlag)
 			GameMode::update();
 		updateActiveRegions();
 		//displayUpdate();




More information about the Scummvm-git-logs mailing list