This has been bugging me for a while...
Note that ifNotStateCommon and ifStateCommon have
been semantically inverted until now. I also fixed their
naming now to reflect what they are actually doing.
This is the thing I held off doing during the HE gfx rewrite, only to find out
it was actually needed. As usual, a great number of changes for... only
one small bug fixed. This closes ticket #9619:
"SCUMM/HE: PUTTZOO- Kenya Animation Bug Persists"
I have tested a bunch of representative HE70+,80,90,95,98,99,100
entries and I didn't notice regressions.
HE versions under 70 have not been touched by this, as I'd like to
know if there are issues with actor/object overlaps BEFORE actually
starting disassembling 16-bit DOS executables...
The 256-color versions of Indy3 have a very strange vertical line on the
big tapestry that's in the middle of room 135, in Castle Brunwald.
It looks like an artist made some wrong click when redrawing this object
for the VGA versions, or maybe the compression routine for those images
had some bug. QA was probably rushed for this port, too, since Indy3 has
various oversights related to the VGA conversion. A similar problem was
fixed in commit 6735e3c0f0.
The tapestry glitch was a bit harder to fix, because the glitched line
hides several pixels with different colors, and because this resource is
in a compressed format. AFAICS, v3 games have no concept of transparent
pixels for background objects, so that simpler solution wouldn't work
either. We could also trim the leftmost OI strip (since the wall in the
background is fine), but I couldn't get this to safely work with the way
unkDecode11() works.
So I have redrawn a fixed OI_0324 with the old BMRP.EXE tool, diffed
the two resources and then added a small mechanism which patches (for
copyright reasons) the impacted bytes from the original resource, as
it is being read. This is a very low-level trick, so various checks
have been added to make sure that we're not corrupting something
(incl. any fan-made modified Indy3), and also in order to make the
workaround a bit easier to follow.
(The most obsessive players will notice that the tapestry still cuts
through a part of the column in the upper-right corner, but I'm only
interested in fixing the obvious problem which was right in the
middle of the room. Sorry if you wished you hadn't seen this.)
There was no copy protection on NES, since it was on a cartridge.
One just needs to open the security door like a regular door, with its
dramatic sound effect.
This also lets one close the door again, like in the original game.
The drawObject() function would always mask out the last three bits of
the object height. This is correct for many versions of SCUMM, but not
for SCUMM v7-v8. In Full Throttle, it caused a glitch when drawing the
open doors to the Corley Motors building late in the game.
So far, this is the only glitch known to have been caused by this. Maybe
the developers generally adjusted the height of their objects out of
habit when creating the games?
In some cases the pointer returned is used directly without further
error checking.
As most instances already assert() in this case this commit simply
adds asserts where missing and deemed appropriate.
This fixes a regression in V1/V2 games when no actor direction
is set (like the Shuttle Bus scene in Zak V2). The regression
was caused by commit de0b5f7674.
Thanks to digitall for his bisecting work, which aided a lot in
finding the actual issue for this bug
Some object functions allow actor IDs and object IDs as parameters. They are easily distinguishable in engines > 0 as actor IDs are < _numActors and object IDs are bigger. In v0 this is not the case as there are objects with IDs like 3 and 5 (e.g. the hamster). So object ID handling was unified for v0 and the other engines by introducing objIsActor(), objToActor() and ActorToObj().
- o5_breakHere() seems to be still needed. For example edna does not manage to walk up the ladder if this is not enabled.
- numLocalObjects seems to be big enough so that < instead of <= can be used. The original interpreter only uses the local ids 0 .. 44 whereas scummvm has _numLocalObjects set to 200.
- MM C64 uses command stack (SentenceTab, doSentence()) now
- _cmdObject... added for current SentenceTab. The _active... variables are only used to build a sentence in the inventory but never by a script.
-> many routines are not needed anymore and are removed
- removed complicated and unnecessary _v0ObjectIndex, _v0ObjectInInventory, _v0ObjectFlag vars
- started to merge object id and type into one object value (type<<8|id)
- verb preposition ids do not dependent on language -> remove from VerbSettings
Note:
- objects with type=0 are foreground objects. They have a state, an owner and a bg overlay image.
- objects with type=1 are bg objects. They do not have a state or owner and are already contained in the bg image. The do not have an entry in objectState/OwnerTable
Note: the transition is not completed yet. The code compiles but is probably not runnable as not every occurrence of _activeInventory has been properly replaced.
The usage of _v0ObjectIndex and _v0ObjectInInventory should be revised too and both variables should be replaced by another mechanism (maybe by using a single variable "obj = (type << 8) | id").
- moved v0 only vars _activeInventory, _activeObject, _activeVerb from ScummEngine_v2 to ScummEngine_v0
- removed _activeActor, _activeInvExecute, _activeObject2Inv and _activeInventory. They are handled by _activeObject/_activeObjectType and _activeObject2/_activeObject2Type now.
- removed _activeObject(2)Index as they only bloat the code without any benefit (?)
- merge prep-name tables from ScummEngine_v2::drawPreposition() and ScummEngine_v0::drawSentenceWord() by introducing ScummEngine_v2::drawPreposition()
- rename ObjectData.flags -> obj_type (quick-fix only, needs review! Maybe obj_nr and obj_type can be merged into one var: obj_nr = (obj_type << 8) | obj_nr)
- o_unknown2 is negation of o_ifActiveObject (o_ifNotEqualActiveObject2)
- renamed o_ifActiveObject -> o_ifEqualActiveObject2 as it acts only on _activeObject2
- renamed ScummEngine_v0::drawSentenceWord() -> ScummEngine_v0::getObjectName()