Commit graph

2095 commits

Author SHA1 Message Date
Matthew Duggan
7eb7b301ec ULTIMA8: Remove unused forward declaration 2021-05-04 21:37:15 +09:00
Matthew Duggan
48d12d8a46 ULTIMA8: Small cleanup for sequential animations 2021-05-04 21:37:15 +09:00
Matthew Duggan
352f7593e8 ULTIMA8: Implement Crusader AutoFirer Process 2021-05-04 21:37:15 +09:00
Matthew Duggan
b88dbd5ebc ULTIMA8: Make Crusader death more closely match original 2021-05-04 21:37:15 +09:00
Orgad Shaneh
a05e54f00c JANITORIAL: Remove trailing whitespaces 2021-05-04 11:46:30 +03:00
Matthew Jimenez
51f212d9dc ULTIMA8: Improve debug output of map sorting
The previous output showed the comparisons between items, but was out of sync with the actual comparison method. Updated method only shows relevant data.
2021-05-03 21:27:23 -05:00
Matthew Jimenez
0a955b4314 ULTIMA8: Add ability to increment / decrement map sort order by value as a parameter 2021-05-03 21:27:23 -05:00
Matthew Jimenez
8d4d37bcfe ULTIMA8: Move map sort order bindings from cheat keys to debug keys. 2021-05-03 21:27:23 -05:00
Matthew Jimenez
e0c1ea0584 ULTIMA8: Update SortItem ListLessThan function to be more consistent
If flats can be less than other flats at the same Z coord, then the result would be reliant on with item is this vs other. Making the check flat vs non-flat adds consistency.
2021-05-02 19:59:31 -05:00
Matthew Duggan
61d97898da ULTIMA8: Set fixed RAND_MAX to avoid platform differences
This should fix bug #12182 which seems to be caused by a difference in the MSVC
RAND_MAX compared to posix systems.
2021-05-02 23:48:41 +09:00
Matthew Duggan
45c79ea4c7 ULTIMA8: Add more debug output to ActorAnim watch. 2021-05-02 22:43:32 +09:00
Matthew Duggan
5cd9e68778 ULTIMA8: Only allow Crusader run on NPCs that can do it 2021-05-02 22:42:26 +09:00
Matthew Duggan
cc7a60d320 ULTIMA: Modify Crudsader Avatar height when kneeling
This matches original game behavior.
2021-05-02 22:27:24 +09:00
Matthew Duggan
90a4c80eed ULTIMA8: Fix int type for gump sizes 2021-05-02 22:19:45 +09:00
Matthew Duggan
e000b92ab9 ULTIMA8: Add Crusader difficulty selector menu
Finally allows also fixing new game creation from within game, and resuming
previous savegame by default like U8 does.
2021-05-02 09:49:20 +09:00
Matthew Duggan
e42fd1a910 ULTIMA8: Make Crusader status gumps work for other NPCs 2021-05-02 07:49:05 +09:00
Matthew Duggan
a4d1be0186 ULTIMA8: Fix loopscript search range in Crusader
With this bugfix, the first mission and first stay at the rebel base can now be
properly completed without a single use of the cheat mover!
2021-05-02 07:49:05 +09:00
Matthew Duggan
5fe9987587 ULTIMA8: Fix a couple more Crusader pickup counts 2021-05-01 21:53:52 +09:00
Matthew Duggan
be95710065 ULTIMA8: Tweaks to Crusader SuperSprite to make Thresher work right 2021-05-01 21:53:52 +09:00
Matthew Duggan
1b15041a29 ULTIMA8: Tidy up 'all process' constant in Kernel. 2021-05-01 21:53:52 +09:00
Matthew Duggan
e2072dc746 ULTIMA8: Kill process 0xc when switching Crusader npc 2021-05-01 21:53:52 +09:00
Matthew Duggan
5c0fa036b9 ULTIMA8: Skip Crusader ammo check for npcs != 1 2021-05-01 21:53:52 +09:00
Matthew Duggan
343c5dfab7 ULTIMA8: Translate anim nums given to usecode 2021-05-01 21:53:52 +09:00
Matthew Duggan
6277257d10 ULTIMA8: Avoid Crusader NPCs spinning to same direction 2021-05-01 21:53:52 +09:00
Matthew Duggan
5301e0e886 ULTIMA8: Remove ignored parameter from FileSystem 2021-05-01 21:53:52 +09:00
Matthew Duggan
29e07a483e ULTIMA8: Restore lost text to Spell of Resurrection
As reported in bug #12503, this book does not display the right text.  The
correct text is in the usecode, but unreachable in the regular game.

Replace the text for this book at runtime with the originally intended text for
the book.  To work this change needs an update to ultima.dat which should be
regenerated before the next release, but it's backwards-compatible with older
dat files and will just not do anything.
2021-05-01 14:55:31 +09:00
Matthew Duggan
027dbb0d5d ULTIMA8: Crusader weapons should default to clip size 2021-05-01 14:55:30 +09:00
Matthew Duggan
727d074554 ULTIMA8: Don't stand when casting a spell
Fixes #12093, the avatar keeps standing when casting a spell.  This is because
there are breaks between the animations, and the mover kept resetting to
standing.  Don't reset if the last animation was a cast.
2021-04-30 16:47:48 +09:00
Matthew Duggan
094133889e ULTIMA8: Run deferred terminates within the same tick
This is the second part of fixing Crusader elevator speeds after e3ee65.  With
this change they move at the same speed as the original (completing their
travel in ~0.6s)

Previously, UC process return would defer termination to the next clock tick,
so waiting processes would be delayed by an extra tick.  The elevator platform
speeds in Crusader show that waiters should be executed on the *same* clock
tick as the process returns.

However, if we terminate and schedule waiters immediately then other things
don't work (eg, the door does not open for the first Thermatron).

This suggests that the correct (to original game) behavior is to defer
termination until the end of the current process list, then wake and execute
waiting processes.

Only apply this to Crusader - it *doesn't* get the right speed on U8, where NPC
moves execute too quickly with this change.  With just e3ee65, U8 NPC moves are
exactly right.
2021-04-30 14:24:07 +09:00
Matthew Duggan
d9438cd6d7 ULTIMA8: Silence overly-chatty warning 2021-04-30 14:24:07 +09:00
Matthew Duggan
3abf2dae38 ULTIMA8: Slow Crusader palette cycle to match original 2021-04-30 14:24:07 +09:00
Matthew Duggan
f1dc36f999 ULTIMA8: Clean up Kernel, no behavior changes. 2021-04-30 14:24:07 +09:00
Matthew Duggan
e3ee65de99 ULTIMA8: After implies, continue current process until suspend
Previously we implemented implies as the same as waitFor, but that suspends the
current process straight away.  All uses of implies in the usecode are
also immediately followed by a suspend.  A typical flow is something like:

005A: 0A    push byte   05h
005C: 0C    push dword  00000000h
0061: 57    spawn       02 00 0A0C:0032 (FREE::ordinal32 (waitNTimerTicks))
0068: 6E    add sp      -02h
006A: 5E    push        retval
006B: 54    implies     01 01
006E: 12    pop     temp
006F: 53    suspend

So after implies we should actually continue executing the current UC process
until a suspend or return, otherwise we wake up next frame only to suspend
again.  For longer-running spawns this probably makes no noticable difference,
but in Crusader the elevators spawn a process which only waits 1 tick.  This
should actually run the ELEVAT process again on the very next tick, but instead
it restarts *3* ticks later:

Tick 1:
1a. ELEVAT: spawn 1 tick sleep, execnow
1b. SLEEP: record start tick as tick 1
1c. ELEVAT: implies (waitFor) - process suspends

Tick 2:
2a. SLEEP: current tick is tick 2, (start+1) return, terminateDeferred

Tick 3:
3a. SLEEP: process terminates, notify ELEVAT process
3b. ELEVAT: wake up because of terminated sleep, pop return, suspend again

Tick 4:
4a. ELEVAT: continue again

This fixes it to only sleep for 2 ticks, which is still not totally correct
(terminateDeferred should maybe happen at the end of the frame to match
original?) but it's an improvement and it doesn't seem to break anything in U8.
2021-04-29 17:51:14 +09:00
Matthew Duggan
be7ce1b6de ULTIMA8: Fix quantity when combining reagents
The reagent which is the target should get the updated quantity, not the one
we're about to destroy.
2021-04-29 17:02:57 +09:00
Matthew Duggan
bb69710f51 ULTIMA8: Add Crusader weapon ammo usage and reload 2021-04-29 17:02:56 +09:00
Matthew Duggan
5480d8a531 ULTIMA8: Add more Crusader weapon data to struct 2021-04-29 17:02:56 +09:00
Matthew Duggan
20cc071c0d ULTIMA8: Fix watch debug output on AnimationTracker 2021-04-29 17:02:56 +09:00
Matthew Duggan
d29114b216 ULTIMA8: Fix keybinding for Crusader medikit 2021-04-29 17:02:56 +09:00
Matthew Duggan
90ee552cc0 ULTIMA8: Correct comment 2021-04-29 17:02:56 +09:00
Matthew Duggan
378076dedf ULTIMA8: Correct count shown in Crusader pickups 2021-04-26 11:09:18 +09:00
Matthew Duggan
b502951278 ULTIMA8: Crusader mover process fixes
* Don't allow attack moves at rebel base
* Save avatar angle (break Crusader save compatibility again, U8 saves are
  fine)
2021-04-26 10:06:09 +09:00
Matthew Duggan
ce379123d7 ULTIMA8: Remove some Crusader Weasel test code 2021-04-26 10:06:09 +09:00
Matthew Duggan
cda8b9ceff ULTIMA8: Correct when to show Crusadeer Weasel intro 2021-04-26 10:06:09 +09:00
Matthew Duggan
a67305562d ULTIMA8: Fix movie scale for some Crusader cutscenes 2021-04-26 10:06:09 +09:00
Matthew Duggan
4b72eac24c ULTIMA8: Refine when to ignore waitFor
Waiting for PROC_TERM_DEFERRED processes is fine and needed for compatibility -
they will still notify other processes when they actually terminate.  Only
ignore the waitFor on processes which have already notified their waiters.
2021-04-25 13:40:52 +09:00
Matthew Duggan
6215ebd8a4 ULTIMA8: Wire up more Remorse movie intrinsics 2021-04-25 13:02:35 +09:00
Matthew Duggan
b499093e20 ULTIMA8: Handle missing subtitles gracefully 2021-04-25 13:02:05 +09:00
Matthew Duggan
79d61a59a2 ULTIMA8: Correct intrinsic count for Remorse 2021-04-25 13:01:43 +09:00
Matthew Duggan
4e4cfe5494 ULTIMA8: Ignore wait requests for terminated processes
This fixes the end of the level in Crusader, but likely fixes some subtle
freeze bugs in U8 too.

The implies opcode was already checking for invalid process IDs (which happens
when speaking to children), but not terminated process IDs. There was a window
where a process could start waiting for an already-terminated process and never
get woken up.
2021-04-25 11:34:35 +09:00
Matthew Duggan
f27a567e91 ULTIMA8: Tiny Crusader snap adjustment to be more accurate to original 2021-04-22 21:39:18 +09:00