aboutsummaryrefslogtreecommitdiff
path: root/engines/agi/graphics.cpp
diff options
context:
space:
mode:
authorMartin Kiewitz2016-02-13 20:42:30 +0100
committerMartin Kiewitz2016-02-13 20:42:30 +0100
commit9f59b5ed7c3130bd7b0060e770a9ec915a91a891 (patch)
treea25c0a9be25596fa1c236fb2a49879253a27e0e2 /engines/agi/graphics.cpp
parent94e5804b84e3e165055fd210f002279d0deb1bb0 (diff)
downloadscummvm-rg350-9f59b5ed7c3130bd7b0060e770a9ec915a91a891.tar.gz
scummvm-rg350-9f59b5ed7c3130bd7b0060e770a9ec915a91a891.tar.bz2
scummvm-rg350-9f59b5ed7c3130bd7b0060e770a9ec915a91a891.zip
AGI: Fix priority band handling
- Fix saving/loading priority bands table. Now saving the actual raw data - Now also saving the flag, that defines if the priority table got modified by scripts - For older saved games it will try to figure out the state of that flag - Blocking set.pri.base for AGI below 2.936 - set.pri.base was actually introduced in 2.936 and not AGI3 - The set.pri.base bug was present in 2.936 as well - Saved games created between the graphics rewrite and this commit may have priority issues for games, that used AGI2.936+
Diffstat (limited to 'engines/agi/graphics.cpp')
-rw-r--r--engines/agi/graphics.cpp35
1 files changed, 32 insertions, 3 deletions
diff --git a/engines/agi/graphics.cpp b/engines/agi/graphics.cpp
index b0165154c8..abe3dc707e 100644
--- a/engines/agi/graphics.cpp
+++ b/engines/agi/graphics.cpp
@@ -750,10 +750,15 @@ void GfxMgr::updateScreen() {
}
void GfxMgr::initPriorityTable() {
+ _priorityTableSet = false;
+
+ createDefaultPriorityTable(_priorityTable);
+}
+
+void GfxMgr::createDefaultPriorityTable(uint8 *priorityTable) {
int16 priority, step;
int16 yPos = 0;
- _priorityTableSet = false;
for (priority = 1; priority < 15; priority++) {
for (step = 0; step < 12; step++) {
_priorityTable[yPos++] = priority < 4 ? 4 : priority;
@@ -775,11 +780,35 @@ void GfxMgr::setPriorityTable(int16 priorityBase) {
}
}
+// used for saving
+int16 GfxMgr::saveLoadGetPriority(int16 yPos) {
+ assert(yPos < SCRIPT_HEIGHT);
+ return _priorityTable[yPos];
+}
+bool GfxMgr::saveLoadWasPriorityTableModified() {
+ return _priorityTableSet;
+}
+
// used for restoring
-void GfxMgr::setPriority(int16 yPos, int16 priority) {
+void GfxMgr::saveLoadSetPriority(int16 yPos, int16 priority) {
assert(yPos < SCRIPT_HEIGHT);
_priorityTable[yPos] = priority;
}
+void GfxMgr::saveLoadSetPriorityTableModifiedBool(bool wasModified) {
+ _priorityTableSet = wasModified;
+}
+void GfxMgr::saveLoadFigureOutPriorityTableModifiedBool() {
+ uint8 defaultPriorityTable[SCRIPT_HEIGHT]; /**< priority table */
+
+ createDefaultPriorityTable(defaultPriorityTable);
+
+ if (memcmp(defaultPriorityTable, _priorityTable, sizeof(_priorityTable)) == 0) {
+ // Match, it is the default table, so reset the flag
+ _priorityTableSet = false;
+ } else {
+ _priorityTableSet = true;
+ }
+}
/**
* Convert sprite priority to y value.
@@ -792,7 +821,7 @@ int16 GfxMgr::priorityToY(int16 priority) {
return (priority - 5) * 12 + 48;
}
- // dynamic priority bands were introduced in 3.002.086 (effectively AGI3)
+ // dynamic priority bands were introduced in 2.936 (effectively last version of AGI2)
// It seems there was a glitch, that caused priority bands to not get calculated properly.
// It was caused by this function starting with Y = 168 instead of 167, which meant it always
// returned with 168 as result.