[Scummvm-git-logs] scummvm master -> b7ea13750afe7cf3dd39119bb360b5723a96c492
a-yyg
76591232+a-yyg at users.noreply.github.com
Sun Jul 4 07:36:28 UTC 2021
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
b7ea13750a SAGA2: Clean global constructors in speldata.cpp
Commit: b7ea13750afe7cf3dd39119bb360b5723a96c492
https://github.com/scummvm/scummvm/commit/b7ea13750afe7cf3dd39119bb360b5723a96c492
Author: a/ (yuri.kgpps at gmail.com)
Date: 2021-07-04T16:35:24+09:00
Commit Message:
SAGA2: Clean global constructors in speldata.cpp
Changed paths:
engines/saga2/dispnode.cpp
engines/saga2/saga2.h
engines/saga2/spelcast.cpp
engines/saga2/speldata.cpp
engines/saga2/spellio.cpp
engines/saga2/spelshow.h
diff --git a/engines/saga2/dispnode.cpp b/engines/saga2/dispnode.cpp
index dd0b7f4e37..b70380b2e0 100644
--- a/engines/saga2/dispnode.cpp
+++ b/engines/saga2/dispnode.cpp
@@ -44,7 +44,6 @@ DisplayNode *DisplayNodeList::head;
DisplayNodeList mainDisplayList;
SpellDisplayList activeSpells(maxActiveSpells);
-//extern SpellDisplayPrototypeList SpellDisplayPrototypeList::sdpList;
bool centerActorIndicatorEnabled;
@@ -990,7 +989,7 @@ void Effectron::drawEffect(void) {
sc->sp = spellSprites->sprite(spriteID()); //tempSpellSpriteIDs[rand()%39] );
sc->offset.x = scList->offset.y = 0;
- SpellDisplayPrototypeList::sdpList[parent->spell]->
+ (*g_vm->_sdpList)[parent->spell]->
getColorTranslation(eColors, this);
sc->colorTable = eColors;
diff --git a/engines/saga2/saga2.h b/engines/saga2/saga2.h
index d45ebacf4e..f78f0ebc11 100644
--- a/engines/saga2/saga2.h
+++ b/engines/saga2/saga2.h
@@ -50,6 +50,8 @@ class GrabInfo;
class CImageCache;
class SensorList;
class Sensor;
+class EffectDisplayPrototypeList;
+class SpellDisplayPrototypeList;
enum {
kDebugResources = 1 << 0,
@@ -111,6 +113,9 @@ public:
BandList *_bandList;
CImageCache *_imageCache;
GrabInfo *_mouseInfo;
+ EffectDisplayPrototypeList *_edpList;
+ SpellDisplayPrototypeList *_sdpList;
+
gDisplayPort _mainPort;
diff --git a/engines/saga2/spelcast.cpp b/engines/saga2/spelcast.cpp
index 85065838a5..1467225f1a 100644
--- a/engines/saga2/spelcast.cpp
+++ b/engines/saga2/spelcast.cpp
@@ -647,7 +647,7 @@ SpellInstance::~SpellInstance() {
// common initialization code
void SpellInstance::init(void) {
- dProto = SpellDisplayPrototypeList::sdpList[spell];
+ dProto = (*g_vm->_sdpList)[spell];
ProtoObj *proto = caster->proto();
TilePoint sPoint = caster->getWorldLocation();
sPoint.z += proto->height / 2;
@@ -656,7 +656,7 @@ void SpellInstance::init(void) {
effSeq = 0;
assert(dProto);
if (!dProto) return;
- effect = EffectDisplayPrototypeList::edpList[dProto->effect];
+ effect = (*g_vm->_edpList)[dProto->effect];
implementAge = dProto->implementAge;
maxAge = dProto->maxAge;
initEffect(sPoint);
diff --git a/engines/saga2/speldata.cpp b/engines/saga2/speldata.cpp
index 5c830b1de4..5ed31d3493 100644
--- a/engines/saga2/speldata.cpp
+++ b/engines/saga2/speldata.cpp
@@ -100,8 +100,6 @@ extern SpellDisplayList activeSpells;
Global data
* ===================================================================== */
-EffectDisplayPrototypeList EffectDisplayPrototypeList::edpList(maxEffectPrototypes);
-SpellDisplayPrototypeList SpellDisplayPrototypeList::sdpList(maxSpellPrototypes);
SpriteSet *spellSprites; // longsword test sprites
SpellStuff spellBook[maxSpells];
@@ -125,6 +123,9 @@ static void loadMagicData(void);
// InitMagic called from main startup code
void initMagic(void) {
+ g_vm->_edpList = new EffectDisplayPrototypeList(maxEffectPrototypes);
+ g_vm->_sdpList = new SpellDisplayPrototypeList(maxSpellPrototypes);
+
defineEffects();
loadMagicData();
@@ -150,8 +151,11 @@ void cleanupMagic(void) {
for (int i = 0; i < maxSpells; i++) {
spellBook[i].killEffects();
}
- SpellDisplayPrototypeList::sdpList.cleanup();
- EffectDisplayPrototypeList::edpList.cleanup();
+ g_vm->_sdpList->cleanup();
+ g_vm->_edpList->cleanup();
+
+ delete g_vm->_sdpList;
+ delete g_vm->_edpList;
}
@@ -163,9 +167,9 @@ void cleanupMagic(void) {
// the macros make things more legible than the entire call
// Set up a display effect shape
-#define ADD_EFFECT( n, p, s, f, h, b, i ) ( EffectDisplayPrototypeList::edpList.add( new EffectDisplayPrototype(n,&p,&s,&f,&h,&b,&i )))
+#define ADD_EFFECT( n, p, s, f, h, b, i ) ( g_vm->_edpList->add( new EffectDisplayPrototype(n,&p,&s,&f,&h,&b,&i )))
// Chain another effect when done
-#define SECOND_EFFECT( e, n, p, s, f, h, b, i ) ( EffectDisplayPrototypeList::edpList.append( new EffectDisplayPrototype(n,&p,&s,&f,&h,&b,&i ),e))
+#define SECOND_EFFECT( e, n, p, s, f, h, b, i ) ( g_vm->_edpList->append( new EffectDisplayPrototype(n,&p,&s,&f,&h,&b,&i ),e))
//-----------------------------------------------------------------------
@@ -193,7 +197,7 @@ static void defineEffects(void) {
}
//-----------------------------------------------------------------------
-#define ADD_SHOW( e, a, b, c, d, f, g, m, i, s, n ) ( SpellDisplayPrototypeList::sdpList.add( new SpellDisplayPrototype( e, a, b, c, d, f, g, m, i, s, n )))
+#define ADD_SHOW( e, a, b, c, d, f, g, m, i, s, n ) ( g_vm->_sdpList->add( new SpellDisplayPrototype( e, a, b, c, d, f, g, m, i, s, n )))
//-----------------------------------------------------------------------
// loadMagicData : reads magic related data from the resource file
@@ -225,7 +229,7 @@ static void loadMagicData(void) {
error("Unable to load data for spell %d", i);
spellBook[rsi->spell].setupFromResource(rsi);
- SpellDisplayPrototypeList::sdpList.add(new SpellDisplayPrototype(rsi));
+ g_vm->_sdpList->add(new SpellDisplayPrototype(rsi));
free(rsi);
i++;
diff --git a/engines/saga2/spellio.cpp b/engines/saga2/spellio.cpp
index 87d718ebe4..190da821b1 100644
--- a/engines/saga2/spellio.cpp
+++ b/engines/saga2/spellio.cpp
@@ -307,7 +307,7 @@ SpellTarget::SpellTarget(StorageSpellTarget &sst) {
SpellInstance::SpellInstance(StorageSpellInstance &ssi) {
implementAge = ssi.implementAge; // age at which to implement the spell effects
- dProto = SpellDisplayPrototypeList::sdpList[ssi.dProto];
+ dProto = (*g_vm->_sdpList)[ssi.dProto];
caster = GameObject::objectAddress(ssi.caster);
target = new SpellTarget(ssi.target);
GameObject *go = GameObject::objectAddress(ssi.world);
@@ -316,15 +316,10 @@ SpellInstance::SpellInstance(StorageSpellInstance &ssi) {
age = ssi.age;
spell = ssi.spell;
maxAge = ssi.maxAge;
-#if 0
- effect = EffectDisplayPrototypeList::edpList[ssi.effect];
- effSeq = ssi.effSeq; // which effect in a sequence is being played
-#else
effSeq = 0;
- effect = EffectDisplayPrototypeList::edpList[ssi.effect];
+ effect = (*g_vm->_edpList)[ssi.effect];
while (effSeq < ssi.effSeq) // which effect in a sequence is being played
effect = effect->next;
-#endif
}
size_t SpellDisplayList::saveSize(void) {
diff --git a/engines/saga2/spelshow.h b/engines/saga2/spelshow.h
index 17c785f755..b7ee6090d8 100644
--- a/engines/saga2/spelshow.h
+++ b/engines/saga2/spelshow.h
@@ -201,8 +201,6 @@ public:
void cleanup(void);
void append(EffectDisplayPrototype *edp, int32 acount);
EffectDisplayPrototype *operator[](EffectID e);
-
- static EffectDisplayPrototypeList edpList;
};
//-----------------------------------------------------------------------
@@ -292,8 +290,6 @@ public:
void cleanup(void);
int32 add(SpellDisplayPrototype *sdp);
SpellDisplayPrototype *operator[](SpellID s);
-
- static SpellDisplayPrototypeList sdpList;
};
//-----------------------------------------------------------------------
@@ -385,7 +381,7 @@ inline EffectID Effectron::spellID(void) {
return parent->spell;
}
inline SpellDisplayPrototype *Effectron::spell(void) {
- return SpellDisplayPrototypeList::sdpList[(SpellID) spellID()];
+ return (*g_vm->_sdpList)[(SpellID) spellID()];
}
inline EffectID Effectron::effectID(void) {
return spell()->effect;
More information about the Scummvm-git-logs
mailing list