SAGA2: Renamed enums in spelbuk.h

This commit is contained in:
Eugene Sandulenko 2022-10-29 14:33:52 +02:00
parent d2e7c34fa4
commit cc93020cb5
No known key found for this signature in database
GPG Key ID: 014D387312D34F08
9 changed files with 139 additions and 139 deletions

View File

@ -157,8 +157,8 @@ bool validTarget(GameObject *enactor, GameObject *target, ActiveItem *tag, Skill
return false;
}
if (target->thisID() == enactor->thisID())
return sp.canTarget(spellTargCaster);
return sp.canTarget(spellTargObject);
return sp.canTarget(kSpellTargCaster);
return sp.canTarget(kSpellTargObject);
}
if (tag != nullptr) {
if (range > 0 &&
@ -168,7 +168,7 @@ bool validTarget(GameObject *enactor, GameObject *target, ActiveItem *tag, Skill
.magnitude()) {
return false;
}
return sp.canTarget(spellTargTAG);
return sp.canTarget(kSpellTargTAG);
}
#if RANGE_CHECKING
if (sp.range > 0 &&
@ -179,7 +179,7 @@ bool validTarget(GameObject *enactor, GameObject *target, ActiveItem *tag, Skill
return false;
}
#endif
return sp.canTarget(spellTargLocation);
return sp.canTarget(kSpellTargLocation);
}
//-----------------------------------------------------------------------
@ -278,7 +278,7 @@ bool implementSpell(GameObject *enactor, Location &target, SkillProto *spell)
SpellID s = spell->getSpellID();
SpellStuff &sProto = spellBook[s];
assert(sProto.shouldTarget(spellApplyLocation));
assert(sProto.shouldTarget(kSpellApplyLocation));
ActorManaID ami = (ActorManaID)(sProto.getManaType());
@ -314,10 +314,10 @@ bool implementSpell(GameObject *enactor, ActiveItem *target, SkillProto *spell)
SpellID s = spell->getSpellID();
SpellStuff &sProto = spellBook[s];
Location l = Location(TAGPos(target), enactor->world()->thisID());
if (sProto.shouldTarget(spellApplyLocation)) {
if (sProto.shouldTarget(kSpellApplyLocation)) {
return implementSpell(enactor, l, spell);
}
assert(sProto.shouldTarget(spellApplyTAG));
assert(sProto.shouldTarget(kSpellApplyTAG));
assert(target->_data.itemType == activeTypeInstance);
ActorManaID ami = (ActorManaID)(sProto.getManaType());
@ -354,9 +354,9 @@ bool implementSpell(GameObject *enactor, GameObject *target, SkillProto *spell)
SpellID s = spell->getSpellID();
SpellStuff &sProto = spellBook[s];
Location l = Location(target->getWorldLocation(), enactor->world()->thisID());
if (sProto.shouldTarget(spellApplyLocation))
if (sProto.shouldTarget(kSpellApplyLocation))
return implementSpell(enactor, l, spell);
assert(sProto.shouldTarget(spellApplyObject));
assert(sProto.shouldTarget(kSpellApplyObject));
ActorManaID ami = (ActorManaID)(sProto.getManaType());

View File

@ -1689,7 +1689,7 @@ void MotionTask::fireBow(Actor &a, GameObject &target) {
void MotionTask::castSpell(Actor &a, SkillProto &spell, GameObject &target) {
MotionTask *mt;
motionTypes type =
(spellBook[spell.getSpellID()].getManaType() == sManaIDSkill) ?
(spellBook[spell.getSpellID()].getManaType() == ksManaIDSkill) ?
kMotionTypeGive :
kMotionTypeCastSpell;
@ -1709,7 +1709,7 @@ void MotionTask::castSpell(Actor &a, SkillProto &spell, GameObject &target) {
void MotionTask::castSpell(Actor &a, SkillProto &spell, Location &target) {
MotionTask *mt;
motionTypes type =
(spellBook[spell.getSpellID()].getManaType() == sManaIDSkill) ?
(spellBook[spell.getSpellID()].getManaType() == ksManaIDSkill) ?
kMotionTypeGive :
kMotionTypeCastSpell;
@ -1728,7 +1728,7 @@ void MotionTask::castSpell(Actor &a, SkillProto &spell, Location &target) {
void MotionTask::castSpell(Actor &a, SkillProto &spell, ActiveItem &target) {
MotionTask *mt;
motionTypes type =
(spellBook[spell.getSpellID()].getManaType() == sManaIDSkill) ?
(spellBook[spell.getSpellID()].getManaType() == ksManaIDSkill) ?
kMotionTypeGive :
kMotionTypeCastSpell;

View File

@ -658,7 +658,7 @@ void GameObject::objCursorText(char nameBuf[], const int8 size, int16 count) {
manaCost = spellBook[sProto->getSpellID()].getManaAmt();
}
if (manaColor == sManaIDSkill) { // It's a skill
if (manaColor == ksManaIDSkill) { // It's a skill
// get the level of the skill for the brother in question
uint16 brotherID = getCenterActor()->thisID();
uint16 level;
@ -676,8 +676,8 @@ void GameObject::objCursorText(char nameBuf[], const int8 size, int16 count) {
// normalize and output
Common::sprintf_s(nameBuf, size, "%s-%d", objName(), ++level);
}
} else if (manaColor >= sManaIDRed
&& manaColor <= sManaIDViolet // A spell
} else if (manaColor >= ksManaIDRed
&& manaColor <= ksManaIDViolet // A spell
&& manaCost > 0) {
ObjectID aID = possessor(); // Who owns the spell
PlayerActorID pID;
@ -703,7 +703,7 @@ bool GameObject::isTrueSkill() {
SkillProto *sProto = skillProtoFromID(thisID());
// determine if this is a skill icon
if (spellBook[sProto->getSpellID()].getManaType() == sManaIDSkill) {
if (spellBook[sProto->getSpellID()].getManaType() == ksManaIDSkill) {
return true;
}
}

View File

@ -64,13 +64,13 @@ SpellStuff::SpellStuff() {
_master = nullSpell;
_display = nullSpell;
_prototype = nullptr;
_targetableTypes = spellTargNone;
_targetTypes = spellApplyNone;
_targetableTypes = kSpellTargNone;
_targetTypes = kSpellApplyNone;
_effects = nullptr;
_targets = nullptr;
_manaType = sManaIDSkill;
_manaType = ksManaIDSkill;
_manaUse = 0;
_shape = eAreaInvisible;
_shape = keAreaInvisible;
_size = 0;
_range = 0;
_sound = 0;
@ -82,8 +82,8 @@ SpellStuff::SpellStuff() {
// is this spell harmful
bool SpellStuff::isOffensive() {
return (canTarget(spellTargActor) || canTarget(spellTargObject)) &&
(!canTarget(spellTargCaster));
return (canTarget(kSpellTargActor) || canTarget(kSpellTargObject)) &&
(!canTarget(kSpellTargCaster));
}
//-----------------------------------------------------------------------
@ -91,21 +91,21 @@ bool SpellStuff::isOffensive() {
bool SpellStuff::safe() {
switch (_shape) {
case eAreaInvisible:
case eAreaAura:
case eAreaGlow:
case eAreaProjectile:
case eAreaExchange:
case eAreaMissle:
case eAreaSquare:
case eAreaBall:
case eAreaWall:
case eAreaStorm:
case keAreaInvisible:
case keAreaAura:
case keAreaGlow:
case keAreaProjectile:
case keAreaExchange:
case keAreaMissle:
case keAreaSquare:
case keAreaBall:
case keAreaWall:
case keAreaStorm:
return false;
case eAreaBolt:
case eAreaBeam:
case eAreaCone:
case eAreaWave:
case keAreaBolt:
case keAreaBeam:
case keAreaCone:
case keAreaWave:
return true;
}
return false;
@ -154,7 +154,7 @@ void SpellStuff::implement(GameObject *enactor, SpellTarget *target) {
implement(enactor, Location(target->getPoint(), Nothing));
break;
case SpellTarget::kSpellTargetObjectPoint:
if (_targetTypes == spellApplyObject)
if (_targetTypes == kSpellApplyObject)
implement(enactor, target->getObject());
else
implement(enactor, Location(target->getPoint(), Nothing));
@ -177,7 +177,7 @@ void SpellStuff::implement(GameObject *enactor, GameObject *target) {
SpellTarget st = SpellTarget(target);
if (safe() &&
target->thisID() == enactor->thisID() &&
!canTarget(spellTargCaster))
!canTarget(kSpellTargCaster))
return;
if (_effects) {
for (ProtoEffect *pe = _effects; pe; pe = pe->_next)
@ -209,7 +209,7 @@ void SpellStuff::implement(GameObject *enactor, Location target) {
if (safe() &&
t->getObject() != nullptr &&
t->getObject()->thisID() == enactor->thisID() &&
!canTarget(spellTargCaster))
!canTarget(kSpellTargCaster))
continue;
for (ProtoEffect *pe = _effects; pe; pe = pe->_next)
if (pe->applicable(*t))
@ -227,15 +227,15 @@ void SpellStuff::buildTargetList(GameObject *caster, SpellTarget &trg) {
TilePoint tVect, orth, tBase;
show(caster, trg);
switch (_shape) {
case eAreaInvisible:
case eAreaAura:
case eAreaGlow:
case eAreaProjectile:
case eAreaExchange:
case eAreaMissle:
case keAreaInvisible:
case keAreaAura:
case keAreaGlow:
case keAreaProjectile:
case keAreaExchange:
case keAreaMissle:
_targets = &trg;
break;
case eAreaSquare: {
case keAreaSquare: {
tVect = trg.getPoint();
orth = TilePoint(squareSpellSize / 2, squareSpellSize / 2, 0);
@ -252,7 +252,7 @@ void SpellStuff::buildTargetList(GameObject *caster, SpellTarget &trg) {
break;
}
case eAreaBolt: {
case keAreaBolt: {
tVect = trg.getPoint() - caster->getWorldLocation();
while (tVect.magnitude() == 0) {
tVect = randomVector(TilePoint(-1, -1, 0), TilePoint(1, 1, 0));
@ -271,7 +271,7 @@ void SpellStuff::buildTargetList(GameObject *caster, SpellTarget &trg) {
break;
}
case eAreaBeam: {
case keAreaBeam: {
tVect = trg.getPoint() - caster->getWorldLocation();
while (tVect.magnitude() == 0) {
tVect = randomVector(TilePoint(-1, -1, 0), TilePoint(1, 1, 0));
@ -290,7 +290,7 @@ void SpellStuff::buildTargetList(GameObject *caster, SpellTarget &trg) {
break;
}
case eAreaBall: {
case keAreaBall: {
radius = ballSpellRadius;
CircularObjectIterator it(currentWorld, trg.getPoint(), radius);
GameObject *go;
@ -301,7 +301,7 @@ void SpellStuff::buildTargetList(GameObject *caster, SpellTarget &trg) {
}
break;
}
case eAreaWall: {
case keAreaWall: {
radius = wallSpellRadius;
RingObjectIterator it(currentWorld, trg.getPoint(), radius, wallInnerRadius);
GameObject *go;
@ -312,7 +312,7 @@ void SpellStuff::buildTargetList(GameObject *caster, SpellTarget &trg) {
}
break;
}
case eAreaStorm: {
case keAreaStorm: {
radius = stormSpellRadius;
CircularObjectIterator it(currentWorld, trg.getPoint(), radius);
GameObject *go;
@ -323,7 +323,7 @@ void SpellStuff::buildTargetList(GameObject *caster, SpellTarget &trg) {
}
break;
}
case eAreaCone: {
case keAreaCone: {
tVect = trg.getPoint() - caster->getWorldLocation();
while (tVect.magnitude() == 0) {
tVect = randomVector(TilePoint(-1, -1, 0), TilePoint(1, 1, 0));
@ -341,7 +341,7 @@ void SpellStuff::buildTargetList(GameObject *caster, SpellTarget &trg) {
}
break;
}
case eAreaWave: {
case keAreaWave: {
tVect = trg.getPoint() - caster->getWorldLocation();
while (tVect.magnitude() == 0) {
tVect = randomVector(TilePoint(-1, -1, 0), TilePoint(1, 1, 0));
@ -381,21 +381,21 @@ void SpellStuff::addTarget(SpellTarget *trg) {
void SpellStuff::removeTargetList() {
switch (_shape) {
case eAreaInvisible:
case eAreaAura:
case eAreaGlow:
case eAreaProjectile:
case eAreaExchange:
case eAreaMissle:
case keAreaInvisible:
case keAreaAura:
case keAreaGlow:
case keAreaProjectile:
case keAreaExchange:
case keAreaMissle:
_targets = nullptr;
break;
case eAreaWall:
case eAreaCone:
case eAreaBeam:
case eAreaBolt:
case eAreaBall:
case eAreaStorm:
case eAreaSquare:
case keAreaWall:
case keAreaCone:
case keAreaBeam:
case keAreaBolt:
case keAreaBall:
case keAreaStorm:
case keAreaSquare:
if (_targets) delete _targets;
_targets = nullptr;
break;
@ -421,18 +421,18 @@ void SpellStuff::show(GameObject *caster, SpellTarget &trg) {
int16 radius = _size;
TilePoint tVect, orth, tBase;
switch (_shape) {
case eAreaInvisible:
case keAreaInvisible:
showTarg(trg.getPoint());
break;
case eAreaAura:
case eAreaGlow:
case eAreaProjectile:
case eAreaExchange:
case eAreaMissle:
case keAreaAura:
case keAreaGlow:
case keAreaProjectile:
case keAreaExchange:
case keAreaMissle:
TPLine(caster->getWorldLocation(), trg.getPoint(), DSPELL_AREA_COLOR);
showTarg(trg.getPoint());
break;
case eAreaSquare: {
case keAreaSquare: {
tVect = trg.getPoint();
orth = TilePoint(squareSpellSize / 2, squareSpellSize / 2, 0);
@ -454,7 +454,7 @@ void SpellStuff::show(GameObject *caster, SpellTarget &trg) {
break;
}
case eAreaBolt: {
case keAreaBolt: {
tVect = trg.getPoint() - caster->getWorldLocation();
while (tVect.magnitude() == 0) {
tVect = randomVector(TilePoint(-1, -1, 0), TilePoint(1, 1, 0));
@ -474,7 +474,7 @@ void SpellStuff::show(GameObject *caster, SpellTarget &trg) {
break;
}
case eAreaBeam: {
case keAreaBeam: {
tVect = trg.getPoint() - caster->getWorldLocation();
while (tVect.magnitude() == 0) {
tVect = randomVector(TilePoint(-1, -1, 0), TilePoint(1, 1, 0));
@ -494,7 +494,7 @@ void SpellStuff::show(GameObject *caster, SpellTarget &trg) {
break;
}
case eAreaBall: {
case keAreaBall: {
radius = ballSpellRadius;
TPCircle(trg.getPoint(), ballSpellRadius, DSPELL_AREA_COLOR);
CircularObjectIterator it(currentWorld, trg.getPoint(), radius);
@ -506,7 +506,7 @@ void SpellStuff::show(GameObject *caster, SpellTarget &trg) {
}
break;
}
case eAreaWall: {
case keAreaWall: {
radius = wallSpellRadius;
TPCircle(trg.getPoint(), radius, DSPELL_AREA_COLOR);
TPCircle(trg.getPoint(), radius / 2, DSPELL_AREA_COLOR);
@ -519,7 +519,7 @@ void SpellStuff::show(GameObject *caster, SpellTarget &trg) {
}
break;
}
case eAreaStorm: {
case keAreaStorm: {
radius = stormSpellRadius;
TPCircle(trg.getPoint(), stormSpellRadius, DSPELL_AREA_COLOR);
CircularObjectIterator it(currentWorld, trg.getPoint(), radius);
@ -531,7 +531,7 @@ void SpellStuff::show(GameObject *caster, SpellTarget &trg) {
}
break;
}
case eAreaCone: {
case keAreaCone: {
tVect = trg.getPoint() - caster->getWorldLocation();
while (tVect.magnitude() == 0) {
tVect = randomVector(TilePoint(-1, -1, 0), TilePoint(1, 1, 0));
@ -550,7 +550,7 @@ void SpellStuff::show(GameObject *caster, SpellTarget &trg) {
}
break;
}
case eAreaWave: {
case keAreaWave: {
tVect = trg.getPoint() - caster->getWorldLocation();
while (tVect.magnitude() == 0) {
tVect = randomVector(TilePoint(-1, -1, 0), TilePoint(1, 1, 0));

View File

@ -215,9 +215,9 @@ static void loadMagicData() {
if (spellRes == nullptr || !spellRes->_valid)
error("Error accessing spell resource group.\n");
i = 1;
ADD_SHOW(eAreaInvisible, 0, 0, 0, 0, diFlagInc, ecFlagNone, 30, MKTAG('S', 'T', 'A', 0), 23, 24);
ADD_SHOW(keAreaInvisible, 0, 0, 0, 0, diFlagInc, ecFlagNone, 30, MKTAG('S', 'T', 'A', 0), 23, 24);
spellBook[0].setManaType(sManaIDSkill);
spellBook[0].setManaType(ksManaIDSkill);
while (spellRes->size(
MKTAG('I', 'N', 'F', i)) > 0) {

View File

@ -37,13 +37,13 @@ class ProtoEffect;
// Mana IDs as spells see them
enum SpellManaID {
sManaIDRed = 0,
sManaIDOrange = 1,
sManaIDYellow = 2,
sManaIDGreen = 3,
sManaIDBlue = 4,
sManaIDViolet = 5,
sManaIDSkill = 6 // skills are here for convenience
ksManaIDRed = 0,
ksManaIDOrange = 1,
ksManaIDYellow = 2,
ksManaIDGreen = 3,
ksManaIDBlue = 4,
ksManaIDViolet = 5,
ksManaIDSkill = 6 // skills are here for convenience
};
//-------------------------------------------------------------------
@ -56,25 +56,25 @@ enum SpellManaID {
//-------------------------------------------------------------------
// legal target selections
enum SpellTargetingTypes {
spellTargNone = 0,
spellTargWorld = 1 << 0, // instant spell
spellTargLocation = 1 << 1, // cast at any location on map
spellTargTAG = 1 << 2, // cast at tileactivity inst.
spellTargObject = 1 << 3, // cast at objects
spellTargActor = 1 << 4,
spellTargCaster = 1 << 5
kSpellTargNone = 0,
kSpellTargWorld = 1 << 0, // instant spell
kSpellTargLocation = 1 << 1, // cast at any location on map
kSpellTargTAG = 1 << 2, // cast at tileactivity inst.
kSpellTargObject = 1 << 3, // cast at objects
kSpellTargActor = 1 << 4,
kSpellTargCaster = 1 << 5
};
//-------------------------------------------------------------------
// target type the spell uses when implemented
enum SpellApplicationTypes {
spellApplyNone = spellTargNone,
spellApplyWorld = spellTargWorld,
spellApplyLocation = spellTargLocation,
spellApplyTAG = spellTargTAG,
spellApplyObject = spellTargObject,
spellApplyActor = spellTargObject,
spellApplyTracking = 1 << 6 // track object targets
kSpellApplyNone = kSpellTargNone,
kSpellApplyWorld = kSpellTargWorld,
kSpellApplyLocation = kSpellTargLocation,
kSpellApplyTAG = kSpellTargTAG,
kSpellApplyObject = kSpellTargObject,
kSpellApplyActor = kSpellTargObject,
kSpellApplyTracking = 1 << 6 // track object targets
};
@ -83,20 +83,20 @@ enum SpellApplicationTypes {
// These are the shapes of the visible effects of spells
enum effectAreas {
eAreaInvisible = 0,
eAreaAura,
eAreaProjectile,
eAreaExchange,
eAreaBolt,
eAreaCone,
eAreaBall,
eAreaSquare,
eAreaWave,
eAreaStorm,
eAreaMissle,
eAreaGlow,
eAreaBeam,
eAreaWall
keAreaInvisible = 0,
keAreaAura,
keAreaProjectile,
keAreaExchange,
keAreaBolt,
keAreaCone,
keAreaBall,
keAreaSquare,
keAreaWave,
keAreaStorm,
keAreaMissle,
keAreaGlow,
keAreaBeam,
keAreaWall
};
@ -150,14 +150,14 @@ public:
}
bool untargetable() {
return (_targetableTypes == spellTargNone);
return (_targetableTypes == kSpellTargNone);
}
bool untargeted() {
return false; //(targetableTypes == spellTargWorld ) ||
return false; //(targetableTypes == kSpellTargWorld ) ||
}
//(targetableTypes == spellTargCaster ) ||
//(targetableTypes == kSpellTargCaster ) ||
//(targetableTypes == targetableTypes &
// (spellTargWorld | spellTargCaster)); }
// (kSpellTargWorld | kSpellTargCaster)); }
void implement(GameObject *enactor, SpellTarget *target);
void implement(GameObject *enactor, GameObject *target);

View File

@ -122,7 +122,7 @@ void SpellStuff::addEffect(ResourceSpellEffect *rse) {
0,
(effectDamageTypes) rse->effectType,
0,
rse->targeting & spellTargCaster);
rse->targeting & kSpellTargCaster);
break;
case kEffectDrains :
pe = new ProtoDrainage(
@ -132,7 +132,7 @@ void SpellStuff::addEffect(ResourceSpellEffect *rse) {
0,
(effectDrainsTypes) rse->effectType,
0,
rse->targeting & spellTargCaster);
rse->targeting & kSpellTargCaster);
break;
case kEffectTAG :
pe = new ProtoTAGEffect(

View File

@ -67,28 +67,28 @@ namespace Saga2 {
int16 whichColorMap(EffectID eid, const Effectron *const effectron) {
int16 rval = 0;
switch (eid) {
case eAreaInvisible:
case eAreaAura:
case eAreaGlow:
case eAreaProjectile:
case eAreaExchange:
case eAreaMissle:
case eAreaBeam:
case eAreaWall:
case keAreaInvisible:
case keAreaAura:
case keAreaGlow:
case keAreaProjectile:
case keAreaExchange:
case keAreaMissle:
case keAreaBeam:
case keAreaWall:
rval = 0;
break;
case eAreaSquare:
case eAreaBall:
case eAreaStorm:
case keAreaSquare:
case keAreaBall:
case keAreaStorm:
rval = (effectron->_parent->_effSeq == 0) ? 0 : 1;
break;
case eAreaBolt:
case keAreaBolt:
rval = ((effectron->_partno % 3) == 1) ? 0 : 1;
break;
case eAreaCone:
case keAreaCone:
rval = ((effectron->_partno / 9) == 0) ? 0 : 1;
break;
case eAreaWave:
case keAreaWave:
rval = ((effectron->_partno / 17) == 0) ? 0 : 1;
break;
}

View File

@ -83,12 +83,12 @@ ProtoEffect *createNewProtoEffect(Common::SeekableReadStream *stream) {
case kEffectDamage:
pe = new ProtoDamage(baseDice, diceSides, skillDice, baseDamage,
(effectDamageTypes)effectType, 0, targeting & spellTargCaster, skillDamage);
(effectDamageTypes)effectType, 0, targeting & kSpellTargCaster, skillDamage);
break;
case kEffectDrains:
pe = new ProtoDrainage(baseDice, diceSides, skillDice, baseDamage,
(effectDrainsTypes)effectType, 0, targeting & spellTargCaster);
(effectDrainsTypes)effectType, 0, targeting & kSpellTargCaster);
break;
case kEffectPoison: