summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2018-04-02 20:36:17 +0300
committerAndrei Karas <akaras@inbox.ru>2018-04-02 20:36:17 +0300
commit9e94feb923afe8ce73b6590b73f513dd3895e70b (patch)
treec60c6979ef76ebf1b820000883e4c79e6a928777
parentb9584b9b876709ae97e94929d3904975e8143832 (diff)
downloadmv-9e94feb923afe8ce73b6590b73f513dd3895e70b.tar.gz
mv-9e94feb923afe8ce73b6590b73f513dd3895e70b.tar.bz2
mv-9e94feb923afe8ce73b6590b73f513dd3895e70b.tar.xz
mv-9e94feb923afe8ce73b6590b73f513dd3895e70b.zip
Remove legacy status effect field "block-id".
Before was warning about this field for some years.
-rw-r--r--src/being/actorsprite.cpp97
-rw-r--r--src/being/actorsprite.h9
-rw-r--r--src/resources/db/statuseffectdb.cpp25
-rw-r--r--src/resources/db/statuseffectdb.h9
-rw-r--r--src/settings.h2
5 files changed, 16 insertions, 126 deletions
diff --git a/src/being/actorsprite.cpp b/src/being/actorsprite.cpp
index c494da7ed..a56e31463 100644
--- a/src/being/actorsprite.cpp
+++ b/src/being/actorsprite.cpp
@@ -61,8 +61,6 @@
#define end_foreach }
-static const unsigned int STATUS_EFFECTS = 32;
-
AnimatedSprite *ActorSprite::targetCursor
[CAST_SIZE(TargetCursorType::NUM_TCT)]
[CAST_SIZE(TargetCursorSize::NUM_TC)];
@@ -218,34 +216,6 @@ void ActorSprite::setStatusEffect(const int32_t index,
}
}
-// function for legacy configs only. Must be removed in future
-void ActorSprite::setStatusEffectBlock(const int offset,
- const uint16_t newEffects)
-{
- for (unsigned i = 0; i < STATUS_EFFECTS; i++)
- {
- const bool val = (newEffects & (1 << i)) > 0;
- const int32_t index = StatusEffectDB::blockIdToId(
- offset + i); // block-id (offset + i) to id (index)
-
- if (index != -1)
- {
- setStatusEffect(index,
- fromBool(val, Enable),
- IsStart_true);
- }
- else if (val && config.getBoolValue("unimplimentedLog"))
- {
- const std::string str = strprintf(
- "Error: unknown effect by block-index. "
- "Offset: %d, effect int: %d, i: %u",
- offset, CAST_S32(newEffects), i);
- logger->log(str);
- DebugMessageListener::distributeEvent(str);
- }
- }
-}
-
static void applyEffectByOption(ActorSprite *const actor,
uint32_t option,
const char *const name,
@@ -316,67 +286,32 @@ void ActorSprite::setStatusEffectOpitons(const uint32_t option,
const uint32_t opt2,
const uint32_t opt3)
{
- if (settings.legacyEffects == false)
- {
- applyEffectByOption(this, option, "option",
- StatusEffectDB::getOptionMap());
- applyEffectByOption1(this, opt1, "opt1",
- StatusEffectDB::getOpt1Map());
- applyEffectByOption(this, opt2, "opt2",
- StatusEffectDB::getOpt2Map());
- applyEffectByOption(this, opt3, "opt3",
- StatusEffectDB::getOpt3Map());
- }
- else
- {
- uint32_t statusEffects = opt2;
- statusEffects |= option << 16;
- setStatusEffectBlock(0,
- CAST_U16((statusEffects >> 16) & 0xffffU));
- setStatusEffectBlock(16,
- CAST_U16(statusEffects & 0xffffU));
- setStatusEffectBlock(32,
- CAST_U16(opt3));
- }
+ applyEffectByOption(this, option, "option",
+ StatusEffectDB::getOptionMap());
+ applyEffectByOption1(this, opt1, "opt1",
+ StatusEffectDB::getOpt1Map());
+ applyEffectByOption(this, opt2, "opt2",
+ StatusEffectDB::getOpt2Map());
+ applyEffectByOption(this, opt3, "opt3",
+ StatusEffectDB::getOpt3Map());
}
void ActorSprite::setStatusEffectOpitons(const uint32_t option,
const uint32_t opt1,
const uint32_t opt2)
{
- if (settings.legacyEffects == false)
- {
- applyEffectByOption(this, option, "option",
- StatusEffectDB::getOptionMap());
- applyEffectByOption1(this, opt1, "opt1",
- StatusEffectDB::getOpt1Map());
- applyEffectByOption(this, opt2, "opt2",
- StatusEffectDB::getOpt2Map());
- }
- else
- {
- uint32_t statusEffects = opt2;
- statusEffects |= option << 16;
- setStatusEffectBlock(0,
- CAST_U16((statusEffects >> 16) & 0xffffU));
- setStatusEffectBlock(16,
- CAST_U16(statusEffects & 0xffffU));
- }
+ applyEffectByOption(this, option, "option",
+ StatusEffectDB::getOptionMap());
+ applyEffectByOption1(this, opt1, "opt1",
+ StatusEffectDB::getOpt1Map());
+ applyEffectByOption(this, opt2, "opt2",
+ StatusEffectDB::getOpt2Map());
}
void ActorSprite::setStatusEffectOpiton0(const uint32_t option)
{
- if (settings.legacyEffects == false)
- {
- applyEffectByOption(this, option, "option",
- StatusEffectDB::getOptionMap());
- }
- else
- {
- const uint32_t statusEffects = option << 16;
- setStatusEffectBlock(0,
- CAST_U16((statusEffects >> 16) & 0xffff));
- }
+ applyEffectByOption(this, option, "option",
+ StatusEffectDB::getOptionMap());
}
void ActorSprite::updateStatusEffect(const int32_t index,
diff --git a/src/being/actorsprite.h b/src/being/actorsprite.h
index a73c91ef7..b872b52c6 100644
--- a/src/being/actorsprite.h
+++ b/src/being/actorsprite.h
@@ -201,15 +201,6 @@ class ActorSprite notfinal : public CompoundSprite, public Actor
protected:
/**
- * A status effect block is a 16 bit mask of status effects. We assign
- * each such flag a block ID of offset + bitnr.
- *
- * These are NOT the same as the status effect indices.
- */
- void setStatusEffectBlock(const int offset,
- const uint16_t newEffects);
-
- /**
* Notify self that a status effect has flipped.
* The new flag is passed.
*/
diff --git a/src/resources/db/statuseffectdb.cpp b/src/resources/db/statuseffectdb.cpp
index 72dbf26a6..77da2737a 100644
--- a/src/resources/db/statuseffectdb.cpp
+++ b/src/resources/db/statuseffectdb.cpp
@@ -42,17 +42,8 @@ namespace
OptionsMap opt1ToIdMap;
OptionsMap opt2ToIdMap;
OptionsMap opt3ToIdMap;
-
- OptionsMap blockIdToIdMap;
} // namespace
-int StatusEffectDB::blockIdToId(const int blockIndex)
-{
- if (blockIdToIdMap.find(blockIndex) == blockIdToIdMap.end())
- return -1;
- return blockIdToIdMap[blockIndex];
-}
-
StatusEffect *StatusEffectDB::getStatusEffect(const int index,
const Enable enabling)
{
@@ -78,11 +69,6 @@ void StatusEffectDB::load()
SkipError_true);
loadXmlDir("statusEffectsPatchDir", loadXmlFile);
- if (!blockIdToIdMap.empty())
- {
- reportAlways("Detected legacy attribute block-id "
- "in status-effects.xml");
- }
mLoaded = true;
}
@@ -113,12 +99,6 @@ void StatusEffectDB::loadXmlFile(const std::string &fileName,
}
int id = XML::getProperty(node, "id", -1);
-
- // legacy field. Only for clients 1.6.3.12 and older
- const int blockId = XML::getProperty(node, "block-id", -1);
- if (id >= 0 && blockId >= 0)
- blockIdToIdMap[blockId] = id;
-
if (id == -1)
{
id = fakeId;
@@ -131,22 +111,18 @@ void StatusEffectDB::loadXmlFile(const std::string &fileName,
if (option != 0)
{
optionToIdMap[option] = id;
- settings.legacyEffects = false;
}
if (opt1 != 0)
{
opt1ToIdMap[opt1] = id;
- settings.legacyEffects = false;
}
if (opt2 != 0)
{
opt2ToIdMap[opt2] = id;
- settings.legacyEffects = false;
}
if (opt3 != 0)
{
opt3ToIdMap[opt3] = id;
- settings.legacyEffects = false;
}
StatusEffect *startEffect = statusEffects[1][id];
@@ -225,7 +201,6 @@ void StatusEffectDB::unload()
opt1ToIdMap.clear();
opt2ToIdMap.clear();
opt3ToIdMap.clear();
- blockIdToIdMap.clear();
mLoaded = false;
}
diff --git a/src/resources/db/statuseffectdb.h b/src/resources/db/statuseffectdb.h
index a7a9d5efe..8b0105c2b 100644
--- a/src/resources/db/statuseffectdb.h
+++ b/src/resources/db/statuseffectdb.h
@@ -48,15 +48,6 @@ namespace StatusEffectDB
StatusEffect *getStatusEffect(const int index,
const Enable enabling) A_WARN_UNUSED;
- /**
- * Maps a block effect index to its corresponding effect index. Block
- * effect indices are used for opt2/opt3/status.option blocks; their
- * mapping to regular effect indices is handled in the config file.
- *
- * Returns -1 on failure.
- */
- int blockIdToId(const int blocKIndex) A_WARN_UNUSED;
-
void load();
void loadXmlFile(const std::string &fileName,
diff --git a/src/settings.h b/src/settings.h
index bbf65ca45..eadc1d78f 100644
--- a/src/settings.h
+++ b/src/settings.h
@@ -91,7 +91,6 @@ class Settings final
pseudoAwayMode(false),
fixDeadAnimation(true),
disableLoggingInGame(false),
- legacyEffects(true),
enableRemoteCommands(true),
uselonglivesprites(false),
unknownSkillsAutoTab(true),
@@ -156,7 +155,6 @@ class Settings final
bool pseudoAwayMode;
bool fixDeadAnimation;
bool disableLoggingInGame;
- bool legacyEffects;
bool enableRemoteCommands;
bool uselonglivesprites;
bool unknownSkillsAutoTab;