Previously we just spawned the usecode event, but to be faithful to the
original the intrinsic should do everything in Item::enterFastArea.
This also adds a workaround for a bug that was occasionally triggered when
returning to the rebel base in Crusader: No Remorse, and fixes an original game
bug in the process.
Also add the customizations to the tookHit function that exist in No Regret -
particularly, different SFX that get played depending on the NPC shape.
RollingThunder is just a stub process for now - needs implementing.
This bug was a bit complex.
This change ensures that cacheIn events get called before enterFastArea. In
Ultima 8 only a couple of classes have cacheIn events, so it makes no real
difference. In Crusader, this bug caused extra people in the rebel base because
they got the wrong mission number during enterFastArea (the mission number is
updated in a cacheIn event).
The previous map switch code was re-making the CameraProcess as needed, but
after the cacheIn usecode processes were created - so the new camera went to
the front of the process queue. The first execution of the camera process then
updates the fast area, and enterFastArea processes get added to the front of
the queue again (in front of the cacheIn events). Switch to only updating the
existing camera process where possible instead of creating a new one, so the
execution order does not change.
The ammo data is stored in shop data 1, and is always the same. Items and
weapons should all be shown in "weapons" mode.
This is still not exact to original - it seems the ammo needs filtering based
on something, probably the unknown data field in stuff.dat.
Inspecting the disassembly more closely and trying to fix the usecode for the
Crusader spider bombs (CRU_SPID::ordinal20), the parameter for this intrinsic
is not "force", but more like "move until blocked", and when it's false the
item should not move at all if there is a block.
The spider bomb usecode tries to move the bomb down every now and then to check
for a fall, but if it meant "force" then the bomb would go into the floor. It
would also never explode because it was always forced into the new position and
never fails.
The return value is whether the move completed.
The list before had some omissions so the avatar would still fall a bit. This
should remove the last places we see pausing while walking around on elevated
platforms etc.
The previous code made it possible to accidentally jump through thin objects
like laser barriers because it was not testing that the avatar could get to the
start point of the adjusted move. Added a sweep test to ensure the start point
is also valid.
Opcode 0x3E pushes a byte on to the stack as a 16-bit value. Previously we
assumed it should be treated as an unsigned value, but the code for conveyors
in Crusader clearly treats it as a signed value - they move at +3 or -3 per
tick. Confirmed in the disasm that both U8 and Cru use CBW to sign-extend
value in AL, so this may fix some things in U8 too.