[Scummvm-git-logs] scummvm master -> 68b4ed52b5ea75fef101d8c59412dc3edd6e596b

dreammaster noreply at scummvm.org
Thu Nov 12 19:47:41 UTC 2026


This automated email contains information about 333 new commits which have been
pushed to the 'scummvm' repo located at https://api.github.com/repos/scummvm/scummvm .

Summary:
69838ecefb ULTIMA: ULTIMA2: Skeleton engine
d0bc327d8b ULTIMA: ULTIMA2: Starting new shared/ folder
ffaf53a796 ULTIMA: ULTIMA2: Shifting generic code into new shared folder
330430e694 ULTIMA: ULTIMA2: Added title screen
2b28a7345d ULTIMA: ULTIMA2: Added Create Character screen
1c6c983da7 ULTIMA: ULTIMA2: Beginnings of overworld view
17e3beb43d ULTIMA: ULTIMA1: Added main menu
18e53702ef ULTIMA: ULTIMA1: Added Character Generation screen
50e96dac49 ULTIMA: ULTIMA1: Aded Overworld view frame
ef7105a08e ULTIMA: ULTIMA1: Map loading and rendering
6960be1475 ULTIMA: ULTIMA1: Start of movement code
3eaec9b09e ULTIMA: ULTIMA1: Adding commands pane
b414701dc1 ULTIMA: ULTIMA1: Overriden font drawing for left/right arrows
cfbbacec34 ULTIMA: ULTIMA1: Start of overworld logic class
38d5e9d42b ULTIMA: ULTIMA1: Fleshing out savegame structure
bb9d06ca29 ULTIMA: ULTIMA1: Support functions needed for movement code
1a87b2ab56 ULTIMA: ULTIMA1: Implementing directional move
0e0fd48efe ULTIMA: ULTIMA1: Remaining overworld movement logic
b812dee126 ULTIMA: ULTIMA1: In progress end of turn code
20d6a56dd4 ULTIMA: ULTIMA1: Map functions for top-left corner of visible map
ffaa201221 ULTIMA: ULTIMA1: Refactor out _mapX/_mapY
6cdb3de388 ULTIMA: ULTIMA1: Beginnings of location entry logic
d09cb865b8 ULTIMA: ULTIMA1: City/Castle init logic
3d7f26a86d ULTIMA: ULTIMA1: Move getTileAt into Map class
ee97750703 ULTIMA: ULTIMA1: Fix off-by-one map drawing
25d7c31a02 ULTIMA: ULTIMA1: Loading city sprites
f6611a4e67 ULTIMA: ULTIMA1: In progress adding Location view
53a9a701ba ULTIMA: ULTIMA1: Working to make common shared commands/stats area
28e4acd22c ULTIMA: ULTIMA1: Making maps distinct views that sit on top of Game view
2a1429ef33 ULTIMA: ULTIMA1: Stop commands being erased when entering city
fa71a7c7b1 ULTIMA: ULTIMA1: In progress fixes to city drawing
71cf7f9edb ULTIMA: ULTIMA1: City map drawing partially
2f79c7ac8b ULTIMA: ULTIMA1: Further fixes to city map loading
71f6680162 ULTIMA: ULTIMA1: Add rendering of location NPCs
44292f8ddc ULTIMA: ULTIMA1: Implementing city movement
ceac2919d7 ULTIMA: ULTIMA1: ZStats window
064df0e921 ULTIMA: ULTIMA1: Don't erase Commands area when leaving Ztats
d1ae18ec52 ULTIMA: ULTIMA1: Starting to implement keypress fallbacks
bd3f570fa7 ULTIMA: ULTIMA1: Setting base Logic class with virtual commands handling
ec3219b2fb ULTIMA: ULTIMA1: Inform command
f5663ad32a ULTIMA: ULTIMA1: Further command defaults
f280368301 ULTIMA: ULTIMA1: Beginnings of Interaction view hierarchy
117ba0d9dd ULTIMA: ULTIMA1: Finished Ready action
65d03984f0 ULTIMA: ULTIMA1: Added Drop action dialog
6878578d32 ULTIMA: ULTIMA1: Added get command
872feb2481 ULTIMA: ULTIMA1: Finished Ready action
7a10f5083f ULTIMA: ULTIMA1: Added Transact command
35d6ece01f ULTIMA: ULTIMA1: Sharing city movement logic with castle logic
95dbdc8fac ULTIMA: ULTIMA1: Better drop reward tile constants
06adeb8d10 ULTIMA: ULTIMA1: Added princess save detection, display
9646b91c59 ULTIMA: ULTIMA1: Function skeletons for end of turn creature updates
9d499f3689 ULTIMA: ULTIMA1: City/castle/overworld creature movement dispatch
b97f6c6734 ULTIMA: ULTIMA1: City/overworld monster/npc updates
8d96de5bd0 ULTIMA: ULTIMA1: Simplify logic destruction using Common::SharedPtr
b6b1c84656 ULTIMA: ULTIMA1: Dungeon level generation
908699bfc3 ULTIMA: ULTIMA1: Map Data::MapDungeon an engine global
23c1e1c914 ULTIMA: ULTIMA1: Implement dungeon draw code
d525a53560 ULTIMA: ULTIMA1: Dungeon move, climb actions
cfd3298dbf ULTIMA: ULTIMA1: Saving dungeon state
5a651068a7 ULTIMA: ULTIMA1: Fix re-entering dungeons
2585e8d3a4 ULTIMA: ULTIMA1: Adding artificial delay after showing lines in Commands area
710b987dc0 ULTIMA: ULTIMA1: Show attack animations in the overworld
ba2b8e088f ULTIMA: ULTIMA1: End of turn handling for the different map types
42cb9a93cf ULTIMA: ULTIMA1: Implement death/resurrection screen
66baedfc05 ULTIMA: ULTIMA1: Beginnings of outer space view
10a7f3f3f6 ULTIMA: ULTIMA1: Implementing outer space lift-off
bc6be2f67e ULTIMA: ULTIMA1: Added view for entering time machine
9ae34c7a81 ULTIMA: ULTIMA1: Loading Mondain map data
7f0a0e088b ULTIMA: ULTIMA1: Basic Mondain map rendering
b0e0de70a7 ULTIMA: ULTIMA1: Mondain map command overrides
94bcb2dcc0 ULTIMA: ULTIMA1: Properly implement Pillar dialog
aed68d5d8c ULTIMA: ULTIMA1: Starting player attack commands
a0c0e88c6c ULTIMA: ULTIMA1: Implement dungeon spellcasting
bbed9b5d3a ULTIMA: ULTIMA1: Work on overworld combat
9438de1b9f ULTIMA: ULTIMA1: Remainder of city/castle/overworld attack code
c9075fe8a9 ULTIMA: ULTIMA1: Mondain map movement
0e95587e6a ULTIMA: ULTIMA1: Mondain animation
50c9b079c9 ULTIMA: ULTIMA1: Split a new Map base class from Dialog
1b60b08d0a ULTIMA: ULTIMA1: Mondain gem get action
3a6c221bb8 ULTIMA: ULTIMA1: Implementing attack command in Mondain map
dc10c1937c ULTIMA: ULTIMA1: Mondain map spellcasting
0a5ec72faa ULTIMA: ULTIMA1: Added Mondain win/lose dialogs
1cd9af7653 ULTIMA: ULTIMA1: Mondain battle logic
799154844f ULTIMA: ULTIMA1: Mondain fight start fixes
a7e32a2372 ULTIMA: ULTIMA1: Added overworld Quit command
bc99ff9c18 ULTIMA: ULTIMA1: Dungeon creature movement
57fc8d648d ULTIMA: ULTIMA1: Remaining commands finished
186454d69e ULTIMA: ULTIMA1: Transact merchant fixes
47e94a32ed ULTIMA: ULTIMA1: Start of outer space, sector scan dialog
fc3c0735b1 ULTIMA: ULTIMA1: Space disabled commands
e8fe01c807 ULTIMA: ULTIMA1: Splitting SpaceLogic into map and cockpit subclasses
890a685926 ULTIMA: ULTIMA1: Beginnings of Cockpit View
9720fc15bf ULTIMA: ULTIMA1: New SpaceGame and SpaceStats view classes
303ec19826 ULTIMA: ULTIMA1: Console improvement for loading space map
484664914f ULTIMA: ULTIMA1: Fix keybinding keys for attacks
c8c26a27d0 ULTIMA: ULTIMA1: Space commands cursor fixes
0d2832f09a ULTIMA: ULTIMA1: Move space related globals to Savegame
92c5ee54b9 ULTIMA: ULTIMA1: Space map drawing
d10c6135ee ULTIMA: ULTIMA1: Space map ship movement
4ec0d7d607 ULTIMA: ULTIMA1: Fix space map ship wrapping around edges of screen
12b5854fe5 ULTIMA: ULTIMA1: Fix saving in maps other than overworld
9cb2ef5aff ULTIMA: ULTIMA1: Implement death when ship collides with sun
7c7034c40d ULTIMA: ULTIMA1: Fix space map command key responses
02d5f8e81f ULTIMA: ULTIMA1: Space station docking
0121b57a32 ULTIMA: ULTIMA1: Fixes to ship movement to space station
45f316064d ULTIMA: ULTIMA1: Secret autopilot command
b1192774e5 ULTIMA: ULTIMA1: Mouse control for space cockpit view
518f9d6cb0 ULTIMA: ULTIMA1: Fix showing space stats for space map
304b02ee4c ULTIMA: ULTIMA1: Space hyperjump, console commands
699bba4ad4 ULTIMA: ULTIMA1: Enemy ship generation
7b27c0f593 ULTIMA: ULTIMA1: Enemy ship combat
2d2a33d3f4 ULTIMA: ULTIMA0: Fix replaceAllViews not passed in replaceView call
47346ab683 ULTIMA: ULTIMA1: Fix cockpit speed default
8d3d221fdc ULTIMA: ULTIMA1: Allow loading from death screen
a300cc7c3d ULTIMA: ULTIMA2: Add fresh engine skeleton with a placeholder startup screen
d13b3b4b6c ULTIMA: Make shared/ engine/gfx objects unconditional in module.mk
3020665854 ULTIMA: ULTIMA2: Add attract-mode title screen sequence
efc9203148 ULTIMA: ULTIMA2: Add blinking text cursor to the menu
7138ee6240 ULTIMA: ULTIMA2: Add character creation and the Savegame data model
9629e8fdfc ULTIMA: ULTIMA2: Add tile graphics, map, dungeon, and monster loaders
0a657f5751 ULTIMA: ULTIMA2: Add core game loop skeleton
cc9932bdaf ULTIMA: ULTIMA2: Added savegame code
d687b940be ULTIMA: ULTIMA2: Add overworld movement and turn loop
df5578fc69 ULTIMA: ULTIMA2: Fix overworld map viewport not wrapping at world edges
0b54c141b2 ULTIMA: ULTIMA2: Add teleport console command
e3d4ccb6da ULTIMA: ULTIMA2: Add combat, equipment, and monster AI
cf90097f96 ULTIMA: ULTIMA2: Add towns, villages, and castles
41d7917cfa ULTIMA: ULTIMA2: Add locations/intangible/hp/food/gold debug console commands
ea61211447 ULTIMA: ULTIMA2: Add enemy debug console command
9c29bbfaf0 ULTIMA: ULTIMA2: Fix TRANSACT echo and missing prompt after direction commands
65ddc9cc2d ULTIMA: ULTIMA2: Rename mapNum1/mapNum2 to mapEra/mapType, console map command
0f401acdbd ULTIMA: ULTIMA2: Fix shopkeeper detection after monsters move off their baked-in tiles
0e62c6ffae ULTIMA: ULTIMA2: Add transport shop horse purchase and fix item price formula
7926138f2f ULTIMA: ULTIMA2: Implement the town and village shops, NPC dialogue and tithe altar
ccf7fc14a9 ULTIMA: ULTIMA2: Separate Dead view
5e05af907c ULTIMA: ULTIMA2: Set up a dummy character when the map command is used without one
168c106ad3 ULTIMA: ULTIMA2: Fix town monster AI so only hostile monsters attack
6fff822412 ULTIMA: ULTIMA2: Draw and update monster slot 0 in towns
75c5ebfe53 ULTIMA: ULTIMA2: Animate the water and forcefield tiles on the overworld and location maps
8a9177f01b ULTIMA: ULTIMA2: Add F5/F7 for showing the save/load game dialogs
6e3ef306d3 ULTIMA: ULTIMA2: Allow non-numeric keys to abort merchant interactions
bc45b40f86 ULTIMA: ULTIMA2: Handle steal, unlock and offer prompts
a2e35ca2e1 ULTIMA: ULTIMA2: Handle command banners, vehicle boarding and movement
4d98e2dcee ULTIMA: ULTIMA2: Add the hopping moongate and time travel between eras
e4cfb026bd ULTIMA: ULTIMA2: Add airplane flight
a1de0bac54 ULTIMA: ULTIMA2: Add the steal, unlock, offer and transact prompts
5887582faf ULTIMA: ULTIMA2: Overworld kill rewards
166bf09a84 ULTIMA: ULTIMA2: Add towers and dungeons
7a6fef6e6a ULTIMA: ULTIMA2: Save and restore the current map and monster state
ba7fde8342 ULTIMA: ULTIMA2: Fix drawing grass tiles outside town/cities
1bfd1b3c70 ULTIMA: ULTIMA2: Add an inventory debug console command
5527e2b9e3 ULTIMA: ULTIMA2: Pass the turn after 5 idle seconds
ed17cf8df0 ULTIMA: ULTIMA2: Flash the dungeon view when a monster hits the player
70326d8456 ULTIMA: ULTIMA2: Make the commands area 30 columns wide like the original
a4eb81ced2 ULTIMA: ULTIMA2: Add a secret ` key dungeon minimap
1339feecb0 ULTIMA: ULTIMA2: Use the CGA palette everywhere, set once at startup
52be98ab05 ULTIMA: ULTIMA2: Add rocket launch, hyperwarp space flight and landing
ef477b9ac3 ULTIMA: ULTIMA2: Added space console command
292b01f2b6 ULTIMA: ULTIMA1: Added space console command
1d7ed5e2db ULTIMA: ULTIMA2: Moved space stats into SpaceStats view
dc6be9a6ef ULTIMA: ULTIMA2: Allow saving mid-flight
681083974b ULTIMA: ULTIMA2: Add the Minax death sequence and victory ending
0729b003f7 ULTIMA: ULTIMA2: Add PC speaker sound effects
6a439ae548 ULTIMA: ULTIMA1: Fix bug for ultima1-only builds
d5d7c5ab33 ULTIMA: ULTIMA2: Add console commands to import and export the original PLAYER save format
170f0d35e7 ULTIMA: ULTIMA2: Fix two small text/sound gaps found in a full string-catalog audit
5433716915 ULTIMA: ULTIMA2: Add Daemon/Devil/Mage/Balron proximity traps
d910e5a9ac ULTIMA: ULTIMA2: Add Minax's proximity curse trap
fd49674c89 ULTIMA: ULTIMA2: Fix monster slot 0 being untargetable
8844cc56c9 ULTIMA: ULTIMA2: Fix unlock only checking east/west and giving no feedback
251016fd4d ULTIMA: ULTIMA2: Fix dungeon melee target search giving up early
fb7d590f1b ULTIMA: ULTIMA2: Unify dungeon combat HP subtraction with the overworld idiom
26eca54154 ULTIMA: ULTIMA2: Fix movement messages running together on one line
f415af2f49 ULTIMA: ULTIMA2: Remove deprecated shared TextInput class
c98e7c8990 ULTIMA: ULTIMA2: Fixes to ZStats screen
acf4a95d37 ULTIMA: ULTIMA2: Fix PLAYER export offsets for readied gear and torches/keys
38f8190549 ULTIMA: ULTIMA2: Fix child bounds to be relative to the parent
046d2da73f ULTIMA: ULTIMA2: Fixes and cleanup for the magic helm view map
34ed596aa7 ULTIMA: ULTIMA2: Fix HelmMap terrain icons and missing screen origin
9c4c580d3f ULTIMA: ULTIMA2: Remove Startup placeholder view and non-original stats screen
e91aa386b8 ULTIMA: ULTIMA2: Consolidate name-lookup helpers into Data
cd310fbd13 ULTIMA: ULTIMA2: Cleanup Yell interaction
dfcaee06f2 ULTIMA: ULTIMA2: Add secret ScummVM town map
1a77f8b9b5 ULTIMA: ULTIMA2: Don't erase text cursor area on title screen
a84ebff6ba ULTIMA: ULTIMA2: Fix treating attribute checks as BCD
8f6ce2a3fe ULTIMA: ULTIMA2: Constrain inventory, gold, food to max
938cafce02 ULTIMA: ULTIMA2: Fix bugs fixed in Ultima 2 Update Patch
eb37e1fa0f ULTIMA: ULTIMA2: Adding files from upgrade patch
8b287c3973 ULTIMA: ULTIMA2: Implementing graphics modes from the Upgrade Patch
7ac1d1e2cd ULTIMA: ULTIMA2: Implement title/demo picture drawing from upgrade
882cff51f2 ULTIMA: ULTIMA2: Refactoring to use Graphics::View base
313c747915 ULTIMA: ULTIMA3: Skeleton engine
2cce959ecf ULTIMA: ULTIMA3: Title screen and boot chain
9f5b373a85 ULTIMA: ULTIMA3: Faithfully recreate the title screen sequence
a4b3d0cdff ULTIMA: ULTIMA3: Flesh out the main menu display
957b72f514 ULTIMA: ULTIMA3: Add roster, party organization and character creation
6857e951c4 ULTIMA: ULTIMA3: Add the animated logo screen and tile shapes
d4c5200064 ULTIMA: ULTIMA3: Add the overworld map, party panel and movement
56bc443edc ULTIMA: ULTIMA3: Add saving and loading of the roster, party and world
f3dee90464 ULTIMA: ULTIMA3: Added f5/f7 keys for save/load game dialog
8b6486a940 ULTIMA: ULTIMA3: Fix force field and lava terrain names
be850c63e2 ULTIMA: ULTIMA3: Add the board, exit, look, ztats, ready, wear, order and volume commands
625025efe1 ULTIMA: ULTIMA3: Rename the overworld view and logic to cover every surface location
5159e07744 ULTIMA: ULTIMA3: Add entering and leaving towns and castles
40b41eef7c ULTIMA: ULTIMA3: Add movement of monsters and townspeople
625893e6c9 ULTIMA: ULTIMA3: Add fights between the party and monsters
e60c6b973e ULTIMA: ULTIMA3: Add the get, steal and unlock commands
8505d0534b ULTIMA: ULTIMA3: Add the transact command for talking and shops
7e974b2460 ULTIMA: ULTIMA3: Add spell casting and the negate time command
e355366f2b ULTIMA: ULTIMA3: Add dungeons with their first person view
a818951b47 ULTIMA: ULTIMA3: Add the debugger console commands
c82b9587b3 ULTIMA: ULTIMA3: Add the hand, join gold, yell, other and quit commands
10b19db406 ULTIMA: ULTIMA3: Add peering at a gem and the vision spell
9632dc7afd ULTIMA: ULTIMA3: Add moon gates, whirlpools, Ambrosia and the shrines
9ec24bd6f7 ULTIMA: ULTIMA3: Add inserting the Exodus cards and the victory ending
cab8ad160a ULTIMA: ULTIMA3: Add dragons and ships breathing fire on the map
6378f92297 ULTIMA: ULTIMA3: Add the PC speaker sound effects
9499ec9bbb ULTIMA: ULTIMA3: Add the bolts of the castle of Exodus
fc9c9d7b0e ULTIMA: ULTIMA3: Make the town of Dawn appear with the full moons
697a6d07fc ULTIMA: ULTIMA3: Add a console command to go to the Exodus machine with the cards
57553e013b ULTIMA: ULTIMA3: Import and export the original world file and moons with the save files
0726b13c8c ULTIMA: ULTIMA3: Add the misty writing on the dungeon walls
bc3951987e ULTIMA: ULTIMA3: Add firing the ship's cannon and the disabled surface commands
bbe5ead264 ULTIMA: ULTIMA2: Added u2 upgrade Composite render mode
1b0cd2bb5c ULTIMA: ULTIMA2: Added graphics mode as an engine option
7dfd67189e ULTIMA: ULTIMA2: Change a SearchMan call to Common::File
fddc44d8e3 ULTIMA: ULTIMA3: Add game options for the Ultima III Upgrade's monster and food rate changes
77e3232947 ULTIMA: ULTIMA3: Added the Upgrade Patch graphics modes as an engine option
9fe6d67e91 ULTIMA: ULTIMA3: Added the Upgrade Patch moon phase icons as a game option
58ba1ff5f3 ULTIMA: ULTIMA3: Added enhanced detection entry for U3 & U2
55cd93159e ULTIMA: ULTIMA3: Added the Upgrade Patch MIDI music as a game option
7d9e18a80e ULTIMA: ULTIMA3: Added the Upgrade Patch Alt-X, Alt-R and Alt-M hotkeys
8ca907a7e9 ULTIMA: ULTIMA3: Added the Upgrade Patch timed sound effects as a game option
ee21d46898 ULTIMA: ULTIMA3: Fixes the title screen rendering and SFX
fbda6009ab ULTIMA: ULTIMA2: Added Upgrade Patch EGA monster and helm map colors
41befa6d7c ULTIMA: ULTIMA2: Added composite mode decoding to the space flight view
0ad64777ab ULTIMA: ULTIMA2: Added the Upgrade Patch Alt-X, Alt-R and Alt-M hotkeys
233fb66756 ULTIMA: ULTIMA2: Added the Upgrade Patch's stat boost choice as a game option
84523b5c3d ULTIMA: ULTIMA2: Added misc Upgrade Patch functions
52577a8a84 ULTIMA: ULTIMA2: Added the Upgrade Patch's colored text, with a mixed case text option
a7c793f44c ULTIMA: ULTIMA2: Changed the game's text to the Upgrade Patch's mixed case
b536d8c0fc ULTIMA: ULTIMA2: Changed the remaining capitalized text to mixed case
c3f8f2b77e ULTIMA: ULTIMA1: Implement sound effects
598e9dc344 ULTIMA: ULTIMA1: Fix Britain/Gwenno mis-spellings
a8ad924591 ULTIMA: Add Voyager Dragon to credits for patch upgrades
755b3bb918 ULTIMA: ULTIMA1: Create custom font for handling arrow symbols
80d127a033 ULTIMA: ULTIMA1: Fix f5/f7 savegame handling
d24305ac15 ULTIMA: ULTIMA1: Clear the game background before drawing elements
7eaeb3a8ae ULTIMA: ULTIMA1: Fix enemy spaceship rendering
77cb3cebb1 ULTIMA: ULTIMA1: Hyperjump display/sound fixes
0f8d747986 ULTIMA: ULTIMA1: Tie flight frame rate to speed
535d0eb605 ULTIMA: ULTIMA1: Adding graphics mode engine option
3ee1400692 ULTIMA: Fix hotkeys across Ultima 1, 2, 3
9e6d0db615 ULTIMA: ULTIMA1: Fix incorrect NPC rendering in Castle British
296b9c7c08 ULTIMA: ULTIMA1: Fix walk sound in castle locations
5d356ede0f ULTIMA: ULTIMA1: Fixes for king quest display
5ff95a1e9b ULTIMA: ULTIMA1: Fix crash loading savegame directly in castle
de5c5d081f ULTIMA: ULTIMA1: Extra console commands
0104372dac ULTIMA: ULTIMA1: Attack action fixes
c47e409791 ULTIMA: ULTIMA1: Fixes for saving princess
3fe5e3cb2a ULTIMA: ULTIMA1: Fix Pass action keybinding
c7b33eaa77 ULTIMA: ULTIMA1: Merchant fixes
786c8bbd91 ULTIMA: ULTIMA1: Fix for boarding vechiles/horses
a98de5cdf8 ULTIMA: ULTIMA1: Fix purchased transport placement in overworld
408b75ccae ULTIMA: ULTIMA1: Move surrounding tile counts back into Map, removed from savegame
d7e7be70af ULTIMA: ULTIMA1: Properly erase the visible cursor when hidden
fd416878e6 ULTIMA: ULTIMA1: Fix persisting overworld transports in savegames
29f4cf5603 ULTIMA: ULTIMA1: Fix prompt when entering/exiting city/castles
ad1579880a ULTIMA: ULTIMA1: Cleanup dungeon monster Id tracking
9b464ab509 ULTIMA: ULTIMA1: Don't show prompt when entering pillars/signs
8b599aeced ULTIMA: ULTIMA1: Fix display of treasure after killing monster
aab5565a12 ULTIMA: ULTIMA1: Command area text shold start at column 1
48f35d96b5 ULTIMA: ULTIMA1: Fix monster placement with continent changes
593bb1af5b ULTIMA: ULTIMA1: Fix dungeon attacks when standing in a doorway
286ea0548a ULTIMA: ULTIMA1: Fix prompt after climbing dungeon ladder
b154b9dd44 ULTIMA: ULTIMA1: Fix action ordering for dungeon monster attacks
75af503575 ULTIMA: ULTIMA1: Handle newlines for lines fitting width exactly
3c02cb019e ULTIMA: ULTIMA1: Fix original loot bug when purse is full
c612d44b54 ULTIMA: ULTIMA1: Increase delay for lines in the commands area
e4680d89ef ULTIMA: ULTIMA1: Fix dungeon random number generator
12714f5f30 ULTIMA: ULTIMA1: Don't set transports array in console inventory cmd
2b20fb178f ULTIMA: ULTIMA1: Merge _moveCtr global into savegame _moveCount field
a3478865e3 ULTIMA: ULTIMA1: Keep space dead view on screen for 5 seconds
1efe8192b7 ULTIMA: ULTIMA1: Fixes for landing shuttle
e0bd381986 ULTIMA: ULTIMA1: Spaceship collision fixes
649130abbb ULTIMA: ULTIMA1: Reset any active spaceship thrust on savegame load
1696d24b44 ULTIMA: ULTIMA1: Fixes to show command prompt in outer space
72eaf00dd6 ULTIMA: ULTIMA1: Fix crash using ZStats in outer space
9fe1d5656d ULTIMA: ULTIMA1: Add missing constraints for switching outer space view mode
d64f5895b9 ULTIMA: ULTIMA1: Stats console command
f8069991b2 ULTIMA: ULTIMA1: Prompt fix after reaching Mondain
44c0ad1e66 ULTIMA: ULTIMA1: Don't render overworld entities in Mondain map
9921752264 ULTIMA: ULTIMA1: Mondain combat fix
237463a5b7 ULTIMA: ULTIMA1: Mondain gem fixes
7cd93ecb3f ULTIMA: ULTIMA1: Mondain psionic attack screen inversion
c0a66a8d3a ULTIMA: ULTIMA1: Persist city/castle/Mondain maps in savegames
380d060618 ULTIMA: ULTIMA1: Missing prompt after Mondain attack misses
b3f401874d ULTIMA: ULTIMA2: Fix commands area delays
42ca32c322 ULTIMA: ULTIMA2: Allow custom hp in hp console cmd
ace4c419cc ULTIMA: ULTIMA2: Fix stats highlight below 100
6faae374f9 ULTIMA: ULTIMA2: Fixes to dead display to freeze game
cccd713d2a ULTIMA: ULTIMA2: Fix using timegates
09612a2646 ULTIMA: ULTIMA2: Renamed moongate savegame fields for clarity
5c2948e59f ULTIMA: ULTIMA2: Added stats console cmd
d965e52557 ULTIMA: ULTIMA2: Added less hunger extra option
a39e7e52ae ULTIMA: ULTIMA2: Added transport console cmd
e9afefc9bc ULTIMA: ULTIMA2: Savegane caching visited maps, version field
75a318d2e4 ULTIMA: ULTIMA2: Fix message for exploding in space
53f74b7e23 ULTIMA: ULTIMA2: Fix text after selecting hyperwarp dest
3989d10c9c ULTIMA: ULTIMA2: Landing message fix
1af958b61c ULTIMA: ULTIMA2: Fix NPC movement in cities/caastles
5cae9647cd ULTIMA: ULTIMA2: Fix overworld negate time
c25b4d4dd6 ULTIMA: ULTIMA2: Fix transact with fixed place shopkeepers
c084f87c77 ULTIMA: ULTIMA2: Map pass command to space key as well
6e7d52f7b0 ULTIMA: ULTIMA2: Fix text on ending screen
fc138273d7 ULTIMA: ULTIMA2: Allow loading savegame on ending screen
00a8dbbff2 ULTIMA: ULTIMA2: Brief pause before showing ending screen
3df3d343e3 ULTIMA: ULTIMA2: Fix  mis-spelling of paralyzed
248b4a285c ULTIMA: ULTIMA2: Fix clearing map tiles after Minax defeat
5ffb45454d ULTIMA: ULTIMA2: Fix original line wrap for magic missile failure
4495d4c05a ULTIMA: ULTIMA3: Reset savegame version back to 1
8a97fc41e7 ULTIMA: ULTIMA3: Added level console cmd
a69ed1c2f1 ULTIMA: ULTIMA3: Added transport console cmd
7cc0dce691 ULTIMA: ULTIMA3: Added win and enemies console commands
1ef2e53201 ULTIMA: ULTIMA3: Slow down the Ambrosia whirlpool slightly
c0eaf33372 ULTIMA: ULTIMA3: Fix fountain and card determination
d18fe1e699 ULTIMA: ULTIMA3: Inventory console cmd can now remove special items
c88577577d ULTIMA: ULTIMA3: Added mp console cmd
27459acf0e ULTIMA: ULTIMA3: Fix dungeon level display in console
db53a09a7f ULTIMA: ULTIMA3: Fix defeating Exodus from a savegame part-way through
e220a505f0 ULTIMA: ULTIMA3: Silence music on returning to title screen
4cd60fd616 ULTIMA: ULTIMA3: Prevent saving after defeating Exodus
68b4ed52b5 ULTIMA: ULTIMA3: New optional dungeon renderer using PNG images


Commit: 69838ecefb91e8a668ece98245d2b68e82b801c7
    https://github.com/scummvm/scummvm/commit/69838ecefb91e8a668ece98245d2b68e82b801c7
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:40:44+11:00

Commit Message:
ULTIMA: ULTIMA2: Skeleton engine

Changed paths:
  A engines/ultima/ultima2/console.cpp
  A engines/ultima/ultima2/console.h
  A engines/ultima/ultima2/events.cpp
  A engines/ultima/ultima2/events.h
  A engines/ultima/ultima2/gfx/gfx_surface.cpp
  A engines/ultima/ultima2/gfx/gfx_surface.h
  A engines/ultima/ultima2/gfx/pic_decoder.cpp
  A engines/ultima/ultima2/gfx/pic_decoder.h
  A engines/ultima/ultima2/messages.cpp
  A engines/ultima/ultima2/messages.h
  A engines/ultima/ultima2/metaengine.cpp
  A engines/ultima/ultima2/metaengine.h
  A engines/ultima/ultima2/ultima2.cpp
  A engines/ultima/ultima2/ultima2.h
  A engines/ultima/ultima2/views/startup.cpp
  A engines/ultima/ultima2/views/startup.h
  A engines/ultima/ultima2/views/view.cpp
  A engines/ultima/ultima2/views/view.h
  A engines/ultima/ultima2/views/views.h
    engines/ultima/configure.engine
    engines/ultima/detection_tables.h
    engines/ultima/metaengine.cpp
    engines/ultima/module.mk


diff --git a/engines/ultima/configure.engine b/engines/ultima/configure.engine
index 3a7037f6b88..996b82085a8 100644
--- a/engines/ultima/configure.engine
+++ b/engines/ultima/configure.engine
@@ -1,8 +1,9 @@
 # This file is included from the main "configure" script
 # add_engine [name] [desc] [build-by-default] [subengines] [base games] [deps] [components]
-add_engine ultima "Ultima" yes "akalabeth ultima1 ultima4 ultima6 ultima8" "" "midi"
+add_engine ultima "Ultima" yes "akalabeth ultima1 ultima2 ultima4 ultima6 ultima8" "" "midi"
 add_engine akalabeth "Akalabeth" no "" "" ""
 add_engine ultima1 "Ultima I - The First Age of Darkness" no "" "" ""
+add_engine ultima2 "Ultima II - The Revenge of the Enchantress" no "" "" ""
 add_engine ultima4 "Ultima IV - Quest of the Avatar" yes "" "" "16bit"
 add_engine ultima6 "Ultima VI = The False Prophet" yes "" "" "highres 16bit lua"
 add_engine ultima8 "Ultima VIII - Pagan" yes "" "" "highres 16bit" "imgui jyv1 xan"
diff --git a/engines/ultima/detection_tables.h b/engines/ultima/detection_tables.h
index fc8bf59f8c0..09a112f180e 100644
--- a/engines/ultima/detection_tables.h
+++ b/engines/ultima/detection_tables.h
@@ -23,6 +23,7 @@ namespace Ultima {
 
 #define GUI_OPTIONS_ULTIMA0	GUIO0()
 #define GUI_OPTIONS_ULTIMA1	GUIO0()
+#define GUI_OPTIONS_ULTIMA2	GUIO0()
 #define GUI_OPTIONS_ULTIMA4	GUIO1(GUIO_NOSPEECH)
 #define GUI_OPTIONS_ULTIMA6	GUIO0()
 #define GUI_OPTIONS_ULTIMA8	GUIO9(GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FRAME_SKIPPING, GAMEOPTION_FRAME_LIMITING, GAMEOPTION_CHEATS, GAMEOPTION_HIGH_RESOLUTION, GAMEOPTION_FOOTSTEP_SOUNDS, GAMEOPTION_JUMP_TO_MOUSE, GAMEOPTION_FONT_REPLACEMENT, GAMEOPTION_FONT_ANTIALIASING)
@@ -51,6 +52,7 @@ static const PlainGameDescriptor ULTIMA_GAMES[] = {
 #ifndef RELEASE_BUILD
 	{ "ultima1", "Ultima I: The First Age of Darkness" },
 #endif
+	{ "ultima2", "Ultima II: Revenge of the Enchantress" },
 	{ "ultima4", "Ultima IV: Quest of the Avatar" },
 	{ "ultima4_enh", "Ultima IV: Quest of the Avatar - Enhanced" },
 	{ "ultima6", "Ultima VI: The False Prophet" },
@@ -133,6 +135,21 @@ static const UltimaGameDescription GAME_DESCRIPTIONS[] = {
 		0
 	},
 
+	{
+		// Ultima II - Revenge of the Enchantress
+		{
+			"ultima2",
+			0,
+			AD_ENTRY1s("mapx00", "86cd98e2f576cfab697a4cfd72dfd83e", 4224),
+			Common::EN_ANY,
+			Common::kPlatformDOS,
+			ADGF_UNSTABLE,
+			GUI_OPTIONS_ULTIMA2
+		},
+		GAME_ULTIMA2,
+		0
+	},
+
 	{
 		// Ultima IV - Quest of the Avatar
 		{
diff --git a/engines/ultima/metaengine.cpp b/engines/ultima/metaengine.cpp
index 7db2f0c15c2..ba1f30d3b8f 100644
--- a/engines/ultima/metaengine.cpp
+++ b/engines/ultima/metaengine.cpp
@@ -34,6 +34,10 @@
 #ifdef ENABLE_ULTIMA1
 #include "ultima/shared/early/ultima_early.h"
 #endif
+#ifdef ENABLE_ULTIMA2
+#include "ultima/ultima2/ultima2.h"
+#include "ultima/ultima2/metaengine.h"
+#endif
 #ifdef ENABLE_ULTIMA4
 #include "ultima/ultima4/ultima4.h"
 #include "ultima/ultima4/metaengine.h"
@@ -195,6 +199,11 @@ Common::Error UltimaMetaEngine::createInstance(OSystem *syst, Engine **engine, c
 		*engine = new Ultima::Shared::UltimaEarlyEngine(syst, gd);
 		break;
 #endif
+#ifdef ENABLE_ULTIMA2
+	case Ultima::GAME_ULTIMA2:
+		*engine = new Ultima::Ultima2::Ultima2Engine(syst, gd);
+		break;
+#endif
 #ifdef ENABLE_ULTIMA4
 	case Ultima::GAME_ULTIMA4:
 		*engine = new Ultima::Ultima4::Ultima4Engine(syst, gd);
@@ -255,7 +264,7 @@ SaveStateDescriptor UltimaMetaEngine::querySaveMetaInfos(const char *target, int
 }
 
 Common::KeymapArray UltimaMetaEngine::initKeymaps(const char *target) const {
-#if defined(ENABLE_AKALABETH) || defined(ENABLE_ULTIMA4) || defined(ENABLE_ULTIMA6) || defined(ENABLE_ULTIMA8)
+#if defined(ENABLE_AKALABETH) || defined(ENABLE_ULTIMA2) || defined(ENABLE_ULTIMA4) || defined(ENABLE_ULTIMA6) || defined(ENABLE_ULTIMA8)
 	const Common::String gameId = getGameId(target);
 #endif
 
@@ -263,6 +272,10 @@ Common::KeymapArray UltimaMetaEngine::initKeymaps(const char *target) const {
 	if (gameId == "akalabeth")
 		return Ultima::Ultima0::MetaEngine::initKeymaps();
 #endif
+#ifdef ENABLE_ULTIMA2
+	if (gameId == "ultima2")
+		return Ultima::Ultima2::MetaEngine::initKeymaps();
+#endif
 #ifdef ENABLE_ULTIMA4
 	if (gameId == "ultima4" || gameId == "ultima4_enh")
 		return Ultima::Ultima4::MetaEngine::initKeymaps();
diff --git a/engines/ultima/module.mk b/engines/ultima/module.mk
index 90cd253563c..9642cff5737 100644
--- a/engines/ultima/module.mk
+++ b/engines/ultima/module.mk
@@ -162,6 +162,19 @@ MODULE_OBJS += \
 	ultima1/game.o
 endif
 
+ifdef ENABLE_ULTIMA2
+MODULE_OBJS += \
+	ultima2/ultima2.o \
+	ultima2/console.o \
+	ultima2/events.o \
+	ultima2/messages.o \
+	ultima2/metaengine.o \
+	ultima2/gfx/gfx_surface.o \
+	ultima2/gfx/pic_decoder.o \
+	ultima2/views/view.o \
+	ultima2/views/startup.o
+endif
+
 ifdef ENABLE_ULTIMA4
 MODULE_OBJS += \
 	ultima4/controllers/alpha_action_controller.o \
diff --git a/engines/ultima/ultima2/console.cpp b/engines/ultima/ultima2/console.cpp
new file mode 100644
index 00000000000..0f928342f25
--- /dev/null
+++ b/engines/ultima/ultima2/console.cpp
@@ -0,0 +1,40 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "ultima/ultima2/console.h"
+
+namespace Ultima {
+namespace Ultima2 {
+
+Console::Console() : GUI::Debugger() {
+	registerCmd("test", WRAP_METHOD(Console, Cmd_test));
+}
+
+Console::~Console() {
+}
+
+bool Console::Cmd_test(int argc, const char **argv) {
+	debugPrintf("Test\n");
+	return true;
+}
+
+} // namespace Ultima2
+} // namespace Ultima
diff --git a/engines/ultima/ultima2/console.h b/engines/ultima/ultima2/console.h
new file mode 100644
index 00000000000..0a164ef66c2
--- /dev/null
+++ b/engines/ultima/ultima2/console.h
@@ -0,0 +1,42 @@
+
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef ULTIMA2_CONSOLE_H
+#define ULTIMA2_CONSOLE_H
+
+#include "gui/debugger.h"
+
+namespace Ultima {
+namespace Ultima2 {
+
+class Console : public GUI::Debugger {
+private:
+	bool Cmd_test(int argc, const char **argv);
+public:
+	Console();
+	~Console() override;
+};
+
+} // namespace Ultima2
+} // namespace Ultima
+
+#endif
diff --git a/engines/ultima/ultima2/events.cpp b/engines/ultima/ultima2/events.cpp
new file mode 100644
index 00000000000..af699d7d520
--- /dev/null
+++ b/engines/ultima/ultima2/events.cpp
@@ -0,0 +1,346 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "common/config-manager.h"
+#include "graphics/screen.h"
+#include "ultima/ultima2/events.h"
+#include "ultima/ultima2/ultima2.h"
+#include "ultima/ultima2/views/views.h"
+
+namespace Ultima {
+namespace Ultima2 {
+
+Events *g_events;
+
+Events::Events() : UIElement("Root", nullptr) {
+	g_events = this;
+}
+
+Events::~Events() {
+	g_events = nullptr;
+}
+
+void Events::runGame() {
+	uint currTime, nextFrameTime = 0;
+	_screen = new Graphics::Screen();
+	Views::Views views;	// Loads all views in the structure
+
+	// Run the game
+	int saveSlot = ConfMan.getInt("save_slot");
+	if (saveSlot != -1)
+		g_engine->loadGameState(saveSlot);
+
+	addView("Startup");
+
+	Common::Event e;
+	while (!_views.empty() && !shouldQuit()) {
+		while (g_system->getEventManager()->pollEvent(e)) {
+			if (e.type == Common::EVENT_QUIT ||
+				e.type == Common::EVENT_RETURN_TO_LAUNCHER) {
+				_views.clear();
+				break;
+			} else {
+				processEvent(e);
+			}
+		}
+
+		if (_views.empty())
+			break;
+
+		g_system->delayMillis(10);
+		if ((currTime = g_system->getMillis()) >= nextFrameTime) {
+			nextFrameTime = currTime + FRAME_DELAY;
+			tick();
+			drawElements();
+			_screen->update();
+		}
+	}
+
+	delete _screen;
+}
+
+void Events::processEvent(Common::Event &ev) {
+	switch (ev.type) {
+	case Common::EVENT_KEYDOWN:
+		if (ev.kbd.keycode < Common::KEYCODE_NUMLOCK)
+			msgKeypress(KeypressMessage(ev.kbd));
+		break;
+	case Common::EVENT_CUSTOM_ENGINE_ACTION_START:
+		msgAction(ActionMessage(ev.customType));
+		break;
+	case Common::EVENT_LBUTTONDOWN:
+	case Common::EVENT_RBUTTONDOWN:
+	case Common::EVENT_MBUTTONDOWN:
+		msgMouseDown(MouseDownMessage(ev.type, ev.mouse));
+		break;
+	case Common::EVENT_LBUTTONUP:
+	case Common::EVENT_RBUTTONUP:
+	case Common::EVENT_MBUTTONUP:
+		msgMouseUp(MouseUpMessage(ev.type, ev.mouse));
+		break;
+	case Common::EVENT_MOUSEMOVE:
+		msgMouseMove(MouseMoveMessage(ev.type, ev.mouse));
+		break;
+	default:
+		break;
+	}
+}
+
+void Events::replaceView(UIElement *ui, bool replaceAllViews) {
+	assert(ui);
+	UIElement *priorView = focusedView();
+
+	if (replaceAllViews) {
+		clearViews();
+
+	} else if (!_views.empty()) {
+		priorView->msgUnfocus(UnfocusMessage());
+		_views.pop();
+	}
+
+	_views.push(ui);
+	ui->redraw();
+	ui->msgFocus(FocusMessage(priorView));
+}
+
+void Events::replaceView(const Common::String &name, bool replaceAllViews) {
+	replaceView(findView(name));
+}
+
+void Events::addView(UIElement *ui) {
+	assert(ui);
+	UIElement *priorView = focusedView();
+
+	if (!_views.empty())
+		priorView->msgUnfocus(UnfocusMessage());
+
+	_views.push(ui);
+	ui->redraw();
+	ui->msgFocus(FocusMessage(priorView));
+}
+
+void Events::addView(const Common::String &name) {
+	addView(findView(name));
+}
+
+void Events::popView() {
+	UIElement *priorView = focusedView();
+	priorView->msgUnfocus(UnfocusMessage());
+	_views.pop();
+
+	for (int i = 0; i < (int)_views.size() - 1; ++i) {
+		_views[i]->redraw();
+		_views[i]->draw();
+	}
+
+	if (!_views.empty()) {
+		UIElement *view = focusedView();
+		view->msgFocus(FocusMessage(priorView));
+		view->redraw();
+		view->draw();
+	}
+}
+
+void Events::redrawViews() {
+	for (uint i = 0; i < _views.size(); ++i) {
+		_views[i]->redraw();
+		_views[i]->draw();
+	}
+}
+
+bool Events::isPresent(const Common::String &name) const {
+	for (uint i = 0; i < _views.size(); ++i) {
+		if (_views[i]->_name == name)
+			return true;
+	}
+
+	return false;
+}
+
+void Events::clearViews() {
+	if (!_views.empty())
+		focusedView()->msgUnfocus(UnfocusMessage());
+
+	_views.clear();
+}
+
+void Events::addKeypress(const Common::KeyCode kc) {
+	Common::KeyState ks;
+	ks.keycode = kc;
+	if (kc >= Common::KEYCODE_SPACE && kc <= Common::KEYCODE_TILDE)
+		ks.ascii = kc;
+
+	focusedView()->msgKeypress(KeypressMessage(ks));
+}
+
+/*------------------------------------------------------------------------*/
+
+Bounds::Bounds(Common::Rect &innerBounds) :
+	_bounds(0, 0, 320, 200),
+	_innerBounds(innerBounds),
+	left(_bounds.left), top(_bounds.top),
+	right(_bounds.right), bottom(_bounds.bottom) {
+}
+
+Bounds &Bounds::operator=(const Common::Rect &r) {
+	_bounds = r;
+	_innerBounds = r;
+	_innerBounds.grow(-_borderSize);
+	return *this;
+}
+
+void Bounds::setBorderSize(size_t borderSize) {
+	_borderSize = borderSize;
+	_innerBounds = *this;
+	_innerBounds.grow(-_borderSize);
+}
+
+/*------------------------------------------------------------------------*/
+
+UIElement::UIElement(const Common::String &name) :
+	_name(name), _parent(g_engine), _bounds(_innerBounds) {
+	g_engine->_children.push_back(this);
+}
+
+UIElement::UIElement(const Common::String &name, UIElement *uiParent) :
+	_name(name), _parent(uiParent),
+	_bounds(_innerBounds) {
+	if (_parent)
+		_parent->_children.push_back(this);
+}
+
+void UIElement::redraw() {
+	_needsRedraw = true;
+
+	for (size_t i = 0; i < _children.size(); ++i)
+		_children[i]->redraw();
+}
+
+void UIElement::drawElements() {
+	if (_needsRedraw) {
+		draw();
+		_needsRedraw = false;
+	}
+
+	for (size_t i = 0; i < _children.size(); ++i)
+		_children[i]->drawElements();
+}
+
+UIElement *UIElement::findViewGlobally(const Common::String &name) {
+	return g_events->findView(name);
+}
+
+void UIElement::focus() {
+	g_events->replaceView(this);
+}
+
+void UIElement::close() {
+	assert(g_events->focusedView() == this);
+	g_events->popView();
+}
+
+bool UIElement::isFocused() const {
+	return g_events->focusedView() == this;
+}
+
+void UIElement::clearSurface() {
+	Graphics::ManagedSurface s = getSurface();
+	s.fillRect(Common::Rect(s.w, s.h), 0);
+}
+
+void UIElement::draw() {
+	for (size_t i = 0; i < _children.size(); ++i) {
+		_children[i]->draw();
+	}
+}
+
+bool UIElement::tick() {
+	if (_timeoutCtr && --_timeoutCtr == 0) {
+		timeout();
+	}
+
+	for (size_t i = 0; i < _children.size(); ++i) {
+		if (_children[i]->tick())
+			return true;
+	}
+
+	return false;
+}
+
+UIElement *UIElement::findView(const Common::String &name) {
+	if (_name.equalsIgnoreCase(name))
+		return this;
+
+	UIElement *result;
+	for (size_t i = 0; i < _children.size(); ++i) {
+		if ((result = _children[i]->findView(name)) != nullptr)
+			return result;
+	}
+
+	return nullptr;
+}
+
+void UIElement::replaceView(UIElement *ui, bool replaceAllViews) {
+	g_events->replaceView(ui, replaceAllViews);
+}
+
+void UIElement::replaceView(const Common::String &name, bool replaceAllViews) {
+	g_events->replaceView(name, replaceAllViews);
+}
+
+void UIElement::addView(UIElement *ui) {
+	g_events->addView(ui);
+}
+
+void UIElement::addView(const Common::String &name) {
+	g_events->addView(name);
+}
+
+void UIElement::addView() {
+	g_events->addView(this);
+}
+
+Gfx::GfxSurface UIElement::getSurface() const {
+	return Gfx::GfxSurface(*g_events->getScreen(), _bounds);
+}
+
+int UIElement::getRandomNumber(int minNumber, int maxNumber) {
+	return g_engine->getRandomNumber(maxNumber - minNumber + 1) + minNumber;
+}
+
+int UIElement::getRandomNumber(int maxNumber) {
+	return g_engine->getRandomNumber(maxNumber);
+}
+
+void UIElement::delaySeconds(uint seconds) {
+	_timeoutCtr = seconds * FRAME_RATE;
+}
+
+void UIElement::delayFrames(uint frames) {
+	_timeoutCtr = frames;
+}
+
+void UIElement::timeout() {
+	redraw();
+}
+
+} // namespace Ultima2
+} // namespace Ultima
diff --git a/engines/ultima/ultima2/events.h b/engines/ultima/ultima2/events.h
new file mode 100644
index 00000000000..25c64a6a9a8
--- /dev/null
+++ b/engines/ultima/ultima2/events.h
@@ -0,0 +1,418 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef ULTIMA2_EVENTS_H
+#define ULTIMA2_EVENTS_H
+
+#include "common/array.h"
+#include "common/stack.h"
+#include "graphics/screen.h"
+#include "ultima/ultima2/messages.h"
+#include "ultima/ultima2/gfx/gfx_surface.h"
+
+namespace Ultima {
+namespace Ultima2 {
+
+#define FRAME_RATE 20
+#define FRAME_DELAY (1000 / FRAME_RATE)
+
+class Events;
+
+/**
+ * Implements a thunk layer around an element's bounds,
+ * allowing access to it as if it were a simple Common::Rect,
+ * but any changes to it will also be applied to a linked inner bounds
+ */
+struct Bounds {
+private:
+	Common::Rect _bounds;
+	Common::Rect &_innerBounds;
+	int _borderSize = 0;
+public:
+	const int16 &left;
+	const int16 ⊤
+	const int16 &right;
+	const int16 ⊥
+public:
+	Bounds(Common::Rect &innerBounds);
+	operator const Common::Rect &() const {
+		return _bounds;
+	}
+	Bounds &operator=(const Common::Rect &r);
+	void setBorderSize(size_t borderSize);
+	size_t borderSize() const {
+		return _borderSize;
+	}
+	int16 width() const {
+		return _bounds.width();
+	}
+	int16 height() const {
+		return _bounds.height();
+	}
+};
+
+/**
+ * User interface element
+ */
+class UIElement {
+	friend class Events;
+private:
+	int _timeoutCtr = 0;
+protected:
+	UIElement *_parent;
+	Common::Array<UIElement *> _children;
+	Common::Rect _innerBounds;
+	Bounds _bounds;
+	bool _needsRedraw = true;
+	Common::String _name;
+protected:
+	/**
+	 * Set a delay countdown in seconds, after which timeout() is called
+	 */
+	void delaySeconds(uint seconds);
+
+	/**
+	 * Set a delay countdown in frames, after which timeout() is called
+	 */
+	void delayFrames(uint frames);
+
+	/**
+	 * Returns true if a delay is active
+	 */
+	bool isDelayActive() const {
+		return _timeoutCtr != 0;
+	}
+
+	/**
+	 * Cancels any active delay
+	 */
+	void cancelDelay() {
+		_timeoutCtr = 0;
+	}
+
+	/**
+	 * Called when an active timeout countdown expired
+	 */
+	virtual void timeout();
+
+private:
+	/**
+	 * Outer method for doing drawing
+	 *
+	 */
+	void drawElements();
+
+	/**
+	 * Finds a view globally
+	 */
+	static UIElement *findViewGlobally(const Common::String &name);
+public:
+	UIElement(const Common::String &name, UIElement *uiParent);
+	UIElement(const Common::String &name);
+	virtual ~UIElement() {
+	}
+
+	/**
+	 * Returns true if the elements needs to be redrawn
+	 */
+	bool needsRedraw() const {
+		return _needsRedraw;
+	}
+
+	/**
+	 * Sets that the element needs to be redrawn
+	 */
+	void redraw();
+
+	/**
+	 * Focuses the element as the current view
+	 */
+	void focus();
+
+	/**
+	 * Closes the current view. The view must have been added
+	 * via addView, so there's a remaining view afterwards
+	 */
+	virtual void close();
+
+	/*
+	 * Returns true if the view is focused
+	 */
+	bool isFocused() const;
+
+	/**
+	 * Sets the focus to a new view
+	 */
+	void replaceView(UIElement *ui, bool replaceAllViews = false);
+	void replaceView(const Common::String &name, bool replaceAllViews = false);
+
+	/**
+	 * Adds a focused view to the view stack without replacing current one
+	 */
+	void addView(UIElement *ui);
+	void addView(const Common::String &name);
+	void addView();
+	void open() {
+		addView();
+	}
+
+	/**
+	 * Returns a random number
+	 */
+	int getRandomNumber(int minNumber, int maxNumber);
+	int getRandomNumber(int maxNumber);
+
+	/**
+	 * Sets the element's bounds
+	 */
+	virtual void setBounds(const Common::Rect &r) {
+		_bounds = r;
+	}
+
+	/**
+	 * Gets the element's bounds
+	 */
+	Common::Rect getBounds() const {
+		return _bounds;
+	}
+
+	/**
+	 * Returns a surface for drawing the element
+	 */
+	Gfx::GfxSurface getSurface() const;
+
+	/**
+	 * Clear the surface
+	 */
+	virtual void clearSurface();
+
+	/**
+	 * Draws the element
+	 */
+	virtual void draw();
+
+	/**
+	 * Called for game frame ticks
+	 */
+	virtual bool tick();
+
+	/**
+	 * Find a view by name
+	 */
+	virtual UIElement *findView(const Common::String &name);
+
+	/**
+	 * Handles events
+	 */
+	 // Mouse move only has a minimal implementation for performance reasons
+protected:
+	virtual bool msgMouseMove(const MouseMoveMessage &msg) {
+		return false;
+	}
+public:
+	bool send(const MouseMoveMessage &msg) {
+		return msgMouseMove(msg);
+	}
+
+#define MESSAGE(NAME) \
+	protected: \
+		virtual bool msg##NAME(const NAME##Message &e) { \
+			for (Common::Array<UIElement *>::iterator it = _children.begin(); \
+					it != _children.end(); ++it) { \
+				if ((*it)->msg##NAME(e)) return true; \
+			} \
+			return false; \
+		} \
+	public: \
+		bool send(const Common::String &viewName, const NAME##Message &msg) { \
+			UIElement *view = UIElement::findViewGlobally(viewName); \
+			assert(view); \
+			return view->msg##NAME(msg); \
+		} \
+		bool send(const NAME##Message &msg) { \
+			return msg##NAME(msg); \
+		} \
+
+	MESSAGE(Focus);
+	MESSAGE(Unfocus);
+	MESSAGE(MouseEnter);
+	MESSAGE(MouseLeave);
+	MESSAGE(Keypress);
+	MESSAGE(MouseDown);
+	MESSAGE(MouseUp);
+	MESSAGE(Action);
+	MESSAGE(Game);
+	MESSAGE(Value);
+#undef MESSAGE
+};
+
+/**
+ * Main events and view manager. This is kept separate from the engine
+ * class because the engine may add a lot of globals and bring in other
+ * classes. So to save on compilation time, classes that only need to
+ * access basic view management methods like addView or replaceView
+ * only need to include events.h rather than the whole engine.
+ */
+class Events : public UIElement {
+private:
+	Graphics::Screen *_screen = nullptr;
+	Common::Stack<UIElement *> _views;
+protected:
+	/**
+	 * Process an event
+	 */
+	void processEvent(Common::Event &ev);
+
+	/**
+	 * Returns true if the game should quit
+	 */
+	virtual bool shouldQuit() const = 0;
+
+	/**
+	 * Overrides events we want to only go to the focused view
+	 */
+#define MESSAGE(NAME) \
+		bool msg##NAME(const NAME##Message &e) override { \
+			return !_views.empty() ? focusedView()->msg##NAME(e) : false; \
+		}
+	MESSAGE(Action);
+	MESSAGE(Focus);
+	MESSAGE(Unfocus);
+	MESSAGE(MouseEnter);
+	MESSAGE(MouseLeave);
+	MESSAGE(Keypress);
+	MESSAGE(MouseDown);
+	MESSAGE(MouseUp);
+	MESSAGE(MouseMove);
+#undef MESSAGE
+public:
+	Events();
+	virtual ~Events();
+
+	/**
+	 * Main game loop
+	 */
+	void runGame();
+
+	/**
+	 * Sets the focus to a new view
+	 */
+	void replaceView(UIElement *ui, bool replaceAllViews = false);
+	void replaceView(const Common::String &name, bool replaceAllViews = false);
+
+	/**
+	 * Adds a focused view to the view stack without replacing current one
+	 */
+	void addView(UIElement *ui);
+	void addView(const Common::String &name);
+
+	/**
+	 * Clears the view list
+	 */
+	void clearViews();
+
+	/**
+	 * Pops a view from the view stack
+	 */
+	void popView();
+
+	/**
+	 * Redraws the views in order. This is used in rare cases
+	 * where a view draws outside it's defined area, and needs
+	 * to restore whether the background was before
+	 */
+	void redrawViews();
+
+	/**
+	 * Returns the currently focused view, if any
+	 */
+	UIElement *focusedView() const {
+		return _views.empty() ? nullptr : _views.top();
+	}
+
+	/**
+	 * Returns the view prior to the current view, if any
+	 */
+	UIElement *priorView() const {
+		return _views.size() < 2 ? nullptr :
+			_views[_views.size() - 2];
+	}
+
+	/**
+	 * Returns true if a view of a given name is present
+	 * at all in the visible view stack
+	 */
+	bool isPresent(const Common::String &name) const;
+
+	/**
+	 * Returns true if combat is active
+	 */
+	bool isInCombat() const {
+		return isPresent("Combat");
+	}
+
+	/**
+	 * Returns the underlying screen
+	 */
+	Graphics::Screen *getScreen() const {
+		return _screen;
+	}
+
+	/**
+	 * Draws the focused view
+	 */
+	void drawElements() {
+		if (!_views.empty())
+			focusedView()->drawElements();
+	}
+
+	/**
+	 * Add a keypress to the event queue
+	 */
+	void addKeypress(const Common::KeyCode kc);
+
+	/**
+	 * Events manager doesn't have any intrinsic drawing
+	 */
+	void draw() override {
+	}
+
+	/**
+	 * Called once every game frame
+	 */
+	bool tick() override {
+		return !_views.empty() ? focusedView()->tick() : false;
+	}
+
+	/**
+	 * Calling the close method for g_events closes the active view
+	 */
+	void close() override {
+		focusedView()->close();
+	}
+};
+
+extern Events *g_events;
+
+} // namespace Ultima2
+} // namespace Ultima
+
+#endif
diff --git a/engines/ultima/ultima2/gfx/gfx_surface.cpp b/engines/ultima/ultima2/gfx/gfx_surface.cpp
new file mode 100644
index 00000000000..0e37f1a1772
--- /dev/null
+++ b/engines/ultima/ultima2/gfx/gfx_surface.cpp
@@ -0,0 +1,108 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "ultima/ultima2/gfx/gfx_surface.h"
+#include "ultima/ultima2/ultima2.h"
+
+namespace Ultima {
+namespace Ultima2 {
+namespace Gfx {
+
+void GfxSurface::writeString(const Common::Point &pt, const Common::String &str,
+		Graphics::TextAlign align) {
+	_textPos = pt;
+	writeString(str, align);
+}
+
+void GfxSurface::writeString(const Common::String &str, Graphics::TextAlign align) {
+	size_t strSize = 0;
+	for (const char *p = str.c_str(); *p; ++p)
+		strSize += Common::isPrint(*p) ? 1 : 0;
+
+	switch (align) {
+	case Graphics::kTextAlignCenter:
+		_textPos.x -= strSize / 2;
+		break;
+	case Graphics::kTextAlignRight:
+		_textPos.x -= strSize;
+		break;
+	case Graphics::kTextAlignLeft:
+	default:
+		break;
+	}
+
+	for (const char *p = str.c_str(); *p; ++p) {
+		if (*p == '\n') {
+			assert(align == Graphics::kTextAlignLeft);
+			newLine();
+		} else if (*p < 32) {
+			setColor((byte)*p);
+		} else {
+			writeChar(*p);
+		}
+	}
+}
+
+void GfxSurface::writeChar(uint32 chr) {
+	if (chr >= ' ') {
+		// TODO
+	}
+
+	if (_textPos.x >= TEXT_WIDTH || chr == '\n') {
+		newLine();
+	}
+}
+
+void GfxSurface::newLine() {
+	_textPos.x = 0;
+	_textPos.y++;
+
+	if (_textPos.y >= TEXT_HEIGHT) {
+#if 0
+		_textPos.y = TEXT_HEIGHT - 1;
+
+		// Scroll the screen contents up
+		blitFrom(*this, Common::Rect(0, GLYPH_HEIGHT, DEFAULT_SCX, DEFAULT_SCY),
+			Common::Point(0, 0));
+		fillRect(Common::Rect(0, DEFAULT_SCX - GLYPH_HEIGHT, DEFAULT_SCX, DEFAULT_SCY), 0);
+#endif
+	}
+}
+
+void GfxSurface::setTextPos(const Common::Point &pt) {
+	_textPos = pt;
+}
+
+byte GfxSurface::setColor(byte color) {
+	byte oldColor = _textColor;
+	_textColor = color;
+	return oldColor;
+}
+
+byte GfxSurface::setColor(byte r, byte g, byte b) {
+	byte oldColor = _textColor;
+	_textColor = g_engine->_palette.findBestColor(r, g, b);
+	return oldColor;
+}
+
+} // namespace Gfx
+} // namespace Ultima2
+} // namespace Ultima
diff --git a/engines/ultima/ultima2/gfx/gfx_surface.h b/engines/ultima/ultima2/gfx/gfx_surface.h
new file mode 100644
index 00000000000..f692914e99d
--- /dev/null
+++ b/engines/ultima/ultima2/gfx/gfx_surface.h
@@ -0,0 +1,63 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef ULTIMA2_GFX_SURFACE_H
+#define ULTIMA2_GFX_SURFACE_H
+
+#include "graphics/font.h"
+#include "graphics/managed_surface.h"
+
+namespace Ultima {
+namespace Ultima2 {
+namespace Gfx {
+
+constexpr int TEXT_WIDTH = 40;
+constexpr int TEXT_HEIGHT = 25;
+
+class GfxSurface : public Graphics::ManagedSurface {
+private:
+	Common::Point _textPos;
+	byte _textColor = 255;
+
+	void newLine();
+
+public:
+	GfxSurface() : Graphics::ManagedSurface() {}
+	GfxSurface(Graphics::ManagedSurface &surf, const Common::Rect &bounds) : Graphics::ManagedSurface(surf, bounds) {}
+
+	/**
+	 * Write some text to the surface
+	 */
+	void writeString(const Common::Point &pt, const Common::String &str,
+		Graphics::TextAlign align = Graphics::kTextAlignLeft);
+	void writeString(const Common::String &str, Graphics::TextAlign align = Graphics::kTextAlignLeft);
+	void writeChar(uint32 chr);
+
+	void setTextPos(const Common::Point &pt);
+	byte setColor(byte color);
+	byte setColor(byte r, byte g, byte b);
+};
+
+} // namespace Gfx
+} // namespace Ultima2
+} // namespace Ultima
+
+#endif
diff --git a/engines/ultima/ultima2/gfx/pic_decoder.cpp b/engines/ultima/ultima2/gfx/pic_decoder.cpp
new file mode 100644
index 00000000000..a22e1b94ad2
--- /dev/null
+++ b/engines/ultima/ultima2/gfx/pic_decoder.cpp
@@ -0,0 +1,86 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "common/stream.h"
+#include "ultima/ultima2/gfx/pic_decoder.h"
+
+namespace Ultima {
+namespace Ultima2 {
+namespace Gfx {
+
+bool PicDecoder::loadStream(Common::SeekableReadStream &stream) {
+	destroy();
+	_surface.create(320, 200, Graphics::PixelFormat::createFormatCLUT8());
+	byte *output_buffer = (byte *)_surface.getPixels();
+
+	// Read in the source data
+	Common::Array<byte> cga_data;
+	cga_data.resize(stream.size());
+	stream.read(&cga_data[0], stream.size());
+
+	int x, y;
+	int cga_offset;
+	uint8_t byte_data;
+	int output_offset;
+
+	// CGA interlaced format:
+	// - First 8,192 bytes: even scanlines (0, 2, 4, ..., 198)
+	// - Next 8,192 bytes: odd scanlines (1, 3, 5, ..., 199)
+	// Each scanline is 80 bytes (320 pixels / 4 pixels per byte)
+
+	// Process even scanlines (0, 2, 4, ..., 198)
+	for (y = 0; y < 200; y += 2) {
+		cga_offset = (y / 2) * 80;  // Even lines are in first half
+		output_offset = y * 320;
+
+		for (x = 0; x < 80; x++) {
+			byte_data = cga_data[cga_offset + x];
+
+			// Extract 4 pixels from the byte (2 bits each)
+			output_buffer[output_offset + (x * 4) + 0] = (byte_data >> 6) & 0x03;
+			output_buffer[output_offset + (x * 4) + 1] = (byte_data >> 4) & 0x03;
+			output_buffer[output_offset + (x * 4) + 2] = (byte_data >> 2) & 0x03;
+			output_buffer[output_offset + (x * 4) + 3] = (byte_data >> 0) & 0x03;
+		}
+	}
+
+	// Process odd scanlines (1, 3, 5, ..., 199)
+	for (y = 1; y < 200; y += 2) {
+		cga_offset = 8192 + ((y / 2) * 80);  // Odd lines are in second half
+		output_offset = y * 320;
+
+		for (x = 0; x < 80; x++) {
+			byte_data = cga_data[cga_offset + x];
+
+			// Extract 4 pixels from the byte (2 bits each)
+			output_buffer[output_offset + (x * 4) + 0] = (byte_data >> 6) & 0x03;
+			output_buffer[output_offset + (x * 4) + 1] = (byte_data >> 4) & 0x03;
+			output_buffer[output_offset + (x * 4) + 2] = (byte_data >> 2) & 0x03;
+			output_buffer[output_offset + (x * 4) + 3] = (byte_data >> 0) & 0x03;
+		}
+	}
+
+	return true;
+}
+
+} // namespace Gfx
+} // namespace Ultima2
+} // namespace Ultima
diff --git a/engines/ultima/ultima2/gfx/pic_decoder.h b/engines/ultima/ultima2/gfx/pic_decoder.h
new file mode 100644
index 00000000000..6e7a395e986
--- /dev/null
+++ b/engines/ultima/ultima2/gfx/pic_decoder.h
@@ -0,0 +1,98 @@
+
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef ULTIMA2_GFX_PIC_DECODER_H
+#define ULTIMA2_GFX_PIC_DECODER_H
+
+#include "graphics/surface.h"
+#include "image/image_decoder.h"
+
+namespace Ultima {
+namespace Ultima2 {
+namespace Gfx {
+
+class PicDecoder : public Image::ImageDecoder {
+private:
+	Graphics::Palette _palette;
+	Graphics::Surface _surface;
+public:
+	~PicDecoder() {
+		destroy();
+	}
+
+	/**
+	 * Load an image from the specified stream.
+	 *
+	 * loadStream() should implicitly call destroy() to free the memory
+	 * of the last loadStream() call.
+	 *
+	 * @param stream  Input stream.
+	 *
+	 * @return Whether loading the file succeeded.
+	 *
+	 * @see getSurface
+	 * @see getPalette
+	 */
+	bool loadStream(Common::SeekableReadStream &stream) override;
+
+	/**
+	 * Destroy this decoder's surface and palette.
+	 *
+	 * This should be called by a loadStream() implementation as well
+	 * as by the destructor.
+	 */
+	void destroy() override {
+		_surface.free();
+	}
+
+	/**
+	 * Get the decoded surface.
+	 *
+	 * This surface is owned by this ImageDecoder and remains valid
+	 * until destroy() or loadStream() is called, or until the destructor of
+	 * this ImageDecoder is called.
+	 *
+	 * @return The decoded surface, or 0 if no surface is present.
+	 */
+	const Graphics::Surface *getSurface() const override {
+		return &_surface;
+	}
+
+	/**
+	 * Get the decoded palette.
+	 *
+	 * This palette is owned by this ImageDecoder and remains valid
+	 * until destroy() or loadStream() is called, or until the destructor of
+	 * this ImageDecoder is called.
+	 *
+	 * @return The decoded palette, or empty if no palette is present.
+	 */
+	const Graphics::Palette &getPalette() const override {
+		return _palette;
+	}
+};
+
+} // namespace Gfx
+} // namespace Ultima2
+} // namespace Ultima
+
+#endif
diff --git a/engines/ultima/ultima2/messages.cpp b/engines/ultima/ultima2/messages.cpp
new file mode 100644
index 00000000000..5aa36b53229
--- /dev/null
+++ b/engines/ultima/ultima2/messages.cpp
@@ -0,0 +1,45 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "ultima/ultima2/messages.h"
+
+namespace Ultima {
+namespace Ultima2 {
+
+MouseMessage::MouseMessage(Common::EventType type,
+	const Common::Point &pos) : Message(), _pos(pos) {
+	switch (type) {
+	case Common::EVENT_RBUTTONDOWN:
+	case Common::EVENT_RBUTTONUP:
+		_button = MB_RIGHT;
+		break;
+	case Common::EVENT_MBUTTONDOWN:
+	case Common::EVENT_MBUTTONUP:
+		_button = MB_MIDDLE;
+		break;
+	default:
+		_button = MB_LEFT;
+		break;
+	}
+}
+
+} // namespace Ultima2
+} // namespace Ultima
diff --git a/engines/ultima/ultima2/messages.h b/engines/ultima/ultima2/messages.h
new file mode 100644
index 00000000000..ca75d4d0c2f
--- /dev/null
+++ b/engines/ultima/ultima2/messages.h
@@ -0,0 +1,133 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef ULTIMA2_MESSAGES_H
+#define ULTIMA2_MESSAGES_H
+
+#include "common/array.h"
+#include "common/events.h"
+#include "common/str.h"
+
+namespace Ultima {
+namespace Ultima2 {
+
+class UIElement;
+
+struct Message {};
+
+struct FocusMessage : public Message {
+	UIElement *_priorView = nullptr;
+	FocusMessage() : Message() {
+	}
+	FocusMessage(UIElement *priorView) : Message(),
+		_priorView(priorView) {
+	}
+};
+
+struct UnfocusMessage : public Message {};
+struct MouseEnterMessage : public Message {};
+struct MouseLeaveMessage : public Message {};
+
+struct KeypressMessage : public Message, public Common::KeyState {
+	KeypressMessage() : Message() {
+	}
+	KeypressMessage(const Common::KeyState &ks) :
+		Message(), Common::KeyState(ks) {
+	}
+};
+
+struct MouseMessage : public Message {
+	enum Button {
+		MB_LEFT, MB_RIGHT, MB_MIDDLE
+	};
+	Button _button;
+	Common::Point _pos;
+
+	MouseMessage() : Message(), _button(MB_LEFT) {
+	}
+	MouseMessage(Button btn, const Common::Point &pos) :
+		Message(), _button(btn), _pos(pos) {
+	}
+	MouseMessage(Common::EventType type, const Common::Point &pos);
+};
+struct MouseDownMessage : public MouseMessage {
+	MouseDownMessage() : MouseMessage() {
+	}
+	MouseDownMessage(Button btn, const Common::Point &pos) :
+		MouseMessage(btn, pos) {
+	}
+	MouseDownMessage(Common::EventType type, const Common::Point &pos) :
+		MouseMessage(type, pos) {
+	}
+};
+struct MouseUpMessage : public MouseMessage {
+	MouseUpMessage() : MouseMessage() {
+	}
+	MouseUpMessage(Button btn, const Common::Point &pos) :
+		MouseMessage(btn, pos) {
+	}
+	MouseUpMessage(Common::EventType type, const Common::Point &pos) :
+		MouseMessage(type, pos) {
+	}
+};
+typedef MouseMessage MouseMoveMessage;
+
+struct GameMessage : public Message {
+	Common::String _name;
+	int _value;
+	Common::String _stringValue;
+
+	GameMessage() : Message(), _value(-1) {
+	}
+	GameMessage(const Common::String &name) : Message(),
+		_name(name), _value(-1) {
+	}
+	GameMessage(const Common::String &name, int value) : Message(),
+		_name(name), _value(value) {
+	}
+	GameMessage(const Common::String &name, const Common::String &value) :
+		Message(), _name(name), _stringValue(value) {
+	}
+};
+
+struct ValueMessage : public Message {
+	int _value;
+
+	ValueMessage() : Message(), _value(0) {
+	}
+	ValueMessage(int value) : Message(),
+		_value(value) {
+	}
+};
+
+struct ActionMessage : public Message {
+	int _action;
+	ActionMessage() : Message(), _action(0) {
+	}
+	ActionMessage(int action) : Message(),
+		_action(action) {
+	}
+};
+
+} // namespace Ultima2
+} // namespace Ultima
+
+#endif
diff --git a/engines/ultima/ultima2/metaengine.cpp b/engines/ultima/ultima2/metaengine.cpp
new file mode 100644
index 00000000000..373aa1b718c
--- /dev/null
+++ b/engines/ultima/ultima2/metaengine.cpp
@@ -0,0 +1,204 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "ultima/ultima2/metaengine.h"
+#include "ultima/ultima2/ultima2.h"
+#include "common/translation.h"
+#include "backends/keymapper/action.h"
+#include "backends/keymapper/standard-actions.h"
+
+namespace Ultima {
+namespace Ultima2 {
+
+struct KeybindingRecord {
+	KeybindingAction _action;
+	const char *_id;
+	const char *_desc;
+	const char *_key;
+	const char *_joy;
+};
+
+static const KeybindingRecord MINIMAL_KEYS[] = {
+	{ KEYBIND_ESCAPE, "ESCAPE", _s("Escape"), "ESCAPE", "JOY_Y" },
+	{ KEYBIND_NONE, nullptr, nullptr, nullptr, nullptr }
+};
+
+static const KeybindingRecord MENU_KEYS[] = {
+	{ KEYBIND_UP, "UP", _s("Up"), "UP", "JOY_UP" },
+	{ KEYBIND_DOWN, "DOWN", _s("Down"), "DOWN", "JOY_DOWN" },
+	{ KEYBIND_SELECT, "SELECT", _s("Select"), "SPACE", nullptr },
+	{ KEYBIND_QUIT, "QUIT", _s("Quit"), "q", nullptr },
+	{ KEYBIND_SWING, "SWING", _s("Swing"), "s", nullptr },
+	{ KEYBIND_THROW, "THROW", _s("Throw"), "t", nullptr },
+	{ KEYBIND_FOOD, "FOOD", _s("Food"), "f", nullptr },
+	{ KEYBIND_RAPIER, "RAPIER", _s("Rapier"), "r", nullptr },
+	{ KEYBIND_AXE, "AXE", _s("Axe"), "a", nullptr },
+	{ KEYBIND_SHIELD, "SHIELD", _s("Shield"), "s", nullptr },
+	{ KEYBIND_BOW, "BOW", _s("Bow & arrow"), "b", nullptr },
+	{ KEYBIND_AMULET, "AMULET", _s("Magic amulet"), "m", nullptr },
+	{ KEYBIND_AMULET1, "AMULET1", _s("Amulet option 1"), "1", nullptr },
+	{ KEYBIND_AMULET2, "AMULET2", _s("Amulet option 2"), "2", nullptr },
+	{ KEYBIND_AMULET3, "AMULET3", _s("Amulet option 3"), "3", nullptr },
+	{ KEYBIND_AMULET4, "AMULET4", _s("Amulet option 4"), "4", nullptr },
+	{ KEYBIND_NONE, nullptr, nullptr, nullptr, nullptr }
+};
+
+static const KeybindingRecord OVERWORLD_KEYS[] = {
+	{ KEYBIND_UP, "UP", _s("North"), "UP", "JOY_UP" },
+	{ KEYBIND_DOWN, "DOWN", _s("South"), "DOWN", "JOY_DOWN" },
+	{ KEYBIND_LEFT, "LEFT", _s("West"), "LEFT", "JOY_LEFT" },
+	{ KEYBIND_RIGHT, "RIGHT", _s("East"), "RIGHT", "JOY_RIGHT" },
+	{ KEYBIND_ENTER, "ENTER", _s("Enter / Exit"), "e", "JOY_B" },
+	{ KEYBIND_INFO, "INFO", _s("Info"), "z", "JOY_X" },
+	{ KEYBIND_QUIT, "QUIT", _s("Quit"), "q", nullptr },
+	{ KEYBIND_PASS, "PASS", _s("Pass / Wait"), "SPACE", nullptr },
+	{ KEYBIND_MINIMAP, "MINIMAP", _s("Minimap"), "m", nullptr },
+	{ KEYBIND_NONE, nullptr, nullptr, nullptr, nullptr }
+};
+
+static const KeybindingRecord DUNGEON_KEYS[] = {
+	{ KEYBIND_UP, "UP", _s("Move forward"), "UP", "JOY_UP" },
+	{ KEYBIND_DOWN, "DOWN", _s("Turn around"), "DOWN", "JOY_DOWN" },
+	{ KEYBIND_LEFT, "LEFT", _s("Turn left"), "LEFT", "JOY_LEFT" },
+	{ KEYBIND_RIGHT, "RIGHT", _s("Turn right"), "RIGHT", "JOY_RIGHT" },
+	{ KEYBIND_ATTACK, "ATTACK", _s("Attack"), "a", "JOY_A" },
+	{ KEYBIND_ENTER, "ENTER", _s("Enter / Exit"), "e", "JOY_B" },
+	{ KEYBIND_INFO, "INFO", _s("Info"), "z", "JOY_X" },
+	{ KEYBIND_QUIT, "QUIT", _s("Quit"), "q", nullptr },
+	{ KEYBIND_PASS, "PASS", _s("Pass / Wait"), "SPACE", nullptr },
+	{ KEYBIND_MINIMAP, "MINIMAP", _s("Minimap"), "m", nullptr },
+	{ KEYBIND_NONE, nullptr, nullptr, nullptr, nullptr }
+};
+
+struct KeysRecord {
+	const char *_id;
+	const char *_desc;
+	const KeybindingRecord *_keys;
+};
+
+static const KeysRecord ALL_RECORDS[] = {
+	{ "Ultima2", _s("Basic keys"), MINIMAL_KEYS },
+	{ "menu", _s("Menu keys"), MENU_KEYS },
+	{ "overworld", _s("Overworld keys"), OVERWORLD_KEYS },
+	{ "dungeon", _s("Dungeon keys"), DUNGEON_KEYS },
+	{ nullptr, nullptr, nullptr }
+};
+
+static const KeysRecord MINIMAL_RECORDS[] = {
+	{ "Ultima2", _s("Basic keys"), MINIMAL_KEYS },
+	{ nullptr, nullptr, nullptr }
+};
+
+static const KeysRecord MENU_RECORDS[] = {
+	{ "Ultima2", _s("Basic keys"), MINIMAL_KEYS },
+	{ "menu", _s("Menu keys"), MENU_KEYS },
+	{ nullptr, nullptr, nullptr }
+};
+
+static const KeysRecord OVERWORLD_RECORDS[] = {
+	{ "Ultima2", _s("Basic keys"), MINIMAL_KEYS },
+	{ "overworld", _s("Overworld keys"), OVERWORLD_KEYS },
+	{ nullptr, nullptr, nullptr }
+};
+
+static const KeysRecord DUNGEON_RECORDS[] = {
+	{ "Ultima2", _s("Basic keys"), MINIMAL_KEYS },
+	{ "dungeon", _s("Dungeon keys"), DUNGEON_KEYS },
+	{ nullptr, nullptr, nullptr }
+};
+
+static const KeysRecord *MODE_RECORDS[] = {
+	ALL_RECORDS,
+	MINIMAL_RECORDS,
+	MENU_RECORDS,
+	OVERWORLD_RECORDS,
+	DUNGEON_RECORDS,
+};
+
+Common::KeymapArray MetaEngine::initKeymaps(KeybindingMode mode) {
+	Common::KeymapArray keymapArray;
+	Common::Keymap *keyMap;
+	Common::Action *act;
+	const KeysRecord *recPtr = MODE_RECORDS[mode];
+
+	for (int kCtr = 0; recPtr->_id; ++recPtr, ++kCtr) {
+		// Core keymaps
+		keyMap = new Common::Keymap(Common::Keymap::kKeymapTypeGame,
+			recPtr->_id, recPtr->_desc);
+		keymapArray.push_back(keyMap);
+
+		if (kCtr == 0) {
+			addMouseClickActions(*keyMap);
+		}
+
+		for (const KeybindingRecord *r = recPtr->_keys; r->_id; ++r) {
+			act = new Common::Action(r->_id, _(r->_desc));
+			act->setCustomEngineActionEvent(r->_action);
+			act->addDefaultInputMapping(r->_key);
+			if (r->_joy)
+				act->addDefaultInputMapping(r->_joy);
+			if (r->_action == KEYBIND_ENTER)
+				act->addDefaultInputMapping("x");	// x also works to eXit
+			else if (r->_action == KEYBIND_SELECT)
+				act->addDefaultInputMapping("RETURN");
+			else if (r->_action == KEYBIND_QUIT)
+				act->addDefaultInputMapping("p");	// Map "Pause" to Quit
+
+			if (r->_action == KEYBIND_UP || r->_action == KEYBIND_DOWN ||
+				r->_action == KEYBIND_LEFT || r->_action == KEYBIND_RIGHT)
+				// Allow movement actions to be triggered on keyboard repeats
+				act->allowKbdRepeats();
+
+			keyMap->addAction(act);
+		}
+	}
+
+	return keymapArray;
+}
+
+void MetaEngine::addMouseClickActions(Common::Keymap &keyMap) {
+	Common::Action *act;
+
+	act = new Common::Action(Common::kStandardActionLeftClick, _("Left click"));
+	act->setLeftClickEvent();
+	act->addDefaultInputMapping("MOUSE_LEFT");
+	act->addDefaultInputMapping("JOY_A");
+	keyMap.addAction(act);
+
+	act = new Common::Action(Common::kStandardActionRightClick, _("Right click"));
+	act->setRightClickEvent();
+	act->addDefaultInputMapping("MOUSE_RIGHT");
+	act->addDefaultInputMapping("JOY_B");
+	keyMap.addAction(act);
+}
+
+void MetaEngine::setKeybindingMode(KeybindingMode mode) {
+	Common::Keymapper *const mapper = g_engine->getEventManager()->getKeymapper();
+	mapper->cleanupGameKeymaps();
+
+	Common::KeymapArray arr = initKeymaps(mode);
+
+	for (uint idx = 0; idx < arr.size(); ++idx)
+		mapper->addGameKeymap(arr[idx]);
+}
+
+} // namespace Ultima2
+} // namespace Ultima
diff --git a/engines/ultima/ultima2/metaengine.h b/engines/ultima/ultima2/metaengine.h
new file mode 100644
index 00000000000..1fd35597c53
--- /dev/null
+++ b/engines/ultima/ultima2/metaengine.h
@@ -0,0 +1,72 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef ULTIMA2_METAENGINE_H
+#define ULTIMA2_METAENGINE_H
+
+#include "backends/keymapper/keymapper.h"
+
+namespace Ultima {
+namespace Ultima2 {
+
+enum KeybindingAction {
+	KEYBIND_UP, KEYBIND_DOWN, KEYBIND_LEFT, KEYBIND_RIGHT,
+	KEYBIND_ESCAPE, KEYBIND_QUIT, KEYBIND_ENTER, KEYBIND_INFO,
+	KEYBIND_PASS, KEYBIND_ATTACK, KEYBIND_SWING, KEYBIND_THROW,
+	KEYBIND_AMULET1, KEYBIND_AMULET2, KEYBIND_AMULET3, KEYBIND_AMULET4,
+	KEYBIND_MINIMAP,
+
+	KEYBIND_SELECT, KEYBIND_FOOD, KEYBIND_RAPIER, KEYBIND_AXE,
+	KEYBIND_SHIELD, KEYBIND_BOW, KEYBIND_AMULET,
+
+	KEYBIND_NONE
+};
+
+enum KeybindingMode {
+	KBMODE_ALL,
+	KBMODE_MINIMAL,
+	KBMODE_MENUS,
+	KBMODE_OVERWORLD,
+	KBMODE_DUNGEONS
+};
+
+class MetaEngine {
+private:
+	/**
+	 * Adds the default actions for the mouse buttons
+	 */
+	static void addMouseClickActions(Common::Keymap &keyMap);
+public:
+	/**
+	 * Initialize keymaps
+	 */
+	static Common::KeymapArray initKeymaps(KeybindingMode mode = KBMODE_ALL);
+
+	/**
+	 * Sets the current set of actions which are active
+	 */
+	static void setKeybindingMode(KeybindingMode mode);
+};
+
+} // namespace Ultima2
+} // namespace Ultima
+
+#endif
diff --git a/engines/ultima/ultima2/ultima2.cpp b/engines/ultima/ultima2/ultima2.cpp
new file mode 100644
index 00000000000..f3ad243d15e
--- /dev/null
+++ b/engines/ultima/ultima2/ultima2.cpp
@@ -0,0 +1,81 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "common/scummsys.h"
+#include "common/config-manager.h"
+#include "common/debug-channels.h"
+#include "common/events.h"
+#include "common/system.h"
+#include "engines/util.h"
+#include "graphics/paletteman.h"
+#include "ultima/ultima2/ultima2.h"
+#include "ultima/ultima2/console.h"
+#include "ultima/ultima2/metaengine.h"
+
+namespace Ultima {
+namespace Ultima2 {
+
+Ultima2Engine *g_engine;
+
+Ultima2Engine::Ultima2Engine(OSystem *syst, const Ultima::UltimaGameDescription *gameDesc) : Engine(syst),
+_gameDescription(gameDesc), _randomSource("Ultima2") {
+	g_engine = this;
+}
+
+
+Ultima2Engine::~Ultima2Engine() {
+}
+
+uint32 Ultima2Engine::getFeatures() const {
+	return _gameDescription->desc.flags;
+}
+
+Common::String Ultima2Engine::getGameId() const {
+	return _gameDescription->desc.gameId;
+}
+
+Common::Error Ultima2Engine::run() {
+	MetaEngine::setKeybindingMode(KBMODE_MINIMAL);
+
+	// Initialize 320x200 paletted graphics mode
+	initGraphics(320, 200);
+
+	// Set the engine's debugger console
+	setDebugger(new Console());
+
+	runGame();
+
+	return Common::kNoError;
+}
+
+Common::Error Ultima2Engine::syncGame(Common::Serializer &s) {
+	// The Serializer has methods isLoading() and isSaving()
+	// if you need to specific steps; for example setting
+	// an array size after reading it's length, whereas
+	// for saving it would write the existing array's length
+	int dummy = 0;
+	s.syncAsUint32LE(dummy);
+
+	return Common::kNoError;
+}
+
+} // namespace Ultima2
+} // namespace Ultima
diff --git a/engines/ultima/ultima2/ultima2.h b/engines/ultima/ultima2/ultima2.h
new file mode 100644
index 00000000000..4980a862560
--- /dev/null
+++ b/engines/ultima/ultima2/ultima2.h
@@ -0,0 +1,117 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef ULTIMA2_H
+#define ULTIMA2_H
+
+#include "common/scummsys.h"
+#include "common/system.h"
+#include "common/error.h"
+#include "common/fs.h"
+#include "common/hash-str.h"
+#include "common/random.h"
+#include "common/serializer.h"
+#include "common/util.h"
+#include "engines/engine.h"
+#include "engines/savestate.h"
+#include "graphics/palette.h"
+#include "graphics/screen.h"
+#include "ultima/detection.h"
+#include "ultima/ultima2/events.h"
+
+namespace Ultima {
+namespace Ultima2 {
+
+struct Ultima2GameDescription;
+
+class Ultima2Engine : public Engine, public Events {
+private:
+	const Ultima::UltimaGameDescription *_gameDescription;
+	Common::RandomSource _randomSource;
+protected:
+	// Engine APIs
+	Common::Error run() override;
+
+	/**
+	 * Returns true if the game should quit
+	 */
+	bool shouldQuit() const override {
+		return Engine::shouldQuit();
+	}
+
+public:
+	Graphics::Palette _palette;
+
+public:
+	Ultima2Engine(OSystem *syst, const Ultima::UltimaGameDescription *gameDesc);
+	~Ultima2Engine() override;
+
+	uint32 getFeatures() const;
+
+	/**
+	 * Returns the game Id
+	 */
+	Common::String getGameId() const;
+
+	/**
+	 * Gets a random number
+	 */
+	uint32 getRandomNumber(uint maxNum) {
+		return _randomSource.getRandomNumber(maxNum);
+	}
+
+	bool hasFeature(EngineFeature f) const override {
+		return
+			(f == kSupportsLoadingDuringRuntime) ||
+			(f == kSupportsSavingDuringRuntime) ||
+			(f == kSupportsReturnToLauncher);
+	};
+
+	bool canLoadGameStateCurrently(Common::U32String *msg = nullptr) override {
+		return true;
+	}
+	bool canSaveGameStateCurrently(Common::U32String *msg = nullptr) override {
+		return true;
+	}
+
+	/**
+	 * Uses a serializer to allow implementing savegame
+	 * loading and saving using a single method
+	 */
+	Common::Error syncGame(Common::Serializer &s);
+
+	Common::Error saveGameStream(Common::WriteStream *stream, bool isAutosave = false) override {
+		Common::Serializer s(nullptr, stream);
+		return syncGame(s);
+	}
+	Common::Error loadGameStream(Common::SeekableReadStream *stream) override {
+		Common::Serializer s(stream, nullptr);
+		return syncGame(s);
+	}
+};
+
+extern Ultima2Engine *g_engine;
+#define SHOULD_QUIT ::Ultima2::g_engine->shouldQuit()
+
+} // namespace Ultima2
+} // namespace Ultima
+
+#endif
diff --git a/engines/ultima/ultima2/views/startup.cpp b/engines/ultima/ultima2/views/startup.cpp
new file mode 100644
index 00000000000..8d558e6ce57
--- /dev/null
+++ b/engines/ultima/ultima2/views/startup.cpp
@@ -0,0 +1,76 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "common/file.h"
+#include "ultima/ultima2/views/startup.h"
+#include "ultima/ultima2/gfx/pic_decoder.h"
+
+namespace Ultima {
+namespace Ultima2 {
+namespace Views {
+
+#define DELAY_SECONDS 3
+
+bool Startup::msgFocus(const FocusMessage &msg) {
+	_pageCtr = 0;
+	delaySeconds(DELAY_SECONDS);
+	return View::msgFocus(msg);
+}
+
+void Startup::timeout() {
+	if (++_pageCtr == 3) {
+		showTitle();
+	} else {
+		redraw();
+		delaySeconds(DELAY_SECONDS);
+	}
+}
+
+void Startup::draw() {
+	Gfx::PicDecoder decoder;
+	Common::File f;
+	auto s = getSurface();
+	s.clear();
+
+	switch (_pageCtr) {
+	case 0:
+		s.writeString(Common::Point(16, 10), "ORIGIN");
+		s.writeString(Common::Point(12, 11), "PROUDLY PRESENTS");
+		break;
+	case 1:
+		s.writeString(Common::Point(16, 8), "PART ][");
+		s.writeString(Common::Point(9, 10), "OF THE #1 BEST SELLING");
+		s.writeString(Common::Point(7, 12), "FANTASY ROLE-PLAYING GAME");
+		s.writeString(Common::Point(12, 14), "BY LORD BRITISH");
+		break;
+	case 2:
+		if (!f.open("PICDRA") || !decoder.loadStream(f))
+			error("Could not load bitmap");
+		s.blitFrom(*decoder.getSurface());
+		break;
+	case 3:
+		showTitle();
+	}
+}
+
+} // namespace Views
+} // namespace Ultima2
+} // namespace Ultima
diff --git a/engines/ultima/ultima2/views/startup.h b/engines/ultima/ultima2/views/startup.h
new file mode 100644
index 00000000000..4f66292801b
--- /dev/null
+++ b/engines/ultima/ultima2/views/startup.h
@@ -0,0 +1,64 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef ULTIMA2_VIEWS_STARTUP_H
+#define ULTIMA2_VIEWS_STARTUP_H
+
+#include "ultima/ultima2/views/view.h"
+
+namespace Ultima {
+namespace Ultima2 {
+namespace Views {
+
+class Startup : public View {
+private:
+	int _pageCtr = 0;
+
+	void showTitle() {
+		replaceView("Title");
+	}
+public:
+	Startup() : View("Startup") {}
+	~Startup() override {}
+
+	void draw() override;
+
+	bool msgFocus(const FocusMessage &msg) override;
+	void timeout() override;
+	bool msgKeypress(const KeypressMessage &msg) override {
+		showTitle();
+		return true;
+	}
+	bool msgMouseDown(const MouseDownMessage &msg) override {
+		showTitle();
+		return true;
+	}
+	bool msgAction(const ActionMessage &msg) override {
+		showTitle();
+		return true;
+	}
+};
+
+} // namespace Views
+} // namespace Ultima2
+} // namespace Ultima
+
+#endif
diff --git a/engines/ultima/ultima2/views/view.cpp b/engines/ultima/ultima2/views/view.cpp
new file mode 100644
index 00000000000..b8d5f7f3258
--- /dev/null
+++ b/engines/ultima/ultima2/views/view.cpp
@@ -0,0 +1,85 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "ultima/ultima2/views/view.h"
+
+namespace Ultima {
+namespace Ultima2 {
+namespace Views {
+
+void View::checkFocusedControl(const Common::Point &mousePos) {
+	if (_focusedElement) {
+		if (!_focusedElement->getBounds().contains(mousePos)) {
+			_focusedElement->send(MouseLeaveMessage());
+			_focusedElement = nullptr;
+		}
+
+	} else {
+		for (UIElement *child : _children) {
+			if (child->getBounds().contains(mousePos)) {
+				_focusedElement = child;
+				child->send(MouseEnterMessage());
+				break;
+			}
+		}
+	}
+}
+
+UIElement *View::getElementAtPos(const Common::Point &pos) const {
+	for (UIElement *child : _children) {
+		if (child->getBounds().contains(pos))
+			return child;
+	}
+
+	return nullptr;
+}
+
+
+bool View::msgFocus(const FocusMessage &msg) {
+	_focusedElement = nullptr;
+	return UIElement::msgFocus(msg);
+}
+
+bool View::msgUnfocus(const UnfocusMessage &msg) {
+	if (_focusedElement)
+		_focusedElement->send(MouseLeaveMessage());
+
+	return UIElement::msgUnfocus(msg);
+}
+
+bool View::msgMouseMove(const MouseMoveMessage &msg) {
+	checkFocusedControl(msg._pos);
+	return true;
+}
+
+bool View::msgMouseDown(const MouseDownMessage &msg) {
+	UIElement *child = getElementAtPos(msg._pos);
+	return child ? child->send(msg) : false;
+}
+
+bool View::msgMouseUp(const MouseUpMessage &msg) {
+	UIElement *child = getElementAtPos(msg._pos);
+	return child ? child->send(msg) : false;
+}
+
+} // namespace Views
+} // namespace Ultima2
+} // namespace Ultima
diff --git a/engines/ultima/ultima2/views/view.h b/engines/ultima/ultima2/views/view.h
new file mode 100644
index 00000000000..b614771c70a
--- /dev/null
+++ b/engines/ultima/ultima2/views/view.h
@@ -0,0 +1,77 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef ULTIMA2_VIEW_H
+#define ULTIMA2_VIEW_H
+
+#include "ultima/ultima2/events.h"
+
+namespace Ultima {
+namespace Ultima2 {
+namespace Views {
+
+/**
+ * Base view class for screens and dialogs that appear on-screen.
+ * The View class takes care of two important things:
+ * 1) By default events get sent to all controls on a view until one
+ * handles it. For mouse events, we instead want only the control the
+ * mouse cursor is over to receive the events, saving the individual
+ * controls from having to check if the mouse is within their bounds.
+ * 2) Individual elements will get a Focus/Unfocus message as the
+ * mouse enters and leaves them. This allows, for example, buttons
+ * that have been pressed to de-select if the mouse leaves their bounds.
+ */
+class View : public UIElement {
+private:
+	UIElement *_focusedElement = nullptr;
+
+	/**
+	 * Checks if a control is entered or left
+	 */
+	void checkFocusedControl(const Common::Point &mousePos);
+
+	/**
+	 * Check for an element at the given position
+	 */
+	UIElement *getElementAtPos(const Common::Point &pos) const;
+
+public:
+	View(const Common::String &name, UIElement *uiParent) :
+		UIElement(name, uiParent) {
+	}
+	View(const Common::String &name) :
+		UIElement(name) {
+	}
+	virtual ~View() {
+	}
+
+	bool msgFocus(const FocusMessage &msg) override;
+	bool msgUnfocus(const UnfocusMessage &msg) override;
+	bool msgMouseMove(const MouseMoveMessage &msg) override;
+	bool msgMouseDown(const MouseDownMessage &msg) override;
+	bool msgMouseUp(const MouseUpMessage &msg) override;
+};
+
+} // namespace Views
+} // namespace Ultima2
+} // namespace Ultima
+
+#endif
diff --git a/engines/ultima/ultima2/views/views.h b/engines/ultima/ultima2/views/views.h
new file mode 100644
index 00000000000..f26cb595a42
--- /dev/null
+++ b/engines/ultima/ultima2/views/views.h
@@ -0,0 +1,39 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef ULTIMA2_VIEWS_H
+#define ULTIMA2_VIEWS_H
+
+#include "ultima/ultima2/views/startup.h"
+
+namespace Ultima {
+namespace Ultima2 {
+namespace Views {
+
+struct Views {
+	Startup _startup;
+};
+
+} // namespace Views
+} // namespace Ultima2
+} // namespace Ultima
+
+#endif


Commit: d0bc327d8b024639e69c2dea108ab315999fb2ff
    https://github.com/scummvm/scummvm/commit/d0bc327d8b024639e69c2dea108ab315999fb2ff
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:40:44+11:00

Commit Message:
ULTIMA: ULTIMA2: Starting new shared/ folder

Previous shared/ which was mainly only for Ultima 1 has been
renamed to u1shared/ for now

Changed paths:
  A engines/ultima/shared/gfx/gfx_surface.cpp
  A engines/ultima/shared/gfx/gfx_surface.h
  A engines/ultima/u1shared/actions/action.cpp
  A engines/ultima/u1shared/actions/action.h
  A engines/ultima/u1shared/actions/huh.cpp
  A engines/ultima/u1shared/actions/huh.h
  A engines/ultima/u1shared/actions/pass.cpp
  A engines/ultima/u1shared/actions/pass.h
  A engines/ultima/u1shared/core/base_object.cpp
  A engines/ultima/u1shared/core/base_object.h
  A engines/ultima/u1shared/core/character.cpp
  A engines/ultima/u1shared/core/character.h
  A engines/ultima/u1shared/core/file.cpp
  A engines/ultima/u1shared/core/file.h
  A engines/ultima/u1shared/core/game_state.h
  A engines/ultima/u1shared/core/lzw.cpp
  A engines/ultima/u1shared/core/lzw.h
  A engines/ultima/u1shared/core/map.cpp
  A engines/ultima/u1shared/core/map.h
  A engines/ultima/u1shared/core/message_target.cpp
  A engines/ultima/u1shared/core/message_target.h
  A engines/ultima/u1shared/core/mouse_cursor.cpp
  A engines/ultima/u1shared/core/mouse_cursor.h
  A engines/ultima/u1shared/core/named_item.cpp
  A engines/ultima/u1shared/core/named_item.h
  A engines/ultima/u1shared/core/party.cpp
  A engines/ultima/u1shared/core/party.h
  A engines/ultima/u1shared/core/rect.h
  A engines/ultima/u1shared/core/str.cpp
  A engines/ultima/u1shared/core/str.h
  A engines/ultima/u1shared/core/tree_item.cpp
  A engines/ultima/u1shared/core/tree_item.h
  A engines/ultima/u1shared/core/utils.cpp
  A engines/ultima/u1shared/core/utils.h
  A engines/ultima/u1shared/core/widgets.cpp
  A engines/ultima/u1shared/core/widgets.h
  A engines/ultima/u1shared/early/font_resources.cpp
  A engines/ultima/u1shared/early/font_resources.h
  A engines/ultima/u1shared/early/game.cpp
  A engines/ultima/u1shared/early/game.h
  A engines/ultima/u1shared/early/game_base.cpp
  A engines/ultima/u1shared/early/game_base.h
  A engines/ultima/u1shared/early/ultima_early.cpp
  A engines/ultima/u1shared/early/ultima_early.h
  A engines/ultima/u1shared/engine/events.cpp
  A engines/ultima/u1shared/engine/events.h
  A engines/ultima/u1shared/engine/input_handler.cpp
  A engines/ultima/u1shared/engine/input_handler.h
  A engines/ultima/u1shared/engine/input_translator.cpp
  A engines/ultima/u1shared/engine/input_translator.h
  A engines/ultima/u1shared/engine/messages.cpp
  A engines/ultima/u1shared/engine/messages.h
  A engines/ultima/u1shared/engine/resources.cpp
  A engines/ultima/u1shared/engine/resources.h
  A engines/ultima/u1shared/gfx/bitmap.cpp
  A engines/ultima/u1shared/gfx/bitmap.h
  A engines/ultima/u1shared/gfx/character_input.cpp
  A engines/ultima/u1shared/gfx/character_input.h
  A engines/ultima/u1shared/gfx/dungeon_surface.cpp
  A engines/ultima/u1shared/gfx/dungeon_surface.h
  A engines/ultima/u1shared/gfx/font.cpp
  A engines/ultima/u1shared/gfx/font.h
  A engines/ultima/u1shared/gfx/info.cpp
  A engines/ultima/u1shared/gfx/info.h
  A engines/ultima/u1shared/gfx/popup.cpp
  A engines/ultima/u1shared/gfx/popup.h
  A engines/ultima/u1shared/gfx/screen.cpp
  A engines/ultima/u1shared/gfx/screen.h
  A engines/ultima/u1shared/gfx/sprites.cpp
  A engines/ultima/u1shared/gfx/sprites.h
  A engines/ultima/u1shared/gfx/text_cursor.cpp
  A engines/ultima/u1shared/gfx/text_cursor.h
  A engines/ultima/u1shared/gfx/text_input.cpp
  A engines/ultima/u1shared/gfx/text_input.h
  A engines/ultima/u1shared/gfx/viewport_dungeon.cpp
  A engines/ultima/u1shared/gfx/viewport_dungeon.h
  A engines/ultima/u1shared/gfx/viewport_map.cpp
  A engines/ultima/u1shared/gfx/viewport_map.h
  A engines/ultima/u1shared/gfx/visual_container.cpp
  A engines/ultima/u1shared/gfx/visual_container.h
  A engines/ultima/u1shared/gfx/visual_item.cpp
  A engines/ultima/u1shared/gfx/visual_item.h
  A engines/ultima/u1shared/gfx/visual_surface.cpp
  A engines/ultima/u1shared/gfx/visual_surface.h
  A engines/ultima/u1shared/maps/creature.cpp
  A engines/ultima/u1shared/maps/creature.h
  A engines/ultima/u1shared/maps/dungeon_creature.h
  A engines/ultima/u1shared/maps/dungeon_widget.h
  A engines/ultima/u1shared/maps/map.cpp
  A engines/ultima/u1shared/maps/map.h
  A engines/ultima/u1shared/maps/map_base.cpp
  A engines/ultima/u1shared/maps/map_base.h
  A engines/ultima/u1shared/maps/map_tile.cpp
  A engines/ultima/u1shared/maps/map_tile.h
  A engines/ultima/u1shared/maps/map_widget.cpp
  A engines/ultima/u1shared/maps/map_widget.h
  R engines/ultima/shared/actions/action.cpp
  R engines/ultima/shared/actions/action.h
  R engines/ultima/shared/actions/huh.cpp
  R engines/ultima/shared/actions/huh.h
  R engines/ultima/shared/actions/pass.cpp
  R engines/ultima/shared/actions/pass.h
  R engines/ultima/shared/core/base_object.cpp
  R engines/ultima/shared/core/base_object.h
  R engines/ultima/shared/core/character.cpp
  R engines/ultima/shared/core/character.h
  R engines/ultima/shared/core/file.cpp
  R engines/ultima/shared/core/file.h
  R engines/ultima/shared/core/game_state.h
  R engines/ultima/shared/core/lzw.cpp
  R engines/ultima/shared/core/lzw.h
  R engines/ultima/shared/core/map.cpp
  R engines/ultima/shared/core/map.h
  R engines/ultima/shared/core/message_target.cpp
  R engines/ultima/shared/core/message_target.h
  R engines/ultima/shared/core/mouse_cursor.cpp
  R engines/ultima/shared/core/mouse_cursor.h
  R engines/ultima/shared/core/named_item.cpp
  R engines/ultima/shared/core/named_item.h
  R engines/ultima/shared/core/party.cpp
  R engines/ultima/shared/core/party.h
  R engines/ultima/shared/core/rect.h
  R engines/ultima/shared/core/str.cpp
  R engines/ultima/shared/core/str.h
  R engines/ultima/shared/core/tree_item.cpp
  R engines/ultima/shared/core/tree_item.h
  R engines/ultima/shared/core/utils.cpp
  R engines/ultima/shared/core/utils.h
  R engines/ultima/shared/core/widgets.cpp
  R engines/ultima/shared/core/widgets.h
  R engines/ultima/shared/early/font_resources.cpp
  R engines/ultima/shared/early/font_resources.h
  R engines/ultima/shared/early/game.cpp
  R engines/ultima/shared/early/game.h
  R engines/ultima/shared/early/game_base.cpp
  R engines/ultima/shared/early/game_base.h
  R engines/ultima/shared/early/ultima_early.cpp
  R engines/ultima/shared/early/ultima_early.h
  R engines/ultima/shared/engine/events.cpp
  R engines/ultima/shared/engine/events.h
  R engines/ultima/shared/engine/input_handler.cpp
  R engines/ultima/shared/engine/input_handler.h
  R engines/ultima/shared/engine/input_translator.cpp
  R engines/ultima/shared/engine/input_translator.h
  R engines/ultima/shared/engine/messages.cpp
  R engines/ultima/shared/engine/messages.h
  R engines/ultima/shared/engine/resources.cpp
  R engines/ultima/shared/engine/resources.h
  R engines/ultima/shared/gfx/bitmap.cpp
  R engines/ultima/shared/gfx/bitmap.h
  R engines/ultima/shared/gfx/character_input.cpp
  R engines/ultima/shared/gfx/character_input.h
  R engines/ultima/shared/gfx/dungeon_surface.cpp
  R engines/ultima/shared/gfx/dungeon_surface.h
  R engines/ultima/shared/gfx/font.cpp
  R engines/ultima/shared/gfx/font.h
  R engines/ultima/shared/gfx/info.cpp
  R engines/ultima/shared/gfx/info.h
  R engines/ultima/shared/gfx/popup.cpp
  R engines/ultima/shared/gfx/popup.h
  R engines/ultima/shared/gfx/screen.cpp
  R engines/ultima/shared/gfx/screen.h
  R engines/ultima/shared/gfx/sprites.cpp
  R engines/ultima/shared/gfx/sprites.h
  R engines/ultima/shared/gfx/text_cursor.cpp
  R engines/ultima/shared/gfx/text_cursor.h
  R engines/ultima/shared/gfx/text_input.cpp
  R engines/ultima/shared/gfx/text_input.h
  R engines/ultima/shared/gfx/viewport_dungeon.cpp
  R engines/ultima/shared/gfx/viewport_dungeon.h
  R engines/ultima/shared/gfx/viewport_map.cpp
  R engines/ultima/shared/gfx/viewport_map.h
  R engines/ultima/shared/gfx/visual_container.cpp
  R engines/ultima/shared/gfx/visual_container.h
  R engines/ultima/shared/gfx/visual_item.cpp
  R engines/ultima/shared/gfx/visual_item.h
  R engines/ultima/shared/gfx/visual_surface.cpp
  R engines/ultima/shared/gfx/visual_surface.h
  R engines/ultima/shared/maps/creature.cpp
  R engines/ultima/shared/maps/creature.h
  R engines/ultima/shared/maps/dungeon_creature.h
  R engines/ultima/shared/maps/dungeon_widget.h
  R engines/ultima/shared/maps/map.cpp
  R engines/ultima/shared/maps/map.h
  R engines/ultima/shared/maps/map_base.cpp
  R engines/ultima/shared/maps/map_base.h
  R engines/ultima/shared/maps/map_tile.cpp
  R engines/ultima/shared/maps/map_tile.h
  R engines/ultima/shared/maps/map_widget.cpp
  R engines/ultima/shared/maps/map_widget.h
  R engines/ultima/ultima2/gfx/gfx_surface.cpp
  R engines/ultima/ultima2/gfx/gfx_surface.h
    engines/ultima/metaengine.cpp
    engines/ultima/module.mk
    engines/ultima/ultima1/actions/action.cpp
    engines/ultima/ultima1/actions/action.h
    engines/ultima/ultima1/actions/attack.h
    engines/ultima/ultima1/actions/cast.cpp
    engines/ultima/ultima1/actions/cast.h
    engines/ultima/ultima1/actions/move.h
    engines/ultima/ultima1/actions/quit.cpp
    engines/ultima/ultima1/actions/quit.h
    engines/ultima/ultima1/actions/ready.h
    engines/ultima/ultima1/actions/stats.h
    engines/ultima/ultima1/core/debugger.cpp
    engines/ultima/ultima1/core/game_state.h
    engines/ultima/ultima1/core/party.h
    engines/ultima/ultima1/core/resources.h
    engines/ultima/ultima1/core/widget_player.h
    engines/ultima/ultima1/game.cpp
    engines/ultima/ultima1/game.h
    engines/ultima/ultima1/maps/map.cpp
    engines/ultima/ultima1/maps/map.h
    engines/ultima/ultima1/maps/map_base.h
    engines/ultima/ultima1/maps/map_dungeon.h
    engines/ultima/ultima1/maps/map_tile.h
    engines/ultima/ultima1/spells/kill_magic_missile.cpp
    engines/ultima/ultima1/spells/kill_magic_missile.h
    engines/ultima/ultima1/spells/spell.h
    engines/ultima/ultima1/u1dialogs/armoury.cpp
    engines/ultima/ultima1/u1dialogs/buy_sell_dialog.cpp
    engines/ultima/ultima1/u1dialogs/buy_sell_dialog.h
    engines/ultima/ultima1/u1dialogs/combat.cpp
    engines/ultima/ultima1/u1dialogs/combat.h
    engines/ultima/ultima1/u1dialogs/dialog.h
    engines/ultima/ultima1/u1dialogs/drop.cpp
    engines/ultima/ultima1/u1dialogs/drop.h
    engines/ultima/ultima1/u1dialogs/grocery.cpp
    engines/ultima/ultima1/u1dialogs/king.cpp
    engines/ultima/ultima1/u1dialogs/king.h
    engines/ultima/ultima1/u1dialogs/magic.cpp
    engines/ultima/ultima1/u1dialogs/ready.cpp
    engines/ultima/ultima1/u1dialogs/stats.cpp
    engines/ultima/ultima1/u1dialogs/tavern.cpp
    engines/ultima/ultima1/u1dialogs/transports.cpp
    engines/ultima/ultima1/u1dialogs/weaponry.cpp
    engines/ultima/ultima1/u1gfx/drawing_support.cpp
    engines/ultima/ultima1/u1gfx/drawing_support.h
    engines/ultima/ultima1/u1gfx/info.cpp
    engines/ultima/ultima1/u1gfx/info.h
    engines/ultima/ultima1/u1gfx/sprites.cpp
    engines/ultima/ultima1/u1gfx/sprites.h
    engines/ultima/ultima1/u1gfx/status.h
    engines/ultima/ultima1/u1gfx/text_cursor.cpp
    engines/ultima/ultima1/u1gfx/text_cursor.h
    engines/ultima/ultima1/u1gfx/view_char_gen.cpp
    engines/ultima/ultima1/u1gfx/view_char_gen.h
    engines/ultima/ultima1/u1gfx/view_game.cpp
    engines/ultima/ultima1/u1gfx/view_game.h
    engines/ultima/ultima1/u1gfx/view_title.cpp
    engines/ultima/ultima1/u1gfx/view_title.h
    engines/ultima/ultima1/u1gfx/viewport_dungeon.cpp
    engines/ultima/ultima1/u1gfx/viewport_dungeon.h
    engines/ultima/ultima1/u1gfx/viewport_map.h
    engines/ultima/ultima1/u6gfx/game_view.cpp
    engines/ultima/ultima1/u6gfx/game_view.h
    engines/ultima/ultima1/widgets/attack_effect.h
    engines/ultima/ultima1/widgets/dungeon_monster.cpp
    engines/ultima/ultima1/widgets/dungeon_monster.h
    engines/ultima/ultima1/widgets/dungeon_player.h
    engines/ultima/ultima1/widgets/dungeon_widget.cpp
    engines/ultima/ultima1/widgets/dungeon_widget.h
    engines/ultima/ultima1/widgets/guard.cpp
    engines/ultima/ultima1/widgets/overworld_monster.cpp
    engines/ultima/ultima1/widgets/overworld_monster.h
    engines/ultima/ultima1/widgets/overworld_widget.cpp
    engines/ultima/ultima1/widgets/overworld_widget.h
    engines/ultima/ultima1/widgets/person.h
    engines/ultima/ultima1/widgets/princess.cpp
    engines/ultima/ultima1/widgets/transport.h
    engines/ultima/ultima1/widgets/urban_widget.h
    engines/ultima/ultima2/events.cpp
    engines/ultima/ultima2/events.h


diff --git a/engines/ultima/metaengine.cpp b/engines/ultima/metaengine.cpp
index ba1f30d3b8f..bf4874265ac 100644
--- a/engines/ultima/metaengine.cpp
+++ b/engines/ultima/metaengine.cpp
@@ -32,7 +32,7 @@
 #include "ultima/ultima0/metaengine.h"
 #endif
 #ifdef ENABLE_ULTIMA1
-#include "ultima/shared/early/ultima_early.h"
+#include "ultima/u1shared/early/ultima_early.h"
 #endif
 #ifdef ENABLE_ULTIMA2
 #include "ultima/ultima2/ultima2.h"
diff --git a/engines/ultima/module.mk b/engines/ultima/module.mk
index 9642cff5737..75049dbc80e 100644
--- a/engines/ultima/module.mk
+++ b/engines/ultima/module.mk
@@ -5,6 +5,11 @@ MODULE_OBJS := \
 	shared/conf/xml_node.o \
 	shared/conf/xml_tree.o
 
+ifdef ENABLE_ULTIMA2
+MODULE_OBJS += \
+	shared/gfx/gfx_surface.o
+endif
+
 ifdef ENABLE_AKALABETH
 MODULE_OBJS += \
 	ultima0/ultima0.o \
@@ -38,51 +43,51 @@ endif
 
 ifdef ENABLE_ULTIMA1
 MODULE_OBJS += \
-	shared/actions/action.o \
-	shared/actions/huh.o \
-	shared/actions/pass.o \
-	shared/core/base_object.o \
-	shared/core/character.o \
-	shared/core/file.o \
-	shared/core/lzw.o \
-	shared/core/map.o \
-	shared/core/message_target.o \
-	shared/core/mouse_cursor.o \
-	shared/core/named_item.o \
-	shared/core/party.o \
-	shared/core/str.o \
-	shared/core/tree_item.o \
-	shared/core/utils.o \
-	shared/core/widgets.o \
-	shared/early/font_resources.o \
-	shared/early/game.o \
-	shared/early/game_base.o \
-	shared/early/ultima_early.o \
-	shared/engine/events.o \
-	shared/engine/input_handler.o \
-	shared/engine/input_translator.o \
-	shared/engine/messages.o \
-	shared/engine/resources.o \
-	shared/gfx/bitmap.o \
-	shared/gfx/character_input.o \
-	shared/gfx/dungeon_surface.o \
-	shared/gfx/font.o \
-	shared/gfx/info.o \
-	shared/gfx/popup.o \
-	shared/gfx/screen.o \
-	shared/gfx/sprites.o \
-	shared/gfx/text_cursor.o \
-	shared/gfx/text_input.o \
-	shared/gfx/viewport_dungeon.o \
-	shared/gfx/viewport_map.o \
-	shared/gfx/visual_container.o \
-	shared/gfx/visual_item.o \
-	shared/gfx/visual_surface.o \
-	shared/maps/map.o \
-	shared/maps/map_base.o \
-	shared/maps/map_tile.o \
-	shared/maps/map_widget.o \
-	shared/maps/creature.o \
+	u1shared/actions/action.o \
+	u1shared/actions/huh.o \
+	u1shared/actions/pass.o \
+	u1shared/core/base_object.o \
+	u1shared/core/character.o \
+	u1shared/core/file.o \
+	u1shared/core/lzw.o \
+	u1shared/core/map.o \
+	u1shared/core/message_target.o \
+	u1shared/core/mouse_cursor.o \
+	u1shared/core/named_item.o \
+	u1shared/core/party.o \
+	u1shared/core/str.o \
+	u1shared/core/tree_item.o \
+	u1shared/core/utils.o \
+	u1shared/core/widgets.o \
+	u1shared/early/font_resources.o \
+	u1shared/early/game.o \
+	u1shared/early/game_base.o \
+	u1shared/early/ultima_early.o \
+	u1shared/engine/events.o \
+	u1shared/engine/input_handler.o \
+	u1shared/engine/input_translator.o \
+	u1shared/engine/messages.o \
+	u1shared/engine/resources.o \
+	u1shared/gfx/bitmap.o \
+	u1shared/gfx/character_input.o \
+	u1shared/gfx/dungeon_surface.o \
+	u1shared/gfx/font.o \
+	u1shared/gfx/info.o \
+	u1shared/gfx/popup.o \
+	u1shared/gfx/screen.o \
+	u1shared/gfx/sprites.o \
+	u1shared/gfx/text_cursor.o \
+	u1shared/gfx/text_input.o \
+	u1shared/gfx/viewport_dungeon.o \
+	u1shared/gfx/viewport_map.o \
+	u1shared/gfx/visual_container.o \
+	u1shared/gfx/visual_item.o \
+	u1shared/gfx/visual_surface.o \
+	u1shared/maps/map.o \
+	u1shared/maps/map_base.o \
+	u1shared/maps/map_tile.o \
+	u1shared/maps/map_widget.o \
+	u1shared/maps/creature.o \
 	ultima1/actions/action.o \
 	ultima1/actions/attack.o \
 	ultima1/actions/move.o \
@@ -169,7 +174,6 @@ MODULE_OBJS += \
 	ultima2/events.o \
 	ultima2/messages.o \
 	ultima2/metaengine.o \
-	ultima2/gfx/gfx_surface.o \
 	ultima2/gfx/pic_decoder.o \
 	ultima2/views/view.o \
 	ultima2/views/startup.o
diff --git a/engines/ultima/ultima2/gfx/gfx_surface.cpp b/engines/ultima/shared/gfx/gfx_surface.cpp
similarity index 78%
rename from engines/ultima/ultima2/gfx/gfx_surface.cpp
rename to engines/ultima/shared/gfx/gfx_surface.cpp
index 0e37f1a1772..c6227d01c01 100644
--- a/engines/ultima/ultima2/gfx/gfx_surface.cpp
+++ b/engines/ultima/shared/gfx/gfx_surface.cpp
@@ -19,11 +19,10 @@
  *
  */
 
-#include "ultima/ultima2/gfx/gfx_surface.h"
-#include "ultima/ultima2/ultima2.h"
+#include "ultima/shared/gfx/gfx_surface.h"
 
 namespace Ultima {
-namespace Ultima2 {
+namespace Shared {
 namespace Gfx {
 
 void GfxSurface::writeString(const Common::Point &pt, const Common::String &str,
@@ -62,11 +61,13 @@ void GfxSurface::writeString(const Common::String &str, Graphics::TextAlign alig
 }
 
 void GfxSurface::writeChar(uint32 chr) {
+	int textW = this->w / _font.getMaxCharWidth();
+
 	if (chr >= ' ') {
 		// TODO
 	}
 
-	if (_textPos.x >= TEXT_WIDTH || chr == '\n') {
+	if (_textPos.x >= textW || chr == '\n') {
 		newLine();
 	}
 }
@@ -75,15 +76,14 @@ void GfxSurface::newLine() {
 	_textPos.x = 0;
 	_textPos.y++;
 
-	if (_textPos.y >= TEXT_HEIGHT) {
-#if 0
-		_textPos.y = TEXT_HEIGHT - 1;
+	const int fontH = _font.getFontHeight();
+	const int textH = fontH / _font.getFontHeight();
+	if (_textPos.y >= textH) {
+		_textPos.y = textH - 1;
 
 		// Scroll the screen contents up
-		blitFrom(*this, Common::Rect(0, GLYPH_HEIGHT, DEFAULT_SCX, DEFAULT_SCY),
-			Common::Point(0, 0));
-		fillRect(Common::Rect(0, DEFAULT_SCX - GLYPH_HEIGHT, DEFAULT_SCX, DEFAULT_SCY), 0);
-#endif
+		blitFrom(*this, Common::Rect(0, fontH, this->w, this->h), Common::Point(0, 0));
+		fillRect(Common::Rect(0, this->h - fontH, this->w, this->h), 0);
 	}
 }
 
@@ -97,12 +97,6 @@ byte GfxSurface::setColor(byte color) {
 	return oldColor;
 }
 
-byte GfxSurface::setColor(byte r, byte g, byte b) {
-	byte oldColor = _textColor;
-	_textColor = g_engine->_palette.findBestColor(r, g, b);
-	return oldColor;
-}
-
 } // namespace Gfx
-} // namespace Ultima2
+} // namespace Shared
 } // namespace Ultima
diff --git a/engines/ultima/ultima2/gfx/gfx_surface.h b/engines/ultima/shared/gfx/gfx_surface.h
similarity index 89%
rename from engines/ultima/ultima2/gfx/gfx_surface.h
rename to engines/ultima/shared/gfx/gfx_surface.h
index f692914e99d..594bf43679b 100644
--- a/engines/ultima/ultima2/gfx/gfx_surface.h
+++ b/engines/ultima/shared/gfx/gfx_surface.h
@@ -19,14 +19,15 @@
  *
  */
 
-#ifndef ULTIMA2_GFX_SURFACE_H
-#define ULTIMA2_GFX_SURFACE_H
+#ifndef ULTIMA_SHARED_GFX_SURFACE_H
+#define ULTIMA_SHARED_GFX_SURFACE_H
 
-#include "graphics/font.h"
+#include "common/rect.h"
+#include "graphics/fonts/dosfont.h"
 #include "graphics/managed_surface.h"
 
 namespace Ultima {
-namespace Ultima2 {
+namespace Shared {
 namespace Gfx {
 
 constexpr int TEXT_WIDTH = 40;
@@ -34,6 +35,7 @@ constexpr int TEXT_HEIGHT = 25;
 
 class GfxSurface : public Graphics::ManagedSurface {
 private:
+	Graphics::DosFont _font;
 	Common::Point _textPos;
 	byte _textColor = 255;
 
@@ -53,11 +55,10 @@ public:
 
 	void setTextPos(const Common::Point &pt);
 	byte setColor(byte color);
-	byte setColor(byte r, byte g, byte b);
 };
 
 } // namespace Gfx
-} // namespace Ultima2
+} // namespace Shared
 } // namespace Ultima
 
 #endif
diff --git a/engines/ultima/shared/actions/action.cpp b/engines/ultima/u1shared/actions/action.cpp
similarity index 88%
rename from engines/ultima/shared/actions/action.cpp
rename to engines/ultima/u1shared/actions/action.cpp
index 447226b54f3..23a6b111bf9 100644
--- a/engines/ultima/shared/actions/action.cpp
+++ b/engines/ultima/u1shared/actions/action.cpp
@@ -19,11 +19,11 @@
  *
  */
 
-#include "ultima/shared/actions/action.h"
-#include "ultima/shared/early/game.h"
-#include "ultima/shared/maps/map.h"
-#include "ultima/shared/gfx/visual_item.h"
-#include "ultima/shared/engine/messages.h"
+#include "ultima/u1shared/actions/action.h"
+#include "ultima/u1shared/early/game.h"
+#include "ultima/u1shared/maps/map.h"
+#include "ultima/u1shared/gfx/visual_item.h"
+#include "ultima/u1shared/engine/messages.h"
 
 namespace Ultima {
 namespace Shared {
diff --git a/engines/ultima/shared/actions/action.h b/engines/ultima/u1shared/actions/action.h
similarity index 97%
rename from engines/ultima/shared/actions/action.h
rename to engines/ultima/u1shared/actions/action.h
index 81af152148a..264ae5a3213 100644
--- a/engines/ultima/shared/actions/action.h
+++ b/engines/ultima/u1shared/actions/action.h
@@ -22,7 +22,7 @@
 #ifndef ULTIMA_SHARED_ACTIONS_ACTION_H
 #define ULTIMA_SHARED_ACTIONS_ACTION_H
 
-#include "ultima/shared/core/tree_item.h"
+#include "ultima/u1shared/core/tree_item.h"
 
 namespace Ultima {
 namespace Shared {
diff --git a/engines/ultima/shared/actions/huh.cpp b/engines/ultima/u1shared/actions/huh.cpp
similarity index 96%
rename from engines/ultima/shared/actions/huh.cpp
rename to engines/ultima/u1shared/actions/huh.cpp
index 5bd7deaf444..35ef69a8033 100644
--- a/engines/ultima/shared/actions/huh.cpp
+++ b/engines/ultima/u1shared/actions/huh.cpp
@@ -19,7 +19,7 @@
  *
  */
 
-#include "ultima/shared/actions/huh.h"
+#include "ultima/u1shared/actions/huh.h"
 
 namespace Ultima {
 namespace Shared {
diff --git a/engines/ultima/shared/actions/huh.h b/engines/ultima/u1shared/actions/huh.h
similarity index 93%
rename from engines/ultima/shared/actions/huh.h
rename to engines/ultima/u1shared/actions/huh.h
index 23a4ec30a3f..2507f144aaa 100644
--- a/engines/ultima/shared/actions/huh.h
+++ b/engines/ultima/u1shared/actions/huh.h
@@ -22,8 +22,8 @@
 #ifndef ULTIMA_SHARED_ACTIONS_HUH_H
 #define ULTIMA_SHARED_ACTIONS_HUH_H
 
-#include "ultima/shared/actions/action.h"
-#include "ultima/shared/engine/messages.h"
+#include "ultima/u1shared/actions/action.h"
+#include "ultima/u1shared/engine/messages.h"
 
 namespace Ultima {
 namespace Shared {
diff --git a/engines/ultima/shared/actions/pass.cpp b/engines/ultima/u1shared/actions/pass.cpp
similarity index 96%
rename from engines/ultima/shared/actions/pass.cpp
rename to engines/ultima/u1shared/actions/pass.cpp
index fadd6c8557e..ecc8f395531 100644
--- a/engines/ultima/shared/actions/pass.cpp
+++ b/engines/ultima/u1shared/actions/pass.cpp
@@ -19,7 +19,7 @@
  *
  */
 
-#include "ultima/shared/actions/pass.h"
+#include "ultima/u1shared/actions/pass.h"
 
 namespace Ultima {
 namespace Shared {
diff --git a/engines/ultima/shared/actions/pass.h b/engines/ultima/u1shared/actions/pass.h
similarity index 93%
rename from engines/ultima/shared/actions/pass.h
rename to engines/ultima/u1shared/actions/pass.h
index a4607faafb1..31fc0a8993f 100644
--- a/engines/ultima/shared/actions/pass.h
+++ b/engines/ultima/u1shared/actions/pass.h
@@ -22,8 +22,8 @@
 #ifndef ULTIMA_SHARED_ACTIONS_PASS_H
 #define ULTIMA_SHARED_ACTIONS_PASS_H
 
-#include "ultima/shared/actions/action.h"
-#include "ultima/shared/engine/messages.h"
+#include "ultima/u1shared/actions/action.h"
+#include "ultima/u1shared/engine/messages.h"
 
 namespace Ultima {
 namespace Shared {
diff --git a/engines/ultima/shared/core/base_object.cpp b/engines/ultima/u1shared/core/base_object.cpp
similarity index 90%
rename from engines/ultima/shared/core/base_object.cpp
rename to engines/ultima/u1shared/core/base_object.cpp
index bb8bd91505f..eba505e63bf 100644
--- a/engines/ultima/shared/core/base_object.cpp
+++ b/engines/ultima/u1shared/core/base_object.cpp
@@ -19,9 +19,9 @@
  *
  */
 
-#include "ultima/shared/core/base_object.h"
-#include "ultima/shared/core/tree_item.h"
-#include "ultima/shared/core/named_item.h"
+#include "ultima/u1shared/core/base_object.h"
+#include "ultima/u1shared/core/tree_item.h"
+#include "ultima/u1shared/core/named_item.h"
 
 namespace Ultima {
 namespace Shared {
diff --git a/engines/ultima/shared/core/base_object.h b/engines/ultima/u1shared/core/base_object.h
similarity index 98%
rename from engines/ultima/shared/core/base_object.h
rename to engines/ultima/u1shared/core/base_object.h
index 127cf118f5c..643382d3600 100644
--- a/engines/ultima/shared/core/base_object.h
+++ b/engines/ultima/u1shared/core/base_object.h
@@ -26,7 +26,7 @@
 #include "common/array.h"
 #include "common/hash-str.h"
 #include "common/list.h"
-#include "ultima/shared/core/file.h"
+#include "ultima/u1shared/core/file.h"
 
 namespace Ultima {
 namespace Shared {
diff --git a/engines/ultima/shared/core/character.cpp b/engines/ultima/u1shared/core/character.cpp
similarity index 97%
rename from engines/ultima/shared/core/character.cpp
rename to engines/ultima/u1shared/core/character.cpp
index 9291aeb7e96..e6f5b78c53c 100644
--- a/engines/ultima/shared/core/character.cpp
+++ b/engines/ultima/u1shared/core/character.cpp
@@ -19,7 +19,7 @@
  *
  */
 
-#include "ultima/shared/core/party.h"
+#include "ultima/u1shared/core/party.h"
 
 namespace Ultima {
 namespace Shared {
diff --git a/engines/ultima/shared/core/character.h b/engines/ultima/u1shared/core/character.h
similarity index 99%
rename from engines/ultima/shared/core/character.h
rename to engines/ultima/u1shared/core/character.h
index 27a1a93826e..87b9a415dbc 100644
--- a/engines/ultima/shared/core/character.h
+++ b/engines/ultima/u1shared/core/character.h
@@ -25,7 +25,7 @@
 #include "common/array.h"
 #include "common/str.h"
 #include "common/serializer.h"
-#include "ultima/shared/core/named_item.h"
+#include "ultima/u1shared/core/named_item.h"
 
 namespace Ultima {
 namespace Shared {
diff --git a/engines/ultima/shared/core/file.cpp b/engines/ultima/u1shared/core/file.cpp
similarity index 95%
rename from engines/ultima/shared/core/file.cpp
rename to engines/ultima/u1shared/core/file.cpp
index e1a8aa5b7e1..cbcdc92c671 100644
--- a/engines/ultima/shared/core/file.cpp
+++ b/engines/ultima/u1shared/core/file.cpp
@@ -20,8 +20,8 @@
  */
 
 #include "common/util.h"
-#include "ultima/shared/core/file.h"
-#include "ultima/shared/early/ultima_early.h"
+#include "ultima/u1shared/core/file.h"
+#include "ultima/u1shared/early/ultima_early.h"
 
 namespace Ultima {
 namespace Shared {
diff --git a/engines/ultima/shared/core/file.h b/engines/ultima/u1shared/core/file.h
similarity index 100%
rename from engines/ultima/shared/core/file.h
rename to engines/ultima/u1shared/core/file.h
diff --git a/engines/ultima/shared/core/game_state.h b/engines/ultima/u1shared/core/game_state.h
similarity index 95%
rename from engines/ultima/shared/core/game_state.h
rename to engines/ultima/u1shared/core/game_state.h
index cc544dcc707..0a28b09e6ec 100644
--- a/engines/ultima/shared/core/game_state.h
+++ b/engines/ultima/u1shared/core/game_state.h
@@ -22,9 +22,9 @@
 #ifndef ULTIMA_SHARED_CORE_GAME_STATE_H
 #define ULTIMA_SHARED_CORE_GAME_STATE_H
 
-#include "ultima/shared/core/rect.h"
-#include "ultima/shared/core/character.h"
-#include "ultima/shared/core/map.h"
+#include "ultima/u1shared/core/rect.h"
+#include "ultima/u1shared/core/character.h"
+#include "ultima/u1shared/core/map.h"
 
 namespace Ultima {
 namespace Shared {
diff --git a/engines/ultima/shared/core/lzw.cpp b/engines/ultima/u1shared/core/lzw.cpp
similarity index 98%
rename from engines/ultima/shared/core/lzw.cpp
rename to engines/ultima/u1shared/core/lzw.cpp
index b983145b590..68ee3cbb911 100644
--- a/engines/ultima/shared/core/lzw.cpp
+++ b/engines/ultima/u1shared/core/lzw.cpp
@@ -21,7 +21,7 @@
 
 #include "common/endian.h"
 #include "common/util.h"
-#include "ultima/shared/core/lzw.h"
+#include "ultima/u1shared/core/lzw.h"
 
 namespace Ultima {
 namespace Shared {
diff --git a/engines/ultima/shared/core/lzw.h b/engines/ultima/u1shared/core/lzw.h
similarity index 100%
rename from engines/ultima/shared/core/lzw.h
rename to engines/ultima/u1shared/core/lzw.h
diff --git a/engines/ultima/shared/core/map.cpp b/engines/ultima/u1shared/core/map.cpp
similarity index 98%
rename from engines/ultima/shared/core/map.cpp
rename to engines/ultima/u1shared/core/map.cpp
index 38a7df6eac2..13b2dc40065 100644
--- a/engines/ultima/shared/core/map.cpp
+++ b/engines/ultima/u1shared/core/map.cpp
@@ -19,9 +19,9 @@
  *
  */
 
-#include "ultima/shared/core/map.h"
-#include "ultima/shared/early/game.h"
-#include "ultima/shared/gfx/visual_item.h"
+#include "ultima/u1shared/core/map.h"
+#include "ultima/u1shared/early/game.h"
+#include "ultima/u1shared/gfx/visual_item.h"
 
 namespace Ultima {
 namespace Shared {
diff --git a/engines/ultima/shared/core/map.h b/engines/ultima/u1shared/core/map.h
similarity index 99%
rename from engines/ultima/shared/core/map.h
rename to engines/ultima/u1shared/core/map.h
index 1f22b8a77c2..bbb8885852e 100644
--- a/engines/ultima/shared/core/map.h
+++ b/engines/ultima/u1shared/core/map.h
@@ -25,8 +25,8 @@
 #include "common/array.h"
 #include "common/ptr.h"
 #include "common/serializer.h"
-#include "ultima/shared/core/rect.h"
-#include "ultima/shared/gfx/dungeon_surface.h"
+#include "ultima/u1shared/core/rect.h"
+#include "ultima/u1shared/gfx/dungeon_surface.h"
 
 namespace Ultima {
 namespace Shared {
diff --git a/engines/ultima/shared/core/message_target.cpp b/engines/ultima/u1shared/core/message_target.cpp
similarity index 96%
rename from engines/ultima/shared/core/message_target.cpp
rename to engines/ultima/u1shared/core/message_target.cpp
index e98015b7e9d..4dc1fe9dfd5 100644
--- a/engines/ultima/shared/core/message_target.cpp
+++ b/engines/ultima/u1shared/core/message_target.cpp
@@ -19,7 +19,7 @@
  *
  */
 
-#include "ultima/shared/core/message_target.h"
+#include "ultima/u1shared/core/message_target.h"
 
 namespace Ultima {
 namespace Shared {
diff --git a/engines/ultima/shared/core/message_target.h b/engines/ultima/u1shared/core/message_target.h
similarity index 98%
rename from engines/ultima/shared/core/message_target.h
rename to engines/ultima/u1shared/core/message_target.h
index 7015df962e0..c6e35b7ec09 100644
--- a/engines/ultima/shared/core/message_target.h
+++ b/engines/ultima/u1shared/core/message_target.h
@@ -22,7 +22,7 @@
 #ifndef ULTIMA_SHARED_CORE_MESSAGE_TARGET_H
 #define ULTIMA_SHARED_CORE_MESSAGE_TARGET_H
 
-#include "ultima/shared/core/base_object.h"
+#include "ultima/u1shared/core/base_object.h"
 
 namespace Ultima {
 namespace Shared {
diff --git a/engines/ultima/shared/core/mouse_cursor.cpp b/engines/ultima/u1shared/core/mouse_cursor.cpp
similarity index 95%
rename from engines/ultima/shared/core/mouse_cursor.cpp
rename to engines/ultima/u1shared/core/mouse_cursor.cpp
index 41fb3605f35..168d2f6e9a9 100644
--- a/engines/ultima/shared/core/mouse_cursor.cpp
+++ b/engines/ultima/u1shared/core/mouse_cursor.cpp
@@ -21,9 +21,9 @@
 
 #include "graphics/cursorman.h"
 #include "graphics/managed_surface.h"
-#include "ultima/shared/core/mouse_cursor.h"
-#include "ultima/shared/core/file.h"
-#include "ultima/shared/early/ultima_early.h"
+#include "ultima/u1shared/core/mouse_cursor.h"
+#include "ultima/u1shared/core/file.h"
+#include "ultima/u1shared/early/ultima_early.h"
 
 namespace Ultima {
 namespace Shared {
diff --git a/engines/ultima/shared/core/mouse_cursor.h b/engines/ultima/u1shared/core/mouse_cursor.h
similarity index 98%
rename from engines/ultima/shared/core/mouse_cursor.h
rename to engines/ultima/u1shared/core/mouse_cursor.h
index 3541c5786ad..746e47556c3 100644
--- a/engines/ultima/shared/core/mouse_cursor.h
+++ b/engines/ultima/u1shared/core/mouse_cursor.h
@@ -23,7 +23,7 @@
 #define ULTIMA_SHARED_CORE_MOUSE_CURSOR_H
 
 #include "common/scummsys.h"
-#include "ultima/shared/core/rect.h"
+#include "ultima/u1shared/core/rect.h"
 #include "common/stream.h"
 
 namespace Ultima {
diff --git a/engines/ultima/shared/core/named_item.cpp b/engines/ultima/u1shared/core/named_item.cpp
similarity index 95%
rename from engines/ultima/shared/core/named_item.cpp
rename to engines/ultima/u1shared/core/named_item.cpp
index 5ad5df996ce..c984d3ebafc 100644
--- a/engines/ultima/shared/core/named_item.cpp
+++ b/engines/ultima/u1shared/core/named_item.cpp
@@ -19,7 +19,7 @@
  *
  */
 
-#include "ultima/shared/core/named_item.h"
+#include "ultima/u1shared/core/named_item.h"
 
 namespace Ultima {
 namespace Shared {
diff --git a/engines/ultima/shared/core/named_item.h b/engines/ultima/u1shared/core/named_item.h
similarity index 97%
rename from engines/ultima/shared/core/named_item.h
rename to engines/ultima/u1shared/core/named_item.h
index 003145fb5a2..99fe090993d 100644
--- a/engines/ultima/shared/core/named_item.h
+++ b/engines/ultima/u1shared/core/named_item.h
@@ -22,7 +22,7 @@
 #ifndef ULTIMA_SHARED_CORE_NAMED_ITEM_H
 #define ULTIMA_SHARED_CORE_NAMED_ITEM_H
 
-#include "ultima/shared/core/tree_item.h"
+#include "ultima/u1shared/core/tree_item.h"
 
 namespace Ultima {
 namespace Shared {
diff --git a/engines/ultima/shared/core/party.cpp b/engines/ultima/u1shared/core/party.cpp
similarity index 97%
rename from engines/ultima/shared/core/party.cpp
rename to engines/ultima/u1shared/core/party.cpp
index 744a9b620f6..91f043cb080 100644
--- a/engines/ultima/shared/core/party.cpp
+++ b/engines/ultima/u1shared/core/party.cpp
@@ -19,7 +19,7 @@
  *
  */
 
-#include "ultima/shared/core/party.h"
+#include "ultima/u1shared/core/party.h"
 
 namespace Ultima {
 namespace Shared {
diff --git a/engines/ultima/shared/core/party.h b/engines/ultima/u1shared/core/party.h
similarity index 97%
rename from engines/ultima/shared/core/party.h
rename to engines/ultima/u1shared/core/party.h
index ca7e78c7f9a..a0c06ff39b2 100644
--- a/engines/ultima/shared/core/party.h
+++ b/engines/ultima/u1shared/core/party.h
@@ -25,7 +25,7 @@
 #include "common/array.h"
 #include "common/str.h"
 #include "common/serializer.h"
-#include "ultima/shared/core/character.h"
+#include "ultima/u1shared/core/character.h"
 
 namespace Ultima {
 namespace Shared {
diff --git a/engines/ultima/shared/core/rect.h b/engines/ultima/u1shared/core/rect.h
similarity index 100%
rename from engines/ultima/shared/core/rect.h
rename to engines/ultima/u1shared/core/rect.h
diff --git a/engines/ultima/shared/core/str.cpp b/engines/ultima/u1shared/core/str.cpp
similarity index 97%
rename from engines/ultima/shared/core/str.cpp
rename to engines/ultima/u1shared/core/str.cpp
index 81f0cf9d39d..3ea930ea5a0 100644
--- a/engines/ultima/shared/core/str.cpp
+++ b/engines/ultima/u1shared/core/str.cpp
@@ -19,7 +19,7 @@
  *
  */
 
-#include "ultima/shared/core/str.h"
+#include "ultima/u1shared/core/str.h"
 
 namespace Ultima {
 namespace Shared {
diff --git a/engines/ultima/shared/core/str.h b/engines/ultima/u1shared/core/str.h
similarity index 100%
rename from engines/ultima/shared/core/str.h
rename to engines/ultima/u1shared/core/str.h
diff --git a/engines/ultima/shared/core/tree_item.cpp b/engines/ultima/u1shared/core/tree_item.cpp
similarity index 96%
rename from engines/ultima/shared/core/tree_item.cpp
rename to engines/ultima/u1shared/core/tree_item.cpp
index 2fb15122abe..25e5e1a70ad 100644
--- a/engines/ultima/shared/core/tree_item.cpp
+++ b/engines/ultima/u1shared/core/tree_item.cpp
@@ -19,10 +19,10 @@
  *
  */
 
-#include "ultima/shared/core/tree_item.h"
-#include "ultima/shared/core/named_item.h"
-#include "ultima/shared/early/game.h"
-#include "ultima/shared/early/game_base.h"
+#include "ultima/u1shared/core/tree_item.h"
+#include "ultima/u1shared/core/named_item.h"
+#include "ultima/u1shared/early/game.h"
+#include "ultima/u1shared/early/game_base.h"
 
 namespace Ultima {
 namespace Shared {
diff --git a/engines/ultima/shared/core/tree_item.h b/engines/ultima/u1shared/core/tree_item.h
similarity index 98%
rename from engines/ultima/shared/core/tree_item.h
rename to engines/ultima/u1shared/core/tree_item.h
index 72578cbdbe3..0d80a36c6a2 100644
--- a/engines/ultima/shared/core/tree_item.h
+++ b/engines/ultima/u1shared/core/tree_item.h
@@ -22,7 +22,7 @@
 #ifndef ULTIMA_SHARED_CORE_TREE_ITEM_H
 #define ULTIMA_SHARED_CORE_TREE_ITEM_H
 
-#include "ultima/shared/core/message_target.h"
+#include "ultima/u1shared/core/message_target.h"
 
 namespace Ultima {
 namespace Shared {
diff --git a/engines/ultima/shared/core/utils.cpp b/engines/ultima/u1shared/core/utils.cpp
similarity index 96%
rename from engines/ultima/shared/core/utils.cpp
rename to engines/ultima/u1shared/core/utils.cpp
index c99f18cd468..c84e28afff7 100644
--- a/engines/ultima/shared/core/utils.cpp
+++ b/engines/ultima/u1shared/core/utils.cpp
@@ -19,7 +19,7 @@
  *
  */
 
-#include "ultima/shared/core/utils.h"
+#include "ultima/u1shared/core/utils.h"
 #include "common/scummsys.h"
 
 namespace Ultima {
diff --git a/engines/ultima/shared/core/utils.h b/engines/ultima/u1shared/core/utils.h
similarity index 100%
rename from engines/ultima/shared/core/utils.h
rename to engines/ultima/u1shared/core/utils.h
diff --git a/engines/ultima/shared/core/widgets.cpp b/engines/ultima/u1shared/core/widgets.cpp
similarity index 94%
rename from engines/ultima/shared/core/widgets.cpp
rename to engines/ultima/u1shared/core/widgets.cpp
index f1ead524b26..899f915ba90 100644
--- a/engines/ultima/shared/core/widgets.cpp
+++ b/engines/ultima/u1shared/core/widgets.cpp
@@ -19,8 +19,8 @@
  *
  */
 
-#include "ultima/shared/core/widgets.h"
-#include "ultima/shared/early/game.h"
+#include "ultima/u1shared/core/widgets.h"
+#include "ultima/u1shared/early/game.h"
 
 namespace Ultima {
 namespace Shared {
diff --git a/engines/ultima/shared/core/widgets.h b/engines/ultima/u1shared/core/widgets.h
similarity index 97%
rename from engines/ultima/shared/core/widgets.h
rename to engines/ultima/u1shared/core/widgets.h
index 7ab35a83520..ac4d6dc190f 100644
--- a/engines/ultima/shared/core/widgets.h
+++ b/engines/ultima/u1shared/core/widgets.h
@@ -22,8 +22,8 @@
 #ifndef ULTIMA_SHARED_CORE_WIDGETS_H
 #define ULTIMA_SHARED_CORE_WIDGETS_H
 
-#include "ultima/shared/core/map.h"
-#include "ultima/shared/gfx/dungeon_surface.h"
+#include "ultima/u1shared/core/map.h"
+#include "ultima/u1shared/gfx/dungeon_surface.h"
 
 namespace Ultima {
 namespace Shared {
diff --git a/engines/ultima/shared/early/font_resources.cpp b/engines/ultima/u1shared/early/font_resources.cpp
similarity index 99%
rename from engines/ultima/shared/early/font_resources.cpp
rename to engines/ultima/u1shared/early/font_resources.cpp
index d75fd1f65d9..a696d8b7821 100644
--- a/engines/ultima/shared/early/font_resources.cpp
+++ b/engines/ultima/u1shared/early/font_resources.cpp
@@ -19,7 +19,7 @@
  *
  */
 
-#include "ultima/shared/early/font_resources.h"
+#include "ultima/u1shared/early/font_resources.h"
 #include "common/algorithm.h"
 
 namespace Ultima {
diff --git a/engines/ultima/shared/early/font_resources.h b/engines/ultima/u1shared/early/font_resources.h
similarity index 94%
rename from engines/ultima/shared/early/font_resources.h
rename to engines/ultima/u1shared/early/font_resources.h
index 5bfe291b4ce..b3f5929b639 100644
--- a/engines/ultima/shared/early/font_resources.h
+++ b/engines/ultima/u1shared/early/font_resources.h
@@ -22,8 +22,8 @@
 #ifndef ULTIMA_SHARED_EARLY_FONT_RESOURCES_H
 #define ULTIMA_SHARED_EARLY_FONT_RESOURCES_H
 
-#include "ultima/shared/engine/resources.h"
-#include "ultima/shared/core/file.h"
+#include "ultima/u1shared/engine/resources.h"
+#include "ultima/u1shared/core/file.h"
 #include "common/memstream.h"
 
 namespace Ultima {
diff --git a/engines/ultima/shared/early/game.cpp b/engines/ultima/u1shared/early/game.cpp
similarity index 93%
rename from engines/ultima/shared/early/game.cpp
rename to engines/ultima/u1shared/early/game.cpp
index 32b9f718c42..cfe9b7a7bf9 100644
--- a/engines/ultima/shared/early/game.cpp
+++ b/engines/ultima/u1shared/early/game.cpp
@@ -19,12 +19,12 @@
  *
  */
 
-#include "ultima/shared/early/game.h"
-#include "ultima/shared/early/font_resources.h"
-#include "ultima/shared/maps/map.h"
-#include "ultima/shared/early/ultima_early.h"
-#include "ultima/shared/gfx/font.h"
-#include "ultima/shared/gfx/screen.h"
+#include "ultima/u1shared/early/game.h"
+#include "ultima/u1shared/early/font_resources.h"
+#include "ultima/u1shared/maps/map.h"
+#include "ultima/u1shared/early/ultima_early.h"
+#include "ultima/u1shared/gfx/font.h"
+#include "ultima/u1shared/gfx/screen.h"
 #include "graphics/palette.h"
 
 namespace Ultima {
diff --git a/engines/ultima/shared/early/game.h b/engines/ultima/u1shared/early/game.h
similarity index 96%
rename from engines/ultima/shared/early/game.h
rename to engines/ultima/u1shared/early/game.h
index e6fd09cae1b..620db0f534a 100644
--- a/engines/ultima/shared/early/game.h
+++ b/engines/ultima/u1shared/early/game.h
@@ -22,8 +22,8 @@
 #ifndef ULTIMA_SHARED_EARLY_GAME_H
 #define ULTIMA_SHARED_EARLY_GAME_H
 
-#include "ultima/shared/early/game_base.h"
-#include "ultima/shared/core/party.h"
+#include "ultima/u1shared/early/game_base.h"
+#include "ultima/u1shared/core/party.h"
 
 namespace Ultima {
 namespace Shared {
diff --git a/engines/ultima/shared/early/game_base.cpp b/engines/ultima/u1shared/early/game_base.cpp
similarity index 94%
rename from engines/ultima/shared/early/game_base.cpp
rename to engines/ultima/u1shared/early/game_base.cpp
index c309fcaa04f..5a7429183bb 100644
--- a/engines/ultima/shared/early/game_base.cpp
+++ b/engines/ultima/u1shared/early/game_base.cpp
@@ -21,14 +21,14 @@
 
 #include "common/config-manager.h"
 #include "common/system.h"
-#include "ultima/shared/early/ultima_early.h"
-#include "ultima/shared/early/game_base.h"
-#include "ultima/shared/engine/messages.h"
-#include "ultima/shared/core/mouse_cursor.h"
-#include "ultima/shared/gfx/font.h"
-#include "ultima/shared/gfx/text_cursor.h"
-#include "ultima/shared/gfx/text_input.h"
-#include "ultima/shared/gfx/visual_container.h"
+#include "ultima/u1shared/early/ultima_early.h"
+#include "ultima/u1shared/early/game_base.h"
+#include "ultima/u1shared/engine/messages.h"
+#include "ultima/u1shared/core/mouse_cursor.h"
+#include "ultima/u1shared/gfx/font.h"
+#include "ultima/u1shared/gfx/text_cursor.h"
+#include "ultima/u1shared/gfx/text_input.h"
+#include "ultima/u1shared/gfx/visual_container.h"
 
 namespace Ultima {
 namespace Shared {
diff --git a/engines/ultima/shared/early/game_base.h b/engines/ultima/u1shared/early/game_base.h
similarity index 96%
rename from engines/ultima/shared/early/game_base.h
rename to engines/ultima/u1shared/early/game_base.h
index 49f9e04a214..b3284c5ea97 100644
--- a/engines/ultima/shared/early/game_base.h
+++ b/engines/ultima/u1shared/early/game_base.h
@@ -25,9 +25,9 @@
 #include "common/scummsys.h"
 #include "common/array.h"
 #include "common/serializer.h"
-#include "ultima/shared/engine/events.h"
-#include "ultima/shared/engine/input_handler.h"
-#include "ultima/shared/engine/input_translator.h"
+#include "ultima/u1shared/engine/events.h"
+#include "ultima/u1shared/engine/input_handler.h"
+#include "ultima/u1shared/engine/input_translator.h"
 
 namespace Ultima {
 namespace Shared {
diff --git a/engines/ultima/shared/early/ultima_early.cpp b/engines/ultima/u1shared/early/ultima_early.cpp
similarity index 94%
rename from engines/ultima/shared/early/ultima_early.cpp
rename to engines/ultima/u1shared/early/ultima_early.cpp
index 7c927387105..50766e35ca9 100644
--- a/engines/ultima/shared/early/ultima_early.cpp
+++ b/engines/ultima/u1shared/early/ultima_early.cpp
@@ -27,12 +27,12 @@
 #include "graphics/thumbnail.h"
 #include "graphics/scaler.h"
 #include "gui/saveload.h"
-#include "ultima/shared/early/ultima_early.h"
-#include "ultima/shared/early/game.h"
-#include "ultima/shared/engine/events.h"
-#include "ultima/shared/engine/resources.h"
-#include "ultima/shared/core/mouse_cursor.h"
-#include "ultima/shared/gfx/screen.h"
+#include "ultima/u1shared/early/ultima_early.h"
+#include "ultima/u1shared/early/game.h"
+#include "ultima/u1shared/engine/events.h"
+#include "ultima/u1shared/engine/resources.h"
+#include "ultima/u1shared/core/mouse_cursor.h"
+#include "ultima/u1shared/gfx/screen.h"
 
 #ifndef RELEASE_BUILD
 #include "ultima/ultima1/game.h"
diff --git a/engines/ultima/shared/early/ultima_early.h b/engines/ultima/u1shared/early/ultima_early.h
similarity index 98%
rename from engines/ultima/shared/early/ultima_early.h
rename to engines/ultima/u1shared/early/ultima_early.h
index 62d5c9dcc0f..fe80998615d 100644
--- a/engines/ultima/shared/early/ultima_early.h
+++ b/engines/ultima/u1shared/early/ultima_early.h
@@ -34,7 +34,7 @@
 #include "engines/engine.h"
 #include "ultima/detection.h"
 
-#include "ultima/shared/engine/events.h"
+#include "ultima/u1shared/engine/events.h"
 
 namespace Ultima {
 
diff --git a/engines/ultima/shared/engine/events.cpp b/engines/ultima/u1shared/engine/events.cpp
similarity index 99%
rename from engines/ultima/shared/engine/events.cpp
rename to engines/ultima/u1shared/engine/events.cpp
index 80bcc256d83..141ef828411 100644
--- a/engines/ultima/shared/engine/events.cpp
+++ b/engines/ultima/u1shared/engine/events.cpp
@@ -25,7 +25,7 @@
 #include "common/endian.h"
 #include "common/system.h"
 #include "engines/util.h"
-#include "ultima/shared/engine/events.h"
+#include "ultima/u1shared/engine/events.h"
 
 namespace Ultima {
 namespace Shared {
diff --git a/engines/ultima/shared/engine/events.h b/engines/ultima/u1shared/engine/events.h
similarity index 99%
rename from engines/ultima/shared/engine/events.h
rename to engines/ultima/u1shared/engine/events.h
index f1592221dab..36d2dcd8fd5 100644
--- a/engines/ultima/shared/engine/events.h
+++ b/engines/ultima/u1shared/engine/events.h
@@ -27,7 +27,7 @@
 #include "common/stack.h"
 #include "gui/debugger.h"
 #include "graphics/screen.h"
-#include "ultima/shared/core/rect.h"
+#include "ultima/u1shared/core/rect.h"
 
 namespace Ultima {
 namespace Shared {
diff --git a/engines/ultima/shared/engine/input_handler.cpp b/engines/ultima/u1shared/engine/input_handler.cpp
similarity index 93%
rename from engines/ultima/shared/engine/input_handler.cpp
rename to engines/ultima/u1shared/engine/input_handler.cpp
index 55d510af039..2f445f368f9 100644
--- a/engines/ultima/shared/engine/input_handler.cpp
+++ b/engines/ultima/u1shared/engine/input_handler.cpp
@@ -19,11 +19,11 @@
  *
  */
 
-#include "ultima/shared/engine/input_handler.h"
-#include "ultima/shared/engine/events.h"
-#include "ultima/shared/early/game_base.h"
-#include "ultima/shared/engine/messages.h"
-#include "ultima/shared/gfx/visual_item.h"
+#include "ultima/u1shared/engine/input_handler.h"
+#include "ultima/u1shared/engine/events.h"
+#include "ultima/u1shared/early/game_base.h"
+#include "ultima/u1shared/engine/messages.h"
+#include "ultima/u1shared/gfx/visual_item.h"
 
 namespace Ultima {
 namespace Shared {
diff --git a/engines/ultima/shared/engine/input_handler.h b/engines/ultima/u1shared/engine/input_handler.h
similarity index 95%
rename from engines/ultima/shared/engine/input_handler.h
rename to engines/ultima/u1shared/engine/input_handler.h
index 7576e5e343c..a8580cb2483 100644
--- a/engines/ultima/shared/engine/input_handler.h
+++ b/engines/ultima/u1shared/engine/input_handler.h
@@ -22,8 +22,8 @@
 #ifndef ULTIMA_SHARED_ENGINE_INPUT_HANDLER_H
 #define ULTIMA_SHARED_ENGINE_INPUT_HANDLER_H
 
-#include "ultima/shared/engine/input_translator.h"
-#include "ultima/shared/core/tree_item.h"
+#include "ultima/u1shared/engine/input_translator.h"
+#include "ultima/u1shared/core/tree_item.h"
 
 namespace Ultima {
 namespace Shared {
diff --git a/engines/ultima/shared/engine/input_translator.cpp b/engines/ultima/u1shared/engine/input_translator.cpp
similarity index 93%
rename from engines/ultima/shared/engine/input_translator.cpp
rename to engines/ultima/u1shared/engine/input_translator.cpp
index e6bacd9390f..8fd536d5d98 100644
--- a/engines/ultima/shared/engine/input_translator.cpp
+++ b/engines/ultima/u1shared/engine/input_translator.cpp
@@ -19,11 +19,11 @@
  *
  */
 
-#include "ultima/shared/engine/input_handler.h"
-#include "ultima/shared/engine/input_translator.h"
-#include "ultima/shared/engine/events.h"
-#include "ultima/shared/engine/messages.h"
-#include "ultima/shared/early/ultima_early.h"
+#include "ultima/u1shared/engine/input_handler.h"
+#include "ultima/u1shared/engine/input_translator.h"
+#include "ultima/u1shared/engine/events.h"
+#include "ultima/u1shared/engine/messages.h"
+#include "ultima/u1shared/early/ultima_early.h"
 
 namespace Ultima {
 namespace Shared {
diff --git a/engines/ultima/shared/engine/input_translator.h b/engines/ultima/u1shared/engine/input_translator.h
similarity index 97%
rename from engines/ultima/shared/engine/input_translator.h
rename to engines/ultima/u1shared/engine/input_translator.h
index 231a7921a76..882ae236b63 100644
--- a/engines/ultima/shared/engine/input_translator.h
+++ b/engines/ultima/u1shared/engine/input_translator.h
@@ -23,7 +23,7 @@
 #define ULTIMA_SHARED_ENGINE_INPUT_TRANSLATOR_H
 
 #include "common/keyboard.h"
-#include "ultima/shared/engine/messages.h"
+#include "ultima/u1shared/engine/messages.h"
 
 namespace Ultima {
 namespace Shared {
diff --git a/engines/ultima/shared/engine/messages.cpp b/engines/ultima/u1shared/engine/messages.cpp
similarity index 94%
rename from engines/ultima/shared/engine/messages.cpp
rename to engines/ultima/u1shared/engine/messages.cpp
index 8e8c2bd3d3b..d3f844206c8 100644
--- a/engines/ultima/shared/engine/messages.cpp
+++ b/engines/ultima/u1shared/engine/messages.cpp
@@ -19,11 +19,11 @@
  *
  */
 
-#include "ultima/shared/engine/messages.h"
-#include "ultima/shared/early/ultima_early.h"
-#include "ultima/shared/early/game_base.h"
-#include "ultima/shared/gfx/screen.h"
-#include "ultima/shared/early/game.h"
+#include "ultima/u1shared/engine/messages.h"
+#include "ultima/u1shared/early/ultima_early.h"
+#include "ultima/u1shared/early/game_base.h"
+#include "ultima/u1shared/gfx/screen.h"
+#include "ultima/u1shared/early/game.h"
 
 namespace Ultima {
 namespace Shared {
diff --git a/engines/ultima/shared/engine/messages.h b/engines/ultima/u1shared/engine/messages.h
similarity index 98%
rename from engines/ultima/shared/engine/messages.h
rename to engines/ultima/u1shared/engine/messages.h
index ec82da99de1..4a359d027ef 100644
--- a/engines/ultima/shared/engine/messages.h
+++ b/engines/ultima/u1shared/engine/messages.h
@@ -24,9 +24,9 @@
 
 #include "common/keyboard.h"
 #include "common/events.h"
-#include "ultima/shared/core/rect.h"
-#include "ultima/shared/core/base_object.h"
-#include "ultima/shared/core/tree_item.h"
+#include "ultima/u1shared/core/rect.h"
+#include "ultima/u1shared/core/base_object.h"
+#include "ultima/u1shared/core/tree_item.h"
 
 namespace Ultima {
 namespace Shared {
diff --git a/engines/ultima/shared/engine/resources.cpp b/engines/ultima/u1shared/engine/resources.cpp
similarity index 98%
rename from engines/ultima/shared/engine/resources.cpp
rename to engines/ultima/u1shared/engine/resources.cpp
index 1633baf4a69..b8174419a8b 100644
--- a/engines/ultima/shared/engine/resources.cpp
+++ b/engines/ultima/u1shared/engine/resources.cpp
@@ -19,8 +19,8 @@
  *
  */
 
-#include "ultima/shared/engine/resources.h"
-#include "ultima/shared/early/font_resources.h"
+#include "ultima/u1shared/engine/resources.h"
+#include "ultima/u1shared/early/font_resources.h"
 #include "common/endian.h"
 
 #ifndef RELEASE_BUILD
diff --git a/engines/ultima/shared/engine/resources.h b/engines/ultima/u1shared/engine/resources.h
similarity index 99%
rename from engines/ultima/shared/engine/resources.h
rename to engines/ultima/u1shared/engine/resources.h
index 8fbdd3a6919..87f11511466 100644
--- a/engines/ultima/shared/engine/resources.h
+++ b/engines/ultima/u1shared/engine/resources.h
@@ -28,7 +28,7 @@
 #include "common/memstream.h"
 #include "common/str.h"
 #include "common/serializer.h"
-#include "ultima/shared/core/file.h"
+#include "ultima/u1shared/core/file.h"
 
 #define STRING_BUFFER_SIZE 32768
 
diff --git a/engines/ultima/shared/gfx/bitmap.cpp b/engines/ultima/u1shared/gfx/bitmap.cpp
similarity index 96%
rename from engines/ultima/shared/gfx/bitmap.cpp
rename to engines/ultima/u1shared/gfx/bitmap.cpp
index c296484cd28..7db52fec396 100644
--- a/engines/ultima/shared/gfx/bitmap.cpp
+++ b/engines/ultima/u1shared/gfx/bitmap.cpp
@@ -19,8 +19,8 @@
  *
  */
 
-#include "ultima/shared/gfx/bitmap.h"
-#include "ultima/shared/core/file.h"
+#include "ultima/u1shared/gfx/bitmap.h"
+#include "ultima/u1shared/core/file.h"
 #include "common/memstream.h"
 #include "graphics/managed_surface.h"
 
diff --git a/engines/ultima/shared/gfx/bitmap.h b/engines/ultima/u1shared/gfx/bitmap.h
similarity index 97%
rename from engines/ultima/shared/gfx/bitmap.h
rename to engines/ultima/u1shared/gfx/bitmap.h
index 42bb9067c58..42ba5783782 100644
--- a/engines/ultima/shared/gfx/bitmap.h
+++ b/engines/ultima/u1shared/gfx/bitmap.h
@@ -22,7 +22,7 @@
 #ifndef ULTIMA_BITMAP_H
 #define ULTIMA_BITMAP_H
 
-#include "ultima/shared/core/lzw.h"
+#include "ultima/u1shared/core/lzw.h"
 #include "common/path.h"
 #include "common/stream.h"
 #include "graphics/managed_surface.h"
diff --git a/engines/ultima/shared/gfx/character_input.cpp b/engines/ultima/u1shared/gfx/character_input.cpp
similarity index 89%
rename from engines/ultima/shared/gfx/character_input.cpp
rename to engines/ultima/u1shared/gfx/character_input.cpp
index 0f7fb765c98..1754f98f909 100644
--- a/engines/ultima/shared/gfx/character_input.cpp
+++ b/engines/ultima/u1shared/gfx/character_input.cpp
@@ -19,10 +19,10 @@
  *
  */
 
-#include "ultima/shared/gfx/character_input.h"
-#include "ultima/shared/gfx/text_cursor.h"
-#include "ultima/shared/early/game_base.h"
-#include "ultima/shared/engine/messages.h"
+#include "ultima/u1shared/gfx/character_input.h"
+#include "ultima/u1shared/gfx/text_cursor.h"
+#include "ultima/u1shared/early/game_base.h"
+#include "ultima/u1shared/engine/messages.h"
 
 namespace Ultima {
 namespace Shared {
diff --git a/engines/ultima/shared/gfx/character_input.h b/engines/ultima/u1shared/gfx/character_input.h
similarity index 97%
rename from engines/ultima/shared/gfx/character_input.h
rename to engines/ultima/u1shared/gfx/character_input.h
index 3d77edb24b2..f44f0c13914 100644
--- a/engines/ultima/shared/gfx/character_input.h
+++ b/engines/ultima/u1shared/gfx/character_input.h
@@ -22,7 +22,7 @@
 #ifndef ULTIMA_GFX_CHARACTER_INPUT_H
 #define ULTIMA_GFX_CHARACTER_INPUT_H
 
-#include "ultima/shared/gfx/popup.h"
+#include "ultima/u1shared/gfx/popup.h"
 
 namespace Ultima {
 namespace Shared {
diff --git a/engines/ultima/shared/gfx/dungeon_surface.cpp b/engines/ultima/u1shared/gfx/dungeon_surface.cpp
similarity index 98%
rename from engines/ultima/shared/gfx/dungeon_surface.cpp
rename to engines/ultima/u1shared/gfx/dungeon_surface.cpp
index 5400145cc24..6eb0fd09cb4 100644
--- a/engines/ultima/shared/gfx/dungeon_surface.cpp
+++ b/engines/ultima/u1shared/gfx/dungeon_surface.cpp
@@ -19,9 +19,9 @@
  *
  */
 
-#include "ultima/shared/gfx/dungeon_surface.h"
-#include "ultima/shared/maps/map.h"
-#include "ultima/shared/early/game.h"
+#include "ultima/u1shared/gfx/dungeon_surface.h"
+#include "ultima/u1shared/maps/map.h"
+#include "ultima/u1shared/early/game.h"
 
 namespace Ultima {
 namespace Shared {
diff --git a/engines/ultima/shared/gfx/dungeon_surface.h b/engines/ultima/u1shared/gfx/dungeon_surface.h
similarity index 98%
rename from engines/ultima/shared/gfx/dungeon_surface.h
rename to engines/ultima/u1shared/gfx/dungeon_surface.h
index 2f98c310920..2ce4067084d 100644
--- a/engines/ultima/shared/gfx/dungeon_surface.h
+++ b/engines/ultima/u1shared/gfx/dungeon_surface.h
@@ -22,7 +22,7 @@
 #ifndef ULTIMA_SHARED_GFX_DUNGEON_H
 #define ULTIMA_SHARED_GFX_DUNGEON_H
 
-#include "ultima/shared/gfx/visual_surface.h"
+#include "ultima/u1shared/gfx/visual_surface.h"
 
 namespace Ultima {
 namespace Shared {
diff --git a/engines/ultima/shared/gfx/font.cpp b/engines/ultima/u1shared/gfx/font.cpp
similarity index 98%
rename from engines/ultima/shared/gfx/font.cpp
rename to engines/ultima/u1shared/gfx/font.cpp
index d4969faf80c..626a42b94dc 100644
--- a/engines/ultima/shared/gfx/font.cpp
+++ b/engines/ultima/u1shared/gfx/font.cpp
@@ -19,7 +19,7 @@
  *
  */
 
-#include "ultima/shared/gfx/font.h"
+#include "ultima/u1shared/gfx/font.h"
 #include "graphics/managed_surface.h"
 
 namespace Ultima {
diff --git a/engines/ultima/shared/gfx/font.h b/engines/ultima/u1shared/gfx/font.h
similarity index 97%
rename from engines/ultima/shared/gfx/font.h
rename to engines/ultima/u1shared/gfx/font.h
index 699f6b3af26..8c6503c33d5 100644
--- a/engines/ultima/shared/gfx/font.h
+++ b/engines/ultima/u1shared/gfx/font.h
@@ -25,7 +25,7 @@
 #include "common/array.h"
 #include "common/stream.h"
 #include "graphics/managed_surface.h"
-#include "ultima/shared/core/rect.h"
+#include "ultima/u1shared/core/rect.h"
 
 namespace Ultima {
 namespace Shared {
diff --git a/engines/ultima/shared/gfx/info.cpp b/engines/ultima/u1shared/gfx/info.cpp
similarity index 96%
rename from engines/ultima/shared/gfx/info.cpp
rename to engines/ultima/u1shared/gfx/info.cpp
index 61d26ae206b..9426b6061f9 100644
--- a/engines/ultima/shared/gfx/info.cpp
+++ b/engines/ultima/u1shared/gfx/info.cpp
@@ -19,10 +19,10 @@
  *
  */
 
-#include "ultima/shared/gfx/info.h"
-#include "ultima/shared/early/game.h"
-#include "ultima/shared/gfx/text_cursor.h"
-#include "ultima/shared/core/str.h"
+#include "ultima/u1shared/gfx/info.h"
+#include "ultima/u1shared/early/game.h"
+#include "ultima/u1shared/gfx/text_cursor.h"
+#include "ultima/u1shared/core/str.h"
 
 namespace Ultima {
 namespace Shared {
diff --git a/engines/ultima/shared/gfx/info.h b/engines/ultima/u1shared/gfx/info.h
similarity index 93%
rename from engines/ultima/shared/gfx/info.h
rename to engines/ultima/u1shared/gfx/info.h
index a85ad0c5d73..50575d8ee6a 100644
--- a/engines/ultima/shared/gfx/info.h
+++ b/engines/ultima/u1shared/gfx/info.h
@@ -22,9 +22,9 @@
 #ifndef ULTIMA_SHARED_GFX_INFO_H
 #define ULTIMA_SHARED_GFX_INFO_H
 
-#include "ultima/shared/gfx/visual_item.h"
-#include "ultima/shared/gfx/text_input.h"
-#include "ultima/shared/gfx/character_input.h"
+#include "ultima/u1shared/gfx/visual_item.h"
+#include "ultima/u1shared/gfx/text_input.h"
+#include "ultima/u1shared/gfx/character_input.h"
 #include "common/str-array.h"
 
 namespace Ultima {
diff --git a/engines/ultima/shared/gfx/popup.cpp b/engines/ultima/u1shared/gfx/popup.cpp
similarity index 95%
rename from engines/ultima/shared/gfx/popup.cpp
rename to engines/ultima/u1shared/gfx/popup.cpp
index 8f200bdddba..b575e8034e0 100644
--- a/engines/ultima/shared/gfx/popup.cpp
+++ b/engines/ultima/u1shared/gfx/popup.cpp
@@ -19,8 +19,8 @@
  *
  */
 
-#include "ultima/shared/gfx/popup.h"
-#include "ultima/shared/early/game_base.h"
+#include "ultima/u1shared/gfx/popup.h"
+#include "ultima/u1shared/early/game_base.h"
 
 namespace Ultima {
 namespace Shared {
diff --git a/engines/ultima/shared/gfx/popup.h b/engines/ultima/u1shared/gfx/popup.h
similarity index 97%
rename from engines/ultima/shared/gfx/popup.h
rename to engines/ultima/u1shared/gfx/popup.h
index 2315da3505c..b17b90916f5 100644
--- a/engines/ultima/shared/gfx/popup.h
+++ b/engines/ultima/u1shared/gfx/popup.h
@@ -22,7 +22,7 @@
 #ifndef ULTIMA_SHARED_GFX_POPUP_H
 #define ULTIMA_SHARED_GFX_POPUP_H
 
-#include "ultima/shared/gfx/visual_item.h"
+#include "ultima/u1shared/gfx/visual_item.h"
 
 namespace Ultima {
 namespace Shared {
diff --git a/engines/ultima/shared/gfx/screen.cpp b/engines/ultima/u1shared/gfx/screen.cpp
similarity index 97%
rename from engines/ultima/shared/gfx/screen.cpp
rename to engines/ultima/u1shared/gfx/screen.cpp
index b56a0fcaeec..eaa8ed86d22 100644
--- a/engines/ultima/shared/gfx/screen.cpp
+++ b/engines/ultima/u1shared/gfx/screen.cpp
@@ -20,7 +20,7 @@
  */
 
 #include "engines/util.h"
-#include "ultima/shared/gfx/screen.h"
+#include "ultima/u1shared/gfx/screen.h"
 
 namespace Ultima {
 namespace Shared {
diff --git a/engines/ultima/shared/gfx/screen.h b/engines/ultima/u1shared/gfx/screen.h
similarity index 93%
rename from engines/ultima/shared/gfx/screen.h
rename to engines/ultima/u1shared/gfx/screen.h
index a842596d9d8..4c1fc7c2404 100644
--- a/engines/ultima/shared/gfx/screen.h
+++ b/engines/ultima/u1shared/gfx/screen.h
@@ -23,10 +23,10 @@
 #define ULTIMA_SHARED_GFX_SCREEN_H
 
 #include "common/list.h"
-#include "ultima/shared/core/rect.h"
+#include "ultima/u1shared/core/rect.h"
 #include "graphics/screen.h"
-#include "ultima/shared/gfx/font.h"
-#include "ultima/shared/engine/messages.h"
+#include "ultima/u1shared/gfx/font.h"
+#include "ultima/u1shared/engine/messages.h"
 
 namespace Ultima {
 namespace Shared {
diff --git a/engines/ultima/shared/gfx/sprites.cpp b/engines/ultima/u1shared/gfx/sprites.cpp
similarity index 97%
rename from engines/ultima/shared/gfx/sprites.cpp
rename to engines/ultima/u1shared/gfx/sprites.cpp
index d2c230a6962..5ac322fd7a4 100644
--- a/engines/ultima/shared/gfx/sprites.cpp
+++ b/engines/ultima/u1shared/gfx/sprites.cpp
@@ -19,8 +19,8 @@
  *
  */
 
-#include "ultima/shared/gfx/sprites.h"
-#include "ultima/shared/core/file.h"
+#include "ultima/u1shared/gfx/sprites.h"
+#include "ultima/u1shared/core/file.h"
 
 namespace Ultima {
 namespace Shared {
diff --git a/engines/ultima/shared/gfx/sprites.h b/engines/ultima/u1shared/gfx/sprites.h
similarity index 98%
rename from engines/ultima/shared/gfx/sprites.h
rename to engines/ultima/u1shared/gfx/sprites.h
index 4f38a5934ca..ee35df5f06d 100644
--- a/engines/ultima/shared/gfx/sprites.h
+++ b/engines/ultima/u1shared/gfx/sprites.h
@@ -25,7 +25,7 @@
 #include "common/array.h"
 #include "common/path.h"
 #include "graphics/managed_surface.h"
-#include "ultima/shared/core/rect.h"
+#include "ultima/u1shared/core/rect.h"
 
 namespace Ultima {
 namespace Shared {
diff --git a/engines/ultima/shared/gfx/text_cursor.cpp b/engines/ultima/u1shared/gfx/text_cursor.cpp
similarity index 92%
rename from engines/ultima/shared/gfx/text_cursor.cpp
rename to engines/ultima/u1shared/gfx/text_cursor.cpp
index b5ea43a5f6a..3c642ec45aa 100644
--- a/engines/ultima/shared/gfx/text_cursor.cpp
+++ b/engines/ultima/u1shared/gfx/text_cursor.cpp
@@ -19,8 +19,8 @@
  *
  */
 
-#include "ultima/shared/gfx/text_cursor.h"
-#include "ultima/shared/early/ultima_early.h"
+#include "ultima/u1shared/gfx/text_cursor.h"
+#include "ultima/u1shared/early/ultima_early.h"
 
 namespace Ultima {
 namespace Shared {
diff --git a/engines/ultima/shared/gfx/text_cursor.h b/engines/ultima/u1shared/gfx/text_cursor.h
similarity index 96%
rename from engines/ultima/shared/gfx/text_cursor.h
rename to engines/ultima/u1shared/gfx/text_cursor.h
index 3b20759a6f1..593ad76a0d8 100644
--- a/engines/ultima/shared/gfx/text_cursor.h
+++ b/engines/ultima/u1shared/gfx/text_cursor.h
@@ -22,8 +22,8 @@
 #ifndef ULTIMA_SHARED_GFX_TEXT_CURSOR_H
 #define ULTIMA_SHARED_GFX_TEXT_CURSOR_H
 
-#include "ultima/shared/core/rect.h"
-#include "ultima/shared/gfx/screen.h"
+#include "ultima/u1shared/core/rect.h"
+#include "ultima/u1shared/gfx/screen.h"
 
 namespace Ultima {
 namespace Shared {
diff --git a/engines/ultima/shared/gfx/text_input.cpp b/engines/ultima/u1shared/gfx/text_input.cpp
similarity index 94%
rename from engines/ultima/shared/gfx/text_input.cpp
rename to engines/ultima/u1shared/gfx/text_input.cpp
index c85f09f97eb..9947c88ba7f 100644
--- a/engines/ultima/shared/gfx/text_input.cpp
+++ b/engines/ultima/u1shared/gfx/text_input.cpp
@@ -19,10 +19,10 @@
  *
  */
 
-#include "ultima/shared/gfx/text_input.h"
-#include "ultima/shared/gfx/text_cursor.h"
-#include "ultima/shared/early/game_base.h"
-#include "ultima/shared/engine/messages.h"
+#include "ultima/u1shared/gfx/text_input.h"
+#include "ultima/u1shared/gfx/text_cursor.h"
+#include "ultima/u1shared/early/game_base.h"
+#include "ultima/u1shared/engine/messages.h"
 
 namespace Ultima {
 namespace Shared {
diff --git a/engines/ultima/shared/gfx/text_input.h b/engines/ultima/u1shared/gfx/text_input.h
similarity index 98%
rename from engines/ultima/shared/gfx/text_input.h
rename to engines/ultima/u1shared/gfx/text_input.h
index 5ca1bab6bda..bf1ea614886 100644
--- a/engines/ultima/shared/gfx/text_input.h
+++ b/engines/ultima/u1shared/gfx/text_input.h
@@ -22,7 +22,7 @@
 #ifndef ULTIMA_GFX_TEXT_INPUT_H
 #define ULTIMA_GFX_TEXT_INPUT_H
 
-#include "ultima/shared/gfx/popup.h"
+#include "ultima/u1shared/gfx/popup.h"
 
 namespace Ultima {
 namespace Shared {
diff --git a/engines/ultima/shared/gfx/viewport_dungeon.cpp b/engines/ultima/u1shared/gfx/viewport_dungeon.cpp
similarity index 96%
rename from engines/ultima/shared/gfx/viewport_dungeon.cpp
rename to engines/ultima/u1shared/gfx/viewport_dungeon.cpp
index b3f67d940af..3559f4794db 100644
--- a/engines/ultima/shared/gfx/viewport_dungeon.cpp
+++ b/engines/ultima/u1shared/gfx/viewport_dungeon.cpp
@@ -19,12 +19,12 @@
  *
  */
 
-#include "ultima/shared/gfx/viewport_dungeon.h"
-#include "ultima/shared/maps/dungeon_widget.h"
-#include "ultima/shared/maps/dungeon_creature.h"
-#include "ultima/shared/maps/map_widget.h"
-#include "ultima/shared/maps/map.h"
-#include "ultima/shared/early/game.h"
+#include "ultima/u1shared/gfx/viewport_dungeon.h"
+#include "ultima/u1shared/maps/dungeon_widget.h"
+#include "ultima/u1shared/maps/dungeon_creature.h"
+#include "ultima/u1shared/maps/map_widget.h"
+#include "ultima/u1shared/maps/map.h"
+#include "ultima/u1shared/early/game.h"
 
 namespace Ultima {
 namespace Shared {
diff --git a/engines/ultima/shared/gfx/viewport_dungeon.h b/engines/ultima/u1shared/gfx/viewport_dungeon.h
similarity index 94%
rename from engines/ultima/shared/gfx/viewport_dungeon.h
rename to engines/ultima/u1shared/gfx/viewport_dungeon.h
index d30880a486e..745224265f6 100644
--- a/engines/ultima/shared/gfx/viewport_dungeon.h
+++ b/engines/ultima/u1shared/gfx/viewport_dungeon.h
@@ -22,9 +22,9 @@
 #ifndef ULTIMA_SHARED_GFX_VIEWPORT_DUNGEON_H
 #define ULTIMA_SHARED_GFX_VIEWPORT_DUNGEON_H
 
-#include "ultima/shared/gfx/visual_item.h"
-#include "ultima/shared/gfx/dungeon_surface.h"
-#include "ultima/shared/maps/map_tile.h"
+#include "ultima/u1shared/gfx/visual_item.h"
+#include "ultima/u1shared/gfx/dungeon_surface.h"
+#include "ultima/u1shared/maps/map_tile.h"
 
 namespace Ultima {
 namespace Shared {
diff --git a/engines/ultima/shared/gfx/viewport_map.cpp b/engines/ultima/u1shared/gfx/viewport_map.cpp
similarity index 94%
rename from engines/ultima/shared/gfx/viewport_map.cpp
rename to engines/ultima/u1shared/gfx/viewport_map.cpp
index bfdbed27580..5b257e85773 100644
--- a/engines/ultima/shared/gfx/viewport_map.cpp
+++ b/engines/ultima/u1shared/gfx/viewport_map.cpp
@@ -19,9 +19,9 @@
  *
  */
 
-#include "ultima/shared/gfx/viewport_map.h"
-#include "ultima/shared/maps/map.h"
-#include "ultima/shared/early/game.h"
+#include "ultima/u1shared/gfx/viewport_map.h"
+#include "ultima/u1shared/maps/map.h"
+#include "ultima/u1shared/early/game.h"
 
 namespace Ultima {
 namespace Shared {
diff --git a/engines/ultima/shared/gfx/viewport_map.h b/engines/ultima/u1shared/gfx/viewport_map.h
similarity index 94%
rename from engines/ultima/shared/gfx/viewport_map.h
rename to engines/ultima/u1shared/gfx/viewport_map.h
index 2082e75dca1..b12ce917c34 100644
--- a/engines/ultima/shared/gfx/viewport_map.h
+++ b/engines/ultima/u1shared/gfx/viewport_map.h
@@ -22,8 +22,8 @@
 #ifndef ULTIMA_SHARED_GFX_VIEWPORT_MAP_H
 #define ULTIMA_SHARED_GFX_VIEWPORT_MAP_H
 
-#include "ultima/shared/gfx/visual_item.h"
-#include "ultima/shared/gfx/sprites.h"
+#include "ultima/u1shared/gfx/visual_item.h"
+#include "ultima/u1shared/gfx/sprites.h"
 
 namespace Ultima {
 namespace Shared {
diff --git a/engines/ultima/shared/gfx/visual_container.cpp b/engines/ultima/u1shared/gfx/visual_container.cpp
similarity index 98%
rename from engines/ultima/shared/gfx/visual_container.cpp
rename to engines/ultima/u1shared/gfx/visual_container.cpp
index 8633d4b4bb7..95024dfd10c 100644
--- a/engines/ultima/shared/gfx/visual_container.cpp
+++ b/engines/ultima/u1shared/gfx/visual_container.cpp
@@ -19,7 +19,7 @@
  *
  */
 
-#include "ultima/shared/gfx/visual_container.h"
+#include "ultima/u1shared/gfx/visual_container.h"
 
 namespace Ultima {
 namespace Shared {
diff --git a/engines/ultima/shared/gfx/visual_container.h b/engines/ultima/u1shared/gfx/visual_container.h
similarity index 96%
rename from engines/ultima/shared/gfx/visual_container.h
rename to engines/ultima/u1shared/gfx/visual_container.h
index 44fd0b4d303..f69ed9265e1 100644
--- a/engines/ultima/shared/gfx/visual_container.h
+++ b/engines/ultima/u1shared/gfx/visual_container.h
@@ -22,8 +22,8 @@
 #ifndef ULTIMA_SHARED_GFX_VISUAL_CONTAINER_H
 #define ULTIMA_SHARED_GFX_VISUAL_CONTAINER_H
 
-#include "ultima/shared/gfx/visual_item.h"
-#include "ultima/shared/core/message_target.h"
+#include "ultima/u1shared/gfx/visual_item.h"
+#include "ultima/u1shared/core/message_target.h"
 
 namespace Ultima {
 namespace Shared {
diff --git a/engines/ultima/shared/gfx/visual_item.cpp b/engines/ultima/u1shared/gfx/visual_item.cpp
similarity index 94%
rename from engines/ultima/shared/gfx/visual_item.cpp
rename to engines/ultima/u1shared/gfx/visual_item.cpp
index 7e46a934f96..02297555284 100644
--- a/engines/ultima/shared/gfx/visual_item.cpp
+++ b/engines/ultima/u1shared/gfx/visual_item.cpp
@@ -19,9 +19,9 @@
  *
  */
 
-#include "ultima/shared/gfx/visual_item.h"
-#include "ultima/shared/early/ultima_early.h"
-#include "ultima/shared/early/game.h"
+#include "ultima/u1shared/gfx/visual_item.h"
+#include "ultima/u1shared/early/ultima_early.h"
+#include "ultima/u1shared/early/game.h"
 
 namespace Ultima {
 namespace Shared {
diff --git a/engines/ultima/shared/gfx/visual_item.h b/engines/ultima/u1shared/gfx/visual_item.h
similarity index 96%
rename from engines/ultima/shared/gfx/visual_item.h
rename to engines/ultima/u1shared/gfx/visual_item.h
index d995d80d6a2..89cbc33ad5e 100644
--- a/engines/ultima/shared/gfx/visual_item.h
+++ b/engines/ultima/u1shared/gfx/visual_item.h
@@ -23,9 +23,9 @@
 #define ULTIMA_SHARED_GFX_VISUAL_ITEM_H
 
 #include "graphics/managed_surface.h"
-#include "ultima/shared/core/named_item.h"
-#include "ultima/shared/gfx/screen.h"
-#include "ultima/shared/gfx/visual_surface.h"
+#include "ultima/u1shared/core/named_item.h"
+#include "ultima/u1shared/gfx/screen.h"
+#include "ultima/u1shared/gfx/visual_surface.h"
 
 namespace Ultima {
 namespace Shared {
diff --git a/engines/ultima/shared/gfx/visual_surface.cpp b/engines/ultima/u1shared/gfx/visual_surface.cpp
similarity index 93%
rename from engines/ultima/shared/gfx/visual_surface.cpp
rename to engines/ultima/u1shared/gfx/visual_surface.cpp
index a61a7c96ce5..a6748adc983 100644
--- a/engines/ultima/shared/gfx/visual_surface.cpp
+++ b/engines/ultima/u1shared/gfx/visual_surface.cpp
@@ -19,10 +19,10 @@
  *
  */
 
-#include "ultima/shared/gfx/visual_surface.h"
-#include "ultima/shared/early/ultima_early.h"
-#include "ultima/shared/early/game.h"
-#include "ultima/shared/gfx/font.h"
+#include "ultima/u1shared/gfx/visual_surface.h"
+#include "ultima/u1shared/early/ultima_early.h"
+#include "ultima/u1shared/early/game.h"
+#include "ultima/u1shared/gfx/font.h"
 
 namespace Ultima {
 namespace Shared {
diff --git a/engines/ultima/shared/gfx/visual_surface.h b/engines/ultima/u1shared/gfx/visual_surface.h
similarity index 94%
rename from engines/ultima/shared/gfx/visual_surface.h
rename to engines/ultima/u1shared/gfx/visual_surface.h
index 4af1f0668b7..d196538e8f6 100644
--- a/engines/ultima/shared/gfx/visual_surface.h
+++ b/engines/ultima/u1shared/gfx/visual_surface.h
@@ -23,9 +23,9 @@
 #define ULTIMA_SHARED_GFX_VISUAL_SURFACE_H
 
 #include "graphics/managed_surface.h"
-#include "ultima/shared/core/named_item.h"
-#include "ultima/shared/core/rect.h"
-#include "ultima/shared/gfx/screen.h"
+#include "ultima/u1shared/core/named_item.h"
+#include "ultima/u1shared/core/rect.h"
+#include "ultima/u1shared/gfx/screen.h"
 
 namespace Ultima {
 namespace Shared {
diff --git a/engines/ultima/shared/maps/creature.cpp b/engines/ultima/u1shared/maps/creature.cpp
similarity index 94%
rename from engines/ultima/shared/maps/creature.cpp
rename to engines/ultima/u1shared/maps/creature.cpp
index 3967a66d65b..028a00b101d 100644
--- a/engines/ultima/shared/maps/creature.cpp
+++ b/engines/ultima/u1shared/maps/creature.cpp
@@ -19,8 +19,8 @@
  *
  */
 
-#include "ultima/shared/maps/creature.h"
-#include "ultima/shared/early/game.h"
+#include "ultima/u1shared/maps/creature.h"
+#include "ultima/u1shared/early/game.h"
 
 namespace Ultima {
 namespace Shared {
diff --git a/engines/ultima/shared/maps/creature.h b/engines/ultima/u1shared/maps/creature.h
similarity index 96%
rename from engines/ultima/shared/maps/creature.h
rename to engines/ultima/u1shared/maps/creature.h
index 70485c0dbe9..15ce4900b18 100644
--- a/engines/ultima/shared/maps/creature.h
+++ b/engines/ultima/u1shared/maps/creature.h
@@ -22,8 +22,8 @@
 #ifndef ULTIMA_SHARED_WIDGETS_CREATURE_H
 #define ULTIMA_SHARED_WIDGETS_CREATURE_H
 
-#include "ultima/shared/maps/map_widget.h"
-#include "ultima/shared/maps/map.h"
+#include "ultima/u1shared/maps/map_widget.h"
+#include "ultima/u1shared/maps/map.h"
 #include "common/serializer.h"
 
 namespace Ultima {
diff --git a/engines/ultima/shared/maps/dungeon_creature.h b/engines/ultima/u1shared/maps/dungeon_creature.h
similarity index 97%
rename from engines/ultima/shared/maps/dungeon_creature.h
rename to engines/ultima/u1shared/maps/dungeon_creature.h
index f3ff6a09a2e..dcba5093f4d 100644
--- a/engines/ultima/shared/maps/dungeon_creature.h
+++ b/engines/ultima/u1shared/maps/dungeon_creature.h
@@ -22,7 +22,7 @@
 #ifndef ULTIMA_SHARED_MAPS_DUNGEON_CREATURE_H
 #define ULTIMA_SHARED_MAPS_DUNGEON_CREATURE_H
 
-#include "ultima/shared/maps/creature.h"
+#include "ultima/u1shared/maps/creature.h"
 
 namespace Ultima {
 namespace Shared {
diff --git a/engines/ultima/shared/maps/dungeon_widget.h b/engines/ultima/u1shared/maps/dungeon_widget.h
similarity index 93%
rename from engines/ultima/shared/maps/dungeon_widget.h
rename to engines/ultima/u1shared/maps/dungeon_widget.h
index cb199b8afb6..8456e7f8b11 100644
--- a/engines/ultima/shared/maps/dungeon_widget.h
+++ b/engines/ultima/u1shared/maps/dungeon_widget.h
@@ -22,9 +22,9 @@
 #ifndef ULTIMA_SHARED_MAPS_DUNGEON_WIDGET_H
 #define ULTIMA_SHARED_MAPS_DUNGEON_WIDGET_H
 
-#include "ultima/shared/maps/map_widget.h"
-#include "ultima/shared/maps/map.h"
-#include "ultima/shared/gfx/dungeon_surface.h"
+#include "ultima/u1shared/maps/map_widget.h"
+#include "ultima/u1shared/maps/map.h"
+#include "ultima/u1shared/gfx/dungeon_surface.h"
 #include "common/serializer.h"
 #include "common/str.h"
 
diff --git a/engines/ultima/shared/maps/map.cpp b/engines/ultima/u1shared/maps/map.cpp
similarity index 91%
rename from engines/ultima/shared/maps/map.cpp
rename to engines/ultima/u1shared/maps/map.cpp
index 34823cf1cad..5bf33dbfe98 100644
--- a/engines/ultima/shared/maps/map.cpp
+++ b/engines/ultima/u1shared/maps/map.cpp
@@ -19,9 +19,9 @@
  *
  */
 
-#include "ultima/shared/maps/map.h"
-#include "ultima/shared/early/game.h"
-#include "ultima/shared/gfx/visual_item.h"
+#include "ultima/u1shared/maps/map.h"
+#include "ultima/u1shared/early/game.h"
+#include "ultima/u1shared/gfx/visual_item.h"
 
 namespace Ultima {
 namespace Shared {
diff --git a/engines/ultima/shared/maps/map.h b/engines/ultima/u1shared/maps/map.h
similarity index 96%
rename from engines/ultima/shared/maps/map.h
rename to engines/ultima/u1shared/maps/map.h
index 1b17e3ad7e9..93ce0742d94 100644
--- a/engines/ultima/shared/maps/map.h
+++ b/engines/ultima/u1shared/maps/map.h
@@ -24,10 +24,10 @@
 
 #include "common/array.h"
 #include "common/serializer.h"
-#include "ultima/shared/core/rect.h"
-#include "ultima/shared/maps/map_base.h"
-#include "ultima/shared/maps/map_widget.h"
-#include "ultima/shared/maps/map_tile.h"
+#include "ultima/u1shared/core/rect.h"
+#include "ultima/u1shared/maps/map_base.h"
+#include "ultima/u1shared/maps/map_widget.h"
+#include "ultima/u1shared/maps/map_tile.h"
 
 
 namespace Ultima {
diff --git a/engines/ultima/shared/maps/map_base.cpp b/engines/ultima/u1shared/maps/map_base.cpp
similarity index 96%
rename from engines/ultima/shared/maps/map_base.cpp
rename to engines/ultima/u1shared/maps/map_base.cpp
index d00953b9429..0eb42bf0cd7 100644
--- a/engines/ultima/shared/maps/map_base.cpp
+++ b/engines/ultima/u1shared/maps/map_base.cpp
@@ -19,11 +19,11 @@
  *
  */
 
-#include "ultima/shared/maps/map_base.h"
-#include "ultima/shared/maps/map_widget.h"
-#include "ultima/shared/maps/map.h"
-#include "ultima/shared/early/game.h"
-#include "ultima/shared/gfx/visual_item.h"
+#include "ultima/u1shared/maps/map_base.h"
+#include "ultima/u1shared/maps/map_widget.h"
+#include "ultima/u1shared/maps/map.h"
+#include "ultima/u1shared/early/game.h"
+#include "ultima/u1shared/gfx/visual_item.h"
 
 namespace Ultima {
 namespace Shared {
diff --git a/engines/ultima/shared/maps/map_base.h b/engines/ultima/u1shared/maps/map_base.h
similarity index 98%
rename from engines/ultima/shared/maps/map_base.h
rename to engines/ultima/u1shared/maps/map_base.h
index 6ef2ca4e4cb..c6524c0b372 100644
--- a/engines/ultima/shared/maps/map_base.h
+++ b/engines/ultima/u1shared/maps/map_base.h
@@ -24,9 +24,9 @@
 
 #include "common/array.h"
 #include "common/serializer.h"
-#include "ultima/shared/core/base_object.h"
-#include "ultima/shared/core/rect.h"
-#include "ultima/shared/maps/map_widget.h"
+#include "ultima/u1shared/core/base_object.h"
+#include "ultima/u1shared/core/rect.h"
+#include "ultima/u1shared/maps/map_widget.h"
 
 namespace Ultima {
 namespace Shared {
diff --git a/engines/ultima/shared/maps/map_tile.cpp b/engines/ultima/u1shared/maps/map_tile.cpp
similarity index 93%
rename from engines/ultima/shared/maps/map_tile.cpp
rename to engines/ultima/u1shared/maps/map_tile.cpp
index 10c0ed62b64..6175c7c4be2 100644
--- a/engines/ultima/shared/maps/map_tile.cpp
+++ b/engines/ultima/u1shared/maps/map_tile.cpp
@@ -19,8 +19,8 @@
  *
  */
 
-#include "ultima/shared/maps/map_tile.h"
-#include "ultima/shared/maps/map_widget.h"
+#include "ultima/u1shared/maps/map_tile.h"
+#include "ultima/u1shared/maps/map_widget.h"
 
 namespace Ultima {
 namespace Shared {
diff --git a/engines/ultima/shared/maps/map_tile.h b/engines/ultima/u1shared/maps/map_tile.h
similarity index 100%
rename from engines/ultima/shared/maps/map_tile.h
rename to engines/ultima/u1shared/maps/map_tile.h
diff --git a/engines/ultima/shared/maps/map_widget.cpp b/engines/ultima/u1shared/maps/map_widget.cpp
similarity index 93%
rename from engines/ultima/shared/maps/map_widget.cpp
rename to engines/ultima/u1shared/maps/map_widget.cpp
index af211dc6cbc..d51eb0aa697 100644
--- a/engines/ultima/shared/maps/map_widget.cpp
+++ b/engines/ultima/u1shared/maps/map_widget.cpp
@@ -19,11 +19,11 @@
  *
  */
 
-#include "ultima/shared/maps/map_widget.h"
-#include "ultima/shared/maps/map_base.h"
-#include "ultima/shared/maps/map_tile.h"
-#include "ultima/shared/early/game.h"
-#include "ultima/shared/gfx/visual_item.h"
+#include "ultima/u1shared/maps/map_widget.h"
+#include "ultima/u1shared/maps/map_base.h"
+#include "ultima/u1shared/maps/map_tile.h"
+#include "ultima/u1shared/early/game.h"
+#include "ultima/u1shared/gfx/visual_item.h"
 
 namespace Ultima {
 namespace Shared {
diff --git a/engines/ultima/shared/maps/map_widget.h b/engines/ultima/u1shared/maps/map_widget.h
similarity index 97%
rename from engines/ultima/shared/maps/map_widget.h
rename to engines/ultima/u1shared/maps/map_widget.h
index 2fa2478f37f..88da7385847 100644
--- a/engines/ultima/shared/maps/map_widget.h
+++ b/engines/ultima/u1shared/maps/map_widget.h
@@ -26,8 +26,8 @@
 #include "common/ptr.h"
 #include "common/serializer.h"
 #include "common/str.h"
-#include "ultima/shared/core/message_target.h"
-#include "ultima/shared/core/rect.h"
+#include "ultima/u1shared/core/message_target.h"
+#include "ultima/u1shared/core/rect.h"
 
 namespace Ultima {
 namespace Shared {
diff --git a/engines/ultima/ultima1/actions/action.cpp b/engines/ultima/ultima1/actions/action.cpp
index 64c1acfb7c3..889e9c3698e 100644
--- a/engines/ultima/ultima1/actions/action.cpp
+++ b/engines/ultima/ultima1/actions/action.cpp
@@ -23,8 +23,8 @@
 #include "ultima/ultima1/game.h"
 #include "ultima/ultima1/maps/map.h"
 #include "ultima/ultima1/core/resources.h"
-#include "ultima/shared/gfx/visual_item.h"
-#include "ultima/shared/engine/messages.h"
+#include "ultima/u1shared/gfx/visual_item.h"
+#include "ultima/u1shared/engine/messages.h"
 
 namespace Ultima {
 namespace Ultima1 {
diff --git a/engines/ultima/ultima1/actions/action.h b/engines/ultima/ultima1/actions/action.h
index 205cd1c93ec..a73c92e96b2 100644
--- a/engines/ultima/ultima1/actions/action.h
+++ b/engines/ultima/ultima1/actions/action.h
@@ -22,7 +22,7 @@
 #ifndef ULTIMA_ULTIMA1_ACTIONS_ACTION_H
 #define ULTIMA_ULTIMA1_ACTIONS_ACTION_H
 
-#include "ultima/shared/actions/action.h"
+#include "ultima/u1shared/actions/action.h"
 
 namespace Ultima {
 namespace Ultima1 {
diff --git a/engines/ultima/ultima1/actions/attack.h b/engines/ultima/ultima1/actions/attack.h
index 7e08d02b2fb..445a4d1e575 100644
--- a/engines/ultima/ultima1/actions/attack.h
+++ b/engines/ultima/ultima1/actions/attack.h
@@ -23,8 +23,8 @@
 #define ULTIMA_ULTIMA1_ACTIONS_ATTACK_H
 
 #include "ultima/ultima1/actions/action.h"
-#include "ultima/shared/maps/map_widget.h"
-#include "ultima/shared/engine/messages.h"
+#include "ultima/u1shared/maps/map_widget.h"
+#include "ultima/u1shared/engine/messages.h"
 
 namespace Ultima {
 namespace Ultima1 {
diff --git a/engines/ultima/ultima1/actions/cast.cpp b/engines/ultima/ultima1/actions/cast.cpp
index a92c32bc29e..9141385d9ff 100644
--- a/engines/ultima/ultima1/actions/cast.cpp
+++ b/engines/ultima/ultima1/actions/cast.cpp
@@ -22,7 +22,7 @@
 #include "ultima/ultima1/actions/cast.h"
 #include "ultima/ultima1/core/resources.h"
 #include "ultima/ultima1/game.h"
-#include "ultima/shared/core/character.h"
+#include "ultima/u1shared/core/character.h"
 
 namespace Ultima {
 namespace Ultima1 {
diff --git a/engines/ultima/ultima1/actions/cast.h b/engines/ultima/ultima1/actions/cast.h
index 41ab67fb327..78cf0aa9907 100644
--- a/engines/ultima/ultima1/actions/cast.h
+++ b/engines/ultima/ultima1/actions/cast.h
@@ -23,7 +23,7 @@
 #define ULTIMA_ULTIMA1_ACTIONS_CAST_H
 
 #include "ultima/ultima1/actions/action.h"
-#include "ultima/shared/engine/messages.h"
+#include "ultima/u1shared/engine/messages.h"
 
 namespace Ultima {
 namespace Ultima1 {
diff --git a/engines/ultima/ultima1/actions/move.h b/engines/ultima/ultima1/actions/move.h
index 5d4925e2dd1..29e8b592983 100644
--- a/engines/ultima/ultima1/actions/move.h
+++ b/engines/ultima/ultima1/actions/move.h
@@ -23,7 +23,7 @@
 #define ULTIMA_ULTIMA1_ACTIONS_MOVE_H
 
 #include "ultima/ultima1/actions/action.h"
-#include "ultima/shared/engine/messages.h"
+#include "ultima/u1shared/engine/messages.h"
 
 namespace Ultima {
 namespace Ultima1 {
diff --git a/engines/ultima/ultima1/actions/quit.cpp b/engines/ultima/ultima1/actions/quit.cpp
index aec82726f0c..90625179c51 100644
--- a/engines/ultima/ultima1/actions/quit.cpp
+++ b/engines/ultima/ultima1/actions/quit.cpp
@@ -23,7 +23,7 @@
 #include "ultima/ultima1/u1dialogs/stats.h"
 #include "ultima/ultima1/core/resources.h"
 #include "ultima/ultima1/game.h"
-#include "ultima/shared/early/ultima_early.h"
+#include "ultima/u1shared/early/ultima_early.h"
 
 namespace Ultima {
 namespace Ultima1 {
diff --git a/engines/ultima/ultima1/actions/quit.h b/engines/ultima/ultima1/actions/quit.h
index 7c8ceda5477..efb0621db6c 100644
--- a/engines/ultima/ultima1/actions/quit.h
+++ b/engines/ultima/ultima1/actions/quit.h
@@ -23,7 +23,7 @@
 #define ULTIMA_ULTIMA1_ACTIONS_QUIT_H
 
 #include "ultima/ultima1/actions/action.h"
-#include "ultima/shared/engine/messages.h"
+#include "ultima/u1shared/engine/messages.h"
 
 namespace Ultima {
 namespace Ultima1 {
diff --git a/engines/ultima/ultima1/actions/ready.h b/engines/ultima/ultima1/actions/ready.h
index 41f34e1cf10..ecdcc7b1555 100644
--- a/engines/ultima/ultima1/actions/ready.h
+++ b/engines/ultima/ultima1/actions/ready.h
@@ -23,7 +23,7 @@
 #define ULTIMA_ULTIMA1_ACTIONS_READY_H
 
 #include "ultima/ultima1/actions/action.h"
-#include "ultima/shared/engine/messages.h"
+#include "ultima/u1shared/engine/messages.h"
 
 namespace Ultima {
 namespace Ultima1 {
diff --git a/engines/ultima/ultima1/actions/stats.h b/engines/ultima/ultima1/actions/stats.h
index ae2d048f018..f8fecf6713e 100644
--- a/engines/ultima/ultima1/actions/stats.h
+++ b/engines/ultima/ultima1/actions/stats.h
@@ -23,7 +23,7 @@
 #define ULTIMA_ULTIMA1_ACTIONS_STATS_H
 
 #include "ultima/ultima1/actions/action.h"
-#include "ultima/shared/engine/messages.h"
+#include "ultima/u1shared/engine/messages.h"
 
 namespace Ultima {
 namespace Ultima1 {
diff --git a/engines/ultima/ultima1/core/debugger.cpp b/engines/ultima/ultima1/core/debugger.cpp
index d5d6438deed..049d0a48cc1 100644
--- a/engines/ultima/ultima1/core/debugger.cpp
+++ b/engines/ultima/ultima1/core/debugger.cpp
@@ -20,9 +20,9 @@
  */
 
 #include "ultima/ultima1/core/debugger.h"
-#include "ultima/shared/early/game.h"
-#include "ultima/shared/early/ultima_early.h"
-#include "ultima/shared/maps/map.h"
+#include "ultima/u1shared/early/game.h"
+#include "ultima/u1shared/early/ultima_early.h"
+#include "ultima/u1shared/maps/map.h"
 
 namespace Ultima {
 namespace Ultima1 {
diff --git a/engines/ultima/ultima1/core/game_state.h b/engines/ultima/ultima1/core/game_state.h
index 9b0453adf5a..dd6065f78b9 100644
--- a/engines/ultima/ultima1/core/game_state.h
+++ b/engines/ultima/ultima1/core/game_state.h
@@ -22,7 +22,7 @@
 #ifndef ULTIMA_ULTIMA1_CORE_GAME_STATE_H
 #define ULTIMA_ULTIMA1_CORE_GAME_STATE_H
 
-#include "ultima/shared/core/game_state.h"
+#include "ultima/u1shared/core/game_state.h"
 
 namespace Ultima {
 namespace Ultima1 {
diff --git a/engines/ultima/ultima1/core/party.h b/engines/ultima/ultima1/core/party.h
index f9c8006b29d..a16c2334142 100644
--- a/engines/ultima/ultima1/core/party.h
+++ b/engines/ultima/ultima1/core/party.h
@@ -22,7 +22,7 @@
 #ifndef ULTIMA_ULTIMA1_CORE_PARTY_H
 #define ULTIMA_ULTIMA1_CORE_PARTY_H
 
-#include "ultima/shared/core/party.h"
+#include "ultima/u1shared/core/party.h"
 #include "ultima/ultima1/spells/blink.h"
 #include "ultima/ultima1/spells/create.h"
 #include "ultima/ultima1/spells/destroy.h"
diff --git a/engines/ultima/ultima1/core/resources.h b/engines/ultima/ultima1/core/resources.h
index 088fa8b167f..a67fabd5691 100644
--- a/engines/ultima/ultima1/core/resources.h
+++ b/engines/ultima/ultima1/core/resources.h
@@ -22,7 +22,7 @@
 #ifndef ULTIMA_ULTIMA1_CORE_RESOURCES_H
 #define ULTIMA_ULTIMA1_CORE_RESOURCES_H
 
-#include "ultima/shared/engine/resources.h"
+#include "ultima/u1shared/engine/resources.h"
 
 namespace Ultima {
 namespace Ultima1 {
diff --git a/engines/ultima/ultima1/core/widget_player.h b/engines/ultima/ultima1/core/widget_player.h
index 0266d6711d4..a584e5c4e1f 100644
--- a/engines/ultima/ultima1/core/widget_player.h
+++ b/engines/ultima/ultima1/core/widget_player.h
@@ -22,7 +22,7 @@
 #ifndef ULTIMA_ULTIMA1_CORE_WIDGET_PLAYER_H
 #define ULTIMA_ULTIMA1_CORE_WIDGET_PLAYER_H
 
-#include "ultima/shared/core/map.h"
+#include "ultima/u1shared/core/map.h"
 
 namespace Ultima {
 namespace Ultima1 {
diff --git a/engines/ultima/ultima1/game.cpp b/engines/ultima/ultima1/game.cpp
index 15c329f0e90..08a76b840eb 100644
--- a/engines/ultima/ultima1/game.cpp
+++ b/engines/ultima/ultima1/game.cpp
@@ -29,10 +29,10 @@
 #include "ultima/ultima1/u1gfx/text_cursor.h"
 #include "ultima/ultima1/u6gfx/game_view.h"
 #include "ultima/ultima1/spells/prayer.h"
-#include "ultima/shared/early/font_resources.h"
-#include "ultima/shared/gfx/popup.h"
-#include "ultima/shared/engine/messages.h"
-#include "ultima/shared/early/ultima_early.h"
+#include "ultima/u1shared/early/font_resources.h"
+#include "ultima/u1shared/gfx/popup.h"
+#include "ultima/u1shared/engine/messages.h"
+#include "ultima/u1shared/early/ultima_early.h"
 
 namespace Ultima {
 namespace Ultima1 {
diff --git a/engines/ultima/ultima1/game.h b/engines/ultima/ultima1/game.h
index 886a23a328a..ccff385f761 100644
--- a/engines/ultima/ultima1/game.h
+++ b/engines/ultima/ultima1/game.h
@@ -22,8 +22,8 @@
 #ifndef ULTIMA_ULTIMA1_GAME_H
 #define ULTIMA_ULTIMA1_GAME_H
 
-#include "ultima/shared/early/game.h"
-#include "ultima/shared/gfx/visual_container.h"
+#include "ultima/u1shared/early/game.h"
+#include "ultima/u1shared/gfx/visual_container.h"
 #include "ultima/ultima1/core/quests.h"
 
 namespace Ultima {
diff --git a/engines/ultima/ultima1/maps/map.cpp b/engines/ultima/ultima1/maps/map.cpp
index db5d1bc6b16..22d7e8dd90b 100644
--- a/engines/ultima/ultima1/maps/map.cpp
+++ b/engines/ultima/ultima1/maps/map.cpp
@@ -26,8 +26,8 @@
 #include "ultima/ultima1/maps/map_tile.h"
 #include "ultima/ultima1/core/resources.h"
 #include "ultima/ultima1/game.h"
-#include "ultima/shared/core/file.h"
-#include "ultima/shared/early/ultima_early.h"
+#include "ultima/u1shared/core/file.h"
+#include "ultima/u1shared/early/ultima_early.h"
 
 namespace Ultima {
 namespace Ultima1 {
diff --git a/engines/ultima/ultima1/maps/map.h b/engines/ultima/ultima1/maps/map.h
index b4f37aee621..e6f86a9ad5d 100644
--- a/engines/ultima/ultima1/maps/map.h
+++ b/engines/ultima/ultima1/maps/map.h
@@ -22,8 +22,8 @@
 #ifndef ULTIMA_ULTIMA1_MAPS_MAP_H
 #define ULTIMA_ULTIMA1_MAPS_MAP_H
 
-#include "ultima/shared/maps/map.h"
-#include "ultima/shared/maps/map_widget.h"
+#include "ultima/u1shared/maps/map.h"
+#include "ultima/u1shared/maps/map_widget.h"
 #include "ultima/ultima1/maps/map_base.h"
 
 namespace Ultima {
diff --git a/engines/ultima/ultima1/maps/map_base.h b/engines/ultima/ultima1/maps/map_base.h
index 9b4eb1b69c9..9d11a485bd9 100644
--- a/engines/ultima/ultima1/maps/map_base.h
+++ b/engines/ultima/ultima1/maps/map_base.h
@@ -22,7 +22,7 @@
 #ifndef ULTIMA_ULTIMA1_MAPS_MAP_BASE_H
 #define ULTIMA_ULTIMA1_MAPS_MAP_BASE_H
 
-#include "ultima/shared/maps/map_base.h"
+#include "ultima/u1shared/maps/map_base.h"
 
 namespace Ultima {
 namespace Ultima1 {
diff --git a/engines/ultima/ultima1/maps/map_dungeon.h b/engines/ultima/ultima1/maps/map_dungeon.h
index e0422a5aa38..edd6dac5794 100644
--- a/engines/ultima/ultima1/maps/map_dungeon.h
+++ b/engines/ultima/ultima1/maps/map_dungeon.h
@@ -23,7 +23,7 @@
 #define ULTIMA_ULTIMA1_MAP_MAP_DUNGEON_H
 
 #include "ultima/ultima1/maps/map_base.h"
-#include "ultima/shared/core/rect.h"
+#include "ultima/u1shared/core/rect.h"
 #include "common/random.h"
 
 namespace Ultima {
diff --git a/engines/ultima/ultima1/maps/map_tile.h b/engines/ultima/ultima1/maps/map_tile.h
index 5c5d9538bda..b00a0967e73 100644
--- a/engines/ultima/ultima1/maps/map_tile.h
+++ b/engines/ultima/ultima1/maps/map_tile.h
@@ -22,7 +22,7 @@
 #ifndef ULTIMA_ULTIMA1_MAPS_MAP_TILE_H
 #define ULTIMA_ULTIMA1_MAPS_MAP_TILE_H
 
-#include "ultima/shared/maps/map_tile.h"
+#include "ultima/u1shared/maps/map_tile.h"
 
 namespace Ultima {
 namespace Ultima1 {
diff --git a/engines/ultima/ultima1/spells/kill_magic_missile.cpp b/engines/ultima/ultima1/spells/kill_magic_missile.cpp
index 7e3b33aa514..255b69465fe 100644
--- a/engines/ultima/ultima1/spells/kill_magic_missile.cpp
+++ b/engines/ultima/ultima1/spells/kill_magic_missile.cpp
@@ -25,7 +25,7 @@
 #include "ultima/ultima1/core/resources.h"
 #include "ultima/ultima1/maps/map_tile.h"
 #include "ultima/ultima1/widgets/dungeon_monster.h"
-#include "ultima/shared/maps/map_widget.h"
+#include "ultima/u1shared/maps/map_widget.h"
 
 namespace Ultima {
 namespace Ultima1 {
diff --git a/engines/ultima/ultima1/spells/kill_magic_missile.h b/engines/ultima/ultima1/spells/kill_magic_missile.h
index e58ba330feb..2d2fcb0ebac 100644
--- a/engines/ultima/ultima1/spells/kill_magic_missile.h
+++ b/engines/ultima/ultima1/spells/kill_magic_missile.h
@@ -23,7 +23,7 @@
 #define ULTIMA_ULTIMA1_U1DIALOGS_KILL_MAGIC_MISSILE_H
 
 #include "ultima/ultima1/spells/spell.h"
-#include "ultima/shared/engine/messages.h"
+#include "ultima/u1shared/engine/messages.h"
 
 namespace Ultima {
 namespace Ultima1 {
diff --git a/engines/ultima/ultima1/spells/spell.h b/engines/ultima/ultima1/spells/spell.h
index ac2f8409711..66b50e2ac7d 100644
--- a/engines/ultima/ultima1/spells/spell.h
+++ b/engines/ultima/ultima1/spells/spell.h
@@ -22,7 +22,7 @@
 #ifndef ULTIMA_ULTIMA1_U1DIALOGS_SPELL_H
 #define ULTIMA_ULTIMA1_U1DIALOGS_SPELL_H
 
-#include "ultima/shared/core/party.h"
+#include "ultima/u1shared/core/party.h"
 #include "ultima/ultima1/maps/map_base.h"
 #include "ultima/ultima1/maps/map_dungeon.h"
 
diff --git a/engines/ultima/ultima1/u1dialogs/armoury.cpp b/engines/ultima/ultima1/u1dialogs/armoury.cpp
index f8d64c9d3fe..431e8ca5b50 100644
--- a/engines/ultima/ultima1/u1dialogs/armoury.cpp
+++ b/engines/ultima/ultima1/u1dialogs/armoury.cpp
@@ -24,8 +24,8 @@
 #include "ultima/ultima1/core/resources.h"
 #include "ultima/ultima1/maps/map.h"
 #include "ultima/ultima1/game.h"
-#include "ultima/shared/engine/messages.h"
-#include "ultima/shared/core/str.h"
+#include "ultima/u1shared/engine/messages.h"
+#include "ultima/u1shared/core/str.h"
 
 namespace Ultima {
 namespace Ultima1 {
diff --git a/engines/ultima/ultima1/u1dialogs/buy_sell_dialog.cpp b/engines/ultima/ultima1/u1dialogs/buy_sell_dialog.cpp
index 376dac18025..42839962381 100644
--- a/engines/ultima/ultima1/u1dialogs/buy_sell_dialog.cpp
+++ b/engines/ultima/ultima1/u1dialogs/buy_sell_dialog.cpp
@@ -23,8 +23,8 @@
 #include "ultima/ultima1/game.h"
 #include "ultima/ultima1/core/resources.h"
 #include "ultima/ultima1/maps/map.h"
-#include "ultima/shared/core/str.h"
-#include "ultima/shared/gfx/visual_surface.h"
+#include "ultima/u1shared/core/str.h"
+#include "ultima/u1shared/gfx/visual_surface.h"
 
 namespace Ultima {
 namespace Ultima1 {
diff --git a/engines/ultima/ultima1/u1dialogs/buy_sell_dialog.h b/engines/ultima/ultima1/u1dialogs/buy_sell_dialog.h
index 0747edcbd09..ab439fa71e7 100644
--- a/engines/ultima/ultima1/u1dialogs/buy_sell_dialog.h
+++ b/engines/ultima/ultima1/u1dialogs/buy_sell_dialog.h
@@ -23,7 +23,7 @@
 #define ULTIMA_ULTIMA1_U1DIALOGS_BUY_SELL_DIALOG_H
 
 #include "ultima/ultima1/u1dialogs/dialog.h"
-#include "ultima/shared/gfx/character_input.h"
+#include "ultima/u1shared/gfx/character_input.h"
 
 namespace Ultima {
 namespace Ultima1 {
diff --git a/engines/ultima/ultima1/u1dialogs/combat.cpp b/engines/ultima/ultima1/u1dialogs/combat.cpp
index 42ae731ff84..92652a5573d 100644
--- a/engines/ultima/ultima1/u1dialogs/combat.cpp
+++ b/engines/ultima/ultima1/u1dialogs/combat.cpp
@@ -23,8 +23,8 @@
 #include "ultima/ultima1/game.h"
 #include "ultima/ultima1/core/resources.h"
 #include "ultima/ultima1/maps/map.h"
-#include "ultima/shared/gfx/text_cursor.h"
-#include "ultima/shared/engine/messages.h"
+#include "ultima/u1shared/gfx/text_cursor.h"
+#include "ultima/u1shared/engine/messages.h"
 
 namespace Ultima {
 namespace Ultima1 {
diff --git a/engines/ultima/ultima1/u1dialogs/combat.h b/engines/ultima/ultima1/u1dialogs/combat.h
index e51a5b37c3f..7f5467c86dd 100644
--- a/engines/ultima/ultima1/u1dialogs/combat.h
+++ b/engines/ultima/ultima1/u1dialogs/combat.h
@@ -23,7 +23,7 @@
 #define ULTIMA_ULTIMA1_U1DIALOGS_COMBAT_H
 
 #include "ultima/ultima1/u1dialogs/full_screen_dialog.h"
-#include "ultima/shared/maps/map_widget.h"
+#include "ultima/u1shared/maps/map_widget.h"
 
 namespace Ultima {
 namespace Ultima1 {
diff --git a/engines/ultima/ultima1/u1dialogs/dialog.h b/engines/ultima/ultima1/u1dialogs/dialog.h
index 9d86347346f..9fb90a64fc9 100644
--- a/engines/ultima/ultima1/u1dialogs/dialog.h
+++ b/engines/ultima/ultima1/u1dialogs/dialog.h
@@ -22,9 +22,9 @@
 #ifndef ULTIMA_ULTIMA1_U1DIALOGS_DIALOG_H
 #define ULTIMA_ULTIMA1_U1DIALOGS_DIALOG_H
 
-#include "ultima/shared/gfx/popup.h"
-#include "ultima/shared/gfx/character_input.h"
-#include "ultima/shared/core/str.h"
+#include "ultima/u1shared/gfx/popup.h"
+#include "ultima/u1shared/gfx/character_input.h"
+#include "ultima/u1shared/core/str.h"
 
 namespace Ultima {
 namespace Ultima1 {
diff --git a/engines/ultima/ultima1/u1dialogs/drop.cpp b/engines/ultima/ultima1/u1dialogs/drop.cpp
index 08610d65e01..fad1e0586a0 100644
--- a/engines/ultima/ultima1/u1dialogs/drop.cpp
+++ b/engines/ultima/ultima1/u1dialogs/drop.cpp
@@ -23,7 +23,7 @@
 #include "ultima/ultima1/game.h"
 #include "ultima/ultima1/core/resources.h"
 #include "ultima/ultima1/maps/map.h"
-#include "ultima/shared/engine/messages.h"
+#include "ultima/u1shared/engine/messages.h"
 
 namespace Ultima {
 namespace Ultima1 {
diff --git a/engines/ultima/ultima1/u1dialogs/drop.h b/engines/ultima/ultima1/u1dialogs/drop.h
index b51793c753f..8c5101461d4 100644
--- a/engines/ultima/ultima1/u1dialogs/drop.h
+++ b/engines/ultima/ultima1/u1dialogs/drop.h
@@ -23,7 +23,7 @@
 #define ULTIMA_ULTIMA1_U1DIALOGS_DROP_H
 
 #include "ultima/ultima1/u1dialogs/full_screen_dialog.h"
-#include "ultima/shared/gfx/text_input.h"
+#include "ultima/u1shared/gfx/text_input.h"
 
 namespace Ultima {
 namespace Ultima1 {
diff --git a/engines/ultima/ultima1/u1dialogs/grocery.cpp b/engines/ultima/ultima1/u1dialogs/grocery.cpp
index 422efcbd107..b7d4d0da841 100644
--- a/engines/ultima/ultima1/u1dialogs/grocery.cpp
+++ b/engines/ultima/ultima1/u1dialogs/grocery.cpp
@@ -22,8 +22,8 @@
 #include "ultima/ultima1/u1dialogs/grocery.h"
 #include "ultima/ultima1/core/resources.h"
 #include "ultima/ultima1/game.h"
-#include "ultima/shared/core/str.h"
-#include "ultima/shared/engine/messages.h"
+#include "ultima/u1shared/core/str.h"
+#include "ultima/u1shared/engine/messages.h"
 
 namespace Ultima {
 namespace Ultima1 {
diff --git a/engines/ultima/ultima1/u1dialogs/king.cpp b/engines/ultima/ultima1/u1dialogs/king.cpp
index 8f4c44da815..008205d9d5a 100644
--- a/engines/ultima/ultima1/u1dialogs/king.cpp
+++ b/engines/ultima/ultima1/u1dialogs/king.cpp
@@ -23,7 +23,7 @@
 #include "ultima/ultima1/game.h"
 #include "ultima/ultima1/core/resources.h"
 #include "ultima/ultima1/maps/map.h"
-#include "ultima/shared/gfx/visual_surface.h"
+#include "ultima/u1shared/gfx/visual_surface.h"
 
 namespace Ultima {
 namespace Ultima1 {
diff --git a/engines/ultima/ultima1/u1dialogs/king.h b/engines/ultima/ultima1/u1dialogs/king.h
index 5ff534a2e5b..bdba396dc25 100644
--- a/engines/ultima/ultima1/u1dialogs/king.h
+++ b/engines/ultima/ultima1/u1dialogs/king.h
@@ -23,7 +23,7 @@
 #define ULTIMA_ULTIMA1_U1DIALOGS_KING_H
 
 #include "ultima/ultima1/u1dialogs/dialog.h"
-#include "ultima/shared/gfx/character_input.h"
+#include "ultima/u1shared/gfx/character_input.h"
 
 namespace Ultima {
 namespace Ultima1 {
diff --git a/engines/ultima/ultima1/u1dialogs/magic.cpp b/engines/ultima/ultima1/u1dialogs/magic.cpp
index 1caed4072b0..ee82feaa5e5 100644
--- a/engines/ultima/ultima1/u1dialogs/magic.cpp
+++ b/engines/ultima/ultima1/u1dialogs/magic.cpp
@@ -24,8 +24,8 @@
 #include "ultima/ultima1/core/resources.h"
 #include "ultima/ultima1/maps/map.h"
 #include "ultima/ultima1/game.h"
-#include "ultima/shared/engine/messages.h"
-#include "ultima/shared/core/str.h"
+#include "ultima/u1shared/engine/messages.h"
+#include "ultima/u1shared/core/str.h"
 
 namespace Ultima {
 namespace Ultima1 {
diff --git a/engines/ultima/ultima1/u1dialogs/ready.cpp b/engines/ultima/ultima1/u1dialogs/ready.cpp
index 51d31865656..ab3596cda16 100644
--- a/engines/ultima/ultima1/u1dialogs/ready.cpp
+++ b/engines/ultima/ultima1/u1dialogs/ready.cpp
@@ -23,8 +23,8 @@
 #include "ultima/ultima1/game.h"
 #include "ultima/ultima1/core/resources.h"
 #include "ultima/ultima1/maps/map.h"
-#include "ultima/shared/gfx/text_cursor.h"
-#include "ultima/shared/engine/messages.h"
+#include "ultima/u1shared/gfx/text_cursor.h"
+#include "ultima/u1shared/engine/messages.h"
 
 namespace Ultima {
 namespace Ultima1 {
diff --git a/engines/ultima/ultima1/u1dialogs/stats.cpp b/engines/ultima/ultima1/u1dialogs/stats.cpp
index 7a0c3a2b69d..b67a1bd7ed6 100644
--- a/engines/ultima/ultima1/u1dialogs/stats.cpp
+++ b/engines/ultima/ultima1/u1dialogs/stats.cpp
@@ -26,7 +26,7 @@
 #include "ultima/ultima1/maps/map.h"
 #include "ultima/ultima1/widgets/transport.h"
 #include "ultima/ultima1/u1gfx/drawing_support.h"
-#include "ultima/shared/engine/messages.h"
+#include "ultima/u1shared/engine/messages.h"
 
 namespace Ultima {
 namespace Ultima1 {
diff --git a/engines/ultima/ultima1/u1dialogs/tavern.cpp b/engines/ultima/ultima1/u1dialogs/tavern.cpp
index c09750a0d49..0b25b18e3d7 100644
--- a/engines/ultima/ultima1/u1dialogs/tavern.cpp
+++ b/engines/ultima/ultima1/u1dialogs/tavern.cpp
@@ -25,8 +25,8 @@
 #include "ultima/ultima1/maps/map.h"
 #include "ultima/ultima1/maps/map_city_castle.h"
 #include "ultima/ultima1/game.h"
-#include "ultima/shared/engine/messages.h"
-#include "ultima/shared/core/str.h"
+#include "ultima/u1shared/engine/messages.h"
+#include "ultima/u1shared/core/str.h"
 
 namespace Ultima {
 namespace Ultima1 {
diff --git a/engines/ultima/ultima1/u1dialogs/transports.cpp b/engines/ultima/ultima1/u1dialogs/transports.cpp
index 34b009e0477..aa7a665c6b4 100644
--- a/engines/ultima/ultima1/u1dialogs/transports.cpp
+++ b/engines/ultima/ultima1/u1dialogs/transports.cpp
@@ -28,8 +28,8 @@
 #include "ultima/ultima1/maps/map_tile.h"
 #include "ultima/ultima1/widgets/transport.h"
 #include "ultima/ultima1/game.h"
-#include "ultima/shared/engine/messages.h"
-#include "ultima/shared/core/str.h"
+#include "ultima/u1shared/engine/messages.h"
+#include "ultima/u1shared/core/str.h"
 
 namespace Ultima {
 namespace Ultima1 {
diff --git a/engines/ultima/ultima1/u1dialogs/weaponry.cpp b/engines/ultima/ultima1/u1dialogs/weaponry.cpp
index 8805fd0c4ec..f56f1b53ff7 100644
--- a/engines/ultima/ultima1/u1dialogs/weaponry.cpp
+++ b/engines/ultima/ultima1/u1dialogs/weaponry.cpp
@@ -24,8 +24,8 @@
 #include "ultima/ultima1/core/resources.h"
 #include "ultima/ultima1/maps/map.h"
 #include "ultima/ultima1/game.h"
-#include "ultima/shared/engine/messages.h"
-#include "ultima/shared/core/str.h"
+#include "ultima/u1shared/engine/messages.h"
+#include "ultima/u1shared/core/str.h"
 
 namespace Ultima {
 namespace Ultima1 {
diff --git a/engines/ultima/ultima1/u1gfx/drawing_support.cpp b/engines/ultima/ultima1/u1gfx/drawing_support.cpp
index 84d92e04ca7..27f0a245cd5 100644
--- a/engines/ultima/ultima1/u1gfx/drawing_support.cpp
+++ b/engines/ultima/ultima1/u1gfx/drawing_support.cpp
@@ -21,7 +21,7 @@
 
 #include "ultima/ultima1/u1gfx/drawing_support.h"
 #include "ultima/ultima1/game.h"
-#include "ultima/shared/early/ultima_early.h"
+#include "ultima/u1shared/early/ultima_early.h"
 
 namespace Ultima {
 namespace Ultima1 {
diff --git a/engines/ultima/ultima1/u1gfx/drawing_support.h b/engines/ultima/ultima1/u1gfx/drawing_support.h
index d562ab12998..aeea2b91e80 100644
--- a/engines/ultima/ultima1/u1gfx/drawing_support.h
+++ b/engines/ultima/ultima1/u1gfx/drawing_support.h
@@ -22,7 +22,7 @@
 #ifndef ULTIMA_ULTIMA1_U1GFX_DRAWING_SUPPORT_H
 #define ULTIMA_ULTIMA1_U1GFX_DRAWING_SUPPORT_H
 
-#include "ultima/shared/gfx/visual_surface.h"
+#include "ultima/u1shared/gfx/visual_surface.h"
 
 namespace Ultima {
 namespace Ultima1 {
diff --git a/engines/ultima/ultima1/u1gfx/info.cpp b/engines/ultima/ultima1/u1gfx/info.cpp
index 713ce2bc3b0..c2b9934bc6f 100644
--- a/engines/ultima/ultima1/u1gfx/info.cpp
+++ b/engines/ultima/ultima1/u1gfx/info.cpp
@@ -21,7 +21,7 @@
 
 #include "ultima/ultima1/u1gfx/info.h"
 #include "ultima/ultima1/u1gfx/drawing_support.h"
-#include "ultima/shared/early/game.h"
+#include "ultima/u1shared/early/game.h"
 
 namespace Ultima {
 namespace Ultima1 {
diff --git a/engines/ultima/ultima1/u1gfx/info.h b/engines/ultima/ultima1/u1gfx/info.h
index 691bd1a79ee..4b22239f73c 100644
--- a/engines/ultima/ultima1/u1gfx/info.h
+++ b/engines/ultima/ultima1/u1gfx/info.h
@@ -22,7 +22,7 @@
 #ifndef ULTIMA_ULTIMA1_GFX_INFO_H
 #define ULTIMA_ULTIMA1_GFX_INFO_H
 
-#include "ultima/shared/gfx/info.h"
+#include "ultima/u1shared/gfx/info.h"
 
 namespace Ultima {
 namespace Ultima1 {
diff --git a/engines/ultima/ultima1/u1gfx/sprites.cpp b/engines/ultima/ultima1/u1gfx/sprites.cpp
index 0d12a5edd98..01107a21f49 100644
--- a/engines/ultima/ultima1/u1gfx/sprites.cpp
+++ b/engines/ultima/ultima1/u1gfx/sprites.cpp
@@ -20,8 +20,8 @@
  */
 
 #include "ultima/ultima1/u1gfx/sprites.h"
-#include "ultima/shared/early/ultima_early.h"
-#include "ultima/shared/early/game.h"
+#include "ultima/u1shared/early/ultima_early.h"
+#include "ultima/u1shared/early/game.h"
 
 namespace Ultima {
 namespace Ultima1 {
diff --git a/engines/ultima/ultima1/u1gfx/sprites.h b/engines/ultima/ultima1/u1gfx/sprites.h
index 3242db26456..cd7e68f5948 100644
--- a/engines/ultima/ultima1/u1gfx/sprites.h
+++ b/engines/ultima/ultima1/u1gfx/sprites.h
@@ -22,10 +22,10 @@
 #ifndef ULTIMA_ULTIMA1_U1GFX_SPRITES_H
 #define ULTIMA_ULTIMA1_U1GFX_SPRITES_H
 
-#include "ultima/shared/gfx/sprites.h"
-#include "ultima/shared/core/tree_item.h"
-#include "ultima/shared/early/ultima_early.h"
-#include "ultima/shared/engine/messages.h"
+#include "ultima/u1shared/gfx/sprites.h"
+#include "ultima/u1shared/core/tree_item.h"
+#include "ultima/u1shared/early/ultima_early.h"
+#include "ultima/u1shared/engine/messages.h"
 
 namespace Ultima {
 namespace Ultima1 {
diff --git a/engines/ultima/ultima1/u1gfx/status.h b/engines/ultima/ultima1/u1gfx/status.h
index 4f8b8d5f4e3..e0309bf1fb6 100644
--- a/engines/ultima/ultima1/u1gfx/status.h
+++ b/engines/ultima/ultima1/u1gfx/status.h
@@ -22,7 +22,7 @@
 #ifndef ULTIMA_ULTIMA1_U1GFX_STATUS_H
 #define ULTIMA_ULTIMA1_U1GFX_STATUS_H
 
-#include "ultima/shared/gfx/visual_item.h"
+#include "ultima/u1shared/gfx/visual_item.h"
 
 namespace Ultima {
 namespace Ultima1 {
diff --git a/engines/ultima/ultima1/u1gfx/text_cursor.cpp b/engines/ultima/ultima1/u1gfx/text_cursor.cpp
index d9c01922d2e..1f762724d8b 100644
--- a/engines/ultima/ultima1/u1gfx/text_cursor.cpp
+++ b/engines/ultima/ultima1/u1gfx/text_cursor.cpp
@@ -20,8 +20,8 @@
  */
 
 #include "ultima/ultima1/u1gfx/text_cursor.h"
-#include "ultima/shared/early/ultima_early.h"
-#include "ultima/shared/gfx/screen.h"
+#include "ultima/u1shared/early/ultima_early.h"
+#include "ultima/u1shared/gfx/screen.h"
 #include "common/system.h"
 #include "graphics/managed_surface.h"
 
diff --git a/engines/ultima/ultima1/u1gfx/text_cursor.h b/engines/ultima/ultima1/u1gfx/text_cursor.h
index d73876a660c..dee4b7fda68 100644
--- a/engines/ultima/ultima1/u1gfx/text_cursor.h
+++ b/engines/ultima/ultima1/u1gfx/text_cursor.h
@@ -22,7 +22,7 @@
 #ifndef ULTIMA_ULTIMA1_U1GFX_TEXT_CURSOR_H
 #define ULTIMA_ULTIMA1_U1GFX_TEXT_CURSOR_H
 
-#include "ultima/shared/gfx/text_cursor.h"
+#include "ultima/u1shared/gfx/text_cursor.h"
 
 namespace Ultima {
 namespace Ultima1 {
diff --git a/engines/ultima/ultima1/u1gfx/view_char_gen.cpp b/engines/ultima/ultima1/u1gfx/view_char_gen.cpp
index 90df8eef585..a80e5cec5f9 100644
--- a/engines/ultima/ultima1/u1gfx/view_char_gen.cpp
+++ b/engines/ultima/ultima1/u1gfx/view_char_gen.cpp
@@ -25,9 +25,9 @@
 #include "ultima/ultima1/maps/map.h"
 #include "ultima/ultima1/u1gfx/text_cursor.h"
 #include "ultima/ultima1/game.h"
-#include "ultima/shared/gfx/text_input.h"
-#include "ultima/shared/early/font_resources.h"
-#include "ultima/shared/early/ultima_early.h"
+#include "ultima/u1shared/gfx/text_input.h"
+#include "ultima/u1shared/early/font_resources.h"
+#include "ultima/u1shared/early/ultima_early.h"
 
 namespace Ultima {
 namespace Ultima1 {
diff --git a/engines/ultima/ultima1/u1gfx/view_char_gen.h b/engines/ultima/ultima1/u1gfx/view_char_gen.h
index 2d2a95b4027..11caf1085bb 100644
--- a/engines/ultima/ultima1/u1gfx/view_char_gen.h
+++ b/engines/ultima/ultima1/u1gfx/view_char_gen.h
@@ -22,9 +22,9 @@
 #ifndef ULTIMA_ULTIMA1_GFX_VIEW_CHAR_GEN_H
 #define ULTIMA_ULTIMA1_GFX_VIEW_CHAR_GEN_H
 
-#include "ultima/shared/gfx/visual_container.h"
-#include "ultima/shared/gfx/text_input.h"
-#include "ultima/shared/core/party.h"
+#include "ultima/u1shared/gfx/visual_container.h"
+#include "ultima/u1shared/gfx/text_input.h"
+#include "ultima/u1shared/core/party.h"
 #include "graphics/managed_surface.h"
 
 namespace Ultima {
diff --git a/engines/ultima/ultima1/u1gfx/view_game.cpp b/engines/ultima/ultima1/u1gfx/view_game.cpp
index 597bef83d94..496a0a3c2f8 100644
--- a/engines/ultima/ultima1/u1gfx/view_game.cpp
+++ b/engines/ultima/ultima1/u1gfx/view_game.cpp
@@ -20,9 +20,9 @@
  */
 
 #include "ultima/ultima1/u1gfx/view_game.h"
-#include "ultima/shared/actions/huh.h"
-#include "ultima/shared/actions/pass.h"
-#include "ultima/shared/maps/map.h"
+#include "ultima/u1shared/actions/huh.h"
+#include "ultima/u1shared/actions/pass.h"
+#include "ultima/u1shared/maps/map.h"
 #include "ultima/ultima1/game.h"
 #include "ultima/ultima1/u1gfx/drawing_support.h"
 #include "ultima/ultima1/u1gfx/info.h"
@@ -36,8 +36,8 @@
 #include "ultima/ultima1/actions/ready.h"
 #include "ultima/ultima1/actions/stats.h"
 #include "ultima/ultima1/core/resources.h"
-#include "ultima/shared/gfx/text_cursor.h"
-#include "ultima/shared/engine/messages.h"
+#include "ultima/u1shared/gfx/text_cursor.h"
+#include "ultima/u1shared/engine/messages.h"
 
 namespace Ultima {
 namespace Ultima1 {
diff --git a/engines/ultima/ultima1/u1gfx/view_game.h b/engines/ultima/ultima1/u1gfx/view_game.h
index d7025b6a108..1ce24b1089f 100644
--- a/engines/ultima/ultima1/u1gfx/view_game.h
+++ b/engines/ultima/ultima1/u1gfx/view_game.h
@@ -22,8 +22,8 @@
 #ifndef ULTIMA_ULTIMA1_GFX_VIEW_GAME_H
 #define ULTIMA_ULTIMA1_GFX_VIEW_GAME_H
 
-#include "ultima/shared/gfx/visual_container.h"
-#include "ultima/shared/gfx/bitmap.h"
+#include "ultima/u1shared/gfx/visual_container.h"
+#include "ultima/u1shared/gfx/bitmap.h"
 
 namespace Ultima {
 
diff --git a/engines/ultima/ultima1/u1gfx/view_title.cpp b/engines/ultima/ultima1/u1gfx/view_title.cpp
index 9c05b2f1e5e..7650de352fa 100644
--- a/engines/ultima/ultima1/u1gfx/view_title.cpp
+++ b/engines/ultima/ultima1/u1gfx/view_title.cpp
@@ -23,10 +23,10 @@
 #include "ultima/ultima1/u1gfx/drawing_support.h"
 #include "ultima/ultima1/core/resources.h"
 #include "ultima/ultima1/game.h"
-#include "ultima/shared/core/file.h"
-#include "ultima/shared/gfx/text_cursor.h"
-#include "ultima/shared/early/font_resources.h"
-#include "ultima/shared/early/ultima_early.h"
+#include "ultima/u1shared/core/file.h"
+#include "ultima/u1shared/gfx/text_cursor.h"
+#include "ultima/u1shared/early/font_resources.h"
+#include "ultima/u1shared/early/ultima_early.h"
 #include "graphics/blit.h"
 #include "image/xbm.h"
 
diff --git a/engines/ultima/ultima1/u1gfx/view_title.h b/engines/ultima/ultima1/u1gfx/view_title.h
index 6d31dc41a2e..5de88e0785e 100644
--- a/engines/ultima/ultima1/u1gfx/view_title.h
+++ b/engines/ultima/ultima1/u1gfx/view_title.h
@@ -22,8 +22,8 @@
 #ifndef ULTIMA_ULTIMA1_GFX_VIEW_MAP_H
 #define ULTIMA_ULTIMA1_GFX_VIEW_MAP_H
 
-#include "ultima/shared/gfx/visual_container.h"
-#include "ultima/shared/gfx/bitmap.h"
+#include "ultima/u1shared/gfx/visual_container.h"
+#include "ultima/u1shared/gfx/bitmap.h"
 #include "graphics/managed_surface.h"
 
 namespace Ultima {
diff --git a/engines/ultima/ultima1/u1gfx/viewport_dungeon.cpp b/engines/ultima/ultima1/u1gfx/viewport_dungeon.cpp
index ff0c6ae50c6..4934b7fc49b 100644
--- a/engines/ultima/ultima1/u1gfx/viewport_dungeon.cpp
+++ b/engines/ultima/ultima1/u1gfx/viewport_dungeon.cpp
@@ -21,7 +21,7 @@
 
 #include "ultima/ultima1/u1gfx/viewport_dungeon.h"
 #include "ultima/ultima1/widgets/dungeon_widget.h"
-#include "ultima/shared/early/ultima_early.h"
+#include "ultima/u1shared/early/ultima_early.h"
 
 namespace Ultima {
 namespace Ultima1 {
diff --git a/engines/ultima/ultima1/u1gfx/viewport_dungeon.h b/engines/ultima/ultima1/u1gfx/viewport_dungeon.h
index ac9741dfa72..b5c9cd4562d 100644
--- a/engines/ultima/ultima1/u1gfx/viewport_dungeon.h
+++ b/engines/ultima/ultima1/u1gfx/viewport_dungeon.h
@@ -22,7 +22,7 @@
 #ifndef ULTIMA_ULTIMA1_U1GFX_VIEWPORT_DUNGEON_H
 #define ULTIMA_ULTIMA1_U1GFX_VIEWPORT_DUNGEON_H
 
-#include "ultima/shared/gfx/viewport_dungeon.h"
+#include "ultima/u1shared/gfx/viewport_dungeon.h"
 
 namespace Ultima {
 namespace Ultima1 {
diff --git a/engines/ultima/ultima1/u1gfx/viewport_map.h b/engines/ultima/ultima1/u1gfx/viewport_map.h
index bf5aeb70876..dd166cd9581 100644
--- a/engines/ultima/ultima1/u1gfx/viewport_map.h
+++ b/engines/ultima/ultima1/u1gfx/viewport_map.h
@@ -22,7 +22,7 @@
 #ifndef ULTIMA_ULTIMA1_GFX_VIEWPORT_MAP_H
 #define ULTIMA_ULTIMA1_GFX_VIEWPORT_MAP_H
 
-#include "ultima/shared/gfx/viewport_map.h"
+#include "ultima/u1shared/gfx/viewport_map.h"
 #include "ultima/ultima1/maps/map.h"
 
 namespace Ultima {
diff --git a/engines/ultima/ultima1/u6gfx/game_view.cpp b/engines/ultima/ultima1/u6gfx/game_view.cpp
index d4a4b1369b4..f9df0725ffd 100644
--- a/engines/ultima/ultima1/u6gfx/game_view.cpp
+++ b/engines/ultima/ultima1/u6gfx/game_view.cpp
@@ -20,9 +20,9 @@
  */
 
 #include "ultima/ultima1/u6gfx/game_view.h"
-#include "ultima/shared/actions/pass.h"
-#include "ultima/shared/maps/map.h"
-#include "ultima/shared/gfx/info.h"
+#include "ultima/u1shared/actions/pass.h"
+#include "ultima/u1shared/maps/map.h"
+#include "ultima/u1shared/gfx/info.h"
 #include "ultima/ultima1/game.h"
 #include "ultima/ultima1/u1gfx/drawing_support.h"
 #include "ultima/ultima1/u1gfx/status.h"
@@ -30,8 +30,8 @@
 #include "ultima/ultima1/u1gfx/viewport_map.h"
 #include "ultima/ultima1/actions/move.h"
 #include "ultima/ultima1/core/resources.h"
-#include "ultima/shared/engine/messages.h"
-#include "ultima/shared/gfx/bitmap.h"
+#include "ultima/u1shared/engine/messages.h"
+#include "ultima/u1shared/gfx/bitmap.h"
 
 namespace Ultima {
 namespace Ultima1 {
diff --git a/engines/ultima/ultima1/u6gfx/game_view.h b/engines/ultima/ultima1/u6gfx/game_view.h
index def0ce3fd23..75bf93e6ad1 100644
--- a/engines/ultima/ultima1/u6gfx/game_view.h
+++ b/engines/ultima/ultima1/u6gfx/game_view.h
@@ -22,7 +22,7 @@
 #ifndef ULTIMA_ULTIMA1_U6GFX_GAME_VIEW_H
 #define ULTIMA_ULTIMA1_U6GFX_GAME_VIEW_H
 
-#include "ultima/shared/gfx/visual_container.h"
+#include "ultima/u1shared/gfx/visual_container.h"
 
 namespace Ultima {
 namespace Shared {
diff --git a/engines/ultima/ultima1/widgets/attack_effect.h b/engines/ultima/ultima1/widgets/attack_effect.h
index 50b72468321..022a6e45e52 100644
--- a/engines/ultima/ultima1/widgets/attack_effect.h
+++ b/engines/ultima/ultima1/widgets/attack_effect.h
@@ -22,7 +22,7 @@
 #ifndef ULTIMA_ULTIMA1_WIDGETS_HIT_H
 #define ULTIMA_ULTIMA1_WIDGETS_HIT_H
 
-#include "ultima/shared/maps/map_widget.h"
+#include "ultima/u1shared/maps/map_widget.h"
 
 namespace Ultima {
 namespace Ultima1 {
diff --git a/engines/ultima/ultima1/widgets/dungeon_monster.cpp b/engines/ultima/ultima1/widgets/dungeon_monster.cpp
index 058bd42f5e1..b7c07501548 100644
--- a/engines/ultima/ultima1/widgets/dungeon_monster.cpp
+++ b/engines/ultima/ultima1/widgets/dungeon_monster.cpp
@@ -25,8 +25,8 @@
 #include "ultima/ultima1/maps/map_tile.h"
 #include "ultima/ultima1/core/resources.h"
 #include "ultima/ultima1/game.h"
-#include "ultima/shared/core/utils.h"
-#include "ultima/shared/early/ultima_early.h"
+#include "ultima/u1shared/core/utils.h"
+#include "ultima/u1shared/early/ultima_early.h"
 
 namespace Ultima {
 namespace Ultima1 {
diff --git a/engines/ultima/ultima1/widgets/dungeon_monster.h b/engines/ultima/ultima1/widgets/dungeon_monster.h
index f4f886149ea..31434a00bc0 100644
--- a/engines/ultima/ultima1/widgets/dungeon_monster.h
+++ b/engines/ultima/ultima1/widgets/dungeon_monster.h
@@ -23,8 +23,8 @@
 #define ULTIMA_ULTIMA1_WIDGETS_DUNGEON_MONSTER_H
 
 #include "ultima/ultima1/widgets/dungeon_widget.h"
-#include "ultima/shared/maps/creature.h"
-#include "ultima/shared/maps/dungeon_creature.h"
+#include "ultima/u1shared/maps/creature.h"
+#include "ultima/u1shared/maps/dungeon_creature.h"
 
 namespace Ultima {
 namespace Ultima1 {
diff --git a/engines/ultima/ultima1/widgets/dungeon_player.h b/engines/ultima/ultima1/widgets/dungeon_player.h
index 0f3bb8f8f6b..149454f546d 100644
--- a/engines/ultima/ultima1/widgets/dungeon_player.h
+++ b/engines/ultima/ultima1/widgets/dungeon_player.h
@@ -22,9 +22,9 @@
 #ifndef ULTIMA_ULTIMA1_WIDGETS_DUNGEON_PLAYER_H
 #define ULTIMA_ULTIMA1_WIDGETS_DUNGEON_PLAYER_H
 
-#include "ultima/shared/maps/dungeon_widget.h"
-#include "ultima/shared/maps/map_widget.h"
-#include "ultima/shared/early/game.h"
+#include "ultima/u1shared/maps/dungeon_widget.h"
+#include "ultima/u1shared/maps/map_widget.h"
+#include "ultima/u1shared/early/game.h"
 
 namespace Ultima {
 namespace Ultima1 {
diff --git a/engines/ultima/ultima1/widgets/dungeon_widget.cpp b/engines/ultima/ultima1/widgets/dungeon_widget.cpp
index 1e2ceed463e..235578241c4 100644
--- a/engines/ultima/ultima1/widgets/dungeon_widget.cpp
+++ b/engines/ultima/ultima1/widgets/dungeon_widget.cpp
@@ -23,7 +23,7 @@
 #include "ultima/ultima1/core/resources.h"
 #include "ultima/ultima1/maps/map_base.h"
 #include "ultima/ultima1/game.h"
-#include "ultima/shared/early/ultima_early.h"
+#include "ultima/u1shared/early/ultima_early.h"
 
 namespace Ultima {
 namespace Ultima1 {
diff --git a/engines/ultima/ultima1/widgets/dungeon_widget.h b/engines/ultima/ultima1/widgets/dungeon_widget.h
index e89012ca470..74160671afd 100644
--- a/engines/ultima/ultima1/widgets/dungeon_widget.h
+++ b/engines/ultima/ultima1/widgets/dungeon_widget.h
@@ -22,8 +22,8 @@
 #ifndef ULTIMA_ULTIMA1_WIDGETS_DUNGEON_WIDGET_H
 #define ULTIMA_ULTIMA1_WIDGETS_DUNGEON_WIDGET_H
 
-#include "ultima/shared/maps/map.h"
-#include "ultima/shared/maps/dungeon_widget.h"
+#include "ultima/u1shared/maps/map.h"
+#include "ultima/u1shared/maps/dungeon_widget.h"
 
 namespace Ultima {
 namespace Ultima1 {
diff --git a/engines/ultima/ultima1/widgets/guard.cpp b/engines/ultima/ultima1/widgets/guard.cpp
index 8608b4f2aeb..3b634f54160 100644
--- a/engines/ultima/ultima1/widgets/guard.cpp
+++ b/engines/ultima/ultima1/widgets/guard.cpp
@@ -21,7 +21,7 @@
 
 #include "ultima/ultima1/widgets/guard.h"
 #include "ultima/ultima1/core/resources.h"
-#include "ultima/shared/core/utils.h"
+#include "ultima/u1shared/core/utils.h"
 
 namespace Ultima {
 namespace Ultima1 {
diff --git a/engines/ultima/ultima1/widgets/overworld_monster.cpp b/engines/ultima/ultima1/widgets/overworld_monster.cpp
index 8f0b756af6a..84c0072eae5 100644
--- a/engines/ultima/ultima1/widgets/overworld_monster.cpp
+++ b/engines/ultima/ultima1/widgets/overworld_monster.cpp
@@ -24,8 +24,8 @@
 #include "ultima/ultima1/core/party.h"
 #include "ultima/ultima1/core/resources.h"
 #include "ultima/ultima1/game.h"
-#include "ultima/shared/maps/map_widget.h"
-#include "ultima/shared/core/utils.h"
+#include "ultima/u1shared/maps/map_widget.h"
+#include "ultima/u1shared/core/utils.h"
 
 namespace Ultima {
 namespace Ultima1 {
diff --git a/engines/ultima/ultima1/widgets/overworld_monster.h b/engines/ultima/ultima1/widgets/overworld_monster.h
index 998e94bb4be..b9c7a55db85 100644
--- a/engines/ultima/ultima1/widgets/overworld_monster.h
+++ b/engines/ultima/ultima1/widgets/overworld_monster.h
@@ -23,7 +23,7 @@
 #define ULTIMA_ULTIMA1_WIDGETS_OVERWORLD_MONSTER_H
 
 #include "ultima/ultima1/widgets/overworld_widget.h"
-#include "ultima/shared/maps/creature.h"
+#include "ultima/u1shared/maps/creature.h"
 
 namespace Ultima {
 namespace Ultima1 {
diff --git a/engines/ultima/ultima1/widgets/overworld_widget.cpp b/engines/ultima/ultima1/widgets/overworld_widget.cpp
index f327554cafd..3465ac58434 100644
--- a/engines/ultima/ultima1/widgets/overworld_widget.cpp
+++ b/engines/ultima/ultima1/widgets/overworld_widget.cpp
@@ -24,7 +24,7 @@
 #include "ultima/ultima1/maps/map_tile.h"
 #include "ultima/ultima1/core/resources.h"
 #include "ultima/ultima1/game.h"
-#include "ultima/shared/early/ultima_early.h"
+#include "ultima/u1shared/early/ultima_early.h"
 
 namespace Ultima {
 namespace Ultima1 {
diff --git a/engines/ultima/ultima1/widgets/overworld_widget.h b/engines/ultima/ultima1/widgets/overworld_widget.h
index 88959e9ce29..151fe0de650 100644
--- a/engines/ultima/ultima1/widgets/overworld_widget.h
+++ b/engines/ultima/ultima1/widgets/overworld_widget.h
@@ -22,8 +22,8 @@
 #ifndef ULTIMA_ULTIMA1_WIDGETS_OVERWORLD_WIDGET_H
 #define ULTIMA_ULTIMA1_WIDGETS_OVERWORLD_WIDGET_H
 
-#include "ultima/shared/maps/map.h"
-#include "ultima/shared/maps/map_widget.h"
+#include "ultima/u1shared/maps/map.h"
+#include "ultima/u1shared/maps/map_widget.h"
 
 namespace Ultima {
 namespace Ultima1 {
diff --git a/engines/ultima/ultima1/widgets/person.h b/engines/ultima/ultima1/widgets/person.h
index a7bb2e17fa7..36ebe59a29c 100644
--- a/engines/ultima/ultima1/widgets/person.h
+++ b/engines/ultima/ultima1/widgets/person.h
@@ -26,7 +26,7 @@
 #include "ultima/ultima1/maps/map.h"
 #include "ultima/ultima1/maps/map_base.h"
 #include "ultima/ultima1/game.h"
-#include "ultima/shared/maps/creature.h"
+#include "ultima/u1shared/maps/creature.h"
 
 namespace Ultima {
 namespace Ultima1 {
diff --git a/engines/ultima/ultima1/widgets/princess.cpp b/engines/ultima/ultima1/widgets/princess.cpp
index 51c714c223c..d6a935228b8 100644
--- a/engines/ultima/ultima1/widgets/princess.cpp
+++ b/engines/ultima/ultima1/widgets/princess.cpp
@@ -21,7 +21,7 @@
 
 #include "ultima/ultima1/widgets/princess.h"
 #include "ultima/ultima1/maps/map_city_castle.h"
-#include "ultima/shared/core/utils.h"
+#include "ultima/u1shared/core/utils.h"
 
 namespace Ultima {
 namespace Ultima1 {
diff --git a/engines/ultima/ultima1/widgets/transport.h b/engines/ultima/ultima1/widgets/transport.h
index 77e870fb1c0..441f12e671e 100644
--- a/engines/ultima/ultima1/widgets/transport.h
+++ b/engines/ultima/ultima1/widgets/transport.h
@@ -23,7 +23,7 @@
 #define ULTIMA_ULTIMA1_WIDGETS_TRANSPORT_H
 
 #include "ultima/ultima1/widgets/overworld_widget.h"
-#include "ultima/shared/maps/map_base.h"
+#include "ultima/u1shared/maps/map_base.h"
 
 namespace Ultima {
 namespace Ultima1 {
diff --git a/engines/ultima/ultima1/widgets/urban_widget.h b/engines/ultima/ultima1/widgets/urban_widget.h
index 02de7d1087d..ed626556e12 100644
--- a/engines/ultima/ultima1/widgets/urban_widget.h
+++ b/engines/ultima/ultima1/widgets/urban_widget.h
@@ -22,7 +22,7 @@
 #ifndef ULTIMA_ULTIMA1_WIDGETS_URBAN_WIDGET_H
 #define ULTIMA_ULTIMA1_WIDGETS_URBAN_WIDGET_H
 
-#include "ultima/shared/maps/map_widget.h"
+#include "ultima/u1shared/maps/map_widget.h"
 #include "ultima/ultima1/maps/map.h"
 
 namespace Ultima {
diff --git a/engines/ultima/ultima2/events.cpp b/engines/ultima/ultima2/events.cpp
index af699d7d520..2b6fbc3f4be 100644
--- a/engines/ultima/ultima2/events.cpp
+++ b/engines/ultima/ultima2/events.cpp
@@ -318,8 +318,8 @@ void UIElement::addView() {
 	g_events->addView(this);
 }
 
-Gfx::GfxSurface UIElement::getSurface() const {
-	return Gfx::GfxSurface(*g_events->getScreen(), _bounds);
+Shared::Gfx::GfxSurface UIElement::getSurface() const {
+	return Shared::Gfx::GfxSurface(*g_events->getScreen(), _bounds);
 }
 
 int UIElement::getRandomNumber(int minNumber, int maxNumber) {
diff --git a/engines/ultima/ultima2/events.h b/engines/ultima/ultima2/events.h
index 25c64a6a9a8..f98ce79c57f 100644
--- a/engines/ultima/ultima2/events.h
+++ b/engines/ultima/ultima2/events.h
@@ -26,7 +26,7 @@
 #include "common/stack.h"
 #include "graphics/screen.h"
 #include "ultima/ultima2/messages.h"
-#include "ultima/ultima2/gfx/gfx_surface.h"
+#include "ultima/shared/gfx/gfx_surface.h"
 
 namespace Ultima {
 namespace Ultima2 {
@@ -197,7 +197,7 @@ public:
 	/**
 	 * Returns a surface for drawing the element
 	 */
-	Gfx::GfxSurface getSurface() const;
+	Shared::Gfx::GfxSurface getSurface() const;
 
 	/**
 	 * Clear the surface


Commit: ffaf53a7963d9366b56e0b0a0055c4caec9f143a
    https://github.com/scummvm/scummvm/commit/ffaf53a7963d9366b56e0b0a0055c4caec9f143a
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:40:44+11:00

Commit Message:
ULTIMA: ULTIMA2: Shifting generic code into new shared folder

Changed paths:
  A engines/ultima/shared/engine/events.cpp
  A engines/ultima/shared/engine/events.h
  A engines/ultima/shared/engine/messages.cpp
  A engines/ultima/shared/engine/messages.h
  A engines/ultima/shared/gfx/view.cpp
  A engines/ultima/shared/gfx/view.h
  R engines/ultima/ultima2/events.cpp
  R engines/ultima/ultima2/events.h
  R engines/ultima/ultima2/messages.cpp
  R engines/ultima/ultima2/messages.h
  R engines/ultima/ultima2/views/view.cpp
  R engines/ultima/ultima2/views/view.h
    engines/ultima/module.mk
    engines/ultima/shared/gfx/gfx_surface.cpp
    engines/ultima/shared/gfx/gfx_surface.h
    engines/ultima/ultima2/ultima2.cpp
    engines/ultima/ultima2/ultima2.h
    engines/ultima/ultima2/views/startup.h
    engines/ultima/ultima2/views/views.h


diff --git a/engines/ultima/module.mk b/engines/ultima/module.mk
index 75049dbc80e..502e82e4823 100644
--- a/engines/ultima/module.mk
+++ b/engines/ultima/module.mk
@@ -7,7 +7,10 @@ MODULE_OBJS := \
 
 ifdef ENABLE_ULTIMA2
 MODULE_OBJS += \
-	shared/gfx/gfx_surface.o
+	shared/engine/events.o \
+	shared/engine/messages.o \
+	shared/gfx/gfx_surface.o \
+	shared/gfx/view.o
 endif
 
 ifdef ENABLE_AKALABETH
diff --git a/engines/ultima/ultima2/events.cpp b/engines/ultima/shared/engine/events.cpp
similarity index 92%
rename from engines/ultima/ultima2/events.cpp
rename to engines/ultima/shared/engine/events.cpp
index 2b6fbc3f4be..ee41de5d2ac 100644
--- a/engines/ultima/ultima2/events.cpp
+++ b/engines/ultima/shared/engine/events.cpp
@@ -20,36 +20,38 @@
  */
 
 #include "common/config-manager.h"
+#include "common/system.h"
+#include "graphics/paletteman.h"
 #include "graphics/screen.h"
-#include "ultima/ultima2/events.h"
-#include "ultima/ultima2/ultima2.h"
-#include "ultima/ultima2/views/views.h"
+#include "ultima/shared/engine/events.h"
+#include "engines/engine.h"
 
 namespace Ultima {
-namespace Ultima2 {
+namespace Shared {
 
 Events *g_events;
 
-Events::Events() : UIElement("Root", nullptr) {
+Events::Events() : UIElement("Root", nullptr), _randomSource("Ultima") {
 	g_events = this;
+
+	// Setup palette
+	Graphics::Palette ega = Graphics::Palette::createEGAPalette();
+	g_system->getPaletteManager()->setPalette(ega);
 }
 
 Events::~Events() {
 	g_events = nullptr;
 }
 
-void Events::runGame() {
+void Events::runGame(Views &views) {
 	uint currTime, nextFrameTime = 0;
 	_screen = new Graphics::Screen();
-	Views::Views views;	// Loads all views in the structure
 
 	// Run the game
 	int saveSlot = ConfMan.getInt("save_slot");
 	if (saveSlot != -1)
 		g_engine->loadGameState(saveSlot);
 
-	addView("Startup");
-
 	Common::Event e;
 	while (!_views.empty() && !shouldQuit()) {
 		while (g_system->getEventManager()->pollEvent(e)) {
@@ -216,8 +218,8 @@ void Bounds::setBorderSize(size_t borderSize) {
 /*------------------------------------------------------------------------*/
 
 UIElement::UIElement(const Common::String &name) :
-	_name(name), _parent(g_engine), _bounds(_innerBounds) {
-	g_engine->_children.push_back(this);
+	_name(name), _parent(g_events), _bounds(_innerBounds) {
+	g_events->_children.push_back(this);
 }
 
 UIElement::UIElement(const Common::String &name, UIElement *uiParent) :
@@ -323,11 +325,11 @@ Shared::Gfx::GfxSurface UIElement::getSurface() const {
 }
 
 int UIElement::getRandomNumber(int minNumber, int maxNumber) {
-	return g_engine->getRandomNumber(maxNumber - minNumber + 1) + minNumber;
+	return g_events->getRandomNumber(maxNumber - minNumber + 1) + minNumber;
 }
 
 int UIElement::getRandomNumber(int maxNumber) {
-	return g_engine->getRandomNumber(maxNumber);
+	return g_events->getRandomNumber(maxNumber);
 }
 
 void UIElement::delaySeconds(uint seconds) {
@@ -342,5 +344,5 @@ void UIElement::timeout() {
 	redraw();
 }
 
-} // namespace Ultima2
+} // namespace Shared
 } // namespace Ultima
diff --git a/engines/ultima/ultima2/events.h b/engines/ultima/shared/engine/events.h
similarity index 93%
rename from engines/ultima/ultima2/events.h
rename to engines/ultima/shared/engine/events.h
index f98ce79c57f..608240bf395 100644
--- a/engines/ultima/ultima2/events.h
+++ b/engines/ultima/shared/engine/events.h
@@ -19,21 +19,24 @@
  *
  */
 
-#ifndef ULTIMA2_EVENTS_H
-#define ULTIMA2_EVENTS_H
+#ifndef ULTIMA_SHARED_ENGINE_EVENTS_H
+#define ULTIMA_SHARED_ENGINE_EVENTS_H
 
 #include "common/array.h"
+#include "common/random.h"
 #include "common/stack.h"
 #include "graphics/screen.h"
-#include "ultima/ultima2/messages.h"
+#include "ultima/shared/engine/messages.h"
 #include "ultima/shared/gfx/gfx_surface.h"
 
 namespace Ultima {
-namespace Ultima2 {
+namespace Shared {
 
 #define FRAME_RATE 20
 #define FRAME_DELAY (1000 / FRAME_RATE)
 
+using namespace Messages;
+
 class Events;
 
 /**
@@ -69,6 +72,12 @@ public:
 	}
 };
 
+/**
+ * Base for container of all the game views
+ */
+struct Views {
+};
+
 /**
  * User interface element
  */
@@ -273,6 +282,7 @@ public:
  */
 class Events : public UIElement {
 private:
+	Common::RandomSource _randomSource;
 	Graphics::Screen *_screen = nullptr;
 	Common::Stack<UIElement *> _views;
 protected:
@@ -310,7 +320,7 @@ public:
 	/**
 	 * Main game loop
 	 */
-	void runGame();
+	void runGame(Views &views);
 
 	/**
 	 * Sets the focus to a new view
@@ -408,11 +418,21 @@ public:
 	void close() override {
 		focusedView()->close();
 	}
+
+	/**
+	 * Returns a random number
+	 */
+	int getRandomNumber(int minNumber, int maxNumber) {
+		return _randomSource.getRandomNumberRng(minNumber, maxNumber);
+	}
+	int getRandomNumber(int maxNumber) {
+		return _randomSource.getRandomNumber(maxNumber);
+	}
 };
 
 extern Events *g_events;
 
-} // namespace Ultima2
+} // namespace Shared
 } // namespace Ultima
 
 #endif
diff --git a/engines/ultima/ultima2/messages.cpp b/engines/ultima/shared/engine/messages.cpp
similarity index 90%
rename from engines/ultima/ultima2/messages.cpp
rename to engines/ultima/shared/engine/messages.cpp
index 5aa36b53229..4f37d656489 100644
--- a/engines/ultima/ultima2/messages.cpp
+++ b/engines/ultima/shared/engine/messages.cpp
@@ -19,10 +19,11 @@
  *
  */
 
-#include "ultima/ultima2/messages.h"
+#include "ultima/shared/engine/messages.h"
 
 namespace Ultima {
-namespace Ultima2 {
+namespace Shared {
+namespace Messages {
 
 MouseMessage::MouseMessage(Common::EventType type,
 	const Common::Point &pos) : Message(), _pos(pos) {
@@ -41,5 +42,6 @@ MouseMessage::MouseMessage(Common::EventType type,
 	}
 }
 
-} // namespace Ultima2
+} // namespace Messages
+} // namespace Shared
 } // namespace Ultima
diff --git a/engines/ultima/ultima2/messages.h b/engines/ultima/shared/engine/messages.h
similarity index 95%
rename from engines/ultima/ultima2/messages.h
rename to engines/ultima/shared/engine/messages.h
index ca75d4d0c2f..1e036ce1757 100644
--- a/engines/ultima/ultima2/messages.h
+++ b/engines/ultima/shared/engine/messages.h
@@ -19,18 +19,19 @@
  *
  */
 
-#ifndef ULTIMA2_MESSAGES_H
-#define ULTIMA2_MESSAGES_H
+#ifndef ULTIMA_SHARED_ENGINE_MESSAGES_H
+#define ULTIMA_SHARED_ENGINE_MESSAGES_H
 
 #include "common/array.h"
 #include "common/events.h"
-#include "common/str.h"
 
 namespace Ultima {
-namespace Ultima2 {
+namespace Shared {
 
 class UIElement;
 
+namespace Messages {
+
 struct Message {};
 
 struct FocusMessage : public Message {
@@ -127,7 +128,8 @@ struct ActionMessage : public Message {
 	}
 };
 
-} // namespace Ultima2
+} // namespace Messages
+} // namespace Shared
 } // namespace Ultima
 
 #endif
diff --git a/engines/ultima/shared/gfx/gfx_surface.cpp b/engines/ultima/shared/gfx/gfx_surface.cpp
index c6227d01c01..d0f2fef8b37 100644
--- a/engines/ultima/shared/gfx/gfx_surface.cpp
+++ b/engines/ultima/shared/gfx/gfx_surface.cpp
@@ -61,10 +61,13 @@ void GfxSurface::writeString(const Common::String &str, Graphics::TextAlign alig
 }
 
 void GfxSurface::writeChar(uint32 chr) {
-	int textW = this->w / _font.getMaxCharWidth();
+	const int charW = _font.getMaxCharWidth();
+	const int charH = _font.getFontHeight();
+	const int textW = this->w / charW;
 
 	if (chr >= ' ') {
-		// TODO
+		_font.drawChar(this, chr, _textPos.x * charW, _textPos.y * charH, _textColor);
+		_textPos.x++;
 	}
 
 	if (_textPos.x >= textW || chr == '\n') {
diff --git a/engines/ultima/shared/gfx/gfx_surface.h b/engines/ultima/shared/gfx/gfx_surface.h
index 594bf43679b..fc24e37a1b3 100644
--- a/engines/ultima/shared/gfx/gfx_surface.h
+++ b/engines/ultima/shared/gfx/gfx_surface.h
@@ -30,14 +30,11 @@ namespace Ultima {
 namespace Shared {
 namespace Gfx {
 
-constexpr int TEXT_WIDTH = 40;
-constexpr int TEXT_HEIGHT = 25;
-
 class GfxSurface : public Graphics::ManagedSurface {
 private:
 	Graphics::DosFont _font;
 	Common::Point _textPos;
-	byte _textColor = 255;
+	byte _textColor = 15;
 
 	void newLine();
 
diff --git a/engines/ultima/ultima2/views/view.cpp b/engines/ultima/shared/gfx/view.cpp
similarity index 94%
rename from engines/ultima/ultima2/views/view.cpp
rename to engines/ultima/shared/gfx/view.cpp
index b8d5f7f3258..53586c23fbc 100644
--- a/engines/ultima/ultima2/views/view.cpp
+++ b/engines/ultima/shared/gfx/view.cpp
@@ -19,11 +19,11 @@
  *
  */
 
-#include "ultima/ultima2/views/view.h"
+#include "ultima/shared/gfx/view.h"
 
 namespace Ultima {
-namespace Ultima2 {
-namespace Views {
+namespace Shared {
+namespace Gfx {
 
 void View::checkFocusedControl(const Common::Point &mousePos) {
 	if (_focusedElement) {
@@ -80,6 +80,6 @@ bool View::msgMouseUp(const MouseUpMessage &msg) {
 	return child ? child->send(msg) : false;
 }
 
-} // namespace Views
-} // namespace Ultima2
+} // namespace Gfx
+} // namespace Shared
 } // namespace Ultima
diff --git a/engines/ultima/ultima2/views/view.h b/engines/ultima/shared/gfx/view.h
similarity index 92%
rename from engines/ultima/ultima2/views/view.h
rename to engines/ultima/shared/gfx/view.h
index b614771c70a..7997689c6a1 100644
--- a/engines/ultima/ultima2/views/view.h
+++ b/engines/ultima/shared/gfx/view.h
@@ -19,14 +19,14 @@
  *
  */
 
-#ifndef ULTIMA2_VIEW_H
-#define ULTIMA2_VIEW_H
+#ifndef ULTIMA_SHARED_GFX_VIEW_H
+#define ULTIMA_SHARED_GFX_VIEW_H
 
-#include "ultima/ultima2/events.h"
+#include "ultima/shared/engine/events.h"
 
 namespace Ultima {
-namespace Ultima2 {
-namespace Views {
+namespace Shared {
+namespace Gfx {
 
 /**
  * Base view class for screens and dialogs that appear on-screen.
@@ -70,8 +70,8 @@ public:
 	bool msgMouseUp(const MouseUpMessage &msg) override;
 };
 
-} // namespace Views
-} // namespace Ultima2
+} // namespace Gfx
+} // namespace Shared
 } // namespace Ultima
 
 #endif
diff --git a/engines/ultima/ultima2/ultima2.cpp b/engines/ultima/ultima2/ultima2.cpp
index f3ad243d15e..550af7a52a5 100644
--- a/engines/ultima/ultima2/ultima2.cpp
+++ b/engines/ultima/ultima2/ultima2.cpp
@@ -29,6 +29,7 @@
 #include "ultima/ultima2/ultima2.h"
 #include "ultima/ultima2/console.h"
 #include "ultima/ultima2/metaengine.h"
+#include "ultima/ultima2/views/views.h"
 
 namespace Ultima {
 namespace Ultima2 {
@@ -61,7 +62,9 @@ Common::Error Ultima2Engine::run() {
 	// Set the engine's debugger console
 	setDebugger(new Console());
 
-	runGame();
+	Views::Views views;
+	addView("Startup");
+	runGame(views);
 
 	return Common::kNoError;
 }
diff --git a/engines/ultima/ultima2/ultima2.h b/engines/ultima/ultima2/ultima2.h
index 4980a862560..22d553e313d 100644
--- a/engines/ultima/ultima2/ultima2.h
+++ b/engines/ultima/ultima2/ultima2.h
@@ -35,14 +35,14 @@
 #include "graphics/palette.h"
 #include "graphics/screen.h"
 #include "ultima/detection.h"
-#include "ultima/ultima2/events.h"
+#include "ultima/shared/engine/events.h"
 
 namespace Ultima {
 namespace Ultima2 {
 
 struct Ultima2GameDescription;
 
-class Ultima2Engine : public Engine, public Events {
+class Ultima2Engine : public Engine, public Shared::Events {
 private:
 	const Ultima::UltimaGameDescription *_gameDescription;
 	Common::RandomSource _randomSource;
diff --git a/engines/ultima/ultima2/views/startup.h b/engines/ultima/ultima2/views/startup.h
index 4f66292801b..7b3b5866b29 100644
--- a/engines/ultima/ultima2/views/startup.h
+++ b/engines/ultima/ultima2/views/startup.h
@@ -22,13 +22,15 @@
 #ifndef ULTIMA2_VIEWS_STARTUP_H
 #define ULTIMA2_VIEWS_STARTUP_H
 
-#include "ultima/ultima2/views/view.h"
+#include "ultima/shared/gfx/view.h"
 
 namespace Ultima {
 namespace Ultima2 {
 namespace Views {
 
-class Startup : public View {
+using namespace Shared::Messages;
+
+class Startup : public Shared::Gfx::View {
 private:
 	int _pageCtr = 0;
 
diff --git a/engines/ultima/ultima2/views/views.h b/engines/ultima/ultima2/views/views.h
index f26cb595a42..bc4fd26cbc2 100644
--- a/engines/ultima/ultima2/views/views.h
+++ b/engines/ultima/ultima2/views/views.h
@@ -22,13 +22,14 @@
 #ifndef ULTIMA2_VIEWS_H
 #define ULTIMA2_VIEWS_H
 
+#include "ultima/shared/engine/events.h"
 #include "ultima/ultima2/views/startup.h"
 
 namespace Ultima {
 namespace Ultima2 {
 namespace Views {
 
-struct Views {
+struct Views : public Shared::Views {
 	Startup _startup;
 };
 


Commit: 330430e69456ee1b293b14b288e1de63867ff5df
    https://github.com/scummvm/scummvm/commit/330430e69456ee1b293b14b288e1de63867ff5df
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:40:45+11:00

Commit Message:
ULTIMA: ULTIMA2: Added title screen

Changed paths:
  A engines/ultima/shared/gfx/rect.h
  A engines/ultima/shared/gfx/text_input.cpp
  A engines/ultima/shared/gfx/text_input.h
  A engines/ultima/ultima2/views/title.cpp
  A engines/ultima/ultima2/views/title.h
    engines/ultima/module.mk
    engines/ultima/shared/gfx/gfx_surface.cpp
    engines/ultima/shared/gfx/gfx_surface.h
    engines/ultima/ultima2/ultima2.cpp
    engines/ultima/ultima2/ultima2.h
    engines/ultima/ultima2/views/views.h


diff --git a/engines/ultima/module.mk b/engines/ultima/module.mk
index 502e82e4823..b73fb43f93c 100644
--- a/engines/ultima/module.mk
+++ b/engines/ultima/module.mk
@@ -10,6 +10,7 @@ MODULE_OBJS += \
 	shared/engine/events.o \
 	shared/engine/messages.o \
 	shared/gfx/gfx_surface.o \
+	shared/gfx/text_input.o \
 	shared/gfx/view.o
 endif
 
@@ -179,7 +180,8 @@ MODULE_OBJS += \
 	ultima2/metaengine.o \
 	ultima2/gfx/pic_decoder.o \
 	ultima2/views/view.o \
-	ultima2/views/startup.o
+	ultima2/views/startup.o \
+	ultima2/views/title.o
 endif
 
 ifdef ENABLE_ULTIMA4
diff --git a/engines/ultima/shared/gfx/gfx_surface.cpp b/engines/ultima/shared/gfx/gfx_surface.cpp
index d0f2fef8b37..0eccb4676b5 100644
--- a/engines/ultima/shared/gfx/gfx_surface.cpp
+++ b/engines/ultima/shared/gfx/gfx_surface.cpp
@@ -100,6 +100,10 @@ byte GfxSurface::setColor(byte color) {
 	return oldColor;
 }
 
+int GfxSurface::getStringWidth(const Common::String &str) const {
+	return str.size() * _font.getMaxCharWidth();
+}
+
 } // namespace Gfx
 } // namespace Shared
 } // namespace Ultima
diff --git a/engines/ultima/shared/gfx/gfx_surface.h b/engines/ultima/shared/gfx/gfx_surface.h
index fc24e37a1b3..a69f9af1d79 100644
--- a/engines/ultima/shared/gfx/gfx_surface.h
+++ b/engines/ultima/shared/gfx/gfx_surface.h
@@ -49,6 +49,7 @@ public:
 		Graphics::TextAlign align = Graphics::kTextAlignLeft);
 	void writeString(const Common::String &str, Graphics::TextAlign align = Graphics::kTextAlignLeft);
 	void writeChar(uint32 chr);
+	int getStringWidth(const Common::String &str) const;
 
 	void setTextPos(const Common::Point &pt);
 	byte setColor(byte color);
diff --git a/engines/ultima/shared/gfx/rect.h b/engines/ultima/shared/gfx/rect.h
new file mode 100644
index 00000000000..df5b6c46fe8
--- /dev/null
+++ b/engines/ultima/shared/gfx/rect.h
@@ -0,0 +1,69 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef ULTIMA_SHARED_CORE_RECT_H
+#define ULTIMA_SHARED_CORE_RECT_H
+
+#include "common/rect.h"
+
+namespace Ultima {
+namespace Shared {
+namespace Gfx {
+
+class TextPoint;
+
+typedef Common::Rect Rect;
+
+typedef Common::Point Point;
+
+/**
+ * Simple derived point class that converts text coordinates to graphic screen coordinates
+ */
+class TextPoint : public Common::Point {
+public:
+	TextPoint() : Common::Point() {
+	}
+	TextPoint(int16 x1, int16 y1) : Common::Point(x1 * 8, y1 * 8) {
+	}
+};
+
+/**
+ * Simple derived rect class that converts text coordinates to graphic screen coordinates
+ */
+class TextRect : public Common::Rect {
+public:
+	TextRect() : Common::Rect() {
+	}
+	TextRect(int16 x1, int16 y1, int16 x2, int16 y2) : Common::Rect(x1 * 8, y1 * 8, (x2 + 1) * 8, (y2 + 1) * 8) {
+	}
+};
+
+} // namespace Gfx
+} // namespace Shared
+
+using Shared::Gfx::Rect;
+using Shared::Gfx::Point;
+using Shared::Gfx::TextPoint;
+using Shared::Gfx::TextRect;
+
+} // namespace Ultima
+
+#endif
diff --git a/engines/ultima/shared/gfx/text_input.cpp b/engines/ultima/shared/gfx/text_input.cpp
new file mode 100644
index 00000000000..402692332c1
--- /dev/null
+++ b/engines/ultima/shared/gfx/text_input.cpp
@@ -0,0 +1,134 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "ultima/shared/gfx/text_input.h"
+#include "ultima/shared/gfx/rect.h"
+
+namespace Ultima {
+namespace Shared {
+namespace Gfx {
+
+#define DELAY_FRAMES 2
+
+TextInput::TextInput(const Common::String &name, UIElement *parent) : UIElement(name, parent) {
+}
+
+TextInput::TextInput(const Common::String &name, UIElement *parent, const Common::Point &pos,
+	int maxChars, bool isNumeric) : UIElement(name, parent) {
+	setBounds(TextRect(pos.x, pos.y, pos.x + maxChars, pos.y + 1));
+	_isNumeric = isNumeric;
+}
+
+
+void TextInput::clear() {
+	_text.clear();
+	redraw();
+}
+
+void TextInput::show(const Common::Point &pos, int maxChars, bool isNumeric) {
+	setBounds(TextRect(pos.x, pos.y, pos.x + maxChars, pos.y + 1));
+	_isNumeric = isNumeric;
+	show();
+}
+
+void TextInput::show() {
+	// Set to visible, and start timer for blinking the cursor
+	_visible = true;
+	_text.clear();
+	delayFrames(DELAY_FRAMES);
+	redraw();
+}
+
+void TextInput::hide() {
+	// Hide the text input
+	_visible = false;
+	cancelDelay();
+	redraw();
+}
+
+void TextInput::setTextPos(const Common::Point &pt) {
+	setBounds(TextRect(pt.x, pt.y, pt.x, pt.y));
+}
+
+void TextInput::draw() {
+	auto s = getSurface();
+
+	if (_visible) {
+		s.clear();
+		s.writeString(_text);
+
+		if (_caretVisible)
+			s.writeChar('_');
+	}
+}
+
+bool TextInput::msgFocus(const FocusMessage &msg) {
+	_text.clear();
+	return true;
+}
+
+bool TextInput::msgUnfocus(const UnfocusMessage &msg) {
+	hide();
+	return true;
+}
+
+bool TextInput::msgKeypress(const KeypressMessage &msg) {
+	if (Common::isPrint(msg.ascii)) {
+		// Printable character
+		if (!_isNumeric || Common::isDigit(msg.keycode)) {
+			_text += toupper(msg.ascii);
+
+			auto s = getSurface();
+			if (s.getStringWidth(_text) >= _bounds.width())
+				_parent->send(GameMessage("INPUT", _text));
+
+			redraw();
+		}
+
+		return true;
+
+	} else if (msg.keycode == Common::KEYCODE_BACKSPACE || msg.keycode == Common::KEYCODE_DELETE) {
+		if (!_text.empty()) {
+			_text.deleteLastChar();
+			redraw();
+		}
+		return true;
+
+	} else if (msg.keycode == Common::KEYCODE_RETURN || msg.keycode == Common::KEYCODE_KP_ENTER) {
+		_parent->send(GameMessage("INPUT", _text));
+		return true;
+	}
+
+	return false;
+}
+
+void TextInput::timeout() {
+	// Keep the cursor caret blinking
+	if (_visible) {
+		_caretVisible = !_caretVisible;
+		redraw();
+		delayFrames(DELAY_FRAMES);
+	}
+}
+
+} // namespace Gfx
+} // namespace Shared
+} // namespace Ultima
diff --git a/engines/ultima/shared/gfx/text_input.h b/engines/ultima/shared/gfx/text_input.h
new file mode 100644
index 00000000000..cac4e6c2e83
--- /dev/null
+++ b/engines/ultima/shared/gfx/text_input.h
@@ -0,0 +1,62 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef ULTIMA_SHARED_GFX_TEXT_INPUT_H
+#define ULTIMA_SHARED_GFX_TEXT_INPUT_H
+
+#include "ultima/shared/engine/events.h"
+
+namespace Ultima {
+namespace Shared {
+namespace Gfx {
+
+class TextInput : public Shared::UIElement {
+private:
+	Common::String _text;
+	bool _isNumeric = false;
+	bool _visible = false;
+	bool _caretVisible = false;
+
+public:
+	TextInput(const Common::String &name, UIElement *parent = nullptr);
+	TextInput(const Common::String &name, UIElement *parent, const Common::Point &pos,
+		int maxChars, bool isNumeric = false);
+	~TextInput() override {
+	}
+
+	void draw() override;
+	bool msgKeypress(const KeypressMessage &msg) override;
+	void timeout() override;
+	bool msgFocus(const FocusMessage &msg) override;
+	bool msgUnfocus(const UnfocusMessage &msg) override;
+
+	void show(const Common::Point &pos, int maxChars, bool isNumeric = false);
+	void show();
+	void hide();
+	void clear();
+	void setTextPos(const Common::Point &pt);
+};
+
+} // namespace Gfx
+} // namespace Shared
+} // namespace Ultima
+
+#endif
diff --git a/engines/ultima/ultima2/ultima2.cpp b/engines/ultima/ultima2/ultima2.cpp
index 550af7a52a5..dcc2e570ed3 100644
--- a/engines/ultima/ultima2/ultima2.cpp
+++ b/engines/ultima/ultima2/ultima2.cpp
@@ -19,10 +19,10 @@
  *
  */
 
-#include "common/scummsys.h"
 #include "common/config-manager.h"
 #include "common/debug-channels.h"
 #include "common/events.h"
+#include "common/savefile.h"
 #include "common/system.h"
 #include "engines/util.h"
 #include "graphics/paletteman.h"
@@ -80,5 +80,14 @@ Common::Error Ultima2Engine::syncGame(Common::Serializer &s) {
 	return Common::kNoError;
 }
 
+bool Ultima2Engine::savegamesExist() const {
+	Common::String slotName = getSaveStateName(1);
+	Common::InSaveFile *saveFile = g_system->getSavefileManager()->openForLoading(slotName);
+	bool result = saveFile != nullptr;
+
+	delete saveFile;
+	return result;
+}
+
 } // namespace Ultima2
 } // namespace Ultima
diff --git a/engines/ultima/ultima2/ultima2.h b/engines/ultima/ultima2/ultima2.h
index 22d553e313d..cb403e56aeb 100644
--- a/engines/ultima/ultima2/ultima2.h
+++ b/engines/ultima/ultima2/ultima2.h
@@ -106,6 +106,11 @@ public:
 		Common::Serializer s(stream, nullptr);
 		return syncGame(s);
 	}
+
+	/**
+	 * Returns true if any savegames exist
+	 */
+	bool savegamesExist() const;
 };
 
 extern Ultima2Engine *g_engine;
diff --git a/engines/ultima/ultima2/views/title.cpp b/engines/ultima/ultima2/views/title.cpp
new file mode 100644
index 00000000000..70c0e4d06cc
--- /dev/null
+++ b/engines/ultima/ultima2/views/title.cpp
@@ -0,0 +1,78 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "ultima/ultima2/views/title.h"
+#include "ultima/ultima2/ultima2.h"
+
+namespace Ultima {
+namespace Ultima2 {
+namespace Views {
+
+bool Title::msgFocus(const FocusMessage &msg) {
+	_cursor.show();
+	return true;
+}
+
+void Title::draw() {
+	auto s = getSurface();
+	s.clear();
+
+	s.writeString(Common::Point(15, 1),  "ULTIMA ][");
+	s.writeString(Common::Point(16, 3),  "REVENGE");
+	s.writeString(Common::Point(16, 5),  "OF  THE");
+	s.writeString(Common::Point(14, 7),  "ENCHANTRESS");
+	s.writeString(Common::Point(6, 22),  "(C)-1983,1989 BY LORD BRITISH");
+	s.writeString(Common::Point(15, 23), "AND ORIGIN");
+	s.writeString(Common::Point(5, 11), "TYPE - ");
+	s.writeString(Common::Point(6, 13), "`D` - FOR A DEMONSTRATION");
+	s.writeString(Common::Point(6, 15), "`P` - PLAY A GAME OF ULTIMA ][");
+	s.writeString(Common::Point(6, 17), "`C` - CREATE A NEW CHARACTER");
+	s.writeString(Common::Point(5, 19), "CHOICE:");
+}
+
+bool Title::msgGame(const GameMessage &msg) {
+	char key = msg._stringValue.empty() ? 0 : toupper(msg._stringValue.firstChar());
+
+	switch (key) {
+	case 'D':
+		replaceView("Demo");
+		return true;
+	case 'C':
+		replaceView("CreateCharacter");
+		return true;
+	case 'P':
+		if (!g_engine->savegamesExist()) {
+			replaceView("CreateCharacter");
+		} else {
+			g_engine->loadGameDialog();
+		}
+		break;
+
+	default:
+		break;
+	}
+
+	return false;
+}
+
+} // namespace Views
+} // namespace Ultima2
+} // namespace Ultima
diff --git a/engines/ultima/ultima2/views/title.h b/engines/ultima/ultima2/views/title.h
new file mode 100644
index 00000000000..c64563d119b
--- /dev/null
+++ b/engines/ultima/ultima2/views/title.h
@@ -0,0 +1,53 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef ULTIMA2_VIEWS_TITLE_H
+#define ULTIMA2_VIEWS_TITLE_H
+
+#include "ultima/shared/gfx/view.h"
+#include "ultima/shared/gfx/text_input.h"
+
+namespace Ultima {
+namespace Ultima2 {
+namespace Views {
+
+using namespace Shared::Messages;
+
+class Title : public Shared::Gfx::View {
+private:
+	Shared::Gfx::TextInput _cursor = Shared::Gfx::TextInput("Cursor", this,
+		Common::Point(12, 19), 1);
+
+public:
+	Title() : View("Title") {}
+	~Title() override {}
+
+	bool msgFocus(const FocusMessage &msg) override;
+	void draw() override;
+
+	bool msgGame(const GameMessage &msg) override;
+};
+
+} // namespace Views
+} // namespace Ultima2
+} // namespace Ultima
+
+#endif
diff --git a/engines/ultima/ultima2/views/views.h b/engines/ultima/ultima2/views/views.h
index bc4fd26cbc2..7ac6e99cf5b 100644
--- a/engines/ultima/ultima2/views/views.h
+++ b/engines/ultima/ultima2/views/views.h
@@ -24,6 +24,7 @@
 
 #include "ultima/shared/engine/events.h"
 #include "ultima/ultima2/views/startup.h"
+#include "ultima/ultima2/views/title.h"
 
 namespace Ultima {
 namespace Ultima2 {
@@ -31,6 +32,7 @@ namespace Views {
 
 struct Views : public Shared::Views {
 	Startup _startup;
+	Title _title;
 };
 
 } // namespace Views


Commit: 2b28a7345d306f9f34ccf02c361a90c95a712825
    https://github.com/scummvm/scummvm/commit/2b28a7345d306f9f34ccf02c361a90c95a712825
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:40:45+11:00

Commit Message:
ULTIMA: ULTIMA2: Added Create Character screen

Changed paths:
  A engines/ultima/ultima2/data/game.cpp
  A engines/ultima/ultima2/data/game.h
  A engines/ultima/ultima2/data/map.cpp
  A engines/ultima/ultima2/data/map.h
  A engines/ultima/ultima2/data/player.cpp
  A engines/ultima/ultima2/data/player.h
  A engines/ultima/ultima2/data/tiles.cpp
  A engines/ultima/ultima2/data/tiles.h
  A engines/ultima/ultima2/views/create_character.cpp
  A engines/ultima/ultima2/views/create_character.h
    engines/ultima/module.mk
    engines/ultima/shared/engine/events.cpp
    engines/ultima/shared/engine/events.h
    engines/ultima/shared/gfx/gfx_surface.cpp
    engines/ultima/shared/gfx/gfx_surface.h
    engines/ultima/shared/gfx/text_input.cpp
    engines/ultima/shared/gfx/view.h
    engines/ultima/ultima2/metaengine.cpp
    engines/ultima/ultima2/ultima2.cpp
    engines/ultima/ultima2/ultima2.h
    engines/ultima/ultima2/views/views.h


diff --git a/engines/ultima/module.mk b/engines/ultima/module.mk
index b73fb43f93c..aa6be4ba342 100644
--- a/engines/ultima/module.mk
+++ b/engines/ultima/module.mk
@@ -178,8 +178,13 @@ MODULE_OBJS += \
 	ultima2/events.o \
 	ultima2/messages.o \
 	ultima2/metaengine.o \
+	ultima2/data/game.o \
+	ultima2/data/map.o \
+	ultima2/data/player.o \
+	ultima2/data/tiles.o \
 	ultima2/gfx/pic_decoder.o \
 	ultima2/views/view.o \
+	ultima2/views/create_character.o \
 	ultima2/views/startup.o \
 	ultima2/views/title.o
 endif
diff --git a/engines/ultima/shared/engine/events.cpp b/engines/ultima/shared/engine/events.cpp
index ee41de5d2ac..36147a5f737 100644
--- a/engines/ultima/shared/engine/events.cpp
+++ b/engines/ultima/shared/engine/events.cpp
@@ -193,6 +193,10 @@ void Events::addKeypress(const Common::KeyCode kc) {
 	focusedView()->msgKeypress(KeypressMessage(ks));
 }
 
+void Events::pauseMillis(uint millis) {
+	g_system->delayMillis(millis);
+}
+
 /*------------------------------------------------------------------------*/
 
 Bounds::Bounds(Common::Rect &innerBounds) :
diff --git a/engines/ultima/shared/engine/events.h b/engines/ultima/shared/engine/events.h
index 608240bf395..31ca2eba92c 100644
--- a/engines/ultima/shared/engine/events.h
+++ b/engines/ultima/shared/engine/events.h
@@ -428,6 +428,13 @@ public:
 	int getRandomNumber(int maxNumber) {
 		return _randomSource.getRandomNumber(maxNumber);
 	}
+
+	/**
+	 * Delays by a given number of milliseconds.
+	 * This shouldn't normally be used directly, since it freezes the
+	 * entire event loop and screen updates.
+	 */
+	void pauseMillis(uint millis = 10);
 };
 
 extern Events *g_events;
diff --git a/engines/ultima/shared/gfx/gfx_surface.cpp b/engines/ultima/shared/gfx/gfx_surface.cpp
index 0eccb4676b5..250cf2b7978 100644
--- a/engines/ultima/shared/gfx/gfx_surface.cpp
+++ b/engines/ultima/shared/gfx/gfx_surface.cpp
@@ -61,12 +61,13 @@ void GfxSurface::writeString(const Common::String &str, Graphics::TextAlign alig
 }
 
 void GfxSurface::writeChar(uint32 chr) {
-	const int charW = _font.getMaxCharWidth();
-	const int charH = _font.getFontHeight();
-	const int textW = this->w / charW;
+	const int fontW = _font.getMaxCharWidth();
+	const int fontH = _font.getFontHeight();
+	const int textW = this->w / fontW;
 
 	if (chr >= ' ') {
-		_font.drawChar(this, chr, _textPos.x * charW, _textPos.y * charH, _textColor);
+		fillRect(Common::Rect(_textPos.x * fontW, _textPos.y * fontH, (_textPos.x + 1) * fontW, (_textPos.y + 1) * fontH), _bgColor);
+		_font.drawChar(this, chr, _textPos.x * fontW, _textPos.y * fontH, _textColor);
 		_textPos.x++;
 	}
 
@@ -80,13 +81,15 @@ void GfxSurface::newLine() {
 	_textPos.y++;
 
 	const int fontH = _font.getFontHeight();
-	const int textH = fontH / _font.getFontHeight();
+	const int textH = this->h / fontH;
 	if (_textPos.y >= textH) {
 		_textPos.y = textH - 1;
 
-		// Scroll the screen contents up
-		blitFrom(*this, Common::Rect(0, fontH, this->w, this->h), Common::Point(0, 0));
-		fillRect(Common::Rect(0, this->h - fontH, this->w, this->h), 0);
+		if (_scrollable) {
+			// Scroll the screen contents up
+			blitFrom(*this, Common::Rect(0, fontH, this->w, this->h), Common::Point(0, 0));
+			fillRect(Common::Rect(0, this->h - fontH, this->w, this->h), 0);
+		}
 	}
 }
 
@@ -94,14 +97,23 @@ void GfxSurface::setTextPos(const Common::Point &pt) {
 	_textPos = pt;
 }
 
+int GfxSurface::getStringWidth(const Common::String &str) const {
+	return str.size() * _font.getMaxCharWidth();
+}
+
 byte GfxSurface::setColor(byte color) {
 	byte oldColor = _textColor;
 	_textColor = color;
 	return oldColor;
 }
 
-int GfxSurface::getStringWidth(const Common::String &str) const {
-	return str.size() * _font.getMaxCharWidth();
+void GfxSurface::setColor(byte fgColor, byte bgColor) {
+	_textColor = fgColor;
+	_bgColor = bgColor;
+}
+
+void GfxSurface::reverseColor() {
+	SWAP(_textColor, _bgColor);
 }
 
 } // namespace Gfx
diff --git a/engines/ultima/shared/gfx/gfx_surface.h b/engines/ultima/shared/gfx/gfx_surface.h
index a69f9af1d79..5bcc2076ce9 100644
--- a/engines/ultima/shared/gfx/gfx_surface.h
+++ b/engines/ultima/shared/gfx/gfx_surface.h
@@ -35,6 +35,8 @@ private:
 	Graphics::DosFont _font;
 	Common::Point _textPos;
 	byte _textColor = 15;
+	byte _bgColor = 0;
+	bool _scrollable = false;
 
 	void newLine();
 
@@ -53,6 +55,11 @@ public:
 
 	void setTextPos(const Common::Point &pt);
 	byte setColor(byte color);
+	void setColor(byte fgColor, byte bgColor);
+	void reverseColor();
+	bool setScrollable(bool flag) {
+		_scrollable = flag;
+	}
 };
 
 } // namespace Gfx
diff --git a/engines/ultima/shared/gfx/text_input.cpp b/engines/ultima/shared/gfx/text_input.cpp
index 402692332c1..150ecac6139 100644
--- a/engines/ultima/shared/gfx/text_input.cpp
+++ b/engines/ultima/shared/gfx/text_input.cpp
@@ -33,7 +33,7 @@ TextInput::TextInput(const Common::String &name, UIElement *parent) : UIElement(
 
 TextInput::TextInput(const Common::String &name, UIElement *parent, const Common::Point &pos,
 	int maxChars, bool isNumeric) : UIElement(name, parent) {
-	setBounds(TextRect(pos.x, pos.y, pos.x + maxChars, pos.y + 1));
+	setBounds(TextRect(pos.x, pos.y, pos.x + maxChars - 1, pos.y));
 	_isNumeric = isNumeric;
 }
 
diff --git a/engines/ultima/shared/gfx/view.h b/engines/ultima/shared/gfx/view.h
index 7997689c6a1..37abbd69d67 100644
--- a/engines/ultima/shared/gfx/view.h
+++ b/engines/ultima/shared/gfx/view.h
@@ -23,6 +23,7 @@
 #define ULTIMA_SHARED_GFX_VIEW_H
 
 #include "ultima/shared/engine/events.h"
+#include "ultima/shared/gfx/rect.h"
 
 namespace Ultima {
 namespace Shared {
diff --git a/engines/ultima/ultima2/data/game.cpp b/engines/ultima/ultima2/data/game.cpp
new file mode 100644
index 00000000000..77788edf14a
--- /dev/null
+++ b/engines/ultima/ultima2/data/game.cpp
@@ -0,0 +1,111 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "ultima/ultima2/data/game.h"
+#include "ultima/ultima2/ultima2.h"
+#include "ultima/ultima2/metaengine.h"
+
+namespace Ultima {
+namespace Ultima2 {
+namespace Data {
+
+void Game::startGame() {
+	const auto &player = g_engine->_player;
+
+	if (IS_DUNGEON(player._mapNum))
+		g_engine->replaceView("Dungeon");
+	else
+		g_engine->replaceView("Overworld");
+
+	promptForCommand();
+}
+
+void Game::message(const Common::String &name, const char *param) {
+	GameMessage msg(name);
+	if (param)
+		msg._stringValue = param;
+	g_engine->focusedView()->send(msg);
+}
+
+void Game::promptForCommand() {
+	g_engine->focusedView()->send(GameMessage("COMMAND"));
+}
+
+void Game::doCommand(int action) {
+	switch (action) {
+	case KEYBIND_PASS:
+		message("INFO", "PASS");
+		break;
+
+	case KEYBIND_UP:
+
+
+	default:
+		message("INFO", "-ILLEGAL COMMAND!");
+		break;
+	}
+
+	endOfTurn();
+}
+
+void Game::endOfTurn() {
+	auto &player = g_engine->_player;
+
+	subtractFoodCtr(10);
+	if (!player.isDead()) {
+		g_engine->focusedView()->redraw();
+		promptForCommand();
+	}
+}
+
+void Game::subtractFoodCtr(int amount) {
+	auto &player = g_engine->_player;
+	if (player._hp == 0)
+		return;		// Already dead
+
+	bool foodFlag = player._foodSubCtr < amount;
+	player._foodSubCtr -= amount;
+	if (foodFlag && --player._food == 0)
+		dead();
+}
+
+void Game::subtractHp(int amount) {
+	auto &player = g_engine->_player;
+	player._hp = MAX((int)player._hp - amount, 0);
+
+	if (player._hp == 0)
+		dead();
+}
+
+void Game::dead() {
+	auto &player = g_engine->_player;
+	player._hp = 0;
+	player._food = 0;
+	player._foodSubCtr = 0;
+	player._experience = 0;
+	player._gold = 0;
+
+	message("DEAD");
+}
+
+} // namespace Data
+} // namespace Ultima2
+} // namespace Ultima
diff --git a/engines/ultima/ultima2/data/game.h b/engines/ultima/ultima2/data/game.h
new file mode 100644
index 00000000000..061e631fea0
--- /dev/null
+++ b/engines/ultima/ultima2/data/game.h
@@ -0,0 +1,86 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef ULTIMA2_DATA_GAME_H
+#define ULTIMA2_DATA_GAME_H
+
+#include "ultima/shared/engine/messages.h"
+
+namespace Ultima {
+namespace Ultima2 {
+namespace Data {
+
+using namespace Shared::Messages;
+
+/*
+ * The number of game frames before prompting the user for a command times out,
+ * and it's treated as a pass
+ */
+constexpr int FRAMES_BEFORE_COMMAND_TIMEOUT = 10;
+
+class Game {
+public:
+	/**
+	 * Called to start the game, both for new characters, and when a savegame is loaded
+	 */
+	void startGame();
+
+	/**
+	 * Prompt the player for a command
+	 */
+	void promptForCommand();
+
+	/**
+	 * Implements an in-game command
+	 */
+	void doCommand(int action);
+
+	/**
+	 * Called after actions are done
+	 */
+	void endOfTurn();
+
+	/**
+	 * Subtract food fraction from the player
+	 */
+	void subtractFoodCtr(int amount);
+
+	/**
+	 * Remove HP from the player
+	 */
+	void subtractHp(int amount);
+
+	/**
+	 * Player has died
+	 */
+	void dead();
+
+	/**
+	 * Triggers a message to the game view
+	 */
+	void message(const Common::String &name, const char *param = nullptr);
+};
+
+} // namespace Data
+} // namespace Ultima2
+} // namespace Ultima
+
+#endif
diff --git a/engines/ultima/ultima2/data/map.cpp b/engines/ultima/ultima2/data/map.cpp
new file mode 100644
index 00000000000..730ed0decf6
--- /dev/null
+++ b/engines/ultima/ultima2/data/map.cpp
@@ -0,0 +1,114 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "common/file.h"
+#include "ultima/ultima2/data/map.h"
+#include "ultima/ultima2/ultima2.h"
+
+namespace Ultima {
+namespace Ultima2 {
+namespace Data {
+
+void Map::load(int mapNum) {
+	const auto &player = g_engine->_player;
+
+	if (mapNum == _currentMap)
+		return;
+	_currentMap = mapNum;
+
+	Common::File f;
+	if (!f.open(Common::String::format("MAPX%.2d", mapNum).c_str()))
+		error("Could not open map %d", mapNum);
+
+	f.read(_tiles, MAP_WIDTH * MAP_HEIGHT);
+
+	// Set up copies of the map position and player tile to use
+	_mapX = player._mapX;
+	_mapY = player._mapY;
+	_playerTileId = (player._class + Data::PLAYER_TILES_OFFSET) * 2;
+	clearTiles();
+}
+
+void Map::clearTiles() {
+	Common::fill(&_mapTilesId[0][0], &_mapTilesId[0][0] + sizeof(VisibleTiles), 0);
+	Common::fill(&_priorTileIds[0][0], &_priorTileIds[0][0] + sizeof(VisibleTiles), 0);
+}
+
+bool Map::canMoveToTile(int tileNum) {
+	auto &game = g_engine->_game;
+	const auto &player = g_engine->_player;
+	int tileId = (tileNum & 0x7f) / 2;
+
+	if (IS_PLANET(player._mapNum) || ((uint)_mapX < Data::MAP_WIDTH && (uint)_mapY < Data::MAP_HEIGHT)) {
+		// Within the bounds of the map
+		if (tileId == kTileSwamp) {
+			game.subtractHp(5);
+		} else if (tileId == kTileForcefield) {
+			if (player._hasRing) {
+				game.message("INFO", "\x8D""FIELD CAUSES 1000 DAMAGE!");
+				game.message("CIRCLE");		// Flash damage circle
+
+				game.subtractHp(1000);
+			} else {
+				game.message("INFO", "RING PROTECTS FROM FIELD!");
+				g_engine->pauseMillis();
+			}
+		}
+
+		// Check paralyzed
+		if (player._paralyzedFlag) {
+			game.message("INFO", "--PARALIZED!");
+			return true;
+		}
+
+		switch (_playerTileId / 2) {
+		case kTileRocket * 2:
+			return true;
+		case kTileAirplane:
+			// TODO
+			error("TODO: airplane");
+			break;
+		case kTileShip:
+			if (tileId != kTileWater)
+				return true;
+
+			goto update_xy;
+		case kTileHorse:
+			// TODO
+			break;
+		default:
+			// TODO
+			break;
+		}
+	} else {
+		// TODO
+	}
+
+update_xy:
+	_mapX &= 63;
+	_mapY &= 63;
+
+	return false;
+}
+
+} // namespace Data
+} // namespace Ultima2
+} // namespace Ultima
diff --git a/engines/ultima/ultima2/data/map.h b/engines/ultima/ultima2/data/map.h
new file mode 100644
index 00000000000..d4c2927ab48
--- /dev/null
+++ b/engines/ultima/ultima2/data/map.h
@@ -0,0 +1,72 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef ULTIMA2_DATA_MAP_H
+#define ULTIMA2_DATA_MAP_H
+
+#include "common/archive.h"
+
+namespace Ultima {
+namespace Ultima2 {
+namespace Data {
+
+#define IS_PLANET(MAPNUM) ((MAPNUM % 10) == 0)
+#define IS_CITY(MAPNUM) ((MAPNUM % 10) >= 1 && (MAPNUM % 10) <= 3)
+#define IS_DUNGEON(MAPNUM) ((MAPNUM % 10) >= 4)
+
+constexpr int MAP_WIDTH = 64;
+constexpr int MAP_HEIGHT = 66;
+constexpr int MAP_VISIBLE_WIDTH = 20;
+constexpr int MAP_VISIBLE_HEIGHT = 10;
+constexpr int MAP_VISIBLE_CENTER_X = 9;
+constexpr int MAP_VISIBLE_CENTER_Y = 4;
+constexpr int PLAYER_TILES_OFFSET = 60;
+typedef byte MapTiles[MAP_HEIGHT][MAP_WIDTH];
+typedef byte VisibleTiles[MAP_VISIBLE_HEIGHT][MAP_VISIBLE_WIDTH];
+
+struct Map {
+private:
+	int _currentMap = -1;
+public:
+	int _mapX = 0, _mapY = 0;
+	byte _playerTileId = 0;
+
+	MapTiles _tiles = {};
+	int8 _outsideMapTile = -1;
+	byte _tilePlayerCenter = 0;
+	byte _tilePlayerUp = 0, _tilePlayerDown = 0,
+		_tilePlayerLeft = 0, _tilePlayerRight = 0;
+	VisibleTiles _mapTilesId = {};		// Calculated visible on-screen tiles
+	VisibleTiles _priorTileIds = {};	// Prior on-screen tiles, used to determine which to draw
+
+	const byte _flag1 = 0;
+
+	void load(int mapNum);
+	void clearTiles();
+
+	bool canMoveToTile(int tileNum);
+};
+
+} // namespace Data
+} // namespace Ultima2
+} // namespace Ultima
+
+#endif
diff --git a/engines/ultima/ultima2/data/player.cpp b/engines/ultima/ultima2/data/player.cpp
new file mode 100644
index 00000000000..8ce2234d071
--- /dev/null
+++ b/engines/ultima/ultima2/data/player.cpp
@@ -0,0 +1,101 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "ultima/ultima2/data/player.h"
+
+namespace Ultima {
+namespace Ultima2 {
+namespace Data {
+
+const char *SEX[] = { "MALE", "FEMALE", "YES PLEASE" };
+const char *RACE[] = { nullptr, "HUMAN", "ELF", "DWARF", "HOBBIT" };
+const char *CLASS[] = { nullptr, "FIGHTER", "CLERIC", "WIZARD", "THIEF" };
+
+void Player::synchronize(Common::Serializer &s) {
+	// Sync name
+	s.syncBytes((byte *)_name, MAX_NAME_LENGTH + 1);
+	s.skip(16 - (MAX_NAME_LENGTH + 1));
+
+	// Sex
+	byte sex = (_sex == SEX_MALE) ? 'M' : 'F';
+	s.syncAsByte(sex);
+	if (s.isLoading())
+		_sex = (sex == 'M') ? SEX_MALE : SEX_FEMALE;
+
+	// Class and race
+	s.syncAsByte(_class);
+	s.syncAsByte(_race);
+
+	// Map number is saved as two separate bytes
+	byte map1 = _mapNum / 10, map2 = _mapNum % 10;
+	s.syncAsByte(map1);
+	s.syncAsByte(map2);
+	if (s.isLoading())
+		_mapNum = (map1 * 10) + map2;
+
+	// Attributes
+	syncByte(s, _strength);
+	syncByte(s, _agility);
+	syncByte(s, _stamina);
+	syncByte(s, _charisma);
+	syncByte(s, _wisdom);
+	syncByte(s, _intelligence);
+	syncWord(s, _hp);
+	syncWord(s, _food);
+	s.syncAsByte(_foodSubCtr);
+	s.skip(1);
+	syncWord(s, _experience);
+	syncWord(s, _gold);
+	syncWord(s, _food);
+
+	syncByte(s, _mapX);
+	syncByte(s, _mapY);
+
+	s.syncAsByte(_hasRing);
+
+	if (s.isLoading()) {
+		_paralyzedFlag = 0;
+	}
+}
+
+void Player::syncByte(Common::Serializer &s, byte &v) {
+	byte tmp = ((v / 10) << 4) | (v % 10);
+	s.syncAsByte(tmp);
+	if (s.isLoading())
+		v = ((tmp >> 4) * 10) + (tmp & 0xf);
+}
+
+void Player::syncWord(Common::Serializer &s, uint16 &v) {
+	byte tmp[2];
+	if (s.isLoading()) {
+		s.syncBytes(tmp, 2);
+		v = ((tmp[0] >> 4) * 1000) + ((tmp[0] & 0xf) * 100) +
+			((tmp[1] >> 4) * 10) + (tmp[1] & 0xf);
+	} else {
+		tmp[0] = ((v / 1000) << 4) | ((v % 1000) / 100);
+		tmp[1] = ((v / 10) << 4) | (v % 10);
+		s.syncBytes(tmp, 2);
+	}
+}
+
+} // namespace Data
+} // namespace Ultima2
+} // namespace Ultima
diff --git a/engines/ultima/ultima2/data/player.h b/engines/ultima/ultima2/data/player.h
new file mode 100644
index 00000000000..5ed03e19aa9
--- /dev/null
+++ b/engines/ultima/ultima2/data/player.h
@@ -0,0 +1,99 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef ULTIMA2_DATA_PLAYER_H
+#define ULTIMA2_DATA_PLAYER_H
+
+#include "common/serializer.h"
+
+namespace Ultima {
+namespace Ultima2 {
+namespace Data {
+
+constexpr int MAX_NAME_LENGTH = 12;
+
+extern const char *SEX[];
+extern const char *RACE[];
+extern const char *CLASS[];
+
+enum Sex {
+	SEX_MALE, SEX_FEMALE
+};
+enum Race {
+	RACE_HUMAN = 1, RACE_ELF = 2, RACE_DWARF = 3, RACE_HOBBIT = 4
+};
+enum Class {
+	CLASS_FIGHTER = 1, CLASS_CLERIC = 2, CLASS_WIZARD = 3, CLASS_THIEF = 4
+};
+
+struct Player {
+private:
+	/**
+	 * Synchronizes a byte value. In original Ultima II, byte values store
+	 * the tens in the upper 4 bits, and the 0-9 portion in the low 4 bits.
+	 */
+	void syncByte(Common::Serializer &s, byte &v);
+
+	/**
+	 * Synchronizes a uint16 value. In original Ultima II, uint16 values store
+	 * 4 digits each in 4-bit portions of their own.
+	 */
+	void syncWord(Common::Serializer &s, uint16 &v);
+
+public:
+	char _name[MAX_NAME_LENGTH + 1] = {};
+	byte _sex = SEX_MALE;
+	byte _class = CLASS_FIGHTER;
+	byte _race = RACE_HUMAN;
+	byte _mapNum = 20;
+
+	byte _strength = 0;
+	byte _agility = 0;
+	byte _stamina = 0;
+	byte _charisma = 0;
+	byte _wisdom = 0;
+	byte _intelligence = 0;
+	uint16 _hp = 400;
+	uint16 _food = 400;
+	byte _foodSubCtr = 87;
+	uint16 _experience = 0;
+	uint16 _gold = 400;
+
+	byte _mapX = 20;
+	byte _mapY = 20;
+	byte _field3E = 0xff;
+
+	bool _hasRing = false;
+
+	// Runtime only fields
+	byte _paralyzedFlag = 0;
+
+	void synchronize(Common::Serializer &s);
+	bool isDead() const {
+		return _hp > 0;
+	}
+};
+
+} // namespace Data
+} // namespace Ultima2
+} // namespace Ultima
+
+#endif
diff --git a/engines/ultima/ultima2/data/tiles.cpp b/engines/ultima/ultima2/data/tiles.cpp
new file mode 100644
index 00000000000..05b54b34e5c
--- /dev/null
+++ b/engines/ultima/ultima2/data/tiles.cpp
@@ -0,0 +1,98 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "common/file.h"
+#include "common/memstream.h"
+#include "ultima/ultima2/data/tiles.h"
+
+namespace Ultima {
+namespace Ultima2 {
+namespace Data {
+
+// Ultima II has 64 tiles, each 16x16 pixels in CGA Linear format
+const int TILE_DATA_OFFSET = 31808;
+const int TILE2_DATA_OFFSET = 21640;
+
+const Common::ArchiveMemberPtr Tiles::getMember(const Common::Path &path) const {
+	if (!hasFile(path))
+		return Common::ArchiveMemberPtr();
+
+	return Common::ArchiveMemberPtr(new Common::GenericArchiveMember(path, *this));
+}
+
+Common::SeekableReadStream *Tiles::createReadStreamForMember(const Common::Path &path) const {
+	if (!hasFile(path))
+		return nullptr;
+
+	Common::File f;
+	if (!f.open("ultimaii.exe"))
+		error("Could not open ultimaii.exe");
+
+	// Seek to the tile data
+	f.seek(TILE_DATA_OFFSET);
+
+	Common::MemoryWriteStreamDynamic buf(DisposeAfterUse::NO);
+
+	// Process each tile
+	for (int tileNumber = 0; tileNumber < TILE_COUNT; tileNumber++) {
+		if (tileNumber == (TILE_COUNT - 1))
+			f.seek(TILE2_DATA_OFFSET);
+
+		byte tileW = f.readByte() * 4;
+		byte tileH = f.readByte();
+		assert(tileW == TILE_WIDTH && tileH == TILE_HEIGHT);
+
+		// Read the tile data (16 rows, 4 bytes per row)
+		for (int y = 0; y < TILE_HEIGHT; y++) {
+			for (int x = 0; x < TILE_WIDTH / 4; x++) {
+				// Read one byte (contains 4 pixels in CGA Linear format)
+				byte pixelByte = f.readByte();
+
+				// Extract 4 pixels from this byte
+				// CGA Linear: bits 7-6 = first pixel, 5-4 = second, 3-2 = third, 1-0 = fourth
+				for (int offset = 0; offset < 4; offset++) {
+					int colorBit = 7 - (offset * 2);  // Start at bit 7, then 5, 3, 1
+
+					// Extract 2-bit color value
+					int colorIndex = 0;
+					if (pixelByte & (1 << colorBit))
+						colorIndex |= 2;
+					if (pixelByte & (1 << (colorBit - 1)))
+						colorIndex |= 1;
+
+					// Map the 2-bit value to palette index (0-3)
+					byte paletteIndex = colorIndex;
+
+					// Write the palette index to the buffer
+					buf.writeByte(paletteIndex);
+				}
+			}
+		}
+	}
+
+	f.close();
+
+	return new Common::MemoryReadStream(buf.getData(), buf.size(), DisposeAfterUse::YES);
+}
+
+} // namespace Data
+} // namespace Ultima2
+} // namespace Ultima
diff --git a/engines/ultima/ultima2/data/tiles.h b/engines/ultima/ultima2/data/tiles.h
new file mode 100644
index 00000000000..f6b5baee1a2
--- /dev/null
+++ b/engines/ultima/ultima2/data/tiles.h
@@ -0,0 +1,153 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef ULTIMA2_DATA_TILES_H
+#define ULTIMA2_DATA_TILES_H
+
+#include "common/archive.h"
+
+namespace Ultima {
+namespace Ultima2 {
+namespace Data {
+
+constexpr int TILE_COUNT = 64 + 1;
+constexpr int TILE_WIDTH = 16;
+constexpr int TILE_HEIGHT = 16;
+
+enum TileId {
+	kTileWater = 0,
+	kTileSwamp = 1,
+	kTileGrass = 2,
+	kTileForest = 3,
+	kTileMountain = 4,
+	kTileUnknown5 = 5,
+	kTileTown = 6,
+	kTileTower = 7,
+	kTileCastle = 8,
+	kTileDungeonEntrance = 9,
+	kTileSignpost = 10,
+	kTileSeaMonster = 11,
+	kTileOrc = 12,
+	kTileDaemon = 13,
+	kTileDevil = 14,
+	kTileBalron = 15,
+	kTileMinax = 16,
+	kTileHorse = 17,
+	kTileShip = 18,
+	kTileAirplane = 19,
+	kTileRocket = 20,
+	kTileShield = 21,
+	kTileSword = 22,
+	kTileForcefield = 23,
+	kTileGuard = 24,
+	kTileJester = 25,
+	kTileShopkeep = 26,
+	kTileUnknown27 = 27,
+	kTileRoad = 28,
+	kTileEmpty = 29,
+	kTileWall = 30,
+	kTileEmptyCounterSpace = 31,
+	kTileLetterA = 32,
+	kTileLetterB = 33,
+	kTileLetterC = 34,
+	kTileLetterD = 35,
+	kTileLetterE = 36,
+	kTileLetterF = 37,
+	kTileLetterG = 38,
+	kTileLetterH = 39,
+	kTileLetterIDoor = 40,
+	kTileLetterJ = 41,
+	kTileLetterK = 42,
+	kTileLetterL = 43,
+	kTileLetterM = 44,
+	kTileLetterN = 45,
+	kTileLetterO = 46,
+	kTileLetterP = 47,
+	kTileMoongate = 48,
+	kTileLetterR = 49,
+	kTileLetterS = 50,
+	kTileLetterT = 51,
+	kTileLetterU = 52,
+	kTileLetterV = 53,
+	kTileLetterW = 54,
+	kTileLetterX = 55,
+	kTileLetterY = 56,
+	kTileLetterZ = 57,
+	kTileCounterEndRight = 58,
+	kTileCounterEndLeft = 59,
+	kTileFighter = 60,
+	kTileCleric = 61,
+	kTileMage = 62,
+	kTileThief = 63,
+	// Special tiles
+	kTileCircle = 64
+};
+
+/**
+ * This archive class virtualizes converting the CGA tile data from
+ * the ultimaii.exe file into a flat pixel (palette indexed) for each tile.
+ * This will hopefully make it easier in the future if anyone wants to
+ * create an enhanced graphic pack.. they'll just need to drop a 'tiles'
+ * file in the game folder and implement a replacement palette for the game.
+ */
+class Tiles : public Common::Archive {
+public:
+	~Tiles() override {
+	}
+
+	/**
+	 * Check if a member with the given @p name is present in the Archive.
+	 * Patterns are not allowed, as this is meant to be a quick File::exists()
+	 * replacement.  This returns "true" for both files and directories.
+	 */
+	virtual bool hasFile(const Common::Path &path) const {
+		return path.baseName().equalsIgnoreCase("tiles");
+	}
+
+	/**
+	 * Add all members of the Archive to the list.
+	 * Must only append to list, and not remove elements from it.
+	 *
+	 * @return The number of names added to list.
+	 */
+	virtual int listMembers(Common::ArchiveMemberList &list) const {
+		return 0;
+	}
+
+	/**
+	 * Return an ArchiveMember representation of the given file.
+	 */
+	const Common::ArchiveMemberPtr getMember(const Common::Path &path) const override;
+
+	/**
+	 * Create a stream bound to a member with the specified name in the
+	 * archive. If no member with this name exists, 0 is returned.
+	 *
+	 * @return The newly created input stream.
+	 */
+	Common::SeekableReadStream *createReadStreamForMember(const Common::Path &path) const override;
+};
+
+} // namespace Data
+} // namespace Ultima2
+} // namespace Ultima
+
+#endif
diff --git a/engines/ultima/ultima2/metaengine.cpp b/engines/ultima/ultima2/metaengine.cpp
index 373aa1b718c..b68413fb35a 100644
--- a/engines/ultima/ultima2/metaengine.cpp
+++ b/engines/ultima/ultima2/metaengine.cpp
@@ -37,54 +37,18 @@ struct KeybindingRecord {
 };
 
 static const KeybindingRecord MINIMAL_KEYS[] = {
-	{ KEYBIND_ESCAPE, "ESCAPE", _s("Escape"), "ESCAPE", "JOY_Y" },
 	{ KEYBIND_NONE, nullptr, nullptr, nullptr, nullptr }
 };
 
 static const KeybindingRecord MENU_KEYS[] = {
-	{ KEYBIND_UP, "UP", _s("Up"), "UP", "JOY_UP" },
-	{ KEYBIND_DOWN, "DOWN", _s("Down"), "DOWN", "JOY_DOWN" },
-	{ KEYBIND_SELECT, "SELECT", _s("Select"), "SPACE", nullptr },
-	{ KEYBIND_QUIT, "QUIT", _s("Quit"), "q", nullptr },
-	{ KEYBIND_SWING, "SWING", _s("Swing"), "s", nullptr },
-	{ KEYBIND_THROW, "THROW", _s("Throw"), "t", nullptr },
-	{ KEYBIND_FOOD, "FOOD", _s("Food"), "f", nullptr },
-	{ KEYBIND_RAPIER, "RAPIER", _s("Rapier"), "r", nullptr },
-	{ KEYBIND_AXE, "AXE", _s("Axe"), "a", nullptr },
-	{ KEYBIND_SHIELD, "SHIELD", _s("Shield"), "s", nullptr },
-	{ KEYBIND_BOW, "BOW", _s("Bow & arrow"), "b", nullptr },
-	{ KEYBIND_AMULET, "AMULET", _s("Magic amulet"), "m", nullptr },
-	{ KEYBIND_AMULET1, "AMULET1", _s("Amulet option 1"), "1", nullptr },
-	{ KEYBIND_AMULET2, "AMULET2", _s("Amulet option 2"), "2", nullptr },
-	{ KEYBIND_AMULET3, "AMULET3", _s("Amulet option 3"), "3", nullptr },
-	{ KEYBIND_AMULET4, "AMULET4", _s("Amulet option 4"), "4", nullptr },
 	{ KEYBIND_NONE, nullptr, nullptr, nullptr, nullptr }
 };
 
 static const KeybindingRecord OVERWORLD_KEYS[] = {
-	{ KEYBIND_UP, "UP", _s("North"), "UP", "JOY_UP" },
-	{ KEYBIND_DOWN, "DOWN", _s("South"), "DOWN", "JOY_DOWN" },
-	{ KEYBIND_LEFT, "LEFT", _s("West"), "LEFT", "JOY_LEFT" },
-	{ KEYBIND_RIGHT, "RIGHT", _s("East"), "RIGHT", "JOY_RIGHT" },
-	{ KEYBIND_ENTER, "ENTER", _s("Enter / Exit"), "e", "JOY_B" },
-	{ KEYBIND_INFO, "INFO", _s("Info"), "z", "JOY_X" },
-	{ KEYBIND_QUIT, "QUIT", _s("Quit"), "q", nullptr },
-	{ KEYBIND_PASS, "PASS", _s("Pass / Wait"), "SPACE", nullptr },
-	{ KEYBIND_MINIMAP, "MINIMAP", _s("Minimap"), "m", nullptr },
 	{ KEYBIND_NONE, nullptr, nullptr, nullptr, nullptr }
 };
 
 static const KeybindingRecord DUNGEON_KEYS[] = {
-	{ KEYBIND_UP, "UP", _s("Move forward"), "UP", "JOY_UP" },
-	{ KEYBIND_DOWN, "DOWN", _s("Turn around"), "DOWN", "JOY_DOWN" },
-	{ KEYBIND_LEFT, "LEFT", _s("Turn left"), "LEFT", "JOY_LEFT" },
-	{ KEYBIND_RIGHT, "RIGHT", _s("Turn right"), "RIGHT", "JOY_RIGHT" },
-	{ KEYBIND_ATTACK, "ATTACK", _s("Attack"), "a", "JOY_A" },
-	{ KEYBIND_ENTER, "ENTER", _s("Enter / Exit"), "e", "JOY_B" },
-	{ KEYBIND_INFO, "INFO", _s("Info"), "z", "JOY_X" },
-	{ KEYBIND_QUIT, "QUIT", _s("Quit"), "q", nullptr },
-	{ KEYBIND_PASS, "PASS", _s("Pass / Wait"), "SPACE", nullptr },
-	{ KEYBIND_MINIMAP, "MINIMAP", _s("Minimap"), "m", nullptr },
 	{ KEYBIND_NONE, nullptr, nullptr, nullptr, nullptr }
 };
 
diff --git a/engines/ultima/ultima2/ultima2.cpp b/engines/ultima/ultima2/ultima2.cpp
index dcc2e570ed3..922d2863229 100644
--- a/engines/ultima/ultima2/ultima2.cpp
+++ b/engines/ultima/ultima2/ultima2.cpp
@@ -37,7 +37,7 @@ namespace Ultima2 {
 Ultima2Engine *g_engine;
 
 Ultima2Engine::Ultima2Engine(OSystem *syst, const Ultima::UltimaGameDescription *gameDesc) : Engine(syst),
-_gameDescription(gameDesc), _randomSource("Ultima2") {
+_gameDescription(gameDesc) {
 	g_engine = this;
 }
 
diff --git a/engines/ultima/ultima2/ultima2.h b/engines/ultima/ultima2/ultima2.h
index cb403e56aeb..b4503d128b3 100644
--- a/engines/ultima/ultima2/ultima2.h
+++ b/engines/ultima/ultima2/ultima2.h
@@ -36,6 +36,10 @@
 #include "graphics/screen.h"
 #include "ultima/detection.h"
 #include "ultima/shared/engine/events.h"
+#include "ultima/ultima2/data/game.h"
+#include "ultima/ultima2/data/map.h"
+#include "ultima/ultima2/data/player.h"
+#include "ultima/ultima2/data/tiles.h"
 
 namespace Ultima {
 namespace Ultima2 {
@@ -45,7 +49,7 @@ struct Ultima2GameDescription;
 class Ultima2Engine : public Engine, public Shared::Events {
 private:
 	const Ultima::UltimaGameDescription *_gameDescription;
-	Common::RandomSource _randomSource;
+
 protected:
 	// Engine APIs
 	Common::Error run() override;
@@ -58,7 +62,10 @@ protected:
 	}
 
 public:
-	Graphics::Palette _palette;
+	Data::Game _game;
+	Data::Map _map;
+	Data::Player _player;
+	Graphics::ManagedSurface _tiles[Data::TILE_COUNT];
 
 public:
 	Ultima2Engine(OSystem *syst, const Ultima::UltimaGameDescription *gameDesc);
@@ -71,13 +78,6 @@ public:
 	 */
 	Common::String getGameId() const;
 
-	/**
-	 * Gets a random number
-	 */
-	uint32 getRandomNumber(uint maxNum) {
-		return _randomSource.getRandomNumber(maxNum);
-	}
-
 	bool hasFeature(EngineFeature f) const override {
 		return
 			(f == kSupportsLoadingDuringRuntime) ||
diff --git a/engines/ultima/ultima2/views/create_character.cpp b/engines/ultima/ultima2/views/create_character.cpp
new file mode 100644
index 00000000000..404f3f60a94
--- /dev/null
+++ b/engines/ultima/ultima2/views/create_character.cpp
@@ -0,0 +1,216 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "ultima/ultima2/views/create_character.h"
+#include "ultima/ultima2/ultima2.h"
+
+namespace Ultima {
+namespace Ultima2 {
+namespace Views {
+
+using namespace Data;
+
+static const byte POS[][2] = {
+	{ 26, 4 }, { 26, 5 }, { 26, 6 }, { 26, 7 }, { 26, 8 }, { 26, 9 },
+	{ 20, 11 }, { 20, 12 }, { 20, 13 }, { 20, 14 }, { 29, 16 }
+};
+
+bool CreateCharacter::msgFocus(const FocusMessage &msg) {
+	reset();
+	return true;
+}
+
+void CreateCharacter::reset() {
+	_cursorIndex = 0;
+	_pointsRemaining = POINTS_REMAINING;
+	_cursor.show(Point(POS[0][0], POS[0][1]), 2, true);
+}
+
+void CreateCharacter::done() {
+	// Unlike the original that took you back to the title screen after
+	// creating a character, since in ScummVM we allow multiple savegames,
+	// take the player directly in-game
+	g_engine->_game.startGame();
+}
+
+void CreateCharacter::draw() {
+	const Player &p = g_engine->_player;
+	auto s = getSurface();
+	s.clear();
+
+	s.writeString(Point(0, 0), "          PLAYER GENERATION :");
+	s.writeString(Point(0, 2), "     POINTS LEFT TO DISTRIBUTE : ");
+
+	// Display points remaining in reverse text
+	s.reverseColor();
+	s.writeString(Common::String::format("%.2d", _pointsRemaining));
+	s.reverseColor();
+
+	s.writeString(Point(0, 4), "           STRENGTH.......\n"
+		"           AGILITY........\n"
+		"           STAMINA........\n"
+		"           CHARISMA.......\n"
+		"           WISDOM.........\n"
+		"           INTELLIGENCE...\n\n"
+		"                M/F-\n"
+		"               RACE-\n"
+		"               TYPE-\n"
+		"               NAME-\n\n"
+		"          SATISFACTORY (Y/N)-\n\n"
+		"        RACES:         TYPES:\n"
+		"         1-HUMAN        1-FIGHTER\n"
+		"         2-ELF          2-CLERIC\n"
+		"         3-DWARF        3-WIZARD\n"
+		"         4-HOBBIT       4-THIEF");
+
+	// Attributes
+	if (_cursorIndex > 0)
+		s.writeString(Point(POS[0][0], POS[0][1]), Common::String::format("%.2d", p._strength));
+	if (_cursorIndex > 1)
+		s.writeString(Point(POS[1][0], POS[1][1]), Common::String::format("%.2d", p._agility));
+	if (_cursorIndex > 2)
+		s.writeString(Point(POS[2][0], POS[2][1]), Common::String::format("%.2d", p._stamina));
+	if (_cursorIndex > 3)
+		s.writeString(Point(POS[3][0], POS[3][1]), Common::String::format("%.2d", p._charisma));
+	if (_cursorIndex > 4)
+		s.writeString(Point(POS[4][0], POS[4][1]), Common::String::format("%.2d", p._wisdom));
+	if (_cursorIndex > 5)
+		s.writeString(Point(POS[5][0], POS[5][1]), Common::String::format("%.2d", p._intelligence));
+
+	// Other fields
+	if (_cursorIndex > 6)
+		s.writeString(Point(POS[6][0], POS[6][1]), SEX[p._sex]);
+	if (_cursorIndex > 7)
+		s.writeString(Point(POS[7][0], POS[7][1]), RACE[p._race]);
+	if (_cursorIndex > 8)
+		s.writeString(Point(POS[8][0], POS[8][1]), CLASS[p._class]);
+	if (_cursorIndex > 9)
+		s.writeString(Point(POS[9][0], POS[9][1]), p._name);
+}
+
+bool CreateCharacter::msgGame(const GameMessage &msg) {
+	if (msg._name != "INPUT")
+		return false;
+
+	Player &p = g_engine->_player;
+	char key = msg._stringValue.empty() ? 0 : toupper(msg._stringValue.firstChar());
+	int num = atoi(msg._stringValue.c_str());
+
+	switch (_cursorIndex) {
+	case 6:
+		if (key == 'M') {
+			p._sex = SEX_MALE;
+			p._strength += 5;		// Men are stronger
+			++_cursorIndex;
+		} else if (key == 'F') {
+			p._sex = SEX_FEMALE;
+			p._charisma += 10;		// Women are prettier
+			++_cursorIndex;
+		}
+		break;
+	case 7:
+		if (num >= 1 && num <= 4) {
+			p._race = (Race)num;
+			++_cursorIndex;
+
+			switch (p._race) {
+			case RACE_HUMAN:
+				p._intelligence += 5;
+				break;
+			case RACE_ELF:
+				p._agility += 5;
+				break;
+			case RACE_DWARF:
+				p._strength += 5;
+				break;
+			case RACE_HOBBIT:
+				p._wisdom += 10;
+				break;
+			}
+		}
+		break;
+	case 8:
+		if (num >= 1 && num <= 4) {
+			p._class = (Class)num;
+			++_cursorIndex;
+
+			switch (p._class) {
+			case CLASS_FIGHTER:
+				p._strength += 15;
+				break;
+			case CLASS_CLERIC:
+				p._wisdom += 10;
+				break;
+			case CLASS_WIZARD:
+				p._intelligence += 10;
+				break;
+			case CLASS_THIEF:
+				p._agility += 10;
+				break;
+			}
+		}
+		break;
+	case 9:
+		strcpy_s(p._name, msg._stringValue.c_str());
+		++_cursorIndex;
+		break;
+	case 10:
+		if (key == 'Y') {
+			done();
+		} else {
+			reset();
+		}
+		return true;
+	default:
+		// Attributes
+		switch (_cursorIndex) {
+		case 0: p._strength = num; break;
+		case 1: p._agility = num; break;
+		case 2: p._stamina = num; break;
+		case 3: p._charisma = num; break;
+		case 4: p._wisdom = num; break;
+		default: p._intelligence = num; break;
+		}
+
+		_pointsRemaining -= num;
+		if (_pointsRemaining < 0) {
+			reset();
+		} else {
+			++_cursorIndex;
+		}
+		break;
+	}
+
+	// Set the new cursor position
+	if (_cursorIndex < 6)
+		_cursor.show(Point(POS[_cursorIndex][0], POS[_cursorIndex][1]), 2, true);
+	else if (_cursorIndex == 9)
+		_cursor.show(Point(POS[_cursorIndex][0], POS[_cursorIndex][1]), MAX_NAME_LENGTH);
+	else
+		_cursor.show(Point(POS[_cursorIndex][0], POS[_cursorIndex][1]), 1);
+
+	redraw();
+	return true;
+}
+
+} // namespace Views
+} // namespace Ultima2
+} // namespace Ultima
diff --git a/engines/ultima/ultima2/views/create_character.h b/engines/ultima/ultima2/views/create_character.h
new file mode 100644
index 00000000000..c5ddd1e360c
--- /dev/null
+++ b/engines/ultima/ultima2/views/create_character.h
@@ -0,0 +1,59 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef ULTIMA2_VIEWS_CREATE_CHARACTER_H
+#define ULTIMA2_VIEWS_CREATE_CHARACTER_H
+
+#include "ultima/shared/gfx/view.h"
+#include "ultima/shared/gfx/text_input.h"
+
+namespace Ultima {
+namespace Ultima2 {
+namespace Views {
+
+constexpr int POINTS_REMAINING = 90;
+
+using namespace Shared::Messages;
+
+class CreateCharacter : public Shared::Gfx::View {
+private:
+	Shared::Gfx::TextInput _cursor = Shared::Gfx::TextInput("Cursor", this);
+	int _pointsRemaining = POINTS_REMAINING;
+	int _cursorIndex = 0;	// Which figure waiting input for
+
+	void reset();
+	void done();
+
+public:
+	CreateCharacter() : View("CreateCharacter") {}
+	~CreateCharacter() override {}
+
+	bool msgFocus(const FocusMessage &msg) override;
+	void draw() override;
+
+	bool msgGame(const GameMessage &msg) override;
+};
+
+} // namespace Views
+} // namespace Ultima2
+} // namespace Ultima
+
+#endif
diff --git a/engines/ultima/ultima2/views/views.h b/engines/ultima/ultima2/views/views.h
index 7ac6e99cf5b..5a73c860b3e 100644
--- a/engines/ultima/ultima2/views/views.h
+++ b/engines/ultima/ultima2/views/views.h
@@ -23,6 +23,7 @@
 #define ULTIMA2_VIEWS_H
 
 #include "ultima/shared/engine/events.h"
+#include "ultima/ultima2/views/create_character.h"
 #include "ultima/ultima2/views/startup.h"
 #include "ultima/ultima2/views/title.h"
 
@@ -31,6 +32,7 @@ namespace Ultima2 {
 namespace Views {
 
 struct Views : public Shared::Views {
+	CreateCharacter _createCharacter;
 	Startup _startup;
 	Title _title;
 };


Commit: 1c6c983da7aeacce3bc313f9116744c80c2276ba
    https://github.com/scummvm/scummvm/commit/1c6c983da7aeacce3bc313f9116744c80c2276ba
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:40:45+11:00

Commit Message:
ULTIMA: ULTIMA2: Beginnings of overworld view

Changed paths:
  A engines/ultima/ultima1/console.cpp
  A engines/ultima/ultima1/console.h
  A engines/ultima/ultima1/data/game.cpp
  A engines/ultima/ultima1/data/game.h
  A engines/ultima/ultima1/data/map.cpp
  A engines/ultima/ultima1/data/map.h
  A engines/ultima/ultima1/data/player.cpp
  A engines/ultima/ultima1/data/player.h
  A engines/ultima/ultima1/data/tiles.cpp
  A engines/ultima/ultima1/data/tiles.h
  A engines/ultima/ultima1/gfx/pic_decoder.cpp
  A engines/ultima/ultima1/gfx/pic_decoder.h
  A engines/ultima/ultima1/metaengine.cpp
  A engines/ultima/ultima1/metaengine.h
  A engines/ultima/ultima1/ultima1.cpp
  A engines/ultima/ultima1/ultima1.h
  A engines/ultima/ultima1/views/commands.cpp
  A engines/ultima/ultima1/views/commands.h
  A engines/ultima/ultima1/views/create_character.cpp
  A engines/ultima/ultima1/views/create_character.h
  A engines/ultima/ultima1/views/dead.cpp
  A engines/ultima/ultima1/views/dead.h
  A engines/ultima/ultima1/views/overworld.cpp
  A engines/ultima/ultima1/views/overworld.h
  A engines/ultima/ultima1/views/overworld_map.cpp
  A engines/ultima/ultima1/views/overworld_map.h
  A engines/ultima/ultima1/views/startup.cpp
  A engines/ultima/ultima1/views/startup.h
  A engines/ultima/ultima1/views/stats.cpp
  A engines/ultima/ultima1/views/stats.h
  A engines/ultima/ultima1/views/title.cpp
  A engines/ultima/ultima1/views/title.h
  A engines/ultima/ultima1/views/views.h
  A engines/ultima/ultima2/views/commands.cpp
  A engines/ultima/ultima2/views/commands.h
  A engines/ultima/ultima2/views/dead.cpp
  A engines/ultima/ultima2/views/dead.h
  A engines/ultima/ultima2/views/demo.cpp
  A engines/ultima/ultima2/views/demo.h
  A engines/ultima/ultima2/views/overworld.cpp
  A engines/ultima/ultima2/views/overworld.h
  A engines/ultima/ultima2/views/overworld_map.cpp
  A engines/ultima/ultima2/views/overworld_map.h
  A engines/ultima/ultima2/views/stats.cpp
  A engines/ultima/ultima2/views/stats.h
  R engines/ultima/u1shared/actions/action.cpp
  R engines/ultima/u1shared/actions/action.h
  R engines/ultima/u1shared/actions/huh.cpp
  R engines/ultima/u1shared/actions/huh.h
  R engines/ultima/u1shared/actions/pass.cpp
  R engines/ultima/u1shared/actions/pass.h
  R engines/ultima/u1shared/core/base_object.cpp
  R engines/ultima/u1shared/core/base_object.h
  R engines/ultima/u1shared/core/character.cpp
  R engines/ultima/u1shared/core/character.h
  R engines/ultima/u1shared/core/file.cpp
  R engines/ultima/u1shared/core/file.h
  R engines/ultima/u1shared/core/game_state.h
  R engines/ultima/u1shared/core/lzw.cpp
  R engines/ultima/u1shared/core/lzw.h
  R engines/ultima/u1shared/core/map.cpp
  R engines/ultima/u1shared/core/map.h
  R engines/ultima/u1shared/core/message_target.cpp
  R engines/ultima/u1shared/core/message_target.h
  R engines/ultima/u1shared/core/mouse_cursor.cpp
  R engines/ultima/u1shared/core/mouse_cursor.h
  R engines/ultima/u1shared/core/named_item.cpp
  R engines/ultima/u1shared/core/named_item.h
  R engines/ultima/u1shared/core/party.cpp
  R engines/ultima/u1shared/core/party.h
  R engines/ultima/u1shared/core/rect.h
  R engines/ultima/u1shared/core/str.cpp
  R engines/ultima/u1shared/core/str.h
  R engines/ultima/u1shared/core/tree_item.cpp
  R engines/ultima/u1shared/core/tree_item.h
  R engines/ultima/u1shared/core/utils.cpp
  R engines/ultima/u1shared/core/utils.h
  R engines/ultima/u1shared/core/widgets.cpp
  R engines/ultima/u1shared/core/widgets.h
  R engines/ultima/u1shared/early/font_resources.cpp
  R engines/ultima/u1shared/early/font_resources.h
  R engines/ultima/u1shared/early/game.cpp
  R engines/ultima/u1shared/early/game.h
  R engines/ultima/u1shared/early/game_base.cpp
  R engines/ultima/u1shared/early/game_base.h
  R engines/ultima/u1shared/early/ultima_early.cpp
  R engines/ultima/u1shared/early/ultima_early.h
  R engines/ultima/u1shared/engine/events.cpp
  R engines/ultima/u1shared/engine/events.h
  R engines/ultima/u1shared/engine/input_handler.cpp
  R engines/ultima/u1shared/engine/input_handler.h
  R engines/ultima/u1shared/engine/input_translator.cpp
  R engines/ultima/u1shared/engine/input_translator.h
  R engines/ultima/u1shared/engine/messages.cpp
  R engines/ultima/u1shared/engine/messages.h
  R engines/ultima/u1shared/engine/resources.cpp
  R engines/ultima/u1shared/engine/resources.h
  R engines/ultima/u1shared/gfx/bitmap.cpp
  R engines/ultima/u1shared/gfx/bitmap.h
  R engines/ultima/u1shared/gfx/character_input.cpp
  R engines/ultima/u1shared/gfx/character_input.h
  R engines/ultima/u1shared/gfx/dungeon_surface.cpp
  R engines/ultima/u1shared/gfx/dungeon_surface.h
  R engines/ultima/u1shared/gfx/font.cpp
  R engines/ultima/u1shared/gfx/font.h
  R engines/ultima/u1shared/gfx/info.cpp
  R engines/ultima/u1shared/gfx/info.h
  R engines/ultima/u1shared/gfx/popup.cpp
  R engines/ultima/u1shared/gfx/popup.h
  R engines/ultima/u1shared/gfx/screen.cpp
  R engines/ultima/u1shared/gfx/screen.h
  R engines/ultima/u1shared/gfx/sprites.cpp
  R engines/ultima/u1shared/gfx/sprites.h
  R engines/ultima/u1shared/gfx/text_cursor.cpp
  R engines/ultima/u1shared/gfx/text_cursor.h
  R engines/ultima/u1shared/gfx/text_input.cpp
  R engines/ultima/u1shared/gfx/text_input.h
  R engines/ultima/u1shared/gfx/viewport_dungeon.cpp
  R engines/ultima/u1shared/gfx/viewport_dungeon.h
  R engines/ultima/u1shared/gfx/viewport_map.cpp
  R engines/ultima/u1shared/gfx/viewport_map.h
  R engines/ultima/u1shared/gfx/visual_container.cpp
  R engines/ultima/u1shared/gfx/visual_container.h
  R engines/ultima/u1shared/gfx/visual_item.cpp
  R engines/ultima/u1shared/gfx/visual_item.h
  R engines/ultima/u1shared/gfx/visual_surface.cpp
  R engines/ultima/u1shared/gfx/visual_surface.h
  R engines/ultima/u1shared/maps/creature.cpp
  R engines/ultima/u1shared/maps/creature.h
  R engines/ultima/u1shared/maps/dungeon_creature.h
  R engines/ultima/u1shared/maps/dungeon_widget.h
  R engines/ultima/u1shared/maps/map.cpp
  R engines/ultima/u1shared/maps/map.h
  R engines/ultima/u1shared/maps/map_base.cpp
  R engines/ultima/u1shared/maps/map_base.h
  R engines/ultima/u1shared/maps/map_tile.cpp
  R engines/ultima/u1shared/maps/map_tile.h
  R engines/ultima/u1shared/maps/map_widget.cpp
  R engines/ultima/u1shared/maps/map_widget.h
  R engines/ultima/ultima1/actions/action.cpp
  R engines/ultima/ultima1/actions/action.h
  R engines/ultima/ultima1/actions/attack.cpp
  R engines/ultima/ultima1/actions/attack.h
  R engines/ultima/ultima1/actions/cast.cpp
  R engines/ultima/ultima1/actions/cast.h
  R engines/ultima/ultima1/actions/map_action.h
  R engines/ultima/ultima1/actions/move.cpp
  R engines/ultima/ultima1/actions/move.h
  R engines/ultima/ultima1/actions/quit.cpp
  R engines/ultima/ultima1/actions/quit.h
  R engines/ultima/ultima1/actions/ready.cpp
  R engines/ultima/ultima1/actions/ready.h
  R engines/ultima/ultima1/actions/stats.cpp
  R engines/ultima/ultima1/actions/stats.h
  R engines/ultima/ultima1/core/debugger.cpp
  R engines/ultima/ultima1/core/debugger.h
  R engines/ultima/ultima1/core/game_state.h
  R engines/ultima/ultima1/core/messages.h
  R engines/ultima/ultima1/core/party.cpp
  R engines/ultima/ultima1/core/party.h
  R engines/ultima/ultima1/core/quests.cpp
  R engines/ultima/ultima1/core/quests.h
  R engines/ultima/ultima1/core/resources.cpp
  R engines/ultima/ultima1/core/resources.h
  R engines/ultima/ultima1/core/widget_player.h
  R engines/ultima/ultima1/game.cpp
  R engines/ultima/ultima1/game.h
  R engines/ultima/ultima1/maps/map.cpp
  R engines/ultima/ultima1/maps/map.h
  R engines/ultima/ultima1/maps/map_base.cpp
  R engines/ultima/ultima1/maps/map_base.h
  R engines/ultima/ultima1/maps/map_city_castle.cpp
  R engines/ultima/ultima1/maps/map_city_castle.h
  R engines/ultima/ultima1/maps/map_dungeon.cpp
  R engines/ultima/ultima1/maps/map_dungeon.h
  R engines/ultima/ultima1/maps/map_overworld.cpp
  R engines/ultima/ultima1/maps/map_overworld.h
  R engines/ultima/ultima1/maps/map_tile.cpp
  R engines/ultima/ultima1/maps/map_tile.h
  R engines/ultima/ultima1/spells/blink.cpp
  R engines/ultima/ultima1/spells/blink.h
  R engines/ultima/ultima1/spells/create.cpp
  R engines/ultima/ultima1/spells/create.h
  R engines/ultima/ultima1/spells/destroy.cpp
  R engines/ultima/ultima1/spells/destroy.h
  R engines/ultima/ultima1/spells/kill_magic_missile.cpp
  R engines/ultima/ultima1/spells/kill_magic_missile.h
  R engines/ultima/ultima1/spells/ladder_down.cpp
  R engines/ultima/ultima1/spells/ladder_down.h
  R engines/ultima/ultima1/spells/ladder_up.cpp
  R engines/ultima/ultima1/spells/ladder_up.h
  R engines/ultima/ultima1/spells/open_unlock.cpp
  R engines/ultima/ultima1/spells/open_unlock.h
  R engines/ultima/ultima1/spells/prayer.cpp
  R engines/ultima/ultima1/spells/prayer.h
  R engines/ultima/ultima1/spells/spell.cpp
  R engines/ultima/ultima1/spells/spell.h
  R engines/ultima/ultima1/spells/steal.cpp
  R engines/ultima/ultima1/spells/steal.h
  R engines/ultima/ultima1/u1dialogs/armoury.cpp
  R engines/ultima/ultima1/u1dialogs/armoury.h
  R engines/ultima/ultima1/u1dialogs/buy_sell_dialog.cpp
  R engines/ultima/ultima1/u1dialogs/buy_sell_dialog.h
  R engines/ultima/ultima1/u1dialogs/combat.cpp
  R engines/ultima/ultima1/u1dialogs/combat.h
  R engines/ultima/ultima1/u1dialogs/dialog.cpp
  R engines/ultima/ultima1/u1dialogs/dialog.h
  R engines/ultima/ultima1/u1dialogs/drop.cpp
  R engines/ultima/ultima1/u1dialogs/drop.h
  R engines/ultima/ultima1/u1dialogs/full_screen_dialog.cpp
  R engines/ultima/ultima1/u1dialogs/full_screen_dialog.h
  R engines/ultima/ultima1/u1dialogs/grocery.cpp
  R engines/ultima/ultima1/u1dialogs/grocery.h
  R engines/ultima/ultima1/u1dialogs/king.cpp
  R engines/ultima/ultima1/u1dialogs/king.h
  R engines/ultima/ultima1/u1dialogs/magic.cpp
  R engines/ultima/ultima1/u1dialogs/magic.h
  R engines/ultima/ultima1/u1dialogs/ready.cpp
  R engines/ultima/ultima1/u1dialogs/ready.h
  R engines/ultima/ultima1/u1dialogs/stats.cpp
  R engines/ultima/ultima1/u1dialogs/stats.h
  R engines/ultima/ultima1/u1dialogs/tavern.cpp
  R engines/ultima/ultima1/u1dialogs/tavern.h
  R engines/ultima/ultima1/u1dialogs/transports.cpp
  R engines/ultima/ultima1/u1dialogs/transports.h
  R engines/ultima/ultima1/u1dialogs/weaponry.cpp
  R engines/ultima/ultima1/u1dialogs/weaponry.h
  R engines/ultima/ultima1/u1gfx/drawing_support.cpp
  R engines/ultima/ultima1/u1gfx/drawing_support.h
  R engines/ultima/ultima1/u1gfx/flags.xbm
  R engines/ultima/ultima1/u1gfx/info.cpp
  R engines/ultima/ultima1/u1gfx/info.h
  R engines/ultima/ultima1/u1gfx/logo.xbm
  R engines/ultima/ultima1/u1gfx/sprites.cpp
  R engines/ultima/ultima1/u1gfx/sprites.h
  R engines/ultima/ultima1/u1gfx/status.cpp
  R engines/ultima/ultima1/u1gfx/status.h
  R engines/ultima/ultima1/u1gfx/text_cursor.cpp
  R engines/ultima/ultima1/u1gfx/text_cursor.h
  R engines/ultima/ultima1/u1gfx/view_char_gen.cpp
  R engines/ultima/ultima1/u1gfx/view_char_gen.h
  R engines/ultima/ultima1/u1gfx/view_game.cpp
  R engines/ultima/ultima1/u1gfx/view_game.h
  R engines/ultima/ultima1/u1gfx/view_title.cpp
  R engines/ultima/ultima1/u1gfx/view_title.h
  R engines/ultima/ultima1/u1gfx/viewport_dungeon.cpp
  R engines/ultima/ultima1/u1gfx/viewport_dungeon.h
  R engines/ultima/ultima1/u1gfx/viewport_map.cpp
  R engines/ultima/ultima1/u1gfx/viewport_map.h
  R engines/ultima/ultima1/u6gfx/game_view.cpp
  R engines/ultima/ultima1/u6gfx/game_view.h
  R engines/ultima/ultima1/widgets/attack_effect.cpp
  R engines/ultima/ultima1/widgets/attack_effect.h
  R engines/ultima/ultima1/widgets/bard.cpp
  R engines/ultima/ultima1/widgets/bard.h
  R engines/ultima/ultima1/widgets/dungeon_chest.cpp
  R engines/ultima/ultima1/widgets/dungeon_chest.h
  R engines/ultima/ultima1/widgets/dungeon_coffin.cpp
  R engines/ultima/ultima1/widgets/dungeon_coffin.h
  R engines/ultima/ultima1/widgets/dungeon_item.cpp
  R engines/ultima/ultima1/widgets/dungeon_item.h
  R engines/ultima/ultima1/widgets/dungeon_monster.cpp
  R engines/ultima/ultima1/widgets/dungeon_monster.h
  R engines/ultima/ultima1/widgets/dungeon_player.cpp
  R engines/ultima/ultima1/widgets/dungeon_player.h
  R engines/ultima/ultima1/widgets/dungeon_widget.cpp
  R engines/ultima/ultima1/widgets/dungeon_widget.h
  R engines/ultima/ultima1/widgets/guard.cpp
  R engines/ultima/ultima1/widgets/guard.h
  R engines/ultima/ultima1/widgets/king.cpp
  R engines/ultima/ultima1/widgets/king.h
  R engines/ultima/ultima1/widgets/merchant.cpp
  R engines/ultima/ultima1/widgets/merchant.h
  R engines/ultima/ultima1/widgets/merchant_armor.cpp
  R engines/ultima/ultima1/widgets/merchant_armor.h
  R engines/ultima/ultima1/widgets/merchant_armour.cpp
  R engines/ultima/ultima1/widgets/merchant_armour.h
  R engines/ultima/ultima1/widgets/merchant_grocer.cpp
  R engines/ultima/ultima1/widgets/merchant_grocer.h
  R engines/ultima/ultima1/widgets/merchant_magic.cpp
  R engines/ultima/ultima1/widgets/merchant_magic.h
  R engines/ultima/ultima1/widgets/merchant_tavern.cpp
  R engines/ultima/ultima1/widgets/merchant_tavern.h
  R engines/ultima/ultima1/widgets/merchant_transport.cpp
  R engines/ultima/ultima1/widgets/merchant_transport.h
  R engines/ultima/ultima1/widgets/merchant_weapons.cpp
  R engines/ultima/ultima1/widgets/merchant_weapons.h
  R engines/ultima/ultima1/widgets/overworld_monster.cpp
  R engines/ultima/ultima1/widgets/overworld_monster.h
  R engines/ultima/ultima1/widgets/overworld_widget.cpp
  R engines/ultima/ultima1/widgets/overworld_widget.h
  R engines/ultima/ultima1/widgets/person.cpp
  R engines/ultima/ultima1/widgets/person.h
  R engines/ultima/ultima1/widgets/princess.cpp
  R engines/ultima/ultima1/widgets/princess.h
  R engines/ultima/ultima1/widgets/transport.cpp
  R engines/ultima/ultima1/widgets/transport.h
  R engines/ultima/ultima1/widgets/urban_player.cpp
  R engines/ultima/ultima1/widgets/urban_player.h
  R engines/ultima/ultima1/widgets/urban_widget.cpp
  R engines/ultima/ultima1/widgets/urban_widget.h
  R engines/ultima/ultima1/widgets/wench.cpp
  R engines/ultima/ultima1/widgets/wench.h
    engines/ultima/metaengine.cpp
    engines/ultima/module.mk
    engines/ultima/shared/engine/events.cpp
    engines/ultima/shared/gfx/gfx_surface.cpp
    engines/ultima/shared/gfx/gfx_surface.h
    engines/ultima/ultima2/ultima2.h


diff --git a/engines/ultima/metaengine.cpp b/engines/ultima/metaengine.cpp
index bf4874265ac..e0be7aeea23 100644
--- a/engines/ultima/metaengine.cpp
+++ b/engines/ultima/metaengine.cpp
@@ -32,7 +32,7 @@
 #include "ultima/ultima0/metaengine.h"
 #endif
 #ifdef ENABLE_ULTIMA1
-#include "ultima/u1shared/early/ultima_early.h"
+#include "ultima/ultima1/ultima1.h"
 #endif
 #ifdef ENABLE_ULTIMA2
 #include "ultima/ultima2/ultima2.h"
@@ -196,7 +196,7 @@ Common::Error UltimaMetaEngine::createInstance(OSystem *syst, Engine **engine, c
 #endif
 #ifdef ENABLE_ULTIMA1
 	case Ultima::GAME_ULTIMA1:
-		*engine = new Ultima::Shared::UltimaEarlyEngine(syst, gd);
+		*engine = new Ultima::Ultima1::Ultima1Engine(syst, gd);
 		break;
 #endif
 #ifdef ENABLE_ULTIMA2
diff --git a/engines/ultima/module.mk b/engines/ultima/module.mk
index aa6be4ba342..c8258d9dc4f 100644
--- a/engines/ultima/module.mk
+++ b/engines/ultima/module.mk
@@ -5,7 +5,7 @@ MODULE_OBJS := \
 	shared/conf/xml_node.o \
 	shared/conf/xml_tree.o
 
-ifdef ENABLE_ULTIMA2
+ifdef ENABLE_ULTIMA1 || ENABLE_ULTIMA2
 MODULE_OBJS += \
 	shared/engine/events.o \
 	shared/engine/messages.o \
@@ -47,128 +47,25 @@ endif
 
 ifdef ENABLE_ULTIMA1
 MODULE_OBJS += \
-	u1shared/actions/action.o \
-	u1shared/actions/huh.o \
-	u1shared/actions/pass.o \
-	u1shared/core/base_object.o \
-	u1shared/core/character.o \
-	u1shared/core/file.o \
-	u1shared/core/lzw.o \
-	u1shared/core/map.o \
-	u1shared/core/message_target.o \
-	u1shared/core/mouse_cursor.o \
-	u1shared/core/named_item.o \
-	u1shared/core/party.o \
-	u1shared/core/str.o \
-	u1shared/core/tree_item.o \
-	u1shared/core/utils.o \
-	u1shared/core/widgets.o \
-	u1shared/early/font_resources.o \
-	u1shared/early/game.o \
-	u1shared/early/game_base.o \
-	u1shared/early/ultima_early.o \
-	u1shared/engine/events.o \
-	u1shared/engine/input_handler.o \
-	u1shared/engine/input_translator.o \
-	u1shared/engine/messages.o \
-	u1shared/engine/resources.o \
-	u1shared/gfx/bitmap.o \
-	u1shared/gfx/character_input.o \
-	u1shared/gfx/dungeon_surface.o \
-	u1shared/gfx/font.o \
-	u1shared/gfx/info.o \
-	u1shared/gfx/popup.o \
-	u1shared/gfx/screen.o \
-	u1shared/gfx/sprites.o \
-	u1shared/gfx/text_cursor.o \
-	u1shared/gfx/text_input.o \
-	u1shared/gfx/viewport_dungeon.o \
-	u1shared/gfx/viewport_map.o \
-	u1shared/gfx/visual_container.o \
-	u1shared/gfx/visual_item.o \
-	u1shared/gfx/visual_surface.o \
-	u1shared/maps/map.o \
-	u1shared/maps/map_base.o \
-	u1shared/maps/map_tile.o \
-	u1shared/maps/map_widget.o \
-	u1shared/maps/creature.o \
-	ultima1/actions/action.o \
-	ultima1/actions/attack.o \
-	ultima1/actions/move.o \
-	ultima1/actions/quit.o \
-	ultima1/actions/ready.o \
-	ultima1/actions/stats.o \
-	ultima1/core/debugger.o \
-	ultima1/core/party.o \
-	ultima1/core/quests.o \
-	ultima1/core/resources.o \
-	ultima1/maps/map.o \
-	ultima1/maps/map_base.o \
-	ultima1/maps/map_city_castle.o \
-	ultima1/maps/map_dungeon.o \
-	ultima1/maps/map_overworld.o \
-	ultima1/maps/map_tile.o \
-	ultima1/spells/blink.o \
-	ultima1/spells/create.o \
-	ultima1/spells/destroy.o \
-	ultima1/spells/kill_magic_missile.o \
-	ultima1/spells/ladder_down.o \
-	ultima1/spells/ladder_up.o \
-	ultima1/spells/open_unlock.o \
-	ultima1/spells/prayer.o \
-	ultima1/spells/spell.o \
-	ultima1/spells/steal.o \
-	ultima1/u1dialogs/armoury.o \
-	ultima1/u1dialogs/buy_sell_dialog.o \
-	ultima1/u1dialogs/combat.o \
-	ultima1/u1dialogs/dialog.o \
-	ultima1/u1dialogs/drop.o \
-	ultima1/u1dialogs/full_screen_dialog.o \
-	ultima1/u1dialogs/grocery.o \
-	ultima1/u1dialogs/king.o \
-	ultima1/u1dialogs/magic.o \
-	ultima1/u1dialogs/ready.o \
-	ultima1/u1dialogs/stats.o \
-	ultima1/u1dialogs/tavern.o \
-	ultima1/u1dialogs/transports.o \
-	ultima1/u1dialogs/weaponry.o \
-	ultima1/u1gfx/drawing_support.o \
-	ultima1/u1gfx/info.o \
-	ultima1/u1gfx/sprites.o \
-	ultima1/u1gfx/status.o \
-	ultima1/u1gfx/text_cursor.o \
-	ultima1/u1gfx/view_char_gen.o \
-	ultima1/u1gfx/view_game.o \
-	ultima1/u1gfx/view_title.o \
-	ultima1/u1gfx/viewport_dungeon.o \
-	ultima1/u1gfx/viewport_map.o \
-	ultima1/u6gfx/game_view.o \
-	ultima1/widgets/attack_effect.o \
-	ultima1/widgets/bard.o \
-	ultima1/widgets/dungeon_chest.o \
-	ultima1/widgets/dungeon_coffin.o \
-	ultima1/widgets/dungeon_item.o \
-	ultima1/widgets/dungeon_monster.o \
-	ultima1/widgets/dungeon_player.o \
-	ultima1/widgets/dungeon_widget.o \
-	ultima1/widgets/guard.o \
-	ultima1/widgets/king.o \
-	ultima1/widgets/merchant.o \
-	ultima1/widgets/merchant_armour.o \
-	ultima1/widgets/merchant_grocer.o \
-	ultima1/widgets/merchant_magic.o \
-	ultima1/widgets/merchant_tavern.o \
-	ultima1/widgets/merchant_transport.o \
-	ultima1/widgets/merchant_weapons.o \
-	ultima1/widgets/overworld_monster.o \
-	ultima1/widgets/overworld_widget.o \
-	ultima1/widgets/person.o \
-	ultima1/widgets/princess.o \
-	ultima1/widgets/transport.o \
-	ultima1/widgets/urban_player.o \
-	ultima1/widgets/urban_widget.o \
-	ultima1/widgets/wench.o \
-	ultima1/game.o
+	ultima1/ultima1.o \
+	ultima1/console.o \
+	ultima1/events.o \
+	ultima1/messages.o \
+	ultima1/metaengine.o \
+	ultima1/data/game.o \
+	ultima1/data/map.o \
+	ultima1/data/player.o \
+	ultima1/data/tiles.o \
+	ultima1/gfx/pic_decoder.o \
+	ultima1/views/view.o \
+	ultima1/views/commands.o \
+	ultima1/views/create_character.o \
+	ultima1/views/dead.o \
+	ultima1/views/overworld.o \
+	ultima1/views/overworld_map.o \
+	ultima1/views/stats.o \
+	ultima1/views/startup.o \
+	ultima1/views/title.o
 endif
 
 ifdef ENABLE_ULTIMA2
@@ -184,7 +81,13 @@ MODULE_OBJS += \
 	ultima2/data/tiles.o \
 	ultima2/gfx/pic_decoder.o \
 	ultima2/views/view.o \
+	ultima2/views/commands.o \
 	ultima2/views/create_character.o \
+	ultima2/views/dead.o \
+	ultima2/views/demo.o \
+	ultima2/views/overworld.o \
+	ultima2/views/overworld_map.o \
+	ultima2/views/stats.o \
 	ultima2/views/startup.o \
 	ultima2/views/title.o
 endif
diff --git a/engines/ultima/shared/engine/events.cpp b/engines/ultima/shared/engine/events.cpp
index 36147a5f737..68de554dc23 100644
--- a/engines/ultima/shared/engine/events.cpp
+++ b/engines/ultima/shared/engine/events.cpp
@@ -329,7 +329,7 @@ Shared::Gfx::GfxSurface UIElement::getSurface() const {
 }
 
 int UIElement::getRandomNumber(int minNumber, int maxNumber) {
-	return g_events->getRandomNumber(maxNumber - minNumber + 1) + minNumber;
+	return g_events->getRandomNumber(minNumber, maxNumber);
 }
 
 int UIElement::getRandomNumber(int maxNumber) {
diff --git a/engines/ultima/shared/gfx/gfx_surface.cpp b/engines/ultima/shared/gfx/gfx_surface.cpp
index 250cf2b7978..6f48f71578d 100644
--- a/engines/ultima/shared/gfx/gfx_surface.cpp
+++ b/engines/ultima/shared/gfx/gfx_surface.cpp
@@ -116,6 +116,19 @@ void GfxSurface::reverseColor() {
 	SWAP(_textColor, _bgColor);
 }
 
+void GfxSurface::xorBlitFrom(const ManagedSurface &src, const Common::Point &destPos) {
+	Graphics::Surface area = getSubArea(Common::Rect(destPos.x, destPos.y,
+		destPos.x + src.w, destPos.y + src.h));
+
+	for (int yCtr = 0; yCtr < src.h; ++yCtr) {
+		const byte *pSrc = (const byte *)src.getBasePtr(0, yCtr);
+		byte *pDest = (byte *)area.getBasePtr(0, yCtr);
+
+		for (int xCtr = 0; xCtr < src.w; ++xCtr, ++pSrc, ++pDest)
+			*pDest ^= *pSrc;
+	}
+}
+
 } // namespace Gfx
 } // namespace Shared
 } // namespace Ultima
diff --git a/engines/ultima/shared/gfx/gfx_surface.h b/engines/ultima/shared/gfx/gfx_surface.h
index 5bcc2076ce9..627734a99c7 100644
--- a/engines/ultima/shared/gfx/gfx_surface.h
+++ b/engines/ultima/shared/gfx/gfx_surface.h
@@ -57,9 +57,11 @@ public:
 	byte setColor(byte color);
 	void setColor(byte fgColor, byte bgColor);
 	void reverseColor();
-	bool setScrollable(bool flag) {
+	void setScrollable(bool flag) {
 		_scrollable = flag;
 	}
+
+	void xorBlitFrom(const ManagedSurface &src, const Common::Point &destPos);
 };
 
 } // namespace Gfx
diff --git a/engines/ultima/u1shared/actions/action.cpp b/engines/ultima/u1shared/actions/action.cpp
deleted file mode 100644
index 23a6b111bf9..00000000000
--- a/engines/ultima/u1shared/actions/action.cpp
+++ /dev/null
@@ -1,61 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-#include "ultima/u1shared/actions/action.h"
-#include "ultima/u1shared/early/game.h"
-#include "ultima/u1shared/maps/map.h"
-#include "ultima/u1shared/gfx/visual_item.h"
-#include "ultima/u1shared/engine/messages.h"
-
-namespace Ultima {
-namespace Shared {
-namespace Actions {
-
-Action::Action(TreeItem *parent) : TreeItem() {
-	assert(parent);
-	addUnder(parent);
-}
-
-Game *Action::getGame() {
-	return static_cast<Game *>(TreeItem::getGame());
-}
-
-Maps::Map *Action::getMap() {
-	return static_cast<Maps::Map *>(getGame()->getMap());
-}
-
-void Action::addInfoMsg(const Common::String &text, bool newLine, bool replaceLine) {
-	CInfoMsg msg(text, newLine, replaceLine);
-	msg.execute(getView());
-}
-
-void Action::playFX(uint effectId) {
-	getGame()->playFX(effectId);
-}
-
-void Action::endOfTurn() {
-	getGame()->endOfTurn();
-}
-
-} // End of namespace Actions
-} // End of namespace Shared
-} // End of namespace Ultima
-
diff --git a/engines/ultima/u1shared/actions/pass.h b/engines/ultima/u1shared/actions/pass.h
deleted file mode 100644
index 31fc0a8993f..00000000000
--- a/engines/ultima/u1shared/actions/pass.h
+++ /dev/null
@@ -1,55 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-#ifndef ULTIMA_SHARED_ACTIONS_PASS_H
-#define ULTIMA_SHARED_ACTIONS_PASS_H
-
-#include "ultima/u1shared/actions/action.h"
-#include "ultima/u1shared/engine/messages.h"
-
-namespace Ultima {
-namespace Shared {
-namespace Actions {
-
-class Pass : public Action {
-	DECLARE_MESSAGE_MAP;
-	bool PassMsg(CPassMsg *msg);
-private:
-	const char *&_text;
-public:
-	CLASSDEF;
-
-	/**
-	 * Constructor
-	 */
-	Pass(TreeItem *parent, const char *&text) : Action(parent), _text(text) {}
-
-	/**
-	 * Destructor
-	 */
-	~Pass() override {}
-};
-
-} // End of namespace Actions
-} // End of namespace Shared
-} // End of namespace Ultima
-
-#endif
diff --git a/engines/ultima/u1shared/core/base_object.cpp b/engines/ultima/u1shared/core/base_object.cpp
deleted file mode 100644
index eba505e63bf..00000000000
--- a/engines/ultima/u1shared/core/base_object.cpp
+++ /dev/null
@@ -1,48 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-#include "ultima/u1shared/core/base_object.h"
-#include "ultima/u1shared/core/tree_item.h"
-#include "ultima/u1shared/core/named_item.h"
-
-namespace Ultima {
-namespace Shared {
-
-ClassDef BaseObject::type() {
-	return ClassDef("BaseObject", nullptr);
-}
-
-bool BaseObject::isInstanceOf(const ClassDef &classDef) const {
-	ClassDef def = getType();
-	for (;;) {
-		if (def == classDef)
-			return true;
-
-		if (!def.hasParent())
-			break;
-		def = def.parent();
-	}
-
-	return false;
-}
-
-} // End of namespace Shared
-} // End of namespace Ultima
diff --git a/engines/ultima/u1shared/core/base_object.h b/engines/ultima/u1shared/core/base_object.h
deleted file mode 100644
index 643382d3600..00000000000
--- a/engines/ultima/u1shared/core/base_object.h
+++ /dev/null
@@ -1,88 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-#ifndef ULTIMA_SHARED_CORE_BASE_OBJECT_H
-#define ULTIMA_SHARED_CORE_BASE_OBJECT_H
-
-#include "common/scummsys.h"
-#include "common/array.h"
-#include "common/hash-str.h"
-#include "common/list.h"
-#include "ultima/u1shared/core/file.h"
-
-namespace Ultima {
-namespace Shared {
-
-class BaseObject;
-
-class ClassDef;
-typedef ClassDef(*ClassDefFn)();
-
-/**
- * Encapsulation of a class definition. Used as part of the message dispatch system
- * to identify classes that implement particular messages
- */
-class ClassDef {
-private:
-	ClassDefFn _parentFn;
-public:
-	const char *_className;
-public:
-	ClassDef(const char *className, const ClassDefFn parentFn) :
-		_className(className), _parentFn(parentFn) {
-	}
-
-	bool hasParent() const {
-		return _parentFn != nullptr;
-	}
-	ClassDef parent() const {
-		return (*_parentFn)();
-	}
-	bool operator==(const ClassDef &right) const {
-		return !strcmp(_className, right._className);
-	}
-};
-
-#define CLASSDEF \
-	static ::Ultima::Shared::ClassDef type(); \
-	::Ultima::Shared::ClassDef getType() const override { return type(); }
-
-/**
- * Defines the most basic root of the engine's object hierarchy.
- */
-class BaseObject {
-public:
-		static ::Ultima::Shared::ClassDef type();
-		virtual ::Ultima::Shared::ClassDef getType() const { return type(); }
-		virtual ~BaseObject() {
-	}
-
-	/**
-	 * Returns true if a given object is of the type defined by the class definition,
-	 * or one of it's descendants
-	 */
-	bool isInstanceOf(const ClassDef &classDef) const;
-};
-
-} // End of namespace Shared
-} // End of namespace Ultima
-
-#endif
diff --git a/engines/ultima/u1shared/core/character.cpp b/engines/ultima/u1shared/core/character.cpp
deleted file mode 100644
index e6f5b78c53c..00000000000
--- a/engines/ultima/u1shared/core/character.cpp
+++ /dev/null
@@ -1,63 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-#include "ultima/u1shared/core/party.h"
-
-namespace Ultima {
-namespace Shared {
-
-template<typename T>
-void syncArray(Common::Array<T *> &items, Common::Serializer &s) {
-	uint count = items.size();
-	s.syncAsByte(count);
-	if (s.isLoading())
-		assert(count == items.size());
-
-	for (uint idx = 0; idx < items.size(); ++idx)
-		items[idx]->synchronize(s);
-}
-
-void Character::synchronize(Common::Serializer &s) {
-	s.syncString(_name);
-	s.syncAsByte(_race);
-	s.syncAsByte(_sex);
-	s.syncAsByte(_class);
-	s.syncAsUint16LE(_strength);
-	s.syncAsUint16LE(_agility);
-	s.syncAsUint16LE(_stamina);
-	s.syncAsUint16LE(_charisma);
-	s.syncAsUint16LE(_wisdom);
-	s.syncAsUint16LE(_intelligence);
-	s.syncAsUint32LE(_hitPoints);
-	s.syncAsUint32LE(_experience);
-	s.syncAsUint32LE(_food);
-	s.syncAsUint32LE(_coins);
-	s.syncAsSByte(_equippedWeapon);
-	s.syncAsSByte(_equippedArmour);
-	s.syncAsSByte(_equippedSpell);
-
-	syncArray<Weapon>(_weapons, s);
-	syncArray<Armour>(_armour, s);
-	syncArray<Spell>(_spells, s);
-}
-
-} // End of namespace Shared
-} // End of namespace Ultima
diff --git a/engines/ultima/u1shared/core/character.h b/engines/ultima/u1shared/core/character.h
deleted file mode 100644
index 87b9a415dbc..00000000000
--- a/engines/ultima/u1shared/core/character.h
+++ /dev/null
@@ -1,231 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-#ifndef ULTIMA_SHARED_CORE_CHARACTER_H
-#define ULTIMA_SHARED_CORE_CHARACTER_H
-
-#include "common/array.h"
-#include "common/str.h"
-#include "common/serializer.h"
-#include "ultima/u1shared/core/named_item.h"
-
-namespace Ultima {
-namespace Shared {
-
-enum Sex { SEX_MALE = 0, SEX_FEMALE = 1, SEX_OTHER = 2, SEX_YES_PLEASE = 2 };
-
-/**
- * Base class for class types that have a quantity
- */
-class Itemized {
-public:
-	uint _quantity;
-public:
-	/**
-	 * Constructor
-	 */
-	Itemized() : _quantity(0) {}
-
-	/**
-	 * Destructor
-	 */
-	virtual ~Itemized() {}
-
-	/**
-	 * Synchronize data
-	 */
-	void synchronize(Common::Serializer &s) {
-		s.syncAsUint16LE(_quantity);
-	}
-
-	/**
-	 * Change the quantity by a given amount
-	 */
-	virtual void changeQuantity(int delta) {
-		_quantity = (uint)CLIP((int)_quantity + delta, 0, 9999);
-	}
-
-	/**
-	 * Increase the quantity by 1
-	 */
-	void incrQuantity() { changeQuantity(1); }
-
-	/**
-	 * Returns if the itemized is empty
-	 */
-	bool empty() const { return _quantity == 0; }
-
-	/**
-	 * Decrease the quantity by 1
-	 */
-	bool decrQuantity() {
-		changeQuantity(-1);
-		return empty();
-	}
-};
-
-/**
- * Weapon entry
- */
-class Weapon : public Itemized {
-public:
-	Common::String _shortName, _longName;
-	uint _distance;
-public:
-	/**
-	 * Constructor
-	 */
-	Weapon() : Itemized(), _distance(0) {}
-};
-
-/**
- * Armour entry
- */
-class Armour : public Itemized {
-public:
-	Common::String _name;
-};
-
-/**
- * Spell entry
- */
-class Spell : public Itemized, public NamedItem {
-};
-
-template<class T>
-class ItemArray : public Common::Array<T> {
-public:
-	/**
-	 * Returns the number of distinct types of items in the array, not counting
-	 * the slot 0 "nothing" slot
-	 */
-	size_t itemsCount() const {
-		uint total = 0;
-		for (uint idx = 1; idx < this->size(); ++idx) {
-			if (!(*this)[idx]->empty())
-				++total;
-		}
-
-		return total;
-	}
-
-	/**
-	 * Returns true if the character has no items
-	 */
-	bool hasNothing() const {
-		return itemsCount() == 0;
-	}
-};
-
-/**
- * Implements the data for a playable character within the game
- */
-class Character {
-public:
-	Common::String _name;
-	uint _race;
-	Sex _sex;
-	uint _class;
-
-	uint _strength;
-	uint _agility;
-	uint _stamina;
-	uint _charisma;
-	uint _wisdom;
-	uint _intelligence;
-	uint _hitPoints;
-	uint _experience;
-	uint _food;
-	uint _coins;
-	int _equippedWeapon;
-	int _equippedArmour;
-	int _equippedSpell;
-	ItemArray<Weapon *> _weapons;
-	ItemArray<Armour *> _armour;
-	ItemArray<Spell *> _spells;
-public:
-	/**
-	 * Constructor
-	 */
-	Character() : _strength(0), _agility(0), _stamina(0), _charisma(0), _wisdom(0), _intelligence(0),
-		_hitPoints(0), _experience(0), _food(0), _coins(0), _equippedWeapon(0), _equippedArmour(0), _equippedSpell(0),
-		_race(0), _sex(SEX_MALE), _class(0) {}
-
-	/**
-	 * Handles loading and saving games
-	 */
-	void synchronize(Common::Serializer &s);
-
-	/**
-	 * Returns true if a weapon is equipped
-	 */
-	bool isWeaponEquipped() const { return _equippedWeapon != 0; }
-
-	/**
-	 * Returns true if armor is equipped
-	 */
-	bool isArmourEquipped() const { return _equippedArmour != 0; }
-
-	/**
-	 * Returns true if a spell is equipped
-	 */
-	bool isSpellEquipped() const { return _equippedSpell != 0; }
-
-	/**
-	 * Return the equipped weapon
-	 */
-	Weapon *equippedWeapon() const { return _weapons[_equippedWeapon]; }
-
-	/**
-	 * Return the equipped armor
-	 */
-	Armour *equippedArmour() const { return _armour[_equippedArmour]; }
-
-	/**
-	 * Return the equipped spell
-	 */
-	Spell *equippedSpell() const { return _spells[_equippedSpell]; }
-
-	/**
-	 * Removes any equipped weapon
-	 */
-	void removeWeapon() { _equippedWeapon = 0; }
-
-	/**
-	 * Removes any eqipped armor
-	 */
-	void removeArmour() { _equippedArmour = 0; }
-
-	/**
-	 * Remove any equipped spell
-	 */
-	void removeSpell() { _equippedSpell = 0; }
-
-	/**
-	 * Gets the character's experience level
-	 */
-	uint getLevel() const { return (_experience / 1000) + 1; }
-};
-
-} // End of namespace Shared
-} // End of namespace Ultima
-
-#endif
diff --git a/engines/ultima/u1shared/core/file.cpp b/engines/ultima/u1shared/core/file.cpp
deleted file mode 100644
index cbcdc92c671..00000000000
--- a/engines/ultima/u1shared/core/file.cpp
+++ /dev/null
@@ -1,85 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-#include "common/util.h"
-#include "ultima/u1shared/core/file.h"
-#include "ultima/u1shared/early/ultima_early.h"
-
-namespace Ultima {
-namespace Shared {
-
-#define ERROR error("Could not open file - %s", name.c_str())
-#define PATH_ERROR error("Could not open file - %s", name.toString(Common::Path::kNativeSeparator).c_str())
-
-File::File(const Common::Path &name) : Common::File(), _filesize(-1) {
-	close();
-
-	if (!Common::File::open(name))
-		PATH_ERROR;
-}
-
-bool File::open(const Common::Path &name) {
-	close();
-
-	if (!Common::File::open(name))
-		PATH_ERROR;
-	return true;
-}
-
-bool File::open(const Common::Path &name, Common::Archive &archive) {
-	close();
-
-	if (!Common::File::open(name, archive))
-		PATH_ERROR;
-	return true;
-}
-
-bool File::open(const Common::FSNode &node) {
-	close();
-
-	Common::String name = node.getName();
-	if (!Common::File::open(node))
-		ERROR;
-	return true;
-}
-
-bool File::open(SeekableReadStream *stream, const Common::String &name) {
-	close();
-
-	if (!Common::File::open(stream, name))
-		ERROR;
-	return true;
-}
-
-void File::close() {
-	_filesize = -1;
-	Common::File::close();
-}
-
-bool File::eof() {
-	if (_filesize == -1)
-		_filesize = size();
-
-	return pos() >= _filesize;
-}
-
-} // End of namespace Shared
-} // End of namespace Ultima
diff --git a/engines/ultima/u1shared/core/file.h b/engines/ultima/u1shared/core/file.h
deleted file mode 100644
index e06bf8ef2ef..00000000000
--- a/engines/ultima/u1shared/core/file.h
+++ /dev/null
@@ -1,81 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-#ifndef ULTIMA_SHARED_CORE_FILE_H
-#define ULTIMA_SHARED_CORE_FILE_H
-
-#include "common/file.h"
-#include "common/str.h"
-
-namespace Ultima {
-namespace Shared {
-
-/**
- * Simple ScummVM File descendent that throws a wobbly if the file it tries to open isn't present
- */
-class File : public Common::File {
-private:
-	int32 _filesize;
-public:
-	File() : Common::File(), _filesize(-1) {}
-	File(const Common::Path &name);
-
-	/**
-	 * Open the file with the given filename, by searching SearchMan.
-	 * @param	name	the name of the file to open
-	 */
-	bool open(const Common::Path &name) override;
-
-	/**
-	 * Open the file with the given filename from within the given archive.
-	 * @param	name	the name of the file to open
-	 * @param	archive		the archive in which to search for the file
-	 */
-	bool open(const Common::Path &name, Common::Archive &archive) override;
-
-	/**
-	 * Open the file corresponding to the give node.
-	 * @param   node        the node to consider.
-	 */
-	bool open(const Common::FSNode &node) override;
-
-	/**
-	 * 'Open' the given stream. That is, we just wrap around it
-	 * @param	stream		a pointer to a SeekableReadStream, or 0
-	 * @param	name		a string describing the 'file' corresponding to stream
-	 */
-	bool open(SeekableReadStream *stream, const Common::String &name) override;
-
-	/**
-	 * Close the currently open file
-	 */
-	void close() override;
-
-	/**
-	 * Differing eof that returns true when pos == size as well as beyond
-	 */
-	bool eof();
-};
-
-} // End of namespace Shared
-} // End of namespace Ultima
-
-#endif
diff --git a/engines/ultima/u1shared/core/game_state.h b/engines/ultima/u1shared/core/game_state.h
deleted file mode 100644
index 0a28b09e6ec..00000000000
--- a/engines/ultima/u1shared/core/game_state.h
+++ /dev/null
@@ -1,112 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-#ifndef ULTIMA_SHARED_CORE_GAME_STATE_H
-#define ULTIMA_SHARED_CORE_GAME_STATE_H
-
-#include "ultima/u1shared/core/rect.h"
-#include "ultima/u1shared/core/character.h"
-#include "ultima/u1shared/core/map.h"
-
-namespace Ultima {
-namespace Shared {
-
-class Game;
-
-enum VideoMode {
-	UNSET = -1, CGA = 0, EGA = 1, TGA = 2, VGA_ENHANCED = 3
-};
-
-class GameState {
-protected:
-	Game *_game;
-public:
-	/**
-	 * Position in the world map. This is stored separately from the map so that the same point can
-	 * be returned to when leaving locations
-	 */
-	Point _worldMapPos;
-
-	/**
-	 * Characters in the party. In the earlier Ultima games, this is a single character
-	 */
-	CharacterArray _characters;
-
-	/**
-	 * Currently active character. In earlier Ultima games, this is the single party member
-	 */
-	Character *_currentCharacter;
-
-	/**
-	 * Pointer to the map manager for the game
-	 */
-	Map *_map;
-
-	/**
-	 * Game type Id
-	 */
-	uint _gameId;
-
-	/**
-	 * Video mode
-	 */
-	VideoMode _videoMode;
-
-	/**
-	 * The number of hit points to generate when a dungeon is left
-	 */
-	uint _dungeonExitHitPoints;
-
-	/**
-	 * Stores the base random seed used for generating deterministic dungeon levels
-	 */
-	uint32 _randomSeed;
-public:
-	/**
-	 * Constructor
-	 */
-	GameState(Game *game);
-
-	/**
-	 * Destructor
-	 */
-	virtual ~GameState();
-
-	/**
-	 * Setup the initial game state
-	 */
-	virtual void setup() {}
-
-	/**
-	 * Returns true if the party is dead
-	 */
-	bool isPartyDead() const;
-
-	/**
-	 * Returns true if the party has no food
-	 */
-	bool isPartyFoodless() const;
-};
-
-} // End of namespace Shared
-} // End of namespace Ultima
-
-#endif
diff --git a/engines/ultima/u1shared/core/lzw.cpp b/engines/ultima/u1shared/core/lzw.cpp
deleted file mode 100644
index 68ee3cbb911..00000000000
--- a/engines/ultima/u1shared/core/lzw.cpp
+++ /dev/null
@@ -1,135 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-#include "common/endian.h"
-#include "common/util.h"
-#include "ultima/u1shared/core/lzw.h"
-
-namespace Ultima {
-namespace Shared {
-
-void LZW::decompress(Common::ReadStream *source, Common::WriteStream *dest) {
-	int32 destSize = source->readUint32LE();
-	_source = source;
-	_currentByte = source->readByte();
-
-	byte litByte = 0;
-	uint16 oldCode = 0;
-	uint16 copyLength, maxCodeValue, code, nextCode, lastCode;
-
-	byte *copyBuf = new byte[8192];
-
-	struct {
-		uint16 code; byte value;
-	} codeTable[8192];
-	memset(codeTable, 0, sizeof(codeTable));
-
-	_codeLength = 9;
-	nextCode = 258;
-	maxCodeValue = 512;
-
-	copyLength = 0;
-	_sourceBitsLeft = 8;
-
-	for (;;) {
-		code = getCode();
-
-		if (code == 257)
-			break;
-
-		if (code == 256) {
-			_codeLength = 9;
-			nextCode = 258;
-			maxCodeValue = 512;
-			lastCode = getCode();
-			oldCode = lastCode;
-			litByte = lastCode;
-			dest->writeByte(litByte);
-		} else {
-			lastCode = code;
-			if (code >= nextCode) {
-				lastCode = oldCode;
-				copyBuf[copyLength++] = litByte;
-			}
-			while (lastCode > 255) {
-				copyBuf[copyLength++] = codeTable[lastCode].value;
-				lastCode = codeTable[lastCode].code;
-			}
-			litByte = lastCode;
-			copyBuf[copyLength++] = lastCode;
-			while (copyLength > 0)
-				dest->writeByte(copyBuf[--copyLength]);
-			codeTable[nextCode].value = lastCode;
-			codeTable[nextCode].code = oldCode;
-			nextCode++;
-			oldCode = code;
-			if (nextCode >= maxCodeValue && _codeLength <= 12) {
-				_codeLength++;
-				maxCodeValue <<= 1;
-			}
-		}
-	}
-
-	delete[] copyBuf;
-	assert(dest->pos() == destSize);
-}
-
-uint16 LZW::getCode() {
-	const byte bitMasks[9] = {
-		0x00, 0x01, 0x03, 0x07, 0x0F, 0x1F, 0x3F, 0x7F, 0x0FF
-	};
-
-	byte   resultBitsLeft = _codeLength;
-	byte   resultBitsPos = 0;
-	uint16 result = 0;
-	byte   currentByte = _currentByte;
-	byte   currentBits = 0;
-
-	// Get bits of current byte
-	while (resultBitsLeft) {
-		if (resultBitsLeft < _sourceBitsLeft) {
-			// we need less than we have left
-			currentBits = (currentByte >> (8 - _sourceBitsLeft)) &bitMasks[resultBitsLeft];
-			result |= (currentBits << resultBitsPos);
-			_sourceBitsLeft -= resultBitsLeft;
-			resultBitsLeft = 0;
-
-		} else {
-			// we need as much as we have left or more
-			resultBitsLeft -= _sourceBitsLeft;
-			currentBits = currentByte >> (8 - _sourceBitsLeft);
-			result |= (currentBits << resultBitsPos);
-			resultBitsPos += _sourceBitsLeft;
-
-			// Go to next byte
-			_currentByte = _source->readByte();
-
-			_sourceBitsLeft = 8;
-			if (resultBitsLeft) {
-				currentByte = _currentByte;
-			}
-		}
-	}
-	return result;
-}
-
-} // End of namespace Shared
-} // End of namespace Ultima
diff --git a/engines/ultima/u1shared/core/map.cpp b/engines/ultima/u1shared/core/map.cpp
deleted file mode 100644
index 13b2dc40065..00000000000
--- a/engines/ultima/u1shared/core/map.cpp
+++ /dev/null
@@ -1,295 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-#include "ultima/u1shared/core/map.h"
-#include "ultima/u1shared/early/game.h"
-#include "ultima/u1shared/gfx/visual_item.h"
-
-namespace Ultima {
-namespace Shared {
-
-void MapTile::clear() {
-	_tileId = _tileNum = -1;
-	_widgetNum = -1;
-	_widget = nullptr;
-	_itemNum = -1;
-	_isDoor = _isSecretDoor = false;
-	_isLadderUp = _isLadderDown = false;
-	_isWall = _isHallway = _isBeams = false;
-}
-
-/*-------------------------------------------------------------------*/
-
-void Map::MapBase::clear() {
-	_mapId = 0;
-	_data.clear();
-	_widgets.clear();
-}
-
-void Map::MapBase::load(MapId mapId) {
-	_mapId = mapId;
-}
-
-void Map::MapBase::synchronize(Common::Serializer &s) {
-	_viewportPos.synchronize(s);
-	uint size;
-	int transportIndex = -1;
-	Common::String name;
-
-	if (s.isSaving()) {
-		// Save widgets
-		size = 0;
-		for (uint idx = 0; idx < _widgets.size(); ++idx) {
-			if (_widgets[idx]->getClassName())
-				++size;
-			if (_playerWidget == _widgets[idx].get())
-				transportIndex = (int)idx;
-		}
-		assert(transportIndex >= 0);
-
-		s.syncAsUint16LE(size);
-		for (uint idx = 0; idx < _widgets.size(); ++idx) {
-			name = _widgets[idx]->getClassName();
-			if (!name.empty()) {
-				s.syncString(name);
-				_widgets[idx]->synchronize(s);
-			}
-		}
-		s.syncAsUint16LE(transportIndex);
-
-	} else {
-		// Load widgets
-		s.syncAsUint16LE(size);
-		_widgets.clear();
-		for (uint idx = 0; idx < size; ++idx) {
-			s.syncString(name);
-
-			MapWidget *w = _map->createWidget(this, name);
-			w->synchronize(s);
-			addWidget(w);
-		}
-
-		s.syncAsUint16LE(transportIndex);
-		_playerWidget = _widgets[transportIndex].get();
-	}
-}
-
-void Map::MapBase::setDimensions(const Point &size) {
-	_data.resize(size.y);
-	for (int y = 0; y < size.y; ++y)
-		_data[y]._data.resize(size.x);
-	_size = size;
-}
-
-Point Map::MapBase::getDirectionDelta() const {
-	switch (_playerWidget->_direction) {
-	case DIR_LEFT:
-		return Point(-1, 0);
-	case DIR_RIGHT:
-		return Point(1, 0);
-	case DIR_UP:
-		return Point(0, -1);
-	default:
-		return Point(0, 1);
-	}
-}
-
-Point Map::MapBase::getDeltaPosition(const Point &delta) {
-	return _playerWidget->_position + delta;
-}
-
-void Map::MapBase::resetViewport() {
-	// Reset the viewport, so it's position will get recalculated
-	_viewportPos.reset();
-}
-
-Point Map::MapBase::getViewportPosition(const Point &viewportSize) {
-	Point &topLeft = _viewportPos._topLeft;
-
-	if (!_viewportPos.isValid() || _viewportPos._size != viewportSize) {
-		// Calculate the new position
-		topLeft.x = _playerWidget->_position.x - (viewportSize.x - 1) / 2;
-		topLeft.y = _playerWidget->_position.y - (viewportSize.y - 1) / 2;
-
-		// Fixed maps, so constrain top left corner so the map fills the viewport.
-		// This will accommodate future renderings with more tiles, or greater tile size
-		topLeft.x = CLIP((int)topLeft.x, 0, (int)(width() - viewportSize.x));
-		topLeft.y = CLIP((int)topLeft.y, 0, (int)(height() - viewportSize.y));
-	}
-
-	return topLeft;
-}
-
-void Map::MapBase::shiftViewport(const Point &delta) {
-	Point &topLeft = _viewportPos._topLeft;
-	topLeft += delta;
-
-	// Shift the viewport, but constraining the map to fill up the screen
-	topLeft.x = CLIP(topLeft.x, (int16)0, (int16)(width() - _viewportPos._size.x));
-	topLeft.y = CLIP(topLeft.y, (int16)0, (int16)(height() - _viewportPos._size.y));
-}
-
-void Map::MapBase::addWidget(MapWidget *widget) {
-	_widgets.push_back(MapWidgetPtr(widget));
-}
-
-void Map::MapBase::removeWidget(MapWidget *widget) {
-	for (uint idx = 0; idx < _widgets.size(); ++idx) {
-		if (_widgets[idx].get() == widget) {
-			_widgets.remove_at(idx);
-			break;
-		}
-	}
-}
-
-void Map::MapBase::getTileAt(const Point &pt, MapTile *tile) {
-	tile->clear();
-
-	// Get the base tile
-	tile->_tileNum = tile->_tileId = _data[pt.y][pt.x];
-
-	// Check for any widget on that map tile
-	for (int idx = (int)_widgets.size() - 1; idx >= 0; --idx) {
-		MapWidget *widget = _widgets[idx].get();
-		if (widget->_position == pt) {
-			tile->_widgetNum = idx;
-			tile->_widget = widget;
-			break;
-		}
-	}
-}
-
-void Map::MapBase::update() {
-	// Call the update method of each widget, to allow for things like npc movement, etc.
-	for (uint idx = 0; idx < _widgets.size(); ++idx)
-		_widgets[idx].get()->update(true);
-
-	// Call the update method of each widget, to allow for things like npc movement, etc.
-	for (uint idx = 0; idx < _widgets.size(); ++idx)
-		_widgets[idx].get()->update(false);
-}
-
-Point Map::MapBase::getPosition() const {
-	return _playerWidget->_position;
-}
-
-void Map::MapBase::setPosition(const Point &pt) {
-	_playerWidget->_position = pt;
-}
-
-Direction Map::MapBase::getDirection() const {
-	return _playerWidget->_direction;
-}
-
-void Map::MapBase::setDirection(Direction dir) {
-	_playerWidget->_direction = dir;
-}
-
-/*------------------------------------------------------------------------*/
-
-void MapWidget::synchronize(Common::Serializer &s) {
-	s.syncAsUint16LE(_position.x);
-	s.syncAsSint16LE(_position.y);
-	s.syncAsByte(_direction);
-	s.syncString(_name);
-}
-
-void MapWidget::addInfoMsg(const Common::String &text, bool newLine) {
-	CInfoMsg msg(text, newLine);
-	msg.execute(_game->getView());
-}
-
-MapWidget::CanMove MapWidget::canMoveTo(const Point &destPos) {
-	if (destPos.x < 0 || destPos.y < 0 || destPos.x >= (int)_map->width() || destPos.y >= (int)_map->height()) {
-		// If the map is fixed, allow moving beyond it's edges so it can be left
-		if (!_map->isMapWrapped())
-			return YES;
-	}
-
-	// Get the details of the position
-	MapTile destTile;
-	_map->getTileAt(destPos, &destTile);
-
-	// If there's a widget blocking the tile, return false
-	if (destTile._widget && destTile._widget->isBlocking())
-		return NO;
-
-	return UNSET;
-}
-
-void MapWidget::moveTo(const Point &destPos, Direction dir) {
-	// If no direction is specified, we'll need to figure it out relative to the old position
-	if (dir == DIR_NONE) {
-		Point delta = destPos - _position;
-		if (ABS(delta.x) > ABS(delta.y))
-			_direction = delta.x > 0 ? DIR_EAST : DIR_WEST;
-		else if (delta.y != 0)
-			_direction = delta.y > 0 ? DIR_SOUTH : DIR_NORTH;
-	} else {
-		_direction = dir;
-	}
-
-	// Set new location
-	_position = destPos;
-
-	// Handle wrap around if need be on maps that wrap
-	if (_map->isMapWrapped()) {
-		if (_position.x < 0)
-			_position.x += _map->width();
-		else if (_position.x >= (int)_map->width())
-			_position.x -= _map->width();
-		if (_position.y < 0)
-			_position.y += _map->height();
-		else if (_position.y >= (int)_map->height())
-			_position.y -= _map->height();
-	}
-}
-
-/*-------------------------------------------------------------------*/
-
-void Map::clear() {
-	if (_mapArea)
-		_mapArea->clear();
-	_mapArea = nullptr;
-}
-
-void Map::load(MapId mapId) {
-	_mapArea = nullptr;
-}
-
-void Map::synchronize(Common::Serializer &s) {
-	int mapId;
-
-	if (s.isSaving()) {
-		// Saving
-		mapId = _mapArea->getMapId();
-		s.syncAsUint16LE(mapId);
-	} else {
-		// Loading
-		s.syncAsUint16LE(mapId);
-		load(mapId);
-	}
-
-	_mapArea->synchronize(s);
-}
-
-} // End of namespace Shared
-} // End of namespace Ultima
diff --git a/engines/ultima/u1shared/core/map.h b/engines/ultima/u1shared/core/map.h
deleted file mode 100644
index bbb8885852e..00000000000
--- a/engines/ultima/u1shared/core/map.h
+++ /dev/null
@@ -1,562 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-#ifndef ULTIMA_SHARED_CORE_MAP_H
-#define ULTIMA_SHARED_CORE_MAP_H
-
-#include "common/array.h"
-#include "common/ptr.h"
-#include "common/serializer.h"
-#include "ultima/u1shared/core/rect.h"
-#include "ultima/u1shared/gfx/dungeon_surface.h"
-
-namespace Ultima {
-namespace Shared {
-
-#define REGISTER_WIDGET(NAME) if (name == #NAME) return new Widgets::NAME(_game, (Ultima1Map::MapBase *)map)
-#define DECLARE_WIDGET(NAME) const char *getClassName() const override { return #NAME; }
-
-enum Direction {
-	DIR_NONE = 0,
-	DIR_LEFT = 1, DIR_RIGHT = 2, DIR_UP = 3, DIR_DOWN = 4,
-	DIR_WEST = 1, DIR_EAST = 2, DIR_NORTH = 3, DIR_SOUTH = 4
-};
-
-typedef byte MapCell;
-typedef int MapId;
-
-class Game;
-class MapWidget;
-
-typedef Common::SharedPtr<MapWidget> MapWidgetPtr;
-
-/**
- * Contains data about a given position within the map
- */
-class MapTile {
-public:
-	int _tileId;							// Tile Id
-	int _tileNum;							// Tile number to display. Normally equals Tile Id, but can differ in rare cases
-	int _widgetNum;							// Widget number, if any
-	MapWidget *_widget;						// Widget pointer
-	int _itemNum;							// Item number, if any
-	// Dungeon tile flags
-	bool _isDoor, _isSecretDoor;
-	bool _isLadderUp, _isLadderDown;
-	bool _isWall, _isHallway, _isBeams;
-public:
-	/**
-	 * Constructor
-	 */
-	MapTile() : _tileNum(-1), _tileId(-1), _widgetNum(-1), _widget(nullptr), _itemNum(-1),
-		_isDoor(false), _isSecretDoor(false), _isLadderUp(false), _isLadderDown(false), _isWall(false),
-		_isHallway(false), _isBeams(false) {}
-
-	/**
- 	 * Destructor
-	 */
-	virtual ~MapTile() {}
-
-	/**
-	 * Clears the map tile information
-	 */
-	virtual void clear();
-
-	/**
-	 * Returns true if the tile is a door in a dungeon
-	 */
-	bool isDoor() const { return _isDoor; }
-
-	/**
-	 * Returns true if the tile is a wall or secret door in a dungeon
-	 */
-	bool isWallOrSecretDoor() const { return _isWall || _isSecretDoor; }
-
-	/**
-	 * Returns true if the tile in a dungeon is a type that has walls on it: walls, doors, or secret doors
-	 */
-	bool isWallOrDoorway() const { return _isWall || _isDoor || _isSecretDoor; }
-
-	/**
-	 * Returns true if a tile is a solid type within a dungeon
-	 */
-	bool isSolid() const { return !(_isHallway || _isLadderUp || _isLadderDown || _isBeams); }
-};
-
-/**
- * Base class for managing maps within the game
- */
-class Map {
-	/**
-	 * Stores state about the current viewport being displayed. It's kept as part of the Map class
-	 * as a convenience to be alongside the current party position
-	 */
-	struct ViewportPosition {
-		Point _topLeft;					// Top, left tile position for viewport
-		Point _size;					// Size of the viewport. Just in case we ever allow it to change
-		MapId _mapId;					// Maze the viewport is for. Used to detect when the map changes
-
-		/**
-		 * Constructor
-		 */
-		ViewportPosition() : _topLeft(-1, -1), _mapId(-1) {}
-
-		/**
-		 * Returns true if the viewport is in a valid state
-		 */
-		bool isValid() const { return _mapId != -1; }
-
-		/**
-		 * Handles loading and saving viewport
-		 */
-		void synchronize(Common::Serializer &s) {
-			s.syncAsUint16LE(_topLeft.x);
-			s.syncAsUint16LE(_topLeft.y);
-		}
-
-		/**
-		 * Resets the viewport position, so it'll get recalculated the next call to getViewportPosition
-		 */
-		void reset() { _mapId = -1; }
-	};
-
-	/**
-	 * Internal class used for storing the data for a row
-	 */
-	struct MapCellsRow {
-	public:
-		Common::Array<MapCell> _data;
-	public:
-		byte &operator[](int idx) { return _data[idx]; }
-		byte operator[](int idx) const { return _data[idx]; }
-	};
-public:
-	/**
-	 * Base class for specific map types
-	 */
-	class MapBase {
-	private:
-		Map *_map;							// Map manager reference
-	protected:
-		MapId _mapId;						// The map Id
-		uint _mapIndex;						// Index of map within the group of same maps
-		uint _mapStyle;						// Map style category for towns & castles
-		ViewportPosition _viewportPos;		// Viewport position
-	protected:
-		/**
-		 * Set the size of the map
-		 */
-		void setDimensions(const Point &size);
-	public:
-		Point _size;						// X, Y size of the map
-		Point _tilesPerOrigTile;			// For enhanced modes, number of tiles per original game tile
-		Common::String _name;				// Name of map, if applicable
-		MapWidget *_playerWidget;		// Current means of transport, even if on foot
-		Common::Array<MapWidgetPtr> _widgets;	// Party, monsteres, transports, etc.
-		Common::Array<MapCellsRow> _data;	// Data for the map
-	public:
-		/**
-		 * Constructor
-		 */
-		MapBase(Game *game, Map *map) : _map(map), _playerWidget(nullptr), _mapId(0), _mapIndex(0),
-			_mapStyle(0) {}
-
-		/**
-		 * Destructor
-		 */
-		virtual ~MapBase() {}
-
-		/**
-		 * Handles loading and saving the map's data
-		 */
-		virtual void synchronize(Common::Serializer &s);
-
-		/**
-		 * Adds a widget to the map
-		 */
-		void addWidget(MapWidget *widget);
-
-		/**
-		 * Removes a widget from the map
-		 */
-		void removeWidget(MapWidget *widget);
-
-		/**
-		 * Clears all map data
-		 */
-		virtual void clear();
-
-		/**
-		 * Gets a tile at a given position
-		 */
-		virtual void getTileAt(const Point &pt, MapTile *tile);
-
-		/**
-		 * Resets the viewport when the viewport changes
-		 */
-		void resetViewport();
-
-		/**
-		 * Get the viewport position
-		 */
-		virtual Point getViewportPosition(const Point &viewportSize);
-
-		/**
-		 * Load the map
-		 */
-		virtual void load(MapId mapId);
-
-		/**
-		 * Changes the level. Only applicable to dungeon maps which have levels
-		 * @param delta		Delta to change dungeon level by
-		 * @returns			False if dungeon left, true if still within dungeon
-		 */
-		virtual bool changeLevel(int delta) { return true; }
-
-		/**
-		 * Get the current map level
-		 */
-		virtual uint getLevel() const { return 0; }
-
-		/**
-		 * Returns whether the map wraps around to the other side at it's edges (i.e. the overworld)
-		 */
-		virtual bool isMapWrapped() const { return false; }
-
-		/**
-		 * Returns the width of the map
-		 */
-		size_t width() const { return _size.x; }
-
-		/**
-		 * Returns the height of the map
-		 */
-		size_t height() const { return _size.y; }
-
-		/**
-		 * Get the current position
-		 */
-		Point getPosition() const;
-
-		/**
-		 * Set the current position
-		 */
-		void setPosition(const Point &pt);
-
-		/**
-		 * Get the current direction
-		 */
-		Direction getDirection() const;
-
-		/**
-		 * Set the current direction
-		 */
-		void setDirection(Direction dir);
-
-		/**
-		 * Returns a delta for the cell in front of the player based on the direction they're facing
-		 */
-		Point getDirectionDelta() const;
-
-		/**
-		 * Gets a point relative to the current position
-		 */
-		virtual Point getDeltaPosition(const Point &delta);
-
-		/**
-		 * Returns the map Id
-		 */
-		MapId getMapId() const { return _mapId; }
-
-		/**
-		 * Gets the map Index
-		 */
-		uint getMapIndex() const { return _mapIndex; }
-
-		/**
-		 * Shifts the viewport by a given delta
-		 */
-		virtual void shiftViewport(const Point &delta);
-
-		/**
-		 * Updates the map at the end of a turn
-		 */
-		virtual void update();
-	};
-protected:
-	MapBase *_mapArea;
-public:
-	/**
-	 * Constructor
-	 */
-	Map() : _mapArea(nullptr) {}
-
-	/**
-	 * Destructor
-	 */
-	virtual ~Map() {}
-
-	/**
-	 * Load a given map
-	 */
-	virtual void load(MapId mapId);
-
-	/**
-	 * Clears all map data
-	 */
-	virtual void clear();
-
-	/**
-	 * Handles loading and saving the map's data
-	 */
-	virtual void synchronize(Common::Serializer &s);
-
-	/**
-	 * Instantiates a widget type by name
-	 */
-	virtual MapWidget *createWidget(Map::MapBase *map, const Common::String &name) = 0;
-
-	/**
-	 * Gets a tile at a given position
-	 */
-	void getTileAt(const Point &pt, MapTile *tile) {
-		assert(_mapArea);
-		return _mapArea->getTileAt(pt, tile);
-	}
-
-	/**
-	 * Get the viewport position
-	 */
-	Point getViewportPosition(const Point &viewportSize) {
-		assert(_mapArea);
-		return _mapArea->getViewportPosition(viewportSize);
-	}
-
-	/**
-	 * Return the width of the map
-	 */
-	size_t width() const {
-		assert(_mapArea);
-		return _mapArea->width();
-	}
-
-	/**
-	 * Return the height of the map
-	 */
-	size_t height() const {
-		assert(_mapArea);
-		return _mapArea->height();
-	}
-
-	/**
-	 * Return the current position
-	 */
-	Point getPosition() const {
-		assert(_mapArea);
-		return _mapArea->getPosition();
-	}
-
-	/**
-	 * Set the position
-	 */
-	void setPosition(const Point &pt) {
-		assert(_mapArea);
-		_mapArea->setPosition(pt);
-	}
-
-	/**
-	 * Get the current direction
-	 */
-	Direction getDirection() const {
-		assert(_mapArea);
-		return _mapArea->getDirection();
-	}
-
-	/**
-	 * Set the current direction
-	 */
-	void setDirection(Direction dir) {
-		assert(_mapArea);
-		_mapArea->setDirection(dir);
-	}
-
-	/**
-	 * Returns a delta for the cell in front of the player based on the direction they're facing
-	 */
-	Point getDirectionDelta() const {
-		assert(_mapArea);
-		return _mapArea->getDirectionDelta();
-	}
-
-	/**
-	 * Gets a point relative to the current position
-	 */
-	Point getDeltaPosition(const Point &delta) {
-		assert(_mapArea);
-		return _mapArea->getDeltaPosition(delta);
-	}
-
-	/**
-	 * Shifts the viewport by a given delta
-	 */
-	void shiftViewport(const Point &delta) {
-		assert(_mapArea);
-		_mapArea->shiftViewport(delta);
-	}
-
-	/**
-	 * Returns the number of tiles in the map there are for each tile in the original game.
-	 * This allows for more detailed maps in the enhanced game modes
-	 */
-	Point getTilesPerOrigTile() const {
-		assert(_mapArea);
-		return _mapArea->_tilesPerOrigTile;
-	}
-
-	/**
-	 * Return the name of the map
-	 */
-	Common::String getName() const {
-		assert(_mapArea);
-		return _mapArea->_name;
-	}
-
-	/**
-	 * Returns the currently active widget that the player is controlling
-	 */
-	MapWidget *getPlayerWidget() const {
-		assert(_mapArea);
-		return _mapArea->_playerWidget;
-	}
-
-	/**
-	 * @param delta		Delta to change dungeon level by
-	 * @returns			False if dungeon left, true if still within dungeon
-	 */
-	bool changeLevel(int delta) {
-		assert(_mapArea);
-		return _mapArea->changeLevel(delta);
-	}
-
-	/**
-	 * Get the current map level
-	 */
-	uint getLevel() const {
-		assert(_mapArea);
-		return _mapArea->getLevel();
-	}
-
-	/**
-	 * Returns whether the map wraps around to the other side at it's edges (i.e. the overworld)
-	 */
-	bool isMapWrapped() const {
-		assert(_mapArea);
-		return _mapArea->isMapWrapped();
-	}
-
-	/**
-	 * Updates the map at the end of a turn
-	 */
-	void update() {
-		assert(_mapArea);
-		return _mapArea->update();
-	}
-};
-
-/**
- * Base class for things that appear within a map, such as monsters, transports, or people
- */
-class MapWidget {
-protected:
-	Game *_game;						// Game reference
-	Map::MapBase *_map;					// Map reference
-public:
-	Point _position;					// Position within the map
-	Direction _direction;				// Direction
-	Common::String _name;				// Name of widget
-public:
-	/**
-	 * Constructor
-	 */
-	MapWidget(Game *game, Map::MapBase *map) : _game(game), _map(map) {}
-	MapWidget(Game *game, Map::MapBase *map, const Point &pt, Direction dir = DIR_NONE) : _game(game), _map(map), _position(pt), _direction(dir) {}
-	MapWidget(Game *game, Map::MapBase *map, const Common::String &name, const Point &pt, Direction dir = DIR_NONE) :
-		_game(game), _map(map), _name(name), _position(pt), _direction(dir) {}
-
-	/**
-	 * Destructor
-	 */
-	virtual ~MapWidget() {}
-
-	/**
-	 * Return a name for a widget class if it can be synchronized to savegames
-	 */
-	virtual const char *getClassName() const { return nullptr; }
-
-	/**
-	 * Handles loading and saving games
-	 */
-	virtual void synchronize(Common::Serializer &s);
-
-	/**
-	 * Adds a text string to the info area
-	 * @param text		Text to add
-	 * @param newLine	Whether to apply a newline at the end
-	 */
-	void addInfoMsg(const Common::String &text, bool newLine = true);
-
-	/**
-	 * Get the tile for the widget
-	 */
-	virtual uint getTileNum() const { return 0; }
-
-	/**
-	 * Returns true if the player can move onto a tile the widget occupies
-	 */
-	virtual bool isBlocking() const { return false; }
-
-	/**
-	 * Called to update the widget at the end of a turn
-	 * @param isPreUpdate		Update is called twice in succession during the end of turn update.
-	 *		Once with true for all widgets, then with it false
-	 */
-	virtual void update(bool isPreUpdate) {}
-
-	enum CanMove { UNSET = 0, YES = 1, NO = 2 };
-
-	/**
-	 * Returns true if the given widget can move to a given position on the map
-	 */
-	virtual CanMove canMoveTo(const Point &destPos);
-
-	/**
-	 * Moves the widget to a given position
-	 * @param destPos		Specified new position
-	 * @param dir			Optional explicit direction to set. If not specified,
-	 *		the direction will be set relative to the position moved from
-	 */
-	virtual void moveTo(const Point &destPos, Direction dir = DIR_NONE);
-};
-
-} // End of namespace Shared
-} // End of namespace Ultima
-
-#endif
diff --git a/engines/ultima/u1shared/core/message_target.h b/engines/ultima/u1shared/core/message_target.h
deleted file mode 100644
index c6e35b7ec09..00000000000
--- a/engines/ultima/u1shared/core/message_target.h
+++ /dev/null
@@ -1,106 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-#ifndef ULTIMA_SHARED_CORE_MESSAGE_TARGET_H
-#define ULTIMA_SHARED_CORE_MESSAGE_TARGET_H
-
-#include "ultima/u1shared/core/base_object.h"
-
-namespace Ultima {
-namespace Shared {
-
-class MessageTarget;
-class CMessage;
-
-typedef bool (MessageTarget:: *PMSG)(CMessage *msg);
-
-struct MSGMAP_ENTRY {
-	PMSG _fn;
-	ClassDefFn _classDef;
-};
-
-struct MSGMAP {
-	const MSGMAP *(*pFnGetBaseMap)();
-	const MSGMAP_ENTRY *lpEntries;
-};
-
-#define DECLARE_MESSAGE_MAP \
-protected: \
-	static const Ultima::Shared::MSGMAP *getThisMessageMap(); \
-	const Ultima::Shared::MSGMAP *getMessageMap() const override
-
-#define DECLARE_MESSAGE_MAP_BASE \
-protected: \
-	static const Ultima::Shared::MSGMAP *getThisMessageMap(); \
-	virtual const Ultima::Shared::MSGMAP *getMessageMap() const
-
-#define BEGIN_MESSAGE_MAP(theClass, baseClass) \
-	Ultima::Shared::ClassDef theClass::type() { return Ultima::Shared::ClassDef(#theClass, &baseClass::type); } \
-	const Ultima::Shared::MSGMAP *theClass::getMessageMap() const \
-		{ return getThisMessageMap(); } \
-	const Ultima::Shared::MSGMAP *theClass::getThisMessageMap() \
-	{ \
-		typedef theClass ThisClass;						   \
-		typedef baseClass TheBaseClass;					   \
-		typedef bool (theClass::*FNPTR)(Ultima::Shared::CMessage *msg);    \
-		static const Ultima::Shared::MSGMAP_ENTRY _messageEntries[] = {
-
-#define ON_MESSAGE(msgClass) \
-	{ static_cast<Ultima::Shared::PMSG>((FNPTR)&ThisClass::msgClass), &C##msgClass::type },
-
-#define END_MESSAGE_MAP() \
-		{ (Ultima::Shared::PMSG)nullptr, nullptr } \
-	}; \
-		static const Ultima::Shared::MSGMAP messageMap = \
-		{ &TheBaseClass::getThisMessageMap, &_messageEntries[0] }; \
-		return &messageMap; \
-	}
-
-#define EMPTY_MESSAGE_MAP(theClass, baseClass) \
-	Ultima::Shared::ClassDef theClass::type() { return Ultima::Shared::ClassDef(#theClass, &baseClass::type); } \
-	const Ultima::Shared::MSGMAP *theClass::getMessageMap() const \
-		{ return getThisMessageMap(); } \
-	const Ultima::Shared::MSGMAP *theClass::getThisMessageMap() \
-	{ \
-		typedef baseClass TheBaseClass;					   \
-		static const Ultima::Shared::MSGMAP_ENTRY _messageEntries[] = { \
-		{ (Ultima::Shared::PMSG)nullptr, nullptr } \
-	}; \
-		static const Ultima::Shared::MSGMAP messageMap = \
-		{ &TheBaseClass::getThisMessageMap, &_messageEntries[0] }; \
-		return &messageMap; \
-	} \
-	enum { DUMMY##theClass }
-
-/**
- * The immediate descendant of the base object, this implements the base class for objects
- * that can receive messages
- */
-class MessageTarget: public BaseObject {
-	DECLARE_MESSAGE_MAP_BASE;
-public:
-	CLASSDEF;
-};
-
-} // End of namespace Shared
-} // End of namespace Ultima
-
-#endif
diff --git a/engines/ultima/u1shared/core/mouse_cursor.cpp b/engines/ultima/u1shared/core/mouse_cursor.cpp
deleted file mode 100644
index 168d2f6e9a9..00000000000
--- a/engines/ultima/u1shared/core/mouse_cursor.cpp
+++ /dev/null
@@ -1,107 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-#include "graphics/cursorman.h"
-#include "graphics/managed_surface.h"
-#include "ultima/u1shared/core/mouse_cursor.h"
-#include "ultima/u1shared/core/file.h"
-#include "ultima/u1shared/early/ultima_early.h"
-
-namespace Ultima {
-namespace Shared {
-
-void MouseCursor::MouseCursorData::load(Common::SeekableReadStream &s) {
-	_hotspot.x = s.readSint16LE();
-	_hotspot.y = s.readSint16LE();
-	for (int idx = 0; idx < 16; ++idx)
-		_pixels[idx] = s.readUint16LE();
-	for (int idx = 0; idx < 16; ++idx)
-		_mask[idx] = s.readUint16LE();
-}
-
-/*-------------------------------------------------------------------*/
-
-MouseCursor::MouseCursor() : _cursorId(-1) {
-/*
-	loadCursors();
-	_cursorId = -1;
-	setCursor(0);
-*/
-}
-
-void MouseCursor::loadCursors() {
-	_cursors.clear();
-
-	File f("TODO");
-	while (f.pos() < f.size()) {
-		_cursors.push_back(MouseCursorData());
-		MouseCursorData &mc = _cursors.back();
-
-		mc._hotspot.x = f.readSint16LE();
-		mc._hotspot.y = f.readSint16LE();
-		for (int idx = 0; idx < 16; ++idx)
-			mc._mask[idx] = f.readUint16LE();
-		for (int idx = 0; idx < 16; ++idx)
-			mc._pixels[idx] = f.readUint16LE();
-	}
-}
-
-void MouseCursor::setCursor(int cursorId) {
-	// No need to do anything if we're already showing the desired cursor
-	if (cursorId == _cursorId)
-		return;
-	_cursorId = cursorId;
-
-	// Set up a temporary surface for rendering the cursor onto
-	Graphics::ManagedSurface s(16, 16);
-	s.fillRect(s.getBounds(), 0xff);
-
-	const MouseCursorData &data = _cursors[cursorId];
-	const uint16 *pixelsP = data._pixels, *maskP = data._mask;
-
-	// Iterate trhough the lines to build up the cursor
-	for (int y = 0; y < CURSOR_HEIGHT; ++y) {
-		uint16 pixVal = *pixelsP++, maskVal = *maskP++;
-		int bitMask = 0x8000;
-		byte *destP = (byte *)s.getBasePtr(0, y);
-
-		for (int x = 0; x < CURSOR_WIDTH; ++x, ++destP, bitMask >>= 1) {
-			if (pixVal & bitMask)
-				*destP = 15;
-			else if (!(maskVal & bitMask))
-				*destP = 0;
-		}
-	}
-
-	// Pass the generated surface onto the ScummVM cursor manager
-	CursorMan.replaceCursor(s, data._hotspot.x, data._hotspot.y, 0xff);
-}
-
-void MouseCursor::show() {
-	CursorMan.showMouse(true);
-}
-
-void MouseCursor::hide() {
-	CursorMan.showMouse(false);
-}
-
-} // End of namespace Shared
-} // End of namespace Ultima
diff --git a/engines/ultima/u1shared/core/mouse_cursor.h b/engines/ultima/u1shared/core/mouse_cursor.h
deleted file mode 100644
index 746e47556c3..00000000000
--- a/engines/ultima/u1shared/core/mouse_cursor.h
+++ /dev/null
@@ -1,103 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-#ifndef ULTIMA_SHARED_CORE_MOUSE_CURSOR_H
-#define ULTIMA_SHARED_CORE_MOUSE_CURSOR_H
-
-#include "common/scummsys.h"
-#include "ultima/u1shared/core/rect.h"
-#include "common/stream.h"
-
-namespace Ultima {
-namespace Shared {
-
-#define CURSOR_WIDTH 16
-#define CURSOR_HEIGHT 16
-/*
-namespace Early {
-
-enum CursorId {
-	CURSOR_ARROW = 0
-};
-
-} // End of namespace Early
-
-namespace Later {
-namespace Xanth {
-
-enum CursorId {
-	CURSOR_BIG_ARROW = 0,
-	CURSOR_SMALL_ARROW = 1,
-	CURSOR_TICK = 2,
-	CURSOR_HOURGLASS = 3
-};
-
-} // End of namespace Xanth
-} // End of namespace Later
-*/
-
-/**
- * Handles the dislay and management of the on-screen mouse cursor
- */
-class MouseCursor {
-	struct MouseCursorData {
-		Point _hotspot;
-		uint16 _pixels[16];
-		uint16 _mask[16];
-
-		void load(Common::SeekableReadStream &s);
-	};
-private:
-	Common::Array<MouseCursorData> _cursors;
-	int _cursorId;
-private:
-	/**
-	 * Loads the mouse cursors
-	 */
-	void loadCursors();
-public:
-	MouseCursor();
-
-	/**
-	 * Sets the active cursor
-	 */
-	void setCursor(int cursorId);
-
-	/**
-	 * Returns the curent cursor
-	 */
-	int getCursor() const { return _cursorId; }
-
-	/**
-	 * Make the mouse cursor visible
-	 */
-	void show();
-
-	/**
-	 * Hide the mouse cursor
-	 */
-	void hide();
-};
-
-} // End of namespace Shared
-} // End of namespace Ultima
-
-#endif
diff --git a/engines/ultima/u1shared/core/named_item.h b/engines/ultima/u1shared/core/named_item.h
deleted file mode 100644
index 99fe090993d..00000000000
--- a/engines/ultima/u1shared/core/named_item.h
+++ /dev/null
@@ -1,51 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-#ifndef ULTIMA_SHARED_CORE_NAMED_ITEM_H
-#define ULTIMA_SHARED_CORE_NAMED_ITEM_H
-
-#include "ultima/u1shared/core/tree_item.h"
-
-namespace Ultima {
-namespace Shared {
-
-/**
- * Derived tree item class that adds a name that can be used to direct messages to later
- */
-class NamedItem: public TreeItem {
-	DECLARE_MESSAGE_MAP;
-public:
-	Common::String _name;
-public:
-	CLASSDEF;
-	NamedItem() {}
-	NamedItem(const Common::String &name) : _name(name) {}
-
-	/**
-	 * Gets the name of the item, if any
-	 */
-	const Common::String getName() const override { return _name; }
-};
-
-} // End of namespace Shared
-} // End of namespace Ultima
-
-#endif
diff --git a/engines/ultima/u1shared/core/party.cpp b/engines/ultima/u1shared/core/party.cpp
deleted file mode 100644
index 91f043cb080..00000000000
--- a/engines/ultima/u1shared/core/party.cpp
+++ /dev/null
@@ -1,67 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-#include "ultima/u1shared/core/party.h"
-
-namespace Ultima {
-namespace Shared {
-
-Party::~Party() {
-	for (uint idx = 0; idx < _characters.size(); ++idx)
-		delete _characters[idx];
-}
-
-void Party::add(Character *c) {
-	_characters.push_back(c);
-}
-
-void Party::synchronize(Common::Serializer &s) {
-	uint partyCount = _characters.size();
-	s.syncAsByte(partyCount);
-	if (s.isLoading())
-		assert(partyCount == _characters.size());
-
-	// Iterate through the characters of the party
-	for (uint idx = 0; idx < _characters.size(); ++idx)
-		_characters[idx]->synchronize(s);
-}
-
-
-bool Party::isDead() const {
-	for (uint idx = 0; idx < _characters.size(); ++idx) {
-		if ((*this)[idx]._hitPoints > 0)
-			return false;
-	}
-
-	return true;
-}
-
-bool Party::isFoodless() const {
-	for (uint idx = 0; idx < _characters.size(); ++idx) {
-		if ((*this)[idx]._food > 0)
-			return false;
-	}
-
-	return true;
-}
-
-} // End of namespace Shared
-} // End of namespace Ultima
diff --git a/engines/ultima/u1shared/core/party.h b/engines/ultima/u1shared/core/party.h
deleted file mode 100644
index a0c06ff39b2..00000000000
--- a/engines/ultima/u1shared/core/party.h
+++ /dev/null
@@ -1,76 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-#ifndef ULTIMA_SHARED_CORE_PARTY_H
-#define ULTIMA_SHARED_CORE_PARTY_H
-
-#include "common/array.h"
-#include "common/str.h"
-#include "common/serializer.h"
-#include "ultima/u1shared/core/character.h"
-
-namespace Ultima {
-namespace Shared {
-
-/**
- * Base class for the player's party
- */
-class Party {
-protected:
-	Common::Array<Character *> _characters;
-public:
-	~Party();
-
-	/**
-	 * Add a character to the party
-	 */
-	void add(Character *c);
-
-	/**
-	 * Casting operator for convenient access to the first character
-	 */
-	operator Character &() const { return *_characters.front(); }
-
-	/**
-	 * Casting operator for convenient access to the first character
-	 */
-	operator Character *() const { return _characters.front(); }
-
-	/**
-	 * Synchronize data
-	 */
-	void synchronize(Common::Serializer &s);
-
-	/**
-	 * Returns true if the party is dead
-	 */
-	bool isDead() const;
-
-	/**
-	 * Returns true if the party has no food
-	 */
-	bool isFoodless() const;
-};
-
-} // End of namespace Shared
-} // End of namespace Ultima
-
-#endif
diff --git a/engines/ultima/u1shared/core/rect.h b/engines/ultima/u1shared/core/rect.h
deleted file mode 100644
index 9dcca3bcbdb..00000000000
--- a/engines/ultima/u1shared/core/rect.h
+++ /dev/null
@@ -1,63 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-#ifndef ULTIMA_SHARED_CORE_RECT_H
-#define ULTIMA_SHARED_CORE_RECT_H
-
-#include "common/rect.h"
-
-namespace Ultima {
-namespace Shared {
-
-class TextPoint;
-
-typedef Common::Rect Rect;
-
-typedef Common::Point Point;
-
-/**
- * Simple derived point class that converts text coordinates to graphic screen coordinates
- */
-class TextPoint : public Common::Point {
-public:
-	TextPoint() : Common::Point() {}
-	TextPoint(int16 x1, int16 y1) : Common::Point(x1 * 8, y1 * 8) {}
-};
-
-/**
- * Simple derived rect class that converts text coordinates to graphic screen coordinates
- */
-class TextRect : public Common::Rect {
-public:
-	TextRect() : Common::Rect() {}
-	TextRect(int16 x1, int16 y1, int16 x2, int16 y2) : Common::Rect(x1 * 8, y1 * 8, (x2 + 1) * 8, (y2 + 1) * 8) {}
-};
-
-} // End of namespace Shared
-
-using Shared::Rect;
-using Shared::Point;
-using Shared::TextPoint;
-using Shared::TextRect;
-
-} // End of namespace Ultima
-
-#endif
diff --git a/engines/ultima/u1shared/core/str.cpp b/engines/ultima/u1shared/core/str.cpp
deleted file mode 100644
index 3ea930ea5a0..00000000000
--- a/engines/ultima/u1shared/core/str.cpp
+++ /dev/null
@@ -1,66 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-#include "ultima/u1shared/core/str.h"
-
-namespace Ultima {
-namespace Shared {
-
-int String::indexOf(char c) const {
-	const char *s = strchr(c_str(), c);
-	return s ? s - c_str() : -1;
-}
-
-int String::indexOf(const String &chars) const {
-	uint minIndex = size();
-
-	for (uint idx = 0; idx < chars.size(); ++idx) {
-		int charIndex = indexOf(chars[idx]);
-		if (charIndex != -1 && charIndex < (int)minIndex)
-			minIndex = charIndex;
-	}
-
-	return minIndex == size() ? -1 : minIndex;
-}
-
-StringArray String::split(char c) const {
-	return split(String(c));
-}
-
-StringArray String::split(const String &chars) const {
-	StringArray results;
-	String temp = *this;
-	int idx;
-
-	// Iterate through the text
-	while ((idx = temp.indexOf(chars)) != -1) {
-		results.push_back(String(temp.c_str(), temp.c_str() + idx));
-		temp = String(temp.c_str() + idx + 1);
-	}
-
-	if (!empty() && !temp.empty())
-		results.push_back(temp);
-
-	return results;
-}
-
-} // End of namespace Shared
-} // End of namespace Ultima
diff --git a/engines/ultima/u1shared/core/str.h b/engines/ultima/u1shared/core/str.h
deleted file mode 100644
index 70720757e4d..00000000000
--- a/engines/ultima/u1shared/core/str.h
+++ /dev/null
@@ -1,76 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-#ifndef ULTIMA_STR_H
-#define ULTIMA_STR_H
-
-#include "common/str.h"
-#include "common/array.h"
-
-namespace Ultima {
-namespace Shared {
-
-class String;
-
-typedef Common::Array<String> StringArray;
-
-/**
- * Derived string class
- */
-class String : public Common::String {
-public:
-	String() : Common::String() {}
-	String(const char *str) : Common::String(str) {}
-	String(const char *str, uint32 len) : Common::String(str, len) {}
-	String(const char *beginP, const char *endP) : Common::String(beginP, endP) {}
-	String(const String &str) : Common::String(str) {}
-	String(const Common::String &str) : Common::String(str) {}
-	explicit String(char c) : Common::String(c) {}
-	String& operator=(const String &str) { this->Common::String::operator=(str); return *this; }
-
-	/**
-	 * Returns the index of a given character, or -1 if not present
-	 */
-	int indexOf(char c) const;
-
-	/**
-	 * Returns the earliest index of any character in a passed set of characters, or -1 if not present
-	 */
-	int indexOf(const String &chars) const;
-
-	/**
-	 * Splits up a text string by a given character
-	 */
-	StringArray split(char c) const;
-
-	/**
-	 * Splits up a text string by any of the characters in the passed string
-	 */
-	StringArray split(const String &chars) const;
-};
-
-} // End of namespace Shared
-
-using Shared::String;
-
-} // End of namespace Ultima
-
-#endif
diff --git a/engines/ultima/u1shared/core/tree_item.cpp b/engines/ultima/u1shared/core/tree_item.cpp
deleted file mode 100644
index 25e5e1a70ad..00000000000
--- a/engines/ultima/u1shared/core/tree_item.cpp
+++ /dev/null
@@ -1,221 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-#include "ultima/u1shared/core/tree_item.h"
-#include "ultima/u1shared/core/named_item.h"
-#include "ultima/u1shared/early/game.h"
-#include "ultima/u1shared/early/game_base.h"
-
-namespace Ultima {
-namespace Shared {
-
-EMPTY_MESSAGE_MAP(TreeItem, MessageTarget);
-
-TreeItem::TreeItem() : _parent(nullptr), _firstChild(nullptr),
-_nextSibling(nullptr), _priorSibling(nullptr),
-_disposeAfterUse(DisposeAfterUse::NO) {
-}
-
-Game *TreeItem::getGame() {
-	TreeItem *treeItem = this;
-
-	while (treeItem->getParent()) {
-		treeItem = treeItem->getParent();
-	}
-
-	return dynamic_cast<Game *>(treeItem);
-}
-
-const Game *TreeItem::getGame() const {
-	const TreeItem *treeItem = this;
-
-	while (treeItem->getParent()) {
-		treeItem = treeItem->getParent();
-	}
-
-	return dynamic_cast<const Game *>(treeItem);
-}
-
-TreeItem *TreeItem::getLastSibling() {
-	TreeItem *item = this;
-	while (item->getNextSibling())
-		item = item->getNextSibling();
-
-	return item;
-}
-
-Gfx::VisualItem *TreeItem::getView() {
-	return getGame()->getView();
-}
-
-TreeItem *TreeItem::getLastChild() const {
-	if (!_firstChild)
-		return nullptr;
-	return _firstChild->getLastSibling();
-}
-
-TreeItem *TreeItem::scan(TreeItem *item) const {
-	if (_firstChild)
-		return _firstChild;
-
-	const TreeItem *treeItem = this;
-	while (treeItem != item) {
-		if (treeItem->_nextSibling)
-			return treeItem->_nextSibling;
-
-		treeItem = treeItem->_parent;
-		if (!treeItem)
-			break;
-	}
-
-	return nullptr;
-}
-
-TreeItem *TreeItem::findChildInstanceOf(const ClassDef &classDef) const {
-	for (TreeItem *treeItem = _firstChild; treeItem; treeItem = treeItem->getNextSibling()) {
-		if (treeItem->isInstanceOf(classDef))
-			return treeItem;
-	}
-
-	return nullptr;
-}
-
-TreeItem *TreeItem::findNextInstanceOf(const ClassDef &classDef, TreeItem *startItem) const {
-	TreeItem *treeItem = startItem ? startItem->getNextSibling() : getFirstChild();
-
-	for (; treeItem; treeItem = treeItem->getNextSibling()) {
-		if (treeItem->isInstanceOf(classDef))
-			return treeItem;
-	}
-
-	return nullptr;
-}
-
-void TreeItem::addUnder(TreeItem *newParent) {
-	if (newParent->_firstChild)
-		addSibling(newParent->_firstChild->getLastSibling());
-	else
-		setParent(newParent);
-}
-
-void TreeItem::addChild(TreeItem *child) {
-	child->addUnder(this);
-}
-
-void TreeItem::setParent(TreeItem *newParent) {
-	_parent = newParent;
-	_priorSibling = nullptr;
-	_nextSibling = newParent->_firstChild;
-
-	if (newParent->_firstChild)
-		newParent->_firstChild->_priorSibling = this;
-	newParent->_firstChild = this;
-}
-
-void TreeItem::addSibling(TreeItem *item) {
-	_priorSibling = item;
-	_nextSibling = item->_nextSibling;
-	_parent = item->_parent;
-
-	if (item->_nextSibling)
-		item->_nextSibling->_priorSibling = this;
-	item->_nextSibling = this;
-}
-
-void TreeItem::moveUnder(TreeItem *newParent) {
-	if (newParent) {
-		detach();
-		addUnder(newParent);
-	}
-}
-
-void TreeItem::destroyAll() {
-	destroyChildren();
-	detach();
-	if (_disposeAfterUse == DisposeAfterUse::YES)
-		delete this;
-}
-
-int TreeItem::destroyChildren() {
-	if (!_firstChild)
-		return 0;
-
-	TreeItem *item = _firstChild, *child, *nextSibling;
-	int total = 0;
-
-	do {
-		child = item->_firstChild;
-		nextSibling = item->_nextSibling;
-
-		if (child)
-			total += item->destroyChildren();
-		item->detach();
-		if (item->_disposeAfterUse == DisposeAfterUse::YES)
-			delete item;
-		++total;
-	} while ((item = nextSibling) != nullptr);
-
-	return total;
-}
-
-void TreeItem::detach() {
-	// Delink this item from any prior and/or next siblings
-	if (_priorSibling)
-		_priorSibling->_nextSibling = _nextSibling;
-	if (_nextSibling)
-		_nextSibling->_priorSibling = _priorSibling;
-
-	if (_parent && _parent->_firstChild == this)
-		_parent->_firstChild = _nextSibling;
-
-	_priorSibling = _nextSibling = _parent = nullptr;
-}
-
-void TreeItem::attach(TreeItem *item) {
-	_nextSibling = item;
-	_priorSibling = item->_priorSibling;
-	_parent = item->_parent;
-
-	if (item->_priorSibling)
-		item->_priorSibling->_nextSibling = this;
-
-	item->_priorSibling = this;
-	if (item->_parent && !item->_parent->_firstChild)
-		item->_parent->_firstChild = this;
-}
-
-NamedItem *TreeItem::findByName(const Common::String &name) {
-	Common::String nameLower = name;
-	nameLower.toLowercase();
-
-	for (TreeItem *treeItem = this; treeItem; treeItem = treeItem->scan(this)) {
-		Common::String itemName = treeItem->getName();
-		itemName.toLowercase();
-
-		if (!itemName.compareTo(nameLower))
-			return dynamic_cast<NamedItem *>(treeItem);
-	}
-
-	return nullptr;
-}
-
-} // End of namespace Shared
-} // End of namespace Ultima
diff --git a/engines/ultima/u1shared/core/tree_item.h b/engines/ultima/u1shared/core/tree_item.h
deleted file mode 100644
index 0d80a36c6a2..00000000000
--- a/engines/ultima/u1shared/core/tree_item.h
+++ /dev/null
@@ -1,215 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-#ifndef ULTIMA_SHARED_CORE_TREE_ITEM_H
-#define ULTIMA_SHARED_CORE_TREE_ITEM_H
-
-#include "ultima/u1shared/core/message_target.h"
-
-namespace Ultima {
-namespace Shared {
-
-namespace Gfx {
-class VisualItem;
-} // End of namespace Gfx
-
-namespace Maps {
-class Map;
-} // End of namespace Maps
-
-class Game;
-class GameManager;
-class GameState;
-class Events;
-class Map;
-class NamedItem;
-class CMessage;
-
-/**
- * This implements the base for objects can form a class hierarchy, with parents, children, and siblings
- * that messages can be passed around.
- */
-class TreeItem: public MessageTarget {
-	friend class CMessage;
-	DECLARE_MESSAGE_MAP;
-private:
-	TreeItem *_parent;
-	TreeItem *_nextSibling;
-	TreeItem *_priorSibling;
-	TreeItem *_firstChild;
-	DisposeAfterUse::Flag _disposeAfterUse;
-public:
-	CLASSDEF;
-	TreeItem();
-
-	/**
-	 * Gets the name of the item, if any
-	 */
-	virtual const Common::String getName() const {
-		return Common::String();
-	}
-
-	/**
-	 * Returns true if the item's name matches a passed name
-	 */
-	virtual bool isEquals(const Common::String &name, int maxLen = 0) const {
-		return false;
-	}
-
-	/**
-	 * Compares the name of the item to a passed name
-	 */
-	virtual int compareTo(const Common::String &name, int maxLen = 0) const {
-		return false;
-	}
-
-	/**
-	 * Called when the view changes
-	 */
-	virtual void viewChange() {
-	}
-
-	/**
-	 * Get the parent for the given item
-	 */
-	TreeItem *getParent() const {
-		return _parent;
-	}
-
-	/**
-	 * Jumps up through the parents to find the root game
-	 */
-	Game *getGame();
-
-	/**
-	 * Jumps up through the parents to find the root game
-	 */
-	const Game *getGame() const;
-
-	/**
-	 * Returns the currently active game view
-	 */
-	Gfx::VisualItem *getView();
-
-	/**
-	 * Get the next sibling
-	 */
-	TreeItem *getNextSibling() const {
-		return _nextSibling;
-	}
-
-	/**
-	 * Get the prior sibling
-	 */
-	TreeItem *getPriorSibling() const {
-		return _priorSibling;
-	}
-
-	/**
-	 * Get the last sibling of this sibling
-	 */
-	TreeItem *getLastSibling();
-
-	/**
-	 * Get the first child of the item, if any
-	 */
-	TreeItem *getFirstChild() const {
-		return _firstChild;
-	}
-
-	/**
-	 * Get the last child of the item, if any
-	 */
-	TreeItem *getLastChild() const;
-
-	/**
-	 * Given all the recursive children of the tree item, gives the next
-	 * item in sequence to the passed starting item
-	 */
-	TreeItem *scan(TreeItem *item) const;
-
-	/**
-	 * Find the first child item that is of a given type
-	 */
-	TreeItem *findChildInstanceOf(const ClassDef &classDef) const;
-
-	/**
-	 * Find the next sibling item that is of the given type
-	 */
-	TreeItem *findNextInstanceOf(const ClassDef &classDef, TreeItem *startItem) const;
-
-	/**
-	 * Adds the item under another tree item
-	 */
-	void addUnder(TreeItem *newParent);
-
-	/**
-	 * Adds a new child under this one
-	 */
-	void addChild(TreeItem *child);
-
-	/**
-	 * Sets the parent for the item
-	 */
-	void setParent(TreeItem *newParent);
-
-	/**
-	 * Adds the item as a sibling of another item
-	 */
-	void addSibling(TreeItem *item);
-
-	/**
-	 * Moves the tree item to be under another parent
-	 */
-	void moveUnder(TreeItem *newParent);
-
-	/**
-	 * Destroys both the item as well as any of it's children
-	 */
-	void destroyAll();
-
-	/**
-	 * Destroys all child tree items under this one.
-	 * @returns		Total number of tree items recursively removed
-	 */
-	int destroyChildren();
-
-	/**
-	 * Detach the tree item from any other associated tree items
-	 */
-	void detach();
-
-	/**
-	 * Attaches a tree item to a new node
-	 */
-	void attach(TreeItem *item);
-
-	/**
-	 * Finds a tree item by name
-	 * @param name		Name to find
-	 */
-	NamedItem *findByName(const Common::String &name);
-};
-
-} // End of namespace Shared
-} // End of namespace Ultima
-
-#endif
diff --git a/engines/ultima/u1shared/core/utils.cpp b/engines/ultima/u1shared/core/utils.cpp
deleted file mode 100644
index c84e28afff7..00000000000
--- a/engines/ultima/u1shared/core/utils.cpp
+++ /dev/null
@@ -1,42 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-#include "ultima/u1shared/core/utils.h"
-#include "common/scummsys.h"
-
-namespace Ultima {
-namespace Shared {
-
-bool isVowel(char c) {
-	switch (toupper(c)) {
-	case 'A':
-	case 'E':
-	case 'I':
-	case 'O':
-	case 'U':
-		return true;
-	default:
-		return false;
-	}
-}
-
-} // End of namespace Shared
-} // End of namespace Ultima
diff --git a/engines/ultima/u1shared/core/widgets.cpp b/engines/ultima/u1shared/core/widgets.cpp
deleted file mode 100644
index 899f915ba90..00000000000
--- a/engines/ultima/u1shared/core/widgets.cpp
+++ /dev/null
@@ -1,44 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-#include "ultima/u1shared/core/widgets.h"
-#include "ultima/u1shared/early/game.h"
-
-namespace Ultima {
-namespace Shared {
-
-void Creature::synchronize(Common::Serializer &s) {
-	StandardWidget::synchronize(s);
-	s.syncAsSint16LE(_hitPoints);
-}
-
-void Creature::update(bool isPreUpdate) {
-	if (isPreUpdate) {
-		// Check whether creature can attack
-		movement();
-		_isAttacking = attackDistance() != 0;
-	} else if (_isAttacking && !_game->_party->isDead()) {
-		attack();
-	}
-}
-
-} // End of namespace Ultima1
-} // End of namespace Ultima
diff --git a/engines/ultima/u1shared/core/widgets.h b/engines/ultima/u1shared/core/widgets.h
deleted file mode 100644
index ac4d6dc190f..00000000000
--- a/engines/ultima/u1shared/core/widgets.h
+++ /dev/null
@@ -1,147 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-#ifndef ULTIMA_SHARED_CORE_WIDGETS_H
-#define ULTIMA_SHARED_CORE_WIDGETS_H
-
-#include "ultima/u1shared/core/map.h"
-#include "ultima/u1shared/gfx/dungeon_surface.h"
-
-namespace Ultima {
-namespace Shared {
-
-/**
- * Base class for widgets on maps other than the dungeons
- */
-class StandardWidget : public MapWidget {
-public:
-	/**
-	 * Constructor
-	 */
-	StandardWidget(Game *game, Map::MapBase *map) : MapWidget(game, map) {}
-	StandardWidget(Game *game, Map::MapBase *map, const Point &pt, Direction dir = DIR_NONE) : MapWidget(game, map, pt, dir) {}
-
-	/**
-	 * Destructor
-	 */
-	~StandardWidget() override {}
-};
-
-class Creature : public StandardWidget {
-protected:
-	int _hitPoints;
-	bool _isAttacking;
-protected:
-	/**
-	 * Returns either the maximum attack distance for a monster, or 0 if the monster is beyond
-	 * that distance from the player
-	 */
-	virtual uint attackDistance() const { return 0; }
-
-	/**
-	 * Handles moving creatures
-	 */
-	virtual void movement() {}
-
-	/**
-	 * Handles attacks
-	 */
-	virtual void attack() {}
-public:
-	/**
-	 * Constructor
-	 */
-	Creature(Game *game, Map::MapBase *map) : StandardWidget(game, map), _hitPoints(0), _isAttacking(false) {}
-	Creature(Game *game, Map::MapBase *map, int hitPoints) : StandardWidget(game, map),
-		_hitPoints(hitPoints), _isAttacking(false) {}
-	Creature(Game *game, Map::MapBase *map, int hitPoints, const Point &pt, Direction dir = DIR_NONE) :
-		StandardWidget(game, map, pt, dir), _hitPoints(hitPoints), _isAttacking(false) {}
-
-	/**
-	 * Destructor
-	 */
-	~Creature() override {}
-
-	/**
-	 * Handles loading and saving games
-	 */
-	void synchronize(Common::Serializer &s) override;
-
-	/**
-	 * Called to update the widget at the end of a turn
-	 * @param isPreUpdate		Update is called twice in succession during the end of turn update.
-	 *		Once with true for all widgets, then with it false
-	 */
-	void update(bool isPreUpdate) override;
-
-	/**
-	 * True true if the creature is dead
-	 */
-	bool isDead() const { return _hitPoints <= 0; }
-};
-
-
-/**
- * Base class for things that appear within the dungeons
- */
-class DungeonWidget : public MapWidget {
-public:
-	/**
-	 * Constructor
-	 */
-	DungeonWidget(Game *game, Map::MapBase *map) : MapWidget(game, map) {}
-	DungeonWidget(Game *game, Map::MapBase *map, const Point &pt, Direction dir = DIR_NONE) : MapWidget(game, map, pt, dir) {}
-	DungeonWidget(Game *game, Map::MapBase *map, const Common::String &name, const Point &pt, Direction dir = DIR_NONE) :
-		MapWidget(game, map, name, pt, dir) {}
-
-	/**
-	 * Destructor
-	 */
-	~DungeonWidget() override {}
-
-	/**
-	 * Draws an item
-	 */
-	virtual void draw(DungeonSurface &s, uint distance) = 0;
-};
-
-/**
- * Stub class for dungeon creatures
- */
-class DungeonCreature {
-public:
-	virtual ~DungeonCreature() {}
-
-	/**
-	 * Returns true if a monster blocks the background behind him
-	 */
-	virtual bool isBlockingView() const = 0;
-
-	/**
-	 * Draw a monster
-	 */
-	virtual void draw(DungeonSurface &s, uint distance) = 0;
-};
-
-} // End of namespace Shared
-} // End of namespace Ultima
-
-#endif
diff --git a/engines/ultima/u1shared/early/font_resources.cpp b/engines/ultima/u1shared/early/font_resources.cpp
deleted file mode 100644
index a696d8b7821..00000000000
--- a/engines/ultima/u1shared/early/font_resources.cpp
+++ /dev/null
@@ -1,313 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-#include "ultima/u1shared/early/font_resources.h"
-#include "common/algorithm.h"
-
-namespace Ultima {
-namespace Shared {
-
-// 8x8 font copied from DosBox
-static const byte INT10_FONT_08[256][8] = {
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x7e, 0x81, 0xa5, 0x81, 0xbd, 0x99, 0x81, 0x7e },
-	{ 0x7e, 0xff, 0xdb, 0xff, 0xc3, 0xe7, 0xff, 0x7e },
-	{ 0x6c, 0xfe, 0xfe, 0xfe, 0x7c, 0x38, 0x10, 0x00 },
-	{ 0x10, 0x38, 0x7c, 0xfe, 0x7c, 0x38, 0x10, 0x00 },
-	{ 0x38, 0x7c, 0x38, 0xfe, 0xfe, 0x7c, 0x38, 0x7c },
-	{ 0x10, 0x10, 0x38, 0x7c, 0xfe, 0x7c, 0x38, 0x7c },
-	{ 0x00, 0x00, 0x18, 0x3c, 0x3c, 0x18, 0x00, 0x00 },
-	{ 0xff, 0xff, 0xe7, 0xc3, 0xc3, 0xe7, 0xff, 0xff },
-	{ 0x00, 0x3c, 0x66, 0x42, 0x42, 0x66, 0x3c, 0x00 },
-	{ 0xff, 0xc3, 0x99, 0xbd, 0xbd, 0x99, 0xc3, 0xff },
-	{ 0x0f, 0x07, 0x0f, 0x7d, 0xcc, 0xcc, 0xcc, 0x78 },
-	{ 0x3c, 0x66, 0x66, 0x66, 0x3c, 0x18, 0x7e, 0x18 },
-	{ 0x3f, 0x33, 0x3f, 0x30, 0x30, 0x70, 0xf0, 0xe0 },
-	{ 0x7f, 0x63, 0x7f, 0x63, 0x63, 0x67, 0xe6, 0xc0 },
-	{ 0x99, 0x5a, 0x3c, 0xe7, 0xe7, 0x3c, 0x5a, 0x99 },
-	{ 0x80, 0xe0, 0xf8, 0xfe, 0xf8, 0xe0, 0x80, 0x00 },
-	{ 0x02, 0x0e, 0x3e, 0xfe, 0x3e, 0x0e, 0x02, 0x00 },
-	{ 0x18, 0x3c, 0x7e, 0x18, 0x18, 0x7e, 0x3c, 0x18 },
-	{ 0x66, 0x66, 0x66, 0x66, 0x66, 0x00, 0x66, 0x00 },
-	{ 0x7f, 0xdb, 0xdb, 0x7b, 0x1b, 0x1b, 0x1b, 0x00 },
-	{ 0x3e, 0x63, 0x38, 0x6c, 0x6c, 0x38, 0xcc, 0x78 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x7e, 0x7e, 0x7e, 0x00 },
-	{ 0x18, 0x3c, 0x7e, 0x18, 0x7e, 0x3c, 0x18, 0xff },
-	{ 0x18, 0x3c, 0x7e, 0x18, 0x18, 0x18, 0x18, 0x00 },
-	{ 0x18, 0x18, 0x18, 0x18, 0x7e, 0x3c, 0x18, 0x00 },
-	{ 0x00, 0x18, 0x0c, 0xfe, 0x0c, 0x18, 0x00, 0x00 },
-	{ 0x00, 0x30, 0x60, 0xfe, 0x60, 0x30, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xc0, 0xc0, 0xc0, 0xfe, 0x00, 0x00 },
-	{ 0x00, 0x24, 0x66, 0xff, 0x66, 0x24, 0x00, 0x00 },
-	{ 0x00, 0x18, 0x3c, 0x7e, 0xff, 0xff, 0x00, 0x00 },
-	{ 0x00, 0xff, 0xff, 0x7e, 0x3c, 0x18, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x30, 0x78, 0x78, 0x30, 0x30, 0x00, 0x30, 0x00 },
-	{ 0x6c, 0x6c, 0x6c, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x6c, 0x6c, 0xfe, 0x6c, 0xfe, 0x6c, 0x6c, 0x00 },
-	{ 0x30, 0x7c, 0xc0, 0x78, 0x0c, 0xf8, 0x30, 0x00 },
-	{ 0x00, 0xc6, 0xcc, 0x18, 0x30, 0x66, 0xc6, 0x00 },
-	{ 0x38, 0x6c, 0x38, 0x76, 0xdc, 0xcc, 0x76, 0x00 },
-	{ 0x60, 0x60, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x18, 0x30, 0x60, 0x60, 0x60, 0x30, 0x18, 0x00 },
-	{ 0x60, 0x30, 0x18, 0x18, 0x18, 0x30, 0x60, 0x00 },
-	{ 0x00, 0x66, 0x3c, 0xff, 0x3c, 0x66, 0x00, 0x00 },
-	{ 0x00, 0x30, 0x30, 0xfc, 0x30, 0x30, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x30, 0x60 },
-	{ 0x00, 0x00, 0x00, 0xfc, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x30, 0x00 },
-	{ 0x06, 0x0c, 0x18, 0x30, 0x60, 0xc0, 0x80, 0x00 },
-	{ 0x7c, 0xc6, 0xce, 0xde, 0xf6, 0xe6, 0x7c, 0x00 },
-	{ 0x30, 0x70, 0x30, 0x30, 0x30, 0x30, 0xfc, 0x00 },
-	{ 0x78, 0xcc, 0x0c, 0x38, 0x60, 0xcc, 0xfc, 0x00 },
-	{ 0x78, 0xcc, 0x0c, 0x38, 0x0c, 0xcc, 0x78, 0x00 },
-	{ 0x1c, 0x3c, 0x6c, 0xcc, 0xfe, 0x0c, 0x1e, 0x00 },
-	{ 0xfc, 0xc0, 0xf8, 0x0c, 0x0c, 0xcc, 0x78, 0x00 },
-	{ 0x38, 0x60, 0xc0, 0xf8, 0xcc, 0xcc, 0x78, 0x00 },
-	{ 0xfc, 0xcc, 0x0c, 0x18, 0x30, 0x30, 0x30, 0x00 },
-	{ 0x78, 0xcc, 0xcc, 0x78, 0xcc, 0xcc, 0x78, 0x00 },
-	{ 0x78, 0xcc, 0xcc, 0x7c, 0x0c, 0x18, 0x70, 0x00 },
-	{ 0x00, 0x30, 0x30, 0x00, 0x00, 0x30, 0x30, 0x00 },
-	{ 0x00, 0x30, 0x30, 0x00, 0x00, 0x30, 0x30, 0x60 },
-	{ 0x18, 0x30, 0x60, 0xc0, 0x60, 0x30, 0x18, 0x00 },
-	{ 0x00, 0x00, 0xfc, 0x00, 0x00, 0xfc, 0x00, 0x00 },
-	{ 0x60, 0x30, 0x18, 0x0c, 0x18, 0x30, 0x60, 0x00 },
-	{ 0x78, 0xcc, 0x0c, 0x18, 0x30, 0x00, 0x30, 0x00 },
-	{ 0x7c, 0xc6, 0xde, 0xde, 0xde, 0xc0, 0x78, 0x00 },
-	{ 0x30, 0x78, 0xcc, 0xcc, 0xfc, 0xcc, 0xcc, 0x00 },
-	{ 0xfc, 0x66, 0x66, 0x7c, 0x66, 0x66, 0xfc, 0x00 },
-	{ 0x3c, 0x66, 0xc0, 0xc0, 0xc0, 0x66, 0x3c, 0x00 },
-	{ 0xf8, 0x6c, 0x66, 0x66, 0x66, 0x6c, 0xf8, 0x00 },
-	{ 0xfe, 0x62, 0x68, 0x78, 0x68, 0x62, 0xfe, 0x00 },
-	{ 0xfe, 0x62, 0x68, 0x78, 0x68, 0x60, 0xf0, 0x00 },
-	{ 0x3c, 0x66, 0xc0, 0xc0, 0xce, 0x66, 0x3e, 0x00 },
-	{ 0xcc, 0xcc, 0xcc, 0xfc, 0xcc, 0xcc, 0xcc, 0x00 },
-	{ 0x78, 0x30, 0x30, 0x30, 0x30, 0x30, 0x78, 0x00 },
-	{ 0x1e, 0x0c, 0x0c, 0x0c, 0xcc, 0xcc, 0x78, 0x00 },
-	{ 0xe6, 0x66, 0x6c, 0x78, 0x6c, 0x66, 0xe6, 0x00 },
-	{ 0xf0, 0x60, 0x60, 0x60, 0x62, 0x66, 0xfe, 0x00 },
-	{ 0xc6, 0xee, 0xfe, 0xfe, 0xd6, 0xc6, 0xc6, 0x00 },
-	{ 0xc6, 0xe6, 0xf6, 0xde, 0xce, 0xc6, 0xc6, 0x00 },
-	{ 0x38, 0x6c, 0xc6, 0xc6, 0xc6, 0x6c, 0x38, 0x00 },
-	{ 0xfc, 0x66, 0x66, 0x7c, 0x60, 0x60, 0xf0, 0x00 },
-	{ 0x78, 0xcc, 0xcc, 0xcc, 0xdc, 0x78, 0x1c, 0x00 },
-	{ 0xfc, 0x66, 0x66, 0x7c, 0x6c, 0x66, 0xe6, 0x00 },
-	{ 0x78, 0xcc, 0xe0, 0x70, 0x1c, 0xcc, 0x78, 0x00 },
-	{ 0xfc, 0xb4, 0x30, 0x30, 0x30, 0x30, 0x78, 0x00 },
-	{ 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xfc, 0x00 },
-	{ 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x78, 0x30, 0x00 },
-	{ 0xc6, 0xc6, 0xc6, 0xd6, 0xfe, 0xee, 0xc6, 0x00 },
-	{ 0xc6, 0xc6, 0x6c, 0x38, 0x38, 0x6c, 0xc6, 0x00 },
-	{ 0xcc, 0xcc, 0xcc, 0x78, 0x30, 0x30, 0x78, 0x00 },
-	{ 0xfe, 0xc6, 0x8c, 0x18, 0x32, 0x66, 0xfe, 0x00 },
-	{ 0x78, 0x60, 0x60, 0x60, 0x60, 0x60, 0x78, 0x00 },
-	{ 0xc0, 0x60, 0x30, 0x18, 0x0c, 0x06, 0x02, 0x00 },
-	{ 0x78, 0x18, 0x18, 0x18, 0x18, 0x18, 0x78, 0x00 },
-	{ 0x10, 0x38, 0x6c, 0xc6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff },
-	{ 0x30, 0x30, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x78, 0x0c, 0x7c, 0xcc, 0x76, 0x00 },
-	{ 0xe0, 0x60, 0x60, 0x7c, 0x66, 0x66, 0xdc, 0x00 },
-	{ 0x00, 0x00, 0x78, 0xcc, 0xc0, 0xcc, 0x78, 0x00 },
-	{ 0x1c, 0x0c, 0x0c, 0x7c, 0xcc, 0xcc, 0x76, 0x00 },
-	{ 0x00, 0x00, 0x78, 0xcc, 0xfc, 0xc0, 0x78, 0x00 },
-	{ 0x38, 0x6c, 0x60, 0xf0, 0x60, 0x60, 0xf0, 0x00 },
-	{ 0x00, 0x00, 0x76, 0xcc, 0xcc, 0x7c, 0x0c, 0xf8 },
-	{ 0xe0, 0x60, 0x6c, 0x76, 0x66, 0x66, 0xe6, 0x00 },
-	{ 0x30, 0x00, 0x70, 0x30, 0x30, 0x30, 0x78, 0x00 },
-	{ 0x0c, 0x00, 0x0c, 0x0c, 0x0c, 0xcc, 0xcc, 0x78 },
-	{ 0xe0, 0x60, 0x66, 0x6c, 0x78, 0x6c, 0xe6, 0x00 },
-	{ 0x70, 0x30, 0x30, 0x30, 0x30, 0x30, 0x78, 0x00 },
-	{ 0x00, 0x00, 0xcc, 0xfe, 0xfe, 0xd6, 0xc6, 0x00 },
-	{ 0x00, 0x00, 0xf8, 0xcc, 0xcc, 0xcc, 0xcc, 0x00 },
-	{ 0x00, 0x00, 0x78, 0xcc, 0xcc, 0xcc, 0x78, 0x00 },
-	{ 0x00, 0x00, 0xdc, 0x66, 0x66, 0x7c, 0x60, 0xf0 },
-	{ 0x00, 0x00, 0x76, 0xcc, 0xcc, 0x7c, 0x0c, 0x1e },
-	{ 0x00, 0x00, 0xdc, 0x76, 0x66, 0x60, 0xf0, 0x00 },
-	{ 0x00, 0x00, 0x7c, 0xc0, 0x78, 0x0c, 0xf8, 0x00 },
-	{ 0x10, 0x30, 0x7c, 0x30, 0x30, 0x34, 0x18, 0x00 },
-	{ 0x00, 0x00, 0xcc, 0xcc, 0xcc, 0xcc, 0x76, 0x00 },
-	{ 0x00, 0x00, 0xcc, 0xcc, 0xcc, 0x78, 0x30, 0x00 },
-	{ 0x00, 0x00, 0xc6, 0xd6, 0xfe, 0xfe, 0x6c, 0x00 },
-	{ 0x00, 0x00, 0xc6, 0x6c, 0x38, 0x6c, 0xc6, 0x00 },
-	{ 0x00, 0x00, 0xcc, 0xcc, 0xcc, 0x7c, 0x0c, 0xf8 },
-	{ 0x00, 0x00, 0xfc, 0x98, 0x30, 0x64, 0xfc, 0x00 },
-	{ 0x1c, 0x30, 0x30, 0xe0, 0x30, 0x30, 0x1c, 0x00 },
-	{ 0x18, 0x18, 0x18, 0x00, 0x18, 0x18, 0x18, 0x00 },
-	{ 0xe0, 0x30, 0x30, 0x1c, 0x30, 0x30, 0xe0, 0x00 },
-	{ 0x76, 0xdc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x10, 0x38, 0x6c, 0xc6, 0xc6, 0xfe, 0x00 },
-	{ 0x78, 0xcc, 0xc0, 0xcc, 0x78, 0x18, 0x0c, 0x78 },
-	{ 0x00, 0xcc, 0x00, 0xcc, 0xcc, 0xcc, 0x7e, 0x00 },
-	{ 0x1c, 0x00, 0x78, 0xcc, 0xfc, 0xc0, 0x78, 0x00 },
-	{ 0x7e, 0xc3, 0x3c, 0x06, 0x3e, 0x66, 0x3f, 0x00 },
-	{ 0xcc, 0x00, 0x78, 0x0c, 0x7c, 0xcc, 0x7e, 0x00 },
-	{ 0xe0, 0x00, 0x78, 0x0c, 0x7c, 0xcc, 0x7e, 0x00 },
-	{ 0x30, 0x30, 0x78, 0x0c, 0x7c, 0xcc, 0x7e, 0x00 },
-	{ 0x00, 0x00, 0x78, 0xc0, 0xc0, 0x78, 0x0c, 0x38 },
-	{ 0x7e, 0xc3, 0x3c, 0x66, 0x7e, 0x60, 0x3c, 0x00 },
-	{ 0xcc, 0x00, 0x78, 0xcc, 0xfc, 0xc0, 0x78, 0x00 },
-	{ 0xe0, 0x00, 0x78, 0xcc, 0xfc, 0xc0, 0x78, 0x00 },
-	{ 0xcc, 0x00, 0x70, 0x30, 0x30, 0x30, 0x78, 0x00 },
-	{ 0x7c, 0xc6, 0x38, 0x18, 0x18, 0x18, 0x3c, 0x00 },
-	{ 0xe0, 0x00, 0x70, 0x30, 0x30, 0x30, 0x78, 0x00 },
-	{ 0xc6, 0x38, 0x6c, 0xc6, 0xfe, 0xc6, 0xc6, 0x00 },
-	{ 0x30, 0x30, 0x00, 0x78, 0xcc, 0xfc, 0xcc, 0x00 },
-	{ 0x1c, 0x00, 0xfc, 0x60, 0x78, 0x60, 0xfc, 0x00 },
-	{ 0x00, 0x00, 0x7f, 0x0c, 0x7f, 0xcc, 0x7f, 0x00 },
-	{ 0x3e, 0x6c, 0xcc, 0xfe, 0xcc, 0xcc, 0xce, 0x00 },
-	{ 0x78, 0xcc, 0x00, 0x78, 0xcc, 0xcc, 0x78, 0x00 },
-	{ 0x00, 0xcc, 0x00, 0x78, 0xcc, 0xcc, 0x78, 0x00 },
-	{ 0x00, 0xe0, 0x00, 0x78, 0xcc, 0xcc, 0x78, 0x00 },
-	{ 0x78, 0xcc, 0x00, 0xcc, 0xcc, 0xcc, 0x7e, 0x00 },
-	{ 0x00, 0xe0, 0x00, 0xcc, 0xcc, 0xcc, 0x7e, 0x00 },
-	{ 0x00, 0xcc, 0x00, 0xcc, 0xcc, 0x7c, 0x0c, 0xf8 },
-	{ 0xc3, 0x18, 0x3c, 0x66, 0x66, 0x3c, 0x18, 0x00 },
-	{ 0xcc, 0x00, 0xcc, 0xcc, 0xcc, 0xcc, 0x78, 0x00 },
-	{ 0x18, 0x18, 0x7e, 0xc0, 0xc0, 0x7e, 0x18, 0x18 },
-	{ 0x38, 0x6c, 0x64, 0xf0, 0x60, 0xe6, 0xfc, 0x00 },
-	{ 0xcc, 0xcc, 0x78, 0xfc, 0x30, 0xfc, 0x30, 0x30 },
-	{ 0xf8, 0xcc, 0xcc, 0xfa, 0xc6, 0xcf, 0xc6, 0xc7 },
-	{ 0x0e, 0x1b, 0x18, 0x3c, 0x18, 0x18, 0xd8, 0x70 },
-	{ 0x1c, 0x00, 0x78, 0x0c, 0x7c, 0xcc, 0x7e, 0x00 },
-	{ 0x38, 0x00, 0x70, 0x30, 0x30, 0x30, 0x78, 0x00 },
-	{ 0x00, 0x1c, 0x00, 0x78, 0xcc, 0xcc, 0x78, 0x00 },
-	{ 0x00, 0x1c, 0x00, 0xcc, 0xcc, 0xcc, 0x7e, 0x00 },
-	{ 0x00, 0xf8, 0x00, 0xf8, 0xcc, 0xcc, 0xcc, 0x00 },
-	{ 0xfc, 0x00, 0xcc, 0xec, 0xfc, 0xdc, 0xcc, 0x00 },
-	{ 0x3c, 0x6c, 0x6c, 0x3e, 0x00, 0x7e, 0x00, 0x00 },
-	{ 0x38, 0x6c, 0x6c, 0x38, 0x00, 0x7c, 0x00, 0x00 },
-	{ 0x30, 0x00, 0x30, 0x60, 0xc0, 0xcc, 0x78, 0x00 },
-	{ 0x00, 0x00, 0x00, 0xfc, 0xc0, 0xc0, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0xfc, 0x0c, 0x0c, 0x00, 0x00 },
-	{ 0xc3, 0xc6, 0xcc, 0xde, 0x33, 0x66, 0xcc, 0x0f },
-	{ 0xc3, 0xc6, 0xcc, 0xdb, 0x37, 0x6f, 0xcf, 0x03 },
-	{ 0x18, 0x18, 0x00, 0x18, 0x18, 0x18, 0x18, 0x00 },
-	{ 0x00, 0x33, 0x66, 0xcc, 0x66, 0x33, 0x00, 0x00 },
-	{ 0x00, 0xcc, 0x66, 0x33, 0x66, 0xcc, 0x00, 0x00 },
-	{ 0x22, 0x88, 0x22, 0x88, 0x22, 0x88, 0x22, 0x88 },
-	{ 0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa },
-	{ 0xdb, 0x77, 0xdb, 0xee, 0xdb, 0x77, 0xdb, 0xee },
-	{ 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18 },
-	{ 0x18, 0x18, 0x18, 0x18, 0xf8, 0x18, 0x18, 0x18 },
-	{ 0x18, 0x18, 0xf8, 0x18, 0xf8, 0x18, 0x18, 0x18 },
-	{ 0x36, 0x36, 0x36, 0x36, 0xf6, 0x36, 0x36, 0x36 },
-	{ 0x00, 0x00, 0x00, 0x00, 0xfe, 0x36, 0x36, 0x36 },
-	{ 0x00, 0x00, 0xf8, 0x18, 0xf8, 0x18, 0x18, 0x18 },
-	{ 0x36, 0x36, 0xf6, 0x06, 0xf6, 0x36, 0x36, 0x36 },
-	{ 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36 },
-	{ 0x00, 0x00, 0xfe, 0x06, 0xf6, 0x36, 0x36, 0x36 },
-	{ 0x36, 0x36, 0xf6, 0x06, 0xfe, 0x00, 0x00, 0x00 },
-	{ 0x36, 0x36, 0x36, 0x36, 0xfe, 0x00, 0x00, 0x00 },
-	{ 0x18, 0x18, 0xf8, 0x18, 0xf8, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0xf8, 0x18, 0x18, 0x18 },
-	{ 0x18, 0x18, 0x18, 0x18, 0x1f, 0x00, 0x00, 0x00 },
-	{ 0x18, 0x18, 0x18, 0x18, 0xff, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0xff, 0x18, 0x18, 0x18 },
-	{ 0x18, 0x18, 0x18, 0x18, 0x1f, 0x18, 0x18, 0x18 },
-	{ 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00 },
-	{ 0x18, 0x18, 0x18, 0x18, 0xff, 0x18, 0x18, 0x18 },
-	{ 0x18, 0x18, 0x1f, 0x18, 0x1f, 0x18, 0x18, 0x18 },
-	{ 0x36, 0x36, 0x36, 0x36, 0x37, 0x36, 0x36, 0x36 },
-	{ 0x36, 0x36, 0x37, 0x30, 0x3f, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x3f, 0x30, 0x37, 0x36, 0x36, 0x36 },
-	{ 0x36, 0x36, 0xf7, 0x00, 0xff, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xff, 0x00, 0xf7, 0x36, 0x36, 0x36 },
-	{ 0x36, 0x36, 0x37, 0x30, 0x37, 0x36, 0x36, 0x36 },
-	{ 0x00, 0x00, 0xff, 0x00, 0xff, 0x00, 0x00, 0x00 },
-	{ 0x36, 0x36, 0xf7, 0x00, 0xf7, 0x36, 0x36, 0x36 },
-	{ 0x18, 0x18, 0xff, 0x00, 0xff, 0x00, 0x00, 0x00 },
-	{ 0x36, 0x36, 0x36, 0x36, 0xff, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xff, 0x00, 0xff, 0x18, 0x18, 0x18 },
-	{ 0x00, 0x00, 0x00, 0x00, 0xff, 0x36, 0x36, 0x36 },
-	{ 0x36, 0x36, 0x36, 0x36, 0x3f, 0x00, 0x00, 0x00 },
-	{ 0x18, 0x18, 0x1f, 0x18, 0x1f, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x1f, 0x18, 0x1f, 0x18, 0x18, 0x18 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x3f, 0x36, 0x36, 0x36 },
-	{ 0x36, 0x36, 0x36, 0x36, 0xff, 0x36, 0x36, 0x36 },
-	{ 0x18, 0x18, 0xff, 0x18, 0xff, 0x18, 0x18, 0x18 },
-	{ 0x18, 0x18, 0x18, 0x18, 0xf8, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x1f, 0x18, 0x18, 0x18 },
-	{ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff },
-	{ 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff },
-	{ 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0 },
-	{ 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f },
-	{ 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x76, 0xdc, 0xc8, 0xdc, 0x76, 0x00 },
-	{ 0x00, 0x78, 0xcc, 0xf8, 0xcc, 0xf8, 0xc0, 0xc0 },
-	{ 0x00, 0xfc, 0xcc, 0xc0, 0xc0, 0xc0, 0xc0, 0x00 },
-	{ 0x00, 0xfe, 0x6c, 0x6c, 0x6c, 0x6c, 0x6c, 0x00 },
-	{ 0xfc, 0xcc, 0x60, 0x30, 0x60, 0xcc, 0xfc, 0x00 },
-	{ 0x00, 0x00, 0x7e, 0xd8, 0xd8, 0xd8, 0x70, 0x00 },
-	{ 0x00, 0x66, 0x66, 0x66, 0x66, 0x7c, 0x60, 0xc0 },
-	{ 0x00, 0x76, 0xdc, 0x18, 0x18, 0x18, 0x18, 0x00 },
-	{ 0xfc, 0x30, 0x78, 0xcc, 0xcc, 0x78, 0x30, 0xfc },
-	{ 0x38, 0x6c, 0xc6, 0xfe, 0xc6, 0x6c, 0x38, 0x00 },
-	{ 0x38, 0x6c, 0xc6, 0xc6, 0x6c, 0x6c, 0xee, 0x00 },
-	{ 0x1c, 0x30, 0x18, 0x7c, 0xcc, 0xcc, 0x78, 0x00 },
-	{ 0x00, 0x00, 0x7e, 0xdb, 0xdb, 0x7e, 0x00, 0x00 },
-	{ 0x06, 0x0c, 0x7e, 0xdb, 0xdb, 0x7e, 0x60, 0xc0 },
-	{ 0x38, 0x60, 0xc0, 0xf8, 0xc0, 0x60, 0x38, 0x00 },
-	{ 0x78, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x00 },
-	{ 0x00, 0xfc, 0x00, 0xfc, 0x00, 0xfc, 0x00, 0x00 },
-	{ 0x30, 0x30, 0xfc, 0x30, 0x30, 0x00, 0xfc, 0x00 },
-	{ 0x60, 0x30, 0x18, 0x30, 0x60, 0x00, 0xfc, 0x00 },
-	{ 0x18, 0x30, 0x60, 0x30, 0x18, 0x00, 0xfc, 0x00 },
-	{ 0x0e, 0x1b, 0x1b, 0x18, 0x18, 0x18, 0x18, 0x18 },
-	{ 0x18, 0x18, 0x18, 0x18, 0x18, 0xd8, 0xd8, 0x70 },
-	{ 0x30, 0x30, 0x00, 0xfc, 0x00, 0x30, 0x30, 0x00 },
-	{ 0x00, 0x76, 0xdc, 0x00, 0x76, 0xdc, 0x00, 0x00 },
-	{ 0x38, 0x6c, 0x6c, 0x38, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00 },
-	{ 0x0f, 0x0c, 0x0c, 0x0c, 0xec, 0x6c, 0x3c, 0x1c },
-	{ 0x78, 0x6c, 0x6c, 0x6c, 0x6c, 0x00, 0x00, 0x00 },
-	{ 0x70, 0x18, 0x30, 0x60, 0x78, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x3c, 0x3c, 0x3c, 0x3c, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }
-};
-
-/*-------------------------------------------------------------------*/
-
-FontResources::FontResources() : LocalResourceFile("COMMON/FONTS") {
-}
-
-FontResources::FontResources(Resources *resManager) : LocalResourceFile(resManager, "COMMON/FONTS") {
-	Common::copy((const byte *)INT10_FONT_08, (const byte *)INT10_FONT_08 + 256 * 8, (byte *)_font8x8);
-}
-
-void FontResources::synchronize() {
-	syncBytes2D((byte *)_font8x8, 256, 8);
-
-	// Load in the Ultima VI font if present
-	Common::File f;
-	if (f.exists("u6.ch")) {
-		f.open("u6.ch");
-		for (int idx = 0; idx < 256; ++idx)
-			f.read(&_fontU6[idx][0], 8);
-	} else {
-		for (int idx = 0; idx < 256; ++idx)
-			Common::fill(&_fontU6[idx][0], &_fontU6[idx][8], 0);
-	}
-}
-
-} // End of namespace Shared
-} // End of namespace Ultima
diff --git a/engines/ultima/u1shared/early/game.cpp b/engines/ultima/u1shared/early/game.cpp
deleted file mode 100644
index cfe9b7a7bf9..00000000000
--- a/engines/ultima/u1shared/early/game.cpp
+++ /dev/null
@@ -1,141 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-#include "ultima/u1shared/early/game.h"
-#include "ultima/u1shared/early/font_resources.h"
-#include "ultima/u1shared/maps/map.h"
-#include "ultima/u1shared/early/ultima_early.h"
-#include "ultima/u1shared/gfx/font.h"
-#include "ultima/u1shared/gfx/screen.h"
-#include "graphics/palette.h"
-
-namespace Ultima {
-namespace Shared {
-
-BEGIN_MESSAGE_MAP(Game, GameBase)
-	ON_MESSAGE(EndOfTurnMsg)
-END_MESSAGE_MAP()
-
-Game::Game() : GameBase(), _randomSeed(0), _gameView(nullptr), _map(nullptr), _party(nullptr),
-		_edgeColor(0), _borderColor(0), _highlightColor(0), _textColor(0), _color1(0), _bgColor(0), _whiteColor(0) {
-	_fontResources = new FontResources();
-	_fontResources->load();
-	setFont(new Gfx::Font((const byte *)&_fontResources->_font8x8[0][0]));
-}
-
-Game::~Game() {
-	delete _fontResources;
-}
-
-void Game::setCGAPalette() {
-	static const byte PALETTE[4][3] = { { 0, 0, 0 },{ 0xAA, 0xAA, 0 },{ 0xAA, 0, 0xAA },{ 0xAA, 0xAA, 0xAA } };
-	g_vm->_screen->setPalette(&PALETTE[0][0], 0, 4);
-
-	_edgeColor = 3;
-	_borderColor = 3;
-	_highlightColor = 1;
-	_textColor = 3;
-	_color1 = 6;
-	_whiteColor = 3;
-}
-
-void Game::setEGAPalette() {
-	static const byte PALETTE[16][3] = {
-		{ 0, 0, 0 },{ 0x00, 0x00, 0x80 },{ 0x00, 0x80, 0x00 },{ 0x00, 0x80, 0x80 },
-		{ 0x80, 0x00, 0x00 },{ 0x80, 0x00, 0x80 },{ 0x80, 0x80, 0x00 },{ 0xC0, 0xC0, 0xC0 },
-		{ 0x80, 0x80, 0x80 },{ 0x00, 0x00, 0xFF },{ 0x00, 0xFF, 0x00 },{ 0x00, 0xFF, 0xFF },
-		{ 0xFF, 0x40, 0x40 },{ 0xFF, 0x00, 0xFF },{ 0xFF, 0xFF, 0x00 },{ 0xFF, 0xFF, 0xFF }
-	};
-	g_vm->_screen->setPalette(&PALETTE[0][0], 0, 16);
-
-	_edgeColor = 15;
-	_borderColor = 1;
-	_highlightColor = 12;
-	_textColor = 11;
-	_color1 = 7;
-	_bgColor = 0;
-	_whiteColor = 15;
-}
-
-void Game::setEGAPalette(const byte *palette) {
-	// Build up the EGA palette
-	byte egaPalette[64 * 3];
-
-	byte *p = &egaPalette[0];
-	for (int i = 0; i < 64; ++i) {
-		*p++ = (i >> 2 & 1) * 0xaa + (i >> 5 & 1) * 0x55;
-		*p++ = (i >> 1 & 1) * 0xaa + (i >> 4 & 1) * 0x55;
-		*p++ = (i & 1) * 0xaa + (i >> 3 & 1) * 0x55;
-	}
-
-	// Loop through setting palette colors based on the passed indexes
-	for (int idx = 0; idx < 16; ++idx) {
-		int palIndex = palette[idx];
-		assert(palIndex < 64);
-
-		const byte *pRgb = (const byte *)&egaPalette[palIndex * 3];
-		g_vm->_screen->setPalette(pRgb, idx, 1);
-	}
-}
-
-void Game::loadU6Palette() {
-	// Read in the palette
-	File f("u6pal");
-	byte palette[Graphics::PALETTE_SIZE];
-	f.read(palette, Graphics::PALETTE_SIZE);
-	f.close();
-
-	// Adjust the palette values from 0-63 to 0-255, and set the palette
-	for (int idx = 0; idx < Graphics::PALETTE_SIZE; ++idx)
-		palette[idx] = PALETTE_6BIT_TO_8BIT(palette[idx]);
-	g_vm->_screen->setPalette(&palette[0], 0, Graphics::PALETTE_COUNT);
-
-	// TODO: Set appropriate indexes
-	_edgeColor = 15;
-	_borderColor = 1;
-	_highlightColor = 12;
-	_textColor = 72;
-	_color1 = 7;
-	_bgColor = 49;
-}
-
-void Game::playFX(uint effectId) {
-	warning("TODO: playFX");
-}
-
-void Game::synchronize(Common::Serializer &s) {
-	_party->synchronize(s);
-	_map->synchronize(s);
-}
-
-bool Game::EndOfTurnMsg(CEndOfTurnMsg *msg) {
-	// Update things on the map
-	_map->update();
-	return false;
-}
-
-void Game::endOfTurn() {
-	CEndOfTurnMsg turnMsg;
-	turnMsg.execute(this);
-}
-
-} // End of namespace Shared
-} // End of namespace Ultima
diff --git a/engines/ultima/u1shared/early/game.h b/engines/ultima/u1shared/early/game.h
deleted file mode 100644
index 620db0f534a..00000000000
--- a/engines/ultima/u1shared/early/game.h
+++ /dev/null
@@ -1,129 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-#ifndef ULTIMA_SHARED_EARLY_GAME_H
-#define ULTIMA_SHARED_EARLY_GAME_H
-
-#include "ultima/u1shared/early/game_base.h"
-#include "ultima/u1shared/core/party.h"
-
-namespace Ultima {
-namespace Shared {
-
-class GameView;
-class GameState;
-class FontResources;
-
-namespace Maps {
-class Map;
-}
-
-/**
- * More specialized base class for earlier Ultima games
- */
-class Game : public GameBase {
-	DECLARE_MESSAGE_MAP;
-	bool EndOfTurnMsg(CEndOfTurnMsg *msg);
-protected:
-	GameView *_gameView;
-	FontResources *_fontResources;
-protected:
-	/**
-	 * Sets up EGA palette
-	 */
-	void setEGAPalette();
-
-	/**
-	 * Loads the Ultima 6 palette
-	 */
-	void loadU6Palette();
-public:
-	byte _edgeColor;
-	byte _borderColor;
-	byte _highlightColor;
-	byte _textColor;
-	byte _color1;
-	byte _bgColor;
-	byte _whiteColor;
-
-	/**
-	 * Player party. In the earlier Ultima games, this is a single character
-	 */
-	Party *_party;
-
-	/**
-	 * Pointer to the map manager for the game
-	 */
-	Maps::Map *_map;
-
-	/**
-	 * Stores the base random seed used for generating deterministic dungeon levels
-	 */
-	uint32 _randomSeed;
-
-public:
-	CLASSDEF;
-
-	/**
-	 * Constructor
-	 */
-	Game();
-
-	/**
-	 * Destructor
-	 */
-	~Game() override;
-
-	/**
-	 * Play a sound effect
-	 */
-	void playFX(uint effectId);
-
-	/**
-	 * Sets an EGA palette based on a 16-byte EGA RGB indexes
-	 */
-	void setEGAPalette(const byte *palette);
-
-	/**
-	 * Sets up a CGA palette
-	 */
-	void setCGAPalette();
-
-	/**
-	 * Returns the map
-	 */
-	Maps::Map *getMap() const override { return _map; }
-
-	/**
-	 * Handles loading and saving games
-	 */
-	void synchronize(Common::Serializer &s) override;
-
-	/**
-	 * Signal an end of turn
-	 */
-	void endOfTurn();
-};
-
-} // End of namespace Shared
-} // End of namespace Ultima
-
-#endif
diff --git a/engines/ultima/u1shared/early/game_base.cpp b/engines/ultima/u1shared/early/game_base.cpp
deleted file mode 100644
index 5a7429183bb..00000000000
--- a/engines/ultima/u1shared/early/game_base.cpp
+++ /dev/null
@@ -1,262 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-#include "common/config-manager.h"
-#include "common/system.h"
-#include "ultima/u1shared/early/ultima_early.h"
-#include "ultima/u1shared/early/game_base.h"
-#include "ultima/u1shared/engine/messages.h"
-#include "ultima/u1shared/core/mouse_cursor.h"
-#include "ultima/u1shared/gfx/font.h"
-#include "ultima/u1shared/gfx/text_cursor.h"
-#include "ultima/u1shared/gfx/text_input.h"
-#include "ultima/u1shared/gfx/visual_container.h"
-
-namespace Ultima {
-namespace Shared {
-
-GameBase::GameBase(): _currentView(nullptr), _pendingPopup(nullptr), _font(nullptr), _priorLeftDownTime(0),
-		_priorMiddleDownTime(0), _priorRightDownTime(0), _inputHandler(this), _inputTranslator(&_inputHandler),
-		_videoMode(0), _textCursor(nullptr) {
-}
-
-GameBase::~GameBase() {
-	delete _font;
-	delete _textCursor;
-}
-
-int GameBase::getSavegameSlot() {
-	return 0;
-}
-
-void GameBase::mouseChanged() {
-
-}
-
-void GameBase::onIdle() {
-	// Handle any drawing updates
-	update();
-}
-
-#define HANDLE_MESSAGE(METHOD) \
-	_inputTranslator.METHOD(g_vm->_events->getSpecialButtons(), mousePos); \
-	mouseChanged()
-
-
-void GameBase::mouseMove(const Point &mousePos) {
-	if (!isMouseControlEnabled())
-		return;
-
-	HANDLE_MESSAGE(mouseMove);
-}
-
-void GameBase::leftButtonDown(const Point &mousePos) {
-	if (!isMouseControlEnabled())
-		return;
-
-	if ((g_vm->_events->getTicksCount() - _priorLeftDownTime) < DOUBLE_CLICK_TIME) {
-		_priorLeftDownTime = 0;
-		leftButtonDoubleClick(mousePos);
-	} else {
-		_priorLeftDownTime = g_vm->_events->getTicksCount();
-		HANDLE_MESSAGE(leftButtonDown);
-	}
-}
-
-void GameBase::leftButtonUp(const Point &mousePos) {
-	if (!isMouseControlEnabled())
-		return;
-
-	HANDLE_MESSAGE(leftButtonUp);
-}
-
-void GameBase::leftButtonDoubleClick(const Point &mousePos) {
-	if (!isMouseControlEnabled())
-		return;
-
-	HANDLE_MESSAGE(leftButtonDoubleClick);
-}
-
-void GameBase::middleButtonDown(const Point &mousePos) {
-	if (!isMouseControlEnabled())
-		return;
-
-	if ((g_vm->_events->getTicksCount() - _priorMiddleDownTime) < DOUBLE_CLICK_TIME) {
-		_priorMiddleDownTime = 0;
-		middleButtonDoubleClick(mousePos);
-	} else {
-		_priorMiddleDownTime = g_vm->_events->getTicksCount();
-		HANDLE_MESSAGE(middleButtonDown);
-	}
-}
-
-void GameBase::middleButtonUp(const Point &mousePos) {
-	if (!isMouseControlEnabled())
-		return;
-
-	HANDLE_MESSAGE(middleButtonUp);
-}
-
-void GameBase::middleButtonDoubleClick(const Point &mousePos) {
-	if (!isMouseControlEnabled())
-		return;
-
-	HANDLE_MESSAGE(middleButtonDoubleClick);
-}
-
-void GameBase::rightButtonDown(const Point &mousePos) {
-	if (!isMouseControlEnabled())
-		return;
-
-	if ((g_vm->_events->getTicksCount() - _priorRightDownTime) < DOUBLE_CLICK_TIME) {
-		_priorRightDownTime = 0;
-		rightButtonDoubleClick(mousePos);
-	} else {
-		_priorRightDownTime = g_vm->_events->getTicksCount();
-		HANDLE_MESSAGE(rightButtonDown);
-	}
-}
-
-void GameBase::rightButtonUp(const Point &mousePos) {
-	if (!isMouseControlEnabled())
-		return;
-
-	HANDLE_MESSAGE(rightButtonUp);
-}
-
-void GameBase::mouseWheel(const Point &mousePos, bool wheelUp) {
-	if (!isMouseControlEnabled())
-		return;
-
-	_inputTranslator.mouseWheel(wheelUp, mousePos);
-	mouseChanged();
-}
-
-void GameBase::rightButtonDoubleClick(const Point &mousePos) {
-	if (!isMouseControlEnabled())
-		return;
-
-	HANDLE_MESSAGE(rightButtonDoubleClick);
-}
-
-void GameBase::keyDown(Common::KeyState keyState) {
-	_inputTranslator.keyDown(keyState);
-}
-
-void GameBase::setView(Gfx::VisualItem *view) {
-	_currentView = view;
-}
-
-void GameBase::setView(const Common::String &viewName) {
-	Gfx::VisualItem *view = dynamic_cast<Gfx::VisualItem *>(findByName(viewName));
-
-	if (view != _currentView) {
-		_currentView = view;
-		assert(_currentView);
-
-		// Signal the view that it's now active
-		CShowMsg showMsg;
-		showMsg.execute(_currentView);
-	}
-}
-
-void GameBase::setPopup(Gfx::Popup *popup) {
-	assert(!_pendingPopup);
-	_pendingPopup = popup;
-}
-
-void GameBase::update() {
-	if (_currentView) {
-		// Signal the next frame
-		CFrameMsg frameMsg(g_vm->_events->getTicksCount());
-		frameMsg.execute(_currentView);
-
-		// Draw the view
-		if (_currentView->isDirty()) {
-			_currentView->draw();
-			_currentView->clearDirty();
-		} else if (_pendingPopup) {
-			// There's a pending popup to display, so make it active
-			_currentView = _pendingPopup;
-			_pendingPopup = nullptr;
-
-			CShowMsg showMsg;
-			showMsg.execute(_currentView);
-		}
-
-		 // Allow the text cursor to update
-		_textCursor->update();
-	}
-}
-
-void GameBase::changeView(const Common::String &name) {
-	Gfx::VisualItem *newView = dynamic_cast<Gfx::VisualItem *>(findByName(name));
-	assert(newView);
-
-	// Hide the current view
-	CHideMsg hideMsg(_currentView, true);
-	hideMsg.execute(_currentView, nullptr, MSGFLAG_SCAN);
-
-	if (hideMsg._fadeOut) {
-		// TODO: Fade out
-	}
-
-	// Show the new view
-	_currentView = newView;
-	CShowMsg showMsg(_currentView, true);
-	showMsg.execute(_currentView, nullptr, MSGFLAG_SCAN);
-
-	_currentView->draw();
-
-	if (showMsg._fadeIn) {
-		// TODO: Fade in
-	}
-}
-
-void GameBase::setFont(Gfx::Font *font) {
-	delete _font;
-	_font = font;
-}
-
-uint GameBase::getRandomNumber(uint max) {
-	return g_vm->getRandomNumber(max);
-}
-
-uint GameBase::getRandomNumber(uint min, uint max) {
-	return g_vm->getRandomNumber(min, max);
-}
-
-void GameBase::sleep(uint time) {
-	g_vm->_events->sleep(time);
-}
-
-uint32 GameBase::getMillis() const {
-	return g_system->getMillis();
-}
-
-void GameBase::synchronize(Common::Serializer &s) {
-	_priorLeftDownTime = 0;
-	_priorMiddleDownTime = 0;
-	_priorRightDownTime = 0;
-}
-
-} // End of namespace Shared
-} // End of namespace Ultima
diff --git a/engines/ultima/u1shared/early/game_base.h b/engines/ultima/u1shared/early/game_base.h
deleted file mode 100644
index b3284c5ea97..00000000000
--- a/engines/ultima/u1shared/early/game_base.h
+++ /dev/null
@@ -1,203 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-#ifndef ULTIMA_SHARED_EARLY_GAME_BASE_H
-#define ULTIMA_SHARED_EARLY_GAME_BASE_H
-
-#include "common/scummsys.h"
-#include "common/array.h"
-#include "common/serializer.h"
-#include "ultima/u1shared/engine/events.h"
-#include "ultima/u1shared/engine/input_handler.h"
-#include "ultima/u1shared/engine/input_translator.h"
-
-namespace Ultima {
-namespace Shared {
-
-class UltimaEngine;
-class GameState;
-
-namespace Gfx {
-class Font;
-class Popup;
-class TextCursor;
-class TextInput;
-class VisualItem;
-} // End of namespace Gfx
-
-namespace Maps {
-class Map;
-} // End of namespace Maps
-
-/**
- * Base class for the game implementations
- */
-class GameBase : public TreeItem, public EventTarget {
-private:
-	/**
-	 * Checks for the presence of any savegames and, if present,
-	 * lets the user pick one to resume
-	 */
-	int getSavegameSlot();
-
-	void leftButtonDoubleClick(const Point &mousePos) override;
-	void middleButtonDoubleClick(const Point &mousePos) override;
-	void rightButtonDoubleClick(const Point &mousePos);
-
-	/**
-	 * Returns true if the player can control the mouse
-	 */
-	bool isMouseControlEnabled() const { return true; }
-
-	void changeView(const Common::String &name);
-protected:
-	uint32 _priorLeftDownTime;
-	uint32 _priorMiddleDownTime;
-	uint32 _priorRightDownTime;
-	Gfx::VisualItem *_currentView;
-	Gfx::Popup *_pendingPopup;
-	InputHandler _inputHandler;
-	InputTranslator _inputTranslator;
-	Gfx::Font *_font;
-public:
-	Gfx::TextCursor *_textCursor;
-	uint _videoMode;
-public:
-	/**
-	 * Constructor
-	 */
-	GameBase();
-
-	/**
-	 * Destructor
-	 */
-	~GameBase() override;
-
-	/**
-	 * Called to handle any regular updates the game requires
-	 */
-	void onIdle() override;
-
-	void mouseMove(const Point &mousePos) override;
-	void leftButtonDown(const Point &mousePos) override;
-	void leftButtonUp(const Point &mousePos) override;
-	void middleButtonDown(const Point &mousePos) override;
-	void middleButtonUp(const Point &mousePos) override;
-	void rightButtonDown(const Point &mousePos) override;
-	void rightButtonUp(const Point &mousePos) override;
-	void mouseWheel(const Point &mousePos, bool wheelUp) override;
-	void keyDown(Common::KeyState keyState) override;
-
-	/**
-	 * Called when the game starts
-	 */
-	virtual void starting(bool isLoading) {}
-
-	/**
-	 * Returns true if the current video mode is VGA
-	 */
-	virtual bool isVGA() const { return false; }
-
-	/**
-	 * Called once every frame to update the game and render the view
-	 */
-	void update();
-
-	/**
-	 * Called by the event handler when a mouse event has been generated
-	 */
-	void mouseChanged();
-
-	/**
-	 * Set the currently active view to display
-	 */
-	void setView(Gfx::VisualItem *view);
-
-	/**
-	 * Set the currently active view to display
-	 */
-	void setView(const Common::String &viewName);
-
-	/**
-	 * Sets a popup to be shown
-	 */
-	void setPopup(Gfx::Popup *popup);
-
-	/**
-	 * Returns the current view
-	 */
-	Gfx::VisualItem *getView() const { return _currentView; }
-
-	/**
-	 * Set a font to use
-	 */
-	void setFont(Gfx::Font *font);
-
-	/**
-	 * Returns the current font
-	 */
-	Gfx::Font *getFont() const { return _font; }
-
-	/**
-	 * Returns the map
-	 */
-	virtual Maps::Map *getMap() const { return nullptr; }
-
-	/**
-	 * Gets a random number
-	 */
-	uint getRandomNumber(uint max);
-
-	/**
-	 * Gets a random number
-	 */
-	uint getRandomNumber(uint min, uint max);
-
-	/**
-	 * Wait for a given period of time
-	 */
-	void sleep(uint time);
-
-	/**
-	 * Return the current time
-	 */
-	uint32 getMillis() const;
-
-	/**
-	 * Returns true if a savegame can currently be loaded
-	 */
-	virtual bool canLoadGameStateCurrently(Common::U32String *msg = nullptr) { return true; }
-
-	/**
-	 * Returns true if the game can currently be saved
-	 */
-	virtual bool canSaveGameStateCurrently(Common::U32String *msg = nullptr) { return false; }
-
-	/**
-	 * Handles loading and saving games
-	 */
-	virtual void synchronize(Common::Serializer &s);
-};
-
-} // End of namespace Shared
-} // End of namespace Ultima
-
-#endif
diff --git a/engines/ultima/u1shared/early/ultima_early.cpp b/engines/ultima/u1shared/early/ultima_early.cpp
deleted file mode 100644
index 50766e35ca9..00000000000
--- a/engines/ultima/u1shared/early/ultima_early.cpp
+++ /dev/null
@@ -1,164 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-#include "common/scummsys.h"
-#include "common/config-manager.h"
-#include "common/debug-channels.h"
-#include "common/system.h"
-#include "common/translation.h"
-#include "graphics/thumbnail.h"
-#include "graphics/scaler.h"
-#include "gui/saveload.h"
-#include "ultima/u1shared/early/ultima_early.h"
-#include "ultima/u1shared/early/game.h"
-#include "ultima/u1shared/engine/events.h"
-#include "ultima/u1shared/engine/resources.h"
-#include "ultima/u1shared/core/mouse_cursor.h"
-#include "ultima/u1shared/gfx/screen.h"
-
-#ifndef RELEASE_BUILD
-#include "ultima/ultima1/game.h"
-#endif
-
-namespace Ultima {
-
-Shared::UltimaEarlyEngine *g_vm;
-
-namespace Shared {
-
-UltimaEarlyEngine::UltimaEarlyEngine(OSystem *syst, const UltimaGameDescription *gameDesc) :
-		Engine(syst), _gameDescription(gameDesc), _game(nullptr), _randomSource("Ultima") {
-	g_vm = this;
-	_mouseCursor = nullptr;
-	_screen = nullptr;
-}
-
-UltimaEarlyEngine::~UltimaEarlyEngine() {
-	delete _events;
-	delete _game;
-	delete _mouseCursor;
-	delete _screen;
-}
-
-bool UltimaEarlyEngine::initialize() {
-	// Call syncSoundSettings to get default volumes set
-	syncSoundSettings();
-
-	// Set up the resources datafile
-	Resources *res = new Resources();
-	if (!res->open()) {
-		GUIErrorMessage(_("Could not find correct ultima.dat datafile"));
-		return false;
-	}
-	SearchMan.add("ultima", res);
-
-	_events = new EventsManager(this);
-	_screen = new Gfx::Screen();
-
-	// Create the game, and signal to it that the game is starting
-	_game = createGame();
-	_events->addTarget(_game);
-	_game->starting(false);
-
-	// Load cursors
-	_mouseCursor = new MouseCursor();
-
-	// If requested, load a savegame instead of showing the intro
-	if (ConfMan.hasKey("save_slot")) {
-		int saveSlot = ConfMan.getInt("save_slot");
-		if (saveSlot >= 0 && saveSlot <= 999)
-			loadGameState(saveSlot);
-	}
-
-	return true;
-}
-
-Common::Error UltimaEarlyEngine::run() {
-	// Initialize the engine and play the game
-	if (initialize())
-		playGame();
-
-	// Deinitialize and free the engine
-	deinitialize();
-	return Common::kNoError;
-}
-
-bool UltimaEarlyEngine::hasFeature(EngineFeature f) const {
-	return
-		(f == kSupportsReturnToLauncher) ||
-		(f == kSupportsLoadingDuringRuntime) ||
-		(f == kSupportsChangingOptionsDuringRuntime) ||
-		(f == kSupportsSavingDuringRuntime);
-}
-
-void UltimaEarlyEngine::playGame() {
-	while (!shouldQuit()) {
-		_events->pollEventsAndWait();
-	}
-}
-
-Graphics::Screen *UltimaEarlyEngine::getScreen() const {
-	return _screen;
-}
-
-GameId UltimaEarlyEngine::getGameId() const {
-	return _gameDescription->gameId;
-}
-
-bool UltimaEarlyEngine::isEnhanced() const {
-	return _gameDescription->features & GF_VGA_ENHANCED;
-}
-
-Game *UltimaEarlyEngine::createGame() const {
-	switch (getGameId()) {
-#ifndef RELEASE_BUILD
-	case GAME_ULTIMA1:
-		return new Ultima1::Ultima1Game();
-#endif
-	default:
-		error("Unknown game");
-	}
-}
-
-Common::Error UltimaEarlyEngine::loadGameStream(Common::SeekableReadStream *stream) {
-	// Read in the game's data
-	Common::Serializer s(stream, nullptr);
-	_game->synchronize(s);
-	return Common::kNoError;
-}
-
-Common::Error UltimaEarlyEngine::saveGameStream(Common::WriteStream *stream, bool) {
-	// Write out the game's data
-	Common::Serializer s(nullptr, stream);
-	_game->synchronize(s);
-	return Common::kNoError;
-}
-
-bool UltimaEarlyEngine::canLoadGameStateCurrently(Common::U32String *msg) {
-	return _game->canLoadGameStateCurrently(msg);
-}
-
-bool UltimaEarlyEngine::canSaveGameStateCurrently(Common::U32String *msg) {
-	return _game->canSaveGameStateCurrently(msg);
-}
-
-} // End of namespace Shared
-} // End of namespace Ultima
diff --git a/engines/ultima/u1shared/early/ultima_early.h b/engines/ultima/u1shared/early/ultima_early.h
deleted file mode 100644
index fe80998615d..00000000000
--- a/engines/ultima/u1shared/early/ultima_early.h
+++ /dev/null
@@ -1,169 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-#ifndef ULTIMA_SHARED_EARLY_ULTIMA_EARLY_H
-#define ULTIMA_SHARED_EARLY_ULTIMA_EARLY_H
-
-#include "common/scummsys.h"
-#include "common/array.h"
-#include "common/endian.h"
-#include "common/hash-str.h"
-#include "common/serializer.h"
-#include "common/random.h"
-#include "common/savefile.h"
-#include "common/util.h"
-#include "graphics/surface.h"
-#include "engines/engine.h"
-#include "ultima/detection.h"
-
-#include "ultima/u1shared/engine/events.h"
-
-namespace Ultima {
-
-struct UltimaGameDescription;
-
-namespace Shared {
-
-struct UltimaSavegameHeader {
-	uint8 _version;
-	uint8 _gameId;
-	uint8 _language;
-	uint8 _videoMode;
-	Common::String _saveName;
-	Graphics::Surface *_thumbnail;
-	int _year, _month, _day;
-	int _hour, _minute;
-	int _totalFrames;
-};
-
-class Events;
-class Game;
-class GameBase;
-class MouseCursor;
-class Resources;
-
-namespace Gfx {
-class Screen;
-}
-
-class UltimaEarlyEngine : public Engine, public EventsCallback {
-private:
-	/**
-	 * Initialize the engine
-	 */
-	virtual bool initialize();
-
-	/**
-	 * Deinitialize the engine
-	 */
-	virtual void deinitialize() {}
-
-private:
-	Common::RandomSource _randomSource;
-protected:
-	const UltimaGameDescription *_gameDescription;
-public:
-	GameBase *_game;
-	MouseCursor *_mouseCursor;
-	Gfx::Screen *_screen;
-	EventsManager *_events;
-public:
-	UltimaEarlyEngine(OSystem *syst, const UltimaGameDescription *gameDesc);
-	~UltimaEarlyEngine() override;
-
-	/**
-	 * Main method for running the game
-	 */
-	Common::Error run() override;
-
-	/**
-	 * Returns supported engine features
-	 */
-	bool hasFeature(EngineFeature f) const override;
-
-	/**
-	 * Play the game
-	 */
-	void playGame();
-
-	/**
-	 * Get a random number
-	 */
-	uint getRandomNumber(uint maxVal) { return _randomSource.getRandomNumber(maxVal); }
-
-	/**
-	 * Gets a random number
-	 */
-	uint getRandomNumber(uint min, uint max) {
-		return min + _randomSource.getRandomNumber(max - min);
-	}
-
-	/**
-	 * Get the screen
-	 */
-	Graphics::Screen *getScreen() const override;
-
-	/**
-	 * Indicates whether a game state can be loaded.
-	 * @param isAutosave	Flags whether it's an autosave check
-	 */
-	bool canLoadGameStateCurrently(Common::U32String *msg = nullptr) override;
-
-	/**
-	 * Indicates whether a game state can be saved.
-	 * @param isAutosave	Flags whether it's an autosave check
-	 */
-	bool canSaveGameStateCurrently(Common::U32String *msg = nullptr) override;
-
-	/**
-	 * Load a savegame
-	 */
-	Common::Error loadGameStream(Common::SeekableReadStream *stream) override;
-
-	/**
-	 * Save a game state.
-	 */
-	Common::Error saveGameStream(Common::WriteStream *stream, bool isAutosave = false) override;
-
-	/**
-	 * Returns the game type being played
-	 */
-	GameId getGameId() const;
-
-	/**
-	 * Returns true if the game is running an enhanced version
-	 * as compared to the original game
-	 */
-	bool isEnhanced() const;
-
-	/*
-	 * Creates a new hierarchy for the game, that contains all the logic for playing that particular game.
-	 */
-	Game *createGame() const;
-};
-
-} // End of namespace Shared
-
-extern Shared::UltimaEarlyEngine *g_vm;
-
-} // End of namespace Ultima
-
-#endif
diff --git a/engines/ultima/u1shared/engine/events.cpp b/engines/ultima/u1shared/engine/events.cpp
deleted file mode 100644
index 141ef828411..00000000000
--- a/engines/ultima/u1shared/engine/events.cpp
+++ /dev/null
@@ -1,255 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-#include "common/scummsys.h"
-#include "graphics/cursorman.h"
-#include "common/events.h"
-#include "common/endian.h"
-#include "common/system.h"
-#include "engines/util.h"
-#include "ultima/u1shared/engine/events.h"
-
-namespace Ultima {
-namespace Shared {
-
-EventsManager::EventsManager(EventsCallback *callback) : _callback(callback), _playTime(0),
-		_gameCounter(0), _frameCounter(0), _priorFrameCounterTime(0), _buttonsDown(0),
-		_specialButtons(0), _priorFrameTime(0) {
-}
-
-void EventsManager::showCursor() {
-	CursorMan.showMouse(true);
-}
-
-void EventsManager::hideCursor() {
-	CursorMan.showMouse(false);
-}
-
-bool EventsManager::isCursorVisible() {
-	return CursorMan.isVisible();
-}
-
-bool EventsManager::pollEvent(Common::Event &event) {
-	uint32 timer = g_system->getMillis();
-
-	if (timer >= (_priorFrameCounterTime + GAME_FRAME_TIME)) {
-		// Time to build up next game frame
-		_priorFrameCounterTime = timer;
-		nextFrame();
-	}
-
-	// Event handling
-	if (g_system->getEventManager()->pollEvent(event)) {
-		if (isMouseDownEvent(event.type)) {
-			setButtonDown(whichButton(event.type), true);
-			_mousePos = event.mouse;
-		} else if (isMouseUpEvent(event.type)) {
-			setButtonDown(whichButton(event.type), false);
-			_mousePos = event.mouse;
-		} else if (event.type == Common::EVENT_MOUSEMOVE) {
-			_mousePos = event.mouse;
-		}
-
-		switch (event.type) {
-		case Common::EVENT_KEYDOWN: {
-			handleKbdSpecial(event.kbd);
-			break;
-		}
-		case Common::EVENT_KEYUP:
-			handleKbdSpecial(event.kbd);
-			break;
-		case Common::EVENT_MOUSEMOVE:
-			_mousePos = event.mouse;
-			break;
-		case Common::EVENT_LBUTTONDOWN:
-		case Common::EVENT_RBUTTONDOWN:
-			break;
-		case Common::EVENT_LBUTTONUP:
-		case Common::EVENT_RBUTTONUP:
-			break;
-		default:
- 			break;
-		}
-
-		return true;
-	}
-
-	return false;
-}
-
-void EventsManager::pollEvents() {
-	Common::Event event;
-
-	while (pollEvent(event)) {
-		switch (event.type) {
-		case Common::EVENT_MOUSEMOVE:
-			eventTarget()->mouseMove(_mousePos);
-			break;
-		case Common::EVENT_LBUTTONDOWN:
-			eventTarget()->leftButtonDown(_mousePos);
-			break;
-		case Common::EVENT_LBUTTONUP:
-			eventTarget()->leftButtonUp(_mousePos);
-			break;
-		case Common::EVENT_MBUTTONDOWN:
-			eventTarget()->middleButtonDown(_mousePos);
-			break;
-		case Common::EVENT_MBUTTONUP:
-			eventTarget()->middleButtonUp(_mousePos);
-			break;
-		case Common::EVENT_RBUTTONDOWN:
-			eventTarget()->rightButtonDown(_mousePos);
-			break;
-		case Common::EVENT_RBUTTONUP:
-			eventTarget()->rightButtonUp(_mousePos);
-			break;
-		case Common::EVENT_WHEELUP:
-		case Common::EVENT_WHEELDOWN:
-			eventTarget()->mouseWheel(_mousePos, event.type == Common::EVENT_WHEELUP);
-			break;
-		case Common::EVENT_KEYDOWN:
-			eventTarget()->keyDown(event.kbd);
-			break;
-		case Common::EVENT_KEYUP:
-			eventTarget()->keyUp(event.kbd);
-			break;
-		default:
-			break;
-		}
-	}
-}
-
-void EventsManager::pollEventsAndWait() {
-	pollEvents();
-	g_system->delayMillis(10);
-}
-
-void EventsManager::nextFrame() {
-	++_frameCounter;
-	++_playTime;
-
-	// Handle any idle updates
-	if (!_eventTargets.empty())
-		eventTarget()->onIdle();
-
-	// Render anything pending for the screen
-	Graphics::Screen *screen = _callback->getScreen();
-	if (screen)
-		screen->update();
-}
-
-void EventsManager::setButtonDown(MouseButton button, bool isDown) {
-	assert(button != BUTTON_NONE);
-
-	byte mask = 0;
-	switch (button) {
-	case BUTTON_LEFT:
-		mask = MK_LBUTTON;
-		break;
-	case BUTTON_RIGHT:
-		mask = MK_RBUTTON;
-		break;
-	case BUTTON_MIDDLE:
-		mask = MK_MBUTTON;
-		break;
-	default:
-		break;
-	}
-
-	if (isDown) {
-		_buttonsDown |= BUTTON_MASK(button);
-		_specialButtons |= mask;
-	} else {
-		_buttonsDown &= ~BUTTON_MASK(button);
-		_specialButtons &= ~mask;
-	}
-}
-
-uint32 EventsManager::getTicksCount() const {
-	return _frameCounter * GAME_FRAME_TIME;
-}
-
-void EventsManager::sleep(uint time) {
-	uint32 delayEnd = g_system->getMillis() + time;
-
-	while (!g_engine->shouldQuit() && g_system->getMillis() < delayEnd)
-		pollEventsAndWait();
-}
-
-bool EventsManager::waitForPress(uint expiry) {
-	uint32 delayEnd = g_system->getMillis() + expiry;
-	CPressTarget pressTarget;
-	addTarget(&pressTarget);
-
-	while (!g_engine->shouldQuit() && g_system->getMillis() < delayEnd && !pressTarget._pressed) {
-		pollEventsAndWait();
-	}
-
-	removeTarget();
-	return pressTarget._pressed;
-}
-
-void EventsManager::setMousePos(const Point &pt) {
-	g_system->warpMouse(pt.x, pt.y);
-	_mousePos = pt;
-	eventTarget()->mouseMove(_mousePos);
-}
-
-void EventsManager::handleKbdSpecial(Common::KeyState keyState) {
-	if (keyState.flags & Common::KBD_CTRL)
-		_specialButtons |= MK_CONTROL;
-	else
-		_specialButtons &= ~MK_CONTROL;
-
-	if (keyState.flags & Common::KBD_SHIFT)
-		_specialButtons |= MK_SHIFT;
-	else
-		_specialButtons &= ~MK_SHIFT;
-}
-
-
-bool shouldQuit() {
-	return g_engine->shouldQuit();
-}
-
-bool isMouseDownEvent(Common::EventType type) {
-	return type == Common::EVENT_LBUTTONDOWN || type == Common::EVENT_RBUTTONDOWN
-		|| type == Common::EVENT_MBUTTONDOWN;
-}
-
-bool isMouseUpEvent(Common::EventType type) {
-	return type == Common::EVENT_LBUTTONUP || type == Common::EVENT_RBUTTONUP
-		|| type == Common::EVENT_MBUTTONUP;
-}
-
-MouseButton whichButton(Common::EventType type) {
-	if (type == Common::EVENT_LBUTTONDOWN || type == Common::EVENT_LBUTTONUP)
-		return BUTTON_LEFT;
-	else if (type == Common::EVENT_RBUTTONDOWN || type == Common::EVENT_RBUTTONUP)
-		return BUTTON_RIGHT;
-	else if (type == Common::EVENT_MBUTTONDOWN || type == Common::EVENT_MBUTTONUP)
-		return BUTTON_MIDDLE;
-	else
-		return BUTTON_NONE;
-}
-
-} // End of namespace Shared
-} // End of namespace Ultima
diff --git a/engines/ultima/u1shared/engine/events.h b/engines/ultima/u1shared/engine/events.h
deleted file mode 100644
index 36d2dcd8fd5..00000000000
--- a/engines/ultima/u1shared/engine/events.h
+++ /dev/null
@@ -1,338 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-#ifndef ULTIMA_SHARED_ENGINE_EVENTS_H
-#define ULTIMA_SHARED_ENGINE_EVENTS_H
-
-#include "common/scummsys.h"
-#include "common/events.h"
-#include "common/stack.h"
-#include "gui/debugger.h"
-#include "graphics/screen.h"
-#include "ultima/u1shared/core/rect.h"
-
-namespace Ultima {
-namespace Shared {
-
-#define GAME_FRAME_RATE (1000 / 50)
-#define GAME_FRAME_TIME 50
-#define SCREEN_UPDATE_TIME 10
-#define BUTTON_MASK(MB) (1 << ((int)(MB) - 1))
-#define DOUBLE_CLICK_TIME 100
-
-enum MouseButton {
-	BUTTON_NONE = 0,
-	BUTTON_LEFT = 1,
-	BUTTON_RIGHT = 2,
-	BUTTON_MIDDLE = 3,
-	MOUSE_LAST
-};
-
-enum SpecialButtons {
-	MK_LBUTTON = 1, MK_RBUTTON = 2, MK_MBUTTON = 4, MK_SHIFT = 8, MK_CONTROL = 0x10
-};
-
-/**
- * A base class for windows that can receive event messages
- */
-class EventTarget {
-public:
-	virtual ~EventTarget() {
-	}
-
-	/**
-	 * Called to handle any regular updates the game requires
-	 */
-	virtual void onIdle() {
-	}
-
-	/**
-	 * Mouse/key event handlers
-	 */
-	virtual void mouseMove(const Common::Point &mousePos) {
-	}
-	virtual void leftButtonDown(const Common::Point &mousePos) {
-	}
-	virtual void leftButtonUp(const Common::Point &mousePos) {
-	}
-	virtual void leftButtonDoubleClick(const Common::Point &mousePos) {
-	}
-	virtual void middleButtonDown(const Common::Point &mousePos) {
-	}
-	virtual void middleButtonUp(const Common::Point &mousePos) {
-	}
-	virtual void middleButtonDoubleClick(const Common::Point &mousePos) {
-	}
-	virtual void rightButtonDown(const Common::Point &mousePos) {
-	}
-	virtual void rightButtonUp(const Common::Point &mousePos) {
-	}
-	virtual void mouseWheel(const Common::Point &mousePos, bool wheelUp) {
-	}
-	virtual void keyDown(Common::KeyState keyState) {
-	}
-	virtual void keyUp(Common::KeyState keyState) {
-	}
-};
-
-/**
- * An eent target used for waiting for a mouse or keypress
- */
-class CPressTarget : public EventTarget {
-public:
-	bool _pressed;
-public:
-	CPressTarget() : _pressed(false) {
-	}
-	~CPressTarget() override {
-	}
-	void leftButtonDown(const Common::Point &mousePos) override {
-		_pressed = true;
-	}
-	void middleButtonDown(const Common::Point &mousePos) override {
-		_pressed = true;
-	}
-	void rightButtonDown(const Common::Point &mousePos) override {
-		_pressed = true;
-	}
-	void keyDown(Common::KeyState keyState) override {
-		_pressed = true;
-	}
-};
-
-/**
- * Abstract interface for engine functionality the events manager needs to access
- */
-class EventsCallback {
-public:
-	/**
-	 * Destructor
-	 */
-	virtual ~EventsCallback() {}
-
-	/**
-	 * Get the screen
-	 */
-	virtual Graphics::Screen *getScreen() const {
-		return nullptr;
-	}
-};
-
-class EventsManager {
-private:
-	EventsCallback *_callback;
-	Common::Stack<EventTarget *> _eventTargets;
-	uint32 _frameCounter;
-	uint32 _priorFrameTime;
-	uint32 _priorFrameCounterTime;
-	uint32 _gameCounter;
-	uint32 _playTime;
-	Point _mousePos;
-	uint _specialButtons;
-	uint8  _buttonsDown;
-
-	/**
-	 * Check whether it's time to display the next screen frame
-	 */
-	bool checkForNextFrameCounter();
-
-	/**
-	 * Return the currently active event target
-	 */
-	EventTarget *eventTarget() const {
-		return _eventTargets.top();
-	}
-
-	/**
-	 * Handles setting/resettings special buttons on key up/down
-	 */
-	void handleKbdSpecial(Common::KeyState keyState);
-
-	/**
-	 * Sets whether a given button is depressed
-	 */
-	void setButtonDown(MouseButton button, bool isDown);
-protected:
-	/**
-	 * Handles moving to the next game frame
-	 */
-	virtual void nextFrame();
-public:
-	EventsManager(EventsCallback *callback);
-	virtual ~EventsManager() {}
-
-	/**
-	 * Adds a new event target to the top of the list. It will get
-	 * all events generated until such time as another is pushed on
-	 * top of it, or the removeTarget method is called
-	 */
-	void addTarget(EventTarget *target) {
-		_eventTargets.push(target);
-	}
-
-	/**
-	 * Removes the currently active event target
-	 */
-	void removeTarget() {
-		_eventTargets.pop();
-	}
-
-	/**
-	 * Polls the ScummVM backend for any pending events, passing out the event, if any
-	 */
-
-	virtual bool pollEvent(Common::Event &event);
-
-	/**
-	 * Checks for any pending events. This differs from pollEvent, in that the event manager will dispatch
-	 * all pending events to the currently registered active event target, rather than simply returning a
-	 * single event like pollEvent does
-	 */
-	void pollEvents();
-
-	/**
-	 * Poll for events and introduce a small delay, to allow the system to
-	 * yield to other running programs
-	 */
-	void pollEventsAndWait();
-
-	/**
-	 * Return the current game frame number
-	 */
-	uint32 getFrameCounter() const {
-		return _frameCounter;
-	}
-
-	/**
-	 * Get the elapsed playtime
-	 */
-	uint32 getTicksCount() const;
-
-	/**
-	 * Sleep for a specified period of time
-	 */
-	void sleep(uint time);
-
-	/**
-	 * Wait for a mouse or keypress
-	 */
-	bool waitForPress(uint expiry);
-
-	/**
-	 * Sets the mouse position
-	 */
-	void setMousePos(const Point &pt);
-
-	/*
-	 * Return whether a given special key is currently pressed
-	 */
-	bool isSpecialPressed(SpecialButtons btn) const {
-		return (_specialButtons & btn) != 0;
-	}
-
-	/**
-	 * Returns the bitset of the currently pressed special buttons
-	 */
-	uint getSpecialButtons() const {
-		return _specialButtons;
-	}
-
-	/*
-	 * Set the cursor
-	 */
-	virtual void setCursor(int cursorId) {
-	}
-
-	/**
-	 * Show the mouse cursor
-	 */
-	void showCursor();
-
-	/**
-	 * Hide the mouse cursor
-	 */
-	void hideCursor();
-
-	/**
-	 * Returns if the mouse cursor is visible
-	 */
-	bool isCursorVisible();
-
-	/**
-	 * Gets the current total ticks
-	 */
-	uint32 getTicks() {
-		return _frameCounter;
-	}
-
-	/**
-	 * Gets the total overall play time
-	 */
-	uint32 playTime() const {
-		return _playTime;
-	}
-
-	/**
-	 * Sets the current play time
-	 */
-	void setPlayTime(uint32 time) {
-		_playTime = time;
-	}
-
-	/**
-	 * Returns true if a given mouse button is pressed
-	 */
-	inline bool isButtonDown(MouseButton button) const {
-		return (_buttonsDown & BUTTON_MASK(button)) != 0;
-	}
-
-	/**
-	 * Returns true if any mouse button is pressed
-	 */
-	bool isButtonDown() const {
-		return isButtonDown(BUTTON_LEFT) || isButtonDown(BUTTON_RIGHT) || isButtonDown(BUTTON_MIDDLE);
-	}
-
-	/**
-	 * Returns the mouse buttons states
-	 */
-	byte getButtonState() const {
-		return _buttonsDown;
-	}
-
-	/**
-	 * Return the mouse position
-	 */
-	Common::Point getMousePos() const {
-		return _mousePos;
-	}
-};
-
-extern bool isMouseDownEvent(Common::EventType type);
-
-extern bool isMouseUpEvent(Common::EventType type);
-
-extern MouseButton whichButton(Common::EventType type);
-
-} // End of namespace Shared
-} // End of namespace Ultima
-
-#endif
diff --git a/engines/ultima/u1shared/engine/input_handler.cpp b/engines/ultima/u1shared/engine/input_handler.cpp
deleted file mode 100644
index 2f445f368f9..00000000000
--- a/engines/ultima/u1shared/engine/input_handler.cpp
+++ /dev/null
@@ -1,118 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-#include "ultima/u1shared/engine/input_handler.h"
-#include "ultima/u1shared/engine/events.h"
-#include "ultima/u1shared/early/game_base.h"
-#include "ultima/u1shared/engine/messages.h"
-#include "ultima/u1shared/gfx/visual_item.h"
-
-namespace Ultima {
-namespace Shared {
-
-InputHandler::InputHandler(GameBase *game) : _game(game), _inputTranslator(nullptr), _dragging(false),
-		_buttonDown(false), _lockCount(0), _abortMessage(false) {
-}
-
-InputHandler::~InputHandler() {
-}
-
-void InputHandler::setTranslator(InputTranslator *translator) {
-	_inputTranslator = translator;
-}
-
-void InputHandler::incLockCount() {
-	++_lockCount;
-}
-
-void InputHandler::decLockCount() {
-	--_lockCount;
-	assert(_lockCount >= 0);
-
-	if (_lockCount == 0 && _inputTranslator) {
-		if (_dragging && !_inputTranslator->isMousePressed()) {
-			CMouseButtonUpMsg upMsg(_mousePos, MK_LBUTTON);
-			handleMessage(upMsg);
-		}
-
-		_buttonDown = _inputTranslator->isMousePressed();
-		_abortMessage = true;
-	}
-}
-
-void InputHandler::handleMessage(CMessage &msg, bool respectLock) {
-	if (!respectLock || _lockCount <= 0) {
-		processMessage(&msg);
-	}
-}
-
-void InputHandler::processMessage(CMessage *msg) {
-	const CMouseMsg *mouseMsg = dynamic_cast<const CMouseMsg *>(msg);
-	_abortMessage = false;
-	dispatchMessage(msg);
-
-	if (_abortMessage) {
-		_abortMessage = false;
-	} else if (mouseMsg) {
-		// Keep the game state mouse position up to date
-		if (_mousePos != mouseMsg->_mousePos) {
-			_mousePos = mouseMsg->_mousePos;
-		}
-
-		// Set flag for whether a mouse button is currently being pressed
-		if (mouseMsg->isButtonDownMsg())
-			_buttonDown = true;
-		else if (mouseMsg->isButtonUpMsg())
-			_buttonDown = false;
-
-		// Drag events generation
-		if (_dragging) {
-			if (mouseMsg->isMouseMoveMsg()) {
-				CMouseDragMsg moveMsg(_mousePos, mouseMsg->_buttons);
-				dispatchMessage(&moveMsg);
-			} else if (mouseMsg->isButtonUpMsg()) {
-				_dragging = false;
-			}
-		} else if (_buttonDown) {
-			if (!mouseMsg->isMouseMoveMsg()) {
-				// Save where the drag movement started from
-				_dragStartPos = _mousePos;
-			} else {
-				Point delta = _mousePos - _dragStartPos;
-				int distance = (int)sqrt(double(delta.x * delta.x + delta.y * delta.y));
-
-				if (distance > 4) {
-					// A drag has started
-					_dragging = true;
-				}
-			}
-		}
-	}
-}
-
-void InputHandler::dispatchMessage(CMessage *msg) {
-	Gfx::VisualItem *view = _game->getView();
-	if (view)
-		msg->execute(view);
-}
-
-} // End of namespace Shared
-} // End of namespace Ultima
diff --git a/engines/ultima/u1shared/engine/input_handler.h b/engines/ultima/u1shared/engine/input_handler.h
deleted file mode 100644
index a8580cb2483..00000000000
--- a/engines/ultima/u1shared/engine/input_handler.h
+++ /dev/null
@@ -1,78 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-#ifndef ULTIMA_SHARED_ENGINE_INPUT_HANDLER_H
-#define ULTIMA_SHARED_ENGINE_INPUT_HANDLER_H
-
-#include "ultima/u1shared/engine/input_translator.h"
-#include "ultima/u1shared/core/tree_item.h"
-
-namespace Ultima {
-namespace Shared {
-
-class GameBase;
-
-class InputHandler {
-private:
-	/**
-	 * Process and dispatch a passed message
-	 */
-	void processMessage(CMessage *msg);
-
-	/**
-	 * Dispatches a message to the project
-	 */
-	void dispatchMessage(CMessage *msg);
-public:
-	GameBase *_game;
-	InputTranslator *_inputTranslator;
-	bool _dragging;
-	bool _buttonDown;
-	Point _mousePos;
-	Point _dragStartPos;
-	int _lockCount;
-	bool _abortMessage;
-public:
-	InputHandler(GameBase *game);
-	~InputHandler();
-
-	void setTranslator(InputTranslator *translator);
-
-	/**
-	 * Increment the lock count
-	 */
-	void incLockCount();
-
-	/**
-	 * Decrement the lock count on the input handler
-	 */
-	void decLockCount();
-
-	/**
-	 * Handles a genereated mouse message
-	 */
-	void handleMessage(CMessage &msg, bool respectLock = true);
-};
-
-} // End of namespace Shared
-} // End of namespace Ultima
-
-#endif
diff --git a/engines/ultima/u1shared/engine/input_translator.cpp b/engines/ultima/u1shared/engine/input_translator.cpp
deleted file mode 100644
index 8fd536d5d98..00000000000
--- a/engines/ultima/u1shared/engine/input_translator.cpp
+++ /dev/null
@@ -1,123 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-#include "ultima/u1shared/engine/input_handler.h"
-#include "ultima/u1shared/engine/input_translator.h"
-#include "ultima/u1shared/engine/events.h"
-#include "ultima/u1shared/engine/messages.h"
-#include "ultima/u1shared/early/ultima_early.h"
-
-namespace Ultima {
-namespace Shared {
-
-InputTranslator::InputTranslator(InputHandler *inputHandler) :
-	_inputHandler(inputHandler) {
-	inputHandler->setTranslator(this);
-}
-
-int InputTranslator::getButtons(int special) const {
-	int buttons = 0;
-	if (special & MK_LBUTTON)
-		buttons |= MB_LEFT;
-	if (special & MK_MBUTTON)
-		buttons |= MB_MIDDLE;
-	if (special & MK_RBUTTON)
-		buttons |= MB_RIGHT;
-
-	return buttons;
-}
-
-void InputTranslator::mouseMove(int special, const Point &pt) {
-	CMouseMoveMsg msg(pt, getButtons(special));
-	_inputHandler->handleMessage(msg);
-}
-
-void InputTranslator::mouseDrag(int special, const Point &pt) {
-	CMouseDragMsg msg(pt, getButtons(special));
-	_inputHandler->handleMessage(msg);
-}
-
-void InputTranslator::leftButtonDown(int special, const Point &pt) {
-	CMouseButtonDownMsg msg(pt, MB_LEFT);
-	_inputHandler->handleMessage(msg);
-}
-
-void InputTranslator::leftButtonUp(int special, const Point &pt) {
-	CMouseButtonUpMsg msg(pt, MB_LEFT);
-	_inputHandler->handleMessage(msg);
-}
-
-void InputTranslator::leftButtonDoubleClick(int special, const Point &pt) {
-	CMouseDoubleClickMsg msg(pt, MB_LEFT);
-	_inputHandler->handleMessage(msg);
-}
-
-void InputTranslator::middleButtonDown(int special, const Point &pt) {
-	CMouseButtonDownMsg msg(pt, MB_MIDDLE);
-	_inputHandler->handleMessage(msg);
-}
-
-void InputTranslator::middleButtonUp(int special, const Point &pt) {
-	CMouseButtonUpMsg msg(pt, MB_MIDDLE);
-	_inputHandler->handleMessage(msg);
-}
-
-void InputTranslator::middleButtonDoubleClick(int special, const Point &pt) {
-	CMouseDoubleClickMsg msg(pt, MB_MIDDLE);
-	_inputHandler->handleMessage(msg);
-}
-
-void InputTranslator::rightButtonDown(int special, const Point &pt) {
-	CMouseButtonDownMsg msg(pt, MB_RIGHT);
-	_inputHandler->handleMessage(msg);
-}
-
-void InputTranslator::rightButtonUp(int special, const Point &pt) {
-	CMouseButtonUpMsg msg(pt, MB_RIGHT);
-	_inputHandler->handleMessage(msg);
-}
-
-void InputTranslator::mouseWheel(bool wheelUp, const Point &pt) {
-	CMouseWheelMsg msg(pt, wheelUp);
-	_inputHandler->handleMessage(msg);
-}
-
-void InputTranslator::rightButtonDoubleClick(int special, const Point &pt) {
-	CMouseDoubleClickMsg msg(pt, MB_RIGHT);
-	_inputHandler->handleMessage(msg);
-}
-
-void InputTranslator::keyDown(const Common::KeyState &keyState) {
-	CKeypressMsg pressMsg(keyState);
-	_inputHandler->handleMessage(pressMsg);
-
-	if (keyState.ascii >= 32 && keyState.ascii <= 127) {
-		CKeyCharMsg charMsg(keyState.ascii);
-		_inputHandler->handleMessage(charMsg);
-	}
-}
-
-bool InputTranslator::isMousePressed() const {
-	return g_vm->_events->getSpecialButtons() & (MK_LBUTTON | MK_RBUTTON | MK_MBUTTON);
-}
-
-} // End of namespace Shared
-} // End of namespace Ultima
diff --git a/engines/ultima/u1shared/engine/input_translator.h b/engines/ultima/u1shared/engine/input_translator.h
deleted file mode 100644
index 882ae236b63..00000000000
--- a/engines/ultima/u1shared/engine/input_translator.h
+++ /dev/null
@@ -1,67 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-#ifndef ULTIMA_SHARED_ENGINE_INPUT_TRANSLATOR_H
-#define ULTIMA_SHARED_ENGINE_INPUT_TRANSLATOR_H
-
-#include "common/keyboard.h"
-#include "ultima/u1shared/engine/messages.h"
-
-namespace Ultima {
-namespace Shared {
-
-class InputHandler;
-
-class InputTranslator {
-private:
-	/**
-	 * Converts the special buttons bitset into a buttons bitset
-	 */
-	int getButtons(int special) const;
-public:
-	InputHandler *_inputHandler;
-public:
-	InputTranslator(InputHandler *inputHandler);
-
-	void mouseMove(int special, const Point &pt);
-	void mouseDrag(int special, const Point &pt);
-	void leftButtonDown(int special, const Point &pt);
-	void leftButtonUp(int special, const Point &pt);
-	void leftButtonDoubleClick(int special, const Point &pt);
-	void middleButtonDown(int special, const Point &pt);
-	void middleButtonUp(int special, const Point &pt);
-	void middleButtonDoubleClick(int special, const Point &pt);
-	void rightButtonDown(int special, const Point &pt);
-	void rightButtonUp(int special, const Point &pt);
-	void mouseWheel(bool wheelUp, const Point &pt);
-	void rightButtonDoubleClick(int special, const Point &pt);
-	void keyDown(const Common::KeyState &keyState);
-
-	/**
-	 * Returns true if any mouse button is currently pressed
-	 */
-	bool isMousePressed() const;
-};
-
-} // End of namespace Shared
-} // End of namespace Ultima
-
-#endif
diff --git a/engines/ultima/u1shared/engine/messages.cpp b/engines/ultima/u1shared/engine/messages.cpp
deleted file mode 100644
index d3f844206c8..00000000000
--- a/engines/ultima/u1shared/engine/messages.cpp
+++ /dev/null
@@ -1,121 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-#include "ultima/u1shared/engine/messages.h"
-#include "ultima/u1shared/early/ultima_early.h"
-#include "ultima/u1shared/early/game_base.h"
-#include "ultima/u1shared/gfx/screen.h"
-#include "ultima/u1shared/early/game.h"
-
-namespace Ultima {
-namespace Shared {
-
-CMessage::CMessage() : BaseObject() {
-}
-
-bool CMessage::execute(TreeItem *target, const ClassDef *classDef, int flags) {
-	// If no target was specified, then there's nothing to do
-	if (!target)
-		return false;
-
-	bool result = false;
-	TreeItem *item = target;
-	TreeItem *nextItem = nullptr;
-	do {
-		if (flags & MSGFLAG_SCAN)
-			nextItem = item->scan(target);
-
-		if (!classDef || item->isInstanceOf(*classDef)) {
-			bool handled = perform(item);
-
-			if (handled) {
-				result = true;
-				if (flags & MSGFLAG_BREAK_IF_HANDLED)
-					return true;
-			}
-		}
-
-		item = nextItem;
-	} while (nextItem);
-
-	return result;
-}
-
-bool CMessage::execute(const Common::String &target, const ClassDef *classDef, int flags) {
-	// Scan for the target by name
-	GameBase *game = g_vm->_game;
-	for (TreeItem *treeItem = game; treeItem; treeItem = treeItem->scan(game)) {
-		if (!treeItem->getName().compareToIgnoreCase(target))
-			return execute(treeItem, classDef, flags);
-	}
-
-	return false;
-}
-
-const MSGMAP_ENTRY *CMessage::findMapEntry(const TreeItem *treeItem, const ClassDef &classDef) {
-	// Iterate through the class and any parent classes
-	for (const MSGMAP *msgMap = treeItem->getMessageMap(); msgMap->pFnGetBaseMap;
-		msgMap = msgMap->pFnGetBaseMap()) {
-		// Iterate through the map entries for this class
-		for (const MSGMAP_ENTRY *entry = msgMap->lpEntries;
-			entry->_classDef != nullptr; ++entry) {
-			// Check if the class or any of it's ancesotrs is handled by this entry
-			for (ClassDef def = (*entry->_classDef)(); def.hasParent(); def = def.parent()) {
-				if (def == classDef)
-					return entry;
-			}
-		}
-	}
-
-	return nullptr;
-}
-
-bool CMessage::perform(TreeItem *treeItem) {
-	const MSGMAP_ENTRY *entry = findMapEntry(treeItem, getType());
-	return entry && (*treeItem.*(entry->_fn))(this);
-}
-
-bool CMessage::supports(const TreeItem *treeItem, const ClassDef &classDef) {
-	return findMapEntry(treeItem, classDef) != nullptr;
-}
-
-bool CMessage::isMouseMsg() const {
-	return dynamic_cast<const CMouseMsg *>(this) != nullptr;
-}
-
-bool CMessage::isButtonDownMsg() const {
-	return dynamic_cast<const CMouseButtonDownMsg *>(this) != nullptr;
-}
-
-bool CMessage::isButtonUpMsg() const {
-	return dynamic_cast<const CMouseButtonUpMsg *>(this) != nullptr;
-}
-
-bool CMessage::isMouseMoveMsg() const {
-	return dynamic_cast<const CMouseMoveMsg *>(this) != nullptr;
-}
-
-bool CMessage::isDoubleClickMsg() const {
-	return dynamic_cast<const CMouseDoubleClickMsg *>(this) != nullptr;
-}
-
-} // End of namespace Shared
-} // End of namespace Ultima
diff --git a/engines/ultima/u1shared/engine/messages.h b/engines/ultima/u1shared/engine/messages.h
deleted file mode 100644
index 4a359d027ef..00000000000
--- a/engines/ultima/u1shared/engine/messages.h
+++ /dev/null
@@ -1,407 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-#ifndef ULTIMA_SHARED_ENGINE_MESSAGES_H
-#define ULTIMA_SHARED_ENGINE_MESSAGES_H
-
-#include "common/keyboard.h"
-#include "common/events.h"
-#include "ultima/u1shared/core/rect.h"
-#include "ultima/u1shared/core/base_object.h"
-#include "ultima/u1shared/core/tree_item.h"
-
-namespace Ultima {
-namespace Shared {
-
-enum MessageFlag {
-	MSGFLAG_SCAN = 1,
-	MSGFLAG_BREAK_IF_HANDLED = 2,
-	MSGFLAG_CLASS_DEF = 4
-};
-
-class CMessage;
-namespace Gfx {
-class VisualItem;
-class TextInput;
-class Popup;
-}
-
-#define MESSAGEDEF(theClass) \
-	static ClassDef type() { return ClassDef(#theClass, &CMessage::type); } \
-	virtual ClassDef getType() const { return type(); }
-#define MESSAGEDEFP(theClass, baseClass) \
-	static ClassDef type() { return ClassDef(#theClass, &baseClass::type); } \
-	virtual ClassDef getType() const { return type(); }
-
-#define MESSAGE0(NAME) \
-	class NAME: public CMessage { \
-	public: NAME() : CMessage() {} \
-	MESSAGEDEF(NAME); \
-	}
-#define MESSAGE1(NAME, F1, N1, V1) \
-	class NAME: public CMessage { \
-	public: F1 _##N1; \
-	NAME(F1 N1 = V1) : CMessage(), _##N1(N1) {} \
-	MESSAGEDEF(NAME); \
-	}
-#define MESSAGE2(NAME, F1, N1, V1, F2, N2, V2) \
-	class NAME: public CMessage { \
-	public: F1 _##N1; F2 _##N2; \
-	NAME(F1 N1 = V1, F2 N2 = V2) : CMessage(), _##N1(N1), _##N2(N2) {} \
-	MESSAGEDEF(NAME); \
-	}
-#define MESSAGE3(NAME, F1, N1, V1, F2, N2, V2, F3, N3, V3) \
-	class NAME: public CMessage { \
-	public: F1 _##N1; F2 _##N2; F3 _##N3; \
-	NAME(F1 N1 = V1, F2 N2 = V2, F3 N3 = V3) : CMessage(), _##N1(N1), _##N2(N2), _##N3(N3) {} \
-	MESSAGEDEF(NAME); \
-	}
-#define MESSAGE4(NAME, F1, N1, V1, F2, N2, V2, F3, N3, V3, F4, N4, V4) \
-	class NAME: public CMessage { \
-	public: F1 _##N1; F2 _##N2; F3 _##N3; F4 _##N4; \
-	NAME(F1 N1 = V1, F2 N2 = V2, F3 N3 = V3, F4 N4 = V4) : CMessage(), _##N1(N1), _##N2(N2), _##N3(N3), _##N4(N4) {} \
-	MESSAGEDEF(NAME); \
-	}
-
-/**
- * Base class for all messages
- */
-class CMessage : public BaseObject {
-private:
-	/**
-	 * Find a map entry that supports the given class
-	 */
-	static const MSGMAP_ENTRY *findMapEntry(const TreeItem *treeItem, const ClassDef &classDef);
-public:
-	MESSAGEDEFP(CMessage, BaseObject);
-	CMessage();
-
-	/**
-	 * Executes the message, passing it on to the designated target,
-	 * and optionally it's children
-	 */
-	bool execute(TreeItem *target, const ClassDef *classDef = nullptr,
-		int flags = MSGFLAG_SCAN | MSGFLAG_BREAK_IF_HANDLED);
-
-	/**
-	 * Executes the message, passing it on to the designated target,
-	 * and optionally it's children
-	 */
-	bool execute(const Common::String &target, const ClassDef *classDef = nullptr,
-		int flags = MSGFLAG_SCAN | MSGFLAG_BREAK_IF_HANDLED);
-
-	/**
-	 * Makes the passed item execute the message
-	 */
-	virtual bool perform(TreeItem *treeItem);
-
-	/**
-	 * Returns true if the passed item supports the specified message class
-	 */
-	static bool supports(const TreeItem *treeItem, const ClassDef &classDef);
-
-	virtual bool isMouseMsg() const;
-	virtual bool isButtonDownMsg() const;
-	virtual bool isButtonUpMsg() const;
-	virtual bool isMouseMoveMsg() const;
-	virtual bool isDoubleClickMsg() const;
-};
-
-
-enum CMouseButton {
-	MB_LEFT = 1, MB_MIDDLE = 2, MB_RIGHT = 4
-};
-
-/**
- * Base class for the different mouse notifications
- */
-class CMouseMsg : public CMessage {
-public:
-	int _buttons;
-	Point _mousePos;
-public:
-	MESSAGEDEF(CMouseMsg);
-
-	CMouseMsg() : _buttons(0) {}
-	CMouseMsg(const Point &pt, int buttons) :
-		_mousePos(pt), _buttons(buttons) {}
-};
-
-/**
- * Notifies a mouse movement
- *
- */
-class CMouseMoveMsg : public CMouseMsg {
-public:
-	MESSAGEDEFP(CMouseMoveMsg, CMouseMsg);
-	CMouseMoveMsg() : CMouseMsg() {}
-	CMouseMoveMsg(const Point &pt, int buttons) : CMouseMsg(pt, buttons) {}
-};
-
-/**
- * Notifies of a mouse drag operation
- */
-class CMouseDragMsg : public CMouseMoveMsg {
-public:
-	MESSAGEDEFP(CMouseDragMsg, CMouseMoveMsg);
-	CMouseDragMsg() : CMouseMoveMsg() {}
-	CMouseDragMsg(const Point &pt, int buttons) : CMouseMoveMsg(pt, buttons) {}
-};
-
-/**
- * Base class for mouse button notifications
- */
-class CMouseButtonMsg : public CMouseMsg {
-public:
-	MESSAGEDEFP(CMouseButtonMsg, CMouseMsg);
-	CMouseButtonMsg() : CMouseMsg() {}
-	CMouseButtonMsg(const Point &pt, int buttons) : CMouseMsg(pt, buttons) {}
-};
-
-/**
- * Notifies a mouse button down
- */
-class CMouseButtonDownMsg : public CMouseButtonMsg {
-public:
-	MESSAGEDEFP(CMouseButtonDownMsg, CMouseButtonMsg);
-	CMouseButtonDownMsg() : CMouseButtonMsg() {}
-	CMouseButtonDownMsg(const Point &pt, int buttons) : CMouseButtonMsg(pt, buttons) {}
-};
-
-/**
- * Notifies a mouse button release
- */
-class CMouseButtonUpMsg : public CMouseButtonMsg {
-public:
-	MESSAGEDEFP(CMouseButtonUpMsg, CMouseButtonMsg);
-	CMouseButtonUpMsg() : CMouseButtonMsg() {}
-	CMouseButtonUpMsg(const Point &pt, int buttons) : CMouseButtonMsg(pt, buttons) {}
-};
-
-/**
- * Notifies a mouse wheel action
- */
-class CMouseWheelMsg : public CMouseMsg {
-public:
-	bool _wheelUp;
-public:
-	MESSAGEDEFP(CMouseWheelMsg, CMouseMsg);
-	CMouseWheelMsg() : CMouseMsg(), _wheelUp(false) {}
-	CMouseWheelMsg(const Point &pt, bool wheelUp) :
-		CMouseMsg(pt, 0), _wheelUp(wheelUp) {}
-};
-
-/**
- * Notifies a mouse double-click
- */
-class CMouseDoubleClickMsg : public CMouseButtonMsg {
-public:
-	MESSAGEDEFP(CMouseDuobleClickMsg, CMouseButtonMsg);
-	CMouseDoubleClickMsg() : CMouseButtonMsg() {}
-	CMouseDoubleClickMsg(const Point &pt, int buttons) : CMouseButtonMsg(pt, buttons) {}
-};
-
-/**
- * Used to notify that a rendering frame has finished, occurring at GAME_FRAME_RATE times every second
- */
-MESSAGE1(CFrameMsg, uint, ticks, 0);
-
-/**
- * Notifies a game view is being hidden
- */
-MESSAGE2(CHideMsg, Gfx::VisualItem *, view, (Gfx::VisualItem *)nullptr, bool, fadeOut, false);
-
-/**
- * Show a prompt in the info area, and get a keypress for a command
- */
-MESSAGE1(CInfoGetCommandKeypress, TreeItem *, responder, (TreeItem *)nullptr);
-
-/**
- * Get a keypress in the info area
- */
-MESSAGE1(CInfoGetKeypress, TreeItem *, responder, (TreeItem *)nullptr);
-
-/**
- * Get a text input in the input area
- */
-MESSAGE3(CInfoGetInput, TreeItem *, responder, (TreeItem *)nullptr, bool, isNumeric, false, size_t, maxCharacters, 10);
-
-/**
- * Adds text strings to the info area
- */
-MESSAGE3(CInfoMsg, Common::String, text, "", bool, newLine, true, bool, replaceLine, false);
-
-/**
- * Signals an unknown/unhandled keypress
- */
-MESSAGE0(CHuhMsg);
-
-/**
- * Signals a single standard ASCII keypress
- */
-MESSAGE1(CKeyCharMsg, int, key, 32);
-
-/**
- * Signals a keypress
- */
-MESSAGE1(CKeypressMsg, Common::KeyState, keyState, Common::KeyState());
-
-/**
- * Called when a popup is finally shown
- */
-MESSAGE1(CPopupShownMsg, Gfx::Popup *, view, (Gfx::Popup *)nullptr);
-
-/**
- * Called when a popup is hidden
- */
-MESSAGE1(CPopupHiddenMsg, Gfx::Popup *, view, (Gfx::Popup *)nullptr);
-
-/**
- * Called when a game view is shown
- */
-MESSAGE2(CShowMsg, Gfx::VisualItem *, view, (Gfx::VisualItem *)nullptr, bool, fadeIn, false);
-
-/**
- * Used when text input is finished, to pass the text back to the owning view
- */
-MESSAGE2(CTextInputMsg, Common::String, text, "", bool, escaped, false);
-
-/**
- * Used when character input is finished, to pass the text back to the owning view
- */
-MESSAGE1(CCharacterInputMsg, Common::KeyState, keyState, Common::KeyState());
-
-/*-------------------------------------------------------------------*/
-
-/**
- * Used to trigger a party movement
- */
-MESSAGE1(CMoveMsg, int, direction, 0);
-
-/**
- * Used to trigger an attack
- */
-MESSAGE1(CAttackMsg, int, direction, 0);
-
-/**
- * Used to trigger a board action
- */
-MESSAGE0(CBoardMsg);
-
-/**
- * Used to trigger a cast action
- */
-MESSAGE0(CCastMsg);
-
-/**
- * Climb up or down
- */
-MESSAGE0(CClimbMsg);
-
-/**
- * Used to trigger a drop action
- */
-MESSAGE0(CDropMsg);
-
-/**
- * Used to trigger an Enter action
- */
-MESSAGE0(CEnterMsg);
-
-/**
- * Used to trigger an exit action
- */
-MESSAGE0(CExitTransportMsg);
-
-/**
- * Used to trigger a fire action
- */
-MESSAGE0(CFireMsg);
-
-/**
- * Used to trigger a Get action
- */
-MESSAGE0(CGetMsg);
-
-/**
- * Used to trigger a HyperJump action
- */
-MESSAGE0(CHyperJumpMsg);
-
-/**
- * Used to trigger an inform action
- */
-MESSAGE0(CInformMsg);
-
-/**
- * Used to trigger an open action
- */
-MESSAGE0(COpenMsg);
-
-/**
- * Pass a turn
- */
-MESSAGE0(CPassMsg);
-
-/**
- * Used to trigger a quit (save) action
- */
-MESSAGE0(CQuitMsg);
-
-/**
- * Used to trigger a ready item/weapon/spell action
- */
-MESSAGE0(CReadyMsg);
-
-/**
- * Used to trigger a stats action
- */
-MESSAGE0(CStatsMsg);
-
-/**
- * Used to trigger a steal action
- */
-MESSAGE0(CStealMsg);
-
-/**
- * Used to trigger a Transact action
- */
-MESSAGE0(CTransactMsg);
-
-/**
- * Used to trigger an Unlock action
- */
-MESSAGE0(CUnlockMsg);
-
-/**
- * Used to trigger a view change action
- */
-MESSAGE0(CViewChangeMsg);
-
-/**
- * Used to signal an end of turn
- */
-MESSAGE0(CEndOfTurnMsg);
-
-} // End of namespace Shared
-} // End of namespace Ultima
-
-#endif
diff --git a/engines/ultima/u1shared/engine/resources.cpp b/engines/ultima/u1shared/engine/resources.cpp
deleted file mode 100644
index b8174419a8b..00000000000
--- a/engines/ultima/u1shared/engine/resources.cpp
+++ /dev/null
@@ -1,265 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-#include "ultima/u1shared/engine/resources.h"
-#include "ultima/u1shared/early/font_resources.h"
-#include "common/endian.h"
-
-#ifndef RELEASE_BUILD
-#include "ultima/ultima1/core/resources.h"
-#endif
-
-namespace Ultima {
-namespace Shared {
-
-/*-------------------------------------------------------------------*/
-
-bool Resources::open() {
-	// Save locally constructred resources to the archive manager for access
-	Shared::FontResources sharedFonts(this);
-	sharedFonts.save();
-#ifndef RELEASE_BUILD
-	Ultima1::GameResources u1Data(this);
-	u1Data.save();
-#endif
-
-	return true;
-}
-
-void Resources::addResource(const Common::Path &name, const byte *data, size_t size) {
-	// Add a new entry to the local resources list for the passed data
-	_localResources.push_back(LocalResource());
-	LocalResource &lr = _localResources[_localResources.size() - 1];
-
-	lr._name = name;
-	lr._data.resize(size);
-	Common::copy(data, data + size, &lr._data[0]);
-}
-
-bool Resources::hasFile(const Common::Path &path) const {
-	for (uint idx = 0; idx < _localResources.size(); ++idx)
-		if (_localResources[idx]._name.equalsIgnoreCase(path))
-			return true;
-
-	return false;
-}
-
-int Resources::listMembers(Common::ArchiveMemberList &list) const {
-	for (uint idx = 0; idx < _localResources.size(); ++idx) {
-		list.push_back(Common::ArchiveMemberPtr(new Common::GenericArchiveMember(_localResources[idx]._name, *this)));
-	}
-
-	return _localResources.size();
-}
-
-const Common::ArchiveMemberPtr Resources::getMember(const Common::Path &path) const {
-	if (!hasFile(path))
-		return Common::ArchiveMemberPtr();
-
-	return Common::ArchiveMemberPtr(new Common::GenericArchiveMember(path, *this));
-}
-
-Common::SeekableReadStream *Resources::createReadStreamForMember(const Common::Path &path) const {
-	for (uint idx = 0; idx < _localResources.size(); ++idx) {
-		const LocalResource &lr = _localResources[idx];
-		if (lr._name.equalsIgnoreCase(path))
-			return new Common::MemoryReadStream(&lr._data[0], lr._data.size());
-	}
-
-	return nullptr;
-}
-
-/*-------------------------------------------------------------------*/
-
-void Resources::FileResource::load(File &f) {
-	_name = f.readString();
-	_offset = f.readUint32LE();
-	_size = f.readUint16LE();
-}
-
-/*-------------------------------------------------------------------*/
-
-ResourceFile::ResourceFile(const Common::Path &filename) : _filename(filename), _bufferP(_buffer) {
-	Common::fill(_buffer, _buffer + STRING_BUFFER_SIZE, 0);
-}
-
-void ResourceFile::load() {
-	_file.open(_filename);
-	synchronize();
-	_file.close();
-}
-
-void ResourceFile::syncString(const char *&str) {
-	str = _bufferP;
-	do {
-		*_bufferP = _file.readByte();
-	} while (*_bufferP++);
-
-	assert(_bufferP < (_buffer + STRING_BUFFER_SIZE));
-}
-
-void ResourceFile::syncStrings(const char **str, size_t count) {
-	uint tag = _file.readUint32LE();
-	assert(tag == MKTAG(count, 0, 0, 0));
-
-	for (size_t idx = 0; idx < count; ++idx)
-		syncString(str[idx]);
-}
-
-void ResourceFile::syncStrings2D(const char **str, size_t count1, size_t count2) {
-	uint tag = _file.readUint32LE();
-	assert(tag == MKTAG(count1, count2, 0, 0));
-
-	for (size_t idx = 0; idx < count1 * count2; ++idx)
-		syncString(str[idx]);
-}
-
-void ResourceFile::syncNumber(int &val) {
-	val = _file.readSint32LE();
-}
-
-void ResourceFile::syncNumbers(int *vals, size_t count) {
-	uint tag = _file.readUint32LE();
-	assert(tag == MKTAG(count, 0, 0, 0));
-	for (size_t idx = 0; idx < count; ++idx)
-		vals[idx] = _file.readSint32LE();
-}
-
-void ResourceFile::syncNumbers2D(int *vals, size_t count1, size_t count2) {
-	uint tag = _file.readUint32LE();
-	assert(tag == MKTAG(count1, count2, 0, 0));
-	for (size_t idx = 0; idx < count1 * count2; ++idx)
-		vals[idx] = _file.readSint32LE();
-}
-
-void ResourceFile::syncNumbers3D(int *vals, size_t count1, size_t count2, size_t count3) {
-	uint tag = _file.readUint32LE();
-	assert(tag == MKTAG(count1, count2, count3, 0));
-	for (size_t idx = 0; idx < count1 * count2 * count3; ++idx)
-		vals[idx] = _file.readSint32LE();
-}
-
-void ResourceFile::syncBytes(byte *vals, size_t count) {
-	uint tag = _file.readUint32LE();
-	assert(tag == MKTAG(count, 0, 0, 0));
-	_file.read(vals, count);
-}
-
-void ResourceFile::syncBytes2D(byte *vals, size_t count1, size_t count2) {
-	uint tag = _file.readUint32LE();
-	assert(tag == MKTAG(count1, count2, 0, 0));
-	_file.read(vals, count1 * count2);
-}
-
-/*-------------------------------------------------------------------*/
-
-void LocalResourceFile::save() {
-	synchronize();
-	_file.finalize();
-	_owner->addResource(_filename, _file.getData(), _file.size());
-}
-
-void LocalResourceFile::syncString(const char *&str) {
-	if (!_owner) {
-		ResourceFile::syncString(str);
-	} else {
-		_file.writeString(str);
-		_file.writeByte('\0');
-	}
-}
-
-void LocalResourceFile::syncStrings(const char **str, size_t count) {
-	if (!_owner) {
-		ResourceFile::syncStrings(str, count);
-	} else {
-		_file.writeUint32LE(MKTAG(count, 0, 0, 0));
-		for (size_t idx = 0; idx < count; ++idx)
-			syncString(str[idx]);
-	}
-}
-
-void LocalResourceFile::syncStrings2D(const char **str, size_t count1, size_t count2) {
-	if (!_owner) {
-		ResourceFile::syncStrings2D(str, count1, count2);
-	} else {
-		_file.writeUint32LE(MKTAG(count1, count2, 0, 0));
-		for (size_t idx = 0; idx < count1 * count2; ++idx)
-			syncString(str[idx]);
-	}
-}
-
-void LocalResourceFile::syncNumber(int &val) {
-	if (!_owner)
-		ResourceFile::syncNumber(val);
-	else
-		_file.writeUint32LE(val);
-}
-
-void LocalResourceFile::syncNumbers(int *vals, size_t count) {
-	if (!_owner) {
-		ResourceFile::syncNumbers(vals, count);
-	} else {
-		_file.writeUint32LE(MKTAG(count, 0, 0, 0));
-		for (size_t idx = 0; idx < count; ++idx)
-			_file.writeUint32LE(vals[idx]);
-	}
-}
-
-void LocalResourceFile::syncNumbers2D(int *vals, size_t count1, size_t count2) {
-	if (!_owner) {
-		ResourceFile::syncNumbers2D(vals, count1, count2);
-	} else {
-		_file.writeUint32LE(MKTAG(count1, count2, 0, 0));
-		for (size_t idx = 0; idx < count1 * count2; ++idx)
-			_file.writeUint32LE(vals[idx]);
-	}
-}
-
-void LocalResourceFile::syncNumbers3D(int *vals, size_t count1, size_t count2, size_t count3) {
-	if (!_owner) {
-		ResourceFile::syncNumbers3D(vals, count1, count2, count3);
-	} else {
-		_file.writeUint32LE(MKTAG(count1, count2, count3, 0));
-		for (size_t idx = 0; idx < count1 * count2 * count3; ++idx)
-			_file.writeUint32LE(vals[idx]);
-	}
-}
-
-void LocalResourceFile::syncBytes(byte *vals, size_t count) {
-	if (!_owner) {
-		ResourceFile::syncBytes(vals, count);
-	} else {
-		_file.writeUint32LE(MKTAG(count, 0, 0, 0));
-		_file.write(vals, count);
-	}
-}
-
-void LocalResourceFile::syncBytes2D(byte *vals, size_t count1, size_t count2) {
-	if (!_owner) {
-		ResourceFile::syncBytes2D(vals, count1, count2);
-	} else {
-		_file.writeUint32LE(MKTAG(count1, count2, 0, 0));
-		_file.write(vals, count1 * count2);
-	}
-}
-
-} // End of namespace Shared
-} // End of namespace Ultima
diff --git a/engines/ultima/u1shared/engine/resources.h b/engines/ultima/u1shared/engine/resources.h
deleted file mode 100644
index 87f11511466..00000000000
--- a/engines/ultima/u1shared/engine/resources.h
+++ /dev/null
@@ -1,196 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-#ifndef ULTIMA_SHARED_ENGINE_RESOURCES_H
-#define ULTIMA_SHARED_ENGINE_RESOURCES_H
-
-#include "common/algorithm.h"
-#include "common/archive.h"
-#include "common/array.h"
-#include "common/memstream.h"
-#include "common/str.h"
-#include "common/serializer.h"
-#include "ultima/u1shared/core/file.h"
-
-#define STRING_BUFFER_SIZE 32768
-
-namespace Ultima {
-namespace Shared {
-
-class Resources;
-
-/**
- * Base class for classes that exposes a set of strings, arrays, and other data from a resource
- */
-class ResourceFile {
-private:
-	File _file;
-	char _buffer[STRING_BUFFER_SIZE];
-	char *_bufferP;
-protected:
-	Common::Path _filename;
-protected:
-	/**
-	 * Constructor
-	 */
-	ResourceFile(const Common::Path &filename);
-
-	/**
-	 * Destructor
-	 */
-	virtual ~ResourceFile() {
-	}
-
-	/**
-	 * Synchronizes the data for the resource
-	 */
-	virtual void synchronize() = 0;
-
-	virtual void syncString(const char *&str);
-	virtual void syncStrings(const char **str, size_t count);
-	virtual void syncStrings2D(const char **str, size_t count1, size_t count2);
-	virtual void syncNumber(int &val);
-	virtual void syncNumbers(int *vals, size_t count);
-	virtual void syncNumbers2D(int *vals, size_t count1, size_t count2);
-	virtual void syncNumbers3D(int *vals, size_t count1, size_t count2, size_t count3);
-	virtual void syncBytes(byte *vals, size_t count);
-	virtual void syncBytes2D(byte *vals, size_t count1, size_t count2);
-public:
-	/**
-	 * Loads in a resource
-	 */
-	void load();
-};
-
-/**
- * Derived base class for resources that have their contents within the executable rather than a data file.
- * This will allow the data for a particular Ultima game to be gradually built up without repeatedly
- * regenerating a data file. Once a game has been properly tested, then it can be moved out.
- */
-class LocalResourceFile : public ResourceFile {
-private:
-	Common::MemoryWriteStreamDynamic _file;
-	Resources *_owner;
-protected:
-	/**
-	 * Constructor
-	 */
-	LocalResourceFile(const Common::Path &filename) : ResourceFile(filename), _owner(nullptr), _file(DisposeAfterUse::YES) {}
-
-	/**
-	 * Constructor
-	 */
-	LocalResourceFile(Resources *owner, const Common::Path &filename) : ResourceFile(filename),
-		_owner(owner), _file(DisposeAfterUse::YES) {}
-
-	/**
-	 * Return true if in saving mode
-	 */
-	bool isSaving() const { return _owner != nullptr; }
-
-	void syncString(const char *&str) override;
-	void syncStrings(const char **str, size_t count) override;
-	void syncStrings2D(const char **str, size_t count1, size_t count2) override;
-	void syncNumber(int &val) override;
-	void syncNumbers(int *vals, size_t count) override;
-	void syncNumbers2D(int *vals, size_t count1, size_t count2) override;
-	void syncNumbers3D(int *vals, size_t count1, size_t count2, size_t count3) override;
-	void syncBytes(byte *vals, size_t count) override;
-	void syncBytes2D(byte *vals, size_t count1, size_t count2) override;
-public:
-	/**
-	 * Write out the resource to the in-memory resource store
-	 */
-	void save();
-};
-
-/**
- * Resources manager
- */
-class Resources : public Common::Archive {
-	struct LocalResource {
-		Common::Path _name;
-		Common::Array<byte> _data;
-	};
-	struct FileResource {
-		Common::Path _name;
-		size_t _offset, _size;
-
-		/**
-		 * Load an index entry from the datafile
-		 */
-		void load(File &f);
-	};
-private:
-	Common::Array<LocalResource> _localResources;
-public:
-	/**
-	 * Constructor
-	 */
-	Resources() {
-	}
-
-	/**
-	 * Sets up the resources for the engine
-	 * @returns		False if setup failed
-	 */
-	bool open();
-
-	/**
-	 * Adds a resource created in memory to the ScummVM archive manager, so that it can be
-	 * later opened like a normal file. Just as it will when eventually shifted to the
-	 * data file for the engine
-	 */
-	void addResource(const Common::Path &name, const byte *data, size_t size);
-
-	// Archive implementation
-	/**
-	 * Check if a member with the given name is present in the Archive.
-	 * Patterns are not allowed, as this is meant to be a quick File::exists()
-	 * replacement.
-	 */
-	bool hasFile(const Common::Path &path) const  override;
-
-	/**
-	 * Add all members of the Archive to list.
-	 * Must only append to list, and not remove elements from it.
-	 *
-	 * @return the number of names added to list
-	 */
-	int listMembers(Common::ArchiveMemberList &list) const  override;
-
-	/**
-	 * Returns a ArchiveMember representation of the given file.
-	 */
-	const Common::ArchiveMemberPtr getMember(const Common::Path &path) const  override;
-
-	/**
-	 * Create a stream bound to a member with the specified name in the
-	 * archive. If no member with this name exists, 0 is returned.
-	 * @return the newly created input stream
-	 */
-	Common::SeekableReadStream *createReadStreamForMember(const Common::Path &path) const  override;
-};
-
-} // End of namespace Shared
-} // End of namespace Ultima
-
-#endif
diff --git a/engines/ultima/u1shared/gfx/bitmap.cpp b/engines/ultima/u1shared/gfx/bitmap.cpp
deleted file mode 100644
index 7db52fec396..00000000000
--- a/engines/ultima/u1shared/gfx/bitmap.cpp
+++ /dev/null
@@ -1,66 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-#include "ultima/u1shared/gfx/bitmap.h"
-#include "ultima/u1shared/core/file.h"
-#include "common/memstream.h"
-#include "graphics/managed_surface.h"
-
-namespace Ultima {
-namespace Shared {
-namespace Gfx {
-
-void Bitmap::load(const Common::Path &filename) {
-	File srcFile(filename);
-	Common::MemoryWriteStreamDynamic decompressedFile(DisposeAfterUse::YES);
-	decompress(&srcFile, &decompressedFile);
-
-	// Set the bitmap size
-	Common::MemoryReadStream f(decompressedFile.getData(), decompressedFile.size());
-	int16 xs = f.readSint16LE();
-	int16 ys = f.readSint16LE();
-	create(xs, ys);
-	assert(f.size() == (xs * ys + 4));
-
-	Graphics::Surface s = getSubArea(Common::Rect(0, 0, xs, ys));
-
-	// Read in the lines
-	for (int y = 0; y < ys; ++y) {
-		byte *dest = (byte *)s.getBasePtr(0, y);
-		f.read(dest, xs);
-	}
-}
-
-void Bitmap::flipHorizontally() {
-	Graphics::Surface s = getSubArea(Common::Rect(0, 0, this->w, this->h));
-
-	for (int y = 0; y < h; ++y) {
-		byte *lineStart = (byte *)s.getBasePtr(0, y);
-		byte *lineEnd = (byte *)s.getBasePtr(this->w - 1, y);
-
-		for (int x = 0; x < (this->w - 1) / 2; ++x, ++lineStart, --lineEnd)
-			SWAP(*lineStart, *lineEnd);
-	}
-}
-
-} // End of namespace Gfx
-} // End of namespace Shared
-} // End of namespace Ultima
diff --git a/engines/ultima/u1shared/gfx/bitmap.h b/engines/ultima/u1shared/gfx/bitmap.h
deleted file mode 100644
index 42ba5783782..00000000000
--- a/engines/ultima/u1shared/gfx/bitmap.h
+++ /dev/null
@@ -1,51 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-#ifndef ULTIMA_BITMAP_H
-#define ULTIMA_BITMAP_H
-
-#include "ultima/u1shared/core/lzw.h"
-#include "common/path.h"
-#include "common/stream.h"
-#include "graphics/managed_surface.h"
-
-namespace Ultima {
-namespace Shared {
-namespace Gfx {
-
-class Bitmap : public Graphics::ManagedSurface, public LZW {
-public:
-	/**
-	 * Loads an Ultima 6 bitmap
-	 */
-	void load(const Common::Path &filename);
-
-	/**
-	 * Flips a bitmap horizontally
-	 */
-	void flipHorizontally();
-};
-
-} // End of namespace Gfx
-} // End of namespace Shared
-} // End of namespace Ultima
-
-#endif
diff --git a/engines/ultima/u1shared/gfx/character_input.cpp b/engines/ultima/u1shared/gfx/character_input.cpp
deleted file mode 100644
index 1754f98f909..00000000000
--- a/engines/ultima/u1shared/gfx/character_input.cpp
+++ /dev/null
@@ -1,55 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-#include "ultima/u1shared/gfx/character_input.h"
-#include "ultima/u1shared/gfx/text_cursor.h"
-#include "ultima/u1shared/early/game_base.h"
-#include "ultima/u1shared/engine/messages.h"
-
-namespace Ultima {
-namespace Shared {
-namespace Gfx {
-
-BEGIN_MESSAGE_MAP(CharacterInput, Popup)
-	ON_MESSAGE(KeypressMsg)
-END_MESSAGE_MAP()
-
-void CharacterInput::show(const Point &pt, byte color, TreeItem *respondTo) {
-	Popup::show(respondTo);
-	_color = color;
-	_bounds = Rect(pt.x, pt.y, pt.x + 8, pt.y + 8);
-
-	_game->_textCursor->setPosition(Point(_bounds.left, _bounds.top));
-	_game->_textCursor->setVisible(true);
-}
-
-bool CharacterInput::KeypressMsg(CKeypressMsg *msg) {
-	hide();
-
-	CCharacterInputMsg inputMsg(msg->_keyState);
-	inputMsg.execute(_respondTo);
-
-	return true;
-}
-
-} // End of namespace Gfx
-} // End of namespace Shared
-} // End of namespace Ultima
diff --git a/engines/ultima/u1shared/gfx/character_input.h b/engines/ultima/u1shared/gfx/character_input.h
deleted file mode 100644
index f44f0c13914..00000000000
--- a/engines/ultima/u1shared/gfx/character_input.h
+++ /dev/null
@@ -1,58 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-#ifndef ULTIMA_GFX_CHARACTER_INPUT_H
-#define ULTIMA_GFX_CHARACTER_INPUT_H
-
-#include "ultima/u1shared/gfx/popup.h"
-
-namespace Ultima {
-namespace Shared {
-namespace Gfx {
-
-/**
- * Text input control
- */
-class CharacterInput : public Popup {
-	DECLARE_MESSAGE_MAP;
-	bool KeypressMsg(CKeypressMsg *msg);
-private:
-	byte _color;
-public:
-	CLASSDEF;
-	CharacterInput(GameBase *game) : Popup(game), _color(0) {
-	}
-
-	/**
-	 * Show the character input
-	 * @param pt		Position of the input
-	 * @param color		Text color
-	 * @param respondTo	Where to send response to
-	 * @remarks			Generates a TextInputMsg message with the character when pressed
-	 */
-	void show(const Point &pt, byte color, TreeItem *respondTo = nullptr);
-};
-
-} // End of namespace Gfx
-} // End of namespace Shared
-} // End of namespace Ultima
-
-#endif
diff --git a/engines/ultima/u1shared/gfx/dungeon_surface.cpp b/engines/ultima/u1shared/gfx/dungeon_surface.cpp
deleted file mode 100644
index 6eb0fd09cb4..00000000000
--- a/engines/ultima/u1shared/gfx/dungeon_surface.cpp
+++ /dev/null
@@ -1,195 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-#include "ultima/u1shared/gfx/dungeon_surface.h"
-#include "ultima/u1shared/maps/map.h"
-#include "ultima/u1shared/early/game.h"
-
-namespace Ultima {
-namespace Shared {
-
-const byte ARRAY_X[] = { 0, 72, 108, 126, 135, 144 };
-const byte ARRAY_Y[] = { 0, 36, 54, 63, 68, 72 };
-
-DungeonSurface::DungeonSurface(const Graphics::ManagedSurface &src, const Rect &bounds, Game *game, DrawWidgetFn widgetFn) :
-		Gfx::VisualSurface(src, bounds), _widgetFn(widgetFn) {
-	_edgeColor = game->_edgeColor;
-	_highlightColor = game->_highlightColor;
-	_widgetColor = 0;
-}
-
-void DungeonSurface::drawWall(uint distance) {
-	int offsetX = !distance ? 8 : 0, offsetY = !distance ? 8 : 0;
-
-	if (distance <= 5) {
-		hLine(ARRAY_X[distance] + 16 + offsetX, ARRAY_Y[distance] + 8 + offsetY,
-			303 - ARRAY_X[distance] - offsetX, _edgeColor);
-		hLine(ARRAY_X[distance] + 16 + offsetX, 151 - ARRAY_Y[distance] - offsetY,
-			303 - ARRAY_X[distance] - offsetX, _edgeColor);
-	}
-}
-
-void DungeonSurface::drawDoorway(uint distance) {
-	int offsetY = !distance ? 8 : 0;
-	byte color = !distance ? 0 : _edgeColor;
-
-	if (distance < 5) {
-		drawWall(distance);
-		drawLine(ARRAY_X[distance + 1] + 16, 151 - ARRAY_Y[distance] - offsetY,
-			ARRAY_X[distance + 1] + 16, ARRAY_Y[distance + 1] + 8, _edgeColor);
-		drawLineTo(303 - ARRAY_X[distance + 1], ARRAY_Y[distance + 1] + 8, _edgeColor);
-		drawLineTo(303 - ARRAY_X[distance + 1], 151 - ARRAY_Y[distance] - offsetY, _edgeColor);
-		drawLineTo(ARRAY_X[distance + 1] + 16, 151 - ARRAY_Y[distance] - offsetY, color);
-	}
-}
-
-void DungeonSurface::drawLeftEdge(uint distance) {
-	if (distance <= 5) {
-		vLine(ARRAY_X[distance] + 16, ARRAY_Y[distance] + 8, 151 - ARRAY_Y[distance], _edgeColor);
-	}
-}
-
-void DungeonSurface::drawRightEdge(uint distance) {
-	if (distance <= 5) {
-		vLine(303 - ARRAY_X[distance], ARRAY_Y[distance] + 8, 151 - ARRAY_Y[distance], _edgeColor);
-	}
-}
-
-void DungeonSurface::drawWidget(uint widgetId, uint distance, byte color) {
-	_widgetFn(*this, widgetId, distance, color);
-}
-
-void DungeonSurface::drawLadderDownFaceOn(uint distance) {
-	if (distance <= 5) {
-		drawWidget(27, distance, _edgeColor);
-		drawWidget(28, distance, _edgeColor);
-	}
-}
-
-void DungeonSurface::drawLadderDownSideOn(uint distance) {
-	if (distance <= 5) {
-		drawWidget(27, distance, _edgeColor);
-		drawWidget(29, distance, _edgeColor);
-	}
-}
-
-void DungeonSurface::drawLadderUpFaceOn(uint distance) {
-	if (distance <= 5) {
-		drawWidget(26, distance, _edgeColor);
-		drawWidget(28, distance, _edgeColor);
-	}
-}
-
-void DungeonSurface::drawLadderUpSideOn(uint distance) {
-	if (distance <= 5) {
-		drawWidget(26, distance, _edgeColor);
-		drawWidget(29, distance, _edgeColor);
-	}
-}
-
-void DungeonSurface::drawLeftDoor(uint distance) {
-	if (distance <= 5) {
-		drawLeftWall(distance);
-
-		Point p1(ARRAY_X[distance], ARRAY_Y[distance]),
-			p2(ARRAY_X[distance - 1], ARRAY_Y[distance - 1]);
-		Point diff = p1 - p2;
-		diff.x /= 9;
-		diff.y /= 5;
-
-		drawLine(p2.x + diff.x * 2 + 16, 151 - diff.y - p2.y - 1, p2.x + diff.x * 2 + 16,
-			p1.y + 8 - diff.y, _edgeColor);
-		drawLineTo(p2.x + diff.x * 6 + 16, p1.y + diff.y + 8, _edgeColor);
-		drawLineTo(p2.x + diff.x * 6 + 16, 151 - p1.y + diff.y * 2 - (distance == 1 ? 2 : 0), _edgeColor);
-	}
-}
-
-void DungeonSurface::drawLeftWall(uint distance) {
-	if (distance <= 5) {
-		Point p1(ARRAY_X[distance], ARRAY_Y[distance]),
-			p2(ARRAY_X[distance - 1], ARRAY_Y[distance - 1]);
-		drawLine(p2.x + 16, p2.y + 8, p1.x + 16, p1.y + 8, _edgeColor);
-		drawLine(p2.x + 16, 151 - p2.y, p1.x + 16, 151 - p1.y, _edgeColor);
-	}
-}
-
-void DungeonSurface::drawLeftBlank(uint distance) {
-	if (distance <= 5) {
-		Point p1(ARRAY_X[distance], ARRAY_Y[distance]),
-			p2(ARRAY_X[distance - 1], ARRAY_Y[distance - 1]);
-		drawLine(p2.x + 16, p1.y + 8, p1.x + 16, p1.y + 8, _edgeColor);
-		drawLine(p2.x + 16, 151 - p1.y, p1.x + 16, 151 - p1.y, _edgeColor);
-	}
-}
-
-void DungeonSurface::drawRightDoor(uint distance) {
-	if (distance <= 5) {
-		drawRightWall(distance);
-
-		Point p1(ARRAY_X[distance], ARRAY_Y[distance]),
-			p2(ARRAY_X[distance - 1], ARRAY_Y[distance - 1]);
-		Point diff = p1 - p2;
-		diff.x /= 9;
-		diff.y /= 5;
-
-		drawLine(303 - (p2.x + diff.x * 2), 151 - diff.y - p2.y - 1, 303 - (p2.x + diff.x * 2),
-			p1.y + 8 - diff.y, _edgeColor);
-		drawLineTo(303 - (diff.x * 6 + p2.x), p1.y + 8 + diff.y, _edgeColor);
-		drawLineTo(303 - (diff.x * 6 + p2.x), 151 - p1.y + diff.y * 2 - (distance == 1 ? 2 : 0), _edgeColor);
-	}
-}
-
-void DungeonSurface::drawRightWall(uint distance) {
-	if (distance <= 5) {
-		Point p1(ARRAY_X[distance], ARRAY_Y[distance]),
-			p2(ARRAY_X[distance - 1], ARRAY_Y[distance - 1]);
-
-		drawLine(303 - p2.x, p2.y + 8, 303 - p1.x, p1.y + 8, _edgeColor);
-		drawLine(303 - p2.x, 151 - p2.y, 303 - p1.x, 151 - p1.y, _edgeColor);
-	}
-}
-
-void DungeonSurface::drawRightBlank(uint distance) {
-	if (distance <= 5) {
-		Point p1(ARRAY_X[distance], ARRAY_Y[distance]),
-			p2(ARRAY_X[distance - 1], ARRAY_Y[distance - 1]);
-		drawLine(303 - p2.x, p1.y + 8, 303 - p1.x, p1.y + 8, _edgeColor);
-		drawLine(303 - p2.x, 151 - p1.y, 303 - p1.x, 151 - p1.y, _edgeColor);
-	}
-}
-
-void DungeonSurface::drawBeams(uint distance) {
-	if (distance <= 5) {
-		// Figure out the Y difference between each beam
-		const int Y_START = ARRAY_Y[distance] + 8;
-		const int Y_END = 151 - ARRAY_Y[distance];
-		const int HEIGHT = (Y_END - Y_START) / 4;
-
-		for (int beamNum = 0; beamNum < 4; ++beamNum) {
-			const int YP = Y_START + HEIGHT * beamNum + (distance / 2);
-
-			drawLine(ARRAY_X[distance] + 16, YP, 303 - ARRAY_X[distance], YP, _highlightColor);
-		}
-	}
-}
-
-} // End of namespace Shared
-} // End of namespace Ultima
diff --git a/engines/ultima/u1shared/gfx/dungeon_surface.h b/engines/ultima/u1shared/gfx/dungeon_surface.h
deleted file mode 100644
index 2ce4067084d..00000000000
--- a/engines/ultima/u1shared/gfx/dungeon_surface.h
+++ /dev/null
@@ -1,174 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-#ifndef ULTIMA_SHARED_GFX_DUNGEON_H
-#define ULTIMA_SHARED_GFX_DUNGEON_H
-
-#include "ultima/u1shared/gfx/visual_surface.h"
-
-namespace Ultima {
-namespace Shared {
-
-typedef void(*DrawWidgetFn)(Graphics::ManagedSurface &s, uint widgetId, uint distance, byte color);
-
-class Game;
-
-/**
- * Acts as a handy container for the drawing methods for rendering the dungeon view
- */
-class DungeonSurface : public Gfx::VisualSurface {
-private:
-	Point _penPos;
-	byte _edgeColor;
-	byte _highlightColor;
-	byte _widgetColor;
-	DrawWidgetFn _widgetFn;
-public:
-	/**
-	 * Constructor
-	 */
-	DungeonSurface(const Graphics::ManagedSurface &src, const Rect &bounds, Game *game, DrawWidgetFn widgetFn);
-
-	/**
-	 * Draw a line
-	 */
-	void drawLine(int x0, int y0, int x1, int y1, uint32 color) {
-		Gfx::VisualSurface::drawLine(x0 - 8, y0 - 8, x1 - 8, y1 - 8, color);
-		_penPos = Point(x1, y1);
-	}
-
-	/**
-	 * Draw a line from a prior line ending point to a new destination pos
-	 */
-	void drawLineTo(int x, int y, uint32 color) {
-		Gfx::VisualSurface::drawLine(_penPos.x - 8, _penPos.y - 8, x - 8, y - 8, color);
-		_penPos = Point(x, y);
-	}
-
-	/**
-	 * Draw a horizontal line.
-	 */
-	void hLine(int x, int y, int x2, uint32 color) {
-		Gfx::VisualSurface::hLine(x - 8, y - 8, x2 - 8, color);
-		_penPos = Point(x2, y);
-	}
-
-	/**
-	 * Draw a vertical line.
-	 */
-	void vLine(int x, int y, int y2, uint32 color) {
-		Gfx::VisualSurface::vLine(x - 8, y - 8, y2 - 8, color);
-		_penPos = Point(x, y2);
-	}
-
-	/**
-	 * Draw a frame around a specified rect.
-	 */
-	void frameRect(const Common::Rect &r, uint32 color) {
-		Gfx::VisualSurface::frameRect(Rect(r.left - 8, r.top - 8, r.right - 8, r.bottom - 8), color);
-	}
-
-
-	/**
-	 * Draws a wall
-	 */
-	void drawWall(uint distance);
-
-	/**
-	 * Draws a doorway directly in front of the player
-	 */
-	void drawDoorway(uint distance);
-
-	/**
-	 * Draws a vertical line forming the edge of cells to the left of the player
-	 */
-	void drawLeftEdge(uint distance);
-
-	/**
-	 * Draws a vertical line forming the edge of cells to the right of the player
-	 */
-	void drawRightEdge(uint distance);
-
-	/**
-	 * Draws a monster or item at a given distance from the player
-	 */
-	void drawWidget(uint widgetId, uint distance, byte color);
-
-	/**
-	 * Draw a ladder down face on
-	 */
-	void drawLadderDownFaceOn(uint distance);
-
-	/**
-	 * Draw a ladder down side on
-	 */
-	void drawLadderDownSideOn(uint distance);
-
-	/**
-	 * Draw a ladder down face on
-	 */
-	void drawLadderUpFaceOn(uint distance);
-
-	/**
-	 * Draw a ladder down side on
-	 */
-	void drawLadderUpSideOn(uint distance);
-
-	/**
-	 * Draw beams
-	 */
-	void drawBeams(uint distance);
-
-	/**
-	 * Draws a door on the left hand side
-	 */
-	void drawLeftDoor(uint distance);
-
-	/**
-	 * Draws a wall on the left-hand side
-	 */
-	void drawLeftWall(uint distance);
-
-	/**
-	 * Draws the partial wall visible at the back of a corridor leading to the left
-	 */
-	void drawLeftBlank(uint distance);
-
-	/**
-	 * Draws a door on the right hand side
-	 */
-	void drawRightDoor(uint distance);
-
-	/**
-	 * Draws a wall on the right-hand side
-	 */
-	void drawRightWall(uint distance);
-
-	/**
-	 * Draws the partial wall visible at the back of a corridor leading to the right
-	 */
-	void drawRightBlank(uint distance);
-};
-
-} // End of namespace Shared
-} // End of namespace Ultima
-
-#endif
diff --git a/engines/ultima/u1shared/gfx/font.cpp b/engines/ultima/u1shared/gfx/font.cpp
deleted file mode 100644
index 626a42b94dc..00000000000
--- a/engines/ultima/u1shared/gfx/font.cpp
+++ /dev/null
@@ -1,83 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-#include "ultima/u1shared/gfx/font.h"
-#include "graphics/managed_surface.h"
-
-namespace Ultima {
-namespace Shared {
-namespace Gfx {
-
-Font::Font(const byte *data, size_t startingChar, size_t charCount) :
-	_data(data), _startingChar(startingChar), _endingChar(startingChar + charCount - 1) {}
-
-int Font::writeString(Graphics::ManagedSurface &surface, const Common::String &msg, Point &pt,
-		byte color, byte bgColor) {
-	int total = 0;
-	int xs = pt.x;
-
-	for (const char *msgP = msg.c_str(); *msgP; ++msgP, total += 8) {
-		if (*msgP == '\n') {
-			// Move to next line
-			pt.x = xs;
-			pt.y += lineHeight();
-		} else {
-			// Write out character
-			writeChar(surface, (unsigned char)*msgP, pt, color, bgColor);
-		}
-	}
-
-	return total;
-}
-
-void Font::writeChar(Graphics::ManagedSurface &surface, unsigned char c, Point &pt,
-		byte color, byte bgColor) {
-	assert(c >= _startingChar && c <= _endingChar);
-	const byte *charP = _data + (c - _startingChar) * 8;
-	Graphics::Surface s = surface.getSubArea(Common::Rect(pt.x, pt.y, pt.x + 8, pt.y + 8));
-
-	for (int y = 0; y < 8; ++y) {
-		byte *lineP = (byte *)s.getBasePtr(0, y);
-		byte lineData = charP[y];
-
-		for (int x = 0; x < 8; ++x, lineData <<= 1, ++lineP) {
-			*lineP = (lineData & 0x80) ? color : bgColor;
-		}
-	}
-
-	pt.x += charWidth(c);
-}
-
-uint Font::charWidth(char c) const {
-	return 8;
-}
-
-uint Font::lineHeight() const {
-	return 8;
-}
-
-uint Font::stringWidth(const Common::String &msg) const {
-	return msg.size() * 8;
-}
-
-} // End of namespace Gfx
-} // End of namespace Shared
-} // End of namespace Ultima
diff --git a/engines/ultima/u1shared/gfx/font.h b/engines/ultima/u1shared/gfx/font.h
deleted file mode 100644
index 8c6503c33d5..00000000000
--- a/engines/ultima/u1shared/gfx/font.h
+++ /dev/null
@@ -1,73 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-#ifndef ULTIMA_SHARED_GFX_FONT_H
-#define ULTIMA_SHARED_GFX_FONT_H
-
-#include "common/array.h"
-#include "common/stream.h"
-#include "graphics/managed_surface.h"
-#include "ultima/u1shared/core/rect.h"
-
-namespace Ultima {
-namespace Shared {
-namespace Gfx {
-
-class Font {
-private:
-	const byte *_data;
-	size_t _startingChar, _endingChar;
-public:
-	Font(const byte *data, size_t startingChar = 0, size_t charCount = 256);
-
-	/**
-	 * Write out a string
-	 */
-	int writeString(Graphics::ManagedSurface &surface, const Common::String &msg,
-		Point &pt, byte color, byte bgColor = 0);
-
-	/**
-	 * Draw a character
-	 */
-	void writeChar(Graphics::ManagedSurface &surface, unsigned char c, Point &pt,
-		byte color, byte bgColor = 0);
-
-	/**
-	 * Return the width of a character
-	 */
-	uint charWidth(char c) const;
-
-	/**
-	 * Return the width of a string
-	 */
-	uint stringWidth(const Common::String &msg) const;
-
-	/**
-	 * Returns the height of the font
-	 */
-	uint lineHeight() const;
-};
-
-} // End of namespace Gfx
-} // End of namespace Shared
-} // End of namespace Ultima
-
-#endif
diff --git a/engines/ultima/u1shared/gfx/info.cpp b/engines/ultima/u1shared/gfx/info.cpp
deleted file mode 100644
index 9426b6061f9..00000000000
--- a/engines/ultima/u1shared/gfx/info.cpp
+++ /dev/null
@@ -1,156 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-#include "ultima/u1shared/gfx/info.h"
-#include "ultima/u1shared/early/game.h"
-#include "ultima/u1shared/gfx/text_cursor.h"
-#include "ultima/u1shared/core/str.h"
-
-namespace Ultima {
-namespace Shared {
-
-#define PROMPT_CHAR '\x1'
-#define SUGGESTED_CR '\r'
-
-BEGIN_MESSAGE_MAP(Info, Shared::Gfx::VisualItem)
-	ON_MESSAGE(InfoMsg)
-	ON_MESSAGE(InfoGetCommandKeypress)
-	ON_MESSAGE(InfoGetKeypress)
-	ON_MESSAGE(InfoGetInput)
-	ON_MESSAGE(KeypressMsg)
-END_MESSAGE_MAP()
-
-Info::Info(TreeItem *parent, const Rect &bounds) : Gfx::VisualItem("Info", bounds, parent),
-		_commandRespondTo(nullptr) {
-	_characterInput = new Gfx::CharacterInput(getGame());
-	_textInput = new Gfx::TextInput(getGame());
-}
-
-Info::~Info() {
-	delete _characterInput;
-	delete _textInput;
-}
-
-bool Info::InfoMsg(CInfoMsg *msg) {
-	// Iterate through text, dealing with lines one at a time
-	StringArray lines = String(msg->_text).split("\r\n");
-
-	if (!_lines.empty() && msg->_replaceLine)
-		_lines.back() = _lines.back().firstChar();
-
-	for (uint idx = 0; idx < lines.size(); ++idx) {
-		if (_lines.empty() || idx > 0)
-			_lines.push_back(" ");
-
-		_lines.back() += lines[idx];
-	}
-
-	// Add newline if necessary
-	if (msg->_newLine)
-		_lines.push_back(" ");
-
-	setDirty();
-
-	// Adding any text hides any visible cursor
-	_commandRespondTo = nullptr;
-	Gfx::TextCursor *textCursor = getGame()->_textCursor;
-	textCursor->setVisible(false);
-
-	return true;
-}
-
-bool Info::InfoGetCommandKeypress(CInfoGetCommandKeypress *msg) {
-	if (_lines.empty() || _lines.back() != " ")
-		_lines.push_back("");
-	_lines.back() = PROMPT_CHAR;
-
-	Gfx::TextCursor *textCursor = getGame()->_textCursor;
-	textCursor->setVisible(true);
-	textCursor->setPosition(Point(8, _bounds.bottom - 8));
-
-	_commandRespondTo = msg->_responder;
-	return true;
-}
-
-bool Info::InfoGetKeypress(CInfoGetKeypress *msg) {
-	Game *game = getGame();
-	Point pt(_bounds.left + _lines.back().size() * 8, _bounds.bottom - 8);
-	_characterInput->show(pt, game->_textColor, msg->_responder);
-
-	return true;
-}
-
-bool Info::InfoGetInput(CInfoGetInput *msg) {
-	Game *game = getGame();
-	Point pt(_bounds.left + _lines.back().size() * 8, _bounds.bottom - 8);
-	_textInput->show(pt, msg->_isNumeric, msg->_maxCharacters, game->_textColor, msg->_responder);
-
-	return true;
-}
-
-bool Info::KeypressMsg(CKeypressMsg *msg) {
-	// If waiting for a command, dispatch the key to the respond, and hide the cursor
-	if (_commandRespondTo) {
-		TreeItem *target = _commandRespondTo;
-		_commandRespondTo = nullptr;
-
-		getGame()->_textCursor->setVisible(false);
-		CCharacterInputMsg cMsg(msg->_keyState);
-		cMsg.execute(target);
-		return true;
-	}
-
-	return true;
-}
-
-void Info::draw() {
-	// Clear the background
-	Gfx::VisualSurface s = getSurface();
-	s.clear();
-
-	// Get the number og lines to display
-	uint lineHeight = s.fontHeight();
-	uint numLines = (s.h + lineHeight - 1) / lineHeight;
-
-	// Discard any stored lines beyond the top of the display
-	while (_lines.size() > numLines)
-		_lines.remove_at(0);
-
-	// Display the lines
-	int x = 0, y = s.h - _lines.size() * lineHeight;
-	for (uint idx = 0; idx < _lines.size(); ++idx, x = 0, y += lineHeight) {
-		// Handle drawing the prompt character at the start of lines if necessary
-		Common::String line = _lines[idx];
-		if (!line.empty() && line[0] == PROMPT_CHAR) {
-			drawPrompt(s, Point(0, y));
-			x = 8;
-			line.deleteChar(0);
-		}
-
-		// Write the remainder of the line
-		s.writeString(line, Point(x, y));
-	}
-
-	_isDirty = false;
-}
-
-} // End of namespace Shared
-} // End of namespace Ultima
diff --git a/engines/ultima/u1shared/gfx/info.h b/engines/ultima/u1shared/gfx/info.h
deleted file mode 100644
index 50575d8ee6a..00000000000
--- a/engines/ultima/u1shared/gfx/info.h
+++ /dev/null
@@ -1,80 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-#ifndef ULTIMA_SHARED_GFX_INFO_H
-#define ULTIMA_SHARED_GFX_INFO_H
-
-#include "ultima/u1shared/gfx/visual_item.h"
-#include "ultima/u1shared/gfx/text_input.h"
-#include "ultima/u1shared/gfx/character_input.h"
-#include "common/str-array.h"
-
-namespace Ultima {
-namespace Shared {
-
-using Shared::CInfoMsg;
-using Shared::CInfoGetCommandKeypress;
-using Shared::CInfoGetInput;
-using Shared::CKeypressMsg;
-
-/**
- * Textual info area, showing what commands area done, and any responses to them
- */
-class Info : public Gfx::VisualItem {
-	DECLARE_MESSAGE_MAP;
-	bool InfoMsg(CInfoMsg *msg);
-	bool InfoGetCommandKeypress(CInfoGetCommandKeypress *msg);
-	bool InfoGetKeypress(CInfoGetKeypress *msg);
-	bool InfoGetInput(CInfoGetInput *msg);
-	bool KeypressMsg(CKeypressMsg *msg);
-private:
-	Common::StringArray _lines;
-	Gfx::TextInput *_textInput;
-	Gfx::CharacterInput *_characterInput;
-	TreeItem *_commandRespondTo;
-protected:
-	/**
-	 * Draws a prompt character
-	 */
-	virtual void drawPrompt(Gfx::VisualSurface &surf, const Point &pt) = 0;
-public:
-	CLASSDEF;
-
-	/**
-	 * Constructor
-	 */
-	Info(TreeItem *parent, const Rect &bounds);
-
-	/**
-	 * Destructor
-	 */
-	~Info() override;
-
-	/**
-	 * Draw the contents
-	 */
-	void draw() override;
-};
-
-} // End of namespace Shared
-} // End of namespace Ultima
-
-#endif
diff --git a/engines/ultima/u1shared/gfx/popup.cpp b/engines/ultima/u1shared/gfx/popup.cpp
deleted file mode 100644
index b575e8034e0..00000000000
--- a/engines/ultima/u1shared/gfx/popup.cpp
+++ /dev/null
@@ -1,70 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-#include "ultima/u1shared/gfx/popup.h"
-#include "ultima/u1shared/early/game_base.h"
-
-namespace Ultima {
-namespace Shared {
-namespace Gfx {
-
-BEGIN_MESSAGE_MAP(Popup, VisualItem)
-	ON_MESSAGE(ShowMsg)
-END_MESSAGE_MAP()
-
-Popup::Popup(GameBase *game) : VisualItem(nullptr), _game(game), _respondTo(nullptr), _parentView(nullptr) {
-	game->addChild(this);
-}
-
-Popup::~Popup() {
-	detach();
-}
-
-void Popup::show(TreeItem *respondTo) {
-	// Save a copy of the view the popup is being shown on, and activate it
-	_parentView = _game->getView();
-	_respondTo = respondTo;
-	if (!_respondTo)
-		_respondTo = _parentView;
-
-	_game->setPopup(this);
-	setDirty();
-}
-
-
-void Popup::hide() {
-	CPopupHiddenMsg hiddenMsg(this);
-	hiddenMsg.execute(_respondTo, nullptr, 0);
-
-	// Reset back to the parent view
-	_game->setView(_parentView);
-	_parentView->setDirty();
-}
-
-bool Popup::ShowMsg(CShowMsg *msg) {
-	CPopupShownMsg shownMsg(this);
-	shownMsg.execute(_respondTo, nullptr, 0);
-	return true;
-}
-
-} // End of namespace Gfx
-} // End of namespace Shared
-} // End of namespace Ultima
diff --git a/engines/ultima/u1shared/gfx/popup.h b/engines/ultima/u1shared/gfx/popup.h
deleted file mode 100644
index b17b90916f5..00000000000
--- a/engines/ultima/u1shared/gfx/popup.h
+++ /dev/null
@@ -1,75 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-#ifndef ULTIMA_SHARED_GFX_POPUP_H
-#define ULTIMA_SHARED_GFX_POPUP_H
-
-#include "ultima/u1shared/gfx/visual_item.h"
-
-namespace Ultima {
-namespace Shared {
-
-class GameBase;
-
-namespace Gfx {
-
-/**
- * Base class for graphic elements that "pop up" on top of existing views. This includes things like
- * dialogs, text input, etc.
- */
-class Popup : public VisualItem {
-	DECLARE_MESSAGE_MAP;
-	bool ShowMsg(CShowMsg *msg);
-protected:
-	GameBase *_game;
-	VisualItem *_parentView;
-	TreeItem *_respondTo;
-public:
-	CLASSDEF;
-
-	/**
-	 * Constructor
-	 */
-	Popup(GameBase *game);
-
-	/**
-	 * Destructor
-	 */
-	~Popup() override;
-
-	/**
-	 * Show the popup
-	 * @param respondTo		Element to send any response to when the popup closes.
-	 *						If not provided, any response goes to the active view
-	 */
-	void show(TreeItem *respondTo = nullptr);
-
-	/**
-	 * Hide the popup
-	 */
-	virtual void hide();
-};
-
-} // End of namespace Gfx
-} // End of namespace Shared
-} // End of namespace Ultima
-
-#endif
diff --git a/engines/ultima/u1shared/gfx/screen.cpp b/engines/ultima/u1shared/gfx/screen.cpp
deleted file mode 100644
index eaa8ed86d22..00000000000
--- a/engines/ultima/u1shared/gfx/screen.cpp
+++ /dev/null
@@ -1,61 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-#include "engines/util.h"
-#include "ultima/u1shared/gfx/screen.h"
-
-namespace Ultima {
-namespace Shared {
-namespace Gfx {
-
-Screen::Screen(): Graphics::Screen(320, 200), _cursor(nullptr), _drawCursor(false) {
-	initGraphics(320, 200);
-}
-
-void Screen::update() {
-	_drawCursor = false;
-
-	if (_cursor) {
-		// Check whether the area the cursor occupies will be being updated
-		Common::Rect cursorBounds = _cursor->getBounds();
-		for (const auto &r : _dirtyRects) {
-			if (r.intersects(cursorBounds)) {
-				addDirtyRect(cursorBounds);
-				_drawCursor = true;
-				break;
-			}
-		}
-	}
-
-	Graphics::Screen::update();
-}
-
-void Screen::updateScreen() {
-	if (_drawCursor)
-		_cursor->draw();
-
-	Graphics::Screen::updateScreen();
-}
-
-
-} // End of namespace Gfx
-} // End of namespace Shared
-} // End of namespace Ultima
diff --git a/engines/ultima/u1shared/gfx/screen.h b/engines/ultima/u1shared/gfx/screen.h
deleted file mode 100644
index 4c1fc7c2404..00000000000
--- a/engines/ultima/u1shared/gfx/screen.h
+++ /dev/null
@@ -1,88 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-#ifndef ULTIMA_SHARED_GFX_SCREEN_H
-#define ULTIMA_SHARED_GFX_SCREEN_H
-
-#include "common/list.h"
-#include "ultima/u1shared/core/rect.h"
-#include "graphics/screen.h"
-#include "ultima/u1shared/gfx/font.h"
-#include "ultima/u1shared/engine/messages.h"
-
-namespace Ultima {
-namespace Shared {
-
-namespace Gfx {
-
-
-/**
- * Base class for an on-screen cursor. Currently used for text cursor display
- */
-class Cursor {
-public:
-	/**
-	 * Destructor
-	 */
-	virtual ~Cursor() {}
-
-	/**
-	 * Get the bounds of the cursor
-	 */
-	virtual Common::Rect getBounds() const = 0;
-
-	/**
-	 * Draw the cursor
-	 */
-	virtual void draw() = 0;
-};
-
-class Screen: public Graphics::Screen {
-private:
-	Cursor *_cursor;
-	bool _drawCursor;
-public:
-	/**
-	 * Constructor
-	 */
-	Screen();
-
-	/**
-	 * Updates the screen by copying any affected areas to the system
-	 */
-	void update() override;
-
-	/**
-	 * Updates the screen at the end of an update call
-	 */
-	void updateScreen() override;
-
-	/**
-	 * Sets the currently active cursor
-	 */
-	void setCursor(Cursor *cursor) { _cursor = cursor; }
-};
-
-} // End of namespace Gfx
-} // End of namespace Shared
-} // End of namespace Ultima
-
-#endif
diff --git a/engines/ultima/u1shared/gfx/sprites.cpp b/engines/ultima/u1shared/gfx/sprites.cpp
deleted file mode 100644
index 5ac322fd7a4..00000000000
--- a/engines/ultima/u1shared/gfx/sprites.cpp
+++ /dev/null
@@ -1,106 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-#include "ultima/u1shared/gfx/sprites.h"
-#include "ultima/u1shared/core/file.h"
-
-namespace Ultima {
-namespace Shared {
-namespace Gfx {
-
-Sprite::Sprite() {
-}
-
-Sprite::Sprite(const Sprite &src) {
-	_surface.copyFrom(src._surface);
-	_transSurface.copyFrom(src._transSurface);
-}
-
-Sprite::Sprite(const byte *src, uint bpp, uint16 w, uint16 h) {
-	_surface.create(w, h, Graphics::PixelFormat::createFormatCLUT8());
-	assert((w % bpp) == 0);
-	byte v = 0;
-
-	for (int y = 0; y < h; ++y) {
-		byte *destP = (byte *)_surface.getBasePtr(0, y);
-
-		for (int x = 0; x < w; ++x, v <<= bpp) {
-			if ((x % (8 / bpp)) == 0)
-				v = *src++;
-
-			*destP++ = (((uint)v << bpp) & 0xff00) >> 8;
-		}
-	}
-}
-
-Sprite &Sprite::operator=(const Sprite &src) {
-	_surface.copyFrom(src._surface);
-	_transSurface.copyFrom(src._transSurface);
-	return *this;
-}
-
-void Sprite::draw(Graphics::ManagedSurface &dest, const Common::Point &pt) {
-	// Get area to be drawn on
-	Graphics::Surface s = dest.getSubArea(Common::Rect(pt.x, pt.y, pt.x + _surface.w, pt.y + _surface.h));
-
-	// Draw the sprite
-	for (uint16 y = 0; y < _surface.h; ++y) {
-		const byte *srcP = (const byte *)_surface.getBasePtr(0, y);
-		const byte *transP = (const byte *)_transSurface.getBasePtr(0, y);
-		byte *destP = (byte *)s.getBasePtr(0, y);
-
-		for (uint16 x = 0; x < _surface.w; ++x, ++srcP, ++transP, ++destP) {
-			if (_transSurface.empty() || *transP)
-				*destP = *srcP;
-		}
-	}
-}
-
-/*-------------------------------------------------------------------*/
-
-void Sprites::load(const Common::Path &name, uint bpp, uint16 w, uint16 h) {
-	_spriteSize = Point(w, h);
-
-	// Open the tiles for access
-	File f(name);
-	byte *buffer = new byte[w * h];
-
-	// Figure out how many tiles the file has
-	size_t bytesPerTile = (w / (8 / bpp)) * h;
-	size_t count = f.size() / bytesPerTile;
-
-	// Ensure there's enough capacity for the tileset
-	if (count > size())
-		_data.resize(count);
-
-	// Iterate through loading the tile data and creating sprites for them
-	for (size_t idx = 0; idx < count; ++idx) {
-		f.read(buffer, bytesPerTile);
-
-		_data[idx] = Sprite(buffer, bpp, w, h);
-	}
-
-	delete[] buffer;
-}
-
-} // End of namespace Gfx
-} // End of namespace Shared
-} // End of namespace Ultima
diff --git a/engines/ultima/u1shared/gfx/sprites.h b/engines/ultima/u1shared/gfx/sprites.h
deleted file mode 100644
index ee35df5f06d..00000000000
--- a/engines/ultima/u1shared/gfx/sprites.h
+++ /dev/null
@@ -1,138 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-#ifndef ULTIMA_SPRITES_H
-#define ULTIMA_SPRITES_H
-
-#include "common/array.h"
-#include "common/path.h"
-#include "graphics/managed_surface.h"
-#include "ultima/u1shared/core/rect.h"
-
-namespace Ultima {
-namespace Shared {
-namespace Gfx {
-
-class Sprite {
-private:
-	Graphics::ManagedSurface _surface;
-	Graphics::ManagedSurface _transSurface;
-public:
-	/**
-	 * Constructor
-	 */
-	Sprite();
-
-	/**
-	 * Constructor, copying from another sprite
-	 */
-	Sprite(const Sprite &src);
-
-	/**
-	 * Constructor, loading a sprite from passed data
-	 * @param src			Source data
-	 * @param bpp			The bits per pixel for tiles in the file
-	 * @param w				Width of tiles
-	 * @param h				Height of files
-	 */
-	Sprite(const byte *src, uint bpp, uint16 w = 16, uint16 h = 16);
-
-	/**
-	 * Copy assignment operator
-	 */
-	Sprite &operator=(const Sprite &src);
-
-	/**
-	 * Draw a tile onto a passed surface
-	 */
-	void draw(Graphics::ManagedSurface &dest, const Common::Point &pt);
-
-	/**
-	 * Return the width of the sprite
-	 */
-	uint16 w() const { return _surface.w; }
-
-	/**
-	 * Return the height of the sprite
-	 */
-	uint16 h() const { return _surface.h; }
-
-	/**
-	 * Get a reference to the sprite surface
-	 */
-	byte *getPixels() { return (byte *)_surface.getPixels(); }
-
-	/**
-	 * Get a reference to a specified position within the sprite
-	 */
-	byte *getBasePtr(int16 x, int16 y) { return (byte *)_surface.getBasePtr(x, y); }
-
-	/**
-	 * Get a reference to a specified position within the sprite
-	 */
-	const byte *getBasePtr(int16 x, int16 y) const { return (const byte *)_surface.getBasePtr(x, y); }
-};
-
-class Sprites {
-protected:
-	Common::Array<Sprite> _data;
-	Point _spriteSize;							// Size of individual sprites
-protected:
-	/**
-	 * Load a raw data file containing sprite pixels
-	 * @param name			Filename
-	 * @param bpp			The bits per pixel for tiles in the file
-	 * @param w				Width of tiles
-	 * @param h				Height of files
-	 */
-	void load(const Common::Path &name, uint bpp, uint16 w = 16, uint16 h = 16);
-public:
-	/**
-	 * Destructor
-	 */
-	virtual ~Sprites() {}
-
-	/**
-	 * Return the default dimensions for tiles
-	 */
-	Point getSpriteSize() const { return _spriteSize; }
-
-	/**
-	 * Return the size of the sprites list
-	 */
-	size_t size() const { return _data.size(); }
-
-	/**
-	 * Returns true if the sprites list is empty
-	 */
-	bool empty() const { return size() == 0; }
-
-	/**
-	 * Return a specific sprite
-	 */
-	virtual Sprite &operator[](uint idx) { return _data[idx]; }
-};
-
-} // End of namespace Gfx
-} // End of namespace Shared
-} // End of namespace Ultima
-
-#endif
diff --git a/engines/ultima/u1shared/gfx/text_cursor.cpp b/engines/ultima/u1shared/gfx/text_cursor.cpp
deleted file mode 100644
index 3c642ec45aa..00000000000
--- a/engines/ultima/u1shared/gfx/text_cursor.cpp
+++ /dev/null
@@ -1,35 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-#include "ultima/u1shared/gfx/text_cursor.h"
-#include "ultima/u1shared/early/ultima_early.h"
-
-namespace Ultima {
-namespace Shared {
-namespace Gfx {
-
-void TextCursor::markAsDirty() {
-	g_vm->_screen->getSubArea(_bounds);
-}
-
-} // End of namespace Gfx
-} // End of namespace Shared
-} // End of namespace Ultima
diff --git a/engines/ultima/u1shared/gfx/text_cursor.h b/engines/ultima/u1shared/gfx/text_cursor.h
deleted file mode 100644
index 593ad76a0d8..00000000000
--- a/engines/ultima/u1shared/gfx/text_cursor.h
+++ /dev/null
@@ -1,95 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-#ifndef ULTIMA_SHARED_GFX_TEXT_CURSOR_H
-#define ULTIMA_SHARED_GFX_TEXT_CURSOR_H
-
-#include "ultima/u1shared/core/rect.h"
-#include "ultima/u1shared/gfx/screen.h"
-
-namespace Ultima {
-namespace Shared {
-namespace Gfx {
-
-/**
- * Base class for text cursors, and is used by those games that don't have a visible cursor
- */
-class TextCursor : public Cursor {
-protected:
-	bool _visible;
-	Common::Rect _bounds;
-protected:
-	/**
-	 * Marks the area of the screen the cursor covers as dirty
-	 */
-	void markAsDirty();
-public:
-	TextCursor() : _visible(false) {
-	}
-	~TextCursor() override {
-	}
-
-	/**
-	 * Returns true if the cursor is visible
-	 */
-	bool isVisible() const {
-		return _visible;
-	}
-
-	/**
-	 * Sets the visibility of the cursor
-	 */
-	virtual void setVisible(bool isVis) {
-		_visible = isVis;
-		markAsDirty();
-	}
-
-	/**
-	 * Get the bounds of the cursor
-	 */
-	Common::Rect getBounds() const override { return _bounds; }
-
-	/**
-	 * Returns the position of the cursor
-	 */
-	Point getPosition() const { return Point(_bounds.left, _bounds.top); }
-
-	/**
-	 * Sets the position of the cursor
-	 */
-	void setPosition(const Point &pt) {
-		bool vis = _visible;
-		setVisible(false);
-		_bounds.moveTo(pt);
-		setVisible(vis);
-	}
-
-	/**
-	 * Update the cursor
-	 */
-	virtual void update() = 0;
-};
-
-} // End of namespace Gfx
-} // End of namespace Shared
-} // End of namespace Ultima
-
-#endif
diff --git a/engines/ultima/u1shared/gfx/text_input.cpp b/engines/ultima/u1shared/gfx/text_input.cpp
deleted file mode 100644
index 9947c88ba7f..00000000000
--- a/engines/ultima/u1shared/gfx/text_input.cpp
+++ /dev/null
@@ -1,96 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-#include "ultima/u1shared/gfx/text_input.h"
-#include "ultima/u1shared/gfx/text_cursor.h"
-#include "ultima/u1shared/early/game_base.h"
-#include "ultima/u1shared/engine/messages.h"
-
-namespace Ultima {
-namespace Shared {
-namespace Gfx {
-
-BEGIN_MESSAGE_MAP(TextInput, Popup)
-	ON_MESSAGE(KeypressMsg)
-END_MESSAGE_MAP()
-
-void TextInput::show(const Point &pt, bool isNumeric, size_t maxCharacters, byte color, TreeItem *respondTo) {
-	Popup::show(respondTo);
-	_isNumeric = isNumeric;
-	_maxCharacters = maxCharacters;
-	_color = color;
-	_bounds = Rect(pt.x, pt.y, pt.x + 8 * (maxCharacters + 1), pt.y + 8);
-	_text = "";
-
-	_game->_textCursor->setPosition(Point(_bounds.left, _bounds.top));
-	_game->_textCursor->setVisible(true);
-}
-
-void TextInput::draw() {
-	Popup::draw();
-
-	VisualSurface s = getSurface();
-
-	// Ensure the cursor is at the right position
-	_game->_textCursor->setPosition(Point(_bounds.left + _text.size() * 8, _bounds.top));
-
-	// Display the text
-	Common::String text = _text;
-	while (text.size() < _maxCharacters)
-		text += ' ';
-	s.writeString(text, TextPoint(0, 0), _color);
-}
-
-bool TextInput::KeypressMsg(CKeypressMsg *msg) {
-	uint16 c = msg->_keyState.ascii;
-	//TreeItem *respondTo = _respondTo;
-
-	if (c >= ' ' && c <= 0x7f) {
-		// Printable character
-		if (_text.size() < _maxCharacters && (!_isNumeric || (c >= '0' && c <= '9'))) {
-			_text += msg->_keyState.ascii;
-			setDirty();
-		}
-	} else if (msg->_keyState.keycode == Common::KEYCODE_BACKSPACE || msg->_keyState.keycode == Common::KEYCODE_LEFT) {
-		if (!_text.empty()) {
-			_text.deleteLastChar();
-			setDirty();
-		}
-	} else if (msg->_keyState.keycode == Common::KEYCODE_RETURN || msg->_keyState.keycode == Common::KEYCODE_KP_ENTER) {
-		_game->_textCursor->setVisible(false);
-		hide();
-
-		CTextInputMsg inputMsg(_text, false);
-		inputMsg.execute(_respondTo);
-	} else if (msg->_keyState.keycode == Common::KEYCODE_ESCAPE) {
-		_game->_textCursor->setVisible(false);
-		hide();
-
-		CTextInputMsg inputMsg("", true);
-		inputMsg.execute(_respondTo);
-	}
-
-	return true;
-}
-
-} // End of namespace Gfx
-} // End of namespace Shared
-} // End of namespace Ultima
diff --git a/engines/ultima/u1shared/gfx/text_input.h b/engines/ultima/u1shared/gfx/text_input.h
deleted file mode 100644
index bf1ea614886..00000000000
--- a/engines/ultima/u1shared/gfx/text_input.h
+++ /dev/null
@@ -1,68 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-#ifndef ULTIMA_GFX_TEXT_INPUT_H
-#define ULTIMA_GFX_TEXT_INPUT_H
-
-#include "ultima/u1shared/gfx/popup.h"
-
-namespace Ultima {
-namespace Shared {
-namespace Gfx {
-
-/**
- * Text input control
- */
-class TextInput : public Popup {
-	DECLARE_MESSAGE_MAP;
-	bool KeypressMsg(CKeypressMsg *msg);
-private:
-	bool _isNumeric;
-	size_t _maxCharacters;
-	Common::String _text;
-	byte _color;
-public:
-	CLASSDEF;
-	TextInput(GameBase *game) : Popup(game), _isNumeric(false), _maxCharacters(0), _color(0) {}
-
-	/**
-	 * Draws the visual item on the screen
-	 */
-	void draw() override;
-
-	/**
-	 * Show the text input
-	 * @param pt				Position of the input
-	 * @param maxCharacters		Maximum length of input
-	 * @param color				Text color
-	 * @param respondTo			Element to send any response to when the popup closes.
-	 *							If not provided, any response goes to the active view
-	 * @remarks		Generates a TextInputMsg message with the text when Enter or escape is pressed
-	 */
-	void show(const Point &pt, bool isNumeric, size_t maxCharacters, byte color,
-		TreeItem *respondTo = nullptr);
-};
-
-} // End of namespace Gfx
-} // End of namespace Shared
-} // End of namespace Ultima
-
-#endif
diff --git a/engines/ultima/u1shared/gfx/viewport_dungeon.cpp b/engines/ultima/u1shared/gfx/viewport_dungeon.cpp
deleted file mode 100644
index 3559f4794db..00000000000
--- a/engines/ultima/u1shared/gfx/viewport_dungeon.cpp
+++ /dev/null
@@ -1,267 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-#include "ultima/u1shared/gfx/viewport_dungeon.h"
-#include "ultima/u1shared/maps/dungeon_widget.h"
-#include "ultima/u1shared/maps/dungeon_creature.h"
-#include "ultima/u1shared/maps/map_widget.h"
-#include "ultima/u1shared/maps/map.h"
-#include "ultima/u1shared/early/game.h"
-
-namespace Ultima {
-namespace Shared {
-
-EMPTY_MESSAGE_MAP(ViewportDungeon, Shared::Gfx::VisualItem);
-
-void ViewportDungeon::draw() {
-	// Get a surface reference and clear it's contents
-	DungeonSurface s = getSurface();
-	s.clear();
-
-	// Get the position delta for the facing direction, and the cells to the left and right of that
-	Maps::Map *map = getGame()->getMap();
-	Point delta = map->getDirectionDelta();
-
-	Point leftDelta, rightDelta;
-	switch (map->getDirection()) {
-	case Maps::DIR_LEFT:
-		leftDelta.y = 1;
-		rightDelta.y = -1;
-		break;
-	case Maps::DIR_RIGHT:
-		leftDelta.y = -1;
-		rightDelta.y = 1;
-		break;
-	case Maps::DIR_UP:
-		leftDelta.x = -1;
-		rightDelta.x = 1;
-		break;
-	case Maps::DIR_DOWN:
-		leftDelta.x = 1;
-		rightDelta.x = -1;
-		break;
-	default:
-		break;
-	}
-
-	Maps::MapTile tile, deltaTile, leftTile, rightTile, backTile;
-	Point currentPos = map->getPosition();
-	map->getTileAt(currentPos, &tile);
-	map->getTileAt(currentPos + delta, &deltaTile);
-
-	bool isDoor = tile.isDoor();
-	bool isWall = tile.isWallOrSecretDoor();
-	int distance = distanceToOccupiedCell(delta);
-
-	// If stuck in a wall, draw it and exit
-	if (isWall) {
-		s.drawWall(0);
-		return;
-	}
-
-	Point backDelta(delta.x * distance, delta.y * distance),
-		currDelta(delta.x * distance, delta.y * distance);
-
-	if (isDoor && deltaTile.isWallOrDoorway()) {
-		s.drawWall(0);
-	} else {
-		if (isDoor)
-			s.drawDoorway(0);
-
-		// These are essentially boolean flags with an extra 'initial' state
-		byte endingLeft = 100, endingRight = 100;
-		byte leftFlag = 100, rightFlag = 100;
-		byte priorLeftFlag = 100, priorRightFlag = 100;
-
-		for (int index = distance; index; --index) {
-			currDelta -= delta;
-			Point pt = currentPos + currDelta;
-
-			if (!isDoor || index > 1) {
-				map->getTileAt(pt + leftDelta, &leftTile);
-				map->getTileAt(pt + rightDelta, &rightTile);
-				leftFlag = leftTile.isSolid();
-				rightFlag = rightTile.isSolid();
-				if (index == distance) {
-					endingLeft = leftFlag;
-					endingRight = rightFlag;
-				} else {
-					if (leftFlag != priorLeftFlag)
-						s.drawLeftEdge(index);
-					if (rightFlag != priorRightFlag)
-						s.drawRightEdge(index);
-				}
-
-				drawLeftCell(index, leftTile);
-				drawRightCell(index, rightTile);
-			}
-
-			drawCell(index, pt + delta);
-			priorLeftFlag = leftFlag;
-			priorRightFlag = rightFlag;
-		}
-
-		if (!isDoor)
-			drawCell(0, currentPos);
-
-		map->getTileAt(currentPos + delta, &backTile);
-		if (distance < 5 && isMonsterBlocking(currentPos + backDelta) && backTile.isDoor()) {
-			map->getTileAt(currentPos + leftDelta, &leftTile);
-			map->getTileAt(currentPos + rightDelta, &rightTile);
-
-			drawLeftCell(distance + 1, leftTile);
-			drawRightCell(distance + 1, rightTile);
-
-			map->getTileAt(currentPos + leftDelta, &leftTile);
-			if (!leftTile.isSolid())
-				s.drawLeftEdge(distance);
-
-			if (!rightTile.isSolid())
-				s.drawRightEdge(distance);
-		} else {
-			if (endingLeft)
-				s.drawLeftEdge(distance);
-			if (endingRight)
-				s.drawRightEdge(distance);
-		}
-	}
-
-	Maps::DungeonWidget *widget = dynamic_cast<Maps::DungeonWidget *>(tile._widget);
-	if (isDoor && widget) {
-		widget->draw(s, 0);
-	}
-}
-
-uint ViewportDungeon::distanceToOccupiedCell(const Point &delta) {
-	Point d = delta;
-	uint distance;
-	for (distance = 1; !isCellOccupied(d); ++distance, d.x += delta.x, d.y += delta.y) {}
-
-	return MIN(distance, (uint)5);
-}
-
-bool ViewportDungeon::isCellOccupied(const Point &delta) {
-	Maps::Map *map = getGame()->getMap();
-	Point pt = map->getPosition() + delta;
-
-	Maps::MapTile tile;
-	map->getTileAt(pt, &tile);
-	if (tile.isWallOrDoorway())
-		return true;
-
-	return isMonsterBlocking(pt);
-}
-
-bool ViewportDungeon::isMonsterBlocking(const Point &pt) {
-	Maps::MapTile tile;
-	getGame()->getMap()->getTileAt(pt, &tile);
-	Maps::DungeonCreature *monster = dynamic_cast<Maps::DungeonCreature *>(tile._widget);
-	return monster != nullptr && monster->isBlockingView();
-}
-
-void ViewportDungeon::drawCell(uint distance, const Point &pt) {
-	Game *game = getGame();
-	DungeonSurface s = getSurface();
-	Maps::Map *map = game->getMap();
-
-	Maps::MapTile tile;
-	map->getTileAt(pt, &tile);
-
-	// TODO: This currently contains dungeon cell types specific to Ultima 1
-	Maps::DungeonCreature *monster = dynamic_cast<Maps::DungeonCreature *>(tile._widget);
-	if (monster) {
-		// Draw a monster
-		if (tile.isWallOrDoorway())
-			s.drawWall(distance);
-		if (tile._tileId == 7)
-			// Ladder down
-			s.drawWidget(27, distance + 1, game->_edgeColor);
-		if (tile._tileId == 6)
-			// Ladder up
-			s.drawWidget(26, distance + 1, game->_edgeColor);
-
-		monster->draw(s, distance);
-	} else {
-		switch (tile._tileId) {
-		case 1:
-		case 2:
-			// Wall or secret door
-			s.drawWall(distance);
-			break;
-		case 3:
-			// Doorway
-			s.drawDoorway(distance);
-			break;
-		case 6:
-			// Ladder down
-			if (map->getDirection() == Maps::DIR_UP || map->getDirection() == Maps::DIR_DOWN) {
-				s.drawLadderDownFaceOn(distance + 1);
-			} else {
-				s.drawLadderDownSideOn(distance + 1);
-			}
-			break;
-		case 7:
-			// Ladder up
-			if (map->getDirection() == Maps::DIR_UP || map->getDirection() == Maps::DIR_DOWN) {
-				s.drawLadderUpFaceOn(distance + 1);
-			} else {
-				s.drawLadderUpSideOn(distance + 1);
-			}
-			break;
-		case 8:
-			// Beams
-			s.drawBeams(distance);
-			break;
-		default:
-			break;
-		}
-	}
-
-	// Draw any item at that distance
-	Maps::DungeonWidget *widget = dynamic_cast<Maps::DungeonWidget *>(tile._widget);
-	if (widget)
-		widget->draw(s, distance);
-}
-
-void ViewportDungeon::drawLeftCell(uint distance, const Maps::MapTile &tile) {
-	DungeonSurface s = getSurface();
-
-	if (tile.isDoor())
-		s.drawLeftDoor(distance);
-	else if (tile.isWallOrSecretDoor())
-		s.drawLeftWall(distance);
-	else
-		s.drawLeftBlank(distance);
-}
-
-void ViewportDungeon::drawRightCell(uint distance, const Maps::MapTile &tile) {
-	DungeonSurface s = getSurface();
-
-	if (tile.isDoor())
-		s.drawRightDoor(distance);
-	else if (tile.isWallOrSecretDoor())
-		s.drawRightWall(distance);
-	else
-		s.drawRightBlank(distance);
-}
-
-} // End of namespace Shared
-} // End of namespace Ultima
diff --git a/engines/ultima/u1shared/gfx/viewport_dungeon.h b/engines/ultima/u1shared/gfx/viewport_dungeon.h
deleted file mode 100644
index 745224265f6..00000000000
--- a/engines/ultima/u1shared/gfx/viewport_dungeon.h
+++ /dev/null
@@ -1,83 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-#ifndef ULTIMA_SHARED_GFX_VIEWPORT_DUNGEON_H
-#define ULTIMA_SHARED_GFX_VIEWPORT_DUNGEON_H
-
-#include "ultima/u1shared/gfx/visual_item.h"
-#include "ultima/u1shared/gfx/dungeon_surface.h"
-#include "ultima/u1shared/maps/map_tile.h"
-
-namespace Ultima {
-namespace Shared {
-
-class ViewportDungeon : public Gfx::VisualItem {
-	DECLARE_MESSAGE_MAP;
-private:
-	/**
-	 * Returns the distance to an occupied cell, if any
-	 */
-	uint distanceToOccupiedCell(const Point &delta);
-
-	/**
-	 * Returns if a cell at a given delta to the player is occupied
-	 */
-	bool isCellOccupied(const Point &delta);
-
-	/**
-	 * Returns true if a monster is at a given position, and it has the blocking attribute
-	 */
-	bool isMonsterBlocking(const Point &pt);
-
-	/**
-	 * Draw a monster or, failing that, the given tile at a given cell and distance
-	 */
-	void drawCell(uint distance, const Point &pt);
-
-	/**
-	 * Draw a cell to the left
-	 */
-	void drawLeftCell(uint distance, const Maps::MapTile &tile);
-
-	/**
-	 * Draw a cell to the left
-	 */
-	void drawRightCell(uint distance, const Maps::MapTile &tile);
-protected:
-	/**
-	 * Returns the surface for rendering the dungeon
-	 */
-	virtual DungeonSurface getSurface() = 0;
-public:
-	CLASSDEF;
-	ViewportDungeon(TreeItem *parent) : Gfx::VisualItem("ViewportDungeon", Rect(8, 8, 312, 152), parent) {}
-	~ViewportDungeon() override {}
-
-	/**
-	 * Draws the dungeon
-	 */
-	void draw() override;
-};
-
-} // End of namespace Shared
-} // End of namespace Ultima
-
-#endif
diff --git a/engines/ultima/u1shared/gfx/viewport_map.cpp b/engines/ultima/u1shared/gfx/viewport_map.cpp
deleted file mode 100644
index 5b257e85773..00000000000
--- a/engines/ultima/u1shared/gfx/viewport_map.cpp
+++ /dev/null
@@ -1,62 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-#include "ultima/u1shared/gfx/viewport_map.h"
-#include "ultima/u1shared/maps/map.h"
-#include "ultima/u1shared/early/game.h"
-
-namespace Ultima {
-namespace Shared {
-
-EMPTY_MESSAGE_MAP(ViewportMap, Gfx::VisualItem);
-
-void ViewportMap::draw() {
-	// Get a surface reference and clear it's contents
-	Gfx::VisualSurface s = getSurface();
-	s.clear();
-
-	// Figure out how many tiles can fit into the display
-	const Point spriteSize = _sprites->getSpriteSize();
-	const Point visibleTiles(_bounds.width() / spriteSize.x, _bounds.height() / spriteSize.y);
-
-	// Get a reference to the map and get the starting tile position
-	Maps::Map *map = getGame()->getMap();
-	const Point topLeft = map->getViewportPosition(visibleTiles);
-
-	// Iterate through drawing the map
-	Maps::MapTile tile;
-	for (int y = 0; y < visibleTiles.y; ++y) {
-		for (int x = 0; x < visibleTiles.x; ++x) {
-			Point drawPos(x * spriteSize.x, y * spriteSize.y);
-
-			// Get the next tile to display and draw it
-			map->getTileAt(Point(topLeft.x + x, topLeft.y + y), &tile);
-			(*_sprites)[tile._tileDisplayNum].draw(s, drawPos);
-
-			// Draw any widgets on the tile
-			for (uint idx = 0; idx < tile._widgets.size(); ++idx)
-				(*_sprites)[tile._widgets[idx]->getTileNum()].draw(s, drawPos);
-		}
-	}
-}
-
-} // End of namespace Shared
-} // End of namespace Ultima
diff --git a/engines/ultima/u1shared/gfx/viewport_map.h b/engines/ultima/u1shared/gfx/viewport_map.h
deleted file mode 100644
index b12ce917c34..00000000000
--- a/engines/ultima/u1shared/gfx/viewport_map.h
+++ /dev/null
@@ -1,57 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-#ifndef ULTIMA_SHARED_GFX_VIEWPORT_MAP_H
-#define ULTIMA_SHARED_GFX_VIEWPORT_MAP_H
-
-#include "ultima/u1shared/gfx/visual_item.h"
-#include "ultima/u1shared/gfx/sprites.h"
-
-namespace Ultima {
-namespace Shared {
-
-class ViewportMap : public Gfx::VisualItem {
-	DECLARE_MESSAGE_MAP;
-protected:
-	Gfx::Sprites *_sprites;
-public:
-	CLASSDEF;
-
-	/**
-	 * Constructor
-	 */
-	ViewportMap(TreeItem *parent) : Gfx::VisualItem("ViewportMap", Rect(8, 8, 312, 152), parent), _sprites(nullptr) {}
-
-	/**
-	 * Destructor
-	 */
-	~ViewportMap() override {}
-
-	/**
-	 * Draws the map
-	 */
-	void draw() override;
-};
-
-} // End of namespace Shared
-} // End of namespace Ultima
-
-#endif
diff --git a/engines/ultima/u1shared/gfx/visual_container.cpp b/engines/ultima/u1shared/gfx/visual_container.cpp
deleted file mode 100644
index 95024dfd10c..00000000000
--- a/engines/ultima/u1shared/gfx/visual_container.cpp
+++ /dev/null
@@ -1,140 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-#include "ultima/u1shared/gfx/visual_container.h"
-
-namespace Ultima {
-namespace Shared {
-namespace Gfx {
-
-BEGIN_MESSAGE_MAP(VisualContainer, VisualItem)
-	ON_MESSAGE(MouseButtonDownMsg)
-	ON_MESSAGE(MouseButtonUpMsg)
-	ON_MESSAGE(MouseMoveMsg)
-	ON_MESSAGE(MouseDoubleClickMsg)
-	ON_MESSAGE(MouseWheelMsg)
-END_MESSAGE_MAP()
-
-
-bool VisualContainer::MouseButtonDownMsg(CMouseButtonDownMsg *msg) {
-	if (msg->_buttons & MB_LEFT) {
-		_mouseFocusItem = handleMouseMsg(msg);
-		return _mouseFocusItem != nullptr;
-	}
-
-	return false;
-}
-
-bool VisualContainer::MouseButtonUpMsg(CMouseButtonUpMsg *msg) {
-	if (msg->_buttons & MB_LEFT) {
-		bool result = handleMouseMsg(msg) != nullptr;
-		_mouseFocusItem = nullptr;
-		return result;
-	}
-
-	return false;
-}
-
-bool VisualContainer::MouseDoubleClickMsg(CMouseDoubleClickMsg *msg) {
-	if (msg->_buttons & MB_LEFT)
-		return handleMouseMsg(msg);
-
-	return false;
-}
-
-bool VisualContainer::MouseWheelMsg(CMouseWheelMsg *msg) {
-	return handleMouseMsg(msg);
-}
-
-bool VisualContainer::MouseMoveMsg(CMouseMoveMsg *msg) {
-	if (msg->_buttons & MB_LEFT)
-		return handleMouseMsg(msg);
-
-	return false;
-}
-
-bool VisualContainer::MouseDragMsg(CMouseDragMsg *msg) {
-	return handleMouseMsg(msg);
-}
-
-VisualItem *VisualContainer::handleMouseMsg(CMouseMsg *msg) {
-	if (_mouseFocusItem) {
-		// An item currently has focus, so pass all events directly to
-		// it, irrespective of whether the mouse is still in it or not
-		msg->execute(_mouseFocusItem);
-		return _mouseFocusItem;
-
-	} else {
-		// Iterate through each child and pass the message to the first
-		// immediate child the mouse position falls within
-		for (TreeItem *child = getFirstChild(); child; child = child->getNextSibling()) {
-			VisualItem *item = dynamic_cast<VisualItem *>(child);
-			if (item && item->getBounds().contains(msg->_mousePos)) {
-				if (msg->execute(item))
-					return item;
-			}
-		}
-
-		return nullptr;
-	}
-}
-
-void VisualContainer::draw() {
-	// If the overall container is dirty, clear it
-	if (_isDirty)
-		getSurface().clear();
-
-	// Iterate through each child and draw any dirty visual items
-	for (TreeItem *child = getFirstChild(); child; child = child->getNextSibling()) {
-		VisualItem *item = dynamic_cast<VisualItem *>(child);
-		if (item && item->isDirty())
-			item->draw();
-	}
-
-	_isDirty = false;
-}
-
-void VisualContainer::setDirty(bool dirty) {
-	for (TreeItem *child = getFirstChild(); child; child = child->getNextSibling()) {
-		VisualItem *item = dynamic_cast<VisualItem *>(child);
-		if (item)
-			item->setDirty(dirty);
-	}
-
-	VisualItem::setDirty(dirty);
-}
-
-bool VisualContainer::isDirty() const {
-	if (_isDirty)
-		return true;
-
-	for (TreeItem *child = getFirstChild(); child; child = child->getNextSibling()) {
-		VisualItem *item = dynamic_cast<VisualItem *>(child);
-		if (item && item->isDirty())
-			return true;
-	}
-
-	return false;
-}
-
-} // End of namespace Gfx
-} // End of namespace Shared
-} // End of namespace Ultima
diff --git a/engines/ultima/u1shared/gfx/visual_container.h b/engines/ultima/u1shared/gfx/visual_container.h
deleted file mode 100644
index f69ed9265e1..00000000000
--- a/engines/ultima/u1shared/gfx/visual_container.h
+++ /dev/null
@@ -1,78 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-#ifndef ULTIMA_SHARED_GFX_VISUAL_CONTAINER_H
-#define ULTIMA_SHARED_GFX_VISUAL_CONTAINER_H
-
-#include "ultima/u1shared/gfx/visual_item.h"
-#include "ultima/u1shared/core/message_target.h"
-
-namespace Ultima {
-namespace Shared {
-namespace Gfx {
-
-class VisualContainer : public VisualItem {
-	DECLARE_MESSAGE_MAP;
-	bool MouseButtonDownMsg(CMouseButtonDownMsg *msg);
-	bool MouseButtonUpMsg(CMouseButtonUpMsg *msg);
-	bool MouseMoveMsg(CMouseMoveMsg *msg);
-	bool MouseDoubleClickMsg(CMouseDoubleClickMsg *msg);
-	bool MouseWheelMsg(CMouseWheelMsg *msg);
-	bool MouseDragMsg(CMouseDragMsg *msg);
-private:
-	VisualItem *_mouseFocusItem;
-private:
-	/**
-	 * Called to handle mouse messagaes on the view
-	 */
-	VisualItem *handleMouseMsg(CMouseMsg *msg);
-public:
-	CLASSDEF;
-	VisualContainer(TreeItem *parent = nullptr) : VisualItem(parent), _mouseFocusItem(nullptr) {}
-	VisualContainer(const Rect &r, TreeItem *parent = nullptr) :
-		VisualItem(r, parent), _mouseFocusItem(nullptr) {}
-	VisualContainer(const Common::String &name, TreeItem *parent = nullptr) :
-		VisualItem(name, parent), _mouseFocusItem(nullptr) {}
-	VisualContainer(const Common::String &name, const Rect &r, TreeItem *parent = nullptr) :
-		VisualItem(name, r, parent), _mouseFocusItem(nullptr) {}
-	~VisualContainer() override {}
-
-	/**
-	 * Draws the container by iterating through each child and letting it draw
-	 */
-	void draw() override;
-
-	/**
-	 * Flags the item as being changed, requiring a redraw
-	 */
-	void setDirty(bool dirty = true) override;
-
-	/**
-	 * Returns true if the item is dirty, requiring a redraw
-	 */
-	bool isDirty() const override;
-};
-
-} // End of namespace Gfx
-} // End of namespace Shared
-} // End of namespace Ultima
-
-#endif
diff --git a/engines/ultima/u1shared/gfx/visual_item.cpp b/engines/ultima/u1shared/gfx/visual_item.cpp
deleted file mode 100644
index 02297555284..00000000000
--- a/engines/ultima/u1shared/gfx/visual_item.cpp
+++ /dev/null
@@ -1,90 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-#include "ultima/u1shared/gfx/visual_item.h"
-#include "ultima/u1shared/early/ultima_early.h"
-#include "ultima/u1shared/early/game.h"
-
-namespace Ultima {
-namespace Shared {
-namespace Gfx {
-
-BEGIN_MESSAGE_MAP(VisualItem, NamedItem)
-	ON_MESSAGE(ShowMsg)
-	ON_MESSAGE(HideMsg)
-END_MESSAGE_MAP()
-
-void VisualItem::init(TreeItem *parent) {
-	_isDirty = true;
-	if (parent != nullptr)
-		addUnder(parent);
-}
-
-bool VisualItem::ShowMsg(CShowMsg *msg) {
-	// When a view is shown, mark it to be redrawn
-	_isDirty = true;
-	//	Font *font = Font::getActiveFont();
-	//	_fontDetails._fontNumber = font ? font->_fontNumber : 1;
-
-	return false;
-}
-
-bool VisualItem::HideMsg(CHideMsg *msg) {
-	// When view is hidden, mark it as not dirty
-	_isDirty = false;
-	return false;
-}
-
-VisualSurface VisualItem::getSurface() {
-	Graphics::ManagedSurface src(*g_vm->_screen, _bounds);
-	return VisualSurface(src, _bounds, getGame());
-}
-
-void VisualItem::setBounds(const Rect &r) {
-	_bounds = r;
-	setDirty();
-}
-
-void VisualItem::setPosition(const Point &pt) {
-	_bounds.moveTo(pt);
-	setDirty();
-}
-
-void VisualItem::setDirty(bool dirty) {
-	// Flag the item as dirty
-	_isDirty = dirty;
-}
-
-void VisualItem::setView(const Common::String &viewName) {
-	getGame()->setView(viewName);
-}
-
-void VisualItem::setPopup(Gfx::Popup *popup) {
-	getGame()->setPopup(popup);
-}
-
-void VisualItem::setView() {
-	getGame()->setView(this);
-}
-
-} // End of namespace Gfx
-} // End of namespace Shaerd
-} // End of namespace Ultima
diff --git a/engines/ultima/u1shared/gfx/visual_item.h b/engines/ultima/u1shared/gfx/visual_item.h
deleted file mode 100644
index 89cbc33ad5e..00000000000
--- a/engines/ultima/u1shared/gfx/visual_item.h
+++ /dev/null
@@ -1,128 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-#ifndef ULTIMA_SHARED_GFX_VISUAL_ITEM_H
-#define ULTIMA_SHARED_GFX_VISUAL_ITEM_H
-
-#include "graphics/managed_surface.h"
-#include "ultima/u1shared/core/named_item.h"
-#include "ultima/u1shared/gfx/screen.h"
-#include "ultima/u1shared/gfx/visual_surface.h"
-
-namespace Ultima {
-namespace Shared {
-namespace Gfx {
-
-class Popup;
-
-/**
- * Acts as the base class for all classes that have a visual representation on the screen
- */
-class VisualItem : public NamedItem {
-	friend class VisualSurface;
-	DECLARE_MESSAGE_MAP;
-	bool ShowMsg(CShowMsg *msg);
-	bool HideMsg(CHideMsg *msg);
-private:
-	/**
-	 * Common initialization method used by the constructors
-	 */
-	void init(TreeItem *parent = nullptr);
-protected:
-	Rect _bounds;
-	bool _isDirty;
-public:
-	CLASSDEF;
-	VisualItem(TreeItem *parent = nullptr) { init(parent); }
-	VisualItem(const Rect &r, TreeItem *parent = nullptr) : _bounds(r) { init(parent); }
-	VisualItem(const Common::String &name, TreeItem *parent = nullptr) : NamedItem(name) { init(parent); }
-	VisualItem(const Common::String &name, const Rect &r, TreeItem *parent = nullptr) : NamedItem(name),
-		_bounds(r) { init(parent); }
-
-	~VisualItem() override {
-	}
-
-	/**
-	 * Draws the visual item on the screen
-	 */
-	virtual void draw() {
-		_isDirty = false;
-	}
-
-	/**
-	 * Gets a managed surface representing the portion of the screen defined by _bounds.
-	 * This allows drawing to be done without worrying about offsets or clipping
-	 */
-	VisualSurface getSurface();
-
-	/**
-	 * Gets the bounds for the item
-	 */
-	const Rect &getBounds() { return _bounds; }
-
-	/**
-	 * Sets the bounds for the item
-	 * @remarks Does not erase the item if it's already been drawn
-	 */
-	void setBounds(const Rect &r);
-
-	/**
-	 * Set the position for the item
-	 * @remarks Does not erase the item if it's already been drawn
-	 */
-	void setPosition(const Point &pt);
-
-	/**
-	 * Flags the item as being changed, requiring a redraw
-	 */
-	virtual void setDirty(bool dirty = true);
-
-	/**
-	 * Clears the dirty flag
-	 */
-	void clearDirty() { setDirty(false); }
-
-	/**
-	 * Returns true if the item is dirty, requiring a redraw
-	 */
-	virtual bool isDirty() const { return _isDirty; }
-
-	/**
-	 * Helper function to switch to a different visual item
-	 */
-	void setView(const Common::String &viewName);
-
-	/**
-	 * Helper function to switch to an on-screen popup
-	 */
-	void setPopup(Gfx::Popup *popup);
-
-	/**
-	 * Helper function to switch the item to be the current view
-	 */
-	void setView();
-};
-
-} // End of namespace Gfx
-} // End of namespace Shared
-} // End of namespace Ultima
-
-#endif
diff --git a/engines/ultima/u1shared/gfx/visual_surface.cpp b/engines/ultima/u1shared/gfx/visual_surface.cpp
deleted file mode 100644
index a6748adc983..00000000000
--- a/engines/ultima/u1shared/gfx/visual_surface.cpp
+++ /dev/null
@@ -1,72 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-#include "ultima/u1shared/gfx/visual_surface.h"
-#include "ultima/u1shared/early/ultima_early.h"
-#include "ultima/u1shared/early/game.h"
-#include "ultima/u1shared/gfx/font.h"
-
-namespace Ultima {
-namespace Shared {
-namespace Gfx {
-
-VisualSurface::VisualSurface(const Graphics::ManagedSurface &src, const Rect &bounds, GameBase *game) :
-		_bounds(bounds), _textColor(255), _bgColor(0) {
-	copyFrom(src);
-	Shared::Game *sharedGame = dynamic_cast<Shared::Game *>(game);
-	if (sharedGame) {
-		_textColor = sharedGame->_textColor;
-		_bgColor = sharedGame->_bgColor;
-	}
-}
-


Commit: 17e3beb43d28f6ec4c331e545369b6ecd1ade5e6
    https://github.com/scummvm/scummvm/commit/17e3beb43d28f6ec4c331e545369b6ecd1ade5e6
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:40:45+11:00

Commit Message:
ULTIMA: ULTIMA1: Added main menu

Changed paths:
  A engines/ultima/ultima1/gfx/text_cursor.cpp
  A engines/ultima/ultima1/gfx/text_cursor.h
  A engines/ultima/ultima1/views/dialog.cpp
  A engines/ultima/ultima1/views/dialog.h
  A engines/ultima/ultima1/views/main_menu.cpp
  A engines/ultima/ultima1/views/main_menu.h
    engines/ultima/module.mk
    engines/ultima/ultima1/gfx/pic_decoder.cpp
    engines/ultima/ultima1/gfx/pic_decoder.h
    engines/ultima/ultima1/views/title.cpp
    engines/ultima/ultima1/views/title.h
    engines/ultima/ultima1/views/views.h


diff --git a/engines/ultima/module.mk b/engines/ultima/module.mk
index c8258d9dc4f..d8022c39b6d 100644
--- a/engines/ultima/module.mk
+++ b/engines/ultima/module.mk
@@ -57,10 +57,13 @@ MODULE_OBJS += \
 	ultima1/data/player.o \
 	ultima1/data/tiles.o \
 	ultima1/gfx/pic_decoder.o \
+	ultima1/gfx/text_cursor.o \
 	ultima1/views/view.o \
 	ultima1/views/commands.o \
 	ultima1/views/create_character.o \
 	ultima1/views/dead.o \
+	ultima1/views/dialog.o \
+	ultima1/views/main_menu.o \
 	ultima1/views/overworld.o \
 	ultima1/views/overworld_map.o \
 	ultima1/views/stats.o \
diff --git a/engines/ultima/ultima1/gfx/pic_decoder.cpp b/engines/ultima/ultima1/gfx/pic_decoder.cpp
index 61ffdfa81d4..d775ca226fb 100644
--- a/engines/ultima/ultima1/gfx/pic_decoder.cpp
+++ b/engines/ultima/ultima1/gfx/pic_decoder.cpp
@@ -26,8 +26,8 @@ namespace Ultima {
 namespace Ultima1 {
 namespace Gfx {
 
-// ULTIMA.EXE's castlePalette - 16 six-bit EGA palette register values
-// (the picture's pixel data assumes this palette, not the standard one)
+// 16 six-bit EGA palette register values for the castle picture
+// (its pixel data assumes this palette, not the standard one)
 static const byte CASTLE_PALETTE_REGISTERS[16] = {
 	0, 24, 7, 63, 63, 34, 58, 14, 20, 7, 61, 59, 1, 57, 7, 63
 };
diff --git a/engines/ultima/ultima1/gfx/pic_decoder.h b/engines/ultima/ultima1/gfx/pic_decoder.h
index 96a0a2d1965..a0522222caf 100644
--- a/engines/ultima/ultima1/gfx/pic_decoder.h
+++ b/engines/ultima/ultima1/gfx/pic_decoder.h
@@ -38,8 +38,8 @@ namespace Gfx {
  * https://moddingwiki.shikadi.net/wiki/Ultima_I_Full_Screen_Graphic_Format
  *
  * The pixel data assumes a custom "cross-over" palette rather than the
- * engine's standard EGA one (see ULTIMA.EXE's castlePalette/setCastlePalette),
- * which loadStream() decodes into getPalette() for the caller to apply.
+ * engine's standard EGA one, which loadStream() decodes into getPalette()
+ * for the caller to apply.
  */
 class PicDecoder : public Image::ImageDecoder {
 private:
diff --git a/engines/ultima/ultima1/gfx/text_cursor.cpp b/engines/ultima/ultima1/gfx/text_cursor.cpp
new file mode 100644
index 00000000000..8f1f6f3ca7c
--- /dev/null
+++ b/engines/ultima/ultima1/gfx/text_cursor.cpp
@@ -0,0 +1,87 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "ultima/ultima1/gfx/text_cursor.h"
+#include "ultima/shared/gfx/rect.h"
+
+namespace Ultima {
+namespace Ultima1 {
+namespace Gfx {
+
+#define DELAY_FRAMES 2
+constexpr int COLOR_CURSOR = 11; // light cyan
+
+// 4-frame 8x8 glyph, one byte per row, low bit = leftmost pixel
+static const byte CURSOR_FRAMES[4][8] = {
+	{ 0x66, 0x3C, 0x18, 0x66, 0x66, 0x18, 0x3C, 0x66 },
+	{ 0x3C, 0x18, 0x66, 0x24, 0x24, 0x66, 0x18, 0x3C },
+	{ 0x18, 0x66, 0x24, 0x3C, 0x3C, 0x24, 0x66, 0x18 },
+	{ 0x66, 0x24, 0x18, 0x18, 0x18, 0x18, 0x3C, 0x66 }
+};
+
+TextCursor::TextCursor(const Common::String &name, UIElement *parent) : UIElement(name, parent) {
+	delayFrames(DELAY_FRAMES);
+}
+
+void TextCursor::show() {
+	_visible = true;
+	_frame = 0;
+	redraw();
+	delayFrames(DELAY_FRAMES);
+}
+
+void TextCursor::hide() {
+	_visible = false;
+	cancelDelay();
+	redraw();
+}
+
+void TextCursor::setPosition(const Common::Point &pt) {
+	setBounds(TextRect(pt.x, pt.y, pt.x, pt.y));
+}
+
+void TextCursor::draw() {
+	if (!_visible)
+		return;
+
+	auto s = getSurface();
+	s.clear();
+
+	for (int y = 0; y < 8; ++y) {
+		byte bits = CURSOR_FRAMES[_frame][y];
+		for (int x = 0; x < 8; ++x, bits >>= 1) {
+			if (bits & 1)
+				s.drawLine(x, y, x, y, COLOR_CURSOR);
+		}
+	}
+}
+
+void TextCursor::timeout() {
+	if (_visible) {
+		_frame = (_frame + 1) % 4;
+		redraw();
+		delayFrames(DELAY_FRAMES);
+	}
+}
+
+} // namespace Gfx
+} // namespace Ultima1
+} // namespace Ultima
diff --git a/engines/ultima/ultima1/gfx/text_cursor.h b/engines/ultima/ultima1/gfx/text_cursor.h
new file mode 100644
index 00000000000..c0240eb5eaa
--- /dev/null
+++ b/engines/ultima/ultima1/gfx/text_cursor.h
@@ -0,0 +1,68 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef ULTIMA1_GFX_TEXT_CURSOR_H
+#define ULTIMA1_GFX_TEXT_CURSOR_H
+
+#include "ultima/shared/engine/events.h"
+
+namespace Ultima {
+namespace Ultima1 {
+namespace Gfx {
+
+/**
+ * Animated 8x8 text cursor glyph shown after an input prompt, cycling
+ * through 4 frames while visible. Doesn't handle keypresses itself -
+ * that's left to whichever view owns it.
+ */
+class TextCursor : public Shared::UIElement {
+private:
+	int _frame = 0;
+	bool _visible = true;
+
+public:
+	TextCursor(const Common::String &name, UIElement *parent = nullptr);
+	~TextCursor() override {}
+
+	void draw() override;
+	void timeout() override;
+
+	/**
+	 * Shows the cursor and (re)starts its animation
+	 */
+	void show();
+
+	/**
+	 * Hides the cursor
+	 */
+	void hide();
+
+	/**
+	 * Sets the screen position of the cursor
+	 */
+	void setPosition(const Common::Point &pt);
+};
+
+} // namespace Gfx
+} // namespace Ultima1
+} // namespace Ultima
+
+#endif
diff --git a/engines/ultima/ultima1/views/dialog.cpp b/engines/ultima/ultima1/views/dialog.cpp
new file mode 100644
index 00000000000..d3d923d0dd7
--- /dev/null
+++ b/engines/ultima/ultima1/views/dialog.cpp
@@ -0,0 +1,69 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "common/util.h"
+#include "ultima/ultima1/views/dialog.h"
+
+namespace Ultima {
+namespace Ultima1 {
+namespace Views {
+
+// Colors used
+constexpr int COLOR_BORDER = 1;  // blue - thick outer band
+constexpr int COLOR_EDGE = 15;   // white - thin inner highlight line
+constexpr int COLOR_NOTCH = 0;   // black - corner notch pixels
+
+void Dialog::drawFrame() {
+	auto s = getSurface();
+
+	// Thick outer border band
+	s.fillRect(Common::Rect(0, 0, 316, 6), COLOR_BORDER);
+	s.fillRect(Common::Rect(0, 6, 6, 199), COLOR_BORDER);
+	s.fillRect(Common::Rect(313, 2, 319, 199), COLOR_BORDER);
+	s.fillRect(Common::Rect(0, 193, 319, 199), COLOR_BORDER);
+
+	// Thin inner highlight line
+	s.drawLine(7, 7, 312, 7, COLOR_EDGE);
+	s.drawLine(7, 7, 7, 192, COLOR_EDGE);
+	s.drawLine(312, 7, 312, 192, COLOR_EDGE);
+	s.drawLine(7, 192, 312, 192, COLOR_EDGE);
+
+	// Diagonal-notched corners, cut as a growing staircase into each corner
+	for (int idx = 1; idx <= 4; ++idx) {
+		s.drawLine(idx, 0, 0, idx, COLOR_NOTCH);
+		s.drawLine(319 - idx, 0, 319, idx, COLOR_NOTCH);
+		s.drawLine(0, 199 - idx, idx, 199, COLOR_NOTCH);
+		s.drawLine(319, 199 - idx, 319 - idx, 199, COLOR_NOTCH);
+	}
+
+	static const Common::Point NOTCH_POINTS[] = {
+		Common::Point(0, 0), Common::Point(0, 5), Common::Point(5, 0),
+		Common::Point(319, 0), Common::Point(314, 0), Common::Point(319, 5),
+		Common::Point(0, 199), Common::Point(0, 194), Common::Point(5, 199),
+		Common::Point(319, 199), Common::Point(319, 194), Common::Point(314, 199)
+	};
+	for (int i = 0; i < ARRAYSIZE(NOTCH_POINTS); ++i)
+		s.drawLine(NOTCH_POINTS[i].x, NOTCH_POINTS[i].y, NOTCH_POINTS[i].x, NOTCH_POINTS[i].y, COLOR_NOTCH);
+}
+
+} // namespace Views
+} // namespace Ultima1
+} // namespace Ultima
diff --git a/engines/ultima/ultima1/views/dialog.h b/engines/ultima/ultima1/views/dialog.h
new file mode 100644
index 00000000000..c47af92af7e
--- /dev/null
+++ b/engines/ultima/ultima1/views/dialog.h
@@ -0,0 +1,50 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef ULTIMA1_VIEWS_DIALOG_H
+#define ULTIMA1_VIEWS_DIALOG_H
+
+#include "ultima/shared/gfx/view.h"
+
+namespace Ultima {
+namespace Ultima1 {
+namespace Views {
+
+/**
+ * Base class for views with the thick beveled-corner frame drawn around the edge of the screen
+ */
+class Dialog : public Shared::Gfx::View {
+protected:
+	/**
+	 * Draws the border frame around the edge of the screen
+	 */
+	void drawFrame();
+
+public:
+	Dialog(const Common::String &name) : View(name) {}
+	~Dialog() override {}
+};
+
+} // namespace Views
+} // namespace Ultima1
+} // namespace Ultima
+
+#endif
diff --git a/engines/ultima/ultima1/views/main_menu.cpp b/engines/ultima/ultima1/views/main_menu.cpp
new file mode 100644
index 00000000000..0f2929b2c77
--- /dev/null
+++ b/engines/ultima/ultima1/views/main_menu.cpp
@@ -0,0 +1,75 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "ultima/ultima1/views/main_menu.h"
+#include "ultima/ultima1/ultima1.h"
+
+namespace Ultima {
+namespace Ultima1 {
+namespace Views {
+
+// Colors used
+constexpr int COLOR_EDGE = 15; // white - used for the title/tagline
+constexpr int COLOR_TEXT = 11; // light cyan - used for the menu options
+
+MainMenu::MainMenu() : Dialog("MainMenu"), _cursor("Cursor", this) {
+	// Position the cursor right after "Thy choice: "
+	_cursor.setPosition(Common::Point(25, 18));
+}
+
+void MainMenu::draw() {
+	auto s = getSurface();
+	s.clear();
+	drawFrame();
+
+	s.setColor(COLOR_EDGE);
+	s.writeString(Common::Point(12, 6), "*** Ultima I ***");
+	s.writeString(Common::Point(14, 9), "from darkest");
+	s.writeString(Common::Point(14, 10), "dungeons, to");
+	s.writeString(Common::Point(13, 11), "deepest space!");
+
+	s.setColor(COLOR_TEXT);
+	s.writeString(Common::Point(8, 14), "a) Generate new character");
+	s.writeString(Common::Point(8, 15), "b) Continue previous game");
+	s.writeString(Common::Point(13, 18), "Thy choice: ");
+}
+
+bool MainMenu::msgKeypress(const KeypressMessage &msg) {
+	switch (toupper(msg.ascii)) {
+	case 'A':
+		replaceView("CreateCharacter");
+		break;
+
+	case 'B':
+		if (g_engine->loadGameDialog())
+			g_engine->_game.startGame();
+		break;
+
+	default:
+		break;
+	}
+
+	return true;
+}
+
+} // namespace Views
+} // namespace Ultima1
+} // namespace Ultima
diff --git a/engines/ultima/ultima1/views/main_menu.h b/engines/ultima/ultima1/views/main_menu.h
new file mode 100644
index 00000000000..3454a496073
--- /dev/null
+++ b/engines/ultima/ultima1/views/main_menu.h
@@ -0,0 +1,54 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef ULTIMA1_VIEWS_MAIN_MENU_H
+#define ULTIMA1_VIEWS_MAIN_MENU_H
+
+#include "ultima/ultima1/gfx/text_cursor.h"
+#include "ultima/ultima1/views/dialog.h"
+
+namespace Ultima {
+namespace Ultima1 {
+namespace Views {
+
+using namespace Shared::Messages;
+
+/**
+ * The game's main menu - offers generating a new character or
+ * continuing a previously saved game.
+ */
+class MainMenu : public Dialog {
+private:
+	Gfx::TextCursor _cursor;
+
+public:
+	MainMenu();
+	~MainMenu() override {}
+
+	void draw() override;
+	bool msgKeypress(const KeypressMessage &msg) override;
+};
+
+} // namespace Views
+} // namespace Ultima1
+} // namespace Ultima
+
+#endif
diff --git a/engines/ultima/ultima1/views/title.cpp b/engines/ultima/ultima1/views/title.cpp
index 7b29739ffde..72083de8af0 100644
--- a/engines/ultima/ultima1/views/title.cpp
+++ b/engines/ultima/ultima1/views/title.cpp
@@ -33,12 +33,11 @@ namespace Ultima {
 namespace Ultima1 {
 namespace Views {
 
-// Colors from ULTIMA.EXE's init_video, EGA branch
-constexpr int COLOR_FOREGROUND = 15;	// white - used by showTrademarks' credits text
-constexpr int COLOR_TEXT       = 11;	// light cyan - used by showTitle1/showTitle2's blurb text
+// Colors used
+constexpr int COLOR_FOREGROUND = 15;	// white - used by the credits text
+constexpr int COLOR_TEXT       = 11;	// light cyan - used by blurb text
 
-// Flag pole x positions either side of the castle gate, matching the
-// animateFlagRandom(123)/animateFlagRandom(196) calls in OUT.EXE's showCastle
+// Flag pole x positions either side of the castle gate
 constexpr int FLAG_X1 = 123;
 constexpr int FLAG_X2 = 196;
 constexpr int FLAG_Y  = 55;
@@ -215,8 +214,7 @@ static const uint32 FLAGS_MAP[] = { 11, 10 };
 constexpr int LOGO_STEPS_PER_FRAME = 4000;
 
 // Number of lines drawn from the top and bottom on the credits screen
-// before they meet in the middle, matching slideInLogo's "cmp arg_4, 32"
-// in ULTIMA.EXE (half the logo's 64-pixel height)
+// before they meet in the middle (half the logo's 64-pixel height)
 constexpr int CREDITS_LOGO_LINES = 32;
 
 // Lines revealed per draw() call from each end - 2 rather than 1 doubles
@@ -369,9 +367,9 @@ void Title::revealLogoPixels(Shared::Gfx::GfxSurface &s) {
 }
 
 void Title::drawCreditsLogo(Shared::Gfx::GfxSurface &s) {
-	// Replicates slideInLogo: new lines are revealed from the top
-	// (growing downward) and bottom (growing upward) each call, meeting
-	// in the middle after CREDITS_LOGO_LINES steps
+	// New lines are revealed from the top (growing downward) and bottom
+	// (growing upward) each call, meeting in the middle after
+	// CREDITS_LOGO_LINES steps
 	for (int i = 0; i < CREDITS_LOGO_STEP && _creditsLine < CREDITS_LOGO_LINES; ++i, ++_creditsLine) {
 		int topRow = _creditsLine;
 		int bottomRow = _logo.h - 1 - _creditsLine;
@@ -422,7 +420,7 @@ void Title::timeout() {
 			_creditsTextShown = true;
 			delaySeconds(3);
 		} else {
-			showCreateCharacter();
+			showMainMenu();
 			return;
 		}
 		break;
@@ -443,13 +441,13 @@ void Title::showCredits() {
 	delayFrames(1);
 }
 
-void Title::showCreateCharacter() {
-	replaceView("CreateCharacter");
+void Title::showMainMenu() {
+	replaceView("MainMenu");
 }
 
 bool Title::msgKeypress(const KeypressMessage &msg) {
 	if (_state == CREDITS)
-		showCreateCharacter();
+		showMainMenu();
 	else
 		showCredits();
 	return true;
@@ -457,7 +455,7 @@ bool Title::msgKeypress(const KeypressMessage &msg) {
 
 bool Title::msgMouseDown(const MouseDownMessage &msg) {
 	if (_state == CREDITS)
-		showCreateCharacter();
+		showMainMenu();
 	else
 		showCredits();
 	return true;
@@ -465,7 +463,7 @@ bool Title::msgMouseDown(const MouseDownMessage &msg) {
 
 bool Title::msgAction(const ActionMessage &msg) {
 	if (_state == CREDITS)
-		showCreateCharacter();
+		showMainMenu();
 	else
 		showCredits();
 	return true;
diff --git a/engines/ultima/ultima1/views/title.h b/engines/ultima/ultima1/views/title.h
index c451e89251d..23ed564fa27 100644
--- a/engines/ultima/ultima1/views/title.h
+++ b/engines/ultima/ultima1/views/title.h
@@ -60,7 +60,7 @@ private:
 	Graphics::Palette _castlePalette;
 
 	void showCredits();
-	void showCreateCharacter();
+	void showMainMenu();
 	void drawCastleFlag(Shared::Gfx::GfxSurface &s, int xp);
 	void resetLogoReveal();
 	void revealLogoPixels(Shared::Gfx::GfxSurface &s);
diff --git a/engines/ultima/ultima1/views/views.h b/engines/ultima/ultima1/views/views.h
index bb68e88690e..6d6c233247d 100644
--- a/engines/ultima/ultima1/views/views.h
+++ b/engines/ultima/ultima1/views/views.h
@@ -24,6 +24,7 @@
 
 #include "ultima/shared/engine/events.h"
 #include "ultima/ultima1/views/create_character.h"
+#include "ultima/ultima1/views/main_menu.h"
 #include "ultima/ultima1/views/startup.h"
 #include "ultima/ultima1/views/title.h"
 
@@ -33,6 +34,7 @@ namespace Views {
 
 struct Views : public Shared::Views {
 	CreateCharacter _createCharacter;
+	MainMenu _mainMenu;
 	Startup _startup;
 	Title _title;
 };


Commit: 18e53702ef0b32edc903c268d7b3790cb0a3b646
    https://github.com/scummvm/scummvm/commit/18e53702ef0b32edc903c268d7b3790cb0a3b646
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:40:45+11:00

Commit Message:
ULTIMA: ULTIMA1: Added Character Generation screen

Changed paths:
  A engines/ultima/ultima1/gfx/text_input.cpp
  A engines/ultima/ultima1/gfx/text_input.h
    engines/ultima/module.mk
    engines/ultima/ultima1/data/game.cpp
    engines/ultima/ultima1/data/game.h
    engines/ultima/ultima1/data/map.cpp
    engines/ultima/ultima1/data/map.h
    engines/ultima/ultima1/data/player.cpp
    engines/ultima/ultima1/data/player.h
    engines/ultima/ultima1/ultima1.cpp
    engines/ultima/ultima1/views/create_character.cpp
    engines/ultima/ultima1/views/create_character.h
    engines/ultima/ultima1/views/dialog.cpp
    engines/ultima/ultima1/views/dialog.h
    engines/ultima/ultima1/views/overworld.cpp
    engines/ultima/ultima1/views/stats.cpp


diff --git a/engines/ultima/module.mk b/engines/ultima/module.mk
index d8022c39b6d..aa735e62ea0 100644
--- a/engines/ultima/module.mk
+++ b/engines/ultima/module.mk
@@ -58,6 +58,7 @@ MODULE_OBJS += \
 	ultima1/data/tiles.o \
 	ultima1/gfx/pic_decoder.o \
 	ultima1/gfx/text_cursor.o \
+	ultima1/gfx/text_input.o \
 	ultima1/views/view.o \
 	ultima1/views/commands.o \
 	ultima1/views/create_character.o \
diff --git a/engines/ultima/ultima1/data/game.cpp b/engines/ultima/ultima1/data/game.cpp
index 3cf80bb5e06..6704d67418e 100644
--- a/engines/ultima/ultima1/data/game.cpp
+++ b/engines/ultima/ultima1/data/game.cpp
@@ -28,12 +28,8 @@ namespace Ultima1 {
 namespace Data {
 
 void Game::startGame() {
-	const auto &player = g_engine->_player;
-
-	if (IS_DUNGEON(player._mapNum))
-		g_engine->replaceView("Dungeon");
-	else
-		g_engine->replaceView("Overworld");
+	// TODO: dungeons aren't implemented yet, so always start on the overworld
+	g_engine->replaceView("Overworld");
 
 	promptForCommand();
 }
@@ -78,30 +74,28 @@ void Game::endOfTurn() {
 
 void Game::subtractFoodCtr(int amount) {
 	auto &player = g_engine->_player;
-	if (player._hp == 0)
+	if (player.isDead())
 		return;		// Already dead
 
-	bool foodFlag = player._foodSubCtr < amount;
-	player._foodSubCtr -= amount;
-	if (foodFlag && --player._food == 0)
+	player._food = MAX((int)player._food - amount, 0);
+	if (player._food == 0)
 		dead();
 }
 
 void Game::subtractHp(int amount) {
 	auto &player = g_engine->_player;
-	player._hp = MAX((int)player._hp - amount, 0);
+	player._hits = MAX((int)player._hits - amount, 0);
 
-	if (player._hp == 0)
+	if (player._hits == 0)
 		dead();
 }
 
 void Game::dead() {
 	auto &player = g_engine->_player;
-	player._hp = 0;
+	player._hits = 0;
 	player._food = 0;
-	player._foodSubCtr = 0;
 	player._experience = 0;
-	player._gold = 0;
+	player._coins = 0;
 
 	message("DEAD");
 }
diff --git a/engines/ultima/ultima1/data/game.h b/engines/ultima/ultima1/data/game.h
index 1e4163761ac..2b0546d1b1a 100644
--- a/engines/ultima/ultima1/data/game.h
+++ b/engines/ultima/ultima1/data/game.h
@@ -59,7 +59,7 @@ public:
 	void endOfTurn();
 
 	/**
-	 * Subtract food fraction from the player
+	 * Subtract food from the player
 	 */
 	void subtractFoodCtr(int amount);
 
diff --git a/engines/ultima/ultima1/data/map.cpp b/engines/ultima/ultima1/data/map.cpp
index 43126171993..25cf0be6ae8 100644
--- a/engines/ultima/ultima1/data/map.cpp
+++ b/engines/ultima/ultima1/data/map.cpp
@@ -41,8 +41,8 @@ void Map::load(int mapNum) {
 	f.read(_tiles, MAP_WIDTH * MAP_HEIGHT);
 
 	// Set up copies of the map position and player tile to use
-	_mapX = player._mapX;
-	_mapY = player._mapY;
+	_mapX = player._position.x;
+	_mapY = player._position.y;
 	_playerTileId = (player._class + Data::PLAYER_TILES_OFFSET) * 2;
 	clearTiles();
 }
@@ -54,29 +54,12 @@ void Map::clearTiles() {
 
 bool Map::canMoveToTile(int tileNum) {
 	auto &game = g_engine->_game;
-	const auto &player = g_engine->_player;
 	int tileId = (tileNum & 0x7f) / 2;
 
-	if (IS_PLANET(player._mapNum) || ((uint)_mapX < Data::MAP_WIDTH && (uint)_mapY < Data::MAP_HEIGHT)) {
+	if ((uint)_mapX < Data::MAP_WIDTH && (uint)_mapY < Data::MAP_HEIGHT) {
 		// Within the bounds of the map
 		if (tileId == kTileSwamp) {
 			game.subtractHp(5);
-		} else if (tileId == kTileForcefield) {
-			if (player._hasRing) {
-				game.message("INFO", "\x8D""FIELD CAUSES 1000 DAMAGE!");
-				game.message("CIRCLE");		// Flash damage circle
-
-				game.subtractHp(1000);
-			} else {
-				game.message("INFO", "RING PROTECTS FROM FIELD!");
-				g_engine->pauseMillis();
-			}
-		}
-
-		// Check paralyzed
-		if (player._paralyzedFlag) {
-			game.message("INFO", "--PARALIZED!");
-			return true;
 		}
 
 		switch (_playerTileId / 2) {
diff --git a/engines/ultima/ultima1/data/map.h b/engines/ultima/ultima1/data/map.h
index 52d47f34e4d..379b841fd96 100644
--- a/engines/ultima/ultima1/data/map.h
+++ b/engines/ultima/ultima1/data/map.h
@@ -28,10 +28,6 @@ namespace Ultima {
 namespace Ultima1 {
 namespace Data {
 
-#define IS_PLANET(MAPNUM) ((MAPNUM % 10) == 0)
-#define IS_CITY(MAPNUM) ((MAPNUM % 10) >= 1 && (MAPNUM % 10) <= 3)
-#define IS_DUNGEON(MAPNUM) ((MAPNUM % 10) >= 4)
-
 constexpr int MAP_WIDTH = 64;
 constexpr int MAP_HEIGHT = 66;
 constexpr int MAP_VISIBLE_WIDTH = 20;
diff --git a/engines/ultima/ultima1/data/player.cpp b/engines/ultima/ultima1/data/player.cpp
index 7c5eb3f2952..e1b2e8c2f44 100644
--- a/engines/ultima/ultima1/data/player.cpp
+++ b/engines/ultima/ultima1/data/player.cpp
@@ -25,75 +25,58 @@ namespace Ultima {
 namespace Ultima1 {
 namespace Data {
 
-const char *SEX[] = { "MALE", "FEMALE", "YES PLEASE" };
-const char *RACE[] = { nullptr, "HUMAN", "ELF", "DWARF", "HOBBIT" };
-const char *CLASS[] = { nullptr, "FIGHTER", "CLERIC", "WIZARD", "THIEF" };
+const char *SEX_NAMES[] = { "Male", "Female" };
+const char *RACE_NAMES[] = { nullptr, "Human", "Elf", "Dwarf", "Bobbit" };
+const char *CLASS_NAMES[] = { nullptr, "Fighter", "Cleric", "Wizard", "Thief" };
 
 void Player::synchronize(Common::Serializer &s) {
-	// Sync name
-	s.syncBytes((byte *)_name, MAX_NAME_LENGTH + 1);
-	s.skip(16 - (MAX_NAME_LENGTH + 1));
-
-	// Sex
-	byte sex = (_sex == SEX_MALE) ? 'M' : 'F';
-	s.syncAsByte(sex);
-	if (s.isLoading())
-		_sex = (sex == 'M') ? SEX_MALE : SEX_FEMALE;
-
-	// Class and race
-	s.syncAsByte(_class);
+	s.syncBytes((byte *)_name, MAX_NAME_LENGTH + 2);
 	s.syncAsByte(_race);
+	s.syncAsByte(_class);
+	s.syncAsByte(_sex);
 
-	// Map number is saved as two separate bytes
-	byte map1 = _mapNum / 10, map2 = _mapNum % 10;
-	s.syncAsByte(map1);
-	s.syncAsByte(map2);
-	if (s.isLoading())
-		_mapNum = (map1 * 10) + map2;
+	s.syncAsSint16LE(_hits);
+	s.syncAsSint16LE(_strength);
+	s.syncAsSint16LE(_agility);
+	s.syncAsSint16LE(_stamina);
+	s.syncAsSint16LE(_charisma);
+	s.syncAsSint16LE(_wisdom);
+	s.syncAsSint16LE(_intelligence);
 
-	// Attributes
-	syncByte(s, _strength);
-	syncByte(s, _agility);
-	syncByte(s, _stamina);
-	syncByte(s, _charisma);
-	syncByte(s, _wisdom);
-	syncByte(s, _intelligence);
-	syncWord(s, _hp);
-	syncWord(s, _food);
-	s.syncAsByte(_foodSubCtr);
-	s.skip(1);
-	syncWord(s, _experience);
-	syncWord(s, _gold);
-	syncWord(s, _food);
+	s.syncAsSint16LE(_coins);
+	s.syncAsSint16LE(_experience);
+	s.syncAsSint16LE(_food);
 
-	syncByte(s, _mapX);
-	syncByte(s, _mapY);
+	s.syncAsSint16LE(_equippedWeapon);
+	s.syncAsSint16LE(_equippedSpell);
+	s.syncAsSint16LE(_equippedArmor);
+	s.syncAsSint16LE(_transportType);
 
-	s.syncAsByte(_hasRing);
+	s.syncAsSint16LE(_randomSeed);
+	s.syncAsSint16LE(_position.x);
+	s.syncAsSint16LE(_position.y);
+	s.syncAsByte(_soundOn);
 
-	if (s.isLoading()) {
-		_paralyzedFlag = 0;
-	}
-}
+	for (int i = 0; i < QUEST_COUNT; ++i)
+		s.syncAsSint16LE(_quests[i]);
 
-void Player::syncByte(Common::Serializer &s, byte &v) {
-	byte tmp = ((v / 10) << 4) | (v % 10);
-	s.syncAsByte(tmp);
-	if (s.isLoading())
-		v = ((tmp >> 4) * 10) + (tmp & 0xf);
-}
+	s.syncAsSint16LE(_redGems);
+	s.syncAsSint16LE(_greenGems);
+	s.syncAsSint16LE(_blueGem);
+	s.syncAsSint16LE(_whiteGem);
+
+	for (int i = 0; i < ARMOR_COUNT; ++i)
+		s.syncAsSint16LE(_armor[i]);
+	for (int i = 0; i < WEAPON_COUNT; ++i)
+		s.syncAsSint16LE(_weapons[i]);
+	for (int i = 0; i < SPELL_COUNT; ++i)
+		s.syncAsSint16LE(_spells[i]);
+	for (int i = 0; i < TRANSPORT_COUNT; ++i)
+		s.syncAsSint16LE(_transports[i]);
 
-void Player::syncWord(Common::Serializer &s, uint16 &v) {
-	byte tmp[2];
-	if (s.isLoading()) {
-		s.syncBytes(tmp, 2);
-		v = ((tmp[0] >> 4) * 1000) + ((tmp[0] & 0xf) * 100) +
-			((tmp[1] >> 4) * 10) + (tmp[1] & 0xf);
-	} else {
-		tmp[0] = ((v / 1000) << 4) | ((v % 1000) / 100);
-		tmp[1] = ((v / 10) << 4) | (v % 10);
-		s.syncBytes(tmp, 2);
-	}
+	s.syncAsSint16LE(_enemyVessels);
+	s.syncAsSint16LE(_signMarker);
+	s.syncAsSint16LE(_moveCount);
 }
 
 } // namespace Data
diff --git a/engines/ultima/ultima1/data/player.h b/engines/ultima/ultima1/data/player.h
index a0025a3740a..37b46925629 100644
--- a/engines/ultima/ultima1/data/player.h
+++ b/engines/ultima/ultima1/data/player.h
@@ -22,73 +22,119 @@
 #ifndef ULTIMA1_DATA_PLAYER_H
 #define ULTIMA1_DATA_PLAYER_H
 
+#include "common/rect.h"
 #include "common/serializer.h"
 
 namespace Ultima {
 namespace Ultima1 {
 namespace Data {
 
-constexpr int MAX_NAME_LENGTH = 12;
+constexpr int MAX_NAME_LENGTH = 14;
+constexpr int QUEST_COUNT = 9;
 
-extern const char *SEX[];
-extern const char *RACE[];
-extern const char *CLASS[];
+extern const char *SEX_NAMES[];
+extern const char *RACE_NAMES[];
+extern const char *CLASS_NAMES[];
 
 enum Sex {
-	SEX_MALE, SEX_FEMALE
+	SEX_MALE = 0, SEX_FEMALE = 1
 };
 enum Race {
-	RACE_HUMAN = 1, RACE_ELF = 2, RACE_DWARF = 3, RACE_HOBBIT = 4
+	RACE_HUMAN = 1, RACE_ELF = 2, RACE_DWARF = 3, RACE_BOBBIT = 4
 };
-enum Class {
+enum CharClass {
 	CLASS_FIGHTER = 1, CLASS_CLERIC = 2, CLASS_WIZARD = 3, CLASS_THIEF = 4
 };
 
-struct Player {
-private:
-	/**
-	 * Synchronizes a byte value. In original Ultima II, byte values store
-	 * the tens in the upper 4 bits, and the 0-9 portion in the low 4 bits.
-	 */
-	void syncByte(Common::Serializer &s, byte &v);
-
-	/**
-	 * Synchronizes a uint16 value. In original Ultima II, uint16 values store
-	 * 4 digits each in 4-bit portions of their own.
-	 */
-	void syncWord(Common::Serializer &s, uint16 &v);
-
-public:
-	char _name[MAX_NAME_LENGTH + 1] = {};
-	byte _sex = SEX_MALE;
-	byte _class = CLASS_FIGHTER;
-	byte _race = RACE_HUMAN;
-	byte _mapNum = 20;
+// Indexes into _armor. Index 0 isn't a real item - it mirrors the
+// unexplained sentinel field seen immediately before the named item
+// slots in the original armor/weapon/spell/transport lists
+enum ArmorType {
+	ARMOR_NONE = 0, ARMOR_LEATHER = 1, ARMOR_CHAINMAIL = 2, ARMOR_PLATE_MAIL = 3,
+	ARMOR_VACUUM_SUIT = 4, ARMOR_REFLECT_SUIT = 5, ARMOR_COUNT = 6
+};
 
-	byte _strength = 0;
-	byte _agility = 0;
-	byte _stamina = 0;
-	byte _charisma = 0;
-	byte _wisdom = 0;
-	byte _intelligence = 0;
-	uint16 _hp = 400;
-	uint16 _food = 400;
-	byte _foodSubCtr = 87;
-	uint16 _experience = 0;
-	uint16 _gold = 400;
+// Indexes into _weapons
+enum WeaponType {
+	WEAPON_NONE = 0, WEAPON_DAGGER = 1, WEAPON_MACE = 2, WEAPON_AXE = 3,
+	WEAPON_ROPE_AND_SPIKES = 4, WEAPON_SWORD = 5, WEAPON_GREAT_SWORD = 6, WEAPON_BOW = 7,
+	WEAPON_AMULET = 8, WEAPON_WAND = 9, WEAPON_STAFF = 10, WEAPON_TRIANGLE = 11,
+	WEAPON_PISTOL = 12, WEAPON_LIGHT_SWORD = 13, WEAPON_PHAZOR = 14, WEAPON_BLASTER = 15,
+	WEAPON_COUNT = 16
+};
 
-	byte _mapX = 20;
-	byte _mapY = 20;
-	byte _field3E = 0xff;
+// Indexes into _spells
+enum SpellType {
+	SPELL_NONE = 0, SPELL_OPEN = 1, SPELL_UNLOCK = 2, SPELL_MAGIC_MISSILE = 3, SPELL_STEAL = 4,
+	SPELL_LADDER_DOWN = 5, SPELL_LADDER_UP = 6, SPELL_BLINK = 7, SPELL_CREATE = 8,
+	SPELL_DESTROY = 9, SPELL_KILL = 10, SPELL_COUNT = 11
+};
 
-	bool _hasRing = false;
+// Indexes into _transports
+enum TransportType {
+	TRANSPORT_FOOT = 0, TRANSPORT_HORSE = 1, TRANSPORT_CART = 2, TRANSPORT_RAFT = 3,
+	TRANSPORT_FRIGATE = 4, TRANSPORT_AIRCAR = 5, TRANSPORT_SHUTTLE = 6, TRANSPORT_TIME_MACHINE = 7,
+	TRANSPORT_COUNT = 8
+};
 
-	// Runtime only fields
-	byte _paralyzedFlag = 0;
+/**
+ * The player character's savegame data
+ */
+struct Player {
+	// Identity
+	char _name[MAX_NAME_LENGTH + 2] = {};
+	byte _race = RACE_HUMAN;
+	byte _class = CLASS_FIGHTER;
+	byte _sex = SEX_MALE;
+
+	// Attributes
+	int16 _hits = 0;
+	int16 _strength = 0;
+	int16 _agility = 0;
+	int16 _stamina = 0;
+	int16 _charisma = 0;
+	int16 _wisdom = 0;
+	int16 _intelligence = 0;
+
+	// Resources
+	int16 _coins = 0;
+	int16 _experience = 0;
+	int16 _food = 0;
+
+	// Currently equipped/readied items
+	int16 _equippedWeapon = WEAPON_NONE;
+	int16 _equippedSpell = SPELL_NONE;
+	int16 _equippedArmor = ARMOR_NONE;
+	int16 _transportType = TRANSPORT_FOOT;
+
+	int16 _randomSeed = 0;
+	Common::Point _position;
+	bool _soundOn = true;
+
+	// Quest completion flags, one per town/dungeon
+	int16 _quests[QUEST_COUNT] = {};
+
+	// Gems
+	int16 _redGems = 0;
+	int16 _greenGems = 0;
+	int16 _blueGem = 0;
+	int16 _whiteGem = 0;
+
+	// Inventory quantities owned, indexed by the enums above. Index 0 of
+	// each isn't a real item quantity
+	int16 _armor[ARMOR_COUNT] = {};
+	int16 _weapons[WEAPON_COUNT] = {};
+	int16 _spells[SPELL_COUNT] = {};
+	int16 _transports[TRANSPORT_COUNT] = {};
+
+	int16 _enemyVessels = 0;
+	int16 _signMarker = -1;
+	int16 _moveCount = 0;
 
 	void synchronize(Common::Serializer &s);
+
 	bool isDead() const {
-		return _hp > 0;
+		return _hits <= 0;
 	}
 };
 
diff --git a/engines/ultima/ultima1/gfx/text_input.cpp b/engines/ultima/ultima1/gfx/text_input.cpp
new file mode 100644
index 00000000000..98953f4e89b
--- /dev/null
+++ b/engines/ultima/ultima1/gfx/text_input.cpp
@@ -0,0 +1,97 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "ultima/ultima1/gfx/text_input.h"
+#include "ultima/shared/gfx/rect.h"
+
+namespace Ultima {
+namespace Ultima1 {
+namespace Gfx {
+
+TextInput::TextInput(const Common::String &name, UIElement *parent, TextCursor &cursor) :
+		UIElement(name, parent), _cursor(cursor) {
+}
+
+void TextInput::setPosition(const Common::Point &pt, int maxWidth) {
+	_pos = pt;
+	_maxWidth = maxWidth;
+	setBounds(TextRect(pt.x, pt.y, pt.x + maxWidth, pt.y));
+
+	_text.clear();
+	_visible = true;
+	updateCursor();
+}
+
+void TextInput::hide() {
+	_visible = false;
+	_cursor.hide();
+	redraw();
+}
+
+void TextInput::updateCursor() {
+	_cursor.setPosition(Common::Point(_pos.x + _text.size(), _pos.y));
+	_cursor.show();
+}
+
+void TextInput::draw() {
+	if (!_visible)
+		return;
+
+	auto s = getSurface();
+	s.clear();
+	s.setColor(_color);
+	s.writeString(_text);
+}
+
+bool TextInput::msgUnfocus(const UnfocusMessage &msg) {
+	hide();
+	return true;
+}
+
+bool TextInput::msgKeypress(const KeypressMessage &msg) {
+	if (!_visible)
+		return false;
+
+	if (Common::isPrint(msg.ascii) && (int)_text.size() < _maxWidth) {
+		_text += (char)msg.ascii;
+		updateCursor();
+		redraw();
+		return true;
+
+	} else if (msg.keycode == Common::KEYCODE_BACKSPACE || msg.keycode == Common::KEYCODE_DELETE) {
+		if (!_text.empty()) {
+			_text.deleteLastChar();
+			updateCursor();
+			redraw();
+		}
+		return true;
+
+	} else if (msg.keycode == Common::KEYCODE_RETURN || msg.keycode == Common::KEYCODE_KP_ENTER) {
+		_parent->send(GameMessage("INPUT", _text));
+		return true;
+	}
+
+	return false;
+}
+
+} // namespace Gfx
+} // namespace Ultima1
+} // namespace Ultima
diff --git a/engines/ultima/ultima1/gfx/text_input.h b/engines/ultima/ultima1/gfx/text_input.h
new file mode 100644
index 00000000000..33edb4b185f
--- /dev/null
+++ b/engines/ultima/ultima1/gfx/text_input.h
@@ -0,0 +1,91 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef ULTIMA1_GFX_TEXT_INPUT_H
+#define ULTIMA1_GFX_TEXT_INPUT_H
+
+#include "ultima/shared/engine/events.h"
+#include "ultima/ultima1/gfx/text_cursor.h"
+
+namespace Ultima {
+namespace Ultima1 {
+namespace Gfx {
+
+using namespace Shared::Messages;
+
+/**
+ * Simple text entry field. Accepts printable characters up to a maximum
+ * width and backspace to delete; Enter sends a GameMessage named "INPUT"
+ * to its parent, with the entered text as the string parameter.
+ *
+ * Rather than drawing its own caret, it drives a shared TextCursor -
+ * positioned just after the last typed character - so the same cursor
+ * animation is used consistently, whether it's parked at a prompt or
+ * following text as it's typed.
+ */
+class TextInput : public Shared::UIElement {
+private:
+	Common::String _text;
+	Common::Point _pos;
+	int _maxWidth = 0;
+	bool _visible = false;
+	byte _color = 15;
+	TextCursor &_cursor;
+
+	/**
+	 * Repositions the cursor to just after the last typed character
+	 */
+	void updateCursor();
+
+public:
+	TextInput(const Common::String &name, UIElement *parent, TextCursor &cursor);
+	~TextInput() override {}
+
+	void draw() override;
+	bool msgKeypress(const KeypressMessage &msg) override;
+	bool msgUnfocus(const UnfocusMessage &msg) override;
+
+	/**
+	 * Positions the field and shows it ready for input, clearing any
+	 * previously entered text. The field's bounds are sized one
+	 * character wider than maxWidth, to leave room for the cursor when
+	 * the text is at its maximum length
+	 */
+	void setPosition(const Common::Point &pt, int maxWidth);
+
+	/**
+	 * Hides the field
+	 */
+	void hide();
+
+	/**
+	 * Sets the color the entered text is drawn in
+	 */
+	void setColor(byte color) {
+		_color = color;
+	}
+};
+
+} // namespace Gfx
+} // namespace Ultima1
+} // namespace Ultima
+
+#endif
diff --git a/engines/ultima/ultima1/ultima1.cpp b/engines/ultima/ultima1/ultima1.cpp
index fb276219c47..d4c7fee68b7 100644
--- a/engines/ultima/ultima1/ultima1.cpp
+++ b/engines/ultima/ultima1/ultima1.cpp
@@ -68,12 +68,7 @@ Common::Error Ultima1Engine::run() {
 }
 
 Common::Error Ultima1Engine::syncGame(Common::Serializer &s) {
-	// The Serializer has methods isLoading() and isSaving()
-	// if you need to specific steps; for example setting
-	// an array size after reading it's length, whereas
-	// for saving it would write the existing array's length
-	int dummy = 0;
-	s.syncAsUint32LE(dummy);
+	_player.synchronize(s);
 
 	return Common::kNoError;
 }
diff --git a/engines/ultima/ultima1/views/create_character.cpp b/engines/ultima/ultima1/views/create_character.cpp
index 86a37906092..5190f09abc5 100644
--- a/engines/ultima/ultima1/views/create_character.cpp
+++ b/engines/ultima/ultima1/views/create_character.cpp
@@ -28,187 +28,389 @@ namespace Views {
 
 using namespace Data;
 
-static const byte POS[][2] = {
-	{ 26, 4 }, { 26, 5 }, { 26, 6 }, { 26, 7 }, { 26, 8 }, { 26, 9 },
-	{ 20, 11 }, { 20, 12 }, { 20, 13 }, { 20, 14 }, { 29, 16 }
-};
+// Colors used
+constexpr int COLOR_EDGE = 15; // white
+constexpr int COLOR_TEXT = 11; // light cyan
+
+// Pads a label out with dots to a fixed width, matching the original's
+// dot-leader alignment for the attribute list
+static Common::String padLabel(const Common::String &label, int width) {
+	Common::String result = label;
+	while ((int)result.size() < width)
+		result += '.';
+	return result;
+}
+
+CreateCharacter::CreateCharacter() : Dialog("CreateCharacter"),
+		_cursor("Cursor", this), _nameInput("NameInput", this, _cursor) {
+	// Hidden until race/sex/class/save selection needs it
+	_cursor.hide();
+	_nameInput.setColor(COLOR_TEXT);
+}
 
 bool CreateCharacter::msgFocus(const FocusMessage &msg) {
 	reset();
-	return true;
+	return View::msgFocus(msg);
 }
 
 void CreateCharacter::reset() {
-	_cursorIndex = 0;
-	_pointsRemaining = POINTS_REMAINING;
-	_cursor.show(Point(POS[0][0], POS[0][1]), 2, true);
+	Player &p = g_engine->_player;
+	p._strength = p._agility = p._stamina = p._charisma = p._wisdom = p._intelligence = 10;
+
+	_pointsRemaining = STARTING_POINTS;
+	_selectedAttribute = 0;
+	_state = ATTRIBUTES;
+	_cursor.hide();
+	redraw();
 }
 
-void CreateCharacter::done() {
-	// Unlike the original that took you back to the title screen after
-	// creating a character, since in ScummVM we allow multiple savegames,
-	// take the player directly in-game
-	g_engine->_game.startGame();
+int16 &CreateCharacter::attribute(int index) {
+	Player &p = g_engine->_player;
+	switch (index) {
+	case 0: return p._strength;
+	case 1: return p._agility;
+	case 2: return p._stamina;
+	case 3: return p._charisma;
+	case 4: return p._wisdom;
+	default: return p._intelligence;
+	}
 }
 
 void CreateCharacter::draw() {
-	const Player &p = g_engine->_player;
 	auto s = getSurface();
 	s.clear();
+	drawFrame();
 
-	s.writeString(Point(0, 0), "          PLAYER GENERATION :");
-	s.writeString(Point(0, 2), "     POINTS LEFT TO DISTRIBUTE : ");
-
-	// Display points remaining in reverse text
-	s.reverseColor();
-	s.writeString(Common::String::format("%.2d", _pointsRemaining));
-	s.reverseColor();
-
-	s.writeString(Point(0, 4), "           STRENGTH.......\n"
-		"           AGILITY........\n"
-		"           STAMINA........\n"
-		"           CHARISMA.......\n"
-		"           WISDOM.........\n"
-		"           INTELLIGENCE...\n\n"
-		"                M/F-\n"
-		"               RACE-\n"
-		"               TYPE-\n"
-		"               NAME-\n\n"
-		"          SATISFACTORY (Y/N)-\n\n"
-		"        RACES:         TYPES:\n"
-		"         1-HUMAN        1-FIGHTER\n"
-		"         2-ELF          2-CLERIC\n"
-		"         3-DWARF        3-WIZARD\n"
-		"         4-HOBBIT       4-THIEF");
-
-	// Attributes
-	if (_cursorIndex > 0)
-		s.writeString(Point(POS[0][0], POS[0][1]), Common::String::format("%.2d", p._strength));
-	if (_cursorIndex > 1)
-		s.writeString(Point(POS[1][0], POS[1][1]), Common::String::format("%.2d", p._agility));
-	if (_cursorIndex > 2)
-		s.writeString(Point(POS[2][0], POS[2][1]), Common::String::format("%.2d", p._stamina));
-	if (_cursorIndex > 3)
-		s.writeString(Point(POS[3][0], POS[3][1]), Common::String::format("%.2d", p._charisma));
-	if (_cursorIndex > 4)
-		s.writeString(Point(POS[4][0], POS[4][1]), Common::String::format("%.2d", p._wisdom));
-	if (_cursorIndex > 5)
-		s.writeString(Point(POS[5][0], POS[5][1]), Common::String::format("%.2d", p._intelligence));
-
-	// Other fields
-	if (_cursorIndex > 6)
-		s.writeString(Point(POS[6][0], POS[6][1]), SEX[p._sex]);
-	if (_cursorIndex > 7)
-		s.writeString(Point(POS[7][0], POS[7][1]), RACE[p._race]);
-	if (_cursorIndex > 8)
-		s.writeString(Point(POS[8][0], POS[8][1]), CLASS[p._class]);
-	if (_cursorIndex > 9)
-		s.writeString(Point(POS[9][0], POS[9][1]), p._name);
-}
+	drawRightArrow(Common::Point(8, 0));
+	s.setColor(COLOR_EDGE);
+	s.writeString(Common::Point(9, 0), " Character Generation ");
+	drawLeftArrow(Common::Point(31, 0));
 
-bool CreateCharacter::msgGame(const GameMessage &msg) {
-	if (msg._name != "INPUT")
-		return false;
+	drawAttributes(s);
 
-	Player &p = g_engine->_player;
-	char key = msg._stringValue.empty() ? 0 : toupper(msg._stringValue.firstChar());
-	int num = atoi(msg._stringValue.c_str());
-
-	switch (_cursorIndex) {
-	case 6:
-		if (key == 'M') {
-			p._sex = SEX_MALE;
-			p._strength += 5;		// Men are stronger
-			++_cursorIndex;
-		} else if (key == 'F') {
-			p._sex = SEX_FEMALE;
-			p._charisma += 10;		// Women are prettier
-			++_cursorIndex;
-		}
+	switch (_state) {
+	case ATTRIBUTES:
+		s.setColor(COLOR_TEXT);
+		s.writeString(Common::Point(6, 4),
+			Common::String::format("Points left to distribute: %d", _pointsRemaining));
+		drawHelp(s);
+		drawRightArrow(Common::Point(11, _selectedAttribute + 6));
+		drawLeftArrow(Common::Point(30, _selectedAttribute + 6));
 		break;
-	case 7:
-		if (num >= 1 && num <= 4) {
-			p._race = (Race)num;
-			++_cursorIndex;
-
-			switch (p._race) {
-			case RACE_HUMAN:
-				p._intelligence += 5;
-				break;
-			case RACE_ELF:
-				p._agility += 5;
-				break;
-			case RACE_DWARF:
-				p._strength += 5;
-				break;
-			case RACE_HOBBIT:
-				p._wisdom += 10;
-				break;
-			}
-		}
+
+	case RACE:
+		s.setColor(COLOR_TEXT);
+		s.writeString(Common::Point(3, 17), "Select thy race: ");
+		s.writeString(Common::Point(12, 19), "a) Human");
+		s.writeString(Common::Point(12, 20), "b) Elf");
+		s.writeString(Common::Point(12, 21), "c) Dwarf");
+		s.writeString(Common::Point(12, 22), "d) Bobbit");
 		break;
-	case 8:
-		if (num >= 1 && num <= 4) {
-			p._class = (Class)num;
-			++_cursorIndex;
-
-			switch (p._class) {
-			case CLASS_FIGHTER:
-				p._strength += 15;
-				break;
-			case CLASS_CLERIC:
-				p._wisdom += 10;
-				break;
-			case CLASS_WIZARD:
-				p._intelligence += 10;
-				break;
-			case CLASS_THIEF:
-				p._agility += 10;
-				break;
-			}
-		}
+
+	case SEX:
+		drawConfirmedRace(s);
+		s.setColor(COLOR_TEXT);
+		s.writeString(Common::Point(3, 17), "Select thy sex: ");
+		s.writeString(Common::Point(12, 19), "a) Male");
+		s.writeString(Common::Point(12, 20), "b) Female");
+		break;
+
+	case CLASS:
+		drawConfirmedRace(s);
+		drawConfirmedSex(s);
+		s.setColor(COLOR_TEXT);
+		s.writeString(Common::Point(3, 17), "Select thy class: ");
+		s.writeString(Common::Point(12, 19), "a) Fighter");
+		s.writeString(Common::Point(12, 20), "b) Cleric");
+		s.writeString(Common::Point(12, 21), "c) Wizard");
+		s.writeString(Common::Point(12, 22), "d) Thief");
+		break;
+
+	case NAME:
+		drawConfirmedRace(s);
+		drawConfirmedSex(s);
+		drawConfirmedClass(s);
+		s.setColor(COLOR_TEXT);
+		s.writeString(Common::Point(3, 17), "Enter thy name: ");
 		break;
-	case 9:
-		strcpy_s(p._name, msg._stringValue.c_str());
-		++_cursorIndex;
+
+	case SAVE:
+		drawConfirmedRace(s);
+		drawConfirmedSex(s);
+		drawConfirmedClass(s);
+		s.setColor(COLOR_TEXT);
+		s.writeString(Common::Point(12, 4), g_engine->_player._name);
+		s.writeString(Common::Point(3, 22), "Use this character? (Y-N) ");
 		break;
-	case 10:
-		if (key == 'Y') {
-			done();
-		} else {
-			reset();
+	}
+}
+
+void CreateCharacter::drawAttributes(Shared::Gfx::GfxSurface &s) {
+	const Player &p = g_engine->_player;
+	s.setColor(COLOR_TEXT);
+
+	s.writeString(Common::Point(12, 6), padLabel("Strength", 16) + Common::String::format("%2d", p._strength));
+	s.writeString(Common::Point(12, 7), padLabel("Agility", 16) + Common::String::format("%2d", p._agility));
+	s.writeString(Common::Point(12, 8), padLabel("Stamina", 16) + Common::String::format("%2d", p._stamina));
+	s.writeString(Common::Point(12, 9), padLabel("Charisma", 16) + Common::String::format("%2d", p._charisma));
+	s.writeString(Common::Point(12, 10), padLabel("Wisdom", 16) + Common::String::format("%2d", p._wisdom));
+	s.writeString(Common::Point(12, 11), padLabel("Intelligence", 16) + Common::String::format("%2d", p._intelligence));
+}
+
+void CreateCharacter::drawHelp(Shared::Gfx::GfxSurface &s) {
+	s.setColor(COLOR_TEXT);
+	s.writeString(Common::Point(2, 16), "Move cursor with up and down arrows;");
+	s.writeString(Common::Point(2, 17), "increase and decrease attributes");
+	s.writeString(Common::Point(2, 18), "with left and right arrows.  Press");
+	s.writeString(Common::Point(2, 19), "space bar when finished, or escape");
+	s.writeString(Common::Point(2, 20), "to return to the main menu.");
+}
+
+void CreateCharacter::drawConfirmedRace(Shared::Gfx::GfxSurface &s) {
+	s.setColor(COLOR_TEXT);
+	s.writeString(Common::Point(14, 13),
+		Common::String::format("Race: %s", RACE_NAMES[g_engine->_player._race]));
+}
+
+void CreateCharacter::drawConfirmedSex(Shared::Gfx::GfxSurface &s) {
+	s.setColor(COLOR_TEXT);
+	s.writeString(Common::Point(15, 14),
+		Common::String::format("Sex: %s", SEX_NAMES[g_engine->_player._sex]));
+}
+
+void CreateCharacter::drawConfirmedClass(Shared::Gfx::GfxSurface &s) {
+	s.setColor(COLOR_TEXT);
+	s.writeString(Common::Point(13, 15),
+		Common::String::format("Class: %s", CLASS_NAMES[g_engine->_player._class]));
+}
+
+bool CreateCharacter::msgKeypress(const KeypressMessage &msg) {
+	switch (_state) {
+	case ATTRIBUTES:
+		return msgAttributesKey(msg);
+	case RACE:
+		return msgRaceKey(msg);
+	case SEX:
+		return msgSexKey(msg);
+	case CLASS:
+		return msgClassKey(msg);
+	case NAME:
+		// Let it fall through to the name text input child
+		return View::msgKeypress(msg);
+	case SAVE:
+		return msgSaveKey(msg);
+	}
+
+	return false;
+}
+
+bool CreateCharacter::msgAttributesKey(const KeypressMessage &msg) {
+	switch (msg.keycode) {
+	case Common::KEYCODE_UP:
+		_selectedAttribute = (_selectedAttribute == 0) ? ATTRIBUTE_COUNT - 1 : _selectedAttribute - 1;
+		redraw();
+		return true;
+
+	case Common::KEYCODE_DOWN:
+		_selectedAttribute = (_selectedAttribute == ATTRIBUTE_COUNT - 1) ? 0 : _selectedAttribute + 1;
+		redraw();
+		return true;
+
+	case Common::KEYCODE_LEFT:
+		if (attribute(_selectedAttribute) > 10) {
+			--attribute(_selectedAttribute);
+			++_pointsRemaining;
+			redraw();
 		}
 		return true;
-	default:
-		// Attributes
-		switch (_cursorIndex) {
-		case 0: p._strength = num; break;
-		case 1: p._agility = num; break;
-		case 2: p._stamina = num; break;
-		case 3: p._charisma = num; break;
-		case 4: p._wisdom = num; break;
-		default: p._intelligence = num; break;
+
+	case Common::KEYCODE_RIGHT:
+		if (_pointsRemaining > 0 && attribute(_selectedAttribute) < 25) {
+			++attribute(_selectedAttribute);
+			--_pointsRemaining;
+			redraw();
 		}
+		return true;
 
-		_pointsRemaining -= num;
-		if (_pointsRemaining < 0) {
-			reset();
-		} else {
-			++_cursorIndex;
+	case Common::KEYCODE_SPACE:
+		if (_pointsRemaining == 0) {
+			_state = RACE;
+			_cursor.setPosition(Common::Point(20, 17));
+			_cursor.show();
+			redraw();
 		}
+		return true;
+
+	case Common::KEYCODE_ESCAPE:
+		replaceView("MainMenu");
+		return true;
+
+	default:
+		return false;
+	}
+}
+
+bool CreateCharacter::msgRaceKey(const KeypressMessage &msg) {
+	char key = toupper(msg.ascii);
+	if (key < 'A' || key > 'D')
+		return false;
+
+	selectRace(key - 'A' + 1);
+	return true;
+}
+
+bool CreateCharacter::msgSexKey(const KeypressMessage &msg) {
+	char key = toupper(msg.ascii);
+	if (key != 'A' && key != 'B')
+		return false;
+
+	selectSex(key == 'A' ? SEX_MALE : SEX_FEMALE);
+	return true;
+}
+
+bool CreateCharacter::msgClassKey(const KeypressMessage &msg) {
+	char key = toupper(msg.ascii);
+	if (key < 'A' || key > 'D')
+		return false;
+
+	selectClass(key - 'A' + 1);
+	return true;
+}
+
+bool CreateCharacter::msgSaveKey(const KeypressMessage &msg) {
+	char key = toupper(msg.ascii);
+	if (key == 'Y') {
+		confirmAndSave();
+		return true;
+	} else if (key == 'N') {
+		reset();
+		return true;
+	}
+
+	return false;
+}
+
+void CreateCharacter::selectRace(int race) {
+	Player &p = g_engine->_player;
+	p._race = race;
+
+	switch (race) {
+	case RACE_HUMAN:
+		p._intelligence += 5;
+		break;
+	case RACE_ELF:
+		p._agility += 5;
+		break;
+	case RACE_DWARF:
+		p._strength += 5;
+		break;
+	case RACE_BOBBIT:
+		p._wisdom += 10;
+		p._strength -= 5;
+		break;
+	default:
 		break;
 	}
 
-	// Set the new cursor position
-	if (_cursorIndex < 6)
-		_cursor.show(Point(POS[_cursorIndex][0], POS[_cursorIndex][1]), 2, true);
-	else if (_cursorIndex == 9)
-		_cursor.show(Point(POS[_cursorIndex][0], POS[_cursorIndex][1]), MAX_NAME_LENGTH);
-	else
-		_cursor.show(Point(POS[_cursorIndex][0], POS[_cursorIndex][1]), 1);
+	_state = SEX;
+	_cursor.setPosition(Common::Point(19, 17));
+	redraw();
+}
+
+void CreateCharacter::selectSex(int sex) {
+	g_engine->_player._sex = sex;
 
+	_state = CLASS;
+	_cursor.setPosition(Common::Point(21, 17));
 	redraw();
-	return true;
+}
+
+void CreateCharacter::selectClass(int charClass) {
+	Player &p = g_engine->_player;
+	p._class = charClass;
+
+	switch (charClass) {
+	case CLASS_FIGHTER:
+		p._strength += 10;
+		p._agility += 10;
+		break;
+	case CLASS_CLERIC:
+		p._wisdom += 10;
+		break;
+	case CLASS_WIZARD:
+		p._intelligence += 10;
+		break;
+	case CLASS_THIEF:
+		p._agility += 10;
+		break;
+	default:
+		break;
+	}
+
+	_state = NAME;
+	_nameInput.setPosition(Common::Point(19, 17), MAX_NAME_LENGTH);
+	redraw();
+}
+
+bool CreateCharacter::msgGame(const GameMessage &msg) {
+	if (_state == NAME && msg._name == "INPUT" && !msg._stringValue.empty()) {
+		strcpy_s(g_engine->_player._name, msg._stringValue.c_str());
+
+		_nameInput.hide();
+		_state = SAVE;
+		_cursor.setPosition(Common::Point(29, 22));
+		_cursor.show();
+		redraw();
+		return true;
+	}
+
+	return false;
+}
+
+void CreateCharacter::confirmAndSave() {
+	Player &p = g_engine->_player;
+
+	p._randomSeed = getRandomNumber(0x7fff) + p._wisdom + p._class;
+	p._hits = 150;
+	p._coins = 100;
+	p._experience = 0;
+	p._food = 200;
+	p._equippedWeapon = WEAPON_DAGGER;
+	p._equippedSpell = SPELL_NONE;
+	p._equippedArmor = ARMOR_LEATHER;
+	p._transportType = TRANSPORT_FOOT;
+	p._position = Common::Point(49, 40);
+	p._soundOn = true;
+
+	for (int i = 0; i < QUEST_COUNT; ++i)
+		p._quests[i] = 0;
+	p._redGems = p._greenGems = p._blueGem = p._whiteGem = 0;
+
+	for (int i = 0; i < ARMOR_COUNT; ++i)
+		p._armor[i] = 0;
+	p._armor[0] = -1;
+	p._armor[ARMOR_LEATHER] = 1;
+
+	for (int i = 0; i < WEAPON_COUNT; ++i)
+		p._weapons[i] = 0;
+	p._weapons[0] = -1;
+	p._weapons[WEAPON_DAGGER] = 2;
+
+	for (int i = 0; i < SPELL_COUNT; ++i)
+		p._spells[i] = 0;
+	p._spells[0] = -1;
+
+	for (int i = 0; i < TRANSPORT_COUNT; ++i)
+		p._transports[i] = 0;
+	p._transports[0] = -1;
+
+	p._enemyVessels = 0;
+	p._signMarker = -1;
+	p._moveCount = 0;
+
+	_cursor.hide();
+
+	g_engine->_game.startGame();
 }
 
 } // namespace Views
diff --git a/engines/ultima/ultima1/views/create_character.h b/engines/ultima/ultima1/views/create_character.h
index 749018b14ff..4e417a13f2a 100644
--- a/engines/ultima/ultima1/views/create_character.h
+++ b/engines/ultima/ultima1/views/create_character.h
@@ -22,33 +22,72 @@
 #ifndef ULTIMA1_VIEWS_CREATE_CHARACTER_H
 #define ULTIMA1_VIEWS_CREATE_CHARACTER_H
 
-#include "ultima/shared/gfx/view.h"
-#include "ultima/shared/gfx/text_input.h"
+#include "ultima/ultima1/gfx/text_cursor.h"
+#include "ultima/ultima1/gfx/text_input.h"
+#include "ultima/ultima1/views/dialog.h"
 
 namespace Ultima {
 namespace Ultima1 {
 namespace Views {
 
-constexpr int POINTS_REMAINING = 90;
-
 using namespace Shared::Messages;
 
-class CreateCharacter : public Shared::Gfx::View {
+constexpr int ATTRIBUTE_COUNT = 6;
+constexpr int STARTING_POINTS = 30;
+
+/**
+ * Character generation - attribute point-buy, then race/sex/class
+ * selection, name entry, and a final save confirmation.
+ */
+class CreateCharacter : public Dialog {
 private:
-	Shared::Gfx::TextInput _cursor = Shared::Gfx::TextInput("Cursor", this);
-	int _pointsRemaining = POINTS_REMAINING;
-	int _cursorIndex = 0;	// Which figure waiting input for
+	enum State {
+		ATTRIBUTES, RACE, SEX, CLASS, NAME, SAVE
+	};
+	State _state = ATTRIBUTES;
+	int _pointsRemaining = STARTING_POINTS;
+	int _selectedAttribute = 0;
+
+	Gfx::TextCursor _cursor;
+	Gfx::TextInput _nameInput;
+
+	void drawAttributes(Shared::Gfx::GfxSurface &s);
+	void drawHelp(Shared::Gfx::GfxSurface &s);
+	void drawConfirmedRace(Shared::Gfx::GfxSurface &s);
+	void drawConfirmedSex(Shared::Gfx::GfxSurface &s);
+	void drawConfirmedClass(Shared::Gfx::GfxSurface &s);
 
+	bool msgAttributesKey(const KeypressMessage &msg);
+	bool msgRaceKey(const KeypressMessage &msg);
+	bool msgSexKey(const KeypressMessage &msg);
+	bool msgClassKey(const KeypressMessage &msg);
+	bool msgSaveKey(const KeypressMessage &msg);
+
+	void selectRace(int race);
+	void selectSex(int sex);
+	void selectClass(int charClass);
+
+	int16 &attribute(int index);
+
+	/**
+	 * Resets to a freshly-generated character with default attributes
+	 */
 	void reset();
-	void done();
+
+	/**
+	 * Fills in the rest of a new character's starting stats/inventory
+	 * and saves the game
+	 */
+	void confirmAndSave();
 
 public:
-	CreateCharacter() : View("CreateCharacter") {}
+	CreateCharacter();
 	~CreateCharacter() override {}
 
 	bool msgFocus(const FocusMessage &msg) override;
 	void draw() override;
 
+	bool msgKeypress(const KeypressMessage &msg) override;
 	bool msgGame(const GameMessage &msg) override;
 };
 
diff --git a/engines/ultima/ultima1/views/dialog.cpp b/engines/ultima/ultima1/views/dialog.cpp
index d3d923d0dd7..a88648ce810 100644
--- a/engines/ultima/ultima1/views/dialog.cpp
+++ b/engines/ultima/ultima1/views/dialog.cpp
@@ -64,6 +64,39 @@ void Dialog::drawFrame() {
 		s.drawLine(NOTCH_POINTS[i].x, NOTCH_POINTS[i].y, NOTCH_POINTS[i].x, NOTCH_POINTS[i].y, COLOR_NOTCH);
 }
 
+// Per-column vertical extent of an 8x8 right-pointing triangle, tip at
+// column 7 - column 0 is the full-height flat edge, tapering down to a
+// single pixel at the tip. Used to fill the triangle solid before the
+// diagonal edge highlights are drawn on top
+static const byte ARROW_TOP[8] = { 0, 0, 1, 1, 2, 2, 3, 3 };
+static const byte ARROW_BOTTOM[8] = { 7, 6, 6, 5, 5, 4, 4, 3 };
+
+void Dialog::drawRightArrow(const Common::Point &pt) {
+	auto s = getSurface();
+	int px = pt.x * 8, py = pt.y * 8;
+
+	s.fillRect(TextRect(pt.x, pt.y, pt.x, pt.y), COLOR_NOTCH);
+
+	for (int i = 0; i < 8; ++i)
+		s.drawLine(px + i, py + ARROW_TOP[i], px + i, py + ARROW_BOTTOM[i], COLOR_BORDER);
+
+	s.drawLine(px, py, px + 7, py + 3, COLOR_EDGE);
+	s.drawLine(px + 7, py + 3, px, py + 7, COLOR_EDGE);
+}
+
+void Dialog::drawLeftArrow(const Common::Point &pt) {
+	auto s = getSurface();
+	int px = pt.x * 8, py = pt.y * 8;
+
+	s.fillRect(TextRect(pt.x, pt.y, pt.x, pt.y), COLOR_NOTCH);
+
+	for (int i = 0; i < 8; ++i)
+		s.drawLine(px + 7 - i, py + ARROW_TOP[i], px + 7 - i, py + ARROW_BOTTOM[i], COLOR_BORDER);
+
+	s.drawLine(px + 7, py, px, py + 3, COLOR_EDGE);
+	s.drawLine(px, py + 3, px + 7, py + 7, COLOR_EDGE);
+}
+
 } // namespace Views
 } // namespace Ultima1
 } // namespace Ultima
diff --git a/engines/ultima/ultima1/views/dialog.h b/engines/ultima/ultima1/views/dialog.h
index c47af92af7e..99a15030981 100644
--- a/engines/ultima/ultima1/views/dialog.h
+++ b/engines/ultima/ultima1/views/dialog.h
@@ -38,6 +38,16 @@ protected:
 	 */
 	void drawFrame();
 
+	/**
+	 * Draws a small triangular right-arrow glyph, in text-cell coordinates
+	 */
+	void drawRightArrow(const Common::Point &pt);
+
+	/**
+	 * Draws a small triangular left-arrow glyph, in text-cell coordinates
+	 */
+	void drawLeftArrow(const Common::Point &pt);
+
 public:
 	Dialog(const Common::String &name) : View(name) {}
 	~Dialog() override {}
diff --git a/engines/ultima/ultima1/views/overworld.cpp b/engines/ultima/ultima1/views/overworld.cpp
index 687cd79b356..007f3946469 100644
--- a/engines/ultima/ultima1/views/overworld.cpp
+++ b/engines/ultima/ultima1/views/overworld.cpp
@@ -43,9 +43,8 @@ void Overworld::draw() {
 }
 
 bool Overworld::msgFocus(const FocusMessage &msg) {
-	const auto &player = g_engine->_player;
 	auto &map = g_engine->_map;
-	map.load(player._mapNum);
+	map.load(0); // TODO: Ultima I's overworld is a single fixed map
 
 	return View::msgFocus(msg);
 }
diff --git a/engines/ultima/ultima1/views/stats.cpp b/engines/ultima/ultima1/views/stats.cpp
index b4d32da0e4c..0e69f136d9e 100644
--- a/engines/ultima/ultima1/views/stats.cpp
+++ b/engines/ultima/ultima1/views/stats.cpp
@@ -32,9 +32,9 @@ void Stats::draw() {
 	s.clear();
 
 	s.writeString("H.P.=");
-	if (p._hp < 100) s.reverseColor();
-	s.writeString(Common::String::format("%.4d", p._hp));
-	if (p._hp < 100) s.reverseColor();
+	if (p._hits < 100) s.reverseColor();
+	s.writeString(Common::String::format("%.4d", p._hits));
+	if (p._hits < 100) s.reverseColor();
 
 	s.writeString(Common::Point(0, 1), "FOOD=");
 	if (p._food < 100) s.reverseColor();
@@ -42,7 +42,7 @@ void Stats::draw() {
 	if (p._food < 100) s.reverseColor();
 
 	s.writeString(Common::Point(0, 2), Common::String::format("EXP.=%.4d", p._experience));
-	s.writeString(Common::Point(0, 3), Common::String::format("GOLD=%.4d", p._gold));
+	s.writeString(Common::Point(0, 3), Common::String::format("GOLD=%.4d", p._coins));
 }
 
 } // namespace Views


Commit: 50e96dac49bbc3b17df3327b40910183408dde82
    https://github.com/scummvm/scummvm/commit/50e96dac49bbc3b17df3327b40910183408dde82
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:40:45+11:00

Commit Message:
ULTIMA: ULTIMA1: Aded Overworld view frame

Changed paths:
    engines/ultima/ultima1/ultima1.cpp
    engines/ultima/ultima1/views/dialog.cpp
    engines/ultima/ultima1/views/dialog.h
    engines/ultima/ultima1/views/overworld.cpp
    engines/ultima/ultima1/views/overworld.h
    engines/ultima/ultima1/views/stats.cpp
    engines/ultima/ultima1/views/stats.h
    engines/ultima/ultima1/views/views.h


diff --git a/engines/ultima/ultima1/ultima1.cpp b/engines/ultima/ultima1/ultima1.cpp
index d4c7fee68b7..de214720704 100644
--- a/engines/ultima/ultima1/ultima1.cpp
+++ b/engines/ultima/ultima1/ultima1.cpp
@@ -70,6 +70,9 @@ Common::Error Ultima1Engine::run() {
 Common::Error Ultima1Engine::syncGame(Common::Serializer &s) {
 	_player.synchronize(s);
 
+	if (s.isLoading())
+		_game.startGame();
+
 	return Common::kNoError;
 }
 
diff --git a/engines/ultima/ultima1/views/dialog.cpp b/engines/ultima/ultima1/views/dialog.cpp
index a88648ce810..46192ed463c 100644
--- a/engines/ultima/ultima1/views/dialog.cpp
+++ b/engines/ultima/ultima1/views/dialog.cpp
@@ -34,11 +34,12 @@ constexpr int COLOR_NOTCH = 0;   // black - corner notch pixels
 void Dialog::drawFrame() {
 	auto s = getSurface();
 
-	// Thick outer border band
-	s.fillRect(Common::Rect(0, 0, 316, 6), COLOR_BORDER);
-	s.fillRect(Common::Rect(0, 6, 6, 199), COLOR_BORDER);
-	s.fillRect(Common::Rect(313, 2, 319, 199), COLOR_BORDER);
-	s.fillRect(Common::Rect(0, 193, 319, 199), COLOR_BORDER);
+	// Thick outer border band - each edge flush against both the screen edge
+	// and the inner highlight line drawn just inside it
+	s.fillRect(Common::Rect(0, 0, 320, 7), COLOR_BORDER);
+	s.fillRect(Common::Rect(0, 7, 7, 193), COLOR_BORDER);
+	s.fillRect(Common::Rect(313, 7, 320, 193), COLOR_BORDER);
+	s.fillRect(Common::Rect(0, 193, 320, 200), COLOR_BORDER);
 
 	// Thin inner highlight line
 	s.drawLine(7, 7, 312, 7, COLOR_EDGE);
@@ -64,6 +65,30 @@ void Dialog::drawFrame() {
 		s.drawLine(NOTCH_POINTS[i].x, NOTCH_POINTS[i].y, NOTCH_POINTS[i].x, NOTCH_POINTS[i].y, COLOR_NOTCH);
 }
 
+void Dialog::drawGameDividers() {
+	auto s = getSurface();
+
+	// Erase the frame's bottom section (its border band, the lower
+	// portion of the side bands, and the bottom corners) - the dividers
+	// below replace it, running all the way to the screen edges
+	s.fillRect(Common::Rect(0, 153, 320, 200), 0);
+
+	// Horizontal divider separating the map viewport (above) from the
+	// command/message log and stats panel (below). The bar and its
+	// bottom edge span the full screen width, but the top edge stops at
+	// the viewport's own inner border, meeting up with its side edges
+	s.fillRect(Common::Rect(0, 153, 320, 159), COLOR_BORDER);
+	s.drawLine(7, 152, 312, 152, COLOR_EDGE);
+	s.drawLine(0, 159, 240, 159, COLOR_EDGE);
+	s.drawLine(247, 159, 319, 159, COLOR_EDGE);
+
+	// Vertical divider between the command/message log (left) and the
+	// stats panel (right), running to the bottom of the screen
+	s.fillRect(Common::Rect(241, 153, 247, 200), COLOR_BORDER);
+	s.drawLine(240, 159, 240, 199, COLOR_EDGE);
+	s.drawLine(247, 159, 247, 199, COLOR_EDGE);
+}
+
 // Per-column vertical extent of an 8x8 right-pointing triangle, tip at
 // column 7 - column 0 is the full-height flat edge, tapering down to a
 // single pixel at the tip. Used to fill the triangle solid before the
diff --git a/engines/ultima/ultima1/views/dialog.h b/engines/ultima/ultima1/views/dialog.h
index 99a15030981..01e3ebcf2ee 100644
--- a/engines/ultima/ultima1/views/dialog.h
+++ b/engines/ultima/ultima1/views/dialog.h
@@ -38,6 +38,13 @@ protected:
 	 */
 	void drawFrame();
 
+	/**
+	 * Draws the dividers splitting the interior of the frame into a map
+	 * viewport (above) and a command/message log and stats panel (below).
+	 * Shared by the overworld, dungeon, and outer space views
+	 */
+	void drawGameDividers();
+
 	/**
 	 * Draws a small triangular right-arrow glyph, in text-cell coordinates
 	 */
diff --git a/engines/ultima/ultima1/views/overworld.cpp b/engines/ultima/ultima1/views/overworld.cpp
index 007f3946469..83cccd74aae 100644
--- a/engines/ultima/ultima1/views/overworld.cpp
+++ b/engines/ultima/ultima1/views/overworld.cpp
@@ -20,107 +20,21 @@
  */
 
 #include "ultima/ultima1/views/overworld.h"
-#include "ultima/ultima1/ultima1.h"
-#include "ultima/ultima1/metaengine.h"
+#include "ultima/shared/gfx/rect.h"
 
 namespace Ultima {
 namespace Ultima1 {
 namespace Views {
 
-Overworld::Overworld() : View("Overworld") {
-	_map.setBounds(TextRect(0, 0, 40, 20));
-	_commands.setBounds(TextRect(0, 20, 30, 24));
-	_stats.setBounds(TextRect(30, 20, 40, 24));
+Overworld::Overworld() : Dialog("Overworld"), _stats(this) {
+	_stats.setBounds(TextRect(31, 21, 39, 24));
 }
 
 void Overworld::draw() {
-	// Clear map tiles so entire map is redrawn
-	auto &map = g_engine->_map;
-	map.clearTiles();
-
-	// Allow the child controls to draw
-	return View::draw();
-}
-
-bool Overworld::msgFocus(const FocusMessage &msg) {
-	auto &map = g_engine->_map;
-	map.load(0); // TODO: Ultima I's overworld is a single fixed map
-
-	return View::msgFocus(msg);
-}
-
-bool Overworld::msgGame(const GameMessage &msg) {
-	const auto &player = g_engine->_player;
-
-	if (msg._name == "COMMAND") {
-		// Scroll the command area, and pause briefly so users can tell
-		// when multiple commands in sequence are happening
-		_mode = kModePreCommand;
-		_commands.writeString("\n");
-		delayFrames(1);
-		return true;
-	} else if (msg._name == "INFO") {
-		_commands.writeString(msg._stringValue);
-		return true;
-	} else if (msg._name == "DEAD") {
-		// Update the stats view immediately to reflect the deadness
-		_stats.draw();
-
-		// Add message to the commands view that the player died
-		_commands.writeString("\0x8d\0x8d\0x8d");
-		_commands.writeString(player._name);
-		_commands.writeString(" IS DEAD!");
-
-		// Switch to the invisible Dead view to freeze the screen
-		g_engine->replaceView("Dead");
-		return true;
-	} else if (msg._name == "CIRCLE") {
-		if (msg._stringValue == "UP")
-			_map.flashCircle(0, -1);
-		else if (msg._stringValue == "DOWN")
-			_map.flashCircle(0, 1);
-		else if (msg._stringValue == "LEFT")
-			_map.flashCircle(-1, 0);
-		else if (msg._stringValue == "RIGHT")
-			_map.flashCircle(1, 0);
-		else
-			_map.flashCircle(0, 0);
-		return true;
-	}
-
-	return View::msgGame(msg);
-}
-
-void Overworld::timeout() {
-	switch (_mode) {
-	case kModePreCommand:
-		// Display new command prompt
-		_mode = kModeCommand;
-		_commands.prompt();
-		delayFrames(Data::FRAMES_BEFORE_COMMAND_TIMEOUT);
-		break;
-	case kModeCommand:
-		// Timeout happened, so automatically select pass command
-		g_engine->_game.doCommand(KEYBIND_PASS);
-		break;
-	default:
-		break;
-	}
-}
-
-bool Overworld::msgAction(const ActionMessage &msg) {
-	auto &game = g_engine->_game;
-
-	// Stop command timeout
-	cancelDelay();
-
-	if (_mode == kModeAttackDirection) {
-		// TODO
-	} else {
-		game.doCommand(msg._action);
-	}
-
-	return true;
+	auto s = getSurface();
+	s.clear();
+	drawFrame();
+	drawGameDividers();
 }
 
 } // namespace Views
diff --git a/engines/ultima/ultima1/views/overworld.h b/engines/ultima/ultima1/views/overworld.h
index 4b5cd0a9b98..6d69f7aaa03 100644
--- a/engines/ultima/ultima1/views/overworld.h
+++ b/engines/ultima/ultima1/views/overworld.h
@@ -22,32 +22,28 @@
 #ifndef ULTIMA1_VIEWS_OVERWORLD_H
 #define ULTIMA1_VIEWS_OVERWORLD_H
 
-#include "ultima/shared/gfx/view.h"
-#include "ultima/ultima1/views/overworld_map.h"
-#include "ultima/ultima1/views/commands.h"
+#include "ultima/ultima1/views/dialog.h"
 #include "ultima/ultima1/views/stats.h"
 
 namespace Ultima {
 namespace Ultima1 {
 namespace Views {
 
-class Overworld : public Shared::Gfx::View {
-	enum Mode { kModePreCommand, kModeCommand, kModeAttackDirection };
+/**
+ * The main in-game screen. Draws the outer frame around the map
+ * viewport, and hosts the map, stats, and command/message log
+ * sub-views. For now, only the frame and stats display are implemented
+ * - the map viewport and command log areas are just left blank.
+ */
+class Overworld : public Dialog {
 private:
-	OverworldMap _map = OverworldMap(this);
-	Commands _commands = Commands(this);
-	Stats _stats = Stats(this);
-	Mode _mode = kModeCommand;
+	Stats _stats;
 
 public:
 	Overworld();
 	~Overworld() override {}
 
 	void draw() override;
-	bool msgFocus(const FocusMessage &msg) override;
-	bool msgGame(const GameMessage &msg) override;
-	bool msgAction(const ActionMessage &msg) override;
-	void timeout() override;
 };
 
 } // namespace Views
diff --git a/engines/ultima/ultima1/views/stats.cpp b/engines/ultima/ultima1/views/stats.cpp
index 0e69f136d9e..10d331e57f0 100644
--- a/engines/ultima/ultima1/views/stats.cpp
+++ b/engines/ultima/ultima1/views/stats.cpp
@@ -26,23 +26,45 @@ namespace Ultima {
 namespace Ultima1 {
 namespace Views {
 
+// Colors used
+constexpr int COLOR_TEXT = 11;      // light cyan - normal values
+constexpr int COLOR_HIGHLIGHT = 12; // light red - low hits/food warning
+
 void Stats::draw() {
-	const auto &p = g_engine->_player;
+	Data::Player &p = g_engine->_player;
 	auto s = getSurface();
 	s.clear();
 
-	s.writeString("H.P.=");
-	if (p._hits < 100) s.reverseColor();
-	s.writeString(Common::String::format("%.4d", p._hits));
-	if (p._hits < 100) s.reverseColor();
+	// Hits and food are clamped and shown in a highlight color once low
+	if (p._hits < 0)
+		p._hits = 0;
+	else if (p._hits > 9999)
+		p._hits = 9999;
+	if (p._food < 0)
+		p._food = 0;
+	else if (p._food > 9999)
+		p._food = 9999;
+	if (p._experience > 9999)
+		p._experience = 9999;
+	if (p._coins > 9999)
+		p._coins = 9999;
+
+	s.setColor(COLOR_TEXT);
+	s.writeString(Common::Point(0, 0), "Hits:");
+	s.setColor(p._hits < 100 ? COLOR_HIGHLIGHT : COLOR_TEXT);
+	s.writeString(Common::Point(5, 0), Common::String::format("%4d", p._hits));
+
+	s.setColor(COLOR_TEXT);
+	s.writeString(Common::Point(0, 1), "Food:");
+	s.setColor(p._food < 100 ? COLOR_HIGHLIGHT : COLOR_TEXT);
+	s.writeString(Common::Point(5, 1), Common::String::format("%4d", p._food));
 
-	s.writeString(Common::Point(0, 1), "FOOD=");
-	if (p._food < 100) s.reverseColor();
-	s.writeString(Common::String::format("%.4d", p._food));
-	if (p._food < 100) s.reverseColor();
+	s.setColor(COLOR_TEXT);
+	s.writeString(Common::Point(0, 2), "Exp.:");
+	s.writeString(Common::Point(5, 2), Common::String::format("%4d", p._experience));
 
-	s.writeString(Common::Point(0, 2), Common::String::format("EXP.=%.4d", p._experience));
-	s.writeString(Common::Point(0, 3), Common::String::format("GOLD=%.4d", p._coins));
+	s.writeString(Common::Point(0, 3), "Coin:");
+	s.writeString(Common::Point(5, 3), Common::String::format("%4d", p._coins));
 }
 
 } // namespace Views
diff --git a/engines/ultima/ultima1/views/stats.h b/engines/ultima/ultima1/views/stats.h
index fd551f69335..b59a0d7d215 100644
--- a/engines/ultima/ultima1/views/stats.h
+++ b/engines/ultima/ultima1/views/stats.h
@@ -28,6 +28,10 @@ namespace Ultima {
 namespace Ultima1 {
 namespace Views {
 
+/**
+ * The always-visible Hits/Food/Exp./Coin display in the corner of the
+ * game screen. Shared between the overworld/town and dungeon views.
+ */
 class Stats : public Shared::UIElement {
 public:
 	Stats(UIElement *parent) : Shared::UIElement("Stats", parent) {}
diff --git a/engines/ultima/ultima1/views/views.h b/engines/ultima/ultima1/views/views.h
index 6d6c233247d..f7d2a62cde4 100644
--- a/engines/ultima/ultima1/views/views.h
+++ b/engines/ultima/ultima1/views/views.h
@@ -25,6 +25,7 @@
 #include "ultima/shared/engine/events.h"
 #include "ultima/ultima1/views/create_character.h"
 #include "ultima/ultima1/views/main_menu.h"
+#include "ultima/ultima1/views/overworld.h"
 #include "ultima/ultima1/views/startup.h"
 #include "ultima/ultima1/views/title.h"
 
@@ -35,6 +36,7 @@ namespace Views {
 struct Views : public Shared::Views {
 	CreateCharacter _createCharacter;
 	MainMenu _mainMenu;
+	Overworld _overworld;
 	Startup _startup;
 	Title _title;
 };


Commit: ef7105a08ef9741f30953116747245cf931e0ad7
    https://github.com/scummvm/scummvm/commit/ef7105a08ef9741f30953116747245cf931e0ad7
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:40:46+11:00

Commit Message:
ULTIMA: ULTIMA1: Map loading and rendering

Changed paths:
    engines/ultima/ultima1/data/map.cpp
    engines/ultima/ultima1/data/map.h
    engines/ultima/ultima1/data/tiles.cpp
    engines/ultima/ultima1/data/tiles.h
    engines/ultima/ultima1/ultima1.cpp
    engines/ultima/ultima1/views/overworld.cpp
    engines/ultima/ultima1/views/overworld.h
    engines/ultima/ultima1/views/overworld_map.cpp
    engines/ultima/ultima1/views/overworld_map.h


diff --git a/engines/ultima/ultima1/data/map.cpp b/engines/ultima/ultima1/data/map.cpp
index 25cf0be6ae8..e12f4f7c758 100644
--- a/engines/ultima/ultima1/data/map.cpp
+++ b/engines/ultima/ultima1/data/map.cpp
@@ -21,6 +21,7 @@
 
 #include "common/file.h"
 #include "ultima/ultima1/data/map.h"
+#include "ultima/ultima1/data/tiles.h"
 #include "ultima/ultima1/ultima1.h"
 
 namespace Ultima {
@@ -43,34 +44,28 @@ void Map::load(int mapNum) {
 	// Set up copies of the map position and player tile to use
 	_mapX = player._position.x;
 	_mapY = player._position.y;
-	_playerTileId = (player._class + Data::PLAYER_TILES_OFFSET) * 2;
+	_playerTileId = kTileParty;
 	clearTiles();
 }
 
 void Map::clearTiles() {
 	Common::fill(&_mapTilesId[0][0], &_mapTilesId[0][0] + sizeof(VisibleTiles), 0);
-	Common::fill(&_priorTileIds[0][0], &_priorTileIds[0][0] + sizeof(VisibleTiles), 0);
 }
 
 bool Map::canMoveToTile(int tileNum) {
-	auto &game = g_engine->_game;
-	int tileId = (tileNum & 0x7f) / 2;
+	int tileId = tileNum & 0x7f;
 
 	if ((uint)_mapX < Data::MAP_WIDTH && (uint)_mapY < Data::MAP_HEIGHT) {
 		// Within the bounds of the map
-		if (tileId == kTileSwamp) {
-			game.subtractHp(5);
-		}
-
-		switch (_playerTileId / 2) {
-		case kTileRocket * 2:
+		switch (_playerTileId) {
+		case kTileTimeMachine:
 			return true;
-		case kTileAirplane:
+		case kTileAircar:
 			// TODO
-			error("TODO: airplane");
+			error("TODO: aircar");
 			break;
-		case kTileShip:
-			if (tileId != kTileWater)
+		case kTileFrigate:
+			if (tileId != kTileOcean)
 				return true;
 
 			goto update_xy;
diff --git a/engines/ultima/ultima1/data/map.h b/engines/ultima/ultima1/data/map.h
index 379b841fd96..fa2dcc7dc5e 100644
--- a/engines/ultima/ultima1/data/map.h
+++ b/engines/ultima/ultima1/data/map.h
@@ -30,11 +30,10 @@ namespace Data {
 
 constexpr int MAP_WIDTH = 64;
 constexpr int MAP_HEIGHT = 66;
-constexpr int MAP_VISIBLE_WIDTH = 20;
-constexpr int MAP_VISIBLE_HEIGHT = 10;
+constexpr int MAP_VISIBLE_WIDTH = 19;
+constexpr int MAP_VISIBLE_HEIGHT = 9;
 constexpr int MAP_VISIBLE_CENTER_X = 9;
 constexpr int MAP_VISIBLE_CENTER_Y = 4;
-constexpr int PLAYER_TILES_OFFSET = 60;
 typedef byte MapTiles[MAP_HEIGHT][MAP_WIDTH];
 typedef byte VisibleTiles[MAP_VISIBLE_HEIGHT][MAP_VISIBLE_WIDTH];
 
@@ -51,9 +50,6 @@ public:
 	byte _tilePlayerUp = 0, _tilePlayerDown = 0,
 		_tilePlayerLeft = 0, _tilePlayerRight = 0;
 	VisibleTiles _mapTilesId = {};		// Calculated visible on-screen tiles
-	VisibleTiles _priorTileIds = {};	// Prior on-screen tiles, used to determine which to draw
-
-	const byte _flag1 = 0;
 
 	void load(int mapNum);
 	void clearTiles();
diff --git a/engines/ultima/ultima1/data/tiles.cpp b/engines/ultima/ultima1/data/tiles.cpp
index a769cf8032f..67172fab4b1 100644
--- a/engines/ultima/ultima1/data/tiles.cpp
+++ b/engines/ultima/ultima1/data/tiles.cpp
@@ -20,77 +20,47 @@
  */
 
 #include "common/file.h"
-#include "common/memstream.h"
 #include "ultima/ultima1/data/tiles.h"
 
 namespace Ultima {
 namespace Ultima1 {
 namespace Data {
 
-// Ultima II has 64 tiles, each 16x16 pixels in CGA Linear format
-const int TILE_DATA_OFFSET = 31808;
-const int TILE2_DATA_OFFSET = 21640;
-
-const Common::ArchiveMemberPtr Tiles::getMember(const Common::Path &path) const {
-	if (!hasFile(path))
-		return Common::ArchiveMemberPtr();
-
-	return Common::ArchiveMemberPtr(new Common::GenericArchiveMember(path, *this));
-}
-
-Common::SeekableReadStream *Tiles::createReadStreamForMember(const Common::Path &path) const {
-	if (!hasFile(path))
-		return nullptr;
+constexpr int BYTES_PER_ROW = 8;	// 4 planes x 2 bytes/plane = 16 pixels
+constexpr int BYTES_PER_TILE = BYTES_PER_ROW * TILE_HEIGHT;
 
+void loadTiles(Graphics::ManagedSurface tiles[TILE_COUNT]) {
 	Common::File f;
-	if (!f.open("ultimaii.exe"))
-		error("Could not open ultimaii.exe");
-
-	// Seek to the tile data
-	f.seek(TILE_DATA_OFFSET);
+	if (!f.open("EgaTiles.Bin"))
+		error("Could not open EgaTiles.Bin");
 
-	Common::MemoryWriteStreamDynamic buf(DisposeAfterUse::NO);
+	byte data[BYTES_PER_TILE];
 
-	// Process each tile
-	for (int tileNumber = 0; tileNumber < TILE_COUNT; tileNumber++) {
-		if (tileNumber == (TILE_COUNT - 1))
-			f.seek(TILE2_DATA_OFFSET);
+	for (int tileNum = 0; tileNum < TILE_COUNT; ++tileNum) {
+		if (f.read(data, BYTES_PER_TILE) != (uint32)BYTES_PER_TILE)
+			error("Unexpected end of EgaTiles.Bin");
 
-		byte tileW = f.readByte() * 4;
-		byte tileH = f.readByte();
-		assert(tileW == TILE_WIDTH && tileH == TILE_HEIGHT);
+		Graphics::ManagedSurface &tile = tiles[tileNum];
+		tile.create(TILE_WIDTH, TILE_HEIGHT, Graphics::PixelFormat::createFormatCLUT8());
 
-		// Read the tile data (16 rows, 4 bytes per row)
-		for (int y = 0; y < TILE_HEIGHT; y++) {
-			for (int x = 0; x < TILE_WIDTH / 4; x++) {
-				// Read one byte (contains 4 pixels in CGA Linear format)
-				byte pixelByte = f.readByte();
+		for (int y = 0; y < TILE_HEIGHT; ++y) {
+			const byte *row = &data[y * BYTES_PER_ROW];
+			byte *destRow = (byte *)tile.getBasePtr(0, y);
 
-				// Extract 4 pixels from this byte
-				// CGA Linear: bits 7-6 = first pixel, 5-4 = second, 3-2 = third, 1-0 = fourth
-				for (int offset = 0; offset < 4; offset++) {
-					int colorBit = 7 - (offset * 2);  // Start at bit 7, then 5, 3, 1
+			for (int x = 0; x < TILE_WIDTH; ++x) {
+				int byteIdx = x / 8;
+				int bitMask = 0x80 >> (x % 8);
 
-					// Extract 2-bit color value
-					int colorIndex = 0;
-					if (pixelByte & (1 << colorBit))
-						colorIndex |= 2;
-					if (pixelByte & (1 << (colorBit - 1)))
-						colorIndex |= 1;
-
-					// Map the 2-bit value to palette index (0-3)
-					byte paletteIndex = colorIndex;
-
-					// Write the palette index to the buffer
-					buf.writeByte(paletteIndex);
+				byte colorIndex = 0;
+				for (int plane = 0; plane < 4; ++plane) {
+					if (row[plane * 2 + byteIdx] & bitMask)
+						colorIndex |= (1 << plane);
 				}
+
+				destRow[x] = colorIndex;
 			}
 		}
 	}
-
-	f.close();
-
-	return new Common::MemoryReadStream(buf.getData(), buf.size(), DisposeAfterUse::YES);
 }
 
 } // namespace Data
diff --git a/engines/ultima/ultima1/data/tiles.h b/engines/ultima/ultima1/data/tiles.h
index 0a86bd8d06f..7c591aba6f6 100644
--- a/engines/ultima/ultima1/data/tiles.h
+++ b/engines/ultima/ultima1/data/tiles.h
@@ -22,129 +22,43 @@
 #ifndef ULTIMA1_DATA_TILES_H
 #define ULTIMA1_DATA_TILES_H
 
-#include "common/archive.h"
+#include "graphics/managed_surface.h"
 
 namespace Ultima {
 namespace Ultima1 {
 namespace Data {
 
-constexpr int TILE_COUNT = 64 + 1;
+constexpr int TILE_COUNT = 52;
 constexpr int TILE_WIDTH = 16;
 constexpr int TILE_HEIGHT = 16;
 
 enum TileId {
-	kTileWater = 0,
-	kTileSwamp = 1,
-	kTileGrass = 2,
-	kTileForest = 3,
-	kTileMountain = 4,
-	kTileUnknown5 = 5,
-	kTileTown = 6,
-	kTileTower = 7,
-	kTileCastle = 8,
-	kTileDungeonEntrance = 9,
-	kTileSignpost = 10,
-	kTileSeaMonster = 11,
-	kTileOrc = 12,
-	kTileDaemon = 13,
-	kTileDevil = 14,
-	kTileBalron = 15,
-	kTileMinax = 16,
-	kTileHorse = 17,
-	kTileShip = 18,
-	kTileAirplane = 19,
-	kTileRocket = 20,
-	kTileShield = 21,
-	kTileSword = 22,
-	kTileForcefield = 23,
-	kTileGuard = 24,
-	kTileJester = 25,
-	kTileShopkeep = 26,
-	kTileUnknown27 = 27,
-	kTileRoad = 28,
-	kTileEmpty = 29,
-	kTileWall = 30,
-	kTileEmptyCounterSpace = 31,
-	kTileLetterA = 32,
-	kTileLetterB = 33,
-	kTileLetterC = 34,
-	kTileLetterD = 35,
-	kTileLetterE = 36,
-	kTileLetterF = 37,
-	kTileLetterG = 38,
-	kTileLetterH = 39,
-	kTileLetterIDoor = 40,
-	kTileLetterJ = 41,
-	kTileLetterK = 42,
-	kTileLetterL = 43,
-	kTileLetterM = 44,
-	kTileLetterN = 45,
-	kTileLetterO = 46,
-	kTileLetterP = 47,
-	kTileMoongate = 48,
-	kTileLetterR = 49,
-	kTileLetterS = 50,
-	kTileLetterT = 51,
-	kTileLetterU = 52,
-	kTileLetterV = 53,
-	kTileLetterW = 54,
-	kTileLetterX = 55,
-	kTileLetterY = 56,
-	kTileLetterZ = 57,
-	kTileCounterEndRight = 58,
-	kTileCounterEndLeft = 59,
-	kTileFighter = 60,
-	kTileCleric = 61,
-	kTileMage = 62,
-	kTileThief = 63,
-	// Special tiles
-	kTileCircle = 64
+	kTileOcean = 0,
+	kTileGrass = 1,
+	kTileWoods = 2,
+	kTileCastle = 4,
+	kTileCastleFlag = 5,
+	kTileSignpost = 6,
+	kTileCity = 7,
+	kTileCityFlag = 8,
+	kTileParty = 11,
+	kTileHorse = 12,
+	kTileCart = 13,
+	kTileRaft = 14,
+	kTileFrigate = 15,
+	kTileAircar = 16,
+	kTileShuttle = 17,
+	kTileTimeMachine = 18,
+	kTileFirstMonster = 19,
+	kTileLastMonster = 47
 };
 
 /**
- * This archive class virtualizes converting the CGA tile data from
- * the ultimaii.exe file into a flat pixel (palette indexed) for each tile.
- * This will hopefully make it easier in the future if anyone wants to
- * create an enhanced graphic pack.. they'll just need to drop a 'tiles'
- * file in the game folder and implement a replacement palette for the game.
+ * Loads the overworld tile sheet (52 16x16 tiles, 4-bit EGA planar,
+ * row-interleaved: each 16-pixel row is 4 planes x 2 bytes) into a
+ * caller-supplied array of TILE_COUNT surfaces
  */
-class Tiles : public Common::Archive {
-public:
-	~Tiles() override {
-	}
-
-	/**
-	 * Check if a member with the given @p name is present in the Archive.
-	 * Patterns are not allowed, as this is meant to be a quick File::exists()
-	 * replacement.  This returns "true" for both files and directories.
-	 */
-	virtual bool hasFile(const Common::Path &path) const {
-		return path.baseName().equalsIgnoreCase("tiles");
-	}
-
-	/**
-	 * Add all members of the Archive to the list.
-	 * Must only append to list, and not remove elements from it.
-	 *
-	 * @return The number of names added to list.
-	 */
-	virtual int listMembers(Common::ArchiveMemberList &list) const {
-		return 0;
-	}
-
-	/**
-	 * Return an ArchiveMember representation of the given file.
-	 */
-	const Common::ArchiveMemberPtr getMember(const Common::Path &path) const override;
-
-	/**
-	 * Create a stream bound to a member with the specified name in the
-	 * archive. If no member with this name exists, 0 is returned.
-	 *
-	 * @return The newly created input stream.
-	 */
-	Common::SeekableReadStream *createReadStreamForMember(const Common::Path &path) const override;
-};
+void loadTiles(Graphics::ManagedSurface tiles[TILE_COUNT]);
 
 } // namespace Data
 } // namespace Ultima1
diff --git a/engines/ultima/ultima1/ultima1.cpp b/engines/ultima/ultima1/ultima1.cpp
index de214720704..583f8c5a48e 100644
--- a/engines/ultima/ultima1/ultima1.cpp
+++ b/engines/ultima/ultima1/ultima1.cpp
@@ -28,6 +28,7 @@
 #include "graphics/paletteman.h"
 #include "ultima/ultima1/ultima1.h"
 #include "ultima/ultima1/console.h"
+#include "ultima/ultima1/data/tiles.h"
 #include "ultima/ultima1/views/views.h"
 
 namespace Ultima {
@@ -60,6 +61,9 @@ Common::Error Ultima1Engine::run() {
 	// Set the engine's debugger console
 	setDebugger(new Console());
 
+	// Load the overworld tile sheet
+	Data::loadTiles(_tiles);
+
 	Views::Views views;
 	addView("Startup");
 	runGame(views);
diff --git a/engines/ultima/ultima1/views/overworld.cpp b/engines/ultima/ultima1/views/overworld.cpp
index 83cccd74aae..118fe84e1c4 100644
--- a/engines/ultima/ultima1/views/overworld.cpp
+++ b/engines/ultima/ultima1/views/overworld.cpp
@@ -20,13 +20,17 @@
  */
 
 #include "ultima/ultima1/views/overworld.h"
+#include "ultima/ultima1/data/map.h"
+#include "ultima/ultima1/data/tiles.h"
 #include "ultima/shared/gfx/rect.h"
 
 namespace Ultima {
 namespace Ultima1 {
 namespace Views {
 
-Overworld::Overworld() : Dialog("Overworld"), _stats(this) {
+Overworld::Overworld() : Dialog("Overworld"), _map(this), _stats(this) {
+	_map.setBounds(Common::Rect(7, 7, 7 + Data::MAP_VISIBLE_WIDTH * Data::TILE_WIDTH,
+		7 + Data::MAP_VISIBLE_HEIGHT * Data::TILE_HEIGHT));
 	_stats.setBounds(TextRect(31, 21, 39, 24));
 }
 
diff --git a/engines/ultima/ultima1/views/overworld.h b/engines/ultima/ultima1/views/overworld.h
index 6d69f7aaa03..a5109051b48 100644
--- a/engines/ultima/ultima1/views/overworld.h
+++ b/engines/ultima/ultima1/views/overworld.h
@@ -23,6 +23,7 @@
 #define ULTIMA1_VIEWS_OVERWORLD_H
 
 #include "ultima/ultima1/views/dialog.h"
+#include "ultima/ultima1/views/overworld_map.h"
 #include "ultima/ultima1/views/stats.h"
 
 namespace Ultima {
@@ -32,11 +33,11 @@ namespace Views {
 /**
  * The main in-game screen. Draws the outer frame around the map
  * viewport, and hosts the map, stats, and command/message log
- * sub-views. For now, only the frame and stats display are implemented
- * - the map viewport and command log areas are just left blank.
+ * sub-views. For now, the command/message log area is just left blank.
  */
 class Overworld : public Dialog {
 private:
+	OverworldMap _map;
 	Stats _stats;
 
 public:
diff --git a/engines/ultima/ultima1/views/overworld_map.cpp b/engines/ultima/ultima1/views/overworld_map.cpp
index 701b65e0951..68c4b7cc580 100644
--- a/engines/ultima/ultima1/views/overworld_map.cpp
+++ b/engines/ultima/ultima1/views/overworld_map.cpp
@@ -33,36 +33,47 @@ bool OverworldMap::msgFocus(const FocusMessage &msg) {
 }
 
 void OverworldMap::timeout() {
-	// Animate the water and forcefield tiles
-	animateTile(g_engine->_tiles[0]);
-	animateTile(g_engine->_tiles[23]);
+	animateWater();
+	++_animIndex;
 	redraw();
 
-	// Wait briefly before next tile animation
+	// Wait briefly before the next animation tick
 	delayFrames(1);
 }
 
-void OverworldMap::animateTile(Graphics::ManagedSurface &tile) {
+void OverworldMap::animateWater() {
+	Graphics::ManagedSurface &tile = g_engine->_tiles[Data::kTileOcean];
 	assert(tile.w == Data::TILE_WIDTH && tile.h == Data::TILE_HEIGHT);
 
-	// Rotate 2 rows upward (top 2 rows move to bottom)
-	const int ROWS_TO_ROTATE = 2;
-	const int BYTES_TO_ROTATE = Data::TILE_WIDTH * ROWS_TO_ROTATE;
-
-	// Temporary buffer to hold the rows being rotated
-	byte tempBuffer[Data::TILE_WIDTH * ROWS_TO_ROTATE];
-
+	byte lastRow[Data::TILE_WIDTH];
 	byte *pixels = (byte *)tile.getPixels();
 
-	// Save the first ROWS_TO_ROTATE rows to temp buffer
-	memcpy(tempBuffer, pixels, BYTES_TO_ROTATE);
+	// The bottom row wraps around to become the new top row, with
+	// every other row shifting down by one to make way for it
+	memcpy(lastRow, pixels + (Data::TILE_HEIGHT - 1) * Data::TILE_WIDTH, Data::TILE_WIDTH);
+	memmove(pixels + Data::TILE_WIDTH, pixels, (Data::TILE_HEIGHT - 1) * Data::TILE_WIDTH);
+	memcpy(pixels, lastRow, Data::TILE_WIDTH);
+}
+
+int OverworldMap::animatedTileId(byte tileId) const {
+	if (tileId == Data::kTileCastle) {
+		// Only redrawn on 2 of every 6 ticks; the other 4 ticks leave
+		// whichever frame was last drawn untouched
+		int offset = 2;
+		if ((_animIndex % 6) == 0)
+			offset = 0;
+		else if ((_animIndex % 3) == 0)
+			offset = 1;
+
+		return (offset == 2) ? -1 : Data::kTileCastle + offset;
+	}
 
-	// Shift all remaining rows up
-	int remainingBytes = (tile.w * tile.h) - BYTES_TO_ROTATE;
-	memmove(pixels, pixels + BYTES_TO_ROTATE, remainingBytes);
+	if (tileId == Data::kTileCity) {
+		// Redrawn every tick, biased 3:1 toward the waving-flag frame
+		return Data::kTileCity + (((_animIndex % 4) == 0) ? 0 : 1);
+	}
 
-	// Copy saved rows to the end
-	memcpy(pixels + remainingBytes, tempBuffer, BYTES_TO_ROTATE);
+	return tileId;
 }
 
 void OverworldMap::draw() {
@@ -74,81 +85,44 @@ void OverworldMap::draw() {
 	// Draw the visible map contents
 	for (int oy = 0; oy < Data::MAP_VISIBLE_HEIGHT; oy++) {
 		for (int ox = 0; ox < Data::MAP_VISIBLE_WIDTH; ox++) {
-			uint8 tileId = map._mapTilesId[oy][ox];
-			if (!(tileId & 0x80)) {
-				const Graphics::ManagedSurface &tileImg = g_engine->_tiles[tileId / 2];
+			int tileId = animatedTileId(map._mapTilesId[oy][ox]);
+			if (tileId != -1) {
+				const Graphics::ManagedSurface &tileImg = g_engine->_tiles[tileId];
 				s.blitFrom(tileImg, Common::Point(ox * Data::TILE_WIDTH, oy * Data::TILE_HEIGHT));
 			}
 		}
 	}
-
-	// Copy rendered tile IDs for next frame's dirty comparison
-	for (int oy = 0; oy < Data::MAP_VISIBLE_HEIGHT; oy++)
-		for (int ox = 0; ox < Data::MAP_VISIBLE_WIDTH; ox++)
-			map._priorTileIds[oy][ox] = map._mapTilesId[oy][ox] & 0x7F;
 }
 
 void OverworldMap::prepareMapForDrawing() {
-	// Load the map if it's not already active
 	auto &map = g_engine->_map;
-
-	//int mapOffsetX = 0, mapOffsetY = 0;
 	int mapLeft, mapTop;
 
 	if (map._outsideMapTile != -1) {
 		// Non-wrapping draw (used for indoor maps/dungeons with a border tile)
-		mapLeft = (map._mapX - 9) + 1;
-		mapTop = (map._mapY - 5) + 1;
+		mapLeft = (map._mapX - Data::MAP_VISIBLE_CENTER_X) + 1;
+		mapTop = (map._mapY - Data::MAP_VISIBLE_CENTER_Y) + 1;
 
 		for (int oy = 0; oy < Data::MAP_VISIBLE_HEIGHT; oy++) {
 			for (int ox = 0; ox < Data::MAP_VISIBLE_WIDTH; ox++) {
 				uint8 x = mapLeft + ox;
 				uint8 y = mapTop + oy;
 
-				uint8 tile;
-				if (x >= 64 || y >= 64) {
-					// Out of bounds: fill with the designated outside tile
-					tile = map._outsideMapTile;
-				} else {
-					tile = (map._tiles[y][x] / 2) & 0xfe;
-				}
-
-				if (tile == map._priorTileIds[oy][ox]) {
-					if (tile == 0) {
-						if (map._flag1 == 0xFF)
-							tile |= 0x80;
-					} else {
-						if (tile != 46)
-							tile |= 0x80;
-					}
-				}
-
-				map._mapTilesId[oy][ox] = tile;
+				map._mapTilesId[oy][ox] = (x >= Data::MAP_WIDTH || y >= Data::MAP_HEIGHT) ?
+					map._outsideMapTile : map._tiles[y][x];
 			}
 		}
 
 	} else {
 		// Normal (wrapping) draw - overworld map
-		mapTop = (map._mapY - 5) & 63;
-		mapLeft = (map._mapX - 9) & 63;
+		mapTop = (map._mapY - Data::MAP_VISIBLE_CENTER_Y) & 63;
+		mapLeft = (map._mapX - Data::MAP_VISIBLE_CENTER_X) & 63;
 
 		for (int oy = 0; oy < Data::MAP_VISIBLE_HEIGHT; oy++) {
 			for (int ox = 0; ox < Data::MAP_VISIBLE_WIDTH; ox++) {
 				uint8 x = (mapLeft + ox) & 63;
 				uint8 y = (mapTop + oy) & 63;
-				uint8 tile = (map._tiles[y][x] / 2) & 0xfe;
-
-				if (tile == map._priorTileIds[oy][ox]) {
-					if (tile == 0) {
-						if (map._flag1 == 0xFF)
-							tile |= 0x80;
-					} else {
-						if (tile != 46)
-							tile |= 0x80;
-					}
-				}
-
-				map._mapTilesId[oy][ox] = tile;
+				map._mapTilesId[oy][ox] = map._tiles[y][x];
 			}
 		}
 	}
@@ -164,24 +138,6 @@ void OverworldMap::prepareMapForDrawing() {
 	map._mapTilesId[Data::MAP_VISIBLE_CENTER_Y][Data::MAP_VISIBLE_CENTER_X] = map._playerTileId;
 }
 
-void OverworldMap::flashCircle(int deltaX, int deltaY) {
-	Common::Point pt((Data::MAP_VISIBLE_CENTER_X + deltaX) * Data::TILE_WIDTH,
-		(Data::MAP_VISIBLE_CENTER_Y + deltaY) * Data::TILE_HEIGHT);
-	auto s = getSurface();
-
-	// Show the circle
-	s.xorBlitFrom(g_engine->_tiles[Data::kTileCircle], pt);
-	g_engine->getScreen()->update();
-
-	// Brief pause
-	g_engine->pauseMillis();
-
-	// Remove it
-	s.xorBlitFrom(g_engine->_tiles[Data::kTileCircle], pt);
-	g_engine->getScreen()->update();
-}
-
-
 } // namespace Views
 } // namespace Ultima1
 } // namespace Ultima
diff --git a/engines/ultima/ultima1/views/overworld_map.h b/engines/ultima/ultima1/views/overworld_map.h
index cb21db58c6d..b4160ad0413 100644
--- a/engines/ultima/ultima1/views/overworld_map.h
+++ b/engines/ultima/ultima1/views/overworld_map.h
@@ -32,8 +32,24 @@ using namespace Shared::Messages;
 
 class OverworldMap : public Shared::UIElement {
 private:
+	int _animIndex = 0;
+
 	void prepareMapForDrawing();
-	void animateTile(Graphics::ManagedSurface &tile);
+
+	/**
+	 * Shifts the ocean tile's bitmap down by one pixel row (the bottom
+	 * row wraps around to become the new top row), to give a rippling
+	 * water effect
+	 */
+	void animateWater();
+
+	/**
+	 * Returns the tile to draw for a given raw map tile, substituting
+	 * in the appropriate animation frame for the castle and city flags.
+	 * Returns -1 if the tile shouldn't be redrawn this tick (the castle
+	 * flag is only redrawn on 2 of every 6 ticks)
+	 */
+	int animatedTileId(byte tileId) const;
 
 public:
 	OverworldMap(Shared::UIElement *parent) : Shared::UIElement("OverworldMap", parent) {}
@@ -42,11 +58,6 @@ public:
 	bool msgFocus(const FocusMessage &msg) override;
 	void draw() override;
 	void timeout() override;
-
-	/**
-	 * Flash a circle at a specified tile delta to the map center
-	 */
-	void flashCircle(int deltaX, int deltaY);
 };
 
 } // namespace Views


Commit: 6960be147526aff027c6e29a6971e2cbcb57bb1c
    https://github.com/scummvm/scummvm/commit/6960be147526aff027c6e29a6971e2cbcb57bb1c
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:40:46+11:00

Commit Message:
ULTIMA: ULTIMA1: Start of movement code

Changed paths:
    engines/ultima/ultima1/data/game.cpp
    engines/ultima/ultima1/data/map.cpp
    engines/ultima/ultima1/data/map.h
    engines/ultima/ultima1/data/player.cpp
    engines/ultima/ultima1/data/player.h
    engines/ultima/ultima1/data/tiles.h
    engines/ultima/ultima1/metaengine.cpp
    engines/ultima/ultima1/ultima1.cpp
    engines/ultima/ultima1/ultima1.h
    engines/ultima/ultima1/views/overworld.cpp
    engines/ultima/ultima1/views/overworld.h
    engines/ultima/ultima1/views/overworld_map.cpp


diff --git a/engines/ultima/ultima1/data/game.cpp b/engines/ultima/ultima1/data/game.cpp
index 6704d67418e..f231177487c 100644
--- a/engines/ultima/ultima1/data/game.cpp
+++ b/engines/ultima/ultima1/data/game.cpp
@@ -28,6 +28,8 @@ namespace Ultima1 {
 namespace Data {
 
 void Game::startGame() {
+	_G(map).load(_G(player)._mapNum);
+
 	// TODO: dungeons aren't implemented yet, so always start on the overworld
 	g_engine->replaceView("Overworld");
 
diff --git a/engines/ultima/ultima1/data/map.cpp b/engines/ultima/ultima1/data/map.cpp
index e12f4f7c758..78044cd3b6a 100644
--- a/engines/ultima/ultima1/data/map.cpp
+++ b/engines/ultima/ultima1/data/map.cpp
@@ -28,22 +28,88 @@ namespace Ultima {
 namespace Ultima1 {
 namespace Data {
 
+constexpr int OVERWORLD_WIDTH = 168;
+constexpr int OVERWORLD_HEIGHT = 168;
+constexpr int OVERWORLD_SIZE = OVERWORLD_WIDTH * OVERWORLD_HEIGHT;
+constexpr int CITY_WIDTH = 38;
+constexpr int CITY_HEIGHT = 18;
+constexpr int CITY_SIZE = CITY_WIDTH * CITY_HEIGHT;
+
+void Map::init() {
+	// Load the overworld map
+	Common::File ow;
+	byte v;
+	byte *offset;
+
+	if (!ow.open("map.bin"))
+		error("Could not open map.bin");
+	_overworldMap.reserve(OVERWORLD_SIZE);
+
+	for (int i = 0; i < OVERWORLD_SIZE / 2; ++i) {
+		v = ow.readByte();
+		_overworldMap.push_back(v >> 4);
+		_overworldMap.push_back(v & 0xf);
+	}
+
+	ow.close();
+
+	// Load the city/castle maps
+	Common::File tc;
+	if (!tc.open("tcd.bin"))
+		error("Could not open tcd.bin");
+
+	for (int i = 0; i < 10; ++i) {
+		auto &m = _cityMap[i];
+		m.resize(CITY_SIZE);
+
+		// Individual cities are top-to-bottom first, then left-to-right. For consistency
+		// with the overworld, we switch them to left-to-right, top-to-bottom
+		for (int x = 0; x < CITY_WIDTH; ++x) {
+			offset = &m[x];
+
+			for (int y = 0; y < CITY_HEIGHT; ++y, offset += CITY_WIDTH)
+				*offset = tc.readByte();
+		}
+	}
+
+	// Load the overworld map by default
+	load(MAP_OVERWORLD);
+}
+
 void Map::load(int mapNum) {
 	const auto &player = g_engine->_player;
 
-	if (mapNum == _currentMap)
-		return;
 	_currentMap = mapNum;
 
-	Common::File f;
-	if (!f.open(Common::String::format("MAPX%.2d", mapNum).c_str()))
-		error("Could not open map %d", mapNum);
+	if (mapNum == MAP_OVERWORLD) {
+		_mapWidth = OVERWORLD_WIDTH;
+		_mapHeight = OVERWORLD_HEIGHT;
+		_outsideMapTile = 0xff;
+
+		_mapRows.clear();
+		_mapRows.reserve(OVERWORLD_HEIGHT);
+		for (int y = 0; y < OVERWORLD_HEIGHT; ++y)
+			_mapRows.push_back(Row(this, &_overworldMap[y * OVERWORLD_WIDTH]));
 
-	f.read(_tiles, MAP_WIDTH * MAP_HEIGHT);
+		_mapX = player._position.x;
+		_mapY = player._position.y;
+
+	} else {
+		_mapWidth = CITY_WIDTH;
+		_mapHeight = CITY_HEIGHT;
+		_outsideMapTile = 0;
+
+		_mapRows.clear();
+		_mapRows.reserve(CITY_HEIGHT + 1);		// One extra row for out-of-bounds y access
+		for (int y = 0; y < OVERWORLD_HEIGHT; ++y)
+			_mapRows.push_back(Row(this, &_cityMap[mapNum - 1][y * CITY_WIDTH]));
+		_mapRows.push_back(Row(this, nullptr));
+
+		_mapX = 19;
+		_mapY = 17;
+	}
 
 	// Set up copies of the map position and player tile to use
-	_mapX = player._position.x;
-	_mapY = player._position.y;
 	_playerTileId = kTileParty;
 	clearTiles();
 }
@@ -55,7 +121,7 @@ void Map::clearTiles() {
 bool Map::canMoveToTile(int tileNum) {
 	int tileId = tileNum & 0x7f;
 
-	if ((uint)_mapX < Data::MAP_WIDTH && (uint)_mapY < Data::MAP_HEIGHT) {
+	if (_mapX < _mapWidth && _mapY < _mapHeight) {
 		// Within the bounds of the map
 		switch (_playerTileId) {
 		case kTileTimeMachine:
diff --git a/engines/ultima/ultima1/data/map.h b/engines/ultima/ultima1/data/map.h
index fa2dcc7dc5e..b8b3eda92c5 100644
--- a/engines/ultima/ultima1/data/map.h
+++ b/engines/ultima/ultima1/data/map.h
@@ -28,30 +28,107 @@ namespace Ultima {
 namespace Ultima1 {
 namespace Data {
 
-constexpr int MAP_WIDTH = 64;
-constexpr int MAP_HEIGHT = 66;
 constexpr int MAP_VISIBLE_WIDTH = 19;
 constexpr int MAP_VISIBLE_HEIGHT = 9;
 constexpr int MAP_VISIBLE_CENTER_X = 9;
 constexpr int MAP_VISIBLE_CENTER_Y = 4;
-typedef byte MapTiles[MAP_HEIGHT][MAP_WIDTH];
+
+enum {
+	MAP_OVERWORLD = 0,
+	MAP_CITY1 = 1
+};
+
+typedef Common::Array< Common::Array<byte> > MapTiles;
 typedef byte VisibleTiles[MAP_VISIBLE_HEIGHT][MAP_VISIBLE_WIDTH];
 
 struct Map {
 private:
 	int _currentMap = -1;
+
+	Common::Array<byte> _overworldMap;		// Cached overworld map data
+	Common::Array<byte> _cityMap[10];		// Cached city/castle/town maps
+
+	MapTiles _mapTiles;						// Visible on-screen tiles
+	int _mapWidth = 0, _mapHeight = 0;		// Map width/height
+	byte _outsideMapTile = 0xff;			// -1 for wrapping, else tile for outside map boundaries
+
+	/**
+	 * Gives access to a row with the current map
+	 */
+	class Row {
+	private:
+		Map *_owner = nullptr;
+		const byte *_data = nullptr;
+
+	public:
+		Row() {}
+		Row(Map *owner, const byte *data) : _owner(owner), _data(data) {}
+
+		// Give access to the byte for a column within the row
+		const byte &operator[](int x) const {
+			// Handle when the Y is already outside the map, or X is outside map
+			if (!_data || (_owner->_outsideMapTile != 0xff && (x < 0 || x >= _owner->_mapWidth)))
+				return _owner->_outsideMapTile;
+
+			// Return cell within the row
+			if (x < 0)
+				return _data[_owner->_mapWidth + x];
+			return _data[x % _owner->_mapWidth];
+		}
+	};
+	friend class Row;
+
+	Common::Array<Row> _mapRows;			// Used for array operator getting map contents
+
 public:
 	int _mapX = 0, _mapY = 0;
 	byte _playerTileId = 0;
 
-	MapTiles _tiles = {};
-	int8 _outsideMapTile = -1;
 	byte _tilePlayerCenter = 0;
 	byte _tilePlayerUp = 0, _tilePlayerDown = 0,
 		_tilePlayerLeft = 0, _tilePlayerRight = 0;
 	VisibleTiles _mapTilesId = {};		// Calculated visible on-screen tiles
 
+public:
+	/**
+	 * Initializes the map, loading necessary data.
+	 */
+	void init();
+
+	/**
+	 * Loads a specified map.
+	 * @param mapNum 
+	 */
 	void load(int mapNum);
+
+	/**
+	 * Returns the map width
+	 */
+	int width() const {
+		return _mapWidth;
+	}
+
+	/**
+	 * Returns the map height
+	 */
+	int height() const {
+		return _mapHeight;
+	}
+
+	/**
+	 * Access tiles of the current map
+	 */
+	const Row &operator[](int y) const {
+		if (_outsideMapTile != 0xff && (y < 0 || y >= _mapHeight))
+			// In a row outside the map
+			return _mapRows[_mapHeight];
+
+		// Return valid row
+		if (y < 0)
+			return _mapRows[_mapHeight + y];
+		return _mapRows[y % _mapHeight];
+	}
+
 	void clearTiles();
 
 	bool canMoveToTile(int tileNum);
diff --git a/engines/ultima/ultima1/data/player.cpp b/engines/ultima/ultima1/data/player.cpp
index e1b2e8c2f44..381da2d5e27 100644
--- a/engines/ultima/ultima1/data/player.cpp
+++ b/engines/ultima/ultima1/data/player.cpp
@@ -20,6 +20,7 @@
  */
 
 #include "ultima/ultima1/data/player.h"
+#include "ultima/ultima1/data/map.h"
 
 namespace Ultima {
 namespace Ultima1 {
@@ -29,7 +30,7 @@ const char *SEX_NAMES[] = { "Male", "Female" };
 const char *RACE_NAMES[] = { nullptr, "Human", "Elf", "Dwarf", "Bobbit" };
 const char *CLASS_NAMES[] = { nullptr, "Fighter", "Cleric", "Wizard", "Thief" };
 
-void Player::synchronize(Common::Serializer &s) {
+void Player::synchronizeBasic(Common::Serializer &s) {
 	s.syncBytes((byte *)_name, MAX_NAME_LENGTH + 2);
 	s.syncAsByte(_race);
 	s.syncAsByte(_class);
@@ -79,6 +80,22 @@ void Player::synchronize(Common::Serializer &s) {
 	s.syncAsSint16LE(_moveCount);
 }
 
+void Player::synchronizeExtra(Common::Serializer &s) {
+	s.syncAsSint16LE(_mapNum);
+	s.syncAsSint16LE(_locationPosition.x);
+	s.syncAsSint16LE(_locationPosition.y);
+}
+
+void Player::synchronize(Common::Serializer &s) {
+	synchronizeBasic(s);
+	synchronizeExtra(s);
+}
+
+void Player::synchronizeOriginal(Common::Serializer &s) {
+	synchronizeBasic(s);
+	_mapNum = MAP_OVERWORLD;
+}
+
 } // namespace Data
 } // namespace Ultima1
 } // namespace Ultima
diff --git a/engines/ultima/ultima1/data/player.h b/engines/ultima/ultima1/data/player.h
index 37b46925629..39e7db87c65 100644
--- a/engines/ultima/ultima1/data/player.h
+++ b/engines/ultima/ultima1/data/player.h
@@ -81,6 +81,18 @@ enum TransportType {
  * The player character's savegame data
  */
 struct Player {
+private:
+	/**
+	 * Synchronizes the basic fields that the original's savegame format had.
+	 */
+	void synchronizeBasic(Common::Serializer &s);
+
+	/**
+	 * Synchronize extra fields specific to ScummVM, which allows saving in more than just the overworld
+	 */
+	void synchronizeExtra(Common::Serializer &s);
+
+public:
 	// Identity
 	char _name[MAX_NAME_LENGTH + 2] = {};
 	byte _race = RACE_HUMAN;
@@ -131,8 +143,22 @@ struct Player {
 	int16 _signMarker = -1;
 	int16 _moveCount = 0;
 
+	// Extra fields
+	int16 _mapNum = 0;
+	Common::Point _locationPosition;
+
+	/**
+	 * Synchronize savegame data
+	*/
 	void synchronize(Common::Serializer &s);
 
+	/**
+	 * Used for loading in original savegames
+	 */
+	void synchronizeOriginal(Common::Serializer &s);
+	/**
+	 * Returns true if the player is dead.
+	 */
 	bool isDead() const {
 		return _hits <= 0;
 	}
diff --git a/engines/ultima/ultima1/data/tiles.h b/engines/ultima/ultima1/data/tiles.h
index 7c591aba6f6..54ae5c88365 100644
--- a/engines/ultima/ultima1/data/tiles.h
+++ b/engines/ultima/ultima1/data/tiles.h
@@ -41,11 +41,11 @@ enum TileId {
 	kTileSignpost = 6,
 	kTileCity = 7,
 	kTileCityFlag = 8,
-	kTileParty = 11,
-	kTileHorse = 12,
-	kTileCart = 13,
-	kTileRaft = 14,
-	kTileFrigate = 15,
+	kTileParty = 10,
+	kTileHorse = 11,
+	kTileCart = 12,
+	kTileRaft = 13,
+	kTileFrigate = 14,
 	kTileAircar = 16,
 	kTileShuttle = 17,
 	kTileTimeMachine = 18,
diff --git a/engines/ultima/ultima1/metaengine.cpp b/engines/ultima/ultima1/metaengine.cpp
index e566248bb6a..9cb7b03941b 100644
--- a/engines/ultima/ultima1/metaengine.cpp
+++ b/engines/ultima/ultima1/metaengine.cpp
@@ -45,6 +45,10 @@ static const KeybindingRecord MENU_KEYS[] = {
 };
 
 static const KeybindingRecord OVERWORLD_KEYS[] = {
+	{ KEYBIND_UP, "UP", _s("Up"), "UP", "JOY_UP"},
+	{ KEYBIND_DOWN, "DOWN", _s("Down"), "DOWN", "JOY_DOWN"},
+	{ KEYBIND_LEFT, "LEFT", _s("Left"), "LEFT", "JOY_LEFT"},
+	{ KEYBIND_RIGHT, "RIGHT", _s("Right"), "RIGHT", "JOY_RIGHT"},
 	{ KEYBIND_NONE, nullptr, nullptr, nullptr, nullptr }
 };
 
diff --git a/engines/ultima/ultima1/ultima1.cpp b/engines/ultima/ultima1/ultima1.cpp
index 583f8c5a48e..5e9b786b2c6 100644
--- a/engines/ultima/ultima1/ultima1.cpp
+++ b/engines/ultima/ultima1/ultima1.cpp
@@ -30,6 +30,7 @@
 #include "ultima/ultima1/console.h"
 #include "ultima/ultima1/data/tiles.h"
 #include "ultima/ultima1/views/views.h"
+#include "ultima/ultima1/metaengine.h"
 
 namespace Ultima {
 namespace Ultima1 {
@@ -54,6 +55,8 @@ Common::String Ultima1Engine::getGameId() const {
 }
 
 Common::Error Ultima1Engine::run() {
+	MetaEngine::setKeybindingMode(KBMODE_MINIMAL);
+
 	// Initialize 320x200 paletted graphics mode
 	initGraphics(320, 200);
 	g_system->getPaletteManager()->setPalette(Graphics::Palette::createEGAPalette());
@@ -61,8 +64,9 @@ Common::Error Ultima1Engine::run() {
 	// Set the engine's debugger console
 	setDebugger(new Console());
 
-	// Load the overworld tile sheet
+	// Load needed data
 	Data::loadTiles(_tiles);
+	_map.init();
 
 	Views::Views views;
 	addView("Startup");
diff --git a/engines/ultima/ultima1/ultima1.h b/engines/ultima/ultima1/ultima1.h
index fca102ec7be..97aa99fcc3b 100644
--- a/engines/ultima/ultima1/ultima1.h
+++ b/engines/ultima/ultima1/ultima1.h
@@ -114,7 +114,7 @@ public:
 };
 
 extern Ultima1Engine *g_engine;
-#define _G(X) (::Ultima1::g_engine->X)
+#define _G(X) (Ultima1::g_engine->_##X)
 
 } // namespace Ultima1
 } // namespace Ultima
diff --git a/engines/ultima/ultima1/views/overworld.cpp b/engines/ultima/ultima1/views/overworld.cpp
index 118fe84e1c4..75cf3dc908a 100644
--- a/engines/ultima/ultima1/views/overworld.cpp
+++ b/engines/ultima/ultima1/views/overworld.cpp
@@ -22,6 +22,7 @@
 #include "ultima/ultima1/views/overworld.h"
 #include "ultima/ultima1/data/map.h"
 #include "ultima/ultima1/data/tiles.h"
+#include "ultima/ultima1/metaengine.h"
 #include "ultima/shared/gfx/rect.h"
 
 namespace Ultima {
@@ -29,11 +30,21 @@ namespace Ultima1 {
 namespace Views {
 
 Overworld::Overworld() : Dialog("Overworld"), _map(this), _stats(this) {
-	_map.setBounds(Common::Rect(7, 7, 7 + Data::MAP_VISIBLE_WIDTH * Data::TILE_WIDTH,
-		7 + Data::MAP_VISIBLE_HEIGHT * Data::TILE_HEIGHT));
+	_map.setBounds(Common::Rect(8, 8, 8 + Data::MAP_VISIBLE_WIDTH * Data::TILE_WIDTH,
+		8 + Data::MAP_VISIBLE_HEIGHT * Data::TILE_HEIGHT));
 	_stats.setBounds(TextRect(31, 21, 39, 24));
 }
 
+bool Overworld::msgFocus(const FocusMessage &msg) {
+	MetaEngine::setKeybindingMode(KBMODE_OVERWORLD);
+	return View::msgFocus(msg);
+}
+
+bool Overworld::msgUnfocus(const UnfocusMessage &msg) {
+	MetaEngine::setKeybindingMode(KBMODE_MINIMAL);
+	return View::msgUnfocus(msg);
+}
+
 void Overworld::draw() {
 	auto s = getSurface();
 	s.clear();
diff --git a/engines/ultima/ultima1/views/overworld.h b/engines/ultima/ultima1/views/overworld.h
index a5109051b48..7fc53a2f0d2 100644
--- a/engines/ultima/ultima1/views/overworld.h
+++ b/engines/ultima/ultima1/views/overworld.h
@@ -44,6 +44,8 @@ public:
 	Overworld();
 	~Overworld() override {}
 
+	bool msgFocus(const FocusMessage &msg) override;
+	bool msgUnfocus(const UnfocusMessage &msg) override;
 	void draw() override;
 };
 
diff --git a/engines/ultima/ultima1/views/overworld_map.cpp b/engines/ultima/ultima1/views/overworld_map.cpp
index 68c4b7cc580..146dbfa1c76 100644
--- a/engines/ultima/ultima1/views/overworld_map.cpp
+++ b/engines/ultima/ultima1/views/overworld_map.cpp
@@ -98,32 +98,15 @@ void OverworldMap::prepareMapForDrawing() {
 	auto &map = g_engine->_map;
 	int mapLeft, mapTop;
 
-	if (map._outsideMapTile != -1) {
-		// Non-wrapping draw (used for indoor maps/dungeons with a border tile)
-		mapLeft = (map._mapX - Data::MAP_VISIBLE_CENTER_X) + 1;
-		mapTop = (map._mapY - Data::MAP_VISIBLE_CENTER_Y) + 1;
-
-		for (int oy = 0; oy < Data::MAP_VISIBLE_HEIGHT; oy++) {
-			for (int ox = 0; ox < Data::MAP_VISIBLE_WIDTH; ox++) {
-				uint8 x = mapLeft + ox;
-				uint8 y = mapTop + oy;
-
-				map._mapTilesId[oy][ox] = (x >= Data::MAP_WIDTH || y >= Data::MAP_HEIGHT) ?
-					map._outsideMapTile : map._tiles[y][x];
-			}
-		}
+	mapLeft = (map._mapX - Data::MAP_VISIBLE_CENTER_X) + 1;
+	mapTop = (map._mapY - Data::MAP_VISIBLE_CENTER_Y) + 1;
 
-	} else {
-		// Normal (wrapping) draw - overworld map
-		mapTop = (map._mapY - Data::MAP_VISIBLE_CENTER_Y) & 63;
-		mapLeft = (map._mapX - Data::MAP_VISIBLE_CENTER_X) & 63;
+	for (int oy = 0; oy < Data::MAP_VISIBLE_HEIGHT; oy++) {
+		for (int ox = 0; ox < Data::MAP_VISIBLE_WIDTH; ox++) {
+			int x = mapLeft + ox;
+			int y = mapTop + oy;
 
-		for (int oy = 0; oy < Data::MAP_VISIBLE_HEIGHT; oy++) {
-			for (int ox = 0; ox < Data::MAP_VISIBLE_WIDTH; ox++) {
-				uint8 x = (mapLeft + ox) & 63;
-				uint8 y = (mapTop + oy) & 63;
-				map._mapTilesId[oy][ox] = map._tiles[y][x];
-			}
+			map._mapTilesId[oy][ox] = map[y][x];
 		}
 	}
 


Commit: 3eaec9b09e10b81eb22476b57d476ba9ca9d6893
    https://github.com/scummvm/scummvm/commit/3eaec9b09e10b81eb22476b57d476ba9ca9d6893
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:40:46+11:00

Commit Message:
ULTIMA: ULTIMA1: Adding commands pane

Changed paths:
    engines/ultima/shared/gfx/gfx_surface.cpp
    engines/ultima/ultima1/views/commands.cpp
    engines/ultima/ultima1/views/commands.h
    engines/ultima/ultima1/views/overworld.cpp
    engines/ultima/ultima1/views/overworld.h


diff --git a/engines/ultima/shared/gfx/gfx_surface.cpp b/engines/ultima/shared/gfx/gfx_surface.cpp
index 6f48f71578d..a91f2aa85a5 100644
--- a/engines/ultima/shared/gfx/gfx_surface.cpp
+++ b/engines/ultima/shared/gfx/gfx_surface.cpp
@@ -52,8 +52,6 @@ void GfxSurface::writeString(const Common::String &str, Graphics::TextAlign alig
 		if (*p == '\n') {
 			assert(align == Graphics::kTextAlignLeft);
 			newLine();
-		} else if (*p < 32) {
-			setColor((byte)*p);
 		} else {
 			writeChar(*p);
 		}
@@ -65,7 +63,7 @@ void GfxSurface::writeChar(uint32 chr) {
 	const int fontH = _font.getFontHeight();
 	const int textW = this->w / fontW;
 
-	if (chr >= ' ') {
+	if (chr != '\n') {
 		fillRect(Common::Rect(_textPos.x * fontW, _textPos.y * fontH, (_textPos.x + 1) * fontW, (_textPos.y + 1) * fontH), _bgColor);
 		_font.drawChar(this, chr, _textPos.x * fontW, _textPos.y * fontH, _textColor);
 		_textPos.x++;
diff --git a/engines/ultima/ultima1/views/commands.cpp b/engines/ultima/ultima1/views/commands.cpp
index d3b7a527f80..dd1dd825cb0 100644
--- a/engines/ultima/ultima1/views/commands.cpp
+++ b/engines/ultima/ultima1/views/commands.cpp
@@ -25,23 +25,33 @@ namespace Ultima {
 namespace Ultima1 {
 namespace Views {
 
+Commands::Commands(UIElement *parent) : Shared::UIElement("Commands", parent), _textCursor("CommandsCursor", this) {
+}
+
 bool Commands::msgFocus(const FocusMessage &msg) {
+	return true;
+}
+
+void Commands::draw() {
 	// Get a surface. We'll maintain a persistent copy to maintain
 	// the text pos across multiple calls
 	_surface = getSurface();
 	_surface.clear();
-	_surface.setTextPos(Common::Point(0, 3));
+	_surface.setTextPos(Common::Point(0, 4));
 	_surface.setScrollable(true);
 
-	return true;
+	prompt();
 }
 
 void Commands::writeString(const Common::String &msg) {
+	_textCursor.hide();
 	_surface.writeString(msg);
 }
 
 void Commands::prompt() {
-	writeString("CMD: ");
+	writeString("\x10");
+	_textCursor.setPosition(Common::Point(1, 24));
+	_textCursor.show();
 }
 
 } // namespace Views
diff --git a/engines/ultima/ultima1/views/commands.h b/engines/ultima/ultima1/views/commands.h
index 9ee2ec8d893..451ed9cd253 100644
--- a/engines/ultima/ultima1/views/commands.h
+++ b/engines/ultima/ultima1/views/commands.h
@@ -23,6 +23,7 @@
 #define ULTIMA1_VIEWS_COMMANDS_H
 
 #include "ultima/shared/engine/events.h"
+#include "ultima/ultima1/gfx/text_cursor.h"
 
 namespace Ultima {
 namespace Ultima1 {
@@ -33,12 +34,14 @@ using namespace Shared::Messages;
 class Commands : public Shared::UIElement {
 private:
 	Shared::Gfx::GfxSurface _surface;
+	Gfx::TextCursor _textCursor;
 
 public:
-	Commands(UIElement *parent) : Shared::UIElement("Commands", parent) {}
+	Commands(UIElement *parent);
 	~Commands() override {}
 
 	bool msgFocus(const FocusMessage &msg) override;
+	void draw() override;
 	void writeString(const Common::String &msg);
 
 	void prompt();
diff --git a/engines/ultima/ultima1/views/overworld.cpp b/engines/ultima/ultima1/views/overworld.cpp
index 75cf3dc908a..a18aec8083e 100644
--- a/engines/ultima/ultima1/views/overworld.cpp
+++ b/engines/ultima/ultima1/views/overworld.cpp
@@ -29,9 +29,9 @@ namespace Ultima {
 namespace Ultima1 {
 namespace Views {
 
-Overworld::Overworld() : Dialog("Overworld"), _map(this), _stats(this) {
-	_map.setBounds(Common::Rect(8, 8, 8 + Data::MAP_VISIBLE_WIDTH * Data::TILE_WIDTH,
-		8 + Data::MAP_VISIBLE_HEIGHT * Data::TILE_HEIGHT));
+Overworld::Overworld() : Dialog("Overworld"), _map(this), _commands(this), _stats(this) {
+	_map.setBounds(TextRect(1, 1, 38, 19));
+	_commands.setBounds(TextRect(0, 20, 29, 24));
 	_stats.setBounds(TextRect(31, 21, 39, 24));
 }
 
diff --git a/engines/ultima/ultima1/views/overworld.h b/engines/ultima/ultima1/views/overworld.h
index 7fc53a2f0d2..f5af446aac0 100644
--- a/engines/ultima/ultima1/views/overworld.h
+++ b/engines/ultima/ultima1/views/overworld.h
@@ -24,6 +24,7 @@
 
 #include "ultima/ultima1/views/dialog.h"
 #include "ultima/ultima1/views/overworld_map.h"
+#include "ultima/ultima1/views/commands.h"
 #include "ultima/ultima1/views/stats.h"
 
 namespace Ultima {
@@ -38,6 +39,7 @@ namespace Views {
 class Overworld : public Dialog {
 private:
 	OverworldMap _map;
+	Commands _commands;
 	Stats _stats;
 
 public:


Commit: b414701dc127a93cbbd702ea286d403e0e221416
    https://github.com/scummvm/scummvm/commit/b414701dc127a93cbbd702ea286d403e0e221416
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:40:46+11:00

Commit Message:
ULTIMA: ULTIMA1: Overriden font drawing for left/right arrows

Changed paths:
    engines/ultima/shared/gfx/gfx_surface.cpp
    engines/ultima/shared/gfx/gfx_surface.h
    engines/ultima/ultima1/views/create_character.cpp
    engines/ultima/ultima1/views/dialog.cpp
    engines/ultima/ultima1/views/dialog.h


diff --git a/engines/ultima/shared/gfx/gfx_surface.cpp b/engines/ultima/shared/gfx/gfx_surface.cpp
index a91f2aa85a5..d40a0af4ac3 100644
--- a/engines/ultima/shared/gfx/gfx_surface.cpp
+++ b/engines/ultima/shared/gfx/gfx_surface.cpp
@@ -25,6 +25,10 @@ namespace Ultima {
 namespace Shared {
 namespace Gfx {
 
+constexpr int COLOR_NOTCH = 0;   // black - corner notch pixels
+constexpr int COLOR_BORDER = 1;  // blue - thick outer band
+constexpr int COLOR_EDGE = 15;   // white - thin inner highlight line
+
 void GfxSurface::writeString(const Common::Point &pt, const Common::String &str,
 		Graphics::TextAlign align) {
 	_textPos = pt;
@@ -65,7 +69,14 @@ void GfxSurface::writeChar(uint32 chr) {
 
 	if (chr != '\n') {
 		fillRect(Common::Rect(_textPos.x * fontW, _textPos.y * fontH, (_textPos.x + 1) * fontW, (_textPos.y + 1) * fontH), _bgColor);
-		_font.drawChar(this, chr, _textPos.x * fontW, _textPos.y * fontH, _textColor);
+
+		if (chr == 16)
+			drawRightArrow();
+		else if (chr == 17)
+			drawLeftArrow();
+		else
+			_font.drawChar(this, chr, _textPos.x * fontW, _textPos.y * fontH, _textColor);
+
 		_textPos.x++;
 	}
 
@@ -74,6 +85,33 @@ void GfxSurface::writeChar(uint32 chr) {
 	}
 }
 
+// Per-column vertical extent of an 8x8 right-pointing triangle, tip at
+// column 7 - column 0 is the full-height flat edge, tapering down to a
+// single pixel at the tip. Used to fill the triangle solid before the
+// diagonal edge highlights are drawn on top
+static const byte ARROW_TOP[8] = { 0, 0, 1, 1, 2, 2, 3, 3 };
+static const byte ARROW_BOTTOM[8] = { 7, 6, 6, 5, 5, 4, 4, 3 };
+
+void GfxSurface::drawRightArrow() {
+	int px = _textPos.x * 8, py = _textPos.y * 8;
+
+	for (int i = 0; i < 8; ++i)
+		drawLine(px + i, py + ARROW_TOP[i], px + i, py + ARROW_BOTTOM[i], COLOR_BORDER);
+
+	drawLine(px, py, px + 7, py + 3, COLOR_EDGE);
+	drawLine(px + 7, py + 3, px, py + 7, COLOR_EDGE);
+}
+
+void GfxSurface::drawLeftArrow() {
+	int px = _textPos.x * 8, py = _textPos.y * 8;
+
+	for (int i = 0; i < 8; ++i)
+		drawLine(px + 7 - i, py + ARROW_TOP[i], px + 7 - i, py + ARROW_BOTTOM[i], COLOR_BORDER);
+
+	drawLine(px + 7, py, px, py + 3, COLOR_EDGE);
+	drawLine(px, py + 3, px + 7, py + 7, COLOR_EDGE);
+}
+
 void GfxSurface::newLine() {
 	_textPos.x = 0;
 	_textPos.y++;
diff --git a/engines/ultima/shared/gfx/gfx_surface.h b/engines/ultima/shared/gfx/gfx_surface.h
index 627734a99c7..11caedc2289 100644
--- a/engines/ultima/shared/gfx/gfx_surface.h
+++ b/engines/ultima/shared/gfx/gfx_surface.h
@@ -38,6 +38,8 @@ private:
 	byte _bgColor = 0;
 	bool _scrollable = false;
 
+	void drawRightArrow();
+	void drawLeftArrow();
 	void newLine();
 
 public:
diff --git a/engines/ultima/ultima1/views/create_character.cpp b/engines/ultima/ultima1/views/create_character.cpp
index 5190f09abc5..48c23509224 100644
--- a/engines/ultima/ultima1/views/create_character.cpp
+++ b/engines/ultima/ultima1/views/create_character.cpp
@@ -81,10 +81,8 @@ void CreateCharacter::draw() {
 	s.clear();
 	drawFrame();
 
-	drawRightArrow(Common::Point(8, 0));
-	s.setColor(COLOR_EDGE);
-	s.writeString(Common::Point(9, 0), " Character Generation ");
-	drawLeftArrow(Common::Point(31, 0));
+	s.setTextPos(Point(8, 0));
+	s.writeString(Common::Point(8, 0), "\x10 Character Generation \x11");
 
 	drawAttributes(s);
 
@@ -94,8 +92,10 @@ void CreateCharacter::draw() {
 		s.writeString(Common::Point(6, 4),
 			Common::String::format("Points left to distribute: %d", _pointsRemaining));
 		drawHelp(s);
-		drawRightArrow(Common::Point(11, _selectedAttribute + 6));
-		drawLeftArrow(Common::Point(30, _selectedAttribute + 6));
+		s.setTextPos(Point(11, _selectedAttribute + 6));
+		s.writeChar(16);	// Right arrow
+		s.setTextPos(Point(30, _selectedAttribute + 6));
+		s.writeChar(17);	// Left arrow
 		break;
 
 	case RACE:
diff --git a/engines/ultima/ultima1/views/dialog.cpp b/engines/ultima/ultima1/views/dialog.cpp
index 46192ed463c..bdd0d070b9e 100644
--- a/engines/ultima/ultima1/views/dialog.cpp
+++ b/engines/ultima/ultima1/views/dialog.cpp
@@ -68,60 +68,21 @@ void Dialog::drawFrame() {
 void Dialog::drawGameDividers() {
 	auto s = getSurface();
 
-	// Erase the frame's bottom section (its border band, the lower
-	// portion of the side bands, and the bottom corners) - the dividers
-	// below replace it, running all the way to the screen edges
+	// Erase the frame's bottom section
 	s.fillRect(Common::Rect(0, 153, 320, 200), 0);
 
-	// Horizontal divider separating the map viewport (above) from the
-	// command/message log and stats panel (below). The bar and its
-	// bottom edge span the full screen width, but the top edge stops at
-	// the viewport's own inner border, meeting up with its side edges
+	// Horizontal divider separating the map viewport (above) from the command/message log and stats panel
 	s.fillRect(Common::Rect(0, 153, 320, 159), COLOR_BORDER);
 	s.drawLine(7, 152, 312, 152, COLOR_EDGE);
 	s.drawLine(0, 159, 240, 159, COLOR_EDGE);
 	s.drawLine(247, 159, 319, 159, COLOR_EDGE);
 
-	// Vertical divider between the command/message log (left) and the
-	// stats panel (right), running to the bottom of the screen
+	// Vertical divider between the command/message log (left) and the stats panel (right)
 	s.fillRect(Common::Rect(241, 153, 247, 200), COLOR_BORDER);
 	s.drawLine(240, 159, 240, 199, COLOR_EDGE);
 	s.drawLine(247, 159, 247, 199, COLOR_EDGE);
 }
 
-// Per-column vertical extent of an 8x8 right-pointing triangle, tip at
-// column 7 - column 0 is the full-height flat edge, tapering down to a
-// single pixel at the tip. Used to fill the triangle solid before the
-// diagonal edge highlights are drawn on top
-static const byte ARROW_TOP[8] = { 0, 0, 1, 1, 2, 2, 3, 3 };
-static const byte ARROW_BOTTOM[8] = { 7, 6, 6, 5, 5, 4, 4, 3 };
-
-void Dialog::drawRightArrow(const Common::Point &pt) {
-	auto s = getSurface();
-	int px = pt.x * 8, py = pt.y * 8;
-
-	s.fillRect(TextRect(pt.x, pt.y, pt.x, pt.y), COLOR_NOTCH);
-
-	for (int i = 0; i < 8; ++i)
-		s.drawLine(px + i, py + ARROW_TOP[i], px + i, py + ARROW_BOTTOM[i], COLOR_BORDER);
-
-	s.drawLine(px, py, px + 7, py + 3, COLOR_EDGE);
-	s.drawLine(px + 7, py + 3, px, py + 7, COLOR_EDGE);
-}
-
-void Dialog::drawLeftArrow(const Common::Point &pt) {
-	auto s = getSurface();
-	int px = pt.x * 8, py = pt.y * 8;
-
-	s.fillRect(TextRect(pt.x, pt.y, pt.x, pt.y), COLOR_NOTCH);
-
-	for (int i = 0; i < 8; ++i)
-		s.drawLine(px + 7 - i, py + ARROW_TOP[i], px + 7 - i, py + ARROW_BOTTOM[i], COLOR_BORDER);
-
-	s.drawLine(px + 7, py, px, py + 3, COLOR_EDGE);
-	s.drawLine(px, py + 3, px + 7, py + 7, COLOR_EDGE);
-}
-
 } // namespace Views
 } // namespace Ultima1
 } // namespace Ultima
diff --git a/engines/ultima/ultima1/views/dialog.h b/engines/ultima/ultima1/views/dialog.h
index 01e3ebcf2ee..ed7ad4f766f 100644
--- a/engines/ultima/ultima1/views/dialog.h
+++ b/engines/ultima/ultima1/views/dialog.h
@@ -45,16 +45,6 @@ protected:
 	 */
 	void drawGameDividers();
 
-	/**
-	 * Draws a small triangular right-arrow glyph, in text-cell coordinates
-	 */
-	void drawRightArrow(const Common::Point &pt);
-
-	/**
-	 * Draws a small triangular left-arrow glyph, in text-cell coordinates
-	 */
-	void drawLeftArrow(const Common::Point &pt);
-
 public:
 	Dialog(const Common::String &name) : View(name) {}
 	~Dialog() override {}


Commit: cfbbacec3469176e23704859052ab6ce90b90276
    https://github.com/scummvm/scummvm/commit/cfbbacec3469176e23704859052ab6ce90b90276
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:40:46+11:00

Commit Message:
ULTIMA: ULTIMA1: Start of overworld logic class

Changed paths:
  A engines/ultima/ultima1/logic/logic.h
  A engines/ultima/ultima1/logic/overworld_logic.cpp
  A engines/ultima/ultima1/logic/overworld_logic.h
    engines/ultima/module.mk
    engines/ultima/ultima1/data/game.cpp
    engines/ultima/ultima1/data/map.cpp
    engines/ultima/ultima1/data/map.h
    engines/ultima/ultima1/data/player.cpp
    engines/ultima/ultima1/data/player.h
    engines/ultima/ultima1/data/tiles.h
    engines/ultima/ultima1/ultima1.h
    engines/ultima/ultima1/views/overworld_map.cpp


diff --git a/engines/ultima/module.mk b/engines/ultima/module.mk
index aa735e62ea0..9e58c132131 100644
--- a/engines/ultima/module.mk
+++ b/engines/ultima/module.mk
@@ -59,6 +59,7 @@ MODULE_OBJS += \
 	ultima1/gfx/pic_decoder.o \
 	ultima1/gfx/text_cursor.o \
 	ultima1/gfx/text_input.o \
+	ultima1/logic/overworld_logic.o \
 	ultima1/views/view.o \
 	ultima1/views/commands.o \
 	ultima1/views/create_character.o \
diff --git a/engines/ultima/ultima1/data/game.cpp b/engines/ultima/ultima1/data/game.cpp
index f231177487c..9e92b097a5c 100644
--- a/engines/ultima/ultima1/data/game.cpp
+++ b/engines/ultima/ultima1/data/game.cpp
@@ -20,6 +20,7 @@
  */
 
 #include "ultima/ultima1/data/game.h"
+#include "ultima/ultima1/logic/overworld_logic.h"
 #include "ultima/ultima1/ultima1.h"
 #include "ultima/ultima1/metaengine.h"
 
@@ -32,8 +33,8 @@ void Game::startGame() {
 
 	// TODO: dungeons aren't implemented yet, so always start on the overworld
 	g_engine->replaceView("Overworld");
-
-	promptForCommand();
+	delete g_engine->_logic;
+	g_engine->_logic = new Logic::OverworldLogic();
 }
 
 void Game::message(const Common::String &name, const char *param) {
diff --git a/engines/ultima/ultima1/data/map.cpp b/engines/ultima/ultima1/data/map.cpp
index 78044cd3b6a..97f1b1243c4 100644
--- a/engines/ultima/ultima1/data/map.cpp
+++ b/engines/ultima/ultima1/data/map.cpp
@@ -28,13 +28,6 @@ namespace Ultima {
 namespace Ultima1 {
 namespace Data {
 
-constexpr int OVERWORLD_WIDTH = 168;
-constexpr int OVERWORLD_HEIGHT = 168;
-constexpr int OVERWORLD_SIZE = OVERWORLD_WIDTH * OVERWORLD_HEIGHT;
-constexpr int CITY_WIDTH = 38;
-constexpr int CITY_HEIGHT = 18;
-constexpr int CITY_SIZE = CITY_WIDTH * CITY_HEIGHT;
-
 void Map::init() {
 	// Load the overworld map
 	Common::File ow;
@@ -110,7 +103,7 @@ void Map::load(int mapNum) {
 	}
 
 	// Set up copies of the map position and player tile to use
-	_playerTileId = kTileParty;
+	_playerTileId = TILE_PLAYER;
 	clearTiles();
 }
 
@@ -124,18 +117,18 @@ bool Map::canMoveToTile(int tileNum) {
 	if (_mapX < _mapWidth && _mapY < _mapHeight) {
 		// Within the bounds of the map
 		switch (_playerTileId) {
-		case kTileTimeMachine:
+		case TILE_TIME_MACHINE:
 			return true;
-		case kTileAircar:
+		case TILE_AIRCAR:
 			// TODO
 			error("TODO: aircar");
 			break;
-		case kTileFrigate:
-			if (tileId != kTileOcean)
+		case TILE_FRIGATE1:
+			if (tileId != TILE_OCEAN)
 				return true;
 
 			goto update_xy;
-		case kTileHorse:
+		case TILE_HORSE:
 			// TODO
 			break;
 		default:
@@ -153,6 +146,19 @@ update_xy:
 	return false;
 }
 
+int Map::getMapTile(int x, int y) const {
+	int tile = (*this)[y][x];
+
+	// I honestly have no idea what this does
+	if (tile > TILE_CASTLE1) {
+		++tile;
+		if (tile == TILE_CITY2)
+			++tile;
+	}
+
+	return tile;
+}
+
 } // namespace Data
 } // namespace Ultima1
 } // namespace Ultima
diff --git a/engines/ultima/ultima1/data/map.h b/engines/ultima/ultima1/data/map.h
index b8b3eda92c5..ddcbe864ce5 100644
--- a/engines/ultima/ultima1/data/map.h
+++ b/engines/ultima/ultima1/data/map.h
@@ -28,6 +28,13 @@ namespace Ultima {
 namespace Ultima1 {
 namespace Data {
 
+constexpr int OVERWORLD_WIDTH = 168;
+constexpr int OVERWORLD_HEIGHT = 168;
+constexpr int OVERWORLD_SIZE = OVERWORLD_WIDTH * OVERWORLD_HEIGHT;
+constexpr int CITY_WIDTH = 38;
+constexpr int CITY_HEIGHT = 18;
+constexpr int CITY_SIZE = CITY_WIDTH * CITY_HEIGHT;
+
 constexpr int MAP_VISIBLE_WIDTH = 19;
 constexpr int MAP_VISIBLE_HEIGHT = 9;
 constexpr int MAP_VISIBLE_CENTER_X = 9;
@@ -132,6 +139,8 @@ public:
 	void clearTiles();
 
 	bool canMoveToTile(int tileNum);
+
+	int getMapTile(int x, int y) const;
 };
 
 } // namespace Data
diff --git a/engines/ultima/ultima1/data/player.cpp b/engines/ultima/ultima1/data/player.cpp
index 381da2d5e27..0031472826f 100644
--- a/engines/ultima/ultima1/data/player.cpp
+++ b/engines/ultima/ultima1/data/player.cpp
@@ -96,6 +96,11 @@ void Player::synchronizeOriginal(Common::Serializer &s) {
 	_mapNum = MAP_OVERWORLD;
 }
 
+int Player::getCreatureAt(int x, int y, int creatureIndex) const {
+	// TODO
+	return -1;
+}
+
 } // namespace Data
 } // namespace Ultima1
 } // namespace Ultima
diff --git a/engines/ultima/ultima1/data/player.h b/engines/ultima/ultima1/data/player.h
index 39e7db87c65..7590d09eff3 100644
--- a/engines/ultima/ultima1/data/player.h
+++ b/engines/ultima/ultima1/data/player.h
@@ -162,6 +162,8 @@ public:
 	bool isDead() const {
 		return _hits <= 0;
 	}
+
+	int getCreatureAt(int x, int y, int creatureIndex) const;
 };
 
 } // namespace Data
diff --git a/engines/ultima/ultima1/data/tiles.h b/engines/ultima/ultima1/data/tiles.h
index 54ae5c88365..20dc2518c23 100644
--- a/engines/ultima/ultima1/data/tiles.h
+++ b/engines/ultima/ultima1/data/tiles.h
@@ -33,24 +33,26 @@ constexpr int TILE_WIDTH = 16;
 constexpr int TILE_HEIGHT = 16;
 
 enum TileId {
-	kTileOcean = 0,
-	kTileGrass = 1,
-	kTileWoods = 2,
-	kTileCastle = 4,
-	kTileCastleFlag = 5,
-	kTileSignpost = 6,
-	kTileCity = 7,
-	kTileCityFlag = 8,
-	kTileParty = 10,
-	kTileHorse = 11,
-	kTileCart = 12,
-	kTileRaft = 13,
-	kTileFrigate = 14,
-	kTileAircar = 16,
-	kTileShuttle = 17,
-	kTileTimeMachine = 18,
-	kTileFirstMonster = 19,
-	kTileLastMonster = 47
+	TILE_OCEAN = 0,
+	TILE_GRASS = 1,
+	TILE_WOODS = 2,
+	TILE_MOUNTAINS = 3,
+	TILE_CASTLE1 = 4,
+	TILE_CASTLE2 = 5,
+	TILE_SIGNPOST = 6,
+	TILE_CITY1 = 7,
+	TILE_CITY2 = 8,
+	TILE_PLAYER = 10,
+	TILE_HORSE = 11,
+	TILE_CART = 12,
+	TILE_RAFT = 13,
+	TILE_FRIGATE1 = 14,
+	TILE_FRIGATE2 = 15,
+	TILE_AIRCAR = 16,
+	TILE_SHUTTLE = 17,
+	TILE_TIME_MACHINE = 18,
+	TILE_FIRST_MONSTER = 19,
+	TILE_LAST_MONSTER = 47
 };
 
 /**
diff --git a/engines/ultima/ultima1/logic/logic.h b/engines/ultima/ultima1/logic/logic.h
new file mode 100644
index 00000000000..5452d3533a7
--- /dev/null
+++ b/engines/ultima/ultima1/logic/logic.h
@@ -0,0 +1,55 @@
+
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef ULTIMA2_LOGIC_H
+#define ULTIMA2_LOGIC_H
+
+#include "common/events.h"
+
+namespace Ultima {
+namespace Ultima1 {
+namespace Logic {
+
+enum Direction {
+	DIR_LEFT = 1, DIR_RIGHT = 2, DIR_UP = 3, DIR_DOWN = 4
+};
+
+/**
+ * Base class for gameplay handling logic used by the Commands class to respond to player actions
+ * or other miscellaneous keypresses.
+ */
+class Logic {
+public:
+	virtual ~Logic() {
+	}
+
+	virtual void action(int action) {
+	}
+	virtual void keypress(Common::KeyCode keycode) {
+	}
+};
+
+} // namespace Logic
+} // namespace Ultima1
+} // namespace Ultima
+
+#endif
diff --git a/engines/ultima/ultima1/logic/overworld_logic.cpp b/engines/ultima/ultima1/logic/overworld_logic.cpp
new file mode 100644
index 00000000000..8d23e3076bf
--- /dev/null
+++ b/engines/ultima/ultima1/logic/overworld_logic.cpp
@@ -0,0 +1,107 @@
+
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "ultima/ultima1/logic/overworld_logic.h"
+#include "ultima/ultima1/data/map.h"
+#include "ultima/ultima1/ultima1.h"
+#include "ultima/ultima1/metaengine.h"
+
+namespace Ultima {
+namespace Ultima1 {
+namespace Logic {
+
+const int8 DELTA_X[5] = { 0, -1, 1, 0, 0 };
+const int8 DELTA_Y[5] = { 0, 0, 0, -1, 1 };
+
+void OverworldLogic::action(int action) {
+	switch (action) {
+	case KEYBIND_UP:
+		move(DIR_UP);
+		break;
+	case KEYBIND_DOWN:
+		move(DIR_DOWN);
+		break;
+	case KEYBIND_LEFT:
+		move(DIR_LEFT);
+		break;
+	case KEYBIND_RIGHT:
+		move(DIR_RIGHT);
+		break;
+	default:
+		break;
+	}
+}
+
+void OverworldLogic::keypress(Common::KeyCode keycode) {
+
+}
+
+void OverworldLogic::move(Direction dir) {
+	int xp = getViewportX(Data::MAP_VISIBLE_CENTER_X + DELTA_X[dir]);
+	int yp = getViewportY(Data::MAP_VISIBLE_CENTER_Y + DELTA_Y[dir]);
+	int tile = getTileAt(xp, yp, 1);
+	int transport = g_engine->_player._transportType;
+
+	if (tile >= Data::TILE_FIRST_MONSTER && tile <= Data::TILE_LAST_MONSTER) {
+		// TODO
+	} else if (transport == Data::TRANSPORT_RAFT) {
+
+	}
+}
+
+bool OverworldLogic::moveCheck(Direction dir) {
+	return false;
+}
+
+int OverworldLogic::getViewportX(int xp) const {
+	int x = g_engine->_player._position.x - Data::MAP_VISIBLE_CENTER_X + xp;
+	if (x < 0)
+		x += Data::OVERWORLD_WIDTH;
+	else if (x >= Data::OVERWORLD_WIDTH)
+		x -= Data::OVERWORLD_WIDTH;
+
+	return x;
+}
+
+int OverworldLogic::getViewportY(int yp) const {
+	int y = g_engine->_player._position.y - Data::MAP_VISIBLE_CENTER_Y + yp;
+	if (y < 0)
+		y += Data::OVERWORLD_HEIGHT;
+	else if (y >= Data::OVERWORLD_HEIGHT)
+		y -= Data::OVERWORLD_HEIGHT;
+
+	return y;
+}
+
+int OverworldLogic::getTileAt(int x, int y, int creatureIndex) const {
+	int index = g_engine->_player.getCreatureAt(x, y, creatureIndex);
+
+	if (index >= 0)
+		// TODO: overworldwidgets
+		return -1;
+
+	return g_engine->_map.getMapTile(x, y);
+}
+
+} // namespace Logic
+} // namespace Ultima1
+} // namespace Ultima
diff --git a/engines/ultima/ultima1/logic/overworld_logic.h b/engines/ultima/ultima1/logic/overworld_logic.h
new file mode 100644
index 00000000000..efe40b511da
--- /dev/null
+++ b/engines/ultima/ultima1/logic/overworld_logic.h
@@ -0,0 +1,75 @@
+
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef ULTIMA2_LOGIC_OVERWORLD_LOGIC_H
+#define ULTIMA2_LOGIC_OVERWORLD_LOGIC_H
+
+#include "ultima/ultima1/logic/logic.h"
+
+namespace Ultima {
+namespace Ultima1 {
+namespace Logic {
+
+class OverworldLogic : public Logic {
+private:
+	/**
+	 * Check for movement
+	 */
+	bool moveCheck(Direction dir);
+
+	/**
+	 * Handle movement
+	 */
+	void move(Direction dir);
+
+	/**
+	 * Get the X co-ordinate for a tile within the map, offset from the left edge of the visible map area
+	 * @param xp	X offset within the window
+	 * @return		X-coordinate within the map
+	*/
+	int getViewportX(int xp) const;
+
+	/**
+	 * Get the Y co-ordinate for a tile within the map, offset from the top edge of the visible map area
+	 * @param yp	Y offset within the window
+	 * @return		Y-coordinate within the map
+	 */
+	int getViewportY(int yp) const;
+
+	/**
+	 * Returns a tile or creature at a given co-ordinate
+	 */
+	int getTileAt(int x, int y, int creatureIndex) const;
+
+public:
+	~OverworldLogic() override {
+	}
+
+	void action(int action) override;
+	void keypress(Common::KeyCode keycode);
+};
+
+} // namespace Logic
+} // namespace Ultima1
+} // namespace Ultima
+
+#endif
diff --git a/engines/ultima/ultima1/ultima1.h b/engines/ultima/ultima1/ultima1.h
index 97aa99fcc3b..4e366362bc5 100644
--- a/engines/ultima/ultima1/ultima1.h
+++ b/engines/ultima/ultima1/ultima1.h
@@ -40,6 +40,7 @@
 #include "ultima/ultima1/data/map.h"
 #include "ultima/ultima1/data/player.h"
 #include "ultima/ultima1/data/tiles.h"
+#include "ultima/ultima1/logic/logic.h"
 
 namespace Ultima {
 namespace Ultima1 {
@@ -66,6 +67,7 @@ public:
 	Data::Map _map;
 	Data::Player _player;
 	Graphics::ManagedSurface _tiles[Data::TILE_COUNT];
+	Logic::Logic *_logic = nullptr;
 
 public:
 	Ultima1Engine(OSystem *syst, const Ultima::UltimaGameDescription *gameDesc);
diff --git a/engines/ultima/ultima1/views/overworld_map.cpp b/engines/ultima/ultima1/views/overworld_map.cpp
index 146dbfa1c76..f146bcdbfe7 100644
--- a/engines/ultima/ultima1/views/overworld_map.cpp
+++ b/engines/ultima/ultima1/views/overworld_map.cpp
@@ -42,7 +42,7 @@ void OverworldMap::timeout() {
 }
 
 void OverworldMap::animateWater() {
-	Graphics::ManagedSurface &tile = g_engine->_tiles[Data::kTileOcean];
+	Graphics::ManagedSurface &tile = g_engine->_tiles[Data::TILE_OCEAN];
 	assert(tile.w == Data::TILE_WIDTH && tile.h == Data::TILE_HEIGHT);
 
 	byte lastRow[Data::TILE_WIDTH];
@@ -56,7 +56,7 @@ void OverworldMap::animateWater() {
 }
 
 int OverworldMap::animatedTileId(byte tileId) const {
-	if (tileId == Data::kTileCastle) {
+	if (tileId == Data::TILE_CASTLE1) {
 		// Only redrawn on 2 of every 6 ticks; the other 4 ticks leave
 		// whichever frame was last drawn untouched
 		int offset = 2;
@@ -65,12 +65,12 @@ int OverworldMap::animatedTileId(byte tileId) const {
 		else if ((_animIndex % 3) == 0)
 			offset = 1;
 
-		return (offset == 2) ? -1 : Data::kTileCastle + offset;
+		return (offset == 2) ? -1 : Data::TILE_CASTLE1 + offset;
 	}
 
-	if (tileId == Data::kTileCity) {
+	if (tileId == Data::TILE_CITY1) {
 		// Redrawn every tick, biased 3:1 toward the waving-flag frame
-		return Data::kTileCity + (((_animIndex % 4) == 0) ? 0 : 1);
+		return Data::TILE_CITY1 + (((_animIndex % 4) == 0) ? 0 : 1);
 	}
 
 	return tileId;


Commit: 38d5e9d42b07cd8160e2a54f1aa9653b8f5f0a2f
    https://github.com/scummvm/scummvm/commit/38d5e9d42b07cd8160e2a54f1aa9653b8f5f0a2f
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:40:46+11:00

Commit Message:
ULTIMA: ULTIMA1: Fleshing out savegame structure

Changed paths:
    engines/ultima/ultima1/data/player.cpp
    engines/ultima/ultima1/data/player.h
    engines/ultima/ultima1/logic/overworld_logic.cpp
    engines/ultima/ultima1/ultima1.h
    engines/ultima/ultima1/views/create_character.cpp


diff --git a/engines/ultima/ultima1/data/player.cpp b/engines/ultima/ultima1/data/player.cpp
index 0031472826f..b098d6db29d 100644
--- a/engines/ultima/ultima1/data/player.cpp
+++ b/engines/ultima/ultima1/data/player.cpp
@@ -21,6 +21,7 @@
 
 #include "ultima/ultima1/data/player.h"
 #include "ultima/ultima1/data/map.h"
+#include "ultima/ultima1/ultima1.h"
 
 namespace Ultima {
 namespace Ultima1 {
@@ -30,6 +31,10 @@ const char *SEX_NAMES[] = { "Male", "Female" };
 const char *RACE_NAMES[] = { nullptr, "Human", "Elf", "Dwarf", "Bobbit" };
 const char *CLASS_NAMES[] = { nullptr, "Fighter", "Cleric", "Wizard", "Thief" };
 
+void OverworldEntity::synchronize(Common::Serializer &s) {
+	s.syncMultipleLE(_type, _data, _x, _y, _hits, _unused1, _unused2, _unused3);
+}
+
 void Player::synchronizeBasic(Common::Serializer &s) {
 	s.syncBytes((byte *)_name, MAX_NAME_LENGTH + 2);
 	s.syncAsByte(_race);
@@ -59,7 +64,7 @@ void Player::synchronizeBasic(Common::Serializer &s) {
 	s.syncAsByte(_soundOn);
 
 	for (int i = 0; i < QUEST_COUNT; ++i)
-		s.syncAsSint16LE(_quests[i]);
+		s.syncAsSint16LE(_questStatus[i]);
 
 	s.syncAsSint16LE(_redGems);
 	s.syncAsSint16LE(_greenGems);
@@ -77,7 +82,12 @@ void Player::synchronizeBasic(Common::Serializer &s) {
 
 	s.syncAsSint16LE(_enemyVessels);
 	s.syncAsSint16LE(_signMarker);
-	s.syncAsSint16LE(_moveCount);
+	s.syncAsSint16LE(_overworldEntityCount);
+	s.syncAsUint32LE(_moveCount);
+	s.syncAsUint16LE(_shipFuel);
+	s.syncAsUint16LE(_shipShield);
+	for (int i = 0; i < OVERWORLD_ENTITY_COUNT; ++i)
+		_overworldEntities[i].synchronize(s);
 }
 
 void Player::synchronizeExtra(Common::Serializer &s) {
@@ -96,9 +106,15 @@ void Player::synchronizeOriginal(Common::Serializer &s) {
 	_mapNum = MAP_OVERWORLD;
 }
 
-int Player::getCreatureAt(int x, int y, int creatureIndex) const {
-	// TODO
-	return -1;
+int Player::getEntityAt(int x, int y, int startingIndex) const {
+	int foundIndex = 0;
+	for (; startingIndex <= g_engine->_overworldEntityCount && !foundIndex; ++startingIndex) {
+		const auto &e = _overworldEntities[startingIndex];
+		if (e._x == x && e._y == y)
+			foundIndex = startingIndex;
+	}
+
+	return startingIndex;
 }
 
 } // namespace Data
diff --git a/engines/ultima/ultima1/data/player.h b/engines/ultima/ultima1/data/player.h
index 7590d09eff3..fd862f2cb4c 100644
--- a/engines/ultima/ultima1/data/player.h
+++ b/engines/ultima/ultima1/data/player.h
@@ -31,6 +31,7 @@ namespace Data {
 
 constexpr int MAX_NAME_LENGTH = 14;
 constexpr int QUEST_COUNT = 9;
+constexpr int OVERWORLD_ENTITY_COUNT = 40;
 
 extern const char *SEX_NAMES[];
 extern const char *RACE_NAMES[];
@@ -77,6 +78,20 @@ enum TransportType {
 	TRANSPORT_COUNT = 8
 };
 
+/**
+ * Entity on the overworld map, such as vechiles or creatures
+ */
+struct OverworldEntity {
+	int16 _type;
+	int16 _data;
+	int16 _x;
+	int16 _y;
+	int16 _hits;
+	int16 _unused1, _unused2, _unused3;
+
+	void synchronize(Common::Serializer &s);
+};
+
 /**
  * The player character's savegame data
  */
@@ -124,7 +139,7 @@ public:
 	bool _soundOn = true;
 
 	// Quest completion flags, one per town/dungeon
-	int16 _quests[QUEST_COUNT] = {};
+	int16 _questStatus[QUEST_COUNT] = {};
 
 	// Gems
 	int16 _redGems = 0;
@@ -141,7 +156,12 @@ public:
 
 	int16 _enemyVessels = 0;
 	int16 _signMarker = -1;
-	int16 _moveCount = 0;
+	int16 _overworldEntityCount = 0;
+	uint32 _moveCount = 0;
+	uint16 _shipFuel = 0;
+	uint16 _shipShield = 0;
+
+	OverworldEntity _overworldEntities[OVERWORLD_ENTITY_COUNT];
 
 	// Extra fields
 	int16 _mapNum = 0;
@@ -163,7 +183,14 @@ public:
 		return _hits <= 0;
 	}
 
-	int getCreatureAt(int x, int y, int creatureIndex) const;
+	/**
+	 * Checks the overworld map for an entity (creature or vechile) at a given position.
+	 * @param x		X position
+	 * @param y		Y position
+	 * @param startingIndex		Starting index array
+	 * @return 
+	*/
+	int getEntityAt(int x, int y, int startingIndex = 1) const;
 };
 
 } // namespace Data
diff --git a/engines/ultima/ultima1/logic/overworld_logic.cpp b/engines/ultima/ultima1/logic/overworld_logic.cpp
index 8d23e3076bf..a7fcda43118 100644
--- a/engines/ultima/ultima1/logic/overworld_logic.cpp
+++ b/engines/ultima/ultima1/logic/overworld_logic.cpp
@@ -93,11 +93,10 @@ int OverworldLogic::getViewportY(int yp) const {
 }
 
 int OverworldLogic::getTileAt(int x, int y, int creatureIndex) const {
-	int index = g_engine->_player.getCreatureAt(x, y, creatureIndex);
+	int entityIndex = g_engine->_player.getEntityAt(x, y, creatureIndex);
 
-	if (index >= 0)
-		// TODO: overworldwidgets
-		return -1;
+	if (entityIndex >= 0)
+		return g_engine->_player._overworldEntities[entityIndex]._type;
 
 	return g_engine->_map.getMapTile(x, y);
 }
diff --git a/engines/ultima/ultima1/ultima1.h b/engines/ultima/ultima1/ultima1.h
index 4e366362bc5..33468e3c578 100644
--- a/engines/ultima/ultima1/ultima1.h
+++ b/engines/ultima/ultima1/ultima1.h
@@ -68,6 +68,7 @@ public:
 	Data::Player _player;
 	Graphics::ManagedSurface _tiles[Data::TILE_COUNT];
 	Logic::Logic *_logic = nullptr;
+	int _overworldEntityCount = 0;
 
 public:
 	Ultima1Engine(OSystem *syst, const Ultima::UltimaGameDescription *gameDesc);
diff --git a/engines/ultima/ultima1/views/create_character.cpp b/engines/ultima/ultima1/views/create_character.cpp
index 48c23509224..737c9fbda8a 100644
--- a/engines/ultima/ultima1/views/create_character.cpp
+++ b/engines/ultima/ultima1/views/create_character.cpp
@@ -383,7 +383,7 @@ void CreateCharacter::confirmAndSave() {
 	p._soundOn = true;
 
 	for (int i = 0; i < QUEST_COUNT; ++i)
-		p._quests[i] = 0;
+		p._questStatus[i] = 0;
 	p._redGems = p._greenGems = p._blueGem = p._whiteGem = 0;
 
 	for (int i = 0; i < ARMOR_COUNT; ++i)


Commit: bb9d06ca2957ba74a8cfd7245353635b511db3ab
    https://github.com/scummvm/scummvm/commit/bb9d06ca2957ba74a8cfd7245353635b511db3ab
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:40:46+11:00

Commit Message:
ULTIMA: ULTIMA1: Support functions needed for movement code

Changed paths:
  A engines/ultima/ultima1/core/strings.cpp
  A engines/ultima/ultima1/core/strings.h
  A engines/ultima/ultima1/data/entity.cpp
  A engines/ultima/ultima1/data/entity.h
  A engines/ultima/ultima1/logic/logic.cpp
    engines/ultima/module.mk
    engines/ultima/ultima1/data/map.h
    engines/ultima/ultima1/data/player.cpp
    engines/ultima/ultima1/data/player.h
    engines/ultima/ultima1/logic/logic.h
    engines/ultima/ultima1/logic/overworld_logic.cpp
    engines/ultima/ultima1/logic/overworld_logic.h
    engines/ultima/ultima1/views/commands.cpp
    engines/ultima/ultima1/views/commands.h


diff --git a/engines/ultima/module.mk b/engines/ultima/module.mk
index 9e58c132131..9185ddee839 100644
--- a/engines/ultima/module.mk
+++ b/engines/ultima/module.mk
@@ -52,6 +52,8 @@ MODULE_OBJS += \
 	ultima1/events.o \
 	ultima1/messages.o \
 	ultima1/metaengine.o \
+	ultima1/core/strings.o \
+	ultima1/data/entity.o \
 	ultima1/data/game.o \
 	ultima1/data/map.o \
 	ultima1/data/player.o \
@@ -59,6 +61,7 @@ MODULE_OBJS += \
 	ultima1/gfx/pic_decoder.o \
 	ultima1/gfx/text_cursor.o \
 	ultima1/gfx/text_input.o \
+	ultima1/logic/logic.o \
 	ultima1/logic/overworld_logic.o \
 	ultima1/views/view.o \
 	ultima1/views/commands.o \
diff --git a/engines/ultima/ultima1/core/strings.cpp b/engines/ultima/ultima1/core/strings.cpp
new file mode 100644
index 00000000000..7ca7e2d00dd
--- /dev/null
+++ b/engines/ultima/ultima1/core/strings.cpp
@@ -0,0 +1,33 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "ultima/ultima1/core/strings.h"
+
+namespace Ultima {
+namespace Ultima1 {
+
+bool isVowel(char c) {
+	c = toupper(c);
+	return c == 'A' || c == 'E' || c == 'I' || c == 'O' || c == 'U';
+}
+
+} // namespace Ultima1
+} // namespace Ultima
diff --git a/engines/ultima/ultima1/core/strings.h b/engines/ultima/ultima1/core/strings.h
new file mode 100644
index 00000000000..ce2d882854e
--- /dev/null
+++ b/engines/ultima/ultima1/core/strings.h
@@ -0,0 +1,36 @@
+
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef ULTIMA2_CORE_STRINGS_H
+#define ULTIMA2_CORE_STRINGS_H
+
+#include "common/scummsys.h"
+
+namespace Ultima {
+namespace Ultima1 {
+
+extern bool isVowel(char c);
+
+} // namespace Ultima1
+} // namespace Ultima
+
+#endif
diff --git a/engines/ultima/ultima1/data/entity.cpp b/engines/ultima/ultima1/data/entity.cpp
new file mode 100644
index 00000000000..deaf57ea688
--- /dev/null
+++ b/engines/ultima/ultima1/data/entity.cpp
@@ -0,0 +1,50 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "ultima/ultima1/data/entity.h"
+
+namespace Ultima {
+namespace Ultima1 {
+
+const char *OVErWORLD_MONSTERS[] = {
+	"Ness creature",
+	"Giant squid",
+	"Dragon turtle",
+	"Pirate ship",
+	"Hood",
+	"Bear",
+	"Hidden archer",
+	"Dark knight",
+	"Evil trent",
+	"Thief",
+	"Orc",
+	"Knight",
+	"Necromancer",
+	"Evil ranger",
+	"Wandering warlock"
+};
+
+void OverworldEntity::synchronize(Common::Serializer &s) {
+	s.syncMultipleLE(_type, _data, _x, _y, _hits, _unused1, _unused2, _unused3);
+}
+
+} // namespace Ultima1
+} // namespace Ultima
diff --git a/engines/ultima/ultima1/data/entity.h b/engines/ultima/ultima1/data/entity.h
new file mode 100644
index 00000000000..e1de11526c8
--- /dev/null
+++ b/engines/ultima/ultima1/data/entity.h
@@ -0,0 +1,50 @@
+
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef ULTIMA2_DATA_ENTITY_H
+#define ULTIMA2_DATA_ENTITY_H
+
+#include "common/serializer.h"
+
+namespace Ultima {
+namespace Ultima1 {
+
+extern const char *OVErWORLD_MONSTERS[];
+
+/**
+ * Entity on the overworld map, such as vechiles or creatures
+ */
+struct OverworldEntity {
+	int16 _type;
+	int16 _data;
+	int16 _x;
+	int16 _y;
+	int16 _hits;
+	int16 _unused1, _unused2, _unused3;
+
+	void synchronize(Common::Serializer &s);
+};
+
+} // namespace Ultima1
+} // namespace Ultima
+
+#endif
diff --git a/engines/ultima/ultima1/data/map.h b/engines/ultima/ultima1/data/map.h
index ddcbe864ce5..b7d943053dd 100644
--- a/engines/ultima/ultima1/data/map.h
+++ b/engines/ultima/ultima1/data/map.h
@@ -45,6 +45,10 @@ enum {
 	MAP_CITY1 = 1
 };
 
+enum Direction {
+	DIR_LEFT = 1, DIR_RIGHT = 2, DIR_UP = 3, DIR_DOWN = 4
+};
+
 typedef Common::Array< Common::Array<byte> > MapTiles;
 typedef byte VisibleTiles[MAP_VISIBLE_HEIGHT][MAP_VISIBLE_WIDTH];
 
diff --git a/engines/ultima/ultima1/data/player.cpp b/engines/ultima/ultima1/data/player.cpp
index b098d6db29d..882fb27ad5b 100644
--- a/engines/ultima/ultima1/data/player.cpp
+++ b/engines/ultima/ultima1/data/player.cpp
@@ -31,10 +31,6 @@ const char *SEX_NAMES[] = { "Male", "Female" };
 const char *RACE_NAMES[] = { nullptr, "Human", "Elf", "Dwarf", "Bobbit" };
 const char *CLASS_NAMES[] = { nullptr, "Fighter", "Cleric", "Wizard", "Thief" };
 
-void OverworldEntity::synchronize(Common::Serializer &s) {
-	s.syncMultipleLE(_type, _data, _x, _y, _hits, _unused1, _unused2, _unused3);
-}
-
 void Player::synchronizeBasic(Common::Serializer &s) {
 	s.syncBytes((byte *)_name, MAX_NAME_LENGTH + 2);
 	s.syncAsByte(_race);
diff --git a/engines/ultima/ultima1/data/player.h b/engines/ultima/ultima1/data/player.h
index fd862f2cb4c..8ee6ebe7834 100644
--- a/engines/ultima/ultima1/data/player.h
+++ b/engines/ultima/ultima1/data/player.h
@@ -24,6 +24,7 @@
 
 #include "common/rect.h"
 #include "common/serializer.h"
+#include "ultima/ultima1/data/entity.h"
 
 namespace Ultima {
 namespace Ultima1 {
@@ -78,20 +79,6 @@ enum TransportType {
 	TRANSPORT_COUNT = 8
 };
 
-/**
- * Entity on the overworld map, such as vechiles or creatures
- */
-struct OverworldEntity {
-	int16 _type;
-	int16 _data;
-	int16 _x;
-	int16 _y;
-	int16 _hits;
-	int16 _unused1, _unused2, _unused3;
-
-	void synchronize(Common::Serializer &s);
-};
-
 /**
  * The player character's savegame data
  */
diff --git a/engines/ultima/ultima1/logic/logic.cpp b/engines/ultima/ultima1/logic/logic.cpp
new file mode 100644
index 00000000000..088da24d2e8
--- /dev/null
+++ b/engines/ultima/ultima1/logic/logic.cpp
@@ -0,0 +1,42 @@
+
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "ultima/ultima1/logic/logic.h"
+#include "ultima/ultima1/ultima1.h"
+
+namespace Ultima {
+namespace Ultima1 {
+namespace Logic {
+
+using namespace Shared::Messages;
+
+void Logic::writeString(const Common::String &msg) {
+	g_engine->send("Commands", GameMessage("TEXT", msg));
+}
+
+void Logic::prompt() {
+	g_engine->send("Commands", GameMessage("PROMPT"));
+}
+
+} // namespace Logic
+} // namespace Ultima1
+} // namespace Ultima
diff --git a/engines/ultima/ultima1/logic/logic.h b/engines/ultima/ultima1/logic/logic.h
index 5452d3533a7..a6ab71d4955 100644
--- a/engines/ultima/ultima1/logic/logic.h
+++ b/engines/ultima/ultima1/logic/logic.h
@@ -24,20 +24,28 @@
 #define ULTIMA2_LOGIC_H
 
 #include "common/events.h"
+#include "ultima/ultima1/data/map.h"
 
 namespace Ultima {
 namespace Ultima1 {
 namespace Logic {
 
-enum Direction {
-	DIR_LEFT = 1, DIR_RIGHT = 2, DIR_UP = 3, DIR_DOWN = 4
-};
-
 /**
  * Base class for gameplay handling logic used by the Commands class to respond to player actions
  * or other miscellaneous keypresses.
  */
 class Logic {
+protected:
+	/**
+	 * Dispatches some text to be shown in the Commands window
+	 */
+	void writeString(const Common::String &msg);
+
+	/**
+	 * Triggers a prompt display in the Commands window
+	 */
+	void prompt();
+
 public:
 	virtual ~Logic() {
 	}
diff --git a/engines/ultima/ultima1/logic/overworld_logic.cpp b/engines/ultima/ultima1/logic/overworld_logic.cpp
index a7fcda43118..0460810ac57 100644
--- a/engines/ultima/ultima1/logic/overworld_logic.cpp
+++ b/engines/ultima/ultima1/logic/overworld_logic.cpp
@@ -21,6 +21,7 @@
  */
 
 #include "ultima/ultima1/logic/overworld_logic.h"
+#include "ultima/ultima1/core/strings.h"
 #include "ultima/ultima1/data/map.h"
 #include "ultima/ultima1/ultima1.h"
 #include "ultima/ultima1/metaengine.h"
@@ -35,16 +36,16 @@ const int8 DELTA_Y[5] = { 0, 0, 0, -1, 1 };
 void OverworldLogic::action(int action) {
 	switch (action) {
 	case KEYBIND_UP:
-		move(DIR_UP);
+		move(Data::DIR_UP);
 		break;
 	case KEYBIND_DOWN:
-		move(DIR_DOWN);
+		move(Data::DIR_DOWN);
 		break;
 	case KEYBIND_LEFT:
-		move(DIR_LEFT);
+		move(Data::DIR_LEFT);
 		break;
 	case KEYBIND_RIGHT:
-		move(DIR_RIGHT);
+		move(Data::DIR_RIGHT);
 		break;
 	default:
 		break;
@@ -55,7 +56,7 @@ void OverworldLogic::keypress(Common::KeyCode keycode) {
 
 }
 
-void OverworldLogic::move(Direction dir) {
+void OverworldLogic::move(Data::Direction dir) {
 	int xp = getViewportX(Data::MAP_VISIBLE_CENTER_X + DELTA_X[dir]);
 	int yp = getViewportY(Data::MAP_VISIBLE_CENTER_Y + DELTA_Y[dir]);
 	int tile = getTileAt(xp, yp, 1);
@@ -68,7 +69,7 @@ void OverworldLogic::move(Direction dir) {
 	}
 }
 
-bool OverworldLogic::moveCheck(Direction dir) {
+bool OverworldLogic::moveCheck(Data::Direction dir) {
 	return false;
 }
 
diff --git a/engines/ultima/ultima1/logic/overworld_logic.h b/engines/ultima/ultima1/logic/overworld_logic.h
index efe40b511da..77e3087c494 100644
--- a/engines/ultima/ultima1/logic/overworld_logic.h
+++ b/engines/ultima/ultima1/logic/overworld_logic.h
@@ -24,6 +24,7 @@
 #define ULTIMA2_LOGIC_OVERWORLD_LOGIC_H
 
 #include "ultima/ultima1/logic/logic.h"
+#include "ultima/ultima1/data/map.h"
 
 namespace Ultima {
 namespace Ultima1 {
@@ -34,12 +35,12 @@ private:
 	/**
 	 * Check for movement
 	 */
-	bool moveCheck(Direction dir);
+	bool moveCheck(Data::Direction dir);
 
 	/**
 	 * Handle movement
 	 */
-	void move(Direction dir);
+	void move(Data::Direction dir);
 
 	/**
 	 * Get the X co-ordinate for a tile within the map, offset from the left edge of the visible map area
diff --git a/engines/ultima/ultima1/views/commands.cpp b/engines/ultima/ultima1/views/commands.cpp
index dd1dd825cb0..e9c91e24c70 100644
--- a/engines/ultima/ultima1/views/commands.cpp
+++ b/engines/ultima/ultima1/views/commands.cpp
@@ -43,6 +43,18 @@ void Commands::draw() {
 	prompt();
 }
 
+bool Commands::msgGame(const GameMessage &msg) {
+	if (msg._name == "TEXT") {
+		writeString(msg._stringValue);
+		return true;
+	} else if (msg._name == "PROMPT") {
+		prompt();
+		return true;
+	}
+
+	return false;
+}
+
 void Commands::writeString(const Common::String &msg) {
 	_textCursor.hide();
 	_surface.writeString(msg);
diff --git a/engines/ultima/ultima1/views/commands.h b/engines/ultima/ultima1/views/commands.h
index 451ed9cd253..4deefa13182 100644
--- a/engines/ultima/ultima1/views/commands.h
+++ b/engines/ultima/ultima1/views/commands.h
@@ -42,8 +42,9 @@ public:
 
 	bool msgFocus(const FocusMessage &msg) override;
 	void draw() override;
-	void writeString(const Common::String &msg);
+	bool msgGame(const GameMessage &msg) override;
 
+	void writeString(const Common::String &msg);
 	void prompt();
 };
 


Commit: 1a87b2ab56d79aff273ecd47d7ac7fcef15ae191
    https://github.com/scummvm/scummvm/commit/1a87b2ab56d79aff273ecd47d7ac7fcef15ae191
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:40:46+11:00

Commit Message:
ULTIMA: ULTIMA1: Implementing directional move

Changed paths:
    engines/ultima/ultima1/data/entity.cpp
    engines/ultima/ultima1/data/entity.h
    engines/ultima/ultima1/data/map.cpp
    engines/ultima/ultima1/data/map.h
    engines/ultima/ultima1/data/tiles.h
    engines/ultima/ultima1/logic/logic.cpp
    engines/ultima/ultima1/logic/logic.h
    engines/ultima/ultima1/logic/overworld_logic.cpp
    engines/ultima/ultima1/logic/overworld_logic.h
    engines/ultima/ultima1/ultima1.cpp
    engines/ultima/ultima1/ultima1.h


diff --git a/engines/ultima/ultima1/data/entity.cpp b/engines/ultima/ultima1/data/entity.cpp
index deaf57ea688..a35dcad0feb 100644
--- a/engines/ultima/ultima1/data/entity.cpp
+++ b/engines/ultima/ultima1/data/entity.cpp
@@ -23,8 +23,9 @@
 
 namespace Ultima {
 namespace Ultima1 {
+namespace Data {
 
-const char *OVErWORLD_MONSTERS[] = {
+const char *OVERWORLD_MONSTERS[] = {
 	"Ness creature",
 	"Giant squid",
 	"Dragon turtle",
@@ -46,5 +47,6 @@ void OverworldEntity::synchronize(Common::Serializer &s) {
 	s.syncMultipleLE(_type, _data, _x, _y, _hits, _unused1, _unused2, _unused3);
 }
 
+} // namespace Data
 } // namespace Ultima1
 } // namespace Ultima
diff --git a/engines/ultima/ultima1/data/entity.h b/engines/ultima/ultima1/data/entity.h
index e1de11526c8..32fd87d8df8 100644
--- a/engines/ultima/ultima1/data/entity.h
+++ b/engines/ultima/ultima1/data/entity.h
@@ -27,8 +27,9 @@
 
 namespace Ultima {
 namespace Ultima1 {
+namespace Data {
 
-extern const char *OVErWORLD_MONSTERS[];
+extern const char *OVERWORLD_MONSTERS[];
 
 /**
  * Entity on the overworld map, such as vechiles or creatures
@@ -44,6 +45,7 @@ struct OverworldEntity {
 	void synchronize(Common::Serializer &s);
 };
 
+} // namespace Data
 } // namespace Ultima1
 } // namespace Ultima
 
diff --git a/engines/ultima/ultima1/data/map.cpp b/engines/ultima/ultima1/data/map.cpp
index 97f1b1243c4..b63427844d1 100644
--- a/engines/ultima/ultima1/data/map.cpp
+++ b/engines/ultima/ultima1/data/map.cpp
@@ -28,6 +28,8 @@ namespace Ultima {
 namespace Ultima1 {
 namespace Data {
 
+const char *DIRECTION_NAMES[4] = { "West", "East", "North", "South" };
+
 void Map::init() {
 	// Load the overworld map
 	Common::File ow;
@@ -159,6 +161,10 @@ int Map::getMapTile(int x, int y) const {
 	return tile;
 }
 
+int Map::getContinentAt(int x, int y) const {
+	return (y > 77 ? 2 : 0) + (x > 83 ? 1 : 0);
+}
+
 } // namespace Data
 } // namespace Ultima1
 } // namespace Ultima
diff --git a/engines/ultima/ultima1/data/map.h b/engines/ultima/ultima1/data/map.h
index b7d943053dd..fa4a0e5444b 100644
--- a/engines/ultima/ultima1/data/map.h
+++ b/engines/ultima/ultima1/data/map.h
@@ -23,13 +23,14 @@
 #define ULTIMA1_DATA_MAP_H
 
 #include "common/archive.h"
+#include "common/rect.h"
 
 namespace Ultima {
 namespace Ultima1 {
 namespace Data {
 
 constexpr int OVERWORLD_WIDTH = 168;
-constexpr int OVERWORLD_HEIGHT = 168;
+constexpr int OVERWORLD_HEIGHT = 156;
 constexpr int OVERWORLD_SIZE = OVERWORLD_WIDTH * OVERWORLD_HEIGHT;
 constexpr int CITY_WIDTH = 38;
 constexpr int CITY_HEIGHT = 18;
@@ -52,6 +53,8 @@ enum Direction {
 typedef Common::Array< Common::Array<byte> > MapTiles;
 typedef byte VisibleTiles[MAP_VISIBLE_HEIGHT][MAP_VISIBLE_WIDTH];
 
+extern const char *DIRECTION_NAMES[4];
+
 struct Map {
 private:
 	int _currentMap = -1;
@@ -144,7 +147,21 @@ public:
 
 	bool canMoveToTile(int tileNum);
 
+	/**
+	 * Get a tile at a given position.
+	 * @param x		X position
+	 * @param y		Y position
+	 * @return		Tile Id
+	 */
 	int getMapTile(int x, int y) const;
+
+	/**
+	 * Returns the continent number at a given position
+	 */
+	int getContinentAt(int x, int y) const;
+	int getContinentAt(const Common::Point &pt) const {
+		return getContinentAt(pt.x, pt.y);
+	}
 };
 
 } // namespace Data
diff --git a/engines/ultima/ultima1/data/tiles.h b/engines/ultima/ultima1/data/tiles.h
index 20dc2518c23..9dc1c5f369d 100644
--- a/engines/ultima/ultima1/data/tiles.h
+++ b/engines/ultima/ultima1/data/tiles.h
@@ -52,6 +52,7 @@ enum TileId {
 	TILE_SHUTTLE = 17,
 	TILE_TIME_MACHINE = 18,
 	TILE_FIRST_MONSTER = 19,
+	TILE_WANDERING_WARLOCK = 47,
 	TILE_LAST_MONSTER = 47
 };
 
diff --git a/engines/ultima/ultima1/logic/logic.cpp b/engines/ultima/ultima1/logic/logic.cpp
index 088da24d2e8..3a70ab77398 100644
--- a/engines/ultima/ultima1/logic/logic.cpp
+++ b/engines/ultima/ultima1/logic/logic.cpp
@@ -37,6 +37,10 @@ void Logic::prompt() {
 	g_engine->send("Commands", GameMessage("PROMPT"));
 }
 
+void Logic::playFX(int num) {
+	g_engine->playFX(num);
+}
+
 } // namespace Logic
 } // namespace Ultima1
 } // namespace Ultima
diff --git a/engines/ultima/ultima1/logic/logic.h b/engines/ultima/ultima1/logic/logic.h
index a6ab71d4955..2c08cc0da00 100644
--- a/engines/ultima/ultima1/logic/logic.h
+++ b/engines/ultima/ultima1/logic/logic.h
@@ -46,6 +46,11 @@ protected:
 	 */
 	void prompt();
 
+	/**
+	 * Play a sound effect
+	 */
+	void playFX(int num);
+
 public:
 	virtual ~Logic() {
 	}
diff --git a/engines/ultima/ultima1/logic/overworld_logic.cpp b/engines/ultima/ultima1/logic/overworld_logic.cpp
index 0460810ac57..73bf5448fc1 100644
--- a/engines/ultima/ultima1/logic/overworld_logic.cpp
+++ b/engines/ultima/ultima1/logic/overworld_logic.cpp
@@ -22,6 +22,7 @@
 
 #include "ultima/ultima1/logic/overworld_logic.h"
 #include "ultima/ultima1/core/strings.h"
+#include "ultima/ultima1/data/entity.h"
 #include "ultima/ultima1/data/map.h"
 #include "ultima/ultima1/ultima1.h"
 #include "ultima/ultima1/metaengine.h"
@@ -30,6 +31,21 @@ namespace Ultima {
 namespace Ultima1 {
 namespace Logic {
 
+enum {
+	IMP_WATER, IMP_MOUNTAINS, IMP_WOODS, IMP_FRIGATES_WATER, IMP_RAFTS_WATER,
+	IMP_BLOCKED_BY, IMP_MOVE_ON_LAND = 6
+};
+
+constexpr int OVERWORLD_MID_Y = Data::OVERWORLD_HEIGHT / 2 - 1;
+
+static const char *IMPASSABLE_REASONS[] = {
+	"You can't walk on water!",
+	"Mountains are impassable!",
+	"Aircars can't pass woods!",
+	"Frigates like water!",
+	"Rafts like water!"
+};
+
 const int8 DELTA_X[5] = { 0, -1, 1, 0, 0 };
 const int8 DELTA_Y[5] = { 0, 0, 0, -1, 1 };
 
@@ -57,20 +73,82 @@ void OverworldLogic::keypress(Common::KeyCode keycode) {
 }
 
 void OverworldLogic::move(Data::Direction dir) {
+	if (!moveCheck(dir))
+		return;
+
+	int continentNum = g_engine->_map.getContinentAt(g_engine->_player._position);
+	if (g_engine->_player._transportType <= Data::TRANSPORT_CART)
+		playFX(4);
+
+	// Write direction traveled
+	writeString(Common::String::format("%s\n", Data::DIRECTION_NAMES[dir]));
+
+	switch (dir) {
+	case Data::DIR_LEFT:
+		moveLeft();
+		break;
+	case Data::DIR_RIGHT:
+		moveRight();
+		break;
+	case Data::DIR_UP:
+		moveUp();
+		break;
+	case Data::DIR_DOWN:
+		moveDown();
+		break;
+	}
+}
+
+bool OverworldLogic::moveCheck(Data::Direction dir) {
 	int xp = getViewportX(Data::MAP_VISIBLE_CENTER_X + DELTA_X[dir]);
 	int yp = getViewportY(Data::MAP_VISIBLE_CENTER_Y + DELTA_Y[dir]);
 	int tile = getTileAt(xp, yp, 1);
 	int transport = g_engine->_player._transportType;
 
 	if (tile >= Data::TILE_FIRST_MONSTER && tile <= Data::TILE_LAST_MONSTER) {
-		// TODO
-	} else if (transport == Data::TRANSPORT_RAFT) {
+		Common::String msg = Common::String::format("Blocked by a");
+		const char *monsterName = Data::OVERWORLD_MONSTERS[(tile - Data::TILE_FIRST_MONSTER) / 2];
+		if (isVowel(*monsterName))
+			msg += '\n';
+		msg += ' ';
+
+		if (tile == Data::TILE_WANDERING_WARLOCK)
+			msg += '\n';
+		msg += monsterName;
+		msg += "!\n";
+
+		writeString(msg);
+		g_engine->playFX(0);
+		return false;
+
+	} else if (tile == Data::TILE_MOUNTAINS) {
+		impassable(IMP_MOUNTAINS);
+		return false;
+
+	} else if (tile == Data::TILE_OCEAN) {
+		if (transport != Data::TRANSPORT_FRIGATE && transport != Data::TRANSPORT_RAFT &&
+				transport != Data::TRANSPORT_AIRCAR) {
+			impassable(IMP_WATER);
+			return false;
+		}
+	} else if (tile == Data::TILE_WOODS && Data::TRANSPORT_AIRCAR) {
+		impassable(IMP_WOODS);
+		return false;
+
+	} else if (transport == Data::TRANSPORT_FRIGATE && tile != Data::TILE_OCEAN) {
+		impassable(IMP_FRIGATES_WATER);
+		return false;
 
+	} else if (transport == Data::TRANSPORT_RAFT && tile != Data::TILE_OCEAN) {
+		impassable(IMP_RAFTS_WATER);
+		return false;
+
+	} else if (transport >= Data::TRANSPORT_SHUTTLE) {
+		impassable(IMP_MOVE_ON_LAND);
+		return false;
 	}
-}
 
-bool OverworldLogic::moveCheck(Data::Direction dir) {
-	return false;
+	return true;
 }
 
 int OverworldLogic::getViewportX(int xp) const {
@@ -102,6 +180,105 @@ int OverworldLogic::getTileAt(int x, int y, int creatureIndex) const {
 	return g_engine->_map.getMapTile(x, y);
 }
 
+void OverworldLogic::impassable(int reason) {
+	writeString(Common::String::format("%s\n", IMPASSABLE_REASONS[reason]));
+	playFX(0);
+}
+
+void OverworldLogic::moveLeft() {
+	// Change overworld position
+	Common::Point &pt = g_engine->_player._position;
+	if (pt.x > 0) {
+		pt.x--;
+	} else {
+		pt.x = Data::OVERWORLD_WIDTH - 1;
+		pt.y = (pt.y >= OVERWORLD_MID_Y) ? pt.y - OVERWORLD_MID_Y : pt.y + OVERWORLD_MID_Y;
+	}
+
+	// Shift the existing columns right by one, to make room for a new
+	// column of tiles at the left edge
+	auto &tiles = g_engine->_map._mapTilesId;
+	for (int col = Data::MAP_VISIBLE_WIDTH - 2; col >= 0; --col) {
+		for (int row = 0; row < Data::MAP_VISIBLE_HEIGHT; ++row)
+			tiles[row][col + 1] = tiles[row][col];
+	}
+
+	// Fill in the new left-hand column
+	for (int row = 0; row < Data::MAP_VISIBLE_HEIGHT; ++row) {
+		int x = getViewportX(0);
+		int y = getViewportY(row);
+		tiles[row][0] = g_engine->_map.getMapTile(x, y);
+	}
+}
+
+void OverworldLogic::moveRight() {
+	// Change overworld position
+	Common::Point &pt = g_engine->_player._position;
+	if (pt.x != Data::OVERWORLD_WIDTH - 1) {
+		pt.x++;
+	} else {
+		pt.y = (pt.y >= OVERWORLD_MID_Y) ? pt.y - OVERWORLD_MID_Y : pt.y + OVERWORLD_MID_Y;
+		pt.x = 0;
+	}
+
+	// Shift the existing columns left by one, to make room for a new
+	// column of tiles at the right edge
+	auto &tiles = g_engine->_map._mapTilesId;
+	for (int col = 1; col < Data::MAP_VISIBLE_WIDTH; ++col) {
+		for (int row = 0; row < Data::MAP_VISIBLE_HEIGHT; ++row)
+			tiles[row][col - 1] = tiles[row][col];
+	}
+
+	// Fill in the new right-hand column
+	for (int row = 0; row < Data::MAP_VISIBLE_HEIGHT; ++row) {
+		int x = getViewportX(Data::MAP_VISIBLE_WIDTH - 1);
+		int y = getViewportY(row);
+		tiles[row][Data::MAP_VISIBLE_WIDTH - 1] = g_engine->_map.getMapTile(x, y);
+	}
+}
+
+void OverworldLogic::moveUp() {
+	// Change overworld position
+	Common::Point &pt = g_engine->_player._position;
+	pt.y = (pt.y == 0) ? Data::OVERWORLD_HEIGHT - 1 : pt.y - 1;
+
+	// Shift the existing rows down by one, to make room for a new
+	// row of tiles at the top edge
+	auto &tiles = g_engine->_map._mapTilesId;
+	for (int row = Data::MAP_VISIBLE_HEIGHT - 2; row >= 0; --row) {
+		for (int col = 0; col < Data::MAP_VISIBLE_WIDTH; ++col)
+			tiles[row + 1][col] = tiles[row][col];
+	}
+
+	// Fill in the new top row
+	for (int col = 0; col < Data::MAP_VISIBLE_WIDTH; ++col) {
+		int x = getViewportX(col);
+		int y = getViewportY(0);
+		tiles[0][col] = g_engine->_map.getMapTile(x, y);
+	}
+}
+
+void OverworldLogic::moveDown() {
+	// Change overworld position
+	Common::Point &pt = g_engine->_player._position;
+	pt.y = (pt.y == Data::OVERWORLD_HEIGHT - 1) ? 0 : pt.y + 1;
+
+	// Shift the existing rows up by one, to make room for a new
+	// row of tiles at the bottom edge
+	auto &tiles = g_engine->_map._mapTilesId;
+	for (int row = 1; row < Data::MAP_VISIBLE_HEIGHT; ++row) {
+		for (int col = 0; col < Data::MAP_VISIBLE_WIDTH; ++col)
+			tiles[row - 1][col] = tiles[row][col];
+	}
+
+	// Fill in the new bottom row
+	for (int col = 0; col < Data::MAP_VISIBLE_WIDTH; ++col) {
+		int x = getViewportX(col);
+		int y = getViewportY(Data::MAP_VISIBLE_HEIGHT - 1);
+		tiles[Data::MAP_VISIBLE_HEIGHT - 1][col] = g_engine->_map.getMapTile(x, y);
+	}
+}
+
 } // namespace Logic
 } // namespace Ultima1
 } // namespace Ultima
diff --git a/engines/ultima/ultima1/logic/overworld_logic.h b/engines/ultima/ultima1/logic/overworld_logic.h
index 77e3087c494..5f3578fba46 100644
--- a/engines/ultima/ultima1/logic/overworld_logic.h
+++ b/engines/ultima/ultima1/logic/overworld_logic.h
@@ -61,6 +61,31 @@ private:
 	 */
 	int getTileAt(int x, int y, int creatureIndex) const;
 
+	/**
+	 * Impassable tile
+	 */
+	void impassable(int reason);
+
+	/**
+	 * Move left
+	 */
+	void moveLeft();
+
+	/**
+	 * Move right
+	 */
+	void moveRight();
+
+	/**
+	 * Move up
+	 */
+	void moveUp();
+
+	/**
+	 * Move down
+	 */
+	void moveDown();
+
 public:
 	~OverworldLogic() override {
 	}
diff --git a/engines/ultima/ultima1/ultima1.cpp b/engines/ultima/ultima1/ultima1.cpp
index 5e9b786b2c6..50394fd3ca1 100644
--- a/engines/ultima/ultima1/ultima1.cpp
+++ b/engines/ultima/ultima1/ultima1.cpp
@@ -93,5 +93,9 @@ bool Ultima1Engine::savegamesExist() const {
 	return result;
 }
 
+void Ultima1Engine::playFX(int num) {
+	warning("TODO: playFX(%d)", num);
+}
+
 } // namespace Ultima1
 } // namespace Ultima
diff --git a/engines/ultima/ultima1/ultima1.h b/engines/ultima/ultima1/ultima1.h
index 33468e3c578..e8b9eb95eeb 100644
--- a/engines/ultima/ultima1/ultima1.h
+++ b/engines/ultima/ultima1/ultima1.h
@@ -114,6 +114,11 @@ public:
 	 * Returns true if any savegames exist
 	 */
 	bool savegamesExist() const;
+
+	/**
+	 * Play a sound effect
+	 */
+	void playFX(int num);
 };
 
 extern Ultima1Engine *g_engine;


Commit: 0e0fd48efedf1e07dbea899569f64d90354f8a34
    https://github.com/scummvm/scummvm/commit/0e0fd48efedf1e07dbea899569f64d90354f8a34
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:40:46+11:00

Commit Message:
ULTIMA: ULTIMA1: Remaining overworld movement logic

Changed paths:
    engines/ultima/ultima1/data/map.cpp
    engines/ultima/ultima1/data/player.cpp
    engines/ultima/ultima1/data/player.h
    engines/ultima/ultima1/logic/overworld_logic.cpp
    engines/ultima/ultima1/logic/overworld_logic.h
    engines/ultima/ultima1/ultima1.h


diff --git a/engines/ultima/ultima1/data/map.cpp b/engines/ultima/ultima1/data/map.cpp
index b63427844d1..5518f1baecd 100644
--- a/engines/ultima/ultima1/data/map.cpp
+++ b/engines/ultima/ultima1/data/map.cpp
@@ -96,7 +96,7 @@ void Map::load(int mapNum) {
 
 		_mapRows.clear();
 		_mapRows.reserve(CITY_HEIGHT + 1);		// One extra row for out-of-bounds y access
-		for (int y = 0; y < OVERWORLD_HEIGHT; ++y)
+		for (int y = 0; y < CITY_HEIGHT; ++y)
 			_mapRows.push_back(Row(this, &_cityMap[mapNum - 1][y * CITY_WIDTH]));
 		_mapRows.push_back(Row(this, nullptr));
 
diff --git a/engines/ultima/ultima1/data/player.cpp b/engines/ultima/ultima1/data/player.cpp
index 882fb27ad5b..bb230cac3d2 100644
--- a/engines/ultima/ultima1/data/player.cpp
+++ b/engines/ultima/ultima1/data/player.cpp
@@ -103,16 +103,29 @@ void Player::synchronizeOriginal(Common::Serializer &s) {
 }
 
 int Player::getEntityAt(int x, int y, int startingIndex) const {
-	int foundIndex = 0;
-	for (; startingIndex <= g_engine->_overworldEntityCount && !foundIndex; ++startingIndex) {
+	int foundIndex = -1;
+	for (; startingIndex <= g_engine->_overworldEntityCount && foundIndex == -1; ++startingIndex) {
 		const auto &e = _overworldEntities[startingIndex];
 		if (e._x == x && e._y == y)
 			foundIndex = startingIndex;
 	}
 
-	return startingIndex;
+	return foundIndex;
 }
 
+void Player::removeCreatureAt(int x, int y) {
+	int creatureNum = getEntityAt(x, y, 1);
+	if (creatureNum <= 0)
+		return;
+
+	// Shift all following entities down a slot, removing the found one
+	for (int idx = creatureNum; idx < g_engine->_overworldEntityCount; ++idx)
+		_overworldEntities[idx] = _overworldEntities[idx + 1];
+
+	--g_engine->_overworldEntityCount;
+}
+
+
 } // namespace Data
 } // namespace Ultima1
 } // namespace Ultima
diff --git a/engines/ultima/ultima1/data/player.h b/engines/ultima/ultima1/data/player.h
index 8ee6ebe7834..15bb2db9298 100644
--- a/engines/ultima/ultima1/data/player.h
+++ b/engines/ultima/ultima1/data/player.h
@@ -178,6 +178,11 @@ public:
 	 * @return 
 	*/
 	int getEntityAt(int x, int y, int startingIndex = 1) const;
+
+	/**
+	 * Removes a creature from a given X/Y position on the map
+	 */
+	void removeCreatureAt(int x, int y);
 };
 
 } // namespace Data
diff --git a/engines/ultima/ultima1/logic/overworld_logic.cpp b/engines/ultima/ultima1/logic/overworld_logic.cpp
index 73bf5448fc1..927a168f17a 100644
--- a/engines/ultima/ultima1/logic/overworld_logic.cpp
+++ b/engines/ultima/ultima1/logic/overworld_logic.cpp
@@ -76,13 +76,14 @@ void OverworldLogic::move(Data::Direction dir) {
 	if (!moveCheck(dir))
 		return;
 
-	int continentNum = g_engine->_map.getContinentAt(g_engine->_player._position);
 	if (g_engine->_player._transportType <= Data::TRANSPORT_CART)
 		playFX(4);
 
 	// Write direction traveled
 	writeString(Common::String::format("%s\n", Data::DIRECTION_NAMES[dir]));
 
+	int continentNum = g_engine->_map.getContinentAt(g_engine->_player._position);
+
 	switch (dir) {
 	case Data::DIR_LEFT:
 		moveLeft();
@@ -97,6 +98,9 @@ void OverworldLogic::move(Data::Direction dir) {
 		moveDown();
 		break;
 	}
+
+	if (g_engine->_map.getContinentAt(g_engine->_player._position) != continentNum)
+		continentChanged(continentNum);
 }
 
 bool OverworldLogic::moveCheck(Data::Direction dir) {
@@ -279,6 +283,18 @@ void OverworldLogic::moveDown() {
 	}
 }
 
+void OverworldLogic::continentChanged(int oldContinent) {
+	for (int index = 1; index < g_engine->_overworldEntityCount; ++index) {
+		auto &e = g_engine->_player._overworldEntities[index];
+		int continent = g_engine->_map.getContinentAt(e._x, e._y);
+
+		if (continent == oldContinent) {
+			g_engine->_player.removeCreatureAt(e._x, e._y);
+			g_engine->_creaturesCount--;
+		}
+	}
+}
+
 } // namespace Logic
 } // namespace Ultima1
 } // namespace Ultima
diff --git a/engines/ultima/ultima1/logic/overworld_logic.h b/engines/ultima/ultima1/logic/overworld_logic.h
index 5f3578fba46..69eeed02341 100644
--- a/engines/ultima/ultima1/logic/overworld_logic.h
+++ b/engines/ultima/ultima1/logic/overworld_logic.h
@@ -86,6 +86,11 @@ private:
 	 */
 	void moveDown();
 
+	/**
+	 * Called when the player changes their current continent
+	 */
+	void continentChanged(int oldContinent);
+
 public:
 	~OverworldLogic() override {
 	}
diff --git a/engines/ultima/ultima1/ultima1.h b/engines/ultima/ultima1/ultima1.h
index e8b9eb95eeb..822c877f9e4 100644
--- a/engines/ultima/ultima1/ultima1.h
+++ b/engines/ultima/ultima1/ultima1.h
@@ -69,6 +69,7 @@ public:
 	Graphics::ManagedSurface _tiles[Data::TILE_COUNT];
 	Logic::Logic *_logic = nullptr;
 	int _overworldEntityCount = 0;
+	int _creaturesCount = 0;
 
 public:
 	Ultima1Engine(OSystem *syst, const Ultima::UltimaGameDescription *gameDesc);


Commit: b812dee126429f648e5a2079ff89b0bf2080d49d
    https://github.com/scummvm/scummvm/commit/b812dee126429f648e5a2079ff89b0bf2080d49d
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:40:46+11:00

Commit Message:
ULTIMA: ULTIMA1: In progress end of turn code

Changed paths:
  A engines/ultima/ultima1/data/savegame.cpp
  A engines/ultima/ultima1/data/savegame.h
  R engines/ultima/ultima1/data/player.cpp
  R engines/ultima/ultima1/data/player.h
    engines/ultima/module.mk
    engines/ultima/ultima1/data/entity.cpp
    engines/ultima/ultima1/data/entity.h
    engines/ultima/ultima1/data/game.cpp
    engines/ultima/ultima1/data/map.cpp
    engines/ultima/ultima1/data/map.h
    engines/ultima/ultima1/logic/logic.cpp
    engines/ultima/ultima1/logic/logic.h
    engines/ultima/ultima1/logic/overworld_logic.cpp
    engines/ultima/ultima1/logic/overworld_logic.h
    engines/ultima/ultima1/ultima1.cpp
    engines/ultima/ultima1/ultima1.h
    engines/ultima/ultima1/views/commands.cpp
    engines/ultima/ultima1/views/commands.h
    engines/ultima/ultima1/views/create_character.cpp
    engines/ultima/ultima1/views/overworld.cpp
    engines/ultima/ultima1/views/overworld.h
    engines/ultima/ultima1/views/overworld_map.cpp
    engines/ultima/ultima1/views/stats.cpp


diff --git a/engines/ultima/module.mk b/engines/ultima/module.mk
index 9185ddee839..bf8a81598c9 100644
--- a/engines/ultima/module.mk
+++ b/engines/ultima/module.mk
@@ -56,7 +56,7 @@ MODULE_OBJS += \
 	ultima1/data/entity.o \
 	ultima1/data/game.o \
 	ultima1/data/map.o \
-	ultima1/data/player.o \
+	ultima1/data/savegame.o \
 	ultima1/data/tiles.o \
 	ultima1/gfx/pic_decoder.o \
 	ultima1/gfx/text_cursor.o \
diff --git a/engines/ultima/ultima1/data/entity.cpp b/engines/ultima/ultima1/data/entity.cpp
index a35dcad0feb..9c8df47316d 100644
--- a/engines/ultima/ultima1/data/entity.cpp
+++ b/engines/ultima/ultima1/data/entity.cpp
@@ -43,10 +43,30 @@ const char *OVERWORLD_MONSTERS[] = {
 	"Wandering warlock"
 };
 
+const int OVERWORLD_MONSTERS_DAMAGE[MONSTER_TYPE_COUNT] = {
+	10, 5, 4, 3, 2, 1, 4, 6, 8, 10, 1, 2, 4, 6, 8
+};
+
+const int OVERWORLD_MONSTERS_HITS[MONSTER_TYPE_COUNT] = {
+	4, 6, 8, 10, 1, 2, 4, 6, 8, 2, 4, 6, 8, 9, 10
+};
+
+const int MONSTER_THRESHOLDS_PER_LEVEL[10] = {
+	35, 55, 75, 95, 115, 135, 155, 175, 195, 205
+};
+
 void OverworldEntity::synchronize(Common::Serializer &s) {
 	s.syncMultipleLE(_type, _data, _x, _y, _hits, _unused1, _unused2, _unused3);
 }
 
+int OverworldEntity::getMonsterAttackDistance(int tileNum, int xDiff, int yDiff) {
+	int threshold = (tileNum == 23 || tileNum == 25 || tileNum == 31 || tileNum == 47) ? 3 : 1;
+	int maxDiff = MAX(ABS(xDiff), ABS(yDiff));
+
+	return (maxDiff > threshold) ? 0 : threshold;
+}
+
+
 } // namespace Data
 } // namespace Ultima1
 } // namespace Ultima
diff --git a/engines/ultima/ultima1/data/entity.h b/engines/ultima/ultima1/data/entity.h
index 32fd87d8df8..ffa12311939 100644
--- a/engines/ultima/ultima1/data/entity.h
+++ b/engines/ultima/ultima1/data/entity.h
@@ -29,8 +29,22 @@ namespace Ultima {
 namespace Ultima1 {
 namespace Data {
 
+constexpr int MONSTER_TYPE_COUNT = 15;
+
 extern const char *OVERWORLD_MONSTERS[];
 
+// Per monster-type coin/experience reward multiplier, indexed by
+// (tileNum - TILE_FIRST_MONSTER) / 2
+extern const int OVERWORLD_MONSTERS_DAMAGE[MONSTER_TYPE_COUNT];
+
+// Per monster-type base hit points value, also reused as a spawn-weighting
+// threshold when picking which monster type to generate
+extern const int OVERWORLD_MONSTERS_HITS[MONSTER_TYPE_COUNT];
+
+// Spawn-chance threshold per character level (experience / 1000), checked
+// against a 1-255 random roll each turn
+extern const int MONSTER_THRESHOLDS_PER_LEVEL[10];
+
 /**
  * Entity on the overworld map, such as vechiles or creatures
  */
@@ -43,6 +57,12 @@ struct OverworldEntity {
 	int16 _unused1, _unused2, _unused3;
 
 	void synchronize(Common::Serializer &s);
+
+	/**
+	 * Returns the attack range for a monster tile if the player is within
+	 * it, else 0 if the player is currently too far away to be attacked
+	 */
+	static int getMonsterAttackDistance(int tileNum, int xDiff, int yDiff);
 };
 
 } // namespace Data
diff --git a/engines/ultima/ultima1/data/game.cpp b/engines/ultima/ultima1/data/game.cpp
index 9e92b097a5c..6c046241ca3 100644
--- a/engines/ultima/ultima1/data/game.cpp
+++ b/engines/ultima/ultima1/data/game.cpp
@@ -29,7 +29,7 @@ namespace Ultima1 {
 namespace Data {
 
 void Game::startGame() {
-	_G(map).load(_G(player)._mapNum);
+	_G(map).load(_G(savegame)._mapNum);
 
 	// TODO: dungeons aren't implemented yet, so always start on the overworld
 	g_engine->replaceView("Overworld");
@@ -66,7 +66,7 @@ void Game::doCommand(int action) {
 }
 
 void Game::endOfTurn() {
-	auto &player = g_engine->_player;
+	auto &player = _G(savegame);
 
 	subtractFoodCtr(10);
 	if (!player.isDead()) {
@@ -76,7 +76,7 @@ void Game::endOfTurn() {
 }
 
 void Game::subtractFoodCtr(int amount) {
-	auto &player = g_engine->_player;
+	auto &player = _G(savegame);
 	if (player.isDead())
 		return;		// Already dead
 
@@ -86,7 +86,7 @@ void Game::subtractFoodCtr(int amount) {
 }
 
 void Game::subtractHp(int amount) {
-	auto &player = g_engine->_player;
+	auto &player = _G(savegame);
 	player._hits = MAX((int)player._hits - amount, 0);
 
 	if (player._hits == 0)
@@ -94,7 +94,7 @@ void Game::subtractHp(int amount) {
 }
 
 void Game::dead() {
-	auto &player = g_engine->_player;
+	auto &player = _G(savegame);
 	player._hits = 0;
 	player._food = 0;
 	player._experience = 0;
diff --git a/engines/ultima/ultima1/data/map.cpp b/engines/ultima/ultima1/data/map.cpp
index 5518f1baecd..343fcff4f26 100644
--- a/engines/ultima/ultima1/data/map.cpp
+++ b/engines/ultima/ultima1/data/map.cpp
@@ -28,7 +28,7 @@ namespace Ultima {
 namespace Ultima1 {
 namespace Data {
 
-const char *DIRECTION_NAMES[4] = { "West", "East", "North", "South" };
+const char *DIRECTION_NAMES[5] = { nullptr, "West", "East", "North", "South" };
 
 void Map::init() {
 	// Load the overworld map
@@ -72,7 +72,7 @@ void Map::init() {
 }
 
 void Map::load(int mapNum) {
-	const auto &player = g_engine->_player;
+	const auto &player = _G(savegame);
 
 	_currentMap = mapNum;
 
@@ -165,6 +165,20 @@ int Map::getContinentAt(int x, int y) const {
 	return (y > 77 ? 2 : 0) + (x > 83 ? 1 : 0);
 }
 
+bool Map::mapRangeCheckX(int xp) const {
+	if (xp > 83)
+		xp -= 84;
+
+	return !(xp >= 159 || xp <= 8);
+}
+
+bool Map::mapRangeCheckY(int yp) const {
+	if (yp > 77)
+		yp -= 78;
+
+	return !(yp >= 150 || yp <= 5);
+}
+
 } // namespace Data
 } // namespace Ultima1
 } // namespace Ultima
diff --git a/engines/ultima/ultima1/data/map.h b/engines/ultima/ultima1/data/map.h
index fa4a0e5444b..63f3d0bf127 100644
--- a/engines/ultima/ultima1/data/map.h
+++ b/engines/ultima/ultima1/data/map.h
@@ -53,7 +53,7 @@ enum Direction {
 typedef Common::Array< Common::Array<byte> > MapTiles;
 typedef byte VisibleTiles[MAP_VISIBLE_HEIGHT][MAP_VISIBLE_WIDTH];
 
-extern const char *DIRECTION_NAMES[4];
+extern const char *DIRECTION_NAMES[5];
 
 struct Map {
 private:
@@ -162,6 +162,18 @@ public:
 	int getContinentAt(const Common::Point &pt) const {
 		return getContinentAt(pt.x, pt.y);
 	}
+
+	/**
+	 * Returns true if a map X co-ordinate is far enough from a
+	 * continent boundary to be a valid creature spawn/move position
+	 */
+	bool mapRangeCheckX(int xp) const;
+
+	/**
+	 * Returns true if a map Y co-ordinate is far enough from a
+	 * continent boundary to be a valid creature spawn/move position
+	 */
+	bool mapRangeCheckY(int yp) const;
 };
 
 } // namespace Data
diff --git a/engines/ultima/ultima1/data/player.cpp b/engines/ultima/ultima1/data/savegame.cpp
similarity index 85%
rename from engines/ultima/ultima1/data/player.cpp
rename to engines/ultima/ultima1/data/savegame.cpp
index bb230cac3d2..525781ac776 100644
--- a/engines/ultima/ultima1/data/player.cpp
+++ b/engines/ultima/ultima1/data/savegame.cpp
@@ -19,7 +19,7 @@
  *
  */
 
-#include "ultima/ultima1/data/player.h"
+#include "ultima/ultima1/data/savegame.h"
 #include "ultima/ultima1/data/map.h"
 #include "ultima/ultima1/ultima1.h"
 
@@ -31,7 +31,7 @@ const char *SEX_NAMES[] = { "Male", "Female" };
 const char *RACE_NAMES[] = { nullptr, "Human", "Elf", "Dwarf", "Bobbit" };
 const char *CLASS_NAMES[] = { nullptr, "Fighter", "Cleric", "Wizard", "Thief" };
 
-void Player::synchronizeBasic(Common::Serializer &s) {
+void Savegame::synchronizeBasic(Common::Serializer &s) {
 	s.syncBytes((byte *)_name, MAX_NAME_LENGTH + 2);
 	s.syncAsByte(_race);
 	s.syncAsByte(_class);
@@ -86,25 +86,25 @@ void Player::synchronizeBasic(Common::Serializer &s) {
 		_overworldEntities[i].synchronize(s);
 }
 
-void Player::synchronizeExtra(Common::Serializer &s) {
+void Savegame::synchronizeExtra(Common::Serializer &s) {
 	s.syncAsSint16LE(_mapNum);
 	s.syncAsSint16LE(_locationPosition.x);
 	s.syncAsSint16LE(_locationPosition.y);
 }
 
-void Player::synchronize(Common::Serializer &s) {
+void Savegame::synchronize(Common::Serializer &s) {
 	synchronizeBasic(s);
 	synchronizeExtra(s);
 }
 
-void Player::synchronizeOriginal(Common::Serializer &s) {
+void Savegame::synchronizeOriginal(Common::Serializer &s) {
 	synchronizeBasic(s);
 	_mapNum = MAP_OVERWORLD;
 }
 
-int Player::getEntityAt(int x, int y, int startingIndex) const {
+int Savegame::getEntityAt(int x, int y, int startingIndex) const {
 	int foundIndex = -1;
-	for (; startingIndex <= g_engine->_overworldEntityCount && foundIndex == -1; ++startingIndex) {
+	for (; startingIndex <= _G(overworldEntityCount) && foundIndex == -1; ++startingIndex) {
 		const auto &e = _overworldEntities[startingIndex];
 		if (e._x == x && e._y == y)
 			foundIndex = startingIndex;
@@ -113,16 +113,16 @@ int Player::getEntityAt(int x, int y, int startingIndex) const {
 	return foundIndex;
 }
 
-void Player::removeCreatureAt(int x, int y) {
+void Savegame::removeCreatureAt(int x, int y) {
 	int creatureNum = getEntityAt(x, y, 1);
 	if (creatureNum <= 0)
 		return;
 
 	// Shift all following entities down a slot, removing the found one
-	for (int idx = creatureNum; idx < g_engine->_overworldEntityCount; ++idx)
+	for (int idx = creatureNum; idx < _G(overworldEntityCount); ++idx)
 		_overworldEntities[idx] = _overworldEntities[idx + 1];
 
-	--g_engine->_overworldEntityCount;
+	--_G(overworldEntityCount);
 }
 
 
diff --git a/engines/ultima/ultima1/data/player.h b/engines/ultima/ultima1/data/savegame.h
similarity index 97%
rename from engines/ultima/ultima1/data/player.h
rename to engines/ultima/ultima1/data/savegame.h
index 15bb2db9298..0332090cb04 100644
--- a/engines/ultima/ultima1/data/player.h
+++ b/engines/ultima/ultima1/data/savegame.h
@@ -19,8 +19,8 @@
  *
  */
 
-#ifndef ULTIMA1_DATA_PLAYER_H
-#define ULTIMA1_DATA_PLAYER_H
+#ifndef ULTIMA1_DATA_SAVEGAME_H
+#define ULTIMA1_DATA_SAVEGAME_H
 
 #include "common/rect.h"
 #include "common/serializer.h"
@@ -33,6 +33,7 @@ namespace Data {
 constexpr int MAX_NAME_LENGTH = 14;
 constexpr int QUEST_COUNT = 9;
 constexpr int OVERWORLD_ENTITY_COUNT = 40;
+constexpr int CREATURES_COUNT = 10;
 
 extern const char *SEX_NAMES[];
 extern const char *RACE_NAMES[];
@@ -82,7 +83,7 @@ enum TransportType {
 /**
  * The player character's savegame data
  */
-struct Player {
+struct Savegame {
 private:
 	/**
 	 * Synchronizes the basic fields that the original's savegame format had.
diff --git a/engines/ultima/ultima1/logic/logic.cpp b/engines/ultima/ultima1/logic/logic.cpp
index 3a70ab77398..20f63f70f20 100644
--- a/engines/ultima/ultima1/logic/logic.cpp
+++ b/engines/ultima/ultima1/logic/logic.cpp
@@ -41,6 +41,14 @@ void Logic::playFX(int num) {
 	g_engine->playFX(num);
 }
 
+int Logic::getRandomNumber(int minNumber, int maxNumber) {
+	return g_engine->getRandomNumber(minNumber, maxNumber);
+}
+
+int Logic::getRandomNumber(int maxNumber) {
+	return g_engine->getRandomNumber(maxNumber);
+}
+
 } // namespace Logic
 } // namespace Ultima1
 } // namespace Ultima
diff --git a/engines/ultima/ultima1/logic/logic.h b/engines/ultima/ultima1/logic/logic.h
index 2c08cc0da00..2f0e0355c23 100644
--- a/engines/ultima/ultima1/logic/logic.h
+++ b/engines/ultima/ultima1/logic/logic.h
@@ -51,6 +51,12 @@ protected:
 	 */
 	void playFX(int num);
 
+	/**
+	 * Returns a random number
+	 */
+	int getRandomNumber(int minNumber, int maxNumber);
+	int getRandomNumber(int maxNumber);
+
 public:
 	virtual ~Logic() {
 	}
diff --git a/engines/ultima/ultima1/logic/overworld_logic.cpp b/engines/ultima/ultima1/logic/overworld_logic.cpp
index 927a168f17a..1028de36055 100644
--- a/engines/ultima/ultima1/logic/overworld_logic.cpp
+++ b/engines/ultima/ultima1/logic/overworld_logic.cpp
@@ -66,23 +66,25 @@ void OverworldLogic::action(int action) {
 	default:
 		break;
 	}
+
+	endOfTurn();
 }
 
 void OverworldLogic::keypress(Common::KeyCode keycode) {
-
+	endOfTurn();
 }
 
 void OverworldLogic::move(Data::Direction dir) {
 	if (!moveCheck(dir))
 		return;
 
-	if (g_engine->_player._transportType <= Data::TRANSPORT_CART)
+	if (_G(savegame)._transportType <= Data::TRANSPORT_CART)
 		playFX(4);
 
 	// Write direction traveled
 	writeString(Common::String::format("%s\n", Data::DIRECTION_NAMES[dir]));
 
-	int continentNum = g_engine->_map.getContinentAt(g_engine->_player._position);
+	int continentNum = _G(map).getContinentAt(_G(savegame)._position);
 
 	switch (dir) {
 	case Data::DIR_LEFT:
@@ -99,7 +101,7 @@ void OverworldLogic::move(Data::Direction dir) {
 		break;
 	}
 
-	if (g_engine->_map.getContinentAt(g_engine->_player._position) != continentNum)
+	if (_G(map).getContinentAt(_G(savegame)._position) != continentNum)
 		continentChanged(continentNum);
 }
 
@@ -107,7 +109,7 @@ bool OverworldLogic::moveCheck(Data::Direction dir) {
 	int xp = getViewportX(Data::MAP_VISIBLE_CENTER_X + DELTA_X[dir]);
 	int yp = getViewportY(Data::MAP_VISIBLE_CENTER_Y + DELTA_Y[dir]);
 	int tile = getTileAt(xp, yp, 1);
-	int transport = g_engine->_player._transportType;
+	int transport = _G(savegame)._transportType;
 
 	if (tile >= Data::TILE_FIRST_MONSTER && tile <= Data::TILE_LAST_MONSTER) {
 		Common::String msg = Common::String::format("Blocked by a");
@@ -122,7 +124,7 @@ bool OverworldLogic::moveCheck(Data::Direction dir) {
 		msg += "!\n";
 
 		writeString(msg);
-		g_engine->playFX(0);
+		playFX(0);
 		return false;
 
 	} else if (tile == Data::TILE_MOUNTAINS) {
@@ -156,7 +158,7 @@ bool OverworldLogic::moveCheck(Data::Direction dir) {
 }
 
 int OverworldLogic::getViewportX(int xp) const {
-	int x = g_engine->_player._position.x - Data::MAP_VISIBLE_CENTER_X + xp;
+	int x = _G(savegame)._position.x - Data::MAP_VISIBLE_CENTER_X + xp;
 	if (x < 0)
 		x += Data::OVERWORLD_WIDTH;
 	else if (x >= Data::OVERWORLD_WIDTH)
@@ -166,7 +168,7 @@ int OverworldLogic::getViewportX(int xp) const {
 }
 
 int OverworldLogic::getViewportY(int yp) const {
-	int y = g_engine->_player._position.y - Data::MAP_VISIBLE_CENTER_Y + yp;
+	int y = _G(savegame)._position.y - Data::MAP_VISIBLE_CENTER_Y + yp;
 	if (y < 0)
 		y += Data::OVERWORLD_HEIGHT;
 	else if (y >= Data::OVERWORLD_HEIGHT)
@@ -176,12 +178,12 @@ int OverworldLogic::getViewportY(int yp) const {
 }
 
 int OverworldLogic::getTileAt(int x, int y, int creatureIndex) const {
-	int entityIndex = g_engine->_player.getEntityAt(x, y, creatureIndex);
+	int entityIndex = _G(savegame).getEntityAt(x, y, creatureIndex);
 
 	if (entityIndex >= 0)
-		return g_engine->_player._overworldEntities[entityIndex]._type;
+		return _G(savegame)._overworldEntities[entityIndex]._type;
 
-	return g_engine->_map.getMapTile(x, y);
+	return _G(map).getMapTile(x, y);
 }
 
 void OverworldLogic::impassable(int reason) {
@@ -191,7 +193,7 @@ void OverworldLogic::impassable(int reason) {
 
 void OverworldLogic::moveLeft() {
 	// Change overworld position
-	Common::Point &pt = g_engine->_player._position;
+	Common::Point &pt = _G(savegame)._position;
 	if (pt.x > 0) {
 		pt.x--;
 	} else {
@@ -201,7 +203,7 @@ void OverworldLogic::moveLeft() {
 
 	// Shift the existing columns right by one, to make room for a new
 	// column of tiles at the left edge
-	auto &tiles = g_engine->_map._mapTilesId;
+	auto &tiles = _G(map)._mapTilesId;
 	for (int col = Data::MAP_VISIBLE_WIDTH - 2; col >= 0; --col) {
 		for (int row = 0; row < Data::MAP_VISIBLE_HEIGHT; ++row)
 			tiles[row][col + 1] = tiles[row][col];
@@ -211,13 +213,13 @@ void OverworldLogic::moveLeft() {
 	for (int row = 0; row < Data::MAP_VISIBLE_HEIGHT; ++row) {
 		int x = getViewportX(0);
 		int y = getViewportY(row);
-		tiles[row][0] = g_engine->_map.getMapTile(x, y);
+		tiles[row][0] = _G(map).getMapTile(x, y);
 	}
 }
 
 void OverworldLogic::moveRight() {
 	// Change overworld position
-	Common::Point &pt = g_engine->_player._position;
+	Common::Point &pt = _G(savegame)._position;
 	if (pt.x != Data::OVERWORLD_WIDTH - 1) {
 		pt.x++;
 	} else {
@@ -227,7 +229,7 @@ void OverworldLogic::moveRight() {
 
 	// Shift the existing columns left by one, to make room for a new
 	// column of tiles at the right edge
-	auto &tiles = g_engine->_map._mapTilesId;
+	auto &tiles = _G(map)._mapTilesId;
 	for (int col = 1; col < Data::MAP_VISIBLE_WIDTH; ++col) {
 		for (int row = 0; row < Data::MAP_VISIBLE_HEIGHT; ++row)
 			tiles[row][col - 1] = tiles[row][col];
@@ -237,18 +239,18 @@ void OverworldLogic::moveRight() {
 	for (int row = 0; row < Data::MAP_VISIBLE_HEIGHT; ++row) {
 		int x = getViewportX(Data::MAP_VISIBLE_WIDTH - 1);
 		int y = getViewportY(row);
-		tiles[row][Data::MAP_VISIBLE_WIDTH - 1] = g_engine->_map.getMapTile(x, y);
+		tiles[row][Data::MAP_VISIBLE_WIDTH - 1] = _G(map).getMapTile(x, y);
 	}
 }
 
 void OverworldLogic::moveUp() {
 	// Change overworld position
-	Common::Point &pt = g_engine->_player._position;
+	Common::Point &pt = _G(savegame)._position;
 	pt.y = (pt.y == 0) ? Data::OVERWORLD_HEIGHT - 1 : pt.y - 1;
 
 	// Shift the existing rows down by one, to make room for a new
 	// row of tiles at the top edge
-	auto &tiles = g_engine->_map._mapTilesId;
+	auto &tiles = _G(map)._mapTilesId;
 	for (int row = Data::MAP_VISIBLE_HEIGHT - 2; row >= 0; --row) {
 		for (int col = 0; col < Data::MAP_VISIBLE_WIDTH; ++col)
 			tiles[row + 1][col] = tiles[row][col];
@@ -258,18 +260,18 @@ void OverworldLogic::moveUp() {
 	for (int col = 0; col < Data::MAP_VISIBLE_WIDTH; ++col) {
 		int x = getViewportX(col);
 		int y = getViewportY(0);
-		tiles[0][col] = g_engine->_map.getMapTile(x, y);
+		tiles[0][col] = _G(map).getMapTile(x, y);
 	}
 }
 
 void OverworldLogic::moveDown() {
 	// Change overworld position
-	Common::Point &pt = g_engine->_player._position;
+	Common::Point &pt = _G(savegame)._position;
 	pt.y = (pt.y == Data::OVERWORLD_HEIGHT - 1) ? 0 : pt.y + 1;
 
 	// Shift the existing rows up by one, to make room for a new
 	// row of tiles at the bottom edge
-	auto &tiles = g_engine->_map._mapTilesId;
+	auto &tiles = _G(map)._mapTilesId;
 	for (int row = 1; row < Data::MAP_VISIBLE_HEIGHT; ++row) {
 		for (int col = 0; col < Data::MAP_VISIBLE_WIDTH; ++col)
 			tiles[row - 1][col] = tiles[row][col];
@@ -279,20 +281,137 @@ void OverworldLogic::moveDown() {
 	for (int col = 0; col < Data::MAP_VISIBLE_WIDTH; ++col) {
 		int x = getViewportX(col);
 		int y = getViewportY(Data::MAP_VISIBLE_HEIGHT - 1);
-		tiles[Data::MAP_VISIBLE_HEIGHT - 1][col] = g_engine->_map.getMapTile(x, y);
+		tiles[Data::MAP_VISIBLE_HEIGHT - 1][col] = _G(map).getMapTile(x, y);
 	}
 }
 
 void OverworldLogic::continentChanged(int oldContinent) {
-	for (int index = 1; index < g_engine->_overworldEntityCount; ++index) {
-		auto &e = g_engine->_player._overworldEntities[index];
-		int continent = g_engine->_map.getContinentAt(e._x, e._y);
+	for (int index = 1; index < _G(overworldEntityCount); ++index) {
+		auto &e = _G(savegame)._overworldEntities[index];
+		int continent = _G(map).getContinentAt(e._x, e._y);
 
 		if (continent == oldContinent) {
-			g_engine->_player.removeCreatureAt(e._x, e._y);
-			g_engine->_creaturesCount--;
+			_G(savegame).removeCreatureAt(e._x, e._y);
+			_G(creaturesCount)--;
+		}
+	}
+}
+
+void OverworldLogic::endOfTurn() {
+	if (_G(creaturesCount) < Data::CREATURES_COUNT)
+		generateCreatures();
+
+	_G(moveCtr)++;
+	updateCreatures();
+	reduceFood();
+
+	// Signal to update the map and stats area. This isn't a full view redraw though,
+	// since we don't want to lose any text added to the Commands area
+	g_engine->send("Overworld", Shared::Messages::GameMessage("UPDATE"));
+}
+
+void OverworldLogic::generateCreatures() {
+	int randomVal = getRandomNumber(1, 255);
+	// Character level (experience / 1000), clamped to the table's bounds
+	int level = MIN(_G(savegame)._experience / 1000, 9);
+	if (randomVal >= Data::MONSTER_THRESHOLDS_PER_LEVEL[level])
+		return;
+
+	// Pick a monster type (0-14), weighted so tougher monster slots are
+	// rarer to roll
+	int weight = getRandomNumber(1, 8) * 2;
+	int typeIdx = getRandomNumber(0, 149) / 10;
+	int tierVal = Data::OVERWORLD_MONSTERS_HITS[typeIdx];
+	if (weight > tierVal)
+		weight = tierVal;
+
+	// The home terrain the monster type needs to spawn on
+	int data;
+	if (typeIdx < 4)
+		data = Data::TILE_OCEAN;
+	else if (typeIdx < 9)
+		data = Data::TILE_WOODS;
+	else
+		data = Data::TILE_GRASS;
+
+	int tile = Data::TILE_FIRST_MONSTER + typeIdx * 2;
+	int hits = Data::OVERWORLD_MONSTERS_HITS[typeIdx] * 10 + (level + 1) + 1;
+
+	// Search for a valid spawn position, randomly offset just outside the
+	// visible viewport, on the monster type's home terrain
+	int x = 0, y = 0, tileAtSpot = 0;
+	bool rangeOk = false;
+	do {
+		int xOff = getRandomNumber(10, 15);
+		if (getRandomNumber(1, 16) & 1)
+			xOff = -xOff;
+		int yOff = getRandomNumber(5, 15);
+		if (getRandomNumber(1, 16) & 1)
+			yOff = -yOff;
+
+		x = getViewportX(xOff + Data::MAP_VISIBLE_CENTER_X);
+		y = getViewportY(yOff + Data::MAP_VISIBLE_CENTER_Y);
+		tileAtSpot = getTileAt(x, y, 1);
+
+		rangeOk = _G(map).mapRangeCheckX(x) && _G(map).mapRangeCheckY(y);
+	} while (tileAtSpot != data && !rangeOk);
+
+	if (tileAtSpot != data || !rangeOk)
+		return;
+
+	// Add the new entity (addOverworldEntity)
+	if (_G(overworldEntityCount) < Data::OVERWORLD_ENTITY_COUNT - 1) {
+		++_G(overworldEntityCount);
+		auto &e = _G(savegame)._overworldEntities[_G(overworldEntityCount)];
+		e._type = tile;
+		e._data = data;
+		e._x = x;
+		e._y = y;
+		e._hits = hits;
+	}
+
+	++_G(creaturesCount);
+}
+
+void OverworldLogic::updateCreatures() {
+	int attackIndexes[Data::CREATURES_COUNT];
+	int attackCount = 0;
+
+	for (int idx = 1; idx <= _G(overworldEntityCount); ++idx) {
+		auto &e = _G(savegame)._overworldEntities[idx];
+
+		if (e._type >= Data::TILE_FIRST_MONSTER && e._type <= Data::TILE_LAST_MONSTER) {
+			int xDiff = _G(savegame)._position.x - e._x;
+			int yDiff = _G(savegame)._position.y - e._y;
+
+			if (Data::OverworldEntity::getMonsterAttackDistance(e._type, xDiff, yDiff) != 0) {
+				if (attackCount < Data::CREATURES_COUNT)
+					attackIndexes[attackCount] = idx;
+				++attackCount;
+			} else {
+				// TODO: monster movement (monsterMoveCheck, monsterMoveCheckX/Y, monsterTransportCheck)
+			}
 		}
 	}
+
+	while (attackCount > 0) {
+		--attackCount;
+		if (_G(savegame)._hits <= 0)
+			break;
+
+		int idx = attackIndexes[attackCount];
+		auto &e = _G(savegame)._overworldEntities[idx];
+		int xDiff = _G(savegame)._position.x - e._x;
+		int yDiff = _G(savegame)._position.y - e._y;
+
+		// TODO: monsterAttack(idx, xDiff, yDiff, getMonsterAttackDistance(e._type, xDiff, yDiff))
+		// - creature combat/damage resolution
+		warning("TODO: xDiff=%d, yDiff=%d", xDiff, yDiff);
+	}
+}
+
+void OverworldLogic::reduceFood() {
+
 }
 
 } // namespace Logic
diff --git a/engines/ultima/ultima1/logic/overworld_logic.h b/engines/ultima/ultima1/logic/overworld_logic.h
index 69eeed02341..6433adabb19 100644
--- a/engines/ultima/ultima1/logic/overworld_logic.h
+++ b/engines/ultima/ultima1/logic/overworld_logic.h
@@ -91,6 +91,26 @@ private:
 	 */
 	void continentChanged(int oldContinent);
 
+	/**
+	 * Called after an action is done
+	 */
+	void endOfTurn();
+
+	/**
+	 * Generate monsters for the overworld
+	 */
+	void generateCreatures();
+
+	/**
+	 * Update overworld creatures
+	 */
+	void updateCreatures();
+
+	/**
+	 * Reduce the food the player has
+	 */
+	void reduceFood();
+
 public:
 	~OverworldLogic() override {
 	}
diff --git a/engines/ultima/ultima1/ultima1.cpp b/engines/ultima/ultima1/ultima1.cpp
index 50394fd3ca1..66d7df78822 100644
--- a/engines/ultima/ultima1/ultima1.cpp
+++ b/engines/ultima/ultima1/ultima1.cpp
@@ -76,7 +76,7 @@ Common::Error Ultima1Engine::run() {
 }
 
 Common::Error Ultima1Engine::syncGame(Common::Serializer &s) {
-	_player.synchronize(s);
+	_savegame.synchronize(s);
 
 	if (s.isLoading())
 		_game.startGame();
diff --git a/engines/ultima/ultima1/ultima1.h b/engines/ultima/ultima1/ultima1.h
index 822c877f9e4..ded9da6ee60 100644
--- a/engines/ultima/ultima1/ultima1.h
+++ b/engines/ultima/ultima1/ultima1.h
@@ -38,7 +38,7 @@
 #include "ultima/shared/engine/events.h"
 #include "ultima/ultima1/data/game.h"
 #include "ultima/ultima1/data/map.h"
-#include "ultima/ultima1/data/player.h"
+#include "ultima/ultima1/data/savegame.h"
 #include "ultima/ultima1/data/tiles.h"
 #include "ultima/ultima1/logic/logic.h"
 
@@ -65,11 +65,12 @@ protected:
 public:
 	Data::Game _game;
 	Data::Map _map;
-	Data::Player _player;
+	Data::Savegame _savegame;
 	Graphics::ManagedSurface _tiles[Data::TILE_COUNT];
 	Logic::Logic *_logic = nullptr;
 	int _overworldEntityCount = 0;
 	int _creaturesCount = 0;
+	uint32 _moveCtr = 0;
 
 public:
 	Ultima1Engine(OSystem *syst, const Ultima::UltimaGameDescription *gameDesc);
diff --git a/engines/ultima/ultima1/views/commands.cpp b/engines/ultima/ultima1/views/commands.cpp
index e9c91e24c70..1df7e3e8c7a 100644
--- a/engines/ultima/ultima1/views/commands.cpp
+++ b/engines/ultima/ultima1/views/commands.cpp
@@ -20,6 +20,7 @@
  */
 
 #include "ultima/ultima1/views/commands.h"
+#include "ultima/ultima1/ultima1.h"
 
 namespace Ultima {
 namespace Ultima1 {
@@ -55,6 +56,16 @@ bool Commands::msgGame(const GameMessage &msg) {
 	return false;
 }
 
+bool Commands::msgAction(const ActionMessage &msg) {
+	g_engine->_logic->action(msg._action);
+	return true;
+}
+
+bool Commands::msgKeypress(const KeypressMessage &msg) {
+	g_engine->_logic->keypress(msg.keycode);
+	return true;
+}
+
 void Commands::writeString(const Common::String &msg) {
 	_textCursor.hide();
 	_surface.writeString(msg);
diff --git a/engines/ultima/ultima1/views/commands.h b/engines/ultima/ultima1/views/commands.h
index 4deefa13182..96c1a7324cb 100644
--- a/engines/ultima/ultima1/views/commands.h
+++ b/engines/ultima/ultima1/views/commands.h
@@ -43,6 +43,8 @@ public:
 	bool msgFocus(const FocusMessage &msg) override;
 	void draw() override;
 	bool msgGame(const GameMessage &msg) override;
+	bool msgAction(const ActionMessage &msg) override;
+	bool msgKeypress(const KeypressMessage &msg) override;
 
 	void writeString(const Common::String &msg);
 	void prompt();
diff --git a/engines/ultima/ultima1/views/create_character.cpp b/engines/ultima/ultima1/views/create_character.cpp
index 737c9fbda8a..0ad39086ab5 100644
--- a/engines/ultima/ultima1/views/create_character.cpp
+++ b/engines/ultima/ultima1/views/create_character.cpp
@@ -54,7 +54,7 @@ bool CreateCharacter::msgFocus(const FocusMessage &msg) {
 }
 
 void CreateCharacter::reset() {
-	Player &p = g_engine->_player;
+	Savegame &p = _G(savegame);
 	p._strength = p._agility = p._stamina = p._charisma = p._wisdom = p._intelligence = 10;
 
 	_pointsRemaining = STARTING_POINTS;
@@ -65,7 +65,7 @@ void CreateCharacter::reset() {
 }
 
 int16 &CreateCharacter::attribute(int index) {
-	Player &p = g_engine->_player;
+	Savegame &p = _G(savegame);
 	switch (index) {
 	case 0: return p._strength;
 	case 1: return p._agility;
@@ -139,14 +139,14 @@ void CreateCharacter::draw() {
 		drawConfirmedSex(s);
 		drawConfirmedClass(s);
 		s.setColor(COLOR_TEXT);
-		s.writeString(Common::Point(12, 4), g_engine->_player._name);
+		s.writeString(Common::Point(12, 4), _G(savegame)._name);
 		s.writeString(Common::Point(3, 22), "Use this character? (Y-N) ");
 		break;
 	}
 }
 
 void CreateCharacter::drawAttributes(Shared::Gfx::GfxSurface &s) {
-	const Player &p = g_engine->_player;
+	const Savegame &p = _G(savegame);
 	s.setColor(COLOR_TEXT);
 
 	s.writeString(Common::Point(12, 6), padLabel("Strength", 16) + Common::String::format("%2d", p._strength));
@@ -169,19 +169,19 @@ void CreateCharacter::drawHelp(Shared::Gfx::GfxSurface &s) {
 void CreateCharacter::drawConfirmedRace(Shared::Gfx::GfxSurface &s) {
 	s.setColor(COLOR_TEXT);
 	s.writeString(Common::Point(14, 13),
-		Common::String::format("Race: %s", RACE_NAMES[g_engine->_player._race]));
+		Common::String::format("Race: %s", RACE_NAMES[_G(savegame)._race]));
 }
 
 void CreateCharacter::drawConfirmedSex(Shared::Gfx::GfxSurface &s) {
 	s.setColor(COLOR_TEXT);
 	s.writeString(Common::Point(15, 14),
-		Common::String::format("Sex: %s", SEX_NAMES[g_engine->_player._sex]));
+		Common::String::format("Sex: %s", SEX_NAMES[_G(savegame)._sex]));
 }
 
 void CreateCharacter::drawConfirmedClass(Shared::Gfx::GfxSurface &s) {
 	s.setColor(COLOR_TEXT);
 	s.writeString(Common::Point(13, 15),
-		Common::String::format("Class: %s", CLASS_NAMES[g_engine->_player._class]));
+		Common::String::format("Class: %s", CLASS_NAMES[_G(savegame)._class]));
 }
 
 bool CreateCharacter::msgKeypress(const KeypressMessage &msg) {
@@ -291,7 +291,7 @@ bool CreateCharacter::msgSaveKey(const KeypressMessage &msg) {
 }
 
 void CreateCharacter::selectRace(int race) {
-	Player &p = g_engine->_player;
+	Savegame &p = _G(savegame);
 	p._race = race;
 
 	switch (race) {
@@ -318,7 +318,7 @@ void CreateCharacter::selectRace(int race) {
 }
 
 void CreateCharacter::selectSex(int sex) {
-	g_engine->_player._sex = sex;
+	_G(savegame)._sex = sex;
 
 	_state = CLASS;
 	_cursor.setPosition(Common::Point(21, 17));
@@ -326,7 +326,7 @@ void CreateCharacter::selectSex(int sex) {
 }
 
 void CreateCharacter::selectClass(int charClass) {
-	Player &p = g_engine->_player;
+	Savegame &p = _G(savegame);
 	p._class = charClass;
 
 	switch (charClass) {
@@ -354,7 +354,7 @@ void CreateCharacter::selectClass(int charClass) {
 
 bool CreateCharacter::msgGame(const GameMessage &msg) {
 	if (_state == NAME && msg._name == "INPUT" && !msg._stringValue.empty()) {
-		strcpy_s(g_engine->_player._name, msg._stringValue.c_str());
+		strcpy_s(_G(savegame)._name, msg._stringValue.c_str());
 
 		_nameInput.hide();
 		_state = SAVE;
@@ -368,7 +368,7 @@ bool CreateCharacter::msgGame(const GameMessage &msg) {
 }
 
 void CreateCharacter::confirmAndSave() {
-	Player &p = g_engine->_player;
+	Savegame &p = _G(savegame);
 
 	p._randomSeed = getRandomNumber(0x7fff) + p._wisdom + p._class;
 	p._hits = 150;
diff --git a/engines/ultima/ultima1/views/overworld.cpp b/engines/ultima/ultima1/views/overworld.cpp
index a18aec8083e..4c7d7683426 100644
--- a/engines/ultima/ultima1/views/overworld.cpp
+++ b/engines/ultima/ultima1/views/overworld.cpp
@@ -52,6 +52,16 @@ void Overworld::draw() {
 	drawGameDividers();
 }
 
+bool Overworld::msgGame(const GameMessage &msg) {
+	if (msg._name == "UPDATE") {
+		_map.redraw();
+		_stats.redraw();
+		return true;
+	}
+
+	return false;
+}
+
 } // namespace Views
 } // namespace Ultima1
 } // namespace Ultima
diff --git a/engines/ultima/ultima1/views/overworld.h b/engines/ultima/ultima1/views/overworld.h
index f5af446aac0..def48f8d5cf 100644
--- a/engines/ultima/ultima1/views/overworld.h
+++ b/engines/ultima/ultima1/views/overworld.h
@@ -48,6 +48,7 @@ public:
 
 	bool msgFocus(const FocusMessage &msg) override;
 	bool msgUnfocus(const UnfocusMessage &msg) override;
+	bool msgGame(const GameMessage &msg) override;
 	void draw() override;
 };
 
diff --git a/engines/ultima/ultima1/views/overworld_map.cpp b/engines/ultima/ultima1/views/overworld_map.cpp
index f146bcdbfe7..278701081bb 100644
--- a/engines/ultima/ultima1/views/overworld_map.cpp
+++ b/engines/ultima/ultima1/views/overworld_map.cpp
@@ -27,7 +27,7 @@ namespace Ultima1 {
 namespace Views {
 
 bool OverworldMap::msgFocus(const FocusMessage &msg) {
-	g_engine->_map.clearTiles();
+	_G(map).clearTiles();
 	delayFrames(1);
 	return UIElement::msgFocus(msg);
 }
diff --git a/engines/ultima/ultima1/views/stats.cpp b/engines/ultima/ultima1/views/stats.cpp
index 10d331e57f0..155252d78d7 100644
--- a/engines/ultima/ultima1/views/stats.cpp
+++ b/engines/ultima/ultima1/views/stats.cpp
@@ -31,7 +31,7 @@ constexpr int COLOR_TEXT = 11;      // light cyan - normal values
 constexpr int COLOR_HIGHLIGHT = 12; // light red - low hits/food warning
 
 void Stats::draw() {
-	Data::Player &p = g_engine->_player;
+	Data::Savegame &p = _G(savegame);
 	auto s = getSurface();
 	s.clear();
 


Commit: 20d6a56dd4b8e36cb24fe1766e4adda3b4e30c22
    https://github.com/scummvm/scummvm/commit/20d6a56dd4b8e36cb24fe1766e4adda3b4e30c22
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:40:47+11:00

Commit Message:
ULTIMA: ULTIMA1: Map functions for top-left corner of visible map

Changed paths:
    engines/ultima/ultima1/data/map.cpp
    engines/ultima/ultima1/data/map.h
    engines/ultima/ultima1/views/overworld_map.cpp


diff --git a/engines/ultima/ultima1/data/map.cpp b/engines/ultima/ultima1/data/map.cpp
index 343fcff4f26..e584435ce16 100644
--- a/engines/ultima/ultima1/data/map.cpp
+++ b/engines/ultima/ultima1/data/map.cpp
@@ -113,6 +113,14 @@ void Map::clearTiles() {
 	Common::fill(&_mapTilesId[0][0], &_mapTilesId[0][0] + sizeof(VisibleTiles), 0);
 }
 
+int Map::mapTopLeftX() const {
+	return (_currentMap == MAP_OVERWORLD) ? (_mapX - MAP_VISIBLE_CENTER_X) + 1 : 0;
+}
+
+int Map::mapTopLeftY() const {
+	return (_currentMap == MAP_OVERWORLD) ? (_mapY - MAP_VISIBLE_CENTER_Y) + 1 : 0;
+}
+
 bool Map::canMoveToTile(int tileNum) {
 	int tileId = tileNum & 0x7f;
 
diff --git a/engines/ultima/ultima1/data/map.h b/engines/ultima/ultima1/data/map.h
index 63f3d0bf127..813c5b4b4ab 100644
--- a/engines/ultima/ultima1/data/map.h
+++ b/engines/ultima/ultima1/data/map.h
@@ -145,6 +145,12 @@ public:
 
 	void clearTiles();
 
+	/**
+	 * Return the X/Y of the map to start drawing
+	 */
+	int mapTopLeftX() const;
+	int mapTopLeftY() const;
+
 	bool canMoveToTile(int tileNum);
 
 	/**
diff --git a/engines/ultima/ultima1/views/overworld_map.cpp b/engines/ultima/ultima1/views/overworld_map.cpp
index 278701081bb..7646f56b005 100644
--- a/engines/ultima/ultima1/views/overworld_map.cpp
+++ b/engines/ultima/ultima1/views/overworld_map.cpp
@@ -98,8 +98,8 @@ void OverworldMap::prepareMapForDrawing() {
 	auto &map = g_engine->_map;
 	int mapLeft, mapTop;
 
-	mapLeft = (map._mapX - Data::MAP_VISIBLE_CENTER_X) + 1;
-	mapTop = (map._mapY - Data::MAP_VISIBLE_CENTER_Y) + 1;
+	mapLeft = _G(map).mapTopLeftX();
+	mapTop = _G(map).mapTopLeftY();
 
 	for (int oy = 0; oy < Data::MAP_VISIBLE_HEIGHT; oy++) {
 		for (int ox = 0; ox < Data::MAP_VISIBLE_WIDTH; ox++) {


Commit: ffaa2012219ab60da2be57ac1f59e391724dbef7
    https://github.com/scummvm/scummvm/commit/ffaa2012219ab60da2be57ac1f59e391724dbef7
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:40:47+11:00

Commit Message:
ULTIMA: ULTIMA1: Refactor out _mapX/_mapY

Changed paths:
    engines/ultima/ultima1/data/map.cpp
    engines/ultima/ultima1/data/map.h
    engines/ultima/ultima1/data/savegame.cpp
    engines/ultima/ultima1/data/savegame.h
    engines/ultima/ultima1/logic/overworld_logic.cpp
    engines/ultima/ultima1/views/create_character.cpp
    engines/ultima/ultima1/views/overworld_map.cpp


diff --git a/engines/ultima/ultima1/data/map.cpp b/engines/ultima/ultima1/data/map.cpp
index e584435ce16..ea4649119de 100644
--- a/engines/ultima/ultima1/data/map.cpp
+++ b/engines/ultima/ultima1/data/map.cpp
@@ -72,8 +72,6 @@ void Map::init() {
 }
 
 void Map::load(int mapNum) {
-	const auto &player = _G(savegame);
-
 	_currentMap = mapNum;
 
 	if (mapNum == MAP_OVERWORLD) {
@@ -86,9 +84,6 @@ void Map::load(int mapNum) {
 		for (int y = 0; y < OVERWORLD_HEIGHT; ++y)
 			_mapRows.push_back(Row(this, &_overworldMap[y * OVERWORLD_WIDTH]));
 
-		_mapX = player._position.x;
-		_mapY = player._position.y;
-
 	} else {
 		_mapWidth = CITY_WIDTH;
 		_mapHeight = CITY_HEIGHT;
@@ -99,9 +94,6 @@ void Map::load(int mapNum) {
 		for (int y = 0; y < CITY_HEIGHT; ++y)
 			_mapRows.push_back(Row(this, &_cityMap[mapNum - 1][y * CITY_WIDTH]));
 		_mapRows.push_back(Row(this, nullptr));
-
-		_mapX = 19;
-		_mapY = 17;
 	}
 
 	// Set up copies of the map position and player tile to use
@@ -113,49 +105,6 @@ void Map::clearTiles() {
 	Common::fill(&_mapTilesId[0][0], &_mapTilesId[0][0] + sizeof(VisibleTiles), 0);
 }
 
-int Map::mapTopLeftX() const {
-	return (_currentMap == MAP_OVERWORLD) ? (_mapX - MAP_VISIBLE_CENTER_X) + 1 : 0;
-}
-
-int Map::mapTopLeftY() const {
-	return (_currentMap == MAP_OVERWORLD) ? (_mapY - MAP_VISIBLE_CENTER_Y) + 1 : 0;
-}
-
-bool Map::canMoveToTile(int tileNum) {
-	int tileId = tileNum & 0x7f;
-
-	if (_mapX < _mapWidth && _mapY < _mapHeight) {
-		// Within the bounds of the map
-		switch (_playerTileId) {
-		case TILE_TIME_MACHINE:
-			return true;
-		case TILE_AIRCAR:
-			// TODO
-			error("TODO: aircar");
-			break;
-		case TILE_FRIGATE1:
-			if (tileId != TILE_OCEAN)
-				return true;
-
-			goto update_xy;
-		case TILE_HORSE:
-			// TODO
-			break;
-		default:
-			// TODO
-			break;
-		}
-	} else {
-		// TODO
-	}
-
-update_xy:
-	_mapX &= 63;
-	_mapY &= 63;
-
-	return false;
-}
-
 int Map::getMapTile(int x, int y) const {
 	int tile = (*this)[y][x];
 
diff --git a/engines/ultima/ultima1/data/map.h b/engines/ultima/ultima1/data/map.h
index 813c5b4b4ab..1403d2db157 100644
--- a/engines/ultima/ultima1/data/map.h
+++ b/engines/ultima/ultima1/data/map.h
@@ -57,8 +57,6 @@ extern const char *DIRECTION_NAMES[5];
 
 struct Map {
 private:
-	int _currentMap = -1;
-
 	Common::Array<byte> _overworldMap;		// Cached overworld map data
 	Common::Array<byte> _cityMap[10];		// Cached city/castle/town maps
 
@@ -95,9 +93,8 @@ private:
 	Common::Array<Row> _mapRows;			// Used for array operator getting map contents
 
 public:
-	int _mapX = 0, _mapY = 0;
+	int _currentMap = -1;
 	byte _playerTileId = 0;
-
 	byte _tilePlayerCenter = 0;
 	byte _tilePlayerUp = 0, _tilePlayerDown = 0,
 		_tilePlayerLeft = 0, _tilePlayerRight = 0;
@@ -145,14 +142,6 @@ public:
 
 	void clearTiles();
 
-	/**
-	 * Return the X/Y of the map to start drawing
-	 */
-	int mapTopLeftX() const;
-	int mapTopLeftY() const;
-
-	bool canMoveToTile(int tileNum);
-
 	/**
 	 * Get a tile at a given position.
 	 * @param x		X position
diff --git a/engines/ultima/ultima1/data/savegame.cpp b/engines/ultima/ultima1/data/savegame.cpp
index 525781ac776..216f653ba92 100644
--- a/engines/ultima/ultima1/data/savegame.cpp
+++ b/engines/ultima/ultima1/data/savegame.cpp
@@ -55,8 +55,8 @@ void Savegame::synchronizeBasic(Common::Serializer &s) {
 	s.syncAsSint16LE(_transportType);
 
 	s.syncAsSint16LE(_randomSeed);
-	s.syncAsSint16LE(_position.x);
-	s.syncAsSint16LE(_position.y);
+	s.syncAsSint16LE(_overworldPos.x);
+	s.syncAsSint16LE(_overworldPos.y);
 	s.syncAsByte(_soundOn);
 
 	for (int i = 0; i < QUEST_COUNT; ++i)
@@ -102,6 +102,14 @@ void Savegame::synchronizeOriginal(Common::Serializer &s) {
 	_mapNum = MAP_OVERWORLD;
 }
 
+int Savegame::mapTopLeftX() const {
+	return (_G(map)._currentMap == MAP_OVERWORLD) ? (_overworldPos.x - MAP_VISIBLE_CENTER_X) + 1 : 0;
+}
+
+int Savegame::mapTopLeftY() const {
+	return (_G(map)._currentMap == MAP_OVERWORLD) ? (_overworldPos.y - MAP_VISIBLE_CENTER_Y) + 1 : 0;
+}
+
 int Savegame::getEntityAt(int x, int y, int startingIndex) const {
 	int foundIndex = -1;
 	for (; startingIndex <= _G(overworldEntityCount) && foundIndex == -1; ++startingIndex) {
diff --git a/engines/ultima/ultima1/data/savegame.h b/engines/ultima/ultima1/data/savegame.h
index 0332090cb04..485df0ae659 100644
--- a/engines/ultima/ultima1/data/savegame.h
+++ b/engines/ultima/ultima1/data/savegame.h
@@ -123,7 +123,7 @@ public:
 	int16 _transportType = TRANSPORT_FOOT;
 
 	int16 _randomSeed = 0;
-	Common::Point _position;
+	Common::Point _overworldPos;
 	bool _soundOn = true;
 
 	// Quest completion flags, one per town/dungeon
@@ -171,6 +171,12 @@ public:
 		return _hits <= 0;
 	}
 
+	/**
+	 * Return the X/Y of the map to start drawing
+	 */
+	int mapTopLeftX() const;
+	int mapTopLeftY() const;
+
 	/**
 	 * Checks the overworld map for an entity (creature or vechile) at a given position.
 	 * @param x		X position
diff --git a/engines/ultima/ultima1/logic/overworld_logic.cpp b/engines/ultima/ultima1/logic/overworld_logic.cpp
index 1028de36055..be7f8f7785d 100644
--- a/engines/ultima/ultima1/logic/overworld_logic.cpp
+++ b/engines/ultima/ultima1/logic/overworld_logic.cpp
@@ -84,7 +84,7 @@ void OverworldLogic::move(Data::Direction dir) {
 	// Write direction traveled
 	writeString(Common::String::format("%s\n", Data::DIRECTION_NAMES[dir]));
 
-	int continentNum = _G(map).getContinentAt(_G(savegame)._position);
+	int continentNum = _G(map).getContinentAt(_G(savegame)._overworldPos);
 
 	switch (dir) {
 	case Data::DIR_LEFT:
@@ -101,7 +101,7 @@ void OverworldLogic::move(Data::Direction dir) {
 		break;
 	}
 
-	if (_G(map).getContinentAt(_G(savegame)._position) != continentNum)
+	if (_G(map).getContinentAt(_G(savegame)._overworldPos) != continentNum)
 		continentChanged(continentNum);
 }
 
@@ -158,7 +158,7 @@ bool OverworldLogic::moveCheck(Data::Direction dir) {
 }
 
 int OverworldLogic::getViewportX(int xp) const {
-	int x = _G(savegame)._position.x - Data::MAP_VISIBLE_CENTER_X + xp;
+	int x = _G(savegame)._overworldPos.x - Data::MAP_VISIBLE_CENTER_X + xp;
 	if (x < 0)
 		x += Data::OVERWORLD_WIDTH;
 	else if (x >= Data::OVERWORLD_WIDTH)
@@ -168,7 +168,7 @@ int OverworldLogic::getViewportX(int xp) const {
 }
 
 int OverworldLogic::getViewportY(int yp) const {
-	int y = _G(savegame)._position.y - Data::MAP_VISIBLE_CENTER_Y + yp;
+	int y = _G(savegame)._overworldPos.y - Data::MAP_VISIBLE_CENTER_Y + yp;
 	if (y < 0)
 		y += Data::OVERWORLD_HEIGHT;
 	else if (y >= Data::OVERWORLD_HEIGHT)
@@ -193,7 +193,7 @@ void OverworldLogic::impassable(int reason) {
 
 void OverworldLogic::moveLeft() {
 	// Change overworld position
-	Common::Point &pt = _G(savegame)._position;
+	Common::Point &pt = _G(savegame)._overworldPos;
 	if (pt.x > 0) {
 		pt.x--;
 	} else {
@@ -219,7 +219,7 @@ void OverworldLogic::moveLeft() {
 
 void OverworldLogic::moveRight() {
 	// Change overworld position
-	Common::Point &pt = _G(savegame)._position;
+	Common::Point &pt = _G(savegame)._overworldPos;
 	if (pt.x != Data::OVERWORLD_WIDTH - 1) {
 		pt.x++;
 	} else {
@@ -245,7 +245,7 @@ void OverworldLogic::moveRight() {
 
 void OverworldLogic::moveUp() {
 	// Change overworld position
-	Common::Point &pt = _G(savegame)._position;
+	Common::Point &pt = _G(savegame)._overworldPos;
 	pt.y = (pt.y == 0) ? Data::OVERWORLD_HEIGHT - 1 : pt.y - 1;
 
 	// Shift the existing rows down by one, to make room for a new
@@ -266,7 +266,7 @@ void OverworldLogic::moveUp() {
 
 void OverworldLogic::moveDown() {
 	// Change overworld position
-	Common::Point &pt = _G(savegame)._position;
+	Common::Point &pt = _G(savegame)._overworldPos;
 	pt.y = (pt.y == Data::OVERWORLD_HEIGHT - 1) ? 0 : pt.y + 1;
 
 	// Shift the existing rows up by one, to make room for a new
@@ -381,8 +381,8 @@ void OverworldLogic::updateCreatures() {
 		auto &e = _G(savegame)._overworldEntities[idx];
 
 		if (e._type >= Data::TILE_FIRST_MONSTER && e._type <= Data::TILE_LAST_MONSTER) {
-			int xDiff = _G(savegame)._position.x - e._x;
-			int yDiff = _G(savegame)._position.y - e._y;
+			int xDiff = _G(savegame)._overworldPos.x - e._x;
+			int yDiff = _G(savegame)._overworldPos.y - e._y;
 
 			if (Data::OverworldEntity::getMonsterAttackDistance(e._type, xDiff, yDiff) != 0) {
 				if (attackCount < Data::CREATURES_COUNT)
@@ -401,8 +401,8 @@ void OverworldLogic::updateCreatures() {
 
 		int idx = attackIndexes[attackCount];
 		auto &e = _G(savegame)._overworldEntities[idx];
-		int xDiff = _G(savegame)._position.x - e._x;
-		int yDiff = _G(savegame)._position.y - e._y;
+		int xDiff = _G(savegame)._overworldPos.x - e._x;
+		int yDiff = _G(savegame)._overworldPos.y - e._y;
 
 		// TODO: monsterAttack(idx, xDiff, yDiff, getMonsterAttackDistance(e._type, xDiff, yDiff))
 		// - creature combat/damage resolution
diff --git a/engines/ultima/ultima1/views/create_character.cpp b/engines/ultima/ultima1/views/create_character.cpp
index 0ad39086ab5..9b2d94ae0a7 100644
--- a/engines/ultima/ultima1/views/create_character.cpp
+++ b/engines/ultima/ultima1/views/create_character.cpp
@@ -379,7 +379,7 @@ void CreateCharacter::confirmAndSave() {
 	p._equippedSpell = SPELL_NONE;
 	p._equippedArmor = ARMOR_LEATHER;
 	p._transportType = TRANSPORT_FOOT;
-	p._position = Common::Point(49, 40);
+	p._overworldPos = Common::Point(49, 40);
 	p._soundOn = true;
 
 	for (int i = 0; i < QUEST_COUNT; ++i)
diff --git a/engines/ultima/ultima1/views/overworld_map.cpp b/engines/ultima/ultima1/views/overworld_map.cpp
index 7646f56b005..a26d949c56b 100644
--- a/engines/ultima/ultima1/views/overworld_map.cpp
+++ b/engines/ultima/ultima1/views/overworld_map.cpp
@@ -98,8 +98,8 @@ void OverworldMap::prepareMapForDrawing() {
 	auto &map = g_engine->_map;
 	int mapLeft, mapTop;
 
-	mapLeft = _G(map).mapTopLeftX();
-	mapTop = _G(map).mapTopLeftY();
+	mapLeft = _G(savegame).mapTopLeftX();
+	mapTop = _G(savegame).mapTopLeftY();
 
 	for (int oy = 0; oy < Data::MAP_VISIBLE_HEIGHT; oy++) {
 		for (int ox = 0; ox < Data::MAP_VISIBLE_WIDTH; ox++) {


Commit: 6cdb3de388c2a77d92e867041d2c5e303292473d
    https://github.com/scummvm/scummvm/commit/6cdb3de388c2a77d92e867041d2c5e303292473d
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:40:47+11:00

Commit Message:
ULTIMA: ULTIMA1: Beginnings of location entry logic

Changed paths:
  A engines/ultima/ultima1/logic/locations_logic.cpp
  A engines/ultima/ultima1/logic/locations_logic.h
  R engines/ultima/ultima1/data/game.cpp
  R engines/ultima/ultima1/data/game.h
    engines/ultima/module.mk
    engines/ultima/ultima1/data/map.cpp
    engines/ultima/ultima1/data/map.h
    engines/ultima/ultima1/logic/logic.cpp
    engines/ultima/ultima1/logic/logic.h
    engines/ultima/ultima1/logic/overworld_logic.cpp
    engines/ultima/ultima1/logic/overworld_logic.h
    engines/ultima/ultima1/metaengine.cpp
    engines/ultima/ultima1/ultima1.cpp
    engines/ultima/ultima1/ultima1.h
    engines/ultima/ultima1/views/create_character.cpp
    engines/ultima/ultima1/views/main_menu.cpp
    engines/ultima/ultima1/views/overworld.cpp


diff --git a/engines/ultima/module.mk b/engines/ultima/module.mk
index bf8a81598c9..95692ddfc7e 100644
--- a/engines/ultima/module.mk
+++ b/engines/ultima/module.mk
@@ -54,7 +54,6 @@ MODULE_OBJS += \
 	ultima1/metaengine.o \
 	ultima1/core/strings.o \
 	ultima1/data/entity.o \
-	ultima1/data/game.o \
 	ultima1/data/map.o \
 	ultima1/data/savegame.o \
 	ultima1/data/tiles.o \
@@ -62,6 +61,7 @@ MODULE_OBJS += \
 	ultima1/gfx/text_cursor.o \
 	ultima1/gfx/text_input.o \
 	ultima1/logic/logic.o \
+	ultima1/logic/locations_logic.o \
 	ultima1/logic/overworld_logic.o \
 	ultima1/views/view.o \
 	ultima1/views/commands.o \
diff --git a/engines/ultima/ultima1/data/game.cpp b/engines/ultima/ultima1/data/game.cpp
deleted file mode 100644
index 6c046241ca3..00000000000
--- a/engines/ultima/ultima1/data/game.cpp
+++ /dev/null
@@ -1,108 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-#include "ultima/ultima1/data/game.h"
-#include "ultima/ultima1/logic/overworld_logic.h"
-#include "ultima/ultima1/ultima1.h"
-#include "ultima/ultima1/metaengine.h"
-
-namespace Ultima {
-namespace Ultima1 {
-namespace Data {
-
-void Game::startGame() {
-	_G(map).load(_G(savegame)._mapNum);
-
-	// TODO: dungeons aren't implemented yet, so always start on the overworld
-	g_engine->replaceView("Overworld");
-	delete g_engine->_logic;
-	g_engine->_logic = new Logic::OverworldLogic();
-}
-
-void Game::message(const Common::String &name, const char *param) {
-	GameMessage msg(name);
-	if (param)
-		msg._stringValue = param;
-	g_engine->focusedView()->send(msg);
-}
-
-void Game::promptForCommand() {
-	g_engine->focusedView()->send(GameMessage("COMMAND"));
-}
-
-void Game::doCommand(int action) {
-	switch (action) {
-	case KEYBIND_PASS:
-		message("INFO", "PASS");
-		break;
-
-	case KEYBIND_UP:
-
-
-	default:
-		message("INFO", "-ILLEGAL COMMAND!");
-		break;
-	}
-
-	endOfTurn();
-}
-
-void Game::endOfTurn() {
-	auto &player = _G(savegame);
-
-	subtractFoodCtr(10);
-	if (!player.isDead()) {
-		g_engine->focusedView()->redraw();
-		promptForCommand();
-	}
-}
-
-void Game::subtractFoodCtr(int amount) {
-	auto &player = _G(savegame);
-	if (player.isDead())
-		return;		// Already dead
-
-	player._food = MAX((int)player._food - amount, 0);
-	if (player._food == 0)
-		dead();
-}
-
-void Game::subtractHp(int amount) {
-	auto &player = _G(savegame);
-	player._hits = MAX((int)player._hits - amount, 0);
-
-	if (player._hits == 0)
-		dead();
-}
-
-void Game::dead() {
-	auto &player = _G(savegame);
-	player._hits = 0;
-	player._food = 0;
-	player._experience = 0;
-	player._coins = 0;
-
-	message("DEAD");
-}
-
-} // namespace Data
-} // namespace Ultima1
-} // namespace Ultima
diff --git a/engines/ultima/ultima1/data/map.cpp b/engines/ultima/ultima1/data/map.cpp
index ea4649119de..9f144efe264 100644
--- a/engines/ultima/ultima1/data/map.cpp
+++ b/engines/ultima/ultima1/data/map.cpp
@@ -22,6 +22,8 @@
 #include "common/file.h"
 #include "ultima/ultima1/data/map.h"
 #include "ultima/ultima1/data/tiles.h"
+#include "ultima/ultima1/logic/locations_logic.h"
+#include "ultima/ultima1/logic/overworld_logic.h"
 #include "ultima/ultima1/ultima1.h"
 
 namespace Ultima {
@@ -30,6 +32,56 @@ namespace Data {
 
 const char *DIRECTION_NAMES[5] = { nullptr, "West", "East", "North", "South" };
 
+static const byte LOCATION_POS_X[LOCATION_COUNT] = {
+	39, 66, 25, 46, 52, 18, 70, 64, 126, 128, 148, 115, 150, 121,
+	150, 109, 42, 44, 64, 31, 66, 37, 66, 25, 128, 101, 142, 121,
+	115, 149, 97, 103, 40, 32, 125, 114, 41, 30, 127, 135, 36, 69,
+	96, 97, 13, 12, 131, 98, 48, 18, 53, 59, 29, 13, 62, 39,
+	38, 130, 100, 124, 155, 147, 98, 109, 116, 136, 52, 32, 25, 14,
+	63, 71, 40, 16, 46, 119, 149, 114, 108, 138, 154, 105, 128, 129
+};
+
+static const byte LOCATION_POS_Y[LOCATION_COUNT] = {
+	39, 41, 61, 28, 63, 34, 63, 22, 36, 63, 22, 43, 49, 15,
+	67, 61, 119, 92, 133, 112, 106, 140, 88, 94, 117, 119, 139, 106,
+	141, 112, 141, 100, 38, 27, 37, 29, 118, 126, 116, 105, 9, 10,
+	33, 66, 89, 122, 87, 88, 11, 13, 22, 29, 37, 43, 49, 60,
+	68, 10, 15, 26, 35, 36, 45, 50, 56, 59, 96, 99, 105, 110,
+	119, 120, 129, 140, 145, 89, 91, 100, 107, 115, 121, 127, 138, 146
+};
+
+// Indexed the same way as LOCATION_POS_X/Y (locationNum - 1) - cities
+// (1-32), castles (33-40), pillars/sign posts (41-47), then dungeons (48-84)
+const char *LOCATION_NAMES[LOCATION_COUNT] = {
+	"Britian", "Moon", "Fawn", "Paws", "Montor", "Yew", "Tune", "Grey",
+	"Arnold", "Linda", "Helen", "Owen", "John", "Gerry", "Wolf", "The Snake",
+	"Nassau", "Clear Lagoon", "Stout", "Gauntlet", "Imagination", "Ponder",
+	"Wealth", "Poor", "Gorlab", "Dextron", "Magic", "Wheeler", "Bulldozer",
+	"The Brother", "Turtle", "Lost Friends",
+
+	"The Castle of Lord British", "The Castle of the Lost King",
+	"The Castle Barataria", "The Castle Rondorin", "The Castle of Olympus",
+	"The Black Dragon's Castle", "The White Dragon's Castle",
+	"The Castle of Shamino",
+
+	"The Pillars of Protection", "The Tower of Knowledge",
+	"The Pillars of the Argonauts", "The Pillar of Ozymandias",
+	"The Sign Post", "The Southern Sign Post", "The Eastern Sign Post",
+
+	"The Grave of the Lost Soul", "The Unholy Hole", "The Dungeon of Perinia",
+	"The Dungeon of Montor", "The Mines of Mt. Drash", "Mondain's Gate to Hell",
+	"The Lost Caverns", "The Dungeon of Doubt", "The Mines of Mt. Drash II",
+	"Death's Awakening", "The Savage Place", "Scorpion Hole", "Advari's Hole",
+	"The Dead Warrior's Fight", "The Horror of the Harpies", "The Labyrinth",
+	"Where Hercules Died", "The Horror of the Harpies II", "The Gorgon Hole",
+	"The Tramp of Doom", "The Viper's Pit", "The Long Death", "The End...",
+	"The Viper's Pit II", "The Slow Death", "The Guild of Death",
+	"The Metal Twister", "The Troll's Hole", "The Skull Smasher",
+	"The Spine Breaker", "The Dungeon of Doom", "The Dead Cat's Life",
+	"The Morbid Adventure", "Free Death Hole", "Dead Man's Walk",
+	"The Dead Cat's Life II", "The Hole to Hades"
+};
+
 void Map::init() {
 	// Load the overworld map
 	Common::File ow;
@@ -66,9 +118,6 @@ void Map::init() {
 				*offset = tc.readByte();
 		}
 	}
-
-	// Load the overworld map by default
-	load(MAP_OVERWORLD);
 }
 
 void Map::load(int mapNum) {
@@ -99,6 +148,23 @@ void Map::load(int mapNum) {
 	// Set up copies of the map position and player tile to use
 	_playerTileId = TILE_PLAYER;
 	clearTiles();
+
+	// Set up the correct logic to use
+	delete _G(logic);
+	if (mapNum >= 49) {
+		_G(logic) = new Logic::DungeonLogic();
+		g_engine->replaceView("Dungeon");
+	} else {
+		if (mapNum == MAP_OVERWORLD)
+			_G(logic) = new Logic::OverworldLogic();
+		else if (mapNum < 33)
+			_G(logic) = new Logic::CityLogic();
+		else if (mapNum < 41)
+			_G(logic) = new Logic::CastleLogic();
+		else
+			_G(logic) = new Logic::PillarLogic();
+		g_engine->replaceView("Overworld");
+	}
 }
 
 void Map::clearTiles() {
@@ -119,9 +185,20 @@ int Map::getMapTile(int x, int y) const {
 }
 
 int Map::getContinentAt(int x, int y) const {
+	assert(_currentMap == MAP_OVERWORLD);
 	return (y > 77 ? 2 : 0) + (x > 83 ? 1 : 0);
 }
 
+int Map::getLocationAt(int x, int y) const {
+	assert(_currentMap == MAP_OVERWORLD);
+	for (int i = 0; i < LOCATION_COUNT; ++i) {
+		if (x == LOCATION_POS_X[i] && y == LOCATION_POS_Y[i])
+			return i + 1;
+	}
+
+	return 0;
+}
+
 bool Map::mapRangeCheckX(int xp) const {
 	if (xp > 83)
 		xp -= 84;
diff --git a/engines/ultima/ultima1/data/map.h b/engines/ultima/ultima1/data/map.h
index 1403d2db157..f0629ee7ebc 100644
--- a/engines/ultima/ultima1/data/map.h
+++ b/engines/ultima/ultima1/data/map.h
@@ -41,6 +41,8 @@ constexpr int MAP_VISIBLE_HEIGHT = 9;
 constexpr int MAP_VISIBLE_CENTER_X = 9;
 constexpr int MAP_VISIBLE_CENTER_Y = 4;
 
+constexpr int LOCATION_COUNT = 84;
+
 enum {
 	MAP_OVERWORLD = 0,
 	MAP_CITY1 = 1
@@ -54,6 +56,7 @@ typedef Common::Array< Common::Array<byte> > MapTiles;
 typedef byte VisibleTiles[MAP_VISIBLE_HEIGHT][MAP_VISIBLE_WIDTH];
 
 extern const char *DIRECTION_NAMES[5];
+extern const char *LOCATION_NAMES[LOCATION_COUNT];
 
 struct Map {
 private:
@@ -99,6 +102,8 @@ public:
 	byte _tilePlayerUp = 0, _tilePlayerDown = 0,
 		_tilePlayerLeft = 0, _tilePlayerRight = 0;
 	VisibleTiles _mapTilesId = {};		// Calculated visible on-screen tiles
+	int _woodsCount = 0, _grassCount = 0, _waterCount = 0;	// Tiles surrounding entered locations
+	bool _isLordBritishCastle = false;
 
 public:
 	/**
@@ -158,6 +163,14 @@ public:
 		return getContinentAt(pt.x, pt.y);
 	}
 
+	/**
+	 * Get the location at a given position
+	 */
+	int getLocationAt(int x, int y) const;
+	int getLocationAt(const Common::Point &pt) const {
+		return getLocationAt(pt.x, pt.y);
+	}
+
 	/**
 	 * Returns true if a map X co-ordinate is far enough from a
 	 * continent boundary to be a valid creature spawn/move position
diff --git a/engines/ultima/ultima1/logic/locations_logic.cpp b/engines/ultima/ultima1/logic/locations_logic.cpp
new file mode 100644
index 00000000000..f39855160e4
--- /dev/null
+++ b/engines/ultima/ultima1/logic/locations_logic.cpp
@@ -0,0 +1,65 @@
+
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "ultima/ultima1/logic/locations_logic.h"
+#include "ultima/ultima1/metaengine.h"
+#include "ultima/ultima1/ultima1.h"
+
+namespace Ultima {
+namespace Ultima1 {
+namespace Logic {
+
+void LocationsLogic::action(int action) {
+	// TODO
+}
+
+void LocationsLogic::keypress(Common::KeyCode keycode) {
+	action(KEYBIND_PASS);
+}
+
+/*-------------------------------------------------------------------*/
+
+void CityLogic::enter() {
+	_G(savegame)._locationPosition = Common::Point(19, 17);
+}
+
+/*-------------------------------------------------------------------*/
+
+void CastleLogic::enter() {
+	_G(savegame)._locationPosition = Common::Point(0, 9);
+}
+
+/*-------------------------------------------------------------------*/
+
+void PillarLogic::enter() {
+	//_G(savegame)._locationPosition = Common::Point(0, 9);
+}
+
+/*-------------------------------------------------------------------*/
+
+void DungeonLogic::enter() {
+
+}
+
+} // namespace Logic
+} // namespace Ultima1
+} // namespace Ultima
diff --git a/engines/ultima/ultima1/data/game.h b/engines/ultima/ultima1/logic/locations_logic.h
similarity index 50%
rename from engines/ultima/ultima1/data/game.h
rename to engines/ultima/ultima1/logic/locations_logic.h
index 2b0546d1b1a..bb96927748f 100644
--- a/engines/ultima/ultima1/data/game.h
+++ b/engines/ultima/ultima1/logic/locations_logic.h
@@ -1,3 +1,4 @@
+
 /* ScummVM - Graphic Adventure Engine
  *
  * ScummVM is the legal property of its developers, whose names
@@ -19,67 +20,61 @@
  *
  */
 
-#ifndef ULTIMA1_DATA_GAME_H
-#define ULTIMA1_DATA_GAME_H
+#ifndef ULTIMA2_LOGIC_LOCATIONS_LOGIC_H
+#define ULTIMA2_LOGIC_LOCATIONS_LOGIC_H
 
-#include "ultima/shared/engine/messages.h"
+#include "ultima/ultima1/logic/logic.h"
 
 namespace Ultima {
 namespace Ultima1 {
-namespace Data {
-
-using namespace Shared::Messages;
+namespace Logic {
 
-/*
- * The number of game frames before prompting the user for a command times out,
- * and it's treated as a pass
+/**
+ * Base class for gameplay handling logic used by the Commands class to respond to player actions
+ * or other miscellaneous keypresses.
  */
-constexpr int FRAMES_BEFORE_COMMAND_TIMEOUT = 10;
+class LocationsLogic : public Logic {
+public:
+	~LocationsLogic() override {
+	}
+
+	void action(int action) override;
+	void keypress(Common::KeyCode keycode) override;
+};
+
+class CityLogic : public LocationsLogic {
+public:
+	~CityLogic() override {
+	}
+
+	void enter() override;
+};
 
-class Game {
+class CastleLogic : public LocationsLogic {
 public:
-	/**
-	 * Called to start the game, both for new characters, and when a savegame is loaded
-	 */
-	void startGame();
-
-	/**
-	 * Prompt the player for a command
-	 */
-	void promptForCommand();
-
-	/**
-	 * Implements an in-game command
-	 */
-	void doCommand(int action);
-
-	/**
-	 * Called after actions are done
-	 */
-	void endOfTurn();
-
-	/**
-	 * Subtract food from the player
-	 */
-	void subtractFoodCtr(int amount);
-
-	/**
-	 * Remove HP from the player
-	 */
-	void subtractHp(int amount);
-
-	/**
-	 * Player has died
-	 */
-	void dead();
-
-	/**
-	 * Triggers a message to the game view
-	 */
-	void message(const Common::String &name, const char *param = nullptr);
+	~CastleLogic() override {
+	}
+
+	void enter() override;
+};
+
+class PillarLogic : public LocationsLogic {
+public:
+	~PillarLogic() override {
+	}
+
+	void enter() override;
+};
+
+class DungeonLogic : public LocationsLogic {
+public:
+	~DungeonLogic() override {
+	}
+
+	void enter() override;
 };
 
-} // namespace Data
+} // namespace Logic
 } // namespace Ultima1
 } // namespace Ultima
 
diff --git a/engines/ultima/ultima1/logic/logic.cpp b/engines/ultima/ultima1/logic/logic.cpp
index 20f63f70f20..61ffb835ed6 100644
--- a/engines/ultima/ultima1/logic/logic.cpp
+++ b/engines/ultima/ultima1/logic/logic.cpp
@@ -37,6 +37,14 @@ void Logic::prompt() {
 	g_engine->send("Commands", GameMessage("PROMPT"));
 }
 
+void Logic::redrawMap() {
+	g_engine->send("Overworld", Shared::Messages::GameMessage("UPDATE", "MAP"));
+}
+
+void Logic::redrawStats() {
+	g_engine->send("Overworld", Shared::Messages::GameMessage("UPDATE", "STATS"));
+}
+
 void Logic::playFX(int num) {
 	g_engine->playFX(num);
 }
diff --git a/engines/ultima/ultima1/logic/logic.h b/engines/ultima/ultima1/logic/logic.h
index 2f0e0355c23..1bc5e23342d 100644
--- a/engines/ultima/ultima1/logic/logic.h
+++ b/engines/ultima/ultima1/logic/logic.h
@@ -57,6 +57,16 @@ protected:
 	int getRandomNumber(int minNumber, int maxNumber);
 	int getRandomNumber(int maxNumber);
 
+	/**
+	 * Signal the map to redraw
+	 */
+	void redrawMap();
+
+	/**
+	 * Signal the stats to redraw
+	 */
+	void redrawStats();
+
 public:
 	virtual ~Logic() {
 	}
@@ -65,6 +75,8 @@ public:
 	}
 	virtual void keypress(Common::KeyCode keycode) {
 	}
+	virtual void enter() {
+	}
 };
 
 } // namespace Logic
diff --git a/engines/ultima/ultima1/logic/overworld_logic.cpp b/engines/ultima/ultima1/logic/overworld_logic.cpp
index be7f8f7785d..ad9c2472f3f 100644
--- a/engines/ultima/ultima1/logic/overworld_logic.cpp
+++ b/engines/ultima/ultima1/logic/overworld_logic.cpp
@@ -74,6 +74,54 @@ void OverworldLogic::keypress(Common::KeyCode keycode) {
 	endOfTurn();
 }
 
+void OverworldLogic::enter() {
+	int location = _G(map).getLocationAt(_G(savegame)._overworldPos);
+	if (location == 0) {
+		writeString("Enter?\n");
+		playFX(1);
+	} else {
+		// Check for tiles surrounding the location
+		_G(map)._waterCount = 0;
+		_G(map)._grassCount = 0;
+		_G(map)._woodsCount = 0;
+
+		for (int deltaY = -1; deltaY <= 1; ++deltaY) {
+			for (int deltaX = -1; deltaX <= 1; ++deltaX) {
+				int tile = getTileAt(_G(savegame)._overworldPos.x + deltaX, _G(savegame)._overworldPos.y + deltaY);
+				switch (tile) {
+				case Data::TILE_OCEAN:
+					_G(map)._waterCount++;
+					break;
+				case Data::TILE_GRASS:
+					_G(map)._grassCount++;
+					break;
+				case Data::TILE_WOODS:
+					_G(map)._woodsCount++;
+					break;
+				default:
+					break;
+				}
+			}
+		}
+
+		// Display the enter message
+		_G(map)._isLordBritishCastle = location == 33;
+
+		Common::String msg = "Entering...\n";
+		if (!_G(map)._isLordBritishCastle)
+			msg += "The city of ";
+		msg += Data::LOCATION_NAMES[location];
+		msg += "\n";
+		writeString(msg);
+
+		// Load the new location
+		_G(map).load(location);
+
+		// Run any logic for entering it
+		_G(logic)->enter();
+	}
+}
+
 void OverworldLogic::move(Data::Direction dir) {
 	if (!moveCheck(dir))
 		return;
@@ -108,7 +156,7 @@ void OverworldLogic::move(Data::Direction dir) {
 bool OverworldLogic::moveCheck(Data::Direction dir) {
 	int xp = getViewportX(Data::MAP_VISIBLE_CENTER_X + DELTA_X[dir]);
 	int yp = getViewportY(Data::MAP_VISIBLE_CENTER_Y + DELTA_Y[dir]);
-	int tile = getTileAt(xp, yp, 1);
+	int tile = getTileAt(xp, yp);
 	int transport = _G(savegame)._transportType;
 
 	if (tile >= Data::TILE_FIRST_MONSTER && tile <= Data::TILE_LAST_MONSTER) {
@@ -137,7 +185,7 @@ bool OverworldLogic::moveCheck(Data::Direction dir) {
 			impassable(IMP_WATER);
 			return false;
 		}
-	} else if (tile == Data::TILE_WOODS && Data::TRANSPORT_AIRCAR) {
+	} else if (tile == Data::TILE_WOODS && transport == Data::TRANSPORT_AIRCAR) {
 		impassable(IMP_WOODS);
 		return false;
 
@@ -305,9 +353,9 @@ void OverworldLogic::endOfTurn() {
 	updateCreatures();
 	reduceFood();
 
-	// Signal to update the map and stats area. This isn't a full view redraw though,
-	// since we don't want to lose any text added to the Commands area
-	g_engine->send("Overworld", Shared::Messages::GameMessage("UPDATE"));
+	redrawMap();
+	redrawStats();
+	prompt();
 }
 
 void OverworldLogic::generateCreatures() {
@@ -351,7 +399,7 @@ void OverworldLogic::generateCreatures() {
 
 		x = getViewportX(xOff + Data::MAP_VISIBLE_CENTER_X);
 		y = getViewportY(yOff + Data::MAP_VISIBLE_CENTER_Y);
-		tileAtSpot = getTileAt(x, y, 1);
+		tileAtSpot = getTileAt(x, y);
 
 		rangeOk = _G(map).mapRangeCheckX(x) && _G(map).mapRangeCheckY(y);
 	} while (tileAtSpot != data && !rangeOk);
diff --git a/engines/ultima/ultima1/logic/overworld_logic.h b/engines/ultima/ultima1/logic/overworld_logic.h
index 6433adabb19..ed8b094a446 100644
--- a/engines/ultima/ultima1/logic/overworld_logic.h
+++ b/engines/ultima/ultima1/logic/overworld_logic.h
@@ -32,6 +32,11 @@ namespace Logic {
 
 class OverworldLogic : public Logic {
 private:
+	/**
+	 * Enter a location
+	 */
+	void enter();
+
 	/**
 	 * Check for movement
 	 */
@@ -57,9 +62,9 @@ private:
 	int getViewportY(int yp) const;
 
 	/**
-	 * Returns a tile or creature at a given co-ordinate
+	 * Returns a tile or creature/entity at a given co-ordinate
 	 */
-	int getTileAt(int x, int y, int creatureIndex) const;
+	int getTileAt(int x, int y, int creatureIndex = 1) const;
 
 	/**
 	 * Impassable tile
diff --git a/engines/ultima/ultima1/metaengine.cpp b/engines/ultima/ultima1/metaengine.cpp
index 9cb7b03941b..0f1711ddcc2 100644
--- a/engines/ultima/ultima1/metaengine.cpp
+++ b/engines/ultima/ultima1/metaengine.cpp
@@ -49,6 +49,7 @@ static const KeybindingRecord OVERWORLD_KEYS[] = {
 	{ KEYBIND_DOWN, "DOWN", _s("Down"), "DOWN", "JOY_DOWN"},
 	{ KEYBIND_LEFT, "LEFT", _s("Left"), "LEFT", "JOY_LEFT"},
 	{ KEYBIND_RIGHT, "RIGHT", _s("Right"), "RIGHT", "JOY_RIGHT"},
+	{ KEYBIND_ENTER, "ENTER", _s("Enter"), "e", nullptr },
 	{ KEYBIND_NONE, nullptr, nullptr, nullptr, nullptr }
 };
 
diff --git a/engines/ultima/ultima1/ultima1.cpp b/engines/ultima/ultima1/ultima1.cpp
index 66d7df78822..a4b3b225a76 100644
--- a/engines/ultima/ultima1/ultima1.cpp
+++ b/engines/ultima/ultima1/ultima1.cpp
@@ -79,7 +79,7 @@ Common::Error Ultima1Engine::syncGame(Common::Serializer &s) {
 	_savegame.synchronize(s);
 
 	if (s.isLoading())
-		_game.startGame();
+		_G(map).load(_G(savegame)._mapNum);
 
 	return Common::kNoError;
 }
diff --git a/engines/ultima/ultima1/ultima1.h b/engines/ultima/ultima1/ultima1.h
index ded9da6ee60..9e55d08d850 100644
--- a/engines/ultima/ultima1/ultima1.h
+++ b/engines/ultima/ultima1/ultima1.h
@@ -36,7 +36,6 @@
 #include "graphics/screen.h"
 #include "ultima/detection.h"
 #include "ultima/shared/engine/events.h"
-#include "ultima/ultima1/data/game.h"
 #include "ultima/ultima1/data/map.h"
 #include "ultima/ultima1/data/savegame.h"
 #include "ultima/ultima1/data/tiles.h"
@@ -63,7 +62,6 @@ protected:
 	}
 
 public:
-	Data::Game _game;
 	Data::Map _map;
 	Data::Savegame _savegame;
 	Graphics::ManagedSurface _tiles[Data::TILE_COUNT];
diff --git a/engines/ultima/ultima1/views/create_character.cpp b/engines/ultima/ultima1/views/create_character.cpp
index 9b2d94ae0a7..64f29b8b6e4 100644
--- a/engines/ultima/ultima1/views/create_character.cpp
+++ b/engines/ultima/ultima1/views/create_character.cpp
@@ -410,7 +410,8 @@ void CreateCharacter::confirmAndSave() {
 
 	_cursor.hide();
 
-	g_engine->_game.startGame();
+	// Load the overworld map
+	_G(map).load(MAP_OVERWORLD);
 }
 
 } // namespace Views
diff --git a/engines/ultima/ultima1/views/main_menu.cpp b/engines/ultima/ultima1/views/main_menu.cpp
index 0f2929b2c77..36af0a2297f 100644
--- a/engines/ultima/ultima1/views/main_menu.cpp
+++ b/engines/ultima/ultima1/views/main_menu.cpp
@@ -59,8 +59,7 @@ bool MainMenu::msgKeypress(const KeypressMessage &msg) {
 		break;
 
 	case 'B':
-		if (g_engine->loadGameDialog())
-			g_engine->_game.startGame();
+		g_engine->loadGameDialog();
 		break;
 
 	default:
diff --git a/engines/ultima/ultima1/views/overworld.cpp b/engines/ultima/ultima1/views/overworld.cpp
index 4c7d7683426..092b4655aa9 100644
--- a/engines/ultima/ultima1/views/overworld.cpp
+++ b/engines/ultima/ultima1/views/overworld.cpp
@@ -54,8 +54,10 @@ void Overworld::draw() {
 
 bool Overworld::msgGame(const GameMessage &msg) {
 	if (msg._name == "UPDATE") {
-		_map.redraw();
-		_stats.redraw();
+		if (msg._stringValue == "MAP")
+			_map.redraw();
+		if (msg._stringValue == "STATS")
+			_stats.redraw();
 		return true;
 	}
 


Commit: d09cb865b8b20a407cdb17d1740d9e59e2833c21
    https://github.com/scummvm/scummvm/commit/d09cb865b8b20a407cdb17d1740d9e59e2833c21
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:40:47+11:00

Commit Message:
ULTIMA: ULTIMA1: City/Castle init logic

Changed paths:
  A engines/ultima/ultima1/logic/city_castle_logic.cpp
  A engines/ultima/ultima1/logic/city_castle_logic.h
  A engines/ultima/ultima1/logic/dungeon_logic.cpp
  A engines/ultima/ultima1/logic/dungeon_logic.h
  A engines/ultima/ultima1/logic/pillar_logic.cpp
  A engines/ultima/ultima1/logic/pillar_logic.h
  R engines/ultima/ultima1/logic/locations_logic.cpp
  R engines/ultima/ultima1/logic/locations_logic.h
    engines/ultima/module.mk
    engines/ultima/ultima1/data/map.cpp
    engines/ultima/ultima1/data/map.h
    engines/ultima/ultima1/data/savegame.cpp
    engines/ultima/ultima1/data/savegame.h
    engines/ultima/ultima1/logic/overworld_logic.cpp
    engines/ultima/ultima1/logic/overworld_logic.h


diff --git a/engines/ultima/module.mk b/engines/ultima/module.mk
index 95692ddfc7e..b598c65234a 100644
--- a/engines/ultima/module.mk
+++ b/engines/ultima/module.mk
@@ -61,8 +61,10 @@ MODULE_OBJS += \
 	ultima1/gfx/text_cursor.o \
 	ultima1/gfx/text_input.o \
 	ultima1/logic/logic.o \
-	ultima1/logic/locations_logic.o \
+	ultima1/logic/city_castle_logic.o \
+	ultima1/logic/dungeon_logic.o \
 	ultima1/logic/overworld_logic.o \
+	ultima1/logic/pillar_logic.o \
 	ultima1/views/view.o \
 	ultima1/views/commands.o \
 	ultima1/views/create_character.o \
diff --git a/engines/ultima/ultima1/data/map.cpp b/engines/ultima/ultima1/data/map.cpp
index 9f144efe264..86b374bbae9 100644
--- a/engines/ultima/ultima1/data/map.cpp
+++ b/engines/ultima/ultima1/data/map.cpp
@@ -22,8 +22,10 @@
 #include "common/file.h"
 #include "ultima/ultima1/data/map.h"
 #include "ultima/ultima1/data/tiles.h"
-#include "ultima/ultima1/logic/locations_logic.h"
+#include "ultima/ultima1/logic/city_castle_logic.h"
+#include "ultima/ultima1/logic/dungeon_logic.h"
 #include "ultima/ultima1/logic/overworld_logic.h"
+#include "ultima/ultima1/logic/pillar_logic.h"
 #include "ultima/ultima1/ultima1.h"
 
 namespace Ultima {
diff --git a/engines/ultima/ultima1/data/map.h b/engines/ultima/ultima1/data/map.h
index f0629ee7ebc..bcc4df1c778 100644
--- a/engines/ultima/ultima1/data/map.h
+++ b/engines/ultima/ultima1/data/map.h
@@ -52,6 +52,13 @@ enum Direction {
 	DIR_LEFT = 1, DIR_RIGHT = 2, DIR_UP = 3, DIR_DOWN = 4
 };
 
+enum MapType {
+	MAPTYPE_OVERWORLD = 0,
+	MAPTYPE_CITY = 1,
+	MAPTYPE_CASTLE = 2,
+	MAPTYPE_DUNGEON = 3
+};
+
 typedef Common::Array< Common::Array<byte> > MapTiles;
 typedef byte VisibleTiles[MAP_VISIBLE_HEIGHT][MAP_VISIBLE_WIDTH];
 
@@ -73,14 +80,17 @@ private:
 	class Row {
 	private:
 		Map *_owner = nullptr;
-		const byte *_data = nullptr;
+		byte *_data = nullptr;
 
 	public:
 		Row() {}
-		Row(Map *owner, const byte *data) : _owner(owner), _data(data) {}
+		Row(Map *owner, byte *data) : _owner(owner), _data(data) {}
 
-		// Give access to the byte for a column within the row
-		const byte &operator[](int x) const {
+		// Give access to the byte for a column within the row. Returns a
+		// mutable reference (even though the method is const - constness
+		// here is about the Row's own members, not the mapped bytes) so
+		// map[y][x] = value can be used to modify the map's contents
+		byte &operator[](int x) const {
 			// Handle when the Y is already outside the map, or X is outside map
 			if (!_data || (_owner->_outsideMapTile != 0xff && (x < 0 || x >= _owner->_mapWidth)))
 				return _owner->_outsideMapTile;
@@ -104,6 +114,10 @@ public:
 	VisibleTiles _mapTilesId = {};		// Calculated visible on-screen tiles
 	int _woodsCount = 0, _grassCount = 0, _waterCount = 0;	// Tiles surrounding entered locations
 	bool _isLordBritishCastle = false;
+	int _mapStyle = 0;
+	int _mapType = MAPTYPE_OVERWORLD;
+	int _tavernCtr = 0;
+	int _castleNum = 0, _castleNum2 = 0;
 
 public:
 	/**
diff --git a/engines/ultima/ultima1/data/savegame.cpp b/engines/ultima/ultima1/data/savegame.cpp
index 216f653ba92..df24c61c391 100644
--- a/engines/ultima/ultima1/data/savegame.cpp
+++ b/engines/ultima/ultima1/data/savegame.cpp
@@ -31,6 +31,13 @@ const char *SEX_NAMES[] = { "Male", "Female" };
 const char *RACE_NAMES[] = { nullptr, "Human", "Elf", "Dwarf", "Bobbit" };
 const char *CLASS_NAMES[] = { nullptr, "Fighter", "Cleric", "Wizard", "Thief" };
 
+void LocationEntity::synchronize(Common::Serializer &s) {
+	s.syncAsSint16LE(_type);
+	s.syncAsSint16LE(_position.x);
+	s.syncAsSint16LE(_position.y);
+	s.syncAsSint16LE(_hitPoints);
+}
+
 void Savegame::synchronizeBasic(Common::Serializer &s) {
 	s.syncBytes((byte *)_name, MAX_NAME_LENGTH + 2);
 	s.syncAsByte(_race);
@@ -90,6 +97,14 @@ void Savegame::synchronizeExtra(Common::Serializer &s) {
 	s.syncAsSint16LE(_mapNum);
 	s.syncAsSint16LE(_locationPosition.x);
 	s.syncAsSint16LE(_locationPosition.y);
+
+	for (int i = 0; i < LOCATION_ENTITY_COUNT; ++i)
+		_locationEntities[i].synchronize(s);
+	s.syncAsSint16LE(_guardsHostile);
+	s.syncAsSint16LE(_hasCastleKey);
+	s.syncAsSint16LE(_freeingPrincess);
+	s.syncAsSint16LE(_castleItemAllowance);
+	s.syncAsSint16LE(_castleKeyVal);
 }
 
 void Savegame::synchronize(Common::Serializer &s) {
diff --git a/engines/ultima/ultima1/data/savegame.h b/engines/ultima/ultima1/data/savegame.h
index 485df0ae659..856bcbc80a8 100644
--- a/engines/ultima/ultima1/data/savegame.h
+++ b/engines/ultima/ultima1/data/savegame.h
@@ -34,6 +34,7 @@ constexpr int MAX_NAME_LENGTH = 14;
 constexpr int QUEST_COUNT = 9;
 constexpr int OVERWORLD_ENTITY_COUNT = 40;
 constexpr int CREATURES_COUNT = 10;
+constexpr int LOCATION_ENTITY_COUNT = 15;
 
 extern const char *SEX_NAMES[];
 extern const char *RACE_NAMES[];
@@ -80,6 +81,18 @@ enum TransportType {
 	TRANSPORT_COUNT = 8
 };
 
+/**
+ * A single NPC/creature placement within a city or castle map - the king
+ * or princess in a castle, or a merchant/guard/bard in a city
+ */
+struct LocationEntity {
+	int16 _type;
+	Common::Point _position;
+	int16 _hitPoints;
+
+	void synchronize(Common::Serializer &s);
+};
+
 /**
  * The player character's savegame data
  */
@@ -154,6 +167,12 @@ public:
 	// Extra fields
 	int16 _mapNum = 0;
 	Common::Point _locationPosition;
+	LocationEntity _locationEntities[LOCATION_ENTITY_COUNT] = {};
+	int16 _guardsHostile = 0;
+	int16 _hasCastleKey = 0;
+	int16 _freeingPrincess = 0;
+	int16 _castleItemAllowance = 0;
+	int16 _castleKeyVal = 0;
 
 	/**
 	 * Synchronize savegame data
diff --git a/engines/ultima/ultima1/logic/city_castle_logic.cpp b/engines/ultima/ultima1/logic/city_castle_logic.cpp
new file mode 100644
index 00000000000..55a3f069ad6
--- /dev/null
+++ b/engines/ultima/ultima1/logic/city_castle_logic.cpp
@@ -0,0 +1,183 @@
+
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "ultima/ultima1/logic/city_castle_logic.h"
+#include "ultima/ultima1/metaengine.h"
+#include "ultima/ultima1/ultima1.h"
+
+namespace Ultima {
+namespace Ultima1 {
+namespace Logic {
+
+constexpr int LOCATION_STYLE_COUNT = 10;
+
+// Per map-style sets of widgets to populate a city/castle interior with,
+// indexed by Map::_mapStyle. The first two styles are castles (each has a
+// king and princess); the remaining eight are cities. Unused slots within
+// a style are padded with a _type of -1
+static const Data::LocationEntity CITY_WIDGETS[LOCATION_STYLE_COUNT][Data::LOCATION_ENTITY_COUNT] = {
+	// Style 0 - castle
+	{
+		{ 20, { 33, 4 }, 2000 }, { 22, { 35, 12 }, 1 }, { 17, { 1, 6 }, 500 },
+		{ 17, { 17, 6 }, 500 }, { 17, { 17, 11 }, 500 }, { 17, { 25, 7 }, 500 },
+		{ 17, { 25, 12 }, 500 }, { 17, { 36, 9 }, 500 }, { 19, { 35, 6 }, 1 },
+		{ -1, { 0, 0 }, 0 }, { -1, { 0, 0 }, 0 }, { -1, { 0, 0 }, 0 },
+		{ -1, { 0, 0 }, 0 }, { -1, { 0, 0 }, 0 }, { -1, { 0, 0 }, 0 }
+	},
+	// Style 1 - castle
+	{
+		{ 20, { 25, 4 }, 2000 }, { 22, { 31, 2 }, 1 }, { 17, { 28, 12 }, 500 },
+		{ 17, { 34, 12 }, 500 }, { 17, { 0, 8 }, 500 }, { 17, { 11, 3 }, 500 },
+		{ 17, { 22, 1 }, 500 }, { 17, { 28, 1 }, 500 }, { 17, { 33, 5 }, 500 },
+		{ 19, { 22, 14 }, 1 }, { -1, { 0, 0 }, 0 }, { -1, { 0, 0 }, 0 },
+		{ -1, { 0, 0 }, 0 }, { -1, { 0, 0 }, 0 }, { -1, { 0, 0 }, 0 }
+	},
+	// Style 2 - city
+	{
+		{ 19, { 15, 5 }, 1 }, { 50, { 34, 6 }, 1 }, { 17, { 2, 9 }, 500 },
+		{ 17, { 16, 16 }, 500 }, { 17, { 18, 2 }, 500 }, { 17, { 20, 8 }, 500 },
+		{ 17, { 21, 16 }, 500 }, { 17, { 36, 8 }, 500 }, { 21, { 6, 3 }, 1 },
+		{ 21, { 6, 14 }, 1 }, { 21, { 13, 14 }, 1 }, { 21, { 25, 3 }, 1 },
+		{ 21, { 25, 12 }, 1 }, { 21, { 32, 3 }, 1 }, { -1, { 0, 0 }, 0 }
+	},
+	// Style 3 - city
+	{
+		{ 19, { 15, 9 }, 1 }, { 50, { 27, 3 }, 1 }, { 17, { 1, 10 }, 500 },
+		{ 17, { 9, 8 }, 500 }, { 17, { 16, 1 }, 500 }, { 17, { 21, 16 }, 500 },
+		{ 17, { 36, 7 }, 500 }, { 21, { 4, 16 }, 1 }, { 21, { 5, 3 }, 1 },
+		{ 21, { 12, 3 }, 1 }, { 21, { 30, 1 }, 1 }, { 21, { 34, 12 }, 1 },
+		{ -1, { 0, 0 }, 0 }, { -1, { 0, 0 }, 0 }, { -1, { 0, 0 }, 0 }
+	},
+	// Style 4 - city
+	{
+		{ 19, { 17, 3 }, 1 }, { 50, { 21, 5 }, 1 }, { 17, { 10, 10 }, 500 },
+		{ 17, { 15, 15 }, 500 }, { 17, { 22, 15 }, 500 }, { 17, { 23, 9 }, 500 },
+		{ 21, { 3, 12 }, 1 }, { 21, { 6, 3 }, 1 }, { 21, { 19, 1 }, 1 },
+		{ 21, { 34, 1 }, 1 }, { -1, { 0, 0 }, 0 }, { -1, { 0, 0 }, 0 },
+		{ -1, { 0, 0 }, 0 }, { -1, { 0, 0 }, 0 }, { -1, { 0, 0 }, 0 }
+	},
+	// Style 5 - city
+	{
+		{ 19, { 19, 12 }, 1 }, { 50, { 24, 3 }, 1 }, { 17, { 1, 7 }, 500 },
+		{ 17, { 1, 11 }, 500 }, { 17, { 8, 16 }, 500 }, { 17, { 14, 7 }, 500 },
+		{ 17, { 29, 16 }, 500 }, { 17, { 36, 11 }, 500 }, { 21, { 4, 1 }, 1 },
+		{ 21, { 12, 1 }, 1 }, { 21, { 17, 1 }, 1 }, { 21, { 22, 1 }, 1 },
+		{ 21, { 28, 1 }, 1 }, { 21, { 34, 1 }, 1 }, { -1, { 0, 0 }, 0 }
+	},
+	// Style 6 - city
+	{
+		{ 17, { 17, 2 }, 500 }, { 17, { 17, 15 }, 500 }, { 17, { 20, 2 }, 500 },
+		{ 17, { 20, 15 }, 500 }, { 21, { 12, 8 }, 1 }, { 21, { 25, 8 }, 1 },
+		{ -1, { 0, 0 }, 0 }, { -1, { 0, 0 }, 0 }, { -1, { 0, 0 }, 0 },
+		{ -1, { 0, 0 }, 0 }, { -1, { 0, 0 }, 0 }, { -1, { 0, 0 }, 0 },
+		{ -1, { 0, 0 }, 0 }, { -1, { 0, 0 }, 0 }, { -1, { 0, 0 }, 0 }
+	},
+	// Style 7 - city
+	{
+		{ 50, { 20, 4 }, 1 }, { 17, { 1, 1 }, 500 }, { 17, { 1, 16 }, 500 },
+		{ 17, { 8, 9 }, 500 }, { 17, { 16, 15 }, 500 }, { 17, { 18, 10 }, 500 },
+		{ 17, { 21, 15 }, 500 }, { 17, { 29, 9 }, 500 }, { 17, { 36, 1 }, 500 },
+		{ 17, { 36, 16 }, 500 }, { 21, { 8, 4 }, 1 }, { 21, { 9, 13 }, 1 },
+		{ 21, { 18, 2 }, 1 }, { 21, { 28, 13 }, 1 }, { 21, { 29, 4 }, 1 }
+	},
+	// Style 8 - city
+	{
+		{ 19, { 31, 14 }, 1 }, { 50, { 27, 6 }, 1 }, { 17, { 4, 11 }, 500 },
+		{ 17, { 17, 14 }, 500 }, { 17, { 20, 14 }, 500 }, { 21, { 7, 4 }, 1 },
+		{ 21, { 18, 4 }, 1 }, { 21, { 29, 3 }, 1 }, { -1, { 0, 0 }, 0 },
+		{ -1, { 0, 0 }, 0 }, { -1, { 0, 0 }, 0 }, { -1, { 0, 0 }, 0 },
+		{ -1, { 0, 0 }, 0 }, { -1, { 0, 0 }, 0 }, { -1, { 0, 0 }, 0 }
+	},
+	// Style 9 - city
+	{
+		{ 19, { 19, 10 }, 5 }, { 17, { 6, 12 }, 500 }, { 17, { 6, 15 }, 500 },
+		{ 17, { 7, 7 }, 500 }, { 17, { 9, 5 }, 500 }, { 17, { 28, 17 }, 500 },
+		{ 17, { 37, 8 }, 500 }, { 21, { 1, 13 }, 1 }, { 21, { 4, 1 }, 1 },
+		{ 21, { 16, 1 }, 1 }, { 21, { 24, 1 }, 1 }, { 21, { 33, 16 }, 1 },
+		{ 21, { 34, 1 }, 1 }, { -1, { 0, 0 }, 0 }, { -1, { 0, 0 }, 0 }
+	}
+};
+
+void CityCastleLogic::enter() {
+	loadEntities();
+}
+
+void CityCastleLogic::action(int action) {
+	// TODO
+}
+
+void CityCastleLogic::keypress(Common::KeyCode keycode) {
+	action(KEYBIND_PASS);
+}
+
+void CityCastleLogic::loadEntities() {
+	auto &map = _G(map);
+	auto &savegame = _G(savegame);
+	const Data::LocationEntity *widgets = CITY_WIDGETS[map._mapStyle];
+
+	for (int idx = 0; idx < Data::LOCATION_ENTITY_COUNT; ++idx)
+		savegame._locationEntities[idx] = widgets[idx];
+}
+
+/*-------------------------------------------------------------------*/
+
+CityLogic::CityLogic() {
+	_G(map)._tavernCtr = 0;
+	_G(map)._mapStyle = (_G(map)._currentMap - 1) % 8 + 2;
+	_G(map)._mapType = Data::MAPTYPE_CITY;
+}
+
+void CityLogic::enter() {
+	_G(savegame)._locationPosition = Common::Point(19, 17);
+	CityCastleLogic::enter();
+}
+
+/*-------------------------------------------------------------------*/
+
+CastleLogic::CastleLogic() {
+	_G(map)._castleNum = _G(map)._currentMap - 33;
+	_G(map)._mapStyle = (_G(map)._currentMap - 1) % 2;
+	_G(map)._castleNum2 = _G(map)._castleNum + 1;
+	_G(map)._mapType = Data::MAPTYPE_CASTLE;
+
+	_G(savegame)._guardsHostile = 0;
+	_G(savegame)._hasCastleKey = 0;
+	_G(savegame)._freeingPrincess = 0;
+	_G(savegame)._castleItemAllowance = 0;
+
+	// The two castle map styles are vertical mirrors of each other, so
+	// the row these two cells sit on differs between them
+	int row = (_G(map)._mapStyle == 0) ? 14 : 4;
+	_G(map)[row][35] = 11;
+	_G(map)[row][31] = 11;
+
+	_G(savegame)._castleKeyVal = getRandomNumber(1) == 1 ? 61 : 60;
+}
+
+void CastleLogic::enter() {
+	_G(savegame)._locationPosition = Common::Point(0, 9);
+	CityCastleLogic::enter();
+}
+
+} // namespace Logic
+} // namespace Ultima1
+} // namespace Ultima
diff --git a/engines/ultima/ultima1/logic/locations_logic.h b/engines/ultima/ultima1/logic/city_castle_logic.h
similarity index 69%
rename from engines/ultima/ultima1/logic/locations_logic.h
rename to engines/ultima/ultima1/logic/city_castle_logic.h
index bb96927748f..c12c1906838 100644
--- a/engines/ultima/ultima1/logic/locations_logic.h
+++ b/engines/ultima/ultima1/logic/city_castle_logic.h
@@ -20,8 +20,8 @@
  *
  */
 
-#ifndef ULTIMA2_LOGIC_LOCATIONS_LOGIC_H
-#define ULTIMA2_LOGIC_LOCATIONS_LOGIC_H
+#ifndef ULTIMA2_LOGIC_CITY_CASTLE_LOGIC_H
+#define ULTIMA2_LOGIC_CITY_CASTLE_LOGIC_H
 
 #include "ultima/ultima1/logic/logic.h"
 
@@ -29,51 +29,37 @@ namespace Ultima {
 namespace Ultima1 {
 namespace Logic {
 
-/**
- * Base class for gameplay handling logic used by the Commands class to respond to player actions
- * or other miscellaneous keypresses.
- */
-class LocationsLogic : public Logic {
+class CityCastleLogic : public Logic {
+protected:
+	void loadEntities();
+
 public:
-	~LocationsLogic() override {
+	~CityCastleLogic() override {
 	}
 
+	void enter() override;
 	void action(int action) override;
 	void keypress(Common::KeyCode keycode) override;
 };
 
-class CityLogic : public LocationsLogic {
+class CityLogic : public CityCastleLogic {
 public:
+	CityLogic();
 	~CityLogic() override {
 	}
 
 	void enter() override;
 };
 
-class CastleLogic : public LocationsLogic {
+class CastleLogic : public CityCastleLogic {
 public:
+	CastleLogic();
 	~CastleLogic() override {
 	}
 
 	void enter() override;
 };
 
-class PillarLogic : public LocationsLogic {
-public:
-	~PillarLogic() override {
-	}
-
-	void enter() override;
-};
-
-class DungeonLogic : public LocationsLogic {
-public:
-	~DungeonLogic() override {
-	}
-
-	void enter() override;
-};
-
 } // namespace Logic
 } // namespace Ultima1
 } // namespace Ultima
diff --git a/engines/ultima/ultima1/logic/dungeon_logic.cpp b/engines/ultima/ultima1/logic/dungeon_logic.cpp
new file mode 100644
index 00000000000..0955210102f
--- /dev/null
+++ b/engines/ultima/ultima1/logic/dungeon_logic.cpp
@@ -0,0 +1,45 @@
+
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "ultima/ultima1/logic/dungeon_logic.h"
+#include "ultima/ultima1/metaengine.h"
+#include "ultima/ultima1/ultima1.h"
+
+namespace Ultima {
+namespace Ultima1 {
+namespace Logic {
+
+void DungeonLogic::enter() {
+	// TODO
+}
+
+void DungeonLogic::action(int action) {
+	// TODO
+}
+
+void DungeonLogic::keypress(Common::KeyCode keycode) {
+	action(KEYBIND_PASS);
+}
+
+} // namespace Logic
+} // namespace Ultima1
+} // namespace Ultima
diff --git a/engines/ultima/ultima1/logic/dungeon_logic.h b/engines/ultima/ultima1/logic/dungeon_logic.h
new file mode 100644
index 00000000000..2fd7037684e
--- /dev/null
+++ b/engines/ultima/ultima1/logic/dungeon_logic.h
@@ -0,0 +1,46 @@
+
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef ULTIMA2_LOGIC_DUNGEON_LOGIC_H
+#define ULTIMA2_LOGIC_DUNGEON_LOGIC_H
+
+#include "ultima/ultima1/logic/logic.h"
+
+namespace Ultima {
+namespace Ultima1 {
+namespace Logic {
+
+class DungeonLogic : public Logic {
+public:
+	~DungeonLogic() override {
+	}
+
+	void enter() override;
+	void action(int action) override;
+	void keypress(Common::KeyCode keycode) override;
+};
+
+} // namespace Logic
+} // namespace Ultima1
+} // namespace Ultima
+
+#endif
diff --git a/engines/ultima/ultima1/logic/overworld_logic.cpp b/engines/ultima/ultima1/logic/overworld_logic.cpp
index ad9c2472f3f..0bea6b54b3c 100644
--- a/engines/ultima/ultima1/logic/overworld_logic.cpp
+++ b/engines/ultima/ultima1/logic/overworld_logic.cpp
@@ -49,6 +49,10 @@ static const char *IMPASSABLE_REASONS[] = {
 const int8 DELTA_X[5] = { 0, -1, 1, 0, 0 };
 const int8 DELTA_Y[5] = { 0, 0, 0, -1, 1 };
 
+OverworldLogic::OverworldLogic() {
+	_G(map)._mapType = Data::MAPTYPE_OVERWORLD;
+}
+
 void OverworldLogic::action(int action) {
 	switch (action) {
 	case KEYBIND_UP:
@@ -63,7 +67,14 @@ void OverworldLogic::action(int action) {
 	case KEYBIND_RIGHT:
 		move(Data::DIR_RIGHT);
 		break;
+	case KEYBIND_ENTER:
+		enter();
+		break;
+	case KEYBIND_PASS:
+		pass();
+		break;
 	default:
+		writeString("Huh?\n");
 		break;
 	}
 
@@ -71,6 +82,7 @@ void OverworldLogic::action(int action) {
 }
 
 void OverworldLogic::keypress(Common::KeyCode keycode) {
+	writeString("Huh?\n");
 	endOfTurn();
 }
 
@@ -122,6 +134,10 @@ void OverworldLogic::enter() {
 	}
 }
 
+void OverworldLogic::pass() {
+	writeString("Pass\n");
+}
+
 void OverworldLogic::move(Data::Direction dir) {
 	if (!moveCheck(dir))
 		return;
diff --git a/engines/ultima/ultima1/logic/overworld_logic.h b/engines/ultima/ultima1/logic/overworld_logic.h
index ed8b094a446..3ef295488c7 100644
--- a/engines/ultima/ultima1/logic/overworld_logic.h
+++ b/engines/ultima/ultima1/logic/overworld_logic.h
@@ -37,6 +37,11 @@ private:
 	 */
 	void enter();
 
+	/**
+	 * Pass a turn
+	 */
+	void pass();
+
 	/**
 	 * Check for movement
 	 */
@@ -117,6 +122,7 @@ private:
 	void reduceFood();
 
 public:
+	OverworldLogic();
 	~OverworldLogic() override {
 	}
 
diff --git a/engines/ultima/ultima1/logic/locations_logic.cpp b/engines/ultima/ultima1/logic/pillar_logic.cpp
similarity index 62%
rename from engines/ultima/ultima1/logic/locations_logic.cpp
rename to engines/ultima/ultima1/logic/pillar_logic.cpp
index f39855160e4..a3b2db53ae7 100644
--- a/engines/ultima/ultima1/logic/locations_logic.cpp
+++ b/engines/ultima/ultima1/logic/pillar_logic.cpp
@@ -20,7 +20,8 @@
  *
  */
 
-#include "ultima/ultima1/logic/locations_logic.h"
+#include "ultima/ultima1/logic/pillar_logic.h"
+#include "ultima/ultima1/data/map.h"
 #include "ultima/ultima1/metaengine.h"
 #include "ultima/ultima1/ultima1.h"
 
@@ -28,36 +29,19 @@ namespace Ultima {
 namespace Ultima1 {
 namespace Logic {
 
-void LocationsLogic::action(int action) {
-	// TODO
-}
-
-void LocationsLogic::keypress(Common::KeyCode keycode) {
-	action(KEYBIND_PASS);
-}
-
-/*-------------------------------------------------------------------*/
-
-void CityLogic::enter() {
-	_G(savegame)._locationPosition = Common::Point(19, 17);
-}
-
-/*-------------------------------------------------------------------*/
-
-void CastleLogic::enter() {
-	_G(savegame)._locationPosition = Common::Point(0, 9);
+PillarLogic::PillarLogic() {
 }
 
-/*-------------------------------------------------------------------*/
-
 void PillarLogic::enter() {
-	//_G(savegame)._locationPosition = Common::Point(0, 9);
+	// TODO
 }
 
-/*-------------------------------------------------------------------*/
-
-void DungeonLogic::enter() {
+void PillarLogic::action(int action) {
+	// TODO
+}
 
+void PillarLogic::keypress(Common::KeyCode keycode) {
+	action(KEYBIND_PASS);
 }
 
 } // namespace Logic
diff --git a/engines/ultima/ultima1/logic/pillar_logic.h b/engines/ultima/ultima1/logic/pillar_logic.h
new file mode 100644
index 00000000000..70ed88e31bd
--- /dev/null
+++ b/engines/ultima/ultima1/logic/pillar_logic.h
@@ -0,0 +1,47 @@
+
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef ULTIMA2_LOGIC_PILLAR_LOGIC_H
+#define ULTIMA2_LOGIC_PILLAR_LOGIC_H
+
+#include "ultima/ultima1/logic/logic.h"
+
+namespace Ultima {
+namespace Ultima1 {
+namespace Logic {
+
+class PillarLogic : public Logic {
+public:
+	PillarLogic();
+	~PillarLogic() override {
+	}
+
+	void enter() override;
+	void action(int action) override;
+	void keypress(Common::KeyCode keycode) override;
+};
+
+} // namespace Logic
+} // namespace Ultima1
+} // namespace Ultima
+
+#endif


Commit: 3d7f26a86ddf47590b33ff8e6376cf7b389bc76e
    https://github.com/scummvm/scummvm/commit/3d7f26a86ddf47590b33ff8e6376cf7b389bc76e
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:40:47+11:00

Commit Message:
ULTIMA: ULTIMA1: Move getTileAt into Map class

Changed paths:
    engines/ultima/ultima1/data/map.cpp
    engines/ultima/ultima1/data/map.h
    engines/ultima/ultima1/logic/overworld_logic.cpp
    engines/ultima/ultima1/logic/overworld_logic.h
    engines/ultima/ultima1/views/overworld_map.cpp


diff --git a/engines/ultima/ultima1/data/map.cpp b/engines/ultima/ultima1/data/map.cpp
index 86b374bbae9..3d99e7fd5c8 100644
--- a/engines/ultima/ultima1/data/map.cpp
+++ b/engines/ultima/ultima1/data/map.cpp
@@ -186,6 +186,15 @@ int Map::getMapTile(int x, int y) const {
 	return tile;
 }
 
+int Map::getTileAt(int x, int y, int creatureIndex) const {
+	int entityIndex = _G(savegame).getEntityAt(x, y, creatureIndex);
+
+	if (entityIndex >= 0)
+		return _G(savegame)._overworldEntities[entityIndex]._type;
+
+	return _G(map).getMapTile(x, y);
+}
+
 int Map::getContinentAt(int x, int y) const {
 	assert(_currentMap == MAP_OVERWORLD);
 	return (y > 77 ? 2 : 0) + (x > 83 ? 1 : 0);
diff --git a/engines/ultima/ultima1/data/map.h b/engines/ultima/ultima1/data/map.h
index bcc4df1c778..eba90e436cc 100644
--- a/engines/ultima/ultima1/data/map.h
+++ b/engines/ultima/ultima1/data/map.h
@@ -169,6 +169,11 @@ public:
 	 */
 	int getMapTile(int x, int y) const;
 
+	/**
+	 * Returns a tile or creature/entity at a given co-ordinate
+	 */
+	int getTileAt(int x, int y, int creatureIndex = 1) const;
+
 	/**
 	 * Returns the continent number at a given position
 	 */
diff --git a/engines/ultima/ultima1/logic/overworld_logic.cpp b/engines/ultima/ultima1/logic/overworld_logic.cpp
index 0bea6b54b3c..357efce09a2 100644
--- a/engines/ultima/ultima1/logic/overworld_logic.cpp
+++ b/engines/ultima/ultima1/logic/overworld_logic.cpp
@@ -99,7 +99,7 @@ void OverworldLogic::enter() {
 
 		for (int deltaY = -1; deltaY <= 1; ++deltaY) {
 			for (int deltaX = -1; deltaX <= 1; ++deltaX) {
-				int tile = getTileAt(_G(savegame)._overworldPos.x + deltaX, _G(savegame)._overworldPos.y + deltaY);
+				int tile = _G(map).getTileAt(_G(savegame)._overworldPos.x + deltaX, _G(savegame)._overworldPos.y + deltaY);
 				switch (tile) {
 				case Data::TILE_OCEAN:
 					_G(map)._waterCount++;
@@ -172,7 +172,7 @@ void OverworldLogic::move(Data::Direction dir) {
 bool OverworldLogic::moveCheck(Data::Direction dir) {
 	int xp = getViewportX(Data::MAP_VISIBLE_CENTER_X + DELTA_X[dir]);
 	int yp = getViewportY(Data::MAP_VISIBLE_CENTER_Y + DELTA_Y[dir]);
-	int tile = getTileAt(xp, yp);
+	int tile = _G(map).getTileAt(xp, yp);
 	int transport = _G(savegame)._transportType;
 
 	if (tile >= Data::TILE_FIRST_MONSTER && tile <= Data::TILE_LAST_MONSTER) {
@@ -241,15 +241,6 @@ int OverworldLogic::getViewportY(int yp) const {
 	return y;
 }
 
-int OverworldLogic::getTileAt(int x, int y, int creatureIndex) const {
-	int entityIndex = _G(savegame).getEntityAt(x, y, creatureIndex);
-
-	if (entityIndex >= 0)
-		return _G(savegame)._overworldEntities[entityIndex]._type;
-
-	return _G(map).getMapTile(x, y);
-}
-
 void OverworldLogic::impassable(int reason) {
 	writeString(Common::String::format("%s\n", IMPASSABLE_REASONS[reason]));
 	playFX(0);
@@ -415,7 +406,7 @@ void OverworldLogic::generateCreatures() {
 
 		x = getViewportX(xOff + Data::MAP_VISIBLE_CENTER_X);
 		y = getViewportY(yOff + Data::MAP_VISIBLE_CENTER_Y);
-		tileAtSpot = getTileAt(x, y);
+		tileAtSpot = _G(map).getTileAt(x, y);
 
 		rangeOk = _G(map).mapRangeCheckX(x) && _G(map).mapRangeCheckY(y);
 	} while (tileAtSpot != data && !rangeOk);
diff --git a/engines/ultima/ultima1/logic/overworld_logic.h b/engines/ultima/ultima1/logic/overworld_logic.h
index 3ef295488c7..047bbe08286 100644
--- a/engines/ultima/ultima1/logic/overworld_logic.h
+++ b/engines/ultima/ultima1/logic/overworld_logic.h
@@ -66,11 +66,6 @@ private:
 	 */
 	int getViewportY(int yp) const;
 
-	/**
-	 * Returns a tile or creature/entity at a given co-ordinate
-	 */
-	int getTileAt(int x, int y, int creatureIndex = 1) const;
-
 	/**
 	 * Impassable tile
 	 */
diff --git a/engines/ultima/ultima1/views/overworld_map.cpp b/engines/ultima/ultima1/views/overworld_map.cpp
index a26d949c56b..068d533edc5 100644
--- a/engines/ultima/ultima1/views/overworld_map.cpp
+++ b/engines/ultima/ultima1/views/overworld_map.cpp
@@ -106,7 +106,7 @@ void OverworldMap::prepareMapForDrawing() {
 			int x = mapLeft + ox;
 			int y = mapTop + oy;
 
-			map._mapTilesId[oy][ox] = map[y][x];
+			map._mapTilesId[oy][ox] = _G(map).getTileAt(x, y);
 		}
 	}
 


Commit: ee9775070364b505e8e6a5d10e998ab365b50cdd
    https://github.com/scummvm/scummvm/commit/ee9775070364b505e8e6a5d10e998ab365b50cdd
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:40:47+11:00

Commit Message:
ULTIMA: ULTIMA1: Fix off-by-one map drawing

Changed paths:
    engines/ultima/ultima1/data/savegame.cpp
    engines/ultima/ultima1/logic/overworld_logic.cpp


diff --git a/engines/ultima/ultima1/data/savegame.cpp b/engines/ultima/ultima1/data/savegame.cpp
index df24c61c391..b52c18a765a 100644
--- a/engines/ultima/ultima1/data/savegame.cpp
+++ b/engines/ultima/ultima1/data/savegame.cpp
@@ -118,11 +118,11 @@ void Savegame::synchronizeOriginal(Common::Serializer &s) {
 }
 
 int Savegame::mapTopLeftX() const {
-	return (_G(map)._currentMap == MAP_OVERWORLD) ? (_overworldPos.x - MAP_VISIBLE_CENTER_X) + 1 : 0;
+	return (_G(map)._currentMap == MAP_OVERWORLD) ? _overworldPos.x - MAP_VISIBLE_CENTER_X : 0;
 }
 
 int Savegame::mapTopLeftY() const {
-	return (_G(map)._currentMap == MAP_OVERWORLD) ? (_overworldPos.y - MAP_VISIBLE_CENTER_Y) + 1 : 0;
+	return (_G(map)._currentMap == MAP_OVERWORLD) ? _overworldPos.y - MAP_VISIBLE_CENTER_Y : 0;
 }
 
 int Savegame::getEntityAt(int x, int y, int startingIndex) const {
diff --git a/engines/ultima/ultima1/logic/overworld_logic.cpp b/engines/ultima/ultima1/logic/overworld_logic.cpp
index 357efce09a2..78091c1d136 100644
--- a/engines/ultima/ultima1/logic/overworld_logic.cpp
+++ b/engines/ultima/ultima1/logic/overworld_logic.cpp
@@ -170,8 +170,8 @@ void OverworldLogic::move(Data::Direction dir) {
 }
 
 bool OverworldLogic::moveCheck(Data::Direction dir) {
-	int xp = getViewportX(Data::MAP_VISIBLE_CENTER_X + DELTA_X[dir]);
-	int yp = getViewportY(Data::MAP_VISIBLE_CENTER_Y + DELTA_Y[dir]);
+	int xp = _G(savegame)._overworldPos.x + DELTA_X[dir];
+	int yp = _G(savegame)._overworldPos.y + DELTA_Y[dir];
 	int tile = _G(map).getTileAt(xp, yp);
 	int transport = _G(savegame)._transportType;
 


Commit: 25d7c31a022ffb244bfd0e21c62dbbd3d680f5c1
    https://github.com/scummvm/scummvm/commit/25d7c31a022ffb244bfd0e21c62dbbd3d680f5c1
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:40:47+11:00

Commit Message:
ULTIMA: ULTIMA1: Loading city sprites

Changed paths:
    engines/ultima/ultima1/data/map.cpp
    engines/ultima/ultima1/data/map.h
    engines/ultima/ultima1/data/tiles.cpp
    engines/ultima/ultima1/data/tiles.h
    engines/ultima/ultima1/ultima1.cpp
    engines/ultima/ultima1/ultima1.h
    engines/ultima/ultima1/views/overworld_map.cpp


diff --git a/engines/ultima/ultima1/data/map.cpp b/engines/ultima/ultima1/data/map.cpp
index 3d99e7fd5c8..275b2077a3c 100644
--- a/engines/ultima/ultima1/data/map.cpp
+++ b/engines/ultima/ultima1/data/map.cpp
@@ -120,6 +120,10 @@ void Map::init() {
 				*offset = tc.readByte();
 		}
 	}
+
+	// Load tiles
+	loadTiles("egatiles.bin", _overworldTiles, OVERWORLD_TILES_COUNT);
+	loadTiles("egatown.bin", _cityTiles, CITY_TILES_COUNT);
 }
 
 void Map::load(int mapNum) {
@@ -129,6 +133,7 @@ void Map::load(int mapNum) {
 		_mapWidth = OVERWORLD_WIDTH;
 		_mapHeight = OVERWORLD_HEIGHT;
 		_outsideMapTile = 0xff;
+		_tiles = _overworldTiles;
 
 		_mapRows.clear();
 		_mapRows.reserve(OVERWORLD_HEIGHT);
@@ -139,6 +144,7 @@ void Map::load(int mapNum) {
 		_mapWidth = CITY_WIDTH;
 		_mapHeight = CITY_HEIGHT;
 		_outsideMapTile = 0;
+		_tiles = _cityTiles;
 
 		_mapRows.clear();
 		_mapRows.reserve(CITY_HEIGHT + 1);		// One extra row for out-of-bounds y access
diff --git a/engines/ultima/ultima1/data/map.h b/engines/ultima/ultima1/data/map.h
index eba90e436cc..39d84f54e2e 100644
--- a/engines/ultima/ultima1/data/map.h
+++ b/engines/ultima/ultima1/data/map.h
@@ -22,8 +22,10 @@
 #ifndef ULTIMA1_DATA_MAP_H
 #define ULTIMA1_DATA_MAP_H
 
-#include "common/archive.h"
+#include "common/array.h"
 #include "common/rect.h"
+#include "graphics/managed_surface.h"
+#include "ultima/ultima1/data/tiles.h"
 
 namespace Ultima {
 namespace Ultima1 {
@@ -104,6 +106,8 @@ private:
 	friend class Row;
 
 	Common::Array<Row> _mapRows;			// Used for array operator getting map contents
+	Graphics::ManagedSurface _overworldTiles[OVERWORLD_TILES_COUNT];
+	Graphics::ManagedSurface _cityTiles[CITY_TILES_COUNT];
 
 public:
 	int _currentMap = -1;
@@ -118,6 +122,7 @@ public:
 	int _mapType = MAPTYPE_OVERWORLD;
 	int _tavernCtr = 0;
 	int _castleNum = 0, _castleNum2 = 0;
+	Graphics::ManagedSurface *_tiles = nullptr;
 
 public:
 	/**
@@ -145,6 +150,13 @@ public:
 		return _mapHeight;
 	}
 
+	/**
+	 * Get the tiles
+	 */
+	const Graphics::ManagedSurface *tiles() const {
+		return _tiles;
+	}
+
 	/**
 	 * Access tiles of the current map
 	 */
diff --git a/engines/ultima/ultima1/data/tiles.cpp b/engines/ultima/ultima1/data/tiles.cpp
index 67172fab4b1..a31236f1bd8 100644
--- a/engines/ultima/ultima1/data/tiles.cpp
+++ b/engines/ultima/ultima1/data/tiles.cpp
@@ -29,14 +29,14 @@ namespace Data {
 constexpr int BYTES_PER_ROW = 8;	// 4 planes x 2 bytes/plane = 16 pixels
 constexpr int BYTES_PER_TILE = BYTES_PER_ROW * TILE_HEIGHT;
 
-void loadTiles(Graphics::ManagedSurface tiles[TILE_COUNT]) {
+void loadTiles(const char *filename, Graphics::ManagedSurface *tiles, int count) {
 	Common::File f;
 	if (!f.open("EgaTiles.Bin"))
 		error("Could not open EgaTiles.Bin");
 
 	byte data[BYTES_PER_TILE];
 
-	for (int tileNum = 0; tileNum < TILE_COUNT; ++tileNum) {
+	for (int tileNum = 0; tileNum < count; ++tileNum) {
 		if (f.read(data, BYTES_PER_TILE) != (uint32)BYTES_PER_TILE)
 			error("Unexpected end of EgaTiles.Bin");
 
diff --git a/engines/ultima/ultima1/data/tiles.h b/engines/ultima/ultima1/data/tiles.h
index 9dc1c5f369d..ea0058e04e3 100644
--- a/engines/ultima/ultima1/data/tiles.h
+++ b/engines/ultima/ultima1/data/tiles.h
@@ -28,11 +28,12 @@ namespace Ultima {
 namespace Ultima1 {
 namespace Data {
 
-constexpr int TILE_COUNT = 52;
+constexpr int OVERWORLD_TILES_COUNT = 52;
+constexpr int CITY_TILES_COUNT = 51;
 constexpr int TILE_WIDTH = 16;
 constexpr int TILE_HEIGHT = 16;
 
-enum TileId {
+enum OverworldTileId {
 	TILE_OCEAN = 0,
 	TILE_GRASS = 1,
 	TILE_WOODS = 2,
@@ -61,7 +62,7 @@ enum TileId {
  * row-interleaved: each 16-pixel row is 4 planes x 2 bytes) into a
  * caller-supplied array of TILE_COUNT surfaces
  */
-void loadTiles(Graphics::ManagedSurface tiles[TILE_COUNT]);
+extern void loadTiles(const char *filename, Graphics::ManagedSurface *tiles, int count);
 
 } // namespace Data
 } // namespace Ultima1
diff --git a/engines/ultima/ultima1/ultima1.cpp b/engines/ultima/ultima1/ultima1.cpp
index a4b3b225a76..e90a56d8229 100644
--- a/engines/ultima/ultima1/ultima1.cpp
+++ b/engines/ultima/ultima1/ultima1.cpp
@@ -28,7 +28,6 @@
 #include "graphics/paletteman.h"
 #include "ultima/ultima1/ultima1.h"
 #include "ultima/ultima1/console.h"
-#include "ultima/ultima1/data/tiles.h"
 #include "ultima/ultima1/views/views.h"
 #include "ultima/ultima1/metaengine.h"
 
@@ -65,7 +64,6 @@ Common::Error Ultima1Engine::run() {
 	setDebugger(new Console());
 
 	// Load needed data
-	Data::loadTiles(_tiles);
 	_map.init();
 
 	Views::Views views;
diff --git a/engines/ultima/ultima1/ultima1.h b/engines/ultima/ultima1/ultima1.h
index 9e55d08d850..bf83843a954 100644
--- a/engines/ultima/ultima1/ultima1.h
+++ b/engines/ultima/ultima1/ultima1.h
@@ -64,7 +64,6 @@ protected:
 public:
 	Data::Map _map;
 	Data::Savegame _savegame;
-	Graphics::ManagedSurface _tiles[Data::TILE_COUNT];
 	Logic::Logic *_logic = nullptr;
 	int _overworldEntityCount = 0;
 	int _creaturesCount = 0;
diff --git a/engines/ultima/ultima1/views/overworld_map.cpp b/engines/ultima/ultima1/views/overworld_map.cpp
index 068d533edc5..8b7e3cbd8c0 100644
--- a/engines/ultima/ultima1/views/overworld_map.cpp
+++ b/engines/ultima/ultima1/views/overworld_map.cpp
@@ -42,7 +42,8 @@ void OverworldMap::timeout() {
 }
 
 void OverworldMap::animateWater() {
-	Graphics::ManagedSurface &tile = g_engine->_tiles[Data::TILE_OCEAN];
+	const Graphics::ManagedSurface *tiles = _G(map).tiles();
+	const Graphics::ManagedSurface &tile = tiles[Data::TILE_OCEAN];
 	assert(tile.w == Data::TILE_WIDTH && tile.h == Data::TILE_HEIGHT);
 
 	byte lastRow[Data::TILE_WIDTH];
@@ -78,6 +79,7 @@ int OverworldMap::animatedTileId(byte tileId) const {
 
 void OverworldMap::draw() {
 	auto &map = g_engine->_map;
+	const Graphics::ManagedSurface *tiles = map.tiles();
 	auto s = getSurface();
 
 	prepareMapForDrawing();
@@ -87,7 +89,9 @@ void OverworldMap::draw() {
 		for (int ox = 0; ox < Data::MAP_VISIBLE_WIDTH; ox++) {
 			int tileId = animatedTileId(map._mapTilesId[oy][ox]);
 			if (tileId != -1) {
-				const Graphics::ManagedSurface &tileImg = g_engine->_tiles[tileId];
+				const Graphics::ManagedSurface &tileImg = tiles[
+					(_G(map)._currentMap != Data::MAP_OVERWORLD && tileId >= 50) ? 1 : tileId
+				];
 				s.blitFrom(tileImg, Common::Point(ox * Data::TILE_WIDTH, oy * Data::TILE_HEIGHT));
 			}
 		}


Commit: f6611a4e67eea6bc651e900cf9d15a412d68dc32
    https://github.com/scummvm/scummvm/commit/f6611a4e67eea6bc651e900cf9d15a412d68dc32
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:40:47+11:00

Commit Message:
ULTIMA: ULTIMA1: In progress adding Location view

Changed paths:
  A engines/ultima/ultima1/views/location.cpp
  A engines/ultima/ultima1/views/location.h
  A engines/ultima/ultima1/views/location_map.cpp
  A engines/ultima/ultima1/views/location_map.h
    engines/ultima/module.mk
    engines/ultima/ultima1/data/map.cpp
    engines/ultima/ultima1/logic/logic.cpp
    engines/ultima/ultima1/views/commands.cpp
    engines/ultima/ultima1/views/commands.h
    engines/ultima/ultima1/views/overworld.cpp
    engines/ultima/ultima1/views/views.h


diff --git a/engines/ultima/module.mk b/engines/ultima/module.mk
index b598c65234a..a937c0d418c 100644
--- a/engines/ultima/module.mk
+++ b/engines/ultima/module.mk
@@ -70,6 +70,8 @@ MODULE_OBJS += \
 	ultima1/views/create_character.o \
 	ultima1/views/dead.o \
 	ultima1/views/dialog.o \
+	ultima1/views/location.o \
+	ultima1/views/location_map.o \
 	ultima1/views/main_menu.o \
 	ultima1/views/overworld.o \
 	ultima1/views/overworld_map.o \
diff --git a/engines/ultima/ultima1/data/map.cpp b/engines/ultima/ultima1/data/map.cpp
index 275b2077a3c..d6fb8876a36 100644
--- a/engines/ultima/ultima1/data/map.cpp
+++ b/engines/ultima/ultima1/data/map.cpp
@@ -162,16 +162,17 @@ void Map::load(int mapNum) {
 	if (mapNum >= 49) {
 		_G(logic) = new Logic::DungeonLogic();
 		g_engine->replaceView("Dungeon");
+	} else if (mapNum == MAP_OVERWORLD) {
+		_G(logic) = new Logic::OverworldLogic();
+		g_engine->replaceView("Overworld");
 	} else {
-		if (mapNum == MAP_OVERWORLD)
-			_G(logic) = new Logic::OverworldLogic();
-		else if (mapNum < 33)
+		if (mapNum < 33)
 			_G(logic) = new Logic::CityLogic();
 		else if (mapNum < 41)
 			_G(logic) = new Logic::CastleLogic();
 		else
 			_G(logic) = new Logic::PillarLogic();
-		g_engine->replaceView("Overworld");
+		g_engine->replaceView("Location");
 	}
 }
 
diff --git a/engines/ultima/ultima1/logic/logic.cpp b/engines/ultima/ultima1/logic/logic.cpp
index 61ffb835ed6..6bd28f84178 100644
--- a/engines/ultima/ultima1/logic/logic.cpp
+++ b/engines/ultima/ultima1/logic/logic.cpp
@@ -30,19 +30,19 @@ namespace Logic {
 using namespace Shared::Messages;
 
 void Logic::writeString(const Common::String &msg) {
-	g_engine->send("Commands", GameMessage("TEXT", msg));
+	g_engine->focusedView()->send(GameMessage("TEXT", msg));
 }
 
 void Logic::prompt() {
-	g_engine->send("Commands", GameMessage("PROMPT"));
+	g_engine->focusedView()->send(GameMessage("PROMPT"));
 }
 
 void Logic::redrawMap() {
-	g_engine->send("Overworld", Shared::Messages::GameMessage("UPDATE", "MAP"));
+	g_engine->focusedView()->send(GameMessage("UPDATE", "MAP"));
 }
 
 void Logic::redrawStats() {
-	g_engine->send("Overworld", Shared::Messages::GameMessage("UPDATE", "STATS"));
+	g_engine->focusedView()->send(GameMessage("UPDATE", "STATS"));
 }
 
 void Logic::playFX(int num) {
diff --git a/engines/ultima/ultima1/views/commands.cpp b/engines/ultima/ultima1/views/commands.cpp
index 1df7e3e8c7a..218d6e2a25a 100644
--- a/engines/ultima/ultima1/views/commands.cpp
+++ b/engines/ultima/ultima1/views/commands.cpp
@@ -26,7 +26,7 @@ namespace Ultima {
 namespace Ultima1 {
 namespace Views {
 
-Commands::Commands(UIElement *parent) : Shared::UIElement("Commands", parent), _textCursor("CommandsCursor", this) {
+Commands::Commands(const Common::String &name, UIElement *parent) : Shared::UIElement(name, parent), _textCursor(name + "Cursor", this) {
 }
 
 bool Commands::msgFocus(const FocusMessage &msg) {
diff --git a/engines/ultima/ultima1/views/commands.h b/engines/ultima/ultima1/views/commands.h
index 96c1a7324cb..d3fea4ee963 100644
--- a/engines/ultima/ultima1/views/commands.h
+++ b/engines/ultima/ultima1/views/commands.h
@@ -37,7 +37,7 @@ private:
 	Gfx::TextCursor _textCursor;
 
 public:
-	Commands(UIElement *parent);
+	Commands(const Common::String &name, UIElement *parent);
 	~Commands() override {}
 
 	bool msgFocus(const FocusMessage &msg) override;
diff --git a/engines/ultima/ultima1/views/location.cpp b/engines/ultima/ultima1/views/location.cpp
new file mode 100644
index 00000000000..bb09961950f
--- /dev/null
+++ b/engines/ultima/ultima1/views/location.cpp
@@ -0,0 +1,69 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "ultima/ultima1/views/location.h"
+#include "ultima/ultima1/data/map.h"
+#include "ultima/ultima1/data/tiles.h"
+#include "ultima/ultima1/metaengine.h"
+#include "ultima/shared/gfx/rect.h"
+
+namespace Ultima {
+namespace Ultima1 {
+namespace Views {
+
+Location::Location() : Dialog("Location"), _map(this), _commands("LocationCommands", this), _stats(this) {
+	_map.setBounds(TextRect(1, 1, 38, 19));
+	_commands.setBounds(TextRect(0, 20, 29, 24));
+	_stats.setBounds(TextRect(31, 21, 39, 24));
+}
+
+bool Location::msgFocus(const FocusMessage &msg) {
+	MetaEngine::setKeybindingMode(KBMODE_OVERWORLD);
+	return Dialog::msgFocus(msg);
+}
+
+bool Location::msgUnfocus(const UnfocusMessage &msg) {
+	MetaEngine::setKeybindingMode(KBMODE_MINIMAL);
+	return Dialog::msgUnfocus(msg);
+}
+
+void Location::draw() {
+	auto s = getSurface();
+	s.clear();
+	drawFrame();
+	drawGameDividers();
+}
+
+bool Location::msgGame(const GameMessage &msg) {
+	if (msg._name == "UPDATE") {
+		if (msg._stringValue == "MAP")
+			_map.redraw();
+		if (msg._stringValue == "STATS")
+			_stats.redraw();
+		return true;
+	}
+
+	return Dialog::msgGame(msg);
+}
+
+} // namespace Views
+} // namespace Ultima1
+} // namespace Ultima
diff --git a/engines/ultima/ultima1/views/location.h b/engines/ultima/ultima1/views/location.h
new file mode 100644
index 00000000000..40e03b173f1
--- /dev/null
+++ b/engines/ultima/ultima1/views/location.h
@@ -0,0 +1,59 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef ULTIMA1_VIEWS_LOCATION_H
+#define ULTIMA1_VIEWS_LOCATION_H
+
+#include "ultima/ultima1/views/dialog.h"
+#include "ultima/ultima1/views/location_map.h"
+#include "ultima/ultima1/views/commands.h"
+#include "ultima/ultima1/views/stats.h"
+
+namespace Ultima {
+namespace Ultima1 {
+namespace Views {
+
+/**
+ * The main in-game screen. Draws the outer frame around the map
+ * viewport, and hosts the map, stats, and command/message log
+ * sub-views. For now, the command/message log area is just left blank.
+ */
+class Location : public Dialog {
+private:
+	LocationMap _map;
+	Commands _commands;
+	Stats _stats;
+
+public:
+	Location();
+	~Location() override {}
+
+	bool msgFocus(const FocusMessage &msg) override;
+	bool msgUnfocus(const UnfocusMessage &msg) override;
+	bool msgGame(const GameMessage &msg) override;
+	void draw() override;
+};
+
+} // namespace Views
+} // namespace Ultima1
+} // namespace Ultima
+
+#endif
diff --git a/engines/ultima/ultima1/views/location_map.cpp b/engines/ultima/ultima1/views/location_map.cpp
new file mode 100644
index 00000000000..9dadf614ee0
--- /dev/null
+++ b/engines/ultima/ultima1/views/location_map.cpp
@@ -0,0 +1,108 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "ultima/ultima1/views/location_map.h"
+#include "ultima/ultima1/ultima1.h"
+
+namespace Ultima {
+namespace Ultima1 {
+namespace Views {
+
+bool LocationMap::msgFocus(const FocusMessage &msg) {
+	_G(map).clearTiles();
+	delayFrames(1);
+	return UIElement::msgFocus(msg);
+}
+
+void LocationMap::timeout() {
+	redraw();
+
+	// Wait briefly before the next animation tick
+	delayFrames(1);
+}
+
+int LocationMap::animatedTileId(byte tileId) const {
+	if (tileId == Data::TILE_CASTLE1) {
+		// Only redrawn on 2 of every 6 ticks; the other 4 ticks leave
+		// whichever frame was last drawn untouched
+		int offset = 2;
+		if ((_animIndex % 6) == 0)
+			offset = 0;
+		else if ((_animIndex % 3) == 0)
+			offset = 1;
+
+		return (offset == 2) ? -1 : Data::TILE_CASTLE1 + offset;
+	}
+
+	if (tileId == Data::TILE_CITY1) {
+		// Redrawn every tick, biased 3:1 toward the waving-flag frame
+		return Data::TILE_CITY1 + (((_animIndex % 4) == 0) ? 0 : 1);
+	}
+
+	return tileId;
+}
+
+void LocationMap::draw() {
+	auto &map = g_engine->_map;
+	const Graphics::ManagedSurface *tiles = map.tiles();
+	auto s = getSurface();
+
+	prepareMapForDrawing();
+
+	// Draw the visible map contents
+	for (int oy = 0; oy < Data::MAP_VISIBLE_HEIGHT; oy++) {
+		for (int ox = 0; ox < Data::MAP_VISIBLE_WIDTH; ox++) {
+			int tileId = animatedTileId(map._mapTilesId[oy][ox]);
+			if (tileId != -1) {
+				const Graphics::ManagedSurface &tileImg = tiles[
+					(_G(map)._currentMap != Data::MAP_OVERWORLD && tileId >= 50) ? 1 : tileId
+				];
+				s.blitFrom(tileImg, Common::Point(ox * Data::TILE_WIDTH, oy * Data::TILE_HEIGHT));
+			}
+		}
+	}
+}
+
+void LocationMap::prepareMapForDrawing() {
+	auto &map = g_engine->_map;
+
+	// Get the map tiles. Unlike in the overworld, where the visible map is centered around the player,
+	// location maps are always on-screen in their entirety
+	for (int oy = 0; oy < Data::MAP_VISIBLE_HEIGHT; oy++) {
+		for (int ox = 0; ox < Data::MAP_VISIBLE_WIDTH; ox++) {
+			map._mapTilesId[oy][ox] = _G(map).getTileAt(ox, oy);
+		}
+	}
+
+	// Player is at center of the viewport. Save tiles around the player
+	map._tilePlayerCenter = map._mapTilesId[Data::MAP_VISIBLE_CENTER_Y][Data::MAP_VISIBLE_CENTER_X];
+	map._tilePlayerUp = map._mapTilesId[Data::MAP_VISIBLE_CENTER_Y - 1][Data::MAP_VISIBLE_CENTER_X];
+	map._tilePlayerDown = map._mapTilesId[Data::MAP_VISIBLE_CENTER_Y + 1][Data::MAP_VISIBLE_CENTER_X];
+	map._tilePlayerLeft = map._mapTilesId[Data::MAP_VISIBLE_CENTER_Y][Data::MAP_VISIBLE_CENTER_X - 1];
+	map._tilePlayerRight = map._mapTilesId[Data::MAP_VISIBLE_CENTER_Y][Data::MAP_VISIBLE_CENTER_X + 1];
+
+	// Place the player tile at the center
+	map._mapTilesId[Data::MAP_VISIBLE_CENTER_Y][Data::MAP_VISIBLE_CENTER_X] = map._playerTileId;
+}
+
+} // namespace Views
+} // namespace Ultima1
+} // namespace Ultima
diff --git a/engines/ultima/ultima1/views/location_map.h b/engines/ultima/ultima1/views/location_map.h
new file mode 100644
index 00000000000..9a2c2ec02fd
--- /dev/null
+++ b/engines/ultima/ultima1/views/location_map.h
@@ -0,0 +1,60 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef ULTIMA2_VIEWS_LOCATION_MAP_H
+#define ULTIMA2_VIEWS_LOCATION_MAP_H
+
+#include "ultima/shared/engine/events.h"
+
+namespace Ultima {
+namespace Ultima1 {
+namespace Views {
+
+using namespace Shared::Messages;
+
+class LocationMap : public Shared::UIElement {
+private:
+	int _animIndex = 0;
+
+	void prepareMapForDrawing();
+
+	/**
+	 * Returns the tile to draw for a given raw map tile, substituting
+	 * in the appropriate animation frame for the castle and city flags.
+	 * Returns -1 if the tile shouldn't be redrawn this tick (the castle
+	 * flag is only redrawn on 2 of every 6 ticks)
+	 */
+	int animatedTileId(byte tileId) const;
+
+public:
+	LocationMap(Shared::UIElement *parent) : Shared::UIElement("LocationMap", parent) {}
+	~LocationMap() override {}
+
+	bool msgFocus(const FocusMessage &msg) override;
+	void draw() override;
+	void timeout() override;
+};
+
+} // namespace Views
+} // namespace Ultima1
+} // namespace Ultima
+
+#endif
diff --git a/engines/ultima/ultima1/views/overworld.cpp b/engines/ultima/ultima1/views/overworld.cpp
index 092b4655aa9..4f6edaffa22 100644
--- a/engines/ultima/ultima1/views/overworld.cpp
+++ b/engines/ultima/ultima1/views/overworld.cpp
@@ -29,7 +29,7 @@ namespace Ultima {
 namespace Ultima1 {
 namespace Views {
 
-Overworld::Overworld() : Dialog("Overworld"), _map(this), _commands(this), _stats(this) {
+Overworld::Overworld() : Dialog("Overworld"), _map(this), _commands("OverworldCommands", this), _stats(this) {
 	_map.setBounds(TextRect(1, 1, 38, 19));
 	_commands.setBounds(TextRect(0, 20, 29, 24));
 	_stats.setBounds(TextRect(31, 21, 39, 24));
@@ -61,7 +61,7 @@ bool Overworld::msgGame(const GameMessage &msg) {
 		return true;
 	}
 
-	return false;
+	return Dialog::msgGame(msg);
 }
 
 } // namespace Views
diff --git a/engines/ultima/ultima1/views/views.h b/engines/ultima/ultima1/views/views.h
index f7d2a62cde4..57b96e58f47 100644
--- a/engines/ultima/ultima1/views/views.h
+++ b/engines/ultima/ultima1/views/views.h
@@ -24,6 +24,7 @@
 
 #include "ultima/shared/engine/events.h"
 #include "ultima/ultima1/views/create_character.h"
+#include "ultima/ultima1/views/location.h"
 #include "ultima/ultima1/views/main_menu.h"
 #include "ultima/ultima1/views/overworld.h"
 #include "ultima/ultima1/views/startup.h"
@@ -35,6 +36,7 @@ namespace Views {
 
 struct Views : public Shared::Views {
 	CreateCharacter _createCharacter;
+	Location _location;
 	MainMenu _mainMenu;
 	Overworld _overworld;
 	Startup _startup;


Commit: 53a9a701ba43e8812baf30f2fa803d934f552614
    https://github.com/scummvm/scummvm/commit/53a9a701ba43e8812baf30f2fa803d934f552614
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:40:47+11:00

Commit Message:
ULTIMA: ULTIMA1: Working to make common shared commands/stats area

Changed paths:
  A engines/ultima/shared/engine/array.h
  A engines/ultima/ultima1/views/game.cpp
  A engines/ultima/ultima1/views/game.h
  R engines/ultima/ultima1/views/location.cpp
  R engines/ultima/ultima1/views/location.h
  R engines/ultima/ultima1/views/overworld.cpp
  R engines/ultima/ultima1/views/overworld.h
    engines/ultima/module.mk
    engines/ultima/shared/engine/events.h
    engines/ultima/ultima1/data/map.cpp
    engines/ultima/ultima1/views/commands.cpp
    engines/ultima/ultima1/views/commands.h
    engines/ultima/ultima1/views/dialog.cpp
    engines/ultima/ultima1/views/views.h


diff --git a/engines/ultima/module.mk b/engines/ultima/module.mk
index a937c0d418c..b9cf65b84d2 100644
--- a/engines/ultima/module.mk
+++ b/engines/ultima/module.mk
@@ -70,7 +70,7 @@ MODULE_OBJS += \
 	ultima1/views/create_character.o \
 	ultima1/views/dead.o \
 	ultima1/views/dialog.o \
-	ultima1/views/location.o \
+	ultima1/views/game.o \
 	ultima1/views/location_map.o \
 	ultima1/views/main_menu.o \
 	ultima1/views/overworld.o \
diff --git a/engines/ultima/ultima1/views/overworld.h b/engines/ultima/shared/engine/array.h
similarity index 52%
rename from engines/ultima/ultima1/views/overworld.h
rename to engines/ultima/shared/engine/array.h
index def48f8d5cf..1310631cbf2 100644
--- a/engines/ultima/ultima1/views/overworld.h
+++ b/engines/ultima/shared/engine/array.h
@@ -19,41 +19,32 @@
  *
  */
 
-#ifndef ULTIMA1_VIEWS_OVERWORLD_H
-#define ULTIMA1_VIEWS_OVERWORLD_H
+#ifndef ULTIMA_SHARED_ENGINE_ARRAY_H
+#define ULTIMA_SHARED_ENGINE_ARRAY_H
 
-#include "ultima/ultima1/views/dialog.h"
-#include "ultima/ultima1/views/overworld_map.h"
-#include "ultima/ultima1/views/commands.h"
-#include "ultima/ultima1/views/stats.h"
+#include "common/array.h"
 
 namespace Ultima {
-namespace Ultima1 {
-namespace Views {
-
-/**
- * The main in-game screen. Draws the outer frame around the map
- * viewport, and hosts the map, stats, and command/message log
- * sub-views. For now, the command/message log area is just left blank.
- */
-class Overworld : public Dialog {
-private:
-	OverworldMap _map;
-	Commands _commands;
-	Stats _stats;
+namespace Shared {
 
+template<class T>
+class Array : public Common::Array<T> {
 public:
-	Overworld();
-	~Overworld() override {}
-
-	bool msgFocus(const FocusMessage &msg) override;
-	bool msgUnfocus(const UnfocusMessage &msg) override;
-	bool msgGame(const GameMessage &msg) override;
-	void draw() override;
+	int indexOf(const T elem) const {
+		for (uint i = 0; i < this->size(); ++i) {
+			if (this->operator[](i) == elem)
+				return i;
+		}
+		return -1;
+	}
+	void remove(T elem) {
+		int idx = this->indexOf(elem);
+		if (idx != -1)
+			this->remove_at(idx);
+	}
 };
 
-} // namespace Views
-} // namespace Ultima1
+} // namespace Shared
 } // namespace Ultima
 
 #endif
diff --git a/engines/ultima/shared/engine/events.h b/engines/ultima/shared/engine/events.h
index 31ca2eba92c..ec4e02f15d7 100644
--- a/engines/ultima/shared/engine/events.h
+++ b/engines/ultima/shared/engine/events.h
@@ -26,6 +26,7 @@
 #include "common/random.h"
 #include "common/stack.h"
 #include "graphics/screen.h"
+#include "ultima/shared/engine/array.h"
 #include "ultima/shared/engine/messages.h"
 #include "ultima/shared/gfx/gfx_surface.h"
 
@@ -87,7 +88,7 @@ private:
 	int _timeoutCtr = 0;
 protected:
 	UIElement *_parent;
-	Common::Array<UIElement *> _children;
+	Array<UIElement *> _children;
 	Common::Rect _innerBounds;
 	Bounds _bounds;
 	bool _needsRedraw = true;
diff --git a/engines/ultima/ultima1/data/map.cpp b/engines/ultima/ultima1/data/map.cpp
index d6fb8876a36..1e2e750c7f0 100644
--- a/engines/ultima/ultima1/data/map.cpp
+++ b/engines/ultima/ultima1/data/map.cpp
@@ -159,20 +159,23 @@ void Map::load(int mapNum) {
 
 	// Set up the correct logic to use
 	delete _G(logic);
+
+	g_engine->replaceView("Game");
 	if (mapNum >= 49) {
 		_G(logic) = new Logic::DungeonLogic();
-		g_engine->replaceView("Dungeon");
+		g_engine->send("Game", Shared::Messages::GameMessage("MAP", "DUNGEON"));
 	} else if (mapNum == MAP_OVERWORLD) {
 		_G(logic) = new Logic::OverworldLogic();
-		g_engine->replaceView("Overworld");
+		g_engine->send("Game", Shared::Messages::GameMessage("MAP", "OVERWORLD"));
+	} else  if (mapNum < 33) {
+		_G(logic) = new Logic::CityLogic();
+		g_engine->send("Game", Shared::Messages::GameMessage("MAP", "CITY"));
+	} else if (mapNum < 41) {
+		_G(logic) = new Logic::CastleLogic();
+		g_engine->send("Game", Shared::Messages::GameMessage("MAP", "CASTLE"));
 	} else {
-		if (mapNum < 33)
-			_G(logic) = new Logic::CityLogic();
-		else if (mapNum < 41)
-			_G(logic) = new Logic::CastleLogic();
-		else
-			_G(logic) = new Logic::PillarLogic();
-		g_engine->replaceView("Location");
+		_G(logic) = new Logic::PillarLogic();
+		g_engine->send("Game", Shared::Messages::GameMessage("MAP", "PILLAR"));
 	}
 }
 
diff --git a/engines/ultima/ultima1/views/commands.cpp b/engines/ultima/ultima1/views/commands.cpp
index 218d6e2a25a..1df7e3e8c7a 100644
--- a/engines/ultima/ultima1/views/commands.cpp
+++ b/engines/ultima/ultima1/views/commands.cpp
@@ -26,7 +26,7 @@ namespace Ultima {
 namespace Ultima1 {
 namespace Views {
 
-Commands::Commands(const Common::String &name, UIElement *parent) : Shared::UIElement(name, parent), _textCursor(name + "Cursor", this) {
+Commands::Commands(UIElement *parent) : Shared::UIElement("Commands", parent), _textCursor("CommandsCursor", this) {
 }
 
 bool Commands::msgFocus(const FocusMessage &msg) {
diff --git a/engines/ultima/ultima1/views/commands.h b/engines/ultima/ultima1/views/commands.h
index d3fea4ee963..96c1a7324cb 100644
--- a/engines/ultima/ultima1/views/commands.h
+++ b/engines/ultima/ultima1/views/commands.h
@@ -37,7 +37,7 @@ private:
 	Gfx::TextCursor _textCursor;
 
 public:
-	Commands(const Common::String &name, UIElement *parent);
+	Commands(UIElement *parent);
 	~Commands() override {}
 
 	bool msgFocus(const FocusMessage &msg) override;
diff --git a/engines/ultima/ultima1/views/dialog.cpp b/engines/ultima/ultima1/views/dialog.cpp
index bdd0d070b9e..c6faa1ef1e9 100644
--- a/engines/ultima/ultima1/views/dialog.cpp
+++ b/engines/ultima/ultima1/views/dialog.cpp
@@ -65,24 +65,6 @@ void Dialog::drawFrame() {
 		s.drawLine(NOTCH_POINTS[i].x, NOTCH_POINTS[i].y, NOTCH_POINTS[i].x, NOTCH_POINTS[i].y, COLOR_NOTCH);
 }
 
-void Dialog::drawGameDividers() {
-	auto s = getSurface();
-
-	// Erase the frame's bottom section
-	s.fillRect(Common::Rect(0, 153, 320, 200), 0);
-
-	// Horizontal divider separating the map viewport (above) from the command/message log and stats panel
-	s.fillRect(Common::Rect(0, 153, 320, 159), COLOR_BORDER);
-	s.drawLine(7, 152, 312, 152, COLOR_EDGE);
-	s.drawLine(0, 159, 240, 159, COLOR_EDGE);
-	s.drawLine(247, 159, 319, 159, COLOR_EDGE);
-
-	// Vertical divider between the command/message log (left) and the stats panel (right)
-	s.fillRect(Common::Rect(241, 153, 247, 200), COLOR_BORDER);
-	s.drawLine(240, 159, 240, 199, COLOR_EDGE);
-	s.drawLine(247, 159, 247, 199, COLOR_EDGE);
-}
-
 } // namespace Views
 } // namespace Ultima1
 } // namespace Ultima
diff --git a/engines/ultima/ultima1/views/game.cpp b/engines/ultima/ultima1/views/game.cpp
new file mode 100644
index 00000000000..2fc74aaf09c
--- /dev/null
+++ b/engines/ultima/ultima1/views/game.cpp
@@ -0,0 +1,110 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "ultima/ultima1/views/game.h"
+#include "ultima/ultima1/views/overworld_map.h"
+#include "ultima/ultima1/views/location_map.h"
+#include "ultima/ultima1/data/map.h"
+#include "ultima/ultima1/data/tiles.h"
+#include "ultima/ultima1/metaengine.h"
+#include "ultima/shared/gfx/rect.h"
+
+namespace Ultima {
+namespace Ultima1 {
+namespace Views {
+
+// Colors used
+constexpr int COLOR_BORDER = 1;  // blue - thick outer band
+constexpr int COLOR_EDGE = 15;   // white - thin inner highlight line
+
+Game::Game() : Dialog("Game"), _commands(this), _stats(this) {
+	_commands.setBounds(TextRect(0, 20, 29, 24));
+	_stats.setBounds(TextRect(31, 21, 39, 24));
+}
+
+Game::~Game() {
+	delete _map;
+}
+
+bool Game::msgFocus(const FocusMessage &msg) {
+	MetaEngine::setKeybindingMode(KBMODE_OVERWORLD);
+	return View::msgFocus(msg);
+}
+
+bool Game::msgUnfocus(const UnfocusMessage &msg) {
+	MetaEngine::setKeybindingMode(KBMODE_MINIMAL);
+	return View::msgUnfocus(msg);
+}
+
+void Game::draw() {
+	auto s = getSurface();
+	s.clear();
+	drawFrame();
+
+	// Erase the frame's bottom section
+	s.fillRect(Common::Rect(0, 153, 320, 200), 0);
+
+	// Horizontal divider separating the map viewport (above) from the command/message log and stats panel
+	s.fillRect(Common::Rect(0, 153, 320, 159), COLOR_BORDER);
+	s.drawLine(7, 152, 312, 152, COLOR_EDGE);
+	s.drawLine(0, 159, 240, 159, COLOR_EDGE);
+	s.drawLine(247, 159, 319, 159, COLOR_EDGE);
+
+	// Vertical divider between the command/message log (left) and the stats panel (right)
+	s.fillRect(Common::Rect(241, 153, 247, 200), COLOR_BORDER);
+	s.drawLine(240, 159, 240, 199, COLOR_EDGE);
+	s.drawLine(247, 159, 247, 199, COLOR_EDGE);
+}
+
+bool Game::msgGame(const GameMessage &msg) {
+	if (msg._name == "MAP") {
+		if (_map) {
+			// Remove current map view
+			_children.remove(_map);
+			delete _map;
+			_map = nullptr;
+		}
+
+		if (msg._stringValue == "OVERWORLD")
+			_map = new OverworldMap(this);
+		else if (msg._stringValue == "CITY" || msg._stringValue == "CASTLE" || msg._stringValue == "PILLAR")
+			_map = new LocationMap(this);
+		else
+			error("Invalid map type - %s", msg._stringValue.c_str());
+
+		// Set the bounds
+		_map->setBounds(TextRect(1, 1, 38, 19));
+		return true;
+
+	} else if (msg._name == "UPDATE") {
+		if (msg._stringValue == "MAP")
+			_map->redraw();
+		if (msg._stringValue == "STATS")
+			_stats.redraw();
+		return true;
+	}
+
+	return Dialog::msgGame(msg);
+}
+
+} // namespace Views
+} // namespace Ultima1
+} // namespace Ultima
diff --git a/engines/ultima/ultima1/views/location.h b/engines/ultima/ultima1/views/game.h
similarity index 77%
rename from engines/ultima/ultima1/views/location.h
rename to engines/ultima/ultima1/views/game.h
index 40e03b173f1..9ec019e42b3 100644
--- a/engines/ultima/ultima1/views/location.h
+++ b/engines/ultima/ultima1/views/game.h
@@ -19,11 +19,10 @@
  *
  */
 
-#ifndef ULTIMA1_VIEWS_LOCATION_H
-#define ULTIMA1_VIEWS_LOCATION_H
+#ifndef ULTIMA1_VIEWS_GAME_H
+#define ULTIMA1_VIEWS_GAME_H
 
 #include "ultima/ultima1/views/dialog.h"
-#include "ultima/ultima1/views/location_map.h"
 #include "ultima/ultima1/views/commands.h"
 #include "ultima/ultima1/views/stats.h"
 
@@ -32,19 +31,18 @@ namespace Ultima1 {
 namespace Views {
 
 /**
- * The main in-game screen. Draws the outer frame around the map
- * viewport, and hosts the map, stats, and command/message log
- * sub-views. For now, the command/message log area is just left blank.
+ * The main in-game screen. Draws the outer frame, and contains the shared
+ * Commands area and Stats display. Only the actual map/dungeon area changes.
  */
-class Location : public Dialog {
+class Game : public Dialog {
 private:
-	LocationMap _map;
 	Commands _commands;
 	Stats _stats;
+	UIElement *_map = nullptr;
 
 public:
-	Location();
-	~Location() override {}
+	Game();
+	~Game() override;
 
 	bool msgFocus(const FocusMessage &msg) override;
 	bool msgUnfocus(const UnfocusMessage &msg) override;
diff --git a/engines/ultima/ultima1/views/location.cpp b/engines/ultima/ultima1/views/location.cpp
deleted file mode 100644
index bb09961950f..00000000000
--- a/engines/ultima/ultima1/views/location.cpp
+++ /dev/null
@@ -1,69 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-#include "ultima/ultima1/views/location.h"
-#include "ultima/ultima1/data/map.h"
-#include "ultima/ultima1/data/tiles.h"
-#include "ultima/ultima1/metaengine.h"
-#include "ultima/shared/gfx/rect.h"
-
-namespace Ultima {
-namespace Ultima1 {
-namespace Views {
-
-Location::Location() : Dialog("Location"), _map(this), _commands("LocationCommands", this), _stats(this) {
-	_map.setBounds(TextRect(1, 1, 38, 19));
-	_commands.setBounds(TextRect(0, 20, 29, 24));
-	_stats.setBounds(TextRect(31, 21, 39, 24));
-}
-
-bool Location::msgFocus(const FocusMessage &msg) {
-	MetaEngine::setKeybindingMode(KBMODE_OVERWORLD);
-	return Dialog::msgFocus(msg);
-}
-
-bool Location::msgUnfocus(const UnfocusMessage &msg) {
-	MetaEngine::setKeybindingMode(KBMODE_MINIMAL);
-	return Dialog::msgUnfocus(msg);
-}
-
-void Location::draw() {
-	auto s = getSurface();
-	s.clear();
-	drawFrame();
-	drawGameDividers();
-}
-
-bool Location::msgGame(const GameMessage &msg) {
-	if (msg._name == "UPDATE") {
-		if (msg._stringValue == "MAP")
-			_map.redraw();
-		if (msg._stringValue == "STATS")
-			_stats.redraw();
-		return true;
-	}
-
-	return Dialog::msgGame(msg);
-}
-
-} // namespace Views
-} // namespace Ultima1
-} // namespace Ultima
diff --git a/engines/ultima/ultima1/views/overworld.cpp b/engines/ultima/ultima1/views/overworld.cpp
deleted file mode 100644
index 4f6edaffa22..00000000000
--- a/engines/ultima/ultima1/views/overworld.cpp
+++ /dev/null
@@ -1,69 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-#include "ultima/ultima1/views/overworld.h"
-#include "ultima/ultima1/data/map.h"
-#include "ultima/ultima1/data/tiles.h"
-#include "ultima/ultima1/metaengine.h"
-#include "ultima/shared/gfx/rect.h"
-
-namespace Ultima {
-namespace Ultima1 {
-namespace Views {
-
-Overworld::Overworld() : Dialog("Overworld"), _map(this), _commands("OverworldCommands", this), _stats(this) {
-	_map.setBounds(TextRect(1, 1, 38, 19));
-	_commands.setBounds(TextRect(0, 20, 29, 24));
-	_stats.setBounds(TextRect(31, 21, 39, 24));
-}
-
-bool Overworld::msgFocus(const FocusMessage &msg) {
-	MetaEngine::setKeybindingMode(KBMODE_OVERWORLD);
-	return View::msgFocus(msg);
-}
-
-bool Overworld::msgUnfocus(const UnfocusMessage &msg) {
-	MetaEngine::setKeybindingMode(KBMODE_MINIMAL);
-	return View::msgUnfocus(msg);
-}
-
-void Overworld::draw() {
-	auto s = getSurface();
-	s.clear();
-	drawFrame();
-	drawGameDividers();
-}
-
-bool Overworld::msgGame(const GameMessage &msg) {
-	if (msg._name == "UPDATE") {
-		if (msg._stringValue == "MAP")
-			_map.redraw();
-		if (msg._stringValue == "STATS")
-			_stats.redraw();
-		return true;
-	}
-
-	return Dialog::msgGame(msg);
-}
-
-} // namespace Views
-} // namespace Ultima1
-} // namespace Ultima
diff --git a/engines/ultima/ultima1/views/views.h b/engines/ultima/ultima1/views/views.h
index 57b96e58f47..500852fd6fe 100644
--- a/engines/ultima/ultima1/views/views.h
+++ b/engines/ultima/ultima1/views/views.h
@@ -24,9 +24,8 @@
 
 #include "ultima/shared/engine/events.h"
 #include "ultima/ultima1/views/create_character.h"
-#include "ultima/ultima1/views/location.h"
+#include "ultima/ultima1/views/game.h"
 #include "ultima/ultima1/views/main_menu.h"
-#include "ultima/ultima1/views/overworld.h"
 #include "ultima/ultima1/views/startup.h"
 #include "ultima/ultima1/views/title.h"
 
@@ -36,9 +35,8 @@ namespace Views {
 
 struct Views : public Shared::Views {
 	CreateCharacter _createCharacter;
-	Location _location;
+	Game _game;
 	MainMenu _mainMenu;
-	Overworld _overworld;
 	Startup _startup;
 	Title _title;
 };


Commit: 28e4acd22cbc42d23fb8dceb8475a4d1ff76e9b8
    https://github.com/scummvm/scummvm/commit/28e4acd22cbc42d23fb8dceb8475a4d1ff76e9b8
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:40:47+11:00

Commit Message:
ULTIMA: ULTIMA1: Making maps distinct views that sit on top of Game view

Changed paths:
  A engines/ultima/ultima1/views/full_screen_dialog.cpp
  A engines/ultima/ultima1/views/full_screen_dialog.h
    engines/ultima/module.mk
    engines/ultima/ultima1/data/map.cpp
    engines/ultima/ultima1/gfx/text_cursor.cpp
    engines/ultima/ultima1/views/commands.cpp
    engines/ultima/ultima1/views/commands.h
    engines/ultima/ultima1/views/create_character.cpp
    engines/ultima/ultima1/views/create_character.h
    engines/ultima/ultima1/views/dialog.cpp
    engines/ultima/ultima1/views/dialog.h
    engines/ultima/ultima1/views/game.cpp
    engines/ultima/ultima1/views/game.h
    engines/ultima/ultima1/views/location_map.cpp
    engines/ultima/ultima1/views/location_map.h
    engines/ultima/ultima1/views/main_menu.cpp
    engines/ultima/ultima1/views/main_menu.h
    engines/ultima/ultima1/views/overworld_map.cpp
    engines/ultima/ultima1/views/overworld_map.h
    engines/ultima/ultima1/views/views.h


diff --git a/engines/ultima/module.mk b/engines/ultima/module.mk
index b9cf65b84d2..6edc2907092 100644
--- a/engines/ultima/module.mk
+++ b/engines/ultima/module.mk
@@ -70,6 +70,7 @@ MODULE_OBJS += \
 	ultima1/views/create_character.o \
 	ultima1/views/dead.o \
 	ultima1/views/dialog.o \
+	ultima1/views/full_screen_dialog.o \
 	ultima1/views/game.o \
 	ultima1/views/location_map.o \
 	ultima1/views/main_menu.o \
diff --git a/engines/ultima/ultima1/data/map.cpp b/engines/ultima/ultima1/data/map.cpp
index 1e2e750c7f0..aadea7ad394 100644
--- a/engines/ultima/ultima1/data/map.cpp
+++ b/engines/ultima/ultima1/data/map.cpp
@@ -160,22 +160,25 @@ void Map::load(int mapNum) {
 	// Set up the correct logic to use
 	delete _G(logic);
 
+	// Set the outer game frame and draw it immediately
 	g_engine->replaceView("Game");
+	g_engine->focusedView()->draw();
+
 	if (mapNum >= 49) {
 		_G(logic) = new Logic::DungeonLogic();
-		g_engine->send("Game", Shared::Messages::GameMessage("MAP", "DUNGEON"));
+		g_engine->addView("DungeonMap");
 	} else if (mapNum == MAP_OVERWORLD) {
 		_G(logic) = new Logic::OverworldLogic();
-		g_engine->send("Game", Shared::Messages::GameMessage("MAP", "OVERWORLD"));
-	} else  if (mapNum < 33) {
-		_G(logic) = new Logic::CityLogic();
-		g_engine->send("Game", Shared::Messages::GameMessage("MAP", "CITY"));
-	} else if (mapNum < 41) {
-		_G(logic) = new Logic::CastleLogic();
-		g_engine->send("Game", Shared::Messages::GameMessage("MAP", "CASTLE"));
+		g_engine->addView("OverworldMap");
 	} else {
-		_G(logic) = new Logic::PillarLogic();
-		g_engine->send("Game", Shared::Messages::GameMessage("MAP", "PILLAR"));
+		if (mapNum < 33)
+			_G(logic) = new Logic::CityLogic();
+		else if (mapNum < 41)
+			_G(logic) = new Logic::CastleLogic();
+		else
+			_G(logic) = new Logic::PillarLogic();
+
+		g_engine->addView("LocationMap");
 	}
 }
 
diff --git a/engines/ultima/ultima1/gfx/text_cursor.cpp b/engines/ultima/ultima1/gfx/text_cursor.cpp
index 8f1f6f3ca7c..7a8979e4c5e 100644
--- a/engines/ultima/ultima1/gfx/text_cursor.cpp
+++ b/engines/ultima/ultima1/gfx/text_cursor.cpp
@@ -77,7 +77,7 @@ void TextCursor::draw() {
 void TextCursor::timeout() {
 	if (_visible) {
 		_frame = (_frame + 1) % 4;
-		redraw();
+		draw();
 		delayFrames(DELAY_FRAMES);
 	}
 }
diff --git a/engines/ultima/ultima1/views/commands.cpp b/engines/ultima/ultima1/views/commands.cpp
index 1df7e3e8c7a..1e887536b7d 100644
--- a/engines/ultima/ultima1/views/commands.cpp
+++ b/engines/ultima/ultima1/views/commands.cpp
@@ -56,16 +56,6 @@ bool Commands::msgGame(const GameMessage &msg) {
 	return false;
 }
 
-bool Commands::msgAction(const ActionMessage &msg) {
-	g_engine->_logic->action(msg._action);
-	return true;
-}
-
-bool Commands::msgKeypress(const KeypressMessage &msg) {
-	g_engine->_logic->keypress(msg.keycode);
-	return true;
-}
-
 void Commands::writeString(const Common::String &msg) {
 	_textCursor.hide();
 	_surface.writeString(msg);
diff --git a/engines/ultima/ultima1/views/commands.h b/engines/ultima/ultima1/views/commands.h
index 96c1a7324cb..4deefa13182 100644
--- a/engines/ultima/ultima1/views/commands.h
+++ b/engines/ultima/ultima1/views/commands.h
@@ -43,8 +43,6 @@ public:
 	bool msgFocus(const FocusMessage &msg) override;
 	void draw() override;
 	bool msgGame(const GameMessage &msg) override;
-	bool msgAction(const ActionMessage &msg) override;
-	bool msgKeypress(const KeypressMessage &msg) override;
 
 	void writeString(const Common::String &msg);
 	void prompt();
diff --git a/engines/ultima/ultima1/views/create_character.cpp b/engines/ultima/ultima1/views/create_character.cpp
index 64f29b8b6e4..a846967e242 100644
--- a/engines/ultima/ultima1/views/create_character.cpp
+++ b/engines/ultima/ultima1/views/create_character.cpp
@@ -41,7 +41,7 @@ static Common::String padLabel(const Common::String &label, int width) {
 	return result;
 }
 
-CreateCharacter::CreateCharacter() : Dialog("CreateCharacter"),
+CreateCharacter::CreateCharacter() : FullScreenDialog("CreateCharacter"),
 		_cursor("Cursor", this), _nameInput("NameInput", this, _cursor) {
 	// Hidden until race/sex/class/save selection needs it
 	_cursor.hide();
@@ -77,10 +77,9 @@ int16 &CreateCharacter::attribute(int index) {
 }
 
 void CreateCharacter::draw() {
-	auto s = getSurface();
-	s.clear();
-	drawFrame();
+	FullScreenDialog::draw();
 
+	auto s = getSurface();
 	s.setTextPos(Point(8, 0));
 	s.writeString(Common::Point(8, 0), "\x10 Character Generation \x11");
 
diff --git a/engines/ultima/ultima1/views/create_character.h b/engines/ultima/ultima1/views/create_character.h
index 4e417a13f2a..b22ac2c404c 100644
--- a/engines/ultima/ultima1/views/create_character.h
+++ b/engines/ultima/ultima1/views/create_character.h
@@ -24,7 +24,7 @@
 
 #include "ultima/ultima1/gfx/text_cursor.h"
 #include "ultima/ultima1/gfx/text_input.h"
-#include "ultima/ultima1/views/dialog.h"
+#include "ultima/ultima1/views/full_screen_dialog.h"
 
 namespace Ultima {
 namespace Ultima1 {
@@ -39,7 +39,7 @@ constexpr int STARTING_POINTS = 30;
  * Character generation - attribute point-buy, then race/sex/class
  * selection, name entry, and a final save confirmation.
  */
-class CreateCharacter : public Dialog {
+class CreateCharacter : public FullScreenDialog {
 private:
 	enum State {
 		ATTRIBUTES, RACE, SEX, CLASS, NAME, SAVE
diff --git a/engines/ultima/ultima1/views/dialog.cpp b/engines/ultima/ultima1/views/dialog.cpp
index c6faa1ef1e9..f2d7d737793 100644
--- a/engines/ultima/ultima1/views/dialog.cpp
+++ b/engines/ultima/ultima1/views/dialog.cpp
@@ -21,6 +21,7 @@
 
 #include "common/util.h"
 #include "ultima/ultima1/views/dialog.h"
+#include "ultima/ultima1/ultima1.h"
 
 namespace Ultima {
 namespace Ultima1 {
@@ -31,28 +32,30 @@ constexpr int COLOR_BORDER = 1;  // blue - thick outer band
 constexpr int COLOR_EDGE = 15;   // white - thin inner highlight line
 constexpr int COLOR_NOTCH = 0;   // black - corner notch pixels
 
-void Dialog::drawFrame() {
+Dialog::Dialog(const Common::String &name) : View(name) {
+	setBounds(TextRect(0, 0, 39, 19));
+}
+
+void Dialog::draw() {
 	auto s = getSurface();
+	s.clear();
 
 	// Thick outer border band - each edge flush against both the screen edge
 	// and the inner highlight line drawn just inside it
 	s.fillRect(Common::Rect(0, 0, 320, 7), COLOR_BORDER);
-	s.fillRect(Common::Rect(0, 7, 7, 193), COLOR_BORDER);
-	s.fillRect(Common::Rect(313, 7, 320, 193), COLOR_BORDER);
-	s.fillRect(Common::Rect(0, 193, 320, 200), COLOR_BORDER);
+	s.fillRect(Common::Rect(0, 7, 7, 159), COLOR_BORDER);
+	s.fillRect(Common::Rect(313, 7, 320, 159), COLOR_BORDER);
+	s.fillRect(Common::Rect(0, 152, 320, 160), COLOR_BORDER);
 
 	// Thin inner highlight line
-	s.drawLine(7, 7, 312, 7, COLOR_EDGE);
-	s.drawLine(7, 7, 7, 192, COLOR_EDGE);
-	s.drawLine(312, 7, 312, 192, COLOR_EDGE);
-	s.drawLine(7, 192, 312, 192, COLOR_EDGE);
+	s.frameRect(Common::Rect(7, 7, 313, 153), COLOR_EDGE);
+	s.drawLine(0, 159, 240, 159, COLOR_EDGE);
+	s.drawLine(247, 159, 319, 159, COLOR_EDGE);
 
 	// Diagonal-notched corners, cut as a growing staircase into each corner
 	for (int idx = 1; idx <= 4; ++idx) {
 		s.drawLine(idx, 0, 0, idx, COLOR_NOTCH);
 		s.drawLine(319 - idx, 0, 319, idx, COLOR_NOTCH);
-		s.drawLine(0, 199 - idx, idx, 199, COLOR_NOTCH);
-		s.drawLine(319, 199 - idx, 319 - idx, 199, COLOR_NOTCH);
 	}
 
 	static const Common::Point NOTCH_POINTS[] = {
@@ -65,6 +68,21 @@ void Dialog::drawFrame() {
 		s.drawLine(NOTCH_POINTS[i].x, NOTCH_POINTS[i].y, NOTCH_POINTS[i].x, NOTCH_POINTS[i].y, COLOR_NOTCH);
 }
 
+bool Dialog::tick() {
+	g_engine->findView("Game")->tick();
+	return Shared::Gfx::View::tick();
+}
+
+bool Dialog::msgAction(const ActionMessage &msg) {
+	g_engine->_logic->action(msg._action);
+	return true;
+}
+
+bool Dialog::msgKeypress(const KeypressMessage &msg) {
+	g_engine->_logic->keypress(msg.keycode);
+	return true;
+}
+
 } // namespace Views
 } // namespace Ultima1
 } // namespace Ultima
diff --git a/engines/ultima/ultima1/views/dialog.h b/engines/ultima/ultima1/views/dialog.h
index ed7ad4f766f..13ddd4defc3 100644
--- a/engines/ultima/ultima1/views/dialog.h
+++ b/engines/ultima/ultima1/views/dialog.h
@@ -23,31 +23,34 @@
 #define ULTIMA1_VIEWS_DIALOG_H
 
 #include "ultima/shared/gfx/view.h"
+#include "ultima/shared/engine/messages.h"
 
 namespace Ultima {
 namespace Ultima1 {
 namespace Views {
 
+using namespace Shared::Messages;
+
 /**
- * Base class for views with the thick beveled-corner frame drawn around the edge of the screen
+ * Base class for views that appear on the top hand of the screen, such as the maps, dungeon, etc.
  */
 class Dialog : public Shared::Gfx::View {
-protected:
+public:
+	Dialog(const Common::String &name);
+	~Dialog() override {}
+
 	/**
-	 * Draws the border frame around the edge of the screen
+	 * Draw the dialog
 	 */
-	void drawFrame();
+	void draw() override;
 
 	/**
-	 * Draws the dividers splitting the interior of the frame into a map
-	 * viewport (above) and a command/message log and stats panel (below).
-	 * Shared by the overworld, dungeon, and outer space views
+	 * Called for game frame ticks
 	 */
-	void drawGameDividers();
+	bool tick() override;
 
-public:
-	Dialog(const Common::String &name) : View(name) {}
-	~Dialog() override {}
+	bool msgAction(const ActionMessage &msg) override;
+	bool msgKeypress(const KeypressMessage &msg) override;
 };
 
 } // namespace Views
diff --git a/engines/ultima/ultima1/views/full_screen_dialog.cpp b/engines/ultima/ultima1/views/full_screen_dialog.cpp
new file mode 100644
index 00000000000..8abe91c5faf
--- /dev/null
+++ b/engines/ultima/ultima1/views/full_screen_dialog.cpp
@@ -0,0 +1,70 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "common/util.h"
+#include "ultima/ultima1/views/full_screen_dialog.h"
+
+namespace Ultima {
+namespace Ultima1 {
+namespace Views {
+
+// Colors used
+constexpr int COLOR_BORDER = 1;  // blue - thick outer band
+constexpr int COLOR_EDGE = 15;   // white - thin inner highlight line
+constexpr int COLOR_NOTCH = 0;   // black - corner notch pixels
+
+void FullScreenDialog::draw() {
+	auto s = getSurface();
+
+	// Thick outer border band - each edge flush against both the screen edge
+	// and the inner highlight line drawn just inside it
+	s.fillRect(Common::Rect(0, 0, 320, 7), COLOR_BORDER);
+	s.fillRect(Common::Rect(0, 7, 7, 193), COLOR_BORDER);
+	s.fillRect(Common::Rect(313, 7, 320, 193), COLOR_BORDER);
+	s.fillRect(Common::Rect(0, 193, 320, 200), COLOR_BORDER);
+
+	// Thin inner highlight line
+	s.drawLine(7, 7, 312, 7, COLOR_EDGE);
+	s.drawLine(7, 7, 7, 192, COLOR_EDGE);
+	s.drawLine(312, 7, 312, 192, COLOR_EDGE);
+	s.drawLine(7, 192, 312, 192, COLOR_EDGE);
+
+	// Diagonal-notched corners, cut as a growing staircase into each corner
+	for (int idx = 1; idx <= 4; ++idx) {
+		s.drawLine(idx, 0, 0, idx, COLOR_NOTCH);
+		s.drawLine(319 - idx, 0, 319, idx, COLOR_NOTCH);
+		s.drawLine(0, 199 - idx, idx, 199, COLOR_NOTCH);
+		s.drawLine(319, 199 - idx, 319 - idx, 199, COLOR_NOTCH);
+	}
+
+	static const Common::Point NOTCH_POINTS[] = {
+		Common::Point(0, 0), Common::Point(0, 5), Common::Point(5, 0),
+		Common::Point(319, 0), Common::Point(314, 0), Common::Point(319, 5),
+		Common::Point(0, 199), Common::Point(0, 194), Common::Point(5, 199),
+		Common::Point(319, 199), Common::Point(319, 194), Common::Point(314, 199)
+	};
+	for (int i = 0; i < ARRAYSIZE(NOTCH_POINTS); ++i)
+		s.drawLine(NOTCH_POINTS[i].x, NOTCH_POINTS[i].y, NOTCH_POINTS[i].x, NOTCH_POINTS[i].y, COLOR_NOTCH);
+}
+
+} // namespace Views
+} // namespace Ultima1
+} // namespace Ultima
diff --git a/engines/ultima/ultima1/views/full_screen_dialog.h b/engines/ultima/ultima1/views/full_screen_dialog.h
new file mode 100644
index 00000000000..af07e961d4e
--- /dev/null
+++ b/engines/ultima/ultima1/views/full_screen_dialog.h
@@ -0,0 +1,46 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef ULTIMA1_VIEWS_FULL_SCREEN_DIALOG_H
+#define ULTIMA1_VIEWS_FULL_SCREEN_DIALOG_H
+
+#include "ultima/shared/gfx/view.h"
+
+namespace Ultima {
+namespace Ultima1 {
+namespace Views {
+
+/**
+ * Base class for views with the thick beveled-corner frame drawn around the edge of the screen
+ */
+class FullScreenDialog : public Shared::Gfx::View {
+public:
+	FullScreenDialog(const Common::String &name) : View(name) {}
+	~FullScreenDialog() override {}
+
+	void draw() override;
+};
+
+} // namespace Views
+} // namespace Ultima1
+} // namespace Ultima
+
+#endif
diff --git a/engines/ultima/ultima1/views/game.cpp b/engines/ultima/ultima1/views/game.cpp
index 2fc74aaf09c..b572fa9c9ac 100644
--- a/engines/ultima/ultima1/views/game.cpp
+++ b/engines/ultima/ultima1/views/game.cpp
@@ -35,15 +35,12 @@ namespace Views {
 constexpr int COLOR_BORDER = 1;  // blue - thick outer band
 constexpr int COLOR_EDGE = 15;   // white - thin inner highlight line
 
-Game::Game() : Dialog("Game"), _commands(this), _stats(this) {
+Game::Game() : Shared::Gfx::View("Game"), _commands(this), _stats(this) {
+	setBounds(TextRect(0, 0, 39, 24));
 	_commands.setBounds(TextRect(0, 20, 29, 24));
 	_stats.setBounds(TextRect(31, 21, 39, 24));
 }
 
-Game::~Game() {
-	delete _map;
-}
-
 bool Game::msgFocus(const FocusMessage &msg) {
 	MetaEngine::setKeybindingMode(KBMODE_OVERWORLD);
 	return View::msgFocus(msg);
@@ -56,53 +53,12 @@ bool Game::msgUnfocus(const UnfocusMessage &msg) {
 
 void Game::draw() {
 	auto s = getSurface();
-	s.clear();
-	drawFrame();
-
-	// Erase the frame's bottom section
-	s.fillRect(Common::Rect(0, 153, 320, 200), 0);
-
-	// Horizontal divider separating the map viewport (above) from the command/message log and stats panel
-	s.fillRect(Common::Rect(0, 153, 320, 159), COLOR_BORDER);
-	s.drawLine(7, 152, 312, 152, COLOR_EDGE);
-	s.drawLine(0, 159, 240, 159, COLOR_EDGE);
-	s.drawLine(247, 159, 319, 159, COLOR_EDGE);
+	Shared::UIElement::draw();
 
 	// Vertical divider between the command/message log (left) and the stats panel (right)
-	s.fillRect(Common::Rect(241, 153, 247, 200), COLOR_BORDER);
-	s.drawLine(240, 159, 240, 199, COLOR_EDGE);
-	s.drawLine(247, 159, 247, 199, COLOR_EDGE);
-}
-
-bool Game::msgGame(const GameMessage &msg) {
-	if (msg._name == "MAP") {
-		if (_map) {
-			// Remove current map view
-			_children.remove(_map);
-			delete _map;
-			_map = nullptr;
-		}
-
-		if (msg._stringValue == "OVERWORLD")
-			_map = new OverworldMap(this);
-		else if (msg._stringValue == "CITY" || msg._stringValue == "CASTLE" || msg._stringValue == "PILLAR")
-			_map = new LocationMap(this);
-		else
-			error("Invalid map type - %s", msg._stringValue.c_str());
-
-		// Set the bounds
-		_map->setBounds(TextRect(1, 1, 38, 19));
-		return true;
-
-	} else if (msg._name == "UPDATE") {
-		if (msg._stringValue == "MAP")
-			_map->redraw();
-		if (msg._stringValue == "STATS")
-			_stats.redraw();
-		return true;
-	}
-
-	return Dialog::msgGame(msg);
+	s.fillRect(Common::Rect(241, 160, 247, 200), COLOR_BORDER);
+	s.drawLine(240, 160, 240, 199, COLOR_EDGE);
+	s.drawLine(247, 160, 247, 199, COLOR_EDGE);
 }
 
 } // namespace Views
diff --git a/engines/ultima/ultima1/views/game.h b/engines/ultima/ultima1/views/game.h
index 9ec019e42b3..fc1ba526437 100644
--- a/engines/ultima/ultima1/views/game.h
+++ b/engines/ultima/ultima1/views/game.h
@@ -22,7 +22,7 @@
 #ifndef ULTIMA1_VIEWS_GAME_H
 #define ULTIMA1_VIEWS_GAME_H
 
-#include "ultima/ultima1/views/dialog.h"
+#include "ultima/shared/gfx/view.h"
 #include "ultima/ultima1/views/commands.h"
 #include "ultima/ultima1/views/stats.h"
 
@@ -34,19 +34,18 @@ namespace Views {
  * The main in-game screen. Draws the outer frame, and contains the shared
  * Commands area and Stats display. Only the actual map/dungeon area changes.
  */
-class Game : public Dialog {
+class Game : public Shared::Gfx::View {
 private:
 	Commands _commands;
 	Stats _stats;
-	UIElement *_map = nullptr;
 
 public:
 	Game();
-	~Game() override;
+	~Game() override {
+	}
 
 	bool msgFocus(const FocusMessage &msg) override;
 	bool msgUnfocus(const UnfocusMessage &msg) override;
-	bool msgGame(const GameMessage &msg) override;
 	void draw() override;
 };
 
diff --git a/engines/ultima/ultima1/views/location_map.cpp b/engines/ultima/ultima1/views/location_map.cpp
index 9dadf614ee0..a2a639e0dfd 100644
--- a/engines/ultima/ultima1/views/location_map.cpp
+++ b/engines/ultima/ultima1/views/location_map.cpp
@@ -61,6 +61,8 @@ int LocationMap::animatedTileId(byte tileId) const {
 }
 
 void LocationMap::draw() {
+	Dialog::draw();
+
 	auto &map = g_engine->_map;
 	const Graphics::ManagedSurface *tiles = map.tiles();
 	auto s = getSurface();
@@ -75,7 +77,7 @@ void LocationMap::draw() {
 				const Graphics::ManagedSurface &tileImg = tiles[
 					(_G(map)._currentMap != Data::MAP_OVERWORLD && tileId >= 50) ? 1 : tileId
 				];
-				s.blitFrom(tileImg, Common::Point(ox * Data::TILE_WIDTH, oy * Data::TILE_HEIGHT));
+				s.blitFrom(tileImg, Common::Point(ox * Data::TILE_WIDTH + 8, oy * Data::TILE_HEIGHT + 8));
 			}
 		}
 	}
diff --git a/engines/ultima/ultima1/views/location_map.h b/engines/ultima/ultima1/views/location_map.h
index 9a2c2ec02fd..eff522dd0b2 100644
--- a/engines/ultima/ultima1/views/location_map.h
+++ b/engines/ultima/ultima1/views/location_map.h
@@ -22,7 +22,7 @@
 #ifndef ULTIMA2_VIEWS_LOCATION_MAP_H
 #define ULTIMA2_VIEWS_LOCATION_MAP_H
 
-#include "ultima/shared/engine/events.h"
+#include "ultima/ultima1/views/dialog.h"
 
 namespace Ultima {
 namespace Ultima1 {
@@ -30,7 +30,7 @@ namespace Views {
 
 using namespace Shared::Messages;
 
-class LocationMap : public Shared::UIElement {
+class LocationMap : public Dialog {
 private:
 	int _animIndex = 0;
 
@@ -45,7 +45,7 @@ private:
 	int animatedTileId(byte tileId) const;
 
 public:
-	LocationMap(Shared::UIElement *parent) : Shared::UIElement("LocationMap", parent) {}
+	LocationMap() : Dialog("LocationMap") {}
 	~LocationMap() override {}
 
 	bool msgFocus(const FocusMessage &msg) override;
diff --git a/engines/ultima/ultima1/views/main_menu.cpp b/engines/ultima/ultima1/views/main_menu.cpp
index 36af0a2297f..77dee41a9aa 100644
--- a/engines/ultima/ultima1/views/main_menu.cpp
+++ b/engines/ultima/ultima1/views/main_menu.cpp
@@ -30,16 +30,15 @@ namespace Views {
 constexpr int COLOR_EDGE = 15; // white - used for the title/tagline
 constexpr int COLOR_TEXT = 11; // light cyan - used for the menu options
 
-MainMenu::MainMenu() : Dialog("MainMenu"), _cursor("Cursor", this) {
+MainMenu::MainMenu() : FullScreenDialog("MainMenu"), _cursor("Cursor", this) {
 	// Position the cursor right after "Thy choice: "
 	_cursor.setPosition(Common::Point(25, 18));
 }
 
 void MainMenu::draw() {
-	auto s = getSurface();
-	s.clear();
-	drawFrame();
+	FullScreenDialog::draw();
 
+	auto s = getSurface();
 	s.setColor(COLOR_EDGE);
 	s.writeString(Common::Point(12, 6), "*** Ultima I ***");
 	s.writeString(Common::Point(14, 9), "from darkest");
diff --git a/engines/ultima/ultima1/views/main_menu.h b/engines/ultima/ultima1/views/main_menu.h
index 3454a496073..5482d89da81 100644
--- a/engines/ultima/ultima1/views/main_menu.h
+++ b/engines/ultima/ultima1/views/main_menu.h
@@ -23,7 +23,7 @@
 #define ULTIMA1_VIEWS_MAIN_MENU_H
 
 #include "ultima/ultima1/gfx/text_cursor.h"
-#include "ultima/ultima1/views/dialog.h"
+#include "ultima/ultima1/views/full_screen_dialog.h"
 
 namespace Ultima {
 namespace Ultima1 {
@@ -35,7 +35,7 @@ using namespace Shared::Messages;
  * The game's main menu - offers generating a new character or
  * continuing a previously saved game.
  */
-class MainMenu : public Dialog {
+class MainMenu : public FullScreenDialog {
 private:
 	Gfx::TextCursor _cursor;
 
diff --git a/engines/ultima/ultima1/views/overworld_map.cpp b/engines/ultima/ultima1/views/overworld_map.cpp
index 8b7e3cbd8c0..019010e2435 100644
--- a/engines/ultima/ultima1/views/overworld_map.cpp
+++ b/engines/ultima/ultima1/views/overworld_map.cpp
@@ -58,19 +58,11 @@ void OverworldMap::animateWater() {
 
 int OverworldMap::animatedTileId(byte tileId) const {
 	if (tileId == Data::TILE_CASTLE1) {
-		// Only redrawn on 2 of every 6 ticks; the other 4 ticks leave
-		// whichever frame was last drawn untouched
-		int offset = 2;
-		if ((_animIndex % 6) == 0)
-			offset = 0;
-		else if ((_animIndex % 3) == 0)
-			offset = 1;
-
-		return (offset == 2) ? -1 : Data::TILE_CASTLE1 + offset;
+		return Data::TILE_CASTLE1 + ((_animIndex % 6) < 3 ? 1 : 0);
 	}
 
 	if (tileId == Data::TILE_CITY1) {
-		// Redrawn every tick, biased 3:1 toward the waving-flag frame
+		// Redrawn biased 3:1 toward the waving-flag frame
 		return Data::TILE_CITY1 + (((_animIndex % 4) == 0) ? 0 : 1);
 	}
 
@@ -78,6 +70,8 @@ int OverworldMap::animatedTileId(byte tileId) const {
 }
 
 void OverworldMap::draw() {
+	Dialog::draw();
+
 	auto &map = g_engine->_map;
 	const Graphics::ManagedSurface *tiles = map.tiles();
 	auto s = getSurface();
@@ -92,7 +86,7 @@ void OverworldMap::draw() {
 				const Graphics::ManagedSurface &tileImg = tiles[
 					(_G(map)._currentMap != Data::MAP_OVERWORLD && tileId >= 50) ? 1 : tileId
 				];
-				s.blitFrom(tileImg, Common::Point(ox * Data::TILE_WIDTH, oy * Data::TILE_HEIGHT));
+				s.blitFrom(tileImg, Common::Point(ox * Data::TILE_WIDTH + 8, oy * Data::TILE_HEIGHT + 8));
 			}
 		}
 	}
diff --git a/engines/ultima/ultima1/views/overworld_map.h b/engines/ultima/ultima1/views/overworld_map.h
index b4160ad0413..fe5adbe742d 100644
--- a/engines/ultima/ultima1/views/overworld_map.h
+++ b/engines/ultima/ultima1/views/overworld_map.h
@@ -22,7 +22,7 @@
 #ifndef ULTIMA1_VIEWS_OVERWORLD_MAP_H
 #define ULTIMA1_VIEWS_OVERWORLD_MAP_H
 
-#include "ultima/shared/engine/events.h"
+#include "ultima/ultima1/views/dialog.h"
 
 namespace Ultima {
 namespace Ultima1 {
@@ -30,7 +30,7 @@ namespace Views {
 
 using namespace Shared::Messages;
 
-class OverworldMap : public Shared::UIElement {
+class OverworldMap : public Dialog {
 private:
 	int _animIndex = 0;
 
@@ -52,7 +52,7 @@ private:
 	int animatedTileId(byte tileId) const;
 
 public:
-	OverworldMap(Shared::UIElement *parent) : Shared::UIElement("OverworldMap", parent) {}
+	OverworldMap() : Dialog("OverworldMap") {}
 	~OverworldMap() override {}
 
 	bool msgFocus(const FocusMessage &msg) override;
diff --git a/engines/ultima/ultima1/views/views.h b/engines/ultima/ultima1/views/views.h
index 500852fd6fe..5dcdb1ee094 100644
--- a/engines/ultima/ultima1/views/views.h
+++ b/engines/ultima/ultima1/views/views.h
@@ -25,7 +25,9 @@
 #include "ultima/shared/engine/events.h"
 #include "ultima/ultima1/views/create_character.h"
 #include "ultima/ultima1/views/game.h"
+#include "ultima/ultima1/views/location_map.h"
 #include "ultima/ultima1/views/main_menu.h"
+#include "ultima/ultima1/views/overworld_map.h"
 #include "ultima/ultima1/views/startup.h"
 #include "ultima/ultima1/views/title.h"
 
@@ -36,7 +38,9 @@ namespace Views {
 struct Views : public Shared::Views {
 	CreateCharacter _createCharacter;
 	Game _game;
+	LocationMap _locationMap;
 	MainMenu _mainMenu;
+	OverworldMap _overworldMap;
 	Startup _startup;
 	Title _title;
 };


Commit: 2a1429ef3394c471c77065189a46a1f04229d686
    https://github.com/scummvm/scummvm/commit/2a1429ef3394c471c77065189a46a1f04229d686
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:40:47+11:00

Commit Message:
ULTIMA: ULTIMA1: Stop commands being erased when entering city

Changed paths:
    engines/ultima/shared/engine/events.h
    engines/ultima/ultima1/data/map.cpp
    engines/ultima/ultima1/logic/logic.cpp
    engines/ultima/ultima1/logic/overworld_logic.cpp
    engines/ultima/ultima1/views/location_map.cpp
    engines/ultima/ultima1/views/location_map.h
    engines/ultima/ultima1/views/overworld_map.cpp
    engines/ultima/ultima1/views/overworld_map.h


diff --git a/engines/ultima/shared/engine/events.h b/engines/ultima/shared/engine/events.h
index ec4e02f15d7..082d1931245 100644
--- a/engines/ultima/shared/engine/events.h
+++ b/engines/ultima/shared/engine/events.h
@@ -184,6 +184,13 @@ public:
 		addView();
 	}
 
+	/**
+	 * Gets the view's name
+	 */
+	const Common::String &getName() const {
+		return _name;
+	}
+
 	/**
 	 * Returns a random number
 	 */
diff --git a/engines/ultima/ultima1/data/map.cpp b/engines/ultima/ultima1/data/map.cpp
index aadea7ad394..9e221a1736b 100644
--- a/engines/ultima/ultima1/data/map.cpp
+++ b/engines/ultima/ultima1/data/map.cpp
@@ -26,6 +26,7 @@
 #include "ultima/ultima1/logic/dungeon_logic.h"
 #include "ultima/ultima1/logic/overworld_logic.h"
 #include "ultima/ultima1/logic/pillar_logic.h"
+#include "ultima/ultima1/views/dialog.h"
 #include "ultima/ultima1/ultima1.h"
 
 namespace Ultima {
@@ -160,16 +161,14 @@ void Map::load(int mapNum) {
 	// Set up the correct logic to use
 	delete _G(logic);
 
-	// Set the outer game frame and draw it immediately
-	g_engine->replaceView("Game");
-	g_engine->focusedView()->draw();
-
+	// Set up logic handler for the mode and which view it'll be using
+	Common::String viewName;
 	if (mapNum >= 49) {
 		_G(logic) = new Logic::DungeonLogic();
-		g_engine->addView("DungeonMap");
+		viewName = "DungeonMap";
 	} else if (mapNum == MAP_OVERWORLD) {
 		_G(logic) = new Logic::OverworldLogic();
-		g_engine->addView("OverworldMap");
+		viewName = "OverworldMap";
 	} else {
 		if (mapNum < 33)
 			_G(logic) = new Logic::CityLogic();
@@ -178,7 +177,21 @@ void Map::load(int mapNum) {
 		else
 			_G(logic) = new Logic::PillarLogic();
 
-		g_engine->addView("LocationMap");
+		viewName = "LocationMap";
+	}
+
+	// If the focused view isn't already a dialog under the game frame, then reset to the game
+	// frame and draw it immediately
+	Views::Dialog *view = dynamic_cast<Views::Dialog *>(g_engine->focusedView());
+	if (view == nullptr) {
+		g_engine->replaceView("Game", true);
+		g_engine->focusedView()->draw();
+
+		// Now add the appropriate map view on top of it
+		g_engine->addView(viewName);
+	} else {
+		// Already showing a game dialog, so just replace the current one
+		g_engine->replaceView(viewName, false);
 	}
 }
 
diff --git a/engines/ultima/ultima1/logic/logic.cpp b/engines/ultima/ultima1/logic/logic.cpp
index 6bd28f84178..f43e8f5deb9 100644
--- a/engines/ultima/ultima1/logic/logic.cpp
+++ b/engines/ultima/ultima1/logic/logic.cpp
@@ -30,19 +30,19 @@ namespace Logic {
 using namespace Shared::Messages;
 
 void Logic::writeString(const Common::String &msg) {
-	g_engine->focusedView()->send(GameMessage("TEXT", msg));
+	g_engine->findView("Commands")->send(GameMessage("TEXT", msg));
 }
 
 void Logic::prompt() {
-	g_engine->focusedView()->send(GameMessage("PROMPT"));
+	g_engine->findView("Commands")->send(GameMessage("PROMPT"));
 }
 
 void Logic::redrawMap() {
-	g_engine->focusedView()->send(GameMessage("UPDATE", "MAP"));
+	g_engine->focusedView()->redraw();
 }
 
 void Logic::redrawStats() {
-	g_engine->focusedView()->send(GameMessage("UPDATE", "STATS"));
+	g_engine->findView("Stats")->draw();
 }
 
 void Logic::playFX(int num) {
diff --git a/engines/ultima/ultima1/logic/overworld_logic.cpp b/engines/ultima/ultima1/logic/overworld_logic.cpp
index 78091c1d136..2f2547b38b0 100644
--- a/engines/ultima/ultima1/logic/overworld_logic.cpp
+++ b/engines/ultima/ultima1/logic/overworld_logic.cpp
@@ -122,7 +122,7 @@ void OverworldLogic::enter() {
 		Common::String msg = "Entering...\n";
 		if (!_G(map)._isLordBritishCastle)
 			msg += "The city of ";
-		msg += Data::LOCATION_NAMES[location];
+		msg += Data::LOCATION_NAMES[location - 1];
 		msg += "\n";
 		writeString(msg);
 
diff --git a/engines/ultima/ultima1/views/location_map.cpp b/engines/ultima/ultima1/views/location_map.cpp
index a2a639e0dfd..a8ec09857e4 100644
--- a/engines/ultima/ultima1/views/location_map.cpp
+++ b/engines/ultima/ultima1/views/location_map.cpp
@@ -21,17 +21,22 @@
 
 #include "ultima/ultima1/views/location_map.h"
 #include "ultima/ultima1/ultima1.h"
+#include "ultima/ultima1/metaengine.h"
 
 namespace Ultima {
 namespace Ultima1 {
 namespace Views {
 
 bool LocationMap::msgFocus(const FocusMessage &msg) {
-	_G(map).clearTiles();
 	delayFrames(1);
 	return UIElement::msgFocus(msg);
 }
 
+bool LocationMap::msgUnfocus(const UnfocusMessage &msg) {
+	MetaEngine::setKeybindingMode(KBMODE_MINIMAL);
+	return Dialog::msgUnfocus(msg);
+}
+
 void LocationMap::timeout() {
 	redraw();
 
diff --git a/engines/ultima/ultima1/views/location_map.h b/engines/ultima/ultima1/views/location_map.h
index eff522dd0b2..4c53e3a54ce 100644
--- a/engines/ultima/ultima1/views/location_map.h
+++ b/engines/ultima/ultima1/views/location_map.h
@@ -49,6 +49,7 @@ public:
 	~LocationMap() override {}
 
 	bool msgFocus(const FocusMessage &msg) override;
+	bool msgUnfocus(const UnfocusMessage &msg) override;
 	void draw() override;
 	void timeout() override;
 };
diff --git a/engines/ultima/ultima1/views/overworld_map.cpp b/engines/ultima/ultima1/views/overworld_map.cpp
index 019010e2435..0e32a8237ab 100644
--- a/engines/ultima/ultima1/views/overworld_map.cpp
+++ b/engines/ultima/ultima1/views/overworld_map.cpp
@@ -21,15 +21,21 @@
 
 #include "ultima/ultima1/views/overworld_map.h"
 #include "ultima/ultima1/ultima1.h"
+#include "ultima/ultima1/metaengine.h"
 
 namespace Ultima {
 namespace Ultima1 {
 namespace Views {
 
 bool OverworldMap::msgFocus(const FocusMessage &msg) {
-	_G(map).clearTiles();
+	MetaEngine::setKeybindingMode(KBMODE_OVERWORLD);
 	delayFrames(1);
-	return UIElement::msgFocus(msg);
+	return Dialog::msgFocus(msg);
+}
+
+bool OverworldMap::msgUnfocus(const UnfocusMessage &msg) {
+	MetaEngine::setKeybindingMode(KBMODE_MINIMAL);
+	return Dialog::msgUnfocus(msg);
 }
 
 void OverworldMap::timeout() {
diff --git a/engines/ultima/ultima1/views/overworld_map.h b/engines/ultima/ultima1/views/overworld_map.h
index fe5adbe742d..e410b832d30 100644
--- a/engines/ultima/ultima1/views/overworld_map.h
+++ b/engines/ultima/ultima1/views/overworld_map.h
@@ -56,6 +56,7 @@ public:
 	~OverworldMap() override {}
 
 	bool msgFocus(const FocusMessage &msg) override;
+	bool msgUnfocus(const UnfocusMessage &msg) override;
 	void draw() override;
 	void timeout() override;
 };


Commit: fa71a7c7b1404638586b22b39a9a4cfb36753a82
    https://github.com/scummvm/scummvm/commit/fa71a7c7b1404638586b22b39a9a4cfb36753a82
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:40:47+11:00

Commit Message:
ULTIMA: ULTIMA1: In progress fixes to city drawing

Changed paths:
    engines/ultima/ultima1/views/location_map.cpp
    engines/ultima/ultima1/views/overworld_map.cpp


diff --git a/engines/ultima/ultima1/views/location_map.cpp b/engines/ultima/ultima1/views/location_map.cpp
index a8ec09857e4..55e62e2e614 100644
--- a/engines/ultima/ultima1/views/location_map.cpp
+++ b/engines/ultima/ultima1/views/location_map.cpp
@@ -45,23 +45,6 @@ void LocationMap::timeout() {
 }
 
 int LocationMap::animatedTileId(byte tileId) const {
-	if (tileId == Data::TILE_CASTLE1) {
-		// Only redrawn on 2 of every 6 ticks; the other 4 ticks leave
-		// whichever frame was last drawn untouched
-		int offset = 2;
-		if ((_animIndex % 6) == 0)
-			offset = 0;
-		else if ((_animIndex % 3) == 0)
-			offset = 1;
-
-		return (offset == 2) ? -1 : Data::TILE_CASTLE1 + offset;
-	}
-
-	if (tileId == Data::TILE_CITY1) {
-		// Redrawn every tick, biased 3:1 toward the waving-flag frame
-		return Data::TILE_CITY1 + (((_animIndex % 4) == 0) ? 0 : 1);
-	}
-
 	return tileId;
 }
 
@@ -79,9 +62,7 @@ void LocationMap::draw() {
 		for (int ox = 0; ox < Data::MAP_VISIBLE_WIDTH; ox++) {
 			int tileId = animatedTileId(map._mapTilesId[oy][ox]);
 			if (tileId != -1) {
-				const Graphics::ManagedSurface &tileImg = tiles[
-					(_G(map)._currentMap != Data::MAP_OVERWORLD && tileId >= 50) ? 1 : tileId
-				];
+				const Graphics::ManagedSurface &tileImg = tiles[(tileId >= 50) ? 1 : tileId];
 				s.blitFrom(tileImg, Common::Point(ox * Data::TILE_WIDTH + 8, oy * Data::TILE_HEIGHT + 8));
 			}
 		}
diff --git a/engines/ultima/ultima1/views/overworld_map.cpp b/engines/ultima/ultima1/views/overworld_map.cpp
index 0e32a8237ab..f9a98426475 100644
--- a/engines/ultima/ultima1/views/overworld_map.cpp
+++ b/engines/ultima/ultima1/views/overworld_map.cpp
@@ -89,9 +89,7 @@ void OverworldMap::draw() {
 		for (int ox = 0; ox < Data::MAP_VISIBLE_WIDTH; ox++) {
 			int tileId = animatedTileId(map._mapTilesId[oy][ox]);
 			if (tileId != -1) {
-				const Graphics::ManagedSurface &tileImg = tiles[
-					(_G(map)._currentMap != Data::MAP_OVERWORLD && tileId >= 50) ? 1 : tileId
-				];
+				const Graphics::ManagedSurface &tileImg = tiles[tileId];
 				s.blitFrom(tileImg, Common::Point(ox * Data::TILE_WIDTH + 8, oy * Data::TILE_HEIGHT + 8));
 			}
 		}


Commit: 71cf7f9edbc17e36c1b573b41a1df0ffc92cee66
    https://github.com/scummvm/scummvm/commit/71cf7f9edbc17e36c1b573b41a1df0ffc92cee66
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:40:48+11:00

Commit Message:
ULTIMA: ULTIMA1: City map drawing partially

Changed paths:
    engines/ultima/ultima1/data/map.cpp
    engines/ultima/ultima1/data/map.h
    engines/ultima/ultima1/data/savegame.cpp
    engines/ultima/ultima1/data/savegame.h
    engines/ultima/ultima1/data/tiles.cpp
    engines/ultima/ultima1/data/tiles.h
    engines/ultima/ultima1/logic/overworld_logic.cpp
    engines/ultima/ultima1/views/location_map.cpp
    engines/ultima/ultima1/views/location_map.h
    engines/ultima/ultima1/views/overworld_map.cpp
    engines/ultima/ultima1/views/overworld_map.h


diff --git a/engines/ultima/ultima1/data/map.cpp b/engines/ultima/ultima1/data/map.cpp
index 9e221a1736b..298bd8fd8d1 100644
--- a/engines/ultima/ultima1/data/map.cpp
+++ b/engines/ultima/ultima1/data/map.cpp
@@ -123,8 +123,8 @@ void Map::init() {
 	}
 
 	// Load tiles
-	loadTiles("egatiles.bin", _overworldTiles, OVERWORLD_TILES_COUNT);
-	loadTiles("egatown.bin", _cityTiles, CITY_TILES_COUNT);
+	loadTiles("egatiles.bin", _overworldTiles, OVERWORLD_TILES_COUNT, 16);
+	loadTiles("egatown.bin", _cityTiles, CITY_TILES_COUNT, 8);
 }
 
 void Map::load(int mapNum) {
@@ -156,7 +156,6 @@ void Map::load(int mapNum) {
 
 	// Set up copies of the map position and player tile to use
 	_playerTileId = TILE_PLAYER;
-	clearTiles();
 
 	// Set up the correct logic to use
 	delete _G(logic);
@@ -195,10 +194,6 @@ void Map::load(int mapNum) {
 	}
 }
 
-void Map::clearTiles() {
-	Common::fill(&_mapTilesId[0][0], &_mapTilesId[0][0] + sizeof(VisibleTiles), 0);
-}
-
 int Map::getMapTile(int x, int y) const {
 	int tile = (*this)[y][x];
 
diff --git a/engines/ultima/ultima1/data/map.h b/engines/ultima/ultima1/data/map.h
index 39d84f54e2e..6971df87aaf 100644
--- a/engines/ultima/ultima1/data/map.h
+++ b/engines/ultima/ultima1/data/map.h
@@ -34,15 +34,15 @@ namespace Data {
 constexpr int OVERWORLD_WIDTH = 168;
 constexpr int OVERWORLD_HEIGHT = 156;
 constexpr int OVERWORLD_SIZE = OVERWORLD_WIDTH * OVERWORLD_HEIGHT;
+constexpr int OVERWORLD_VISIBLE_WIDTH = 19;
+constexpr int OVERWORLD_VISIBLE_HEIGHT = 9;
+constexpr int OVERWORLD_VISIBLE_CENTER_X = 9;
+constexpr int OVERWORLD_VISIBLE_CENTER_Y = 4;
+
 constexpr int CITY_WIDTH = 38;
 constexpr int CITY_HEIGHT = 18;
 constexpr int CITY_SIZE = CITY_WIDTH * CITY_HEIGHT;
 
-constexpr int MAP_VISIBLE_WIDTH = 19;
-constexpr int MAP_VISIBLE_HEIGHT = 9;
-constexpr int MAP_VISIBLE_CENTER_X = 9;
-constexpr int MAP_VISIBLE_CENTER_Y = 4;
-
 constexpr int LOCATION_COUNT = 84;
 
 enum {
@@ -62,7 +62,6 @@ enum MapType {
 };
 
 typedef Common::Array< Common::Array<byte> > MapTiles;
-typedef byte VisibleTiles[MAP_VISIBLE_HEIGHT][MAP_VISIBLE_WIDTH];
 
 extern const char *DIRECTION_NAMES[5];
 extern const char *LOCATION_NAMES[LOCATION_COUNT];
@@ -115,7 +114,6 @@ public:
 	byte _tilePlayerCenter = 0;
 	byte _tilePlayerUp = 0, _tilePlayerDown = 0,
 		_tilePlayerLeft = 0, _tilePlayerRight = 0;
-	VisibleTiles _mapTilesId = {};		// Calculated visible on-screen tiles
 	int _woodsCount = 0, _grassCount = 0, _waterCount = 0;	// Tiles surrounding entered locations
 	bool _isLordBritishCastle = false;
 	int _mapStyle = 0;
@@ -171,8 +169,6 @@ public:
 		return _mapRows[y % _mapHeight];
 	}
 
-	void clearTiles();
-
 	/**
 	 * Get a tile at a given position.
 	 * @param x		X position
diff --git a/engines/ultima/ultima1/data/savegame.cpp b/engines/ultima/ultima1/data/savegame.cpp
index b52c18a765a..4abfb8bff47 100644
--- a/engines/ultima/ultima1/data/savegame.cpp
+++ b/engines/ultima/ultima1/data/savegame.cpp
@@ -117,14 +117,6 @@ void Savegame::synchronizeOriginal(Common::Serializer &s) {
 	_mapNum = MAP_OVERWORLD;
 }
 
-int Savegame::mapTopLeftX() const {
-	return (_G(map)._currentMap == MAP_OVERWORLD) ? _overworldPos.x - MAP_VISIBLE_CENTER_X : 0;
-}
-
-int Savegame::mapTopLeftY() const {
-	return (_G(map)._currentMap == MAP_OVERWORLD) ? _overworldPos.y - MAP_VISIBLE_CENTER_Y : 0;
-}
-
 int Savegame::getEntityAt(int x, int y, int startingIndex) const {
 	int foundIndex = -1;
 	for (; startingIndex <= _G(overworldEntityCount) && foundIndex == -1; ++startingIndex) {
diff --git a/engines/ultima/ultima1/data/savegame.h b/engines/ultima/ultima1/data/savegame.h
index 856bcbc80a8..2ff9290f478 100644
--- a/engines/ultima/ultima1/data/savegame.h
+++ b/engines/ultima/ultima1/data/savegame.h
@@ -190,12 +190,6 @@ public:
 		return _hits <= 0;
 	}
 
-	/**
-	 * Return the X/Y of the map to start drawing
-	 */
-	int mapTopLeftX() const;
-	int mapTopLeftY() const;
-
 	/**
 	 * Checks the overworld map for an entity (creature or vechile) at a given position.
 	 * @param x		X position
diff --git a/engines/ultima/ultima1/data/tiles.cpp b/engines/ultima/ultima1/data/tiles.cpp
index a31236f1bd8..821d5842661 100644
--- a/engines/ultima/ultima1/data/tiles.cpp
+++ b/engines/ultima/ultima1/data/tiles.cpp
@@ -26,28 +26,28 @@ namespace Ultima {
 namespace Ultima1 {
 namespace Data {
 
-constexpr int BYTES_PER_ROW = 8;	// 4 planes x 2 bytes/plane = 16 pixels
-constexpr int BYTES_PER_TILE = BYTES_PER_ROW * TILE_HEIGHT;
+void loadTiles(const char *filename, Graphics::ManagedSurface *tiles, int count, int tileSize) {
+	const int BYTES_PER_ROW = tileSize / 2;		// 4 planes, so 2 pixels per byte
+	const int BYTES_PER_TILE = BYTES_PER_ROW * tileSize;
 
-void loadTiles(const char *filename, Graphics::ManagedSurface *tiles, int count) {
 	Common::File f;
-	if (!f.open("EgaTiles.Bin"))
-		error("Could not open EgaTiles.Bin");
+	if (!f.open(filename))
+		error("Could not open %s", filename);
 
-	byte data[BYTES_PER_TILE];
+	byte *data = new byte[BYTES_PER_TILE];
 
 	for (int tileNum = 0; tileNum < count; ++tileNum) {
 		if (f.read(data, BYTES_PER_TILE) != (uint32)BYTES_PER_TILE)
-			error("Unexpected end of EgaTiles.Bin");
+			error("Unexpected end of %s", filename);
 
 		Graphics::ManagedSurface &tile = tiles[tileNum];
-		tile.create(TILE_WIDTH, TILE_HEIGHT, Graphics::PixelFormat::createFormatCLUT8());
+		tile.create(tileSize, tileSize, Graphics::PixelFormat::createFormatCLUT8());
 
-		for (int y = 0; y < TILE_HEIGHT; ++y) {
+		for (int y = 0; y < tileSize; ++y) {
 			const byte *row = &data[y * BYTES_PER_ROW];
 			byte *destRow = (byte *)tile.getBasePtr(0, y);
 
-			for (int x = 0; x < TILE_WIDTH; ++x) {
+			for (int x = 0; x < tileSize; ++x) {
 				int byteIdx = x / 8;
 				int bitMask = 0x80 >> (x % 8);
 
@@ -61,6 +61,8 @@ void loadTiles(const char *filename, Graphics::ManagedSurface *tiles, int count)
 			}
 		}
 	}
+
+	delete[] data;
 }
 
 } // namespace Data
diff --git a/engines/ultima/ultima1/data/tiles.h b/engines/ultima/ultima1/data/tiles.h
index ea0058e04e3..b2b4af7a22f 100644
--- a/engines/ultima/ultima1/data/tiles.h
+++ b/engines/ultima/ultima1/data/tiles.h
@@ -30,8 +30,6 @@ namespace Data {
 
 constexpr int OVERWORLD_TILES_COUNT = 52;
 constexpr int CITY_TILES_COUNT = 51;
-constexpr int TILE_WIDTH = 16;
-constexpr int TILE_HEIGHT = 16;
 
 enum OverworldTileId {
 	TILE_OCEAN = 0,
@@ -61,8 +59,12 @@ enum OverworldTileId {
  * Loads the overworld tile sheet (52 16x16 tiles, 4-bit EGA planar,
  * row-interleaved: each 16-pixel row is 4 planes x 2 bytes) into a
  * caller-supplied array of TILE_COUNT surfaces
+ * @param filename		Filename to load
+ * @param tiles			Tiles array to load into
+ * @param count			Number of tiles
+ * @param tileSize		Width/Height of individual tiles
  */
-extern void loadTiles(const char *filename, Graphics::ManagedSurface *tiles, int count);
+extern void loadTiles(const char *filename, Graphics::ManagedSurface *tiles, int count, int size);
 
 } // namespace Data
 } // namespace Ultima1
diff --git a/engines/ultima/ultima1/logic/overworld_logic.cpp b/engines/ultima/ultima1/logic/overworld_logic.cpp
index 2f2547b38b0..9fee5cf2d90 100644
--- a/engines/ultima/ultima1/logic/overworld_logic.cpp
+++ b/engines/ultima/ultima1/logic/overworld_logic.cpp
@@ -222,6 +222,8 @@ bool OverworldLogic::moveCheck(Data::Direction dir) {
 }
 
 int OverworldLogic::getViewportX(int xp) const {
+	error("Deprecated");
+#if 0
 	int x = _G(savegame)._overworldPos.x - Data::MAP_VISIBLE_CENTER_X + xp;
 	if (x < 0)
 		x += Data::OVERWORLD_WIDTH;
@@ -229,9 +231,12 @@ int OverworldLogic::getViewportX(int xp) const {
 		x -= Data::OVERWORLD_WIDTH;
 
 	return x;
+#endif
 }
 
 int OverworldLogic::getViewportY(int yp) const {
+	error("Deprecated");
+#if 0
 	int y = _G(savegame)._overworldPos.y - Data::MAP_VISIBLE_CENTER_Y + yp;
 	if (y < 0)
 		y += Data::OVERWORLD_HEIGHT;
@@ -239,6 +244,7 @@ int OverworldLogic::getViewportY(int yp) const {
 		y -= Data::OVERWORLD_HEIGHT;
 
 	return y;
+#endif
 }
 
 void OverworldLogic::impassable(int reason) {
@@ -255,7 +261,7 @@ void OverworldLogic::moveLeft() {
 		pt.x = Data::OVERWORLD_WIDTH - 1;
 		pt.y = (pt.y >= OVERWORLD_MID_Y) ? pt.y - OVERWORLD_MID_Y : pt.y + OVERWORLD_MID_Y;
 	}
-
+#if 0
 	// Shift the existing columns right by one, to make room for a new
 	// column of tiles at the left edge
 	auto &tiles = _G(map)._mapTilesId;
@@ -270,6 +276,7 @@ void OverworldLogic::moveLeft() {
 		int y = getViewportY(row);
 		tiles[row][0] = _G(map).getMapTile(x, y);
 	}
+#endif
 }
 
 void OverworldLogic::moveRight() {
@@ -281,7 +288,7 @@ void OverworldLogic::moveRight() {
 		pt.y = (pt.y >= OVERWORLD_MID_Y) ? pt.y - OVERWORLD_MID_Y : pt.y + OVERWORLD_MID_Y;
 		pt.x = 0;
 	}
-
+#if 0
 	// Shift the existing columns left by one, to make room for a new
 	// column of tiles at the right edge
 	auto &tiles = _G(map)._mapTilesId;
@@ -296,13 +303,14 @@ void OverworldLogic::moveRight() {
 		int y = getViewportY(row);
 		tiles[row][Data::MAP_VISIBLE_WIDTH - 1] = _G(map).getMapTile(x, y);
 	}
+#endif
 }
 
 void OverworldLogic::moveUp() {
 	// Change overworld position
 	Common::Point &pt = _G(savegame)._overworldPos;
 	pt.y = (pt.y == 0) ? Data::OVERWORLD_HEIGHT - 1 : pt.y - 1;
-
+#if 0
 	// Shift the existing rows down by one, to make room for a new
 	// row of tiles at the top edge
 	auto &tiles = _G(map)._mapTilesId;
@@ -317,13 +325,14 @@ void OverworldLogic::moveUp() {
 		int y = getViewportY(0);
 		tiles[0][col] = _G(map).getMapTile(x, y);
 	}
+#endif
 }
 
 void OverworldLogic::moveDown() {
 	// Change overworld position
 	Common::Point &pt = _G(savegame)._overworldPos;
 	pt.y = (pt.y == Data::OVERWORLD_HEIGHT - 1) ? 0 : pt.y + 1;
-
+#if 0
 	// Shift the existing rows up by one, to make room for a new
 	// row of tiles at the bottom edge
 	auto &tiles = _G(map)._mapTilesId;
@@ -338,6 +347,7 @@ void OverworldLogic::moveDown() {
 		int y = getViewportY(Data::MAP_VISIBLE_HEIGHT - 1);
 		tiles[Data::MAP_VISIBLE_HEIGHT - 1][col] = _G(map).getMapTile(x, y);
 	}
+#endif
 }
 
 void OverworldLogic::continentChanged(int oldContinent) {
@@ -366,6 +376,7 @@ void OverworldLogic::endOfTurn() {
 }
 
 void OverworldLogic::generateCreatures() {
+	const Common::Point &pos = _G(savegame)._overworldPos;
 	int randomVal = getRandomNumber(1, 255);
 	// Character level (experience / 1000), clamped to the table's bounds
 	int level = MIN(_G(savegame)._experience / 1000, 9);
@@ -404,8 +415,8 @@ void OverworldLogic::generateCreatures() {
 		if (getRandomNumber(1, 16) & 1)
 			yOff = -yOff;
 
-		x = getViewportX(xOff + Data::MAP_VISIBLE_CENTER_X);
-		y = getViewportY(yOff + Data::MAP_VISIBLE_CENTER_Y);
+		x = pos.x + xOff;	// getViewportX(xOff + Data::OVERWORLD_VISIBLE_CENTER_X);
+		y = pos.y + yOff;	// getViewportY(yOff + Data::OVERWORLD_VISIBLE_CENTER_Y);
 		tileAtSpot = _G(map).getTileAt(x, y);
 
 		rangeOk = _G(map).mapRangeCheckX(x) && _G(map).mapRangeCheckY(y);
diff --git a/engines/ultima/ultima1/views/location_map.cpp b/engines/ultima/ultima1/views/location_map.cpp
index 55e62e2e614..98ce2180c7d 100644
--- a/engines/ultima/ultima1/views/location_map.cpp
+++ b/engines/ultima/ultima1/views/location_map.cpp
@@ -27,6 +27,11 @@ namespace Ultima {
 namespace Ultima1 {
 namespace Views {
 
+constexpr int TILE_WIDTH = 8;
+constexpr int TILE_HEIGHT = 8;
+constexpr int MAP_VISIBLE_WIDTH = 38;
+constexpr int MAP_VISIBLE_HEIGHT = 18;
+
 bool LocationMap::msgFocus(const FocusMessage &msg) {
 	delayFrames(1);
 	return UIElement::msgFocus(msg);
@@ -44,53 +49,29 @@ void LocationMap::timeout() {
 	delayFrames(1);
 }
 
-int LocationMap::animatedTileId(byte tileId) const {
-	return tileId;
-}
-
 void LocationMap::draw() {
-	Dialog::draw();
-
 	auto &map = g_engine->_map;
 	const Graphics::ManagedSurface *tiles = map.tiles();
 	auto s = getSurface();
+	const auto &pos = _G(savegame)._locationPosition;
 
-	prepareMapForDrawing();
+	Dialog::draw();
 
 	// Draw the visible map contents
-	for (int oy = 0; oy < Data::MAP_VISIBLE_HEIGHT; oy++) {
-		for (int ox = 0; ox < Data::MAP_VISIBLE_WIDTH; ox++) {
-			int tileId = animatedTileId(map._mapTilesId[oy][ox]);
-			if (tileId != -1) {
-				const Graphics::ManagedSurface &tileImg = tiles[(tileId >= 50) ? 1 : tileId];
-				s.blitFrom(tileImg, Common::Point(ox * Data::TILE_WIDTH + 8, oy * Data::TILE_HEIGHT + 8));
+	for (int oy = 0; oy < MAP_VISIBLE_HEIGHT; oy++) {
+		for (int ox = 0; ox < MAP_VISIBLE_WIDTH; ox++) {
+			int tileId = (ox == pos.x && oy == pos.y) ? 10 : _G(map).getTileAt(ox, oy);
+			if (tileId >= 50)
+				tileId = 1;
+
+			if (tileId) {
+				const Graphics::ManagedSurface &tileImg = tiles[tileId - 1];
+				s.blitFrom(tileImg, Common::Point(ox * TILE_WIDTH + 8, oy * TILE_HEIGHT + 8));
 			}
 		}
 	}
 }
 
-void LocationMap::prepareMapForDrawing() {
-	auto &map = g_engine->_map;
-
-	// Get the map tiles. Unlike in the overworld, where the visible map is centered around the player,
-	// location maps are always on-screen in their entirety
-	for (int oy = 0; oy < Data::MAP_VISIBLE_HEIGHT; oy++) {
-		for (int ox = 0; ox < Data::MAP_VISIBLE_WIDTH; ox++) {
-			map._mapTilesId[oy][ox] = _G(map).getTileAt(ox, oy);
-		}
-	}
-
-	// Player is at center of the viewport. Save tiles around the player
-	map._tilePlayerCenter = map._mapTilesId[Data::MAP_VISIBLE_CENTER_Y][Data::MAP_VISIBLE_CENTER_X];
-	map._tilePlayerUp = map._mapTilesId[Data::MAP_VISIBLE_CENTER_Y - 1][Data::MAP_VISIBLE_CENTER_X];
-	map._tilePlayerDown = map._mapTilesId[Data::MAP_VISIBLE_CENTER_Y + 1][Data::MAP_VISIBLE_CENTER_X];
-	map._tilePlayerLeft = map._mapTilesId[Data::MAP_VISIBLE_CENTER_Y][Data::MAP_VISIBLE_CENTER_X - 1];
-	map._tilePlayerRight = map._mapTilesId[Data::MAP_VISIBLE_CENTER_Y][Data::MAP_VISIBLE_CENTER_X + 1];
-
-	// Place the player tile at the center
-	map._mapTilesId[Data::MAP_VISIBLE_CENTER_Y][Data::MAP_VISIBLE_CENTER_X] = map._playerTileId;
-}
-
 } // namespace Views
 } // namespace Ultima1
 } // namespace Ultima
diff --git a/engines/ultima/ultima1/views/location_map.h b/engines/ultima/ultima1/views/location_map.h
index 4c53e3a54ce..4b332ea9ee0 100644
--- a/engines/ultima/ultima1/views/location_map.h
+++ b/engines/ultima/ultima1/views/location_map.h
@@ -31,19 +31,6 @@ namespace Views {
 using namespace Shared::Messages;
 
 class LocationMap : public Dialog {
-private:
-	int _animIndex = 0;
-
-	void prepareMapForDrawing();
-
-	/**
-	 * Returns the tile to draw for a given raw map tile, substituting
-	 * in the appropriate animation frame for the castle and city flags.
-	 * Returns -1 if the tile shouldn't be redrawn this tick (the castle
-	 * flag is only redrawn on 2 of every 6 ticks)
-	 */
-	int animatedTileId(byte tileId) const;
-
 public:
 	LocationMap() : Dialog("LocationMap") {}
 	~LocationMap() override {}
diff --git a/engines/ultima/ultima1/views/overworld_map.cpp b/engines/ultima/ultima1/views/overworld_map.cpp
index f9a98426475..41849d865fc 100644
--- a/engines/ultima/ultima1/views/overworld_map.cpp
+++ b/engines/ultima/ultima1/views/overworld_map.cpp
@@ -27,6 +27,9 @@ namespace Ultima {
 namespace Ultima1 {
 namespace Views {
 
+constexpr int TILE_WIDTH = 16;
+constexpr int TILE_HEIGHT = 16;
+
 bool OverworldMap::msgFocus(const FocusMessage &msg) {
 	MetaEngine::setKeybindingMode(KBMODE_OVERWORLD);
 	delayFrames(1);
@@ -50,16 +53,16 @@ void OverworldMap::timeout() {
 void OverworldMap::animateWater() {
 	const Graphics::ManagedSurface *tiles = _G(map).tiles();
 	const Graphics::ManagedSurface &tile = tiles[Data::TILE_OCEAN];
-	assert(tile.w == Data::TILE_WIDTH && tile.h == Data::TILE_HEIGHT);
+	assert(tile.w == TILE_WIDTH && tile.h == TILE_HEIGHT);
 
-	byte lastRow[Data::TILE_WIDTH];
+	byte lastRow[TILE_WIDTH];
 	byte *pixels = (byte *)tile.getPixels();
 
 	// The bottom row wraps around to become the new top row, with
 	// every other row shifting down by one to make way for it
-	memcpy(lastRow, pixels + (Data::TILE_HEIGHT - 1) * Data::TILE_WIDTH, Data::TILE_WIDTH);
-	memmove(pixels + Data::TILE_WIDTH, pixels, (Data::TILE_HEIGHT - 1) * Data::TILE_WIDTH);
-	memcpy(pixels, lastRow, Data::TILE_WIDTH);
+	memcpy(lastRow, pixels + (TILE_HEIGHT - 1) * TILE_WIDTH, TILE_WIDTH);
+	memmove(pixels + TILE_WIDTH, pixels, (TILE_HEIGHT - 1) * TILE_WIDTH);
+	memcpy(pixels, lastRow, TILE_WIDTH);
 }
 
 int OverworldMap::animatedTileId(byte tileId) const {
@@ -85,12 +88,12 @@ void OverworldMap::draw() {
 	prepareMapForDrawing();
 
 	// Draw the visible map contents
-	for (int oy = 0; oy < Data::MAP_VISIBLE_HEIGHT; oy++) {
-		for (int ox = 0; ox < Data::MAP_VISIBLE_WIDTH; ox++) {
-			int tileId = animatedTileId(map._mapTilesId[oy][ox]);
+	for (int oy = 0; oy < Data::OVERWORLD_VISIBLE_HEIGHT; oy++) {
+		for (int ox = 0; ox < Data::OVERWORLD_VISIBLE_WIDTH; ox++) {
+			int tileId = animatedTileId(_mapTilesId[oy][ox]);
 			if (tileId != -1) {
 				const Graphics::ManagedSurface &tileImg = tiles[tileId];
-				s.blitFrom(tileImg, Common::Point(ox * Data::TILE_WIDTH + 8, oy * Data::TILE_HEIGHT + 8));
+				s.blitFrom(tileImg, Common::Point(ox * TILE_WIDTH + 8, oy * TILE_HEIGHT + 8));
 			}
 		}
 	}
@@ -98,29 +101,27 @@ void OverworldMap::draw() {
 
 void OverworldMap::prepareMapForDrawing() {
 	auto &map = g_engine->_map;
-	int mapLeft, mapTop;
-
-	mapLeft = _G(savegame).mapTopLeftX();
-	mapTop = _G(savegame).mapTopLeftY();
+	int mapLeft = _G(savegame)._overworldPos.x - Data::OVERWORLD_VISIBLE_CENTER_X;
+	int mapTop = _G(savegame)._overworldPos.y - Data::OVERWORLD_VISIBLE_CENTER_Y;
 
-	for (int oy = 0; oy < Data::MAP_VISIBLE_HEIGHT; oy++) {
-		for (int ox = 0; ox < Data::MAP_VISIBLE_WIDTH; ox++) {
+	for (int oy = 0; oy < Data::OVERWORLD_VISIBLE_HEIGHT; oy++) {
+		for (int ox = 0; ox < Data::OVERWORLD_VISIBLE_WIDTH; ox++) {
 			int x = mapLeft + ox;
 			int y = mapTop + oy;
 
-			map._mapTilesId[oy][ox] = _G(map).getTileAt(x, y);
+			_mapTilesId[oy][ox] = _G(map).getTileAt(x, y);
 		}
 	}
 
 	// Player is at center of the viewport. Save tiles around the player
-	map._tilePlayerCenter = map._mapTilesId[Data::MAP_VISIBLE_CENTER_Y][Data::MAP_VISIBLE_CENTER_X];
-	map._tilePlayerUp = map._mapTilesId[Data::MAP_VISIBLE_CENTER_Y - 1][Data::MAP_VISIBLE_CENTER_X];
-	map._tilePlayerDown = map._mapTilesId[Data::MAP_VISIBLE_CENTER_Y + 1][Data::MAP_VISIBLE_CENTER_X];
-	map._tilePlayerLeft = map._mapTilesId[Data::MAP_VISIBLE_CENTER_Y][Data::MAP_VISIBLE_CENTER_X - 1];
-	map._tilePlayerRight = map._mapTilesId[Data::MAP_VISIBLE_CENTER_Y][Data::MAP_VISIBLE_CENTER_X + 1];
+	map._tilePlayerCenter = _mapTilesId[Data::OVERWORLD_VISIBLE_CENTER_Y][Data::OVERWORLD_VISIBLE_CENTER_X];
+	map._tilePlayerUp = _mapTilesId[Data::OVERWORLD_VISIBLE_CENTER_Y - 1][Data::OVERWORLD_VISIBLE_CENTER_X];
+	map._tilePlayerDown = _mapTilesId[Data::OVERWORLD_VISIBLE_CENTER_Y + 1][Data::OVERWORLD_VISIBLE_CENTER_X];
+	map._tilePlayerLeft = _mapTilesId[Data::OVERWORLD_VISIBLE_CENTER_Y][Data::OVERWORLD_VISIBLE_CENTER_X - 1];
+	map._tilePlayerRight = _mapTilesId[Data::OVERWORLD_VISIBLE_CENTER_Y][Data::OVERWORLD_VISIBLE_CENTER_X + 1];
 
 	// Place the player tile at the center
-	map._mapTilesId[Data::MAP_VISIBLE_CENTER_Y][Data::MAP_VISIBLE_CENTER_X] = map._playerTileId;
+	_mapTilesId[Data::OVERWORLD_VISIBLE_CENTER_Y][Data::OVERWORLD_VISIBLE_CENTER_X] = map._playerTileId;
 }
 
 } // namespace Views
diff --git a/engines/ultima/ultima1/views/overworld_map.h b/engines/ultima/ultima1/views/overworld_map.h
index e410b832d30..a9e55f6741e 100644
--- a/engines/ultima/ultima1/views/overworld_map.h
+++ b/engines/ultima/ultima1/views/overworld_map.h
@@ -23,6 +23,7 @@
 #define ULTIMA1_VIEWS_OVERWORLD_MAP_H
 
 #include "ultima/ultima1/views/dialog.h"
+#include "ultima/ultima1/data/map.h"
 
 namespace Ultima {
 namespace Ultima1 {
@@ -32,6 +33,8 @@ using namespace Shared::Messages;
 
 class OverworldMap : public Dialog {
 private:
+	typedef byte VisibleTiles[Data::OVERWORLD_VISIBLE_HEIGHT][Data::OVERWORLD_VISIBLE_WIDTH];
+	VisibleTiles _mapTilesId = {};		// Calculated visible on-screen tiles
 	int _animIndex = 0;
 
 	void prepareMapForDrawing();


Commit: 2f79c7ac8b4643bba38ffecf2fb15a0102867585
    https://github.com/scummvm/scummvm/commit/2f79c7ac8b4643bba38ffecf2fb15a0102867585
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:40:48+11:00

Commit Message:
ULTIMA: ULTIMA1: Further fixes to city map loading

Changed paths:
    engines/ultima/ultima1/data/map.cpp
    engines/ultima/ultima1/data/tiles.cpp
    engines/ultima/ultima1/data/tiles.h
    engines/ultima/ultima1/views/location_map.cpp


diff --git a/engines/ultima/ultima1/data/map.cpp b/engines/ultima/ultima1/data/map.cpp
index 298bd8fd8d1..35824463667 100644
--- a/engines/ultima/ultima1/data/map.cpp
+++ b/engines/ultima/ultima1/data/map.cpp
@@ -136,22 +136,11 @@ void Map::load(int mapNum) {
 		_outsideMapTile = 0xff;
 		_tiles = _overworldTiles;
 
-		_mapRows.clear();
-		_mapRows.reserve(OVERWORLD_HEIGHT);
-		for (int y = 0; y < OVERWORLD_HEIGHT; ++y)
-			_mapRows.push_back(Row(this, &_overworldMap[y * OVERWORLD_WIDTH]));
-
 	} else {
 		_mapWidth = CITY_WIDTH;
 		_mapHeight = CITY_HEIGHT;
-		_outsideMapTile = 0;
+		_outsideMapTile = LOCTILE_WALL;
 		_tiles = _cityTiles;
-
-		_mapRows.clear();
-		_mapRows.reserve(CITY_HEIGHT + 1);		// One extra row for out-of-bounds y access
-		for (int y = 0; y < CITY_HEIGHT; ++y)
-			_mapRows.push_back(Row(this, &_cityMap[mapNum - 1][y * CITY_WIDTH]));
-		_mapRows.push_back(Row(this, nullptr));
 	}
 
 	// Set up copies of the map position and player tile to use
@@ -179,6 +168,19 @@ void Map::load(int mapNum) {
 		viewName = "LocationMap";
 	}
 
+	// Set up the map row pointers
+	_mapRows.clear();
+	if (_currentMap == MAP_OVERWORLD) {
+		_mapRows.reserve(OVERWORLD_HEIGHT);
+		for (int y = 0; y < OVERWORLD_HEIGHT; ++y)
+			_mapRows.push_back(Row(this, &_overworldMap[y * OVERWORLD_WIDTH]));
+	} else {
+		_mapRows.reserve(CITY_HEIGHT + 1);		// One extra row for out-of-bounds y access
+		for (int y = 0; y < CITY_HEIGHT; ++y)
+			_mapRows.push_back(Row(this, &_cityMap[_mapStyle][y * CITY_WIDTH]));
+		_mapRows.push_back(Row(this, nullptr));
+	}
+
 	// If the focused view isn't already a dialog under the game frame, then reset to the game
 	// frame and draw it immediately
 	Views::Dialog *view = dynamic_cast<Views::Dialog *>(g_engine->focusedView());
@@ -197,8 +199,12 @@ void Map::load(int mapNum) {
 int Map::getMapTile(int x, int y) const {
 	int tile = (*this)[y][x];
 
-	// I honestly have no idea what this does
-	if (tile > TILE_CASTLE1) {
+	// Raw overworld map data skips the castle/city flag animation frames
+	// (TILE_CASTLE2/TILE_CITY2), which are only ever substituted in at
+	// draw time and never stored in the map itself. This doesn't apply
+	// to city/castle map data, which uses a completely different,
+	// contiguous tile ID space (see the Town.bin tile table)
+	if (_currentMap == MAP_OVERWORLD && tile > TILE_CASTLE1) {
 		++tile;
 		if (tile == TILE_CITY2)
 			++tile;
diff --git a/engines/ultima/ultima1/data/tiles.cpp b/engines/ultima/ultima1/data/tiles.cpp
index 821d5842661..56c1a344d0c 100644
--- a/engines/ultima/ultima1/data/tiles.cpp
+++ b/engines/ultima/ultima1/data/tiles.cpp
@@ -28,6 +28,7 @@ namespace Data {
 
 void loadTiles(const char *filename, Graphics::ManagedSurface *tiles, int count, int tileSize) {
 	const int BYTES_PER_ROW = tileSize / 2;		// 4 planes, so 2 pixels per byte
+	const int BYTES_PER_PLANE_ROW = BYTES_PER_ROW / 4;	// bytes per row, within a single plane
 	const int BYTES_PER_TILE = BYTES_PER_ROW * tileSize;
 
 	Common::File f;
@@ -53,7 +54,7 @@ void loadTiles(const char *filename, Graphics::ManagedSurface *tiles, int count,
 
 				byte colorIndex = 0;
 				for (int plane = 0; plane < 4; ++plane) {
-					if (row[plane * 2 + byteIdx] & bitMask)
+					if (row[plane * BYTES_PER_PLANE_ROW + byteIdx] & bitMask)
 						colorIndex |= (1 << plane);
 				}
 
diff --git a/engines/ultima/ultima1/data/tiles.h b/engines/ultima/ultima1/data/tiles.h
index b2b4af7a22f..9bbf4342505 100644
--- a/engines/ultima/ultima1/data/tiles.h
+++ b/engines/ultima/ultima1/data/tiles.h
@@ -55,6 +55,11 @@ enum OverworldTileId {
 	TILE_LAST_MONSTER = 47
 };
 
+enum LocationTileId {
+	LOCTILE_WALL = 0,
+	LOCTILE_PLAYER = 18
+};
+
 /**
  * Loads the overworld tile sheet (52 16x16 tiles, 4-bit EGA planar,
  * row-interleaved: each 16-pixel row is 4 planes x 2 bytes) into a
diff --git a/engines/ultima/ultima1/views/location_map.cpp b/engines/ultima/ultima1/views/location_map.cpp
index 98ce2180c7d..bf55d41c05a 100644
--- a/engines/ultima/ultima1/views/location_map.cpp
+++ b/engines/ultima/ultima1/views/location_map.cpp
@@ -60,16 +60,18 @@ void LocationMap::draw() {
 	// Draw the visible map contents
 	for (int oy = 0; oy < MAP_VISIBLE_HEIGHT; oy++) {
 		for (int ox = 0; ox < MAP_VISIBLE_WIDTH; ox++) {
-			int tileId = (ox == pos.x && oy == pos.y) ? 10 : _G(map).getTileAt(ox, oy);
-			if (tileId >= 50)
+			int tileId = _G(map).getTileAt(ox, oy);
+			if (tileId >= Data::CITY_TILES_COUNT)
 				tileId = 1;
 
-			if (tileId) {
-				const Graphics::ManagedSurface &tileImg = tiles[tileId - 1];
-				s.blitFrom(tileImg, Common::Point(ox * TILE_WIDTH + 8, oy * TILE_HEIGHT + 8));
-			}
+			const Graphics::ManagedSurface &tileImg = tiles[tileId];
+			s.blitFrom(tileImg, Common::Point(ox * TILE_WIDTH + 8, oy * TILE_HEIGHT + 8));
 		}
 	}
+
+	// Draw the player
+	const Graphics::ManagedSurface &tileImg = tiles[Data::LOCTILE_PLAYER];
+	s.blitFrom(tileImg, Common::Point(pos.x * TILE_WIDTH + 8, pos.y * TILE_HEIGHT + 8));
 }
 
 } // namespace Views


Commit: 71f6680162c693c537cecaeb030a5d9d6f02f40b
    https://github.com/scummvm/scummvm/commit/71f6680162c693c537cecaeb030a5d9d6f02f40b
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:40:48+11:00

Commit Message:
ULTIMA: ULTIMA1: Add rendering of location NPCs

Changed paths:
    engines/ultima/ultima1/views/location_map.cpp


diff --git a/engines/ultima/ultima1/views/location_map.cpp b/engines/ultima/ultima1/views/location_map.cpp
index bf55d41c05a..f2254e674bc 100644
--- a/engines/ultima/ultima1/views/location_map.cpp
+++ b/engines/ultima/ultima1/views/location_map.cpp
@@ -69,6 +69,14 @@ void LocationMap::draw() {
 		}
 	}
 
+	// Draw any people in the location
+	for (const auto &entity : _G(savegame)._locationEntities) {
+		if (entity._type != -1) {
+			const Graphics::ManagedSurface &tileImg = tiles[entity._type];
+			s.blitFrom(tileImg, Common::Point(entity._position.x * TILE_WIDTH + 8, entity._position.y * TILE_HEIGHT + 8));
+		}
+	}
+	
 	// Draw the player
 	const Graphics::ManagedSurface &tileImg = tiles[Data::LOCTILE_PLAYER];
 	s.blitFrom(tileImg, Common::Point(pos.x * TILE_WIDTH + 8, pos.y * TILE_HEIGHT + 8));


Commit: 44292f8ddcd79dfc99d8751af217ff788fab6470
    https://github.com/scummvm/scummvm/commit/44292f8ddcd79dfc99d8751af217ff788fab6470
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:40:48+11:00

Commit Message:
ULTIMA: ULTIMA1: Implementing city movement

Changed paths:
    engines/ultima/ultima0/metaengine.cpp
    engines/ultima/ultima1/data/map.cpp
    engines/ultima/ultima1/data/savegame.cpp
    engines/ultima/ultima1/data/savegame.h
    engines/ultima/ultima1/data/tiles.h
    engines/ultima/ultima1/logic/city_castle_logic.cpp
    engines/ultima/ultima1/logic/city_castle_logic.h
    engines/ultima/ultima1/logic/logic.cpp
    engines/ultima/ultima1/logic/logic.h
    engines/ultima/ultima1/logic/overworld_logic.cpp
    engines/ultima/ultima1/logic/overworld_logic.h
    engines/ultima/ultima1/metaengine.cpp
    engines/ultima/ultima1/metaengine.h
    engines/ultima/ultima1/views/game.cpp
    engines/ultima/ultima1/views/game.h
    engines/ultima/ultima1/views/location_map.cpp
    engines/ultima/ultima1/views/overworld_map.cpp


diff --git a/engines/ultima/ultima0/metaengine.cpp b/engines/ultima/ultima0/metaengine.cpp
index 749d1d0b871..d06ed74a970 100644
--- a/engines/ultima/ultima0/metaengine.cpp
+++ b/engines/ultima/ultima0/metaengine.cpp
@@ -113,7 +113,7 @@ static const KeysRecord MENU_RECORDS[] = {
 	{ nullptr, nullptr, nullptr }
 };
 
-static const KeysRecord OVERWORLD_RECORDS[] = {
+static const KeysRecord GAMEPLAY_RECORDS[] = {
 	{ "ultima0", _s("Basic keys"), MINIMAL_KEYS },
 	{ "overworld", _s("Overworld keys"), OVERWORLD_KEYS },
 	{ nullptr, nullptr, nullptr }
@@ -129,7 +129,7 @@ static const KeysRecord *MODE_RECORDS[] = {
 	ALL_RECORDS,
 	MINIMAL_RECORDS,
 	MENU_RECORDS,
-	OVERWORLD_RECORDS,
+	GAMEPLAY_RECORDS,
 	DUNGEON_RECORDS,
 };
 
diff --git a/engines/ultima/ultima1/data/map.cpp b/engines/ultima/ultima1/data/map.cpp
index 35824463667..412e826366f 100644
--- a/engines/ultima/ultima1/data/map.cpp
+++ b/engines/ultima/ultima1/data/map.cpp
@@ -139,7 +139,7 @@ void Map::load(int mapNum) {
 	} else {
 		_mapWidth = CITY_WIDTH;
 		_mapHeight = CITY_HEIGHT;
-		_outsideMapTile = LOCTILE_WALL;
+		_outsideMapTile = CTILE_BLANK;
 		_tiles = _cityTiles;
 	}
 
@@ -214,10 +214,17 @@ int Map::getMapTile(int x, int y) const {
 }
 
 int Map::getTileAt(int x, int y, int creatureIndex) const {
-	int entityIndex = _G(savegame).getEntityAt(x, y, creatureIndex);
+	int entityIndex;
 
-	if (entityIndex >= 0)
-		return _G(savegame)._overworldEntities[entityIndex]._type;
+	if (_mapType == MAPTYPE_OVERWORLD) {
+		entityIndex = _G(savegame).getOverworldEntityAt(x, y, creatureIndex);
+		if (entityIndex >= 0)
+			return _G(savegame)._overworldEntities[entityIndex]._type;
+	} else {
+		entityIndex = _G(savegame).getLocationEntityAt(x, y);
+		if (entityIndex >= 0)
+			return _G(savegame)._locationEntities[entityIndex]._type;
+	}
 
 	return _G(map).getMapTile(x, y);
 }
diff --git a/engines/ultima/ultima1/data/savegame.cpp b/engines/ultima/ultima1/data/savegame.cpp
index 4abfb8bff47..35986995aca 100644
--- a/engines/ultima/ultima1/data/savegame.cpp
+++ b/engines/ultima/ultima1/data/savegame.cpp
@@ -117,7 +117,7 @@ void Savegame::synchronizeOriginal(Common::Serializer &s) {
 	_mapNum = MAP_OVERWORLD;
 }
 
-int Savegame::getEntityAt(int x, int y, int startingIndex) const {
+int Savegame::getOverworldEntityAt(int x, int y, int startingIndex) const {
 	int foundIndex = -1;
 	for (; startingIndex <= _G(overworldEntityCount) && foundIndex == -1; ++startingIndex) {
 		const auto &e = _overworldEntities[startingIndex];
@@ -128,8 +128,8 @@ int Savegame::getEntityAt(int x, int y, int startingIndex) const {
 	return foundIndex;
 }
 
-void Savegame::removeCreatureAt(int x, int y) {
-	int creatureNum = getEntityAt(x, y, 1);
+void Savegame::removeOverworldCreatureAt(int x, int y) {
+	int creatureNum = getOverworldEntityAt(x, y, 1);
 	if (creatureNum <= 0)
 		return;
 
@@ -140,6 +140,16 @@ void Savegame::removeCreatureAt(int x, int y) {
 	--_G(overworldEntityCount);
 }
 
+int Savegame::getLocationEntityAt(int x, int y) const {
+	int foundIndex = -1;
+	for (int startingIndex = 1; startingIndex < LOCATION_ENTITY_COUNT && foundIndex == -1; ++startingIndex) {
+		const auto &e = _locationEntities[startingIndex];
+		if (e._position.x == x && e._position.y == y)
+			foundIndex = startingIndex;
+	}
+
+	return foundIndex;
+}
 
 } // namespace Data
 } // namespace Ultima1
diff --git a/engines/ultima/ultima1/data/savegame.h b/engines/ultima/ultima1/data/savegame.h
index 2ff9290f478..2373c3213fb 100644
--- a/engines/ultima/ultima1/data/savegame.h
+++ b/engines/ultima/ultima1/data/savegame.h
@@ -197,12 +197,17 @@ public:
 	 * @param startingIndex		Starting index array
 	 * @return 
 	*/
-	int getEntityAt(int x, int y, int startingIndex = 1) const;
+	int getOverworldEntityAt(int x, int y, int startingIndex = 1) const;
 
 	/**
 	 * Removes a creature from a given X/Y position on the map
 	 */
-	void removeCreatureAt(int x, int y);
+	void removeOverworldCreatureAt(int x, int y);
+
+	/**
+	 * Return the index of any NPC at a gien x, y position within a location
+	 */
+	int getLocationEntityAt(int x, int y) const;
 };
 
 } // namespace Data
diff --git a/engines/ultima/ultima1/data/tiles.h b/engines/ultima/ultima1/data/tiles.h
index 9bbf4342505..5565e3c41f7 100644
--- a/engines/ultima/ultima1/data/tiles.h
+++ b/engines/ultima/ultima1/data/tiles.h
@@ -56,8 +56,11 @@ enum OverworldTileId {
 };
 
 enum LocationTileId {
-	LOCTILE_WALL = 0,
-	LOCTILE_PLAYER = 18
+	CTILE_WALL = 0,
+	CTILE_GROUND = 1,
+	CTILE_PLAYER = 18,
+	CTILE_GUARD_MB = 51,
+	CTILE_BLANK = 63
 };
 
 /**
diff --git a/engines/ultima/ultima1/logic/city_castle_logic.cpp b/engines/ultima/ultima1/logic/city_castle_logic.cpp
index 55a3f069ad6..aa8f7d529d8 100644
--- a/engines/ultima/ultima1/logic/city_castle_logic.cpp
+++ b/engines/ultima/ultima1/logic/city_castle_logic.cpp
@@ -117,16 +117,45 @@ static const Data::LocationEntity CITY_WIDGETS[LOCATION_STYLE_COUNT][Data::LOCAT
 	}
 };
 
+static const int8 DELTA_X[5] = { 0, -1, 1, 0, 0 };
+static const int8 DELTA_Y[5] = { 0, 0, 0, -1, 1 };
+
+
 void CityCastleLogic::enter() {
 	loadEntities();
 }
 
 void CityCastleLogic::action(int action) {
-	// TODO
+	switch (action) {
+	case KEYBIND_UP:
+		move(Data::DIR_UP);
+		break;
+	case KEYBIND_DOWN:
+		move(Data::DIR_DOWN);
+		break;
+	case KEYBIND_LEFT:
+		move(Data::DIR_LEFT);
+		break;
+	case KEYBIND_RIGHT:
+		move(Data::DIR_RIGHT);
+		break;
+	case KEYBIND_ENTER:
+		enter();
+		break;
+	case KEYBIND_PASS:
+		pass();
+		break;
+	default:
+		writeString("Huh?\n");
+		break;
+	}
+
+	endOfTurn();
 }
 
 void CityCastleLogic::keypress(Common::KeyCode keycode) {
-	action(KEYBIND_PASS);
+	writeString("Huh?\n");
+	endOfTurn();
 }
 
 void CityCastleLogic::loadEntities() {
@@ -138,6 +167,10 @@ void CityCastleLogic::loadEntities() {
 		savegame._locationEntities[idx] = widgets[idx];
 }
 
+void CityCastleLogic::pass() {
+	writeString("Pass\n");
+}
+
 /*-------------------------------------------------------------------*/
 
 CityLogic::CityLogic() {
@@ -151,6 +184,46 @@ void CityLogic::enter() {
 	CityCastleLogic::enter();
 }
 
+void CityLogic::move(Data::Direction dir) {
+	const int deltaX = DELTA_X[dir];
+	const int deltaY = DELTA_Y[dir];
+	const int x = _G(savegame)._locationPosition.x + deltaX;
+	const int y = _G(savegame)._locationPosition.y + deltaY;
+
+	if (x < 0 || y < 0 || x >= Data::CITY_WIDTH || y >= Data::CITY_HEIGHT) {
+		// Left the bounds of the map, returning to the overworld
+		_G(map).load(Data::MAP_OVERWORLD);
+	} else {
+		int tile = checkAt(x, y);
+
+		if (tile == -1 || tile == Data::CTILE_BLANK) {
+			// Write direction traveled
+			writeString(Common::String::format("%s\n", Data::DIRECTION_NAMES[dir]));
+
+			_G(savegame)._locationPosition = Common::Point(x, y);
+			playFX(1);
+			redrawMap();
+			
+		} else {
+			// Can't move in that direction
+			writeString("Blocked!\n");
+			playFX(1);
+		}
+	}
+}
+
+int CityLogic::checkAt(int x, int y) const {
+	int tile = _G(map).getTileAt(x, y);
+	if (tile == Data::CTILE_BLANK)
+		return tile;
+
+	if (tile == Data::CTILE_GROUND || tile >= Data::CTILE_GUARD_MB)
+		return -1;
+
+	return 0;
+}
+
+
 /*-------------------------------------------------------------------*/
 
 CastleLogic::CastleLogic() {
diff --git a/engines/ultima/ultima1/logic/city_castle_logic.h b/engines/ultima/ultima1/logic/city_castle_logic.h
index c12c1906838..0b6b69feb6e 100644
--- a/engines/ultima/ultima1/logic/city_castle_logic.h
+++ b/engines/ultima/ultima1/logic/city_castle_logic.h
@@ -31,8 +31,21 @@ namespace Logic {
 
 class CityCastleLogic : public Logic {
 protected:
+	/**
+	 * Load the NPCs for the given location
+	 */
 	void loadEntities();
 
+	/**
+	 * Handle movement
+	 */
+	virtual void move(Data::Direction dir) = 0;
+
+	/**
+	 * Pass a turn
+	 */
+	void pass();
+
 public:
 	~CityCastleLogic() override {
 	}
@@ -43,6 +56,17 @@ public:
 };
 
 class CityLogic : public CityCastleLogic {
+protected:
+	/**
+	 * Handle movement
+	 */
+	void move(Data::Direction dir) override;
+
+	/**
+	 * Checks if the player can move to a given location
+	 */
+	int checkAt(int x, int y) const;
+
 public:
 	CityLogic();
 	~CityLogic() override {
@@ -52,6 +76,13 @@ public:
 };
 
 class CastleLogic : public CityCastleLogic {
+protected:
+	/**
+	 * Handle movement
+	 */
+	void move(Data::Direction dir) override {
+	}
+
 public:
 	CastleLogic();
 	~CastleLogic() override {
diff --git a/engines/ultima/ultima1/logic/logic.cpp b/engines/ultima/ultima1/logic/logic.cpp
index f43e8f5deb9..56f9815c092 100644
--- a/engines/ultima/ultima1/logic/logic.cpp
+++ b/engines/ultima/ultima1/logic/logic.cpp
@@ -57,6 +57,14 @@ int Logic::getRandomNumber(int maxNumber) {
 	return g_engine->getRandomNumber(maxNumber);
 }
 
+void Logic::endOfTurn() {
+	_G(moveCtr)++;
+
+	redrawMap();
+	redrawStats();
+	prompt();
+}
+
 } // namespace Logic
 } // namespace Ultima1
 } // namespace Ultima
diff --git a/engines/ultima/ultima1/logic/logic.h b/engines/ultima/ultima1/logic/logic.h
index 1bc5e23342d..06b0060a4ea 100644
--- a/engines/ultima/ultima1/logic/logic.h
+++ b/engines/ultima/ultima1/logic/logic.h
@@ -67,6 +67,11 @@ protected:
 	 */
 	void redrawStats();
 
+	/**
+	 * Handles end of turn logic
+	 */
+	void endOfTurn();
+
 public:
 	virtual ~Logic() {
 	}
diff --git a/engines/ultima/ultima1/logic/overworld_logic.cpp b/engines/ultima/ultima1/logic/overworld_logic.cpp
index 9fee5cf2d90..c77acfa9594 100644
--- a/engines/ultima/ultima1/logic/overworld_logic.cpp
+++ b/engines/ultima/ultima1/logic/overworld_logic.cpp
@@ -46,8 +46,8 @@ static const char *IMPASSABLE_REASONS[] = {
 	"Rafts like water!"
 };
 
-const int8 DELTA_X[5] = { 0, -1, 1, 0, 0 };
-const int8 DELTA_Y[5] = { 0, 0, 0, -1, 1 };
+static const int8 DELTA_X[5] = { 0, -1, 1, 0, 0 };
+static const int8 DELTA_Y[5] = { 0, 0, 0, -1, 1 };
 
 OverworldLogic::OverworldLogic() {
 	_G(map)._mapType = Data::MAPTYPE_OVERWORLD;
@@ -356,7 +356,7 @@ void OverworldLogic::continentChanged(int oldContinent) {
 		int continent = _G(map).getContinentAt(e._x, e._y);
 
 		if (continent == oldContinent) {
-			_G(savegame).removeCreatureAt(e._x, e._y);
+			_G(savegame).removeOverworldCreatureAt(e._x, e._y);
 			_G(creaturesCount)--;
 		}
 	}
@@ -365,14 +365,10 @@ void OverworldLogic::continentChanged(int oldContinent) {
 void OverworldLogic::endOfTurn() {
 	if (_G(creaturesCount) < Data::CREATURES_COUNT)
 		generateCreatures();
-
-	_G(moveCtr)++;
 	updateCreatures();
 	reduceFood();
 
-	redrawMap();
-	redrawStats();
-	prompt();
+	Logic::endOfTurn();
 }
 
 void OverworldLogic::generateCreatures() {
diff --git a/engines/ultima/ultima1/logic/overworld_logic.h b/engines/ultima/ultima1/logic/overworld_logic.h
index 047bbe08286..bdfa78a0e3e 100644
--- a/engines/ultima/ultima1/logic/overworld_logic.h
+++ b/engines/ultima/ultima1/logic/overworld_logic.h
@@ -122,7 +122,7 @@ public:
 	}
 
 	void action(int action) override;
-	void keypress(Common::KeyCode keycode);
+	void keypress(Common::KeyCode keycode) override;
 };
 
 } // namespace Logic
diff --git a/engines/ultima/ultima1/metaengine.cpp b/engines/ultima/ultima1/metaengine.cpp
index 0f1711ddcc2..81d4fd7aae8 100644
--- a/engines/ultima/ultima1/metaengine.cpp
+++ b/engines/ultima/ultima1/metaengine.cpp
@@ -44,7 +44,7 @@ static const KeybindingRecord MENU_KEYS[] = {
 	{ KEYBIND_NONE, nullptr, nullptr, nullptr, nullptr }
 };
 
-static const KeybindingRecord OVERWORLD_KEYS[] = {
+static const KeybindingRecord GAMEPLAY_KEYS[] = {
 	{ KEYBIND_UP, "UP", _s("Up"), "UP", "JOY_UP"},
 	{ KEYBIND_DOWN, "DOWN", _s("Down"), "DOWN", "JOY_DOWN"},
 	{ KEYBIND_LEFT, "LEFT", _s("Left"), "LEFT", "JOY_LEFT"},
@@ -66,7 +66,7 @@ struct KeysRecord {
 static const KeysRecord ALL_RECORDS[] = {
 	{ "Ultima1", _s("Basic keys"), MINIMAL_KEYS },
 	{ "menu", _s("Menu keys"), MENU_KEYS },
-	{ "overworld", _s("Overworld keys"), OVERWORLD_KEYS },
+	{ "gameplay", _s("Gameplay keys"), GAMEPLAY_KEYS },
 	{ "dungeon", _s("Dungeon keys"), DUNGEON_KEYS },
 	{ nullptr, nullptr, nullptr }
 };
@@ -82,9 +82,9 @@ static const KeysRecord MENU_RECORDS[] = {
 	{ nullptr, nullptr, nullptr }
 };
 
-static const KeysRecord OVERWORLD_RECORDS[] = {
+static const KeysRecord GAMEPLAY_RECORDS[] = {
 	{ "Ultima1", _s("Basic keys"), MINIMAL_KEYS },
-	{ "overworld", _s("Overworld keys"), OVERWORLD_KEYS },
+	{ "gameplay", _s("Gameplay keys"), GAMEPLAY_KEYS },
 	{ nullptr, nullptr, nullptr }
 };
 
@@ -98,7 +98,7 @@ static const KeysRecord *MODE_RECORDS[] = {
 	ALL_RECORDS,
 	MINIMAL_RECORDS,
 	MENU_RECORDS,
-	OVERWORLD_RECORDS,
+	GAMEPLAY_RECORDS,
 	DUNGEON_RECORDS,
 };
 
diff --git a/engines/ultima/ultima1/metaengine.h b/engines/ultima/ultima1/metaengine.h
index 794cd30bad5..cea8e4a3e3b 100644
--- a/engines/ultima/ultima1/metaengine.h
+++ b/engines/ultima/ultima1/metaengine.h
@@ -44,7 +44,7 @@ enum KeybindingMode {
 	KBMODE_ALL,
 	KBMODE_MINIMAL,
 	KBMODE_MENUS,
-	KBMODE_OVERWORLD,
+	KBMODE_GAMEPLAY,
 	KBMODE_DUNGEONS
 };
 
diff --git a/engines/ultima/ultima1/views/game.cpp b/engines/ultima/ultima1/views/game.cpp
index b572fa9c9ac..a7882e8e108 100644
--- a/engines/ultima/ultima1/views/game.cpp
+++ b/engines/ultima/ultima1/views/game.cpp
@@ -41,16 +41,6 @@ Game::Game() : Shared::Gfx::View("Game"), _commands(this), _stats(this) {
 	_stats.setBounds(TextRect(31, 21, 39, 24));
 }
 
-bool Game::msgFocus(const FocusMessage &msg) {
-	MetaEngine::setKeybindingMode(KBMODE_OVERWORLD);
-	return View::msgFocus(msg);
-}
-
-bool Game::msgUnfocus(const UnfocusMessage &msg) {
-	MetaEngine::setKeybindingMode(KBMODE_MINIMAL);
-	return View::msgUnfocus(msg);
-}
-
 void Game::draw() {
 	auto s = getSurface();
 	Shared::UIElement::draw();
diff --git a/engines/ultima/ultima1/views/game.h b/engines/ultima/ultima1/views/game.h
index fc1ba526437..5f1b9336d22 100644
--- a/engines/ultima/ultima1/views/game.h
+++ b/engines/ultima/ultima1/views/game.h
@@ -44,8 +44,6 @@ public:
 	~Game() override {
 	}
 
-	bool msgFocus(const FocusMessage &msg) override;
-	bool msgUnfocus(const UnfocusMessage &msg) override;
 	void draw() override;
 };
 
diff --git a/engines/ultima/ultima1/views/location_map.cpp b/engines/ultima/ultima1/views/location_map.cpp
index f2254e674bc..088276aa618 100644
--- a/engines/ultima/ultima1/views/location_map.cpp
+++ b/engines/ultima/ultima1/views/location_map.cpp
@@ -33,6 +33,7 @@ constexpr int MAP_VISIBLE_WIDTH = 38;
 constexpr int MAP_VISIBLE_HEIGHT = 18;
 
 bool LocationMap::msgFocus(const FocusMessage &msg) {
+	MetaEngine::setKeybindingMode(KBMODE_GAMEPLAY);
 	delayFrames(1);
 	return UIElement::msgFocus(msg);
 }
@@ -78,7 +79,7 @@ void LocationMap::draw() {
 	}
 	
 	// Draw the player
-	const Graphics::ManagedSurface &tileImg = tiles[Data::LOCTILE_PLAYER];
+	const Graphics::ManagedSurface &tileImg = tiles[Data::CTILE_PLAYER];
 	s.blitFrom(tileImg, Common::Point(pos.x * TILE_WIDTH + 8, pos.y * TILE_HEIGHT + 8));
 }
 
diff --git a/engines/ultima/ultima1/views/overworld_map.cpp b/engines/ultima/ultima1/views/overworld_map.cpp
index 41849d865fc..68fe8739ea5 100644
--- a/engines/ultima/ultima1/views/overworld_map.cpp
+++ b/engines/ultima/ultima1/views/overworld_map.cpp
@@ -31,7 +31,7 @@ constexpr int TILE_WIDTH = 16;
 constexpr int TILE_HEIGHT = 16;
 
 bool OverworldMap::msgFocus(const FocusMessage &msg) {
-	MetaEngine::setKeybindingMode(KBMODE_OVERWORLD);
+	MetaEngine::setKeybindingMode(KBMODE_GAMEPLAY);
 	delayFrames(1);
 	return Dialog::msgFocus(msg);
 }


Commit: ceac2919d71994da951ab6931bc86bfb25f41c16
    https://github.com/scummvm/scummvm/commit/ceac2919d71994da951ab6931bc86bfb25f41c16
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:40:48+11:00

Commit Message:
ULTIMA: ULTIMA1: ZStats window

Changed paths:
  A engines/ultima/ultima1/views/zstats.cpp
  A engines/ultima/ultima1/views/zstats.h
    engines/ultima/module.mk
    engines/ultima/shared/gfx/gfx_surface.cpp
    engines/ultima/shared/gfx/gfx_surface.h
    engines/ultima/ultima1/data/savegame.cpp
    engines/ultima/ultima1/data/savegame.h
    engines/ultima/ultima1/logic/city_castle_logic.cpp
    engines/ultima/ultima1/logic/overworld_logic.cpp
    engines/ultima/ultima1/metaengine.cpp
    engines/ultima/ultima1/metaengine.h
    engines/ultima/ultima1/views/commands.cpp
    engines/ultima/ultima1/views/commands.h
    engines/ultima/ultima1/views/views.h


diff --git a/engines/ultima/module.mk b/engines/ultima/module.mk
index 6edc2907092..464462fd3ef 100644
--- a/engines/ultima/module.mk
+++ b/engines/ultima/module.mk
@@ -78,7 +78,8 @@ MODULE_OBJS += \
 	ultima1/views/overworld_map.o \
 	ultima1/views/stats.o \
 	ultima1/views/startup.o \
-	ultima1/views/title.o
+	ultima1/views/title.o \
+	ultima1/views/zstats.o
 endif
 
 ifdef ENABLE_ULTIMA2
diff --git a/engines/ultima/shared/gfx/gfx_surface.cpp b/engines/ultima/shared/gfx/gfx_surface.cpp
index d40a0af4ac3..8f2fd56bf32 100644
--- a/engines/ultima/shared/gfx/gfx_surface.cpp
+++ b/engines/ultima/shared/gfx/gfx_surface.cpp
@@ -62,6 +62,28 @@ void GfxSurface::writeString(const Common::String &str, Graphics::TextAlign alig
 	}
 }
 
+void GfxSurface::writeString(const Common::Point &pt, const char *str, ...) {
+	va_list alist;
+
+	// Start reading values
+	va_start(alist, str);
+	Common::String msg = Common::String::vformat(str, alist);
+	va_end(alist);
+
+	writeString(pt, msg, Graphics::kTextAlignLeft);
+}
+
+void GfxSurface::writeString(const char *str, ...) {
+	va_list alist;
+
+	// Start reading values
+	va_start(alist, str);
+	Common::String msg = Common::String::vformat(str, alist);
+	va_end(alist);
+
+	writeString(msg, Graphics::kTextAlignLeft);
+}
+
 void GfxSurface::writeChar(uint32 chr) {
 	const int fontW = _font.getMaxCharWidth();
 	const int fontH = _font.getFontHeight();
diff --git a/engines/ultima/shared/gfx/gfx_surface.h b/engines/ultima/shared/gfx/gfx_surface.h
index 11caedc2289..b8af4974a3c 100644
--- a/engines/ultima/shared/gfx/gfx_surface.h
+++ b/engines/ultima/shared/gfx/gfx_surface.h
@@ -52,6 +52,8 @@ public:
 	void writeString(const Common::Point &pt, const Common::String &str,
 		Graphics::TextAlign align = Graphics::kTextAlignLeft);
 	void writeString(const Common::String &str, Graphics::TextAlign align = Graphics::kTextAlignLeft);
+	void writeString(const Common::Point &pt, const char *str, ...);
+	void writeString(const char *str, ...);
 	void writeChar(uint32 chr);
 	int getStringWidth(const Common::String &str) const;
 
diff --git a/engines/ultima/ultima1/data/savegame.cpp b/engines/ultima/ultima1/data/savegame.cpp
index 35986995aca..eb2842f3fd5 100644
--- a/engines/ultima/ultima1/data/savegame.cpp
+++ b/engines/ultima/ultima1/data/savegame.cpp
@@ -31,6 +31,26 @@ const char *SEX_NAMES[] = { "Male", "Female" };
 const char *RACE_NAMES[] = { nullptr, "Human", "Elf", "Dwarf", "Bobbit" };
 const char *CLASS_NAMES[] = { nullptr, "Fighter", "Cleric", "Wizard", "Thief" };
 
+// Index 0 of each ("Skin"/"Hands"/"Prayer"/"Foot") is the innate/default
+// state and is never shown in the stats screen, but is included here to
+// keep these arrays indexed identically to the enums/savegame arrays above
+const char *ARMOR_NAMES[] = {
+	"Skin", "Leather armor", "Chain mail", "Plate mail", "Vacuum suit", "Reflect suit"
+};
+const char *WEAPON_NAMES[] = {
+	"Hands", "Dagger", "Mace", "Axe", "Rope & Spikes", "Sword", "Great Sword",
+	"Bow & Arrows", "Amulet", "Wand", "Staff", "Triangle", "Pistol",
+	"Light Sword", "Phazor", "Blaster"
+};
+const char *SPELL_NAMES[] = {
+	"Prayer", "Open", "Unlock", "Magic Missile", "Steal", "Ladder Down",
+	"Ladder Up", "Blink", "Create", "Destroy", "Kill"
+};
+const char *TRANSPORT_NAMES[] = {
+	"Foot", "Horse", "Cart", "Raft", "Frigate", "Aircar", "Shuttle", "Time Machine"
+};
+const char *GEM_NAMES[] = { "Red Gem", "Green Gem", "Blue Gem", "White Gem" };
+
 void LocationEntity::synchronize(Common::Serializer &s) {
 	s.syncAsSint16LE(_type);
 	s.syncAsSint16LE(_position.x);
diff --git a/engines/ultima/ultima1/data/savegame.h b/engines/ultima/ultima1/data/savegame.h
index 2373c3213fb..7685ab02d51 100644
--- a/engines/ultima/ultima1/data/savegame.h
+++ b/engines/ultima/ultima1/data/savegame.h
@@ -39,6 +39,11 @@ constexpr int LOCATION_ENTITY_COUNT = 15;
 extern const char *SEX_NAMES[];
 extern const char *RACE_NAMES[];
 extern const char *CLASS_NAMES[];
+extern const char *ARMOR_NAMES[];
+extern const char *WEAPON_NAMES[];
+extern const char *SPELL_NAMES[];
+extern const char *TRANSPORT_NAMES[];
+extern const char *GEM_NAMES[];
 
 enum Sex {
 	SEX_MALE = 0, SEX_FEMALE = 1
@@ -190,6 +195,13 @@ public:
 		return _hits <= 0;
 	}
 
+	/**
+	 * Returns the player's current level
+	 */
+	int getCurrentLevel() const {
+		return _experience / 1000 + 1;
+	}
+
 	/**
 	 * Checks the overworld map for an entity (creature or vechile) at a given position.
 	 * @param x		X position
diff --git a/engines/ultima/ultima1/logic/city_castle_logic.cpp b/engines/ultima/ultima1/logic/city_castle_logic.cpp
index aa8f7d529d8..907f0790f61 100644
--- a/engines/ultima/ultima1/logic/city_castle_logic.cpp
+++ b/engines/ultima/ultima1/logic/city_castle_logic.cpp
@@ -145,7 +145,11 @@ void CityCastleLogic::action(int action) {
 	case KEYBIND_PASS:
 		pass();
 		break;
-	default:
+	case KEYBIND_ZSTATS:
+		writeString("Ztats\n");
+		g_engine->addView("ZStats");
+		return;
+	return;	default:
 		writeString("Huh?\n");
 		break;
 	}
diff --git a/engines/ultima/ultima1/logic/overworld_logic.cpp b/engines/ultima/ultima1/logic/overworld_logic.cpp
index c77acfa9594..b7946850f6d 100644
--- a/engines/ultima/ultima1/logic/overworld_logic.cpp
+++ b/engines/ultima/ultima1/logic/overworld_logic.cpp
@@ -73,6 +73,10 @@ void OverworldLogic::action(int action) {
 	case KEYBIND_PASS:
 		pass();
 		break;
+	case KEYBIND_ZSTATS:
+		writeString("Ztats\n");
+		g_engine->addView("ZStats");
+		return;
 	default:
 		writeString("Huh?\n");
 		break;
diff --git a/engines/ultima/ultima1/metaengine.cpp b/engines/ultima/ultima1/metaengine.cpp
index 81d4fd7aae8..3007e91f911 100644
--- a/engines/ultima/ultima1/metaengine.cpp
+++ b/engines/ultima/ultima1/metaengine.cpp
@@ -50,10 +50,12 @@ static const KeybindingRecord GAMEPLAY_KEYS[] = {
 	{ KEYBIND_LEFT, "LEFT", _s("Left"), "LEFT", "JOY_LEFT"},
 	{ KEYBIND_RIGHT, "RIGHT", _s("Right"), "RIGHT", "JOY_RIGHT"},
 	{ KEYBIND_ENTER, "ENTER", _s("Enter"), "e", nullptr },
+	{ KEYBIND_ZSTATS, "STATS", _s("Ztats"), "z", nullptr },
 	{ KEYBIND_NONE, nullptr, nullptr, nullptr, nullptr }
 };
 
 static const KeybindingRecord DUNGEON_KEYS[] = {
+	{ KEYBIND_ZSTATS, "STATS", _s("Ztats"), "z", nullptr },
 	{ KEYBIND_NONE, nullptr, nullptr, nullptr, nullptr }
 };
 
@@ -124,12 +126,6 @@ Common::KeymapArray MetaEngine::initKeymaps(KeybindingMode mode) {
 			act->addDefaultInputMapping(r->_key);
 			if (r->_joy)
 				act->addDefaultInputMapping(r->_joy);
-			if (r->_action == KEYBIND_ENTER)
-				act->addDefaultInputMapping("x");	// x also works to eXit
-			else if (r->_action == KEYBIND_SELECT)
-				act->addDefaultInputMapping("RETURN");
-			else if (r->_action == KEYBIND_QUIT)
-				act->addDefaultInputMapping("p");	// Map "Pause" to Quit
 
 			if (r->_action == KEYBIND_UP || r->_action == KEYBIND_DOWN ||
 				r->_action == KEYBIND_LEFT || r->_action == KEYBIND_RIGHT)
diff --git a/engines/ultima/ultima1/metaengine.h b/engines/ultima/ultima1/metaengine.h
index cea8e4a3e3b..ed3efd61162 100644
--- a/engines/ultima/ultima1/metaengine.h
+++ b/engines/ultima/ultima1/metaengine.h
@@ -29,13 +29,9 @@ namespace Ultima1 {
 
 enum KeybindingAction {
 	KEYBIND_UP, KEYBIND_DOWN, KEYBIND_LEFT, KEYBIND_RIGHT,
-	KEYBIND_ESCAPE, KEYBIND_QUIT, KEYBIND_ENTER, KEYBIND_INFO,
-	KEYBIND_PASS, KEYBIND_ATTACK, KEYBIND_SWING, KEYBIND_THROW,
-	KEYBIND_AMULET1, KEYBIND_AMULET2, KEYBIND_AMULET3, KEYBIND_AMULET4,
-	KEYBIND_MINIMAP,
-
-	KEYBIND_SELECT, KEYBIND_FOOD, KEYBIND_RAPIER, KEYBIND_AXE,
-	KEYBIND_SHIELD, KEYBIND_BOW, KEYBIND_AMULET,
+	KEYBIND_ESCAPE, KEYBIND_QUIT, KEYBIND_ENTER,
+	KEYBIND_ZSTATS,
+	KEYBIND_PASS,
 
 	KEYBIND_NONE
 };
diff --git a/engines/ultima/ultima1/views/commands.cpp b/engines/ultima/ultima1/views/commands.cpp
index 1e887536b7d..79395faed90 100644
--- a/engines/ultima/ultima1/views/commands.cpp
+++ b/engines/ultima/ultima1/views/commands.cpp
@@ -26,6 +26,8 @@ namespace Ultima {
 namespace Ultima1 {
 namespace Views {
 
+constexpr int COLOR_TEXT = 11;      // light cyan - normal values
+
 Commands::Commands(UIElement *parent) : Shared::UIElement("Commands", parent), _textCursor("CommandsCursor", this) {
 }
 
@@ -40,6 +42,7 @@ void Commands::draw() {
 	_surface.clear();
 	_surface.setTextPos(Common::Point(0, 4));
 	_surface.setScrollable(true);
+	_surface.setColor(COLOR_TEXT);
 
 	prompt();
 }
@@ -51,6 +54,9 @@ bool Commands::msgGame(const GameMessage &msg) {
 	} else if (msg._name == "PROMPT") {
 		prompt();
 		return true;
+	} else if (msg._name == "SPACE") {
+		spaceToContinue();
+		return true;
 	}
 
 	return false;
@@ -67,6 +73,12 @@ void Commands::prompt() {
 	_textCursor.show();
 }
 
+void Commands::spaceToContinue() {
+	writeString("Press Space to continue:");
+	_textCursor.setPosition(Common::Point(25, 24));
+	_textCursor.show();
+}
+
 } // namespace Views
 } // namespace Ultima1
 } // namespace Ultima
diff --git a/engines/ultima/ultima1/views/commands.h b/engines/ultima/ultima1/views/commands.h
index 4deefa13182..465af1c797a 100644
--- a/engines/ultima/ultima1/views/commands.h
+++ b/engines/ultima/ultima1/views/commands.h
@@ -46,6 +46,7 @@ public:
 
 	void writeString(const Common::String &msg);
 	void prompt();
+	void spaceToContinue();
 };
 
 } // namespace Views
diff --git a/engines/ultima/ultima1/views/views.h b/engines/ultima/ultima1/views/views.h
index 5dcdb1ee094..ac26615757b 100644
--- a/engines/ultima/ultima1/views/views.h
+++ b/engines/ultima/ultima1/views/views.h
@@ -30,6 +30,7 @@
 #include "ultima/ultima1/views/overworld_map.h"
 #include "ultima/ultima1/views/startup.h"
 #include "ultima/ultima1/views/title.h"
+#include "ultima/ultima1/views/zstats.h"
 
 namespace Ultima {
 namespace Ultima1 {
@@ -43,6 +44,7 @@ struct Views : public Shared::Views {
 	OverworldMap _overworldMap;
 	Startup _startup;
 	Title _title;
+	ZStats _zStats;
 };
 
 } // namespace Views
diff --git a/engines/ultima/ultima1/views/zstats.cpp b/engines/ultima/ultima1/views/zstats.cpp
new file mode 100644
index 00000000000..ed01c4100d1
--- /dev/null
+++ b/engines/ultima/ultima1/views/zstats.cpp
@@ -0,0 +1,159 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "ultima/ultima1/views/zstats.h"
+#include "ultima/ultima1/ultima1.h"
+#include "ultima/ultima1/metaengine.h"
+
+namespace Ultima {
+namespace Ultima1 {
+namespace Views {
+
+constexpr int COLOR_TEXT = 11;      // light cyan - normal values
+constexpr int COLOR_HIGHLIGHT = 12; // light red - currently equipped/readied item
+
+// Two columns of 13 rows each per page
+constexpr int LINES_PER_PAGE = 26;
+
+bool ZStats::msgFocus(const FocusMessage &msg) {
+	g_engine->send("Commands", GameMessage("SPACE"));
+	buildLines();
+	_pageStart = 0;
+	return Dialog::msgFocus(msg);
+}
+
+bool ZStats::msgUnfocus(const UnfocusMessage &msg) {
+	// Switch back to an action prompt in the commands area
+	g_engine->send("Commands", GameMessage("PROMPT"));
+	return Dialog::msgUnfocus(msg);
+}
+
+void ZStats::draw() {
+	const auto &sg = _G(savegame);
+	auto s = getSurface();
+	Dialog::draw();
+
+	s.writeString(Point(13, 0), "\x10 Inventory \x11");
+	s.writeString(Point(2, 2), "Player: %s", sg._name);
+	s.writeString(Point(2, 3), "A Level %d %s %s %s", sg.getCurrentLevel(), Data::SEX_NAMES[sg._sex],
+		Data::RACE_NAMES[sg._race], Data::CLASS_NAMES[sg._class]);
+
+	uint pageEnd = MIN(_pageStart + (uint)LINES_PER_PAGE, (uint)_lines.size());
+	for (uint idx = _pageStart; idx < pageEnd; ++idx) {
+		const StatLine &line = _lines[idx];
+
+		s.setColor(line._color);
+		s.writeString(linePos(idx - _pageStart), line._text);
+	}
+
+	// If there's more to show on a following page, prompt for it
+	if (pageEnd < _lines.size()) {
+		s.setColor(COLOR_TEXT);
+		s.writeString(Point(16, 19), "\x10 More \x11");
+	}
+}
+
+Common::Point ZStats::linePos(int lineNum) const {
+	int col = (lineNum > 12) ? 1 : 0;
+	return Common::Point(col * 19 + 2, (lineNum % 13) + 5);
+}
+
+void ZStats::addLine(const char *name, int value, bool highlighted) {
+	if (!value)
+		return;
+
+	StatLine line;
+	line._text = getLine(name, value);
+	line._color = highlighted ? COLOR_HIGHLIGHT : COLOR_TEXT;
+	_lines.push_back(line);
+}
+
+void ZStats::buildLines() {
+	const auto &sg = _G(savegame);
+	_lines.clear();
+
+	addLine("Hit Points", sg._hits);
+	addLine("Strength", sg._strength);
+	addLine("Agility", sg._agility);
+	addLine("Stamina", sg._stamina);
+	addLine("Charisma", sg._charisma);
+	addLine("Wisdom", sg._wisdom);
+	addLine("Intelligence", sg._intelligence);
+
+	// Coin breakdown - only shown for the denominations actually present
+	if (sg._coins % 10 != 0)
+		addLine("Copper pence.", sg._coins % 10);
+	if (sg._coins % 100 > 9)
+		addLine("Silver pieces", (sg._coins % 100) / 10);
+	if (sg._coins > 99)
+		addLine("Gold crowns..", sg._coins / 100);
+
+	addLine("Enemy vessels", sg._enemyVessels);
+
+	// Owned armor/weapons/spells/transports - index 0 of each is the
+	// innate/default state (Skin/Hands/Prayer/Foot) and is never listed.
+	// The currently equipped/readied one of each is drawn highlighted
+	for (int idx = 1; idx < Data::ARMOR_COUNT; ++idx)
+		addLine(Data::ARMOR_NAMES[idx], sg._armor[idx], idx == sg._equippedArmor);
+	for (int idx = 1; idx < Data::WEAPON_COUNT; ++idx)
+		addLine(Data::WEAPON_NAMES[idx], sg._weapons[idx], idx == sg._equippedWeapon);
+	for (int idx = 1; idx < Data::SPELL_COUNT; ++idx)
+		addLine(Data::SPELL_NAMES[idx], sg._spells[idx], idx == sg._equippedSpell);
+	for (int idx = 1; idx < Data::TRANSPORT_COUNT; ++idx)
+		addLine(Data::TRANSPORT_NAMES[idx], sg._transports[idx], idx == sg._transportType);
+
+	const int16 gemValues[4] = { sg._redGems, sg._greenGems, sg._blueGem, sg._whiteGem };
+	for (int idx = 0; idx < 4; ++idx)
+		addLine(Data::GEM_NAMES[idx], gemValues[idx]);
+}
+
+Common::String ZStats::getLine(const char *name, int value) {
+	Common::String numStr = Common::String::format("%d", value);
+	Common::String result(name);
+
+	while (result.size() < (17 - numStr.size()))
+		result += '.';
+
+	return result + numStr;
+}
+
+bool ZStats::msgAction(const ActionMessage &msg) {
+	keyPressed();
+	return true;
+}
+
+bool ZStats::msgKeypress(const KeypressMessage &msg) {
+	keyPressed();
+	return true;
+}
+
+void ZStats::keyPressed() {
+	_pageStart += LINES_PER_PAGE;
+
+	if (_pageStart < _lines.size())
+		redraw();
+	else
+		close();
+}
+
+} // namespace Views
+} // namespace Ultima1
+} // namespace Ultima
diff --git a/engines/ultima/ultima1/views/zstats.h b/engines/ultima/ultima1/views/zstats.h
new file mode 100644
index 00000000000..3af12cd0a79
--- /dev/null
+++ b/engines/ultima/ultima1/views/zstats.h
@@ -0,0 +1,90 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef ULTIMA2_VIEWS_ZTATS_H
+#define ULTIMA2_VIEWS_ZTATS_H
+
+#include "common/array.h"
+#include "common/str.h"
+#include "ultima/ultima1/views/dialog.h"
+
+namespace Ultima {
+namespace Ultima1 {
+namespace Views {
+
+using namespace Shared::Messages;
+
+class ZStats : public Dialog {
+private:
+	struct StatLine {
+		Common::String _text;
+		byte _color;
+	};
+
+	// All the lines to display, spanning however many pages are needed.
+	// Rebuilt fresh each time the dialog is focused
+	Common::Array<StatLine> _lines;
+
+	// Index into _lines where the currently displayed page starts
+	uint _pageStart = 0;
+
+	/**
+	 * Builds the full set of stat lines from the current savegame
+	 */
+	void buildLines();
+
+	/**
+	 * Adds a single "name....value" line if value is non-zero, in the
+	 * highlight color if highlighted is true
+	 */
+	void addLine(const char *name, int value, bool highlighted = false);
+
+	/**
+	 * Formats a single "name....value" line
+	 */
+	Common::String getLine(const char *name, int value);
+
+	/**
+	 * Returns the text-cell position for a line at a given index within
+	 * the current page (0-25) - a two-column layout of 13 rows each
+	 */
+	Common::Point linePos(int lineNum) const;
+
+	void keyPressed();
+
+public:
+	ZStats() : Dialog("ZStats") {
+	}
+	~ZStats() override {
+	}
+
+	void draw() override;
+	bool msgFocus(const FocusMessage &msg) override;
+	bool msgUnfocus(const UnfocusMessage &msg) override;
+	bool msgAction(const ActionMessage &msg) override;
+	bool msgKeypress(const KeypressMessage &msg) override;
+};
+
+} // namespace Views
+} // namespace Ultima1
+} // namespace Ultima
+
+#endif


Commit: 064df0e921a6eee332ef9382b734eebdc0bfa8e3
    https://github.com/scummvm/scummvm/commit/064df0e921a6eee332ef9382b734eebdc0bfa8e3
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:40:48+11:00

Commit Message:
ULTIMA: ULTIMA1: Don't erase Commands area when leaving Ztats

Changed paths:
    engines/ultima/shared/engine/events.cpp
    engines/ultima/shared/engine/events.h
    engines/ultima/ultima1/views/commands.cpp


diff --git a/engines/ultima/shared/engine/events.cpp b/engines/ultima/shared/engine/events.cpp
index 68de554dc23..7a16fba063d 100644
--- a/engines/ultima/shared/engine/events.cpp
+++ b/engines/ultima/shared/engine/events.cpp
@@ -148,9 +148,12 @@ void Events::popView() {
 	priorView->msgUnfocus(UnfocusMessage());
 	_views.pop();
 
-	for (int i = 0; i < (int)_views.size() - 1; ++i) {
-		_views[i]->redraw();
-		_views[i]->draw();
+	// If the prior view was smaller than the view just closed, then we need to redraw everything
+	if (!_views.empty() && !_views[_views.size() - 1]->_bounds.contains(priorView->_bounds)) {
+		for (int i = 0; i < (int)_views.size() - 1; ++i) {
+			_views[i]->redraw();
+			_views[i]->draw();
+		}
 	}
 
 	if (!_views.empty()) {
diff --git a/engines/ultima/shared/engine/events.h b/engines/ultima/shared/engine/events.h
index 082d1931245..ec3e7ebd9a4 100644
--- a/engines/ultima/shared/engine/events.h
+++ b/engines/ultima/shared/engine/events.h
@@ -71,6 +71,9 @@ public:
 	int16 height() const {
 		return _bounds.height();
 	}
+	bool contains(const Common::Rect &r) const {
+		return _bounds.contains(r);
+	}
 };
 
 /**
diff --git a/engines/ultima/ultima1/views/commands.cpp b/engines/ultima/ultima1/views/commands.cpp
index 79395faed90..9b45a9da94e 100644
--- a/engines/ultima/ultima1/views/commands.cpp
+++ b/engines/ultima/ultima1/views/commands.cpp
@@ -21,6 +21,7 @@
 
 #include "ultima/ultima1/views/commands.h"
 #include "ultima/ultima1/ultima1.h"
+#include "ultima/shared/gfx/rect.h"
 
 namespace Ultima {
 namespace Ultima1 {
@@ -68,7 +69,8 @@ void Commands::writeString(const Common::String &msg) {
 }
 
 void Commands::prompt() {
-	writeString("\x10");
+	_surface.fillRect(TextRect(0, 4, 29, 4), 0);	// Clear entire bottom row
+	_surface.writeString(Point(0, 4), "\x10");
 	_textCursor.setPosition(Common::Point(1, 24));
 	_textCursor.show();
 }


Commit: d1ae18ec52e6e54816a5e7f0d0336c0c74921024
    https://github.com/scummvm/scummvm/commit/d1ae18ec52e6e54816a5e7f0d0336c0c74921024
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:40:48+11:00

Commit Message:
ULTIMA: ULTIMA1: Starting to implement keypress fallbacks

Changed paths:
    engines/ultima/ultima1/logic/city_castle_logic.cpp
    engines/ultima/ultima1/logic/city_castle_logic.h
    engines/ultima/ultima1/logic/dungeon_logic.cpp
    engines/ultima/ultima1/logic/dungeon_logic.h
    engines/ultima/ultima1/logic/logic.cpp
    engines/ultima/ultima1/logic/logic.h
    engines/ultima/ultima1/logic/overworld_logic.cpp
    engines/ultima/ultima1/logic/pillar_logic.cpp
    engines/ultima/ultima1/logic/pillar_logic.h
    engines/ultima/ultima1/metaengine.cpp
    engines/ultima/ultima1/metaengine.h


diff --git a/engines/ultima/ultima1/logic/city_castle_logic.cpp b/engines/ultima/ultima1/logic/city_castle_logic.cpp
index 907f0790f61..9ef8dd8b7a3 100644
--- a/engines/ultima/ultima1/logic/city_castle_logic.cpp
+++ b/engines/ultima/ultima1/logic/city_castle_logic.cpp
@@ -121,7 +121,7 @@ static const int8 DELTA_X[5] = { 0, -1, 1, 0, 0 };
 static const int8 DELTA_Y[5] = { 0, 0, 0, -1, 1 };
 
 
-void CityCastleLogic::enter() {
+void CityCastleLogic::entering() {
 	loadEntities();
 }
 
@@ -145,7 +145,7 @@ void CityCastleLogic::action(int action) {
 	case KEYBIND_PASS:
 		pass();
 		break;
-	case KEYBIND_ZSTATS:
+	case KEYBIND_STATS:
 		writeString("Ztats\n");
 		g_engine->addView("ZStats");
 		return;
@@ -183,9 +183,9 @@ CityLogic::CityLogic() {
 	_G(map)._mapType = Data::MAPTYPE_CITY;
 }
 
-void CityLogic::enter() {
+void CityLogic::entering() {
 	_G(savegame)._locationPosition = Common::Point(19, 17);
-	CityCastleLogic::enter();
+	CityCastleLogic::entering();
 }
 
 void CityLogic::move(Data::Direction dir) {
@@ -250,9 +250,9 @@ CastleLogic::CastleLogic() {
 	_G(savegame)._castleKeyVal = getRandomNumber(1) == 1 ? 61 : 60;
 }
 
-void CastleLogic::enter() {
+void CastleLogic::entering() {
 	_G(savegame)._locationPosition = Common::Point(0, 9);
-	CityCastleLogic::enter();
+	CityCastleLogic::entering();
 }
 
 } // namespace Logic
diff --git a/engines/ultima/ultima1/logic/city_castle_logic.h b/engines/ultima/ultima1/logic/city_castle_logic.h
index 0b6b69feb6e..1b03765cdc6 100644
--- a/engines/ultima/ultima1/logic/city_castle_logic.h
+++ b/engines/ultima/ultima1/logic/city_castle_logic.h
@@ -50,7 +50,7 @@ public:
 	~CityCastleLogic() override {
 	}
 
-	void enter() override;
+	void entering() override;
 	void action(int action) override;
 	void keypress(Common::KeyCode keycode) override;
 };
@@ -72,7 +72,7 @@ public:
 	~CityLogic() override {
 	}
 
-	void enter() override;
+	void entering() override;
 };
 
 class CastleLogic : public CityCastleLogic {
@@ -88,7 +88,7 @@ public:
 	~CastleLogic() override {
 	}
 
-	void enter() override;
+	void entering() override;
 };
 
 } // namespace Logic
diff --git a/engines/ultima/ultima1/logic/dungeon_logic.cpp b/engines/ultima/ultima1/logic/dungeon_logic.cpp
index 0955210102f..601d5d023be 100644
--- a/engines/ultima/ultima1/logic/dungeon_logic.cpp
+++ b/engines/ultima/ultima1/logic/dungeon_logic.cpp
@@ -28,7 +28,7 @@ namespace Ultima {
 namespace Ultima1 {
 namespace Logic {
 
-void DungeonLogic::enter() {
+void DungeonLogic::entering() {
 	// TODO
 }
 
diff --git a/engines/ultima/ultima1/logic/dungeon_logic.h b/engines/ultima/ultima1/logic/dungeon_logic.h
index 2fd7037684e..55a67ded140 100644
--- a/engines/ultima/ultima1/logic/dungeon_logic.h
+++ b/engines/ultima/ultima1/logic/dungeon_logic.h
@@ -34,7 +34,7 @@ public:
 	~DungeonLogic() override {
 	}
 
-	void enter() override;
+	void entering() override;
 	void action(int action) override;
 	void keypress(Common::KeyCode keycode) override;
 };
diff --git a/engines/ultima/ultima1/logic/logic.cpp b/engines/ultima/ultima1/logic/logic.cpp
index 56f9815c092..03c04b0a79d 100644
--- a/engines/ultima/ultima1/logic/logic.cpp
+++ b/engines/ultima/ultima1/logic/logic.cpp
@@ -65,6 +65,36 @@ void Logic::endOfTurn() {
 	prompt();
 }
 
+void Logic::board() {
+	writeString("Board?\n");
+	playFX(1);
+}
+
+void Logic::cast() {
+	writeString("Cast -- Hmmmm... no effect!\n");
+	playFX(6);
+}
+
+void Logic::drop() {
+	writeString("Drop?\n");
+	playFX(1);
+}
+
+void Logic::enter() {
+	writeString("Enter?\n");
+	playFX(1);
+}
+
+void Logic::fire() {
+	writeString("Fire?\n");
+	playFX(1);
+}
+
+void Logic::get() {
+	writeString("Get?\n");
+	playFX(1);
+}
+
 } // namespace Logic
 } // namespace Ultima1
 } // namespace Ultima
diff --git a/engines/ultima/ultima1/logic/logic.h b/engines/ultima/ultima1/logic/logic.h
index 06b0060a4ea..5397ca507a8 100644
--- a/engines/ultima/ultima1/logic/logic.h
+++ b/engines/ultima/ultima1/logic/logic.h
@@ -72,6 +72,16 @@ protected:
 	 */
 	void endOfTurn();
 
+	/*--- Fallback player action handlers ---*/
+
+	void board();
+	void cast();
+	void drop();
+	void enter();
+	void fire();
+	void get();
+
+	/*---------------------------------------*/
 public:
 	virtual ~Logic() {
 	}
@@ -80,7 +90,7 @@ public:
 	}
 	virtual void keypress(Common::KeyCode keycode) {
 	}
-	virtual void enter() {
+	virtual void entering() {
 	}
 };
 
diff --git a/engines/ultima/ultima1/logic/overworld_logic.cpp b/engines/ultima/ultima1/logic/overworld_logic.cpp
index b7946850f6d..4de65b06f70 100644
--- a/engines/ultima/ultima1/logic/overworld_logic.cpp
+++ b/engines/ultima/ultima1/logic/overworld_logic.cpp
@@ -73,7 +73,7 @@ void OverworldLogic::action(int action) {
 	case KEYBIND_PASS:
 		pass();
 		break;
-	case KEYBIND_ZSTATS:
+	case KEYBIND_STATS:
 		writeString("Ztats\n");
 		g_engine->addView("ZStats");
 		return;
@@ -134,7 +134,7 @@ void OverworldLogic::enter() {
 		_G(map).load(location);
 
 		// Run any logic for entering it
-		_G(logic)->enter();
+		_G(logic)->entering();
 	}
 }
 
diff --git a/engines/ultima/ultima1/logic/pillar_logic.cpp b/engines/ultima/ultima1/logic/pillar_logic.cpp
index a3b2db53ae7..b57a7edcef4 100644
--- a/engines/ultima/ultima1/logic/pillar_logic.cpp
+++ b/engines/ultima/ultima1/logic/pillar_logic.cpp
@@ -32,7 +32,7 @@ namespace Logic {
 PillarLogic::PillarLogic() {
 }
 
-void PillarLogic::enter() {
+void PillarLogic::entering() {
 	// TODO
 }
 
diff --git a/engines/ultima/ultima1/logic/pillar_logic.h b/engines/ultima/ultima1/logic/pillar_logic.h
index 70ed88e31bd..45360e18204 100644
--- a/engines/ultima/ultima1/logic/pillar_logic.h
+++ b/engines/ultima/ultima1/logic/pillar_logic.h
@@ -35,7 +35,7 @@ public:
 	~PillarLogic() override {
 	}
 
-	void enter() override;
+	void entering() override;
 	void action(int action) override;
 	void keypress(Common::KeyCode keycode) override;
 };
diff --git a/engines/ultima/ultima1/metaengine.cpp b/engines/ultima/ultima1/metaengine.cpp
index 3007e91f911..7351c52ac53 100644
--- a/engines/ultima/ultima1/metaengine.cpp
+++ b/engines/ultima/ultima1/metaengine.cpp
@@ -49,13 +49,30 @@ static const KeybindingRecord GAMEPLAY_KEYS[] = {
 	{ KEYBIND_DOWN, "DOWN", _s("Down"), "DOWN", "JOY_DOWN"},
 	{ KEYBIND_LEFT, "LEFT", _s("Left"), "LEFT", "JOY_LEFT"},
 	{ KEYBIND_RIGHT, "RIGHT", _s("Right"), "RIGHT", "JOY_RIGHT"},
+	{ KEYBIND_UP, "ATTACK_UP", _s("Attack Up"), "8", nullptr},
+	{ KEYBIND_DOWN, "ATTACK_DOWN", _s("Attack Down"), "2", nullptr},
+	{ KEYBIND_LEFT, "ATTACK_LEFT", _s("Attack Left"), "4", nullptr},
+	{ KEYBIND_RIGHT, "ATTACK_RIGHT", _s("Attack Right"), "6", nullptr},
+	{ KEYBIND_BOARD, "BOARD", _s("Board"), "b", nullptr },
+	{ KEYBIND_CAST, "CAST", _s("Cast"), "c", nullptr },
+	{ KEYBIND_DROP, "DROP", _s("Drop"), "d", nullptr },
 	{ KEYBIND_ENTER, "ENTER", _s("Enter"), "e", nullptr },
-	{ KEYBIND_ZSTATS, "STATS", _s("Ztats"), "z", nullptr },
-	{ KEYBIND_NONE, nullptr, nullptr, nullptr, nullptr }
-};
-
-static const KeybindingRecord DUNGEON_KEYS[] = {
-	{ KEYBIND_ZSTATS, "STATS", _s("Ztats"), "z", nullptr },
+	{ KEYBIND_FIRE, "FIRE", _s("Fire"), "f", nullptr },
+	{ KEYBIND_GET, "GET", _s("Get"), "g", nullptr },
+	{ KEYBIND_HYPERJUMP, "HYPERJUMP", _s("Hyperjump"), "h", nullptr },
+	{ KEYBIND_INFORM, "INFORM", _s("Inform"), "i", nullptr },
+	{ KEYBIND_CLIMB, "CLIMB", _s("Klimb"), "k", nullptr },
+	{ KEYBIND_NOISE, "NOISE", _s("Noise"), "n", nullptr },
+	{ KEYBIND_OPEN, "OPEN", _s("Open"), "o", nullptr },
+	{ KEYBIND_QUIT, "QUIT", _s("Quit"), "q", nullptr },
+	{ KEYBIND_READY, "READY", _s("Ready"), "r", nullptr },
+	{ KEYBIND_STEAL, "STEAL", _s("Steal"), "s", nullptr },
+	{ KEYBIND_TRANSACT, "TRANSACT", _s("Transact"), "t", nullptr },
+	{ KEYBIND_UNLOCK, "UNLOCK", _s("Unlock"), "u", nullptr },
+	{ KEYBIND_VIEW, "VIEW", _s("View change"), "e", nullptr },
+	{ KEYBIND_EXIT, "EXIT", _s("eXit"), "x", nullptr },
+	{ KEYBIND_STATS, "STATS", _s("Ztats"), "z", nullptr },
+	{ KEYBIND_PASS, "PASS", _s("Pass"), " ", nullptr },
 	{ KEYBIND_NONE, nullptr, nullptr, nullptr, nullptr }
 };
 
@@ -69,7 +86,6 @@ static const KeysRecord ALL_RECORDS[] = {
 	{ "Ultima1", _s("Basic keys"), MINIMAL_KEYS },
 	{ "menu", _s("Menu keys"), MENU_KEYS },
 	{ "gameplay", _s("Gameplay keys"), GAMEPLAY_KEYS },
-	{ "dungeon", _s("Dungeon keys"), DUNGEON_KEYS },
 	{ nullptr, nullptr, nullptr }
 };
 
@@ -90,18 +106,11 @@ static const KeysRecord GAMEPLAY_RECORDS[] = {
 	{ nullptr, nullptr, nullptr }
 };
 
-static const KeysRecord DUNGEON_RECORDS[] = {
-	{ "Ultima1", _s("Basic keys"), MINIMAL_KEYS },
-	{ "dungeon", _s("Dungeon keys"), DUNGEON_KEYS },
-	{ nullptr, nullptr, nullptr }
-};
-
 static const KeysRecord *MODE_RECORDS[] = {
 	ALL_RECORDS,
 	MINIMAL_RECORDS,
 	MENU_RECORDS,
-	GAMEPLAY_RECORDS,
-	DUNGEON_RECORDS,
+	GAMEPLAY_RECORDS
 };
 
 Common::KeymapArray MetaEngine::initKeymaps(KeybindingMode mode) {
diff --git a/engines/ultima/ultima1/metaengine.h b/engines/ultima/ultima1/metaengine.h
index ed3efd61162..e8494e06e4d 100644
--- a/engines/ultima/ultima1/metaengine.h
+++ b/engines/ultima/ultima1/metaengine.h
@@ -29,10 +29,11 @@ namespace Ultima1 {
 
 enum KeybindingAction {
 	KEYBIND_UP, KEYBIND_DOWN, KEYBIND_LEFT, KEYBIND_RIGHT,
-	KEYBIND_ESCAPE, KEYBIND_QUIT, KEYBIND_ENTER,
-	KEYBIND_ZSTATS,
-	KEYBIND_PASS,
-
+	KEYBIND_ATTACK_UP, KEYBIND_ATTACK_DOWN, KEYBIND_ATTACK_LEFT, KEYBIND_ATTACK_RIGHT,
+	KEYBIND_ATTACK, KEYBIND_BOARD, KEYBIND_CAST, KEYBIND_DROP, KEYBIND_ENTER, KEYBIND_FIRE,
+	KEYBIND_GET, KEYBIND_HYPERJUMP, KEYBIND_INFORM, KEYBIND_CLIMB, KEYBIND_NOISE,
+	KEYBIND_OPEN, KEYBIND_QUIT, KEYBIND_READY, KEYBIND_STEAL, KEYBIND_TRANSACT,
+	KEYBIND_UNLOCK, KEYBIND_VIEW, KEYBIND_EXIT, KEYBIND_STATS, KEYBIND_PASS,
 	KEYBIND_NONE
 };
 
@@ -40,8 +41,7 @@ enum KeybindingMode {
 	KBMODE_ALL,
 	KBMODE_MINIMAL,
 	KBMODE_MENUS,
-	KBMODE_GAMEPLAY,
-	KBMODE_DUNGEONS
+	KBMODE_GAMEPLAY
 };
 
 class MetaEngine {


Commit: bd3f570fa73476b3b3931ee9ef8be7cbebe66ffc
    https://github.com/scummvm/scummvm/commit/bd3f570fa73476b3b3931ee9ef8be7cbebe66ffc
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:40:48+11:00

Commit Message:
ULTIMA: ULTIMA1: Setting base Logic class with virtual commands handling

Changed paths:
    engines/ultima/ultima1/data/map.cpp
    engines/ultima/ultima1/logic/city_castle_logic.cpp
    engines/ultima/ultima1/logic/city_castle_logic.h
    engines/ultima/ultima1/logic/dungeon_logic.h
    engines/ultima/ultima1/logic/logic.cpp
    engines/ultima/ultima1/logic/logic.h
    engines/ultima/ultima1/logic/overworld_logic.cpp
    engines/ultima/ultima1/logic/overworld_logic.h
    engines/ultima/ultima1/logic/pillar_logic.h
    engines/ultima/ultima1/metaengine.cpp
    engines/ultima/ultima1/ultima1.cpp
    engines/ultima/ultima1/views/create_character.cpp


diff --git a/engines/ultima/ultima1/data/map.cpp b/engines/ultima/ultima1/data/map.cpp
index 412e826366f..56d02169232 100644
--- a/engines/ultima/ultima1/data/map.cpp
+++ b/engines/ultima/ultima1/data/map.cpp
@@ -146,9 +146,6 @@ void Map::load(int mapNum) {
 	// Set up copies of the map position and player tile to use
 	_playerTileId = TILE_PLAYER;
 
-	// Set up the correct logic to use
-	delete _G(logic);
-
 	// Set up logic handler for the mode and which view it'll be using
 	Common::String viewName;
 	if (mapNum >= 49) {
diff --git a/engines/ultima/ultima1/logic/city_castle_logic.cpp b/engines/ultima/ultima1/logic/city_castle_logic.cpp
index 9ef8dd8b7a3..37b720d60db 100644
--- a/engines/ultima/ultima1/logic/city_castle_logic.cpp
+++ b/engines/ultima/ultima1/logic/city_castle_logic.cpp
@@ -125,43 +125,6 @@ void CityCastleLogic::entering() {
 	loadEntities();
 }
 
-void CityCastleLogic::action(int action) {
-	switch (action) {
-	case KEYBIND_UP:
-		move(Data::DIR_UP);
-		break;
-	case KEYBIND_DOWN:
-		move(Data::DIR_DOWN);
-		break;
-	case KEYBIND_LEFT:
-		move(Data::DIR_LEFT);
-		break;
-	case KEYBIND_RIGHT:
-		move(Data::DIR_RIGHT);
-		break;
-	case KEYBIND_ENTER:
-		enter();
-		break;
-	case KEYBIND_PASS:
-		pass();
-		break;
-	case KEYBIND_STATS:
-		writeString("Ztats\n");
-		g_engine->addView("ZStats");
-		return;
-	return;	default:
-		writeString("Huh?\n");
-		break;
-	}
-
-	endOfTurn();
-}
-
-void CityCastleLogic::keypress(Common::KeyCode keycode) {
-	writeString("Huh?\n");
-	endOfTurn();
-}
-
 void CityCastleLogic::loadEntities() {
 	auto &map = _G(map);
 	auto &savegame = _G(savegame);
@@ -171,10 +134,6 @@ void CityCastleLogic::loadEntities() {
 		savegame._locationEntities[idx] = widgets[idx];
 }
 
-void CityCastleLogic::pass() {
-	writeString("Pass\n");
-}
-
 /*-------------------------------------------------------------------*/
 
 CityLogic::CityLogic() {
diff --git a/engines/ultima/ultima1/logic/city_castle_logic.h b/engines/ultima/ultima1/logic/city_castle_logic.h
index 1b03765cdc6..2868e19f623 100644
--- a/engines/ultima/ultima1/logic/city_castle_logic.h
+++ b/engines/ultima/ultima1/logic/city_castle_logic.h
@@ -36,23 +36,11 @@ protected:
 	 */
 	void loadEntities();
 
-	/**
-	 * Handle movement
-	 */
-	virtual void move(Data::Direction dir) = 0;
-
-	/**
-	 * Pass a turn
-	 */
-	void pass();
-
 public:
 	~CityCastleLogic() override {
 	}
 
 	void entering() override;
-	void action(int action) override;
-	void keypress(Common::KeyCode keycode) override;
 };
 
 class CityLogic : public CityCastleLogic {
diff --git a/engines/ultima/ultima1/logic/dungeon_logic.h b/engines/ultima/ultima1/logic/dungeon_logic.h
index 55a67ded140..ce147526f0f 100644
--- a/engines/ultima/ultima1/logic/dungeon_logic.h
+++ b/engines/ultima/ultima1/logic/dungeon_logic.h
@@ -30,6 +30,10 @@ namespace Ultima1 {
 namespace Logic {
 
 class DungeonLogic : public Logic {
+protected:
+	void move(Data::Direction dir) override {
+	}
+
 public:
 	~DungeonLogic() override {
 	}
diff --git a/engines/ultima/ultima1/logic/logic.cpp b/engines/ultima/ultima1/logic/logic.cpp
index 03c04b0a79d..450e7ec86ed 100644
--- a/engines/ultima/ultima1/logic/logic.cpp
+++ b/engines/ultima/ultima1/logic/logic.cpp
@@ -22,6 +22,7 @@
 
 #include "ultima/ultima1/logic/logic.h"
 #include "ultima/ultima1/ultima1.h"
+#include "ultima/ultima1/metaengine.h"
 
 namespace Ultima {
 namespace Ultima1 {
@@ -63,6 +64,48 @@ void Logic::endOfTurn() {
 	redrawMap();
 	redrawStats();
 	prompt();
+
+	// If this logic is no longer the active one, such as from switching maps,
+	// then delete it
+	if (this != _G(logic))
+		delete this;
+}
+
+void Logic::action(int action) {
+	switch (action) {
+	case KEYBIND_UP:
+		move(Data::DIR_UP);
+		break;
+	case KEYBIND_DOWN:
+		move(Data::DIR_DOWN);
+		break;
+	case KEYBIND_LEFT:
+		move(Data::DIR_LEFT);
+		break;
+	case KEYBIND_RIGHT:
+		move(Data::DIR_RIGHT);
+		break;
+	case KEYBIND_ENTER:
+		enter();
+		break;
+	case KEYBIND_PASS:
+		pass();
+		break;
+	case KEYBIND_STATS:
+		writeString("Ztats\n");
+		g_engine->addView("ZStats");
+		return;
+	default:
+		writeString("Huh?\n");
+		break;
+	}
+
+	endOfTurn();
+}
+
+void Logic::keypress(Common::KeyCode keycode) {
+	writeString("Huh?\n");
+	endOfTurn();
 }
 
 void Logic::board() {
@@ -95,6 +138,10 @@ void Logic::get() {
 	playFX(1);
 }
 
+void Logic::pass() {
+	writeString("Pass\n");
+}
+
 } // namespace Logic
 } // namespace Ultima1
 } // namespace Ultima
diff --git a/engines/ultima/ultima1/logic/logic.h b/engines/ultima/ultima1/logic/logic.h
index 5397ca507a8..07d41502876 100644
--- a/engines/ultima/ultima1/logic/logic.h
+++ b/engines/ultima/ultima1/logic/logic.h
@@ -74,22 +74,22 @@ protected:
 
 	/*--- Fallback player action handlers ---*/
 
-	void board();
-	void cast();
-	void drop();
-	void enter();
-	void fire();
-	void get();
+	virtual void board();
+	virtual void cast();
+	virtual void drop();
+	virtual void enter();
+	virtual void fire();
+	virtual void get();
+	virtual void move(Data::Direction dir) = 0;
+	virtual void pass();
 
 	/*---------------------------------------*/
 public:
 	virtual ~Logic() {
 	}
 
-	virtual void action(int action) {
-	}
-	virtual void keypress(Common::KeyCode keycode) {
-	}
+	virtual void action(int action);
+	virtual void keypress(Common::KeyCode keycode);
 	virtual void entering() {
 	}
 };
diff --git a/engines/ultima/ultima1/logic/overworld_logic.cpp b/engines/ultima/ultima1/logic/overworld_logic.cpp
index 4de65b06f70..486a0798bd7 100644
--- a/engines/ultima/ultima1/logic/overworld_logic.cpp
+++ b/engines/ultima/ultima1/logic/overworld_logic.cpp
@@ -53,43 +53,6 @@ OverworldLogic::OverworldLogic() {
 	_G(map)._mapType = Data::MAPTYPE_OVERWORLD;
 }
 
-void OverworldLogic::action(int action) {
-	switch (action) {
-	case KEYBIND_UP:
-		move(Data::DIR_UP);
-		break;
-	case KEYBIND_DOWN:
-		move(Data::DIR_DOWN);
-		break;
-	case KEYBIND_LEFT:
-		move(Data::DIR_LEFT);
-		break;
-	case KEYBIND_RIGHT:
-		move(Data::DIR_RIGHT);
-		break;
-	case KEYBIND_ENTER:
-		enter();
-		break;
-	case KEYBIND_PASS:
-		pass();
-		break;
-	case KEYBIND_STATS:
-		writeString("Ztats\n");
-		g_engine->addView("ZStats");
-		return;
-	default:
-		writeString("Huh?\n");
-		break;
-	}
-
-	endOfTurn();
-}
-
-void OverworldLogic::keypress(Common::KeyCode keycode) {
-	writeString("Huh?\n");
-	endOfTurn();
-}
-
 void OverworldLogic::enter() {
 	int location = _G(map).getLocationAt(_G(savegame)._overworldPos);
 	if (location == 0) {
@@ -138,10 +101,6 @@ void OverworldLogic::enter() {
 	}
 }
 
-void OverworldLogic::pass() {
-	writeString("Pass\n");
-}
-
 void OverworldLogic::move(Data::Direction dir) {
 	if (!moveCheck(dir))
 		return;
diff --git a/engines/ultima/ultima1/logic/overworld_logic.h b/engines/ultima/ultima1/logic/overworld_logic.h
index bdfa78a0e3e..dbb89126bec 100644
--- a/engines/ultima/ultima1/logic/overworld_logic.h
+++ b/engines/ultima/ultima1/logic/overworld_logic.h
@@ -32,26 +32,11 @@ namespace Logic {
 
 class OverworldLogic : public Logic {
 private:
-	/**
-	 * Enter a location
-	 */
-	void enter();
-
-	/**
-	 * Pass a turn
-	 */
-	void pass();
-
 	/**
 	 * Check for movement
 	 */
 	bool moveCheck(Data::Direction dir);
 
-	/**
-	 * Handle movement
-	 */
-	void move(Data::Direction dir);
-
 	/**
 	 * Get the X co-ordinate for a tile within the map, offset from the left edge of the visible map area
 	 * @param xp	X offset within the window
@@ -116,13 +101,22 @@ private:
 	 */
 	void reduceFood();
 
+protected:
+	/**
+	 * Enter a location
+	 */
+	void enter() override;
+
+	/**
+	 * Handle movement
+	 */
+	void move(Data::Direction dir) override;
+
+
 public:
 	OverworldLogic();
 	~OverworldLogic() override {
 	}
-
-	void action(int action) override;
-	void keypress(Common::KeyCode keycode) override;
 };
 
 } // namespace Logic
diff --git a/engines/ultima/ultima1/logic/pillar_logic.h b/engines/ultima/ultima1/logic/pillar_logic.h
index 45360e18204..8c1bf15b4c7 100644
--- a/engines/ultima/ultima1/logic/pillar_logic.h
+++ b/engines/ultima/ultima1/logic/pillar_logic.h
@@ -30,6 +30,10 @@ namespace Ultima1 {
 namespace Logic {
 
 class PillarLogic : public Logic {
+protected:
+	void move(Data::Direction dir) override {
+	}
+
 public:
 	PillarLogic();
 	~PillarLogic() override {
diff --git a/engines/ultima/ultima1/metaengine.cpp b/engines/ultima/ultima1/metaengine.cpp
index 7351c52ac53..83dab6cce78 100644
--- a/engines/ultima/ultima1/metaengine.cpp
+++ b/engines/ultima/ultima1/metaengine.cpp
@@ -69,7 +69,7 @@ static const KeybindingRecord GAMEPLAY_KEYS[] = {
 	{ KEYBIND_STEAL, "STEAL", _s("Steal"), "s", nullptr },
 	{ KEYBIND_TRANSACT, "TRANSACT", _s("Transact"), "t", nullptr },
 	{ KEYBIND_UNLOCK, "UNLOCK", _s("Unlock"), "u", nullptr },
-	{ KEYBIND_VIEW, "VIEW", _s("View change"), "e", nullptr },
+	{ KEYBIND_VIEW, "VIEW", _s("View change"), "v", nullptr },
 	{ KEYBIND_EXIT, "EXIT", _s("eXit"), "x", nullptr },
 	{ KEYBIND_STATS, "STATS", _s("Ztats"), "z", nullptr },
 	{ KEYBIND_PASS, "PASS", _s("Pass"), " ", nullptr },
diff --git a/engines/ultima/ultima1/ultima1.cpp b/engines/ultima/ultima1/ultima1.cpp
index e90a56d8229..aa1b237b40b 100644
--- a/engines/ultima/ultima1/ultima1.cpp
+++ b/engines/ultima/ultima1/ultima1.cpp
@@ -76,8 +76,11 @@ Common::Error Ultima1Engine::run() {
 Common::Error Ultima1Engine::syncGame(Common::Serializer &s) {
 	_savegame.synchronize(s);
 
-	if (s.isLoading())
+	if (s.isLoading()) {
+		delete _G(logic);
+		_G(logic) = nullptr;
 		_G(map).load(_G(savegame)._mapNum);
+	}
 
 	return Common::kNoError;
 }
diff --git a/engines/ultima/ultima1/views/create_character.cpp b/engines/ultima/ultima1/views/create_character.cpp
index a846967e242..02f44de3158 100644
--- a/engines/ultima/ultima1/views/create_character.cpp
+++ b/engines/ultima/ultima1/views/create_character.cpp
@@ -410,6 +410,9 @@ void CreateCharacter::confirmAndSave() {
 	_cursor.hide();
 
 	// Load the overworld map
+	delete _G(logic);
+	_G(logic) = nullptr;
+
 	_G(map).load(MAP_OVERWORLD);
 }
 


Commit: ec3219b2fb7c1d6eda689081087792a9183bf120
    https://github.com/scummvm/scummvm/commit/ec3219b2fb7c1d6eda689081087792a9183bf120
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:40:48+11:00

Commit Message:
ULTIMA: ULTIMA1: Inform command

Changed paths:
    engines/ultima/ultima1/data/map.cpp
    engines/ultima/ultima1/data/map.h
    engines/ultima/ultima1/logic/logic.cpp
    engines/ultima/ultima1/logic/logic.h
    engines/ultima/ultima1/logic/overworld_logic.h


diff --git a/engines/ultima/ultima1/data/map.cpp b/engines/ultima/ultima1/data/map.cpp
index 56d02169232..65aaf4a5616 100644
--- a/engines/ultima/ultima1/data/map.cpp
+++ b/engines/ultima/ultima1/data/map.cpp
@@ -85,6 +85,13 @@ const char *LOCATION_NAMES[LOCATION_COUNT] = {
 	"The Dead Cat's Life II", "The Hole to Hades"
 };
 
+const char *CONTINENT_NAMES[4] = {
+	"of Lord British",
+	"of the Feudal Lords",
+	"of the Dark Unknown",
+	"of Danger and Despair"
+};
+
 void Map::init() {
 	// Load the overworld map
 	Common::File ow;
@@ -227,12 +234,10 @@ int Map::getTileAt(int x, int y, int creatureIndex) const {
 }
 
 int Map::getContinentAt(int x, int y) const {
-	assert(_currentMap == MAP_OVERWORLD);
 	return (y > 77 ? 2 : 0) + (x > 83 ? 1 : 0);
 }
 
 int Map::getLocationAt(int x, int y) const {
-	assert(_currentMap == MAP_OVERWORLD);
 	for (int i = 0; i < LOCATION_COUNT; ++i) {
 		if (x == LOCATION_POS_X[i] && y == LOCATION_POS_Y[i])
 			return i + 1;
diff --git a/engines/ultima/ultima1/data/map.h b/engines/ultima/ultima1/data/map.h
index 6971df87aaf..addc23ff6e3 100644
--- a/engines/ultima/ultima1/data/map.h
+++ b/engines/ultima/ultima1/data/map.h
@@ -65,6 +65,7 @@ typedef Common::Array< Common::Array<byte> > MapTiles;
 
 extern const char *DIRECTION_NAMES[5];
 extern const char *LOCATION_NAMES[LOCATION_COUNT];
+extern const char *CONTINENT_NAMES[4];
 
 struct Map {
 private:
diff --git a/engines/ultima/ultima1/logic/logic.cpp b/engines/ultima/ultima1/logic/logic.cpp
index 450e7ec86ed..1160ec385f3 100644
--- a/engines/ultima/ultima1/logic/logic.cpp
+++ b/engines/ultima/ultima1/logic/logic.cpp
@@ -21,6 +21,7 @@
  */
 
 #include "ultima/ultima1/logic/logic.h"
+#include "ultima/ultima1/data/map.h"
 #include "ultima/ultima1/ultima1.h"
 #include "ultima/ultima1/metaengine.h"
 
@@ -34,6 +35,17 @@ void Logic::writeString(const Common::String &msg) {
 	g_engine->findView("Commands")->send(GameMessage("TEXT", msg));
 }
 
+void Logic::writeString(const char *format, ...) {
+	va_list alist;
+
+	// Start reading values
+	va_start(alist, format);
+	Common::String msg = Common::String::vformat(format, alist);
+	va_end(alist);
+
+	writeString(msg);
+}
+
 void Logic::prompt() {
 	g_engine->findView("Commands")->send(GameMessage("PROMPT"));
 }
@@ -88,12 +100,23 @@ void Logic::action(int action) {
 	case KEYBIND_ENTER:
 		enter();
 		break;
+	case KEYBIND_FIRE:
+		fire();
+		break;
+	case KEYBIND_GET:
+		get();
+		break;
+	case KEYBIND_HYPERJUMP:
+		hyperjump();
+		break;
+	case KEYBIND_INFORM:
+		inform();
+		break;
 	case KEYBIND_PASS:
 		pass();
 		break;
 	case KEYBIND_STATS:
-		writeString("Ztats\n");
-		g_engine->addView("ZStats");
+		zstats();
 		return;
 	default:
 		writeString("Huh?\n");
@@ -138,6 +161,43 @@ void Logic::get() {
 	playFX(1);
 }
 
+void Logic::hyperjump() {
+	writeString("HyperJump?\n");
+	playFX(1);
+}
+
+void Logic::inform() {
+	writeString("Inform and search\n");
+	int location = _G(map).getLocationAt(_G(savegame)._overworldPos);
+	int continent = _G(map).getContinentAt(_G(savegame)._overworldPos);
+
+	if (location) {
+		if (location < 33)
+			writeString("the city of ");
+
+		writeString("%s\n", Data::LOCATION_NAMES[location - 1]);
+
+	} else {
+		switch (_G(map).getMapTile(_G(savegame)._overworldPos.x, _G(savegame)._overworldPos.y)) {
+		case Data::TILE_OCEAN:
+			writeString("You are at sea\n");
+			break;
+		case Data::TILE_WOODS:
+			writeString("You are in the woods\n");
+			break;
+		default:
+			writeString("You are in the lands\n");
+			writeString("%s\n", Data::CONTINENT_NAMES[continent]);
+			break;
+		}
+	} 
+}
+
+void Logic::zstats() {
+	writeString("Ztats\n");
+	g_engine->addView("ZStats");
+}
+
 void Logic::pass() {
 	writeString("Pass\n");
 }
diff --git a/engines/ultima/ultima1/logic/logic.h b/engines/ultima/ultima1/logic/logic.h
index 07d41502876..fb94380775d 100644
--- a/engines/ultima/ultima1/logic/logic.h
+++ b/engines/ultima/ultima1/logic/logic.h
@@ -40,6 +40,7 @@ protected:
 	 * Dispatches some text to be shown in the Commands window
 	 */
 	void writeString(const Common::String &msg);
+	void writeString(const char *format, ...);
 
 	/**
 	 * Triggers a prompt display in the Commands window
@@ -70,7 +71,7 @@ protected:
 	/**
 	 * Handles end of turn logic
 	 */
-	void endOfTurn();
+	virtual void endOfTurn();
 
 	/*--- Fallback player action handlers ---*/
 
@@ -80,6 +81,9 @@ protected:
 	virtual void enter();
 	virtual void fire();
 	virtual void get();
+	virtual void hyperjump();
+	virtual void inform();
+	virtual void zstats();
 	virtual void move(Data::Direction dir) = 0;
 	virtual void pass();
 
diff --git a/engines/ultima/ultima1/logic/overworld_logic.h b/engines/ultima/ultima1/logic/overworld_logic.h
index dbb89126bec..17ef8a407f1 100644
--- a/engines/ultima/ultima1/logic/overworld_logic.h
+++ b/engines/ultima/ultima1/logic/overworld_logic.h
@@ -84,7 +84,7 @@ private:
 	/**
 	 * Called after an action is done
 	 */
-	void endOfTurn();
+	void endOfTurn() override;
 
 	/**
 	 * Generate monsters for the overworld


Commit: f5663ad32aff002f7c3cf0ded143acad2ae87f29
    https://github.com/scummvm/scummvm/commit/f5663ad32aff002f7c3cf0ded143acad2ae87f29
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:40:48+11:00

Commit Message:
ULTIMA: ULTIMA1: Further command defaults

Changed paths:
    engines/ultima/ultima1/logic/logic.cpp
    engines/ultima/ultima1/logic/logic.h


diff --git a/engines/ultima/ultima1/logic/logic.cpp b/engines/ultima/ultima1/logic/logic.cpp
index 1160ec385f3..c82d63da3a7 100644
--- a/engines/ultima/ultima1/logic/logic.cpp
+++ b/engines/ultima/ultima1/logic/logic.cpp
@@ -97,6 +97,9 @@ void Logic::action(int action) {
 	case KEYBIND_RIGHT:
 		move(Data::DIR_RIGHT);
 		break;
+	case KEYBIND_CLIMB:
+		climb();
+		break;
 	case KEYBIND_ENTER:
 		enter();
 		break;
@@ -112,6 +115,18 @@ void Logic::action(int action) {
 	case KEYBIND_INFORM:
 		inform();
 		break;
+	case KEYBIND_NOISE:
+		noise();
+		break;
+	case KEYBIND_OPEN:
+		open();
+		break;
+	case KEYBIND_QUIT:
+		quit();
+		break;
+	case KEYBIND_READY:
+		ready();
+		break;
 	case KEYBIND_PASS:
 		pass();
 		break;
@@ -141,6 +156,11 @@ void Logic::cast() {
 	playFX(6);
 }
 
+void Logic::climb() {
+	writeString("K-Limb?\n");
+	playFX(1);
+}
+
 void Logic::drop() {
 	writeString("Drop?\n");
 	playFX(1);
@@ -193,6 +213,25 @@ void Logic::inform() {
 	} 
 }
 
+void Logic::noise() {
+	_G(savegame)._soundOn = !_G(savegame)._soundOn;
+	writeString("Noise %s\n", _G(savegame)._soundOn ? "on" : "off");
+}
+
+void Logic::open() {
+	writeString("Open?\n");
+	playFX(1);
+}
+
+void Logic::quit() {
+	writeString("Quit - only allowed outdoors!\n");
+	playFX(1);
+}
+
+void Logic::ready() {
+	// TODO
+}
+
 void Logic::zstats() {
 	writeString("Ztats\n");
 	g_engine->addView("ZStats");
diff --git a/engines/ultima/ultima1/logic/logic.h b/engines/ultima/ultima1/logic/logic.h
index fb94380775d..4e7d530fad8 100644
--- a/engines/ultima/ultima1/logic/logic.h
+++ b/engines/ultima/ultima1/logic/logic.h
@@ -77,12 +77,17 @@ protected:
 
 	virtual void board();
 	virtual void cast();
+	virtual void climb();
 	virtual void drop();
 	virtual void enter();
 	virtual void fire();
 	virtual void get();
 	virtual void hyperjump();
 	virtual void inform();
+	virtual void noise();
+	virtual void open();
+	virtual void quit();
+	virtual void ready();
 	virtual void zstats();
 	virtual void move(Data::Direction dir) = 0;
 	virtual void pass();


Commit: f280368301ba9fde553ce5b360c663e9a462b8ba
    https://github.com/scummvm/scummvm/commit/f280368301ba9fde553ce5b360c663e9a462b8ba
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:40:48+11:00

Commit Message:
ULTIMA: ULTIMA1: Beginnings of Interaction view hierarchy

In progress Ready command user interface

Changed paths:
  A engines/ultima/ultima1/views/interactions/dead.cpp
  A engines/ultima/ultima1/views/interactions/dead.h
  A engines/ultima/ultima1/views/interactions/interaction.cpp
  A engines/ultima/ultima1/views/interactions/interaction.h
  A engines/ultima/ultima1/views/interactions/ready.cpp
  A engines/ultima/ultima1/views/interactions/ready.h
  R engines/ultima/ultima1/views/dead.cpp
  R engines/ultima/ultima1/views/dead.h
    engines/ultima/module.mk
    engines/ultima/shared/gfx/gfx_surface.h
    engines/ultima/ultima1/logic/logic.cpp
    engines/ultima/ultima1/views/commands.cpp
    engines/ultima/ultima1/views/commands.h
    engines/ultima/ultima1/views/views.h
    engines/ultima/ultima1/views/zstats.cpp


diff --git a/engines/ultima/module.mk b/engines/ultima/module.mk
index 464462fd3ef..214ca87f3a4 100644
--- a/engines/ultima/module.mk
+++ b/engines/ultima/module.mk
@@ -65,10 +65,12 @@ MODULE_OBJS += \
 	ultima1/logic/dungeon_logic.o \
 	ultima1/logic/overworld_logic.o \
 	ultima1/logic/pillar_logic.o \
+	ultima1/views/interactions/interaction.o \
+	ultima1/views/interactions/dead.o \
+	ultima1/views/interactions/ready.o \
 	ultima1/views/view.o \
 	ultima1/views/commands.o \
 	ultima1/views/create_character.o \
-	ultima1/views/dead.o \
 	ultima1/views/dialog.o \
 	ultima1/views/full_screen_dialog.o \
 	ultima1/views/game.o \
diff --git a/engines/ultima/shared/gfx/gfx_surface.h b/engines/ultima/shared/gfx/gfx_surface.h
index b8af4974a3c..6f48b714b33 100644
--- a/engines/ultima/shared/gfx/gfx_surface.h
+++ b/engines/ultima/shared/gfx/gfx_surface.h
@@ -58,6 +58,9 @@ public:
 	int getStringWidth(const Common::String &str) const;
 
 	void setTextPos(const Common::Point &pt);
+	const Common::Point &getTextPos() const {
+		return _textPos;
+	}
 	byte setColor(byte color);
 	void setColor(byte fgColor, byte bgColor);
 	void reverseColor();
diff --git a/engines/ultima/ultima1/logic/logic.cpp b/engines/ultima/ultima1/logic/logic.cpp
index c82d63da3a7..8c63cabd328 100644
--- a/engines/ultima/ultima1/logic/logic.cpp
+++ b/engines/ultima/ultima1/logic/logic.cpp
@@ -126,7 +126,7 @@ void Logic::action(int action) {
 		break;
 	case KEYBIND_READY:
 		ready();
-		break;
+		return;
 	case KEYBIND_PASS:
 		pass();
 		break;
@@ -229,7 +229,7 @@ void Logic::quit() {
 }
 
 void Logic::ready() {
-	// TODO
+	g_engine->addView("Ready");
 }
 
 void Logic::zstats() {
diff --git a/engines/ultima/ultima1/views/commands.cpp b/engines/ultima/ultima1/views/commands.cpp
index 9b45a9da94e..abae2b8bc1e 100644
--- a/engines/ultima/ultima1/views/commands.cpp
+++ b/engines/ultima/ultima1/views/commands.cpp
@@ -52,12 +52,14 @@ bool Commands::msgGame(const GameMessage &msg) {
 	if (msg._name == "TEXT") {
 		writeString(msg._stringValue);
 		return true;
+	} else if (msg._name == "RESET_LINE") {
+		resetLine();
+		return true;
+	} else if (msg._name == "SHOW_CURSOR") {
+		showCursor();
 	} else if (msg._name == "PROMPT") {
 		prompt();
 		return true;
-	} else if (msg._name == "SPACE") {
-		spaceToContinue();
-		return true;
 	}
 
 	return false;
@@ -68,19 +70,22 @@ void Commands::writeString(const Common::String &msg) {
 	_surface.writeString(msg);
 }
 
-void Commands::prompt() {
+void Commands::resetLine() {
 	_surface.fillRect(TextRect(0, 4, 29, 4), 0);	// Clear entire bottom row
-	_surface.writeString(Point(0, 4), "\x10");
-	_textCursor.setPosition(Common::Point(1, 24));
-	_textCursor.show();
+	_surface.setTextPos(Point(0, 4));
 }
 
-void Commands::spaceToContinue() {
-	writeString("Press Space to continue:");
-	_textCursor.setPosition(Common::Point(25, 24));
+void Commands::showCursor() {
+	_textCursor.setPosition(Common::Point(_surface.getTextPos().x, 24));
 	_textCursor.show();
 }
 
+void Commands::prompt() {
+	resetLine();
+	_surface.writeString("\x10");
+	showCursor();
+}
+
 } // namespace Views
 } // namespace Ultima1
 } // namespace Ultima
diff --git a/engines/ultima/ultima1/views/commands.h b/engines/ultima/ultima1/views/commands.h
index 465af1c797a..76e12792c4c 100644
--- a/engines/ultima/ultima1/views/commands.h
+++ b/engines/ultima/ultima1/views/commands.h
@@ -45,8 +45,9 @@ public:
 	bool msgGame(const GameMessage &msg) override;
 
 	void writeString(const Common::String &msg);
+	void resetLine();
+	void showCursor();
 	void prompt();
-	void spaceToContinue();
 };
 
 } // namespace Views
diff --git a/engines/ultima/ultima1/views/dead.cpp b/engines/ultima/ultima1/views/interactions/dead.cpp
similarity index 90%
rename from engines/ultima/ultima1/views/dead.cpp
rename to engines/ultima/ultima1/views/interactions/dead.cpp
index 4faa6d8464e..5df577c70d9 100644
--- a/engines/ultima/ultima1/views/dead.cpp
+++ b/engines/ultima/ultima1/views/interactions/dead.cpp
@@ -19,16 +19,14 @@
  *
  */
 
-#include "ultima/ultima1/views/dead.h"
+#include "ultima/ultima1/views/interactions/dead.h"
 
 namespace Ultima {
 namespace Ultima1 {
 namespace Views {
+namespace Interactions {
 
-Dead::Dead() : View("Dead") {
-	setBounds(Common::Rect(0, 0, 0, 0));
-}
-
+} // namespace Interactions
 } // namespace Views
 } // namespace Ultima1
 } // namespace Ultima
diff --git a/engines/ultima/ultima1/views/dead.h b/engines/ultima/ultima1/views/interactions/dead.h
similarity index 80%
rename from engines/ultima/ultima1/views/dead.h
rename to engines/ultima/ultima1/views/interactions/dead.h
index 2c0794b2546..fd7c485926d 100644
--- a/engines/ultima/ultima1/views/dead.h
+++ b/engines/ultima/ultima1/views/interactions/dead.h
@@ -19,25 +19,29 @@
  *
  */
 
-#ifndef ULTIMA1_VIEWS_DEAD_H
-#define ULTIMA1_VIEWS_DEAD_H
+#ifndef ULTIMA1_VIEWS_INTERACTIONS_DEAD_H
+#define ULTIMA1_VIEWS_INTERACTIONS_DEAD_H
 
-#include "ultima/shared/gfx/view.h"
+#include "ultima/ultima1/views/interactions/interaction.h"
 
 namespace Ultima {
 namespace Ultima1 {
 namespace Views {
+namespace Interactions {
 
 /**
  * Dummy view to go to when the player dies. This allows the game to know
  * not to allow saving anymore, and to stop on-screen map animations.
  */
-class Dead : public Shared::Gfx::View {
+class Dead : public Interaction {
 public:
-	Dead();
-	~Dead() override {}
+	Dead() : Interaction("Dead") {
+	}
+	~Dead() override {
+	}
 };
 
+} // namespace Interactions
 } // namespace Views
 } // namespace Ultima1
 } // namespace Ultima
diff --git a/engines/ultima/ultima1/views/interactions/interaction.cpp b/engines/ultima/ultima1/views/interactions/interaction.cpp
new file mode 100644
index 00000000000..3d402beec96
--- /dev/null
+++ b/engines/ultima/ultima1/views/interactions/interaction.cpp
@@ -0,0 +1,71 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "ultima/ultima1/views/interactions/interaction.h"
+#include "ultima/ultima1/ultima1.h"
+
+namespace Ultima {
+namespace Ultima1 {
+namespace Views {
+namespace Interactions {
+
+using namespace Ultima::Shared::Messages;
+
+Interaction::Interaction(const Common::String &name) : View(name) {
+	setBounds(Common::Rect(0, 0, 0, 0));
+}
+
+bool Interaction::tick() {
+	g_engine->findView("Commands")->tick();
+	return Shared::Gfx::View::tick();
+}
+
+void Interaction::writeString(const Common::String &msg) {
+	g_engine->findView("Commands")->send(GameMessage("TEXT", msg));
+}
+
+void Interaction::writeString(const char *format, ...) {
+	va_list alist;
+
+	// Start reading values
+	va_start(alist, format);
+	Common::String msg = Common::String::vformat(format, alist);
+	va_end(alist);
+
+	writeString(msg);
+}
+
+void Interaction::resetLine() {
+	g_engine->findView("Commands")->send(GameMessage("RESET_LINE"));
+}
+
+void Interaction::showCursor() {
+	g_engine->findView("Commands")->send(GameMessage("SHOW_CURSOR"));
+}
+
+void Interaction::prompt() {
+	g_engine->findView("Commands")->send(GameMessage("PROMPT"));
+}
+
+} // namespace Interactions
+} // namespace Views
+} // namespace Ultima1
+} // namespace Ultima
diff --git a/engines/ultima/ultima1/views/interactions/interaction.h b/engines/ultima/ultima1/views/interactions/interaction.h
new file mode 100644
index 00000000000..6e4a6aff1bb
--- /dev/null
+++ b/engines/ultima/ultima1/views/interactions/interaction.h
@@ -0,0 +1,58 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef ULTIMA1_VIEWS_INTERACTIONS_INTERACTION_H
+#define ULTIMA1_VIEWS_INTERACTIONS_INTERACTION_H
+
+#include "ultima/shared/gfx/view.h"
+
+namespace Ultima {
+namespace Ultima1 {
+namespace Views {
+namespace Interactions {
+
+/**
+ * Base view for any interaction that prompts the user for information.
+ * It creates a dummy 0x0 size window on top of the current one that
+ * can receive input, and does any output in the commands window
+ */
+class Interaction : public Shared::Gfx::View {
+protected:
+	void writeString(const Common::String &msg);
+	void writeString(const char *format, ...);
+	void resetLine();
+	void showCursor();
+	void prompt();
+
+public:
+	Interaction(const Common::String &name);
+	~Interaction() override {
+	}
+
+	bool tick() override;
+};
+
+} // namespace Interactions
+} // namespace Views
+} // namespace Ultima1
+} // namespace Ultima
+
+#endif
diff --git a/engines/ultima/ultima1/views/interactions/ready.cpp b/engines/ultima/ultima1/views/interactions/ready.cpp
new file mode 100644
index 00000000000..12b2ee581b9
--- /dev/null
+++ b/engines/ultima/ultima1/views/interactions/ready.cpp
@@ -0,0 +1,132 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "ultima/ultima1/views/interactions/ready.h"
+
+namespace Ultima {
+namespace Ultima1 {
+namespace Views {
+namespace Interactions {
+
+Ready::Ready() : Interaction("Ready") {
+}
+
+bool Ready::msgFocus(const FocusMessage &msg) {
+	// Start by getting them to select the area
+	_mode = READY_AREA;
+	setBounds(Common::Rect(0, 0, 0, 0));
+	writeString("Ready Weapon,Armour,Spell:");
+	showCursor();
+	return true;
+}
+
+bool Ready::msgAction(const ActionMessage &msg) {
+	nothing();
+	return true;
+}
+
+bool Ready::msgKeypress(const KeypressMessage &msg) {
+	switch (_mode) {
+	case READY_AREA:
+		switch (msg.keycode) {
+		case Common::KEYCODE_w:
+			// Ready weapon
+			_mode = READY_WEAPON;
+			resetLine();
+			writeString("\x10Ready weapon: ");
+			showCursor();
+
+			// Draw a proper dialog with the list of selections
+			setBounds(TextRect(0, 0, 39, 19));
+			redraw();
+			break;
+
+		case Common::KEYCODE_a:
+			// Ready armor
+			_mode = READY_ARMOUR;
+			resetLine();
+			writeString("\x10Ready armour: ");
+			showCursor();
+
+			// Draw a proper dialog with the list of selections
+			setBounds(TextRect(0, 0, 39, 19));
+			redraw();
+			break;
+
+		case Common::KEYCODE_s:
+			// Ready spell
+			_mode = READY_SPELL;
+			resetLine();
+			writeString("\x10Ready spell:  ");
+			showCursor();
+
+			// Draw a proper dialog with the list of selections
+			setBounds(TextRect(0, 0, 39, 19));
+			redraw();
+			break;
+
+		default:
+			// Everything else aborts ready
+			nothing();
+			break;
+		}
+		break;
+
+	case READY_WEAPON:
+		break;
+
+	case READY_ARMOUR:
+		break;
+
+	case READY_SPELL:
+	default:
+		break;
+	}
+
+	return true;
+}
+
+void Ready::draw() {
+	// No initial drawing when waiting for ready area
+	if (_mode == READY_AREA)
+		return;
+
+	// Display title
+	auto s = getSurface();
+	s.writeString(Point(16, 0), "\x10 Ready \x11");
+
+	// Clear dialog content
+	s.fillRect(TextRect(1, 1, 38, 18), 0);
+
+	// Draw list of selections
+}
+
+void Ready::nothing() {
+	resetLine();
+	writeString("\x10Ready nothing\n");
+	prompt();
+	close();
+}
+
+} // namespace Interactions
+} // namespace Views
+} // namespace Ultima1
+} // namespace Ultima
diff --git a/engines/ultima/ultima1/views/interactions/ready.h b/engines/ultima/ultima1/views/interactions/ready.h
new file mode 100644
index 00000000000..365e14a25dc
--- /dev/null
+++ b/engines/ultima/ultima1/views/interactions/ready.h
@@ -0,0 +1,62 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef ULTIMA1_VIEWS_INTERACTIONS_READY_H
+#define ULTIMA1_VIEWS_INTERACTIONS_READY_H
+
+#include "ultima/ultima1/views/interactions/interaction.h"
+
+namespace Ultima {
+namespace Ultima1 {
+namespace Views {
+namespace Interactions {
+
+using namespace Ultima::Shared::Messages;
+
+/**
+ * Handler for the Ready command
+ */
+class Ready : public Interaction {
+	enum Mode {
+		READY_AREA, READY_WEAPON, READY_ARMOUR, READY_SPELL
+	};
+private:
+	Mode _mode = READY_AREA;
+
+	void nothing();
+
+public:
+	Ready();
+	~Ready() override {
+	}
+
+	void draw() override;
+	bool msgFocus(const FocusMessage &msg) override;
+	bool msgAction(const ActionMessage &msg) override;
+	bool msgKeypress(const KeypressMessage &msg) override;
+};
+
+} // namespace Interactions
+} // namespace Views
+} // namespace Ultima1
+} // namespace Ultima
+
+#endif
diff --git a/engines/ultima/ultima1/views/views.h b/engines/ultima/ultima1/views/views.h
index ac26615757b..bfb8223aee7 100644
--- a/engines/ultima/ultima1/views/views.h
+++ b/engines/ultima/ultima1/views/views.h
@@ -23,6 +23,8 @@
 #define ULTIMA1_VIEWS_H
 
 #include "ultima/shared/engine/events.h"
+#include "ultima/ultima1/views/interactions/dead.h"
+#include "ultima/ultima1/views/interactions/ready.h"
 #include "ultima/ultima1/views/create_character.h"
 #include "ultima/ultima1/views/game.h"
 #include "ultima/ultima1/views/location_map.h"
@@ -37,6 +39,8 @@ namespace Ultima1 {
 namespace Views {
 
 struct Views : public Shared::Views {
+	Interactions::Dead _dead;
+	Interactions::Ready _ready;
 	CreateCharacter _createCharacter;
 	Game _game;
 	LocationMap _locationMap;
diff --git a/engines/ultima/ultima1/views/zstats.cpp b/engines/ultima/ultima1/views/zstats.cpp
index ed01c4100d1..8f0dcf07734 100644
--- a/engines/ultima/ultima1/views/zstats.cpp
+++ b/engines/ultima/ultima1/views/zstats.cpp
@@ -34,7 +34,9 @@ constexpr int COLOR_HIGHLIGHT = 12; // light red - currently equipped/readied it
 constexpr int LINES_PER_PAGE = 26;
 
 bool ZStats::msgFocus(const FocusMessage &msg) {
-	g_engine->send("Commands", GameMessage("SPACE"));
+	g_engine->send("Commands", GameMessage("TEXT", "Press Space to continue: "));
+	g_engine->send("Commands", GameMessage("SHOW_CURSOR"));
+
 	buildLines();
 	_pageStart = 0;
 	return Dialog::msgFocus(msg);


Commit: 117ba0d9dd20bd47769a4ab71857964a484019f7
    https://github.com/scummvm/scummvm/commit/117ba0d9dd20bd47769a4ab71857964a484019f7
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:40:48+11:00

Commit Message:
ULTIMA: ULTIMA1: Finished Ready action

Changed paths:
    engines/ultima/ultima1/views/interactions/ready.cpp
    engines/ultima/ultima1/views/interactions/ready.h


diff --git a/engines/ultima/ultima1/views/interactions/ready.cpp b/engines/ultima/ultima1/views/interactions/ready.cpp
index 12b2ee581b9..409587c13f0 100644
--- a/engines/ultima/ultima1/views/interactions/ready.cpp
+++ b/engines/ultima/ultima1/views/interactions/ready.cpp
@@ -20,12 +20,15 @@
  */
 
 #include "ultima/ultima1/views/interactions/ready.h"
+#include "ultima/ultima1/ultima1.h"
 
 namespace Ultima {
 namespace Ultima1 {
 namespace Views {
 namespace Interactions {
 
+constexpr int COLOR_TEXT = 11; // light cyan
+
 Ready::Ready() : Interaction("Ready") {
 }
 
@@ -91,12 +94,20 @@ bool Ready::msgKeypress(const KeypressMessage &msg) {
 		break;
 
 	case READY_WEAPON:
+		selectItem(_G(savegame)._weapons, Data::WEAPON_NAMES, Data::WEAPON_COUNT - 1,
+			_G(savegame)._equippedWeapon, "weapon", msg.keycode);
 		break;
 
 	case READY_ARMOUR:
+		selectItem(_G(savegame)._armor, Data::ARMOR_NAMES, Data::ARMOR_COUNT - 1,
+			_G(savegame)._equippedArmor, "armour", msg.keycode);
 		break;
 
 	case READY_SPELL:
+		selectItem(_G(savegame)._spells, Data::SPELL_NAMES, Data::SPELL_COUNT - 1,
+			_G(savegame)._equippedSpell, "spell", msg.keycode);
+		break;
+
 	default:
 		break;
 	}
@@ -117,11 +128,68 @@ void Ready::draw() {
 	s.fillRect(TextRect(1, 1, 38, 18), 0);
 
 	// Draw list of selections
+	switch (_mode) {
+	case READY_WEAPON:
+		drawItemList(_G(savegame)._weapons, Data::WEAPON_NAMES, Data::WEAPON_COUNT - 1);
+		break;
+	case READY_ARMOUR:
+		drawItemList(_G(savegame)._armor, Data::ARMOR_NAMES, Data::ARMOR_COUNT - 1);
+		break;
+	case READY_SPELL:
+		drawItemList(_G(savegame)._spells, Data::SPELL_NAMES, Data::SPELL_COUNT - 1);
+		break;
+	default:
+		break;
+	}
+}
+
+void Ready::drawItemList(const int16 *items, const char *const *names, int maxIndex) {
+	auto s = getSurface();
+
+	// Count the owned items so the list can be vertically centered
+	int count = 0;
+	for (int idx = 0; idx <= maxIndex; ++idx) {
+		if (items[idx])
+			++count;
+	}
+
+	int y = 10 - count / 2;
+	s.setColor(COLOR_TEXT);
+
+	for (int idx = 0; idx <= maxIndex; ++idx) {
+		if (items[idx]) {
+			s.writeString(Point(15, y), "%c) %s", 'a' + idx, names[idx]);
+			++y;
+		}
+	}
+}
+
+void Ready::selectItem(const int16 *items, const char *const *names, int maxIndex,
+		int16 &equippedIndex, const char *label, Common::KeyCode keycode) {
+	int idx = keycode - Common::KEYCODE_a;
+
+	// An out of range letter, or one for an item not owned, leaves
+	// whatever was already readied unchanged
+	if (idx < 0 || idx > maxIndex || !items[idx])
+		idx = equippedIndex;
+
+	equippedIndex = idx;
+
+	// Display readied selection
+	Common::String msg = Common::String::format("%s: ", label);
+	if (_mode == READY_SPELL)
+		msg += ' ';
+	msg += names[idx];
+	ready(msg.c_str());
 }
 
 void Ready::nothing() {
+	ready("nothing");
+}
+
+void Ready::ready(const char *name) {
 	resetLine();
-	writeString("\x10Ready nothing\n");
+	writeString("\x10Ready %s\n", name);
 	prompt();
 	close();
 }
diff --git a/engines/ultima/ultima1/views/interactions/ready.h b/engines/ultima/ultima1/views/interactions/ready.h
index 365e14a25dc..206aedcb766 100644
--- a/engines/ultima/ultima1/views/interactions/ready.h
+++ b/engines/ultima/ultima1/views/interactions/ready.h
@@ -42,6 +42,22 @@ private:
 	Mode _mode = READY_AREA;
 
 	void nothing();
+	void ready(const char *name);
+
+	/**
+	 * Handles a letter keypress made while selecting from a list of
+	 * items - validates it against the owned items array, falling back
+	 * to the currently equipped index if it's out of range or refers to
+	 * an item that isn't owned, then readies the result
+	 */
+	void selectItem(const int16 *items, const char *const *names, int maxIndex,
+		int16 &equippedIndex, const char *label, Common::KeyCode keycode);
+
+	/**
+	 * Draws the centered, lettered list of items selectable in the
+	 * current mode
+	 */
+	void drawItemList(const int16 *items, const char *const *names, int maxIndex);
 
 public:
 	Ready();


Commit: 65d03984f087868129e6343a83c334184bb4b59b
    https://github.com/scummvm/scummvm/commit/65d03984f087868129e6343a83c334184bb4b59b
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:40:48+11:00

Commit Message:
ULTIMA: ULTIMA1: Added Drop action dialog

Changed paths:
  A engines/ultima/ultima1/views/interactions/drop.cpp
  A engines/ultima/ultima1/views/interactions/drop.h
    engines/ultima/module.mk
    engines/ultima/ultima1/data/tiles.h
    engines/ultima/ultima1/logic/city_castle_logic.cpp
    engines/ultima/ultima1/logic/city_castle_logic.h
    engines/ultima/ultima1/logic/logic.cpp
    engines/ultima/ultima1/views/views.h


diff --git a/engines/ultima/module.mk b/engines/ultima/module.mk
index 214ca87f3a4..1f01d76364a 100644
--- a/engines/ultima/module.mk
+++ b/engines/ultima/module.mk
@@ -67,6 +67,7 @@ MODULE_OBJS += \
 	ultima1/logic/pillar_logic.o \
 	ultima1/views/interactions/interaction.o \
 	ultima1/views/interactions/dead.o \
+	ultima1/views/interactions/drop.o \
 	ultima1/views/interactions/ready.o \
 	ultima1/views/view.o \
 	ultima1/views/commands.o \
diff --git a/engines/ultima/ultima1/data/tiles.h b/engines/ultima/ultima1/data/tiles.h
index 5565e3c41f7..c6676cd9e90 100644
--- a/engines/ultima/ultima1/data/tiles.h
+++ b/engines/ultima/ultima1/data/tiles.h
@@ -60,6 +60,10 @@ enum LocationTileId {
 	CTILE_GROUND = 1,
 	CTILE_PLAYER = 18,
 	CTILE_GUARD_MB = 51,
+	// Unnamed in the original - both are "wishing well"-style tiles that
+	// dropPence/dropPenceCastle give a random bonus for dropping coins on
+	CTILE_52 = 52,
+	CTILE_53 = 53,
 	CTILE_BLANK = 63
 };
 
diff --git a/engines/ultima/ultima1/logic/city_castle_logic.cpp b/engines/ultima/ultima1/logic/city_castle_logic.cpp
index 37b720d60db..c87c1bf58e2 100644
--- a/engines/ultima/ultima1/logic/city_castle_logic.cpp
+++ b/engines/ultima/ultima1/logic/city_castle_logic.cpp
@@ -125,6 +125,10 @@ void CityCastleLogic::entering() {
 	loadEntities();
 }
 
+void CityCastleLogic::drop() {
+	g_engine->addView("Drop");
+}
+
 void CityCastleLogic::loadEntities() {
 	auto &map = _G(map);
 	auto &savegame = _G(savegame);
diff --git a/engines/ultima/ultima1/logic/city_castle_logic.h b/engines/ultima/ultima1/logic/city_castle_logic.h
index 2868e19f623..1bc2babd700 100644
--- a/engines/ultima/ultima1/logic/city_castle_logic.h
+++ b/engines/ultima/ultima1/logic/city_castle_logic.h
@@ -36,6 +36,11 @@ protected:
 	 */
 	void loadEntities();
 
+	/**
+	 * The Drop command is only usable within cities and castles
+	 */
+	void drop() override;
+
 public:
 	~CityCastleLogic() override {
 	}
diff --git a/engines/ultima/ultima1/logic/logic.cpp b/engines/ultima/ultima1/logic/logic.cpp
index 8c63cabd328..ffaf942a784 100644
--- a/engines/ultima/ultima1/logic/logic.cpp
+++ b/engines/ultima/ultima1/logic/logic.cpp
@@ -100,6 +100,9 @@ void Logic::action(int action) {
 	case KEYBIND_CLIMB:
 		climb();
 		break;
+	case KEYBIND_DROP:
+		drop();
+		return;
 	case KEYBIND_ENTER:
 		enter();
 		break;
@@ -164,6 +167,7 @@ void Logic::climb() {
 void Logic::drop() {
 	writeString("Drop?\n");
 	playFX(1);
+	endOfTurn();
 }
 
 void Logic::enter() {
diff --git a/engines/ultima/ultima1/views/interactions/drop.cpp b/engines/ultima/ultima1/views/interactions/drop.cpp
new file mode 100644
index 00000000000..4c60b2788b2
--- /dev/null
+++ b/engines/ultima/ultima1/views/interactions/drop.cpp
@@ -0,0 +1,334 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "ultima/ultima1/views/interactions/drop.h"
+#include "ultima/ultima1/ultima1.h"
+
+namespace Ultima {
+namespace Ultima1 {
+namespace Views {
+namespace Interactions {
+
+constexpr int COLOR_TEXT = 11; // light cyan
+
+// Returns how many of items[1..maxIndex] are actually owned (index 0,
+// the innate/default state, is never droppable)
+static int countOwned(const int16 *items, int maxIndex) {
+	int count = 0;
+	for (int idx = 1; idx <= maxIndex; ++idx) {
+		if (items[idx])
+			++count;
+	}
+
+	return count;
+}
+
+Drop::Drop() : Interaction("Drop") {
+}
+
+bool Drop::msgFocus(const FocusMessage &msg) {
+	_mode = DROP_AREA;
+	setBounds(Common::Rect(0, 0, 0, 0));
+	writeString("Drop Pence,Weapon,Armour:");
+	showCursor();
+	return true;
+}
+
+bool Drop::msgAction(const ActionMessage &msg) {
+	none();
+	return true;
+}
+
+bool Drop::msgKeypress(const KeypressMessage &msg) {
+	switch (_mode) {
+	case DROP_AREA:
+		switch (msg.keycode) {
+		case Common::KEYCODE_p:
+			_mode = DROP_PENCE;
+			_amount.clear();
+			resetLine();
+			writeString("\x10""Drop pence: ");
+			showCursor();
+			break;
+
+		case Common::KEYCODE_w:
+			if (!countOwned(_G(savegame)._weapons, Data::WEAPON_COUNT - 1)) {
+				none();
+				break;
+			}
+
+			_mode = DROP_WEAPON;
+			resetLine();
+			writeString("\x10""Drop weapon: ");
+			showCursor();
+
+			// Draw a proper dialog with the list of selections
+			setBounds(TextRect(0, 0, 39, 19));
+			redraw();
+			break;
+
+		case Common::KEYCODE_a:
+			if (!countOwned(_G(savegame)._armor, Data::ARMOR_COUNT - 1)) {
+				none();
+				break;
+			}
+
+			_mode = DROP_ARMOUR;
+			resetLine();
+			writeString("\x10""Drop armour: ");
+			showCursor();
+
+			// Draw a proper dialog with the list of selections
+			setBounds(TextRect(0, 0, 39, 19));
+			redraw();
+			break;
+
+		default:
+			// Everything else aborts drop
+			none();
+			break;
+		}
+		break;
+
+	case DROP_PENCE:
+		penceKeypress(msg);
+		break;
+
+	case DROP_WEAPON:
+		selectItem(_G(savegame)._weapons, Data::WEAPON_NAMES, Data::WEAPON_COUNT - 1,
+			_G(savegame)._equippedWeapon, msg.keycode);
+		break;
+
+	case DROP_ARMOUR:
+		selectItem(_G(savegame)._armor, Data::ARMOR_NAMES, Data::ARMOR_COUNT - 1,
+			_G(savegame)._equippedArmor, msg.keycode);
+		break;
+
+	default:
+		break;
+	}
+
+	return true;
+}
+
+void Drop::draw() {
+	// No initial drawing when waiting for drop area, or during pence
+	// entry, which stays entirely within the Commands text area
+	if (_mode == DROP_AREA || _mode == DROP_PENCE)
+		return;
+
+	// Display title
+	auto s = getSurface();
+	s.writeString(Point(16, 0), "\x10 Drop \x11");
+
+	// Clear dialog content
+	s.fillRect(TextRect(1, 1, 38, 18), 0);
+
+	switch (_mode) {
+	case DROP_WEAPON:
+		drawItemList(_G(savegame)._weapons, Data::WEAPON_NAMES, Data::WEAPON_COUNT - 1, 15);
+		break;
+	case DROP_ARMOUR:
+		drawItemList(_G(savegame)._armor, Data::ARMOR_NAMES, Data::ARMOR_COUNT - 1, 13);
+		break;
+	default:
+		break;
+	}
+}
+
+void Drop::drawItemList(const int16 *items, const char *const *names, int maxIndex, int col) {
+	auto s = getSurface();
+	int count = countOwned(items, maxIndex);
+	int y = 10 - count / 2;
+
+	s.setColor(COLOR_TEXT);
+	for (int idx = 1; idx <= maxIndex; ++idx) {
+		if (items[idx]) {
+			s.writeString(Point(col, y), "%c) %s", 'a' + idx, names[idx]);
+			++y;
+		}
+	}
+}
+
+void Drop::selectItem(int16 *items, const char *const *names, int maxIndex,
+		int16 &equippedIndex, Common::KeyCode keycode) {
+	int idx = keycode - Common::KEYCODE_a;
+
+	// Unlike Ready, an out of range or unowned choice just drops nothing,
+	// rather than falling back to a previous selection
+	if (idx < 1 || idx > maxIndex || !items[idx]) {
+		writeString("none");
+	} else {
+		writeString(names[idx]);
+		--items[idx];
+
+		// If the last of the currently readied one was just dropped, unready it
+		if (idx == equippedIndex && items[idx] == 0)
+			equippedIndex = 0;
+	}
+
+	finish();
+}
+
+void Drop::penceKeypress(const KeypressMessage &msg) {
+	if (msg.ascii >= '0' && msg.ascii <= '9') {
+		// No leading zero, and no more than 4 digits
+		if ((_amount.empty() && msg.ascii == '0') || _amount.size() >= 4)
+			return;
+
+		_amount += (char)msg.ascii;
+		writeString(Common::String(1, (char)msg.ascii));
+
+	} else if (msg.keycode == Common::KEYCODE_BACKSPACE) {
+		if (!_amount.empty()) {
+			_amount.deleteLastChar();
+			resetLine();
+			writeString(Common::String::format("\x10""Drop pence: %s", _amount.c_str()));
+			showCursor();
+		}
+
+	} else {
+		// Any other key finalizes the amount entered so far
+		dropPence();
+	}
+}
+
+void Drop::dropPence() {
+	auto &sg = _G(savegame);
+	int total = _amount.empty() ? 0 : atoi(_amount.c_str());
+
+	if (!total) {
+		writeString("none");
+		finish();
+		return;
+	}
+
+	// Blank line, moving past the entered amount
+	writeString("\n");
+
+	if (total > sg._coins) {
+		writeString("Thou hast not that much!");
+		g_engine->playFX(1);
+		finish();
+		return;
+	}
+
+	sg._coins -= total;
+	redrawStats();
+
+	if (_G(map)._mapType == Data::MAPTYPE_CASTLE)
+		dropPenceCastleBonus(total);
+	else
+		dropPenceCityBonus(total);
+
+	finish();
+}
+
+void Drop::dropPenceCityBonus(int total) {
+	auto &sg = _G(savegame);
+	int tile = _G(map).getTileAt(sg._locationPosition.x, sg._locationPosition.y);
+
+	if (tile != Data::CTILE_GUARD_MB) {
+		writeString("Ok!");
+		return;
+	}
+
+	sg._hits += (total * 3) / 2;
+	redrawStats();
+
+	if (g_engine->getRandomNumber(1, 255) > 16) {
+		writeString("Shazam!");
+	} else {
+		// WORKAROUND: The original computes this random roll but then (apparently by mistake)
+		// indexes its bonus array by the pence amount dropped instead, which would read/write
+		// out of bounds for anything but a tiny amount. Applying the roll to the spell it clearly
+		// intended to pick instead
+		int spellIdx = g_engine->getRandomNumber(1, 7);
+		if (spellIdx == 3)
+			spellIdx = 4;
+		++sg._spells[spellIdx];
+		writeString("Alakazot!");
+	}
+
+	g_engine->playFX(5);
+}
+
+void Drop::dropPenceCastleBonus(int total) {
+	auto &sg = _G(savegame);
+	int tile = _G(map).getTileAt(sg._locationPosition.x, sg._locationPosition.y);
+
+	if (tile != Data::CTILE_GUARD_MB && tile != Data::CTILE_52 && tile != Data::CTILE_53) {
+		writeString("Ok!");
+		return;
+	}
+
+	writeString("Shazam!");
+	g_engine->playFX(5);
+
+	if (tile == Data::CTILE_53) {
+		sg._food += total * 3;
+		redrawStats();
+
+	} else if (tile == Data::CTILE_52) {
+		if (total >= 10) {
+			int weaponIdx = g_engine->getRandomNumber(1, 15);
+			if (sg._weapons[weaponIdx] < 255)
+				++sg._weapons[weaponIdx];
+		}
+
+	} else {
+		// CTILE_GUARD_MB - boost a random attribute (never Hits), capped at 99
+		int attrIdx = g_engine->getRandomNumber(1, 6);
+		int16 *attr;
+		switch (attrIdx) {
+		case 1: attr = &sg._strength; break;
+		case 2: attr = &sg._agility; break;
+		case 3: attr = &sg._stamina; break;
+		case 4: attr = &sg._charisma; break;
+		case 5: attr = &sg._wisdom; break;
+		default: attr = &sg._intelligence; break;
+		}
+
+		*attr += total / 10;
+		if (*attr > 99)
+			*attr = 99;
+	}
+}
+
+void Drop::none() {
+	writeString("nothing");
+	finish();
+}
+
+void Drop::finish() {
+	writeString("\n");
+	prompt();
+	close();
+}
+
+void Drop::redrawStats() {
+	g_engine->findView("Stats")->draw();
+}
+
+} // namespace Interactions
+} // namespace Views
+} // namespace Ultima1
+} // namespace Ultima
diff --git a/engines/ultima/ultima1/views/interactions/drop.h b/engines/ultima/ultima1/views/interactions/drop.h
new file mode 100644
index 00000000000..a593bef5f35
--- /dev/null
+++ b/engines/ultima/ultima1/views/interactions/drop.h
@@ -0,0 +1,103 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef ULTIMA1_VIEWS_INTERACTIONS_DROP_H
+#define ULTIMA1_VIEWS_INTERACTIONS_DROP_H
+
+#include "ultima/ultima1/views/interactions/interaction.h"
+
+namespace Ultima {
+namespace Ultima1 {
+namespace Views {
+namespace Interactions {
+
+using namespace Ultima::Shared::Messages;
+
+/**
+ * Handler for the Drop command. Only usable in cities and castles
+ */
+class Drop : public Interaction {
+	enum Mode {
+		DROP_AREA, DROP_PENCE, DROP_WEAPON, DROP_ARMOUR
+	};
+private:
+	Mode _mode = DROP_AREA;
+	Common::String _amount;
+
+	void none();
+	void finish();
+	void redrawStats();
+
+	/**
+	 * Handles the pence amount entry, digit by digit
+	 */
+	void penceKeypress(const KeypressMessage &msg);
+
+	/**
+	 * Called once a pence amount has been entered (or aborted)
+	 */
+	void dropPence();
+
+	/**
+	 * Bonus given for dropping pence on the special tile found in some
+	 * cities - "wishing well"-style: usually gives a Hits bonus, and a
+	 * small chance of a bonus spell charge
+	 */
+	void dropPenceCityBonus(int total);
+
+	/**
+	 * Bonus given for dropping pence on the special tiles found in
+	 * castles - depending on the specific tile, gives Food, a random
+	 * weapon, or an attribute bonus
+	 */
+	void dropPenceCastleBonus(int total);
+
+	/**
+	 * Handles a letter keypress made while selecting an owned item to
+	 * drop. Unlike Ready's equivalent, an invalid/unowned choice just
+	 * aborts with "none" rather than keeping a prior selection
+	 */
+	void selectItem(int16 *items, const char *const *names, int maxIndex,
+		int16 &equippedIndex, Common::KeyCode keycode);
+
+	/**
+	 * Draws the centered, lettered list of owned items droppable in the
+	 * current mode
+	 */
+	void drawItemList(const int16 *items, const char *const *names, int maxIndex, int col);
+
+public:
+	Drop();
+	~Drop() override {
+	}
+
+	void draw() override;
+	bool msgFocus(const FocusMessage &msg) override;
+	bool msgAction(const ActionMessage &msg) override;
+	bool msgKeypress(const KeypressMessage &msg) override;
+};
+
+} // namespace Interactions
+} // namespace Views
+} // namespace Ultima1
+} // namespace Ultima
+
+#endif
diff --git a/engines/ultima/ultima1/views/views.h b/engines/ultima/ultima1/views/views.h
index bfb8223aee7..1478fbd3b1c 100644
--- a/engines/ultima/ultima1/views/views.h
+++ b/engines/ultima/ultima1/views/views.h
@@ -24,6 +24,7 @@
 
 #include "ultima/shared/engine/events.h"
 #include "ultima/ultima1/views/interactions/dead.h"
+#include "ultima/ultima1/views/interactions/drop.h"
 #include "ultima/ultima1/views/interactions/ready.h"
 #include "ultima/ultima1/views/create_character.h"
 #include "ultima/ultima1/views/game.h"
@@ -40,6 +41,7 @@ namespace Views {
 
 struct Views : public Shared::Views {
 	Interactions::Dead _dead;
+	Interactions::Drop _drop;
 	Interactions::Ready _ready;
 	CreateCharacter _createCharacter;
 	Game _game;


Commit: 6878578d3264c484d11abab6a66758d227a4acbb
    https://github.com/scummvm/scummvm/commit/6878578d3264c484d11abab6a66758d227a4acbb
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:40:48+11:00

Commit Message:
ULTIMA: ULTIMA1: Added get command

Changed paths:
    engines/ultima/ultima1/data/tiles.h
    engines/ultima/ultima1/logic/city_castle_logic.cpp
    engines/ultima/ultima1/logic/city_castle_logic.h
    engines/ultima/ultima1/logic/dungeon_logic.h
    engines/ultima/ultima1/logic/logic.cpp
    engines/ultima/ultima1/logic/logic.h
    engines/ultima/ultima1/logic/overworld_logic.cpp
    engines/ultima/ultima1/logic/overworld_logic.h
    engines/ultima/ultima1/logic/pillar_logic.h


diff --git a/engines/ultima/ultima1/data/tiles.h b/engines/ultima/ultima1/data/tiles.h
index c6676cd9e90..1ed91aa2979 100644
--- a/engines/ultima/ultima1/data/tiles.h
+++ b/engines/ultima/ultima1/data/tiles.h
@@ -64,6 +64,9 @@ enum LocationTileId {
 	// dropPence/dropPenceCastle give a random bonus for dropping coins on
 	CTILE_52 = 52,
 	CTILE_53 = 53,
+	CTILE_STEAL_ARMOR = 55,
+	CTILE_STEAL_FOOD = 57,
+	CTILE_STEAL_WEAPON = 59,
 	CTILE_BLANK = 63
 };
 
diff --git a/engines/ultima/ultima1/logic/city_castle_logic.cpp b/engines/ultima/ultima1/logic/city_castle_logic.cpp
index c87c1bf58e2..2b2df720238 100644
--- a/engines/ultima/ultima1/logic/city_castle_logic.cpp
+++ b/engines/ultima/ultima1/logic/city_castle_logic.cpp
@@ -21,6 +21,7 @@
  */
 
 #include "ultima/ultima1/logic/city_castle_logic.h"
+#include "ultima/ultima1/core/strings.h"
 #include "ultima/ultima1/metaengine.h"
 #include "ultima/ultima1/ultima1.h"
 
@@ -125,8 +126,98 @@ void CityCastleLogic::entering() {
 	loadEntities();
 }
 
-void CityCastleLogic::drop() {
+bool CityCastleLogic::drop() {
 	g_engine->addView("Drop");
+	return false;
+}
+
+bool CityCastleLogic::get() {
+	writeString("Get");
+
+	if (_G(map)._mapType == Data::MAPTYPE_CASTLE) {
+		const auto &pos = _G(savegame)._locationPosition;
+
+		switch (_G(map).getTileAt(pos.x, pos.y)) {
+		case Data::CTILE_STEAL_WEAPON:
+			if (checkCastlePermission())
+				findWeapon();
+			break;
+		case Data::CTILE_STEAL_ARMOR:
+			if (checkCastlePermission())
+				findArmor();
+			break;
+		case Data::CTILE_STEAL_FOOD:
+			if (checkCastlePermission())
+				findFood();
+			break;
+		default:
+			writeString(" - nothing here!\n");
+			break;
+		}
+	} else {
+		if (_G(map)._mapType == Data::MAPTYPE_CITY)
+			writeString(" what");
+		writeString("?\n");
+		playFX(1);
+	}
+
+	return true;
+}
+
+bool CityCastleLogic::checkCastlePermission() {
+	if (_G(savegame)._castleItemAllowance <= 0) {
+		writeString("\n");
+		writeString("Thou hast not the king's\n");
+		writeString("permission!\n");
+		playFX(1);
+		return false;
+	}
+
+	--_G(savegame)._castleItemAllowance;
+	return true;
+}
+
+void CityCastleLogic::findWeapon() {
+	writeString("\n");
+	writeString("Thou dost find a");
+
+	int idx = getRandomNumber(1, 15);
+	const char *name = Data::WEAPON_NAMES[idx];
+
+	if (isVowel(*name))
+		writeString("n");
+	writeString(Common::String(name).size() > 8 ? "\n" : " ");
+	writeString("%s\n", name);
+
+	auto &sg = _G(savegame);
+	if (sg._weapons[idx] < 255)
+		++sg._weapons[idx];
+}
+
+void CityCastleLogic::findFood() {
+	writeString("\n");
+	writeString("Thou dost find ");
+
+	int amount = getRandomNumber(2, 31);
+	writeString("%d bags of\n", amount);
+	writeString("food!\n");
+
+	_G(savegame)._food += amount;
+	redrawStats();
+}
+
+void CityCastleLogic::findArmor() {
+	writeString("\n");
+	writeString("Thou dost find ");
+
+	int idx = getRandomNumber(1, 5);
+	if (idx <= 4)
+		writeString("a ");
+	writeString("%s\n", Data::ARMOR_NAMES[idx]);
+
+	auto &sg = _G(savegame);
+	if (sg._armor[idx] < 255)
+		++sg._armor[idx];
 }
 
 void CityCastleLogic::loadEntities() {
@@ -151,7 +242,7 @@ void CityLogic::entering() {
 	CityCastleLogic::entering();
 }
 
-void CityLogic::move(Data::Direction dir) {
+bool CityLogic::move(Data::Direction dir) {
 	const int deltaX = DELTA_X[dir];
 	const int deltaY = DELTA_Y[dir];
 	const int x = _G(savegame)._locationPosition.x + deltaX;
@@ -177,6 +268,8 @@ void CityLogic::move(Data::Direction dir) {
 			playFX(1);
 		}
 	}
+
+	return true;
 }
 
 int CityLogic::checkAt(int x, int y) const {
diff --git a/engines/ultima/ultima1/logic/city_castle_logic.h b/engines/ultima/ultima1/logic/city_castle_logic.h
index 1bc2babd700..3793402df63 100644
--- a/engines/ultima/ultima1/logic/city_castle_logic.h
+++ b/engines/ultima/ultima1/logic/city_castle_logic.h
@@ -39,7 +39,34 @@ protected:
 	/**
 	 * The Drop command is only usable within cities and castles
 	 */
-	void drop() override;
+	bool drop() override;
+
+	/**
+	 * The Get command only does anything within castles - cities just
+	 * show a "Get what?" prompt, matching the original
+	 */
+	bool get() override;
+
+	/**
+	 * Checks the castle item allowance, consuming one use if available.
+	 * Denies with a message if there isn't one
+	 */
+	bool checkCastlePermission();
+
+	/**
+	 * Grants the player a random weapon, used by the castle Get command
+	 */
+	void findWeapon();
+
+	/**
+	 * Grants the player a random amount of food, used by the castle Get command
+	 */
+	void findFood();
+
+	/**
+	 * Grants the player a random piece of armor, used by the castle Get command
+	 */
+	void findArmor();
 
 public:
 	~CityCastleLogic() override {
@@ -53,7 +80,7 @@ protected:
 	/**
 	 * Handle movement
 	 */
-	void move(Data::Direction dir) override;
+	bool move(Data::Direction dir) override;
 
 	/**
 	 * Checks if the player can move to a given location
@@ -73,7 +100,8 @@ protected:
 	/**
 	 * Handle movement
 	 */
-	void move(Data::Direction dir) override {
+	bool move(Data::Direction dir) override {
+		return true;
 	}
 
 public:
diff --git a/engines/ultima/ultima1/logic/dungeon_logic.h b/engines/ultima/ultima1/logic/dungeon_logic.h
index ce147526f0f..6021997cb07 100644
--- a/engines/ultima/ultima1/logic/dungeon_logic.h
+++ b/engines/ultima/ultima1/logic/dungeon_logic.h
@@ -31,7 +31,8 @@ namespace Logic {
 
 class DungeonLogic : public Logic {
 protected:
-	void move(Data::Direction dir) override {
+	bool move(Data::Direction dir) override {
+		return true;
 	}
 
 public:
diff --git a/engines/ultima/ultima1/logic/logic.cpp b/engines/ultima/ultima1/logic/logic.cpp
index ffaf942a784..a1bbeaa0f14 100644
--- a/engines/ultima/ultima1/logic/logic.cpp
+++ b/engines/ultima/ultima1/logic/logic.cpp
@@ -84,64 +84,67 @@ void Logic::endOfTurn() {
 }
 
 void Logic::action(int action) {
+	bool doEndOfTurn = true;
+
 	switch (action) {
 	case KEYBIND_UP:
-		move(Data::DIR_UP);
+		doEndOfTurn = move(Data::DIR_UP);
 		break;
 	case KEYBIND_DOWN:
-		move(Data::DIR_DOWN);
+		doEndOfTurn = move(Data::DIR_DOWN);
 		break;
 	case KEYBIND_LEFT:
-		move(Data::DIR_LEFT);
+		doEndOfTurn = move(Data::DIR_LEFT);
 		break;
 	case KEYBIND_RIGHT:
-		move(Data::DIR_RIGHT);
+		doEndOfTurn = move(Data::DIR_RIGHT);
 		break;
 	case KEYBIND_CLIMB:
-		climb();
+		doEndOfTurn = climb();
 		break;
 	case KEYBIND_DROP:
-		drop();
-		return;
+		doEndOfTurn = drop();
+		break;
 	case KEYBIND_ENTER:
-		enter();
+		doEndOfTurn = enter();
 		break;
 	case KEYBIND_FIRE:
-		fire();
+		doEndOfTurn = fire();
 		break;
 	case KEYBIND_GET:
-		get();
+		doEndOfTurn = get();
 		break;
 	case KEYBIND_HYPERJUMP:
-		hyperjump();
+		doEndOfTurn = hyperjump();
 		break;
 	case KEYBIND_INFORM:
-		inform();
+		doEndOfTurn = inform();
 		break;
 	case KEYBIND_NOISE:
-		noise();
+		doEndOfTurn = noise();
 		break;
 	case KEYBIND_OPEN:
-		open();
+		doEndOfTurn = open();
 		break;
 	case KEYBIND_QUIT:
-		quit();
+		doEndOfTurn = quit();
 		break;
 	case KEYBIND_READY:
-		ready();
-		return;
+		doEndOfTurn = ready();
+		break;
 	case KEYBIND_PASS:
-		pass();
+		doEndOfTurn = pass();
 		break;
 	case KEYBIND_STATS:
-		zstats();
-		return;
+		doEndOfTurn = zstats();
+		break;
 	default:
 		writeString("Huh?\n");
 		break;
 	}
 
-	endOfTurn();
+	if (doEndOfTurn)
+		endOfTurn();
 }
 
 void Logic::keypress(Common::KeyCode keycode) {
@@ -149,48 +152,55 @@ void Logic::keypress(Common::KeyCode keycode) {
 	endOfTurn();
 }
 
-void Logic::board() {
+bool Logic::board() {
 	writeString("Board?\n");
 	playFX(1);
+	return true;
 }
 
-void Logic::cast() {
+bool Logic::cast() {
 	writeString("Cast -- Hmmmm... no effect!\n");
 	playFX(6);
+	return true;
 }
 
-void Logic::climb() {
+bool Logic::climb() {
 	writeString("K-Limb?\n");
 	playFX(1);
+	return true;
 }
 
-void Logic::drop() {
+bool Logic::drop() {
 	writeString("Drop?\n");
 	playFX(1);
-	endOfTurn();
+	return true;
 }
 
-void Logic::enter() {
+bool Logic::enter() {
 	writeString("Enter?\n");
 	playFX(1);
+	return true;
 }
 
-void Logic::fire() {
+bool Logic::fire() {
 	writeString("Fire?\n");
 	playFX(1);
+	return true;
 }
 
-void Logic::get() {
+bool Logic::get() {
 	writeString("Get?\n");
 	playFX(1);
+	return true;
 }
 
-void Logic::hyperjump() {
+bool Logic::hyperjump() {
 	writeString("HyperJump?\n");
 	playFX(1);
+	return true;
 }
 
-void Logic::inform() {
+bool Logic::inform() {
 	writeString("Inform and search\n");
 	int location = _G(map).getLocationAt(_G(savegame)._overworldPos);
 	int continent = _G(map).getContinentAt(_G(savegame)._overworldPos);
@@ -214,35 +224,43 @@ void Logic::inform() {
 			writeString("%s\n", Data::CONTINENT_NAMES[continent]);
 			break;
 		}
-	} 
+	}
+
+	return true;
 }
 
-void Logic::noise() {
+bool Logic::noise() {
 	_G(savegame)._soundOn = !_G(savegame)._soundOn;
 	writeString("Noise %s\n", _G(savegame)._soundOn ? "on" : "off");
+	return true;
 }
 
-void Logic::open() {
+bool Logic::open() {
 	writeString("Open?\n");
 	playFX(1);
+	return true;
 }
 
-void Logic::quit() {
+bool Logic::quit() {
 	writeString("Quit - only allowed outdoors!\n");
 	playFX(1);
+	return true;
 }
 
-void Logic::ready() {
+bool Logic::ready() {
 	g_engine->addView("Ready");
+	return false;
 }
 
-void Logic::zstats() {
+bool Logic::zstats() {
 	writeString("Ztats\n");
 	g_engine->addView("ZStats");
+	return false;
 }
 
-void Logic::pass() {
+bool Logic::pass() {
 	writeString("Pass\n");
+	return true;
 }
 
 } // namespace Logic
diff --git a/engines/ultima/ultima1/logic/logic.h b/engines/ultima/ultima1/logic/logic.h
index 4e7d530fad8..973d24e295c 100644
--- a/engines/ultima/ultima1/logic/logic.h
+++ b/engines/ultima/ultima1/logic/logic.h
@@ -73,24 +73,27 @@ protected:
 	 */
 	virtual void endOfTurn();
 
-	/*--- Fallback player action handlers ---*/
-
-	virtual void board();
-	virtual void cast();
-	virtual void climb();
-	virtual void drop();
-	virtual void enter();
-	virtual void fire();
-	virtual void get();
-	virtual void hyperjump();
-	virtual void inform();
-	virtual void noise();
-	virtual void open();
-	virtual void quit();
-	virtual void ready();
-	virtual void zstats();
-	virtual void move(Data::Direction dir) = 0;
-	virtual void pass();
+	/*--- Fallback player action handlers. Each returns true if end of
+	 * turn processing should happen immediately afterward, or false if
+	 * that's being deferred - typically because a sub-dialog was opened
+	 * that will only complete the action once it closes ---*/
+
+	virtual bool board();
+	virtual bool cast();
+	virtual bool climb();
+	virtual bool drop();
+	virtual bool enter();
+	virtual bool fire();
+	virtual bool get();
+	virtual bool hyperjump();
+	virtual bool inform();
+	virtual bool noise();
+	virtual bool open();
+	virtual bool quit();
+	virtual bool ready();
+	virtual bool zstats();
+	virtual bool move(Data::Direction dir) = 0;
+	virtual bool pass();
 
 	/*---------------------------------------*/
 public:
diff --git a/engines/ultima/ultima1/logic/overworld_logic.cpp b/engines/ultima/ultima1/logic/overworld_logic.cpp
index 486a0798bd7..ea82dba7685 100644
--- a/engines/ultima/ultima1/logic/overworld_logic.cpp
+++ b/engines/ultima/ultima1/logic/overworld_logic.cpp
@@ -53,7 +53,7 @@ OverworldLogic::OverworldLogic() {
 	_G(map)._mapType = Data::MAPTYPE_OVERWORLD;
 }
 
-void OverworldLogic::enter() {
+bool OverworldLogic::enter() {
 	int location = _G(map).getLocationAt(_G(savegame)._overworldPos);
 	if (location == 0) {
 		writeString("Enter?\n");
@@ -99,11 +99,13 @@ void OverworldLogic::enter() {
 		// Run any logic for entering it
 		_G(logic)->entering();
 	}
+
+	return true;
 }
 
-void OverworldLogic::move(Data::Direction dir) {
+bool OverworldLogic::move(Data::Direction dir) {
 	if (!moveCheck(dir))
-		return;
+		return true;
 
 	if (_G(savegame)._transportType <= Data::TRANSPORT_CART)
 		playFX(4);
@@ -130,6 +132,8 @@ void OverworldLogic::move(Data::Direction dir) {
 
 	if (_G(map).getContinentAt(_G(savegame)._overworldPos) != continentNum)
 		continentChanged(continentNum);
+
+	return true;
 }
 
 bool OverworldLogic::moveCheck(Data::Direction dir) {
diff --git a/engines/ultima/ultima1/logic/overworld_logic.h b/engines/ultima/ultima1/logic/overworld_logic.h
index 17ef8a407f1..07d99eceb0b 100644
--- a/engines/ultima/ultima1/logic/overworld_logic.h
+++ b/engines/ultima/ultima1/logic/overworld_logic.h
@@ -105,12 +105,12 @@ protected:
 	/**
 	 * Enter a location
 	 */
-	void enter() override;
+	bool enter() override;
 
 	/**
 	 * Handle movement
 	 */
-	void move(Data::Direction dir) override;
+	bool move(Data::Direction dir) override;
 
 
 public:
diff --git a/engines/ultima/ultima1/logic/pillar_logic.h b/engines/ultima/ultima1/logic/pillar_logic.h
index 8c1bf15b4c7..493eed89afd 100644
--- a/engines/ultima/ultima1/logic/pillar_logic.h
+++ b/engines/ultima/ultima1/logic/pillar_logic.h
@@ -31,7 +31,8 @@ namespace Logic {
 
 class PillarLogic : public Logic {
 protected:
-	void move(Data::Direction dir) override {
+	bool move(Data::Direction dir) override {
+		return true;
 	}
 
 public:


Commit: 872feb24817551681411c3e8a82b2a058717d959
    https://github.com/scummvm/scummvm/commit/872feb24817551681411c3e8a82b2a058717d959
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:40:49+11:00

Commit Message:
ULTIMA: ULTIMA1: Finished Ready action

Changed paths:
    engines/ultima/ultima1/logic/city_castle_logic.cpp
    engines/ultima/ultima1/logic/city_castle_logic.h
    engines/ultima/ultima1/logic/logic.cpp
    engines/ultima/ultima1/logic/logic.h


diff --git a/engines/ultima/ultima1/logic/city_castle_logic.cpp b/engines/ultima/ultima1/logic/city_castle_logic.cpp
index 2b2df720238..146e82b8457 100644
--- a/engines/ultima/ultima1/logic/city_castle_logic.cpp
+++ b/engines/ultima/ultima1/logic/city_castle_logic.cpp
@@ -140,15 +140,15 @@ bool CityCastleLogic::get() {
 		switch (_G(map).getTileAt(pos.x, pos.y)) {
 		case Data::CTILE_STEAL_WEAPON:
 			if (checkCastlePermission())
-				findWeapon();
+				findWeapon(false);
 			break;
 		case Data::CTILE_STEAL_ARMOR:
 			if (checkCastlePermission())
-				findArmor();
+				findArmor(false);
 			break;
 		case Data::CTILE_STEAL_FOOD:
 			if (checkCastlePermission())
-				findFood();
+				findFood(false);
 			break;
 		default:
 			writeString(" - nothing here!\n");
@@ -164,6 +164,29 @@ bool CityCastleLogic::get() {
 	return true;
 }
 
+bool CityCastleLogic::steal() {
+	writeString("Steal");
+
+	const auto &pos = _G(savegame)._locationPosition;
+	switch (_G(map).getTileAt(pos.x, pos.y)) {
+	case Data::CTILE_STEAL_FOOD:
+		findFood(true);
+		break;
+	case Data::CTILE_STEAL_WEAPON:
+		findWeapon(true);
+		break;
+	case Data::CTILE_STEAL_ARMOR:
+		findArmor(true);
+		break;
+	default:
+		writeString(" - nothing here!\n");
+		playFX(1);
+		break;
+	}
+
+	return true;
+}
+
 bool CityCastleLogic::checkCastlePermission() {
 	if (_G(savegame)._castleItemAllowance <= 0) {
 		writeString("\n");
@@ -177,7 +200,30 @@ bool CityCastleLogic::checkCastlePermission() {
 	return true;
 }
 
-void CityCastleLogic::findWeapon() {
+bool CityCastleLogic::checkCaughtStealing() {
+	auto &sg = _G(savegame);
+	int roll = getRandomNumber(1, 255);
+	bool caught = (sg._guardsHostile != 0) || (roll < 38);
+
+	if (!caught && sg._class == Data::CLASS_WIZARD)
+		return false;
+
+	if (!caught) {
+		if (roll > 77)
+			return false;
+		caught = true;
+	}
+
+	writeString("\n");
+	writeString("Oh no!  Thou wert caught!\n");
+	sg._guardsHostile = 1;
+	return true;
+}
+
+void CityCastleLogic::findWeapon(bool checkCaught) {
+	if (checkCaught && checkCaughtStealing())
+		return;
+
 	writeString("\n");
 	writeString("Thou dost find a");
 
@@ -194,7 +240,10 @@ void CityCastleLogic::findWeapon() {
 		++sg._weapons[idx];
 }
 
-void CityCastleLogic::findFood() {
+void CityCastleLogic::findFood(bool checkCaught) {
+	if (checkCaught && checkCaughtStealing())
+		return;
+
 	writeString("\n");
 	writeString("Thou dost find ");
 
@@ -206,7 +255,10 @@ void CityCastleLogic::findFood() {
 	redrawStats();
 }
 
-void CityCastleLogic::findArmor() {
+void CityCastleLogic::findArmor(bool checkCaught) {
+	if (checkCaught && checkCaughtStealing())
+		return;
+
 	writeString("\n");
 	writeString("Thou dost find ");
 
diff --git a/engines/ultima/ultima1/logic/city_castle_logic.h b/engines/ultima/ultima1/logic/city_castle_logic.h
index 3793402df63..75319dc6a52 100644
--- a/engines/ultima/ultima1/logic/city_castle_logic.h
+++ b/engines/ultima/ultima1/logic/city_castle_logic.h
@@ -47,26 +47,44 @@ protected:
 	 */
 	bool get() override;
 
+	/**
+	 * The Steal command is usable in both cities and castles
+	 */
+	bool steal() override;
+
 	/**
 	 * Checks the castle item allowance, consuming one use if available.
-	 * Denies with a message if there isn't one
+	 * Denies with a message if there isn't one. Used by Get
 	 */
 	bool checkCastlePermission();
 
 	/**
-	 * Grants the player a random weapon, used by the castle Get command
+	 * Rolls whether the player is caught in the act. If so, prints a
+	 * message and makes the guards hostile from then on. Wizards get an
+	 * extra chance to avoid a middling roll; a hostile guard or a bad
+	 * enough roll catches anyone. Used by Steal
+	 */
+	bool checkCaughtStealing();
+
+	/**
+	 * Grants the player a random weapon. If checkCaught is true (Steal),
+	 * this can fail by getting the player caught; Get always passes false
 	 */
-	void findWeapon();
+	void findWeapon(bool checkCaught);
 
 	/**
-	 * Grants the player a random amount of food, used by the castle Get command
+	 * Grants the player a random amount of food. If checkCaught is true
+	 * (Steal), this can fail by getting the player caught; Get always
+	 * passes false
 	 */
-	void findFood();
+	void findFood(bool checkCaught);
 
 	/**
-	 * Grants the player a random piece of armor, used by the castle Get command
+	 * Grants the player a random piece of armor. If checkCaught is true
+	 * (Steal), this can fail by getting the player caught; Get always
+	 * passes false
 	 */
-	void findArmor();
+	void findArmor(bool checkCaught);
 
 public:
 	~CityCastleLogic() override {
diff --git a/engines/ultima/ultima1/logic/logic.cpp b/engines/ultima/ultima1/logic/logic.cpp
index a1bbeaa0f14..7dc47ae3e55 100644
--- a/engines/ultima/ultima1/logic/logic.cpp
+++ b/engines/ultima/ultima1/logic/logic.cpp
@@ -132,6 +132,9 @@ void Logic::action(int action) {
 	case KEYBIND_READY:
 		doEndOfTurn = ready();
 		break;
+	case KEYBIND_STEAL:
+		doEndOfTurn = steal();
+		break;
 	case KEYBIND_PASS:
 		doEndOfTurn = pass();
 		break;
@@ -252,6 +255,12 @@ bool Logic::ready() {
 	return false;
 }
 
+bool Logic::steal() {
+	writeString("Steal?\n");
+	playFX(1);
+	return true;
+}
+
 bool Logic::zstats() {
 	writeString("Ztats\n");
 	g_engine->addView("ZStats");
diff --git a/engines/ultima/ultima1/logic/logic.h b/engines/ultima/ultima1/logic/logic.h
index 973d24e295c..caf7f718dbd 100644
--- a/engines/ultima/ultima1/logic/logic.h
+++ b/engines/ultima/ultima1/logic/logic.h
@@ -91,6 +91,7 @@ protected:
 	virtual bool open();
 	virtual bool quit();
 	virtual bool ready();
+	virtual bool steal();
 	virtual bool zstats();
 	virtual bool move(Data::Direction dir) = 0;
 	virtual bool pass();


Commit: 7a10f5083f06547b2c1cfc081d22a14bd194802f
    https://github.com/scummvm/scummvm/commit/7a10f5083f06547b2c1cfc081d22a14bd194802f
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:40:49+11:00

Commit Message:
ULTIMA: ULTIMA1: Added Transact command

Changed paths:
  A engines/ultima/ultima1/views/interactions/king.cpp
  A engines/ultima/ultima1/views/interactions/king.h
  A engines/ultima/ultima1/views/interactions/merchant.cpp
  A engines/ultima/ultima1/views/interactions/merchant.h
    engines/ultima/module.mk
    engines/ultima/ultima1/data/tiles.h
    engines/ultima/ultima1/logic/city_castle_logic.cpp
    engines/ultima/ultima1/logic/city_castle_logic.h
    engines/ultima/ultima1/logic/logic.cpp
    engines/ultima/ultima1/logic/logic.h
    engines/ultima/ultima1/views/views.h


diff --git a/engines/ultima/module.mk b/engines/ultima/module.mk
index 1f01d76364a..33d87663fc1 100644
--- a/engines/ultima/module.mk
+++ b/engines/ultima/module.mk
@@ -68,6 +68,8 @@ MODULE_OBJS += \
 	ultima1/views/interactions/interaction.o \
 	ultima1/views/interactions/dead.o \
 	ultima1/views/interactions/drop.o \
+	ultima1/views/interactions/king.o \
+	ultima1/views/interactions/merchant.o \
 	ultima1/views/interactions/ready.o \
 	ultima1/views/view.o \
 	ultima1/views/commands.o \
diff --git a/engines/ultima/ultima1/data/tiles.h b/engines/ultima/ultima1/data/tiles.h
index 1ed91aa2979..5bc55684f5b 100644
--- a/engines/ultima/ultima1/data/tiles.h
+++ b/engines/ultima/ultima1/data/tiles.h
@@ -64,9 +64,20 @@ enum LocationTileId {
 	// dropPence/dropPenceCastle give a random bonus for dropping coins on
 	CTILE_52 = 52,
 	CTILE_53 = 53,
+	// Shop counter tiles. Each shop spans two adjacent tiles - the even one
+	// is just the other half of the counter, while the odd one is also the
+	// tile get/steal work against
+	CTILE_ARMORY = 54,
 	CTILE_STEAL_ARMOR = 55,
+	CTILE_GROCER = 56,
 	CTILE_STEAL_FOOD = 57,
+	CTILE_WEAPONS = 58,
 	CTILE_STEAL_WEAPON = 59,
+	CTILE_MAGIC = 60,
+	CTILE_TAVERN = 61,
+	// Tile 62 is a transport shop counter in cities, but the king in castles
+	CTILE_TRANSPORT = 62,
+	CTILE_KING = 62,
 	CTILE_BLANK = 63
 };
 
diff --git a/engines/ultima/ultima1/logic/city_castle_logic.cpp b/engines/ultima/ultima1/logic/city_castle_logic.cpp
index 146e82b8457..6f261c12cd1 100644
--- a/engines/ultima/ultima1/logic/city_castle_logic.cpp
+++ b/engines/ultima/ultima1/logic/city_castle_logic.cpp
@@ -324,6 +324,28 @@ bool CityLogic::move(Data::Direction dir) {
 	return true;
 }
 
+bool CityLogic::transact() {
+	writeString("Transact");
+
+	if (_G(savegame)._guardsHostile) {
+		writeString("\n");
+		writeString("None will talk to thee!\n");
+		return true;
+	}
+
+	const auto &pos = _G(savegame)._locationPosition;
+	int tile = _G(map).getTileAt(pos.x, pos.y);
+	if (tile < Data::CTILE_ARMORY || tile > Data::CTILE_TRANSPORT) {
+		writeString("\n");
+		writeString("Thou art not by a counter!\n");
+		playFX(1);
+		return true;
+	}
+
+	g_engine->addView("Merchant");
+	return false;
+}
+
 int CityLogic::checkAt(int x, int y) const {
 	int tile = _G(map).getTileAt(x, y);
 	if (tile == Data::CTILE_BLANK)
@@ -358,6 +380,24 @@ CastleLogic::CastleLogic() {
 	_G(savegame)._castleKeyVal = getRandomNumber(1) == 1 ? 61 : 60;
 }
 
+bool CastleLogic::transact() {
+	writeString("Transact with king\n");
+
+	const auto &pos = _G(savegame)._locationPosition;
+	if (_G(map).getTileAt(pos.x, pos.y) != Data::CTILE_KING) {
+		writeString("He is not here!\n");
+		return true;
+	}
+
+	if (_G(savegame)._guardsHostile) {
+		writeString("He rejects thine offer!\n");
+		return true;
+	}
+
+	g_engine->addView("King");
+	return false;
+}
+
 void CastleLogic::entering() {
 	_G(savegame)._locationPosition = Common::Point(0, 9);
 	CityCastleLogic::entering();
diff --git a/engines/ultima/ultima1/logic/city_castle_logic.h b/engines/ultima/ultima1/logic/city_castle_logic.h
index 75319dc6a52..574335e49dc 100644
--- a/engines/ultima/ultima1/logic/city_castle_logic.h
+++ b/engines/ultima/ultima1/logic/city_castle_logic.h
@@ -105,6 +105,12 @@ protected:
 	 */
 	int checkAt(int x, int y) const;
 
+	/**
+	 * The Transact command opens the Merchant view when standing at a shop
+	 * counter
+	 */
+	bool transact() override;
+
 public:
 	CityLogic();
 	~CityLogic() override {
@@ -122,6 +128,11 @@ protected:
 		return true;
 	}
 
+	/**
+	 * The Transact command opens the King view when standing at the throne
+	 */
+	bool transact() override;
+
 public:
 	CastleLogic();
 	~CastleLogic() override {
diff --git a/engines/ultima/ultima1/logic/logic.cpp b/engines/ultima/ultima1/logic/logic.cpp
index 7dc47ae3e55..f256f1f9f5c 100644
--- a/engines/ultima/ultima1/logic/logic.cpp
+++ b/engines/ultima/ultima1/logic/logic.cpp
@@ -135,6 +135,9 @@ void Logic::action(int action) {
 	case KEYBIND_STEAL:
 		doEndOfTurn = steal();
 		break;
+	case KEYBIND_TRANSACT:
+		doEndOfTurn = transact();
+		break;
 	case KEYBIND_PASS:
 		doEndOfTurn = pass();
 		break;
@@ -261,6 +264,12 @@ bool Logic::steal() {
 	return true;
 }
 
+bool Logic::transact() {
+	writeString("Transact?\n");
+	playFX(1);
+	return true;
+}
+
 bool Logic::zstats() {
 	writeString("Ztats\n");
 	g_engine->addView("ZStats");
diff --git a/engines/ultima/ultima1/logic/logic.h b/engines/ultima/ultima1/logic/logic.h
index caf7f718dbd..5795fdb2308 100644
--- a/engines/ultima/ultima1/logic/logic.h
+++ b/engines/ultima/ultima1/logic/logic.h
@@ -92,6 +92,7 @@ protected:
 	virtual bool quit();
 	virtual bool ready();
 	virtual bool steal();
+	virtual bool transact();
 	virtual bool zstats();
 	virtual bool move(Data::Direction dir) = 0;
 	virtual bool pass();
diff --git a/engines/ultima/ultima1/views/interactions/king.cpp b/engines/ultima/ultima1/views/interactions/king.cpp
new file mode 100644
index 00000000000..b855bf64e1d
--- /dev/null
+++ b/engines/ultima/ultima1/views/interactions/king.cpp
@@ -0,0 +1,244 @@
+
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "ultima/ultima1/views/interactions/king.h"
+#include "ultima/ultima1/ultima1.h"
+
+namespace Ultima {
+namespace Ultima1 {
+namespace Views {
+namespace Interactions {
+
+// The four dungeon monsters kings with an even castle index send the
+// player to kill, indexed by (castleIndex - 2) / 2
+static const char *const QUEST_MONSTER_NAMES[4] = {
+	"Gelatinous Cube", "Carrion Creeper", "Lich", "Balron"
+};
+
+// The four landmarks kings with an odd castle index send the player to
+// find, as indexes into Data::LOCATION_NAMES, indexed by (castleIndex - 1) / 2
+static const int QUEST_LOCATION_INDEXES[4] = { 47, 45, 43, 41 };
+
+// Reward text shown for a completed "kill a monster" quest, indexed by the
+// continent the player is currently standing on
+static const char *const GEM_REWARD_MESSAGES[4] = {
+	"that it requires all four gems\nto launch a time machine!\n\nThe king gives thee a red gem.\n",
+	"that the time machine must be\nused in order to win.\n\nThe king gives thee a green gem!\n",
+	"the princess will help a\nspace ace through time!\n\nThe king gives thee a blue gem!\n",
+	"to take nine items from my\nstorerooms - but only nine!\n\nThe king also gives thee a white gem!\n"
+};
+
+King::King() : Interaction("King") {
+}
+
+bool King::msgFocus(const FocusMessage &msg) {
+	_mode = KING_PROMPT;
+	setBounds(Common::Rect(0, 0, 0, 0));
+
+	if (checkQuestReward()) {
+		finish();
+		return true;
+	}
+
+	writeString("Dost thou offer pence\n");
+	writeString("or service: ");
+	showCursor();
+	return true;
+}
+
+bool King::msgAction(const ActionMessage &msg) {
+	writeString("neither\n");
+	finish();
+	return true;
+}
+
+bool King::msgKeypress(const KeypressMessage &msg) {
+	switch (_mode) {
+	case KING_PROMPT:
+		if (msg.keycode == Common::KEYCODE_p) {
+			_mode = KING_PENCE;
+			_amount.clear();
+			writeString("pence\n");
+			resetLine();
+			writeString("\x10""How much? ");
+			showCursor();
+
+		} else if (msg.keycode == Common::KEYCODE_s) {
+			int castleIdx = _G(map)._castleNum2;
+
+			if (_G(savegame)._questStatus[castleIdx] == -1) {
+				writeString("\n");
+				writeString("Thou art on a quest\n");
+				writeString("for me already!\n");
+			} else {
+				giveQuest();
+			}
+			finish();
+
+		} else {
+			writeString("neither\n");
+			finish();
+		}
+		break;
+
+	case KING_PENCE:
+		penceKeypress(msg);
+		break;
+	}
+
+	return true;
+}
+
+bool King::checkQuestReward() {
+	auto &sg = _G(savegame);
+	int castleIdx = _G(map)._castleNum2;
+
+	if (sg._questStatus[castleIdx] != 1)
+		return false;
+
+	sg._questStatus[castleIdx] = 0;
+
+	writeString(Common::String::format("Ah, %s!  Thou hast\n", sg._name));
+	writeString("completed thy quest.\n");
+
+	if (castleIdx % 2 != 0) {
+		// Odd castle index - a "find a location" quest rewards strength points
+		int amount = (99 - sg._strength) / 8;
+		if (amount == 0 && sg._strength != 99)
+			amount = 1;
+
+		writeString(Common::String::format("For this I will give thee %d point%s of strength.\n",
+			amount, amount == 1 ? "" : "s"));
+		sg._strength += amount;
+
+	} else {
+		// Even castle index - a "kill a monster" quest rewards a gem, based
+		// on the continent the castle is on. WORKAROUND: the original reuses
+		// a single position field for both overworld and in-location
+		// coordinates, so this ends up passing meaningless in-castle
+		// coordinates to the continent lookup; using the real overworld
+		// position instead
+		int continent = _G(map).getContinentAt(sg._overworldPos);
+		writeString("For this I shall tell thee\n");
+		writeString(GEM_REWARD_MESSAGES[continent]);
+
+		switch (continent) {
+		case 0:
+			++sg._redGems;
+			break;
+		case 1:
+			++sg._greenGems;
+			break;
+		case 2:
+			++sg._blueGem;
+			break;
+		case 3:
+			++sg._whiteGem;
+			sg._castleItemAllowance = 9;
+			break;
+		default:
+			break;
+		}
+	}
+
+	redrawStats();
+	return true;
+}
+
+void King::giveQuest() {
+	auto &sg = _G(savegame);
+	int castleIdx = _G(map)._castleNum2;
+	sg._questStatus[castleIdx] = -1;
+
+	if (castleIdx % 2 == 0) {
+		writeString("Go now and kill a\n");
+
+		int monsterIdx = (castleIdx - 2) / 2;
+		if (monsterIdx >= 0 && monsterIdx < 4)
+			writeString(Common::String::format("%s\n", QUEST_MONSTER_NAMES[monsterIdx]));
+	} else {
+		writeString("Go forth and find\n");
+
+		int locIdx = (castleIdx - 1) / 2;
+		if (locIdx >= 0 && locIdx < 4)
+			writeString(Common::String::format("%s\n", Data::LOCATION_NAMES[QUEST_LOCATION_INDEXES[locIdx]]));
+	}
+
+	writeString("Do not return until\n");
+	writeString("thy quest is done!\n");
+}
+
+void King::penceKeypress(const KeypressMessage &msg) {
+	if (msg.ascii >= '0' && msg.ascii <= '9') {
+		if ((_amount.empty() && msg.ascii == '0') || _amount.size() >= 4)
+			return;
+
+		_amount += (char)msg.ascii;
+		writeString(Common::String(1, (char)msg.ascii));
+
+	} else if (msg.keycode == Common::KEYCODE_BACKSPACE) {
+		if (!_amount.empty()) {
+			_amount.deleteLastChar();
+			resetLine();
+			writeString(Common::String::format("\x10""How much? %s", _amount.c_str()));
+			showCursor();
+		}
+
+	} else {
+		auto &sg = _G(savegame);
+		int amount = _amount.empty() ? 0 : atoi(_amount.c_str());
+
+		writeString("\n");
+		if (amount == 0) {
+			writeString("none\n");
+			finish();
+		} else if (amount > sg._coins) {
+			writeString("Thou hast not that much!\n");
+			g_engine->playFX(1);
+			finish();
+		} else {
+			sg._coins -= amount;
+			int hits = amount * 3 / 2;
+			sg._hits += hits;
+
+			writeString("In return I give unto\n");
+			writeString(Common::String::format("thee %d hit points\n", hits));
+			redrawStats();
+			finish();
+		}
+	}
+}
+
+void King::finish() {
+	writeString("\n");
+	prompt();
+	close();
+}
+
+void King::redrawStats() {
+	g_engine->findView("Stats")->draw();
+}
+
+} // namespace Interactions
+} // namespace Views
+} // namespace Ultima1
+} // namespace Ultima
diff --git a/engines/ultima/ultima1/views/interactions/king.h b/engines/ultima/ultima1/views/interactions/king.h
new file mode 100644
index 00000000000..625e2104a30
--- /dev/null
+++ b/engines/ultima/ultima1/views/interactions/king.h
@@ -0,0 +1,85 @@
+
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef ULTIMA1_VIEWS_INTERACTIONS_KING_H
+#define ULTIMA1_VIEWS_INTERACTIONS_KING_H
+
+#include "ultima/ultima1/views/interactions/interaction.h"
+
+namespace Ultima {
+namespace Ultima1 {
+namespace Views {
+namespace Interactions {
+
+using namespace Ultima::Shared::Messages;
+
+/**
+ * Handler for the Transact command's king interaction within castles.
+ * Only usable when standing on the throne tile and the guards aren't
+ * hostile
+ */
+class King : public Interaction {
+	enum Mode {
+		KING_PROMPT, KING_PENCE
+	};
+private:
+	Mode _mode = KING_PROMPT;
+	Common::String _amount;
+
+	void finish();
+	void redrawStats();
+
+	/**
+	 * If the player has just completed this castle's quest, gives the
+	 * reward and prints the completion message. Returns true if a reward
+	 * was given, in which case the pence/service prompt is skipped
+	 */
+	bool checkQuestReward();
+
+	/**
+	 * Starts a new quest for this castle - either to kill a specific
+	 * dungeon monster, or to find a specific landmark - depending on
+	 * whether the castle's index is even or odd
+	 */
+	void giveQuest();
+
+	/**
+	 * Handles the pence amount entry, digit by digit
+	 */
+	void penceKeypress(const KeypressMessage &msg);
+
+public:
+	King();
+	~King() override {
+	}
+
+	bool msgFocus(const FocusMessage &msg) override;
+	bool msgAction(const ActionMessage &msg) override;
+	bool msgKeypress(const KeypressMessage &msg) override;
+};
+
+} // namespace Interactions
+} // namespace Views
+} // namespace Ultima1
+} // namespace Ultima
+
+#endif
diff --git a/engines/ultima/ultima1/views/interactions/merchant.cpp b/engines/ultima/ultima1/views/interactions/merchant.cpp
new file mode 100644
index 00000000000..71d65278e5c
--- /dev/null
+++ b/engines/ultima/ultima1/views/interactions/merchant.cpp
@@ -0,0 +1,850 @@
+
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "ultima/ultima1/views/interactions/merchant.h"
+#include "ultima/ultima1/ultima1.h"
+
+namespace Ultima {
+namespace Ultima1 {
+namespace Views {
+namespace Interactions {
+
+constexpr int COLOR_TEXT = 11; // light cyan
+
+struct ShopName {
+	const char *_line1;
+	const char *_line2;
+};
+
+// Per city (map style 2-9, i.e. variant 0-7) shop proprietor flavor names.
+// A null line1 means that particular city doesn't have this kind of shop
+static const ShopName ARMORY_NAMES[8] = {
+	{ "The Armour Shop of", "Lord Eldric D'Charbonneux" }, { "Max's Armoury", nullptr },
+	{ "The Iron Fist", nullptr }, { "The Hammer -n- Anvil", nullptr },
+	{ nullptr, nullptr }, { "Defense Specialties Unlimited", nullptr },
+	{ nullptr, nullptr }, { "Custom Armor Works", nullptr }
+};
+static const ShopName WEAPON_SHOP_NAMES[8] = {
+	{ "The Weapon Shop of", "Lord Eldric D'Charbonneux" }, { "The Tempered Steel", nullptr },
+	{ "The Razor's Edge", nullptr }, { "Cold Steel Creations", nullptr },
+	{ "The Bloody Blade", nullptr }, { "The Duelo Shop", nullptr },
+	{ "Weaponry Supply", nullptr }, { "Cold Steel Creations", nullptr }
+};
+static const ShopName MAGIC_SHOP_NAMES[8] = {
+	{ "Mad Chad's Magic Shoppe", nullptr }, { "Mystic Melinda's", nullptr },
+	{ "Words of Power", nullptr }, { "Psychic Sam's Magical Emporium", nullptr },
+	{ nullptr, nullptr }, { nullptr, nullptr },
+	{ nullptr, nullptr }, { "The Unleashed Spell", nullptr }
+};
+static const ShopName GROCER_SHOP_NAMES[8] = {
+	{ "Li'l Karelia's Finnish Grocery", nullptr }, { "Adventurer's Supply Post", nullptr },
+	{ nullptr, nullptr }, { "The Brown Bag", nullptr },
+	{ "Fresh Food Marketplace", nullptr }, { "Rations Unlimited", nullptr },
+	{ "Fastest Freshest Food Market", nullptr }, { "Exploration Provisioners", nullptr }
+};
+static const ShopName TAVERN_SHOP_NAMES[8] = {
+	{ "Pub de Varg", nullptr }, { "Ye Olde Local Pub", nullptr },
+	{ "Dr. Cat's Lair", nullptr }, { "Teaser's House", nullptr },
+	{ nullptr, nullptr }, { "Mary's Midway", nullptr },
+	{ "Kurtstable's Korner", nullptr }, { "Dav's House-o-Suds", nullptr }
+};
+static const ShopName TRANSPORT_SHOP_NAMES[8] = {
+	{ "Scooter's Super Duper", "Transport, Inc." }, { nullptr, nullptr },
+	{ nullptr, nullptr }, { "Quality Transport Ltd.", nullptr },
+	{ nullptr, nullptr }, { "O.K. New and Used Transport", nullptr },
+	{ nullptr, nullptr }, { "Sly Sam's Transportation", "Specialists" }
+};
+
+// Tavern tip/rumor flavor texts. Index 0 is the drunk penalty message
+// (no header); indices 1-8 are prefixed with "Thou had best know " when
+// shown. Index 2 is sex-dependent and filled in at the point of use
+static const char *const TAVERN_TIPS[9] = {
+	"Thou hast been seduced!\nAfter a long night,\nthou art back.",
+	"about space travel!\nThou must destroy at least 20 enemy vessels\nto become an ace!",
+	nullptr,
+	"that the princess will give great reward to the one who\nrescues her, and an extra gift to an 8th level ace!",
+	"thou must go back in time.",
+	"thou should destroy the evil gem!",
+	"that many lakes and ponds have strong magical powers!",
+	"this is a great game!",
+	"that over 1000 years ago, Mondain the Wizard created an evil gem.\n"
+	"With this gem, he is immortal and cannot be defeated.\n\n"
+	"The quest of --Ultima-- is to traverse the lands in search\n"
+	"of a time machine.  Upon finding such a device, thou\n"
+	"should go back in time to the days before Mondain created\n"
+	"the evil gem and destroy him!"
+};
+
+Merchant::Merchant() : Interaction("Merchant") {
+}
+
+bool Merchant::msgFocus(const FocusMessage &msg) {
+	_mode = SHOP_PROMPT;
+	setBounds(Common::Rect(0, 0, 0, 0));
+
+	const auto &pos = _G(savegame)._locationPosition;
+	switch (_G(map).getTileAt(pos.x, pos.y)) {
+	case Data::CTILE_ARMORY:
+	case Data::CTILE_STEAL_ARMOR:
+		_shopType = SHOP_ARMORY;
+		break;
+	case Data::CTILE_GROCER:
+	case Data::CTILE_STEAL_FOOD:
+		_shopType = SHOP_GROCER;
+		break;
+	case Data::CTILE_WEAPONS:
+	case Data::CTILE_STEAL_WEAPON:
+		_shopType = SHOP_WEAPONS;
+		break;
+	case Data::CTILE_MAGIC:
+		_shopType = SHOP_MAGIC;
+		break;
+	case Data::CTILE_TAVERN:
+		_shopType = SHOP_TAVERN;
+		break;
+	default:
+		_shopType = SHOP_TRANSPORT;
+		break;
+	}
+
+	writeString("-Buy, Sell: ");
+	showCursor();
+	return true;
+}
+
+bool Merchant::msgAction(const ActionMessage &msg) {
+	nothing();
+	return true;
+}
+
+bool Merchant::msgKeypress(const KeypressMessage &msg) {
+	switch (_mode) {
+	case SHOP_PROMPT:
+		if (msg.keycode == Common::KEYCODE_b)
+			chooseBuy();
+		else if (msg.keycode == Common::KEYCODE_s)
+			chooseSell();
+		else
+			nothing();
+		break;
+
+	case SHOP_BUY:
+		switch (_shopType) {
+		case SHOP_ARMORY:
+			armoryBuyKeypress(msg.keycode);
+			break;
+		case SHOP_WEAPONS:
+			weaponsBuyKeypress(msg.keycode);
+			break;
+		case SHOP_MAGIC:
+			magicBuyKeypress(msg.keycode);
+			break;
+		case SHOP_TRANSPORT:
+			transportBuyKeypress(msg.keycode);
+			break;
+		default:
+			break;
+		}
+		break;
+
+	case SHOP_SELL:
+		switch (_shopType) {
+		case SHOP_ARMORY:
+			armorySellKeypress(msg.keycode);
+			break;
+		case SHOP_WEAPONS:
+			weaponsSellKeypress(msg.keycode);
+			break;
+		default:
+			break;
+		}
+		break;
+
+	case SHOP_QTY:
+		groceryKeypress(msg);
+		break;
+	}
+
+	return true;
+}
+
+void Merchant::draw() {
+	if (_mode != SHOP_BUY && _mode != SHOP_SELL)
+		return;
+
+	auto s = getSurface();
+	s.writeString(Point(15, 0), "\x10 Transact \x11");
+	s.fillRect(TextRect(1, 1, 38, 18), 0);
+
+	if (_mode == SHOP_BUY) {
+		switch (_shopType) {
+		case SHOP_ARMORY:
+			drawArmoryBuy();
+			break;
+		case SHOP_WEAPONS:
+			drawWeaponsBuy();
+			break;
+		case SHOP_MAGIC:
+			drawMagicBuy();
+			break;
+		case SHOP_TRANSPORT:
+			drawTransportBuy();
+			break;
+		default:
+			break;
+		}
+	} else {
+		switch (_shopType) {
+		case SHOP_ARMORY:
+			drawArmorySell();
+			break;
+		case SHOP_WEAPONS:
+			drawWeaponsSell();
+			break;
+		default:
+			break;
+		}
+	}
+}
+
+int Merchant::shopVariant() const {
+	return _G(map)._mapStyle - 2;
+}
+
+void Merchant::drawShopName() {
+	static const ShopName *const TABLES[6] = {
+		ARMORY_NAMES, WEAPON_SHOP_NAMES, MAGIC_SHOP_NAMES,
+		GROCER_SHOP_NAMES, TAVERN_SHOP_NAMES, TRANSPORT_SHOP_NAMES
+	};
+
+	const ShopName &name = TABLES[_shopType][shopVariant()];
+	if (!name._line1)
+		return;
+
+	auto s = getSurface();
+	s.setColor(COLOR_TEXT);
+	s.writeString(Point(19 - (int)Common::String(name._line1).size() / 2, 2), "%s", name._line1);
+	if (name._line2)
+		s.writeString(Point(19 - (int)Common::String(name._line2).size() / 2, 3), "%s", name._line2);
+}
+
+bool Merchant::isWenchNearby() const {
+	const auto &pos = _G(savegame)._locationPosition;
+
+	for (int dy = -1; dy <= 1; ++dy) {
+		for (int dx = -1; dx <= 1; ++dx) {
+			if (dx == 0 && dy == 0)
+				continue;
+
+			int idx = _G(savegame).getLocationEntityAt(pos.x + dx, pos.y + dy);
+			if (idx != -1 && _G(savegame)._locationEntities[idx]._type == 50)
+				return true;
+		}
+	}
+
+	return false;
+}
+
+int Merchant::overworldTransportCount() const {
+	int count = 0;
+	for (int idx = 1; idx <= _G(overworldEntityCount); ++idx) {
+		int type = _G(savegame)._overworldEntities[idx]._type;
+		if (type >= Data::TILE_HORSE && type <= Data::TILE_SHUTTLE)
+			++count;
+	}
+
+	return count;
+}
+
+void Merchant::chooseBuy() {
+	switch (_shopType) {
+	case SHOP_ARMORY:
+	case SHOP_WEAPONS:
+	case SHOP_MAGIC:
+		_mode = SHOP_BUY;
+		setBounds(TextRect(0, 0, 39, 19));
+		redraw();
+		break;
+
+	case SHOP_GROCER:
+		groceryPrompt();
+		break;
+
+	case SHOP_TAVERN:
+		tavernBuy();
+		break;
+
+	case SHOP_TRANSPORT: {
+		auto &map = _G(map);
+		auto &sg = _G(savegame);
+		bool fleetFull = sg._transports[Data::TRANSPORT_SHUTTLE] == 0 &&
+			overworldTransportCount() >= 15;
+
+		for (int i = 0; i < 6; ++i)
+			_transportIds[i] = 0;
+
+		if ((map._woodsCount || map._grassCount) && !fleetFull) {
+			_transportIds[0] = Data::TRANSPORT_HORSE;
+			_transportIds[1] = Data::TRANSPORT_CART;
+		}
+		if (map._waterCount && !fleetFull) {
+			_transportIds[2] = Data::TRANSPORT_RAFT;
+			_transportIds[3] = Data::TRANSPORT_FRIGATE;
+		}
+		if (_G(moveCtr) > 3000) {
+			if (map._grassCount && !fleetFull)
+				_transportIds[4] = Data::TRANSPORT_AIRCAR;
+			if (sg._transports[Data::TRANSPORT_SHUTTLE] == 0)
+				_transportIds[5] = Data::TRANSPORT_SHUTTLE;
+		}
+
+		bool any = false;
+		for (int i = 0; i < 6 && !any; ++i)
+			any = _transportIds[i] != 0;
+
+		if (!any) {
+			writeString("\n");
+			writeString("Closed for the day.\n");
+			finish();
+			break;
+		}
+
+		_mode = SHOP_BUY;
+		setBounds(TextRect(0, 0, 39, 19));
+		redraw();
+		break;
+	}
+
+	default:
+		break;
+	}
+}
+
+void Merchant::chooseSell() {
+	switch (_shopType) {
+	case SHOP_ARMORY: {
+		bool anyOwned = false;
+		for (int idx = 1; idx < Data::ARMOR_COUNT && !anyOwned; ++idx)
+			anyOwned = _G(savegame)._armor[idx] != 0;
+
+		if (!anyOwned) {
+			writeString("\n");
+			writeString("Thou hast no armour to sell!\n");
+			nothing();
+		} else {
+			_mode = SHOP_SELL;
+			setBounds(TextRect(0, 0, 39, 19));
+			redraw();
+		}
+		break;
+	}
+
+	case SHOP_WEAPONS: {
+		bool anyOwned = false;
+		for (int idx = 1; idx < Data::WEAPON_COUNT && !anyOwned; ++idx)
+			anyOwned = _G(savegame)._weapons[idx] != 0;
+
+		if (!anyOwned) {
+			writeString("\n");
+			writeString("Thou hast no weaponry to sell!\n");
+			nothing();
+		} else {
+			_mode = SHOP_SELL;
+			setBounds(TextRect(0, 0, 39, 19));
+			redraw();
+		}
+		break;
+	}
+
+	case SHOP_MAGIC:
+		writeString("\n");
+		writeString("Sorry, we don't buy spells!\n");
+		nothing();
+		break;
+
+	case SHOP_GROCER:
+		writeString("\n");
+		writeString("Used food?  No thanks!\n");
+		nothing();
+		break;
+
+	case SHOP_TAVERN:
+		writeString("\n");
+		writeString("We have plenty of booze already!\n");
+		nothing();
+		break;
+
+	case SHOP_TRANSPORT:
+		writeString("\n");
+		writeString("Sorry, we don't deal in used stuff.\n");
+		nothing();
+		break;
+	}
+}
+
+void Merchant::drawArmoryBuy() {
+	drawShopName();
+	auto s = getSurface();
+	s.setColor(COLOR_TEXT);
+
+	int maxIdx = (_G(moveCtr) > 3000) ? 5 : 3;
+	int y = 8;
+	for (int idx = 1; idx <= maxIdx; ++idx, ++y) {
+		int price = ((200 - _G(savegame)._intelligence) / 4) * idx;
+		s.writeString(Point(10, y), "%c) %s", 'a' + idx, Data::ARMOR_NAMES[idx]);
+		s.writeString(Point(27, y), "-%3d", price);
+	}
+}
+
+void Merchant::armoryBuyKeypress(Common::KeyCode keycode) {
+	int maxIdx = (_G(moveCtr) > 3000) ? 5 : 3;
+	int idx = keycode - Common::KEYCODE_a;
+
+	if (idx < 1 || idx > maxIdx) {
+		nothing();
+		return;
+	}
+
+	auto &sg = _G(savegame);
+	int price = ((200 - sg._intelligence) / 4) * idx;
+	if (price > sg._coins) {
+		cantAfford();
+		return;
+	}
+
+	sg._coins -= price;
+	if (sg._armor[idx] < 255)
+		++sg._armor[idx];
+
+	writeString(Data::ARMOR_NAMES[idx]);
+	redrawStats();
+	writeString("\n");
+	writeString("Sold!\n");
+	finish();
+}
+
+void Merchant::drawArmorySell() {
+	drawShopName();
+	auto s = getSurface();
+	s.setColor(COLOR_TEXT);
+
+	int y = 8;
+	for (int idx = 1; idx < Data::ARMOR_COUNT; ++idx) {
+		if (_G(savegame)._armor[idx]) {
+			int price = (_G(savegame)._charisma + 40) * idx * idx / 256 + 1;
+			s.writeString(Point(10, y), "%c) %s", 'a' + idx, Data::ARMOR_NAMES[idx]);
+			s.writeString(Point(27, y), "-%3d", price);
+			++y;
+		}
+	}
+}
+
+void Merchant::armorySellKeypress(Common::KeyCode keycode) {
+	int idx = keycode - Common::KEYCODE_a;
+	auto &sg = _G(savegame);
+
+	if (idx < 1 || idx >= Data::ARMOR_COUNT || !sg._armor[idx]) {
+		nothing();
+		return;
+	}
+
+	int price = (sg._charisma + 40) * idx * idx / 256 + 1;
+	sg._coins += price;
+	--sg._armor[idx];
+	if (idx == sg._equippedArmor && sg._armor[idx] == 0)
+		sg._equippedArmor = 0;
+
+	writeString(Data::ARMOR_NAMES[idx]);
+	redrawStats();
+	writeString("\n");
+	writeString("Done!\n");
+	finish();
+}
+
+void Merchant::weaponsRange(int &minIdx, int &maxIdx) const {
+	int base = (((_G(map)._mapStyle - 1) & 1) == 0) ? 1 : 2;
+	uint32 moveCtr = _G(moveCtr);
+	int tier = (moveCtr <= 3000) ? MIN<uint32>(moveCtr % 1500, 3) : 3;
+
+	minIdx = base;
+	maxIdx = base + (tier + 1) * 2;
+}
+
+void Merchant::drawWeaponsBuy() {
+	drawShopName();
+	auto s = getSurface();
+	s.setColor(COLOR_TEXT);
+
+	int minIdx, maxIdx;
+	weaponsRange(minIdx, maxIdx);
+
+	int y = 8;
+	for (int idx = minIdx; idx <= maxIdx; idx += 2, ++y) {
+		int price = (255 - _G(savegame)._intelligence) * idx * idx / 256 + 5;
+		s.writeString(Point(9, y), "%c) %s", 'a' + idx, Data::WEAPON_NAMES[idx]);
+		s.writeString(Point(26, y), "-%3d", price);
+	}
+}
+
+void Merchant::weaponsBuyKeypress(Common::KeyCode keycode) {
+	int minIdx, maxIdx;
+	weaponsRange(minIdx, maxIdx);
+	int idx = keycode - Common::KEYCODE_a;
+
+	if (idx < minIdx || idx > maxIdx || (idx - minIdx) % 2 != 0) {
+		nothing();
+		return;
+	}
+
+	auto &sg = _G(savegame);
+	int price = (255 - sg._intelligence) * idx * idx / 256 + 5;
+	if (price > sg._coins) {
+		cantAfford();
+		return;
+	}
+
+	sg._coins -= price;
+	if (sg._weapons[idx] < 255)
+		++sg._weapons[idx];
+
+	writeString(Data::WEAPON_NAMES[idx]);
+	redrawStats();
+	writeString("\n");
+	writeString("Sold!\n");
+	finish();
+}
+
+void Merchant::drawWeaponsSell() {
+	drawShopName();
+	auto s = getSurface();
+	s.setColor(COLOR_TEXT);
+
+	int y = 6;
+	for (int idx = 1; idx < Data::WEAPON_COUNT; ++idx) {
+		if (_G(savegame)._weapons[idx]) {
+			int price = (_G(savegame)._charisma + 40) * idx * idx / 256 + 1;
+			s.writeString(Point(9, y), "%c) %s", 'a' + idx, Data::WEAPON_NAMES[idx]);
+			s.writeString(Point(26, y), "-%3d", price);
+			++y;
+		}
+	}
+}
+
+void Merchant::weaponsSellKeypress(Common::KeyCode keycode) {
+	int idx = keycode - Common::KEYCODE_a;
+	auto &sg = _G(savegame);
+
+	if (idx < 1 || idx >= Data::WEAPON_COUNT || !sg._weapons[idx]) {
+		nothing();
+		return;
+	}
+
+	int price = (sg._charisma + 40) * idx * idx / 256 + 1;
+	sg._coins += price;
+	--sg._weapons[idx];
+	if (idx == sg._equippedWeapon && sg._weapons[idx] == 0)
+		sg._equippedWeapon = 0;
+
+	writeString(Data::WEAPON_NAMES[idx]);
+	redrawStats();
+	writeString("\n");
+	writeString("Done!\n");
+	finish();
+}
+
+void Merchant::magicRange(int &minIdx, int &maxIdx) const {
+	int base = ((_G(map)._mapStyle & 1) == 0) ? 1 : 2;
+	int span = (_G(savegame)._class == Data::CLASS_CLERIC) ? 8 : 4;
+
+	minIdx = base;
+	maxIdx = base + span;
+}
+
+void Merchant::drawMagicBuy() {
+	drawShopName();
+	auto s = getSurface();
+	s.setColor(COLOR_TEXT);
+
+	int minIdx, maxIdx;
+	magicRange(minIdx, maxIdx);
+
+	int y = 8;
+	for (int idx = minIdx; idx <= maxIdx; idx += 2) {
+		if (idx == Data::SPELL_STEAL)
+			continue;
+
+		int price = ((200 - _G(savegame)._wisdom) / 32) * idx;
+		s.writeString(Point(9, y), "%c) %s", 'a' + idx, Data::SPELL_NAMES[idx]);
+		s.writeString(Point(26, y), "-%3d", price);
+		++y;
+	}
+}
+
+void Merchant::magicBuyKeypress(Common::KeyCode keycode) {
+	int minIdx, maxIdx;
+	magicRange(minIdx, maxIdx);
+	int idx = keycode - Common::KEYCODE_a;
+
+	if (idx < minIdx || idx > maxIdx || (idx - minIdx) % 2 != 0 || idx == Data::SPELL_STEAL) {
+		nothing();
+		return;
+	}
+
+	auto &sg = _G(savegame);
+	int price = ((200 - sg._wisdom) / 32) * idx;
+	if (price > sg._coins) {
+		cantAfford();
+		return;
+	}
+
+	sg._coins -= price;
+	if (sg._spells[idx] < 255)
+		++sg._spells[idx];
+
+	writeString(Data::SPELL_NAMES[idx]);
+	redrawStats();
+	writeString("\n");
+	writeString("Sold!\n");
+	finish();
+}
+
+void Merchant::groceryPrompt() {
+	_mode = SHOP_QTY;
+	_amount.clear();
+
+	int pricePerPack = 5 - _G(savegame)._intelligence / 20;
+	writeString("\n");
+	writeString(Common::String::format("Packs of 10 food cost %d pence each.\n", pricePerPack));
+	resetLine();
+	writeString("\x10""How many dost thou wish to purchase? ");
+	showCursor();
+}
+
+void Merchant::groceryKeypress(const KeypressMessage &msg) {
+	if (msg.ascii >= '0' && msg.ascii <= '9') {
+		if ((_amount.empty() && msg.ascii == '0') || _amount.size() >= 4)
+			return;
+
+		_amount += (char)msg.ascii;
+		writeString(Common::String(1, (char)msg.ascii));
+
+	} else if (msg.keycode == Common::KEYCODE_BACKSPACE) {
+		if (!_amount.empty()) {
+			_amount.deleteLastChar();
+			resetLine();
+			writeString(Common::String::format("\x10""How many dost thou wish to purchase? %s", _amount.c_str()));
+			showCursor();
+		}
+
+	} else {
+		int qty = _amount.empty() ? 0 : atoi(_amount.c_str());
+		auto &sg = _G(savegame);
+		int pricePerPack = 5 - sg._intelligence / 20;
+		int total = pricePerPack * qty;
+
+		writeString("\n");
+		if (qty == 0) {
+			nothing();
+		} else if (total > sg._coins) {
+			cantAfford();
+		} else {
+			sg._coins -= total;
+			sg._food += qty * 10;
+			redrawStats();
+			writeString(Common::String::format("%d packs food\n", qty));
+			writeString("Sold!\n");
+			finish();
+		}
+	}
+}
+
+void Merchant::tavernBuy() {
+	auto &sg = _G(savegame);
+
+	if (sg._coins == 0) {
+		writeString("\n");
+		writeString("Thou art broke!\n");
+		writeString("Come back when thou hast some money to spend.\n");
+		nothing();
+		return;
+	}
+
+	--sg._coins;
+	redrawStats();
+	writeString("\n");
+	writeString("The tavern keeper sayeth:\n");
+	writeString("Here, have a cold one!\n");
+	writeString("ale");
+	++_G(map)._tavernCtr;
+
+	if (_G(map)._tavernCtr > sg._stamina / 4 && isWenchNearby()) {
+		writeString("\n");
+		writeString(TAVERN_TIPS[0]);
+		writeString("\n");
+
+		sg._coins /= 2;
+		redrawStats();
+		--sg._wisdom;
+		if (sg._wisdom == 4)
+			++sg._wisdom;
+	}
+
+	if (g_engine->getRandomNumber(1, 255) < 75) {
+		int tipIdx = g_engine->getRandomNumber(11, 89) / 10;
+		writeString("\n");
+		writeString("Thou had best know ");
+
+		if (tipIdx == 2)
+			writeString(Common::String::format("to watch the %s.", sg._sex == Data::SEX_MALE ? "wench" : "lecher"));
+		else
+			writeString(TAVERN_TIPS[tipIdx]);
+		writeString("\n");
+	}
+
+	finish();
+}
+
+void Merchant::drawTransportBuy() {
+	drawShopName();
+	auto s = getSurface();
+	s.setColor(COLOR_TEXT);
+
+	int y = 8;
+	for (int i = 0; i < 6; ++i, ++y) {
+		if (_transportIds[i] == 0)
+			continue;
+
+		int transportId = _transportIds[i];
+		int price = ((200 - _G(savegame)._intelligence) / 5) * transportId * transportId;
+		s.writeString(Point(11, y), "%c) %s", 'a' + i, Data::TRANSPORT_NAMES[transportId]);
+		s.writeString(Point(22, y), "-%4d", price);
+	}
+}
+
+void Merchant::transportBuyKeypress(Common::KeyCode keycode) {
+	int letterIdx = keycode - Common::KEYCODE_a;
+	if (letterIdx < 0 || letterIdx > 5 || _transportIds[letterIdx] == 0) {
+		nothing();
+		return;
+	}
+
+	int transportId = _transportIds[letterIdx];
+	auto &sg = _G(savegame);
+	int price = ((200 - sg._intelligence) / 5) * transportId * transportId;
+
+	if (price > sg._coins) {
+		cantAfford();
+		return;
+	}
+
+	writeString(Data::TRANSPORT_NAMES[transportId]);
+	sg._coins -= price;
+	redrawStats();
+
+	if (sg._transports[transportId] < 255)
+		++sg._transports[transportId];
+
+	if (transportId == Data::TRANSPORT_SHUTTLE) {
+		sg._shipFuel = 1000;
+		sg._shipShield = 1000;
+	}
+
+	spawnTransport(transportId);
+
+	writeString("\n");
+	writeString("Sold!\n");
+	finish();
+}
+
+void Merchant::spawnTransport(int transportId) {
+	static const int TRANSPORT_TILES[8] = {
+		0, Data::TILE_HORSE, Data::TILE_CART, Data::TILE_RAFT, Data::TILE_FRIGATE1,
+		Data::TILE_AIRCAR, Data::TILE_SHUTTLE, 0
+	};
+
+	int neededTile;
+	switch (transportId) {
+	case Data::TRANSPORT_HORSE:
+	case Data::TRANSPORT_CART:
+		neededTile = (_G(map)._woodsCount > 0) ? Data::TILE_WOODS : Data::TILE_GRASS;
+		break;
+	case Data::TRANSPORT_RAFT:
+	case Data::TRANSPORT_FRIGATE:
+		neededTile = Data::TILE_OCEAN;
+		break;
+	default:
+		neededTile = Data::TILE_GRASS;
+		break;
+	}
+
+	const Common::Point &pos = _G(savegame)._overworldPos;
+	int dx = 1, dy = 1;
+	bool found = false;
+
+	for (int y = -1; y <= 1 && !found; ++y) {
+		for (int x = -1; x <= 1 && !found; ++x) {
+			if (_G(map).getTileAt(pos.x + x, pos.y + y) == neededTile) {
+				dx = x;
+				dy = y;
+				found = true;
+			}
+		}
+	}
+
+	if (_G(overworldEntityCount) < Data::OVERWORLD_ENTITY_COUNT - 1) {
+		++_G(overworldEntityCount);
+		auto &e = _G(savegame)._overworldEntities[_G(overworldEntityCount)];
+		e._type = TRANSPORT_TILES[transportId];
+		e._data = neededTile;
+		e._x = pos.x + dx;
+		e._y = pos.y + dy;
+		e._hits = 0;
+	}
+}
+
+void Merchant::nothing() {
+	writeString("nothing");
+	finish();
+}
+
+void Merchant::cantAfford() {
+	writeString("nothing");
+	writeString("\n");
+	writeString("Thou canst not afford it!\n");
+	g_engine->playFX(1);
+	finish();
+}
+
+void Merchant::finish() {
+	writeString("\n");
+	prompt();
+	close();
+}
+
+void Merchant::redrawStats() {
+	g_engine->findView("Stats")->draw();
+}
+
+} // namespace Interactions
+} // namespace Views
+} // namespace Ultima1
+} // namespace Ultima
diff --git a/engines/ultima/ultima1/views/interactions/merchant.h b/engines/ultima/ultima1/views/interactions/merchant.h
new file mode 100644
index 00000000000..441a1878caf
--- /dev/null
+++ b/engines/ultima/ultima1/views/interactions/merchant.h
@@ -0,0 +1,146 @@
+
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef ULTIMA1_VIEWS_INTERACTIONS_MERCHANT_H
+#define ULTIMA1_VIEWS_INTERACTIONS_MERCHANT_H
+
+#include "ultima/ultima1/views/interactions/interaction.h"
+
+namespace Ultima {
+namespace Ultima1 {
+namespace Views {
+namespace Interactions {
+
+using namespace Ultima::Shared::Messages;
+
+/**
+ * The kind of shop found at the counter tile the player is standing on
+ */
+enum ShopType {
+	SHOP_ARMORY, SHOP_WEAPONS, SHOP_MAGIC, SHOP_GROCER, SHOP_TAVERN, SHOP_TRANSPORT
+};
+
+/**
+ * Handler for the buy/sell side of the Transact command within cities.
+ * Only usable when standing at a shop counter tile - the specific shop is
+ * determined from the tile at focus time
+ */
+class Merchant : public Interaction {
+	enum Mode {
+		SHOP_PROMPT, SHOP_BUY, SHOP_SELL, SHOP_QTY
+	};
+private:
+	ShopType _shopType = SHOP_ARMORY;
+	Mode _mode = SHOP_PROMPT;
+	Common::String _amount;
+	// Which of the 6 transports (Horse..Shuttle) are offered this visit,
+	// indexed by the letter (a-f) used to select them; 0 means unavailable
+	int _transportIds[6] = { 0, 0, 0, 0, 0, 0 };
+
+	void nothing();
+	void cantAfford();
+	void finish();
+	void redrawStats();
+
+	/**
+	 * Returns which of the 8 flavor variants of the current shop type is
+	 * showing, based on the current city's map style
+	 */
+	int shopVariant() const;
+
+	/**
+	 * Draws the current shop's proprietor name(s), if any, centered near
+	 * the top of the dialog
+	 */
+	void drawShopName();
+
+	/**
+	 * Returns true if a wench (or, for a female player, a lecher) NPC is
+	 * standing next to the player - used by the tavern's drunk penalty
+	 */
+	bool isWenchNearby() const;
+
+	/**
+	 * Returns the number of vehicle entities currently out on the
+	 * overworld map, used to cap the transport shop's available fleet
+	 */
+	int overworldTransportCount() const;
+
+	void chooseBuy();
+	void chooseSell();
+
+	void drawArmoryBuy();
+	void drawArmorySell();
+	void armoryBuyKeypress(Common::KeyCode keycode);
+	void armorySellKeypress(Common::KeyCode keycode);
+
+	/**
+	 * Works out the inclusive min/max weapon indexes this shop currently
+	 * offers - every second index starting from a base that alternates by
+	 * map style, extended over time by the move counter
+	 */
+	void weaponsRange(int &minIdx, int &maxIdx) const;
+	void drawWeaponsBuy();
+	void drawWeaponsSell();
+	void weaponsBuyKeypress(Common::KeyCode keycode);
+	void weaponsSellKeypress(Common::KeyCode keycode);
+
+	/**
+	 * Works out the inclusive min/max spell indexes this shop currently
+	 * offers - every second index starting from a base that alternates by
+	 * map style, extended for Clerics. The Steal spell is never offered
+	 */
+	void magicRange(int &minIdx, int &maxIdx) const;
+	void drawMagicBuy();
+	void magicBuyKeypress(Common::KeyCode keycode);
+
+	void groceryPrompt();
+	void groceryKeypress(const KeypressMessage &msg);
+
+	void tavernBuy();
+
+	void drawTransportBuy();
+	void transportBuyKeypress(Common::KeyCode keycode);
+
+	/**
+	 * Places a newly bought vehicle on the overworld next to the city,
+	 * on whichever adjacent tile matches the terrain it needs
+	 */
+	void spawnTransport(int transportId);
+
+public:
+	Merchant();
+	~Merchant() override {
+	}
+
+	void draw() override;
+	bool msgFocus(const FocusMessage &msg) override;
+	bool msgAction(const ActionMessage &msg) override;
+	bool msgKeypress(const KeypressMessage &msg) override;
+};
+
+} // namespace Interactions
+} // namespace Views
+} // namespace Ultima1
+} // namespace Ultima
+
+#endif
diff --git a/engines/ultima/ultima1/views/views.h b/engines/ultima/ultima1/views/views.h
index 1478fbd3b1c..5db03641828 100644
--- a/engines/ultima/ultima1/views/views.h
+++ b/engines/ultima/ultima1/views/views.h
@@ -25,6 +25,8 @@
 #include "ultima/shared/engine/events.h"
 #include "ultima/ultima1/views/interactions/dead.h"
 #include "ultima/ultima1/views/interactions/drop.h"
+#include "ultima/ultima1/views/interactions/king.h"
+#include "ultima/ultima1/views/interactions/merchant.h"
 #include "ultima/ultima1/views/interactions/ready.h"
 #include "ultima/ultima1/views/create_character.h"
 #include "ultima/ultima1/views/game.h"
@@ -42,6 +44,8 @@ namespace Views {
 struct Views : public Shared::Views {
 	Interactions::Dead _dead;
 	Interactions::Drop _drop;
+	Interactions::King _king;
+	Interactions::Merchant _merchant;
 	Interactions::Ready _ready;
 	CreateCharacter _createCharacter;
 	Game _game;


Commit: 35d6ece01f839a59b8490496ab85982e010fa2be
    https://github.com/scummvm/scummvm/commit/35d6ece01f839a59b8490496ab85982e010fa2be
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:40:49+11:00

Commit Message:
ULTIMA: ULTIMA1: Sharing city movement logic with castle logic

Changed paths:
    engines/ultima/ultima1/logic/city_castle_logic.cpp
    engines/ultima/ultima1/logic/city_castle_logic.h


diff --git a/engines/ultima/ultima1/logic/city_castle_logic.cpp b/engines/ultima/ultima1/logic/city_castle_logic.cpp
index 6f261c12cd1..933d7e1e987 100644
--- a/engines/ultima/ultima1/logic/city_castle_logic.cpp
+++ b/engines/ultima/ultima1/logic/city_castle_logic.cpp
@@ -126,6 +126,41 @@ void CityCastleLogic::entering() {
 	loadEntities();
 }
 
+void CityCastleLogic::leaving() {
+	// Left the bounds of the map, returning to the overworld
+	_G(map).load(Data::MAP_OVERWORLD);
+}
+
+bool CityCastleLogic::move(Data::Direction dir) {
+	const int deltaX = DELTA_X[dir];
+	const int deltaY = DELTA_Y[dir];
+	const int x = _G(savegame)._locationPosition.x + deltaX;
+	const int y = _G(savegame)._locationPosition.y + deltaY;
+
+	if (x < 0 || y < 0 || x >= Data::CITY_WIDTH || y >= Data::CITY_HEIGHT) {
+		leaving();
+
+	} else {
+		int tile = checkAt(x, y);
+
+		if (tile == -1 || tile == Data::CTILE_BLANK) {
+			// Write direction traveled
+			writeString(Common::String::format("%s\n", Data::DIRECTION_NAMES[dir]));
+
+			_G(savegame)._locationPosition = Common::Point(x, y);
+			playFX(1);
+			redrawMap();
+
+		} else {
+			// Can't move in that direction
+			writeString("Blocked!\n");
+			playFX(1);
+		}
+	}
+
+	return true;
+}
+
 bool CityCastleLogic::drop() {
 	g_engine->addView("Drop");
 	return false;
@@ -281,6 +316,17 @@ void CityCastleLogic::loadEntities() {
 		savegame._locationEntities[idx] = widgets[idx];
 }
 
+int CityCastleLogic::checkAt(int x, int y) const {
+	int tile = _G(map).getTileAt(x, y);
+	if (tile == Data::CTILE_BLANK)
+		return tile;
+
+	if (tile == Data::CTILE_GROUND || tile >= Data::CTILE_GUARD_MB)
+		return -1;
+
+	return 0;
+}
+
 /*-------------------------------------------------------------------*/
 
 CityLogic::CityLogic() {
@@ -294,36 +340,6 @@ void CityLogic::entering() {
 	CityCastleLogic::entering();
 }
 
-bool CityLogic::move(Data::Direction dir) {
-	const int deltaX = DELTA_X[dir];
-	const int deltaY = DELTA_Y[dir];
-	const int x = _G(savegame)._locationPosition.x + deltaX;
-	const int y = _G(savegame)._locationPosition.y + deltaY;
-
-	if (x < 0 || y < 0 || x >= Data::CITY_WIDTH || y >= Data::CITY_HEIGHT) {
-		// Left the bounds of the map, returning to the overworld
-		_G(map).load(Data::MAP_OVERWORLD);
-	} else {
-		int tile = checkAt(x, y);
-
-		if (tile == -1 || tile == Data::CTILE_BLANK) {
-			// Write direction traveled
-			writeString(Common::String::format("%s\n", Data::DIRECTION_NAMES[dir]));
-
-			_G(savegame)._locationPosition = Common::Point(x, y);
-			playFX(1);
-			redrawMap();
-			
-		} else {
-			// Can't move in that direction
-			writeString("Blocked!\n");
-			playFX(1);
-		}
-	}
-
-	return true;
-}
-
 bool CityLogic::transact() {
 	writeString("Transact");
 
@@ -346,18 +362,6 @@ bool CityLogic::transact() {
 	return false;
 }
 
-int CityLogic::checkAt(int x, int y) const {
-	int tile = _G(map).getTileAt(x, y);
-	if (tile == Data::CTILE_BLANK)
-		return tile;
-
-	if (tile == Data::CTILE_GROUND || tile >= Data::CTILE_GUARD_MB)
-		return -1;
-
-	return 0;
-}
-
-
 /*-------------------------------------------------------------------*/
 
 CastleLogic::CastleLogic() {
@@ -403,6 +407,24 @@ void CastleLogic::entering() {
 	CityCastleLogic::entering();
 }
 
+void CastleLogic::leaving() {
+	// Check when leaving castles if we've saved the princess
+	if (isPrincessSaved()) {
+		princessSaved();
+	} else {
+		CityCastleLogic::leaving();
+	}
+}
+
+bool CastleLogic::isPrincessSaved() {
+	// TODO
+	return false;
+}
+
+void CastleLogic::princessSaved() {
+	// TODO: Show a Princess interaction
+}
+
 } // namespace Logic
 } // namespace Ultima1
 } // namespace Ultima
diff --git a/engines/ultima/ultima1/logic/city_castle_logic.h b/engines/ultima/ultima1/logic/city_castle_logic.h
index 574335e49dc..c63a8eee0a8 100644
--- a/engines/ultima/ultima1/logic/city_castle_logic.h
+++ b/engines/ultima/ultima1/logic/city_castle_logic.h
@@ -30,12 +30,23 @@ namespace Ultima1 {
 namespace Logic {
 
 class CityCastleLogic : public Logic {
+private:
+	/**
+	 * Checks if the player can move to a given location
+	 */
+	int checkAt(int x, int y) const;
+
 protected:
 	/**
 	 * Load the NPCs for the given location
 	 */
 	void loadEntities();
 
+	/**
+	 * Handle movement
+	 */
+	bool move(Data::Direction dir) override;
+
 	/**
 	 * The Drop command is only usable within cities and castles
 	 */
@@ -91,20 +102,15 @@ public:
 	}
 
 	void entering() override;
-};
 
-class CityLogic : public CityCastleLogic {
-protected:
 	/**
-	 * Handle movement
+	 * Called to leave the location
 	 */
-	bool move(Data::Direction dir) override;
-
-	/**
-	 * Checks if the player can move to a given location
-	 */
-	int checkAt(int x, int y) const;
+	virtual void leaving();
+};
 
+class CityLogic : public CityCastleLogic {
+protected:
 	/**
 	 * The Transact command opens the Merchant view when standing at a shop
 	 * counter
@@ -120,14 +126,18 @@ public:
 };
 
 class CastleLogic : public CityCastleLogic {
-protected:
+private:
 	/**
-	 * Handle movement
+	 * Returns true if the player has left the castle with a princess
 	 */
-	bool move(Data::Direction dir) override {
-		return true;
-	}
+	bool isPrincessSaved();
+
+	/**
+	 * Called when a princess has been saved, to show the princess dialog before loading the overworld map. 
+	 */
+	void princessSaved();
 
+protected:
 	/**
 	 * The Transact command opens the King view when standing at the throne
 	 */
@@ -139,6 +149,11 @@ public:
 	}
 
 	void entering() override;
+
+	/**
+	 * Called when leaving the castle
+	 */
+	void leaving() override;
 };
 
 } // namespace Logic


Commit: 95dbdc8fac4bb686febe8be3872d2fb4037ac19f
    https://github.com/scummvm/scummvm/commit/95dbdc8fac4bb686febe8be3872d2fb4037ac19f
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:40:49+11:00

Commit Message:
ULTIMA: ULTIMA1: Better drop reward tile constants

Changed paths:
    engines/ultima/ultima1/data/tiles.h
    engines/ultima/ultima1/logic/city_castle_logic.cpp
    engines/ultima/ultima1/views/interactions/drop.cpp


diff --git a/engines/ultima/ultima1/data/tiles.h b/engines/ultima/ultima1/data/tiles.h
index 5bc55684f5b..13b8b823d5c 100644
--- a/engines/ultima/ultima1/data/tiles.h
+++ b/engines/ultima/ultima1/data/tiles.h
@@ -59,11 +59,11 @@ enum LocationTileId {
 	CTILE_WALL = 0,
 	CTILE_GROUND = 1,
 	CTILE_PLAYER = 18,
-	CTILE_GUARD_MB = 51,
-	// Unnamed in the original - both are "wishing well"-style tiles that
+	// Unnamed in the original - all three are "wishing well"-style tiles that
 	// dropPence/dropPenceCastle give a random bonus for dropping coins on
-	CTILE_52 = 52,
-	CTILE_53 = 53,
+	CTILE_DROP1 = 51,
+	CTILE_DROP2 = 52,
+	CTILE_DROP3 = 53,
 	// Shop counter tiles. Each shop spans two adjacent tiles - the even one
 	// is just the other half of the counter, while the odd one is also the
 	// tile get/steal work against
diff --git a/engines/ultima/ultima1/logic/city_castle_logic.cpp b/engines/ultima/ultima1/logic/city_castle_logic.cpp
index 933d7e1e987..0e00feb45d1 100644
--- a/engines/ultima/ultima1/logic/city_castle_logic.cpp
+++ b/engines/ultima/ultima1/logic/city_castle_logic.cpp
@@ -321,7 +321,7 @@ int CityCastleLogic::checkAt(int x, int y) const {
 	if (tile == Data::CTILE_BLANK)
 		return tile;
 
-	if (tile == Data::CTILE_GROUND || tile >= Data::CTILE_GUARD_MB)
+	if (tile == Data::CTILE_GROUND || tile >= Data::CTILE_DROP1)
 		return -1;
 
 	return 0;
diff --git a/engines/ultima/ultima1/views/interactions/drop.cpp b/engines/ultima/ultima1/views/interactions/drop.cpp
index 4c60b2788b2..00f1227e413 100644
--- a/engines/ultima/ultima1/views/interactions/drop.cpp
+++ b/engines/ultima/ultima1/views/interactions/drop.cpp
@@ -246,7 +246,7 @@ void Drop::dropPenceCityBonus(int total) {
 	auto &sg = _G(savegame);
 	int tile = _G(map).getTileAt(sg._locationPosition.x, sg._locationPosition.y);
 
-	if (tile != Data::CTILE_GUARD_MB) {
+	if (tile != Data::CTILE_DROP1) {
 		writeString("Ok!");
 		return;
 	}
@@ -275,7 +275,7 @@ void Drop::dropPenceCastleBonus(int total) {
 	auto &sg = _G(savegame);
 	int tile = _G(map).getTileAt(sg._locationPosition.x, sg._locationPosition.y);
 
-	if (tile != Data::CTILE_GUARD_MB && tile != Data::CTILE_52 && tile != Data::CTILE_53) {
+	if (tile != Data::CTILE_DROP1 && tile != Data::CTILE_DROP2 && tile != Data::CTILE_DROP3) {
 		writeString("Ok!");
 		return;
 	}
@@ -283,11 +283,11 @@ void Drop::dropPenceCastleBonus(int total) {
 	writeString("Shazam!");
 	g_engine->playFX(5);
 
-	if (tile == Data::CTILE_53) {
+	if (tile == Data::CTILE_DROP3) {
 		sg._food += total * 3;
 		redrawStats();
 
-	} else if (tile == Data::CTILE_52) {
+	} else if (tile == Data::CTILE_DROP2) {
 		if (total >= 10) {
 			int weaponIdx = g_engine->getRandomNumber(1, 15);
 			if (sg._weapons[weaponIdx] < 255)
@@ -295,7 +295,7 @@ void Drop::dropPenceCastleBonus(int total) {
 		}
 
 	} else {
-		// CTILE_GUARD_MB - boost a random attribute (never Hits), capped at 99
+		// CTILE_51 - boost a random attribute (never Hits), capped at 99
 		int attrIdx = g_engine->getRandomNumber(1, 6);
 		int16 *attr;
 		switch (attrIdx) {


Commit: 06adeb8d105e36a7e69a8d1dbe509951e482d70e
    https://github.com/scummvm/scummvm/commit/06adeb8d105e36a7e69a8d1dbe509951e482d70e
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:40:49+11:00

Commit Message:
ULTIMA: ULTIMA1: Added princess save detection, display

Changed paths:
  A engines/ultima/ultima1/views/interactions/princess_saved.cpp
  A engines/ultima/ultima1/views/interactions/princess_saved.h
    engines/ultima/module.mk
    engines/ultima/ultima1/logic/city_castle_logic.cpp
    engines/ultima/ultima1/logic/city_castle_logic.h
    engines/ultima/ultima1/views/views.h


diff --git a/engines/ultima/module.mk b/engines/ultima/module.mk
index 33d87663fc1..fbe1d972e5a 100644
--- a/engines/ultima/module.mk
+++ b/engines/ultima/module.mk
@@ -70,6 +70,7 @@ MODULE_OBJS += \
 	ultima1/views/interactions/drop.o \
 	ultima1/views/interactions/king.o \
 	ultima1/views/interactions/merchant.o \
+	ultima1/views/interactions/princess_saved.o \
 	ultima1/views/interactions/ready.o \
 	ultima1/views/view.o \
 	ultima1/views/commands.o \
diff --git a/engines/ultima/ultima1/logic/city_castle_logic.cpp b/engines/ultima/ultima1/logic/city_castle_logic.cpp
index 0e00feb45d1..d10b6adf387 100644
--- a/engines/ultima/ultima1/logic/city_castle_logic.cpp
+++ b/engines/ultima/ultima1/logic/city_castle_logic.cpp
@@ -416,13 +416,27 @@ void CastleLogic::leaving() {
 	}
 }
 
+bool CastleLogic::isPrincessAtDelta(int deltaX, int deltaY) const {
+	const auto &pos = _G(savegame)._locationPosition;
+	int idx = _G(savegame).getLocationEntityAt(pos.x + deltaX, pos.y + deltaY);
+
+	// Widget type 22 is a princess
+	return idx != -1 && _G(savegame)._locationEntities[idx]._type == 22;
+}
+
 bool CastleLogic::isPrincessSaved() {
-	// TODO
+	for (int deltaY = -1; deltaY <= 1; ++deltaY) {
+		for (int deltaX = -1; deltaX <= 1; ++deltaX) {
+			if ((deltaX || deltaY) && isPrincessAtDelta(deltaX, deltaY))
+				return true;
+		}
+	}
+
 	return false;
 }
 
 void CastleLogic::princessSaved() {
-	// TODO: Show a Princess interaction
+	g_engine->addView("PrincessSaved");
 }
 
 } // namespace Logic
diff --git a/engines/ultima/ultima1/logic/city_castle_logic.h b/engines/ultima/ultima1/logic/city_castle_logic.h
index c63a8eee0a8..97d1033c4c1 100644
--- a/engines/ultima/ultima1/logic/city_castle_logic.h
+++ b/engines/ultima/ultima1/logic/city_castle_logic.h
@@ -127,6 +127,12 @@ public:
 
 class CastleLogic : public CityCastleLogic {
 private:
+	/**
+	 * Returns true if a princess NPC is standing at a given offset from
+	 * the player's current position
+	 */
+	bool isPrincessAtDelta(int deltaX, int deltaY) const;
+
 	/**
 	 * Returns true if the player has left the castle with a princess
 	 */
diff --git a/engines/ultima/ultima1/views/interactions/princess_saved.cpp b/engines/ultima/ultima1/views/interactions/princess_saved.cpp
new file mode 100644
index 00000000000..0827c68bbbe
--- /dev/null
+++ b/engines/ultima/ultima1/views/interactions/princess_saved.cpp
@@ -0,0 +1,119 @@
+
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "ultima/ultima1/views/interactions/princess_saved.h"
+#include "ultima/ultima1/ultima1.h"
+
+namespace Ultima {
+namespace Ultima1 {
+namespace Views {
+namespace Interactions {
+
+// Indexed by Map::_castleNum (0-7)
+static const char *const PRINCESS_NAMES[8] = {
+	"Julia", "Cassandra", "Marsha", "Donna", "Kristen", "Beth", "Lori", "Dianne"
+};
+
+PrincessSaved::PrincessSaved() : Interaction("PrincessSaved") {
+}
+
+bool PrincessSaved::msgFocus(const FocusMessage &msg) {
+	setBounds(Common::Rect(0, 0, 0, 0));
+	auto &sg = _G(savegame);
+
+	// Whether the player has already done enough to be ready to win, checked
+	// before this rescue's reward is applied, matching the original
+	bool readyForTimeTravel = sg._enemyVessels >= 20 && sg._experience >= 7000;
+
+	writeString(Common::String::format("Thou hast saved the princess %s.  She giveth thee\n",
+		PRINCESS_NAMES[_G(map)._castleNum]));
+	writeString("500 hit points, pence and experience points.\n");
+
+	sg._coins += 500;
+	sg._hits += 500;
+	sg._experience += 500;
+	g_engine->findView("Stats")->draw();
+
+	if (readyForTimeTravel) {
+		writeString("\n");
+		writeString("She informs thee that thou art now ready for time travel,\n");
+		writeString("and that there is a time machine far to the northwest!\n");
+
+		if (sg._transports[Data::TRANSPORT_TIME_MACHINE] < 9) {
+			++sg._transports[Data::TRANSPORT_TIME_MACHINE];
+			spawnTimeMachine();
+		}
+	}
+
+	writeString("\n");
+	showCursor();
+	return true;
+}
+
+bool PrincessSaved::msgAction(const ActionMessage &msg) {
+	finish();
+	return true;
+}
+
+bool PrincessSaved::msgKeypress(const KeypressMessage &msg) {
+	finish();
+	return true;
+}
+
+void PrincessSaved::spawnTimeMachine() {
+	static const int BASE_X[4] = { 0, 83, 0, 83 };
+	static const int BASE_Y[4] = { 0, 0, 77, 77 };
+
+	int continent = _G(map).getContinentAt(_G(savegame)._overworldPos);
+	int baseX = BASE_X[continent];
+	int baseY = BASE_Y[continent];
+
+	for (int i = 0; i < 500; ++i) {
+		int x = baseX + g_engine->getRandomNumber(12, 21);
+		int y = baseY + g_engine->getRandomNumber(11, 15);
+
+		if (_G(map).getTileAt(x, y) == Data::TILE_WOODS) {
+			if (_G(overworldEntityCount) < Data::OVERWORLD_ENTITY_COUNT - 1) {
+				++_G(overworldEntityCount);
+				auto &e = _G(savegame)._overworldEntities[_G(overworldEntityCount)];
+				e._type = Data::TILE_TIME_MACHINE;
+				e._data = Data::TILE_WOODS;
+				e._x = x;
+				e._y = y;
+				e._hits = 0;
+			}
+			break;
+		}
+	}
+}
+
+void PrincessSaved::finish() {
+	// Clear out the Castle logic handler and load the overworld map
+	delete _G(logic);
+	_G(logic) = nullptr;
+	_G(map).load(Data::MAP_OVERWORLD);
+}
+
+} // namespace Interactions
+} // namespace Views
+} // namespace Ultima1
+} // namespace Ultima
diff --git a/engines/ultima/ultima1/views/interactions/princess_saved.h b/engines/ultima/ultima1/views/interactions/princess_saved.h
new file mode 100644
index 00000000000..7a9fd72308c
--- /dev/null
+++ b/engines/ultima/ultima1/views/interactions/princess_saved.h
@@ -0,0 +1,70 @@
+
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef ULTIMA1_VIEWS_INTERACTIONS_PRINCESS_SAVED_H
+#define ULTIMA1_VIEWS_INTERACTIONS_PRINCESS_SAVED_H
+
+#include "ultima/ultima1/views/interactions/interaction.h"
+
+namespace Ultima {
+namespace Ultima1 {
+namespace Views {
+namespace Interactions {
+
+using namespace Ultima::Shared::Messages;
+
+/**
+ * Shown when the player carries a castle's princess out past its bounds.
+ * Grants the base reward, and - if the player is otherwise ready to win
+ * (enough enemy vessels destroyed and experience gained) - also reveals
+ * and hides a time machine out on the overworld. Any keypress dismisses
+ * it and returns to the overworld
+ */
+class PrincessSaved : public Interaction {
+private:
+	/**
+	 * Hides a time machine on the overworld, near the continent the player
+	 * is currently on, on a random patch of woods
+	 */
+	void spawnTimeMachine();
+
+	/**
+	 * Dismisses the dialog and returns to the overworld
+	 */
+	void finish();
+
+public:
+	PrincessSaved();
+	~PrincessSaved() override {
+	}
+
+	bool msgFocus(const FocusMessage &msg) override;
+	bool msgAction(const ActionMessage &msg) override;
+	bool msgKeypress(const KeypressMessage &msg) override;
+};
+
+} // namespace Interactions
+} // namespace Views
+} // namespace Ultima1
+} // namespace Ultima
+
+#endif
diff --git a/engines/ultima/ultima1/views/views.h b/engines/ultima/ultima1/views/views.h
index 5db03641828..3937400a163 100644
--- a/engines/ultima/ultima1/views/views.h
+++ b/engines/ultima/ultima1/views/views.h
@@ -27,6 +27,7 @@
 #include "ultima/ultima1/views/interactions/drop.h"
 #include "ultima/ultima1/views/interactions/king.h"
 #include "ultima/ultima1/views/interactions/merchant.h"
+#include "ultima/ultima1/views/interactions/princess_saved.h"
 #include "ultima/ultima1/views/interactions/ready.h"
 #include "ultima/ultima1/views/create_character.h"
 #include "ultima/ultima1/views/game.h"
@@ -46,6 +47,7 @@ struct Views : public Shared::Views {
 	Interactions::Drop _drop;
 	Interactions::King _king;
 	Interactions::Merchant _merchant;
+	Interactions::PrincessSaved _princessSaved;
 	Interactions::Ready _ready;
 	CreateCharacter _createCharacter;
 	Game _game;


Commit: 9646b91c5979c5e72c4cc18226a3171ae79f554e
    https://github.com/scummvm/scummvm/commit/9646b91c5979c5e72c4cc18226a3171ae79f554e
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:40:49+11:00

Commit Message:
ULTIMA: ULTIMA1: Function skeletons for end of turn creature updates

Changed paths:
    engines/ultima/ultima1/logic/city_castle_logic.cpp
    engines/ultima/ultima1/logic/city_castle_logic.h
    engines/ultima/ultima1/logic/dungeon_logic.cpp
    engines/ultima/ultima1/logic/dungeon_logic.h
    engines/ultima/ultima1/logic/logic.h
    engines/ultima/ultima1/logic/overworld_logic.cpp
    engines/ultima/ultima1/logic/overworld_logic.h
    engines/ultima/ultima1/logic/pillar_logic.h


diff --git a/engines/ultima/ultima1/logic/city_castle_logic.cpp b/engines/ultima/ultima1/logic/city_castle_logic.cpp
index d10b6adf387..638a7c11f9e 100644
--- a/engines/ultima/ultima1/logic/city_castle_logic.cpp
+++ b/engines/ultima/ultima1/logic/city_castle_logic.cpp
@@ -161,6 +161,10 @@ bool CityCastleLogic::move(Data::Direction dir) {
 	return true;
 }
 
+void CityCastleLogic::updateCreatures() {
+
+}
+
 bool CityCastleLogic::drop() {
 	g_engine->addView("Drop");
 	return false;
@@ -327,6 +331,23 @@ int CityCastleLogic::checkAt(int x, int y) const {
 	return 0;
 }
 
+void CityCastleLogic::updateBardJester(int entityIndex) {
+
+}
+
+void CityCastleLogic::updateWench(int entityIndex) {
+
+}
+
+void CityCastleLogic::updatePrincess(int entityIndex) {
+
+}
+
+bool CityCastleLogic::guardMove(int entityIndex) {
+	// TODO
+	return false;
+}
+
 /*-------------------------------------------------------------------*/
 
 CityLogic::CityLogic() {
diff --git a/engines/ultima/ultima1/logic/city_castle_logic.h b/engines/ultima/ultima1/logic/city_castle_logic.h
index 97d1033c4c1..2b331460133 100644
--- a/engines/ultima/ultima1/logic/city_castle_logic.h
+++ b/engines/ultima/ultima1/logic/city_castle_logic.h
@@ -36,6 +36,26 @@ private:
 	 */
 	int checkAt(int x, int y) const;
 
+	/**
+	 * Updates Bard/Jesters at end of turn
+	 */
+	void updateBardJester(int entityIndex);
+
+	/**
+	 * Updates wenches at end of turn
+	 */
+	void updateWench(int entityIndex);
+
+	/**
+	 * Updates princesses at end of turn
+	 */
+	void updatePrincess(int entityIndex);
+
+	/**
+	 * Handles hostile guard movement
+	 */
+	bool guardMove(int entityIndex);
+
 protected:
 	/**
 	 * Load the NPCs for the given location
@@ -47,6 +67,11 @@ protected:
 	 */
 	bool move(Data::Direction dir) override;
 
+	/**
+	 * Handles updating creatures/NPCs
+	 */
+	void updateCreatures() override;
+
 	/**
 	 * The Drop command is only usable within cities and castles
 	 */
diff --git a/engines/ultima/ultima1/logic/dungeon_logic.cpp b/engines/ultima/ultima1/logic/dungeon_logic.cpp
index 601d5d023be..f28cbf05fff 100644
--- a/engines/ultima/ultima1/logic/dungeon_logic.cpp
+++ b/engines/ultima/ultima1/logic/dungeon_logic.cpp
@@ -32,12 +32,12 @@ void DungeonLogic::entering() {
 	// TODO
 }
 
-void DungeonLogic::action(int action) {
-	// TODO
+bool DungeonLogic::move(Data::Direction dir) {
+	return true;
 }
 
-void DungeonLogic::keypress(Common::KeyCode keycode) {
-	action(KEYBIND_PASS);
+void DungeonLogic::updateCreatures() {
+	// TODO
 }
 
 } // namespace Logic
diff --git a/engines/ultima/ultima1/logic/dungeon_logic.h b/engines/ultima/ultima1/logic/dungeon_logic.h
index 6021997cb07..06bfb8a8429 100644
--- a/engines/ultima/ultima1/logic/dungeon_logic.h
+++ b/engines/ultima/ultima1/logic/dungeon_logic.h
@@ -31,17 +31,21 @@ namespace Logic {
 
 class DungeonLogic : public Logic {
 protected:
-	bool move(Data::Direction dir) override {
-		return true;
-	}
+	/**
+	 * Handle dungeon movement
+	 */
+	bool move(Data::Direction dir) override;
+
+	/**
+	 * Handles updating creatures/NPCs
+	 */
+	void updateCreatures() override;
 
 public:
 	~DungeonLogic() override {
 	}
 
 	void entering() override;
-	void action(int action) override;
-	void keypress(Common::KeyCode keycode) override;
 };
 
 } // namespace Logic
diff --git a/engines/ultima/ultima1/logic/logic.h b/engines/ultima/ultima1/logic/logic.h
index 5795fdb2308..8ea9e52cf36 100644
--- a/engines/ultima/ultima1/logic/logic.h
+++ b/engines/ultima/ultima1/logic/logic.h
@@ -73,6 +73,11 @@ protected:
 	 */
 	virtual void endOfTurn();
 
+	/**
+	 * Handles updating creatures/NPCs
+	 */
+	virtual void updateCreatures() = 0;
+
 	/*--- Fallback player action handlers. Each returns true if end of
 	 * turn processing should happen immediately afterward, or false if
 	 * that's being deferred - typically because a sub-dialog was opened
diff --git a/engines/ultima/ultima1/logic/overworld_logic.cpp b/engines/ultima/ultima1/logic/overworld_logic.cpp
index ea82dba7685..de799f33ade 100644
--- a/engines/ultima/ultima1/logic/overworld_logic.cpp
+++ b/engines/ultima/ultima1/logic/overworld_logic.cpp
@@ -188,32 +188,6 @@ bool OverworldLogic::moveCheck(Data::Direction dir) {
 	return true;
 }
 
-int OverworldLogic::getViewportX(int xp) const {
-	error("Deprecated");
-#if 0
-	int x = _G(savegame)._overworldPos.x - Data::MAP_VISIBLE_CENTER_X + xp;
-	if (x < 0)
-		x += Data::OVERWORLD_WIDTH;
-	else if (x >= Data::OVERWORLD_WIDTH)
-		x -= Data::OVERWORLD_WIDTH;
-
-	return x;
-#endif
-}
-
-int OverworldLogic::getViewportY(int yp) const {
-	error("Deprecated");
-#if 0
-	int y = _G(savegame)._overworldPos.y - Data::MAP_VISIBLE_CENTER_Y + yp;
-	if (y < 0)
-		y += Data::OVERWORLD_HEIGHT;
-	else if (y >= Data::OVERWORLD_HEIGHT)
-		y -= Data::OVERWORLD_HEIGHT;
-
-	return y;
-#endif
-}
-
 void OverworldLogic::impassable(int reason) {
 	writeString(Common::String::format("%s\n", IMPASSABLE_REASONS[reason]));
 	playFX(0);
@@ -228,22 +202,6 @@ void OverworldLogic::moveLeft() {
 		pt.x = Data::OVERWORLD_WIDTH - 1;
 		pt.y = (pt.y >= OVERWORLD_MID_Y) ? pt.y - OVERWORLD_MID_Y : pt.y + OVERWORLD_MID_Y;
 	}
-#if 0
-	// Shift the existing columns right by one, to make room for a new
-	// column of tiles at the left edge
-	auto &tiles = _G(map)._mapTilesId;
-	for (int col = Data::MAP_VISIBLE_WIDTH - 2; col >= 0; --col) {
-		for (int row = 0; row < Data::MAP_VISIBLE_HEIGHT; ++row)
-			tiles[row][col + 1] = tiles[row][col];
-	}
-
-	// Fill in the new left-hand column
-	for (int row = 0; row < Data::MAP_VISIBLE_HEIGHT; ++row) {
-		int x = getViewportX(0);
-		int y = getViewportY(row);
-		tiles[row][0] = _G(map).getMapTile(x, y);
-	}
-#endif
 }
 
 void OverworldLogic::moveRight() {
@@ -255,66 +213,18 @@ void OverworldLogic::moveRight() {
 		pt.y = (pt.y >= OVERWORLD_MID_Y) ? pt.y - OVERWORLD_MID_Y : pt.y + OVERWORLD_MID_Y;
 		pt.x = 0;
 	}
-#if 0
-	// Shift the existing columns left by one, to make room for a new
-	// column of tiles at the right edge
-	auto &tiles = _G(map)._mapTilesId;
-	for (int col = 1; col < Data::MAP_VISIBLE_WIDTH; ++col) {
-		for (int row = 0; row < Data::MAP_VISIBLE_HEIGHT; ++row)
-			tiles[row][col - 1] = tiles[row][col];
-	}
-
-	// Fill in the new right-hand column
-	for (int row = 0; row < Data::MAP_VISIBLE_HEIGHT; ++row) {
-		int x = getViewportX(Data::MAP_VISIBLE_WIDTH - 1);
-		int y = getViewportY(row);
-		tiles[row][Data::MAP_VISIBLE_WIDTH - 1] = _G(map).getMapTile(x, y);
-	}
-#endif
 }
 
 void OverworldLogic::moveUp() {
 	// Change overworld position
 	Common::Point &pt = _G(savegame)._overworldPos;
 	pt.y = (pt.y == 0) ? Data::OVERWORLD_HEIGHT - 1 : pt.y - 1;
-#if 0
-	// Shift the existing rows down by one, to make room for a new
-	// row of tiles at the top edge
-	auto &tiles = _G(map)._mapTilesId;
-	for (int row = Data::MAP_VISIBLE_HEIGHT - 2; row >= 0; --row) {
-		for (int col = 0; col < Data::MAP_VISIBLE_WIDTH; ++col)
-			tiles[row + 1][col] = tiles[row][col];
-	}
-
-	// Fill in the new top row
-	for (int col = 0; col < Data::MAP_VISIBLE_WIDTH; ++col) {
-		int x = getViewportX(col);
-		int y = getViewportY(0);
-		tiles[0][col] = _G(map).getMapTile(x, y);
-	}
-#endif
 }
 
 void OverworldLogic::moveDown() {
 	// Change overworld position
 	Common::Point &pt = _G(savegame)._overworldPos;
 	pt.y = (pt.y == Data::OVERWORLD_HEIGHT - 1) ? 0 : pt.y + 1;
-#if 0
-	// Shift the existing rows up by one, to make room for a new
-	// row of tiles at the bottom edge
-	auto &tiles = _G(map)._mapTilesId;
-	for (int row = 1; row < Data::MAP_VISIBLE_HEIGHT; ++row) {
-		for (int col = 0; col < Data::MAP_VISIBLE_WIDTH; ++col)
-			tiles[row - 1][col] = tiles[row][col];
-	}
-
-	// Fill in the new bottom row
-	for (int col = 0; col < Data::MAP_VISIBLE_WIDTH; ++col) {
-		int x = getViewportX(col);
-		int y = getViewportY(Data::MAP_VISIBLE_HEIGHT - 1);
-		tiles[Data::MAP_VISIBLE_HEIGHT - 1][col] = _G(map).getMapTile(x, y);
-	}
-#endif
 }
 
 void OverworldLogic::continentChanged(int oldContinent) {
diff --git a/engines/ultima/ultima1/logic/overworld_logic.h b/engines/ultima/ultima1/logic/overworld_logic.h
index 07d99eceb0b..0761f250721 100644
--- a/engines/ultima/ultima1/logic/overworld_logic.h
+++ b/engines/ultima/ultima1/logic/overworld_logic.h
@@ -91,11 +91,6 @@ private:
 	 */
 	void generateCreatures();
 
-	/**
-	 * Update overworld creatures
-	 */
-	void updateCreatures();
-
 	/**
 	 * Reduce the food the player has
 	 */
@@ -112,6 +107,10 @@ protected:
 	 */
 	bool move(Data::Direction dir) override;
 
+	/**
+	 * Handles updating creatures/NPCs
+	 */
+	void updateCreatures() override;
 
 public:
 	OverworldLogic();
diff --git a/engines/ultima/ultima1/logic/pillar_logic.h b/engines/ultima/ultima1/logic/pillar_logic.h
index 493eed89afd..132223dfe26 100644
--- a/engines/ultima/ultima1/logic/pillar_logic.h
+++ b/engines/ultima/ultima1/logic/pillar_logic.h
@@ -35,6 +35,12 @@ protected:
 		return true;
 	}
 
+	/**
+	 * Handles updating creatures/NPCs
+	 */
+	void updateCreatures() override {
+	}
+
 public:
 	PillarLogic();
 	~PillarLogic() override {


Commit: 9d499f36894116634875d823762818deac7eea6c
    https://github.com/scummvm/scummvm/commit/9d499f36894116634875d823762818deac7eea6c
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:40:49+11:00

Commit Message:
ULTIMA: ULTIMA1: City/castle/overworld creature movement dispatch

Changed paths:
    engines/ultima/ultima1/data/tiles.h
    engines/ultima/ultima1/logic/city_castle_logic.cpp
    engines/ultima/ultima1/logic/city_castle_logic.h
    engines/ultima/ultima1/logic/overworld_logic.cpp
    engines/ultima/ultima1/logic/overworld_logic.h


diff --git a/engines/ultima/ultima1/data/tiles.h b/engines/ultima/ultima1/data/tiles.h
index 13b8b823d5c..8ce73e55255 100644
--- a/engines/ultima/ultima1/data/tiles.h
+++ b/engines/ultima/ultima1/data/tiles.h
@@ -58,9 +58,12 @@ enum OverworldTileId {
 enum LocationTileId {
 	CTILE_WALL = 0,
 	CTILE_GROUND = 1,
+	CTILE_GUARD = 17,
 	CTILE_PLAYER = 18,
-	// Unnamed in the original - all three are "wishing well"-style tiles that
-	// dropPence/dropPenceCastle give a random bonus for dropping coins on
+	CTILE_BARD = 19,
+	CTILE_PRINCESS = 22,
+	CTILE_WENCH = 50,
+	// Wishing tiles for dropping coins on
 	CTILE_DROP1 = 51,
 	CTILE_DROP2 = 52,
 	CTILE_DROP3 = 53,
diff --git a/engines/ultima/ultima1/logic/city_castle_logic.cpp b/engines/ultima/ultima1/logic/city_castle_logic.cpp
index 638a7c11f9e..38ad3ed83df 100644
--- a/engines/ultima/ultima1/logic/city_castle_logic.cpp
+++ b/engines/ultima/ultima1/logic/city_castle_logic.cpp
@@ -162,7 +162,36 @@ bool CityCastleLogic::move(Data::Direction dir) {
 }
 
 void CityCastleLogic::updateCreatures() {
+	Common::Array<int> guardIndexes;
 
+	for (int i = 0; i < Data::LOCATION_ENTITY_COUNT; ++i) {
+		const auto &e = _G(savegame)._locationEntities[i];
+
+		switch (e._type) {
+		case Data::CTILE_BARD:
+			updateBardJester(i);
+			break;
+		case Data::CTILE_WENCH:
+			updateWench(i);
+			break;
+		case Data::CTILE_PRINCESS:
+			updatePrincess(i);
+			break;
+		case Data::CTILE_GUARD:
+			if (_G(savegame)._guardsHostile && !guardMove(i))
+				guardIndexes.push_back(i);
+			break;
+		default:
+			break;
+		}
+	}
+
+	// Handle guards' attacks
+	for (const int index : guardIndexes) {
+		guardAttack(index);
+		if (_G(savegame)._hits <= 0)
+			break;
+	}
 }
 
 bool CityCastleLogic::drop() {
@@ -332,15 +361,15 @@ int CityCastleLogic::checkAt(int x, int y) const {
 }
 
 void CityCastleLogic::updateBardJester(int entityIndex) {
-
+	// TODO
 }
 
 void CityCastleLogic::updateWench(int entityIndex) {
-
+	// TODO
 }
 
 void CityCastleLogic::updatePrincess(int entityIndex) {
-
+	// TODO
 }
 
 bool CityCastleLogic::guardMove(int entityIndex) {
@@ -348,6 +377,10 @@ bool CityCastleLogic::guardMove(int entityIndex) {
 	return false;
 }
 
+void CityCastleLogic::guardAttack(int entityIndex) {
+	// TODO
+}
+
 /*-------------------------------------------------------------------*/
 
 CityLogic::CityLogic() {
diff --git a/engines/ultima/ultima1/logic/city_castle_logic.h b/engines/ultima/ultima1/logic/city_castle_logic.h
index 2b331460133..df194037d82 100644
--- a/engines/ultima/ultima1/logic/city_castle_logic.h
+++ b/engines/ultima/ultima1/logic/city_castle_logic.h
@@ -56,6 +56,12 @@ private:
 	 */
 	bool guardMove(int entityIndex);
 
+	/**
+	 * Handles hostile guard attacks
+	 * 
+	 */
+	void guardAttack(int entityIndex);
+
 protected:
 	/**
 	 * Load the NPCs for the given location
diff --git a/engines/ultima/ultima1/logic/overworld_logic.cpp b/engines/ultima/ultima1/logic/overworld_logic.cpp
index de799f33ade..7124f4a124a 100644
--- a/engines/ultima/ultima1/logic/overworld_logic.cpp
+++ b/engines/ultima/ultima1/logic/overworld_logic.cpp
@@ -20,6 +20,7 @@
  *
  */
 
+#include "common/stack.h"
 #include "ultima/ultima1/logic/overworld_logic.h"
 #include "ultima/ultima1/core/strings.h"
 #include "ultima/ultima1/data/entity.h"
@@ -313,8 +314,7 @@ void OverworldLogic::generateCreatures() {
 }
 
 void OverworldLogic::updateCreatures() {
-	int attackIndexes[Data::CREATURES_COUNT];
-	int attackCount = 0;
+	Common::Stack<int> attackers;
 
 	for (int idx = 1; idx <= _G(overworldEntityCount); ++idx) {
 		auto &e = _G(savegame)._overworldEntities[idx];
@@ -322,30 +322,27 @@ void OverworldLogic::updateCreatures() {
 		if (e._type >= Data::TILE_FIRST_MONSTER && e._type <= Data::TILE_LAST_MONSTER) {
 			int xDiff = _G(savegame)._overworldPos.x - e._x;
 			int yDiff = _G(savegame)._overworldPos.y - e._y;
+			int distance = Data::OverworldEntity::getMonsterAttackDistance(e._type, xDiff, yDiff);
 
-			if (Data::OverworldEntity::getMonsterAttackDistance(e._type, xDiff, yDiff) != 0) {
-				if (attackCount < Data::CREATURES_COUNT)
-					attackIndexes[attackCount] = idx;
-				++attackCount;
+			if (distance != 0) {
+				if ((int)attackers.size() < Data::CREATURES_COUNT)
+					attackers.push(idx);
 			} else {
-				// TODO: monster movement (monsterMoveCheck, monsterMoveCheckX/Y, monsterTransportCheck)
+				monsterMoveCheck(idx, xDiff, yDiff);
 			}
 		}
 	}
 
-	while (attackCount > 0) {
-		--attackCount;
-		if (_G(savegame)._hits <= 0)
-			break;
+	while (!attackers.empty() && _G(savegame)._hits > 0) {
+		// Get the attacker index from the end of the 
+		int idx = attackers.pop();
 
-		int idx = attackIndexes[attackCount];
 		auto &e = _G(savegame)._overworldEntities[idx];
 		int xDiff = _G(savegame)._overworldPos.x - e._x;
 		int yDiff = _G(savegame)._overworldPos.y - e._y;
+		int distance = Data::OverworldEntity::getMonsterAttackDistance(e._type, xDiff, yDiff);
 
-		// TODO: monsterAttack(idx, xDiff, yDiff, getMonsterAttackDistance(e._type, xDiff, yDiff))
-		// - creature combat/damage resolution
-		warning("TODO: xDiff=%d, yDiff=%d", xDiff, yDiff);
+		monsterAttack(idx, xDiff, yDiff, distance);
 	}
 }
 
@@ -353,6 +350,14 @@ void OverworldLogic::reduceFood() {
 
 }
 
+void OverworldLogic::monsterMoveCheck(int entityIndex, int xDiff, int yDiff) {
+	// TODO
+}
+
+void OverworldLogic::monsterAttack(int entityIndex, int xDiff, int yDiff, int distance) {
+	// TODO
+}
+
 } // namespace Logic
 } // namespace Ultima1
 } // namespace Ultima
diff --git a/engines/ultima/ultima1/logic/overworld_logic.h b/engines/ultima/ultima1/logic/overworld_logic.h
index 0761f250721..83a208d4886 100644
--- a/engines/ultima/ultima1/logic/overworld_logic.h
+++ b/engines/ultima/ultima1/logic/overworld_logic.h
@@ -37,20 +37,6 @@ private:
 	 */
 	bool moveCheck(Data::Direction dir);
 
-	/**
-	 * Get the X co-ordinate for a tile within the map, offset from the left edge of the visible map area
-	 * @param xp	X offset within the window
-	 * @return		X-coordinate within the map
-	*/
-	int getViewportX(int xp) const;
-
-	/**
-	 * Get the Y co-ordinate for a tile within the map, offset from the top edge of the visible map area
-	 * @param yp	Y offset within the window
-	 * @return		Y-coordinate within the map
-	 */
-	int getViewportY(int yp) const;
-
 	/**
 	 * Impassable tile
 	 */
@@ -96,6 +82,10 @@ private:
 	 */
 	void reduceFood();
 
+	void monsterMoveCheck(int entityIndex, int xDiff, int yDiff);
+
+	void monsterAttack(int entityIndex, int xDiff, int yDiff, int distance);
+
 protected:
 	/**
 	 * Enter a location


Commit: b97f6c6734c828771f321756db2aa5430833aa9e
    https://github.com/scummvm/scummvm/commit/b97f6c6734c828771f321756db2aa5430833aa9e
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:40:49+11:00

Commit Message:
ULTIMA: ULTIMA1: City/overworld monster/npc updates

Changed paths:
    engines/ultima/ultima1/data/savegame.cpp
    engines/ultima/ultima1/data/savegame.h
    engines/ultima/ultima1/data/tiles.h
    engines/ultima/ultima1/logic/city_castle_logic.cpp
    engines/ultima/ultima1/logic/city_castle_logic.h
    engines/ultima/ultima1/logic/overworld_logic.cpp
    engines/ultima/ultima1/logic/overworld_logic.h


diff --git a/engines/ultima/ultima1/data/savegame.cpp b/engines/ultima/ultima1/data/savegame.cpp
index eb2842f3fd5..669ba59d5dc 100644
--- a/engines/ultima/ultima1/data/savegame.cpp
+++ b/engines/ultima/ultima1/data/savegame.cpp
@@ -51,6 +51,9 @@ const char *TRANSPORT_NAMES[] = {
 };
 const char *GEM_NAMES[] = { "Red Gem", "Green Gem", "Blue Gem", "White Gem" };
 
+// Indexed by TransportType
+const int TRANSPORT_RANDOM_THRESHOLD[] = { 100, 50, 33, 100, 50, 25, 10, 10 };
+
 void LocationEntity::synchronize(Common::Serializer &s) {
 	s.syncAsSint16LE(_type);
 	s.syncAsSint16LE(_position.x);
@@ -162,7 +165,7 @@ void Savegame::removeOverworldCreatureAt(int x, int y) {
 
 int Savegame::getLocationEntityAt(int x, int y) const {
 	int foundIndex = -1;
-	for (int startingIndex = 1; startingIndex < LOCATION_ENTITY_COUNT && foundIndex == -1; ++startingIndex) {
+	for (int startingIndex = 0; startingIndex < LOCATION_ENTITY_COUNT && foundIndex == -1; ++startingIndex) {
 		const auto &e = _locationEntities[startingIndex];
 		if (e._position.x == x && e._position.y == y)
 			foundIndex = startingIndex;
diff --git a/engines/ultima/ultima1/data/savegame.h b/engines/ultima/ultima1/data/savegame.h
index 7685ab02d51..ee2ef50ae7c 100644
--- a/engines/ultima/ultima1/data/savegame.h
+++ b/engines/ultima/ultima1/data/savegame.h
@@ -45,6 +45,11 @@ extern const char *SPELL_NAMES[];
 extern const char *TRANSPORT_NAMES[];
 extern const char *GEM_NAMES[];
 
+// Per player-transport-type chance (as a 1-100 threshold) for a pursuing
+// monster to get a chance to move/attack on a given turn - faster player
+// transports make it harder for monsters to keep up
+extern const int TRANSPORT_RANDOM_THRESHOLD[];
+
 enum Sex {
 	SEX_MALE = 0, SEX_FEMALE = 1
 };
diff --git a/engines/ultima/ultima1/data/tiles.h b/engines/ultima/ultima1/data/tiles.h
index 8ce73e55255..43ce65b7ece 100644
--- a/engines/ultima/ultima1/data/tiles.h
+++ b/engines/ultima/ultima1/data/tiles.h
@@ -41,6 +41,7 @@ enum OverworldTileId {
 	TILE_SIGNPOST = 6,
 	TILE_CITY1 = 7,
 	TILE_CITY2 = 8,
+	TILE_DUNGEON = 9,
 	TILE_PLAYER = 10,
 	TILE_HORSE = 11,
 	TILE_CART = 12,
diff --git a/engines/ultima/ultima1/logic/city_castle_logic.cpp b/engines/ultima/ultima1/logic/city_castle_logic.cpp
index 38ad3ed83df..1e5993f4224 100644
--- a/engines/ultima/ultima1/logic/city_castle_logic.cpp
+++ b/engines/ultima/ultima1/logic/city_castle_logic.cpp
@@ -350,7 +350,19 @@ void CityCastleLogic::loadEntities() {
 }
 
 int CityCastleLogic::checkAt(int x, int y) const {
-	int tile = _G(map).getTileAt(x, y);
+	if (x < 0 || x >= Data::CITY_WIDTH || y < 0 || y >= Data::CITY_HEIGHT)
+		return Data::CTILE_BLANK;
+
+	// The player or an NPC standing on the tile takes priority over
+	// whatever the map itself has there
+	if (x == _G(savegame)._locationPosition.x && y == _G(savegame)._locationPosition.y)
+		return Data::CTILE_PLAYER;
+
+	int idx = _G(savegame).getLocationEntityAt(x, y);
+	if (idx != -1)
+		return _G(savegame)._locationEntities[idx]._type;
+
+	int tile = _G(map).getMapTile(x, y);
 	if (tile == Data::CTILE_BLANK)
 		return tile;
 
@@ -360,25 +372,171 @@ int CityCastleLogic::checkAt(int x, int y) const {
 	return 0;
 }
 
+int CityCastleLogic::randomWanderDelta() {
+	int delta = getRandomNumber(1, 215) % 3;
+	return (delta == 2) ? -1 : delta;
+}
+
+bool CityCastleLogic::moveEntityBy(int entityIndex, int deltaX, int deltaY) {
+	auto &e = _G(savegame)._locationEntities[entityIndex];
+	int x = e._position.x + deltaX;
+	int y = e._position.y + deltaY;
+
+	int tile = checkAt(x, y);
+	if (tile != -1 && tile != Data::CTILE_BLANK)
+		return false;
+
+	e._position = Common::Point(x, y);
+	redrawMap();
+	return true;
+}
+
 void CityCastleLogic::updateBardJester(int entityIndex) {
-	// TODO
+	if (_G(savegame)._guardsHostile)
+		return;
+
+	auto &e = _G(savegame)._locationEntities[entityIndex];
+	int x = e._position.x + randomWanderDelta();
+	int y = e._position.y + randomWanderDelta();
+	int tile = checkAt(x, y);
+
+	bool stolen = false;
+	if (tile == -1) {
+		e._position = Common::Point(x, y);
+		redrawMap();
+		playFX(4);
+
+	} else if (tile == Data::CTILE_PLAYER) {
+		// Try to pickpocket a weapon that isn't currently readied
+		auto &sg = _G(savegame);
+		for (int idx = Data::WEAPON_COUNT - 1; idx >= 1 && !stolen; --idx) {
+			if (sg._weapons[idx] && idx != sg._equippedWeapon) {
+				--sg._weapons[idx];
+				stolen = true;
+			}
+		}
+
+		if (stolen && getRandomNumber(1, 255) < sg._agility + 128) {
+			writeString(_G(map)._mapType == Data::MAPTYPE_CITY ?
+				"Iolo stole something!\n" : "The jester stole something!\n");
+		}
+	}
+
+	if (!stolen && getRandomNumber(1, 255) < 15) {
+		if (_G(map)._mapType == Data::MAPTYPE_CITY) {
+			writeString("Iolo the Bard sings:\n");
+			writeString("Ho eyoh he hum!\n");
+		} else {
+			writeString("Gwino the jester sings:\n");
+			writeString("I've got the key!\n");
+		}
+	}
 }
 
 void CityCastleLogic::updateWench(int entityIndex) {
-	// TODO
+	if (_G(savegame)._guardsHostile)
+		return;
+
+	auto &e = _G(savegame)._locationEntities[entityIndex];
+	int x = e._position.x + randomWanderDelta();
+	int y = e._position.y + randomWanderDelta();
+
+	if (checkAt(x, y) == -1) {
+		e._position = Common::Point(x, y);
+		redrawMap();
+		playFX(4);
+	}
 }
 
 void CityCastleLogic::updatePrincess(int entityIndex) {
-	// TODO
+	if (!_G(savegame)._guardsHostile) {
+		// Not currently being chased, so she just wanders like a wench
+		updateWench(entityIndex);
+		return;
+	}
+
+	const auto &e = _G(savegame)._locationEntities[entityIndex];
+	const auto &pos = _G(savegame)._locationPosition;
+
+	int diffX = e._position.x - pos.x;
+	int deltaX = (diffX == 0) ? 0 : (diffX > 0 ? -1 : 1);
+	int diffY = e._position.y - pos.y;
+	int deltaY = (diffY == 0) ? 0 : (diffY > 0 ? -1 : 1);
+
+	// Randomly vary which axis is tried first
+	bool moved = false;
+	if (getRandomNumber(1, 100) < 50) {
+		if (deltaY != 0)
+			moved = moveEntityBy(entityIndex, 0, deltaY);
+		if (!moved && deltaX != 0)
+			moved = moveEntityBy(entityIndex, deltaX, 0);
+	} else {
+		if (deltaX != 0)
+			moved = moveEntityBy(entityIndex, deltaX, 0);
+		if (!moved && deltaY != 0)
+			moved = moveEntityBy(entityIndex, 0, deltaY);
+	}
+
+	if (moved)
+		playFX(4);
 }
 
 bool CityCastleLogic::guardMove(int entityIndex) {
-	// TODO
-	return false;
+	const auto &e = _G(savegame)._locationEntities[entityIndex];
+	const auto &pos = _G(savegame)._locationPosition;
+
+	int diffX = e._position.x - pos.x;
+	int diffY = e._position.y - pos.y;
+	int absDiffX = ABS(diffX);
+	int absDiffY = ABS(diffY);
+
+	// Already adjacent enough to attack instead, or too far away to bother
+	if (absDiffX < 2 && absDiffY < 2)
+		return false;
+	if (absDiffX + absDiffY >= 13)
+		return false;
+
+	int deltaX = (diffX == 0) ? 0 : (diffX > 0 ? -1 : 1);
+	int deltaY = (diffY == 0) ? 0 : (diffY > 0 ? -1 : 1);
+
+	bool moved = false;
+	if (deltaX != 0)
+		moved = moveEntityBy(entityIndex, deltaX, 0);
+	if (!moved && deltaY != 0)
+		moved = moveEntityBy(entityIndex, 0, deltaY);
+
+	if (moved)
+		playFX(4);
+
+	return moved;
 }
 
 void CityCastleLogic::guardAttack(int entityIndex) {
-	// TODO
+	const auto &e = _G(savegame)._locationEntities[entityIndex];
+	const auto &pos = _G(savegame)._locationPosition;
+
+	if (ABS(e._position.x - pos.x) >= 2 || ABS(e._position.y - pos.y) >= 2)
+		return;
+
+	writeString("Attacked by guard!\n");
+	playFX(7);
+
+	auto &sg = _G(savegame);
+	int roll = getRandomNumber(1, 255);
+	int threshold = sg._stamina / 2 + sg._equippedArmor * 8 + 56;
+
+	if (roll < threshold) {
+		writeString("Missed!\n");
+		return;
+	}
+
+	writeString("Hit!...");
+	int damage = getRandomNumber(2, sg._hits / 128 + 15);
+	writeString("%d damage!\n", damage);
+	playFX(2);
+
+	sg._hits -= damage;
+	redrawStats();
 }
 
 /*-------------------------------------------------------------------*/
diff --git a/engines/ultima/ultima1/logic/city_castle_logic.h b/engines/ultima/ultima1/logic/city_castle_logic.h
index df194037d82..7edf41b0729 100644
--- a/engines/ultima/ultima1/logic/city_castle_logic.h
+++ b/engines/ultima/ultima1/logic/city_castle_logic.h
@@ -58,10 +58,24 @@ private:
 
 	/**
 	 * Handles hostile guard attacks
-	 * 
+	 *
 	 */
 	void guardAttack(int entityIndex);
 
+	/**
+	 * Returns a random one-tile step delta (-1, 0, or 1), used by NPCs that
+	 * wander aimlessly (bards/jesters, wenches, and princesses when not
+	 * being pursued)
+	 */
+	int randomWanderDelta();
+
+	/**
+	 * Attempts to move an NPC by a given delta, checking first that the
+	 * destination isn't blocked by the map, the player, or another NPC.
+	 * Returns true if the move succeeded
+	 */
+	bool moveEntityBy(int entityIndex, int deltaX, int deltaY);
+
 protected:
 	/**
 	 * Load the NPCs for the given location
diff --git a/engines/ultima/ultima1/logic/overworld_logic.cpp b/engines/ultima/ultima1/logic/overworld_logic.cpp
index 7124f4a124a..c40a7d026a3 100644
--- a/engines/ultima/ultima1/logic/overworld_logic.cpp
+++ b/engines/ultima/ultima1/logic/overworld_logic.cpp
@@ -350,12 +350,105 @@ void OverworldLogic::reduceFood() {
 
 }
 
+bool OverworldLogic::monsterTransportCheck(int entityIndex, int xDiff, int yDiff) {
+	// Faster player transports make it harder for monsters to keep up - each
+	// movement attempt has a per-transport-type chance of being skipped
+	if (getRandomNumber(1, 100) > Data::TRANSPORT_RANDOM_THRESHOLD[_G(savegame)._transportType])
+		return false;
+
+	const auto &e = _G(savegame)._overworldEntities[entityIndex];
+	int tile1, tile2;
+	if (e._type >= Data::TILE_FIRST_MONSTER && e._type <= 25) {
+		// Sea monsters can only move onto water
+		tile1 = tile2 = Data::TILE_OCEAN;
+	} else if (e._type == 31 || e._type == 35) {
+		// These two monster types can only move onto woods
+		tile1 = tile2 = Data::TILE_WOODS;
+	} else {
+		// Everything else can move onto either woods or grass
+		tile1 = Data::TILE_WOODS;
+		tile2 = Data::TILE_GRASS;
+	}
+
+	int newX = _G(savegame)._overworldPos.x - xDiff;
+	int newY = _G(savegame)._overworldPos.y - yDiff;
+	int tile = _G(map).getTileAt(newX, newY);
+
+	// Single-terrain (amphibious) monster types are also allowed to move
+	// onto a city/castle/dungeon entrance tile, regardless of the mismatch
+	if (tile1 == tile2 && tile >= Data::TILE_CASTLE1 && tile <= Data::TILE_DUNGEON)
+		return true;
+
+	return (tile == tile1 || tile == tile2) &&
+		_G(map).mapRangeCheckX(newX) && _G(map).mapRangeCheckY(newY);
+}
+
+bool OverworldLogic::monsterMoveCheckX(int entityIndex, int xDiff, int yDiff) {
+	if (xDiff == 0)
+		return false;
+
+	int step = (xDiff > 0) ? -1 : 1;
+	if (!monsterTransportCheck(entityIndex, xDiff + step, yDiff))
+		return false;
+
+	_G(savegame)._overworldEntities[entityIndex]._x -= step;
+	return true;
+}
+
+bool OverworldLogic::monsterMoveCheckY(int entityIndex, int xDiff, int yDiff) {
+	if (yDiff == 0)
+		return false;
+
+	int step = (yDiff > 0) ? -1 : 1;
+	if (!monsterTransportCheck(entityIndex, xDiff, yDiff + step))
+		return false;
+
+	_G(savegame)._overworldEntities[entityIndex]._y -= step;
+	return true;
+}
+
 void OverworldLogic::monsterMoveCheck(int entityIndex, int xDiff, int yDiff) {
-	// TODO
+	// Randomly vary which axis is tried first, so pursuing monsters don't
+	// always prefer the same axis when moving diagonally
+	if (getRandomNumber(1, 10) & 1) {
+		if (!monsterMoveCheckY(entityIndex, xDiff, yDiff))
+			monsterMoveCheckX(entityIndex, xDiff, yDiff);
+	} else {
+		if (!monsterMoveCheckX(entityIndex, xDiff, yDiff))
+			monsterMoveCheckY(entityIndex, xDiff, yDiff);
+	}
 }
 
 void OverworldLogic::monsterAttack(int entityIndex, int xDiff, int yDiff, int distance) {
-	// TODO
+	// WORKAROUND: the original animates the attack as a projectile flying
+	// tile-by-tile towards the player, using up to distance tiles and
+	// stopping early if it's blocked by mountains. That's purely visual and
+	// doesn't affect whether the attack hits, so it's skipped here
+	const auto &e = _G(savegame)._overworldEntities[entityIndex];
+	int monsterIdx = (e._type - Data::TILE_FIRST_MONSTER) / 2;
+
+	writeString(Data::OVERWORLD_MONSTERS[monsterIdx]);
+	writeString(" attacks!");
+
+	auto &sg = _G(savegame);
+	int roll = getRandomNumber(1, 255);
+	int threshold = 200 - sg._stamina / 2 - sg._equippedArmor * 8;
+
+	if (roll >= threshold) {
+		writeString("\n");
+		writeString("Missed!\n");
+		return;
+	}
+
+	int damage = getRandomNumber(1, Data::OVERWORLD_MONSTERS_DAMAGE[monsterIdx] * 2 + 1);
+	playFX(2);
+
+	writeString("\n");
+	writeString("Hit! ");
+	writeString("%d damage\n", damage);
+
+	sg._hits -= damage;
+	redrawStats();
 }
 
 } // namespace Logic
diff --git a/engines/ultima/ultima1/logic/overworld_logic.h b/engines/ultima/ultima1/logic/overworld_logic.h
index 83a208d4886..ceaab9bea04 100644
--- a/engines/ultima/ultima1/logic/overworld_logic.h
+++ b/engines/ultima/ultima1/logic/overworld_logic.h
@@ -82,6 +82,27 @@ private:
 	 */
 	void reduceFood();
 
+	/**
+	 * Returns true if a monster is allowed to move onto the tile a given
+	 * offset away from the player, taking into account the terrain that
+	 * type of monster needs, and a per-player-transport-type chance for
+	 * the monster to get a turn at all (faster transports make it harder
+	 * for monsters to keep up)
+	 */
+	bool monsterTransportCheck(int entityIndex, int xDiff, int yDiff);
+
+	/**
+	 * Attempts to move a monster one step closer to the player along the
+	 * X axis. Returns true if it moved
+	 */
+	bool monsterMoveCheckX(int entityIndex, int xDiff, int yDiff);
+
+	/**
+	 * Attempts to move a monster one step closer to the player along the
+	 * Y axis. Returns true if it moved
+	 */
+	bool monsterMoveCheckY(int entityIndex, int xDiff, int yDiff);
+
 	void monsterMoveCheck(int entityIndex, int xDiff, int yDiff);
 
 	void monsterAttack(int entityIndex, int xDiff, int yDiff, int distance);


Commit: 8d96de5bd0d05526e5d5f04de8f7f0420ec9d7e0
    https://github.com/scummvm/scummvm/commit/8d96de5bd0d05526e5d5f04de8f7f0420ec9d7e0
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:40:49+11:00

Commit Message:
ULTIMA: ULTIMA1: Simplify logic destruction using Common::SharedPtr

Logic handlers can replace themselves when the map changes, and I
was previously doing some nasty logic to keep the old logic in
memory until it was completely finished.

Changed paths:
    engines/ultima/ultima1/data/map.cpp
    engines/ultima/ultima1/logic/logic.cpp
    engines/ultima/ultima1/ultima1.cpp
    engines/ultima/ultima1/ultima1.h
    engines/ultima/ultima1/views/create_character.cpp
    engines/ultima/ultima1/views/interactions/princess_saved.cpp


diff --git a/engines/ultima/ultima1/data/map.cpp b/engines/ultima/ultima1/data/map.cpp
index 65aaf4a5616..edf3c3ad705 100644
--- a/engines/ultima/ultima1/data/map.cpp
+++ b/engines/ultima/ultima1/data/map.cpp
@@ -156,18 +156,18 @@ void Map::load(int mapNum) {
 	// Set up logic handler for the mode and which view it'll be using
 	Common::String viewName;
 	if (mapNum >= 49) {
-		_G(logic) = new Logic::DungeonLogic();
+		_G(logic) = Common::SharedPtr<Logic::Logic>(new Logic::DungeonLogic());
 		viewName = "DungeonMap";
 	} else if (mapNum == MAP_OVERWORLD) {
-		_G(logic) = new Logic::OverworldLogic();
+		_G(logic) = Common::SharedPtr<Logic::Logic>(new Logic::OverworldLogic());
 		viewName = "OverworldMap";
 	} else {
 		if (mapNum < 33)
-			_G(logic) = new Logic::CityLogic();
+			_G(logic) = Common::SharedPtr<Logic::Logic>(new Logic::CityLogic());
 		else if (mapNum < 41)
-			_G(logic) = new Logic::CastleLogic();
+			_G(logic) = Common::SharedPtr<Logic::Logic>(new Logic::CastleLogic());
 		else
-			_G(logic) = new Logic::PillarLogic();
+			_G(logic) = Common::SharedPtr<Logic::Logic>(new Logic::PillarLogic());
 
 		viewName = "LocationMap";
 	}
diff --git a/engines/ultima/ultima1/logic/logic.cpp b/engines/ultima/ultima1/logic/logic.cpp
index f256f1f9f5c..63c9feea847 100644
--- a/engines/ultima/ultima1/logic/logic.cpp
+++ b/engines/ultima/ultima1/logic/logic.cpp
@@ -75,15 +75,10 @@ void Logic::endOfTurn() {
 
 	redrawMap();
 	redrawStats();
-	prompt();
-
-	// If this logic is no longer the active one, such as from switching maps,
-	// then delete it
-	if (this != _G(logic))
-		delete this;
 }
 
 void Logic::action(int action) {
+	Common::SharedPtr<Logic> currLogic = _G(logic);
 	bool doEndOfTurn = true;
 
 	switch (action) {
@@ -149,8 +144,15 @@ void Logic::action(int action) {
 		break;
 	}
 
-	if (doEndOfTurn)
-		endOfTurn();
+	// End of turn handling
+	if (doEndOfTurn) {
+		// Only do end of turn stuff like creature movement and food reduction if we're
+		// still in the same map we started on
+		if (_G(logic) == currLogic)
+			endOfTurn();
+
+		prompt();
+	}
 }
 
 void Logic::keypress(Common::KeyCode keycode) {
diff --git a/engines/ultima/ultima1/ultima1.cpp b/engines/ultima/ultima1/ultima1.cpp
index aa1b237b40b..288bb4765c3 100644
--- a/engines/ultima/ultima1/ultima1.cpp
+++ b/engines/ultima/ultima1/ultima1.cpp
@@ -77,8 +77,6 @@ Common::Error Ultima1Engine::syncGame(Common::Serializer &s) {
 	_savegame.synchronize(s);
 
 	if (s.isLoading()) {
-		delete _G(logic);
-		_G(logic) = nullptr;
 		_G(map).load(_G(savegame)._mapNum);
 	}
 
diff --git a/engines/ultima/ultima1/ultima1.h b/engines/ultima/ultima1/ultima1.h
index bf83843a954..2b168e916c6 100644
--- a/engines/ultima/ultima1/ultima1.h
+++ b/engines/ultima/ultima1/ultima1.h
@@ -27,6 +27,7 @@
 #include "common/error.h"
 #include "common/fs.h"
 #include "common/hash-str.h"
+#include "common/ptr.h"
 #include "common/random.h"
 #include "common/serializer.h"
 #include "common/util.h"
@@ -64,7 +65,7 @@ protected:
 public:
 	Data::Map _map;
 	Data::Savegame _savegame;
-	Logic::Logic *_logic = nullptr;
+	Common::SharedPtr<Logic::Logic> _logic;
 	int _overworldEntityCount = 0;
 	int _creaturesCount = 0;
 	uint32 _moveCtr = 0;
diff --git a/engines/ultima/ultima1/views/create_character.cpp b/engines/ultima/ultima1/views/create_character.cpp
index 02f44de3158..a846967e242 100644
--- a/engines/ultima/ultima1/views/create_character.cpp
+++ b/engines/ultima/ultima1/views/create_character.cpp
@@ -410,9 +410,6 @@ void CreateCharacter::confirmAndSave() {
 	_cursor.hide();
 
 	// Load the overworld map
-	delete _G(logic);
-	_G(logic) = nullptr;
-
 	_G(map).load(MAP_OVERWORLD);
 }
 
diff --git a/engines/ultima/ultima1/views/interactions/princess_saved.cpp b/engines/ultima/ultima1/views/interactions/princess_saved.cpp
index 0827c68bbbe..9e31ab46c1b 100644
--- a/engines/ultima/ultima1/views/interactions/princess_saved.cpp
+++ b/engines/ultima/ultima1/views/interactions/princess_saved.cpp
@@ -107,9 +107,7 @@ void PrincessSaved::spawnTimeMachine() {
 }
 
 void PrincessSaved::finish() {
-	// Clear out the Castle logic handler and load the overworld map
-	delete _G(logic);
-	_G(logic) = nullptr;
+	// Switch back to the overworld map
 	_G(map).load(Data::MAP_OVERWORLD);
 }
 


Commit: b6b1c84656d905776580ce065aaf9c83c036c2fb
    https://github.com/scummvm/scummvm/commit/b6b1c84656d905776580ce065aaf9c83c036c2fb
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:40:49+11:00

Commit Message:
ULTIMA: ULTIMA1: Dungeon level generation

Changed paths:
  A engines/ultima/ultima1/data/map_dungeon.cpp
  A engines/ultima/ultima1/data/map_dungeon.h
  A engines/ultima/ultima1/views/dungeon_map.cpp
  A engines/ultima/ultima1/views/dungeon_map.h
    engines/ultima/module.mk
    engines/ultima/ultima1/data/map.cpp
    engines/ultima/ultima1/data/map.h
    engines/ultima/ultima1/data/savegame.h
    engines/ultima/ultima1/logic/dungeon_logic.cpp
    engines/ultima/ultima1/logic/dungeon_logic.h
    engines/ultima/ultima1/views/views.h


diff --git a/engines/ultima/module.mk b/engines/ultima/module.mk
index fbe1d972e5a..2509b91d0a0 100644
--- a/engines/ultima/module.mk
+++ b/engines/ultima/module.mk
@@ -55,6 +55,7 @@ MODULE_OBJS += \
 	ultima1/core/strings.o \
 	ultima1/data/entity.o \
 	ultima1/data/map.o \
+	ultima1/data/map_dungeon.o \
 	ultima1/data/savegame.o \
 	ultima1/data/tiles.o \
 	ultima1/gfx/pic_decoder.o \
@@ -76,6 +77,7 @@ MODULE_OBJS += \
 	ultima1/views/commands.o \
 	ultima1/views/create_character.o \
 	ultima1/views/dialog.o \
+	ultima1/views/dungeon_map.o \
 	ultima1/views/full_screen_dialog.o \
 	ultima1/views/game.o \
 	ultima1/views/location_map.o \
diff --git a/engines/ultima/ultima1/data/map.cpp b/engines/ultima/ultima1/data/map.cpp
index edf3c3ad705..246dbe77dee 100644
--- a/engines/ultima/ultima1/data/map.cpp
+++ b/engines/ultima/ultima1/data/map.cpp
@@ -174,15 +174,27 @@ void Map::load(int mapNum) {
 
 	// Set up the map row pointers
 	_mapRows.clear();
-	if (_currentMap == MAP_OVERWORLD) {
+	switch (_mapType) {
+	case MAPTYPE_OVERWORLD:
 		_mapRows.reserve(OVERWORLD_HEIGHT);
 		for (int y = 0; y < OVERWORLD_HEIGHT; ++y)
 			_mapRows.push_back(Row(this, &_overworldMap[y * OVERWORLD_WIDTH]));
-	} else {
+		break;
+
+	case MAPTYPE_DUNGEON:
+		generateDungeonLevel();
+
+		_mapRows.reserve(DUNGEON_HEIGHT);
+		for (int y = 0; y < DUNGEON_HEIGHT; ++y)
+			_mapRows.push_back(Row(this, &_dungeonTiles[y][0]));
+		break;
+
+	default:
 		_mapRows.reserve(CITY_HEIGHT + 1);		// One extra row for out-of-bounds y access
 		for (int y = 0; y < CITY_HEIGHT; ++y)
 			_mapRows.push_back(Row(this, &_cityMap[_mapStyle][y * CITY_WIDTH]));
 		_mapRows.push_back(Row(this, nullptr));
+		break;
 	}
 
 	// If the focused view isn't already a dialog under the game frame, then reset to the game
diff --git a/engines/ultima/ultima1/data/map.h b/engines/ultima/ultima1/data/map.h
index addc23ff6e3..9ed5cf32987 100644
--- a/engines/ultima/ultima1/data/map.h
+++ b/engines/ultima/ultima1/data/map.h
@@ -26,6 +26,7 @@
 #include "common/rect.h"
 #include "graphics/managed_surface.h"
 #include "ultima/ultima1/data/tiles.h"
+#include "ultima/ultima1/data/map_dungeon.h"
 
 namespace Ultima {
 namespace Ultima1 {
@@ -67,7 +68,7 @@ extern const char *DIRECTION_NAMES[5];
 extern const char *LOCATION_NAMES[LOCATION_COUNT];
 extern const char *CONTINENT_NAMES[4];
 
-struct Map {
+struct Map : public MapDungeon {
 private:
 	Common::Array<byte> _overworldMap;		// Cached overworld map data
 	Common::Array<byte> _cityMap[10];		// Cached city/castle/town maps
@@ -109,6 +110,11 @@ private:
 	Graphics::ManagedSurface _overworldTiles[OVERWORLD_TILES_COUNT];
 	Graphics::ManagedSurface _cityTiles[CITY_TILES_COUNT];
 
+	/**
+	 * Used to generate the dungeon.
+	 */
+	void loadDungeonMap();
+
 public:
 	int _currentMap = -1;
 	byte _playerTileId = 0;
diff --git a/engines/ultima/ultima1/data/map_dungeon.cpp b/engines/ultima/ultima1/data/map_dungeon.cpp
new file mode 100644
index 00000000000..49708cd04c0
--- /dev/null
+++ b/engines/ultima/ultima1/data/map_dungeon.cpp
@@ -0,0 +1,187 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "ultima/ultima1/data/map_dungeon.h"
+#include "ultima/ultima1/ultima1.h"
+
+namespace Ultima {
+namespace Ultima1 {
+namespace Data {
+
+MapDungeon::MapDungeon() {
+	clear();
+}
+
+void MapDungeon::clear() {
+	Common::fill(&_dungeonTiles[0][0], &_dungeonTiles[0][0] + DUNGEON_WIDTH * DUNGEON_HEIGHT, 0);
+	for (auto &y : _cells) {
+		for (auto &x : y) {
+			x._itemId = DITEM_NONE;
+			// Unlike _itemId, 0 is a real monster Id, so "no monster" needs
+			// its own sentinel value
+			x._monsterId = DUNGEON_NO_MONSTER;
+			x._monsterHp = 0;
+		}
+	}
+}
+
+void MapDungeon::setRandomSeed() {
+	_randomSeed = _G(savegame)._randomSeed + _G(savegame)._overworldPos.x * 5 +
+		_G(savegame)._overworldPos.y * 3 + _G(savegame)._dungeonLevel * 17;
+}
+
+byte MapDungeon::getRandomNumber(int minVal, int maxVal) {
+	// Rotate the seed right by 3 bits after adding a fixed value
+	uint16 low3 = _randomSeed & 7;
+	_randomSeed = (uint16)(_randomSeed >> 3) | (uint16)(low3 << 13);
+
+	int clampedMax = (maxVal > 255) ? 255 : maxVal;
+	int range = clampedMax - minVal;
+	int result = _randomSeed & 0x3ff;
+	while (result > range)
+		result -= range;
+
+	return (byte)(result + minVal);
+}
+
+void MapDungeon::generateDungeonLevel() {
+	setRandomSeed();
+	clear();
+
+	int dungeonLevel = _G(savegame)._dungeonLevel;
+
+	// Outer border walls
+	for (int i = 0; i < DUNGEON_WIDTH; ++i) {
+		_dungeonTiles[0][i] = DTILE_WALL;
+		_dungeonTiles[DUNGEON_HEIGHT - 1][i] = DTILE_WALL;
+		_dungeonTiles[i][0] = DTILE_WALL;
+		_dungeonTiles[i][DUNGEON_WIDTH - 1] = DTILE_WALL;
+	}
+
+	// Randomize the tiles at the grid intersections that divide the level
+	// into a rough 4x4 arrangement of rooms
+	for (int x = 2; x <= 8; x += 2) {
+		for (int y = 1; y <= 9; ++y)
+			_dungeonTiles[y][x] = getRandomNumber(1, 4) - 1;
+	}
+
+	// Scatter some extra walls/support beams around the level, at one of
+	// 16 predefined spots (mirrored across the diagonal on even levels, so
+	// odd/even levels don't look identical)
+	static const int DUNGEON_DATA1[16] = { 4, 8, 5, 2, 8, 1, 5, 4, 6, 1, 3, 7, 3, 9, 2, 6 };
+	static const int DUNGEON_DATA2[16] = { 1, 1, 2, 3, 3, 4, 4, 5, 5, 6, 6, 6, 8, 8, 9, 9 };
+
+	int decorCount = dungeonLevel * 2;
+	for (int i = 0; i <= decorCount; ++i) {
+		int newTile = (getRandomNumber(1, 255) > 160) ? DTILE_BEAMS : DTILE_WALL;
+		int idx = getRandomNumber(1, 16) - 1;
+
+		if (dungeonLevel & 1)
+			_dungeonTiles[DUNGEON_DATA2[idx]][DUNGEON_DATA1[idx]] = newTile;
+		else
+			_dungeonTiles[DUNGEON_DATA1[idx]][DUNGEON_DATA2[idx]] = newTile;
+	}
+
+	// Re-seed partway through, so item placement below doesn't correlate
+	// too closely with the maze layout generated above
+	_randomSeed += 1777;
+
+	// Scatter chests/coffins onto floor cells
+	int itemCount = dungeonLevel;
+	for (int i = 0; i <= itemCount; ++i) {
+		int newItem = DTILE_CHEST + (getRandomNumber(1, 100) & 1);
+		int x = getRandomNumber(10, 99) / 10;
+		int y = getRandomNumber(10, 99) / 10;
+
+		int tile = _dungeonTiles[y][x];
+		if (tile != DTILE_WALL && tile != DTILE_SECRET_DOOR && tile != DTILE_BEAMS)
+			_cells[y][x]._itemId = newItem;
+	}
+
+	// Place the ladders connecting to the levels above/below, alternating
+	// which of the two fixed spots is up/down between odd/even levels
+	_dungeonTiles[2][1] = DTILE_HALLWAY;
+	if (dungeonLevel & 1) {
+		_dungeonTiles[3][7] = DTILE_LADDER_UP;
+		_dungeonTiles[7][3] = DTILE_LADDER_DOWN;
+	} else {
+		_dungeonTiles[3][7] = DTILE_LADDER_DOWN;
+		_dungeonTiles[7][3] = DTILE_LADDER_UP;
+	}
+
+	if (dungeonLevel == DUNGEON_FLOORS)
+		// No level below the deepest one
+		_dungeonTiles[3][7] = DTILE_HALLWAY;
+
+	if (dungeonLevel == 1) {
+		// The topmost level connects back to the overworld instead, via a
+		// separate fixed spot
+		_dungeonTiles[1][1] = DTILE_LADDER_UP;
+		_dungeonTiles[3][7] = DTILE_HALLWAY;
+	}
+
+	// Spawn 3 of the level's 5 possible monster slots
+	for (int i = 0; i < DUNGEON_MONSTER_SLOTS; ++i)
+		_monsterSlotUsed[i] = false;
+
+	dungeonSpawnMonster();
+	dungeonSpawnMonster();
+	dungeonSpawnMonster();
+}
+
+void MapDungeon::dungeonSpawnMonster() {
+	int x = 0, y = 0;
+	bool valid = false;
+
+	for (int attempt = 0; attempt <= 500 && !valid; ++attempt) {
+		x = getRandomNumber(0, 242) % 9 + 1;
+		y = getRandomNumber(0, 242) % 9 + 1;
+
+		valid = _cells[y][x]._monsterId == DUNGEON_NO_MONSTER &&
+			_dungeonTiles[y][x] != DTILE_WALL && _dungeonTiles[y][x] != DTILE_SECRET_DOOR &&
+			_dungeonTiles[y][x] != DTILE_BEAMS && _cells[y][x]._itemId != DITEM_CHEST;
+	}
+
+	if (!valid)
+		return;
+
+	// Never spawn directly on top of the player
+	if (Common::Point(x, y) == _G(savegame)._locationPosition)
+		return;
+
+	// Find one of the 5 monster slots that hasn't been used yet this
+	// generation
+	int slot;
+	do {
+		slot = getRandomNumber(0, 49) / 10;
+	} while (_monsterSlotUsed[slot]);
+	_monsterSlotUsed[slot] = true;
+
+	int dungeonLevel = _G(savegame)._dungeonLevel;
+	int monsterId = (dungeonLevel - 1) / 2 * DUNGEON_MONSTER_SLOTS + slot;
+
+	_cells[y][x]._monsterId = monsterId;
+	_cells[y][x]._monsterHp = getRandomNumber(1, dungeonLevel * dungeonLevel + 1) + 10 + monsterId;
+}
+
+} // namespace Data
+} // namespace Ultima1
+} // namespace Ultima
diff --git a/engines/ultima/ultima1/data/map_dungeon.h b/engines/ultima/ultima1/data/map_dungeon.h
new file mode 100644
index 00000000000..369d6a2bd01
--- /dev/null
+++ b/engines/ultima/ultima1/data/map_dungeon.h
@@ -0,0 +1,116 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef ULTIMA1_DATA_MAP_DUNGEON_H
+#define ULTIMA1_DATA_MAP_DUNGEON_H
+
+#include "common/scummsys.h"
+
+namespace Ultima {
+namespace Ultima1 {
+namespace Data {
+
+constexpr int DUNGEON_WIDTH = 11;
+constexpr int DUNGEON_HEIGHT = 11;
+constexpr int DUNGEON_FLOORS = 10;
+// Number of distinct monster "slots" filled in when a level is generated
+constexpr int DUNGEON_MONSTER_SLOTS = 5;
+
+// No monster is present in a cell. Real monster Ids are 0-24 (5 tiers of
+// 5 types, tier = (dungeonLevel - 1) / 2), so this can't use 0 like the
+// _itemId sentinel does
+constexpr uint8 DUNGEON_NO_MONSTER = 0xff;
+
+enum DungeonTileId {
+	DTILE_HALLWAY = 0,
+	DTILE_WALL = 1,
+	DTILE_SECRET_DOOR = 2,
+	DTILE_DOOR = 3,
+	DTILE_CHEST = 4,
+	DTILE_COFFIN = 5,
+	DTILE_LADDER_DOWN = 6,
+	DTILE_LADDER_UP = 7,
+	DTILE_BEAMS = 8
+};
+
+// Values of DungeonCell::_itemId. Shares numbering with DungeonTileId's
+// chest/coffin, since the original stores the same tile Id in both places
+enum DungeonItemId {
+	DITEM_NONE = 0,
+	DITEM_CHEST = DTILE_CHEST,
+	DITEM_COFFIN = DTILE_COFFIN
+};
+
+struct DungeonCell {
+	uint8 _monsterId;
+	uint8 _itemId;
+	uint16 _monsterHp;
+};
+
+struct MapDungeon {
+private:
+	DungeonCell _cells[DUNGEON_HEIGHT][DUNGEON_WIDTH];
+	uint16 _randomSeed = 0;
+	// Tracks which of the 5 monster slots have already been filled while
+	// generating the current level
+	bool _monsterSlotUsed[DUNGEON_MONSTER_SLOTS] = {};
+
+	/**
+	 * Clear the dungeon content
+	 */
+	void clear();
+
+	/**
+	 * Sets the random seed used for generating the dungeon level layout
+	 */
+	void setRandomSeed();
+
+	/**
+	 * Gets a random number in the inclusive min/max range, using the same
+	 * manually seeded algorithm as the original game, so the dungeon
+	 * layouts will match
+	 */
+	byte getRandomNumber(int minVal, int maxVal);
+
+	/**
+	 * Picks a random unoccupied cell and, provided it isn't where the
+	 * player is standing, spawns a new monster there appropriate for the
+	 * current dungeon level
+	 */
+	void dungeonSpawnMonster();
+
+protected:
+	byte _dungeonTiles[DUNGEON_HEIGHT][DUNGEON_WIDTH];
+
+	/**
+	 * Loads a dungeon level
+	 */
+	void generateDungeonLevel();
+
+public:
+	MapDungeon();
+};
+
+} // namespace Data
+} // namespace Ultima1
+} // namespace Ultima
+
+#endif
diff --git a/engines/ultima/ultima1/data/savegame.h b/engines/ultima/ultima1/data/savegame.h
index ee2ef50ae7c..e8c9d0d7072 100644
--- a/engines/ultima/ultima1/data/savegame.h
+++ b/engines/ultima/ultima1/data/savegame.h
@@ -183,6 +183,9 @@ public:
 	int16 _freeingPrincess = 0;
 	int16 _castleItemAllowance = 0;
 	int16 _castleKeyVal = 0;
+	uint8 _dungeonLevel = 0;
+	uint8 _dungeonDirection = 4;
+	uint16 _dungeonExitHitPoints = 0;
 
 	/**
 	 * Synchronize savegame data
diff --git a/engines/ultima/ultima1/logic/dungeon_logic.cpp b/engines/ultima/ultima1/logic/dungeon_logic.cpp
index f28cbf05fff..851c1931046 100644
--- a/engines/ultima/ultima1/logic/dungeon_logic.cpp
+++ b/engines/ultima/ultima1/logic/dungeon_logic.cpp
@@ -28,8 +28,15 @@ namespace Ultima {
 namespace Ultima1 {
 namespace Logic {
 
+DungeonLogic::DungeonLogic() {
+	_G(map)._mapType = Data::MAPTYPE_DUNGEON;
+}
+
 void DungeonLogic::entering() {
-	// TODO
+	_G(savegame)._locationPosition = Common::Point(1, 1);
+	_G(savegame)._dungeonLevel = 1;
+	_G(savegame)._dungeonDirection = 4;
+	_G(savegame)._dungeonExitHitPoints = 0;
 }
 
 bool DungeonLogic::move(Data::Direction dir) {
diff --git a/engines/ultima/ultima1/logic/dungeon_logic.h b/engines/ultima/ultima1/logic/dungeon_logic.h
index 06bfb8a8429..86daec8f752 100644
--- a/engines/ultima/ultima1/logic/dungeon_logic.h
+++ b/engines/ultima/ultima1/logic/dungeon_logic.h
@@ -42,6 +42,7 @@ protected:
 	void updateCreatures() override;
 
 public:
+	DungeonLogic();
 	~DungeonLogic() override {
 	}
 
diff --git a/engines/ultima/ultima1/views/dungeon_map.cpp b/engines/ultima/ultima1/views/dungeon_map.cpp
new file mode 100644
index 00000000000..e8347b2135b
--- /dev/null
+++ b/engines/ultima/ultima1/views/dungeon_map.cpp
@@ -0,0 +1,52 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "ultima/ultima1/views/dungeon_map.h"
+#include "ultima/ultima1/ultima1.h"
+#include "ultima/ultima1/metaengine.h"
+
+namespace Ultima {
+namespace Ultima1 {
+namespace Views {
+
+bool DungeonMap::msgFocus(const FocusMessage &msg) {
+	MetaEngine::setKeybindingMode(KBMODE_GAMEPLAY);
+	return Dialog::msgFocus(msg);
+}
+
+bool DungeonMap::msgUnfocus(const UnfocusMessage &msg) {
+	MetaEngine::setKeybindingMode(KBMODE_MINIMAL);
+	return Dialog::msgUnfocus(msg);
+}
+
+void DungeonMap::draw() {
+	Dialog::draw();
+	auto s = getSurface();
+
+	// Write title showing the dungeon level
+	s.writeString(Point(15, 0), "\x10 Level %2d \x11", _G(savegame)._dungeonLevel);
+
+	// TODO: Dungeon view rendering
+}
+
+} // namespace Views
+} // namespace Ultima1
+} // namespace Ultima
diff --git a/engines/ultima/ultima1/views/dungeon_map.h b/engines/ultima/ultima1/views/dungeon_map.h
new file mode 100644
index 00000000000..935476965ee
--- /dev/null
+++ b/engines/ultima/ultima1/views/dungeon_map.h
@@ -0,0 +1,48 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef ULTIMA1_VIEWS_DUNGEON_MAP_H
+#define ULTIMA1_VIEWS_DUNGEON_MAP_H
+
+#include "ultima/ultima1/views/dialog.h"
+#include "ultima/ultima1/data/map.h"
+
+namespace Ultima {
+namespace Ultima1 {
+namespace Views {
+
+using namespace Shared::Messages;
+
+class DungeonMap : public Dialog {
+public:
+	DungeonMap() : Dialog("DungeonMap") {}
+	~DungeonMap() override {}
+
+	bool msgFocus(const FocusMessage &msg) override;
+	bool msgUnfocus(const UnfocusMessage &msg) override;
+	void draw() override;
+};
+
+} // namespace Views
+} // namespace Ultima1
+} // namespace Ultima
+
+#endif
diff --git a/engines/ultima/ultima1/views/views.h b/engines/ultima/ultima1/views/views.h
index 3937400a163..f68326394ce 100644
--- a/engines/ultima/ultima1/views/views.h
+++ b/engines/ultima/ultima1/views/views.h
@@ -30,6 +30,7 @@
 #include "ultima/ultima1/views/interactions/princess_saved.h"
 #include "ultima/ultima1/views/interactions/ready.h"
 #include "ultima/ultima1/views/create_character.h"
+#include "ultima/ultima1/views/dungeon_map.h"
 #include "ultima/ultima1/views/game.h"
 #include "ultima/ultima1/views/location_map.h"
 #include "ultima/ultima1/views/main_menu.h"
@@ -50,6 +51,7 @@ struct Views : public Shared::Views {
 	Interactions::PrincessSaved _princessSaved;
 	Interactions::Ready _ready;
 	CreateCharacter _createCharacter;
+	DungeonMap _dungeonMap;
 	Game _game;
 	LocationMap _locationMap;
 	MainMenu _mainMenu;


Commit: 908699bfc3f16efe2e260b00ebde0ad5ee2fd22c
    https://github.com/scummvm/scummvm/commit/908699bfc3f16efe2e260b00ebde0ad5ee2fd22c
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:40:49+11:00

Commit Message:
ULTIMA: ULTIMA1: Map Data::MapDungeon an engine global

I was hoping to fold into the existing Data::Map class,
but the two data formats are just too different

Changed paths:
    engines/ultima/ultima1/data/map.cpp
    engines/ultima/ultima1/data/map.h
    engines/ultima/ultima1/data/map_dungeon.cpp
    engines/ultima/ultima1/data/map_dungeon.h
    engines/ultima/ultima1/data/savegame.cpp
    engines/ultima/ultima1/ultima1.h


diff --git a/engines/ultima/ultima1/data/map.cpp b/engines/ultima/ultima1/data/map.cpp
index 246dbe77dee..cd5f745adf5 100644
--- a/engines/ultima/ultima1/data/map.cpp
+++ b/engines/ultima/ultima1/data/map.cpp
@@ -21,6 +21,7 @@
 
 #include "common/file.h"
 #include "ultima/ultima1/data/map.h"
+#include "ultima/ultima1/data/map_dungeon.h"
 #include "ultima/ultima1/data/tiles.h"
 #include "ultima/ultima1/logic/city_castle_logic.h"
 #include "ultima/ultima1/logic/dungeon_logic.h"
@@ -182,11 +183,8 @@ void Map::load(int mapNum) {
 		break;
 
 	case MAPTYPE_DUNGEON:
-		generateDungeonLevel();
-
-		_mapRows.reserve(DUNGEON_HEIGHT);
-		for (int y = 0; y < DUNGEON_HEIGHT; ++y)
-			_mapRows.push_back(Row(this, &_dungeonTiles[y][0]));
+		_G(dungeon).generateDungeonLevel();
+		_mapRows.clear();		// Dungeon doesn't use this map
 		break;
 
 	default:
diff --git a/engines/ultima/ultima1/data/map.h b/engines/ultima/ultima1/data/map.h
index 9ed5cf32987..fa2473987bb 100644
--- a/engines/ultima/ultima1/data/map.h
+++ b/engines/ultima/ultima1/data/map.h
@@ -26,7 +26,6 @@
 #include "common/rect.h"
 #include "graphics/managed_surface.h"
 #include "ultima/ultima1/data/tiles.h"
-#include "ultima/ultima1/data/map_dungeon.h"
 
 namespace Ultima {
 namespace Ultima1 {
@@ -68,7 +67,7 @@ extern const char *DIRECTION_NAMES[5];
 extern const char *LOCATION_NAMES[LOCATION_COUNT];
 extern const char *CONTINENT_NAMES[4];
 
-struct Map : public MapDungeon {
+struct Map {
 private:
 	Common::Array<byte> _overworldMap;		// Cached overworld map data
 	Common::Array<byte> _cityMap[10];		// Cached city/castle/town maps
diff --git a/engines/ultima/ultima1/data/map_dungeon.cpp b/engines/ultima/ultima1/data/map_dungeon.cpp
index 49708cd04c0..7f4b11f7d5d 100644
--- a/engines/ultima/ultima1/data/map_dungeon.cpp
+++ b/engines/ultima/ultima1/data/map_dungeon.cpp
@@ -31,12 +31,10 @@ MapDungeon::MapDungeon() {
 }
 
 void MapDungeon::clear() {
-	Common::fill(&_dungeonTiles[0][0], &_dungeonTiles[0][0] + DUNGEON_WIDTH * DUNGEON_HEIGHT, 0);
 	for (auto &y : _cells) {
 		for (auto &x : y) {
+			x._tileNum = DTILE_HALLWAY;
 			x._itemId = DITEM_NONE;
-			// Unlike _itemId, 0 is a real monster Id, so "no monster" needs
-			// its own sentinel value
 			x._monsterId = DUNGEON_NO_MONSTER;
 			x._monsterHp = 0;
 		}
@@ -70,17 +68,17 @@ void MapDungeon::generateDungeonLevel() {
 
 	// Outer border walls
 	for (int i = 0; i < DUNGEON_WIDTH; ++i) {
-		_dungeonTiles[0][i] = DTILE_WALL;
-		_dungeonTiles[DUNGEON_HEIGHT - 1][i] = DTILE_WALL;
-		_dungeonTiles[i][0] = DTILE_WALL;
-		_dungeonTiles[i][DUNGEON_WIDTH - 1] = DTILE_WALL;
+		_cells[0][i]._tileNum = DTILE_WALL;
+		_cells[DUNGEON_HEIGHT - 1][i]._tileNum = DTILE_WALL;
+		_cells[i][0]._tileNum = DTILE_WALL;
+		_cells[i][DUNGEON_WIDTH - 1]._tileNum = DTILE_WALL;
 	}
 
 	// Randomize the tiles at the grid intersections that divide the level
 	// into a rough 4x4 arrangement of rooms
 	for (int x = 2; x <= 8; x += 2) {
 		for (int y = 1; y <= 9; ++y)
-			_dungeonTiles[y][x] = getRandomNumber(1, 4) - 1;
+			_cells[y][x]._tileNum = (DungeonTileId)getRandomNumber(DTILE_HALLWAY, DTILE_DOOR);
 	}
 
 	// Scatter some extra walls/support beams around the level, at one of
@@ -91,13 +89,13 @@ void MapDungeon::generateDungeonLevel() {
 
 	int decorCount = dungeonLevel * 2;
 	for (int i = 0; i <= decorCount; ++i) {
-		int newTile = (getRandomNumber(1, 255) > 160) ? DTILE_BEAMS : DTILE_WALL;
+		DungeonTileId newTile = (getRandomNumber(1, 255) > 160) ? DTILE_BEAMS : DTILE_WALL;
 		int idx = getRandomNumber(1, 16) - 1;
 
 		if (dungeonLevel & 1)
-			_dungeonTiles[DUNGEON_DATA2[idx]][DUNGEON_DATA1[idx]] = newTile;
+			_cells[DUNGEON_DATA2[idx]][DUNGEON_DATA1[idx]]._tileNum = newTile;
 		else
-			_dungeonTiles[DUNGEON_DATA1[idx]][DUNGEON_DATA2[idx]] = newTile;
+			_cells[DUNGEON_DATA1[idx]][DUNGEON_DATA2[idx]]._tileNum = newTile;
 	}
 
 	// Re-seed partway through, so item placement below doesn't correlate
@@ -111,31 +109,31 @@ void MapDungeon::generateDungeonLevel() {
 		int x = getRandomNumber(10, 99) / 10;
 		int y = getRandomNumber(10, 99) / 10;
 
-		int tile = _dungeonTiles[y][x];
+		int tile = _cells[y][x]._tileNum;
 		if (tile != DTILE_WALL && tile != DTILE_SECRET_DOOR && tile != DTILE_BEAMS)
 			_cells[y][x]._itemId = newItem;
 	}
 
 	// Place the ladders connecting to the levels above/below, alternating
 	// which of the two fixed spots is up/down between odd/even levels
-	_dungeonTiles[2][1] = DTILE_HALLWAY;
+	_cells[2][1]._tileNum = DTILE_HALLWAY;
 	if (dungeonLevel & 1) {
-		_dungeonTiles[3][7] = DTILE_LADDER_UP;
-		_dungeonTiles[7][3] = DTILE_LADDER_DOWN;
+		_cells[3][7]._tileNum = DTILE_LADDER_UP;
+		_cells[7][3]._tileNum = DTILE_LADDER_DOWN;
 	} else {
-		_dungeonTiles[3][7] = DTILE_LADDER_DOWN;
-		_dungeonTiles[7][3] = DTILE_LADDER_UP;
+		_cells[3][7]._tileNum = DTILE_LADDER_DOWN;
+		_cells[7][3]._tileNum = DTILE_LADDER_UP;
 	}
 
 	if (dungeonLevel == DUNGEON_FLOORS)
 		// No level below the deepest one
-		_dungeonTiles[3][7] = DTILE_HALLWAY;
+		_cells[3][7]._tileNum = DTILE_HALLWAY;
 
 	if (dungeonLevel == 1) {
 		// The topmost level connects back to the overworld instead, via a
 		// separate fixed spot
-		_dungeonTiles[1][1] = DTILE_LADDER_UP;
-		_dungeonTiles[3][7] = DTILE_HALLWAY;
+		_cells[1][1]._tileNum = DTILE_LADDER_UP;
+		_cells[3][7]._tileNum = DTILE_HALLWAY;
 	}
 
 	// Spawn 3 of the level's 5 possible monster slots
@@ -156,8 +154,8 @@ void MapDungeon::dungeonSpawnMonster() {
 		y = getRandomNumber(0, 242) % 9 + 1;
 
 		valid = _cells[y][x]._monsterId == DUNGEON_NO_MONSTER &&
-			_dungeonTiles[y][x] != DTILE_WALL && _dungeonTiles[y][x] != DTILE_SECRET_DOOR &&
-			_dungeonTiles[y][x] != DTILE_BEAMS && _cells[y][x]._itemId != DITEM_CHEST;
+			_cells[y][x]._tileNum != DTILE_WALL && _cells[y][x]._tileNum != DTILE_SECRET_DOOR &&
+			_cells[y][x]._tileNum != DTILE_BEAMS && _cells[y][x]._itemId != DITEM_CHEST;
 	}
 
 	if (!valid)
diff --git a/engines/ultima/ultima1/data/map_dungeon.h b/engines/ultima/ultima1/data/map_dungeon.h
index 369d6a2bd01..95e50638b07 100644
--- a/engines/ultima/ultima1/data/map_dungeon.h
+++ b/engines/ultima/ultima1/data/map_dungeon.h
@@ -60,6 +60,7 @@ enum DungeonItemId {
 };
 
 struct DungeonCell {
+	DungeonTileId _tileNum;
 	uint8 _monsterId;
 	uint8 _itemId;
 	uint16 _monsterHp;
@@ -67,7 +68,6 @@ struct DungeonCell {
 
 struct MapDungeon {
 private:
-	DungeonCell _cells[DUNGEON_HEIGHT][DUNGEON_WIDTH];
 	uint16 _randomSeed = 0;
 	// Tracks which of the 5 monster slots have already been filled while
 	// generating the current level
@@ -97,16 +97,16 @@ private:
 	 */
 	void dungeonSpawnMonster();
 
-protected:
-	byte _dungeonTiles[DUNGEON_HEIGHT][DUNGEON_WIDTH];
+public:
+	DungeonCell _cells[DUNGEON_HEIGHT][DUNGEON_WIDTH];
+
+public:
+	MapDungeon();
 
 	/**
-	 * Loads a dungeon level
+	 * Generates a dungeon level
 	 */
 	void generateDungeonLevel();
-
-public:
-	MapDungeon();
 };
 
 } // namespace Data
diff --git a/engines/ultima/ultima1/data/savegame.cpp b/engines/ultima/ultima1/data/savegame.cpp
index 669ba59d5dc..20f42973447 100644
--- a/engines/ultima/ultima1/data/savegame.cpp
+++ b/engines/ultima/ultima1/data/savegame.cpp
@@ -128,6 +128,9 @@ void Savegame::synchronizeExtra(Common::Serializer &s) {
 	s.syncAsSint16LE(_freeingPrincess);
 	s.syncAsSint16LE(_castleItemAllowance);
 	s.syncAsSint16LE(_castleKeyVal);
+	s.syncAsByte(_dungeonLevel);
+	s.syncAsByte(_dungeonDirection);
+	s.syncAsSint16LE(_dungeonExitHitPoints);
 }
 
 void Savegame::synchronize(Common::Serializer &s) {
diff --git a/engines/ultima/ultima1/ultima1.h b/engines/ultima/ultima1/ultima1.h
index 2b168e916c6..1e2f7f97891 100644
--- a/engines/ultima/ultima1/ultima1.h
+++ b/engines/ultima/ultima1/ultima1.h
@@ -38,6 +38,7 @@
 #include "ultima/detection.h"
 #include "ultima/shared/engine/events.h"
 #include "ultima/ultima1/data/map.h"
+#include "ultima/ultima1/data/map_dungeon.h"
 #include "ultima/ultima1/data/savegame.h"
 #include "ultima/ultima1/data/tiles.h"
 #include "ultima/ultima1/logic/logic.h"
@@ -64,6 +65,7 @@ protected:
 
 public:
 	Data::Map _map;
+	Data::MapDungeon _dungeon;
 	Data::Savegame _savegame;
 	Common::SharedPtr<Logic::Logic> _logic;
 	int _overworldEntityCount = 0;


Commit: 23c1e1c914fd08ab761f43608b9b8981301d4db5
    https://github.com/scummvm/scummvm/commit/23c1e1c914fd08ab761f43608b9b8981301d4db5
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:40:49+11:00

Commit Message:
ULTIMA: ULTIMA1: Implement dungeon draw code

Changed paths:
    engines/ultima/ultima1/views/dungeon_map.cpp
    engines/ultima/ultima1/views/dungeon_map.h


diff --git a/engines/ultima/ultima1/views/dungeon_map.cpp b/engines/ultima/ultima1/views/dungeon_map.cpp
index e8347b2135b..dae55bb4896 100644
--- a/engines/ultima/ultima1/views/dungeon_map.cpp
+++ b/engines/ultima/ultima1/views/dungeon_map.cpp
@@ -27,6 +27,84 @@ namespace Ultima {
 namespace Ultima1 {
 namespace Views {
 
+// Colours used by the dungeon view's wireframe lines
+constexpr int EDGE_COLOR = 15;
+constexpr int HIGHLIGHT_COLOR = 12;
+
+// Perspective coordinate table, indexed by distance (0-5). Matches the
+// original's DUNGEON_ARRAY_X/DUNGEONL_ARRAY_Y
+static const int DUNGEON_ARRAY_X[6] = { 0, 72, 108, 126, 135, 144 };
+static const int DUNGEON_ARRAY_Y[6] = { 0, 36, 54, 63, 68, 72 };
+
+// Dungeon monster Ids that don't block the view, being either invisible or
+// disguised as something else
+constexpr int UMONS_GELATINOUS_CUBE = 9;
+constexpr int UMONS_MIMIC = 11;
+constexpr int UMONS_INVISIBLE_SEEKER = 20;
+
+// Y offset added to widget shape coordinates, indexed by a 0-4 distance tier
+static const int UWIDGET_OFFSET_Y[5] = { 139, 112, 96, 88, 84 };
+
+// Monster/item widget shapes. Each is a byte stream of X,Y coordinate pairs
+// (signed, relative to screen center) describing a polyline: 0x7E marks the
+// next pair as a "move to" (starts a new disconnected segment) rather than
+// a "line to" from the current pen position, and 0x7F ends the shape
+static const uint8 RANGER_DRAW_DATA[] = { 0x7E, 0xE1, 0xFC, 0x1E, 0xFC, 0x0C, 0xE0, 0x0C, 0xDB, 0x12, 0xD4, 0x2A, 0xDB, 0x2A, 0xCF, 0x12, 0xCB, 0x06, 0xC3, 0x0C, 0xBB, 0x0C, 0xB6, 0x06, 0xB3, 0xF9, 0xB3, 0xF3, 0xB6, 0xF3, 0xBB, 0xF9, 0xC3, 0xED, 0xCB, 0xD5, 0xCF, 0xD5, 0xDB, 0xED, 0xD4, 0xF3, 0xDB, 0xF3, 0xE0, 0xE1, 0xFC, 0x7E, 0xED, 0xFC, 0xE7, 0x00, 0xF3, 0x00, 0xF3, 0xFC, 0x7E, 0x12, 0xFC, 0x18, 0x00, 0x0C, 0x00, 0x0C, 0xFC, 0x7E, 0xF3, 0xDB, 0x0C, 0xDB, 0x7E, 0xF3, 0xE0, 0x0C, 0xE0, 0x7E, 0xF3, 0xC7, 0xF9, 0xCB, 0x06, 0xCB, 0x0C, 0xC7, 0x7E, 0x00, 0xD4, 0x00, 0xCB, 0x7E, 0xFB, 0xBF, 0x04, 0xBF, 0x7E, 0x00, 0xBB, 0x06, 0xB6, 0x06, 0xBB, 0xF9, 0xBB, 0xF9, 0xB6, 0x00, 0xBB, 0x7F };
+static const uint8 SKELETON_DRAW_DATA[] = { 0x7E, 0xDB, 0x00, 0xE7, 0x00, 0xE7, 0xEC, 0xF3, 0xE2, 0x0C, 0xE2, 0x18, 0xEC, 0x18, 0x00, 0x24, 0x00, 0x7E, 0x00, 0xE7, 0x00, 0xB6, 0x7E, 0xFC, 0xD8, 0x03, 0xD8, 0x7E, 0xF8, 0xCF, 0x07, 0xCF, 0x7E, 0xF5, 0xC5, 0x0A, 0xC5, 0x7E, 0xE7, 0xCF, 0xF3, 0xBB, 0x0C, 0xBB, 0x18, 0xCF, 0x7E, 0xDB, 0xC5, 0xDB, 0xCF, 0xCF, 0xC5, 0xDB, 0xC5, 0xF3, 0xD8, 0x7E, 0x18, 0xD4, 0x18, 0xC0, 0x7E, 0x12, 0xCF, 0x1E, 0xCF, 0x7E, 0xF9, 0xB6, 0x06, 0xB6, 0x0C, 0xAD, 0x0C, 0xA8, 0x06, 0xA3, 0xF9, 0xA3, 0xF3, 0xA8, 0xF3, 0xAD, 0xF9, 0xB6, 0x7E, 0xF9, 0xA3, 0x00, 0xA8, 0x7E, 0xF9, 0xAD, 0x7E, 0x06, 0xAD, 0x7E, 0xF9, 0xB1, 0x06, 0xB1, 0x7F };
+static const uint8 THIEF_DRAW_DATA[] = { 0x7E, 0x00, 0xBC, 0x00, 0xF7, 0x0C, 0x00, 0x24, 0x00, 0x24, 0xC0, 0x0C, 0xB3, 0x00, 0xBC, 0xF3, 0xB3, 0xDB, 0xC0, 0xDB, 0x00, 0xF3, 0x00, 0x00, 0xF7, 0x7E, 0x0C, 0xB3, 0x0C, 0xA4, 0x00, 0x9B, 0xF3, 0xA4, 0xF3, 0xB3, 0x7E, 0xF3, 0xA4, 0x00, 0xB6, 0x0C, 0xA4, 0x00, 0xA0, 0xF3, 0xA4, 0x7F };
+static const uint8 GIANT_RAT_DRAW_DATA[] = { 0x7E, 0xF9, 0xCF, 0xE7, 0xF3, 0xF3, 0x00, 0x0C, 0x00, 0x18, 0xF3, 0x06, 0xCF, 0x7E, 0x00, 0xDB, 0xF3, 0xC3, 0x00, 0xC9, 0x0C, 0xC3, 0x00, 0xDB, 0x7E, 0x06, 0xC9, 0x02, 0xCF, 0x7E, 0xF9, 0xC9, 0xFD, 0xCF, 0x7E, 0xFB, 0xE7, 0xFB, 0xE1, 0x7E, 0xF6, 0xE7, 0xF6, 0xE1, 0x7E, 0x09, 0xE7, 0x09, 0xE1, 0x7E, 0x04, 0xE7, 0x04, 0xE1, 0x7F };
+static const uint8 RAT_DRAW_DATA[] = { 0x7E, 0x03, 0xC7, 0x15, 0xBE, 0x2B, 0xBE, 0x36, 0xC3, 0x2B, 0xB4, 0x15, 0xAF, 0x03, 0xB6, 0x07, 0xB1, 0x07, 0xAA, 0x03, 0xAD, 0xFD, 0xAD, 0xF8, 0xAA, 0xF8, 0xB1, 0xFC, 0xB6, 0xEA, 0xAF, 0xD4, 0xB4, 0xC9, 0xC3, 0xD4, 0xBE, 0xEA, 0xBE, 0xFC, 0xC7, 0x03, 0xC7, 0x7E, 0xFD, 0xB0, 0x7E, 0x02, 0xB0, 0x7F };
+static const uint8 SPIDER_DRAW_DATA[] = { 0x7E, 0xE7, 0xDB, 0x18, 0xE7, 0x30, 0xDB, 0x18, 0xC3, 0x00, 0xB6, 0xCF, 0xAA, 0xB6, 0xB6, 0xCF, 0xCF, 0xE7, 0xDB, 0xE7, 0xE1, 0xC3, 0xE7, 0xDB, 0xE1, 0xDB, 0xD5, 0xC3, 0xD5, 0xB6, 0xDB, 0xC3, 0xCF, 0x00, 0xCF, 0x00, 0xDB, 0xE7, 0xDB, 0xE7, 0xC3, 0xCF, 0xC3, 0xCF, 0xCF, 0x7E, 0xE7, 0xC3, 0x00, 0xCF, 0x7E, 0x18, 0xE7, 0x3C, 0xF3, 0x00, 0x01, 0x7E, 0x20, 0xE3, 0x4F, 0xE7, 0x79, 0x00, 0x7E, 0x29, 0xDF, 0x4F, 0xDB, 0x79, 0xED, 0x7E, 0x30, 0xDB, 0x4F, 0xC9, 0x79, 0xDB, 0x7E, 0xB6, 0xB6, 0x92, 0xC9, 0x86, 0xE1, 0x7E, 0xBE, 0xB3, 0xAA, 0x9E, 0x86, 0xB6, 0x7E, 0xC6, 0xAE, 0xC3, 0x98, 0x9E, 0x86, 0x7E, 0xCF, 0xAA, 0xE7, 0x98, 0xB6, 0x86, 0x7F };
+static const uint8 VIPER_DRAW_DATA[] = { 0x7E, 0xE7, 0xED, 0xE7, 0xE7, 0xDB, 0xDB, 0xDB, 0x00, 0x24, 0x00, 0x24, 0xED, 0xDB, 0xED, 0x7E, 0x18, 0xED, 0x0C, 0xE7, 0x0C, 0xD5, 0xF3, 0xD5, 0xF3, 0xE7, 0x00, 0xED, 0x7E, 0xE7, 0xF9, 0x24, 0xF9, 0x24, 0xF3, 0xDB, 0xF3, 0x7E, 0xF3, 0xE7, 0x0C, 0xE7, 0x0C, 0xE1, 0xF3, 0xE1, 0xF3, 0xDB, 0x0C, 0xDB, 0x0C, 0xD5, 0xF3, 0xD5, 0x7E, 0x0C, 0xCC, 0xF3, 0xCC, 0xE7, 0xDB, 0x00, 0xCC, 0x18, 0xDB, 0x0C, 0xCC, 0x7E, 0xED, 0xD5, 0xED, 0xCC, 0xF3, 0xC3, 0x0C, 0xC3, 0x11, 0xCC, 0x12, 0xD5, 0x7E, 0xED, 0xCC, 0x00, 0xC3, 0x0F, 0xCC, 0x7F };
+static const uint8 ORC_DRAW_DATA[] = { 0x7E, 0xE7, 0x00, 0x18, 0x00, 0x0C, 0xF7, 0x0C, 0xED, 0x18, 0xE5, 0x18, 0xED, 0x24, 0xE5, 0x24, 0xC9, 0x18, 0xC0, 0xE7, 0xC0, 0x7E, 0xE7, 0x00, 0xF3, 0xF7, 0xF3, 0xED, 0xE7, 0xE5, 0xE7, 0xED, 0xDB, 0xE5, 0xDB, 0xC9, 0xE7, 0xC0, 0x7E, 0x0C, 0xC0, 0x18, 0xAE, 0x0C, 0xA4, 0xF3, 0xA4, 0xE7, 0xAE, 0xF3, 0xC0, 0x7E, 0x18, 0xAE, 0xE7, 0xAE, 0x7E, 0xDB, 0xED, 0x0C, 0xC9, 0x18, 0xC9, 0x00, 0xDB, 0x00, 0xD2, 0xF3, 0xD2, 0x0C, 0xC0, 0x0C, 0xC9, 0x7E, 0x00, 0xB6, 0x0C, 0xAE, 0x0C, 0xB6, 0xF3, 0xB6, 0xF3, 0xAE, 0x00, 0xB6, 0x7F };
+static const uint8 CYCLOPS_DRAW_DATA[] = { 0x7E, 0x00, 0xE1, 0x06, 0x00, 0x1E, 0x00, 0x12, 0xF9, 0x08, 0xE1, 0x12, 0xC9, 0x1E, 0xE1, 0x24, 0xE1, 0x1E, 0xC3, 0x06, 0xBC, 0x12, 0xB6, 0x12, 0xB0, 0x06, 0xAA, 0x7E, 0x00, 0xE1, 0xF9, 0x00, 0xE1, 0x00, 0xED, 0xF9, 0xF7, 0xE1, 0xED, 0xC9, 0xE1, 0xE1, 0xDB, 0xE1, 0xE1, 0xC3, 0xF9, 0xBC, 0xED, 0xB6, 0xED, 0xB0, 0xF9, 0xAA, 0x7E, 0x06, 0xAA, 0xF9, 0xAA, 0x7E, 0x0C, 0xB0, 0x00, 0xAD, 0xF3, 0xB0, 0x00, 0xB4, 0x0C, 0xB0, 0x7E, 0xF3, 0xB6, 0x0C, 0xB6, 0x7F };
+static const uint8 GELATINOUS_CUBE_DRAW_DATA[] = { 0x7E, 0xB5, 0xF1, 0x4B, 0xF1, 0x4B, 0xAB, 0xB5, 0xAB, 0xB5, 0xF1, 0x7F };
+static const uint8 ETTIN_DRAW_DATA[] = { 0x7E, 0x00, 0xE1, 0x18, 0x00, 0x30, 0x00, 0x24, 0xF9, 0x12, 0xD5, 0x18, 0xC9, 0x24, 0xCF, 0x24, 0xDB, 0x30, 0xDB, 0x30, 0xC9, 0x12, 0xB6, 0x24, 0xB6, 0x24, 0xA5, 0x0C, 0xA5, 0x0C, 0xB3, 0xF3, 0xB3, 0x7E, 0x00, 0xE1, 0xE7, 0x00, 0xCF, 0x00, 0xDB, 0xF9, 0xED, 0xD5, 0xE7, 0xC6, 0xCF, 0xCC, 0xBA, 0xBE, 0xC3, 0xB6, 0xCF, 0xBF, 0xED, 0xB6, 0xDB, 0xB6, 0xDB, 0xA5, 0xF3, 0xA5, 0xF3, 0xB3, 0x7E, 0x1C, 0xB1, 0x7E, 0x15, 0xAB, 0x7E, 0xE3, 0xB1, 0x7E, 0xEA, 0xAB, 0x7F };
+static const uint8 CHEST_DRAW_DATA[] = { 0x7E, 0xE7, 0x05, 0xE7, 0xE7, 0x18, 0xE7, 0x18, 0x05, 0xE7, 0x05, 0x7E, 0xE7, 0xE7, 0xF3, 0xDB, 0x24, 0xDB, 0x24, 0xF3, 0x18, 0x05, 0x7E, 0x18, 0xE7, 0x24, 0xDB, 0x7F };
+static const uint8 LIZARD_MAN_DRAW_DATA[] = { 0x7E, 0x06, 0xC9, 0x0E, 0xD5, 0x06, 0xE7, 0x06, 0xED, 0x14, 0x00, 0x1E, 0x00, 0x18, 0xF9, 0x12, 0xE7, 0x12, 0xDB, 0x7E, 0x06, 0xC9, 0xF9, 0xC9, 0xF1, 0xD5, 0xF9, 0xE7, 0xF9, 0xED, 0xEB, 0x00, 0xE1, 0x00, 0xE7, 0xF9, 0xED, 0xE7, 0xED, 0xDB, 0x7E, 0x12, 0xDB, 0x1E, 0xC9, 0x1E, 0xB6, 0x18, 0xBC, 0x18, 0xC9, 0x12, 0xC9, 0x06, 0xC3, 0x12, 0xBC, 0x06, 0xB6, 0xF9, 0xB6, 0xE7, 0xBC, 0xE7, 0xBF, 0xF9, 0xC3, 0xE7, 0xCF, 0xE7, 0xE7, 0xED, 0xE1, 0x7E, 0xE7, 0xBE, 0xF9, 0xBE, 0x7E, 0x02, 0xBA, 0x7E, 0xF9, 0xED, 0x0F, 0xF9, 0x7E, 0x18, 0xF9, 0x2A, 0xF3, 0x1E, 0x00, 0x7F };
+static const uint8 MINOTAUR_DRAW_DATA[] = { 0x7E, 0x00, 0xE1, 0x12, 0xE7, 0x12, 0xF9, 0x1E, 0x00, 0x2A, 0x00, 0x1E, 0xF9, 0x1E, 0xE1, 0x12, 0xD5, 0x12, 0xCF, 0x2A, 0xBC, 0x2A, 0xAA, 0x1E, 0xB6, 0x12, 0xBC, 0x06, 0xB6, 0x7E, 0x00, 0xE1, 0xED, 0xE7, 0xED, 0xF9, 0xE1, 0x00, 0xD5, 0x00, 0xE1, 0xF9, 0xE1, 0xE1, 0xED, 0xD5, 0xED, 0xCF, 0xD5, 0xBC, 0xD5, 0xAA, 0xE1, 0xB6, 0xED, 0xBC, 0xF9, 0xB6, 0x7E, 0x0C, 0xAE, 0x06, 0xB6, 0x06, 0xBA, 0xF9, 0xBA, 0xF9, 0xB6, 0xF3, 0xAE, 0xED, 0xA4, 0xF9, 0xAA, 0x06, 0xAA, 0x12, 0xA4, 0x0C, 0xAE, 0x7E, 0xFB, 0xAF, 0x7E, 0x04, 0xAF, 0x7F };
+static const uint8 CARRION_CREEPER_DRAW_DATA[] = { 0x7E, 0xE7, 0x86, 0xE7, 0x92, 0xF3, 0x9E, 0x0C, 0x9E, 0x18, 0x92, 0x18, 0x86, 0x7E, 0xE7, 0x92, 0xD5, 0xA4, 0xD5, 0xC3, 0x7E, 0xF3, 0x9E, 0xE7, 0xB6, 0xF3, 0xCF, 0x7E, 0x0C, 0x9E, 0x18, 0xB6, 0x0C, 0xDB, 0x7E, 0x18, 0x92, 0x2A, 0xAA, 0x30, 0xC3, 0x7F };
+static const uint8 TANGLER_DRAW_DATA[] = { 0x7E, 0xE7, 0x00, 0xF3, 0xED, 0xF3, 0xB6, 0x00, 0xAA, 0x06, 0xAA, 0x0C, 0xB0, 0x0C, 0xE7, 0x18, 0x00, 0x7E, 0xF3, 0xDB, 0xE7, 0xED, 0xDB, 0xE7, 0xE1, 0xE1, 0x7E, 0xF3, 0xC9, 0xE1, 0xD5, 0xDB, 0xC9, 0xE1, 0xBC, 0x7E, 0xF3, 0xBC, 0xE7, 0xB6, 0xE1, 0xAA, 0xED, 0x9E, 0x7E, 0x0C, 0xB6, 0x18, 0xB0, 0x12, 0xA4, 0x06, 0x9E, 0x7E, 0x0C, 0xC3, 0x18, 0xC9, 0x24, 0xC3, 0x24, 0xB0, 0x7E, 0x0C, 0xD5, 0x18, 0xE1, 0x1E, 0xE1, 0x24, 0xD5, 0x7E, 0x00, 0xB6, 0xF9, 0xBC, 0x00, 0xC3, 0x06, 0xBC, 0x00, 0xB6, 0x7E, 0x00, 0xBC, 0x7F };
+static const uint8 GREMLIN_DRAW_DATA[] = { 0x7E, 0xE7, 0x00, 0xED, 0x00, 0xF3, 0xF9, 0xED, 0xF3, 0xF9, 0xE7, 0x18, 0xE1, 0x0C, 0xED, 0x12, 0xF3, 0x0C, 0xF9, 0x12, 0x00, 0x18, 0x00, 0x7E, 0xF3, 0xED, 0x0C, 0xED, 0x7E, 0xF3, 0xF9, 0x0C, 0xF9, 0x7E, 0xF9, 0xF1, 0x7E, 0x06, 0xF1, 0x7E, 0xF9, 0xF6, 0x06, 0xF6, 0x7F };
+static const uint8 WANDERING_EYES_DRAW_DATA[] = { 0x7E, 0x06, 0xDB, 0x0E, 0xD2, 0x0E, 0xC6, 0x06, 0xBC, 0xF9, 0xBC, 0x7E, 0x06, 0xDB, 0xF9, 0xDB, 0xF1, 0xD2, 0xF1, 0xC6, 0xF9, 0xBC, 0x7E, 0x00, 0xC3, 0x06, 0xCC, 0x00, 0xD5, 0xF9, 0xCC, 0x00, 0xC3, 0x7E, 0x00, 0xC9, 0x00, 0xCF, 0x7E, 0x0E, 0xD2, 0x14, 0xD5, 0x18, 0xD2, 0x18, 0xCF, 0x1E, 0xCF, 0x1E, 0xD5, 0x18, 0xD5, 0x18, 0xCF, 0x7E, 0xF1, 0xD2, 0xEB, 0xCF, 0xE7, 0xD2, 0xE7, 0xCF, 0xE1, 0xCF, 0xE1, 0xD5, 0xE7, 0xD5, 0xE7, 0xCF, 0x7E, 0xF1, 0xC6, 0xEB, 0xC6, 0xE7, 0xC0, 0xE7, 0xC0, 0xE7, 0xC3, 0xE1, 0xC3, 0xE1, 0xBC, 0xE7, 0xBC, 0xE7, 0xC3, 0x7E, 0x0E, 0xC6, 0x12, 0xC0, 0x18, 0xC0, 0x18, 0xC3, 0x1E, 0xC3, 0x1E, 0xBC, 0x18, 0xBC, 0x18, 0xC3, 0x7E, 0x06, 0xBC, 0x08, 0xB4, 0x0C, 0xB4, 0x0C, 0xB6, 0x12, 0xB6, 0x12, 0xB0, 0x0C, 0xB0, 0x0C, 0xB6, 0x7E, 0xF9, 0xBC, 0xF7, 0xB6, 0xF3, 0xB4, 0xF3, 0xB6, 0xED, 0xB6, 0xED, 0xB0, 0xF3, 0xB0, 0xF3, 0xB6, 0x7F };
+static const uint8 WRAITH_DRAW_DATA[] = { 0x7E, 0xCF, 0x00, 0xDB, 0xDB, 0xE7, 0xAA, 0x00, 0x9E, 0x0C, 0x9E, 0x18, 0xAA, 0x12, 0xB6, 0x12, 0xC3, 0x18, 0xDB, 0x18, 0xDB, 0x24, 0x00, 0x7E, 0x00, 0xAA, 0x0C, 0xA4, 0x12, 0xAA, 0x0C, 0xB6, 0x06, 0xB6, 0x00, 0xB0, 0x00, 0xAA, 0x7E, 0xE1, 0xC3, 0xF3, 0xD5, 0x7E, 0xF3, 0xB6, 0xF3, 0xC3, 0xF9, 0xCF, 0x7E, 0x06, 0xCF, 0x12, 0xDB, 0x7E, 0x0C, 0xC3, 0x12, 0xCF, 0x7E, 0x00, 0xDB, 0x00, 0xF3, 0xF9, 0x00, 0x7E, 0x06, 0xAB, 0x7E, 0x0C, 0xAB, 0x7F };
+static const uint8 LICH_DRAW_DATA[] = { 0x7E, 0x0C, 0xA4, 0x12, 0xA9, 0x18, 0xB3, 0x18, 0xBC, 0x12, 0xC0, 0x06, 0xD7, 0xF9, 0xD7, 0x7E, 0x0C, 0xA4, 0xF3, 0xA4, 0xED, 0xA9, 0xE7, 0xB3, 0xE7, 0xBC, 0xED, 0xC0, 0xF9, 0xD7, 0x7E, 0xED, 0xB3, 0xF3, 0xAE, 0xF9, 0xAE, 0x00, 0xB3, 0x7E, 0x12, 0xB3, 0x0C, 0xAE, 0x06, 0xAE, 0x00, 0xB3, 0x7E, 0x12, 0xB3, 0x0C, 0xB6, 0x06, 0xB6, 0x00, 0xB3, 0x7E, 0xED, 0xB3, 0xF3, 0xB6, 0xF9, 0xB6, 0x00, 0xB3, 0x7E, 0xF9, 0xC9, 0x06, 0xC9, 0x7E, 0xF9, 0xBC, 0x06, 0xBC, 0x00, 0xC0, 0xF9, 0xBC, 0x7F };
+static const uint8 INVISIBLE_SEEKER_DRAW_DATA[] = { 0x7F };
+static const uint8 MIND_WHIPPER_DRAW_DATA[] = { 0x7E, 0x09, 0xAD, 0x0E, 0xAD, 0x09, 0xBB, 0x18, 0xC0, 0x27, 0x00, 0xD8, 0x00, 0xE7, 0xC0, 0xF6, 0xBB, 0xF1, 0xAD, 0xF6, 0xAD, 0x7E, 0xEC, 0xE2, 0xF1, 0xC5, 0xFB, 0xBB, 0xF6, 0xA8, 0x00, 0xA3, 0x09, 0xA8, 0x04, 0xBB, 0x0E, 0xC5, 0x13, 0xE2, 0x7E, 0xFD, 0xB9, 0xFD, 0xBB, 0xF6, 0xCF, 0xF6, 0xE7, 0x7E, 0x02, 0xB9, 0x02, 0xBB, 0x09, 0xCF, 0x09, 0xE7, 0x7E, 0x00, 0xB6, 0x00, 0xEC, 0x7E, 0x03, 0xAA, 0x7E, 0xFC, 0xAA, 0x7F };
+static const uint8 ZORN_DRAW_DATA[] = { 0x7E, 0xF3, 0xF3, 0x0C, 0xF3, 0x18, 0xE7, 0x24, 0xF3, 0x24, 0x00, 0x30, 0x00, 0x30, 0xE7, 0x24, 0xDB, 0x24, 0xCF, 0x36, 0xC9, 0x43, 0xAA, 0x36, 0xB0, 0x2A, 0xAA, 0x30, 0xB6, 0x24, 0xC3, 0x1E, 0xAA, 0x0C, 0x9E, 0x00, 0xB6, 0xF3, 0x9E, 0xE1, 0xAA, 0x7E, 0xF3, 0xF3, 0xE7, 0xE7, 0xDB, 0xF3, 0xDB, 0x00, 0xCF, 0x00, 0xCF, 0xE7, 0xDB, 0xDB, 0xDB, 0xCF, 0xC9, 0xC9, 0xBC, 0xAA, 0xC9, 0xB0, 0xD5, 0xAA, 0xCF, 0xB6, 0xDB, 0xC3, 0xE1, 0xAA, 0x7E, 0xE7, 0xBC, 0x0C, 0xBC, 0x7E, 0x18, 0xBC, 0x0C, 0xBC, 0x7F };
+static const uint8 DEAMON_DRAW_DATA[] = { 0x7E, 0x00, 0xD5, 0x12, 0xE1, 0x12, 0x00, 0x36, 0x00, 0x2A, 0xF9, 0x2A, 0xE1, 0x1E, 0xCF, 0x2A, 0xD5, 0x36, 0xB6, 0x12, 0xAA, 0x06, 0xB6, 0x00, 0xAA, 0x7E, 0x00, 0xD5, 0xED, 0xE1, 0xED, 0x00, 0xC9, 0x00, 0xD5, 0xF9, 0xD5, 0xE1, 0xE1, 0xCF, 0xD5, 0xD5, 0xC9, 0xB6, 0xED, 0xAA, 0xF9, 0xB6, 0x00, 0xAA, 0x7E, 0x12, 0xAA, 0x14, 0xA4, 0x0C, 0xA2, 0x12, 0x98, 0x06, 0x9E, 0x7E, 0xED, 0xAA, 0xEB, 0xA4, 0xF3, 0xA2, 0xED, 0x98, 0xF9, 0x9E, 0x06, 0x9E, 0x7E, 0x0A, 0xA4, 0x06, 0xA8, 0x7E, 0xF5, 0xA4, 0xF9, 0xA8, 0x7F };
+static const uint8 BALRON_DRAW_DATA[] = { 0x7E, 0x00, 0xDB, 0x00, 0x01, 0x18, 0x00, 0x0C, 0xF3, 0x0C, 0xCF, 0x18, 0xDB, 0x18, 0xB6, 0x0C, 0xAA, 0x0C, 0x98, 0x00, 0x92, 0x7E, 0x00, 0x01, 0xE7, 0x00, 0xF3, 0xF3, 0xF3, 0xCF, 0xE7, 0xDB, 0xE7, 0xB6, 0xF3, 0xAA, 0xF3, 0x98, 0x00, 0x92, 0x7E, 0x0C, 0xAA, 0x18, 0x9E, 0x30, 0x9E, 0x55, 0xE7, 0x30, 0xE7, 0x18, 0xCF, 0x7E, 0xF3, 0xAA, 0xE7, 0x9E, 0xCF, 0x9E, 0xAA, 0xE7, 0xCF, 0xE7, 0xE7, 0xCF, 0x7E, 0x06, 0x9E, 0x7E, 0xF9, 0x9E, 0x7E, 0x06, 0xA8, 0xF9, 0xA8, 0x7F };
+
+// Indexed by monster Id (0-24). Mimic (11) reuses the chest shape, since
+// it disguises itself as one; the gelatinous cube's entry (9) is present
+// for completeness but never used - it's drawn as a wall instead
+static const uint8 *const UWIDGET_DRAW_TABLE[25] = {
+	RANGER_DRAW_DATA, SKELETON_DRAW_DATA, THIEF_DRAW_DATA, GIANT_RAT_DRAW_DATA,
+	RAT_DRAW_DATA, SPIDER_DRAW_DATA, VIPER_DRAW_DATA, ORC_DRAW_DATA,
+	CYCLOPS_DRAW_DATA, GELATINOUS_CUBE_DRAW_DATA, ETTIN_DRAW_DATA, CHEST_DRAW_DATA,
+	LIZARD_MAN_DRAW_DATA, MINOTAUR_DRAW_DATA, CARRION_CREEPER_DRAW_DATA, TANGLER_DRAW_DATA,
+	GREMLIN_DRAW_DATA, WANDERING_EYES_DRAW_DATA, WRAITH_DRAW_DATA, LICH_DRAW_DATA,
+	INVISIBLE_SEEKER_DRAW_DATA, MIND_WHIPPER_DRAW_DATA, ZORN_DRAW_DATA, DEAMON_DRAW_DATA,
+	BALRON_DRAW_DATA
+};
+
+// Ladder widget shapes - the "hole" opening (drawn wide-to-narrow to suggest
+// a hatch) plus the shaft: a full rung ladder when seen face-on, or just a
+// single pole when seen from the side (the rungs aren't visible edge-on)
+static const uint8 LADDER_UP_TOP_DATA[] = { 0x7E, 0xBA, 0x88, 0x46, 0x88, 0x28, 0x97, 0xD8, 0x97, 0xBA, 0x88, 0x7F };
+static const uint8 LADDER_DOWN_TOP_DATA[] = { 0x7E, 0xBA, 0x00, 0x46, 0x00, 0x28, 0xF1, 0xD8, 0xF1, 0xBA, 0x00, 0x7F };
+static const uint8 LADDER_SHAFT_FACEON_DATA[] = {
+	0x7E, 0xEC, 0x88, 0xEC, 0x00, 0x7E, 0x14, 0x88, 0x14, 0x00, 0x7E, 0xEC, 0x9C, 0x14, 0x9C,
+	0x7E, 0xEC, 0xB5, 0x14, 0xB5, 0x7E, 0xEC, 0xD3, 0x14, 0xD3, 0x7E, 0xEC, 0xF1, 0x14, 0xF1, 0x7F
+};
+static const uint8 LADDER_SHAFT_SIDE_DATA[] = { 0x7E, 0x00, 0x88, 0x00, 0x00, 0x7F };
+
+// A coffin, lid ajar
+static const uint8 COFFIN_DRAW_DATA[] = {
+	0x7E, 0xCE, 0x05, 0x32, 0x05, 0x32, 0xF9, 0xCE, 0xF9, 0xCE, 0x05, 0xBF, 0xFB, 0xBF, 0xEF,
+	0xCE, 0xFB, 0x7E, 0x32, 0x05, 0x39, 0x01, 0x39, 0xF4, 0x32, 0xF9, 0x7E, 0xBF, 0xEF, 0xD3, 0xEA, 0x39, 0xF4, 0x7F
+};
+
 bool DungeonMap::msgFocus(const FocusMessage &msg) {
 	MetaEngine::setKeybindingMode(KBMODE_GAMEPLAY);
 	return Dialog::msgFocus(msg);
@@ -44,7 +122,587 @@ void DungeonMap::draw() {
 	// Write title showing the dungeon level
 	s.writeString(Point(15, 0), "\x10 Level %2d \x11", _G(savegame)._dungeonLevel);
 
-	// TODO: Dungeon view rendering
+	drawDungeonView();
+}
+
+Data::DungeonCell DungeonMap::cellAt(int x, int y) const {
+	if (x < 0 || x >= Data::DUNGEON_WIDTH || y < 0 || y >= Data::DUNGEON_HEIGHT)
+		return Data::DungeonCell{ Data::DTILE_WALL, Data::DUNGEON_NO_MONSTER, Data::DITEM_NONE, 0 };
+
+	return _G(dungeon)._cells[y][x];
+}
+
+int DungeonMap::getDirDeltaX() const {
+	switch (_G(savegame)._dungeonDirection) {
+	case Data::DIR_RIGHT:
+		return 1;
+	case Data::DIR_LEFT:
+		return -1;
+	default:
+		return 0;
+	}
+}
+
+int DungeonMap::getDirDeltaY() const {
+	switch (_G(savegame)._dungeonDirection) {
+	case Data::DIR_UP:
+		return -1;
+	case Data::DIR_DOWN:
+		return 1;
+	default:
+		return 0;
+	}
+}
+
+bool DungeonMap::isMonsterBlocking(int x, int y) const {
+	int monsterId = cellAt(x, y)._monsterId;
+	if (monsterId == Data::DUNGEON_NO_MONSTER)
+		return false;
+
+	return monsterId != UMONS_GELATINOUS_CUBE && monsterId != UMONS_MIMIC &&
+		monsterId != UMONS_INVISIBLE_SEEKER;
+}
+
+bool DungeonMap::isCellOccupied(int deltaX, int deltaY) const {
+	const auto &pos = _G(savegame)._locationPosition;
+	int x = pos.x + deltaX, y = pos.y + deltaY;
+
+	int tile = cellAt(x, y)._tileNum;
+	if (tile == Data::DTILE_WALL || tile == Data::DTILE_SECRET_DOOR || tile == Data::DTILE_DOOR)
+		return true;
+
+	return isMonsterBlocking(x, y);
+}
+
+static int sgn(int val) {
+	return (val > 0) ? 1 : (val < 0 ? -1 : 0);
+}
+
+int DungeonMap::distanceToOccupiedCell(int deltaX, int deltaY) const {
+	int dx = deltaX, dy = deltaY;
+	int idx = 1;
+
+	while (!isCellOccupied(dx, dy)) {
+		++idx;
+		dx += sgn(deltaX);
+		dy += sgn(deltaY);
+	}
+
+	return MIN(idx, 5);
+}
+
+bool DungeonMap::isSolidTile(int tileNum) const {
+	return tileNum != Data::DTILE_HALLWAY && tileNum != Data::DTILE_LADDER_UP &&
+		tileNum != Data::DTILE_LADDER_DOWN && tileNum != Data::DTILE_BEAMS;
+}
+
+void DungeonMap::drawFacingDirection() {
+	auto s = getSurface();
+
+	const char *dirName;
+	switch (_G(savegame)._dungeonDirection) {
+	case Data::DIR_UP:
+		dirName = "North";
+		break;
+	case Data::DIR_DOWN:
+		dirName = "South";
+		break;
+	case Data::DIR_RIGHT:
+		dirName = "East";
+		break;
+	default:
+		dirName = "West";
+		break;
+	}
+
+	s.setColor(EDGE_COLOR);
+	s.writeString(Point(16, 19), "\x10 %s \x11", dirName);
+}
+
+void DungeonMap::drawWall(int distance) {
+	if (distance > 5)
+		return;
+
+	int offset = (distance == 0) ? 8 : 0;
+	auto s = getSurface();
+
+	int x1 = DUNGEON_ARRAY_X[distance] + 16 + offset;
+	int x2 = 303 - DUNGEON_ARRAY_X[distance] - offset;
+	int yTop = DUNGEON_ARRAY_Y[distance] + 8 + offset;
+	int yBottom = 151 - DUNGEON_ARRAY_Y[distance] - offset;
+
+	s.drawLine(x1, yTop, x2, yTop, EDGE_COLOR);
+	s.drawLine(x1, yBottom, x2, yBottom, EDGE_COLOR);
+}
+
+void DungeonMap::drawLeftWall(int distance) {
+	if (distance < 1 || distance > 5)
+		return;
+	auto s = getSurface();
+
+	int x1 = DUNGEON_ARRAY_X[distance - 1] + 16;
+	int x2 = DUNGEON_ARRAY_X[distance] + 16;
+
+	s.drawLine(x1, DUNGEON_ARRAY_Y[distance - 1] + 8, x2, DUNGEON_ARRAY_Y[distance] + 8, EDGE_COLOR);
+	s.drawLine(x1, 151 - DUNGEON_ARRAY_Y[distance - 1], x2, 151 - DUNGEON_ARRAY_Y[distance], EDGE_COLOR);
+}
+
+void DungeonMap::drawRightWall(int distance) {
+	if (distance < 1 || distance > 5)
+		return;
+	auto s = getSurface();
+
+	int x1 = 303 - DUNGEON_ARRAY_X[distance - 1];
+	int x2 = 303 - DUNGEON_ARRAY_X[distance];
+
+	s.drawLine(x1, DUNGEON_ARRAY_Y[distance - 1] + 8, x2, DUNGEON_ARRAY_Y[distance] + 8, EDGE_COLOR);
+	s.drawLine(x1, 151 - DUNGEON_ARRAY_Y[distance - 1], x2, 151 - DUNGEON_ARRAY_Y[distance], EDGE_COLOR);
+}
+
+void DungeonMap::drawLeftBlank(int distance) {
+	if (distance < 1 || distance > 5)
+		return;
+	auto s = getSurface();
+
+	int x1 = DUNGEON_ARRAY_X[distance - 1] + 16;
+	int x2 = DUNGEON_ARRAY_X[distance] + 16;
+	int yTop = DUNGEON_ARRAY_Y[distance] + 8;
+	int yBottom = 151 - DUNGEON_ARRAY_Y[distance];
+
+	s.drawLine(x1, yTop, x2, yTop, EDGE_COLOR);
+	s.drawLine(x1, yBottom, x2, yBottom, EDGE_COLOR);
+}
+
+void DungeonMap::drawRightBlank(int distance) {
+	if (distance < 1 || distance > 5)
+		return;
+	auto s = getSurface();
+
+	int x1 = 303 - DUNGEON_ARRAY_X[distance - 1];
+	int x2 = 303 - DUNGEON_ARRAY_X[distance];
+	int yTop = DUNGEON_ARRAY_Y[distance] + 8;
+	int yBottom = 151 - DUNGEON_ARRAY_Y[distance];
+
+	s.drawLine(x1, yTop, x2, yTop, EDGE_COLOR);
+	s.drawLine(x1, yBottom, x2, yBottom, EDGE_COLOR);
+}
+
+void DungeonMap::drawLeftEdge(int distance) {
+	if (distance > 5)
+		return;
+	auto s = getSurface();
+
+	int x = DUNGEON_ARRAY_X[distance] + 16;
+	s.drawLine(x, DUNGEON_ARRAY_Y[distance] + 8, x, 151 - DUNGEON_ARRAY_Y[distance], EDGE_COLOR);
+}
+
+void DungeonMap::drawRightEdge(int distance) {
+	if (distance > 5)
+		return;
+	auto s = getSurface();
+
+	int x = 303 - DUNGEON_ARRAY_X[distance];
+	s.drawLine(x, DUNGEON_ARRAY_Y[distance] + 8, x, 151 - DUNGEON_ARRAY_Y[distance], EDGE_COLOR);
+}
+
+void DungeonMap::drawLeftDoor(int distance) {
+	if (distance > 5)
+		return;
+
+	drawLeftWall(distance);
+
+	int diffX = ABS((DUNGEON_ARRAY_X[distance - 1] - DUNGEON_ARRAY_X[distance]) / 9);
+	int diffY = ABS((DUNGEON_ARRAY_Y[distance - 1] - DUNGEON_ARRAY_Y[distance]) / 5);
+
+	int x1 = DUNGEON_ARRAY_X[distance - 1] + diffX * 2 + 16;
+	int y1 = 151 - diffY - DUNGEON_ARRAY_Y[distance - 1] - 1;
+	int x2 = x1;
+	int y2 = DUNGEON_ARRAY_Y[distance] + 8 - diffY;
+
+	auto s = getSurface();
+	s.drawLine(x1, y1, x2, y2, EDGE_COLOR);
+
+	int xp = diffX * 6 + 16 + DUNGEON_ARRAY_X[distance - 1];
+	int yp = DUNGEON_ARRAY_Y[distance] + 8 + diffY;
+	s.drawLine(x2, y2, xp, yp, EDGE_COLOR);
+
+	int yp2 = 151 - DUNGEON_ARRAY_Y[distance] + diffY + diffY - ((distance == 1) ? 2 : 0);
+	s.drawLine(xp, yp, xp, yp2, EDGE_COLOR);
+}
+
+void DungeonMap::drawRightDoor(int distance) {
+	if (distance > 5)
+		return;
+
+	drawRightWall(distance);
+
+	int diffX = ABS((DUNGEON_ARRAY_X[distance - 1] - DUNGEON_ARRAY_X[distance]) / 9);
+	int diffY = ABS((DUNGEON_ARRAY_Y[distance - 1] - DUNGEON_ARRAY_Y[distance]) / 5);
+
+	int x1 = 303 - (DUNGEON_ARRAY_X[distance - 1] + diffX * 2);
+	int y1 = 151 - diffY - DUNGEON_ARRAY_Y[distance - 1] - 1;
+	int x2 = x1;
+	int y2 = DUNGEON_ARRAY_Y[distance] + 8 - diffY;
+
+	auto s = getSurface();
+	s.drawLine(x1, y1, x2, y2, EDGE_COLOR);
+
+	int xp = 303 - (diffX * 6 + DUNGEON_ARRAY_X[distance - 1]);
+	int yp = DUNGEON_ARRAY_Y[distance] + 8 + diffY;
+	s.drawLine(x2, y2, xp, yp, EDGE_COLOR);
+
+	int yp2 = 151 - DUNGEON_ARRAY_Y[distance] + diffY + diffY - ((distance == 1) ? 2 : 0);
+	s.drawLine(xp, yp, xp, yp2, EDGE_COLOR);
+}
+
+void DungeonMap::drawDoorway(int distance) {
+	int offsetY = 0;
+	int bottomColor = EDGE_COLOR;
+	if (distance == 0) {
+		offsetY = 8;
+		// Standing right at the threshold, so the near edge (right at the
+		// player's feet) isn't drawn
+		bottomColor = 0;
+	}
+
+	if (distance >= 5)
+		return;
+
+	drawWall(distance);
+
+	auto s = getSurface();
+	int farLeftX = DUNGEON_ARRAY_X[distance + 1] + 16;
+	int farRightX = 303 - DUNGEON_ARRAY_X[distance + 1];
+	int bottomY = 151 - DUNGEON_ARRAY_Y[distance] - offsetY;
+	int topY = DUNGEON_ARRAY_Y[distance + 1] + 8;
+
+	s.drawLine(farRightX, bottomY, farLeftX, bottomY, bottomColor);
+	s.drawLine(farLeftX, bottomY, farLeftX, topY, EDGE_COLOR);
+	s.drawLine(farLeftX, topY, farRightX, topY, EDGE_COLOR);
+	s.drawLine(farRightX, topY, farRightX, bottomY, EDGE_COLOR);
+}
+
+void DungeonMap::drawBeams(int distance) {
+	if (distance > 5)
+		return;
+
+	int height = ABS((2 * DUNGEON_ARRAY_Y[distance] - 143) / 4);
+	int x1 = DUNGEON_ARRAY_X[distance] + 16;
+	int x2 = 303 - DUNGEON_ARRAY_X[distance];
+
+	auto s = getSurface();
+	for (int beamNum = 1; beamNum <= 3; ++beamNum) {
+		int y = DUNGEON_ARRAY_Y[distance] + 8 + height * beamNum + distance / 2;
+		s.drawLine(x1, y, x2, y, HIGHLIGHT_COLOR);
+	}
+}
+
+void DungeonMap::drawLadderUpFaceOn(int distance) {
+	if (distance > 5)
+		return;
+	dungeonDrawWidget(LADDER_UP_TOP_DATA, distance, EDGE_COLOR);
+	dungeonDrawWidget(LADDER_SHAFT_FACEON_DATA, distance, EDGE_COLOR);
+}
+
+void DungeonMap::drawLadderDownFaceOn(int distance) {
+	if (distance > 5)
+		return;
+	dungeonDrawWidget(LADDER_DOWN_TOP_DATA, distance, EDGE_COLOR);
+	dungeonDrawWidget(LADDER_SHAFT_FACEON_DATA, distance, EDGE_COLOR);
+}
+
+void DungeonMap::drawLadderUpSideways(int distance) {
+	if (distance > 5)
+		return;
+	dungeonDrawWidget(LADDER_UP_TOP_DATA, distance, EDGE_COLOR);
+	dungeonDrawWidget(LADDER_SHAFT_SIDE_DATA, distance, EDGE_COLOR);
+}
+
+void DungeonMap::drawLadderDownSideways(int distance) {
+	if (distance > 5)
+		return;
+	dungeonDrawWidget(LADDER_DOWN_TOP_DATA, distance, EDGE_COLOR);
+	dungeonDrawWidget(LADDER_SHAFT_SIDE_DATA, distance, EDGE_COLOR);
+}
+
+void DungeonMap::drawLeftCell(int distance, int tileNum) {
+	if (tileNum == Data::DTILE_WALL || tileNum == Data::DTILE_SECRET_DOOR)
+		drawLeftWall(distance);
+	else if (tileNum == Data::DTILE_DOOR)
+		drawLeftDoor(distance);
+	else
+		drawLeftBlank(distance);
+}
+
+void DungeonMap::drawRightCell(int distance, int tileNum) {
+	if (tileNum == Data::DTILE_WALL || tileNum == Data::DTILE_SECRET_DOOR)
+		drawRightWall(distance);
+	else if (tileNum == Data::DTILE_DOOR)
+		drawRightDoor(distance);
+	else
+		drawRightBlank(distance);
+}
+
+void DungeonMap::dungeonDrawCell(int distance, int x, int y) {
+	const Data::DungeonCell cell = cellAt(x, y);
+
+	if (cell._monsterId != Data::DUNGEON_NO_MONSTER) {
+		if (cell._tileNum == Data::DTILE_DOOR || cell._tileNum == Data::DTILE_SECRET_DOOR ||
+				cell._tileNum == Data::DTILE_WALL)
+			drawWall(distance);
+
+		// A monster sharing a ladder's cell only gets the "hole" opening
+		// drawn, not the full shaft - matching the original's dungeonDrawCell2
+		if (cell._tileNum == Data::DTILE_LADDER_DOWN)
+			dungeonDrawWidget(LADDER_DOWN_TOP_DATA, distance + 1, EDGE_COLOR);
+		else if (cell._tileNum == Data::DTILE_LADDER_UP)
+			dungeonDrawWidget(LADDER_UP_TOP_DATA, distance + 1, EDGE_COLOR);
+
+		dungeonDrawMonster(cell._monsterId, distance);
+		return;
+	}
+
+	bool facingUpDown = _G(savegame)._dungeonDirection == Data::DIR_UP ||
+		_G(savegame)._dungeonDirection == Data::DIR_DOWN;
+
+	switch (cell._tileNum) {
+	case Data::DTILE_WALL:
+	case Data::DTILE_SECRET_DOOR:
+		drawWall(distance);
+		break;
+	case Data::DTILE_DOOR:
+		drawDoorway(distance);
+		break;
+	case Data::DTILE_LADDER_DOWN:
+		if (facingUpDown)
+			drawLadderDownFaceOn(distance + 1);
+		else
+			drawLadderDownSideways(distance + 1);
+		break;
+	case Data::DTILE_LADDER_UP:
+		if (facingUpDown)
+			drawLadderUpFaceOn(distance + 1);
+		else
+			drawLadderUpSideways(distance + 1);
+		break;
+	case Data::DTILE_BEAMS:
+		drawBeams(distance);
+		break;
+	default:
+		break;
+	}
+
+	if (cell._itemId == Data::DITEM_COFFIN)
+		drawCoffin(distance + 1);
+	else if (cell._itemId == Data::DITEM_CHEST)
+		drawChest(distance + 1);
+}
+
+void DungeonMap::dungeonDrawWidget(const uint8 *data, int distance, int color) {
+	// Distance-1, clamped to 0-4 via an unsigned comparison, so a distance
+	// of 0 (the player's own cell) wraps around and also clamps to 4
+	int tier = distance - 1;
+	if ((uint)tier > 4)
+		tier = 4;
+
+	// The farthest tier gets shrunk down one extra bit beyond the others
+	int bitShift = (tier == 4) ? tier + 1 : tier;
+	int offsetY = UWIDGET_OFFSET_Y[tier];
+
+	auto s = getSurface();
+	Common::Point pen;
+	int idx = 0;
+
+	for (;;) {
+		int8 val = data[idx++];
+		if (val == 127)
+			break;
+
+		bool moveTo = (val == 126);
+		int8 xByte = moveTo ? data[idx++] : val;
+		int8 yByte = data[idx++];
+
+		int x = (xByte >> bitShift) + 160;
+		int y = (yByte >> bitShift) + offsetY;
+
+		if (moveTo) {
+			pen = Common::Point(x, y);
+		} else {
+			s.drawLine(pen.x, pen.y, x, y, color);
+			pen = Common::Point(x, y);
+		}
+	}
+}
+
+void DungeonMap::drawCoffin(int distance) {
+	// TODO: show "Coffin" in the commands area (writeStringNewline in the
+	// original) - that belongs to DungeonLogic, as with monster names
+	dungeonDrawWidget(COFFIN_DRAW_DATA, distance, EDGE_COLOR);
+}
+
+void DungeonMap::drawChest(int distance) {
+	// TODO: show "Chest" in the commands area (writeStringNewline in the
+	// original) - that belongs to DungeonLogic, as with monster names.
+	// Reuses the mimic's widget shape, since the original draws chests and
+	// mimics identically
+	dungeonDrawWidget(UWIDGET_DRAW_TABLE[UMONS_MIMIC], distance, EDGE_COLOR);
+}
+
+void DungeonMap::dungeonDrawMonster(int monsterId, int distance) {
+	if (distance >= 5)
+		return;
+
+	// TODO: show the monster's name in the commands area (writeStringNewline
+	// with UNDERWORLD_MONSTERS[monsterId] in the original) - that belongs
+	// to DungeonLogic, once it exists there
+
+	if (monsterId == UMONS_GELATINOUS_CUBE) {
+		// The cube fills the whole passage rather than using a widget shape
+		drawWall(distance);
+		drawLeftEdge(distance);
+		drawRightEdge(distance);
+	} else {
+		dungeonDrawWidget(UWIDGET_DRAW_TABLE[monsterId], distance, EDGE_COLOR);
+	}
+}
+
+void DungeonMap::drawDungeonView() {
+	const auto &pos = _G(savegame)._locationPosition;
+
+	int deltaX = getDirDeltaX();
+	int deltaY = getDirDeltaY();
+
+	int leftDeltaX = 0, leftDeltaY = 0, rightDeltaX = 0, rightDeltaY = 0;
+	switch (_G(savegame)._dungeonDirection) {
+	case Data::DIR_UP:
+		leftDeltaX = -1;
+		rightDeltaX = 1;
+		break;
+	case Data::DIR_DOWN:
+		leftDeltaX = 1;
+		rightDeltaX = -1;
+		break;
+	case Data::DIR_RIGHT:
+		leftDeltaY = -1;
+		rightDeltaY = 1;
+		break;
+	case Data::DIR_LEFT:
+		leftDeltaY = 1;
+		rightDeltaY = -1;
+		break;
+	default:
+		break;
+	}
+
+	auto s = getSurface();
+	s.fillRect(TextRect(1, 1, 38, 18), 0);
+	drawFacingDirection();
+
+	const Data::DungeonCell ownCell = cellAt(pos.x, pos.y);
+	bool isDoor = ownCell._tileNum == Data::DTILE_DOOR;
+	bool isWall = ownCell._tileNum == Data::DTILE_SECRET_DOOR || ownCell._tileNum == Data::DTILE_WALL;
+
+	int distance = distanceToOccupiedCell(deltaX, deltaY);
+
+	if (isWall) {
+		drawWall(0);
+		return;
+	}
+
+	int index = distance;
+	int backX = deltaX * index, backY = deltaY * index;
+	int currDeltaX = backX, currDeltaY = backY;
+	bool skipToEnd = false;
+
+	if (isDoor) {
+		// A secret door diagonally adjacent while standing in a doorway
+		// forces an immediate wall, skipping the rest of the view
+		int t1 = cellAt(pos.x + leftDeltaX, pos.y + leftDeltaY)._tileNum;
+		int t2 = cellAt(pos.x + leftDeltaX, pos.y + deltaY)._tileNum;
+		if (t1 != Data::DTILE_WALL && t1 != Data::DTILE_DOOR && t2 == Data::DTILE_SECRET_DOOR) {
+			drawWall(0);
+			skipToEnd = true;
+		}
+	}
+
+	if (!skipToEnd) {
+		if (isDoor)
+			drawDoorway(0);
+
+		bool endingLeft = false, endingRight = false;
+		bool leftSolid = false, rightSolid = false;
+
+		while (index > 0) {
+			currDeltaX -= deltaX;
+			currDeltaY -= deltaY;
+
+			// Skip re-deriving the flanking walls for the innermost tier
+			// when standing in a doorway - already handled above
+			if (!(isDoor && index == 1)) {
+				int currX = pos.x + currDeltaX;
+				int currY = pos.y + currDeltaY;
+				int leftTile = cellAt(currX + leftDeltaX, currY + leftDeltaY)._tileNum;
+				int rightTile = cellAt(currX + rightDeltaX, currY + rightDeltaY)._tileNum;
+
+				drawLeftCell(index, leftTile);
+				drawRightCell(index, rightTile);
+
+				bool newLeftSolid = isSolidTile(leftTile);
+				bool newRightSolid = isSolidTile(rightTile);
+
+				if (index == distance) {
+					endingLeft = newLeftSolid;
+					endingRight = newRightSolid;
+				} else {
+					if (leftSolid != newLeftSolid)
+						drawLeftEdge(index);
+					if (rightSolid != newRightSolid)
+						drawRightEdge(index);
+				}
+
+				leftSolid = newLeftSolid;
+				rightSolid = newRightSolid;
+			}
+
+			int xp = pos.x + currDeltaX + deltaX;
+			int yp = pos.y + currDeltaY + deltaY;
+			dungeonDrawCell(index, xp, yp);
+
+			--index;
+		}
+
+		if (!isDoor)
+			dungeonDrawCell(0, pos.x, pos.y);
+
+		int backTileNum = cellAt(pos.x + backX, pos.y + backY)._tileNum;
+		if (isMonsterBlocking(pos.x + backX, pos.y + backY) && backTileNum != Data::DTILE_DOOR && distance < 5) {
+			// A monster is blocking the view just past the last drawn
+			// tier, so cap the view with one more tier right behind it
+			int leftTile = cellAt(pos.x + leftDeltaX + backX, pos.y + leftDeltaY + backY)._tileNum;
+			int rightTile = cellAt(pos.x + rightDeltaX + backX, pos.y + rightDeltaY + backY)._tileNum;
+
+			drawLeftCell(distance + 1, leftTile);
+			drawRightCell(distance + 1, rightTile);
+
+			if (!isSolidTile(leftTile))
+				drawLeftEdge(distance);
+			if (!isSolidTile(rightTile))
+				drawRightEdge(distance);
+
+		} else {
+			if (endingLeft)
+				drawLeftEdge(distance);
+			if (endingRight)
+				drawRightEdge(distance);
+		}
+	}
+
+	if (isDoor) {
+		if (ownCell._itemId == Data::DITEM_COFFIN)
+			drawCoffin(1);
+		else if (ownCell._itemId == Data::DITEM_CHEST)
+			drawChest(1);
+	}
 }
 
 } // namespace Views
diff --git a/engines/ultima/ultima1/views/dungeon_map.h b/engines/ultima/ultima1/views/dungeon_map.h
index 935476965ee..bdcfc02fb53 100644
--- a/engines/ultima/ultima1/views/dungeon_map.h
+++ b/engines/ultima/ultima1/views/dungeon_map.h
@@ -24,6 +24,7 @@
 
 #include "ultima/ultima1/views/dialog.h"
 #include "ultima/ultima1/data/map.h"
+#include "ultima/ultima1/data/map_dungeon.h"
 
 namespace Ultima {
 namespace Ultima1 {
@@ -32,6 +33,143 @@ namespace Views {
 using namespace Shared::Messages;
 
 class DungeonMap : public Dialog {
+private:
+	/**
+	 * Returns the cell at a given position, or a solid wall cell if the
+	 * position is outside the dungeon's bounds
+	 */
+	Data::DungeonCell cellAt(int x, int y) const;
+
+	/**
+	 * Returns the X/Y delta of a single step in the direction the player
+	 * is currently facing
+	 */
+	int getDirDeltaX() const;
+	int getDirDeltaY() const;
+
+	/**
+	 * Returns true if a monster occupying a cell should block the view -
+	 * disguised/see-through monster types don't
+	 */
+	bool isMonsterBlocking(int x, int y) const;
+
+	/**
+	 * Returns true if the cell a given offset from the player blocks the
+	 * view, either because it's solid or because a monster is there
+	 */
+	bool isCellOccupied(int deltaX, int deltaY) const;
+
+	/**
+	 * Returns how many tiles ahead, in a given direction, the view extends
+	 * before it's blocked, capped at 5
+	 */
+	int distanceToOccupiedCell(int deltaX, int deltaY) const;
+
+	/**
+	 * Returns true for tiles that block movement/view (walls, doors,
+	 * secret doors) - false for hallways, ladders, and support beams
+	 */
+	bool isSolidTile(int tileNum) const;
+
+	/**
+	 * Shows the direction the player is currently facing at the top of
+	 * the view
+	 */
+	void drawFacingDirection();
+
+	/**
+	 * Draws the wall directly facing the player at a given distance
+	 */
+	void drawWall(int distance);
+
+	/**
+	 * Draws the receding side wall connecting distance-1 to distance, on
+	 * the left/right
+	 */
+	void drawLeftWall(int distance);
+	void drawRightWall(int distance);
+
+	/**
+	 * Draws the open threshold framing a side passage at a given distance,
+	 * on the left/right
+	 */
+	void drawLeftBlank(int distance);
+	void drawRightBlank(int distance);
+
+	/**
+	 * Draws the vertical edge marking where a side wall starts/stops at a
+	 * given distance, on the left/right
+	 */
+	void drawLeftEdge(int distance);
+	void drawRightEdge(int distance);
+
+	/**
+	 * Draws a doorway set into the left/right flanking wall at a given
+	 * distance
+	 */
+	void drawLeftDoor(int distance);
+	void drawRightDoor(int distance);
+
+	/**
+	 * Draws the doorway directly facing the player at a given distance
+	 */
+	void drawDoorway(int distance);
+
+	/**
+	 * Draws a row of horizontal ceiling support beams across the passage
+	 * at a given distance
+	 */
+	void drawBeams(int distance);
+
+	/**
+	 * Draws a ladder (its "hole" opening plus shaft) at a given distance.
+	 * The face-on variants are used when facing up/down the dungeon grid,
+	 * the sideways variants when facing left/right, since the ladder's
+	 * shaft is only visible face-on
+	 */
+	void drawLadderUpFaceOn(int distance);
+	void drawLadderDownFaceOn(int distance);
+	void drawLadderUpSideways(int distance);
+	void drawLadderDownSideways(int distance);
+
+	/**
+	 * Draws the left/right flanking cell at a given distance, based on its
+	 * tile type
+	 */
+	void drawLeftCell(int distance, int tileNum);
+	void drawRightCell(int distance, int tileNum);
+
+	/**
+	 * Draws the cell directly ahead at a given distance
+	 */
+	void dungeonDrawCell(int distance, int x, int y);
+
+	/**
+	 * Draws a monster/item widget shape - a small polyline figure made up
+	 * of moveto/lineto segments with coordinates relative to screen
+	 * center, scaled down the further away it is
+	 */
+	void dungeonDrawWidget(const uint8 *data, int distance, int color);
+
+	/**
+	 * Draws whichever monster occupies a cell. The gelatinous cube fills
+	 * the whole passage instead of using a widget shape
+	 */
+	void dungeonDrawMonster(int monsterId, int distance);
+
+	/**
+	 * Draws a coffin or chest widget at a given distance. In the original
+	 * these (writeCoffin/writeChest) also print the item's name in the
+	 * commands area - that's left for DungeonLogic, as with monster names
+	 */
+	void drawCoffin(int distance);
+	void drawChest(int distance);
+
+	/**
+	 * Draws the full first-person dungeon corridor view
+	 */
+	void drawDungeonView();
+
 public:
 	DungeonMap() : Dialog("DungeonMap") {}
 	~DungeonMap() override {}


Commit: d525a53560ca7f9dae23b7b81cfd6423db46751f
    https://github.com/scummvm/scummvm/commit/d525a53560ca7f9dae23b7b81cfd6423db46751f
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:40:49+11:00

Commit Message:
ULTIMA: ULTIMA1: Dungeon move, climb actions

Changed paths:
    engines/ultima/ultima1/logic/dungeon_logic.cpp
    engines/ultima/ultima1/logic/dungeon_logic.h


diff --git a/engines/ultima/ultima1/logic/dungeon_logic.cpp b/engines/ultima/ultima1/logic/dungeon_logic.cpp
index 851c1931046..e6088509742 100644
--- a/engines/ultima/ultima1/logic/dungeon_logic.cpp
+++ b/engines/ultima/ultima1/logic/dungeon_logic.cpp
@@ -39,7 +39,199 @@ void DungeonLogic::entering() {
 	_G(savegame)._dungeonExitHitPoints = 0;
 }
 
+int DungeonLogic::getDirDeltaX() const {
+	switch (_G(savegame)._dungeonDirection) {
+	case Data::DIR_RIGHT:
+		return 1;
+	case Data::DIR_LEFT:
+		return -1;
+	default:
+		return 0;
+	}
+}
+
+int DungeonLogic::getDirDeltaY() const {
+	switch (_G(savegame)._dungeonDirection) {
+	case Data::DIR_UP:
+		return -1;
+	case Data::DIR_DOWN:
+		return 1;
+	default:
+		return 0;
+	}
+}
+
+bool DungeonLogic::isBlocked(int deltaX, int deltaY) const {
+	const auto &pos = _G(savegame)._locationPosition;
+	const Data::DungeonCell &destCell = _G(dungeon)._cells[pos.y + deltaY][pos.x + deltaX];
+
+	if (destCell._tileNum == Data::DTILE_WALL || destCell._tileNum == Data::DTILE_SECRET_DOOR ||
+			destCell._tileNum == Data::DTILE_BEAMS)
+		return true;
+
+	if (destCell._tileNum == Data::DTILE_DOOR) {
+		// A door only blocks if the player is already standing on one -
+		// otherwise stepping through it is allowed
+		if (_G(dungeon)._cells[pos.y][pos.x]._tileNum == Data::DTILE_DOOR)
+			return true;
+	}
+
+	return destCell._monsterId != Data::DUNGEON_NO_MONSTER;
+}
+
+void DungeonLogic::turnLeft() {
+	writeString("Turn left\n");
+
+	switch (_G(savegame)._dungeonDirection) {
+	case Data::DIR_LEFT:
+		_G(savegame)._dungeonDirection = Data::DIR_DOWN;
+		break;
+	case Data::DIR_RIGHT:
+		_G(savegame)._dungeonDirection = Data::DIR_UP;
+		break;
+	case Data::DIR_UP:
+		_G(savegame)._dungeonDirection = Data::DIR_LEFT;
+		break;
+	case Data::DIR_DOWN:
+		_G(savegame)._dungeonDirection = Data::DIR_RIGHT;
+		break;
+	}
+}
+
+void DungeonLogic::turnRight() {
+	writeString("Turn right\n");
+
+	switch (_G(savegame)._dungeonDirection) {
+	case Data::DIR_LEFT:
+		_G(savegame)._dungeonDirection = Data::DIR_UP;
+		break;
+	case Data::DIR_RIGHT:
+		_G(savegame)._dungeonDirection = Data::DIR_DOWN;
+		break;
+	case Data::DIR_UP:
+		_G(savegame)._dungeonDirection = Data::DIR_RIGHT;
+		break;
+	case Data::DIR_DOWN:
+		_G(savegame)._dungeonDirection = Data::DIR_LEFT;
+		break;
+	}
+}
+
+void DungeonLogic::turnAround() {
+	writeString("Turn around\n");
+
+	switch (_G(savegame)._dungeonDirection) {
+	case Data::DIR_LEFT:
+		_G(savegame)._dungeonDirection = Data::DIR_RIGHT;
+		break;
+	case Data::DIR_RIGHT:
+		_G(savegame)._dungeonDirection = Data::DIR_LEFT;
+		break;
+	case Data::DIR_UP:
+		_G(savegame)._dungeonDirection = Data::DIR_DOWN;
+		break;
+	case Data::DIR_DOWN:
+		_G(savegame)._dungeonDirection = Data::DIR_UP;
+		break;
+	}
+}
+
+void DungeonLogic::moveForward() {
+	int deltaX = getDirDeltaX();
+	int deltaY = getDirDeltaY();
+
+	writeString("Forward");
+
+	if (isBlocked(deltaX, deltaY)) {
+		playFX(0);
+		writeString(" - path blocked!\n");
+	} else {
+		_G(savegame)._locationPosition.x += deltaX;
+		_G(savegame)._locationPosition.y += deltaY;
+		writeString("\n");
+	}
+}
+
+void DungeonLogic::climbLadderUp() {
+	Data::Savegame &sg = _G(savegame);
+	--sg._dungeonLevel;
+	writeString(" up to level %d\n", sg._dungeonLevel);
+
+	if (sg._dungeonLevel == 0) {
+		// Exiting the dungeon back to the overworld
+		int hp = sg._hits + sg._dungeonExitHitPoints;
+		if (hp > 9999)
+			sg._dungeonExitHitPoints = 9999 - sg._hits;
+
+		if (sg._dungeonExitHitPoints != 0) {
+			writeString("Thou dost gain %d hit ", sg._dungeonExitHitPoints);
+			if (sg._dungeonExitHitPoints > 999)
+				writeString("\n");
+			writeString("points\n");
+
+			sg._hits += sg._dungeonExitHitPoints;
+			redrawStats();
+		}
+
+		_G(map).load(Data::MAP_OVERWORLD);
+	} else {
+		_G(dungeon).generateDungeonLevel();
+		_G(dungeon)._cells[sg._locationPosition.y][sg._locationPosition.x]._monsterId = Data::DUNGEON_NO_MONSTER;
+	}
+}
+
+void DungeonLogic::climbLadderDown() {
+	Data::Savegame &sg = _G(savegame);
+	++sg._dungeonLevel;
+	writeString(" down to level %d\n", sg._dungeonLevel);
+
+	_G(dungeon).generateDungeonLevel();
+}
+
 bool DungeonLogic::move(Data::Direction dir) {
+	switch (dir) {
+	case Data::DIR_LEFT:
+		turnLeft();
+		break;
+	case Data::DIR_RIGHT:
+		turnRight();
+		break;
+	case Data::DIR_UP:
+		moveForward();
+		break;
+	case Data::DIR_DOWN:
+		turnAround();
+		break;
+	}
+
+	return true;
+}
+
+bool DungeonLogic::climb() {
+	writeString("K-Limb");
+
+	const Common::Point &pos = _G(savegame)._locationPosition;
+	Data::DungeonTileId tileNum = _G(dungeon)._cells[pos.y][pos.x]._tileNum;
+
+	if (tileNum != Data::DTILE_LADDER_UP && tileNum != Data::DTILE_LADDER_DOWN) {
+		writeString(" what?\n");
+		playFX(1);
+		return true;
+	}
+
+	if (_G(savegame)._dungeonDirection == Data::DIR_LEFT ||
+			_G(savegame)._dungeonDirection == Data::DIR_RIGHT) {
+		writeString("\n");
+		writeString("Thou must face the ladder!\n");
+		playFX(1);
+		return true;
+	}
+
+	if (tileNum == Data::DTILE_LADDER_UP)
+		climbLadderUp();
+	else
+		climbLadderDown();
+
 	return true;
 }
 
diff --git a/engines/ultima/ultima1/logic/dungeon_logic.h b/engines/ultima/ultima1/logic/dungeon_logic.h
index 86daec8f752..98e8c5526fd 100644
--- a/engines/ultima/ultima1/logic/dungeon_logic.h
+++ b/engines/ultima/ultima1/logic/dungeon_logic.h
@@ -30,12 +30,57 @@ namespace Ultima1 {
 namespace Logic {
 
 class DungeonLogic : public Logic {
+private:
+	/**
+	 * Returns the X/Y delta of a single step in the direction the player
+	 * is currently facing
+	 */
+	int getDirDeltaX() const;
+	int getDirDeltaY() const;
+
+	/**
+	 * Returns true if moving by the given delta from the player's current
+	 * position would be blocked - by a wall, secret door, support beam,
+	 * a closed door (when already standing on one), or a monster
+	 */
+	bool isBlocked(int deltaX, int deltaY) const;
+
+	/**
+	 * Rotates the player's facing direction 90 degrees left or right,
+	 * without moving
+	 */
+	void turnLeft();
+	void turnRight();
+
+	/**
+	 * Rotates the player's facing direction 180 degrees, without moving
+	 */
+	void turnAround();
+
+	/**
+	 * Moves the player one step in the direction they're currently
+	 * facing, provided the way isn't blocked
+	 */
+	void moveForward();
+
+	/**
+	 * Climbs the ladder at the player's current position up/down a level.
+	 * Climbing up from level 1 exits the dungeon back to the overworld
+	 */
+	void climbLadderUp();
+	void climbLadderDown();
+
 protected:
 	/**
 	 * Handle dungeon movement
 	 */
 	bool move(Data::Direction dir) override;
 
+	/**
+	 * Handles climbing a ladder at the player's current position
+	 */
+	bool climb() override;
+
 	/**
 	 * Handles updating creatures/NPCs
 	 */


Commit: cfd3298dbfb3d7fa31bd9524123512a480067305
    https://github.com/scummvm/scummvm/commit/cfd3298dbfb3d7fa31bd9524123512a480067305
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:40:50+11:00

Commit Message:
ULTIMA: ULTIMA1: Saving dungeon state

Changed paths:
    engines/ultima/ultima1/data/map_dungeon.h
    engines/ultima/ultima1/logic/overworld_logic.cpp


diff --git a/engines/ultima/ultima1/data/map_dungeon.h b/engines/ultima/ultima1/data/map_dungeon.h
index 95e50638b07..277c3723df5 100644
--- a/engines/ultima/ultima1/data/map_dungeon.h
+++ b/engines/ultima/ultima1/data/map_dungeon.h
@@ -22,7 +22,7 @@
 #ifndef ULTIMA1_DATA_MAP_DUNGEON_H
 #define ULTIMA1_DATA_MAP_DUNGEON_H
 
-#include "common/scummsys.h"
+#include "common/serializer.h"
 
 namespace Ultima {
 namespace Ultima1 {
@@ -64,6 +64,8 @@ struct DungeonCell {
 	uint8 _monsterId;
 	uint8 _itemId;
 	uint16 _monsterHp;
+
+	void synchronize(Common::Serializer &s);
 };
 
 struct MapDungeon {
@@ -107,6 +109,8 @@ public:
 	 * Generates a dungeon level
 	 */
 	void generateDungeonLevel();
+
+	void synchronize(Common::Serializer &s);
 };
 
 } // namespace Data
diff --git a/engines/ultima/ultima1/logic/overworld_logic.cpp b/engines/ultima/ultima1/logic/overworld_logic.cpp
index c40a7d026a3..1245bfe252c 100644
--- a/engines/ultima/ultima1/logic/overworld_logic.cpp
+++ b/engines/ultima/ultima1/logic/overworld_logic.cpp
@@ -88,7 +88,7 @@ bool OverworldLogic::enter() {
 		_G(map)._isLordBritishCastle = location == 33;
 
 		Common::String msg = "Entering...\n";
-		if (!_G(map)._isLordBritishCastle)
+		if (location < 33)
 			msg += "The city of ";
 		msg += Data::LOCATION_NAMES[location - 1];
 		msg += "\n";


Commit: 5a651068a72259bbe271f464edc237390a20280e
    https://github.com/scummvm/scummvm/commit/5a651068a72259bbe271f464edc237390a20280e
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:40:50+11:00

Commit Message:
ULTIMA: ULTIMA1: Fix re-entering dungeons

Changed paths:
    engines/ultima/ultima1/data/savegame.h
    engines/ultima/ultima1/logic/dungeon_logic.cpp


diff --git a/engines/ultima/ultima1/data/savegame.h b/engines/ultima/ultima1/data/savegame.h
index e8c9d0d7072..ef608e31b45 100644
--- a/engines/ultima/ultima1/data/savegame.h
+++ b/engines/ultima/ultima1/data/savegame.h
@@ -183,7 +183,7 @@ public:
 	int16 _freeingPrincess = 0;
 	int16 _castleItemAllowance = 0;
 	int16 _castleKeyVal = 0;
-	uint8 _dungeonLevel = 0;
+	uint8 _dungeonLevel = 1;
 	uint8 _dungeonDirection = 4;
 	uint16 _dungeonExitHitPoints = 0;
 
diff --git a/engines/ultima/ultima1/logic/dungeon_logic.cpp b/engines/ultima/ultima1/logic/dungeon_logic.cpp
index e6088509742..11f6327d359 100644
--- a/engines/ultima/ultima1/logic/dungeon_logic.cpp
+++ b/engines/ultima/ultima1/logic/dungeon_logic.cpp
@@ -30,6 +30,8 @@ namespace Logic {
 
 DungeonLogic::DungeonLogic() {
 	_G(map)._mapType = Data::MAPTYPE_DUNGEON;
+	if (_G(savegame)._dungeonLevel == 0)
+		_G(savegame)._dungeonLevel = 1;
 }
 
 void DungeonLogic::entering() {


Commit: 2585e8d3a4030ffd736ad1d723b9baa315983b6d
    https://github.com/scummvm/scummvm/commit/2585e8d3a4030ffd736ad1d723b9baa315983b6d
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:40:50+11:00

Commit Message:
ULTIMA: ULTIMA1: Adding artificial delay after showing lines in Commands area

Changed paths:
    engines/ultima/shared/engine/events.cpp
    engines/ultima/shared/engine/events.h
    engines/ultima/ultima1/views/commands.cpp
    engines/ultima/ultima1/views/commands.h


diff --git a/engines/ultima/shared/engine/events.cpp b/engines/ultima/shared/engine/events.cpp
index 7a16fba063d..c2e7d27e71a 100644
--- a/engines/ultima/shared/engine/events.cpp
+++ b/engines/ultima/shared/engine/events.cpp
@@ -60,7 +60,8 @@ void Events::runGame(Views &views) {
 				_views.clear();
 				break;
 			} else {
-				processEvent(e);
+				if (processEvent(e))
+					break;
 			}
 		}
 
@@ -79,7 +80,7 @@ void Events::runGame(Views &views) {
 	delete _screen;
 }
 
-void Events::processEvent(Common::Event &ev) {
+bool Events::processEvent(Common::Event &ev) {
 	switch (ev.type) {
 	case Common::EVENT_KEYDOWN:
 		if (ev.kbd.keycode < Common::KEYCODE_NUMLOCK)
@@ -100,10 +101,12 @@ void Events::processEvent(Common::Event &ev) {
 		break;
 	case Common::EVENT_MOUSEMOVE:
 		msgMouseMove(MouseMoveMessage(ev.type, ev.mouse));
-		break;
+		return false;
 	default:
-		break;
+		return false;
 	}
+
+	return true;
 }
 
 void Events::replaceView(UIElement *ui, bool replaceAllViews) {
@@ -200,6 +203,11 @@ void Events::pauseMillis(uint millis) {
 	g_system->delayMillis(millis);
 }
 
+void Events::updateScreen() {
+	_screen->update();
+
+}
+
 /*------------------------------------------------------------------------*/
 
 Bounds::Bounds(Common::Rect &innerBounds) :
diff --git a/engines/ultima/shared/engine/events.h b/engines/ultima/shared/engine/events.h
index ec3e7ebd9a4..715e8452a61 100644
--- a/engines/ultima/shared/engine/events.h
+++ b/engines/ultima/shared/engine/events.h
@@ -299,8 +299,10 @@ private:
 protected:
 	/**
 	 * Process an event
+	 * @param ev		Event to process
+	 * @returns			True if no further events should be handled this game frame
 	 */
-	void processEvent(Common::Event &ev);
+	bool processEvent(Common::Event &ev);
 
 	/**
 	 * Returns true if the game should quit
@@ -446,6 +448,11 @@ public:
 	 * entire event loop and screen updates.
 	 */
 	void pauseMillis(uint millis = 10);
+
+	/**
+	 * Updates the screen
+	 */
+	void updateScreen();
 };
 
 extern Events *g_events;
diff --git a/engines/ultima/ultima1/views/commands.cpp b/engines/ultima/ultima1/views/commands.cpp
index abae2b8bc1e..55fc88e7174 100644
--- a/engines/ultima/ultima1/views/commands.cpp
+++ b/engines/ultima/ultima1/views/commands.cpp
@@ -28,6 +28,7 @@ namespace Ultima1 {
 namespace Views {
 
 constexpr int COLOR_TEXT = 11;      // light cyan - normal values
+constexpr int NEWLINE_DELAY = 50;	// Delay after a newline
 
 Commands::Commands(UIElement *parent) : Shared::UIElement("Commands", parent), _textCursor("CommandsCursor", this) {
 }
@@ -60,6 +61,9 @@ bool Commands::msgGame(const GameMessage &msg) {
 	} else if (msg._name == "PROMPT") {
 		prompt();
 		return true;
+	} else if (msg._name == "DELAY") {
+		delay(msg._value);
+		return true;
 	}
 
 	return false;
@@ -68,6 +72,10 @@ bool Commands::msgGame(const GameMessage &msg) {
 void Commands::writeString(const Common::String &msg) {
 	_textCursor.hide();
 	_surface.writeString(msg);
+
+	if (msg.contains('\n')) {
+		delay(NEWLINE_DELAY);
+	}
 }
 
 void Commands::resetLine() {
@@ -86,6 +94,11 @@ void Commands::prompt() {
 	showCursor();
 }
 
+void Commands::delay(uint milli) {
+	g_engine->updateScreen();
+	g_engine->pauseMillis(NEWLINE_DELAY);
+}
+
 } // namespace Views
 } // namespace Ultima1
 } // namespace Ultima
diff --git a/engines/ultima/ultima1/views/commands.h b/engines/ultima/ultima1/views/commands.h
index 76e12792c4c..4a6c0b68cca 100644
--- a/engines/ultima/ultima1/views/commands.h
+++ b/engines/ultima/ultima1/views/commands.h
@@ -36,6 +36,14 @@ private:
 	Shared::Gfx::GfxSurface _surface;
 	Gfx::TextCursor _textCursor;
 
+	/**
+	 * Ensures the commands view is updated on-screen, and then delays for a set amount.
+	 * This is useful for ensuring text isn't scrolled too quickly off screen when there's
+	 * more lines than can fit within a single turn
+	 * @param milli		Delay amount in milliseconds
+	 */
+	void delay(uint milli);
+
 public:
 	Commands(UIElement *parent);
 	~Commands() override {}


Commit: 710b987dc0befd98b1f2deaf49d7efb87b21c22f
    https://github.com/scummvm/scummvm/commit/710b987dc0befd98b1f2deaf49d7efb87b21c22f
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:40:50+11:00

Commit Message:
ULTIMA: ULTIMA1: Show attack animations in the overworld

Changed paths:
    engines/ultima/shared/engine/events.h
    engines/ultima/shared/engine/messages.h
    engines/ultima/ultima1/data/tiles.h
    engines/ultima/ultima1/logic/logic.cpp
    engines/ultima/ultima1/logic/logic.h
    engines/ultima/ultima1/logic/overworld_logic.cpp
    engines/ultima/ultima1/views/location_map.cpp
    engines/ultima/ultima1/views/location_map.h
    engines/ultima/ultima1/views/overworld_map.cpp
    engines/ultima/ultima1/views/overworld_map.h


diff --git a/engines/ultima/shared/engine/events.h b/engines/ultima/shared/engine/events.h
index 715e8452a61..3d25581f81f 100644
--- a/engines/ultima/shared/engine/events.h
+++ b/engines/ultima/shared/engine/events.h
@@ -281,6 +281,7 @@ public:
 	MESSAGE(Action);
 	MESSAGE(Game);
 	MESSAGE(Value);
+	MESSAGE(AttackTile);
 #undef MESSAGE
 };
 
diff --git a/engines/ultima/shared/engine/messages.h b/engines/ultima/shared/engine/messages.h
index 1e036ce1757..fc1d27183ab 100644
--- a/engines/ultima/shared/engine/messages.h
+++ b/engines/ultima/shared/engine/messages.h
@@ -128,6 +128,27 @@ struct ActionMessage : public Message {
 	}
 };
 
+/**
+ * Sent to a map view to have it briefly overlay a tile directly on-screen
+ * at a given map position - e.g. a projectile flying towards the player,
+ * or a hit flash - before restoring the view back to normal. (x, y) are
+ * in map/world tile coordinates, not screen pixels; it's up to the view
+ * receiving the message to convert that to its own on-screen position.
+ * The handler is expected to pause briefly before returning, so combat
+ * logic that shows several of these in a row (e.g. multiple attackers in
+ * a single turn) will naturally have each shown with a delay in turn
+ */
+struct AttackTileMessage : public Message {
+	int _x, _y;
+	int _tileId;
+
+	AttackTileMessage() : Message(), _x(0), _y(0), _tileId(0) {
+	}
+	AttackTileMessage(int x, int y, int tileId) : Message(),
+		_x(x), _y(y), _tileId(tileId) {
+	}
+};
+
 } // namespace Messages
 } // namespace Shared
 } // namespace Ultima
diff --git a/engines/ultima/ultima1/data/tiles.h b/engines/ultima/ultima1/data/tiles.h
index 43ce65b7ece..0214618e287 100644
--- a/engines/ultima/ultima1/data/tiles.h
+++ b/engines/ultima/ultima1/data/tiles.h
@@ -53,7 +53,10 @@ enum OverworldTileId {
 	TILE_TIME_MACHINE = 18,
 	TILE_FIRST_MONSTER = 19,
 	TILE_WANDERING_WARLOCK = 47,
-	TILE_LAST_MONSTER = 47
+	TILE_LAST_MONSTER = 47,
+	// Attack projectile/impact glyph, flashed briefly over the map during
+	// combat animations
+	TILE_ATTACK = 50
 };
 
 enum LocationTileId {
diff --git a/engines/ultima/ultima1/logic/logic.cpp b/engines/ultima/ultima1/logic/logic.cpp
index 63c9feea847..988524b99a3 100644
--- a/engines/ultima/ultima1/logic/logic.cpp
+++ b/engines/ultima/ultima1/logic/logic.cpp
@@ -54,6 +54,10 @@ void Logic::redrawMap() {
 	g_engine->focusedView()->redraw();
 }
 
+void Logic::showAttackTile(int x, int y, int tileId) {
+	g_engine->focusedView()->send(AttackTileMessage(x, y, tileId));
+}
+
 void Logic::redrawStats() {
 	g_engine->findView("Stats")->draw();
 }
diff --git a/engines/ultima/ultima1/logic/logic.h b/engines/ultima/ultima1/logic/logic.h
index 8ea9e52cf36..1e6309ccfd8 100644
--- a/engines/ultima/ultima1/logic/logic.h
+++ b/engines/ultima/ultima1/logic/logic.h
@@ -63,6 +63,14 @@ protected:
 	 */
 	void redrawMap();
 
+	/**
+	 * Has the currently focused map view briefly flash a tile on-screen at
+	 * a given map position - e.g. a projectile flying towards the player,
+	 * or a hit flash - pausing before returning. Used for combat
+	 * animations; see AttackTileMessage
+	 */
+	void showAttackTile(int x, int y, int tileId);
+
 	/**
 	 * Signal the stats to redraw
 	 */
diff --git a/engines/ultima/ultima1/logic/overworld_logic.cpp b/engines/ultima/ultima1/logic/overworld_logic.cpp
index 1245bfe252c..c32d56042be 100644
--- a/engines/ultima/ultima1/logic/overworld_logic.cpp
+++ b/engines/ultima/ultima1/logic/overworld_logic.cpp
@@ -420,26 +420,47 @@ void OverworldLogic::monsterMoveCheck(int entityIndex, int xDiff, int yDiff) {
 }
 
 void OverworldLogic::monsterAttack(int entityIndex, int xDiff, int yDiff, int distance) {
-	// WORKAROUND: the original animates the attack as a projectile flying
-	// tile-by-tile towards the player, using up to distance tiles and
-	// stopping early if it's blocked by mountains. That's purely visual and
-	// doesn't affect whether the attack hits, so it's skipped here
 	const auto &e = _G(savegame)._overworldEntities[entityIndex];
 	int monsterIdx = (e._type - Data::TILE_FIRST_MONSTER) / 2;
 
 	writeString(Data::OVERWORLD_MONSTERS[monsterIdx]);
 	writeString(" attacks!");
 
+	// Animate a projectile flying from the monster towards the player, one
+	// tile at a time, stopping early if it's blocked by mountains
+	int xDelta = (xDiff > 0) ? -1 : (xDiff < 0 ? 1 : 0);
+	int yDelta = (yDiff > 0) ? -1 : (yDiff < 0 ? 1 : 0);
+	const auto &pos = _G(savegame)._overworldPos;
+
+	int tempX, tempY, tile;
+	int attackCtr = 1;
+	for (;;) {
+		tempX = xDiff + xDelta * attackCtr;
+		tempY = yDiff + yDelta * attackCtr;
+
+		showAttackTile(pos.x - tempX, pos.y - tempY, Data::TILE_ATTACK);
+		tile = _G(map).getTileAt(pos.x - tempX, pos.y - tempY);
+
+		++attackCtr;
+		if (attackCtr > distance || tile == Data::TILE_MOUNTAINS || (tempX == 0 && tempY == 0))
+			break;
+	}
+
 	auto &sg = _G(savegame);
 	int roll = getRandomNumber(1, 255);
 	int threshold = 200 - sg._stamina / 2 - sg._equippedArmor * 8;
+	bool isHit = roll < threshold;
 
-	if (roll >= threshold) {
+	// A shot that got blocked or ran out of range before reaching the
+	// player always misses, regardless of the roll
+	if (tempX != 0 || tempY != 0 || !isHit) {
 		writeString("\n");
 		writeString("Missed!\n");
 		return;
 	}
 
+	showAttackTile(pos.x, pos.y, Data::TILE_ATTACK);
+
 	int damage = getRandomNumber(1, Data::OVERWORLD_MONSTERS_DAMAGE[monsterIdx] * 2 + 1);
 	playFX(2);
 
diff --git a/engines/ultima/ultima1/views/location_map.cpp b/engines/ultima/ultima1/views/location_map.cpp
index 088276aa618..8f3d4197fcf 100644
--- a/engines/ultima/ultima1/views/location_map.cpp
+++ b/engines/ultima/ultima1/views/location_map.cpp
@@ -31,6 +31,7 @@ constexpr int TILE_WIDTH = 8;
 constexpr int TILE_HEIGHT = 8;
 constexpr int MAP_VISIBLE_WIDTH = 38;
 constexpr int MAP_VISIBLE_HEIGHT = 18;
+constexpr int ATTACK_TILE_DELAY = 100;	// Delay after flashing an attack tile
 
 bool LocationMap::msgFocus(const FocusMessage &msg) {
 	MetaEngine::setKeybindingMode(KBMODE_GAMEPLAY);
@@ -43,6 +44,22 @@ bool LocationMap::msgUnfocus(const UnfocusMessage &msg) {
 	return Dialog::msgUnfocus(msg);
 }
 
+bool LocationMap::msgAttackTile(const AttackTileMessage &msg) {
+	if (msg._x >= 0 && msg._x < MAP_VISIBLE_WIDTH && msg._y >= 0 && msg._y < MAP_VISIBLE_HEIGHT) {
+		const Graphics::ManagedSurface *tiles = g_engine->_map.tiles();
+		auto s = getSurface();
+		s.blitFrom(tiles[msg._tileId], Common::Point(msg._x * TILE_WIDTH + 8, msg._y * TILE_HEIGHT + 8));
+
+		g_engine->updateScreen();
+		g_engine->pauseMillis(ATTACK_TILE_DELAY);
+
+		// Restore the map back to normal
+		draw();
+	}
+
+	return true;
+}
+
 void LocationMap::timeout() {
 	redraw();
 
diff --git a/engines/ultima/ultima1/views/location_map.h b/engines/ultima/ultima1/views/location_map.h
index 4b332ea9ee0..bcdd089a7b5 100644
--- a/engines/ultima/ultima1/views/location_map.h
+++ b/engines/ultima/ultima1/views/location_map.h
@@ -37,6 +37,7 @@ public:
 
 	bool msgFocus(const FocusMessage &msg) override;
 	bool msgUnfocus(const UnfocusMessage &msg) override;
+	bool msgAttackTile(const AttackTileMessage &msg) override;
 	void draw() override;
 	void timeout() override;
 };
diff --git a/engines/ultima/ultima1/views/overworld_map.cpp b/engines/ultima/ultima1/views/overworld_map.cpp
index 68fe8739ea5..ebd50981940 100644
--- a/engines/ultima/ultima1/views/overworld_map.cpp
+++ b/engines/ultima/ultima1/views/overworld_map.cpp
@@ -29,6 +29,7 @@ namespace Views {
 
 constexpr int TILE_WIDTH = 16;
 constexpr int TILE_HEIGHT = 16;
+constexpr int ATTACK_TILE_DELAY = 100;	// Delay after flashing an attack tile
 
 bool OverworldMap::msgFocus(const FocusMessage &msg) {
 	MetaEngine::setKeybindingMode(KBMODE_GAMEPLAY);
@@ -41,6 +42,27 @@ bool OverworldMap::msgUnfocus(const UnfocusMessage &msg) {
 	return Dialog::msgUnfocus(msg);
 }
 
+bool OverworldMap::msgAttackTile(const AttackTileMessage &msg) {
+	int mapLeft = _G(savegame)._overworldPos.x - Data::OVERWORLD_VISIBLE_CENTER_X;
+	int mapTop = _G(savegame)._overworldPos.y - Data::OVERWORLD_VISIBLE_CENTER_Y;
+	int ox = msg._x - mapLeft;
+	int oy = msg._y - mapTop;
+
+	if (ox >= 0 && ox < Data::OVERWORLD_VISIBLE_WIDTH && oy >= 0 && oy < Data::OVERWORLD_VISIBLE_HEIGHT) {
+		const Graphics::ManagedSurface *tiles = g_engine->_map.tiles();
+		auto s = getSurface();
+		s.blitFrom(tiles[msg._tileId], Common::Point(ox * TILE_WIDTH + 8, oy * TILE_HEIGHT + 8));
+
+		g_engine->updateScreen();
+		g_engine->pauseMillis(ATTACK_TILE_DELAY);
+
+		// Restore the map back to normal
+		draw();
+	}
+
+	return true;
+}
+
 void OverworldMap::timeout() {
 	animateWater();
 	++_animIndex;
diff --git a/engines/ultima/ultima1/views/overworld_map.h b/engines/ultima/ultima1/views/overworld_map.h
index a9e55f6741e..cbeec6a2206 100644
--- a/engines/ultima/ultima1/views/overworld_map.h
+++ b/engines/ultima/ultima1/views/overworld_map.h
@@ -60,6 +60,7 @@ public:
 
 	bool msgFocus(const FocusMessage &msg) override;
 	bool msgUnfocus(const UnfocusMessage &msg) override;
+	bool msgAttackTile(const AttackTileMessage &msg) override;
 	void draw() override;
 	void timeout() override;
 };


Commit: ba2b8e088f7ee34fda0b1988c72209b3aaef0793
    https://github.com/scummvm/scummvm/commit/ba2b8e088f7ee34fda0b1988c72209b3aaef0793
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:40:50+11:00

Commit Message:
ULTIMA: ULTIMA1: End of turn handling for the different map types

Changed paths:
    engines/ultima/ultima1/data/map_dungeon.cpp
    engines/ultima/ultima1/data/map_dungeon.h
    engines/ultima/ultima1/data/savegame.cpp
    engines/ultima/ultima1/data/savegame.h
    engines/ultima/ultima1/logic/dungeon_logic.cpp
    engines/ultima/ultima1/logic/dungeon_logic.h
    engines/ultima/ultima1/logic/logic.cpp
    engines/ultima/ultima1/logic/overworld_logic.cpp
    engines/ultima/ultima1/ultima1.h
    engines/ultima/ultima1/views/dungeon_map.cpp


diff --git a/engines/ultima/ultima1/data/map_dungeon.cpp b/engines/ultima/ultima1/data/map_dungeon.cpp
index 7f4b11f7d5d..d8cd8f2a80f 100644
--- a/engines/ultima/ultima1/data/map_dungeon.cpp
+++ b/engines/ultima/ultima1/data/map_dungeon.cpp
@@ -26,6 +26,13 @@ namespace Ultima {
 namespace Ultima1 {
 namespace Data {
 
+const char *UNDERWORLD_MONSTERS[] = {
+	"Ranger", "Skeleton", "Thief", "Giant rat", "Bat", "Spider", "Viper", "Orc",
+	"Cyclops", "Gelatinous cube", "Ettin", "Chest", "Lizard man", "Minatour",
+	"Carrion creeper", "Tangler", "Gremlin", "Wandering eyes", "Wraith", "Lich",
+	"Invisible seeker", "Mind whipper", "Zorn", "Daemon", "Balron"
+};
+
 MapDungeon::MapDungeon() {
 	clear();
 }
diff --git a/engines/ultima/ultima1/data/map_dungeon.h b/engines/ultima/ultima1/data/map_dungeon.h
index 277c3723df5..a4e83aab86c 100644
--- a/engines/ultima/ultima1/data/map_dungeon.h
+++ b/engines/ultima/ultima1/data/map_dungeon.h
@@ -39,6 +39,17 @@ constexpr int DUNGEON_MONSTER_SLOTS = 5;
 // _itemId sentinel does
 constexpr uint8 DUNGEON_NO_MONSTER = 0xff;
 
+// Disguised monster Ids that don't block movement/view like a normal
+// monster would - a mimic looks (and is named) like a chest, an
+// invisible seeker isn't visibly drawn at all, and a gelatinous cube
+// fills the passage but can still be seen/moved past
+constexpr int UMONS_GELATINOUS_CUBE = 9;
+constexpr int UMONS_MIMIC = 11;
+constexpr int UMONS_INVISIBLE_SEEKER = 20;
+
+// Dungeon monster names, indexed by DungeonCell::_monsterId (0-24)
+extern const char *UNDERWORLD_MONSTERS[];
+
 enum DungeonTileId {
 	DTILE_HALLWAY = 0,
 	DTILE_WALL = 1,
diff --git a/engines/ultima/ultima1/data/savegame.cpp b/engines/ultima/ultima1/data/savegame.cpp
index 20f42973447..ffcd0e2bca7 100644
--- a/engines/ultima/ultima1/data/savegame.cpp
+++ b/engines/ultima/ultima1/data/savegame.cpp
@@ -54,6 +54,9 @@ const char *GEM_NAMES[] = { "Red Gem", "Green Gem", "Blue Gem", "White Gem" };
 // Indexed by TransportType
 const int TRANSPORT_RANDOM_THRESHOLD[] = { 100, 50, 33, 100, 50, 25, 10, 10 };
 
+// Indexed by TransportType
+const int FOOD_PER_TRANSPORT[] = { 2, 3, 3, 4, 5, 6, 11, 0 };
+
 void LocationEntity::synchronize(Common::Serializer &s) {
 	s.syncAsSint16LE(_type);
 	s.syncAsSint16LE(_position.x);
diff --git a/engines/ultima/ultima1/data/savegame.h b/engines/ultima/ultima1/data/savegame.h
index ef608e31b45..9c874035e92 100644
--- a/engines/ultima/ultima1/data/savegame.h
+++ b/engines/ultima/ultima1/data/savegame.h
@@ -50,6 +50,11 @@ extern const char *GEM_NAMES[];
 // transports make it harder for monsters to keep up
 extern const int TRANSPORT_RANDOM_THRESHOLD[];
 
+// Per player-transport-type number of turns between each point of food
+// consumed - faster/hungrier transports (or none at all, for the time
+// machine) burn through food quicker
+extern const int FOOD_PER_TRANSPORT[];
+
 enum Sex {
 	SEX_MALE = 0, SEX_FEMALE = 1
 };
diff --git a/engines/ultima/ultima1/logic/dungeon_logic.cpp b/engines/ultima/ultima1/logic/dungeon_logic.cpp
index 11f6327d359..d7b52a90204 100644
--- a/engines/ultima/ultima1/logic/dungeon_logic.cpp
+++ b/engines/ultima/ultima1/logic/dungeon_logic.cpp
@@ -241,6 +241,61 @@ void DungeonLogic::updateCreatures() {
 	// TODO
 }
 
+void DungeonLogic::showNearbyText() {
+	const Common::Point &pos = _G(savegame)._locationPosition;
+
+	// A chest/coffin at the player's own feet is only noticed when they're
+	// standing in a doorway, matching the original's dungeonUpdate
+	const Data::DungeonCell &hereCell = _G(dungeon)._cells[pos.y][pos.x];
+	if (hereCell._tileNum == Data::DTILE_DOOR) {
+		if (hereCell._itemId == Data::DITEM_COFFIN)
+			writeString("Coffin\n");
+		else if (hereCell._itemId == Data::DITEM_CHEST)
+			writeString("Chest\n");
+	}
+
+	// Items/monsters visible ahead, in the direction currently faced, up to
+	// wherever the dungeon view itself would be blocked (capped at 5 tiles,
+	// matching the view's own render distance)
+	int deltaX = getDirDeltaX();
+	int deltaY = getDirDeltaY();
+	int x = pos.x, y = pos.y;
+
+	for (int distance = 1; distance <= 5; ++distance) {
+		x += deltaX;
+		y += deltaY;
+		const Data::DungeonCell &cell = _G(dungeon)._cells[y][x];
+
+		if (cell._itemId == Data::DITEM_COFFIN)
+			writeString("Coffin\n");
+		else if (cell._itemId == Data::DITEM_CHEST)
+			writeString("Chest\n");
+
+		bool hasMonster = cell._monsterId != Data::DUNGEON_NO_MONSTER;
+		if (hasMonster) {
+			writeString(Data::UNDERWORLD_MONSTERS[cell._monsterId]);
+			writeString("\n");
+		}
+
+		// Disguised monster types (mimic, invisible seeker, gelatinous
+		// cube) don't block the view/movement, so scanning continues past
+		// them - matching DungeonMap::isMonsterBlocking
+		bool isBlockingMonster = hasMonster && cell._monsterId != Data::UMONS_GELATINOUS_CUBE &&
+			cell._monsterId != Data::UMONS_MIMIC && cell._monsterId != Data::UMONS_INVISIBLE_SEEKER;
+
+		if (cell._tileNum == Data::DTILE_WALL || cell._tileNum == Data::DTILE_SECRET_DOOR ||
+				cell._tileNum == Data::DTILE_DOOR || isBlockingMonster)
+			break;
+	}
+}
+
+void DungeonLogic::endOfTurn() {
+	showNearbyText();
+
+	// Calls updateCreatures() in turn
+	Logic::endOfTurn();
+}
+
 } // namespace Logic
 } // namespace Ultima1
 } // namespace Ultima
diff --git a/engines/ultima/ultima1/logic/dungeon_logic.h b/engines/ultima/ultima1/logic/dungeon_logic.h
index 98e8c5526fd..064c5ac7c2d 100644
--- a/engines/ultima/ultima1/logic/dungeon_logic.h
+++ b/engines/ultima/ultima1/logic/dungeon_logic.h
@@ -70,6 +70,14 @@ private:
 	void climbLadderUp();
 	void climbLadderDown();
 
+	/**
+	 * Announces any item/monster close enough to the player to be shown in
+	 * the dungeon view - a chest or coffin at the player's own feet (only
+	 * noticed when standing in a doorway), and any item/monster along the
+	 * corridor directly ahead, up to wherever the view is blocked
+	 */
+	void showNearbyText();
+
 protected:
 	/**
 	 * Handle dungeon movement
@@ -86,6 +94,11 @@ protected:
 	 */
 	void updateCreatures() override;
 
+	/**
+	 * Called after an action is done
+	 */
+	void endOfTurn() override;
+
 public:
 	DungeonLogic();
 	~DungeonLogic() override {
diff --git a/engines/ultima/ultima1/logic/logic.cpp b/engines/ultima/ultima1/logic/logic.cpp
index 988524b99a3..190096c78db 100644
--- a/engines/ultima/ultima1/logic/logic.cpp
+++ b/engines/ultima/ultima1/logic/logic.cpp
@@ -76,6 +76,7 @@ int Logic::getRandomNumber(int maxNumber) {
 
 void Logic::endOfTurn() {
 	_G(moveCtr)++;
+	updateCreatures();
 
 	redrawMap();
 	redrawStats();
diff --git a/engines/ultima/ultima1/logic/overworld_logic.cpp b/engines/ultima/ultima1/logic/overworld_logic.cpp
index c32d56042be..0e562c1fd83 100644
--- a/engines/ultima/ultima1/logic/overworld_logic.cpp
+++ b/engines/ultima/ultima1/logic/overworld_logic.cpp
@@ -52,6 +52,7 @@ static const int8 DELTA_Y[5] = { 0, 0, 0, -1, 1 };
 
 OverworldLogic::OverworldLogic() {
 	_G(map)._mapType = Data::MAPTYPE_OVERWORLD;
+	_G(transportFoodCtr) = 1;
 }
 
 bool OverworldLogic::enter() {
@@ -243,9 +244,9 @@ void OverworldLogic::continentChanged(int oldContinent) {
 void OverworldLogic::endOfTurn() {
 	if (_G(creaturesCount) < Data::CREATURES_COUNT)
 		generateCreatures();
-	updateCreatures();
 	reduceFood();
 
+	// Calls updateCreatures() in turn
 	Logic::endOfTurn();
 }
 
@@ -347,7 +348,13 @@ void OverworldLogic::updateCreatures() {
 }
 
 void OverworldLogic::reduceFood() {
-
+	if (_G(transportFoodCtr) >= Data::FOOD_PER_TRANSPORT[_G(savegame)._transportType]) {
+		_G(transportFoodCtr) = 0;
+		--_G(savegame)._food;
+		redrawStats();
+	} else {
+		++_G(transportFoodCtr);
+	}
 }
 
 bool OverworldLogic::monsterTransportCheck(int entityIndex, int xDiff, int yDiff) {
diff --git a/engines/ultima/ultima1/ultima1.h b/engines/ultima/ultima1/ultima1.h
index 1e2f7f97891..870674a31fa 100644
--- a/engines/ultima/ultima1/ultima1.h
+++ b/engines/ultima/ultima1/ultima1.h
@@ -71,6 +71,7 @@ public:
 	int _overworldEntityCount = 0;
 	int _creaturesCount = 0;
 	uint32 _moveCtr = 0;
+	int _transportFoodCtr = 0;
 
 public:
 	Ultima1Engine(OSystem *syst, const Ultima::UltimaGameDescription *gameDesc);
diff --git a/engines/ultima/ultima1/views/dungeon_map.cpp b/engines/ultima/ultima1/views/dungeon_map.cpp
index dae55bb4896..ab41a2da280 100644
--- a/engines/ultima/ultima1/views/dungeon_map.cpp
+++ b/engines/ultima/ultima1/views/dungeon_map.cpp
@@ -36,12 +36,6 @@ constexpr int HIGHLIGHT_COLOR = 12;
 static const int DUNGEON_ARRAY_X[6] = { 0, 72, 108, 126, 135, 144 };
 static const int DUNGEON_ARRAY_Y[6] = { 0, 36, 54, 63, 68, 72 };
 
-// Dungeon monster Ids that don't block the view, being either invisible or
-// disguised as something else
-constexpr int UMONS_GELATINOUS_CUBE = 9;
-constexpr int UMONS_MIMIC = 11;
-constexpr int UMONS_INVISIBLE_SEEKER = 20;
-
 // Y offset added to widget shape coordinates, indexed by a 0-4 distance tier
 static const int UWIDGET_OFFSET_Y[5] = { 139, 112, 96, 88, 84 };
 
@@ -159,8 +153,8 @@ bool DungeonMap::isMonsterBlocking(int x, int y) const {
 	if (monsterId == Data::DUNGEON_NO_MONSTER)
 		return false;
 
-	return monsterId != UMONS_GELATINOUS_CUBE && monsterId != UMONS_MIMIC &&
-		monsterId != UMONS_INVISIBLE_SEEKER;
+	return monsterId != Data::UMONS_GELATINOUS_CUBE && monsterId != Data::UMONS_MIMIC &&
+		monsterId != Data::UMONS_INVISIBLE_SEEKER;
 }
 
 bool DungeonMap::isCellOccupied(int deltaX, int deltaY) const {
@@ -535,28 +529,28 @@ void DungeonMap::dungeonDrawWidget(const uint8 *data, int distance, int color) {
 }
 
 void DungeonMap::drawCoffin(int distance) {
-	// TODO: show "Coffin" in the commands area (writeStringNewline in the
-	// original) - that belongs to DungeonLogic, as with monster names
+	// The original also shows "Coffin" in the commands area here - that's
+	// handled by DungeonLogic::endOfTurn instead, as with monster names
 	dungeonDrawWidget(COFFIN_DRAW_DATA, distance, EDGE_COLOR);
 }
 
 void DungeonMap::drawChest(int distance) {
-	// TODO: show "Chest" in the commands area (writeStringNewline in the
-	// original) - that belongs to DungeonLogic, as with monster names.
+	// The original also shows "Chest" in the commands area here - that's
+	// handled by DungeonLogic::endOfTurn instead, as with monster names.
 	// Reuses the mimic's widget shape, since the original draws chests and
 	// mimics identically
-	dungeonDrawWidget(UWIDGET_DRAW_TABLE[UMONS_MIMIC], distance, EDGE_COLOR);
+	dungeonDrawWidget(UWIDGET_DRAW_TABLE[Data::UMONS_MIMIC], distance, EDGE_COLOR);
 }
 
 void DungeonMap::dungeonDrawMonster(int monsterId, int distance) {
 	if (distance >= 5)
 		return;
 
-	// TODO: show the monster's name in the commands area (writeStringNewline
-	// with UNDERWORLD_MONSTERS[monsterId] in the original) - that belongs
-	// to DungeonLogic, once it exists there
+	// The original also shows the monster's name in the commands area here
+	// (UNDERWORLD_MONSTERS[monsterId]) - that's handled by
+	// DungeonLogic::endOfTurn instead
 
-	if (monsterId == UMONS_GELATINOUS_CUBE) {
+	if (monsterId == Data::UMONS_GELATINOUS_CUBE) {
 		// The cube fills the whole passage rather than using a widget shape
 		drawWall(distance);
 		drawLeftEdge(distance);


Commit: 42cb9a93cfc9a7e04caeed5c2e163d918d1eb256
    https://github.com/scummvm/scummvm/commit/42cb9a93cfc9a7e04caeed5c2e163d918d1eb256
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:40:50+11:00

Commit Message:
ULTIMA: ULTIMA1: Implement death/resurrection screen

Changed paths:
    engines/ultima/ultima1/logic/logic.cpp
    engines/ultima/ultima1/views/interactions/dead.cpp
    engines/ultima/ultima1/views/interactions/dead.h


diff --git a/engines/ultima/ultima1/logic/logic.cpp b/engines/ultima/ultima1/logic/logic.cpp
index 190096c78db..853f9022fb2 100644
--- a/engines/ultima/ultima1/logic/logic.cpp
+++ b/engines/ultima/ultima1/logic/logic.cpp
@@ -80,6 +80,9 @@ void Logic::endOfTurn() {
 
 	redrawMap();
 	redrawStats();
+
+	if (_G(savegame)._hits == 0)
+		g_engine->addView("Dead");
 }
 
 void Logic::action(int action) {
@@ -156,7 +159,8 @@ void Logic::action(int action) {
 		if (_G(logic) == currLogic)
 			endOfTurn();
 
-		prompt();
+		if (_G(savegame)._hits > 0)
+			prompt();
 	}
 }
 
diff --git a/engines/ultima/ultima1/views/interactions/dead.cpp b/engines/ultima/ultima1/views/interactions/dead.cpp
index 5df577c70d9..643c18a5137 100644
--- a/engines/ultima/ultima1/views/interactions/dead.cpp
+++ b/engines/ultima/ultima1/views/interactions/dead.cpp
@@ -20,12 +20,242 @@
  */
 
 #include "ultima/ultima1/views/interactions/dead.h"
+#include "ultima/ultima1/ultima1.h"
 
 namespace Ultima {
 namespace Ultima1 {
 namespace Views {
 namespace Interactions {
 
+// Frames to pause before the resurrection count-up starts, and between each
+// point of hits/food animated back afterward - approximates the original's
+// timer-tick based wait(80) and wait(1) calls
+constexpr int INTRO_DELAY = 80;
+constexpr int COUNT_DELAY = 1;
+
+// Hits/food the player is resurrected with
+constexpr int RESURRECTED_AMOUNT = 99;
+
+constexpr int EDGE_COLOR = 15;
+
+// The skull glyph shown while the player is dead - a 64x95 1-bit-per-pixel
+// bitmap, stored as 95 rows of 4 big-endian 16-bit words (bit 15 = leftmost
+// pixel of the word), matching the original's drawDeathGraphic byte table
+constexpr int DEATH_GRAPHIC_WIDTH = 64;
+constexpr int DEATH_GRAPHIC_HEIGHT = 95;
+
+// Absolute screen position the original centers the glyph at within the
+// map viewport, converted below to be local to this view's own bounds
+constexpr int DEATH_GRAPHIC_SCREEN_X = 128;
+constexpr int DEATH_GRAPHIC_SCREEN_Y = 31;
+
+static const uint8 DEATH_GRAPHIC_DATA[DEATH_GRAPHIC_HEIGHT * 8] = {
+	0x00, 0x00, 0x3f, 0x00, 0x00, 0xfc, 0x00, 0x00, 0x00, 0x00, 0xff, 0x01, 0x80, 0xff, 0x00, 0x00,
+	0x00, 0x00, 0xff, 0x07, 0xe0, 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, 0x3f, 0xfc, 0xff, 0x00, 0x00,
+	0x00, 0x00, 0xff, 0xff, 0xfe, 0xff, 0x00, 0x00, 0x03, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x80,
+	0x07, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0xe0, 0x1f, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0xf8,
+	0x1f, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0xfc, 0x7f, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0xfe,
+	0x7f, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0xff, 0xff, 0x80, 0xff,
+	0xff, 0x01, 0xff, 0xff, 0xff, 0xff, 0x80, 0xff, 0xff, 0x03, 0xff, 0xff, 0xff, 0xff, 0xe0, 0xff,
+	0xff, 0x07, 0xff, 0xff, 0xff, 0xff, 0xf0, 0xff, 0xff, 0x07, 0xff, 0xff, 0xff, 0xff, 0xf0, 0xff,
+	0xff, 0x0f, 0xff, 0xff, 0xff, 0xff, 0xf0, 0xff, 0xff, 0x0f, 0xff, 0xff, 0xff, 0xff, 0xfc, 0xff,
+	0xff, 0x1f, 0xff, 0xff, 0xff, 0xff, 0xfc, 0xff, 0xff, 0x1f, 0xff, 0xff, 0xff, 0xff, 0xfe, 0xff,
+	0xff, 0x3f, 0xff, 0xff, 0xff, 0xff, 0xfe, 0xff, 0xff, 0x3f, 0xff, 0xff, 0xff, 0xff, 0xfe, 0xff,
+	0xff, 0x3f, 0xff, 0xff, 0xff, 0xff, 0xfe, 0xff, 0xff, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xfe, 0xff,
+	0xff, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+	0xff, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+	0xff, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0xff,
+	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xe3, 0xff, 0xfe, 0xff,
+	0xff, 0xff, 0xff, 0xc3, 0x80, 0xff, 0xfe, 0x0f, 0xfc, 0x7f, 0xff, 0x01, 0x00, 0xff, 0xfc, 0x03,
+	0xf0, 0x7f, 0xff, 0x00, 0x00, 0xff, 0xfc, 0x03, 0xc0, 0x7f, 0xbf, 0x00, 0x00, 0xff, 0xfc, 0x00,
+	0x80, 0x7f, 0x7f, 0x00, 0x00, 0xff, 0xfc, 0x00, 0x80, 0x7f, 0x7f, 0x00, 0x00, 0xfe, 0xfc, 0x00,
+	0x80, 0x3f, 0x1f, 0x00, 0x00, 0xfe, 0xfc, 0x00, 0x00, 0x3f, 0x3f, 0x00, 0x00, 0xfe, 0xfc, 0x00,
+	0x00, 0x3f, 0x3f, 0x00, 0x00, 0xfe, 0xfc, 0x00, 0x00, 0x3f, 0x3f, 0x00, 0x00, 0xfe, 0xfe, 0x00,
+	0x00, 0x3f, 0x7f, 0x00, 0x00, 0xfe, 0xfe, 0x00, 0x00, 0x1f, 0xff, 0x00, 0x00, 0xff, 0xfe, 0x00,
+	0x80, 0x1f, 0xff, 0x03, 0x80, 0xff, 0xfe, 0x01, 0x80, 0x1f, 0xff, 0x07, 0xc0, 0xff, 0xfe, 0x01,
+	0x80, 0x1f, 0xfd, 0x0f, 0xf0, 0xbf, 0xfe, 0x01, 0xc0, 0x1f, 0xfc, 0x3f, 0xfc, 0x1f, 0xfe, 0x03,
+	0xe0, 0x1f, 0xf8, 0x7f, 0xff, 0x1f, 0xfe, 0x07, 0xf0, 0x1f, 0xf0, 0xff, 0xff, 0x0f, 0xfe, 0xff,
+	0xff, 0x1f, 0xf0, 0xff, 0xff, 0x0f, 0xfe, 0xff, 0xff, 0x1f, 0xe0, 0xff, 0xff, 0x07, 0xfe, 0xff,
+	0xff, 0x1f, 0xe0, 0xff, 0xff, 0x07, 0xfe, 0xff, 0xff, 0x1f, 0xc0, 0xff, 0xff, 0x07, 0xfc, 0xff,
+	0xff, 0x1f, 0xc0, 0xff, 0xff, 0x03, 0xfc, 0xff, 0xff, 0x1f, 0xc0, 0xff, 0xff, 0x03, 0xfc, 0xff,
+	0xff, 0x0f, 0x80, 0xff, 0xff, 0x03, 0xf8, 0xff, 0xff, 0x0f, 0x80, 0xff, 0xff, 0x03, 0xf8, 0xff,
+	0xff, 0x0f, 0xc0, 0xff, 0xff, 0x07, 0xf0, 0xff, 0xff, 0x07, 0xc5, 0xff, 0xff, 0x0f, 0xf0, 0xff,
+	0xff, 0x03, 0xff, 0xff, 0xff, 0xff, 0xe0, 0xff, 0xff, 0x03, 0xff, 0xff, 0xff, 0xff, 0xc0, 0xfb,
+	0xff, 0x01, 0xff, 0xff, 0xff, 0xff, 0xc0, 0x7f, 0xff, 0x01, 0xff, 0xbf, 0xff, 0xff, 0x80, 0x0f,
+	0xf6, 0x00, 0xff, 0x7f, 0xff, 0xff, 0x80, 0x8f, 0xfe, 0x00, 0xff, 0x7f, 0xff, 0xff, 0x00, 0x8f,
+	0x7e, 0x00, 0xff, 0x7f, 0xff, 0xff, 0x00, 0x9f, 0x7e, 0x00, 0xff, 0x3f, 0xff, 0xff, 0x00, 0x9f,
+	0x7e, 0x00, 0xff, 0x3f, 0xff, 0xff, 0x00, 0x9f, 0x3e, 0x00, 0xdf, 0x7f, 0xff, 0xff, 0x00, 0xbf,
+	0x3f, 0x00, 0x7b, 0xff, 0xff, 0xcf, 0x00, 0xff, 0x3f, 0x00, 0x93, 0xda, 0xac, 0xc9, 0x00, 0xff,
+	0x3f, 0x00, 0x90, 0x5a, 0x0d, 0x88, 0x00, 0x7f, 0x3f, 0x00, 0x90, 0xda, 0x2d, 0x88, 0x00, 0xff,
+	0x3f, 0x00, 0x10, 0xff, 0xad, 0x88, 0x00, 0xfe, 0x1f, 0x00, 0xf0, 0xeb, 0xff, 0xbb, 0x00, 0xfe,
+	0x1f, 0x00, 0x3f, 0xd7, 0x6f, 0xe6, 0x00, 0x7e, 0x1f, 0x00, 0x24, 0xd5, 0x6a, 0x92, 0x00, 0xfe,
+	0x1f, 0x00, 0x24, 0xfd, 0x4b, 0xb2, 0x00, 0xfc, 0x0f, 0x00, 0x64, 0xff, 0x5f, 0xb6, 0x00, 0xfc,
+	0x0f, 0x00, 0xfc, 0xff, 0x7f, 0xbe, 0x00, 0xf8, 0x07, 0x00, 0xff, 0xff, 0xff, 0x7b, 0x00, 0xf8,
+	0x03, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0xf0, 0x03, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0xe0,
+	0x01, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0xc0, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x80,
+	0x00, 0x00, 0xff, 0x7f, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, 0x3f, 0xfe, 0xff, 0x00, 0x00,
+	0x00, 0x00, 0xff, 0x1f, 0xfc, 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, 0x07, 0xf0, 0xff, 0x00, 0x00,
+	0x00, 0x00, 0xff, 0x01, 0xe0, 0xff, 0x00, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x80, 0xff, 0x00, 0x00,
+	0x00, 0x00, 0x0f, 0x00, 0x00, 0xfc, 0x00, 0x00
+};
+
+bool Dead::msgFocus(const FocusMessage &msg) {
+	// Claim the map viewport area (inside the game border, which is left
+	// drawn by whatever view was showing underneath)
+	setBounds(Common::Rect(8, 8, 312, 152));
+
+	auto &sg = _G(savegame);
+	sg._food = 0;
+	sg._hits = 0;
+	sg._coins = 0;
+	g_engine->findView("Stats")->draw();
+
+	g_engine->playFX(2);
+	g_engine->playFX(2);
+	g_engine->playFX(2);
+
+	writeString(sg._name);
+	writeString(", thou art dead\n");
+
+	_phase = PHASE_INTRO;
+	_delayCtr = INTRO_DELAY;
+	return true;
+}
+
+void Dead::draw() {
+	auto s = getSurface();
+	s.clear();
+
+	drawDeathGraphic();
+}
+
+void Dead::drawDeathGraphic() {
+	auto s = getSurface();
+
+	// This view's own bounds start at absolute screen (8, 8), so convert
+	// down to the local coordinates its surface uses
+	int startX = DEATH_GRAPHIC_SCREEN_X - 8;
+	int startY = DEATH_GRAPHIC_SCREEN_Y - 8;
+
+	for (int row = 0; row < DEATH_GRAPHIC_HEIGHT; ++row) {
+		const uint8 *rowData = &DEATH_GRAPHIC_DATA[row * 8];
+		int x = startX;
+
+		for (int wordIdx = 0; wordIdx < 4; ++wordIdx) {
+			uint16 word = rowData[wordIdx * 2] | (rowData[wordIdx * 2 + 1] << 8);
+
+			for (int bit = 15; bit >= 0; --bit, ++x) {
+				if (word & (1 << bit))
+					s.setPixel(x, startY + row, EDGE_COLOR);
+			}
+		}
+	}
+}
+
+bool Dead::tick() {
+	if (_delayCtr > 0 && --_delayCtr == 0) {
+		auto &sg = _G(savegame);
+
+		switch (_phase) {
+		case PHASE_INTRO:
+			writeString("Attempting resurrection!\n");
+			_phase = PHASE_HITS;
+			_delayCtr = COUNT_DELAY;
+			break;
+
+		case PHASE_HITS:
+			++sg._hits;
+			g_engine->findView("Stats")->draw();
+
+			if (sg._hits >= RESURRECTED_AMOUNT) {
+				for (int continent = 0; continent < 4; ++continent)
+					removeCreaturesOnContinent(continent);
+				_phase = PHASE_FOOD;
+			}
+			_delayCtr = COUNT_DELAY;
+			break;
+
+		case PHASE_FOOD:
+			++sg._food;
+			g_engine->findView("Stats")->draw();
+
+			if (sg._food >= RESURRECTED_AMOUNT)
+				finish();
+			else
+				_delayCtr = COUNT_DELAY;
+			break;
+		}
+	}
+
+	return Interaction::tick();
+}
+
+void Dead::removeCreaturesOnContinent(int continent) {
+	for (int index = 1; index < _G(overworldEntityCount); ++index) {
+		auto &e = _G(savegame)._overworldEntities[index];
+
+		if (_G(map).getContinentAt(e._x, e._y) == continent) {
+			_G(savegame).removeOverworldCreatureAt(e._x, e._y);
+			--_G(creaturesCount);
+		}
+	}
+}
+
+void Dead::resetPlayerPosition() {
+	auto &sg = _G(savegame);
+	int origContinent = _G(map).getContinentAt(sg._overworldPos);
+	int x = 0, y = 0, tile = 0;
+	bool found = false;
+
+	while (!found) {
+		x = sg._overworldPos.x + g_engine->getRandomNumber(3, 23) - 13;
+		y = sg._overworldPos.y + g_engine->getRandomNumber(3, 23) - 13;
+
+		if (x < 2 || x > Data::OVERWORLD_WIDTH - 3)
+			x = sg._overworldPos.x;
+		if (y < 2 || y > Data::OVERWORLD_HEIGHT - 3)
+			y = sg._overworldPos.y;
+
+		if (_G(map).getContinentAt(x, y) != origContinent)
+			continue;
+
+		tile = _G(map).getTileAt(x, y);
+		found = tile == Data::TILE_GRASS || tile == Data::TILE_WOODS;
+	}
+
+	sg._overworldPos = Common::Point(x, y);
+
+	auto &e = sg._overworldEntities[0];
+	e._type = Data::TILE_PLAYER;
+	e._data = tile;
+	e._x = x;
+	e._y = y;
+}
+
+void Dead::finish() {
+	auto &sg = _G(savegame);
+
+	// Losing any ridden transport
+	if (sg._transportType != Data::TRANSPORT_FOOT) {
+		--sg._transports[sg._transportType];
+		sg._transportType = Data::TRANSPORT_FOOT;
+		sg._overworldEntities[0]._type = Data::TILE_PLAYER;
+	}
+
+	// All weapons are lost, and everything readied is unreadied
+	for (int i = 0; i < Data::WEAPON_COUNT; ++i)
+		sg._weapons[i] = 0;
+	sg._equippedWeapon = Data::WEAPON_NONE;
+	sg._equippedArmor = Data::ARMOR_NONE;
+	sg._equippedSpell = Data::SPELL_NONE;
+
+	g_engine->playFX(5);
+	resetPlayerPosition();
+
+	_G(map).load(Data::MAP_OVERWORLD);
+}
+
 } // namespace Interactions
 } // namespace Views
 } // namespace Ultima1
diff --git a/engines/ultima/ultima1/views/interactions/dead.h b/engines/ultima/ultima1/views/interactions/dead.h
index fd7c485926d..816aaaadd91 100644
--- a/engines/ultima/ultima1/views/interactions/dead.h
+++ b/engines/ultima/ultima1/views/interactions/dead.h
@@ -29,16 +29,74 @@ namespace Ultima1 {
 namespace Views {
 namespace Interactions {
 
+using namespace Ultima::Shared::Messages;
+
 /**
- * Dummy view to go to when the player dies. This allows the game to know
- * not to allow saving anymore, and to stop on-screen map animations.
+ * Shown when the player's hit points reach zero. Plays out the original's
+ * resurrection sequence: shows the skull glyph and "<name>, thou art dead",
+ * pauses briefly, then "Attempting resurrection!" and animates hits and
+ * food back up to 99 each, one point at a time. Finishes by stripping the
+ * player's weapons and any ridden transport, moving them to a random spot
+ * on the continent they died on, and returning to the overworld.
+ *
+ * The whole sequence plays out automatically via tick() - no player input
+ * is needed, or accepted, while it's running.
  */
 class Dead : public Interaction {
+private:
+	enum Phase {
+		PHASE_INTRO,
+		PHASE_HITS,
+		PHASE_FOOD
+	};
+
+	Phase _phase = PHASE_INTRO;
+	int _delayCtr = 0;
+
+	/**
+	 * Draws the skull glyph shown in the map area while the player is dead
+	 */
+	void drawDeathGraphic();
+
+	/**
+	 * Removes any overworld creatures on a given continent. Called for
+	 * every continent once hits have been restored, so the resurrected
+	 * player doesn't return to a world still full of whatever was hunting
+	 * them down before they died
+	 */
+	void removeCreaturesOnContinent(int continent);
+
+	/**
+	 * Picks a new random position for the player, on the same continent
+	 * they died on, on a patch of grass or woods
+	 */
+	void resetPlayerPosition();
+
+	/**
+	 * Finishes the resurrection - loses any ridden transport and all
+	 * weapons, unreadies everything, then returns to the overworld
+	 */
+	void finish();
+
 public:
 	Dead() : Interaction("Dead") {
 	}
 	~Dead() override {
 	}
+
+	bool msgFocus(const FocusMessage &msg) override;
+
+	// The death sequence is automatic - swallow input rather than letting
+	// it reach the (soon to be replaced) logic/view underneath
+	bool msgAction(const ActionMessage &msg) override {
+		return true;
+	}
+	bool msgKeypress(const KeypressMessage &msg) override {
+		return true;
+	}
+
+	void draw() override;
+	bool tick() override;
 };
 
 } // namespace Interactions


Commit: 66baedfc05a61f68b216740d8b43851e886ce5d1
    https://github.com/scummvm/scummvm/commit/66baedfc05a61f68b216740d8b43851e886ce5d1
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:40:50+11:00

Commit Message:
ULTIMA: ULTIMA1: Beginnings of outer space view

Changed paths:
  A engines/ultima/ultima1/logic/space_logic.cpp
  A engines/ultima/ultima1/logic/space_logic.h
  A engines/ultima/ultima1/views/space_map.cpp
  A engines/ultima/ultima1/views/space_map.h
    engines/ultima/module.mk
    engines/ultima/ultima1/data/map.cpp
    engines/ultima/ultima1/data/map.h
    engines/ultima/ultima1/logic/logic.h
    engines/ultima/ultima1/views/dialog.cpp


diff --git a/engines/ultima/module.mk b/engines/ultima/module.mk
index 2509b91d0a0..fade8abac97 100644
--- a/engines/ultima/module.mk
+++ b/engines/ultima/module.mk
@@ -66,6 +66,7 @@ MODULE_OBJS += \
 	ultima1/logic/dungeon_logic.o \
 	ultima1/logic/overworld_logic.o \
 	ultima1/logic/pillar_logic.o \
+	ultima1/logic/space_logic.o \
 	ultima1/views/interactions/interaction.o \
 	ultima1/views/interactions/dead.o \
 	ultima1/views/interactions/drop.o \
@@ -84,6 +85,7 @@ MODULE_OBJS += \
 	ultima1/views/main_menu.o \
 	ultima1/views/overworld.o \
 	ultima1/views/overworld_map.o \
+	ultima1/views/space_map.o \
 	ultima1/views/stats.o \
 	ultima1/views/startup.o \
 	ultima1/views/title.o \
diff --git a/engines/ultima/ultima1/data/map.cpp b/engines/ultima/ultima1/data/map.cpp
index cd5f745adf5..21fe26d50e0 100644
--- a/engines/ultima/ultima1/data/map.cpp
+++ b/engines/ultima/ultima1/data/map.cpp
@@ -27,6 +27,7 @@
 #include "ultima/ultima1/logic/dungeon_logic.h"
 #include "ultima/ultima1/logic/overworld_logic.h"
 #include "ultima/ultima1/logic/pillar_logic.h"
+#include "ultima/ultima1/logic/space_logic.h"
 #include "ultima/ultima1/views/dialog.h"
 #include "ultima/ultima1/ultima1.h"
 
@@ -162,6 +163,9 @@ void Map::load(int mapNum) {
 	} else if (mapNum == MAP_OVERWORLD) {
 		_G(logic) = Common::SharedPtr<Logic::Logic>(new Logic::OverworldLogic());
 		viewName = "OverworldMap";
+	} else if (mapNum == MAP_SPACE) {
+		_G(logic) = Common::SharedPtr<Logic::Logic>(new Logic::SpaceLogic());
+		viewName = "SpaceMap";
 	} else {
 		if (mapNum < 33)
 			_G(logic) = Common::SharedPtr<Logic::Logic>(new Logic::CityLogic());
@@ -187,6 +191,10 @@ void Map::load(int mapNum) {
 		_mapRows.clear();		// Dungeon doesn't use this map
 		break;
 
+	case MAPTYPE_SPACE:
+		_mapRows.clear();		// Outer space doesn't use this map
+		break;
+
 	default:
 		_mapRows.reserve(CITY_HEIGHT + 1);		// One extra row for out-of-bounds y access
 		for (int y = 0; y < CITY_HEIGHT; ++y)
diff --git a/engines/ultima/ultima1/data/map.h b/engines/ultima/ultima1/data/map.h
index fa2473987bb..5c688f9d255 100644
--- a/engines/ultima/ultima1/data/map.h
+++ b/engines/ultima/ultima1/data/map.h
@@ -47,7 +47,8 @@ constexpr int LOCATION_COUNT = 84;
 
 enum {
 	MAP_OVERWORLD = 0,
-	MAP_CITY1 = 1
+	MAP_SPACE = 90,
+	MAP_MONDIAN = 91
 };
 
 enum Direction {
@@ -58,7 +59,8 @@ enum MapType {
 	MAPTYPE_OVERWORLD = 0,
 	MAPTYPE_CITY = 1,
 	MAPTYPE_CASTLE = 2,
-	MAPTYPE_DUNGEON = 3
+	MAPTYPE_DUNGEON = 3,
+	MAPTYPE_SPACE = 4
 };
 
 typedef Common::Array< Common::Array<byte> > MapTiles;
diff --git a/engines/ultima/ultima1/logic/logic.h b/engines/ultima/ultima1/logic/logic.h
index 1e6309ccfd8..ec6a5d15188 100644
--- a/engines/ultima/ultima1/logic/logic.h
+++ b/engines/ultima/ultima1/logic/logic.h
@@ -119,6 +119,11 @@ public:
 	virtual void keypress(Common::KeyCode keycode);
 	virtual void entering() {
 	}
+
+	/**
+	 * Called once per game frame for any logic updates
+	 */
+	virtual void tick() {}
 };
 
 } // namespace Logic
diff --git a/engines/ultima/ultima1/logic/space_logic.cpp b/engines/ultima/ultima1/logic/space_logic.cpp
new file mode 100644
index 00000000000..951d166961a
--- /dev/null
+++ b/engines/ultima/ultima1/logic/space_logic.cpp
@@ -0,0 +1,41 @@
+
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "ultima/ultima1/logic/space_logic.h"
+#include "ultima/ultima1/data/map.h"
+#include "ultima/ultima1/metaengine.h"
+#include "ultima/ultima1/ultima1.h"
+
+namespace Ultima {
+namespace Ultima1 {
+namespace Logic {
+
+SpaceLogic::SpaceLogic() {
+}
+
+void SpaceLogic::entering() {
+	// TODO
+}
+
+} // namespace Logic
+} // namespace Ultima1
+} // namespace Ultima
diff --git a/engines/ultima/ultima1/logic/space_logic.h b/engines/ultima/ultima1/logic/space_logic.h
new file mode 100644
index 00000000000..cb4725a4afc
--- /dev/null
+++ b/engines/ultima/ultima1/logic/space_logic.h
@@ -0,0 +1,56 @@
+
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef ULTIMA2_LOGIC_SPACE_LOGIC_H
+#define ULTIMA2_LOGIC_SPACE_LOGIC_H
+
+#include "ultima/ultima1/logic/logic.h"
+
+namespace Ultima {
+namespace Ultima1 {
+namespace Logic {
+
+class SpaceLogic : public Logic {
+protected:
+	bool move(Data::Direction dir) override {
+		return true;
+	}
+
+	/**
+	 * Handles updating creatures/NPCs
+	 */
+	void updateCreatures() override {
+	}
+
+public:
+	SpaceLogic();
+	~SpaceLogic() override {
+	}
+
+	void entering() override;
+};
+
+} // namespace Logic
+} // namespace Ultima1
+} // namespace Ultima
+
+#endif
diff --git a/engines/ultima/ultima1/views/dialog.cpp b/engines/ultima/ultima1/views/dialog.cpp
index f2d7d737793..a6325176449 100644
--- a/engines/ultima/ultima1/views/dialog.cpp
+++ b/engines/ultima/ultima1/views/dialog.cpp
@@ -70,6 +70,9 @@ void Dialog::draw() {
 
 bool Dialog::tick() {
 	g_engine->findView("Game")->tick();
+	if (_G(logic))
+		_G(logic)->tick();
+
 	return Shared::Gfx::View::tick();
 }
 
diff --git a/engines/ultima/ultima1/views/space_map.cpp b/engines/ultima/ultima1/views/space_map.cpp
new file mode 100644
index 00000000000..223bac608bf
--- /dev/null
+++ b/engines/ultima/ultima1/views/space_map.cpp
@@ -0,0 +1,48 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "ultima/ultima1/views/space_map.h"
+#include "ultima/ultima1/ultima1.h"
+#include "ultima/ultima1/metaengine.h"
+
+namespace Ultima {
+namespace Ultima1 {
+namespace Views {
+
+bool SpaceMap::msgFocus(const FocusMessage &msg) {
+	MetaEngine::setKeybindingMode(KBMODE_GAMEPLAY);
+	return Dialog::msgFocus(msg);
+}
+
+bool SpaceMap::msgUnfocus(const UnfocusMessage &msg) {
+	MetaEngine::setKeybindingMode(KBMODE_MINIMAL);
+	return Dialog::msgUnfocus(msg);
+}
+
+void SpaceMap::draw() {
+	Dialog::draw();
+
+	// TODO
+}
+
+} // namespace Views
+} // namespace Ultima1
+} // namespace Ultima
diff --git a/engines/ultima/ultima1/views/space_map.h b/engines/ultima/ultima1/views/space_map.h
new file mode 100644
index 00000000000..42b4cbcd5d6
--- /dev/null
+++ b/engines/ultima/ultima1/views/space_map.h
@@ -0,0 +1,50 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef ULTIMA1_VIEWS_SPACE_MAP_H
+#define ULTIMA1_VIEWS_SPACE_MAP_H
+
+#include "ultima/ultima1/views/dialog.h"
+#include "ultima/ultima1/data/map.h"
+
+namespace Ultima {
+namespace Ultima1 {
+namespace Views {
+
+using namespace Shared::Messages;
+
+class SpaceMap : public Dialog {
+public:
+	SpaceMap() : Dialog("SpaceMap") {}
+	~SpaceMap() override {}
+
+	bool msgFocus(const FocusMessage &msg) override;
+	bool msgUnfocus(const UnfocusMessage &msg) override;
+	bool msgAttackTile(const AttackTileMessage &msg) override;
+	void draw() override;
+	void timeout() override;
+};
+
+} // namespace Views
+} // namespace Ultima1
+} // namespace Ultima
+
+#endif


Commit: 10a7f3f3f66f67e0909e86a822adb696a45c5d1f
    https://github.com/scummvm/scummvm/commit/10a7f3f3f66f67e0909e86a822adb696a45c5d1f
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:40:50+11:00

Commit Message:
ULTIMA: ULTIMA1: Implementing outer space lift-off

Changed paths:
  A engines/ultima/ultima1/views/interactions/liftoff.cpp
  A engines/ultima/ultima1/views/interactions/liftoff.h
  A engines/ultima/ultima1/views/interactions/operate_craft.cpp
  A engines/ultima/ultima1/views/interactions/operate_craft.h
    engines/ultima/module.mk
    engines/ultima/ultima1/data/map.cpp
    engines/ultima/ultima1/logic/logic.cpp
    engines/ultima/ultima1/logic/overworld_logic.cpp
    engines/ultima/ultima1/logic/overworld_logic.h
    engines/ultima/ultima1/views/views.h


diff --git a/engines/ultima/module.mk b/engines/ultima/module.mk
index fade8abac97..76cb91e9f53 100644
--- a/engines/ultima/module.mk
+++ b/engines/ultima/module.mk
@@ -71,7 +71,9 @@ MODULE_OBJS += \
 	ultima1/views/interactions/dead.o \
 	ultima1/views/interactions/drop.o \
 	ultima1/views/interactions/king.o \
+	ultima1/views/interactions/liftoff.o \
 	ultima1/views/interactions/merchant.o \
+	ultima1/views/interactions/operate_craft.o \
 	ultima1/views/interactions/princess_saved.o \
 	ultima1/views/interactions/ready.o \
 	ultima1/views/view.o \
diff --git a/engines/ultima/ultima1/data/map.cpp b/engines/ultima/ultima1/data/map.cpp
index 21fe26d50e0..279c6d2bc1a 100644
--- a/engines/ultima/ultima1/data/map.cpp
+++ b/engines/ultima/ultima1/data/map.cpp
@@ -157,15 +157,15 @@ void Map::load(int mapNum) {
 
 	// Set up logic handler for the mode and which view it'll be using
 	Common::String viewName;
-	if (mapNum >= 49) {
+	if (mapNum == MAP_SPACE) {
+		_G(logic) = Common::SharedPtr<Logic::Logic>(new Logic::SpaceLogic());
+		viewName = "SpaceMap";
+	} else if (mapNum >= 49) {
 		_G(logic) = Common::SharedPtr<Logic::Logic>(new Logic::DungeonLogic());
 		viewName = "DungeonMap";
 	} else if (mapNum == MAP_OVERWORLD) {
 		_G(logic) = Common::SharedPtr<Logic::Logic>(new Logic::OverworldLogic());
 		viewName = "OverworldMap";
-	} else if (mapNum == MAP_SPACE) {
-		_G(logic) = Common::SharedPtr<Logic::Logic>(new Logic::SpaceLogic());
-		viewName = "SpaceMap";
 	} else {
 		if (mapNum < 33)
 			_G(logic) = Common::SharedPtr<Logic::Logic>(new Logic::CityLogic());
diff --git a/engines/ultima/ultima1/logic/logic.cpp b/engines/ultima/ultima1/logic/logic.cpp
index 853f9022fb2..8909ff75191 100644
--- a/engines/ultima/ultima1/logic/logic.cpp
+++ b/engines/ultima/ultima1/logic/logic.cpp
@@ -90,6 +90,9 @@ void Logic::action(int action) {
 	bool doEndOfTurn = true;
 
 	switch (action) {
+	case KEYBIND_BOARD:
+		doEndOfTurn = board();
+		break;
 	case KEYBIND_UP:
 		doEndOfTurn = move(Data::DIR_UP);
 		break;
diff --git a/engines/ultima/ultima1/logic/overworld_logic.cpp b/engines/ultima/ultima1/logic/overworld_logic.cpp
index 0e562c1fd83..b99f75d73f2 100644
--- a/engines/ultima/ultima1/logic/overworld_logic.cpp
+++ b/engines/ultima/ultima1/logic/overworld_logic.cpp
@@ -55,6 +55,54 @@ OverworldLogic::OverworldLogic() {
 	_G(transportFoodCtr) = 1;
 }
 
+bool OverworldLogic::board() {
+	auto &sg = _G(savegame);
+
+	if (sg._transportType != Data::TRANSPORT_FOOT) {
+		writeString("X-it thy craft first!\n");
+		playFX(1);
+		return true;
+	}
+
+	int tileNum = _G(map).getTileAt(sg._overworldPos.x, sg._overworldPos.y);
+	if (tileNum < Data::TILE_HORSE || tileNum > Data::TILE_TIME_MACHINE) {
+		writeString("Nothing to Board!\n");
+		playFX(1);
+		return true;
+	}
+
+	// The vehicle becomes the player's own overworld graphic, rather than a
+	// separate entity standing at the same spot
+	sg._overworldEntities[0]._type = tileNum;
+	sg.removeOverworldCreatureAt(sg._overworldPos.x, sg._overworldPos.y);
+
+	// TILE_FRIGATE2 (the flag-waving animation frame of TILE_FRIGATE1)
+	// doesn't have its own TransportType, so every tile past it needs to
+	// shift back down by one to line back up
+	sg._transportType = tileNum - Data::TILE_HORSE + 1;
+	if (sg._transportType > 4)
+		--sg._transportType;
+
+	writeString(tileNum == Data::TILE_HORSE || tileNum == Data::TILE_CART ? "Mount " : "Board ");
+	writeString("%s\n", Data::TRANSPORT_NAMES[sg._transportType]);
+
+	if (tileNum == Data::TILE_SHUTTLE) {
+		g_engine->addView("LiftOff");
+		return false;
+	}
+
+	if (tileNum == Data::TILE_TIME_MACHINE) {
+		if (sg._redGems != 0 && sg._whiteGem != 0 && sg._blueGem != 0 && sg._greenGems != 0) {
+			_G(map).load(Data::MAP_MONDIAN);
+		} else {
+			g_engine->addView("OperateCraft");
+		}
+		return false;
+	}
+
+	return true;
+}
+
 bool OverworldLogic::enter() {
 	int location = _G(map).getLocationAt(_G(savegame)._overworldPos);
 	if (location == 0) {
diff --git a/engines/ultima/ultima1/logic/overworld_logic.h b/engines/ultima/ultima1/logic/overworld_logic.h
index ceaab9bea04..d337269ad8c 100644
--- a/engines/ultima/ultima1/logic/overworld_logic.h
+++ b/engines/ultima/ultima1/logic/overworld_logic.h
@@ -108,6 +108,11 @@ private:
 	void monsterAttack(int entityIndex, int xDiff, int yDiff, int distance);
 
 protected:
+	/**
+	 * Board a vehicle the player is standing on
+	 */
+	bool board() override;
+
 	/**
 	 * Enter a location
 	 */
diff --git a/engines/ultima/ultima1/views/interactions/liftoff.cpp b/engines/ultima/ultima1/views/interactions/liftoff.cpp
new file mode 100644
index 00000000000..5b97bc86ff4
--- /dev/null
+++ b/engines/ultima/ultima1/views/interactions/liftoff.cpp
@@ -0,0 +1,81 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "ultima/ultima1/views/interactions/liftoff.h"
+#include "ultima/ultima1/data/map.h"
+#include "ultima/ultima1/ultima1.h"
+
+namespace Ultima {
+namespace Ultima1 {
+namespace Views {
+namespace Interactions {
+
+bool LiftOff::msgFocus(const FocusMessage &msg) {
+	setBounds(Common::Rect(0, 0, 0, 0));
+
+	_counter = 10;
+	showCounter();
+	delaySeconds(1);
+	return true;
+}
+
+void LiftOff::showCounter() {
+	writeString("%d", _counter);
+	if (_counter != 1)
+		writeString("..");
+}
+
+void LiftOff::timeout() {
+	if (--_counter == 0) {
+		finish();
+	} else {
+		showCounter();
+		delaySeconds(1);
+	}
+}
+
+bool LiftOff::msgAction(const ActionMessage &msg) {
+	skip();
+	return true;
+}
+
+bool LiftOff::msgKeypress(const KeypressMessage &msg) {
+	skip();
+	return true;
+}
+
+void LiftOff::skip() {
+	cancelDelay();
+	finish();
+}
+
+void LiftOff::finish() {
+	writeString("\n");
+	writeString("Thou hast lifted off!\n");
+
+	close();
+	_G(map).load(Data::MAP_SPACE);
+}
+
+} // namespace Interactions
+} // namespace Views
+} // namespace Ultima1
+} // namespace Ultima
diff --git a/engines/ultima/ultima1/views/interactions/liftoff.h b/engines/ultima/ultima1/views/interactions/liftoff.h
new file mode 100644
index 00000000000..7f95fc91abf
--- /dev/null
+++ b/engines/ultima/ultima1/views/interactions/liftoff.h
@@ -0,0 +1,78 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef ULTIMA1_VIEWS_INTERACTIONS_LIFTOFF_H
+#define ULTIMA1_VIEWS_INTERACTIONS_LIFTOFF_H
+
+#include "ultima/ultima1/views/interactions/interaction.h"
+
+namespace Ultima {
+namespace Ultima1 {
+namespace Views {
+namespace Interactions {
+
+using namespace Ultima::Shared::Messages;
+
+/**
+ * Shown when the player lifts off in a shuttle/time machine to enter the
+ * outer space section. Counts down from 10 to 1, one number every second,
+ * appending ".." after each but the last - any keypress skips the rest of
+ * the countdown. Finishes with "Thou hast lifted off!", then closes and
+ * switches to the space map
+ */
+class LiftOff : public Interaction {
+private:
+	int _counter = 10;
+
+	/**
+	 * Shows the current countdown number, with a trailing ".." if there's
+	 * more of the countdown still to come
+	 */
+	void showCounter();
+
+	/**
+	 * Skips the remainder of the countdown
+	 */
+	void skip();
+
+	/**
+	 * Shows the liftoff message, then closes and switches to the space map
+	 */
+	void finish();
+
+public:
+	LiftOff() : Interaction("LiftOff") {
+	}
+	~LiftOff() override {
+	}
+
+	bool msgFocus(const FocusMessage &msg) override;
+	bool msgAction(const ActionMessage &msg) override;
+	bool msgKeypress(const KeypressMessage &msg) override;
+	void timeout() override;
+};
+
+} // namespace Interactions
+} // namespace Views
+} // namespace Ultima1
+} // namespace Ultima
+
+#endif
diff --git a/engines/ultima/ultima1/views/interactions/operate_craft.cpp b/engines/ultima/ultima1/views/interactions/operate_craft.cpp
new file mode 100644
index 00000000000..4a4e3870f42
--- /dev/null
+++ b/engines/ultima/ultima1/views/interactions/operate_craft.cpp
@@ -0,0 +1,57 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "ultima/ultima1/views/interactions/operate_craft.h"
+
+namespace Ultima {
+namespace Ultima1 {
+namespace Views {
+namespace Interactions {
+
+bool OperateCraft::msgFocus(const FocusMessage &msg) {
+	setBounds(Common::Rect(0, 0, 0, 0));
+
+	writeString("Thou canst not determine how\n");
+	writeString("to operate the craft at this\n");
+	writeString("time.\n");
+
+	showCursor();
+	return true;
+}
+
+bool OperateCraft::msgAction(const ActionMessage &msg) {
+	finish();
+	return true;
+}
+
+bool OperateCraft::msgKeypress(const KeypressMessage &msg) {
+	finish();
+	return true;
+}
+
+void OperateCraft::finish() {
+	close();
+}
+
+} // namespace Interactions
+} // namespace Views
+} // namespace Ultima1
+} // namespace Ultima
diff --git a/engines/ultima/ultima1/views/interactions/operate_craft.h b/engines/ultima/ultima1/views/interactions/operate_craft.h
new file mode 100644
index 00000000000..f1a9ea4766b
--- /dev/null
+++ b/engines/ultima/ultima1/views/interactions/operate_craft.h
@@ -0,0 +1,59 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef ULTIMA1_VIEWS_INTERACTIONS_OPERATE_CRAFT_H
+#define ULTIMA1_VIEWS_INTERACTIONS_OPERATE_CRAFT_H
+
+#include "ultima/ultima1/views/interactions/interaction.h"
+
+namespace Ultima {
+namespace Ultima1 {
+namespace Views {
+namespace Interactions {
+
+using namespace Ultima::Shared::Messages;
+
+/**
+ * Shown when the player boards the time machine without having all four
+ * gems needed to operate it. Just a message dismissed by any keypress,
+ * returning to the overworld
+ */
+class OperateCraft : public Interaction {
+private:
+	void finish();
+
+public:
+	OperateCraft() : Interaction("OperateCraft") {
+	}
+	~OperateCraft() override {
+	}
+
+	bool msgFocus(const FocusMessage &msg) override;
+	bool msgAction(const ActionMessage &msg) override;
+	bool msgKeypress(const KeypressMessage &msg) override;
+};
+
+} // namespace Interactions
+} // namespace Views
+} // namespace Ultima1
+} // namespace Ultima
+
+#endif
diff --git a/engines/ultima/ultima1/views/views.h b/engines/ultima/ultima1/views/views.h
index f68326394ce..81693a96acf 100644
--- a/engines/ultima/ultima1/views/views.h
+++ b/engines/ultima/ultima1/views/views.h
@@ -26,7 +26,9 @@
 #include "ultima/ultima1/views/interactions/dead.h"
 #include "ultima/ultima1/views/interactions/drop.h"
 #include "ultima/ultima1/views/interactions/king.h"
+#include "ultima/ultima1/views/interactions/liftoff.h"
 #include "ultima/ultima1/views/interactions/merchant.h"
+#include "ultima/ultima1/views/interactions/operate_craft.h"
 #include "ultima/ultima1/views/interactions/princess_saved.h"
 #include "ultima/ultima1/views/interactions/ready.h"
 #include "ultima/ultima1/views/create_character.h"
@@ -47,7 +49,9 @@ struct Views : public Shared::Views {
 	Interactions::Dead _dead;
 	Interactions::Drop _drop;
 	Interactions::King _king;
+	Interactions::LiftOff _liftOff;
 	Interactions::Merchant _merchant;
+	Interactions::OperateCraft _operateCraft;
 	Interactions::PrincessSaved _princessSaved;
 	Interactions::Ready _ready;
 	CreateCharacter _createCharacter;


Commit: bc6be2f67e2390348ff3ff2089ff88ff4734aab2
    https://github.com/scummvm/scummvm/commit/bc6be2f67e2390348ff3ff2089ff88ff4734aab2
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:40:50+11:00

Commit Message:
ULTIMA: ULTIMA1: Added view for entering time machine

Changed paths:
  A engines/ultima/ultima1/views/interactions/entering_craft.cpp
  A engines/ultima/ultima1/views/interactions/entering_craft.h
    engines/ultima/module.mk
    engines/ultima/ultima1/console.cpp
    engines/ultima/ultima1/console.h
    engines/ultima/ultima1/logic/overworld_logic.cpp
    engines/ultima/ultima1/views/commands.cpp
    engines/ultima/ultima1/views/commands.h
    engines/ultima/ultima1/views/views.h
    engines/ultima/ultima1/views/zstats.cpp


diff --git a/engines/ultima/module.mk b/engines/ultima/module.mk
index 76cb91e9f53..d117adea0da 100644
--- a/engines/ultima/module.mk
+++ b/engines/ultima/module.mk
@@ -70,6 +70,7 @@ MODULE_OBJS += \
 	ultima1/views/interactions/interaction.o \
 	ultima1/views/interactions/dead.o \
 	ultima1/views/interactions/drop.o \
+	ultima1/views/interactions/entering_craft.o \
 	ultima1/views/interactions/king.o \
 	ultima1/views/interactions/liftoff.o \
 	ultima1/views/interactions/merchant.o \
diff --git a/engines/ultima/ultima1/console.cpp b/engines/ultima/ultima1/console.cpp
index 70ade96f485..30b23ed3a54 100644
--- a/engines/ultima/ultima1/console.cpp
+++ b/engines/ultima/ultima1/console.cpp
@@ -20,20 +20,38 @@
  */
 
 #include "ultima/ultima1/console.h"
+#include "ultima/ultima1/ultima1.h"
+#include "ultima/ultima1/views/dialog.h"
 
 namespace Ultima {
 namespace Ultima1 {
 
 Console::Console() : GUI::Debugger() {
-	registerCmd("test", WRAP_METHOD(Console, Cmd_test));
+	registerCmd("view", WRAP_METHOD(Console, cmdView));
 }
 
 Console::~Console() {
 }
 
-bool Console::Cmd_test(int argc, const char **argv) {
-	debugPrintf("Test\n");
-	return true;
+bool Console::cmdView(int argc, const char **argv) {
+	if (argc != 2) {
+		debugPrintf("view <view name>\n");
+		return true;
+	} else {
+		auto *view = g_engine->findView(argv[1]);
+
+		if (!view) {
+			debugPrintf("Unknown view name\n");
+			return true;
+		} else if (dynamic_cast<Views::Dialog *>(view)) {
+			g_engine->replaceView("Game", true);
+			g_engine->addView(argv[1]);
+			return false;
+		} else {
+			g_engine->replaceView(argv[1], true);
+			return false;
+		}
+	}
 }
 
 } // namespace Ultima1
diff --git a/engines/ultima/ultima1/console.h b/engines/ultima/ultima1/console.h
index 8259f1aa4b7..14fad2c1969 100644
--- a/engines/ultima/ultima1/console.h
+++ b/engines/ultima/ultima1/console.h
@@ -30,7 +30,7 @@ namespace Ultima1 {
 
 class Console : public GUI::Debugger {
 private:
-	bool Cmd_test(int argc, const char **argv);
+	bool cmdView(int argc, const char **argv);
 public:
 	Console();
 	~Console() override;
diff --git a/engines/ultima/ultima1/logic/overworld_logic.cpp b/engines/ultima/ultima1/logic/overworld_logic.cpp
index b99f75d73f2..83db01aa083 100644
--- a/engines/ultima/ultima1/logic/overworld_logic.cpp
+++ b/engines/ultima/ultima1/logic/overworld_logic.cpp
@@ -93,7 +93,9 @@ bool OverworldLogic::board() {
 
 	if (tileNum == Data::TILE_TIME_MACHINE) {
 		if (sg._redGems != 0 && sg._whiteGem != 0 && sg._blueGem != 0 && sg._greenGems != 0) {
-			_G(map).load(Data::MAP_MONDIAN);
+			// EnteringCraft shows its four instructional pages, then loads
+			// the Mondain map itself once the last one is dismissed
+			g_engine->addView("EnteringCraft");
 		} else {
 			g_engine->addView("OperateCraft");
 		}
diff --git a/engines/ultima/ultima1/views/commands.cpp b/engines/ultima/ultima1/views/commands.cpp
index 55fc88e7174..12a4f637bb4 100644
--- a/engines/ultima/ultima1/views/commands.cpp
+++ b/engines/ultima/ultima1/views/commands.cpp
@@ -58,9 +58,13 @@ bool Commands::msgGame(const GameMessage &msg) {
 		return true;
 	} else if (msg._name == "SHOW_CURSOR") {
 		showCursor();
+		return true;
 	} else if (msg._name == "PROMPT") {
 		prompt();
 		return true;
+	} else if (msg._name == "SPACE") {
+		space();
+		return true;
 	} else if (msg._name == "DELAY") {
 		delay(msg._value);
 		return true;
@@ -94,6 +98,12 @@ void Commands::prompt() {
 	showCursor();
 }
 
+void Commands::space() {
+	resetLine();
+	_surface.writeString("\x10Press Space to continue: ");
+	showCursor();
+}
+
 void Commands::delay(uint milli) {
 	g_engine->updateScreen();
 	g_engine->pauseMillis(NEWLINE_DELAY);
diff --git a/engines/ultima/ultima1/views/commands.h b/engines/ultima/ultima1/views/commands.h
index 4a6c0b68cca..86e06084cb8 100644
--- a/engines/ultima/ultima1/views/commands.h
+++ b/engines/ultima/ultima1/views/commands.h
@@ -44,6 +44,12 @@ private:
 	 */
 	void delay(uint milli);
 
+	void writeString(const Common::String &msg);
+	void resetLine();
+	void showCursor();
+	void prompt();
+	void space();
+
 public:
 	Commands(UIElement *parent);
 	~Commands() override {}
@@ -51,11 +57,6 @@ public:
 	bool msgFocus(const FocusMessage &msg) override;
 	void draw() override;
 	bool msgGame(const GameMessage &msg) override;
-
-	void writeString(const Common::String &msg);
-	void resetLine();
-	void showCursor();
-	void prompt();
 };
 
 } // namespace Views
diff --git a/engines/ultima/ultima1/views/interactions/entering_craft.cpp b/engines/ultima/ultima1/views/interactions/entering_craft.cpp
new file mode 100644
index 00000000000..8a5ef03bb07
--- /dev/null
+++ b/engines/ultima/ultima1/views/interactions/entering_craft.cpp
@@ -0,0 +1,193 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "common/util.h"
+#include "ultima/ultima1/views/interactions/entering_craft.h"
+#include "ultima/ultima1/data/map.h"
+#include "ultima/ultima1/ultima1.h"
+
+namespace Ultima {
+namespace Ultima1 {
+namespace Views {
+namespace Interactions {
+
+constexpr int TEXT_COLOR = 11;   // light cyan - matches Commands/Stats
+constexpr int BORDER_COLOR = 1;  // dark blue
+
+// The dialog's own area (matching fillDialogArea's fill rect) and, inset
+// within it, the thin border line (matching drawDialogBorder) - both given
+// here in absolute screen pixels, as in the original
+constexpr int DIALOG_X1 = 22, DIALOG_Y1 = 15, DIALOG_X2 = 300, DIALOG_Y2 = 143;
+constexpr int BORDER_X1 = 25, BORDER_Y1 = 18, BORDER_X2 = 297, BORDER_Y2 = 140;
+
+struct CraftLine {
+	int _x, _y;
+	const char *_text;
+};
+
+// Text cell positions here are the original's setCursorPos/writeStringAt
+// coordinates, adjusted by (-3, -2) to line up with this dialog's own
+// (smaller, inset) text area
+static const CraftLine PAGE1_LINES[] = {
+	{ 2, 1, "Entering the craft, thou dost" },
+	{ 2, 2, "remark upon four holes marked:" },
+	{ 9, 4, "R    G    B    W" },
+	{ 1, 7, "The proper gems fit in each hole." },
+	{ 2, 9, "Further examination leads thee" },
+	{ 8, 10, "to two discoveries:" },
+	{ 1, 12, "There is a button marked LAUNCH," },
+	{ 3, 13, "and thou art locked in, with" },
+	{ 3, 14, "nothing to do but press it!" }
+};
+
+static const CraftLine PAGE2_LINES[] = {
+	{ 1, 2, "As soon as thou hast pressed the" },
+	{ 1, 3, "large black button, lights begin" },
+	{ 1, 4, "  to dance across the control" },
+	{ 13, 5, "screens." },
+	{ 1, 7, " Generators shake the very floor" },
+	{ 9, 8, "beneath thy feet." },
+	{ 1, 10, "The small craft begins to tremble" },
+	{ 5, 11, "and rattle as thy journey" },
+	{ 6, 12, "through time begins..." }
+};
+
+static const CraftLine PAGE3_LINES[] = {
+	{ 1, 6, "After but a few moments thou dost" },
+	{ 1, 7, "feel a strong magic pulling thee" },
+	{ 9, 8, "from thy craft..." }
+};
+
+static const CraftLine PAGE4_LINES[] = {
+	{ 8, 4, "...A moment later," },
+	{ 6, 5, "thou art face to face" },
+	{ 1, 6, " with the evil Mondain himself!" },
+	{ 6, 11, "Good luck, this is it!" }
+};
+
+// X positions of the four gem holes, under the R/G/B/W heading on page 1
+// (also adjusted by -3); the row is the heading's row + 1, i.e. 5
+static const int GEM_HOLE_X[4] = { 9, 14, 19, 24 };
+constexpr int GEM_HOLE_Y = 5;
+
+// Red/Green/Blue/White, matching the gem each hole is labelled for
+static const byte GEM_COLORS[4] = { 4, 2, 9, 15 };
+
+// Per-row half-width of an 8x8 diamond, used to draw each gem as a small
+// solid diamond rather than relying on font glyphs (which the DosFont
+// doesn't have meaningful shapes for at these code points - that's set up
+// by the Mondain executable's own startup code, which isn't ported)
+static const byte GEM_DIAMOND_HALF_WIDTH[8] = { 0, 1, 2, 3, 3, 2, 1, 0 };
+
+bool EnteringCraft::msgFocus(const FocusMessage &msg) {
+	setBounds(Common::Rect(DIALOG_X1, DIALOG_Y1, DIALOG_X2, DIALOG_Y2));
+
+	_page = 1;
+	showPage();
+	return true;
+}
+
+void EnteringCraft::showPage() {
+	redraw();
+	g_engine->send("Commands", GameMessage("SPACE"));
+}
+
+void EnteringCraft::draw() {
+	auto s = getSurface();
+	s.fillRect(Common::Rect(0, 0, DIALOG_X2 - DIALOG_X1, DIALOG_Y2 - DIALOG_Y1), 0);
+	s.frameRect(Common::Rect(BORDER_X1 - DIALOG_X1, BORDER_Y1 - DIALOG_Y1,
+		BORDER_X2 - DIALOG_X1, BORDER_Y2 - DIALOG_Y1), BORDER_COLOR);
+
+	drawPageText();
+	if (_page == 1)
+		drawGemHoles();
+}
+
+void EnteringCraft::drawPageText() {
+	const CraftLine *lines = nullptr;
+	int count = 0;
+
+	switch (_page) {
+	case 1:
+		lines = PAGE1_LINES;
+		count = ARRAYSIZE(PAGE1_LINES);
+		break;
+	case 2:
+		lines = PAGE2_LINES;
+		count = ARRAYSIZE(PAGE2_LINES);
+		break;
+	case 3:
+		lines = PAGE3_LINES;
+		count = ARRAYSIZE(PAGE3_LINES);
+		break;
+	case 4:
+		lines = PAGE4_LINES;
+		count = ARRAYSIZE(PAGE4_LINES);
+		break;
+	default:
+		break;
+	}
+
+	auto s = getSurface();
+	s.setColor(TEXT_COLOR);
+	for (int i = 0; i < count; ++i)
+		s.writeString(Common::Point(lines[i]._x, lines[i]._y), lines[i]._text);
+}
+
+void EnteringCraft::drawGemHoles() {
+	for (int i = 0; i < 4; ++i)
+		drawGem(GEM_HOLE_X[i], GEM_HOLE_Y, GEM_COLORS[i]);
+}
+
+void EnteringCraft::drawGem(int cellX, int cellY, byte color) {
+	auto s = getSurface();
+	int px = cellX * 8, py = cellY * 8;
+
+	for (int row = 0; row < 8; ++row) {
+		int halfWidth = GEM_DIAMOND_HALF_WIDTH[row];
+		s.drawLine(px + 3 - halfWidth, py + row, px + 3 + halfWidth, py + row, color);
+	}
+}
+
+bool EnteringCraft::msgAction(const ActionMessage &msg) {
+	nextPage();
+	return true;
+}
+
+bool EnteringCraft::msgKeypress(const KeypressMessage &msg) {
+	nextPage();
+	return true;
+}
+
+void EnteringCraft::nextPage() {
+	if (_page < 4) {
+		++_page;
+		showPage();
+	} else {
+		close();
+		_G(map).load(Data::MAP_MONDIAN);
+	}
+}
+
+} // namespace Interactions
+} // namespace Views
+} // namespace Ultima1
+} // namespace Ultima
diff --git a/engines/ultima/ultima1/views/interactions/entering_craft.h b/engines/ultima/ultima1/views/interactions/entering_craft.h
new file mode 100644
index 00000000000..a93ef976d8a
--- /dev/null
+++ b/engines/ultima/ultima1/views/interactions/entering_craft.h
@@ -0,0 +1,90 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef ULTIMA1_VIEWS_INTERACTIONS_ENTERING_CRAFT_H
+#define ULTIMA1_VIEWS_INTERACTIONS_ENTERING_CRAFT_H
+
+#include "ultima/ultima1/views/interactions/interaction.h"
+
+namespace Ultima {
+namespace Ultima1 {
+namespace Views {
+namespace Interactions {
+
+using namespace Ultima::Shared::Messages;
+
+/**
+ * Shown after boarding the time machine with all four gems - a four page
+ * instructional dialog ("Entering the craft, thou dost remark upon four
+ * holes marked...") leading up to the trip through time. Unlike the other
+ * interactions, this one draws its own thin bordered box that doesn't
+ * cover the whole map area, matching the original's fillDialogArea/
+ * drawDialogBorder. Space (or any keypress) advances through the four
+ * pages; after the last page, closes and switches to the Mondain map
+ */
+class EnteringCraft : public Interaction {
+private:
+	int _page = 1;
+
+	/**
+	 * Draws the lines of text for the current page
+	 */
+	void drawPageText();
+
+	/**
+	 * Draws the four gems under the "R  G  B  W" heading, shown only on
+	 * the first page
+	 */
+	void drawGemHoles();
+
+	/**
+	 * Draws a small solid diamond gem icon within an 8x8 text cell
+	 */
+	void drawGem(int cellX, int cellY, byte color);
+
+	/**
+	 * Shows the current page, and prompts to continue
+	 */
+	void showPage();
+
+	/**
+	 * Advances to the next page, or finishes once the last page is done
+	 */
+	void nextPage();
+
+public:
+	EnteringCraft() : Interaction("EnteringCraft") {
+	}
+	~EnteringCraft() override {
+	}
+
+	bool msgFocus(const FocusMessage &msg) override;
+	bool msgAction(const ActionMessage &msg) override;
+	bool msgKeypress(const KeypressMessage &msg) override;
+	void draw() override;
+};
+
+} // namespace Interactions
+} // namespace Views
+} // namespace Ultima1
+} // namespace Ultima
+
+#endif
diff --git a/engines/ultima/ultima1/views/views.h b/engines/ultima/ultima1/views/views.h
index 81693a96acf..7df2f4b3aae 100644
--- a/engines/ultima/ultima1/views/views.h
+++ b/engines/ultima/ultima1/views/views.h
@@ -25,6 +25,7 @@
 #include "ultima/shared/engine/events.h"
 #include "ultima/ultima1/views/interactions/dead.h"
 #include "ultima/ultima1/views/interactions/drop.h"
+#include "ultima/ultima1/views/interactions/entering_craft.h"
 #include "ultima/ultima1/views/interactions/king.h"
 #include "ultima/ultima1/views/interactions/liftoff.h"
 #include "ultima/ultima1/views/interactions/merchant.h"
@@ -48,6 +49,7 @@ namespace Views {
 struct Views : public Shared::Views {
 	Interactions::Dead _dead;
 	Interactions::Drop _drop;
+	Interactions::EnteringCraft _enteringCraft;
 	Interactions::King _king;
 	Interactions::LiftOff _liftOff;
 	Interactions::Merchant _merchant;
diff --git a/engines/ultima/ultima1/views/zstats.cpp b/engines/ultima/ultima1/views/zstats.cpp
index 8f0dcf07734..198969b53b4 100644
--- a/engines/ultima/ultima1/views/zstats.cpp
+++ b/engines/ultima/ultima1/views/zstats.cpp
@@ -34,8 +34,7 @@ constexpr int COLOR_HIGHLIGHT = 12; // light red - currently equipped/readied it
 constexpr int LINES_PER_PAGE = 26;
 
 bool ZStats::msgFocus(const FocusMessage &msg) {
-	g_engine->send("Commands", GameMessage("TEXT", "Press Space to continue: "));
-	g_engine->send("Commands", GameMessage("SHOW_CURSOR"));
+	g_engine->send("Commands", GameMessage("SPACE"));
 
 	buildLines();
 	_pageStart = 0;


Commit: 9ae34c7a8101a80425e678d31bb0a94f259ef8cd
    https://github.com/scummvm/scummvm/commit/9ae34c7a8101a80425e678d31bb0a94f259ef8cd
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:40:50+11:00

Commit Message:
ULTIMA: ULTIMA1: Loading Mondain map data

Changed paths:
  A engines/ultima/ultima1/logic/mondain_logic.cpp
  A engines/ultima/ultima1/logic/mondain_logic.h
  A engines/ultima/ultima1/views/mondain_map.cpp
  A engines/ultima/ultima1/views/mondain_map.h
    engines/ultima/module.mk
    engines/ultima/ultima1/data/map.cpp
    engines/ultima/ultima1/data/map.h
    engines/ultima/ultima1/data/tiles.h
    engines/ultima/ultima1/views/interactions/entering_craft.cpp
    engines/ultima/ultima1/views/space_map.h
    engines/ultima/ultima1/views/views.h


diff --git a/engines/ultima/module.mk b/engines/ultima/module.mk
index d117adea0da..579787f0d83 100644
--- a/engines/ultima/module.mk
+++ b/engines/ultima/module.mk
@@ -64,6 +64,7 @@ MODULE_OBJS += \
 	ultima1/logic/logic.o \
 	ultima1/logic/city_castle_logic.o \
 	ultima1/logic/dungeon_logic.o \
+	ultima1/logic/mondain_logic.o \
 	ultima1/logic/overworld_logic.o \
 	ultima1/logic/pillar_logic.o \
 	ultima1/logic/space_logic.o \
@@ -86,6 +87,7 @@ MODULE_OBJS += \
 	ultima1/views/game.o \
 	ultima1/views/location_map.o \
 	ultima1/views/main_menu.o \
+	ultima1/views/mondain_map.o \
 	ultima1/views/overworld.o \
 	ultima1/views/overworld_map.o \
 	ultima1/views/space_map.o \
diff --git a/engines/ultima/ultima1/data/map.cpp b/engines/ultima/ultima1/data/map.cpp
index 279c6d2bc1a..cc94deff3d6 100644
--- a/engines/ultima/ultima1/data/map.cpp
+++ b/engines/ultima/ultima1/data/map.cpp
@@ -25,6 +25,7 @@
 #include "ultima/ultima1/data/tiles.h"
 #include "ultima/ultima1/logic/city_castle_logic.h"
 #include "ultima/ultima1/logic/dungeon_logic.h"
+#include "ultima/ultima1/logic/mondain_logic.h"
 #include "ultima/ultima1/logic/overworld_logic.h"
 #include "ultima/ultima1/logic/pillar_logic.h"
 #include "ultima/ultima1/logic/space_logic.h"
@@ -94,6 +95,22 @@ const char *CONTINENT_NAMES[4] = {
 	"of Danger and Despair"
 };
 
+// The Mondain encounter room. The original stores this top-to-bottom
+// columns first, then left-to-right (MONDAIN_WIDTH columns of MONDAIN_HEIGHT
+// bytes each); transposed here to left-to-right rows, top-to-bottom, for
+// consistency with the overworld/city maps
+static const byte MONDAIN_MAP[MONDAIN_HEIGHT][MONDAIN_WIDTH] = {
+	{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
+	{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 5, 5, 0, 5, 5, 5, 0 },
+	{ 0, 0, 0, 0, 0, 5, 5, 5, 5, 5, 0, 5, 0, 0, 0, 0, 0, 5, 0 },
+	{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 0, 0, 0, 0, 0, 5, 0 },
+	{ 0, 0, 1, 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0 },
+	{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 0, 0, 0, 0, 0, 5, 0 },
+	{ 0, 0, 0, 0, 0, 5, 5, 5, 5, 5, 0, 5, 0, 0, 0, 0, 0, 5, 0 },
+	{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 5, 5, 0, 5, 5, 5, 0 },
+	{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
+};
+
 void Map::init() {
 	// Load the overworld map
 	Common::File ow;
@@ -131,9 +148,13 @@ void Map::init() {
 		}
 	}
 
+	// Copy the Mondain map
+	Common::copy(&MONDAIN_MAP[0][0], &MONDAIN_MAP[0][0] + MONDAIN_WIDTH * MONDAIN_HEIGHT, &_mondainMap[0][0]);
+
 	// Load tiles
 	loadTiles("egatiles.bin", _overworldTiles, OVERWORLD_TILES_COUNT, 16);
 	loadTiles("egatown.bin", _cityTiles, CITY_TILES_COUNT, 8);
+	loadTiles("egamond.bin", _mondainTiles, MONDAIN_TILES_COUNT, 16);
 }
 
 void Map::load(int mapNum) {
@@ -145,6 +166,11 @@ void Map::load(int mapNum) {
 		_outsideMapTile = 0xff;
 		_tiles = _overworldTiles;
 
+	} else if (mapNum == MAP_MONDAIN) {
+		_mapWidth = MONDAIN_WIDTH;
+		_mapHeight = MONDAIN_HEIGHT;
+		_tiles = _mondainTiles;
+
 	} else {
 		_mapWidth = CITY_WIDTH;
 		_mapHeight = CITY_HEIGHT;
@@ -160,6 +186,9 @@ void Map::load(int mapNum) {
 	if (mapNum == MAP_SPACE) {
 		_G(logic) = Common::SharedPtr<Logic::Logic>(new Logic::SpaceLogic());
 		viewName = "SpaceMap";
+	} else if (mapNum == MAP_MONDAIN) {
+		_G(logic) = Common::SharedPtr<Logic::Logic>(new Logic::MondainLogic());
+		viewName = "MondainMap";
 	} else if (mapNum >= 49) {
 		_G(logic) = Common::SharedPtr<Logic::Logic>(new Logic::DungeonLogic());
 		viewName = "DungeonMap";
@@ -191,6 +220,12 @@ void Map::load(int mapNum) {
 		_mapRows.clear();		// Dungeon doesn't use this map
 		break;
 
+	case MAPTYPE_MONDAIN:
+		_mapRows.reserve(MONDAIN_HEIGHT);
+		for (int y = 0; y < MONDAIN_HEIGHT; ++y)
+			_mapRows.push_back(Row(this, &_mondainMap[y * OVERWORLD_WIDTH][0]));
+		break;
+
 	case MAPTYPE_SPACE:
 		_mapRows.clear();		// Outer space doesn't use this map
 		break;
diff --git a/engines/ultima/ultima1/data/map.h b/engines/ultima/ultima1/data/map.h
index 5c688f9d255..f9c72967aef 100644
--- a/engines/ultima/ultima1/data/map.h
+++ b/engines/ultima/ultima1/data/map.h
@@ -43,12 +43,15 @@ constexpr int CITY_WIDTH = 38;
 constexpr int CITY_HEIGHT = 18;
 constexpr int CITY_SIZE = CITY_WIDTH * CITY_HEIGHT;
 
+constexpr int MONDAIN_WIDTH = 19;
+constexpr int MONDAIN_HEIGHT = 9;
+
 constexpr int LOCATION_COUNT = 84;
 
 enum {
 	MAP_OVERWORLD = 0,
 	MAP_SPACE = 90,
-	MAP_MONDIAN = 91
+	MAP_MONDAIN = 91
 };
 
 enum Direction {
@@ -60,7 +63,8 @@ enum MapType {
 	MAPTYPE_CITY = 1,
 	MAPTYPE_CASTLE = 2,
 	MAPTYPE_DUNGEON = 3,
-	MAPTYPE_SPACE = 4
+	MAPTYPE_SPACE = 4,
+	MAPTYPE_MONDAIN = 5
 };
 
 typedef Common::Array< Common::Array<byte> > MapTiles;
@@ -73,6 +77,7 @@ struct Map {
 private:
 	Common::Array<byte> _overworldMap;		// Cached overworld map data
 	Common::Array<byte> _cityMap[10];		// Cached city/castle/town maps
+	byte _mondainMap[MONDAIN_HEIGHT][MONDAIN_WIDTH];	// Cached Mondain encounter map
 
 	MapTiles _mapTiles;						// Visible on-screen tiles
 	int _mapWidth = 0, _mapHeight = 0;		// Map width/height
@@ -110,6 +115,7 @@ private:
 	Common::Array<Row> _mapRows;			// Used for array operator getting map contents
 	Graphics::ManagedSurface _overworldTiles[OVERWORLD_TILES_COUNT];
 	Graphics::ManagedSurface _cityTiles[CITY_TILES_COUNT];
+	Graphics::ManagedSurface _mondainTiles[MONDAIN_TILES_COUNT];
 
 	/**
 	 * Used to generate the dungeon.
diff --git a/engines/ultima/ultima1/data/tiles.h b/engines/ultima/ultima1/data/tiles.h
index 0214618e287..1a67a7ab8ef 100644
--- a/engines/ultima/ultima1/data/tiles.h
+++ b/engines/ultima/ultima1/data/tiles.h
@@ -30,6 +30,7 @@ namespace Data {
 
 constexpr int OVERWORLD_TILES_COUNT = 52;
 constexpr int CITY_TILES_COUNT = 51;
+constexpr int MONDAIN_TILES_COUNT = 19;
 
 enum OverworldTileId {
 	TILE_OCEAN = 0,
diff --git a/engines/ultima/ultima1/logic/mondain_logic.cpp b/engines/ultima/ultima1/logic/mondain_logic.cpp
new file mode 100644
index 00000000000..8356e35afb2
--- /dev/null
+++ b/engines/ultima/ultima1/logic/mondain_logic.cpp
@@ -0,0 +1,41 @@
+
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "ultima/ultima1/logic/mondain_logic.h"
+#include "ultima/ultima1/data/map.h"
+#include "ultima/ultima1/metaengine.h"
+#include "ultima/ultima1/ultima1.h"
+
+namespace Ultima {
+namespace Ultima1 {
+namespace Logic {
+
+MondainLogic::MondainLogic() {
+}
+
+void MondainLogic::entering() {
+	// TODO
+}
+
+} // namespace Logic
+} // namespace Ultima1
+} // namespace Ultima
diff --git a/engines/ultima/ultima1/logic/mondain_logic.h b/engines/ultima/ultima1/logic/mondain_logic.h
new file mode 100644
index 00000000000..b575ffe1649
--- /dev/null
+++ b/engines/ultima/ultima1/logic/mondain_logic.h
@@ -0,0 +1,56 @@
+
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef ULTIMA2_LOGIC_MONDAIN_LOGIC_H
+#define ULTIMA2_LOGIC_MONDAIN_LOGIC_H
+
+#include "ultima/ultima1/logic/logic.h"
+
+namespace Ultima {
+namespace Ultima1 {
+namespace Logic {
+
+class MondainLogic : public Logic {
+protected:
+	bool move(Data::Direction dir) override {
+		return true;
+	}
+
+	/**
+	 * Handles updating creatures/NPCs
+	 */
+	void updateCreatures() override {
+	}
+
+public:
+	MondainLogic();
+	~MondainLogic() override {
+	}
+
+	void entering() override;
+};
+
+} // namespace Logic
+} // namespace Ultima1
+} // namespace Ultima
+
+#endif
diff --git a/engines/ultima/ultima1/views/interactions/entering_craft.cpp b/engines/ultima/ultima1/views/interactions/entering_craft.cpp
index 8a5ef03bb07..4f10bac73ad 100644
--- a/engines/ultima/ultima1/views/interactions/entering_craft.cpp
+++ b/engines/ultima/ultima1/views/interactions/entering_craft.cpp
@@ -183,7 +183,7 @@ void EnteringCraft::nextPage() {
 		showPage();
 	} else {
 		close();
-		_G(map).load(Data::MAP_MONDIAN);
+		_G(map).load(Data::MAP_MONDAIN);
 	}
 }
 
diff --git a/engines/ultima/ultima1/views/mondain_map.cpp b/engines/ultima/ultima1/views/mondain_map.cpp
new file mode 100644
index 00000000000..50da847ad58
--- /dev/null
+++ b/engines/ultima/ultima1/views/mondain_map.cpp
@@ -0,0 +1,42 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "ultima/ultima1/views/mondain_map.h"
+#include "ultima/ultima1/ultima1.h"
+#include "ultima/ultima1/metaengine.h"
+
+namespace Ultima {
+namespace Ultima1 {
+namespace Views {
+
+constexpr int TILE_WIDTH = 16;
+constexpr int TILE_HEIGHT = 16;
+constexpr int ATTACK_TILE_DELAY = 100;	// Delay after flashing an attack tile
+
+void MondainMap::draw() {
+	Dialog::draw();
+
+	// TODO
+}
+
+} // namespace Views
+} // namespace Ultima1
+} // namespace Ultima
diff --git a/engines/ultima/ultima1/views/mondain_map.h b/engines/ultima/ultima1/views/mondain_map.h
new file mode 100644
index 00000000000..9d375291f77
--- /dev/null
+++ b/engines/ultima/ultima1/views/mondain_map.h
@@ -0,0 +1,46 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef ULTIMA1_VIEWS_MONDAIN_MAP_H
+#define ULTIMA1_VIEWS_MONDAIN_MAP_H
+
+#include "ultima/ultima1/views/dialog.h"
+#include "ultima/ultima1/data/map.h"
+
+namespace Ultima {
+namespace Ultima1 {
+namespace Views {
+
+using namespace Shared::Messages;
+
+class MondainMap : public Dialog {
+public:
+	MondainMap() : Dialog("MondainMap") {}
+	~MondainMap() override {}
+
+	void draw() override;
+};
+
+} // namespace Views
+} // namespace Ultima1
+} // namespace Ultima
+
+#endif
diff --git a/engines/ultima/ultima1/views/space_map.h b/engines/ultima/ultima1/views/space_map.h
index 42b4cbcd5d6..3e2a87cb5d8 100644
--- a/engines/ultima/ultima1/views/space_map.h
+++ b/engines/ultima/ultima1/views/space_map.h
@@ -38,9 +38,7 @@ public:
 
 	bool msgFocus(const FocusMessage &msg) override;
 	bool msgUnfocus(const UnfocusMessage &msg) override;
-	bool msgAttackTile(const AttackTileMessage &msg) override;
 	void draw() override;
-	void timeout() override;
 };
 
 } // namespace Views
diff --git a/engines/ultima/ultima1/views/views.h b/engines/ultima/ultima1/views/views.h
index 7df2f4b3aae..2bff6dfb9d8 100644
--- a/engines/ultima/ultima1/views/views.h
+++ b/engines/ultima/ultima1/views/views.h
@@ -37,7 +37,9 @@
 #include "ultima/ultima1/views/game.h"
 #include "ultima/ultima1/views/location_map.h"
 #include "ultima/ultima1/views/main_menu.h"
+#include "ultima/ultima1/views/mondain_map.h"
 #include "ultima/ultima1/views/overworld_map.h"
+#include "ultima/ultima1/views/space_map.h"
 #include "ultima/ultima1/views/startup.h"
 #include "ultima/ultima1/views/title.h"
 #include "ultima/ultima1/views/zstats.h"
@@ -61,7 +63,9 @@ struct Views : public Shared::Views {
 	Game _game;
 	LocationMap _locationMap;
 	MainMenu _mainMenu;
+	MondainMap _mondainMap;
 	OverworldMap _overworldMap;
+	SpaceMap _spaceMap;
 	Startup _startup;
 	Title _title;
 	ZStats _zStats;


Commit: 7f0a0e088b50e7e1011a72671245bf10eec83607
    https://github.com/scummvm/scummvm/commit/7f0a0e088b50e7e1011a72671245bf10eec83607
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:40:50+11:00

Commit Message:
ULTIMA: ULTIMA1: Basic Mondain map rendering

Changed paths:
    engines/ultima/ultima1/console.cpp
    engines/ultima/ultima1/console.h
    engines/ultima/ultima1/data/map.cpp
    engines/ultima/ultima1/data/map.h
    engines/ultima/ultima1/data/tiles.h
    engines/ultima/ultima1/logic/mondain_logic.cpp
    engines/ultima/ultima1/views/mondain_map.cpp
    engines/ultima/ultima1/views/mondain_map.h


diff --git a/engines/ultima/ultima1/console.cpp b/engines/ultima/ultima1/console.cpp
index 30b23ed3a54..57bba03e3e8 100644
--- a/engines/ultima/ultima1/console.cpp
+++ b/engines/ultima/ultima1/console.cpp
@@ -28,6 +28,7 @@ namespace Ultima1 {
 
 Console::Console() : GUI::Debugger() {
 	registerCmd("view", WRAP_METHOD(Console, cmdView));
+	registerCmd("map", WRAP_METHOD(Console, cmdMap));
 }
 
 Console::~Console() {
@@ -54,5 +55,17 @@ bool Console::cmdView(int argc, const char **argv) {
 	}
 }
 
+bool Console::cmdMap(int argc, const char **argv) {
+	if (argc != 2) {
+		debugPrintf("map <map num>\n");
+		return true;
+	} else {
+		int mapNum = atoi(argv[1]);
+		_G(map).load(mapNum);
+		_G(logic)->entering();
+		return false;
+	}
+}
+
 } // namespace Ultima1
 } // namespace Ultima
diff --git a/engines/ultima/ultima1/console.h b/engines/ultima/ultima1/console.h
index 14fad2c1969..ffb8803f9e9 100644
--- a/engines/ultima/ultima1/console.h
+++ b/engines/ultima/ultima1/console.h
@@ -31,6 +31,7 @@ namespace Ultima1 {
 class Console : public GUI::Debugger {
 private:
 	bool cmdView(int argc, const char **argv);
+	bool cmdMap(int argc, const char **argv);
 public:
 	Console();
 	~Console() override;
diff --git a/engines/ultima/ultima1/data/map.cpp b/engines/ultima/ultima1/data/map.cpp
index cc94deff3d6..55874e96b0d 100644
--- a/engines/ultima/ultima1/data/map.cpp
+++ b/engines/ultima/ultima1/data/map.cpp
@@ -154,7 +154,11 @@ void Map::init() {
 	// Load tiles
 	loadTiles("egatiles.bin", _overworldTiles, OVERWORLD_TILES_COUNT, 16);
 	loadTiles("egatown.bin", _cityTiles, CITY_TILES_COUNT, 8);
-	loadTiles("egamond.bin", _mondainTiles, MONDAIN_TILES_COUNT, 16);
+
+	// Tile 0 is a blank empty floor tile, followed by 19 tiles, and tile 20 is duplicated from egatiles.bin
+	_mondainTiles[0].create(16, 16, Graphics::PixelFormat::createFormatCLUT8());
+	loadTiles("egamond.bin", &_mondainTiles[1], MONDAIN_TILES_COUNT, 16);
+	_mondainTiles[20] = _overworldTiles[TILE_PLAYER];
 }
 
 void Map::load(int mapNum) {
@@ -223,7 +227,7 @@ void Map::load(int mapNum) {
 	case MAPTYPE_MONDAIN:
 		_mapRows.reserve(MONDAIN_HEIGHT);
 		for (int y = 0; y < MONDAIN_HEIGHT; ++y)
-			_mapRows.push_back(Row(this, &_mondainMap[y * OVERWORLD_WIDTH][0]));
+			_mapRows.push_back(Row(this, &_mondainMap[y][0]));
 		break;
 
 	case MAPTYPE_SPACE:
diff --git a/engines/ultima/ultima1/data/map.h b/engines/ultima/ultima1/data/map.h
index f9c72967aef..32a4e599651 100644
--- a/engines/ultima/ultima1/data/map.h
+++ b/engines/ultima/ultima1/data/map.h
@@ -115,7 +115,7 @@ private:
 	Common::Array<Row> _mapRows;			// Used for array operator getting map contents
 	Graphics::ManagedSurface _overworldTiles[OVERWORLD_TILES_COUNT];
 	Graphics::ManagedSurface _cityTiles[CITY_TILES_COUNT];
-	Graphics::ManagedSurface _mondainTiles[MONDAIN_TILES_COUNT];
+	Graphics::ManagedSurface _mondainTiles[MONDAIN_TILES_COUNT + 2];
 
 	/**
 	 * Used to generate the dungeon.
diff --git a/engines/ultima/ultima1/data/tiles.h b/engines/ultima/ultima1/data/tiles.h
index 1a67a7ab8ef..a17bed3e194 100644
--- a/engines/ultima/ultima1/data/tiles.h
+++ b/engines/ultima/ultima1/data/tiles.h
@@ -89,6 +89,10 @@ enum LocationTileId {
 	CTILE_BLANK = 63
 };
 
+enum MondainTileId {
+	MTILE_PLAYER = 20
+};
+
 /**
  * Loads the overworld tile sheet (52 16x16 tiles, 4-bit EGA planar,
  * row-interleaved: each 16-pixel row is 4 planes x 2 bytes) into a
diff --git a/engines/ultima/ultima1/logic/mondain_logic.cpp b/engines/ultima/ultima1/logic/mondain_logic.cpp
index 8356e35afb2..765f65b2337 100644
--- a/engines/ultima/ultima1/logic/mondain_logic.cpp
+++ b/engines/ultima/ultima1/logic/mondain_logic.cpp
@@ -30,10 +30,11 @@ namespace Ultima1 {
 namespace Logic {
 
 MondainLogic::MondainLogic() {
+	_G(map)._mapType = Data::MAPTYPE_MONDAIN;
 }
 
 void MondainLogic::entering() {
-	// TODO
+	_G(savegame)._locationPosition = Common::Point(3, 4);
 }
 
 } // namespace Logic
diff --git a/engines/ultima/ultima1/views/mondain_map.cpp b/engines/ultima/ultima1/views/mondain_map.cpp
index 50da847ad58..4d6ba028ba6 100644
--- a/engines/ultima/ultima1/views/mondain_map.cpp
+++ b/engines/ultima/ultima1/views/mondain_map.cpp
@@ -31,10 +31,54 @@ constexpr int TILE_WIDTH = 16;
 constexpr int TILE_HEIGHT = 16;
 constexpr int ATTACK_TILE_DELAY = 100;	// Delay after flashing an attack tile
 
+
+bool MondainMap::msgFocus(const FocusMessage &msg) {
+	MetaEngine::setKeybindingMode(KBMODE_GAMEPLAY);
+	delayFrames(1);
+	return UIElement::msgFocus(msg);
+}
+
+bool MondainMap::msgUnfocus(const UnfocusMessage &msg) {
+	MetaEngine::setKeybindingMode(KBMODE_MINIMAL);
+	return Dialog::msgUnfocus(msg);
+}
+
+bool MondainMap::tick() {
+	redraw();
+	return Dialog::tick();
+}
+
 void MondainMap::draw() {
+	auto &map = g_engine->_map;
+	const Graphics::ManagedSurface *tiles = map.tiles();
+	auto s = getSurface();
+	const auto &pos = _G(savegame)._locationPosition;
+
 	Dialog::draw();
 
-	// TODO
+	// Draw the visible map contents
+	for (int oy = 0; oy < Data::MONDAIN_HEIGHT; oy++) {
+		for (int ox = 0; ox < Data::MONDAIN_WIDTH; ox++) {
+			int tileId = _G(map).getTileAt(ox, oy);
+
+			const Graphics::ManagedSurface &tileImg = tiles[tileId];
+			s.blitFrom(tileImg, Common::Point(ox * TILE_WIDTH + 8, oy * TILE_HEIGHT + 8));
+		}
+	}
+
+#if 0
+	// Draw any people in the location
+	for (const auto &entity : _G(savegame)._locationEntities) {
+		if (entity._type != -1) {
+			const Graphics::ManagedSurface &tileImg = tiles[entity._type];
+			s.blitFrom(tileImg, Common::Point(entity._position.x * TILE_WIDTH + 8, entity._position.y * TILE_HEIGHT + 8));
+		}
+	}
+#endif
+
+	// Draw the player
+	const Graphics::ManagedSurface &tileImg = tiles[Data::MTILE_PLAYER];
+	s.blitFrom(tileImg, Common::Point(pos.x * TILE_WIDTH + 8, pos.y * TILE_HEIGHT + 8));
 }
 
 } // namespace Views
diff --git a/engines/ultima/ultima1/views/mondain_map.h b/engines/ultima/ultima1/views/mondain_map.h
index 9d375291f77..950738f8b0c 100644
--- a/engines/ultima/ultima1/views/mondain_map.h
+++ b/engines/ultima/ultima1/views/mondain_map.h
@@ -36,7 +36,10 @@ public:
 	MondainMap() : Dialog("MondainMap") {}
 	~MondainMap() override {}
 
+	bool msgFocus(const FocusMessage &msg) override;
+	bool msgUnfocus(const UnfocusMessage &msg) override;
 	void draw() override;
+	bool tick() override;
 };
 
 } // namespace Views


Commit: b0e0de70a7cdb3b8beaa0f13fa393de0b836a895
    https://github.com/scummvm/scummvm/commit/b0e0de70a7cdb3b8beaa0f13fa393de0b836a895
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:40:50+11:00

Commit Message:
ULTIMA: ULTIMA1: Mondain map command overrides

Changed paths:
    engines/ultima/ultima1/data/savegame.h
    engines/ultima/ultima1/logic/logic.cpp
    engines/ultima/ultima1/logic/logic.h
    engines/ultima/ultima1/logic/mondain_logic.cpp
    engines/ultima/ultima1/logic/mondain_logic.h


diff --git a/engines/ultima/ultima1/data/savegame.h b/engines/ultima/ultima1/data/savegame.h
index 9c874035e92..3c478733e87 100644
--- a/engines/ultima/ultima1/data/savegame.h
+++ b/engines/ultima/ultima1/data/savegame.h
@@ -192,6 +192,9 @@ public:
 	uint8 _dungeonDirection = 4;
 	uint16 _dungeonExitHitPoints = 0;
 
+	bool _gemDestroyedFlag = false;
+	Common::Point _mondainPos;
+
 	/**
 	 * Synchronize savegame data
 	*/
diff --git a/engines/ultima/ultima1/logic/logic.cpp b/engines/ultima/ultima1/logic/logic.cpp
index 8909ff75191..a2f5029f79f 100644
--- a/engines/ultima/ultima1/logic/logic.cpp
+++ b/engines/ultima/ultima1/logic/logic.cpp
@@ -114,6 +114,9 @@ void Logic::action(int action) {
 	case KEYBIND_ENTER:
 		doEndOfTurn = enter();
 		break;
+	case KEYBIND_EXIT:
+		doEndOfTurn = xit();
+		break;
 	case KEYBIND_FIRE:
 		doEndOfTurn = fire();
 		break;
@@ -284,6 +287,12 @@ bool Logic::transact() {
 	return true;
 }
 
+bool Logic::xit() {
+	writeString("Xit?\n");
+	playFX(1);
+	return true;
+}
+
 bool Logic::zstats() {
 	writeString("Ztats\n");
 	g_engine->addView("ZStats");
diff --git a/engines/ultima/ultima1/logic/logic.h b/engines/ultima/ultima1/logic/logic.h
index ec6a5d15188..38b8c2fae90 100644
--- a/engines/ultima/ultima1/logic/logic.h
+++ b/engines/ultima/ultima1/logic/logic.h
@@ -106,6 +106,7 @@ protected:
 	virtual bool ready();
 	virtual bool steal();
 	virtual bool transact();
+	virtual bool xit();
 	virtual bool zstats();
 	virtual bool move(Data::Direction dir) = 0;
 	virtual bool pass();
diff --git a/engines/ultima/ultima1/logic/mondain_logic.cpp b/engines/ultima/ultima1/logic/mondain_logic.cpp
index 765f65b2337..5ae202cd9cb 100644
--- a/engines/ultima/ultima1/logic/mondain_logic.cpp
+++ b/engines/ultima/ultima1/logic/mondain_logic.cpp
@@ -35,6 +35,55 @@ MondainLogic::MondainLogic() {
 
 void MondainLogic::entering() {
 	_G(savegame)._locationPosition = Common::Point(3, 4);
+	_G(savegame)._mondainPos = Common::Point(15, 4);
+}
+
+bool MondainLogic::move(Data::Direction dir) {
+	// TODO
+	return true;
+}
+
+void MondainLogic::updateCreatures() {
+	// TODO
+}
+
+bool MondainLogic::get() {
+	return true;
+}
+
+bool MondainLogic::inform() {
+	if (_G(savegame)._gemDestroyedFlag) {
+		writeString("Inform and Search\n");
+		writeString("Mondain's magical aura doth\n");
+		writeString("seem substantially diminished\n");
+		writeString("in the absence of the gem.\n");
+	} else {
+		writeString("Inform and Search...it looks\n");
+		writeString("as if he is creating the evil\n");
+		writeString("gem!\n");
+	}
+
+	return true;
+}
+
+bool MondainLogic::quit() {
+	writeString("Quit...is not allowed!\n");
+	playFX(1);
+	return true;
+}
+
+bool MondainLogic::steal() {
+	writeString("Steal...he's watching,\n");
+	writeString("That would be foolish!\n");
+	playFX(1);
+	return true;
+}
+
+bool MondainLogic::transact() {
+	writeString("Transact...Mondain will\n");
+	writeString("not negotiate!\n");
+	playFX(1);
+	return true;
 }
 
 } // namespace Logic
diff --git a/engines/ultima/ultima1/logic/mondain_logic.h b/engines/ultima/ultima1/logic/mondain_logic.h
index b575ffe1649..f30224b17d6 100644
--- a/engines/ultima/ultima1/logic/mondain_logic.h
+++ b/engines/ultima/ultima1/logic/mondain_logic.h
@@ -31,15 +31,18 @@ namespace Logic {
 
 class MondainLogic : public Logic {
 protected:
-	bool move(Data::Direction dir) override {
-		return true;
-	}
+	bool move(Data::Direction dir) override;
 
 	/**
 	 * Handles updating creatures/NPCs
 	 */
-	void updateCreatures() override {
-	}
+	void updateCreatures() override;
+
+	bool get() override;
+	bool inform() override;
+	bool quit() override;
+	bool steal() override;
+	bool transact() override;
 
 public:
 	MondainLogic();


Commit: 94bcb2dcc0aaccb56dd28c4e4710aa2398176d9c
    https://github.com/scummvm/scummvm/commit/94bcb2dcc0aaccb56dd28c4e4710aa2398176d9c
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:40:51+11:00

Commit Message:
ULTIMA: ULTIMA1: Properly implement Pillar dialog

Changed paths:
  A engines/ultima/ultima1/views/interactions/pillar.cpp
  A engines/ultima/ultima1/views/interactions/pillar.h
  R engines/ultima/ultima1/logic/pillar_logic.cpp
  R engines/ultima/ultima1/logic/pillar_logic.h
    engines/ultima/module.mk
    engines/ultima/ultima1/console.cpp
    engines/ultima/ultima1/data/map.cpp
    engines/ultima/ultima1/logic/overworld_logic.cpp
    engines/ultima/ultima1/views/views.h


diff --git a/engines/ultima/module.mk b/engines/ultima/module.mk
index 579787f0d83..8eba2c8a0a9 100644
--- a/engines/ultima/module.mk
+++ b/engines/ultima/module.mk
@@ -66,7 +66,6 @@ MODULE_OBJS += \
 	ultima1/logic/dungeon_logic.o \
 	ultima1/logic/mondain_logic.o \
 	ultima1/logic/overworld_logic.o \
-	ultima1/logic/pillar_logic.o \
 	ultima1/logic/space_logic.o \
 	ultima1/views/interactions/interaction.o \
 	ultima1/views/interactions/dead.o \
@@ -76,6 +75,7 @@ MODULE_OBJS += \
 	ultima1/views/interactions/liftoff.o \
 	ultima1/views/interactions/merchant.o \
 	ultima1/views/interactions/operate_craft.o \
+	ultima1/views/interactions/pillar.o \
 	ultima1/views/interactions/princess_saved.o \
 	ultima1/views/interactions/ready.o \
 	ultima1/views/view.o \
diff --git a/engines/ultima/ultima1/console.cpp b/engines/ultima/ultima1/console.cpp
index 57bba03e3e8..7355dc09d16 100644
--- a/engines/ultima/ultima1/console.cpp
+++ b/engines/ultima/ultima1/console.cpp
@@ -60,9 +60,15 @@ bool Console::cmdMap(int argc, const char **argv) {
 		debugPrintf("map <map num>\n");
 		return true;
 	} else {
-		int mapNum = atoi(argv[1]);
-		_G(map).load(mapNum);
-		_G(logic)->entering();
+		int location = atoi(argv[1]);
+
+		if (location >= 41 && location < 49) {
+			g_engine->send("Pillar", Shared::Messages::GameMessage("PILLAR", location - 41));
+		} else {
+			_G(map).load(location);
+			_G(logic)->entering();
+		}
+
 		return false;
 	}
 }
diff --git a/engines/ultima/ultima1/data/map.cpp b/engines/ultima/ultima1/data/map.cpp
index 55874e96b0d..1f0e049ac3e 100644
--- a/engines/ultima/ultima1/data/map.cpp
+++ b/engines/ultima/ultima1/data/map.cpp
@@ -27,7 +27,6 @@
 #include "ultima/ultima1/logic/dungeon_logic.h"
 #include "ultima/ultima1/logic/mondain_logic.h"
 #include "ultima/ultima1/logic/overworld_logic.h"
-#include "ultima/ultima1/logic/pillar_logic.h"
 #include "ultima/ultima1/logic/space_logic.h"
 #include "ultima/ultima1/views/dialog.h"
 #include "ultima/ultima1/ultima1.h"
@@ -202,10 +201,8 @@ void Map::load(int mapNum) {
 	} else {
 		if (mapNum < 33)
 			_G(logic) = Common::SharedPtr<Logic::Logic>(new Logic::CityLogic());
-		else if (mapNum < 41)
-			_G(logic) = Common::SharedPtr<Logic::Logic>(new Logic::CastleLogic());
 		else
-			_G(logic) = Common::SharedPtr<Logic::Logic>(new Logic::PillarLogic());
+			_G(logic) = Common::SharedPtr<Logic::Logic>(new Logic::CastleLogic());
 
 		viewName = "LocationMap";
 	}
diff --git a/engines/ultima/ultima1/logic/overworld_logic.cpp b/engines/ultima/ultima1/logic/overworld_logic.cpp
index 83db01aa083..f53945ae1b4 100644
--- a/engines/ultima/ultima1/logic/overworld_logic.cpp
+++ b/engines/ultima/ultima1/logic/overworld_logic.cpp
@@ -145,8 +145,13 @@ bool OverworldLogic::enter() {
 		msg += "\n";
 		writeString(msg);
 
-		// Load the new location
-		_G(map).load(location);
+		if (location >= 41 && location < 49) {
+			g_engine->send("Pillar", Shared::Messages::GameMessage("PILLAR", location - 41));
+
+		} else {
+			// Load the new location
+			_G(map).load(location);
+		}
 
 		// Run any logic for entering it
 		_G(logic)->entering();
diff --git a/engines/ultima/ultima1/logic/pillar_logic.cpp b/engines/ultima/ultima1/logic/pillar_logic.cpp
deleted file mode 100644
index b57a7edcef4..00000000000
--- a/engines/ultima/ultima1/logic/pillar_logic.cpp
+++ /dev/null
@@ -1,49 +0,0 @@
-
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-#include "ultima/ultima1/logic/pillar_logic.h"
-#include "ultima/ultima1/data/map.h"
-#include "ultima/ultima1/metaengine.h"
-#include "ultima/ultima1/ultima1.h"
-
-namespace Ultima {
-namespace Ultima1 {
-namespace Logic {
-
-PillarLogic::PillarLogic() {
-}
-
-void PillarLogic::entering() {
-	// TODO
-}
-
-void PillarLogic::action(int action) {
-	// TODO
-}
-
-void PillarLogic::keypress(Common::KeyCode keycode) {
-	action(KEYBIND_PASS);
-}
-
-} // namespace Logic
-} // namespace Ultima1
-} // namespace Ultima
diff --git a/engines/ultima/ultima1/logic/pillar_logic.h b/engines/ultima/ultima1/logic/pillar_logic.h
deleted file mode 100644
index 132223dfe26..00000000000
--- a/engines/ultima/ultima1/logic/pillar_logic.h
+++ /dev/null
@@ -1,58 +0,0 @@
-
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-#ifndef ULTIMA2_LOGIC_PILLAR_LOGIC_H
-#define ULTIMA2_LOGIC_PILLAR_LOGIC_H
-
-#include "ultima/ultima1/logic/logic.h"
-
-namespace Ultima {
-namespace Ultima1 {
-namespace Logic {
-
-class PillarLogic : public Logic {
-protected:
-	bool move(Data::Direction dir) override {
-		return true;
-	}
-
-	/**
-	 * Handles updating creatures/NPCs
-	 */
-	void updateCreatures() override {
-	}
-
-public:
-	PillarLogic();
-	~PillarLogic() override {
-	}
-
-	void entering() override;
-	void action(int action) override;
-	void keypress(Common::KeyCode keycode) override;
-};
-
-} // namespace Logic
-} // namespace Ultima1
-} // namespace Ultima
-
-#endif
diff --git a/engines/ultima/ultima1/views/interactions/pillar.cpp b/engines/ultima/ultima1/views/interactions/pillar.cpp
new file mode 100644
index 00000000000..26df4b46305
--- /dev/null
+++ b/engines/ultima/ultima1/views/interactions/pillar.cpp
@@ -0,0 +1,249 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "ultima/ultima1/views/interactions/pillar.h"
+#include "ultima/ultima1/core/strings.h"
+#include "ultima/ultima1/ultima1.h"
+
+namespace Ultima {
+namespace Ultima1 {
+namespace Views {
+namespace Interactions {
+
+constexpr int COLOR_TEXT = 11;   // light cyan - matches Commands/Stats
+constexpr int COLOR_BORDER = 1;  // dark blue
+constexpr int COLOR_EDGE = 15;   // white - brief "success" flash colour
+
+// The dialog box's own area, and the thin border line inset within it -
+// both given here in absolute screen pixels, as in the original
+constexpr int DIALOG_X1 = 31, DIALOG_Y1 = 23, DIALOG_X2 = 287, DIALOG_Y2 = 127;
+constexpr int BORDER_X1 = 34, BORDER_Y1 = 26, BORDER_X2 = 284, BORDER_Y2 = 124;
+
+// Which attribute (into ATTRIBUTE_NAMES/attributeRef below) each of the 8
+// pillars raises; -1 marks the two special-cased pillars - location 2
+// (finds a weapon instead) and location 6 (does nothing at all)
+static const int8 ATTRIBUTE_INDEXES[8] = { 2, 6, -1, 5, 3, 4, -1, 3 };
+
+static const char *const ATTRIBUTE_NAMES[7] = {
+	"Hit Points", "Strength", "Agility", "Stamina", "Charisma", "Wisdom", "Intelligence"
+};
+
+int16 &attributeRef(Data::Savegame &sg, int attrIndex) {
+	switch (attrIndex) {
+	case 0:
+		return sg._hits;
+	case 1:
+		return sg._strength;
+	case 2:
+		return sg._agility;
+	case 3:
+		return sg._stamina;
+	case 4:
+		return sg._charisma;
+	case 5:
+		return sg._wisdom;
+	default:
+		return sg._intelligence;
+	}
+}
+
+bool Pillar::msgGame(const GameMessage &msg) {
+	if (msg._name == "PILLAR") {
+		_locationNum = msg._value;
+		addView();
+		return true;
+	}
+
+	return false;
+}
+
+bool Pillar::msgFocus(const FocusMessage &msg) {
+	setBounds(TextRect(0, 0, 39, 19));
+	_borderColor = COLOR_BORDER;
+
+	auto &sg = _G(savegame);
+	bool success;
+
+	if ((_locationNum % 2) != 0)
+		questCompleted(_locationNum);
+
+	if (_locationNum == sg._signMarker) {
+		// Already read this particular pillar before - no repeat reward
+		success = false;
+	} else {
+		sg._signMarker = _locationNum;
+
+		int attrIndex = ATTRIBUTE_INDEXES[_locationNum];
+		if (attrIndex < 0)
+			success = (_locationNum == 2) && findWeapon();
+		else
+			success = gainAttribute(attrIndex);
+	}
+
+	if (success) {
+		// Flash the border briefly to celebrate the reward
+		_borderColor = COLOR_EDGE;
+		g_engine->playFX(5);
+		delaySeconds(1);
+	} else if (_locationNum != 6) {
+		writeString("Hmmmm...no effect!");
+		g_engine->playFX(6);
+	}
+
+	redraw();
+	return true;
+}
+
+void Pillar::timeout() {
+	_borderColor = COLOR_BORDER;
+	redraw();
+}
+
+void Pillar::draw() {
+	auto s = getSurface();
+	s.fillRect(Rect(DIALOG_X1, DIALOG_Y1, DIALOG_X2, DIALOG_Y2), 0);
+	s.frameRect(Rect(BORDER_X1, BORDER_Y1, BORDER_X2, BORDER_Y2), _borderColor);
+
+	s.setColor(COLOR_TEXT);
+	drawInscription();
+}
+
+void Pillar::drawInscription() {
+	auto s = getSurface();
+
+	switch (_locationNum) {
+	case 0:
+		s.writeString(Point(8, 8), "You feel a strong magic");
+		s.writeString(Point(12, 9), "surrounding you!");
+		break;
+	case 1:
+		s.writeString(Point(10, 7), "You hear someone say,");
+		s.writeString(Point(6, 9), " \"TURIS-SCIENTIA-MAGNOPERE\"");
+		break;
+	case 2:
+		s.writeString(Point(13, 7), "A sign reads:");
+		s.writeString(Point(8, 9), "\"FORTES FORTUNA ADIUVAT!\"");
+		break;
+	case 3:
+		s.writeString(Point(13, 5), "On a pedestal,");
+		s.writeString(Point(10, 6), "these words appear:");
+		s.writeString(Point(8, 7), "\"MY NAME IS OZYMANDIAS,");
+		s.writeString(Point(13, 8), "KING OF KINGS:");
+		s.writeString(Point(11, 9), "LOOK AT MY WORKS,");
+		s.writeString(Point(8, 10), "YE MIGHTY, AND DESPAIR!\"");
+		s.writeString(Point(8, 12), "Nothing beside remains.");
+		s.writeString(Point(7, 13), "You feel a strange force!");
+		break;
+	case 4:
+		s.writeString(Point(12, 6), "The sign reads:");
+		s.writeString(Point(12, 8), "\"ULTIMA THULE!\"");
+		s.writeString(Point(7, 10), "The sky grows dark, and a");
+		s.writeString(Point(7, 11), "strong magic engulfs you!");
+		break;
+	case 5:
+		s.writeString(Point(12, 7), "The sign reads:");
+		s.writeString(Point(11, 9), "\"OMNIA MUTANTUR!\"");
+		break;
+	case 6:
+		s.writeString(Point(12, 7), "The sign reads:");
+		s.writeString(Point(9, 9), "\"GO EAST TO GO EAST!\"");
+		break;
+	case 7:
+		s.writeString(Point(10, 7), "The grave is marked:");
+		s.writeString(Point(14, 9), "\"VAE VICTIS\"");
+		break;
+	default:
+		break;
+	}
+}
+
+void Pillar::questCompleted(int locationNum) {
+	auto &sg = _G(savegame);
+	int castleIdx = 8 - locationNum;
+
+	if (sg._questStatus[castleIdx] == -1) {
+		sg._questStatus[castleIdx] = 1;
+		writeString("A quest has been completed!\n");
+		g_engine->playFX(5);
+		writeString("\n");
+	}
+}
+
+bool Pillar::findWeapon() {
+	auto &sg = _G(savegame);
+
+	int idx = 0;
+	do {
+		++idx;
+	} while (idx <= 15 && sg._weapons[idx] != 0);
+
+	if (idx > 15)
+		return false;
+
+	++sg._weapons[idx];
+	const char *name = Data::WEAPON_NAMES[idx];
+
+	writeString("You find a");
+	if (isVowel(*name))
+		writeString("n");
+	writeString(" %s!", name);
+	return true;
+}
+
+bool Pillar::gainAttribute(int attrIndex) {
+	auto &sg = _G(savegame);
+	int16 &stat = attributeRef(sg, attrIndex);
+
+	if (stat == 99)
+		return false;
+
+	int value = (stat + 8) / 10;
+	if (stat + value > 99)
+		value = 99 - stat;
+
+	writeString("Thou dost gain %d %s", value, ATTRIBUTE_NAMES[attrIndex]);
+	stat += value;
+	return true;
+}
+
+bool Pillar::msgAction(const ActionMessage &msg) {
+	finish();
+	return true;
+}
+
+bool Pillar::msgKeypress(const KeypressMessage &msg) {
+	finish();
+	return true;
+}
+
+void Pillar::finish() {
+	cancelDelay();
+
+	if (_locationNum != 6)
+		writeString("\n");
+	prompt();
+	close();
+}
+
+} // namespace Interactions
+} // namespace Views
+} // namespace Ultima1
+} // namespace Ultima
diff --git a/engines/ultima/ultima1/views/interactions/pillar.h b/engines/ultima/ultima1/views/interactions/pillar.h
new file mode 100644
index 00000000000..b5e57cba6ed
--- /dev/null
+++ b/engines/ultima/ultima1/views/interactions/pillar.h
@@ -0,0 +1,95 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef ULTIMA1_VIEWS_INTERACTIONS_PILLAR_H
+#define ULTIMA1_VIEWS_INTERACTIONS_PILLAR_H
+
+#include "ultima/ultima1/views/interactions/interaction.h"
+
+namespace Ultima {
+namespace Ultima1 {
+namespace Views {
+namespace Interactions {
+
+using namespace Ultima::Shared::Messages;
+
+/**
+ * Handles Pillar locations on the overworld map. Each of the 8 pillars
+ * shows a one-off inscription and, the first time it's read, either
+ * raises one of the player's attributes, grants a random weapon (the
+ * "Fortes Fortuna" pillar), or - for the "Go East to go East" pillar -
+ * does nothing at all. Visiting an odd-numbered pillar also completes
+ * the matching castle's "find a location" quest, if it's currently
+ * active
+ */
+class Pillar : public Interaction {
+private:
+	int _locationNum = 0;
+	byte _borderColor = 0;
+
+	/**
+	 * Draws the inscription text for the current pillar
+	 */
+	void drawInscription();
+
+	/**
+	 * Marks the matching castle's quest as completed, if it's currently
+	 * outstanding
+	 */
+	void questCompleted(int locationNum);
+
+	/**
+	 * Awards the player a random not-yet-found weapon, if any are left
+	 * @return		True if a weapon was found
+	 */
+	bool findWeapon();
+
+	/**
+	 * Raises the given attribute by a tenth or so of the distance to 99
+	 * @return		True if the attribute wasn't already maxed out
+	 */
+	bool gainAttribute(int attrIndex);
+
+	/**
+	 * Closes the dialog and returns control to the overworld
+	 */
+	void finish();
+
+public:
+	Pillar() : Interaction("Pillar") {
+	}
+	~Pillar() override {
+	}
+
+	void draw() override;
+	bool msgGame(const GameMessage &msg) override;
+	bool msgFocus(const FocusMessage &msg) override;
+	bool msgAction(const ActionMessage &msg) override;
+	bool msgKeypress(const KeypressMessage &msg) override;
+	void timeout() override;
+};
+
+} // namespace Interactions
+} // namespace Views
+} // namespace Ultima1
+} // namespace Ultima
+
+#endif
diff --git a/engines/ultima/ultima1/views/views.h b/engines/ultima/ultima1/views/views.h
index 2bff6dfb9d8..a5e7188a988 100644
--- a/engines/ultima/ultima1/views/views.h
+++ b/engines/ultima/ultima1/views/views.h
@@ -30,6 +30,7 @@
 #include "ultima/ultima1/views/interactions/liftoff.h"
 #include "ultima/ultima1/views/interactions/merchant.h"
 #include "ultima/ultima1/views/interactions/operate_craft.h"
+#include "ultima/ultima1/views/interactions/pillar.h"
 #include "ultima/ultima1/views/interactions/princess_saved.h"
 #include "ultima/ultima1/views/interactions/ready.h"
 #include "ultima/ultima1/views/create_character.h"
@@ -56,6 +57,7 @@ struct Views : public Shared::Views {
 	Interactions::LiftOff _liftOff;
 	Interactions::Merchant _merchant;
 	Interactions::OperateCraft _operateCraft;
+	Interactions::Pillar _pillar;
 	Interactions::PrincessSaved _princessSaved;
 	Interactions::Ready _ready;
 	CreateCharacter _createCharacter;


Commit: aed68d5d8c6569e666f482bb08b6c5201fa9bc13
    https://github.com/scummvm/scummvm/commit/aed68d5d8c6569e666f482bb08b6c5201fa9bc13
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:40:51+11:00

Commit Message:
ULTIMA: ULTIMA1: Starting player attack commands

Changed paths:
    engines/ultima/ultima1/data/map.h
    engines/ultima/ultima1/data/map_dungeon.cpp
    engines/ultima/ultima1/data/map_dungeon.h
    engines/ultima/ultima1/data/savegame.cpp
    engines/ultima/ultima1/data/savegame.h
    engines/ultima/ultima1/logic/dungeon_logic.cpp
    engines/ultima/ultima1/logic/dungeon_logic.h
    engines/ultima/ultima1/logic/logic.cpp
    engines/ultima/ultima1/logic/logic.h
    engines/ultima/ultima1/logic/overworld_logic.cpp
    engines/ultima/ultima1/logic/overworld_logic.h


diff --git a/engines/ultima/ultima1/data/map.h b/engines/ultima/ultima1/data/map.h
index 32a4e599651..a521864656c 100644
--- a/engines/ultima/ultima1/data/map.h
+++ b/engines/ultima/ultima1/data/map.h
@@ -55,7 +55,7 @@ enum {
 };
 
 enum Direction {
-	DIR_LEFT = 1, DIR_RIGHT = 2, DIR_UP = 3, DIR_DOWN = 4
+	DIR_LEFT = 1, DIR_RIGHT = 2, DIR_UP = 3, DIR_DOWN = 4, DIR_UNSPECIFIED = -1
 };
 
 enum MapType {
diff --git a/engines/ultima/ultima1/data/map_dungeon.cpp b/engines/ultima/ultima1/data/map_dungeon.cpp
index d8cd8f2a80f..3313d42ce73 100644
--- a/engines/ultima/ultima1/data/map_dungeon.cpp
+++ b/engines/ultima/ultima1/data/map_dungeon.cpp
@@ -187,6 +187,15 @@ void MapDungeon::dungeonSpawnMonster() {
 	_cells[y][x]._monsterHp = getRandomNumber(1, dungeonLevel * dungeonLevel + 1) + 10 + monsterId;
 }
 
+void MapDungeon::killMonster(int x, int y) {
+	DungeonCell &cell = _cells[y][x];
+	_monsterSlotUsed[cell._monsterId % DUNGEON_MONSTER_SLOTS] = false;
+	cell._monsterId = DUNGEON_NO_MONSTER;
+	cell._monsterHp = 0;
+
+	dungeonSpawnMonster();
+}
+
 } // namespace Data
 } // namespace Ultima1
 } // namespace Ultima
diff --git a/engines/ultima/ultima1/data/map_dungeon.h b/engines/ultima/ultima1/data/map_dungeon.h
index a4e83aab86c..20b777a1c19 100644
--- a/engines/ultima/ultima1/data/map_dungeon.h
+++ b/engines/ultima/ultima1/data/map_dungeon.h
@@ -121,6 +121,12 @@ public:
 	 */
 	void generateDungeonLevel();
 
+	/**
+	 * Removes a slain monster from the given cell, freeing up its monster
+	 * slot, then spawns a fresh monster elsewhere in its place
+	 */
+	void killMonster(int x, int y);
+
 	void synchronize(Common::Serializer &s);
 };
 
diff --git a/engines/ultima/ultima1/data/savegame.cpp b/engines/ultima/ultima1/data/savegame.cpp
index ffcd0e2bca7..d87849e9758 100644
--- a/engines/ultima/ultima1/data/savegame.cpp
+++ b/engines/ultima/ultima1/data/savegame.cpp
@@ -42,6 +42,13 @@ const char *WEAPON_NAMES[] = {
 	"Bow & Arrows", "Amulet", "Wand", "Staff", "Triangle", "Pistol",
 	"Light Sword", "Phazor", "Blaster"
 };
+const char *WEAPON_NAMES_LOWER[] = {
+	"hands", "dagger", "mace", "axe", "rope", "sword", "g sword", "bow", "amulet",
+	"wand", "staff", "triangle", "pistol", "L sword", "phazor", "blaster"
+};
+const byte WEAPONS_DISTANCE[] = {
+	1, 1, 1, 1, 0, 1, 1, 3, 0, 0, 0, 1, 3, 1, 3, 3
+};
 const char *SPELL_NAMES[] = {
 	"Prayer", "Open", "Unlock", "Magic Missile", "Steal", "Ladder Down",
 	"Ladder Up", "Blink", "Create", "Destroy", "Kill"
diff --git a/engines/ultima/ultima1/data/savegame.h b/engines/ultima/ultima1/data/savegame.h
index 3c478733e87..4f39b48a060 100644
--- a/engines/ultima/ultima1/data/savegame.h
+++ b/engines/ultima/ultima1/data/savegame.h
@@ -41,6 +41,8 @@ extern const char *RACE_NAMES[];
 extern const char *CLASS_NAMES[];
 extern const char *ARMOR_NAMES[];
 extern const char *WEAPON_NAMES[];
+extern const char *WEAPON_NAMES_LOWER[];
+extern const byte WEAPONS_DISTANCE[];
 extern const char *SPELL_NAMES[];
 extern const char *TRANSPORT_NAMES[];
 extern const char *GEM_NAMES[];
diff --git a/engines/ultima/ultima1/logic/dungeon_logic.cpp b/engines/ultima/ultima1/logic/dungeon_logic.cpp
index d7b52a90204..8f114d1efe4 100644
--- a/engines/ultima/ultima1/logic/dungeon_logic.cpp
+++ b/engines/ultima/ultima1/logic/dungeon_logic.cpp
@@ -209,6 +209,37 @@ bool DungeonLogic::move(Data::Direction dir) {
 	return true;
 }
 
+bool DungeonLogic::attack(Data::Direction dir) {
+	writeString("Attack with %s", Data::WEAPON_NAMES_LOWER[_G(savegame)._equippedWeapon]);
+
+	int maxDistance = Data::WEAPONS_DISTANCE[_G(savegame)._equippedWeapon];
+	if (!maxDistance) {
+		// It's a non-attacking "weapon" like the rope
+		writeString("?\n");
+		playFX(1);
+
+	} else {
+		writeString("\n");
+
+		int monsterDistance = getMonsterDistance(maxDistance);
+		if (!monsterDistance) {
+			writeString("Nothing\n");
+
+		} else {
+			int agility = _G(savegame)._agility + 50;
+			int strike = getRandomNumber(2, _G(savegame)._equippedWeapon * 8 + _G(savegame)._strength);
+			int deltaX = getDirDeltaX();
+			int deltaY = getDirDeltaY();
+			int x = _G(savegame)._locationPosition.x + monsterDistance * deltaX;
+			int y = _G(savegame)._locationPosition.y + monsterDistance * deltaY;
+
+			dungeonAttackAt(2, agility, strike, x, y);
+		}
+	}
+
+	return true;
+}
+
 bool DungeonLogic::climb() {
 	writeString("K-Limb");
 
@@ -296,6 +327,129 @@ void DungeonLogic::endOfTurn() {
 	Logic::endOfTurn();
 }
 
+int DungeonLogic::getMonsterDistance(int maxDistance) const {
+	int deltaX = getDirDeltaX();
+	int deltaY = getDirDeltaY();
+	int x, y, tile = 0, monsterId = -1;
+	int dist;
+
+	for (dist = 0; dist < maxDistance; ++dist) {
+		x = _G(savegame)._locationPosition.x + deltaX * dist;
+		y = _G(savegame)._locationPosition.y + deltaY * dist;
+		tile = _G(dungeon)._cells[y][x]._tileNum;
+		monsterId = _G(dungeon)._cells[y][x]._monsterId;
+
+		if (monsterId != -1 || tile == Data::DTILE_WALL || tile == Data::DTILE_SECRET_DOOR ||
+			tile == Data::DTILE_BEAMS || tile == Data::DTILE_DOOR)
+			break;
+	}
+
+	return (monsterId != -1 && tile != Data::DTILE_WALL &&
+		tile != Data::DTILE_SECRET_DOOR && tile != Data::DTILE_BEAMS) ? dist : 0;;
+}
+
+void DungeonLogic::writeMonsterName(int monsterId) {
+	if (monsterId == Data::UMONS_MIMIC)
+		writeString("Mimic");
+	else
+		writeString(Data::UNDERWORLD_MONSTERS[monsterId]);
+}
+
+void DungeonLogic::monsterDead(int monsterId) {
+	// Only 4 monster Ids have a castle quest tied to them - the ones named
+	// in King::QUEST_MONSTER_NAMES, indexed by continent
+	int castleIdx;
+	switch (monsterId) {
+	case 9:
+		castleIdx = 2;
+		break;
+	case 14:
+		castleIdx = 4;
+		break;
+	case 19:
+		castleIdx = 6;
+		break;
+	case 24:
+		castleIdx = 8;
+		break;
+	default:
+		return;
+	}
+
+	Data::Savegame &sg = _G(savegame);
+	if (sg._questStatus[castleIdx] == -1) {
+		sg._questStatus[castleIdx] = 1;
+		writeString("A quest has been completed!\n");
+		playFX(5);
+		writeString("\n");
+	}
+}
+
+void DungeonLogic::giveCoins(int coins) {
+	Data::Savegame &sg = _G(savegame);
+	if (sg._coins + coins > 9999)
+		coins = 9999 - sg._coins;
+
+	sg._coins += coins;
+	writeString("%d gold\n", coins);
+}
+
+void DungeonLogic::dungeonAttackAt(int effectNum, int agility, int strike, int x, int y) {
+	Data::MapDungeon &dungeon = _G(dungeon);
+	Data::Savegame &sg = _G(savegame);
+	const Common::Point &pos = sg._locationPosition;
+
+	// If the player is currently standing in a doorway, the shot can only
+	// connect if it's heading straight down a clear corridor - not through
+	// another door, or into a chest/coffin
+	bool canHit = true;
+	if (dungeon._cells[pos.y][pos.x]._tileNum == Data::DTILE_DOOR) {
+		Data::DungeonTileId targetTile = dungeon._cells[y][x]._tileNum;
+		canHit = targetTile == Data::DTILE_HALLWAY || targetTile == Data::DTILE_LADDER_UP ||
+			targetTile == Data::DTILE_LADDER_DOWN;
+	}
+
+	if (getRandomNumber(1, 100) > agility) {
+		writeString("Missed!\n");
+		return;
+	}
+
+	Data::DungeonTileId hereTile = dungeon._cells[pos.y][pos.x]._tileNum;
+	if (hereTile == Data::DTILE_WALL || hereTile == Data::DTILE_SECRET_DOOR ||
+			hereTile == Data::DTILE_BEAMS || !canHit) {
+		writeString("Missed!\n");
+		return;
+	}
+
+	playFX(effectNum);
+	if (strike != 10000)
+		writeString("Hit! ");
+
+	Data::DungeonCell &cell = dungeon._cells[y][x];
+	if (cell._monsterHp <= strike) {
+		// Monster killed
+		writeMonsterName(cell._monsterId);
+		writeString(strike == 10000 ? " destroyed!\n" : " killed!\n");
+
+		monsterDead(cell._monsterId);
+
+		int coins = getRandomNumber(2, sg._dungeonLevel * 3 + 10 + cell._monsterId);
+		writeString("Thou dost find: ");
+		giveCoins(coins);
+
+		dungeon.killMonster(x, y);
+
+		int expGain = getRandomNumber(2, sg._dungeonLevel * sg._dungeonLevel + 10);
+		sg._experience += expGain;
+		sg._dungeonExitHitPoints += expGain * 2;
+		redrawStats();
+	} else {
+		// Damaged, but survived
+		writeString("%d damage!\n", strike);
+		cell._monsterHp -= strike;
+	}
+}
+
 } // namespace Logic
 } // namespace Ultima1
 } // namespace Ultima
diff --git a/engines/ultima/ultima1/logic/dungeon_logic.h b/engines/ultima/ultima1/logic/dungeon_logic.h
index 064c5ac7c2d..d60e693b06a 100644
--- a/engines/ultima/ultima1/logic/dungeon_logic.h
+++ b/engines/ultima/ultima1/logic/dungeon_logic.h
@@ -78,12 +78,49 @@ private:
 	 */
 	void showNearbyText();
 
+	/**
+	 * Get the distance to the closest monster, if any, in front of the player
+	 */
+	int getMonsterDistance(int maxDistance) const;
+
+	/**
+	 * Writes the name of the given monster, special-casing a mimic (which
+	 * is otherwise catalogued in UNDERWORLD_MONSTERS under the name of
+	 * whatever item it's disguised as)
+	 */
+	void writeMonsterName(int monsterId);
+
+	/**
+	 * Marks the castle quest tied to the given monster (if any) as
+	 * completed, provided it's currently outstanding. Only 4 of the 25
+	 * monster Ids - one per continent's "kill a monster" quest - have a
+	 * quest tied to them
+	 */
+	void monsterDead(int monsterId);
+
+	/**
+	 * Adds coins to the player's purse, capped at 9999
+	 */
+	void giveCoins(int coins);
+
+	/**
+	 * Resolves an attack (physical or magical) landing at the given
+	 * dungeon cell - rolls to hit, then applies damage or kills the
+	 * monster there, awarding coins/experience on a kill
+	 */
+	void dungeonAttackAt(int effectNum, int agility, int strike, int x, int y);
+
 protected:
 	/**
 	 * Handle dungeon movement
 	 */
 	bool move(Data::Direction dir) override;
 
+	/**
+	 * Attack command
+	 */
+	bool attack(Data::Direction dir) override;
+
 	/**
 	 * Handles climbing a ladder at the player's current position
 	 */
diff --git a/engines/ultima/ultima1/logic/logic.cpp b/engines/ultima/ultima1/logic/logic.cpp
index a2f5029f79f..cecc5991045 100644
--- a/engines/ultima/ultima1/logic/logic.cpp
+++ b/engines/ultima/ultima1/logic/logic.cpp
@@ -90,9 +90,6 @@ void Logic::action(int action) {
 	bool doEndOfTurn = true;
 
 	switch (action) {
-	case KEYBIND_BOARD:
-		doEndOfTurn = board();
-		break;
 	case KEYBIND_UP:
 		doEndOfTurn = move(Data::DIR_UP);
 		break;
@@ -105,6 +102,24 @@ void Logic::action(int action) {
 	case KEYBIND_RIGHT:
 		doEndOfTurn = move(Data::DIR_RIGHT);
 		break;
+	case KEYBIND_ATTACK:
+		doEndOfTurn = attack(Data::DIR_UNSPECIFIED);
+		break;
+	case KEYBIND_ATTACK_UP:
+		doEndOfTurn = attack(Data::DIR_UP);
+		break;
+	case KEYBIND_ATTACK_DOWN:
+		doEndOfTurn = attack(Data::DIR_DOWN);
+		break;
+	case KEYBIND_ATTACK_LEFT:
+		doEndOfTurn = attack(Data::DIR_LEFT);
+		break;
+	case KEYBIND_ATTACK_RIGHT:
+		doEndOfTurn = attack(Data::DIR_RIGHT);
+		break;
+	case KEYBIND_BOARD:
+		doEndOfTurn = board();
+		break;
 	case KEYBIND_CLIMB:
 		doEndOfTurn = climb();
 		break;
@@ -175,6 +190,20 @@ void Logic::keypress(Common::KeyCode keycode) {
 	endOfTurn();
 }
 
+bool Logic::attack(Data::Direction dir) {
+	writeString("Attack with %s", Data::WEAPON_NAMES_LOWER[_G(savegame)._equippedWeapon]);
+
+	if (Data::WEAPONS_DISTANCE[_G(savegame)._equippedWeapon]) {
+		writeString(": ");
+		return combat(dir, 7);
+
+	} else {
+		writeString("?\n");
+		playFX(1);
+		return true;
+	}
+}
+
 bool Logic::board() {
 	writeString("Board?\n");
 	playFX(1);
@@ -304,6 +333,11 @@ bool Logic::pass() {
 	return true;
 }
 
+bool Logic::combat(int direction, int amount) {
+	// TODO
+	return true;
+}
+
 } // namespace Logic
 } // namespace Ultima1
 } // namespace Ultima
diff --git a/engines/ultima/ultima1/logic/logic.h b/engines/ultima/ultima1/logic/logic.h
index 38b8c2fae90..4f52bd2dcf9 100644
--- a/engines/ultima/ultima1/logic/logic.h
+++ b/engines/ultima/ultima1/logic/logic.h
@@ -76,6 +76,13 @@ protected:
 	 */
 	void redrawStats();
 
+	/**
+	 * Triggers combat action
+	 */
+	bool combat(int direction, int amount);
+
+	virtual bool attack(Data::Direction dir);
+
 	/**
 	 * Handles end of turn logic
 	 */
diff --git a/engines/ultima/ultima1/logic/overworld_logic.cpp b/engines/ultima/ultima1/logic/overworld_logic.cpp
index f53945ae1b4..b7b5f07f260 100644
--- a/engines/ultima/ultima1/logic/overworld_logic.cpp
+++ b/engines/ultima/ultima1/logic/overworld_logic.cpp
@@ -160,6 +160,18 @@ bool OverworldLogic::enter() {
 	return true;
 }
 
+bool OverworldLogic::fire() {
+	writeString("Fire ");
+
+	if (_G(savegame)._transportType == Data::TRANSPORT_FRIGATE || _G(savegame)._transportType == Data::TRANSPORT_AIRCAR) {
+
+	} else {
+		writeString("what?\n");
+	}
+
+	return true;
+}
+
 bool OverworldLogic::move(Data::Direction dir) {
 	if (!moveCheck(dir))
 		return true;
diff --git a/engines/ultima/ultima1/logic/overworld_logic.h b/engines/ultima/ultima1/logic/overworld_logic.h
index d337269ad8c..99e5982d3c6 100644
--- a/engines/ultima/ultima1/logic/overworld_logic.h
+++ b/engines/ultima/ultima1/logic/overworld_logic.h
@@ -118,6 +118,11 @@ protected:
 	 */
 	bool enter() override;
 
+	/**
+	 * Fire transport weaponry
+	 */
+	bool fire() override;
+
 	/**
 	 * Handle movement
 	 */


Commit: a0c0e88c6c68f45c4a829f8c59ba0257bccadb0c
    https://github.com/scummvm/scummvm/commit/a0c0e88c6c68f45c4a829f8c59ba0257bccadb0c
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:40:51+11:00

Commit Message:
ULTIMA: ULTIMA1: Implement dungeon spellcasting

Changed paths:
  A engines/ultima/ultima1/data/data.cpp
  A engines/ultima/ultima1/data/data.h
    engines/ultima/module.mk
    engines/ultima/ultima1/data/savegame.cpp
    engines/ultima/ultima1/data/savegame.h
    engines/ultima/ultima1/logic/dungeon_logic.cpp
    engines/ultima/ultima1/logic/dungeon_logic.h
    engines/ultima/ultima1/logic/overworld_logic.cpp
    engines/ultima/ultima1/logic/overworld_logic.h
    engines/ultima/ultima1/views/create_character.cpp
    engines/ultima/ultima1/views/interactions/dead.cpp


diff --git a/engines/ultima/module.mk b/engines/ultima/module.mk
index 8eba2c8a0a9..4fe14693f43 100644
--- a/engines/ultima/module.mk
+++ b/engines/ultima/module.mk
@@ -53,6 +53,7 @@ MODULE_OBJS += \
 	ultima1/messages.o \
 	ultima1/metaengine.o \
 	ultima1/core/strings.o \
+	ultima1/data/data.o \
 	ultima1/data/entity.o \
 	ultima1/data/map.o \
 	ultima1/data/map_dungeon.o \
diff --git a/engines/ultima/ultima1/data/data.cpp b/engines/ultima/ultima1/data/data.cpp
new file mode 100644
index 00000000000..1e6f08f204a
--- /dev/null
+++ b/engines/ultima/ultima1/data/data.cpp
@@ -0,0 +1,75 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "ultima/ultima1/data/data.h"
+#include "ultima/ultima1/data/map.h"
+#include "ultima/ultima1/ultima1.h"
+
+namespace Ultima {
+namespace Ultima1 {
+namespace Data {
+
+const char *SEX_NAMES[] = { "Male", "Female" };
+const char *RACE_NAMES[] = { nullptr, "Human", "Elf", "Dwarf", "Bobbit" };
+const char *CLASS_NAMES[] = { nullptr, "Fighter", "Cleric", "Wizard", "Thief" };
+
+// Index 0 of each ("Skin"/"Hands"/"Prayer"/"Foot") is the innate/default
+// state and is never shown in the stats screen, but is included here to
+// keep these arrays indexed identically to the enums/savegame arrays above
+const char *ARMOR_NAMES[] = {
+	"Skin", "Leather armor", "Chain mail", "Plate mail", "Vacuum suit", "Reflect suit"
+};
+const char *WEAPON_NAMES[] = {
+	"Hands", "Dagger", "Mace", "Axe", "Rope & Spikes", "Sword", "Great Sword",
+	"Bow & Arrows", "Amulet", "Wand", "Staff", "Triangle", "Pistol",
+	"Light Sword", "Phazor", "Blaster"
+};
+const char *WEAPON_NAMES_LOWER[] = {
+	"hands", "dagger", "mace", "axe", "rope", "sword", "g sword", "bow", "amulet",
+	"wand", "staff", "triangle", "pistol", "L sword", "phazor", "blaster"
+};
+const byte WEAPONS_DISTANCE[] = {
+	1, 1, 1, 1, 0, 1, 1, 3, 0, 0, 0, 1, 3, 1, 3, 3
+};
+
+const char *SPELL_NAMES[] = {
+	"Prayer", "Open", "Unlock", "Magic Missile", "Steal", "Ladder Down",
+	"Ladder Up", "Blink", "Create", "Destroy", "Kill"
+};
+const char *SPELL_PHRASES[] = {
+	"\"POTENTIS-LAUDIS!\"", "\"APERTUS!\"", "\"PECUNIA!\"", "\"VASTO!\"", "\"NUDO!\"", "\"INFERUS!\"",
+	"\"ASCENDO!\"", "\"DUCIS-EDUCO!\"", "\"STRUXI!\"", "\"DELIO!\"", "\"INTERFICIO!\""
+};
+
+const char *TRANSPORT_NAMES[] = {
+	"Foot", "Horse", "Cart", "Raft", "Frigate", "Aircar", "Shuttle", "Time Machine"
+};
+const char *GEM_NAMES[] = { "Red Gem", "Green Gem", "Blue Gem", "White Gem" };
+
+// Indexed by TransportType
+const int TRANSPORT_RANDOM_THRESHOLD[] = { 100, 50, 33, 100, 50, 25, 10, 10 };
+
+// Indexed by TransportType
+const int FOOD_PER_TRANSPORT[] = { 2, 3, 3, 4, 5, 6, 11, 0 };
+
+} // namespace Data
+} // namespace Ultima1
+} // namespace Ultima
diff --git a/engines/ultima/ultima1/data/data.h b/engines/ultima/ultima1/data/data.h
new file mode 100644
index 00000000000..60c954be563
--- /dev/null
+++ b/engines/ultima/ultima1/data/data.h
@@ -0,0 +1,106 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef ULTIMA1_DATA_DATA_H
+#define ULTIMA1_DATA_DATA_H
+
+#include "common/rect.h"
+#include "common/serializer.h"
+#include "ultima/ultima1/data/entity.h"
+
+namespace Ultima {
+namespace Ultima1 {
+namespace Data {
+
+constexpr int MAX_NAME_LENGTH = 14;
+constexpr int QUEST_COUNT = 9;
+constexpr int OVERWORLD_ENTITY_COUNT = 40;
+constexpr int CREATURES_COUNT = 10;
+constexpr int LOCATION_ENTITY_COUNT = 15;
+
+extern const char *SEX_NAMES[];
+extern const char *RACE_NAMES[];
+extern const char *CLASS_NAMES[];
+extern const char *ARMOR_NAMES[];
+extern const char *WEAPON_NAMES[];
+extern const char *WEAPON_NAMES_LOWER[];
+extern const byte WEAPONS_DISTANCE[];
+extern const char *SPELL_NAMES[];
+extern const char *SPELL_PHRASES[];
+extern const char *TRANSPORT_NAMES[];
+extern const char *GEM_NAMES[];
+
+// Per player-transport-type chance (as a 1-100 threshold) for a pursuing
+// monster to get a chance to move/attack on a given turn - faster player
+// transports make it harder for monsters to keep up
+extern const int TRANSPORT_RANDOM_THRESHOLD[];
+
+// Per player-transport-type number of turns between each point of food
+// consumed - faster/hungrier transports (or none at all, for the time
+// machine) burn through food quicker
+extern const int FOOD_PER_TRANSPORT[];
+
+enum Sex {
+	SEX_MALE = 0, SEX_FEMALE = 1
+};
+enum Race {
+	RACE_HUMAN = 1, RACE_ELF = 2, RACE_DWARF = 3, RACE_BOBBIT = 4
+};
+enum CharClass {
+	CLASS_FIGHTER = 1, CLASS_CLERIC = 2, CLASS_WIZARD = 3, CLASS_THIEF = 4
+};
+
+// Indexes into _armor. Index 0 isn't a real item - it mirrors the
+// unexplained sentinel field seen immediately before the named item
+// slots in the original armor/weapon/spell/transport lists
+enum ArmorType {
+	ARMOR_NONE = 0, ARMOR_LEATHER = 1, ARMOR_CHAINMAIL = 2, ARMOR_PLATE_MAIL = 3,
+	ARMOR_VACUUM_SUIT = 4, ARMOR_REFLECT_SUIT = 5, ARMOR_COUNT = 6
+};
+
+// Indexes into _weapons
+enum WeaponType {
+	WEAPON_NONE = 0, WEAPON_DAGGER = 1, WEAPON_MACE = 2, WEAPON_AXE = 3,
+	WEAPON_ROPE_AND_SPIKES = 4, WEAPON_SWORD = 5, WEAPON_GREAT_SWORD = 6, WEAPON_BOW = 7,
+	WEAPON_AMULET = 8, WEAPON_WAND = 9, WEAPON_STAFF = 10, WEAPON_TRIANGLE = 11,
+	WEAPON_PISTOL = 12, WEAPON_LIGHT_SWORD = 13, WEAPON_PHAZOR = 14, WEAPON_BLASTER = 15,
+	WEAPON_COUNT = 16
+};
+
+// Indexes into _spells
+enum SpellType {
+	SPELL_PRAYER = 0, SPELL_OPEN = 1, SPELL_UNLOCK = 2, SPELL_MAGIC_MISSILE = 3, SPELL_STEAL = 4,
+	SPELL_LADDER_DOWN = 5, SPELL_LADDER_UP = 6, SPELL_BLINK = 7, SPELL_CREATE = 8,
+	SPELL_DESTROY = 9, SPELL_KILL = 10, SPELL_COUNT = 11
+};
+
+// Indexes into _transports
+enum TransportType {
+	TRANSPORT_FOOT = 0, TRANSPORT_HORSE = 1, TRANSPORT_CART = 2, TRANSPORT_RAFT = 3,
+	TRANSPORT_FRIGATE = 4, TRANSPORT_AIRCAR = 5, TRANSPORT_SHUTTLE = 6, TRANSPORT_TIME_MACHINE = 7,
+	TRANSPORT_COUNT = 8
+};
+
+} // namespace Data
+} // namespace Ultima1
+} // namespace Ultima
+
+#endif
diff --git a/engines/ultima/ultima1/data/savegame.cpp b/engines/ultima/ultima1/data/savegame.cpp
index d87849e9758..b84c07a0e84 100644
--- a/engines/ultima/ultima1/data/savegame.cpp
+++ b/engines/ultima/ultima1/data/savegame.cpp
@@ -27,43 +27,6 @@ namespace Ultima {
 namespace Ultima1 {
 namespace Data {
 
-const char *SEX_NAMES[] = { "Male", "Female" };
-const char *RACE_NAMES[] = { nullptr, "Human", "Elf", "Dwarf", "Bobbit" };
-const char *CLASS_NAMES[] = { nullptr, "Fighter", "Cleric", "Wizard", "Thief" };
-
-// Index 0 of each ("Skin"/"Hands"/"Prayer"/"Foot") is the innate/default
-// state and is never shown in the stats screen, but is included here to
-// keep these arrays indexed identically to the enums/savegame arrays above
-const char *ARMOR_NAMES[] = {
-	"Skin", "Leather armor", "Chain mail", "Plate mail", "Vacuum suit", "Reflect suit"
-};
-const char *WEAPON_NAMES[] = {
-	"Hands", "Dagger", "Mace", "Axe", "Rope & Spikes", "Sword", "Great Sword",
-	"Bow & Arrows", "Amulet", "Wand", "Staff", "Triangle", "Pistol",
-	"Light Sword", "Phazor", "Blaster"
-};
-const char *WEAPON_NAMES_LOWER[] = {
-	"hands", "dagger", "mace", "axe", "rope", "sword", "g sword", "bow", "amulet",
-	"wand", "staff", "triangle", "pistol", "L sword", "phazor", "blaster"
-};
-const byte WEAPONS_DISTANCE[] = {
-	1, 1, 1, 1, 0, 1, 1, 3, 0, 0, 0, 1, 3, 1, 3, 3
-};
-const char *SPELL_NAMES[] = {
-	"Prayer", "Open", "Unlock", "Magic Missile", "Steal", "Ladder Down",
-	"Ladder Up", "Blink", "Create", "Destroy", "Kill"
-};
-const char *TRANSPORT_NAMES[] = {
-	"Foot", "Horse", "Cart", "Raft", "Frigate", "Aircar", "Shuttle", "Time Machine"
-};
-const char *GEM_NAMES[] = { "Red Gem", "Green Gem", "Blue Gem", "White Gem" };
-
-// Indexed by TransportType
-const int TRANSPORT_RANDOM_THRESHOLD[] = { 100, 50, 33, 100, 50, 25, 10, 10 };
-
-// Indexed by TransportType
-const int FOOD_PER_TRANSPORT[] = { 2, 3, 3, 4, 5, 6, 11, 0 };
-
 void LocationEntity::synchronize(Common::Serializer &s) {
 	s.syncAsSint16LE(_type);
 	s.syncAsSint16LE(_position.x);
diff --git a/engines/ultima/ultima1/data/savegame.h b/engines/ultima/ultima1/data/savegame.h
index 4f39b48a060..88518770d5b 100644
--- a/engines/ultima/ultima1/data/savegame.h
+++ b/engines/ultima/ultima1/data/savegame.h
@@ -24,80 +24,13 @@
 
 #include "common/rect.h"
 #include "common/serializer.h"
+#include "ultima/ultima1/data/data.h"
 #include "ultima/ultima1/data/entity.h"
 
 namespace Ultima {
 namespace Ultima1 {
 namespace Data {
 
-constexpr int MAX_NAME_LENGTH = 14;
-constexpr int QUEST_COUNT = 9;
-constexpr int OVERWORLD_ENTITY_COUNT = 40;
-constexpr int CREATURES_COUNT = 10;
-constexpr int LOCATION_ENTITY_COUNT = 15;
-
-extern const char *SEX_NAMES[];
-extern const char *RACE_NAMES[];
-extern const char *CLASS_NAMES[];
-extern const char *ARMOR_NAMES[];
-extern const char *WEAPON_NAMES[];
-extern const char *WEAPON_NAMES_LOWER[];
-extern const byte WEAPONS_DISTANCE[];
-extern const char *SPELL_NAMES[];
-extern const char *TRANSPORT_NAMES[];
-extern const char *GEM_NAMES[];
-
-// Per player-transport-type chance (as a 1-100 threshold) for a pursuing
-// monster to get a chance to move/attack on a given turn - faster player
-// transports make it harder for monsters to keep up
-extern const int TRANSPORT_RANDOM_THRESHOLD[];
-
-// Per player-transport-type number of turns between each point of food
-// consumed - faster/hungrier transports (or none at all, for the time
-// machine) burn through food quicker
-extern const int FOOD_PER_TRANSPORT[];
-
-enum Sex {
-	SEX_MALE = 0, SEX_FEMALE = 1
-};
-enum Race {
-	RACE_HUMAN = 1, RACE_ELF = 2, RACE_DWARF = 3, RACE_BOBBIT = 4
-};
-enum CharClass {
-	CLASS_FIGHTER = 1, CLASS_CLERIC = 2, CLASS_WIZARD = 3, CLASS_THIEF = 4
-};
-
-// Indexes into _armor. Index 0 isn't a real item - it mirrors the
-// unexplained sentinel field seen immediately before the named item
-// slots in the original armor/weapon/spell/transport lists
-enum ArmorType {
-	ARMOR_NONE = 0, ARMOR_LEATHER = 1, ARMOR_CHAINMAIL = 2, ARMOR_PLATE_MAIL = 3,
-	ARMOR_VACUUM_SUIT = 4, ARMOR_REFLECT_SUIT = 5, ARMOR_COUNT = 6
-};
-
-// Indexes into _weapons
-enum WeaponType {
-	WEAPON_NONE = 0, WEAPON_DAGGER = 1, WEAPON_MACE = 2, WEAPON_AXE = 3,
-	WEAPON_ROPE_AND_SPIKES = 4, WEAPON_SWORD = 5, WEAPON_GREAT_SWORD = 6, WEAPON_BOW = 7,
-	WEAPON_AMULET = 8, WEAPON_WAND = 9, WEAPON_STAFF = 10, WEAPON_TRIANGLE = 11,
-	WEAPON_PISTOL = 12, WEAPON_LIGHT_SWORD = 13, WEAPON_PHAZOR = 14, WEAPON_BLASTER = 15,
-	WEAPON_COUNT = 16
-};
-
-// Indexes into _spells
-enum SpellType {
-	SPELL_NONE = 0, SPELL_OPEN = 1, SPELL_UNLOCK = 2, SPELL_MAGIC_MISSILE = 3, SPELL_STEAL = 4,
-	SPELL_LADDER_DOWN = 5, SPELL_LADDER_UP = 6, SPELL_BLINK = 7, SPELL_CREATE = 8,
-	SPELL_DESTROY = 9, SPELL_KILL = 10, SPELL_COUNT = 11
-};
-
-// Indexes into _transports
-enum TransportType {
-	TRANSPORT_FOOT = 0, TRANSPORT_HORSE = 1, TRANSPORT_CART = 2, TRANSPORT_RAFT = 3,
-	TRANSPORT_FRIGATE = 4, TRANSPORT_AIRCAR = 5, TRANSPORT_SHUTTLE = 6, TRANSPORT_TIME_MACHINE = 7,
-	TRANSPORT_COUNT = 8
-};
-
 /**
  * A single NPC/creature placement within a city or castle map - the king
  * or princess in a castle, or a merchant/guard/bard in a city
@@ -148,7 +81,7 @@ public:
 
 	// Currently equipped/readied items
 	int16 _equippedWeapon = WEAPON_NONE;
-	int16 _equippedSpell = SPELL_NONE;
+	int16 _equippedSpell = SPELL_PRAYER;
 	int16 _equippedArmor = ARMOR_NONE;
 	int16 _transportType = TRANSPORT_FOOT;
 
diff --git a/engines/ultima/ultima1/logic/dungeon_logic.cpp b/engines/ultima/ultima1/logic/dungeon_logic.cpp
index 8f114d1efe4..d3b235fa67b 100644
--- a/engines/ultima/ultima1/logic/dungeon_logic.cpp
+++ b/engines/ultima/ultima1/logic/dungeon_logic.cpp
@@ -240,6 +240,25 @@ bool DungeonLogic::attack(Data::Direction dir) {
 	return true;
 }
 
+bool DungeonLogic::cast() {
+	writeString("Cast %s", Data::SPELL_NAMES[_G(savegame)._equippedSpell]);
+
+	int spell = _G(savegame)._equippedSpell;
+	if (spell == Data::SPELL_PRAYER) {
+		castPrayer();
+
+	} else if (!_G(savegame)._spells[spell]) {
+		writeString("\n");
+		playFX(6);
+		writeString("You've used up that spell!\n");
+
+	} else {
+		castSpell(spell, true);
+	}
+
+	return true;
+}
+
 bool DungeonLogic::climb() {
 	writeString("K-Limb");
 
@@ -450,6 +469,198 @@ void DungeonLogic::dungeonAttackAt(int effectNum, int agility, int strike, int x
 	}
 }
 
+
+void DungeonLogic::castPrayer() {
+	writeString("\n%s\n", Data::SPELL_PHRASES[0]);
+
+	int spell = getRandomNumber(Data::SPELL_OPEN, Data::SPELL_KILL);
+	if (spell == Data::SPELL_STEAL)
+		spell = Data::SPELL_LADDER_DOWN;
+
+	castSpell(spell, false);
+}
+
+int DungeonLogic::getMagicWeaponPower() {
+	Data::Savegame &sg = _G(savegame);
+	int result = getRandomNumber(1, sg._intelligence);
+
+	if (sg._equippedWeapon == Data::WEAPON_WAND)
+		result *= 2;
+	else if (sg._equippedWeapon == Data::WEAPON_AMULET)
+		result = result * 3 / 2;
+	else if (sg._equippedWeapon == Data::WEAPON_STAFF || sg._equippedWeapon == Data::WEAPON_TRIANGLE)
+		result *= 3;
+
+	return result;
+}
+
+void DungeonLogic::castOpen() {
+	Data::Savegame &sg = _G(savegame);
+	writeString(" opened!\n");
+
+	_G(dungeon)._cells[sg._locationPosition.y][sg._locationPosition.x]._itemId = Data::DITEM_NONE;
+
+	writeString("Thou dost find: ");
+	int coins = getRandomNumber(3, sg._dungeonLevel * sg._dungeonLevel + 9);
+	giveCoins(coins);
+}
+
+void DungeonLogic::castSpell(int spell, bool showPhrase) {
+	if (showPhrase)
+		writeString("%s\n", Data::SPELL_PHRASES[spell]);
+
+	Data::MapDungeon &dungeon = _G(dungeon);
+	Data::Savegame &sg = _G(savegame);
+	const Common::Point &pos = sg._locationPosition;
+	bool failed = false;
+
+	switch (spell) {
+	case Data::SPELL_OPEN: {
+		Data::DungeonCell &cell = dungeon._cells[pos.y][pos.x];
+		if (cell._itemId == Data::DITEM_COFFIN) {
+			writeString("Coffin");
+			castOpen();
+		} else {
+			failed = true;
+		}
+		break;
+	}
+
+	case Data::SPELL_UNLOCK: {
+		Data::DungeonCell &cell = dungeon._cells[pos.y][pos.x];
+		if (cell._itemId == Data::DITEM_CHEST) {
+			writeString("Chest");
+			castOpen();
+		} else {
+			failed = true;
+		}
+		break;
+	}
+
+	case Data::SPELL_MAGIC_MISSILE: {
+		int distance = getMonsterDistance(5);
+		if (!distance) {
+			failed = true;
+		} else {
+			int strike = getMagicWeaponPower();
+			int x = pos.x + getDirDeltaX() * distance;
+			int y = pos.y + getDirDeltaY() * distance;
+			dungeonAttackAt(5, 101, strike, x, y);
+		}
+		break;
+	}
+
+	case Data::SPELL_STEAL:
+		// Has no dungeon effect - same as the original's jump table, which
+		// points this spell straight at its no-op default case
+		break;
+
+	case Data::SPELL_LADDER_DOWN:
+		if (sg._dungeonLevel == 10 || dungeon._cells[pos.y][pos.x]._tileNum == Data::DTILE_BEAMS) {
+			failed = true;
+		} else if ((pos.x & 1) || (pos.y & 1)) {
+			dungeon._cells[pos.y][pos.x]._tileNum = Data::DTILE_LADDER_DOWN;
+			writeString("Ladder created!\n");
+		} else {
+			failed = true;
+		}
+		break;
+
+	case Data::SPELL_LADDER_UP:
+		if (!((pos.x & 1) || (pos.y & 1))) {
+			failed = true;
+		} else if (dungeon._cells[pos.y][pos.x]._tileNum == Data::DTILE_BEAMS) {
+			failed = true;
+		} else {
+			dungeon._cells[pos.y][pos.x]._tileNum = Data::DTILE_LADDER_UP;
+			writeString("Ladder created!\n");
+		}
+		break;
+
+	case Data::SPELL_BLINK: {
+		// Keep picking random spots until an unoccupied floor tile, other
+		// than the player's own, turns up - the original loops
+		// unconditionally until it finds one; a 500-attempt cap is added
+		// here for safety, matching MapDungeon::dungeonSpawnMonster
+		int newX = 0, newY = 0;
+		bool valid = false;
+
+		for (int attempt = 0; attempt < 500 && !valid; ++attempt) {
+			newX = getRandomNumber(1, 9);
+			newY = getRandomNumber(1, 9);
+			if (newX == pos.x && newY == pos.y)
+				continue;
+
+			Data::DungeonTileId tile = dungeon._cells[newY][newX]._tileNum;
+			if (tile == Data::DTILE_BEAMS || tile == Data::DTILE_WALL || tile == Data::DTILE_SECRET_DOOR)
+				continue;
+			if (dungeon._cells[newY][newX]._monsterId != Data::DUNGEON_NO_MONSTER)
+				continue;
+
+			valid = true;
+		}
+
+		if (valid) {
+			sg._locationPosition = Common::Point(newX, newY);
+			writeString("Teleported!\n");
+		} else {
+			failed = true;
+		}
+		break;
+	}
+
+	case Data::SPELL_CREATE: {
+		int x = pos.x + getDirDeltaX();
+		int y = pos.y + getDirDeltaY();
+		Data::DungeonCell &cell = dungeon._cells[y][x];
+
+		if (cell._tileNum == Data::DTILE_HALLWAY && cell._monsterId == Data::DUNGEON_NO_MONSTER &&
+				cell._itemId == Data::DITEM_NONE) {
+			cell._tileNum = Data::DTILE_BEAMS;
+			writeString("Field created!\n");
+		} else {
+			failed = true;
+		}
+		break;
+	}
+
+	case Data::SPELL_DESTROY: {
+		int x = pos.x + getDirDeltaX();
+		int y = pos.y + getDirDeltaY();
+		Data::DungeonCell &cell = dungeon._cells[y][x];
+
+		if (cell._tileNum == Data::DTILE_BEAMS) {
+			cell._tileNum = Data::DTILE_HALLWAY;
+			writeString("Field destroyed!\n");
+		} else {
+			failed = true;
+		}
+		break;
+	}
+
+	case Data::SPELL_KILL: {
+		int x = pos.x + getDirDeltaX();
+		int y = pos.y + getDirDeltaY();
+
+		if (dungeon._cells[y][x]._monsterId == Data::DUNGEON_NO_MONSTER)
+			failed = true;
+		else
+			dungeonAttackAt(5, 101, 10000, x, y);
+		break;
+	}
+
+	default:
+		break;
+	}
+
+	if (failed) {
+		playFX(6);
+		writeString("Failed!\n");
+	} else if (spell != Data::SPELL_KILL && spell != Data::SPELL_MAGIC_MISSILE) {
+		playFX(5);
+	}
+}
+
 } // namespace Logic
 } // namespace Ultima1
 } // namespace Ultima
diff --git a/engines/ultima/ultima1/logic/dungeon_logic.h b/engines/ultima/ultima1/logic/dungeon_logic.h
index d60e693b06a..ca3511a5003 100644
--- a/engines/ultima/ultima1/logic/dungeon_logic.h
+++ b/engines/ultima/ultima1/logic/dungeon_logic.h
@@ -110,6 +110,30 @@ private:
 	 */
 	void dungeonAttackAt(int effectNum, int agility, int strike, int x, int y);
 
+	/**
+	 * Returns the magic "strike" power of the currently readied weapon,
+	 * used by the Magic Missile spell - a random value up to the player's
+	 * intelligence, doubled/tripled/halved again depending on whether a
+	 * wand, amulet, staff, or triangle is readied
+	 */
+	int getMagicWeaponPower();
+
+	/**
+	 * Shared finish for the Open/Unlock spells - empties the chest/coffin
+	 * at the player's current position and awards coins
+	 */
+	void castOpen();
+
+	/**
+	 * Casts the prayer spell
+	 */
+	void castPrayer();
+
+	/**
+	 * Casts a spell
+	 */
+	void castSpell(int spell, bool showPhrase);
+
 protected:
 	/**
 	 * Handle dungeon movement
@@ -121,6 +145,11 @@ protected:
 	 */
 	bool attack(Data::Direction dir) override;
 
+	/**
+	 * Cast a spell
+	 */
+	bool cast() override;
+
 	/**
 	 * Handles climbing a ladder at the player's current position
 	 */
diff --git a/engines/ultima/ultima1/logic/overworld_logic.cpp b/engines/ultima/ultima1/logic/overworld_logic.cpp
index b7b5f07f260..f2f14072487 100644
--- a/engines/ultima/ultima1/logic/overworld_logic.cpp
+++ b/engines/ultima/ultima1/logic/overworld_logic.cpp
@@ -105,6 +105,26 @@ bool OverworldLogic::board() {
 	return true;
 }
 
+bool OverworldLogic::cast() {
+	writeString("Cast %s", Data::SPELL_NAMES[_G(savegame)._equippedSpell]);
+
+	switch (_G(savegame)._equippedSpell) {
+	case Data::SPELL_PRAYER:
+		castPrayer();
+		return true;
+
+	case Data::SPELL_MAGIC_MISSILE:
+	case Data::SPELL_KILL:
+		return castSpellAttack();
+
+	default:
+		writeString("\n");
+		playFX(6);
+		writeString("Failed, dungeon spell only!\n");
+		return true;
+	}
+}
+
 bool OverworldLogic::enter() {
 	int location = _G(map).getLocationAt(_G(savegame)._overworldPos);
 	if (location == 0) {
@@ -546,6 +566,39 @@ void OverworldLogic::monsterAttack(int entityIndex, int xDiff, int yDiff, int di
 	redrawStats();
 }
 
+void OverworldLogic::castPrayer() {
+	bool flag = false;
+	writeString("\n%s\n", Data::SPELL_PHRASES[0]);
+
+	if (_G(savegame)._hits < 15) {
+		_G(savegame)._hits = 15;
+		redrawStats();
+		writeString(" Shazam!\n");
+		playFX(5);
+		flag = true;
+
+	} else if (_G(savegame)._food < 15) {
+		_G(savegame)._food = 15;
+		redrawStats();
+		writeString(" Shazam!\n");
+		playFX(5);
+		flag = true;
+
+	} else if (getRandomNumber(1, 100) < 25) {
+		// TODO
+		flag = true;
+	}
+
+	if (!flag) {
+		// TODO
+	}
+}
+
+bool OverworldLogic::castSpellAttack() {
+	// TODO
+	return true;
+}
+
 } // namespace Logic
 } // namespace Ultima1
 } // namespace Ultima
diff --git a/engines/ultima/ultima1/logic/overworld_logic.h b/engines/ultima/ultima1/logic/overworld_logic.h
index 99e5982d3c6..76c78e27356 100644
--- a/engines/ultima/ultima1/logic/overworld_logic.h
+++ b/engines/ultima/ultima1/logic/overworld_logic.h
@@ -107,12 +107,21 @@ private:
 
 	void monsterAttack(int entityIndex, int xDiff, int yDiff, int distance);
 
+	void castPrayer();
+	void castSpell(int spellNum, int val);
+	bool castSpellAttack();
+
 protected:
 	/**
 	 * Board a vehicle the player is standing on
 	 */
 	bool board() override;
 
+	/**
+	 * Cast a spell
+	 */
+	bool cast() override;
+
 	/**
 	 * Enter a location
 	 */
diff --git a/engines/ultima/ultima1/views/create_character.cpp b/engines/ultima/ultima1/views/create_character.cpp
index a846967e242..f1b1cf375ab 100644
--- a/engines/ultima/ultima1/views/create_character.cpp
+++ b/engines/ultima/ultima1/views/create_character.cpp
@@ -375,7 +375,7 @@ void CreateCharacter::confirmAndSave() {
 	p._experience = 0;
 	p._food = 200;
 	p._equippedWeapon = WEAPON_DAGGER;
-	p._equippedSpell = SPELL_NONE;
+	p._equippedSpell = SPELL_PRAYER;
 	p._equippedArmor = ARMOR_LEATHER;
 	p._transportType = TRANSPORT_FOOT;
 	p._overworldPos = Common::Point(49, 40);
diff --git a/engines/ultima/ultima1/views/interactions/dead.cpp b/engines/ultima/ultima1/views/interactions/dead.cpp
index 643c18a5137..a94d68f936e 100644
--- a/engines/ultima/ultima1/views/interactions/dead.cpp
+++ b/engines/ultima/ultima1/views/interactions/dead.cpp
@@ -248,7 +248,7 @@ void Dead::finish() {
 		sg._weapons[i] = 0;
 	sg._equippedWeapon = Data::WEAPON_NONE;
 	sg._equippedArmor = Data::ARMOR_NONE;
-	sg._equippedSpell = Data::SPELL_NONE;
+	sg._equippedSpell = Data::SPELL_PRAYER;
 
 	g_engine->playFX(5);
 	resetPlayerPosition();


Commit: bbed9b5d3a6facff9b62d5f4f5ca4ed86c96b46a
    https://github.com/scummvm/scummvm/commit/bbed9b5d3a6facff9b62d5f4f5ca4ed86c96b46a
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:40:51+11:00

Commit Message:
ULTIMA: ULTIMA1: Work on overworld combat

Changed paths:
  A engines/ultima/ultima1/views/interactions/direction.cpp
  A engines/ultima/ultima1/views/interactions/direction.h
    engines/ultima/module.mk
    engines/ultima/ultima1/data/tiles.h
    engines/ultima/ultima1/logic/logic.h
    engines/ultima/ultima1/logic/overworld_logic.cpp
    engines/ultima/ultima1/logic/overworld_logic.h


diff --git a/engines/ultima/module.mk b/engines/ultima/module.mk
index 4fe14693f43..a40deb96c75 100644
--- a/engines/ultima/module.mk
+++ b/engines/ultima/module.mk
@@ -70,6 +70,7 @@ MODULE_OBJS += \
 	ultima1/logic/space_logic.o \
 	ultima1/views/interactions/interaction.o \
 	ultima1/views/interactions/dead.o \
+	ultima1/views/interactions/direction.o \
 	ultima1/views/interactions/drop.o \
 	ultima1/views/interactions/entering_craft.o \
 	ultima1/views/interactions/king.o \
diff --git a/engines/ultima/ultima1/data/tiles.h b/engines/ultima/ultima1/data/tiles.h
index a17bed3e194..a054c1d35c3 100644
--- a/engines/ultima/ultima1/data/tiles.h
+++ b/engines/ultima/ultima1/data/tiles.h
@@ -55,6 +55,10 @@ enum OverworldTileId {
 	TILE_FIRST_MONSTER = 19,
 	TILE_WANDERING_WARLOCK = 47,
 	TILE_LAST_MONSTER = 47,
+	// Flying spell-attack projectile glyph, used for casting Magic
+	// Missile/Kill on the overworld - distinct from the melee TILE_ATTACK
+	// impact flash below
+	TILE_SPELL_ATTACK = 49,
 	// Attack projectile/impact glyph, flashed briefly over the map during
 	// combat animations
 	TILE_ATTACK = 50
diff --git a/engines/ultima/ultima1/logic/logic.h b/engines/ultima/ultima1/logic/logic.h
index 4f52bd2dcf9..a6ce2392f22 100644
--- a/engines/ultima/ultima1/logic/logic.h
+++ b/engines/ultima/ultima1/logic/logic.h
@@ -81,6 +81,9 @@ protected:
 	 */
 	bool combat(int direction, int amount);
 
+	/**
+	 * Attack with a weapon
+	 */
 	virtual bool attack(Data::Direction dir);
 
 	/**
@@ -91,7 +94,8 @@ protected:
 	/**
 	 * Handles updating creatures/NPCs
 	 */
-	virtual void updateCreatures() = 0;
+	virtual void updateCreatures() {
+	}
 
 	/*--- Fallback player action handlers. Each returns true if end of
 	 * turn processing should happen immediately afterward, or false if
@@ -115,7 +119,9 @@ protected:
 	virtual bool transact();
 	virtual bool xit();
 	virtual bool zstats();
-	virtual bool move(Data::Direction dir) = 0;
+	virtual bool move(Data::Direction dir) {
+		return false;
+	}
 	virtual bool pass();
 
 	/*---------------------------------------*/
diff --git a/engines/ultima/ultima1/logic/overworld_logic.cpp b/engines/ultima/ultima1/logic/overworld_logic.cpp
index f2f14072487..962c8fe0930 100644
--- a/engines/ultima/ultima1/logic/overworld_logic.cpp
+++ b/engines/ultima/ultima1/logic/overworld_logic.cpp
@@ -50,11 +50,73 @@ static const char *IMPASSABLE_REASONS[] = {
 static const int8 DELTA_X[5] = { 0, -1, 1, 0, 0 };
 static const int8 DELTA_Y[5] = { 0, 0, 0, -1, 1 };
 
+
+OverworldLogic::DirectionLogic::DirectionLogic(Mode mode) : _mode(mode) {
+	_oldLogic = _G(logic);
+}
+
+void OverworldLogic::DirectionLogic::action(int action) {
+	Data::Direction dir;
+
+	switch (action) {
+	case KEYBIND_UP:
+		dir = Data::DIR_UP;
+		break;
+	case KEYBIND_DOWN:
+		dir = Data::DIR_DOWN;
+		break;
+	case KEYBIND_LEFT:
+		dir = Data::DIR_LEFT;
+		break;
+	case KEYBIND_RIGHT:
+		dir = Data::DIR_RIGHT;
+		break;
+	default:
+		dir = Data::DIR_UNSPECIFIED;
+		break;
+	}
+
+	_G(logic) = _oldLogic;
+
+	switch (_mode) {
+	case SPELL:
+		static_cast<OverworldLogic *>(_oldLogic.get())->castSpellAttack(dir);
+		break;
+	case WEAPON:
+		static_cast<OverworldLogic *>(_oldLogic.get())->combat(dir, 7);
+		break;
+	case FIRE:
+	default:
+		static_cast<OverworldLogic *>(_oldLogic.get())->combat(dir, 8);
+		break;
+	}
+}
+
+/*-------------------------------------------------------------------*/
+
 OverworldLogic::OverworldLogic() {
 	_G(map)._mapType = Data::MAPTYPE_OVERWORLD;
 	_G(transportFoodCtr) = 1;
 }
 
+bool OverworldLogic::attack(Data::Direction dir) {
+	writeString("Attack with %s", Data::WEAPON_NAMES_LOWER[_G(savegame)._equippedWeapon]);
+
+	int maxDistance = Data::WEAPONS_DISTANCE[_G(savegame)._equippedWeapon];
+	if (!maxDistance) {
+		// It's a non-attacking "weapon" like the rope
+		writeString("?\n");
+		playFX(1);
+		return true;
+
+	} else {
+		writeString(": ");
+		_G(logic) = Common::SharedPtr<Logic>(new DirectionLogic(DirectionLogic::WEAPON));
+		g_engine->addView("Direction");
+		return false;
+	}
+}
+
 bool OverworldLogic::board() {
 	auto &sg = _G(savegame);
 
@@ -115,7 +177,11 @@ bool OverworldLogic::cast() {
 
 	case Data::SPELL_MAGIC_MISSILE:
 	case Data::SPELL_KILL:
-		return castSpellAttack();
+		// Select direction
+		writeString(": ");
+		_G(logic) = Common::SharedPtr<Logic>(new DirectionLogic(DirectionLogic::SPELL));
+		g_engine->addView("Direction");
+		return false;
 
 	default:
 		writeString("\n");
@@ -184,12 +250,15 @@ bool OverworldLogic::fire() {
 	writeString("Fire ");
 
 	if (_G(savegame)._transportType == Data::TRANSPORT_FRIGATE || _G(savegame)._transportType == Data::TRANSPORT_AIRCAR) {
+		writeString(_G(savegame)._transportType == Data::TRANSPORT_FRIGATE ? "cannons: " : "lasers: ");
+		_G(logic) = Common::SharedPtr<Logic>(new DirectionLogic(DirectionLogic::FIRE));
+		g_engine->addView("Direction");
+		return false;
 
 	} else {
 		writeString("what?\n");
+		return true;
 	}
-
-	return true;
 }
 
 bool OverworldLogic::move(Data::Direction dir) {
@@ -594,9 +663,127 @@ void OverworldLogic::castPrayer() {
 	}
 }
 
-bool OverworldLogic::castSpellAttack() {
-	// TODO
-	return true;
+int OverworldLogic::getMagicWeaponPower() {
+	Data::Savegame &sg = _G(savegame);
+	int result = getRandomNumber(1, sg._intelligence);
+
+	if (sg._equippedWeapon == Data::WEAPON_WAND)
+		result *= 2;
+	else if (sg._equippedWeapon == Data::WEAPON_AMULET)
+		result = result * 3 / 2;
+	else if (sg._equippedWeapon == Data::WEAPON_STAFF || sg._equippedWeapon == Data::WEAPON_TRIANGLE)
+		result *= 3;
+
+	return result;
+}
+
+void OverworldLogic::giveCoins(int coins) {
+	Data::Savegame &sg = _G(savegame);
+	if (sg._coins + coins > 9999)
+		coins = 9999 - sg._coins;
+
+	sg._coins += coins;
+	writeString("%d gold\n", coins);
+}
+
+void OverworldLogic::attackDamage(Data::Direction dir, int effectNum, int maxDistance, int strike, int hitChance, int tileId) {
+	// DELTA_X/Y aren't valid for DIR_UNSPECIFIED (-1) - treat it the same
+	// as DELTA_X/Y's own unused index 0, i.e. the projectile just stays put
+	// on the player's own tile
+	int deltaIdx = (dir == Data::DIR_UNSPECIFIED) ? 0 : dir;
+	int dx = DELTA_X[deltaIdx], dy = DELTA_Y[deltaIdx];
+	const Common::Point &pos = _G(savegame)._overworldPos;
+
+	int x = pos.x, y = pos.y, tile = 0;
+	for (int step = 1; step <= maxDistance; ++step) {
+		x = pos.x + dx * step;
+		y = pos.y + dy * step;
+
+		showAttackTile(x, y, tileId);
+		tile = _G(map).getTileAt(x, y);
+
+		if (tile >= Data::TILE_FIRST_MONSTER || tile == Data::TILE_MOUNTAINS)
+			break;
+	}
+
+	if (tile < Data::TILE_FIRST_MONSTER) {
+		// Ran out of range, or blocked by mountains, without finding a monster
+		writeString("Miss!\n");
+		return;
+	}
+
+	int monsterIdx = (tile - Data::TILE_FIRST_MONSTER) / 2;
+	const char *monsterName = Data::OVERWORLD_MONSTERS[monsterIdx];
+
+	if (getRandomNumber(1, 100) > hitChance) {
+		writeString("Missed the %s!\n", monsterName);
+		return;
+	}
+
+	Data::Savegame &sg = _G(savegame);
+	int entityIdx = sg.getOverworldEntityAt(x, y, 1);
+	if (entityIdx == -1) {
+		// Shouldn't normally happen - the scan found a monster tile with no
+		// matching entity there
+		writeString("Miss!\n");
+		return;
+	}
+
+	Data::OverworldEntity &e = sg._overworldEntities[entityIdx];
+	e._hits -= strike;
+
+	writeString(e._hits > 0 ? "Hit the %s" : "Killed the %s", monsterName);
+
+	if (e._hits > 0) {
+		writeString(Common::String(monsterName).size() > 6 ? "!\n" : "! ");
+		writeString("%d damage\n", strike);
+		playFX(2);
+
+	} else {
+		sg.removeOverworldCreatureAt(x, y);
+		--_G(creaturesCount);
+
+		int coins = getRandomNumber(1, Data::OVERWORLD_MONSTERS_DAMAGE[monsterIdx] * 4) + 10;
+		int expGain = getRandomNumber(2, Data::OVERWORLD_MONSTERS_DAMAGE[monsterIdx] * 5);
+		sg._experience += expGain;
+		playFX(2);
+
+		giveCoins(coins);
+		redrawStats();
+	}
+}
+
+void OverworldLogic::castSpellAttack(Data::Direction dir) {
+	Data::Savegame &sg = _G(savegame);
+
+	writeString("%s\n", (dir >= Data::DIR_LEFT && dir <= Data::DIR_DOWN) ? Data::DIRECTION_NAMES[dir] : "");
+
+	int strike;
+	if (sg._equippedSpell == Data::SPELL_MAGIC_MISSILE) {
+		writeString("\"DELCIO-ERE-UI\" ");
+		strike = getMagicWeaponPower();
+	} else {
+		// SPELL_KILL - cast() only ever routes Magic Missile/Kill here
+		writeString("\"INTERFICIO-NUNC!\" ");
+		strike = 9999;
+	}
+
+	bool success = (sg._class == Data::CLASS_FIGHTER) ||
+		(getRandomNumber(1, 100) < sg._wisdom + 50);
+
+	if (!success) {
+		writeString("Failed!\n");
+		playFX(6);
+		return;
+	}
+
+	playFX(5);
+	writeString("\n");
+	attackDamage(dir, 7, 3, strike, 101, Data::TILE_SPELL_ATTACK);
+}
+
+void OverworldLogic::combat(Data::Direction dir, int val) {
+
 }
 
 } // namespace Logic
diff --git a/engines/ultima/ultima1/logic/overworld_logic.h b/engines/ultima/ultima1/logic/overworld_logic.h
index 76c78e27356..4f84df8b991 100644
--- a/engines/ultima/ultima1/logic/overworld_logic.h
+++ b/engines/ultima/ultima1/logic/overworld_logic.h
@@ -23,6 +23,7 @@
 #ifndef ULTIMA2_LOGIC_OVERWORLD_LOGIC_H
 #define ULTIMA2_LOGIC_OVERWORLD_LOGIC_H
 
+#include "common/ptr.h"
 #include "ultima/ultima1/logic/logic.h"
 #include "ultima/ultima1/data/map.h"
 
@@ -31,6 +32,26 @@ namespace Ultima1 {
 namespace Logic {
 
 class OverworldLogic : public Logic {
+private:
+	/**
+	 * Bridging class used to receive back the selected direction from the Direction view, and then
+	 * dispatch it for either spell or weapon attack in the given direction.
+	 */
+	class DirectionLogic : public Logic {
+	public:
+		enum Mode { SPELL, WEAPON, FIRE };
+	private:
+		Common::SharedPtr<Logic> _oldLogic;
+		Mode _mode;
+
+	public:
+		DirectionLogic(Mode mode);
+		~DirectionLogic() override {
+		}
+		void action(int action) override;
+	};
+	friend class DirectionLogic;
+
 private:
 	/**
 	 * Check for movement
@@ -109,9 +130,37 @@ private:
 
 	void castPrayer();
 	void castSpell(int spellNum, int val);
-	bool castSpellAttack();
+
+	/**
+	 * Returns the magic "strike" power of the currently readied weapon,
+	 * used by the Magic Missile spell - a random value up to the player's
+	 * intelligence, doubled/tripled/halved again depending on whether a
+	 * wand, amulet, staff, or triangle is readied
+	 */
+	int getMagicWeaponPower();
+
+	/**
+	 * Adds coins to the player's purse, capped at 9999
+	 */
+	void giveCoins(int coins);
+
+	/**
+	 * Animates a spell-attack projectile flying up to maxDistance tiles in
+	 * the given direction, stopping early at a monster or mountains, then
+	 * resolves the hit - rolling to hit, then applying damage or killing
+	 * the monster there, awarding coins/experience on a kill
+	 */
+	void attackDamage(Data::Direction dir, int effectNum, int maxDistance, int strike, int hitChance, int tileId);
+
+	void castSpellAttack(Data::Direction dir);
+	void combat(Data::Direction dir, int val);
 
 protected:
+	/**
+	 * Attack with weapon
+	 */
+	bool attack(Data::Direction dir) override;
+
 	/**
 	 * Board a vehicle the player is standing on
 	 */
diff --git a/engines/ultima/ultima1/views/interactions/direction.cpp b/engines/ultima/ultima1/views/interactions/direction.cpp
new file mode 100644
index 00000000000..577823ce9ea
--- /dev/null
+++ b/engines/ultima/ultima1/views/interactions/direction.cpp
@@ -0,0 +1,72 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "ultima/ultima1/views/interactions/direction.h"
+#include "ultima/ultima1/data/map.h"
+#include "ultima/ultima1/ultima1.h"
+#include "ultima/ultima1/metaengine.h"
+
+namespace Ultima {
+namespace Ultima1 {
+namespace Views {
+namespace Interactions {
+
+bool Direction::msgFocus(const FocusMessage &msg) {
+	showCursor();
+	return true;
+}
+
+bool Direction::msgAction(const ActionMessage &msg) {
+	switch (msg._action) {
+	case KEYBIND_UP:
+	case KEYBIND_ATTACK_UP:
+		_G(logic)->action(KEYBIND_UP);
+		break;
+	case KEYBIND_DOWN:
+	case KEYBIND_ATTACK_DOWN:
+		_G(logic)->action(KEYBIND_DOWN);
+		break;
+	case KEYBIND_LEFT:
+	case KEYBIND_ATTACK_LEFT:
+		_G(logic)->action(KEYBIND_LEFT);
+		break;
+	case KEYBIND_RIGHT:
+	case KEYBIND_ATTACK_RIGHT:
+		_G(logic)->action(KEYBIND_RIGHT);
+		break;
+	default:
+		_G(logic)->action(KEYBIND_PASS);
+		break;
+	}
+
+	return true;
+}
+
+bool Direction::msgKeypress(const KeypressMessage &msg) {
+	close();
+	_G(logic)->action(KEYBIND_PASS);
+	return true;
+}
+
+} // namespace Interactions
+} // namespace Views
+} // namespace Ultima1
+} // namespace Ultima
diff --git a/engines/ultima/ultima1/views/interactions/direction.h b/engines/ultima/ultima1/views/interactions/direction.h
new file mode 100644
index 00000000000..7d4148a3a2c
--- /dev/null
+++ b/engines/ultima/ultima1/views/interactions/direction.h
@@ -0,0 +1,56 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef ULTIMA1_VIEWS_INTERACTIONS_DIRECTION_H
+#define ULTIMA1_VIEWS_INTERACTIONS_DIRECTION_H
+
+#include "common/ptr.h"
+#include "ultima/ultima1/views/interactions/interaction.h"
+#include "ultima/ultima1/logic/logic.h"
+
+namespace Ultima {
+namespace Ultima1 {
+namespace Views {
+namespace Interactions {
+
+using namespace Ultima::Shared::Messages;
+
+/**
+ * Waits for the user to select a direction
+ */
+class Direction : public Interaction {
+public:
+	Direction() : Interaction("Direction") {
+	}
+	~Direction() override {
+	}
+
+	bool msgFocus(const FocusMessage &msg) override;
+	bool msgAction(const ActionMessage &msg) override;
+	bool msgKeypress(const KeypressMessage &msg) override;
+};
+
+} // namespace Interactions
+} // namespace Views
+} // namespace Ultima1
+} // namespace Ultima
+
+#endif


Commit: 9438de1b9f60b8deac7be643a2a4fd99eed94d9d
    https://github.com/scummvm/scummvm/commit/9438de1b9f60b8deac7be643a2a4fd99eed94d9d
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:40:51+11:00

Commit Message:
ULTIMA: ULTIMA1: Remainder of city/castle/overworld attack code

Changed paths:
    engines/ultima/ultima1/data/tiles.h
    engines/ultima/ultima1/logic/city_castle_logic.cpp
    engines/ultima/ultima1/logic/city_castle_logic.h
    engines/ultima/ultima1/logic/logic.cpp
    engines/ultima/ultima1/logic/logic.h
    engines/ultima/ultima1/logic/overworld_logic.cpp
    engines/ultima/ultima1/logic/overworld_logic.h


diff --git a/engines/ultima/ultima1/data/tiles.h b/engines/ultima/ultima1/data/tiles.h
index a054c1d35c3..3353427daff 100644
--- a/engines/ultima/ultima1/data/tiles.h
+++ b/engines/ultima/ultima1/data/tiles.h
@@ -70,6 +70,10 @@ enum LocationTileId {
 	CTILE_GUARD = 17,
 	CTILE_PLAYER = 18,
 	CTILE_BARD = 19,
+	// The king/merchant NPC widget types - distinct from CTILE_KING(62)
+	// below, which is the throne tile the player stands on to transact
+	CTILE_KING_WIDGET = 20,
+	CTILE_MERCHANT = 21,
 	CTILE_PRINCESS = 22,
 	CTILE_WENCH = 50,
 	// Wishing tiles for dropping coins on
diff --git a/engines/ultima/ultima1/logic/city_castle_logic.cpp b/engines/ultima/ultima1/logic/city_castle_logic.cpp
index 1e5993f4224..017a2d9e43a 100644
--- a/engines/ultima/ultima1/logic/city_castle_logic.cpp
+++ b/engines/ultima/ultima1/logic/city_castle_logic.cpp
@@ -194,6 +194,97 @@ void CityCastleLogic::updateCreatures() {
 	}
 }
 
+void CityCastleLogic::damage(Data::Direction dir, int effectNum, int maxDistance, int strike, int hitChance, int tileId) {
+	attackPerson(dir, maxDistance, strike, hitChance);
+}
+
+void CityCastleLogic::attackPerson(Data::Direction dir, int maxDistance, int strike, int hitChance) {
+	playFX(7);
+
+	int deltaX = DELTA_X[dir], deltaY = DELTA_Y[dir];
+	const auto &pos = _G(savegame)._locationPosition;
+
+	// Scan up to maxDistance tiles for whatever's there, just to pick which
+	// "Type! " message to show - stops as soon as anything but open ground
+	// is found
+	int tile = -1;
+	for (int step = 1; step <= maxDistance; ++step) {
+		tile = checkAt(pos.x + deltaX * step, pos.y + deltaY * step);
+		if (tile != -1 && tile != Data::CTILE_BLANK)
+			break;
+	}
+
+	// The actual attack always lands on whatever's directly adjacent,
+	// regardless of how far away the scan above found something - matching
+	// a quirk in the original
+	int idx = _G(savegame).getLocationEntityAt(pos.x + deltaX, pos.y + deltaY);
+	bool hit = (idx != -1) && (getRandomNumber(1, 100) <= hitChance);
+
+	if (!hit) {
+		writeString("Missed!\n");
+		return;
+	}
+
+	writeString("Hit ");
+	switch (tile) {
+	case Data::CTILE_WENCH:
+		writeString(_G(savegame)._sex == Data::SEX_MALE ? "Wench! " : "Lecher! ");
+		break;
+	case Data::CTILE_BARD:
+		writeString(_G(map)._mapType == Data::MAPTYPE_CITY ? "Bard! " : "Jester! ");
+		break;
+	case Data::CTILE_PRINCESS:
+		writeString("Princess! ");
+		break;
+	case Data::CTILE_MERCHANT:
+		writeString("Merchant! ");
+		break;
+	case Data::CTILE_GUARD:
+		writeString("Guard! ");
+		break;
+	case Data::CTILE_KING_WIDGET:
+		writeString("King! ");
+		break;
+	default:
+		break;
+	}
+
+	_G(savegame)._guardsHostile = 1;
+	playFX(2);
+
+	Data::LocationEntity &e = _G(savegame)._locationEntities[idx];
+	if (strike >= e._hitPoints) {
+		// Killed
+		writeString("Killed!\n");
+
+		if (tile == Data::CTILE_PRINCESS) {
+			_G(savegame)._freeingPrincess = 0;
+		} else {
+			++_G(savegame)._experience;
+			redrawStats();
+		}
+
+		e._type = -1;
+		e._position.x = 127;
+		redrawMap();
+
+		if (tile == Data::CTILE_GUARD)
+			_G(savegame)._experience += 14;
+
+		if (tile == Data::CTILE_BARD && _G(map)._mapType == Data::MAPTYPE_CASTLE) {
+			writeString("Thou hast found a key!\n");
+			_G(savegame)._hasCastleKey = 1;
+		}
+
+	} else {
+		// The king is invincible in Lord British's castle
+		if (!(tile == Data::CTILE_KING_WIDGET && _G(map)._isLordBritishCastle))
+			e._hitPoints -= strike;
+
+		writeString("%d damage!\n", strike);
+	}
+}
+
 bool CityCastleLogic::drop() {
 	g_engine->addView("Drop");
 	return false;
diff --git a/engines/ultima/ultima1/logic/city_castle_logic.h b/engines/ultima/ultima1/logic/city_castle_logic.h
index 7edf41b0729..37b09e30779 100644
--- a/engines/ultima/ultima1/logic/city_castle_logic.h
+++ b/engines/ultima/ultima1/logic/city_castle_logic.h
@@ -76,6 +76,15 @@ private:
 	 */
 	bool moveEntityBy(int entityIndex, int deltaX, int deltaY);
 
+	/**
+	 * Resolves a weapon/cannon-fire attack against whichever NPC widget is
+	 * standing directly adjacent to the player in the given direction -
+	 * the type shown in the attack message is instead whatever widget (if
+	 * any) is found scanning up to maxDistance tiles away, matching a
+	 * quirk in the original where the two don't have to be the same NPC
+	 */
+	void attackPerson(Data::Direction dir, int maxDistance, int strike, int hitChance);
+
 protected:
 	/**
 	 * Load the NPCs for the given location
@@ -92,6 +101,13 @@ protected:
 	 */
 	void updateCreatures() override;
 
+	/**
+	 * Resolves a weapon/cannon-fire attack - see attackPerson. effectNum
+	 * and tileId aren't used here; the city/castle side of the original's
+	 * shared damage() function never draws a projectile
+	 */
+	void damage(Data::Direction dir, int effectNum, int maxDistance, int strike, int hitChance, int tileId) override;
+
 	/**
 	 * The Drop command is only usable within cities and castles
 	 */
diff --git a/engines/ultima/ultima1/logic/logic.cpp b/engines/ultima/ultima1/logic/logic.cpp
index cecc5991045..60b7d7c7d01 100644
--- a/engines/ultima/ultima1/logic/logic.cpp
+++ b/engines/ultima/ultima1/logic/logic.cpp
@@ -195,9 +195,17 @@ bool Logic::attack(Data::Direction dir) {
 
 	if (Data::WEAPONS_DISTANCE[_G(savegame)._equippedWeapon]) {
 		writeString(": ");
-		return combat(dir, 7);
 
+		if (dir == Data::DIR_UNSPECIFIED) {
+			_G(logic) = Common::SharedPtr<Logic>(new DirectionLogic(DirectionLogic::WEAPON));
+			g_engine->addView("Direction");
+			return false;
+		} else {
+			combat(dir, 7);
+			return true;
+		}
 	} else {
+		// It's a non-attacking "weapon" like the rope
 		writeString("?\n");
 		playFX(1);
 		return true;
@@ -333,9 +341,75 @@ bool Logic::pass() {
 	return true;
 }
 
-bool Logic::combat(int direction, int amount) {
-	// TODO
-	return true;
+void Logic::combat(Data::Direction direction, int effect) {
+	if (direction == Data::DIR_UNSPECIFIED) {
+		writeString("nothing\n");
+	} else {
+		writeString("%s\n", Data::DIRECTION_NAMES[direction]);
+		combatDir(direction, effect);
+	}
+}
+
+void Logic::combatDir(Data::Direction direction, int effect) {
+	Data::Savegame &sg = _G(savegame);
+	int maxDistance, hitChance, strike;
+
+	if (effect == 7) {
+		// Attacking with the readied weapon
+		maxDistance = Data::WEAPONS_DISTANCE[sg._equippedWeapon];
+		hitChance = sg._agility + 50;
+		strike = getRandomNumber(2, sg._equippedWeapon * 8 + sg._strength);
+	} else {
+		// Firing a frigate's cannons/aircar's lasers
+		maxDistance = 3;
+		hitChance = 80;
+		strike = getRandomNumber(1, sg._transportType * 10) + 30;
+	}
+
+	damage(direction, effect, maxDistance, strike, hitChance, Data::TILE_ATTACK);
+}
+
+/*-------------------------------------------------------------------*/
+
+DirectionLogic::DirectionLogic(Mode mode) : _mode(mode) {
+	_oldLogic = _G(logic);
+}
+
+void DirectionLogic::action(int action) {
+	Data::Direction dir;
+
+	switch (action) {
+	case KEYBIND_UP:
+		dir = Data::DIR_UP;
+		break;
+	case KEYBIND_DOWN:
+		dir = Data::DIR_DOWN;
+		break;
+	case KEYBIND_LEFT:
+		dir = Data::DIR_LEFT;
+		break;
+	case KEYBIND_RIGHT:
+		dir = Data::DIR_RIGHT;
+		break;
+	default:
+		dir = Data::DIR_UNSPECIFIED;
+		break;
+	}
+
+	_G(logic) = _oldLogic;
+
+	switch (_mode) {
+	case SPELL:
+		_oldLogic->castSpellAttack(dir);
+		break;
+	case WEAPON:
+		_oldLogic->combat(dir, 7);
+		break;
+	case FIRE:
+	default:
+		_oldLogic->combat(dir, 8);
+		break;
+	}
 }
 
 } // namespace Logic
diff --git a/engines/ultima/ultima1/logic/logic.h b/engines/ultima/ultima1/logic/logic.h
index a6ce2392f22..50464420a01 100644
--- a/engines/ultima/ultima1/logic/logic.h
+++ b/engines/ultima/ultima1/logic/logic.h
@@ -24,17 +24,24 @@
 #define ULTIMA2_LOGIC_H
 
 #include "common/events.h"
+#include "common/ptr.h"
 #include "ultima/ultima1/data/map.h"
 
 namespace Ultima {
 namespace Ultima1 {
 namespace Logic {
 
+class DirectionLogic;
+
 /**
  * Base class for gameplay handling logic used by the Commands class to respond to player actions
  * or other miscellaneous keypresses.
  */
 class Logic {
+	friend class DirectionLogic;
+private:
+	void combatDir(Data::Direction direction, int effect);
+
 protected:
 	/**
 	 * Dispatches some text to be shown in the Commands window
@@ -79,7 +86,7 @@ protected:
 	/**
 	 * Triggers combat action
 	 */
-	bool combat(int direction, int amount);
+	void combat(Data::Direction direction, int effect);
 
 	/**
 	 * Attack with a weapon
@@ -97,6 +104,28 @@ protected:
 	virtual void updateCreatures() {
 	}
 
+	/**
+	 * Cast spell direction chosen for overworld spells
+	 */
+	virtual void castSpellAttack(Data::Direction dir) {
+	}
+
+	/**
+	 * Resolves a weapon/cannon-fire/spell attack in a given direction -
+	 * rolls to hit, then applies damage or kills whatever's found there.
+	 * The city/castle half (CityCastleLogic) attacks an NPC widget; the
+	 * overworld half (OverworldLogic) attacks a monster entity - dungeons
+	 * have their own separate attack handling and don't use this
+	 * @param dir			Direction to attack in
+	 * @param effectNum		Sound effect Id to play on a successful hit
+	 * @param maxDistance	How far away a target can be and still be hit
+	 * @param strike		Amount of damage to inflict
+	 * @param hitChance		1-100 threshold a to-hit roll must be under
+	 * @param tileId		Tile Id shown for the weapon/projectile effect
+	 */
+	virtual void damage(Data::Direction dir, int effectNum, int maxDistance, int strike, int hitChance, int tileId) {
+	}
+
 	/*--- Fallback player action handlers. Each returns true if end of
 	 * turn processing should happen immediately afterward, or false if
 	 * that's being deferred - typically because a sub-dialog was opened
@@ -140,6 +169,26 @@ public:
 	virtual void tick() {}
 };
 
+/**
+ * Bridging class used to receive back the selected direction from the Direction view, and then
+ * dispatch it for either spell or weapon attack in the given direction.
+ */
+class DirectionLogic : public Logic {
+public:
+	enum Mode {
+		SPELL, WEAPON, FIRE
+	};
+private:
+	Common::SharedPtr<Logic> _oldLogic;
+	Mode _mode;
+
+public:
+	DirectionLogic(Mode mode);
+	~DirectionLogic() override {
+	}
+	void action(int action) override;
+};
+
 } // namespace Logic
 } // namespace Ultima1
 } // namespace Ultima
diff --git a/engines/ultima/ultima1/logic/overworld_logic.cpp b/engines/ultima/ultima1/logic/overworld_logic.cpp
index 962c8fe0930..2289232735d 100644
--- a/engines/ultima/ultima1/logic/overworld_logic.cpp
+++ b/engines/ultima/ultima1/logic/overworld_logic.cpp
@@ -51,72 +51,11 @@ static const int8 DELTA_X[5] = { 0, -1, 1, 0, 0 };
 static const int8 DELTA_Y[5] = { 0, 0, 0, -1, 1 };
 
 
-OverworldLogic::DirectionLogic::DirectionLogic(Mode mode) : _mode(mode) {
-	_oldLogic = _G(logic);
-}
-
-void OverworldLogic::DirectionLogic::action(int action) {
-	Data::Direction dir;
-
-	switch (action) {
-	case KEYBIND_UP:
-		dir = Data::DIR_UP;
-		break;
-	case KEYBIND_DOWN:
-		dir = Data::DIR_DOWN;
-		break;
-	case KEYBIND_LEFT:
-		dir = Data::DIR_LEFT;
-		break;
-	case KEYBIND_RIGHT:
-		dir = Data::DIR_RIGHT;
-		break;
-	default:
-		dir = Data::DIR_UNSPECIFIED;
-		break;
-	}
-
-	_G(logic) = _oldLogic;
-
-	switch (_mode) {
-	case SPELL:
-		static_cast<OverworldLogic *>(_oldLogic.get())->castSpellAttack(dir);
-		break;
-	case WEAPON:
-		static_cast<OverworldLogic *>(_oldLogic.get())->combat(dir, 7);
-		break;
-	case FIRE:
-	default:
-		static_cast<OverworldLogic *>(_oldLogic.get())->combat(dir, 8);
-		break;
-	}
-}
-
-/*-------------------------------------------------------------------*/
-
 OverworldLogic::OverworldLogic() {
 	_G(map)._mapType = Data::MAPTYPE_OVERWORLD;
 	_G(transportFoodCtr) = 1;
 }
 
-bool OverworldLogic::attack(Data::Direction dir) {
-	writeString("Attack with %s", Data::WEAPON_NAMES_LOWER[_G(savegame)._equippedWeapon]);
-
-	int maxDistance = Data::WEAPONS_DISTANCE[_G(savegame)._equippedWeapon];
-	if (!maxDistance) {
-		// It's a non-attacking "weapon" like the rope
-		writeString("?\n");
-		playFX(1);
-		return true;
-
-	} else {
-		writeString(": ");
-		_G(logic) = Common::SharedPtr<Logic>(new DirectionLogic(DirectionLogic::WEAPON));
-		g_engine->addView("Direction");
-		return false;
-	}
-}
-
 bool OverworldLogic::board() {
 	auto &sg = _G(savegame);
 
@@ -686,7 +625,7 @@ void OverworldLogic::giveCoins(int coins) {
 	writeString("%d gold\n", coins);
 }
 
-void OverworldLogic::attackDamage(Data::Direction dir, int effectNum, int maxDistance, int strike, int hitChance, int tileId) {
+void OverworldLogic::damage(Data::Direction dir, int effectNum, int maxDistance, int strike, int hitChance, int tileId) {
 	// DELTA_X/Y aren't valid for DIR_UNSPECIFIED (-1) - treat it the same
 	// as DELTA_X/Y's own unused index 0, i.e. the projectile just stays put
 	// on the player's own tile
@@ -699,6 +638,8 @@ void OverworldLogic::attackDamage(Data::Direction dir, int effectNum, int maxDis
 		x = pos.x + dx * step;
 		y = pos.y + dy * step;
 
+		if (step == 1)
+			playFX(effectNum);
 		showAttackTile(x, y, tileId);
 		tile = _G(map).getTileAt(x, y);
 
@@ -779,11 +720,7 @@ void OverworldLogic::castSpellAttack(Data::Direction dir) {
 
 	playFX(5);
 	writeString("\n");
-	attackDamage(dir, 7, 3, strike, 101, Data::TILE_SPELL_ATTACK);
-}
-
-void OverworldLogic::combat(Data::Direction dir, int val) {
-
+	damage(dir, 7, 3, strike, 101, Data::TILE_SPELL_ATTACK);
 }
 
 } // namespace Logic
diff --git a/engines/ultima/ultima1/logic/overworld_logic.h b/engines/ultima/ultima1/logic/overworld_logic.h
index 4f84df8b991..bb129550687 100644
--- a/engines/ultima/ultima1/logic/overworld_logic.h
+++ b/engines/ultima/ultima1/logic/overworld_logic.h
@@ -23,7 +23,6 @@
 #ifndef ULTIMA2_LOGIC_OVERWORLD_LOGIC_H
 #define ULTIMA2_LOGIC_OVERWORLD_LOGIC_H
 
-#include "common/ptr.h"
 #include "ultima/ultima1/logic/logic.h"
 #include "ultima/ultima1/data/map.h"
 
@@ -32,26 +31,6 @@ namespace Ultima1 {
 namespace Logic {
 
 class OverworldLogic : public Logic {
-private:
-	/**
-	 * Bridging class used to receive back the selected direction from the Direction view, and then
-	 * dispatch it for either spell or weapon attack in the given direction.
-	 */
-	class DirectionLogic : public Logic {
-	public:
-		enum Mode { SPELL, WEAPON, FIRE };
-	private:
-		Common::SharedPtr<Logic> _oldLogic;
-		Mode _mode;
-
-	public:
-		DirectionLogic(Mode mode);
-		~DirectionLogic() override {
-		}
-		void action(int action) override;
-	};
-	friend class DirectionLogic;
-
 private:
 	/**
 	 * Check for movement
@@ -144,23 +123,7 @@ private:
 	 */
 	void giveCoins(int coins);
 
-	/**
-	 * Animates a spell-attack projectile flying up to maxDistance tiles in
-	 * the given direction, stopping early at a monster or mountains, then
-	 * resolves the hit - rolling to hit, then applying damage or killing
-	 * the monster there, awarding coins/experience on a kill
-	 */
-	void attackDamage(Data::Direction dir, int effectNum, int maxDistance, int strike, int hitChance, int tileId);
-
-	void castSpellAttack(Data::Direction dir);
-	void combat(Data::Direction dir, int val);
-
 protected:
-	/**
-	 * Attack with weapon
-	 */
-	bool attack(Data::Direction dir) override;
-
 	/**
 	 * Board a vehicle the player is standing on
 	 */
@@ -191,6 +154,19 @@ protected:
 	 */
 	void updateCreatures() override;
 
+	void castSpellAttack(Data::Direction dir) override;
+
+	/**
+	 * Animates an attack projectile flying up to maxDistance tiles in the
+	 * given direction, stopping early at a monster or mountains, then
+	 * resolves the hit - rolling to hit, then applying damage or killing
+	 * the monster there, awarding coins/experience on a kill. Used for
+	 * weapon/cannon-fire attacks (via Logic::combatDir) as well as spell
+	 * attacks (castSpellAttack calls this directly, just as the original
+	 * has castSpellAttack call the same shared damage() function)
+	 */
+	void damage(Data::Direction dir, int effectNum, int maxDistance, int strike, int hitChance, int tileId) override;
+
 public:
 	OverworldLogic();
 	~OverworldLogic() override {


Commit: c9075fe8a9f22a389c4ba1f810518426a419bf72
    https://github.com/scummvm/scummvm/commit/c9075fe8a9f22a389c4ba1f810518426a419bf72
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:40:51+11:00

Commit Message:
ULTIMA: ULTIMA1: Mondain map movement

Changed paths:
    engines/ultima/ultima1/data/savegame.cpp
    engines/ultima/ultima1/data/savegame.h
    engines/ultima/ultima1/logic/mondain_logic.cpp
    engines/ultima/ultima1/logic/mondain_logic.h


diff --git a/engines/ultima/ultima1/data/savegame.cpp b/engines/ultima/ultima1/data/savegame.cpp
index b84c07a0e84..97df00ffdc9 100644
--- a/engines/ultima/ultima1/data/savegame.cpp
+++ b/engines/ultima/ultima1/data/savegame.cpp
@@ -104,6 +104,14 @@ void Savegame::synchronizeExtra(Common::Serializer &s) {
 	s.syncAsByte(_dungeonLevel);
 	s.syncAsByte(_dungeonDirection);
 	s.syncAsSint16LE(_dungeonExitHitPoints);
+
+	if (_mapNum == MAP_MONDAIN) {
+		s.syncAsSint16LE(_mondainPos.x);
+		s.syncAsSint16LE(_mondainPos.y);
+		s.syncAsByte(_gemDestroyedFlag);
+		s.syncAsSint16LE(_mondainHitAnimFrame);
+		s.syncAsSint16LE(_mondainCombatFlag);
+	}
 }
 
 void Savegame::synchronize(Common::Serializer &s) {
diff --git a/engines/ultima/ultima1/data/savegame.h b/engines/ultima/ultima1/data/savegame.h
index 88518770d5b..edf9c6f50c5 100644
--- a/engines/ultima/ultima1/data/savegame.h
+++ b/engines/ultima/ultima1/data/savegame.h
@@ -129,6 +129,12 @@ public:
 
 	bool _gemDestroyedFlag = false;
 	Common::Point _mondainPos;
+	// Set to 1 when the player first steps next to Mondain, then counts up
+	// frame by frame to drive his hit-reaction animation
+	int16 _mondainHitAnimFrame = 0;
+	// Set once combat with Mondain has been triggered (the player got
+	// adjacent to him for the first time)
+	int16 _mondainCombatFlag = 0;
 
 	/**
 	 * Synchronize savegame data
diff --git a/engines/ultima/ultima1/logic/mondain_logic.cpp b/engines/ultima/ultima1/logic/mondain_logic.cpp
index 5ae202cd9cb..b67971527e3 100644
--- a/engines/ultima/ultima1/logic/mondain_logic.cpp
+++ b/engines/ultima/ultima1/logic/mondain_logic.cpp
@@ -29,6 +29,9 @@ namespace Ultima {
 namespace Ultima1 {
 namespace Logic {
 
+static const int8 DELTA_X[5] = { 0, -1, 1, 0, 0 };
+static const int8 DELTA_Y[5] = { 0, 0, 0, -1, 1 };
+
 MondainLogic::MondainLogic() {
 	_G(map)._mapType = Data::MAPTYPE_MONDAIN;
 }
@@ -39,10 +42,72 @@ void MondainLogic::entering() {
 }
 
 bool MondainLogic::move(Data::Direction dir) {
-	// TODO
+	Data::Savegame &sg = _G(savegame);
+	int newX = sg._locationPosition.x + DELTA_X[dir];
+	int newY = sg._locationPosition.y + DELTA_Y[dir];
+
+	int moveResult;
+	if (newX < 0 || newX >= Data::MONDAIN_WIDTH || newY < 0 || newY >= Data::MONDAIN_HEIGHT) {
+		// Off the edge of the room
+		moveResult = 2;
+	} else if (newX == sg._mondainPos.x && newY == sg._mondainPos.y) {
+		// Mondain himself is blocking the way
+		moveResult = 2;
+	} else {
+		moveResult = _G(map).getMapTile(newX, newY);
+	}
+
+	if (moveResult == 0) {
+		// Open floor - move there. The old/new position markers embedded
+		// in the map are kept in sync with the player's actual position,
+		// even though MondainMap::draw() redraws the player as its own
+		// overlay each frame regardless of what's in the map data
+		writeString("%s\n", Data::DIRECTION_NAMES[dir]);
+
+		_G(map)[sg._locationPosition.y][sg._locationPosition.x] = 0;
+		sg._locationPosition = Common::Point(newX, newY);
+		_G(map)[newY][newX] = Data::MTILE_PLAYER;
+		playFX(4);
+
+	} else if (moveResult == 1) {
+		// The time machine - can't be reached this way
+		writeString("Blocked!\n");
+		playFX(0);
+
+	} else {
+		// Bumped into a wall, a gem, a bat, Mondain himself, or the edge of
+		// the room - all of them burn the player a little
+		playFX(0);
+
+		int damage = sg._hits / 10;
+		if (damage == 0)
+			damage = 1;
+
+		writeString("Burned! ");
+		writeString("%d damage!\n", damage);
+		playFX(2);
+
+		sg._hits -= damage;
+		redrawStats();
+	}
+
+	if (isAdjacentToMondain() && sg._mondainHitAnimFrame == 0) {
+		sg._mondainHitAnimFrame = 1;
+		sg._mondainCombatFlag = 1;
+	}
+
 	return true;
 }
 
+bool MondainLogic::isAdjacentToMondain() const {
+	const Common::Point &pos = _G(savegame)._locationPosition;
+	const Common::Point &mondainPos = _G(savegame)._mondainPos;
+
+	int dx = ABS(pos.x - mondainPos.x);
+	int dy = ABS(pos.y - mondainPos.y);
+	return dx <= 1 && dy <= 1 && (dx != 0 || dy != 0);
+}
+
 void MondainLogic::updateCreatures() {
 	// TODO
 }
diff --git a/engines/ultima/ultima1/logic/mondain_logic.h b/engines/ultima/ultima1/logic/mondain_logic.h
index f30224b17d6..8953599d9c3 100644
--- a/engines/ultima/ultima1/logic/mondain_logic.h
+++ b/engines/ultima/ultima1/logic/mondain_logic.h
@@ -30,6 +30,13 @@ namespace Ultima1 {
 namespace Logic {
 
 class MondainLogic : public Logic {
+private:
+	/**
+	 * Returns true if Mondain is standing in any of the 8 cells surrounding
+	 * the player's current position
+	 */
+	bool isAdjacentToMondain() const;
+
 protected:
 	bool move(Data::Direction dir) override;
 


Commit: 0e95587e6a9d99b6d3e423b452d8574b65a7499b
    https://github.com/scummvm/scummvm/commit/0e95587e6a9d99b6d3e423b452d8574b65a7499b
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:40:51+11:00

Commit Message:
ULTIMA: ULTIMA1: Mondain animation

Changed paths:
    engines/ultima/ultima1/data/savegame.cpp
    engines/ultima/ultima1/data/savegame.h
    engines/ultima/ultima1/logic/mondain_logic.cpp
    engines/ultima/ultima1/logic/mondain_logic.h
    engines/ultima/ultima1/views/mondain_map.cpp


diff --git a/engines/ultima/ultima1/data/savegame.cpp b/engines/ultima/ultima1/data/savegame.cpp
index 97df00ffdc9..67a801ecf8f 100644
--- a/engines/ultima/ultima1/data/savegame.cpp
+++ b/engines/ultima/ultima1/data/savegame.cpp
@@ -110,7 +110,10 @@ void Savegame::synchronizeExtra(Common::Serializer &s) {
 		s.syncAsSint16LE(_mondainPos.y);
 		s.syncAsByte(_gemDestroyedFlag);
 		s.syncAsSint16LE(_mondainHitAnimFrame);
+		s.syncAsSint16LE(_mondainHitAnimDir);
 		s.syncAsSint16LE(_mondainCombatFlag);
+		s.syncAsSint16LE(_mondainPhase);
+		s.syncAsSint16LE(_mondainPhaseAnimOffset);
 	}
 }
 
diff --git a/engines/ultima/ultima1/data/savegame.h b/engines/ultima/ultima1/data/savegame.h
index edf9c6f50c5..f7ae6667962 100644
--- a/engines/ultima/ultima1/data/savegame.h
+++ b/engines/ultima/ultima1/data/savegame.h
@@ -132,9 +132,18 @@ public:
 	// Set to 1 when the player first steps next to Mondain, then counts up
 	// frame by frame to drive his hit-reaction animation
 	int16 _mondainHitAnimFrame = 0;
+	// +1/-1 step direction _mondainHitAnimFrame currently bounces by,
+	// between 1 and 4
+	int16 _mondainHitAnimDir = 0;
 	// Set once combat with Mondain has been triggered (the player got
 	// adjacent to him for the first time)
 	int16 _mondainCombatFlag = 0;
+	// Which of Mondain's story-driven forms/poses is currently shown - a
+	// tile Id offset added to _mondainPhaseAnimOffset
+	int16 _mondainPhase = 2;
+	// Small cycling offset added to _mondainPhase to animate his current
+	// pose - what it cycles through depends on the current phase
+	int16 _mondainPhaseAnimOffset = 0;
 
 	/**
 	 * Synchronize savegame data
diff --git a/engines/ultima/ultima1/logic/mondain_logic.cpp b/engines/ultima/ultima1/logic/mondain_logic.cpp
index b67971527e3..c6138c819bd 100644
--- a/engines/ultima/ultima1/logic/mondain_logic.cpp
+++ b/engines/ultima/ultima1/logic/mondain_logic.cpp
@@ -93,12 +93,43 @@ bool MondainLogic::move(Data::Direction dir) {
 
 	if (isAdjacentToMondain() && sg._mondainHitAnimFrame == 0) {
 		sg._mondainHitAnimFrame = 1;
+		sg._mondainHitAnimDir = 1;
 		sg._mondainCombatFlag = 1;
 	}
 
 	return true;
 }
 
+void MondainLogic::tick() {
+	// Only advance the animations once every 4 frames
+	if (++_tickCounter < 4)
+		return;
+	_tickCounter = 0;
+
+	Data::Savegame &sg = _G(savegame);
+
+	// Bounce the hit-reaction frame back and forth between 1 and 4
+	if (sg._mondainHitAnimFrame != 0) {
+		sg._mondainHitAnimFrame += sg._mondainHitAnimDir;
+
+		if (sg._mondainHitAnimFrame == 1)
+			sg._mondainHitAnimDir = 1;
+		else if (sg._mondainHitAnimFrame > 4)
+			sg._mondainHitAnimDir = -1;
+	}
+
+	// Cycle the idle pose animation - what it does depends on which of
+	// Mondain's story-driven phases is currently active
+	if (sg._mondainPhase == 2) {
+		sg._mondainPhaseAnimOffset = (getRandomNumber(1, 200) < 100) ? 1 : 0;
+	} else if (sg._mondainPhase == 11) {
+		if (sg._mondainPhaseAnimOffset == 2)
+			sg._mondainPhaseAnimOffset = 0;
+		else
+			++sg._mondainPhaseAnimOffset;
+	}
+}
+
 bool MondainLogic::isAdjacentToMondain() const {
 	const Common::Point &pos = _G(savegame)._locationPosition;
 	const Common::Point &mondainPos = _G(savegame)._mondainPos;
diff --git a/engines/ultima/ultima1/logic/mondain_logic.h b/engines/ultima/ultima1/logic/mondain_logic.h
index 8953599d9c3..0b23b8c1a55 100644
--- a/engines/ultima/ultima1/logic/mondain_logic.h
+++ b/engines/ultima/ultima1/logic/mondain_logic.h
@@ -31,6 +31,11 @@ namespace Logic {
 
 class MondainLogic : public Logic {
 private:
+	// tick() is called once per game frame, but the original only advanced
+	// Mondain's animations once every few frames - this counts frames
+	// between updates
+	int _tickCounter = 0;
+
 	/**
 	 * Returns true if Mondain is standing in any of the 8 cells surrounding
 	 * the player's current position
@@ -57,6 +62,12 @@ public:
 	}
 
 	void entering() override;
+
+	/**
+	 * Called once per game frame - advances Mondain's hit-reaction and
+	 * idle-pose animations
+	 */
+	void tick() override;
 };
 
 } // namespace Logic
diff --git a/engines/ultima/ultima1/views/mondain_map.cpp b/engines/ultima/ultima1/views/mondain_map.cpp
index 4d6ba028ba6..0ed768c10dc 100644
--- a/engines/ultima/ultima1/views/mondain_map.cpp
+++ b/engines/ultima/ultima1/views/mondain_map.cpp
@@ -76,6 +76,19 @@ void MondainMap::draw() {
 	}
 #endif
 
+	// Draw Mondain himself - his current pose, plus (while he's reacting to
+	// a hit) a small flash effect just to the left of him
+	const auto &sg = _G(savegame);
+	const auto &mondainPos = sg._mondainPos;
+
+	if (sg._mondainHitAnimFrame != 0) {
+		const Graphics::ManagedSurface &hitTileImg = tiles[sg._mondainHitAnimFrame + 5];
+		s.blitFrom(hitTileImg, Common::Point((mondainPos.x - 1) * TILE_WIDTH + 8, mondainPos.y * TILE_HEIGHT + 8));
+	}
+
+	const Graphics::ManagedSurface &mondainTileImg = tiles[sg._mondainPhase + sg._mondainPhaseAnimOffset];
+	s.blitFrom(mondainTileImg, Common::Point(mondainPos.x * TILE_WIDTH + 8, mondainPos.y * TILE_HEIGHT + 8));
+
 	// Draw the player
 	const Graphics::ManagedSurface &tileImg = tiles[Data::MTILE_PLAYER];
 	s.blitFrom(tileImg, Common::Point(pos.x * TILE_WIDTH + 8, pos.y * TILE_HEIGHT + 8));


Commit: 50c9b079c9cbf95169e18430560b65980d9ce318
    https://github.com/scummvm/scummvm/commit/50c9b079c9cbf95169e18430560b65980d9ce318
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:40:51+11:00

Commit Message:
ULTIMA: ULTIMA1: Split a new Map base class from Dialog

Changed paths:
  A engines/ultima/ultima1/views/map.cpp
  A engines/ultima/ultima1/views/map.h
    engines/ultima/module.mk
    engines/ultima/ultima1/logic/logic.cpp
    engines/ultima/ultima1/ultima1.cpp
    engines/ultima/ultima1/ultima1.h
    engines/ultima/ultima1/views/dialog.cpp
    engines/ultima/ultima1/views/dialog.h
    engines/ultima/ultima1/views/dungeon_map.cpp
    engines/ultima/ultima1/views/dungeon_map.h
    engines/ultima/ultima1/views/location_map.cpp
    engines/ultima/ultima1/views/location_map.h
    engines/ultima/ultima1/views/mondain_map.cpp
    engines/ultima/ultima1/views/mondain_map.h
    engines/ultima/ultima1/views/overworld_map.cpp
    engines/ultima/ultima1/views/overworld_map.h
    engines/ultima/ultima1/views/space_map.cpp
    engines/ultima/ultima1/views/space_map.h


diff --git a/engines/ultima/module.mk b/engines/ultima/module.mk
index a40deb96c75..81a410e4a82 100644
--- a/engines/ultima/module.mk
+++ b/engines/ultima/module.mk
@@ -89,6 +89,7 @@ MODULE_OBJS += \
 	ultima1/views/game.o \
 	ultima1/views/location_map.o \
 	ultima1/views/main_menu.o \
+	ultima1/views/map.o \
 	ultima1/views/mondain_map.o \
 	ultima1/views/overworld.o \
 	ultima1/views/overworld_map.o \
diff --git a/engines/ultima/ultima1/logic/logic.cpp b/engines/ultima/ultima1/logic/logic.cpp
index 60b7d7c7d01..26ecddb2469 100644
--- a/engines/ultima/ultima1/logic/logic.cpp
+++ b/engines/ultima/ultima1/logic/logic.cpp
@@ -188,6 +188,7 @@ void Logic::action(int action) {
 void Logic::keypress(Common::KeyCode keycode) {
 	writeString("Huh?\n");
 	endOfTurn();
+	prompt();
 }
 
 bool Logic::attack(Data::Direction dir) {
diff --git a/engines/ultima/ultima1/ultima1.cpp b/engines/ultima/ultima1/ultima1.cpp
index 288bb4765c3..541b1316a4c 100644
--- a/engines/ultima/ultima1/ultima1.cpp
+++ b/engines/ultima/ultima1/ultima1.cpp
@@ -29,6 +29,7 @@
 #include "ultima/ultima1/ultima1.h"
 #include "ultima/ultima1/console.h"
 #include "ultima/ultima1/views/views.h"
+#include "ultima/ultima1/views/map.h"
 #include "ultima/ultima1/metaengine.h"
 
 namespace Ultima {
@@ -73,6 +74,11 @@ Common::Error Ultima1Engine::run() {
 	return Common::kNoError;
 }
 
+bool Ultima1Engine::canSaveGameStateCurrently(Common::U32String *msg) {
+	// Only allow saving when any of the different map views are active
+	return dynamic_cast<Views::Map *>(focusedView()) != nullptr;
+}
+
 Common::Error Ultima1Engine::syncGame(Common::Serializer &s) {
 	_savegame.synchronize(s);
 
diff --git a/engines/ultima/ultima1/ultima1.h b/engines/ultima/ultima1/ultima1.h
index 870674a31fa..0e9a1d60437 100644
--- a/engines/ultima/ultima1/ultima1.h
+++ b/engines/ultima/ultima1/ultima1.h
@@ -94,9 +94,7 @@ public:
 	bool canLoadGameStateCurrently(Common::U32String *msg = nullptr) override {
 		return true;
 	}
-	bool canSaveGameStateCurrently(Common::U32String *msg = nullptr) override {
-		return true;
-	}
+	bool canSaveGameStateCurrently(Common::U32String *msg = nullptr) override;
 
 	/**
 	 * Uses a serializer to allow implementing savegame
diff --git a/engines/ultima/ultima1/views/dialog.cpp b/engines/ultima/ultima1/views/dialog.cpp
index a6325176449..97e7a9a41f5 100644
--- a/engines/ultima/ultima1/views/dialog.cpp
+++ b/engines/ultima/ultima1/views/dialog.cpp
@@ -70,22 +70,9 @@ void Dialog::draw() {
 
 bool Dialog::tick() {
 	g_engine->findView("Game")->tick();
-	if (_G(logic))
-		_G(logic)->tick();
-
 	return Shared::Gfx::View::tick();
 }
 
-bool Dialog::msgAction(const ActionMessage &msg) {
-	g_engine->_logic->action(msg._action);
-	return true;
-}
-
-bool Dialog::msgKeypress(const KeypressMessage &msg) {
-	g_engine->_logic->keypress(msg.keycode);
-	return true;
-}
-
 } // namespace Views
 } // namespace Ultima1
 } // namespace Ultima
diff --git a/engines/ultima/ultima1/views/dialog.h b/engines/ultima/ultima1/views/dialog.h
index 13ddd4defc3..bee72a9fb5a 100644
--- a/engines/ultima/ultima1/views/dialog.h
+++ b/engines/ultima/ultima1/views/dialog.h
@@ -23,14 +23,11 @@
 #define ULTIMA1_VIEWS_DIALOG_H
 
 #include "ultima/shared/gfx/view.h"
-#include "ultima/shared/engine/messages.h"
 
 namespace Ultima {
 namespace Ultima1 {
 namespace Views {
 
-using namespace Shared::Messages;
-
 /**
  * Base class for views that appear on the top hand of the screen, such as the maps, dungeon, etc.
  */
@@ -44,13 +41,7 @@ public:
 	 */
 	void draw() override;
 
-	/**
-	 * Called for game frame ticks
-	 */
 	bool tick() override;
-
-	bool msgAction(const ActionMessage &msg) override;
-	bool msgKeypress(const KeypressMessage &msg) override;
 };
 
 } // namespace Views
diff --git a/engines/ultima/ultima1/views/dungeon_map.cpp b/engines/ultima/ultima1/views/dungeon_map.cpp
index ab41a2da280..251c9861529 100644
--- a/engines/ultima/ultima1/views/dungeon_map.cpp
+++ b/engines/ultima/ultima1/views/dungeon_map.cpp
@@ -101,16 +101,16 @@ static const uint8 COFFIN_DRAW_DATA[] = {
 
 bool DungeonMap::msgFocus(const FocusMessage &msg) {
 	MetaEngine::setKeybindingMode(KBMODE_GAMEPLAY);
-	return Dialog::msgFocus(msg);
+	return Map::msgFocus(msg);
 }
 
 bool DungeonMap::msgUnfocus(const UnfocusMessage &msg) {
 	MetaEngine::setKeybindingMode(KBMODE_MINIMAL);
-	return Dialog::msgUnfocus(msg);
+	return Map::msgUnfocus(msg);
 }
 
 void DungeonMap::draw() {
-	Dialog::draw();
+	Map::draw();
 	auto s = getSurface();
 
 	// Write title showing the dungeon level
diff --git a/engines/ultima/ultima1/views/dungeon_map.h b/engines/ultima/ultima1/views/dungeon_map.h
index bdcfc02fb53..62c7ca5fcd0 100644
--- a/engines/ultima/ultima1/views/dungeon_map.h
+++ b/engines/ultima/ultima1/views/dungeon_map.h
@@ -22,7 +22,7 @@
 #ifndef ULTIMA1_VIEWS_DUNGEON_MAP_H
 #define ULTIMA1_VIEWS_DUNGEON_MAP_H
 
-#include "ultima/ultima1/views/dialog.h"
+#include "ultima/ultima1/views/map.h"
 #include "ultima/ultima1/data/map.h"
 #include "ultima/ultima1/data/map_dungeon.h"
 
@@ -32,7 +32,7 @@ namespace Views {
 
 using namespace Shared::Messages;
 
-class DungeonMap : public Dialog {
+class DungeonMap : public Map {
 private:
 	/**
 	 * Returns the cell at a given position, or a solid wall cell if the
@@ -171,7 +171,7 @@ private:
 	void drawDungeonView();
 
 public:
-	DungeonMap() : Dialog("DungeonMap") {}
+	DungeonMap() : Map("DungeonMap") {}
 	~DungeonMap() override {}
 
 	bool msgFocus(const FocusMessage &msg) override;
diff --git a/engines/ultima/ultima1/views/location_map.cpp b/engines/ultima/ultima1/views/location_map.cpp
index 8f3d4197fcf..48837e05a8a 100644
--- a/engines/ultima/ultima1/views/location_map.cpp
+++ b/engines/ultima/ultima1/views/location_map.cpp
@@ -36,12 +36,12 @@ constexpr int ATTACK_TILE_DELAY = 100;	// Delay after flashing an attack tile
 bool LocationMap::msgFocus(const FocusMessage &msg) {
 	MetaEngine::setKeybindingMode(KBMODE_GAMEPLAY);
 	delayFrames(1);
-	return UIElement::msgFocus(msg);
+	return Map::msgFocus(msg);
 }
 
 bool LocationMap::msgUnfocus(const UnfocusMessage &msg) {
 	MetaEngine::setKeybindingMode(KBMODE_MINIMAL);
-	return Dialog::msgUnfocus(msg);
+	return Map::msgUnfocus(msg);
 }
 
 bool LocationMap::msgAttackTile(const AttackTileMessage &msg) {
@@ -73,7 +73,7 @@ void LocationMap::draw() {
 	auto s = getSurface();
 	const auto &pos = _G(savegame)._locationPosition;
 
-	Dialog::draw();
+	Map::draw();
 
 	// Draw the visible map contents
 	for (int oy = 0; oy < MAP_VISIBLE_HEIGHT; oy++) {
diff --git a/engines/ultima/ultima1/views/location_map.h b/engines/ultima/ultima1/views/location_map.h
index bcdd089a7b5..eec64d48ab8 100644
--- a/engines/ultima/ultima1/views/location_map.h
+++ b/engines/ultima/ultima1/views/location_map.h
@@ -22,7 +22,7 @@
 #ifndef ULTIMA2_VIEWS_LOCATION_MAP_H
 #define ULTIMA2_VIEWS_LOCATION_MAP_H
 
-#include "ultima/ultima1/views/dialog.h"
+#include "ultima/ultima1/views/map.h"
 
 namespace Ultima {
 namespace Ultima1 {
@@ -30,9 +30,9 @@ namespace Views {
 
 using namespace Shared::Messages;
 
-class LocationMap : public Dialog {
+class LocationMap : public Map {
 public:
-	LocationMap() : Dialog("LocationMap") {}
+	LocationMap() : Map("LocationMap") {}
 	~LocationMap() override {}
 
 	bool msgFocus(const FocusMessage &msg) override;
diff --git a/engines/ultima/ultima1/views/map.cpp b/engines/ultima/ultima1/views/map.cpp
new file mode 100644
index 00000000000..8be21411766
--- /dev/null
+++ b/engines/ultima/ultima1/views/map.cpp
@@ -0,0 +1,67 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "ultima/ultima1/views/map.h"
+#include "ultima/ultima1/ultima1.h"
+#include "ultima/ultima1/metaengine.h"
+
+namespace Ultima {
+namespace Ultima1 {
+namespace Views {
+
+constexpr int PASS_TIMEOUT = 4 * 60 * FRAME_RATE;
+
+Map::Map(const Common::String &name) : Dialog(name) {
+}
+
+bool Map::msgFocus(const FocusMessage &msg) {
+	_passCtr = 0;
+	return Dialog::msgFocus(msg);
+}
+
+bool Map::msgAction(const ActionMessage &msg) {
+	_passCtr = 0;
+	g_engine->_logic->action(msg._action);
+	return true;
+}
+
+bool Map::msgKeypress(const KeypressMessage &msg) {
+	_passCtr = 0;
+	g_engine->_logic->keypress(msg.keycode);
+	return true;
+}
+
+bool Map::tick() {
+	if (++_passCtr >= PASS_TIMEOUT) {
+		_passCtr = 0;
+		msgAction(ActionMessage(KEYBIND_PASS));
+	}
+
+	if (_G(logic))
+		_G(logic)->tick();
+
+	return Dialog::tick();
+}
+
+
+} // namespace Views
+} // namespace Ultima1
+} // namespace Ultima
diff --git a/engines/ultima/ultima1/views/map.h b/engines/ultima/ultima1/views/map.h
new file mode 100644
index 00000000000..847e8e61456
--- /dev/null
+++ b/engines/ultima/ultima1/views/map.h
@@ -0,0 +1,58 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef ULTIMA1_VIEWS_MAP_H
+#define ULTIMA1_VIEWS_MAP_H
+
+#include "ultima/ultima1/views/dialog.h"
+#include "ultima/shared/engine/messages.h"
+
+namespace Ultima {
+namespace Ultima1 {
+namespace Views {
+
+using namespace Shared::Messages;
+
+/**
+ * Base class for map views
+ */
+class Map : public Dialog {
+private:
+	int _passCtr = 0;
+public:
+	Map(const Common::String &name);
+	~Map() override {}
+
+	bool msgFocus(const FocusMessage &msg) override;
+	bool msgAction(const ActionMessage &msg) override;
+	bool msgKeypress(const KeypressMessage &msg) override;
+
+	/**
+	 * Called for game frame ticks
+	 */
+	bool tick() override;
+};
+
+} // namespace Views
+} // namespace Ultima1
+} // namespace Ultima
+
+#endif
diff --git a/engines/ultima/ultima1/views/mondain_map.cpp b/engines/ultima/ultima1/views/mondain_map.cpp
index 0ed768c10dc..8f82208f79e 100644
--- a/engines/ultima/ultima1/views/mondain_map.cpp
+++ b/engines/ultima/ultima1/views/mondain_map.cpp
@@ -35,17 +35,17 @@ constexpr int ATTACK_TILE_DELAY = 100;	// Delay after flashing an attack tile
 bool MondainMap::msgFocus(const FocusMessage &msg) {
 	MetaEngine::setKeybindingMode(KBMODE_GAMEPLAY);
 	delayFrames(1);
-	return UIElement::msgFocus(msg);
+	return Map::msgFocus(msg);
 }
 
 bool MondainMap::msgUnfocus(const UnfocusMessage &msg) {
 	MetaEngine::setKeybindingMode(KBMODE_MINIMAL);
-	return Dialog::msgUnfocus(msg);
+	return Map::msgUnfocus(msg);
 }
 
 bool MondainMap::tick() {
 	redraw();
-	return Dialog::tick();
+	return Map::tick();
 }
 
 void MondainMap::draw() {
@@ -54,7 +54,7 @@ void MondainMap::draw() {
 	auto s = getSurface();
 	const auto &pos = _G(savegame)._locationPosition;
 
-	Dialog::draw();
+	Map::draw();
 
 	// Draw the visible map contents
 	for (int oy = 0; oy < Data::MONDAIN_HEIGHT; oy++) {
diff --git a/engines/ultima/ultima1/views/mondain_map.h b/engines/ultima/ultima1/views/mondain_map.h
index 950738f8b0c..585e7acfdfa 100644
--- a/engines/ultima/ultima1/views/mondain_map.h
+++ b/engines/ultima/ultima1/views/mondain_map.h
@@ -22,7 +22,7 @@
 #ifndef ULTIMA1_VIEWS_MONDAIN_MAP_H
 #define ULTIMA1_VIEWS_MONDAIN_MAP_H
 
-#include "ultima/ultima1/views/dialog.h"
+#include "ultima/ultima1/views/map.h"
 #include "ultima/ultima1/data/map.h"
 
 namespace Ultima {
@@ -31,9 +31,9 @@ namespace Views {
 
 using namespace Shared::Messages;
 
-class MondainMap : public Dialog {
+class MondainMap : public Map {
 public:
-	MondainMap() : Dialog("MondainMap") {}
+	MondainMap() : Map("MondainMap") {}
 	~MondainMap() override {}
 
 	bool msgFocus(const FocusMessage &msg) override;
diff --git a/engines/ultima/ultima1/views/overworld_map.cpp b/engines/ultima/ultima1/views/overworld_map.cpp
index ebd50981940..41e4416330b 100644
--- a/engines/ultima/ultima1/views/overworld_map.cpp
+++ b/engines/ultima/ultima1/views/overworld_map.cpp
@@ -34,12 +34,12 @@ constexpr int ATTACK_TILE_DELAY = 100;	// Delay after flashing an attack tile
 bool OverworldMap::msgFocus(const FocusMessage &msg) {
 	MetaEngine::setKeybindingMode(KBMODE_GAMEPLAY);
 	delayFrames(1);
-	return Dialog::msgFocus(msg);
+	return Map::msgFocus(msg);
 }
 
 bool OverworldMap::msgUnfocus(const UnfocusMessage &msg) {
 	MetaEngine::setKeybindingMode(KBMODE_MINIMAL);
-	return Dialog::msgUnfocus(msg);
+	return Map::msgUnfocus(msg);
 }
 
 bool OverworldMap::msgAttackTile(const AttackTileMessage &msg) {
@@ -101,7 +101,7 @@ int OverworldMap::animatedTileId(byte tileId) const {
 }
 
 void OverworldMap::draw() {
-	Dialog::draw();
+	Map::draw();
 
 	auto &map = g_engine->_map;
 	const Graphics::ManagedSurface *tiles = map.tiles();
diff --git a/engines/ultima/ultima1/views/overworld_map.h b/engines/ultima/ultima1/views/overworld_map.h
index cbeec6a2206..71dee70f6f3 100644
--- a/engines/ultima/ultima1/views/overworld_map.h
+++ b/engines/ultima/ultima1/views/overworld_map.h
@@ -22,7 +22,7 @@
 #ifndef ULTIMA1_VIEWS_OVERWORLD_MAP_H
 #define ULTIMA1_VIEWS_OVERWORLD_MAP_H
 
-#include "ultima/ultima1/views/dialog.h"
+#include "ultima/ultima1/views/map.h"
 #include "ultima/ultima1/data/map.h"
 
 namespace Ultima {
@@ -31,7 +31,7 @@ namespace Views {
 
 using namespace Shared::Messages;
 
-class OverworldMap : public Dialog {
+class OverworldMap : public Map {
 private:
 	typedef byte VisibleTiles[Data::OVERWORLD_VISIBLE_HEIGHT][Data::OVERWORLD_VISIBLE_WIDTH];
 	VisibleTiles _mapTilesId = {};		// Calculated visible on-screen tiles
@@ -55,7 +55,7 @@ private:
 	int animatedTileId(byte tileId) const;
 
 public:
-	OverworldMap() : Dialog("OverworldMap") {}
+	OverworldMap() : Map("OverworldMap") {}
 	~OverworldMap() override {}
 
 	bool msgFocus(const FocusMessage &msg) override;
diff --git a/engines/ultima/ultima1/views/space_map.cpp b/engines/ultima/ultima1/views/space_map.cpp
index 223bac608bf..aaa7ca9b079 100644
--- a/engines/ultima/ultima1/views/space_map.cpp
+++ b/engines/ultima/ultima1/views/space_map.cpp
@@ -29,16 +29,16 @@ namespace Views {
 
 bool SpaceMap::msgFocus(const FocusMessage &msg) {
 	MetaEngine::setKeybindingMode(KBMODE_GAMEPLAY);
-	return Dialog::msgFocus(msg);
+	return Map::msgFocus(msg);
 }
 
 bool SpaceMap::msgUnfocus(const UnfocusMessage &msg) {
 	MetaEngine::setKeybindingMode(KBMODE_MINIMAL);
-	return Dialog::msgUnfocus(msg);
+	return Map::msgUnfocus(msg);
 }
 
 void SpaceMap::draw() {
-	Dialog::draw();
+	Map::draw();
 
 	// TODO
 }
diff --git a/engines/ultima/ultima1/views/space_map.h b/engines/ultima/ultima1/views/space_map.h
index 3e2a87cb5d8..56e59bc54ca 100644
--- a/engines/ultima/ultima1/views/space_map.h
+++ b/engines/ultima/ultima1/views/space_map.h
@@ -22,7 +22,7 @@
 #ifndef ULTIMA1_VIEWS_SPACE_MAP_H
 #define ULTIMA1_VIEWS_SPACE_MAP_H
 
-#include "ultima/ultima1/views/dialog.h"
+#include "ultima/ultima1/views/map.h"
 #include "ultima/ultima1/data/map.h"
 
 namespace Ultima {
@@ -31,9 +31,9 @@ namespace Views {
 
 using namespace Shared::Messages;
 
-class SpaceMap : public Dialog {
+class SpaceMap : public Map {
 public:
-	SpaceMap() : Dialog("SpaceMap") {}
+	SpaceMap() : Map("SpaceMap") {}
 	~SpaceMap() override {}
 
 	bool msgFocus(const FocusMessage &msg) override;


Commit: 1b60b08d0ac0b9d7595e891a46a253919b5f2b08
    https://github.com/scummvm/scummvm/commit/1b60b08d0ac0b9d7595e891a46a253919b5f2b08
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:40:51+11:00

Commit Message:
ULTIMA: ULTIMA1: Mondain gem get action

Changed paths:
    engines/ultima/ultima1/data/savegame.cpp
    engines/ultima/ultima1/data/savegame.h
    engines/ultima/ultima1/logic/mondain_logic.cpp


diff --git a/engines/ultima/ultima1/data/savegame.cpp b/engines/ultima/ultima1/data/savegame.cpp
index 67a801ecf8f..7c3448d103e 100644
--- a/engines/ultima/ultima1/data/savegame.cpp
+++ b/engines/ultima/ultima1/data/savegame.cpp
@@ -114,6 +114,8 @@ void Savegame::synchronizeExtra(Common::Serializer &s) {
 		s.syncAsSint16LE(_mondainCombatFlag);
 		s.syncAsSint16LE(_mondainPhase);
 		s.syncAsSint16LE(_mondainPhaseAnimOffset);
+		s.syncAsSint16LE(_mondainPhaseTimer);
+		s.syncAsSint16LE(_mondainDefeatedFlag);
 	}
 }
 
diff --git a/engines/ultima/ultima1/data/savegame.h b/engines/ultima/ultima1/data/savegame.h
index f7ae6667962..3c32ead23b0 100644
--- a/engines/ultima/ultima1/data/savegame.h
+++ b/engines/ultima/ultima1/data/savegame.h
@@ -144,6 +144,11 @@ public:
 	// Small cycling offset added to _mondainPhase to animate his current
 	// pose - what it cycles through depends on the current phase
 	int16 _mondainPhaseAnimOffset = 0;
+	// Drives Mondain's story-driven phase transitions (not yet ported) -
+	// destroying the gem while it happens to read 30 defeats him outright
+	int16 _mondainPhaseTimer = 20;
+	// Set once Mondain has been finally defeated
+	int16 _mondainDefeatedFlag = 0;
 
 	/**
 	 * Synchronize savegame data
diff --git a/engines/ultima/ultima1/logic/mondain_logic.cpp b/engines/ultima/ultima1/logic/mondain_logic.cpp
index c6138c819bd..7653011f042 100644
--- a/engines/ultima/ultima1/logic/mondain_logic.cpp
+++ b/engines/ultima/ultima1/logic/mondain_logic.cpp
@@ -144,6 +144,36 @@ void MondainLogic::updateCreatures() {
 }
 
 bool MondainLogic::get() {
+	Data::Savegame &sg = _G(savegame);
+	writeString("Get (Gem)");
+
+	if (sg._gemDestroyedFlag || !isAdjacentToMondain()) {
+		writeString("..'tis nothing here!\n");
+		playFX(1);
+		return true;
+	}
+
+	// Destroy the gem - it can only be done once, adjacent to Mondain
+	sg._mondainCombatFlag = 1;
+	sg._gemDestroyedFlag = true;
+	sg._mondainHitAnimFrame = 0;
+
+	int damage = sg._hits * 3 / 4;
+
+	writeString("... ");
+	writeString("%d damage!\n", damage);
+
+	for (int i = 0; i < 5; ++i)
+		playFX(2);
+
+	writeString("The Gem is DESTROYED!\n");
+
+	sg._hits -= damage;
+	redrawStats();
+
+	if (sg._mondainPhaseTimer == 30)
+		sg._mondainDefeatedFlag = 1;
+
 	return true;
 }
 


Commit: 3a6c221bb8f94e79a81dbc20f213bb081e7265dd
    https://github.com/scummvm/scummvm/commit/3a6c221bb8f94e79a81dbc20f213bb081e7265dd
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:40:51+11:00

Commit Message:
ULTIMA: ULTIMA1: Implementing attack command in Mondain map

Changed paths:
    engines/ultima/ultima1/data/savegame.cpp
    engines/ultima/ultima1/data/savegame.h
    engines/ultima/ultima1/logic/logic.cpp
    engines/ultima/ultima1/logic/logic.h
    engines/ultima/ultima1/logic/mondain_logic.cpp
    engines/ultima/ultima1/logic/mondain_logic.h


diff --git a/engines/ultima/ultima1/data/savegame.cpp b/engines/ultima/ultima1/data/savegame.cpp
index 7c3448d103e..377b1def59f 100644
--- a/engines/ultima/ultima1/data/savegame.cpp
+++ b/engines/ultima/ultima1/data/savegame.cpp
@@ -116,6 +116,7 @@ void Savegame::synchronizeExtra(Common::Serializer &s) {
 		s.syncAsSint16LE(_mondainPhaseAnimOffset);
 		s.syncAsSint16LE(_mondainPhaseTimer);
 		s.syncAsSint16LE(_mondainDefeatedFlag);
+		s.syncAsSint16LE(_mondainHits);
 	}
 }
 
diff --git a/engines/ultima/ultima1/data/savegame.h b/engines/ultima/ultima1/data/savegame.h
index 3c32ead23b0..9f5f30eeef0 100644
--- a/engines/ultima/ultima1/data/savegame.h
+++ b/engines/ultima/ultima1/data/savegame.h
@@ -149,6 +149,8 @@ public:
 	int16 _mondainPhaseTimer = 20;
 	// Set once Mondain has been finally defeated
 	int16 _mondainDefeatedFlag = 0;
+	// Mondain's own hit points
+	int16 _mondainHits = 1000;
 
 	/**
 	 * Synchronize savegame data
diff --git a/engines/ultima/ultima1/logic/logic.cpp b/engines/ultima/ultima1/logic/logic.cpp
index 26ecddb2469..4c6ffaecae0 100644
--- a/engines/ultima/ultima1/logic/logic.cpp
+++ b/engines/ultima/ultima1/logic/logic.cpp
@@ -359,7 +359,7 @@ void Logic::combatDir(Data::Direction direction, int effect) {
 		// Attacking with the readied weapon
 		maxDistance = Data::WEAPONS_DISTANCE[sg._equippedWeapon];
 		hitChance = sg._agility + 50;
-		strike = getRandomNumber(2, sg._equippedWeapon * 8 + sg._strength);
+		strike = getRandomNumber(2, sg._equippedWeapon * _weaponDamageScale + sg._strength);
 	} else {
 		// Firing a frigate's cannons/aircar's lasers
 		maxDistance = 3;
diff --git a/engines/ultima/ultima1/logic/logic.h b/engines/ultima/ultima1/logic/logic.h
index 50464420a01..66140270215 100644
--- a/engines/ultima/ultima1/logic/logic.h
+++ b/engines/ultima/ultima1/logic/logic.h
@@ -43,6 +43,12 @@ private:
 	void combatDir(Data::Direction direction, int effect);
 
 protected:
+	// Per-point-of-strength/readied-item scaling factor used by combatDir's
+	// weapon-attack strike roll - 8 for the main game, but MondainLogic
+	// overrides it to 3 to match the Mondain encounter's own weaker curve
+	int _weaponDamageScale = 8;
+
+
 	/**
 	 * Dispatches some text to be shown in the Commands window
 	 */
diff --git a/engines/ultima/ultima1/logic/mondain_logic.cpp b/engines/ultima/ultima1/logic/mondain_logic.cpp
index 7653011f042..78a6472c38b 100644
--- a/engines/ultima/ultima1/logic/mondain_logic.cpp
+++ b/engines/ultima/ultima1/logic/mondain_logic.cpp
@@ -34,6 +34,10 @@ static const int8 DELTA_Y[5] = { 0, 0, 0, -1, 1 };
 
 MondainLogic::MondainLogic() {
 	_G(map)._mapType = Data::MAPTYPE_MONDAIN;
+
+	// The Mondain encounter's own cityCastleAttackDir uses a weaker per-
+	// point-of-strength scale (*3) than the main game's (*8)
+	_weaponDamageScale = 3;
 }
 
 void MondainLogic::entering() {
@@ -100,6 +104,39 @@ bool MondainLogic::move(Data::Direction dir) {
 	return true;
 }
 
+void MondainLogic::damage(Data::Direction dir, int effectNum, int maxDistance, int strike, int hitChance, int tileId) {
+	playFX(effectNum);
+
+	Data::Savegame &sg = _G(savegame);
+	int dx = DELTA_X[dir], dy = DELTA_Y[dir];
+	const Common::Point &pos = sg._locationPosition;
+
+	int scanX = pos.x, scanY = pos.y;
+	bool foundMondain = false;
+
+	for (int step = 1; step <= maxDistance; ++step) {
+		scanX = pos.x + dx * step;
+		scanY = pos.y + dy * step;
+
+		int tileVal = _G(map).getMapTile(scanX, scanY);
+		foundMondain = tileVal == 0 && scanX == sg._mondainPos.x && scanY == sg._mondainPos.y;
+
+		if (foundMondain || scanX <= 0 || scanY <= 0 ||
+				scanX >= Data::MONDAIN_WIDTH || scanY >= Data::MONDAIN_HEIGHT)
+			break;
+	}
+
+	if (!foundMondain || getRandomNumber(1, 100) > hitChance) {
+		writeString("Missed!\n");
+		return;
+	}
+
+	sg._mondainHits -= strike;
+	writeString("Hit Mondain! ");
+	writeString("%d damage!\n", strike);
+	playFX(2);
+}
+
 void MondainLogic::tick() {
 	// Only advance the animations once every 4 frames
 	if (++_tickCounter < 4)
diff --git a/engines/ultima/ultima1/logic/mondain_logic.h b/engines/ultima/ultima1/logic/mondain_logic.h
index 0b23b8c1a55..cd3a8318265 100644
--- a/engines/ultima/ultima1/logic/mondain_logic.h
+++ b/engines/ultima/ultima1/logic/mondain_logic.h
@@ -50,6 +50,14 @@ protected:
 	 */
 	void updateCreatures() override;
 
+	/**
+	 * Resolves a wand attack - scans up to maxDistance tiles in the given
+	 * direction for Mondain, then rolls to hit and applies damage. Unlike
+	 * the main game's damage(), there's no city/castle branch here at all -
+	 * this is the whole of the original's scanAndDamageAlongDirection
+	 */
+	void damage(Data::Direction dir, int effectNum, int maxDistance, int strike, int hitChance, int tileId) override;
+
 	bool get() override;
 	bool inform() override;
 	bool quit() override;


Commit: dc10c1937c0b957376443f36a7d97f75d4dbafb5
    https://github.com/scummvm/scummvm/commit/dc10c1937c0b957376443f36a7d97f75d4dbafb5
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:40:51+11:00

Commit Message:
ULTIMA: ULTIMA1: Mondain map spellcasting

Changed paths:
    engines/ultima/ultima1/logic/mondain_logic.cpp
    engines/ultima/ultima1/logic/mondain_logic.h


diff --git a/engines/ultima/ultima1/logic/mondain_logic.cpp b/engines/ultima/ultima1/logic/mondain_logic.cpp
index 78a6472c38b..ce831343360 100644
--- a/engines/ultima/ultima1/logic/mondain_logic.cpp
+++ b/engines/ultima/ultima1/logic/mondain_logic.cpp
@@ -137,6 +137,220 @@ void MondainLogic::damage(Data::Direction dir, int effectNum, int maxDistance, i
 	playFX(2);
 }
 
+bool MondainLogic::isWithinRange7() const {
+	const Common::Point &pos = _G(savegame)._locationPosition;
+	const Common::Point &mondainPos = _G(savegame)._mondainPos;
+	return ABS(pos.x - mondainPos.x) + ABS(pos.y - mondainPos.y) < 7;
+}
+
+bool MondainLogic::rollSpellSuccess() {
+	Data::Savegame &sg = _G(savegame);
+	return getRandomNumber(1, 249) < (sg._intelligence + 160) || sg._class == Data::CLASS_WIZARD;
+}
+
+int MondainLogic::getMagicWeaponPower() {
+	Data::Savegame &sg = _G(savegame);
+	int result = getRandomNumber(2, sg._intelligence);
+
+	if (sg._equippedWeapon == Data::WEAPON_WAND)
+		result *= 2;
+	else if (sg._equippedWeapon == Data::WEAPON_AMULET)
+		result = result * 3 / 2;
+	else if (sg._equippedWeapon == Data::WEAPON_STAFF || sg._equippedWeapon == Data::WEAPON_TRIANGLE)
+		result *= 3;
+
+	return result;
+}
+
+bool MondainLogic::castTeleport() {
+	writeString("\n");
+
+	if (!rollSpellSuccess())
+		return false;
+
+	Data::Savegame &sg = _G(savegame);
+	int newX = 0, newY = 0;
+	bool valid = false;
+
+	// The original retries with no attempt cap at all - bounded here for
+	// safety, matching the same defensive pattern used for the dungeon and
+	// overworld Blink spells
+	for (int attempt = 0; attempt < 500 && !valid; ++attempt) {
+		newX = getRandomNumber(1, 255) % Data::MONDAIN_WIDTH;
+		newY = getRandomNumber(1, 255) % Data::MONDAIN_HEIGHT;
+		valid = _G(map).getMapTile(newX, newY) == 0;
+	}
+
+	if (!valid)
+		return false;
+
+	_G(map)[sg._locationPosition.y][sg._locationPosition.x] = 0;
+	sg._locationPosition = Common::Point(newX, newY);
+	_G(map)[newY][newX] = Data::MTILE_PLAYER;
+
+	playFX(5);
+	writeString("Done.\n");
+	return true;
+}
+
+bool MondainLogic::castInterficioNunc() {
+	writeString("\n");
+
+	if (!rollSpellSuccess() || !isWithinRange7())
+		return false;
+
+	// The Kill spell doesn't work on Mondain at all - it backfires,
+	// doubling his remaining hit points instead (capped at 15000)
+	writeString("\"INTERFICIO-NUNC!\"\n");
+	writeString("The spell doth seem\n");
+	writeString("to make him stronger!\n");
+
+	Data::Savegame &sg = _G(savegame);
+	if (sg._mondainHits < 15000)
+		sg._mondainHits *= 2;
+
+	playFX(5);
+	return true;
+}
+
+bool MondainLogic::castPlaceBarrier(Data::Direction dir) {
+	if (dir == Data::DIR_UNSPECIFIED) {
+		writeString("nothing\n");
+		playFX(6);
+		return true;
+	}
+
+	writeString("%s\n", Data::DIRECTION_NAMES[dir]);
+	if (!rollSpellSuccess())
+		return false;
+
+	Data::Savegame &sg = _G(savegame);
+	int x = sg._locationPosition.x + DELTA_X[dir];
+	int y = sg._locationPosition.y + DELTA_Y[dir];
+
+	// Can't place a barrier on an occupied tile, or anywhere in line with
+	// Mondain
+	if (_G(map).getMapTile(x, y) != 0 || x == sg._mondainPos.x || y == sg._mondainPos.y)
+		return false;
+
+	_G(map)[y][x] = 5;
+	playFX(5);
+	writeString("Done.\n");
+	return true;
+}
+
+bool MondainLogic::castRemoveBarrier(Data::Direction dir) {
+	if (dir == Data::DIR_UNSPECIFIED) {
+		writeString("nothing\n");
+		playFX(6);
+		return true;
+	}
+
+	writeString("%s\n", Data::DIRECTION_NAMES[dir]);
+	if (!rollSpellSuccess())
+		return false;
+
+	Data::Savegame &sg = _G(savegame);
+	int x = sg._locationPosition.x + DELTA_X[dir];
+	int y = sg._locationPosition.y + DELTA_Y[dir];
+
+	if (_G(map).getMapTile(x, y) != 5)
+		return false;
+
+	_G(map)[y][x] = 0;
+	playFX(5);
+	writeString("Done.\n");
+	return true;
+}
+
+bool MondainLogic::castMagicMissile(Data::Direction dir) {
+	if (dir == Data::DIR_UNSPECIFIED) {
+		writeString("nothing\n");
+		playFX(6);
+		return false;
+	}
+
+	writeString("%s\n", Data::DIRECTION_NAMES[dir]);
+	if (!rollSpellSuccess() || !isWithinRange7())
+		return false;
+
+	int strike = getMagicWeaponPower();
+	damage(dir, 5, 5, strike, 500, 0);
+	return true;
+}
+
+bool MondainLogic::cast() {
+	Data::Savegame &sg = _G(savegame);
+	int spell = sg._equippedSpell;
+
+	writeString("Cast %s", Data::SPELL_NAMES[spell]);
+
+	if (sg._spells[spell] == 0) {
+		writeString("\n");
+		writeString("You've used up that spell!\n");
+		playFX(6);
+		return true;
+	}
+
+	if (spell != Data::SPELL_PRAYER)
+		--sg._spells[spell];
+
+	if (spell != Data::SPELL_MAGIC_MISSILE && spell != Data::SPELL_BLINK && spell != Data::SPELL_CREATE &&
+			spell != Data::SPELL_DESTROY && spell != Data::SPELL_KILL) {
+		// Nothing else has any effect on Mondain
+		writeString("\n");
+		writeString("Failed!\n");
+		playFX(6);
+		return true;
+	}
+
+	bool success;
+	switch (spell) {
+	case Data::SPELL_BLINK:
+		success = castTeleport();
+		break;
+	case Data::SPELL_KILL:
+		success = castInterficioNunc();
+		break;
+	default:
+		// Magic Missile/Create/Destroy all need a direction first, so
+		// defer to the Direction view - castSpellAttack() picks up from
+		// here once one's been chosen
+		writeString(": ");
+		_castSpell = spell;
+		_G(logic) = Common::SharedPtr<Logic>(new DirectionLogic(DirectionLogic::SPELL));
+		g_engine->addView("Direction");
+		return false;
+	}
+
+	if (!success) {
+		writeString("Failed!\n");
+		playFX(6);
+	}
+	return true;
+}
+
+void MondainLogic::castSpellAttack(Data::Direction dir) {
+	bool success;
+	switch (_castSpell) {
+	case Data::SPELL_CREATE:
+		success = castPlaceBarrier(dir);
+		break;
+	case Data::SPELL_DESTROY:
+		success = castRemoveBarrier(dir);
+		break;
+	default:
+		// SPELL_MAGIC_MISSILE
+		success = castMagicMissile(dir);
+		break;
+	}
+
+	if (!success) {
+		writeString("Failed!\n");
+		playFX(6);
+	}
+}
+
 void MondainLogic::tick() {
 	// Only advance the animations once every 4 frames
 	if (++_tickCounter < 4)
diff --git a/engines/ultima/ultima1/logic/mondain_logic.h b/engines/ultima/ultima1/logic/mondain_logic.h
index cd3a8318265..ec9bcb5b5ca 100644
--- a/engines/ultima/ultima1/logic/mondain_logic.h
+++ b/engines/ultima/ultima1/logic/mondain_logic.h
@@ -36,12 +36,69 @@ private:
 	// between updates
 	int _tickCounter = 0;
 
+	// Which spell useSelectedItem/cast() started casting - remembered so
+	// castSpellAttack (called back later once a direction's been chosen
+	// via the Direction view) knows which of the 3 direction-needing
+	// spells to resolve
+	int _castSpell = 0;
+
 	/**
 	 * Returns true if Mondain is standing in any of the 8 cells surrounding
 	 * the player's current position
 	 */
 	bool isAdjacentToMondain() const;
 
+	/**
+	 * Returns true if the player is within a Manhattan distance of 7 of
+	 * Mondain - used to gate the Kill/Magic Missile spells
+	 */
+	bool isWithinRange7() const;
+
+	/**
+	 * Rolls whether a spell succeeds at all - based on intelligence, with
+	 * wizards always succeeding
+	 */
+	bool rollSpellSuccess();
+
+	/**
+	 * Returns the magic "strike" power of the currently readied weapon,
+	 * used by the Magic Missile spell - a random value up to the player's
+	 * intelligence, doubled/tripled/halved again depending on whether a
+	 * wand, amulet, staff, or triangle is readied
+	 */
+	int getMagicWeaponPower();
+
+	/**
+	 * Blink spell (SPELL_BLINK) - teleports the player to a random open
+	 * floor tile. Doesn't need a direction
+	 */
+	bool castTeleport();
+
+	/**
+	 * Kill spell (SPELL_KILL) - rather than harming Mondain, it backfires
+	 * and doubles his remaining hit points (capped at 15000). Doesn't need
+	 * a direction
+	 */
+	bool castInterficioNunc();
+
+	/**
+	 * Create spell (SPELL_CREATE) - places a barrier on the empty tile in
+	 * the given direction, provided it isn't in line with Mondain
+	 */
+	bool castPlaceBarrier(Data::Direction dir);
+
+	/**
+	 * Destroy spell (SPELL_DESTROY) - removes a barrier tile in the given
+	 * direction
+	 */
+	bool castRemoveBarrier(Data::Direction dir);
+
+	/**
+	 * Magic Missile spell (SPELL_MAGIC_MISSILE) - attacks Mondain in the
+	 * given direction, provided he's within range
+	 */
+	bool castMagicMissile(Data::Direction dir);
+
 protected:
 	bool move(Data::Direction dir) override;
 
@@ -58,6 +115,18 @@ protected:
 	 */
 	void damage(Data::Direction dir, int effectNum, int maxDistance, int strike, int hitChance, int tileId) override;
 
+	/**
+	 * Cast a spell - only Magic Missile, Blink, Create, Destroy, and Kill
+	 * have any effect here; everything else just fails
+	 */
+	bool cast() override;
+
+	/**
+	 * Called back by the Direction view once a direction's been chosen for
+	 * whichever spell cast() deferred to it (_castSpell)
+	 */
+	void castSpellAttack(Data::Direction dir) override;
+
 	bool get() override;
 	bool inform() override;
 	bool quit() override;


Commit: 0a5ec72faa65104436947bde889a99ade0e3b472
    https://github.com/scummvm/scummvm/commit/0a5ec72faa65104436947bde889a99ade0e3b472
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:40:51+11:00

Commit Message:
ULTIMA: ULTIMA1: Added Mondain win/lose dialogs

Changed paths:
  A engines/ultima/ultima1/views/interactions/lose.cpp
  A engines/ultima/ultima1/views/interactions/lose.h
  A engines/ultima/ultima1/views/interactions/win.cpp
  A engines/ultima/ultima1/views/interactions/win.h
    engines/ultima/module.mk
    engines/ultima/ultima1/logic/mondain_logic.cpp
    engines/ultima/ultima1/logic/mondain_logic.h
    engines/ultima/ultima1/views/full_screen_dialog.cpp
    engines/ultima/ultima1/views/views.h


diff --git a/engines/ultima/module.mk b/engines/ultima/module.mk
index 81a410e4a82..bb75f648152 100644
--- a/engines/ultima/module.mk
+++ b/engines/ultima/module.mk
@@ -75,11 +75,13 @@ MODULE_OBJS += \
 	ultima1/views/interactions/entering_craft.o \
 	ultima1/views/interactions/king.o \
 	ultima1/views/interactions/liftoff.o \
+	ultima1/views/interactions/lose.o \
 	ultima1/views/interactions/merchant.o \
 	ultima1/views/interactions/operate_craft.o \
 	ultima1/views/interactions/pillar.o \
 	ultima1/views/interactions/princess_saved.o \
 	ultima1/views/interactions/ready.o \
+	ultima1/views/interactions/win.o \
 	ultima1/views/view.o \
 	ultima1/views/commands.o \
 	ultima1/views/create_character.o \
diff --git a/engines/ultima/ultima1/logic/mondain_logic.cpp b/engines/ultima/ultima1/logic/mondain_logic.cpp
index ce831343360..498f7754435 100644
--- a/engines/ultima/ultima1/logic/mondain_logic.cpp
+++ b/engines/ultima/ultima1/logic/mondain_logic.cpp
@@ -394,6 +394,13 @@ void MondainLogic::updateCreatures() {
 	// TODO
 }
 
+void MondainLogic::endOfTurn() {
+	Logic::endOfTurn();
+
+	if (_G(savegame)._mondainDefeatedFlag)
+		g_engine->addView("Win");
+}
+
 bool MondainLogic::get() {
 	Data::Savegame &sg = _G(savegame);
 	writeString("Get (Gem)");
diff --git a/engines/ultima/ultima1/logic/mondain_logic.h b/engines/ultima/ultima1/logic/mondain_logic.h
index ec9bcb5b5ca..3d044175fa1 100644
--- a/engines/ultima/ultima1/logic/mondain_logic.h
+++ b/engines/ultima/ultima1/logic/mondain_logic.h
@@ -107,6 +107,12 @@ protected:
 	 */
 	void updateCreatures() override;
 
+	/**
+	 * Called after an action is done - checks for Mondain's defeat, on top
+	 * of the usual end of turn handling
+	 */
+	void endOfTurn() override;
+
 	/**
 	 * Resolves a wand attack - scans up to maxDistance tiles in the given
 	 * direction for Mondain, then rolls to hit and applies damage. Unlike
diff --git a/engines/ultima/ultima1/views/full_screen_dialog.cpp b/engines/ultima/ultima1/views/full_screen_dialog.cpp
index 8abe91c5faf..7236502f7f5 100644
--- a/engines/ultima/ultima1/views/full_screen_dialog.cpp
+++ b/engines/ultima/ultima1/views/full_screen_dialog.cpp
@@ -33,6 +33,7 @@ constexpr int COLOR_NOTCH = 0;   // black - corner notch pixels
 
 void FullScreenDialog::draw() {
 	auto s = getSurface();
+	s.clear();
 
 	// Thick outer border band - each edge flush against both the screen edge
 	// and the inner highlight line drawn just inside it
diff --git a/engines/ultima/ultima1/views/interactions/lose.cpp b/engines/ultima/ultima1/views/interactions/lose.cpp
new file mode 100644
index 00000000000..24a5f6290d8
--- /dev/null
+++ b/engines/ultima/ultima1/views/interactions/lose.cpp
@@ -0,0 +1,77 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "ultima/ultima1/views/interactions/lose.h"
+#include "ultima/ultima1/ultima1.h"
+
+namespace Ultima {
+namespace Ultima1 {
+namespace Views {
+namespace Interactions {
+
+constexpr int TEXT_COLOR = 15;   // white
+constexpr int BORDER_COLOR = 1;  // dark blue
+
+// Same generic drawDialog box geometry the Win cutscene uses
+constexpr int DIALOG_X1 = 31, DIALOG_Y1 = 23, DIALOG_X2 = 287, DIALOG_Y2 = 127;
+constexpr int BORDER_X1 = 34, BORDER_Y1 = 26, BORDER_X2 = 284, BORDER_Y2 = 124;
+
+bool Lose::msgFocus(const FocusMessage &msg) {
+	setBounds(TextRect(0, 0, 39, 19));
+
+	g_engine->send("Commands", GameMessage("TEXT", "THOU ART DEAD!"));
+	g_engine->playFX(2);
+	g_engine->playFX(2);
+	g_engine->playFX(2);
+
+	return true;
+}
+
+void Lose::draw() {
+	drawDialog();
+}
+
+void Lose::drawDialog() {
+	auto s = getSurface();
+	s.fillRect(Rect(DIALOG_X1, DIALOG_Y1, DIALOG_X2, DIALOG_Y2), 0);
+	s.frameRect(Rect(BORDER_X1, BORDER_Y1, BORDER_X2, BORDER_Y2), BORDER_COLOR);
+
+	s.setColor(TEXT_COLOR);
+	s.writeString(Point(5, 6), "   Thou hast been defeated by");
+	s.writeString(Point(5, 7), "      Mondain the Wizard!");
+	s.writeString(Point(5, 12), "    THE UNIVERSE IS DOOMED!");
+}
+
+bool Lose::msgAction(const ActionMessage &msg) {
+	// No resurrection from this one - straight back to the main menu
+	g_engine->replaceView("MainMenu", true);
+	return true;
+}
+
+bool Lose::msgKeypress(const KeypressMessage &msg) {
+	g_engine->replaceView("MainMenu", true);
+	return true;
+}
+
+} // namespace Interactions
+} // namespace Views
+} // namespace Ultima1
+} // namespace Ultima
diff --git a/engines/ultima/ultima1/views/interactions/lose.h b/engines/ultima/ultima1/views/interactions/lose.h
new file mode 100644
index 00000000000..640d39a5689
--- /dev/null
+++ b/engines/ultima/ultima1/views/interactions/lose.h
@@ -0,0 +1,65 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef ULTIMA1_VIEWS_INTERACTIONS_LOSE_H
+#define ULTIMA1_VIEWS_INTERACTIONS_LOSE_H
+
+#include "ultima/ultima1/views/interactions/interaction.h"
+
+namespace Ultima {
+namespace Ultima1 {
+namespace Views {
+namespace Interactions {
+
+using namespace Ultima::Shared::Messages;
+
+/**
+ * Shown when Mondain kills the player. Unlike the normal Dead view there's
+ * no resurrection - this is the end. Plays out the original's own defeat
+ * screen: a dialog announcing "THOU ART DEAD!" and that Mondain the Wizard
+ * has won, the universe doomed. Any keypress or action then returns to the
+ * main menu.
+ */
+class Lose : public Interaction {
+private:
+	/**
+	 * Draws the defeat dialog
+	 */
+	void drawDialog();
+
+public:
+	Lose() : Interaction("Lose") {
+	}
+	~Lose() override {
+	}
+
+	bool msgFocus(const FocusMessage &msg) override;
+	bool msgAction(const ActionMessage &msg) override;
+	bool msgKeypress(const KeypressMessage &msg) override;
+	void draw() override;
+};
+
+} // namespace Interactions
+} // namespace Views
+} // namespace Ultima1
+} // namespace Ultima
+
+#endif
diff --git a/engines/ultima/ultima1/views/interactions/win.cpp b/engines/ultima/ultima1/views/interactions/win.cpp
new file mode 100644
index 00000000000..ac2686edb70
--- /dev/null
+++ b/engines/ultima/ultima1/views/interactions/win.cpp
@@ -0,0 +1,157 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "common/util.h"
+#include "ultima/ultima1/views/interactions/win.h"
+#include "ultima/ultima1/ultima1.h"
+
+namespace Ultima {
+namespace Ultima1 {
+namespace Views {
+namespace Interactions {
+
+constexpr int TEXT_COLOR = 15;   // white
+constexpr int BORDER_COLOR = 1;  // dark blue
+
+// The small "Mondain is dead!" dialog reuses the same generic drawDialog
+// box geometry as Pillar's inscription dialog - both come from the
+// original's own shared drawDialog function
+constexpr int DIALOG_X1 = 31, DIALOG_Y1 = 23, DIALOG_X2 = 287, DIALOG_Y2 = 127;
+constexpr int BORDER_X1 = 34, BORDER_Y1 = 26, BORDER_X2 = 284, BORDER_Y2 = 124;
+
+// The original's ending image decodes to exactly 320x168 pixels (21 rows
+// of an 8px-tall font) - matching the 21 lines of text below exactly
+constexpr int ENDING_WIDTH = 320, ENDING_HEIGHT = 168;
+
+// FRAME_RATE ticks/second (see shared/engine/events.h) - about 10 seconds
+// to fully reveal, matching the original's scanline-by-scanline draw
+constexpr int REVEAL_TICKS = FRAME_RATE * 10;
+
+// The full text of the original's "nif.bin" ending picture, transcribed
+// from the decoded bitmap - 21 lines, matching its exact line breaks
+static const char *const ENDING_TEXT[] = {
+	"A rain of silver lightning heralds the",
+	"death of Mondain.  Fleeting glimpses of",
+	"fates avoided rush through thy mind as",
+	"the arcane power of the mage's dying",
+	"scream echoes in thy ears.  A thousand",
+	"years pass in but a moment's time as a",
+	"strange sleep overcomes thee.",
+	"",
+	"Upon awakening thou dost find thyself",
+	"in new surroundings.  A stately youth in",
+	"violet robes helps thee to thy feet",
+	"whereupon thou dost see the thousands",
+	"who gaze upon thee in adoration.",
+	"",
+	"\"Thy selfless heroism hath saved our",
+	"people, my worthy one.  Should our",
+	"gratitude alone not be enough to sustain",
+	"thee, know that I, Lord British, hereby",
+	"ordain that the entire realm of Sosaria",
+	"be at thy service for all time hence-",
+	"forth.  So let it be done.\""
+};
+
+bool Win::msgFocus(const FocusMessage &msg) {
+	setBounds(TextRect(0, 0, 39, 19));
+	_phase = PHASE_DIALOG;
+	_revealedRows = 0;
+	_elapsedTicks = 0;
+
+	renderEndingText();
+
+	for (int i = 0; i < 3; ++i)
+		g_engine->playFX(5);
+
+	return true;
+}
+
+void Win::renderEndingText() {
+	_textSurface.create(ENDING_WIDTH, ENDING_HEIGHT, Graphics::PixelFormat::createFormatCLUT8());
+	_textSurface.setColor(TEXT_COLOR);
+
+	for (int i = 0; i < ARRAYSIZE(ENDING_TEXT); ++i)
+		_textSurface.writeString(Common::Point(0, i), ENDING_TEXT[i]);
+}
+
+void Win::draw() {
+	if (_phase == PHASE_DIALOG) {
+		drawDialog();
+		return;
+	}
+
+	auto s = getSurface();
+	s.fillRect(Rect(0, 0, 320, 200), 0);
+	s.blitFrom(_textSurface, Common::Rect(0, 0, ENDING_WIDTH, _revealedRows), Common::Point(0, 0));
+}
+
+void Win::drawDialog() {
+	auto s = getSurface();
+	s.fillRect(Rect(DIALOG_X1, DIALOG_Y1, DIALOG_X2, DIALOG_Y2), 0);
+	s.frameRect(Rect(BORDER_X1, BORDER_Y1, BORDER_X2, BORDER_Y2), BORDER_COLOR);
+
+	s.setColor(TEXT_COLOR);
+	s.writeString(Point(11, 8), "THOU ART VICTORIOUS!");
+}
+
+bool Win::tick() {
+	if (_phase == PHASE_GLYPH && _revealedRows < ENDING_HEIGHT) {
+		++_elapsedTicks;
+
+		int rows = MIN(ENDING_HEIGHT, ENDING_HEIGHT * _elapsedTicks / REVEAL_TICKS);
+		if (rows != _revealedRows) {
+			_revealedRows = rows;
+			redraw();
+		}
+	}
+
+	return Interaction::tick();
+}
+
+bool Win::msgAction(const ActionMessage &msg) {
+	advancePhase();
+	return true;
+}
+
+bool Win::msgKeypress(const KeypressMessage &msg) {
+	advancePhase();
+	return true;
+}
+
+void Win::advancePhase() {
+	if (_phase == PHASE_DIALOG) {
+		// First key wipes the announcement dialog and starts the ending
+		// text revealing itself from the top down
+		_phase = PHASE_GLYPH;
+		setBounds(Common::Rect(0, 0, 320, 200));
+		redraw();
+		return;
+	}
+
+	// A key during or after the reveal takes the player on to the main menu
+	g_engine->replaceView("MainMenu", true);
+}
+
+} // namespace Interactions
+} // namespace Views
+} // namespace Ultima1
+} // namespace Ultima
diff --git a/engines/ultima/ultima1/views/interactions/win.h b/engines/ultima/ultima1/views/interactions/win.h
new file mode 100644
index 00000000000..ebfae9dc3b8
--- /dev/null
+++ b/engines/ultima/ultima1/views/interactions/win.h
@@ -0,0 +1,101 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef ULTIMA1_VIEWS_INTERACTIONS_WIN_H
+#define ULTIMA1_VIEWS_INTERACTIONS_WIN_H
+
+#include "ultima/ultima1/views/interactions/interaction.h"
+#include "ultima/shared/gfx/gfx_surface.h"
+
+namespace Ultima {
+namespace Ultima1 {
+namespace Views {
+namespace Interactions {
+
+using namespace Ultima::Shared::Messages;
+
+/**
+ * Shown when Mondain is defeated for good (the gem has already been
+ * destroyed, so it can't be undone). Plays out the original's
+ * playMondainDefeatCutscene: a small inset dialog announcing "THOU ART
+ * VICTORIOUS!" (with a triple chime, matching showMondainDeathDialog),
+ * then any key wipes to the ending text, which reveals itself top-down
+ * over about 10 seconds - matching the original's own scanline-by-scanline
+ * drawing of its "nif.bin" ending picture, which turned out (once decoded)
+ * to itself just be a 320x168 1-bit-per-pixel bitmap of this same epilogue
+ * text, not an illustration. A further keypress or action - during or
+ * after the reveal - takes the player on to the main menu.
+ *
+ * The separate "Mondain is dead." message - shown in the Commands area
+ * the moment his hit points reach zero, which doesn't necessarily stick if
+ * the gem hasn't been destroyed yet - belongs to updateMondainState's end
+ * of turn handling, not this view
+ */
+class Win : public Interaction {
+private:
+	enum Phase {
+		PHASE_DIALOG,
+		PHASE_GLYPH
+	};
+
+	Phase _phase = PHASE_DIALOG;
+
+	// The ending text, rendered once into its own surface on focus, then
+	// revealed gradually from the top down as _revealedRows grows
+	Shared::Gfx::GfxSurface _textSurface;
+	int _revealedRows = 0;
+	int _elapsedTicks = 0;
+
+	/**
+	 * Draws the small "Mondain is dead!" dialog
+	 */
+	void drawDialog();
+
+	/**
+	 * Renders the full ending text into _textSurface, once, up front
+	 */
+	void renderEndingText();
+
+	/**
+	 * Handles a keypress/action: the first wipes from the dialog to the
+	 * ending text reveal; a later one moves on to the main menu
+	 */
+	void advancePhase();
+
+public:
+	Win() : Interaction("Win") {
+	}
+	~Win() override {
+	}
+
+	bool msgFocus(const FocusMessage &msg) override;
+	bool msgAction(const ActionMessage &msg) override;
+	bool msgKeypress(const KeypressMessage &msg) override;
+	void draw() override;
+	bool tick() override;
+};
+
+} // namespace Interactions
+} // namespace Views
+} // namespace Ultima1
+} // namespace Ultima
+
+#endif
diff --git a/engines/ultima/ultima1/views/views.h b/engines/ultima/ultima1/views/views.h
index a5e7188a988..9c2f1e2d1ea 100644
--- a/engines/ultima/ultima1/views/views.h
+++ b/engines/ultima/ultima1/views/views.h
@@ -28,11 +28,13 @@
 #include "ultima/ultima1/views/interactions/entering_craft.h"
 #include "ultima/ultima1/views/interactions/king.h"
 #include "ultima/ultima1/views/interactions/liftoff.h"
+#include "ultima/ultima1/views/interactions/lose.h"
 #include "ultima/ultima1/views/interactions/merchant.h"
 #include "ultima/ultima1/views/interactions/operate_craft.h"
 #include "ultima/ultima1/views/interactions/pillar.h"
 #include "ultima/ultima1/views/interactions/princess_saved.h"
 #include "ultima/ultima1/views/interactions/ready.h"
+#include "ultima/ultima1/views/interactions/win.h"
 #include "ultima/ultima1/views/create_character.h"
 #include "ultima/ultima1/views/dungeon_map.h"
 #include "ultima/ultima1/views/game.h"
@@ -55,11 +57,13 @@ struct Views : public Shared::Views {
 	Interactions::EnteringCraft _enteringCraft;
 	Interactions::King _king;
 	Interactions::LiftOff _liftOff;
+	Interactions::Lose _lose;
 	Interactions::Merchant _merchant;
 	Interactions::OperateCraft _operateCraft;
 	Interactions::Pillar _pillar;
 	Interactions::PrincessSaved _princessSaved;
 	Interactions::Ready _ready;
+	Interactions::Win _win;
 	CreateCharacter _createCharacter;
 	DungeonMap _dungeonMap;
 	Game _game;


Commit: 1cd9af7653228c76efa5840a71bf8006ba560cd7
    https://github.com/scummvm/scummvm/commit/1cd9af7653228c76efa5840a71bf8006ba560cd7
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:40:51+11:00

Commit Message:
ULTIMA: ULTIMA1: Mondain battle logic

Changed paths:
    engines/ultima/ultima1/data/savegame.cpp
    engines/ultima/ultima1/data/savegame.h
    engines/ultima/ultima1/data/tiles.h
    engines/ultima/ultima1/logic/mondain_logic.cpp
    engines/ultima/ultima1/logic/mondain_logic.h
    engines/ultima/ultima1/views/mondain_map.cpp


diff --git a/engines/ultima/ultima1/data/savegame.cpp b/engines/ultima/ultima1/data/savegame.cpp
index 377b1def59f..ef98d4c6556 100644
--- a/engines/ultima/ultima1/data/savegame.cpp
+++ b/engines/ultima/ultima1/data/savegame.cpp
@@ -117,6 +117,9 @@ void Savegame::synchronizeExtra(Common::Serializer &s) {
 		s.syncAsSint16LE(_mondainPhaseTimer);
 		s.syncAsSint16LE(_mondainDefeatedFlag);
 		s.syncAsSint16LE(_mondainHits);
+		s.syncAsSint16LE(_mondainHazardAnim);
+		s.syncAsSint16LE(_mondainHazardPos.x);
+		s.syncAsSint16LE(_mondainHazardPos.y);
 	}
 }
 
diff --git a/engines/ultima/ultima1/data/savegame.h b/engines/ultima/ultima1/data/savegame.h
index 9f5f30eeef0..0da77b129c2 100644
--- a/engines/ultima/ultima1/data/savegame.h
+++ b/engines/ultima/ultima1/data/savegame.h
@@ -151,6 +151,10 @@ public:
 	int16 _mondainDefeatedFlag = 0;
 	// Mondain's own hit points
 	int16 _mondainHits = 1000;
+	// Mondain's conjured-hazard flash: -1 when idle, otherwise its current
+	// animation frame (0..6). _mondainHazardPos is the cell it occupies
+	int16 _mondainHazardAnim = -1;
+	Common::Point _mondainHazardPos;
 
 	/**
 	 * Synchronize savegame data
diff --git a/engines/ultima/ultima1/data/tiles.h b/engines/ultima/ultima1/data/tiles.h
index 3353427daff..c8b703ddb7e 100644
--- a/engines/ultima/ultima1/data/tiles.h
+++ b/engines/ultima/ultima1/data/tiles.h
@@ -98,6 +98,9 @@ enum LocationTileId {
 };
 
 enum MondainTileId {
+	// Tiles 14-19 are the 6 animation frames of a hazard Mondain briefly
+	// conjures onto an empty cell (see updateMondainState / MondainLogic::tick)
+	MTILE_HAZARD = 14,
 	MTILE_PLAYER = 20
 };
 
diff --git a/engines/ultima/ultima1/logic/mondain_logic.cpp b/engines/ultima/ultima1/logic/mondain_logic.cpp
index 498f7754435..83962688849 100644
--- a/engines/ultima/ultima1/logic/mondain_logic.cpp
+++ b/engines/ultima/ultima1/logic/mondain_logic.cpp
@@ -32,6 +32,10 @@ namespace Logic {
 static const int8 DELTA_X[5] = { 0, -1, 1, 0, 0 };
 static const int8 DELTA_Y[5] = { 0, 0, 0, -1, 1 };
 
+static int sgn(int v) {
+	return (v > 0) - (v < 0);
+}
+
 MondainLogic::MondainLogic() {
 	_G(map)._mapType = Data::MAPTYPE_MONDAIN;
 
@@ -359,6 +363,17 @@ void MondainLogic::tick() {
 
 	Data::Savegame &sg = _G(savegame);
 
+	// Advance the conjured-hazard flash. It plays 6 frames, then the cell
+	// it occupied is cleared back to open floor
+	if (sg._mondainHazardAnim >= 0) {
+		if (sg._mondainHazardAnim >= 6) {
+			_G(map)[sg._mondainHazardPos.y][sg._mondainHazardPos.x] = 0;
+			sg._mondainHazardAnim = -1;
+		} else {
+			++sg._mondainHazardAnim;
+		}
+	}
+
 	// Bounce the hit-reaction frame back and forth between 1 and 4
 	if (sg._mondainHitAnimFrame != 0) {
 		sg._mondainHitAnimFrame += sg._mondainHitAnimDir;
@@ -390,15 +405,250 @@ bool MondainLogic::isAdjacentToMondain() const {
 	return dx <= 1 && dy <= 1 && (dx != 0 || dy != 0);
 }
 
+void MondainLogic::updateMondainState() {
+	Data::Savegame &sg = _G(savegame);
+
+	// Once combat's underway, Mondain occasionally conjures a hazard tile
+	// onto a random empty cell that shares neither a row nor a column with
+	// him or the player. It flashes for a few frames (see tick()) and burns
+	// the player if they walk into it
+	if (sg._mondainCombatFlag && sg._mondainHazardAnim < 0 && getRandomNumber(1, 200) < 36) {
+		int hx = 0, hy = 0;
+		bool empty = false;
+
+		for (int attempt = 0; attempt < 100 && !empty; ++attempt) {
+			hx = (getRandomNumber(1, 255) + getRandomNumber(1, 255)) % Data::MONDAIN_WIDTH;
+			hy = (getRandomNumber(1, 255) + getRandomNumber(1, 255)) % Data::MONDAIN_HEIGHT;
+			empty = _G(map).getMapTile(hx, hy) == 0;
+		}
+
+		if (empty && hx != sg._mondainPos.x && hx != sg._locationPosition.x &&
+				hy != sg._mondainPos.y && hy != sg._locationPosition.y) {
+			sg._mondainHazardAnim = 0;
+			sg._mondainHazardPos = Common::Point(hx, hy);
+			_G(map)[hy][hx] = Data::MTILE_HAZARD;
+		}
+	}
+
+	// Step Mondain through his hit-point-driven phases
+	if (sg._mondainHits > 500) {
+		// Healthy - his aggressive phase
+		sg._mondainPhase = 2;
+		sg._mondainPhaseTimer = 20;
+	} else if (sg._mondainHits > 0) {
+		// Wounded - backs off and stops attacking
+		if (sg._mondainPhase != 11) {
+			sg._mondainPhase = 11;
+			sg._mondainPhaseTimer = 40;
+			sg._mondainPhaseAnimOffset = 0;
+		}
+	} else if (sg._mondainPhaseTimer != 30) {
+		// Hit points have just reached zero
+		writeString("Mondain is dead!");
+
+		if (!sg._gemDestroyedFlag) {
+			// The gem still stands, so this won't last - mondainTakeTurn
+			// will heal him back up
+			writeString("...or is he?\n");
+		} else {
+			writeString("\n");
+			sg._mondainDefeatedFlag = 1;
+		}
+
+		sg._mondainPhase = 4;
+		sg._mondainPhaseTimer = 30;
+		sg._mondainPhaseAnimOffset = 0;
+	}
+}
+
 void MondainLogic::updateCreatures() {
-	// TODO
+	mondainTakeTurn();
+}
+
+void MondainLogic::mondainTakeTurn() {
+	Data::Savegame &sg = _G(savegame);
+
+	if (!sg._mondainCombatFlag) {
+		// Combat hasn't been triggered yet - just an occasional hint that
+		// something's afoot
+		if (getRandomNumber(1, 200) < 17)
+			writeString("You hear a strange chanting!\n");
+		return;
+	}
+
+	if (sg._mondainPhase == 4) {
+		// Defeated for now, but the gem's intact - he steadily heals back
+		sg._mondainHits += 25;
+		return;
+	}
+
+	int dx = sg._mondainPos.x - sg._locationPosition.x;
+	int dy = sg._mondainPos.y - sg._locationPosition.y;
+	int dist = ABS(dx) + ABS(dy);
+
+	if (dist == 1 && sg._mondainPhaseTimer == 20) {
+		mondainMeleeAttack();
+		return;
+	}
+
+	if (dist < 7 && getRandomNumber(1, 255) < 128 && sg._mondainPhaseTimer == 20) {
+		mondainSpellAttack();
+		return;
+	}
+
+	// Otherwise he moves. When retreating (his wounded phase) and already
+	// lined up with the player on an axis, he picks that axis at random so
+	// he doesn't just sit in the firing line
+	if (sg._mondainPhaseTimer == 40) {
+		if (dx == 0)
+			dx = randomSign();
+		if (dy == 0)
+			dy = randomSign();
+	}
+
+	bool moved;
+	if (getRandomNumber(1, 255) & 1) {
+		moved = tryMoveMondain(0, sgn(dy));
+		if (!moved)
+			moved = tryMoveMondain(sgn(dx), 0);
+	} else {
+		moved = tryMoveMondain(sgn(dx), 0);
+		if (!moved)
+			moved = tryMoveMondain(0, sgn(dy));
+	}
+
+	// Boxed in while retreating - he burns a turn regenerating instead
+	if (!moved && sg._mondainPhaseTimer == 40)
+		sg._mondainHits += 5;
+}
+
+bool MondainLogic::tryMoveMondain(int dx, int dy) {
+	Data::Savegame &sg = _G(savegame);
+	int newX = sg._mondainPos.x + dx;
+	int newY = sg._mondainPos.y + dy;
+
+	if (newX < 0 || newY < 0 || newX >= Data::MONDAIN_WIDTH || newY >= Data::MONDAIN_HEIGHT)
+		return false;
+
+	// Anything non-empty blocks him - walls, barriers, a hazard, and the
+	// player (whose cell is kept marked with MTILE_PLAYER)
+	if (_G(map).getMapTile(newX, newY) != 0)
+		return false;
+
+	sg._mondainPos = Common::Point(newX, newY);
+	return true;
+}
+
+int MondainLogic::randomSign() {
+	return sgn(getRandomNumber(1, 255) - 128);
+}
+
+void MondainLogic::damagePlayer(int amount) {
+	Data::Savegame &sg = _G(savegame);
+
+	writeString("Hit! ");
+	writeString("%d damage!\n", amount);
+
+	sg._hits -= amount;
+	playFX(2);
+	redrawStats();
+}
+
+void MondainLogic::mondainMeleeAttack() {
+	Data::Savegame &sg = _G(savegame);
+
+	writeString("Attacked by Mondain!\n");
+	playFX(3);
+
+	// Note: as in the original, higher stamina/armour actually *raises* this
+	// threshold, so a well-equipped player is hit more often, not less
+	int roll = getRandomNumber(1, 255);
+	int threshold = 2 * (0xB9 - sg._stamina / 2 + (sg._equippedArmor << 3));
+
+	if (roll <= threshold)
+		damagePlayer(sg._hits / 32 + getRandomNumber(1, 20));
+	else
+		writeString("Missed!\n");
+}
+
+void MondainLogic::mondainSpellAttack() {
+	Data::Savegame &sg = _G(savegame);
+
+	int kind = getRandomNumber(1, 238) % 3;
+	writeString("Mondain casts ");
+
+	bool hit = false;
+
+	switch (kind) {
+	case 0:
+		// Magic missile - straightforward damage, dodged with high mental
+		// stats (the threshold goes negative once wisdom is high enough)
+		writeString("magic missile!\n");
+		playFX(5);
+
+		hit = getRandomNumber(1, 255) < 2 * (0xC3 - (sg._wisdom + sg._intelligence / 2));
+		if (hit)
+			damagePlayer(getRandomNumber(1, 100));
+		break;
+
+	case 1:
+		// Mind blaster - drains each of the six attributes
+		writeString("mind blaster!\n");
+		playFX(5);
+
+		hit = getRandomNumber(1, 200) > 140;
+		if (hit) {
+			writeString("Hit!  Stats are reduced!\n");
+
+			int16 *stats[6] = {
+				&sg._strength, &sg._agility, &sg._stamina,
+				&sg._charisma, &sg._wisdom, &sg._intelligence
+			};
+			for (int i = 0; i < 6; ++i) {
+				if (*stats[i] > 0x10)
+					*stats[i] -= *stats[i] / 8;
+				else if (*stats[i] >= 2)
+					*stats[i] -= 2;
+			}
+		}
+		break;
+
+	default:
+		// Psionic shock
+		writeString("psionic shock!\n");
+		playFX(5);
+
+		hit = getRandomNumber(1, 200) > 140;
+		if (hit) {
+			int amount = sg._hits / 32;
+			if (amount > 0xFF)
+				amount -= 0xFE;
+			damagePlayer(amount);
+		}
+		break;
+	}
+
+	if (!hit)
+		writeString("Missed!\n");
 }
 
 void MondainLogic::endOfTurn() {
-	Logic::endOfTurn();
+	// Not chaining to Logic::endOfTurn() on purpose
+
+	updateMondainState();
 
-	if (_G(savegame)._mondainDefeatedFlag)
+	if (_G(savegame)._mondainDefeatedFlag) {
+		redrawStats();
 		g_engine->addView("Win");
+		return;
+	}
+
+	updateCreatures();
+
+	redrawStats();
+
+	if (_G(savegame)._hits <= 0)
+		g_engine->addView("Lose");
 }
 
 bool MondainLogic::get() {
diff --git a/engines/ultima/ultima1/logic/mondain_logic.h b/engines/ultima/ultima1/logic/mondain_logic.h
index 3d044175fa1..e4a5d9b7f5b 100644
--- a/engines/ultima/ultima1/logic/mondain_logic.h
+++ b/engines/ultima/ultima1/logic/mondain_logic.h
@@ -99,6 +99,53 @@ private:
 	 */
 	bool castMagicMissile(Data::Direction dir);
 
+	/**
+	 * End of turn housekeeping for Mondain himself (the original's
+	 * updateMondainState): occasionally conjures a short-lived hazard tile,
+	 * steps him through his hit-point-driven phases, and - once his hit
+	 * points reach zero - prints the "Mondain is dead!" message, setting
+	 * _mondainDefeatedFlag only if the gem has already been destroyed
+	 */
+	void updateMondainState();
+
+	/**
+	 * Mondain's own turn (the original's mondainTakeTurn) - he attacks if
+	 * adjacent or close and in his aggressive phase, otherwise moves toward
+	 * (or, when wounded, away from) the player
+	 */
+	void mondainTakeTurn();
+
+	/**
+	 * Mondain's melee attack, used when he's standing right next to the
+	 * player (the original's dungeonAttack)
+	 */
+	void mondainMeleeAttack();
+
+	/**
+	 * Mondain's ranged spell attack - magic missile, mind blaster (stat
+	 * drain), or psionic shock, picked at random (the original's
+	 * mondainSpecialAttack)
+	 */
+	void mondainSpellAttack();
+
+	/**
+	 * Applies a hit from Mondain to the player - prints "Hit! N damage!",
+	 * subtracts the hit points, and updates the stats display
+	 */
+	void damagePlayer(int amount);
+
+	/**
+	 * Tries to step Mondain by (dx, dy) - fails if that cell is off the map
+	 * or occupied. Returns true if he moved
+	 */
+	bool tryMoveMondain(int dx, int dy);
+
+	/**
+	 * Returns -1, 0, or +1 at random (the original's randomSign) - used to
+	 * pick a retreat direction on an axis the player shares with Mondain
+	 */
+	int randomSign();
+
 protected:
 	bool move(Data::Direction dir) override;
 
@@ -108,8 +155,12 @@ protected:
 	void updateCreatures() override;
 
 	/**
-	 * Called after an action is done - checks for Mondain's defeat, on top
-	 * of the usual end of turn handling
+	 * Called after an action is done. Deliberately does NOT chain to
+	 * Logic::endOfTurn(): the Mondain encounter runs its own loop with no
+	 * food upkeep, and dying to Mondain is final - none of the base class's
+	 * resurrection ("Dead") handling applies. Runs updateMondainState, then
+	 * (unless he's been defeated for good) gives Mondain his turn via
+	 * updateCreatures, then checks whether the player has been killed
 	 */
 	void endOfTurn() override;
 
diff --git a/engines/ultima/ultima1/views/mondain_map.cpp b/engines/ultima/ultima1/views/mondain_map.cpp
index 8f82208f79e..8b098200e03 100644
--- a/engines/ultima/ultima1/views/mondain_map.cpp
+++ b/engines/ultima/ultima1/views/mondain_map.cpp
@@ -76,9 +76,18 @@ void MondainMap::draw() {
 	}
 #endif
 
+	const auto &sg = _G(savegame);
+
+	// A hazard Mondain has conjured, mid-flash (the map cell already holds
+	// MTILE_HAZARD; this overlays the current animation frame on top)
+	if (sg._mondainHazardAnim >= 0 && sg._mondainHazardAnim < 6) {
+		const Graphics::ManagedSurface &hazImg = tiles[Data::MTILE_HAZARD + sg._mondainHazardAnim];
+		s.blitFrom(hazImg, Common::Point(sg._mondainHazardPos.x * TILE_WIDTH + 8,
+			sg._mondainHazardPos.y * TILE_HEIGHT + 8));
+	}
+
 	// Draw Mondain himself - his current pose, plus (while he's reacting to
 	// a hit) a small flash effect just to the left of him
-	const auto &sg = _G(savegame);
 	const auto &mondainPos = sg._mondainPos;
 
 	if (sg._mondainHitAnimFrame != 0) {


Commit: 799154844f53877f5e8141951de4ffc99a4ec085
    https://github.com/scummvm/scummvm/commit/799154844f53877f5e8141951de4ffc99a4ec085
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:40:51+11:00

Commit Message:
ULTIMA: ULTIMA1: Mondain fight start fixes

Changed paths:
    engines/ultima/ultima1/data/map.cpp
    engines/ultima/ultima1/data/map.h
    engines/ultima/ultima1/logic/mondain_logic.cpp
    engines/ultima/ultima1/views/interactions/entering_craft.cpp


diff --git a/engines/ultima/ultima1/data/map.cpp b/engines/ultima/ultima1/data/map.cpp
index 1f0e049ac3e..c9cc676ab1b 100644
--- a/engines/ultima/ultima1/data/map.cpp
+++ b/engines/ultima/ultima1/data/map.cpp
@@ -103,7 +103,7 @@ static const byte MONDAIN_MAP[MONDAIN_HEIGHT][MONDAIN_WIDTH] = {
 	{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 5, 5, 0, 5, 5, 5, 0 },
 	{ 0, 0, 0, 0, 0, 5, 5, 5, 5, 5, 0, 5, 0, 0, 0, 0, 0, 5, 0 },
 	{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 0, 0, 0, 0, 0, 5, 0 },
-	{ 0, 0, 1, 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0 },
+	{ 0, 0, 1,20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0 },
 	{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 0, 0, 0, 0, 0, 5, 0 },
 	{ 0, 0, 0, 0, 0, 5, 5, 5, 5, 5, 0, 5, 0, 0, 0, 0, 0, 5, 0 },
 	{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 5, 5, 0, 5, 5, 5, 0 },
@@ -148,7 +148,7 @@ void Map::init() {
 	}
 
 	// Copy the Mondain map
-	Common::copy(&MONDAIN_MAP[0][0], &MONDAIN_MAP[0][0] + MONDAIN_WIDTH * MONDAIN_HEIGHT, &_mondainMap[0][0]);
+	resetMondainMap();
 
 	// Load tiles
 	loadTiles("egatiles.bin", _overworldTiles, OVERWORLD_TILES_COUNT, 16);
@@ -160,6 +160,10 @@ void Map::init() {
 	_mondainTiles[20] = _overworldTiles[TILE_PLAYER];
 }
 
+void Map::resetMondainMap() {
+	Common::copy(&MONDAIN_MAP[0][0], &MONDAIN_MAP[0][0] + MONDAIN_WIDTH * MONDAIN_HEIGHT, &_mondainMap[0][0]);
+}
+
 void Map::load(int mapNum) {
 	_currentMap = mapNum;
 
diff --git a/engines/ultima/ultima1/data/map.h b/engines/ultima/ultima1/data/map.h
index a521864656c..6bfb5b3d5a3 100644
--- a/engines/ultima/ultima1/data/map.h
+++ b/engines/ultima/ultima1/data/map.h
@@ -144,10 +144,18 @@ public:
 
 	/**
 	 * Loads a specified map.
-	 * @param mapNum 
+	 * @param mapNum
 	 */
 	void load(int mapNum);
 
+	/**
+	 * Restores the Mondain encounter room to its pristine layout, discarding
+	 * anything left behind by a previous visit (placed barriers, conjured
+	 * hazards, the player/position markers). The original re-reads the room
+	 * from disk each time its executable launches; this is the equivalent
+	 */
+	void resetMondainMap();
+
 	/**
 	 * Returns the map width
 	 */
diff --git a/engines/ultima/ultima1/logic/mondain_logic.cpp b/engines/ultima/ultima1/logic/mondain_logic.cpp
index 83962688849..275e72c0e98 100644
--- a/engines/ultima/ultima1/logic/mondain_logic.cpp
+++ b/engines/ultima/ultima1/logic/mondain_logic.cpp
@@ -45,8 +45,34 @@ MondainLogic::MondainLogic() {
 }
 
 void MondainLogic::entering() {
-	_G(savegame)._locationPosition = Common::Point(3, 4);
-	_G(savegame)._mondainPos = Common::Point(15, 4);
+	Data::Savegame &sg = _G(savegame);
+
+	// Discard anything a previous visit left in the room (placed barriers,
+	// conjured hazards, stale position markers)
+	_G(map).resetMondainMap();
+
+	// Fixed starting positions - the player by the time machine on the west
+	// wall, Mondain across the room to the east. These match the MTILE_PLAYER
+	// marker baked into MONDAIN_MAP; Mondain is drawn purely as an overlay,
+	// so his cell stays 0 in the map data
+	sg._locationPosition = Common::Point(3, 4);
+	sg._mondainPos = Common::Point(15, 4);
+
+	// The original re-launches a dedicated executable for this encounter, so
+	// every bit of its state starts from that executable's static
+	// initializers. We reuse the one long-lived Savegame, so reset the same
+	// state here to those values - otherwise a second visit (via the debug
+	// map command, say) would inherit a dead or half-fought Mondain
+	sg._mondainHits = 1000;
+	sg._mondainPhase = 2;
+	sg._mondainPhaseAnimOffset = 0;
+	sg._mondainPhaseTimer = 20;
+	sg._mondainHitAnimFrame = 0;
+	sg._mondainHitAnimDir = 0;
+	sg._mondainCombatFlag = 0;
+	sg._gemDestroyedFlag = false;
+	sg._mondainDefeatedFlag = 0;
+	sg._mondainHazardAnim = -1;
 }
 
 bool MondainLogic::move(Data::Direction dir) {
diff --git a/engines/ultima/ultima1/views/interactions/entering_craft.cpp b/engines/ultima/ultima1/views/interactions/entering_craft.cpp
index 4f10bac73ad..cc87ec21362 100644
--- a/engines/ultima/ultima1/views/interactions/entering_craft.cpp
+++ b/engines/ultima/ultima1/views/interactions/entering_craft.cpp
@@ -184,6 +184,7 @@ void EnteringCraft::nextPage() {
 	} else {
 		close();
 		_G(map).load(Data::MAP_MONDAIN);
+		_G(logic)->entering();
 	}
 }
 


Commit: a7e32a237296c94a5a4bca224c1e8e9e9f48c92b
    https://github.com/scummvm/scummvm/commit/a7e32a237296c94a5a4bca224c1e8e9e9f48c92b
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:40:52+11:00

Commit Message:
ULTIMA: ULTIMA1: Added overworld Quit command

Changed paths:
    engines/ultima/ultima1/logic/overworld_logic.cpp
    engines/ultima/ultima1/logic/overworld_logic.h
    engines/ultima/ultima1/ultima1.cpp


diff --git a/engines/ultima/ultima1/logic/overworld_logic.cpp b/engines/ultima/ultima1/logic/overworld_logic.cpp
index 2289232735d..7bdb9bf5597 100644
--- a/engines/ultima/ultima1/logic/overworld_logic.cpp
+++ b/engines/ultima/ultima1/logic/overworld_logic.cpp
@@ -200,6 +200,16 @@ bool OverworldLogic::fire() {
 	}
 }
 
+bool OverworldLogic::quit() {
+	writeString("Quit - saving game...");
+	g_engine->updateScreen();
+	if (g_engine->saveGameDialog())
+		writeString("saved.");
+	writeString("\n");
+
+	return true;
+}
+
 bool OverworldLogic::move(Data::Direction dir) {
 	if (!moveCheck(dir))
 		return true;
diff --git a/engines/ultima/ultima1/logic/overworld_logic.h b/engines/ultima/ultima1/logic/overworld_logic.h
index bb129550687..451e6cfa270 100644
--- a/engines/ultima/ultima1/logic/overworld_logic.h
+++ b/engines/ultima/ultima1/logic/overworld_logic.h
@@ -144,6 +144,11 @@ protected:
 	 */
 	bool fire() override;
 
+	/**
+	 * Quit - Save the Game
+	 */
+	bool quit() override;
+
 	/**
 	 * Handle movement
 	 */
diff --git a/engines/ultima/ultima1/ultima1.cpp b/engines/ultima/ultima1/ultima1.cpp
index 541b1316a4c..814139ad108 100644
--- a/engines/ultima/ultima1/ultima1.cpp
+++ b/engines/ultima/ultima1/ultima1.cpp
@@ -80,6 +80,9 @@ bool Ultima1Engine::canSaveGameStateCurrently(Common::U32String *msg) {
 }
 
 Common::Error Ultima1Engine::syncGame(Common::Serializer &s) {
+	if (s.isSaving())
+		_G(savegame)._moveCount = _moveCtr;
+
 	_savegame.synchronize(s);
 
 	if (s.isLoading()) {


Commit: bc99ff9c18df4a9207573787e2baf6cd2d69a7ce
    https://github.com/scummvm/scummvm/commit/bc99ff9c18df4a9207573787e2baf6cd2d69a7ce
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:40:52+11:00

Commit Message:
ULTIMA: ULTIMA1: Dungeon creature movement

Changed paths:
    engines/ultima/ultima1/data/map_dungeon.h
    engines/ultima/ultima1/logic/dungeon_logic.cpp
    engines/ultima/ultima1/logic/dungeon_logic.h


diff --git a/engines/ultima/ultima1/data/map_dungeon.h b/engines/ultima/ultima1/data/map_dungeon.h
index 20b777a1c19..aadd6172393 100644
--- a/engines/ultima/ultima1/data/map_dungeon.h
+++ b/engines/ultima/ultima1/data/map_dungeon.h
@@ -47,6 +47,12 @@ constexpr int UMONS_GELATINOUS_CUBE = 9;
 constexpr int UMONS_MIMIC = 11;
 constexpr int UMONS_INVISIBLE_SEEKER = 20;
 
+// Monster Ids with a special effect on a successful melee hit (see
+// DungeonLogic::dungeonMonsterAttack)
+constexpr int UMONS_THIEF = 2;
+constexpr int UMONS_GREMLIN = 16;
+constexpr int UMONS_MIND_WHIPPER = 21;
+
 // Dungeon monster names, indexed by DungeonCell::_monsterId (0-24)
 extern const char *UNDERWORLD_MONSTERS[];
 
diff --git a/engines/ultima/ultima1/logic/dungeon_logic.cpp b/engines/ultima/ultima1/logic/dungeon_logic.cpp
index d3b235fa67b..d7bbde912c8 100644
--- a/engines/ultima/ultima1/logic/dungeon_logic.cpp
+++ b/engines/ultima/ultima1/logic/dungeon_logic.cpp
@@ -21,6 +21,7 @@
  */
 
 #include "ultima/ultima1/logic/dungeon_logic.h"
+#include "ultima/ultima1/core/strings.h"
 #include "ultima/ultima1/metaengine.h"
 #include "ultima/ultima1/ultima1.h"
 
@@ -28,6 +29,10 @@ namespace Ultima {
 namespace Ultima1 {
 namespace Logic {
 
+static int sgn(int v) {
+	return (v > 0) - (v < 0);
+}
+
 DungeonLogic::DungeonLogic() {
 	_G(map)._mapType = Data::MAPTYPE_DUNGEON;
 	if (_G(savegame)._dungeonLevel == 0)
@@ -288,7 +293,164 @@ bool DungeonLogic::climb() {
 }
 
 void DungeonLogic::updateCreatures() {
-	// TODO
+	Data::Savegame &sg = _G(savegame);
+	Data::MapDungeon &dungeon = _G(dungeon);
+	const Common::Point &pos = sg._locationPosition;
+
+	// Cells a monster has already been stepped into this turn, so the grid
+	// sweep doesn't keep pushing the same monster along ahead of it (the
+	// original marks the destination cell's _itemId with a temporary +1000
+	// and clears it again in a second pass)
+	bool moved[Data::DUNGEON_HEIGHT][Data::DUNGEON_WIDTH] = {};
+
+	// The "did this monster take a step" result deliberately carries over
+	// between monsters, exactly as the original's shared local does: a
+	// monster already lined up with the player on one axis only tries the
+	// other axis when the previously processed monster didn't move
+	bool stepped = false;
+
+	for (int x = 1; x <= 9; ++x) {
+		for (int y = 1; y <= 9; ++y) {
+			const Data::DungeonCell &cell = dungeon._cells[y][x];
+			if (cell._monsterId == Data::DUNGEON_NO_MONSTER || moved[y][x])
+				continue;
+
+			int deltaX = pos.x - x;
+			int deltaY = pos.y - y;
+			int distance = ABS(deltaX) + ABS(deltaY);
+
+			if (distance == 1) {
+				dungeonMonsterAttack(deltaX, deltaY);
+			} else if (distance < 7) {
+				int sx = sgn(deltaX);
+				int sy = sgn(deltaY);
+
+				if (sx != 0)
+					stepped = dungeonCreatureMove(x, y, sx, 0, moved);
+				if (!stepped && sy != 0)
+					stepped = dungeonCreatureMove(x, y, 0, sy, moved);
+			}
+
+			if (sg._hits <= 0 || sg._food <= 0)
+				return;
+		}
+	}
+}
+
+void DungeonLogic::dungeonMonsterAttack(int deltaX, int deltaY) {
+	Data::Savegame &sg = _G(savegame);
+	Data::MapDungeon &dungeon = _G(dungeon);
+	const Common::Point &pos = sg._locationPosition;
+
+	// Standing in the beams keeps every monster's melee off
+	if (dungeon._cells[pos.y][pos.x]._tileNum == Data::DTILE_BEAMS)
+		return;
+
+	int monsterX = pos.x - deltaX;
+	int monsterY = pos.y - deltaY;
+
+	// A monster attacking out of a doorway can't reach the player if the
+	// player's own tile is a door/wall/secret door
+	if (dungeon._cells[monsterY][monsterX]._tileNum == Data::DTILE_DOOR) {
+		Data::DungeonTileId hereTile = dungeon._cells[pos.y][pos.x]._tileNum;
+		if (hereTile == Data::DTILE_DOOR || hereTile == Data::DTILE_WALL ||
+				hereTile == Data::DTILE_SECRET_DOOR)
+			return;
+	}
+
+	int monsterId = dungeon._cells[monsterY][monsterX]._monsterId;
+
+	writeString("Attacked by ");
+	writeMonsterName(monsterId);
+	writeString("!\n");
+	playFX(3);
+
+	// As with the player's own weapon attacks, a higher stamina/armour
+	// actually *raises* this to-hit threshold in the original rather than
+	// lowering it
+	int hitThreshold = sg._stamina / 2 + (sg._equippedArmor << 3) + 56;
+	if (getRandomNumber(1, 255) > hitThreshold) {
+		writeString("Missed!\n");
+		return;
+	}
+
+	int specialRoll = getRandomNumber(1, 255);
+
+	int damage = sg._dungeonLevel + monsterId * monsterId;
+	if (damage > 255)
+		damage = getRandomNumber(monsterId + 1, 255);
+
+	bool dealDamage = true;
+
+	if (monsterId == Data::UMONS_GELATINOUS_CUBE && sg._equippedArmor != Data::ARMOR_NONE) {
+		writeString("Armor destroyed!\n");
+		--sg._armor[sg._equippedArmor];
+		sg._equippedArmor = Data::ARMOR_NONE;
+		dealDamage = false;
+
+	} else if (monsterId == Data::UMONS_GREMLIN) {
+		writeString("A gremlin stole some food!\n");
+		sg._food /= 2;
+		redrawStats();
+		dealDamage = false;
+
+	} else if (monsterId == Data::UMONS_MIND_WHIPPER && specialRoll < 128) {
+		writeString("Mental attack!\n");
+		sg._intelligence = sg._intelligence / 2 + 5;
+		dealDamage = false;
+
+	} else if (monsterId == Data::UMONS_THIEF) {
+		// Steals the first spare weapon that isn't the one readied - the
+		// thief still lands its hit as well
+		for (int w = Data::WEAPON_DAGGER; w < Data::WEAPON_COUNT; ++w) {
+			if (sg._weapons[w] != 0 && w != sg._equippedWeapon) {
+				const char *name = Data::WEAPON_NAMES[w];
+				writeString("Thief stole a");
+				writeString(isVowel(*name) ? "n " : " ");
+				if (Common::String(name).size() > 11)
+					writeString("\n");
+				writeString("%s\n", name);
+				--sg._weapons[w];
+				break;
+			}
+		}
+	}
+
+	if (dealDamage) {
+		playFX(2);
+		writeString("Hit! %d damage!\n", damage);
+		sg._hits -= damage;
+		redrawStats();
+	}
+}
+
+bool DungeonLogic::dungeonCreatureMove(int x, int y, int deltaX, int deltaY,
+		bool moved[][Data::DUNGEON_WIDTH]) {
+	Data::MapDungeon &dungeon = _G(dungeon);
+	int newX = x + deltaX;
+	int newY = y + deltaY;
+
+	Data::DungeonTileId destTile = dungeon._cells[newY][newX]._tileNum;
+	if (destTile == Data::DTILE_WALL || destTile == Data::DTILE_SECRET_DOOR ||
+			destTile == Data::DTILE_BEAMS)
+		return false;
+	if (dungeon._cells[newY][newX]._monsterId != Data::DUNGEON_NO_MONSTER)
+		return false;
+
+	Data::DungeonCell &src = dungeon._cells[y][x];
+	Data::DungeonCell &dest = dungeon._cells[newY][newX];
+
+	dest._monsterId = src._monsterId;
+	// The original moves only _monsterId, leaving a chasing monster with
+	// whatever hit points the destination cell held (0 for empty floor) -
+	// carrying _monsterHp across keeps a moving monster as tough as a
+	// stationary one
+	dest._monsterHp = src._monsterHp;
+	src._monsterId = Data::DUNGEON_NO_MONSTER;
+	src._monsterHp = 0;
+
+	moved[newY][newX] = true;
+	return true;
 }
 
 void DungeonLogic::showNearbyText() {
diff --git a/engines/ultima/ultima1/logic/dungeon_logic.h b/engines/ultima/ultima1/logic/dungeon_logic.h
index ca3511a5003..757b085d49b 100644
--- a/engines/ultima/ultima1/logic/dungeon_logic.h
+++ b/engines/ultima/ultima1/logic/dungeon_logic.h
@@ -23,6 +23,7 @@
 #ifndef ULTIMA2_LOGIC_DUNGEON_LOGIC_H
 #define ULTIMA2_LOGIC_DUNGEON_LOGIC_H
 
+#include "ultima/ultima1/data/map_dungeon.h"
 #include "ultima/ultima1/logic/logic.h"
 
 namespace Ultima {
@@ -110,6 +111,25 @@ private:
 	 */
 	void dungeonAttackAt(int effectNum, int agility, int strike, int x, int y);
 
+	/**
+	 * A dungeon monster's melee attack on the player, when it's in an
+	 * adjacent cell. deltaX/deltaY point from the monster to the player.
+	 * Some monster types have a special effect instead of (or as well as)
+	 * plain damage - the gelatinous cube destroys armour, the gremlin eats
+	 * food, the mind whipper drains intelligence, the thief pinches a
+	 * spare weapon
+	 */
+	void dungeonMonsterAttack(int deltaX, int deltaY);
+
+	/**
+	 * Tries to step the monster at (x, y) by (deltaX, deltaY). Fails on a
+	 * wall/secret door/beams tile or an occupied cell. On success the
+	 * destination is flagged in `moved` so the grid scan doesn't advance
+	 * the same monster again this turn
+	 */
+	bool dungeonCreatureMove(int x, int y, int deltaX, int deltaY,
+		bool moved[][Data::DUNGEON_WIDTH]);
+
 	/**
 	 * Returns the magic "strike" power of the currently readied weapon,
 	 * used by the Magic Missile spell - a random value up to the player's


Commit: 57fc8d648d4b76518e1f107da140720ee58d3637
    https://github.com/scummvm/scummvm/commit/57fc8d648d4b76518e1f107da140720ee58d3637
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:40:52+11:00

Commit Message:
ULTIMA: ULTIMA1: Remaining commands finished

Changed paths:
    engines/ultima/ultima1/data/map_dungeon.cpp
    engines/ultima/ultima1/data/map_dungeon.h
    engines/ultima/ultima1/data/tiles.h
    engines/ultima/ultima1/logic/city_castle_logic.cpp
    engines/ultima/ultima1/logic/city_castle_logic.h
    engines/ultima/ultima1/logic/dungeon_logic.cpp
    engines/ultima/ultima1/logic/dungeon_logic.h
    engines/ultima/ultima1/logic/logic.cpp
    engines/ultima/ultima1/logic/logic.h
    engines/ultima/ultima1/logic/overworld_logic.cpp
    engines/ultima/ultima1/logic/overworld_logic.h


diff --git a/engines/ultima/ultima1/data/map_dungeon.cpp b/engines/ultima/ultima1/data/map_dungeon.cpp
index 3313d42ce73..6dc77f621f2 100644
--- a/engines/ultima/ultima1/data/map_dungeon.cpp
+++ b/engines/ultima/ultima1/data/map_dungeon.cpp
@@ -187,6 +187,32 @@ void MapDungeon::dungeonSpawnMonster() {
 	_cells[y][x]._monsterHp = getRandomNumber(1, dungeonLevel * dungeonLevel + 1) + 10 + monsterId;
 }
 
+void MapDungeon::spawnMonsterAt(int x, int y) {
+	DungeonCell &cell = _cells[y][x];
+
+	if (cell._tileNum != DTILE_HALLWAY && cell._tileNum != DTILE_LADDER_UP &&
+			cell._tileNum != DTILE_LADDER_DOWN)
+		return;
+	if (cell._monsterId != DUNGEON_NO_MONSTER)
+		return;
+
+	// Prefer an unused slot, but a coffin doesn't free one up first the way
+	// a kill does, so fall back to any slot after 50 tries
+	int slot = 0;
+	for (int attempt = 0; attempt < 50; ++attempt) {
+		slot = getRandomNumber(0, 49) / 10;
+		if (!_monsterSlotUsed[slot])
+			break;
+	}
+	_monsterSlotUsed[slot] = true;
+
+	int dungeonLevel = _G(savegame)._dungeonLevel;
+	int monsterId = (dungeonLevel - 1) / 2 * DUNGEON_MONSTER_SLOTS + slot;
+
+	cell._monsterId = monsterId;
+	cell._monsterHp = getRandomNumber(1, dungeonLevel * dungeonLevel + 1) + 10 + monsterId;
+}
+
 void MapDungeon::killMonster(int x, int y) {
 	DungeonCell &cell = _cells[y][x];
 	_monsterSlotUsed[cell._monsterId % DUNGEON_MONSTER_SLOTS] = false;
diff --git a/engines/ultima/ultima1/data/map_dungeon.h b/engines/ultima/ultima1/data/map_dungeon.h
index aadd6172393..ece20713e8f 100644
--- a/engines/ultima/ultima1/data/map_dungeon.h
+++ b/engines/ultima/ultima1/data/map_dungeon.h
@@ -133,6 +133,14 @@ public:
 	 */
 	void killMonster(int x, int y);
 
+	/**
+	 * Spawns a monster into a specific cell (the original's shiftCoffin) -
+	 * used when opening a coffin. Does nothing unless the cell is open
+	 * floor/a ladder and unoccupied. Unlike a kill, no slot is freed first,
+	 * so it will reuse an already-taken slot after enough tries
+	 */
+	void spawnMonsterAt(int x, int y);
+
 	void synchronize(Common::Serializer &s);
 };
 
diff --git a/engines/ultima/ultima1/data/tiles.h b/engines/ultima/ultima1/data/tiles.h
index c8b703ddb7e..5e0e67cb465 100644
--- a/engines/ultima/ultima1/data/tiles.h
+++ b/engines/ultima/ultima1/data/tiles.h
@@ -91,6 +91,11 @@ enum LocationTileId {
 	CTILE_STEAL_WEAPON = 59,
 	CTILE_MAGIC = 60,
 	CTILE_TAVERN = 61,
+	// In castles, tiles 60/61 are instead the two lock tiles the player
+	// stands on to Unlock a princess's cell - one of them matches the key
+	// (_castleKeyVal), the other is the wrong one
+	CTILE_LOCK1 = 60,
+	CTILE_LOCK2 = 61,
 	// Tile 62 is a transport shop counter in cities, but the king in castles
 	CTILE_TRANSPORT = 62,
 	CTILE_KING = 62,
diff --git a/engines/ultima/ultima1/logic/city_castle_logic.cpp b/engines/ultima/ultima1/logic/city_castle_logic.cpp
index 017a2d9e43a..8637ffc4239 100644
--- a/engines/ultima/ultima1/logic/city_castle_logic.cpp
+++ b/engines/ultima/ultima1/logic/city_castle_logic.cpp
@@ -346,6 +346,13 @@ bool CityCastleLogic::steal() {
 	return true;
 }
 
+bool CityCastleLogic::unlock() {
+	// Cities have nothing to unlock (CastleLogic overrides this)
+	writeString("Unlock what?\n");
+	playFX(1);
+	return true;
+}
+
 bool CityCastleLogic::checkCastlePermission() {
 	if (_G(savegame)._castleItemAllowance <= 0) {
 		writeString("\n");
@@ -705,6 +712,44 @@ bool CastleLogic::transact() {
 	return false;
 }
 
+bool CastleLogic::unlock() {
+	Data::Savegame &sg = _G(savegame);
+	const auto &pos = sg._locationPosition;
+
+	writeString("Unlock");
+
+	// The player has to be standing on one of the two lock tiles (the
+	// princess's barred cell is the cell directly above)
+	int tile = _G(map).getMapTile(pos.x, pos.y);
+	if (tile != Data::CTILE_LOCK1 && tile != Data::CTILE_LOCK2) {
+		writeString(" what?\n");
+		playFX(1);
+		return true;
+	}
+
+	writeString("\n");
+
+	if (!sg._hasCastleKey) {
+		writeString("Thou hast not a key!\n");
+		return true;
+	}
+
+	if (tile != sg._castleKeyVal) {
+		writeString("Thou hast not\n");
+		writeString("the correct key!\n");
+		return true;
+	}
+
+	writeString("The door is open!\n");
+	sg._freeingPrincess = 1;
+
+	// Clear the barred cell above the player so the princess can follow out
+	_G(map)[pos.y - 1][pos.x] = Data::CTILE_GROUND;
+	redrawMap();
+
+	return true;
+}
+
 void CastleLogic::entering() {
 	_G(savegame)._locationPosition = Common::Point(0, 9);
 	CityCastleLogic::entering();
diff --git a/engines/ultima/ultima1/logic/city_castle_logic.h b/engines/ultima/ultima1/logic/city_castle_logic.h
index 37b09e30779..c2d67090ce1 100644
--- a/engines/ultima/ultima1/logic/city_castle_logic.h
+++ b/engines/ultima/ultima1/logic/city_castle_logic.h
@@ -124,6 +124,12 @@ protected:
 	 */
 	bool steal() override;
 
+	/**
+	 * Unlock has no effect in a city ("Unlock what?"); CastleLogic
+	 * overrides it to open a princess's cell
+	 */
+	bool unlock() override;
+
 	/**
 	 * Checks the castle item allowance, consuming one use if available.
 	 * Denies with a message if there isn't one. Used by Get
@@ -210,6 +216,12 @@ protected:
 	 */
 	bool transact() override;
 
+	/**
+	 * Unlocks the barred princess cell the player is standing at - needs
+	 * the castle key, and the lock tile must match the key this visit
+	 */
+	bool unlock() override;
+
 public:
 	CastleLogic();
 	~CastleLogic() override {
diff --git a/engines/ultima/ultima1/logic/dungeon_logic.cpp b/engines/ultima/ultima1/logic/dungeon_logic.cpp
index d7bbde912c8..12b40a731f3 100644
--- a/engines/ultima/ultima1/logic/dungeon_logic.cpp
+++ b/engines/ultima/ultima1/logic/dungeon_logic.cpp
@@ -292,6 +292,92 @@ bool DungeonLogic::climb() {
 	return true;
 }
 
+bool DungeonLogic::unlock() {
+	Data::Savegame &sg = _G(savegame);
+	const Common::Point &pos = sg._locationPosition;
+	Data::DungeonCell &cell = _G(dungeon)._cells[pos.y][pos.x];
+
+	writeString("Unlock chest");
+
+	if (cell._itemId != Data::DITEM_CHEST) {
+		writeString(" - none here!\n");
+		playFX(1);
+		return true;
+	}
+
+	writeString("\n");
+
+	// Wizards pick any lock; everyone else rolls against agility
+	if (getRandomNumber(1, 75) > sg._agility && sg._class != Data::CLASS_WIZARD) {
+		writeString("Thou hast set off a trap!");
+		playFX(2);
+		writeString("\n");
+		sg._hits -= sg._dungeonLevel;
+		redrawStats();
+		return true;
+	}
+
+	cell._itemId = Data::DITEM_NONE;
+	writeString("Thou dost find: ");
+	giveCoins(getRandomNumber(3, sg._dungeonLevel * sg._dungeonLevel + 9));
+	return true;
+}
+
+bool DungeonLogic::open() {
+	Data::Savegame &sg = _G(savegame);
+	Data::MapDungeon &dungeon = _G(dungeon);
+	const Common::Point &pos = sg._locationPosition;
+	Data::DungeonCell &cell = dungeon._cells[pos.y][pos.x];
+
+	writeString("Open coffin");
+
+	if (cell._itemId != Data::DITEM_COFFIN) {
+		writeString(" - none here!\n");
+		playFX(1);
+		return true;
+	}
+
+	writeString("\n");
+
+	int aheadX = pos.x + getDirDeltaX();
+	int aheadY = pos.y + getDirDeltaY();
+	const Data::DungeonCell &ahead = dungeon._cells[aheadY][aheadX];
+
+	// Roughly 40% chance something lurking inside springs out into the cell
+	// ahead (if that cell can take it) - the coffin then stays shut
+	if (getRandomNumber(1, 255) < 104 && ahead._tileNum != Data::DTILE_WALL &&
+			ahead._tileNum != Data::DTILE_SECRET_DOOR &&
+			ahead._monsterId == Data::DUNGEON_NO_MONSTER) {
+		dungeon.spawnMonsterAt(aheadX, aheadY);
+		return true;
+	}
+
+	cell._itemId = Data::DITEM_NONE;
+	writeString("Thou dost find: ");
+	giveCoins(getRandomNumber(3, sg._dungeonLevel * sg._dungeonLevel + 9));
+	return true;
+}
+
+bool DungeonLogic::inform() {
+	writeString("Inform and search\n");
+
+	Data::MapDungeon &dungeon = _G(dungeon);
+	const Common::Point &pos = _G(savegame)._locationPosition;
+	Data::DungeonCell &ahead = dungeon._cells[pos.y + getDirDeltaY()][pos.x + getDirDeltaX()];
+
+	writeString("Thou dost find ");
+
+	if (ahead._tileNum == Data::DTILE_SECRET_DOOR &&
+			dungeon._cells[pos.y][pos.x]._tileNum != Data::DTILE_DOOR) {
+		writeString("a secret door!\n");
+		ahead._tileNum = Data::DTILE_DOOR;
+	} else {
+		writeString("nothing\n");
+	}
+
+	return true;
+}
+
 void DungeonLogic::updateCreatures() {
 	Data::Savegame &sg = _G(savegame);
 	Data::MapDungeon &dungeon = _G(dungeon);
diff --git a/engines/ultima/ultima1/logic/dungeon_logic.h b/engines/ultima/ultima1/logic/dungeon_logic.h
index 757b085d49b..b668655e31c 100644
--- a/engines/ultima/ultima1/logic/dungeon_logic.h
+++ b/engines/ultima/ultima1/logic/dungeon_logic.h
@@ -175,6 +175,24 @@ protected:
 	 */
 	bool climb() override;
 
+	/**
+	 * Unlocks a chest at the player's current cell - an agility check
+	 * (auto-passed by wizards); failure springs a trap for dungeonLevel
+	 * damage, success awards its coins
+	 */
+	bool unlock() override;
+
+	/**
+	 * Opens a coffin at the player's current cell - a chance something
+	 * springs out into the cell ahead, otherwise it yields coins
+	 */
+	bool open() override;
+
+	/**
+	 * Inform/search - reveals a secret door in the direction faced
+	 */
+	bool inform() override;
+
 	/**
 	 * Handles updating creatures/NPCs
 	 */
diff --git a/engines/ultima/ultima1/logic/logic.cpp b/engines/ultima/ultima1/logic/logic.cpp
index 4c6ffaecae0..5f087c89c17 100644
--- a/engines/ultima/ultima1/logic/logic.cpp
+++ b/engines/ultima/ultima1/logic/logic.cpp
@@ -81,7 +81,7 @@ void Logic::endOfTurn() {
 	redrawMap();
 	redrawStats();
 
-	if (_G(savegame)._hits == 0)
+	if (_G(savegame)._hits <= 0)
 		g_engine->addView("Dead");
 }
 
@@ -132,6 +132,12 @@ void Logic::action(int action) {
 	case KEYBIND_EXIT:
 		doEndOfTurn = xit();
 		break;
+	case KEYBIND_UNLOCK:
+		doEndOfTurn = unlock();
+		break;
+	case KEYBIND_VIEW:
+		doEndOfTurn = view();
+		break;
 	case KEYBIND_FIRE:
 		doEndOfTurn = fire();
 		break;
@@ -325,8 +331,23 @@ bool Logic::transact() {
 	return true;
 }
 
+bool Logic::unlock() {
+	// Overworld (and anywhere without its own handling) - nothing to unlock
+	writeString("Unlock?\n");
+	playFX(1);
+	return true;
+}
+
+bool Logic::view() {
+	writeString("View?\n");
+	playFX(1);
+	return true;
+}
+
 bool Logic::xit() {
-	writeString("Xit?\n");
+	// Only means anything on the overworld (dismount a transport); anywhere
+	// else it's just a prompt
+	writeString("X-it?\n");
 	playFX(1);
 	return true;
 }
diff --git a/engines/ultima/ultima1/logic/logic.h b/engines/ultima/ultima1/logic/logic.h
index 66140270215..e80a860755a 100644
--- a/engines/ultima/ultima1/logic/logic.h
+++ b/engines/ultima/ultima1/logic/logic.h
@@ -152,6 +152,8 @@ protected:
 	virtual bool ready();
 	virtual bool steal();
 	virtual bool transact();
+	virtual bool unlock();
+	virtual bool view();
 	virtual bool xit();
 	virtual bool zstats();
 	virtual bool move(Data::Direction dir) {
diff --git a/engines/ultima/ultima1/logic/overworld_logic.cpp b/engines/ultima/ultima1/logic/overworld_logic.cpp
index 7bdb9bf5597..15df6141bfa 100644
--- a/engines/ultima/ultima1/logic/overworld_logic.cpp
+++ b/engines/ultima/ultima1/logic/overworld_logic.cpp
@@ -210,6 +210,57 @@ bool OverworldLogic::quit() {
 	return true;
 }
 
+bool OverworldLogic::xit() {
+	Data::Savegame &sg = _G(savegame);
+	const Common::Point &pos = sg._overworldPos;
+
+	if (sg._transportType == Data::TRANSPORT_FOOT) {
+		writeString("X-it what?\n");
+		playFX(1);
+		return true;
+	}
+
+	// The original compares the terrain tile straight against TRANSPORT_CART,
+	// which numerically just means "ocean, grass or woods" (tiles 0-2) - you
+	// can't step off onto mountains or a location tile. It also needs dry
+	// land within a couple of tiles
+	int terrain = _G(map).getMapTile(pos.x, pos.y);
+
+	bool landNearby = false;
+	for (int dy = -2; dy <= 2; ++dy) {
+		for (int dx = -2; dx <= 2; ++dx) {
+			if (_G(map).getMapTile(pos.x + dx, pos.y + dy) != Data::TILE_OCEAN)
+				landNearby = true;
+		}
+	}
+
+	if (terrain > Data::TILE_WOODS || !landNearby) {
+		writeString("Thy canst not leave it here!\n");
+		playFX(1);
+		return true;
+	}
+
+	// Drop the vehicle where the player stands as a re-boardable entity,
+	// then carry on afoot
+	int vehicleTile = sg._overworldEntities[0]._type;
+	if (_G(overworldEntityCount) < Data::OVERWORLD_ENTITY_COUNT - 1) {
+		++_G(overworldEntityCount);
+		auto &e = sg._overworldEntities[_G(overworldEntityCount)];
+		e._type = vehicleTile;
+		e._data = terrain;
+		e._x = pos.x;
+		e._y = pos.y;
+		e._hits = 0;
+	}
+
+	sg._overworldEntities[0]._data = vehicleTile;
+	sg._overworldEntities[0]._type = Data::TILE_PLAYER;
+	sg._transportType = Data::TRANSPORT_FOOT;
+
+	writeString("X-it\n");
+	return true;
+}
+
 bool OverworldLogic::move(Data::Direction dir) {
 	if (!moveCheck(dir))
 		return true;
@@ -603,12 +654,33 @@ void OverworldLogic::castPrayer() {
 		flag = true;
 
 	} else if (getRandomNumber(1, 100) < 25) {
-		// TODO
-		flag = true;
+		// A rarer answered prayer: the first monster close enough to strike
+		// at the player is whisked away
+		Data::Savegame &sg = _G(savegame);
+
+		for (int idx = 1; idx <= _G(overworldEntityCount); ++idx) {
+			Data::OverworldEntity &e = sg._overworldEntities[idx];
+			if (e._type < Data::TILE_FIRST_MONSTER)
+				continue;
+
+			int xDiff = sg._overworldPos.x - e._x;
+			int yDiff = sg._overworldPos.y - e._y;
+			if (Data::OverworldEntity::getMonsterAttackDistance(e._type, xDiff, yDiff) == 0)
+				continue;
+
+			showAttackTile(e._x, e._y, Data::TILE_SPELL_ATTACK);
+			writeString("Monster removed!\n");
+			playFX(5);
+			sg.removeOverworldCreatureAt(e._x, e._y);
+			--_G(creaturesCount);
+			flag = true;
+			break;
+		}
 	}
 
 	if (!flag) {
-		// TODO
+		writeString("Hmmmm... no effect!\n");
+		playFX(6);
 	}
 }
 
diff --git a/engines/ultima/ultima1/logic/overworld_logic.h b/engines/ultima/ultima1/logic/overworld_logic.h
index 451e6cfa270..38c0fdd9e63 100644
--- a/engines/ultima/ultima1/logic/overworld_logic.h
+++ b/engines/ultima/ultima1/logic/overworld_logic.h
@@ -149,6 +149,11 @@ protected:
 	 */
 	bool quit() override;
 
+	/**
+	 * eXit - dismount the current transport, dropping it on the map
+	 */
+	bool xit() override;
+
 	/**
 	 * Handle movement
 	 */


Commit: 186454d69e27150ccffb4cb9d9de573ed84331ea
    https://github.com/scummvm/scummvm/commit/186454d69e27150ccffb4cb9d9de573ed84331ea
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:40:52+11:00

Commit Message:
ULTIMA: ULTIMA1: Transact merchant fixes

Changed paths:
    engines/ultima/ultima1/logic/city_castle_logic.cpp
    engines/ultima/ultima1/views/interactions/merchant.cpp


diff --git a/engines/ultima/ultima1/logic/city_castle_logic.cpp b/engines/ultima/ultima1/logic/city_castle_logic.cpp
index 8637ffc4239..da02137d338 100644
--- a/engines/ultima/ultima1/logic/city_castle_logic.cpp
+++ b/engines/ultima/ultima1/logic/city_castle_logic.cpp
@@ -124,6 +124,7 @@ static const int8 DELTA_Y[5] = { 0, 0, 0, -1, 1 };
 
 void CityCastleLogic::entering() {
 	loadEntities();
+	_G(savegame)._guardsHostile = false;
 }
 
 void CityCastleLogic::leaving() {
diff --git a/engines/ultima/ultima1/views/interactions/merchant.cpp b/engines/ultima/ultima1/views/interactions/merchant.cpp
index 71d65278e5c..3f51a117122 100644
--- a/engines/ultima/ultima1/views/interactions/merchant.cpp
+++ b/engines/ultima/ultima1/views/interactions/merchant.cpp
@@ -276,6 +276,10 @@ int Merchant::overworldTransportCount() const {
 }
 
 void Merchant::chooseBuy() {
+	resetLine();
+	writeString("Transact-Buy: ");
+	showCursor();
+
 	switch (_shopType) {
 	case SHOP_ARMORY:
 	case SHOP_WEAPONS:
@@ -340,6 +344,10 @@ void Merchant::chooseBuy() {
 }
 
 void Merchant::chooseSell() {
+	resetLine();
+	writeString("Transact-Sell: ");
+	showCursor();
+
 	switch (_shopType) {
 	case SHOP_ARMORY: {
 		bool anyOwned = false;
@@ -482,8 +490,13 @@ void Merchant::armorySellKeypress(Common::KeyCode keycode) {
 
 void Merchant::weaponsRange(int &minIdx, int &maxIdx) const {
 	int base = (((_G(map)._mapStyle - 1) & 1) == 0) ? 1 : 2;
+
+	// The stock widens as the game goes on: one more weapon offered per 1500
+	// moves, up to a cap of 3 extra tiers (then a 4th once past 3000 moves).
+	// The original takes moveCtr % 0x7FFF before the /1500, but with the
+	// > 3000 branch forcing tier 3 that modulo never changes the result
 	uint32 moveCtr = _G(moveCtr);
-	int tier = (moveCtr <= 3000) ? MIN<uint32>(moveCtr % 1500, 3) : 3;
+	int tier = (moveCtr <= 3000) ? MIN<uint32>((moveCtr % 0x7FFF) / 1500, 3) : 3;
 
 	minIdx = base;
 	maxIdx = base + (tier + 1) * 2;


Commit: 47e94a32edcb63f89c45e32c905b73109100c4b9
    https://github.com/scummvm/scummvm/commit/47e94a32edcb63f89c45e32c905b73109100c4b9
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:40:52+11:00

Commit Message:
ULTIMA: ULTIMA1: Start of outer space, sector scan dialog

Changed paths:
  A engines/ultima/ultima1/data/space_map.cpp
  A engines/ultima/ultima1/data/space_map.h
  A engines/ultima/ultima1/views/interactions/sector_scan.cpp
  A engines/ultima/ultima1/views/interactions/sector_scan.h
    engines/ultima/module.mk
    engines/ultima/ultima1/logic/space_logic.cpp
    engines/ultima/ultima1/logic/space_logic.h
    engines/ultima/ultima1/ultima1.h
    engines/ultima/ultima1/views/interactions/liftoff.cpp
    engines/ultima/ultima1/views/views.h


diff --git a/engines/ultima/module.mk b/engines/ultima/module.mk
index bb75f648152..f58cccb7669 100644
--- a/engines/ultima/module.mk
+++ b/engines/ultima/module.mk
@@ -58,6 +58,7 @@ MODULE_OBJS += \
 	ultima1/data/map.o \
 	ultima1/data/map_dungeon.o \
 	ultima1/data/savegame.o \
+	ultima1/data/space_map.o \
 	ultima1/data/tiles.o \
 	ultima1/gfx/pic_decoder.o \
 	ultima1/gfx/text_cursor.o \
@@ -81,6 +82,7 @@ MODULE_OBJS += \
 	ultima1/views/interactions/pillar.o \
 	ultima1/views/interactions/princess_saved.o \
 	ultima1/views/interactions/ready.o \
+	ultima1/views/interactions/sector_scan.o \
 	ultima1/views/interactions/win.o \
 	ultima1/views/view.o \
 	ultima1/views/commands.o \
diff --git a/engines/ultima/ultima1/data/space_map.cpp b/engines/ultima/ultima1/data/space_map.cpp
new file mode 100644
index 00000000000..b1608b42140
--- /dev/null
+++ b/engines/ultima/ultima1/data/space_map.cpp
@@ -0,0 +1,111 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "common/util.h"
+#include "ultima/ultima1/data/space_map.h"
+#include "ultima/ultima1/ultima1.h"
+
+namespace Ultima {
+namespace Ultima1 {
+namespace Data {
+
+int SpaceMap::getRandomNumber(int minVal, int maxVal) {
+	// seed = ror16(seed + 0x9248, 3)
+	_randomSeed = (uint16)(_randomSeed + 0x9248);
+	_randomSeed = (uint16)((_randomSeed >> 3) | (_randomSeed << 13));
+
+	int clampedMax = (maxVal > 255) ? 255 : maxVal;
+	int range = clampedMax - minVal;
+	int result = _randomSeed & 0x3ff;
+	while (result > range)
+		result -= range;
+
+	return (result + minVal) & 0xff;
+}
+
+void SpaceMap::setup() {
+	_randomSeed = (uint16)((int)_G(savegame)._randomSeed * 3 / 2);
+
+	for (int x = 0; x < SPACE_SECTOR_COUNT; ++x)
+		for (int y = 0; y < SPACE_SECTOR_COUNT; ++y)
+			_sectors[x][y] = SpaceMapCell();
+
+	for (int x = 0; x < SPACE_SECTOR_COUNT; ++x)
+		for (int y = 0; y < SPACE_SECTOR_COUNT; ++y)
+			setupSector(x, y);
+
+	// Sector (3,3) is always the space station: a fixed hazard, a fixed
+	// docking anchor, and no roaming enemies
+	SpaceMapCell &station = _sectors[SPACE_STATION_X][SPACE_STATION_Y];
+	station._enemyCount = 0;
+	station._hazardX = 140;
+	station._hazardY = 70;
+	station._anchorX = 200;
+	station._anchorY = 100;
+
+	// TODO: setupSpaceMap also parks two fighters (ships[0]/[1]) at the
+	// station and places the player's own shuttle (ships[3], fuel/shield
+	// from _savegame._shipFuel/_shipShield). Needed for docking and combat,
+	// not for the sector scan
+}
+
+void SpaceMap::setupSector(int x, int y) {
+	SpaceMapCell &cell = _sectors[x][y];
+
+	for (int i = 0; i < SPACE_SHIPS_PER_SECTOR; ++i)
+		cell._ships[i]._shipType = SHIP_NONE;
+
+	cell._enemyCount = getRandomNumber(0, 240) / 40;
+	if (cell._enemyCount > 3)
+		cell._enemyCount = 0;
+
+	int hazardX = 0, hazardY = 0, anchorX = 0, anchorY = 0;
+
+	// ~38% of sectors have a star / heat hazard
+	if (getRandomNumber(1, 200) < 77) {
+		hazardX = getRandomNumber(50, 200);
+		hazardY = getRandomNumber(50, 120);
+	}
+	cell._hazardX = hazardX;
+	cell._hazardY = hazardY;
+
+	// ~38% have an encounter anchor - discarded again if it would sit too
+	// close to the hazard on either axis
+	if (getRandomNumber(1, 200) < 77) {
+		anchorX = getRandomNumber(50, 200);
+		anchorY = getRandomNumber(50, 100);
+
+		if (ABS(anchorX - hazardX) < 40 || ABS(anchorY - hazardY) < 40) {
+			anchorX = 0;
+			anchorY = 0;
+		}
+	}
+	cell._anchorX = anchorX;
+	cell._anchorY = anchorY;
+
+	// TODO: with a non-zero anchor, setupSpaceSector then clusters 1-2
+	// encounter ships around it (using the DELTA_X/DELTA_Y parking tables
+	// and the checkOverlap* helpers). Not needed for the sector scan
+}
+
+} // namespace Data
+} // namespace Ultima1
+} // namespace Ultima
diff --git a/engines/ultima/ultima1/data/space_map.h b/engines/ultima/ultima1/data/space_map.h
new file mode 100644
index 00000000000..f4c1b07aea4
--- /dev/null
+++ b/engines/ultima/ultima1/data/space_map.h
@@ -0,0 +1,112 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef ULTIMA1_DATA_SPACE_MAP_H
+#define ULTIMA1_DATA_SPACE_MAP_H
+
+#include "common/scummsys.h"
+
+namespace Ultima {
+namespace Ultima1 {
+namespace Data {
+
+// The galaxy is a 7x7 grid of sectors
+constexpr int SPACE_SECTOR_COUNT = 7;
+
+// The station sector, where the player arrives and can dock/land
+constexpr int SPACE_STATION_X = 3;
+constexpr int SPACE_STATION_Y = 3;
+
+// Up to 4 ships can be present in a sector at once (parked fighters, the
+// player's own ship, spawned attackers)
+constexpr int SPACE_SHIPS_PER_SECTOR = 4;
+
+// Ship types (SHIP_* in the disassembly)
+enum SpaceShipType {
+	SHIP_NONE = -1,
+	SHIP_SHUTTLE = 0,			// the only type that can land back on Sosaria
+	SHIP_LARGE_FIGHTER = 1,		// "Fighter 1" - high fuel
+	SHIP_SMALL_FIGHTER = 2		// "Fighter 2" - heavy shields
+};
+
+/**
+ * A single ship occupying one of a sector's ship slots
+ */
+struct SpaceMapShip {
+	int16 _x = 0, _y = 0;
+	int16 _shipType = SHIP_NONE;
+	int16 _fuel = 0;
+	int16 _shield = 0;
+	int16 _facing = 0;
+};
+
+/**
+ * One sector of the galaxy grid
+ */
+struct SpaceMapCell {
+	// Hostile ships that will attack in this sector (0-3)
+	int16 _enemyCount = 0;
+	// A star / heat hazard - flying within 25 units destroys the ship.
+	// (0, 0) means none in this sector
+	int16 _hazardX = 0, _hazardY = 0;
+	// The docking / encounter anchor that any ships in the sector cluster
+	// around (the space station itself in sector 3,3). (0, 0) means the
+	// sector has no ships
+	int16 _anchorX = 0, _anchorY = 0;
+
+	SpaceMapShip _ships[SPACE_SHIPS_PER_SECTOR];
+};
+
+/**
+ * The whole galaxy. Regenerated from the savegame's random seed each time
+ * the player lifts off into space (it isn't itself part of the savegame),
+ * matching the original SPACE.EXE's setupSpaceMap
+ */
+struct SpaceMap {
+private:
+	uint16 _randomSeed = 0;
+
+	/**
+	 * The original's own LFSR, seeded from the savegame - kept separate
+	 * from the engine RNG so a given seed always lays out the same galaxy
+	 */
+	int getRandomNumber(int minVal, int maxVal);
+
+	/**
+	 * Rolls the contents of one sector (setupSpaceSector)
+	 */
+	void setupSector(int x, int y);
+
+public:
+	// Indexed [x][y], matching the original's column-major layout
+	SpaceMapCell _sectors[SPACE_SECTOR_COUNT][SPACE_SECTOR_COUNT];
+
+	/**
+	 * (Re)generates the whole galaxy
+	 */
+	void setup();
+};
+
+} // namespace Data
+} // namespace Ultima1
+} // namespace Ultima
+
+#endif
diff --git a/engines/ultima/ultima1/logic/space_logic.cpp b/engines/ultima/ultima1/logic/space_logic.cpp
index 951d166961a..6243b66c361 100644
--- a/engines/ultima/ultima1/logic/space_logic.cpp
+++ b/engines/ultima/ultima1/logic/space_logic.cpp
@@ -33,7 +33,17 @@ SpaceLogic::SpaceLogic() {
 }
 
 void SpaceLogic::entering() {
-	// TODO
+	// The original re-launches SPACE.EXE each time, always starting fresh
+	// at the station sector with a newly rolled galaxy
+	_G(sectorX) = Data::SPACE_STATION_X;
+	_G(sectorY) = Data::SPACE_STATION_Y;
+	_G(spaceMap).setup();
+}
+
+bool SpaceLogic::inform() {
+	writeString("Inform and Search\n");
+	g_engine->addView("SectorScan");
+	return false;
 }
 
 } // namespace Logic
diff --git a/engines/ultima/ultima1/logic/space_logic.h b/engines/ultima/ultima1/logic/space_logic.h
index cb4725a4afc..4b89462fca4 100644
--- a/engines/ultima/ultima1/logic/space_logic.h
+++ b/engines/ultima/ultima1/logic/space_logic.h
@@ -41,6 +41,11 @@ protected:
 	void updateCreatures() override {
 	}
 
+	/**
+	 * Inform - shows the animated sector scan of the galaxy
+	 */
+	bool inform() override;
+
 public:
 	SpaceLogic();
 	~SpaceLogic() override {
diff --git a/engines/ultima/ultima1/ultima1.h b/engines/ultima/ultima1/ultima1.h
index 0e9a1d60437..1d41c20e392 100644
--- a/engines/ultima/ultima1/ultima1.h
+++ b/engines/ultima/ultima1/ultima1.h
@@ -40,6 +40,7 @@
 #include "ultima/ultima1/data/map.h"
 #include "ultima/ultima1/data/map_dungeon.h"
 #include "ultima/ultima1/data/savegame.h"
+#include "ultima/ultima1/data/space_map.h"
 #include "ultima/ultima1/data/tiles.h"
 #include "ultima/ultima1/logic/logic.h"
 
@@ -66,12 +67,16 @@ protected:
 public:
 	Data::Map _map;
 	Data::MapDungeon _dungeon;
+	Data::SpaceMap _spaceMap;
 	Data::Savegame _savegame;
 	Common::SharedPtr<Logic::Logic> _logic;
 	int _overworldEntityCount = 0;
 	int _creaturesCount = 0;
 	uint32 _moveCtr = 0;
 	int _transportFoodCtr = 0;
+	// The player's current galaxy sector while in outer space
+	int _sectorX = Data::SPACE_STATION_X;
+	int _sectorY = Data::SPACE_STATION_Y;
 
 public:
 	Ultima1Engine(OSystem *syst, const Ultima::UltimaGameDescription *gameDesc);
diff --git a/engines/ultima/ultima1/views/interactions/liftoff.cpp b/engines/ultima/ultima1/views/interactions/liftoff.cpp
index 5b97bc86ff4..25a26656bed 100644
--- a/engines/ultima/ultima1/views/interactions/liftoff.cpp
+++ b/engines/ultima/ultima1/views/interactions/liftoff.cpp
@@ -73,6 +73,7 @@ void LiftOff::finish() {
 
 	close();
 	_G(map).load(Data::MAP_SPACE);
+	_G(logic)->entering();
 }
 
 } // namespace Interactions
diff --git a/engines/ultima/ultima1/views/interactions/sector_scan.cpp b/engines/ultima/ultima1/views/interactions/sector_scan.cpp
new file mode 100644
index 00000000000..4ee191cc65d
--- /dev/null
+++ b/engines/ultima/ultima1/views/interactions/sector_scan.cpp
@@ -0,0 +1,158 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "ultima/ultima1/views/interactions/sector_scan.h"
+#include "ultima/ultima1/data/space_map.h"
+#include "ultima/ultima1/ultima1.h"
+
+namespace Ultima {
+namespace Ultima1 {
+namespace Views {
+namespace Interactions {
+
+// Same inset-dialog geometry the other space/overworld dialogs use
+constexpr int DIALOG_X1 = 31, DIALOG_Y1 = 23, DIALOG_X2 = 287, DIALOG_Y2 = 127;
+constexpr int BORDER_X1 = 34, BORDER_Y1 = 26, BORDER_X2 = 284, BORDER_Y2 = 124;
+
+constexpr int TEXT_COLOR = 15;
+constexpr int FRAME_COLOR = 1;
+constexpr int MARKER_COLOR = 15;
+constexpr int EMPTY_HILIGHT_COLOR = 14;
+constexpr int EMPTY_DIM_COLOR = 1;
+
+// The scan grid's own outline, and where sector (sx, sy)'s glyph sits
+// within it - matching the original's drawSectorMapIcon
+constexpr int GRID_X1 = 130, GRID_Y1 = 44, GRID_X2 = 200, GRID_Y2 = 115;
+static int cellX(int sx) { return sx * 10 + 132; }
+static int cellY(int sy) { return sy * 10 + 46; }
+
+// tick() runs ~20/sec; the original waits 7 BIOS ticks (~0.38s) between
+// blinks
+constexpr int BLINK_TICKS = 8;
+
+bool SectorScan::msgFocus(const FocusMessage &msg) {
+	setBounds(Common::Rect(0, 0, 320, 200));
+	_blinkCtr = 0;
+	_blipVisible = true;
+	return true;
+}
+
+void SectorScan::draw() {
+	auto s = getSurface();
+
+	// Inset dialog box
+	s.fillRect(Rect(DIALOG_X1, DIALOG_Y1, DIALOG_X2, DIALOG_Y2), 0);
+	s.frameRect(Rect(BORDER_X1, BORDER_Y1, BORDER_X2, BORDER_Y2), FRAME_COLOR);
+
+	s.setColor(TEXT_COLOR);
+	s.writeString(Point(5, 4), "Sector Scan:");
+
+	// The scan grid outline
+	s.drawLine(GRID_X1, GRID_Y1, GRID_X2, GRID_Y1, MARKER_COLOR);
+	s.drawLine(GRID_X2, GRID_Y1, GRID_X2, GRID_Y2, MARKER_COLOR);
+	s.drawLine(GRID_X2, GRID_Y2, GRID_X1, GRID_Y2, MARKER_COLOR);
+	s.drawLine(GRID_X1, GRID_Y2, GRID_X1, GRID_Y1, MARKER_COLOR);
+
+	// One glyph per sector
+	for (int sx = 0; sx < Data::SPACE_SECTOR_COUNT; ++sx)
+		for (int sy = 0; sy < Data::SPACE_SECTOR_COUNT; ++sy)
+			drawSectorIcon(s, sx, sy);
+
+	// Blink the player's current sector by blanking its glyph on the off
+	// beat
+	if (!_blipVisible) {
+		int px = cellX(_G(sectorX)), py = cellY(_G(sectorY));
+		s.fillRect(Rect(px, py, px + 8, py + 9), 0);
+	}
+}
+
+void SectorScan::drawSectorIcon(Shared::Gfx::GfxSurface &s, int sx, int sy) {
+	const Data::SpaceMapCell &cell = _G(spaceMap)._sectors[sx][sy];
+	int px = cellX(sx), py = cellY(sy);
+
+	if (cell._enemyCount != 0)
+		drawEnemyMarker(s, px, py);
+	else if (cell._anchorX != 0)
+		drawStationMarker(s, px, py);
+	else if (cell._hazardX != 0)
+		drawStarMarker(s, px, py);
+	else
+		drawEmptyMarker(s, px, py);
+}
+
+void SectorScan::drawEnemyMarker(Shared::Gfx::GfxSurface &s, int x, int y) {
+	// Two side bars each end, two rungs across the middle - a fighter shape
+	for (int i = 0; i < 2; ++i) {
+		s.drawLine(x + i, y, x + i, y + 7, MARKER_COLOR);
+		s.drawLine(x + i + 5, y, x + i + 5, y + 7, MARKER_COLOR);
+		s.drawLine(x, y + 3 + i, x + 6, y + 3 + i, MARKER_COLOR);
+	}
+}
+
+void SectorScan::drawStationMarker(Shared::Gfx::GfxSurface &s, int x, int y) {
+	// A cross
+	for (int i = 0; i < 2; ++i) {
+		s.drawLine(x + i + 3, y, x + i + 3, y + 7, MARKER_COLOR);
+		s.drawLine(x, y + i + 3, x + 7, y + i + 3, MARKER_COLOR);
+	}
+}
+
+void SectorScan::drawStarMarker(Shared::Gfx::GfxSurface &s, int x, int y) {
+	// A small diamond
+	for (int i = 0; i < 3; ++i) {
+		s.drawLine(x + 3 - i, y + i + 1, x + 3 + i, y + i + 1, MARKER_COLOR);
+		s.drawLine(x + 3 - i, y + 6 - i, x + 3 + i, y + 6 - i, MARKER_COLOR);
+	}
+}
+
+void SectorScan::drawEmptyMarker(Shared::Gfx::GfxSurface &s, int x, int y) {
+	// A sparse scattering of dots
+	s.setPixel(x + 1, y + 1, MARKER_COLOR);
+	s.setPixel(x + 3, y + 3, EMPTY_HILIGHT_COLOR);
+	s.setPixel(x + 6, y + 2, EMPTY_DIM_COLOR);
+	s.setPixel(x + 4, y + 5, MARKER_COLOR);
+	s.setPixel(x + 2, y + 6, EMPTY_DIM_COLOR);
+}
+
+bool SectorScan::tick() {
+	if (++_blinkCtr >= BLINK_TICKS) {
+		_blinkCtr = 0;
+		_blipVisible = !_blipVisible;
+		redraw();
+	}
+
+	return Interaction::tick();
+}
+
+bool SectorScan::msgAction(const ActionMessage &msg) {
+	close();
+	return true;
+}
+
+bool SectorScan::msgKeypress(const KeypressMessage &msg) {
+	close();
+	return true;
+}
+
+} // namespace Interactions
+} // namespace Views
+} // namespace Ultima1
+} // namespace Ultima
diff --git a/engines/ultima/ultima1/views/interactions/sector_scan.h b/engines/ultima/ultima1/views/interactions/sector_scan.h
new file mode 100644
index 00000000000..b4c8831463a
--- /dev/null
+++ b/engines/ultima/ultima1/views/interactions/sector_scan.h
@@ -0,0 +1,70 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef ULTIMA1_VIEWS_INTERACTIONS_SECTOR_SCAN_H
+#define ULTIMA1_VIEWS_INTERACTIONS_SECTOR_SCAN_H
+
+#include "ultima/ultima1/views/interactions/interaction.h"
+#include "ultima/shared/gfx/gfx_surface.h"
+
+namespace Ultima {
+namespace Ultima1 {
+namespace Views {
+namespace Interactions {
+
+using namespace Ultima::Shared::Messages;
+
+/**
+ * The outer-space Inform command's "Sector Scan" dialog (SPACE.EXE's own
+ * inform): a 7x7 grid of the galaxy, one small glyph per sector showing
+ * whether it holds hostile ships, a station/encounter, a star hazard, or
+ * nothing, with the player's current sector blinking. Any key closes it.
+ */
+class SectorScan : public Interaction {
+private:
+	int _blinkCtr = 0;
+	bool _blipVisible = true;
+
+	void drawSectorIcon(Shared::Gfx::GfxSurface &s, int sx, int sy);
+	void drawEnemyMarker(Shared::Gfx::GfxSurface &s, int x, int y);
+	void drawStationMarker(Shared::Gfx::GfxSurface &s, int x, int y);
+	void drawStarMarker(Shared::Gfx::GfxSurface &s, int x, int y);
+	void drawEmptyMarker(Shared::Gfx::GfxSurface &s, int x, int y);
+
+public:
+	SectorScan() : Interaction("SectorScan") {
+	}
+	~SectorScan() override {
+	}
+
+	bool msgFocus(const FocusMessage &msg) override;
+	bool msgAction(const ActionMessage &msg) override;
+	bool msgKeypress(const KeypressMessage &msg) override;
+	void draw() override;
+	bool tick() override;
+};
+
+} // namespace Interactions
+} // namespace Views
+} // namespace Ultima1
+} // namespace Ultima
+
+#endif
diff --git a/engines/ultima/ultima1/views/views.h b/engines/ultima/ultima1/views/views.h
index 9c2f1e2d1ea..1d4792970c6 100644
--- a/engines/ultima/ultima1/views/views.h
+++ b/engines/ultima/ultima1/views/views.h
@@ -34,6 +34,7 @@
 #include "ultima/ultima1/views/interactions/pillar.h"
 #include "ultima/ultima1/views/interactions/princess_saved.h"
 #include "ultima/ultima1/views/interactions/ready.h"
+#include "ultima/ultima1/views/interactions/sector_scan.h"
 #include "ultima/ultima1/views/interactions/win.h"
 #include "ultima/ultima1/views/create_character.h"
 #include "ultima/ultima1/views/dungeon_map.h"
@@ -63,6 +64,7 @@ struct Views : public Shared::Views {
 	Interactions::Pillar _pillar;
 	Interactions::PrincessSaved _princessSaved;
 	Interactions::Ready _ready;
+	Interactions::SectorScan _sectorScan;
 	Interactions::Win _win;
 	CreateCharacter _createCharacter;
 	DungeonMap _dungeonMap;


Commit: fc3c0735b11670690060576aca26c74c9230ad8e
    https://github.com/scummvm/scummvm/commit/fc3c0735b11670690060576aca26c74c9230ad8e
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:40:52+11:00

Commit Message:
ULTIMA: ULTIMA1: Space disabled commands

Changed paths:
    engines/ultima/ultima1/logic/space_logic.cpp
    engines/ultima/ultima1/logic/space_logic.h
    engines/ultima/ultima1/ultima1.h


diff --git a/engines/ultima/ultima1/logic/space_logic.cpp b/engines/ultima/ultima1/logic/space_logic.cpp
index 6243b66c361..d15ed9d6e13 100644
--- a/engines/ultima/ultima1/logic/space_logic.cpp
+++ b/engines/ultima/ultima1/logic/space_logic.cpp
@@ -1,4 +1,3 @@
-
 /* ScummVM - Graphic Adventure Engine
  *
  * ScummVM is the legal property of its developers, whose names
@@ -20,8 +19,10 @@
  *
  */
 
+#include "common/util.h"
 #include "ultima/ultima1/logic/space_logic.h"
 #include "ultima/ultima1/data/map.h"
+#include "ultima/ultima1/data/space_map.h"
 #include "ultima/ultima1/metaengine.h"
 #include "ultima/ultima1/ultima1.h"
 
@@ -34,18 +35,101 @@ SpaceLogic::SpaceLogic() {
 
 void SpaceLogic::entering() {
 	// The original re-launches SPACE.EXE each time, always starting fresh
-	// at the station sector with a newly rolled galaxy
+	// at the station sector with a newly rolled galaxy, flying the shuttle
+	// out of the docking bay
 	_G(sectorX) = Data::SPACE_STATION_X;
 	_G(sectorY) = Data::SPACE_STATION_Y;
+	_G(shipIndex) = 2;
+	_G(cockpitView) = false;
+	_G(cockpitSpeed) = 0;
 	_G(spaceMap).setup();
 }
 
+int SpaceLogic::shipFuel() const {
+	return _G(spaceMap)._sectors[_G(sectorX)][_G(sectorY)]._ships[_G(shipIndex)]._fuel;
+}
+
+void SpaceLogic::subtractFuel(int amount) {
+	int16 &fuel = _G(spaceMap)._sectors[_G(sectorX)][_G(sectorY)]._ships[_G(shipIndex)]._fuel;
+	fuel = (fuel > amount) ? (int16)(fuel - amount) : 0;
+	// TODO: displayFuelNumber() - refresh the cockpit's fuel readout
+}
+
+void SpaceLogic::setSpeed(int speed) {
+	writeString("Speed %d\n", speed);
+
+	int reqFuel = ABS(speed - _G(cockpitSpeed)) * 4;
+	if (reqFuel > shipFuel()) {
+		writeString("Not enough fuel!\n");
+	} else {
+		_G(cockpitSpeed) = speed;
+		subtractFuel(reqFuel);
+	}
+}
+
+void SpaceLogic::keypress(Common::KeyCode keycode) {
+	if (_G(cockpitView) && keycode >= Common::KEYCODE_1 && keycode <= Common::KEYCODE_8) {
+		setSpeed(keycode - Common::KEYCODE_0);
+		return;
+	}
+
+	writeString("Huh?\n");
+	playFX(1);
+}
+
 bool SpaceLogic::inform() {
 	writeString("Inform and Search\n");
 	g_engine->addView("SectorScan");
 	return false;
 }
 
+bool SpaceLogic::attack(Data::Direction dir) {
+	writeString("Attack?\n");
+	playFX(1);
+	return true;
+}
+
+bool SpaceLogic::cast() {
+	writeString("Cast?\n");
+	playFX(1);
+	return true;
+}
+
+bool SpaceLogic::climb() {
+	writeString("Klimb?\n");
+	playFX(1);
+	return true;
+}
+
+bool SpaceLogic::fire() {
+	// Overhead view - nothing to shoot at. In the cockpit view the original
+	// runs handleFireCommand (space combat), which isn't ported yet
+	writeString("Fire?\n");
+	playFX(1);
+	return true;
+}
+
+bool SpaceLogic::quit() {
+	writeString("Quit?\n");
+	playFX(1);
+	return true;
+}
+
+bool SpaceLogic::ready() {
+	writeString("Ready?\n");
+	playFX(1);
+	return true;
+}
+
+bool SpaceLogic::view() {
+	// The original's View toggles between the cockpit and overhead sector
+	// map (with fuel/collision checks and a "whilst in space dock" guard) -
+	// not ported until the flight system is
+	writeString("View?\n");
+	playFX(1);
+	return true;
+}
+
 } // namespace Logic
 } // namespace Ultima1
 } // namespace Ultima
diff --git a/engines/ultima/ultima1/logic/space_logic.h b/engines/ultima/ultima1/logic/space_logic.h
index 4b89462fca4..233eab5a0a8 100644
--- a/engines/ultima/ultima1/logic/space_logic.h
+++ b/engines/ultima/ultima1/logic/space_logic.h
@@ -30,6 +30,24 @@ namespace Ultima1 {
 namespace Logic {
 
 class SpaceLogic : public Logic {
+private:
+	/**
+	 * Fuel remaining in the ship the player is currently flying
+	 * (getShipFuel)
+	 */
+	int shipFuel() const;
+
+	/**
+	 * Burns fuel from the current ship, clamped at zero (subtractFuel)
+	 */
+	void subtractFuel(int amount);
+
+	/**
+	 * Sets the cockpit flight speed (1-8), spending 4 fuel per step of
+	 * change - the number keys while in the cockpit view. setSpeed
+	 */
+	void setSpeed(int speed);
+
 protected:
 	bool move(Data::Direction dir) override {
 		return true;
@@ -46,12 +64,28 @@ protected:
 	 */
 	bool inform() override;
 
+	// Commands that do nothing in outer space - just a beep and a prompt.
+	// The rest (board/drop/enter/get/open/steal/transact/unlock/xit/noise)
+	// already say the right thing via the base Logic fallbacks
+	bool attack(Data::Direction dir) override;
+	bool cast() override;
+	bool climb() override;
+	bool fire() override;
+	bool quit() override;
+	bool ready() override;
+	bool view() override;
+
 public:
 	SpaceLogic();
 	~SpaceLogic() override {
 	}
 
 	void entering() override;
+
+	/**
+	 * The number keys set the flight speed while in the cockpit view
+	 */
+	void keypress(Common::KeyCode keycode) override;
 };
 
 } // namespace Logic
diff --git a/engines/ultima/ultima1/ultima1.h b/engines/ultima/ultima1/ultima1.h
index 1d41c20e392..a6d6f9ca807 100644
--- a/engines/ultima/ultima1/ultima1.h
+++ b/engines/ultima/ultima1/ultima1.h
@@ -77,6 +77,12 @@ public:
 	// The player's current galaxy sector while in outer space
 	int _sectorX = Data::SPACE_STATION_X;
 	int _sectorY = Data::SPACE_STATION_Y;
+	// Which of the current sector's ship slots the player is flying, and
+	// whether they're in the first-person cockpit view (vs the overhead
+	// sector map). _cockpitSpeed is the flight speed set while in cockpit
+	int _shipIndex = 2;
+	bool _cockpitView = false;
+	int _cockpitSpeed = 0;
 
 public:
 	Ultima1Engine(OSystem *syst, const Ultima::UltimaGameDescription *gameDesc);


Commit: e8fe01c807ae1d5e635981835f299b6908ebc86a
    https://github.com/scummvm/scummvm/commit/e8fe01c807ae1d5e635981835f299b6908ebc86a
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:40:52+11:00

Commit Message:
ULTIMA: ULTIMA1: Splitting SpaceLogic into map and cockpit subclasses

Changed paths:
  A engines/ultima/ultima1/logic/space_cockpit_logic.cpp
  A engines/ultima/ultima1/logic/space_cockpit_logic.h
  A engines/ultima/ultima1/logic/space_map_logic.cpp
  A engines/ultima/ultima1/logic/space_map_logic.h
  A engines/ultima/ultima1/views/space_cockpit.cpp
  A engines/ultima/ultima1/views/space_cockpit.h
    engines/ultima/module.mk
    engines/ultima/ultima1/data/map.cpp
    engines/ultima/ultima1/data/space_map.cpp
    engines/ultima/ultima1/data/space_map.h
    engines/ultima/ultima1/logic/space_logic.cpp
    engines/ultima/ultima1/logic/space_logic.h
    engines/ultima/ultima1/ultima1.h
    engines/ultima/ultima1/views/views.h


diff --git a/engines/ultima/module.mk b/engines/ultima/module.mk
index f58cccb7669..d4d1f724ebc 100644
--- a/engines/ultima/module.mk
+++ b/engines/ultima/module.mk
@@ -68,7 +68,9 @@ MODULE_OBJS += \
 	ultima1/logic/dungeon_logic.o \
 	ultima1/logic/mondain_logic.o \
 	ultima1/logic/overworld_logic.o \
+	ultima1/logic/space_cockpit_logic.o \
 	ultima1/logic/space_logic.o \
+	ultima1/logic/space_map_logic.o \
 	ultima1/views/interactions/interaction.o \
 	ultima1/views/interactions/dead.o \
 	ultima1/views/interactions/direction.o \
@@ -97,6 +99,7 @@ MODULE_OBJS += \
 	ultima1/views/mondain_map.o \
 	ultima1/views/overworld.o \
 	ultima1/views/overworld_map.o \
+	ultima1/views/space_cockpit.o \
 	ultima1/views/space_map.o \
 	ultima1/views/stats.o \
 	ultima1/views/startup.o \
diff --git a/engines/ultima/ultima1/data/map.cpp b/engines/ultima/ultima1/data/map.cpp
index c9cc676ab1b..b4e037a4ec1 100644
--- a/engines/ultima/ultima1/data/map.cpp
+++ b/engines/ultima/ultima1/data/map.cpp
@@ -27,7 +27,7 @@
 #include "ultima/ultima1/logic/dungeon_logic.h"
 #include "ultima/ultima1/logic/mondain_logic.h"
 #include "ultima/ultima1/logic/overworld_logic.h"
-#include "ultima/ultima1/logic/space_logic.h"
+#include "ultima/ultima1/logic/space_map_logic.h"
 #include "ultima/ultima1/views/dialog.h"
 #include "ultima/ultima1/ultima1.h"
 
@@ -191,7 +191,7 @@ void Map::load(int mapNum) {
 	// Set up logic handler for the mode and which view it'll be using
 	Common::String viewName;
 	if (mapNum == MAP_SPACE) {
-		_G(logic) = Common::SharedPtr<Logic::Logic>(new Logic::SpaceLogic());
+		_G(logic) = Common::SharedPtr<Logic::Logic>(new Logic::SpaceMapLogic());
 		viewName = "SpaceMap";
 	} else if (mapNum == MAP_MONDAIN) {
 		_G(logic) = Common::SharedPtr<Logic::Logic>(new Logic::MondainLogic());
diff --git a/engines/ultima/ultima1/data/space_map.cpp b/engines/ultima/ultima1/data/space_map.cpp
index b1608b42140..0c3d2a58248 100644
--- a/engines/ultima/ultima1/data/space_map.cpp
+++ b/engines/ultima/ultima1/data/space_map.cpp
@@ -27,6 +27,8 @@ namespace Ultima {
 namespace Ultima1 {
 namespace Data {
 
+const char *SPACE_COCKPIT_DIRECTION_NAMES[5] = { nullptr, "Left", "Right", "Climb", "Dive" };
+
 int SpaceMap::getRandomNumber(int minVal, int maxVal) {
 	// seed = ror16(seed + 0x9248, 3)
 	_randomSeed = (uint16)(_randomSeed + 0x9248);
diff --git a/engines/ultima/ultima1/data/space_map.h b/engines/ultima/ultima1/data/space_map.h
index f4c1b07aea4..4bb53a131fb 100644
--- a/engines/ultima/ultima1/data/space_map.h
+++ b/engines/ultima/ultima1/data/space_map.h
@@ -39,6 +39,11 @@ constexpr int SPACE_STATION_Y = 3;
 // player's own ship, spawned attackers)
 constexpr int SPACE_SHIPS_PER_SECTOR = 4;
 
+// Direction names shown in the cockpit view, indexed by Data::Direction
+// (1-4): the arrow keys read as Left / Right / Climb / Dive rather than the
+// overhead view's West / East / North / South
+extern const char *SPACE_COCKPIT_DIRECTION_NAMES[5];
+
 // Ship types (SHIP_* in the disassembly)
 enum SpaceShipType {
 	SHIP_NONE = -1,
diff --git a/engines/ultima/ultima1/logic/space_cockpit_logic.cpp b/engines/ultima/ultima1/logic/space_cockpit_logic.cpp
new file mode 100644
index 00000000000..7f7b2204922
--- /dev/null
+++ b/engines/ultima/ultima1/logic/space_cockpit_logic.cpp
@@ -0,0 +1,91 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "common/util.h"
+#include "ultima/ultima1/logic/space_cockpit_logic.h"
+#include "ultima/ultima1/logic/space_map_logic.h"
+#include "ultima/ultima1/data/space_map.h"
+#include "ultima/ultima1/ultima1.h"
+
+namespace Ultima {
+namespace Ultima1 {
+namespace Logic {
+
+void SpaceCockpitLogic::setSpeed(int speed) {
+	writeString("Speed %d\n", speed);
+
+	int reqFuel = ABS(speed - _G(cockpitSpeed)) * 4;
+	if (reqFuel > shipFuel()) {
+		writeString("Not enough fuel!\n");
+	} else {
+		_G(cockpitSpeed) = speed;
+		subtractFuel(reqFuel);
+	}
+}
+
+void SpaceCockpitLogic::keypress(Common::KeyCode keycode) {
+	if (keycode >= Common::KEYCODE_1 && keycode <= Common::KEYCODE_8) {
+		setSpeed(keycode - Common::KEYCODE_0);
+		return;
+	}
+
+	SpaceLogic::keypress(keycode);
+}
+
+bool SpaceCockpitLogic::move(Data::Direction dir) {
+	writeString("%s\n", Data::SPACE_COCKPIT_DIRECTION_NAMES[dir]);
+
+	if (shipFuel() < 2) {
+		writeString("Not enough fuel!\n");
+		return true;
+	}
+	subtractFuel(2);
+
+	// TODO: set the starfield pan velocity (viewPanDeltaX/Y) - Left/Right
+	// pan X by -/+4, Climb/Dive pan Y by -/+4 - which the cockpit view's
+	// per-frame starfield update then applies
+	return true;
+}
+
+bool SpaceCockpitLogic::fire() {
+	// TODO: handleFireCommand - the actual enemy-ship combat
+	writeString("Fire!\n");
+	playFX(1);
+	return true;
+}
+
+bool SpaceCockpitLogic::pass() {
+	// TODO: re-centres the starscape (clears the pan velocity, recentres
+	// viewCenterX/Y, redraws the viewport border)
+	writeString("Center\n");
+	return true;
+}
+
+bool SpaceCockpitLogic::view() {
+	writeString("View\n");
+	_G(logic) = Common::SharedPtr<Logic>(new SpaceMapLogic());
+	g_engine->replaceView("SpaceMap");
+	return false;
+}
+
+} // namespace Logic
+} // namespace Ultima1
+} // namespace Ultima
diff --git a/engines/ultima/ultima1/logic/space_cockpit_logic.h b/engines/ultima/ultima1/logic/space_cockpit_logic.h
new file mode 100644
index 00000000000..9e0ec195de0
--- /dev/null
+++ b/engines/ultima/ultima1/logic/space_cockpit_logic.h
@@ -0,0 +1,63 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef ULTIMA2_LOGIC_SPACE_COCKPIT_LOGIC_H
+#define ULTIMA2_LOGIC_SPACE_COCKPIT_LOGIC_H
+
+#include "ultima/ultima1/logic/space_logic.h"
+
+namespace Ultima {
+namespace Ultima1 {
+namespace Logic {
+
+/**
+ * The first-person cockpit view of outer space: a panning starscape where
+ * the arrows steer the ship (Left/Right/Climb/Dive), the number keys set
+ * the flight speed, and enemy-ship combat happens. Reached from the
+ * overhead view with the View command
+ */
+class SpaceCockpitLogic : public SpaceLogic {
+private:
+	/**
+	 * Sets the flight speed (1-8), spending 4 fuel per step of change
+	 * (setSpeed) - the number keys
+	 */
+	void setSpeed(int speed);
+
+protected:
+	bool move(Data::Direction dir) override;
+	bool fire() override;
+	bool pass() override;
+	bool view() override;
+
+public:
+	SpaceCockpitLogic() : SpaceLogic() {}
+	~SpaceCockpitLogic() override {
+	}
+
+	void keypress(Common::KeyCode keycode) override;
+};
+
+} // namespace Logic
+} // namespace Ultima1
+} // namespace Ultima
+
+#endif
diff --git a/engines/ultima/ultima1/logic/space_logic.cpp b/engines/ultima/ultima1/logic/space_logic.cpp
index d15ed9d6e13..3d7fcafa90c 100644
--- a/engines/ultima/ultima1/logic/space_logic.cpp
+++ b/engines/ultima/ultima1/logic/space_logic.cpp
@@ -19,7 +19,6 @@
  *
  */
 
-#include "common/util.h"
 #include "ultima/ultima1/logic/space_logic.h"
 #include "ultima/ultima1/data/map.h"
 #include "ultima/ultima1/data/space_map.h"
@@ -31,6 +30,7 @@ namespace Ultima1 {
 namespace Logic {
 
 SpaceLogic::SpaceLogic() {
+	_G(map)._mapType = Data::MAPTYPE_SPACE;
 }
 
 void SpaceLogic::entering() {
@@ -40,7 +40,6 @@ void SpaceLogic::entering() {
 	_G(sectorX) = Data::SPACE_STATION_X;
 	_G(sectorY) = Data::SPACE_STATION_Y;
 	_G(shipIndex) = 2;
-	_G(cockpitView) = false;
 	_G(cockpitSpeed) = 0;
 	_G(spaceMap).setup();
 }
@@ -55,24 +54,7 @@ void SpaceLogic::subtractFuel(int amount) {
 	// TODO: displayFuelNumber() - refresh the cockpit's fuel readout
 }
 
-void SpaceLogic::setSpeed(int speed) {
-	writeString("Speed %d\n", speed);
-
-	int reqFuel = ABS(speed - _G(cockpitSpeed)) * 4;
-	if (reqFuel > shipFuel()) {
-		writeString("Not enough fuel!\n");
-	} else {
-		_G(cockpitSpeed) = speed;
-		subtractFuel(reqFuel);
-	}
-}
-
 void SpaceLogic::keypress(Common::KeyCode keycode) {
-	if (_G(cockpitView) && keycode >= Common::KEYCODE_1 && keycode <= Common::KEYCODE_8) {
-		setSpeed(keycode - Common::KEYCODE_0);
-		return;
-	}
-
 	writeString("Huh?\n");
 	playFX(1);
 }
@@ -101,14 +83,6 @@ bool SpaceLogic::climb() {
 	return true;
 }
 
-bool SpaceLogic::fire() {
-	// Overhead view - nothing to shoot at. In the cockpit view the original
-	// runs handleFireCommand (space combat), which isn't ported yet
-	writeString("Fire?\n");
-	playFX(1);
-	return true;
-}
-
 bool SpaceLogic::quit() {
 	writeString("Quit?\n");
 	playFX(1);
@@ -121,15 +95,6 @@ bool SpaceLogic::ready() {
 	return true;
 }
 
-bool SpaceLogic::view() {
-	// The original's View toggles between the cockpit and overhead sector
-	// map (with fuel/collision checks and a "whilst in space dock" guard) -
-	// not ported until the flight system is
-	writeString("View?\n");
-	playFX(1);
-	return true;
-}
-
 } // namespace Logic
 } // namespace Ultima1
 } // namespace Ultima
diff --git a/engines/ultima/ultima1/logic/space_logic.h b/engines/ultima/ultima1/logic/space_logic.h
index 233eab5a0a8..77b3bf5b370 100644
--- a/engines/ultima/ultima1/logic/space_logic.h
+++ b/engines/ultima/ultima1/logic/space_logic.h
@@ -29,8 +29,17 @@ namespace Ultima {
 namespace Ultima1 {
 namespace Logic {
 
+/**
+ * Shared base for the two outer-space modes. Outer space has two quite
+ * different play views - the overhead sector map (SpaceMapLogic) and the
+ * first-person cockpit (SpaceCockpitLogic) - swapped with the View command.
+ * This holds what's common to both: entering(), the fuel accessors, and the
+ * many commands that just say "<X>?" in either mode
+ */
 class SpaceLogic : public Logic {
-private:
+protected:
+	SpaceLogic();
+
 	/**
 	 * Fuel remaining in the ship the player is currently flying
 	 * (getShipFuel)
@@ -42,48 +51,39 @@ private:
 	 */
 	void subtractFuel(int amount);
 
-	/**
-	 * Sets the cockpit flight speed (1-8), spending 4 fuel per step of
-	 * change - the number keys while in the cockpit view. setSpeed
-	 */
-	void setSpeed(int speed);
-
-protected:
-	bool move(Data::Direction dir) override {
-		return true;
-	}
-
-	/**
-	 * Handles updating creatures/NPCs
-	 */
 	void updateCreatures() override {
 	}
 
 	/**
-	 * Inform - shows the animated sector scan of the galaxy
+	 * Inform - the animated sector scan of the galaxy (works in either view)
 	 */
 	bool inform() override;
 
 	// Commands that do nothing in outer space - just a beep and a prompt.
-	// The rest (board/drop/enter/get/open/steal/transact/unlock/xit/noise)
+	// board/drop/enter/get/open/steal/transact/unlock/xit/noise/pass
 	// already say the right thing via the base Logic fallbacks
 	bool attack(Data::Direction dir) override;
 	bool cast() override;
 	bool climb() override;
-	bool fire() override;
 	bool quit() override;
 	bool ready() override;
-	bool view() override;
 
 public:
-	SpaceLogic();
 	~SpaceLogic() override {
 	}
 
+	/**
+	 * Sets up the whole space encounter: rolls the galaxy, drops the player
+	 * at the station sector flying the shuttle. Deliberately on the base
+	 * class - it's only ever called on the SpaceMapLogic that take-off
+	 * loads, but conceptually it belongs to "entering space", not to the
+	 * overhead view specifically
+	 */
 	void entering() override;
 
 	/**
-	 * The number keys set the flight speed while in the cockpit view
+	 * Any unmapped key is just "Huh?" (overridden by SpaceCockpitLogic for
+	 * the speed number keys)
 	 */
 	void keypress(Common::KeyCode keycode) override;
 };
diff --git a/engines/ultima/ultima1/logic/space_map_logic.cpp b/engines/ultima/ultima1/logic/space_map_logic.cpp
new file mode 100644
index 00000000000..544cc6d7867
--- /dev/null
+++ b/engines/ultima/ultima1/logic/space_map_logic.cpp
@@ -0,0 +1,62 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "ultima/ultima1/logic/space_map_logic.h"
+#include "ultima/ultima1/logic/space_cockpit_logic.h"
+#include "ultima/ultima1/data/map.h"
+#include "ultima/ultima1/ultima1.h"
+
+namespace Ultima {
+namespace Ultima1 {
+namespace Logic {
+
+bool SpaceMapLogic::move(Data::Direction dir) {
+	writeString("%s\n", Data::DIRECTION_NAMES[dir]);
+
+	// TODO: handleOverheadArrows - nudges the drift heading (sectorChangeX/Y)
+	// by 1, spends 5 fuel (2 for Left/Right), "No fuel!" when empty, and
+	// "Crunch!" + shield drain on a collision. The drift itself and the
+	// sector crossing run in the overhead view's per-frame update
+	return true;
+}
+
+bool SpaceMapLogic::fire() {
+	// Nothing to shoot at from the overhead view
+	writeString("Fire?\n");
+	playFX(1);
+	return true;
+}
+
+bool SpaceMapLogic::view() {
+	writeString("View\n");
+
+	// TODO: the original refuses the switch while enemies remain in the
+	// sector ("Thou must eliminate all enemy craft first!"), with no fuel,
+	// or while docked; and seeds the cockpit's heading from the current
+	// drift
+	_G(logic) = Common::SharedPtr<Logic>(new SpaceCockpitLogic());
+	g_engine->replaceView("SpaceCockpit");
+	return false;
+}
+
+} // namespace Logic
+} // namespace Ultima1
+} // namespace Ultima
diff --git a/engines/ultima/ultima1/logic/space_map_logic.h b/engines/ultima/ultima1/logic/space_map_logic.h
new file mode 100644
index 00000000000..b0f2e031228
--- /dev/null
+++ b/engines/ultima/ultima1/logic/space_map_logic.h
@@ -0,0 +1,53 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef ULTIMA2_LOGIC_SPACE_MAP_LOGIC_H
+#define ULTIMA2_LOGIC_SPACE_MAP_LOGIC_H
+
+#include "ultima/ultima1/logic/space_logic.h"
+
+namespace Ultima {
+namespace Ultima1 {
+namespace Logic {
+
+/**
+ * The overhead sector-map view of outer space: the ship drifts around the
+ * current sector, the arrows nudge its heading (West/East/North/South), and
+ * reaching an edge crosses into the neighbouring sector. This is the mode
+ * take-off loads into
+ */
+class SpaceMapLogic : public SpaceLogic {
+protected:
+	bool move(Data::Direction dir) override;
+	bool fire() override;
+	bool view() override;
+
+public:
+	SpaceMapLogic() : SpaceLogic() {}
+	~SpaceMapLogic() override {
+	}
+};
+
+} // namespace Logic
+} // namespace Ultima1
+} // namespace Ultima
+
+#endif
diff --git a/engines/ultima/ultima1/ultima1.h b/engines/ultima/ultima1/ultima1.h
index a6d6f9ca807..e2403b6f6e8 100644
--- a/engines/ultima/ultima1/ultima1.h
+++ b/engines/ultima/ultima1/ultima1.h
@@ -78,10 +78,9 @@ public:
 	int _sectorX = Data::SPACE_STATION_X;
 	int _sectorY = Data::SPACE_STATION_Y;
 	// Which of the current sector's ship slots the player is flying, and
-	// whether they're in the first-person cockpit view (vs the overhead
-	// sector map). _cockpitSpeed is the flight speed set while in cockpit
+	// the flight speed set while in the cockpit view (the overhead vs
+	// cockpit distinction is carried by which SpaceLogic subclass is active)
 	int _shipIndex = 2;
-	bool _cockpitView = false;
 	int _cockpitSpeed = 0;
 
 public:
diff --git a/engines/ultima/ultima1/views/space_cockpit.cpp b/engines/ultima/ultima1/views/space_cockpit.cpp
new file mode 100644
index 00000000000..46b92c254cd
--- /dev/null
+++ b/engines/ultima/ultima1/views/space_cockpit.cpp
@@ -0,0 +1,48 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "ultima/ultima1/views/space_cockpit.h"
+#include "ultima/ultima1/ultima1.h"
+#include "ultima/ultima1/metaengine.h"
+
+namespace Ultima {
+namespace Ultima1 {
+namespace Views {
+
+bool SpaceCockpit::msgFocus(const FocusMessage &msg) {
+	MetaEngine::setKeybindingMode(KBMODE_GAMEPLAY);
+	return Map::msgFocus(msg);
+}
+
+bool SpaceCockpit::msgUnfocus(const UnfocusMessage &msg) {
+	MetaEngine::setKeybindingMode(KBMODE_MINIMAL);
+	return Map::msgUnfocus(msg);
+}
+
+void SpaceCockpit::draw() {
+	Map::draw();
+
+	// TODO: the cockpit frame, HUD (Shld:/Fuel:), and the panning starfield
+}
+
+} // namespace Views
+} // namespace Ultima1
+} // namespace Ultima
diff --git a/engines/ultima/ultima1/views/space_cockpit.h b/engines/ultima/ultima1/views/space_cockpit.h
new file mode 100644
index 00000000000..ab917783a2c
--- /dev/null
+++ b/engines/ultima/ultima1/views/space_cockpit.h
@@ -0,0 +1,53 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef ULTIMA1_VIEWS_SPACE_COCKPIT_H
+#define ULTIMA1_VIEWS_SPACE_COCKPIT_H
+
+#include "ultima/ultima1/views/map.h"
+#include "ultima/ultima1/data/map.h"
+
+namespace Ultima {
+namespace Ultima1 {
+namespace Views {
+
+using namespace Shared::Messages;
+
+/**
+ * The first-person cockpit view of outer space - a panning starscape with
+ * the ship's HUD, where enemy-craft combat happens. Paired with
+ * SpaceCockpitLogic; swapped in from SpaceMap by the View command
+ */
+class SpaceCockpit : public Map {
+public:
+	SpaceCockpit() : Map("SpaceCockpit") {}
+	~SpaceCockpit() override {}
+
+	bool msgFocus(const FocusMessage &msg) override;
+	bool msgUnfocus(const UnfocusMessage &msg) override;
+	void draw() override;
+};
+
+} // namespace Views
+} // namespace Ultima1
+} // namespace Ultima
+
+#endif
diff --git a/engines/ultima/ultima1/views/views.h b/engines/ultima/ultima1/views/views.h
index 1d4792970c6..61f8c9aeceb 100644
--- a/engines/ultima/ultima1/views/views.h
+++ b/engines/ultima/ultima1/views/views.h
@@ -43,6 +43,7 @@
 #include "ultima/ultima1/views/main_menu.h"
 #include "ultima/ultima1/views/mondain_map.h"
 #include "ultima/ultima1/views/overworld_map.h"
+#include "ultima/ultima1/views/space_cockpit.h"
 #include "ultima/ultima1/views/space_map.h"
 #include "ultima/ultima1/views/startup.h"
 #include "ultima/ultima1/views/title.h"
@@ -73,6 +74,7 @@ struct Views : public Shared::Views {
 	MainMenu _mainMenu;
 	MondainMap _mondainMap;
 	OverworldMap _overworldMap;
+	SpaceCockpit _spaceCockpit;
 	SpaceMap _spaceMap;
 	Startup _startup;
 	Title _title;


Commit: 890a68592612017e26d8a9a0e57fa61b8ef385c9
    https://github.com/scummvm/scummvm/commit/890a68592612017e26d8a9a0e57fa61b8ef385c9
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:40:52+11:00

Commit Message:
ULTIMA: ULTIMA1: Beginnings of Cockpit View

Changed paths:
    engines/ultima/ultima1/data/space_map.cpp
    engines/ultima/ultima1/data/space_map.h
    engines/ultima/ultima1/logic/space_cockpit_logic.cpp
    engines/ultima/ultima1/logic/space_cockpit_logic.h
    engines/ultima/ultima1/ultima1.h
    engines/ultima/ultima1/views/space_cockpit.cpp
    engines/ultima/ultima1/views/space_cockpit.h


diff --git a/engines/ultima/ultima1/data/space_map.cpp b/engines/ultima/ultima1/data/space_map.cpp
index 0c3d2a58248..743fbe733b9 100644
--- a/engines/ultima/ultima1/data/space_map.cpp
+++ b/engines/ultima/ultima1/data/space_map.cpp
@@ -108,6 +108,69 @@ void SpaceMap::setupSector(int x, int y) {
 	// and the checkOverlap* helpers). Not needed for the sector scan
 }
 
+void SpaceStarfield::spawnStar(int index) {
+	// A random quadrant and a random offset magnitude, so the star starts
+	// somewhere near an edge and heads outward
+	int quadrant = g_engine->getRandomNumber(0, 255) / 64;
+	int dx = g_engine->getRandomNumber(2, 255) / 2;
+	int dy = g_engine->getRandomNumber(4, 255) / 4;
+
+	if (quadrant == 1 || quadrant == 2)
+		dx = -dx;
+	if (quadrant > 1)
+		dy = -dy;
+
+	// If that would already be off-view, park it far away so next frame
+	// just respawns it
+	if (!withinView(_centerX + dx, _centerY + dy)) {
+		dx = 5000;
+		dy = 5000;
+	}
+
+	_starX[index] = (int16)dx;
+	_starY[index] = (int16)dy;
+}
+
+void SpaceStarfield::reset() {
+	_centerX = 0x9f;
+	_centerY = 0x4f;
+	_panX = _panY = 0;
+
+	for (int i = 0; i < SPACE_STAR_COUNT; ++i)
+		spawnStar(i);
+}
+
+void SpaceStarfield::advance() {
+	for (int i = 0; i < SPACE_STAR_COUNT; ++i) {
+		int stepX = _starX[i] / 8;
+		int stepY = _starY[i] / 6;
+
+		// Always move at least one pixel in the star's own direction
+		if (stepX == 0)
+			stepX = (_starX[i] > 0) - (_starX[i] < 0);
+		if (stepY == 0)
+			stepY = (_starY[i] > 0) - (_starY[i] < 0);
+
+		_starX[i] = (int16)(_starX[i] + stepX);
+		_starY[i] = (int16)(_starY[i] + stepY);
+
+		if (!withinView(_centerX + _starX[i], _centerY + _starY[i]))
+			spawnStar(i);
+	}
+
+	// Pan the centre, stopping dead (and dropping the pan) at a viewport edge
+	_centerX = (int16)(_centerX + _panX);
+	if (_centerX >= 300 || _centerX <= 20) {
+		_centerX = (int16)(_centerX - _panX);
+		_panX = 0;
+	}
+	_centerY = (int16)(_centerY + _panY);
+	if (_centerY >= 140 || _centerY <= 20) {
+		_centerY = (int16)(_centerY - _panY);
+		_panY = 0;
+	}
+}
+
 } // namespace Data
 } // namespace Ultima1
 } // namespace Ultima
diff --git a/engines/ultima/ultima1/data/space_map.h b/engines/ultima/ultima1/data/space_map.h
index 4bb53a131fb..ca36dfdda24 100644
--- a/engines/ultima/ultima1/data/space_map.h
+++ b/engines/ultima/ultima1/data/space_map.h
@@ -110,6 +110,48 @@ public:
 	void setup();
 };
 
+// The cockpit view's warp starfield holds this many stars
+constexpr int SPACE_STAR_COUNT = 40;
+
+/**
+ * The panning warp starfield drawn in the first-person cockpit view -
+ * SPACE.EXE's setupStars / advanceStarfield. Purely visual (not saved)
+ */
+struct SpaceStarfield {
+	// The viewport centre the stars radiate from and the aiming crosshair
+	// sits at (viewCenterX/Y), and the pan velocity applied to it each
+	// frame while steering (viewPanDeltaX/Y)
+	int16 _centerX = 0x9f, _centerY = 0x4f;
+	int16 _panX = 0, _panY = 0;
+
+	// Each star is an offset from the centre that accelerates outward
+	int16 _starX[SPACE_STAR_COUNT] = {};
+	int16 _starY[SPACE_STAR_COUNT] = {};
+
+	/**
+	 * Fresh random stars, centre and pan back to their defaults (setupStars)
+	 */
+	void reset();
+
+	/**
+	 * One frame: every star drifts further from the centre (respawning at
+	 * an edge once it leaves the viewport), then the centre pans by the
+	 * current pan velocity, which is zeroed on hitting a viewport edge
+	 * (advanceStarfield, normal-cruise path)
+	 */
+	void advance();
+
+	/**
+	 * True if a screen point is inside the cockpit viewport (starWithinView)
+	 */
+	static bool withinView(int x, int y) {
+		return x > 20 && x < 300 && y > 20 && y < 140;
+	}
+
+private:
+	void spawnStar(int index);
+};
+
 } // namespace Data
 } // namespace Ultima1
 } // namespace Ultima
diff --git a/engines/ultima/ultima1/logic/space_cockpit_logic.cpp b/engines/ultima/ultima1/logic/space_cockpit_logic.cpp
index 7f7b2204922..843a12d8d79 100644
--- a/engines/ultima/ultima1/logic/space_cockpit_logic.cpp
+++ b/engines/ultima/ultima1/logic/space_cockpit_logic.cpp
@@ -50,6 +50,17 @@ void SpaceCockpitLogic::keypress(Common::KeyCode keycode) {
 	SpaceLogic::keypress(keycode);
 }
 
+void SpaceCockpitLogic::tick() {
+	// The original advances the starfield every cockpit frame; at 20fps
+	// that's far too fast, so only every 3rd tick
+	if (++_tickCounter < 3)
+		return;
+	_tickCounter = 0;
+
+	_G(starfield).advance();
+	redrawMap();
+}
+
 bool SpaceCockpitLogic::move(Data::Direction dir) {
 	writeString("%s\n", Data::SPACE_COCKPIT_DIRECTION_NAMES[dir]);
 
@@ -59,9 +70,30 @@ bool SpaceCockpitLogic::move(Data::Direction dir) {
 	}
 	subtractFuel(2);
 
-	// TODO: set the starfield pan velocity (viewPanDeltaX/Y) - Left/Right
-	// pan X by -/+4, Climb/Dive pan Y by -/+4 - which the cockpit view's
-	// per-frame starfield update then applies
+	// Steer by setting the starfield pan velocity - the view's per-frame
+	// update slides the centre and clamps it at the viewport edges
+	Data::SpaceStarfield &sf = _G(starfield);
+	switch (dir) {
+	case Data::DIR_LEFT:
+		sf._panX = -4;
+		sf._panY = 0;
+		break;
+	case Data::DIR_RIGHT:
+		sf._panX = 4;
+		sf._panY = 0;
+		break;
+	case Data::DIR_UP:
+		sf._panY = -4;
+		sf._panX = 0;
+		break;
+	case Data::DIR_DOWN:
+		sf._panY = 4;
+		sf._panX = 0;
+		break;
+	default:
+		break;
+	}
+
 	return true;
 }
 
@@ -73,9 +105,14 @@ bool SpaceCockpitLogic::fire() {
 }
 
 bool SpaceCockpitLogic::pass() {
-	// TODO: re-centres the starscape (clears the pan velocity, recentres
-	// viewCenterX/Y, redraws the viewport border)
+	// Re-centres the starscape and stops any drift
 	writeString("Center\n");
+
+	Data::SpaceStarfield &sf = _G(starfield);
+	sf._centerX = 0x9f;
+	sf._centerY = 0x4f;
+	sf._panX = sf._panY = 0;
+	redrawMap();
 	return true;
 }
 
diff --git a/engines/ultima/ultima1/logic/space_cockpit_logic.h b/engines/ultima/ultima1/logic/space_cockpit_logic.h
index 9e0ec195de0..6e923e6f89b 100644
--- a/engines/ultima/ultima1/logic/space_cockpit_logic.h
+++ b/engines/ultima/ultima1/logic/space_cockpit_logic.h
@@ -36,6 +36,10 @@ namespace Logic {
  */
 class SpaceCockpitLogic : public SpaceLogic {
 private:
+	// tick() fires ~20/sec; only advance the starfield every few calls so
+	// it doesn't streak by too fast
+	int _tickCounter = 0;
+
 	/**
 	 * Sets the flight speed (1-8), spending 4 fuel per step of change
 	 * (setSpeed) - the number keys
@@ -54,6 +58,12 @@ public:
 	}
 
 	void keypress(Common::KeyCode keycode) override;
+
+	/**
+	 * Advances the panning starfield each frame (the starfield half of
+	 * cockpitPerFrame)
+	 */
+	void tick() override;
 };
 
 } // namespace Logic
diff --git a/engines/ultima/ultima1/ultima1.h b/engines/ultima/ultima1/ultima1.h
index e2403b6f6e8..771729c69a7 100644
--- a/engines/ultima/ultima1/ultima1.h
+++ b/engines/ultima/ultima1/ultima1.h
@@ -68,6 +68,7 @@ public:
 	Data::Map _map;
 	Data::MapDungeon _dungeon;
 	Data::SpaceMap _spaceMap;
+	Data::SpaceStarfield _starfield;
 	Data::Savegame _savegame;
 	Common::SharedPtr<Logic::Logic> _logic;
 	int _overworldEntityCount = 0;
diff --git a/engines/ultima/ultima1/views/space_cockpit.cpp b/engines/ultima/ultima1/views/space_cockpit.cpp
index 46b92c254cd..62d6566af48 100644
--- a/engines/ultima/ultima1/views/space_cockpit.cpp
+++ b/engines/ultima/ultima1/views/space_cockpit.cpp
@@ -20,6 +20,7 @@
  */
 
 #include "ultima/ultima1/views/space_cockpit.h"
+#include "ultima/ultima1/data/space_map.h"
 #include "ultima/ultima1/ultima1.h"
 #include "ultima/ultima1/metaengine.h"
 
@@ -27,8 +28,13 @@ namespace Ultima {
 namespace Ultima1 {
 namespace Views {
 
+constexpr int FRAME_COLOR = 7;		// light grey cockpit surround
+constexpr int STAR_COLOR = 15;		// white stars / crosshair
+constexpr int RIVET_COLOR = 0;		// black detail punched into the frame
+
 bool SpaceCockpit::msgFocus(const FocusMessage &msg) {
 	MetaEngine::setKeybindingMode(KBMODE_GAMEPLAY);
+	_G(starfield).reset();
 	return Map::msgFocus(msg);
 }
 
@@ -40,7 +46,49 @@ bool SpaceCockpit::msgUnfocus(const UnfocusMessage &msg) {
 void SpaceCockpit::draw() {
 	Map::draw();
 
-	// TODO: the cockpit frame, HUD (Shld:/Fuel:), and the panning starfield
+	auto s = getSurface();
+	s.fillRect(Rect(8, 8, 312, 152), 0);
+
+	drawCockpitFrame(s);
+
+	const Data::SpaceStarfield &sf = _G(starfield);
+
+	// The aiming crosshair marking the viewport centre
+	s.drawLine(sf._centerX - 2, sf._centerY, sf._centerX + 2, sf._centerY, STAR_COLOR);
+	s.drawLine(sf._centerX, sf._centerY - 2, sf._centerX, sf._centerY + 2, STAR_COLOR);
+
+	// The warp stars
+	for (int i = 0; i < Data::SPACE_STAR_COUNT; ++i) {
+		int x = sf._centerX + sf._starX[i];
+		int y = sf._centerY + sf._starY[i];
+		if (Data::SpaceStarfield::withinView(x, y))
+			s.setPixel(x, y, STAR_COLOR);
+	}
+}
+
+void SpaceCockpit::drawCockpitFrame(Shared::Gfx::GfxSurface &s) {
+	// The ~7px surround around the viewport
+	s.fillRect(Rect(8, 8, 312, 16), FRAME_COLOR);
+	s.fillRect(Rect(8, 144, 312, 152), FRAME_COLOR);
+	s.fillRect(Rect(8, 16, 16, 145), FRAME_COLOR);
+	s.fillRect(Rect(304, 16, 312, 145), FRAME_COLOR);
+
+	// Rivet detail along the top and bottom
+	for (int i = 1; i < 20; ++i) {
+		int px = i * 15 + 10;
+		s.setPixel(px, 10, RIVET_COLOR);
+		s.setPixel(px, 13, RIVET_COLOR);
+		s.setPixel(px, 146, RIVET_COLOR);
+		s.setPixel(px, 149, RIVET_COLOR);
+	}
+	// ...and down the sides
+	for (int i = 1; i < 10; ++i) {
+		int py = i * 15 + 3;
+		s.setPixel(10, py, RIVET_COLOR);
+		s.setPixel(13, py, RIVET_COLOR);
+		s.setPixel(306, py, RIVET_COLOR);
+		s.setPixel(309, py, RIVET_COLOR);
+	}
 }
 
 } // namespace Views
diff --git a/engines/ultima/ultima1/views/space_cockpit.h b/engines/ultima/ultima1/views/space_cockpit.h
index ab917783a2c..6da84a5a391 100644
--- a/engines/ultima/ultima1/views/space_cockpit.h
+++ b/engines/ultima/ultima1/views/space_cockpit.h
@@ -24,6 +24,7 @@
 
 #include "ultima/ultima1/views/map.h"
 #include "ultima/ultima1/data/map.h"
+#include "ultima/shared/gfx/gfx_surface.h"
 
 namespace Ultima {
 namespace Ultima1 {
@@ -32,11 +33,18 @@ namespace Views {
 using namespace Shared::Messages;
 
 /**
- * The first-person cockpit view of outer space - a panning starscape with
- * the ship's HUD, where enemy-craft combat happens. Paired with
- * SpaceCockpitLogic; swapped in from SpaceMap by the View command
+ * The first-person cockpit view of outer space - the panning warp starfield
+ * inside the cockpit frame, with the aiming crosshair at the centre (this
+ * is also where enemy-craft combat happens). Paired with SpaceCockpitLogic;
+ * swapped in from SpaceMap by the View command
  */
 class SpaceCockpit : public Map {
+private:
+	/**
+	 * Draws the static cockpit frame around the viewport (drawCockpitFrame)
+	 */
+	void drawCockpitFrame(Shared::Gfx::GfxSurface &s);
+
 public:
 	SpaceCockpit() : Map("SpaceCockpit") {}
 	~SpaceCockpit() override {}


Commit: 9720fc15bfa12a38c8760df2916303ee7b88a850
    https://github.com/scummvm/scummvm/commit/9720fc15bfa12a38c8760df2916303ee7b88a850
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:40:52+11:00

Commit Message:
ULTIMA: ULTIMA1: New SpaceGame and SpaceStats view classes

Changed paths:
  A engines/ultima/ultima1/views/space_game.cpp
  A engines/ultima/ultima1/views/space_game.h
  A engines/ultima/ultima1/views/space_stats.cpp
  A engines/ultima/ultima1/views/space_stats.h
    engines/ultima/module.mk
    engines/ultima/ultima1/data/map.cpp
    engines/ultima/ultima1/logic/logic.cpp
    engines/ultima/ultima1/logic/logic.h
    engines/ultima/ultima1/logic/space_logic.cpp
    engines/ultima/ultima1/logic/space_logic.h
    engines/ultima/ultima1/views/commands.cpp
    engines/ultima/ultima1/views/commands.h
    engines/ultima/ultima1/views/dialog.cpp
    engines/ultima/ultima1/views/views.h


diff --git a/engines/ultima/module.mk b/engines/ultima/module.mk
index d4d1f724ebc..6c1c1bd7659 100644
--- a/engines/ultima/module.mk
+++ b/engines/ultima/module.mk
@@ -100,7 +100,9 @@ MODULE_OBJS += \
 	ultima1/views/overworld.o \
 	ultima1/views/overworld_map.o \
 	ultima1/views/space_cockpit.o \
+	ultima1/views/space_game.o \
 	ultima1/views/space_map.o \
+	ultima1/views/space_stats.o \
 	ultima1/views/stats.o \
 	ultima1/views/startup.o \
 	ultima1/views/title.o \
diff --git a/engines/ultima/ultima1/data/map.cpp b/engines/ultima/ultima1/data/map.cpp
index b4e037a4ec1..0985ecbc041 100644
--- a/engines/ultima/ultima1/data/map.cpp
+++ b/engines/ultima/ultima1/data/map.cpp
@@ -243,11 +243,19 @@ void Map::load(int mapNum) {
 		break;
 	}
 
+	// Outer space uses its own base game frame (its own stats corner); make
+	// sure the right one - SpaceGame vs Game - is the active base before the
+	// map view goes on top of it
+	bool isSpaceView = (viewName == "SpaceMap" || viewName == "SpaceCockpit");
+	const char *baseViewName = isSpaceView ? "SpaceGame" : "Game";
+	if (!g_engine->isPresent(baseViewName))
+		g_engine->replaceView(baseViewName, true);
+
 	// If the focused view isn't already a dialog under the game frame, then reset to the game
 	// frame and draw it immediately
 	Views::Dialog *view = dynamic_cast<Views::Dialog *>(g_engine->focusedView());
 	if (view == nullptr) {
-		g_engine->replaceView("Game", true);
+		g_engine->replaceView(baseViewName, true);
 		g_engine->focusedView()->draw();
 
 		// Now add the appropriate map view on top of it
diff --git a/engines/ultima/ultima1/logic/logic.cpp b/engines/ultima/ultima1/logic/logic.cpp
index 5f087c89c17..ca3ae7e7025 100644
--- a/engines/ultima/ultima1/logic/logic.cpp
+++ b/engines/ultima/ultima1/logic/logic.cpp
@@ -31,8 +31,16 @@ namespace Logic {
 
 using namespace Shared::Messages;
 
+const char *Logic::commandsViewName() const {
+	return _G(map)._mapType == Data::MAPTYPE_SPACE ? "SpaceCommands" : "Commands";
+}
+
+const char *Logic::statsViewName() const {
+	return _G(map)._mapType == Data::MAPTYPE_SPACE ? "SpaceStats" : "Stats";
+}
+
 void Logic::writeString(const Common::String &msg) {
-	g_engine->findView("Commands")->send(GameMessage("TEXT", msg));
+	g_engine->findView(commandsViewName())->send(GameMessage("TEXT", msg));
 }
 
 void Logic::writeString(const char *format, ...) {
@@ -47,7 +55,7 @@ void Logic::writeString(const char *format, ...) {
 }
 
 void Logic::prompt() {
-	g_engine->findView("Commands")->send(GameMessage("PROMPT"));
+	g_engine->findView(commandsViewName())->send(GameMessage("PROMPT"));
 }
 
 void Logic::redrawMap() {
@@ -59,7 +67,7 @@ void Logic::showAttackTile(int x, int y, int tileId) {
 }
 
 void Logic::redrawStats() {
-	g_engine->findView("Stats")->draw();
+	g_engine->findView(statsViewName())->draw();
 }
 
 void Logic::playFX(int num) {
diff --git a/engines/ultima/ultima1/logic/logic.h b/engines/ultima/ultima1/logic/logic.h
index e80a860755a..a205f343ae2 100644
--- a/engines/ultima/ultima1/logic/logic.h
+++ b/engines/ultima/ultima1/logic/logic.h
@@ -49,6 +49,14 @@ protected:
 	int _weaponDamageScale = 8;
 
 
+	/**
+	 * The message-log and stats-corner view names for the current map. The
+	 * land and outer-space game frames keep their own copies (their stats
+	 * corners show different things), so these route to the right one
+	 */
+	const char *commandsViewName() const;
+	const char *statsViewName() const;
+
 	/**
 	 * Dispatches some text to be shown in the Commands window
 	 */
diff --git a/engines/ultima/ultima1/logic/space_logic.cpp b/engines/ultima/ultima1/logic/space_logic.cpp
index 3d7fcafa90c..92dfa2a07c9 100644
--- a/engines/ultima/ultima1/logic/space_logic.cpp
+++ b/engines/ultima/ultima1/logic/space_logic.cpp
@@ -24,6 +24,7 @@
 #include "ultima/ultima1/data/space_map.h"
 #include "ultima/ultima1/metaengine.h"
 #include "ultima/ultima1/ultima1.h"
+#include "ultima/shared/engine/events.h"
 
 namespace Ultima {
 namespace Ultima1 {
@@ -42,6 +43,22 @@ void SpaceLogic::entering() {
 	_G(shipIndex) = 2;
 	_G(cockpitSpeed) = 0;
 	_G(spaceMap).setup();
+
+	// Seed the player's own ship slot from the savegame. setupSpaceMap also
+	// parks two fighters at the station and positions everything - still
+	// TODO - but the fuel/shield are what the HUD and flight need
+	Data::SpaceMapShip &ship =
+		_G(spaceMap)._sectors[_G(sectorX)][_G(sectorY)]._ships[_G(shipIndex)];
+	ship._shipType = Data::SHIP_SHUTTLE;
+	ship._fuel = _G(savegame)._shipFuel;
+	ship._shield = _G(savegame)._shipShield;
+}
+
+void SpaceLogic::endOfTurn() {
+	redrawMap();
+	redrawStats();
+	// TODO: death in space (hits/shields at zero) returns to Sosaria via
+	// OUT.EXE, not the land resurrection sequence
 }
 
 int SpaceLogic::shipFuel() const {
@@ -51,7 +68,7 @@ int SpaceLogic::shipFuel() const {
 void SpaceLogic::subtractFuel(int amount) {
 	int16 &fuel = _G(spaceMap)._sectors[_G(sectorX)][_G(sectorY)]._ships[_G(shipIndex)]._fuel;
 	fuel = (fuel > amount) ? (int16)(fuel - amount) : 0;
-	// TODO: displayFuelNumber() - refresh the cockpit's fuel readout
+	redrawStats();
 }
 
 void SpaceLogic::keypress(Common::KeyCode keycode) {
diff --git a/engines/ultima/ultima1/logic/space_logic.h b/engines/ultima/ultima1/logic/space_logic.h
index 77b3bf5b370..aae9623f755 100644
--- a/engines/ultima/ultima1/logic/space_logic.h
+++ b/engines/ultima/ultima1/logic/space_logic.h
@@ -54,6 +54,12 @@ protected:
 	void updateCreatures() override {
 	}
 
+	/**
+	 * Space has no land-style turn (no food upkeep, no creature phase) - a
+	 * command just refreshes the display
+	 */
+	void endOfTurn() override;
+
 	/**
 	 * Inform - the animated sector scan of the galaxy (works in either view)
 	 */
diff --git a/engines/ultima/ultima1/views/commands.cpp b/engines/ultima/ultima1/views/commands.cpp
index 12a4f637bb4..9231174c117 100644
--- a/engines/ultima/ultima1/views/commands.cpp
+++ b/engines/ultima/ultima1/views/commands.cpp
@@ -30,7 +30,8 @@ namespace Views {
 constexpr int COLOR_TEXT = 11;      // light cyan - normal values
 constexpr int NEWLINE_DELAY = 50;	// Delay after a newline
 
-Commands::Commands(UIElement *parent) : Shared::UIElement("Commands", parent), _textCursor("CommandsCursor", this) {
+Commands::Commands(UIElement *parent, const Common::String &name) :
+		Shared::UIElement(name, parent), _textCursor("CommandsCursor", this) {
 }
 
 bool Commands::msgFocus(const FocusMessage &msg) {
diff --git a/engines/ultima/ultima1/views/commands.h b/engines/ultima/ultima1/views/commands.h
index 86e06084cb8..56e2fdf195b 100644
--- a/engines/ultima/ultima1/views/commands.h
+++ b/engines/ultima/ultima1/views/commands.h
@@ -51,7 +51,9 @@ private:
 	void space();
 
 public:
-	Commands(UIElement *parent);
+	// name lets the space game frame register its own copy ("SpaceCommands")
+	// so it doesn't collide with the land frame's in findView
+	Commands(UIElement *parent, const Common::String &name = "Commands");
 	~Commands() override {}
 
 	bool msgFocus(const FocusMessage &msg) override;
diff --git a/engines/ultima/ultima1/views/dialog.cpp b/engines/ultima/ultima1/views/dialog.cpp
index 97e7a9a41f5..f4040b2e557 100644
--- a/engines/ultima/ultima1/views/dialog.cpp
+++ b/engines/ultima/ultima1/views/dialog.cpp
@@ -69,7 +69,7 @@ void Dialog::draw() {
 }
 
 bool Dialog::tick() {
-	g_engine->findView("Game")->tick();
+	g_engine->findView(_G(map)._mapType == Data::MAPTYPE_SPACE ? "SpaceGame" : "Game")->tick();
 	return Shared::Gfx::View::tick();
 }
 
diff --git a/engines/ultima/ultima1/views/space_game.cpp b/engines/ultima/ultima1/views/space_game.cpp
new file mode 100644
index 00000000000..885aeb4425b
--- /dev/null
+++ b/engines/ultima/ultima1/views/space_game.cpp
@@ -0,0 +1,52 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "ultima/ultima1/views/space_game.h"
+#include "ultima/shared/gfx/rect.h"
+
+namespace Ultima {
+namespace Ultima1 {
+namespace Views {
+
+// Colors used
+constexpr int COLOR_BORDER = 1;  // blue - thick outer band
+constexpr int COLOR_EDGE = 15;   // white - thin inner highlight line
+
+SpaceGame::SpaceGame() : Shared::Gfx::View("SpaceGame"),
+		_commands(this, "SpaceCommands"), _stats(this) {
+	setBounds(TextRect(0, 0, 39, 24));
+	_commands.setBounds(TextRect(0, 20, 29, 24));
+	_stats.setBounds(TextRect(31, 21, 39, 24));
+}
+
+void SpaceGame::draw() {
+	auto s = getSurface();
+	Shared::UIElement::draw();
+
+	// Divider between the command/message log (left) and the stats corner
+	s.fillRect(Common::Rect(241, 160, 247, 200), COLOR_BORDER);
+	s.drawLine(240, 160, 240, 199, COLOR_EDGE);
+	s.drawLine(247, 160, 247, 199, COLOR_EDGE);
+}
+
+} // namespace Views
+} // namespace Ultima1
+} // namespace Ultima
diff --git a/engines/ultima/ultima1/views/space_game.h b/engines/ultima/ultima1/views/space_game.h
new file mode 100644
index 00000000000..ea4f4e7393e
--- /dev/null
+++ b/engines/ultima/ultima1/views/space_game.h
@@ -0,0 +1,55 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef ULTIMA1_VIEWS_SPACE_GAME_H
+#define ULTIMA1_VIEWS_SPACE_GAME_H
+
+#include "ultima/shared/gfx/view.h"
+#include "ultima/ultima1/views/commands.h"
+#include "ultima/ultima1/views/space_stats.h"
+
+namespace Ultima {
+namespace Ultima1 {
+namespace Views {
+
+/**
+ * The base in-space screen - the outer-space counterpart of Game. Draws the
+ * shared frame and owns the message log and the Shld/Fuel/Exp/Coin corner
+ * readout; SpaceMap or SpaceCockpit is layered on top for the actual view
+ */
+class SpaceGame : public Shared::Gfx::View {
+private:
+	Commands _commands;
+	SpaceStats _stats;
+
+public:
+	SpaceGame();
+	~SpaceGame() override {
+	}
+
+	void draw() override;
+};
+
+} // namespace Views
+} // namespace Ultima1
+} // namespace Ultima
+
+#endif
diff --git a/engines/ultima/ultima1/views/space_stats.cpp b/engines/ultima/ultima1/views/space_stats.cpp
new file mode 100644
index 00000000000..bc0f937ce71
--- /dev/null
+++ b/engines/ultima/ultima1/views/space_stats.cpp
@@ -0,0 +1,68 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "ultima/ultima1/views/space_stats.h"
+#include "ultima/ultima1/data/space_map.h"
+#include "ultima/ultima1/ultima1.h"
+
+namespace Ultima {
+namespace Ultima1 {
+namespace Views {
+
+constexpr int COLOR_TEXT = 11;			// light cyan - normal values
+constexpr int COLOR_HIGHLIGHT = 12;		// light red - low shield/fuel warning
+
+void SpaceStats::draw() {
+	Data::Savegame &p = _G(savegame);
+	const Data::SpaceMapShip &ship =
+		_G(spaceMap)._sectors[_G(sectorX)][_G(sectorY)]._ships[_G(shipIndex)];
+
+	auto s = getSurface();
+	s.clear();
+
+	if (p._experience > 9999)
+		p._experience = 9999;
+	if (p._coins > 9999)
+		p._coins = 9999;
+
+	// Shield and fuel go red once they're running low, matching
+	// displayShieldNumber / displayFuelNumber
+	s.setColor(COLOR_TEXT);
+	s.writeString(Common::Point(0, 0), "Shld:");
+	s.setColor(ship._shield < 100 ? COLOR_HIGHLIGHT : COLOR_TEXT);
+	s.writeString(Common::Point(5, 0), Common::String::format("%4d", ship._shield));
+
+	s.setColor(COLOR_TEXT);
+	s.writeString(Common::Point(0, 1), "Fuel:");
+	s.setColor(ship._fuel < 100 ? COLOR_HIGHLIGHT : COLOR_TEXT);
+	s.writeString(Common::Point(5, 1), Common::String::format("%4d", ship._fuel));
+
+	s.setColor(COLOR_TEXT);
+	s.writeString(Common::Point(0, 2), "Exp.:");
+	s.writeString(Common::Point(5, 2), Common::String::format("%4d", p._experience));
+
+	s.writeString(Common::Point(0, 3), "Coin:");
+	s.writeString(Common::Point(5, 3), Common::String::format("%4d", p._coins));
+}
+
+} // namespace Views
+} // namespace Ultima1
+} // namespace Ultima
diff --git a/engines/ultima/ultima1/views/space_stats.h b/engines/ultima/ultima1/views/space_stats.h
new file mode 100644
index 00000000000..292b7fd6000
--- /dev/null
+++ b/engines/ultima/ultima1/views/space_stats.h
@@ -0,0 +1,48 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef ULTIMA1_VIEWS_SPACE_STATS_H
+#define ULTIMA1_VIEWS_SPACE_STATS_H
+
+#include "ultima/shared/engine/events.h"
+
+namespace Ultima {
+namespace Ultima1 {
+namespace Views {
+
+/**
+ * The outer-space corner readout - the current ship's Shld and Fuel, plus
+ * the character's Exp. and Coin. The space counterpart of Stats (which
+ * shows Hits/Food instead)
+ */
+class SpaceStats : public Shared::UIElement {
+public:
+	SpaceStats(UIElement *parent) : Shared::UIElement("SpaceStats", parent) {}
+	~SpaceStats() override {}
+
+	void draw() override;
+};
+
+} // namespace Views
+} // namespace Ultima1
+} // namespace Ultima
+
+#endif
diff --git a/engines/ultima/ultima1/views/views.h b/engines/ultima/ultima1/views/views.h
index 61f8c9aeceb..89cfb7b5c28 100644
--- a/engines/ultima/ultima1/views/views.h
+++ b/engines/ultima/ultima1/views/views.h
@@ -44,6 +44,7 @@
 #include "ultima/ultima1/views/mondain_map.h"
 #include "ultima/ultima1/views/overworld_map.h"
 #include "ultima/ultima1/views/space_cockpit.h"
+#include "ultima/ultima1/views/space_game.h"
 #include "ultima/ultima1/views/space_map.h"
 #include "ultima/ultima1/views/startup.h"
 #include "ultima/ultima1/views/title.h"
@@ -75,6 +76,7 @@ struct Views : public Shared::Views {
 	MondainMap _mondainMap;
 	OverworldMap _overworldMap;
 	SpaceCockpit _spaceCockpit;
+	SpaceGame _spaceGame;
 	SpaceMap _spaceMap;
 	Startup _startup;
 	Title _title;


Commit: 303ec19826c7dc123183a1ab15c3921296a88556
    https://github.com/scummvm/scummvm/commit/303ec19826c7dc123183a1ab15c3921296a88556
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:40:52+11:00

Commit Message:
ULTIMA: ULTIMA1: Console improvement for loading space map

Changed paths:
    engines/ultima/ultima1/console.cpp
    engines/ultima/ultima1/logic/space_cockpit_logic.cpp
    engines/ultima/ultima1/logic/space_logic.cpp
    engines/ultima/ultima1/logic/space_map_logic.cpp


diff --git a/engines/ultima/ultima1/console.cpp b/engines/ultima/ultima1/console.cpp
index 7355dc09d16..d3d3dbf8d14 100644
--- a/engines/ultima/ultima1/console.cpp
+++ b/engines/ultima/ultima1/console.cpp
@@ -65,6 +65,11 @@ bool Console::cmdMap(int argc, const char **argv) {
 		if (location >= 41 && location < 49) {
 			g_engine->send("Pillar", Shared::Messages::GameMessage("PILLAR", location - 41));
 		} else {
+			if (location == Data::MAP_SPACE) {
+				_G(savegame)._shipFuel = 9999;
+				_G(savegame)._shipShield = 9999;
+			}
+
 			_G(map).load(location);
 			_G(logic)->entering();
 		}
diff --git a/engines/ultima/ultima1/logic/space_cockpit_logic.cpp b/engines/ultima/ultima1/logic/space_cockpit_logic.cpp
index 843a12d8d79..d98f7377c15 100644
--- a/engines/ultima/ultima1/logic/space_cockpit_logic.cpp
+++ b/engines/ultima/ultima1/logic/space_cockpit_logic.cpp
@@ -120,7 +120,7 @@ bool SpaceCockpitLogic::view() {
 	writeString("View\n");
 	_G(logic) = Common::SharedPtr<Logic>(new SpaceMapLogic());
 	g_engine->replaceView("SpaceMap");
-	return false;
+	return true;
 }
 
 } // namespace Logic
diff --git a/engines/ultima/ultima1/logic/space_logic.cpp b/engines/ultima/ultima1/logic/space_logic.cpp
index 92dfa2a07c9..b5c89277c11 100644
--- a/engines/ultima/ultima1/logic/space_logic.cpp
+++ b/engines/ultima/ultima1/logic/space_logic.cpp
@@ -52,6 +52,8 @@ void SpaceLogic::entering() {
 	ship._shipType = Data::SHIP_SHUTTLE;
 	ship._fuel = _G(savegame)._shipFuel;
 	ship._shield = _G(savegame)._shipShield;
+
+	redrawStats();
 }
 
 void SpaceLogic::endOfTurn() {
diff --git a/engines/ultima/ultima1/logic/space_map_logic.cpp b/engines/ultima/ultima1/logic/space_map_logic.cpp
index 544cc6d7867..1d6f0f45f94 100644
--- a/engines/ultima/ultima1/logic/space_map_logic.cpp
+++ b/engines/ultima/ultima1/logic/space_map_logic.cpp
@@ -54,7 +54,7 @@ bool SpaceMapLogic::view() {
 	// drift
 	_G(logic) = Common::SharedPtr<Logic>(new SpaceCockpitLogic());
 	g_engine->replaceView("SpaceCockpit");
-	return false;
+	return true;
 }
 
 } // namespace Logic


Commit: 484664914f3c5d502aa50d5e24781556be935722
    https://github.com/scummvm/scummvm/commit/484664914f3c5d502aa50d5e24781556be935722
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:40:52+11:00

Commit Message:
ULTIMA: ULTIMA1: Fix keybinding keys for attacks

Changed paths:
    engines/ultima/ultima1/metaengine.cpp
    engines/ultima/ultima1/metaengine.h
    engines/ultima/ultima1/views/space_cockpit.cpp
    engines/ultima/ultima1/views/space_map.cpp


diff --git a/engines/ultima/ultima1/metaengine.cpp b/engines/ultima/ultima1/metaengine.cpp
index 83dab6cce78..31c4f1414be 100644
--- a/engines/ultima/ultima1/metaengine.cpp
+++ b/engines/ultima/ultima1/metaengine.cpp
@@ -40,19 +40,45 @@ static const KeybindingRecord MINIMAL_KEYS[] = {
 	{ KEYBIND_NONE, nullptr, nullptr, nullptr, nullptr }
 };
 
-static const KeybindingRecord MENU_KEYS[] = {
+static const KeybindingRecord GAMEPLAY_KEYS[] = {
+	{ KEYBIND_UP, "UP", _s("Up"), "UP", "JOY_UP"},
+	{ KEYBIND_DOWN, "DOWN", _s("Down"), "DOWN", "JOY_DOWN"},
+	{ KEYBIND_LEFT, "LEFT", _s("Left"), "LEFT", "JOY_LEFT"},
+	{ KEYBIND_RIGHT, "RIGHT", _s("Right"), "RIGHT", "JOY_RIGHT"},
+	{ KEYBIND_ATTACK_UP, "ATTACK_UP", _s("Attack Up"), "8", nullptr},
+	{ KEYBIND_ATTACK_DOWN, "ATTACK_DOWN", _s("Attack Down"), "2", nullptr},
+	{ KEYBIND_ATTACK_LEFT, "ATTACK_LEFT", _s("Attack Left"), "4", nullptr},
+	{ KEYBIND_ATTACK_RIGHT, "ATTACK_RIGHT", _s("Attack Right"), "6", nullptr},
+	{ KEYBIND_BOARD, "BOARD", _s("Board"), "b", nullptr },
+	{ KEYBIND_CAST, "CAST", _s("Cast"), "c", nullptr },
+	{ KEYBIND_DROP, "DROP", _s("Drop"), "d", nullptr },
+	{ KEYBIND_ENTER, "ENTER", _s("Enter"), "e", nullptr },
+	{ KEYBIND_FIRE, "FIRE", _s("Fire"), "f", nullptr },
+	{ KEYBIND_GET, "GET", _s("Get"), "g", nullptr },
+	{ KEYBIND_HYPERJUMP, "HYPERJUMP", _s("Hyperjump"), "h", nullptr },
+	{ KEYBIND_INFORM, "INFORM", _s("Inform"), "i", nullptr },
+	{ KEYBIND_CLIMB, "CLIMB", _s("Klimb"), "k", nullptr },
+	{ KEYBIND_NOISE, "NOISE", _s("Noise"), "n", nullptr },
+	{ KEYBIND_OPEN, "OPEN", _s("Open"), "o", nullptr },
+	{ KEYBIND_QUIT, "QUIT", _s("Quit"), "q", nullptr },
+	{ KEYBIND_READY, "READY", _s("Ready"), "r", nullptr },
+	{ KEYBIND_STEAL, "STEAL", _s("Steal"), "s", nullptr },
+	{ KEYBIND_TRANSACT, "TRANSACT", _s("Transact"), "t", nullptr },
+	{ KEYBIND_UNLOCK, "UNLOCK", _s("Unlock"), "u", nullptr },
+	{ KEYBIND_VIEW, "VIEW", _s("View change"), "v", nullptr },
+	{ KEYBIND_EXIT, "EXIT", _s("eXit"), "x", nullptr },
+	{ KEYBIND_STATS, "STATS", _s("Ztats"), "z", nullptr },
+	{ KEYBIND_PASS, "PASS", _s("Pass"), " ", nullptr },
 	{ KEYBIND_NONE, nullptr, nullptr, nullptr, nullptr }
 };
 
-static const KeybindingRecord GAMEPLAY_KEYS[] = {
+// Space has everything but the directional attack keys (though most don't do anything).
+// Not those keys because the numbers are used for speed control
+static const KeybindingRecord SPACE_KEYS[] = {
 	{ KEYBIND_UP, "UP", _s("Up"), "UP", "JOY_UP"},
 	{ KEYBIND_DOWN, "DOWN", _s("Down"), "DOWN", "JOY_DOWN"},
 	{ KEYBIND_LEFT, "LEFT", _s("Left"), "LEFT", "JOY_LEFT"},
 	{ KEYBIND_RIGHT, "RIGHT", _s("Right"), "RIGHT", "JOY_RIGHT"},
-	{ KEYBIND_UP, "ATTACK_UP", _s("Attack Up"), "8", nullptr},
-	{ KEYBIND_DOWN, "ATTACK_DOWN", _s("Attack Down"), "2", nullptr},
-	{ KEYBIND_LEFT, "ATTACK_LEFT", _s("Attack Left"), "4", nullptr},
-	{ KEYBIND_RIGHT, "ATTACK_RIGHT", _s("Attack Right"), "6", nullptr},
 	{ KEYBIND_BOARD, "BOARD", _s("Board"), "b", nullptr },
 	{ KEYBIND_CAST, "CAST", _s("Cast"), "c", nullptr },
 	{ KEYBIND_DROP, "DROP", _s("Drop"), "d", nullptr },
@@ -84,7 +110,6 @@ struct KeysRecord {
 
 static const KeysRecord ALL_RECORDS[] = {
 	{ "Ultima1", _s("Basic keys"), MINIMAL_KEYS },
-	{ "menu", _s("Menu keys"), MENU_KEYS },
 	{ "gameplay", _s("Gameplay keys"), GAMEPLAY_KEYS },
 	{ nullptr, nullptr, nullptr }
 };
@@ -94,23 +119,23 @@ static const KeysRecord MINIMAL_RECORDS[] = {
 	{ nullptr, nullptr, nullptr }
 };
 
-static const KeysRecord MENU_RECORDS[] = {
+static const KeysRecord GAMEPLAY_RECORDS[] = {
 	{ "Ultima1", _s("Basic keys"), MINIMAL_KEYS },
-	{ "menu", _s("Menu keys"), MENU_KEYS },
+	{ "gameplay", _s("Gameplay keys"), GAMEPLAY_KEYS },
 	{ nullptr, nullptr, nullptr }
 };
 
-static const KeysRecord GAMEPLAY_RECORDS[] = {
+static const KeysRecord SPACE_RECORDS[] = {
 	{ "Ultima1", _s("Basic keys"), MINIMAL_KEYS },
-	{ "gameplay", _s("Gameplay keys"), GAMEPLAY_KEYS },
+	{ "space", _s("Gameplay keys"), SPACE_KEYS },
 	{ nullptr, nullptr, nullptr }
 };
 
 static const KeysRecord *MODE_RECORDS[] = {
 	ALL_RECORDS,
 	MINIMAL_RECORDS,
-	MENU_RECORDS,
-	GAMEPLAY_RECORDS
+	GAMEPLAY_RECORDS,
+	SPACE_RECORDS
 };
 
 Common::KeymapArray MetaEngine::initKeymaps(KeybindingMode mode) {
diff --git a/engines/ultima/ultima1/metaengine.h b/engines/ultima/ultima1/metaengine.h
index e8494e06e4d..b5c4a6e411c 100644
--- a/engines/ultima/ultima1/metaengine.h
+++ b/engines/ultima/ultima1/metaengine.h
@@ -40,8 +40,8 @@ enum KeybindingAction {
 enum KeybindingMode {
 	KBMODE_ALL,
 	KBMODE_MINIMAL,
-	KBMODE_MENUS,
-	KBMODE_GAMEPLAY
+	KBMODE_GAMEPLAY,
+	KBMODE_SPACE
 };
 
 class MetaEngine {
diff --git a/engines/ultima/ultima1/views/space_cockpit.cpp b/engines/ultima/ultima1/views/space_cockpit.cpp
index 62d6566af48..aeaffaca817 100644
--- a/engines/ultima/ultima1/views/space_cockpit.cpp
+++ b/engines/ultima/ultima1/views/space_cockpit.cpp
@@ -33,7 +33,7 @@ constexpr int STAR_COLOR = 15;		// white stars / crosshair
 constexpr int RIVET_COLOR = 0;		// black detail punched into the frame
 
 bool SpaceCockpit::msgFocus(const FocusMessage &msg) {
-	MetaEngine::setKeybindingMode(KBMODE_GAMEPLAY);
+	MetaEngine::setKeybindingMode(KBMODE_SPACE);
 	_G(starfield).reset();
 	return Map::msgFocus(msg);
 }
diff --git a/engines/ultima/ultima1/views/space_map.cpp b/engines/ultima/ultima1/views/space_map.cpp
index aaa7ca9b079..dd156e73661 100644
--- a/engines/ultima/ultima1/views/space_map.cpp
+++ b/engines/ultima/ultima1/views/space_map.cpp
@@ -28,7 +28,7 @@ namespace Ultima1 {
 namespace Views {
 
 bool SpaceMap::msgFocus(const FocusMessage &msg) {
-	MetaEngine::setKeybindingMode(KBMODE_GAMEPLAY);
+	MetaEngine::setKeybindingMode(KBMODE_SPACE);
 	return Map::msgFocus(msg);
 }
 


Commit: c8c26a27d04c5ca7f4e2572f949d0a4252da77bd
    https://github.com/scummvm/scummvm/commit/c8c26a27d04c5ca7f4e2572f949d0a4252da77bd
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:40:52+11:00

Commit Message:
ULTIMA: ULTIMA1: Space commands cursor fixes

Changed paths:
    engines/ultima/shared/engine/events.h
    engines/ultima/ultima1/logic/logic.cpp
    engines/ultima/ultima1/logic/logic.h
    engines/ultima/ultima1/logic/space_cockpit_logic.cpp
    engines/ultima/ultima1/logic/space_logic.cpp
    engines/ultima/ultima1/views/commands.cpp
    engines/ultima/ultima1/views/commands.h
    engines/ultima/ultima1/views/interactions/interaction.cpp
    engines/ultima/ultima1/views/space_game.cpp
    engines/ultima/ultima1/views/space_stats.h


diff --git a/engines/ultima/shared/engine/events.h b/engines/ultima/shared/engine/events.h
index 3d25581f81f..54725c8211b 100644
--- a/engines/ultima/shared/engine/events.h
+++ b/engines/ultima/shared/engine/events.h
@@ -380,6 +380,13 @@ public:
 			_views[_views.size() - 2];
 	}
 
+	/**
+	 * Returns the earliest view on the view stack, if any
+	 */
+	UIElement *baseView() const {
+		return _views.empty() ? nullptr : _views[0];
+	}
+
 	/**
 	 * Returns true if a view of a given name is present
 	 * at all in the visible view stack
diff --git a/engines/ultima/ultima1/logic/logic.cpp b/engines/ultima/ultima1/logic/logic.cpp
index ca3ae7e7025..255930c114d 100644
--- a/engines/ultima/ultima1/logic/logic.cpp
+++ b/engines/ultima/ultima1/logic/logic.cpp
@@ -31,16 +31,8 @@ namespace Logic {
 
 using namespace Shared::Messages;
 
-const char *Logic::commandsViewName() const {
-	return _G(map)._mapType == Data::MAPTYPE_SPACE ? "SpaceCommands" : "Commands";
-}
-
-const char *Logic::statsViewName() const {
-	return _G(map)._mapType == Data::MAPTYPE_SPACE ? "SpaceStats" : "Stats";
-}
-
 void Logic::writeString(const Common::String &msg) {
-	g_engine->findView(commandsViewName())->send(GameMessage("TEXT", msg));
+	g_engine->baseView()->findView("Commands")->send(GameMessage("TEXT", msg));
 }
 
 void Logic::writeString(const char *format, ...) {
@@ -55,7 +47,7 @@ void Logic::writeString(const char *format, ...) {
 }
 
 void Logic::prompt() {
-	g_engine->findView(commandsViewName())->send(GameMessage("PROMPT"));
+	g_engine->baseView()->findView("Commands")->send(GameMessage("PROMPT"));
 }
 
 void Logic::redrawMap() {
@@ -67,7 +59,7 @@ void Logic::showAttackTile(int x, int y, int tileId) {
 }
 
 void Logic::redrawStats() {
-	g_engine->findView(statsViewName())->draw();
+	g_engine->baseView()->findView("Stats")->draw();
 }
 
 void Logic::playFX(int num) {
diff --git a/engines/ultima/ultima1/logic/logic.h b/engines/ultima/ultima1/logic/logic.h
index a205f343ae2..200993cb322 100644
--- a/engines/ultima/ultima1/logic/logic.h
+++ b/engines/ultima/ultima1/logic/logic.h
@@ -48,15 +48,6 @@ protected:
 	// overrides it to 3 to match the Mondain encounter's own weaker curve
 	int _weaponDamageScale = 8;
 
-
-	/**
-	 * The message-log and stats-corner view names for the current map. The
-	 * land and outer-space game frames keep their own copies (their stats
-	 * corners show different things), so these route to the right one
-	 */
-	const char *commandsViewName() const;
-	const char *statsViewName() const;
-
 	/**
 	 * Dispatches some text to be shown in the Commands window
 	 */
diff --git a/engines/ultima/ultima1/logic/space_cockpit_logic.cpp b/engines/ultima/ultima1/logic/space_cockpit_logic.cpp
index d98f7377c15..0d96dbbd296 100644
--- a/engines/ultima/ultima1/logic/space_cockpit_logic.cpp
+++ b/engines/ultima/ultima1/logic/space_cockpit_logic.cpp
@@ -39,6 +39,8 @@ void SpaceCockpitLogic::setSpeed(int speed) {
 		_G(cockpitSpeed) = speed;
 		subtractFuel(reqFuel);
 	}
+
+	prompt();
 }
 
 void SpaceCockpitLogic::keypress(Common::KeyCode keycode) {
diff --git a/engines/ultima/ultima1/logic/space_logic.cpp b/engines/ultima/ultima1/logic/space_logic.cpp
index b5c89277c11..9f0665330a2 100644
--- a/engines/ultima/ultima1/logic/space_logic.cpp
+++ b/engines/ultima/ultima1/logic/space_logic.cpp
@@ -76,10 +76,11 @@ void SpaceLogic::subtractFuel(int amount) {
 void SpaceLogic::keypress(Common::KeyCode keycode) {
 	writeString("Huh?\n");
 	playFX(1);
+	prompt();
 }
 
 bool SpaceLogic::inform() {
-	writeString("Inform and Search\n");
+	writeString("Inform and Search");
 	g_engine->addView("SectorScan");
 	return false;
 }
diff --git a/engines/ultima/ultima1/views/commands.cpp b/engines/ultima/ultima1/views/commands.cpp
index 9231174c117..751022d2669 100644
--- a/engines/ultima/ultima1/views/commands.cpp
+++ b/engines/ultima/ultima1/views/commands.cpp
@@ -30,12 +30,7 @@ namespace Views {
 constexpr int COLOR_TEXT = 11;      // light cyan - normal values
 constexpr int NEWLINE_DELAY = 50;	// Delay after a newline
 
-Commands::Commands(UIElement *parent, const Common::String &name) :
-		Shared::UIElement(name, parent), _textCursor("CommandsCursor", this) {
-}
-
-bool Commands::msgFocus(const FocusMessage &msg) {
-	return true;
+Commands::Commands(UIElement *parent) : Shared::UIElement("Commands", parent), _textCursor("CommandsCursor", this) {
 }
 
 void Commands::draw() {
diff --git a/engines/ultima/ultima1/views/commands.h b/engines/ultima/ultima1/views/commands.h
index 56e2fdf195b..d2c7156b1ca 100644
--- a/engines/ultima/ultima1/views/commands.h
+++ b/engines/ultima/ultima1/views/commands.h
@@ -51,12 +51,9 @@ private:
 	void space();
 
 public:
-	// name lets the space game frame register its own copy ("SpaceCommands")
-	// so it doesn't collide with the land frame's in findView
-	Commands(UIElement *parent, const Common::String &name = "Commands");
+	Commands(UIElement *parent);
 	~Commands() override {}
 
-	bool msgFocus(const FocusMessage &msg) override;
 	void draw() override;
 	bool msgGame(const GameMessage &msg) override;
 };
diff --git a/engines/ultima/ultima1/views/interactions/interaction.cpp b/engines/ultima/ultima1/views/interactions/interaction.cpp
index 3d402beec96..1c4c9156ba1 100644
--- a/engines/ultima/ultima1/views/interactions/interaction.cpp
+++ b/engines/ultima/ultima1/views/interactions/interaction.cpp
@@ -34,12 +34,12 @@ Interaction::Interaction(const Common::String &name) : View(name) {
 }
 
 bool Interaction::tick() {
-	g_engine->findView("Commands")->tick();
+	g_engine->baseView()->findView("Commands")->tick();
 	return Shared::Gfx::View::tick();
 }
 
 void Interaction::writeString(const Common::String &msg) {
-	g_engine->findView("Commands")->send(GameMessage("TEXT", msg));
+	g_engine->baseView()->findView("Commands")->send(GameMessage("TEXT", msg));
 }
 
 void Interaction::writeString(const char *format, ...) {
diff --git a/engines/ultima/ultima1/views/space_game.cpp b/engines/ultima/ultima1/views/space_game.cpp
index 885aeb4425b..1ec01654230 100644
--- a/engines/ultima/ultima1/views/space_game.cpp
+++ b/engines/ultima/ultima1/views/space_game.cpp
@@ -30,8 +30,7 @@ namespace Views {
 constexpr int COLOR_BORDER = 1;  // blue - thick outer band
 constexpr int COLOR_EDGE = 15;   // white - thin inner highlight line
 
-SpaceGame::SpaceGame() : Shared::Gfx::View("SpaceGame"),
-		_commands(this, "SpaceCommands"), _stats(this) {
+SpaceGame::SpaceGame() : Shared::Gfx::View("SpaceGame"), _commands(this), _stats(this) {
 	setBounds(TextRect(0, 0, 39, 24));
 	_commands.setBounds(TextRect(0, 20, 29, 24));
 	_stats.setBounds(TextRect(31, 21, 39, 24));
diff --git a/engines/ultima/ultima1/views/space_stats.h b/engines/ultima/ultima1/views/space_stats.h
index 292b7fd6000..17816914753 100644
--- a/engines/ultima/ultima1/views/space_stats.h
+++ b/engines/ultima/ultima1/views/space_stats.h
@@ -35,7 +35,7 @@ namespace Views {
  */
 class SpaceStats : public Shared::UIElement {
 public:
-	SpaceStats(UIElement *parent) : Shared::UIElement("SpaceStats", parent) {}
+	SpaceStats(UIElement *parent) : Shared::UIElement("Stats", parent) {}
 	~SpaceStats() override {}
 
 	void draw() override;


Commit: 0d2832f09a805db1a0cce3017aacdddf13fa0f06
    https://github.com/scummvm/scummvm/commit/0d2832f09a805db1a0cce3017aacdddf13fa0f06
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:40:52+11:00

Commit Message:
ULTIMA: ULTIMA1: Move space related globals to Savegame

Changed paths:
    engines/ultima/ultima1/data/savegame.cpp
    engines/ultima/ultima1/data/savegame.h
    engines/ultima/ultima1/data/space_map.cpp
    engines/ultima/ultima1/data/space_map.h
    engines/ultima/ultima1/logic/space_logic.cpp
    engines/ultima/ultima1/ultima1.h
    engines/ultima/ultima1/views/interactions/sector_scan.cpp
    engines/ultima/ultima1/views/space_stats.cpp


diff --git a/engines/ultima/ultima1/data/savegame.cpp b/engines/ultima/ultima1/data/savegame.cpp
index ef98d4c6556..a3783692de1 100644
--- a/engines/ultima/ultima1/data/savegame.cpp
+++ b/engines/ultima/ultima1/data/savegame.cpp
@@ -121,6 +121,13 @@ void Savegame::synchronizeExtra(Common::Serializer &s) {
 		s.syncAsSint16LE(_mondainHazardPos.x);
 		s.syncAsSint16LE(_mondainHazardPos.y);
 	}
+
+	if (_mapNum == MAP_SPACE) {
+		s.syncAsSint16LE(_sectorX);
+		s.syncAsSint16LE(_sectorY);
+		s.syncAsSint16LE(_shipIndex);
+		_starmap.synchronize(s);
+	}
 }
 
 void Savegame::synchronize(Common::Serializer &s) {
diff --git a/engines/ultima/ultima1/data/savegame.h b/engines/ultima/ultima1/data/savegame.h
index 0da77b129c2..a50ec8a2fbd 100644
--- a/engines/ultima/ultima1/data/savegame.h
+++ b/engines/ultima/ultima1/data/savegame.h
@@ -26,6 +26,7 @@
 #include "common/serializer.h"
 #include "ultima/ultima1/data/data.h"
 #include "ultima/ultima1/data/entity.h"
+#include "ultima/ultima1/data/space_map.h"
 
 namespace Ultima {
 namespace Ultima1 {
@@ -127,6 +128,12 @@ public:
 	uint8 _dungeonDirection = 4;
 	uint16 _dungeonExitHitPoints = 0;
 
+	// Outer space state - synchronized only while _mapNum == MAP_SPACE
+	int16 _sectorX = SPACE_STATION_X;
+	int16 _sectorY = SPACE_STATION_Y;
+	int16 _shipIndex = 2;
+	SpaceMap _starmap;
+
 	bool _gemDestroyedFlag = false;
 	Common::Point _mondainPos;
 	// Set to 1 when the player first steps next to Mondain, then counts up
diff --git a/engines/ultima/ultima1/data/space_map.cpp b/engines/ultima/ultima1/data/space_map.cpp
index 743fbe733b9..6e8cad8cab8 100644
--- a/engines/ultima/ultima1/data/space_map.cpp
+++ b/engines/ultima/ultima1/data/space_map.cpp
@@ -69,6 +69,32 @@ void SpaceMap::setup() {
 	// not for the sector scan
 }
 
+void SpaceMapShip::synchronize(Common::Serializer &s) {
+	s.syncAsSint16LE(_x);
+	s.syncAsSint16LE(_y);
+	s.syncAsSint16LE(_shipType);
+	s.syncAsSint16LE(_fuel);
+	s.syncAsSint16LE(_shield);
+	s.syncAsSint16LE(_facing);
+}
+
+void SpaceMapCell::synchronize(Common::Serializer &s) {
+	s.syncAsSint16LE(_enemyCount);
+	s.syncAsSint16LE(_hazardX);
+	s.syncAsSint16LE(_hazardY);
+	s.syncAsSint16LE(_anchorX);
+	s.syncAsSint16LE(_anchorY);
+
+	for (int i = 0; i < SPACE_SHIPS_PER_SECTOR; ++i)
+		_ships[i].synchronize(s);
+}
+
+void SpaceMap::synchronize(Common::Serializer &s) {
+	for (int x = 0; x < SPACE_SECTOR_COUNT; ++x)
+		for (int y = 0; y < SPACE_SECTOR_COUNT; ++y)
+			_sectors[x][y].synchronize(s);
+}
+
 void SpaceMap::setupSector(int x, int y) {
 	SpaceMapCell &cell = _sectors[x][y];
 
diff --git a/engines/ultima/ultima1/data/space_map.h b/engines/ultima/ultima1/data/space_map.h
index ca36dfdda24..ebe9aea239a 100644
--- a/engines/ultima/ultima1/data/space_map.h
+++ b/engines/ultima/ultima1/data/space_map.h
@@ -23,6 +23,7 @@
 #define ULTIMA1_DATA_SPACE_MAP_H
 
 #include "common/scummsys.h"
+#include "common/serializer.h"
 
 namespace Ultima {
 namespace Ultima1 {
@@ -61,6 +62,8 @@ struct SpaceMapShip {
 	int16 _fuel = 0;
 	int16 _shield = 0;
 	int16 _facing = 0;
+
+	void synchronize(Common::Serializer &s);
 };
 
 /**
@@ -78,6 +81,8 @@ struct SpaceMapCell {
 	int16 _anchorX = 0, _anchorY = 0;
 
 	SpaceMapShip _ships[SPACE_SHIPS_PER_SECTOR];
+
+	void synchronize(Common::Serializer &s);
 };
 
 /**
@@ -108,6 +113,13 @@ public:
 	 * (Re)generates the whole galaxy
 	 */
 	void setup();
+
+	/**
+	 * Synchronizes the current state of every sector - called from the
+	 * savegame while the player is actually in space, since the galaxy
+	 * isn't just regenerated from the seed once ships/fuel/hazards diverge
+	 */
+	void synchronize(Common::Serializer &s);
 };
 
 // The cockpit view's warp starfield holds this many stars
diff --git a/engines/ultima/ultima1/logic/space_logic.cpp b/engines/ultima/ultima1/logic/space_logic.cpp
index 9f0665330a2..118e848a52e 100644
--- a/engines/ultima/ultima1/logic/space_logic.cpp
+++ b/engines/ultima/ultima1/logic/space_logic.cpp
@@ -38,17 +38,17 @@ void SpaceLogic::entering() {
 	// The original re-launches SPACE.EXE each time, always starting fresh
 	// at the station sector with a newly rolled galaxy, flying the shuttle
 	// out of the docking bay
-	_G(sectorX) = Data::SPACE_STATION_X;
-	_G(sectorY) = Data::SPACE_STATION_Y;
-	_G(shipIndex) = 2;
+	_G(savegame)._sectorX = Data::SPACE_STATION_X;
+	_G(savegame)._sectorY = Data::SPACE_STATION_Y;
+	_G(savegame)._shipIndex = 2;
 	_G(cockpitSpeed) = 0;
-	_G(spaceMap).setup();
+	_G(savegame)._starmap.setup();
 
 	// Seed the player's own ship slot from the savegame. setupSpaceMap also
 	// parks two fighters at the station and positions everything - still
 	// TODO - but the fuel/shield are what the HUD and flight need
 	Data::SpaceMapShip &ship =
-		_G(spaceMap)._sectors[_G(sectorX)][_G(sectorY)]._ships[_G(shipIndex)];
+		_G(savegame)._starmap._sectors[_G(savegame)._sectorX][_G(savegame)._sectorY]._ships[_G(savegame)._shipIndex];
 	ship._shipType = Data::SHIP_SHUTTLE;
 	ship._fuel = _G(savegame)._shipFuel;
 	ship._shield = _G(savegame)._shipShield;
@@ -64,11 +64,11 @@ void SpaceLogic::endOfTurn() {
 }
 
 int SpaceLogic::shipFuel() const {
-	return _G(spaceMap)._sectors[_G(sectorX)][_G(sectorY)]._ships[_G(shipIndex)]._fuel;
+	return _G(savegame)._starmap._sectors[_G(savegame)._sectorX][_G(savegame)._sectorY]._ships[_G(savegame)._shipIndex]._fuel;
 }
 
 void SpaceLogic::subtractFuel(int amount) {
-	int16 &fuel = _G(spaceMap)._sectors[_G(sectorX)][_G(sectorY)]._ships[_G(shipIndex)]._fuel;
+	int16 &fuel = _G(savegame)._starmap._sectors[_G(savegame)._sectorX][_G(savegame)._sectorY]._ships[_G(savegame)._shipIndex]._fuel;
 	fuel = (fuel > amount) ? (int16)(fuel - amount) : 0;
 	redrawStats();
 }
diff --git a/engines/ultima/ultima1/ultima1.h b/engines/ultima/ultima1/ultima1.h
index 771729c69a7..752263ef0dc 100644
--- a/engines/ultima/ultima1/ultima1.h
+++ b/engines/ultima/ultima1/ultima1.h
@@ -67,7 +67,6 @@ protected:
 public:
 	Data::Map _map;
 	Data::MapDungeon _dungeon;
-	Data::SpaceMap _spaceMap;
 	Data::SpaceStarfield _starfield;
 	Data::Savegame _savegame;
 	Common::SharedPtr<Logic::Logic> _logic;
@@ -75,13 +74,8 @@ public:
 	int _creaturesCount = 0;
 	uint32 _moveCtr = 0;
 	int _transportFoodCtr = 0;
-	// The player's current galaxy sector while in outer space
-	int _sectorX = Data::SPACE_STATION_X;
-	int _sectorY = Data::SPACE_STATION_Y;
-	// Which of the current sector's ship slots the player is flying, and
-	// the flight speed set while in the cockpit view (the overhead vs
+	// The flight speed set while in the cockpit view (the overhead vs
 	// cockpit distinction is carried by which SpaceLogic subclass is active)
-	int _shipIndex = 2;
 	int _cockpitSpeed = 0;
 
 public:
diff --git a/engines/ultima/ultima1/views/interactions/sector_scan.cpp b/engines/ultima/ultima1/views/interactions/sector_scan.cpp
index 4ee191cc65d..af6962dcfed 100644
--- a/engines/ultima/ultima1/views/interactions/sector_scan.cpp
+++ b/engines/ultima/ultima1/views/interactions/sector_scan.cpp
@@ -79,13 +79,13 @@ void SectorScan::draw() {
 	// Blink the player's current sector by blanking its glyph on the off
 	// beat
 	if (!_blipVisible) {
-		int px = cellX(_G(sectorX)), py = cellY(_G(sectorY));
+		int px = cellX(_G(savegame)._sectorX), py = cellY(_G(savegame)._sectorY);
 		s.fillRect(Rect(px, py, px + 8, py + 9), 0);
 	}
 }
 
 void SectorScan::drawSectorIcon(Shared::Gfx::GfxSurface &s, int sx, int sy) {
-	const Data::SpaceMapCell &cell = _G(spaceMap)._sectors[sx][sy];
+	const Data::SpaceMapCell &cell = _G(savegame)._starmap._sectors[sx][sy];
 	int px = cellX(sx), py = cellY(sy);
 
 	if (cell._enemyCount != 0)
diff --git a/engines/ultima/ultima1/views/space_stats.cpp b/engines/ultima/ultima1/views/space_stats.cpp
index bc0f937ce71..4f9c471838c 100644
--- a/engines/ultima/ultima1/views/space_stats.cpp
+++ b/engines/ultima/ultima1/views/space_stats.cpp
@@ -33,7 +33,7 @@ constexpr int COLOR_HIGHLIGHT = 12;		// light red - low shield/fuel warning
 void SpaceStats::draw() {
 	Data::Savegame &p = _G(savegame);
 	const Data::SpaceMapShip &ship =
-		_G(spaceMap)._sectors[_G(sectorX)][_G(sectorY)]._ships[_G(shipIndex)];
+		_G(savegame)._starmap._sectors[_G(savegame)._sectorX][_G(savegame)._sectorY]._ships[_G(savegame)._shipIndex];
 
 	auto s = getSurface();
 	s.clear();


Commit: 92c5ee54b90bd4a6adb44e252c5217952ee9c8fd
    https://github.com/scummvm/scummvm/commit/92c5ee54b90bd4a6adb44e252c5217952ee9c8fd
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:40:53+11:00

Commit Message:
ULTIMA: ULTIMA1: Space map drawing

Changed paths:
    engines/ultima/ultima1/data/map.cpp
    engines/ultima/ultima1/data/map.h
    engines/ultima/ultima1/data/space_map.cpp
    engines/ultima/ultima1/data/space_map.h
    engines/ultima/ultima1/data/tiles.cpp
    engines/ultima/ultima1/data/tiles.h
    engines/ultima/ultima1/logic/space_logic.cpp
    engines/ultima/ultima1/views/space_map.cpp
    engines/ultima/ultima1/views/space_map.h


diff --git a/engines/ultima/ultima1/data/map.cpp b/engines/ultima/ultima1/data/map.cpp
index 0985ecbc041..7f4b5fe3056 100644
--- a/engines/ultima/ultima1/data/map.cpp
+++ b/engines/ultima/ultima1/data/map.cpp
@@ -158,6 +158,8 @@ void Map::init() {
 	_mondainTiles[0].create(16, 16, Graphics::PixelFormat::createFormatCLUT8());
 	loadTiles("egamond.bin", &_mondainTiles[1], MONDAIN_TILES_COUNT, 16);
 	_mondainTiles[20] = _overworldTiles[TILE_PLAYER];
+
+	loadShipTiles("egaspace.bin", _spaceShipTiles, SPACE_SHIP_TILES_COUNT);
 }
 
 void Map::resetMondainMap() {
diff --git a/engines/ultima/ultima1/data/map.h b/engines/ultima/ultima1/data/map.h
index 6bfb5b3d5a3..07e43272c8b 100644
--- a/engines/ultima/ultima1/data/map.h
+++ b/engines/ultima/ultima1/data/map.h
@@ -116,6 +116,7 @@ private:
 	Graphics::ManagedSurface _overworldTiles[OVERWORLD_TILES_COUNT];
 	Graphics::ManagedSurface _cityTiles[CITY_TILES_COUNT];
 	Graphics::ManagedSurface _mondainTiles[MONDAIN_TILES_COUNT + 2];
+	Graphics::ManagedSurface _spaceShipTiles[SPACE_SHIP_TILES_COUNT];
 
 	/**
 	 * Used to generate the dungeon.
@@ -177,6 +178,13 @@ public:
 		return _tiles;
 	}
 
+	/**
+	 * Get the outer-space ship glyph tiles, indexed by shipType*4+facing
+	 */
+	const Graphics::ManagedSurface *spaceShipTiles() const {
+		return _spaceShipTiles;
+	}
+
 	/**
 	 * Access tiles of the current map
 	 */
diff --git a/engines/ultima/ultima1/data/space_map.cpp b/engines/ultima/ultima1/data/space_map.cpp
index 6e8cad8cab8..4397524c2a3 100644
--- a/engines/ultima/ultima1/data/space_map.cpp
+++ b/engines/ultima/ultima1/data/space_map.cpp
@@ -63,10 +63,27 @@ void SpaceMap::setup() {
 	station._anchorX = 200;
 	station._anchorY = 100;
 
-	// TODO: setupSpaceMap also parks two fighters (ships[0]/[1]) at the
-	// station and places the player's own shuttle (ships[3], fuel/shield
-	// from _savegame._shipFuel/_shipShield). Needed for docking and combat,
-	// not for the sector scan
+	// Two fighters are permanently parked at the station, docked at fixed
+	// offsets from the anchor (setupSpaceMap's own DELTA_X/DELTA_Y-derived
+	// positions for the bottom and left docking edges respectively)
+	SpaceMapShip &smallFighter = station._ships[0];
+	smallFighter._shipType = SHIP_SMALL_FIGHTER;
+	smallFighter._fuel = 2500;
+	smallFighter._shield = 5000;
+	smallFighter._x = (int16)(station._anchorX + 2);
+	smallFighter._y = (int16)(station._anchorY + 17);
+	smallFighter._facing = FACING_UP;
+
+	SpaceMapShip &largeFighter = station._ships[1];
+	largeFighter._shipType = SHIP_LARGE_FIGHTER;
+	largeFighter._fuel = 5000;
+	largeFighter._shield = 1000;
+	largeFighter._x = (int16)(station._anchorX - 15);
+	largeFighter._y = (int16)(station._anchorY + 1);
+	largeFighter._facing = FACING_RIGHT;
+
+	// The player's own shuttle (ships[2]) sits at a fixed dock position of
+	// its own, not derived from the anchor - see SpaceLogic::entering()
 }
 
 void SpaceMapShip::synchronize(Common::Serializer &s) {
diff --git a/engines/ultima/ultima1/data/space_map.h b/engines/ultima/ultima1/data/space_map.h
index ebe9aea239a..eb86fbb9ac1 100644
--- a/engines/ultima/ultima1/data/space_map.h
+++ b/engines/ultima/ultima1/data/space_map.h
@@ -53,6 +53,16 @@ enum SpaceShipType {
 	SHIP_SMALL_FIGHTER = 2		// "Fighter 2" - heavy shields
 };
 
+// A ship icon's facing in the overhead sector view (distinct from the
+// cockpit's Data::Direction) - also the order of drawShipSprite's own
+// per-facing jump table
+enum SpaceShipFacing {
+	FACING_LEFT = 0,
+	FACING_RIGHT = 1,
+	FACING_UP = 2,
+	FACING_DOWN = 3
+};
+
 /**
  * A single ship occupying one of a sector's ship slots
  */
diff --git a/engines/ultima/ultima1/data/tiles.cpp b/engines/ultima/ultima1/data/tiles.cpp
index 56c1a344d0c..f26fcd12b36 100644
--- a/engines/ultima/ultima1/data/tiles.cpp
+++ b/engines/ultima/ultima1/data/tiles.cpp
@@ -66,6 +66,44 @@ void loadTiles(const char *filename, Graphics::ManagedSurface *tiles, int count,
 	delete[] data;
 }
 
+constexpr int SHIP_TILE_WIDTH = 32;
+constexpr int SHIP_TILE_HEIGHT = 19;
+constexpr int SHIP_TILE_ROW_BYTES = SHIP_TILE_WIDTH / 8;
+constexpr int SHIP_TILE_BYTES = SHIP_TILE_ROW_BYTES * SHIP_TILE_HEIGHT;
+constexpr int SHIP_TILE_SHIFT_VARIANTS = 8;
+constexpr int SHIP_TILE_SLOT_BYTES = SHIP_TILE_BYTES * SHIP_TILE_SHIFT_VARIANTS;
+constexpr byte SHIP_TILE_MASK_COLOR = 15;
+
+void loadShipTiles(const char *filename, Graphics::ManagedSurface *tiles, int count) {
+	Common::File f;
+	if (!f.open(filename))
+		error("Could not open %s", filename);
+
+	byte data[SHIP_TILE_BYTES];
+
+	for (int tileNum = 0; tileNum < count; ++tileNum) {
+		f.seek(tileNum * SHIP_TILE_SLOT_BYTES);
+		if (f.read(data, SHIP_TILE_BYTES) != (uint32)SHIP_TILE_BYTES)
+			error("Unexpected end of %s", filename);
+
+		Graphics::ManagedSurface &tile = tiles[tileNum];
+		tile.create(SHIP_TILE_WIDTH, SHIP_TILE_HEIGHT, Graphics::PixelFormat::createFormatCLUT8());
+		tile.clear(0);
+
+		for (int y = 0; y < SHIP_TILE_HEIGHT; ++y) {
+			const byte *row = &data[y * SHIP_TILE_ROW_BYTES];
+			byte *destRow = (byte *)tile.getBasePtr(0, y);
+
+			for (int x = 0; x < SHIP_TILE_WIDTH; ++x) {
+				int byteIdx = x / 8;
+				int bitMask = 0x80 >> (x % 8);
+				if (row[byteIdx] & bitMask)
+					destRow[x] = SHIP_TILE_MASK_COLOR;
+			}
+		}
+	}
+}
+
 } // namespace Data
 } // namespace Ultima1
 } // namespace Ultima
diff --git a/engines/ultima/ultima1/data/tiles.h b/engines/ultima/ultima1/data/tiles.h
index 5e0e67cb465..270e41e69f9 100644
--- a/engines/ultima/ultima1/data/tiles.h
+++ b/engines/ultima/ultima1/data/tiles.h
@@ -32,6 +32,10 @@ constexpr int OVERWORLD_TILES_COUNT = 52;
 constexpr int CITY_TILES_COUNT = 51;
 constexpr int MONDAIN_TILES_COUNT = 19;
 
+// One outer-space ship glyph per shipType*4+facing combination (3 ship
+// types x 4 facings - see Data::SpaceShipType/SpaceShipFacing)
+constexpr int SPACE_SHIP_TILES_COUNT = 12;
+
 enum OverworldTileId {
 	TILE_OCEAN = 0,
 	TILE_GRASS = 1,
@@ -120,6 +124,20 @@ enum MondainTileId {
  */
 extern void loadTiles(const char *filename, Graphics::ManagedSurface *tiles, int count, int size);
 
+/**
+ * Loads the outer-space ship glyph sheet (egaspace.bin) into a
+ * caller-supplied array of SPACE_SHIP_TILES_COUNT surfaces, one 32x19
+ * 1-bit-per-pixel XOR mask glyph per shipType*4+facing combination
+ * (blitShipSpriteXor). Each glyph is followed in the file by 7 more
+ * byte-alignment-shifted copies of itself (for the original's hardware
+ * byte-aligned blitter) - only the first, unshifted copy is loaded, since a
+ * software blit isn't limited to byte-aligned X positions
+ * @param filename		Filename to load
+ * @param tiles			Tiles array to load into
+ * @param count			Number of glyphs
+ */
+extern void loadShipTiles(const char *filename, Graphics::ManagedSurface *tiles, int count);
+
 } // namespace Data
 } // namespace Ultima1
 } // namespace Ultima
diff --git a/engines/ultima/ultima1/logic/space_logic.cpp b/engines/ultima/ultima1/logic/space_logic.cpp
index 118e848a52e..3522955962b 100644
--- a/engines/ultima/ultima1/logic/space_logic.cpp
+++ b/engines/ultima/ultima1/logic/space_logic.cpp
@@ -52,6 +52,11 @@ void SpaceLogic::entering() {
 	ship._shipType = Data::SHIP_SHUTTLE;
 	ship._fuel = _G(savegame)._shipFuel;
 	ship._shield = _G(savegame)._shipShield;
+	// setupSpaceMap docks the player's shuttle at a fixed point of its own,
+	// not relative to the station anchor like the two parked fighters
+	ship._x = 260;
+	ship._y = 90;
+	ship._facing = Data::FACING_LEFT;
 
 	redrawStats();
 }
diff --git a/engines/ultima/ultima1/views/space_map.cpp b/engines/ultima/ultima1/views/space_map.cpp
index dd156e73661..46189c1c1ad 100644
--- a/engines/ultima/ultima1/views/space_map.cpp
+++ b/engines/ultima/ultima1/views/space_map.cpp
@@ -27,6 +27,89 @@ namespace Ultima {
 namespace Ultima1 {
 namespace Views {
 
+// EGA-mode colors for the sector view's baked-in raw bitmaps and the ship
+// outlines - the disassembly's own hardcoded non-CGA fallback values for
+// drawStarGraphic/drawStationGraphic, and (for the ships) the closest
+// equivalents already established elsewhere in this port's space UI
+constexpr int STAR_COLOR_1 = 12;
+constexpr int STAR_COLOR_2 = 14;
+constexpr int ANCHOR_COLOR = 15;
+constexpr int STATION_COLOR_HILIGHT = 1;
+constexpr int STATION_COLOR_BORDER = 10;
+constexpr int STATION_COLOR_EDGE = 7;
+
+// Star/heat hazard bitmap (18 rows x 19 cols), matching SPACE.EXE's own raw
+// table for drawStarGraphic. 1 -> STAR_COLOR_1, 2 -> STAR_COLOR_2
+static const int8 STAR_BITMAP[18][19] = {
+	{ 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0 },
+	{ 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0 },
+	{ 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0 },
+	{ 0, 0, 1, 1, 0, 0, 0, 1, 1, 0, 1, 1, 0, 0, 0, 1, 1, 0, 0 },
+	{ 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0 },
+	{ 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0 },
+	{ 1, 1, 0, 0, 0, 0, 0, 0, 2, 2, 2, 0, 0, 0, 0, 0, 0, 1, 1 },
+	{ 0, 0, 1, 1, 0, 0, 2, 2, 2, 2, 2, 2, 2, 0, 0, 1, 1, 0, 0 },
+	{ 0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0 },
+	{ 0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0 },
+	{ 0, 0, 1, 1, 0, 0, 2, 2, 2, 2, 2, 2, 2, 0, 0, 1, 1, 0, 0 },
+	{ 1, 1, 0, 0, 0, 0, 0, 0, 2, 2, 2, 0, 0, 0, 0, 0, 0, 1, 1 },
+	{ 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0 },
+	{ 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0 },
+	{ 0, 0, 1, 1, 0, 0, 0, 1, 1, 0, 1, 1, 0, 0, 0, 1, 1, 0, 0 },
+	{ 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0 },
+	{ 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0 },
+	{ 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0 },
+};
+
+// Docking/encounter anchor bitmap (20 rows x 20 cols), matching SPACE.EXE's
+// own raw table for drawPlanetGraphic. Any nonzero value -> ANCHOR_COLOR
+static const int8 PLANET_BITMAP[20][20] = {
+	{ 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0 },
+	{ 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0 },
+	{ 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0 },
+	{ 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0 },
+	{ 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0 },
+	{ 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0 },
+	{ 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0 },
+	{ 1, 1, 1, 0, 1, 1, 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 0, 1, 1, 1 },
+	{ 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1 },
+	{ 0, 0, 1, 1, 0, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 1, 1, 0, 0 },
+	{ 0, 0, 1, 1, 0, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 1, 1, 0, 0 },
+	{ 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1 },
+	{ 1, 1, 1, 0, 1, 1, 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 0, 1, 1, 1 },
+	{ 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0 },
+	{ 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0 },
+	{ 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0 },
+	{ 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0 },
+	{ 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0 },
+	{ 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0 },
+	{ 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0 },
+};
+
+// Space station bitmap (18 rows x 21 cols), matching SPACE.EXE's own raw
+// table for drawStationGraphic. 1/2 -> STATION_COLOR_HILIGHT,
+// 4 -> STATION_COLOR_EDGE, 3 -> STATION_COLOR_BORDER
+static const int8 STATION_BITMAP[18][21] = {
+	{ 0, 0, 0, 0, 0, 0, 0, 0, 4, 4, 4, 4, 4, 0, 0, 0, 0, 0, 0, 0, 0 },
+	{ 0, 0, 0, 0, 0, 0, 4, 1, 1, 1, 1, 1, 1, 1, 4, 0, 0, 0, 0, 0, 0 },
+	{ 0, 0, 0, 0, 4, 1, 1, 1, 2, 3, 2, 3, 2, 3, 1, 1, 4, 0, 0, 0, 0 },
+	{ 0, 0, 0, 4, 1, 1, 2, 3, 2, 2, 2, 3, 2, 3, 2, 1, 1, 4, 0, 0, 0 },
+	{ 0, 0, 4, 1, 1, 3, 2, 2, 2, 2, 2, 3, 2, 3, 2, 2, 1, 1, 4, 0, 0 },
+	{ 0, 4, 1, 1, 3, 3, 2, 2, 2, 2, 2, 3, 2, 2, 2, 3, 2, 1, 1, 4, 0 },
+	{ 0, 4, 1, 1, 3, 3, 3, 2, 2, 3, 3, 3, 2, 3, 3, 3, 3, 1, 1, 4, 0 },
+	{ 4, 1, 1, 2, 3, 2, 2, 2, 2, 3, 3, 3, 3, 2, 3, 3, 3, 2, 1, 1, 4 },
+	{ 4, 1, 1, 1, 3, 2, 2, 3, 2, 2, 3, 3, 3, 3, 3, 3, 2, 2, 1, 1, 4 },
+	{ 4, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 2, 3, 2, 2, 1, 1, 4 },
+	{ 4, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 2, 2, 2, 2, 1, 1, 4 },
+	{ 0, 4, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 3, 2, 2, 2, 2, 1, 1, 4, 0 },
+	{ 0, 4, 1, 1, 2, 2, 2, 2, 2, 3, 3, 3, 2, 2, 2, 2, 2, 1, 1, 4, 0 },
+	{ 0, 0, 4, 1, 1, 2, 2, 3, 2, 3, 3, 3, 3, 2, 2, 2, 1, 1, 4, 0, 0 },
+	{ 0, 0, 0, 4, 1, 1, 2, 3, 2, 3, 2, 3, 2, 2, 2, 1, 1, 4, 0, 0, 0 },
+	{ 0, 0, 0, 0, 4, 1, 1, 1, 2, 3, 2, 3, 2, 1, 1, 1, 4, 0, 0, 0, 0 },
+	{ 0, 0, 0, 0, 0, 0, 4, 1, 1, 1, 1, 1, 1, 1, 4, 0, 0, 0, 0, 0, 0 },
+	{ 0, 0, 0, 0, 0, 0, 0, 0, 4, 4, 4, 4, 4, 0, 0, 0, 0, 0, 0, 0, 0 },
+};
+
 bool SpaceMap::msgFocus(const FocusMessage &msg) {
 	MetaEngine::setKeybindingMode(KBMODE_SPACE);
 	return Map::msgFocus(msg);
@@ -40,7 +123,79 @@ bool SpaceMap::msgUnfocus(const UnfocusMessage &msg) {
 void SpaceMap::draw() {
 	Map::draw();
 
-	// TODO
+	auto s = getSurface();
+	const Data::SpaceMapCell &cell =
+		_G(savegame)._starmap._sectors[_G(savegame)._sectorX][_G(savegame)._sectorY];
+
+	// The station graphic only ever appears in its own fixed sector, at the
+	// docking-bay entrance point
+	if (_G(savegame)._sectorX == Data::SPACE_STATION_X && _G(savegame)._sectorY == Data::SPACE_STATION_Y)
+		drawStationGraphic(s, 60, 75);
+
+	if (cell._hazardX != 0)
+		drawStarGraphic(s, cell._hazardX, cell._hazardY);
+
+	if (cell._anchorX != 0)
+		drawPlanetGraphic(s, cell._anchorX, cell._anchorY);
+
+	for (int i = 0; i < Data::SPACE_SHIPS_PER_SECTOR; ++i) {
+		const Data::SpaceMapShip &ship = cell._ships[i];
+		if (ship._shipType != Data::SHIP_NONE)
+			drawShipOutline(s, ship);
+	}
+}
+
+void SpaceMap::drawStarGraphic(Shared::Gfx::GfxSurface &s, int x, int y) {
+	for (int row = 0; row < 18; ++row) {
+		for (int col = 0; col < 19; ++col) {
+			switch (STAR_BITMAP[row][col]) {
+			case 1:
+				s.setPixel(x + col, y + row, STAR_COLOR_1);
+				break;
+			case 2:
+				s.setPixel(x + col, y + row, STAR_COLOR_2);
+				break;
+			default:
+				break;
+			}
+		}
+	}
+}
+
+void SpaceMap::drawPlanetGraphic(Shared::Gfx::GfxSurface &s, int x, int y) {
+	for (int row = 0; row < 20; ++row) {
+		for (int col = 0; col < 20; ++col) {
+			if (PLANET_BITMAP[row][col] != 0)
+				s.setPixel(x + col, y + row, ANCHOR_COLOR);
+		}
+	}
+}
+
+void SpaceMap::drawStationGraphic(Shared::Gfx::GfxSurface &s, int x, int y) {
+	for (int row = 0; row < 18; ++row) {
+		for (int col = 0; col < 21; ++col) {
+			switch (STATION_BITMAP[row][col]) {
+			case 1:
+			case 2:
+				s.setPixel(x + col, y + row, STATION_COLOR_HILIGHT);
+				break;
+			case 4:
+				s.setPixel(x + col, y + row, STATION_COLOR_EDGE);
+				break;
+			case 3:
+				s.setPixel(x + col, y + row, STATION_COLOR_BORDER);
+				break;
+			default:
+				break;
+			}
+		}
+	}
+}
+
+void SpaceMap::drawShipOutline(Shared::Gfx::GfxSurface &s, const Data::SpaceMapShip &ship) {
+	int tileIndex = ship._shipType * 4 + ship._facing;
+	const Graphics::ManagedSurface &tile = _G(map).spaceShipTiles()[tileIndex];
+	s.xorBlitFrom(tile, Common::Point(ship._x, ship._y));
 }
 
 } // namespace Views
diff --git a/engines/ultima/ultima1/views/space_map.h b/engines/ultima/ultima1/views/space_map.h
index 56e59bc54ca..899c46eeca7 100644
--- a/engines/ultima/ultima1/views/space_map.h
+++ b/engines/ultima/ultima1/views/space_map.h
@@ -24,6 +24,8 @@
 
 #include "ultima/ultima1/views/map.h"
 #include "ultima/ultima1/data/map.h"
+#include "ultima/ultima1/data/space_map.h"
+#include "ultima/shared/gfx/gfx_surface.h"
 
 namespace Ultima {
 namespace Ultima1 {
@@ -31,7 +33,36 @@ namespace Views {
 
 using namespace Shared::Messages;
 
+/**
+ * The overhead view of the player's current galaxy sector - the station
+ * and/or star hazard and/or docking anchor (if any are present), and every
+ * active ship, matching the original SPACE.EXE's setupView (overhead branch)
+ */
 class SpaceMap : public Map {
+private:
+	/**
+	 * Draws the station's raw bitmap (drawStationGraphic), only shown in
+	 * sector (3,3)
+	 */
+	void drawStationGraphic(Shared::Gfx::GfxSurface &s, int x, int y);
+
+	/**
+	 * Draws a sector's star/heat hazard raw bitmap (drawStarGraphic)
+	 */
+	void drawStarGraphic(Shared::Gfx::GfxSurface &s, int x, int y);
+
+	/**
+	 * Draws a sector's docking/encounter anchor raw bitmap (drawPlanetGraphic)
+	 */
+	void drawPlanetGraphic(Shared::Gfx::GfxSurface &s, int x, int y);
+
+	/**
+	 * XOR-blits a ship's glyph (egaspace.bin, via Data::Map::spaceShipTiles,
+	 * indexed by shipType*4+facing) at its current position
+	 * (blitShipSpriteXor)
+	 */
+	void drawShipOutline(Shared::Gfx::GfxSurface &s, const Data::SpaceMapShip &ship);
+
 public:
 	SpaceMap() : Map("SpaceMap") {}
 	~SpaceMap() override {}


Commit: d10c6135ee60b5542df7b93374de7eb4a5680e8c
    https://github.com/scummvm/scummvm/commit/d10c6135ee60b5542df7b93374de7eb4a5680e8c
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:40:53+11:00

Commit Message:
ULTIMA: ULTIMA1: Space map ship movement

Changed paths:
    engines/ultima/ultima1/logic/space_logic.cpp
    engines/ultima/ultima1/logic/space_logic.h
    engines/ultima/ultima1/logic/space_map_logic.cpp
    engines/ultima/ultima1/logic/space_map_logic.h
    engines/ultima/ultima1/ultima1.h
    engines/ultima/ultima1/views/space_map.cpp
    engines/ultima/ultima1/views/space_map.h


diff --git a/engines/ultima/ultima1/logic/space_logic.cpp b/engines/ultima/ultima1/logic/space_logic.cpp
index 3522955962b..87a421aac0d 100644
--- a/engines/ultima/ultima1/logic/space_logic.cpp
+++ b/engines/ultima/ultima1/logic/space_logic.cpp
@@ -78,6 +78,16 @@ void SpaceLogic::subtractFuel(int amount) {
 	redrawStats();
 }
 
+int SpaceLogic::shipShields() const {
+	return _G(savegame)._starmap._sectors[_G(savegame)._sectorX][_G(savegame)._sectorY]._ships[_G(savegame)._shipIndex]._shield;
+}
+
+void SpaceLogic::subtractShields(int amount) {
+	int16 &shield = _G(savegame)._starmap._sectors[_G(savegame)._sectorX][_G(savegame)._sectorY]._ships[_G(savegame)._shipIndex]._shield;
+	shield = (shield > amount) ? (int16)(shield - amount) : 0;
+	redrawStats();
+}
+
 void SpaceLogic::keypress(Common::KeyCode keycode) {
 	writeString("Huh?\n");
 	playFX(1);
diff --git a/engines/ultima/ultima1/logic/space_logic.h b/engines/ultima/ultima1/logic/space_logic.h
index aae9623f755..ddc5fa820b6 100644
--- a/engines/ultima/ultima1/logic/space_logic.h
+++ b/engines/ultima/ultima1/logic/space_logic.h
@@ -51,6 +51,18 @@ protected:
 	 */
 	void subtractFuel(int amount);
 
+	/**
+	 * Shields remaining in the ship the player is currently flying
+	 * (getShipShields)
+	 */
+	int shipShields() const;
+
+	/**
+	 * Drains shields from the current ship, clamped at zero
+	 * (subtractShields)
+	 */
+	void subtractShields(int amount);
+
 	void updateCreatures() override {
 	}
 
diff --git a/engines/ultima/ultima1/logic/space_map_logic.cpp b/engines/ultima/ultima1/logic/space_map_logic.cpp
index 1d6f0f45f94..5552a255191 100644
--- a/engines/ultima/ultima1/logic/space_map_logic.cpp
+++ b/engines/ultima/ultima1/logic/space_map_logic.cpp
@@ -19,6 +19,7 @@
  *
  */
 
+#include "common/util.h"
 #include "ultima/ultima1/logic/space_map_logic.h"
 #include "ultima/ultima1/logic/space_cockpit_logic.h"
 #include "ultima/ultima1/data/map.h"
@@ -28,16 +29,118 @@ namespace Ultima {
 namespace Ultima1 {
 namespace Logic {
 
+// The overhead sector view's playable area (clampShipX/Y) - drifting past
+// this is what triggers the viewport-border "Crunch!" bounce
+constexpr int SECTOR_MIN_X = 20, SECTOR_MAX_X = 275;
+constexpr int SECTOR_MIN_Y = 10, SECTOR_MAX_Y = 130;
+constexpr int MAX_DRIFT = 9;
+
 bool SpaceMapLogic::move(Data::Direction dir) {
 	writeString("%s\n", Data::DIRECTION_NAMES[dir]);
 
-	// TODO: handleOverheadArrows - nudges the drift heading (sectorChangeX/Y)
-	// by 1, spends 5 fuel (2 for Left/Right), "No fuel!" when empty, and
-	// "Crunch!" + shield drain on a collision. The drift itself and the
-	// sector crossing run in the overhead view's per-frame update
+	int fuelCost = (dir == Data::DIR_LEFT || dir == Data::DIR_RIGHT) ? 2 : 5;
+
+	if (shipFuel() == 0) {
+		writeString("No fuel!!\n");
+		writeString("Wilt thou drift forever?!?\n");
+		return true;
+	}
+	if (shipFuel() < fuelCost)
+		fuelCost = shipFuel();
+
+	// A ship sitting right on top of another counts as docked - thrusting
+	// into it (anything but Down, which just brakes) is a crunch rather
+	// than a move
+	Data::SpaceMapCell &cell = _G(savegame)._starmap._sectors[_G(savegame)._sectorX][_G(savegame)._sectorY];
+	const Data::SpaceMapShip &ship = cell._ships[_G(savegame)._shipIndex];
+	bool docked = false;
+	for (int i = 0; i < Data::SPACE_SHIPS_PER_SECTOR && !docked; ++i) {
+		if (i == _G(savegame)._shipIndex)
+			continue;
+		const Data::SpaceMapShip &other = cell._ships[i];
+		docked = other._shipType != Data::SHIP_NONE && other._x == ship._x && other._y == ship._y;
+	}
+
+	if (docked && dir != Data::DIR_DOWN) {
+		writeString("Crunch!\n");
+		playFX(0);
+		subtractShields(shipShields() / 4 + 5);
+		// TODO: death in space - see SpaceLogic::endOfTurn
+		if (shipShields() == 0)
+			writeString("Thy shield is drained!\n");
+		return true;
+	}
+
+	subtractFuel(fuelCost);
+
+	if (dir == Data::DIR_DOWN) {
+		// Brake - stop drifting and clear the exhaust trail
+		_G(sectorDriftX) = 0;
+		_G(sectorDriftY) = 0;
+		_G(shipExhaustCountdown) = 0;
+		redrawMap();
+		return true;
+	}
+
+	if (dir == Data::DIR_LEFT || dir == Data::DIR_RIGHT) {
+		// A lateral nudge doesn't sustain the exhaust trail the way
+		// thrusting forward (Up) does
+		_G(shipExhaustCountdown) = 0;
+	}
+
+	switch (dir) {
+	case Data::DIR_LEFT:
+		_G(sectorDriftX) = CLIP(_G(sectorDriftX) - 1, -MAX_DRIFT, MAX_DRIFT);
+		break;
+	case Data::DIR_RIGHT:
+		_G(sectorDriftX) = CLIP(_G(sectorDriftX) + 1, -MAX_DRIFT, MAX_DRIFT);
+		break;
+	case Data::DIR_UP:
+		_G(sectorDriftY) = CLIP(_G(sectorDriftY) - 1, -MAX_DRIFT, MAX_DRIFT);
+		_G(shipExhaustCountdown) += 10;
+		break;
+	default:
+		break;
+	}
+
+	redrawMap();
 	return true;
 }
 
+void SpaceMapLogic::tick() {
+	if (_G(sectorDriftX) == 0 && _G(sectorDriftY) == 0 && _G(shipExhaustCountdown) == 0)
+		return;
+
+	if (_G(sectorDriftX) != 0 || _G(sectorDriftY) != 0) {
+		Data::SpaceMapShip &ship =
+			_G(savegame)._starmap._sectors[_G(savegame)._sectorX][_G(savegame)._sectorY]._ships[_G(savegame)._shipIndex];
+
+		int newX = ship._x + _G(sectorDriftX);
+		int newY = ship._y + _G(sectorDriftY);
+
+		if (newX < SECTOR_MIN_X || newX > SECTOR_MAX_X || newY < SECTOR_MIN_Y || newY > SECTOR_MAX_Y) {
+			writeString("Crunch!\n");
+			playFX(0);
+			subtractShields(shipShields() / 4 + 5);
+			// TODO: death in space - see SpaceLogic::endOfTurn
+			if (shipShields() == 0)
+				writeString("Thy shield is drained!\n");
+
+			// Bounce back off the border
+			_G(sectorDriftX) = -_G(sectorDriftX);
+			_G(sectorDriftY) = -_G(sectorDriftY);
+		} else {
+			ship._x = (int16)newX;
+			ship._y = (int16)newY;
+		}
+	}
+
+	if (_G(shipExhaustCountdown) > 0)
+		--_G(shipExhaustCountdown);
+
+	redrawMap();
+}
+
 bool SpaceMapLogic::fire() {
 	// Nothing to shoot at from the overhead view
 	writeString("Fire?\n");
diff --git a/engines/ultima/ultima1/logic/space_map_logic.h b/engines/ultima/ultima1/logic/space_map_logic.h
index b0f2e031228..d830f3337b6 100644
--- a/engines/ultima/ultima1/logic/space_map_logic.h
+++ b/engines/ultima/ultima1/logic/space_map_logic.h
@@ -29,10 +29,14 @@ namespace Ultima1 {
 namespace Logic {
 
 /**
- * The overhead sector-map view of outer space: the ship drifts around the
- * current sector, the arrows nudge its heading (West/East/North/South), and
- * reaching an edge crosses into the neighbouring sector. This is the mode
- * take-off loads into
+ * The overhead sector-map view of outer space: the arrows nudge the ship's
+ * drift heading (West/East/North/South - handleOverheadArrows), and the
+ * drift itself is applied each frame (per_frame_logic), clamped to the
+ * sector's playable area. Flying into the viewport border bounces the ship
+ * back and drains shields ("Crunch!" - handleSectorBoundaryCollision);
+ * actually crossing into a neighbouring sector is a cockpit-only feature
+ * (hyperjump), not available from this view. This is the mode take-off
+ * loads into
  */
 class SpaceMapLogic : public SpaceLogic {
 protected:
@@ -44,6 +48,13 @@ public:
 	SpaceMapLogic() : SpaceLogic() {}
 	~SpaceMapLogic() override {
 	}
+
+	/**
+	 * Applies the current drift to the player's ship position, handling the
+	 * viewport-border bounce/shield-drain and advancing the exhaust trail
+	 * countdown (per_frame_logic, overhead branch)
+	 */
+	void tick() override;
 };
 
 } // namespace Logic
diff --git a/engines/ultima/ultima1/ultima1.h b/engines/ultima/ultima1/ultima1.h
index 752263ef0dc..42c70375933 100644
--- a/engines/ultima/ultima1/ultima1.h
+++ b/engines/ultima/ultima1/ultima1.h
@@ -77,6 +77,12 @@ public:
 	// The flight speed set while in the cockpit view (the overhead vs
 	// cockpit distinction is carried by which SpaceLogic subclass is active)
 	int _cockpitSpeed = 0;
+	// The overhead sector view's current drift velocity (sectorChangeX/Y),
+	// applied to the player's ship position each frame, and the number of
+	// frames left to keep showing its engine exhaust trail (_countdown)
+	int _sectorDriftX = 0;
+	int _sectorDriftY = 0;
+	int _shipExhaustCountdown = 0;
 
 public:
 	Ultima1Engine(OSystem *syst, const Ultima::UltimaGameDescription *gameDesc);
diff --git a/engines/ultima/ultima1/views/space_map.cpp b/engines/ultima/ultima1/views/space_map.cpp
index 46189c1c1ad..8a8197e2cfb 100644
--- a/engines/ultima/ultima1/views/space_map.cpp
+++ b/engines/ultima/ultima1/views/space_map.cpp
@@ -37,6 +37,13 @@ constexpr int ANCHOR_COLOR = 15;
 constexpr int STATION_COLOR_HILIGHT = 1;
 constexpr int STATION_COLOR_BORDER = 10;
 constexpr int STATION_COLOR_EDGE = 7;
+constexpr int EXHAUST_COLOR_MAIN = 12;
+constexpr int EXHAUST_COLOR_HILIGHT = 14;
+
+// Bounds plotShipPixelBounded clips the exhaust trail's individual pixels to
+static bool withinShipView(int x, int y) {
+	return x > 20 && x < 300 && y > 18 && y < 141;
+}
 
 // Star/heat hazard bitmap (18 rows x 19 cols), matching SPACE.EXE's own raw
 // table for drawStarGraphic. 1 -> STAR_COLOR_1, 2 -> STAR_COLOR_2
@@ -143,6 +150,10 @@ void SpaceMap::draw() {
 		if (ship._shipType != Data::SHIP_NONE)
 			drawShipOutline(s, ship);
 	}
+
+	// Only the player's own ship thrusts, so only it ever trails exhaust
+	if (_G(shipExhaustCountdown) > 0)
+		drawShipExhaust(s, cell._ships[_G(savegame)._shipIndex]);
 }
 
 void SpaceMap::drawStarGraphic(Shared::Gfx::GfxSurface &s, int x, int y) {
@@ -198,6 +209,195 @@ void SpaceMap::drawShipOutline(Shared::Gfx::GfxSurface &s, const Data::SpaceMapS
 	s.xorBlitFrom(tile, Common::Point(ship._x, ship._y));
 }
 
+void SpaceMap::drawShipExhaust(Shared::Gfx::GfxSurface &s, const Data::SpaceMapShip &ship) {
+	switch (ship._shipType) {
+	case Data::SHIP_LARGE_FIGHTER:
+		drawLargeFighterExhaust(s, ship._x, ship._y, ship._facing);
+		break;
+	case Data::SHIP_SMALL_FIGHTER:
+		drawSmallFighterExhaust(s, ship._x, ship._y, ship._facing);
+		break;
+	case Data::SHIP_SHUTTLE:
+	default:
+		drawShuttleExhaust(s, ship._x, ship._y, ship._facing);
+		break;
+	}
+}
+
+void SpaceMap::drawShuttleExhaust(Shared::Gfx::GfxSurface &s, int x, int y, int facing) {
+	auto plot = [&s](int px, int py, int color) {
+		if (withinShipView(px, py))
+			s.setPixel(px, py, color);
+	};
+
+	switch (facing) {
+	case Data::FACING_LEFT:
+		for (int i = 0; i < 3; ++i) {
+			plot(x + 19, y + 4 + i, EXHAUST_COLOR_MAIN);
+			plot(x + 19, y + 11 + i, EXHAUST_COLOR_MAIN);
+		}
+		plot(x + 20, y + 5, EXHAUST_COLOR_HILIGHT);
+		plot(x + 20, y + 6, EXHAUST_COLOR_HILIGHT);
+		plot(x + 20, y + 11, EXHAUST_COLOR_HILIGHT);
+		plot(x + 20, y + 12, EXHAUST_COLOR_HILIGHT);
+		plot(x + 21, y + 6, EXHAUST_COLOR_MAIN);
+		plot(x + 21, y + 11, EXHAUST_COLOR_MAIN);
+		break;
+
+	case Data::FACING_RIGHT:
+		for (int i = 0; i < 3; ++i) {
+			plot(x - 1, y + 4 + i, EXHAUST_COLOR_MAIN);
+			plot(x - 1, y + 11 + i, EXHAUST_COLOR_MAIN);
+		}
+		plot(x - 2, y + 5, EXHAUST_COLOR_HILIGHT);
+		plot(x - 2, y + 6, EXHAUST_COLOR_HILIGHT);
+		plot(x - 2, y + 11, EXHAUST_COLOR_HILIGHT);
+		plot(x - 2, y + 12, EXHAUST_COLOR_HILIGHT);
+		plot(x - 3, y + 6, EXHAUST_COLOR_MAIN);
+		plot(x - 3, y + 11, EXHAUST_COLOR_MAIN);
+		break;
+
+	case Data::FACING_UP:
+		for (int i = 0; i < 3; ++i) {
+			plot(x + 5 + i, y + 19, EXHAUST_COLOR_MAIN);
+			plot(x + 12 + i, y + 19, EXHAUST_COLOR_MAIN);
+		}
+		plot(x + 6, y + 20, EXHAUST_COLOR_HILIGHT);
+		plot(x + 7, y + 20, EXHAUST_COLOR_HILIGHT);
+		plot(x + 12, y + 20, EXHAUST_COLOR_HILIGHT);
+		plot(x + 13, y + 20, EXHAUST_COLOR_HILIGHT);
+		plot(x + 7, y + 21, EXHAUST_COLOR_MAIN);
+		plot(x + 12, y + 21, EXHAUST_COLOR_MAIN);
+		break;
+
+	case Data::FACING_DOWN:
+	default:
+		for (int i = 0; i < 3; ++i) {
+			plot(x + 5 + i, y - 1, EXHAUST_COLOR_MAIN);
+			plot(x + 12 + i, y - 1, EXHAUST_COLOR_MAIN);
+		}
+		plot(x + 6, y - 2, EXHAUST_COLOR_HILIGHT);
+		plot(x + 7, y - 2, EXHAUST_COLOR_HILIGHT);
+		plot(x + 12, y - 2, EXHAUST_COLOR_HILIGHT);
+		plot(x + 13, y - 2, EXHAUST_COLOR_HILIGHT);
+		plot(x + 7, y - 3, EXHAUST_COLOR_MAIN);
+		plot(x + 12, y - 3, EXHAUST_COLOR_MAIN);
+		break;
+	}
+}
+
+void SpaceMap::drawSmallFighterExhaust(Shared::Gfx::GfxSurface &s, int x, int y, int facing) {
+	auto plot = [&s](int px, int py) {
+		if (withinShipView(px, py))
+			s.setPixel(px, py, EXHAUST_COLOR_MAIN);
+	};
+
+	switch (facing) {
+	case Data::FACING_LEFT:
+		for (int i = 0; i < 2; ++i) {
+			plot(x + 17 + i, y + 1);
+			plot(x + 17 + i, y + 2);
+			plot(x + 17 + i, y + 15);
+			plot(x + 17 + i, y + 16);
+		}
+		for (int i = 0; i < 4; ++i)
+			plot(x + 17, y + 7 + i);
+		plot(x + 18, y + 6);
+		plot(x + 18, y + 11);
+		break;
+
+	case Data::FACING_RIGHT:
+		for (int i = 0; i < 2; ++i) {
+			plot(x - 1 - i, y + 1);
+			plot(x - 1 - i, y + 2);
+			plot(x - 1 - i, y + 15);
+			plot(x - 1 - i, y + 16);
+		}
+		for (int i = 0; i < 4; ++i)
+			plot(x - 1, y + 7 + i);
+		plot(x - 2, y + 6);
+		plot(x - 2, y + 11);
+		break;
+
+	case Data::FACING_UP:
+		for (int i = 0; i < 2; ++i) {
+			plot(x + i, y + 18);
+			plot(x + i, y + 19);
+			plot(x + 14 + i, y + 18);
+			plot(x + 14 + i, y + 19);
+		}
+		for (int i = 0; i < 4; ++i)
+			plot(x + 6 + i, y + 18);
+		plot(x + 5, y + 19);
+		plot(x + 10, y + 19);
+		break;
+
+	case Data::FACING_DOWN:
+	default:
+		for (int i = 0; i < 2; ++i) {
+			plot(x + i, y);
+			plot(x + i, y - 1);
+			plot(x + 14 + i, y);
+			plot(x + 14 + i, y - 1);
+		}
+		for (int i = 0; i < 4; ++i)
+			plot(x + 6 + i, y);
+		plot(x + 5, y - 1);
+		plot(x + 10, y - 1);
+		break;
+	}
+}
+
+void SpaceMap::drawLargeFighterExhaust(Shared::Gfx::GfxSurface &s, int x, int y, int facing) {
+	auto plot = [&s](int px, int py) {
+		if (withinShipView(px, py))
+			s.setPixel(px, py, EXHAUST_COLOR_MAIN);
+	};
+
+	switch (facing) {
+	case Data::FACING_LEFT:
+		for (int i = 0; i < 2; ++i) {
+			plot(x + 17, y + 7 + i);
+			plot(x + 17, y + 9 + i);
+			plot(x + 18, y + 8 + i);
+		}
+		for (int i = 0; i < 6; ++i)
+			plot(x + 19, y + 6 + i);
+		break;
+
+	case Data::FACING_RIGHT:
+		for (int i = 0; i < 2; ++i) {
+			plot(x - 1, y + 7 + i);
+			plot(x - 1, y + 9 + i);
+			plot(x - 2, y + 8 + i);
+		}
+		for (int i = 0; i < 6; ++i)
+			plot(x - 3, y + 6 + i);
+		break;
+
+	case Data::FACING_UP:
+		for (int i = 0; i < 2; ++i) {
+			plot(x + 7 + i, y + 18);
+			plot(x + 9 + i, y + 18);
+			plot(x + 8 + i, y + 19);
+		}
+		for (int i = 0; i < 6; ++i)
+			plot(x + 6 + i, y + 20);
+		break;
+
+	case Data::FACING_DOWN:
+	default:
+		for (int i = 0; i < 2; ++i) {
+			plot(x + 7 + i, y);
+			plot(x + 9 + i, y);
+			plot(x + 8 + i, y - 1);
+		}
+		for (int i = 0; i < 6; ++i)
+			plot(x + 6 + i, y - 2);
+		break;
+	}
+}
+
 } // namespace Views
 } // namespace Ultima1
 } // namespace Ultima
diff --git a/engines/ultima/ultima1/views/space_map.h b/engines/ultima/ultima1/views/space_map.h
index 899c46eeca7..0e900633540 100644
--- a/engines/ultima/ultima1/views/space_map.h
+++ b/engines/ultima/ultima1/views/space_map.h
@@ -63,6 +63,16 @@ private:
 	 */
 	void drawShipOutline(Shared::Gfx::GfxSurface &s, const Data::SpaceMapShip &ship);
 
+	/**
+	 * Draws the player ship's engine exhaust trail while
+	 * _G(shipExhaustCountdown) is active, dispatching by ship type
+	 * (drawShipSprite, vector-plotted rather than a sprite tile)
+	 */
+	void drawShipExhaust(Shared::Gfx::GfxSurface &s, const Data::SpaceMapShip &ship);
+	void drawShuttleExhaust(Shared::Gfx::GfxSurface &s, int x, int y, int facing);
+	void drawLargeFighterExhaust(Shared::Gfx::GfxSurface &s, int x, int y, int facing);
+	void drawSmallFighterExhaust(Shared::Gfx::GfxSurface &s, int x, int y, int facing);
+
 public:
 	SpaceMap() : Map("SpaceMap") {}
 	~SpaceMap() override {}


Commit: 4ec0d7d607946a7b280fd01b5642d9b2b3aed6c6
    https://github.com/scummvm/scummvm/commit/4ec0d7d607946a7b280fd01b5642d9b2b3aed6c6
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:40:53+11:00

Commit Message:
ULTIMA: ULTIMA1: Fix space map ship wrapping around edges of screen

Changed paths:
    engines/ultima/shared/gfx/gfx_surface.cpp
    engines/ultima/shared/gfx/gfx_surface.h
    engines/ultima/ultima1/data/space_map.h
    engines/ultima/ultima1/data/tiles.cpp
    engines/ultima/ultima1/data/tiles.h
    engines/ultima/ultima1/logic/space_map_logic.cpp
    engines/ultima/ultima1/views/space_map.cpp


diff --git a/engines/ultima/shared/gfx/gfx_surface.cpp b/engines/ultima/shared/gfx/gfx_surface.cpp
index 8f2fd56bf32..419a3be104e 100644
--- a/engines/ultima/shared/gfx/gfx_surface.cpp
+++ b/engines/ultima/shared/gfx/gfx_surface.cpp
@@ -175,14 +175,21 @@ void GfxSurface::reverseColor() {
 }
 
 void GfxSurface::xorBlitFrom(const ManagedSurface &src, const Common::Point &destPos) {
+	xorBlitFrom(src, Common::Rect(0, 0, src.w, src.h), destPos);
+}
+
+void GfxSurface::xorBlitFrom(const ManagedSurface &src, const Common::Rect &srcRect, const Common::Point &destPos) {
+	// Callers are responsible for keeping destPos/srcRect fully within this
+	// surface - getSubArea doesn't clip, so an out-of-bounds rect here would
+	// silently corrupt unrelated pixels rather than getting cropped
 	Graphics::Surface area = getSubArea(Common::Rect(destPos.x, destPos.y,
-		destPos.x + src.w, destPos.y + src.h));
+		destPos.x + srcRect.width(), destPos.y + srcRect.height()));
 
-	for (int yCtr = 0; yCtr < src.h; ++yCtr) {
-		const byte *pSrc = (const byte *)src.getBasePtr(0, yCtr);
+	for (int yCtr = 0; yCtr < srcRect.height(); ++yCtr) {
+		const byte *pSrc = (const byte *)src.getBasePtr(srcRect.left, srcRect.top + yCtr);
 		byte *pDest = (byte *)area.getBasePtr(0, yCtr);
 
-		for (int xCtr = 0; xCtr < src.w; ++xCtr, ++pSrc, ++pDest)
+		for (int xCtr = 0; xCtr < srcRect.width(); ++xCtr, ++pSrc, ++pDest)
 			*pDest ^= *pSrc;
 	}
 }
diff --git a/engines/ultima/shared/gfx/gfx_surface.h b/engines/ultima/shared/gfx/gfx_surface.h
index 6f48b714b33..8ed29fbb446 100644
--- a/engines/ultima/shared/gfx/gfx_surface.h
+++ b/engines/ultima/shared/gfx/gfx_surface.h
@@ -69,6 +69,7 @@ public:
 	}
 
 	void xorBlitFrom(const ManagedSurface &src, const Common::Point &destPos);
+	void xorBlitFrom(const ManagedSurface &src, const Common::Rect &srcRect, const Common::Point &destPos);
 };
 
 } // namespace Gfx
diff --git a/engines/ultima/ultima1/data/space_map.h b/engines/ultima/ultima1/data/space_map.h
index eb86fbb9ac1..e79a37326a3 100644
--- a/engines/ultima/ultima1/data/space_map.h
+++ b/engines/ultima/ultima1/data/space_map.h
@@ -40,6 +40,22 @@ constexpr int SPACE_STATION_Y = 3;
 // player's own ship, spawned attackers)
 constexpr int SPACE_SHIPS_PER_SECTOR = 4;
 
+// The overhead sector view's playable area - a ship drifting past this
+// seamlessly wraps around to the opposite edge, Asteroids-style. Matches
+// the drawable viewport setupView itself clears each frame (its own inset
+// frame within the outer game border, not the outer border itself), so a
+// ship's sprite is only ever actually invisible right as it wraps rather
+// than jumping there from comfortably mid-screen
+constexpr int SPACE_SECTOR_MIN_X = 16, SPACE_SECTOR_MAX_X = 303;
+constexpr int SPACE_SECTOR_MIN_Y = 16, SPACE_SECTOR_MAX_Y = 143;
+constexpr int SPACE_SECTOR_WRAP_WIDTH = SPACE_SECTOR_MAX_X - SPACE_SECTOR_MIN_X + 1;
+constexpr int SPACE_SECTOR_WRAP_HEIGHT = SPACE_SECTOR_MAX_Y - SPACE_SECTOR_MIN_Y + 1;
+
+// The station's fixed screen position/size within its own sector (3,3) -
+// drawStationGraphic's (x,y) and the raw bitmap's dimensions
+constexpr int SPACE_STATION_SCREEN_X = 60, SPACE_STATION_SCREEN_Y = 75;
+constexpr int SPACE_STATION_WIDTH = 21, SPACE_STATION_HEIGHT = 18;
+
 // Direction names shown in the cockpit view, indexed by Data::Direction
 // (1-4): the arrow keys read as Left / Right / Climb / Dive rather than the
 // overhead view's West / East / North / South
diff --git a/engines/ultima/ultima1/data/tiles.cpp b/engines/ultima/ultima1/data/tiles.cpp
index f26fcd12b36..d22edb01e56 100644
--- a/engines/ultima/ultima1/data/tiles.cpp
+++ b/engines/ultima/ultima1/data/tiles.cpp
@@ -66,8 +66,8 @@ void loadTiles(const char *filename, Graphics::ManagedSurface *tiles, int count,
 	delete[] data;
 }
 
-constexpr int SHIP_TILE_WIDTH = 32;
-constexpr int SHIP_TILE_HEIGHT = 19;
+constexpr int SHIP_TILE_WIDTH = SPACE_SHIP_TILE_WIDTH;
+constexpr int SHIP_TILE_HEIGHT = SPACE_SHIP_TILE_HEIGHT;
 constexpr int SHIP_TILE_ROW_BYTES = SHIP_TILE_WIDTH / 8;
 constexpr int SHIP_TILE_BYTES = SHIP_TILE_ROW_BYTES * SHIP_TILE_HEIGHT;
 constexpr int SHIP_TILE_SHIFT_VARIANTS = 8;
diff --git a/engines/ultima/ultima1/data/tiles.h b/engines/ultima/ultima1/data/tiles.h
index 270e41e69f9..faf0d7c4b35 100644
--- a/engines/ultima/ultima1/data/tiles.h
+++ b/engines/ultima/ultima1/data/tiles.h
@@ -35,6 +35,8 @@ constexpr int MONDAIN_TILES_COUNT = 19;
 // One outer-space ship glyph per shipType*4+facing combination (3 ship
 // types x 4 facings - see Data::SpaceShipType/SpaceShipFacing)
 constexpr int SPACE_SHIP_TILES_COUNT = 12;
+constexpr int SPACE_SHIP_TILE_WIDTH = 32;
+constexpr int SPACE_SHIP_TILE_HEIGHT = 19;
 
 enum OverworldTileId {
 	TILE_OCEAN = 0,
diff --git a/engines/ultima/ultima1/logic/space_map_logic.cpp b/engines/ultima/ultima1/logic/space_map_logic.cpp
index 5552a255191..56af910cb8e 100644
--- a/engines/ultima/ultima1/logic/space_map_logic.cpp
+++ b/engines/ultima/ultima1/logic/space_map_logic.cpp
@@ -29,12 +29,40 @@ namespace Ultima {
 namespace Ultima1 {
 namespace Logic {
 
-// The overhead sector view's playable area (clampShipX/Y) - drifting past
-// this is what triggers the viewport-border "Crunch!" bounce
-constexpr int SECTOR_MIN_X = 20, SECTOR_MAX_X = 275;
-constexpr int SECTOR_MIN_Y = 10, SECTOR_MAX_Y = 130;
 constexpr int MAX_DRIFT = 9;
 
+// Rotating Left/Right cycles the ship's facing a quarter-turn counter-
+// clockwise/clockwise (word_17EA2), indexed by the ship's current facing
+constexpr Data::SpaceShipFacing ROTATE_CCW[4] = {
+	Data::FACING_DOWN, Data::FACING_UP, Data::FACING_LEFT, Data::FACING_RIGHT
+};
+constexpr Data::SpaceShipFacing ROTATE_CW[4] = {
+	Data::FACING_UP, Data::FACING_DOWN, Data::FACING_RIGHT, Data::FACING_LEFT
+};
+
+// Thrust (Up) is a unit nudge along whichever way the ship is currently
+// facing, not a fixed screen axis - so facing Left and thrusting builds up
+// leftward drift, and reversing facing then thrusting decelerates/reverses
+// whatever drift is already there rather than adding a second, unrelated one
+constexpr int FACING_DX[4] = { -1, 1, 0, 0 };
+constexpr int FACING_DY[4] = { 0, 0, -1, 1 };
+
+static int wrapCoord(int value, int minVal, int maxVal, int wrapSize) {
+	if (value < minVal)
+		return value + wrapSize;
+	if (value > maxVal)
+		return value - wrapSize;
+	return value;
+}
+
+// True if a ship of the usual sprite size at (x,y) would overlap the given
+// rect - used to detect running into the station or another ship (the only
+// thing that actually triggers "Crunch!"; the sector edges just wrap)
+static bool overlapsRect(int x, int y, int rx, int ry, int rw, int rh) {
+	return x < rx + rw && x + Data::SPACE_SHIP_TILE_WIDTH > rx &&
+		y < ry + rh && y + Data::SPACE_SHIP_TILE_HEIGHT > ry;
+}
+
 bool SpaceMapLogic::move(Data::Direction dir) {
 	writeString("%s\n", Data::DIRECTION_NAMES[dir]);
 
@@ -47,58 +75,32 @@ bool SpaceMapLogic::move(Data::Direction dir) {
 	}
 	if (shipFuel() < fuelCost)
 		fuelCost = shipFuel();
-
-	// A ship sitting right on top of another counts as docked - thrusting
-	// into it (anything but Down, which just brakes) is a crunch rather
-	// than a move
-	Data::SpaceMapCell &cell = _G(savegame)._starmap._sectors[_G(savegame)._sectorX][_G(savegame)._sectorY];
-	const Data::SpaceMapShip &ship = cell._ships[_G(savegame)._shipIndex];
-	bool docked = false;
-	for (int i = 0; i < Data::SPACE_SHIPS_PER_SECTOR && !docked; ++i) {
-		if (i == _G(savegame)._shipIndex)
-			continue;
-		const Data::SpaceMapShip &other = cell._ships[i];
-		docked = other._shipType != Data::SHIP_NONE && other._x == ship._x && other._y == ship._y;
-	}
-
-	if (docked && dir != Data::DIR_DOWN) {
-		writeString("Crunch!\n");
-		playFX(0);
-		subtractShields(shipShields() / 4 + 5);
-		// TODO: death in space - see SpaceLogic::endOfTurn
-		if (shipShields() == 0)
-			writeString("Thy shield is drained!\n");
-		return true;
-	}
-
 	subtractFuel(fuelCost);
 
-	if (dir == Data::DIR_DOWN) {
-		// Brake - stop drifting and clear the exhaust trail
-		_G(sectorDriftX) = 0;
-		_G(sectorDriftY) = 0;
-		_G(shipExhaustCountdown) = 0;
-		redrawMap();
-		return true;
-	}
-
-	if (dir == Data::DIR_LEFT || dir == Data::DIR_RIGHT) {
-		// A lateral nudge doesn't sustain the exhaust trail the way
-		// thrusting forward (Up) does
-		_G(shipExhaustCountdown) = 0;
-	}
+	Data::SpaceMapShip &ship =
+		_G(savegame)._starmap._sectors[_G(savegame)._sectorX][_G(savegame)._sectorY]._ships[_G(savegame)._shipIndex];
 
 	switch (dir) {
 	case Data::DIR_LEFT:
-		_G(sectorDriftX) = CLIP(_G(sectorDriftX) - 1, -MAX_DRIFT, MAX_DRIFT);
+		ship._facing = ROTATE_CCW[ship._facing];
+		_G(shipExhaustCountdown) = 0;
 		break;
 	case Data::DIR_RIGHT:
-		_G(sectorDriftX) = CLIP(_G(sectorDriftX) + 1, -MAX_DRIFT, MAX_DRIFT);
+		ship._facing = ROTATE_CW[ship._facing];
+		_G(shipExhaustCountdown) = 0;
 		break;
 	case Data::DIR_UP:
-		_G(sectorDriftY) = CLIP(_G(sectorDriftY) - 1, -MAX_DRIFT, MAX_DRIFT);
+		_G(sectorDriftX) = CLIP(_G(sectorDriftX) + FACING_DX[ship._facing], -MAX_DRIFT, MAX_DRIFT);
+		_G(sectorDriftY) = CLIP(_G(sectorDriftY) + FACING_DY[ship._facing], -MAX_DRIFT, MAX_DRIFT);
 		_G(shipExhaustCountdown) += 10;
 		break;
+	case Data::DIR_DOWN:
+		// Brake - stop drifting and clear the exhaust trail. Rotating
+		// (Left/Right) leaves the drift untouched - only Down cancels it
+		_G(sectorDriftX) = 0;
+		_G(sectorDriftY) = 0;
+		_G(shipExhaustCountdown) = 0;
+		break;
 	default:
 		break;
 	}
@@ -112,13 +114,29 @@ void SpaceMapLogic::tick() {
 		return;
 
 	if (_G(sectorDriftX) != 0 || _G(sectorDriftY) != 0) {
-		Data::SpaceMapShip &ship =
-			_G(savegame)._starmap._sectors[_G(savegame)._sectorX][_G(savegame)._sectorY]._ships[_G(savegame)._shipIndex];
-
-		int newX = ship._x + _G(sectorDriftX);
-		int newY = ship._y + _G(sectorDriftY);
+		Data::SpaceMapCell &cell = _G(savegame)._starmap._sectors[_G(savegame)._sectorX][_G(savegame)._sectorY];
+		Data::SpaceMapShip &ship = cell._ships[_G(savegame)._shipIndex];
+
+		int newX = wrapCoord(ship._x + _G(sectorDriftX), Data::SPACE_SECTOR_MIN_X, Data::SPACE_SECTOR_MAX_X, Data::SPACE_SECTOR_WRAP_WIDTH);
+		int newY = wrapCoord(ship._y + _G(sectorDriftY), Data::SPACE_SECTOR_MIN_Y, Data::SPACE_SECTOR_MAX_Y, Data::SPACE_SECTOR_WRAP_HEIGHT);
+
+		// The only real obstacles are the station (in its own sector) and
+		// any other ship sitting in the sector - the sector edges themselves
+		// just wrap around
+		bool crunch = false;
+		if (_G(savegame)._sectorX == Data::SPACE_STATION_X && _G(savegame)._sectorY == Data::SPACE_STATION_Y) {
+			crunch = overlapsRect(newX, newY, Data::SPACE_STATION_SCREEN_X, Data::SPACE_STATION_SCREEN_Y,
+				Data::SPACE_STATION_WIDTH, Data::SPACE_STATION_HEIGHT);
+		}
+		for (int i = 0; !crunch && i < Data::SPACE_SHIPS_PER_SECTOR; ++i) {
+			if (i == _G(savegame)._shipIndex)
+				continue;
+			const Data::SpaceMapShip &other = cell._ships[i];
+			if (other._shipType != Data::SHIP_NONE)
+				crunch = overlapsRect(newX, newY, other._x, other._y, Data::SPACE_SHIP_TILE_WIDTH, Data::SPACE_SHIP_TILE_HEIGHT);
+		}
 
-		if (newX < SECTOR_MIN_X || newX > SECTOR_MAX_X || newY < SECTOR_MIN_Y || newY > SECTOR_MAX_Y) {
+		if (crunch) {
 			writeString("Crunch!\n");
 			playFX(0);
 			subtractShields(shipShields() / 4 + 5);
@@ -126,7 +144,7 @@ void SpaceMapLogic::tick() {
 			if (shipShields() == 0)
 				writeString("Thy shield is drained!\n");
 
-			// Bounce back off the border
+			// Bounce back rather than plough into it
 			_G(sectorDriftX) = -_G(sectorDriftX);
 			_G(sectorDriftY) = -_G(sectorDriftY);
 		} else {
diff --git a/engines/ultima/ultima1/views/space_map.cpp b/engines/ultima/ultima1/views/space_map.cpp
index 8a8197e2cfb..47abae39111 100644
--- a/engines/ultima/ultima1/views/space_map.cpp
+++ b/engines/ultima/ultima1/views/space_map.cpp
@@ -45,6 +45,56 @@ static bool withinShipView(int x, int y) {
 	return x > 20 && x < 300 && y > 18 && y < 141;
 }
 
+// The exhaust trail is plotted pixel-by-pixel (each already clipped to
+// withinShipView), so a second whole-shape pass at a shifted anchor is safe
+// - any pixels that land outside the viewport are simply skipped. Returns
+// the extra anchor position(s) needed (not including the ship's own true
+// position), up to 3 for a corner case where both axes overflow
+static int wrappedPositions(int x, int y, int w, int h, Common::Point extra[3]) {
+	int dxs[2] = { 0 }, dxCount = 1;
+	if (x < Data::SPACE_SECTOR_MIN_X)
+		dxs[dxCount++] = Data::SPACE_SECTOR_WRAP_WIDTH;
+	else if (x + w > Data::SPACE_SECTOR_MAX_X)
+		dxs[dxCount++] = -Data::SPACE_SECTOR_WRAP_WIDTH;
+
+	int dys[2] = { 0 }, dyCount = 1;
+	if (y < Data::SPACE_SECTOR_MIN_Y)
+		dys[dyCount++] = Data::SPACE_SECTOR_WRAP_HEIGHT;
+	else if (y + h > Data::SPACE_SECTOR_MAX_Y)
+		dys[dyCount++] = -Data::SPACE_SECTOR_WRAP_HEIGHT;
+
+	int count = 0;
+	for (int dyi = 0; dyi < dyCount; ++dyi) {
+		for (int dxi = 0; dxi < dxCount; ++dxi) {
+			if (dxi == 0 && dyi == 0)
+				continue;
+			extra[count++] = Common::Point(x + dxs[dxi], y + dys[dyi]);
+		}
+	}
+	return count;
+}
+
+// The ship tile is a single rectangular XOR blit, so (unlike the exhaust)
+// there's no per-pixel clipping to fall back on - xorBlitFrom doesn't clip
+// its rect either, so blitting the whole tile at a shifted, partly
+// off-surface position would corrupt unrelated pixels rather than just get
+// cropped. Instead, split the tile at the sector's wrap edge and draw each
+// piece at its own fully-in-bounds position, wrapping the clipped part
+// around to the opposite edge - up to 4 pieces at a corner
+static void drawWrappedTile(Shared::Gfx::GfxSurface &s, const Graphics::ManagedSurface &tile, int x, int y) {
+	int w = tile.w, h = tile.h;
+	int splitX = (x + w > Data::SPACE_SECTOR_MAX_X) ? (Data::SPACE_SECTOR_MAX_X - x) : w;
+	int splitY = (y + h > Data::SPACE_SECTOR_MAX_Y) ? (Data::SPACE_SECTOR_MAX_Y - y) : h;
+
+	s.xorBlitFrom(tile, Common::Rect(0, 0, splitX, splitY), Common::Point(x, y));
+	if (splitX < w)
+		s.xorBlitFrom(tile, Common::Rect(splitX, 0, w, splitY), Common::Point(Data::SPACE_SECTOR_MIN_X, y));
+	if (splitY < h)
+		s.xorBlitFrom(tile, Common::Rect(0, splitY, splitX, h), Common::Point(x, Data::SPACE_SECTOR_MIN_Y));
+	if (splitX < w && splitY < h)
+		s.xorBlitFrom(tile, Common::Rect(splitX, splitY, w, h), Common::Point(Data::SPACE_SECTOR_MIN_X, Data::SPACE_SECTOR_MIN_Y));
+}
+
 // Star/heat hazard bitmap (18 rows x 19 cols), matching SPACE.EXE's own raw
 // table for drawStarGraphic. 1 -> STAR_COLOR_1, 2 -> STAR_COLOR_2
 static const int8 STAR_BITMAP[18][19] = {
@@ -137,7 +187,7 @@ void SpaceMap::draw() {
 	// The station graphic only ever appears in its own fixed sector, at the
 	// docking-bay entrance point
 	if (_G(savegame)._sectorX == Data::SPACE_STATION_X && _G(savegame)._sectorY == Data::SPACE_STATION_Y)
-		drawStationGraphic(s, 60, 75);
+		drawStationGraphic(s, Data::SPACE_STATION_SCREEN_X, Data::SPACE_STATION_SCREEN_Y);
 
 	if (cell._hazardX != 0)
 		drawStarGraphic(s, cell._hazardX, cell._hazardY);
@@ -152,8 +202,20 @@ void SpaceMap::draw() {
 	}
 
 	// Only the player's own ship thrusts, so only it ever trails exhaust
-	if (_G(shipExhaustCountdown) > 0)
-		drawShipExhaust(s, cell._ships[_G(savegame)._shipIndex]);
+	if (_G(shipExhaustCountdown) > 0) {
+		const Data::SpaceMapShip &playerShip = cell._ships[_G(savegame)._shipIndex];
+		drawShipExhaust(s, playerShip);
+
+		Common::Point extra[3];
+		int count = wrappedPositions(playerShip._x, playerShip._y,
+			Data::SPACE_SHIP_TILE_WIDTH, Data::SPACE_SHIP_TILE_HEIGHT, extra);
+		for (int i = 0; i < count; ++i) {
+			Data::SpaceMapShip wrapped = playerShip;
+			wrapped._x = (int16)extra[i].x;
+			wrapped._y = (int16)extra[i].y;
+			drawShipExhaust(s, wrapped);
+		}
+	}
 }
 
 void SpaceMap::drawStarGraphic(Shared::Gfx::GfxSurface &s, int x, int y) {
@@ -206,7 +268,7 @@ void SpaceMap::drawStationGraphic(Shared::Gfx::GfxSurface &s, int x, int y) {
 void SpaceMap::drawShipOutline(Shared::Gfx::GfxSurface &s, const Data::SpaceMapShip &ship) {
 	int tileIndex = ship._shipType * 4 + ship._facing;
 	const Graphics::ManagedSurface &tile = _G(map).spaceShipTiles()[tileIndex];
-	s.xorBlitFrom(tile, Common::Point(ship._x, ship._y));
+	drawWrappedTile(s, tile, ship._x, ship._y);
 }
 
 void SpaceMap::drawShipExhaust(Shared::Gfx::GfxSurface &s, const Data::SpaceMapShip &ship) {


Commit: 12b5854fe5ac0b04b7b09a6d52dd40244af2b263
    https://github.com/scummvm/scummvm/commit/12b5854fe5ac0b04b7b09a6d52dd40244af2b263
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:40:53+11:00

Commit Message:
ULTIMA: ULTIMA1: Fix saving in maps other than overworld

Changed paths:
    engines/ultima/ultima1/data/map.cpp
    engines/ultima/ultima1/data/map.h
    engines/ultima/ultima1/logic/city_castle_logic.cpp


diff --git a/engines/ultima/ultima1/data/map.cpp b/engines/ultima/ultima1/data/map.cpp
index 7f4b5fe3056..99e8bf68de6 100644
--- a/engines/ultima/ultima1/data/map.cpp
+++ b/engines/ultima/ultima1/data/map.cpp
@@ -167,7 +167,7 @@ void Map::resetMondainMap() {
 }
 
 void Map::load(int mapNum) {
-	_currentMap = mapNum;
+	_G(savegame)._mapNum = mapNum;
 
 	if (mapNum == MAP_OVERWORLD) {
 		_mapWidth = OVERWORLD_WIDTH;
@@ -276,7 +276,7 @@ int Map::getMapTile(int x, int y) const {
 	// draw time and never stored in the map itself. This doesn't apply
 	// to city/castle map data, which uses a completely different,
 	// contiguous tile ID space (see the Town.bin tile table)
-	if (_currentMap == MAP_OVERWORLD && tile > TILE_CASTLE1) {
+	if (_G(savegame)._mapNum == MAP_OVERWORLD && tile > TILE_CASTLE1) {
 		++tile;
 		if (tile == TILE_CITY2)
 			++tile;
diff --git a/engines/ultima/ultima1/data/map.h b/engines/ultima/ultima1/data/map.h
index 07e43272c8b..be5d132eb12 100644
--- a/engines/ultima/ultima1/data/map.h
+++ b/engines/ultima/ultima1/data/map.h
@@ -124,7 +124,6 @@ private:
 	void loadDungeonMap();
 
 public:
-	int _currentMap = -1;
 	byte _playerTileId = 0;
 	byte _tilePlayerCenter = 0;
 	byte _tilePlayerUp = 0, _tilePlayerDown = 0,
diff --git a/engines/ultima/ultima1/logic/city_castle_logic.cpp b/engines/ultima/ultima1/logic/city_castle_logic.cpp
index da02137d338..83226501725 100644
--- a/engines/ultima/ultima1/logic/city_castle_logic.cpp
+++ b/engines/ultima/ultima1/logic/city_castle_logic.cpp
@@ -642,7 +642,7 @@ void CityCastleLogic::guardAttack(int entityIndex) {
 
 CityLogic::CityLogic() {
 	_G(map)._tavernCtr = 0;
-	_G(map)._mapStyle = (_G(map)._currentMap - 1) % 8 + 2;
+	_G(map)._mapStyle = (_G(savegame)._mapNum - 1) % 8 + 2;
 	_G(map)._mapType = Data::MAPTYPE_CITY;
 }
 
@@ -676,8 +676,8 @@ bool CityLogic::transact() {
 /*-------------------------------------------------------------------*/
 
 CastleLogic::CastleLogic() {
-	_G(map)._castleNum = _G(map)._currentMap - 33;
-	_G(map)._mapStyle = (_G(map)._currentMap - 1) % 2;
+	_G(map)._castleNum = _G(savegame)._mapNum - 33;
+	_G(map)._mapStyle = (_G(savegame)._mapNum - 1) % 2;
 	_G(map)._castleNum2 = _G(map)._castleNum + 1;
 	_G(map)._mapType = Data::MAPTYPE_CASTLE;
 


Commit: 9cb2ef5aff8e370453e9b3647ca08ee2ffb569f6
    https://github.com/scummvm/scummvm/commit/9cb2ef5aff8e370453e9b3647ca08ee2ffb569f6
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:40:53+11:00

Commit Message:
ULTIMA: ULTIMA1: Implement death when ship collides with sun

Changed paths:
    engines/ultima/ultima1/logic/space_logic.cpp
    engines/ultima/ultima1/logic/space_logic.h
    engines/ultima/ultima1/logic/space_map_logic.cpp
    engines/ultima/ultima1/views/interactions/dead.cpp
    engines/ultima/ultima1/views/interactions/dead.h
    engines/ultima/ultima1/views/views.h


diff --git a/engines/ultima/ultima1/logic/space_logic.cpp b/engines/ultima/ultima1/logic/space_logic.cpp
index 87a421aac0d..aa5dee47c4d 100644
--- a/engines/ultima/ultima1/logic/space_logic.cpp
+++ b/engines/ultima/ultima1/logic/space_logic.cpp
@@ -88,6 +88,10 @@ void SpaceLogic::subtractShields(int amount) {
 	redrawStats();
 }
 
+void SpaceLogic::death() {
+	g_engine->addView("SpaceDead");
+}
+
 void SpaceLogic::keypress(Common::KeyCode keycode) {
 	writeString("Huh?\n");
 	playFX(1);
diff --git a/engines/ultima/ultima1/logic/space_logic.h b/engines/ultima/ultima1/logic/space_logic.h
index ddc5fa820b6..995f278884f 100644
--- a/engines/ultima/ultima1/logic/space_logic.h
+++ b/engines/ultima/ultima1/logic/space_logic.h
@@ -63,6 +63,12 @@ protected:
 	 */
 	void subtractShields(int amount);
 
+	/**
+	 * Shows the SpaceDead view (death). The caller is expected to have
+	 * already written the reason for death to the commands area first
+	 */
+	void death();
+
 	void updateCreatures() override {
 	}
 
diff --git a/engines/ultima/ultima1/logic/space_map_logic.cpp b/engines/ultima/ultima1/logic/space_map_logic.cpp
index 56af910cb8e..341664f9fe3 100644
--- a/engines/ultima/ultima1/logic/space_map_logic.cpp
+++ b/engines/ultima/ultima1/logic/space_map_logic.cpp
@@ -31,6 +31,10 @@ namespace Logic {
 
 constexpr int MAX_DRIFT = 9;
 
+// Flying within this many units (on both axes) of a sector's star/heat
+// hazard is fatal (checkStarProximity)
+constexpr int STAR_DEATH_RANGE = 25;
+
 // Rotating Left/Right cycles the ship's facing a quarter-turn counter-
 // clockwise/clockwise (word_17EA2), indexed by the ship's current facing
 constexpr Data::SpaceShipFacing ROTATE_CCW[4] = {
@@ -120,6 +124,12 @@ void SpaceMapLogic::tick() {
 		int newX = wrapCoord(ship._x + _G(sectorDriftX), Data::SPACE_SECTOR_MIN_X, Data::SPACE_SECTOR_MAX_X, Data::SPACE_SECTOR_WRAP_WIDTH);
 		int newY = wrapCoord(ship._y + _G(sectorDriftY), Data::SPACE_SECTOR_MIN_Y, Data::SPACE_SECTOR_MAX_Y, Data::SPACE_SECTOR_WRAP_HEIGHT);
 
+		if (cell._hazardX != 0 && ABS(newX - cell._hazardX) < STAR_DEATH_RANGE && ABS(newY - cell._hazardY) < STAR_DEATH_RANGE) {
+			writeString("Thy ship melts near the star!\n");
+			death();
+			return;
+		}
+
 		// The only real obstacles are the station (in its own sector) and
 		// any other ship sitting in the sector - the sector edges themselves
 		// just wrap around
@@ -140,9 +150,11 @@ void SpaceMapLogic::tick() {
 			writeString("Crunch!\n");
 			playFX(0);
 			subtractShields(shipShields() / 4 + 5);
-			// TODO: death in space - see SpaceLogic::endOfTurn
-			if (shipShields() == 0)
+			if (shipShields() == 0) {
 				writeString("Thy shield is drained!\n");
+				death();
+				return;
+			}
 
 			// Bounce back rather than plough into it
 			_G(sectorDriftX) = -_G(sectorDriftX);
diff --git a/engines/ultima/ultima1/views/interactions/dead.cpp b/engines/ultima/ultima1/views/interactions/dead.cpp
index a94d68f936e..8b201d51920 100644
--- a/engines/ultima/ultima1/views/interactions/dead.cpp
+++ b/engines/ultima/ultima1/views/interactions/dead.cpp
@@ -100,6 +100,30 @@ static const uint8 DEATH_GRAPHIC_DATA[DEATH_GRAPHIC_HEIGHT * 8] = {
 	0x00, 0x00, 0x0f, 0x00, 0x00, 0xfc, 0x00, 0x00
 };
 
+// Shared by Dead and SpaceDead - both claim the map viewport area (inside
+// the game border, which is left drawn by whatever view was showing
+// underneath) and centre the same skull glyph within it
+static void drawSkullGraphic(Shared::Gfx::GfxSurface &s) {
+	// This view's own bounds start at absolute screen (8, 8), so convert
+	// down to the local coordinates its surface uses
+	int startX = DEATH_GRAPHIC_SCREEN_X - 8;
+	int startY = DEATH_GRAPHIC_SCREEN_Y - 8;
+
+	for (int row = 0; row < DEATH_GRAPHIC_HEIGHT; ++row) {
+		const uint8 *rowData = &DEATH_GRAPHIC_DATA[row * 8];
+		int x = startX;
+
+		for (int wordIdx = 0; wordIdx < 4; ++wordIdx) {
+			uint16 word = rowData[wordIdx * 2] | (rowData[wordIdx * 2 + 1] << 8);
+
+			for (int bit = 15; bit >= 0; --bit, ++x) {
+				if (word & (1 << bit))
+					s.setPixel(x, startY + row, EDGE_COLOR);
+			}
+		}
+	}
+}
+
 bool Dead::msgFocus(const FocusMessage &msg) {
 	// Claim the map viewport area (inside the game border, which is left
 	// drawn by whatever view was showing underneath)
@@ -132,25 +156,7 @@ void Dead::draw() {
 
 void Dead::drawDeathGraphic() {
 	auto s = getSurface();
-
-	// This view's own bounds start at absolute screen (8, 8), so convert
-	// down to the local coordinates its surface uses
-	int startX = DEATH_GRAPHIC_SCREEN_X - 8;
-	int startY = DEATH_GRAPHIC_SCREEN_Y - 8;
-
-	for (int row = 0; row < DEATH_GRAPHIC_HEIGHT; ++row) {
-		const uint8 *rowData = &DEATH_GRAPHIC_DATA[row * 8];
-		int x = startX;
-
-		for (int wordIdx = 0; wordIdx < 4; ++wordIdx) {
-			uint16 word = rowData[wordIdx * 2] | (rowData[wordIdx * 2 + 1] << 8);
-
-			for (int bit = 15; bit >= 0; --bit, ++x) {
-				if (word & (1 << bit))
-					s.setPixel(x, startY + row, EDGE_COLOR);
-			}
-		}
-	}
+	drawSkullGraphic(s);
 }
 
 bool Dead::tick() {
@@ -256,6 +262,32 @@ void Dead::finish() {
 	_G(map).load(Data::MAP_OVERWORLD);
 }
 
+bool SpaceDead::msgFocus(const FocusMessage &msg) {
+	setBounds(Common::Rect(8, 8, 312, 152));
+
+	g_engine->playFX(2);
+	g_engine->playFX(2);
+	g_engine->playFX(2);
+
+	return true;
+}
+
+void SpaceDead::draw() {
+	auto s = getSurface();
+	s.clear();
+	drawSkullGraphic(s);
+}
+
+bool SpaceDead::msgAction(const ActionMessage &msg) {
+	g_engine->replaceView("MainMenu", true);
+	return true;
+}
+
+bool SpaceDead::msgKeypress(const KeypressMessage &msg) {
+	g_engine->replaceView("MainMenu", true);
+	return true;
+}
+
 } // namespace Interactions
 } // namespace Views
 } // namespace Ultima1
diff --git a/engines/ultima/ultima1/views/interactions/dead.h b/engines/ultima/ultima1/views/interactions/dead.h
index 816aaaadd91..a7372201ea2 100644
--- a/engines/ultima/ultima1/views/interactions/dead.h
+++ b/engines/ultima/ultima1/views/interactions/dead.h
@@ -99,6 +99,27 @@ public:
 	bool tick() override;
 };
 
+/**
+ * Shown when the player dies in outer space (e.g. flying too close to a
+ * star). Unlike the overworld's Dead, there's no automatic resurrection
+ * sequence - the caller is expected to have already written the reason for
+ * death to the commands area (via SpaceLogic::death()) before this view goes
+ * up. Just shows the same skull glyph and waits for any key/action, then
+ * returns to the main menu
+ */
+class SpaceDead : public Interaction {
+public:
+	SpaceDead() : Interaction("SpaceDead") {
+	}
+	~SpaceDead() override {
+	}
+
+	bool msgFocus(const FocusMessage &msg) override;
+	bool msgAction(const ActionMessage &msg) override;
+	bool msgKeypress(const KeypressMessage &msg) override;
+	void draw() override;
+};
+
 } // namespace Interactions
 } // namespace Views
 } // namespace Ultima1
diff --git a/engines/ultima/ultima1/views/views.h b/engines/ultima/ultima1/views/views.h
index 89cfb7b5c28..ade08444951 100644
--- a/engines/ultima/ultima1/views/views.h
+++ b/engines/ultima/ultima1/views/views.h
@@ -67,6 +67,7 @@ struct Views : public Shared::Views {
 	Interactions::PrincessSaved _princessSaved;
 	Interactions::Ready _ready;
 	Interactions::SectorScan _sectorScan;
+	Interactions::SpaceDead _spaceDead;
 	Interactions::Win _win;
 	CreateCharacter _createCharacter;
 	DungeonMap _dungeonMap;


Commit: 7c7034c40d25cfceb82781b8378355bb9bfea7ca
    https://github.com/scummvm/scummvm/commit/7c7034c40d25cfceb82781b8378355bb9bfea7ca
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:40:53+11:00

Commit Message:
ULTIMA: ULTIMA1: Fix space map command key responses

Changed paths:
    engines/ultima/ultima1/data/map.cpp
    engines/ultima/ultima1/data/map.h
    engines/ultima/ultima1/logic/logic.cpp
    engines/ultima/ultima1/logic/space_map_logic.cpp
    engines/ultima/ultima1/metaengine.cpp


diff --git a/engines/ultima/ultima1/data/map.cpp b/engines/ultima/ultima1/data/map.cpp
index 99e8bf68de6..b805a4a4566 100644
--- a/engines/ultima/ultima1/data/map.cpp
+++ b/engines/ultima/ultima1/data/map.cpp
@@ -36,6 +36,7 @@ namespace Ultima1 {
 namespace Data {
 
 const char *DIRECTION_NAMES[5] = { nullptr, "West", "East", "North", "South" };
+const char *SPACE_DIRECTION_NAMES[5] = { nullptr, "Counter-Clockwise", "Clockwise", "Thrust", "Retro" };
 
 static const byte LOCATION_POS_X[LOCATION_COUNT] = {
 	39, 66, 25, 46, 52, 18, 70, 64, 126, 128, 148, 115, 150, 121,
diff --git a/engines/ultima/ultima1/data/map.h b/engines/ultima/ultima1/data/map.h
index be5d132eb12..d6137f5522f 100644
--- a/engines/ultima/ultima1/data/map.h
+++ b/engines/ultima/ultima1/data/map.h
@@ -70,6 +70,7 @@ enum MapType {
 typedef Common::Array< Common::Array<byte> > MapTiles;
 
 extern const char *DIRECTION_NAMES[5];
+extern const char *SPACE_DIRECTION_NAMES[5];
 extern const char *LOCATION_NAMES[LOCATION_COUNT];
 extern const char *CONTINENT_NAMES[4];
 
diff --git a/engines/ultima/ultima1/logic/logic.cpp b/engines/ultima/ultima1/logic/logic.cpp
index 255930c114d..c468f6123d0 100644
--- a/engines/ultima/ultima1/logic/logic.cpp
+++ b/engines/ultima/ultima1/logic/logic.cpp
@@ -120,6 +120,9 @@ void Logic::action(int action) {
 	case KEYBIND_BOARD:
 		doEndOfTurn = board();
 		break;
+	case KEYBIND_CAST:
+		doEndOfTurn = cast();
+		break;
 	case KEYBIND_CLIMB:
 		doEndOfTurn = climb();
 		break;
diff --git a/engines/ultima/ultima1/logic/space_map_logic.cpp b/engines/ultima/ultima1/logic/space_map_logic.cpp
index 341664f9fe3..983cc543617 100644
--- a/engines/ultima/ultima1/logic/space_map_logic.cpp
+++ b/engines/ultima/ultima1/logic/space_map_logic.cpp
@@ -68,7 +68,7 @@ static bool overlapsRect(int x, int y, int rx, int ry, int rw, int rh) {
 }
 
 bool SpaceMapLogic::move(Data::Direction dir) {
-	writeString("%s\n", Data::DIRECTION_NAMES[dir]);
+	writeString("%s\n", Data::SPACE_DIRECTION_NAMES[dir]);
 
 	int fuelCost = (dir == Data::DIR_LEFT || dir == Data::DIR_RIGHT) ? 2 : 5;
 
diff --git a/engines/ultima/ultima1/metaengine.cpp b/engines/ultima/ultima1/metaengine.cpp
index 31c4f1414be..48af7f8677d 100644
--- a/engines/ultima/ultima1/metaengine.cpp
+++ b/engines/ultima/ultima1/metaengine.cpp
@@ -49,6 +49,7 @@ static const KeybindingRecord GAMEPLAY_KEYS[] = {
 	{ KEYBIND_ATTACK_DOWN, "ATTACK_DOWN", _s("Attack Down"), "2", nullptr},
 	{ KEYBIND_ATTACK_LEFT, "ATTACK_LEFT", _s("Attack Left"), "4", nullptr},
 	{ KEYBIND_ATTACK_RIGHT, "ATTACK_RIGHT", _s("Attack Right"), "6", nullptr},
+	{ KEYBIND_ATTACK, "ATTACK", _s("Attack"), "a", nullptr},
 	{ KEYBIND_BOARD, "BOARD", _s("Board"), "b", nullptr },
 	{ KEYBIND_CAST, "CAST", _s("Cast"), "c", nullptr },
 	{ KEYBIND_DROP, "DROP", _s("Drop"), "d", nullptr },
@@ -79,6 +80,7 @@ static const KeybindingRecord SPACE_KEYS[] = {
 	{ KEYBIND_DOWN, "DOWN", _s("Down"), "DOWN", "JOY_DOWN"},
 	{ KEYBIND_LEFT, "LEFT", _s("Left"), "LEFT", "JOY_LEFT"},
 	{ KEYBIND_RIGHT, "RIGHT", _s("Right"), "RIGHT", "JOY_RIGHT"},
+	{ KEYBIND_ATTACK, "ATTACK", _s("Attack"), "a", nullptr },
 	{ KEYBIND_BOARD, "BOARD", _s("Board"), "b", nullptr },
 	{ KEYBIND_CAST, "CAST", _s("Cast"), "c", nullptr },
 	{ KEYBIND_DROP, "DROP", _s("Drop"), "d", nullptr },


Commit: 02d5f8e81f759ca96394f42f08632e8369cbc27d
    https://github.com/scummvm/scummvm/commit/02d5f8e81f759ca96394f42f08632e8369cbc27d
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:40:53+11:00

Commit Message:
ULTIMA: ULTIMA1: Space station docking

Changed paths:
  A engines/ultima/ultima1/views/interactions/space_station.cpp
  A engines/ultima/ultima1/views/interactions/space_station.h
    engines/ultima/module.mk
    engines/ultima/ultima1/data/space_map.cpp
    engines/ultima/ultima1/data/space_map.h
    engines/ultima/ultima1/logic/space_map_logic.cpp
    engines/ultima/ultima1/views/interactions/interaction.cpp
    engines/ultima/ultima1/views/views.h


diff --git a/engines/ultima/module.mk b/engines/ultima/module.mk
index 6c1c1bd7659..1e84580856b 100644
--- a/engines/ultima/module.mk
+++ b/engines/ultima/module.mk
@@ -85,6 +85,7 @@ MODULE_OBJS += \
 	ultima1/views/interactions/princess_saved.o \
 	ultima1/views/interactions/ready.o \
 	ultima1/views/interactions/sector_scan.o \
+	ultima1/views/interactions/space_station.o \
 	ultima1/views/interactions/win.o \
 	ultima1/views/view.o \
 	ultima1/views/commands.o \
diff --git a/engines/ultima/ultima1/data/space_map.cpp b/engines/ultima/ultima1/data/space_map.cpp
index 4397524c2a3..fed144d55f3 100644
--- a/engines/ultima/ultima1/data/space_map.cpp
+++ b/engines/ultima/ultima1/data/space_map.cpp
@@ -29,6 +29,67 @@ namespace Data {
 
 const char *SPACE_COCKPIT_DIRECTION_NAMES[5] = { nullptr, "Left", "Right", "Climb", "Dive" };
 
+// Edge order: 0=left, 1=right, 2=top, 3=bottom. ShipType order: Shuttle,
+// LargeFighter, SmallFighter
+const int16 SPACE_DOCK_DELTA_X[SPACE_DOCK_EDGE_COUNT][3] = {
+	{ -17, -15, -15 },
+	{ 18, 18, 18 },
+	{ 0, 1, 2 },
+	{ 0, 1, 2 }
+};
+const int16 SPACE_DOCK_DELTA_Y[SPACE_DOCK_EDGE_COUNT][3] = {
+	{ 1, 1, 1 },
+	{ 1, 1, 1 },
+	{ -17, -16, -16 },
+	{ 18, 17, 17 }
+};
+const SpaceShipFacing SPACE_DOCK_EDGE_FACING[SPACE_DOCK_EDGE_COUNT] = {
+	FACING_RIGHT, FACING_LEFT, FACING_DOWN, FACING_UP
+};
+const char *SPACE_DOCK_EDGE_NAMES[SPACE_DOCK_EDGE_COUNT] = { "left", "right", "top", "bottom" };
+
+int SpaceMapCell::dockedEdge(int shipIndex) const {
+	const SpaceMapShip &ship = _ships[shipIndex];
+	if (ship._shipType == SHIP_NONE)
+		return -1;
+
+	for (int edge = 0; edge < SPACE_DOCK_EDGE_COUNT; ++edge) {
+		int expectedX = _anchorX + SPACE_DOCK_DELTA_X[edge][ship._shipType];
+		int expectedY = _anchorY + SPACE_DOCK_DELTA_Y[edge][ship._shipType];
+		if (ship._x == expectedX && ship._y == expectedY && ship._facing == SPACE_DOCK_EDGE_FACING[edge])
+			return edge;
+	}
+
+	return -1;
+}
+
+int SpaceMapCell::shipAtEdge(int edge) const {
+	for (int i = 0; i < SPACE_SHIPS_PER_SECTOR; ++i) {
+		if (dockedEdge(i) == edge)
+			return i;
+	}
+
+	return -1;
+}
+
+int16 shipFuelCapacity(int shipType) {
+	switch (shipType) {
+	case SHIP_SHUTTLE: return 1000;
+	case SHIP_LARGE_FIGHTER: return 5000;
+	case SHIP_SMALL_FIGHTER: return 2500;
+	default: return 0;
+	}
+}
+
+int16 shipShieldCapacity(int shipType) {
+	switch (shipType) {
+	case SHIP_SHUTTLE: return 1000;
+	case SHIP_LARGE_FIGHTER: return 1000;
+	case SHIP_SMALL_FIGHTER: return 5000;
+	default: return 0;
+	}
+}
+
 int SpaceMap::getRandomNumber(int minVal, int maxVal) {
 	// seed = ror16(seed + 0x9248, 3)
 	_randomSeed = (uint16)(_randomSeed + 0x9248);
diff --git a/engines/ultima/ultima1/data/space_map.h b/engines/ultima/ultima1/data/space_map.h
index e79a37326a3..6b959cd9d15 100644
--- a/engines/ultima/ultima1/data/space_map.h
+++ b/engines/ultima/ultima1/data/space_map.h
@@ -79,6 +79,26 @@ enum SpaceShipFacing {
 	FACING_DOWN = 3
 };
 
+// The 4 station/encounter docking edges (EDGE_NAMES), and the [edge][shipType]
+// offsets from a sector's anchor for a ship of that type parked at that edge
+// (checkOverlapX/Y's own DELTA_X/DELTA_Y tables)
+constexpr int SPACE_DOCK_EDGE_COUNT = 4;
+extern const int16 SPACE_DOCK_DELTA_X[SPACE_DOCK_EDGE_COUNT][3];
+extern const int16 SPACE_DOCK_DELTA_Y[SPACE_DOCK_EDGE_COUNT][3];
+
+// The facing a ship parked at a given edge should have - always facing
+// inward toward the station/anchor (checkOverlapFacing)
+extern const SpaceShipFacing SPACE_DOCK_EDGE_FACING[SPACE_DOCK_EDGE_COUNT];
+
+// Edge names used in docking prompts/messages (EDGE_NAMES)
+extern const char *SPACE_DOCK_EDGE_NAMES[SPACE_DOCK_EDGE_COUNT];
+
+/**
+ * Max fuel/shield for a ship type (getShipFuelCapacity/getShipShieldCapacity)
+ */
+int16 shipFuelCapacity(int shipType);
+int16 shipShieldCapacity(int shipType);
+
 /**
  * A single ship occupying one of a sector's ship slots
  */
@@ -109,6 +129,19 @@ struct SpaceMapCell {
 	SpaceMapShip _ships[SPACE_SHIPS_PER_SECTOR];
 
 	void synchronize(Common::Serializer &s);
+
+	/**
+	 * Returns which docking edge (0-3) the given ship slot is currently
+	 * sitting in - an exact position and inward-facing match for its own
+	 * ship type - or -1 if it isn't docked anywhere (collisionCheck)
+	 */
+	int dockedEdge(int shipIndex) const;
+
+	/**
+	 * Returns which ship slot (0-3) is currently docked at the given edge,
+	 * or -1 if none is (findDockedShipAtEdge)
+	 */
+	int shipAtEdge(int edge) const;
 };
 
 /**
diff --git a/engines/ultima/ultima1/logic/space_map_logic.cpp b/engines/ultima/ultima1/logic/space_map_logic.cpp
index 983cc543617..8e7ebeda71d 100644
--- a/engines/ultima/ultima1/logic/space_map_logic.cpp
+++ b/engines/ultima/ultima1/logic/space_map_logic.cpp
@@ -130,11 +130,25 @@ void SpaceMapLogic::tick() {
 			return;
 		}
 
-		// The only real obstacles are the station (in its own sector) and
-		// any other ship sitting in the sector - the sector edges themselves
-		// just wrap around
+		int oldX = ship._x, oldY = ship._y;
+		ship._x = (int16)newX;
+		ship._y = (int16)newY;
+
+		bool isStationSector = _G(savegame)._sectorX == Data::SPACE_STATION_X && _G(savegame)._sectorY == Data::SPACE_STATION_Y;
+
+		// Coming to rest exactly in one of the station's docking slots (the
+		// right position AND facing, for the ship's own type) docks safely;
+		// anything else that touches the station or another ship is a crunch
+		if (isStationSector && cell.dockedEdge(_G(savegame)._shipIndex) >= 0) {
+			_G(sectorDriftX) = 0;
+			_G(sectorDriftY) = 0;
+			g_engine->addView("SpaceStation");
+			redrawMap();
+			return;
+		}
+
 		bool crunch = false;
-		if (_G(savegame)._sectorX == Data::SPACE_STATION_X && _G(savegame)._sectorY == Data::SPACE_STATION_Y) {
+		if (isStationSector) {
 			crunch = overlapsRect(newX, newY, Data::SPACE_STATION_SCREEN_X, Data::SPACE_STATION_SCREEN_Y,
 				Data::SPACE_STATION_WIDTH, Data::SPACE_STATION_HEIGHT);
 		}
@@ -147,6 +161,10 @@ void SpaceMapLogic::tick() {
 		}
 
 		if (crunch) {
+			// Revert - stay where we were before this frame's drift
+			ship._x = (int16)oldX;
+			ship._y = (int16)oldY;
+
 			writeString("Crunch!\n");
 			playFX(0);
 			subtractShields(shipShields() / 4 + 5);
@@ -159,9 +177,6 @@ void SpaceMapLogic::tick() {
 			// Bounce back rather than plough into it
 			_G(sectorDriftX) = -_G(sectorDriftX);
 			_G(sectorDriftY) = -_G(sectorDriftY);
-		} else {
-			ship._x = (int16)newX;
-			ship._y = (int16)newY;
 		}
 	}
 
diff --git a/engines/ultima/ultima1/views/interactions/interaction.cpp b/engines/ultima/ultima1/views/interactions/interaction.cpp
index 1c4c9156ba1..ec565dee2ed 100644
--- a/engines/ultima/ultima1/views/interactions/interaction.cpp
+++ b/engines/ultima/ultima1/views/interactions/interaction.cpp
@@ -54,15 +54,15 @@ void Interaction::writeString(const char *format, ...) {
 }
 
 void Interaction::resetLine() {
-	g_engine->findView("Commands")->send(GameMessage("RESET_LINE"));
+	g_engine->baseView()->findView("Commands")->send(GameMessage("RESET_LINE"));
 }
 
 void Interaction::showCursor() {
-	g_engine->findView("Commands")->send(GameMessage("SHOW_CURSOR"));
+	g_engine->baseView()->findView("Commands")->send(GameMessage("SHOW_CURSOR"));
 }
 
 void Interaction::prompt() {
-	g_engine->findView("Commands")->send(GameMessage("PROMPT"));
+	g_engine->baseView()->findView("Commands")->send(GameMessage("PROMPT"));
 }
 
 } // namespace Interactions
diff --git a/engines/ultima/ultima1/views/interactions/space_station.cpp b/engines/ultima/ultima1/views/interactions/space_station.cpp
new file mode 100644
index 00000000000..6a46ec79e21
--- /dev/null
+++ b/engines/ultima/ultima1/views/interactions/space_station.cpp
@@ -0,0 +1,128 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "ultima/ultima1/views/interactions/space_station.h"
+#include "ultima/ultima1/data/space_map.h"
+#include "ultima/ultima1/ultima1.h"
+
+namespace Ultima {
+namespace Ultima1 {
+namespace Views {
+namespace Interactions {
+
+constexpr int DOCKING_FEE = 500;
+
+bool SpaceStation::msgFocus(const FocusMessage &msg) {
+	setBounds(Common::Rect(0, 0, 0, 0));
+
+	// The ship is now docked - stop drifting and drop the exhaust trail
+	_G(sectorDriftX) = 0;
+	_G(sectorDriftY) = 0;
+	_G(shipExhaustCountdown) = 0;
+
+	writeString("Docked!  Welcome to base!\n");
+
+	if (_G(savegame)._equippedArmor < Data::ARMOR_VACUUM_SUIT) {
+		writeString("The spacedoors open, exposing\n");
+		writeString("thee to a complete vacuum!\n");
+		g_engine->addView("SpaceDead");
+		return true;
+	}
+
+	Data::SpaceMapCell &cell = _G(savegame)._starmap._sectors[_G(savegame)._sectorX][_G(savegame)._sectorY];
+
+	if (_G(savegame)._coins < DOCKING_FEE) {
+		writeString("Sorry, but thou canst not\n");
+		writeString("refuel thy ship without\n");
+		writeString("the 500p docking fee.\n");
+		finish();
+		return true;
+	}
+
+	// The ship that arrived gets refueled and its shields restored,
+	// regardless of which ship (if any) the player ends up flying out in
+	_G(savegame)._coins -= DOCKING_FEE;
+	Data::SpaceMapShip &dockedShip = cell._ships[_G(savegame)._shipIndex];
+	dockedShip._fuel = Data::shipFuelCapacity(dockedShip._shipType);
+	dockedShip._shield = Data::shipShieldCapacity(dockedShip._shipType);
+
+	int realShipCount = 0;
+	for (int i = 0; i < Data::SPACE_SHIPS_PER_SECTOR; ++i) {
+		if (cell._ships[i]._shipType != Data::SHIP_NONE)
+			++realShipCount;
+	}
+
+	if (realShipCount > 1) {
+		_state = STATE_CHOOSE_SHIP;
+		resetLine();
+		writeString("Choose thy ship: ");
+		showCursor();
+	} else {
+		finish();
+	}
+
+	return true;
+}
+
+bool SpaceStation::msgAction(const ActionMessage &msg) {
+	// Only a docking-port digit (handled in msgKeypress) does anything here
+	return true;
+}
+
+bool SpaceStation::msgKeypress(const KeypressMessage &msg) {
+	if (_state != STATE_CHOOSE_SHIP)
+		return true;
+
+	if (msg.keycode < Common::KEYCODE_1 || msg.keycode > Common::KEYCODE_4)
+		return true;
+
+	int edge = msg.keycode - Common::KEYCODE_1;
+	writeString("%d\n", edge + 1);
+
+	Data::SpaceMapCell &cell = _G(savegame)._starmap._sectors[_G(savegame)._sectorX][_G(savegame)._sectorY];
+	int slot = cell.shipAtEdge(edge);
+
+	if (slot == -1) {
+		writeString("That port is not available.\n");
+		resetLine();
+		writeString("Choose thy ship: ");
+		showCursor();
+		return true;
+	}
+
+	_G(savegame)._shipIndex = slot;
+	writeString("Thou art in the %s ship.\n", Data::SPACE_DOCK_EDGE_NAMES[edge]);
+	finish();
+	return true;
+}
+
+void SpaceStation::finish() {
+	g_engine->baseView()->findView("Stats")->draw();
+
+	resetLine();
+	prompt();
+	close();
+}
+
+} // namespace Interactions
+} // namespace Views
+} // namespace Ultima1
+} // namespace Ultima
diff --git a/engines/ultima/ultima1/views/interactions/space_station.h b/engines/ultima/ultima1/views/interactions/space_station.h
new file mode 100644
index 00000000000..eb8c11f5be1
--- /dev/null
+++ b/engines/ultima/ultima1/views/interactions/space_station.h
@@ -0,0 +1,74 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef ULTIMA1_VIEWS_INTERACTIONS_SPACE_STATION_H
+#define ULTIMA1_VIEWS_INTERACTIONS_SPACE_STATION_H
+
+#include "ultima/ultima1/views/interactions/interaction.h"
+
+namespace Ultima {
+namespace Ultima1 {
+namespace Views {
+namespace Interactions {
+
+using namespace Ultima::Shared::Messages;
+
+/**
+ * Shown when the player's ship comes to rest exactly in one of the space
+ * station's docking slots (SpaceMapLogic::tick() - dockAtStation). Charges
+ * the 500gp docking fee and refuels the ship that just docked, refusing if
+ * the player can't pay; kills the player outright if they aren't wearing a
+ * vacuum/reflect suit (space station airlocks don't care); and if more than
+ * one real ship is present in the sector, prompts to choose which one to
+ * fly out in
+ */
+class SpaceStation : public Interaction {
+private:
+	enum State {
+		STATE_DONE,
+		STATE_CHOOSE_SHIP
+	};
+
+	State _state = STATE_DONE;
+
+	/**
+	 * Finishes up: refreshes the fuel/shield/coins HUD and hands control
+	 * back to the map
+	 */
+	void finish();
+
+public:
+	SpaceStation() : Interaction("SpaceStation") {
+	}
+	~SpaceStation() override {
+	}
+
+	bool msgFocus(const FocusMessage &msg) override;
+	bool msgAction(const ActionMessage &msg) override;
+	bool msgKeypress(const KeypressMessage &msg) override;
+};
+
+} // namespace Interactions
+} // namespace Views
+} // namespace Ultima1
+} // namespace Ultima
+
+#endif
diff --git a/engines/ultima/ultima1/views/views.h b/engines/ultima/ultima1/views/views.h
index ade08444951..f82f46e2de5 100644
--- a/engines/ultima/ultima1/views/views.h
+++ b/engines/ultima/ultima1/views/views.h
@@ -35,6 +35,7 @@
 #include "ultima/ultima1/views/interactions/princess_saved.h"
 #include "ultima/ultima1/views/interactions/ready.h"
 #include "ultima/ultima1/views/interactions/sector_scan.h"
+#include "ultima/ultima1/views/interactions/space_station.h"
 #include "ultima/ultima1/views/interactions/win.h"
 #include "ultima/ultima1/views/create_character.h"
 #include "ultima/ultima1/views/dungeon_map.h"
@@ -68,6 +69,7 @@ struct Views : public Shared::Views {
 	Interactions::Ready _ready;
 	Interactions::SectorScan _sectorScan;
 	Interactions::SpaceDead _spaceDead;
+	Interactions::SpaceStation _spaceStation;
 	Interactions::Win _win;
 	CreateCharacter _createCharacter;
 	DungeonMap _dungeonMap;


Commit: 0121b57a32f21a10c915f5692171e1f87fb0bb7d
    https://github.com/scummvm/scummvm/commit/0121b57a32f21a10c915f5692171e1f87fb0bb7d
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:40:53+11:00

Commit Message:
ULTIMA: ULTIMA1: Fixes to ship movement to space station

Changed paths:
    engines/ultima/ultima1/logic/space_map_logic.cpp


diff --git a/engines/ultima/ultima1/logic/space_map_logic.cpp b/engines/ultima/ultima1/logic/space_map_logic.cpp
index 8e7ebeda71d..83452101ca4 100644
--- a/engines/ultima/ultima1/logic/space_map_logic.cpp
+++ b/engines/ultima/ultima1/logic/space_map_logic.cpp
@@ -59,12 +59,25 @@ static int wrapCoord(int value, int minVal, int maxVal, int wrapSize) {
 	return value;
 }
 
-// True if a ship of the usual sprite size at (x,y) would overlap the given
+// The ship tile is a 32x19 canvas, but most of that is blank padding left
+// over from the original's byte-alignment pre-shift copies (see
+// loadShipTiles) - the actual ship silhouette drawn within it is much
+// smaller. Using the full tile as the collision box was triggering "Crunch!"
+// roughly a whole ship-width before the ship visually touched anything, so
+// use a smaller, roughly-centred box instead
+constexpr int SHIP_COLLISION_WIDTH = 16;
+constexpr int SHIP_COLLISION_HEIGHT = 10;
+constexpr int SHIP_COLLISION_OFFSET_X = (Data::SPACE_SHIP_TILE_WIDTH - SHIP_COLLISION_WIDTH) / 2;
+constexpr int SHIP_COLLISION_OFFSET_Y = (Data::SPACE_SHIP_TILE_HEIGHT - SHIP_COLLISION_HEIGHT) / 2;
+
+// True if a ship at (x,y) (its tile's top-left) would overlap the given
 // rect - used to detect running into the station or another ship (the only
 // thing that actually triggers "Crunch!"; the sector edges just wrap)
 static bool overlapsRect(int x, int y, int rx, int ry, int rw, int rh) {
-	return x < rx + rw && x + Data::SPACE_SHIP_TILE_WIDTH > rx &&
-		y < ry + rh && y + Data::SPACE_SHIP_TILE_HEIGHT > ry;
+	x += SHIP_COLLISION_OFFSET_X;
+	y += SHIP_COLLISION_OFFSET_Y;
+	return x < rx + rw && x + SHIP_COLLISION_WIDTH > rx &&
+		y < ry + rh && y + SHIP_COLLISION_HEIGHT > ry;
 }
 
 bool SpaceMapLogic::move(Data::Direction dir) {
@@ -99,10 +112,14 @@ bool SpaceMapLogic::move(Data::Direction dir) {
 		_G(shipExhaustCountdown) += 10;
 		break;
 	case Data::DIR_DOWN:
-		// Brake - stop drifting and clear the exhaust trail. Rotating
-		// (Left/Right) leaves the drift untouched - only Down cancels it
-		_G(sectorDriftX) = 0;
-		_G(sectorDriftY) = 0;
+		// Retro-thrust - a real thrust in the opposite direction, not a
+		// full stop. From rest it starts the ship moving backwards, and
+		// against existing forward drift it only decelerates it by one
+		// increment (mirrors Up, just subtracted instead of added). It does
+		// immediately clear any exhaust trail still showing from a
+		// previous Up, rather than extending it further
+		_G(sectorDriftX) = CLIP(_G(sectorDriftX) - FACING_DX[ship._facing], -MAX_DRIFT, MAX_DRIFT);
+		_G(sectorDriftY) = CLIP(_G(sectorDriftY) - FACING_DY[ship._facing], -MAX_DRIFT, MAX_DRIFT);
 		_G(shipExhaustCountdown) = 0;
 		break;
 	default:
@@ -157,7 +174,8 @@ void SpaceMapLogic::tick() {
 				continue;
 			const Data::SpaceMapShip &other = cell._ships[i];
 			if (other._shipType != Data::SHIP_NONE)
-				crunch = overlapsRect(newX, newY, other._x, other._y, Data::SPACE_SHIP_TILE_WIDTH, Data::SPACE_SHIP_TILE_HEIGHT);
+				crunch = overlapsRect(newX, newY, other._x + SHIP_COLLISION_OFFSET_X, other._y + SHIP_COLLISION_OFFSET_Y,
+					SHIP_COLLISION_WIDTH, SHIP_COLLISION_HEIGHT);
 		}
 
 		if (crunch) {


Commit: 45f316064d9f61c6132e4c5143a397aaa6bf9654
    https://github.com/scummvm/scummvm/commit/45f316064d9f61c6132e4c5143a397aaa6bf9654
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:40:53+11:00

Commit Message:
ULTIMA: ULTIMA1: Secret autopilot command

Changed paths:
    engines/ultima/ultima1/logic/space_map_logic.cpp
    engines/ultima/ultima1/logic/space_map_logic.h


diff --git a/engines/ultima/ultima1/logic/space_map_logic.cpp b/engines/ultima/ultima1/logic/space_map_logic.cpp
index 83452101ca4..c2fde4e2890 100644
--- a/engines/ultima/ultima1/logic/space_map_logic.cpp
+++ b/engines/ultima/ultima1/logic/space_map_logic.cpp
@@ -130,6 +130,37 @@ bool SpaceMapLogic::move(Data::Direction dir) {
 	return true;
 }
 
+bool SpaceMapLogic::attack(Data::Direction dir) {
+	if (_G(savegame)._sectorX != Data::SPACE_STATION_X || _G(savegame)._sectorY != Data::SPACE_STATION_Y) {
+		writeString("Autopilot: only in home sector.\n");
+		return true;
+	}
+
+	Data::SpaceMapCell &cell = _G(savegame)._starmap._sectors[Data::SPACE_STATION_X][Data::SPACE_STATION_Y];
+	int freeEdge = -1;
+	for (int edge = 0; edge < Data::SPACE_DOCK_EDGE_COUNT; ++edge) {
+		if (cell.shipAtEdge(edge) == -1) {
+			freeEdge = edge;
+			break;
+		}
+	}
+	if (freeEdge == -1)
+		// Should never happen
+		return true;
+
+	Data::SpaceMapShip &ship = cell._ships[_G(savegame)._shipIndex];
+	ship._x = (int16)(cell._anchorX + Data::SPACE_DOCK_DELTA_X[freeEdge][ship._shipType]);
+	ship._y = (int16)(cell._anchorY + Data::SPACE_DOCK_DELTA_Y[freeEdge][ship._shipType]);
+	ship._facing = Data::SPACE_DOCK_EDGE_FACING[freeEdge];
+
+	_G(sectorDriftX) = 0;
+	_G(sectorDriftY) = 0;
+	_G(shipExhaustCountdown) = 0;
+
+	g_engine->addView("SpaceStation");
+	return false;
+}
+
 void SpaceMapLogic::tick() {
 	if (_G(sectorDriftX) == 0 && _G(sectorDriftY) == 0 && _G(shipExhaustCountdown) == 0)
 		return;
diff --git a/engines/ultima/ultima1/logic/space_map_logic.h b/engines/ultima/ultima1/logic/space_map_logic.h
index d830f3337b6..72f90e6da7c 100644
--- a/engines/ultima/ultima1/logic/space_map_logic.h
+++ b/engines/ultima/ultima1/logic/space_map_logic.h
@@ -44,6 +44,13 @@ protected:
 	bool fire() override;
 	bool view() override;
 
+	/**
+	 * Repurposed as an "Autopilot" testing shortcut in the overhead view -
+	 * finds a free station docking port and instantly shifts the ship
+	 * there, then triggers docking directly (not part of the original)
+	 */
+	bool attack(Data::Direction dir) override;
+
 public:
 	SpaceMapLogic() : SpaceLogic() {}
 	~SpaceMapLogic() override {


Commit: b1192774e5a97dc3441474eda87eb6e638085d1a
    https://github.com/scummvm/scummvm/commit/b1192774e5a97dc3441474eda87eb6e638085d1a
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:40:53+11:00

Commit Message:
ULTIMA: ULTIMA1: Mouse control for space cockpit view

Changed paths:
    engines/ultima/ultima1/console.cpp
    engines/ultima/ultima1/views/space_cockpit.cpp
    engines/ultima/ultima1/views/space_cockpit.h


diff --git a/engines/ultima/ultima1/console.cpp b/engines/ultima/ultima1/console.cpp
index d3d3dbf8d14..35c3f64d097 100644
--- a/engines/ultima/ultima1/console.cpp
+++ b/engines/ultima/ultima1/console.cpp
@@ -68,6 +68,11 @@ bool Console::cmdMap(int argc, const char **argv) {
 			if (location == Data::MAP_SPACE) {
 				_G(savegame)._shipFuel = 9999;
 				_G(savegame)._shipShield = 9999;
+
+				// Make sure docking at the station doesn't kill them outright
+				// for want of a vacuum suit
+				_G(savegame)._armor[Data::ARMOR_VACUUM_SUIT] = 1;
+				_G(savegame)._equippedArmor = Data::ARMOR_VACUUM_SUIT;
 			}
 
 			_G(map).load(location);
diff --git a/engines/ultima/ultima1/views/space_cockpit.cpp b/engines/ultima/ultima1/views/space_cockpit.cpp
index aeaffaca817..0640e94988c 100644
--- a/engines/ultima/ultima1/views/space_cockpit.cpp
+++ b/engines/ultima/ultima1/views/space_cockpit.cpp
@@ -19,6 +19,7 @@
  *
  */
 
+#include "common/util.h"
 #include "ultima/ultima1/views/space_cockpit.h"
 #include "ultima/ultima1/data/space_map.h"
 #include "ultima/ultima1/ultima1.h"
@@ -66,6 +67,21 @@ void SpaceCockpit::draw() {
 	}
 }
 
+bool SpaceCockpit::msgMouseMove(const MouseMoveMessage &msg) {
+	Data::SpaceStarfield &sf = _G(starfield);
+	sf._panX = 0;
+	sf._panY = 0;
+	sf._centerX = (int16)CLIP<int>(msg._pos.x, 21, 299);
+	sf._centerY = (int16)CLIP<int>(msg._pos.y, 21, 139);
+	redraw();
+	return true;
+}
+
+bool SpaceCockpit::msgMouseDown(const MouseDownMessage &msg) {
+	_G(logic)->action(KEYBIND_FIRE);
+	return true;
+}
+
 void SpaceCockpit::drawCockpitFrame(Shared::Gfx::GfxSurface &s) {
 	// The ~7px surround around the viewport
 	s.fillRect(Rect(8, 8, 312, 16), FRAME_COLOR);
diff --git a/engines/ultima/ultima1/views/space_cockpit.h b/engines/ultima/ultima1/views/space_cockpit.h
index 6da84a5a391..c35de72c2c6 100644
--- a/engines/ultima/ultima1/views/space_cockpit.h
+++ b/engines/ultima/ultima1/views/space_cockpit.h
@@ -52,6 +52,15 @@ public:
 	bool msgFocus(const FocusMessage &msg) override;
 	bool msgUnfocus(const UnfocusMessage &msg) override;
 	void draw() override;
+
+	/**
+	 * Secret mouse-aiming shortcut (not part of the original): moving the
+	 * mouse stops any keyboard-driven panning and snaps the crosshair
+	 * straight to the pointer, and clicking fires - a much easier way to
+	 * line up on enemy ships
+	 */
+	bool msgMouseMove(const MouseMoveMessage &msg) override;
+	bool msgMouseDown(const MouseDownMessage &msg) override;
 };
 
 } // namespace Views


Commit: 518f9d6cb0caa9101bb260f3edb598ce3d6e2bea
    https://github.com/scummvm/scummvm/commit/518f9d6cb0caa9101bb260f3edb598ce3d6e2bea
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:40:53+11:00

Commit Message:
ULTIMA: ULTIMA1: Fix showing space stats for space map

Changed paths:
    engines/ultima/shared/engine/events.cpp


diff --git a/engines/ultima/shared/engine/events.cpp b/engines/ultima/shared/engine/events.cpp
index c2e7d27e71a..4c18c27c5e0 100644
--- a/engines/ultima/shared/engine/events.cpp
+++ b/engines/ultima/shared/engine/events.cpp
@@ -127,7 +127,7 @@ void Events::replaceView(UIElement *ui, bool replaceAllViews) {
 }
 
 void Events::replaceView(const Common::String &name, bool replaceAllViews) {
-	replaceView(findView(name));
+	replaceView(findView(name), replaceAllViews);
 }
 
 void Events::addView(UIElement *ui) {


Commit: 304b02ee4c34dd06209d33ab79034ebe4d8835a3
    https://github.com/scummvm/scummvm/commit/304b02ee4c34dd06209d33ab79034ebe4d8835a3
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:40:53+11:00

Commit Message:
ULTIMA: ULTIMA1: Space hyperjump, console commands

Changed paths:
    engines/ultima/ultima1/console.cpp
    engines/ultima/ultima1/console.h
    engines/ultima/ultima1/data/space_map.cpp
    engines/ultima/ultima1/data/space_map.h
    engines/ultima/ultima1/logic/logic.cpp
    engines/ultima/ultima1/logic/logic.h
    engines/ultima/ultima1/logic/space_cockpit_logic.cpp
    engines/ultima/ultima1/logic/space_cockpit_logic.h
    engines/ultima/ultima1/logic/space_map_logic.cpp
    engines/ultima/ultima1/logic/space_map_logic.h
    engines/ultima/ultima1/views/space_cockpit.cpp
    engines/ultima/ultima1/views/space_cockpit.h


diff --git a/engines/ultima/ultima1/console.cpp b/engines/ultima/ultima1/console.cpp
index 35c3f64d097..c9b42c4b92b 100644
--- a/engines/ultima/ultima1/console.cpp
+++ b/engines/ultima/ultima1/console.cpp
@@ -20,6 +20,7 @@
  */
 
 #include "ultima/ultima1/console.h"
+#include "ultima/ultima1/data/space_map.h"
 #include "ultima/ultima1/ultima1.h"
 #include "ultima/ultima1/views/dialog.h"
 
@@ -29,6 +30,10 @@ namespace Ultima1 {
 Console::Console() : GUI::Debugger() {
 	registerCmd("view", WRAP_METHOD(Console, cmdView));
 	registerCmd("map", WRAP_METHOD(Console, cmdMap));
+	registerCmd("hits", WRAP_METHOD(Console, cmdHits));
+	registerCmd("food", WRAP_METHOD(Console, cmdFood));
+	registerCmd("coins", WRAP_METHOD(Console, cmdCoins));
+	registerCmd("fuel", WRAP_METHOD(Console, cmdFuel));
 }
 
 Console::~Console() {
@@ -83,5 +88,39 @@ bool Console::cmdMap(int argc, const char **argv) {
 	}
 }
 
+bool Console::cmdHits(int argc, const char **argv) {
+	_G(savegame)._hits = (argc == 2) ? atoi(argv[1]) : 9999;
+	g_engine->baseView()->findView("Stats")->draw();
+	return false;
+}
+
+bool Console::cmdFood(int argc, const char **argv) {
+	_G(savegame)._food = (argc == 2) ? atoi(argv[1]) : 9999;
+	g_engine->baseView()->findView("Stats")->draw();
+	return false;
+}
+
+bool Console::cmdCoins(int argc, const char **argv) {
+	_G(savegame)._coins = (argc == 2) ? atoi(argv[1]) : 9999;
+	g_engine->baseView()->findView("Stats")->draw();
+	return false;
+}
+
+bool Console::cmdFuel(int argc, const char **argv) {
+	if (_G(map)._mapType == Data::MAPTYPE_SPACE) {
+		Data::SpaceMapShip &ship = _G(savegame)._starmap
+			._sectors[_G(savegame)._sectorX][_G(savegame)._sectorY]
+			._ships[_G(savegame)._shipIndex];
+		ship._fuel = 9999;
+		ship._shield = 9999;
+	}
+
+	_G(savegame)._shipFuel = 9999;
+	_G(savegame)._shipShield = 9999;
+
+	g_engine->baseView()->findView("Stats")->draw();
+	return false;
+}
+
 } // namespace Ultima1
 } // namespace Ultima
diff --git a/engines/ultima/ultima1/console.h b/engines/ultima/ultima1/console.h
index ffb8803f9e9..af9354eb33c 100644
--- a/engines/ultima/ultima1/console.h
+++ b/engines/ultima/ultima1/console.h
@@ -32,6 +32,11 @@ class Console : public GUI::Debugger {
 private:
 	bool cmdView(int argc, const char **argv);
 	bool cmdMap(int argc, const char **argv);
+	bool cmdHits(int argc, const char **argv);
+	bool cmdFood(int argc, const char **argv);
+	bool cmdCoins(int argc, const char **argv);
+	bool cmdFuel(int argc, const char **argv);
+
 public:
 	Console();
 	~Console() override;
diff --git a/engines/ultima/ultima1/data/space_map.cpp b/engines/ultima/ultima1/data/space_map.cpp
index fed144d55f3..aa48f774d10 100644
--- a/engines/ultima/ultima1/data/space_map.cpp
+++ b/engines/ultima/ultima1/data/space_map.cpp
@@ -29,6 +29,9 @@ namespace Data {
 
 const char *SPACE_COCKPIT_DIRECTION_NAMES[5] = { nullptr, "Left", "Right", "Climb", "Dive" };
 
+const int16 SPACE_FACING_DX[4] = { -1, 1, 0, 0 };
+const int16 SPACE_FACING_DY[4] = { 0, 0, -1, 1 };
+
 // Edge order: 0=left, 1=right, 2=top, 3=bottom. ShipType order: Shuttle,
 // LargeFighter, SmallFighter
 const int16 SPACE_DOCK_DELTA_X[SPACE_DOCK_EDGE_COUNT][3] = {
diff --git a/engines/ultima/ultima1/data/space_map.h b/engines/ultima/ultima1/data/space_map.h
index 6b959cd9d15..59bade92873 100644
--- a/engines/ultima/ultima1/data/space_map.h
+++ b/engines/ultima/ultima1/data/space_map.h
@@ -79,6 +79,10 @@ enum SpaceShipFacing {
 	FACING_DOWN = 3
 };
 
+// Unit vector for a given facing, indexed by SpaceShipFacing
+extern const int16 SPACE_FACING_DX[4];
+extern const int16 SPACE_FACING_DY[4];
+
 // The 4 station/encounter docking edges (EDGE_NAMES), and the [edge][shipType]
 // offsets from a sector's anchor for a ship of that type parked at that edge
 // (checkOverlapX/Y's own DELTA_X/DELTA_Y tables)
diff --git a/engines/ultima/ultima1/logic/logic.cpp b/engines/ultima/ultima1/logic/logic.cpp
index c468f6123d0..f91a25eb130 100644
--- a/engines/ultima/ultima1/logic/logic.cpp
+++ b/engines/ultima/ultima1/logic/logic.cpp
@@ -46,6 +46,10 @@ void Logic::writeString(const char *format, ...) {
 	writeString(msg);
 }
 
+void Logic::resetLine() {
+	g_engine->baseView()->findView("Commands")->send(GameMessage("RESET_LINE"));
+}
+
 void Logic::prompt() {
 	g_engine->baseView()->findView("Commands")->send(GameMessage("PROMPT"));
 }
diff --git a/engines/ultima/ultima1/logic/logic.h b/engines/ultima/ultima1/logic/logic.h
index 200993cb322..6b3667e7751 100644
--- a/engines/ultima/ultima1/logic/logic.h
+++ b/engines/ultima/ultima1/logic/logic.h
@@ -54,6 +54,12 @@ protected:
 	void writeString(const Common::String &msg);
 	void writeString(const char *format, ...);
 
+	/**
+	 * Clears the current line of the Commands window, ready for it to be
+	 * overwritten
+	 */
+	void resetLine();
+
 	/**
 	 * Triggers a prompt display in the Commands window
 	 */
diff --git a/engines/ultima/ultima1/logic/space_cockpit_logic.cpp b/engines/ultima/ultima1/logic/space_cockpit_logic.cpp
index 0d96dbbd296..2ac3792fe9f 100644
--- a/engines/ultima/ultima1/logic/space_cockpit_logic.cpp
+++ b/engines/ultima/ultima1/logic/space_cockpit_logic.cpp
@@ -23,6 +23,7 @@
 #include "ultima/ultima1/logic/space_cockpit_logic.h"
 #include "ultima/ultima1/logic/space_map_logic.h"
 #include "ultima/ultima1/data/space_map.h"
+#include "ultima/ultima1/views/space_cockpit.h"
 #include "ultima/ultima1/ultima1.h"
 
 namespace Ultima {
@@ -118,6 +119,90 @@ bool SpaceCockpitLogic::pass() {
 	return true;
 }
 
+bool SpaceCockpitLogic::hyperjump() {
+	// Left open (no newline) so the animation can append " Lightspeed!" to
+	// the same line once it hits full scrolling speed
+	writeString("HyperJump...");
+
+	if (shipFuel() < 100) {
+		writeString("Not enough fuel!\n");
+		return true;
+	}
+
+	// Heads one sector over in whichever direction the ship is currently
+	// facing on the overhead map - the original derives this from which
+	// edge of the sector the ship exited, but facing is the equivalent
+	// concept here, and doesn't require the ship to actually be moving
+	Data::SpaceMapShip &ship = _G(savegame)._starmap
+		._sectors[_G(savegame)._sectorX][_G(savegame)._sectorY]
+		._ships[_G(savegame)._shipIndex];
+	int dx = Data::SPACE_FACING_DX[ship._facing];
+	int dy = Data::SPACE_FACING_DY[ship._facing];
+
+	Views::SpaceCockpit *view = dynamic_cast<Views::SpaceCockpit *>(g_engine->findView("SpaceCockpit"));
+	assert(view);
+	view->startHyperjump(dx, dy);
+
+	// The animation owns the commands area until it finishes or is
+	// interrupted - suppress the usual immediate end-of-turn/prompt
+	return false;
+}
+
+void SpaceCockpitLogic::hyperjumpLightspeed() {
+	writeString(" Lightspeed!");
+}
+
+void SpaceCockpitLogic::completeHyperjump(int dx, int dy) {
+	subtractFuel(100);
+
+	int newSectorX = (_G(savegame)._sectorX + dx + Data::SPACE_SECTOR_COUNT) % Data::SPACE_SECTOR_COUNT;
+	int newSectorY = (_G(savegame)._sectorY + dy + Data::SPACE_SECTOR_COUNT) % Data::SPACE_SECTOR_COUNT;
+
+	Data::SpaceMapCell &oldCell = _G(savegame)._starmap._sectors[_G(savegame)._sectorX][_G(savegame)._sectorY];
+	Data::SpaceMapCell &newCell = _G(savegame)._starmap._sectors[newSectorX][newSectorY];
+
+	// Find a free ship slot in the destination sector to arrive in
+	int freeSlot = -1;
+	for (int i = 0; i < Data::SPACE_SHIPS_PER_SECTOR; ++i) {
+		if (newCell._ships[i]._shipType == Data::SHIP_NONE) {
+			freeSlot = i;
+			break;
+		}
+	}
+
+	resetLine();
+	if (freeSlot == -1) {
+		writeString("No room to arrive in that sector!\n");
+	} else {
+		// Move the player's ship record into the new sector's slot, vacating
+		// the old one, and reposition to the same fixed point space entry uses
+		Data::SpaceMapShip ship = oldCell._ships[_G(savegame)._shipIndex];
+		oldCell._ships[_G(savegame)._shipIndex] = Data::SpaceMapShip();
+
+		ship._x = 260;
+		ship._y = 90;
+		ship._facing = Data::FACING_LEFT;
+		newCell._ships[freeSlot] = ship;
+
+		_G(savegame)._sectorX = (int16)newSectorX;
+		_G(savegame)._sectorY = (int16)newSectorY;
+		_G(savegame)._shipIndex = (int16)freeSlot;
+
+		writeString("\x10HyperJump completed.\n");
+	}
+
+	redrawMap();
+	redrawStats();
+	prompt();
+}
+
+void SpaceCockpitLogic::abortHyperjump() {
+	resetLine();
+	writeString("Hyperjump aborted!\n");
+	redrawMap();
+	prompt();
+}
+
 bool SpaceCockpitLogic::view() {
 	writeString("View\n");
 	_G(logic) = Common::SharedPtr<Logic>(new SpaceMapLogic());
diff --git a/engines/ultima/ultima1/logic/space_cockpit_logic.h b/engines/ultima/ultima1/logic/space_cockpit_logic.h
index 6e923e6f89b..f121bab15c7 100644
--- a/engines/ultima/ultima1/logic/space_cockpit_logic.h
+++ b/engines/ultima/ultima1/logic/space_cockpit_logic.h
@@ -52,6 +52,14 @@ protected:
 	bool pass() override;
 	bool view() override;
 
+	/**
+	 * Validates fuel/heading and, if both are fine, hands off to the
+	 * SpaceCockpit view's animated hyperjump sequence (hyperjump) - the
+	 * actual sector change happens later, in completeHyperjump(), once that
+	 * animation finishes
+	 */
+	bool hyperjump() override;
+
 public:
 	SpaceCockpitLogic() : SpaceLogic() {}
 	~SpaceCockpitLogic() override {
@@ -64,6 +72,28 @@ public:
 	 * cockpitPerFrame)
 	 */
 	void tick() override;
+
+	/**
+	 * Called by the SpaceCockpit view once its hyperjump animation ramps up
+	 * to full scrolling speed, to append " Lightspeed!" to the still-open
+	 * "HyperJump..." line
+	 */
+	void hyperjumpLightspeed();
+
+	/**
+	 * Called by the SpaceCockpit view once its hyperjump animation
+	 * completes - charges the fuel and actually moves the player's ship
+	 * into a free slot in the sector one over in the given direction
+	 * (dx/dy each -1/0/1), matching changeSector's own bookkeeping
+	 */
+	void completeHyperjump(int dx, int dy);
+
+	/**
+	 * Called by the SpaceCockpit view when a keypress/action interrupts an
+	 * in-progress hyperjump animation - no fuel was spent yet, so this just
+	 * reports it and lets the player carry on
+	 */
+	void abortHyperjump();
 };
 
 } // namespace Logic
diff --git a/engines/ultima/ultima1/logic/space_map_logic.cpp b/engines/ultima/ultima1/logic/space_map_logic.cpp
index c2fde4e2890..4c2318e7d9e 100644
--- a/engines/ultima/ultima1/logic/space_map_logic.cpp
+++ b/engines/ultima/ultima1/logic/space_map_logic.cpp
@@ -44,13 +44,6 @@ constexpr Data::SpaceShipFacing ROTATE_CW[4] = {
 	Data::FACING_UP, Data::FACING_DOWN, Data::FACING_RIGHT, Data::FACING_LEFT
 };
 
-// Thrust (Up) is a unit nudge along whichever way the ship is currently
-// facing, not a fixed screen axis - so facing Left and thrusting builds up
-// leftward drift, and reversing facing then thrusting decelerates/reverses
-// whatever drift is already there rather than adding a second, unrelated one
-constexpr int FACING_DX[4] = { -1, 1, 0, 0 };
-constexpr int FACING_DY[4] = { 0, 0, -1, 1 };
-
 static int wrapCoord(int value, int minVal, int maxVal, int wrapSize) {
 	if (value < minVal)
 		return value + wrapSize;
@@ -107,8 +100,8 @@ bool SpaceMapLogic::move(Data::Direction dir) {
 		_G(shipExhaustCountdown) = 0;
 		break;
 	case Data::DIR_UP:
-		_G(sectorDriftX) = CLIP(_G(sectorDriftX) + FACING_DX[ship._facing], -MAX_DRIFT, MAX_DRIFT);
-		_G(sectorDriftY) = CLIP(_G(sectorDriftY) + FACING_DY[ship._facing], -MAX_DRIFT, MAX_DRIFT);
+		_G(sectorDriftX) = CLIP(_G(sectorDriftX) + Data::SPACE_FACING_DX[ship._facing], -MAX_DRIFT, MAX_DRIFT);
+		_G(sectorDriftY) = CLIP(_G(sectorDriftY) + Data::SPACE_FACING_DY[ship._facing], -MAX_DRIFT, MAX_DRIFT);
 		_G(shipExhaustCountdown) += 10;
 		break;
 	case Data::DIR_DOWN:
@@ -118,8 +111,8 @@ bool SpaceMapLogic::move(Data::Direction dir) {
 		// increment (mirrors Up, just subtracted instead of added). It does
 		// immediately clear any exhaust trail still showing from a
 		// previous Up, rather than extending it further
-		_G(sectorDriftX) = CLIP(_G(sectorDriftX) - FACING_DX[ship._facing], -MAX_DRIFT, MAX_DRIFT);
-		_G(sectorDriftY) = CLIP(_G(sectorDriftY) - FACING_DY[ship._facing], -MAX_DRIFT, MAX_DRIFT);
+		_G(sectorDriftX) = CLIP(_G(sectorDriftX) - Data::SPACE_FACING_DX[ship._facing], -MAX_DRIFT, MAX_DRIFT);
+		_G(sectorDriftY) = CLIP(_G(sectorDriftY) - Data::SPACE_FACING_DY[ship._facing], -MAX_DRIFT, MAX_DRIFT);
 		_G(shipExhaustCountdown) = 0;
 		break;
 	default:
@@ -161,6 +154,13 @@ bool SpaceMapLogic::attack(Data::Direction dir) {
 	return false;
 }
 
+bool SpaceMapLogic::hyperjump() {
+	writeString("HyperJump?\n");
+	writeString("Hyperjump can only be made\n");
+	writeString("from front view.\n");
+	return true;
+}
+
 void SpaceMapLogic::tick() {
 	if (_G(sectorDriftX) == 0 && _G(sectorDriftY) == 0 && _G(shipExhaustCountdown) == 0)
 		return;
diff --git a/engines/ultima/ultima1/logic/space_map_logic.h b/engines/ultima/ultima1/logic/space_map_logic.h
index 72f90e6da7c..6fca332a221 100644
--- a/engines/ultima/ultima1/logic/space_map_logic.h
+++ b/engines/ultima/ultima1/logic/space_map_logic.h
@@ -51,6 +51,11 @@ protected:
 	 */
 	bool attack(Data::Direction dir) override;
 
+	/**
+	 * Hyperjump can only be done from the cockpit view (hyperjump)
+	 */
+	bool hyperjump() override;
+
 public:
 	SpaceMapLogic() : SpaceLogic() {}
 	~SpaceMapLogic() override {
diff --git a/engines/ultima/ultima1/views/space_cockpit.cpp b/engines/ultima/ultima1/views/space_cockpit.cpp
index 0640e94988c..ac0b135f6c1 100644
--- a/engines/ultima/ultima1/views/space_cockpit.cpp
+++ b/engines/ultima/ultima1/views/space_cockpit.cpp
@@ -12,16 +12,17 @@
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
+ * GNU General Public License for more detailsvvvvv.
  *
  * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ * along with this program.  If not, see <htvvvtp://www.gnu.org/licenses/>.
  *
  */
 
 #include "common/util.h"
 #include "ultima/ultima1/views/space_cockpit.h"
 #include "ultima/ultima1/data/space_map.h"
+#include "ultima/ultima1/logic/space_cockpit_logic.h"
 #include "ultima/ultima1/ultima1.h"
 #include "ultima/ultima1/metaengine.h"
 
@@ -82,6 +83,104 @@ bool SpaceCockpit::msgMouseDown(const MouseDownMessage &msg) {
 	return true;
 }
 
+// Ticks per +/-1 step while ramping the display speed up/down
+constexpr int HYPERJUMP_SPEED_STEP_TICKS = 2;
+// How long (in ticks) to hold at full warp, streaking the starfield
+constexpr int HYPERJUMP_WARP_TICKS = 30;
+// Extra starfield advances per tick while at full warp, on top of the
+// normal per-frame one - this is the "speeded up" part of the animation
+constexpr int HYPERJUMP_WARP_ADVANCES = 5;
+
+void SpaceCockpit::startHyperjump(int dx, int dy) {
+	_hyperjumpState = HYPERJUMP_RAMP_UP;
+	_hyperjumpTicks = 0;
+	_hyperjumpDX = dx;
+	_hyperjumpDY = dy;
+	_hyperjumpOrigSpeed = _G(cockpitSpeed);
+
+	// Stop any manual steering - the animation takes over the view
+	_G(starfield)._panX = 0;
+	_G(starfield)._panY = 0;
+}
+
+void SpaceCockpit::tickHyperjump() {
+	++_hyperjumpTicks;
+
+	switch (_hyperjumpState) {
+	case HYPERJUMP_RAMP_UP:
+		if (_hyperjumpTicks % HYPERJUMP_SPEED_STEP_TICKS == 0 && _G(cockpitSpeed) < 8)
+			++_G(cockpitSpeed);
+		if (_G(cockpitSpeed) >= 8) {
+			_hyperjumpState = HYPERJUMP_WARP;
+			_hyperjumpTicks = 0;
+
+			auto *logic = dynamic_cast<Logic::SpaceCockpitLogic *>(_G(logic).get());
+			if (logic)
+				logic->hyperjumpLightspeed();
+		}
+		break;
+
+	case HYPERJUMP_WARP:
+		for (int i = 0; i < HYPERJUMP_WARP_ADVANCES; ++i)
+			_G(starfield).advance();
+		if (_hyperjumpTicks >= HYPERJUMP_WARP_TICKS) {
+			_hyperjumpState = HYPERJUMP_RAMP_DOWN;
+			_hyperjumpTicks = 0;
+		}
+		break;
+
+	case HYPERJUMP_RAMP_DOWN:
+		if (_hyperjumpTicks % HYPERJUMP_SPEED_STEP_TICKS == 0 && _G(cockpitSpeed) > _hyperjumpOrigSpeed)
+			--_G(cockpitSpeed);
+		if (_G(cockpitSpeed) <= _hyperjumpOrigSpeed) {
+			_hyperjumpState = HYPERJUMP_IDLE;
+			auto *logic = dynamic_cast<Logic::SpaceCockpitLogic *>(_G(logic).get());
+			if (logic)
+				logic->completeHyperjump(_hyperjumpDX, _hyperjumpDY);
+		}
+		break;
+
+	default:
+		break;
+	}
+
+	redraw();
+}
+
+bool SpaceCockpit::tick() {
+	if (_hyperjumpState != HYPERJUMP_IDLE)
+		tickHyperjump();
+
+	return Map::tick();
+}
+
+static void abortHyperjumpAndNotify(int origSpeed) {
+	_G(cockpitSpeed) = origSpeed;
+	auto *logic = dynamic_cast<Logic::SpaceCockpitLogic *>(_G(logic).get());
+	if (logic)
+		logic->abortHyperjump();
+}
+
+bool SpaceCockpit::msgAction(const ActionMessage &msg) {
+	if (_hyperjumpState != HYPERJUMP_IDLE) {
+		_hyperjumpState = HYPERJUMP_IDLE;
+		abortHyperjumpAndNotify(_hyperjumpOrigSpeed);
+		return true;
+	}
+
+	return Map::msgAction(msg);
+}
+
+bool SpaceCockpit::msgKeypress(const KeypressMessage &msg) {
+	if (_hyperjumpState != HYPERJUMP_IDLE) {
+		_hyperjumpState = HYPERJUMP_IDLE;
+		abortHyperjumpAndNotify(_hyperjumpOrigSpeed);
+		return true;
+	}
+
+	return Map::msgKeypress(msg);
+}
+
 void SpaceCockpit::drawCockpitFrame(Shared::Gfx::GfxSurface &s) {
 	// The ~7px surround around the viewport
 	s.fillRect(Rect(8, 8, 312, 16), FRAME_COLOR);
diff --git a/engines/ultima/ultima1/views/space_cockpit.h b/engines/ultima/ultima1/views/space_cockpit.h
index c35de72c2c6..ceb6c59080f 100644
--- a/engines/ultima/ultima1/views/space_cockpit.h
+++ b/engines/ultima/ultima1/views/space_cockpit.h
@@ -40,11 +40,31 @@ using namespace Shared::Messages;
  */
 class SpaceCockpit : public Map {
 private:
+	enum HyperjumpState {
+		HYPERJUMP_IDLE,
+		HYPERJUMP_RAMP_UP,
+		HYPERJUMP_WARP,
+		HYPERJUMP_RAMP_DOWN
+	};
+
+	HyperjumpState _hyperjumpState = HYPERJUMP_IDLE;
+	int _hyperjumpTicks = 0;
+	int _hyperjumpDX = 0, _hyperjumpDY = 0;
+	int _hyperjumpOrigSpeed = 0;
+
 	/**
 	 * Draws the static cockpit frame around the viewport (drawCockpitFrame)
 	 */
 	void drawCockpitFrame(Shared::Gfx::GfxSurface &s);
 
+	/**
+	 * Advances whichever phase of the hyperjump animation is running -
+	 * ramping the display speed up to 8, streaking the starfield hard for
+	 * a bit, then ramping back down to the original speed and handing off
+	 * to SpaceCockpitLogic::completeHyperjump()
+	 */
+	void tickHyperjump();
+
 public:
 	SpaceCockpit() : Map("SpaceCockpit") {}
 	~SpaceCockpit() override {}
@@ -52,6 +72,14 @@ public:
 	bool msgFocus(const FocusMessage &msg) override;
 	bool msgUnfocus(const UnfocusMessage &msg) override;
 	void draw() override;
+	bool tick() override;
+
+	/**
+	 * Any action/keypress while a hyperjump is in progress aborts it
+	 * instead of being handled normally
+	 */
+	bool msgAction(const ActionMessage &msg) override;
+	bool msgKeypress(const KeypressMessage &msg) override;
 
 	/**
 	 * Secret mouse-aiming shortcut (not part of the original): moving the
@@ -61,6 +89,13 @@ public:
 	 */
 	bool msgMouseMove(const MouseMoveMessage &msg) override;
 	bool msgMouseDown(const MouseDownMessage &msg) override;
+
+	/**
+	 * Kicks off the animated hyperjump sequence heading towards the sector
+	 * at the given offset (dx/dy each -1/0/1) - called by
+	 * SpaceCockpitLogic::hyperjump() once fuel/heading are validated
+	 */
+	void startHyperjump(int dx, int dy);
 };
 
 } // namespace Views


Commit: 699bba4ad4d9f7ec7253082f7c60877cdb2a7029
    https://github.com/scummvm/scummvm/commit/699bba4ad4d9f7ec7253082f7c60877cdb2a7029
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:40:53+11:00

Commit Message:
ULTIMA: ULTIMA1: Enemy ship generation

Changed paths:
    engines/ultima/ultima1/data/space_map.cpp
    engines/ultima/ultima1/data/space_map.h
    engines/ultima/ultima1/logic/space_cockpit_logic.cpp
    engines/ultima/ultima1/logic/space_cockpit_logic.h
    engines/ultima/ultima1/logic/space_map_logic.cpp
    engines/ultima/ultima1/ultima1.h
    engines/ultima/ultima1/views/space_cockpit.cpp
    engines/ultima/ultima1/views/space_cockpit.h


diff --git a/engines/ultima/ultima1/data/space_map.cpp b/engines/ultima/ultima1/data/space_map.cpp
index aa48f774d10..b150d6e3813 100644
--- a/engines/ultima/ultima1/data/space_map.cpp
+++ b/engines/ultima/ultima1/data/space_map.cpp
@@ -51,6 +51,13 @@ const SpaceShipFacing SPACE_DOCK_EDGE_FACING[SPACE_DOCK_EDGE_COUNT] = {
 };
 const char *SPACE_DOCK_EDGE_NAMES[SPACE_DOCK_EDGE_COUNT] = { "left", "right", "top", "bottom" };
 
+// Recovered from the data segment (dseg+0x212/+0x1F6 and +0x220/+0x204
+// respectively)
+const int16 SPACE_TARGET_HIT_MIN_X[SPACE_TARGET_STAGE_COUNT] = { 1, 1, 1, 1, 0, 0, 0 };
+const int16 SPACE_TARGET_HIT_MAX_X[SPACE_TARGET_STAGE_COUNT] = { 5, 6, 8, 10, 12, 16, 18 };
+const int16 SPACE_TARGET_HIT_MIN_Y[SPACE_TARGET_STAGE_COUNT] = { 5, 5, 4, 4, 3, 2, 1 };
+const int16 SPACE_TARGET_HIT_MAX_Y[SPACE_TARGET_STAGE_COUNT] = { 4, 6, 8, 10, 12, 14, 18 };
+
 int SpaceMapCell::dockedEdge(int shipIndex) const {
 	const SpaceMapShip &ship = _ships[shipIndex];
 	if (ship._shipType == SHIP_NONE)
diff --git a/engines/ultima/ultima1/data/space_map.h b/engines/ultima/ultima1/data/space_map.h
index 59bade92873..946f6115c76 100644
--- a/engines/ultima/ultima1/data/space_map.h
+++ b/engines/ultima/ultima1/data/space_map.h
@@ -97,6 +97,20 @@ extern const SpaceShipFacing SPACE_DOCK_EDGE_FACING[SPACE_DOCK_EDGE_COUNT];
 // Edge names used in docking prompts/messages (EDGE_NAMES)
 extern const char *SPACE_DOCK_EDGE_NAMES[SPACE_DOCK_EDGE_COUNT];
 
+// Number of stages a cockpit-view combat encounter's target progresses
+// through as it closes in (targetApproachStage, 0..6)
+constexpr int SPACE_TARGET_STAGE_COUNT = 7;
+
+// Per-stage hit-test window for the Fire command (handleFireCommand): a
+// shot only registers as a hit if (viewCenterX - targetX) falls between
+// SPACE_TARGET_HIT_MIN_X[stage] and SPACE_TARGET_HIT_MAX_X[stage], and
+// likewise for Y - the window widens on X and tightens toward zero on Y
+// as the target closes in
+extern const int16 SPACE_TARGET_HIT_MIN_X[SPACE_TARGET_STAGE_COUNT];
+extern const int16 SPACE_TARGET_HIT_MAX_X[SPACE_TARGET_STAGE_COUNT];
+extern const int16 SPACE_TARGET_HIT_MIN_Y[SPACE_TARGET_STAGE_COUNT];
+extern const int16 SPACE_TARGET_HIT_MAX_Y[SPACE_TARGET_STAGE_COUNT];
+
 /**
  * Max fuel/shield for a ship type (getShipFuelCapacity/getShipShieldCapacity)
  */
diff --git a/engines/ultima/ultima1/logic/space_cockpit_logic.cpp b/engines/ultima/ultima1/logic/space_cockpit_logic.cpp
index 2ac3792fe9f..12f911eec9a 100644
--- a/engines/ultima/ultima1/logic/space_cockpit_logic.cpp
+++ b/engines/ultima/ultima1/logic/space_cockpit_logic.cpp
@@ -30,6 +30,23 @@ namespace Ultima {
 namespace Ultima1 {
 namespace Logic {
 
+// The Fire command's fuel cost (handleFireCommand)
+constexpr int FIRE_FUEL_COST = 10;
+
+constexpr int FIRE_HIT_XP = 100;
+constexpr int SPACE_ACE_KILLS = 20;
+
+// The viewport window an encounter target must stay inside; drifting past
+// this (cockpitPerFrame) counts as passing by unengaged
+constexpr int TARGET_MIN_X = 30, TARGET_MAX_X = 280;
+constexpr int TARGET_MIN_Y = 24, TARGET_MAX_Y = 125;
+
+// How many frames an encounter waits between rolls to advance its approach
+// stage, and the roll range/threshold - both scale with cockpit speed
+// (cockpitPerFrame)
+constexpr int TARGET_APPROACH_TIMER_THRESHOLD = 15;
+constexpr int TARGET_APPROACH_ROLL_THRESHOLD = 20;
+
 void SpaceCockpitLogic::setSpeed(int speed) {
 	writeString("Speed %d\n", speed);
 
@@ -61,9 +78,45 @@ void SpaceCockpitLogic::tick() {
 	_tickCounter = 0;
 
 	_G(starfield).advance();
+	tickEncounter();
 	redrawMap();
 }
 
+void SpaceCockpitLogic::tickEncounter() {
+	if (_G(cockpitTargetX) == 0)
+		return;
+
+	Data::SpaceStarfield &sf = _G(starfield);
+	int deltaX = sf._centerX - _G(cockpitTargetX);
+	int deltaY = sf._centerY - _G(cockpitTargetY);
+
+	// The target only holds its screen position while the crosshair is
+	// actively tracking it - otherwise it drifts a further pixel away each
+	// frame, so lining up a shot means keeping the crosshair on it
+	int stepX = (deltaX > 0) - (deltaX < 0);
+	int stepY = (deltaY > 0) - (deltaY < 0);
+	_G(cockpitTargetX) -= stepX;
+	_G(cockpitTargetY) -= stepY;
+
+	if (_G(cockpitTargetX) < TARGET_MIN_X || _G(cockpitTargetX) > TARGET_MAX_X ||
+			_G(cockpitTargetY) < TARGET_MIN_Y || _G(cockpitTargetY) > TARGET_MAX_Y) {
+		// Passed by unengaged
+		setupSectorEnemies();
+		return;
+	}
+
+	if (_G(cockpitApproachTimer) <= TARGET_APPROACH_TIMER_THRESHOLD) {
+		++_G(cockpitApproachTimer);
+		return;
+	}
+
+	_G(cockpitApproachTimer) = 0;
+	if (getRandomNumber(1, (_G(cockpitSpeed) + 3) * 10) > TARGET_APPROACH_ROLL_THRESHOLD) {
+		if (++_G(cockpitTargetStage) >= Data::SPACE_TARGET_STAGE_COUNT)
+			setupSectorEnemies();
+	}
+}
+
 bool SpaceCockpitLogic::move(Data::Direction dir) {
 	writeString("%s\n", Data::SPACE_COCKPIT_DIRECTION_NAMES[dir]);
 
@@ -101,14 +154,51 @@ bool SpaceCockpitLogic::move(Data::Direction dir) {
 }
 
 bool SpaceCockpitLogic::fire() {
-	// TODO: handleFireCommand - the actual enemy-ship combat
 	writeString("Fire!\n");
-	playFX(1);
+
+	if (shipFuel() < FIRE_FUEL_COST) {
+		writeString("Thou hast not enough fuel!\n");
+		return true;
+	}
+	subtractFuel(FIRE_FUEL_COST);
+
+	// Flash a laser bolt in from each side of the viewport, converging on
+	// the crosshair
+	Views::SpaceCockpit *view = dynamic_cast<Views::SpaceCockpit *>(g_engine->findView("SpaceCockpit"));
+	assert(view);
+	view->fireLaser();
+	playFX(8);
+
+	int stage = _G(cockpitTargetStage);
+	int deltaX = _G(starfield)._centerX - _G(cockpitTargetX);
+	int deltaY = _G(starfield)._centerY - _G(cockpitTargetY);
+	bool hit = _G(cockpitTargetX) != 0 &&
+		deltaX >= Data::SPACE_TARGET_HIT_MIN_X[stage] && deltaX <= Data::SPACE_TARGET_HIT_MAX_X[stage] &&
+		deltaY >= Data::SPACE_TARGET_HIT_MIN_Y[stage] && deltaY <= Data::SPACE_TARGET_HIT_MAX_Y[stage];
+
+	if (hit) {
+		playFX(2);
+		writeString("Hit!!!\n");
+		_G(savegame)._experience += FIRE_HIT_XP;
+		++_G(savegame)._enemyVessels;
+
+		if (_G(savegame)._enemyVessels == SPACE_ACE_KILLS)
+			writeString("Thou hast achieved the rank of Space Ace!\n");
+		else if (_G(savegame)._enemyVessels > SPACE_ACE_KILLS)
+			writeString("Thou art still a Space Ace!\n");
+
+		Data::SpaceMapCell &cell = _G(savegame)._starmap
+			._sectors[_G(savegame)._sectorX][_G(savegame)._sectorY];
+		--cell._enemyCount;
+		setupSectorEnemies();
+		redrawStats();
+	}
+
 	return true;
 }
 
 bool SpaceCockpitLogic::pass() {
-	// Re-centres the starscape and stops any drift
+	// Re-centers the starscape and stops any drift
 	writeString("Center\n");
 
 	Data::SpaceStarfield &sf = _G(starfield);
@@ -148,6 +238,20 @@ bool SpaceCockpitLogic::hyperjump() {
 	return false;
 }
 
+void SpaceCockpitLogic::setupSectorEnemies() {
+	Data::SpaceMapCell &cell = _G(savegame)._starmap
+		._sectors[_G(savegame)._sectorX][_G(savegame)._sectorY];
+
+	if (cell._enemyCount > 0) {
+		_G(cockpitTargetX) = getRandomNumber(40, 280);
+		_G(cockpitTargetY) = getRandomNumber(40, 120);
+		_G(cockpitTargetStage) = 0;
+	} else {
+		_G(cockpitTargetX) = 0;
+		_G(cockpitTargetY) = 0;
+	}
+}
+
 void SpaceCockpitLogic::hyperjumpLightspeed() {
 	writeString(" Lightspeed!");
 }
@@ -187,6 +291,7 @@ void SpaceCockpitLogic::completeHyperjump(int dx, int dy) {
 		_G(savegame)._sectorX = (int16)newSectorX;
 		_G(savegame)._sectorY = (int16)newSectorY;
 		_G(savegame)._shipIndex = (int16)freeSlot;
+		setupSectorEnemies();
 
 		writeString("\x10HyperJump completed.\n");
 	}
@@ -205,6 +310,10 @@ void SpaceCockpitLogic::abortHyperjump() {
 
 bool SpaceCockpitLogic::view() {
 	writeString("View\n");
+
+	// TODO: the original refuses this switch back to the overhead view
+	// while any enemies remain in the sector ("Thou must eliminate all
+	// enemy craft first!")
 	_G(logic) = Common::SharedPtr<Logic>(new SpaceMapLogic());
 	g_engine->replaceView("SpaceMap");
 	return true;
diff --git a/engines/ultima/ultima1/logic/space_cockpit_logic.h b/engines/ultima/ultima1/logic/space_cockpit_logic.h
index f121bab15c7..13bd5ad22b0 100644
--- a/engines/ultima/ultima1/logic/space_cockpit_logic.h
+++ b/engines/ultima/ultima1/logic/space_cockpit_logic.h
@@ -46,8 +46,26 @@ private:
 	 */
 	void setSpeed(int speed);
 
+	/**
+	 * Per-frame update for the current encounter, if any (the target half
+	 * of cockpitPerFrame): the target drifts a pixel further from the
+	 * crosshair each frame unless the crosshair keeps tracking it, being
+	 * dropped (setupSectorEnemies picks the next one) if it drifts out of
+	 * the viewport; otherwise, on a speed-weighted random timer, advances
+	 * how close it's approached (targetApproachStage), which widens the
+	 * window fire() hit-tests shots against - past the last stage, it's
+	 * also dropped
+	 */
+	void tickEncounter();
+
 protected:
 	bool move(Data::Direction dir) override;
+
+	/**
+	 * The Fire command (handleFireCommand): spends fuel, flashes a laser
+	 * bolt from each side of the viewport to the crosshair, and hit-tests
+	 * it against the current encounter target, if any
+	 */
 	bool fire() override;
 	bool pass() override;
 	bool view() override;
@@ -73,6 +91,15 @@ public:
 	 */
 	void tick() override;
 
+	/**
+	 * Picks a fresh encounter target (a random on-screen position within
+	 * the viewport) if this sector still has enemies remaining, or clears
+	 * the current one if not (setupSectorEnemies). Called on first entering
+	 * the cockpit view for a sector and again after each kill or hyperjump
+	 * arrival
+	 */
+	void setupSectorEnemies();
+
 	/**
 	 * Called by the SpaceCockpit view once its hyperjump animation ramps up
 	 * to full scrolling speed, to append " Lightspeed!" to the still-open
diff --git a/engines/ultima/ultima1/logic/space_map_logic.cpp b/engines/ultima/ultima1/logic/space_map_logic.cpp
index 4c2318e7d9e..ec7c55cfc4c 100644
--- a/engines/ultima/ultima1/logic/space_map_logic.cpp
+++ b/engines/ultima/ultima1/logic/space_map_logic.cpp
@@ -245,11 +245,11 @@ bool SpaceMapLogic::fire() {
 bool SpaceMapLogic::view() {
 	writeString("View\n");
 
-	// TODO: the original refuses the switch while enemies remain in the
-	// sector ("Thou must eliminate all enemy craft first!"), with no fuel,
-	// or while docked; and seeds the cockpit's heading from the current
-	// drift
-	_G(logic) = Common::SharedPtr<Logic>(new SpaceCockpitLogic());
+	// TODO: the original refuses the switch with no fuel or while docked,
+	// and seeds the cockpit's heading from the current drift
+	Common::SharedPtr<SpaceCockpitLogic> cockpitLogic(new SpaceCockpitLogic());
+	cockpitLogic->setupSectorEnemies();
+	_G(logic) = cockpitLogic;
 	g_engine->replaceView("SpaceCockpit");
 	return true;
 }
diff --git a/engines/ultima/ultima1/ultima1.h b/engines/ultima/ultima1/ultima1.h
index 42c70375933..5cb8505349c 100644
--- a/engines/ultima/ultima1/ultima1.h
+++ b/engines/ultima/ultima1/ultima1.h
@@ -83,6 +83,15 @@ public:
 	int _sectorDriftX = 0;
 	int _sectorDriftY = 0;
 	int _shipExhaustCountdown = 0;
+	// The current cockpit-view combat encounter's screen position (0 = no
+	// enemy currently engaged), set up by SpaceCockpitLogic::setupSectorEnemies
+	int _cockpitTargetX = 0;
+	int _cockpitTargetY = 0;
+	// How far the current encounter has "closed in" (targetApproachStage,
+	// 0-6 - indexes the SPACE_TARGET_HIT_* tables), and the frame counter
+	// gating how often it advances (approachTimer)
+	int _cockpitTargetStage = 0;
+	int _cockpitApproachTimer = 0;
 
 public:
 	Ultima1Engine(OSystem *syst, const Ultima::UltimaGameDescription *gameDesc);
diff --git a/engines/ultima/ultima1/views/space_cockpit.cpp b/engines/ultima/ultima1/views/space_cockpit.cpp
index ac0b135f6c1..3de52da45ec 100644
--- a/engines/ultima/ultima1/views/space_cockpit.cpp
+++ b/engines/ultima/ultima1/views/space_cockpit.cpp
@@ -33,6 +33,14 @@ namespace Views {
 constexpr int FRAME_COLOR = 7;		// light grey cockpit surround
 constexpr int STAR_COLOR = 15;		// white stars / crosshair
 constexpr int RIVET_COLOR = 0;		// black detail punched into the frame
+constexpr int LASER_COLOR = 12;	// light red laser-bolt flash
+
+// How many ticks the laser-bolt flash from fireLaser() stays on-screen
+constexpr int LASER_FLASH_TICKS = 3;
+
+// The two fixed points at the bottom corners of the viewport the laser
+// bolts converge in from (handleFireCommand's own (20,140)/(300,140))
+constexpr int LASER_ORIGIN_LEFT_X = 20, LASER_ORIGIN_RIGHT_X = 300, LASER_ORIGIN_Y = 140;
 
 bool SpaceCockpit::msgFocus(const FocusMessage &msg) {
 	MetaEngine::setKeybindingMode(KBMODE_SPACE);
@@ -66,6 +74,13 @@ void SpaceCockpit::draw() {
 		if (Data::SpaceStarfield::withinView(x, y))
 			s.setPixel(x, y, STAR_COLOR);
 	}
+
+	// The brief laser-bolt flash from a shot just fired, converging on the
+	// crosshair from both bottom corners of the viewport
+	if (_laserFlashTicks > 0) {
+		s.drawLine(LASER_ORIGIN_LEFT_X, LASER_ORIGIN_Y, sf._centerX, sf._centerY, LASER_COLOR);
+		s.drawLine(LASER_ORIGIN_RIGHT_X, LASER_ORIGIN_Y, sf._centerX, sf._centerY, LASER_COLOR);
+	}
 }
 
 bool SpaceCockpit::msgMouseMove(const MouseMoveMessage &msg) {
@@ -83,6 +98,11 @@ bool SpaceCockpit::msgMouseDown(const MouseDownMessage &msg) {
 	return true;
 }
 
+void SpaceCockpit::fireLaser() {
+	_laserFlashTicks = LASER_FLASH_TICKS;
+	redraw();
+}
+
 // Ticks per +/-1 step while ramping the display speed up/down
 constexpr int HYPERJUMP_SPEED_STEP_TICKS = 2;
 // How long (in ticks) to hold at full warp, streaking the starfield
@@ -151,6 +171,9 @@ bool SpaceCockpit::tick() {
 	if (_hyperjumpState != HYPERJUMP_IDLE)
 		tickHyperjump();
 
+	if (_laserFlashTicks > 0 && --_laserFlashTicks == 0)
+		redraw();
+
 	return Map::tick();
 }
 
diff --git a/engines/ultima/ultima1/views/space_cockpit.h b/engines/ultima/ultima1/views/space_cockpit.h
index ceb6c59080f..5474d9da052 100644
--- a/engines/ultima/ultima1/views/space_cockpit.h
+++ b/engines/ultima/ultima1/views/space_cockpit.h
@@ -52,6 +52,10 @@ private:
 	int _hyperjumpDX = 0, _hyperjumpDY = 0;
 	int _hyperjumpOrigSpeed = 0;
 
+	// Ticks left to keep showing the laser-bolt flash from fireLaser() (0 =
+	// not showing)
+	int _laserFlashTicks = 0;
+
 	/**
 	 * Draws the static cockpit frame around the viewport (drawCockpitFrame)
 	 */
@@ -96,6 +100,13 @@ public:
 	 * SpaceCockpitLogic::hyperjump() once fuel/heading are validated
 	 */
 	void startHyperjump(int dx, int dy);
+
+	/**
+	 * Briefly flashes twin laser-bolt lines in from the bottom corners of
+	 * the viewport, converging on the crosshair - called by
+	 * SpaceCockpitLogic::fire() for each shot
+	 */
+	void fireLaser();
 };
 
 } // namespace Views


Commit: 7b27c0f59393e835b88a823702e23a4db5f8c4a2
    https://github.com/scummvm/scummvm/commit/7b27c0f59393e835b88a823702e23a4db5f8c4a2
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:40:54+11:00

Commit Message:
ULTIMA: ULTIMA1: Enemy ship combat

Changed paths:
    engines/ultima/ultima1/logic/space_cockpit_logic.cpp
    engines/ultima/ultima1/logic/space_cockpit_logic.h
    engines/ultima/ultima1/views/space_cockpit.cpp
    engines/ultima/ultima1/views/space_cockpit.h


diff --git a/engines/ultima/ultima1/logic/space_cockpit_logic.cpp b/engines/ultima/ultima1/logic/space_cockpit_logic.cpp
index 12f911eec9a..c7d13618c3f 100644
--- a/engines/ultima/ultima1/logic/space_cockpit_logic.cpp
+++ b/engines/ultima/ultima1/logic/space_cockpit_logic.cpp
@@ -47,6 +47,16 @@ constexpr int TARGET_MIN_Y = 24, TARGET_MAX_Y = 125;
 constexpr int TARGET_APPROACH_TIMER_THRESHOLD = 15;
 constexpr int TARGET_APPROACH_ROLL_THRESHOLD = 20;
 
+// alienFiresBack's own odds: a ~1.5% chance per frame of a shot at all
+// (roll < ALIEN_FIRE_ROLL_THRESHOLD out of ALIEN_FIRE_ROLL_MAX), and then a
+// ~25% chance (reusing the SAME roll used to pick the shot's origin edge -
+// only a shot arriving from the bottom edge can actually hit) of it landing
+constexpr int ALIEN_FIRE_ROLL_MAX = 200;
+constexpr int ALIEN_FIRE_ROLL_THRESHOLD = 4;
+constexpr int ALIEN_FIRE_EDGE_ROLL_MAX = 255;
+constexpr int ALIEN_FIRE_HIT_THRESHOLD = 0x40;
+constexpr int ALIEN_FIRE_DAMAGE = 0x141;
+
 void SpaceCockpitLogic::setSpeed(int speed) {
 	writeString("Speed %d\n", speed);
 
@@ -102,19 +112,66 @@ void SpaceCockpitLogic::tickEncounter() {
 			_G(cockpitTargetY) < TARGET_MIN_Y || _G(cockpitTargetY) > TARGET_MAX_Y) {
 		// Passed by unengaged
 		setupSectorEnemies();
-		return;
+	} else if (_G(cockpitApproachTimer) <= TARGET_APPROACH_TIMER_THRESHOLD) {
+		++_G(cockpitApproachTimer);
+	} else {
+		_G(cockpitApproachTimer) = 0;
+		if (getRandomNumber(1, (_G(cockpitSpeed) + 3) * 10) > TARGET_APPROACH_ROLL_THRESHOLD) {
+			if (++_G(cockpitTargetStage) >= Data::SPACE_TARGET_STAGE_COUNT)
+				setupSectorEnemies();
+		}
 	}
 
-	if (_G(cockpitApproachTimer) <= TARGET_APPROACH_TIMER_THRESHOLD) {
-		++_G(cockpitApproachTimer);
+	// Still runs even if the above just picked a fresh target (it starts at
+	// stage 0, which alienFiresBack's own gate always skips) or cleared it
+	alienFiresBack();
+}
+
+void SpaceCockpitLogic::alienFiresBack() {
+	if (getRandomNumber(1, ALIEN_FIRE_ROLL_MAX) >= ALIEN_FIRE_ROLL_THRESHOLD)
+		return;
+	if (_G(cockpitTargetStage) == 0 || _G(cockpitTargetX) == 0)
 		return;
+
+	writeString("Alien fires!\n");
+
+	// The same roll both picks which viewport edge the shot comes in from
+	// and (only the bottom-edge range) whether it actually lands
+	int roll = getRandomNumber(1, ALIEN_FIRE_EDGE_ROLL_MAX);
+	int originX, originY;
+	if (roll < 0x40) {
+		originX = 159; originY = 135;		// bottom edge
+	} else if (roll < 0x80) {
+		originX = 159; originY = 20;		// top edge
+	} else if (roll <= 0xC0) {
+		originX = 290; originY = 79;		// right edge
+	} else {
+		originX = 20; originY = 79;		// left edge
 	}
 
-	_G(cockpitApproachTimer) = 0;
-	if (getRandomNumber(1, (_G(cockpitSpeed) + 3) * 10) > TARGET_APPROACH_ROLL_THRESHOLD) {
-		if (++_G(cockpitTargetStage) >= Data::SPACE_TARGET_STAGE_COUNT)
-			setupSectorEnemies();
+	int stage = _G(cockpitTargetStage);
+	int endX = _G(cockpitTargetX) + Data::SPACE_TARGET_HIT_MAX_X[stage] / 2;
+	int endY = _G(cockpitTargetY) + Data::SPACE_TARGET_HIT_MAX_Y[stage];
+
+	Views::SpaceCockpit *view = dynamic_cast<Views::SpaceCockpit *>(g_engine->findView("SpaceCockpit"));
+	assert(view);
+	view->alienFireFlash(originX, originY, endX, endY);
+	playFX(8);
+
+	if (roll < ALIEN_FIRE_HIT_THRESHOLD) {
+		playFX(2);
+		writeString("You've been hit!\n");
+
+		subtractShields(MIN(shipShields(), ALIEN_FIRE_DAMAGE));
+
+		if (shipShields() == 0) {
+			writeString("Thy shield is drained!\n");
+			death();
+			return;
+		}
 	}
+
+	prompt();
 }
 
 bool SpaceCockpitLogic::move(Data::Direction dir) {
diff --git a/engines/ultima/ultima1/logic/space_cockpit_logic.h b/engines/ultima/ultima1/logic/space_cockpit_logic.h
index 13bd5ad22b0..43dabf58a92 100644
--- a/engines/ultima/ultima1/logic/space_cockpit_logic.h
+++ b/engines/ultima/ultima1/logic/space_cockpit_logic.h
@@ -58,6 +58,15 @@ private:
 	 */
 	void tickEncounter();
 
+	/**
+	 * Called from tickEncounter() for each frame a target is being engaged:
+	 * a small chance of the target shooting back (alienFiresBack). Fires a
+	 * laser-bolt line in from a random viewport edge toward the target, and
+	 * a further chance of it actually hitting - draining shields (and
+	 * killing the player outright if that empties them)
+	 */
+	void alienFiresBack();
+
 protected:
 	bool move(Data::Direction dir) override;
 
diff --git a/engines/ultima/ultima1/views/space_cockpit.cpp b/engines/ultima/ultima1/views/space_cockpit.cpp
index 3de52da45ec..853e243e9f8 100644
--- a/engines/ultima/ultima1/views/space_cockpit.cpp
+++ b/engines/ultima/ultima1/views/space_cockpit.cpp
@@ -81,6 +81,10 @@ void SpaceCockpit::draw() {
 		s.drawLine(LASER_ORIGIN_LEFT_X, LASER_ORIGIN_Y, sf._centerX, sf._centerY, LASER_COLOR);
 		s.drawLine(LASER_ORIGIN_RIGHT_X, LASER_ORIGIN_Y, sf._centerX, sf._centerY, LASER_COLOR);
 	}
+
+	// The brief laser-bolt flash from the current target firing back
+	if (_alienFlashTicks > 0)
+		s.drawLine(_alienFlashX1, _alienFlashY1, _alienFlashX2, _alienFlashY2, LASER_COLOR);
 }
 
 bool SpaceCockpit::msgMouseMove(const MouseMoveMessage &msg) {
@@ -103,6 +107,13 @@ void SpaceCockpit::fireLaser() {
 	redraw();
 }
 
+void SpaceCockpit::alienFireFlash(int x1, int y1, int x2, int y2) {
+	_alienFlashTicks = LASER_FLASH_TICKS;
+	_alienFlashX1 = x1; _alienFlashY1 = y1;
+	_alienFlashX2 = x2; _alienFlashY2 = y2;
+	redraw();
+}
+
 // Ticks per +/-1 step while ramping the display speed up/down
 constexpr int HYPERJUMP_SPEED_STEP_TICKS = 2;
 // How long (in ticks) to hold at full warp, streaking the starfield
@@ -173,6 +184,8 @@ bool SpaceCockpit::tick() {
 
 	if (_laserFlashTicks > 0 && --_laserFlashTicks == 0)
 		redraw();
+	if (_alienFlashTicks > 0 && --_alienFlashTicks == 0)
+		redraw();
 
 	return Map::tick();
 }
diff --git a/engines/ultima/ultima1/views/space_cockpit.h b/engines/ultima/ultima1/views/space_cockpit.h
index 5474d9da052..ed7e5b5d2d1 100644
--- a/engines/ultima/ultima1/views/space_cockpit.h
+++ b/engines/ultima/ultima1/views/space_cockpit.h
@@ -56,6 +56,11 @@ private:
 	// not showing)
 	int _laserFlashTicks = 0;
 
+	// Ticks left to keep showing the incoming shot flash from
+	// alienFireFlash() (0 = not showing), and its endpoints
+	int _alienFlashTicks = 0;
+	int _alienFlashX1 = 0, _alienFlashY1 = 0, _alienFlashX2 = 0, _alienFlashY2 = 0;
+
 	/**
 	 * Draws the static cockpit frame around the viewport (drawCockpitFrame)
 	 */
@@ -107,6 +112,13 @@ public:
 	 * SpaceCockpitLogic::fire() for each shot
 	 */
 	void fireLaser();
+
+	/**
+	 * Briefly flashes a single laser-bolt line between the given points -
+	 * called by SpaceCockpitLogic::alienFiresBack() for the current
+	 * target's return shot
+	 */
+	void alienFireFlash(int x1, int y1, int x2, int y2);
 };
 
 } // namespace Views


Commit: 2d2a33d3f46d503e99fe15cfb6220c753fed5c12
    https://github.com/scummvm/scummvm/commit/2d2a33d3f46d503e99fe15cfb6220c753fed5c12
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:40:54+11:00

Commit Message:
ULTIMA: ULTIMA0: Fix replaceAllViews not passed in replaceView call

Changed paths:
    engines/ultima/ultima0/events.cpp


diff --git a/engines/ultima/ultima0/events.cpp b/engines/ultima/ultima0/events.cpp
index 39829d78453..aced93f1c9c 100644
--- a/engines/ultima/ultima0/events.cpp
+++ b/engines/ultima/ultima0/events.cpp
@@ -157,7 +157,7 @@ void Events::replaceView(UIElement *ui, bool replaceAllViews) {
 }
 
 void Events::replaceView(const Common::String &name, bool replaceAllViews) {
-	replaceView(findView(name));
+	replaceView(findView(name), replaceAllViews);
 }
 
 void Events::addView(UIElement *ui) {


Commit: 47346ab683e6578f7a8612eb0338e0e2692bcf44
    https://github.com/scummvm/scummvm/commit/47346ab683e6578f7a8612eb0338e0e2692bcf44
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:40:54+11:00

Commit Message:
ULTIMA: ULTIMA1: Fix cockpit speed default

Changed paths:
    engines/ultima/ultima1/logic/space_cockpit_logic.cpp
    engines/ultima/ultima1/logic/space_logic.cpp


diff --git a/engines/ultima/ultima1/logic/space_cockpit_logic.cpp b/engines/ultima/ultima1/logic/space_cockpit_logic.cpp
index c7d13618c3f..3477be3bbe5 100644
--- a/engines/ultima/ultima1/logic/space_cockpit_logic.cpp
+++ b/engines/ultima/ultima1/logic/space_cockpit_logic.cpp
@@ -259,8 +259,8 @@ bool SpaceCockpitLogic::pass() {
 	writeString("Center\n");
 
 	Data::SpaceStarfield &sf = _G(starfield);
-	sf._centerX = 0x9f;
-	sf._centerY = 0x4f;
+	sf._centerX = 320 / 2;
+	sf._centerY = 160 / 2;
 	sf._panX = sf._panY = 0;
 	redrawMap();
 	return true;
diff --git a/engines/ultima/ultima1/logic/space_logic.cpp b/engines/ultima/ultima1/logic/space_logic.cpp
index aa5dee47c4d..16c30d6f0e9 100644
--- a/engines/ultima/ultima1/logic/space_logic.cpp
+++ b/engines/ultima/ultima1/logic/space_logic.cpp
@@ -36,12 +36,11 @@ SpaceLogic::SpaceLogic() {
 
 void SpaceLogic::entering() {
 	// The original re-launches SPACE.EXE each time, always starting fresh
-	// at the station sector with a newly rolled galaxy, flying the shuttle
-	// out of the docking bay
+	// at the station sector with a newly rolled galaxy
 	_G(savegame)._sectorX = Data::SPACE_STATION_X;
 	_G(savegame)._sectorY = Data::SPACE_STATION_Y;
 	_G(savegame)._shipIndex = 2;
-	_G(cockpitSpeed) = 0;
+	_G(cockpitSpeed) = 5;
 	_G(savegame)._starmap.setup();
 
 	// Seed the player's own ship slot from the savegame. setupSpaceMap also


Commit: 8d3d221fdcf92bb7e014e241e2475e2aca4322d5
    https://github.com/scummvm/scummvm/commit/8d3d221fdcf92bb7e014e241e2475e2aca4322d5
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:40:54+11:00

Commit Message:
ULTIMA: ULTIMA1: Allow loading from death screen

Changed paths:
    engines/ultima/ultima1/ultima1.cpp
    engines/ultima/ultima1/ultima1.h


diff --git a/engines/ultima/ultima1/ultima1.cpp b/engines/ultima/ultima1/ultima1.cpp
index 814139ad108..2ef7dc1d5a2 100644
--- a/engines/ultima/ultima1/ultima1.cpp
+++ b/engines/ultima/ultima1/ultima1.cpp
@@ -79,6 +79,12 @@ bool Ultima1Engine::canSaveGameStateCurrently(Common::U32String *msg) {
 	return dynamic_cast<Views::Map *>(focusedView()) != nullptr;
 }
 
+bool Ultima1Engine::canLoadGameStateCurrently(Common::U32String *msg) {
+	return canSaveGameStateCurrently() ||
+		dynamic_cast<Views::Interactions::Dead *>(focusedView()) != nullptr ||
+		dynamic_cast<Views::Interactions::SpaceDead *>(focusedView()) != nullptr;
+}
+
 Common::Error Ultima1Engine::syncGame(Common::Serializer &s) {
 	if (s.isSaving())
 		_G(savegame)._moveCount = _moveCtr;
diff --git a/engines/ultima/ultima1/ultima1.h b/engines/ultima/ultima1/ultima1.h
index 5cb8505349c..751b69cfe58 100644
--- a/engines/ultima/ultima1/ultima1.h
+++ b/engines/ultima/ultima1/ultima1.h
@@ -111,10 +111,8 @@ public:
 			(f == kSupportsReturnToLauncher);
 	};
 
-	bool canLoadGameStateCurrently(Common::U32String *msg = nullptr) override {
-		return true;
-	}
 	bool canSaveGameStateCurrently(Common::U32String *msg = nullptr) override;
+	bool canLoadGameStateCurrently(Common::U32String *msg = nullptr) override;
 
 	/**
 	 * Uses a serializer to allow implementing savegame


Commit: a300cc7c3d9303379cdba64520be82f980c69873
    https://github.com/scummvm/scummvm/commit/a300cc7c3d9303379cdba64520be82f980c69873
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:40:54+11:00

Commit Message:
ULTIMA: ULTIMA2: Add fresh engine skeleton with a placeholder startup screen

Changed paths:
  R engines/ultima/ultima2/data/game.cpp
  R engines/ultima/ultima2/data/game.h
  R engines/ultima/ultima2/data/map.cpp
  R engines/ultima/ultima2/data/map.h
  R engines/ultima/ultima2/data/player.cpp
  R engines/ultima/ultima2/data/player.h
  R engines/ultima/ultima2/data/tiles.cpp
  R engines/ultima/ultima2/data/tiles.h
  R engines/ultima/ultima2/gfx/pic_decoder.cpp
  R engines/ultima/ultima2/gfx/pic_decoder.h
  R engines/ultima/ultima2/views/commands.cpp
  R engines/ultima/ultima2/views/commands.h
  R engines/ultima/ultima2/views/create_character.cpp
  R engines/ultima/ultima2/views/create_character.h
  R engines/ultima/ultima2/views/dead.cpp
  R engines/ultima/ultima2/views/dead.h
  R engines/ultima/ultima2/views/demo.cpp
  R engines/ultima/ultima2/views/demo.h
  R engines/ultima/ultima2/views/overworld.cpp
  R engines/ultima/ultima2/views/overworld.h
  R engines/ultima/ultima2/views/overworld_map.cpp
  R engines/ultima/ultima2/views/overworld_map.h
  R engines/ultima/ultima2/views/stats.cpp
  R engines/ultima/ultima2/views/stats.h
  R engines/ultima/ultima2/views/title.cpp
  R engines/ultima/ultima2/views/title.h
    engines/ultima/detection_tables.h
    engines/ultima/module.mk
    engines/ultima/ultima2/console.cpp
    engines/ultima/ultima2/console.h
    engines/ultima/ultima2/metaengine.cpp
    engines/ultima/ultima2/metaengine.h
    engines/ultima/ultima2/ultima2.cpp
    engines/ultima/ultima2/ultima2.h
    engines/ultima/ultima2/views/startup.cpp
    engines/ultima/ultima2/views/startup.h
    engines/ultima/ultima2/views/views.h


diff --git a/engines/ultima/detection_tables.h b/engines/ultima/detection_tables.h
index 09a112f180e..16e2508bff4 100644
--- a/engines/ultima/detection_tables.h
+++ b/engines/ultima/detection_tables.h
@@ -140,7 +140,7 @@ static const UltimaGameDescription GAME_DESCRIPTIONS[] = {
 		{
 			"ultima2",
 			0,
-			AD_ENTRY1s("mapx00", "86cd98e2f576cfab697a4cfd72dfd83e", 4224),
+			AD_ENTRY1s("monsters", "29160ad200758650d8a4a6af2474d075", 2176),
 			Common::EN_ANY,
 			Common::kPlatformDOS,
 			ADGF_UNSTABLE,
diff --git a/engines/ultima/module.mk b/engines/ultima/module.mk
index 1e84580856b..5cc650d3c65 100644
--- a/engines/ultima/module.mk
+++ b/engines/ultima/module.mk
@@ -114,24 +114,8 @@ ifdef ENABLE_ULTIMA2
 MODULE_OBJS += \
 	ultima2/ultima2.o \
 	ultima2/console.o \
-	ultima2/events.o \
-	ultima2/messages.o \
 	ultima2/metaengine.o \
-	ultima2/data/game.o \
-	ultima2/data/map.o \
-	ultima2/data/player.o \
-	ultima2/data/tiles.o \
-	ultima2/gfx/pic_decoder.o \
-	ultima2/views/view.o \
-	ultima2/views/commands.o \
-	ultima2/views/create_character.o \
-	ultima2/views/dead.o \
-	ultima2/views/demo.o \
-	ultima2/views/overworld.o \
-	ultima2/views/overworld_map.o \
-	ultima2/views/stats.o \
-	ultima2/views/startup.o \
-	ultima2/views/title.o
+	ultima2/views/startup.o
 endif
 
 ifdef ENABLE_ULTIMA4
diff --git a/engines/ultima/ultima2/console.cpp b/engines/ultima/ultima2/console.cpp
index 0f928342f25..ce3848906f6 100644
--- a/engines/ultima/ultima2/console.cpp
+++ b/engines/ultima/ultima2/console.cpp
@@ -25,16 +25,10 @@ namespace Ultima {
 namespace Ultima2 {
 
 Console::Console() : GUI::Debugger() {
-	registerCmd("test", WRAP_METHOD(Console, Cmd_test));
 }
 
 Console::~Console() {
 }
 
-bool Console::Cmd_test(int argc, const char **argv) {
-	debugPrintf("Test\n");
-	return true;
-}
-
 } // namespace Ultima2
 } // namespace Ultima
diff --git a/engines/ultima/ultima2/console.h b/engines/ultima/ultima2/console.h
index 0a164ef66c2..118d645c509 100644
--- a/engines/ultima/ultima2/console.h
+++ b/engines/ultima/ultima2/console.h
@@ -1,4 +1,3 @@
-
 /* ScummVM - Graphic Adventure Engine
  *
  * ScummVM is the legal property of its developers, whose names
@@ -29,8 +28,6 @@ namespace Ultima {
 namespace Ultima2 {
 
 class Console : public GUI::Debugger {
-private:
-	bool Cmd_test(int argc, const char **argv);
 public:
 	Console();
 	~Console() override;
diff --git a/engines/ultima/ultima2/data/game.cpp b/engines/ultima/ultima2/data/game.cpp
deleted file mode 100644
index 77788edf14a..00000000000
--- a/engines/ultima/ultima2/data/game.cpp
+++ /dev/null
@@ -1,111 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-#include "ultima/ultima2/data/game.h"
-#include "ultima/ultima2/ultima2.h"
-#include "ultima/ultima2/metaengine.h"
-
-namespace Ultima {
-namespace Ultima2 {
-namespace Data {
-
-void Game::startGame() {
-	const auto &player = g_engine->_player;
-
-	if (IS_DUNGEON(player._mapNum))
-		g_engine->replaceView("Dungeon");
-	else
-		g_engine->replaceView("Overworld");
-
-	promptForCommand();
-}
-
-void Game::message(const Common::String &name, const char *param) {
-	GameMessage msg(name);
-	if (param)
-		msg._stringValue = param;
-	g_engine->focusedView()->send(msg);
-}
-
-void Game::promptForCommand() {
-	g_engine->focusedView()->send(GameMessage("COMMAND"));
-}
-
-void Game::doCommand(int action) {
-	switch (action) {
-	case KEYBIND_PASS:
-		message("INFO", "PASS");
-		break;
-
-	case KEYBIND_UP:
-
-
-	default:
-		message("INFO", "-ILLEGAL COMMAND!");
-		break;
-	}
-
-	endOfTurn();
-}
-
-void Game::endOfTurn() {
-	auto &player = g_engine->_player;
-
-	subtractFoodCtr(10);
-	if (!player.isDead()) {
-		g_engine->focusedView()->redraw();
-		promptForCommand();
-	}
-}
-
-void Game::subtractFoodCtr(int amount) {
-	auto &player = g_engine->_player;
-	if (player._hp == 0)
-		return;		// Already dead
-
-	bool foodFlag = player._foodSubCtr < amount;
-	player._foodSubCtr -= amount;
-	if (foodFlag && --player._food == 0)
-		dead();
-}
-
-void Game::subtractHp(int amount) {
-	auto &player = g_engine->_player;
-	player._hp = MAX((int)player._hp - amount, 0);
-
-	if (player._hp == 0)
-		dead();
-}
-
-void Game::dead() {
-	auto &player = g_engine->_player;
-	player._hp = 0;
-	player._food = 0;
-	player._foodSubCtr = 0;
-	player._experience = 0;
-	player._gold = 0;
-
-	message("DEAD");
-}
-
-} // namespace Data
-} // namespace Ultima2
-} // namespace Ultima
diff --git a/engines/ultima/ultima2/data/game.h b/engines/ultima/ultima2/data/game.h
deleted file mode 100644
index 061e631fea0..00000000000
--- a/engines/ultima/ultima2/data/game.h
+++ /dev/null
@@ -1,86 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-#ifndef ULTIMA2_DATA_GAME_H
-#define ULTIMA2_DATA_GAME_H
-
-#include "ultima/shared/engine/messages.h"
-
-namespace Ultima {
-namespace Ultima2 {
-namespace Data {
-
-using namespace Shared::Messages;
-
-/*
- * The number of game frames before prompting the user for a command times out,
- * and it's treated as a pass
- */
-constexpr int FRAMES_BEFORE_COMMAND_TIMEOUT = 10;
-
-class Game {
-public:
-	/**
-	 * Called to start the game, both for new characters, and when a savegame is loaded
-	 */
-	void startGame();
-
-	/**
-	 * Prompt the player for a command
-	 */
-	void promptForCommand();
-
-	/**
-	 * Implements an in-game command
-	 */
-	void doCommand(int action);
-
-	/**
-	 * Called after actions are done
-	 */
-	void endOfTurn();
-
-	/**
-	 * Subtract food fraction from the player
-	 */
-	void subtractFoodCtr(int amount);
-
-	/**
-	 * Remove HP from the player
-	 */
-	void subtractHp(int amount);
-
-	/**
-	 * Player has died
-	 */
-	void dead();
-
-	/**
-	 * Triggers a message to the game view
-	 */
-	void message(const Common::String &name, const char *param = nullptr);
-};
-
-} // namespace Data
-} // namespace Ultima2
-} // namespace Ultima
-
-#endif
diff --git a/engines/ultima/ultima2/data/map.cpp b/engines/ultima/ultima2/data/map.cpp
deleted file mode 100644
index 730ed0decf6..00000000000
--- a/engines/ultima/ultima2/data/map.cpp
+++ /dev/null
@@ -1,114 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-#include "common/file.h"
-#include "ultima/ultima2/data/map.h"
-#include "ultima/ultima2/ultima2.h"
-
-namespace Ultima {
-namespace Ultima2 {
-namespace Data {
-
-void Map::load(int mapNum) {
-	const auto &player = g_engine->_player;
-
-	if (mapNum == _currentMap)
-		return;
-	_currentMap = mapNum;
-
-	Common::File f;
-	if (!f.open(Common::String::format("MAPX%.2d", mapNum).c_str()))
-		error("Could not open map %d", mapNum);
-
-	f.read(_tiles, MAP_WIDTH * MAP_HEIGHT);
-
-	// Set up copies of the map position and player tile to use
-	_mapX = player._mapX;
-	_mapY = player._mapY;
-	_playerTileId = (player._class + Data::PLAYER_TILES_OFFSET) * 2;
-	clearTiles();
-}
-
-void Map::clearTiles() {
-	Common::fill(&_mapTilesId[0][0], &_mapTilesId[0][0] + sizeof(VisibleTiles), 0);
-	Common::fill(&_priorTileIds[0][0], &_priorTileIds[0][0] + sizeof(VisibleTiles), 0);
-}
-
-bool Map::canMoveToTile(int tileNum) {
-	auto &game = g_engine->_game;
-	const auto &player = g_engine->_player;
-	int tileId = (tileNum & 0x7f) / 2;
-
-	if (IS_PLANET(player._mapNum) || ((uint)_mapX < Data::MAP_WIDTH && (uint)_mapY < Data::MAP_HEIGHT)) {
-		// Within the bounds of the map
-		if (tileId == kTileSwamp) {
-			game.subtractHp(5);
-		} else if (tileId == kTileForcefield) {
-			if (player._hasRing) {
-				game.message("INFO", "\x8D""FIELD CAUSES 1000 DAMAGE!");
-				game.message("CIRCLE");		// Flash damage circle
-
-				game.subtractHp(1000);
-			} else {
-				game.message("INFO", "RING PROTECTS FROM FIELD!");
-				g_engine->pauseMillis();
-			}
-		}
-
-		// Check paralyzed
-		if (player._paralyzedFlag) {
-			game.message("INFO", "--PARALIZED!");
-			return true;
-		}
-
-		switch (_playerTileId / 2) {
-		case kTileRocket * 2:
-			return true;
-		case kTileAirplane:
-			// TODO
-			error("TODO: airplane");
-			break;
-		case kTileShip:
-			if (tileId != kTileWater)
-				return true;
-
-			goto update_xy;
-		case kTileHorse:
-			// TODO
-			break;
-		default:
-			// TODO
-			break;
-		}
-	} else {
-		// TODO
-	}
-
-update_xy:
-	_mapX &= 63;
-	_mapY &= 63;
-
-	return false;
-}
-
-} // namespace Data
-} // namespace Ultima2
-} // namespace Ultima
diff --git a/engines/ultima/ultima2/data/map.h b/engines/ultima/ultima2/data/map.h
deleted file mode 100644
index d4c2927ab48..00000000000
--- a/engines/ultima/ultima2/data/map.h
+++ /dev/null
@@ -1,72 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-#ifndef ULTIMA2_DATA_MAP_H
-#define ULTIMA2_DATA_MAP_H
-
-#include "common/archive.h"
-
-namespace Ultima {
-namespace Ultima2 {
-namespace Data {
-
-#define IS_PLANET(MAPNUM) ((MAPNUM % 10) == 0)
-#define IS_CITY(MAPNUM) ((MAPNUM % 10) >= 1 && (MAPNUM % 10) <= 3)
-#define IS_DUNGEON(MAPNUM) ((MAPNUM % 10) >= 4)
-
-constexpr int MAP_WIDTH = 64;
-constexpr int MAP_HEIGHT = 66;
-constexpr int MAP_VISIBLE_WIDTH = 20;
-constexpr int MAP_VISIBLE_HEIGHT = 10;
-constexpr int MAP_VISIBLE_CENTER_X = 9;
-constexpr int MAP_VISIBLE_CENTER_Y = 4;
-constexpr int PLAYER_TILES_OFFSET = 60;
-typedef byte MapTiles[MAP_HEIGHT][MAP_WIDTH];
-typedef byte VisibleTiles[MAP_VISIBLE_HEIGHT][MAP_VISIBLE_WIDTH];
-
-struct Map {
-private:
-	int _currentMap = -1;
-public:
-	int _mapX = 0, _mapY = 0;
-	byte _playerTileId = 0;
-
-	MapTiles _tiles = {};
-	int8 _outsideMapTile = -1;
-	byte _tilePlayerCenter = 0;
-	byte _tilePlayerUp = 0, _tilePlayerDown = 0,
-		_tilePlayerLeft = 0, _tilePlayerRight = 0;
-	VisibleTiles _mapTilesId = {};		// Calculated visible on-screen tiles
-	VisibleTiles _priorTileIds = {};	// Prior on-screen tiles, used to determine which to draw
-
-	const byte _flag1 = 0;
-
-	void load(int mapNum);
-	void clearTiles();
-
-	bool canMoveToTile(int tileNum);
-};
-
-} // namespace Data
-} // namespace Ultima2
-} // namespace Ultima
-
-#endif
diff --git a/engines/ultima/ultima2/data/player.cpp b/engines/ultima/ultima2/data/player.cpp
deleted file mode 100644
index 8ce2234d071..00000000000
--- a/engines/ultima/ultima2/data/player.cpp
+++ /dev/null
@@ -1,101 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-#include "ultima/ultima2/data/player.h"
-
-namespace Ultima {
-namespace Ultima2 {
-namespace Data {
-
-const char *SEX[] = { "MALE", "FEMALE", "YES PLEASE" };
-const char *RACE[] = { nullptr, "HUMAN", "ELF", "DWARF", "HOBBIT" };
-const char *CLASS[] = { nullptr, "FIGHTER", "CLERIC", "WIZARD", "THIEF" };
-
-void Player::synchronize(Common::Serializer &s) {
-	// Sync name
-	s.syncBytes((byte *)_name, MAX_NAME_LENGTH + 1);
-	s.skip(16 - (MAX_NAME_LENGTH + 1));
-
-	// Sex
-	byte sex = (_sex == SEX_MALE) ? 'M' : 'F';
-	s.syncAsByte(sex);
-	if (s.isLoading())
-		_sex = (sex == 'M') ? SEX_MALE : SEX_FEMALE;
-
-	// Class and race
-	s.syncAsByte(_class);
-	s.syncAsByte(_race);
-
-	// Map number is saved as two separate bytes
-	byte map1 = _mapNum / 10, map2 = _mapNum % 10;
-	s.syncAsByte(map1);
-	s.syncAsByte(map2);
-	if (s.isLoading())
-		_mapNum = (map1 * 10) + map2;
-
-	// Attributes
-	syncByte(s, _strength);
-	syncByte(s, _agility);
-	syncByte(s, _stamina);
-	syncByte(s, _charisma);
-	syncByte(s, _wisdom);
-	syncByte(s, _intelligence);
-	syncWord(s, _hp);
-	syncWord(s, _food);
-	s.syncAsByte(_foodSubCtr);
-	s.skip(1);
-	syncWord(s, _experience);
-	syncWord(s, _gold);
-	syncWord(s, _food);
-
-	syncByte(s, _mapX);
-	syncByte(s, _mapY);
-
-	s.syncAsByte(_hasRing);
-
-	if (s.isLoading()) {
-		_paralyzedFlag = 0;
-	}
-}
-
-void Player::syncByte(Common::Serializer &s, byte &v) {
-	byte tmp = ((v / 10) << 4) | (v % 10);
-	s.syncAsByte(tmp);
-	if (s.isLoading())
-		v = ((tmp >> 4) * 10) + (tmp & 0xf);
-}
-
-void Player::syncWord(Common::Serializer &s, uint16 &v) {
-	byte tmp[2];
-	if (s.isLoading()) {
-		s.syncBytes(tmp, 2);
-		v = ((tmp[0] >> 4) * 1000) + ((tmp[0] & 0xf) * 100) +
-			((tmp[1] >> 4) * 10) + (tmp[1] & 0xf);
-	} else {
-		tmp[0] = ((v / 1000) << 4) | ((v % 1000) / 100);
-		tmp[1] = ((v / 10) << 4) | (v % 10);
-		s.syncBytes(tmp, 2);
-	}
-}
-
-} // namespace Data
-} // namespace Ultima2
-} // namespace Ultima
diff --git a/engines/ultima/ultima2/data/player.h b/engines/ultima/ultima2/data/player.h
deleted file mode 100644
index 5ed03e19aa9..00000000000
--- a/engines/ultima/ultima2/data/player.h
+++ /dev/null
@@ -1,99 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-#ifndef ULTIMA2_DATA_PLAYER_H
-#define ULTIMA2_DATA_PLAYER_H
-
-#include "common/serializer.h"
-
-namespace Ultima {
-namespace Ultima2 {
-namespace Data {
-
-constexpr int MAX_NAME_LENGTH = 12;
-
-extern const char *SEX[];
-extern const char *RACE[];
-extern const char *CLASS[];
-
-enum Sex {
-	SEX_MALE, SEX_FEMALE
-};
-enum Race {
-	RACE_HUMAN = 1, RACE_ELF = 2, RACE_DWARF = 3, RACE_HOBBIT = 4
-};
-enum Class {
-	CLASS_FIGHTER = 1, CLASS_CLERIC = 2, CLASS_WIZARD = 3, CLASS_THIEF = 4
-};
-
-struct Player {
-private:
-	/**
-	 * Synchronizes a byte value. In original Ultima II, byte values store
-	 * the tens in the upper 4 bits, and the 0-9 portion in the low 4 bits.
-	 */
-	void syncByte(Common::Serializer &s, byte &v);
-
-	/**
-	 * Synchronizes a uint16 value. In original Ultima II, uint16 values store
-	 * 4 digits each in 4-bit portions of their own.
-	 */
-	void syncWord(Common::Serializer &s, uint16 &v);
-
-public:
-	char _name[MAX_NAME_LENGTH + 1] = {};
-	byte _sex = SEX_MALE;
-	byte _class = CLASS_FIGHTER;
-	byte _race = RACE_HUMAN;
-	byte _mapNum = 20;
-
-	byte _strength = 0;
-	byte _agility = 0;
-	byte _stamina = 0;
-	byte _charisma = 0;
-	byte _wisdom = 0;
-	byte _intelligence = 0;
-	uint16 _hp = 400;
-	uint16 _food = 400;
-	byte _foodSubCtr = 87;
-	uint16 _experience = 0;
-	uint16 _gold = 400;
-
-	byte _mapX = 20;
-	byte _mapY = 20;
-	byte _field3E = 0xff;
-
-	bool _hasRing = false;
-
-	// Runtime only fields
-	byte _paralyzedFlag = 0;
-
-	void synchronize(Common::Serializer &s);
-	bool isDead() const {
-		return _hp > 0;
-	}
-};
-
-} // namespace Data
-} // namespace Ultima2
-} // namespace Ultima
-
-#endif
diff --git a/engines/ultima/ultima2/data/tiles.cpp b/engines/ultima/ultima2/data/tiles.cpp
deleted file mode 100644
index 05b54b34e5c..00000000000
--- a/engines/ultima/ultima2/data/tiles.cpp
+++ /dev/null
@@ -1,98 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-#include "common/file.h"
-#include "common/memstream.h"
-#include "ultima/ultima2/data/tiles.h"
-
-namespace Ultima {
-namespace Ultima2 {
-namespace Data {
-
-// Ultima II has 64 tiles, each 16x16 pixels in CGA Linear format
-const int TILE_DATA_OFFSET = 31808;
-const int TILE2_DATA_OFFSET = 21640;
-
-const Common::ArchiveMemberPtr Tiles::getMember(const Common::Path &path) const {
-	if (!hasFile(path))
-		return Common::ArchiveMemberPtr();
-
-	return Common::ArchiveMemberPtr(new Common::GenericArchiveMember(path, *this));
-}
-
-Common::SeekableReadStream *Tiles::createReadStreamForMember(const Common::Path &path) const {
-	if (!hasFile(path))
-		return nullptr;
-
-	Common::File f;
-	if (!f.open("ultimaii.exe"))
-		error("Could not open ultimaii.exe");
-
-	// Seek to the tile data
-	f.seek(TILE_DATA_OFFSET);
-
-	Common::MemoryWriteStreamDynamic buf(DisposeAfterUse::NO);
-
-	// Process each tile
-	for (int tileNumber = 0; tileNumber < TILE_COUNT; tileNumber++) {
-		if (tileNumber == (TILE_COUNT - 1))
-			f.seek(TILE2_DATA_OFFSET);
-
-		byte tileW = f.readByte() * 4;
-		byte tileH = f.readByte();
-		assert(tileW == TILE_WIDTH && tileH == TILE_HEIGHT);
-
-		// Read the tile data (16 rows, 4 bytes per row)
-		for (int y = 0; y < TILE_HEIGHT; y++) {
-			for (int x = 0; x < TILE_WIDTH / 4; x++) {
-				// Read one byte (contains 4 pixels in CGA Linear format)
-				byte pixelByte = f.readByte();
-
-				// Extract 4 pixels from this byte
-				// CGA Linear: bits 7-6 = first pixel, 5-4 = second, 3-2 = third, 1-0 = fourth
-				for (int offset = 0; offset < 4; offset++) {
-					int colorBit = 7 - (offset * 2);  // Start at bit 7, then 5, 3, 1
-
-					// Extract 2-bit color value
-					int colorIndex = 0;
-					if (pixelByte & (1 << colorBit))
-						colorIndex |= 2;
-					if (pixelByte & (1 << (colorBit - 1)))
-						colorIndex |= 1;
-
-					// Map the 2-bit value to palette index (0-3)
-					byte paletteIndex = colorIndex;
-
-					// Write the palette index to the buffer
-					buf.writeByte(paletteIndex);
-				}
-			}
-		}
-	}
-
-	f.close();
-
-	return new Common::MemoryReadStream(buf.getData(), buf.size(), DisposeAfterUse::YES);
-}
-
-} // namespace Data
-} // namespace Ultima2
-} // namespace Ultima
diff --git a/engines/ultima/ultima2/data/tiles.h b/engines/ultima/ultima2/data/tiles.h
deleted file mode 100644
index f6b5baee1a2..00000000000
--- a/engines/ultima/ultima2/data/tiles.h
+++ /dev/null
@@ -1,153 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-#ifndef ULTIMA2_DATA_TILES_H
-#define ULTIMA2_DATA_TILES_H
-
-#include "common/archive.h"
-
-namespace Ultima {
-namespace Ultima2 {
-namespace Data {
-
-constexpr int TILE_COUNT = 64 + 1;
-constexpr int TILE_WIDTH = 16;
-constexpr int TILE_HEIGHT = 16;
-
-enum TileId {
-	kTileWater = 0,
-	kTileSwamp = 1,
-	kTileGrass = 2,
-	kTileForest = 3,
-	kTileMountain = 4,
-	kTileUnknown5 = 5,
-	kTileTown = 6,
-	kTileTower = 7,
-	kTileCastle = 8,
-	kTileDungeonEntrance = 9,
-	kTileSignpost = 10,
-	kTileSeaMonster = 11,
-	kTileOrc = 12,
-	kTileDaemon = 13,
-	kTileDevil = 14,
-	kTileBalron = 15,
-	kTileMinax = 16,
-	kTileHorse = 17,
-	kTileShip = 18,
-	kTileAirplane = 19,
-	kTileRocket = 20,
-	kTileShield = 21,
-	kTileSword = 22,
-	kTileForcefield = 23,
-	kTileGuard = 24,
-	kTileJester = 25,
-	kTileShopkeep = 26,
-	kTileUnknown27 = 27,
-	kTileRoad = 28,
-	kTileEmpty = 29,
-	kTileWall = 30,
-	kTileEmptyCounterSpace = 31,
-	kTileLetterA = 32,
-	kTileLetterB = 33,
-	kTileLetterC = 34,
-	kTileLetterD = 35,
-	kTileLetterE = 36,
-	kTileLetterF = 37,
-	kTileLetterG = 38,
-	kTileLetterH = 39,
-	kTileLetterIDoor = 40,
-	kTileLetterJ = 41,
-	kTileLetterK = 42,
-	kTileLetterL = 43,
-	kTileLetterM = 44,
-	kTileLetterN = 45,
-	kTileLetterO = 46,
-	kTileLetterP = 47,
-	kTileMoongate = 48,
-	kTileLetterR = 49,
-	kTileLetterS = 50,
-	kTileLetterT = 51,
-	kTileLetterU = 52,
-	kTileLetterV = 53,
-	kTileLetterW = 54,
-	kTileLetterX = 55,
-	kTileLetterY = 56,
-	kTileLetterZ = 57,
-	kTileCounterEndRight = 58,
-	kTileCounterEndLeft = 59,
-	kTileFighter = 60,
-	kTileCleric = 61,
-	kTileMage = 62,
-	kTileThief = 63,
-	// Special tiles
-	kTileCircle = 64
-};
-
-/**
- * This archive class virtualizes converting the CGA tile data from
- * the ultimaii.exe file into a flat pixel (palette indexed) for each tile.
- * This will hopefully make it easier in the future if anyone wants to
- * create an enhanced graphic pack.. they'll just need to drop a 'tiles'
- * file in the game folder and implement a replacement palette for the game.
- */
-class Tiles : public Common::Archive {
-public:
-	~Tiles() override {
-	}
-
-	/**
-	 * Check if a member with the given @p name is present in the Archive.
-	 * Patterns are not allowed, as this is meant to be a quick File::exists()
-	 * replacement.  This returns "true" for both files and directories.
-	 */
-	virtual bool hasFile(const Common::Path &path) const {
-		return path.baseName().equalsIgnoreCase("tiles");
-	}
-
-	/**
-	 * Add all members of the Archive to the list.
-	 * Must only append to list, and not remove elements from it.
-	 *
-	 * @return The number of names added to list.
-	 */
-	virtual int listMembers(Common::ArchiveMemberList &list) const {
-		return 0;
-	}
-
-	/**
-	 * Return an ArchiveMember representation of the given file.
-	 */
-	const Common::ArchiveMemberPtr getMember(const Common::Path &path) const override;
-
-	/**
-	 * Create a stream bound to a member with the specified name in the
-	 * archive. If no member with this name exists, 0 is returned.
-	 *
-	 * @return The newly created input stream.
-	 */
-	Common::SeekableReadStream *createReadStreamForMember(const Common::Path &path) const override;
-};
-
-} // namespace Data
-} // namespace Ultima2
-} // namespace Ultima
-
-#endif
diff --git a/engines/ultima/ultima2/gfx/pic_decoder.cpp b/engines/ultima/ultima2/gfx/pic_decoder.cpp
deleted file mode 100644
index a22e1b94ad2..00000000000
--- a/engines/ultima/ultima2/gfx/pic_decoder.cpp
+++ /dev/null
@@ -1,86 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-#include "common/stream.h"
-#include "ultima/ultima2/gfx/pic_decoder.h"
-
-namespace Ultima {
-namespace Ultima2 {
-namespace Gfx {
-
-bool PicDecoder::loadStream(Common::SeekableReadStream &stream) {
-	destroy();
-	_surface.create(320, 200, Graphics::PixelFormat::createFormatCLUT8());
-	byte *output_buffer = (byte *)_surface.getPixels();
-
-	// Read in the source data
-	Common::Array<byte> cga_data;
-	cga_data.resize(stream.size());
-	stream.read(&cga_data[0], stream.size());
-
-	int x, y;
-	int cga_offset;
-	uint8_t byte_data;
-	int output_offset;
-
-	// CGA interlaced format:
-	// - First 8,192 bytes: even scanlines (0, 2, 4, ..., 198)
-	// - Next 8,192 bytes: odd scanlines (1, 3, 5, ..., 199)
-	// Each scanline is 80 bytes (320 pixels / 4 pixels per byte)
-
-	// Process even scanlines (0, 2, 4, ..., 198)
-	for (y = 0; y < 200; y += 2) {
-		cga_offset = (y / 2) * 80;  // Even lines are in first half
-		output_offset = y * 320;
-
-		for (x = 0; x < 80; x++) {
-			byte_data = cga_data[cga_offset + x];
-
-			// Extract 4 pixels from the byte (2 bits each)
-			output_buffer[output_offset + (x * 4) + 0] = (byte_data >> 6) & 0x03;
-			output_buffer[output_offset + (x * 4) + 1] = (byte_data >> 4) & 0x03;
-			output_buffer[output_offset + (x * 4) + 2] = (byte_data >> 2) & 0x03;
-			output_buffer[output_offset + (x * 4) + 3] = (byte_data >> 0) & 0x03;
-		}
-	}
-
-	// Process odd scanlines (1, 3, 5, ..., 199)
-	for (y = 1; y < 200; y += 2) {
-		cga_offset = 8192 + ((y / 2) * 80);  // Odd lines are in second half
-		output_offset = y * 320;
-
-		for (x = 0; x < 80; x++) {
-			byte_data = cga_data[cga_offset + x];
-
-			// Extract 4 pixels from the byte (2 bits each)
-			output_buffer[output_offset + (x * 4) + 0] = (byte_data >> 6) & 0x03;
-			output_buffer[output_offset + (x * 4) + 1] = (byte_data >> 4) & 0x03;
-			output_buffer[output_offset + (x * 4) + 2] = (byte_data >> 2) & 0x03;
-			output_buffer[output_offset + (x * 4) + 3] = (byte_data >> 0) & 0x03;
-		}
-	}
-
-	return true;
-}
-
-} // namespace Gfx
-} // namespace Ultima2
-} // namespace Ultima
diff --git a/engines/ultima/ultima2/gfx/pic_decoder.h b/engines/ultima/ultima2/gfx/pic_decoder.h
deleted file mode 100644
index 6e7a395e986..00000000000
--- a/engines/ultima/ultima2/gfx/pic_decoder.h
+++ /dev/null
@@ -1,98 +0,0 @@
-
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-#ifndef ULTIMA2_GFX_PIC_DECODER_H
-#define ULTIMA2_GFX_PIC_DECODER_H
-
-#include "graphics/surface.h"
-#include "image/image_decoder.h"
-
-namespace Ultima {
-namespace Ultima2 {
-namespace Gfx {
-
-class PicDecoder : public Image::ImageDecoder {
-private:
-	Graphics::Palette _palette;
-	Graphics::Surface _surface;
-public:
-	~PicDecoder() {
-		destroy();
-	}
-
-	/**
-	 * Load an image from the specified stream.
-	 *
-	 * loadStream() should implicitly call destroy() to free the memory
-	 * of the last loadStream() call.
-	 *
-	 * @param stream  Input stream.
-	 *
-	 * @return Whether loading the file succeeded.
-	 *
-	 * @see getSurface
-	 * @see getPalette
-	 */
-	bool loadStream(Common::SeekableReadStream &stream) override;
-
-	/**
-	 * Destroy this decoder's surface and palette.
-	 *
-	 * This should be called by a loadStream() implementation as well
-	 * as by the destructor.
-	 */
-	void destroy() override {
-		_surface.free();
-	}
-
-	/**
-	 * Get the decoded surface.
-	 *
-	 * This surface is owned by this ImageDecoder and remains valid
-	 * until destroy() or loadStream() is called, or until the destructor of
-	 * this ImageDecoder is called.
-	 *
-	 * @return The decoded surface, or 0 if no surface is present.
-	 */
-	const Graphics::Surface *getSurface() const override {
-		return &_surface;
-	}
-
-	/**
-	 * Get the decoded palette.
-	 *
-	 * This palette is owned by this ImageDecoder and remains valid
-	 * until destroy() or loadStream() is called, or until the destructor of
-	 * this ImageDecoder is called.
-	 *
-	 * @return The decoded palette, or empty if no palette is present.
-	 */
-	const Graphics::Palette &getPalette() const override {
-		return _palette;
-	}
-};
-
-} // namespace Gfx
-} // namespace Ultima2
-} // namespace Ultima
-
-#endif
diff --git a/engines/ultima/ultima2/metaengine.cpp b/engines/ultima/ultima2/metaengine.cpp
index b68413fb35a..8ac5f7a7481 100644
--- a/engines/ultima/ultima2/metaengine.cpp
+++ b/engines/ultima/ultima2/metaengine.cpp
@@ -40,15 +40,11 @@ static const KeybindingRecord MINIMAL_KEYS[] = {
 	{ KEYBIND_NONE, nullptr, nullptr, nullptr, nullptr }
 };
 
-static const KeybindingRecord MENU_KEYS[] = {
-	{ KEYBIND_NONE, nullptr, nullptr, nullptr, nullptr }
-};
-
-static const KeybindingRecord OVERWORLD_KEYS[] = {
-	{ KEYBIND_NONE, nullptr, nullptr, nullptr, nullptr }
-};
-
-static const KeybindingRecord DUNGEON_KEYS[] = {
+static const KeybindingRecord GAMEPLAY_KEYS[] = {
+	{ KEYBIND_UP, "UP", _s("Up"), "UP", "JOY_UP"},
+	{ KEYBIND_DOWN, "DOWN", _s("Down"), "DOWN", "JOY_DOWN"},
+	{ KEYBIND_LEFT, "LEFT", _s("Left"), "LEFT", "JOY_LEFT"},
+	{ KEYBIND_RIGHT, "RIGHT", _s("Right"), "RIGHT", "JOY_RIGHT"},
 	{ KEYBIND_NONE, nullptr, nullptr, nullptr, nullptr }
 };
 
@@ -60,9 +56,7 @@ struct KeysRecord {
 
 static const KeysRecord ALL_RECORDS[] = {
 	{ "Ultima2", _s("Basic keys"), MINIMAL_KEYS },
-	{ "menu", _s("Menu keys"), MENU_KEYS },
-	{ "overworld", _s("Overworld keys"), OVERWORLD_KEYS },
-	{ "dungeon", _s("Dungeon keys"), DUNGEON_KEYS },
+	{ "gameplay", _s("Gameplay keys"), GAMEPLAY_KEYS },
 	{ nullptr, nullptr, nullptr }
 };
 
@@ -71,30 +65,9 @@ static const KeysRecord MINIMAL_RECORDS[] = {
 	{ nullptr, nullptr, nullptr }
 };
 
-static const KeysRecord MENU_RECORDS[] = {
-	{ "Ultima2", _s("Basic keys"), MINIMAL_KEYS },
-	{ "menu", _s("Menu keys"), MENU_KEYS },
-	{ nullptr, nullptr, nullptr }
-};
-
-static const KeysRecord OVERWORLD_RECORDS[] = {
-	{ "Ultima2", _s("Basic keys"), MINIMAL_KEYS },
-	{ "overworld", _s("Overworld keys"), OVERWORLD_KEYS },
-	{ nullptr, nullptr, nullptr }
-};
-
-static const KeysRecord DUNGEON_RECORDS[] = {
-	{ "Ultima2", _s("Basic keys"), MINIMAL_KEYS },
-	{ "dungeon", _s("Dungeon keys"), DUNGEON_KEYS },
-	{ nullptr, nullptr, nullptr }
-};
-
 static const KeysRecord *MODE_RECORDS[] = {
 	ALL_RECORDS,
-	MINIMAL_RECORDS,
-	MENU_RECORDS,
-	OVERWORLD_RECORDS,
-	DUNGEON_RECORDS,
+	MINIMAL_RECORDS
 };
 
 Common::KeymapArray MetaEngine::initKeymaps(KeybindingMode mode) {
@@ -119,12 +92,6 @@ Common::KeymapArray MetaEngine::initKeymaps(KeybindingMode mode) {
 			act->addDefaultInputMapping(r->_key);
 			if (r->_joy)
 				act->addDefaultInputMapping(r->_joy);
-			if (r->_action == KEYBIND_ENTER)
-				act->addDefaultInputMapping("x");	// x also works to eXit
-			else if (r->_action == KEYBIND_SELECT)
-				act->addDefaultInputMapping("RETURN");
-			else if (r->_action == KEYBIND_QUIT)
-				act->addDefaultInputMapping("p");	// Map "Pause" to Quit
 
 			if (r->_action == KEYBIND_UP || r->_action == KEYBIND_DOWN ||
 				r->_action == KEYBIND_LEFT || r->_action == KEYBIND_RIGHT)
diff --git a/engines/ultima/ultima2/metaengine.h b/engines/ultima/ultima2/metaengine.h
index 1fd35597c53..562872bf926 100644
--- a/engines/ultima/ultima2/metaengine.h
+++ b/engines/ultima/ultima2/metaengine.h
@@ -27,25 +27,17 @@
 namespace Ultima {
 namespace Ultima2 {
 
+// TODO: Extend with the full 26-command A-Z keyset once the base Logic
+// class and its command dispatch are added (see the ULTIMA2 implementation
+// plan, Stage 4).
 enum KeybindingAction {
 	KEYBIND_UP, KEYBIND_DOWN, KEYBIND_LEFT, KEYBIND_RIGHT,
-	KEYBIND_ESCAPE, KEYBIND_QUIT, KEYBIND_ENTER, KEYBIND_INFO,
-	KEYBIND_PASS, KEYBIND_ATTACK, KEYBIND_SWING, KEYBIND_THROW,
-	KEYBIND_AMULET1, KEYBIND_AMULET2, KEYBIND_AMULET3, KEYBIND_AMULET4,
-	KEYBIND_MINIMAP,
-
-	KEYBIND_SELECT, KEYBIND_FOOD, KEYBIND_RAPIER, KEYBIND_AXE,
-	KEYBIND_SHIELD, KEYBIND_BOW, KEYBIND_AMULET,
-
 	KEYBIND_NONE
 };
 
 enum KeybindingMode {
 	KBMODE_ALL,
-	KBMODE_MINIMAL,
-	KBMODE_MENUS,
-	KBMODE_OVERWORLD,
-	KBMODE_DUNGEONS
+	KBMODE_MINIMAL
 };
 
 class MetaEngine {
diff --git a/engines/ultima/ultima2/ultima2.cpp b/engines/ultima/ultima2/ultima2.cpp
index 922d2863229..b51b6045784 100644
--- a/engines/ultima/ultima2/ultima2.cpp
+++ b/engines/ultima/ultima2/ultima2.cpp
@@ -19,13 +19,7 @@
  *
  */
 
-#include "common/config-manager.h"
-#include "common/debug-channels.h"
-#include "common/events.h"
-#include "common/savefile.h"
-#include "common/system.h"
 #include "engines/util.h"
-#include "graphics/paletteman.h"
 #include "ultima/ultima2/ultima2.h"
 #include "ultima/ultima2/console.h"
 #include "ultima/ultima2/metaengine.h"
@@ -41,7 +35,6 @@ _gameDescription(gameDesc) {
 	g_engine = this;
 }
 
-
 Ultima2Engine::~Ultima2Engine() {
 }
 
@@ -69,25 +62,5 @@ Common::Error Ultima2Engine::run() {
 	return Common::kNoError;
 }
 
-Common::Error Ultima2Engine::syncGame(Common::Serializer &s) {
-	// The Serializer has methods isLoading() and isSaving()
-	// if you need to specific steps; for example setting
-	// an array size after reading it's length, whereas
-	// for saving it would write the existing array's length
-	int dummy = 0;
-	s.syncAsUint32LE(dummy);
-
-	return Common::kNoError;
-}
-
-bool Ultima2Engine::savegamesExist() const {
-	Common::String slotName = getSaveStateName(1);
-	Common::InSaveFile *saveFile = g_system->getSavefileManager()->openForLoading(slotName);
-	bool result = saveFile != nullptr;
-
-	delete saveFile;
-	return result;
-}
-
 } // namespace Ultima2
 } // namespace Ultima
diff --git a/engines/ultima/ultima2/ultima2.h b/engines/ultima/ultima2/ultima2.h
index 0d4715f5fab..8b43fda7f92 100644
--- a/engines/ultima/ultima2/ultima2.h
+++ b/engines/ultima/ultima2/ultima2.h
@@ -25,21 +25,10 @@
 #include "common/scummsys.h"
 #include "common/system.h"
 #include "common/error.h"
-#include "common/fs.h"
-#include "common/hash-str.h"
-#include "common/random.h"
-#include "common/serializer.h"
 #include "common/util.h"
 #include "engines/engine.h"
-#include "engines/savestate.h"
-#include "graphics/palette.h"
-#include "graphics/screen.h"
 #include "ultima/detection.h"
 #include "ultima/shared/engine/events.h"
-#include "ultima/ultima2/data/game.h"
-#include "ultima/ultima2/data/map.h"
-#include "ultima/ultima2/data/player.h"
-#include "ultima/ultima2/data/tiles.h"
 
 namespace Ultima {
 namespace Ultima2 {
@@ -61,12 +50,6 @@ protected:
 		return Engine::shouldQuit();
 	}
 
-public:
-	Data::Game _game;
-	Data::Map _map;
-	Data::Player _player;
-	Graphics::ManagedSurface _tiles[Data::TILE_COUNT];
-
 public:
 	Ultima2Engine(OSystem *syst, const Ultima::UltimaGameDescription *gameDesc);
 	~Ultima2Engine() override;
@@ -80,37 +63,8 @@ public:
 
 	bool hasFeature(EngineFeature f) const override {
 		return
-			(f == kSupportsLoadingDuringRuntime) ||
-			(f == kSupportsSavingDuringRuntime) ||
 			(f == kSupportsReturnToLauncher);
 	};
-
-	bool canLoadGameStateCurrently(Common::U32String *msg = nullptr) override {
-		return true;
-	}
-	bool canSaveGameStateCurrently(Common::U32String *msg = nullptr) override {
-		return true;
-	}
-
-	/**
-	 * Uses a serializer to allow implementing savegame
-	 * loading and saving using a single method
-	 */
-	Common::Error syncGame(Common::Serializer &s);
-
-	Common::Error saveGameStream(Common::WriteStream *stream, bool isAutosave = false) override {
-		Common::Serializer s(nullptr, stream);
-		return syncGame(s);
-	}
-	Common::Error loadGameStream(Common::SeekableReadStream *stream) override {
-		Common::Serializer s(stream, nullptr);
-		return syncGame(s);
-	}
-
-	/**
-	 * Returns true if any savegames exist
-	 */
-	bool savegamesExist() const;
 };
 
 extern Ultima2Engine *g_engine;
diff --git a/engines/ultima/ultima2/views/commands.cpp b/engines/ultima/ultima2/views/commands.cpp
deleted file mode 100644
index fe1b0c675cf..00000000000
--- a/engines/ultima/ultima2/views/commands.cpp
+++ /dev/null
@@ -1,49 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-#include "ultima/ultima2/views/commands.h"
-
-namespace Ultima {
-namespace Ultima2 {
-namespace Views {
-
-bool Commands::msgFocus(const FocusMessage &msg) {
-	// Get a surface. We'll maintain a persistent copy to maintain
-	// the text pos across multiple calls
-	_surface = getSurface();
-	_surface.clear();
-	_surface.setTextPos(Common::Point(0, 3));
-	_surface.setScrollable(true);
-
-	return true;
-}
-
-void Commands::writeString(const Common::String &msg) {
-	_surface.writeString(msg);
-}
-
-void Commands::prompt() {
-	writeString("CMD: ");
-}
-
-} // namespace Views
-} // namespace Ultima2
-} // namespace Ultima
diff --git a/engines/ultima/ultima2/views/commands.h b/engines/ultima/ultima2/views/commands.h
deleted file mode 100644
index aedc7277df6..00000000000
--- a/engines/ultima/ultima2/views/commands.h
+++ /dev/null
@@ -1,51 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-#ifndef ULTIMA2_VIEWS_COMMANDS_H
-#define ULTIMA2_VIEWS_COMMANDS_H
-
-#include "ultima/shared/engine/events.h"
-
-namespace Ultima {
-namespace Ultima2 {
-namespace Views {
-
-using namespace Shared::Messages;
-
-class Commands : public Shared::UIElement {
-private:
-	Shared::Gfx::GfxSurface _surface;
-
-public:
-	Commands(UIElement *parent) : Shared::UIElement("Commands", parent) {}
-	~Commands() override {}
-
-	bool msgFocus(const FocusMessage &msg) override;
-	void writeString(const Common::String &msg);
-
-	void prompt();
-};
-
-} // namespace Views
-} // namespace Ultima2
-} // namespace Ultima
-
-#endif
diff --git a/engines/ultima/ultima2/views/create_character.cpp b/engines/ultima/ultima2/views/create_character.cpp
deleted file mode 100644
index 404f3f60a94..00000000000
--- a/engines/ultima/ultima2/views/create_character.cpp
+++ /dev/null
@@ -1,216 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-#include "ultima/ultima2/views/create_character.h"
-#include "ultima/ultima2/ultima2.h"
-
-namespace Ultima {
-namespace Ultima2 {
-namespace Views {
-
-using namespace Data;
-
-static const byte POS[][2] = {
-	{ 26, 4 }, { 26, 5 }, { 26, 6 }, { 26, 7 }, { 26, 8 }, { 26, 9 },
-	{ 20, 11 }, { 20, 12 }, { 20, 13 }, { 20, 14 }, { 29, 16 }
-};
-
-bool CreateCharacter::msgFocus(const FocusMessage &msg) {
-	reset();
-	return true;
-}
-
-void CreateCharacter::reset() {
-	_cursorIndex = 0;
-	_pointsRemaining = POINTS_REMAINING;
-	_cursor.show(Point(POS[0][0], POS[0][1]), 2, true);
-}
-
-void CreateCharacter::done() {
-	// Unlike the original that took you back to the title screen after
-	// creating a character, since in ScummVM we allow multiple savegames,
-	// take the player directly in-game
-	g_engine->_game.startGame();
-}
-
-void CreateCharacter::draw() {
-	const Player &p = g_engine->_player;
-	auto s = getSurface();
-	s.clear();
-
-	s.writeString(Point(0, 0), "          PLAYER GENERATION :");
-	s.writeString(Point(0, 2), "     POINTS LEFT TO DISTRIBUTE : ");
-
-	// Display points remaining in reverse text
-	s.reverseColor();
-	s.writeString(Common::String::format("%.2d", _pointsRemaining));
-	s.reverseColor();
-
-	s.writeString(Point(0, 4), "           STRENGTH.......\n"
-		"           AGILITY........\n"
-		"           STAMINA........\n"
-		"           CHARISMA.......\n"
-		"           WISDOM.........\n"
-		"           INTELLIGENCE...\n\n"
-		"                M/F-\n"
-		"               RACE-\n"
-		"               TYPE-\n"
-		"               NAME-\n\n"
-		"          SATISFACTORY (Y/N)-\n\n"
-		"        RACES:         TYPES:\n"
-		"         1-HUMAN        1-FIGHTER\n"
-		"         2-ELF          2-CLERIC\n"
-		"         3-DWARF        3-WIZARD\n"
-		"         4-HOBBIT       4-THIEF");
-
-	// Attributes
-	if (_cursorIndex > 0)
-		s.writeString(Point(POS[0][0], POS[0][1]), Common::String::format("%.2d", p._strength));
-	if (_cursorIndex > 1)
-		s.writeString(Point(POS[1][0], POS[1][1]), Common::String::format("%.2d", p._agility));
-	if (_cursorIndex > 2)
-		s.writeString(Point(POS[2][0], POS[2][1]), Common::String::format("%.2d", p._stamina));
-	if (_cursorIndex > 3)
-		s.writeString(Point(POS[3][0], POS[3][1]), Common::String::format("%.2d", p._charisma));
-	if (_cursorIndex > 4)
-		s.writeString(Point(POS[4][0], POS[4][1]), Common::String::format("%.2d", p._wisdom));
-	if (_cursorIndex > 5)
-		s.writeString(Point(POS[5][0], POS[5][1]), Common::String::format("%.2d", p._intelligence));
-
-	// Other fields
-	if (_cursorIndex > 6)
-		s.writeString(Point(POS[6][0], POS[6][1]), SEX[p._sex]);
-	if (_cursorIndex > 7)
-		s.writeString(Point(POS[7][0], POS[7][1]), RACE[p._race]);
-	if (_cursorIndex > 8)
-		s.writeString(Point(POS[8][0], POS[8][1]), CLASS[p._class]);
-	if (_cursorIndex > 9)
-		s.writeString(Point(POS[9][0], POS[9][1]), p._name);
-}
-
-bool CreateCharacter::msgGame(const GameMessage &msg) {
-	if (msg._name != "INPUT")
-		return false;
-
-	Player &p = g_engine->_player;
-	char key = msg._stringValue.empty() ? 0 : toupper(msg._stringValue.firstChar());
-	int num = atoi(msg._stringValue.c_str());
-
-	switch (_cursorIndex) {
-	case 6:
-		if (key == 'M') {
-			p._sex = SEX_MALE;
-			p._strength += 5;		// Men are stronger
-			++_cursorIndex;
-		} else if (key == 'F') {
-			p._sex = SEX_FEMALE;
-			p._charisma += 10;		// Women are prettier
-			++_cursorIndex;
-		}
-		break;
-	case 7:
-		if (num >= 1 && num <= 4) {
-			p._race = (Race)num;
-			++_cursorIndex;
-
-			switch (p._race) {
-			case RACE_HUMAN:
-				p._intelligence += 5;
-				break;
-			case RACE_ELF:
-				p._agility += 5;
-				break;
-			case RACE_DWARF:
-				p._strength += 5;
-				break;
-			case RACE_HOBBIT:
-				p._wisdom += 10;
-				break;
-			}
-		}
-		break;
-	case 8:
-		if (num >= 1 && num <= 4) {
-			p._class = (Class)num;
-			++_cursorIndex;
-
-			switch (p._class) {
-			case CLASS_FIGHTER:
-				p._strength += 15;
-				break;
-			case CLASS_CLERIC:
-				p._wisdom += 10;
-				break;
-			case CLASS_WIZARD:
-				p._intelligence += 10;
-				break;
-			case CLASS_THIEF:
-				p._agility += 10;
-				break;
-			}
-		}
-		break;
-	case 9:
-		strcpy_s(p._name, msg._stringValue.c_str());
-		++_cursorIndex;
-		break;
-	case 10:
-		if (key == 'Y') {
-			done();
-		} else {
-			reset();
-		}
-		return true;
-	default:
-		// Attributes
-		switch (_cursorIndex) {
-		case 0: p._strength = num; break;
-		case 1: p._agility = num; break;
-		case 2: p._stamina = num; break;
-		case 3: p._charisma = num; break;
-		case 4: p._wisdom = num; break;
-		default: p._intelligence = num; break;
-		}
-
-		_pointsRemaining -= num;
-		if (_pointsRemaining < 0) {
-			reset();
-		} else {
-			++_cursorIndex;
-		}
-		break;
-	}
-
-	// Set the new cursor position
-	if (_cursorIndex < 6)
-		_cursor.show(Point(POS[_cursorIndex][0], POS[_cursorIndex][1]), 2, true);
-	else if (_cursorIndex == 9)
-		_cursor.show(Point(POS[_cursorIndex][0], POS[_cursorIndex][1]), MAX_NAME_LENGTH);
-	else
-		_cursor.show(Point(POS[_cursorIndex][0], POS[_cursorIndex][1]), 1);
-
-	redraw();
-	return true;
-}
-
-} // namespace Views
-} // namespace Ultima2
-} // namespace Ultima
diff --git a/engines/ultima/ultima2/views/create_character.h b/engines/ultima/ultima2/views/create_character.h
deleted file mode 100644
index c5ddd1e360c..00000000000
--- a/engines/ultima/ultima2/views/create_character.h
+++ /dev/null
@@ -1,59 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-#ifndef ULTIMA2_VIEWS_CREATE_CHARACTER_H
-#define ULTIMA2_VIEWS_CREATE_CHARACTER_H
-
-#include "ultima/shared/gfx/view.h"
-#include "ultima/shared/gfx/text_input.h"
-
-namespace Ultima {
-namespace Ultima2 {
-namespace Views {
-
-constexpr int POINTS_REMAINING = 90;
-
-using namespace Shared::Messages;
-
-class CreateCharacter : public Shared::Gfx::View {
-private:
-	Shared::Gfx::TextInput _cursor = Shared::Gfx::TextInput("Cursor", this);
-	int _pointsRemaining = POINTS_REMAINING;
-	int _cursorIndex = 0;	// Which figure waiting input for
-
-	void reset();
-	void done();
-
-public:
-	CreateCharacter() : View("CreateCharacter") {}
-	~CreateCharacter() override {}
-
-	bool msgFocus(const FocusMessage &msg) override;
-	void draw() override;
-
-	bool msgGame(const GameMessage &msg) override;
-};
-
-} // namespace Views
-} // namespace Ultima2
-} // namespace Ultima
-
-#endif
diff --git a/engines/ultima/ultima2/views/dead.cpp b/engines/ultima/ultima2/views/dead.cpp
deleted file mode 100644
index 62f17335eca..00000000000
--- a/engines/ultima/ultima2/views/dead.cpp
+++ /dev/null
@@ -1,34 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-#include "ultima/ultima2/views/dead.h"
-
-namespace Ultima {
-namespace Ultima2 {
-namespace Views {
-
-Dead::Dead() : View("Dead") {
-	setBounds(Common::Rect(0, 0, 0, 0));
-}
-
-} // namespace Views
-} // namespace Ultima2
-} // namespace Ultima
diff --git a/engines/ultima/ultima2/views/dead.h b/engines/ultima/ultima2/views/dead.h
deleted file mode 100644
index 5f790d9af36..00000000000
--- a/engines/ultima/ultima2/views/dead.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-#ifndef ULTIMA2_VIEWS_DEAD_H
-#define ULTIMA2_VIEWS_DEAD_H
-
-#include "ultima/shared/gfx/view.h"
-
-namespace Ultima {
-namespace Ultima2 {
-namespace Views {
-
-/**
- * Dummy view to go to when the player dies. This allows the game to know
- * not to allow saving anymore, and to stop on-screen map animations.
- */
-class Dead : public Shared::Gfx::View {
-public:
-	Dead();
-	~Dead() override {}
-};
-
-} // namespace Views
-} // namespace Ultima2
-} // namespace Ultima
-
-#endif
diff --git a/engines/ultima/ultima2/views/demo.cpp b/engines/ultima/ultima2/views/demo.cpp
deleted file mode 100644
index e4f106256b8..00000000000
--- a/engines/ultima/ultima2/views/demo.cpp
+++ /dev/null
@@ -1,106 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-#include "common/file.h"
-#include "ultima/ultima2/views/demo.h"
-#include "ultima/ultima2/gfx/pic_decoder.h"
-
-namespace Ultima {
-namespace Ultima2 {
-namespace Views {
-
-#define DELAY_SECONDS 3
-
-bool Demo::msgFocus(const FocusMessage &msg) {
-	_pageCtr = 0;
-	delaySeconds(DELAY_SECONDS);
-	return View::msgFocus(msg);
-}
-
-void Demo::timeout() {
-	_pageCtr = (_pageCtr + 1) % 8;
-	redraw();
-	delaySeconds(DELAY_SECONDS);
-}
-
-void Demo::draw() {
-	Gfx::PicDecoder decoder;
-	Common::File f;
-	auto s = getSurface();
-	s.clear();
-
-	if (_pageCtr < 5) {
-		static const char *FILENAMES[] = { "PICOUT", "PICTWN", "PICDNG", "PICSPA", "PICMIN" };
-
-		if (!f.open(FILENAMES[_pageCtr]) || !decoder.loadStream(f))
-			error("Could not load bitmap");
-		s.blitFrom(*decoder.getSurface());
-	}
-
-	switch (_pageCtr) {
-	case 0:
-		s.writeString(Common::Point(0, 23), "        BATTLE STRANGE CREATURES");
-		s.writeString(Common::Point(0, 24), "      ACROSS THE FACE OF THE EARTH");
-		break;
-
-	case 1:
-		s.writeString(Common::Point(0, 23), "   SEARCH FOR CLUES IN CARELESS WORDS");
-		s.writeString(Common::Point(0, 24), "      SPOKEN AT THE LOCAL PUB");
-		break;
-
-	case 2:
-		s.writeString(Common::Point(0, 23), "   TRAVERSE DEEP DARK DEADLY DUNGEONS");
-		s.writeString(Common::Point(0, 24), "      AND TALL TERRIFYING TOWERS");
-		break;
-
-	case 3:
-		s.writeString(Common::Point(0, 23), "      TRAVEL THROUGHOUT THE GALAXY");
-		s.writeString(Common::Point(0, 24), "  TO THE PLANETS OF OUR SOLAR SYSTEM");
-		break;
-
-	case 4:
-		s.writeString(Common::Point(0, 23), "   AND CONQUER TIME ITSELF TO BATTLE");
-		s.writeString(Common::Point(8, 24), "MINAX THE ENCHANTRESS");
-		break;
-
-	case 5:
-		s.writeString(Common::Point(16, 10), "ORIGIN");
-		s.writeString(Common::Point(12, 11), "PROUDLY PRESENTS");
-		break;
-
-	case 6:
-		s.writeString(Common::Point(16, 8), "PART ][");
-		s.writeString(Common::Point(9, 10), "OF THE #1 BEST SELLING");
-		s.writeString(Common::Point(7, 12), "FANTASY ROLE-PLAYING GAME");
-		s.writeString(Common::Point(12, 14), "BY LORD BRITISH");
-		break;
-
-	case 7:
-		if (!f.open("PICDRA") || !decoder.loadStream(f))
-			error("Could not load bitmap");
-		s.blitFrom(*decoder.getSurface());
-		break;
-	}
-}
-
-} // namespace Views
-} // namespace Ultima2
-} // namespace Ultima
diff --git a/engines/ultima/ultima2/views/demo.h b/engines/ultima/ultima2/views/demo.h
deleted file mode 100644
index 85ff840ee37..00000000000
--- a/engines/ultima/ultima2/views/demo.h
+++ /dev/null
@@ -1,66 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-#ifndef ULTIMA2_VIEWS_DEMO_H
-#define ULTIMA2_VIEWS_DEMO_H
-
-#include "ultima/shared/gfx/view.h"
-
-namespace Ultima {
-namespace Ultima2 {
-namespace Views {
-
-using namespace Shared::Messages;
-
-class Demo : public Shared::Gfx::View {
-private:
-	int _pageCtr = 0;
-
-	void showTitle() {
-		replaceView("Title");
-	}
-public:
-	Demo() : View("Demo") {}
-	~Demo() override {}
-
-	void draw() override;
-
-	bool msgFocus(const FocusMessage &msg) override;
-	void timeout() override;
-	bool msgKeypress(const KeypressMessage &msg) override {
-		showTitle();
-		return true;
-	}
-	bool msgMouseDown(const MouseDownMessage &msg) override {
-		showTitle();
-		return true;
-	}
-	bool msgAction(const ActionMessage &msg) override {
-		showTitle();
-		return true;
-	}
-};
-
-} // namespace Views
-} // namespace Ultima2
-} // namespace Ultima
-
-#endif
diff --git a/engines/ultima/ultima2/views/overworld.cpp b/engines/ultima/ultima2/views/overworld.cpp
deleted file mode 100644
index c7ee047fb60..00000000000
--- a/engines/ultima/ultima2/views/overworld.cpp
+++ /dev/null
@@ -1,129 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-#include "ultima/ultima2/views/overworld.h"
-#include "ultima/ultima2/ultima2.h"
-#include "ultima/ultima2/metaengine.h"
-
-namespace Ultima {
-namespace Ultima2 {
-namespace Views {
-
-Overworld::Overworld() : View("Overworld") {
-	_map.setBounds(TextRect(0, 0, 40, 20));
-	_commands.setBounds(TextRect(0, 20, 30, 24));
-	_stats.setBounds(TextRect(30, 20, 40, 24));
-}
-
-void Overworld::draw() {
-	// Clear map tiles so entire map is redrawn
-	auto &map = g_engine->_map;
-	map.clearTiles();
-
-	// Allow the child controls to draw
-	return View::draw();
-}
-
-bool Overworld::msgFocus(const FocusMessage &msg) {
-	const auto &player = g_engine->_player;
-	auto &map = g_engine->_map;
-	map.load(player._mapNum);
-
-	return View::msgFocus(msg);
-}
-
-bool Overworld::msgGame(const GameMessage &msg) {
-	const auto &player = g_engine->_player;
-
-	if (msg._name == "COMMAND") {
-		// Scroll the command area, and pause briefly so users can tell
-		// when multiple commands in sequence are happening
-		_mode = kModePreCommand;
-		_commands.writeString("\n");
-		delayFrames(1);
-		return true;
-	} else if (msg._name == "INFO") {
-		_commands.writeString(msg._stringValue);
-		return true;
-	} else if (msg._name == "DEAD") {
-		// Update the stats view immediately to reflect the deadness
-		_stats.draw();
-
-		// Add message to the commands view that the player died
-		_commands.writeString("\0x8d\0x8d\0x8d");
-		_commands.writeString(player._name);
-		_commands.writeString(" IS DEAD!");
-
-		// Switch to the invisible Dead view to freeze the screen
-		g_engine->replaceView("Dead");
-		return true;
-	} else if (msg._name == "CIRCLE") {
-		if (msg._stringValue == "UP")
-			_map.flashCircle(0, -1);
-		else if (msg._stringValue == "DOWN")
-			_map.flashCircle(0, 1);
-		else if (msg._stringValue == "LEFT")
-			_map.flashCircle(-1, 0);
-		else if (msg._stringValue == "RIGHT")
-			_map.flashCircle(1, 0);
-		else
-			_map.flashCircle(0, 0);
-		return true;
-	}
-
-	return View::msgGame(msg);
-}
-
-void Overworld::timeout() {
-	switch (_mode) {
-	case kModePreCommand:
-		// Display new command prompt
-		_mode = kModeCommand;
-		_commands.prompt();
-		delayFrames(Data::FRAMES_BEFORE_COMMAND_TIMEOUT);
-		break;
-	case kModeCommand:
-		// Timeout happened, so automatically select pass command
-		g_engine->_game.doCommand(KEYBIND_PASS);
-		break;
-	default:
-		break;
-	}
-}
-
-bool Overworld::msgAction(const ActionMessage &msg) {
-	auto &game = g_engine->_game;
-
-	// Stop command timeout
-	cancelDelay();
-
-	if (_mode == kModeAttackDirection) {
-		// TODO
-	} else {
-		game.doCommand(msg._action);
-	}
-
-	return true;
-}
-
-} // namespace Views
-} // namespace Ultima2
-} // namespace Ultima
diff --git a/engines/ultima/ultima2/views/overworld.h b/engines/ultima/ultima2/views/overworld.h
deleted file mode 100644
index 59bd67d051e..00000000000
--- a/engines/ultima/ultima2/views/overworld.h
+++ /dev/null
@@ -1,57 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-#ifndef ULTIMA2_VIEWS_OVERWORLD_H
-#define ULTIMA2_VIEWS_OVERWORLD_H
-
-#include "ultima/shared/gfx/view.h"
-#include "ultima/ultima2/views/overworld_map.h"
-#include "ultima/ultima2/views/commands.h"
-#include "ultima/ultima2/views/stats.h"
-
-namespace Ultima {
-namespace Ultima2 {
-namespace Views {
-
-class Overworld : public Shared::Gfx::View {
-	enum Mode { kModePreCommand, kModeCommand, kModeAttackDirection };
-private:
-	OverworldMap _map = OverworldMap(this);
-	Commands _commands = Commands(this);
-	Stats _stats = Stats(this);
-	Mode _mode = kModeCommand;
-
-public:
-	Overworld();
-	~Overworld() override {}
-
-	void draw() override;
-	bool msgFocus(const FocusMessage &msg) override;
-	bool msgGame(const GameMessage &msg) override;
-	bool msgAction(const ActionMessage &msg) override;
-	void timeout() override;
-};
-
-} // namespace Views
-} // namespace Ultima2
-} // namespace Ultima
-
-#endif
diff --git a/engines/ultima/ultima2/views/overworld_map.cpp b/engines/ultima/ultima2/views/overworld_map.cpp
deleted file mode 100644
index 91639e09172..00000000000
--- a/engines/ultima/ultima2/views/overworld_map.cpp
+++ /dev/null
@@ -1,187 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-#include "ultima/ultima2/views/overworld_map.h"
-#include "ultima/ultima2/ultima2.h"
-
-namespace Ultima {
-namespace Ultima2 {
-namespace Views {
-
-bool OverworldMap::msgFocus(const FocusMessage &msg) {
-	g_engine->_map.clearTiles();
-	delayFrames(1);
-	return UIElement::msgFocus(msg);
-}
-
-void OverworldMap::timeout() {
-	// Animate the water and forcefield tiles
-	animateTile(g_engine->_tiles[0]);
-	animateTile(g_engine->_tiles[23]);
-	redraw();
-
-	// Wait briefly before next tile animation
-	delayFrames(1);
-}
-
-void OverworldMap::animateTile(Graphics::ManagedSurface &tile) {
-	assert(tile.w == Data::TILE_WIDTH && tile.h == Data::TILE_HEIGHT);
-
-	// Rotate 2 rows upward (top 2 rows move to bottom)
-	const int ROWS_TO_ROTATE = 2;
-	const int BYTES_TO_ROTATE = Data::TILE_WIDTH * ROWS_TO_ROTATE;
-
-	// Temporary buffer to hold the rows being rotated
-	byte tempBuffer[Data::TILE_WIDTH * ROWS_TO_ROTATE];
-
-	byte *pixels = (byte *)tile.getPixels();
-
-	// Save the first ROWS_TO_ROTATE rows to temp buffer
-	memcpy(tempBuffer, pixels, BYTES_TO_ROTATE);
-
-	// Shift all remaining rows up
-	int remainingBytes = (tile.w * tile.h) - BYTES_TO_ROTATE;
-	memmove(pixels, pixels + BYTES_TO_ROTATE, remainingBytes);
-
-	// Copy saved rows to the end
-	memcpy(pixels + remainingBytes, tempBuffer, BYTES_TO_ROTATE);
-}
-
-void OverworldMap::draw() {
-	auto &map = g_engine->_map;
-	auto s = getSurface();
-
-	prepareMapForDrawing();
-
-	// Draw the visible map contents
-	for (int oy = 0; oy < Data::MAP_VISIBLE_HEIGHT; oy++) {
-		for (int ox = 0; ox < Data::MAP_VISIBLE_WIDTH; ox++) {
-			uint8 tileId = map._mapTilesId[oy][ox];
-			if (!(tileId & 0x80)) {
-				const Graphics::ManagedSurface &tileImg = g_engine->_tiles[tileId / 2];
-				s.blitFrom(tileImg, Common::Point(ox * Data::TILE_WIDTH, oy * Data::TILE_HEIGHT));
-			}
-		}
-	}
-
-	// Copy rendered tile IDs for next frame's dirty comparison
-	for (int oy = 0; oy < Data::MAP_VISIBLE_HEIGHT; oy++)
-		for (int ox = 0; ox < Data::MAP_VISIBLE_WIDTH; ox++)
-			map._priorTileIds[oy][ox] = map._mapTilesId[oy][ox] & 0x7F;
-}
-
-void OverworldMap::prepareMapForDrawing() {
-	// Load the map if it's not already active
-	auto &map = g_engine->_map;
-
-	//int mapOffsetX = 0, mapOffsetY = 0;
-	int mapLeft, mapTop;
-
-	if (map._outsideMapTile != -1) {
-		// Non-wrapping draw (used for indoor maps/dungeons with a border tile)
-		mapLeft = (map._mapX - 9) + 1;
-		mapTop = (map._mapY - 5) + 1;
-
-		for (int oy = 0; oy < Data::MAP_VISIBLE_HEIGHT; oy++) {
-			for (int ox = 0; ox < Data::MAP_VISIBLE_WIDTH; ox++) {
-				uint8 x = mapLeft + ox;
-				uint8 y = mapTop + oy;
-
-				uint8 tile;
-				if (x >= 64 || y >= 64) {
-					// Out of bounds: fill with the designated outside tile
-					tile = map._outsideMapTile;
-				} else {
-					tile = (map._tiles[y][x] / 2) & 0xfe;
-				}
-
-				if (tile == map._priorTileIds[oy][ox]) {
-					if (tile == 0) {
-						if (map._flag1 == 0xFF)
-							tile |= 0x80;
-					} else {
-						if (tile != 46)
-							tile |= 0x80;
-					}
-				}
-
-				map._mapTilesId[oy][ox] = tile;
-			}
-		}
-
-	} else {
-		// Normal (wrapping) draw - overworld map
-		mapTop = (map._mapY - 5) & 63;
-		mapLeft = (map._mapX - 9) & 63;
-
-		for (int oy = 0; oy < Data::MAP_VISIBLE_HEIGHT; oy++) {
-			for (int ox = 0; ox < Data::MAP_VISIBLE_WIDTH; ox++) {
-				uint8 x = (mapLeft + ox) & 63;
-				uint8 y = (mapTop + oy) & 63;
-				uint8 tile = (map._tiles[y][x] / 2) & 0xfe;
-
-				if (tile == map._priorTileIds[oy][ox]) {
-					if (tile == 0) {
-						if (map._flag1 == 0xFF)
-							tile |= 0x80;
-					} else {
-						if (tile != 46)
-							tile |= 0x80;
-					}
-				}
-
-				map._mapTilesId[oy][ox] = tile;
-			}
-		}
-	}
-
-	// Player is at center of the viewport. Save tiles around the player
-	map._tilePlayerCenter = map._mapTilesId[Data::MAP_VISIBLE_CENTER_Y][Data::MAP_VISIBLE_CENTER_X];
-	map._tilePlayerUp = map._mapTilesId[Data::MAP_VISIBLE_CENTER_Y - 1][Data::MAP_VISIBLE_CENTER_X];
-	map._tilePlayerDown = map._mapTilesId[Data::MAP_VISIBLE_CENTER_Y + 1][Data::MAP_VISIBLE_CENTER_X];
-	map._tilePlayerLeft = map._mapTilesId[Data::MAP_VISIBLE_CENTER_Y][Data::MAP_VISIBLE_CENTER_X - 1];
-	map._tilePlayerRight = map._mapTilesId[Data::MAP_VISIBLE_CENTER_Y][Data::MAP_VISIBLE_CENTER_X + 1];
-
-	// Place the player tile at the center
-	map._mapTilesId[Data::MAP_VISIBLE_CENTER_Y][Data::MAP_VISIBLE_CENTER_X] = map._playerTileId;
-}
-
-void OverworldMap::flashCircle(int deltaX, int deltaY) {
-	Common::Point pt((Data::MAP_VISIBLE_CENTER_X + deltaX) * Data::TILE_WIDTH,
-		(Data::MAP_VISIBLE_CENTER_Y + deltaY) * Data::TILE_HEIGHT);
-	auto s = getSurface();
-
-	// Show the circle
-	s.xorBlitFrom(g_engine->_tiles[Data::kTileCircle], pt);
-	g_engine->getScreen()->update();
-
-	// Brief pause
-	g_engine->pauseMillis();
-
-	// Remove it
-	s.xorBlitFrom(g_engine->_tiles[Data::kTileCircle], pt);
-	g_engine->getScreen()->update();
-}
-
-
-} // namespace Views
-} // namespace Ultima2
-} // namespace Ultima
diff --git a/engines/ultima/ultima2/views/overworld_map.h b/engines/ultima/ultima2/views/overworld_map.h
deleted file mode 100644
index 6ebfe276155..00000000000
--- a/engines/ultima/ultima2/views/overworld_map.h
+++ /dev/null
@@ -1,56 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-#ifndef ULTIMA2_VIEWS_OVERWORLD_MAP_H
-#define ULTIMA2_VIEWS_OVERWORLD_MAP_H
-
-#include "ultima/shared/engine/events.h"
-
-namespace Ultima {
-namespace Ultima2 {
-namespace Views {
-
-using namespace Shared::Messages;
-
-class OverworldMap : public Shared::UIElement {
-private:
-	void prepareMapForDrawing();
-	void animateTile(Graphics::ManagedSurface &tile);
-
-public:
-	OverworldMap(Shared::UIElement *parent) : Shared::UIElement("OverworldMap", parent) {}
-	~OverworldMap() override {}
-
-	bool msgFocus(const FocusMessage &msg) override;
-	void draw() override;
-	void timeout() override;
-
-	/**
-	 * Flash a circle at a specified tile delta to the map center
-	 */
-	void flashCircle(int deltaX, int deltaY);
-};
-
-} // namespace Views
-} // namespace Ultima2
-} // namespace Ultima
-
-#endif
diff --git a/engines/ultima/ultima2/views/startup.cpp b/engines/ultima/ultima2/views/startup.cpp
index 8d558e6ce57..6ea00b80979 100644
--- a/engines/ultima/ultima2/views/startup.cpp
+++ b/engines/ultima/ultima2/views/startup.cpp
@@ -19,56 +19,21 @@
  *
  */
 
-#include "common/file.h"
 #include "ultima/ultima2/views/startup.h"
-#include "ultima/ultima2/gfx/pic_decoder.h"
 
 namespace Ultima {
 namespace Ultima2 {
 namespace Views {
 
-#define DELAY_SECONDS 3
-
-bool Startup::msgFocus(const FocusMessage &msg) {
-	_pageCtr = 0;
-	delaySeconds(DELAY_SECONDS);
-	return View::msgFocus(msg);
-}
-
-void Startup::timeout() {
-	if (++_pageCtr == 3) {
-		showTitle();
-	} else {
-		redraw();
-		delaySeconds(DELAY_SECONDS);
-	}
-}
+#define COLOR_FOREGROUND 15 // white
 
 void Startup::draw() {
-	Gfx::PicDecoder decoder;
-	Common::File f;
 	auto s = getSurface();
 	s.clear();
 
-	switch (_pageCtr) {
-	case 0:
-		s.writeString(Common::Point(16, 10), "ORIGIN");
-		s.writeString(Common::Point(12, 11), "PROUDLY PRESENTS");
-		break;
-	case 1:
-		s.writeString(Common::Point(16, 8), "PART ][");
-		s.writeString(Common::Point(9, 10), "OF THE #1 BEST SELLING");
-		s.writeString(Common::Point(7, 12), "FANTASY ROLE-PLAYING GAME");
-		s.writeString(Common::Point(12, 14), "BY LORD BRITISH");
-		break;
-	case 2:
-		if (!f.open("PICDRA") || !decoder.loadStream(f))
-			error("Could not load bitmap");
-		s.blitFrom(*decoder.getSurface());
-		break;
-	case 3:
-		showTitle();
-	}
+	s.setColor(COLOR_FOREGROUND);
+	s.writeString(Common::Point(16, 8), "Ultima II");
+	s.writeString(Common::Point(8, 11), "The Revenge of the Enchantress");
 }
 
 } // namespace Views
diff --git a/engines/ultima/ultima2/views/startup.h b/engines/ultima/ultima2/views/startup.h
index 7b3b5866b29..1e9ca3c231e 100644
--- a/engines/ultima/ultima2/views/startup.h
+++ b/engines/ultima/ultima2/views/startup.h
@@ -28,35 +28,16 @@ namespace Ultima {
 namespace Ultima2 {
 namespace Views {
 
-using namespace Shared::Messages;
-
+/**
+ * Placeholder splash screen shown while the rest of the engine is being
+ * built up. Will be replaced by the real title screen sequence.
+ */
 class Startup : public Shared::Gfx::View {
-private:
-	int _pageCtr = 0;
-
-	void showTitle() {
-		replaceView("Title");
-	}
 public:
 	Startup() : View("Startup") {}
 	~Startup() override {}
 
 	void draw() override;
-
-	bool msgFocus(const FocusMessage &msg) override;
-	void timeout() override;
-	bool msgKeypress(const KeypressMessage &msg) override {
-		showTitle();
-		return true;
-	}
-	bool msgMouseDown(const MouseDownMessage &msg) override {
-		showTitle();
-		return true;
-	}
-	bool msgAction(const ActionMessage &msg) override {
-		showTitle();
-		return true;
-	}
 };
 
 } // namespace Views
diff --git a/engines/ultima/ultima2/views/stats.cpp b/engines/ultima/ultima2/views/stats.cpp
deleted file mode 100644
index af89041e19d..00000000000
--- a/engines/ultima/ultima2/views/stats.cpp
+++ /dev/null
@@ -1,50 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-#include "ultima/ultima2/views/stats.h"
-#include "ultima/ultima2/ultima2.h"
-
-namespace Ultima {
-namespace Ultima2 {
-namespace Views {
-
-void Stats::draw() {
-	const auto &p = g_engine->_player;
-	auto s = getSurface();
-	s.clear();
-
-	s.writeString("H.P.=");
-	if (p._hp < 100) s.reverseColor();
-	s.writeString(Common::String::format("%.4d", p._hp));
-	if (p._hp < 100) s.reverseColor();
-
-	s.writeString(Common::Point(0, 1), "FOOD=");
-	if (p._food < 100) s.reverseColor();
-	s.writeString(Common::String::format("%.4d", p._food));
-	if (p._food < 100) s.reverseColor();
-
-	s.writeString(Common::Point(0, 2), Common::String::format("EXP.=%.4d", p._experience));
-	s.writeString(Common::Point(0, 3), Common::String::format("GOLD=%.4d", p._gold));
-}
-
-} // namespace Views
-} // namespace Ultima2
-} // namespace Ultima
diff --git a/engines/ultima/ultima2/views/stats.h b/engines/ultima/ultima2/views/stats.h
deleted file mode 100644
index 7b7b690dc2b..00000000000
--- a/engines/ultima/ultima2/views/stats.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-#ifndef ULTIMA2_VIEWS_STATS_H
-#define ULTIMA2_VIEWS_STATS_H
-
-#include "ultima/shared/engine/events.h"
-
-namespace Ultima {
-namespace Ultima2 {
-namespace Views {
-
-class Stats : public Shared::UIElement {
-public:
-	Stats(UIElement *parent) : Shared::UIElement("Stats", parent) {}
-	~Stats() override {}
-
-	void draw() override;
-};
-
-} // namespace Views
-} // namespace Ultima2
-} // namespace Ultima
-
-#endif
diff --git a/engines/ultima/ultima2/views/title.cpp b/engines/ultima/ultima2/views/title.cpp
deleted file mode 100644
index 70c0e4d06cc..00000000000
--- a/engines/ultima/ultima2/views/title.cpp
+++ /dev/null
@@ -1,78 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-#include "ultima/ultima2/views/title.h"
-#include "ultima/ultima2/ultima2.h"
-
-namespace Ultima {
-namespace Ultima2 {
-namespace Views {
-
-bool Title::msgFocus(const FocusMessage &msg) {
-	_cursor.show();
-	return true;
-}
-
-void Title::draw() {
-	auto s = getSurface();
-	s.clear();
-
-	s.writeString(Common::Point(15, 1),  "ULTIMA ][");
-	s.writeString(Common::Point(16, 3),  "REVENGE");
-	s.writeString(Common::Point(16, 5),  "OF  THE");
-	s.writeString(Common::Point(14, 7),  "ENCHANTRESS");
-	s.writeString(Common::Point(6, 22),  "(C)-1983,1989 BY LORD BRITISH");
-	s.writeString(Common::Point(15, 23), "AND ORIGIN");
-	s.writeString(Common::Point(5, 11), "TYPE - ");
-	s.writeString(Common::Point(6, 13), "`D` - FOR A DEMONSTRATION");
-	s.writeString(Common::Point(6, 15), "`P` - PLAY A GAME OF ULTIMA ][");
-	s.writeString(Common::Point(6, 17), "`C` - CREATE A NEW CHARACTER");
-	s.writeString(Common::Point(5, 19), "CHOICE:");
-}
-
-bool Title::msgGame(const GameMessage &msg) {
-	char key = msg._stringValue.empty() ? 0 : toupper(msg._stringValue.firstChar());
-
-	switch (key) {
-	case 'D':
-		replaceView("Demo");
-		return true;
-	case 'C':
-		replaceView("CreateCharacter");
-		return true;
-	case 'P':
-		if (!g_engine->savegamesExist()) {
-			replaceView("CreateCharacter");
-		} else {
-			g_engine->loadGameDialog();
-		}
-		break;
-
-	default:
-		break;
-	}
-
-	return false;
-}
-
-} // namespace Views
-} // namespace Ultima2
-} // namespace Ultima
diff --git a/engines/ultima/ultima2/views/title.h b/engines/ultima/ultima2/views/title.h
deleted file mode 100644
index c64563d119b..00000000000
--- a/engines/ultima/ultima2/views/title.h
+++ /dev/null
@@ -1,53 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-#ifndef ULTIMA2_VIEWS_TITLE_H
-#define ULTIMA2_VIEWS_TITLE_H
-
-#include "ultima/shared/gfx/view.h"
-#include "ultima/shared/gfx/text_input.h"
-
-namespace Ultima {
-namespace Ultima2 {
-namespace Views {
-
-using namespace Shared::Messages;
-
-class Title : public Shared::Gfx::View {
-private:
-	Shared::Gfx::TextInput _cursor = Shared::Gfx::TextInput("Cursor", this,
-		Common::Point(12, 19), 1);
-
-public:
-	Title() : View("Title") {}
-	~Title() override {}
-
-	bool msgFocus(const FocusMessage &msg) override;
-	void draw() override;
-
-	bool msgGame(const GameMessage &msg) override;
-};
-
-} // namespace Views
-} // namespace Ultima2
-} // namespace Ultima
-
-#endif
diff --git a/engines/ultima/ultima2/views/views.h b/engines/ultima/ultima2/views/views.h
index 5a73c860b3e..bc4fd26cbc2 100644
--- a/engines/ultima/ultima2/views/views.h
+++ b/engines/ultima/ultima2/views/views.h
@@ -23,18 +23,14 @@
 #define ULTIMA2_VIEWS_H
 
 #include "ultima/shared/engine/events.h"
-#include "ultima/ultima2/views/create_character.h"
 #include "ultima/ultima2/views/startup.h"
-#include "ultima/ultima2/views/title.h"
 
 namespace Ultima {
 namespace Ultima2 {
 namespace Views {
 
 struct Views : public Shared::Views {
-	CreateCharacter _createCharacter;
 	Startup _startup;
-	Title _title;
 };
 
 } // namespace Views


Commit: d13b3b4b6c47d76aa76497b4b48fe2aa99d22645
    https://github.com/scummvm/scummvm/commit/d13b3b4b6c47d76aa76497b4b48fe2aa99d22645
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:40:54+11:00

Commit Message:
ULTIMA: Make shared/ engine/gfx objects unconditional in module.mk

I'd previously used ifdef ENABLE_ULTIMA1 || ENABLE_ULTIMA2 guard,
but it turns out that it isn't supported

Changed paths:
    engines/ultima/module.mk


diff --git a/engines/ultima/module.mk b/engines/ultima/module.mk
index 5cc650d3c65..c753594c11e 100644
--- a/engines/ultima/module.mk
+++ b/engines/ultima/module.mk
@@ -3,16 +3,12 @@ MODULE := engines/ultima
 MODULE_OBJS := \
 	metaengine.o \
 	shared/conf/xml_node.o \
-	shared/conf/xml_tree.o
-
-ifdef ENABLE_ULTIMA1 || ENABLE_ULTIMA2
-MODULE_OBJS += \
+	shared/conf/xml_tree.o \
 	shared/engine/events.o \
 	shared/engine/messages.o \
 	shared/gfx/gfx_surface.o \
 	shared/gfx/text_input.o \
 	shared/gfx/view.o
-endif
 
 ifdef ENABLE_AKALABETH
 MODULE_OBJS += \


Commit: 30206658544b151f1bbafcfe5a3cfbdd3c9842fd
    https://github.com/scummvm/scummvm/commit/30206658544b151f1bbafcfe5a3cfbdd3c9842fd
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:40:54+11:00

Commit Message:
ULTIMA: ULTIMA2: Add attract-mode title screen sequence

The two text screens, the PICDRA title picture, the main menu
(Demonstration / Play / Create character), and the PICOUT..PICMIN
demonstration slideshow.

Changed paths:
  A engines/ultima/ultima2/gfx/pic_decoder.cpp
  A engines/ultima/ultima2/gfx/pic_decoder.h
  A engines/ultima/ultima2/views/title.cpp
  A engines/ultima/ultima2/views/title.h
    engines/ultima/module.mk
    engines/ultima/ultima2/views/startup.cpp
    engines/ultima/ultima2/views/startup.h
    engines/ultima/ultima2/views/views.h


diff --git a/engines/ultima/module.mk b/engines/ultima/module.mk
index c753594c11e..2bebd5ebff0 100644
--- a/engines/ultima/module.mk
+++ b/engines/ultima/module.mk
@@ -111,7 +111,9 @@ MODULE_OBJS += \
 	ultima2/ultima2.o \
 	ultima2/console.o \
 	ultima2/metaengine.o \
-	ultima2/views/startup.o
+	ultima2/gfx/pic_decoder.o \
+	ultima2/views/startup.o \
+	ultima2/views/title.o
 endif
 
 ifdef ENABLE_ULTIMA4
diff --git a/engines/ultima/ultima2/gfx/pic_decoder.cpp b/engines/ultima/ultima2/gfx/pic_decoder.cpp
new file mode 100644
index 00000000000..7fbdd4f56e4
--- /dev/null
+++ b/engines/ultima/ultima2/gfx/pic_decoder.cpp
@@ -0,0 +1,69 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "common/stream.h"
+#include "ultima/ultima2/gfx/pic_decoder.h"
+
+namespace Ultima {
+namespace Ultima2 {
+namespace Gfx {
+
+constexpr int BANK_SIZE = 0x2000;  // reserved size of each interlaced CGA bank
+constexpr int BYTES_PER_ROW = 80;  // 320 pixels / 4 pixels-per-byte
+
+// CGA mode 4, palette 1, border/background color 0 (black)
+static const byte CGA_PALETTE1[4 * 3] = {
+	0x00, 0x00, 0x00, // 0: black
+	0x55, 0xff, 0xff, // 1: light cyan
+	0xff, 0x55, 0xff, // 2: light magenta
+	0xff, 0xff, 0xff  // 3: white
+};
+
+bool PicDecoder::loadStream(Common::SeekableReadStream &stream) {
+	destroy();
+	_surface.create(320, 200, Graphics::PixelFormat::createFormatCLUT8());
+	byte *output_buffer = (byte *)_surface.getPixels();
+
+	Common::Array<byte> data;
+	data.resize(stream.size());
+	stream.read(&data[0], stream.size());
+
+	for (int y = 0; y < 200; ++y) {
+		int bank = y & 1;
+		const byte *row = &data[bank * BANK_SIZE + (y / 2) * BYTES_PER_ROW];
+		byte *outputRow = output_buffer + y * 320;
+
+		for (int byteX = 0; byteX < BYTES_PER_ROW; ++byteX) {
+			byte b = row[byteX];
+			outputRow[byteX * 4 + 0] = (b >> 6) & 3;
+			outputRow[byteX * 4 + 1] = (b >> 4) & 3;
+			outputRow[byteX * 4 + 2] = (b >> 2) & 3;
+			outputRow[byteX * 4 + 3] = b & 3;
+		}
+	}
+
+	_palette = Graphics::Palette(CGA_PALETTE1, 4);
+	return true;
+}
+
+} // namespace Gfx
+} // namespace Ultima2
+} // namespace Ultima
diff --git a/engines/ultima/ultima2/gfx/pic_decoder.h b/engines/ultima/ultima2/gfx/pic_decoder.h
new file mode 100644
index 00000000000..8e422ad04db
--- /dev/null
+++ b/engines/ultima/ultima2/gfx/pic_decoder.h
@@ -0,0 +1,68 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef ULTIMA2_GFX_PIC_DECODER_H
+#define ULTIMA2_GFX_PIC_DECODER_H
+
+#include "graphics/palette.h"
+#include "graphics/surface.h"
+#include "image/image_decoder.h"
+
+namespace Ultima {
+namespace Ultima2 {
+namespace Gfx {
+
+/**
+ * Decodes Ultima II's raw "pic???" full-screen title/demo art: a literal
+ * 16384-byte dump of the CGA mode 4 (320x200, 4-color, palette 1)
+ * framebuffer segment -- two interleaved 8192-byte banks (even scanlines
+ * in the first, odd in the second), 2 bits/pixel, 4 pixels per byte,
+ * MSB-first.
+ */
+class PicDecoder : public Image::ImageDecoder {
+private:
+	Graphics::Palette _palette;
+	Graphics::Surface _surface;
+public:
+	~PicDecoder() {
+		destroy();
+	}
+
+	bool loadStream(Common::SeekableReadStream &stream) override;
+
+	void destroy() override {
+		_surface.free();
+	}
+
+	const Graphics::Surface *getSurface() const override {
+		return &_surface;
+	}
+
+	const Graphics::Palette &getPalette() const override {
+		return _palette;
+	}
+};
+
+} // namespace Gfx
+} // namespace Ultima2
+} // namespace Ultima
+
+#endif
diff --git a/engines/ultima/ultima2/views/startup.cpp b/engines/ultima/ultima2/views/startup.cpp
index 6ea00b80979..32f236f2bfc 100644
--- a/engines/ultima/ultima2/views/startup.cpp
+++ b/engines/ultima/ultima2/views/startup.cpp
@@ -25,8 +25,19 @@ namespace Ultima {
 namespace Ultima2 {
 namespace Views {
 
+#define DELAY_SECONDS 3
+
 #define COLOR_FOREGROUND 15 // white
 
+bool Startup::msgFocus(const FocusMessage &msg) {
+	delaySeconds(DELAY_SECONDS);
+	return View::msgFocus(msg);
+}
+
+void Startup::timeout() {
+	showTitle();
+}
+
 void Startup::draw() {
 	auto s = getSurface();
 	s.clear();
diff --git a/engines/ultima/ultima2/views/startup.h b/engines/ultima/ultima2/views/startup.h
index 1e9ca3c231e..7e17b6ef220 100644
--- a/engines/ultima/ultima2/views/startup.h
+++ b/engines/ultima/ultima2/views/startup.h
@@ -28,16 +28,37 @@ namespace Ultima {
 namespace Ultima2 {
 namespace Views {
 
+using namespace Shared::Messages;
+
 /**
- * Placeholder splash screen shown while the rest of the engine is being
- * built up. Will be replaced by the real title screen sequence.
+ * Brief ScummVM splash shown before handing off to the real attract-mode
+ * Title sequence.
  */
 class Startup : public Shared::Gfx::View {
+private:
+	void showTitle() {
+		replaceView("Title");
+	}
 public:
 	Startup() : View("Startup") {}
 	~Startup() override {}
 
 	void draw() override;
+
+	bool msgFocus(const FocusMessage &msg) override;
+	void timeout() override;
+	bool msgKeypress(const KeypressMessage &msg) override {
+		showTitle();
+		return true;
+	}
+	bool msgMouseDown(const MouseDownMessage &msg) override {
+		showTitle();
+		return true;
+	}
+	bool msgAction(const ActionMessage &msg) override {
+		showTitle();
+		return true;
+	}
 };
 
 } // namespace Views
diff --git a/engines/ultima/ultima2/views/title.cpp b/engines/ultima/ultima2/views/title.cpp
new file mode 100644
index 00000000000..d0b815f89de
--- /dev/null
+++ b/engines/ultima/ultima2/views/title.cpp
@@ -0,0 +1,243 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "common/file.h"
+#include "common/system.h"
+#include "graphics/paletteman.h"
+#include "ultima/ultima2/views/title.h"
+#include "ultima/ultima2/gfx/pic_decoder.h"
+
+namespace Ultima {
+namespace Ultima2 {
+namespace Views {
+
+// Color used for the picture-caption text, an index into the picture's
+// own 4-color CGA palette (see Gfx::PicDecoder) rather than the engine's
+// standard 16-color EGA one used for the plain text screens/menu
+constexpr int COLOR_CAPTION = 3; // white, within CGA_PALETTE1
+
+constexpr int COLOR_TEXT = 15; // white, within the standard EGA palette
+
+void Title::loadPic(const Common::String &filename) {
+	Gfx::PicDecoder decoder;
+	Common::File f;
+	if (!f.open(filename.c_str()) || !decoder.loadStream(f))
+		error("Could not load %s", filename.c_str());
+
+	_pic.create(320, 200);
+	_pic.blitFrom(*decoder.getSurface());
+	_picPalette = decoder.getPalette();
+}
+
+bool Title::msgFocus(const FocusMessage &msg) {
+	showState(TEXT1);
+	return View::msgFocus(msg);
+}
+
+bool Title::msgUnfocus(const UnfocusMessage &msg) {
+	_pic.free();
+	return View::msgUnfocus(msg);
+}
+
+void Title::showState(State state) {
+	_state = state;
+
+	switch (state) {
+	case TEXT1:
+		delaySeconds(3);
+		break;
+	case TEXT2:
+		delaySeconds(4);
+		break;
+	case PICDRA:
+		loadPic("PICDRA");
+		delaySeconds(3);
+		break;
+	case DEMO_OUT:
+		loadPic("PICOUT");
+		delaySeconds(5);
+		break;
+	case DEMO_TWN:
+		loadPic("PICTWN");
+		delaySeconds(5);
+		break;
+	case DEMO_DNG:
+		loadPic("PICDNG");
+		delaySeconds(5);
+		break;
+	case DEMO_SPA:
+		loadPic("PICSPA");
+		delaySeconds(5);
+		break;
+	case DEMO_MIN:
+		loadPic("PICMIN");
+		delaySeconds(5);
+		break;
+	case MENU:
+		// No timeout; this state waits indefinitely for a keypress
+		break;
+	}
+
+	redraw();
+}
+
+void Title::showMenu() {
+	showState(MENU);
+}
+
+void Title::draw() {
+	auto s = getSurface();
+	bool hasPicture = _state == PICDRA || _state >= DEMO_OUT;
+
+	if (hasPicture) {
+		g_system->getPaletteManager()->setPalette(_picPalette);
+		s.blitFrom(_pic);
+		s.setColor(COLOR_CAPTION);
+	} else {
+		g_system->getPaletteManager()->setPalette(Graphics::Palette::createEGAPalette());
+		s.clear();
+		s.setColor(COLOR_TEXT);
+	}
+
+	switch (_state) {
+	case TEXT1:
+		s.writeString(Common::Point(16, 10), "ORIGIN");
+		s.writeString(Common::Point(11, 12), "PROUDLY PRESENTS");
+		break;
+
+	case TEXT2:
+		s.writeString(Common::Point(16, 8), "PART ][");
+		s.writeString(Common::Point(9, 10), "OF THE #1 BEST SELLING");
+		s.writeString(Common::Point(7, 12), "FANTASY ROLE-PLAYING GAME");
+		s.writeString(Common::Point(12, 14), "BY LORD BRITISH");
+		break;
+
+	case PICDRA:
+		// Just the picture, no caption
+		break;
+
+	case DEMO_OUT:
+		s.writeString(Common::Point(0, 23), "        BATTLE STRANGE CREATURES");
+		s.writeString(Common::Point(0, 24), "      ACROSS THE FACE OF THE EARTH");
+		break;
+
+	case DEMO_TWN:
+		s.writeString(Common::Point(0, 23), "   SEARCH FOR CLUES IN CARELESS WORDS");
+		s.writeString(Common::Point(2, 24), "      SPOKEN AT THE LOCAL PUB");
+		break;
+
+	case DEMO_DNG:
+		s.writeString(Common::Point(0, 23), "   TRAVERSE DEEP DARK DEADLY DUNGEONS");
+		s.writeString(Common::Point(1, 24), "      AND TALL TERRIFYING TOWERS");
+		break;
+
+	case DEMO_SPA:
+		s.writeString(Common::Point(0, 23), "      TRAVEL THROUGHOUT THE GALAXY");
+		s.writeString(Common::Point(1, 24), "  TO THE PLANETS OF OUR SOLAR SYSTEM");
+		break;
+
+	case DEMO_MIN:
+		s.writeString(Common::Point(0, 23), "   AND CONQUER TIME ITSELF TO BATTLE");
+		s.writeString(Common::Point(8, 24), "MINAX THE ENCHANTRESS");
+		break;
+
+	case MENU:
+		s.writeString(Common::Point(15, 1), "ULTIMA ][");
+		s.writeString(Common::Point(16, 3), "REVENGE");
+		s.writeString(Common::Point(16, 5), "OF  THE");
+		s.writeString(Common::Point(14, 7), "ENCHANTRESS");
+		s.writeString(Common::Point(6, 22), "(C)-1983,1989 BY LORD BRITISH");
+		s.writeString(Common::Point(15, 23), "AND ORIGIN");
+		s.writeString(Common::Point(5, 11), "TYPE -");
+		s.writeString(Common::Point(6, 13), "'D' - FOR A DEMONSTRATION");
+		s.writeString(Common::Point(6, 15), "'P' - PLAY A GAME OF ULTIMA ][");
+		s.writeString(Common::Point(6, 17), "'C' - CREATE A NEW CHARACTER");
+		s.writeString(Common::Point(5, 19), "CHOICE:");
+		break;
+	}
+}
+
+void Title::timeout() {
+	switch (_state) {
+	case TEXT1:
+		showState(TEXT2);
+		break;
+	case TEXT2:
+		showState(PICDRA);
+		break;
+	case PICDRA:
+		// Once a demonstration has been started, loop straight back into
+		// it instead of showing the menu again
+		showState(_demoMode ? DEMO_OUT : MENU);
+		break;
+	case DEMO_OUT:
+		showState(DEMO_TWN);
+		break;
+	case DEMO_TWN:
+		showState(DEMO_DNG);
+		break;
+	case DEMO_DNG:
+		showState(DEMO_SPA);
+		break;
+	case DEMO_SPA:
+		showState(DEMO_MIN);
+		break;
+	case DEMO_MIN:
+		showState(TEXT1);
+		break;
+	case MENU:
+		break;
+	}
+}
+
+bool Title::msgKeypress(const KeypressMessage &msg) {
+	if (_state == MENU) {
+		switch (msg.keycode) {
+		case Common::KEYCODE_d:
+			_demoMode = true;
+			showState(DEMO_OUT);
+			break;
+		case Common::KEYCODE_p:
+			// TODO: play a saved game -- needs the Savegame/data model, added in a later stage
+			break;
+		case Common::KEYCODE_c:
+			// TODO: create a new character -- needs the Savegame/data model, added in a later stage
+			break;
+		default:
+			break;
+		}
+	} else {
+		showMenu();
+	}
+
+	return true;
+}
+
+bool Title::msgAction(const ActionMessage &msg) {
+	if (_state != MENU)
+		showMenu();
+
+	return true;
+}
+
+} // namespace Views
+} // namespace Ultima2
+} // namespace Ultima
diff --git a/engines/ultima/ultima2/views/title.h b/engines/ultima/ultima2/views/title.h
new file mode 100644
index 00000000000..b94ce0eb433
--- /dev/null
+++ b/engines/ultima/ultima2/views/title.h
@@ -0,0 +1,78 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef ULTIMA2_VIEWS_TITLE_H
+#define ULTIMA2_VIEWS_TITLE_H
+
+#include "graphics/managed_surface.h"
+#include "graphics/palette.h"
+#include "ultima/shared/gfx/view.h"
+
+namespace Ultima {
+namespace Ultima2 {
+namespace Views {
+
+using namespace Shared::Messages;
+
+/**
+ * The attract-mode sequence: two text screens ("ORIGIN / PROUDLY
+ * PRESENTS", "PART ][ / OF THE #1 BEST SELLING / ..."), the PICDRA title
+ * picture, then the main "ULTIMA ][ / REVENGE OF THE ENCHANTRESS" menu
+ * (Demonstration / Play / Create character). Choosing Demonstration
+ * cycles through the PICOUT..PICMIN slideshow before looping back to the
+ * start; pressing Escape at any point before the menu jumps straight to
+ * it.
+ */
+class Title : public Shared::Gfx::View {
+private:
+	enum State {
+		TEXT1, TEXT2, PICDRA, MENU,
+		DEMO_OUT, DEMO_TWN, DEMO_DNG, DEMO_SPA, DEMO_MIN
+	};
+	State _state = TEXT1;
+	bool _demoMode = false;
+
+	// The single picture currently on screen, if any (loaded lazily per state)
+	Graphics::ManagedSurface _pic;
+	Graphics::Palette _picPalette;
+
+	void loadPic(const Common::String &filename);
+	void showMenu();
+	void showState(State state);
+
+public:
+	Title() : View("Title") {}
+	~Title() override {}
+
+	bool msgFocus(const FocusMessage &msg) override;
+	bool msgUnfocus(const UnfocusMessage &msg) override;
+	void draw() override;
+	void timeout() override;
+
+	bool msgKeypress(const KeypressMessage &msg) override;
+	bool msgAction(const ActionMessage &msg) override;
+};
+
+} // namespace Views
+} // namespace Ultima2
+} // namespace Ultima
+
+#endif
diff --git a/engines/ultima/ultima2/views/views.h b/engines/ultima/ultima2/views/views.h
index bc4fd26cbc2..7ac6e99cf5b 100644
--- a/engines/ultima/ultima2/views/views.h
+++ b/engines/ultima/ultima2/views/views.h
@@ -24,6 +24,7 @@
 
 #include "ultima/shared/engine/events.h"
 #include "ultima/ultima2/views/startup.h"
+#include "ultima/ultima2/views/title.h"
 
 namespace Ultima {
 namespace Ultima2 {
@@ -31,6 +32,7 @@ namespace Views {
 
 struct Views : public Shared::Views {
 	Startup _startup;
+	Title _title;
 };
 
 } // namespace Views


Commit: efc920314899cd867cd47a760e30abc4d63b85e9
    https://github.com/scummvm/scummvm/commit/efc920314899cd867cd47a760e30abc4d63b85e9
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:40:54+11:00

Commit Message:
ULTIMA: ULTIMA2: Add blinking text cursor to the menu

Changed paths:
  A engines/ultima/ultima2/gfx/text_cursor.cpp
  A engines/ultima/ultima2/gfx/text_cursor.h
    engines/ultima/module.mk
    engines/ultima/ultima2/views/title.cpp
    engines/ultima/ultima2/views/title.h


diff --git a/engines/ultima/module.mk b/engines/ultima/module.mk
index 2bebd5ebff0..f62e4713100 100644
--- a/engines/ultima/module.mk
+++ b/engines/ultima/module.mk
@@ -112,6 +112,7 @@ MODULE_OBJS += \
 	ultima2/console.o \
 	ultima2/metaengine.o \
 	ultima2/gfx/pic_decoder.o \
+	ultima2/gfx/text_cursor.o \
 	ultima2/views/startup.o \
 	ultima2/views/title.o
 endif
diff --git a/engines/ultima/ultima2/gfx/text_cursor.cpp b/engines/ultima/ultima2/gfx/text_cursor.cpp
new file mode 100644
index 00000000000..c9beea3e247
--- /dev/null
+++ b/engines/ultima/ultima2/gfx/text_cursor.cpp
@@ -0,0 +1,70 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "ultima/ultima2/gfx/text_cursor.h"
+#include "ultima/shared/gfx/rect.h"
+
+namespace Ultima {
+namespace Ultima2 {
+namespace Gfx {
+
+#define DELAY_FRAMES 5
+
+constexpr int COLOR_CURSOR = 15; // white
+
+TextCursor::TextCursor(const Common::String &name, UIElement *parent) : UIElement(name, parent) {
+	setPosition(Common::Point(0, 0));
+	delayFrames(DELAY_FRAMES);
+}
+
+void TextCursor::show() {
+	_visible = true;
+	redraw();
+	delayFrames(DELAY_FRAMES);
+}
+
+void TextCursor::hide() {
+	_visible = false;
+	cancelDelay();
+	redraw();
+}
+
+void TextCursor::setPosition(const Common::Point &pt) {
+	setBounds(TextRect(pt.x, pt.y, pt.x, pt.y));
+}
+
+void TextCursor::draw() {
+	auto s = getSurface();
+	s.clear();
+
+	if (_visible)
+		s.fillRect(Common::Rect(0, 7, 8, 8), COLOR_CURSOR);
+}
+
+void TextCursor::timeout() {
+	_visible = !_visible;
+	redraw();
+	delayFrames(DELAY_FRAMES);
+}
+
+} // namespace Gfx
+} // namespace Ultima2
+} // namespace Ultima
diff --git a/engines/ultima/ultima2/gfx/text_cursor.h b/engines/ultima/ultima2/gfx/text_cursor.h
new file mode 100644
index 00000000000..a21698b2439
--- /dev/null
+++ b/engines/ultima/ultima2/gfx/text_cursor.h
@@ -0,0 +1,67 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef ULTIMA2_GFX_TEXT_CURSOR_H
+#define ULTIMA2_GFX_TEXT_CURSOR_H
+
+#include "ultima/shared/engine/events.h"
+
+namespace Ultima {
+namespace Ultima2 {
+namespace Gfx {
+
+/**
+ * Blinking text-input cursor shown after an input prompt (the main menu's
+ * "CHOICE:", and later character creation's text entry). Doesn't handle
+ * keypresses itself - that's left to whichever view owns it.
+ */
+class TextCursor : public Shared::UIElement {
+private:
+	bool _visible = true;
+
+public:
+	TextCursor(const Common::String &name, UIElement *parent = nullptr);
+	~TextCursor() override {}
+
+	void draw() override;
+	void timeout() override;
+
+	/**
+	 * Shows the cursor and (re)starts its blink cycle
+	 */
+	void show();
+
+	/**
+	 * Hides the cursor
+	 */
+	void hide();
+
+	/**
+	 * Sets the screen position of the cursor
+	 */
+	void setPosition(const Common::Point &pt);
+};
+
+} // namespace Gfx
+} // namespace Ultima2
+} // namespace Ultima
+
+#endif
diff --git a/engines/ultima/ultima2/views/title.cpp b/engines/ultima/ultima2/views/title.cpp
index d0b815f89de..4fe46938e25 100644
--- a/engines/ultima/ultima2/views/title.cpp
+++ b/engines/ultima/ultima2/views/title.cpp
@@ -36,6 +36,12 @@ constexpr int COLOR_CAPTION = 3; // white, within CGA_PALETTE1
 
 constexpr int COLOR_TEXT = 15; // white, within the standard EGA palette
 
+Title::Title() : View("Title"), _cursor("Cursor", this) {
+	// Position the cursor right after "CHOICE:"
+	_cursor.setPosition(Common::Point(12, 19));
+	_cursor.hide();
+}
+
 void Title::loadPic(const Common::String &filename) {
 	Gfx::PicDecoder decoder;
 	Common::File f;
@@ -59,6 +65,7 @@ bool Title::msgUnfocus(const UnfocusMessage &msg) {
 
 void Title::showState(State state) {
 	_state = state;
+	_cursor.hide();
 
 	switch (state) {
 	case TEXT1:
@@ -93,6 +100,7 @@ void Title::showState(State state) {
 		break;
 	case MENU:
 		// No timeout; this state waits indefinitely for a keypress
+		_cursor.show();
 		break;
 	}
 
diff --git a/engines/ultima/ultima2/views/title.h b/engines/ultima/ultima2/views/title.h
index b94ce0eb433..157bf0a9dfb 100644
--- a/engines/ultima/ultima2/views/title.h
+++ b/engines/ultima/ultima2/views/title.h
@@ -25,6 +25,7 @@
 #include "graphics/managed_surface.h"
 #include "graphics/palette.h"
 #include "ultima/shared/gfx/view.h"
+#include "ultima/ultima2/gfx/text_cursor.h"
 
 namespace Ultima {
 namespace Ultima2 {
@@ -38,8 +39,8 @@ using namespace Shared::Messages;
  * picture, then the main "ULTIMA ][ / REVENGE OF THE ENCHANTRESS" menu
  * (Demonstration / Play / Create character). Choosing Demonstration
  * cycles through the PICOUT..PICMIN slideshow before looping back to the
- * start; pressing Escape at any point before the menu jumps straight to
- * it.
+ * start; any keypress or action before the menu is reached jumps
+ * straight to it.
  */
 class Title : public Shared::Gfx::View {
 private:
@@ -54,12 +55,15 @@ private:
 	Graphics::ManagedSurface _pic;
 	Graphics::Palette _picPalette;
 
+	// Blinking cursor shown after "CHOICE:" while the menu is active
+	Gfx::TextCursor _cursor;
+
 	void loadPic(const Common::String &filename);
 	void showMenu();
 	void showState(State state);
 
 public:
-	Title() : View("Title") {}
+	Title();
 	~Title() override {}
 
 	bool msgFocus(const FocusMessage &msg) override;


Commit: 7138ee6240da8fa43a269347b60b1bdc777c4ce6
    https://github.com/scummvm/scummvm/commit/7138ee6240da8fa43a269347b60b1bdc777c4ce6
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:40:54+11:00

Commit Message:
ULTIMA: ULTIMA2: Add character creation and the Savegame data model

Changed paths:
  A engines/ultima/ultima2/data/data.h
  A engines/ultima/ultima2/data/savegame.h
  A engines/ultima/ultima2/views/create_character.cpp
  A engines/ultima/ultima2/views/create_character.h
    engines/ultima/module.mk
    engines/ultima/ultima2/ultima2.h
    engines/ultima/ultima2/views/title.cpp
    engines/ultima/ultima2/views/views.h


diff --git a/engines/ultima/module.mk b/engines/ultima/module.mk
index f62e4713100..caa33c59031 100644
--- a/engines/ultima/module.mk
+++ b/engines/ultima/module.mk
@@ -113,6 +113,7 @@ MODULE_OBJS += \
 	ultima2/metaengine.o \
 	ultima2/gfx/pic_decoder.o \
 	ultima2/gfx/text_cursor.o \
+	ultima2/views/create_character.o \
 	ultima2/views/startup.o \
 	ultima2/views/title.o
 endif
diff --git a/engines/ultima/ultima2/data/data.h b/engines/ultima/ultima2/data/data.h
new file mode 100644
index 00000000000..0ef460058a2
--- /dev/null
+++ b/engines/ultima/ultima2/data/data.h
@@ -0,0 +1,73 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef ULTIMA2_DATA_DATA_H
+#define ULTIMA2_DATA_DATA_H
+
+namespace Ultima {
+namespace Ultima2 {
+namespace Data {
+
+constexpr int MAX_NAME_LENGTH = 12;
+
+enum Sex {
+	SEX_MALE = 0, SEX_FEMALE = 1
+};
+enum Race {
+	RACE_HUMAN = 0, RACE_ELF = 1, RACE_DWARF = 2, RACE_HOBBIT = 3, RACE_COUNT = 4
+};
+enum CharClass {
+	CLASS_FIGHTER = 0, CLASS_CLERIC = 1, CLASS_WIZARD = 2, CLASS_THIEF = 3, CLASS_COUNT = 4
+};
+
+// Indexes into Savegame::_weaponOwned
+enum WeaponType {
+	WEAPON_HANDS = 0, WEAPON_DAGGER = 1, WEAPON_MACE = 2, WEAPON_AXE = 3, WEAPON_BOW = 4,
+	WEAPON_SWORD = 5, WEAPON_GREAT_SWORD = 6, WEAPON_LIGHT_SWORD = 7, WEAPON_PHASER = 8,
+	WEAPON_QUICK_SWORD = 9, WEAPON_COUNT = 10
+};
+
+// Indexes into Savegame::_armorOwned
+enum ArmorType {
+	ARMOR_SKIN = 0, ARMOR_CLOTH = 1, ARMOR_LEATHER = 2, ARMOR_CHAIN = 3, ARMOR_PLATE = 4,
+	ARMOR_REFLECT = 5, ARMOR_POWER = 6, ARMOR_COUNT = 7
+};
+
+// Indexes into Savegame::_spellCharges
+enum SpellType {
+	SPELL_NONE = 0, SPELL_LIGHT = 1, SPELL_DOWN_LADDER = 2, SPELL_UP_LADDER = 3, SPELL_PASSWALL = 4,
+	SPELL_SURFACE = 5, SPELL_PRAYER = 6, SPELL_MAGIC_MISSILE = 7, SPELL_BLINK = 8, SPELL_KILL = 9,
+	SPELL_COUNT = 10
+};
+
+// Indexes into Savegame::_items
+enum ItemType {
+	ITEM_RING = 0, ITEM_WAND = 1, ITEM_STAFF = 2, ITEM_BOOTS = 3, ITEM_CLOAK = 4, ITEM_HELM = 5,
+	ITEM_GEM = 6, ITEM_ANKH = 7, ITEM_RED_GEM = 8, ITEM_SKULL_KEY = 9, ITEM_GREEN_GEM = 10,
+	ITEM_BRASS_BUTTON = 11, ITEM_BLUE_TASSLE = 12, ITEM_STRANGE_COIN = 13, ITEM_GREEN_IDOL = 14,
+	ITEM_TRI_LITHIUM = 15, ITEM_COUNT = 16
+};
+
+} // namespace Data
+} // namespace Ultima2
+} // namespace Ultima
+
+#endif
diff --git a/engines/ultima/ultima2/data/savegame.h b/engines/ultima/ultima2/data/savegame.h
new file mode 100644
index 00000000000..231d8c4a6ae
--- /dev/null
+++ b/engines/ultima/ultima2/data/savegame.h
@@ -0,0 +1,100 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef ULTIMA2_DATA_SAVEGAME_H
+#define ULTIMA2_DATA_SAVEGAME_H
+
+#include "ultima/ultima2/data/data.h"
+
+namespace Ultima {
+namespace Ultima2 {
+namespace Data {
+
+/**
+ * The player character's savegame data
+ */
+struct Savegame {
+	// Identity
+	char _name[MAX_NAME_LENGTH + 1] = {};
+	Sex _sex = SEX_MALE;
+	Race _race = RACE_HUMAN;
+	CharClass _class = CLASS_FIGHTER;
+
+	// Attributes
+	int16 _strength = 0;
+	int16 _agility = 0;
+	int16 _stamina = 0;
+	int16 _charisma = 0;
+	int16 _wisdom = 0;
+	int16 _intelligence = 0;
+
+	// Resources
+	int16 _hp = 0;
+	int16 _food = 0;
+	int16 _foodTurnCtr = 0;
+	int16 _experience = 0;
+	int16 _gold = 0;
+
+	// Position - _mapNum1/_mapNum2 select the current mapX??/monX??/tlkX???
+	// file; _mapX/_mapY are the player's position within it
+	byte _mapNum1 = 0;
+	byte _mapNum2 = 0;
+	byte _mapX = 0;
+	byte _mapY = 0;
+
+	// Currently readied items
+	WeaponType _readiedWeapon = WEAPON_HANDS;
+	ArmorType _readiedArmor = ARMOR_SKIN;
+	SpellType _readiedSpell = SPELL_NONE;
+
+	// Consumable resources dropped by monster kills
+	int16 _torches = 0;
+	int16 _keys = 0;
+	int16 _thievesTools = 0;
+
+	// Outer space
+	bool _inSpace = false;
+	byte _launchMapX = 0;
+	byte _launchMapY = 0;
+
+	bool _saveDisabled = false;
+	// -1 when not orbiting/in deep space; 0-8 selects a planet being
+	// orbited; 9 gates a one-off castle NPC interaction
+	int16 _orbitTarget = -1;
+
+	bool _ringQuestFlag = false;
+	bool _enilnoOwned = false;
+	byte _patrolWaypoint = 0;
+
+	byte _offerRewardItems[9] = {};
+
+	// Inventory quantities/charges, indexed by the enums in data.h
+	int16 _armorOwned[ARMOR_COUNT] = {};
+	int16 _weaponOwned[WEAPON_COUNT] = {};
+	int16 _spellCharges[SPELL_COUNT] = {};
+	int16 _items[ITEM_COUNT] = {};
+};
+
+} // namespace Data
+} // namespace Ultima2
+} // namespace Ultima
+
+#endif
diff --git a/engines/ultima/ultima2/ultima2.h b/engines/ultima/ultima2/ultima2.h
index 8b43fda7f92..d962216fab0 100644
--- a/engines/ultima/ultima2/ultima2.h
+++ b/engines/ultima/ultima2/ultima2.h
@@ -29,6 +29,7 @@
 #include "engines/engine.h"
 #include "ultima/detection.h"
 #include "ultima/shared/engine/events.h"
+#include "ultima/ultima2/data/savegame.h"
 
 namespace Ultima {
 namespace Ultima2 {
@@ -50,6 +51,9 @@ protected:
 		return Engine::shouldQuit();
 	}
 
+public:
+	Data::Savegame _savegame;
+
 public:
 	Ultima2Engine(OSystem *syst, const Ultima::UltimaGameDescription *gameDesc);
 	~Ultima2Engine() override;
@@ -68,6 +72,7 @@ public:
 };
 
 extern Ultima2Engine *g_engine;
+#define _G(X) (Ultima2::g_engine->_##X)
 
 } // namespace Ultima2
 } // namespace Ultima
diff --git a/engines/ultima/ultima2/views/create_character.cpp b/engines/ultima/ultima2/views/create_character.cpp
new file mode 100644
index 00000000000..90714107dea
--- /dev/null
+++ b/engines/ultima/ultima2/views/create_character.cpp
@@ -0,0 +1,343 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "ultima/ultima2/views/create_character.h"
+#include "ultima/ultima2/ultima2.h"
+
+namespace Ultima {
+namespace Ultima2 {
+namespace Views {
+
+constexpr int COLOR_TEXT = 15; // white
+
+constexpr int STARTING_POINTS = 90;
+constexpr int MIN_ATTRIBUTE = 10;
+
+static const char *raceName(Data::Race race) {
+	switch (race) {
+	case Data::RACE_HUMAN: return "HUMAN";
+	case Data::RACE_ELF: return "ELF";
+	case Data::RACE_DWARF: return "DWARF";
+	case Data::RACE_HOBBIT: return "HOBBIT";
+	default: return "";
+	}
+}
+
+static const char *className(Data::CharClass charClass) {
+	switch (charClass) {
+	case Data::CLASS_FIGHTER: return "FIGHTER";
+	case Data::CLASS_CLERIC: return "CLERIC";
+	case Data::CLASS_WIZARD: return "WIZARD";
+	case Data::CLASS_THIEF: return "THIEF";
+	default: return "";
+	}
+}
+
+CreateCharacter::CreateCharacter() : View("CreateCharacter"), _cursor("Cursor", this) {
+}
+
+bool CreateCharacter::msgFocus(const FocusMessage &msg) {
+	reset();
+	return View::msgFocus(msg);
+}
+
+void CreateCharacter::reset() {
+	_state = STRENGTH;
+	_pointsRemaining = STARTING_POINTS;
+	_digitCount = 0;
+	_name.clear();
+
+	_G(savegame) = Data::Savegame();
+	positionCursor();
+	redraw();
+}
+
+void CreateCharacter::rejectEntry() {
+	// TODO: play the original's triple-beep failure sound once sound
+	// effects are implemented
+	reset();
+}
+
+void CreateCharacter::enterStat(int value) {
+	if (value < MIN_ATTRIBUTE || value > _pointsRemaining) {
+		rejectEntry();
+		return;
+	}
+
+	_pointsRemaining -= value;
+	Data::Savegame &sg = _G(savegame);
+
+	switch (_state) {
+	case STRENGTH:
+		sg._strength = value;
+		_state = AGILITY;
+		break;
+	case AGILITY:
+		sg._agility = value;
+		_state = STAMINA;
+		break;
+	case STAMINA:
+		sg._stamina = value;
+		_state = CHARISMA;
+		break;
+	case CHARISMA:
+		sg._charisma = value;
+		_state = WISDOM;
+		break;
+	case WISDOM:
+		sg._wisdom = value;
+		_state = INTELLIGENCE;
+		break;
+	case INTELLIGENCE:
+		sg._intelligence = value;
+		_state = SEX;
+		break;
+	default:
+		break;
+	}
+
+	_digitCount = 0;
+	positionCursor();
+	redraw();
+}
+
+void CreateCharacter::positionCursor() {
+	switch (_state) {
+	case STRENGTH: case AGILITY: case STAMINA:
+	case CHARISMA: case WISDOM: case INTELLIGENCE:
+		_cursor.setPosition(Common::Point(26 + _digitCount, 4 + (int)_state));
+		break;
+	case SEX:
+		_cursor.setPosition(Common::Point(20, 11));
+		break;
+	case RACE:
+		_cursor.setPosition(Common::Point(20, 12));
+		break;
+	case CLASS:
+		_cursor.setPosition(Common::Point(20, 13));
+		break;
+	case NAME:
+		_cursor.setPosition(Common::Point((int16)(20 + _name.size()), 14));
+		break;
+	case CONFIRM:
+		_cursor.setPosition(Common::Point(29, 16));
+		break;
+	case DONE:
+		_cursor.hide();
+		return;
+	}
+
+	_cursor.show();
+}
+
+void CreateCharacter::draw() {
+	auto s = getSurface();
+	s.clear();
+	s.setColor(COLOR_TEXT);
+
+	if (_state == DONE) {
+		drawDone(s);
+		return;
+	}
+
+	Data::Savegame &sg = _G(savegame);
+
+	s.writeString(Common::Point(10, 1), "PLAYER GENERATION :");
+
+	s.writeString(Common::Point(5, 2), "POINTS LEFT TO DISTRIBUTE : ");
+	s.reverseColor();
+	s.writeString(Common::Point(33, 2), "%d", _pointsRemaining);
+	s.reverseColor();
+
+	s.writeString(Common::Point(11, 4), "STRENGTH.......");
+	s.writeString(Common::Point(11, 5), "AGILITY........");
+	s.writeString(Common::Point(11, 6), "STAMINA........");
+	s.writeString(Common::Point(11, 7), "CHARISMA.......");
+	s.writeString(Common::Point(11, 8), "WISDOM.........");
+	s.writeString(Common::Point(11, 9), "INTELLIGENCE...");
+
+	if (_state > STRENGTH) s.writeString(Common::Point(26, 4), "%d", sg._strength);
+	if (_state > AGILITY) s.writeString(Common::Point(26, 5), "%d", sg._agility);
+	if (_state > STAMINA) s.writeString(Common::Point(26, 6), "%d", sg._stamina);
+	if (_state > CHARISMA) s.writeString(Common::Point(26, 7), "%d", sg._charisma);
+	if (_state > WISDOM) s.writeString(Common::Point(26, 8), "%d", sg._wisdom);
+	if (_state > INTELLIGENCE) s.writeString(Common::Point(26, 9), "%d", sg._intelligence);
+
+	// The digits typed so far for whichever attribute is currently active
+	if (_state <= INTELLIGENCE && _digitCount > 0) {
+		Common::String digits;
+		for (int i = 0; i < _digitCount; ++i)
+			digits += (char)('0' + _digits[i]);
+		s.writeString(Common::Point(26, 4 + (int)_state), digits);
+	}
+
+	s.writeString(Common::Point(16, 11), "M/F-");
+	s.writeString(Common::Point(15, 12), "RACE-");
+	s.writeString(Common::Point(15, 13), "TYPE-");
+	s.writeString(Common::Point(15, 14), "NAME-");
+
+	if (_state > SEX)
+		s.writeString(Common::Point(20, 11), sg._sex == Data::SEX_MALE ? "MALE" : "FEMALE");
+	if (_state > RACE)
+		s.writeString(Common::Point(20, 12), raceName(sg._race));
+	if (_state > CLASS)
+		s.writeString(Common::Point(20, 13), className(sg._class));
+	if (_state >= NAME)
+		s.writeString(Common::Point(20, 14), _name);
+
+	s.writeString(Common::Point(10, 16), "SATISFACTORY (Y/N)-");
+
+	s.writeString(Common::Point(8, 18), "RACES:         TYPES:");
+	s.writeString(Common::Point(9, 19), "1-HUMAN        1-FIGHTER");
+	s.writeString(Common::Point(9, 20), "2-ELF          2-CLERIC");
+	s.writeString(Common::Point(9, 21), "3-DWARF        3-WIZARD");
+	s.writeString(Common::Point(9, 22), "4-HOBBIT       4-THIEF");
+}
+
+void CreateCharacter::drawDone(Shared::Gfx::GfxSurface &s) {
+	Data::Savegame &sg = _G(savegame);
+
+	s.writeString(Common::Point(10, 2), "CHARACTER CREATED");
+	s.writeString(Common::Point(4, 4), "NAME: %s", sg._name);
+	s.writeString(Common::Point(4, 5), "%s %s %s",
+		sg._sex == Data::SEX_MALE ? "MALE" : "FEMALE", raceName(sg._race), className(sg._class));
+	s.writeString(Common::Point(4, 7), "STR:%d AGL:%d STA:%d", sg._strength, sg._agility, sg._stamina);
+	s.writeString(Common::Point(4, 8), "CHR:%d WIS:%d INT:%d", sg._charisma, sg._wisdom, sg._intelligence);
+	s.writeString(Common::Point(4, 10), "HP:%d FOOD:%d GOLD:%d", sg._hp, sg._food, sg._gold);
+
+	s.writeString(Common::Point(4, 13), "PRESS ANY KEY TO RETURN TO THE MENU");
+}
+
+bool CreateCharacter::msgKeypress(const KeypressMessage &msg) {
+	Data::Savegame &sg = _G(savegame);
+
+	switch (_state) {
+	case STRENGTH:
+	case AGILITY:
+	case STAMINA:
+	case CHARISMA:
+	case WISDOM:
+	case INTELLIGENCE:
+		if (msg.ascii < '0' || msg.ascii > '9')
+			break;
+		_digits[_digitCount++] = msg.ascii - '0';
+		if (_digitCount == 2) {
+			enterStat(_digits[0] * 10 + _digits[1]);
+		} else {
+			positionCursor();
+			redraw();
+		}
+		break;
+
+	case SEX:
+		if (toupper(msg.ascii) == 'M') {
+			sg._sex = Data::SEX_MALE;
+			sg._strength += 5;
+			_state = RACE;
+			positionCursor();
+			redraw();
+		} else if (toupper(msg.ascii) == 'F') {
+			sg._sex = Data::SEX_FEMALE;
+			sg._charisma += 16;
+			_state = RACE;
+			positionCursor();
+			redraw();
+		}
+		break;
+
+	case RACE:
+		if (msg.ascii >= '1' && msg.ascii <= '4') {
+			sg._race = (Data::Race)(msg.ascii - '1');
+			switch (sg._race) {
+			case Data::RACE_HUMAN: sg._intelligence += 5; break;
+			case Data::RACE_ELF: sg._agility += 5; break;
+			case Data::RACE_DWARF: sg._strength += 5; break;
+			case Data::RACE_HOBBIT: sg._wisdom += 16; break;
+			default: break;
+			}
+			_state = CLASS;
+			positionCursor();
+			redraw();
+		}
+		break;
+
+	case CLASS:
+		if (msg.ascii >= '1' && msg.ascii <= '4') {
+			sg._class = (Data::CharClass)(msg.ascii - '1');
+			switch (sg._class) {
+			case Data::CLASS_FIGHTER: sg._strength += 21; break;
+			case Data::CLASS_CLERIC: sg._wisdom += 16; break;
+			case Data::CLASS_WIZARD: sg._intelligence += 16; break;
+			case Data::CLASS_THIEF: sg._agility += 16; break;
+			default: break;
+			}
+			_state = NAME;
+			positionCursor();
+			redraw();
+		}
+		break;
+
+	case NAME:
+		if (msg.ascii == 8) { // backspace
+			if (!_name.empty())
+				_name.deleteLastChar();
+			positionCursor();
+			redraw();
+		} else if (msg.ascii == 13) { // enter
+			_state = CONFIRM;
+			positionCursor();
+			redraw();
+		} else if (msg.ascii >= 32 && msg.ascii < 127 && (int)_name.size() < Data::MAX_NAME_LENGTH) {
+			_name += (char)msg.ascii;
+			positionCursor();
+			redraw();
+		}
+		break;
+
+	case CONFIRM:
+		if (toupper(msg.ascii) == 'N') {
+			reset();
+		} else if (toupper(msg.ascii) == 'Y') {
+			Common::strlcpy(sg._name, _name.c_str(), sizeof(sg._name));
+			sg._hp = 400;
+			sg._food = 400;
+			sg._gold = 400;
+			sg._mapX = 20;
+			sg._mapY = 20;
+			sg._mapNum1 = 2;
+			sg._mapNum2 = 0;
+			_state = DONE;
+			positionCursor();
+			redraw();
+		}
+		break;
+
+	case DONE:
+		replaceView("Title");
+		break;
+	}
+
+	return true;
+}
+
+} // namespace Views
+} // namespace Ultima2
+} // namespace Ultima
diff --git a/engines/ultima/ultima2/views/create_character.h b/engines/ultima/ultima2/views/create_character.h
new file mode 100644
index 00000000000..50be05c5462
--- /dev/null
+++ b/engines/ultima/ultima2/views/create_character.h
@@ -0,0 +1,77 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef ULTIMA2_VIEWS_CREATE_CHARACTER_H
+#define ULTIMA2_VIEWS_CREATE_CHARACTER_H
+
+#include "ultima/shared/gfx/view.h"
+#include "ultima/ultima2/gfx/text_cursor.h"
+
+namespace Ultima {
+namespace Ultima2 {
+namespace Views {
+
+using namespace Shared::Messages;
+
+/**
+ * Point-buy character creation: six attributes distributed from a shared
+ * pool of 90 points (each at least 10), sex, race, class - each of which
+ * adds its own bonus to a particular attribute - then a name and a final
+ * confirmation. Any invalid attribute entry (below 10, or more than the
+ * remaining pool) discards all progress and starts over, matching the
+ * harsh but simple validation of the original.
+ */
+class CreateCharacter : public Shared::Gfx::View {
+private:
+	enum State {
+		STRENGTH, AGILITY, STAMINA, CHARISMA, WISDOM, INTELLIGENCE,
+		SEX, RACE, CLASS, NAME, CONFIRM, DONE
+	};
+	State _state = STRENGTH;
+
+	int _pointsRemaining = 0;
+	int _digits[2] = { 0, 0 };
+	int _digitCount = 0;
+	Common::String _name;
+
+	// Blinking cursor, tracking whichever field is currently being entered
+	Gfx::TextCursor _cursor;
+
+	void reset();
+	void rejectEntry();
+	void enterStat(int value);
+	void positionCursor();
+	void drawDone(Shared::Gfx::GfxSurface &s);
+
+public:
+	CreateCharacter();
+	~CreateCharacter() override {}
+
+	bool msgFocus(const FocusMessage &msg) override;
+	void draw() override;
+	bool msgKeypress(const KeypressMessage &msg) override;
+};
+
+} // namespace Views
+} // namespace Ultima2
+} // namespace Ultima
+
+#endif
diff --git a/engines/ultima/ultima2/views/title.cpp b/engines/ultima/ultima2/views/title.cpp
index 4fe46938e25..6a18f0e572b 100644
--- a/engines/ultima/ultima2/views/title.cpp
+++ b/engines/ultima/ultima2/views/title.cpp
@@ -24,6 +24,7 @@
 #include "graphics/paletteman.h"
 #include "ultima/ultima2/views/title.h"
 #include "ultima/ultima2/gfx/pic_decoder.h"
+#include "ultima/ultima2/ultima2.h"
 
 namespace Ultima {
 namespace Ultima2 {
@@ -224,10 +225,10 @@ bool Title::msgKeypress(const KeypressMessage &msg) {
 			showState(DEMO_OUT);
 			break;
 		case Common::KEYCODE_p:
-			// TODO: play a saved game -- needs the Savegame/data model, added in a later stage
+			g_engine->loadGameDialog();
 			break;
 		case Common::KEYCODE_c:
-			// TODO: create a new character -- needs the Savegame/data model, added in a later stage
+			replaceView("CreateCharacter");
 			break;
 		default:
 			break;
diff --git a/engines/ultima/ultima2/views/views.h b/engines/ultima/ultima2/views/views.h
index 7ac6e99cf5b..5a73c860b3e 100644
--- a/engines/ultima/ultima2/views/views.h
+++ b/engines/ultima/ultima2/views/views.h
@@ -23,6 +23,7 @@
 #define ULTIMA2_VIEWS_H
 
 #include "ultima/shared/engine/events.h"
+#include "ultima/ultima2/views/create_character.h"
 #include "ultima/ultima2/views/startup.h"
 #include "ultima/ultima2/views/title.h"
 
@@ -31,6 +32,7 @@ namespace Ultima2 {
 namespace Views {
 
 struct Views : public Shared::Views {
+	CreateCharacter _createCharacter;
 	Startup _startup;
 	Title _title;
 };


Commit: 9629e8fdfc6e42ad90e8ebd949959deb78547254
    https://github.com/scummvm/scummvm/commit/9629e8fdfc6e42ad90e8ebd949959deb78547254
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:40:54+11:00

Commit Message:
ULTIMA: ULTIMA2: Add tile graphics, map, dungeon, and monster loaders

Changed paths:
  A engines/ultima/ultima2/data/map.cpp
  A engines/ultima/ultima2/data/map.h
  A engines/ultima/ultima2/data/map_dungeon.cpp
  A engines/ultima/ultima2/data/map_dungeon.h
  A engines/ultima/ultima2/data/map_monsters.cpp
  A engines/ultima/ultima2/data/map_monsters.h
  A engines/ultima/ultima2/data/tiles.cpp
  A engines/ultima/ultima2/data/tiles.h
    engines/ultima/module.mk
    engines/ultima/ultima2/console.cpp
    engines/ultima/ultima2/console.h
    engines/ultima/ultima2/ultima2.h


diff --git a/engines/ultima/module.mk b/engines/ultima/module.mk
index caa33c59031..2ecc5fc2bfd 100644
--- a/engines/ultima/module.mk
+++ b/engines/ultima/module.mk
@@ -111,6 +111,10 @@ MODULE_OBJS += \
 	ultima2/ultima2.o \
 	ultima2/console.o \
 	ultima2/metaengine.o \
+	ultima2/data/map.o \
+	ultima2/data/map_dungeon.o \
+	ultima2/data/map_monsters.o \
+	ultima2/data/tiles.o \
 	ultima2/gfx/pic_decoder.o \
 	ultima2/gfx/text_cursor.o \
 	ultima2/views/create_character.o \
diff --git a/engines/ultima/ultima2/console.cpp b/engines/ultima/ultima2/console.cpp
index ce3848906f6..4b98ddcef24 100644
--- a/engines/ultima/ultima2/console.cpp
+++ b/engines/ultima/ultima2/console.cpp
@@ -20,15 +20,98 @@
  */
 
 #include "ultima/ultima2/console.h"
+#include "ultima/ultima2/ultima2.h"
+#include "ultima/ultima2/data/tiles.h"
 
 namespace Ultima {
 namespace Ultima2 {
 
 Console::Console() : GUI::Debugger() {
+	registerCmd("map", WRAP_METHOD(Console, cmdMap));
+	registerCmd("tiles", WRAP_METHOD(Console, cmdTiles));
 }
 
 Console::~Console() {
 }
 
+bool Console::cmdMap(int argc, const char **argv) {
+	int mapNum1 = _G(savegame)._mapNum1;
+	int mapNum2 = _G(savegame)._mapNum2;
+
+	if (argc == 3) {
+		mapNum1 = atoi(argv[1]);
+		mapNum2 = atoi(argv[2]);
+	} else if (argc != 1) {
+		debugPrintf("map [<mapNum1> <mapNum2>]\n");
+		return true;
+	}
+
+	if (mapNum2 >= 4) {
+		_G(dungeon).load(mapNum1, mapNum2);
+		debugPrintf("Loaded dungeon MAPX%d%d\n", mapNum1, mapNum2);
+
+		for (int level = 0; level < Data::DUNGEON_LEVELS; ++level) {
+			debugPrintf("Level %d:\n", level);
+			for (int y = 0; y < Data::DUNGEON_HEIGHT; ++y) {
+				Common::String line;
+				for (int x = 0; x < Data::DUNGEON_WIDTH; ++x)
+					line += Common::String::format("%02x", _G(dungeon)._cells[level][y][x]);
+				debugPrintf("%s\n", line.c_str());
+			}
+		}
+	} else {
+		_G(map).load(mapNum1, mapNum2);
+		debugPrintf("Loaded map MAPX%d%d\n", mapNum1, mapNum2);
+
+		for (int y = 0; y < Data::MAP_HEIGHT; ++y) {
+			Common::String line;
+			for (int x = 0; x < Data::MAP_WIDTH; ++x)
+				line += Common::String::format("%02x", (int)_G(map).tileAt(x, y));
+			debugPrintf("%s\n", line.c_str());
+		}
+
+		for (int i = 0; i < Data::MAP_MONSTER_COUNT; ++i) {
+			if (_G(map)._monsters.isActive(i)) {
+				debugPrintf("Monster %d: type=%d pos=(%d,%d)\n", i,
+					_G(map)._monsters.tileType(i),
+					_G(map)._monsters._mapX[i], _G(map)._monsters._mapY[i]);
+			}
+		}
+	}
+
+	return true;
+}
+
+bool Console::cmdTiles(int argc, const char **argv) {
+	Graphics::Surface tiles[Data::TILE_COUNT];
+	Data::loadTiles(tiles);
+
+	debugPrintf("Loaded %d tiles\n", Data::TILE_COUNT);
+	for (int t = 0; t < Data::TILE_COUNT; ++t) {
+		uint32 sum = 0;
+		const byte *pixels = (const byte *)tiles[t].getPixels();
+		for (int i = 0; i < Data::TILE_WIDTH * Data::TILE_HEIGHT; ++i)
+			sum += pixels[i];
+
+		debugPrintf("Tile %2d: pixel sum=%u\n", t, sum);
+	}
+
+	// Tile 6 (Town) has a distinctive twin-tower shape, useful as a
+	// visual sanity check that the decode is correct
+	debugPrintf("Tile %d (Town):\n", (int)Data::TILE_TOWN);
+	const byte *townPixels = (const byte *)tiles[Data::TILE_TOWN].getPixels();
+	for (int y = 0; y < Data::TILE_HEIGHT; ++y) {
+		Common::String line;
+		for (int x = 0; x < Data::TILE_WIDTH; ++x)
+			line += (char)('0' + townPixels[y * Data::TILE_WIDTH + x]);
+		debugPrintf("%s\n", line.c_str());
+	}
+
+	for (int t = 0; t < Data::TILE_COUNT; ++t)
+		tiles[t].free();
+
+	return true;
+}
+
 } // namespace Ultima2
 } // namespace Ultima
diff --git a/engines/ultima/ultima2/console.h b/engines/ultima/ultima2/console.h
index 118d645c509..854e902d669 100644
--- a/engines/ultima/ultima2/console.h
+++ b/engines/ultima/ultima2/console.h
@@ -28,6 +28,9 @@ namespace Ultima {
 namespace Ultima2 {
 
 class Console : public GUI::Debugger {
+private:
+	bool cmdMap(int argc, const char **argv);
+	bool cmdTiles(int argc, const char **argv);
 public:
 	Console();
 	~Console() override;
diff --git a/engines/ultima/ultima2/data/map.cpp b/engines/ultima/ultima2/data/map.cpp
new file mode 100644
index 00000000000..46778031b1b
--- /dev/null
+++ b/engines/ultima/ultima2/data/map.cpp
@@ -0,0 +1,53 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "common/file.h"
+#include "ultima/ultima2/data/map.h"
+
+namespace Ultima {
+namespace Ultima2 {
+namespace Data {
+
+Common::String mapFilename(int mapNum1, int mapNum2) {
+	return Common::String::format("MAPX%c%c", '0' + mapNum1, '0' + mapNum2);
+}
+
+Common::String monsterFilename(int mapNum1, int mapNum2) {
+	return Common::String::format("MONX%c%c", '0' + mapNum1, '0' + mapNum2);
+}
+
+void Map::load(int mapNum1, int mapNum2) {
+	Common::File f;
+	Common::String filename = mapFilename(mapNum1, mapNum2);
+	if (!f.open(filename.c_str()))
+		error("Could not open %s", filename.c_str());
+
+	for (int y = 0; y < MAP_HEIGHT; ++y) {
+		for (int x = 0; x < MAP_WIDTH; ++x)
+			_tiles[y][x] = (TileId)(f.readByte() / 4);
+	}
+
+	_monsters.load(mapNum1, mapNum2);
+}
+
+} // namespace Data
+} // namespace Ultima2
+} // namespace Ultima
diff --git a/engines/ultima/ultima2/data/map.h b/engines/ultima/ultima2/data/map.h
new file mode 100644
index 00000000000..0976f53cfb1
--- /dev/null
+++ b/engines/ultima/ultima2/data/map.h
@@ -0,0 +1,61 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef ULTIMA2_DATA_MAP_H
+#define ULTIMA2_DATA_MAP_H
+
+#include "common/str.h"
+#include "ultima/ultima2/data/tiles.h"
+#include "ultima/ultima2/data/map_monsters.h"
+
+namespace Ultima {
+namespace Ultima2 {
+namespace Data {
+
+constexpr int MAP_WIDTH = 64;
+constexpr int MAP_HEIGHT = 64;
+
+// Both build "MAPXnn"/"MONXnn" from the same two map-number digits
+Common::String mapFilename(int mapNum1, int mapNum2);
+Common::String monsterFilename(int mapNum1, int mapNum2);
+
+/**
+ * A planet, village, town, or castle's map: a flat 64x64 grid of tiles,
+ * plus its monster/NPC slots. Towers and dungeons share the same on-disk
+ * mapX??/monX?? files but use a different internal layout for the map
+ * data itself -- see MapDungeon.
+ */
+struct Map {
+	TileId _tiles[MAP_HEIGHT][MAP_WIDTH] = {};
+	MapMonsters _monsters;
+
+	void load(int mapNum1, int mapNum2);
+
+	TileId tileAt(int x, int y) const {
+		return _tiles[y][x];
+	}
+};
+
+} // namespace Data
+} // namespace Ultima2
+} // namespace Ultima
+
+#endif
diff --git a/engines/ultima/ultima2/data/map_dungeon.cpp b/engines/ultima/ultima2/data/map_dungeon.cpp
new file mode 100644
index 00000000000..279c9abebf4
--- /dev/null
+++ b/engines/ultima/ultima2/data/map_dungeon.cpp
@@ -0,0 +1,41 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "common/file.h"
+#include "ultima/ultima2/data/map_dungeon.h"
+#include "ultima/ultima2/data/map.h"
+
+namespace Ultima {
+namespace Ultima2 {
+namespace Data {
+
+void MapDungeon::load(int mapNum1, int mapNum2) {
+	Common::File f;
+	Common::String filename = mapFilename(mapNum1, mapNum2);
+	if (!f.open(filename.c_str()))
+		error("Could not open %s", filename.c_str());
+
+	f.read(_cells, sizeof(_cells));
+}
+
+} // namespace Data
+} // namespace Ultima2
+} // namespace Ultima
diff --git a/engines/ultima/ultima2/data/map_dungeon.h b/engines/ultima/ultima2/data/map_dungeon.h
new file mode 100644
index 00000000000..27c2e66c534
--- /dev/null
+++ b/engines/ultima/ultima2/data/map_dungeon.h
@@ -0,0 +1,70 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef ULTIMA2_DATA_MAP_DUNGEON_H
+#define ULTIMA2_DATA_MAP_DUNGEON_H
+
+#include "common/scummsys.h"
+
+namespace Ultima {
+namespace Ultima2 {
+namespace Data {
+
+constexpr int DUNGEON_WIDTH = 16;
+constexpr int DUNGEON_HEIGHT = 16;
+constexpr int DUNGEON_LEVELS = 16;
+
+enum DungeonTerrain {
+	DUNGEON_FLOOR = 0x00,
+	DUNGEON_LADDER_UP = 0x10,
+	DUNGEON_LADDER_DOWN = 0x20,
+	DUNGEON_LADDER_UP_DOWN = 0x30,
+	DUNGEON_CHEST = 0x40,
+	DUNGEON_WALL = 0x80,
+	DUNGEON_DOOR = 0xC0,
+	DUNGEON_SECRET_DOOR = 0xE0
+};
+
+/**
+ * A dungeon or tower's 16 levels, each a 16x16 grid of cells (dungeons
+ * number levels top to bottom, towers bottom to top). The high nibble of
+ * each cell byte is its terrain (see DungeonTerrain); the low 3 bits flag
+ * monster presence there, independent of the per-map MapMonsters slots,
+ * and get cleared on a kill while preserving the terrain nibble.
+ */
+struct MapDungeon {
+	byte _cells[DUNGEON_LEVELS][DUNGEON_HEIGHT][DUNGEON_WIDTH] = {};
+
+	void load(int mapNum1, int mapNum2);
+
+	DungeonTerrain terrainAt(int level, int x, int y) const {
+		return (DungeonTerrain)(_cells[level][y][x] & 0xF0);
+	}
+	bool hasMonsterAt(int level, int x, int y) const {
+		return (_cells[level][y][x] & 7) != 0;
+	}
+};
+
+} // namespace Data
+} // namespace Ultima2
+} // namespace Ultima
+
+#endif
diff --git a/engines/ultima/ultima2/data/map_monsters.cpp b/engines/ultima/ultima2/data/map_monsters.cpp
new file mode 100644
index 00000000000..152f1c3382f
--- /dev/null
+++ b/engines/ultima/ultima2/data/map_monsters.cpp
@@ -0,0 +1,48 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "common/file.h"
+#include "ultima/ultima2/data/map_monsters.h"
+#include "ultima/ultima2/data/map.h"
+
+namespace Ultima {
+namespace Ultima2 {
+namespace Data {
+
+void MapMonsters::load(int mapNum1, int mapNum2) {
+	Common::File f;
+	Common::String filename = monsterFilename(mapNum1, mapNum2);
+	if (!f.open(filename.c_str()))
+		error("Could not open %s", filename.c_str());
+
+	f.read(_mapX, MAP_MONSTER_COUNT);
+	f.read(_mapY, MAP_MONSTER_COUNT);
+	f.read(_spellHP, MAP_MONSTER_COUNT);
+	f.read(_type, MAP_MONSTER_COUNT);
+	f.read(_glyphTile, MAP_MONSTER_COUNT);
+	f.read(_offerFlag, MAP_MONSTER_COUNT);
+	f.read(_tempX, MAP_MONSTER_COUNT);
+	f.read(_tempY, MAP_MONSTER_COUNT);
+}
+
+} // namespace Data
+} // namespace Ultima2
+} // namespace Ultima
diff --git a/engines/ultima/ultima2/data/map_monsters.h b/engines/ultima/ultima2/data/map_monsters.h
new file mode 100644
index 00000000000..2662407520b
--- /dev/null
+++ b/engines/ultima/ultima2/data/map_monsters.h
@@ -0,0 +1,63 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef ULTIMA2_DATA_MAP_MONSTERS_H
+#define ULTIMA2_DATA_MAP_MONSTERS_H
+
+#include "common/scummsys.h"
+#include "ultima/ultima2/data/tiles.h"
+
+namespace Ultima {
+namespace Ultima2 {
+namespace Data {
+
+constexpr int MAP_MONSTER_COUNT = 32;
+
+/**
+ * Up to 32 monster/NPC slots for the current map, stored as a
+ * struct-of-arrays -- one array per field, with a monster's slot index
+ * (0-31) shared across all of them -- rather than one struct per monster.
+ */
+struct MapMonsters {
+	byte _mapX[MAP_MONSTER_COUNT] = {};
+	byte _mapY[MAP_MONSTER_COUNT] = {};
+	byte _spellHP[MAP_MONSTER_COUNT] = {};
+	byte _type[MAP_MONSTER_COUNT] = {}; // TileId x 4; 0 means the slot is empty
+	byte _glyphTile[MAP_MONSTER_COUNT] = {};
+	byte _offerFlag[MAP_MONSTER_COUNT] = {};
+	byte _tempX[MAP_MONSTER_COUNT] = {};
+	byte _tempY[MAP_MONSTER_COUNT] = {};
+
+	void load(int mapNum1, int mapNum2);
+
+	bool isActive(int slot) const {
+		return _type[slot] != 0;
+	}
+	TileId tileType(int slot) const {
+		return (TileId)(_type[slot] / 4);
+	}
+};
+
+} // namespace Data
+} // namespace Ultima2
+} // namespace Ultima
+
+#endif
diff --git a/engines/ultima/ultima2/data/tiles.cpp b/engines/ultima/ultima2/data/tiles.cpp
new file mode 100644
index 00000000000..892045ccd17
--- /dev/null
+++ b/engines/ultima/ultima2/data/tiles.cpp
@@ -0,0 +1,65 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "common/file.h"
+#include "ultima/ultima2/data/tiles.h"
+
+namespace Ultima {
+namespace Ultima2 {
+namespace Data {
+
+// Byte offset of the first tile's data within ULTIMAII.EXE
+constexpr int32 TILE_DATA_OFFSET = 0x7C40;
+
+// 2-byte header (row width in bytes, row count -- always 4 and 16) plus
+// 64 bytes of packed pixel data
+constexpr int TILE_RECORD_SIZE = 66;
+
+void loadTiles(Graphics::Surface tiles[TILE_COUNT]) {
+	Common::File f;
+	if (!f.open("ULTIMAII.EXE"))
+		error("Could not open ULTIMAII.EXE");
+
+	f.seek(TILE_DATA_OFFSET);
+
+	for (int t = 0; t < TILE_COUNT; ++t) {
+		byte record[TILE_RECORD_SIZE];
+		if (f.read(record, TILE_RECORD_SIZE) != (uint32)TILE_RECORD_SIZE)
+			error("Could not read tile %d", t);
+
+		tiles[t].create(TILE_WIDTH, TILE_HEIGHT, Graphics::PixelFormat::createFormatCLUT8());
+		byte *dst = (byte *)tiles[t].getPixels();
+
+		for (int row = 0; row < TILE_HEIGHT; ++row) {
+			for (int b = 0; b < TILE_WIDTH / 4; ++b) {
+				byte v = record[2 + row * 4 + b];
+				dst[row * TILE_WIDTH + b * 4 + 0] = (v >> 6) & 3;
+				dst[row * TILE_WIDTH + b * 4 + 1] = (v >> 4) & 3;
+				dst[row * TILE_WIDTH + b * 4 + 2] = (v >> 2) & 3;
+				dst[row * TILE_WIDTH + b * 4 + 3] = v & 3;
+			}
+		}
+	}
+}
+
+} // namespace Data
+} // namespace Ultima2
+} // namespace Ultima
diff --git a/engines/ultima/ultima2/data/tiles.h b/engines/ultima/ultima2/data/tiles.h
new file mode 100644
index 00000000000..1e5c7652341
--- /dev/null
+++ b/engines/ultima/ultima2/data/tiles.h
@@ -0,0 +1,63 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef ULTIMA2_DATA_TILES_H
+#define ULTIMA2_DATA_TILES_H
+
+#include "graphics/surface.h"
+
+namespace Ultima {
+namespace Ultima2 {
+namespace Data {
+
+enum TileId {
+	TILE_WATER = 0, TILE_SWAMP = 1, TILE_GRASS = 2, TILE_FOREST = 3, TILE_MOUNTAIN = 4,
+	TILE_UNKNOWN_5 = 5, TILE_TOWN = 6, TILE_TOWER = 7, TILE_CASTLE = 8,
+	TILE_DUNGEON_ENTRANCE = 9, TILE_SIGNPOST = 10, TILE_SEA_MONSTER = 11, TILE_ORC = 12,
+	TILE_DAEMON = 13, TILE_DEVIL = 14, TILE_BALRON = 15, TILE_MINAX = 16, TILE_HORSE = 17,
+	TILE_SHIP = 18, TILE_AIRPLANE = 19, TILE_ROCKET = 20, TILE_SHIELD = 21, TILE_SWORD = 22,
+	TILE_FORCEFIELD = 23, TILE_GUARD = 24, TILE_JESTER = 25, TILE_SHOPKEEP = 26,
+	TILE_UNKNOWN_27 = 27, TILE_ROAD = 28, TILE_EMPTY = 29, TILE_WALL = 30,
+	TILE_EMPTY_COUNTER = 31,
+	TILE_A = 32, TILE_B = 33, TILE_C = 34, TILE_D = 35, TILE_E = 36, TILE_F = 37, TILE_G = 38,
+	TILE_H = 39, TILE_I_DOOR = 40, TILE_J = 41, TILE_K = 42, TILE_L = 43, TILE_M = 44,
+	TILE_N = 45, TILE_O = 46, TILE_P = 47, TILE_MOONGATE = 48, TILE_R = 49, TILE_S = 50,
+	TILE_T = 51, TILE_U = 52, TILE_V = 53, TILE_W = 54, TILE_X = 55, TILE_Y = 56, TILE_Z = 57,
+	TILE_COUNTER_END_RIGHT = 58, TILE_COUNTER_END_LEFT = 59,
+	TILE_FIGHTER = 60, TILE_CLERIC = 61, TILE_MAGE = 62, TILE_THIEF = 63,
+	TILE_COUNT = 64
+};
+
+constexpr int TILE_WIDTH = 16;
+constexpr int TILE_HEIGHT = 16;
+
+/**
+ * Decodes the 64 overworld/town tile graphics embedded directly in
+ * ULTIMAII.EXE into 16x16 CLUT8 surfaces, indexed into the same 4-color
+ * CGA palette as the pic??? full-screen art (see Gfx::PicDecoder).
+ */
+void loadTiles(Graphics::Surface tiles[TILE_COUNT]);
+
+} // namespace Data
+} // namespace Ultima2
+} // namespace Ultima
+
+#endif
diff --git a/engines/ultima/ultima2/ultima2.h b/engines/ultima/ultima2/ultima2.h
index d962216fab0..07df9143cff 100644
--- a/engines/ultima/ultima2/ultima2.h
+++ b/engines/ultima/ultima2/ultima2.h
@@ -29,6 +29,8 @@
 #include "engines/engine.h"
 #include "ultima/detection.h"
 #include "ultima/shared/engine/events.h"
+#include "ultima/ultima2/data/map.h"
+#include "ultima/ultima2/data/map_dungeon.h"
 #include "ultima/ultima2/data/savegame.h"
 
 namespace Ultima {
@@ -53,6 +55,8 @@ protected:
 
 public:
 	Data::Savegame _savegame;
+	Data::Map _map;
+	Data::MapDungeon _dungeon;
 
 public:
 	Ultima2Engine(OSystem *syst, const Ultima::UltimaGameDescription *gameDesc);


Commit: 0a657f57517262e2008747e611af1bb8b2d9277b
    https://github.com/scummvm/scummvm/commit/0a657f57517262e2008747e611af1bb8b2d9277b
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:40:54+11:00

Commit Message:
ULTIMA: ULTIMA2: Add core game loop skeleton

Changed paths:
  A engines/ultima/ultima2/logic/logic.cpp
  A engines/ultima/ultima2/logic/logic.h
  A engines/ultima/ultima2/logic/overworld_logic.h
  A engines/ultima/ultima2/views/commands.cpp
  A engines/ultima/ultima2/views/commands.h
  A engines/ultima/ultima2/views/game.cpp
  A engines/ultima/ultima2/views/game.h
  A engines/ultima/ultima2/views/map.cpp
  A engines/ultima/ultima2/views/map.h
  A engines/ultima/ultima2/views/overworld_map.cpp
  A engines/ultima/ultima2/views/overworld_map.h
  A engines/ultima/ultima2/views/stats.cpp
  A engines/ultima/ultima2/views/stats.h
    engines/ultima/module.mk
    engines/ultima/ultima2/data/data.h
    engines/ultima/ultima2/data/map.cpp
    engines/ultima/ultima2/gfx/pic_decoder.cpp
    engines/ultima/ultima2/gfx/pic_decoder.h
    engines/ultima/ultima2/gfx/text_cursor.cpp
    engines/ultima/ultima2/gfx/text_cursor.h
    engines/ultima/ultima2/metaengine.cpp
    engines/ultima/ultima2/metaengine.h
    engines/ultima/ultima2/ultima2.h
    engines/ultima/ultima2/views/create_character.cpp
    engines/ultima/ultima2/views/views.h


diff --git a/engines/ultima/module.mk b/engines/ultima/module.mk
index 2ecc5fc2bfd..8b727cf1fe6 100644
--- a/engines/ultima/module.mk
+++ b/engines/ultima/module.mk
@@ -117,8 +117,14 @@ MODULE_OBJS += \
 	ultima2/data/tiles.o \
 	ultima2/gfx/pic_decoder.o \
 	ultima2/gfx/text_cursor.o \
+	ultima2/logic/logic.o \
+	ultima2/views/commands.o \
 	ultima2/views/create_character.o \
+	ultima2/views/game.o \
+	ultima2/views/map.o \
+	ultima2/views/overworld_map.o \
 	ultima2/views/startup.o \
+	ultima2/views/stats.o \
 	ultima2/views/title.o
 endif
 
diff --git a/engines/ultima/ultima2/data/data.h b/engines/ultima/ultima2/data/data.h
index 0ef460058a2..694d5e2ffad 100644
--- a/engines/ultima/ultima2/data/data.h
+++ b/engines/ultima/ultima2/data/data.h
@@ -28,6 +28,10 @@ namespace Data {
 
 constexpr int MAX_NAME_LENGTH = 12;
 
+enum Direction {
+	DIR_UP = 0, DIR_DOWN = 1, DIR_LEFT = 2, DIR_RIGHT = 3, DIR_UNSPECIFIED = 4
+};
+
 enum Sex {
 	SEX_MALE = 0, SEX_FEMALE = 1
 };
diff --git a/engines/ultima/ultima2/data/map.cpp b/engines/ultima/ultima2/data/map.cpp
index 46778031b1b..8466accc8ce 100644
--- a/engines/ultima/ultima2/data/map.cpp
+++ b/engines/ultima/ultima2/data/map.cpp
@@ -21,6 +21,9 @@
 
 #include "common/file.h"
 #include "ultima/ultima2/data/map.h"
+#include "ultima/ultima2/ultima2.h"
+#include "ultima/ultima2/logic/overworld_logic.h"
+#include "ultima/shared/gfx/view.h"
 
 namespace Ultima {
 namespace Ultima2 {
@@ -46,6 +49,22 @@ void Map::load(int mapNum1, int mapNum2) {
 	}
 
 	_monsters.load(mapNum1, mapNum2);
+
+	// TODO: only OverworldLogic exists so far -- villages/towns/castles
+	// (mapNum2 1-3) get their own CityCastleLogic in a later stage
+	_G(logic) = Common::SharedPtr<Logic::Logic>(new Logic::OverworldLogic());
+
+	if (!g_engine->isPresent("Game")) {
+		// Set up the game view and force it to draw immediately
+		g_engine->replaceView("Game", true);
+		g_engine->focusedView()->draw();
+
+		// Now open the map view on top of it
+		g_engine->addView("OverworldMap");
+	} else {
+		// Just switching from one map view to another
+		g_engine->replaceView("OverworldMap");
+	}
 }
 
 } // namespace Data
diff --git a/engines/ultima/ultima2/gfx/pic_decoder.cpp b/engines/ultima/ultima2/gfx/pic_decoder.cpp
index 7fbdd4f56e4..99e15851889 100644
--- a/engines/ultima/ultima2/gfx/pic_decoder.cpp
+++ b/engines/ultima/ultima2/gfx/pic_decoder.cpp
@@ -29,8 +29,7 @@ namespace Gfx {
 constexpr int BANK_SIZE = 0x2000;  // reserved size of each interlaced CGA bank
 constexpr int BYTES_PER_ROW = 80;  // 320 pixels / 4 pixels-per-byte
 
-// CGA mode 4, palette 1, border/background color 0 (black)
-static const byte CGA_PALETTE1[4 * 3] = {
+const byte CGA_PALETTE1[4 * 3] = {
 	0x00, 0x00, 0x00, // 0: black
 	0x55, 0xff, 0xff, // 1: light cyan
 	0xff, 0x55, 0xff, // 2: light magenta
diff --git a/engines/ultima/ultima2/gfx/pic_decoder.h b/engines/ultima/ultima2/gfx/pic_decoder.h
index 8e422ad04db..ea59fa1c458 100644
--- a/engines/ultima/ultima2/gfx/pic_decoder.h
+++ b/engines/ultima/ultima2/gfx/pic_decoder.h
@@ -30,6 +30,10 @@ namespace Ultima {
 namespace Ultima2 {
 namespace Gfx {
 
+// CGA mode 4, palette 1 (black/light cyan/light magenta/white), the
+// palette used by both the pic??? art and the embedded tile graphics
+extern const byte CGA_PALETTE1[4 * 3];
+
 /**
  * Decodes Ultima II's raw "pic???" full-screen title/demo art: a literal
  * 16384-byte dump of the CGA mode 4 (320x200, 4-color, palette 1)
diff --git a/engines/ultima/ultima2/gfx/text_cursor.cpp b/engines/ultima/ultima2/gfx/text_cursor.cpp
index c9beea3e247..d5708fb57f7 100644
--- a/engines/ultima/ultima2/gfx/text_cursor.cpp
+++ b/engines/ultima/ultima2/gfx/text_cursor.cpp
@@ -28,9 +28,8 @@ namespace Gfx {
 
 #define DELAY_FRAMES 5
 
-constexpr int COLOR_CURSOR = 15; // white
-
-TextCursor::TextCursor(const Common::String &name, UIElement *parent) : UIElement(name, parent) {
+TextCursor::TextCursor(const Common::String &name, UIElement *parent, byte color) :
+		UIElement(name, parent), _color(color) {
 	setPosition(Common::Point(0, 0));
 	delayFrames(DELAY_FRAMES);
 }
@@ -56,7 +55,7 @@ void TextCursor::draw() {
 	s.clear();
 
 	if (_visible)
-		s.fillRect(Common::Rect(0, 7, 8, 8), COLOR_CURSOR);
+		s.fillRect(Common::Rect(0, 7, 8, 8), _color);
 }
 
 void TextCursor::timeout() {
diff --git a/engines/ultima/ultima2/gfx/text_cursor.h b/engines/ultima/ultima2/gfx/text_cursor.h
index a21698b2439..ec6b3cf7afc 100644
--- a/engines/ultima/ultima2/gfx/text_cursor.h
+++ b/engines/ultima/ultima2/gfx/text_cursor.h
@@ -36,9 +36,10 @@ namespace Gfx {
 class TextCursor : public Shared::UIElement {
 private:
 	bool _visible = true;
+	byte _color;
 
 public:
-	TextCursor(const Common::String &name, UIElement *parent = nullptr);
+	TextCursor(const Common::String &name, UIElement *parent = nullptr, byte color = 15);
 	~TextCursor() override {}
 
 	void draw() override;
diff --git a/engines/ultima/ultima2/logic/logic.cpp b/engines/ultima/ultima2/logic/logic.cpp
new file mode 100644
index 00000000000..c63f8aeb6a0
--- /dev/null
+++ b/engines/ultima/ultima2/logic/logic.cpp
@@ -0,0 +1,320 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "ultima/ultima2/logic/logic.h"
+#include "ultima/ultima2/ultima2.h"
+#include "ultima/ultima2/metaengine.h"
+
+namespace Ultima {
+namespace Ultima2 {
+namespace Logic {
+
+using namespace Shared::Messages;
+
+void Logic::writeString(const Common::String &msg) {
+	g_engine->baseView()->findView("Commands")->send(GameMessage("TEXT", msg));
+}
+
+void Logic::writeString(const char *format, ...) {
+	va_list alist;
+	va_start(alist, format);
+	Common::String msg = Common::String::vformat(format, alist);
+	va_end(alist);
+
+	writeString(msg);
+}
+
+void Logic::prompt() {
+	g_engine->baseView()->findView("Commands")->send(GameMessage("PROMPT"));
+}
+
+void Logic::redrawMap() {
+	g_engine->focusedView()->redraw();
+}
+
+void Logic::redrawStats() {
+	g_engine->baseView()->findView("Stats")->draw();
+}
+
+int Logic::getRandomNumber(int minNumber, int maxNumber) {
+	return g_engine->getRandomNumber(minNumber, maxNumber);
+}
+
+int Logic::getRandomNumber(int maxNumber) {
+	return g_engine->getRandomNumber(maxNumber);
+}
+
+void Logic::endOfTurn() {
+	updateCreatures();
+	redrawMap();
+	redrawStats();
+}
+
+void Logic::action(int action) {
+	Common::SharedPtr<Logic> currLogic = _G(logic);
+	bool doEndOfTurn = true;
+
+	switch (action) {
+	case KEYBIND_UP:
+		doEndOfTurn = move(Data::DIR_UP);
+		break;
+	case KEYBIND_DOWN:
+		doEndOfTurn = move(Data::DIR_DOWN);
+		break;
+	case KEYBIND_LEFT:
+		doEndOfTurn = move(Data::DIR_LEFT);
+		break;
+	case KEYBIND_RIGHT:
+		doEndOfTurn = move(Data::DIR_RIGHT);
+		break;
+	case KEYBIND_ATTACK:
+		doEndOfTurn = attack();
+		break;
+	case KEYBIND_BOARD:
+		doEndOfTurn = board();
+		break;
+	case KEYBIND_CAST:
+		doEndOfTurn = cast();
+		break;
+	case KEYBIND_DESCEND:
+		doEndOfTurn = descend();
+		break;
+	case KEYBIND_ENTER:
+		doEndOfTurn = enter();
+		break;
+	case KEYBIND_FIRE:
+		doEndOfTurn = fire();
+		break;
+	case KEYBIND_GET:
+		doEndOfTurn = get();
+		break;
+	case KEYBIND_HYPER:
+		doEndOfTurn = hyper();
+		break;
+	case KEYBIND_IGNITE_TORCH:
+		doEndOfTurn = igniteTorch();
+		break;
+	case KEYBIND_JUMP:
+		doEndOfTurn = jump();
+		break;
+	case KEYBIND_KLIMB:
+		doEndOfTurn = klimb();
+		break;
+	case KEYBIND_LAUNCH:
+		doEndOfTurn = launch();
+		break;
+	case KEYBIND_MAGIC:
+		doEndOfTurn = magic();
+		break;
+	case KEYBIND_NEGATE_TIME:
+		doEndOfTurn = negateTime();
+		break;
+	case KEYBIND_OFFER:
+		doEndOfTurn = offer();
+		break;
+	case KEYBIND_PASS:
+		doEndOfTurn = pass();
+		break;
+	case KEYBIND_QUIT:
+		doEndOfTurn = quit();
+		break;
+	case KEYBIND_READY:
+		doEndOfTurn = ready();
+		break;
+	case KEYBIND_STEAL:
+		doEndOfTurn = steal();
+		break;
+	case KEYBIND_TRANSACT:
+		doEndOfTurn = transact();
+		break;
+	case KEYBIND_UNLOCK:
+		doEndOfTurn = unlock();
+		break;
+	case KEYBIND_VIEW:
+		doEndOfTurn = view();
+		break;
+	case KEYBIND_WEAR_ARMOR:
+		doEndOfTurn = wearArmor();
+		break;
+	case KEYBIND_X_IT:
+		doEndOfTurn = xit();
+		break;
+	case KEYBIND_YELL:
+		doEndOfTurn = yell();
+		break;
+	case KEYBIND_ZSTATS:
+		doEndOfTurn = zstats();
+		break;
+	default:
+		writeString("Huh?\n");
+		break;
+	}
+
+	if (doEndOfTurn) {
+		// Only do end of turn stuff like creature movement and food
+		// reduction if we're still in the same mode we started on
+		if (_G(logic) == currLogic)
+			endOfTurn();
+
+		if (_G(savegame)._hp > 0)
+			prompt();
+	}
+}
+
+void Logic::keypress(Common::KeyCode keycode) {
+	writeString("Huh?\n");
+	endOfTurn();
+	prompt();
+}
+
+bool Logic::attack() {
+	writeString("Attack?\n");
+	return true;
+}
+
+bool Logic::board() {
+	writeString("Board?\n");
+	return true;
+}
+
+bool Logic::cast() {
+	writeString("Cast?\n");
+	return true;
+}
+
+bool Logic::descend() {
+	writeString("Descend?\n");
+	return true;
+}
+
+bool Logic::enter() {
+	writeString("Enter?\n");
+	return true;
+}
+
+bool Logic::fire() {
+	writeString("Fire?\n");
+	return true;
+}
+
+bool Logic::get() {
+	writeString("Get?\n");
+	return true;
+}
+
+bool Logic::hyper() {
+	writeString("Hyper?\n");
+	return true;
+}
+
+bool Logic::igniteTorch() {
+	writeString("Ignite Torch?\n");
+	return true;
+}
+
+bool Logic::jump() {
+	writeString("Jump?\n");
+	return true;
+}
+
+bool Logic::klimb() {
+	writeString("Klimb?\n");
+	return true;
+}
+
+bool Logic::launch() {
+	writeString("Launch?\n");
+	return true;
+}
+
+bool Logic::magic() {
+	writeString("Magic?\n");
+	return true;
+}
+
+bool Logic::negateTime() {
+	writeString("Negate Time?\n");
+	return true;
+}
+
+bool Logic::offer() {
+	writeString("Offer?\n");
+	return true;
+}
+
+bool Logic::pass() {
+	writeString("Pass\n");
+	return true;
+}
+
+bool Logic::quit() {
+	writeString("Quit?\n");
+	return true;
+}
+
+bool Logic::ready() {
+	writeString("Ready?\n");
+	return true;
+}
+
+bool Logic::steal() {
+	writeString("Steal?\n");
+	return true;
+}
+
+bool Logic::transact() {
+	writeString("Transact?\n");
+	return true;
+}
+
+bool Logic::unlock() {
+	writeString("Unlock?\n");
+	return true;
+}
+
+bool Logic::view() {
+	writeString("View?\n");
+	return true;
+}
+
+bool Logic::wearArmor() {
+	writeString("Wear Armor?\n");
+	return true;
+}
+
+bool Logic::xit() {
+	writeString("eXit?\n");
+	return true;
+}
+
+bool Logic::yell() {
+	writeString("Yell?\n");
+	return true;
+}
+
+bool Logic::zstats() {
+	writeString("Zstats\n");
+	return true;
+}
+
+} // namespace Logic
+} // namespace Ultima2
+} // namespace Ultima
diff --git a/engines/ultima/ultima2/logic/logic.h b/engines/ultima/ultima2/logic/logic.h
new file mode 100644
index 00000000000..6a030c3be3a
--- /dev/null
+++ b/engines/ultima/ultima2/logic/logic.h
@@ -0,0 +1,134 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef ULTIMA2_LOGIC_LOGIC_H
+#define ULTIMA2_LOGIC_LOGIC_H
+
+#include "common/events.h"
+#include "ultima/ultima2/data/data.h"
+
+namespace Ultima {
+namespace Ultima2 {
+namespace Logic {
+
+/**
+ * Base class for gameplay handling logic - one virtual method per player
+ * command letter, with a default fallback body for each. Concrete
+ * subclasses per mode (overworld, city/castle, dungeon, space) override
+ * only the commands that differ there.
+ */
+class Logic {
+protected:
+	/**
+	 * Dispatches some text to be shown in the Commands window
+	 */
+	void writeString(const Common::String &msg);
+	void writeString(const char *format, ...);
+
+	/**
+	 * Triggers a prompt display in the Commands window
+	 */
+	void prompt();
+
+	/**
+	 * Signal the map to redraw
+	 */
+	void redrawMap();
+
+	/**
+	 * Signal the stats to redraw
+	 */
+	void redrawStats();
+
+	/**
+	 * Returns a random number
+	 */
+	int getRandomNumber(int minNumber, int maxNumber);
+	int getRandomNumber(int maxNumber);
+
+	/**
+	 * Handles end of turn logic
+	 */
+	virtual void endOfTurn();
+
+	/**
+	 * Handles updating creatures/NPCs
+	 */
+	virtual void updateCreatures() {
+	}
+
+	/*--- Fallback player command handlers. Each returns true if end of
+	 * turn processing should happen immediately afterward, or false if
+	 * that's being deferred - typically because a sub-dialog was opened
+	 * that will only complete the action once it closes ---*/
+
+	virtual bool move(Data::Direction dir) {
+		return false;
+	}
+	virtual bool attack();
+	virtual bool board();
+	virtual bool cast();
+	virtual bool descend();
+	virtual bool enter();
+	virtual bool fire();
+	virtual bool get();
+	virtual bool hyper();
+	virtual bool igniteTorch();
+	virtual bool jump();
+	virtual bool klimb();
+	virtual bool launch();
+	virtual bool magic();
+	virtual bool negateTime();
+	virtual bool offer();
+	virtual bool pass();
+	virtual bool quit();
+	virtual bool ready();
+	virtual bool steal();
+	virtual bool transact();
+	virtual bool unlock();
+	virtual bool view();
+	virtual bool wearArmor();
+	virtual bool xit();
+	virtual bool yell();
+	virtual bool zstats();
+
+	/*---------------------------------------*/
+public:
+	virtual ~Logic() {
+	}
+
+	virtual void action(int action);
+	virtual void keypress(Common::KeyCode keycode);
+	virtual void entering() {
+	}
+
+	/**
+	 * Called once per game frame for any logic updates
+	 */
+	virtual void tick() {
+	}
+};
+
+} // namespace Logic
+} // namespace Ultima2
+} // namespace Ultima
+
+#endif
diff --git a/engines/ultima/ultima2/logic/overworld_logic.h b/engines/ultima/ultima2/logic/overworld_logic.h
new file mode 100644
index 00000000000..1b3e5ff5fce
--- /dev/null
+++ b/engines/ultima/ultima2/logic/overworld_logic.h
@@ -0,0 +1,44 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef ULTIMA2_LOGIC_OVERWORLD_LOGIC_H
+#define ULTIMA2_LOGIC_OVERWORLD_LOGIC_H
+
+#include "ultima/ultima2/logic/logic.h"
+
+namespace Ultima {
+namespace Ultima2 {
+namespace Logic {
+
+/**
+ * Command handling while on a planet's overworld. Movement and the rest
+ * of the overworld-specific commands are added in a later stage.
+ */
+class OverworldLogic : public Logic {
+public:
+	~OverworldLogic() override {}
+};
+
+} // namespace Logic
+} // namespace Ultima2
+} // namespace Ultima
+
+#endif
diff --git a/engines/ultima/ultima2/metaengine.cpp b/engines/ultima/ultima2/metaengine.cpp
index 8ac5f7a7481..b10a769b675 100644
--- a/engines/ultima/ultima2/metaengine.cpp
+++ b/engines/ultima/ultima2/metaengine.cpp
@@ -45,6 +45,32 @@ static const KeybindingRecord GAMEPLAY_KEYS[] = {
 	{ KEYBIND_DOWN, "DOWN", _s("Down"), "DOWN", "JOY_DOWN"},
 	{ KEYBIND_LEFT, "LEFT", _s("Left"), "LEFT", "JOY_LEFT"},
 	{ KEYBIND_RIGHT, "RIGHT", _s("Right"), "RIGHT", "JOY_RIGHT"},
+	{ KEYBIND_ATTACK, "ATTACK", _s("Attack"), "a", nullptr },
+	{ KEYBIND_BOARD, "BOARD", _s("Board"), "b", nullptr },
+	{ KEYBIND_CAST, "CAST", _s("Cast"), "c", nullptr },
+	{ KEYBIND_DESCEND, "DESCEND", _s("Descend"), "d", nullptr },
+	{ KEYBIND_ENTER, "ENTER", _s("Enter"), "e", nullptr },
+	{ KEYBIND_FIRE, "FIRE", _s("Fire"), "f", nullptr },
+	{ KEYBIND_GET, "GET", _s("Get"), "g", nullptr },
+	{ KEYBIND_HYPER, "HYPER", _s("Hyper"), "h", nullptr },
+	{ KEYBIND_IGNITE_TORCH, "IGNITE_TORCH", _s("Ignite torch"), "i", nullptr },
+	{ KEYBIND_JUMP, "JUMP", _s("Jump"), "j", nullptr },
+	{ KEYBIND_KLIMB, "KLIMB", _s("Klimb"), "k", nullptr },
+	{ KEYBIND_LAUNCH, "LAUNCH", _s("Launch"), "l", nullptr },
+	{ KEYBIND_MAGIC, "MAGIC", _s("Magic"), "m", nullptr },
+	{ KEYBIND_NEGATE_TIME, "NEGATE_TIME", _s("Negate time"), "n", nullptr },
+	{ KEYBIND_OFFER, "OFFER", _s("Offer"), "o", nullptr },
+	{ KEYBIND_PASS, "PASS", _s("Pass"), "p", nullptr },
+	{ KEYBIND_QUIT, "QUIT", _s("Quit"), "q", nullptr },
+	{ KEYBIND_READY, "READY", _s("Ready"), "r", nullptr },
+	{ KEYBIND_STEAL, "STEAL", _s("Steal"), "s", nullptr },
+	{ KEYBIND_TRANSACT, "TRANSACT", _s("Transact"), "t", nullptr },
+	{ KEYBIND_UNLOCK, "UNLOCK", _s("Unlock"), "u", nullptr },
+	{ KEYBIND_VIEW, "VIEW", _s("View"), "v", nullptr },
+	{ KEYBIND_WEAR_ARMOR, "WEAR_ARMOR", _s("Wear armor"), "w", nullptr },
+	{ KEYBIND_X_IT, "X_IT", _s("eXit"), "x", nullptr },
+	{ KEYBIND_YELL, "YELL", _s("Yell"), "y", nullptr },
+	{ KEYBIND_ZSTATS, "ZSTATS", _s("Ztats"), "z", nullptr },
 	{ KEYBIND_NONE, nullptr, nullptr, nullptr, nullptr }
 };
 
@@ -65,9 +91,16 @@ static const KeysRecord MINIMAL_RECORDS[] = {
 	{ nullptr, nullptr, nullptr }
 };
 
+static const KeysRecord GAMEPLAY_RECORDS[] = {
+	{ "Ultima2", _s("Basic keys"), MINIMAL_KEYS },
+	{ "gameplay", _s("Gameplay keys"), GAMEPLAY_KEYS },
+	{ nullptr, nullptr, nullptr }
+};
+
 static const KeysRecord *MODE_RECORDS[] = {
 	ALL_RECORDS,
-	MINIMAL_RECORDS
+	MINIMAL_RECORDS,
+	GAMEPLAY_RECORDS
 };
 
 Common::KeymapArray MetaEngine::initKeymaps(KeybindingMode mode) {
diff --git a/engines/ultima/ultima2/metaengine.h b/engines/ultima/ultima2/metaengine.h
index 562872bf926..39343c30d8c 100644
--- a/engines/ultima/ultima2/metaengine.h
+++ b/engines/ultima/ultima2/metaengine.h
@@ -27,17 +27,20 @@
 namespace Ultima {
 namespace Ultima2 {
 
-// TODO: Extend with the full 26-command A-Z keyset once the base Logic
-// class and its command dispatch are added (see the ULTIMA2 implementation
-// plan, Stage 4).
 enum KeybindingAction {
 	KEYBIND_UP, KEYBIND_DOWN, KEYBIND_LEFT, KEYBIND_RIGHT,
+	KEYBIND_ATTACK, KEYBIND_BOARD, KEYBIND_CAST, KEYBIND_DESCEND, KEYBIND_ENTER, KEYBIND_FIRE,
+	KEYBIND_GET, KEYBIND_HYPER, KEYBIND_IGNITE_TORCH, KEYBIND_JUMP, KEYBIND_KLIMB, KEYBIND_LAUNCH,
+	KEYBIND_MAGIC, KEYBIND_NEGATE_TIME, KEYBIND_OFFER, KEYBIND_PASS, KEYBIND_QUIT, KEYBIND_READY,
+	KEYBIND_STEAL, KEYBIND_TRANSACT, KEYBIND_UNLOCK, KEYBIND_VIEW, KEYBIND_WEAR_ARMOR,
+	KEYBIND_X_IT, KEYBIND_YELL, KEYBIND_ZSTATS,
 	KEYBIND_NONE
 };
 
 enum KeybindingMode {
 	KBMODE_ALL,
-	KBMODE_MINIMAL
+	KBMODE_MINIMAL,
+	KBMODE_GAMEPLAY
 };
 
 class MetaEngine {
diff --git a/engines/ultima/ultima2/ultima2.h b/engines/ultima/ultima2/ultima2.h
index 07df9143cff..e8c85b087b5 100644
--- a/engines/ultima/ultima2/ultima2.h
+++ b/engines/ultima/ultima2/ultima2.h
@@ -25,6 +25,7 @@
 #include "common/scummsys.h"
 #include "common/system.h"
 #include "common/error.h"
+#include "common/ptr.h"
 #include "common/util.h"
 #include "engines/engine.h"
 #include "ultima/detection.h"
@@ -32,6 +33,7 @@
 #include "ultima/ultima2/data/map.h"
 #include "ultima/ultima2/data/map_dungeon.h"
 #include "ultima/ultima2/data/savegame.h"
+#include "ultima/ultima2/logic/logic.h"
 
 namespace Ultima {
 namespace Ultima2 {
@@ -57,6 +59,7 @@ public:
 	Data::Savegame _savegame;
 	Data::Map _map;
 	Data::MapDungeon _dungeon;
+	Common::SharedPtr<Logic::Logic> _logic;
 
 public:
 	Ultima2Engine(OSystem *syst, const Ultima::UltimaGameDescription *gameDesc);
diff --git a/engines/ultima/ultima2/views/commands.cpp b/engines/ultima/ultima2/views/commands.cpp
new file mode 100644
index 00000000000..4385ba44234
--- /dev/null
+++ b/engines/ultima/ultima2/views/commands.cpp
@@ -0,0 +1,100 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "ultima/ultima2/views/commands.h"
+#include "ultima/ultima2/ultima2.h"
+#include "ultima/shared/gfx/rect.h"
+
+namespace Ultima {
+namespace Ultima2 {
+namespace Views {
+
+constexpr int COLOR_TEXT = 3; // white, within the game's 4-color CGA palette
+constexpr int NEWLINE_DELAY = 50;
+constexpr int PROMPT_ROW = 3; // last of the 4 rows within Commands' own bounds
+constexpr int PROMPT_ABSOLUTE_ROW = 23;
+
+Commands::Commands(UIElement *parent) : Shared::UIElement("Commands", parent), _textCursor("CommandsCursor", this, COLOR_TEXT) {
+}
+
+void Commands::draw() {
+	_surface = getSurface();
+	_surface.clear();
+	_surface.setTextPos(Common::Point(0, PROMPT_ROW));
+	_surface.setScrollable(true);
+	_surface.setColor(COLOR_TEXT);
+
+	prompt();
+}
+
+bool Commands::msgGame(const GameMessage &msg) {
+	if (msg._name == "TEXT") {
+		writeString(msg._stringValue);
+		return true;
+	} else if (msg._name == "RESET_LINE") {
+		resetLine();
+		return true;
+	} else if (msg._name == "SHOW_CURSOR") {
+		showCursor();
+		return true;
+	} else if (msg._name == "PROMPT") {
+		prompt();
+		return true;
+	} else if (msg._name == "DELAY") {
+		delay(msg._value);
+		return true;
+	}
+
+	return false;
+}
+
+void Commands::writeString(const Common::String &msg) {
+	_textCursor.hide();
+	_surface.writeString(msg);
+
+	if (msg.contains('\n'))
+		delay(NEWLINE_DELAY);
+}
+
+void Commands::resetLine() {
+	_surface.fillRect(TextRect(0, PROMPT_ROW, 28, PROMPT_ROW), 0);
+	_surface.setTextPos(Common::Point(0, PROMPT_ROW));
+}
+
+void Commands::showCursor() {
+	_textCursor.setPosition(Common::Point(_surface.getTextPos().x, PROMPT_ABSOLUTE_ROW));
+	_textCursor.show();
+}
+
+void Commands::prompt() {
+	resetLine();
+	_surface.writeString("CMD: ");
+	showCursor();
+}
+
+void Commands::delay(uint milli) {
+	g_engine->updateScreen();
+	g_engine->pauseMillis(milli);
+}
+
+} // namespace Views
+} // namespace Ultima2
+} // namespace Ultima
diff --git a/engines/ultima/ultima2/views/commands.h b/engines/ultima/ultima2/views/commands.h
new file mode 100644
index 00000000000..4598adeedc0
--- /dev/null
+++ b/engines/ultima/ultima2/views/commands.h
@@ -0,0 +1,61 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef ULTIMA2_VIEWS_COMMANDS_H
+#define ULTIMA2_VIEWS_COMMANDS_H
+
+#include "ultima/shared/engine/events.h"
+#include "ultima/ultima2/gfx/text_cursor.h"
+
+namespace Ultima {
+namespace Ultima2 {
+namespace Views {
+
+using namespace Shared::Messages;
+
+/**
+ * The scrolling message log and "CMD: " prompt at the bottom of the
+ * game screen.
+ */
+class Commands : public Shared::UIElement {
+private:
+	Shared::Gfx::GfxSurface _surface;
+	Gfx::TextCursor _textCursor;
+
+	void delay(uint milli);
+	void writeString(const Common::String &msg);
+	void resetLine();
+	void showCursor();
+	void prompt();
+
+public:
+	Commands(UIElement *parent);
+	~Commands() override {}
+
+	void draw() override;
+	bool msgGame(const GameMessage &msg) override;
+};
+
+} // namespace Views
+} // namespace Ultima2
+} // namespace Ultima
+
+#endif
diff --git a/engines/ultima/ultima2/views/create_character.cpp b/engines/ultima/ultima2/views/create_character.cpp
index 90714107dea..8d9db15690d 100644
--- a/engines/ultima/ultima2/views/create_character.cpp
+++ b/engines/ultima/ultima2/views/create_character.cpp
@@ -223,7 +223,7 @@ void CreateCharacter::drawDone(Shared::Gfx::GfxSurface &s) {
 	s.writeString(Common::Point(4, 8), "CHR:%d WIS:%d INT:%d", sg._charisma, sg._wisdom, sg._intelligence);
 	s.writeString(Common::Point(4, 10), "HP:%d FOOD:%d GOLD:%d", sg._hp, sg._food, sg._gold);
 
-	s.writeString(Common::Point(4, 13), "PRESS ANY KEY TO RETURN TO THE MENU");
+	s.writeString(Common::Point(4, 13), "PRESS ANY KEY TO ENTER THE WORLD");
 }
 
 bool CreateCharacter::msgKeypress(const KeypressMessage &msg) {
@@ -331,7 +331,7 @@ bool CreateCharacter::msgKeypress(const KeypressMessage &msg) {
 		break;
 
 	case DONE:
-		replaceView("Title");
+		_G(map).load(sg._mapNum1, sg._mapNum2);
 		break;
 	}
 
diff --git a/engines/ultima/ultima2/views/game.cpp b/engines/ultima/ultima2/views/game.cpp
new file mode 100644
index 00000000000..f40c48bffa1
--- /dev/null
+++ b/engines/ultima/ultima2/views/game.cpp
@@ -0,0 +1,37 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "ultima/ultima2/views/game.h"
+#include "ultima/shared/gfx/rect.h"
+
+namespace Ultima {
+namespace Ultima2 {
+namespace Views {
+
+Game::Game() : Shared::Gfx::View("Game"), _commands(this), _stats(this) {
+	setBounds(TextRect(0, 0, 39, 24));
+	_commands.setBounds(TextRect(0, 20, 28, 23));
+	_stats.setBounds(TextRect(30, 20, 39, 23));
+}
+
+} // namespace Views
+} // namespace Ultima2
+} // namespace Ultima
diff --git a/engines/ultima/ultima2/views/game.h b/engines/ultima/ultima2/views/game.h
new file mode 100644
index 00000000000..2b38eceb285
--- /dev/null
+++ b/engines/ultima/ultima2/views/game.h
@@ -0,0 +1,51 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef ULTIMA2_VIEWS_GAME_H
+#define ULTIMA2_VIEWS_GAME_H
+
+#include "ultima/shared/gfx/view.h"
+#include "ultima/ultima2/views/commands.h"
+#include "ultima/ultima2/views/stats.h"
+
+namespace Ultima {
+namespace Ultima2 {
+namespace Views {
+
+/**
+ * The main in-game screen frame. Owns the Commands log/prompt and Stats
+ * panel; the map viewport above them is a separate view pushed on top.
+ */
+class Game : public Shared::Gfx::View {
+private:
+	Commands _commands;
+	Stats _stats;
+
+public:
+	Game();
+	~Game() override {}
+};
+
+} // namespace Views
+} // namespace Ultima2
+} // namespace Ultima
+
+#endif
diff --git a/engines/ultima/ultima2/views/map.cpp b/engines/ultima/ultima2/views/map.cpp
new file mode 100644
index 00000000000..9a9290a0a67
--- /dev/null
+++ b/engines/ultima/ultima2/views/map.cpp
@@ -0,0 +1,41 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "ultima/ultima2/views/map.h"
+#include "ultima/ultima2/ultima2.h"
+
+namespace Ultima {
+namespace Ultima2 {
+namespace Views {
+
+bool Map::msgAction(const ActionMessage &msg) {
+	g_engine->_logic->action(msg._action);
+	return true;
+}
+
+bool Map::msgKeypress(const KeypressMessage &msg) {
+	g_engine->_logic->keypress(msg.keycode);
+	return true;
+}
+
+} // namespace Views
+} // namespace Ultima2
+} // namespace Ultima
diff --git a/engines/ultima/ultima2/views/map.h b/engines/ultima/ultima2/views/map.h
new file mode 100644
index 00000000000..dd25e80a19a
--- /dev/null
+++ b/engines/ultima/ultima2/views/map.h
@@ -0,0 +1,49 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef ULTIMA2_VIEWS_MAP_H
+#define ULTIMA2_VIEWS_MAP_H
+
+#include "ultima/shared/gfx/view.h"
+
+namespace Ultima {
+namespace Ultima2 {
+namespace Views {
+
+using namespace Shared::Messages;
+
+/**
+ * Base class for map views - forwards player input into the active Logic
+ */
+class Map : public Shared::Gfx::View {
+public:
+	Map(const Common::String &name) : View(name) {}
+	~Map() override {}
+
+	bool msgAction(const ActionMessage &msg) override;
+	bool msgKeypress(const KeypressMessage &msg) override;
+};
+
+} // namespace Views
+} // namespace Ultima2
+} // namespace Ultima
+
+#endif
diff --git a/engines/ultima/ultima2/views/overworld_map.cpp b/engines/ultima/ultima2/views/overworld_map.cpp
new file mode 100644
index 00000000000..2bc752532b7
--- /dev/null
+++ b/engines/ultima/ultima2/views/overworld_map.cpp
@@ -0,0 +1,85 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "common/system.h"
+#include "graphics/paletteman.h"
+#include "ultima/ultima2/views/overworld_map.h"
+#include "ultima/ultima2/ultima2.h"
+#include "ultima/ultima2/metaengine.h"
+#include "ultima/ultima2/gfx/pic_decoder.h"
+
+namespace Ultima {
+namespace Ultima2 {
+namespace Views {
+
+constexpr int TILE_WIDTH = 16;
+constexpr int TILE_HEIGHT = 16;
+constexpr int VIEWPORT_WIDTH = 20;
+constexpr int VIEWPORT_HEIGHT = 10;
+constexpr int PLAYER_VIEWPORT_X = 9;
+constexpr int PLAYER_VIEWPORT_Y = 5;
+
+OverworldMap::OverworldMap() : Map("OverworldMap") {
+	setBounds(TextRect(0, 0, 39, 19));
+	Data::loadTiles(_tiles);
+}
+
+OverworldMap::~OverworldMap() {
+	for (int i = 0; i < Data::TILE_COUNT; ++i)
+		_tiles[i].free();
+}
+
+bool OverworldMap::msgFocus(const FocusMessage &msg) {
+	MetaEngine::setKeybindingMode(KBMODE_GAMEPLAY);
+	g_system->getPaletteManager()->setPalette(Graphics::Palette(Gfx::CGA_PALETTE1, 4));
+	return Map::msgFocus(msg);
+}
+
+bool OverworldMap::msgUnfocus(const UnfocusMessage &msg) {
+	MetaEngine::setKeybindingMode(KBMODE_MINIMAL);
+	return Map::msgUnfocus(msg);
+}
+
+void OverworldMap::draw() {
+	auto s = getSurface();
+	s.clear();
+
+	Data::Savegame &sg = _G(savegame);
+	int mapLeft = sg._mapX - PLAYER_VIEWPORT_X;
+	int mapTop = sg._mapY - PLAYER_VIEWPORT_Y;
+
+	for (int oy = 0; oy < VIEWPORT_HEIGHT; ++oy) {
+		for (int ox = 0; ox < VIEWPORT_WIDTH; ++ox) {
+			int x = mapLeft + ox, y = mapTop + oy;
+			Data::TileId tileId = (x >= 0 && x < Data::MAP_WIDTH && y >= 0 && y < Data::MAP_HEIGHT) ?
+				_G(map).tileAt(x, y) : Data::TILE_WATER;
+
+			if (ox == PLAYER_VIEWPORT_X && oy == PLAYER_VIEWPORT_Y)
+				tileId = (Data::TileId)(Data::TILE_FIGHTER + sg._class);
+
+			s.blitFrom(_tiles[tileId], Common::Point(ox * TILE_WIDTH, oy * TILE_HEIGHT));
+		}
+	}
+}
+
+} // namespace Views
+} // namespace Ultima2
+} // namespace Ultima
diff --git a/engines/ultima/ultima2/views/overworld_map.h b/engines/ultima/ultima2/views/overworld_map.h
new file mode 100644
index 00000000000..ae49a83d752
--- /dev/null
+++ b/engines/ultima/ultima2/views/overworld_map.h
@@ -0,0 +1,53 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef ULTIMA2_VIEWS_OVERWORLD_MAP_H
+#define ULTIMA2_VIEWS_OVERWORLD_MAP_H
+
+#include "ultima/ultima2/views/map.h"
+#include "ultima/ultima2/data/tiles.h"
+
+namespace Ultima {
+namespace Ultima2 {
+namespace Views {
+
+/**
+ * Renders the 20x10-tile viewport centered on the player for a planet,
+ * village, town, or castle map.
+ */
+class OverworldMap : public Map {
+private:
+	Graphics::Surface _tiles[Data::TILE_COUNT];
+
+public:
+	OverworldMap();
+	~OverworldMap() override;
+
+	bool msgFocus(const FocusMessage &msg) override;
+	bool msgUnfocus(const UnfocusMessage &msg) override;
+	void draw() override;
+};
+
+} // namespace Views
+} // namespace Ultima2
+} // namespace Ultima
+
+#endif
diff --git a/engines/ultima/ultima2/views/stats.cpp b/engines/ultima/ultima2/views/stats.cpp
new file mode 100644
index 00000000000..11cedf73a4d
--- /dev/null
+++ b/engines/ultima/ultima2/views/stats.cpp
@@ -0,0 +1,62 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "ultima/ultima2/views/stats.h"
+#include "ultima/ultima2/ultima2.h"
+
+namespace Ultima {
+namespace Ultima2 {
+namespace Views {
+
+constexpr int COLOR_TEXT = 3; // white, within the game's 4-color CGA palette
+
+void Stats::draw() {
+	Data::Savegame &sg = _G(savegame);
+	auto s = getSurface();
+	s.clear();
+
+	s.setColor(COLOR_TEXT);
+	s.writeString(Common::Point(0, 0), "H.P.=");
+	if (sg._hp == 0)
+		s.reverseColor();
+	s.writeString(Common::Point(5, 0), "%4d", sg._hp);
+	if (sg._hp == 0)
+		s.reverseColor();
+
+	s.setColor(COLOR_TEXT);
+	s.writeString(Common::Point(0, 1), "FOOD=");
+	if (sg._food == 0)
+		s.reverseColor();
+	s.writeString(Common::Point(5, 1), "%4d", sg._food);
+	if (sg._food == 0)
+		s.reverseColor();
+
+	s.setColor(COLOR_TEXT);
+	s.writeString(Common::Point(0, 2), "EXP.=");
+	s.writeString(Common::Point(5, 2), "%4d", sg._experience);
+
+	s.writeString(Common::Point(0, 3), "GOLD=");
+	s.writeString(Common::Point(5, 3), "%4d", sg._gold);
+}
+
+} // namespace Views
+} // namespace Ultima2
+} // namespace Ultima
diff --git a/engines/ultima/ultima2/views/stats.h b/engines/ultima/ultima2/views/stats.h
new file mode 100644
index 00000000000..72834ad6428
--- /dev/null
+++ b/engines/ultima/ultima2/views/stats.h
@@ -0,0 +1,47 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef ULTIMA2_VIEWS_STATS_H
+#define ULTIMA2_VIEWS_STATS_H
+
+#include "ultima/shared/engine/events.h"
+
+namespace Ultima {
+namespace Ultima2 {
+namespace Views {
+
+/**
+ * The always-visible H.P./FOOD/EXP./GOLD display in the corner of the
+ * game screen.
+ */
+class Stats : public Shared::UIElement {
+public:
+	Stats(UIElement *parent) : Shared::UIElement("Stats", parent) {}
+	~Stats() override {}
+
+	void draw() override;
+};
+
+} // namespace Views
+} // namespace Ultima2
+} // namespace Ultima
+
+#endif
diff --git a/engines/ultima/ultima2/views/views.h b/engines/ultima/ultima2/views/views.h
index 5a73c860b3e..c8221c38774 100644
--- a/engines/ultima/ultima2/views/views.h
+++ b/engines/ultima/ultima2/views/views.h
@@ -24,6 +24,8 @@
 
 #include "ultima/shared/engine/events.h"
 #include "ultima/ultima2/views/create_character.h"
+#include "ultima/ultima2/views/game.h"
+#include "ultima/ultima2/views/overworld_map.h"
 #include "ultima/ultima2/views/startup.h"
 #include "ultima/ultima2/views/title.h"
 
@@ -33,6 +35,8 @@ namespace Views {
 
 struct Views : public Shared::Views {
 	CreateCharacter _createCharacter;
+	Game _game;
+	OverworldMap _overworldMap;
 	Startup _startup;
 	Title _title;
 };


Commit: cc9932bdafe9661442cb4b83c2fc2bdebb5e0079
    https://github.com/scummvm/scummvm/commit/cc9932bdafe9661442cb4b83c2fc2bdebb5e0079
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:40:54+11:00

Commit Message:
ULTIMA: ULTIMA2: Added savegame code

Changed paths:
  A engines/ultima/ultima2/data/savegame.cpp
    engines/ultima/module.mk
    engines/ultima/ultima2/data/savegame.h
    engines/ultima/ultima2/ultima2.cpp
    engines/ultima/ultima2/ultima2.h
    engines/ultima/ultima2/views/map.h
    engines/ultima/ultima2/views/overworld_map.cpp


diff --git a/engines/ultima/module.mk b/engines/ultima/module.mk
index 8b727cf1fe6..ecfec835db9 100644
--- a/engines/ultima/module.mk
+++ b/engines/ultima/module.mk
@@ -114,6 +114,7 @@ MODULE_OBJS += \
 	ultima2/data/map.o \
 	ultima2/data/map_dungeon.o \
 	ultima2/data/map_monsters.o \
+	ultima2/data/savegame.o \
 	ultima2/data/tiles.o \
 	ultima2/gfx/pic_decoder.o \
 	ultima2/gfx/text_cursor.o \
diff --git a/engines/ultima/ultima2/data/savegame.cpp b/engines/ultima/ultima2/data/savegame.cpp
new file mode 100644
index 00000000000..06fc7fe61bd
--- /dev/null
+++ b/engines/ultima/ultima2/data/savegame.cpp
@@ -0,0 +1,86 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "ultima/ultima2/data/savegame.h"
+
+namespace Ultima {
+namespace Ultima2 {
+namespace Data {
+
+void Savegame::synchronize(Common::Serializer &s) {
+	s.syncBytes((byte *)_name, MAX_NAME_LENGTH + 1);
+	s.syncAsByte(_sex);
+	s.syncAsByte(_race);
+	s.syncAsByte(_class);
+
+	s.syncAsSint16LE(_strength);
+	s.syncAsSint16LE(_agility);
+	s.syncAsSint16LE(_stamina);
+	s.syncAsSint16LE(_charisma);
+	s.syncAsSint16LE(_wisdom);
+	s.syncAsSint16LE(_intelligence);
+
+	s.syncAsSint16LE(_hp);
+	s.syncAsSint16LE(_food);
+	s.syncAsSint16LE(_foodTurnCtr);
+	s.syncAsSint16LE(_experience);
+	s.syncAsSint16LE(_gold);
+
+	s.syncAsByte(_mapNum1);
+	s.syncAsByte(_mapNum2);
+	s.syncAsByte(_mapX);
+	s.syncAsByte(_mapY);
+
+	s.syncAsByte(_readiedWeapon);
+	s.syncAsByte(_readiedArmor);
+	s.syncAsByte(_readiedSpell);
+
+	s.syncAsSint16LE(_torches);
+	s.syncAsSint16LE(_keys);
+	s.syncAsSint16LE(_thievesTools);
+
+	s.syncAsByte(_inSpace);
+	s.syncAsByte(_launchMapX);
+	s.syncAsByte(_launchMapY);
+
+	s.syncAsByte(_saveDisabled);
+	s.syncAsSint16LE(_orbitTarget);
+
+	s.syncAsByte(_ringQuestFlag);
+	s.syncAsByte(_enilnoOwned);
+	s.syncAsByte(_patrolWaypoint);
+
+	for (int i = 0; i < 9; ++i)
+		s.syncAsByte(_offerRewardItems[i]);
+
+	for (int i = 0; i < ARMOR_COUNT; ++i)
+		s.syncAsSint16LE(_armorOwned[i]);
+	for (int i = 0; i < WEAPON_COUNT; ++i)
+		s.syncAsSint16LE(_weaponOwned[i]);
+	for (int i = 0; i < SPELL_COUNT; ++i)
+		s.syncAsSint16LE(_spellCharges[i]);
+	for (int i = 0; i < ITEM_COUNT; ++i)
+		s.syncAsSint16LE(_items[i]);
+}
+
+} // namespace Data
+} // namespace Ultima2
+} // namespace Ultima
diff --git a/engines/ultima/ultima2/data/savegame.h b/engines/ultima/ultima2/data/savegame.h
index 231d8c4a6ae..a0eb2f59cd3 100644
--- a/engines/ultima/ultima2/data/savegame.h
+++ b/engines/ultima/ultima2/data/savegame.h
@@ -22,6 +22,7 @@
 #ifndef ULTIMA2_DATA_SAVEGAME_H
 #define ULTIMA2_DATA_SAVEGAME_H
 
+#include "common/serializer.h"
 #include "ultima/ultima2/data/data.h"
 
 namespace Ultima {
@@ -91,6 +92,11 @@ struct Savegame {
 	int16 _weaponOwned[WEAPON_COUNT] = {};
 	int16 _spellCharges[SPELL_COUNT] = {};
 	int16 _items[ITEM_COUNT] = {};
+
+	/**
+	 * Synchronize savegame data
+	 */
+	void synchronize(Common::Serializer &s);
 };
 
 } // namespace Data
diff --git a/engines/ultima/ultima2/ultima2.cpp b/engines/ultima/ultima2/ultima2.cpp
index b51b6045784..6c00b297870 100644
--- a/engines/ultima/ultima2/ultima2.cpp
+++ b/engines/ultima/ultima2/ultima2.cpp
@@ -19,11 +19,14 @@
  *
  */
 
+#include "common/system.h"
+#include "common/savefile.h"
 #include "engines/util.h"
 #include "ultima/ultima2/ultima2.h"
 #include "ultima/ultima2/console.h"
 #include "ultima/ultima2/metaengine.h"
 #include "ultima/ultima2/views/views.h"
+#include "ultima/ultima2/views/map.h"
 
 namespace Ultima {
 namespace Ultima2 {
@@ -62,5 +65,29 @@ Common::Error Ultima2Engine::run() {
 	return Common::kNoError;
 }
 
+bool Ultima2Engine::canSaveGameStateCurrently(Common::U32String *msg) {
+	// Only allow saving when any of the different map views are active
+	return dynamic_cast<Views::Map *>(focusedView()) != nullptr;
+}
+
+Common::Error Ultima2Engine::syncGame(Common::Serializer &s) {
+	_savegame.synchronize(s);
+
+	if (s.isLoading()) {
+		_G(map).load(_G(savegame)._mapNum1, _G(savegame)._mapNum2);
+	}
+
+	return Common::kNoError;
+}
+
+bool Ultima2Engine::savegamesExist() const {
+	Common::String slotName = getSaveStateName(1);
+	Common::InSaveFile *saveFile = g_system->getSavefileManager()->openForLoading(slotName);
+	bool result = saveFile != nullptr;
+
+	delete saveFile;
+	return result;
+}
+
 } // namespace Ultima2
 } // namespace Ultima
diff --git a/engines/ultima/ultima2/ultima2.h b/engines/ultima/ultima2/ultima2.h
index e8c85b087b5..62c6e5de079 100644
--- a/engines/ultima/ultima2/ultima2.h
+++ b/engines/ultima/ultima2/ultima2.h
@@ -26,6 +26,7 @@
 #include "common/system.h"
 #include "common/error.h"
 #include "common/ptr.h"
+#include "common/serializer.h"
 #include "common/util.h"
 #include "engines/engine.h"
 #include "ultima/detection.h"
@@ -74,8 +75,35 @@ public:
 
 	bool hasFeature(EngineFeature f) const override {
 		return
+			(f == kSupportsLoadingDuringRuntime) ||
+			(f == kSupportsSavingDuringRuntime) ||
 			(f == kSupportsReturnToLauncher);
 	};
+
+	bool canLoadGameStateCurrently(Common::U32String *msg = nullptr) override {
+		return true;
+	}
+	bool canSaveGameStateCurrently(Common::U32String *msg = nullptr) override;
+
+	/**
+	 * Uses a serializer to allow implementing savegame
+	 * loading and saving using a single method
+	 */
+	Common::Error syncGame(Common::Serializer &s);
+
+	Common::Error saveGameStream(Common::WriteStream *stream, bool isAutosave = false) override {
+		Common::Serializer s(nullptr, stream);
+		return syncGame(s);
+	}
+	Common::Error loadGameStream(Common::SeekableReadStream *stream) override {
+		Common::Serializer s(stream, nullptr);
+		return syncGame(s);
+	}
+
+	/**
+	 * Returns true if any savegames exist
+	 */
+	bool savegamesExist() const;
 };
 
 extern Ultima2Engine *g_engine;
diff --git a/engines/ultima/ultima2/views/map.h b/engines/ultima/ultima2/views/map.h
index dd25e80a19a..fab751a1590 100644
--- a/engines/ultima/ultima2/views/map.h
+++ b/engines/ultima/ultima2/views/map.h
@@ -35,7 +35,9 @@ using namespace Shared::Messages;
  */
 class Map : public Shared::Gfx::View {
 public:
-	Map(const Common::String &name) : View(name) {}
+	Map(const Common::String &name) : View(name) {
+		setBounds(TextRect(0, 0, 39, 19));
+	}
 	~Map() override {}
 
 	bool msgAction(const ActionMessage &msg) override;
diff --git a/engines/ultima/ultima2/views/overworld_map.cpp b/engines/ultima/ultima2/views/overworld_map.cpp
index 2bc752532b7..9e1194835ba 100644
--- a/engines/ultima/ultima2/views/overworld_map.cpp
+++ b/engines/ultima/ultima2/views/overworld_map.cpp
@@ -38,7 +38,6 @@ constexpr int PLAYER_VIEWPORT_X = 9;
 constexpr int PLAYER_VIEWPORT_Y = 5;
 
 OverworldMap::OverworldMap() : Map("OverworldMap") {
-	setBounds(TextRect(0, 0, 39, 19));
 	Data::loadTiles(_tiles);
 }
 


Commit: d687b940be87e52d71eedf547e76bbcba6355fcd
    https://github.com/scummvm/scummvm/commit/d687b940be87e52d71eedf547e76bbcba6355fcd
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:40:54+11:00

Commit Message:
ULTIMA: ULTIMA2: Add overworld movement and turn loop

Changed paths:
  A engines/ultima/ultima2/logic/overworld_logic.cpp
  A engines/ultima/ultima2/views/world_map_overview.cpp
  A engines/ultima/ultima2/views/world_map_overview.h
    engines/ultima/module.mk
    engines/ultima/ultima2/data/savegame.cpp
    engines/ultima/ultima2/data/savegame.h
    engines/ultima/ultima2/logic/logic.cpp
    engines/ultima/ultima2/logic/logic.h
    engines/ultima/ultima2/logic/overworld_logic.h
    engines/ultima/ultima2/views/map.cpp
    engines/ultima/ultima2/views/views.h


diff --git a/engines/ultima/module.mk b/engines/ultima/module.mk
index ecfec835db9..506b5fa4fef 100644
--- a/engines/ultima/module.mk
+++ b/engines/ultima/module.mk
@@ -119,6 +119,7 @@ MODULE_OBJS += \
 	ultima2/gfx/pic_decoder.o \
 	ultima2/gfx/text_cursor.o \
 	ultima2/logic/logic.o \
+	ultima2/logic/overworld_logic.o \
 	ultima2/views/commands.o \
 	ultima2/views/create_character.o \
 	ultima2/views/game.o \
@@ -126,7 +127,8 @@ MODULE_OBJS += \
 	ultima2/views/overworld_map.o \
 	ultima2/views/startup.o \
 	ultima2/views/stats.o \
-	ultima2/views/title.o
+	ultima2/views/title.o \
+	ultima2/views/world_map_overview.o
 endif
 
 ifdef ENABLE_ULTIMA4
diff --git a/engines/ultima/ultima2/data/savegame.cpp b/engines/ultima/ultima2/data/savegame.cpp
index 06fc7fe61bd..632b27c8ca5 100644
--- a/engines/ultima/ultima2/data/savegame.cpp
+++ b/engines/ultima/ultima2/data/savegame.cpp
@@ -79,6 +79,12 @@ void Savegame::synchronize(Common::Serializer &s) {
 		s.syncAsSint16LE(_spellCharges[i]);
 	for (int i = 0; i < ITEM_COUNT; ++i)
 		s.syncAsSint16LE(_items[i]);
+
+	s.syncAsSint16LE(_legParalysisTurns);
+	s.syncAsSint16LE(_armParalysisTurns);
+	s.syncAsSint16LE(_sleepTurns);
+	s.syncAsSint16LE(_negateTimeTurns);
+	s.syncAsSint16LE(_lightTurns);
 }
 
 } // namespace Data
diff --git a/engines/ultima/ultima2/data/savegame.h b/engines/ultima/ultima2/data/savegame.h
index a0eb2f59cd3..39be045d9a2 100644
--- a/engines/ultima/ultima2/data/savegame.h
+++ b/engines/ultima/ultima2/data/savegame.h
@@ -93,10 +93,45 @@ struct Savegame {
 	int16 _spellCharges[SPELL_COUNT] = {};
 	int16 _items[ITEM_COUNT] = {};
 
+	// Turn-based status counters, decremented once per turn in Logic::endOfTurn
+	int16 _legParalysisTurns = 0;
+	int16 _armParalysisTurns = 0;
+	int16 _sleepTurns = 0;
+	int16 _negateTimeTurns = 0;
+	// Torch/Light spell duration; only decremented by the (not yet implemented)
+	// dungeon renderer
+	int16 _lightTurns = 0;
+
 	/**
 	 * Synchronize savegame data
 	 */
 	void synchronize(Common::Serializer &s);
+
+	/**
+	 * Deducts an amount from HP. Returns false if this was fatal.
+	 */
+	bool deductHP(int amount) {
+		_hp -= amount;
+		if (_hp > 0)
+			return true;
+
+		_hp = 0;
+		return false;
+	}
+
+	/**
+	 * Deducts an amount from food (stored as whole units in _food plus
+	 * hundredths in _foodTurnCtr). Returns false if food ran out.
+	 */
+	bool deductFood(int amount) {
+		int total = _food * 100 + _foodTurnCtr - amount;
+		if (total < 0)
+			return false;
+
+		_food = total / 100;
+		_foodTurnCtr = total % 100;
+		return true;
+	}
 };
 
 } // namespace Data
diff --git a/engines/ultima/ultima2/logic/logic.cpp b/engines/ultima/ultima2/logic/logic.cpp
index c63f8aeb6a0..33d5dab0fc6 100644
--- a/engines/ultima/ultima2/logic/logic.cpp
+++ b/engines/ultima/ultima2/logic/logic.cpp
@@ -54,6 +54,20 @@ void Logic::redrawStats() {
 	g_engine->baseView()->findView("Stats")->draw();
 }
 
+void Logic::playerDied() {
+	Data::Savegame &sg = _G(savegame);
+	writeString("\n%s IS DEAD!\n", sg._name);
+
+	sg._hp = 0;
+	sg._food = 0;
+	sg._foodTurnCtr = 0;
+	sg._experience = 0;
+	sg._gold = 0;
+
+	// UIElement* overload used directly since the string-name one drops replaceAllViews
+	g_engine->replaceView(g_engine->findView("Title"), true);
+}
+
 int Logic::getRandomNumber(int minNumber, int maxNumber) {
 	return g_engine->getRandomNumber(minNumber, maxNumber);
 }
@@ -64,6 +78,17 @@ int Logic::getRandomNumber(int maxNumber) {
 
 void Logic::endOfTurn() {
 	updateCreatures();
+
+	Data::Savegame &sg = _G(savegame);
+	if (sg._legParalysisTurns > 0)
+		--sg._legParalysisTurns;
+	if (sg._armParalysisTurns > 0)
+		--sg._armParalysisTurns;
+	if (sg._sleepTurns > 0)
+		--sg._sleepTurns;
+	if (sg._negateTimeTurns > 0)
+		--sg._negateTimeTurns;
+
 	redrawMap();
 	redrawStats();
 }
@@ -179,7 +204,19 @@ void Logic::action(int action) {
 	}
 }
 
-void Logic::keypress(Common::KeyCode keycode) {
+void Logic::keypress(const Shared::Messages::KeypressMessage &msg) {
+	if (_yelling) {
+		if (msg.ascii == 13) {
+			writeString("\n");
+			_yelling = false;
+			MetaEngine::setKeybindingMode(KBMODE_GAMEPLAY);
+			resumeTurn();
+		} else if (msg.ascii >= 32 && msg.ascii < 127) {
+			writeString("%c", (char)msg.ascii);
+		}
+		return;
+	}
+
 	writeString("Huh?\n");
 	endOfTurn();
 	prompt();
@@ -226,7 +263,19 @@ bool Logic::hyper() {
 }
 
 bool Logic::igniteTorch() {
-	writeString("Ignite Torch?\n");
+	writeString("IGNITE TORCH\n");
+	Data::Savegame &sg = _G(savegame);
+
+	if (sg._mapNum2 < 4)
+		return true;
+
+	if (sg._torches == 0) {
+		writeString("NONE OWNED!\n");
+		return true;
+	}
+
+	--sg._torches;
+	sg._lightTurns = 150;
 	return true;
 }
 
@@ -261,7 +310,7 @@ bool Logic::offer() {
 }
 
 bool Logic::pass() {
-	writeString("Pass\n");
+	writeString("PASS\n");
 	return true;
 }
 
@@ -291,8 +340,17 @@ bool Logic::unlock() {
 }
 
 bool Logic::view() {
-	writeString("View?\n");
-	return true;
+	Data::Savegame &sg = _G(savegame);
+
+	if (sg._items[Data::ITEM_HELM] == 0 || sg._mapNum2 >= 4) {
+		writeString("VIEW WHAT?\n");
+		return true;
+	}
+
+	writeString("VIEW\nWITH MAGICAL HELM!\n");
+	--sg._items[Data::ITEM_HELM];
+	g_engine->addView("WorldMapOverview");
+	return false;
 }
 
 bool Logic::wearArmor() {
@@ -306,8 +364,10 @@ bool Logic::xit() {
 }
 
 bool Logic::yell() {
-	writeString("Yell?\n");
-	return true;
+	writeString("YELL WHAT?\n");
+	_yelling = true;
+	MetaEngine::setKeybindingMode(KBMODE_MINIMAL);
+	return false;
 }
 
 bool Logic::zstats() {
diff --git a/engines/ultima/ultima2/logic/logic.h b/engines/ultima/ultima2/logic/logic.h
index 6a030c3be3a..582638f5d68 100644
--- a/engines/ultima/ultima2/logic/logic.h
+++ b/engines/ultima/ultima2/logic/logic.h
@@ -22,8 +22,8 @@
 #ifndef ULTIMA2_LOGIC_LOGIC_H
 #define ULTIMA2_LOGIC_LOGIC_H
 
-#include "common/events.h"
 #include "ultima/ultima2/data/data.h"
+#include "ultima/shared/engine/messages.h"
 
 namespace Ultima {
 namespace Ultima2 {
@@ -37,6 +37,10 @@ namespace Logic {
  */
 class Logic {
 protected:
+	// Set while a yell()'d message is being typed in, echoing raw keypresses
+	// back out until Enter is pressed
+	bool _yelling = false;
+
 	/**
 	 * Dispatches some text to be shown in the Commands window
 	 */
@@ -48,6 +52,12 @@ protected:
 	 */
 	void prompt();
 
+	/**
+	 * Handles the player dying - clears their resources and returns to
+	 * the title screen
+	 */
+	void playerDied();
+
 	/**
 	 * Signal the map to redraw
 	 */
@@ -116,7 +126,7 @@ public:
 	}
 
 	virtual void action(int action);
-	virtual void keypress(Common::KeyCode keycode);
+	virtual void keypress(const Shared::Messages::KeypressMessage &msg);
 	virtual void entering() {
 	}
 
@@ -125,6 +135,15 @@ public:
 	 */
 	virtual void tick() {
 	}
+
+	/**
+	 * Resumes end of turn processing after a command deferred it (returned
+	 * false from action()) to run some sub-interaction first
+	 */
+	void resumeTurn() {
+		endOfTurn();
+		prompt();
+	}
 };
 
 } // namespace Logic
diff --git a/engines/ultima/ultima2/logic/overworld_logic.cpp b/engines/ultima/ultima2/logic/overworld_logic.cpp
new file mode 100644
index 00000000000..64941431dad
--- /dev/null
+++ b/engines/ultima/ultima2/logic/overworld_logic.cpp
@@ -0,0 +1,118 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "ultima/ultima2/logic/overworld_logic.h"
+#include "ultima/ultima2/ultima2.h"
+
+namespace Ultima {
+namespace Ultima2 {
+namespace Logic {
+
+bool OverworldLogic::isWalkable(Data::TileId tile) const {
+	switch (tile) {
+	case Data::TILE_WATER:
+	case Data::TILE_MOUNTAIN:
+		return false;
+	case Data::TILE_HORSE:
+	case Data::TILE_SHIP:
+	case Data::TILE_AIRPLANE:
+	case Data::TILE_ROCKET:
+	case Data::TILE_SHIELD:
+	case Data::TILE_SWORD:
+	case Data::TILE_FORCEFIELD:
+	case Data::TILE_ROAD:
+		return true;
+	default:
+		return tile <= Data::TILE_SIGNPOST;
+	}
+}
+
+bool OverworldLogic::move(Data::Direction dir) {
+	Data::Savegame &sg = _G(savegame);
+
+	int newX = sg._mapX, newY = sg._mapY;
+	const char *dirName;
+	switch (dir) {
+	case Data::DIR_UP:
+		newY = (newY + Data::MAP_HEIGHT - 1) % Data::MAP_HEIGHT;
+		dirName = "NORTH";
+		break;
+	case Data::DIR_DOWN:
+		newY = (newY + 1) % Data::MAP_HEIGHT;
+		dirName = "SOUTH";
+		break;
+	case Data::DIR_LEFT:
+		newX = (newX + Data::MAP_WIDTH - 1) % Data::MAP_WIDTH;
+		dirName = "WEST";
+		break;
+	case Data::DIR_RIGHT:
+		newX = (newX + 1) % Data::MAP_WIDTH;
+		dirName = "EAST";
+		break;
+	default:
+		return true;
+	}
+
+	writeString("%s", dirName);
+
+	if (sg._legParalysisTurns > 0) {
+		writeString("--PARALIZED!--INVALID MOVE!\n");
+		return true;
+	}
+
+	Data::TileId destTile = _G(map).tileAt(newX, newY);
+
+	if (destTile == Data::TILE_SWAMP) {
+		if (!sg.deductHP(5)) {
+			playerDied();
+			return false;
+		}
+	} else if (destTile == Data::TILE_FORCEFIELD) {
+		if (sg._items[Data::ITEM_RING] != 0) {
+			writeString("\nRING PROTECTS FROM FIELD!\n");
+		} else {
+			writeString("\nFIELD CAUSES 1000 DAMAGE!\n");
+			if (!sg.deductHP(1000)) {
+				playerDied();
+				return false;
+			}
+		}
+	}
+
+	if (!sg.deductFood(25)) {
+		playerDied();
+		return false;
+	}
+
+	if (!isWalkable(destTile)) {
+		writeString("--INVALID MOVE!\n");
+		return true;
+	}
+
+	writeString("\n");
+	sg._mapX = newX;
+	sg._mapY = newY;
+	return true;
+}
+
+} // namespace Logic
+} // namespace Ultima2
+} // namespace Ultima
diff --git a/engines/ultima/ultima2/logic/overworld_logic.h b/engines/ultima/ultima2/logic/overworld_logic.h
index 1b3e5ff5fce..bb8e4c8945f 100644
--- a/engines/ultima/ultima2/logic/overworld_logic.h
+++ b/engines/ultima/ultima2/logic/overworld_logic.h
@@ -23,18 +23,26 @@
 #define ULTIMA2_LOGIC_OVERWORLD_LOGIC_H
 
 #include "ultima/ultima2/logic/logic.h"
+#include "ultima/ultima2/data/tiles.h"
 
 namespace Ultima {
 namespace Ultima2 {
 namespace Logic {
 
 /**
- * Command handling while on a planet's overworld. Movement and the rest
- * of the overworld-specific commands are added in a later stage.
+ * Command handling while on a planet's overworld.
  */
 class OverworldLogic : public Logic {
+private:
+	/**
+	 * Returns true if the given tile can be walked onto on foot
+	 */
+	bool isWalkable(Data::TileId tile) const;
+
 public:
 	~OverworldLogic() override {}
+
+	bool move(Data::Direction dir) override;
 };
 
 } // namespace Logic
diff --git a/engines/ultima/ultima2/views/map.cpp b/engines/ultima/ultima2/views/map.cpp
index 9a9290a0a67..fc04e3b545b 100644
--- a/engines/ultima/ultima2/views/map.cpp
+++ b/engines/ultima/ultima2/views/map.cpp
@@ -32,7 +32,7 @@ bool Map::msgAction(const ActionMessage &msg) {
 }
 
 bool Map::msgKeypress(const KeypressMessage &msg) {
-	g_engine->_logic->keypress(msg.keycode);
+	g_engine->_logic->keypress(msg);
 	return true;
 }
 
diff --git a/engines/ultima/ultima2/views/views.h b/engines/ultima/ultima2/views/views.h
index c8221c38774..367f5d50332 100644
--- a/engines/ultima/ultima2/views/views.h
+++ b/engines/ultima/ultima2/views/views.h
@@ -28,6 +28,7 @@
 #include "ultima/ultima2/views/overworld_map.h"
 #include "ultima/ultima2/views/startup.h"
 #include "ultima/ultima2/views/title.h"
+#include "ultima/ultima2/views/world_map_overview.h"
 
 namespace Ultima {
 namespace Ultima2 {
@@ -39,6 +40,7 @@ struct Views : public Shared::Views {
 	OverworldMap _overworldMap;
 	Startup _startup;
 	Title _title;
+	WorldMapOverview _worldMapOverview;
 };
 
 } // namespace Views
diff --git a/engines/ultima/ultima2/views/world_map_overview.cpp b/engines/ultima/ultima2/views/world_map_overview.cpp
new file mode 100644
index 00000000000..143267915cc
--- /dev/null
+++ b/engines/ultima/ultima2/views/world_map_overview.cpp
@@ -0,0 +1,94 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "ultima/ultima2/views/world_map_overview.h"
+#include "ultima/ultima2/data/map.h"
+#include "ultima/ultima2/ultima2.h"
+
+namespace Ultima {
+namespace Ultima2 {
+namespace Views {
+
+constexpr int COLOR_ICON = 3;
+
+// Each world cell maps to a 4-wide x 2-tall block of plot points; the
+// points lit within that block form a small per-terrain-category icon
+static const Common::Point ICON_MOUNTAIN_OR_SPRITE[] = { {0, 0}, {1, 0}, {0, 1}, {1, 1} };
+static const Common::Point ICON_GRASS[] = { {1, 0}, {2, 0} };
+static const Common::Point ICON_FOREST[] = { {1, 1}, {2, 1} };
+static const Common::Point ICON_SWAMP[] = { {0, 1}, {3, 1} };
+static const Common::Point ICON_ROAD[] = { {0, 0}, {3, 0}, {0, 1}, {3, 1} };
+static const Common::Point ICON_OTHER[] = { {1, 0}, {2, 0}, {1, 1}, {2, 1} };
+
+WorldMapOverview::WorldMapOverview() : View("WorldMapOverview") {
+	setBounds(TextRect(0, 0, 39, 24));
+}
+
+void WorldMapOverview::plotIcon(Shared::Gfx::GfxSurface &s, int cellX, int cellY, Data::TileId tile) {
+	const Common::Point *points;
+	int count;
+
+	if (tile == Data::TILE_WATER) {
+		return;
+	} else if (tile == Data::TILE_MOUNTAIN || (tile >= Data::TILE_WALL && tile <= Data::TILE_COUNTER_END_LEFT)) {
+		points = ICON_MOUNTAIN_OR_SPRITE;
+		count = ARRAYSIZE(ICON_MOUNTAIN_OR_SPRITE);
+	} else if (tile == Data::TILE_GRASS) {
+		points = ICON_GRASS;
+		count = ARRAYSIZE(ICON_GRASS);
+	} else if (tile == Data::TILE_FOREST) {
+		points = ICON_FOREST;
+		count = ARRAYSIZE(ICON_FOREST);
+	} else if (tile == Data::TILE_SWAMP) {
+		points = ICON_SWAMP;
+		count = ARRAYSIZE(ICON_SWAMP);
+	} else if (tile == Data::TILE_ROAD) {
+		points = ICON_ROAD;
+		count = ARRAYSIZE(ICON_ROAD);
+	} else {
+		points = ICON_OTHER;
+		count = ARRAYSIZE(ICON_OTHER);
+	}
+
+	int px = cellX * 4, py = cellY * 2;
+	for (int i = 0; i < count; ++i)
+		s.setPixel(px + points[i].x, py + points[i].y, COLOR_ICON);
+}
+
+void WorldMapOverview::draw() {
+	auto s = getSurface();
+	s.clear();
+
+	for (int y = 0; y < Data::MAP_HEIGHT; ++y) {
+		for (int x = 0; x < Data::MAP_WIDTH; ++x)
+			plotIcon(s, x, y, _G(map).tileAt(x, y));
+	}
+}
+
+bool WorldMapOverview::msgKeypress(const KeypressMessage &msg) {
+	close();
+	_G(logic)->resumeTurn();
+	return true;
+}
+
+} // namespace Views
+} // namespace Ultima2
+} // namespace Ultima
diff --git a/engines/ultima/ultima2/views/world_map_overview.h b/engines/ultima/ultima2/views/world_map_overview.h
new file mode 100644
index 00000000000..39c4f6c6594
--- /dev/null
+++ b/engines/ultima/ultima2/views/world_map_overview.h
@@ -0,0 +1,54 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef ULTIMA2_VIEWS_WORLD_MAP_OVERVIEW_H
+#define ULTIMA2_VIEWS_WORLD_MAP_OVERVIEW_H
+
+#include "ultima/shared/gfx/view.h"
+#include "ultima/ultima2/data/tiles.h"
+
+namespace Ultima {
+namespace Ultima2 {
+namespace Views {
+
+using namespace Shared::Messages;
+
+/**
+ * The "view" command's full-map overview, shown as a small icon per world
+ * cell. Closes and resumes the turn on any keypress.
+ */
+class WorldMapOverview : public Shared::Gfx::View {
+private:
+	void plotIcon(Shared::Gfx::GfxSurface &s, int cellX, int cellY, Data::TileId tile);
+
+public:
+	WorldMapOverview();
+	~WorldMapOverview() override {}
+
+	void draw() override;
+	bool msgKeypress(const KeypressMessage &msg) override;
+};
+
+} // namespace Views
+} // namespace Ultima2
+} // namespace Ultima
+
+#endif


Commit: df5578fc6996013a55f099f556ef36ab2daf0d6c
    https://github.com/scummvm/scummvm/commit/df5578fc6996013a55f099f556ef36ab2daf0d6c
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:40:54+11:00

Commit Message:
ULTIMA: ULTIMA2: Fix overworld map viewport not wrapping at world edges

Changed paths:
    engines/ultima/ultima2/views/overworld_map.cpp


diff --git a/engines/ultima/ultima2/views/overworld_map.cpp b/engines/ultima/ultima2/views/overworld_map.cpp
index 9e1194835ba..651b85384e2 100644
--- a/engines/ultima/ultima2/views/overworld_map.cpp
+++ b/engines/ultima/ultima2/views/overworld_map.cpp
@@ -67,9 +67,9 @@ void OverworldMap::draw() {
 
 	for (int oy = 0; oy < VIEWPORT_HEIGHT; ++oy) {
 		for (int ox = 0; ox < VIEWPORT_WIDTH; ++ox) {
-			int x = mapLeft + ox, y = mapTop + oy;
-			Data::TileId tileId = (x >= 0 && x < Data::MAP_WIDTH && y >= 0 && y < Data::MAP_HEIGHT) ?
-				_G(map).tileAt(x, y) : Data::TILE_WATER;
+			int x = (mapLeft + ox + Data::MAP_WIDTH) % Data::MAP_WIDTH;
+			int y = (mapTop + oy + Data::MAP_HEIGHT) % Data::MAP_HEIGHT;
+			Data::TileId tileId = _G(map).tileAt(x, y);
 
 			if (ox == PLAYER_VIEWPORT_X && oy == PLAYER_VIEWPORT_Y)
 				tileId = (Data::TileId)(Data::TILE_FIGHTER + sg._class);


Commit: 0b54c141b2197314f0fede019248204e4e63a463
    https://github.com/scummvm/scummvm/commit/0b54c141b2197314f0fede019248204e4e63a463
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:40:55+11:00

Commit Message:
ULTIMA: ULTIMA2: Add teleport console command

Changed paths:
    engines/ultima/ultima2/console.cpp
    engines/ultima/ultima2/console.h


diff --git a/engines/ultima/ultima2/console.cpp b/engines/ultima/ultima2/console.cpp
index 4b98ddcef24..1d6fd82a03c 100644
--- a/engines/ultima/ultima2/console.cpp
+++ b/engines/ultima/ultima2/console.cpp
@@ -29,6 +29,7 @@ namespace Ultima2 {
 Console::Console() : GUI::Debugger() {
 	registerCmd("map", WRAP_METHOD(Console, cmdMap));
 	registerCmd("tiles", WRAP_METHOD(Console, cmdTiles));
+	registerCmd("teleport", WRAP_METHOD(Console, cmdTeleport));
 }
 
 Console::~Console() {
@@ -113,5 +114,21 @@ bool Console::cmdTiles(int argc, const char **argv) {
 	return true;
 }
 
+bool Console::cmdTeleport(int argc, const char **argv) {
+	Data::Savegame &sg = _G(savegame);
+
+	if (argc == 3) {
+		sg._mapX = atoi(argv[1]);
+		sg._mapY = atoi(argv[2]);
+		g_engine->focusedView()->redraw();
+	} else if (argc != 1) {
+		debugPrintf("teleport [<x> <y>]\n");
+		return true;
+	}
+
+	debugPrintf("Position: (%d,%d)\n", sg._mapX, sg._mapY);
+	return true;
+}
+
 } // namespace Ultima2
 } // namespace Ultima
diff --git a/engines/ultima/ultima2/console.h b/engines/ultima/ultima2/console.h
index 854e902d669..32b0a38d6ff 100644
--- a/engines/ultima/ultima2/console.h
+++ b/engines/ultima/ultima2/console.h
@@ -31,6 +31,7 @@ class Console : public GUI::Debugger {
 private:
 	bool cmdMap(int argc, const char **argv);
 	bool cmdTiles(int argc, const char **argv);
+	bool cmdTeleport(int argc, const char **argv);
 public:
 	Console();
 	~Console() override;


Commit: e3d4ccb6da07b420cb2d9b9d9d6312e901512e6c
    https://github.com/scummvm/scummvm/commit/e3d4ccb6da07b420cb2d9b9d9d6312e901512e6c
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:40:55+11:00

Commit Message:
ULTIMA: ULTIMA2: Add combat, equipment, and monster AI

Changed paths:
  A engines/ultima/ultima2/data/data.cpp
  A engines/ultima/ultima2/views/interactions/direction.cpp
  A engines/ultima/ultima2/views/interactions/direction.h
  A engines/ultima/ultima2/views/interactions/interaction.cpp
  A engines/ultima/ultima2/views/interactions/interaction.h
  A engines/ultima/ultima2/views/interactions/ready_spell.cpp
  A engines/ultima/ultima2/views/interactions/ready_spell.h
  A engines/ultima/ultima2/views/interactions/ready_weapon.cpp
  A engines/ultima/ultima2/views/interactions/ready_weapon.h
  A engines/ultima/ultima2/views/interactions/wear_armor.cpp
  A engines/ultima/ultima2/views/interactions/wear_armor.h
  A engines/ultima/ultima2/views/interactions/yell.cpp
  A engines/ultima/ultima2/views/interactions/yell.h
  A engines/ultima/ultima2/views/zstats.cpp
  A engines/ultima/ultima2/views/zstats.h
    engines/ultima/metaengine.cpp
    engines/ultima/module.mk
    engines/ultima/ultima2/data/data.h
    engines/ultima/ultima2/data/savegame.cpp
    engines/ultima/ultima2/data/savegame.h
    engines/ultima/ultima2/data/tiles.cpp
    engines/ultima/ultima2/data/tiles.h
    engines/ultima/ultima2/logic/logic.cpp
    engines/ultima/ultima2/logic/logic.h
    engines/ultima/ultima2/logic/overworld_logic.cpp
    engines/ultima/ultima2/logic/overworld_logic.h
    engines/ultima/ultima2/ultima2.cpp
    engines/ultima/ultima2/ultima2.h
    engines/ultima/ultima2/views/overworld_map.cpp
    engines/ultima/ultima2/views/overworld_map.h
    engines/ultima/ultima2/views/views.h


diff --git a/engines/ultima/metaengine.cpp b/engines/ultima/metaengine.cpp
index e0be7aeea23..523eb5ec9bc 100644
--- a/engines/ultima/metaengine.cpp
+++ b/engines/ultima/metaengine.cpp
@@ -33,10 +33,13 @@
 #endif
 #ifdef ENABLE_ULTIMA1
 #include "ultima/ultima1/ultima1.h"
+#include "ultima/ultima1/metaengine.h"
+#undef _G
 #endif
 #ifdef ENABLE_ULTIMA2
 #include "ultima/ultima2/ultima2.h"
 #include "ultima/ultima2/metaengine.h"
+#undef _G
 #endif
 #ifdef ENABLE_ULTIMA4
 #include "ultima/ultima4/ultima4.h"
@@ -272,6 +275,10 @@ Common::KeymapArray UltimaMetaEngine::initKeymaps(const char *target) const {
 	if (gameId == "akalabeth")
 		return Ultima::Ultima0::MetaEngine::initKeymaps();
 #endif
+#ifdef ENABLE_ULTIMA1
+	if (gameId == "ultima1")
+		return Ultima::Ultima1::MetaEngine::initKeymaps();
+#endif
 #ifdef ENABLE_ULTIMA2
 	if (gameId == "ultima2")
 		return Ultima::Ultima2::MetaEngine::initKeymaps();
diff --git a/engines/ultima/module.mk b/engines/ultima/module.mk
index 506b5fa4fef..ef8fedf7c12 100644
--- a/engines/ultima/module.mk
+++ b/engines/ultima/module.mk
@@ -111,6 +111,7 @@ MODULE_OBJS += \
 	ultima2/ultima2.o \
 	ultima2/console.o \
 	ultima2/metaengine.o \
+	ultima2/data/data.o \
 	ultima2/data/map.o \
 	ultima2/data/map_dungeon.o \
 	ultima2/data/map_monsters.o \
@@ -128,7 +129,14 @@ MODULE_OBJS += \
 	ultima2/views/startup.o \
 	ultima2/views/stats.o \
 	ultima2/views/title.o \
-	ultima2/views/world_map_overview.o
+	ultima2/views/world_map_overview.o \
+	ultima2/views/zstats.o \
+	ultima2/views/interactions/interaction.o \
+	ultima2/views/interactions/direction.o \
+	ultima2/views/interactions/ready_spell.o \
+	ultima2/views/interactions/ready_weapon.o \
+	ultima2/views/interactions/wear_armor.o \
+	ultima2/views/interactions/yell.o
 endif
 
 ifdef ENABLE_ULTIMA4
diff --git a/engines/ultima/ultima2/data/data.cpp b/engines/ultima/ultima2/data/data.cpp
new file mode 100644
index 00000000000..e5da4d5ec67
--- /dev/null
+++ b/engines/ultima/ultima2/data/data.cpp
@@ -0,0 +1,50 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "ultima/ultima2/data/data.h"
+
+namespace Ultima {
+namespace Ultima2 {
+namespace Data {
+
+const char *const WEAPON_NAMES[WEAPON_COUNT] = {
+	"HANDS", "DAGGER", "MACE", "AXE", "BOW", "SWORD",
+	"GREAT SWORD", "LIGHT SWORD", "PHASER", "QUICK SWORD"
+};
+
+const char *const ARMOR_NAMES[ARMOR_COUNT] = {
+	"SKIN", "CLOTH", "LEATHER", "CHAIN", "PLATE", "REFLECT", "POWER"
+};
+
+const char *const SPELL_NAMES[SPELL_COUNT] = {
+	"NONE", "LIGHT", "DOWN LADDER", "UP LADDER", "PASSWALL",
+	"SURFACE", "PRAYER", "MAGIC MISSILE", "BLINK", "KILL"
+};
+
+const char *const ITEM_NAMES[ITEM_COUNT] = {
+	"RING", "WAND", "STAFF", "BOOTS", "CLOAK", "HELM", "GEM", "ANKH",
+	"RED GEM", "SKULL KEY", "GREEN GEM", "BRASS BUTTON", "BLUE TASSLE",
+	"STRANGE COIN", "GREEN IDOL", "TRI LITHIUM"
+};
+
+} // namespace Data
+} // namespace Ultima2
+} // namespace Ultima
diff --git a/engines/ultima/ultima2/data/data.h b/engines/ultima/ultima2/data/data.h
index 694d5e2ffad..834260ba0b1 100644
--- a/engines/ultima/ultima2/data/data.h
+++ b/engines/ultima/ultima2/data/data.h
@@ -48,12 +48,14 @@ enum WeaponType {
 	WEAPON_SWORD = 5, WEAPON_GREAT_SWORD = 6, WEAPON_LIGHT_SWORD = 7, WEAPON_PHASER = 8,
 	WEAPON_QUICK_SWORD = 9, WEAPON_COUNT = 10
 };
+extern const char *const WEAPON_NAMES[WEAPON_COUNT];
 
 // Indexes into Savegame::_armorOwned
 enum ArmorType {
 	ARMOR_SKIN = 0, ARMOR_CLOTH = 1, ARMOR_LEATHER = 2, ARMOR_CHAIN = 3, ARMOR_PLATE = 4,
 	ARMOR_REFLECT = 5, ARMOR_POWER = 6, ARMOR_COUNT = 7
 };
+extern const char *const ARMOR_NAMES[ARMOR_COUNT];
 
 // Indexes into Savegame::_spellCharges
 enum SpellType {
@@ -61,6 +63,7 @@ enum SpellType {
 	SPELL_SURFACE = 5, SPELL_PRAYER = 6, SPELL_MAGIC_MISSILE = 7, SPELL_BLINK = 8, SPELL_KILL = 9,
 	SPELL_COUNT = 10
 };
+extern const char *const SPELL_NAMES[SPELL_COUNT];
 
 // Indexes into Savegame::_items
 enum ItemType {
@@ -69,6 +72,7 @@ enum ItemType {
 	ITEM_BRASS_BUTTON = 11, ITEM_BLUE_TASSLE = 12, ITEM_STRANGE_COIN = 13, ITEM_GREEN_IDOL = 14,
 	ITEM_TRI_LITHIUM = 15, ITEM_COUNT = 16
 };
+extern const char *const ITEM_NAMES[ITEM_COUNT];
 
 } // namespace Data
 } // namespace Ultima2
diff --git a/engines/ultima/ultima2/data/savegame.cpp b/engines/ultima/ultima2/data/savegame.cpp
index 632b27c8ca5..e91f504a82f 100644
--- a/engines/ultima/ultima2/data/savegame.cpp
+++ b/engines/ultima/ultima2/data/savegame.cpp
@@ -85,6 +85,7 @@ void Savegame::synchronize(Common::Serializer &s) {
 	s.syncAsSint16LE(_sleepTurns);
 	s.syncAsSint16LE(_negateTimeTurns);
 	s.syncAsSint16LE(_lightTurns);
+	s.syncAsByte(_monsterSpawnCounter);
 }
 
 } // namespace Data
diff --git a/engines/ultima/ultima2/data/savegame.h b/engines/ultima/ultima2/data/savegame.h
index 39be045d9a2..e91d85f6e1c 100644
--- a/engines/ultima/ultima2/data/savegame.h
+++ b/engines/ultima/ultima2/data/savegame.h
@@ -102,6 +102,10 @@ struct Savegame {
 	// dungeon renderer
 	int16 _lightTurns = 0;
 
+	// Incremented on every overworld monster spawn attempt; its lowest set
+	// bit selects the monster type rotation in OverworldLogic::trySpawnMonster
+	byte _monsterSpawnCounter = 0;
+
 	/**
 	 * Synchronize savegame data
 	 */
@@ -109,14 +113,17 @@ struct Savegame {
 
 	/**
 	 * Deducts an amount from HP. Returns false if this was fatal.
+	 * A survived hit costs one extra point beyond the amount given,
+	 * matching the original's borrow-based HP subtraction.
 	 */
 	bool deductHP(int amount) {
-		_hp -= amount;
-		if (_hp > 0)
-			return true;
+		if (_hp <= amount) {
+			_hp = 0;
+			return false;
+		}
 
-		_hp = 0;
-		return false;
+		_hp -= amount + 1;
+		return true;
 	}
 
 	/**
diff --git a/engines/ultima/ultima2/data/tiles.cpp b/engines/ultima/ultima2/data/tiles.cpp
index 892045ccd17..0047c3a1f6c 100644
--- a/engines/ultima/ultima2/data/tiles.cpp
+++ b/engines/ultima/ultima2/data/tiles.cpp
@@ -29,10 +29,29 @@ namespace Data {
 // Byte offset of the first tile's data within ULTIMAII.EXE
 constexpr int32 TILE_DATA_OFFSET = 0x7C40;
 
+// Byte offset of the attack-flash sprite's data within ULTIMAII.EXE
+constexpr int32 ATTACK_SPRITE_OFFSET = 0x5488;
+
 // 2-byte header (row width in bytes, row count -- always 4 and 16) plus
 // 64 bytes of packed pixel data
 constexpr int TILE_RECORD_SIZE = 66;
 
+template<typename SurfaceT>
+static void decodeTileRecord(const byte record[TILE_RECORD_SIZE], SurfaceT &surf) {
+	surf.create(TILE_WIDTH, TILE_HEIGHT, Graphics::PixelFormat::createFormatCLUT8());
+	byte *dst = (byte *)surf.getPixels();
+
+	for (int row = 0; row < TILE_HEIGHT; ++row) {
+		for (int b = 0; b < TILE_WIDTH / 4; ++b) {
+			byte v = record[2 + row * 4 + b];
+			dst[row * TILE_WIDTH + b * 4 + 0] = (v >> 6) & 3;
+			dst[row * TILE_WIDTH + b * 4 + 1] = (v >> 4) & 3;
+			dst[row * TILE_WIDTH + b * 4 + 2] = (v >> 2) & 3;
+			dst[row * TILE_WIDTH + b * 4 + 3] = v & 3;
+		}
+	}
+}
+
 void loadTiles(Graphics::Surface tiles[TILE_COUNT]) {
 	Common::File f;
 	if (!f.open("ULTIMAII.EXE"))
@@ -45,21 +64,24 @@ void loadTiles(Graphics::Surface tiles[TILE_COUNT]) {
 		if (f.read(record, TILE_RECORD_SIZE) != (uint32)TILE_RECORD_SIZE)
 			error("Could not read tile %d", t);
 
-		tiles[t].create(TILE_WIDTH, TILE_HEIGHT, Graphics::PixelFormat::createFormatCLUT8());
-		byte *dst = (byte *)tiles[t].getPixels();
-
-		for (int row = 0; row < TILE_HEIGHT; ++row) {
-			for (int b = 0; b < TILE_WIDTH / 4; ++b) {
-				byte v = record[2 + row * 4 + b];
-				dst[row * TILE_WIDTH + b * 4 + 0] = (v >> 6) & 3;
-				dst[row * TILE_WIDTH + b * 4 + 1] = (v >> 4) & 3;
-				dst[row * TILE_WIDTH + b * 4 + 2] = (v >> 2) & 3;
-				dst[row * TILE_WIDTH + b * 4 + 3] = v & 3;
-			}
-		}
+		decodeTileRecord(record, tiles[t]);
 	}
 }
 
+void loadAttackSprite(Graphics::ManagedSurface &sprite) {
+	Common::File f;
+	if (!f.open("ULTIMAII.EXE"))
+		error("Could not open ULTIMAII.EXE");
+
+	f.seek(ATTACK_SPRITE_OFFSET);
+
+	byte record[TILE_RECORD_SIZE];
+	if (f.read(record, TILE_RECORD_SIZE) != (uint32)TILE_RECORD_SIZE)
+		error("Could not read attack sprite");
+
+	decodeTileRecord(record, sprite);
+}
+
 } // namespace Data
 } // namespace Ultima2
 } // namespace Ultima
diff --git a/engines/ultima/ultima2/data/tiles.h b/engines/ultima/ultima2/data/tiles.h
index 1e5c7652341..3d23b020228 100644
--- a/engines/ultima/ultima2/data/tiles.h
+++ b/engines/ultima/ultima2/data/tiles.h
@@ -23,6 +23,7 @@
 #define ULTIMA2_DATA_TILES_H
 
 #include "graphics/surface.h"
+#include "graphics/managed_surface.h"
 
 namespace Ultima {
 namespace Ultima2 {
@@ -56,6 +57,15 @@ constexpr int TILE_HEIGHT = 16;
  */
 void loadTiles(Graphics::Surface tiles[TILE_COUNT]);
 
+/**
+ * Decodes the "sprite circle" graphic used to flash a hit indicator over
+ * the player's position during combat (xorSpriteDrawCenter in the
+ * original), in the same 16x16 CLUT8/CGA format as the map tiles. A
+ * ManagedSurface, unlike the plain map tiles, since it needs to be XOR-
+ * blitted (see GfxSurface::xorBlitFrom)
+ */
+void loadAttackSprite(Graphics::ManagedSurface &sprite);
+
 } // namespace Data
 } // namespace Ultima2
 } // namespace Ultima
diff --git a/engines/ultima/ultima2/logic/logic.cpp b/engines/ultima/ultima2/logic/logic.cpp
index 33d5dab0fc6..28380d02437 100644
--- a/engines/ultima/ultima2/logic/logic.cpp
+++ b/engines/ultima/ultima2/logic/logic.cpp
@@ -68,6 +68,10 @@ void Logic::playerDied() {
 	g_engine->replaceView(g_engine->findView("Title"), true);
 }
 
+void Logic::alertTownGuards() {
+	// Only meaningful once towns/castles exist
+}
+
 int Logic::getRandomNumber(int minNumber, int maxNumber) {
 	return g_engine->getRandomNumber(minNumber, maxNumber);
 }
@@ -76,6 +80,18 @@ int Logic::getRandomNumber(int maxNumber) {
 	return g_engine->getRandomNumber(maxNumber);
 }
 
+byte Logic::randByte() {
+	return g_engine->randByte();
+}
+
+void Logic::showAttackTile(int x, int y) {
+	g_engine->focusedView()->send(AttackTileMessage(x, y, 0));
+}
+
+void Logic::playFX(int num) {
+	g_engine->playFX(num);
+}
+
 void Logic::endOfTurn() {
 	updateCreatures();
 
@@ -205,24 +221,12 @@ void Logic::action(int action) {
 }
 
 void Logic::keypress(const Shared::Messages::KeypressMessage &msg) {
-	if (_yelling) {
-		if (msg.ascii == 13) {
-			writeString("\n");
-			_yelling = false;
-			MetaEngine::setKeybindingMode(KBMODE_GAMEPLAY);
-			resumeTurn();
-		} else if (msg.ascii >= 32 && msg.ascii < 127) {
-			writeString("%c", (char)msg.ascii);
-		}
-		return;
-	}
-
 	writeString("Huh?\n");
 	endOfTurn();
 	prompt();
 }
 
-bool Logic::attack() {
+bool Logic::attack(Data::Direction dir) {
 	writeString("Attack?\n");
 	return true;
 }
@@ -295,8 +299,8 @@ bool Logic::launch() {
 }
 
 bool Logic::magic() {
-	writeString("Magic?\n");
-	return true;
+	g_engine->addView("ReadySpell");
+	return false;
 }
 
 bool Logic::negateTime() {
@@ -320,8 +324,8 @@ bool Logic::quit() {
 }
 
 bool Logic::ready() {
-	writeString("Ready?\n");
-	return true;
+	g_engine->addView("ReadyWeapon");
+	return false;
 }
 
 bool Logic::steal() {
@@ -354,8 +358,8 @@ bool Logic::view() {
 }
 
 bool Logic::wearArmor() {
-	writeString("Wear Armor?\n");
-	return true;
+	g_engine->addView("WearArmor");
+	return false;
 }
 
 bool Logic::xit() {
@@ -364,15 +368,13 @@ bool Logic::xit() {
 }
 
 bool Logic::yell() {
-	writeString("YELL WHAT?\n");
-	_yelling = true;
-	MetaEngine::setKeybindingMode(KBMODE_MINIMAL);
+	g_engine->addView("Yell");
 	return false;
 }
 
 bool Logic::zstats() {
-	writeString("Zstats\n");
-	return true;
+	g_engine->addView("ZStats");
+	return false;
 }
 
 } // namespace Logic
diff --git a/engines/ultima/ultima2/logic/logic.h b/engines/ultima/ultima2/logic/logic.h
index 582638f5d68..14016672189 100644
--- a/engines/ultima/ultima2/logic/logic.h
+++ b/engines/ultima/ultima2/logic/logic.h
@@ -37,10 +37,6 @@ namespace Logic {
  */
 class Logic {
 protected:
-	// Set while a yell()'d message is being typed in, echoing raw keypresses
-	// back out until Enter is pressed
-	bool _yelling = false;
-
 	/**
 	 * Dispatches some text to be shown in the Commands window
 	 */
@@ -58,6 +54,13 @@ protected:
 	 */
 	void playerDied();
 
+	/**
+	 * Alerts nearby town guards after an attack or theft. A no-op outside
+	 * of towns/castles/villages (_mapNum2 == 0), which is the only mode
+	 * implemented so far
+	 */
+	void alertTownGuards();
+
 	/**
 	 * Signal the map to redraw
 	 */
@@ -74,6 +77,24 @@ protected:
 	int getRandomNumber(int minNumber, int maxNumber);
 	int getRandomNumber(int maxNumber);
 
+	/**
+	 * Returns the next byte from the game's random number generator
+	 */
+	byte randByte();
+
+	/**
+	 * Has the currently focused map view briefly flash the attack sprite
+	 * over a map position - a hit indicator, pausing before returning.
+	 * See AttackTileMessage
+	 */
+	void showAttackTile(int x, int y);
+
+	/**
+	 * Plays a sound effect. Currently a no-op stub, mirroring ultima1's
+	 * own unimplemented playFX
+	 */
+	void playFX(int num);
+
 	/**
 	 * Handles end of turn logic
 	 */
@@ -93,7 +114,6 @@ protected:
 	virtual bool move(Data::Direction dir) {
 		return false;
 	}
-	virtual bool attack();
 	virtual bool board();
 	virtual bool cast();
 	virtual bool descend();
@@ -130,6 +150,13 @@ public:
 	virtual void entering() {
 	}
 
+	/**
+	 * Attacks in the given direction, or - if unspecified - starts the
+	 * Direction interaction to prompt for one. Public since the Direction
+	 * interaction calls back into it directly once a direction is chosen
+	 */
+	virtual bool attack(Data::Direction dir = Data::DIR_UNSPECIFIED);
+
 	/**
 	 * Called once per game frame for any logic updates
 	 */
diff --git a/engines/ultima/ultima2/logic/overworld_logic.cpp b/engines/ultima/ultima2/logic/overworld_logic.cpp
index 64941431dad..91f3a4de517 100644
--- a/engines/ultima/ultima2/logic/overworld_logic.cpp
+++ b/engines/ultima/ultima2/logic/overworld_logic.cpp
@@ -26,6 +26,29 @@ namespace Ultima {
 namespace Ultima2 {
 namespace Logic {
 
+namespace {
+
+struct SpawnEntry {
+	Data::TileId tile;
+	byte hp;
+	Data::TileId requiredTerrain;
+};
+
+// Indexed by the lowest set bit (0-7) of Savegame::_monsterSpawnCounter;
+// an all-zero counter spawns a Balron instead (see trySpawnMonster)
+const SpawnEntry SPAWN_TABLE[8] = {
+	{ Data::TILE_ORC,         0x10, Data::TILE_GRASS },
+	{ Data::TILE_THIEF,       0x20, Data::TILE_GRASS },
+	{ Data::TILE_DAEMON,      0x40, Data::TILE_GRASS },
+	{ Data::TILE_SEA_MONSTER, 0x40, Data::TILE_WATER },
+	{ Data::TILE_FIGHTER,     0x80, Data::TILE_GRASS },
+	{ Data::TILE_SHIP,        0xA0, Data::TILE_WATER },
+	{ Data::TILE_DEVIL,       0xC0, Data::TILE_GRASS },
+	{ Data::TILE_MAGE,        0xE0, Data::TILE_GRASS }
+};
+
+} // namespace
+
 bool OverworldLogic::isWalkable(Data::TileId tile) const {
 	switch (tile) {
 	case Data::TILE_WATER:
@@ -102,7 +125,7 @@ bool OverworldLogic::move(Data::Direction dir) {
 		return false;
 	}
 
-	if (!isWalkable(destTile)) {
+	if (!isWalkable(destTile) || findTargetMonster(newX, newY) >= 0) {
 		writeString("--INVALID MOVE!\n");
 		return true;
 	}
@@ -113,6 +136,286 @@ bool OverworldLogic::move(Data::Direction dir) {
 	return true;
 }
 
+int OverworldLogic::signByte(int v) const {
+	int8 b = (int8)(byte)(v & 0xFF);
+	return (b > 0) - (b < 0);
+}
+
+int OverworldLogic::findTargetMonster(int x, int y) const {
+	Data::MapMonsters &monsters = _G(map)._monsters;
+	for (int slot = 31; slot >= 1; --slot) {
+		if (monsters.isActive(slot) && monsters._mapX[slot] == x && monsters._mapY[slot] == y)
+			return slot;
+	}
+
+	return -1;
+}
+
+bool OverworldLogic::monsterCanEnter(Data::TileId monsterTile, Data::TileId destTile, int x, int y) const {
+	if (monsterTile == Data::TILE_SEA_MONSTER || monsterTile == Data::TILE_SHIP)
+		return destTile == Data::TILE_WATER;
+
+	return isWalkable(destTile) && findTargetMonster(x, y) < 0;
+}
+
+bool OverworldLogic::tryMoveMonster(int slot, int dx, int dy) {
+	if (dx == 0 && dy == 0)
+		return false;
+
+	Data::MapMonsters &monsters = _G(map)._monsters;
+	int newX = (monsters._mapX[slot] + dx + Data::MAP_WIDTH) % Data::MAP_WIDTH;
+	int newY = (monsters._mapY[slot] + dy + Data::MAP_HEIGHT) % Data::MAP_HEIGHT;
+
+	Data::TileId destTile = _G(map).tileAt(newX, newY);
+	if (!monsterCanEnter(monsters.tileType(slot), destTile, newX, newY))
+		return false;
+
+	monsters._mapX[slot] = newX;
+	monsters._mapY[slot] = newY;
+	return true;
+}
+
+void OverworldLogic::updateCreatures() {
+	Data::Savegame &sg = _G(savegame);
+	Data::MapMonsters &monsters = _G(map)._monsters;
+	byte damageAccumulator = 0;
+	int engagedCount = 0, hitCount = 0;
+
+	for (int slot = 31; slot >= 1; --slot) {
+		if (!monsters.isActive(slot))
+			continue;
+
+		int dx = sg._mapX - monsters._mapX[slot];
+		int dy = sg._mapY - monsters._mapY[slot];
+		int sdx = signByte(dx * 4);
+		int sdy = signByte(dy * 4);
+
+		// Below 15 HP, a monster flees the player instead of approaching
+		if (monsters._spellHP[slot] < 15) {
+			sdx = -sdx;
+			sdy = -sdy;
+		}
+
+		int newX = (monsters._mapX[slot] + sdx + Data::MAP_WIDTH) % Data::MAP_WIDTH;
+		int newY = (monsters._mapY[slot] + sdy + Data::MAP_HEIGHT) % Data::MAP_HEIGHT;
+
+		if (newX == sg._mapX && newY == sg._mapY) {
+			++engagedCount;
+
+			if (monsters.tileType(slot) == Data::TILE_THIEF && randByte() < 0x40) {
+				int itemIdx = randByte() & 0xF;
+				if (sg._items[itemIdx] > 0) {
+					--sg._items[itemIdx];
+					writeString("A THIEF STOLE SOMETHING!\n");
+				}
+			}
+
+			int roll = randByte();
+			if (roll < 0x80 && (roll & 7) >= sg._readiedArmor) {
+				++hitCount;
+				int contribution = (monsters._spellHP[slot] >> 2) + 1 + damageAccumulator;
+				if (_G(map).tileAt(sg._mapX, sg._mapY) == Data::TILE_TOWN)
+					contribution *= 2;
+				damageAccumulator = (byte)contribution;
+			}
+		} else {
+			if (monsters._spellHP[slot] < 16)
+				++monsters._spellHP[slot];
+
+			// Try diagonal, then vertical-only, then horizontal-only
+			if (!tryMoveMonster(slot, sdx, sdy) && !tryMoveMonster(slot, 0, sdy))
+				tryMoveMonster(slot, sdx, 0);
+		}
+	}
+
+	// A cannon-ish sound plays for every monster occupying the player's
+	// tile this turn; the hit flash only for those that actually connected
+	for (int i = 0; i < engagedCount; ++i) {
+		playFX(1);
+		if (i < hitCount)
+			showAttackTile(sg._mapX, sg._mapY);
+	}
+
+	if (damageAccumulator != 0) {
+		int dmg = (randByte() & damageAccumulator & 0x77) + 1;
+		if (!sg.deductHP(dmg)) {
+			playerDied();
+			return;
+		}
+	}
+
+	trySpawnMonster();
+}
+
+void OverworldLogic::trySpawnMonster() {
+	Data::MapMonsters &monsters = _G(map)._monsters;
+
+	int slot = -1;
+	for (int i = 31; i >= 1; --i) {
+		if (!monsters.isActive(i)) {
+			slot = i;
+			break;
+		}
+	}
+	if (slot < 0)
+		return;
+
+	int r = randByte();
+	if (r >= 0x3F)
+		return;
+	int x = r;
+
+	int r2 = randByte();
+	if (r2 & 0x80)
+		return;
+	int y = r2 & 0x3F;
+
+	Data::Savegame &sg = _G(savegame);
+	Data::TileId terrain = _G(map).tileAt(x, y);
+
+	++sg._monsterSpawnCounter;
+	int bit = -1;
+	for (int i = 0; i < 8; ++i) {
+		if (sg._monsterSpawnCounter & (1 << i)) {
+			bit = i;
+			break;
+		}
+	}
+
+	Data::TileId newTile = Data::TILE_BALRON;
+	byte newHp = 0xFF;
+	Data::TileId requiredTerrain = Data::TILE_GRASS;
+	if (bit >= 0) {
+		newTile = SPAWN_TABLE[bit].tile;
+		newHp = SPAWN_TABLE[bit].hp;
+		requiredTerrain = SPAWN_TABLE[bit].requiredTerrain;
+	}
+
+	if (terrain != requiredTerrain) {
+		// A failed attempt doesn't advance the type rotation
+		--sg._monsterSpawnCounter;
+		return;
+	}
+
+	monsters._mapX[slot] = x;
+	monsters._mapY[slot] = y;
+	monsters._spellHP[slot] = newHp;
+	monsters._type[slot] = newTile * 4;
+	monsters._glyphTile[slot] = 0;
+	monsters._offerFlag[slot] = 0;
+	monsters._tempX[slot] = 0;
+	monsters._tempY[slot] = 0;
+}
+
+bool OverworldLogic::attack(Data::Direction dir) {
+	Data::Savegame &sg = _G(savegame);
+
+	if (dir == Data::DIR_UNSPECIFIED) {
+		writeString("ATTACK--");
+
+		if (sg._armParalysisTurns > 0) {
+			writeString("PARALIZED!\n");
+			return true;
+		}
+
+		g_engine->addView("Direction");
+		return false;
+	}
+
+	int dx = 0, dy = 0;
+	switch (dir) {
+	case Data::DIR_UP: dy = -1; break;
+	case Data::DIR_DOWN: dy = 1; break;
+	case Data::DIR_LEFT: dx = -1; break;
+	case Data::DIR_RIGHT: dx = 1; break;
+	default: break;
+	}
+
+	int tx = (sg._mapX + dx + Data::MAP_WIDTH) % Data::MAP_WIDTH;
+	int ty = (sg._mapY + dy + Data::MAP_HEIGHT) % Data::MAP_HEIGHT;
+	int slot = findTargetMonster(tx, ty);
+
+	if (slot < 0 || (randByte() >> 1) >= sg._agility) {
+		writeString("--MISS\n");
+		resumeTurn();
+		return false;
+	}
+
+	writeString("--HIT!!!\n");
+	alertTownGuards();
+
+	int dmg = (sg._readiedWeapon * 8 + sg._strength) >> 2;
+	Data::MapMonsters &monsters = _G(map)._monsters;
+	byte &hp = monsters._spellHP[slot];
+
+	if (hp <= dmg) {
+		hp = 0;
+		killMonster(slot);
+	} else {
+		hp -= dmg + 1;
+	}
+
+	resumeTurn();
+	return false;
+}
+
+bool OverworldLogic::fire() {
+	// FIRE is the ship's cannon, gated on currently riding a Ship -
+	// there's no vehicle/boarding state yet (added in a later stage), so
+	// this is always the "not on a ship" failure case for now
+	writeString("FIRE WHAT?\n");
+	return true;
+}
+
+void OverworldLogic::killMonster(int slot) {
+	Data::Savegame &sg = _G(savegame);
+	Data::MapMonsters &monsters = _G(map)._monsters;
+	Data::TileId monsterTile = monsters.tileType(slot);
+	monsters._type[slot] = 0;
+
+	if (monsterTile == Data::TILE_MINAX) {
+		writeString("MINAX IS DEAD!!\n");
+		return;
+	}
+
+	switch (monsterTile) {
+	case Data::TILE_GUARD:
+		sg._keys += 2;
+		break;
+
+	case Data::TILE_THIEF: {
+		if (randByte() < 0x40)
+			++sg._thievesTools;
+		int itemIdx = randByte() & 0xF;
+		if (itemIdx != 0)
+			++sg._items[itemIdx];
+		break;
+	}
+
+	case Data::TILE_FIGHTER:
+		if (randByte() < 0x40)
+			++sg._items[Data::ITEM_HELM];
+		sg._torches += (randByte() & 3) + 1;
+		break;
+
+	case Data::TILE_MAGE:
+		if ((randByte() & 1) == 0)
+			++sg._items[Data::ITEM_WAND];
+		else
+			++sg._items[Data::ITEM_STAFF];
+		break;
+
+	default:
+		break;
+	}
+
+	int goldAmt = (randByte() & 0x17) | 1;
+	int expAmt = (randByte() & 3) + 1;
+	sg._gold += goldAmt;
+	sg._experience += expAmt;
+	writeString("KILLED--GOLD+%d--EXP.+%d\n", goldAmt, expAmt);
+}
+
 } // namespace Logic
 } // namespace Ultima2
 } // namespace Ultima
diff --git a/engines/ultima/ultima2/logic/overworld_logic.h b/engines/ultima/ultima2/logic/overworld_logic.h
index bb8e4c8945f..e3e641aeb10 100644
--- a/engines/ultima/ultima2/logic/overworld_logic.h
+++ b/engines/ultima/ultima2/logic/overworld_logic.h
@@ -39,10 +39,49 @@ private:
 	 */
 	bool isWalkable(Data::TileId tile) const;
 
+	/**
+	 * Returns -1/0/+1 matching the sign of the low byte of v, replicating
+	 * the original's byte-truncating "shortest step on a wrapping map" trick
+	 */
+	int signByte(int v) const;
+
+	/**
+	 * Returns the slot of the active monster at (x,y), or -1 if none
+	 */
+	int findTargetMonster(int x, int y) const;
+
+	/**
+	 * Returns true if a monster of the given type can move onto destTile
+	 * at (x,y) - not occupied by another monster, and matching its
+	 * water/land travel requirement
+	 */
+	bool monsterCanEnter(Data::TileId monsterTile, Data::TileId destTile, int x, int y) const;
+
+	/**
+	 * Attempts to move a monster by the given delta; returns false if blocked
+	 */
+	bool tryMoveMonster(int slot, int dx, int dy);
+
+	/**
+	 * Kills a monster - runs its type's kill-drop table, clears its slot,
+	 * and grants the standard gold/experience reward
+	 */
+	void killMonster(int slot);
+
+	/**
+	 * Rolls for and, on success, spawns a new monster in a free slot
+	 */
+	void trySpawnMonster();
+
+protected:
+	void updateCreatures() override;
+
 public:
 	~OverworldLogic() override {}
 
 	bool move(Data::Direction dir) override;
+	bool attack(Data::Direction dir) override;
+	bool fire() override;
 };
 
 } // namespace Logic
diff --git a/engines/ultima/ultima2/ultima2.cpp b/engines/ultima/ultima2/ultima2.cpp
index 6c00b297870..1c59c369bfe 100644
--- a/engines/ultima/ultima2/ultima2.cpp
+++ b/engines/ultima/ultima2/ultima2.cpp
@@ -58,6 +58,12 @@ Common::Error Ultima2Engine::run() {
 	// Set the engine's debugger console
 	setDebugger(new Console());
 
+	byte seed = (byte)getRandomNumber(255);
+	for (int i = 0; i < 6; ++i)
+		_rngState[i] = seed;
+	_rngState[0]++;
+	_rngState[1]++;
+
 	Views::Views views;
 	addView("Startup");
 	runGame(views);
@@ -65,6 +71,17 @@ Common::Error Ultima2Engine::run() {
 	return Common::kNoError;
 }
 
+byte Ultima2Engine::randByte() {
+	byte newVal = (byte)(_rngState[1] + _rngState[4] + _rngState[5] + 1);
+	_rngState[5] = _rngState[4];
+	_rngState[4] = _rngState[3];
+	_rngState[3] = _rngState[2];
+	_rngState[2] = _rngState[1];
+	_rngState[1] = _rngState[0];
+	_rngState[0] = newVal;
+	return newVal;
+}
+
 bool Ultima2Engine::canSaveGameStateCurrently(Common::U32String *msg) {
 	// Only allow saving when any of the different map views are active
 	return dynamic_cast<Views::Map *>(focusedView()) != nullptr;
@@ -89,5 +106,9 @@ bool Ultima2Engine::savegamesExist() const {
 	return result;
 }
 
+void Ultima2Engine::playFX(int num) {
+	warning("TODO: playFX(%d)", num);
+}
+
 } // namespace Ultima2
 } // namespace Ultima
diff --git a/engines/ultima/ultima2/ultima2.h b/engines/ultima/ultima2/ultima2.h
index 62c6e5de079..aea5fc81987 100644
--- a/engines/ultima/ultima2/ultima2.h
+++ b/engines/ultima/ultima2/ultima2.h
@@ -56,6 +56,11 @@ protected:
 		return Engine::shouldQuit();
 	}
 
+private:
+	// 6-byte lagged-Fibonacci-style state for randByte(), matching the
+	// original's rand_byte generator
+	byte _rngState[6] = {};
+
 public:
 	Data::Savegame _savegame;
 	Data::Map _map;
@@ -104,6 +109,18 @@ public:
 	 * Returns true if any savegames exist
 	 */
 	bool savegamesExist() const;
+
+	/**
+	 * Returns the next byte from the game's random number generator
+	 */
+	byte randByte();
+
+	/**
+	 * Plays a sound effect. Currently a no-op stub, mirroring ultima1's
+	 * own unimplemented playFX - Ultima II has no numbered sound-effect
+	 * table; each original sound is its own hardcoded PC-speaker tone-sweep
+	 */
+	void playFX(int num);
 };
 
 extern Ultima2Engine *g_engine;
diff --git a/engines/ultima/ultima2/views/interactions/direction.cpp b/engines/ultima/ultima2/views/interactions/direction.cpp
new file mode 100644
index 00000000000..23c3cbda74b
--- /dev/null
+++ b/engines/ultima/ultima2/views/interactions/direction.cpp
@@ -0,0 +1,58 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "ultima/ultima2/views/interactions/direction.h"
+#include "ultima/ultima2/ultima2.h"
+#include "ultima/ultima2/metaengine.h"
+
+namespace Ultima {
+namespace Ultima2 {
+namespace Views {
+namespace Interactions {
+
+Direction::Direction() : Interaction("Direction") {
+}
+
+bool Direction::msgFocus(const FocusMessage &msg) {
+	MetaEngine::setKeybindingMode(KBMODE_MINIMAL);
+	return Interaction::msgFocus(msg);
+}
+
+bool Direction::msgKeypress(const KeypressMessage &msg) {
+	Data::Direction dir;
+	switch (msg.keycode) {
+	case Common::KEYCODE_UP: dir = Data::DIR_UP; break;
+	case Common::KEYCODE_DOWN: dir = Data::DIR_DOWN; break;
+	case Common::KEYCODE_LEFT: dir = Data::DIR_LEFT; break;
+	case Common::KEYCODE_RIGHT: dir = Data::DIR_RIGHT; break;
+	default:
+		return true;
+	}
+
+	close();
+	_G(logic)->attack(dir);
+	return true;
+}
+
+} // namespace Interactions
+} // namespace Views
+} // namespace Ultima2
+} // namespace Ultima
diff --git a/engines/ultima/ultima2/views/interactions/direction.h b/engines/ultima/ultima2/views/interactions/direction.h
new file mode 100644
index 00000000000..7b475850061
--- /dev/null
+++ b/engines/ultima/ultima2/views/interactions/direction.h
@@ -0,0 +1,51 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef ULTIMA2_VIEWS_INTERACTIONS_DIRECTION_H
+#define ULTIMA2_VIEWS_INTERACTIONS_DIRECTION_H
+
+#include "ultima/ultima2/views/interactions/interaction.h"
+
+namespace Ultima {
+namespace Ultima2 {
+namespace Views {
+namespace Interactions {
+
+/**
+ * Prompts for an arrow-key direction, then feeds it back into the active
+ * Logic's attack(). Suspends the gameplay keymap while active so the
+ * arrow keypress arrives raw instead of as a movement action
+ */
+class Direction : public Interaction {
+public:
+	Direction();
+	~Direction() override {}
+
+	bool msgFocus(const FocusMessage &msg) override;
+	bool msgKeypress(const KeypressMessage &msg) override;
+};
+
+} // namespace Interactions
+} // namespace Views
+} // namespace Ultima2
+} // namespace Ultima
+
+#endif
diff --git a/engines/ultima/ultima2/views/interactions/interaction.cpp b/engines/ultima/ultima2/views/interactions/interaction.cpp
new file mode 100644
index 00000000000..94caac16eb3
--- /dev/null
+++ b/engines/ultima/ultima2/views/interactions/interaction.cpp
@@ -0,0 +1,59 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "ultima/ultima2/views/interactions/interaction.h"
+#include "ultima/ultima2/ultima2.h"
+
+namespace Ultima {
+namespace Ultima2 {
+namespace Views {
+namespace Interactions {
+
+Interaction::Interaction(const Common::String &name) : View(name) {
+	setBounds(Common::Rect(0, 0, 0, 0));
+}
+
+bool Interaction::tick() {
+	g_engine->baseView()->findView("Commands")->tick();
+	return Shared::Gfx::View::tick();
+}
+
+void Interaction::writeString(const Common::String &msg) {
+	g_engine->baseView()->findView("Commands")->send(GameMessage("TEXT", msg));
+}
+
+void Interaction::writeString(const char *format, ...) {
+	va_list alist;
+	va_start(alist, format);
+	Common::String msg = Common::String::vformat(format, alist);
+	va_end(alist);
+
+	writeString(msg);
+}
+
+void Interaction::prompt() {
+	g_engine->baseView()->findView("Commands")->send(GameMessage("PROMPT"));
+}
+
+} // namespace Interactions
+} // namespace Views
+} // namespace Ultima2
+} // namespace Ultima
diff --git a/engines/ultima/ultima2/views/interactions/interaction.h b/engines/ultima/ultima2/views/interactions/interaction.h
new file mode 100644
index 00000000000..32258dd3dd2
--- /dev/null
+++ b/engines/ultima/ultima2/views/interactions/interaction.h
@@ -0,0 +1,58 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef ULTIMA2_VIEWS_INTERACTIONS_INTERACTION_H
+#define ULTIMA2_VIEWS_INTERACTIONS_INTERACTION_H
+
+#include "ultima/shared/gfx/view.h"
+
+namespace Ultima {
+namespace Ultima2 {
+namespace Views {
+namespace Interactions {
+
+using namespace Shared::Messages;
+
+/**
+ * Base view for a modal interaction that prompts the player for input and
+ * writes any output through the Commands log view. It's a zero-size dummy
+ * window pushed on top of the current map/game view purely to take input
+ * focus.
+ */
+class Interaction : public Shared::Gfx::View {
+protected:
+	void writeString(const Common::String &msg);
+	void writeString(const char *format, ...);
+	void prompt();
+
+public:
+	Interaction(const Common::String &name);
+	~Interaction() override {}
+
+	bool tick() override;
+};
+
+} // namespace Interactions
+} // namespace Views
+} // namespace Ultima2
+} // namespace Ultima
+
+#endif
diff --git a/engines/ultima/ultima2/views/interactions/ready_spell.cpp b/engines/ultima/ultima2/views/interactions/ready_spell.cpp
new file mode 100644
index 00000000000..828aebe4eee
--- /dev/null
+++ b/engines/ultima/ultima2/views/interactions/ready_spell.cpp
@@ -0,0 +1,54 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "ultima/ultima2/views/interactions/ready_spell.h"
+#include "ultima/ultima2/ultima2.h"
+
+namespace Ultima {
+namespace Ultima2 {
+namespace Views {
+namespace Interactions {
+
+ReadySpell::ReadySpell() : Interaction("ReadySpell") {
+}
+
+bool ReadySpell::msgFocus(const FocusMessage &msg) {
+	writeString("MAGIC SPELL READY #");
+	return Interaction::msgFocus(msg);
+}
+
+bool ReadySpell::msgKeypress(const KeypressMessage &msg) {
+	if (msg.ascii < '0' || msg.ascii > '9')
+		return true;
+
+	int digit = msg.ascii - '0';
+	_G(savegame)._readiedSpell = (Data::SpellType)digit;
+	writeString("%d\nSPELL READY => %s\n", digit, Data::SPELL_NAMES[digit]);
+
+	close();
+	_G(logic)->resumeTurn();
+	return true;
+}
+
+} // namespace Interactions
+} // namespace Views
+} // namespace Ultima2
+} // namespace Ultima
diff --git a/engines/ultima/ultima2/views/interactions/ready_spell.h b/engines/ultima/ultima2/views/interactions/ready_spell.h
new file mode 100644
index 00000000000..89aed1e9307
--- /dev/null
+++ b/engines/ultima/ultima2/views/interactions/ready_spell.h
@@ -0,0 +1,51 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef ULTIMA2_VIEWS_INTERACTIONS_READY_SPELL_H
+#define ULTIMA2_VIEWS_INTERACTIONS_READY_SPELL_H
+
+#include "ultima/ultima2/views/interactions/interaction.h"
+
+namespace Ultima {
+namespace Ultima2 {
+namespace Views {
+namespace Interactions {
+
+/**
+ * Prompts for a digit selecting which spell number to ready. Unlike
+ * ReadyWeapon/WearArmor, there's no ownership or stat check here - that's
+ * all deferred to cast time
+ */
+class ReadySpell : public Interaction {
+public:
+	ReadySpell();
+	~ReadySpell() override {}
+
+	bool msgFocus(const FocusMessage &msg) override;
+	bool msgKeypress(const KeypressMessage &msg) override;
+};
+
+} // namespace Interactions
+} // namespace Views
+} // namespace Ultima2
+} // namespace Ultima
+
+#endif
diff --git a/engines/ultima/ultima2/views/interactions/ready_weapon.cpp b/engines/ultima/ultima2/views/interactions/ready_weapon.cpp
new file mode 100644
index 00000000000..4587a366493
--- /dev/null
+++ b/engines/ultima/ultima2/views/interactions/ready_weapon.cpp
@@ -0,0 +1,62 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "ultima/ultima2/views/interactions/ready_weapon.h"
+#include "ultima/ultima2/ultima2.h"
+
+namespace Ultima {
+namespace Ultima2 {
+namespace Views {
+namespace Interactions {
+
+ReadyWeapon::ReadyWeapon() : Interaction("ReadyWeapon") {
+}
+
+bool ReadyWeapon::msgFocus(const FocusMessage &msg) {
+	writeString("READY WEAPON:\n1-DA, 2-MA, 3-AX, 4-BO,\n5-SW, 6-GR, 7-LI, 8-PH.\n9-QU, WHICH? ");
+	return Interaction::msgFocus(msg);
+}
+
+bool ReadyWeapon::msgKeypress(const KeypressMessage &msg) {
+	if (msg.ascii < '0' || msg.ascii > '9')
+		return true;
+
+	int digit = msg.ascii - '0';
+	Data::Savegame &sg = _G(savegame);
+
+	if (digit != Data::WEAPON_HANDS && sg._weaponOwned[digit] == 0) {
+		writeString("%d\n%s NOT OWNED!\n", digit, Data::WEAPON_NAMES[digit]);
+	} else if (digit * 8 >= sg._agility) {
+		writeString("%d\n<-THOU ART NOT AGILE ENOUGH TO WIELD!\n", digit);
+	} else {
+		sg._readiedWeapon = (Data::WeaponType)digit;
+		writeString("%d\n%s READY.\n", digit, Data::WEAPON_NAMES[digit]);
+	}
+
+	close();
+	_G(logic)->resumeTurn();
+	return true;
+}
+
+} // namespace Interactions
+} // namespace Views
+} // namespace Ultima2
+} // namespace Ultima
diff --git a/engines/ultima/ultima2/views/interactions/ready_weapon.h b/engines/ultima/ultima2/views/interactions/ready_weapon.h
new file mode 100644
index 00000000000..450324e2399
--- /dev/null
+++ b/engines/ultima/ultima2/views/interactions/ready_weapon.h
@@ -0,0 +1,49 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef ULTIMA2_VIEWS_INTERACTIONS_READY_WEAPON_H
+#define ULTIMA2_VIEWS_INTERACTIONS_READY_WEAPON_H
+
+#include "ultima/ultima2/views/interactions/interaction.h"
+
+namespace Ultima {
+namespace Ultima2 {
+namespace Views {
+namespace Interactions {
+
+/**
+ * Prompts for a digit selecting which owned weapon to ready
+ */
+class ReadyWeapon : public Interaction {
+public:
+	ReadyWeapon();
+	~ReadyWeapon() override {}
+
+	bool msgFocus(const FocusMessage &msg) override;
+	bool msgKeypress(const KeypressMessage &msg) override;
+};
+
+} // namespace Interactions
+} // namespace Views
+} // namespace Ultima2
+} // namespace Ultima
+
+#endif
diff --git a/engines/ultima/ultima2/views/interactions/wear_armor.cpp b/engines/ultima/ultima2/views/interactions/wear_armor.cpp
new file mode 100644
index 00000000000..fdbbbf82621
--- /dev/null
+++ b/engines/ultima/ultima2/views/interactions/wear_armor.cpp
@@ -0,0 +1,65 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "ultima/ultima2/views/interactions/wear_armor.h"
+#include "ultima/ultima2/ultima2.h"
+
+namespace Ultima {
+namespace Ultima2 {
+namespace Views {
+namespace Interactions {
+
+WearArmor::WearArmor() : Interaction("WearArmor") {
+}
+
+bool WearArmor::msgFocus(const FocusMessage &msg) {
+	writeString("WEAR ARMOUR:\n1-CLOTH, 2-LEATHER, 3-CHAIN,\n4-PLATE, 5-REFLECT, 6-POWER,\nWHICH? ");
+	return Interaction::msgFocus(msg);
+}
+
+bool WearArmor::msgKeypress(const KeypressMessage &msg) {
+	if (msg.ascii < '0' || msg.ascii > '9')
+		return true;
+
+	int digit = msg.ascii - '0';
+	int armorIdx = (digit == 7) ? Data::ARMOR_SKIN : digit;
+	Data::Savegame &sg = _G(savegame);
+
+	if (armorIdx >= Data::ARMOR_COUNT) {
+		writeString("%d\nNOT OWNED!\n", digit);
+	} else if (armorIdx != Data::ARMOR_SKIN && sg._armorOwned[armorIdx] == 0) {
+		writeString("%d\n%s NOT OWNED!\n", digit, Data::ARMOR_NAMES[armorIdx]);
+	} else if (armorIdx * 8 >= sg._strength) {
+		writeString("%d\n<-THOU ART NOT\nSTRONG ENOUGH TO WEAR!\n", digit);
+	} else {
+		sg._readiedArmor = (Data::ArmorType)armorIdx;
+		writeString("%d\n%s READY.\n", digit, Data::ARMOR_NAMES[armorIdx]);
+	}
+
+	close();
+	_G(logic)->resumeTurn();
+	return true;
+}
+
+} // namespace Interactions
+} // namespace Views
+} // namespace Ultima2
+} // namespace Ultima
diff --git a/engines/ultima/ultima2/views/interactions/wear_armor.h b/engines/ultima/ultima2/views/interactions/wear_armor.h
new file mode 100644
index 00000000000..4c533f17726
--- /dev/null
+++ b/engines/ultima/ultima2/views/interactions/wear_armor.h
@@ -0,0 +1,49 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef ULTIMA2_VIEWS_INTERACTIONS_WEAR_ARMOR_H
+#define ULTIMA2_VIEWS_INTERACTIONS_WEAR_ARMOR_H
+
+#include "ultima/ultima2/views/interactions/interaction.h"
+
+namespace Ultima {
+namespace Ultima2 {
+namespace Views {
+namespace Interactions {
+
+/**
+ * Prompts for a digit selecting which owned armor to wear
+ */
+class WearArmor : public Interaction {
+public:
+	WearArmor();
+	~WearArmor() override {}
+
+	bool msgFocus(const FocusMessage &msg) override;
+	bool msgKeypress(const KeypressMessage &msg) override;
+};
+
+} // namespace Interactions
+} // namespace Views
+} // namespace Ultima2
+} // namespace Ultima
+
+#endif
diff --git a/engines/ultima/ultima2/views/interactions/yell.cpp b/engines/ultima/ultima2/views/interactions/yell.cpp
new file mode 100644
index 00000000000..066eedbf4ad
--- /dev/null
+++ b/engines/ultima/ultima2/views/interactions/yell.cpp
@@ -0,0 +1,55 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "ultima/ultima2/views/interactions/yell.h"
+#include "ultima/ultima2/ultima2.h"
+#include "ultima/ultima2/metaengine.h"
+
+namespace Ultima {
+namespace Ultima2 {
+namespace Views {
+namespace Interactions {
+
+Yell::Yell() : Interaction("Yell") {
+}
+
+bool Yell::msgFocus(const FocusMessage &msg) {
+	writeString("YELL WHAT?\n");
+	MetaEngine::setKeybindingMode(KBMODE_MINIMAL);
+	return Interaction::msgFocus(msg);
+}
+
+bool Yell::msgKeypress(const KeypressMessage &msg) {
+	if (msg.ascii == 13) {
+		writeString("\n");
+		close();
+		_G(logic)->resumeTurn();
+	} else if (msg.ascii >= 32 && msg.ascii < 127) {
+		writeString("%c", (char)msg.ascii);
+	}
+
+	return true;
+}
+
+} // namespace Interactions
+} // namespace Views
+} // namespace Ultima2
+} // namespace Ultima
diff --git a/engines/ultima/ultima2/views/interactions/yell.h b/engines/ultima/ultima2/views/interactions/yell.h
new file mode 100644
index 00000000000..7e848fa66be
--- /dev/null
+++ b/engines/ultima/ultima2/views/interactions/yell.h
@@ -0,0 +1,50 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef ULTIMA2_VIEWS_INTERACTIONS_YELL_H
+#define ULTIMA2_VIEWS_INTERACTIONS_YELL_H
+
+#include "ultima/ultima2/views/interactions/interaction.h"
+
+namespace Ultima {
+namespace Ultima2 {
+namespace Views {
+namespace Interactions {
+
+/**
+ * A pure flavor-text prompt - echoes typed characters back out until
+ * Enter is pressed, with no gameplay effect at all
+ */
+class Yell : public Interaction {
+public:
+	Yell();
+	~Yell() override {}
+
+	bool msgFocus(const FocusMessage &msg) override;
+	bool msgKeypress(const KeypressMessage &msg) override;
+};
+
+} // namespace Interactions
+} // namespace Views
+} // namespace Ultima2
+} // namespace Ultima
+
+#endif
diff --git a/engines/ultima/ultima2/views/overworld_map.cpp b/engines/ultima/ultima2/views/overworld_map.cpp
index 651b85384e2..87d048a72c7 100644
--- a/engines/ultima/ultima2/views/overworld_map.cpp
+++ b/engines/ultima/ultima2/views/overworld_map.cpp
@@ -39,11 +39,13 @@ constexpr int PLAYER_VIEWPORT_Y = 5;
 
 OverworldMap::OverworldMap() : Map("OverworldMap") {
 	Data::loadTiles(_tiles);
+	Data::loadAttackSprite(_attackSprite);
 }
 
 OverworldMap::~OverworldMap() {
 	for (int i = 0; i < Data::TILE_COUNT; ++i)
 		_tiles[i].free();
+	_attackSprite.free();
 }
 
 bool OverworldMap::msgFocus(const FocusMessage &msg) {
@@ -57,11 +59,37 @@ bool OverworldMap::msgUnfocus(const UnfocusMessage &msg) {
 	return Map::msgUnfocus(msg);
 }
 
+bool OverworldMap::msgAttackTile(const AttackTileMessage &msg) {
+	Data::Savegame &sg = _G(savegame);
+	int mapLeft = sg._mapX - PLAYER_VIEWPORT_X;
+	int mapTop = sg._mapY - PLAYER_VIEWPORT_Y;
+	int ox = msg._x - mapLeft;
+	int oy = msg._y - mapTop;
+
+	if (ox < 0 || ox >= VIEWPORT_WIDTH || oy < 0 || oy >= VIEWPORT_HEIGHT)
+		return true;
+
+	Common::Point pt(ox * TILE_WIDTH, oy * TILE_HEIGHT);
+	auto s = getSurface();
+
+	// XOR-flash the hit indicator on, then off again - matches the
+	// original's xorSpriteDrawCenter-twice-with-a-pause-between pattern
+	s.xorBlitFrom(_attackSprite, pt);
+	g_engine->updateScreen();
+	g_engine->pauseMillis(80);
+
+	s.xorBlitFrom(_attackSprite, pt);
+	g_engine->updateScreen();
+
+	return true;
+}
+
 void OverworldMap::draw() {
 	auto s = getSurface();
 	s.clear();
 
 	Data::Savegame &sg = _G(savegame);
+	Data::MapMonsters &monsters = _G(map)._monsters;
 	int mapLeft = sg._mapX - PLAYER_VIEWPORT_X;
 	int mapTop = sg._mapY - PLAYER_VIEWPORT_Y;
 
@@ -71,6 +99,13 @@ void OverworldMap::draw() {
 			int y = (mapTop + oy + Data::MAP_HEIGHT) % Data::MAP_HEIGHT;
 			Data::TileId tileId = _G(map).tileAt(x, y);
 
+			for (int slot = 1; slot <= 31; ++slot) {
+				if (monsters.isActive(slot) && monsters._mapX[slot] == x && monsters._mapY[slot] == y) {
+					tileId = monsters.tileType(slot);
+					break;
+				}
+			}
+
 			if (ox == PLAYER_VIEWPORT_X && oy == PLAYER_VIEWPORT_Y)
 				tileId = (Data::TileId)(Data::TILE_FIGHTER + sg._class);
 
diff --git a/engines/ultima/ultima2/views/overworld_map.h b/engines/ultima/ultima2/views/overworld_map.h
index ae49a83d752..995ad4cdd61 100644
--- a/engines/ultima/ultima2/views/overworld_map.h
+++ b/engines/ultima/ultima2/views/overworld_map.h
@@ -36,6 +36,7 @@ namespace Views {
 class OverworldMap : public Map {
 private:
 	Graphics::Surface _tiles[Data::TILE_COUNT];
+	Graphics::ManagedSurface _attackSprite;
 
 public:
 	OverworldMap();
@@ -43,6 +44,7 @@ public:
 
 	bool msgFocus(const FocusMessage &msg) override;
 	bool msgUnfocus(const UnfocusMessage &msg) override;
+	bool msgAttackTile(const AttackTileMessage &msg) override;
 	void draw() override;
 };
 
diff --git a/engines/ultima/ultima2/views/views.h b/engines/ultima/ultima2/views/views.h
index 367f5d50332..534506c7cad 100644
--- a/engines/ultima/ultima2/views/views.h
+++ b/engines/ultima/ultima2/views/views.h
@@ -29,18 +29,31 @@
 #include "ultima/ultima2/views/startup.h"
 #include "ultima/ultima2/views/title.h"
 #include "ultima/ultima2/views/world_map_overview.h"
+#include "ultima/ultima2/views/zstats.h"
+#include "ultima/ultima2/views/interactions/direction.h"
+#include "ultima/ultima2/views/interactions/ready_spell.h"
+#include "ultima/ultima2/views/interactions/ready_weapon.h"
+#include "ultima/ultima2/views/interactions/wear_armor.h"
+#include "ultima/ultima2/views/interactions/yell.h"
 
 namespace Ultima {
 namespace Ultima2 {
 namespace Views {
 
 struct Views : public Shared::Views {
+	Interactions::Direction _direction;
+	Interactions::ReadySpell _readySpell;
+	Interactions::ReadyWeapon _readyWeapon;
+	Interactions::WearArmor _wearArmor;
+	Interactions::Yell _yell;
+
 	CreateCharacter _createCharacter;
 	Game _game;
 	OverworldMap _overworldMap;
 	Startup _startup;
 	Title _title;
 	WorldMapOverview _worldMapOverview;
+	ZStats _zstats;
 };
 
 } // namespace Views
diff --git a/engines/ultima/ultima2/views/zstats.cpp b/engines/ultima/ultima2/views/zstats.cpp
new file mode 100644
index 00000000000..b15c6d7f463
--- /dev/null
+++ b/engines/ultima/ultima2/views/zstats.cpp
@@ -0,0 +1,142 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "ultima/ultima2/views/zstats.h"
+#include "ultima/ultima2/ultima2.h"
+
+namespace Ultima {
+namespace Ultima2 {
+namespace Views {
+
+constexpr int COLOR_TEXT = 3;
+
+static const char *weaponName(Data::WeaponType w) {
+	return (w >= 0 && w < Data::WEAPON_COUNT) ? Data::WEAPON_NAMES[w] : "";
+}
+
+static const char *armorName(Data::ArmorType a) {
+	return (a >= 0 && a < Data::ARMOR_COUNT) ? Data::ARMOR_NAMES[a] : "";
+}
+
+static const char *spellName(Data::SpellType s) {
+	return (s >= 0 && s < Data::SPELL_COUNT) ? Data::SPELL_NAMES[s] : "";
+}
+
+static const char *itemName(int i) {
+	return (i >= 0 && i < Data::ITEM_COUNT) ? Data::ITEM_NAMES[i] : "";
+}
+
+static const char *raceName(Data::Race race) {
+	switch (race) {
+	case Data::RACE_HUMAN: return "HUMAN";
+	case Data::RACE_ELF: return "ELF";
+	case Data::RACE_DWARF: return "DWARF";
+	case Data::RACE_HOBBIT: return "HOBBIT";
+	default: return "";
+	}
+}
+
+static const char *className(Data::CharClass charClass) {
+	switch (charClass) {
+	case Data::CLASS_FIGHTER: return "FIGHTER";
+	case Data::CLASS_CLERIC: return "CLERIC";
+	case Data::CLASS_WIZARD: return "WIZARD";
+	case Data::CLASS_THIEF: return "THIEF";
+	default: return "";
+	}
+}
+
+ZStats::ZStats() : View("ZStats") {
+	setBounds(TextRect(0, 0, 39, 24));
+}
+
+void ZStats::draw() {
+	auto s = getSurface();
+	s.clear();
+	s.setColor(COLOR_TEXT);
+
+	Data::Savegame &sg = _G(savegame);
+
+	s.writeString(Common::Point(0, 0), "%s", sg._name);
+	s.writeString(Common::Point(0, 1), "A LEVEL %.2d %s %s %s", sg._experience,
+		sg._sex == Data::SEX_MALE ? "MALE" : "FEMALE",
+		raceName(sg._race),
+		className(sg._class));
+
+	s.writeString(Common::Point(2, 4), "WEAPON-%s", weaponName(sg._readiedWeapon));
+	s.writeString(Common::Point(2, 5), "ARMOUR-%s", armorName(sg._readiedArmor));
+	s.writeString(Common::Point(2, 6), " SPELL-%s", spellName(sg._readiedSpell));
+
+	s.writeString(Common::Point(39, 4), Common::String::format("TORCHES-%.2d", sg._torches), Graphics::kTextAlignRight);
+	s.writeString(Common::Point(39, 5), Common::String::format("KEYS-%.2d", sg._keys), Graphics::kTextAlignRight);
+	s.writeString(Common::Point(39, 6), Common::String::format("TOOLS-%.2d", sg._thievesTools), Graphics::kTextAlignRight);
+
+	s.writeString(Common::Point(0, 7), "STRENGTH-%.2d", sg._strength);
+	s.writeString(Common::Point(14, 7), " STAMINA-%.2d", sg._stamina);
+	s.writeString(Common::Point(29, 7), " WISDOM-%.2d", sg._wisdom);
+	s.writeString(Common::Point(0, 8), " AGILITY-%.2d", sg._agility);
+	s.writeString(Common::Point(14, 8), "CHARISMA-%.2d", sg._charisma);
+	s.writeString(Common::Point(29, 8), "INTELL.-%.2d", sg._intelligence);
+
+	int row = 10;
+	Common::String line = "WEAPONS: ";
+	for (int i = 0; i < Data::WEAPON_COUNT; ++i) {
+		if (sg._weaponOwned[i] != 0)
+			line += Common::String::format("%sS-%d ", weaponName((Data::WeaponType)i), sg._weaponOwned[i]);
+	}
+	s.writeString(Common::Point(0, row), line);
+	row += 3; // two blank rows below WEAPONS
+
+	line = "ARMOUR: ";
+	for (int i = 0; i < Data::ARMOR_COUNT; ++i) {
+		if (sg._armorOwned[i] != 0)
+			line += Common::String::format("%s-%d ", armorName((Data::ArmorType)i), sg._armorOwned[i]);
+	}
+	s.writeString(Common::Point(0, row), line);
+	row += 2; // one blank row below ARMOUR
+
+	line = "SPELLS: ";
+	for (int i = 0; i < Data::SPELL_COUNT; ++i) {
+		if (sg._spellCharges[i] != 0)
+			line += Common::String::format("%sS-%d ", spellName((Data::SpellType)i), sg._spellCharges[i]);
+	}
+	s.writeString(Common::Point(0, row), line);
+	row += 3; // two blank rows below SPELLS
+
+	line = "ITEMS: ";
+	for (int i = 0; i < Data::ITEM_COUNT; ++i) {
+		if (sg._items[i] != 0) {
+			line += Common::String::format("%s%s-%d ", itemName(i),
+				i == Data::ITEM_BOOTS ? "" : "S", sg._items[i]);
+		}
+	}
+	s.writeString(Common::Point(0, row), line);
+}
+
+bool ZStats::msgKeypress(const KeypressMessage &msg) {
+	close();
+	_G(logic)->resumeTurn();
+	return true;
+}
+
+} // namespace Views
+} // namespace Ultima2
+} // namespace Ultima
diff --git a/engines/ultima/ultima2/views/zstats.h b/engines/ultima/ultima2/views/zstats.h
new file mode 100644
index 00000000000..437b42bbaab
--- /dev/null
+++ b/engines/ultima/ultima2/views/zstats.h
@@ -0,0 +1,50 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef ULTIMA2_VIEWS_ZSTATS_H
+#define ULTIMA2_VIEWS_ZSTATS_H
+
+#include "ultima/shared/gfx/view.h"
+
+namespace Ultima {
+namespace Ultima2 {
+namespace Views {
+
+using namespace Shared::Messages;
+
+/**
+ * The "Z" full character stats screen. Closes and resumes the turn on any
+ * keypress.
+ */
+class ZStats : public Shared::Gfx::View {
+public:
+	ZStats();
+	~ZStats() override {}
+
+	void draw() override;
+	bool msgKeypress(const KeypressMessage &msg) override;
+};
+
+} // namespace Views
+} // namespace Ultima2
+} // namespace Ultima
+
+#endif


Commit: cf90097f962067b02fde6e1ffbebebde535c51ce
    https://github.com/scummvm/scummvm/commit/cf90097f962067b02fde6e1ffbebebde535c51ce
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:40:55+11:00

Commit Message:
ULTIMA: ULTIMA2: Add towns, villages, and castles

Changed paths:
  A engines/ultima/ultima2/logic/city_castle_logic.cpp
  A engines/ultima/ultima2/logic/city_castle_logic.h
  A engines/ultima/ultima2/views/interactions/offer_gold.cpp
  A engines/ultima/ultima2/views/interactions/offer_gold.h
  A engines/ultima/ultima2/views/interactions/shop.cpp
  A engines/ultima/ultima2/views/interactions/shop.h
  A engines/ultima/ultima2/views/location_map.cpp
  A engines/ultima/ultima2/views/location_map.h
    engines/ultima/module.mk
    engines/ultima/ultima2/data/data.cpp
    engines/ultima/ultima2/data/data.h
    engines/ultima/ultima2/data/map.cpp
    engines/ultima/ultima2/data/savegame.cpp
    engines/ultima/ultima2/data/savegame.h
    engines/ultima/ultima2/data/tiles.h
    engines/ultima/ultima2/gfx/pic_decoder.cpp
    engines/ultima/ultima2/gfx/pic_decoder.h
    engines/ultima/ultima2/logic/logic.cpp
    engines/ultima/ultima2/logic/logic.h
    engines/ultima/ultima2/logic/overworld_logic.cpp
    engines/ultima/ultima2/logic/overworld_logic.h
    engines/ultima/ultima2/views/interactions/direction.cpp
    engines/ultima/ultima2/views/overworld_map.cpp
    engines/ultima/ultima2/views/views.h


diff --git a/engines/ultima/module.mk b/engines/ultima/module.mk
index ef8fedf7c12..9581cdcf6c1 100644
--- a/engines/ultima/module.mk
+++ b/engines/ultima/module.mk
@@ -119,11 +119,13 @@ MODULE_OBJS += \
 	ultima2/data/tiles.o \
 	ultima2/gfx/pic_decoder.o \
 	ultima2/gfx/text_cursor.o \
+	ultima2/logic/city_castle_logic.o \
 	ultima2/logic/logic.o \
 	ultima2/logic/overworld_logic.o \
 	ultima2/views/commands.o \
 	ultima2/views/create_character.o \
 	ultima2/views/game.o \
+	ultima2/views/location_map.o \
 	ultima2/views/map.o \
 	ultima2/views/overworld_map.o \
 	ultima2/views/startup.o \
@@ -133,8 +135,10 @@ MODULE_OBJS += \
 	ultima2/views/zstats.o \
 	ultima2/views/interactions/interaction.o \
 	ultima2/views/interactions/direction.o \
+	ultima2/views/interactions/offer_gold.o \
 	ultima2/views/interactions/ready_spell.o \
 	ultima2/views/interactions/ready_weapon.o \
+	ultima2/views/interactions/shop.o \
 	ultima2/views/interactions/wear_armor.o \
 	ultima2/views/interactions/yell.o
 endif
diff --git a/engines/ultima/ultima2/data/data.cpp b/engines/ultima/ultima2/data/data.cpp
index e5da4d5ec67..3a988b0be98 100644
--- a/engines/ultima/ultima2/data/data.cpp
+++ b/engines/ultima/ultima2/data/data.cpp
@@ -25,6 +25,13 @@ namespace Ultima {
 namespace Ultima2 {
 namespace Data {
 
+const byte CGA_PALETTE1[4 * 3] = {
+	0x00, 0x00, 0x00, // 0: black
+	0x55, 0xff, 0xff, // 1: light cyan
+	0xff, 0x55, 0xff, // 2: light magenta
+	0xff, 0xff, 0xff  // 3: white
+};
+
 const char *const WEAPON_NAMES[WEAPON_COUNT] = {
 	"HANDS", "DAGGER", "MACE", "AXE", "BOW", "SWORD",
 	"GREAT SWORD", "LIGHT SWORD", "PHASER", "QUICK SWORD"
diff --git a/engines/ultima/ultima2/data/data.h b/engines/ultima/ultima2/data/data.h
index 834260ba0b1..c922398ef35 100644
--- a/engines/ultima/ultima2/data/data.h
+++ b/engines/ultima/ultima2/data/data.h
@@ -22,10 +22,16 @@
 #ifndef ULTIMA2_DATA_DATA_H
 #define ULTIMA2_DATA_DATA_H
 
+#include "common/scummsys.h"
+
 namespace Ultima {
 namespace Ultima2 {
 namespace Data {
 
+// CGA mode 4, palette 1 (black/light cyan/light magenta/white), the
+// palette used by both the pic??? art and the embedded tile graphics
+extern const byte CGA_PALETTE1[4 * 3];
+
 constexpr int MAX_NAME_LENGTH = 12;
 
 enum Direction {
diff --git a/engines/ultima/ultima2/data/map.cpp b/engines/ultima/ultima2/data/map.cpp
index 8466accc8ce..906a4ee7c40 100644
--- a/engines/ultima/ultima2/data/map.cpp
+++ b/engines/ultima/ultima2/data/map.cpp
@@ -23,6 +23,7 @@
 #include "ultima/ultima2/data/map.h"
 #include "ultima/ultima2/ultima2.h"
 #include "ultima/ultima2/logic/overworld_logic.h"
+#include "ultima/ultima2/logic/city_castle_logic.h"
 #include "ultima/shared/gfx/view.h"
 
 namespace Ultima {
@@ -50,9 +51,12 @@ void Map::load(int mapNum1, int mapNum2) {
 
 	_monsters.load(mapNum1, mapNum2);
 
-	// TODO: only OverworldLogic exists so far -- villages/towns/castles
-	// (mapNum2 1-3) get their own CityCastleLogic in a later stage
-	_G(logic) = Common::SharedPtr<Logic::Logic>(new Logic::OverworldLogic());
+	if (mapNum2 == 0)
+		_G(logic) = Common::SharedPtr<Logic::Logic>(new Logic::OverworldLogic());
+	else
+		_G(logic) = Common::SharedPtr<Logic::Logic>(new Logic::CityCastleLogic());
+
+	Common::String mapViewName = (mapNum2 == 0) ? "OverworldMap" : "LocationMap";
 
 	if (!g_engine->isPresent("Game")) {
 		// Set up the game view and force it to draw immediately
@@ -60,10 +64,10 @@ void Map::load(int mapNum1, int mapNum2) {
 		g_engine->focusedView()->draw();
 
 		// Now open the map view on top of it
-		g_engine->addView("OverworldMap");
+		g_engine->addView(mapViewName);
 	} else {
 		// Just switching from one map view to another
-		g_engine->replaceView("OverworldMap");
+		g_engine->replaceView(mapViewName);
 	}
 }
 
diff --git a/engines/ultima/ultima2/data/savegame.cpp b/engines/ultima/ultima2/data/savegame.cpp
index e91f504a82f..c209ec5b1fc 100644
--- a/engines/ultima/ultima2/data/savegame.cpp
+++ b/engines/ultima/ultima2/data/savegame.cpp
@@ -48,6 +48,8 @@ void Savegame::synchronize(Common::Serializer &s) {
 	s.syncAsByte(_mapNum2);
 	s.syncAsByte(_mapX);
 	s.syncAsByte(_mapY);
+	s.syncAsByte(_overworldReturnX);
+	s.syncAsByte(_overworldReturnY);
 
 	s.syncAsByte(_readiedWeapon);
 	s.syncAsByte(_readiedArmor);
diff --git a/engines/ultima/ultima2/data/savegame.h b/engines/ultima/ultima2/data/savegame.h
index e91d85f6e1c..156b116775c 100644
--- a/engines/ultima/ultima2/data/savegame.h
+++ b/engines/ultima/ultima2/data/savegame.h
@@ -61,6 +61,11 @@ struct Savegame {
 	byte _mapX = 0;
 	byte _mapY = 0;
 
+	// Overworld position to restore to when walking off the edge of a
+	// village/town/castle/tower/dungeon map back to the surface
+	byte _overworldReturnX = 0;
+	byte _overworldReturnY = 0;
+
 	// Currently readied items
 	WeaponType _readiedWeapon = WEAPON_HANDS;
 	ArmorType _readiedArmor = ARMOR_SKIN;
@@ -139,6 +144,31 @@ struct Savegame {
 		_foodTurnCtr = total % 100;
 		return true;
 	}
+
+	/**
+	 * Computes a shop item's price: a repeated doubling (mod 100) ramp
+	 * keyed off the item index, discounted by the player's combined
+	 * Intelligence+Charisma (a haggling mechanic)
+	 */
+	int computeItemPrice(int itemIndex) const {
+		int sum = _intelligence + _charisma;
+		int discount = 0;
+		while (sum > 0) {
+			sum >>= 1;
+			++discount;
+		}
+		if (discount > 8)
+			discount = 8;
+
+		int effIndex = itemIndex + 8 - discount;
+		if (effIndex < 0)
+			effIndex = 0;
+
+		int price = 4;
+		for (int i = 0; i < effIndex; ++i)
+			price = (price * 2) % 100;
+		return price;
+	}
 };
 
 } // namespace Data
diff --git a/engines/ultima/ultima2/data/tiles.h b/engines/ultima/ultima2/data/tiles.h
index 3d23b020228..c018dc7d945 100644
--- a/engines/ultima/ultima2/data/tiles.h
+++ b/engines/ultima/ultima2/data/tiles.h
@@ -31,12 +31,12 @@ namespace Data {
 
 enum TileId {
 	TILE_WATER = 0, TILE_SWAMP = 1, TILE_GRASS = 2, TILE_FOREST = 3, TILE_MOUNTAIN = 4,
-	TILE_UNKNOWN_5 = 5, TILE_TOWN = 6, TILE_TOWER = 7, TILE_CASTLE = 8,
+	TILE_VILLAGE = 5, TILE_TOWN = 6, TILE_TOWER = 7, TILE_CASTLE = 8,
 	TILE_DUNGEON_ENTRANCE = 9, TILE_SIGNPOST = 10, TILE_SEA_MONSTER = 11, TILE_ORC = 12,
 	TILE_DAEMON = 13, TILE_DEVIL = 14, TILE_BALRON = 15, TILE_MINAX = 16, TILE_HORSE = 17,
 	TILE_SHIP = 18, TILE_AIRPLANE = 19, TILE_ROCKET = 20, TILE_SHIELD = 21, TILE_SWORD = 22,
 	TILE_FORCEFIELD = 23, TILE_GUARD = 24, TILE_JESTER = 25, TILE_SHOPKEEP = 26,
-	TILE_UNKNOWN_27 = 27, TILE_ROAD = 28, TILE_EMPTY = 29, TILE_WALL = 30,
+	TILE_TITHE_ALTAR = 27, TILE_ROAD = 28, TILE_EMPTY = 29, TILE_WALL = 30,
 	TILE_EMPTY_COUNTER = 31,
 	TILE_A = 32, TILE_B = 33, TILE_C = 34, TILE_D = 35, TILE_E = 36, TILE_F = 37, TILE_G = 38,
 	TILE_H = 39, TILE_I_DOOR = 40, TILE_J = 41, TILE_K = 42, TILE_L = 43, TILE_M = 44,
diff --git a/engines/ultima/ultima2/gfx/pic_decoder.cpp b/engines/ultima/ultima2/gfx/pic_decoder.cpp
index 99e15851889..ecf16c1baba 100644
--- a/engines/ultima/ultima2/gfx/pic_decoder.cpp
+++ b/engines/ultima/ultima2/gfx/pic_decoder.cpp
@@ -20,6 +20,7 @@
  */
 
 #include "common/stream.h"
+#include "ultima/ultima2/data/data.h"
 #include "ultima/ultima2/gfx/pic_decoder.h"
 
 namespace Ultima {
@@ -29,13 +30,6 @@ namespace Gfx {
 constexpr int BANK_SIZE = 0x2000;  // reserved size of each interlaced CGA bank
 constexpr int BYTES_PER_ROW = 80;  // 320 pixels / 4 pixels-per-byte
 
-const byte CGA_PALETTE1[4 * 3] = {
-	0x00, 0x00, 0x00, // 0: black
-	0x55, 0xff, 0xff, // 1: light cyan
-	0xff, 0x55, 0xff, // 2: light magenta
-	0xff, 0xff, 0xff  // 3: white
-};
-
 bool PicDecoder::loadStream(Common::SeekableReadStream &stream) {
 	destroy();
 	_surface.create(320, 200, Graphics::PixelFormat::createFormatCLUT8());
@@ -59,7 +53,7 @@ bool PicDecoder::loadStream(Common::SeekableReadStream &stream) {
 		}
 	}
 
-	_palette = Graphics::Palette(CGA_PALETTE1, 4);
+	_palette = Graphics::Palette(Data::CGA_PALETTE1, 4);
 	return true;
 }
 
diff --git a/engines/ultima/ultima2/gfx/pic_decoder.h b/engines/ultima/ultima2/gfx/pic_decoder.h
index ea59fa1c458..8e422ad04db 100644
--- a/engines/ultima/ultima2/gfx/pic_decoder.h
+++ b/engines/ultima/ultima2/gfx/pic_decoder.h
@@ -30,10 +30,6 @@ namespace Ultima {
 namespace Ultima2 {
 namespace Gfx {
 
-// CGA mode 4, palette 1 (black/light cyan/light magenta/white), the
-// palette used by both the pic??? art and the embedded tile graphics
-extern const byte CGA_PALETTE1[4 * 3];
-
 /**
  * Decodes Ultima II's raw "pic???" full-screen title/demo art: a literal
  * 16384-byte dump of the CGA mode 4 (320x200, 4-color, palette 1)
diff --git a/engines/ultima/ultima2/logic/city_castle_logic.cpp b/engines/ultima/ultima2/logic/city_castle_logic.cpp
new file mode 100644
index 00000000000..70428a308f9
--- /dev/null
+++ b/engines/ultima/ultima2/logic/city_castle_logic.cpp
@@ -0,0 +1,532 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "ultima/ultima2/logic/city_castle_logic.h"
+#include "ultima/ultima2/ultima2.h"
+
+namespace Ultima {
+namespace Ultima2 {
+namespace Logic {
+
+void CityCastleLogic::exitToOverworld() {
+	Data::Savegame &sg = _G(savegame);
+	sg._mapX = sg._overworldReturnX;
+	sg._mapY = sg._overworldReturnY;
+	sg._mapNum2 = 0;
+	_G(map).load(sg._mapNum1, sg._mapNum2);
+}
+
+bool CityCastleLogic::move(Data::Direction dir) {
+	Data::Savegame &sg = _G(savegame);
+
+	int newX = sg._mapX, newY = sg._mapY;
+	const char *dirName;
+	switch (dir) {
+	case Data::DIR_UP:    --newY; dirName = "NORTH"; break;
+	case Data::DIR_DOWN:  ++newY; dirName = "SOUTH"; break;
+	case Data::DIR_LEFT:  --newX; dirName = "WEST"; break;
+	case Data::DIR_RIGHT: ++newX; dirName = "EAST"; break;
+	default: return true;
+	}
+
+	writeString("%s", dirName);
+
+	if (sg._legParalysisTurns > 0) {
+		writeString("--PARALIZED!--INVALID MOVE!\n");
+		return true;
+	}
+
+	if (newX < 0 || newX >= Data::MAP_WIDTH || newY < 0 || newY >= Data::MAP_HEIGHT) {
+		writeString("\n");
+		exitToOverworld();
+		return false;
+	}
+
+	Data::TileId destTile = _G(map).tileAt(newX, newY);
+
+	if (destTile == Data::TILE_SWAMP) {
+		if (!sg.deductHP(5)) {
+			playerDied();
+			return false;
+		}
+	} else if (destTile == Data::TILE_FORCEFIELD) {
+		if (sg._items[Data::ITEM_RING] != 0) {
+			writeString("\nRING PROTECTS FROM FIELD!\n");
+		} else {
+			writeString("\nFIELD CAUSES 1000 DAMAGE!\n");
+			if (!sg.deductHP(1000)) {
+				playerDied();
+				return false;
+			}
+		}
+	}
+
+	if (!sg.deductFood(25)) {
+		playerDied();
+		return false;
+	}
+
+	if (!isWalkable(destTile) || findTargetMonster(newX, newY) >= 0) {
+		writeString("--INVALID MOVE!\n");
+		return true;
+	}
+
+	writeString("\n");
+	sg._mapX = newX;
+	sg._mapY = newY;
+	return true;
+}
+
+void CityCastleLogic::updateCreatures() {
+	Data::Savegame &sg = _G(savegame);
+	Data::MapMonsters &monsters = _G(map)._monsters;
+	byte damageAccumulator = 0;
+	int engagedCount = 0, hitCount = 0;
+
+	for (int slot = 31; slot >= 1; --slot) {
+		if (!monsters.isActive(slot))
+			continue;
+
+		int8 flag = (int8)monsters._offerFlag[slot];
+		if (flag <= 0)
+			continue; // at rest (0), or a shop/quest NPC (negative/high-bit) - never moves
+
+		int sdx, sdy;
+		if (flag <= 2) {
+			int dx = sg._mapX - monsters._mapX[slot];
+			int dy = sg._mapY - monsters._mapY[slot];
+			sdx = signByte(dx * 4);
+			sdy = signByte(dy * 4);
+		} else {
+			// Wander: 75% chance to pick a fresh random direction, else
+			// keep going the way it was already headed (kept in _tempX/Y)
+			if (randByte() < 0xC0 || (monsters._tempX[slot] == 0 && monsters._tempY[slot] == 0)) {
+				static const int8 DX[4] = { 0, 0, -1, 1 };
+				static const int8 DY[4] = { -1, 1, 0, 0 };
+				int r = randByte() & 3;
+				sdx = DX[r];
+				sdy = DY[r];
+				monsters._tempX[slot] = (byte)sdx;
+				monsters._tempY[slot] = (byte)sdy;
+			} else {
+				sdx = (int8)monsters._tempX[slot];
+				sdy = (int8)monsters._tempY[slot];
+			}
+		}
+
+		int newX = (monsters._mapX[slot] + sdx + Data::MAP_WIDTH) % Data::MAP_WIDTH;
+		int newY = (monsters._mapY[slot] + sdy + Data::MAP_HEIGHT) % Data::MAP_HEIGHT;
+
+		if (flag <= 2 && newX == sg._mapX && newY == sg._mapY) {
+			++engagedCount;
+
+			int roll = randByte();
+			if (roll < 0x80 && (roll & 7) >= sg._readiedArmor) {
+				++hitCount;
+				int contribution = (monsters._spellHP[slot] >> 2) + 1 + damageAccumulator;
+				damageAccumulator = (byte)contribution;
+			}
+		} else if (newX != sg._mapX || newY != sg._mapY) {
+			if (monsters._spellHP[slot] < 16)
+				++monsters._spellHP[slot];
+
+			if (!tryMoveMonster(slot, sdx, sdy) && !tryMoveMonster(slot, 0, sdy))
+				tryMoveMonster(slot, sdx, 0);
+		}
+	}
+
+	for (int i = 0; i < engagedCount; ++i) {
+		playFX(1);
+		if (i < hitCount)
+			showAttackTile(sg._mapX, sg._mapY);
+	}
+
+	if (damageAccumulator != 0) {
+		int dmg = (randByte() & damageAccumulator & 0x77) + 1;
+		if (!sg.deductHP(dmg)) {
+			playerDied();
+			return;
+		}
+	}
+
+	// Villages/towns/castles don't spawn new monsters
+}
+
+bool CityCastleLogic::steal(Data::Direction dir) {
+	if (dir == Data::DIR_UNSPECIFIED) {
+		writeString("STEAL--");
+		_directionPurpose = DirectionPurpose::STEAL;
+		g_engine->addView("Direction");
+		return false;
+	}
+
+	Data::Savegame &sg = _G(savegame);
+	int dx = 0, dy = 0;
+	switch (dir) {
+	case Data::DIR_UP: dy = -1; break;
+	case Data::DIR_DOWN: dy = 1; break;
+	case Data::DIR_LEFT: dx = -1; break;
+	case Data::DIR_RIGHT: dx = 1; break;
+	default: break;
+	}
+
+	int x1 = sg._mapX + dx, y1 = sg._mapY + dy;
+	bool counterFound = x1 >= 0 && x1 < Data::MAP_WIDTH && y1 >= 0 && y1 < Data::MAP_HEIGHT &&
+		(_G(map).tileAt(x1, y1) >= Data::TILE_A || _G(map).tileAt(x1, y1) == Data::TILE_EMPTY_COUNTER);
+
+	int x2 = sg._mapX + dx * 2, y2 = sg._mapY + dy * 2;
+	bool foundShopkeep = counterFound && x2 >= 0 && x2 < Data::MAP_WIDTH && y2 >= 0 && y2 < Data::MAP_HEIGHT &&
+		_G(map).tileAt(x2, y2) == Data::TILE_SHOPKEEP;
+
+	auto noLuck = [this]() {
+		writeString("NO LUCK!\n");
+		if ((randByte() & 7) == 0)
+			alertTownGuards();
+	};
+
+	if (!foundShopkeep) {
+		noLuck();
+		return true;
+	}
+	if (sg._class != Data::CLASS_THIEF && (randByte() & 0x80) != 0) {
+		noLuck();
+		return true;
+	}
+	if ((randByte() & 0x80) != 0) {
+		noLuck();
+		return true;
+	}
+
+	Data::MapMonsters &monsters = _G(map)._monsters;
+	if (monsters._offerFlag[0] == 1) {
+		noLuck();
+		return true;
+	}
+
+	switch (sg._mapNum2) {
+	case 1: // Village
+		if (sg._mapY < 32 && sg._mapX >= 32) {
+			writeString("STEAL FOOD!\n");
+			++sg._food;
+		} else {
+			noLuck();
+		}
+		break;
+	case 2: // Town
+		if (sg._mapY >= 32) {
+			noLuck();
+		} else if (sg._mapX >= 32) {
+			writeString("STEAL ARMOUR!\n");
+			++sg._armorOwned[1 + (randByte() & 3)];
+		} else {
+			writeString("STEAL WEAPONS!\n");
+			++sg._weaponOwned[1 + (randByte() & 7)];
+		}
+		break;
+	default: // Castle - never works
+		noLuck();
+		break;
+	}
+
+	return true;
+}
+
+bool CityCastleLogic::unlock(Data::Direction dir) {
+	if (dir == Data::DIR_UNSPECIFIED) {
+		_directionPurpose = DirectionPurpose::UNLOCK;
+		g_engine->addView("Direction");
+		return false;
+	}
+
+	Data::Savegame &sg = _G(savegame);
+	int dx = 0, dy = 0;
+	switch (dir) {
+	case Data::DIR_UP: dy = -1; break;
+	case Data::DIR_DOWN: dy = 1; break;
+	case Data::DIR_LEFT: dx = -1; break;
+	case Data::DIR_RIGHT: dx = 1; break;
+	default:
+		writeString("NO DOOR THERE!\n");
+		return true;
+	}
+
+	int x = sg._mapX + dx, y = sg._mapY + dy;
+	if (x < 0 || x >= Data::MAP_WIDTH || y < 0 || y >= Data::MAP_HEIGHT ||
+			_G(map).tileAt(x, y) != Data::TILE_I_DOOR) {
+		writeString("NO DOOR THERE!\n");
+		return true;
+	}
+
+	if (sg._keys == 0) {
+		writeString("NO KEYS THAT FIT!\n");
+		return true;
+	}
+
+	--sg._keys;
+	// The door tile is replaced by whatever tile the player is currently
+	// standing on - matches the original exactly, though it's an odd way
+	// to clear a door; worth confirming visually during playtest
+	_G(map)._tiles[y][x] = _G(map).tileAt(sg._mapX, sg._mapY);
+	writeString("UNLOCKED!\n");
+	return true;
+}
+
+bool CityCastleLogic::offer(Data::Direction dir) {
+	if (dir == Data::DIR_UNSPECIFIED) {
+		_directionPurpose = DirectionPurpose::OFFER;
+		g_engine->addView("Direction");
+		return false;
+	}
+
+	Data::Savegame &sg = _G(savegame);
+	int dx = 0, dy = 0;
+	switch (dir) {
+	case Data::DIR_UP: dy = -1; break;
+	case Data::DIR_DOWN: dy = 1; break;
+	case Data::DIR_LEFT: dx = -1; break;
+	case Data::DIR_RIGHT: dx = 1; break;
+	default: break;
+	}
+
+	int x = sg._mapX + dx, y = sg._mapY + dy;
+	int slot = (x >= 0 && x < Data::MAP_WIDTH && y >= 0 && y < Data::MAP_HEIGHT) ?
+		findTargetMonster(x, y) : -1;
+
+	if (slot < 0) {
+		writeString("OFFER TO WHOM?\n");
+		return true;
+	}
+
+	_offerTargetSlot = slot;
+	writeString("HOW MUCH (*100)? ");
+	g_engine->addView("OfferGold");
+	return false;
+}
+
+void CityCastleLogic::completeOffer(int goldHundreds) {
+	Data::Savegame &sg = _G(savegame);
+	if (!trySpendGold(goldHundreds * 100)) {
+		resumeTurn();
+		return;
+	}
+
+	Data::MapMonsters &monsters = _G(map)._monsters;
+	byte flag = monsters.isActive(_offerTargetSlot) ? monsters._offerFlag[_offerTargetSlot] : 0;
+	bool wrongMap = !(sg._mapNum2 == 2 && sg._mapNum1 == 3);
+
+	if ((int8)flag >= 0 || wrongMap) {
+		writeString("THANK YOU VERY MUCH!\n");
+		resumeTurn();
+		return;
+	}
+
+	switch (flag) {
+	case 0x81:
+		if (goldHundreds < 5) {
+			writeString("THANK YOU VERY MUCH!\n");
+		} else {
+			writeString("ENILNO IS YOURS!\n");
+			sg._enilnoOwned = true;
+		}
+		break;
+
+	case 0x82:
+		if (goldHundreds < 5) {
+			writeString("THANK YOU VERY MUCH!\n");
+		} else if (!sg._ringQuestFlag) {
+			writeString("EARN THE RING!\n");
+		} else {
+			writeString("THE RING IS YOURS!\n");
+			++sg._items[Data::ITEM_RING];
+		}
+		break;
+
+	case 0x83: {
+		int idx = 1 + (randByte() & 7);
+		++sg._offerRewardItems[idx];
+		writeString("HERE TAKE THIS!\n");
+		break;
+	}
+
+	default:
+		if ((randByte() & 7) >= 6) {
+			writeString("THANK YOU VERY MUCH!\n");
+		} else {
+			int16 *attrs[6] = {
+				&sg._strength, &sg._agility, &sg._stamina,
+				&sg._charisma, &sg._wisdom, &sg._intelligence
+			};
+			*attrs[randByte() % 6] += 4 * goldHundreds;
+			writeString("ALAKAZAM!\n");
+		}
+		break;
+	}
+
+	resumeTurn();
+}
+
+bool CityCastleLogic::tithe() {
+	Data::Savegame &sg = _G(savegame);
+	if (sg._class != Data::CLASS_CLERIC) {
+		writeString(" YOU ARE NOT A CLERIC!\n");
+		return true;
+	}
+
+	writeString("WELCOME %s\n", sg._name);
+	writeString("FIRST MY 50 G.P. TRIBUTE!\n");
+	if (!trySpendGold(50))
+		return true;
+
+	int heal = (sg._hp < 50) ? 3 : (sg._hp < 75) ? 2 : (sg._hp < 99) ? 1 : 0;
+	sg._hp += heal;
+	writeString("AND FOR IT I RAISE THEE %d\n", heal);
+	return true;
+}
+
+bool CityCastleLogic::openShopForCurrentQuadrant() {
+	Data::Savegame &sg = _G(savegame);
+	bool top = sg._mapY < 32;
+	bool left = sg._mapX < 32;
+	bool isTown = sg._mapNum2 == 2;
+
+	if (top && left) {
+		if (isTown) {
+			g_engine->addView("WeaponShop");
+			return false;
+		}
+		writeString("A HOODED FIGURE OFFERS A CLUE FOR GOLD...\n");
+		return true;
+	}
+
+	if (!top && left) {
+		if (isTown) {
+			writeString("WELCOME TO THE PUB!\n");
+			return true;
+		}
+		g_engine->addView("WizardSpellShop");
+		return false;
+	}
+
+	if (top) { // top-right
+		if (isTown) {
+			g_engine->addView("ArmorShop");
+			return false;
+		}
+		writeString("PER 100, WANT ONE? ");
+		if (!trySpendGold(sg.computeItemPrice(3)))
+			return true;
+		++sg._food;
+		writeString("\nOK!\n");
+		return true;
+	}
+
+	// bottom-right
+	if (isTown) {
+		writeString("RIDE SWIFTLY!\n");
+		trySpendGold(sg.computeItemPrice(4));
+		return true;
+	}
+	if (sg._class != Data::CLASS_CLERIC) {
+		writeString(" YOU ARE NOT A CLERIC!\n");
+		return true;
+	}
+	g_engine->addView("ClericSpellShop");
+	return false;
+}
+
+bool CityCastleLogic::transact(Data::Direction dir) {
+	if (dir == Data::DIR_UNSPECIFIED) {
+		_directionPurpose = DirectionPurpose::TRANSACT;
+		g_engine->addView("Direction");
+		return false;
+	}
+
+	Data::Savegame &sg = _G(savegame);
+	int dx = 0, dy = 0;
+	switch (dir) {
+	case Data::DIR_UP: dy = -1; break;
+	case Data::DIR_DOWN: dy = 1; break;
+	case Data::DIR_LEFT: dx = -1; break;
+	case Data::DIR_RIGHT: dx = 1; break;
+	default: break;
+	}
+
+	int x1 = sg._mapX + dx, y1 = sg._mapY + dy;
+	int slot = (x1 >= 0 && x1 < Data::MAP_WIDTH && y1 >= 0 && y1 < Data::MAP_HEIGHT) ?
+		findTargetMonster(x1, y1) : -1;
+
+	if (slot > 0) {
+		Data::MapMonsters &monsters = _G(map)._monsters;
+		if ((int8)monsters._offerFlag[slot] < 0)
+			return openShopForCurrentQuadrant();
+
+		switch (monsters.tileType(slot)) {
+		case Data::TILE_TITHE_ALTAR:
+			return tithe();
+		case Data::TILE_GUARD:
+			writeString("A GUARD SAYS: PAY YOUR TAXES!\n");
+			return true;
+		case Data::TILE_JESTER:
+			writeString("A JESTER SINGS: HO HO HO!\n");
+			return true;
+		case Data::TILE_SHOPKEEP:
+			writeString("A MERCHANT SAYS: WILL YOU BUY MY APPLES?\n");
+			return true;
+		case Data::TILE_FIGHTER:
+			writeString("A FIGHTER SAYS: UGH, ME TOUGH!\n");
+			return true;
+		case Data::TILE_CLERIC:
+			writeString("A CLERIC SAYS: BELIEVE!\n");
+			return true;
+		case Data::TILE_MAGE:
+			writeString("A WIZARD SAYS: HEX-E-POO-HEX-ON-YOU!\n");
+			return true;
+		case Data::TILE_THIEF:
+			writeString("A THIEF SAYS: PSST, WANNA BUY A WATCH?\n");
+			return true;
+		default:
+			writeString("FUNNY, NO RESPONSE!\n");
+			return true;
+		}
+	}
+
+	// No monster in that direction - counter-tile probe fallback
+	Data::TileId t1 = (x1 >= 0 && x1 < Data::MAP_WIDTH && y1 >= 0 && y1 < Data::MAP_HEIGHT) ?
+		_G(map).tileAt(x1, y1) : Data::TILE_WATER;
+	if (t1 < Data::TILE_A && t1 != Data::TILE_EMPTY_COUNTER) {
+		writeString("FUNNY, NO RESPONSE!\n");
+		return true;
+	}
+
+	int x2 = sg._mapX + dx * 2, y2 = sg._mapY + dy * 2;
+	Data::TileId t2 = (x2 >= 0 && x2 < Data::MAP_WIDTH && y2 >= 0 && y2 < Data::MAP_HEIGHT) ?
+		_G(map).tileAt(x2, y2) : Data::TILE_WATER;
+	if (t2 != Data::TILE_SHOPKEEP) {
+		writeString("FUNNY, NO RESPONSE!\n");
+		return true;
+	}
+
+	return openShopForCurrentQuadrant();
+}
+
+} // namespace Logic
+} // namespace Ultima2
+} // namespace Ultima
diff --git a/engines/ultima/ultima2/logic/city_castle_logic.h b/engines/ultima/ultima2/logic/city_castle_logic.h
new file mode 100644
index 00000000000..c6972900248
--- /dev/null
+++ b/engines/ultima/ultima2/logic/city_castle_logic.h
@@ -0,0 +1,79 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef ULTIMA2_LOGIC_CITY_CASTLE_LOGIC_H
+#define ULTIMA2_LOGIC_CITY_CASTLE_LOGIC_H
+
+#include "ultima/ultima2/logic/overworld_logic.h"
+
+namespace Ultima {
+namespace Ultima2 {
+namespace Logic {
+
+/**
+ * Command handling while inside a village, town, or castle. Reuses
+ * OverworldLogic's terrain/monster-targeting helpers and combat (attack
+ * works identically in a settlement per the original), overriding only
+ * what genuinely differs: movement (edge-exit instead of wraparound),
+ * monster AI (offerFlag-driven instead of always-hostile, no spawning),
+ * and the settlement-only commands.
+ */
+class CityCastleLogic : public OverworldLogic {
+private:
+	// Slot targeted by a pending offer(), remembered between the Direction
+	// interaction resolving and the OfferGold interaction completing
+	int _offerTargetSlot = -1;
+
+	/**
+	 * Returns to the overworld position saved when this local map was entered
+	 */
+	void exitToOverworld();
+
+	/**
+	 * Opens the shop/NPC interaction appropriate for the player's current
+	 * map quadrant and map type (village/castle vs. town)
+	 */
+	bool openShopForCurrentQuadrant();
+
+	/**
+	 * Handles talking to a Cleric tithe altar
+	 */
+	bool tithe();
+
+protected:
+	void updateCreatures() override;
+
+public:
+	~CityCastleLogic() override {}
+
+	bool move(Data::Direction dir) override;
+	bool steal(Data::Direction dir) override;
+	bool unlock(Data::Direction dir) override;
+	bool offer(Data::Direction dir) override;
+	bool transact(Data::Direction dir) override;
+	void completeOffer(int goldHundreds) override;
+};
+
+} // namespace Logic
+} // namespace Ultima2
+} // namespace Ultima
+
+#endif
diff --git a/engines/ultima/ultima2/logic/logic.cpp b/engines/ultima/ultima2/logic/logic.cpp
index 28380d02437..cfeb1b59327 100644
--- a/engines/ultima/ultima2/logic/logic.cpp
+++ b/engines/ultima/ultima2/logic/logic.cpp
@@ -68,8 +68,17 @@ void Logic::playerDied() {
 	g_engine->replaceView(g_engine->findView("Title"), true);
 }
 
-void Logic::alertTownGuards() {
-	// Only meaningful once towns/castles exist
+void Logic::alertTownGuards(int extraSlot) {
+	Data::Savegame &sg = _G(savegame);
+	if (sg._mapNum2 == 0)
+		return;
+
+	Data::MapMonsters &monsters = _G(map)._monsters;
+	for (int slot = 0; slot <= 7; ++slot)
+		monsters._offerFlag[slot] = 1;
+
+	if (extraSlot >= 0)
+		monsters._offerFlag[extraSlot] = 1;
 }
 
 int Logic::getRandomNumber(int minNumber, int maxNumber) {
@@ -220,6 +229,37 @@ void Logic::action(int action) {
 	}
 }
 
+void Logic::resolveDirection(Data::Direction dir) {
+	switch (_directionPurpose) {
+	case DirectionPurpose::ATTACK:
+		attack(dir);
+		break;
+	case DirectionPurpose::STEAL:
+		steal(dir);
+		break;
+	case DirectionPurpose::UNLOCK:
+		unlock(dir);
+		break;
+	case DirectionPurpose::OFFER:
+		offer(dir);
+		break;
+	case DirectionPurpose::TRANSACT:
+		transact(dir);
+		break;
+	}
+}
+
+bool Logic::trySpendGold(int amount) {
+	Data::Savegame &sg = _G(savegame);
+	if (sg._gold < amount) {
+		writeString("YOU DONT HAVE THAT MUCH!\n");
+		return false;
+	}
+
+	sg._gold -= amount;
+	return true;
+}
+
 void Logic::keypress(const Shared::Messages::KeypressMessage &msg) {
 	writeString("Huh?\n");
 	endOfTurn();
@@ -257,7 +297,35 @@ bool Logic::fire() {
 }
 
 bool Logic::get() {
-	writeString("Get?\n");
+	Data::Savegame &sg = _G(savegame);
+
+	if (sg._mapNum2 >= 4) {
+		// Dungeon/tower chest handling - not yet implemented
+		writeString("Get?\n");
+		return true;
+	}
+
+	Data::TileId tile = _G(map).tileAt(sg._mapX, sg._mapY);
+	if (tile == Data::TILE_SWORD) {
+		int r = randByte() & 7;
+		if (r == 0)
+			writeString("EMPTY!\n");
+		else {
+			++sg._weaponOwned[r];
+			writeString("GOT %s!\n", Data::WEAPON_NAMES[r]);
+		}
+	} else if (tile == Data::TILE_SHIELD) {
+		int r = randByte() & 3;
+		if (r == 0)
+			writeString("EMPTY!\n");
+		else {
+			++sg._armorOwned[r];
+			writeString("GOT %s!\n", Data::ARMOR_NAMES[r]);
+		}
+	} else {
+		writeString("GET WHAT?\n");
+	}
+
 	return true;
 }
 
@@ -304,11 +372,20 @@ bool Logic::magic() {
 }
 
 bool Logic::negateTime() {
-	writeString("Negate Time?\n");
+	Data::Savegame &sg = _G(savegame);
+
+	if (sg._items[Data::ITEM_STRANGE_COIN] == 0) {
+		writeString(" HOW?  YOU'RE NOT EINSTEIN\n");
+		return true;
+	}
+
+	--sg._items[Data::ITEM_STRANGE_COIN];
+	writeString("YOU RUB A COIN...\n");
+	sg._negateTimeTurns = 20;
 	return true;
 }
 
-bool Logic::offer() {
+bool Logic::offer(Data::Direction dir) {
 	writeString("Offer?\n");
 	return true;
 }
@@ -328,17 +405,17 @@ bool Logic::ready() {
 	return false;
 }
 
-bool Logic::steal() {
+bool Logic::steal(Data::Direction dir) {
 	writeString("Steal?\n");
 	return true;
 }
 
-bool Logic::transact() {
+bool Logic::transact(Data::Direction dir) {
 	writeString("Transact?\n");
 	return true;
 }
 
-bool Logic::unlock() {
+bool Logic::unlock(Data::Direction dir) {
 	writeString("Unlock?\n");
 	return true;
 }
diff --git a/engines/ultima/ultima2/logic/logic.h b/engines/ultima/ultima2/logic/logic.h
index 14016672189..86596e3ccf4 100644
--- a/engines/ultima/ultima2/logic/logic.h
+++ b/engines/ultima/ultima2/logic/logic.h
@@ -37,6 +37,10 @@ namespace Logic {
  */
 class Logic {
 protected:
+	// Which command is waiting on the Direction interaction's result
+	enum class DirectionPurpose { ATTACK, STEAL, UNLOCK, OFFER, TRANSACT };
+	DirectionPurpose _directionPurpose = DirectionPurpose::ATTACK;
+
 	/**
 	 * Dispatches some text to be shown in the Commands window
 	 */
@@ -55,11 +59,11 @@ protected:
 	void playerDied();
 
 	/**
-	 * Alerts nearby town guards after an attack or theft. A no-op outside
-	 * of towns/castles/villages (_mapNum2 == 0), which is the only mode
-	 * implemented so far
+	 * Alerts nearby town guards (slots 0-7, plus optionally the specific
+	 * slot just interacted with) after an attack or theft. A no-op on the
+	 * overworld (_mapNum2 == 0)
 	 */
-	void alertTownGuards();
+	void alertTownGuards(int extraSlot = -1);
 
 	/**
 	 * Signal the map to redraw
@@ -127,13 +131,9 @@ protected:
 	virtual bool launch();
 	virtual bool magic();
 	virtual bool negateTime();
-	virtual bool offer();
 	virtual bool pass();
 	virtual bool quit();
 	virtual bool ready();
-	virtual bool steal();
-	virtual bool transact();
-	virtual bool unlock();
 	virtual bool view();
 	virtual bool wearArmor();
 	virtual bool xit();
@@ -150,12 +150,29 @@ public:
 	virtual void entering() {
 	}
 
+	/*--- Commands needing a direction first read via the Direction
+	 * interaction. Each is called once with dir == DIR_UNSPECIFIED (from
+	 * action()'s dispatch) to kick off the prompt, then again with the
+	 * resolved direction once chosen - public since Direction calls back
+	 * into these directly ---*/
+
+	virtual bool attack(Data::Direction dir = Data::DIR_UNSPECIFIED);
+	virtual bool steal(Data::Direction dir = Data::DIR_UNSPECIFIED);
+	virtual bool unlock(Data::Direction dir = Data::DIR_UNSPECIFIED);
+	virtual bool offer(Data::Direction dir = Data::DIR_UNSPECIFIED);
+	virtual bool transact(Data::Direction dir = Data::DIR_UNSPECIFIED);
+
 	/**
-	 * Attacks in the given direction, or - if unspecified - starts the
-	 * Direction interaction to prompt for one. Public since the Direction
-	 * interaction calls back into it directly once a direction is chosen
+	 * Called by the Direction interaction once a direction has been chosen,
+	 * dispatching to whichever command requested it (see _directionPurpose)
 	 */
-	virtual bool attack(Data::Direction dir = Data::DIR_UNSPECIFIED);
+	void resolveDirection(Data::Direction dir);
+
+	/**
+	 * Called once a digit has been chosen by the OfferGold interaction
+	 */
+	virtual void completeOffer(int goldHundreds) {
+	}
 
 	/**
 	 * Called once per game frame for any logic updates
@@ -171,6 +188,13 @@ public:
 		endOfTurn();
 		prompt();
 	}
+
+	/**
+	 * Attempts to deduct gold; prints a failure message and returns false
+	 * if the player can't afford it. Public since interactions (shop
+	 * purchases, offerings) call this directly
+	 */
+	bool trySpendGold(int amount);
 };
 
 } // namespace Logic
diff --git a/engines/ultima/ultima2/logic/overworld_logic.cpp b/engines/ultima/ultima2/logic/overworld_logic.cpp
index 91f3a4de517..da0d4ed6f40 100644
--- a/engines/ultima/ultima2/logic/overworld_logic.cpp
+++ b/engines/ultima/ultima2/logic/overworld_logic.cpp
@@ -318,6 +318,7 @@ bool OverworldLogic::attack(Data::Direction dir) {
 			return true;
 		}
 
+		_directionPurpose = DirectionPurpose::ATTACK;
 		g_engine->addView("Direction");
 		return false;
 	}
@@ -342,7 +343,7 @@ bool OverworldLogic::attack(Data::Direction dir) {
 	}
 
 	writeString("--HIT!!!\n");
-	alertTownGuards();
+	alertTownGuards(slot);
 
 	int dmg = (sg._readiedWeapon * 8 + sg._strength) >> 2;
 	Data::MapMonsters &monsters = _G(map)._monsters;
@@ -416,6 +417,55 @@ void OverworldLogic::killMonster(int slot) {
 	writeString("KILLED--GOLD+%d--EXP.+%d\n", goldAmt, expAmt);
 }
 
+void OverworldLogic::enterLocalMap(int mapNum2) {
+	Data::Savegame &sg = _G(savegame);
+	sg._overworldReturnX = sg._mapX;
+	sg._overworldReturnY = sg._mapY;
+	sg._mapX = 31;
+	sg._mapY = 62;
+	sg._mapNum2 = mapNum2;
+	_G(map).load(sg._mapNum1, sg._mapNum2);
+}
+
+bool OverworldLogic::enter() {
+	Data::Savegame &sg = _G(savegame);
+
+	if (sg._mapNum2 != 0) {
+		writeString(" WHAT?\n");
+		return true;
+	}
+
+	Data::TileId tile = _G(map).tileAt(sg._mapX, sg._mapY);
+	switch (tile) {
+	case Data::TILE_VILLAGE:
+		enterLocalMap(1);
+		return false;
+	case Data::TILE_TOWN:
+		enterLocalMap(2);
+		return false;
+	case Data::TILE_CASTLE:
+		enterLocalMap(3);
+		return false;
+	case Data::TILE_TOWER:
+	case Data::TILE_DUNGEON_ENTRANCE:
+		// Dungeon/tower first-person rendering isn't implemented yet
+		writeString("NOT YET IMPLEMENTED\n");
+		return true;
+	case Data::TILE_SIGNPOST: {
+		static const char *const ERA_TEXT[5] = {
+			"ANOS: LEGENDS!", "ANOS: 2112 A.D.", "ANOS: 9,000,000 B.C.",
+			"ANOS: 1423 B.C.", "ANOS: 1990 A.D."
+		};
+		int era = (sg._mapNum1 < 5) ? sg._mapNum1 : 4;
+		writeString("%s\n", ERA_TEXT[era]);
+		return true;
+	}
+	default:
+		writeString(" WHAT?\n");
+		return true;
+	}
+}
+
 } // namespace Logic
 } // namespace Ultima2
 } // namespace Ultima
diff --git a/engines/ultima/ultima2/logic/overworld_logic.h b/engines/ultima/ultima2/logic/overworld_logic.h
index e3e641aeb10..409c6ae0520 100644
--- a/engines/ultima/ultima2/logic/overworld_logic.h
+++ b/engines/ultima/ultima2/logic/overworld_logic.h
@@ -34,6 +34,19 @@ namespace Logic {
  */
 class OverworldLogic : public Logic {
 private:
+	/**
+	 * Rolls for and, on success, spawns a new monster in a free slot.
+	 * Overworld-only - CityCastleLogic doesn't spawn new monsters
+	 */
+	void trySpawnMonster();
+
+	/**
+	 * Stashes the current position as the overworld return point, then
+	 * loads the given local map type (1-3 for village/town/castle)
+	 */
+	void enterLocalMap(int mapNum2);
+
+protected:
 	/**
 	 * Returns true if the given tile can be walked onto on foot
 	 */
@@ -68,12 +81,6 @@ private:
 	 */
 	void killMonster(int slot);
 
-	/**
-	 * Rolls for and, on success, spawns a new monster in a free slot
-	 */
-	void trySpawnMonster();
-
-protected:
 	void updateCreatures() override;
 
 public:
@@ -82,6 +89,7 @@ public:
 	bool move(Data::Direction dir) override;
 	bool attack(Data::Direction dir) override;
 	bool fire() override;
+	bool enter() override;
 };
 
 } // namespace Logic
diff --git a/engines/ultima/ultima2/views/interactions/direction.cpp b/engines/ultima/ultima2/views/interactions/direction.cpp
index 23c3cbda74b..abd2e2e0c58 100644
--- a/engines/ultima/ultima2/views/interactions/direction.cpp
+++ b/engines/ultima/ultima2/views/interactions/direction.cpp
@@ -48,7 +48,7 @@ bool Direction::msgKeypress(const KeypressMessage &msg) {
 	}
 
 	close();
-	_G(logic)->attack(dir);
+	_G(logic)->resolveDirection(dir);
 	return true;
 }
 
diff --git a/engines/ultima/ultima2/views/interactions/offer_gold.cpp b/engines/ultima/ultima2/views/interactions/offer_gold.cpp
new file mode 100644
index 00000000000..af27d134e2f
--- /dev/null
+++ b/engines/ultima/ultima2/views/interactions/offer_gold.cpp
@@ -0,0 +1,48 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "ultima/ultima2/views/interactions/offer_gold.h"
+#include "ultima/ultima2/ultima2.h"
+
+namespace Ultima {
+namespace Ultima2 {
+namespace Views {
+namespace Interactions {
+
+OfferGold::OfferGold() : Interaction("OfferGold") {
+}
+
+bool OfferGold::msgKeypress(const KeypressMessage &msg) {
+	if (msg.ascii < '0' || msg.ascii > '9')
+		return true;
+
+	int digit = msg.ascii - '0';
+	writeString("%d\n", digit);
+
+	close();
+	_G(logic)->completeOffer(digit);
+	return true;
+}
+
+} // namespace Interactions
+} // namespace Views
+} // namespace Ultima2
+} // namespace Ultima
diff --git a/engines/ultima/ultima2/views/interactions/offer_gold.h b/engines/ultima/ultima2/views/interactions/offer_gold.h
new file mode 100644
index 00000000000..2b64ffcdb58
--- /dev/null
+++ b/engines/ultima/ultima2/views/interactions/offer_gold.h
@@ -0,0 +1,49 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef ULTIMA2_VIEWS_INTERACTIONS_OFFER_GOLD_H
+#define ULTIMA2_VIEWS_INTERACTIONS_OFFER_GOLD_H
+
+#include "ultima/ultima2/views/interactions/interaction.h"
+
+namespace Ultima {
+namespace Ultima2 {
+namespace Views {
+namespace Interactions {
+
+/**
+ * Reads a single digit (gold offered = digit*100) for the "offer" command,
+ * then hands it back to the active Logic's completeOffer()
+ */
+class OfferGold : public Interaction {
+public:
+	OfferGold();
+	~OfferGold() override {}
+
+	bool msgKeypress(const KeypressMessage &msg) override;
+};
+
+} // namespace Interactions
+} // namespace Views
+} // namespace Ultima2
+} // namespace Ultima
+
+#endif
diff --git a/engines/ultima/ultima2/views/interactions/shop.cpp b/engines/ultima/ultima2/views/interactions/shop.cpp
new file mode 100644
index 00000000000..f64e1c337ba
--- /dev/null
+++ b/engines/ultima/ultima2/views/interactions/shop.cpp
@@ -0,0 +1,105 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "ultima/ultima2/views/interactions/shop.h"
+#include "ultima/ultima2/ultima2.h"
+
+namespace Ultima {
+namespace Ultima2 {
+namespace Views {
+namespace Interactions {
+
+Shop::Shop(Kind kind, const Common::String &name) : Interaction(name), _kind(kind) {
+}
+
+int Shop::priceIndexForDigit(int digit) const {
+	switch (_kind) {
+	case ARMOR:
+		return digit * 2;
+	case SPELL_WIZARD:
+		return (digit >= 4) ? digit + 3 : digit;
+	default:
+		return digit;
+	}
+}
+
+bool Shop::msgFocus(const FocusMessage &msg) {
+	switch (_kind) {
+	case WEAPON:
+		writeString("WEAPON SHOPPE\n1-DA,2-MA,3-AX,4-BO,5-SW,6-GR,7-LI,8-PH\nWHICH? ");
+		break;
+	case ARMOR:
+		writeString("ARMOUR SHOPPE\n1-CLOTH,2-LEATHER,3-CHAIN,\n4-PLATE,5-REFLECT,6-POWER\nWHICH? ");
+		break;
+	case SPELL_CLERIC:
+		writeString("MAGIC SHOPPE\n1-LIGHT,2-L.D.,3-L.U.,\n4-PASS,5-SURFACE,6-PRAYER\nWHICH? ");
+		break;
+	case SPELL_WIZARD:
+		writeString("MAGIC SHOPPE\n1-LIGHT,2-L.D.,3-L.U.,\n4-M.M.,5-BLINK,6-KILL\nWHICH? ");
+		break;
+	}
+
+	return Interaction::msgFocus(msg);
+}
+
+bool Shop::msgKeypress(const KeypressMessage &msg) {
+	if (msg.ascii < '0' || msg.ascii > '9')
+		return true;
+
+	int digit = msg.ascii - '0';
+	close();
+
+	if (digit != 0 && digit <= 6) {
+		Data::Savegame &sg = _G(savegame);
+		int price = sg.computeItemPrice(priceIndexForDigit(digit));
+
+		if (_G(logic)->trySpendGold(price)) {
+			switch (_kind) {
+			case WEAPON:
+				++sg._weaponOwned[digit];
+				writeString("%s READY.\n", Data::WEAPON_NAMES[digit]);
+				break;
+			case ARMOR:
+				++sg._armorOwned[digit];
+				writeString("%s READY.\n", Data::ARMOR_NAMES[digit]);
+				break;
+			case SPELL_CLERIC:
+				sg._spellCharges[digit] += 5;
+				writeString("%s CHARGED.\n", Data::SPELL_NAMES[digit]);
+				break;
+			case SPELL_WIZARD: {
+				int spellIdx = (digit >= 4) ? digit + 3 : digit;
+				sg._spellCharges[spellIdx] += 5;
+				writeString("%s CHARGED.\n", Data::SPELL_NAMES[spellIdx]);
+				break;
+			}
+			}
+		}
+	}
+
+	_G(logic)->resumeTurn();
+	return true;
+}
+
+} // namespace Interactions
+} // namespace Views
+} // namespace Ultima2
+} // namespace Ultima
diff --git a/engines/ultima/ultima2/views/interactions/shop.h b/engines/ultima/ultima2/views/interactions/shop.h
new file mode 100644
index 00000000000..527026d616c
--- /dev/null
+++ b/engines/ultima/ultima2/views/interactions/shop.h
@@ -0,0 +1,61 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef ULTIMA2_VIEWS_INTERACTIONS_SHOP_H
+#define ULTIMA2_VIEWS_INTERACTIONS_SHOP_H
+
+#include "ultima/ultima2/views/interactions/interaction.h"
+
+namespace Ultima {
+namespace Ultima2 {
+namespace Views {
+namespace Interactions {
+
+/**
+ * A generic numbered-menu shop: prints an item list, reads a digit, and
+ * on a nonzero digit computes the price (Savegame::computeItemPrice),
+ * charges gold, and grants the item. Covers the weapon/armour/cleric-
+ * spell/wizard-spell shoppes, which all share this exact shape and only
+ * differ in their item list, price-index mapping, and target array
+ */
+class Shop : public Interaction {
+public:
+	enum Kind { WEAPON, ARMOR, SPELL_CLERIC, SPELL_WIZARD };
+
+private:
+	Kind _kind;
+
+	int priceIndexForDigit(int digit) const;
+
+public:
+	Shop(Kind kind, const Common::String &name);
+	~Shop() override {}
+
+	bool msgFocus(const FocusMessage &msg) override;
+	bool msgKeypress(const KeypressMessage &msg) override;
+};
+
+} // namespace Interactions
+} // namespace Views
+} // namespace Ultima2
+} // namespace Ultima
+
+#endif
diff --git a/engines/ultima/ultima2/views/location_map.cpp b/engines/ultima/ultima2/views/location_map.cpp
new file mode 100644
index 00000000000..0d0b50301ac
--- /dev/null
+++ b/engines/ultima/ultima2/views/location_map.cpp
@@ -0,0 +1,124 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "common/system.h"
+#include "graphics/paletteman.h"
+#include "ultima/ultima2/data/data.h"
+#include "ultima/ultima2/views/location_map.h"
+#include "ultima/ultima2/ultima2.h"
+#include "ultima/ultima2/metaengine.h"
+
+namespace Ultima {
+namespace Ultima2 {
+namespace Views {
+
+constexpr int TILE_WIDTH = 16;
+constexpr int TILE_HEIGHT = 16;
+constexpr int VIEWPORT_WIDTH = 20;
+constexpr int VIEWPORT_HEIGHT = 10;
+constexpr int PLAYER_VIEWPORT_X = 9;
+constexpr int PLAYER_VIEWPORT_Y = 5;
+
+LocationMap::LocationMap() : Map("LocationMap") {
+	Data::loadTiles(_tiles);
+	Data::loadAttackSprite(_attackSprite);
+}
+
+LocationMap::~LocationMap() {
+	for (int i = 0; i < Data::TILE_COUNT; ++i)
+		_tiles[i].free();
+	_attackSprite.free();
+}
+
+bool LocationMap::msgFocus(const FocusMessage &msg) {
+	MetaEngine::setKeybindingMode(KBMODE_GAMEPLAY);
+	g_system->getPaletteManager()->setPalette(Graphics::Palette(Data::CGA_PALETTE1, 4));
+	return Map::msgFocus(msg);
+}
+
+bool LocationMap::msgUnfocus(const UnfocusMessage &msg) {
+	MetaEngine::setKeybindingMode(KBMODE_MINIMAL);
+	return Map::msgUnfocus(msg);
+}
+
+bool LocationMap::msgAttackTile(const AttackTileMessage &msg) {
+	Data::Savegame &sg = _G(savegame);
+	int mapLeft = sg._mapX - PLAYER_VIEWPORT_X;
+	int mapTop = sg._mapY - PLAYER_VIEWPORT_Y;
+	int ox = msg._x - mapLeft;
+	int oy = msg._y - mapTop;
+
+	if (ox < 0 || ox >= VIEWPORT_WIDTH || oy < 0 || oy >= VIEWPORT_HEIGHT)
+		return true;
+
+	Common::Point pt(ox * TILE_WIDTH, oy * TILE_HEIGHT);
+	auto s = getSurface();
+
+	s.xorBlitFrom(_attackSprite, pt);
+	g_engine->updateScreen();
+	g_engine->pauseMillis(80);
+
+	s.xorBlitFrom(_attackSprite, pt);
+	g_engine->updateScreen();
+
+	return true;
+}
+
+void LocationMap::draw() {
+	auto s = getSurface();
+	s.clear();
+
+	Data::Savegame &sg = _G(savegame);
+	Data::MapMonsters &monsters = _G(map)._monsters;
+	int mapLeft = sg._mapX - PLAYER_VIEWPORT_X;
+	int mapTop = sg._mapY - PLAYER_VIEWPORT_Y;
+
+	for (int oy = 0; oy < VIEWPORT_HEIGHT; ++oy) {
+		for (int ox = 0; ox < VIEWPORT_WIDTH; ++ox) {
+			int x = mapLeft + ox, y = mapTop + oy;
+			Data::TileId tileId;
+
+			if (x < 0 || x >= Data::MAP_WIDTH || y < 0 || y >= Data::MAP_HEIGHT) {
+				// Local maps don't wrap - anything off the edge shows as
+				// Mountain, giving villages/towns/castles a walled border
+				tileId = Data::TILE_MOUNTAIN;
+			} else {
+				tileId = _G(map).tileAt(x, y);
+
+				for (int slot = 1; slot <= 31; ++slot) {
+					if (monsters.isActive(slot) && monsters._mapX[slot] == x && monsters._mapY[slot] == y) {
+						tileId = monsters.tileType(slot);
+						break;
+					}
+				}
+			}
+
+			if (ox == PLAYER_VIEWPORT_X && oy == PLAYER_VIEWPORT_Y)
+				tileId = (Data::TileId)(Data::TILE_FIGHTER + sg._class);
+
+			s.blitFrom(_tiles[tileId], Common::Point(ox * TILE_WIDTH, oy * TILE_HEIGHT));
+		}
+	}
+}
+
+} // namespace Views
+} // namespace Ultima2
+} // namespace Ultima
diff --git a/engines/ultima/ultima2/views/location_map.h b/engines/ultima/ultima2/views/location_map.h
new file mode 100644
index 00000000000..d512b22a405
--- /dev/null
+++ b/engines/ultima/ultima2/views/location_map.h
@@ -0,0 +1,57 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef ULTIMA2_VIEWS_LOCATION_MAP_H
+#define ULTIMA2_VIEWS_LOCATION_MAP_H
+
+#include "ultima/ultima2/views/map.h"
+#include "ultima/ultima2/data/tiles.h"
+
+namespace Ultima {
+namespace Ultima2 {
+namespace Views {
+
+/**
+ * Renders the 20x10-tile viewport centered on the player for a village,
+ * town, or castle map. Like OverworldMap, but cells outside the map's
+ * 0-63 bounds show as Mountain (there's no wraparound - walking off the
+ * edge instead exits back to the overworld, see CityCastleLogic::move)
+ */
+class LocationMap : public Map {
+private:
+	Graphics::Surface _tiles[Data::TILE_COUNT];
+	Graphics::ManagedSurface _attackSprite;
+
+public:
+	LocationMap();
+	~LocationMap() override;
+
+	bool msgFocus(const FocusMessage &msg) override;
+	bool msgUnfocus(const UnfocusMessage &msg) override;
+	bool msgAttackTile(const AttackTileMessage &msg) override;
+	void draw() override;
+};
+
+} // namespace Views
+} // namespace Ultima2
+} // namespace Ultima
+
+#endif
diff --git a/engines/ultima/ultima2/views/overworld_map.cpp b/engines/ultima/ultima2/views/overworld_map.cpp
index 87d048a72c7..8182c7694a9 100644
--- a/engines/ultima/ultima2/views/overworld_map.cpp
+++ b/engines/ultima/ultima2/views/overworld_map.cpp
@@ -21,10 +21,11 @@
 
 #include "common/system.h"
 #include "graphics/paletteman.h"
+#include "ultima/ultima2/data/data.h"
+#include "ultima/ultima2/gfx/pic_decoder.h"
 #include "ultima/ultima2/views/overworld_map.h"
 #include "ultima/ultima2/ultima2.h"
 #include "ultima/ultima2/metaengine.h"
-#include "ultima/ultima2/gfx/pic_decoder.h"
 
 namespace Ultima {
 namespace Ultima2 {
@@ -50,7 +51,7 @@ OverworldMap::~OverworldMap() {
 
 bool OverworldMap::msgFocus(const FocusMessage &msg) {
 	MetaEngine::setKeybindingMode(KBMODE_GAMEPLAY);
-	g_system->getPaletteManager()->setPalette(Graphics::Palette(Gfx::CGA_PALETTE1, 4));
+	g_system->getPaletteManager()->setPalette(Graphics::Palette(Data::CGA_PALETTE1, 4));
 	return Map::msgFocus(msg);
 }
 
diff --git a/engines/ultima/ultima2/views/views.h b/engines/ultima/ultima2/views/views.h
index 534506c7cad..f83d05ff085 100644
--- a/engines/ultima/ultima2/views/views.h
+++ b/engines/ultima/ultima2/views/views.h
@@ -25,14 +25,17 @@
 #include "ultima/shared/engine/events.h"
 #include "ultima/ultima2/views/create_character.h"
 #include "ultima/ultima2/views/game.h"
+#include "ultima/ultima2/views/location_map.h"
 #include "ultima/ultima2/views/overworld_map.h"
 #include "ultima/ultima2/views/startup.h"
 #include "ultima/ultima2/views/title.h"
 #include "ultima/ultima2/views/world_map_overview.h"
 #include "ultima/ultima2/views/zstats.h"
 #include "ultima/ultima2/views/interactions/direction.h"
+#include "ultima/ultima2/views/interactions/offer_gold.h"
 #include "ultima/ultima2/views/interactions/ready_spell.h"
 #include "ultima/ultima2/views/interactions/ready_weapon.h"
+#include "ultima/ultima2/views/interactions/shop.h"
 #include "ultima/ultima2/views/interactions/wear_armor.h"
 #include "ultima/ultima2/views/interactions/yell.h"
 
@@ -42,13 +45,19 @@ namespace Views {
 
 struct Views : public Shared::Views {
 	Interactions::Direction _direction;
+	Interactions::OfferGold _offerGold;
 	Interactions::ReadySpell _readySpell;
 	Interactions::ReadyWeapon _readyWeapon;
 	Interactions::WearArmor _wearArmor;
 	Interactions::Yell _yell;
+	Interactions::Shop _weaponShop{Interactions::Shop::WEAPON, "WeaponShop"};
+	Interactions::Shop _armorShop{Interactions::Shop::ARMOR, "ArmorShop"};
+	Interactions::Shop _clericSpellShop{Interactions::Shop::SPELL_CLERIC, "ClericSpellShop"};
+	Interactions::Shop _wizardSpellShop{Interactions::Shop::SPELL_WIZARD, "WizardSpellShop"};
 
 	CreateCharacter _createCharacter;
 	Game _game;
+	LocationMap _locationMap;
 	OverworldMap _overworldMap;
 	Startup _startup;
 	Title _title;


Commit: 41d7917cfaa26dad9a2e16b411a00de6c172ed4d
    https://github.com/scummvm/scummvm/commit/41d7917cfaa26dad9a2e16b411a00de6c172ed4d
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:40:55+11:00

Commit Message:
ULTIMA: ULTIMA2: Add locations/intangible/hp/food/gold debug console commands

Changed paths:
    engines/ultima/ultima2/console.cpp
    engines/ultima/ultima2/console.h
    engines/ultima/ultima2/logic/city_castle_logic.cpp
    engines/ultima/ultima2/logic/overworld_logic.cpp
    engines/ultima/ultima2/ultima2.h


diff --git a/engines/ultima/ultima2/console.cpp b/engines/ultima/ultima2/console.cpp
index 1d6fd82a03c..43b4b4cb7b8 100644
--- a/engines/ultima/ultima2/console.cpp
+++ b/engines/ultima/ultima2/console.cpp
@@ -30,6 +30,11 @@ Console::Console() : GUI::Debugger() {
 	registerCmd("map", WRAP_METHOD(Console, cmdMap));
 	registerCmd("tiles", WRAP_METHOD(Console, cmdTiles));
 	registerCmd("teleport", WRAP_METHOD(Console, cmdTeleport));
+	registerCmd("locations", WRAP_METHOD(Console, cmdLocations));
+	registerCmd("intangible", WRAP_METHOD(Console, cmdIntangible));
+	registerCmd("hp", WRAP_METHOD(Console, cmdHP));
+	registerCmd("food", WRAP_METHOD(Console, cmdFood));
+	registerCmd("gold", WRAP_METHOD(Console, cmdGold));
 }
 
 Console::~Console() {
@@ -130,5 +135,85 @@ bool Console::cmdTeleport(int argc, const char **argv) {
 	return true;
 }
 
+bool Console::cmdLocations(int argc, const char **argv) {
+	static const struct {
+		Data::TileId tile;
+		const char *name;
+	} LOCATION_TILES[] = {
+		{ Data::TILE_VILLAGE, "VILLAGE" },
+		{ Data::TILE_TOWN, "TOWN" },
+		{ Data::TILE_TOWER, "TOWER" },
+		{ Data::TILE_CASTLE, "CASTLE" },
+		{ Data::TILE_DUNGEON_ENTRANCE, "DUNGEON" },
+		{ Data::TILE_SIGNPOST, "SIGNPOST" }
+	};
+
+	Common::Array<Common::Point> positions;
+	Common::Array<const char *> names;
+	for (int y = 0; y < Data::MAP_HEIGHT; ++y) {
+		for (int x = 0; x < Data::MAP_WIDTH; ++x) {
+			Data::TileId tile = _G(map).tileAt(x, y);
+			for (const auto &entry : LOCATION_TILES) {
+				if (tile == entry.tile) {
+					positions.push_back(Common::Point(x, y));
+					names.push_back(entry.name);
+					break;
+				}
+			}
+		}
+	}
+
+	if (argc == 2) {
+		int index = atoi(argv[1]);
+		if (index < 0 || index >= (int)positions.size()) {
+			debugPrintf("Invalid location index\n");
+			return true;
+		}
+
+		_G(savegame)._mapX = positions[index].x;
+		_G(savegame)._mapY = positions[index].y;
+		g_engine->focusedView()->redraw();
+		debugPrintf("Teleported to %d: %s (%d,%d)\n", index, names[index],
+			positions[index].x, positions[index].y);
+		return true;
+	} else if (argc != 1) {
+		debugPrintf("locations [<index>]\n");
+		return true;
+	}
+
+	for (uint i = 0; i < positions.size(); ++i)
+		debugPrintf("%2d: %-8s (%d,%d)\n", i, names[i], positions[i].x, positions[i].y);
+
+	return true;
+}
+
+bool Console::cmdIntangible(int argc, const char **argv) {
+	_G(intangible) = !_G(intangible);
+	debugPrintf("Intangible mode %s\n", _G(intangible) ? "ON" : "OFF");
+	return true;
+}
+
+bool Console::cmdHP(int argc, const char **argv) {
+	_G(savegame)._hp = 9999;
+	g_engine->baseView()->findView("Stats")->draw();
+	debugPrintf("HP set to 9999\n");
+	return true;
+}
+
+bool Console::cmdFood(int argc, const char **argv) {
+	_G(savegame)._food = 9999;
+	_G(savegame)._foodTurnCtr = 0;
+	g_engine->baseView()->findView("Stats")->draw();
+	debugPrintf("Food set to 9999\n");
+	return true;
+}
+
+bool Console::cmdGold(int argc, const char **argv) {
+	_G(savegame)._gold = 9999;
+	g_engine->baseView()->findView("Stats")->draw();
+	debugPrintf("Gold set to 9999\n");
+	return true;
+}
+
 } // namespace Ultima2
 } // namespace Ultima
diff --git a/engines/ultima/ultima2/console.h b/engines/ultima/ultima2/console.h
index 32b0a38d6ff..38c05d3e8cd 100644
--- a/engines/ultima/ultima2/console.h
+++ b/engines/ultima/ultima2/console.h
@@ -22,6 +22,8 @@
 #ifndef ULTIMA2_CONSOLE_H
 #define ULTIMA2_CONSOLE_H
 
+#include "common/array.h"
+#include "common/rect.h"
 #include "gui/debugger.h"
 
 namespace Ultima {
@@ -32,6 +34,11 @@ private:
 	bool cmdMap(int argc, const char **argv);
 	bool cmdTiles(int argc, const char **argv);
 	bool cmdTeleport(int argc, const char **argv);
+	bool cmdLocations(int argc, const char **argv);
+	bool cmdIntangible(int argc, const char **argv);
+	bool cmdHP(int argc, const char **argv);
+	bool cmdFood(int argc, const char **argv);
+	bool cmdGold(int argc, const char **argv);
 public:
 	Console();
 	~Console() override;
diff --git a/engines/ultima/ultima2/logic/city_castle_logic.cpp b/engines/ultima/ultima2/logic/city_castle_logic.cpp
index 70428a308f9..c321dc20b7b 100644
--- a/engines/ultima/ultima2/logic/city_castle_logic.cpp
+++ b/engines/ultima/ultima2/logic/city_castle_logic.cpp
@@ -84,7 +84,7 @@ bool CityCastleLogic::move(Data::Direction dir) {
 		return false;
 	}
 
-	if (!isWalkable(destTile) || findTargetMonster(newX, newY) >= 0) {
+	if ((!_G(intangible) && !isWalkable(destTile)) || findTargetMonster(newX, newY) >= 0) {
 		writeString("--INVALID MOVE!\n");
 		return true;
 	}
diff --git a/engines/ultima/ultima2/logic/overworld_logic.cpp b/engines/ultima/ultima2/logic/overworld_logic.cpp
index da0d4ed6f40..152b1ed6392 100644
--- a/engines/ultima/ultima2/logic/overworld_logic.cpp
+++ b/engines/ultima/ultima2/logic/overworld_logic.cpp
@@ -125,7 +125,7 @@ bool OverworldLogic::move(Data::Direction dir) {
 		return false;
 	}
 
-	if (!isWalkable(destTile) || findTargetMonster(newX, newY) >= 0) {
+	if ((!_G(intangible) && !isWalkable(destTile)) || findTargetMonster(newX, newY) >= 0) {
 		writeString("--INVALID MOVE!\n");
 		return true;
 	}
diff --git a/engines/ultima/ultima2/ultima2.h b/engines/ultima/ultima2/ultima2.h
index aea5fc81987..f7b8eee0bc4 100644
--- a/engines/ultima/ultima2/ultima2.h
+++ b/engines/ultima/ultima2/ultima2.h
@@ -67,6 +67,10 @@ public:
 	Data::MapDungeon _dungeon;
 	Common::SharedPtr<Logic::Logic> _logic;
 
+	// Debug flag toggled by the "intangible" console command, allowing
+	// movement through normally impassable terrain
+	bool _intangible = false;
+
 public:
 	Ultima2Engine(OSystem *syst, const Ultima::UltimaGameDescription *gameDesc);
 	~Ultima2Engine() override;


Commit: ea612114478d6413215a682abd220d69869412ec
    https://github.com/scummvm/scummvm/commit/ea612114478d6413215a682abd220d69869412ec
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:40:55+11:00

Commit Message:
ULTIMA: ULTIMA2: Add enemy debug console command

Changed paths:
    engines/ultima/ultima2/console.cpp
    engines/ultima/ultima2/console.h
    engines/ultima/ultima2/logic/overworld_logic.h


diff --git a/engines/ultima/ultima2/console.cpp b/engines/ultima/ultima2/console.cpp
index 43b4b4cb7b8..b6fae7b9664 100644
--- a/engines/ultima/ultima2/console.cpp
+++ b/engines/ultima/ultima2/console.cpp
@@ -22,6 +22,7 @@
 #include "ultima/ultima2/console.h"
 #include "ultima/ultima2/ultima2.h"
 #include "ultima/ultima2/data/tiles.h"
+#include "ultima/ultima2/logic/overworld_logic.h"
 
 namespace Ultima {
 namespace Ultima2 {
@@ -32,6 +33,7 @@ Console::Console() : GUI::Debugger() {
 	registerCmd("teleport", WRAP_METHOD(Console, cmdTeleport));
 	registerCmd("locations", WRAP_METHOD(Console, cmdLocations));
 	registerCmd("intangible", WRAP_METHOD(Console, cmdIntangible));
+	registerCmd("enemy", WRAP_METHOD(Console, cmdEnemy));
 	registerCmd("hp", WRAP_METHOD(Console, cmdHP));
 	registerCmd("food", WRAP_METHOD(Console, cmdFood));
 	registerCmd("gold", WRAP_METHOD(Console, cmdGold));
@@ -187,6 +189,78 @@ bool Console::cmdLocations(int argc, const char **argv) {
 	return true;
 }
 
+bool Console::cmdEnemy(int argc, const char **argv) {
+	Data::Savegame &sg = _G(savegame);
+	if (sg._mapNum2 != 0) {
+		debugPrintf("Only supported on the overworld map\n");
+		return true;
+	}
+
+	Logic::OverworldLogic *logic = dynamic_cast<Logic::OverworldLogic *>(_G(logic).get());
+	assert(logic);
+
+	Data::MapMonsters &monsters = _G(map)._monsters;
+
+	int slot = -1;
+	for (int i = 1; i <= 31; ++i) {
+		if (!monsters.isActive(i)) {
+			slot = i;
+			break;
+		}
+	}
+	if (slot < 0) {
+		slot = 1;
+		monsters._type[slot] = 0;
+		debugPrintf("No free monster slots; evicted the monster in slot %d\n", slot);
+	}
+
+	int spawnX = -1, spawnY = -1;
+	for (int radius = 1; radius <= 10 && spawnX < 0; ++radius) {
+		for (int dy = -radius; dy <= radius && spawnX < 0; ++dy) {
+			for (int dx = -radius; dx <= radius && spawnX < 0; ++dx) {
+				if (MAX(ABS(dx), ABS(dy)) != radius)
+					continue;
+
+				int x = (sg._mapX + dx + Data::MAP_WIDTH) % Data::MAP_WIDTH;
+				int y = (sg._mapY + dy + Data::MAP_HEIGHT) % Data::MAP_HEIGHT;
+				if (!logic->isWalkable(_G(map).tileAt(x, y)))
+					continue;
+
+				bool occupied = false;
+				for (int i = 1; i <= 31; ++i) {
+					if (monsters.isActive(i) && monsters._mapX[i] == x && monsters._mapY[i] == y) {
+						occupied = true;
+						break;
+					}
+				}
+				if (!occupied) {
+					spawnX = x;
+					spawnY = y;
+					break;
+				}
+			}
+		}
+	}
+
+	if (spawnX < 0) {
+		debugPrintf("Couldn't find a free tile nearby\n");
+		return true;
+	}
+
+	monsters._mapX[slot] = spawnX;
+	monsters._mapY[slot] = spawnY;
+	monsters._spellHP[slot] = 0x10;
+	monsters._type[slot] = Data::TILE_ORC * 4;
+	monsters._glyphTile[slot] = 0;
+	monsters._offerFlag[slot] = 0;
+	monsters._tempX[slot] = 0;
+	monsters._tempY[slot] = 0;
+
+	g_engine->focusedView()->redraw();
+	debugPrintf("Spawned enemy in slot %d at (%d,%d)\n", slot, spawnX, spawnY);
+	return true;
+}
+
 bool Console::cmdIntangible(int argc, const char **argv) {
 	_G(intangible) = !_G(intangible);
 	debugPrintf("Intangible mode %s\n", _G(intangible) ? "ON" : "OFF");
diff --git a/engines/ultima/ultima2/console.h b/engines/ultima/ultima2/console.h
index 38c05d3e8cd..bfe81131046 100644
--- a/engines/ultima/ultima2/console.h
+++ b/engines/ultima/ultima2/console.h
@@ -36,6 +36,7 @@ private:
 	bool cmdTeleport(int argc, const char **argv);
 	bool cmdLocations(int argc, const char **argv);
 	bool cmdIntangible(int argc, const char **argv);
+	bool cmdEnemy(int argc, const char **argv);
 	bool cmdHP(int argc, const char **argv);
 	bool cmdFood(int argc, const char **argv);
 	bool cmdGold(int argc, const char **argv);
diff --git a/engines/ultima/ultima2/logic/overworld_logic.h b/engines/ultima/ultima2/logic/overworld_logic.h
index 409c6ae0520..fb6ef0d5e4b 100644
--- a/engines/ultima/ultima2/logic/overworld_logic.h
+++ b/engines/ultima/ultima2/logic/overworld_logic.h
@@ -47,11 +47,6 @@ private:
 	void enterLocalMap(int mapNum2);
 
 protected:
-	/**
-	 * Returns true if the given tile can be walked onto on foot
-	 */
-	bool isWalkable(Data::TileId tile) const;
-
 	/**
 	 * Returns -1/0/+1 matching the sign of the low byte of v, replicating
 	 * the original's byte-truncating "shortest step on a wrapping map" trick
@@ -86,6 +81,11 @@ protected:
 public:
 	~OverworldLogic() override {}
 
+	/**
+	 * Returns true if the given tile can be walked onto on foot
+	 */
+	bool isWalkable(Data::TileId tile) const;
+
 	bool move(Data::Direction dir) override;
 	bool attack(Data::Direction dir) override;
 	bool fire() override;


Commit: 9c29bbfaf0a667dd00259c96dee698e7febeda1e
    https://github.com/scummvm/scummvm/commit/9c29bbfaf0a667dd00259c96dee698e7febeda1e
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:40:55+11:00

Commit Message:
ULTIMA: ULTIMA2: Fix TRANSACT echo and missing prompt after direction commands

Changed paths:
    engines/ultima/ultima2/logic/city_castle_logic.cpp
    engines/ultima/ultima2/logic/logic.cpp
    engines/ultima/ultima2/logic/logic.h


diff --git a/engines/ultima/ultima2/logic/city_castle_logic.cpp b/engines/ultima/ultima2/logic/city_castle_logic.cpp
index c321dc20b7b..d64c6a6c12b 100644
--- a/engines/ultima/ultima2/logic/city_castle_logic.cpp
+++ b/engines/ultima/ultima2/logic/city_castle_logic.cpp
@@ -454,6 +454,7 @@ bool CityCastleLogic::openShopForCurrentQuadrant() {
 
 bool CityCastleLogic::transact(Data::Direction dir) {
 	if (dir == Data::DIR_UNSPECIFIED) {
+		writeString("TRANSACT-");
 		_directionPurpose = DirectionPurpose::TRANSACT;
 		g_engine->addView("Direction");
 		return false;
@@ -461,13 +462,15 @@ bool CityCastleLogic::transact(Data::Direction dir) {
 
 	Data::Savegame &sg = _G(savegame);
 	int dx = 0, dy = 0;
+	const char *dirName;
 	switch (dir) {
-	case Data::DIR_UP: dy = -1; break;
-	case Data::DIR_DOWN: dy = 1; break;
-	case Data::DIR_LEFT: dx = -1; break;
-	case Data::DIR_RIGHT: dx = 1; break;
-	default: break;
+	case Data::DIR_UP:    dy = -1; dirName = "NORTH"; break;
+	case Data::DIR_DOWN:  dy = 1;  dirName = "SOUTH"; break;
+	case Data::DIR_LEFT:  dx = -1; dirName = "WEST"; break;
+	case Data::DIR_RIGHT: dx = 1;  dirName = "EAST"; break;
+	default: dirName = ""; break;
 	}
+	writeString("%s\n", dirName);
 
 	int x1 = sg._mapX + dx, y1 = sg._mapY + dy;
 	int slot = (x1 >= 0 && x1 < Data::MAP_WIDTH && y1 >= 0 && y1 < Data::MAP_HEIGHT) ?
@@ -482,25 +485,25 @@ bool CityCastleLogic::transact(Data::Direction dir) {
 		case Data::TILE_TITHE_ALTAR:
 			return tithe();
 		case Data::TILE_GUARD:
-			writeString("A GUARD SAYS: PAY YOUR TAXES!\n");
+			writeString("A GUARD SAYS:\nPAY YOUR TAXES!\n");
 			return true;
 		case Data::TILE_JESTER:
-			writeString("A JESTER SINGS: HO HO HO!\n");
+			writeString("A JESTER SINGS:\nHO HO HO!\n");
 			return true;
 		case Data::TILE_SHOPKEEP:
-			writeString("A MERCHANT SAYS: WILL YOU BUY MY APPLES?\n");
+			writeString("A MERCHANT SAYS:\nWILL YOU BUY MY APPLES?\n");
 			return true;
 		case Data::TILE_FIGHTER:
-			writeString("A FIGHTER SAYS: UGH, ME TOUGH!\n");
+			writeString("A FIGHTER SAYS:\nUGH, ME TOUGH!\n");
 			return true;
 		case Data::TILE_CLERIC:
-			writeString("A CLERIC SAYS: BELIEVE!\n");
+			writeString("A CLERIC SAYS:\nBELIEVE!\n");
 			return true;
 		case Data::TILE_MAGE:
-			writeString("A WIZARD SAYS: HEX-E-POO-HEX-ON-YOU!\n");
+			writeString("A WIZARD SAYS:\nHEX-E-POO-HEX-ON-YOU!\n");
 			return true;
 		case Data::TILE_THIEF:
-			writeString("A THIEF SAYS: PSST, WANNA BUY A WATCH?\n");
+			writeString("A THIEF SAYS:\nPSST, WANNA BUY A WATCH?\n");
 			return true;
 		default:
 			writeString("FUNNY, NO RESPONSE!\n");
diff --git a/engines/ultima/ultima2/logic/logic.cpp b/engines/ultima/ultima2/logic/logic.cpp
index cfeb1b59327..e0f1fe2b08f 100644
--- a/engines/ultima/ultima2/logic/logic.cpp
+++ b/engines/ultima/ultima2/logic/logic.cpp
@@ -230,23 +230,27 @@ void Logic::action(int action) {
 }
 
 void Logic::resolveDirection(Data::Direction dir) {
+	bool doEndOfTurn = false;
 	switch (_directionPurpose) {
 	case DirectionPurpose::ATTACK:
-		attack(dir);
+		doEndOfTurn = attack(dir);
 		break;
 	case DirectionPurpose::STEAL:
-		steal(dir);
+		doEndOfTurn = steal(dir);
 		break;
 	case DirectionPurpose::UNLOCK:
-		unlock(dir);
+		doEndOfTurn = unlock(dir);
 		break;
 	case DirectionPurpose::OFFER:
-		offer(dir);
+		doEndOfTurn = offer(dir);
 		break;
 	case DirectionPurpose::TRANSACT:
-		transact(dir);
+		doEndOfTurn = transact(dir);
 		break;
 	}
+
+	if (doEndOfTurn)
+		resumeTurn();
 }
 
 bool Logic::trySpendGold(int amount) {
diff --git a/engines/ultima/ultima2/logic/logic.h b/engines/ultima/ultima2/logic/logic.h
index 86596e3ccf4..d217e7cb781 100644
--- a/engines/ultima/ultima2/logic/logic.h
+++ b/engines/ultima/ultima2/logic/logic.h
@@ -164,7 +164,8 @@ public:
 
 	/**
 	 * Called by the Direction interaction once a direction has been chosen,
-	 * dispatching to whichever command requested it (see _directionPurpose)
+	 * dispatching to whichever command requested it (see _directionPurpose).
+	 * Resumes the turn if the command reports it's now complete.
 	 */
 	void resolveDirection(Data::Direction dir);
 


Commit: 65ddc9cc2dae6ea30b120ea96313e1ab8f35f749
    https://github.com/scummvm/scummvm/commit/65ddc9cc2dae6ea30b120ea96313e1ab8f35f749
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:40:55+11:00

Commit Message:
ULTIMA: ULTIMA2: Rename mapNum1/mapNum2 to mapEra/mapType, console map command

Changed paths:
    engines/ultima/ultima2/console.cpp
    engines/ultima/ultima2/data/map.cpp
    engines/ultima/ultima2/data/map.h
    engines/ultima/ultima2/data/map_dungeon.cpp
    engines/ultima/ultima2/data/map_dungeon.h
    engines/ultima/ultima2/data/map_monsters.cpp
    engines/ultima/ultima2/data/map_monsters.h
    engines/ultima/ultima2/data/savegame.cpp
    engines/ultima/ultima2/data/savegame.h
    engines/ultima/ultima2/logic/city_castle_logic.cpp
    engines/ultima/ultima2/logic/logic.cpp
    engines/ultima/ultima2/logic/logic.h
    engines/ultima/ultima2/logic/overworld_logic.cpp
    engines/ultima/ultima2/logic/overworld_logic.h
    engines/ultima/ultima2/ultima2.cpp
    engines/ultima/ultima2/views/create_character.cpp


diff --git a/engines/ultima/ultima2/console.cpp b/engines/ultima/ultima2/console.cpp
index b6fae7b9664..7ed3d615301 100644
--- a/engines/ultima/ultima2/console.cpp
+++ b/engines/ultima/ultima2/console.cpp
@@ -19,6 +19,7 @@
  *
  */
 
+#include "common/file.h"
 #include "ultima/ultima2/console.h"
 #include "ultima/ultima2/ultima2.h"
 #include "ultima/ultima2/data/tiles.h"
@@ -43,20 +44,24 @@ Console::~Console() {
 }
 
 bool Console::cmdMap(int argc, const char **argv) {
-	int mapNum1 = _G(savegame)._mapNum1;
-	int mapNum2 = _G(savegame)._mapNum2;
+	if (argc != 3) {
+		debugPrintf("map <era> <map type>\n");
+		return true;
+	}
 
-	if (argc == 3) {
-		mapNum1 = atoi(argv[1]);
-		mapNum2 = atoi(argv[2]);
-	} else if (argc != 1) {
-		debugPrintf("map [<mapNum1> <mapNum2>]\n");
+	Data::Savegame &sg = _G(savegame);
+	int mapEra = atoi(argv[1]);
+	int mapType = atoi(argv[2]);
+
+	if (!Common::File::exists(Data::mapFilename(mapEra, mapType).c_str())) {
+		debugPrintf("No such map: %s\n", Data::mapFilename(mapEra, mapType).c_str());
 		return true;
 	}
 
-	if (mapNum2 >= 4) {
-		_G(dungeon).load(mapNum1, mapNum2);
-		debugPrintf("Loaded dungeon MAPX%d%d\n", mapNum1, mapNum2);
+	if (mapType >= 4) {
+		// Towers and dungeons have no view yet, so just dump the loaded cells
+		_G(dungeon).load(mapEra, mapType);
+		debugPrintf("Loaded dungeon MAPX%d%d\n", mapEra, mapType);
 
 		for (int level = 0; level < Data::DUNGEON_LEVELS; ++level) {
 			debugPrintf("Level %d:\n", level);
@@ -67,27 +72,23 @@ bool Console::cmdMap(int argc, const char **argv) {
 				debugPrintf("%s\n", line.c_str());
 			}
 		}
-	} else {
-		_G(map).load(mapNum1, mapNum2);
-		debugPrintf("Loaded map MAPX%d%d\n", mapNum1, mapNum2);
-
-		for (int y = 0; y < Data::MAP_HEIGHT; ++y) {
-			Common::String line;
-			for (int x = 0; x < Data::MAP_WIDTH; ++x)
-				line += Common::String::format("%02x", (int)_G(map).tileAt(x, y));
-			debugPrintf("%s\n", line.c_str());
-		}
+		return true;
+	}
 
-		for (int i = 0; i < Data::MAP_MONSTER_COUNT; ++i) {
-			if (_G(map)._monsters.isActive(i)) {
-				debugPrintf("Monster %d: type=%d pos=(%d,%d)\n", i,
-					_G(map)._monsters.tileType(i),
-					_G(map)._monsters._mapX[i], _G(map)._monsters._mapY[i]);
-			}
-		}
+	if (sg._mapType == 0) {
+		sg._overworldReturnX = sg._mapX;
+		sg._overworldReturnY = sg._mapY;
+	}
+	if (mapType != 0) {
+		sg._mapX = 31;
+		sg._mapY = 62;
 	}
 
-	return true;
+	sg._mapEra = mapEra;
+	sg._mapType = mapType;
+	_G(map).load(mapEra, mapType);
+	_G(logic)->entering();
+	return false;
 }
 
 bool Console::cmdTiles(int argc, const char **argv) {
@@ -191,7 +192,7 @@ bool Console::cmdLocations(int argc, const char **argv) {
 
 bool Console::cmdEnemy(int argc, const char **argv) {
 	Data::Savegame &sg = _G(savegame);
-	if (sg._mapNum2 != 0) {
+	if (sg._mapType != 0) {
 		debugPrintf("Only supported on the overworld map\n");
 		return true;
 	}
diff --git a/engines/ultima/ultima2/data/map.cpp b/engines/ultima/ultima2/data/map.cpp
index 906a4ee7c40..ec0d6e8d610 100644
--- a/engines/ultima/ultima2/data/map.cpp
+++ b/engines/ultima/ultima2/data/map.cpp
@@ -30,17 +30,17 @@ namespace Ultima {
 namespace Ultima2 {
 namespace Data {
 
-Common::String mapFilename(int mapNum1, int mapNum2) {
-	return Common::String::format("MAPX%c%c", '0' + mapNum1, '0' + mapNum2);
+Common::String mapFilename(int mapEra, int mapType) {
+	return Common::String::format("MAPX%c%c", '0' + mapEra, '0' + mapType);
 }
 
-Common::String monsterFilename(int mapNum1, int mapNum2) {
-	return Common::String::format("MONX%c%c", '0' + mapNum1, '0' + mapNum2);
+Common::String monsterFilename(int mapEra, int mapType) {
+	return Common::String::format("MONX%c%c", '0' + mapEra, '0' + mapType);
 }
 
-void Map::load(int mapNum1, int mapNum2) {
+void Map::load(int mapEra, int mapType) {
 	Common::File f;
-	Common::String filename = mapFilename(mapNum1, mapNum2);
+	Common::String filename = mapFilename(mapEra, mapType);
 	if (!f.open(filename.c_str()))
 		error("Could not open %s", filename.c_str());
 
@@ -49,14 +49,14 @@ void Map::load(int mapNum1, int mapNum2) {
 			_tiles[y][x] = (TileId)(f.readByte() / 4);
 	}
 
-	_monsters.load(mapNum1, mapNum2);
+	_monsters.load(mapEra, mapType);
 
-	if (mapNum2 == 0)
+	if (mapType == 0)
 		_G(logic) = Common::SharedPtr<Logic::Logic>(new Logic::OverworldLogic());
 	else
 		_G(logic) = Common::SharedPtr<Logic::Logic>(new Logic::CityCastleLogic());
 
-	Common::String mapViewName = (mapNum2 == 0) ? "OverworldMap" : "LocationMap";
+	Common::String mapViewName = (mapType == 0) ? "OverworldMap" : "LocationMap";
 
 	if (!g_engine->isPresent("Game")) {
 		// Set up the game view and force it to draw immediately
diff --git a/engines/ultima/ultima2/data/map.h b/engines/ultima/ultima2/data/map.h
index 0976f53cfb1..9968f855a9b 100644
--- a/engines/ultima/ultima2/data/map.h
+++ b/engines/ultima/ultima2/data/map.h
@@ -34,8 +34,8 @@ constexpr int MAP_WIDTH = 64;
 constexpr int MAP_HEIGHT = 64;
 
 // Both build "MAPXnn"/"MONXnn" from the same two map-number digits
-Common::String mapFilename(int mapNum1, int mapNum2);
-Common::String monsterFilename(int mapNum1, int mapNum2);
+Common::String mapFilename(int mapEra, int mapType);
+Common::String monsterFilename(int mapEra, int mapType);
 
 /**
  * A planet, village, town, or castle's map: a flat 64x64 grid of tiles,
@@ -47,7 +47,7 @@ struct Map {
 	TileId _tiles[MAP_HEIGHT][MAP_WIDTH] = {};
 	MapMonsters _monsters;
 
-	void load(int mapNum1, int mapNum2);
+	void load(int mapEra, int mapType);
 
 	TileId tileAt(int x, int y) const {
 		return _tiles[y][x];
diff --git a/engines/ultima/ultima2/data/map_dungeon.cpp b/engines/ultima/ultima2/data/map_dungeon.cpp
index 279c9abebf4..f714e366c99 100644
--- a/engines/ultima/ultima2/data/map_dungeon.cpp
+++ b/engines/ultima/ultima2/data/map_dungeon.cpp
@@ -27,9 +27,9 @@ namespace Ultima {
 namespace Ultima2 {
 namespace Data {
 
-void MapDungeon::load(int mapNum1, int mapNum2) {
+void MapDungeon::load(int mapEra, int mapType) {
 	Common::File f;
-	Common::String filename = mapFilename(mapNum1, mapNum2);
+	Common::String filename = mapFilename(mapEra, mapType);
 	if (!f.open(filename.c_str()))
 		error("Could not open %s", filename.c_str());
 
diff --git a/engines/ultima/ultima2/data/map_dungeon.h b/engines/ultima/ultima2/data/map_dungeon.h
index 27c2e66c534..2d8fb66da59 100644
--- a/engines/ultima/ultima2/data/map_dungeon.h
+++ b/engines/ultima/ultima2/data/map_dungeon.h
@@ -53,7 +53,7 @@ enum DungeonTerrain {
 struct MapDungeon {
 	byte _cells[DUNGEON_LEVELS][DUNGEON_HEIGHT][DUNGEON_WIDTH] = {};
 
-	void load(int mapNum1, int mapNum2);
+	void load(int mapEra, int mapType);
 
 	DungeonTerrain terrainAt(int level, int x, int y) const {
 		return (DungeonTerrain)(_cells[level][y][x] & 0xF0);
diff --git a/engines/ultima/ultima2/data/map_monsters.cpp b/engines/ultima/ultima2/data/map_monsters.cpp
index 152f1c3382f..85dd1925a32 100644
--- a/engines/ultima/ultima2/data/map_monsters.cpp
+++ b/engines/ultima/ultima2/data/map_monsters.cpp
@@ -27,9 +27,9 @@ namespace Ultima {
 namespace Ultima2 {
 namespace Data {
 
-void MapMonsters::load(int mapNum1, int mapNum2) {
+void MapMonsters::load(int mapEra, int mapType) {
 	Common::File f;
-	Common::String filename = monsterFilename(mapNum1, mapNum2);
+	Common::String filename = monsterFilename(mapEra, mapType);
 	if (!f.open(filename.c_str()))
 		error("Could not open %s", filename.c_str());
 
diff --git a/engines/ultima/ultima2/data/map_monsters.h b/engines/ultima/ultima2/data/map_monsters.h
index 2662407520b..b62d582f955 100644
--- a/engines/ultima/ultima2/data/map_monsters.h
+++ b/engines/ultima/ultima2/data/map_monsters.h
@@ -46,7 +46,7 @@ struct MapMonsters {
 	byte _tempX[MAP_MONSTER_COUNT] = {};
 	byte _tempY[MAP_MONSTER_COUNT] = {};
 
-	void load(int mapNum1, int mapNum2);
+	void load(int mapEra, int mapType);
 
 	bool isActive(int slot) const {
 		return _type[slot] != 0;
diff --git a/engines/ultima/ultima2/data/savegame.cpp b/engines/ultima/ultima2/data/savegame.cpp
index c209ec5b1fc..41d15cd3a28 100644
--- a/engines/ultima/ultima2/data/savegame.cpp
+++ b/engines/ultima/ultima2/data/savegame.cpp
@@ -44,8 +44,8 @@ void Savegame::synchronize(Common::Serializer &s) {
 	s.syncAsSint16LE(_experience);
 	s.syncAsSint16LE(_gold);
 
-	s.syncAsByte(_mapNum1);
-	s.syncAsByte(_mapNum2);
+	s.syncAsByte(_mapEra);
+	s.syncAsByte(_mapType);
 	s.syncAsByte(_mapX);
 	s.syncAsByte(_mapY);
 	s.syncAsByte(_overworldReturnX);
diff --git a/engines/ultima/ultima2/data/savegame.h b/engines/ultima/ultima2/data/savegame.h
index 156b116775c..cef8025333b 100644
--- a/engines/ultima/ultima2/data/savegame.h
+++ b/engines/ultima/ultima2/data/savegame.h
@@ -54,10 +54,10 @@ struct Savegame {
 	int16 _experience = 0;
 	int16 _gold = 0;
 
-	// Position - _mapNum1/_mapNum2 select the current mapX??/monX??/tlkX???
+	// Position - _mapEra/_mapType select the current mapX??/monX??/tlkX???
 	// file; _mapX/_mapY are the player's position within it
-	byte _mapNum1 = 0;
-	byte _mapNum2 = 0;
+	byte _mapEra = 0;
+	byte _mapType = 0;
 	byte _mapX = 0;
 	byte _mapY = 0;
 
diff --git a/engines/ultima/ultima2/logic/city_castle_logic.cpp b/engines/ultima/ultima2/logic/city_castle_logic.cpp
index d64c6a6c12b..4cda32ec867 100644
--- a/engines/ultima/ultima2/logic/city_castle_logic.cpp
+++ b/engines/ultima/ultima2/logic/city_castle_logic.cpp
@@ -30,8 +30,8 @@ void CityCastleLogic::exitToOverworld() {
 	Data::Savegame &sg = _G(savegame);
 	sg._mapX = sg._overworldReturnX;
 	sg._mapY = sg._overworldReturnY;
-	sg._mapNum2 = 0;
-	_G(map).load(sg._mapNum1, sg._mapNum2);
+	sg._mapType = 0;
+	_G(map).load(sg._mapEra, sg._mapType);
 }
 
 bool CityCastleLogic::move(Data::Direction dir) {
@@ -221,7 +221,7 @@ bool CityCastleLogic::steal(Data::Direction dir) {
 		return true;
 	}
 
-	switch (sg._mapNum2) {
+	switch (sg._mapType) {
 	case 1: // Village
 		if (sg._mapY < 32 && sg._mapX >= 32) {
 			writeString("STEAL FOOD!\n");
@@ -330,7 +330,7 @@ void CityCastleLogic::completeOffer(int goldHundreds) {
 
 	Data::MapMonsters &monsters = _G(map)._monsters;
 	byte flag = monsters.isActive(_offerTargetSlot) ? monsters._offerFlag[_offerTargetSlot] : 0;
-	bool wrongMap = !(sg._mapNum2 == 2 && sg._mapNum1 == 3);
+	bool wrongMap = !(sg._mapType == 2 && sg._mapEra == 3);
 
 	if ((int8)flag >= 0 || wrongMap) {
 		writeString("THANK YOU VERY MUCH!\n");
@@ -405,7 +405,7 @@ bool CityCastleLogic::openShopForCurrentQuadrant() {
 	Data::Savegame &sg = _G(savegame);
 	bool top = sg._mapY < 32;
 	bool left = sg._mapX < 32;
-	bool isTown = sg._mapNum2 == 2;
+	bool isTown = sg._mapType == 2;
 
 	if (top && left) {
 		if (isTown) {
diff --git a/engines/ultima/ultima2/logic/logic.cpp b/engines/ultima/ultima2/logic/logic.cpp
index e0f1fe2b08f..3449b5fdb27 100644
--- a/engines/ultima/ultima2/logic/logic.cpp
+++ b/engines/ultima/ultima2/logic/logic.cpp
@@ -70,7 +70,7 @@ void Logic::playerDied() {
 
 void Logic::alertTownGuards(int extraSlot) {
 	Data::Savegame &sg = _G(savegame);
-	if (sg._mapNum2 == 0)
+	if (sg._mapType == 0)
 		return;
 
 	Data::MapMonsters &monsters = _G(map)._monsters;
@@ -303,7 +303,7 @@ bool Logic::fire() {
 bool Logic::get() {
 	Data::Savegame &sg = _G(savegame);
 
-	if (sg._mapNum2 >= 4) {
+	if (sg._mapType >= 4) {
 		// Dungeon/tower chest handling - not yet implemented
 		writeString("Get?\n");
 		return true;
@@ -342,7 +342,7 @@ bool Logic::igniteTorch() {
 	writeString("IGNITE TORCH\n");
 	Data::Savegame &sg = _G(savegame);
 
-	if (sg._mapNum2 < 4)
+	if (sg._mapType < 4)
 		return true;
 
 	if (sg._torches == 0) {
@@ -427,7 +427,7 @@ bool Logic::unlock(Data::Direction dir) {
 bool Logic::view() {
 	Data::Savegame &sg = _G(savegame);
 
-	if (sg._items[Data::ITEM_HELM] == 0 || sg._mapNum2 >= 4) {
+	if (sg._items[Data::ITEM_HELM] == 0 || sg._mapType >= 4) {
 		writeString("VIEW WHAT?\n");
 		return true;
 	}
diff --git a/engines/ultima/ultima2/logic/logic.h b/engines/ultima/ultima2/logic/logic.h
index d217e7cb781..cd00ea6444f 100644
--- a/engines/ultima/ultima2/logic/logic.h
+++ b/engines/ultima/ultima2/logic/logic.h
@@ -61,7 +61,7 @@ protected:
 	/**
 	 * Alerts nearby town guards (slots 0-7, plus optionally the specific
 	 * slot just interacted with) after an attack or theft. A no-op on the
-	 * overworld (_mapNum2 == 0)
+	 * overworld (_mapType == 0)
 	 */
 	void alertTownGuards(int extraSlot = -1);
 
diff --git a/engines/ultima/ultima2/logic/overworld_logic.cpp b/engines/ultima/ultima2/logic/overworld_logic.cpp
index 152b1ed6392..e27a8b3dd38 100644
--- a/engines/ultima/ultima2/logic/overworld_logic.cpp
+++ b/engines/ultima/ultima2/logic/overworld_logic.cpp
@@ -417,20 +417,20 @@ void OverworldLogic::killMonster(int slot) {
 	writeString("KILLED--GOLD+%d--EXP.+%d\n", goldAmt, expAmt);
 }
 
-void OverworldLogic::enterLocalMap(int mapNum2) {
+void OverworldLogic::enterLocalMap(int mapType) {
 	Data::Savegame &sg = _G(savegame);
 	sg._overworldReturnX = sg._mapX;
 	sg._overworldReturnY = sg._mapY;
 	sg._mapX = 31;
 	sg._mapY = 62;
-	sg._mapNum2 = mapNum2;
-	_G(map).load(sg._mapNum1, sg._mapNum2);
+	sg._mapType = mapType;
+	_G(map).load(sg._mapEra, sg._mapType);
 }
 
 bool OverworldLogic::enter() {
 	Data::Savegame &sg = _G(savegame);
 
-	if (sg._mapNum2 != 0) {
+	if (sg._mapType != 0) {
 		writeString(" WHAT?\n");
 		return true;
 	}
@@ -456,7 +456,7 @@ bool OverworldLogic::enter() {
 			"ANOS: LEGENDS!", "ANOS: 2112 A.D.", "ANOS: 9,000,000 B.C.",
 			"ANOS: 1423 B.C.", "ANOS: 1990 A.D."
 		};
-		int era = (sg._mapNum1 < 5) ? sg._mapNum1 : 4;
+		int era = (sg._mapEra < 5) ? sg._mapEra : 4;
 		writeString("%s\n", ERA_TEXT[era]);
 		return true;
 	}
diff --git a/engines/ultima/ultima2/logic/overworld_logic.h b/engines/ultima/ultima2/logic/overworld_logic.h
index fb6ef0d5e4b..cce2da433a5 100644
--- a/engines/ultima/ultima2/logic/overworld_logic.h
+++ b/engines/ultima/ultima2/logic/overworld_logic.h
@@ -44,7 +44,7 @@ private:
 	 * Stashes the current position as the overworld return point, then
 	 * loads the given local map type (1-3 for village/town/castle)
 	 */
-	void enterLocalMap(int mapNum2);
+	void enterLocalMap(int mapType);
 
 protected:
 	/**
diff --git a/engines/ultima/ultima2/ultima2.cpp b/engines/ultima/ultima2/ultima2.cpp
index 1c59c369bfe..99b4fab6d19 100644
--- a/engines/ultima/ultima2/ultima2.cpp
+++ b/engines/ultima/ultima2/ultima2.cpp
@@ -91,7 +91,7 @@ Common::Error Ultima2Engine::syncGame(Common::Serializer &s) {
 	_savegame.synchronize(s);
 
 	if (s.isLoading()) {
-		_G(map).load(_G(savegame)._mapNum1, _G(savegame)._mapNum2);
+		_G(map).load(_G(savegame)._mapEra, _G(savegame)._mapType);
 	}
 
 	return Common::kNoError;
diff --git a/engines/ultima/ultima2/views/create_character.cpp b/engines/ultima/ultima2/views/create_character.cpp
index 8d9db15690d..4c09de31627 100644
--- a/engines/ultima/ultima2/views/create_character.cpp
+++ b/engines/ultima/ultima2/views/create_character.cpp
@@ -322,8 +322,8 @@ bool CreateCharacter::msgKeypress(const KeypressMessage &msg) {
 			sg._gold = 400;
 			sg._mapX = 20;
 			sg._mapY = 20;
-			sg._mapNum1 = 2;
-			sg._mapNum2 = 0;
+			sg._mapEra = 2;
+			sg._mapType = 0;
 			_state = DONE;
 			positionCursor();
 			redraw();
@@ -331,7 +331,7 @@ bool CreateCharacter::msgKeypress(const KeypressMessage &msg) {
 		break;
 
 	case DONE:
-		_G(map).load(sg._mapNum1, sg._mapNum2);
+		_G(map).load(sg._mapEra, sg._mapType);
 		break;
 	}
 


Commit: 0f401acdbdbc66e828196be53fb7e696ae59ec10
    https://github.com/scummvm/scummvm/commit/0f401acdbdbc66e828196be53fb7e696ae59ec10
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:40:55+11:00

Commit Message:
ULTIMA: ULTIMA2: Fix shopkeeper detection after monsters move off their baked-in tiles

Changed paths:
    engines/ultima/ultima2/data/map.cpp
    engines/ultima/ultima2/logic/city_castle_logic.cpp
    engines/ultima/ultima2/logic/city_castle_logic.h


diff --git a/engines/ultima/ultima2/data/map.cpp b/engines/ultima/ultima2/data/map.cpp
index ec0d6e8d610..3aa6d3f31fd 100644
--- a/engines/ultima/ultima2/data/map.cpp
+++ b/engines/ultima/ultima2/data/map.cpp
@@ -51,6 +51,17 @@ void Map::load(int mapEra, int mapType) {
 
 	_monsters.load(mapEra, mapType);
 
+	// The files store each monster's tile baked into the map; restore the
+	// terrain underneath, since monsters are tracked and drawn separately
+	for (int slot = 0; slot < MAP_MONSTER_COUNT; ++slot) {
+		if (!_monsters.isActive(slot))
+			continue;
+
+		int x = _monsters._mapX[slot], y = _monsters._mapY[slot];
+		if (x < MAP_WIDTH && y < MAP_HEIGHT && _tiles[y][x] == _monsters.tileType(slot))
+			_tiles[y][x] = (TileId)(_monsters._glyphTile[slot] / 4);
+	}
+
 	if (mapType == 0)
 		_G(logic) = Common::SharedPtr<Logic::Logic>(new Logic::OverworldLogic());
 	else
diff --git a/engines/ultima/ultima2/logic/city_castle_logic.cpp b/engines/ultima/ultima2/logic/city_castle_logic.cpp
index 4cda32ec867..0c06dfd4b73 100644
--- a/engines/ultima/ultima2/logic/city_castle_logic.cpp
+++ b/engines/ultima/ultima2/logic/city_castle_logic.cpp
@@ -26,6 +26,14 @@ namespace Ultima {
 namespace Ultima2 {
 namespace Logic {
 
+bool CityCastleLogic::shopkeeperAt(int x, int y) const {
+	if (x < 0 || x >= Data::MAP_WIDTH || y < 0 || y >= Data::MAP_HEIGHT)
+		return false;
+
+	int slot = findTargetMonster(x, y);
+	return slot >= 0 && _G(map)._monsters.tileType(slot) == Data::TILE_SHOPKEEP;
+}
+
 void CityCastleLogic::exitToOverworld() {
 	Data::Savegame &sg = _G(savegame);
 	sg._mapX = sg._overworldReturnX;
@@ -193,8 +201,7 @@ bool CityCastleLogic::steal(Data::Direction dir) {
 		(_G(map).tileAt(x1, y1) >= Data::TILE_A || _G(map).tileAt(x1, y1) == Data::TILE_EMPTY_COUNTER);
 
 	int x2 = sg._mapX + dx * 2, y2 = sg._mapY + dy * 2;
-	bool foundShopkeep = counterFound && x2 >= 0 && x2 < Data::MAP_WIDTH && y2 >= 0 && y2 < Data::MAP_HEIGHT &&
-		_G(map).tileAt(x2, y2) == Data::TILE_SHOPKEEP;
+	bool foundShopkeep = counterFound && shopkeeperAt(x2, y2);
 
 	auto noLuck = [this]() {
 		writeString("NO LUCK!\n");
@@ -519,10 +526,7 @@ bool CityCastleLogic::transact(Data::Direction dir) {
 		return true;
 	}
 
-	int x2 = sg._mapX + dx * 2, y2 = sg._mapY + dy * 2;
-	Data::TileId t2 = (x2 >= 0 && x2 < Data::MAP_WIDTH && y2 >= 0 && y2 < Data::MAP_HEIGHT) ?
-		_G(map).tileAt(x2, y2) : Data::TILE_WATER;
-	if (t2 != Data::TILE_SHOPKEEP) {
+	if (!shopkeeperAt(sg._mapX + dx * 2, sg._mapY + dy * 2)) {
 		writeString("FUNNY, NO RESPONSE!\n");
 		return true;
 	}
diff --git a/engines/ultima/ultima2/logic/city_castle_logic.h b/engines/ultima/ultima2/logic/city_castle_logic.h
index c6972900248..8f442e64153 100644
--- a/engines/ultima/ultima2/logic/city_castle_logic.h
+++ b/engines/ultima/ultima2/logic/city_castle_logic.h
@@ -42,6 +42,11 @@ private:
 	// interaction resolving and the OfferGold interaction completing
 	int _offerTargetSlot = -1;
 
+	/**
+	 * Returns true if a shopkeeper is currently standing at (x,y)
+	 */
+	bool shopkeeperAt(int x, int y) const;
+
 	/**
 	 * Returns to the overworld position saved when this local map was entered
 	 */


Commit: 0e62c6ffaeaf8073e62634ed22f9ac5a404b04f0
    https://github.com/scummvm/scummvm/commit/0e62c6ffaeaf8073e62634ed22f9ac5a404b04f0
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:40:55+11:00

Commit Message:
ULTIMA: ULTIMA2: Add transport shop horse purchase and fix item price formula

Changed paths:
  A engines/ultima/ultima2/views/interactions/transport.cpp
  A engines/ultima/ultima2/views/interactions/transport.h
    engines/ultima/module.mk
    engines/ultima/ultima2/data/savegame.cpp
    engines/ultima/ultima2/data/savegame.h
    engines/ultima/ultima2/logic/city_castle_logic.cpp
    engines/ultima/ultima2/views/location_map.cpp
    engines/ultima/ultima2/views/overworld_map.cpp
    engines/ultima/ultima2/views/views.h


diff --git a/engines/ultima/module.mk b/engines/ultima/module.mk
index 9581cdcf6c1..9f2d8d1462c 100644
--- a/engines/ultima/module.mk
+++ b/engines/ultima/module.mk
@@ -139,6 +139,7 @@ MODULE_OBJS += \
 	ultima2/views/interactions/ready_spell.o \
 	ultima2/views/interactions/ready_weapon.o \
 	ultima2/views/interactions/shop.o \
+	ultima2/views/interactions/transport.o \
 	ultima2/views/interactions/wear_armor.o \
 	ultima2/views/interactions/yell.o
 endif
diff --git a/engines/ultima/ultima2/data/savegame.cpp b/engines/ultima/ultima2/data/savegame.cpp
index 41d15cd3a28..0519ee57edc 100644
--- a/engines/ultima/ultima2/data/savegame.cpp
+++ b/engines/ultima/ultima2/data/savegame.cpp
@@ -88,6 +88,7 @@ void Savegame::synchronize(Common::Serializer &s) {
 	s.syncAsSint16LE(_negateTimeTurns);
 	s.syncAsSint16LE(_lightTurns);
 	s.syncAsByte(_monsterSpawnCounter);
+	s.syncAsByte(_mount);
 }
 
 } // namespace Data
diff --git a/engines/ultima/ultima2/data/savegame.h b/engines/ultima/ultima2/data/savegame.h
index cef8025333b..42c1f122004 100644
--- a/engines/ultima/ultima2/data/savegame.h
+++ b/engines/ultima/ultima2/data/savegame.h
@@ -24,6 +24,7 @@
 
 #include "common/serializer.h"
 #include "ultima/ultima2/data/data.h"
+#include "ultima/ultima2/data/tiles.h"
 
 namespace Ultima {
 namespace Ultima2 {
@@ -66,6 +67,9 @@ struct Savegame {
 	byte _overworldReturnX = 0;
 	byte _overworldReturnY = 0;
 
+	// Tile of the vehicle the player is riding (horse, ship, ...), or 0 on foot
+	byte _mount = 0;
+
 	// Currently readied items
 	WeaponType _readiedWeapon = WEAPON_HANDS;
 	ArmorType _readiedArmor = ARMOR_SKIN;
@@ -116,6 +120,13 @@ struct Savegame {
 	 */
 	void synchronize(Common::Serializer &s);
 
+	/**
+	 * Returns the tile the player is drawn with
+	 */
+	TileId playerTile() const {
+		return _mount ? (TileId)_mount : (TileId)(TILE_FIGHTER + _class);
+	}
+
 	/**
 	 * Deducts an amount from HP. Returns false if this was fatal.
 	 * A survived hit costs one extra point beyond the amount given,
@@ -146,27 +157,26 @@ struct Savegame {
 	}
 
 	/**
-	 * Computes a shop item's price: a repeated doubling (mod 100) ramp
-	 * keyed off the item index, discounted by the player's combined
-	 * Intelligence+Charisma (a haggling mechanic)
+	 * Computes a shop item's price: a Fibonacci-style ramp (each step adds
+	 * the previous two prices, starting from 4 and 4) whose length grows
+	 * with the item index and shrinks by the bit length of the player's
+	 * combined Intelligence+Charisma (a haggling mechanic)
 	 */
 	int computeItemPrice(int itemIndex) const {
 		int sum = _intelligence + _charisma;
-		int discount = 0;
+		int bits = 0;
 		while (sum > 0) {
 			sum >>= 1;
-			++discount;
+			++bits;
 		}
-		if (discount > 8)
-			discount = 8;
-
-		int effIndex = itemIndex + 8 - discount;
-		if (effIndex < 0)
-			effIndex = 0;
 
-		int price = 4;
-		for (int i = 0; i < effIndex; ++i)
-			price = (price * 2) % 100;
+		int steps = itemIndex + 8 - bits;
+		int prev = 4, price = 4;
+		for (int i = 0; i < steps; ++i) {
+			int next = (prev + price) % 10000;
+			prev = price;
+			price = next;
+		}
 		return price;
 	}
 };
diff --git a/engines/ultima/ultima2/logic/city_castle_logic.cpp b/engines/ultima/ultima2/logic/city_castle_logic.cpp
index 0c06dfd4b73..14b2e1a72e5 100644
--- a/engines/ultima/ultima2/logic/city_castle_logic.cpp
+++ b/engines/ultima/ultima2/logic/city_castle_logic.cpp
@@ -447,9 +447,8 @@ bool CityCastleLogic::openShopForCurrentQuadrant() {
 
 	// bottom-right
 	if (isTown) {
-		writeString("RIDE SWIFTLY!\n");
-		trySpendGold(sg.computeItemPrice(4));
-		return true;
+		g_engine->addView("Transport");
+		return false;
 	}
 	if (sg._class != Data::CLASS_CLERIC) {
 		writeString(" YOU ARE NOT A CLERIC!\n");
diff --git a/engines/ultima/ultima2/views/interactions/transport.cpp b/engines/ultima/ultima2/views/interactions/transport.cpp
new file mode 100644
index 00000000000..152f3e7427d
--- /dev/null
+++ b/engines/ultima/ultima2/views/interactions/transport.cpp
@@ -0,0 +1,66 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "ultima/ultima2/views/interactions/transport.h"
+#include "ultima/ultima2/ultima2.h"
+#include "ultima/ultima2/metaengine.h"
+
+namespace Ultima {
+namespace Ultima2 {
+namespace Views {
+namespace Interactions {
+
+constexpr int HORSE_PRICE_INDEX = 4;
+
+Transport::Transport() : Interaction("Transport") {
+}
+
+bool Transport::msgFocus(const FocusMessage &msg) {
+	MetaEngine::setKeybindingMode(KBMODE_MINIMAL);
+	_price = _G(savegame).computeItemPrice(HORSE_PRICE_INDEX);
+	writeString("WELCOME, TO THE TRANSPORT\nSHOPPE. I SELL YOU HORSE %.4d\nGOLD, DEAL, OK? --- ", _price);
+
+	return Interaction::msgFocus(msg);
+}
+
+bool Transport::msgKeypress(const KeypressMessage &msg) {
+	if (msg.ascii == 0)
+		return true;
+
+	char key = toupper(msg.ascii);
+	writeString("%c\n", key);
+	close();
+
+	if (key != 'Y') {
+		writeString("\nO.K. BYE THEN...\n");
+	} else if (_G(logic)->trySpendGold(_price)) {
+		writeString("\nRIDE SWIFTLY!\n");
+		_G(savegame)._mount = Data::TILE_HORSE;
+	}
+
+	_G(logic)->resumeTurn();
+	return true;
+}
+
+} // namespace Interactions
+} // namespace Views
+} // namespace Ultima2
+} // namespace Ultima
diff --git a/engines/ultima/ultima2/views/interactions/transport.h b/engines/ultima/ultima2/views/interactions/transport.h
new file mode 100644
index 00000000000..9db04473dd7
--- /dev/null
+++ b/engines/ultima/ultima2/views/interactions/transport.h
@@ -0,0 +1,52 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef ULTIMA2_VIEWS_INTERACTIONS_TRANSPORT_H
+#define ULTIMA2_VIEWS_INTERACTIONS_TRANSPORT_H
+
+#include "ultima/ultima2/views/interactions/interaction.h"
+
+namespace Ultima {
+namespace Ultima2 {
+namespace Views {
+namespace Interactions {
+
+/**
+ * The town transport shop's offer to sell the player a horse
+ */
+class Transport : public Interaction {
+private:
+	int _price = 0;
+
+public:
+	Transport();
+	~Transport() override {}
+
+	bool msgFocus(const FocusMessage &msg) override;
+	bool msgKeypress(const KeypressMessage &msg) override;
+};
+
+} // namespace Interactions
+} // namespace Views
+} // namespace Ultima2
+} // namespace Ultima
+
+#endif
diff --git a/engines/ultima/ultima2/views/location_map.cpp b/engines/ultima/ultima2/views/location_map.cpp
index 0d0b50301ac..344d1da5bd7 100644
--- a/engines/ultima/ultima2/views/location_map.cpp
+++ b/engines/ultima/ultima2/views/location_map.cpp
@@ -112,7 +112,7 @@ void LocationMap::draw() {
 			}
 
 			if (ox == PLAYER_VIEWPORT_X && oy == PLAYER_VIEWPORT_Y)
-				tileId = (Data::TileId)(Data::TILE_FIGHTER + sg._class);
+				tileId = sg.playerTile();
 
 			s.blitFrom(_tiles[tileId], Common::Point(ox * TILE_WIDTH, oy * TILE_HEIGHT));
 		}
diff --git a/engines/ultima/ultima2/views/overworld_map.cpp b/engines/ultima/ultima2/views/overworld_map.cpp
index 8182c7694a9..808f8af11ac 100644
--- a/engines/ultima/ultima2/views/overworld_map.cpp
+++ b/engines/ultima/ultima2/views/overworld_map.cpp
@@ -108,7 +108,7 @@ void OverworldMap::draw() {
 			}
 
 			if (ox == PLAYER_VIEWPORT_X && oy == PLAYER_VIEWPORT_Y)
-				tileId = (Data::TileId)(Data::TILE_FIGHTER + sg._class);
+				tileId = sg.playerTile();
 
 			s.blitFrom(_tiles[tileId], Common::Point(ox * TILE_WIDTH, oy * TILE_HEIGHT));
 		}
diff --git a/engines/ultima/ultima2/views/views.h b/engines/ultima/ultima2/views/views.h
index f83d05ff085..5144701a9a3 100644
--- a/engines/ultima/ultima2/views/views.h
+++ b/engines/ultima/ultima2/views/views.h
@@ -36,6 +36,7 @@
 #include "ultima/ultima2/views/interactions/ready_spell.h"
 #include "ultima/ultima2/views/interactions/ready_weapon.h"
 #include "ultima/ultima2/views/interactions/shop.h"
+#include "ultima/ultima2/views/interactions/transport.h"
 #include "ultima/ultima2/views/interactions/wear_armor.h"
 #include "ultima/ultima2/views/interactions/yell.h"
 
@@ -48,6 +49,7 @@ struct Views : public Shared::Views {
 	Interactions::OfferGold _offerGold;
 	Interactions::ReadySpell _readySpell;
 	Interactions::ReadyWeapon _readyWeapon;
+	Interactions::Transport _transport;
 	Interactions::WearArmor _wearArmor;
 	Interactions::Yell _yell;
 	Interactions::Shop _weaponShop{Interactions::Shop::WEAPON, "WeaponShop"};


Commit: 7926138f2ff787eb1712fd6f060d3a4af647ab2f
    https://github.com/scummvm/scummvm/commit/7926138f2ff787eb1712fd6f060d3a4af647ab2f
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:40:55+11:00

Commit Message:
ULTIMA: ULTIMA2: Implement the town and village shops, NPC dialogue and tithe altar

Changed paths:
  A engines/ultima/ultima2/views/interactions/clue_seller.cpp
  A engines/ultima/ultima2/views/interactions/clue_seller.h
  A engines/ultima/ultima2/views/interactions/food_shop.cpp
  A engines/ultima/ultima2/views/interactions/food_shop.h
  A engines/ultima/ultima2/views/interactions/pub.cpp
  A engines/ultima/ultima2/views/interactions/pub.h
    engines/ultima/module.mk
    engines/ultima/ultima2/data/map.cpp
    engines/ultima/ultima2/data/map.h
    engines/ultima/ultima2/logic/city_castle_logic.cpp
    engines/ultima/ultima2/views/interactions/shop.cpp
    engines/ultima/ultima2/views/interactions/shop.h
    engines/ultima/ultima2/views/views.h


diff --git a/engines/ultima/module.mk b/engines/ultima/module.mk
index 9f2d8d1462c..63f8afec923 100644
--- a/engines/ultima/module.mk
+++ b/engines/ultima/module.mk
@@ -134,8 +134,11 @@ MODULE_OBJS += \
 	ultima2/views/world_map_overview.o \
 	ultima2/views/zstats.o \
 	ultima2/views/interactions/interaction.o \
+	ultima2/views/interactions/clue_seller.o \
 	ultima2/views/interactions/direction.o \
+	ultima2/views/interactions/food_shop.o \
 	ultima2/views/interactions/offer_gold.o \
+	ultima2/views/interactions/pub.o \
 	ultima2/views/interactions/ready_spell.o \
 	ultima2/views/interactions/ready_weapon.o \
 	ultima2/views/interactions/shop.o \
diff --git a/engines/ultima/ultima2/data/map.cpp b/engines/ultima/ultima2/data/map.cpp
index 3aa6d3f31fd..0cd7db19a53 100644
--- a/engines/ultima/ultima2/data/map.cpp
+++ b/engines/ultima/ultima2/data/map.cpp
@@ -38,6 +38,41 @@ Common::String monsterFilename(int mapEra, int mapType) {
 	return Common::String::format("MONX%c%c", '0' + mapEra, '0' + mapType);
 }
 
+Common::String talkFilename(int mapEra, int mapType) {
+	return Common::String::format("TLKX%c%c", '0' + mapEra, '0' + mapType);
+}
+
+void Map::loadTalk(int mapEra, int mapType) {
+	_talk.clear();
+
+	Common::File f;
+	if (!f.open(talkFilename(mapEra, mapType).c_str()))
+		return;
+
+	// Zero-terminated strings with the high bit set on every character,
+	// after a leading zero, so line 1 is the first string
+	byte buffer[256] = {};
+	f.read(buffer, sizeof(buffer));
+
+	Common::String line;
+	_talk.push_back(line);
+	for (int i = 1; i < 256; ++i) {
+		if (buffer[i] == 0) {
+			_talk.push_back(line);
+			line.clear();
+		} else {
+			line += (char)(buffer[i] & 0x7F);
+		}
+	}
+
+	for (uint i = 0; i < _talk.size(); ++i) {
+		for (uint j = 0; j < _talk[i].size(); ++j) {
+			if (_talk[i][j] == '\r')
+				_talk[i].setChar('\n', j);
+		}
+	}
+}
+
 void Map::load(int mapEra, int mapType) {
 	Common::File f;
 	Common::String filename = mapFilename(mapEra, mapType);
@@ -50,6 +85,7 @@ void Map::load(int mapEra, int mapType) {
 	}
 
 	_monsters.load(mapEra, mapType);
+	loadTalk(mapEra, mapType);
 
 	// The files store each monster's tile baked into the map; restore the
 	// terrain underneath, since monsters are tracked and drawn separately
diff --git a/engines/ultima/ultima2/data/map.h b/engines/ultima/ultima2/data/map.h
index 9968f855a9b..4b4299a1638 100644
--- a/engines/ultima/ultima2/data/map.h
+++ b/engines/ultima/ultima2/data/map.h
@@ -22,6 +22,7 @@
 #ifndef ULTIMA2_DATA_MAP_H
 #define ULTIMA2_DATA_MAP_H
 
+#include "common/array.h"
 #include "common/str.h"
 #include "ultima/ultima2/data/tiles.h"
 #include "ultima/ultima2/data/map_monsters.h"
@@ -36,6 +37,7 @@ constexpr int MAP_HEIGHT = 64;
 // Both build "MAPXnn"/"MONXnn" from the same two map-number digits
 Common::String mapFilename(int mapEra, int mapType);
 Common::String monsterFilename(int mapEra, int mapType);
+Common::String talkFilename(int mapEra, int mapType);
 
 /**
  * A planet, village, town, or castle's map: a flat 64x64 grid of tiles,
@@ -46,9 +48,22 @@ Common::String monsterFilename(int mapEra, int mapType);
 struct Map {
 	TileId _tiles[MAP_HEIGHT][MAP_WIDTH] = {};
 	MapMonsters _monsters;
+	Common::Array<Common::String> _talk;
 
+private:
+	void loadTalk(int mapEra, int mapType);
+
+public:
 	void load(int mapEra, int mapType);
 
+	/**
+	 * Returns the given line of the map's NPC dialogue, or an empty string
+	 * if there isn't one
+	 */
+	Common::String talkString(int index) const {
+		return (index >= 0 && index < (int)_talk.size()) ? _talk[index] : Common::String();
+	}
+
 	TileId tileAt(int x, int y) const {
 		return _tiles[y][x];
 	}
diff --git a/engines/ultima/ultima2/logic/city_castle_logic.cpp b/engines/ultima/ultima2/logic/city_castle_logic.cpp
index 14b2e1a72e5..26e668b76af 100644
--- a/engines/ultima/ultima2/logic/city_castle_logic.cpp
+++ b/engines/ultima/ultima2/logic/city_castle_logic.cpp
@@ -232,7 +232,7 @@ bool CityCastleLogic::steal(Data::Direction dir) {
 	case 1: // Village
 		if (sg._mapY < 32 && sg._mapX >= 32) {
 			writeString("STEAL FOOD!\n");
-			++sg._food;
+			sg._food = MIN(sg._food + 100, 9999);
 		} else {
 			noLuck();
 		}
@@ -392,19 +392,15 @@ void CityCastleLogic::completeOffer(int goldHundreds) {
 
 bool CityCastleLogic::tithe() {
 	Data::Savegame &sg = _G(savegame);
-	if (sg._class != Data::CLASS_CLERIC) {
-		writeString(" YOU ARE NOT A CLERIC!\n");
-		return true;
-	}
-
-	writeString("WELCOME %s\n", sg._name);
-	writeString("FIRST MY 50 G.P. TRIBUTE!\n");
+	writeString("WELCOME MY CHILD %s\nFIRST MY 50 G.P. TRIBUTE!\n", sg._name);
 	if (!trySpendGold(50))
 		return true;
 
-	int heal = (sg._hp < 50) ? 3 : (sg._hp < 75) ? 2 : (sg._hp < 99) ? 1 : 0;
-	sg._hp += heal;
-	writeString("AND FOR IT I RAISE THEE %d\n", heal);
+	// The raise is in hundreds of hit points, and shrinks as HP grows
+	int hundreds = sg._hp / 100;
+	int heal = (hundreds < 50) ? 3 : (hundreds < 75) ? 2 : (hundreds < 99) ? 1 : 0;
+	sg._hp = MIN(sg._hp + heal * 100, 9999);
+	writeString("AND FOR IT I RAISE THEE %.4d\n", heal * 100);
 	return true;
 }
 
@@ -425,7 +421,11 @@ bool CityCastleLogic::openShopForCurrentQuadrant() {
 
 	if (!top && left) {
 		if (isTown) {
-			writeString("WELCOME TO THE PUB!\n");
+			g_engine->addView("Pub");
+			return false;
+		}
+		if (sg._class != Data::CLASS_WIZARD) {
+			writeString("%s YOU ARE NOT A WIZARD!\n", sg._name);
 			return true;
 		}
 		g_engine->addView("WizardSpellShop");
@@ -437,12 +437,8 @@ bool CityCastleLogic::openShopForCurrentQuadrant() {
 			g_engine->addView("ArmorShop");
 			return false;
 		}
-		writeString("PER 100, WANT ONE? ");
-		if (!trySpendGold(sg.computeItemPrice(3)))
-			return true;
-		++sg._food;
-		writeString("\nOK!\n");
-		return true;
+		g_engine->addView("FoodShop");
+		return false;
 	}
 
 	// bottom-right
@@ -451,7 +447,7 @@ bool CityCastleLogic::openShopForCurrentQuadrant() {
 		return false;
 	}
 	if (sg._class != Data::CLASS_CLERIC) {
-		writeString(" YOU ARE NOT A CLERIC!\n");
+		writeString("%s YOU ARE NOT A CLERIC!\n", sg._name);
 		return true;
 	}
 	g_engine->addView("ClericSpellShop");
@@ -484,8 +480,13 @@ bool CityCastleLogic::transact(Data::Direction dir) {
 
 	if (slot > 0) {
 		Data::MapMonsters &monsters = _G(map)._monsters;
-		if ((int8)monsters._offerFlag[slot] < 0)
-			return openShopForCurrentQuadrant();
+		byte flag = monsters._offerFlag[slot];
+		if (flag >= 0x80) {
+			writeString("%s\n", _G(map).talkString(flag - 0x80).c_str());
+			if (sg._orbitTarget == 9 && sg._mapType == 3 && flag == 0x81)
+				sg._ringQuestFlag = true;
+			return true;
+		}
 
 		switch (monsters.tileType(slot)) {
 		case Data::TILE_TITHE_ALTAR:
diff --git a/engines/ultima/ultima2/views/interactions/clue_seller.cpp b/engines/ultima/ultima2/views/interactions/clue_seller.cpp
new file mode 100644
index 00000000000..a8d7a2a476c
--- /dev/null
+++ b/engines/ultima/ultima2/views/interactions/clue_seller.cpp
@@ -0,0 +1,72 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "ultima/ultima2/views/interactions/clue_seller.h"
+#include "ultima/ultima2/ultima2.h"
+#include "ultima/ultima2/metaengine.h"
+
+namespace Ultima {
+namespace Ultima2 {
+namespace Views {
+namespace Interactions {
+
+static const char *const CLUES[10] = {
+	"ASK ME NO QUESTIONS,\nI'LL TELL YOU NO LIES.",
+	"THE QUEEN IS THE KING\nAND THE KING IS A SPY.",
+	"THE EVIL MEN DO\nIS A HORRIBLE THING.",
+	"BUT DISPELLING MEANS\nTHAT YOU MUST HAVE THE RING.",
+	"JUST WHERE IT IS,\nI CANNOT SAY.",
+	"BUT I'LL TELL YOU RIGHT NOW,\nTHERE IS NO OTHER WAY.",
+	"I HEAR IN A TOWN\nWHERE THE WATER RUNS FREE.",
+	"THERE IS AN OLD MAN\nLIVING UNDER A TREE.",
+	"HE HAS NOT A NAME\nBUT HE DOES HAVE A CLUE",
+	"MAYHAPS IF YOU FIND HIM,\nHE'LL TELL IT TO YOU!"
+};
+
+ClueSeller::ClueSeller() : Interaction("ClueSeller") {
+}
+
+bool ClueSeller::msgFocus(const FocusMessage &msg) {
+	MetaEngine::setKeybindingMode(KBMODE_MINIMAL);
+	writeString("TIME AND TRAVEL MADE ME WISE,\nPRECIOUS GOLD, A CLUE IT BUYS!HOW MUCH WILL YOU PAY *100? ");
+
+	return Interaction::msgFocus(msg);
+}
+
+bool ClueSeller::msgKeypress(const KeypressMessage &msg) {
+	if (msg.ascii < '0' || msg.ascii > '9')
+		return true;
+
+	int digit = msg.ascii - '0';
+	writeString("%d\n", digit);
+	close();
+
+	if (_G(logic)->trySpendGold(digit * 100))
+		writeString("%s\n", CLUES[digit]);
+
+	_G(logic)->resumeTurn();
+	return true;
+}
+
+} // namespace Interactions
+} // namespace Views
+} // namespace Ultima2
+} // namespace Ultima
diff --git a/engines/ultima/ultima2/views/interactions/clue_seller.h b/engines/ultima/ultima2/views/interactions/clue_seller.h
new file mode 100644
index 00000000000..b47abd8a299
--- /dev/null
+++ b/engines/ultima/ultima2/views/interactions/clue_seller.h
@@ -0,0 +1,50 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef ULTIMA2_VIEWS_INTERACTIONS_CLUE_SELLER_H
+#define ULTIMA2_VIEWS_INTERACTIONS_CLUE_SELLER_H
+
+#include "ultima/ultima2/views/interactions/interaction.h"
+
+namespace Ultima {
+namespace Ultima2 {
+namespace Views {
+namespace Interactions {
+
+/**
+ * The village/castle clue seller: a chosen digit costs that many hundred
+ * gold and buys the rhyme with the same number
+ */
+class ClueSeller : public Interaction {
+public:
+	ClueSeller();
+	~ClueSeller() override {}
+
+	bool msgFocus(const FocusMessage &msg) override;
+	bool msgKeypress(const KeypressMessage &msg) override;
+};
+
+} // namespace Interactions
+} // namespace Views
+} // namespace Ultima2
+} // namespace Ultima
+
+#endif
diff --git a/engines/ultima/ultima2/views/interactions/food_shop.cpp b/engines/ultima/ultima2/views/interactions/food_shop.cpp
new file mode 100644
index 00000000000..a9f015889c2
--- /dev/null
+++ b/engines/ultima/ultima2/views/interactions/food_shop.cpp
@@ -0,0 +1,68 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "ultima/ultima2/views/interactions/food_shop.h"
+#include "ultima/ultima2/ultima2.h"
+#include "ultima/ultima2/metaengine.h"
+
+namespace Ultima {
+namespace Ultima2 {
+namespace Views {
+namespace Interactions {
+
+constexpr int FOOD_PRICE_INDEX = 3;
+constexpr int MAX_FOOD = 9999;
+
+FoodShop::FoodShop() : Interaction("FoodShop") {
+}
+
+bool FoodShop::msgFocus(const FocusMessage &msg) {
+	MetaEngine::setKeybindingMode(KBMODE_MINIMAL);
+	_price = _G(savegame).computeItemPrice(FOOD_PRICE_INDEX);
+	writeString("THE FOOD HERE COSTS %.4d\nPER 100, WANT ONE? ", _price);
+
+	return Interaction::msgFocus(msg);
+}
+
+bool FoodShop::msgKeypress(const KeypressMessage &msg) {
+	if (msg.ascii == 0)
+		return true;
+
+	close();
+	if (toupper(msg.ascii) != 'Y') {
+		writeString("NO\n");
+	} else {
+		writeString("YES,\nNO ONIONS AND TO GO PLEASE!\n");
+		if (_G(logic)->trySpendGold(_price)) {
+			Data::Savegame &sg = _G(savegame);
+			sg._food = MIN(sg._food + 100, MAX_FOOD);
+			writeString("THANK YOU, COME AGAIN!\n");
+		}
+	}
+
+	_G(logic)->resumeTurn();
+	return true;
+}
+
+} // namespace Interactions
+} // namespace Views
+} // namespace Ultima2
+} // namespace Ultima
diff --git a/engines/ultima/ultima2/views/interactions/food_shop.h b/engines/ultima/ultima2/views/interactions/food_shop.h
new file mode 100644
index 00000000000..fd7cfa4e057
--- /dev/null
+++ b/engines/ultima/ultima2/views/interactions/food_shop.h
@@ -0,0 +1,52 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef ULTIMA2_VIEWS_INTERACTIONS_FOOD_SHOP_H
+#define ULTIMA2_VIEWS_INTERACTIONS_FOOD_SHOP_H
+
+#include "ultima/ultima2/views/interactions/interaction.h"
+
+namespace Ultima {
+namespace Ultima2 {
+namespace Views {
+namespace Interactions {
+
+/**
+ * The village food seller, offering 100 food for a price
+ */
+class FoodShop : public Interaction {
+private:
+	int _price = 0;
+
+public:
+	FoodShop();
+	~FoodShop() override {}
+
+	bool msgFocus(const FocusMessage &msg) override;
+	bool msgKeypress(const KeypressMessage &msg) override;
+};
+
+} // namespace Interactions
+} // namespace Views
+} // namespace Ultima2
+} // namespace Ultima
+
+#endif
diff --git a/engines/ultima/ultima2/views/interactions/pub.cpp b/engines/ultima/ultima2/views/interactions/pub.cpp
new file mode 100644
index 00000000000..ac3544ab04c
--- /dev/null
+++ b/engines/ultima/ultima2/views/interactions/pub.cpp
@@ -0,0 +1,100 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "ultima/ultima2/views/interactions/pub.h"
+#include "ultima/ultima2/ultima2.h"
+#include "ultima/ultima2/metaengine.h"
+
+namespace Ultima {
+namespace Ultima2 {
+namespace Views {
+namespace Interactions {
+
+static const char *const HINTS[10] = {
+	"CAUGH...",
+	"ISN'T THIS A GREAT GAME?",
+	"HHMMM...",
+	"SOME FIGHTERS WEAR MAGIC HELMS!",
+	"AVIATORS USE SKULL KEYS!",
+	"SAYLORS WEAR BLUE TASSLES!",
+	"MAGES CARRY WANDS OR STAFFS!",
+	"GUARDS CARRY KEYS!",
+	"ANKHS OPEN SPACE!",
+	"PLANES NEED BRASS BUTTONS!"
+};
+
+constexpr int DRINK_PRICE = 5;
+
+Pub::Pub() : Interaction("Pub") {
+}
+
+bool Pub::msgFocus(const FocusMessage &msg) {
+	MetaEngine::setKeybindingMode(KBMODE_MINIMAL);
+	_state = MENU;
+	writeString("WELCOME TO THE PUB!\n1-BUY, 2-TIP --- ");
+
+	return Interaction::msgFocus(msg);
+}
+
+void Pub::barkeepSays(int hint) {
+	writeString("THE BARKEEP SAYS:\n%s\n", HINTS[hint]);
+}
+
+bool Pub::msgKeypress(const KeypressMessage &msg) {
+	if (msg.ascii < '0' || msg.ascii > '9')
+		return true;
+
+	int digit = msg.ascii - '0';
+	writeString("%d\n", digit);
+
+	if (_state == MENU) {
+		if (digit == 2) {
+			writeString("TIP HOW MUCH? ");
+			_state = TIP;
+			return true;
+		}
+
+		close();
+		if (digit == 1 && _G(logic)->trySpendGold(DRINK_PRICE)) {
+			writeString("HERE, HAVE A STRONG ONE!\n");
+			g_engine->randByte();
+			barkeepSays(1);
+		}
+	} else {
+		close();
+		if (_G(logic)->trySpendGold(digit)) {
+			// A bigger tip moves the hint further along the list, with a
+			// random -1/0/+1 wobble; running off either end gives the first
+			int8 roll = (int8)g_engine->randByte();
+			int wobble = (roll > 0) - (roll < 0);
+			byte hint = (byte)(digit + wobble);
+			barkeepSays(hint < 10 ? hint : 0);
+		}
+	}
+
+	_G(logic)->resumeTurn();
+	return true;
+}
+
+} // namespace Interactions
+} // namespace Views
+} // namespace Ultima2
+} // namespace Ultima
diff --git a/engines/ultima/ultima2/views/interactions/pub.h b/engines/ultima/ultima2/views/interactions/pub.h
new file mode 100644
index 00000000000..4182837fae1
--- /dev/null
+++ b/engines/ultima/ultima2/views/interactions/pub.h
@@ -0,0 +1,55 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef ULTIMA2_VIEWS_INTERACTIONS_PUB_H
+#define ULTIMA2_VIEWS_INTERACTIONS_PUB_H
+
+#include "ultima/ultima2/views/interactions/interaction.h"
+
+namespace Ultima {
+namespace Ultima2 {
+namespace Views {
+namespace Interactions {
+
+/**
+ * The town pub, where a drink or a tip buys a hint from the barkeep
+ */
+class Pub : public Interaction {
+private:
+	enum State { MENU, TIP };
+	State _state = MENU;
+
+	void barkeepSays(int hint);
+
+public:
+	Pub();
+	~Pub() override {}
+
+	bool msgFocus(const FocusMessage &msg) override;
+	bool msgKeypress(const KeypressMessage &msg) override;
+};
+
+} // namespace Interactions
+} // namespace Views
+} // namespace Ultima2
+} // namespace Ultima
+
+#endif
diff --git a/engines/ultima/ultima2/views/interactions/shop.cpp b/engines/ultima/ultima2/views/interactions/shop.cpp
index f64e1c337ba..10a7fcce729 100644
--- a/engines/ultima/ultima2/views/interactions/shop.cpp
+++ b/engines/ultima/ultima2/views/interactions/shop.cpp
@@ -21,6 +21,7 @@
 
 #include "ultima/ultima2/views/interactions/shop.h"
 #include "ultima/ultima2/ultima2.h"
+#include "ultima/ultima2/metaengine.h"
 
 namespace Ultima {
 namespace Ultima2 {
@@ -30,72 +31,144 @@ namespace Interactions {
 Shop::Shop(Kind kind, const Common::String &name) : Interaction(name), _kind(kind) {
 }
 
-int Shop::priceIndexForDigit(int digit) const {
+bool Shop::isValidChoice(int digit) const {
 	switch (_kind) {
-	case ARMOR:
-		return digit * 2;
-	case SPELL_WIZARD:
-		return (digit >= 4) ? digit + 3 : digit;
+	case WEAPON:
+		return digit >= 1 && digit <= 8;
 	default:
-		return digit;
+		return digit >= 1 && digit <= 6;
 	}
 }
 
 bool Shop::msgFocus(const FocusMessage &msg) {
+	MetaEngine::setKeybindingMode(KBMODE_MINIMAL);
+	_state = CHOOSE;
+	Data::Savegame &sg = _G(savegame);
+
 	switch (_kind) {
 	case WEAPON:
-		writeString("WEAPON SHOPPE\n1-DA,2-MA,3-AX,4-BO,5-SW,6-GR,7-LI,8-PH\nWHICH? ");
+		writeString("  THE WEAPONS SHOPPE:\n1-DA, 2-MA, 3-AX, 4-BO,\n5-SW, 6-GR, 7-LI, 8-PH.\nYOUR INTEREST? ");
 		break;
 	case ARMOR:
-		writeString("ARMOUR SHOPPE\n1-CLOTH,2-LEATHER,3-CHAIN,\n4-PLATE,5-REFLECT,6-POWER\nWHICH? ");
+		writeString("     THE ARMOUR SHOPPE:\n1-CLOTH, 2-LEATHER, 3-CHAIN,\n4-PLATE, 5-REFLECT, 6-POWER,\nYOUR INTEREST? ");
 		break;
 	case SPELL_CLERIC:
-		writeString("MAGIC SHOPPE\n1-LIGHT,2-L.D.,3-L.U.,\n4-PASS,5-SURFACE,6-PRAYER\nWHICH? ");
+		writeString("WELCOME %s%s\n1-LIGHT, 2-L.D., 3-L.U.,\n4-PASS 5-SURFACE, 6-PRAYER.\nYOUR INTEREST? ",
+			sg._sex == Data::SEX_FEMALE ? "SISTER " : "BROTHER ", sg._name);
 		break;
 	case SPELL_WIZARD:
-		writeString("MAGIC SHOPPE\n1-LIGHT,2-L.D.,3-L.U.,\n4-M.M.,5-BLINK,6-KILL\nWHICH? ");
+		writeString("%s MUSERREF OLDUM!\n1-LIGHT, 2-L.D., 3-L.U.,\n4-M.M., 5-BLINK, 6-KILL,\nBIR IKI UC...? ", sg._name);
 		break;
 	}
 
 	return Interaction::msgFocus(msg);
 }
 
-bool Shop::msgKeypress(const KeypressMessage &msg) {
-	if (msg.ascii < '0' || msg.ascii > '9')
-		return true;
+void Shop::finish(const char *message) {
+	close();
+	writeString("%s\n", message);
+	_G(logic)->resumeTurn();
+}
+
+void Shop::chooseItem(int digit) {
+	writeString("%d\n", digit);
 
-	int digit = msg.ascii - '0';
+	if (!isValidChoice(digit)) {
+		switch (_kind) {
+		case WEAPON:
+		case ARMOR:
+			finish("THANKS FOR COMING BY...");
+			break;
+		case SPELL_CLERIC:
+			finish("FOLLOW THE LIGHT, FRIEND!");
+			break;
+		case SPELL_WIZARD:
+			finish("\nUGURLA OLSUN!");
+			break;
+		}
+		return;
+	}
+
+	Data::Savegame &sg = _G(savegame);
+	switch (_kind) {
+	case WEAPON:
+		_item = digit;
+		_price = sg.computeItemPrice(_item);
+		writeString("AH! YES! A %s\nFOR YOU ONLY %.4d\nHOW 'BOUT IT? ", Data::WEAPON_NAMES[_item], _price);
+		break;
+	case ARMOR:
+		_item = digit;
+		_price = sg.computeItemPrice(_item * 2);
+		writeString("AH! YES! %s\nFOR YOU ONLY %.4d\nHOW 'BOUT IT? ", Data::ARMOR_NAMES[_item], _price);
+		break;
+	case SPELL_CLERIC:
+	case SPELL_WIZARD:
+		_item = (_kind == SPELL_WIZARD && digit >= 4) ? digit + 3 : digit;
+		_price = sg.computeItemPrice(_item);
+		writeString("FIVE %sS FOR %.4d\n%s ", Data::SPELL_NAMES[_item], _price,
+			_kind == SPELL_CLERIC ? "YES, FRIEND?" : "LUTFEN EVET?");
+		break;
+	}
+
+	_state = CONFIRM;
+}
+
+void Shop::confirm(char key) {
+	Data::Savegame &sg = _G(savegame);
+	bool yes = key == 'Y';
 	close();
 
-	if (digit != 0 && digit <= 6) {
-		Data::Savegame &sg = _G(savegame);
-		int price = sg.computeItemPrice(priceIndexForDigit(digit));
-
-		if (_G(logic)->trySpendGold(price)) {
-			switch (_kind) {
-			case WEAPON:
-				++sg._weaponOwned[digit];
-				writeString("%s READY.\n", Data::WEAPON_NAMES[digit]);
-				break;
-			case ARMOR:
-				++sg._armorOwned[digit];
-				writeString("%s READY.\n", Data::ARMOR_NAMES[digit]);
-				break;
-			case SPELL_CLERIC:
-				sg._spellCharges[digit] += 5;
-				writeString("%s CHARGED.\n", Data::SPELL_NAMES[digit]);
-				break;
-			case SPELL_WIZARD: {
-				int spellIdx = (digit >= 4) ? digit + 3 : digit;
-				sg._spellCharges[spellIdx] += 5;
-				writeString("%s CHARGED.\n", Data::SPELL_NAMES[spellIdx]);
-				break;
+	switch (_kind) {
+	case WEAPON:
+	case ARMOR:
+		writeString("%c\n", key);
+		if (!yes) {
+			writeString("OH, WELL.\n");
+		} else if (_G(logic)->trySpendGold(_price)) {
+			if (_kind == WEAPON)
+				++sg._weaponOwned[_item];
+			else
+				++sg._armorOwned[_item];
+			writeString("SOLD!\n");
+		}
+		break;
+
+	case SPELL_CLERIC:
+		if (!yes) {
+			writeString("NO\nI'M SORRY, GOOD DAY.\n");
+		} else {
+			writeString("YES,\nI WILL TAKE 5!");
+			if (_G(logic)->trySpendGold(_price)) {
+				sg._spellCharges[_item] += 5;
+				writeString("\n");
 			}
+		}
+		break;
+
+	case SPELL_WIZARD:
+		if (!yes) {
+			writeString("NO!\nUGURLA OLSUN!\n");
+		} else {
+			writeString("YES\n");
+			if (_G(logic)->trySpendGold(_price)) {
+				sg._spellCharges[_item] += 5;
+				writeString("GULE GULE!\n");
 			}
 		}
+		break;
 	}
 
 	_G(logic)->resumeTurn();
+}
+
+bool Shop::msgKeypress(const KeypressMessage &msg) {
+	if (_state == CHOOSE) {
+		if (msg.ascii >= '0' && msg.ascii <= '9')
+			chooseItem(msg.ascii - '0');
+	} else if (msg.ascii != 0) {
+		confirm(toupper(msg.ascii));
+	}
+
 	return true;
 }
 
diff --git a/engines/ultima/ultima2/views/interactions/shop.h b/engines/ultima/ultima2/views/interactions/shop.h
index 527026d616c..6ec531fb1ab 100644
--- a/engines/ultima/ultima2/views/interactions/shop.h
+++ b/engines/ultima/ultima2/views/interactions/shop.h
@@ -30,20 +30,28 @@ namespace Views {
 namespace Interactions {
 
 /**
- * A generic numbered-menu shop: prints an item list, reads a digit, and
- * on a nonzero digit computes the price (Savegame::computeItemPrice),
- * charges gold, and grants the item. Covers the weapon/armour/cleric-
- * spell/wizard-spell shoppes, which all share this exact shape and only
- * differ in their item list, price-index mapping, and target array
+ * A numbered-menu shop: prints an item list, reads a digit, quotes a price
+ * (Savegame::computeItemPrice) and, if the player agrees, charges gold and
+ * grants the item. Covers the weapon, armour, cleric-spell and wizard-spell
+ * shoppes, which share this shape and differ in their wording, item list,
+ * price-index mapping and target array
  */
 class Shop : public Interaction {
 public:
 	enum Kind { WEAPON, ARMOR, SPELL_CLERIC, SPELL_WIZARD };
 
 private:
+	enum State { CHOOSE, CONFIRM };
+
 	Kind _kind;
+	State _state = CHOOSE;
+	int _item = 0;
+	int _price = 0;
 
-	int priceIndexForDigit(int digit) const;
+	bool isValidChoice(int digit) const;
+	void finish(const char *message);
+	void chooseItem(int digit);
+	void confirm(char key);
 
 public:
 	Shop(Kind kind, const Common::String &name);
diff --git a/engines/ultima/ultima2/views/views.h b/engines/ultima/ultima2/views/views.h
index 5144701a9a3..f5600ba612b 100644
--- a/engines/ultima/ultima2/views/views.h
+++ b/engines/ultima/ultima2/views/views.h
@@ -31,8 +31,11 @@
 #include "ultima/ultima2/views/title.h"
 #include "ultima/ultima2/views/world_map_overview.h"
 #include "ultima/ultima2/views/zstats.h"
+#include "ultima/ultima2/views/interactions/clue_seller.h"
 #include "ultima/ultima2/views/interactions/direction.h"
+#include "ultima/ultima2/views/interactions/food_shop.h"
 #include "ultima/ultima2/views/interactions/offer_gold.h"
+#include "ultima/ultima2/views/interactions/pub.h"
 #include "ultima/ultima2/views/interactions/ready_spell.h"
 #include "ultima/ultima2/views/interactions/ready_weapon.h"
 #include "ultima/ultima2/views/interactions/shop.h"
@@ -45,8 +48,11 @@ namespace Ultima2 {
 namespace Views {
 
 struct Views : public Shared::Views {
+	Interactions::ClueSeller _clueSeller;
 	Interactions::Direction _direction;
+	Interactions::FoodShop _foodShop;
 	Interactions::OfferGold _offerGold;
+	Interactions::Pub _pub;
 	Interactions::ReadySpell _readySpell;
 	Interactions::ReadyWeapon _readyWeapon;
 	Interactions::Transport _transport;


Commit: ccf7fc14a93e95a640f5cba0fcd4cf0a8bb46d34
    https://github.com/scummvm/scummvm/commit/ccf7fc14a93e95a640f5cba0fcd4cf0a8bb46d34
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:40:55+11:00

Commit Message:
ULTIMA: ULTIMA2: Separate Dead view

Changed paths:
  A engines/ultima/ultima2/views/interactions/dead.cpp
  A engines/ultima/ultima2/views/interactions/dead.h
    engines/ultima/module.mk
    engines/ultima/ultima2/logic/logic.cpp
    engines/ultima/ultima2/ultima2.cpp
    engines/ultima/ultima2/ultima2.h
    engines/ultima/ultima2/views/interactions/interaction.cpp
    engines/ultima/ultima2/views/views.h


diff --git a/engines/ultima/module.mk b/engines/ultima/module.mk
index 63f8afec923..61baaae533a 100644
--- a/engines/ultima/module.mk
+++ b/engines/ultima/module.mk
@@ -135,6 +135,7 @@ MODULE_OBJS += \
 	ultima2/views/zstats.o \
 	ultima2/views/interactions/interaction.o \
 	ultima2/views/interactions/clue_seller.o \
+	ultima2/views/interactions/dead.o \
 	ultima2/views/interactions/direction.o \
 	ultima2/views/interactions/food_shop.o \
 	ultima2/views/interactions/offer_gold.o \
diff --git a/engines/ultima/ultima2/logic/logic.cpp b/engines/ultima/ultima2/logic/logic.cpp
index 3449b5fdb27..3c6295cee21 100644
--- a/engines/ultima/ultima2/logic/logic.cpp
+++ b/engines/ultima/ultima2/logic/logic.cpp
@@ -51,21 +51,16 @@ void Logic::redrawMap() {
 }
 
 void Logic::redrawStats() {
-	g_engine->baseView()->findView("Stats")->draw();
+	auto *view = g_engine->baseView()->findView("Stats");
+	if (view)
+		view->draw();
 }
 
 void Logic::playerDied() {
 	Data::Savegame &sg = _G(savegame);
 	writeString("\n%s IS DEAD!\n", sg._name);
 
-	sg._hp = 0;
-	sg._food = 0;
-	sg._foodTurnCtr = 0;
-	sg._experience = 0;
-	sg._gold = 0;
-
-	// UIElement* overload used directly since the string-name one drops replaceAllViews
-	g_engine->replaceView(g_engine->findView("Title"), true);
+	g_engine->replaceView("Dead", true);
 }
 
 void Logic::alertTownGuards(int extraSlot) {
diff --git a/engines/ultima/ultima2/ultima2.cpp b/engines/ultima/ultima2/ultima2.cpp
index 99b4fab6d19..eaa0c677f60 100644
--- a/engines/ultima/ultima2/ultima2.cpp
+++ b/engines/ultima/ultima2/ultima2.cpp
@@ -27,6 +27,7 @@
 #include "ultima/ultima2/metaengine.h"
 #include "ultima/ultima2/views/views.h"
 #include "ultima/ultima2/views/map.h"
+#include "ultima/ultima2/views/interactions/dead.h"
 
 namespace Ultima {
 namespace Ultima2 {
@@ -87,6 +88,10 @@ bool Ultima2Engine::canSaveGameStateCurrently(Common::U32String *msg) {
 	return dynamic_cast<Views::Map *>(focusedView()) != nullptr;
 }
 
+bool Ultima2Engine::canLoadGameStateCurrently(Common::U32String *msg) {
+	return canSaveGameStateCurrently() || dynamic_cast<Views::Interactions::Dead *>(focusedView()) != nullptr;
+}
+
 Common::Error Ultima2Engine::syncGame(Common::Serializer &s) {
 	_savegame.synchronize(s);
 
diff --git a/engines/ultima/ultima2/ultima2.h b/engines/ultima/ultima2/ultima2.h
index f7b8eee0bc4..08489e1dd23 100644
--- a/engines/ultima/ultima2/ultima2.h
+++ b/engines/ultima/ultima2/ultima2.h
@@ -89,10 +89,8 @@ public:
 			(f == kSupportsReturnToLauncher);
 	};
 
-	bool canLoadGameStateCurrently(Common::U32String *msg = nullptr) override {
-		return true;
-	}
 	bool canSaveGameStateCurrently(Common::U32String *msg = nullptr) override;
+	bool canLoadGameStateCurrently(Common::U32String *msg = nullptr) override;
 
 	/**
 	 * Uses a serializer to allow implementing savegame
diff --git a/engines/ultima/ultima2/views/interactions/dead.cpp b/engines/ultima/ultima2/views/interactions/dead.cpp
new file mode 100644
index 00000000000..d61b76f9a41
--- /dev/null
+++ b/engines/ultima/ultima2/views/interactions/dead.cpp
@@ -0,0 +1,54 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "ultima/ultima2/views/interactions/dead.h"
+#include "ultima/ultima2/ultima2.h"
+
+namespace Ultima {
+namespace Ultima2 {
+namespace Views {
+namespace Interactions {
+
+bool Dead::msgFocus(const FocusMessage &msg) {
+	auto &sg = _G(savegame);
+	sg._hp = 0;
+	sg._food = 0;
+	sg._foodTurnCtr = 0;
+	sg._experience = 0;
+	sg._gold = 0;
+
+	return true;
+}
+
+bool Dead::msgAction(const ActionMessage &msg) {
+	g_engine->replaceView("Title", true);
+	return true;
+}
+
+bool Dead::msgKeypress(const KeypressMessage &msg) {
+	g_engine->replaceView("Title", true);
+	return true;
+}
+
+} // namespace Interactions
+} // namespace Views
+} // namespace Ultima2
+} // namespace Ultima
diff --git a/engines/ultima/ultima2/views/interactions/dead.h b/engines/ultima/ultima2/views/interactions/dead.h
new file mode 100644
index 00000000000..0ecfd47d3af
--- /dev/null
+++ b/engines/ultima/ultima2/views/interactions/dead.h
@@ -0,0 +1,55 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef ULTIMA2_VIEWS_INTERACTIONS_DEAD_H
+#define ULTIMA2_VIEWS_INTERACTIONS_DEAD_H
+
+#include "ultima/ultima2/views/interactions/interaction.h"
+
+namespace Ultima {
+namespace Ultima2 {
+namespace Views {
+namespace Interactions {
+
+using namespace Ultima::Shared::Messages;
+
+/**
+ * Shown when the player dies, to allow them time to see the death message
+ */
+class Dead : public Interaction {
+public:
+	Dead() : Interaction("Dead") {
+	}
+	~Dead() override {
+	}
+
+	bool msgFocus(const FocusMessage &msg) override;
+	bool msgAction(const ActionMessage &msg) override;
+	bool msgKeypress(const KeypressMessage &msg) override;
+	bool tick() override { return true; }
+};
+
+} // namespace Interactions
+} // namespace Views
+} // namespace Ultima2
+} // namespace Ultima
+
+#endif
diff --git a/engines/ultima/ultima2/views/interactions/interaction.cpp b/engines/ultima/ultima2/views/interactions/interaction.cpp
index 94caac16eb3..41ccdd88fd3 100644
--- a/engines/ultima/ultima2/views/interactions/interaction.cpp
+++ b/engines/ultima/ultima2/views/interactions/interaction.cpp
@@ -32,7 +32,10 @@ Interaction::Interaction(const Common::String &name) : View(name) {
 }
 
 bool Interaction::tick() {
-	g_engine->baseView()->findView("Commands")->tick();
+	auto *view = g_engine->baseView()->findView("Commands");
+	if (view)
+		view->tick();
+
 	return Shared::Gfx::View::tick();
 }
 
diff --git a/engines/ultima/ultima2/views/views.h b/engines/ultima/ultima2/views/views.h
index f5600ba612b..64397ae67ff 100644
--- a/engines/ultima/ultima2/views/views.h
+++ b/engines/ultima/ultima2/views/views.h
@@ -32,6 +32,7 @@
 #include "ultima/ultima2/views/world_map_overview.h"
 #include "ultima/ultima2/views/zstats.h"
 #include "ultima/ultima2/views/interactions/clue_seller.h"
+#include "ultima/ultima2/views/interactions/dead.h"
 #include "ultima/ultima2/views/interactions/direction.h"
 #include "ultima/ultima2/views/interactions/food_shop.h"
 #include "ultima/ultima2/views/interactions/offer_gold.h"
@@ -49,6 +50,7 @@ namespace Views {
 
 struct Views : public Shared::Views {
 	Interactions::ClueSeller _clueSeller;
+	Interactions::Dead _dead;
 	Interactions::Direction _direction;
 	Interactions::FoodShop _foodShop;
 	Interactions::OfferGold _offerGold;


Commit: 5e05af907ce32b61e71431d1854001cd19782b2d
    https://github.com/scummvm/scummvm/commit/5e05af907ce32b61e71431d1854001cd19782b2d
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:40:55+11:00

Commit Message:
ULTIMA: ULTIMA2: Set up a dummy character when the map command is used without one

Changed paths:
    engines/ultima/ultima2/console.cpp
    engines/ultima/ultima2/data/savegame.cpp
    engines/ultima/ultima2/data/savegame.h


diff --git a/engines/ultima/ultima2/console.cpp b/engines/ultima/ultima2/console.cpp
index 7ed3d615301..6d115802deb 100644
--- a/engines/ultima/ultima2/console.cpp
+++ b/engines/ultima/ultima2/console.cpp
@@ -75,6 +75,9 @@ bool Console::cmdMap(int argc, const char **argv) {
 		return true;
 	}
 
+	if (!sg.hasCharacter())
+		sg.setupDummyCharacter();
+
 	if (sg._mapType == 0) {
 		sg._overworldReturnX = sg._mapX;
 		sg._overworldReturnY = sg._mapY;
diff --git a/engines/ultima/ultima2/data/savegame.cpp b/engines/ultima/ultima2/data/savegame.cpp
index 0519ee57edc..5525b3a9398 100644
--- a/engines/ultima/ultima2/data/savegame.cpp
+++ b/engines/ultima/ultima2/data/savegame.cpp
@@ -25,6 +25,32 @@ namespace Ultima {
 namespace Ultima2 {
 namespace Data {
 
+void Savegame::setupDummyCharacter() {
+	*this = Savegame();
+
+	Common::strlcpy(_name, "DUMMY", sizeof(_name));
+	_sex = SEX_MALE;
+	_race = RACE_HUMAN;
+	_class = CLASS_FIGHTER;
+
+	// Even spread of the starting points, plus the male, human and fighter bonuses
+	_strength = 15 + 5 + 21;
+	_agility = 15;
+	_stamina = 15;
+	_charisma = 15;
+	_wisdom = 15;
+	_intelligence = 15 + 5;
+
+	_hp = 400;
+	_food = 400;
+	_gold = 400;
+
+	_mapEra = 2;
+	_mapType = 0;
+	_mapX = 20;
+	_mapY = 20;
+}
+
 void Savegame::synchronize(Common::Serializer &s) {
 	s.syncBytes((byte *)_name, MAX_NAME_LENGTH + 1);
 	s.syncAsByte(_sex);
diff --git a/engines/ultima/ultima2/data/savegame.h b/engines/ultima/ultima2/data/savegame.h
index 42c1f122004..a126ea539e1 100644
--- a/engines/ultima/ultima2/data/savegame.h
+++ b/engines/ultima/ultima2/data/savegame.h
@@ -120,6 +120,19 @@ struct Savegame {
 	 */
 	void synchronize(Common::Serializer &s);
 
+	/**
+	 * Returns true if a character has been created or loaded
+	 */
+	bool hasCharacter() const {
+		return _name[0] != '\0';
+	}
+
+	/**
+	 * Replaces the savegame with a default character on the starting
+	 * overworld, for testing without going through character creation
+	 */
+	void setupDummyCharacter();
+
 	/**
 	 * Returns the tile the player is drawn with
 	 */


Commit: 168c106ad32cab1bf2d2c1aafb39ab3a52d2b4b7
    https://github.com/scummvm/scummvm/commit/168c106ad32cab1bf2d2c1aafb39ab3a52d2b4b7
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:40:55+11:00

Commit Message:
ULTIMA: ULTIMA2: Fix town monster AI so only hostile monsters attack

Changed paths:
    engines/ultima/ultima2/logic/city_castle_logic.cpp
    engines/ultima/ultima2/logic/overworld_logic.cpp
    engines/ultima/ultima2/logic/overworld_logic.h


diff --git a/engines/ultima/ultima2/logic/city_castle_logic.cpp b/engines/ultima/ultima2/logic/city_castle_logic.cpp
index 26e668b76af..310c78bf7eb 100644
--- a/engines/ultima/ultima2/logic/city_castle_logic.cpp
+++ b/engines/ultima/ultima2/logic/city_castle_logic.cpp
@@ -92,7 +92,7 @@ bool CityCastleLogic::move(Data::Direction dir) {
 		return false;
 	}
 
-	if ((!_G(intangible) && !isWalkable(destTile)) || findTargetMonster(newX, newY) >= 0) {
+	if ((!_G(intangible) && !isWalkable(destTile)) || isOccupied(newX, newY)) {
 		writeString("--INVALID MOVE!\n");
 		return true;
 	}
@@ -123,6 +123,12 @@ void CityCastleLogic::updateCreatures() {
 			int dy = sg._mapY - monsters._mapY[slot];
 			sdx = signByte(dx * 4);
 			sdy = signByte(dy * 4);
+
+			// Hostile monsters below 15 HP flee instead of approaching
+			if (flag == 1 && monsters._spellHP[slot] < 15) {
+				sdx = -sdx;
+				sdy = -sdy;
+			}
 		} else {
 			// Wander: 75% chance to pick a fresh random direction, else
 			// keep going the way it was already headed (kept in _tempX/Y)
@@ -143,7 +149,9 @@ void CityCastleLogic::updateCreatures() {
 		int newX = (monsters._mapX[slot] + sdx + Data::MAP_WIDTH) % Data::MAP_WIDTH;
 		int newY = (monsters._mapY[slot] + sdy + Data::MAP_HEIGHT) % Data::MAP_HEIGHT;
 
-		if (flag <= 2 && newX == sg._mapX && newY == sg._mapY) {
+		// Only hostile monsters (1) attack; the others (2) merely follow the
+		// player around and stop short of their square
+		if (flag == 1 && newX == sg._mapX && newY == sg._mapY) {
 			++engagedCount;
 
 			int roll = randByte();
diff --git a/engines/ultima/ultima2/logic/overworld_logic.cpp b/engines/ultima/ultima2/logic/overworld_logic.cpp
index e27a8b3dd38..bbf81c5c9cf 100644
--- a/engines/ultima/ultima2/logic/overworld_logic.cpp
+++ b/engines/ultima/ultima2/logic/overworld_logic.cpp
@@ -125,7 +125,7 @@ bool OverworldLogic::move(Data::Direction dir) {
 		return false;
 	}
 
-	if ((!_G(intangible) && !isWalkable(destTile)) || findTargetMonster(newX, newY) >= 0) {
+	if ((!_G(intangible) && !isWalkable(destTile)) || isOccupied(newX, newY)) {
 		writeString("--INVALID MOVE!\n");
 		return true;
 	}
@@ -155,7 +155,17 @@ bool OverworldLogic::monsterCanEnter(Data::TileId monsterTile, Data::TileId dest
 	if (monsterTile == Data::TILE_SEA_MONSTER || monsterTile == Data::TILE_SHIP)
 		return destTile == Data::TILE_WATER;
 
-	return isWalkable(destTile) && findTargetMonster(x, y) < 0;
+	return isWalkable(destTile) && !isOccupied(x, y);
+}
+
+bool OverworldLogic::isOccupied(int x, int y) const {
+	Data::MapMonsters &monsters = _G(map)._monsters;
+	for (int slot = 0; slot < Data::MAP_MONSTER_COUNT; ++slot) {
+		if (monsters.isActive(slot) && monsters._mapX[slot] == x && monsters._mapY[slot] == y)
+			return true;
+	}
+
+	return false;
 }
 
 bool OverworldLogic::tryMoveMonster(int slot, int dx, int dy) {
diff --git a/engines/ultima/ultima2/logic/overworld_logic.h b/engines/ultima/ultima2/logic/overworld_logic.h
index cce2da433a5..3b5ec2b459b 100644
--- a/engines/ultima/ultima2/logic/overworld_logic.h
+++ b/engines/ultima/ultima2/logic/overworld_logic.h
@@ -58,6 +58,11 @@ protected:
 	 */
 	int findTargetMonster(int x, int y) const;
 
+	/**
+	 * Returns true if any monster, including slot 0, stands at (x,y)
+	 */
+	bool isOccupied(int x, int y) const;
+
 	/**
 	 * Returns true if a monster of the given type can move onto destTile
 	 * at (x,y) - not occupied by another monster, and matching its


Commit: 6fff82241244ff8887c80be3691a33cf6b549374
    https://github.com/scummvm/scummvm/commit/6fff82241244ff8887c80be3691a33cf6b549374
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:40:56+11:00

Commit Message:
ULTIMA: ULTIMA2: Draw and update monster slot 0 in towns

Changed paths:
    engines/ultima/ultima2/logic/city_castle_logic.cpp
    engines/ultima/ultima2/views/location_map.cpp
    engines/ultima/ultima2/views/overworld_map.cpp


diff --git a/engines/ultima/ultima2/logic/city_castle_logic.cpp b/engines/ultima/ultima2/logic/city_castle_logic.cpp
index 310c78bf7eb..028d9b4a24e 100644
--- a/engines/ultima/ultima2/logic/city_castle_logic.cpp
+++ b/engines/ultima/ultima2/logic/city_castle_logic.cpp
@@ -109,7 +109,7 @@ void CityCastleLogic::updateCreatures() {
 	byte damageAccumulator = 0;
 	int engagedCount = 0, hitCount = 0;
 
-	for (int slot = 31; slot >= 1; --slot) {
+	for (int slot = 31; slot >= 0; --slot) {
 		if (!monsters.isActive(slot))
 			continue;
 
diff --git a/engines/ultima/ultima2/views/location_map.cpp b/engines/ultima/ultima2/views/location_map.cpp
index 344d1da5bd7..b8a5652556f 100644
--- a/engines/ultima/ultima2/views/location_map.cpp
+++ b/engines/ultima/ultima2/views/location_map.cpp
@@ -103,7 +103,7 @@ void LocationMap::draw() {
 			} else {
 				tileId = _G(map).tileAt(x, y);
 
-				for (int slot = 1; slot <= 31; ++slot) {
+				for (int slot = 0; slot < Data::MAP_MONSTER_COUNT; ++slot) {
 					if (monsters.isActive(slot) && monsters._mapX[slot] == x && monsters._mapY[slot] == y) {
 						tileId = monsters.tileType(slot);
 						break;
diff --git a/engines/ultima/ultima2/views/overworld_map.cpp b/engines/ultima/ultima2/views/overworld_map.cpp
index 808f8af11ac..7942b56e903 100644
--- a/engines/ultima/ultima2/views/overworld_map.cpp
+++ b/engines/ultima/ultima2/views/overworld_map.cpp
@@ -100,7 +100,7 @@ void OverworldMap::draw() {
 			int y = (mapTop + oy + Data::MAP_HEIGHT) % Data::MAP_HEIGHT;
 			Data::TileId tileId = _G(map).tileAt(x, y);
 
-			for (int slot = 1; slot <= 31; ++slot) {
+			for (int slot = 0; slot < Data::MAP_MONSTER_COUNT; ++slot) {
 				if (monsters.isActive(slot) && monsters._mapX[slot] == x && monsters._mapY[slot] == y) {
 					tileId = monsters.tileType(slot);
 					break;


Commit: 75c5ebfe53ebf5de197eb8a156bd3c8efbf463d8
    https://github.com/scummvm/scummvm/commit/75c5ebfe53ebf5de197eb8a156bd3c8efbf463d8
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:40:56+11:00

Commit Message:
ULTIMA: ULTIMA2: Animate the water and forcefield tiles on the overworld and location maps

Changed paths:
    engines/ultima/ultima2/data/tiles.cpp
    engines/ultima/ultima2/data/tiles.h
    engines/ultima/ultima2/views/location_map.h
    engines/ultima/ultima2/views/map.cpp
    engines/ultima/ultima2/views/map.h
    engines/ultima/ultima2/views/overworld_map.h


diff --git a/engines/ultima/ultima2/data/tiles.cpp b/engines/ultima/ultima2/data/tiles.cpp
index 0047c3a1f6c..716354aadbb 100644
--- a/engines/ultima/ultima2/data/tiles.cpp
+++ b/engines/ultima/ultima2/data/tiles.cpp
@@ -82,6 +82,15 @@ void loadAttackSprite(Graphics::ManagedSurface &sprite) {
 	decodeTileRecord(record, sprite);
 }
 
+void scrollTileRows(Graphics::Surface &tile, int rows) {
+	byte copy[TILE_WIDTH * TILE_HEIGHT];
+	byte *pixels = (byte *)tile.getPixels();
+	memcpy(copy, pixels, sizeof(copy));
+
+	for (int y = 0; y < TILE_HEIGHT; ++y)
+		memcpy(pixels + y * TILE_WIDTH, copy + ((y + rows) % TILE_HEIGHT) * TILE_WIDTH, TILE_WIDTH);
+}
+
 } // namespace Data
 } // namespace Ultima2
 } // namespace Ultima
diff --git a/engines/ultima/ultima2/data/tiles.h b/engines/ultima/ultima2/data/tiles.h
index c018dc7d945..d62f8a046b3 100644
--- a/engines/ultima/ultima2/data/tiles.h
+++ b/engines/ultima/ultima2/data/tiles.h
@@ -66,6 +66,12 @@ void loadTiles(Graphics::Surface tiles[TILE_COUNT]);
  */
 void loadAttackSprite(Graphics::ManagedSurface &sprite);
 
+/**
+ * Scrolls a tile's rows upwards with wraparound, which is how the water and
+ * forcefield tiles animate
+ */
+void scrollTileRows(Graphics::Surface &tile, int rows);
+
 } // namespace Data
 } // namespace Ultima2
 } // namespace Ultima
diff --git a/engines/ultima/ultima2/views/location_map.h b/engines/ultima/ultima2/views/location_map.h
index d512b22a405..7f50ad93717 100644
--- a/engines/ultima/ultima2/views/location_map.h
+++ b/engines/ultima/ultima2/views/location_map.h
@@ -40,6 +40,11 @@ private:
 	Graphics::Surface _tiles[Data::TILE_COUNT];
 	Graphics::ManagedSurface _attackSprite;
 
+protected:
+	Graphics::Surface *tileGraphics() override {
+		return _tiles;
+	}
+
 public:
 	LocationMap();
 	~LocationMap() override;
diff --git a/engines/ultima/ultima2/views/map.cpp b/engines/ultima/ultima2/views/map.cpp
index fc04e3b545b..69eed2b1f19 100644
--- a/engines/ultima/ultima2/views/map.cpp
+++ b/engines/ultima/ultima2/views/map.cpp
@@ -19,6 +19,7 @@
  *
  */
 
+#include "common/system.h"
 #include "ultima/ultima2/views/map.h"
 #include "ultima/ultima2/ultima2.h"
 
@@ -26,11 +27,31 @@ namespace Ultima {
 namespace Ultima2 {
 namespace Views {
 
+// The original animates while waiting for a command: the water tile scrolls
+// four rows and the forcefield tile one row per step
+constexpr uint32 ANIMATION_DELAY = 150;
+constexpr int WATER_SCROLL_ROWS = 4;
+constexpr int FORCEFIELD_SCROLL_ROWS = 1;
+
 bool Map::msgAction(const ActionMessage &msg) {
 	g_engine->_logic->action(msg._action);
 	return true;
 }
 
+bool Map::tick() {
+	uint32 now = g_system->getMillis();
+	if (now - _lastAnimation >= ANIMATION_DELAY) {
+		_lastAnimation = now;
+
+		Graphics::Surface *tiles = tileGraphics();
+		Data::scrollTileRows(tiles[Data::TILE_WATER], WATER_SCROLL_ROWS);
+		Data::scrollTileRows(tiles[Data::TILE_FORCEFIELD], FORCEFIELD_SCROLL_ROWS);
+		redraw();
+	}
+
+	return View::tick();
+}
+
 bool Map::msgKeypress(const KeypressMessage &msg) {
 	g_engine->_logic->keypress(msg);
 	return true;
diff --git a/engines/ultima/ultima2/views/map.h b/engines/ultima/ultima2/views/map.h
index fab751a1590..186176c893a 100644
--- a/engines/ultima/ultima2/views/map.h
+++ b/engines/ultima/ultima2/views/map.h
@@ -23,6 +23,7 @@
 #define ULTIMA2_VIEWS_MAP_H
 
 #include "ultima/shared/gfx/view.h"
+#include "ultima/ultima2/data/tiles.h"
 
 namespace Ultima {
 namespace Ultima2 {
@@ -34,6 +35,16 @@ using namespace Shared::Messages;
  * Base class for map views - forwards player input into the active Logic
  */
 class Map : public Shared::Gfx::View {
+public:
+private:
+	uint32 _lastAnimation = 0;
+
+protected:
+	/**
+	 * Returns the view's TILE_COUNT tile graphics
+	 */
+	virtual Graphics::Surface *tileGraphics() = 0;
+
 public:
 	Map(const Common::String &name) : View(name) {
 		setBounds(TextRect(0, 0, 39, 19));
@@ -42,6 +53,7 @@ public:
 
 	bool msgAction(const ActionMessage &msg) override;
 	bool msgKeypress(const KeypressMessage &msg) override;
+	bool tick() override;
 };
 
 } // namespace Views
diff --git a/engines/ultima/ultima2/views/overworld_map.h b/engines/ultima/ultima2/views/overworld_map.h
index 995ad4cdd61..970c2c50a74 100644
--- a/engines/ultima/ultima2/views/overworld_map.h
+++ b/engines/ultima/ultima2/views/overworld_map.h
@@ -38,6 +38,11 @@ private:
 	Graphics::Surface _tiles[Data::TILE_COUNT];
 	Graphics::ManagedSurface _attackSprite;
 
+protected:
+	Graphics::Surface *tileGraphics() override {
+		return _tiles;
+	}
+
 public:
 	OverworldMap();
 	~OverworldMap() override;


Commit: 8a9177f01bdc718888c4a155fc48a91f5e3b2fed
    https://github.com/scummvm/scummvm/commit/8a9177f01bdc718888c4a155fc48a91f5e3b2fed
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:40:56+11:00

Commit Message:
ULTIMA: ULTIMA2: Add F5/F7 for showing the save/load game dialogs

Changed paths:
    engines/ultima/shared/engine/events.cpp
    engines/ultima/ultima2/ultima2.cpp


diff --git a/engines/ultima/shared/engine/events.cpp b/engines/ultima/shared/engine/events.cpp
index 4c18c27c5e0..6d33eacf70f 100644
--- a/engines/ultima/shared/engine/events.cpp
+++ b/engines/ultima/shared/engine/events.cpp
@@ -83,6 +83,19 @@ void Events::runGame(Views &views) {
 bool Events::processEvent(Common::Event &ev) {
 	switch (ev.type) {
 	case Common::EVENT_KEYDOWN:
+		if (ev.kbd.flags == 0) {
+			switch (ev.kbd.keycode) {
+			case Common::KEYCODE_F5:
+				g_engine->saveGameDialog();
+				return true;
+			case Common::KEYCODE_F7:
+				g_engine->loadGameDialog();
+				return true;
+			default:
+				break;
+			}
+		}
+
 		if (ev.kbd.keycode < Common::KEYCODE_NUMLOCK)
 			msgKeypress(KeypressMessage(ev.kbd));
 		break;
diff --git a/engines/ultima/ultima2/ultima2.cpp b/engines/ultima/ultima2/ultima2.cpp
index eaa0c677f60..23892f9646d 100644
--- a/engines/ultima/ultima2/ultima2.cpp
+++ b/engines/ultima/ultima2/ultima2.cpp
@@ -89,7 +89,9 @@ bool Ultima2Engine::canSaveGameStateCurrently(Common::U32String *msg) {
 }
 
 bool Ultima2Engine::canLoadGameStateCurrently(Common::U32String *msg) {
-	return canSaveGameStateCurrently() || dynamic_cast<Views::Interactions::Dead *>(focusedView()) != nullptr;
+	return canSaveGameStateCurrently() ||
+		dynamic_cast<Views::Interactions::Dead *>(focusedView()) != nullptr ||
+		dynamic_cast<Views::Title *>(focusedView()) != nullptr;
 }
 
 Common::Error Ultima2Engine::syncGame(Common::Serializer &s) {


Commit: 6e3ef306d3d8fe23ab35990c3129c93c86335004
    https://github.com/scummvm/scummvm/commit/6e3ef306d3d8fe23ab35990c3129c93c86335004
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:40:56+11:00

Commit Message:
ULTIMA: ULTIMA2: Allow non-numeric keys to abort merchant interactions

Changed paths:
    engines/ultima/ultima2/views/interactions/clue_seller.cpp
    engines/ultima/ultima2/views/interactions/food_shop.cpp
    engines/ultima/ultima2/views/interactions/offer_gold.cpp
    engines/ultima/ultima2/views/interactions/pub.cpp
    engines/ultima/ultima2/views/interactions/shop.cpp
    engines/ultima/ultima2/views/interactions/transport.cpp


diff --git a/engines/ultima/ultima2/views/interactions/clue_seller.cpp b/engines/ultima/ultima2/views/interactions/clue_seller.cpp
index a8d7a2a476c..a15174249ac 100644
--- a/engines/ultima/ultima2/views/interactions/clue_seller.cpp
+++ b/engines/ultima/ultima2/views/interactions/clue_seller.cpp
@@ -52,15 +52,18 @@ bool ClueSeller::msgFocus(const FocusMessage &msg) {
 }
 
 bool ClueSeller::msgKeypress(const KeypressMessage &msg) {
-	if (msg.ascii < '0' || msg.ascii > '9')
-		return true;
-
-	int digit = msg.ascii - '0';
-	writeString("%d\n", digit);
 	close();
 
-	if (_G(logic)->trySpendGold(digit * 100))
-		writeString("%s\n", CLUES[digit]);
+	// Any other key walks away
+	if (msg.ascii < '0' || msg.ascii > '9') {
+		writeString("\n");
+	} else {
+		int digit = msg.ascii - '0';
+		writeString("%d\n", digit);
+
+		if (_G(logic)->trySpendGold(digit * 100))
+			writeString("%s\n", CLUES[digit]);
+	}
 
 	_G(logic)->resumeTurn();
 	return true;
diff --git a/engines/ultima/ultima2/views/interactions/food_shop.cpp b/engines/ultima/ultima2/views/interactions/food_shop.cpp
index a9f015889c2..14a8e269c99 100644
--- a/engines/ultima/ultima2/views/interactions/food_shop.cpp
+++ b/engines/ultima/ultima2/views/interactions/food_shop.cpp
@@ -43,9 +43,6 @@ bool FoodShop::msgFocus(const FocusMessage &msg) {
 }
 
 bool FoodShop::msgKeypress(const KeypressMessage &msg) {
-	if (msg.ascii == 0)
-		return true;
-
 	close();
 	if (toupper(msg.ascii) != 'Y') {
 		writeString("NO\n");
diff --git a/engines/ultima/ultima2/views/interactions/offer_gold.cpp b/engines/ultima/ultima2/views/interactions/offer_gold.cpp
index af27d134e2f..59b2180ca5f 100644
--- a/engines/ultima/ultima2/views/interactions/offer_gold.cpp
+++ b/engines/ultima/ultima2/views/interactions/offer_gold.cpp
@@ -31,8 +31,13 @@ OfferGold::OfferGold() : Interaction("OfferGold") {
 }
 
 bool OfferGold::msgKeypress(const KeypressMessage &msg) {
-	if (msg.ascii < '0' || msg.ascii > '9')
+	// Any other key withdraws the offer
+	if (msg.ascii < '0' || msg.ascii > '9') {
+		close();
+		writeString("\n");
+		_G(logic)->resumeTurn();
 		return true;
+	}
 
 	int digit = msg.ascii - '0';
 	writeString("%d\n", digit);
diff --git a/engines/ultima/ultima2/views/interactions/pub.cpp b/engines/ultima/ultima2/views/interactions/pub.cpp
index ac3544ab04c..8bcc45b7fc7 100644
--- a/engines/ultima/ultima2/views/interactions/pub.cpp
+++ b/engines/ultima/ultima2/views/interactions/pub.cpp
@@ -59,8 +59,13 @@ void Pub::barkeepSays(int hint) {
 }
 
 bool Pub::msgKeypress(const KeypressMessage &msg) {
-	if (msg.ascii < '0' || msg.ascii > '9')
+	// Any other key walks out of the pub
+	if (msg.ascii < '0' || msg.ascii > '9') {
+		close();
+		writeString("\n");
+		_G(logic)->resumeTurn();
 		return true;
+	}
 
 	int digit = msg.ascii - '0';
 	writeString("%d\n", digit);
diff --git a/engines/ultima/ultima2/views/interactions/shop.cpp b/engines/ultima/ultima2/views/interactions/shop.cpp
index 10a7fcce729..93841a004ee 100644
--- a/engines/ultima/ultima2/views/interactions/shop.cpp
+++ b/engines/ultima/ultima2/views/interactions/shop.cpp
@@ -71,7 +71,8 @@ void Shop::finish(const char *message) {
 }
 
 void Shop::chooseItem(int digit) {
-	writeString("%d\n", digit);
+	if (digit >= 0)
+		writeString("%d\n", digit);
 
 	if (!isValidChoice(digit)) {
 		switch (_kind) {
@@ -121,7 +122,9 @@ void Shop::confirm(char key) {
 	switch (_kind) {
 	case WEAPON:
 	case ARMOR:
-		writeString("%c\n", key);
+		if (key >= ' ')
+			writeString("%c", key);
+		writeString("\n");
 		if (!yes) {
 			writeString("OH, WELL.\n");
 		} else if (_G(logic)->trySpendGold(_price)) {
@@ -163,9 +166,9 @@ void Shop::confirm(char key) {
 
 bool Shop::msgKeypress(const KeypressMessage &msg) {
 	if (_state == CHOOSE) {
-		if (msg.ascii >= '0' && msg.ascii <= '9')
-			chooseItem(msg.ascii - '0');
-	} else if (msg.ascii != 0) {
+		// Any non-digit key leaves the shop, the same as an invalid choice
+		chooseItem((msg.ascii >= '0' && msg.ascii <= '9') ? msg.ascii - '0' : -1);
+	} else {
 		confirm(toupper(msg.ascii));
 	}
 
diff --git a/engines/ultima/ultima2/views/interactions/transport.cpp b/engines/ultima/ultima2/views/interactions/transport.cpp
index 152f3e7427d..d7d84c9108f 100644
--- a/engines/ultima/ultima2/views/interactions/transport.cpp
+++ b/engines/ultima/ultima2/views/interactions/transport.cpp
@@ -42,11 +42,10 @@ bool Transport::msgFocus(const FocusMessage &msg) {
 }
 
 bool Transport::msgKeypress(const KeypressMessage &msg) {
-	if (msg.ascii == 0)
-		return true;
-
 	char key = toupper(msg.ascii);
-	writeString("%c\n", key);
+	if (key >= ' ')
+		writeString("%c", key);
+	writeString("\n");
 	close();
 
 	if (key != 'Y') {


Commit: bc45b40f86ab88feb5014796e5b264506fd4bfa8
    https://github.com/scummvm/scummvm/commit/bc45b40f86ab88feb5014796e5b264506fd4bfa8
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:40:56+11:00

Commit Message:
ULTIMA: ULTIMA2: Handle steal, unlock and offer prompts

Changed paths:
    engines/ultima/ultima2/logic/city_castle_logic.cpp
    engines/ultima/ultima2/logic/logic.cpp
    engines/ultima/ultima2/views/interactions/direction.cpp


diff --git a/engines/ultima/ultima2/logic/city_castle_logic.cpp b/engines/ultima/ultima2/logic/city_castle_logic.cpp
index 028d9b4a24e..7ebb09a1b01 100644
--- a/engines/ultima/ultima2/logic/city_castle_logic.cpp
+++ b/engines/ultima/ultima2/logic/city_castle_logic.cpp
@@ -188,12 +188,13 @@ void CityCastleLogic::updateCreatures() {
 
 bool CityCastleLogic::steal(Data::Direction dir) {
 	if (dir == Data::DIR_UNSPECIFIED) {
-		writeString("STEAL--");
+		writeString("STEAL DIRECT-");
 		_directionPurpose = DirectionPurpose::STEAL;
 		g_engine->addView("Direction");
 		return false;
 	}
 
+	writeString("\n");
 	Data::Savegame &sg = _G(savegame);
 	int dx = 0, dy = 0;
 	switch (dir) {
@@ -266,51 +267,42 @@ bool CityCastleLogic::steal(Data::Direction dir) {
 
 bool CityCastleLogic::unlock(Data::Direction dir) {
 	if (dir == Data::DIR_UNSPECIFIED) {
+		writeString("UNLOCK DIRECTION-");
 		_directionPurpose = DirectionPurpose::UNLOCK;
 		g_engine->addView("Direction");
 		return false;
 	}
 
+	// The original only looks east or west of the player for a door
 	Data::Savegame &sg = _G(savegame);
-	int dx = 0, dy = 0;
-	switch (dir) {
-	case Data::DIR_UP: dy = -1; break;
-	case Data::DIR_DOWN: dy = 1; break;
-	case Data::DIR_LEFT: dx = -1; break;
-	case Data::DIR_RIGHT: dx = 1; break;
-	default:
-		writeString("NO DOOR THERE!\n");
-		return true;
-	}
-
-	int x = sg._mapX + dx, y = sg._mapY + dy;
-	if (x < 0 || x >= Data::MAP_WIDTH || y < 0 || y >= Data::MAP_HEIGHT ||
-			_G(map).tileAt(x, y) != Data::TILE_I_DOOR) {
-		writeString("NO DOOR THERE!\n");
+	int x = sg._mapX + (dir == Data::DIR_LEFT ? -1 : dir == Data::DIR_RIGHT ? 1 : 0);
+	if (x == sg._mapX || x < 0 || x >= Data::MAP_WIDTH ||
+			_G(map).tileAt(x, sg._mapY) != Data::TILE_I_DOOR) {
+		writeString("\nNO DOOR THERE!\n");
 		return true;
 	}
 
 	if (sg._keys == 0) {
-		writeString("NO KEYS THAT FIT!\n");
+		writeString("\nNO KEYS THAT FIT!\n");
 		return true;
 	}
 
 	--sg._keys;
-	// The door tile is replaced by whatever tile the player is currently
-	// standing on - matches the original exactly, though it's an odd way
-	// to clear a door; worth confirming visually during playtest
-	_G(map)._tiles[y][x] = _G(map).tileAt(sg._mapX, sg._mapY);
-	writeString("UNLOCKED!\n");
+	// The door is replaced by the tile the player is standing on
+	_G(map)._tiles[sg._mapY][x] = _G(map).tileAt(sg._mapX, sg._mapY);
+	writeString("\n");
 	return true;
 }
 
 bool CityCastleLogic::offer(Data::Direction dir) {
 	if (dir == Data::DIR_UNSPECIFIED) {
+		writeString("OFFER GOLD DIRECT-");
 		_directionPurpose = DirectionPurpose::OFFER;
 		g_engine->addView("Direction");
 		return false;
 	}
 
+	writeString("\n");
 	Data::Savegame &sg = _G(savegame);
 	int dx = 0, dy = 0;
 	switch (dir) {
@@ -331,7 +323,7 @@ bool CityCastleLogic::offer(Data::Direction dir) {
 	}
 
 	_offerTargetSlot = slot;
-	writeString("HOW MUCH (*100)? ");
+	writeString("HOW MUCH (*100) ? ");
 	g_engine->addView("OfferGold");
 	return false;
 }
@@ -382,14 +374,16 @@ void CityCastleLogic::completeOffer(int goldHundreds) {
 	}
 
 	default:
-		if ((randByte() & 7) >= 6) {
+		int stat = randByte() & 7;
+		if (stat >= 6) {
 			writeString("THANK YOU VERY MUCH!\n");
 		} else {
 			int16 *attrs[6] = {
 				&sg._strength, &sg._agility, &sg._stamina,
 				&sg._charisma, &sg._wisdom, &sg._intelligence
 			};
-			*attrs[randByte() % 6] += 4 * goldHundreds;
+			// Attributes are two BCD digits, so a big boost wraps around
+			*attrs[stat] = (*attrs[stat] + 4 * goldHundreds) % 100;
 			writeString("ALAKAZAM!\n");
 		}
 		break;
@@ -472,15 +466,14 @@ bool CityCastleLogic::transact(Data::Direction dir) {
 
 	Data::Savegame &sg = _G(savegame);
 	int dx = 0, dy = 0;
-	const char *dirName;
 	switch (dir) {
-	case Data::DIR_UP:    dy = -1; dirName = "NORTH"; break;
-	case Data::DIR_DOWN:  dy = 1;  dirName = "SOUTH"; break;
-	case Data::DIR_LEFT:  dx = -1; dirName = "WEST"; break;
-	case Data::DIR_RIGHT: dx = 1;  dirName = "EAST"; break;
-	default: dirName = ""; break;
+	case Data::DIR_UP:    dy = -1; break;
+	case Data::DIR_DOWN:  dy = 1;  break;
+	case Data::DIR_LEFT:  dx = -1; break;
+	case Data::DIR_RIGHT: dx = 1;  break;
+	default: break;
 	}
-	writeString("%s\n", dirName);
+	writeString("\n");
 
 	int x1 = sg._mapX + dx, y1 = sg._mapY + dy;
 	int slot = (x1 >= 0 && x1 < Data::MAP_WIDTH && y1 >= 0 && y1 < Data::MAP_HEIGHT) ?
diff --git a/engines/ultima/ultima2/logic/logic.cpp b/engines/ultima/ultima2/logic/logic.cpp
index 3c6295cee21..ce940ced424 100644
--- a/engines/ultima/ultima2/logic/logic.cpp
+++ b/engines/ultima/ultima2/logic/logic.cpp
@@ -372,15 +372,17 @@ bool Logic::magic() {
 
 bool Logic::negateTime() {
 	Data::Savegame &sg = _G(savegame);
+	writeString("Negate time");
 
 	if (sg._items[Data::ITEM_STRANGE_COIN] == 0) {
-		writeString(" HOW?  YOU'RE NOT EINSTEIN\n");
-		return true;
+		writeString(" how?\nYou're not Einstein\n");
+
+	} else {
+		--sg._items[Data::ITEM_STRANGE_COIN];
+		writeString("\nYou rub a coin...\n");
+		sg._negateTimeTurns = 20;
 	}
 
-	--sg._items[Data::ITEM_STRANGE_COIN];
-	writeString("YOU RUB A COIN...\n");
-	sg._negateTimeTurns = 20;
 	return true;
 }
 
diff --git a/engines/ultima/ultima2/views/interactions/direction.cpp b/engines/ultima/ultima2/views/interactions/direction.cpp
index abd2e2e0c58..20d668a5317 100644
--- a/engines/ultima/ultima2/views/interactions/direction.cpp
+++ b/engines/ultima/ultima2/views/interactions/direction.cpp
@@ -39,10 +39,10 @@ bool Direction::msgFocus(const FocusMessage &msg) {
 bool Direction::msgKeypress(const KeypressMessage &msg) {
 	Data::Direction dir;
 	switch (msg.keycode) {
-	case Common::KEYCODE_UP: dir = Data::DIR_UP; break;
-	case Common::KEYCODE_DOWN: dir = Data::DIR_DOWN; break;
-	case Common::KEYCODE_LEFT: dir = Data::DIR_LEFT; break;
-	case Common::KEYCODE_RIGHT: dir = Data::DIR_RIGHT; break;
+	case Common::KEYCODE_UP: dir = Data::DIR_UP; writeString("NORTH"); break;
+	case Common::KEYCODE_DOWN: dir = Data::DIR_DOWN; writeString("SOUTH"); break;
+	case Common::KEYCODE_LEFT: dir = Data::DIR_LEFT; writeString("WEST"); break;
+	case Common::KEYCODE_RIGHT: dir = Data::DIR_RIGHT; writeString("EAST"); break;
 	default:
 		return true;
 	}


Commit: a2e35ca2e1b8580df2864c7c12a8211538e10f5b
    https://github.com/scummvm/scummvm/commit/a2e35ca2e1b8580df2864c7c12a8211538e10f5b
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:40:56+11:00

Commit Message:
ULTIMA: ULTIMA2: Handle command banners, vehicle boarding and movement

Changed paths:
    engines/ultima/ultima2/logic/city_castle_logic.cpp
    engines/ultima/ultima2/logic/logic.cpp
    engines/ultima/ultima2/logic/logic.h
    engines/ultima/ultima2/logic/overworld_logic.cpp
    engines/ultima/ultima2/logic/overworld_logic.h


diff --git a/engines/ultima/ultima2/logic/city_castle_logic.cpp b/engines/ultima/ultima2/logic/city_castle_logic.cpp
index 7ebb09a1b01..4a7b856d7f9 100644
--- a/engines/ultima/ultima2/logic/city_castle_logic.cpp
+++ b/engines/ultima/ultima2/logic/city_castle_logic.cpp
@@ -57,49 +57,26 @@ bool CityCastleLogic::move(Data::Direction dir) {
 
 	writeString("%s", dirName);
 
-	if (sg._legParalysisTurns > 0) {
-		writeString("--PARALIZED!--INVALID MOVE!\n");
-		return true;
-	}
-
 	if (newX < 0 || newX >= Data::MAP_WIDTH || newY < 0 || newY >= Data::MAP_HEIGHT) {
 		writeString("\n");
 		exitToOverworld();
-		return false;
-	}
-
-	Data::TileId destTile = _G(map).tileAt(newX, newY);
-
-	if (destTile == Data::TILE_SWAMP) {
-		if (!sg.deductHP(5)) {
-			playerDied();
-			return false;
-		}
-	} else if (destTile == Data::TILE_FORCEFIELD) {
-		if (sg._items[Data::ITEM_RING] != 0) {
-			writeString("\nRING PROTECTS FROM FIELD!\n");
-		} else {
-			writeString("\nFIELD CAUSES 1000 DAMAGE!\n");
-			if (!sg.deductHP(1000)) {
-				playerDied();
-				return false;
-			}
-		}
+		return true;
 	}
 
-	if (!sg.deductFood(25)) {
-		playerDied();
+	switch (stepOnto(newX, newY)) {
+	case STEP_DIED:
 		return false;
-	}
-
-	if ((!_G(intangible) && !isWalkable(destTile)) || isOccupied(newX, newY)) {
+	case STEP_BLOCKED:
 		writeString("--INVALID MOVE!\n");
 		return true;
+	default:
+		break;
 	}
 
 	writeString("\n");
 	sg._mapX = newX;
 	sg._mapY = newY;
+	_monstersSkipTurn = !_monstersSkipTurn;
 	return true;
 }
 
diff --git a/engines/ultima/ultima2/logic/logic.cpp b/engines/ultima/ultima2/logic/logic.cpp
index ce940ced424..a7b7837194a 100644
--- a/engines/ultima/ultima2/logic/logic.cpp
+++ b/engines/ultima/ultima2/logic/logic.cpp
@@ -117,6 +117,9 @@ void Logic::action(int action) {
 	Common::SharedPtr<Logic> currLogic = _G(logic);
 	bool doEndOfTurn = true;
 
+	if (action != KEYBIND_UP && action != KEYBIND_DOWN && action != KEYBIND_LEFT && action != KEYBIND_RIGHT)
+		_monstersSkipTurn = false;
+
 	switch (action) {
 	case KEYBIND_UP:
 		doEndOfTurn = move(Data::DIR_UP);
@@ -146,7 +149,7 @@ void Logic::action(int action) {
 		doEndOfTurn = enter();
 		break;
 	case KEYBIND_FIRE:
-		doEndOfTurn = fire();
+		doEndOfTurn = fire(Data::DIR_UNSPECIFIED);
 		break;
 	case KEYBIND_GET:
 		doEndOfTurn = get();
@@ -230,6 +233,9 @@ void Logic::resolveDirection(Data::Direction dir) {
 	case DirectionPurpose::ATTACK:
 		doEndOfTurn = attack(dir);
 		break;
+	case DirectionPurpose::FIRE:
+		doEndOfTurn = fire(dir);
+		break;
 	case DirectionPurpose::STEAL:
 		doEndOfTurn = steal(dir);
 		break;
@@ -271,65 +277,138 @@ bool Logic::attack(Data::Direction dir) {
 }
 
 bool Logic::board() {
-	writeString("Board?\n");
+	Data::Savegame &sg = _G(savegame);
+	writeString("BOARD");
+
+	if (sg._mapType >= 4 || sg._mount != 0) {
+		writeString("\nTHINK AGAIN %s\n", sg._name);
+		return true;
+	}
+
+	Data::TileId vehicle = _G(map).tileAt(sg._mapX, sg._mapY);
+	Data::TileId under = Data::TILE_GRASS;
+
+	switch (vehicle) {
+	case Data::TILE_HORSE:
+		writeString(" HORSE");
+		break;
+	case Data::TILE_SHIP:
+		if (sg._items[Data::ITEM_BLUE_TASSLE] == 0) {
+			writeString(" SHIP\nTHE CREW OF THIS SHIP\nWILL NOT LET YOU BOARD!\n");
+			return true;
+		}
+		writeString(" FRIGATE");
+		under = Data::TILE_WATER;
+		break;
+	case Data::TILE_AIRPLANE:
+		if (sg._items[Data::ITEM_SKULL_KEY] == 0) {
+			writeString(" PLANE\nSTRANGE YOU CAN'T GET IN!\n");
+			return true;
+		}
+		writeString(" PLANE");
+		break;
+	case Data::TILE_ROCKET:
+		writeString(" ROCKET");
+		if (sg._items[Data::ITEM_ANKH] == 0) {
+			writeString("\nA METALIC VOICE COMMANDS:\nYOU MUST HAVE AN ANKH!\n");
+			return true;
+		}
+		break;
+	default:
+		writeString(" WHAT?\n");
+		return true;
+	}
+
+	_G(map)._tiles[sg._mapY][sg._mapX] = under;
+	sg._mount = vehicle;
+	writeString("\n");
 	return true;
 }
 
 bool Logic::cast() {
-	writeString("Cast?\n");
+	Data::Savegame &sg = _G(savegame);
+	writeString("CAST-%s", Data::SPELL_NAMES[sg._readiedSpell]);
+
+	if (sg._items[Data::ITEM_WAND] + sg._items[Data::ITEM_STAFF] == 0) {
+		writeString("\nNEED WAND OR STAFF!\n");
+		return true;
+	}
+
+	if (sg._readiedSpell == Data::SPELL_NONE) {
+		writeString("\n");
+		return true;
+	}
+
+	if (sg._spellCharges[sg._readiedSpell] == 0) {
+		writeString("\nNO SPELL!\n");
+		return true;
+	}
+
+	--sg._spellCharges[sg._readiedSpell];
+
+	// Spells only work in dungeons and towers, which aren't implemented yet
+	writeString("-FAILED!\n");
 	return true;
 }
 
 bool Logic::descend() {
-	writeString("Descend?\n");
+	// Ladders only exist in dungeons and towers, which aren't implemented yet
+	writeString("DESCEND-WHAT?\n");
 	return true;
 }
 
 bool Logic::enter() {
-	writeString("Enter?\n");
+	writeString("ENTER WHAT?\n");
 	return true;
 }
 
-bool Logic::fire() {
-	writeString("Fire?\n");
+bool Logic::fire(Data::Direction dir) {
+	writeString("FIRE WHAT?\n");
 	return true;
 }
 
 bool Logic::get() {
 	Data::Savegame &sg = _G(savegame);
+	writeString("GET");
 
+	// Chests only exist in dungeons and towers, which aren't implemented yet
 	if (sg._mapType >= 4) {
-		// Dungeon/tower chest handling - not yet implemented
-		writeString("Get?\n");
+		writeString(" WHAT?\n");
 		return true;
 	}
 
 	Data::TileId tile = _G(map).tileAt(sg._mapX, sg._mapY);
+	if (tile != Data::TILE_SWORD && tile != Data::TILE_SHIELD) {
+		writeString(" WHAT?\n");
+		return true;
+	}
+
+	_G(map)._tiles[sg._mapY][sg._mapX] = Data::TILE_GRASS;
+
 	if (tile == Data::TILE_SWORD) {
+		writeString(" WEAPON");
 		int r = randByte() & 7;
-		if (r == 0)
-			writeString("EMPTY!\n");
-		else {
+		if (r != 0) {
 			++sg._weaponOwned[r];
-			writeString("GOT %s!\n", Data::WEAPON_NAMES[r]);
+			writeString("\n");
+			return true;
 		}
-	} else if (tile == Data::TILE_SHIELD) {
+	} else {
+		writeString(" ARMOUR");
 		int r = randByte() & 3;
-		if (r == 0)
-			writeString("EMPTY!\n");
-		else {
+		if (r != 0) {
 			++sg._armorOwned[r];
-			writeString("GOT %s!\n", Data::ARMOR_NAMES[r]);
+			writeString("\n");
+			return true;
 		}
-	} else {
-		writeString("GET WHAT?\n");
 	}
 
+	writeString(" EMPTY!\n");
 	return true;
 }
 
 bool Logic::hyper() {
-	writeString("Hyper?\n");
+	writeString("HYPER WHAT?\n");
 	return true;
 }
 
@@ -351,17 +430,35 @@ bool Logic::igniteTorch() {
 }
 
 bool Logic::jump() {
-	writeString("Jump?\n");
+	writeString("JUMP...WHEE...\n");
 	return true;
 }
 
 bool Logic::klimb() {
-	writeString("Klimb?\n");
+	// Ladders only exist in dungeons and towers, which aren't implemented yet
+	writeString("KLIMB-WHAT?\n");
 	return true;
 }
 
 bool Logic::launch() {
-	writeString("Launch?\n");
+	Data::Savegame &sg = _G(savegame);
+
+	if (sg._mount == Data::TILE_AIRPLANE) {
+		writeString("LAUNCH--PLANE");
+		if (sg._items[Data::ITEM_BRASS_BUTTON] == 0)
+			writeString("\nFUNNY THIS PLANE IS\nMISSING A BRASS BUTTON!\n");
+		else
+			writeString("\nNOT YET IMPLEMENTED\n");
+	} else if (sg._mount == Data::TILE_ROCKET) {
+		writeString("LAUNCH--ROCKET");
+		if (sg._items[Data::ITEM_TRI_LITHIUM] == 0)
+			writeString("\nA METALLIC VOICE SAYS:\nSHIP INCAPABLE OF LAUNCH!\n");
+		else
+			writeString("\nNOT YET IMPLEMENTED\n");
+	} else {
+		writeString("LAUNCH WHAT?\n");
+	}
+
 	return true;
 }
 
@@ -372,14 +469,14 @@ bool Logic::magic() {
 
 bool Logic::negateTime() {
 	Data::Savegame &sg = _G(savegame);
-	writeString("Negate time");
+	writeString("NEGATE TIME");
 
 	if (sg._items[Data::ITEM_STRANGE_COIN] == 0) {
-		writeString(" how?\nYou're not Einstein\n");
+		writeString(" HOW?\nYOU'RE NOT EINSTEIN\n");
 
 	} else {
 		--sg._items[Data::ITEM_STRANGE_COIN];
-		writeString("\nYou rub a coin...\n");
+		writeString("\nYOU RUB A COIN...\n");
 		sg._negateTimeTurns = 20;
 	}
 
@@ -397,7 +494,20 @@ bool Logic::pass() {
 }
 
 bool Logic::quit() {
-	writeString("Quit?\n");
+	Data::Savegame &sg = _G(savegame);
+	writeString("QUIT OR SAVE GAME.");
+
+	if (sg._mapType != 0)
+		writeString("\nONLY OUTDOORS!\n");
+	else if (sg._saveDisabled)
+		writeString("\nONLY ON EARTH!\n");
+	else if (sg._mount != 0)
+		writeString("\nONLY ON FOOT!\n");
+	else {
+		writeString("\nONE MOMENT PLEASE!\n");
+		g_engine->saveGameDialog();
+	}
+
 	return true;
 }
 
@@ -441,7 +551,23 @@ bool Logic::wearArmor() {
 }
 
 bool Logic::xit() {
-	writeString("eXit?\n");
+	Data::Savegame &sg = _G(savegame);
+	writeString("X-IT");
+
+	if (sg._mount == 0) {
+		writeString(" WHAT?\n");
+		return true;
+	}
+
+	Data::TileId under = _G(map).tileAt(sg._mapX, sg._mapY);
+	if (under != Data::TILE_GRASS && !(under == Data::TILE_WATER && sg._mount == Data::TILE_SHIP)) {
+		writeString("-NOT HERE!\n");
+		return true;
+	}
+
+	_G(map)._tiles[sg._mapY][sg._mapX] = (Data::TileId)sg._mount;
+	sg._mount = 0;
+	writeString("\n");
 	return true;
 }
 
diff --git a/engines/ultima/ultima2/logic/logic.h b/engines/ultima/ultima2/logic/logic.h
index cd00ea6444f..7546d7d2ced 100644
--- a/engines/ultima/ultima2/logic/logic.h
+++ b/engines/ultima/ultima2/logic/logic.h
@@ -38,9 +38,13 @@ namespace Logic {
 class Logic {
 protected:
 	// Which command is waiting on the Direction interaction's result
-	enum class DirectionPurpose { ATTACK, STEAL, UNLOCK, OFFER, TRANSACT };
+	enum class DirectionPurpose { ATTACK, FIRE, STEAL, UNLOCK, OFFER, TRANSACT };
 	DirectionPurpose _directionPurpose = DirectionPurpose::ATTACK;
 
+	// Flips on every successful step and clears on any other command; while
+	// set and riding a horse, most monsters skip their turn
+	bool _monstersSkipTurn = false;
+
 	/**
 	 * Dispatches some text to be shown in the Commands window
 	 */
@@ -122,7 +126,6 @@ protected:
 	virtual bool cast();
 	virtual bool descend();
 	virtual bool enter();
-	virtual bool fire();
 	virtual bool get();
 	virtual bool hyper();
 	virtual bool igniteTorch();
@@ -157,6 +160,7 @@ public:
 	 * into these directly ---*/
 
 	virtual bool attack(Data::Direction dir = Data::DIR_UNSPECIFIED);
+	virtual bool fire(Data::Direction dir = Data::DIR_UNSPECIFIED);
 	virtual bool steal(Data::Direction dir = Data::DIR_UNSPECIFIED);
 	virtual bool unlock(Data::Direction dir = Data::DIR_UNSPECIFIED);
 	virtual bool offer(Data::Direction dir = Data::DIR_UNSPECIFIED);
diff --git a/engines/ultima/ultima2/logic/overworld_logic.cpp b/engines/ultima/ultima2/logic/overworld_logic.cpp
index bbf81c5c9cf..73d50052a96 100644
--- a/engines/ultima/ultima2/logic/overworld_logic.cpp
+++ b/engines/ultima/ultima2/logic/overworld_logic.cpp
@@ -68,6 +68,65 @@ bool OverworldLogic::isWalkable(Data::TileId tile) const {
 	}
 }
 
+bool OverworldLogic::mountCanEnter(Data::TileId dest) const {
+	switch (_G(savegame)._mount) {
+	case Data::TILE_ROCKET:
+		return false;
+	case Data::TILE_SHIP:
+		return dest == Data::TILE_WATER;
+	case Data::TILE_HORSE:
+		return isWalkable(dest) && dest != Data::TILE_SWAMP;
+	case Data::TILE_AIRPLANE:
+		return isWalkable(dest) && dest != Data::TILE_SWAMP && dest != Data::TILE_FOREST;
+	default:
+		return isWalkable(dest);
+	}
+}
+
+OverworldLogic::StepResult OverworldLogic::stepOnto(int x, int y) {
+	Data::Savegame &sg = _G(savegame);
+	Data::TileId dest = _G(map).tileAt(x, y);
+
+	if (dest == Data::TILE_SWAMP) {
+		if (!sg.deductHP(5)) {
+			playerDied();
+			return STEP_DIED;
+		}
+	} else if (dest == Data::TILE_FORCEFIELD) {
+		if (sg._items[Data::ITEM_RING] != 0) {
+			writeString("\nRING PROTECTS FROM FIELD!");
+		} else {
+			writeString("\nFIELD CAUSES 1000 DAMAGE!");
+			if (!sg.deductHP(1000)) {
+				playerDied();
+				return STEP_DIED;
+			}
+		}
+	}
+
+	if (sg._legParalysisTurns > 0) {
+		writeString("--PARALIZED!\n");
+		return STEP_BLOCKED;
+	}
+
+	// Ships and rockets don't eat; horses and planes eat twice as much
+	int foodCost = 25;
+	if (sg._mount == Data::TILE_SHIP || sg._mount == Data::TILE_ROCKET)
+		foodCost = 0;
+	else if (sg._mount == Data::TILE_HORSE || sg._mount == Data::TILE_AIRPLANE)
+		foodCost = 50;
+
+	if (foodCost != 0 && !sg.deductFood(foodCost)) {
+		playerDied();
+		return STEP_DIED;
+	}
+
+	if ((!_G(intangible) && !mountCanEnter(dest)) || isOccupied(x, y))
+		return STEP_BLOCKED;
+
+	return STEP_OK;
+}
+
 bool OverworldLogic::move(Data::Direction dir) {
 	Data::Savegame &sg = _G(savegame);
 
@@ -96,43 +155,20 @@ bool OverworldLogic::move(Data::Direction dir) {
 
 	writeString("%s", dirName);
 
-	if (sg._legParalysisTurns > 0) {
-		writeString("--PARALIZED!--INVALID MOVE!\n");
-		return true;
-	}
-
-	Data::TileId destTile = _G(map).tileAt(newX, newY);
-
-	if (destTile == Data::TILE_SWAMP) {
-		if (!sg.deductHP(5)) {
-			playerDied();
-			return false;
-		}
-	} else if (destTile == Data::TILE_FORCEFIELD) {
-		if (sg._items[Data::ITEM_RING] != 0) {
-			writeString("\nRING PROTECTS FROM FIELD!\n");
-		} else {
-			writeString("\nFIELD CAUSES 1000 DAMAGE!\n");
-			if (!sg.deductHP(1000)) {
-				playerDied();
-				return false;
-			}
-		}
-	}
-
-	if (!sg.deductFood(25)) {
-		playerDied();
+	switch (stepOnto(newX, newY)) {
+	case STEP_DIED:
 		return false;
-	}
-
-	if ((!_G(intangible) && !isWalkable(destTile)) || isOccupied(newX, newY)) {
+	case STEP_BLOCKED:
 		writeString("--INVALID MOVE!\n");
 		return true;
+	default:
+		break;
 	}
 
 	writeString("\n");
 	sg._mapX = newX;
 	sg._mapY = newY;
+	_monstersSkipTurn = !_monstersSkipTurn;
 	return true;
 }
 
@@ -195,6 +231,12 @@ void OverworldLogic::updateCreatures() {
 		if (!monsters.isActive(slot))
 			continue;
 
+		// Riding a horse, everything but sea creatures and Balrons moves every other step
+		Data::TileId monsterTile = monsters.tileType(slot);
+		if (sg._mount == Data::TILE_HORSE && _monstersSkipTurn && monsterTile != Data::TILE_SHIP &&
+				monsterTile != Data::TILE_BALRON && monsterTile != Data::TILE_SEA_MONSTER)
+			continue;
+
 		int dx = sg._mapX - monsters._mapX[slot];
 		int dy = sg._mapY - monsters._mapY[slot];
 		int sdx = signByte(dx * 4);
@@ -370,11 +412,53 @@ bool OverworldLogic::attack(Data::Direction dir) {
 	return false;
 }
 
-bool OverworldLogic::fire() {
-	// FIRE is the ship's cannon, gated on currently riding a Ship -
-	// there's no vehicle/boarding state yet (added in a later stage), so
-	// this is always the "not on a ship" failure case for now
-	writeString("FIRE WHAT?\n");
+bool OverworldLogic::fire(Data::Direction dir) {
+	Data::Savegame &sg = _G(savegame);
+
+	if (dir == Data::DIR_UNSPECIFIED) {
+		writeString("FIRE");
+
+		if (sg._mount != Data::TILE_SHIP) {
+			writeString(" WHAT?\n");
+			return true;
+		}
+
+		writeString(" DIRECT-");
+		_directionPurpose = DirectionPurpose::FIRE;
+		g_engine->addView("Direction");
+		return false;
+	}
+
+	int dx = 0, dy = 0;
+	switch (dir) {
+	case Data::DIR_UP: dy = -1; break;
+	case Data::DIR_DOWN: dy = 1; break;
+	case Data::DIR_LEFT: dx = -1; break;
+	case Data::DIR_RIGHT: dx = 1; break;
+	default: break;
+	}
+
+	int tx = (sg._mapX + dx + Data::MAP_WIDTH) % Data::MAP_WIDTH;
+	int ty = (sg._mapY + dy + Data::MAP_HEIGHT) % Data::MAP_HEIGHT;
+	int slot = findTargetMonster(tx, ty);
+
+	if (slot < 0) {
+		writeString("--MISS\n");
+		return true;
+	}
+
+	// The cannon always hits, for 32-255 damage
+	int dmg = randByte() | 0x20;
+	byte &hp = _G(map)._monsters._spellHP[slot];
+
+	writeString("\n");
+	if (hp <= dmg) {
+		hp = 0;
+		killMonster(slot);
+	} else {
+		hp -= dmg + 1;
+	}
+
 	return true;
 }
 
@@ -439,35 +523,46 @@ void OverworldLogic::enterLocalMap(int mapType) {
 
 bool OverworldLogic::enter() {
 	Data::Savegame &sg = _G(savegame);
+	writeString("ENTER");
 
 	if (sg._mapType != 0) {
 		writeString(" WHAT?\n");
 		return true;
 	}
 
+	if (sg._mount != 0) {
+		writeString("-ONLY ON FOOT!\n");
+		return true;
+	}
+
 	Data::TileId tile = _G(map).tileAt(sg._mapX, sg._mapY);
 	switch (tile) {
 	case Data::TILE_VILLAGE:
+		writeString("-VILLAGE\n");
 		enterLocalMap(1);
-		return false;
+		return true;
 	case Data::TILE_TOWN:
+		writeString("-TOWN\n");
 		enterLocalMap(2);
-		return false;
+		return true;
 	case Data::TILE_CASTLE:
+		writeString("-CASTLE\n");
 		enterLocalMap(3);
-		return false;
+		return true;
 	case Data::TILE_TOWER:
-	case Data::TILE_DUNGEON_ENTRANCE:
 		// Dungeon/tower first-person rendering isn't implemented yet
-		writeString("NOT YET IMPLEMENTED\n");
+		writeString("-TOWER\nNOT YET IMPLEMENTED\n");
+		return true;
+	case Data::TILE_DUNGEON_ENTRANCE:
+		writeString("-DUNGEON\nNOT YET IMPLEMENTED\n");
 		return true;
 	case Data::TILE_SIGNPOST: {
 		static const char *const ERA_TEXT[5] = {
-			"ANOS: LEGENDS!", "ANOS: 2112 A.D.", "ANOS: 9,000,000 B.C.",
-			"ANOS: 1423 B.C.", "ANOS: 1990 A.D."
+			"ANOS: LEGENDS!", "ANOS: 9,000,000 B.C.", "ANOS: 1423 B.C.",
+			"ANOS: 1990 A.D.", "ANOS: 2112 A.D."
 		};
 		int era = (sg._mapEra < 5) ? sg._mapEra : 4;
-		writeString("%s\n", ERA_TEXT[era]);
+		writeString("-THE SIGN READS:\n%s\n", ERA_TEXT[era]);
 		return true;
 	}
 	default:
diff --git a/engines/ultima/ultima2/logic/overworld_logic.h b/engines/ultima/ultima2/logic/overworld_logic.h
index 3b5ec2b459b..c7f2ec3d777 100644
--- a/engines/ultima/ultima2/logic/overworld_logic.h
+++ b/engines/ultima/ultima2/logic/overworld_logic.h
@@ -47,6 +47,20 @@ private:
 	void enterLocalMap(int mapType);
 
 protected:
+	enum StepResult { STEP_OK, STEP_BLOCKED, STEP_DIED };
+
+	/**
+	 * Applies the terrain damage, food cost and mount rules for stepping
+	 * onto (x,y), printing any resulting messages. Doesn't move the player
+	 */
+	StepResult stepOnto(int x, int y);
+
+	/**
+	 * Returns true if the current mount (or the player on foot) can enter
+	 * the given terrain
+	 */
+	bool mountCanEnter(Data::TileId dest) const;
+
 	/**
 	 * Returns -1/0/+1 matching the sign of the low byte of v, replicating
 	 * the original's byte-truncating "shortest step on a wrapping map" trick
@@ -93,7 +107,7 @@ public:
 
 	bool move(Data::Direction dir) override;
 	bool attack(Data::Direction dir) override;
-	bool fire() override;
+	bool fire(Data::Direction dir) override;
 	bool enter() override;
 };
 


Commit: 4d98e2dcee516c66c1fc5745c82f9cacfd4bf857
    https://github.com/scummvm/scummvm/commit/4d98e2dcee516c66c1fc5745c82f9cacfd4bf857
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:40:56+11:00

Commit Message:
ULTIMA: ULTIMA2: Add the hopping moongate and time travel between eras

Changed paths:
    engines/ultima/ultima2/data/savegame.cpp
    engines/ultima/ultima2/data/savegame.h
    engines/ultima/ultima2/logic/overworld_logic.cpp
    engines/ultima/ultima2/logic/overworld_logic.h


diff --git a/engines/ultima/ultima2/data/savegame.cpp b/engines/ultima/ultima2/data/savegame.cpp
index 5525b3a9398..635eae34b1b 100644
--- a/engines/ultima/ultima2/data/savegame.cpp
+++ b/engines/ultima/ultima2/data/savegame.cpp
@@ -95,6 +95,8 @@ void Savegame::synchronize(Common::Serializer &s) {
 	s.syncAsByte(_ringQuestFlag);
 	s.syncAsByte(_enilnoOwned);
 	s.syncAsByte(_patrolWaypoint);
+	s.syncAsByte(_patrolTimer);
+	s.syncAsByte(_patrolTerrain);
 
 	for (int i = 0; i < 9; ++i)
 		s.syncAsByte(_offerRewardItems[i]);
diff --git a/engines/ultima/ultima2/data/savegame.h b/engines/ultima/ultima2/data/savegame.h
index a126ea539e1..1b3e0069efa 100644
--- a/engines/ultima/ultima2/data/savegame.h
+++ b/engines/ultima/ultima2/data/savegame.h
@@ -94,6 +94,11 @@ struct Savegame {
 	bool _enilnoOwned = false;
 	byte _patrolWaypoint = 0;
 
+	// Turns until the moongate hops to its next waypoint, and the terrain
+	// tile it's currently covering
+	byte _patrolTimer = 0;
+	byte _patrolTerrain = 0;
+
 	byte _offerRewardItems[9] = {};
 
 	// Inventory quantities/charges, indexed by the enums in data.h
diff --git a/engines/ultima/ultima2/logic/overworld_logic.cpp b/engines/ultima/ultima2/logic/overworld_logic.cpp
index 73d50052a96..c3d0c84b56e 100644
--- a/engines/ultima/ultima2/logic/overworld_logic.cpp
+++ b/engines/ultima/ultima2/logic/overworld_logic.cpp
@@ -47,6 +47,15 @@ const SpawnEntry SPAWN_TABLE[8] = {
 	{ Data::TILE_MAGE,        0xE0, Data::TILE_GRASS }
 };
 
+// The moongate's four waypoints in each era
+const byte MOONGATE_WAYPOINTS[5][4][2] = {
+	{ { 29, 56 }, { 31, 56 }, { 33, 56 }, { 35, 56 } },
+	{ { 34, 8 }, { 47, 28 }, { 36, 56 }, { 20, 37 } },
+	{ { 16, 16 }, { 48, 24 }, { 42, 24 }, { 19, 52 } },
+	{ { 56, 52 }, { 28, 12 }, { 33, 23 }, { 20, 52 } },
+	{ { 18, 23 }, { 50, 34 }, { 52, 24 }, { 8, 11 } }
+};
+
 } // namespace
 
 bool OverworldLogic::isWalkable(Data::TileId tile) const {
@@ -109,6 +118,17 @@ OverworldLogic::StepResult OverworldLogic::stepOnto(int x, int y) {
 		return STEP_BLOCKED;
 	}
 
+	if (sg._mapType == 0 && dest == Data::TILE_MOONGATE &&
+			sg._mount != Data::TILE_SHIP && sg._mount != Data::TILE_ROCKET) {
+		int cost = (sg._mount == Data::TILE_HORSE || sg._mount == Data::TILE_AIRPLANE) ? 50 : 25;
+		if (!sg.deductFood(cost)) {
+			playerDied();
+			return STEP_DIED;
+		}
+
+		return STEP_MOONGATE;
+	}
+
 	// Ships and rockets don't eat; horses and planes eat twice as much
 	int foodCost = 25;
 	if (sg._mount == Data::TILE_SHIP || sg._mount == Data::TILE_ROCKET)
@@ -161,6 +181,10 @@ bool OverworldLogic::move(Data::Direction dir) {
 	case STEP_BLOCKED:
 		writeString("--INVALID MOVE!\n");
 		return true;
+	case STEP_MOONGATE:
+		writeString("\n");
+		enterMoongate(newX, newY);
+		return true;
 	default:
 		break;
 	}
@@ -172,6 +196,51 @@ bool OverworldLogic::move(Data::Direction dir) {
 	return true;
 }
 
+void OverworldLogic::enterMoongate(int x, int y) {
+	Data::Savegame &sg = _G(savegame);
+	_G(map)._tiles[y][x] = (Data::TileId)sg._patrolTerrain;
+
+	// Each waypoint leads to a different one of the other eras, arriving
+	// at that era's moongate for the same waypoint
+	int waypoint = sg._patrolWaypoint >> 1;
+	int era = waypoint;
+	if (era >= sg._mapEra)
+		++era;
+
+	sg._mapEra = era;
+	_G(map).load(era, 0);
+
+	sg._mapX = MOONGATE_WAYPOINTS[era][waypoint][0];
+	sg._mapY = MOONGATE_WAYPOINTS[era][waypoint][1];
+	redrawMap();
+}
+
+void OverworldLogic::updatePatrolMarker() {
+	Data::Savegame &sg = _G(savegame);
+	if (sg._saveDisabled || --sg._patrolTimer != 0)
+		return;
+
+	auto moongateAt = [&](int waypoint) -> Data::TileId & {
+		const byte *pos = MOONGATE_WAYPOINTS[sg._mapEra][waypoint];
+		return _G(map)._tiles[pos[1]][pos[0]];
+	};
+
+	Data::TileId &oldTile = moongateAt(sg._patrolWaypoint >> 1);
+	if (oldTile == Data::TILE_MOONGATE)
+		oldTile = (Data::TileId)sg._patrolTerrain;
+
+	sg._patrolTimer = 8;
+	sg._patrolWaypoint = (sg._patrolWaypoint + 2) & 7;
+
+	// Only bare terrain (water up to mountains) can host it
+	Data::TileId &newTile = moongateAt(sg._patrolWaypoint >> 1);
+	if (newTile > Data::TILE_MOUNTAIN)
+		return;
+
+	sg._patrolTerrain = newTile;
+	newTile = Data::TILE_MOONGATE;
+}
+
 int OverworldLogic::signByte(int v) const {
 	int8 b = (int8)(byte)(v & 0xFF);
 	return (b > 0) - (b < 0);
@@ -297,6 +366,7 @@ void OverworldLogic::updateCreatures() {
 	}
 
 	trySpawnMonster();
+	updatePatrolMarker();
 }
 
 void OverworldLogic::trySpawnMonster() {
diff --git a/engines/ultima/ultima2/logic/overworld_logic.h b/engines/ultima/ultima2/logic/overworld_logic.h
index c7f2ec3d777..8ae62931eec 100644
--- a/engines/ultima/ultima2/logic/overworld_logic.h
+++ b/engines/ultima/ultima2/logic/overworld_logic.h
@@ -46,8 +46,19 @@ private:
 	 */
 	void enterLocalMap(int mapType);
 
+	/**
+	 * Counts down the moongate's hop timer, moving it to its next waypoint
+	 * when it expires
+	 */
+	void updatePatrolMarker();
+
+	/**
+	 * Steps onto the moongate at (x,y), moving the player to another era
+	 */
+	void enterMoongate(int x, int y);
+
 protected:
-	enum StepResult { STEP_OK, STEP_BLOCKED, STEP_DIED };
+	enum StepResult { STEP_OK, STEP_BLOCKED, STEP_DIED, STEP_MOONGATE };
 
 	/**
 	 * Applies the terrain damage, food cost and mount rules for stepping


Commit: e4cfb026bdcb61263d960aa384bbe975af0c4abd
    https://github.com/scummvm/scummvm/commit/e4cfb026bdcb61263d960aa384bbe975af0c4abd
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:40:56+11:00

Commit Message:
ULTIMA: ULTIMA2: Add airplane flight

Changed paths:
  A engines/ultima/ultima2/views/interactions/plane_flight.cpp
  A engines/ultima/ultima2/views/interactions/plane_flight.h
    engines/ultima/module.mk
    engines/ultima/ultima2/logic/logic.cpp
    engines/ultima/ultima2/views/views.h


diff --git a/engines/ultima/module.mk b/engines/ultima/module.mk
index 61baaae533a..11c456298c1 100644
--- a/engines/ultima/module.mk
+++ b/engines/ultima/module.mk
@@ -139,6 +139,7 @@ MODULE_OBJS += \
 	ultima2/views/interactions/direction.o \
 	ultima2/views/interactions/food_shop.o \
 	ultima2/views/interactions/offer_gold.o \
+	ultima2/views/interactions/plane_flight.o \
 	ultima2/views/interactions/pub.o \
 	ultima2/views/interactions/ready_spell.o \
 	ultima2/views/interactions/ready_weapon.o \
diff --git a/engines/ultima/ultima2/logic/logic.cpp b/engines/ultima/ultima2/logic/logic.cpp
index a7b7837194a..434c70ad2ed 100644
--- a/engines/ultima/ultima2/logic/logic.cpp
+++ b/engines/ultima/ultima2/logic/logic.cpp
@@ -445,10 +445,13 @@ bool Logic::launch() {
 
 	if (sg._mount == Data::TILE_AIRPLANE) {
 		writeString("LAUNCH--PLANE");
-		if (sg._items[Data::ITEM_BRASS_BUTTON] == 0)
+		if (sg._items[Data::ITEM_BRASS_BUTTON] == 0) {
 			writeString("\nFUNNY THIS PLANE IS\nMISSING A BRASS BUTTON!\n");
-		else
-			writeString("\nNOT YET IMPLEMENTED\n");
+			return true;
+		}
+
+		g_engine->addView("PlaneFlight");
+		return false;
 	} else if (sg._mount == Data::TILE_ROCKET) {
 		writeString("LAUNCH--ROCKET");
 		if (sg._items[Data::ITEM_TRI_LITHIUM] == 0)
diff --git a/engines/ultima/ultima2/views/interactions/plane_flight.cpp b/engines/ultima/ultima2/views/interactions/plane_flight.cpp
new file mode 100644
index 00000000000..d23e0437f81
--- /dev/null
+++ b/engines/ultima/ultima2/views/interactions/plane_flight.cpp
@@ -0,0 +1,104 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#include "ultima/ultima2/views/interactions/plane_flight.h"
+#include "ultima/ultima2/ultima2.h"
+#include "ultima/ultima2/metaengine.h"
+
+namespace Ultima {
+namespace Ultima2 {
+namespace Views {
+namespace Interactions {
+
+constexpr uint32 STEP_DELAY = 100;
+
+PlaneFlight::PlaneFlight() : Interaction("PlaneFlight") {
+}
+
+bool PlaneFlight::msgFocus(const FocusMessage &msg) {
+	MetaEngine::setKeybindingMode(KBMODE_MINIMAL);
+	_dx = 0;
+	_dy = -1;
+	_lastStep = g_system->getMillis();
+
+	writeString("\n");
+	prompt();
+	return Interaction::msgFocus(msg);
+}
+
+void PlaneFlight::setHeading(int dx, int dy, const char *name) {
+	_dx = dx;
+	_dy = dy;
+	writeString("%s\n", name);
+	prompt();
+}
+
+void PlaneFlight::land() {
+	Data::Savegame &sg = _G(savegame);
+
+	if (_G(map).tileAt(sg._mapX, sg._mapY) == Data::TILE_GRASS) {
+		writeString("LAND PLANE.\n");
+		close();
+		_G(logic)->resumeTurn();
+	} else {
+		writeString("LAND--NOT HERE!!!!!\n");
+		prompt();
+	}
+}
+
+bool PlaneFlight::msgKeypress(const KeypressMessage &msg) {
+	switch (msg.keycode) {
+	case Common::KEYCODE_UP: setHeading(0, -1, "NORTH"); break;
+	case Common::KEYCODE_DOWN: setHeading(0, 1, "SOUTH"); break;
+	case Common::KEYCODE_LEFT: setHeading(-1, 0, "WEST"); break;
+	case Common::KEYCODE_RIGHT: setHeading(1, 0, "EAST"); break;
+	default:
+		if (toupper(msg.ascii) == 'L')
+			land();
+		break;
+	}
+
+	return true;
+}
+
+bool PlaneFlight::tick() {
+	uint32 now = g_system->getMillis();
+	if (now - _lastStep >= STEP_DELAY) {
+		_lastStep = now;
+
+		Data::Savegame &sg = _G(savegame);
+		sg._mapX = (sg._mapX + _dx + Data::MAP_WIDTH) % Data::MAP_WIDTH;
+		sg._mapY = (sg._mapY + _dy + Data::MAP_HEIGHT) % Data::MAP_HEIGHT;
+
+		// The focused view is this dummy one, so the map has to be redrawn explicitly
+		UIElement *map = g_engine->findView("OverworldMap");
+		map->redraw();
+		map->draw();
+	}
+
+	return Interaction::tick();
+}
+
+} // namespace Interactions
+} // namespace Views
+} // namespace Ultima2
+} // namespace Ultima
diff --git a/engines/ultima/ultima2/views/interactions/plane_flight.h b/engines/ultima/ultima2/views/interactions/plane_flight.h
new file mode 100644
index 00000000000..5191bd54cdf
--- /dev/null
+++ b/engines/ultima/ultima2/views/interactions/plane_flight.h
@@ -0,0 +1,59 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#ifndef ULTIMA2_VIEWS_INTERACTIONS_PLANE_FLIGHT_H
+#define ULTIMA2_VIEWS_INTERACTIONS_PLANE_FLIGHT_H
+
+#include "ultima/ultima2/views/interactions/interaction.h"
+
+namespace Ultima {
+namespace Ultima2 {
+namespace Views {
+namespace Interactions {
+
+/**
+ * A launched airplane flying across the overworld: it keeps moving in its
+ * current heading until an arrow key turns it, and 'L' lands it on grass
+ */
+class PlaneFlight : public Interaction {
+private:
+	int _dx = 0, _dy = -1;
+	uint32 _lastStep = 0;
+
+	void setHeading(int dx, int dy, const char *name);
+	void land();
+
+public:
+	PlaneFlight();
+	~PlaneFlight() override {}
+
+	bool msgFocus(const FocusMessage &msg) override;
+	bool msgKeypress(const KeypressMessage &msg) override;
+	bool tick() override;
+};
+
+} // namespace Interactions
+} // namespace Views
+} // namespace Ultima2
+} // namespace Ultima
+
+#endif
diff --git a/engines/ultima/ultima2/views/views.h b/engines/ultima/ultima2/views/views.h
index 64397ae67ff..dae63f3cb1c 100644
--- a/engines/ultima/ultima2/views/views.h
+++ b/engines/ultima/ultima2/views/views.h
@@ -36,6 +36,7 @@
 #include "ultima/ultima2/views/interactions/direction.h"
 #include "ultima/ultima2/views/interactions/food_shop.h"
 #include "ultima/ultima2/views/interactions/offer_gold.h"
+#include "ultima/ultima2/views/interactions/plane_flight.h"
 #include "ultima/ultima2/views/interactions/pub.h"
 #include "ultima/ultima2/views/interactions/ready_spell.h"
 #include "ultima/ultima2/views/interactions/ready_weapon.h"
@@ -54,6 +55,7 @@ struct Views : public Shared::Views {
 	Interactions::Direction _direction;
 	Interactions::FoodShop _foodShop;
 	Interactions::OfferGold _offerGold;
+	Interactions::PlaneFlight _planeFlight;
 	Interactions::Pub _pub;
 	Interactions::ReadySpell _readySpell;
 	Interactions::ReadyWeapon _readyWeapon;


Commit: a1de0bac542fbdcc97144c34ee5cc7f260c8dd86
    https://github.com/scummvm/scummvm/commit/a1de0bac542fbdcc97144c34ee5cc7f260c8dd86
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:40:56+11:00

Commit Message:
ULTIMA: ULTIMA2: Add the steal, unlock, offer and transact prompts

Changed paths:
    engines/ultima/ultima2/logic/logic.cpp


diff --git a/engines/ultima/ultima2/logic/logic.cpp b/engines/ultima/ultima2/logic/logic.cpp
index 434c70ad2ed..35da3c5b35c 100644
--- a/engines/ultima/ultima2/logic/logic.cpp
+++ b/engines/ultima/ultima2/logic/logic.cpp
@@ -117,6 +117,13 @@ void Logic::action(int action) {
 	Common::SharedPtr<Logic> currLogic = _G(logic);
 	bool doEndOfTurn = true;
 
+	// Sleeping players lose the command they were about to give
+	if (_G(savegame)._sleepTurns > 0) {
+		writeString("ZZZZZZZZZZZZZZZZZZZZ\n");
+		resumeTurn();
+		return;
+	}
+
 	if (action != KEYBIND_UP && action != KEYBIND_DOWN && action != KEYBIND_LEFT && action != KEYBIND_RIGHT)
 		_monstersSkipTurn = false;
 
@@ -487,7 +494,15 @@ bool Logic::negateTime() {
 }
 
 bool Logic::offer(Data::Direction dir) {
-	writeString("Offer?\n");
+	if (dir == Data::DIR_UNSPECIFIED) {
+		writeString("OFFER GOLD DIRECT-");
+		_directionPurpose = DirectionPurpose::OFFER;
+		g_engine->addView("Direction");
+		return false;
+	}
+
+	// Outside a settlement there's never anyone to give gold to
+	writeString("\nOFFER TO WHOM?\n");
 	return true;
 }
 
@@ -520,17 +535,42 @@ bool Logic::ready() {
 }
 
 bool Logic::steal(Data::Direction dir) {
-	writeString("Steal?\n");
+	if (dir == Data::DIR_UNSPECIFIED) {
+		writeString("STEAL DIRECT-");
+		_directionPurpose = DirectionPurpose::STEAL;
+		g_engine->addView("Direction");
+		return false;
+	}
+
+	// Outside a settlement there's nothing to steal
+	writeString("\nNO LUCK!\n");
+	if ((randByte() & 7) == 0)
+		alertTownGuards();
 	return true;
 }
 
 bool Logic::transact(Data::Direction dir) {
-	writeString("Transact?\n");
+	if (dir == Data::DIR_UNSPECIFIED) {
+		writeString("TRANSACT-");
+		_directionPurpose = DirectionPurpose::TRANSACT;
+		g_engine->addView("Direction");
+		return false;
+	}
+
+	writeString("\nFUNNY, NO RESPONSE!\n");
 	return true;
 }
 
 bool Logic::unlock(Data::Direction dir) {
-	writeString("Unlock?\n");
+	if (dir == Data::DIR_UNSPECIFIED) {
+		writeString("UNLOCK DIRECTION-");
+		_directionPurpose = DirectionPurpose::UNLOCK;
+		g_engine->addView("Direction");
+		return false;
+	}
+
+	// Outside a settlement there are no doors
+	writeString("\nNO DOOR THERE!\n");
 	return true;
 }
 


Commit: 5887582fafbf6a32d071c66e15059a0f66e3ae6d
    https://github.com/scummvm/scummvm/commit/5887582fafbf6a32d071c66e15059a0f66e3ae6d
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:40:56+11:00

Commit Message:
ULTIMA: ULTIMA2: Overworld kill rewards

Changed paths:
    engines/ultima/ultima2/data/data.h
    engines/ultima/ultima2/logic/overworld_logic.cpp


diff --git a/engines/ultima/ultima2/data/data.h b/engines/ultima/ultima2/data/data.h
index c922398ef35..c259c22cc86 100644
--- a/engines/ultima/ultima2/data/data.h
+++ b/engines/ultima/ultima2/data/data.h
@@ -80,6 +80,21 @@ enum ItemType {
 };
 extern const char *const ITEM_NAMES[ITEM_COUNT];
 
+/**
+ * The original keeps amounts as packed BCD bytes: each nibble is a decimal
+ * digit. Converts such a byte to the number it represents
+ */
+inline int bcdValue(byte v) {
+	return (v >> 4) * 10 + (v & 0xF);
+}
+
+/**
+ * Converts a number below 100 to a packed BCD byte
+ */
+inline byte toBcd(int v) {
+	return (byte)(((v / 10) << 4) | (v % 10));
+}
+
 } // namespace Data
 } // namespace Ultima2
 } // namespace Ultima
diff --git a/engines/ultima/ultima2/logic/overworld_logic.cpp b/engines/ultima/ultima2/logic/overworld_logic.cpp
index c3d0c84b56e..619e1203c67 100644
--- a/engines/ultima/ultima2/logic/overworld_logic.cpp
+++ b/engines/ultima/ultima2/logic/overworld_logic.cpp
@@ -574,11 +574,12 @@ void OverworldLogic::killMonster(int slot) {
 		break;
 	}
 
-	int goldAmt = (randByte() & 0x17) | 1;
+	// The original keeps and prints these as two BCD digits
+	int goldAmt = Data::bcdValue((randByte() & 0x17) | 1);
 	int expAmt = (randByte() & 3) + 1;
 	sg._gold += goldAmt;
 	sg._experience += expAmt;
-	writeString("KILLED--GOLD+%d--EXP.+%d\n", goldAmt, expAmt);
+	writeString("KILLED--GOLD+%.2d--EXP.+%.2d\n", goldAmt, expAmt);
 }
 
 void OverworldLogic::enterLocalMap(int mapType) {


Commit: 166bf09a842b3267736002a497a1acae88266581
    https://github.com/scummvm/scummvm/commit/166bf09a842b3267736002a497a1acae88266581
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:40:56+11:00

Commit Message:
ULTIMA: ULTIMA2: Add towers and dungeons

Changed paths:
  A engines/ultima/ultima2/logic/dungeon_logic.cpp
  A engines/ultima/ultima2/logic/dungeon_logic.h
  A engines/ultima/ultima2/views/dungeon_map.cpp
  A engines/ultima/ultima2/views/dungeon_map.h
    engines/ultima/module.mk
    engines/ultima/ultima2/console.cpp
    engines/ultima/ultima2/data/map.cpp
    engines/ultima/ultima2/data/map.h
    engines/ultima/ultima2/data/map_dungeon.h
    engines/ultima/ultima2/data/savegame.cpp
    engines/ultima/ultima2/data/savegame.h
    engines/ultima/ultima2/logic/logic.cpp
    engines/ultima/ultima2/logic/logic.h
    engines/ultima/ultima2/logic/overworld_logic.cpp
    engines/ultima/ultima2/logic/overworld_logic.h
    engines/ultima/ultima2/views/views.h


diff --git a/engines/ultima/module.mk b/engines/ultima/module.mk
index 11c456298c1..340281ca55e 100644
--- a/engines/ultima/module.mk
+++ b/engines/ultima/module.mk
@@ -120,10 +120,12 @@ MODULE_OBJS += \
 	ultima2/gfx/pic_decoder.o \
 	ultima2/gfx/text_cursor.o \
 	ultima2/logic/city_castle_logic.o \
+	ultima2/logic/dungeon_logic.o \
 	ultima2/logic/logic.o \
 	ultima2/logic/overworld_logic.o \
 	ultima2/views/commands.o \
 	ultima2/views/create_character.o \
+	ultima2/views/dungeon_map.o \
 	ultima2/views/game.o \
 	ultima2/views/location_map.o \
 	ultima2/views/map.o \
diff --git a/engines/ultima/ultima2/console.cpp b/engines/ultima/ultima2/console.cpp
index 6d115802deb..2b76ea8e06a 100644
--- a/engines/ultima/ultima2/console.cpp
+++ b/engines/ultima/ultima2/console.cpp
@@ -58,23 +58,6 @@ bool Console::cmdMap(int argc, const char **argv) {
 		return true;
 	}
 
-	if (mapType >= 4) {
-		// Towers and dungeons have no view yet, so just dump the loaded cells
-		_G(dungeon).load(mapEra, mapType);
-		debugPrintf("Loaded dungeon MAPX%d%d\n", mapEra, mapType);
-
-		for (int level = 0; level < Data::DUNGEON_LEVELS; ++level) {
-			debugPrintf("Level %d:\n", level);
-			for (int y = 0; y < Data::DUNGEON_HEIGHT; ++y) {
-				Common::String line;
-				for (int x = 0; x < Data::DUNGEON_WIDTH; ++x)
-					line += Common::String::format("%02x", _G(dungeon)._cells[level][y][x]);
-				debugPrintf("%s\n", line.c_str());
-			}
-		}
-		return true;
-	}
-
 	if (!sg.hasCharacter())
 		sg.setupDummyCharacter();
 
@@ -82,7 +65,13 @@ bool Console::cmdMap(int argc, const char **argv) {
 		sg._overworldReturnX = sg._mapX;
 		sg._overworldReturnY = sg._mapY;
 	}
-	if (mapType != 0) {
+	if (mapType >= 4) {
+		sg._mapX = 5;
+		sg._mapY = 5;
+		sg._dungeonLevel = 0;
+		sg._facingX = 1;
+		sg._facingY = 0;
+	} else if (mapType != 0) {
 		sg._mapX = 31;
 		sg._mapY = 62;
 	}
diff --git a/engines/ultima/ultima2/data/map.cpp b/engines/ultima/ultima2/data/map.cpp
index 0cd7db19a53..377aa7d2152 100644
--- a/engines/ultima/ultima2/data/map.cpp
+++ b/engines/ultima/ultima2/data/map.cpp
@@ -24,6 +24,7 @@
 #include "ultima/ultima2/ultima2.h"
 #include "ultima/ultima2/logic/overworld_logic.h"
 #include "ultima/ultima2/logic/city_castle_logic.h"
+#include "ultima/ultima2/logic/dungeon_logic.h"
 #include "ultima/shared/gfx/view.h"
 
 namespace Ultima {
@@ -74,6 +75,11 @@ void Map::loadTalk(int mapEra, int mapType) {
 }
 
 void Map::load(int mapEra, int mapType) {
+	if (mapType >= 4) {
+		loadDungeon(mapEra, mapType);
+		return;
+	}
+
 	Common::File f;
 	Common::String filename = mapFilename(mapEra, mapType);
 	if (!f.open(filename.c_str()))
@@ -103,8 +109,27 @@ void Map::load(int mapEra, int mapType) {
 	else
 		_G(logic) = Common::SharedPtr<Logic::Logic>(new Logic::CityCastleLogic());
 
-	Common::String mapViewName = (mapType == 0) ? "OverworldMap" : "LocationMap";
+	showMapView(mapType == 0 ? "OverworldMap" : "LocationMap");
+}
+
+void Map::loadDungeon(int mapEra, int mapType) {
+	_G(dungeon).load(mapEra, mapType);
+	_monsters.load(mapEra, mapType);
+	_talk.clear();
+
+	// Each dungeon monster is also flagged in the low bits of its cell
+	for (int slot = 0; slot < MAP_MONSTER_COUNT; ++slot) {
+		if (_monsters.isActive(slot)) {
+			_G(dungeon).cell(_monsters._glyphTile[slot], _monsters._mapX[slot],
+				_monsters._mapY[slot]) |= _monsters._type[slot] & 7;
+		}
+	}
+
+	_G(logic) = Common::SharedPtr<Logic::Logic>(new Logic::DungeonLogic());
+	showMapView("DungeonMap");
+}
 
+void Map::showMapView(const Common::String &mapViewName) {
 	if (!g_engine->isPresent("Game")) {
 		// Set up the game view and force it to draw immediately
 		g_engine->replaceView("Game", true);
diff --git a/engines/ultima/ultima2/data/map.h b/engines/ultima/ultima2/data/map.h
index 4b4299a1638..4fd1af53699 100644
--- a/engines/ultima/ultima2/data/map.h
+++ b/engines/ultima/ultima2/data/map.h
@@ -53,6 +53,17 @@ struct Map {
 private:
 	void loadTalk(int mapEra, int mapType);
 
+	/**
+	 * Loads a tower or dungeon and its monsters, and enters it
+	 */
+	void loadDungeon(int mapEra, int mapType);
+
+	/**
+	 * Switches to the given map view, first setting up the game view if
+	 * that isn't already showing
+	 */
+	void showMapView(const Common::String &mapViewName);
+
 public:
 	void load(int mapEra, int mapType);
 
diff --git a/engines/ultima/ultima2/data/map_dungeon.h b/engines/ultima/ultima2/data/map_dungeon.h
index 2d8fb66da59..cdce188d65b 100644
--- a/engines/ultima/ultima2/data/map_dungeon.h
+++ b/engines/ultima/ultima2/data/map_dungeon.h
@@ -55,6 +55,24 @@ struct MapDungeon {
 
 	void load(int mapEra, int mapType);
 
+	/**
+	 * Returns the cell at the given position on a level. Addresses it the
+	 * way the original does - a byte index within the level's 256-byte
+	 * page - so positions just outside the 16x16 grid alias into
+	 * neighbouring cells rather than being out of range
+	 */
+	byte &cell(int level, int x, int y) {
+		byte row = (byte)y;
+		int carry = 0;
+		for (int i = 0; i < 4; ++i) {
+			carry = row >> 7;
+			row = (byte)(row << 1);
+		}
+
+		int index = (row + (byte)x + carry) & 0xFF;
+		return _cells[level & 0xF][index / DUNGEON_WIDTH][index % DUNGEON_WIDTH];
+	}
+
 	DungeonTerrain terrainAt(int level, int x, int y) const {
 		return (DungeonTerrain)(_cells[level][y][x] & 0xF0);
 	}
diff --git a/engines/ultima/ultima2/data/savegame.cpp b/engines/ultima/ultima2/data/savegame.cpp
index 635eae34b1b..05e7deb2e3b 100644
--- a/engines/ultima/ultima2/data/savegame.cpp
+++ b/engines/ultima/ultima2/data/savegame.cpp
@@ -98,6 +98,10 @@ void Savegame::synchronize(Common::Serializer &s) {
 	s.syncAsByte(_patrolTimer);
 	s.syncAsByte(_patrolTerrain);
 
+	s.syncAsByte(_dungeonLevel);
+	s.syncAsSByte(_facingX);
+	s.syncAsSByte(_facingY);
+
 	for (int i = 0; i < 9; ++i)
 		s.syncAsByte(_offerRewardItems[i]);
 
diff --git a/engines/ultima/ultima2/data/savegame.h b/engines/ultima/ultima2/data/savegame.h
index 1b3e0069efa..a31d1b45e9e 100644
--- a/engines/ultima/ultima2/data/savegame.h
+++ b/engines/ultima/ultima2/data/savegame.h
@@ -67,6 +67,12 @@ struct Savegame {
 	byte _overworldReturnX = 0;
 	byte _overworldReturnY = 0;
 
+	// Position within a tower or dungeon: the level (0-15) and the compass
+	// direction faced, as an x/y step
+	byte _dungeonLevel = 0;
+	int8 _facingX = 1;
+	int8 _facingY = 0;
+
 	// Tile of the vehicle the player is riding (horse, ship, ...), or 0 on foot
 	byte _mount = 0;
 
@@ -112,8 +118,7 @@ struct Savegame {
 	int16 _armParalysisTurns = 0;
 	int16 _sleepTurns = 0;
 	int16 _negateTimeTurns = 0;
-	// Torch/Light spell duration; only decremented by the (not yet implemented)
-	// dungeon renderer
+	// Torch/Light spell duration in a tower or dungeon
 	int16 _lightTurns = 0;
 
 	// Incremented on every overworld monster spawn attempt; its lowest set
diff --git a/engines/ultima/ultima2/logic/dungeon_logic.cpp b/engines/ultima/ultima2/logic/dungeon_logic.cpp
new file mode 100644
index 00000000000..1ba62d0d07f
--- /dev/null
+++ b/engines/ultima/ultima2/logic/dungeon_logic.cpp
@@ -0,0 +1,580 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "ultima/ultima2/logic/dungeon_logic.h"
+#include "ultima/ultima2/ultima2.h"
+
+namespace Ultima {
+namespace Ultima2 {
+namespace Logic {
+
+namespace {
+
+constexpr int MAX_LEVEL = 15;
+constexpr int TORCH_TURNS = 150;
+
+// Cell contents: the high nibble is the terrain, the low bits flag a monster
+constexpr byte CELL_WALL = 0x80;
+constexpr byte CELL_CHEST = 0x40;
+constexpr byte CELL_LADDER_UP = 0x10;
+constexpr byte CELL_LADDER_DOWN = 0x20;
+
+int signOf(int v) {
+	return (v > 0) - (v < 0);
+}
+
+} // namespace
+
+byte &DungeonLogic::cellAt(int x, int y) const {
+	return _G(dungeon).cell(_G(savegame)._dungeonLevel, x, y);
+}
+
+int DungeonLogic::findMonsterAhead() const {
+	Data::Savegame &sg = _G(savegame);
+	Data::MapMonsters &monsters = _G(map)._monsters;
+	byte x = sg._mapX + sg._facingX, y = sg._mapY + sg._facingY;
+
+	for (int slot = 31; slot >= 1; --slot) {
+		if (monsters.isActive(slot) && monsters._glyphTile[slot] == sg._dungeonLevel &&
+				monsters._mapX[slot] == x && monsters._mapY[slot] == y)
+			return slot;
+	}
+
+	return -1;
+}
+
+bool DungeonLogic::move(Data::Direction dir) {
+	switch (dir) {
+	case Data::DIR_UP:
+		return advance();
+	case Data::DIR_DOWN:
+		return retreat();
+	case Data::DIR_LEFT:
+		return turn(true);
+	case Data::DIR_RIGHT:
+		return turn(false);
+	default:
+		return true;
+	}
+}
+
+bool DungeonLogic::advance() {
+	Data::Savegame &sg = _G(savegame);
+	writeString("ADVANCE");
+
+	byte front = cellAt((byte)(sg._mapX + sg._facingX), (byte)(sg._mapY + sg._facingY));
+	if ((front & 0x0F) != 0 || front == CELL_WALL) {
+		writeString("-BLOCKED!\n");
+		return true;
+	}
+
+	sg._mapX = (sg._mapX + sg._facingX) & 0x3F;
+	sg._mapY = (sg._mapY + sg._facingY) & 0x3F;
+
+	// Deeper levels have more traps
+	if (randByte() >= sg._dungeonLevel) {
+		writeString("\n");
+		return true;
+	}
+
+	sg._lightTurns = 0;
+	writeString("\nARGH! A TRAP!\n");
+
+	if (sg._thievesTools == 0) {
+		playerDied();
+		return false;
+	}
+
+	writeString("ESCAPED! BY USE OF TOOLS!\n");
+	--sg._thievesTools;
+	return true;
+}
+
+bool DungeonLogic::retreat() {
+	Data::Savegame &sg = _G(savegame);
+	writeString("RETREAT");
+
+	byte back = cellAt((byte)(sg._mapX - sg._facingX), (byte)(sg._mapY - sg._facingY));
+	if ((back & 0x8F) != 0) {
+		writeString("-BLOCKED!\n");
+		return true;
+	}
+
+	sg._mapX = (sg._mapX - sg._facingX) & 0x3F;
+	sg._mapY = (sg._mapY - sg._facingY) & 0x3F;
+	writeString("\n");
+	return true;
+}
+
+bool DungeonLogic::turn(bool left) {
+	Data::Savegame &sg = _G(savegame);
+	writeString(left ? "TURN LEFT\n" : "TURN RIGHT\n");
+
+	int8 fx = sg._facingX, fy = sg._facingY;
+	if (left) {
+		if (fy != 0) {
+			sg._facingX = fy;
+			sg._facingY = 0;
+		} else {
+			sg._facingY = -fx;
+			sg._facingX = 0;
+		}
+	} else {
+		if (fx != 0) {
+			sg._facingY = fx;
+			sg._facingX = 0;
+		} else {
+			sg._facingX = -fy;
+			sg._facingY = 0;
+		}
+	}
+
+	return true;
+}
+
+void DungeonLogic::printLevel() {
+	writeString("\nTO LEVEL %02d\n", _G(savegame)._dungeonLevel);
+}
+
+void DungeonLogic::surface() {
+	Data::Savegame &sg = _G(savegame);
+	sg._mapX = sg._overworldReturnX;
+	sg._mapY = sg._overworldReturnY;
+	sg._mapType = 0;
+	writeString("\n");
+	_G(map).load(sg._mapEra, sg._mapType);
+}
+
+void DungeonLogic::changeLevel(int delta) {
+	Data::Savegame &sg = _G(savegame);
+	int level = sg._dungeonLevel + delta;
+
+	if (level < 0) {
+		surface();
+	} else {
+		sg._dungeonLevel = level;
+		printLevel();
+	}
+}
+
+bool DungeonLogic::descend() {
+	Data::Savegame &sg = _G(savegame);
+	writeString("DESCEND");
+
+	if ((cellAt(sg._mapX, sg._mapY) & CELL_LADDER_DOWN) == 0) {
+		writeString("-WHAT?\n");
+		return true;
+	}
+
+	// Towers are numbered from the bottom up, dungeons from the top down
+	changeLevel(sg._mapType == 4 ? -1 : 1);
+	return true;
+}
+
+bool DungeonLogic::klimb() {
+	Data::Savegame &sg = _G(savegame);
+	writeString("KLIMB");
+
+	if ((cellAt(sg._mapX, sg._mapY) & CELL_LADDER_UP) == 0) {
+		writeString("-WHAT?\n");
+		return true;
+	}
+
+	changeLevel(sg._mapType == 4 ? 1 : -1);
+	return true;
+}
+
+bool DungeonLogic::get() {
+	Data::Savegame &sg = _G(savegame);
+	writeString("GET");
+
+	byte &cell = cellAt(sg._mapX, sg._mapY);
+	if (cell != CELL_CHEST) {
+		writeString(" WHAT?\n");
+		return true;
+	}
+
+	writeString(" CHEST!\nIT CONTAINS ");
+	cell = 0;
+
+	int level = sg._dungeonLevel;
+	if (level == MAX_LEVEL) {
+		writeString("TRI-LITHIUM!\n");
+		++sg._items[Data::ITEM_TRI_LITHIUM];
+		return true;
+	}
+
+	if (randByte() >= 0x40) {
+		writeString("GOLD!\n");
+		int amount = ((randByte() & 0x1F) + level * 2) & 0x77;
+		sg._gold = (sg._gold + Data::bcdValue(amount)) % 10000;
+		return true;
+	}
+
+	// Even levels hold weapons, odd ones armour
+	if ((level & 1) == 0) {
+		writeString("A  WEAPON");
+		int r = randByte() & 7;
+		if (r != 0) {
+			++sg._weaponOwned[r];
+			writeString("\n");
+			return true;
+		}
+	} else {
+		writeString(" ARMOUR");
+		int r = randByte() & 3;
+		if (r != 0) {
+			++sg._armorOwned[r];
+			writeString("\n");
+			return true;
+		}
+	}
+
+	writeString(" EMPTY!\n");
+	return true;
+}
+
+void DungeonLogic::killMonster(int slot) {
+	Data::Savegame &sg = _G(savegame);
+	Data::MapMonsters &monsters = _G(map)._monsters;
+
+	cellAt(monsters._mapX[slot], monsters._mapY[slot]) &= 0xF0;
+	monsters._spellHP[slot] = 0;
+	monsters._type[slot] = 0;
+	monsters._glyphTile[slot] = 0;
+
+	int gold = Data::bcdValue((randByte() & 0x17) | 1);
+	writeString("\nKILLED--GOLD+%.2d", gold);
+	sg._gold = (sg._gold + gold) % 10000;
+
+	int exp = randByte() & 7;
+	writeString("--EXP.+%.2d\n", exp);
+	sg._experience = (sg._experience + exp) % 10000;
+}
+
+bool DungeonLogic::attack(Data::Direction dir) {
+	Data::Savegame &sg = _G(savegame);
+	Data::MapMonsters &monsters = _G(map)._monsters;
+	writeString("ATTACK--");
+
+	byte x = sg._mapX + sg._facingX, y = sg._mapY + sg._facingY;
+	if ((cellAt(x, y) & 7) == 0) {
+		writeString("MISS\n");
+		return true;
+	}
+
+	// The search for the monster gives up at the first empty slot it meets
+	int slot = 31, last;
+	bool found = false;
+	while (slot >= 0) {
+		last = monsters._mapX[slot];
+		if (last == x) {
+			last = monsters._mapY[slot];
+			if (last == y) {
+				last = monsters._glyphTile[slot];
+				if (last == sg._dungeonLevel) {
+					found = true;
+					break;
+				}
+			}
+		}
+
+		--slot;
+		if (last == 0)
+			break;
+	}
+
+	if (!found || (randByte() >> 1) >= sg._agility) {
+		writeString("MISS\n");
+		return true;
+	}
+
+	writeString("HIT!");
+	int dmg = (sg._readiedWeapon * 8 + sg._strength) >> 2;
+	byte &hp = monsters._spellHP[slot];
+
+	if (hp < dmg) {
+		killMonster(slot);
+	} else {
+		hp -= dmg;
+		writeString("\n");
+	}
+
+	return true;
+}
+
+bool DungeonLogic::castSpell(Data::SpellType spell) {
+	Data::Savegame &sg = _G(savegame);
+	Data::MapMonsters &monsters = _G(map)._monsters;
+	int level = sg._dungeonLevel;
+
+	switch (spell) {
+	case Data::SPELL_LIGHT:
+		sg._lightTurns = TORCH_TURNS;
+		writeString("\n");
+		return true;
+
+	case Data::SPELL_DOWN_LADDER:
+	case Data::SPELL_UP_LADDER: {
+		// Down Ladder goes deeper in a dungeon but shallower in a tower, and
+		// Up Ladder the reverse
+		bool deeper = (spell == Data::SPELL_DOWN_LADDER) == (sg._mapType == 5);
+		if (!deeper && level == 0) {
+			surface();
+			return true;
+		}
+
+		int dest = deeper ? level + 1 : level - 1;
+		if (dest > MAX_LEVEL || _G(dungeon).cell(dest, sg._mapX, sg._mapY) != 0)
+			break;
+
+		sg._dungeonLevel = dest;
+		printLevel();
+		return true;
+	}
+
+	case Data::SPELL_PASSWALL: {
+		int x = (sg._mapX + sg._facingX) & 0xF, y = (sg._mapY + sg._facingY) & 0xF;
+		if (x == 0 || y == 0 || (cellAt(x, y) & CELL_WALL) == 0)
+			break;
+
+		cellAt(x, y) = 0;
+		writeString("\n");
+		return true;
+	}
+
+	case Data::SPELL_SURFACE:
+		surface();
+		return true;
+
+	case Data::SPELL_PRAYER:
+	case Data::SPELL_KILL:
+	case Data::SPELL_MAGIC_MISSILE: {
+		if (spell == Data::SPELL_PRAYER && (randByte() & 0x80) != 0)
+			break;
+
+		int slot = findMonsterAhead();
+		if (slot < 0)
+			break;
+
+		if (spell == Data::SPELL_MAGIC_MISSILE) {
+			// Damage grows with the hundreds of experience
+			int exp = Data::toBcd((sg._experience / 100) % 100);
+			int sum = exp + exp;
+			int carry = sum >> 8;
+			sum = (sum & 0xFF) + 0x1E + carry;
+			int dmg = sum & 0xFF;
+			int borrow = (sum >> 8) ? 0 : 1;
+
+			byte &hp = monsters._spellHP[slot];
+			if (hp >= dmg + borrow) {
+				hp -= dmg + borrow;
+				writeString("\n");
+				return true;
+			}
+		}
+
+		killMonster(slot);
+		return true;
+	}
+
+	case Data::SPELL_BLINK: {
+		int x = (randByte() & 0xF) | 1;
+		int y = (randByte() & 0xF) | 1;
+		if (cellAt(x, y) != 0)
+			break;
+
+		sg._mapX = x;
+		sg._mapY = y;
+		writeString("\n");
+		return true;
+	}
+
+	default:
+		break;
+	}
+
+	writeString("-FAILED!\n");
+	return true;
+}
+
+void DungeonLogic::spawnMonsters() {
+	Data::MapMonsters &monsters = _G(map)._monsters;
+
+	for (int slot = 31; slot >= 1; --slot) {
+		if (monsters.isActive(slot))
+			continue;
+
+		// Each slot belongs to a single level, and picks an odd-numbered cell
+		int level = slot >> 1;
+		byte x = ((randByte() & 7) * 2) | 1;
+		byte y = ((randByte() & 7) * 2) | 1;
+		monsters._mapX[slot] = x;
+		monsters._mapY[slot] = y;
+		monsters._glyphTile[slot] = level;
+
+		byte &cell = _G(dungeon).cell(level, x, y);
+		if (cell != 0)
+			continue;
+
+		// Tougher monsters only turn up on deeper levels
+		int r = randByte() & 7;
+		if (r == 7 || r * 2 > level)
+			continue;
+
+		int type = r + 1;
+		monsters._type[slot] = type;
+		monsters._spellHP[slot] = (byte)((type * 2 + level) * 8) | 0x10;
+		cell |= type;
+	}
+}
+
+bool DungeonLogic::monsterAttacks(int slot) {
+	Data::Savegame &sg = _G(savegame);
+	Data::MapMonsters &monsters = _G(map)._monsters;
+	int level = sg._dungeonLevel;
+
+	if (randByte() < 0x40) {
+		if (monsters._glyphTile[slot] != level)
+			return true;
+
+		switch (monsters._type[slot]) {
+		case 2:
+			if (sg._lightTurns != 0) {
+				writeString("YOUR TORCH IS BLOWN OUT!\n");
+				sg._lightTurns = 0;
+			}
+			return true;
+
+		case 5:
+			writeString("A GREMLIN STOLE SOME FOOD!\n");
+			if (sg._food < 100) {
+				playerDied();
+				return false;
+			}
+			sg._food -= 100;
+			return true;
+
+		case 7:
+			writeString("YOU FEEL A STRONG MAGIC!\n");
+			sg._sleepTurns = randByte() & 7;
+			return true;
+
+		default:
+			break;
+		}
+	}
+
+	if (monsters._glyphTile[slot] != level)
+		return true;
+
+	playFX(1);
+	byte roll = randByte();
+	if ((roll & 0x80) != 0 || (roll & 7) < sg._readiedArmor)
+		return true;
+
+	int dmg = Data::bcdValue((byte)((randByte() & 0x77) + ((level * 4) & 0x77)));
+	if (sg._hp < dmg) {
+		sg._hp = 0;
+		playerDied();
+		return false;
+	}
+
+	sg._hp -= dmg;
+	return true;
+}
+
+int DungeonLogic::tryMoveMonster(int slot, int x, int y) {
+	Data::MapMonsters &monsters = _G(map)._monsters;
+	int level = _G(savegame)._dungeonLevel;
+
+	if (monsters._glyphTile[slot] != level)
+		return 0;
+
+	byte &dest = cellAt(x, y);
+	if (dest == CELL_WALL || dest == 0xFF)
+		return 0;
+	if ((dest & 7) != 0)
+		return 2;
+
+	cellAt(monsters._mapX[slot], monsters._mapY[slot]) &= 0xF0;
+	monsters._mapX[slot] = x;
+	monsters._mapY[slot] = y;
+	dest |= monsters._type[slot];
+	return 1;
+}
+
+void DungeonLogic::updateCreatures() {
+	Data::Savegame &sg = _G(savegame);
+	Data::MapMonsters &monsters = _G(map)._monsters;
+
+	spawnMonsters();
+
+	for (int slot = 31; slot >= 1; --slot) {
+		if (!monsters.isActive(slot))
+			continue;
+
+		int dx = signOf((int8)(byte)(sg._mapX - monsters._mapX[slot]));
+		int dy = signOf((int8)(byte)(sg._mapY - monsters._mapY[slot]));
+
+		// Badly hurt monsters run away
+		if (monsters._spellHP[slot] < 0x0F) {
+			dx = -dx;
+			dy = -dy;
+		}
+
+		if (dx != 0) {
+			byte x = monsters._mapX[slot] + dx, y = monsters._mapY[slot];
+			if (x == sg._mapX && y == sg._mapY) {
+				if (!monsterAttacks(slot))
+					return;
+				continue;
+			}
+
+			if (tryMoveMonster(slot, x, y) != 0)
+				continue;
+		}
+
+		if (dy != 0) {
+			byte x = monsters._mapX[slot], y = monsters._mapY[slot] + dy;
+			if (x == sg._mapX && y == sg._mapY) {
+				if (!monsterAttacks(slot))
+					return;
+				continue;
+			}
+
+			tryMoveMonster(slot, x, y);
+		}
+	}
+
+	if (sg._lightTurns == 0) {
+		writeString("IT'S DARK!\n");
+	} else if (--sg._lightTurns == 0) {
+		writeString("TORCH BURNED OUT!\n");
+	}
+
+	if (!sg.deductFood(16))
+		playerDied();
+}
+
+} // namespace Logic
+} // namespace Ultima2
+} // namespace Ultima
diff --git a/engines/ultima/ultima2/logic/dungeon_logic.h b/engines/ultima/ultima2/logic/dungeon_logic.h
new file mode 100644
index 00000000000..89feb4ffa24
--- /dev/null
+++ b/engines/ultima/ultima2/logic/dungeon_logic.h
@@ -0,0 +1,115 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#ifndef ULTIMA2_LOGIC_DUNGEON_LOGIC_H
+#define ULTIMA2_LOGIC_DUNGEON_LOGIC_H
+
+#include "ultima/ultima2/logic/logic.h"
+
+namespace Ultima {
+namespace Ultima2 {
+namespace Logic {
+
+/**
+ * Command handling inside a tower or dungeon: a first-person maze whose
+ * monsters live on individual levels, and whose movement is relative to
+ * the direction faced.
+ */
+class DungeonLogic : public Logic {
+private:
+	/**
+	 * Returns the cell on the current level at a position
+	 */
+	byte &cellAt(int x, int y) const;
+
+	/**
+	 * Returns the slot of the nearest monster on the current level in the
+	 * cell straight ahead of the player, or -1
+	 */
+	int findMonsterAhead() const;
+
+	/**
+	 * Steps forward or backward one cell, or turns left/right
+	 */
+	bool advance();
+	bool retreat();
+	bool turn(bool left);
+
+	/**
+	 * Moves up or down a level, or out to the surface when that goes past
+	 * the entrance. Returns true if the level change went ahead
+	 */
+	void changeLevel(int delta);
+	void surface();
+	void printLevel();
+
+	/**
+	 * Clears a slain monster and hands out its gold and experience
+	 */
+	void killMonster(int slot);
+
+	/**
+	 * Spawns monsters into any empty slots
+	 */
+	void spawnMonsters();
+
+	/**
+	 * Has a monster next to the player attack them. Returns false if that
+	 * killed the player
+	 */
+	bool monsterAttacks(int slot);
+
+	/**
+	 * Tries to move a monster to a cell. Returns 0 if the cell is a wall (or
+	 * on another level) so another direction is worth trying, 1 if it moved,
+	 * and 2 if it's occupied so the monster should just stay put
+	 */
+	int tryMoveMonster(int slot, int x, int y);
+
+protected:
+	void updateCreatures() override;
+	bool castSpell(Data::SpellType spell) override;
+
+	bool move(Data::Direction dir) override;
+	bool descend() override;
+	bool klimb() override;
+	bool get() override;
+
+public:
+	~DungeonLogic() override {}
+
+	/**
+	 * Entering counts as the turn's first, so monsters spawn and the
+	 * surroundings are drawn straight away
+	 */
+	void entering() override {
+		endOfTurn();
+	}
+
+	bool attack(Data::Direction dir) override;
+};
+
+} // namespace Logic
+} // namespace Ultima2
+} // namespace Ultima
+
+#endif
diff --git a/engines/ultima/ultima2/logic/logic.cpp b/engines/ultima/ultima2/logic/logic.cpp
index 35da3c5b35c..826ad071faf 100644
--- a/engines/ultima/ultima2/logic/logic.cpp
+++ b/engines/ultima/ultima2/logic/logic.cpp
@@ -352,14 +352,17 @@ bool Logic::cast() {
 	}
 
 	--sg._spellCharges[sg._readiedSpell];
+	return castSpell(sg._readiedSpell);
+}
 
-	// Spells only work in dungeons and towers, which aren't implemented yet
+bool Logic::castSpell(Data::SpellType spell) {
+	// Spells only work in towers and dungeons
 	writeString("-FAILED!\n");
 	return true;
 }
 
 bool Logic::descend() {
-	// Ladders only exist in dungeons and towers, which aren't implemented yet
+	// Ladders only exist in towers and dungeons
 	writeString("DESCEND-WHAT?\n");
 	return true;
 }
@@ -378,12 +381,6 @@ bool Logic::get() {
 	Data::Savegame &sg = _G(savegame);
 	writeString("GET");
 
-	// Chests only exist in dungeons and towers, which aren't implemented yet
-	if (sg._mapType >= 4) {
-		writeString(" WHAT?\n");
-		return true;
-	}
-
 	Data::TileId tile = _G(map).tileAt(sg._mapX, sg._mapY);
 	if (tile != Data::TILE_SWORD && tile != Data::TILE_SHIELD) {
 		writeString(" WHAT?\n");
@@ -442,7 +439,7 @@ bool Logic::jump() {
 }
 
 bool Logic::klimb() {
-	// Ladders only exist in dungeons and towers, which aren't implemented yet
+	// Ladders only exist in towers and dungeons
 	writeString("KLIMB-WHAT?\n");
 	return true;
 }
diff --git a/engines/ultima/ultima2/logic/logic.h b/engines/ultima/ultima2/logic/logic.h
index 7546d7d2ced..ad1ab51316d 100644
--- a/engines/ultima/ultima2/logic/logic.h
+++ b/engines/ultima/ultima2/logic/logic.h
@@ -124,6 +124,12 @@ protected:
 	}
 	virtual bool board();
 	virtual bool cast();
+
+	/**
+	 * Applies the effect of a spell that's just been cast
+	 */
+	virtual bool castSpell(Data::SpellType spell);
+
 	virtual bool descend();
 	virtual bool enter();
 	virtual bool get();
diff --git a/engines/ultima/ultima2/logic/overworld_logic.cpp b/engines/ultima/ultima2/logic/overworld_logic.cpp
index 619e1203c67..4cc54357d31 100644
--- a/engines/ultima/ultima2/logic/overworld_logic.cpp
+++ b/engines/ultima/ultima2/logic/overworld_logic.cpp
@@ -592,6 +592,20 @@ void OverworldLogic::enterLocalMap(int mapType) {
 	_G(map).load(sg._mapEra, sg._mapType);
 }
 
+void OverworldLogic::enterDungeon(int mapType) {
+	Data::Savegame &sg = _G(savegame);
+	sg._overworldReturnX = sg._mapX;
+	sg._overworldReturnY = sg._mapY;
+	sg._mapX = 5;
+	sg._mapY = 5;
+	sg._dungeonLevel = 0;
+	sg._facingX = 1;
+	sg._facingY = 0;
+	sg._mapType = mapType;
+	_G(map).load(sg._mapEra, sg._mapType);
+	_G(logic)->entering();
+}
+
 bool OverworldLogic::enter() {
 	Data::Savegame &sg = _G(savegame);
 	writeString("ENTER");
@@ -621,11 +635,12 @@ bool OverworldLogic::enter() {
 		enterLocalMap(3);
 		return true;
 	case Data::TILE_TOWER:
-		// Dungeon/tower first-person rendering isn't implemented yet
-		writeString("-TOWER\nNOT YET IMPLEMENTED\n");
+		writeString("-TOWER\n");
+		enterDungeon(4);
 		return true;
 	case Data::TILE_DUNGEON_ENTRANCE:
-		writeString("-DUNGEON\nNOT YET IMPLEMENTED\n");
+		writeString("-DUNGEON\n");
+		enterDungeon(5);
 		return true;
 	case Data::TILE_SIGNPOST: {
 		static const char *const ERA_TEXT[5] = {
diff --git a/engines/ultima/ultima2/logic/overworld_logic.h b/engines/ultima/ultima2/logic/overworld_logic.h
index 8ae62931eec..ae1a5f27537 100644
--- a/engines/ultima/ultima2/logic/overworld_logic.h
+++ b/engines/ultima/ultima2/logic/overworld_logic.h
@@ -46,6 +46,12 @@ private:
 	 */
 	void enterLocalMap(int mapType);
 
+	/**
+	 * Stashes the current position as the overworld return point, then
+	 * enters a tower (4) or dungeon (5) at its first level
+	 */
+	void enterDungeon(int mapType);
+
 	/**
 	 * Counts down the moongate's hop timer, moving it to its next waypoint
 	 * when it expires
diff --git a/engines/ultima/ultima2/views/dungeon_map.cpp b/engines/ultima/ultima2/views/dungeon_map.cpp
new file mode 100644
index 00000000000..9712b1a929c
--- /dev/null
+++ b/engines/ultima/ultima2/views/dungeon_map.cpp
@@ -0,0 +1,522 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "common/file.h"
+#include "common/system.h"
+#include "graphics/paletteman.h"
+#include "ultima/ultima2/data/data.h"
+#include "ultima/ultima2/gfx/pic_decoder.h"
+#include "ultima/ultima2/views/dungeon_map.h"
+#include "ultima/ultima2/ultima2.h"
+#include "ultima/ultima2/metaengine.h"
+
+namespace Ultima {
+namespace Ultima2 {
+namespace Views {
+
+namespace {
+
+// The corridor is drawn in a 256x128 area, offset from the top left corner
+constexpr int VIEW_OFFSET = 16;
+constexpr int COLOR_LINE = 3;
+constexpr int MAX_DEPTH = 8;
+
+// Cell terrain bits
+constexpr byte TERRAIN_WALL = 0x80;
+constexpr byte TERRAIN_DOOR = 0x40;
+constexpr byte TERRAIN_SECRET = 0x20;
+constexpr byte TERRAIN_LADDER_DOWN = 0x20;
+constexpr byte TERRAIN_LADDER_UP = 0x10;
+constexpr byte TERRAIN_CHEST = 0x40;
+
+// Wall corner positions for each depth, one table per edge or feature.
+// The tables sit back to back as in the original, and the drawing routines
+// index some of them past their eighth entry, so they're kept as one block
+constexpr int TABLE_BASE = 0x1620D;
+const byte TABLE[] = {
+	// 1620D
+	0x00, 0x40, 0x60, 0x70, 0x78, 0x7C, 0x7E, 0x7F, 0x7F, 0x7F,
+	// 16217
+	0xFF, 0xBF, 0x9F, 0x8F, 0x87, 0x83, 0x81, 0x80, 0x80, 0x80,
+	// 16221
+	0x00, 0x20, 0x30, 0x38, 0x3C, 0x3E, 0x3F, 0x3F,
+	// 16229
+	0x7F, 0x5F, 0x4F, 0x47, 0x43, 0x41, 0x40, 0x40,
+	// 16231
+	0x10, 0x48, 0x64, 0x72, 0x79, 0x7C, 0x7F, 0x7F,
+	// 16239
+	0x30, 0x58, 0x6C, 0x76, 0x7B, 0x7C, 0x7F, 0x7F,
+	// 16241
+	0xEF, 0xB7, 0x9B, 0x8D, 0x86, 0x83, 0x80, 0x80,
+	// 16249
+	0xCF, 0xA7, 0x93, 0x89, 0x84, 0x83, 0x80, 0x80,
+	// 16251
+	0x77, 0x5B, 0x4D, 0x46, 0x42, 0x40, 0x40, 0x40,
+	// 16259
+	0x67, 0x53, 0x49, 0x44, 0x42, 0x40, 0x40, 0x40,
+	// 16261
+	0x2A, 0x35, 0x3B, 0x3D, 0x3E, 0x3F, 0x3F, 0x3F,
+	// 16269
+	0x08, 0x24, 0x32, 0x39, 0x3C, 0x3E, 0x3F, 0x3F,
+	// 16271
+	0x18, 0x2C, 0x36, 0x3A, 0x3D, 0x3E, 0x3F, 0x3F,
+	// 16279
+	0x77, 0x5B, 0x4D, 0x46, 0x43, 0x41, 0x40, 0x40,
+	// 16281
+	0x67, 0x53, 0x49, 0x45, 0x42, 0x41, 0x40, 0x40,
+	// 16289
+	0x6F, 0x57, 0x4B, 0x45, 0x42, 0x40, 0x40, 0x40
+};
+
+// Table addresses, named for the edge they hold
+enum {
+	LEFT_X = 0x1620D,        // x of the left edge at each depth
+	LEFT_X_NEXT = 0x1620E,   // ... and at the next depth in
+	LEFT_X_NEXT2 = 0x1620F,
+	LEFT_X_NEXT3 = 0x16210,
+	RIGHT_X = 0x16217,
+	RIGHT_X_NEXT = 0x16218,
+	RIGHT_X_NEXT2 = 0x16219,
+	RIGHT_X_NEXT3 = 0x1621A,
+	TOP_Y = 0x16221,
+	TOP_Y_NEXT = 0x16222,
+	BOTTOM_Y = 0x16229,
+	BOTTOM_Y_NEXT = 0x1622A,
+	LADDER_LEFT_A = 0x16232,
+	LADDER_LEFT_B = 0x1623A,
+	LADDER_RIGHT_B = 0x16242,
+	LADDER_RIGHT_A = 0x1624A,
+	LEFT_DOOR_X = 0x16231,
+	LEFT_DOOR_X2 = 0x16239,
+	AHEAD_DOOR_X = 0x16241,
+	AHEAD_DOOR_X2 = 0x16249,
+	DOOR_BOTTOM_A = 0x16251,
+	DOOR_BOTTOM_B = 0x16259,
+	DOOR_TOP_B = 0x16261,
+	RAIL_TOP_A = 0x16269,
+	RAIL_TOP_B = 0x16271,
+	RAIL_BOTTOM_A = 0x16279,
+	RAIL_BOTTOM_B = 0x16281,
+	CHEST_BOTTOM = 0x16289
+};
+
+// The four-pixel patterns a monster sprite's blocks are drawn with
+const byte SPRITE_PATTERNS[8] = { 0xFF, 0x11, 0x88, 0xCC, 0x33, 0x00, 0x00, 0x00 };
+
+// Where a monster's sprite starts within its data page, by depth. The
+// nearest depth uses a page of its own per monster type instead
+const byte SPRITE_BAND_OFFSETS[MAX_DEPTH] = { 0, 0, 0x80, 0xC0, 0xE0, 0xF0, 0xF8, 0xFC };
+
+/**
+ * Draws lines the way the original does. Its routines share one pair of
+ * end points that each line leaves standing at its far end, so the wall
+ * shapes below only set the coordinates that change between lines
+ */
+class Painter {
+private:
+	Shared::Gfx::GfxSurface &_s;
+
+	void plot(byte x, byte y) {
+		int px = x + VIEW_OFFSET, py = y + VIEW_OFFSET;
+		if (px < 320 && py < 160)
+			_s.setPixel(px, py, COLOR_LINE);
+	}
+
+public:
+	byte _x1 = 0, _y1 = 0, _x2 = 0, _y2 = 0;
+	int _depth = 0;
+
+	Painter(Shared::Gfx::GfxSurface &s) : _s(s) {
+	}
+
+	/**
+	 * Returns an entry of the corner position tables for the current depth
+	 */
+	byte t(int address) const {
+		return TABLE[address - TABLE_BASE + _depth];
+	}
+
+	void line() {
+		if (_x1 == _x2 && _y1 == _y2)
+			return;
+
+		byte adx, ady;
+		int sx, sy;
+		if (_x2 >= _x1) {
+			adx = _x2 - _x1;
+			sx = 1;
+		} else {
+			adx = _x1 - _x2;
+			sx = -1;
+		}
+		if (_y2 >= _y1) {
+			ady = _y2 - _y1;
+			sy = 1;
+		} else {
+			ady = _y1 - _y2;
+			sy = -1;
+		}
+
+		if (adx >= ady) {
+			byte count = adx, err = adx >> 1;
+			do {
+				err += ady;
+				if (err >= adx) {
+					err -= adx;
+					_y1 += sy;
+				}
+				_x1 += sx;
+				plot(_x1, _y1);
+			} while (--count != 0);
+		} else {
+			byte count = ady, err = ady >> 1;
+			do {
+				err += adx;
+				if (err >= ady) {
+					err -= ady;
+					_x1 += sx;
+				}
+				_y1 += sy;
+				plot(_x1, _y1);
+			} while (--count != 0);
+		}
+	}
+
+	void leftOpen() {
+		_x1 = _x2 = t(LEFT_X);
+		_y1 = t(TOP_Y);
+		_y2 = t(BOTTOM_Y);
+		line();
+		_y1 = _y2 = t(TOP_Y_NEXT);
+		_x2 = t(LEFT_X_NEXT);
+		line();
+		_y2 = t(BOTTOM_Y_NEXT);
+		line();
+		_x2 = t(LEFT_X);
+		line();
+	}
+
+	void rightOpen() {
+		_x1 = _x2 = t(RIGHT_X);
+		_y1 = t(TOP_Y);
+		_y2 = t(BOTTOM_Y);
+		line();
+		_y1 = _y2 = t(TOP_Y_NEXT);
+		_x2 = t(RIGHT_X_NEXT);
+		line();
+		_y2 = t(BOTTOM_Y_NEXT);
+		line();
+		_x2 = t(RIGHT_X);
+		line();
+	}
+
+	void leftWall() {
+		_x1 = t(LEFT_X);
+		_x2 = t(LEFT_X_NEXT);
+		_y1 = t(TOP_Y);
+		_y2 = t(TOP_Y_NEXT);
+		line();
+		_x2 = t(LEFT_X);
+		_y2 = t(BOTTOM_Y);
+		_y1 = t(BOTTOM_Y_NEXT);
+		line();
+	}
+
+	void rightWall() {
+		_x1 = t(RIGHT_X);
+		_x2 = t(RIGHT_X_NEXT);
+		_y1 = t(TOP_Y);
+		_y2 = t(TOP_Y_NEXT);
+		line();
+		_x2 = t(RIGHT_X);
+		_y2 = t(BOTTOM_Y);
+		_y1 = t(BOTTOM_Y_NEXT);
+		line();
+	}
+
+	void frontWall() {
+		_x1 = t(LEFT_X);
+		_y1 = t(TOP_Y);
+		_y2 = t(TOP_Y);
+		_x2 = t(RIGHT_X);
+		line();
+		_y2 = t(BOTTOM_Y);
+		line();
+		_x2 = t(LEFT_X);
+		line();
+		_y2 = t(TOP_Y);
+		line();
+	}
+
+	void frontDoor() {
+		_x1 = _x2 = t(LEFT_X_NEXT);
+		_y1 = t(BOTTOM_Y);
+		_y2 = t(TOP_Y_NEXT);
+		line();
+		_x2 = t(RIGHT_X_NEXT);
+		line();
+		_y2 = t(BOTTOM_Y);
+		line();
+	}
+
+	void leftDoor() {
+		_x1 = _x2 = t(LEFT_DOOR_X);
+		_y1 = t(DOOR_BOTTOM_A);
+		_y2 = t(TOP_Y_NEXT);
+		line();
+		_x2 = t(LEFT_DOOR_X2);
+		_y2 = t(DOOR_TOP_B);
+		line();
+		_y2 = t(DOOR_BOTTOM_B);
+		line();
+	}
+
+	void rightDoor() {
+		_x1 = _x2 = t(AHEAD_DOOR_X);
+		_y1 = t(DOOR_BOTTOM_A);
+		_y2 = t(TOP_Y_NEXT);
+		line();
+		_x2 = t(AHEAD_DOOR_X2);
+		_y2 = t(DOOR_TOP_B);
+		line();
+		_y2 = t(DOOR_BOTTOM_B);
+		line();
+	}
+
+	void ladderRails() {
+		_x1 = _x2 = 0x7F;
+		_y1 = t(RAIL_TOP_A);
+		_y2 = t(RAIL_BOTTOM_A);
+		line();
+		_x1 = _x2 = 0x80;
+		_y1 = t(RAIL_TOP_A);
+		_y2 = t(RAIL_BOTTOM_A);
+		line();
+	}
+
+	void ladderDown() {
+		_x1 = t(LADDER_LEFT_A);
+		_x2 = t(LADDER_LEFT_B);
+		_y1 = t(RAIL_BOTTOM_A);
+		_y2 = t(RAIL_BOTTOM_B);
+		line();
+		_x2 = t(LADDER_RIGHT_A);
+		line();
+		_x2 = t(LADDER_RIGHT_B);
+		_y2 = t(RAIL_BOTTOM_A);
+		line();
+		_x2 = t(LADDER_LEFT_A);
+		line();
+		ladderRails();
+	}
+
+	void ladderUp() {
+		_x1 = t(LADDER_LEFT_A);
+		_x2 = t(LADDER_LEFT_B);
+		_y1 = t(RAIL_TOP_A);
+		_y2 = t(RAIL_TOP_B);
+		line();
+		_x2 = t(LADDER_RIGHT_A);
+		line();
+		_x2 = t(LADDER_RIGHT_B);
+		_y2 = t(RAIL_TOP_A);
+		line();
+		_x2 = t(LADDER_LEFT_A);
+		line();
+		ladderRails();
+	}
+
+	void chest() {
+		_x1 = t(LEFT_X_NEXT2);
+		_y1 = _y2 = t(CHEST_BOTTOM);
+		_x2 = t(RIGHT_X_NEXT3);
+		line();
+		_y2 = t(DOOR_BOTTOM_A);
+		line();
+		_x2 = t(LEFT_X_NEXT2);
+		line();
+		_y2 = t(CHEST_BOTTOM);
+		line();
+		_x2 = t(LEFT_X_NEXT3);
+		_y2 = t(DOOR_BOTTOM_B);
+		line();
+		_x2 = t(RIGHT_X_NEXT2);
+		line();
+		_y2 = t(CHEST_BOTTOM);
+		line();
+		_x2 = t(RIGHT_X_NEXT3);
+		_y2 = t(DOOR_BOTTOM_A);
+		line();
+		_x1 = t(RIGHT_X_NEXT3);
+		_y1 = t(CHEST_BOTTOM);
+		_x2 = t(RIGHT_X_NEXT2);
+		_y2 = t(DOOR_BOTTOM_B);
+		line();
+	}
+};
+
+} // namespace
+
+DungeonMap::DungeonMap() : Map("DungeonMap") {
+	Common::File f;
+	if (f.open("MONSTERS"))
+		f.read(_monsterSprites, sizeof(_monsterSprites));
+	else
+		warning("Could not open MONSTERS");
+}
+
+bool DungeonMap::msgFocus(const FocusMessage &msg) {
+	MetaEngine::setKeybindingMode(KBMODE_GAMEPLAY);
+	g_system->getPaletteManager()->setPalette(Graphics::Palette(Data::CGA_PALETTE1, 4));
+	return Map::msgFocus(msg);
+}
+
+bool DungeonMap::msgUnfocus(const UnfocusMessage &msg) {
+	MetaEngine::setKeybindingMode(KBMODE_MINIMAL);
+	return Map::msgUnfocus(msg);
+}
+
+bool DungeonMap::tick() {
+	// There's no water or forcefield to animate here
+	return Shared::Gfx::View::tick();
+}
+
+int DungeonMap::drawCorridor(Shared::Gfx::GfxSurface &s) {
+	Data::Savegame &sg = _G(savegame);
+	Data::MapDungeon &dungeon = _G(dungeon);
+	int level = sg._dungeonLevel;
+	int fx = sg._facingX, fy = sg._facingY;
+
+	// Read the cells down the corridor and to either side of it
+	byte left[MAX_DEPTH], center[MAX_DEPTH], right[MAX_DEPTH], monsters[MAX_DEPTH];
+	byte lx = sg._mapX + fy, ly = sg._mapY - fx;
+	byte cx = sg._mapX, cy = sg._mapY;
+	byte rx = sg._mapX - fy, ry = sg._mapY + fx;
+
+	for (int d = 0; d < MAX_DEPTH; ++d) {
+		byte x = lx & 0x3F, y = ly & 0x3F;
+		left[d] = dungeon.cell(level, x, y) & 0xF0;
+		lx = x + fx;
+		ly = y + fy;
+
+		x = cx & 0x3F;
+		y = cy & 0x3F;
+		byte c = dungeon.cell(level, x, y);
+		center[d] = c & 0xF0;
+		monsters[d] = c & 7;
+		cx = x + fx;
+		cy = y + fy;
+
+		x = rx & 0x3F;
+		y = ry & 0x3F;
+		right[d] = dungeon.cell(level, x, y) & 0xF0;
+		rx = x + fx;
+		ry = y + fy;
+	}
+
+	Painter p(s);
+	p._depth = 0;
+	p.frontWall();
+
+	int d = 0;
+	for (;;) {
+		p._depth = d;
+		byte c = center[d];
+
+		if (c & TERRAIN_WALL) {
+			p.frontWall();
+			if ((c & TERRAIN_DOOR) == 0 || (c & TERRAIN_SECRET) != 0)
+				break;
+
+			p.frontDoor();
+			if (d != 0 || ++d >= MAX_DEPTH)
+				break;
+			continue;
+		}
+
+		if (c & TERRAIN_LADDER_DOWN)
+			p.ladderDown();
+		if (c & TERRAIN_LADDER_UP)
+			p.ladderUp();
+		else if (c & TERRAIN_CHEST)
+			p.chest();
+
+		byte l = left[d];
+		if (l & TERRAIN_WALL) {
+			p.leftWall();
+			if ((l & TERRAIN_DOOR) && !(l & TERRAIN_SECRET))
+				p.leftDoor();
+		} else {
+			p.leftOpen();
+		}
+
+		byte r = right[d];
+		if (r & TERRAIN_WALL) {
+			p.rightWall();
+			if ((r & TERRAIN_DOOR) && !(r & TERRAIN_SECRET))
+				p.rightDoor();
+		} else {
+			p.rightOpen();
+		}
+
+		if (++d >= MAX_DEPTH - 1)
+			break;
+	}
+
+	drawMonster(s, monsters, d + 1);
+	return d;
+}
+
+void DungeonMap::drawMonster(Shared::Gfx::GfxSurface &s, const byte *monsters, int depth) {
+	for (int d = 1; d < depth && d < MAX_DEPTH; ++d) {
+		if (monsters[d] == 0)
+			continue;
+
+		// Only the nearest monster in view is drawn
+		int offset = (d == 1) ? monsters[d] * 256 : SPRITE_BAND_OFFSETS[d];
+		while (offset + 1 < (int)sizeof(_monsterSprites) && _monsterSprites[offset] != 0) {
+			int x = (_monsterSprites[offset] + 4) * 4;
+			int y = (_monsterSprites[offset + 1] & 0x1F) * 4 + VIEW_OFFSET;
+			byte pattern = SPRITE_PATTERNS[_monsterSprites[offset + 1] >> 5];
+			offset += 2;
+
+			for (int row = 0; row < 4; ++row) {
+				for (int col = 0; col < 4; ++col)
+					s.setPixel(x + col, y + row, (pattern >> ((3 - col) * 2)) & 3);
+			}
+		}
+
+		return;
+	}
+}
+
+void DungeonMap::draw() {
+	auto s = getSurface();
+	s.clear();
+
+	// Nothing can be seen without a light
+	if (_G(savegame)._lightTurns > 0)
+		drawCorridor(s);
+}
+
+} // namespace Views
+} // namespace Ultima2
+} // namespace Ultima
diff --git a/engines/ultima/ultima2/views/dungeon_map.h b/engines/ultima/ultima2/views/dungeon_map.h
new file mode 100644
index 00000000000..20381bb403a
--- /dev/null
+++ b/engines/ultima/ultima2/views/dungeon_map.h
@@ -0,0 +1,69 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#ifndef ULTIMA2_VIEWS_DUNGEON_MAP_H
+#define ULTIMA2_VIEWS_DUNGEON_MAP_H
+
+#include "ultima/ultima2/views/map.h"
+
+namespace Ultima {
+namespace Ultima2 {
+namespace Views {
+
+/**
+ * Renders the first-person wireframe corridor seen from inside a tower or
+ * dungeon, along with the nearest monster in view
+ */
+class DungeonMap : public Map {
+private:
+	byte _monsterSprites[2048] = {};
+
+	/**
+	 * Draws the corridor ahead. Returns the depth it was drawn out to
+	 */
+	int drawCorridor(Shared::Gfx::GfxSurface &s);
+
+	/**
+	 * Draws the nearest monster in the corridor, out to the given depth
+	 */
+	void drawMonster(Shared::Gfx::GfxSurface &s, const byte *monsters, int depth);
+
+protected:
+	Graphics::Surface *tileGraphics() override {
+		return nullptr;
+	}
+
+public:
+	DungeonMap();
+	~DungeonMap() override {}
+
+	bool msgFocus(const FocusMessage &msg) override;
+	bool msgUnfocus(const UnfocusMessage &msg) override;
+	void draw() override;
+	bool tick() override;
+};
+
+} // namespace Views
+} // namespace Ultima2
+} // namespace Ultima
+
+#endif
diff --git a/engines/ultima/ultima2/views/views.h b/engines/ultima/ultima2/views/views.h
index dae63f3cb1c..07c13876ac1 100644
--- a/engines/ultima/ultima2/views/views.h
+++ b/engines/ultima/ultima2/views/views.h
@@ -24,6 +24,7 @@
 
 #include "ultima/shared/engine/events.h"
 #include "ultima/ultima2/views/create_character.h"
+#include "ultima/ultima2/views/dungeon_map.h"
 #include "ultima/ultima2/views/game.h"
 #include "ultima/ultima2/views/location_map.h"
 #include "ultima/ultima2/views/overworld_map.h"
@@ -68,6 +69,7 @@ struct Views : public Shared::Views {
 	Interactions::Shop _wizardSpellShop{Interactions::Shop::SPELL_WIZARD, "WizardSpellShop"};
 
 	CreateCharacter _createCharacter;
+	DungeonMap _dungeonMap;
 	Game _game;
 	LocationMap _locationMap;
 	OverworldMap _overworldMap;


Commit: 7a6fef6e6a7415ca79e949f412e7a4dc52415ee6
    https://github.com/scummvm/scummvm/commit/7a6fef6e6a7415ca79e949f412e7a4dc52415ee6
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:40:56+11:00

Commit Message:
ULTIMA: ULTIMA2: Save and restore the current map and monster state

Changed paths:
    engines/ultima/ultima2/data/map.cpp
    engines/ultima/ultima2/data/map.h
    engines/ultima/ultima2/data/map_dungeon.h
    engines/ultima/ultima2/data/map_monsters.cpp
    engines/ultima/ultima2/data/map_monsters.h
    engines/ultima/ultima2/ultima2.cpp


diff --git a/engines/ultima/ultima2/data/map.cpp b/engines/ultima/ultima2/data/map.cpp
index 377aa7d2152..f954757fc10 100644
--- a/engines/ultima/ultima2/data/map.cpp
+++ b/engines/ultima/ultima2/data/map.cpp
@@ -112,6 +112,22 @@ void Map::load(int mapEra, int mapType) {
 	showMapView(mapType == 0 ? "OverworldMap" : "LocationMap");
 }
 
+void Map::synchronize(Common::Serializer &s, bool isDungeon) {
+	_monsters.synchronize(s);
+
+	if (isDungeon) {
+		_G(dungeon).synchronize(s);
+	} else {
+		for (int y = 0; y < MAP_HEIGHT; ++y) {
+			for (int x = 0; x < MAP_WIDTH; ++x) {
+				byte tile = _tiles[y][x];
+				s.syncAsByte(tile);
+				_tiles[y][x] = (TileId)tile;
+			}
+		}
+	}
+}
+
 void Map::loadDungeon(int mapEra, int mapType) {
 	_G(dungeon).load(mapEra, mapType);
 	_monsters.load(mapEra, mapType);
diff --git a/engines/ultima/ultima2/data/map.h b/engines/ultima/ultima2/data/map.h
index 4fd1af53699..d3a136c4b47 100644
--- a/engines/ultima/ultima2/data/map.h
+++ b/engines/ultima/ultima2/data/map.h
@@ -23,6 +23,7 @@
 #define ULTIMA2_DATA_MAP_H
 
 #include "common/array.h"
+#include "common/serializer.h"
 #include "common/str.h"
 #include "ultima/ultima2/data/tiles.h"
 #include "ultima/ultima2/data/map_monsters.h"
@@ -67,6 +68,13 @@ private:
 public:
 	void load(int mapEra, int mapType);
 
+	/**
+	 * Saves or restores the current map's contents and monsters as they
+	 * are now, including changes made during play. Loading expects the
+	 * map to have been loaded first
+	 */
+	void synchronize(Common::Serializer &s, bool isDungeon);
+
 	/**
 	 * Returns the given line of the map's NPC dialogue, or an empty string
 	 * if there isn't one
diff --git a/engines/ultima/ultima2/data/map_dungeon.h b/engines/ultima/ultima2/data/map_dungeon.h
index cdce188d65b..edb303bd3a6 100644
--- a/engines/ultima/ultima2/data/map_dungeon.h
+++ b/engines/ultima/ultima2/data/map_dungeon.h
@@ -23,6 +23,7 @@
 #define ULTIMA2_DATA_MAP_DUNGEON_H
 
 #include "common/scummsys.h"
+#include "common/serializer.h"
 
 namespace Ultima {
 namespace Ultima2 {
@@ -55,6 +56,10 @@ struct MapDungeon {
 
 	void load(int mapEra, int mapType);
 
+	void synchronize(Common::Serializer &s) {
+		s.syncBytes(&_cells[0][0][0], sizeof(_cells));
+	}
+
 	/**
 	 * Returns the cell at the given position on a level. Addresses it the
 	 * way the original does - a byte index within the level's 256-byte
diff --git a/engines/ultima/ultima2/data/map_monsters.cpp b/engines/ultima/ultima2/data/map_monsters.cpp
index 85dd1925a32..6048a893436 100644
--- a/engines/ultima/ultima2/data/map_monsters.cpp
+++ b/engines/ultima/ultima2/data/map_monsters.cpp
@@ -43,6 +43,17 @@ void MapMonsters::load(int mapEra, int mapType) {
 	f.read(_tempY, MAP_MONSTER_COUNT);
 }
 
+void MapMonsters::synchronize(Common::Serializer &s) {
+	s.syncBytes(_mapX, MAP_MONSTER_COUNT);
+	s.syncBytes(_mapY, MAP_MONSTER_COUNT);
+	s.syncBytes(_spellHP, MAP_MONSTER_COUNT);
+	s.syncBytes(_type, MAP_MONSTER_COUNT);
+	s.syncBytes(_glyphTile, MAP_MONSTER_COUNT);
+	s.syncBytes(_offerFlag, MAP_MONSTER_COUNT);
+	s.syncBytes(_tempX, MAP_MONSTER_COUNT);
+	s.syncBytes(_tempY, MAP_MONSTER_COUNT);
+}
+
 } // namespace Data
 } // namespace Ultima2
 } // namespace Ultima
diff --git a/engines/ultima/ultima2/data/map_monsters.h b/engines/ultima/ultima2/data/map_monsters.h
index b62d582f955..a3694ba46d4 100644
--- a/engines/ultima/ultima2/data/map_monsters.h
+++ b/engines/ultima/ultima2/data/map_monsters.h
@@ -23,6 +23,7 @@
 #define ULTIMA2_DATA_MAP_MONSTERS_H
 
 #include "common/scummsys.h"
+#include "common/serializer.h"
 #include "ultima/ultima2/data/tiles.h"
 
 namespace Ultima {
@@ -48,6 +49,8 @@ struct MapMonsters {
 
 	void load(int mapEra, int mapType);
 
+	void synchronize(Common::Serializer &s);
+
 	bool isActive(int slot) const {
 		return _type[slot] != 0;
 	}
diff --git a/engines/ultima/ultima2/ultima2.cpp b/engines/ultima/ultima2/ultima2.cpp
index 23892f9646d..c00a80a3727 100644
--- a/engines/ultima/ultima2/ultima2.cpp
+++ b/engines/ultima/ultima2/ultima2.cpp
@@ -97,9 +97,14 @@ bool Ultima2Engine::canLoadGameStateCurrently(Common::U32String *msg) {
 Common::Error Ultima2Engine::syncGame(Common::Serializer &s) {
 	_savegame.synchronize(s);
 
-	if (s.isLoading()) {
+	if (s.isLoading())
 		_G(map).load(_G(savegame)._mapEra, _G(savegame)._mapType);
-	}
+
+	_G(map).synchronize(s, _G(savegame)._mapType >= 4);
+
+	// The views were drawn from the freshly loaded map, before its saved state was applied
+	if (s.isLoading())
+		focusedView()->redraw();
 
 	return Common::kNoError;
 }


Commit: ba7fde83427c05cf8a70c6de9ff98a1cf78dfae3
    https://github.com/scummvm/scummvm/commit/ba7fde83427c05cf8a70c6de9ff98a1cf78dfae3
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:40:56+11:00

Commit Message:
ULTIMA: ULTIMA2: Fix drawing grass tiles outside town/cities

Changed paths:
    engines/ultima/ultima2/views/location_map.cpp
    engines/ultima/ultima2/views/location_map.h


diff --git a/engines/ultima/ultima2/views/location_map.cpp b/engines/ultima/ultima2/views/location_map.cpp
index b8a5652556f..dcbc4942f4f 100644
--- a/engines/ultima/ultima2/views/location_map.cpp
+++ b/engines/ultima/ultima2/views/location_map.cpp
@@ -97,9 +97,8 @@ void LocationMap::draw() {
 			Data::TileId tileId;
 
 			if (x < 0 || x >= Data::MAP_WIDTH || y < 0 || y >= Data::MAP_HEIGHT) {
-				// Local maps don't wrap - anything off the edge shows as
-				// Mountain, giving villages/towns/castles a walled border
-				tileId = Data::TILE_MOUNTAIN;
+				// Local maps don't wrap - anything off the edge shows as grass
+				tileId = Data::TILE_GRASS;
 			} else {
 				tileId = _G(map).tileAt(x, y);
 
diff --git a/engines/ultima/ultima2/views/location_map.h b/engines/ultima/ultima2/views/location_map.h
index 7f50ad93717..8362a361f60 100644
--- a/engines/ultima/ultima2/views/location_map.h
+++ b/engines/ultima/ultima2/views/location_map.h
@@ -32,7 +32,7 @@ namespace Views {
 /**
  * Renders the 20x10-tile viewport centered on the player for a village,
  * town, or castle map. Like OverworldMap, but cells outside the map's
- * 0-63 bounds show as Mountain (there's no wraparound - walking off the
+ * 0-63 bounds show as grass (there's no wraparound - walking off the
  * edge instead exits back to the overworld, see CityCastleLogic::move)
  */
 class LocationMap : public Map {


Commit: 1bfd1b3c703da6479342df764f62a59c66b77297
    https://github.com/scummvm/scummvm/commit/1bfd1b3c703da6479342df764f62a59c66b77297
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:40:57+11:00

Commit Message:
ULTIMA: ULTIMA2: Add an inventory debug console command

Changed paths:
    engines/ultima/ultima2/console.cpp
    engines/ultima/ultima2/console.h


diff --git a/engines/ultima/ultima2/console.cpp b/engines/ultima/ultima2/console.cpp
index 2b76ea8e06a..d6d0bdb00d9 100644
--- a/engines/ultima/ultima2/console.cpp
+++ b/engines/ultima/ultima2/console.cpp
@@ -38,6 +38,7 @@ Console::Console() : GUI::Debugger() {
 	registerCmd("hp", WRAP_METHOD(Console, cmdHP));
 	registerCmd("food", WRAP_METHOD(Console, cmdFood));
 	registerCmd("gold", WRAP_METHOD(Console, cmdGold));
+	registerCmd("inventory", WRAP_METHOD(Console, cmdInventory));
 }
 
 Console::~Console() {
@@ -282,5 +283,47 @@ bool Console::cmdGold(int argc, const char **argv) {
 	return true;
 }
 
+bool Console::cmdInventory(int argc, const char **argv) {
+	Data::Savegame &sg = _G(savegame);
+
+	for (int i = 1; i < Data::ARMOR_COUNT; ++i)
+		sg._armorOwned[i] = 9;
+	for (int i = 1; i < Data::WEAPON_COUNT; ++i)
+		sg._weaponOwned[i] = 9;
+	for (int i = 1; i < Data::SPELL_COUNT; ++i)
+		sg._spellCharges[i] = 99;
+	for (int i = 0; i < Data::ITEM_COUNT; ++i)
+		sg._items[i] = 9;
+
+	sg._torches = 99;
+	sg._keys = 99;
+	sg._thievesTools = 99;
+	sg._enilnoOwned = true;
+	sg._hp = sg._food = sg._gold = 9999;
+	sg._foodTurnCtr = 0;
+
+	// Equip the best that the character's strength and agility allow
+	sg._readiedWeapon = Data::WEAPON_HANDS;
+	for (int i = Data::WEAPON_COUNT - 1; i > 0; --i) {
+		if (i * 8 < sg._agility) {
+			sg._readiedWeapon = (Data::WeaponType)i;
+			break;
+		}
+	}
+
+	sg._readiedArmor = Data::ARMOR_SKIN;
+	for (int i = Data::ARMOR_COUNT - 1; i > 0; --i) {
+		if (i * 8 < sg._strength) {
+			sg._readiedArmor = (Data::ArmorType)i;
+			break;
+		}
+	}
+
+	g_engine->baseView()->findView("Stats")->draw();
+	debugPrintf("Full inventory given; readied %s and %s armour\n",
+		Data::WEAPON_NAMES[sg._readiedWeapon], Data::ARMOR_NAMES[sg._readiedArmor]);
+	return true;
+}
+
 } // namespace Ultima2
 } // namespace Ultima
diff --git a/engines/ultima/ultima2/console.h b/engines/ultima/ultima2/console.h
index bfe81131046..f2e0e90e0d7 100644
--- a/engines/ultima/ultima2/console.h
+++ b/engines/ultima/ultima2/console.h
@@ -40,6 +40,7 @@ private:
 	bool cmdHP(int argc, const char **argv);
 	bool cmdFood(int argc, const char **argv);
 	bool cmdGold(int argc, const char **argv);
+	bool cmdInventory(int argc, const char **argv);
 public:
 	Console();
 	~Console() override;


Commit: 5527e2b9e3aeb1ff63eaf4dbdb171f2743fdc2ce
    https://github.com/scummvm/scummvm/commit/5527e2b9e3aeb1ff63eaf4dbdb171f2743fdc2ce
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:40:57+11:00

Commit Message:
ULTIMA: ULTIMA2: Pass the turn after 5 idle seconds

Changed paths:
    engines/ultima/ultima2/logic/logic.cpp
    engines/ultima/ultima2/views/dungeon_map.cpp
    engines/ultima/ultima2/views/interactions/direction.cpp
    engines/ultima/ultima2/views/interactions/direction.h
    engines/ultima/ultima2/views/map.cpp
    engines/ultima/ultima2/views/map.h


diff --git a/engines/ultima/ultima2/logic/logic.cpp b/engines/ultima/ultima2/logic/logic.cpp
index 826ad071faf..03b9cf15267 100644
--- a/engines/ultima/ultima2/logic/logic.cpp
+++ b/engines/ultima/ultima2/logic/logic.cpp
@@ -504,7 +504,15 @@ bool Logic::offer(Data::Direction dir) {
 }
 
 bool Logic::pass() {
+	Data::Savegame &sg = _G(savegame);
 	writeString("PASS\n");
+
+	// Waiting costs a little food outside towers and dungeons
+	if (sg._mapType < 4 && !sg.deductFood(10)) {
+		playerDied();
+		return false;
+	}
+
 	return true;
 }
 
diff --git a/engines/ultima/ultima2/views/dungeon_map.cpp b/engines/ultima/ultima2/views/dungeon_map.cpp
index 9712b1a929c..beec6c8a209 100644
--- a/engines/ultima/ultima2/views/dungeon_map.cpp
+++ b/engines/ultima/ultima2/views/dungeon_map.cpp
@@ -396,6 +396,7 @@ bool DungeonMap::msgUnfocus(const UnfocusMessage &msg) {
 
 bool DungeonMap::tick() {
 	// There's no water or forcefield to animate here
+	checkIdle();
 	return Shared::Gfx::View::tick();
 }
 
diff --git a/engines/ultima/ultima2/views/interactions/direction.cpp b/engines/ultima/ultima2/views/interactions/direction.cpp
index 20d668a5317..717cf6fe445 100644
--- a/engines/ultima/ultima2/views/interactions/direction.cpp
+++ b/engines/ultima/ultima2/views/interactions/direction.cpp
@@ -28,14 +28,29 @@ namespace Ultima2 {
 namespace Views {
 namespace Interactions {
 
+constexpr uint32 TIMEOUT = 5000;
+
 Direction::Direction() : Interaction("Direction") {
 }
 
 bool Direction::msgFocus(const FocusMessage &msg) {
 	MetaEngine::setKeybindingMode(KBMODE_MINIMAL);
+	_startTime = g_system->getMillis();
 	return Interaction::msgFocus(msg);
 }
 
+bool Direction::tick() {
+	// If no direction is given in time, the command is abandoned and a turn passes
+	if (g_system->getMillis() - _startTime >= TIMEOUT) {
+		writeString("PASS\n");
+		close();
+		_G(logic)->resumeTurn();
+		return true;
+	}
+
+	return Interaction::tick();
+}
+
 bool Direction::msgKeypress(const KeypressMessage &msg) {
 	Data::Direction dir;
 	switch (msg.keycode) {
diff --git a/engines/ultima/ultima2/views/interactions/direction.h b/engines/ultima/ultima2/views/interactions/direction.h
index 7b475850061..a16020a29f4 100644
--- a/engines/ultima/ultima2/views/interactions/direction.h
+++ b/engines/ultima/ultima2/views/interactions/direction.h
@@ -35,11 +35,15 @@ namespace Interactions {
  * arrow keypress arrives raw instead of as a movement action
  */
 class Direction : public Interaction {
+private:
+	uint32 _startTime = 0;
+
 public:
 	Direction();
 	~Direction() override {}
 
 	bool msgFocus(const FocusMessage &msg) override;
+	bool tick() override;
 	bool msgKeypress(const KeypressMessage &msg) override;
 };
 
diff --git a/engines/ultima/ultima2/views/map.cpp b/engines/ultima/ultima2/views/map.cpp
index 69eed2b1f19..3be9a21553a 100644
--- a/engines/ultima/ultima2/views/map.cpp
+++ b/engines/ultima/ultima2/views/map.cpp
@@ -22,6 +22,7 @@
 #include "common/system.h"
 #include "ultima/ultima2/views/map.h"
 #include "ultima/ultima2/ultima2.h"
+#include "ultima/ultima2/metaengine.h"
 
 namespace Ultima {
 namespace Ultima2 {
@@ -31,13 +32,30 @@ namespace Views {
 // four rows and the forcefield tile one row per step
 constexpr uint32 ANIMATION_DELAY = 150;
 constexpr int WATER_SCROLL_ROWS = 4;
+
+// Without a command for this long, the original passes the turn for you
+constexpr uint32 IDLE_DELAY = 5000;
 constexpr int FORCEFIELD_SCROLL_ROWS = 1;
 
+bool Map::msgFocus(const FocusMessage &msg) {
+	_lastInput = g_system->getMillis();
+	return View::msgFocus(msg);
+}
+
 bool Map::msgAction(const ActionMessage &msg) {
+	_lastInput = g_system->getMillis();
 	g_engine->_logic->action(msg._action);
 	return true;
 }
 
+void Map::checkIdle() {
+	uint32 now = g_system->getMillis();
+	if (now - _lastInput >= IDLE_DELAY) {
+		_lastInput = now;
+		g_engine->_logic->action(KEYBIND_PASS);
+	}
+}
+
 bool Map::tick() {
 	uint32 now = g_system->getMillis();
 	if (now - _lastAnimation >= ANIMATION_DELAY) {
@@ -49,10 +67,12 @@ bool Map::tick() {
 		redraw();
 	}
 
+	checkIdle();
 	return View::tick();
 }
 
 bool Map::msgKeypress(const KeypressMessage &msg) {
+	_lastInput = g_system->getMillis();
 	g_engine->_logic->keypress(msg);
 	return true;
 }
diff --git a/engines/ultima/ultima2/views/map.h b/engines/ultima/ultima2/views/map.h
index 186176c893a..38d7af02791 100644
--- a/engines/ultima/ultima2/views/map.h
+++ b/engines/ultima/ultima2/views/map.h
@@ -38,6 +38,7 @@ class Map : public Shared::Gfx::View {
 public:
 private:
 	uint32 _lastAnimation = 0;
+	uint32 _lastInput = 0;
 
 protected:
 	/**
@@ -45,12 +46,18 @@ protected:
 	 */
 	virtual Graphics::Surface *tileGraphics() = 0;
 
+	/**
+	 * Passes the turn if no command has been given for a while
+	 */
+	void checkIdle();
+
 public:
 	Map(const Common::String &name) : View(name) {
 		setBounds(TextRect(0, 0, 39, 19));
 	}
 	~Map() override {}
 
+	bool msgFocus(const FocusMessage &msg) override;
 	bool msgAction(const ActionMessage &msg) override;
 	bool msgKeypress(const KeypressMessage &msg) override;
 	bool tick() override;


Commit: ed17cf8df005db7b35ce2c2aa02a42ff7109db71
    https://github.com/scummvm/scummvm/commit/ed17cf8df005db7b35ce2c2aa02a42ff7109db71
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:40:57+11:00

Commit Message:
ULTIMA: ULTIMA2: Flash the dungeon view when a monster hits the player

Changed paths:
    engines/ultima/ultima2/logic/dungeon_logic.cpp
    engines/ultima/ultima2/views/dungeon_map.cpp
    engines/ultima/ultima2/views/dungeon_map.h


diff --git a/engines/ultima/ultima2/logic/dungeon_logic.cpp b/engines/ultima/ultima2/logic/dungeon_logic.cpp
index 1ba62d0d07f..86da8b18804 100644
--- a/engines/ultima/ultima2/logic/dungeon_logic.cpp
+++ b/engines/ultima/ultima2/logic/dungeon_logic.cpp
@@ -491,6 +491,7 @@ bool DungeonLogic::monsterAttacks(int slot) {
 	if ((roll & 0x80) != 0 || (roll & 7) < sg._readiedArmor)
 		return true;
 
+	showAttackTile(0, 0);
 	int dmg = Data::bcdValue((byte)((randByte() & 0x77) + ((level * 4) & 0x77)));
 	if (sg._hp < dmg) {
 		sg._hp = 0;
diff --git a/engines/ultima/ultima2/views/dungeon_map.cpp b/engines/ultima/ultima2/views/dungeon_map.cpp
index beec6c8a209..185b399e586 100644
--- a/engines/ultima/ultima2/views/dungeon_map.cpp
+++ b/engines/ultima/ultima2/views/dungeon_map.cpp
@@ -394,6 +394,27 @@ bool DungeonMap::msgUnfocus(const UnfocusMessage &msg) {
 	return Map::msgUnfocus(msg);
 }
 
+bool DungeonMap::msgAttackTile(const AttackTileMessage &msg) {
+	// Being hit inverts the whole view, briefly
+	for (int i = 0; i < 2; ++i) {
+		auto s = getSurface();
+		for (int y = 0; y < s.h; ++y) {
+			byte *pixels = (byte *)s.getBasePtr(0, y);
+			for (int x = 0; x < s.w; ++x)
+				pixels[x] ^= 3;
+		}
+
+		s.markAllDirty();
+		g_engine->updateScreen();
+
+		if (i == 0)
+			// Pause briefly after initial inversion
+			g_engine->pauseMillis(80);
+	}
+
+	return true;
+}
+
 bool DungeonMap::tick() {
 	// There's no water or forcefield to animate here
 	checkIdle();
diff --git a/engines/ultima/ultima2/views/dungeon_map.h b/engines/ultima/ultima2/views/dungeon_map.h
index 20381bb403a..8868eb046ff 100644
--- a/engines/ultima/ultima2/views/dungeon_map.h
+++ b/engines/ultima/ultima2/views/dungeon_map.h
@@ -58,6 +58,7 @@ public:
 
 	bool msgFocus(const FocusMessage &msg) override;
 	bool msgUnfocus(const UnfocusMessage &msg) override;
+	bool msgAttackTile(const AttackTileMessage &msg) override;
 	void draw() override;
 	bool tick() override;
 };


Commit: 70326d8456648042ef8718f08af1b3ff00180107
    https://github.com/scummvm/scummvm/commit/70326d8456648042ef8718f08af1b3ff00180107
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:40:57+11:00

Commit Message:
ULTIMA: ULTIMA2: Make the commands area 30 columns wide like the original

Changed paths:
    engines/ultima/ultima2/views/commands.cpp
    engines/ultima/ultima2/views/game.cpp


diff --git a/engines/ultima/ultima2/views/commands.cpp b/engines/ultima/ultima2/views/commands.cpp
index 4385ba44234..ee0739d9858 100644
--- a/engines/ultima/ultima2/views/commands.cpp
+++ b/engines/ultima/ultima2/views/commands.cpp
@@ -75,7 +75,7 @@ void Commands::writeString(const Common::String &msg) {
 }
 
 void Commands::resetLine() {
-	_surface.fillRect(TextRect(0, PROMPT_ROW, 28, PROMPT_ROW), 0);
+	_surface.fillRect(TextRect(0, PROMPT_ROW, 29, PROMPT_ROW), 0);
 	_surface.setTextPos(Common::Point(0, PROMPT_ROW));
 }
 
diff --git a/engines/ultima/ultima2/views/game.cpp b/engines/ultima/ultima2/views/game.cpp
index f40c48bffa1..7e4553935d8 100644
--- a/engines/ultima/ultima2/views/game.cpp
+++ b/engines/ultima/ultima2/views/game.cpp
@@ -28,7 +28,7 @@ namespace Views {
 
 Game::Game() : Shared::Gfx::View("Game"), _commands(this), _stats(this) {
 	setBounds(TextRect(0, 0, 39, 24));
-	_commands.setBounds(TextRect(0, 20, 28, 23));
+	_commands.setBounds(TextRect(0, 20, 29, 23));
 	_stats.setBounds(TextRect(30, 20, 39, 23));
 }
 


Commit: a4eb81ced2ff315aa21756130f0aa4e24b5f8bb1
    https://github.com/scummvm/scummvm/commit/a4eb81ced2ff315aa21756130f0aa4e24b5f8bb1
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:40:57+11:00

Commit Message:
ULTIMA: ULTIMA2: Add a secret ` key dungeon minimap

Changed paths:
    engines/ultima/ultima2/views/dungeon_map.cpp
    engines/ultima/ultima2/views/dungeon_map.h


diff --git a/engines/ultima/ultima2/views/dungeon_map.cpp b/engines/ultima/ultima2/views/dungeon_map.cpp
index 185b399e586..a2b6f85283d 100644
--- a/engines/ultima/ultima2/views/dungeon_map.cpp
+++ b/engines/ultima/ultima2/views/dungeon_map.cpp
@@ -39,6 +39,17 @@ constexpr int VIEW_OFFSET = 16;
 constexpr int COLOR_LINE = 3;
 constexpr int MAX_DEPTH = 8;
 
+// The minimap draws each cell as a square of this many pixels
+constexpr int MINIMAP_SCALE = 2;
+constexpr int MINIMAP_PASSAGE = 0;
+constexpr int MINIMAP_LADDER = 1;
+constexpr int MINIMAP_MONSTER = 2;
+constexpr int MINIMAP_WALL = 3;
+
+// An extra palette entry beyond the game's four, just for the player marker
+constexpr int MINIMAP_PLAYER = 4;
+const byte MINIMAP_PLAYER_RGB[3] = { 0x55, 0xff, 0x55 };
+
 // Cell terrain bits
 constexpr byte TERRAIN_WALL = 0x80;
 constexpr byte TERRAIN_DOOR = 0x40;
@@ -385,7 +396,10 @@ DungeonMap::DungeonMap() : Map("DungeonMap") {
 
 bool DungeonMap::msgFocus(const FocusMessage &msg) {
 	MetaEngine::setKeybindingMode(KBMODE_GAMEPLAY);
-	g_system->getPaletteManager()->setPalette(Graphics::Palette(Data::CGA_PALETTE1, 4));
+	Graphics::Palette palette(5);
+	palette.set(Data::CGA_PALETTE1, 0, 4);
+	palette.set(MINIMAP_PLAYER_RGB, MINIMAP_PLAYER, 1);
+	g_system->getPaletteManager()->setPalette(palette);
 	return Map::msgFocus(msg);
 }
 
@@ -415,6 +429,46 @@ bool DungeonMap::msgAttackTile(const AttackTileMessage &msg) {
 	return true;
 }
 
+bool DungeonMap::msgKeypress(const KeypressMessage &msg) {
+	// Secret debugging aid: minmap toggle
+	if (msg.keycode == Common::KEYCODE_BACKQUOTE || msg.keycode == Common::KEYCODE_TILDE) {
+		_showMinimap = !_showMinimap;
+		redraw();
+		return true;
+	}
+
+	return Map::msgKeypress(msg);
+}
+
+void DungeonMap::drawMinimap(Shared::Gfx::GfxSurface &s) {
+	Data::Savegame &sg = _G(savegame);
+	Data::MapDungeon &dungeon = _G(dungeon);
+	const int left = 320 - (Data::DUNGEON_WIDTH + 2) * MINIMAP_SCALE;
+
+	// Runs one cell past each edge, since the edge of the level acts as a wall
+	for (int y = -1; y <= Data::DUNGEON_HEIGHT; ++y) {
+		for (int x = -1; x <= Data::DUNGEON_WIDTH; ++x) {
+			bool outside = x < 0 || y < 0 || x >= Data::DUNGEON_WIDTH || y >= Data::DUNGEON_HEIGHT;
+			byte cell = outside ? TERRAIN_WALL : dungeon.cell(sg._dungeonLevel, x, y);
+			int color = MINIMAP_PASSAGE;
+
+			if (x == sg._mapX && y == sg._mapY)
+				color = MINIMAP_PLAYER;
+			else if (cell & 7)
+				color = MINIMAP_MONSTER;
+			else if (cell & TERRAIN_WALL)
+				color = MINIMAP_WALL;
+			else if (cell & (TERRAIN_LADDER_UP | TERRAIN_LADDER_DOWN))
+				color = MINIMAP_LADDER;
+
+			for (int py = 0; py < MINIMAP_SCALE; ++py) {
+				for (int px = 0; px < MINIMAP_SCALE; ++px)
+					s.setPixel(left + (x + 1) * MINIMAP_SCALE + px, (y + 1) * MINIMAP_SCALE + py, color);
+			}
+		}
+	}
+}
+
 bool DungeonMap::tick() {
 	// There's no water or forcefield to animate here
 	checkIdle();
@@ -537,6 +591,9 @@ void DungeonMap::draw() {
 	// Nothing can be seen without a light
 	if (_G(savegame)._lightTurns > 0)
 		drawCorridor(s);
+
+	if (_showMinimap)
+		drawMinimap(s);
 }
 
 } // namespace Views
diff --git a/engines/ultima/ultima2/views/dungeon_map.h b/engines/ultima/ultima2/views/dungeon_map.h
index 8868eb046ff..07368c76f3a 100644
--- a/engines/ultima/ultima2/views/dungeon_map.h
+++ b/engines/ultima/ultima2/views/dungeon_map.h
@@ -36,6 +36,12 @@ namespace Views {
 class DungeonMap : public Map {
 private:
 	byte _monsterSprites[2048] = {};
+	bool _showMinimap = false;
+
+	/**
+	 * Draws a small map of the current level in the top right corner
+	 */
+	void drawMinimap(Shared::Gfx::GfxSurface &s);
 
 	/**
 	 * Draws the corridor ahead. Returns the depth it was drawn out to
@@ -59,6 +65,7 @@ public:
 	bool msgFocus(const FocusMessage &msg) override;
 	bool msgUnfocus(const UnfocusMessage &msg) override;
 	bool msgAttackTile(const AttackTileMessage &msg) override;
+	bool msgKeypress(const KeypressMessage &msg) override;
 	void draw() override;
 	bool tick() override;
 };


Commit: 1339feecb0f86808374ffa3be1808900d1723409
    https://github.com/scummvm/scummvm/commit/1339feecb0f86808374ffa3be1808900d1723409
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:40:57+11:00

Commit Message:
ULTIMA: ULTIMA2: Use the CGA palette everywhere, set once at startup

Changed paths:
    engines/ultima/ultima2/data/data.cpp
    engines/ultima/ultima2/data/data.h
    engines/ultima/ultima2/gfx/text_cursor.h
    engines/ultima/ultima2/ultima2.cpp
    engines/ultima/ultima2/views/create_character.cpp
    engines/ultima/ultima2/views/dungeon_map.cpp
    engines/ultima/ultima2/views/location_map.cpp
    engines/ultima/ultima2/views/overworld_map.cpp
    engines/ultima/ultima2/views/startup.cpp
    engines/ultima/ultima2/views/title.cpp
    engines/ultima/ultima2/views/title.h


diff --git a/engines/ultima/ultima2/data/data.cpp b/engines/ultima/ultima2/data/data.cpp
index 3a988b0be98..ac3ce638cf6 100644
--- a/engines/ultima/ultima2/data/data.cpp
+++ b/engines/ultima/ultima2/data/data.cpp
@@ -19,6 +19,8 @@
  *
  */
 
+#include "common/system.h"
+#include "graphics/paletteman.h"
 #include "ultima/ultima2/data/data.h"
 
 namespace Ultima {
@@ -32,6 +34,15 @@ const byte CGA_PALETTE1[4 * 3] = {
 	0xff, 0xff, 0xff  // 3: white
 };
 
+void setCGAPalette() {
+	Graphics::Palette palette(PALETTE_PLAYER_MARKER + 1);
+	palette.set(CGA_PALETTE1, 0, 4);
+
+	const byte green[3] = { 0x55, 0xff, 0x55 };
+	palette.set(green, PALETTE_PLAYER_MARKER, 1);
+	g_system->getPaletteManager()->setPalette(palette);
+}
+
 const char *const WEAPON_NAMES[WEAPON_COUNT] = {
 	"HANDS", "DAGGER", "MACE", "AXE", "BOW", "SWORD",
 	"GREAT SWORD", "LIGHT SWORD", "PHASER", "QUICK SWORD"
diff --git a/engines/ultima/ultima2/data/data.h b/engines/ultima/ultima2/data/data.h
index c259c22cc86..5c56f8d8387 100644
--- a/engines/ultima/ultima2/data/data.h
+++ b/engines/ultima/ultima2/data/data.h
@@ -32,6 +32,16 @@ namespace Data {
 // palette used by both the pic??? art and the embedded tile graphics
 extern const byte CGA_PALETTE1[4 * 3];
 
+// An extra bright green entry after the four CGA colors, used by the
+// dungeon minimap's player marker
+constexpr int PALETTE_PLAYER_MARKER = 4;
+
+/**
+ * Switches the screen to the CGA palette that the game itself, the tile
+ * graphics and the pic??? art all use
+ */
+void setCGAPalette();
+
 constexpr int MAX_NAME_LENGTH = 12;
 
 enum Direction {
diff --git a/engines/ultima/ultima2/gfx/text_cursor.h b/engines/ultima/ultima2/gfx/text_cursor.h
index ec6b3cf7afc..c3923f3645f 100644
--- a/engines/ultima/ultima2/gfx/text_cursor.h
+++ b/engines/ultima/ultima2/gfx/text_cursor.h
@@ -39,7 +39,7 @@ private:
 	byte _color;
 
 public:
-	TextCursor(const Common::String &name, UIElement *parent = nullptr, byte color = 15);
+	TextCursor(const Common::String &name, UIElement *parent = nullptr, byte color = 3);
 	~TextCursor() override {}
 
 	void draw() override;
diff --git a/engines/ultima/ultima2/ultima2.cpp b/engines/ultima/ultima2/ultima2.cpp
index c00a80a3727..d06b9b66298 100644
--- a/engines/ultima/ultima2/ultima2.cpp
+++ b/engines/ultima/ultima2/ultima2.cpp
@@ -55,6 +55,7 @@ Common::Error Ultima2Engine::run() {
 
 	// Initialize 320x200 paletted graphics mode
 	initGraphics(320, 200);
+	Data::setCGAPalette();
 
 	// Set the engine's debugger console
 	setDebugger(new Console());
diff --git a/engines/ultima/ultima2/views/create_character.cpp b/engines/ultima/ultima2/views/create_character.cpp
index 4c09de31627..135ebd4a0f5 100644
--- a/engines/ultima/ultima2/views/create_character.cpp
+++ b/engines/ultima/ultima2/views/create_character.cpp
@@ -26,7 +26,7 @@ namespace Ultima {
 namespace Ultima2 {
 namespace Views {
 
-constexpr int COLOR_TEXT = 15; // white
+constexpr int COLOR_TEXT = 3; // white, within CGA_PALETTE1
 
 constexpr int STARTING_POINTS = 90;
 constexpr int MIN_ATTRIBUTE = 10;
diff --git a/engines/ultima/ultima2/views/dungeon_map.cpp b/engines/ultima/ultima2/views/dungeon_map.cpp
index a2b6f85283d..0ad68ee61bd 100644
--- a/engines/ultima/ultima2/views/dungeon_map.cpp
+++ b/engines/ultima/ultima2/views/dungeon_map.cpp
@@ -46,9 +46,6 @@ constexpr int MINIMAP_LADDER = 1;
 constexpr int MINIMAP_MONSTER = 2;
 constexpr int MINIMAP_WALL = 3;
 
-// An extra palette entry beyond the game's four, just for the player marker
-constexpr int MINIMAP_PLAYER = 4;
-const byte MINIMAP_PLAYER_RGB[3] = { 0x55, 0xff, 0x55 };
 
 // Cell terrain bits
 constexpr byte TERRAIN_WALL = 0x80;
@@ -396,10 +393,6 @@ DungeonMap::DungeonMap() : Map("DungeonMap") {
 
 bool DungeonMap::msgFocus(const FocusMessage &msg) {
 	MetaEngine::setKeybindingMode(KBMODE_GAMEPLAY);
-	Graphics::Palette palette(5);
-	palette.set(Data::CGA_PALETTE1, 0, 4);
-	palette.set(MINIMAP_PLAYER_RGB, MINIMAP_PLAYER, 1);
-	g_system->getPaletteManager()->setPalette(palette);
 	return Map::msgFocus(msg);
 }
 
@@ -453,7 +446,7 @@ void DungeonMap::drawMinimap(Shared::Gfx::GfxSurface &s) {
 			int color = MINIMAP_PASSAGE;
 
 			if (x == sg._mapX && y == sg._mapY)
-				color = MINIMAP_PLAYER;
+				color = Data::PALETTE_PLAYER_MARKER;
 			else if (cell & 7)
 				color = MINIMAP_MONSTER;
 			else if (cell & TERRAIN_WALL)
diff --git a/engines/ultima/ultima2/views/location_map.cpp b/engines/ultima/ultima2/views/location_map.cpp
index dcbc4942f4f..93f90e48c52 100644
--- a/engines/ultima/ultima2/views/location_map.cpp
+++ b/engines/ultima/ultima2/views/location_map.cpp
@@ -50,7 +50,6 @@ LocationMap::~LocationMap() {
 
 bool LocationMap::msgFocus(const FocusMessage &msg) {
 	MetaEngine::setKeybindingMode(KBMODE_GAMEPLAY);
-	g_system->getPaletteManager()->setPalette(Graphics::Palette(Data::CGA_PALETTE1, 4));
 	return Map::msgFocus(msg);
 }
 
diff --git a/engines/ultima/ultima2/views/overworld_map.cpp b/engines/ultima/ultima2/views/overworld_map.cpp
index 7942b56e903..edf05e7b466 100644
--- a/engines/ultima/ultima2/views/overworld_map.cpp
+++ b/engines/ultima/ultima2/views/overworld_map.cpp
@@ -51,7 +51,6 @@ OverworldMap::~OverworldMap() {
 
 bool OverworldMap::msgFocus(const FocusMessage &msg) {
 	MetaEngine::setKeybindingMode(KBMODE_GAMEPLAY);
-	g_system->getPaletteManager()->setPalette(Graphics::Palette(Data::CGA_PALETTE1, 4));
 	return Map::msgFocus(msg);
 }
 
diff --git a/engines/ultima/ultima2/views/startup.cpp b/engines/ultima/ultima2/views/startup.cpp
index 32f236f2bfc..7edabba9958 100644
--- a/engines/ultima/ultima2/views/startup.cpp
+++ b/engines/ultima/ultima2/views/startup.cpp
@@ -27,7 +27,7 @@ namespace Views {
 
 #define DELAY_SECONDS 3
 
-#define COLOR_FOREGROUND 15 // white
+#define COLOR_FOREGROUND 3 // white, within CGA_PALETTE1
 
 bool Startup::msgFocus(const FocusMessage &msg) {
 	delaySeconds(DELAY_SECONDS);
diff --git a/engines/ultima/ultima2/views/title.cpp b/engines/ultima/ultima2/views/title.cpp
index 6a18f0e572b..d9725680381 100644
--- a/engines/ultima/ultima2/views/title.cpp
+++ b/engines/ultima/ultima2/views/title.cpp
@@ -30,12 +30,7 @@ namespace Ultima {
 namespace Ultima2 {
 namespace Views {
 
-// Color used for the picture-caption text, an index into the picture's
-// own 4-color CGA palette (see Gfx::PicDecoder) rather than the engine's
-// standard 16-color EGA one used for the plain text screens/menu
-constexpr int COLOR_CAPTION = 3; // white, within CGA_PALETTE1
-
-constexpr int COLOR_TEXT = 15; // white, within the standard EGA palette
+constexpr int COLOR_TEXT = 3; // white, within CGA_PALETTE1
 
 Title::Title() : View("Title"), _cursor("Cursor", this) {
 	// Position the cursor right after "CHOICE:"
@@ -51,7 +46,6 @@ void Title::loadPic(const Common::String &filename) {
 
 	_pic.create(320, 200);
 	_pic.blitFrom(*decoder.getSurface());
-	_picPalette = decoder.getPalette();
 }
 
 bool Title::msgFocus(const FocusMessage &msg) {
@@ -117,11 +111,9 @@ void Title::draw() {
 	bool hasPicture = _state == PICDRA || _state >= DEMO_OUT;
 
 	if (hasPicture) {
-		g_system->getPaletteManager()->setPalette(_picPalette);
 		s.blitFrom(_pic);
-		s.setColor(COLOR_CAPTION);
+		s.setColor(COLOR_TEXT);
 	} else {
-		g_system->getPaletteManager()->setPalette(Graphics::Palette::createEGAPalette());
 		s.clear();
 		s.setColor(COLOR_TEXT);
 	}
diff --git a/engines/ultima/ultima2/views/title.h b/engines/ultima/ultima2/views/title.h
index 157bf0a9dfb..7a60f8e6cc4 100644
--- a/engines/ultima/ultima2/views/title.h
+++ b/engines/ultima/ultima2/views/title.h
@@ -53,7 +53,6 @@ private:
 
 	// The single picture currently on screen, if any (loaded lazily per state)
 	Graphics::ManagedSurface _pic;
-	Graphics::Palette _picPalette;
 
 	// Blinking cursor shown after "CHOICE:" while the menu is active
 	Gfx::TextCursor _cursor;


Commit: 52be98ab053de93803d5f25ac32b784c376a3e30
    https://github.com/scummvm/scummvm/commit/52be98ab053de93803d5f25ac32b784c376a3e30
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:40:57+11:00

Commit Message:
ULTIMA: ULTIMA2: Add rocket launch, hyperwarp space flight and landing

Changed paths:
  A engines/ultima/ultima2/logic/space_logic.cpp
  A engines/ultima/ultima2/logic/space_logic.h
  A engines/ultima/ultima2/views/interactions/hyperwarp_target.cpp
  A engines/ultima/ultima2/views/interactions/hyperwarp_target.h
  A engines/ultima/ultima2/views/interactions/rocket_landing.cpp
  A engines/ultima/ultima2/views/interactions/rocket_landing.h
  A engines/ultima/ultima2/views/space_map.cpp
  A engines/ultima/ultima2/views/space_map.h
    engines/ultima/module.mk
    engines/ultima/ultima2/data/data.cpp
    engines/ultima/ultima2/data/data.h
    engines/ultima/ultima2/data/map.cpp
    engines/ultima/ultima2/data/savegame.cpp
    engines/ultima/ultima2/data/savegame.h
    engines/ultima/ultima2/logic/logic.cpp
    engines/ultima/ultima2/logic/logic.h
    engines/ultima/ultima2/logic/overworld_logic.cpp
    engines/ultima/ultima2/views/views.h


diff --git a/engines/ultima/module.mk b/engines/ultima/module.mk
index 340281ca55e..0de923709b2 100644
--- a/engines/ultima/module.mk
+++ b/engines/ultima/module.mk
@@ -123,6 +123,7 @@ MODULE_OBJS += \
 	ultima2/logic/dungeon_logic.o \
 	ultima2/logic/logic.o \
 	ultima2/logic/overworld_logic.o \
+	ultima2/logic/space_logic.o \
 	ultima2/views/commands.o \
 	ultima2/views/create_character.o \
 	ultima2/views/dungeon_map.o \
@@ -130,6 +131,7 @@ MODULE_OBJS += \
 	ultima2/views/location_map.o \
 	ultima2/views/map.o \
 	ultima2/views/overworld_map.o \
+	ultima2/views/space_map.o \
 	ultima2/views/startup.o \
 	ultima2/views/stats.o \
 	ultima2/views/title.o \
@@ -140,11 +142,13 @@ MODULE_OBJS += \
 	ultima2/views/interactions/dead.o \
 	ultima2/views/interactions/direction.o \
 	ultima2/views/interactions/food_shop.o \
+	ultima2/views/interactions/hyperwarp_target.o \
 	ultima2/views/interactions/offer_gold.o \
 	ultima2/views/interactions/plane_flight.o \
 	ultima2/views/interactions/pub.o \
 	ultima2/views/interactions/ready_spell.o \
 	ultima2/views/interactions/ready_weapon.o \
+	ultima2/views/interactions/rocket_landing.o \
 	ultima2/views/interactions/shop.o \
 	ultima2/views/interactions/transport.o \
 	ultima2/views/interactions/wear_armor.o \
diff --git a/engines/ultima/ultima2/data/data.cpp b/engines/ultima/ultima2/data/data.cpp
index ac3ce638cf6..449caaaab59 100644
--- a/engines/ultima/ultima2/data/data.cpp
+++ b/engines/ultima/ultima2/data/data.cpp
@@ -34,6 +34,15 @@ const byte CGA_PALETTE1[4 * 3] = {
 	0xff, 0xff, 0xff  // 3: white
 };
 
+const char *const PLANET_NAMES[PLANET_COUNT] = {
+	"EARTH", "MERCURY", "VENUS", "MARS", "JUPITER", "SATURN", "URANUS", "NEPTUNE", "PLUTO"
+};
+
+const byte PLANET_COORDS[PLANET_COUNT + 1][3] = {
+	{ 6, 6, 6 }, { 5, 4, 5 }, { 3, 3, 4 }, { 6, 2, 3 }, { 1, 3, 4 },
+	{ 2, 8, 5 }, { 9, 4, 6 }, { 4, 0, 5 }, { 0, 1, 4 }, { 9, 9, 9 }
+};
+
 void setCGAPalette() {
 	Graphics::Palette palette(PALETTE_PLAYER_MARKER + 1);
 	palette.set(CGA_PALETTE1, 0, 4);
diff --git a/engines/ultima/ultima2/data/data.h b/engines/ultima/ultima2/data/data.h
index 5c56f8d8387..7a1f6ec25ee 100644
--- a/engines/ultima/ultima2/data/data.h
+++ b/engines/ultima/ultima2/data/data.h
@@ -36,6 +36,14 @@ extern const byte CGA_PALETTE1[4 * 3];
 // dungeon minimap's player marker
 constexpr int PALETTE_PLAYER_MARKER = 4;
 
+// Names of the worlds that can be orbited, indexed by Savegame::_orbitTarget
+constexpr int PLANET_COUNT = 9;
+extern const char *const PLANET_NAMES[PLANET_COUNT];
+
+// Hyperwarp coordinates (XENO, YAKO, ZABO) of each world, indexed the same
+// way, with a tenth entry for planet X
+extern const byte PLANET_COORDS[PLANET_COUNT + 1][3];
+
 /**
  * Switches the screen to the CGA palette that the game itself, the tile
  * graphics and the pic??? art all use
diff --git a/engines/ultima/ultima2/data/map.cpp b/engines/ultima/ultima2/data/map.cpp
index f954757fc10..5c47b63bbd1 100644
--- a/engines/ultima/ultima2/data/map.cpp
+++ b/engines/ultima/ultima2/data/map.cpp
@@ -31,16 +31,21 @@ namespace Ultima {
 namespace Ultima2 {
 namespace Data {
 
+// The other planets' files are named with a G rather than the usual X
+static char filePrefix() {
+	return _G(savegame)._orbitTarget == 0 ? 'X' : 'G';
+}
+
 Common::String mapFilename(int mapEra, int mapType) {
-	return Common::String::format("MAPX%c%c", '0' + mapEra, '0' + mapType);
+	return Common::String::format("MAP%c%c%c", filePrefix(), '0' + mapEra, '0' + mapType);
 }
 
 Common::String monsterFilename(int mapEra, int mapType) {
-	return Common::String::format("MONX%c%c", '0' + mapEra, '0' + mapType);
+	return Common::String::format("MON%c%c%c", filePrefix(), '0' + mapEra, '0' + mapType);
 }
 
 Common::String talkFilename(int mapEra, int mapType) {
-	return Common::String::format("TLKX%c%c", '0' + mapEra, '0' + mapType);
+	return Common::String::format("TLK%c%c%c", filePrefix(), '0' + mapEra, '0' + mapType);
 }
 
 void Map::loadTalk(int mapEra, int mapType) {
diff --git a/engines/ultima/ultima2/data/savegame.cpp b/engines/ultima/ultima2/data/savegame.cpp
index 05e7deb2e3b..3cc4e9b5c91 100644
--- a/engines/ultima/ultima2/data/savegame.cpp
+++ b/engines/ultima/ultima2/data/savegame.cpp
@@ -89,7 +89,6 @@ void Savegame::synchronize(Common::Serializer &s) {
 	s.syncAsByte(_launchMapX);
 	s.syncAsByte(_launchMapY);
 
-	s.syncAsByte(_saveDisabled);
 	s.syncAsSint16LE(_orbitTarget);
 
 	s.syncAsByte(_ringQuestFlag);
diff --git a/engines/ultima/ultima2/data/savegame.h b/engines/ultima/ultima2/data/savegame.h
index a31d1b45e9e..c13790e2ad4 100644
--- a/engines/ultima/ultima2/data/savegame.h
+++ b/engines/ultima/ultima2/data/savegame.h
@@ -91,10 +91,9 @@ struct Savegame {
 	byte _launchMapX = 0;
 	byte _launchMapY = 0;
 
-	bool _saveDisabled = false;
-	// -1 when not orbiting/in deep space; 0-8 selects a planet being
-	// orbited; 9 gates a one-off castle NPC interaction
-	int16 _orbitTarget = -1;
+	// The world the player is on or orbiting: 0 is Earth, 1-8 the other
+	// planets, 9 planet X and 10 deep space. Saving only works on Earth
+	int16 _orbitTarget = 0;
 
 	bool _ringQuestFlag = false;
 	bool _enilnoOwned = false;
@@ -130,6 +129,14 @@ struct Savegame {
 	 */
 	void synchronize(Common::Serializer &s);
 
+	/**
+	 * Returns true if the game can't be saved here, which is anywhere
+	 * but Earth
+	 */
+	bool saveDisabled() const {
+		return _orbitTarget != 0;
+	}
+
 	/**
 	 * Returns true if a character has been created or loaded
 	 */
diff --git a/engines/ultima/ultima2/logic/logic.cpp b/engines/ultima/ultima2/logic/logic.cpp
index 03b9cf15267..f3609e3edf5 100644
--- a/engines/ultima/ultima2/logic/logic.cpp
+++ b/engines/ultima/ultima2/logic/logic.cpp
@@ -20,6 +20,7 @@
  */
 
 #include "ultima/ultima2/logic/logic.h"
+#include "ultima/ultima2/logic/space_logic.h"
 #include "ultima/ultima2/ultima2.h"
 #include "ultima/ultima2/metaengine.h"
 
@@ -458,10 +459,22 @@ bool Logic::launch() {
 		return false;
 	} else if (sg._mount == Data::TILE_ROCKET) {
 		writeString("LAUNCH--ROCKET");
-		if (sg._items[Data::ITEM_TRI_LITHIUM] == 0)
+		if (sg._items[Data::ITEM_TRI_LITHIUM] == 0) {
 			writeString("\nA METALLIC VOICE SAYS:\nSHIP INCAPABLE OF LAUNCH!\n");
-		else
-			writeString("\nNOT YET IMPLEMENTED\n");
+			return true;
+		}
+
+		writeString("\nPREPARE FOR LAUNCH!\n");
+
+		// The first launch from Earth remembers where to come back to
+		if (sg._orbitTarget == 0 && sg._mapType == 0) {
+			sg._launchMapX = sg._mapX;
+			sg._launchMapY = sg._mapY;
+			sg._inSpace = true;
+		}
+
+		SpaceLogic::takeOff();
+		return false;
 	} else {
 		writeString("LAUNCH WHAT?\n");
 	}
@@ -522,7 +535,7 @@ bool Logic::quit() {
 
 	if (sg._mapType != 0)
 		writeString("\nONLY OUTDOORS!\n");
-	else if (sg._saveDisabled)
+	else if (sg.saveDisabled())
 		writeString("\nONLY ON EARTH!\n");
 	else if (sg._mount != 0)
 		writeString("\nONLY ON FOOT!\n");
diff --git a/engines/ultima/ultima2/logic/logic.h b/engines/ultima/ultima2/logic/logic.h
index ad1ab51316d..cf76710cfd3 100644
--- a/engines/ultima/ultima2/logic/logic.h
+++ b/engines/ultima/ultima2/logic/logic.h
@@ -56,12 +56,6 @@ protected:
 	 */
 	void prompt();
 
-	/**
-	 * Handles the player dying - clears their resources and returns to
-	 * the title screen
-	 */
-	void playerDied();
-
 	/**
 	 * Alerts nearby town guards (slots 0-7, plus optionally the specific
 	 * slot just interacted with) after an attack or theft. A no-op on the
@@ -191,6 +185,12 @@ public:
 	virtual void tick() {
 	}
 
+	/**
+	 * Handles the player dying - clears their resources and returns to
+	 * the title screen
+	 */
+	void playerDied();
+
 	/**
 	 * Resumes end of turn processing after a command deferred it (returned
 	 * false from action()) to run some sub-interaction first
diff --git a/engines/ultima/ultima2/logic/overworld_logic.cpp b/engines/ultima/ultima2/logic/overworld_logic.cpp
index 4cc54357d31..af2da37072f 100644
--- a/engines/ultima/ultima2/logic/overworld_logic.cpp
+++ b/engines/ultima/ultima2/logic/overworld_logic.cpp
@@ -217,7 +217,7 @@ void OverworldLogic::enterMoongate(int x, int y) {
 
 void OverworldLogic::updatePatrolMarker() {
 	Data::Savegame &sg = _G(savegame);
-	if (sg._saveDisabled || --sg._patrolTimer != 0)
+	if (sg.saveDisabled() || --sg._patrolTimer != 0)
 		return;
 
 	auto moongateAt = [&](int waypoint) -> Data::TileId & {
diff --git a/engines/ultima/ultima2/logic/space_logic.cpp b/engines/ultima/ultima2/logic/space_logic.cpp
new file mode 100644
index 00000000000..623a9b9ae06
--- /dev/null
+++ b/engines/ultima/ultima2/logic/space_logic.cpp
@@ -0,0 +1,214 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#include "common/file.h"
+#include "ultima/ultima2/logic/space_logic.h"
+#include "ultima/ultima2/views/space_map.h"
+#include "ultima/ultima2/ultima2.h"
+#include "ultima/ultima2/metaengine.h"
+
+namespace Ultima {
+namespace Ultima2 {
+namespace Logic {
+
+namespace {
+
+constexpr int DEEP_SPACE = 10;
+constexpr int PLANET_X = 9;
+
+// The ship's steering position, which is also where the stars radiate from
+constexpr byte CENTER_X = 0x80, CENTER_Y = 0x40;
+
+// Reflective armour or better is needed to survive the launch
+constexpr int SAFE_ARMOR = Data::ARMOR_REFLECT;
+
+} // namespace
+
+void SpaceLogic::takeOff() {
+	Data::Savegame &sg = _G(savegame);
+	SpaceLogic *logic = new SpaceLogic();
+
+	int world = MIN<int>(sg._orbitTarget, PLANET_X);
+	for (int i = 0; i < 3; ++i)
+		logic->_coords[i] = Data::PLANET_COORDS[world][i];
+
+	--sg._items[Data::ITEM_TRI_LITHIUM];
+	logic->_launching = true;
+
+	_G(logic) = Common::SharedPtr<Logic>(logic);
+	g_engine->replaceView("SpaceMap");
+}
+
+void SpaceLogic::hyperwarpTo(int xeno, int yako, int zabo) {
+	_coords[0] = xeno;
+	_coords[1] = yako;
+	_coords[2] = zabo;
+
+	static_cast<Views::SpaceMap *>(g_engine->findView("SpaceMap"))->startSpinDown();
+}
+
+bool SpaceLogic::announceOrbit() {
+	Data::Savegame &sg = _G(savegame);
+
+	if (_coords[0] == 4 && _coords[1] == 4 && _coords[2] == 4) {
+		writeString("\n\nYOU HIT THE SUN!\n");
+		playerDied();
+		return false;
+	}
+
+	for (int world = PLANET_X; world >= 0; --world) {
+		if (_coords[0] == Data::PLANET_COORDS[world][0] && _coords[1] == Data::PLANET_COORDS[world][1] &&
+				_coords[2] == Data::PLANET_COORDS[world][2]) {
+			sg._orbitTarget = world;
+			writeString("YOU ARE ORBITING %s.\n", world == PLANET_X ? "X" : Data::PLANET_NAMES[world]);
+			return true;
+		}
+	}
+
+	sg._orbitTarget = DEEP_SPACE;
+	writeString("YOU ARE IN DEEP SPACE.\n");
+	return true;
+}
+
+void SpaceLogic::warpFinished() {
+	Data::Savegame &sg = _G(savegame);
+	auto *view = static_cast<Views::SpaceMap *>(g_engine->findView("SpaceMap"));
+
+	// The ship strays when the fuel level's low digit is a 3 or 7
+	if ((Data::toBcd(sg._items[Data::ITEM_TRI_LITHIUM] % 100) & 3) == 3) {
+		writeString("SHIP OFF COURSE!\n");
+		for (int i = 0; i < 3; ++i)
+			_coords[i] = view->nextStarCoord() & 7;
+	}
+
+	if (!announceOrbit())
+		return;
+
+	if (_launching) {
+		_launching = false;
+
+		if (sg._readiedArmor < SAFE_ARMOR) {
+			writeString("\nYOU HAVE EXPLODED!\n\n");
+			playerDied();
+			return;
+		}
+	}
+
+	view->redraw();
+	prompt();
+}
+
+void SpaceLogic::hyperwarp() {
+	Data::Savegame &sg = _G(savegame);
+
+	if (sg._items[Data::ITEM_TRI_LITHIUM] == 0) {
+		writeString("NO FUEL!\n");
+		prompt();
+		return;
+	}
+
+	--sg._items[Data::ITEM_TRI_LITHIUM];
+	static_cast<Views::SpaceMap *>(g_engine->findView("SpaceMap"))->setShip(CENTER_X, CENTER_Y);
+
+	writeString("HYPERWARP TO:\n");
+	g_engine->addView("HyperwarpTarget");
+}
+
+void SpaceLogic::land() {
+	Data::Savegame &sg = _G(savegame);
+	auto *view = static_cast<Views::SpaceMap *>(g_engine->findView("SpaceMap"));
+
+	view->setShip(CENTER_X, CENTER_Y);
+	writeString("LANDING REQUESTED!\n");
+	if (!announceOrbit())
+		return;
+
+	// Earth is always reached in its present day, and the other worlds
+	// come from their own files
+	int world = sg._orbitTarget;
+	int era = (world == 0) ? 4 : world;
+	if (world == DEEP_SPACE || !Common::File::exists(Data::mapFilename(era, 0).c_str()) ||
+			!Common::File::exists(Data::monsterFilename(era, 0).c_str())) {
+		writeString("REQUEST DENIED!\n");
+		prompt();
+		return;
+	}
+
+	// Keep hold of this logic until the map load replaces it
+	Common::SharedPtr<Logic> hold = _G(logic);
+
+	sg._mapEra = era;
+	sg._mapType = 0;
+	sg._mapX = 0;
+	sg._mapY = 0;
+	_G(map).load(era, 0);
+	g_engine->addView("RocketLanding");
+}
+
+void SpaceLogic::action(int action) {
+	Common::SharedPtr<Logic> hold = _G(logic);
+	auto *view = static_cast<Views::SpaceMap *>(g_engine->findView("SpaceMap"));
+
+	// Nothing can be commanded while a hyperwarp is under way
+	if (view->busy())
+		return;
+
+	switch (action) {
+	case KEYBIND_LEFT:
+		writeString("LEFT\n");
+		view->setShip(0x20, CENTER_Y);
+		prompt();
+		break;
+	case KEYBIND_RIGHT:
+		writeString("RIGHT\n");
+		view->setShip(0xDF, CENTER_Y);
+		prompt();
+		break;
+	case KEYBIND_UP:
+		writeString("CLIMB\n");
+		view->setShip(CENTER_X, 0x10);
+		prompt();
+		break;
+	case KEYBIND_DOWN:
+		writeString("DIVE\n");
+		view->setShip(CENTER_X, 0x6F);
+		prompt();
+		break;
+	case KEYBIND_HYPER:
+		hyperwarp();
+		break;
+	case KEYBIND_LAUNCH:
+		land();
+		break;
+	default:
+		view->setShip(CENTER_X, CENTER_Y);
+		break;
+	}
+}
+
+void SpaceLogic::keypress(const Shared::Messages::KeypressMessage &msg) {
+	static_cast<Views::SpaceMap *>(g_engine->findView("SpaceMap"))->setShip(CENTER_X, CENTER_Y);
+}
+
+} // namespace Logic
+} // namespace Ultima2
+} // namespace Ultima
diff --git a/engines/ultima/ultima2/logic/space_logic.h b/engines/ultima/ultima2/logic/space_logic.h
new file mode 100644
index 00000000000..ad621bc38e4
--- /dev/null
+++ b/engines/ultima/ultima2/logic/space_logic.h
@@ -0,0 +1,91 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#ifndef ULTIMA2_LOGIC_SPACE_LOGIC_H
+#define ULTIMA2_LOGIC_SPACE_LOGIC_H
+
+#include "ultima/ultima2/logic/logic.h"
+
+namespace Ultima {
+namespace Ultima2 {
+namespace Logic {
+
+/**
+ * Command handling while flying a rocket between worlds. There's no turn
+ * structure: the ship can be steered, hyperwarped to a set of XENO/YAKO/ZABO
+ * coordinates, and landed when orbiting a world
+ */
+class SpaceLogic : public Logic {
+private:
+	// The coordinates being flown to, or that were last reached
+	byte _coords[3] = {};
+
+	// Set until the first hyperwarp after launch completes
+	bool _launching = false;
+
+	/**
+	 * Reports the world the coordinates put the ship at. Returns false if
+	 * that was fatal
+	 */
+	bool announceOrbit();
+
+	/**
+	 * Starts a hyperwarp, once fuel is confirmed
+	 */
+	void hyperwarp();
+
+	/**
+	 * Lands on the world being orbited
+	 */
+	void land();
+
+public:
+	~SpaceLogic() override {}
+
+	/**
+	 * Takes off from the current world, switching to space flight
+	 */
+	static void takeOff();
+
+	const byte *coords() const {
+		return _coords;
+	}
+
+	/**
+	 * Called with the coordinates the player chose to hyperwarp to
+	 */
+	void hyperwarpTo(int xeno, int yako, int zabo);
+
+	/**
+	 * Called by the space view once a hyperwarp animation completes
+	 */
+	void warpFinished();
+
+	void action(int action) override;
+	void keypress(const Shared::Messages::KeypressMessage &msg) override;
+};
+
+} // namespace Logic
+} // namespace Ultima2
+} // namespace Ultima
+
+#endif
diff --git a/engines/ultima/ultima2/views/interactions/hyperwarp_target.cpp b/engines/ultima/ultima2/views/interactions/hyperwarp_target.cpp
new file mode 100644
index 00000000000..9235a9d2646
--- /dev/null
+++ b/engines/ultima/ultima2/views/interactions/hyperwarp_target.cpp
@@ -0,0 +1,74 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "ultima/ultima2/views/interactions/hyperwarp_target.h"
+#include "ultima/ultima2/logic/space_logic.h"
+#include "ultima/ultima2/ultima2.h"
+#include "ultima/ultima2/metaengine.h"
+
+namespace Ultima {
+namespace Ultima2 {
+namespace Views {
+namespace Interactions {
+
+static const char *const PROMPTS[3] = { "XENO=", " YAKO=", " ZABO=" };
+
+HyperwarpTarget::HyperwarpTarget() : Interaction("HyperwarpTarget") {
+}
+
+bool HyperwarpTarget::msgFocus(const FocusMessage &msg) {
+	MetaEngine::setKeybindingMode(KBMODE_MINIMAL);
+	_count = 0;
+	writeString(PROMPTS[0]);
+	return Interaction::msgFocus(msg);
+}
+
+bool HyperwarpTarget::msgKeypress(const KeypressMessage &msg) {
+	if (msg.ascii < '0' || msg.ascii > '9')
+		return true;
+
+	_digits[_count] = msg.ascii - '0';
+	writeString("%d", _digits[_count]);
+
+	if (++_count < 3) {
+		writeString(PROMPTS[_count]);
+		return true;
+	}
+
+	close();
+	writeString("\nPREPARE FOR HYPERWARP!\n");
+
+	auto *logic = dynamic_cast<Logic::SpaceLogic *>(_G(logic).get());
+	if (logic)
+		logic->hyperwarpTo(_digits[0], _digits[1], _digits[2]);
+	return true;
+}
+
+bool HyperwarpTarget::tick() {
+	// The stars keep streaming past while the coordinates are entered
+	g_engine->findView("SpaceMap")->tick();
+	return Interaction::tick();
+}
+
+} // namespace Interactions
+} // namespace Views
+} // namespace Ultima2
+} // namespace Ultima
diff --git a/engines/ultima/ultima2/views/interactions/hyperwarp_target.h b/engines/ultima/ultima2/views/interactions/hyperwarp_target.h
new file mode 100644
index 00000000000..d578419192c
--- /dev/null
+++ b/engines/ultima/ultima2/views/interactions/hyperwarp_target.h
@@ -0,0 +1,55 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef ULTIMA2_VIEWS_INTERACTIONS_HYPERWARP_TARGET_H
+#define ULTIMA2_VIEWS_INTERACTIONS_HYPERWARP_TARGET_H
+
+#include "ultima/ultima2/views/interactions/interaction.h"
+
+namespace Ultima {
+namespace Ultima2 {
+namespace Views {
+namespace Interactions {
+
+/**
+ * Asks for the three digit XENO, YAKO and ZABO coordinates to hyperwarp to
+ * while the stars keep moving behind it
+ */
+class HyperwarpTarget : public Interaction {
+private:
+	int _digits[3] = {};
+	int _count = 0;
+
+public:
+	HyperwarpTarget();
+	~HyperwarpTarget() override {}
+
+	bool msgFocus(const FocusMessage &msg) override;
+	bool msgKeypress(const KeypressMessage &msg) override;
+	bool tick() override;
+};
+
+} // namespace Interactions
+} // namespace Views
+} // namespace Ultima2
+} // namespace Ultima
+
+#endif
diff --git a/engines/ultima/ultima2/views/interactions/rocket_landing.cpp b/engines/ultima/ultima2/views/interactions/rocket_landing.cpp
new file mode 100644
index 00000000000..ff32529d5a9
--- /dev/null
+++ b/engines/ultima/ultima2/views/interactions/rocket_landing.cpp
@@ -0,0 +1,89 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "ultima/ultima2/views/interactions/rocket_landing.h"
+#include "ultima/ultima2/ultima2.h"
+#include "ultima/ultima2/metaengine.h"
+
+namespace Ultima {
+namespace Ultima2 {
+namespace Views {
+namespace Interactions {
+
+constexpr uint32 STEP_DELAY = 100;
+
+RocketLanding::RocketLanding() : Interaction("RocketLanding") {
+}
+
+bool RocketLanding::msgFocus(const FocusMessage &msg) {
+	MetaEngine::setKeybindingMode(KBMODE_MINIMAL);
+	_lastStep = g_system->getMillis();
+
+	writeString("(PRESS ANY KEY)");
+	return Interaction::msgFocus(msg);
+}
+
+bool RocketLanding::tick() {
+	uint32 now = g_system->getMillis();
+	if (now - _lastStep >= STEP_DELAY) {
+		_lastStep = now;
+
+		// Sweeps steadily south, drifting a little east as it goes
+		Data::Savegame &sg = _G(savegame);
+		sg._mapY = (sg._mapY + 2) % Data::MAP_HEIGHT;
+		if ((sg._mapY & 7) == 0)
+			sg._mapX = (sg._mapX + 1) % Data::MAP_WIDTH;
+
+		UIElement *map = g_engine->findView("OverworldMap");
+		map->redraw();
+		map->draw();
+	}
+
+	return Interaction::tick();
+}
+
+bool RocketLanding::msgKeypress(const KeypressMessage &msg) {
+	Data::Savegame &sg = _G(savegame);
+	close();
+	writeString("\n");
+
+	if (_G(map).tileAt(sg._mapX, sg._mapY) != Data::TILE_GRASS) {
+		_G(logic)->playerDied();
+		return true;
+	}
+
+	// Anywhere but Earth is where the rocket will next take off from
+	if (sg._orbitTarget == 0) {
+		sg._inSpace = false;
+	} else {
+		sg._launchMapX = sg._mapX;
+		sg._launchMapY = sg._mapY;
+		sg._inSpace = true;
+	}
+
+	_G(logic)->resumeTurn();
+	return true;
+}
+
+} // namespace Interactions
+} // namespace Views
+} // namespace Ultima2
+} // namespace Ultima
diff --git a/engines/ultima/ultima2/views/interactions/rocket_landing.h b/engines/ultima/ultima2/views/interactions/rocket_landing.h
new file mode 100644
index 00000000000..e395c76e93c
--- /dev/null
+++ b/engines/ultima/ultima2/views/interactions/rocket_landing.h
@@ -0,0 +1,54 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef ULTIMA2_VIEWS_INTERACTIONS_ROCKET_LANDING_H
+#define ULTIMA2_VIEWS_INTERACTIONS_ROCKET_LANDING_H
+
+#include "ultima/ultima2/views/interactions/interaction.h"
+
+namespace Ultima {
+namespace Ultima2 {
+namespace Views {
+namespace Interactions {
+
+/**
+ * A rocket coming down over a world's map, sweeping across it until a key
+ * is pressed to touch down. The landing has to be on grass
+ */
+class RocketLanding : public Interaction {
+private:
+	uint32 _lastStep = 0;
+
+public:
+	RocketLanding();
+	~RocketLanding() override {}
+
+	bool msgFocus(const FocusMessage &msg) override;
+	bool msgKeypress(const KeypressMessage &msg) override;
+	bool tick() override;
+};
+
+} // namespace Interactions
+} // namespace Views
+} // namespace Ultima2
+} // namespace Ultima
+
+#endif
diff --git a/engines/ultima/ultima2/views/space_map.cpp b/engines/ultima/ultima2/views/space_map.cpp
new file mode 100644
index 00000000000..24535126f40
--- /dev/null
+++ b/engines/ultima/ultima2/views/space_map.cpp
@@ -0,0 +1,272 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "ultima/ultima2/views/space_map.h"
+#include "ultima/ultima2/logic/space_logic.h"
+#include "ultima/ultima2/ultima2.h"
+#include "ultima/ultima2/metaengine.h"
+
+namespace Ultima {
+namespace Ultima2 {
+namespace Views {
+
+// The stars fill a 256x128 area, offset from the top left corner
+constexpr int VIEW_OFFSET = 16;
+constexpr int COLOR_STAR = 3;
+
+// Animation steps per game frame while hyperwarping. The original's speed
+// depends on the CPU, so this is just tuned to feel right
+constexpr int WARP_STEPS_PER_TICK = 2;
+
+SpaceMap::SpaceMap() : View("SpaceMap") {
+	setBounds(TextRect(0, 0, 39, 24));
+}
+
+void SpaceMap::seedStars() {
+	_seedA = 0x3B;
+	_seedB = 0x67;
+}
+
+byte SpaceMap::nextStarCoord() {
+	int sum = _seedA + 9;
+	int carry = sum >> 8;
+	byte next = (byte)(sum + _seedB + carry);
+
+	_seedB = _seedA;
+	_seedA = next;
+	return next;
+}
+
+bool SpaceMap::msgFocus(const FocusMessage &msg) {
+	MetaEngine::setKeybindingMode(KBMODE_GAMEPLAY);
+
+	seedStars();
+	for (int i = 0; i < STAR_COUNT; ++i) {
+		_starX[i] = nextStarCoord();
+		_starY[i] = nextStarCoord() & 0x7F;
+	}
+
+	_shipX = 0x80;
+	_shipY = 0x40;
+	_speed = 0x80;
+	startWarp();
+	return View::msgFocus(msg);
+}
+
+bool SpaceMap::msgUnfocus(const UnfocusMessage &msg) {
+	MetaEngine::setKeybindingMode(KBMODE_MINIMAL);
+	return View::msgUnfocus(msg);
+}
+
+bool SpaceMap::msgAction(const ActionMessage &msg) {
+	if (!busy())
+		g_engine->_logic->action(msg._action);
+	return true;
+}
+
+bool SpaceMap::msgKeypress(const KeypressMessage &msg) {
+	if (!busy())
+		g_engine->_logic->keypress(msg);
+	return true;
+}
+
+void SpaceMap::plot(Shared::Gfx::GfxSurface &s, int x, int y, int color) {
+	s.setPixel(x + VIEW_OFFSET, y + VIEW_OFFSET, color);
+}
+
+void SpaceMap::drawMarker(Shared::Gfx::GfxSurface &s, int color) {
+	for (int i = -3; i <= 3; ++i) {
+		plot(s, _shipX, (byte)(_shipY + i), color);
+		if (i != 0)
+			plot(s, (byte)(_shipX + i), _shipY, color);
+	}
+}
+
+void SpaceMap::setShip(byte x, byte y) {
+	auto s = getSurface();
+	drawMarker(s, 0);
+
+	_shipX = x;
+	_shipY = y;
+	drawMarker(s, COLOR_STAR);
+}
+
+void SpaceMap::drawHud(Shared::Gfx::GfxSurface &s) {
+	auto *logic = dynamic_cast<Logic::SpaceLogic *>(_G(logic).get());
+	if (!logic)
+		return;
+
+	s.fillRect(TextRect(30, 20, 39, 23), 0);
+	s.setColor(COLOR_STAR);
+	s.writeString(Common::Point(30, 20), "  FUEL=%.2d", _G(savegame)._items[Data::ITEM_TRI_LITHIUM] % 100);
+	s.writeString(Common::Point(30, 21), "  XENO=%.2d", logic->coords()[0]);
+	s.writeString(Common::Point(30, 22), "  YAKO=%.2d", logic->coords()[1]);
+	s.writeString(Common::Point(30, 23), "  ZABO=%.2d", logic->coords()[2]);
+}
+
+void SpaceMap::draw() {
+	auto s = getSurface();
+	s.fillRect(Common::Rect(0, 0, 320, 160), 0);
+
+	for (int i = 0; i < STAR_COUNT; ++i)
+		plot(s, _starX[i], _starY[i], COLOR_STAR);
+	drawMarker(s, COLOR_STAR);
+	drawHud(s);
+}
+
+void SpaceMap::animate() {
+	auto s = getSurface();
+	drawMarker(s, COLOR_STAR);
+
+	for (int i = 0; i < STAR_COUNT; ++i) {
+		byte sx = _starX[i], sy = _starY[i];
+		byte nx = 0, ny = 0;
+		bool respawn = false;
+
+		// Each star moves away from the steering position, faster the
+		// further out it is, and is replaced by a new one once off the edge
+		byte dx = sx - _shipX;
+		if (sx >= _shipX) {
+			int t = sx + (dx >> 4) + 1;
+			if (t > 255)
+				respawn = true;
+			else
+				nx = t;
+		} else {
+			int step = ((byte)~dx >> 4) + 1;
+			if (sx < step)
+				respawn = true;
+			else
+				nx = sx - step;
+		}
+
+		if (!respawn) {
+			byte dy = sy - _shipY;
+			if (sy >= _shipY) {
+				byte t = sy + (dy >> 4) + 1;
+				if (t & 0x80)
+					respawn = true;
+				else
+					ny = t;
+			} else {
+				int step = ((byte)~dy >> 4) + 1;
+				byte t = sy - step;
+				if (t & 0x80)
+					respawn = true;
+				else
+					ny = t;
+			}
+		}
+
+		if (respawn) {
+			nx = nextStarCoord();
+			ny = nextStarCoord() & 0x7F;
+		}
+
+		// At speed zero the old positions are left behind, drawing streaks
+		if (_speed != 0)
+			plot(s, sx, sy, 0);
+
+		_starX[i] = nx;
+		_starY[i] = ny;
+		plot(s, nx, ny, COLOR_STAR);
+	}
+
+	// Flag the entire surface area needing updates
+	s.markAllDirty();
+}
+
+void SpaceMap::startWarp() {
+	g_engine->baseView()->findView("Commands")->send(GameMessage("TEXT", "HYPERWARP ENGAGED!\n"));
+
+	_speed = 0;
+	_counter = 0x80;
+	seedStars();
+	_phase = PHASE_WARP_TRAILS;
+}
+
+void SpaceMap::startSpinDown() {
+	seedStars();
+	_phase = PHASE_SPIN_DOWN;
+}
+
+bool SpaceMap::tick() {
+	auto *commands = g_engine->baseView()->findView("Commands");
+	if (commands)
+		commands->tick();
+
+	int steps = (_phase == PHASE_IDLE) ? 1 : WARP_STEPS_PER_TICK;
+	for (int i = 0; i < steps; ++i) {
+		animate();
+
+		switch (_phase) {
+		case PHASE_WARP_TRAILS:
+			if (--_counter == 0) {
+				auto s = getSurface();
+				_counter = 0x80;
+				_speed = 1;
+				drawHud(s);
+				seedStars();
+				_phase = PHASE_WARP_ACCELERATE;
+			}
+			break;
+
+		case PHASE_WARP_ACCELERATE:
+			if (--_counter == 0) {
+				++_speed;
+				_phase = PHASE_WARP_RUSH;
+			}
+			break;
+
+		case PHASE_WARP_RUSH:
+			_speed += 2;
+			if (_speed & 0x80) {
+				_phase = PHASE_IDLE;
+				if (auto *logic = dynamic_cast<Logic::SpaceLogic *>(_G(logic).get()))
+					logic->warpFinished();
+				return true;
+			}
+			break;
+
+		case PHASE_SPIN_DOWN:
+			if (--_speed == 2) {
+				_counter = 0x40;
+				seedStars();
+				_phase = PHASE_SPIN_HOLD;
+			}
+			break;
+
+		case PHASE_SPIN_HOLD:
+			if (--_counter == 0)
+				startWarp();
+			break;
+
+		default:
+			break;
+		}
+	}
+
+	return true;
+}
+
+} // namespace Views
+} // namespace Ultima2
+} // namespace Ultima
diff --git a/engines/ultima/ultima2/views/space_map.h b/engines/ultima/ultima2/views/space_map.h
new file mode 100644
index 00000000000..8c7fc9b39fd
--- /dev/null
+++ b/engines/ultima/ultima2/views/space_map.h
@@ -0,0 +1,109 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef ULTIMA2_VIEWS_SPACE_MAP_H
+#define ULTIMA2_VIEWS_SPACE_MAP_H
+
+#include "ultima/shared/gfx/view.h"
+
+namespace Ultima {
+namespace Ultima2 {
+namespace Views {
+
+using namespace Shared::Messages;
+
+/**
+ * The starfield seen from a rocket in flight, with the steering marker and
+ * the fuel and hyperwarp coordinates readout. Also runs the hyperwarp
+ * animation, which passes through several phases of stars streaking and
+ * then speeding past
+ */
+class SpaceMap : public Shared::Gfx::View {
+private:
+	enum Phase {
+		PHASE_IDLE, PHASE_WARP_TRAILS, PHASE_WARP_ACCELERATE, PHASE_WARP_RUSH,
+		PHASE_SPIN_DOWN, PHASE_SPIN_HOLD
+	};
+
+	static const int STAR_COUNT = 64;
+
+	byte _starX[STAR_COUNT] = {};
+	byte _starY[STAR_COUNT] = {};
+	byte _seedA = 0, _seedB = 0;
+	byte _shipX = 0x80, _shipY = 0x40;
+	byte _speed = 0x80;
+	Phase _phase = PHASE_IDLE;
+	int _counter = 0;
+
+	void seedStars();
+	void plot(Shared::Gfx::GfxSurface &s, int x, int y, int color);
+	void drawMarker(Shared::Gfx::GfxSurface &s, int color);
+	void drawHud(Shared::Gfx::GfxSurface &s);
+
+	/**
+	 * Moves every star one step away from the ship's steering position
+	 */
+	void animate();
+
+	/**
+	 * Starts the animation that runs the ship's hyperwarp drive
+	 */
+	void startWarp();
+
+public:
+	SpaceMap();
+	~SpaceMap() override {}
+
+	/**
+	 * Returns true while a hyperwarp is under way
+	 */
+	bool busy() const {
+		return _phase != PHASE_IDLE;
+	}
+
+	/**
+	 * Moves the steering marker
+	 */
+	void setShip(byte x, byte y);
+
+	/**
+	 * Winds the ship down to a stop ready for a hyperwarp, then warps
+	 */
+	void startSpinDown();
+
+	/**
+	 * Returns the next value from the starfield's pseudo-random sequence
+	 */
+	byte nextStarCoord();
+
+	bool msgFocus(const FocusMessage &msg) override;
+	bool msgUnfocus(const UnfocusMessage &msg) override;
+	bool msgAction(const ActionMessage &msg) override;
+	bool msgKeypress(const KeypressMessage &msg) override;
+	void draw() override;
+	bool tick() override;
+};
+
+} // namespace Views
+} // namespace Ultima2
+} // namespace Ultima
+
+#endif
diff --git a/engines/ultima/ultima2/views/views.h b/engines/ultima/ultima2/views/views.h
index 07c13876ac1..563d3615b0d 100644
--- a/engines/ultima/ultima2/views/views.h
+++ b/engines/ultima/ultima2/views/views.h
@@ -28,6 +28,7 @@
 #include "ultima/ultima2/views/game.h"
 #include "ultima/ultima2/views/location_map.h"
 #include "ultima/ultima2/views/overworld_map.h"
+#include "ultima/ultima2/views/space_map.h"
 #include "ultima/ultima2/views/startup.h"
 #include "ultima/ultima2/views/title.h"
 #include "ultima/ultima2/views/world_map_overview.h"
@@ -36,11 +37,13 @@
 #include "ultima/ultima2/views/interactions/dead.h"
 #include "ultima/ultima2/views/interactions/direction.h"
 #include "ultima/ultima2/views/interactions/food_shop.h"
+#include "ultima/ultima2/views/interactions/hyperwarp_target.h"
 #include "ultima/ultima2/views/interactions/offer_gold.h"
 #include "ultima/ultima2/views/interactions/plane_flight.h"
 #include "ultima/ultima2/views/interactions/pub.h"
 #include "ultima/ultima2/views/interactions/ready_spell.h"
 #include "ultima/ultima2/views/interactions/ready_weapon.h"
+#include "ultima/ultima2/views/interactions/rocket_landing.h"
 #include "ultima/ultima2/views/interactions/shop.h"
 #include "ultima/ultima2/views/interactions/transport.h"
 #include "ultima/ultima2/views/interactions/wear_armor.h"
@@ -55,11 +58,13 @@ struct Views : public Shared::Views {
 	Interactions::Dead _dead;
 	Interactions::Direction _direction;
 	Interactions::FoodShop _foodShop;
+	Interactions::HyperwarpTarget _hyperwarpTarget;
 	Interactions::OfferGold _offerGold;
 	Interactions::PlaneFlight _planeFlight;
 	Interactions::Pub _pub;
 	Interactions::ReadySpell _readySpell;
 	Interactions::ReadyWeapon _readyWeapon;
+	Interactions::RocketLanding _rocketLanding;
 	Interactions::Transport _transport;
 	Interactions::WearArmor _wearArmor;
 	Interactions::Yell _yell;
@@ -73,6 +78,7 @@ struct Views : public Shared::Views {
 	Game _game;
 	LocationMap _locationMap;
 	OverworldMap _overworldMap;
+	SpaceMap _spaceMap;
 	Startup _startup;
 	Title _title;
 	WorldMapOverview _worldMapOverview;


Commit: ef477b9ac364bce7520732f170816db93fbd7739
    https://github.com/scummvm/scummvm/commit/ef477b9ac364bce7520732f170816db93fbd7739
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:40:57+11:00

Commit Message:
ULTIMA: ULTIMA2: Added space console command

Changed paths:
    engines/ultima/ultima2/console.cpp
    engines/ultima/ultima2/console.h


diff --git a/engines/ultima/ultima2/console.cpp b/engines/ultima/ultima2/console.cpp
index d6d0bdb00d9..93862693b53 100644
--- a/engines/ultima/ultima2/console.cpp
+++ b/engines/ultima/ultima2/console.cpp
@@ -24,6 +24,7 @@
 #include "ultima/ultima2/ultima2.h"
 #include "ultima/ultima2/data/tiles.h"
 #include "ultima/ultima2/logic/overworld_logic.h"
+#include "ultima/ultima2/logic/space_logic.h"
 
 namespace Ultima {
 namespace Ultima2 {
@@ -39,6 +40,7 @@ Console::Console() : GUI::Debugger() {
 	registerCmd("food", WRAP_METHOD(Console, cmdFood));
 	registerCmd("gold", WRAP_METHOD(Console, cmdGold));
 	registerCmd("inventory", WRAP_METHOD(Console, cmdInventory));
+	registerCmd("space", WRAP_METHOD(Console, cmdSpace));
 }
 
 Console::~Console() {
@@ -325,5 +327,23 @@ bool Console::cmdInventory(int argc, const char **argv) {
 	return true;
 }
 
+bool Console::cmdSpace(int argc, const char **argv) {
+	// The first launch from Earth remembers where to come back to
+	Data::Savegame &sg = _G(savegame);
+	if (sg._orbitTarget == 0 && sg._mapType == 0) {
+		sg._launchMapX = sg._mapX;
+		sg._launchMapY = sg._mapY;
+		sg._inSpace = true;
+	}
+
+	// Ensure we have necessary equipment
+	sg._readiedArmor = Data::ARMOR_REFLECT;
+	sg._items[Data::ITEM_TRI_LITHIUM] = 9;
+
+	Logic::SpaceLogic::takeOff();
+
+	return false;
+}
+
 } // namespace Ultima2
 } // namespace Ultima
diff --git a/engines/ultima/ultima2/console.h b/engines/ultima/ultima2/console.h
index f2e0e90e0d7..e01a4e19d15 100644
--- a/engines/ultima/ultima2/console.h
+++ b/engines/ultima/ultima2/console.h
@@ -41,6 +41,8 @@ private:
 	bool cmdFood(int argc, const char **argv);
 	bool cmdGold(int argc, const char **argv);
 	bool cmdInventory(int argc, const char **argv);
+	bool cmdSpace(int argc, const char **argv);
+
 public:
 	Console();
 	~Console() override;


Commit: 292b01f2b6dfb1225317638da64c68066d796c07
    https://github.com/scummvm/scummvm/commit/292b01f2b6dfb1225317638da64c68066d796c07
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:40:57+11:00

Commit Message:
ULTIMA: ULTIMA1: Added space console command

Changed paths:
    engines/ultima/ultima1/console.cpp
    engines/ultima/ultima1/console.h


diff --git a/engines/ultima/ultima1/console.cpp b/engines/ultima/ultima1/console.cpp
index c9b42c4b92b..5596899f8f4 100644
--- a/engines/ultima/ultima1/console.cpp
+++ b/engines/ultima/ultima1/console.cpp
@@ -34,6 +34,7 @@ Console::Console() : GUI::Debugger() {
 	registerCmd("food", WRAP_METHOD(Console, cmdFood));
 	registerCmd("coins", WRAP_METHOD(Console, cmdCoins));
 	registerCmd("fuel", WRAP_METHOD(Console, cmdFuel));
+	registerCmd("space", WRAP_METHOD(Console, cmdSpace));
 }
 
 Console::~Console() {
@@ -122,5 +123,20 @@ bool Console::cmdFuel(int argc, const char **argv) {
 	return false;
 }
 
+bool Console::cmdSpace(int argc, const char **argv) {
+	_G(savegame)._shipFuel = 9999;
+	_G(savegame)._shipShield = 9999;
+
+	// Make sure docking at the station doesn't kill them outright
+	// for want of a vacuum suit
+	_G(savegame)._armor[Data::ARMOR_VACUUM_SUIT] = 1;
+	_G(savegame)._equippedArmor = Data::ARMOR_VACUUM_SUIT;
+
+	_G(map).load(Data::MAP_SPACE);
+	_G(logic)->entering();
+
+	return false;
+}
+
 } // namespace Ultima1
 } // namespace Ultima
diff --git a/engines/ultima/ultima1/console.h b/engines/ultima/ultima1/console.h
index af9354eb33c..0829afc257b 100644
--- a/engines/ultima/ultima1/console.h
+++ b/engines/ultima/ultima1/console.h
@@ -36,6 +36,7 @@ private:
 	bool cmdFood(int argc, const char **argv);
 	bool cmdCoins(int argc, const char **argv);
 	bool cmdFuel(int argc, const char **argv);
+	bool cmdSpace(int argc, const char **argv);
 
 public:
 	Console();


Commit: 1d7ed5e2db16444b1ec07523b863b5dab998de27
    https://github.com/scummvm/scummvm/commit/1d7ed5e2db16444b1ec07523b863b5dab998de27
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:40:57+11:00

Commit Message:
ULTIMA: ULTIMA2: Moved space stats into SpaceStats view

Changed paths:
  A engines/ultima/ultima2/views/space_stats.cpp
  A engines/ultima/ultima2/views/space_stats.h
    engines/ultima/module.mk
    engines/ultima/ultima2/views/commands.cpp
    engines/ultima/ultima2/views/game.cpp
    engines/ultima/ultima2/views/space_map.cpp
    engines/ultima/ultima2/views/space_map.h
    engines/ultima/ultima2/views/stats.cpp
    engines/ultima/ultima2/views/stats.h


diff --git a/engines/ultima/module.mk b/engines/ultima/module.mk
index 0de923709b2..f308b9413c8 100644
--- a/engines/ultima/module.mk
+++ b/engines/ultima/module.mk
@@ -132,6 +132,7 @@ MODULE_OBJS += \
 	ultima2/views/map.o \
 	ultima2/views/overworld_map.o \
 	ultima2/views/space_map.o \
+	ultima2/views/space_stats.o \
 	ultima2/views/startup.o \
 	ultima2/views/stats.o \
 	ultima2/views/title.o \
diff --git a/engines/ultima/ultima2/views/commands.cpp b/engines/ultima/ultima2/views/commands.cpp
index ee0739d9858..57b67054f45 100644
--- a/engines/ultima/ultima2/views/commands.cpp
+++ b/engines/ultima/ultima2/views/commands.cpp
@@ -33,6 +33,7 @@ constexpr int PROMPT_ROW = 3; // last of the 4 rows within Commands' own bounds
 constexpr int PROMPT_ABSOLUTE_ROW = 23;
 
 Commands::Commands(UIElement *parent) : Shared::UIElement("Commands", parent), _textCursor("CommandsCursor", this, COLOR_TEXT) {
+	setBounds(TextRect(0, 20, 29, 23));
 }
 
 void Commands::draw() {
diff --git a/engines/ultima/ultima2/views/game.cpp b/engines/ultima/ultima2/views/game.cpp
index 7e4553935d8..617bec0749f 100644
--- a/engines/ultima/ultima2/views/game.cpp
+++ b/engines/ultima/ultima2/views/game.cpp
@@ -28,8 +28,6 @@ namespace Views {
 
 Game::Game() : Shared::Gfx::View("Game"), _commands(this), _stats(this) {
 	setBounds(TextRect(0, 0, 39, 24));
-	_commands.setBounds(TextRect(0, 20, 29, 23));
-	_stats.setBounds(TextRect(30, 20, 39, 23));
 }
 
 } // namespace Views
diff --git a/engines/ultima/ultima2/views/space_map.cpp b/engines/ultima/ultima2/views/space_map.cpp
index 24535126f40..f9398f1aebc 100644
--- a/engines/ultima/ultima2/views/space_map.cpp
+++ b/engines/ultima/ultima2/views/space_map.cpp
@@ -109,19 +109,6 @@ void SpaceMap::setShip(byte x, byte y) {
 	drawMarker(s, COLOR_STAR);
 }
 
-void SpaceMap::drawHud(Shared::Gfx::GfxSurface &s) {
-	auto *logic = dynamic_cast<Logic::SpaceLogic *>(_G(logic).get());
-	if (!logic)
-		return;
-
-	s.fillRect(TextRect(30, 20, 39, 23), 0);
-	s.setColor(COLOR_STAR);
-	s.writeString(Common::Point(30, 20), "  FUEL=%.2d", _G(savegame)._items[Data::ITEM_TRI_LITHIUM] % 100);
-	s.writeString(Common::Point(30, 21), "  XENO=%.2d", logic->coords()[0]);
-	s.writeString(Common::Point(30, 22), "  YAKO=%.2d", logic->coords()[1]);
-	s.writeString(Common::Point(30, 23), "  ZABO=%.2d", logic->coords()[2]);
-}
-
 void SpaceMap::draw() {
 	auto s = getSurface();
 	s.fillRect(Common::Rect(0, 0, 320, 160), 0);
@@ -129,7 +116,9 @@ void SpaceMap::draw() {
 	for (int i = 0; i < STAR_COUNT; ++i)
 		plot(s, _starX[i], _starY[i], COLOR_STAR);
 	drawMarker(s, COLOR_STAR);
-	drawHud(s);
+
+	// Draw the HUD stats
+	View::draw();
 }
 
 void SpaceMap::animate() {
@@ -223,7 +212,7 @@ bool SpaceMap::tick() {
 				auto s = getSurface();
 				_counter = 0x80;
 				_speed = 1;
-				drawHud(s);
+				_stats.draw();
 				seedStars();
 				_phase = PHASE_WARP_ACCELERATE;
 			}
diff --git a/engines/ultima/ultima2/views/space_map.h b/engines/ultima/ultima2/views/space_map.h
index 8c7fc9b39fd..17df38a4697 100644
--- a/engines/ultima/ultima2/views/space_map.h
+++ b/engines/ultima/ultima2/views/space_map.h
@@ -23,6 +23,7 @@
 #define ULTIMA2_VIEWS_SPACE_MAP_H
 
 #include "ultima/shared/gfx/view.h"
+#include "ultima/ultima2/views/space_stats.h"
 
 namespace Ultima {
 namespace Ultima2 {
@@ -45,6 +46,7 @@ private:
 
 	static const int STAR_COUNT = 64;
 
+	SpaceStats _stats = SpaceStats(this);
 	byte _starX[STAR_COUNT] = {};
 	byte _starY[STAR_COUNT] = {};
 	byte _seedA = 0, _seedB = 0;
@@ -56,7 +58,6 @@ private:
 	void seedStars();
 	void plot(Shared::Gfx::GfxSurface &s, int x, int y, int color);
 	void drawMarker(Shared::Gfx::GfxSurface &s, int color);
-	void drawHud(Shared::Gfx::GfxSurface &s);
 
 	/**
 	 * Moves every star one step away from the ship's steering position
diff --git a/engines/ultima/ultima2/views/space_stats.cpp b/engines/ultima/ultima2/views/space_stats.cpp
new file mode 100644
index 00000000000..458c82dd025
--- /dev/null
+++ b/engines/ultima/ultima2/views/space_stats.cpp
@@ -0,0 +1,54 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "ultima/ultima2/views/space_stats.h"
+#include "ultima/ultima2/logic/space_logic.h"
+#include "ultima/ultima2/ultima2.h"
+#include "ultima/shared/gfx/rect.h"
+
+namespace Ultima {
+namespace Ultima2 {
+namespace Views {
+
+constexpr int COLOR_TEXT = 3; // white, within the game's 4-color CGA palette
+
+SpaceStats::SpaceStats(UIElement *parent) : Shared::UIElement("SpaceStats", parent) {
+	setBounds(TextRect(30, 20, 39, 23));
+}
+
+void SpaceStats::draw() {
+	auto s = getSurface();
+	s.clear();
+
+	auto *logic = dynamic_cast<Logic::SpaceLogic *>(_G(logic).get());
+	if (!logic)
+		return;
+
+	s.setColor(COLOR_TEXT);
+	s.writeString(Common::Point(0, 0), "  FUEL=%.2d", _G(savegame)._items[Data::ITEM_TRI_LITHIUM] % 100);
+	s.writeString(Common::Point(0, 1), "  XENO=%.2d", logic->coords()[0]);
+	s.writeString(Common::Point(0, 2), "  YAKO=%.2d", logic->coords()[1]);
+	s.writeString(Common::Point(0, 3), "  ZABO=%.2d", logic->coords()[2]);
+}
+
+} // namespace Views
+} // namespace Ultima2
+} // namespace Ultima
diff --git a/engines/ultima/ultima2/views/space_stats.h b/engines/ultima/ultima2/views/space_stats.h
new file mode 100644
index 00000000000..7ef4024e231
--- /dev/null
+++ b/engines/ultima/ultima2/views/space_stats.h
@@ -0,0 +1,47 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef ULTIMA2_VIEWS_SPACE_STATS_H
+#define ULTIMA2_VIEWS_SPACE_STATS_H
+
+#include "ultima/shared/engine/events.h"
+
+namespace Ultima {
+namespace Ultima2 {
+namespace Views {
+
+/**
+ * The stats display shown when in outer space
+ */
+class SpaceStats : public Shared::UIElement {
+public:
+	SpaceStats(UIElement *parent);
+	~SpaceStats() override {
+	}
+
+	void draw() override;
+};
+
+} // namespace Views
+} // namespace Ultima2
+} // namespace Ultima
+
+#endif
diff --git a/engines/ultima/ultima2/views/stats.cpp b/engines/ultima/ultima2/views/stats.cpp
index 11cedf73a4d..9bb5e47e204 100644
--- a/engines/ultima/ultima2/views/stats.cpp
+++ b/engines/ultima/ultima2/views/stats.cpp
@@ -21,6 +21,7 @@
 
 #include "ultima/ultima2/views/stats.h"
 #include "ultima/ultima2/ultima2.h"
+#include "ultima/shared/gfx/rect.h"
 
 namespace Ultima {
 namespace Ultima2 {
@@ -28,6 +29,10 @@ namespace Views {
 
 constexpr int COLOR_TEXT = 3; // white, within the game's 4-color CGA palette
 
+Stats::Stats(UIElement *parent) : Shared::UIElement("Stats", parent) {
+	setBounds(TextRect(30, 20, 39, 23));
+}
+
 void Stats::draw() {
 	Data::Savegame &sg = _G(savegame);
 	auto s = getSurface();
diff --git a/engines/ultima/ultima2/views/stats.h b/engines/ultima/ultima2/views/stats.h
index 72834ad6428..f9fbb8aed43 100644
--- a/engines/ultima/ultima2/views/stats.h
+++ b/engines/ultima/ultima2/views/stats.h
@@ -34,7 +34,7 @@ namespace Views {
  */
 class Stats : public Shared::UIElement {
 public:
-	Stats(UIElement *parent) : Shared::UIElement("Stats", parent) {}
+	Stats(UIElement *parent);
 	~Stats() override {}
 
 	void draw() override;


Commit: dc6be9a6ef1aac45b9d60bbd1c0c5cc32b3dcd35
    https://github.com/scummvm/scummvm/commit/dc6be9a6ef1aac45b9d60bbd1c0c5cc32b3dcd35
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:40:57+11:00

Commit Message:
ULTIMA: ULTIMA2: Allow saving mid-flight

Changed paths:
    engines/ultima/ultima2/data/savegame.cpp
    engines/ultima/ultima2/data/savegame.h
    engines/ultima/ultima2/logic/space_logic.cpp
    engines/ultima/ultima2/logic/space_logic.h
    engines/ultima/ultima2/ultima2.cpp
    engines/ultima/ultima2/views/space_stats.cpp


diff --git a/engines/ultima/ultima2/data/savegame.cpp b/engines/ultima/ultima2/data/savegame.cpp
index 3cc4e9b5c91..b301af3fa7c 100644
--- a/engines/ultima/ultima2/data/savegame.cpp
+++ b/engines/ultima/ultima2/data/savegame.cpp
@@ -90,6 +90,8 @@ void Savegame::synchronize(Common::Serializer &s) {
 	s.syncAsByte(_launchMapY);
 
 	s.syncAsSint16LE(_orbitTarget);
+	s.syncBytes(_hyperwarpCoords, 3);
+	s.syncAsByte(_inFlight);
 
 	s.syncAsByte(_ringQuestFlag);
 	s.syncAsByte(_enilnoOwned);
diff --git a/engines/ultima/ultima2/data/savegame.h b/engines/ultima/ultima2/data/savegame.h
index c13790e2ad4..e341982cd44 100644
--- a/engines/ultima/ultima2/data/savegame.h
+++ b/engines/ultima/ultima2/data/savegame.h
@@ -95,6 +95,14 @@ struct Savegame {
 	// planets, 9 planet X and 10 deep space. Saving only works on Earth
 	int16 _orbitTarget = 0;
 
+	// The XENO/YAKO/ZABO coordinates being hyperwarped to, or last reached
+	byte _hyperwarpCoords[3] = {};
+
+	// True while SpaceMap is the active view (flying between worlds, not yet
+	// landed) - lets a save made mid-flight resume back into it. Distinct
+	// from the original's own _inSpace flag below
+	bool _inFlight = false;
+
 	bool _ringQuestFlag = false;
 	bool _enilnoOwned = false;
 	byte _patrolWaypoint = 0;
diff --git a/engines/ultima/ultima2/logic/space_logic.cpp b/engines/ultima/ultima2/logic/space_logic.cpp
index 623a9b9ae06..55df798741e 100644
--- a/engines/ultima/ultima2/logic/space_logic.cpp
+++ b/engines/ultima/ultima2/logic/space_logic.cpp
@@ -43,41 +43,63 @@ constexpr int SAFE_ARMOR = Data::ARMOR_REFLECT;
 
 } // namespace
 
+void SpaceLogic::showSpaceView() {
+	if (!g_engine->isPresent("Game")) {
+		// Set up the game view and force it to draw immediately
+		g_engine->replaceView("Game", true);
+		g_engine->focusedView()->draw();
+
+		// Now open the space view on top of it
+		g_engine->addView("SpaceMap");
+	} else {
+		g_engine->replaceView("SpaceMap");
+	}
+}
+
 void SpaceLogic::takeOff() {
 	Data::Savegame &sg = _G(savegame);
-	SpaceLogic *logic = new SpaceLogic();
 
 	int world = MIN<int>(sg._orbitTarget, PLANET_X);
 	for (int i = 0; i < 3; ++i)
-		logic->_coords[i] = Data::PLANET_COORDS[world][i];
+		sg._hyperwarpCoords[i] = Data::PLANET_COORDS[world][i];
 
 	--sg._items[Data::ITEM_TRI_LITHIUM];
-	logic->_launching = true;
+	sg._inFlight = true;
 
+	SpaceLogic *logic = new SpaceLogic();
+	logic->_launching = true;
 	_G(logic) = Common::SharedPtr<Logic>(logic);
-	g_engine->replaceView("SpaceMap");
+
+	showSpaceView();
+}
+
+void SpaceLogic::resume() {
+	_G(logic) = Common::SharedPtr<Logic>(new SpaceLogic());
+	showSpaceView();
 }
 
 void SpaceLogic::hyperwarpTo(int xeno, int yako, int zabo) {
-	_coords[0] = xeno;
-	_coords[1] = yako;
-	_coords[2] = zabo;
+	Data::Savegame &sg = _G(savegame);
+	sg._hyperwarpCoords[0] = xeno;
+	sg._hyperwarpCoords[1] = yako;
+	sg._hyperwarpCoords[2] = zabo;
 
 	static_cast<Views::SpaceMap *>(g_engine->findView("SpaceMap"))->startSpinDown();
 }
 
 bool SpaceLogic::announceOrbit() {
 	Data::Savegame &sg = _G(savegame);
+	const byte *coords = sg._hyperwarpCoords;
 
-	if (_coords[0] == 4 && _coords[1] == 4 && _coords[2] == 4) {
+	if (coords[0] == 4 && coords[1] == 4 && coords[2] == 4) {
 		writeString("\n\nYOU HIT THE SUN!\n");
 		playerDied();
 		return false;
 	}
 
 	for (int world = PLANET_X; world >= 0; --world) {
-		if (_coords[0] == Data::PLANET_COORDS[world][0] && _coords[1] == Data::PLANET_COORDS[world][1] &&
-				_coords[2] == Data::PLANET_COORDS[world][2]) {
+		if (coords[0] == Data::PLANET_COORDS[world][0] && coords[1] == Data::PLANET_COORDS[world][1] &&
+				coords[2] == Data::PLANET_COORDS[world][2]) {
 			sg._orbitTarget = world;
 			writeString("YOU ARE ORBITING %s.\n", world == PLANET_X ? "X" : Data::PLANET_NAMES[world]);
 			return true;
@@ -97,7 +119,7 @@ void SpaceLogic::warpFinished() {
 	if ((Data::toBcd(sg._items[Data::ITEM_TRI_LITHIUM] % 100) & 3) == 3) {
 		writeString("SHIP OFF COURSE!\n");
 		for (int i = 0; i < 3; ++i)
-			_coords[i] = view->nextStarCoord() & 7;
+			sg._hyperwarpCoords[i] = view->nextStarCoord() & 7;
 	}
 
 	if (!announceOrbit())
@@ -156,6 +178,7 @@ void SpaceLogic::land() {
 	// Keep hold of this logic until the map load replaces it
 	Common::SharedPtr<Logic> hold = _G(logic);
 
+	sg._inFlight = false;
 	sg._mapEra = era;
 	sg._mapType = 0;
 	sg._mapX = 0;
diff --git a/engines/ultima/ultima2/logic/space_logic.h b/engines/ultima/ultima2/logic/space_logic.h
index ad621bc38e4..7cf0ac83191 100644
--- a/engines/ultima/ultima2/logic/space_logic.h
+++ b/engines/ultima/ultima2/logic/space_logic.h
@@ -36,9 +36,6 @@ namespace Logic {
  */
 class SpaceLogic : public Logic {
 private:
-	// The coordinates being flown to, or that were last reached
-	byte _coords[3] = {};
-
 	// Set until the first hyperwarp after launch completes
 	bool _launching = false;
 
@@ -58,6 +55,12 @@ private:
 	 */
 	void land();
 
+	/**
+	 * Pushes or swaps in the SpaceMap view, bootstrapping the Game view
+	 * first if needed - mirrors Data::Map::showMapView
+	 */
+	static void showSpaceView();
+
 public:
 	~SpaceLogic() override {}
 
@@ -66,9 +69,10 @@ public:
 	 */
 	static void takeOff();
 
-	const byte *coords() const {
-		return _coords;
-	}
+	/**
+	 * Resumes flight after loading a save made mid-flight
+	 */
+	static void resume();
 
 	/**
 	 * Called with the coordinates the player chose to hyperwarp to
diff --git a/engines/ultima/ultima2/ultima2.cpp b/engines/ultima/ultima2/ultima2.cpp
index d06b9b66298..d397101e832 100644
--- a/engines/ultima/ultima2/ultima2.cpp
+++ b/engines/ultima/ultima2/ultima2.cpp
@@ -25,8 +25,10 @@
 #include "ultima/ultima2/ultima2.h"
 #include "ultima/ultima2/console.h"
 #include "ultima/ultima2/metaengine.h"
+#include "ultima/ultima2/logic/space_logic.h"
 #include "ultima/ultima2/views/views.h"
 #include "ultima/ultima2/views/map.h"
+#include "ultima/ultima2/views/space_map.h"
 #include "ultima/ultima2/views/interactions/dead.h"
 
 namespace Ultima {
@@ -85,8 +87,13 @@ byte Ultima2Engine::randByte() {
 }
 
 bool Ultima2Engine::canSaveGameStateCurrently(Common::U32String *msg) {
-	// Only allow saving when any of the different map views are active
-	return dynamic_cast<Views::Map *>(focusedView()) != nullptr;
+	// Only allow saving when any of the different map views are active, or
+	// flying in space and not in the middle of a hyperwarp animation
+	if (dynamic_cast<Views::Map *>(focusedView()) != nullptr)
+		return true;
+
+	auto *spaceMap = dynamic_cast<Views::SpaceMap *>(focusedView());
+	return spaceMap != nullptr && !spaceMap->busy();
 }
 
 bool Ultima2Engine::canLoadGameStateCurrently(Common::U32String *msg) {
@@ -98,10 +105,16 @@ bool Ultima2Engine::canLoadGameStateCurrently(Common::U32String *msg) {
 Common::Error Ultima2Engine::syncGame(Common::Serializer &s) {
 	_savegame.synchronize(s);
 
-	if (s.isLoading())
-		_G(map).load(_G(savegame)._mapEra, _G(savegame)._mapType);
+	if (s.isLoading()) {
+		if (_G(savegame)._inFlight)
+			Logic::SpaceLogic::resume();
+		else
+			_G(map).load(_G(savegame)._mapEra, _G(savegame)._mapType);
+	}
 
-	_G(map).synchronize(s, _G(savegame)._mapType >= 4);
+	// While flying, there's no current map to save/restore the state of
+	if (!_G(savegame)._inFlight)
+		_G(map).synchronize(s, _G(savegame)._mapType >= 4);
 
 	// The views were drawn from the freshly loaded map, before its saved state was applied
 	if (s.isLoading())
diff --git a/engines/ultima/ultima2/views/space_stats.cpp b/engines/ultima/ultima2/views/space_stats.cpp
index 458c82dd025..108ec8dc08d 100644
--- a/engines/ultima/ultima2/views/space_stats.cpp
+++ b/engines/ultima/ultima2/views/space_stats.cpp
@@ -20,7 +20,6 @@
  */
 
 #include "ultima/ultima2/views/space_stats.h"
-#include "ultima/ultima2/logic/space_logic.h"
 #include "ultima/ultima2/ultima2.h"
 #include "ultima/shared/gfx/rect.h"
 
@@ -38,15 +37,12 @@ void SpaceStats::draw() {
 	auto s = getSurface();
 	s.clear();
 
-	auto *logic = dynamic_cast<Logic::SpaceLogic *>(_G(logic).get());
-	if (!logic)
-		return;
-
+	Data::Savegame &sg = _G(savegame);
 	s.setColor(COLOR_TEXT);
-	s.writeString(Common::Point(0, 0), "  FUEL=%.2d", _G(savegame)._items[Data::ITEM_TRI_LITHIUM] % 100);
-	s.writeString(Common::Point(0, 1), "  XENO=%.2d", logic->coords()[0]);
-	s.writeString(Common::Point(0, 2), "  YAKO=%.2d", logic->coords()[1]);
-	s.writeString(Common::Point(0, 3), "  ZABO=%.2d", logic->coords()[2]);
+	s.writeString(Common::Point(0, 0), "  FUEL=%.2d", sg._items[Data::ITEM_TRI_LITHIUM] % 100);
+	s.writeString(Common::Point(0, 1), "  XENO=%.2d", sg._hyperwarpCoords[0]);
+	s.writeString(Common::Point(0, 2), "  YAKO=%.2d", sg._hyperwarpCoords[1]);
+	s.writeString(Common::Point(0, 3), "  ZABO=%.2d", sg._hyperwarpCoords[2]);
 }
 
 } // namespace Views


Commit: 681083974bc53c3318e05c2f5fc17a249d4711ef
    https://github.com/scummvm/scummvm/commit/681083974bc53c3318e05c2f5fc17a249d4711ef
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:40:57+11:00

Commit Message:
ULTIMA: ULTIMA2: Add the Minax death sequence and victory ending

Changed paths:
  A engines/ultima/ultima2/views/ending.cpp
  A engines/ultima/ultima2/views/ending.h
    engines/ultima/module.mk
    engines/ultima/ultima2/logic/overworld_logic.cpp
    engines/ultima/ultima2/logic/overworld_logic.h
    engines/ultima/ultima2/views/views.h


diff --git a/engines/ultima/module.mk b/engines/ultima/module.mk
index f308b9413c8..dbc930b1396 100644
--- a/engines/ultima/module.mk
+++ b/engines/ultima/module.mk
@@ -127,6 +127,7 @@ MODULE_OBJS += \
 	ultima2/views/commands.o \
 	ultima2/views/create_character.o \
 	ultima2/views/dungeon_map.o \
+	ultima2/views/ending.o \
 	ultima2/views/game.o \
 	ultima2/views/location_map.o \
 	ultima2/views/map.o \
diff --git a/engines/ultima/ultima2/logic/overworld_logic.cpp b/engines/ultima/ultima2/logic/overworld_logic.cpp
index af2da37072f..0a086e71a12 100644
--- a/engines/ultima/ultima2/logic/overworld_logic.cpp
+++ b/engines/ultima/ultima2/logic/overworld_logic.cpp
@@ -476,6 +476,8 @@ bool OverworldLogic::attack(Data::Direction dir) {
 		killMonster(slot);
 	} else {
 		hp -= dmg + 1;
+		if (monsters.tileType(slot) == Data::TILE_MINAX)
+			minaxFlees(slot);
 	}
 
 	resumeTurn();
@@ -527,11 +529,47 @@ bool OverworldLogic::fire(Data::Direction dir) {
 		killMonster(slot);
 	} else {
 		hp -= dmg + 1;
+		if (_G(map)._monsters.tileType(slot) == Data::TILE_MINAX)
+			minaxFlees(slot);
 	}
 
 	return true;
 }
 
+void OverworldLogic::minaxFlees(int slot) {
+	Data::MapMonsters &monsters = _G(map)._monsters;
+
+	// She reappears at the mirror image of her current position, and never
+	// budges again short of being killed
+	byte oldX = monsters._mapX[slot], oldY = monsters._mapY[slot];
+	monsters._mapX[slot] = oldY;
+	monsters._mapY[slot] = oldX;
+	monsters._offerFlag[slot] = 0x84;
+
+	writeString("\nSHE'S GONE!!!\n");
+}
+
+void OverworldLogic::minaxDeathSequence() {
+	writeString("\n\n     MINAX IS DEAD!!\nALL HER WORKS SHALL DIE!\n");
+
+	// The castle crumbles into rubble before the screen hands off to the
+	// endless victory pan
+	Shared::UIElement *curView = g_engine->focusedView();
+	for (int step = 0; step < 64; ++step) {
+		for (int i = 0; i < 64; ++i) {
+			int x = randByte() & 0x3F, y = randByte() & 0x3F;
+			_G(map)._tiles[y][x] = Data::TILE_EMPTY;
+		}
+
+		curView->draw();
+		g_engine->updateScreen();
+		g_engine->pauseMillis(30);
+	}
+
+	writeString("\nYOU FEEL A STRANGE FORCE!\n");
+	g_engine->addView("Ending");
+}
+
 void OverworldLogic::killMonster(int slot) {
 	Data::Savegame &sg = _G(savegame);
 	Data::MapMonsters &monsters = _G(map)._monsters;
@@ -539,7 +577,7 @@ void OverworldLogic::killMonster(int slot) {
 	monsters._type[slot] = 0;
 
 	if (monsterTile == Data::TILE_MINAX) {
-		writeString("MINAX IS DEAD!!\n");
+		minaxDeathSequence();
 		return;
 	}
 
diff --git a/engines/ultima/ultima2/logic/overworld_logic.h b/engines/ultima/ultima2/logic/overworld_logic.h
index ae1a5f27537..292c6a42af1 100644
--- a/engines/ultima/ultima2/logic/overworld_logic.h
+++ b/engines/ultima/ultima2/logic/overworld_logic.h
@@ -63,6 +63,17 @@ private:
 	 */
 	void enterMoongate(int x, int y);
 
+	/**
+	 * Minax survives a hit - she swaps to the mirror position of her
+	 * current spot and becomes permanently passive
+	 */
+	void minaxFlees(int slot);
+
+	/**
+	 * Minax is slain - the endgame victory sequence
+	 */
+	void minaxDeathSequence();
+
 protected:
 	enum StepResult { STEP_OK, STEP_BLOCKED, STEP_DIED, STEP_MOONGATE };
 
diff --git a/engines/ultima/ultima2/views/ending.cpp b/engines/ultima/ultima2/views/ending.cpp
new file mode 100644
index 00000000000..4733d0dea92
--- /dev/null
+++ b/engines/ultima/ultima2/views/ending.cpp
@@ -0,0 +1,116 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "common/file.h"
+#include "common/system.h"
+#include "ultima/ultima2/views/ending.h"
+#include "ultima/ultima2/data/map.h"
+#include "ultima/ultima2/ultima2.h"
+
+namespace Ultima {
+namespace Ultima2 {
+namespace Views {
+
+namespace {
+
+constexpr int TILE_WIDTH = 16;
+constexpr int TILE_HEIGHT = 16;
+constexpr int VIEWPORT_WIDTH = 20;
+constexpr int VIEWPORT_HEIGHT = 10;
+constexpr int PLAYER_VIEWPORT_X = 9;
+constexpr int PLAYER_VIEWPORT_Y = 5;
+
+// The original's pace here is CPU-dependent; picked to look right
+constexpr uint32 STEP_DELAY = 90;
+
+} // namespace
+
+Ending::Ending() : View("Ending") {
+	setBounds(TextRect(0, 0, 39, 24));
+}
+
+Ending::~Ending() {
+	for (int i = 0; i < Data::TILE_COUNT; ++i)
+		_tileGfx[i].free();
+}
+
+bool Ending::msgFocus(const FocusMessage &msg) {
+	Data::loadTiles(_tileGfx);
+
+	// A fixed background, reused from the same file that's the real
+	// planet map of this era/type combination - not loaded as a live map
+	Common::File f;
+	if (f.open(Data::mapFilename(3, 0).c_str())) {
+		for (int y = 0; y < Data::MAP_HEIGHT; ++y) {
+			for (int x = 0; x < Data::MAP_WIDTH; ++x)
+				_tiles[y][x] = (Data::TileId)(f.readByte() / 4);
+		}
+	}
+
+	_panX = _panY = 0;
+	_lastStep = g_system->getMillis();
+
+	g_engine->baseView()->findView("Commands")->send(Shared::Messages::GameMessage("TEXT",
+		"\n\nYOU HAVE SAVED THE UNIVERSE,\nAND COMPLETED ULTIMA ][! SEEK\n"
+		"NOW TO CONQUER WICKED EXODUS,\nFOUND IN ULTIMA ]I[-D ]II[-P!\n"));
+
+	return View::msgFocus(msg);
+}
+
+void Ending::draw() {
+	auto s = getSurface();
+	s.clear();
+
+	int mapLeft = _panX - PLAYER_VIEWPORT_X;
+	int mapTop = _panY - PLAYER_VIEWPORT_Y;
+
+	for (int oy = 0; oy < VIEWPORT_HEIGHT; ++oy) {
+		for (int ox = 0; ox < VIEWPORT_WIDTH; ++ox) {
+			int x = (mapLeft + ox + Data::MAP_WIDTH) % Data::MAP_WIDTH;
+			int y = (mapTop + oy + Data::MAP_HEIGHT) % Data::MAP_HEIGHT;
+			Data::TileId tileId = _tiles[y][x];
+
+			if (ox == PLAYER_VIEWPORT_X && oy == PLAYER_VIEWPORT_Y)
+				tileId = Data::TILE_ROCKET;
+
+			s.blitFrom(_tileGfx[tileId], Common::Point(ox * TILE_WIDTH, oy * TILE_HEIGHT));
+		}
+	}
+}
+
+bool Ending::tick() {
+	uint32 now = g_system->getMillis();
+	if (now - _lastStep >= STEP_DELAY) {
+		_lastStep = now;
+
+		_panY = (_panY + 1) & 0x3F;
+		if ((_panY & 3) == 0)
+			_panX = (_panX + 1) & 0x3F;
+
+		redraw();
+	}
+
+	return View::tick();
+}
+
+} // namespace Views
+} // namespace Ultima2
+} // namespace Ultima
diff --git a/engines/ultima/ultima2/views/ending.h b/engines/ultima/ultima2/views/ending.h
new file mode 100644
index 00000000000..23d951a1749
--- /dev/null
+++ b/engines/ultima/ultima2/views/ending.h
@@ -0,0 +1,60 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef ULTIMA2_VIEWS_ENDING_H
+#define ULTIMA2_VIEWS_ENDING_H
+
+#include "ultima/shared/gfx/view.h"
+#include "ultima/ultima2/data/map.h"
+
+namespace Ultima {
+namespace Ultima2 {
+namespace Views {
+
+using namespace Shared::Messages;
+
+/**
+ * The game's final, non-interactive screen: the victory text over MAPX30,
+ * a fixed decorative map reused for this purpose, endlessly panning on a
+ * diagonal with the player shown as a rocket. There's no way back from
+ * here short of quitting - matches the original, which loops forever
+ */
+class Ending : public Shared::Gfx::View {
+private:
+	Data::TileId _tiles[Data::MAP_HEIGHT][Data::MAP_WIDTH] = {};
+	Graphics::Surface _tileGfx[Data::TILE_COUNT];
+	byte _panX = 0, _panY = 0;
+	uint32 _lastStep = 0;
+
+public:
+	Ending();
+	~Ending() override;
+
+	bool msgFocus(const FocusMessage &msg) override;
+	void draw() override;
+	bool tick() override;
+};
+
+} // namespace Views
+} // namespace Ultima2
+} // namespace Ultima
+
+#endif
diff --git a/engines/ultima/ultima2/views/views.h b/engines/ultima/ultima2/views/views.h
index 563d3615b0d..9c1ece3e072 100644
--- a/engines/ultima/ultima2/views/views.h
+++ b/engines/ultima/ultima2/views/views.h
@@ -25,6 +25,7 @@
 #include "ultima/shared/engine/events.h"
 #include "ultima/ultima2/views/create_character.h"
 #include "ultima/ultima2/views/dungeon_map.h"
+#include "ultima/ultima2/views/ending.h"
 #include "ultima/ultima2/views/game.h"
 #include "ultima/ultima2/views/location_map.h"
 #include "ultima/ultima2/views/overworld_map.h"
@@ -75,6 +76,7 @@ struct Views : public Shared::Views {
 
 	CreateCharacter _createCharacter;
 	DungeonMap _dungeonMap;
+	Ending _ending;
 	Game _game;
 	LocationMap _locationMap;
 	OverworldMap _overworldMap;


Commit: 0729b003f767f5564e0f0355d31a4270d815a24d
    https://github.com/scummvm/scummvm/commit/0729b003f767f5564e0f0355d31a4270d815a24d
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:40:57+11:00

Commit Message:
ULTIMA: ULTIMA2: Add PC speaker sound effects

Changed paths:
    engines/ultima/ultima2/data/data.h
    engines/ultima/ultima2/logic/city_castle_logic.cpp
    engines/ultima/ultima2/logic/dungeon_logic.cpp
    engines/ultima/ultima2/logic/logic.cpp
    engines/ultima/ultima2/logic/logic.h
    engines/ultima/ultima2/logic/overworld_logic.cpp
    engines/ultima/ultima2/ultima2.cpp
    engines/ultima/ultima2/ultima2.h


diff --git a/engines/ultima/ultima2/data/data.h b/engines/ultima/ultima2/data/data.h
index 7a1f6ec25ee..bb91a5ef2e1 100644
--- a/engines/ultima/ultima2/data/data.h
+++ b/engines/ultima/ultima2/data/data.h
@@ -98,6 +98,11 @@ enum ItemType {
 };
 extern const char *const ITEM_NAMES[ITEM_COUNT];
 
+// Short PC speaker effects, played through Ultima2Engine::playFX
+enum SoundEffect {
+	SFX_TICK, SFX_STEP, SFX_ATTACK, SFX_HIT, SFX_CANNON, SFX_TRAP, SFX_FAIL, SFX_BEEP, SFX_MAGIC
+};
+
 /**
  * The original keeps amounts as packed BCD bytes: each nibble is a decimal
  * digit. Converts such a byte to the number it represents
diff --git a/engines/ultima/ultima2/logic/city_castle_logic.cpp b/engines/ultima/ultima2/logic/city_castle_logic.cpp
index 4a7b856d7f9..366d91e7623 100644
--- a/engines/ultima/ultima2/logic/city_castle_logic.cpp
+++ b/engines/ultima/ultima2/logic/city_castle_logic.cpp
@@ -55,6 +55,7 @@ bool CityCastleLogic::move(Data::Direction dir) {
 	default: return true;
 	}
 
+	playFX(Data::SFX_STEP);
 	writeString("%s", dirName);
 
 	if (newX < 0 || newX >= Data::MAP_WIDTH || newY < 0 || newY >= Data::MAP_HEIGHT) {
@@ -147,7 +148,7 @@ void CityCastleLogic::updateCreatures() {
 	}
 
 	for (int i = 0; i < engagedCount; ++i) {
-		playFX(1);
+		playFX(Data::SFX_CANNON);
 		if (i < hitCount)
 			showAttackTile(sg._mapX, sg._mapY);
 	}
diff --git a/engines/ultima/ultima2/logic/dungeon_logic.cpp b/engines/ultima/ultima2/logic/dungeon_logic.cpp
index 86da8b18804..b536dc0be6a 100644
--- a/engines/ultima/ultima2/logic/dungeon_logic.cpp
+++ b/engines/ultima/ultima2/logic/dungeon_logic.cpp
@@ -96,6 +96,7 @@ bool DungeonLogic::advance() {
 	}
 
 	sg._lightTurns = 0;
+	playFX(Data::SFX_TRAP);
 	writeString("\nARGH! A TRAP!\n");
 
 	if (sg._thievesTools == 0) {
@@ -273,6 +274,7 @@ void DungeonLogic::killMonster(int slot) {
 bool DungeonLogic::attack(Data::Direction dir) {
 	Data::Savegame &sg = _G(savegame);
 	Data::MapMonsters &monsters = _G(map)._monsters;
+	playFX(Data::SFX_ATTACK);
 	writeString("ATTACK--");
 
 	byte x = sg._mapX + sg._facingX, y = sg._mapY + sg._facingY;
@@ -307,6 +309,7 @@ bool DungeonLogic::attack(Data::Direction dir) {
 		return true;
 	}
 
+	playFX(Data::SFX_HIT);
 	writeString("HIT!");
 	int dmg = (sg._readiedWeapon * 8 + sg._strength) >> 2;
 	byte &hp = monsters._spellHP[slot];
@@ -412,6 +415,7 @@ bool DungeonLogic::castSpell(Data::SpellType spell) {
 		break;
 	}
 
+	playFX(Data::SFX_FAIL);
 	writeString("-FAILED!\n");
 	return true;
 }
@@ -486,7 +490,7 @@ bool DungeonLogic::monsterAttacks(int slot) {
 	if (monsters._glyphTile[slot] != level)
 		return true;
 
-	playFX(1);
+	playFX(Data::SFX_CANNON);
 	byte roll = randByte();
 	if ((roll & 0x80) != 0 || (roll & 7) < sg._readiedArmor)
 		return true;
diff --git a/engines/ultima/ultima2/logic/logic.cpp b/engines/ultima/ultima2/logic/logic.cpp
index f3609e3edf5..ba439b9895a 100644
--- a/engines/ultima/ultima2/logic/logic.cpp
+++ b/engines/ultima/ultima2/logic/logic.cpp
@@ -93,11 +93,12 @@ void Logic::showAttackTile(int x, int y) {
 	g_engine->focusedView()->send(AttackTileMessage(x, y, 0));
 }
 
-void Logic::playFX(int num) {
-	g_engine->playFX(num);
+void Logic::playFX(Data::SoundEffect fx) {
+	g_engine->playFX(fx);
 }
 
 void Logic::endOfTurn() {
+	playFX(Data::SFX_TICK);
 	updateCreatures();
 
 	Data::Savegame &sg = _G(savegame);
@@ -338,6 +339,7 @@ bool Logic::cast() {
 	writeString("CAST-%s", Data::SPELL_NAMES[sg._readiedSpell]);
 
 	if (sg._items[Data::ITEM_WAND] + sg._items[Data::ITEM_STAFF] == 0) {
+		playFX(Data::SFX_FAIL);
 		writeString("\nNEED WAND OR STAFF!\n");
 		return true;
 	}
@@ -348,6 +350,7 @@ bool Logic::cast() {
 	}
 
 	if (sg._spellCharges[sg._readiedSpell] == 0) {
+		playFX(Data::SFX_FAIL);
 		writeString("\nNO SPELL!\n");
 		return true;
 	}
@@ -358,6 +361,7 @@ bool Logic::cast() {
 
 bool Logic::castSpell(Data::SpellType spell) {
 	// Spells only work in towers and dungeons
+	playFX(Data::SFX_FAIL);
 	writeString("-FAILED!\n");
 	return true;
 }
diff --git a/engines/ultima/ultima2/logic/logic.h b/engines/ultima/ultima2/logic/logic.h
index cf76710cfd3..31befeb3f6e 100644
--- a/engines/ultima/ultima2/logic/logic.h
+++ b/engines/ultima/ultima2/logic/logic.h
@@ -92,10 +92,9 @@ protected:
 	void showAttackTile(int x, int y);
 
 	/**
-	 * Plays a sound effect. Currently a no-op stub, mirroring ultima1's
-	 * own unimplemented playFX
+	 * Plays a short PC speaker sound effect
 	 */
-	void playFX(int num);
+	void playFX(Data::SoundEffect fx);
 
 	/**
 	 * Handles end of turn logic
diff --git a/engines/ultima/ultima2/logic/overworld_logic.cpp b/engines/ultima/ultima2/logic/overworld_logic.cpp
index 0a086e71a12..fba9683aa88 100644
--- a/engines/ultima/ultima2/logic/overworld_logic.cpp
+++ b/engines/ultima/ultima2/logic/overworld_logic.cpp
@@ -173,6 +173,7 @@ bool OverworldLogic::move(Data::Direction dir) {
 		return true;
 	}
 
+	playFX(Data::SFX_STEP);
 	writeString("%s", dirName);
 
 	switch (stepOnto(newX, newY)) {
@@ -352,7 +353,7 @@ void OverworldLogic::updateCreatures() {
 	// A cannon-ish sound plays for every monster occupying the player's
 	// tile this turn; the hit flash only for those that actually connected
 	for (int i = 0; i < engagedCount; ++i) {
-		playFX(1);
+		playFX(Data::SFX_CANNON);
 		if (i < hitCount)
 			showAttackTile(sg._mapX, sg._mapY);
 	}
@@ -445,6 +446,8 @@ bool OverworldLogic::attack(Data::Direction dir) {
 		return false;
 	}
 
+	playFX(Data::SFX_ATTACK);
+
 	int dx = 0, dy = 0;
 	switch (dir) {
 	case Data::DIR_UP: dy = -1; break;
@@ -464,6 +467,7 @@ bool OverworldLogic::attack(Data::Direction dir) {
 		return false;
 	}
 
+	playFX(Data::SFX_HIT);
 	writeString("--HIT!!!\n");
 	alertTownGuards(slot);
 
diff --git a/engines/ultima/ultima2/ultima2.cpp b/engines/ultima/ultima2/ultima2.cpp
index d397101e832..0b17c734186 100644
--- a/engines/ultima/ultima2/ultima2.cpp
+++ b/engines/ultima/ultima2/ultima2.cpp
@@ -22,6 +22,7 @@
 #include "common/system.h"
 #include "common/savefile.h"
 #include "engines/util.h"
+#include "audio/softsynth/pcspk.h"
 #include "ultima/ultima2/ultima2.h"
 #include "ultima/ultima2/console.h"
 #include "ultima/ultima2/metaengine.h"
@@ -39,9 +40,11 @@ Ultima2Engine *g_engine;
 Ultima2Engine::Ultima2Engine(OSystem *syst, const Ultima::UltimaGameDescription *gameDesc) : Engine(syst),
 _gameDescription(gameDesc) {
 	g_engine = this;
+	_pcSpeaker = new Audio::PCSpeaker();
 }
 
 Ultima2Engine::~Ultima2Engine() {
+	delete _pcSpeaker;
 }
 
 uint32 Ultima2Engine::getFeatures() const {
@@ -58,6 +61,7 @@ Common::Error Ultima2Engine::run() {
 	// Initialize 320x200 paletted graphics mode
 	initGraphics(320, 200);
 	Data::setCGAPalette();
+	_pcSpeakerReady = _pcSpeaker->init();
 
 	// Set the engine's debugger console
 	setDebugger(new Console());
@@ -132,8 +136,87 @@ bool Ultima2Engine::savegamesExist() const {
 	return result;
 }
 
-void Ultima2Engine::playFX(int num) {
-	warning("TODO: playFX(%d)", num);
+namespace {
+
+// The original's PIT timer runs at ~1193182Hz; a note's pitch is that
+// divided by the divisor value the game hands to the timer chip
+constexpr double PIT_BASE_FREQUENCY = 1193182.0;
+
+} // namespace
+
+void Ultima2Engine::queueTone(int divisor, uint32 lengthMs) {
+	if (_pcSpeakerReady && divisor > 0)
+		_pcSpeaker->playQueue(Audio::PCSpeaker::kWaveFormSquare, PIT_BASE_FREQUENCY / divisor, lengthMs * 1000);
+}
+
+void Ultima2Engine::queueSilence(uint32 lengthMs) {
+	if (_pcSpeakerReady)
+		_pcSpeaker->playQueue(Audio::PCSpeaker::kWaveFormSilence, 0, lengthMs * 1000);
+}
+
+void Ultima2Engine::playFX(Data::SoundEffect fx) {
+	if (!_pcSpeakerReady)
+		return;
+
+	_pcSpeaker->stop();
+
+	switch (fx) {
+	case Data::SFX_TICK:
+		// A short, unobtrusive click - played every single turn
+		queueTone(1280, 8);
+		break;
+
+	case Data::SFX_STEP:
+		// An even quieter, lower thud for each step taken
+		queueTone(0x4000, 12);
+		break;
+
+	case Data::SFX_ATTACK:
+		// A brief falling whoosh as a weapon swings
+		queueTone(1024, 60);
+		queueTone(1280, 60);
+		queueTone(1535, 80);
+		break;
+
+	case Data::SFX_HIT:
+		// A short, buzzy warble for a connecting blow
+		for (int i = 0; i < 6; ++i)
+			queueTone((i & 1) ? 512 : 1400, 20);
+		break;
+
+	case Data::SFX_CANNON:
+		// A quick descending-pitch blast
+		queueTone(768, 40);
+		queueTone(1280, 40);
+		queueTone(1790, 40);
+		break;
+
+	case Data::SFX_TRAP:
+		// A longer falling alarm
+		for (int i = 0; i < 8; ++i)
+			queueTone(256 + i * ((4351 - 256) / 7), 90);
+		break;
+
+	case Data::SFX_FAIL:
+		// A short, rapidly rising buzz for a failed action
+		for (int i = 0; i < 12; ++i)
+			queueTone(2048 - i * 160, 15);
+		break;
+
+	case Data::SFX_BEEP:
+		// A narrow, high-pitched double-blip confirmation chime
+		queueTone(760, 60);
+		queueTone(800, 60);
+		queueTone(760, 60);
+		break;
+
+	case Data::SFX_MAGIC:
+		// A narrow, softer chime for a successful spell
+		queueTone(1170, 60);
+		queueTone(1216, 60);
+		queueTone(1170, 60);
+		break;
+	}
 }
 
 } // namespace Ultima2
diff --git a/engines/ultima/ultima2/ultima2.h b/engines/ultima/ultima2/ultima2.h
index 08489e1dd23..e47458ea4e6 100644
--- a/engines/ultima/ultima2/ultima2.h
+++ b/engines/ultima/ultima2/ultima2.h
@@ -36,6 +36,10 @@
 #include "ultima/ultima2/data/savegame.h"
 #include "ultima/ultima2/logic/logic.h"
 
+namespace Audio {
+class PCSpeaker;
+}
+
 namespace Ultima {
 namespace Ultima2 {
 
@@ -61,6 +65,21 @@ private:
 	// original's rand_byte generator
 	byte _rngState[6] = {};
 
+	Audio::PCSpeaker *_pcSpeaker = nullptr;
+	bool _pcSpeakerReady = false;
+
+	/**
+	 * Queues a single square-wave note. divisor is the original's PIT
+	 * timer divisor (frequency = ~1193182/divisor), matching how each
+	 * original sound is specified
+	 */
+	void queueTone(int divisor, uint32 lengthMs);
+
+	/**
+	 * Queues a moment of silence
+	 */
+	void queueSilence(uint32 lengthMs);
+
 public:
 	Data::Savegame _savegame;
 	Data::Map _map;
@@ -118,11 +137,11 @@ public:
 	byte randByte();
 
 	/**
-	 * Plays a sound effect. Currently a no-op stub, mirroring ultima1's
-	 * own unimplemented playFX - Ultima II has no numbered sound-effect
-	 * table; each original sound is its own hardcoded PC-speaker tone-sweep
+	 * Plays a short PC speaker sound effect. Ultima II has no numbered
+	 * sound-effect table of its own - each original sound is its own
+	 * hardcoded tone sweep, reproduced here as a short note sequence
 	 */
-	void playFX(int num);
+	void playFX(Data::SoundEffect fx);
 };
 
 extern Ultima2Engine *g_engine;


Commit: 6a439ae54856c9bc49417fd05eae995d5ce5a329
    https://github.com/scummvm/scummvm/commit/6a439ae54856c9bc49417fd05eae995d5ce5a329
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:40:57+11:00

Commit Message:
ULTIMA: ULTIMA1: Fix bug for ultima1-only builds

Changed paths:
    engines/ultima/detection_tables.h
    engines/ultima/metaengine.cpp


diff --git a/engines/ultima/detection_tables.h b/engines/ultima/detection_tables.h
index 16e2508bff4..d34f76fc4ee 100644
--- a/engines/ultima/detection_tables.h
+++ b/engines/ultima/detection_tables.h
@@ -49,9 +49,7 @@ namespace Ultima {
 
 static const PlainGameDescriptor ULTIMA_GAMES[] = {
 	{ "akalabeth", "Akalabeth: World of Doom" },
-#ifndef RELEASE_BUILD
 	{ "ultima1", "Ultima I: The First Age of Darkness" },
-#endif
 	{ "ultima2", "Ultima II: Revenge of the Enchantress" },
 	{ "ultima4", "Ultima IV: Quest of the Avatar" },
 	{ "ultima4_enh", "Ultima IV: Quest of the Avatar - Enhanced" },
diff --git a/engines/ultima/metaengine.cpp b/engines/ultima/metaengine.cpp
index 523eb5ec9bc..f5f2f375e15 100644
--- a/engines/ultima/metaengine.cpp
+++ b/engines/ultima/metaengine.cpp
@@ -267,7 +267,7 @@ SaveStateDescriptor UltimaMetaEngine::querySaveMetaInfos(const char *target, int
 }
 
 Common::KeymapArray UltimaMetaEngine::initKeymaps(const char *target) const {
-#if defined(ENABLE_AKALABETH) || defined(ENABLE_ULTIMA2) || defined(ENABLE_ULTIMA4) || defined(ENABLE_ULTIMA6) || defined(ENABLE_ULTIMA8)
+#if defined(ENABLE_AKALABETH) || defined(ENABLE_ULTIMA1) || defined(ENABLE_ULTIMA2) || defined(ENABLE_ULTIMA4) || defined(ENABLE_ULTIMA6) || defined(ENABLE_ULTIMA8)
 	const Common::String gameId = getGameId(target);
 #endif
 


Commit: d5d7c5ab33778e5f71f6eb062d1b1faec2f62990
    https://github.com/scummvm/scummvm/commit/d5d7c5ab33778e5f71f6eb062d1b1faec2f62990
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:40:57+11:00

Commit Message:
ULTIMA: ULTIMA2: Add console commands to import and export the original PLAYER save format

Changed paths:
    engines/ultima/ultima2/console.cpp
    engines/ultima/ultima2/console.h
    engines/ultima/ultima2/data/savegame.cpp
    engines/ultima/ultima2/data/savegame.h


diff --git a/engines/ultima/ultima2/console.cpp b/engines/ultima/ultima2/console.cpp
index 93862693b53..da7fb4e70bc 100644
--- a/engines/ultima/ultima2/console.cpp
+++ b/engines/ultima/ultima2/console.cpp
@@ -41,6 +41,8 @@ Console::Console() : GUI::Debugger() {
 	registerCmd("gold", WRAP_METHOD(Console, cmdGold));
 	registerCmd("inventory", WRAP_METHOD(Console, cmdInventory));
 	registerCmd("space", WRAP_METHOD(Console, cmdSpace));
+	registerCmd("load", WRAP_METHOD(Console, cmdLoad));
+	registerCmd("save", WRAP_METHOD(Console, cmdSave));
 }
 
 Console::~Console() {
@@ -345,5 +347,65 @@ bool Console::cmdSpace(int argc, const char **argv) {
 	return false;
 }
 
+bool Console::cmdLoad(int argc, const char **argv) {
+	if (argc > 2) {
+		debugPrintf("load [<filename>]  - imports an original DOS PLAYER save; defaults to \"PLAYER\"\n");
+		return true;
+	}
+
+	Common::String filename = (argc == 2) ? argv[1] : "PLAYER";
+	Common::File f;
+	if (!f.open(filename.c_str())) {
+		debugPrintf("Could not open %s\n", filename.c_str());
+		return true;
+	}
+
+	Data::Savegame &sg = _G(savegame);
+	bool success = sg.importOriginal(f);
+	f.close();
+
+	if (!success) {
+		debugPrintf("%s is too short to be a PLAYER save\n", filename.c_str());
+		return true;
+	}
+
+	if (!Common::File::exists(Data::mapFilename(sg._mapEra, sg._mapType).c_str())) {
+		debugPrintf("Imported %s, but no map file for era %d type %d\n",
+			filename.c_str(), sg._mapEra, sg._mapType);
+		return true;
+	}
+
+	_G(map).load(sg._mapEra, sg._mapType);
+	_G(logic)->entering();
+	debugPrintf("Imported %s: %s, HP=%d food=%d gold=%d, at (%d,%d) era %d type %d\n",
+		filename.c_str(), sg._name, sg._hp, sg._food, sg._gold, sg._mapX, sg._mapY, sg._mapEra, sg._mapType);
+	return false;
+}
+
+bool Console::cmdSave(int argc, const char **argv) {
+	if (argc > 2) {
+		debugPrintf("save [<filename>]  - exports an original DOS PLAYER save; defaults to \"PLAYER\"\n");
+		return true;
+	}
+
+	Data::Savegame &sg = _G(savegame);
+	if (!sg.hasCharacter()) {
+		debugPrintf("No character to save\n");
+		return true;
+	}
+
+	Common::String filename = (argc == 2) ? argv[1] : "PLAYER";
+	Common::DumpFile f;
+	if (!f.open(Common::Path(filename), true)) {
+		debugPrintf("Could not create %s\n", filename.c_str());
+		return true;
+	}
+
+	sg.exportOriginal(f);
+	f.close();
+	debugPrintf("Exported %s\n", filename.c_str());
+	return true;
+}
+
 } // namespace Ultima2
 } // namespace Ultima
diff --git a/engines/ultima/ultima2/console.h b/engines/ultima/ultima2/console.h
index e01a4e19d15..18b5393b25b 100644
--- a/engines/ultima/ultima2/console.h
+++ b/engines/ultima/ultima2/console.h
@@ -42,6 +42,8 @@ private:
 	bool cmdGold(int argc, const char **argv);
 	bool cmdInventory(int argc, const char **argv);
 	bool cmdSpace(int argc, const char **argv);
+	bool cmdLoad(int argc, const char **argv);
+	bool cmdSave(int argc, const char **argv);
 
 public:
 	Console();
diff --git a/engines/ultima/ultima2/data/savegame.cpp b/engines/ultima/ultima2/data/savegame.cpp
index b301af3fa7c..ebb10708ca6 100644
--- a/engines/ultima/ultima2/data/savegame.cpp
+++ b/engines/ultima/ultima2/data/savegame.cpp
@@ -124,6 +124,189 @@ void Savegame::synchronize(Common::Serializer &s) {
 	s.syncAsByte(_mount);
 }
 
+namespace {
+
+// Byte offsets into the original 256-byte PLAYER struct. Most of these are
+// confirmed directly from the disassembly's own struct definition; a few
+// small gaps between them were only ever described in prose and turned
+// out to be one byte short - re-measured here against a real captured
+// PLAYER file (every attribute/resource decodes to a plausible value,
+// and the gap sizes below place them so that mapX/mapY, and the later
+// _disableSave field the disassembly does give an exact offset for, both
+// land in exactly the right place)
+enum {
+	OFS_NAME = 0x00,
+	OFS_SEX = 0x10,
+	OFS_CLASS = 0x11,
+	OFS_RACE = 0x12,
+	OFS_MAP_ERA = 0x13,
+	OFS_MAP_TYPE = 0x14,
+	OFS_STRENGTH = 0x15,
+	OFS_AGILITY = 0x16,
+	OFS_STAMINA = 0x17,
+	OFS_CHARISMA = 0x18,
+	OFS_WISDOM = 0x19,
+	OFS_INTELLIGENCE = 0x1A,
+	OFS_HP = 0x1B,          // 2 bytes, hi/lo BCD digit pairs
+	OFS_FOOD = 0x1D,        // 2 bytes
+	OFS_FOOD_TURN_CTR = 0x1F,
+	OFS_EXPERIENCE = 0x20,  // 2 bytes
+	OFS_GOLD = 0x22,        // 2 bytes
+	OFS_MAP_X = 0x24,
+	OFS_MAP_Y = 0x25,
+	OFS_READIED_WEAPON = 0x2A,
+	OFS_READIED_ARMOR = 0x2B,
+	OFS_READIED_SPELL = 0x2C,
+	OFS_TORCHES = 0x2D,
+	OFS_KEYS = 0x2E,
+	OFS_THIEVES_TOOLS = 0x2F,
+	OFS_IN_SPACE = 0x30,
+	OFS_LAUNCH_MAP_X = 0x34,
+	OFS_LAUNCH_MAP_Y = 0x35,
+	OFS_RING_QUEST_FLAG = 0x36,
+	OFS_ORBIT_TARGET = 0x37,
+	OFS_PATROL_WAYPOINT = 0x38,
+	OFS_OFFER_REWARD_ITEMS = 0x40, // 9 bytes
+	OFS_ENILNO_OWNED = 0x49,
+	OFS_ARMOR_OWNED = 0x60,  // ARMOR_COUNT bytes, BCD
+	OFS_WEAPON_OWNED = 0x76, // WEAPON_COUNT bytes, BCD
+	OFS_SPELL_CHARGES = 0x80, // SPELL_COUNT bytes, BCD
+	OFS_ITEMS = 0xA0,        // ITEM_COUNT bytes, BCD
+
+	PLAYER_SIZE = 0x100
+};
+
+} // namespace
+
+bool Savegame::importOriginal(Common::SeekableReadStream &stream) {
+	byte buf[PLAYER_SIZE];
+	if (stream.read(buf, sizeof(buf)) != sizeof(buf))
+		return false;
+
+	*this = Savegame();
+
+	Common::strlcpy(_name, (const char *)&buf[OFS_NAME], sizeof(_name));
+
+	_sex = (buf[OFS_SEX] == 'M') ? SEX_MALE : SEX_FEMALE;
+	_class = (CharClass)CLIP<int>(buf[OFS_CLASS], 0, CLASS_COUNT - 1);
+	_race = (Race)CLIP<int>(buf[OFS_RACE], 0, RACE_COUNT - 1);
+	_mapEra = buf[OFS_MAP_ERA];
+	_mapType = buf[OFS_MAP_TYPE];
+
+	_strength = bcdValue(buf[OFS_STRENGTH]);
+	_agility = bcdValue(buf[OFS_AGILITY]);
+	_stamina = bcdValue(buf[OFS_STAMINA]);
+	_charisma = bcdValue(buf[OFS_CHARISMA]);
+	_wisdom = bcdValue(buf[OFS_WISDOM]);
+	_intelligence = bcdValue(buf[OFS_INTELLIGENCE]);
+
+	_hp = bcdValue(buf[OFS_HP]) * 100 + bcdValue(buf[OFS_HP + 1]);
+	_food = bcdValue(buf[OFS_FOOD]) * 100 + bcdValue(buf[OFS_FOOD + 1]);
+	_foodTurnCtr = bcdValue(buf[OFS_FOOD_TURN_CTR]);
+	_experience = bcdValue(buf[OFS_EXPERIENCE]) * 100 + bcdValue(buf[OFS_EXPERIENCE + 1]);
+	_gold = bcdValue(buf[OFS_GOLD]) * 100 + bcdValue(buf[OFS_GOLD + 1]);
+
+	_mapX = buf[OFS_MAP_X];
+	_mapY = buf[OFS_MAP_Y];
+
+	_readiedWeapon = (WeaponType)CLIP<int>(buf[OFS_READIED_WEAPON], 0, WEAPON_COUNT - 1);
+	_readiedArmor = (ArmorType)CLIP<int>(buf[OFS_READIED_ARMOR], 0, ARMOR_COUNT - 1);
+	_readiedSpell = (SpellType)CLIP<int>(buf[OFS_READIED_SPELL], 0, SPELL_COUNT - 1);
+	_torches = bcdValue(buf[OFS_TORCHES]);
+	_keys = bcdValue(buf[OFS_KEYS]);
+	_thievesTools = bcdValue(buf[OFS_THIEVES_TOOLS]);
+
+	_inSpace = buf[OFS_IN_SPACE] != 0;
+	_launchMapX = buf[OFS_LAUNCH_MAP_X];
+	_launchMapY = buf[OFS_LAUNCH_MAP_Y];
+	_ringQuestFlag = buf[OFS_RING_QUEST_FLAG] != 0;
+	_orbitTarget = buf[OFS_ORBIT_TARGET];
+	_patrolWaypoint = buf[OFS_PATROL_WAYPOINT];
+
+	for (int i = 0; i < 9; ++i)
+		_offerRewardItems[i] = buf[OFS_OFFER_REWARD_ITEMS + i];
+	_enilnoOwned = buf[OFS_ENILNO_OWNED] != 0;
+
+	for (int i = 0; i < ARMOR_COUNT; ++i)
+		_armorOwned[i] = bcdValue(buf[OFS_ARMOR_OWNED + i]);
+	for (int i = 0; i < WEAPON_COUNT; ++i)
+		_weaponOwned[i] = bcdValue(buf[OFS_WEAPON_OWNED + i]);
+	for (int i = 0; i < SPELL_COUNT; ++i)
+		_spellCharges[i] = bcdValue(buf[OFS_SPELL_CHARGES + i]);
+	for (int i = 0; i < ITEM_COUNT; ++i)
+		_items[i] = bcdValue(buf[OFS_ITEMS + i]);
+
+	// The rest (overworldReturn, dungeon position, moongate timer,
+	// hyperwarp coordinates, in-flight flag, ...) are all ScummVM-only
+	// additions with nothing to import - left at Savegame()'s defaults
+	return true;
+}
+
+void Savegame::exportOriginal(Common::WriteStream &stream) const {
+	byte buf[PLAYER_SIZE] = {};
+
+	Common::strlcpy((char *)&buf[OFS_NAME], _name, MAX_NAME_LENGTH + 1);
+
+	buf[OFS_SEX] = (_sex == SEX_MALE) ? 'M' : 'F';
+	buf[OFS_CLASS] = _class;
+	buf[OFS_RACE] = _race;
+	buf[OFS_MAP_ERA] = _mapEra;
+	buf[OFS_MAP_TYPE] = _mapType;
+
+	buf[OFS_STRENGTH] = toBcd(_strength);
+	buf[OFS_AGILITY] = toBcd(_agility);
+	buf[OFS_STAMINA] = toBcd(_stamina);
+	buf[OFS_CHARISMA] = toBcd(_charisma);
+	buf[OFS_WISDOM] = toBcd(_wisdom);
+	buf[OFS_INTELLIGENCE] = toBcd(_intelligence);
+
+	buf[OFS_HP] = toBcd(_hp / 100);
+	buf[OFS_HP + 1] = toBcd(_hp % 100);
+	buf[OFS_FOOD] = toBcd(_food / 100);
+	buf[OFS_FOOD + 1] = toBcd(_food % 100);
+	buf[OFS_FOOD_TURN_CTR] = toBcd(_foodTurnCtr);
+	buf[OFS_EXPERIENCE] = toBcd(_experience / 100);
+	buf[OFS_EXPERIENCE + 1] = toBcd(_experience % 100);
+	buf[OFS_GOLD] = toBcd(_gold / 100);
+	buf[OFS_GOLD + 1] = toBcd(_gold % 100);
+
+	buf[OFS_MAP_X] = _mapX;
+	buf[OFS_MAP_Y] = _mapY;
+
+	buf[OFS_READIED_WEAPON] = _readiedWeapon;
+	buf[OFS_READIED_ARMOR] = _readiedArmor;
+	buf[OFS_READIED_SPELL] = _readiedSpell;
+	buf[OFS_TORCHES] = toBcd(_torches);
+	buf[OFS_KEYS] = toBcd(_keys);
+	buf[OFS_THIEVES_TOOLS] = toBcd(_thievesTools);
+
+	buf[OFS_IN_SPACE] = _inSpace ? 1 : 0;
+	buf[OFS_LAUNCH_MAP_X] = _launchMapX;
+	buf[OFS_LAUNCH_MAP_Y] = _launchMapY;
+	buf[OFS_RING_QUEST_FLAG] = _ringQuestFlag ? 1 : 0;
+	buf[OFS_ORBIT_TARGET] = (byte)_orbitTarget;
+	buf[OFS_PATROL_WAYPOINT] = _patrolWaypoint;
+
+	for (int i = 0; i < 9; ++i)
+		buf[OFS_OFFER_REWARD_ITEMS + i] = _offerRewardItems[i];
+	buf[OFS_ENILNO_OWNED] = _enilnoOwned ? 1 : 0;
+
+	for (int i = 0; i < ARMOR_COUNT; ++i)
+		buf[OFS_ARMOR_OWNED + i] = toBcd(_armorOwned[i]);
+	for (int i = 0; i < WEAPON_COUNT; ++i)
+		buf[OFS_WEAPON_OWNED + i] = toBcd(_weaponOwned[i]);
+	for (int i = 0; i < SPELL_COUNT; ++i)
+		buf[OFS_SPELL_CHARGES + i] = toBcd(_spellCharges[i]);
+	for (int i = 0; i < ITEM_COUNT; ++i)
+		buf[OFS_ITEMS + i] = toBcd(_items[i]);
+
+	// The original leaves this at 0xFF once the game's speed calibration
+	// has run once; harmless either way since nothing reads it back in
+	buf[0x3E] = 0xFF;
+
+	stream.write(buf, sizeof(buf));
+}
+
 } // namespace Data
 } // namespace Ultima2
 } // namespace Ultima
diff --git a/engines/ultima/ultima2/data/savegame.h b/engines/ultima/ultima2/data/savegame.h
index e341982cd44..ae9ce8e443b 100644
--- a/engines/ultima/ultima2/data/savegame.h
+++ b/engines/ultima/ultima2/data/savegame.h
@@ -23,6 +23,7 @@
 #define ULTIMA2_DATA_SAVEGAME_H
 
 #include "common/serializer.h"
+#include "common/stream.h"
 #include "ultima/ultima2/data/data.h"
 #include "ultima/ultima2/data/tiles.h"
 
@@ -137,6 +138,31 @@ struct Savegame {
 	 */
 	void synchronize(Common::Serializer &s);
 
+	/**
+	 * Replaces the character with one imported from the original DOS
+	 * game's binary PLAYER file format (its first 256 bytes; real files
+	 * on disk have a 128-byte stale duplicate tail, same as monx??/
+	 * tlkx???, which is ignored here). Returns false if the stream is
+	 * too short to be a real PLAYER file.
+	 *
+	 * Debug/testing use only, via the "load" console command. Fields
+	 * ScummVM's own save format added that the original never had
+	 * (dungeon position, moongate timer, hyperwarp coordinates, the
+	 * mid-flight flag, ...) are reset to their defaults, since there's
+	 * nothing in the file to recover them from - a character saved by
+	 * the original is also always standing on a map (villages/towns/
+	 * castles auto-save too), never mid-dungeon-corridor or mid-flight.
+	 */
+	bool importOriginal(Common::SeekableReadStream &stream);
+
+	/**
+	 * Writes the character out in the original DOS game's binary PLAYER
+	 * file format (256 bytes, no stale tail), so it can be loaded back
+	 * with "load", or dropped into a real DOS install for DOSBox.
+	 * Debug/testing use only, via the "save" console command.
+	 */
+	void exportOriginal(Common::WriteStream &stream) const;
+
 	/**
 	 * Returns true if the game can't be saved here, which is anywhere
 	 * but Earth


Commit: 170f0d35e7655c074e61072c7f612c2a650dcd75
    https://github.com/scummvm/scummvm/commit/170f0d35e7655c074e61072c7f612c2a650dcd75
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:40:58+11:00

Commit Message:
ULTIMA: ULTIMA2: Fix two small text/sound gaps found in a full string-catalog audit

Changed paths:
    engines/ultima/ultima2/logic/logic.cpp
    engines/ultima/ultima2/views/create_character.cpp


diff --git a/engines/ultima/ultima2/logic/logic.cpp b/engines/ultima/ultima2/logic/logic.cpp
index ba439b9895a..08211f3e8e6 100644
--- a/engines/ultima/ultima2/logic/logic.cpp
+++ b/engines/ultima/ultima2/logic/logic.cpp
@@ -221,7 +221,7 @@ void Logic::action(int action) {
 		doEndOfTurn = zstats();
 		break;
 	default:
-		writeString("Huh?\n");
+		writeString("-ILLEGAL COMMAND!\n");
 		break;
 	}
 
@@ -275,7 +275,7 @@ bool Logic::trySpendGold(int amount) {
 }
 
 void Logic::keypress(const Shared::Messages::KeypressMessage &msg) {
-	writeString("Huh?\n");
+	writeString("-ILLEGAL COMMAND!\n");
 	endOfTurn();
 	prompt();
 }
diff --git a/engines/ultima/ultima2/views/create_character.cpp b/engines/ultima/ultima2/views/create_character.cpp
index 135ebd4a0f5..8f3e9756410 100644
--- a/engines/ultima/ultima2/views/create_character.cpp
+++ b/engines/ultima/ultima2/views/create_character.cpp
@@ -71,8 +71,7 @@ void CreateCharacter::reset() {
 }
 
 void CreateCharacter::rejectEntry() {
-	// TODO: play the original's triple-beep failure sound once sound
-	// effects are implemented
+	g_engine->playFX(Data::SFX_FAIL);
 	reset();
 }
 


Commit: 5433716915b94f4e100529f3d62d64f17f8c63b8
    https://github.com/scummvm/scummvm/commit/5433716915b94f4e100529f3d62d64f17f8c63b8
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:40:58+11:00

Commit Message:
ULTIMA: ULTIMA2: Add Daemon/Devil/Mage/Balron proximity traps

Changed paths:
    engines/ultima/ultima2/logic/overworld_logic.cpp
    engines/ultima/ultima2/logic/overworld_logic.h


diff --git a/engines/ultima/ultima2/logic/overworld_logic.cpp b/engines/ultima/ultima2/logic/overworld_logic.cpp
index fba9683aa88..84733f2f125 100644
--- a/engines/ultima/ultima2/logic/overworld_logic.cpp
+++ b/engines/ultima/ultima2/logic/overworld_logic.cpp
@@ -309,6 +309,28 @@ void OverworldLogic::updateCreatures() {
 
 		int dx = sg._mapX - monsters._mapX[slot];
 		int dy = sg._mapY - monsters._mapY[slot];
+
+		// Daemons, Devils, Mages and Balrons within 2 tiles have a small
+		// chance each turn of casting a proximity trap on the player
+		if (ABS(dx) < 3 && ABS(dy) < 3 && randByte() < 0x20) {
+			switch (monsterTile) {
+			case Data::TILE_DAEMON:
+				legParalysisTrap();
+				break;
+			case Data::TILE_DEVIL:
+				armParalysisTrap();
+				break;
+			case Data::TILE_MAGE:
+				magicMissileTrap();
+				break;
+			case Data::TILE_BALRON:
+				sleepTrap();
+				break;
+			default:
+				break;
+			}
+		}
+
 		int sdx = signByte(dx * 4);
 		int sdy = signByte(dy * 4);
 
@@ -574,6 +596,55 @@ void OverworldLogic::minaxDeathSequence() {
 	g_engine->addView("Ending");
 }
 
+void OverworldLogic::legParalysisTrap() {
+	Data::Savegame &sg = _G(savegame);
+	writeString("LEGS PARALIZED!\n");
+	playFX(Data::SFX_MAGIC);
+	showAttackTile(sg._mapX, sg._mapY);
+
+	if (sg._items[Data::ITEM_BOOTS] != 0 && randByte() >= 0x40) {
+		writeString("SAVED BY MAGICAL BOOTS!\n");
+		return;
+	}
+
+	sg._legParalysisTurns = randByte() & 0xF;
+}
+
+void OverworldLogic::armParalysisTrap() {
+	Data::Savegame &sg = _G(savegame);
+	writeString("ARMS PARALIZED!\n");
+	playFX(Data::SFX_MAGIC);
+	showAttackTile(sg._mapX, sg._mapY);
+
+	if (sg._items[Data::ITEM_CLOAK] != 0 && randByte() >= 0x40) {
+		writeString("SAVED BY MAGICAL CLOAK\n");
+		return;
+	}
+
+	sg._armParalysisTurns = randByte() & 0xF;
+}
+
+void OverworldLogic::magicMissileTrap() {
+	Data::Savegame &sg = _G(savegame);
+	writeString("MAGIC MISSILE!\n");
+	playFX(Data::SFX_MAGIC);
+	showAttackTile(sg._mapX, sg._mapY);
+}
+
+void OverworldLogic::sleepTrap() {
+	Data::Savegame &sg = _G(savegame);
+	writeString("SLEEP SPELL!\n");
+	playFX(Data::SFX_MAGIC);
+	showAttackTile(sg._mapX, sg._mapY);
+
+	if (sg._items[Data::ITEM_GREEN_IDOL] != 0 && randByte() >= 0x40) {
+		writeString("SAVED BY IDOL!\n");
+		return;
+	}
+
+	sg._sleepTurns = randByte() & 0xF;
+}
+
 void OverworldLogic::killMonster(int slot) {
 	Data::Savegame &sg = _G(savegame);
 	Data::MapMonsters &monsters = _G(map)._monsters;
diff --git a/engines/ultima/ultima2/logic/overworld_logic.h b/engines/ultima/ultima2/logic/overworld_logic.h
index 292c6a42af1..ff63c4176eb 100644
--- a/engines/ultima/ultima2/logic/overworld_logic.h
+++ b/engines/ultima/ultima2/logic/overworld_logic.h
@@ -74,6 +74,28 @@ private:
 	 */
 	void minaxDeathSequence();
 
+	/**
+	 * A nearby Daemon paralyzes the player's legs, blocking movement until
+	 * it wears off, unless the boots resist it
+	 */
+	void legParalysisTrap();
+
+	/**
+	 * A nearby Devil paralyzes the player's arms, blocking attacks until
+	 * it wears off, unless the cloak resists it
+	 */
+	void armParalysisTrap();
+
+	/**
+	 * A nearby Mage fires a magic missile
+	 */
+	void magicMissileTrap();
+
+	/**
+	 * A nearby Balron puts the player to sleep, unless the idol resists it
+	 */
+	void sleepTrap();
+
 protected:
 	enum StepResult { STEP_OK, STEP_BLOCKED, STEP_DIED, STEP_MOONGATE };
 


Commit: d910e5a9aca6fc16ae0d7827a2739f73e98f6c6c
    https://github.com/scummvm/scummvm/commit/d910e5a9aca6fc16ae0d7827a2739f73e98f6c6c
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:40:58+11:00

Commit Message:
ULTIMA: ULTIMA2: Add Minax's proximity curse trap

Changed paths:
    engines/ultima/ultima2/logic/city_castle_logic.cpp
    engines/ultima/ultima2/logic/overworld_logic.cpp
    engines/ultima/ultima2/logic/overworld_logic.h


diff --git a/engines/ultima/ultima2/logic/city_castle_logic.cpp b/engines/ultima/ultima2/logic/city_castle_logic.cpp
index 366d91e7623..f3b3d154fcc 100644
--- a/engines/ultima/ultima2/logic/city_castle_logic.cpp
+++ b/engines/ultima/ultima2/logic/city_castle_logic.cpp
@@ -91,6 +91,15 @@ void CityCastleLogic::updateCreatures() {
 		if (!monsters.isActive(slot))
 			continue;
 
+		// Minax curses the player for 1 HP if she's nearby, whether she's
+		// still hostile or has already fled and gone permanently passive
+		if (monsters.tileType(slot) == Data::TILE_MINAX) {
+			int dx = sg._mapX - monsters._mapX[slot];
+			int dy = sg._mapY - monsters._mapY[slot];
+			if (ABS(dx) < 4 && ABS(dy) < 4 && minaxCurseTrap())
+				return;
+		}
+
 		int8 flag = (int8)monsters._offerFlag[slot];
 		if (flag <= 0)
 			continue; // at rest (0), or a shop/quest NPC (negative/high-bit) - never moves
diff --git a/engines/ultima/ultima2/logic/overworld_logic.cpp b/engines/ultima/ultima2/logic/overworld_logic.cpp
index 84733f2f125..fd8be32c7a9 100644
--- a/engines/ultima/ultima2/logic/overworld_logic.cpp
+++ b/engines/ultima/ultima2/logic/overworld_logic.cpp
@@ -645,6 +645,19 @@ void OverworldLogic::sleepTrap() {
 	sg._sleepTurns = randByte() & 0xF;
 }
 
+bool OverworldLogic::minaxCurseTrap() {
+	Data::Savegame &sg = _G(savegame);
+	writeString("MINAX CRIES: DIE FOOL!\n");
+	showAttackTile(sg._mapX, sg._mapY);
+
+	if (!sg.deductHP(1)) {
+		playerDied();
+		return true;
+	}
+
+	return false;
+}
+
 void OverworldLogic::killMonster(int slot) {
 	Data::Savegame &sg = _G(savegame);
 	Data::MapMonsters &monsters = _G(map)._monsters;
diff --git a/engines/ultima/ultima2/logic/overworld_logic.h b/engines/ultima/ultima2/logic/overworld_logic.h
index ff63c4176eb..fd8bafebb7a 100644
--- a/engines/ultima/ultima2/logic/overworld_logic.h
+++ b/engines/ultima/ultima2/logic/overworld_logic.h
@@ -97,6 +97,12 @@ private:
 	void sleepTrap();
 
 protected:
+	/**
+	 * A nearby Minax curses the player for 1 HP, active or fled, hostile or
+	 * not. Returns true if this killed the player
+	 */
+	bool minaxCurseTrap();
+
 	enum StepResult { STEP_OK, STEP_BLOCKED, STEP_DIED, STEP_MOONGATE };
 
 	/**


Commit: fd49674c8941b73028329a57e8a60d6d07265d95
    https://github.com/scummvm/scummvm/commit/fd49674c8941b73028329a57e8a60d6d07265d95
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:40:58+11:00

Commit Message:
ULTIMA: ULTIMA2: Fix monster slot 0 being untargetable

findTargetMonster's search loop excluded slot 0, a leftover of the
original using 0 as its own "not found" sentinel; the port's -1
sentinel makes that exclusion needless, so slot 0 (guards live there
in every settlement) could never be attacked, offered to, or fired on.

Changed paths:
    engines/ultima/ultima2/logic/overworld_logic.cpp


diff --git a/engines/ultima/ultima2/logic/overworld_logic.cpp b/engines/ultima/ultima2/logic/overworld_logic.cpp
index fd8be32c7a9..d54a9e68ade 100644
--- a/engines/ultima/ultima2/logic/overworld_logic.cpp
+++ b/engines/ultima/ultima2/logic/overworld_logic.cpp
@@ -249,7 +249,7 @@ int OverworldLogic::signByte(int v) const {
 
 int OverworldLogic::findTargetMonster(int x, int y) const {
 	Data::MapMonsters &monsters = _G(map)._monsters;
-	for (int slot = 31; slot >= 1; --slot) {
+	for (int slot = 31; slot >= 0; --slot) {
 		if (monsters.isActive(slot) && monsters._mapX[slot] == x && monsters._mapY[slot] == y)
 			return slot;
 	}


Commit: 8844cc56c9c67180f539766f47a69f610be8d097
    https://github.com/scummvm/scummvm/commit/8844cc56c9c67180f539766f47a69f610be8d097
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:40:58+11:00

Commit Message:
ULTIMA: ULTIMA2: Fix unlock only checking east/west and giving no feedback

The original reads only _circleDeltaX and ignores _circleDeltaY, so a
door directly above/below the player could never be unlocked, and a
successful unlock printed nothing at all.

Changed paths:
    engines/ultima/ultima2/logic/city_castle_logic.cpp


diff --git a/engines/ultima/ultima2/logic/city_castle_logic.cpp b/engines/ultima/ultima2/logic/city_castle_logic.cpp
index f3b3d154fcc..7abf31fc6b1 100644
--- a/engines/ultima/ultima2/logic/city_castle_logic.cpp
+++ b/engines/ultima/ultima2/logic/city_castle_logic.cpp
@@ -260,11 +260,19 @@ bool CityCastleLogic::unlock(Data::Direction dir) {
 		return false;
 	}
 
-	// The original only looks east or west of the player for a door
 	Data::Savegame &sg = _G(savegame);
-	int x = sg._mapX + (dir == Data::DIR_LEFT ? -1 : dir == Data::DIR_RIGHT ? 1 : 0);
-	if (x == sg._mapX || x < 0 || x >= Data::MAP_WIDTH ||
-			_G(map).tileAt(x, sg._mapY) != Data::TILE_I_DOOR) {
+	int dx = 0, dy = 0;
+	switch (dir) {
+	case Data::DIR_UP: dy = -1; break;
+	case Data::DIR_DOWN: dy = 1; break;
+	case Data::DIR_LEFT: dx = -1; break;
+	case Data::DIR_RIGHT: dx = 1; break;
+	default: break;
+	}
+
+	int x = sg._mapX + dx, y = sg._mapY + dy;
+	if (x < 0 || x >= Data::MAP_WIDTH || y < 0 || y >= Data::MAP_HEIGHT ||
+			_G(map).tileAt(x, y) != Data::TILE_I_DOOR) {
 		writeString("\nNO DOOR THERE!\n");
 		return true;
 	}
@@ -276,8 +284,8 @@ bool CityCastleLogic::unlock(Data::Direction dir) {
 
 	--sg._keys;
 	// The door is replaced by the tile the player is standing on
-	_G(map)._tiles[sg._mapY][x] = _G(map).tileAt(sg._mapX, sg._mapY);
-	writeString("\n");
+	_G(map)._tiles[y][x] = _G(map).tileAt(sg._mapX, sg._mapY);
+	writeString("\nDOOR UNLOCKED!\n");
 	return true;
 }
 


Commit: 251016fd4d8e8d8f206d18b7d4c6cc1c5b2ec765
    https://github.com/scummvm/scummvm/commit/251016fd4d8e8d8f206d18b7d4c6cc1c5b2ec765
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:40:58+11:00

Commit Message:
ULTIMA: ULTIMA2: Fix dungeon melee target search giving up early

The original's search aborted as soon as any checked field (X, Y, or
level) happened to read zero for a non-matching slot, treating that
as "no more monsters" even when a real target sat in a lower slot.

Changed paths:
    engines/ultima/ultima2/logic/dungeon_logic.cpp


diff --git a/engines/ultima/ultima2/logic/dungeon_logic.cpp b/engines/ultima/ultima2/logic/dungeon_logic.cpp
index b536dc0be6a..45dd4abdaa5 100644
--- a/engines/ultima/ultima2/logic/dungeon_logic.cpp
+++ b/engines/ultima/ultima2/logic/dungeon_logic.cpp
@@ -283,28 +283,16 @@ bool DungeonLogic::attack(Data::Direction dir) {
 		return true;
 	}
 
-	// The search for the monster gives up at the first empty slot it meets
-	int slot = 31, last;
-	bool found = false;
-	while (slot >= 0) {
-		last = monsters._mapX[slot];
-		if (last == x) {
-			last = monsters._mapY[slot];
-			if (last == y) {
-				last = monsters._glyphTile[slot];
-				if (last == sg._dungeonLevel) {
-					found = true;
-					break;
-				}
-			}
-		}
-
-		--slot;
-		if (last == 0)
+	int slot = -1;
+	for (int i = 31; i >= 0; --i) {
+		if (monsters.isActive(i) && monsters._mapX[i] == x && monsters._mapY[i] == y &&
+				monsters._glyphTile[i] == sg._dungeonLevel) {
+			slot = i;
 			break;
+		}
 	}
 
-	if (!found || (randByte() >> 1) >= sg._agility) {
+	if (slot < 0 || (randByte() >> 1) >= sg._agility) {
 		writeString("MISS\n");
 		return true;
 	}


Commit: fb7d590f1b403347fa94098ec0cd345f90307766
    https://github.com/scummvm/scummvm/commit/fb7d590f1b403347fa94098ec0cd345f90307766
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:40:58+11:00

Commit Message:
ULTIMA: ULTIMA2: Unify dungeon combat HP subtraction with the overworld idiom

Dungeon melee, magic missile, and monster-attacks-player damage each
used a slightly different literal-asm kill threshold (some killing at
hp<dmg with no survive penalty, Magic Missile's threshold flipping on
an unrelated carry bit), instead of the hp<=dmg/cost dmg+1 rule
already established for overworld combat via Savegame::deductHP().

Changed paths:
    engines/ultima/ultima2/logic/dungeon_logic.cpp


diff --git a/engines/ultima/ultima2/logic/dungeon_logic.cpp b/engines/ultima/ultima2/logic/dungeon_logic.cpp
index 45dd4abdaa5..4e5a3bd76cb 100644
--- a/engines/ultima/ultima2/logic/dungeon_logic.cpp
+++ b/engines/ultima/ultima2/logic/dungeon_logic.cpp
@@ -302,10 +302,11 @@ bool DungeonLogic::attack(Data::Direction dir) {
 	int dmg = (sg._readiedWeapon * 8 + sg._strength) >> 2;
 	byte &hp = monsters._spellHP[slot];
 
-	if (hp < dmg) {
+	if (hp <= dmg) {
+		hp = 0;
 		killMonster(slot);
 	} else {
-		hp -= dmg;
+		hp -= dmg + 1;
 		writeString("\n");
 	}
 
@@ -371,13 +372,11 @@ bool DungeonLogic::castSpell(Data::SpellType spell) {
 			int exp = Data::toBcd((sg._experience / 100) % 100);
 			int sum = exp + exp;
 			int carry = sum >> 8;
-			sum = (sum & 0xFF) + 0x1E + carry;
-			int dmg = sum & 0xFF;
-			int borrow = (sum >> 8) ? 0 : 1;
+			int dmg = ((sum & 0xFF) + 0x1E + carry) & 0xFF;
 
 			byte &hp = monsters._spellHP[slot];
-			if (hp >= dmg + borrow) {
-				hp -= dmg + borrow;
+			if (hp > dmg) {
+				hp -= dmg + 1;
 				writeString("\n");
 				return true;
 			}
@@ -485,13 +484,11 @@ bool DungeonLogic::monsterAttacks(int slot) {
 
 	showAttackTile(0, 0);
 	int dmg = Data::bcdValue((byte)((randByte() & 0x77) + ((level * 4) & 0x77)));
-	if (sg._hp < dmg) {
-		sg._hp = 0;
+	if (!sg.deductHP(dmg)) {
 		playerDied();
 		return false;
 	}
 
-	sg._hp -= dmg;
 	return true;
 }
 


Commit: 26eca541549cb23d686d81c1d00c3c301a6992fb
    https://github.com/scummvm/scummvm/commit/26eca541549cb23d686d81c1d00c3c301a6992fb
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:40:58+11:00

Commit Message:
ULTIMA: ULTIMA2: Fix movement messages running together on one line

Field/ring damage text had no trailing newline, so a move blocked
right after showed "FIELD CAUSES 1000 DAMAGE!--INVALID MOVE!" on one
line; a paralyzed move also got a redundant "--INVALID MOVE!" tacked on

Changed paths:
    engines/ultima/ultima2/logic/city_castle_logic.cpp
    engines/ultima/ultima2/logic/overworld_logic.cpp
    engines/ultima/ultima2/logic/overworld_logic.h


diff --git a/engines/ultima/ultima2/logic/city_castle_logic.cpp b/engines/ultima/ultima2/logic/city_castle_logic.cpp
index 7abf31fc6b1..37ef9fcfb0a 100644
--- a/engines/ultima/ultima2/logic/city_castle_logic.cpp
+++ b/engines/ultima/ultima2/logic/city_castle_logic.cpp
@@ -56,10 +56,9 @@ bool CityCastleLogic::move(Data::Direction dir) {
 	}
 
 	playFX(Data::SFX_STEP);
-	writeString("%s", dirName);
+	writeString("%s\n", dirName);
 
 	if (newX < 0 || newX >= Data::MAP_WIDTH || newY < 0 || newY >= Data::MAP_HEIGHT) {
-		writeString("\n");
 		exitToOverworld();
 		return true;
 	}
@@ -67,6 +66,8 @@ bool CityCastleLogic::move(Data::Direction dir) {
 	switch (stepOnto(newX, newY)) {
 	case STEP_DIED:
 		return false;
+	case STEP_PARALYZED:
+		return true;
 	case STEP_BLOCKED:
 		writeString("--INVALID MOVE!\n");
 		return true;
@@ -74,7 +75,6 @@ bool CityCastleLogic::move(Data::Direction dir) {
 		break;
 	}
 
-	writeString("\n");
 	sg._mapX = newX;
 	sg._mapY = newY;
 	_monstersSkipTurn = !_monstersSkipTurn;
diff --git a/engines/ultima/ultima2/logic/overworld_logic.cpp b/engines/ultima/ultima2/logic/overworld_logic.cpp
index d54a9e68ade..0915517e101 100644
--- a/engines/ultima/ultima2/logic/overworld_logic.cpp
+++ b/engines/ultima/ultima2/logic/overworld_logic.cpp
@@ -103,9 +103,9 @@ OverworldLogic::StepResult OverworldLogic::stepOnto(int x, int y) {
 		}
 	} else if (dest == Data::TILE_FORCEFIELD) {
 		if (sg._items[Data::ITEM_RING] != 0) {
-			writeString("\nRING PROTECTS FROM FIELD!");
+			writeString("RING PROTECTS FROM FIELD!\n");
 		} else {
-			writeString("\nFIELD CAUSES 1000 DAMAGE!");
+			writeString("FIELD CAUSES 1000 DAMAGE!\n");
 			if (!sg.deductHP(1000)) {
 				playerDied();
 				return STEP_DIED;
@@ -115,7 +115,7 @@ OverworldLogic::StepResult OverworldLogic::stepOnto(int x, int y) {
 
 	if (sg._legParalysisTurns > 0) {
 		writeString("--PARALIZED!\n");
-		return STEP_BLOCKED;
+		return STEP_PARALYZED;
 	}
 
 	if (sg._mapType == 0 && dest == Data::TILE_MOONGATE &&
@@ -174,23 +174,23 @@ bool OverworldLogic::move(Data::Direction dir) {
 	}
 
 	playFX(Data::SFX_STEP);
-	writeString("%s", dirName);
+	writeString("%s\n", dirName);
 
 	switch (stepOnto(newX, newY)) {
 	case STEP_DIED:
 		return false;
+	case STEP_PARALYZED:
+		return true;
 	case STEP_BLOCKED:
 		writeString("--INVALID MOVE!\n");
 		return true;
 	case STEP_MOONGATE:
-		writeString("\n");
 		enterMoongate(newX, newY);
 		return true;
 	default:
 		break;
 	}
 
-	writeString("\n");
 	sg._mapX = newX;
 	sg._mapY = newY;
 	_monstersSkipTurn = !_monstersSkipTurn;
diff --git a/engines/ultima/ultima2/logic/overworld_logic.h b/engines/ultima/ultima2/logic/overworld_logic.h
index fd8bafebb7a..78e6e8e42c6 100644
--- a/engines/ultima/ultima2/logic/overworld_logic.h
+++ b/engines/ultima/ultima2/logic/overworld_logic.h
@@ -103,7 +103,10 @@ protected:
 	 */
 	bool minaxCurseTrap();
 
-	enum StepResult { STEP_OK, STEP_BLOCKED, STEP_DIED, STEP_MOONGATE };
+	// STEP_BLOCKED prints no message of its own - the caller shows a
+	// generic "--INVALID MOVE!". STEP_PARALYZED already printed its own
+	// complete message, so the caller adds nothing further
+	enum StepResult { STEP_OK, STEP_BLOCKED, STEP_PARALYZED, STEP_DIED, STEP_MOONGATE };
 
 	/**
 	 * Applies the terrain damage, food cost and mount rules for stepping


Commit: f415af2f49b4fbd7a220558dc6159432e512ba49
    https://github.com/scummvm/scummvm/commit/f415af2f49b4fbd7a220558dc6159432e512ba49
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:40:58+11:00

Commit Message:
ULTIMA: ULTIMA2: Remove deprecated shared TextInput class

Changed paths:
  R engines/ultima/shared/gfx/text_input.cpp
  R engines/ultima/shared/gfx/text_input.h
    engines/ultima/module.mk


diff --git a/engines/ultima/module.mk b/engines/ultima/module.mk
index dbc930b1396..ca1513d6431 100644
--- a/engines/ultima/module.mk
+++ b/engines/ultima/module.mk
@@ -7,7 +7,6 @@ MODULE_OBJS := \
 	shared/engine/events.o \
 	shared/engine/messages.o \
 	shared/gfx/gfx_surface.o \
-	shared/gfx/text_input.o \
 	shared/gfx/view.o
 
 ifdef ENABLE_AKALABETH
diff --git a/engines/ultima/shared/gfx/text_input.cpp b/engines/ultima/shared/gfx/text_input.cpp
deleted file mode 100644
index 150ecac6139..00000000000
--- a/engines/ultima/shared/gfx/text_input.cpp
+++ /dev/null
@@ -1,134 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-#include "ultima/shared/gfx/text_input.h"
-#include "ultima/shared/gfx/rect.h"
-
-namespace Ultima {
-namespace Shared {
-namespace Gfx {
-
-#define DELAY_FRAMES 2
-
-TextInput::TextInput(const Common::String &name, UIElement *parent) : UIElement(name, parent) {
-}
-
-TextInput::TextInput(const Common::String &name, UIElement *parent, const Common::Point &pos,
-	int maxChars, bool isNumeric) : UIElement(name, parent) {
-	setBounds(TextRect(pos.x, pos.y, pos.x + maxChars - 1, pos.y));
-	_isNumeric = isNumeric;
-}
-
-
-void TextInput::clear() {
-	_text.clear();
-	redraw();
-}
-
-void TextInput::show(const Common::Point &pos, int maxChars, bool isNumeric) {
-	setBounds(TextRect(pos.x, pos.y, pos.x + maxChars, pos.y + 1));
-	_isNumeric = isNumeric;
-	show();
-}
-
-void TextInput::show() {
-	// Set to visible, and start timer for blinking the cursor
-	_visible = true;
-	_text.clear();
-	delayFrames(DELAY_FRAMES);
-	redraw();
-}
-
-void TextInput::hide() {
-	// Hide the text input
-	_visible = false;
-	cancelDelay();
-	redraw();
-}
-
-void TextInput::setTextPos(const Common::Point &pt) {
-	setBounds(TextRect(pt.x, pt.y, pt.x, pt.y));
-}
-
-void TextInput::draw() {
-	auto s = getSurface();
-
-	if (_visible) {
-		s.clear();
-		s.writeString(_text);
-
-		if (_caretVisible)
-			s.writeChar('_');
-	}
-}
-
-bool TextInput::msgFocus(const FocusMessage &msg) {
-	_text.clear();
-	return true;
-}
-
-bool TextInput::msgUnfocus(const UnfocusMessage &msg) {
-	hide();
-	return true;
-}
-
-bool TextInput::msgKeypress(const KeypressMessage &msg) {
-	if (Common::isPrint(msg.ascii)) {
-		// Printable character
-		if (!_isNumeric || Common::isDigit(msg.keycode)) {
-			_text += toupper(msg.ascii);
-
-			auto s = getSurface();
-			if (s.getStringWidth(_text) >= _bounds.width())
-				_parent->send(GameMessage("INPUT", _text));
-
-			redraw();
-		}
-
-		return true;
-
-	} else if (msg.keycode == Common::KEYCODE_BACKSPACE || msg.keycode == Common::KEYCODE_DELETE) {
-		if (!_text.empty()) {
-			_text.deleteLastChar();
-			redraw();
-		}
-		return true;
-
-	} else if (msg.keycode == Common::KEYCODE_RETURN || msg.keycode == Common::KEYCODE_KP_ENTER) {
-		_parent->send(GameMessage("INPUT", _text));
-		return true;
-	}
-
-	return false;
-}
-
-void TextInput::timeout() {
-	// Keep the cursor caret blinking
-	if (_visible) {
-		_caretVisible = !_caretVisible;
-		redraw();
-		delayFrames(DELAY_FRAMES);
-	}
-}
-
-} // namespace Gfx
-} // namespace Shared
-} // namespace Ultima
diff --git a/engines/ultima/shared/gfx/text_input.h b/engines/ultima/shared/gfx/text_input.h
deleted file mode 100644
index cac4e6c2e83..00000000000
--- a/engines/ultima/shared/gfx/text_input.h
+++ /dev/null
@@ -1,62 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-#ifndef ULTIMA_SHARED_GFX_TEXT_INPUT_H
-#define ULTIMA_SHARED_GFX_TEXT_INPUT_H
-
-#include "ultima/shared/engine/events.h"
-
-namespace Ultima {
-namespace Shared {
-namespace Gfx {
-
-class TextInput : public Shared::UIElement {
-private:
-	Common::String _text;
-	bool _isNumeric = false;
-	bool _visible = false;
-	bool _caretVisible = false;
-
-public:
-	TextInput(const Common::String &name, UIElement *parent = nullptr);
-	TextInput(const Common::String &name, UIElement *parent, const Common::Point &pos,
-		int maxChars, bool isNumeric = false);
-	~TextInput() override {
-	}
-
-	void draw() override;
-	bool msgKeypress(const KeypressMessage &msg) override;
-	void timeout() override;
-	bool msgFocus(const FocusMessage &msg) override;
-	bool msgUnfocus(const UnfocusMessage &msg) override;
-
-	void show(const Common::Point &pos, int maxChars, bool isNumeric = false);
-	void show();
-	void hide();
-	void clear();
-	void setTextPos(const Common::Point &pt);
-};
-
-} // namespace Gfx
-} // namespace Shared
-} // namespace Ultima
-
-#endif


Commit: c98e7c899038c38fab5082c205d85c9fd60bbb0f
    https://github.com/scummvm/scummvm/commit/c98e7c899038c38fab5082c205d85c9fd60bbb0f
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:40:58+11:00

Commit Message:
ULTIMA: ULTIMA2: Fixes to ZStats screen

Changed paths:
    engines/ultima/ultima2/views/zstats.cpp
    engines/ultima/ultima2/views/zstats.h


diff --git a/engines/ultima/ultima2/views/zstats.cpp b/engines/ultima/ultima2/views/zstats.cpp
index b15c6d7f463..8edfe5ebf30 100644
--- a/engines/ultima/ultima2/views/zstats.cpp
+++ b/engines/ultima/ultima2/views/zstats.cpp
@@ -68,6 +68,16 @@ ZStats::ZStats() : View("ZStats") {
 	setBounds(TextRect(0, 0, 39, 24));
 }
 
+bool ZStats::msgFocus(const FocusMessage &msg) {
+	// Clear the entire screen
+	setBounds(TextRect(0, 0, 39, 24));
+	getSurface().clear();
+
+	// Set up a slightly reduced bounds to exclude columns 0 and 39
+	setBounds(TextRect(1, 0, 38, 24));
+	return Shared::Gfx::View::msgFocus(msg);
+}
+
 void ZStats::draw() {
 	auto s = getSurface();
 	s.clear();
@@ -85,22 +95,22 @@ void ZStats::draw() {
 	s.writeString(Common::Point(2, 5), "ARMOUR-%s", armorName(sg._readiedArmor));
 	s.writeString(Common::Point(2, 6), " SPELL-%s", spellName(sg._readiedSpell));
 
-	s.writeString(Common::Point(39, 4), Common::String::format("TORCHES-%.2d", sg._torches), Graphics::kTextAlignRight);
-	s.writeString(Common::Point(39, 5), Common::String::format("KEYS-%.2d", sg._keys), Graphics::kTextAlignRight);
-	s.writeString(Common::Point(39, 6), Common::String::format("TOOLS-%.2d", sg._thievesTools), Graphics::kTextAlignRight);
+	s.writeString(Common::Point(38, 4), Common::String::format("TORCHES-%.2d", sg._torches), Graphics::kTextAlignRight);
+	s.writeString(Common::Point(38, 5), Common::String::format("KEYS-%.2d", sg._keys), Graphics::kTextAlignRight);
+	s.writeString(Common::Point(38, 6), Common::String::format("TOOLS-%.2d", sg._thievesTools), Graphics::kTextAlignRight);
 
 	s.writeString(Common::Point(0, 7), "STRENGTH-%.2d", sg._strength);
 	s.writeString(Common::Point(14, 7), " STAMINA-%.2d", sg._stamina);
-	s.writeString(Common::Point(29, 7), " WISDOM-%.2d", sg._wisdom);
+	s.writeString(Common::Point(38, 7), Common::String::format(" WISDOM-%.2d", sg._wisdom), Graphics::kTextAlignRight);
 	s.writeString(Common::Point(0, 8), " AGILITY-%.2d", sg._agility);
 	s.writeString(Common::Point(14, 8), "CHARISMA-%.2d", sg._charisma);
-	s.writeString(Common::Point(29, 8), "INTELL.-%.2d", sg._intelligence);
+	s.writeString(Common::Point(38, 8), Common::String::format("INTELL.-%.2d", sg._intelligence), Graphics::kTextAlignRight);
 
 	int row = 10;
 	Common::String line = "WEAPONS: ";
 	for (int i = 0; i < Data::WEAPON_COUNT; ++i) {
 		if (sg._weaponOwned[i] != 0)
-			line += Common::String::format("%sS-%d ", weaponName((Data::WeaponType)i), sg._weaponOwned[i]);
+			line += Common::String::format("%sS-%.2d ", weaponName((Data::WeaponType)i), sg._weaponOwned[i]);
 	}
 	s.writeString(Common::Point(0, row), line);
 	row += 3; // two blank rows below WEAPONS
@@ -108,7 +118,7 @@ void ZStats::draw() {
 	line = "ARMOUR: ";
 	for (int i = 0; i < Data::ARMOR_COUNT; ++i) {
 		if (sg._armorOwned[i] != 0)
-			line += Common::String::format("%s-%d ", armorName((Data::ArmorType)i), sg._armorOwned[i]);
+			line += Common::String::format("%s-%.2d ", armorName((Data::ArmorType)i), sg._armorOwned[i]);
 	}
 	s.writeString(Common::Point(0, row), line);
 	row += 2; // one blank row below ARMOUR
@@ -116,7 +126,7 @@ void ZStats::draw() {
 	line = "SPELLS: ";
 	for (int i = 0; i < Data::SPELL_COUNT; ++i) {
 		if (sg._spellCharges[i] != 0)
-			line += Common::String::format("%sS-%d ", spellName((Data::SpellType)i), sg._spellCharges[i]);
+			line += Common::String::format("%sS-%.2d ", spellName((Data::SpellType)i), sg._spellCharges[i]);
 	}
 	s.writeString(Common::Point(0, row), line);
 	row += 3; // two blank rows below SPELLS
@@ -124,7 +134,7 @@ void ZStats::draw() {
 	line = "ITEMS: ";
 	for (int i = 0; i < Data::ITEM_COUNT; ++i) {
 		if (sg._items[i] != 0) {
-			line += Common::String::format("%s%s-%d ", itemName(i),
+			line += Common::String::format("%s%s-%.2d ", itemName(i),
 				i == Data::ITEM_BOOTS ? "" : "S", sg._items[i]);
 		}
 	}
diff --git a/engines/ultima/ultima2/views/zstats.h b/engines/ultima/ultima2/views/zstats.h
index 437b42bbaab..96455f27755 100644
--- a/engines/ultima/ultima2/views/zstats.h
+++ b/engines/ultima/ultima2/views/zstats.h
@@ -39,6 +39,7 @@ public:
 	ZStats();
 	~ZStats() override {}
 
+	bool msgFocus(const FocusMessage &msg) override;
 	void draw() override;
 	bool msgKeypress(const KeypressMessage &msg) override;
 };


Commit: acf4a95d37862e128788e0e5676cc85040a3232b
    https://github.com/scummvm/scummvm/commit/acf4a95d37862e128788e0e5676cc85040a3232b
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:40:58+11:00

Commit Message:
ULTIMA: ULTIMA2: Fix PLAYER export offsets for readied gear and torches/keys

Changed paths:
    engines/ultima/ultima2/data/savegame.cpp


diff --git a/engines/ultima/ultima2/data/savegame.cpp b/engines/ultima/ultima2/data/savegame.cpp
index ebb10708ca6..512dc62af20 100644
--- a/engines/ultima/ultima2/data/savegame.cpp
+++ b/engines/ultima/ultima2/data/savegame.cpp
@@ -126,14 +126,8 @@ void Savegame::synchronize(Common::Serializer &s) {
 
 namespace {
 
-// Byte offsets into the original 256-byte PLAYER struct. Most of these are
-// confirmed directly from the disassembly's own struct definition; a few
-// small gaps between them were only ever described in prose and turned
-// out to be one byte short - re-measured here against a real captured
-// PLAYER file (every attribute/resource decodes to a plausible value,
-// and the gap sizes below place them so that mapX/mapY, and the later
-// _disableSave field the disassembly does give an exact offset for, both
-// land in exactly the right place)
+// Byte offsets into the original 256-byte PLAYER struct, verified against a
+// real ScummVM -> PLAYER -> DOSBox round-trip
 enum {
 	OFS_NAME = 0x00,
 	OFS_SEX = 0x10,
@@ -154,13 +148,15 @@ enum {
 	OFS_GOLD = 0x22,        // 2 bytes
 	OFS_MAP_X = 0x24,
 	OFS_MAP_Y = 0x25,
-	OFS_READIED_WEAPON = 0x2A,
-	OFS_READIED_ARMOR = 0x2B,
-	OFS_READIED_SPELL = 0x2C,
-	OFS_TORCHES = 0x2D,
-	OFS_KEYS = 0x2E,
-	OFS_THIEVES_TOOLS = 0x2F,
-	OFS_IN_SPACE = 0x30,
+	// 0x26-0x2A unused
+	OFS_READIED_WEAPON = 0x2B,
+	OFS_READIED_ARMOR = 0x2C,
+	OFS_READIED_SPELL = 0x2D,
+	OFS_TORCHES = 0x2E,
+	OFS_KEYS = 0x2F,
+	OFS_THIEVES_TOOLS = 0x30,
+	// 0x31-0x32 unused
+	OFS_IN_SPACE = 0x33,
 	OFS_LAUNCH_MAP_X = 0x34,
 	OFS_LAUNCH_MAP_Y = 0x35,
 	OFS_RING_QUEST_FLAG = 0x36,


Commit: 38f81905493f166284111bc9c33252f14fa37ec7
    https://github.com/scummvm/scummvm/commit/38f81905493f166284111bc9c33252f14fa37ec7
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:40:58+11:00

Commit Message:
ULTIMA: ULTIMA2: Fix child bounds to be relative to the parent

This fixes placement of text cursor in ZStats window

Changed paths:
    engines/ultima/shared/engine/events.cpp
    engines/ultima/shared/engine/events.h
    engines/ultima/ultima2/views/zstats.cpp
    engines/ultima/ultima2/views/zstats.h


diff --git a/engines/ultima/shared/engine/events.cpp b/engines/ultima/shared/engine/events.cpp
index 6d33eacf70f..2797ffca842 100644
--- a/engines/ultima/shared/engine/events.cpp
+++ b/engines/ultima/shared/engine/events.cpp
@@ -360,6 +360,32 @@ int UIElement::getRandomNumber(int maxNumber) {
 	return g_events->getRandomNumber(maxNumber);
 }
 
+void UIElement::setBounds(const Common::Rect &r) {
+	// If the element has any children, convert the screen bounds to relative bounds against our old bounds
+	Common::Array<Common::Rect> oldBounds;
+	oldBounds.reserve(_children.size());
+	for (const UIElement *child : _children) {
+		Common::Rect childRect = child->getBounds();
+		childRect.translate(-_bounds.left, -_bounds.top);
+		oldBounds.push_back(childRect);
+	}
+
+	// Set the new bounds. If we have a parent, it's relative to that
+	if (_parent) {
+		Common::Rect temp = r;
+		temp.translate(_parent->_bounds.left, _parent->_bounds.top);
+		temp.constrain(_parent->_bounds);
+		_bounds = temp;
+	} else {
+		_bounds = r;
+	}
+
+	// Reset the bounds of any children. Since setBounds sets relative to the parent,
+	// this will set them relative to the new bounds we set
+	for (uint i = 0; i < _children.size(); ++i)
+		_children[i]->setBounds(oldBounds[i]);
+}
+
 void UIElement::delaySeconds(uint seconds) {
 	_timeoutCtr = seconds * FRAME_RATE;
 }
diff --git a/engines/ultima/shared/engine/events.h b/engines/ultima/shared/engine/events.h
index 54725c8211b..57ed22b0f70 100644
--- a/engines/ultima/shared/engine/events.h
+++ b/engines/ultima/shared/engine/events.h
@@ -203,10 +203,7 @@ public:
 	/**
 	 * Sets the element's bounds
 	 */
-	virtual void setBounds(const Common::Rect &r) {
-		_bounds = r;
-	}
-
+	virtual void setBounds(const Common::Rect &r);
 	/**
 	 * Gets the element's bounds
 	 */
diff --git a/engines/ultima/ultima2/views/zstats.cpp b/engines/ultima/ultima2/views/zstats.cpp
index 8edfe5ebf30..3096de9a384 100644
--- a/engines/ultima/ultima2/views/zstats.cpp
+++ b/engines/ultima/ultima2/views/zstats.cpp
@@ -139,6 +139,10 @@ void ZStats::draw() {
 		}
 	}
 	s.writeString(Common::Point(0, row), line);
+
+	// Show the blinking cursor
+	_textCursor.setPosition(s.getTextPos());
+	_textCursor.show();
 }
 
 bool ZStats::msgKeypress(const KeypressMessage &msg) {
diff --git a/engines/ultima/ultima2/views/zstats.h b/engines/ultima/ultima2/views/zstats.h
index 96455f27755..ab1857eca45 100644
--- a/engines/ultima/ultima2/views/zstats.h
+++ b/engines/ultima/ultima2/views/zstats.h
@@ -23,6 +23,7 @@
 #define ULTIMA2_VIEWS_ZSTATS_H
 
 #include "ultima/shared/gfx/view.h"
+#include "ultima/ultima2/gfx/text_cursor.h"
 
 namespace Ultima {
 namespace Ultima2 {
@@ -35,6 +36,9 @@ using namespace Shared::Messages;
  * keypress.
  */
 class ZStats : public Shared::Gfx::View {
+private:
+	Gfx::TextCursor _textCursor = Gfx::TextCursor("ZStatsCursor", this);
+
 public:
 	ZStats();
 	~ZStats() override {}


Commit: 046d2da73f72dfcc0ce59bc774b589ccd91aab11
    https://github.com/scummvm/scummvm/commit/046d2da73f72dfcc0ce59bc774b589ccd91aab11
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:40:58+11:00

Commit Message:
ULTIMA: ULTIMA2: Fixes and cleanup for the magic helm view map

Changed paths:
  A engines/ultima/ultima2/views/helm_map.cpp
  A engines/ultima/ultima2/views/helm_map.h
  R engines/ultima/ultima2/views/world_map_overview.cpp
  R engines/ultima/ultima2/views/world_map_overview.h
    engines/ultima/module.mk
    engines/ultima/ultima2/logic/logic.cpp
    engines/ultima/ultima2/views/views.h


diff --git a/engines/ultima/module.mk b/engines/ultima/module.mk
index ca1513d6431..2f9751a688c 100644
--- a/engines/ultima/module.mk
+++ b/engines/ultima/module.mk
@@ -128,6 +128,7 @@ MODULE_OBJS += \
 	ultima2/views/dungeon_map.o \
 	ultima2/views/ending.o \
 	ultima2/views/game.o \
+	ultima2/views/helm_map.o \
 	ultima2/views/location_map.o \
 	ultima2/views/map.o \
 	ultima2/views/overworld_map.o \
@@ -136,7 +137,6 @@ MODULE_OBJS += \
 	ultima2/views/startup.o \
 	ultima2/views/stats.o \
 	ultima2/views/title.o \
-	ultima2/views/world_map_overview.o \
 	ultima2/views/zstats.o \
 	ultima2/views/interactions/interaction.o \
 	ultima2/views/interactions/clue_seller.o \
diff --git a/engines/ultima/ultima2/logic/logic.cpp b/engines/ultima/ultima2/logic/logic.cpp
index 08211f3e8e6..7525352e6af 100644
--- a/engines/ultima/ultima2/logic/logic.cpp
+++ b/engines/ultima/ultima2/logic/logic.cpp
@@ -606,7 +606,7 @@ bool Logic::view() {
 
 	writeString("VIEW\nWITH MAGICAL HELM!\n");
 	--sg._items[Data::ITEM_HELM];
-	g_engine->addView("WorldMapOverview");
+	g_engine->addView("HelmMap");
 	return false;
 }
 
diff --git a/engines/ultima/ultima2/views/world_map_overview.cpp b/engines/ultima/ultima2/views/helm_map.cpp
similarity index 88%
rename from engines/ultima/ultima2/views/world_map_overview.cpp
rename to engines/ultima/ultima2/views/helm_map.cpp
index 143267915cc..a23c81f3177 100644
--- a/engines/ultima/ultima2/views/world_map_overview.cpp
+++ b/engines/ultima/ultima2/views/helm_map.cpp
@@ -19,7 +19,7 @@
  *
  */
 
-#include "ultima/ultima2/views/world_map_overview.h"
+#include "ultima/ultima2/views/helm_map.h"
 #include "ultima/ultima2/data/map.h"
 #include "ultima/ultima2/ultima2.h"
 
@@ -38,11 +38,11 @@ static const Common::Point ICON_SWAMP[] = { {0, 1}, {3, 1} };
 static const Common::Point ICON_ROAD[] = { {0, 0}, {3, 0}, {0, 1}, {3, 1} };
 static const Common::Point ICON_OTHER[] = { {1, 0}, {2, 0}, {1, 1}, {2, 1} };
 
-WorldMapOverview::WorldMapOverview() : View("WorldMapOverview") {
-	setBounds(TextRect(0, 0, 39, 24));
+HelmMap::HelmMap() : Shared::Gfx::View("HelmMap") {
+	setBounds(TextRect(0, 0, 39, 19));
 }
 
-void WorldMapOverview::plotIcon(Shared::Gfx::GfxSurface &s, int cellX, int cellY, Data::TileId tile) {
+void HelmMap::plotIcon(Shared::Gfx::GfxSurface &s, int cellX, int cellY, Data::TileId tile) {
 	const Common::Point *points;
 	int count;
 
@@ -73,7 +73,7 @@ void WorldMapOverview::plotIcon(Shared::Gfx::GfxSurface &s, int cellX, int cellY
 		s.setPixel(px + points[i].x, py + points[i].y, COLOR_ICON);
 }
 
-void WorldMapOverview::draw() {
+void HelmMap::draw() {
 	auto s = getSurface();
 	s.clear();
 
@@ -83,7 +83,7 @@ void WorldMapOverview::draw() {
 	}
 }
 
-bool WorldMapOverview::msgKeypress(const KeypressMessage &msg) {
+bool HelmMap::msgKeypress(const KeypressMessage &msg) {
 	close();
 	_G(logic)->resumeTurn();
 	return true;
diff --git a/engines/ultima/ultima2/views/world_map_overview.h b/engines/ultima/ultima2/views/helm_map.h
similarity index 87%
rename from engines/ultima/ultima2/views/world_map_overview.h
rename to engines/ultima/ultima2/views/helm_map.h
index 39c4f6c6594..a7de1a36912 100644
--- a/engines/ultima/ultima2/views/world_map_overview.h
+++ b/engines/ultima/ultima2/views/helm_map.h
@@ -19,8 +19,8 @@
  *
  */
 
-#ifndef ULTIMA2_VIEWS_WORLD_MAP_OVERVIEW_H
-#define ULTIMA2_VIEWS_WORLD_MAP_OVERVIEW_H
+#ifndef ULTIMA2_VIEWS_HELM_MAP_H
+#define ULTIMA2_VIEWS_HELM_MAP_H
 
 #include "ultima/shared/gfx/view.h"
 #include "ultima/ultima2/data/tiles.h"
@@ -32,16 +32,16 @@ namespace Views {
 using namespace Shared::Messages;
 
 /**
- * The "view" command's full-map overview, shown as a small icon per world
+ * The "view" command's full-map overview, shown as a small icon per world/location
  * cell. Closes and resumes the turn on any keypress.
  */
-class WorldMapOverview : public Shared::Gfx::View {
+class HelmMap : public Shared::Gfx::View {
 private:
 	void plotIcon(Shared::Gfx::GfxSurface &s, int cellX, int cellY, Data::TileId tile);
 
 public:
-	WorldMapOverview();
-	~WorldMapOverview() override {}
+	HelmMap();
+	~HelmMap() override {}
 
 	void draw() override;
 	bool msgKeypress(const KeypressMessage &msg) override;
diff --git a/engines/ultima/ultima2/views/views.h b/engines/ultima/ultima2/views/views.h
index 9c1ece3e072..65b83eda132 100644
--- a/engines/ultima/ultima2/views/views.h
+++ b/engines/ultima/ultima2/views/views.h
@@ -27,12 +27,12 @@
 #include "ultima/ultima2/views/dungeon_map.h"
 #include "ultima/ultima2/views/ending.h"
 #include "ultima/ultima2/views/game.h"
+#include "ultima/ultima2/views/helm_map.h"
 #include "ultima/ultima2/views/location_map.h"
 #include "ultima/ultima2/views/overworld_map.h"
 #include "ultima/ultima2/views/space_map.h"
 #include "ultima/ultima2/views/startup.h"
 #include "ultima/ultima2/views/title.h"
-#include "ultima/ultima2/views/world_map_overview.h"
 #include "ultima/ultima2/views/zstats.h"
 #include "ultima/ultima2/views/interactions/clue_seller.h"
 #include "ultima/ultima2/views/interactions/dead.h"
@@ -83,7 +83,7 @@ struct Views : public Shared::Views {
 	SpaceMap _spaceMap;
 	Startup _startup;
 	Title _title;
-	WorldMapOverview _worldMapOverview;
+	HelmMap _helmMap;
 	ZStats _zstats;
 };
 


Commit: 34ed596aa75a1e97f6e70e7dc90694634ba27b38
    https://github.com/scummvm/scummvm/commit/34ed596aa75a1e97f6e70e7dc90694634ba27b38
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:40:58+11:00

Commit Message:
ULTIMA: ULTIMA2: Fix HelmMap terrain icons and missing screen origin

Changed paths:
    engines/ultima/ultima2/views/helm_map.cpp


diff --git a/engines/ultima/ultima2/views/helm_map.cpp b/engines/ultima/ultima2/views/helm_map.cpp
index a23c81f3177..d44999d5d5f 100644
--- a/engines/ultima/ultima2/views/helm_map.cpp
+++ b/engines/ultima/ultima2/views/helm_map.cpp
@@ -29,21 +29,24 @@ namespace Views {
 
 constexpr int COLOR_ICON = 3;
 
+// Matches the screen offset used by every other full-screen point/line renderer
+constexpr int VIEW_OFFSET = 16;
+
 // Each world cell maps to a 4-wide x 2-tall block of plot points; the
 // points lit within that block form a small per-terrain-category icon
-static const Common::Point ICON_MOUNTAIN_OR_SPRITE[] = { {0, 0}, {1, 0}, {0, 1}, {1, 1} };
-static const Common::Point ICON_GRASS[] = { {1, 0}, {2, 0} };
-static const Common::Point ICON_FOREST[] = { {1, 1}, {2, 1} };
-static const Common::Point ICON_SWAMP[] = { {0, 1}, {3, 1} };
-static const Common::Point ICON_ROAD[] = { {0, 0}, {3, 0}, {0, 1}, {3, 1} };
-static const Common::Point ICON_OTHER[] = { {1, 0}, {2, 0}, {1, 1}, {2, 1} };
+static const byte ICON_GRASS[][2] = { {1, 0}, {3, 1} };
+static const byte ICON_FOREST[][2] = { {1, 1}, {3, 0}, {1, 0}, {3, 1} };
+static const byte ICON_MOUNTAIN_OR_SPRITE[][2] = { {0, 0}, {0, 1}, {2, 1}, {2, 0}, {1, 1}, {3, 0}, {1, 0}, {3, 1} };
+static const byte ICON_SWAMP[][2] = { {1, 0}, {3, 0} };
+static const byte ICON_ROAD[][2] = { {0, 0}, {0, 1}, {2, 0}, {2, 1} };
+static const byte ICON_OTHER[][2] = { {1, 0}, {2, 0}, {2, 1}, {1, 1} };
 
 HelmMap::HelmMap() : Shared::Gfx::View("HelmMap") {
 	setBounds(TextRect(0, 0, 39, 19));
 }
 
 void HelmMap::plotIcon(Shared::Gfx::GfxSurface &s, int cellX, int cellY, Data::TileId tile) {
-	const Common::Point *points;
+	const byte (*points)[2];
 	int count;
 
 	if (tile == Data::TILE_WATER) {
@@ -68,9 +71,9 @@ void HelmMap::plotIcon(Shared::Gfx::GfxSurface &s, int cellX, int cellY, Data::T
 		count = ARRAYSIZE(ICON_OTHER);
 	}
 
-	int px = cellX * 4, py = cellY * 2;
+	int px = cellX * 4 + VIEW_OFFSET, py = cellY * 2 + VIEW_OFFSET;
 	for (int i = 0; i < count; ++i)
-		s.setPixel(px + points[i].x, py + points[i].y, COLOR_ICON);
+		s.setPixel(px + points[i][0], py + points[i][1], COLOR_ICON);
 }
 
 void HelmMap::draw() {


Commit: 9c4c580d3f251940e529807d5e74681afe54d727
    https://github.com/scummvm/scummvm/commit/9c4c580d3f251940e529807d5e74681afe54d727
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:40:59+11:00

Commit Message:
ULTIMA: ULTIMA2: Remove Startup placeholder view and non-original stats screen

Changed paths:
  R engines/ultima/ultima2/views/startup.cpp
  R engines/ultima/ultima2/views/startup.h
    engines/ultima/module.mk
    engines/ultima/ultima2/ultima2.cpp
    engines/ultima/ultima2/views/create_character.cpp
    engines/ultima/ultima2/views/create_character.h
    engines/ultima/ultima2/views/views.h


diff --git a/engines/ultima/module.mk b/engines/ultima/module.mk
index 2f9751a688c..fc2d0704ef0 100644
--- a/engines/ultima/module.mk
+++ b/engines/ultima/module.mk
@@ -134,7 +134,6 @@ MODULE_OBJS += \
 	ultima2/views/overworld_map.o \
 	ultima2/views/space_map.o \
 	ultima2/views/space_stats.o \
-	ultima2/views/startup.o \
 	ultima2/views/stats.o \
 	ultima2/views/title.o \
 	ultima2/views/zstats.o \
diff --git a/engines/ultima/ultima2/ultima2.cpp b/engines/ultima/ultima2/ultima2.cpp
index 0b17c734186..30fd336e525 100644
--- a/engines/ultima/ultima2/ultima2.cpp
+++ b/engines/ultima/ultima2/ultima2.cpp
@@ -73,7 +73,7 @@ Common::Error Ultima2Engine::run() {
 	_rngState[1]++;
 
 	Views::Views views;
-	addView("Startup");
+	addView("Title");
 	runGame(views);
 
 	return Common::kNoError;
diff --git a/engines/ultima/ultima2/views/create_character.cpp b/engines/ultima/ultima2/views/create_character.cpp
index 8f3e9756410..79da6b09375 100644
--- a/engines/ultima/ultima2/views/create_character.cpp
+++ b/engines/ultima/ultima2/views/create_character.cpp
@@ -139,9 +139,6 @@ void CreateCharacter::positionCursor() {
 	case CONFIRM:
 		_cursor.setPosition(Common::Point(29, 16));
 		break;
-	case DONE:
-		_cursor.hide();
-		return;
 	}
 
 	_cursor.show();
@@ -152,11 +149,6 @@ void CreateCharacter::draw() {
 	s.clear();
 	s.setColor(COLOR_TEXT);
 
-	if (_state == DONE) {
-		drawDone(s);
-		return;
-	}
-
 	Data::Savegame &sg = _G(savegame);
 
 	s.writeString(Common::Point(10, 1), "PLAYER GENERATION :");
@@ -211,20 +203,6 @@ void CreateCharacter::draw() {
 	s.writeString(Common::Point(9, 22), "4-HOBBIT       4-THIEF");
 }
 
-void CreateCharacter::drawDone(Shared::Gfx::GfxSurface &s) {
-	Data::Savegame &sg = _G(savegame);
-
-	s.writeString(Common::Point(10, 2), "CHARACTER CREATED");
-	s.writeString(Common::Point(4, 4), "NAME: %s", sg._name);
-	s.writeString(Common::Point(4, 5), "%s %s %s",
-		sg._sex == Data::SEX_MALE ? "MALE" : "FEMALE", raceName(sg._race), className(sg._class));
-	s.writeString(Common::Point(4, 7), "STR:%d AGL:%d STA:%d", sg._strength, sg._agility, sg._stamina);
-	s.writeString(Common::Point(4, 8), "CHR:%d WIS:%d INT:%d", sg._charisma, sg._wisdom, sg._intelligence);
-	s.writeString(Common::Point(4, 10), "HP:%d FOOD:%d GOLD:%d", sg._hp, sg._food, sg._gold);
-
-	s.writeString(Common::Point(4, 13), "PRESS ANY KEY TO ENTER THE WORLD");
-}
-
 bool CreateCharacter::msgKeypress(const KeypressMessage &msg) {
 	Data::Savegame &sg = _G(savegame);
 
@@ -323,15 +301,9 @@ bool CreateCharacter::msgKeypress(const KeypressMessage &msg) {
 			sg._mapY = 20;
 			sg._mapEra = 2;
 			sg._mapType = 0;
-			_state = DONE;
-			positionCursor();
-			redraw();
+			_G(map).load(sg._mapEra, sg._mapType);
 		}
 		break;
-
-	case DONE:
-		_G(map).load(sg._mapEra, sg._mapType);
-		break;
 	}
 
 	return true;
diff --git a/engines/ultima/ultima2/views/create_character.h b/engines/ultima/ultima2/views/create_character.h
index 50be05c5462..46cdd4f9ac6 100644
--- a/engines/ultima/ultima2/views/create_character.h
+++ b/engines/ultima/ultima2/views/create_character.h
@@ -43,7 +43,7 @@ class CreateCharacter : public Shared::Gfx::View {
 private:
 	enum State {
 		STRENGTH, AGILITY, STAMINA, CHARISMA, WISDOM, INTELLIGENCE,
-		SEX, RACE, CLASS, NAME, CONFIRM, DONE
+		SEX, RACE, CLASS, NAME, CONFIRM
 	};
 	State _state = STRENGTH;
 
@@ -59,7 +59,6 @@ private:
 	void rejectEntry();
 	void enterStat(int value);
 	void positionCursor();
-	void drawDone(Shared::Gfx::GfxSurface &s);
 
 public:
 	CreateCharacter();
diff --git a/engines/ultima/ultima2/views/startup.cpp b/engines/ultima/ultima2/views/startup.cpp
deleted file mode 100644
index 7edabba9958..00000000000
--- a/engines/ultima/ultima2/views/startup.cpp
+++ /dev/null
@@ -1,52 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-#include "ultima/ultima2/views/startup.h"
-
-namespace Ultima {
-namespace Ultima2 {
-namespace Views {
-
-#define DELAY_SECONDS 3
-
-#define COLOR_FOREGROUND 3 // white, within CGA_PALETTE1
-
-bool Startup::msgFocus(const FocusMessage &msg) {
-	delaySeconds(DELAY_SECONDS);
-	return View::msgFocus(msg);
-}
-
-void Startup::timeout() {
-	showTitle();
-}
-
-void Startup::draw() {
-	auto s = getSurface();
-	s.clear();
-
-	s.setColor(COLOR_FOREGROUND);
-	s.writeString(Common::Point(16, 8), "Ultima II");
-	s.writeString(Common::Point(8, 11), "The Revenge of the Enchantress");
-}
-
-} // namespace Views
-} // namespace Ultima2
-} // namespace Ultima
diff --git a/engines/ultima/ultima2/views/startup.h b/engines/ultima/ultima2/views/startup.h
deleted file mode 100644
index 7e17b6ef220..00000000000
--- a/engines/ultima/ultima2/views/startup.h
+++ /dev/null
@@ -1,68 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-#ifndef ULTIMA2_VIEWS_STARTUP_H
-#define ULTIMA2_VIEWS_STARTUP_H
-
-#include "ultima/shared/gfx/view.h"
-
-namespace Ultima {
-namespace Ultima2 {
-namespace Views {
-
-using namespace Shared::Messages;
-
-/**
- * Brief ScummVM splash shown before handing off to the real attract-mode
- * Title sequence.
- */
-class Startup : public Shared::Gfx::View {
-private:
-	void showTitle() {
-		replaceView("Title");
-	}
-public:
-	Startup() : View("Startup") {}
-	~Startup() override {}
-
-	void draw() override;
-
-	bool msgFocus(const FocusMessage &msg) override;
-	void timeout() override;
-	bool msgKeypress(const KeypressMessage &msg) override {
-		showTitle();
-		return true;
-	}
-	bool msgMouseDown(const MouseDownMessage &msg) override {
-		showTitle();
-		return true;
-	}
-	bool msgAction(const ActionMessage &msg) override {
-		showTitle();
-		return true;
-	}
-};
-
-} // namespace Views
-} // namespace Ultima2
-} // namespace Ultima
-
-#endif
diff --git a/engines/ultima/ultima2/views/views.h b/engines/ultima/ultima2/views/views.h
index 65b83eda132..c20c7a19020 100644
--- a/engines/ultima/ultima2/views/views.h
+++ b/engines/ultima/ultima2/views/views.h
@@ -31,7 +31,6 @@
 #include "ultima/ultima2/views/location_map.h"
 #include "ultima/ultima2/views/overworld_map.h"
 #include "ultima/ultima2/views/space_map.h"
-#include "ultima/ultima2/views/startup.h"
 #include "ultima/ultima2/views/title.h"
 #include "ultima/ultima2/views/zstats.h"
 #include "ultima/ultima2/views/interactions/clue_seller.h"
@@ -81,7 +80,6 @@ struct Views : public Shared::Views {
 	LocationMap _locationMap;
 	OverworldMap _overworldMap;
 	SpaceMap _spaceMap;
-	Startup _startup;
 	Title _title;
 	HelmMap _helmMap;
 	ZStats _zstats;


Commit: e91aa386b838372b51b610e622f80203ef90a1a5
    https://github.com/scummvm/scummvm/commit/e91aa386b838372b51b610e622f80203ef90a1a5
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:40:59+11:00

Commit Message:
ULTIMA: ULTIMA2: Consolidate name-lookup helpers into Data

Changed paths:
    engines/ultima/ultima2/data/data.cpp
    engines/ultima/ultima2/data/data.h
    engines/ultima/ultima2/views/create_character.cpp
    engines/ultima/ultima2/views/zstats.cpp


diff --git a/engines/ultima/ultima2/data/data.cpp b/engines/ultima/ultima2/data/data.cpp
index 449caaaab59..07ac74f5955 100644
--- a/engines/ultima/ultima2/data/data.cpp
+++ b/engines/ultima/ultima2/data/data.cpp
@@ -52,6 +52,14 @@ void setCGAPalette() {
 	g_system->getPaletteManager()->setPalette(palette);
 }
 
+const char *const RACE_NAMES[RACE_COUNT] = {
+	"HUMAN", "ELF", "DWARF", "HOBBIT"
+};
+
+const char *const CLASS_NAMES[CLASS_COUNT] = {
+	"FIGHTER", "CLERIC", "WIZARD", "THIEF"
+};
+
 const char *const WEAPON_NAMES[WEAPON_COUNT] = {
 	"HANDS", "DAGGER", "MACE", "AXE", "BOW", "SWORD",
 	"GREAT SWORD", "LIGHT SWORD", "PHASER", "QUICK SWORD"
@@ -72,6 +80,30 @@ const char *const ITEM_NAMES[ITEM_COUNT] = {
 	"STRANGE COIN", "GREEN IDOL", "TRI LITHIUM"
 };
 
+const char *raceName(Race race) {
+	return (race >= 0 && race < RACE_COUNT) ? RACE_NAMES[race] : "";
+}
+
+const char *className(CharClass charClass) {
+	return (charClass >= 0 && charClass < CLASS_COUNT) ? CLASS_NAMES[charClass] : "";
+}
+
+const char *weaponName(WeaponType weapon) {
+	return (weapon >= 0 && weapon < WEAPON_COUNT) ? WEAPON_NAMES[weapon] : "";
+}
+
+const char *armorName(ArmorType armor) {
+	return (armor >= 0 && armor < ARMOR_COUNT) ? ARMOR_NAMES[armor] : "";
+}
+
+const char *spellName(SpellType spell) {
+	return (spell >= 0 && spell < SPELL_COUNT) ? SPELL_NAMES[spell] : "";
+}
+
+const char *itemName(int item) {
+	return (item >= 0 && item < ITEM_COUNT) ? ITEM_NAMES[item] : "";
+}
+
 } // namespace Data
 } // namespace Ultima2
 } // namespace Ultima
diff --git a/engines/ultima/ultima2/data/data.h b/engines/ultima/ultima2/data/data.h
index bb91a5ef2e1..ae37982976a 100644
--- a/engines/ultima/ultima2/data/data.h
+++ b/engines/ultima/ultima2/data/data.h
@@ -62,9 +62,12 @@ enum Sex {
 enum Race {
 	RACE_HUMAN = 0, RACE_ELF = 1, RACE_DWARF = 2, RACE_HOBBIT = 3, RACE_COUNT = 4
 };
+extern const char *const RACE_NAMES[RACE_COUNT];
+
 enum CharClass {
 	CLASS_FIGHTER = 0, CLASS_CLERIC = 1, CLASS_WIZARD = 2, CLASS_THIEF = 3, CLASS_COUNT = 4
 };
+extern const char *const CLASS_NAMES[CLASS_COUNT];
 
 // Indexes into Savegame::_weaponOwned
 enum WeaponType {
@@ -98,6 +101,15 @@ enum ItemType {
 };
 extern const char *const ITEM_NAMES[ITEM_COUNT];
 
+// Bounds-checked lookups into the *_NAMES arrays above, the single shared
+// implementation for what used to be separately duplicated per view
+const char *raceName(Race race);
+const char *className(CharClass charClass);
+const char *weaponName(WeaponType weapon);
+const char *armorName(ArmorType armor);
+const char *spellName(SpellType spell);
+const char *itemName(int item);
+
 // Short PC speaker effects, played through Ultima2Engine::playFX
 enum SoundEffect {
 	SFX_TICK, SFX_STEP, SFX_ATTACK, SFX_HIT, SFX_CANNON, SFX_TRAP, SFX_FAIL, SFX_BEEP, SFX_MAGIC
diff --git a/engines/ultima/ultima2/views/create_character.cpp b/engines/ultima/ultima2/views/create_character.cpp
index 79da6b09375..dcb9a50ed46 100644
--- a/engines/ultima/ultima2/views/create_character.cpp
+++ b/engines/ultima/ultima2/views/create_character.cpp
@@ -31,26 +31,6 @@ constexpr int COLOR_TEXT = 3; // white, within CGA_PALETTE1
 constexpr int STARTING_POINTS = 90;
 constexpr int MIN_ATTRIBUTE = 10;
 
-static const char *raceName(Data::Race race) {
-	switch (race) {
-	case Data::RACE_HUMAN: return "HUMAN";
-	case Data::RACE_ELF: return "ELF";
-	case Data::RACE_DWARF: return "DWARF";
-	case Data::RACE_HOBBIT: return "HOBBIT";
-	default: return "";
-	}
-}
-
-static const char *className(Data::CharClass charClass) {
-	switch (charClass) {
-	case Data::CLASS_FIGHTER: return "FIGHTER";
-	case Data::CLASS_CLERIC: return "CLERIC";
-	case Data::CLASS_WIZARD: return "WIZARD";
-	case Data::CLASS_THIEF: return "THIEF";
-	default: return "";
-	}
-}
-
 CreateCharacter::CreateCharacter() : View("CreateCharacter"), _cursor("Cursor", this) {
 }
 
@@ -188,9 +168,9 @@ void CreateCharacter::draw() {
 	if (_state > SEX)
 		s.writeString(Common::Point(20, 11), sg._sex == Data::SEX_MALE ? "MALE" : "FEMALE");
 	if (_state > RACE)
-		s.writeString(Common::Point(20, 12), raceName(sg._race));
+		s.writeString(Common::Point(20, 12), Data::raceName(sg._race));
 	if (_state > CLASS)
-		s.writeString(Common::Point(20, 13), className(sg._class));
+		s.writeString(Common::Point(20, 13), Data::className(sg._class));
 	if (_state >= NAME)
 		s.writeString(Common::Point(20, 14), _name);
 
diff --git a/engines/ultima/ultima2/views/zstats.cpp b/engines/ultima/ultima2/views/zstats.cpp
index 3096de9a384..0dbfe33fd02 100644
--- a/engines/ultima/ultima2/views/zstats.cpp
+++ b/engines/ultima/ultima2/views/zstats.cpp
@@ -28,42 +28,6 @@ namespace Views {
 
 constexpr int COLOR_TEXT = 3;
 
-static const char *weaponName(Data::WeaponType w) {
-	return (w >= 0 && w < Data::WEAPON_COUNT) ? Data::WEAPON_NAMES[w] : "";
-}
-
-static const char *armorName(Data::ArmorType a) {
-	return (a >= 0 && a < Data::ARMOR_COUNT) ? Data::ARMOR_NAMES[a] : "";
-}
-
-static const char *spellName(Data::SpellType s) {
-	return (s >= 0 && s < Data::SPELL_COUNT) ? Data::SPELL_NAMES[s] : "";
-}
-
-static const char *itemName(int i) {
-	return (i >= 0 && i < Data::ITEM_COUNT) ? Data::ITEM_NAMES[i] : "";
-}
-
-static const char *raceName(Data::Race race) {
-	switch (race) {
-	case Data::RACE_HUMAN: return "HUMAN";
-	case Data::RACE_ELF: return "ELF";
-	case Data::RACE_DWARF: return "DWARF";
-	case Data::RACE_HOBBIT: return "HOBBIT";
-	default: return "";
-	}
-}
-
-static const char *className(Data::CharClass charClass) {
-	switch (charClass) {
-	case Data::CLASS_FIGHTER: return "FIGHTER";
-	case Data::CLASS_CLERIC: return "CLERIC";
-	case Data::CLASS_WIZARD: return "WIZARD";
-	case Data::CLASS_THIEF: return "THIEF";
-	default: return "";
-	}
-}
-
 ZStats::ZStats() : View("ZStats") {
 	setBounds(TextRect(0, 0, 39, 24));
 }
@@ -88,12 +52,12 @@ void ZStats::draw() {
 	s.writeString(Common::Point(0, 0), "%s", sg._name);
 	s.writeString(Common::Point(0, 1), "A LEVEL %.2d %s %s %s", sg._experience,
 		sg._sex == Data::SEX_MALE ? "MALE" : "FEMALE",
-		raceName(sg._race),
-		className(sg._class));
+		Data::raceName(sg._race),
+		Data::className(sg._class));
 
-	s.writeString(Common::Point(2, 4), "WEAPON-%s", weaponName(sg._readiedWeapon));
-	s.writeString(Common::Point(2, 5), "ARMOUR-%s", armorName(sg._readiedArmor));
-	s.writeString(Common::Point(2, 6), " SPELL-%s", spellName(sg._readiedSpell));
+	s.writeString(Common::Point(2, 4), "WEAPON-%s", Data::weaponName(sg._readiedWeapon));
+	s.writeString(Common::Point(2, 5), "ARMOUR-%s", Data::armorName(sg._readiedArmor));
+	s.writeString(Common::Point(2, 6), " SPELL-%s", Data::spellName(sg._readiedSpell));
 
 	s.writeString(Common::Point(38, 4), Common::String::format("TORCHES-%.2d", sg._torches), Graphics::kTextAlignRight);
 	s.writeString(Common::Point(38, 5), Common::String::format("KEYS-%.2d", sg._keys), Graphics::kTextAlignRight);
@@ -110,7 +74,7 @@ void ZStats::draw() {
 	Common::String line = "WEAPONS: ";
 	for (int i = 0; i < Data::WEAPON_COUNT; ++i) {
 		if (sg._weaponOwned[i] != 0)
-			line += Common::String::format("%sS-%.2d ", weaponName((Data::WeaponType)i), sg._weaponOwned[i]);
+			line += Common::String::format("%sS-%.2d ", Data::weaponName((Data::WeaponType)i), sg._weaponOwned[i]);
 	}
 	s.writeString(Common::Point(0, row), line);
 	row += 3; // two blank rows below WEAPONS
@@ -118,7 +82,7 @@ void ZStats::draw() {
 	line = "ARMOUR: ";
 	for (int i = 0; i < Data::ARMOR_COUNT; ++i) {
 		if (sg._armorOwned[i] != 0)
-			line += Common::String::format("%s-%.2d ", armorName((Data::ArmorType)i), sg._armorOwned[i]);
+			line += Common::String::format("%s-%.2d ", Data::armorName((Data::ArmorType)i), sg._armorOwned[i]);
 	}
 	s.writeString(Common::Point(0, row), line);
 	row += 2; // one blank row below ARMOUR
@@ -126,7 +90,7 @@ void ZStats::draw() {
 	line = "SPELLS: ";
 	for (int i = 0; i < Data::SPELL_COUNT; ++i) {
 		if (sg._spellCharges[i] != 0)
-			line += Common::String::format("%sS-%.2d ", spellName((Data::SpellType)i), sg._spellCharges[i]);
+			line += Common::String::format("%sS-%.2d ", Data::spellName((Data::SpellType)i), sg._spellCharges[i]);
 	}
 	s.writeString(Common::Point(0, row), line);
 	row += 3; // two blank rows below SPELLS
@@ -134,7 +98,7 @@ void ZStats::draw() {
 	line = "ITEMS: ";
 	for (int i = 0; i < Data::ITEM_COUNT; ++i) {
 		if (sg._items[i] != 0) {
-			line += Common::String::format("%s%s-%.2d ", itemName(i),
+			line += Common::String::format("%s%s-%.2d ", Data::itemName(i),
 				i == Data::ITEM_BOOTS ? "" : "S", sg._items[i]);
 		}
 	}


Commit: cd310fbd1305cb510b6f030ab672a66eb9732bf5
    https://github.com/scummvm/scummvm/commit/cd310fbd1305cb510b6f030ab672a66eb9732bf5
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:40:59+11:00

Commit Message:
ULTIMA: ULTIMA2: Cleanup Yell interaction

Changed paths:
    engines/ultima/ultima2/views/interactions/yell.cpp


diff --git a/engines/ultima/ultima2/views/interactions/yell.cpp b/engines/ultima/ultima2/views/interactions/yell.cpp
index 066eedbf4ad..a6bb8e956bb 100644
--- a/engines/ultima/ultima2/views/interactions/yell.cpp
+++ b/engines/ultima/ultima2/views/interactions/yell.cpp
@@ -38,11 +38,11 @@ bool Yell::msgFocus(const FocusMessage &msg) {
 }
 
 bool Yell::msgKeypress(const KeypressMessage &msg) {
-	if (msg.ascii == 13) {
+	if (msg.keycode == Common::KEYCODE_RETURN) {
 		writeString("\n");
 		close();
 		_G(logic)->resumeTurn();
-	} else if (msg.ascii >= 32 && msg.ascii < 127) {
+	} else if (Common::isPrint(msg.ascii)) {
 		writeString("%c", (char)msg.ascii);
 	}
 


Commit: dfcaee06f243a3c829bb4088676edc044b6920ed
    https://github.com/scummvm/scummvm/commit/dfcaee06f243a3c829bb4088676edc044b6920ed
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:40:59+11:00

Commit Message:
ULTIMA: ULTIMA2: Add secret ScummVM town map

This is triggered by entering 'scummvm' in the yell command.

Changed paths:
  A engines/ultima/ultima2/data/secret_archive.cpp
  A engines/ultima/ultima2/data/secret_archive.h
    engines/ultima/module.mk
    engines/ultima/ultima2/data/map.cpp
    engines/ultima/ultima2/ultima2.cpp
    engines/ultima/ultima2/views/interactions/yell.cpp
    engines/ultima/ultima2/views/interactions/yell.h


diff --git a/engines/ultima/module.mk b/engines/ultima/module.mk
index fc2d0704ef0..37f00b67efd 100644
--- a/engines/ultima/module.mk
+++ b/engines/ultima/module.mk
@@ -115,6 +115,7 @@ MODULE_OBJS += \
 	ultima2/data/map_dungeon.o \
 	ultima2/data/map_monsters.o \
 	ultima2/data/savegame.o \
+	ultima2/data/secret_archive.o \
 	ultima2/data/tiles.o \
 	ultima2/gfx/pic_decoder.o \
 	ultima2/gfx/text_cursor.o \
diff --git a/engines/ultima/ultima2/data/map.cpp b/engines/ultima/ultima2/data/map.cpp
index 5c47b63bbd1..bf792adf035 100644
--- a/engines/ultima/ultima2/data/map.cpp
+++ b/engines/ultima/ultima2/data/map.cpp
@@ -80,7 +80,7 @@ void Map::loadTalk(int mapEra, int mapType) {
 }
 
 void Map::load(int mapEra, int mapType) {
-	if (mapType >= 4) {
+	if (mapType >= 4 && mapType != 9) {
 		loadDungeon(mapEra, mapType);
 		return;
 	}
diff --git a/engines/ultima/ultima2/data/secret_archive.cpp b/engines/ultima/ultima2/data/secret_archive.cpp
new file mode 100644
index 00000000000..a59a2a121a9
--- /dev/null
+++ b/engines/ultima/ultima2/data/secret_archive.cpp
@@ -0,0 +1,192 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "common/memstream.h"
+#include "ultima/ultima2/data/map.h"
+#include "ultima/ultima2/data/secret_archive.h"
+
+namespace Ultima {
+namespace Ultima2 {
+namespace Data {
+
+namespace {
+
+// Matches the compass entrances in the real MAPX22 - a 4-tile gap centered
+// on each edge of the map
+constexpr int ENTRANCE_START = 30;
+constexpr int ENTRANCE_WIDTH = 4;
+
+// A minimal 5x7 dot-matrix font, used to spell "SCUMMVM" out of wall tiles
+// across the top half of the map. '#' is a lit pixel; anything else is
+// left as the map's base grass
+constexpr int FONT_WIDTH = 5;
+constexpr int FONT_HEIGHT = 7;
+constexpr int FONT_SPACING = 1;
+
+const char *const FONT_C[FONT_HEIGHT] = {
+	" ### ", "#    ", "#    ", "#    ", "#    ", "#    ", " ### "
+};
+const char *const FONT_M[FONT_HEIGHT] = {
+	"#   #", "## ##", "# # #", "#   #", "#   #", "#   #", "#   #"
+};
+const char *const FONT_S[FONT_HEIGHT] = {
+	" ### ", "#    ", "#    ", " ### ", "    #", "    #", " ### "
+};
+const char *const FONT_U[FONT_HEIGHT] = {
+	"#   #", "#   #", "#   #", "#   #", "#   #", "#   #", " ### "
+};
+const char *const FONT_V[FONT_HEIGHT] = {
+	"#   #", "#   #", "#   #", "#   #", "#   #", " # # ", "  #  "
+};
+
+const char *const *const SCUMMVM_WORD[] = {
+	FONT_S, FONT_C, FONT_U, FONT_M, FONT_M, FONT_V, FONT_M
+};
+constexpr int SCUMMVM_LETTER_COUNT = ARRAYSIZE(SCUMMVM_WORD);
+
+void setTile(byte *buffer, int x, int y, TileId tile) {
+	buffer[y * MAP_WIDTH + x] = (byte)(tile * 4);
+}
+
+// The wall lettering re-uses the game's own A-Z tile glyphs, which run in
+// alphabetic order except for a gap at Q (that slot is the moongate glyph)
+TileId letterTile(char c) {
+	return (TileId)(TILE_A + (c - 'A'));
+}
+
+void writeWallText(byte *buffer, int y, int x, const char *text) {
+	for (int i = 0; text[i]; ++i)
+		setTile(buffer, x + i, y, letterTile(text[i]));
+}
+
+Common::SeekableReadStream *buildTownMap() {
+	byte *buffer = new byte[MAP_WIDTH * MAP_HEIGHT];
+
+	for (int i = 0; i < MAP_WIDTH * MAP_HEIGHT; ++i)
+		buffer[i] = (byte)(TILE_GRASS * 4);
+
+	// Walls around the edge of the town, with a gap at each compass entrance
+	for (int x = 0; x < MAP_WIDTH; ++x) {
+		if (x < ENTRANCE_START || x >= ENTRANCE_START + ENTRANCE_WIDTH) {
+			setTile(buffer, x, 0, TILE_WALL);
+			setTile(buffer, x, MAP_HEIGHT - 1, TILE_WALL);
+		}
+	}
+	for (int y = 0; y < MAP_HEIGHT; ++y) {
+		if (y < ENTRANCE_START || y >= ENTRANCE_START + ENTRANCE_WIDTH) {
+			setTile(buffer, 0, y, TILE_WALL);
+			setTile(buffer, MAP_WIDTH - 1, y, TILE_WALL);
+		}
+	}
+
+	// A crossroads connecting every compass entrance clear through the
+	// town, like MAPX22's own main streets
+	for (int y = ENTRANCE_START; y < ENTRANCE_START + ENTRANCE_WIDTH; ++y) {
+		for (int x = 0; x < MAP_WIDTH; ++x)
+			setTile(buffer, x, y, TILE_ROAD);
+	}
+	for (int x = ENTRANCE_START; x < ENTRANCE_START + ENTRANCE_WIDTH; ++x) {
+		for (int y = 0; y < MAP_HEIGHT; ++y)
+			setTile(buffer, x, y, TILE_ROAD);
+	}
+
+	// South wall lettering, mirroring MAPX22's own "TOWNE"/"LINDA" either
+	// side of its south entrance
+	writeWallText(buffer, MAP_HEIGHT - 1, 24, "TOWNE");
+	writeWallText(buffer, MAP_HEIGHT - 1, 35, "SCUMMVM");
+
+	// "SCUMMVM" spelled out in large wall-tile letters across the top half,
+	// drawn over the north-south road so the lettering wins wherever the
+	// two overlap. Letter spacing stays constant throughout; the word is
+	// simply positioned so the gap between its two "M"s falls under the
+	// north entrance, even where that means the letters' own wall tiles
+	// spill out over the road on either side of that gap
+	constexpr int MM_GAP_COLUMN = ENTRANCE_START + ENTRANCE_WIDTH / 2 - 1;
+	constexpr int WORD_START_X = MM_GAP_COLUMN - (3 * (FONT_WIDTH + FONT_SPACING) + FONT_WIDTH);
+	constexpr int WORD_START_Y = 3;
+
+	for (int letter = 0; letter < SCUMMVM_LETTER_COUNT; ++letter) {
+		int lx = WORD_START_X + letter * (FONT_WIDTH + FONT_SPACING);
+		for (int row = 0; row < FONT_HEIGHT; ++row) {
+			const char *bits = SCUMMVM_WORD[letter][row];
+			for (int col = 0; col < FONT_WIDTH; ++col) {
+				if (bits[col] != ' ')
+					setTile(buffer, lx + col, WORD_START_Y + row, TILE_WALL);
+			}
+		}
+	}
+
+	return new Common::MemoryReadStream(buffer, MAP_WIDTH * MAP_HEIGHT, DisposeAfterUse::YES);
+}
+
+// MapMonsters::load reads eight parallel MAP_MONSTER_COUNT-byte arrays; an
+// all-zero buffer means every slot's type is 0, i.e. inactive - no NPCs
+constexpr int MONSTER_DATA_SIZE = MAP_MONSTER_COUNT * 8;
+
+Common::SeekableReadStream *buildDummyMonsterData() {
+	byte *buffer = new byte[MONSTER_DATA_SIZE]();
+	return new Common::MemoryReadStream(buffer, MONSTER_DATA_SIZE, DisposeAfterUse::YES);
+}
+
+// Map::loadTalk reads this many bytes and splits them on zero bytes into
+// dialogue lines; an all-zero buffer decodes to nothing but empty lines
+constexpr int TALK_DATA_SIZE = 256;
+
+Common::SeekableReadStream *buildDummyTalkData() {
+	byte *buffer = new byte[TALK_DATA_SIZE]();
+	return new Common::MemoryReadStream(buffer, TALK_DATA_SIZE, DisposeAfterUse::YES);
+}
+
+} // namespace
+
+bool SecretMapArchive::hasFile(const Common::Path &path) const {
+	Common::String name = path.baseName();
+	return name.size() == 6 && name.hasSuffix("9") && (
+		name.hasPrefixIgnoreCase("mapx") ||
+		name.hasPrefixIgnoreCase("monx") ||
+		name.hasPrefixIgnoreCase("tlkx")
+	);
+}
+
+const Common::ArchiveMemberPtr SecretMapArchive::getMember(const Common::Path &path) const {
+	if (!hasFile(path))
+		return Common::ArchiveMemberPtr();
+
+	return Common::ArchiveMemberPtr(new Common::GenericArchiveMember(path, *this));
+}
+
+Common::SeekableReadStream *SecretMapArchive::createReadStreamForMember(const Common::Path &path) const {
+	if (!hasFile(path))
+		return nullptr;
+
+	Common::String name = path.baseName();
+
+	if (name.hasPrefixIgnoreCase("mapx"))
+		return buildTownMap();
+	if (name.hasPrefixIgnoreCase("monx"))
+		return buildDummyMonsterData();
+
+	return buildDummyTalkData();
+}
+
+} // namespace Data
+} // namespace Ultima2
+} // namespace Ultima
diff --git a/engines/ultima/ultima2/data/secret_archive.h b/engines/ultima/ultima2/data/secret_archive.h
new file mode 100644
index 00000000000..a8f2d70469e
--- /dev/null
+++ b/engines/ultima/ultima2/data/secret_archive.h
@@ -0,0 +1,87 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef ULTIMA2_DATA_SECRET_ARCHIVE_H
+#define ULTIMA2_DATA_SECRET_ARCHIVE_H
+
+#include "common/archive.h"
+
+namespace Ultima {
+namespace Ultima2 {
+namespace Data {
+
+
+/**
+ * Implements a special secret city map file just for ScummVM
+ */
+class SecretMapArchive : public Common::Archive {
+public:
+	~SecretMapArchive() override {
+	}
+
+	/**
+	 * Check if a member with the given name is present in the Archive.
+	 * Patterns are not allowed, as this is meant to be a quick File::exists()
+	 * replacement.
+	 */
+	bool hasFile(const Common::Path &path) const override;
+
+	/**
+	 * Add all members of the Archive matching the specified pattern to list.
+	 * Must only append to list, and not remove elements from it.
+	 *
+	 * @return the number of members added to list
+	 */
+	int listMatchingMembers(Common::ArchiveMemberList &list,
+		const Common::Path &pattern, bool matchPathComponents = false) const override {
+		return 0;
+	}
+
+	/**
+	 * Add all members of the Archive to list.
+	 * Must only append to list, and not remove elements from it.
+	 *
+	 * @return the number of names added to list
+	 */
+	int listMembers(Common::ArchiveMemberList &list) const override {
+		return 0;
+	}
+
+	/**
+	 * Returns a ArchiveMember representation of the given file.
+	 */
+	const Common::ArchiveMemberPtr getMember(const Common::Path &path)
+		const override;
+
+	/**
+	 * Create a stream bound to a member with the specified name in the
+	 * archive. If no member with this name exists, 0 is returned.
+	 * @return the newly created input stream
+	 */
+	Common::SeekableReadStream *createReadStreamForMember(
+		const Common::Path &path) const override;
+};
+
+} // namespace Data
+} // namespace Ultima2
+} // namespace Ultima
+
+#endif
diff --git a/engines/ultima/ultima2/ultima2.cpp b/engines/ultima/ultima2/ultima2.cpp
index 30fd336e525..5957d077186 100644
--- a/engines/ultima/ultima2/ultima2.cpp
+++ b/engines/ultima/ultima2/ultima2.cpp
@@ -26,6 +26,7 @@
 #include "ultima/ultima2/ultima2.h"
 #include "ultima/ultima2/console.h"
 #include "ultima/ultima2/metaengine.h"
+#include "ultima/ultima2/data/secret_archive.h"
 #include "ultima/ultima2/logic/space_logic.h"
 #include "ultima/ultima2/views/views.h"
 #include "ultima/ultima2/views/map.h"
@@ -72,6 +73,10 @@ Common::Error Ultima2Engine::run() {
 	_rngState[0]++;
 	_rngState[1]++;
 
+	// Set up secret map
+	SearchMan.add("Secret", new Data::SecretMapArchive());
+
+	// Create all the views and run the game
 	Views::Views views;
 	addView("Title");
 	runGame(views);
diff --git a/engines/ultima/ultima2/views/interactions/yell.cpp b/engines/ultima/ultima2/views/interactions/yell.cpp
index a6bb8e956bb..50622b49257 100644
--- a/engines/ultima/ultima2/views/interactions/yell.cpp
+++ b/engines/ultima/ultima2/views/interactions/yell.cpp
@@ -20,6 +20,7 @@
  */
 
 #include "ultima/ultima2/views/interactions/yell.h"
+#include "ultima/ultima2/views/overworld_map.h"
 #include "ultima/ultima2/ultima2.h"
 #include "ultima/ultima2/metaengine.h"
 
@@ -41,9 +42,30 @@ bool Yell::msgKeypress(const KeypressMessage &msg) {
 	if (msg.keycode == Common::KEYCODE_RETURN) {
 		writeString("\n");
 		close();
+
+		Data::Savegame &sg = _G(savegame);
+		if (_text.equalsIgnoreCase("scummvm") && dynamic_cast<Views::OverworldMap *>(g_engine->focusedView()) != nullptr &&
+				sg._mount == 0) {
+			writeString("The universe whisks you away.\n");
+
+			// A parting gift; items are stored as two BCD digits, so 99 is the highest they can go
+			if (sg._items[Data::ITEM_HELM] < 99)
+				++sg._items[Data::ITEM_HELM];
+
+			// Show the ScummVM secret map
+			sg._overworldReturnX = sg._mapX;
+			sg._overworldReturnY = sg._mapY;
+			sg._mapX = 31;
+			sg._mapY = 62;
+			sg._mapType = 2;
+			_G(map).load(sg._mapEra, 9);
+			_G(logic)->entering();
+		}
+
 		_G(logic)->resumeTurn();
 	} else if (Common::isPrint(msg.ascii)) {
 		writeString("%c", (char)msg.ascii);
+		_text += msg.ascii;
 	}
 
 	return true;
diff --git a/engines/ultima/ultima2/views/interactions/yell.h b/engines/ultima/ultima2/views/interactions/yell.h
index 7e848fa66be..b58567cbf19 100644
--- a/engines/ultima/ultima2/views/interactions/yell.h
+++ b/engines/ultima/ultima2/views/interactions/yell.h
@@ -34,6 +34,9 @@ namespace Interactions {
  * Enter is pressed, with no gameplay effect at all
  */
 class Yell : public Interaction {
+private:
+	Common::String _text;
+
 public:
 	Yell();
 	~Yell() override {}


Commit: 1a77f8b9b5f337732dd24bf3245adc923f575ec1
    https://github.com/scummvm/scummvm/commit/1a77f8b9b5f337732dd24bf3245adc923f575ec1
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:40:59+11:00

Commit Message:
ULTIMA: ULTIMA2: Don't erase text cursor area on title screen

Changed paths:
    engines/ultima/ultima2/gfx/text_cursor.cpp
    engines/ultima/ultima2/gfx/text_cursor.h


diff --git a/engines/ultima/ultima2/gfx/text_cursor.cpp b/engines/ultima/ultima2/gfx/text_cursor.cpp
index d5708fb57f7..2ee07ef3ac2 100644
--- a/engines/ultima/ultima2/gfx/text_cursor.cpp
+++ b/engines/ultima/ultima2/gfx/text_cursor.cpp
@@ -35,6 +35,7 @@ TextCursor::TextCursor(const Common::String &name, UIElement *parent, byte color
 }
 
 void TextCursor::show() {
+	_active = true;
 	_visible = true;
 	redraw();
 	delayFrames(DELAY_FRAMES);
@@ -43,7 +44,9 @@ void TextCursor::show() {
 void TextCursor::hide() {
 	_visible = false;
 	cancelDelay();
-	redraw();
+	draw();
+
+	_active = false;
 }
 
 void TextCursor::setPosition(const Common::Point &pt) {
@@ -51,11 +54,13 @@ void TextCursor::setPosition(const Common::Point &pt) {
 }
 
 void TextCursor::draw() {
-	auto s = getSurface();
-	s.clear();
+	if (_active) {
+		auto s = getSurface();
+		s.clear();
 
-	if (_visible)
-		s.fillRect(Common::Rect(0, 7, 8, 8), _color);
+		if (_visible)
+			s.fillRect(Common::Rect(0, 7, 8, 8), _color);
+	}
 }
 
 void TextCursor::timeout() {
diff --git a/engines/ultima/ultima2/gfx/text_cursor.h b/engines/ultima/ultima2/gfx/text_cursor.h
index c3923f3645f..8f1a5c813e4 100644
--- a/engines/ultima/ultima2/gfx/text_cursor.h
+++ b/engines/ultima/ultima2/gfx/text_cursor.h
@@ -35,6 +35,7 @@ namespace Gfx {
  */
 class TextCursor : public Shared::UIElement {
 private:
+	bool _active = false;
 	bool _visible = true;
 	byte _color;
 


Commit: a84ebff6ba769b5669069b177933108217aa507f
    https://github.com/scummvm/scummvm/commit/a84ebff6ba769b5669069b177933108217aa507f
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:40:59+11:00

Commit Message:
ULTIMA: ULTIMA2: Fix treating attribute checks as BCD

Changed paths:
    engines/ultima/ultima2/console.cpp
    engines/ultima/ultima2/data/savegame.h
    engines/ultima/ultima2/logic/dungeon_logic.cpp
    engines/ultima/ultima2/logic/overworld_logic.cpp
    engines/ultima/ultima2/views/interactions/ready_weapon.cpp
    engines/ultima/ultima2/views/interactions/wear_armor.cpp


diff --git a/engines/ultima/ultima2/console.cpp b/engines/ultima/ultima2/console.cpp
index da7fb4e70bc..ae8bbebf3ca 100644
--- a/engines/ultima/ultima2/console.cpp
+++ b/engines/ultima/ultima2/console.cpp
@@ -306,10 +306,11 @@ bool Console::cmdInventory(int argc, const char **argv) {
 	sg._hp = sg._food = sg._gold = 9999;
 	sg._foodTurnCtr = 0;
 
-	// Equip the best that the character's strength and agility allow
+	// Equip the best that the character's strength and agility allow -
+	// mirrors ReadyWeapon/WearArmor's own BCD-byte comparisons
 	sg._readiedWeapon = Data::WEAPON_HANDS;
 	for (int i = Data::WEAPON_COUNT - 1; i > 0; --i) {
-		if (i * 8 < sg._agility) {
+		if (i * 8 < Data::toBcd(sg._agility)) {
 			sg._readiedWeapon = (Data::WeaponType)i;
 			break;
 		}
@@ -317,7 +318,7 @@ bool Console::cmdInventory(int argc, const char **argv) {
 
 	sg._readiedArmor = Data::ARMOR_SKIN;
 	for (int i = Data::ARMOR_COUNT - 1; i > 0; --i) {
-		if (i * 8 < sg._strength) {
+		if (i * 8 < Data::toBcd(sg._strength)) {
 			sg._readiedArmor = (Data::ArmorType)i;
 			break;
 		}
diff --git a/engines/ultima/ultima2/data/savegame.h b/engines/ultima/ultima2/data/savegame.h
index ae9ce8e443b..2d37c67c9f8 100644
--- a/engines/ultima/ultima2/data/savegame.h
+++ b/engines/ultima/ultima2/data/savegame.h
@@ -227,7 +227,9 @@ struct Savegame {
 	 * combined Intelligence+Charisma (a haggling mechanic)
 	 */
 	int computeItemPrice(int itemIndex) const {
-		int sum = _intelligence + _charisma;
+		// The original sums the raw packed-BCD Intelligence/Charisma bytes,
+		// not their decimal values, before counting bits below
+		int sum = toBcd(_intelligence) + toBcd(_charisma);
 		int bits = 0;
 		while (sum > 0) {
 			sum >>= 1;
diff --git a/engines/ultima/ultima2/logic/dungeon_logic.cpp b/engines/ultima/ultima2/logic/dungeon_logic.cpp
index 4e5a3bd76cb..6e0980b1e93 100644
--- a/engines/ultima/ultima2/logic/dungeon_logic.cpp
+++ b/engines/ultima/ultima2/logic/dungeon_logic.cpp
@@ -292,14 +292,16 @@ bool DungeonLogic::attack(Data::Direction dir) {
 		}
 	}
 
-	if (slot < 0 || (randByte() >> 1) >= sg._agility) {
+	// Both checks compare against the raw packed-BCD attribute bytes, not
+	// their decimal values, matching the original's own arithmetic
+	if (slot < 0 || (randByte() >> 1) >= Data::toBcd(sg._agility)) {
 		writeString("MISS\n");
 		return true;
 	}
 
 	playFX(Data::SFX_HIT);
 	writeString("HIT!");
-	int dmg = (sg._readiedWeapon * 8 + sg._strength) >> 2;
+	int dmg = (sg._readiedWeapon * 8 + Data::toBcd(sg._strength)) >> 2;
 	byte &hp = monsters._spellHP[slot];
 
 	if (hp <= dmg) {
diff --git a/engines/ultima/ultima2/logic/overworld_logic.cpp b/engines/ultima/ultima2/logic/overworld_logic.cpp
index 0915517e101..1632bc85707 100644
--- a/engines/ultima/ultima2/logic/overworld_logic.cpp
+++ b/engines/ultima/ultima2/logic/overworld_logic.cpp
@@ -483,7 +483,9 @@ bool OverworldLogic::attack(Data::Direction dir) {
 	int ty = (sg._mapY + dy + Data::MAP_HEIGHT) % Data::MAP_HEIGHT;
 	int slot = findTargetMonster(tx, ty);
 
-	if (slot < 0 || (randByte() >> 1) >= sg._agility) {
+	// Both checks compare against the raw packed-BCD attribute bytes, not
+	// their decimal values, matching the original's own arithmetic
+	if (slot < 0 || (randByte() >> 1) >= Data::toBcd(sg._agility)) {
 		writeString("--MISS\n");
 		resumeTurn();
 		return false;
@@ -493,7 +495,7 @@ bool OverworldLogic::attack(Data::Direction dir) {
 	writeString("--HIT!!!\n");
 	alertTownGuards(slot);
 
-	int dmg = (sg._readiedWeapon * 8 + sg._strength) >> 2;
+	int dmg = (sg._readiedWeapon * 8 + Data::toBcd(sg._strength)) >> 2;
 	Data::MapMonsters &monsters = _G(map)._monsters;
 	byte &hp = monsters._spellHP[slot];
 
diff --git a/engines/ultima/ultima2/views/interactions/ready_weapon.cpp b/engines/ultima/ultima2/views/interactions/ready_weapon.cpp
index 4587a366493..f17119b6bcb 100644
--- a/engines/ultima/ultima2/views/interactions/ready_weapon.cpp
+++ b/engines/ultima/ultima2/views/interactions/ready_weapon.cpp
@@ -44,7 +44,9 @@ bool ReadyWeapon::msgKeypress(const KeypressMessage &msg) {
 
 	if (digit != Data::WEAPON_HANDS && sg._weaponOwned[digit] == 0) {
 		writeString("%d\n%s NOT OWNED!\n", digit, Data::WEAPON_NAMES[digit]);
-	} else if (digit * 8 >= sg._agility) {
+	} else if (digit * 8 >= Data::toBcd(sg._agility)) {
+		// The original compares against the raw packed-BCD agility byte,
+		// not its decimal value - see WearArmor's equivalent check
 		writeString("%d\n<-THOU ART NOT AGILE ENOUGH TO WIELD!\n", digit);
 	} else {
 		sg._readiedWeapon = (Data::WeaponType)digit;
diff --git a/engines/ultima/ultima2/views/interactions/wear_armor.cpp b/engines/ultima/ultima2/views/interactions/wear_armor.cpp
index fdbbbf82621..de12aabc2ef 100644
--- a/engines/ultima/ultima2/views/interactions/wear_armor.cpp
+++ b/engines/ultima/ultima2/views/interactions/wear_armor.cpp
@@ -47,7 +47,10 @@ bool WearArmor::msgKeypress(const KeypressMessage &msg) {
 		writeString("%d\nNOT OWNED!\n", digit);
 	} else if (armorIdx != Data::ARMOR_SKIN && sg._armorOwned[armorIdx] == 0) {
 		writeString("%d\n%s NOT OWNED!\n", digit, Data::ARMOR_NAMES[armorIdx]);
-	} else if (armorIdx * 8 >= sg._strength) {
+	} else if (armorIdx * 8 >= Data::toBcd(sg._strength)) {
+		// The original compares against the raw packed-BCD strength byte,
+		// not its decimal value, so e.g. leather (index 2) needs strength
+		// 11+ (2*8=16 < BCD 0x11=17), not 17+
 		writeString("%d\n<-THOU ART NOT\nSTRONG ENOUGH TO WEAR!\n", digit);
 	} else {
 		sg._readiedArmor = (Data::ArmorType)armorIdx;


Commit: 8f6ce2a3fe3e16fc3a466788151ff1c47df76387
    https://github.com/scummvm/scummvm/commit/8f6ce2a3fe3e16fc3a466788151ff1c47df76387
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:40:59+11:00

Commit Message:
ULTIMA: ULTIMA2: Constrain inventory, gold, food to max

Prevent the original bug that the totals could roll over to zero.

Changed paths:
    engines/ultima/ultima2/data/data.h
    engines/ultima/ultima2/logic/city_castle_logic.cpp
    engines/ultima/ultima2/logic/dungeon_logic.cpp
    engines/ultima/ultima2/logic/logic.cpp
    engines/ultima/ultima2/logic/overworld_logic.cpp
    engines/ultima/ultima2/views/interactions/shop.cpp
    engines/ultima/ultima2/views/interactions/yell.cpp


diff --git a/engines/ultima/ultima2/data/data.h b/engines/ultima/ultima2/data/data.h
index ae37982976a..d6398682855 100644
--- a/engines/ultima/ultima2/data/data.h
+++ b/engines/ultima/ultima2/data/data.h
@@ -52,6 +52,14 @@ void setCGAPalette();
 
 constexpr int MAX_NAME_LENGTH = 12;
 
+// Ceilings for stats that round-trip through the original PLAYER file's
+// packed-BCD fields: items/weapons/armour/spells/torches/keys/thieves'
+// tools each use a single BCD byte (00-99), while food/gold/experience
+// use two (0000-9999). Gains are clamped at these rather than allowed to
+// overflow, unlike the original, which just rolls back around to 0
+constexpr int MAX_BCD_BYTE = 99;
+constexpr int MAX_BCD_WORD = 9999;
+
 enum Direction {
 	DIR_UP = 0, DIR_DOWN = 1, DIR_LEFT = 2, DIR_RIGHT = 3, DIR_UNSPECIFIED = 4
 };
diff --git a/engines/ultima/ultima2/logic/city_castle_logic.cpp b/engines/ultima/ultima2/logic/city_castle_logic.cpp
index 37ef9fcfb0a..a6362cce3b8 100644
--- a/engines/ultima/ultima2/logic/city_castle_logic.cpp
+++ b/engines/ultima/ultima2/logic/city_castle_logic.cpp
@@ -238,10 +238,12 @@ bool CityCastleLogic::steal(Data::Direction dir) {
 			noLuck();
 		} else if (sg._mapX >= 32) {
 			writeString("STEAL ARMOUR!\n");
-			++sg._armorOwned[1 + (randByte() & 3)];
+			int idx = 1 + (randByte() & 3);
+			sg._armorOwned[idx] = MIN(sg._armorOwned[idx] + 1, Data::MAX_BCD_BYTE);
 		} else {
 			writeString("STEAL WEAPONS!\n");
-			++sg._weaponOwned[1 + (randByte() & 7)];
+			int idx = 1 + (randByte() & 7);
+			sg._weaponOwned[idx] = MIN(sg._weaponOwned[idx] + 1, Data::MAX_BCD_BYTE);
 		}
 		break;
 	default: // Castle - never works
@@ -357,7 +359,7 @@ void CityCastleLogic::completeOffer(int goldHundreds) {
 			writeString("EARN THE RING!\n");
 		} else {
 			writeString("THE RING IS YOURS!\n");
-			++sg._items[Data::ITEM_RING];
+			sg._items[Data::ITEM_RING] = MIN(sg._items[Data::ITEM_RING] + 1, Data::MAX_BCD_BYTE);
 		}
 		break;
 
diff --git a/engines/ultima/ultima2/logic/dungeon_logic.cpp b/engines/ultima/ultima2/logic/dungeon_logic.cpp
index 6e0980b1e93..9470f9dcfcd 100644
--- a/engines/ultima/ultima2/logic/dungeon_logic.cpp
+++ b/engines/ultima/ultima2/logic/dungeon_logic.cpp
@@ -219,14 +219,14 @@ bool DungeonLogic::get() {
 	int level = sg._dungeonLevel;
 	if (level == MAX_LEVEL) {
 		writeString("TRI-LITHIUM!\n");
-		++sg._items[Data::ITEM_TRI_LITHIUM];
+		sg._items[Data::ITEM_TRI_LITHIUM] = MIN(sg._items[Data::ITEM_TRI_LITHIUM] + 1, Data::MAX_BCD_BYTE);
 		return true;
 	}
 
 	if (randByte() >= 0x40) {
 		writeString("GOLD!\n");
 		int amount = ((randByte() & 0x1F) + level * 2) & 0x77;
-		sg._gold = (sg._gold + Data::bcdValue(amount)) % 10000;
+		sg._gold = MIN(sg._gold + Data::bcdValue(amount), Data::MAX_BCD_WORD);
 		return true;
 	}
 
@@ -235,7 +235,7 @@ bool DungeonLogic::get() {
 		writeString("A  WEAPON");
 		int r = randByte() & 7;
 		if (r != 0) {
-			++sg._weaponOwned[r];
+			sg._weaponOwned[r] = MIN(sg._weaponOwned[r] + 1, Data::MAX_BCD_BYTE);
 			writeString("\n");
 			return true;
 		}
@@ -243,7 +243,7 @@ bool DungeonLogic::get() {
 		writeString(" ARMOUR");
 		int r = randByte() & 3;
 		if (r != 0) {
-			++sg._armorOwned[r];
+			sg._armorOwned[r] = MIN(sg._armorOwned[r] + 1, Data::MAX_BCD_BYTE);
 			writeString("\n");
 			return true;
 		}
@@ -264,11 +264,11 @@ void DungeonLogic::killMonster(int slot) {
 
 	int gold = Data::bcdValue((randByte() & 0x17) | 1);
 	writeString("\nKILLED--GOLD+%.2d", gold);
-	sg._gold = (sg._gold + gold) % 10000;
+	sg._gold = MIN(sg._gold + gold, Data::MAX_BCD_WORD);
 
 	int exp = randByte() & 7;
 	writeString("--EXP.+%.2d\n", exp);
-	sg._experience = (sg._experience + exp) % 10000;
+	sg._experience = MIN(sg._experience + exp, Data::MAX_BCD_WORD);
 }
 
 bool DungeonLogic::attack(Data::Direction dir) {
diff --git a/engines/ultima/ultima2/logic/logic.cpp b/engines/ultima/ultima2/logic/logic.cpp
index 7525352e6af..a5cfb0ecae5 100644
--- a/engines/ultima/ultima2/logic/logic.cpp
+++ b/engines/ultima/ultima2/logic/logic.cpp
@@ -398,7 +398,7 @@ bool Logic::get() {
 		writeString(" WEAPON");
 		int r = randByte() & 7;
 		if (r != 0) {
-			++sg._weaponOwned[r];
+			sg._weaponOwned[r] = MIN(sg._weaponOwned[r] + 1, Data::MAX_BCD_BYTE);
 			writeString("\n");
 			return true;
 		}
@@ -406,7 +406,7 @@ bool Logic::get() {
 		writeString(" ARMOUR");
 		int r = randByte() & 3;
 		if (r != 0) {
-			++sg._armorOwned[r];
+			sg._armorOwned[r] = MIN(sg._armorOwned[r] + 1, Data::MAX_BCD_BYTE);
 			writeString("\n");
 			return true;
 		}
diff --git a/engines/ultima/ultima2/logic/overworld_logic.cpp b/engines/ultima/ultima2/logic/overworld_logic.cpp
index 1632bc85707..eda6151ad2e 100644
--- a/engines/ultima/ultima2/logic/overworld_logic.cpp
+++ b/engines/ultima/ultima2/logic/overworld_logic.cpp
@@ -673,29 +673,29 @@ void OverworldLogic::killMonster(int slot) {
 
 	switch (monsterTile) {
 	case Data::TILE_GUARD:
-		sg._keys += 2;
+		sg._keys = MIN(sg._keys + 2, Data::MAX_BCD_BYTE);
 		break;
 
 	case Data::TILE_THIEF: {
 		if (randByte() < 0x40)
-			++sg._thievesTools;
+			sg._thievesTools = MIN(sg._thievesTools + 1, Data::MAX_BCD_BYTE);
 		int itemIdx = randByte() & 0xF;
 		if (itemIdx != 0)
-			++sg._items[itemIdx];
+			sg._items[itemIdx] = MIN(sg._items[itemIdx] + 1, Data::MAX_BCD_BYTE);
 		break;
 	}
 
 	case Data::TILE_FIGHTER:
 		if (randByte() < 0x40)
-			++sg._items[Data::ITEM_HELM];
-		sg._torches += (randByte() & 3) + 1;
+			sg._items[Data::ITEM_HELM] = MIN(sg._items[Data::ITEM_HELM] + 1, Data::MAX_BCD_BYTE);
+		sg._torches = MIN(sg._torches + (randByte() & 3) + 1, Data::MAX_BCD_BYTE);
 		break;
 
 	case Data::TILE_MAGE:
 		if ((randByte() & 1) == 0)
-			++sg._items[Data::ITEM_WAND];
+			sg._items[Data::ITEM_WAND] = MIN(sg._items[Data::ITEM_WAND] + 1, Data::MAX_BCD_BYTE);
 		else
-			++sg._items[Data::ITEM_STAFF];
+			sg._items[Data::ITEM_STAFF] = MIN(sg._items[Data::ITEM_STAFF] + 1, Data::MAX_BCD_BYTE);
 		break;
 
 	default:
@@ -705,8 +705,8 @@ void OverworldLogic::killMonster(int slot) {
 	// The original keeps and prints these as two BCD digits
 	int goldAmt = Data::bcdValue((randByte() & 0x17) | 1);
 	int expAmt = (randByte() & 3) + 1;
-	sg._gold += goldAmt;
-	sg._experience += expAmt;
+	sg._gold = MIN(sg._gold + goldAmt, Data::MAX_BCD_WORD);
+	sg._experience = MIN(sg._experience + expAmt, Data::MAX_BCD_WORD);
 	writeString("KILLED--GOLD+%.2d--EXP.+%.2d\n", goldAmt, expAmt);
 }
 
diff --git a/engines/ultima/ultima2/views/interactions/shop.cpp b/engines/ultima/ultima2/views/interactions/shop.cpp
index 93841a004ee..faf434bc22b 100644
--- a/engines/ultima/ultima2/views/interactions/shop.cpp
+++ b/engines/ultima/ultima2/views/interactions/shop.cpp
@@ -129,9 +129,9 @@ void Shop::confirm(char key) {
 			writeString("OH, WELL.\n");
 		} else if (_G(logic)->trySpendGold(_price)) {
 			if (_kind == WEAPON)
-				++sg._weaponOwned[_item];
+				sg._weaponOwned[_item] = MIN(sg._weaponOwned[_item] + 1, Data::MAX_BCD_BYTE);
 			else
-				++sg._armorOwned[_item];
+				sg._armorOwned[_item] = MIN(sg._armorOwned[_item] + 1, Data::MAX_BCD_BYTE);
 			writeString("SOLD!\n");
 		}
 		break;
@@ -142,7 +142,7 @@ void Shop::confirm(char key) {
 		} else {
 			writeString("YES,\nI WILL TAKE 5!");
 			if (_G(logic)->trySpendGold(_price)) {
-				sg._spellCharges[_item] += 5;
+				sg._spellCharges[_item] = MIN(sg._spellCharges[_item] + 5, Data::MAX_BCD_BYTE);
 				writeString("\n");
 			}
 		}
@@ -154,7 +154,7 @@ void Shop::confirm(char key) {
 		} else {
 			writeString("YES\n");
 			if (_G(logic)->trySpendGold(_price)) {
-				sg._spellCharges[_item] += 5;
+				sg._spellCharges[_item] = MIN(sg._spellCharges[_item] + 5, Data::MAX_BCD_BYTE);
 				writeString("GULE GULE!\n");
 			}
 		}
diff --git a/engines/ultima/ultima2/views/interactions/yell.cpp b/engines/ultima/ultima2/views/interactions/yell.cpp
index 50622b49257..e2a0f3f6c42 100644
--- a/engines/ultima/ultima2/views/interactions/yell.cpp
+++ b/engines/ultima/ultima2/views/interactions/yell.cpp
@@ -48,9 +48,8 @@ bool Yell::msgKeypress(const KeypressMessage &msg) {
 				sg._mount == 0) {
 			writeString("The universe whisks you away.\n");
 
-			// A parting gift; items are stored as two BCD digits, so 99 is the highest they can go
-			if (sg._items[Data::ITEM_HELM] < 99)
-				++sg._items[Data::ITEM_HELM];
+			// A parting gift
+			sg._items[Data::ITEM_HELM] = MIN(sg._items[Data::ITEM_HELM] + 1, Data::MAX_BCD_BYTE);
 
 			// Show the ScummVM secret map
 			sg._overworldReturnX = sg._mapX;


Commit: 938cafce02044e64aa5b254c54f5c700d1a637eb
    https://github.com/scummvm/scummvm/commit/938cafce02044e64aa5b254c54f5c700d1a637eb
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:40:59+11:00

Commit Message:
ULTIMA: ULTIMA2: Fix bugs fixed in Ultima 2 Update Patch

Fixes vendor prices, Alakazam attribute map, moongate terrain
corruption.

Changed paths:
    engines/ultima/ultima2/data/map.cpp
    engines/ultima/ultima2/data/map.h
    engines/ultima/ultima2/data/savegame.h
    engines/ultima/ultima2/logic/city_castle_logic.cpp
    engines/ultima/ultima2/logic/overworld_logic.cpp


diff --git a/engines/ultima/ultima2/data/map.cpp b/engines/ultima/ultima2/data/map.cpp
index bf792adf035..bc05e4a66f9 100644
--- a/engines/ultima/ultima2/data/map.cpp
+++ b/engines/ultima/ultima2/data/map.cpp
@@ -79,6 +79,16 @@ void Map::loadTalk(int mapEra, int mapType) {
 	}
 }
 
+bool Map::canLoad(int mapEra, int mapType) const {
+	Common::File f;
+	if (!f.open(mapFilename(mapEra, mapType).c_str()))
+		return false;
+
+	// Towers/dungeons use a different on-disk layout than the fixed-size
+	// overworld/town/castle grid, so only their existence is checked here
+	return (mapType >= 4 && mapType != 9) || f.size() == MAP_WIDTH * MAP_HEIGHT;
+}
+
 void Map::load(int mapEra, int mapType) {
 	if (mapType >= 4 && mapType != 9) {
 		loadDungeon(mapEra, mapType);
diff --git a/engines/ultima/ultima2/data/map.h b/engines/ultima/ultima2/data/map.h
index d3a136c4b47..caa5c06c960 100644
--- a/engines/ultima/ultima2/data/map.h
+++ b/engines/ultima/ultima2/data/map.h
@@ -68,6 +68,17 @@ private:
 public:
 	void load(int mapEra, int mapType);
 
+	/**
+	 * Checks that a map's file exists and, for overworld/town/castle maps,
+	 * is the right size, without actually loading it. The original's
+	 * moongate travel reloads the target era unconditionally and can show
+	 * corrupted terrain if that era's data turns out to be missing or
+	 * truncated; callers doing an unprompted map switch (moongate travel,
+	 * not a player-chosen destination) can check this first and bail out
+	 * instead
+	 */
+	bool canLoad(int mapEra, int mapType) const;
+
 	/**
 	 * Saves or restores the current map's contents and monsters as they
 	 * are now, including changes made during play. Loading expects the
diff --git a/engines/ultima/ultima2/data/savegame.h b/engines/ultima/ultima2/data/savegame.h
index 2d37c67c9f8..db3f92d213f 100644
--- a/engines/ultima/ultima2/data/savegame.h
+++ b/engines/ultima/ultima2/data/savegame.h
@@ -227,9 +227,15 @@ struct Savegame {
 	 * combined Intelligence+Charisma (a haggling mechanic)
 	 */
 	int computeItemPrice(int itemIndex) const {
-		// The original sums the raw packed-BCD Intelligence/Charisma bytes,
-		// not their decimal values, before counting bits below
-		int sum = toBcd(_intelligence) + toBcd(_charisma);
+		// The original sums the raw packed-BCD Intelligence/Charisma bytes
+		// with no decimal adjustment, so a combined score of 100+ lands on
+		// an invalid byte and produces too small a discount. The 1989
+		// "Ultima II Upgrade" patch fixes this by decimal-adjusting the sum
+		// and clamping it to the highest valid BCD byte (0x99) instead;
+		// since a properly decimal-adjusted BCD byte's integer value is
+		// just its own toBcd() encoding, that's the same as clamping the
+		// true decimal sum to 99 before re-encoding it here
+		int sum = toBcd(MIN(_intelligence + _charisma, MAX_BCD_BYTE));
 		int bits = 0;
 		while (sum > 0) {
 			sum >>= 1;
diff --git a/engines/ultima/ultima2/logic/city_castle_logic.cpp b/engines/ultima/ultima2/logic/city_castle_logic.cpp
index a6362cce3b8..d15ca24df87 100644
--- a/engines/ultima/ultima2/logic/city_castle_logic.cpp
+++ b/engines/ultima/ultima2/logic/city_castle_logic.cpp
@@ -379,8 +379,12 @@ void CityCastleLogic::completeOffer(int goldHundreds) {
 				&sg._strength, &sg._agility, &sg._stamina,
 				&sg._charisma, &sg._wisdom, &sg._intelligence
 			};
-			// Attributes are two BCD digits, so a big boost wraps around
-			*attrs[stat] = (*attrs[stat] + 4 * goldHundreds) % 100;
+			// The original adds goldHundreds in 4 unclamped BCD steps, so a
+			// big enough boost wraps back down past 0. The 1989 "Ultima II
+			// Upgrade" patch clamps each of the 4 steps to 99 instead;
+			// since the same amount is added every step, clamping the
+			// combined total once here gives the same result
+			*attrs[stat] = (int16)MIN(*attrs[stat] + 4 * goldHundreds, Data::MAX_BCD_BYTE);
 			writeString("ALAKAZAM!\n");
 		}
 		break;
diff --git a/engines/ultima/ultima2/logic/overworld_logic.cpp b/engines/ultima/ultima2/logic/overworld_logic.cpp
index eda6151ad2e..f77000edddd 100644
--- a/engines/ultima/ultima2/logic/overworld_logic.cpp
+++ b/engines/ultima/ultima2/logic/overworld_logic.cpp
@@ -199,7 +199,6 @@ bool OverworldLogic::move(Data::Direction dir) {
 
 void OverworldLogic::enterMoongate(int x, int y) {
 	Data::Savegame &sg = _G(savegame);
-	_G(map)._tiles[y][x] = (Data::TileId)sg._patrolTerrain;
 
 	// Each waypoint leads to a different one of the other eras, arriving
 	// at that era's moongate for the same waypoint
@@ -208,6 +207,15 @@ void OverworldLogic::enterMoongate(int x, int y) {
 	if (era >= sg._mapEra)
 		++era;
 
+	// The original reloads the target era unconditionally here, which can
+	// show corrupted terrain if that era's map data turns out to be
+	// missing or truncated; bail out untouched rather than risk the same
+	if (!_G(map).canLoad(era, 0)) {
+		writeString("THE GATE FLICKERS AND FAILS!\n");
+		return;
+	}
+
+	_G(map)._tiles[y][x] = (Data::TileId)sg._patrolTerrain;
 	sg._mapEra = era;
 	_G(map).load(era, 0);
 


Commit: eb37e1fa0f2f2c59af377fb2f69197009a74b28f
    https://github.com/scummvm/scummvm/commit/eb37e1fa0f2f2c59af377fb2f69197009a74b28f
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:40:59+11:00

Commit Message:
ULTIMA: ULTIMA2: Adding files from upgrade patch

Changed paths:
  A devtools/create_ultima/files/ultima2/cgacomp.pal
  A devtools/create_ultima/files/ultima2/cgatiles
  A devtools/create_ultima/files/ultima2/egatheme.10/egacolor
  A devtools/create_ultima/files/ultima2/egatheme.10/egatiles
  A devtools/create_ultima/files/ultima2/egatheme.10/picdng.ega
  A devtools/create_ultima/files/ultima2/egatheme.10/picspa.ega
  A devtools/create_ultima/files/ultima2/egatheme.alt/egatiles
  A devtools/create_ultima/files/ultima2/egatheme.c64/egacolor
  A devtools/create_ultima/files/ultima2/egatheme.c64/egatiles
  A devtools/create_ultima/files/ultima2/egatheme.c64/picdng.ega
  A devtools/create_ultima/files/ultima2/egatheme.c64/picspa.ega
  A devtools/create_ultima/files/ultima2/egatiles
  A devtools/create_ultima/files/ultima2/piccas
  A devtools/create_ultima/files/ultima2/piccas.idx
  A devtools/create_ultima/files/ultima2/picdng.ega
  A devtools/create_ultima/files/ultima2/picdra.ega
  A devtools/create_ultima/files/ultima2/picmin.idx
  A devtools/create_ultima/files/ultima2/picout.idx
  A devtools/create_ultima/files/ultima2/picspa.ega
  A devtools/create_ultima/files/ultima2/pictwn.idx
  A devtools/create_ultima/files/ultima2/version.txt
    engines/ultima/ultima2/ultima2.cpp


diff --git a/devtools/create_ultima/files/ultima2/cgacomp.pal b/devtools/create_ultima/files/ultima2/cgacomp.pal
new file mode 100644
index 00000000000..0ec7488a05b
Binary files /dev/null and b/devtools/create_ultima/files/ultima2/cgacomp.pal differ
diff --git a/devtools/create_ultima/files/ultima2/cgatiles b/devtools/create_ultima/files/ultima2/cgatiles
new file mode 100644
index 00000000000..44fd8378686
Binary files /dev/null and b/devtools/create_ultima/files/ultima2/cgatiles differ
diff --git a/devtools/create_ultima/files/ultima2/egatheme.10/egacolor b/devtools/create_ultima/files/ultima2/egatheme.10/egacolor
new file mode 100644
index 00000000000..6f6a5aae784
Binary files /dev/null and b/devtools/create_ultima/files/ultima2/egatheme.10/egacolor differ
diff --git a/devtools/create_ultima/files/ultima2/egatheme.10/egatiles b/devtools/create_ultima/files/ultima2/egatheme.10/egatiles
new file mode 100644
index 00000000000..afe6ec91710
Binary files /dev/null and b/devtools/create_ultima/files/ultima2/egatheme.10/egatiles differ
diff --git a/devtools/create_ultima/files/ultima2/egatheme.10/picdng.ega b/devtools/create_ultima/files/ultima2/egatheme.10/picdng.ega
new file mode 100644
index 00000000000..8340aebff02
Binary files /dev/null and b/devtools/create_ultima/files/ultima2/egatheme.10/picdng.ega differ
diff --git a/devtools/create_ultima/files/ultima2/egatheme.10/picspa.ega b/devtools/create_ultima/files/ultima2/egatheme.10/picspa.ega
new file mode 100644
index 00000000000..e65e7c8d11a
Binary files /dev/null and b/devtools/create_ultima/files/ultima2/egatheme.10/picspa.ega differ
diff --git a/devtools/create_ultima/files/ultima2/egatheme.alt/egatiles b/devtools/create_ultima/files/ultima2/egatheme.alt/egatiles
new file mode 100644
index 00000000000..2f459664abc
Binary files /dev/null and b/devtools/create_ultima/files/ultima2/egatheme.alt/egatiles differ
diff --git a/devtools/create_ultima/files/ultima2/egatheme.c64/egacolor b/devtools/create_ultima/files/ultima2/egatheme.c64/egacolor
new file mode 100644
index 00000000000..dd8c528368e
Binary files /dev/null and b/devtools/create_ultima/files/ultima2/egatheme.c64/egacolor differ
diff --git a/devtools/create_ultima/files/ultima2/egatheme.c64/egatiles b/devtools/create_ultima/files/ultima2/egatheme.c64/egatiles
new file mode 100644
index 00000000000..1405bbd5b4b
Binary files /dev/null and b/devtools/create_ultima/files/ultima2/egatheme.c64/egatiles differ
diff --git a/devtools/create_ultima/files/ultima2/egatheme.c64/picdng.ega b/devtools/create_ultima/files/ultima2/egatheme.c64/picdng.ega
new file mode 100644
index 00000000000..60594a00425
Binary files /dev/null and b/devtools/create_ultima/files/ultima2/egatheme.c64/picdng.ega differ
diff --git a/devtools/create_ultima/files/ultima2/egatheme.c64/picspa.ega b/devtools/create_ultima/files/ultima2/egatheme.c64/picspa.ega
new file mode 100644
index 00000000000..e703ca297c3
Binary files /dev/null and b/devtools/create_ultima/files/ultima2/egatheme.c64/picspa.ega differ
diff --git a/devtools/create_ultima/files/ultima2/egatiles b/devtools/create_ultima/files/ultima2/egatiles
new file mode 100644
index 00000000000..22b1dcb5c0a
Binary files /dev/null and b/devtools/create_ultima/files/ultima2/egatiles differ
diff --git a/devtools/create_ultima/files/ultima2/piccas b/devtools/create_ultima/files/ultima2/piccas
new file mode 100644
index 00000000000..975178f470a
Binary files /dev/null and b/devtools/create_ultima/files/ultima2/piccas differ
diff --git a/devtools/create_ultima/files/ultima2/piccas.idx b/devtools/create_ultima/files/ultima2/piccas.idx
new file mode 100644
index 00000000000..a1cd51a1f88
--- /dev/null
+++ b/devtools/create_ultima/files/ultima2/piccas.idx
@@ -0,0 +1 @@
+xxxx¬¸ÄŒ|„Ä Ì Èœxxxxxppppppppppppxxüppppì|èpppppüxxppxpppTlTppppxppxxppppp`ppppp`ppppppxxppppppppðpppppppppxxppppppppppppppppppxxpppxppôpppôpppxpppxxppppøppppppppøppppxxppppppppppppppppppx
\ No newline at end of file
diff --git a/devtools/create_ultima/files/ultima2/picdng.ega b/devtools/create_ultima/files/ultima2/picdng.ega
new file mode 100644
index 00000000000..8340aebff02
Binary files /dev/null and b/devtools/create_ultima/files/ultima2/picdng.ega differ
diff --git a/devtools/create_ultima/files/ultima2/picdra.ega b/devtools/create_ultima/files/ultima2/picdra.ega
new file mode 100644
index 00000000000..01e821ac1e2
Binary files /dev/null and b/devtools/create_ultima/files/ultima2/picdra.ega differ
diff --git a/devtools/create_ultima/files/ultima2/picmin.idx b/devtools/create_ultima/files/ultima2/picmin.idx
new file mode 100644
index 00000000000..2503fa25051
Binary files /dev/null and b/devtools/create_ultima/files/ultima2/picmin.idx differ
diff --git a/devtools/create_ultima/files/ultima2/picout.idx b/devtools/create_ultima/files/ultima2/picout.idx
new file mode 100644
index 00000000000..c5593857d05
Binary files /dev/null and b/devtools/create_ultima/files/ultima2/picout.idx differ
diff --git a/devtools/create_ultima/files/ultima2/picspa.ega b/devtools/create_ultima/files/ultima2/picspa.ega
new file mode 100644
index 00000000000..351184b9f86
Binary files /dev/null and b/devtools/create_ultima/files/ultima2/picspa.ega differ
diff --git a/devtools/create_ultima/files/ultima2/pictwn.idx b/devtools/create_ultima/files/ultima2/pictwn.idx
new file mode 100644
index 00000000000..419c21c8dea
--- /dev/null
+++ b/devtools/create_ultima/files/ultima2/pictwn.idx
@@ -0,0 +1 @@
+xÈØ€Èœ„Ј¨¬ÄÈxxpppppphppppppxx¼Ð„|€´Œ|¼ ää€xxpppppppppppppxxpì||èpðpppppppxpppppppppppppxxxxxxxxpxxxxxxxxpppìxpppxpppìxx|èpp ppp ppì|x
\ No newline at end of file
diff --git a/devtools/create_ultima/files/ultima2/version.txt b/devtools/create_ultima/files/ultima2/version.txt
new file mode 100644
index 00000000000..9f8e9b69a33
--- /dev/null
+++ b/devtools/create_ultima/files/ultima2/version.txt
@@ -0,0 +1 @@
+1.0
\ No newline at end of file
diff --git a/engines/ultima/ultima2/ultima2.cpp b/engines/ultima/ultima2/ultima2.cpp
index 5957d077186..a30ce52ee99 100644
--- a/engines/ultima/ultima2/ultima2.cpp
+++ b/engines/ultima/ultima2/ultima2.cpp
@@ -20,6 +20,7 @@
  */
 
 #include "common/system.h"
+#include "common/engine_data.h"
 #include "common/savefile.h"
 #include "engines/util.h"
 #include "audio/softsynth/pcspk.h"
@@ -73,6 +74,13 @@ Common::Error Ultima2Engine::run() {
 	_rngState[0]++;
 	_rngState[1]++;
 
+	// Initialise engine data for the game
+	Common::U32String errMsg;
+	if (!Common::load_engine_data("ultima.dat", "ultima2", 1, 0, errMsg)) {
+		GUIErrorMessage(errMsg);
+		return Common::kNoError;
+	}
+
 	// Set up secret map
 	SearchMan.add("Secret", new Data::SecretMapArchive());
 


Commit: 8b287c397306425b94ca8d80479705ce548be052
    https://github.com/scummvm/scummvm/commit/8b287c397306425b94ca8d80479705ce548be052
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:40:59+11:00

Commit Message:
ULTIMA: ULTIMA2: Implementing graphics modes from the Upgrade Patch

Changed paths:
    engines/ultima/ultima2/console.cpp
    engines/ultima/ultima2/data/data.cpp
    engines/ultima/ultima2/data/data.h
    engines/ultima/ultima2/data/tiles.cpp
    engines/ultima/ultima2/data/tiles.h
    engines/ultima/ultima2/ultima2.cpp
    engines/ultima/ultima2/ultima2.h
    engines/ultima/ultima2/views/ending.cpp
    engines/ultima/ultima2/views/location_map.cpp
    engines/ultima/ultima2/views/location_map.h
    engines/ultima/ultima2/views/map.h
    engines/ultima/ultima2/views/overworld_map.cpp
    engines/ultima/ultima2/views/overworld_map.h
    engines/ultima/ultima2/views/title.cpp


diff --git a/engines/ultima/ultima2/console.cpp b/engines/ultima/ultima2/console.cpp
index ae8bbebf3ca..3aac75b6ffc 100644
--- a/engines/ultima/ultima2/console.cpp
+++ b/engines/ultima/ultima2/console.cpp
@@ -90,7 +90,7 @@ bool Console::cmdMap(int argc, const char **argv) {
 
 bool Console::cmdTiles(int argc, const char **argv) {
 	Graphics::Surface tiles[Data::TILE_COUNT];
-	Data::loadTiles(tiles);
+	Data::loadTiles(tiles, g_engine->getRenderMode());
 
 	debugPrintf("Loaded %d tiles\n", Data::TILE_COUNT);
 	for (int t = 0; t < Data::TILE_COUNT; ++t) {
diff --git a/engines/ultima/ultima2/data/data.cpp b/engines/ultima/ultima2/data/data.cpp
index 07ac74f5955..05a47b3b2fa 100644
--- a/engines/ultima/ultima2/data/data.cpp
+++ b/engines/ultima/ultima2/data/data.cpp
@@ -34,6 +34,33 @@ const byte CGA_PALETTE1[4 * 3] = {
 	0xff, 0xff, 0xff  // 3: white
 };
 
+const char *const RENDER_MODE_NAMES[RENDER_MODE_COUNT] = {
+	"ORIGINAL", "EGA", "EGA (V1.0)", "EGA (WILTSHIRE)", "EGA (C64)"
+};
+
+// The standard 16-color EGA/VGA palette, confirmed as the one ega.drv
+// relies on (via the BIOS's default mode 13h palette, rather than
+// loading its own - see docs/enhanced-patch.md §3.6) - EGATILES' pixel
+// values are literal indices into this
+const byte EGA_PALETTE16[EGA_PALETTE_SIZE * 3] = {
+	0x00, 0x00, 0x00, // 0: black
+	0x00, 0x00, 0xaa, // 1: blue
+	0x00, 0xaa, 0x00, // 2: green
+	0x00, 0xaa, 0xaa, // 3: cyan
+	0xaa, 0x00, 0x00, // 4: red
+	0xaa, 0x00, 0xaa, // 5: magenta
+	0xaa, 0x55, 0x00, // 6: brown
+	0xaa, 0xaa, 0xaa, // 7: light gray
+	0x55, 0x55, 0x55, // 8: dark gray
+	0x55, 0x55, 0xff, // 9: light blue
+	0x55, 0xff, 0x55, // 10: light green
+	0x55, 0xff, 0xff, // 11: light cyan
+	0xff, 0x55, 0x55, // 12: light red
+	0xff, 0x55, 0xff, // 13: light magenta
+	0xff, 0xff, 0x55, // 14: yellow
+	0xff, 0xff, 0xff  // 15: white
+};
+
 const char *const PLANET_NAMES[PLANET_COUNT] = {
 	"EARTH", "MERCURY", "VENUS", "MARS", "JUPITER", "SATURN", "URANUS", "NEPTUNE", "PLUTO"
 };
@@ -43,12 +70,14 @@ const byte PLANET_COORDS[PLANET_COUNT + 1][3] = {
 	{ 2, 8, 5 }, { 9, 4, 6 }, { 4, 0, 5 }, { 0, 1, 4 }, { 9, 9, 9 }
 };
 
-void setCGAPalette() {
-	Graphics::Palette palette(PALETTE_PLAYER_MARKER + 1);
+void setPalette() {
+	Graphics::Palette palette(EGA_PALETTE_BASE + EGA_PALETTE_SIZE);
 	palette.set(CGA_PALETTE1, 0, 4);
 
 	const byte green[3] = { 0x55, 0xff, 0x55 };
 	palette.set(green, PALETTE_PLAYER_MARKER, 1);
+
+	palette.set(EGA_PALETTE16, EGA_PALETTE_BASE, EGA_PALETTE_SIZE);
 	g_system->getPaletteManager()->setPalette(palette);
 }
 
diff --git a/engines/ultima/ultima2/data/data.h b/engines/ultima/ultima2/data/data.h
index d6398682855..9c4556b2f3f 100644
--- a/engines/ultima/ultima2/data/data.h
+++ b/engines/ultima/ultima2/data/data.h
@@ -36,6 +36,27 @@ extern const byte CGA_PALETTE1[4 * 3];
 // dungeon minimap's player marker
 constexpr int PALETTE_PLAYER_MARKER = 4;
 
+// The "Ultima II Upgrade" fan patch's alternate renderers: each is VGA
+// mode 13h under the hood (not real EGA hardware - see
+// docs/enhanced-patch.md §3.6-3.8), using 16-of-256 palette entries and
+// tile/picture data from EGATILES-format files instead of the CGA
+// tileset embedded in the EXE. The EGA_* themes are pure data swaps
+// (alternate EGATILES/EGACOLOR/picture files), not different rendering
+// logic
+enum RenderMode {
+	RENDER_CGA = 0, RENDER_EGA = 1, RENDER_EGA_V1 = 2, RENDER_EGA_WILTSHIRE = 3,
+	RENDER_EGA_C64 = 4, RENDER_MODE_COUNT = 5
+};
+extern const char *const RENDER_MODE_NAMES[RENDER_MODE_COUNT];
+
+// The EGA-family renderers' 16-color palette occupies this range, kept
+// well away from CGA_PALETTE1/PALETTE_PLAYER_MARKER (indices 0-4) so
+// CGA-drawn chrome (text, the pic??? title art) keeps rendering
+// correctly no matter which renderer's tiles are currently active
+constexpr int EGA_PALETTE_BASE = 16;
+constexpr int EGA_PALETTE_SIZE = 16;
+extern const byte EGA_PALETTE16[EGA_PALETTE_SIZE * 3];
+
 // Names of the worlds that can be orbited, indexed by Savegame::_orbitTarget
 constexpr int PLANET_COUNT = 9;
 extern const char *const PLANET_NAMES[PLANET_COUNT];
@@ -45,10 +66,12 @@ extern const char *const PLANET_NAMES[PLANET_COUNT];
 extern const byte PLANET_COORDS[PLANET_COUNT + 1][3];
 
 /**
- * Switches the screen to the CGA palette that the game itself, the tile
- * graphics and the pic??? art all use
+ * Switches the screen to the palette the game needs: CGA_PALETTE1 plus
+ * the player-marker green at their fixed low indices (always active, so
+ * CGA-drawn chrome keeps working in any render mode), plus EGA_PALETTE16
+ * at EGA_PALETTE_BASE for whichever EGA-family renderer is active
  */
-void setCGAPalette();
+void setPalette();
 
 constexpr int MAX_NAME_LENGTH = 12;
 
diff --git a/engines/ultima/ultima2/data/tiles.cpp b/engines/ultima/ultima2/data/tiles.cpp
index 716354aadbb..2dd5513b2ac 100644
--- a/engines/ultima/ultima2/data/tiles.cpp
+++ b/engines/ultima/ultima2/data/tiles.cpp
@@ -52,7 +52,65 @@ static void decodeTileRecord(const byte record[TILE_RECORD_SIZE], SurfaceT &surf
 	}
 }
 
-void loadTiles(Graphics::Surface tiles[TILE_COUNT]) {
+// EGATILES-format files (see docs/enhanced-patch.md §3.8): 65 headerless
+// 128-byte records (the 64 tiles, same order as TileId, plus the attack
+// sprite as a 65th), 4 bits/pixel, 8 bytes/row x 16 rows, high nibble
+// first. Pixel values are literal EGA_PALETTE16 indices, so they're
+// offset by EGA_PALETTE_BASE to land in that palette's reserved range
+constexpr int EGA_RECORD_SIZE = 128;
+constexpr int EGA_ATTACK_SPRITE_RECORD = 64;
+
+template<typename SurfaceT>
+static void decodeEgaTileRecord(const byte record[EGA_RECORD_SIZE], SurfaceT &surf) {
+	surf.create(TILE_WIDTH, TILE_HEIGHT, Graphics::PixelFormat::createFormatCLUT8());
+	byte *dst = (byte *)surf.getPixels();
+
+	for (int row = 0; row < TILE_HEIGHT; ++row) {
+		for (int b = 0; b < TILE_WIDTH / 2; ++b) {
+			byte v = record[row * 8 + b];
+			dst[row * TILE_WIDTH + b * 2 + 0] = EGA_PALETTE_BASE + ((v >> 4) & 0xF);
+			dst[row * TILE_WIDTH + b * 2 + 1] = EGA_PALETTE_BASE + (v & 0xF);
+		}
+	}
+}
+
+// The base EGA tileset lives at the data root; each "theme" is an
+// alternate EGATILES file in its own subfolder (confirmed pure data
+// swaps, no code differences - see docs/enhanced-patch.md §3.6)
+static Common::String egaTilesFilename(RenderMode mode) {
+	switch (mode) {
+	case RENDER_EGA_V1:
+		return "egatheme.10/egatiles";
+	case RENDER_EGA_WILTSHIRE:
+		return "egatheme.alt/egatiles";
+	case RENDER_EGA_C64:
+		return "egatheme.c64/egatiles";
+	default:
+		return "egatiles";
+	}
+}
+
+static void loadEgaTiles(Graphics::Surface tiles[TILE_COUNT], RenderMode mode) {
+	Common::File f;
+	Common::String filename = egaTilesFilename(mode);
+	if (!f.open(filename.c_str()))
+		error("Could not open %s", filename.c_str());
+
+	for (int t = 0; t < TILE_COUNT; ++t) {
+		byte record[EGA_RECORD_SIZE];
+		if (f.read(record, EGA_RECORD_SIZE) != (uint32)EGA_RECORD_SIZE)
+			error("Could not read tile %d from %s", t, filename.c_str());
+
+		decodeEgaTileRecord(record, tiles[t]);
+	}
+}
+
+void loadTiles(Graphics::Surface tiles[TILE_COUNT], RenderMode mode) {
+	if (mode != RENDER_CGA) {
+		loadEgaTiles(tiles, mode);
+		return;
+	}
+
 	Common::File f;
 	if (!f.open("ULTIMAII.EXE"))
 		error("Could not open ULTIMAII.EXE");
@@ -68,8 +126,23 @@ void loadTiles(Graphics::Surface tiles[TILE_COUNT]) {
 	}
 }
 
-void loadAttackSprite(Graphics::ManagedSurface &sprite) {
+void loadAttackSprite(Graphics::ManagedSurface &sprite, RenderMode mode) {
 	Common::File f;
+
+	if (mode != RENDER_CGA) {
+		Common::String filename = egaTilesFilename(mode);
+		if (!f.open(filename.c_str()))
+			error("Could not open %s", filename.c_str());
+
+		f.seek(EGA_ATTACK_SPRITE_RECORD * EGA_RECORD_SIZE);
+		byte record[EGA_RECORD_SIZE];
+		if (f.read(record, EGA_RECORD_SIZE) != (uint32)EGA_RECORD_SIZE)
+			error("Could not read attack sprite from %s", filename.c_str());
+
+		decodeEgaTileRecord(record, sprite);
+		return;
+	}
+
 	if (!f.open("ULTIMAII.EXE"))
 		error("Could not open ULTIMAII.EXE");
 
diff --git a/engines/ultima/ultima2/data/tiles.h b/engines/ultima/ultima2/data/tiles.h
index d62f8a046b3..a3a6f29d119 100644
--- a/engines/ultima/ultima2/data/tiles.h
+++ b/engines/ultima/ultima2/data/tiles.h
@@ -24,6 +24,7 @@
 
 #include "graphics/surface.h"
 #include "graphics/managed_surface.h"
+#include "ultima/ultima2/data/data.h"
 
 namespace Ultima {
 namespace Ultima2 {
@@ -51,20 +52,23 @@ constexpr int TILE_WIDTH = 16;
 constexpr int TILE_HEIGHT = 16;
 
 /**
- * Decodes the 64 overworld/town tile graphics embedded directly in
- * ULTIMAII.EXE into 16x16 CLUT8 surfaces, indexed into the same 4-color
- * CGA palette as the pic??? full-screen art (see Gfx::PicDecoder).
+ * Decodes the 64 overworld/town tile graphics and (RENDER_CGA only) puts
+ * them into CLUT8 surfaces indexed into the 4-color CGA_PALETTE1 (see
+ * Gfx::PicDecoder). RENDER_CGA reads them embedded directly in
+ * ULTIMAII.EXE, as the original does; the EGA-family modes instead read
+ * an EGATILES-format file (see docs/enhanced-patch.md §3.8) and index
+ * into EGA_PALETTE16 at EGA_PALETTE_BASE instead
  */
-void loadTiles(Graphics::Surface tiles[TILE_COUNT]);
+void loadTiles(Graphics::Surface tiles[TILE_COUNT], RenderMode mode);
 
 /**
  * Decodes the "sprite circle" graphic used to flash a hit indicator over
  * the player's position during combat (xorSpriteDrawCenter in the
- * original), in the same 16x16 CLUT8/CGA format as the map tiles. A
- * ManagedSurface, unlike the plain map tiles, since it needs to be XOR-
- * blitted (see GfxSurface::xorBlitFrom)
+ * original), in the same 16x16 CLUT8 format and palette convention as
+ * loadTiles above. A ManagedSurface, unlike the plain map tiles, since it
+ * needs to be XOR-blitted (see GfxSurface::xorBlitFrom)
  */
-void loadAttackSprite(Graphics::ManagedSurface &sprite);
+void loadAttackSprite(Graphics::ManagedSurface &sprite, RenderMode mode);
 
 /**
  * Scrolls a tile's rows upwards with wraparound, which is how the water and
diff --git a/engines/ultima/ultima2/ultima2.cpp b/engines/ultima/ultima2/ultima2.cpp
index a30ce52ee99..11f79cb320b 100644
--- a/engines/ultima/ultima2/ultima2.cpp
+++ b/engines/ultima/ultima2/ultima2.cpp
@@ -20,6 +20,7 @@
  */
 
 #include "common/system.h"
+#include "common/config-manager.h"
 #include "common/engine_data.h"
 #include "common/savefile.h"
 #include "engines/util.h"
@@ -62,7 +63,7 @@ Common::Error Ultima2Engine::run() {
 
 	// Initialize 320x200 paletted graphics mode
 	initGraphics(320, 200);
-	Data::setCGAPalette();
+	Data::setPalette();
 	_pcSpeakerReady = _pcSpeaker->init();
 
 	// Set the engine's debugger console
@@ -81,6 +82,15 @@ Common::Error Ultima2Engine::run() {
 		return Common::kNoError;
 	}
 
+	// Restore the player's preferred renderer, falling back to the
+	// original CGA look if the stored value is missing or stale. Uses
+	// its own key rather than the generic "render_mode" - that one's
+	// already a reserved, string-valued ScummVM-wide GUI setting (the
+	// "Render mode:" dropdown, see gui/options.cpp), not an engine-local int
+	int renderMode = ConfMan.getInt("graphics_mode");
+	_renderMode = (renderMode >= 0 && renderMode < Data::RENDER_MODE_COUNT) ?
+		(Data::RenderMode)renderMode : Data::RENDER_CGA;
+
 	// Set up secret map
 	SearchMan.add("Secret", new Data::SecretMapArchive());
 
@@ -232,5 +242,20 @@ void Ultima2Engine::playFX(Data::SoundEffect fx) {
 	}
 }
 
+void Ultima2Engine::setRenderMode(Data::RenderMode mode) {
+	if (mode == _renderMode)
+		return;
+
+	_renderMode = mode;
+	ConfMan.setInt("graphics_mode", (int)mode);
+	ConfMan.flushToDisk();
+	Data::setPalette();
+
+	// OverworldMap/LocationMap are constructed once up front as part of
+	// Views::Views, so they need to be explicitly told to re-read their
+	// tile graphics now rather than noticing this on their own
+	g_engine->send(Shared::Messages::GameMessage("RELOAD_TILES"));
+}
+
 } // namespace Ultima2
 } // namespace Ultima
diff --git a/engines/ultima/ultima2/ultima2.h b/engines/ultima/ultima2/ultima2.h
index e47458ea4e6..280fdbeb6f8 100644
--- a/engines/ultima/ultima2/ultima2.h
+++ b/engines/ultima/ultima2/ultima2.h
@@ -90,6 +90,9 @@ public:
 	// movement through normally impassable terrain
 	bool _intangible = false;
 
+private:
+	Data::RenderMode _renderMode = Data::RENDER_CGA;
+
 public:
 	Ultima2Engine(OSystem *syst, const Ultima::UltimaGameDescription *gameDesc);
 	~Ultima2Engine() override;
@@ -142,6 +145,21 @@ public:
 	 * hardcoded tone sweep, reproduced here as a short note sequence
 	 */
 	void playFX(Data::SoundEffect fx);
+
+	/**
+	 * Returns the currently selected renderer (CGA or one of the "Ultima
+	 * II Upgrade" patch's EGA-family modes)
+	 */
+	Data::RenderMode getRenderMode() const {
+		return _renderMode;
+	}
+
+	/**
+	 * Changes the active renderer, persisting the choice to ConfMan and
+	 * refreshing the palette immediately. Map views pick up the new tile
+	 * data themselves next time they're (re)constructed
+	 */
+	void setRenderMode(Data::RenderMode mode);
 };
 
 extern Ultima2Engine *g_engine;
diff --git a/engines/ultima/ultima2/views/ending.cpp b/engines/ultima/ultima2/views/ending.cpp
index 4733d0dea92..9d161cf5270 100644
--- a/engines/ultima/ultima2/views/ending.cpp
+++ b/engines/ultima/ultima2/views/ending.cpp
@@ -53,7 +53,7 @@ Ending::~Ending() {
 }
 
 bool Ending::msgFocus(const FocusMessage &msg) {
-	Data::loadTiles(_tileGfx);
+	Data::loadTiles(_tileGfx, g_engine->getRenderMode());
 
 	// A fixed background, reused from the same file that's the real
 	// planet map of this era/type combination - not loaded as a live map
diff --git a/engines/ultima/ultima2/views/location_map.cpp b/engines/ultima/ultima2/views/location_map.cpp
index 93f90e48c52..f79ecffb768 100644
--- a/engines/ultima/ultima2/views/location_map.cpp
+++ b/engines/ultima/ultima2/views/location_map.cpp
@@ -38,8 +38,7 @@ constexpr int PLAYER_VIEWPORT_X = 9;
 constexpr int PLAYER_VIEWPORT_Y = 5;
 
 LocationMap::LocationMap() : Map("LocationMap") {
-	Data::loadTiles(_tiles);
-	Data::loadAttackSprite(_attackSprite);
+	reloadTiles();
 }
 
 LocationMap::~LocationMap() {
@@ -48,6 +47,12 @@ LocationMap::~LocationMap() {
 	_attackSprite.free();
 }
 
+void LocationMap::reloadTiles() {
+	Data::loadTiles(_tiles, g_engine->getRenderMode());
+	Data::loadAttackSprite(_attackSprite, g_engine->getRenderMode());
+	redraw();
+}
+
 bool LocationMap::msgFocus(const FocusMessage &msg) {
 	MetaEngine::setKeybindingMode(KBMODE_GAMEPLAY);
 	return Map::msgFocus(msg);
@@ -81,6 +86,12 @@ bool LocationMap::msgAttackTile(const AttackTileMessage &msg) {
 	return true;
 }
 
+bool LocationMap::msgGame(const GameMessage &msg) {
+	if (msg._name == "RELOAD_TILES")
+		reloadTiles();
+	return false;
+}
+
 void LocationMap::draw() {
 	auto s = getSurface();
 	s.clear();
diff --git a/engines/ultima/ultima2/views/location_map.h b/engines/ultima/ultima2/views/location_map.h
index 8362a361f60..b12d2f3e7ac 100644
--- a/engines/ultima/ultima2/views/location_map.h
+++ b/engines/ultima/ultima2/views/location_map.h
@@ -40,6 +40,8 @@ private:
 	Graphics::Surface _tiles[Data::TILE_COUNT];
 	Graphics::ManagedSurface _attackSprite;
 
+	void reloadTiles() override;
+
 protected:
 	Graphics::Surface *tileGraphics() override {
 		return _tiles;
@@ -52,6 +54,7 @@ public:
 	bool msgFocus(const FocusMessage &msg) override;
 	bool msgUnfocus(const UnfocusMessage &msg) override;
 	bool msgAttackTile(const AttackTileMessage &msg) override;
+	bool msgGame(const GameMessage &msg) override;
 	void draw() override;
 };
 
diff --git a/engines/ultima/ultima2/views/map.h b/engines/ultima/ultima2/views/map.h
index 38d7af02791..f4be05e986c 100644
--- a/engines/ultima/ultima2/views/map.h
+++ b/engines/ultima/ultima2/views/map.h
@@ -52,6 +52,15 @@ protected:
 	void checkIdle();
 
 public:
+	/**
+	 * Re-reads whatever tile/sprite graphics this view uses for the
+	 * current render mode. A no-op by default; overridden by subclasses
+	 * that actually own tile surfaces (OverworldMap, LocationMap), since
+	 * those are constructed once up front as part of Views::Views and so
+	 * don't otherwise notice a render mode change made after the fact
+	 */
+	virtual void reloadTiles() {}
+
 	Map(const Common::String &name) : View(name) {
 		setBounds(TextRect(0, 0, 39, 19));
 	}
diff --git a/engines/ultima/ultima2/views/overworld_map.cpp b/engines/ultima/ultima2/views/overworld_map.cpp
index edf05e7b466..4952c1613a7 100644
--- a/engines/ultima/ultima2/views/overworld_map.cpp
+++ b/engines/ultima/ultima2/views/overworld_map.cpp
@@ -39,8 +39,7 @@ constexpr int PLAYER_VIEWPORT_X = 9;
 constexpr int PLAYER_VIEWPORT_Y = 5;
 
 OverworldMap::OverworldMap() : Map("OverworldMap") {
-	Data::loadTiles(_tiles);
-	Data::loadAttackSprite(_attackSprite);
+	reloadTiles();
 }
 
 OverworldMap::~OverworldMap() {
@@ -49,6 +48,12 @@ OverworldMap::~OverworldMap() {
 	_attackSprite.free();
 }
 
+void OverworldMap::reloadTiles() {
+	Data::loadTiles(_tiles, g_engine->getRenderMode());
+	Data::loadAttackSprite(_attackSprite, g_engine->getRenderMode());
+	redraw();
+}
+
 bool OverworldMap::msgFocus(const FocusMessage &msg) {
 	MetaEngine::setKeybindingMode(KBMODE_GAMEPLAY);
 	return Map::msgFocus(msg);
@@ -84,6 +89,12 @@ bool OverworldMap::msgAttackTile(const AttackTileMessage &msg) {
 	return true;
 }
 
+bool OverworldMap::msgGame(const GameMessage &msg) {
+	if (msg._name == "RELOAD_TILES")
+		reloadTiles();
+	return false;
+}
+
 void OverworldMap::draw() {
 	auto s = getSurface();
 	s.clear();
diff --git a/engines/ultima/ultima2/views/overworld_map.h b/engines/ultima/ultima2/views/overworld_map.h
index 970c2c50a74..d0a80775f3a 100644
--- a/engines/ultima/ultima2/views/overworld_map.h
+++ b/engines/ultima/ultima2/views/overworld_map.h
@@ -38,6 +38,8 @@ private:
 	Graphics::Surface _tiles[Data::TILE_COUNT];
 	Graphics::ManagedSurface _attackSprite;
 
+	void reloadTiles() override;
+
 protected:
 	Graphics::Surface *tileGraphics() override {
 		return _tiles;
@@ -50,6 +52,7 @@ public:
 	bool msgFocus(const FocusMessage &msg) override;
 	bool msgUnfocus(const UnfocusMessage &msg) override;
 	bool msgAttackTile(const AttackTileMessage &msg) override;
+	bool msgGame(const GameMessage &msg) override;
 	void draw() override;
 };
 
diff --git a/engines/ultima/ultima2/views/title.cpp b/engines/ultima/ultima2/views/title.cpp
index d9725680381..25951aecfec 100644
--- a/engines/ultima/ultima2/views/title.cpp
+++ b/engines/ultima/ultima2/views/title.cpp
@@ -22,6 +22,7 @@
 #include "common/file.h"
 #include "common/system.h"
 #include "graphics/paletteman.h"
+#include "ultima/ultima2/data/data.h"
 #include "ultima/ultima2/views/title.h"
 #include "ultima/ultima2/gfx/pic_decoder.h"
 #include "ultima/ultima2/ultima2.h"
@@ -167,10 +168,12 @@ void Title::draw() {
 		s.writeString(Common::Point(14, 7), "ENCHANTRESS");
 		s.writeString(Common::Point(6, 22), "(C)-1983,1989 BY LORD BRITISH");
 		s.writeString(Common::Point(15, 23), "AND ORIGIN");
-		s.writeString(Common::Point(5, 11), "TYPE -");
-		s.writeString(Common::Point(6, 13), "'D' - FOR A DEMONSTRATION");
-		s.writeString(Common::Point(6, 15), "'P' - PLAY A GAME OF ULTIMA ][");
-		s.writeString(Common::Point(6, 17), "'C' - CREATE A NEW CHARACTER");
+		s.writeString(Common::Point(5, 10), "TYPE -");
+		s.writeString(Common::Point(6, 11), "'D' - FOR A DEMONSTRATION");
+		s.writeString(Common::Point(6, 13), "'P' - PLAY A GAME OF ULTIMA ][");
+		s.writeString(Common::Point(6, 15), "'C' - CREATE A NEW CHARACTER");
+		s.writeString(Common::Point(6, 17), Common::String::format("'G' - GRAPHICS: %s",
+			Data::RENDER_MODE_NAMES[g_engine->getRenderMode()]));
 		s.writeString(Common::Point(5, 19), "CHOICE:");
 		break;
 	}
@@ -222,6 +225,12 @@ bool Title::msgKeypress(const KeypressMessage &msg) {
 		case Common::KEYCODE_c:
 			replaceView("CreateCharacter");
 			break;
+		case Common::KEYCODE_g: {
+			int nextMode = (g_engine->getRenderMode() + 1) % Data::RENDER_MODE_COUNT;
+			g_engine->setRenderMode((Data::RenderMode)nextMode);
+			redraw();
+			break;
+		}
 		default:
 			break;
 		}


Commit: 7ac1d1e2cd8e74d082a1b05ba0de10876969c0c6
    https://github.com/scummvm/scummvm/commit/7ac1d1e2cd8e74d082a1b05ba0de10876969c0c6
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:40:59+11:00

Commit Message:
ULTIMA: ULTIMA2: Implement title/demo picture drawing from upgrade

Changed paths:
  A engines/ultima/ultima2/gfx/ega_picture.cpp
  A engines/ultima/ultima2/gfx/ega_picture.h
    engines/ultima/module.mk
    engines/ultima/ultima2/data/tiles.cpp
    engines/ultima/ultima2/data/tiles.h
    engines/ultima/ultima2/views/title.cpp
    engines/ultima/ultima2/views/title.h


diff --git a/engines/ultima/module.mk b/engines/ultima/module.mk
index 37f00b67efd..75b6edf6801 100644
--- a/engines/ultima/module.mk
+++ b/engines/ultima/module.mk
@@ -117,6 +117,7 @@ MODULE_OBJS += \
 	ultima2/data/savegame.o \
 	ultima2/data/secret_archive.o \
 	ultima2/data/tiles.o \
+	ultima2/gfx/ega_picture.o \
 	ultima2/gfx/pic_decoder.o \
 	ultima2/gfx/text_cursor.o \
 	ultima2/logic/city_castle_logic.o \
diff --git a/engines/ultima/ultima2/data/tiles.cpp b/engines/ultima/ultima2/data/tiles.cpp
index 2dd5513b2ac..d5a3faeb3ce 100644
--- a/engines/ultima/ultima2/data/tiles.cpp
+++ b/engines/ultima/ultima2/data/tiles.cpp
@@ -19,7 +19,10 @@
  *
  */
 
+#include "common/archive.h"
 #include "common/file.h"
+#include "common/scummsys.h"
+#include "common/ptr.h"
 #include "ultima/ultima2/data/tiles.h"
 
 namespace Ultima {
@@ -74,32 +77,43 @@ static void decodeEgaTileRecord(const byte record[EGA_RECORD_SIZE], SurfaceT &su
 	}
 }
 
-// The base EGA tileset lives at the data root; each "theme" is an
-// alternate EGATILES file in its own subfolder (confirmed pure data
+// The base EGA data files live at the data root; each "theme" is a
+// subfolder holding alternate copies of some of them (confirmed pure data
 // swaps, no code differences - see docs/enhanced-patch.md §3.6)
-static Common::String egaTilesFilename(RenderMode mode) {
+static const char *egaThemeFolder(RenderMode mode) {
 	switch (mode) {
 	case RENDER_EGA_V1:
-		return "egatheme.10/egatiles";
+		return "egatheme.10/";
 	case RENDER_EGA_WILTSHIRE:
-		return "egatheme.alt/egatiles";
+		return "egatheme.alt/";
 	case RENDER_EGA_C64:
-		return "egatheme.c64/egatiles";
+		return "egatheme.c64/";
 	default:
-		return "egatiles";
+		return "";
 	}
 }
 
+Common::SeekableReadStream *openEgaFile(RenderMode mode, const Common::String &filename) {
+	Common::String folder = egaThemeFolder(mode);
+	if (!folder.empty()) {
+		Common::SeekableReadStream *stream =
+			SearchMan.createReadStreamForMember(Common::Path(folder + filename));
+		if (stream)
+			return stream;
+	}
+
+	return SearchMan.createReadStreamForMember(Common::Path(filename));
+}
+
 static void loadEgaTiles(Graphics::Surface tiles[TILE_COUNT], RenderMode mode) {
-	Common::File f;
-	Common::String filename = egaTilesFilename(mode);
-	if (!f.open(filename.c_str()))
-		error("Could not open %s", filename.c_str());
+	Common::ScopedPtr<Common::SeekableReadStream> f(openEgaFile(mode, "egatiles"));
+	if (!f)
+		error("Could not open egatiles");
 
 	for (int t = 0; t < TILE_COUNT; ++t) {
 		byte record[EGA_RECORD_SIZE];
-		if (f.read(record, EGA_RECORD_SIZE) != (uint32)EGA_RECORD_SIZE)
-			error("Could not read tile %d from %s", t, filename.c_str());
+		if (f->read(record, EGA_RECORD_SIZE) != (uint32)EGA_RECORD_SIZE)
+			error("Could not read tile %d from egatiles", t);
 
 		decodeEgaTileRecord(record, tiles[t]);
 	}
@@ -127,22 +141,21 @@ void loadTiles(Graphics::Surface tiles[TILE_COUNT], RenderMode mode) {
 }
 
 void loadAttackSprite(Graphics::ManagedSurface &sprite, RenderMode mode) {
-	Common::File f;
-
 	if (mode != RENDER_CGA) {
-		Common::String filename = egaTilesFilename(mode);
-		if (!f.open(filename.c_str()))
-			error("Could not open %s", filename.c_str());
+		Common::ScopedPtr<Common::SeekableReadStream> egaFile(openEgaFile(mode, "egatiles"));
+		if (!egaFile)
+			error("Could not open egatiles");
 
-		f.seek(EGA_ATTACK_SPRITE_RECORD * EGA_RECORD_SIZE);
+		egaFile->seek(EGA_ATTACK_SPRITE_RECORD * EGA_RECORD_SIZE);
 		byte record[EGA_RECORD_SIZE];
-		if (f.read(record, EGA_RECORD_SIZE) != (uint32)EGA_RECORD_SIZE)
-			error("Could not read attack sprite from %s", filename.c_str());
+		if (egaFile->read(record, EGA_RECORD_SIZE) != (uint32)EGA_RECORD_SIZE)
+			error("Could not read attack sprite from egatiles");
 
 		decodeEgaTileRecord(record, sprite);
 		return;
 	}
 
+	Common::File f;
 	if (!f.open("ULTIMAII.EXE"))
 		error("Could not open ULTIMAII.EXE");
 
diff --git a/engines/ultima/ultima2/data/tiles.h b/engines/ultima/ultima2/data/tiles.h
index a3a6f29d119..b909340578a 100644
--- a/engines/ultima/ultima2/data/tiles.h
+++ b/engines/ultima/ultima2/data/tiles.h
@@ -22,6 +22,8 @@
 #ifndef ULTIMA2_DATA_TILES_H
 #define ULTIMA2_DATA_TILES_H
 
+#include "common/stream.h"
+#include "common/str.h"
 #include "graphics/surface.h"
 #include "graphics/managed_surface.h"
 #include "ultima/ultima2/data/data.h"
@@ -51,6 +53,14 @@ enum TileId {
 constexpr int TILE_WIDTH = 16;
 constexpr int TILE_HEIGHT = 16;
 
+/**
+ * Opens one of the EGA-family renderers' data files by name (e.g.
+ * "egatiles" or "picdng.ega") the way the upgrade's ega.drv does: the
+ * active theme's own copy if it has one, otherwise the base copy at the
+ * data root. Returns nullptr if neither exists; the caller owns the stream
+ */
+Common::SeekableReadStream *openEgaFile(RenderMode mode, const Common::String &filename);
+
 /**
  * Decodes the 64 overworld/town tile graphics and (RENDER_CGA only) puts
  * them into CLUT8 surfaces indexed into the 4-color CGA_PALETTE1 (see
diff --git a/engines/ultima/ultima2/gfx/ega_picture.cpp b/engines/ultima/ultima2/gfx/ega_picture.cpp
new file mode 100644
index 00000000000..3d54611c067
--- /dev/null
+++ b/engines/ultima/ultima2/gfx/ega_picture.cpp
@@ -0,0 +1,105 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "common/ptr.h"
+#include "ultima/ultima2/data/tiles.h"
+#include "ultima/ultima2/gfx/ega_picture.h"
+
+namespace Ultima {
+namespace Ultima2 {
+namespace Gfx {
+
+constexpr int PIC_WIDTH = 320;
+constexpr int PIC_HEIGHT = 200;
+
+// Tile-map pictures: one tile code per 16x16 cell, row by row
+constexpr int MAP_COLUMNS = PIC_WIDTH / Data::TILE_WIDTH;
+constexpr int MAP_ROWS = 10;
+constexpr int MAP_CELLS = MAP_COLUMNS * MAP_ROWS;
+
+static bool isTileMapPicture(const Common::String &name) {
+	return name == "picout" || name == "pictwn" || name == "piccas" || name == "picmin";
+}
+
+static bool loadFullPicture(const Common::String &name, Data::RenderMode mode,
+		Graphics::ManagedSurface &surf) {
+	Common::ScopedPtr<Common::SeekableReadStream> f(Data::openEgaFile(mode, name + ".ega"));
+	if (!f)
+		return false;
+
+	surf.create(PIC_WIDTH, PIC_HEIGHT, Graphics::PixelFormat::createFormatCLUT8());
+	byte *dst = (byte *)surf.getPixels();
+
+	// Each byte is a direct EGA color index, one per pixel
+	byte row[PIC_WIDTH];
+	for (int y = 0; y < PIC_HEIGHT; ++y) {
+		if (f->read(row, PIC_WIDTH) != (uint32)PIC_WIDTH)
+			return false;
+
+		for (int x = 0; x < PIC_WIDTH; ++x)
+			dst[y * PIC_WIDTH + x] = Data::EGA_PALETTE_BASE + (row[x] & 0xF);
+	}
+
+	return true;
+}
+
+static bool loadTileMapPicture(const Common::String &name, Data::RenderMode mode,
+		Graphics::ManagedSurface &surf) {
+	Common::ScopedPtr<Common::SeekableReadStream> f(Data::openEgaFile(mode, name + ".idx"));
+	if (!f)
+		return false;
+
+	byte codes[MAP_CELLS];
+	if (f->read(codes, MAP_CELLS) != (uint32)MAP_CELLS)
+		return false;
+
+	Graphics::Surface tiles[Data::TILE_COUNT];
+	Data::loadTiles(tiles, mode);
+
+	// Below the map's 10 rows of tiles is the caption area, left black
+	surf.create(PIC_WIDTH, PIC_HEIGHT, Graphics::PixelFormat::createFormatCLUT8());
+	surf.clear(Data::EGA_PALETTE_BASE);
+
+	for (int cell = 0; cell < MAP_CELLS; ++cell) {
+		// Tile codes are the same as in the map files: tile id * 4
+		int tileId = codes[cell] / 4;
+		if (tileId >= Data::TILE_COUNT)
+			continue;
+
+		surf.blitFrom(tiles[tileId], Common::Point((cell % MAP_COLUMNS) * Data::TILE_WIDTH,
+			(cell / MAP_COLUMNS) * Data::TILE_HEIGHT));
+	}
+
+	for (int t = 0; t < Data::TILE_COUNT; ++t)
+		tiles[t].free();
+
+	return true;
+}
+
+bool loadEgaPicture(const Common::String &name, Data::RenderMode mode,
+		Graphics::ManagedSurface &surf) {
+	return isTileMapPicture(name) ? loadTileMapPicture(name, mode, surf) :
+		loadFullPicture(name, mode, surf);
+}
+
+} // namespace Gfx
+} // namespace Ultima2
+} // namespace Ultima
diff --git a/engines/ultima/ultima2/gfx/ega_picture.h b/engines/ultima/ultima2/gfx/ega_picture.h
new file mode 100644
index 00000000000..ceffe8568b1
--- /dev/null
+++ b/engines/ultima/ultima2/gfx/ega_picture.h
@@ -0,0 +1,54 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef ULTIMA2_GFX_EGA_PICTURE_H
+#define ULTIMA2_GFX_EGA_PICTURE_H
+
+#include "common/str.h"
+#include "graphics/managed_surface.h"
+#include "ultima/ultima2/data/data.h"
+
+namespace Ultima {
+namespace Ultima2 {
+namespace Gfx {
+
+/**
+ * Loads one of the title/demo pictures as the "Ultima II Upgrade" patch's
+ * EGA-family renderers show it, into a 320x200 CLUT8 surface whose pixels
+ * index EGA_PALETTE16 at EGA_PALETTE_BASE. The name is the picture's
+ * original CGA filename, in lower case ("picdra", "picout", ...).
+ *
+ * As in the patch's ega.drv, three pictures (picdra, picdng, picspa) got
+ * full 64,000-byte redraws, one byte per pixel. The rest (picout, pictwn,
+ * piccas, picmin) are instead a 20x10 map of game tiles - a 200 byte .idx
+ * file of tile codes, same encoding as the map files - drawn with the
+ * current theme's own tileset. See docs/enhanced-patch.md §3.9
+ *
+ * Returns false if the picture's data couldn't be found
+ */
+bool loadEgaPicture(const Common::String &name, Data::RenderMode mode,
+	Graphics::ManagedSurface &surf);
+
+} // namespace Gfx
+} // namespace Ultima2
+} // namespace Ultima
+
+#endif
diff --git a/engines/ultima/ultima2/views/title.cpp b/engines/ultima/ultima2/views/title.cpp
index 25951aecfec..c8139093598 100644
--- a/engines/ultima/ultima2/views/title.cpp
+++ b/engines/ultima/ultima2/views/title.cpp
@@ -24,6 +24,7 @@
 #include "graphics/paletteman.h"
 #include "ultima/ultima2/data/data.h"
 #include "ultima/ultima2/views/title.h"
+#include "ultima/ultima2/gfx/ega_picture.h"
 #include "ultima/ultima2/gfx/pic_decoder.h"
 #include "ultima/ultima2/ultima2.h"
 
@@ -40,6 +41,14 @@ Title::Title() : View("Title"), _cursor("Cursor", this) {
 }
 
 void Title::loadPic(const Common::String &filename) {
+	// The upgrade patch's EGA-family renderers show their own versions
+	Data::RenderMode mode = g_engine->getRenderMode();
+	if (mode != Data::RENDER_CGA) {
+		if (!Gfx::loadEgaPicture(filename, mode, _pic))
+			error("Could not load %s", filename.c_str());
+		return;
+	}
+
 	Gfx::PicDecoder decoder;
 	Common::File f;
 	if (!f.open(filename.c_str()) || !decoder.loadStream(f))
@@ -71,27 +80,31 @@ void Title::showState(State state) {
 		delaySeconds(4);
 		break;
 	case PICDRA:
-		loadPic("PICDRA");
+		loadPic("picdra");
 		delaySeconds(3);
 		break;
 	case DEMO_OUT:
-		loadPic("PICOUT");
+		loadPic("picout");
 		delaySeconds(5);
 		break;
 	case DEMO_TWN:
-		loadPic("PICTWN");
+		loadPic("pictwn");
+		delaySeconds(5);
+		break;
+	case DEMO_CAS:
+		loadPic("piccas");
 		delaySeconds(5);
 		break;
 	case DEMO_DNG:
-		loadPic("PICDNG");
+		loadPic("picdng");
 		delaySeconds(5);
 		break;
 	case DEMO_SPA:
-		loadPic("PICSPA");
+		loadPic("picspa");
 		delaySeconds(5);
 		break;
 	case DEMO_MIN:
-		loadPic("PICMIN");
+		loadPic("picmin");
 		delaySeconds(5);
 		break;
 	case MENU:
@@ -146,6 +159,11 @@ void Title::draw() {
 		s.writeString(Common::Point(2, 24), "      SPOKEN AT THE LOCAL PUB");
 		break;
 
+	case DEMO_CAS:
+		s.writeString(Common::Point(0, 23), "        PLEAD WITH MEDIEVAL KINGS");
+		s.writeString(Common::Point(4, 24), "         FOR ASSISTANCE");
+		break;
+
 	case DEMO_DNG:
 		s.writeString(Common::Point(0, 23), "   TRAVERSE DEEP DARK DEADLY DUNGEONS");
 		s.writeString(Common::Point(1, 24), "      AND TALL TERRIFYING TOWERS");
@@ -196,6 +214,9 @@ void Title::timeout() {
 		showState(DEMO_TWN);
 		break;
 	case DEMO_TWN:
+		showState(DEMO_CAS);
+		break;
+	case DEMO_CAS:
 		showState(DEMO_DNG);
 		break;
 	case DEMO_DNG:
diff --git a/engines/ultima/ultima2/views/title.h b/engines/ultima/ultima2/views/title.h
index 7a60f8e6cc4..8a519752360 100644
--- a/engines/ultima/ultima2/views/title.h
+++ b/engines/ultima/ultima2/views/title.h
@@ -46,7 +46,7 @@ class Title : public Shared::Gfx::View {
 private:
 	enum State {
 		TEXT1, TEXT2, PICDRA, MENU,
-		DEMO_OUT, DEMO_TWN, DEMO_DNG, DEMO_SPA, DEMO_MIN
+		DEMO_OUT, DEMO_TWN, DEMO_CAS, DEMO_DNG, DEMO_SPA, DEMO_MIN
 	};
 	State _state = TEXT1;
 	bool _demoMode = false;


Commit: 882cff51f2c34876384d1e0ede0ae5ffdc1ad79d
    https://github.com/scummvm/scummvm/commit/882cff51f2c34876384d1e0ede0ae5ffdc1ad79d
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:40:59+11:00

Commit Message:
ULTIMA: ULTIMA2: Refactoring to use Graphics::View base

Changed paths:
  A engines/ultima/shared/engine/view.h
  R engines/ultima/shared/engine/events.cpp
  R engines/ultima/shared/engine/messages.cpp
  R engines/ultima/shared/gfx/gfx_surface.cpp
  R engines/ultima/shared/gfx/gfx_surface.h
  R engines/ultima/shared/gfx/rect.h
  R engines/ultima/shared/gfx/view.cpp
  R engines/ultima/shared/gfx/view.h
    engines/ultima/configure.engine
    engines/ultima/shared/engine/events.h
    engines/ultima/shared/engine/messages.h
    engines/ultima/ultima1/console.cpp
    engines/ultima/ultima1/gfx/text_cursor.cpp
    engines/ultima/ultima1/gfx/text_cursor.h
    engines/ultima/ultima1/gfx/text_input.cpp
    engines/ultima/ultima1/gfx/text_input.h
    engines/ultima/ultima1/logic/logic.cpp
    engines/ultima/ultima1/logic/overworld_logic.cpp
    engines/ultima/ultima1/logic/space_logic.cpp
    engines/ultima/ultima1/ultima1.cpp
    engines/ultima/ultima1/ultima1.h
    engines/ultima/ultima1/views/commands.cpp
    engines/ultima/ultima1/views/commands.h
    engines/ultima/ultima1/views/create_character.cpp
    engines/ultima/ultima1/views/create_character.h
    engines/ultima/ultima1/views/dialog.cpp
    engines/ultima/ultima1/views/dialog.h
    engines/ultima/ultima1/views/dungeon_map.cpp
    engines/ultima/ultima1/views/dungeon_map.h
    engines/ultima/ultima1/views/full_screen_dialog.h
    engines/ultima/ultima1/views/game.cpp
    engines/ultima/ultima1/views/game.h
    engines/ultima/ultima1/views/interactions/dead.cpp
    engines/ultima/ultima1/views/interactions/dead.h
    engines/ultima/ultima1/views/interactions/direction.h
    engines/ultima/ultima1/views/interactions/drop.cpp
    engines/ultima/ultima1/views/interactions/drop.h
    engines/ultima/ultima1/views/interactions/entering_craft.h
    engines/ultima/ultima1/views/interactions/interaction.cpp
    engines/ultima/ultima1/views/interactions/interaction.h
    engines/ultima/ultima1/views/interactions/king.h
    engines/ultima/ultima1/views/interactions/liftoff.h
    engines/ultima/ultima1/views/interactions/lose.cpp
    engines/ultima/ultima1/views/interactions/lose.h
    engines/ultima/ultima1/views/interactions/merchant.cpp
    engines/ultima/ultima1/views/interactions/merchant.h
    engines/ultima/ultima1/views/interactions/operate_craft.h
    engines/ultima/ultima1/views/interactions/pillar.cpp
    engines/ultima/ultima1/views/interactions/pillar.h
    engines/ultima/ultima1/views/interactions/princess_saved.h
    engines/ultima/ultima1/views/interactions/ready.cpp
    engines/ultima/ultima1/views/interactions/ready.h
    engines/ultima/ultima1/views/interactions/sector_scan.cpp
    engines/ultima/ultima1/views/interactions/sector_scan.h
    engines/ultima/ultima1/views/interactions/space_station.h
    engines/ultima/ultima1/views/interactions/win.cpp
    engines/ultima/ultima1/views/interactions/win.h
    engines/ultima/ultima1/views/location_map.cpp
    engines/ultima/ultima1/views/location_map.h
    engines/ultima/ultima1/views/main_menu.h
    engines/ultima/ultima1/views/map.cpp
    engines/ultima/ultima1/views/map.h
    engines/ultima/ultima1/views/mondain_map.h
    engines/ultima/ultima1/views/overworld_map.cpp
    engines/ultima/ultima1/views/overworld_map.h
    engines/ultima/ultima1/views/space_cockpit.cpp
    engines/ultima/ultima1/views/space_cockpit.h
    engines/ultima/ultima1/views/space_game.cpp
    engines/ultima/ultima1/views/space_game.h
    engines/ultima/ultima1/views/space_map.cpp
    engines/ultima/ultima1/views/space_map.h
    engines/ultima/ultima1/views/space_stats.h
    engines/ultima/ultima1/views/startup.h
    engines/ultima/ultima1/views/stats.h
    engines/ultima/ultima1/views/title.cpp
    engines/ultima/ultima1/views/title.h
    engines/ultima/ultima1/views/views.h
    engines/ultima/ultima1/views/zstats.cpp
    engines/ultima/ultima1/views/zstats.h
    engines/ultima/ultima2/data/map.cpp
    engines/ultima/ultima2/gfx/text_cursor.cpp
    engines/ultima/ultima2/gfx/text_cursor.h
    engines/ultima/ultima2/logic/logic.cpp
    engines/ultima/ultima2/logic/logic.h
    engines/ultima/ultima2/logic/overworld_logic.cpp
    engines/ultima/ultima2/logic/space_logic.cpp
    engines/ultima/ultima2/logic/space_logic.h
    engines/ultima/ultima2/ultima2.cpp
    engines/ultima/ultima2/ultima2.h
    engines/ultima/ultima2/views/commands.cpp
    engines/ultima/ultima2/views/commands.h
    engines/ultima/ultima2/views/create_character.h
    engines/ultima/ultima2/views/dungeon_map.cpp
    engines/ultima/ultima2/views/dungeon_map.h
    engines/ultima/ultima2/views/ending.cpp
    engines/ultima/ultima2/views/ending.h
    engines/ultima/ultima2/views/game.cpp
    engines/ultima/ultima2/views/game.h
    engines/ultima/ultima2/views/helm_map.cpp
    engines/ultima/ultima2/views/helm_map.h
    engines/ultima/ultima2/views/interactions/dead.h
    engines/ultima/ultima2/views/interactions/interaction.cpp
    engines/ultima/ultima2/views/interactions/interaction.h
    engines/ultima/ultima2/views/location_map.cpp
    engines/ultima/ultima2/views/location_map.h
    engines/ultima/ultima2/views/map.h
    engines/ultima/ultima2/views/overworld_map.cpp
    engines/ultima/ultima2/views/overworld_map.h
    engines/ultima/ultima2/views/space_map.cpp
    engines/ultima/ultima2/views/space_map.h
    engines/ultima/ultima2/views/space_stats.cpp
    engines/ultima/ultima2/views/space_stats.h
    engines/ultima/ultima2/views/stats.cpp
    engines/ultima/ultima2/views/stats.h
    engines/ultima/ultima2/views/title.h
    engines/ultima/ultima2/views/views.h
    engines/ultima/ultima2/views/zstats.cpp
    engines/ultima/ultima2/views/zstats.h


diff --git a/engines/ultima/configure.engine b/engines/ultima/configure.engine
index 996b82085a8..c6eccd44384 100644
--- a/engines/ultima/configure.engine
+++ b/engines/ultima/configure.engine
@@ -2,8 +2,8 @@
 # add_engine [name] [desc] [build-by-default] [subengines] [base games] [deps] [components]
 add_engine ultima "Ultima" yes "akalabeth ultima1 ultima2 ultima4 ultima6 ultima8" "" "midi"
 add_engine akalabeth "Akalabeth" no "" "" ""
-add_engine ultima1 "Ultima I - The First Age of Darkness" no "" "" ""
-add_engine ultima2 "Ultima II - The Revenge of the Enchantress" no "" "" ""
+add_engine ultima1 "Ultima I - The First Age of Darkness" no "" "" "views"
+add_engine ultima2 "Ultima II - The Revenge of the Enchantress" no "" "" "views"
 add_engine ultima4 "Ultima IV - Quest of the Avatar" yes "" "" "16bit"
 add_engine ultima6 "Ultima VI = The False Prophet" yes "" "" "highres 16bit lua"
 add_engine ultima8 "Ultima VIII - Pagan" yes "" "" "highres 16bit" "imgui jyv1 xan"
diff --git a/engines/ultima/shared/engine/events.cpp b/engines/ultima/shared/engine/events.cpp
deleted file mode 100644
index 2797ffca842..00000000000
--- a/engines/ultima/shared/engine/events.cpp
+++ /dev/null
@@ -1,402 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-#include "common/config-manager.h"
-#include "common/system.h"
-#include "graphics/paletteman.h"
-#include "graphics/screen.h"
-#include "ultima/shared/engine/events.h"
-#include "engines/engine.h"
-
-namespace Ultima {
-namespace Shared {
-
-Events *g_events;
-
-Events::Events() : UIElement("Root", nullptr), _randomSource("Ultima") {
-	g_events = this;
-
-	// Setup palette
-	Graphics::Palette ega = Graphics::Palette::createEGAPalette();
-	g_system->getPaletteManager()->setPalette(ega);
-}
-
-Events::~Events() {
-	g_events = nullptr;
-}
-
-void Events::runGame(Views &views) {
-	uint currTime, nextFrameTime = 0;
-	_screen = new Graphics::Screen();
-
-	// Run the game
-	int saveSlot = ConfMan.getInt("save_slot");
-	if (saveSlot != -1)
-		g_engine->loadGameState(saveSlot);
-
-	Common::Event e;
-	while (!_views.empty() && !shouldQuit()) {
-		while (g_system->getEventManager()->pollEvent(e)) {
-			if (e.type == Common::EVENT_QUIT ||
-				e.type == Common::EVENT_RETURN_TO_LAUNCHER) {
-				_views.clear();
-				break;
-			} else {
-				if (processEvent(e))
-					break;
-			}
-		}
-
-		if (_views.empty())
-			break;
-
-		g_system->delayMillis(10);
-		if ((currTime = g_system->getMillis()) >= nextFrameTime) {
-			nextFrameTime = currTime + FRAME_DELAY;
-			tick();
-			drawElements();
-			_screen->update();
-		}
-	}
-
-	delete _screen;
-}
-
-bool Events::processEvent(Common::Event &ev) {
-	switch (ev.type) {
-	case Common::EVENT_KEYDOWN:
-		if (ev.kbd.flags == 0) {
-			switch (ev.kbd.keycode) {
-			case Common::KEYCODE_F5:
-				g_engine->saveGameDialog();
-				return true;
-			case Common::KEYCODE_F7:
-				g_engine->loadGameDialog();
-				return true;
-			default:
-				break;
-			}
-		}
-
-		if (ev.kbd.keycode < Common::KEYCODE_NUMLOCK)
-			msgKeypress(KeypressMessage(ev.kbd));
-		break;
-	case Common::EVENT_CUSTOM_ENGINE_ACTION_START:
-		msgAction(ActionMessage(ev.customType));
-		break;
-	case Common::EVENT_LBUTTONDOWN:
-	case Common::EVENT_RBUTTONDOWN:
-	case Common::EVENT_MBUTTONDOWN:
-		msgMouseDown(MouseDownMessage(ev.type, ev.mouse));
-		break;
-	case Common::EVENT_LBUTTONUP:
-	case Common::EVENT_RBUTTONUP:
-	case Common::EVENT_MBUTTONUP:
-		msgMouseUp(MouseUpMessage(ev.type, ev.mouse));
-		break;
-	case Common::EVENT_MOUSEMOVE:
-		msgMouseMove(MouseMoveMessage(ev.type, ev.mouse));
-		return false;
-	default:
-		return false;
-	}
-
-	return true;
-}
-
-void Events::replaceView(UIElement *ui, bool replaceAllViews) {
-	assert(ui);
-	UIElement *priorView = focusedView();
-
-	if (replaceAllViews) {
-		clearViews();
-
-	} else if (!_views.empty()) {
-		priorView->msgUnfocus(UnfocusMessage());
-		_views.pop();
-	}
-
-	_views.push(ui);
-	ui->redraw();
-	ui->msgFocus(FocusMessage(priorView));
-}
-
-void Events::replaceView(const Common::String &name, bool replaceAllViews) {
-	replaceView(findView(name), replaceAllViews);
-}
-
-void Events::addView(UIElement *ui) {
-	assert(ui);
-	UIElement *priorView = focusedView();
-
-	if (!_views.empty())
-		priorView->msgUnfocus(UnfocusMessage());
-
-	_views.push(ui);
-	ui->redraw();
-	ui->msgFocus(FocusMessage(priorView));
-}
-
-void Events::addView(const Common::String &name) {
-	addView(findView(name));
-}
-
-void Events::popView() {
-	UIElement *priorView = focusedView();
-	priorView->msgUnfocus(UnfocusMessage());
-	_views.pop();
-
-	// If the prior view was smaller than the view just closed, then we need to redraw everything
-	if (!_views.empty() && !_views[_views.size() - 1]->_bounds.contains(priorView->_bounds)) {
-		for (int i = 0; i < (int)_views.size() - 1; ++i) {
-			_views[i]->redraw();
-			_views[i]->draw();
-		}
-	}
-
-	if (!_views.empty()) {
-		UIElement *view = focusedView();
-		view->msgFocus(FocusMessage(priorView));
-		view->redraw();
-		view->draw();
-	}
-}
-
-void Events::redrawViews() {
-	for (uint i = 0; i < _views.size(); ++i) {
-		_views[i]->redraw();
-		_views[i]->draw();
-	}
-}
-
-bool Events::isPresent(const Common::String &name) const {
-	for (uint i = 0; i < _views.size(); ++i) {
-		if (_views[i]->_name == name)
-			return true;
-	}
-
-	return false;
-}
-
-void Events::clearViews() {
-	if (!_views.empty())
-		focusedView()->msgUnfocus(UnfocusMessage());
-
-	_views.clear();
-}
-
-void Events::addKeypress(const Common::KeyCode kc) {
-	Common::KeyState ks;
-	ks.keycode = kc;
-	if (kc >= Common::KEYCODE_SPACE && kc <= Common::KEYCODE_TILDE)
-		ks.ascii = kc;
-
-	focusedView()->msgKeypress(KeypressMessage(ks));
-}
-
-void Events::pauseMillis(uint millis) {
-	g_system->delayMillis(millis);
-}
-
-void Events::updateScreen() {
-	_screen->update();
-
-}
-
-/*------------------------------------------------------------------------*/
-
-Bounds::Bounds(Common::Rect &innerBounds) :
-	_bounds(0, 0, 320, 200),
-	_innerBounds(innerBounds),
-	left(_bounds.left), top(_bounds.top),
-	right(_bounds.right), bottom(_bounds.bottom) {
-}
-
-Bounds &Bounds::operator=(const Common::Rect &r) {
-	_bounds = r;
-	_innerBounds = r;
-	_innerBounds.grow(-_borderSize);
-	return *this;
-}
-
-void Bounds::setBorderSize(size_t borderSize) {
-	_borderSize = borderSize;
-	_innerBounds = *this;
-	_innerBounds.grow(-_borderSize);
-}
-
-/*------------------------------------------------------------------------*/
-
-UIElement::UIElement(const Common::String &name) :
-	_name(name), _parent(g_events), _bounds(_innerBounds) {
-	g_events->_children.push_back(this);
-}
-
-UIElement::UIElement(const Common::String &name, UIElement *uiParent) :
-	_name(name), _parent(uiParent),
-	_bounds(_innerBounds) {
-	if (_parent)
-		_parent->_children.push_back(this);
-}
-
-void UIElement::redraw() {
-	_needsRedraw = true;
-
-	for (size_t i = 0; i < _children.size(); ++i)
-		_children[i]->redraw();
-}
-
-void UIElement::drawElements() {
-	if (_needsRedraw) {
-		draw();
-		_needsRedraw = false;
-	}
-
-	for (size_t i = 0; i < _children.size(); ++i)
-		_children[i]->drawElements();
-}
-
-UIElement *UIElement::findViewGlobally(const Common::String &name) {
-	return g_events->findView(name);
-}
-
-void UIElement::focus() {
-	g_events->replaceView(this);
-}
-
-void UIElement::close() {
-	assert(g_events->focusedView() == this);
-	g_events->popView();
-}
-
-bool UIElement::isFocused() const {
-	return g_events->focusedView() == this;
-}
-
-void UIElement::clearSurface() {
-	Graphics::ManagedSurface s = getSurface();
-	s.fillRect(Common::Rect(s.w, s.h), 0);
-}
-
-void UIElement::draw() {
-	for (size_t i = 0; i < _children.size(); ++i) {
-		_children[i]->draw();
-	}
-}
-
-bool UIElement::tick() {
-	if (_timeoutCtr && --_timeoutCtr == 0) {
-		timeout();
-	}
-
-	for (size_t i = 0; i < _children.size(); ++i) {
-		if (_children[i]->tick())
-			return true;
-	}
-
-	return false;
-}
-
-UIElement *UIElement::findView(const Common::String &name) {
-	if (_name.equalsIgnoreCase(name))
-		return this;
-
-	UIElement *result;
-	for (size_t i = 0; i < _children.size(); ++i) {
-		if ((result = _children[i]->findView(name)) != nullptr)
-			return result;
-	}
-
-	return nullptr;
-}
-
-void UIElement::replaceView(UIElement *ui, bool replaceAllViews) {
-	g_events->replaceView(ui, replaceAllViews);
-}
-
-void UIElement::replaceView(const Common::String &name, bool replaceAllViews) {
-	g_events->replaceView(name, replaceAllViews);
-}
-
-void UIElement::addView(UIElement *ui) {
-	g_events->addView(ui);
-}
-
-void UIElement::addView(const Common::String &name) {
-	g_events->addView(name);
-}
-
-void UIElement::addView() {
-	g_events->addView(this);
-}
-
-Shared::Gfx::GfxSurface UIElement::getSurface() const {
-	return Shared::Gfx::GfxSurface(*g_events->getScreen(), _bounds);
-}
-
-int UIElement::getRandomNumber(int minNumber, int maxNumber) {
-	return g_events->getRandomNumber(minNumber, maxNumber);
-}
-
-int UIElement::getRandomNumber(int maxNumber) {
-	return g_events->getRandomNumber(maxNumber);
-}
-
-void UIElement::setBounds(const Common::Rect &r) {
-	// If the element has any children, convert the screen bounds to relative bounds against our old bounds
-	Common::Array<Common::Rect> oldBounds;
-	oldBounds.reserve(_children.size());
-	for (const UIElement *child : _children) {
-		Common::Rect childRect = child->getBounds();
-		childRect.translate(-_bounds.left, -_bounds.top);
-		oldBounds.push_back(childRect);
-	}
-
-	// Set the new bounds. If we have a parent, it's relative to that
-	if (_parent) {
-		Common::Rect temp = r;
-		temp.translate(_parent->_bounds.left, _parent->_bounds.top);
-		temp.constrain(_parent->_bounds);
-		_bounds = temp;
-	} else {
-		_bounds = r;
-	}
-
-	// Reset the bounds of any children. Since setBounds sets relative to the parent,
-	// this will set them relative to the new bounds we set
-	for (uint i = 0; i < _children.size(); ++i)
-		_children[i]->setBounds(oldBounds[i]);
-}
-
-void UIElement::delaySeconds(uint seconds) {
-	_timeoutCtr = seconds * FRAME_RATE;
-}
-
-void UIElement::delayFrames(uint frames) {
-	_timeoutCtr = frames;
-}
-
-void UIElement::timeout() {
-	redraw();
-}
-
-} // namespace Shared
-} // namespace Ultima
diff --git a/engines/ultima/shared/engine/events.h b/engines/ultima/shared/engine/events.h
index 57ed22b0f70..a8b0ec820c0 100644
--- a/engines/ultima/shared/engine/events.h
+++ b/engines/ultima/shared/engine/events.h
@@ -22,446 +22,49 @@
 #ifndef ULTIMA_SHARED_ENGINE_EVENTS_H
 #define ULTIMA_SHARED_ENGINE_EVENTS_H
 
-#include "common/array.h"
-#include "common/random.h"
-#include "common/stack.h"
-#include "graphics/screen.h"
-#include "ultima/shared/engine/array.h"
+#include "graphics/views/events.h"
 #include "ultima/shared/engine/messages.h"
-#include "ultima/shared/gfx/gfx_surface.h"
 
 namespace Ultima {
 namespace Shared {
 
-#define FRAME_RATE 20
-#define FRAME_DELAY (1000 / FRAME_RATE)
-
-using namespace Messages;
-
-class Events;
-
 /**
- * Implements a thunk layer around an element's bounds,
- * allowing access to it as if it were a simple Common::Rect,
- * but any changes to it will also be applied to a linked inner bounds
+ * Adds handling of Ultima-specific messages to a UIElement-derived class.
+ * Engine-defined messages arrive via msgCustom, and are converted here to
+ * the dedicated msgXXX virtuals that views override
  */
-struct Bounds {
-private:
-	Common::Rect _bounds;
-	Common::Rect &_innerBounds;
-	int _borderSize = 0;
+#define ULTIMA_CUSTOM_MESSAGES(BASE)                                            \
+protected:                                                                      \
+	virtual bool msgAttackTile(const AttackTileMessage &msg) {                  \
+		return false;                                                           \
+	}                                                                           \
+	bool msgCustom(const Graphics::Views::Message &msg) override {              \
+		const AttackTileMessage *attackTile =                                   \
+			dynamic_cast<const AttackTileMessage *>(&msg);                      \
+		if (attackTile && msgAttackTile(*attackTile))                           \
+			return true;                                                        \
+		return BASE::msgCustom(msg);                                            \
+	}
+
+class UIElement : public Graphics::Views::UIElement {
+	ULTIMA_CUSTOM_MESSAGES(Graphics::Views::UIElement)
 public:
-	const int16 &left;
-	const int16 ⊤
-	const int16 &right;
-	const int16 ⊥
-public:
-	Bounds(Common::Rect &innerBounds);
-	operator const Common::Rect &() const {
-		return _bounds;
-	}
-	Bounds &operator=(const Common::Rect &r);
-	void setBorderSize(size_t borderSize);
-	size_t borderSize() const {
-		return _borderSize;
-	}
-	int16 width() const {
-		return _bounds.width();
+	UIElement(const Common::String &name, Graphics::Views::UIElement *uiParent) : Graphics::Views::UIElement(name, uiParent) {
 	}
-	int16 height() const {
-		return _bounds.height();
+	UIElement(const Common::String &name) : Graphics::Views::UIElement(name) {
 	}
-	bool contains(const Common::Rect &r) const {
-		return _bounds.contains(r);
+	~UIElement() override {
 	}
 };
 
-/**
- * Base for container of all the game views
- */
-struct Views {
-};
-
-/**
- * User interface element
- */
-class UIElement {
-	friend class Events;
-private:
-	int _timeoutCtr = 0;
-protected:
-	UIElement *_parent;
-	Array<UIElement *> _children;
-	Common::Rect _innerBounds;
-	Bounds _bounds;
-	bool _needsRedraw = true;
-	Common::String _name;
-protected:
-	/**
-	 * Set a delay countdown in seconds, after which timeout() is called
-	 */
-	void delaySeconds(uint seconds);
-
-	/**
-	 * Set a delay countdown in frames, after which timeout() is called
-	 */
-	void delayFrames(uint frames);
-
-	/**
-	 * Returns true if a delay is active
-	 */
-	bool isDelayActive() const {
-		return _timeoutCtr != 0;
-	}
-
-	/**
-	 * Cancels any active delay
-	 */
-	void cancelDelay() {
-		_timeoutCtr = 0;
-	}
-
-	/**
-	 * Called when an active timeout countdown expired
-	 */
-	virtual void timeout();
-
-private:
-	/**
-	 * Outer method for doing drawing
-	 *
-	 */
-	void drawElements();
-
-	/**
-	 * Finds a view globally
-	 */
-	static UIElement *findViewGlobally(const Common::String &name);
+class Events : public Graphics::Views::Events {
 public:
-	UIElement(const Common::String &name, UIElement *uiParent);
-	UIElement(const Common::String &name);
-	virtual ~UIElement() {
-	}
-
-	/**
-	 * Returns true if the elements needs to be redrawn
-	 */
-	bool needsRedraw() const {
-		return _needsRedraw;
+	Events(const Common::String &engineName) : Graphics::Views::Events(engineName) {
 	}
-
-	/**
-	 * Sets that the element needs to be redrawn
-	 */
-	void redraw();
-
-	/**
-	 * Focuses the element as the current view
-	 */
-	void focus();
-
-	/**
-	 * Closes the current view. The view must have been added
-	 * via addView, so there's a remaining view afterwards
-	 */
-	virtual void close();
-
-	/*
-	 * Returns true if the view is focused
-	 */
-	bool isFocused() const;
-
-	/**
-	 * Sets the focus to a new view
-	 */
-	void replaceView(UIElement *ui, bool replaceAllViews = false);
-	void replaceView(const Common::String &name, bool replaceAllViews = false);
-
-	/**
-	 * Adds a focused view to the view stack without replacing current one
-	 */
-	void addView(UIElement *ui);
-	void addView(const Common::String &name);
-	void addView();
-	void open() {
-		addView();
-	}
-
-	/**
-	 * Gets the view's name
-	 */
-	const Common::String &getName() const {
-		return _name;
-	}
-
-	/**
-	 * Returns a random number
-	 */
-	int getRandomNumber(int minNumber, int maxNumber);
-	int getRandomNumber(int maxNumber);
-
-	/**
-	 * Sets the element's bounds
-	 */
-	virtual void setBounds(const Common::Rect &r);
-	/**
-	 * Gets the element's bounds
-	 */
-	Common::Rect getBounds() const {
-		return _bounds;
-	}
-
-	/**
-	 * Returns a surface for drawing the element
-	 */
-	Shared::Gfx::GfxSurface getSurface() const;
-
-	/**
-	 * Clear the surface
-	 */
-	virtual void clearSurface();
-
-	/**
-	 * Draws the element
-	 */
-	virtual void draw();
-
-	/**
-	 * Called for game frame ticks
-	 */
-	virtual bool tick();
-
-	/**
-	 * Find a view by name
-	 */
-	virtual UIElement *findView(const Common::String &name);
-
-	/**
-	 * Handles events
-	 */
-	 // Mouse move only has a minimal implementation for performance reasons
-protected:
-	virtual bool msgMouseMove(const MouseMoveMessage &msg) {
-		return false;
-	}
-public:
-	bool send(const MouseMoveMessage &msg) {
-		return msgMouseMove(msg);
+	~Events() override {
 	}
-
-#define MESSAGE(NAME) \
-	protected: \
-		virtual bool msg##NAME(const NAME##Message &e) { \
-			for (Common::Array<UIElement *>::iterator it = _children.begin(); \
-					it != _children.end(); ++it) { \
-				if ((*it)->msg##NAME(e)) return true; \
-			} \
-			return false; \
-		} \
-	public: \
-		bool send(const Common::String &viewName, const NAME##Message &msg) { \
-			UIElement *view = UIElement::findViewGlobally(viewName); \
-			assert(view); \
-			return view->msg##NAME(msg); \
-		} \
-		bool send(const NAME##Message &msg) { \
-			return msg##NAME(msg); \
-		} \
-
-	MESSAGE(Focus);
-	MESSAGE(Unfocus);
-	MESSAGE(MouseEnter);
-	MESSAGE(MouseLeave);
-	MESSAGE(Keypress);
-	MESSAGE(MouseDown);
-	MESSAGE(MouseUp);
-	MESSAGE(Action);
-	MESSAGE(Game);
-	MESSAGE(Value);
-	MESSAGE(AttackTile);
-#undef MESSAGE
 };
 
-/**
- * Main events and view manager. This is kept separate from the engine
- * class because the engine may add a lot of globals and bring in other
- * classes. So to save on compilation time, classes that only need to
- * access basic view management methods like addView or replaceView
- * only need to include events.h rather than the whole engine.
- */
-class Events : public UIElement {
-private:
-	Common::RandomSource _randomSource;
-	Graphics::Screen *_screen = nullptr;
-	Common::Stack<UIElement *> _views;
-protected:
-	/**
-	 * Process an event
-	 * @param ev		Event to process
-	 * @returns			True if no further events should be handled this game frame
-	 */
-	bool processEvent(Common::Event &ev);
-
-	/**
-	 * Returns true if the game should quit
-	 */
-	virtual bool shouldQuit() const = 0;
-
-	/**
-	 * Overrides events we want to only go to the focused view
-	 */
-#define MESSAGE(NAME) \
-		bool msg##NAME(const NAME##Message &e) override { \
-			return !_views.empty() ? focusedView()->msg##NAME(e) : false; \
-		}
-	MESSAGE(Action);
-	MESSAGE(Focus);
-	MESSAGE(Unfocus);
-	MESSAGE(MouseEnter);
-	MESSAGE(MouseLeave);
-	MESSAGE(Keypress);
-	MESSAGE(MouseDown);
-	MESSAGE(MouseUp);
-	MESSAGE(MouseMove);
-#undef MESSAGE
-public:
-	Events();
-	virtual ~Events();
-
-	/**
-	 * Main game loop
-	 */
-	void runGame(Views &views);
-
-	/**
-	 * Sets the focus to a new view
-	 */
-	void replaceView(UIElement *ui, bool replaceAllViews = false);
-	void replaceView(const Common::String &name, bool replaceAllViews = false);
-
-	/**
-	 * Adds a focused view to the view stack without replacing current one
-	 */
-	void addView(UIElement *ui);
-	void addView(const Common::String &name);
-
-	/**
-	 * Clears the view list
-	 */
-	void clearViews();
-
-	/**
-	 * Pops a view from the view stack
-	 */
-	void popView();
-
-	/**
-	 * Redraws the views in order. This is used in rare cases
-	 * where a view draws outside it's defined area, and needs
-	 * to restore whether the background was before
-	 */
-	void redrawViews();
-
-	/**
-	 * Returns the currently focused view, if any
-	 */
-	UIElement *focusedView() const {
-		return _views.empty() ? nullptr : _views.top();
-	}
-
-	/**
-	 * Returns the view prior to the current view, if any
-	 */
-	UIElement *priorView() const {
-		return _views.size() < 2 ? nullptr :
-			_views[_views.size() - 2];
-	}
-
-	/**
-	 * Returns the earliest view on the view stack, if any
-	 */
-	UIElement *baseView() const {
-		return _views.empty() ? nullptr : _views[0];
-	}
-
-	/**
-	 * Returns true if a view of a given name is present
-	 * at all in the visible view stack
-	 */
-	bool isPresent(const Common::String &name) const;
-
-	/**
-	 * Returns true if combat is active
-	 */
-	bool isInCombat() const {
-		return isPresent("Combat");
-	}
-
-	/**
-	 * Returns the underlying screen
-	 */
-	Graphics::Screen *getScreen() const {
-		return _screen;
-	}
-
-	/**
-	 * Draws the focused view
-	 */
-	void drawElements() {
-		if (!_views.empty())
-			focusedView()->drawElements();
-	}
-
-	/**
-	 * Add a keypress to the event queue
-	 */
-	void addKeypress(const Common::KeyCode kc);
-
-	/**
-	 * Events manager doesn't have any intrinsic drawing
-	 */
-	void draw() override {
-	}
-
-	/**
-	 * Called once every game frame
-	 */
-	bool tick() override {
-		return !_views.empty() ? focusedView()->tick() : false;
-	}
-
-	/**
-	 * Calling the close method for g_events closes the active view
-	 */
-	void close() override {
-		focusedView()->close();
-	}
-
-	/**
-	 * Returns a random number
-	 */
-	int getRandomNumber(int minNumber, int maxNumber) {
-		return _randomSource.getRandomNumberRng(minNumber, maxNumber);
-	}
-	int getRandomNumber(int maxNumber) {
-		return _randomSource.getRandomNumber(maxNumber);
-	}
-
-	/**
-	 * Delays by a given number of milliseconds.
-	 * This shouldn't normally be used directly, since it freezes the
-	 * entire event loop and screen updates.
-	 */
-	void pauseMillis(uint millis = 10);
-
-	/**
-	 * Updates the screen
-	 */
-	void updateScreen();
-};
-
-extern Events *g_events;
-
 } // namespace Shared
 } // namespace Ultima
 
diff --git a/engines/ultima/shared/engine/messages.cpp b/engines/ultima/shared/engine/messages.cpp
deleted file mode 100644
index 4f37d656489..00000000000
--- a/engines/ultima/shared/engine/messages.cpp
+++ /dev/null
@@ -1,47 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-#include "ultima/shared/engine/messages.h"
-
-namespace Ultima {
-namespace Shared {
-namespace Messages {
-
-MouseMessage::MouseMessage(Common::EventType type,
-	const Common::Point &pos) : Message(), _pos(pos) {
-	switch (type) {
-	case Common::EVENT_RBUTTONDOWN:
-	case Common::EVENT_RBUTTONUP:
-		_button = MB_RIGHT;
-		break;
-	case Common::EVENT_MBUTTONDOWN:
-	case Common::EVENT_MBUTTONUP:
-		_button = MB_MIDDLE;
-		break;
-	default:
-		_button = MB_LEFT;
-		break;
-	}
-}
-
-} // namespace Messages
-} // namespace Shared
-} // namespace Ultima
diff --git a/engines/ultima/shared/engine/messages.h b/engines/ultima/shared/engine/messages.h
index fc1d27183ab..ce4eda28b57 100644
--- a/engines/ultima/shared/engine/messages.h
+++ b/engines/ultima/shared/engine/messages.h
@@ -22,123 +22,17 @@
 #ifndef ULTIMA_SHARED_ENGINE_MESSAGES_H
 #define ULTIMA_SHARED_ENGINE_MESSAGES_H
 
-#include "common/array.h"
-#include "common/events.h"
+#include "graphics/views/messages.h"
 
 namespace Ultima {
 namespace Shared {
 
-class UIElement;
-
-namespace Messages {
-
-struct Message {};
-
-struct FocusMessage : public Message {
-	UIElement *_priorView = nullptr;
-	FocusMessage() : Message() {
-	}
-	FocusMessage(UIElement *priorView) : Message(),
-		_priorView(priorView) {
-	}
-};
-
-struct UnfocusMessage : public Message {};
-struct MouseEnterMessage : public Message {};
-struct MouseLeaveMessage : public Message {};
-
-struct KeypressMessage : public Message, public Common::KeyState {
-	KeypressMessage() : Message() {
-	}
-	KeypressMessage(const Common::KeyState &ks) :
-		Message(), Common::KeyState(ks) {
-	}
-};
-
-struct MouseMessage : public Message {
-	enum Button {
-		MB_LEFT, MB_RIGHT, MB_MIDDLE
-	};
-	Button _button;
-	Common::Point _pos;
-
-	MouseMessage() : Message(), _button(MB_LEFT) {
-	}
-	MouseMessage(Button btn, const Common::Point &pos) :
-		Message(), _button(btn), _pos(pos) {
-	}
-	MouseMessage(Common::EventType type, const Common::Point &pos);
-};
-struct MouseDownMessage : public MouseMessage {
-	MouseDownMessage() : MouseMessage() {
-	}
-	MouseDownMessage(Button btn, const Common::Point &pos) :
-		MouseMessage(btn, pos) {
-	}
-	MouseDownMessage(Common::EventType type, const Common::Point &pos) :
-		MouseMessage(type, pos) {
-	}
-};
-struct MouseUpMessage : public MouseMessage {
-	MouseUpMessage() : MouseMessage() {
-	}
-	MouseUpMessage(Button btn, const Common::Point &pos) :
-		MouseMessage(btn, pos) {
-	}
-	MouseUpMessage(Common::EventType type, const Common::Point &pos) :
-		MouseMessage(type, pos) {
-	}
-};
-typedef MouseMessage MouseMoveMessage;
-
-struct GameMessage : public Message {
-	Common::String _name;
-	int _value;
-	Common::String _stringValue;
-
-	GameMessage() : Message(), _value(-1) {
-	}
-	GameMessage(const Common::String &name) : Message(),
-		_name(name), _value(-1) {
-	}
-	GameMessage(const Common::String &name, int value) : Message(),
-		_name(name), _value(value) {
-	}
-	GameMessage(const Common::String &name, const Common::String &value) :
-		Message(), _name(name), _stringValue(value) {
-	}
-};
-
-struct ValueMessage : public Message {
-	int _value;
-
-	ValueMessage() : Message(), _value(0) {
-	}
-	ValueMessage(int value) : Message(),
-		_value(value) {
-	}
-};
-
-struct ActionMessage : public Message {
-	int _action;
-	ActionMessage() : Message(), _action(0) {
-	}
-	ActionMessage(int action) : Message(),
-		_action(action) {
-	}
-};
-
 /**
  * Sent to a map view to have it briefly overlay a tile directly on-screen
  * at a given map position - e.g. a projectile flying towards the player,
- * or a hit flash - before restoring the view back to normal. (x, y) are
- * in map/world tile coordinates, not screen pixels; it's up to the view
- * receiving the message to convert that to its own on-screen position.
- * The handler is expected to pause briefly before returning, so combat
- * logic that shows several of these in a row (e.g. multiple attackers in
- * a single turn) will naturally have each shown with a delay in turn
+ * or a hit flash - before restoring the view back to normal.
  */
-struct AttackTileMessage : public Message {
+struct AttackTileMessage : public Graphics::Views::Message {
 	int _x, _y;
 	int _tileId;
 
@@ -149,7 +43,6 @@ struct AttackTileMessage : public Message {
 	}
 };
 
-} // namespace Messages
 } // namespace Shared
 } // namespace Ultima
 
diff --git a/engines/ultima/shared/gfx/rect.h b/engines/ultima/shared/engine/view.h
similarity index 54%
rename from engines/ultima/shared/gfx/rect.h
rename to engines/ultima/shared/engine/view.h
index df5b6c46fe8..ced1b1c5551 100644
--- a/engines/ultima/shared/gfx/rect.h
+++ b/engines/ultima/shared/engine/view.h
@@ -19,51 +19,40 @@
  *
  */
 
-#ifndef ULTIMA_SHARED_CORE_RECT_H
-#define ULTIMA_SHARED_CORE_RECT_H
+#ifndef ULTIMA_SHARED_ENGINE_VIEW_H
+#define ULTIMA_SHARED_ENGINE_VIEW_H
 
-#include "common/rect.h"
+#include "graphics/views/view.h"
+#include "ultima/shared/engine/events.h"
 
 namespace Ultima {
 namespace Shared {
-namespace Gfx {
-
-class TextPoint;
-
-typedef Common::Rect Rect;
-
-typedef Common::Point Point;
 
 /**
- * Simple derived point class that converts text coordinates to graphic screen coordinates
+ * Base class for the Ultima engines' views. Adds handling of
+ * the Ultima-specific messages on top of the common View
  */
-class TextPoint : public Common::Point {
+class View : public Graphics::Views::View {
+	ULTIMA_CUSTOM_MESSAGES(Graphics::Views::View)
 public:
-	TextPoint() : Common::Point() {
+	View(const Common::String &name, Graphics::Views::UIElement *uiParent) : Graphics::Views::View(name, uiParent) {
 	}
-	TextPoint(int16 x1, int16 y1) : Common::Point(x1 * 8, y1 * 8) {
+	View(const Common::String &name) : Graphics::Views::View(name) {
 	}
-};
-
-/**
- * Simple derived rect class that converts text coordinates to graphic screen coordinates
- */
-class TextRect : public Common::Rect {
-public:
-	TextRect() : Common::Rect() {
+	~View() override {
 	}
-	TextRect(int16 x1, int16 y1, int16 x2, int16 y2) : Common::Rect(x1 * 8, y1 * 8, (x2 + 1) * 8, (y2 + 1) * 8) {
+
+	/**
+	 * Returns a surface for drawing the element
+	 */
+	Graphics::Views::GfxSurface getSurface(bool innerBounds = false) const {
+		auto s = Graphics::Views::View::getSurface(innerBounds);
+		s.setColor(15);		// EGA white color
+		return s;
 	}
 };
 
-} // namespace Gfx
 } // namespace Shared
-
-using Shared::Gfx::Rect;
-using Shared::Gfx::Point;
-using Shared::Gfx::TextPoint;
-using Shared::Gfx::TextRect;
-
 } // namespace Ultima
 
 #endif
diff --git a/engines/ultima/shared/gfx/gfx_surface.cpp b/engines/ultima/shared/gfx/gfx_surface.cpp
deleted file mode 100644
index 419a3be104e..00000000000
--- a/engines/ultima/shared/gfx/gfx_surface.cpp
+++ /dev/null
@@ -1,199 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-#include "ultima/shared/gfx/gfx_surface.h"
-
-namespace Ultima {
-namespace Shared {
-namespace Gfx {
-
-constexpr int COLOR_NOTCH = 0;   // black - corner notch pixels
-constexpr int COLOR_BORDER = 1;  // blue - thick outer band
-constexpr int COLOR_EDGE = 15;   // white - thin inner highlight line
-
-void GfxSurface::writeString(const Common::Point &pt, const Common::String &str,
-		Graphics::TextAlign align) {
-	_textPos = pt;
-	writeString(str, align);
-}
-
-void GfxSurface::writeString(const Common::String &str, Graphics::TextAlign align) {
-	size_t strSize = 0;
-	for (const char *p = str.c_str(); *p; ++p)
-		strSize += Common::isPrint(*p) ? 1 : 0;
-
-	switch (align) {
-	case Graphics::kTextAlignCenter:
-		_textPos.x -= strSize / 2;
-		break;
-	case Graphics::kTextAlignRight:
-		_textPos.x -= strSize;
-		break;
-	case Graphics::kTextAlignLeft:
-	default:
-		break;
-	}
-
-	for (const char *p = str.c_str(); *p; ++p) {
-		if (*p == '\n') {
-			assert(align == Graphics::kTextAlignLeft);
-			newLine();
-		} else {
-			writeChar(*p);
-		}
-	}
-}
-
-void GfxSurface::writeString(const Common::Point &pt, const char *str, ...) {
-	va_list alist;
-
-	// Start reading values
-	va_start(alist, str);
-	Common::String msg = Common::String::vformat(str, alist);
-	va_end(alist);
-
-	writeString(pt, msg, Graphics::kTextAlignLeft);
-}
-
-void GfxSurface::writeString(const char *str, ...) {
-	va_list alist;
-
-	// Start reading values
-	va_start(alist, str);
-	Common::String msg = Common::String::vformat(str, alist);
-	va_end(alist);
-
-	writeString(msg, Graphics::kTextAlignLeft);
-}
-
-void GfxSurface::writeChar(uint32 chr) {
-	const int fontW = _font.getMaxCharWidth();
-	const int fontH = _font.getFontHeight();
-	const int textW = this->w / fontW;
-
-	if (chr != '\n') {
-		fillRect(Common::Rect(_textPos.x * fontW, _textPos.y * fontH, (_textPos.x + 1) * fontW, (_textPos.y + 1) * fontH), _bgColor);
-
-		if (chr == 16)
-			drawRightArrow();
-		else if (chr == 17)
-			drawLeftArrow();
-		else
-			_font.drawChar(this, chr, _textPos.x * fontW, _textPos.y * fontH, _textColor);
-
-		_textPos.x++;
-	}
-
-	if (_textPos.x >= textW || chr == '\n') {
-		newLine();
-	}
-}
-
-// Per-column vertical extent of an 8x8 right-pointing triangle, tip at
-// column 7 - column 0 is the full-height flat edge, tapering down to a
-// single pixel at the tip. Used to fill the triangle solid before the
-// diagonal edge highlights are drawn on top
-static const byte ARROW_TOP[8] = { 0, 0, 1, 1, 2, 2, 3, 3 };
-static const byte ARROW_BOTTOM[8] = { 7, 6, 6, 5, 5, 4, 4, 3 };
-
-void GfxSurface::drawRightArrow() {
-	int px = _textPos.x * 8, py = _textPos.y * 8;
-
-	for (int i = 0; i < 8; ++i)
-		drawLine(px + i, py + ARROW_TOP[i], px + i, py + ARROW_BOTTOM[i], COLOR_BORDER);
-
-	drawLine(px, py, px + 7, py + 3, COLOR_EDGE);
-	drawLine(px + 7, py + 3, px, py + 7, COLOR_EDGE);
-}
-
-void GfxSurface::drawLeftArrow() {
-	int px = _textPos.x * 8, py = _textPos.y * 8;
-
-	for (int i = 0; i < 8; ++i)
-		drawLine(px + 7 - i, py + ARROW_TOP[i], px + 7 - i, py + ARROW_BOTTOM[i], COLOR_BORDER);
-
-	drawLine(px + 7, py, px, py + 3, COLOR_EDGE);
-	drawLine(px, py + 3, px + 7, py + 7, COLOR_EDGE);
-}
-
-void GfxSurface::newLine() {
-	_textPos.x = 0;
-	_textPos.y++;
-
-	const int fontH = _font.getFontHeight();
-	const int textH = this->h / fontH;
-	if (_textPos.y >= textH) {
-		_textPos.y = textH - 1;
-
-		if (_scrollable) {
-			// Scroll the screen contents up
-			blitFrom(*this, Common::Rect(0, fontH, this->w, this->h), Common::Point(0, 0));
-			fillRect(Common::Rect(0, this->h - fontH, this->w, this->h), 0);
-		}
-	}
-}
-
-void GfxSurface::setTextPos(const Common::Point &pt) {
-	_textPos = pt;
-}
-
-int GfxSurface::getStringWidth(const Common::String &str) const {
-	return str.size() * _font.getMaxCharWidth();
-}
-
-byte GfxSurface::setColor(byte color) {
-	byte oldColor = _textColor;
-	_textColor = color;
-	return oldColor;
-}
-
-void GfxSurface::setColor(byte fgColor, byte bgColor) {
-	_textColor = fgColor;
-	_bgColor = bgColor;
-}
-
-void GfxSurface::reverseColor() {
-	SWAP(_textColor, _bgColor);
-}
-
-void GfxSurface::xorBlitFrom(const ManagedSurface &src, const Common::Point &destPos) {
-	xorBlitFrom(src, Common::Rect(0, 0, src.w, src.h), destPos);
-}
-
-void GfxSurface::xorBlitFrom(const ManagedSurface &src, const Common::Rect &srcRect, const Common::Point &destPos) {
-	// Callers are responsible for keeping destPos/srcRect fully within this
-	// surface - getSubArea doesn't clip, so an out-of-bounds rect here would
-	// silently corrupt unrelated pixels rather than getting cropped
-	Graphics::Surface area = getSubArea(Common::Rect(destPos.x, destPos.y,
-		destPos.x + srcRect.width(), destPos.y + srcRect.height()));
-
-	for (int yCtr = 0; yCtr < srcRect.height(); ++yCtr) {
-		const byte *pSrc = (const byte *)src.getBasePtr(srcRect.left, srcRect.top + yCtr);
-		byte *pDest = (byte *)area.getBasePtr(0, yCtr);
-
-		for (int xCtr = 0; xCtr < srcRect.width(); ++xCtr, ++pSrc, ++pDest)
-			*pDest ^= *pSrc;
-	}
-}
-
-} // namespace Gfx
-} // namespace Shared
-} // namespace Ultima
diff --git a/engines/ultima/shared/gfx/gfx_surface.h b/engines/ultima/shared/gfx/gfx_surface.h
deleted file mode 100644
index 8ed29fbb446..00000000000
--- a/engines/ultima/shared/gfx/gfx_surface.h
+++ /dev/null
@@ -1,79 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-#ifndef ULTIMA_SHARED_GFX_SURFACE_H
-#define ULTIMA_SHARED_GFX_SURFACE_H
-
-#include "common/rect.h"
-#include "graphics/fonts/dosfont.h"
-#include "graphics/managed_surface.h"
-
-namespace Ultima {
-namespace Shared {
-namespace Gfx {
-
-class GfxSurface : public Graphics::ManagedSurface {
-private:
-	Graphics::DosFont _font;
-	Common::Point _textPos;
-	byte _textColor = 15;
-	byte _bgColor = 0;
-	bool _scrollable = false;
-
-	void drawRightArrow();
-	void drawLeftArrow();
-	void newLine();
-
-public:
-	GfxSurface() : Graphics::ManagedSurface() {}
-	GfxSurface(Graphics::ManagedSurface &surf, const Common::Rect &bounds) : Graphics::ManagedSurface(surf, bounds) {}
-
-	/**
-	 * Write some text to the surface
-	 */
-	void writeString(const Common::Point &pt, const Common::String &str,
-		Graphics::TextAlign align = Graphics::kTextAlignLeft);
-	void writeString(const Common::String &str, Graphics::TextAlign align = Graphics::kTextAlignLeft);
-	void writeString(const Common::Point &pt, const char *str, ...);
-	void writeString(const char *str, ...);
-	void writeChar(uint32 chr);
-	int getStringWidth(const Common::String &str) const;
-
-	void setTextPos(const Common::Point &pt);
-	const Common::Point &getTextPos() const {
-		return _textPos;
-	}
-	byte setColor(byte color);
-	void setColor(byte fgColor, byte bgColor);
-	void reverseColor();
-	void setScrollable(bool flag) {
-		_scrollable = flag;
-	}
-
-	void xorBlitFrom(const ManagedSurface &src, const Common::Point &destPos);
-	void xorBlitFrom(const ManagedSurface &src, const Common::Rect &srcRect, const Common::Point &destPos);
-};
-
-} // namespace Gfx
-} // namespace Shared
-} // namespace Ultima
-
-#endif
diff --git a/engines/ultima/shared/gfx/view.cpp b/engines/ultima/shared/gfx/view.cpp
deleted file mode 100644
index 53586c23fbc..00000000000
--- a/engines/ultima/shared/gfx/view.cpp
+++ /dev/null
@@ -1,85 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-#include "ultima/shared/gfx/view.h"
-
-namespace Ultima {
-namespace Shared {
-namespace Gfx {
-
-void View::checkFocusedControl(const Common::Point &mousePos) {
-	if (_focusedElement) {
-		if (!_focusedElement->getBounds().contains(mousePos)) {
-			_focusedElement->send(MouseLeaveMessage());
-			_focusedElement = nullptr;
-		}
-
-	} else {
-		for (UIElement *child : _children) {
-			if (child->getBounds().contains(mousePos)) {
-				_focusedElement = child;
-				child->send(MouseEnterMessage());
-				break;
-			}
-		}
-	}
-}
-
-UIElement *View::getElementAtPos(const Common::Point &pos) const {
-	for (UIElement *child : _children) {
-		if (child->getBounds().contains(pos))
-			return child;
-	}
-
-	return nullptr;
-}
-
-
-bool View::msgFocus(const FocusMessage &msg) {
-	_focusedElement = nullptr;
-	return UIElement::msgFocus(msg);
-}
-
-bool View::msgUnfocus(const UnfocusMessage &msg) {
-	if (_focusedElement)
-		_focusedElement->send(MouseLeaveMessage());
-
-	return UIElement::msgUnfocus(msg);
-}
-
-bool View::msgMouseMove(const MouseMoveMessage &msg) {
-	checkFocusedControl(msg._pos);
-	return true;
-}
-
-bool View::msgMouseDown(const MouseDownMessage &msg) {
-	UIElement *child = getElementAtPos(msg._pos);
-	return child ? child->send(msg) : false;
-}
-
-bool View::msgMouseUp(const MouseUpMessage &msg) {
-	UIElement *child = getElementAtPos(msg._pos);
-	return child ? child->send(msg) : false;
-}
-
-} // namespace Gfx
-} // namespace Shared
-} // namespace Ultima
diff --git a/engines/ultima/shared/gfx/view.h b/engines/ultima/shared/gfx/view.h
deleted file mode 100644
index 37abbd69d67..00000000000
--- a/engines/ultima/shared/gfx/view.h
+++ /dev/null
@@ -1,78 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-#ifndef ULTIMA_SHARED_GFX_VIEW_H
-#define ULTIMA_SHARED_GFX_VIEW_H
-
-#include "ultima/shared/engine/events.h"
-#include "ultima/shared/gfx/rect.h"
-
-namespace Ultima {
-namespace Shared {
-namespace Gfx {
-
-/**
- * Base view class for screens and dialogs that appear on-screen.
- * The View class takes care of two important things:
- * 1) By default events get sent to all controls on a view until one
- * handles it. For mouse events, we instead want only the control the
- * mouse cursor is over to receive the events, saving the individual
- * controls from having to check if the mouse is within their bounds.
- * 2) Individual elements will get a Focus/Unfocus message as the
- * mouse enters and leaves them. This allows, for example, buttons
- * that have been pressed to de-select if the mouse leaves their bounds.
- */
-class View : public UIElement {
-private:
-	UIElement *_focusedElement = nullptr;
-
-	/**
-	 * Checks if a control is entered or left
-	 */
-	void checkFocusedControl(const Common::Point &mousePos);
-
-	/**
-	 * Check for an element at the given position
-	 */
-	UIElement *getElementAtPos(const Common::Point &pos) const;
-
-public:
-	View(const Common::String &name, UIElement *uiParent) :
-		UIElement(name, uiParent) {
-	}
-	View(const Common::String &name) :
-		UIElement(name) {
-	}
-	virtual ~View() {
-	}
-
-	bool msgFocus(const FocusMessage &msg) override;
-	bool msgUnfocus(const UnfocusMessage &msg) override;
-	bool msgMouseMove(const MouseMoveMessage &msg) override;
-	bool msgMouseDown(const MouseDownMessage &msg) override;
-	bool msgMouseUp(const MouseUpMessage &msg) override;
-};
-
-} // namespace Gfx
-} // namespace Shared
-} // namespace Ultima
-
-#endif
diff --git a/engines/ultima/ultima1/console.cpp b/engines/ultima/ultima1/console.cpp
index 5596899f8f4..39cd98090a5 100644
--- a/engines/ultima/ultima1/console.cpp
+++ b/engines/ultima/ultima1/console.cpp
@@ -69,7 +69,7 @@ bool Console::cmdMap(int argc, const char **argv) {
 		int location = atoi(argv[1]);
 
 		if (location >= 41 && location < 49) {
-			g_engine->send("Pillar", Shared::Messages::GameMessage("PILLAR", location - 41));
+			g_engine->send("Pillar", Graphics::Views::GameMessage("PILLAR", location - 41));
 		} else {
 			if (location == Data::MAP_SPACE) {
 				_G(savegame)._shipFuel = 9999;
diff --git a/engines/ultima/ultima1/gfx/text_cursor.cpp b/engines/ultima/ultima1/gfx/text_cursor.cpp
index 7a8979e4c5e..fbaa6b26674 100644
--- a/engines/ultima/ultima1/gfx/text_cursor.cpp
+++ b/engines/ultima/ultima1/gfx/text_cursor.cpp
@@ -20,7 +20,7 @@
  */
 
 #include "ultima/ultima1/gfx/text_cursor.h"
-#include "ultima/shared/gfx/rect.h"
+#include "graphics/views/rect.h"
 
 namespace Ultima {
 namespace Ultima1 {
@@ -55,7 +55,7 @@ void TextCursor::hide() {
 }
 
 void TextCursor::setPosition(const Common::Point &pt) {
-	setBounds(TextRect(pt.x, pt.y, pt.x, pt.y));
+	setBounds(Graphics::Views::TextRect(pt.x, pt.y, pt.x, pt.y));
 }
 
 void TextCursor::draw() {
diff --git a/engines/ultima/ultima1/gfx/text_cursor.h b/engines/ultima/ultima1/gfx/text_cursor.h
index c0240eb5eaa..bd526e115b3 100644
--- a/engines/ultima/ultima1/gfx/text_cursor.h
+++ b/engines/ultima/ultima1/gfx/text_cursor.h
@@ -22,7 +22,7 @@
 #ifndef ULTIMA1_GFX_TEXT_CURSOR_H
 #define ULTIMA1_GFX_TEXT_CURSOR_H
 
-#include "ultima/shared/engine/events.h"
+#include "graphics/views/events.h"
 
 namespace Ultima {
 namespace Ultima1 {
@@ -33,7 +33,7 @@ namespace Gfx {
  * through 4 frames while visible. Doesn't handle keypresses itself -
  * that's left to whichever view owns it.
  */
-class TextCursor : public Shared::UIElement {
+class TextCursor : public Graphics::Views::UIElement {
 private:
 	int _frame = 0;
 	bool _visible = true;
diff --git a/engines/ultima/ultima1/gfx/text_input.cpp b/engines/ultima/ultima1/gfx/text_input.cpp
index 98953f4e89b..87a4a66a631 100644
--- a/engines/ultima/ultima1/gfx/text_input.cpp
+++ b/engines/ultima/ultima1/gfx/text_input.cpp
@@ -20,7 +20,7 @@
  */
 
 #include "ultima/ultima1/gfx/text_input.h"
-#include "ultima/shared/gfx/rect.h"
+#include "graphics/views/rect.h"
 
 namespace Ultima {
 namespace Ultima1 {
@@ -33,7 +33,7 @@ TextInput::TextInput(const Common::String &name, UIElement *parent, TextCursor &
 void TextInput::setPosition(const Common::Point &pt, int maxWidth) {
 	_pos = pt;
 	_maxWidth = maxWidth;
-	setBounds(TextRect(pt.x, pt.y, pt.x + maxWidth, pt.y));
+	setBounds(Graphics::Views::TextRect(pt.x, pt.y, pt.x + maxWidth, pt.y));
 
 	_text.clear();
 	_visible = true;
diff --git a/engines/ultima/ultima1/gfx/text_input.h b/engines/ultima/ultima1/gfx/text_input.h
index 33edb4b185f..cb4dca5cb7e 100644
--- a/engines/ultima/ultima1/gfx/text_input.h
+++ b/engines/ultima/ultima1/gfx/text_input.h
@@ -22,14 +22,14 @@
 #ifndef ULTIMA1_GFX_TEXT_INPUT_H
 #define ULTIMA1_GFX_TEXT_INPUT_H
 
-#include "ultima/shared/engine/events.h"
+#include "graphics/views/events.h"
 #include "ultima/ultima1/gfx/text_cursor.h"
 
 namespace Ultima {
 namespace Ultima1 {
 namespace Gfx {
 
-using namespace Shared::Messages;
+using namespace Graphics::Views;
 
 /**
  * Simple text entry field. Accepts printable characters up to a maximum
@@ -41,7 +41,7 @@ using namespace Shared::Messages;
  * animation is used consistently, whether it's parked at a prompt or
  * following text as it's typed.
  */
-class TextInput : public Shared::UIElement {
+class TextInput : public Graphics::Views::UIElement {
 private:
 	Common::String _text;
 	Common::Point _pos;
diff --git a/engines/ultima/ultima1/logic/logic.cpp b/engines/ultima/ultima1/logic/logic.cpp
index f91a25eb130..8085c6ebac5 100644
--- a/engines/ultima/ultima1/logic/logic.cpp
+++ b/engines/ultima/ultima1/logic/logic.cpp
@@ -24,12 +24,13 @@
 #include "ultima/ultima1/data/map.h"
 #include "ultima/ultima1/ultima1.h"
 #include "ultima/ultima1/metaengine.h"
+#include "ultima/shared/engine/messages.h"
 
 namespace Ultima {
 namespace Ultima1 {
 namespace Logic {
 
-using namespace Shared::Messages;
+using namespace Graphics::Views;
 
 void Logic::writeString(const Common::String &msg) {
 	g_engine->baseView()->findView("Commands")->send(GameMessage("TEXT", msg));
@@ -59,7 +60,7 @@ void Logic::redrawMap() {
 }
 
 void Logic::showAttackTile(int x, int y, int tileId) {
-	g_engine->focusedView()->send(AttackTileMessage(x, y, tileId));
+	g_engine->focusedView()->send(Shared::AttackTileMessage(x, y, tileId));
 }
 
 void Logic::redrawStats() {
diff --git a/engines/ultima/ultima1/logic/overworld_logic.cpp b/engines/ultima/ultima1/logic/overworld_logic.cpp
index 15df6141bfa..f5d2e81d5a4 100644
--- a/engines/ultima/ultima1/logic/overworld_logic.cpp
+++ b/engines/ultima/ultima1/logic/overworld_logic.cpp
@@ -171,7 +171,7 @@ bool OverworldLogic::enter() {
 		writeString(msg);
 
 		if (location >= 41 && location < 49) {
-			g_engine->send("Pillar", Shared::Messages::GameMessage("PILLAR", location - 41));
+			g_engine->send("Pillar", Graphics::Views::GameMessage("PILLAR", location - 41));
 
 		} else {
 			// Load the new location
diff --git a/engines/ultima/ultima1/logic/space_logic.cpp b/engines/ultima/ultima1/logic/space_logic.cpp
index 16c30d6f0e9..e52b536ac40 100644
--- a/engines/ultima/ultima1/logic/space_logic.cpp
+++ b/engines/ultima/ultima1/logic/space_logic.cpp
@@ -24,7 +24,7 @@
 #include "ultima/ultima1/data/space_map.h"
 #include "ultima/ultima1/metaengine.h"
 #include "ultima/ultima1/ultima1.h"
-#include "ultima/shared/engine/events.h"
+#include "graphics/views/events.h"
 
 namespace Ultima {
 namespace Ultima1 {
diff --git a/engines/ultima/ultima1/ultima1.cpp b/engines/ultima/ultima1/ultima1.cpp
index 2ef7dc1d5a2..6f6c76774f1 100644
--- a/engines/ultima/ultima1/ultima1.cpp
+++ b/engines/ultima/ultima1/ultima1.cpp
@@ -37,8 +37,8 @@ namespace Ultima1 {
 
 Ultima1Engine *g_engine;
 
-Ultima1Engine::Ultima1Engine(OSystem *syst, const Ultima::UltimaGameDescription *gameDesc) : Engine(syst),
-_gameDescription(gameDesc) {
+Ultima1Engine::Ultima1Engine(OSystem *syst, const Ultima::UltimaGameDescription *gameDesc) :
+		Engine(syst), Shared::Events("ultima1"), _gameDescription(gameDesc) {
 	g_engine = this;
 }
 
@@ -69,7 +69,8 @@ Common::Error Ultima1Engine::run() {
 
 	Views::Views views;
 	addView("Startup");
-	runGame(views);
+	runGame();
+	(void)views;		// Suppress any warnings of unused local
 
 	return Common::kNoError;
 }
@@ -111,5 +112,9 @@ void Ultima1Engine::playFX(int num) {
 	warning("TODO: playFX(%d)", num);
 }
 
+void Ultima1Engine::pauseMillis(uint32 millis) {
+	g_system->delayMillis(millis);
+}
+
 } // namespace Ultima1
 } // namespace Ultima
diff --git a/engines/ultima/ultima1/ultima1.h b/engines/ultima/ultima1/ultima1.h
index 751b69cfe58..c0ca5679c82 100644
--- a/engines/ultima/ultima1/ultima1.h
+++ b/engines/ultima/ultima1/ultima1.h
@@ -35,8 +35,8 @@
 #include "engines/savestate.h"
 #include "graphics/palette.h"
 #include "graphics/screen.h"
-#include "ultima/detection.h"
 #include "ultima/shared/engine/events.h"
+#include "ultima/detection.h"
 #include "ultima/ultima1/data/map.h"
 #include "ultima/ultima1/data/map_dungeon.h"
 #include "ultima/ultima1/data/savegame.h"
@@ -138,6 +138,11 @@ public:
 	 * Play a sound effect
 	 */
 	void playFX(int num);
+
+	/**
+	 * Pause for a given number of milliseconds
+	 */
+	void pauseMillis(uint32 millis);
 };
 
 extern Ultima1Engine *g_engine;
diff --git a/engines/ultima/ultima1/views/commands.cpp b/engines/ultima/ultima1/views/commands.cpp
index 751022d2669..27f0ce51db8 100644
--- a/engines/ultima/ultima1/views/commands.cpp
+++ b/engines/ultima/ultima1/views/commands.cpp
@@ -21,7 +21,7 @@
 
 #include "ultima/ultima1/views/commands.h"
 #include "ultima/ultima1/ultima1.h"
-#include "ultima/shared/gfx/rect.h"
+#include "graphics/views/rect.h"
 
 namespace Ultima {
 namespace Ultima1 {
@@ -30,7 +30,7 @@ namespace Views {
 constexpr int COLOR_TEXT = 11;      // light cyan - normal values
 constexpr int NEWLINE_DELAY = 50;	// Delay after a newline
 
-Commands::Commands(UIElement *parent) : Shared::UIElement("Commands", parent), _textCursor("CommandsCursor", this) {
+Commands::Commands(UIElement *parent) : Graphics::Views::UIElement("Commands", parent), _textCursor("CommandsCursor", this) {
 }
 
 void Commands::draw() {
@@ -79,8 +79,8 @@ void Commands::writeString(const Common::String &msg) {
 }
 
 void Commands::resetLine() {
-	_surface.fillRect(TextRect(0, 4, 29, 4), 0);	// Clear entire bottom row
-	_surface.setTextPos(Point(0, 4));
+	_surface.fillRect(Graphics::Views::TextRect(0, 4, 29, 4), 0);	// Clear entire bottom row
+	_surface.setTextPos(Common::Point(0, 4));
 }
 
 void Commands::showCursor() {
diff --git a/engines/ultima/ultima1/views/commands.h b/engines/ultima/ultima1/views/commands.h
index d2c7156b1ca..137b5794020 100644
--- a/engines/ultima/ultima1/views/commands.h
+++ b/engines/ultima/ultima1/views/commands.h
@@ -22,18 +22,18 @@
 #ifndef ULTIMA1_VIEWS_COMMANDS_H
 #define ULTIMA1_VIEWS_COMMANDS_H
 
-#include "ultima/shared/engine/events.h"
+#include "graphics/views/events.h"
 #include "ultima/ultima1/gfx/text_cursor.h"
 
 namespace Ultima {
 namespace Ultima1 {
 namespace Views {
 
-using namespace Shared::Messages;
+using namespace Graphics::Views;
 
-class Commands : public Shared::UIElement {
+class Commands : public Graphics::Views::UIElement {
 private:
-	Shared::Gfx::GfxSurface _surface;
+	Graphics::Views::GfxSurface _surface;
 	Gfx::TextCursor _textCursor;
 
 	/**
diff --git a/engines/ultima/ultima1/views/create_character.cpp b/engines/ultima/ultima1/views/create_character.cpp
index f1b1cf375ab..02a3b2092d1 100644
--- a/engines/ultima/ultima1/views/create_character.cpp
+++ b/engines/ultima/ultima1/views/create_character.cpp
@@ -80,7 +80,7 @@ void CreateCharacter::draw() {
 	FullScreenDialog::draw();
 
 	auto s = getSurface();
-	s.setTextPos(Point(8, 0));
+	s.setTextPos(Common::Point(8, 0));
 	s.writeString(Common::Point(8, 0), "\x10 Character Generation \x11");
 
 	drawAttributes(s);
@@ -91,9 +91,9 @@ void CreateCharacter::draw() {
 		s.writeString(Common::Point(6, 4),
 			Common::String::format("Points left to distribute: %d", _pointsRemaining));
 		drawHelp(s);
-		s.setTextPos(Point(11, _selectedAttribute + 6));
+		s.setTextPos(Common::Point(11, _selectedAttribute + 6));
 		s.writeChar(16);	// Right arrow
-		s.setTextPos(Point(30, _selectedAttribute + 6));
+		s.setTextPos(Common::Point(30, _selectedAttribute + 6));
 		s.writeChar(17);	// Left arrow
 		break;
 
@@ -144,7 +144,7 @@ void CreateCharacter::draw() {
 	}
 }
 
-void CreateCharacter::drawAttributes(Shared::Gfx::GfxSurface &s) {
+void CreateCharacter::drawAttributes(Graphics::Views::GfxSurface &s) {
 	const Savegame &p = _G(savegame);
 	s.setColor(COLOR_TEXT);
 
@@ -156,7 +156,7 @@ void CreateCharacter::drawAttributes(Shared::Gfx::GfxSurface &s) {
 	s.writeString(Common::Point(12, 11), padLabel("Intelligence", 16) + Common::String::format("%2d", p._intelligence));
 }
 
-void CreateCharacter::drawHelp(Shared::Gfx::GfxSurface &s) {
+void CreateCharacter::drawHelp(Graphics::Views::GfxSurface &s) {
 	s.setColor(COLOR_TEXT);
 	s.writeString(Common::Point(2, 16), "Move cursor with up and down arrows;");
 	s.writeString(Common::Point(2, 17), "increase and decrease attributes");
@@ -165,19 +165,19 @@ void CreateCharacter::drawHelp(Shared::Gfx::GfxSurface &s) {
 	s.writeString(Common::Point(2, 20), "to return to the main menu.");
 }
 
-void CreateCharacter::drawConfirmedRace(Shared::Gfx::GfxSurface &s) {
+void CreateCharacter::drawConfirmedRace(Graphics::Views::GfxSurface &s) {
 	s.setColor(COLOR_TEXT);
 	s.writeString(Common::Point(14, 13),
 		Common::String::format("Race: %s", RACE_NAMES[_G(savegame)._race]));
 }
 
-void CreateCharacter::drawConfirmedSex(Shared::Gfx::GfxSurface &s) {
+void CreateCharacter::drawConfirmedSex(Graphics::Views::GfxSurface &s) {
 	s.setColor(COLOR_TEXT);
 	s.writeString(Common::Point(15, 14),
 		Common::String::format("Sex: %s", SEX_NAMES[_G(savegame)._sex]));
 }
 
-void CreateCharacter::drawConfirmedClass(Shared::Gfx::GfxSurface &s) {
+void CreateCharacter::drawConfirmedClass(Graphics::Views::GfxSurface &s) {
 	s.setColor(COLOR_TEXT);
 	s.writeString(Common::Point(13, 15),
 		Common::String::format("Class: %s", CLASS_NAMES[_G(savegame)._class]));
diff --git a/engines/ultima/ultima1/views/create_character.h b/engines/ultima/ultima1/views/create_character.h
index b22ac2c404c..a8340bb41cf 100644
--- a/engines/ultima/ultima1/views/create_character.h
+++ b/engines/ultima/ultima1/views/create_character.h
@@ -30,7 +30,7 @@ namespace Ultima {
 namespace Ultima1 {
 namespace Views {
 
-using namespace Shared::Messages;
+using namespace Graphics::Views;
 
 constexpr int ATTRIBUTE_COUNT = 6;
 constexpr int STARTING_POINTS = 30;
@@ -51,11 +51,11 @@ private:
 	Gfx::TextCursor _cursor;
 	Gfx::TextInput _nameInput;
 
-	void drawAttributes(Shared::Gfx::GfxSurface &s);
-	void drawHelp(Shared::Gfx::GfxSurface &s);
-	void drawConfirmedRace(Shared::Gfx::GfxSurface &s);
-	void drawConfirmedSex(Shared::Gfx::GfxSurface &s);
-	void drawConfirmedClass(Shared::Gfx::GfxSurface &s);
+	void drawAttributes(Graphics::Views::GfxSurface &s);
+	void drawHelp(Graphics::Views::GfxSurface &s);
+	void drawConfirmedRace(Graphics::Views::GfxSurface &s);
+	void drawConfirmedSex(Graphics::Views::GfxSurface &s);
+	void drawConfirmedClass(Graphics::Views::GfxSurface &s);
 
 	bool msgAttributesKey(const KeypressMessage &msg);
 	bool msgRaceKey(const KeypressMessage &msg);
diff --git a/engines/ultima/ultima1/views/dialog.cpp b/engines/ultima/ultima1/views/dialog.cpp
index f4040b2e557..21e61606e01 100644
--- a/engines/ultima/ultima1/views/dialog.cpp
+++ b/engines/ultima/ultima1/views/dialog.cpp
@@ -33,7 +33,7 @@ constexpr int COLOR_EDGE = 15;   // white - thin inner highlight line
 constexpr int COLOR_NOTCH = 0;   // black - corner notch pixels
 
 Dialog::Dialog(const Common::String &name) : View(name) {
-	setBounds(TextRect(0, 0, 39, 19));
+	setBounds(Graphics::Views::TextRect(0, 0, 39, 19));
 }
 
 void Dialog::draw() {
@@ -70,7 +70,7 @@ void Dialog::draw() {
 
 bool Dialog::tick() {
 	g_engine->findView(_G(map)._mapType == Data::MAPTYPE_SPACE ? "SpaceGame" : "Game")->tick();
-	return Shared::Gfx::View::tick();
+	return Graphics::Views::View::tick();
 }
 
 } // namespace Views
diff --git a/engines/ultima/ultima1/views/dialog.h b/engines/ultima/ultima1/views/dialog.h
index bee72a9fb5a..a49787008f1 100644
--- a/engines/ultima/ultima1/views/dialog.h
+++ b/engines/ultima/ultima1/views/dialog.h
@@ -22,7 +22,7 @@
 #ifndef ULTIMA1_VIEWS_DIALOG_H
 #define ULTIMA1_VIEWS_DIALOG_H
 
-#include "ultima/shared/gfx/view.h"
+#include "ultima/shared/engine/view.h"
 
 namespace Ultima {
 namespace Ultima1 {
@@ -31,7 +31,7 @@ namespace Views {
 /**
  * Base class for views that appear on the top hand of the screen, such as the maps, dungeon, etc.
  */
-class Dialog : public Shared::Gfx::View {
+class Dialog : public Shared::View {
 public:
 	Dialog(const Common::String &name);
 	~Dialog() override {}
diff --git a/engines/ultima/ultima1/views/dungeon_map.cpp b/engines/ultima/ultima1/views/dungeon_map.cpp
index 251c9861529..e034b4979ae 100644
--- a/engines/ultima/ultima1/views/dungeon_map.cpp
+++ b/engines/ultima/ultima1/views/dungeon_map.cpp
@@ -114,7 +114,7 @@ void DungeonMap::draw() {
 	auto s = getSurface();
 
 	// Write title showing the dungeon level
-	s.writeString(Point(15, 0), "\x10 Level %2d \x11", _G(savegame)._dungeonLevel);
+	s.writeString(Common::Point(15, 0), "\x10 Level %2d \x11", _G(savegame)._dungeonLevel);
 
 	drawDungeonView();
 }
@@ -210,7 +210,7 @@ void DungeonMap::drawFacingDirection() {
 	}
 
 	s.setColor(EDGE_COLOR);
-	s.writeString(Point(16, 19), "\x10 %s \x11", dirName);
+	s.writeString(Common::Point(16, 19), "\x10 %s \x11", dirName);
 }
 
 void DungeonMap::drawWall(int distance) {
@@ -589,7 +589,7 @@ void DungeonMap::drawDungeonView() {
 	}
 
 	auto s = getSurface();
-	s.fillRect(TextRect(1, 1, 38, 18), 0);
+	s.fillRect(Graphics::Views::TextRect(1, 1, 38, 18), 0);
 	drawFacingDirection();
 
 	const Data::DungeonCell ownCell = cellAt(pos.x, pos.y);
diff --git a/engines/ultima/ultima1/views/dungeon_map.h b/engines/ultima/ultima1/views/dungeon_map.h
index 62c7ca5fcd0..85fa5ccc923 100644
--- a/engines/ultima/ultima1/views/dungeon_map.h
+++ b/engines/ultima/ultima1/views/dungeon_map.h
@@ -30,7 +30,7 @@ namespace Ultima {
 namespace Ultima1 {
 namespace Views {
 
-using namespace Shared::Messages;
+using namespace Graphics::Views;
 
 class DungeonMap : public Map {
 private:
diff --git a/engines/ultima/ultima1/views/full_screen_dialog.h b/engines/ultima/ultima1/views/full_screen_dialog.h
index af07e961d4e..3f57d33a0d4 100644
--- a/engines/ultima/ultima1/views/full_screen_dialog.h
+++ b/engines/ultima/ultima1/views/full_screen_dialog.h
@@ -22,7 +22,7 @@
 #ifndef ULTIMA1_VIEWS_FULL_SCREEN_DIALOG_H
 #define ULTIMA1_VIEWS_FULL_SCREEN_DIALOG_H
 
-#include "ultima/shared/gfx/view.h"
+#include "ultima/shared/engine/view.h"
 
 namespace Ultima {
 namespace Ultima1 {
@@ -31,7 +31,7 @@ namespace Views {
 /**
  * Base class for views with the thick beveled-corner frame drawn around the edge of the screen
  */
-class FullScreenDialog : public Shared::Gfx::View {
+class FullScreenDialog : public Shared::View {
 public:
 	FullScreenDialog(const Common::String &name) : View(name) {}
 	~FullScreenDialog() override {}
diff --git a/engines/ultima/ultima1/views/game.cpp b/engines/ultima/ultima1/views/game.cpp
index a7882e8e108..acd37ac1ee8 100644
--- a/engines/ultima/ultima1/views/game.cpp
+++ b/engines/ultima/ultima1/views/game.cpp
@@ -25,7 +25,7 @@
 #include "ultima/ultima1/data/map.h"
 #include "ultima/ultima1/data/tiles.h"
 #include "ultima/ultima1/metaengine.h"
-#include "ultima/shared/gfx/rect.h"
+#include "graphics/views/rect.h"
 
 namespace Ultima {
 namespace Ultima1 {
@@ -35,15 +35,15 @@ namespace Views {
 constexpr int COLOR_BORDER = 1;  // blue - thick outer band
 constexpr int COLOR_EDGE = 15;   // white - thin inner highlight line
 
-Game::Game() : Shared::Gfx::View("Game"), _commands(this), _stats(this) {
-	setBounds(TextRect(0, 0, 39, 24));
-	_commands.setBounds(TextRect(0, 20, 29, 24));
-	_stats.setBounds(TextRect(31, 21, 39, 24));
+Game::Game() : Shared::View("Game"), _commands(this), _stats(this) {
+	setBounds(Graphics::Views::TextRect(0, 0, 39, 24));
+	_commands.setBounds(Graphics::Views::TextRect(0, 20, 29, 24));
+	_stats.setBounds(Graphics::Views::TextRect(31, 21, 39, 24));
 }
 
 void Game::draw() {
 	auto s = getSurface();
-	Shared::UIElement::draw();
+	Graphics::Views::UIElement::draw();
 
 	// Vertical divider between the command/message log (left) and the stats panel (right)
 	s.fillRect(Common::Rect(241, 160, 247, 200), COLOR_BORDER);
diff --git a/engines/ultima/ultima1/views/game.h b/engines/ultima/ultima1/views/game.h
index 5f1b9336d22..57b709018c2 100644
--- a/engines/ultima/ultima1/views/game.h
+++ b/engines/ultima/ultima1/views/game.h
@@ -22,7 +22,7 @@
 #ifndef ULTIMA1_VIEWS_GAME_H
 #define ULTIMA1_VIEWS_GAME_H
 
-#include "ultima/shared/gfx/view.h"
+#include "ultima/shared/engine/view.h"
 #include "ultima/ultima1/views/commands.h"
 #include "ultima/ultima1/views/stats.h"
 
@@ -34,7 +34,7 @@ namespace Views {
  * The main in-game screen. Draws the outer frame, and contains the shared
  * Commands area and Stats display. Only the actual map/dungeon area changes.
  */
-class Game : public Shared::Gfx::View {
+class Game : public Shared::View {
 private:
 	Commands _commands;
 	Stats _stats;
diff --git a/engines/ultima/ultima1/views/interactions/dead.cpp b/engines/ultima/ultima1/views/interactions/dead.cpp
index 8b201d51920..c1d3c546f7d 100644
--- a/engines/ultima/ultima1/views/interactions/dead.cpp
+++ b/engines/ultima/ultima1/views/interactions/dead.cpp
@@ -103,7 +103,7 @@ static const uint8 DEATH_GRAPHIC_DATA[DEATH_GRAPHIC_HEIGHT * 8] = {
 // Shared by Dead and SpaceDead - both claim the map viewport area (inside
 // the game border, which is left drawn by whatever view was showing
 // underneath) and centre the same skull glyph within it
-static void drawSkullGraphic(Shared::Gfx::GfxSurface &s) {
+static void drawSkullGraphic(Graphics::Views::GfxSurface &s) {
 	// This view's own bounds start at absolute screen (8, 8), so convert
 	// down to the local coordinates its surface uses
 	int startX = DEATH_GRAPHIC_SCREEN_X - 8;
diff --git a/engines/ultima/ultima1/views/interactions/dead.h b/engines/ultima/ultima1/views/interactions/dead.h
index a7372201ea2..2122fe9016a 100644
--- a/engines/ultima/ultima1/views/interactions/dead.h
+++ b/engines/ultima/ultima1/views/interactions/dead.h
@@ -29,7 +29,7 @@ namespace Ultima1 {
 namespace Views {
 namespace Interactions {
 
-using namespace Ultima::Shared::Messages;
+using namespace Graphics::Views;
 
 /**
  * Shown when the player's hit points reach zero. Plays out the original's
diff --git a/engines/ultima/ultima1/views/interactions/direction.h b/engines/ultima/ultima1/views/interactions/direction.h
index 7d4148a3a2c..eeece8b01b8 100644
--- a/engines/ultima/ultima1/views/interactions/direction.h
+++ b/engines/ultima/ultima1/views/interactions/direction.h
@@ -31,7 +31,7 @@ namespace Ultima1 {
 namespace Views {
 namespace Interactions {
 
-using namespace Ultima::Shared::Messages;
+using namespace Graphics::Views;
 
 /**
  * Waits for the user to select a direction
diff --git a/engines/ultima/ultima1/views/interactions/drop.cpp b/engines/ultima/ultima1/views/interactions/drop.cpp
index 00f1227e413..54b660c42d4 100644
--- a/engines/ultima/ultima1/views/interactions/drop.cpp
+++ b/engines/ultima/ultima1/views/interactions/drop.cpp
@@ -81,7 +81,7 @@ bool Drop::msgKeypress(const KeypressMessage &msg) {
 			showCursor();
 
 			// Draw a proper dialog with the list of selections
-			setBounds(TextRect(0, 0, 39, 19));
+			setBounds(Graphics::Views::TextRect(0, 0, 39, 19));
 			redraw();
 			break;
 
@@ -97,7 +97,7 @@ bool Drop::msgKeypress(const KeypressMessage &msg) {
 			showCursor();
 
 			// Draw a proper dialog with the list of selections
-			setBounds(TextRect(0, 0, 39, 19));
+			setBounds(Graphics::Views::TextRect(0, 0, 39, 19));
 			redraw();
 			break;
 
@@ -137,10 +137,10 @@ void Drop::draw() {
 
 	// Display title
 	auto s = getSurface();
-	s.writeString(Point(16, 0), "\x10 Drop \x11");
+	s.writeString(Common::Point(16, 0), "\x10 Drop \x11");
 
 	// Clear dialog content
-	s.fillRect(TextRect(1, 1, 38, 18), 0);
+	s.fillRect(Graphics::Views::TextRect(1, 1, 38, 18), 0);
 
 	switch (_mode) {
 	case DROP_WEAPON:
@@ -162,7 +162,7 @@ void Drop::drawItemList(const int16 *items, const char *const *names, int maxInd
 	s.setColor(COLOR_TEXT);
 	for (int idx = 1; idx <= maxIndex; ++idx) {
 		if (items[idx]) {
-			s.writeString(Point(col, y), "%c) %s", 'a' + idx, names[idx]);
+			s.writeString(Common::Point(col, y), "%c) %s", 'a' + idx, names[idx]);
 			++y;
 		}
 	}
diff --git a/engines/ultima/ultima1/views/interactions/drop.h b/engines/ultima/ultima1/views/interactions/drop.h
index a593bef5f35..1b9b04b3684 100644
--- a/engines/ultima/ultima1/views/interactions/drop.h
+++ b/engines/ultima/ultima1/views/interactions/drop.h
@@ -29,7 +29,7 @@ namespace Ultima1 {
 namespace Views {
 namespace Interactions {
 
-using namespace Ultima::Shared::Messages;
+using namespace Graphics::Views;
 
 /**
  * Handler for the Drop command. Only usable in cities and castles
diff --git a/engines/ultima/ultima1/views/interactions/entering_craft.h b/engines/ultima/ultima1/views/interactions/entering_craft.h
index a93ef976d8a..a85ab3be395 100644
--- a/engines/ultima/ultima1/views/interactions/entering_craft.h
+++ b/engines/ultima/ultima1/views/interactions/entering_craft.h
@@ -29,7 +29,7 @@ namespace Ultima1 {
 namespace Views {
 namespace Interactions {
 
-using namespace Ultima::Shared::Messages;
+using namespace Graphics::Views;
 
 /**
  * Shown after boarding the time machine with all four gems - a four page
diff --git a/engines/ultima/ultima1/views/interactions/interaction.cpp b/engines/ultima/ultima1/views/interactions/interaction.cpp
index ec565dee2ed..e17b776a706 100644
--- a/engines/ultima/ultima1/views/interactions/interaction.cpp
+++ b/engines/ultima/ultima1/views/interactions/interaction.cpp
@@ -27,7 +27,7 @@ namespace Ultima1 {
 namespace Views {
 namespace Interactions {
 
-using namespace Ultima::Shared::Messages;
+using namespace Graphics::Views;
 
 Interaction::Interaction(const Common::String &name) : View(name) {
 	setBounds(Common::Rect(0, 0, 0, 0));
@@ -35,7 +35,7 @@ Interaction::Interaction(const Common::String &name) : View(name) {
 
 bool Interaction::tick() {
 	g_engine->baseView()->findView("Commands")->tick();
-	return Shared::Gfx::View::tick();
+	return Graphics::Views::View::tick();
 }
 
 void Interaction::writeString(const Common::String &msg) {
diff --git a/engines/ultima/ultima1/views/interactions/interaction.h b/engines/ultima/ultima1/views/interactions/interaction.h
index 6e4a6aff1bb..ec8d58cbf35 100644
--- a/engines/ultima/ultima1/views/interactions/interaction.h
+++ b/engines/ultima/ultima1/views/interactions/interaction.h
@@ -22,7 +22,7 @@
 #ifndef ULTIMA1_VIEWS_INTERACTIONS_INTERACTION_H
 #define ULTIMA1_VIEWS_INTERACTIONS_INTERACTION_H
 
-#include "ultima/shared/gfx/view.h"
+#include "ultima/shared/engine/view.h"
 
 namespace Ultima {
 namespace Ultima1 {
@@ -34,7 +34,7 @@ namespace Interactions {
  * It creates a dummy 0x0 size window on top of the current one that
  * can receive input, and does any output in the commands window
  */
-class Interaction : public Shared::Gfx::View {
+class Interaction : public Shared::View {
 protected:
 	void writeString(const Common::String &msg);
 	void writeString(const char *format, ...);
diff --git a/engines/ultima/ultima1/views/interactions/king.h b/engines/ultima/ultima1/views/interactions/king.h
index 625e2104a30..fa18832eeec 100644
--- a/engines/ultima/ultima1/views/interactions/king.h
+++ b/engines/ultima/ultima1/views/interactions/king.h
@@ -30,7 +30,7 @@ namespace Ultima1 {
 namespace Views {
 namespace Interactions {
 
-using namespace Ultima::Shared::Messages;
+using namespace Graphics::Views;
 
 /**
  * Handler for the Transact command's king interaction within castles.
diff --git a/engines/ultima/ultima1/views/interactions/liftoff.h b/engines/ultima/ultima1/views/interactions/liftoff.h
index 7f95fc91abf..eb2e4e5578b 100644
--- a/engines/ultima/ultima1/views/interactions/liftoff.h
+++ b/engines/ultima/ultima1/views/interactions/liftoff.h
@@ -29,7 +29,7 @@ namespace Ultima1 {
 namespace Views {
 namespace Interactions {
 
-using namespace Ultima::Shared::Messages;
+using namespace Graphics::Views;
 
 /**
  * Shown when the player lifts off in a shuttle/time machine to enter the
diff --git a/engines/ultima/ultima1/views/interactions/lose.cpp b/engines/ultima/ultima1/views/interactions/lose.cpp
index 24a5f6290d8..bdae6b7d932 100644
--- a/engines/ultima/ultima1/views/interactions/lose.cpp
+++ b/engines/ultima/ultima1/views/interactions/lose.cpp
@@ -35,7 +35,7 @@ constexpr int DIALOG_X1 = 31, DIALOG_Y1 = 23, DIALOG_X2 = 287, DIALOG_Y2 = 127;
 constexpr int BORDER_X1 = 34, BORDER_Y1 = 26, BORDER_X2 = 284, BORDER_Y2 = 124;
 
 bool Lose::msgFocus(const FocusMessage &msg) {
-	setBounds(TextRect(0, 0, 39, 19));
+	setBounds(Graphics::Views::TextRect(0, 0, 39, 19));
 
 	g_engine->send("Commands", GameMessage("TEXT", "THOU ART DEAD!"));
 	g_engine->playFX(2);
@@ -51,13 +51,13 @@ void Lose::draw() {
 
 void Lose::drawDialog() {
 	auto s = getSurface();
-	s.fillRect(Rect(DIALOG_X1, DIALOG_Y1, DIALOG_X2, DIALOG_Y2), 0);
-	s.frameRect(Rect(BORDER_X1, BORDER_Y1, BORDER_X2, BORDER_Y2), BORDER_COLOR);
+	s.fillRect(Common::Rect(DIALOG_X1, DIALOG_Y1, DIALOG_X2, DIALOG_Y2), 0);
+	s.frameRect(Common::Rect(BORDER_X1, BORDER_Y1, BORDER_X2, BORDER_Y2), BORDER_COLOR);
 
 	s.setColor(TEXT_COLOR);
-	s.writeString(Point(5, 6), "   Thou hast been defeated by");
-	s.writeString(Point(5, 7), "      Mondain the Wizard!");
-	s.writeString(Point(5, 12), "    THE UNIVERSE IS DOOMED!");
+	s.writeString(Common::Point(5, 6), "   Thou hast been defeated by");
+	s.writeString(Common::Point(5, 7), "      Mondain the Wizard!");
+	s.writeString(Common::Point(5, 12), "    THE UNIVERSE IS DOOMED!");
 }
 
 bool Lose::msgAction(const ActionMessage &msg) {
diff --git a/engines/ultima/ultima1/views/interactions/lose.h b/engines/ultima/ultima1/views/interactions/lose.h
index 640d39a5689..58b207d87ca 100644
--- a/engines/ultima/ultima1/views/interactions/lose.h
+++ b/engines/ultima/ultima1/views/interactions/lose.h
@@ -29,7 +29,7 @@ namespace Ultima1 {
 namespace Views {
 namespace Interactions {
 
-using namespace Ultima::Shared::Messages;
+using namespace Graphics::Views;
 
 /**
  * Shown when Mondain kills the player. Unlike the normal Dead view there's
diff --git a/engines/ultima/ultima1/views/interactions/merchant.cpp b/engines/ultima/ultima1/views/interactions/merchant.cpp
index 3f51a117122..66d26deb663 100644
--- a/engines/ultima/ultima1/views/interactions/merchant.cpp
+++ b/engines/ultima/ultima1/views/interactions/merchant.cpp
@@ -192,8 +192,8 @@ void Merchant::draw() {
 		return;
 
 	auto s = getSurface();
-	s.writeString(Point(15, 0), "\x10 Transact \x11");
-	s.fillRect(TextRect(1, 1, 38, 18), 0);
+	s.writeString(Common::Point(15, 0), "\x10 Transact \x11");
+	s.fillRect(Graphics::Views::TextRect(1, 1, 38, 18), 0);
 
 	if (_mode == SHOP_BUY) {
 		switch (_shopType) {
@@ -242,9 +242,9 @@ void Merchant::drawShopName() {
 
 	auto s = getSurface();
 	s.setColor(COLOR_TEXT);
-	s.writeString(Point(19 - (int)Common::String(name._line1).size() / 2, 2), "%s", name._line1);
+	s.writeString(Common::Point(19 - (int)Common::String(name._line1).size() / 2, 2), "%s", name._line1);
 	if (name._line2)
-		s.writeString(Point(19 - (int)Common::String(name._line2).size() / 2, 3), "%s", name._line2);
+		s.writeString(Common::Point(19 - (int)Common::String(name._line2).size() / 2, 3), "%s", name._line2);
 }
 
 bool Merchant::isWenchNearby() const {
@@ -285,7 +285,7 @@ void Merchant::chooseBuy() {
 	case SHOP_WEAPONS:
 	case SHOP_MAGIC:
 		_mode = SHOP_BUY;
-		setBounds(TextRect(0, 0, 39, 19));
+		setBounds(Graphics::Views::TextRect(0, 0, 39, 19));
 		redraw();
 		break;
 
@@ -333,7 +333,7 @@ void Merchant::chooseBuy() {
 		}
 
 		_mode = SHOP_BUY;
-		setBounds(TextRect(0, 0, 39, 19));
+		setBounds(Graphics::Views::TextRect(0, 0, 39, 19));
 		redraw();
 		break;
 	}
@@ -360,7 +360,7 @@ void Merchant::chooseSell() {
 			nothing();
 		} else {
 			_mode = SHOP_SELL;
-			setBounds(TextRect(0, 0, 39, 19));
+			setBounds(Graphics::Views::TextRect(0, 0, 39, 19));
 			redraw();
 		}
 		break;
@@ -377,7 +377,7 @@ void Merchant::chooseSell() {
 			nothing();
 		} else {
 			_mode = SHOP_SELL;
-			setBounds(TextRect(0, 0, 39, 19));
+			setBounds(Graphics::Views::TextRect(0, 0, 39, 19));
 			redraw();
 		}
 		break;
@@ -418,8 +418,8 @@ void Merchant::drawArmoryBuy() {
 	int y = 8;
 	for (int idx = 1; idx <= maxIdx; ++idx, ++y) {
 		int price = ((200 - _G(savegame)._intelligence) / 4) * idx;
-		s.writeString(Point(10, y), "%c) %s", 'a' + idx, Data::ARMOR_NAMES[idx]);
-		s.writeString(Point(27, y), "-%3d", price);
+		s.writeString(Common::Point(10, y), "%c) %s", 'a' + idx, Data::ARMOR_NAMES[idx]);
+		s.writeString(Common::Point(27, y), "-%3d", price);
 	}
 }
 
@@ -459,8 +459,8 @@ void Merchant::drawArmorySell() {
 	for (int idx = 1; idx < Data::ARMOR_COUNT; ++idx) {
 		if (_G(savegame)._armor[idx]) {
 			int price = (_G(savegame)._charisma + 40) * idx * idx / 256 + 1;
-			s.writeString(Point(10, y), "%c) %s", 'a' + idx, Data::ARMOR_NAMES[idx]);
-			s.writeString(Point(27, y), "-%3d", price);
+			s.writeString(Common::Point(10, y), "%c) %s", 'a' + idx, Data::ARMOR_NAMES[idx]);
+			s.writeString(Common::Point(27, y), "-%3d", price);
 			++y;
 		}
 	}
@@ -513,8 +513,8 @@ void Merchant::drawWeaponsBuy() {
 	int y = 8;
 	for (int idx = minIdx; idx <= maxIdx; idx += 2, ++y) {
 		int price = (255 - _G(savegame)._intelligence) * idx * idx / 256 + 5;
-		s.writeString(Point(9, y), "%c) %s", 'a' + idx, Data::WEAPON_NAMES[idx]);
-		s.writeString(Point(26, y), "-%3d", price);
+		s.writeString(Common::Point(9, y), "%c) %s", 'a' + idx, Data::WEAPON_NAMES[idx]);
+		s.writeString(Common::Point(26, y), "-%3d", price);
 	}
 }
 
@@ -555,8 +555,8 @@ void Merchant::drawWeaponsSell() {
 	for (int idx = 1; idx < Data::WEAPON_COUNT; ++idx) {
 		if (_G(savegame)._weapons[idx]) {
 			int price = (_G(savegame)._charisma + 40) * idx * idx / 256 + 1;
-			s.writeString(Point(9, y), "%c) %s", 'a' + idx, Data::WEAPON_NAMES[idx]);
-			s.writeString(Point(26, y), "-%3d", price);
+			s.writeString(Common::Point(9, y), "%c) %s", 'a' + idx, Data::WEAPON_NAMES[idx]);
+			s.writeString(Common::Point(26, y), "-%3d", price);
 			++y;
 		}
 	}
@@ -606,8 +606,8 @@ void Merchant::drawMagicBuy() {
 			continue;
 
 		int price = ((200 - _G(savegame)._wisdom) / 32) * idx;
-		s.writeString(Point(9, y), "%c) %s", 'a' + idx, Data::SPELL_NAMES[idx]);
-		s.writeString(Point(26, y), "-%3d", price);
+		s.writeString(Common::Point(9, y), "%c) %s", 'a' + idx, Data::SPELL_NAMES[idx]);
+		s.writeString(Common::Point(26, y), "-%3d", price);
 		++y;
 	}
 }
@@ -748,8 +748,8 @@ void Merchant::drawTransportBuy() {
 
 		int transportId = _transportIds[i];
 		int price = ((200 - _G(savegame)._intelligence) / 5) * transportId * transportId;
-		s.writeString(Point(11, y), "%c) %s", 'a' + i, Data::TRANSPORT_NAMES[transportId]);
-		s.writeString(Point(22, y), "-%4d", price);
+		s.writeString(Common::Point(11, y), "%c) %s", 'a' + i, Data::TRANSPORT_NAMES[transportId]);
+		s.writeString(Common::Point(22, y), "-%4d", price);
 	}
 }
 
diff --git a/engines/ultima/ultima1/views/interactions/merchant.h b/engines/ultima/ultima1/views/interactions/merchant.h
index 441a1878caf..b4d3fd8ef09 100644
--- a/engines/ultima/ultima1/views/interactions/merchant.h
+++ b/engines/ultima/ultima1/views/interactions/merchant.h
@@ -30,7 +30,7 @@ namespace Ultima1 {
 namespace Views {
 namespace Interactions {
 
-using namespace Ultima::Shared::Messages;
+using namespace Graphics::Views;
 
 /**
  * The kind of shop found at the counter tile the player is standing on
diff --git a/engines/ultima/ultima1/views/interactions/operate_craft.h b/engines/ultima/ultima1/views/interactions/operate_craft.h
index f1a9ea4766b..92e68fc898b 100644
--- a/engines/ultima/ultima1/views/interactions/operate_craft.h
+++ b/engines/ultima/ultima1/views/interactions/operate_craft.h
@@ -29,7 +29,7 @@ namespace Ultima1 {
 namespace Views {
 namespace Interactions {
 
-using namespace Ultima::Shared::Messages;
+using namespace Graphics::Views;
 
 /**
  * Shown when the player boards the time machine without having all four
diff --git a/engines/ultima/ultima1/views/interactions/pillar.cpp b/engines/ultima/ultima1/views/interactions/pillar.cpp
index 26df4b46305..3dc0c33fc94 100644
--- a/engines/ultima/ultima1/views/interactions/pillar.cpp
+++ b/engines/ultima/ultima1/views/interactions/pillar.cpp
@@ -76,7 +76,7 @@ bool Pillar::msgGame(const GameMessage &msg) {
 }
 
 bool Pillar::msgFocus(const FocusMessage &msg) {
-	setBounds(TextRect(0, 0, 39, 19));
+	setBounds(Graphics::Views::TextRect(0, 0, 39, 19));
 	_borderColor = COLOR_BORDER;
 
 	auto &sg = _G(savegame);
@@ -119,8 +119,8 @@ void Pillar::timeout() {
 
 void Pillar::draw() {
 	auto s = getSurface();
-	s.fillRect(Rect(DIALOG_X1, DIALOG_Y1, DIALOG_X2, DIALOG_Y2), 0);
-	s.frameRect(Rect(BORDER_X1, BORDER_Y1, BORDER_X2, BORDER_Y2), _borderColor);
+	s.fillRect(Common::Rect(DIALOG_X1, DIALOG_Y1, DIALOG_X2, DIALOG_Y2), 0);
+	s.frameRect(Common::Rect(BORDER_X1, BORDER_Y1, BORDER_X2, BORDER_Y2), _borderColor);
 
 	s.setColor(COLOR_TEXT);
 	drawInscription();
@@ -131,44 +131,44 @@ void Pillar::drawInscription() {
 
 	switch (_locationNum) {
 	case 0:
-		s.writeString(Point(8, 8), "You feel a strong magic");
-		s.writeString(Point(12, 9), "surrounding you!");
+		s.writeString(Common::Point(8, 8), "You feel a strong magic");
+		s.writeString(Common::Point(12, 9), "surrounding you!");
 		break;
 	case 1:
-		s.writeString(Point(10, 7), "You hear someone say,");
-		s.writeString(Point(6, 9), " \"TURIS-SCIENTIA-MAGNOPERE\"");
+		s.writeString(Common::Point(10, 7), "You hear someone say,");
+		s.writeString(Common::Point(6, 9), " \"TURIS-SCIENTIA-MAGNOPERE\"");
 		break;
 	case 2:
-		s.writeString(Point(13, 7), "A sign reads:");
-		s.writeString(Point(8, 9), "\"FORTES FORTUNA ADIUVAT!\"");
+		s.writeString(Common::Point(13, 7), "A sign reads:");
+		s.writeString(Common::Point(8, 9), "\"FORTES FORTUNA ADIUVAT!\"");
 		break;
 	case 3:
-		s.writeString(Point(13, 5), "On a pedestal,");
-		s.writeString(Point(10, 6), "these words appear:");
-		s.writeString(Point(8, 7), "\"MY NAME IS OZYMANDIAS,");
-		s.writeString(Point(13, 8), "KING OF KINGS:");
-		s.writeString(Point(11, 9), "LOOK AT MY WORKS,");
-		s.writeString(Point(8, 10), "YE MIGHTY, AND DESPAIR!\"");
-		s.writeString(Point(8, 12), "Nothing beside remains.");
-		s.writeString(Point(7, 13), "You feel a strange force!");
+		s.writeString(Common::Point(13, 5), "On a pedestal,");
+		s.writeString(Common::Point(10, 6), "these words appear:");
+		s.writeString(Common::Point(8, 7), "\"MY NAME IS OZYMANDIAS,");
+		s.writeString(Common::Point(13, 8), "KING OF KINGS:");
+		s.writeString(Common::Point(11, 9), "LOOK AT MY WORKS,");
+		s.writeString(Common::Point(8, 10), "YE MIGHTY, AND DESPAIR!\"");
+		s.writeString(Common::Point(8, 12), "Nothing beside remains.");
+		s.writeString(Common::Point(7, 13), "You feel a strange force!");
 		break;
 	case 4:
-		s.writeString(Point(12, 6), "The sign reads:");
-		s.writeString(Point(12, 8), "\"ULTIMA THULE!\"");
-		s.writeString(Point(7, 10), "The sky grows dark, and a");
-		s.writeString(Point(7, 11), "strong magic engulfs you!");
+		s.writeString(Common::Point(12, 6), "The sign reads:");
+		s.writeString(Common::Point(12, 8), "\"ULTIMA THULE!\"");
+		s.writeString(Common::Point(7, 10), "The sky grows dark, and a");
+		s.writeString(Common::Point(7, 11), "strong magic engulfs you!");
 		break;
 	case 5:
-		s.writeString(Point(12, 7), "The sign reads:");
-		s.writeString(Point(11, 9), "\"OMNIA MUTANTUR!\"");
+		s.writeString(Common::Point(12, 7), "The sign reads:");
+		s.writeString(Common::Point(11, 9), "\"OMNIA MUTANTUR!\"");
 		break;
 	case 6:
-		s.writeString(Point(12, 7), "The sign reads:");
-		s.writeString(Point(9, 9), "\"GO EAST TO GO EAST!\"");
+		s.writeString(Common::Point(12, 7), "The sign reads:");
+		s.writeString(Common::Point(9, 9), "\"GO EAST TO GO EAST!\"");
 		break;
 	case 7:
-		s.writeString(Point(10, 7), "The grave is marked:");
-		s.writeString(Point(14, 9), "\"VAE VICTIS\"");
+		s.writeString(Common::Point(10, 7), "The grave is marked:");
+		s.writeString(Common::Point(14, 9), "\"VAE VICTIS\"");
 		break;
 	default:
 		break;
diff --git a/engines/ultima/ultima1/views/interactions/pillar.h b/engines/ultima/ultima1/views/interactions/pillar.h
index b5e57cba6ed..4ad5b178c3c 100644
--- a/engines/ultima/ultima1/views/interactions/pillar.h
+++ b/engines/ultima/ultima1/views/interactions/pillar.h
@@ -29,7 +29,7 @@ namespace Ultima1 {
 namespace Views {
 namespace Interactions {
 
-using namespace Ultima::Shared::Messages;
+using namespace Graphics::Views;
 
 /**
  * Handles Pillar locations on the overworld map. Each of the 8 pillars
diff --git a/engines/ultima/ultima1/views/interactions/princess_saved.h b/engines/ultima/ultima1/views/interactions/princess_saved.h
index 7a9fd72308c..123a2ef795d 100644
--- a/engines/ultima/ultima1/views/interactions/princess_saved.h
+++ b/engines/ultima/ultima1/views/interactions/princess_saved.h
@@ -30,7 +30,7 @@ namespace Ultima1 {
 namespace Views {
 namespace Interactions {
 
-using namespace Ultima::Shared::Messages;
+using namespace Graphics::Views;
 
 /**
  * Shown when the player carries a castle's princess out past its bounds.
diff --git a/engines/ultima/ultima1/views/interactions/ready.cpp b/engines/ultima/ultima1/views/interactions/ready.cpp
index 409587c13f0..afa8c932071 100644
--- a/engines/ultima/ultima1/views/interactions/ready.cpp
+++ b/engines/ultima/ultima1/views/interactions/ready.cpp
@@ -58,7 +58,7 @@ bool Ready::msgKeypress(const KeypressMessage &msg) {
 			showCursor();
 
 			// Draw a proper dialog with the list of selections
-			setBounds(TextRect(0, 0, 39, 19));
+			setBounds(Graphics::Views::TextRect(0, 0, 39, 19));
 			redraw();
 			break;
 
@@ -70,7 +70,7 @@ bool Ready::msgKeypress(const KeypressMessage &msg) {
 			showCursor();
 
 			// Draw a proper dialog with the list of selections
-			setBounds(TextRect(0, 0, 39, 19));
+			setBounds(Graphics::Views::TextRect(0, 0, 39, 19));
 			redraw();
 			break;
 
@@ -82,7 +82,7 @@ bool Ready::msgKeypress(const KeypressMessage &msg) {
 			showCursor();
 
 			// Draw a proper dialog with the list of selections
-			setBounds(TextRect(0, 0, 39, 19));
+			setBounds(Graphics::Views::TextRect(0, 0, 39, 19));
 			redraw();
 			break;
 
@@ -122,10 +122,10 @@ void Ready::draw() {
 
 	// Display title
 	auto s = getSurface();
-	s.writeString(Point(16, 0), "\x10 Ready \x11");
+	s.writeString(Common::Point(16, 0), "\x10 Ready \x11");
 
 	// Clear dialog content
-	s.fillRect(TextRect(1, 1, 38, 18), 0);
+	s.fillRect(Graphics::Views::TextRect(1, 1, 38, 18), 0);
 
 	// Draw list of selections
 	switch (_mode) {
@@ -158,7 +158,7 @@ void Ready::drawItemList(const int16 *items, const char *const *names, int maxIn
 
 	for (int idx = 0; idx <= maxIndex; ++idx) {
 		if (items[idx]) {
-			s.writeString(Point(15, y), "%c) %s", 'a' + idx, names[idx]);
+			s.writeString(Common::Point(15, y), "%c) %s", 'a' + idx, names[idx]);
 			++y;
 		}
 	}
diff --git a/engines/ultima/ultima1/views/interactions/ready.h b/engines/ultima/ultima1/views/interactions/ready.h
index 206aedcb766..1a265cf28ca 100644
--- a/engines/ultima/ultima1/views/interactions/ready.h
+++ b/engines/ultima/ultima1/views/interactions/ready.h
@@ -29,7 +29,7 @@ namespace Ultima1 {
 namespace Views {
 namespace Interactions {
 
-using namespace Ultima::Shared::Messages;
+using namespace Graphics::Views;
 
 /**
  * Handler for the Ready command
diff --git a/engines/ultima/ultima1/views/interactions/sector_scan.cpp b/engines/ultima/ultima1/views/interactions/sector_scan.cpp
index af6962dcfed..cbd382033f6 100644
--- a/engines/ultima/ultima1/views/interactions/sector_scan.cpp
+++ b/engines/ultima/ultima1/views/interactions/sector_scan.cpp
@@ -59,11 +59,11 @@ void SectorScan::draw() {
 	auto s = getSurface();
 
 	// Inset dialog box
-	s.fillRect(Rect(DIALOG_X1, DIALOG_Y1, DIALOG_X2, DIALOG_Y2), 0);
-	s.frameRect(Rect(BORDER_X1, BORDER_Y1, BORDER_X2, BORDER_Y2), FRAME_COLOR);
+	s.fillRect(Common::Rect(DIALOG_X1, DIALOG_Y1, DIALOG_X2, DIALOG_Y2), 0);
+	s.frameRect(Common::Rect(BORDER_X1, BORDER_Y1, BORDER_X2, BORDER_Y2), FRAME_COLOR);
 
 	s.setColor(TEXT_COLOR);
-	s.writeString(Point(5, 4), "Sector Scan:");
+	s.writeString(Common::Point(5, 4), "Sector Scan:");
 
 	// The scan grid outline
 	s.drawLine(GRID_X1, GRID_Y1, GRID_X2, GRID_Y1, MARKER_COLOR);
@@ -80,11 +80,11 @@ void SectorScan::draw() {
 	// beat
 	if (!_blipVisible) {
 		int px = cellX(_G(savegame)._sectorX), py = cellY(_G(savegame)._sectorY);
-		s.fillRect(Rect(px, py, px + 8, py + 9), 0);
+		s.fillRect(Common::Rect(px, py, px + 8, py + 9), 0);
 	}
 }
 
-void SectorScan::drawSectorIcon(Shared::Gfx::GfxSurface &s, int sx, int sy) {
+void SectorScan::drawSectorIcon(Graphics::Views::GfxSurface &s, int sx, int sy) {
 	const Data::SpaceMapCell &cell = _G(savegame)._starmap._sectors[sx][sy];
 	int px = cellX(sx), py = cellY(sy);
 
@@ -98,7 +98,7 @@ void SectorScan::drawSectorIcon(Shared::Gfx::GfxSurface &s, int sx, int sy) {
 		drawEmptyMarker(s, px, py);
 }
 
-void SectorScan::drawEnemyMarker(Shared::Gfx::GfxSurface &s, int x, int y) {
+void SectorScan::drawEnemyMarker(Graphics::Views::GfxSurface &s, int x, int y) {
 	// Two side bars each end, two rungs across the middle - a fighter shape
 	for (int i = 0; i < 2; ++i) {
 		s.drawLine(x + i, y, x + i, y + 7, MARKER_COLOR);
@@ -107,7 +107,7 @@ void SectorScan::drawEnemyMarker(Shared::Gfx::GfxSurface &s, int x, int y) {
 	}
 }
 
-void SectorScan::drawStationMarker(Shared::Gfx::GfxSurface &s, int x, int y) {
+void SectorScan::drawStationMarker(Graphics::Views::GfxSurface &s, int x, int y) {
 	// A cross
 	for (int i = 0; i < 2; ++i) {
 		s.drawLine(x + i + 3, y, x + i + 3, y + 7, MARKER_COLOR);
@@ -115,7 +115,7 @@ void SectorScan::drawStationMarker(Shared::Gfx::GfxSurface &s, int x, int y) {
 	}
 }
 
-void SectorScan::drawStarMarker(Shared::Gfx::GfxSurface &s, int x, int y) {
+void SectorScan::drawStarMarker(Graphics::Views::GfxSurface &s, int x, int y) {
 	// A small diamond
 	for (int i = 0; i < 3; ++i) {
 		s.drawLine(x + 3 - i, y + i + 1, x + 3 + i, y + i + 1, MARKER_COLOR);
@@ -123,7 +123,7 @@ void SectorScan::drawStarMarker(Shared::Gfx::GfxSurface &s, int x, int y) {
 	}
 }
 
-void SectorScan::drawEmptyMarker(Shared::Gfx::GfxSurface &s, int x, int y) {
+void SectorScan::drawEmptyMarker(Graphics::Views::GfxSurface &s, int x, int y) {
 	// A sparse scattering of dots
 	s.setPixel(x + 1, y + 1, MARKER_COLOR);
 	s.setPixel(x + 3, y + 3, EMPTY_HILIGHT_COLOR);
diff --git a/engines/ultima/ultima1/views/interactions/sector_scan.h b/engines/ultima/ultima1/views/interactions/sector_scan.h
index b4c8831463a..309bbe2fc6f 100644
--- a/engines/ultima/ultima1/views/interactions/sector_scan.h
+++ b/engines/ultima/ultima1/views/interactions/sector_scan.h
@@ -23,14 +23,14 @@
 #define ULTIMA1_VIEWS_INTERACTIONS_SECTOR_SCAN_H
 
 #include "ultima/ultima1/views/interactions/interaction.h"
-#include "ultima/shared/gfx/gfx_surface.h"
+#include "graphics/views/gfx_surface.h"
 
 namespace Ultima {
 namespace Ultima1 {
 namespace Views {
 namespace Interactions {
 
-using namespace Ultima::Shared::Messages;
+using namespace Graphics::Views;
 
 /**
  * The outer-space Inform command's "Sector Scan" dialog (SPACE.EXE's own
@@ -43,11 +43,11 @@ private:
 	int _blinkCtr = 0;
 	bool _blipVisible = true;
 
-	void drawSectorIcon(Shared::Gfx::GfxSurface &s, int sx, int sy);
-	void drawEnemyMarker(Shared::Gfx::GfxSurface &s, int x, int y);
-	void drawStationMarker(Shared::Gfx::GfxSurface &s, int x, int y);
-	void drawStarMarker(Shared::Gfx::GfxSurface &s, int x, int y);
-	void drawEmptyMarker(Shared::Gfx::GfxSurface &s, int x, int y);
+	void drawSectorIcon(Graphics::Views::GfxSurface &s, int sx, int sy);
+	void drawEnemyMarker(Graphics::Views::GfxSurface &s, int x, int y);
+	void drawStationMarker(Graphics::Views::GfxSurface &s, int x, int y);
+	void drawStarMarker(Graphics::Views::GfxSurface &s, int x, int y);
+	void drawEmptyMarker(Graphics::Views::GfxSurface &s, int x, int y);
 
 public:
 	SectorScan() : Interaction("SectorScan") {
diff --git a/engines/ultima/ultima1/views/interactions/space_station.h b/engines/ultima/ultima1/views/interactions/space_station.h
index eb8c11f5be1..4780066e2fa 100644
--- a/engines/ultima/ultima1/views/interactions/space_station.h
+++ b/engines/ultima/ultima1/views/interactions/space_station.h
@@ -29,7 +29,7 @@ namespace Ultima1 {
 namespace Views {
 namespace Interactions {
 
-using namespace Ultima::Shared::Messages;
+using namespace Graphics::Views;
 
 /**
  * Shown when the player's ship comes to rest exactly in one of the space
diff --git a/engines/ultima/ultima1/views/interactions/win.cpp b/engines/ultima/ultima1/views/interactions/win.cpp
index ac2686edb70..242b4c9d0a1 100644
--- a/engines/ultima/ultima1/views/interactions/win.cpp
+++ b/engines/ultima/ultima1/views/interactions/win.cpp
@@ -41,9 +41,8 @@ constexpr int BORDER_X1 = 34, BORDER_Y1 = 26, BORDER_X2 = 284, BORDER_Y2 = 124;
 // of an 8px-tall font) - matching the 21 lines of text below exactly
 constexpr int ENDING_WIDTH = 320, ENDING_HEIGHT = 168;
 
-// FRAME_RATE ticks/second (see shared/engine/events.h) - about 10 seconds
-// to fully reveal, matching the original's scanline-by-scanline draw
-constexpr int REVEAL_TICKS = FRAME_RATE * 10;
+// About 10 seconds to fully reveal, matching the original's scanline-by-scanline draw
+constexpr int REVEAL_TIME = 10000;
 
 // The full text of the original's "nif.bin" ending picture, transcribed
 // from the decoded bitmap - 21 lines, matching its exact line breaks
@@ -72,7 +71,7 @@ static const char *const ENDING_TEXT[] = {
 };
 
 bool Win::msgFocus(const FocusMessage &msg) {
-	setBounds(TextRect(0, 0, 39, 19));
+	setBounds(Graphics::Views::TextRect(0, 0, 39, 19));
 	_phase = PHASE_DIALOG;
 	_revealedRows = 0;
 	_elapsedTicks = 0;
@@ -100,24 +99,26 @@ void Win::draw() {
 	}
 
 	auto s = getSurface();
-	s.fillRect(Rect(0, 0, 320, 200), 0);
+	s.fillRect(Common::Rect(0, 0, 320, 200), 0);
 	s.blitFrom(_textSurface, Common::Rect(0, 0, ENDING_WIDTH, _revealedRows), Common::Point(0, 0));
 }
 
 void Win::drawDialog() {
 	auto s = getSurface();
-	s.fillRect(Rect(DIALOG_X1, DIALOG_Y1, DIALOG_X2, DIALOG_Y2), 0);
-	s.frameRect(Rect(BORDER_X1, BORDER_Y1, BORDER_X2, BORDER_Y2), BORDER_COLOR);
+	s.fillRect(Common::Rect(DIALOG_X1, DIALOG_Y1, DIALOG_X2, DIALOG_Y2), 0);
+	s.frameRect(Common::Rect(BORDER_X1, BORDER_Y1, BORDER_X2, BORDER_Y2), BORDER_COLOR);
 
 	s.setColor(TEXT_COLOR);
-	s.writeString(Point(11, 8), "THOU ART VICTORIOUS!");
+	s.writeString(Common::Point(11, 8), "THOU ART VICTORIOUS!");
 }
 
 bool Win::tick() {
 	if (_phase == PHASE_GLYPH && _revealedRows < ENDING_HEIGHT) {
 		++_elapsedTicks;
 
-		int rows = MIN(ENDING_HEIGHT, ENDING_HEIGHT * _elapsedTicks / REVEAL_TICKS);
+		uint32 time = g_system->getMillis();
+		uint32 diff = time - _revealStartTime;
+		int rows = MIN<uint32>(ENDING_HEIGHT, ENDING_HEIGHT * diff / REVEAL_TIME);
 		if (rows != _revealedRows) {
 			_revealedRows = rows;
 			redraw();
@@ -142,6 +143,7 @@ void Win::advancePhase() {
 		// First key wipes the announcement dialog and starts the ending
 		// text revealing itself from the top down
 		_phase = PHASE_GLYPH;
+		_revealStartTime = g_system->getMillis();
 		setBounds(Common::Rect(0, 0, 320, 200));
 		redraw();
 		return;
diff --git a/engines/ultima/ultima1/views/interactions/win.h b/engines/ultima/ultima1/views/interactions/win.h
index ebfae9dc3b8..37634e9fabd 100644
--- a/engines/ultima/ultima1/views/interactions/win.h
+++ b/engines/ultima/ultima1/views/interactions/win.h
@@ -23,14 +23,14 @@
 #define ULTIMA1_VIEWS_INTERACTIONS_WIN_H
 
 #include "ultima/ultima1/views/interactions/interaction.h"
-#include "ultima/shared/gfx/gfx_surface.h"
+#include "graphics/views/gfx_surface.h"
 
 namespace Ultima {
 namespace Ultima1 {
 namespace Views {
 namespace Interactions {
 
-using namespace Ultima::Shared::Messages;
+using namespace Graphics::Views;
 
 /**
  * Shown when Mondain is defeated for good (the gem has already been
@@ -57,10 +57,11 @@ private:
 	};
 
 	Phase _phase = PHASE_DIALOG;
+	uint32 _revealStartTime = 0;
 
 	// The ending text, rendered once into its own surface on focus, then
 	// revealed gradually from the top down as _revealedRows grows
-	Shared::Gfx::GfxSurface _textSurface;
+	Graphics::Views::GfxSurface _textSurface;
 	int _revealedRows = 0;
 	int _elapsedTicks = 0;
 
diff --git a/engines/ultima/ultima1/views/location_map.cpp b/engines/ultima/ultima1/views/location_map.cpp
index 48837e05a8a..4823367ac3d 100644
--- a/engines/ultima/ultima1/views/location_map.cpp
+++ b/engines/ultima/ultima1/views/location_map.cpp
@@ -44,7 +44,7 @@ bool LocationMap::msgUnfocus(const UnfocusMessage &msg) {
 	return Map::msgUnfocus(msg);
 }
 
-bool LocationMap::msgAttackTile(const AttackTileMessage &msg) {
+bool LocationMap::msgAttackTile(const Shared::AttackTileMessage &msg) {
 	if (msg._x >= 0 && msg._x < MAP_VISIBLE_WIDTH && msg._y >= 0 && msg._y < MAP_VISIBLE_HEIGHT) {
 		const Graphics::ManagedSurface *tiles = g_engine->_map.tiles();
 		auto s = getSurface();
diff --git a/engines/ultima/ultima1/views/location_map.h b/engines/ultima/ultima1/views/location_map.h
index eec64d48ab8..7ddfdece45d 100644
--- a/engines/ultima/ultima1/views/location_map.h
+++ b/engines/ultima/ultima1/views/location_map.h
@@ -28,7 +28,7 @@ namespace Ultima {
 namespace Ultima1 {
 namespace Views {
 
-using namespace Shared::Messages;
+using namespace Graphics::Views;
 
 class LocationMap : public Map {
 public:
@@ -37,7 +37,7 @@ public:
 
 	bool msgFocus(const FocusMessage &msg) override;
 	bool msgUnfocus(const UnfocusMessage &msg) override;
-	bool msgAttackTile(const AttackTileMessage &msg) override;
+	bool msgAttackTile(const Shared::AttackTileMessage &msg) override;
 	void draw() override;
 	void timeout() override;
 };
diff --git a/engines/ultima/ultima1/views/main_menu.h b/engines/ultima/ultima1/views/main_menu.h
index 5482d89da81..48402983ee3 100644
--- a/engines/ultima/ultima1/views/main_menu.h
+++ b/engines/ultima/ultima1/views/main_menu.h
@@ -29,7 +29,7 @@ namespace Ultima {
 namespace Ultima1 {
 namespace Views {
 
-using namespace Shared::Messages;
+using namespace Graphics::Views;
 
 /**
  * The game's main menu - offers generating a new character or
diff --git a/engines/ultima/ultima1/views/map.cpp b/engines/ultima/ultima1/views/map.cpp
index 8be21411766..3533a56f254 100644
--- a/engines/ultima/ultima1/views/map.cpp
+++ b/engines/ultima/ultima1/views/map.cpp
@@ -27,31 +27,33 @@ namespace Ultima {
 namespace Ultima1 {
 namespace Views {
 
-constexpr int PASS_TIMEOUT = 4 * 60 * FRAME_RATE;
+constexpr int PASS_TIME = 4 * 60 * 1000;
 
 Map::Map(const Common::String &name) : Dialog(name) {
 }
 
 bool Map::msgFocus(const FocusMessage &msg) {
-	_passCtr = 0;
+	_passStartTime = g_system->getMillis();
 	return Dialog::msgFocus(msg);
 }
 
 bool Map::msgAction(const ActionMessage &msg) {
-	_passCtr = 0;
+	_passStartTime = g_system->getMillis();
 	g_engine->_logic->action(msg._action);
 	return true;
 }
 
 bool Map::msgKeypress(const KeypressMessage &msg) {
-	_passCtr = 0;
+	_passStartTime = g_system->getMillis();
 	g_engine->_logic->keypress(msg.keycode);
 	return true;
 }
 
 bool Map::tick() {
-	if (++_passCtr >= PASS_TIMEOUT) {
-		_passCtr = 0;
+	uint32 time = g_system->getMillis();
+
+	if (time >= (_passStartTime + PASS_TIME)) {
+		_passStartTime = time;
 		msgAction(ActionMessage(KEYBIND_PASS));
 	}
 
diff --git a/engines/ultima/ultima1/views/map.h b/engines/ultima/ultima1/views/map.h
index 847e8e61456..e8da2005b31 100644
--- a/engines/ultima/ultima1/views/map.h
+++ b/engines/ultima/ultima1/views/map.h
@@ -29,14 +29,15 @@ namespace Ultima {
 namespace Ultima1 {
 namespace Views {
 
-using namespace Shared::Messages;
+using namespace Graphics::Views;
 
 /**
  * Base class for map views
  */
 class Map : public Dialog {
 private:
-	int _passCtr = 0;
+	uint32 _passStartTime = 0;
+
 public:
 	Map(const Common::String &name);
 	~Map() override {}
diff --git a/engines/ultima/ultima1/views/mondain_map.h b/engines/ultima/ultima1/views/mondain_map.h
index 585e7acfdfa..00eff140938 100644
--- a/engines/ultima/ultima1/views/mondain_map.h
+++ b/engines/ultima/ultima1/views/mondain_map.h
@@ -29,7 +29,7 @@ namespace Ultima {
 namespace Ultima1 {
 namespace Views {
 
-using namespace Shared::Messages;
+using namespace Graphics::Views;
 
 class MondainMap : public Map {
 public:
diff --git a/engines/ultima/ultima1/views/overworld_map.cpp b/engines/ultima/ultima1/views/overworld_map.cpp
index 41e4416330b..32fbd784bd4 100644
--- a/engines/ultima/ultima1/views/overworld_map.cpp
+++ b/engines/ultima/ultima1/views/overworld_map.cpp
@@ -42,7 +42,7 @@ bool OverworldMap::msgUnfocus(const UnfocusMessage &msg) {
 	return Map::msgUnfocus(msg);
 }
 
-bool OverworldMap::msgAttackTile(const AttackTileMessage &msg) {
+bool OverworldMap::msgAttackTile(const Shared::AttackTileMessage &msg) {
 	int mapLeft = _G(savegame)._overworldPos.x - Data::OVERWORLD_VISIBLE_CENTER_X;
 	int mapTop = _G(savegame)._overworldPos.y - Data::OVERWORLD_VISIBLE_CENTER_Y;
 	int ox = msg._x - mapLeft;
diff --git a/engines/ultima/ultima1/views/overworld_map.h b/engines/ultima/ultima1/views/overworld_map.h
index 71dee70f6f3..6ead4baf55b 100644
--- a/engines/ultima/ultima1/views/overworld_map.h
+++ b/engines/ultima/ultima1/views/overworld_map.h
@@ -29,7 +29,7 @@ namespace Ultima {
 namespace Ultima1 {
 namespace Views {
 
-using namespace Shared::Messages;
+using namespace Graphics::Views;
 
 class OverworldMap : public Map {
 private:
@@ -60,7 +60,7 @@ public:
 
 	bool msgFocus(const FocusMessage &msg) override;
 	bool msgUnfocus(const UnfocusMessage &msg) override;
-	bool msgAttackTile(const AttackTileMessage &msg) override;
+	bool msgAttackTile(const Shared::AttackTileMessage &msg) override;
 	void draw() override;
 	void timeout() override;
 };
diff --git a/engines/ultima/ultima1/views/space_cockpit.cpp b/engines/ultima/ultima1/views/space_cockpit.cpp
index 853e243e9f8..d824eedf351 100644
--- a/engines/ultima/ultima1/views/space_cockpit.cpp
+++ b/engines/ultima/ultima1/views/space_cockpit.cpp
@@ -57,7 +57,7 @@ void SpaceCockpit::draw() {
 	Map::draw();
 
 	auto s = getSurface();
-	s.fillRect(Rect(8, 8, 312, 152), 0);
+	s.fillRect(Common::Rect(8, 8, 312, 152), 0);
 
 	drawCockpitFrame(s);
 
@@ -217,12 +217,12 @@ bool SpaceCockpit::msgKeypress(const KeypressMessage &msg) {
 	return Map::msgKeypress(msg);
 }
 
-void SpaceCockpit::drawCockpitFrame(Shared::Gfx::GfxSurface &s) {
+void SpaceCockpit::drawCockpitFrame(Graphics::Views::GfxSurface &s) {
 	// The ~7px surround around the viewport
-	s.fillRect(Rect(8, 8, 312, 16), FRAME_COLOR);
-	s.fillRect(Rect(8, 144, 312, 152), FRAME_COLOR);
-	s.fillRect(Rect(8, 16, 16, 145), FRAME_COLOR);
-	s.fillRect(Rect(304, 16, 312, 145), FRAME_COLOR);
+	s.fillRect(Common::Rect(8, 8, 312, 16), FRAME_COLOR);
+	s.fillRect(Common::Rect(8, 144, 312, 152), FRAME_COLOR);
+	s.fillRect(Common::Rect(8, 16, 16, 145), FRAME_COLOR);
+	s.fillRect(Common::Rect(304, 16, 312, 145), FRAME_COLOR);
 
 	// Rivet detail along the top and bottom
 	for (int i = 1; i < 20; ++i) {
diff --git a/engines/ultima/ultima1/views/space_cockpit.h b/engines/ultima/ultima1/views/space_cockpit.h
index ed7e5b5d2d1..8edfa71aeff 100644
--- a/engines/ultima/ultima1/views/space_cockpit.h
+++ b/engines/ultima/ultima1/views/space_cockpit.h
@@ -24,13 +24,13 @@
 
 #include "ultima/ultima1/views/map.h"
 #include "ultima/ultima1/data/map.h"
-#include "ultima/shared/gfx/gfx_surface.h"
+#include "graphics/views/gfx_surface.h"
 
 namespace Ultima {
 namespace Ultima1 {
 namespace Views {
 
-using namespace Shared::Messages;
+using namespace Graphics::Views;
 
 /**
  * The first-person cockpit view of outer space - the panning warp starfield
@@ -64,7 +64,7 @@ private:
 	/**
 	 * Draws the static cockpit frame around the viewport (drawCockpitFrame)
 	 */
-	void drawCockpitFrame(Shared::Gfx::GfxSurface &s);
+	void drawCockpitFrame(Graphics::Views::GfxSurface &s);
 
 	/**
 	 * Advances whichever phase of the hyperjump animation is running -
diff --git a/engines/ultima/ultima1/views/space_game.cpp b/engines/ultima/ultima1/views/space_game.cpp
index 1ec01654230..f78e46817b3 100644
--- a/engines/ultima/ultima1/views/space_game.cpp
+++ b/engines/ultima/ultima1/views/space_game.cpp
@@ -20,7 +20,7 @@
  */
 
 #include "ultima/ultima1/views/space_game.h"
-#include "ultima/shared/gfx/rect.h"
+#include "graphics/views/rect.h"
 
 namespace Ultima {
 namespace Ultima1 {
@@ -30,15 +30,15 @@ namespace Views {
 constexpr int COLOR_BORDER = 1;  // blue - thick outer band
 constexpr int COLOR_EDGE = 15;   // white - thin inner highlight line
 
-SpaceGame::SpaceGame() : Shared::Gfx::View("SpaceGame"), _commands(this), _stats(this) {
-	setBounds(TextRect(0, 0, 39, 24));
-	_commands.setBounds(TextRect(0, 20, 29, 24));
-	_stats.setBounds(TextRect(31, 21, 39, 24));
+SpaceGame::SpaceGame() : Shared::View("SpaceGame"), _commands(this), _stats(this) {
+	setBounds(Graphics::Views::TextRect(0, 0, 39, 24));
+	_commands.setBounds(Graphics::Views::TextRect(0, 20, 29, 24));
+	_stats.setBounds(Graphics::Views::TextRect(31, 21, 39, 24));
 }
 
 void SpaceGame::draw() {
 	auto s = getSurface();
-	Shared::UIElement::draw();
+	Graphics::Views::UIElement::draw();
 
 	// Divider between the command/message log (left) and the stats corner
 	s.fillRect(Common::Rect(241, 160, 247, 200), COLOR_BORDER);
diff --git a/engines/ultima/ultima1/views/space_game.h b/engines/ultima/ultima1/views/space_game.h
index ea4f4e7393e..9806388397a 100644
--- a/engines/ultima/ultima1/views/space_game.h
+++ b/engines/ultima/ultima1/views/space_game.h
@@ -22,7 +22,7 @@
 #ifndef ULTIMA1_VIEWS_SPACE_GAME_H
 #define ULTIMA1_VIEWS_SPACE_GAME_H
 
-#include "ultima/shared/gfx/view.h"
+#include "ultima/shared/engine/view.h"
 #include "ultima/ultima1/views/commands.h"
 #include "ultima/ultima1/views/space_stats.h"
 
@@ -35,7 +35,7 @@ namespace Views {
  * shared frame and owns the message log and the Shld/Fuel/Exp/Coin corner
  * readout; SpaceMap or SpaceCockpit is layered on top for the actual view
  */
-class SpaceGame : public Shared::Gfx::View {
+class SpaceGame : public Shared::View {
 private:
 	Commands _commands;
 	SpaceStats _stats;
diff --git a/engines/ultima/ultima1/views/space_map.cpp b/engines/ultima/ultima1/views/space_map.cpp
index 47abae39111..48982fb68d9 100644
--- a/engines/ultima/ultima1/views/space_map.cpp
+++ b/engines/ultima/ultima1/views/space_map.cpp
@@ -81,7 +81,7 @@ static int wrappedPositions(int x, int y, int w, int h, Common::Point extra[3])
 // cropped. Instead, split the tile at the sector's wrap edge and draw each
 // piece at its own fully-in-bounds position, wrapping the clipped part
 // around to the opposite edge - up to 4 pieces at a corner
-static void drawWrappedTile(Shared::Gfx::GfxSurface &s, const Graphics::ManagedSurface &tile, int x, int y) {
+static void drawWrappedTile(Graphics::Views::GfxSurface &s, const Graphics::ManagedSurface &tile, int x, int y) {
 	int w = tile.w, h = tile.h;
 	int splitX = (x + w > Data::SPACE_SECTOR_MAX_X) ? (Data::SPACE_SECTOR_MAX_X - x) : w;
 	int splitY = (y + h > Data::SPACE_SECTOR_MAX_Y) ? (Data::SPACE_SECTOR_MAX_Y - y) : h;
@@ -218,7 +218,7 @@ void SpaceMap::draw() {
 	}
 }
 
-void SpaceMap::drawStarGraphic(Shared::Gfx::GfxSurface &s, int x, int y) {
+void SpaceMap::drawStarGraphic(Graphics::Views::GfxSurface &s, int x, int y) {
 	for (int row = 0; row < 18; ++row) {
 		for (int col = 0; col < 19; ++col) {
 			switch (STAR_BITMAP[row][col]) {
@@ -235,7 +235,7 @@ void SpaceMap::drawStarGraphic(Shared::Gfx::GfxSurface &s, int x, int y) {
 	}
 }
 
-void SpaceMap::drawPlanetGraphic(Shared::Gfx::GfxSurface &s, int x, int y) {
+void SpaceMap::drawPlanetGraphic(Graphics::Views::GfxSurface &s, int x, int y) {
 	for (int row = 0; row < 20; ++row) {
 		for (int col = 0; col < 20; ++col) {
 			if (PLANET_BITMAP[row][col] != 0)
@@ -244,7 +244,7 @@ void SpaceMap::drawPlanetGraphic(Shared::Gfx::GfxSurface &s, int x, int y) {
 	}
 }
 
-void SpaceMap::drawStationGraphic(Shared::Gfx::GfxSurface &s, int x, int y) {
+void SpaceMap::drawStationGraphic(Graphics::Views::GfxSurface &s, int x, int y) {
 	for (int row = 0; row < 18; ++row) {
 		for (int col = 0; col < 21; ++col) {
 			switch (STATION_BITMAP[row][col]) {
@@ -265,13 +265,13 @@ void SpaceMap::drawStationGraphic(Shared::Gfx::GfxSurface &s, int x, int y) {
 	}
 }
 
-void SpaceMap::drawShipOutline(Shared::Gfx::GfxSurface &s, const Data::SpaceMapShip &ship) {
+void SpaceMap::drawShipOutline(Graphics::Views::GfxSurface &s, const Data::SpaceMapShip &ship) {
 	int tileIndex = ship._shipType * 4 + ship._facing;
 	const Graphics::ManagedSurface &tile = _G(map).spaceShipTiles()[tileIndex];
 	drawWrappedTile(s, tile, ship._x, ship._y);
 }
 
-void SpaceMap::drawShipExhaust(Shared::Gfx::GfxSurface &s, const Data::SpaceMapShip &ship) {
+void SpaceMap::drawShipExhaust(Graphics::Views::GfxSurface &s, const Data::SpaceMapShip &ship) {
 	switch (ship._shipType) {
 	case Data::SHIP_LARGE_FIGHTER:
 		drawLargeFighterExhaust(s, ship._x, ship._y, ship._facing);
@@ -286,7 +286,7 @@ void SpaceMap::drawShipExhaust(Shared::Gfx::GfxSurface &s, const Data::SpaceMapS
 	}
 }
 
-void SpaceMap::drawShuttleExhaust(Shared::Gfx::GfxSurface &s, int x, int y, int facing) {
+void SpaceMap::drawShuttleExhaust(Graphics::Views::GfxSurface &s, int x, int y, int facing) {
 	auto plot = [&s](int px, int py, int color) {
 		if (withinShipView(px, py))
 			s.setPixel(px, py, color);
@@ -348,7 +348,7 @@ void SpaceMap::drawShuttleExhaust(Shared::Gfx::GfxSurface &s, int x, int y, int
 	}
 }
 
-void SpaceMap::drawSmallFighterExhaust(Shared::Gfx::GfxSurface &s, int x, int y, int facing) {
+void SpaceMap::drawSmallFighterExhaust(Graphics::Views::GfxSurface &s, int x, int y, int facing) {
 	auto plot = [&s](int px, int py) {
 		if (withinShipView(px, py))
 			s.setPixel(px, py, EXHAUST_COLOR_MAIN);
@@ -410,7 +410,7 @@ void SpaceMap::drawSmallFighterExhaust(Shared::Gfx::GfxSurface &s, int x, int y,
 	}
 }
 
-void SpaceMap::drawLargeFighterExhaust(Shared::Gfx::GfxSurface &s, int x, int y, int facing) {
+void SpaceMap::drawLargeFighterExhaust(Graphics::Views::GfxSurface &s, int x, int y, int facing) {
 	auto plot = [&s](int px, int py) {
 		if (withinShipView(px, py))
 			s.setPixel(px, py, EXHAUST_COLOR_MAIN);
diff --git a/engines/ultima/ultima1/views/space_map.h b/engines/ultima/ultima1/views/space_map.h
index 0e900633540..9713686e24c 100644
--- a/engines/ultima/ultima1/views/space_map.h
+++ b/engines/ultima/ultima1/views/space_map.h
@@ -25,13 +25,13 @@
 #include "ultima/ultima1/views/map.h"
 #include "ultima/ultima1/data/map.h"
 #include "ultima/ultima1/data/space_map.h"
-#include "ultima/shared/gfx/gfx_surface.h"
+#include "graphics/views/gfx_surface.h"
 
 namespace Ultima {
 namespace Ultima1 {
 namespace Views {
 
-using namespace Shared::Messages;
+using namespace Graphics::Views;
 
 /**
  * The overhead view of the player's current galaxy sector - the station
@@ -44,34 +44,34 @@ private:
 	 * Draws the station's raw bitmap (drawStationGraphic), only shown in
 	 * sector (3,3)
 	 */
-	void drawStationGraphic(Shared::Gfx::GfxSurface &s, int x, int y);
+	void drawStationGraphic(Graphics::Views::GfxSurface &s, int x, int y);
 
 	/**
 	 * Draws a sector's star/heat hazard raw bitmap (drawStarGraphic)
 	 */
-	void drawStarGraphic(Shared::Gfx::GfxSurface &s, int x, int y);
+	void drawStarGraphic(Graphics::Views::GfxSurface &s, int x, int y);
 
 	/**
 	 * Draws a sector's docking/encounter anchor raw bitmap (drawPlanetGraphic)
 	 */
-	void drawPlanetGraphic(Shared::Gfx::GfxSurface &s, int x, int y);
+	void drawPlanetGraphic(Graphics::Views::GfxSurface &s, int x, int y);
 
 	/**
 	 * XOR-blits a ship's glyph (egaspace.bin, via Data::Map::spaceShipTiles,
 	 * indexed by shipType*4+facing) at its current position
 	 * (blitShipSpriteXor)
 	 */
-	void drawShipOutline(Shared::Gfx::GfxSurface &s, const Data::SpaceMapShip &ship);
+	void drawShipOutline(Graphics::Views::GfxSurface &s, const Data::SpaceMapShip &ship);
 
 	/**
 	 * Draws the player ship's engine exhaust trail while
 	 * _G(shipExhaustCountdown) is active, dispatching by ship type
 	 * (drawShipSprite, vector-plotted rather than a sprite tile)
 	 */
-	void drawShipExhaust(Shared::Gfx::GfxSurface &s, const Data::SpaceMapShip &ship);
-	void drawShuttleExhaust(Shared::Gfx::GfxSurface &s, int x, int y, int facing);
-	void drawLargeFighterExhaust(Shared::Gfx::GfxSurface &s, int x, int y, int facing);
-	void drawSmallFighterExhaust(Shared::Gfx::GfxSurface &s, int x, int y, int facing);
+	void drawShipExhaust(Graphics::Views::GfxSurface &s, const Data::SpaceMapShip &ship);
+	void drawShuttleExhaust(Graphics::Views::GfxSurface &s, int x, int y, int facing);
+	void drawLargeFighterExhaust(Graphics::Views::GfxSurface &s, int x, int y, int facing);
+	void drawSmallFighterExhaust(Graphics::Views::GfxSurface &s, int x, int y, int facing);
 
 public:
 	SpaceMap() : Map("SpaceMap") {}
diff --git a/engines/ultima/ultima1/views/space_stats.h b/engines/ultima/ultima1/views/space_stats.h
index 17816914753..7dd9f0ce1c0 100644
--- a/engines/ultima/ultima1/views/space_stats.h
+++ b/engines/ultima/ultima1/views/space_stats.h
@@ -22,7 +22,7 @@
 #ifndef ULTIMA1_VIEWS_SPACE_STATS_H
 #define ULTIMA1_VIEWS_SPACE_STATS_H
 
-#include "ultima/shared/engine/events.h"
+#include "graphics/views/events.h"
 
 namespace Ultima {
 namespace Ultima1 {
@@ -33,9 +33,9 @@ namespace Views {
  * the character's Exp. and Coin. The space counterpart of Stats (which
  * shows Hits/Food instead)
  */
-class SpaceStats : public Shared::UIElement {
+class SpaceStats : public Graphics::Views::UIElement {
 public:
-	SpaceStats(UIElement *parent) : Shared::UIElement("Stats", parent) {}
+	SpaceStats(UIElement *parent) : Graphics::Views::UIElement("Stats", parent) {}
 	~SpaceStats() override {}
 
 	void draw() override;
diff --git a/engines/ultima/ultima1/views/startup.h b/engines/ultima/ultima1/views/startup.h
index a8d2bf5dc1e..6811c95cae7 100644
--- a/engines/ultima/ultima1/views/startup.h
+++ b/engines/ultima/ultima1/views/startup.h
@@ -22,18 +22,18 @@
 #ifndef ULTIMA1_VIEWS_STARTUP_H
 #define ULTIMA1_VIEWS_STARTUP_H
 
-#include "ultima/shared/gfx/view.h"
+#include "ultima/shared/engine/view.h"
 
 namespace Ultima {
 namespace Ultima1 {
 namespace Views {
 
-using namespace Shared::Messages;
+using namespace Graphics::Views;
 
 /**
  * Startup splash screen - the game title and copyright
  */
-class Startup : public Shared::Gfx::View {
+class Startup : public Shared::View {
 private:
 	void showTitle() {
 		replaceView("Title");
diff --git a/engines/ultima/ultima1/views/stats.h b/engines/ultima/ultima1/views/stats.h
index b59a0d7d215..6ce9fadcdb1 100644
--- a/engines/ultima/ultima1/views/stats.h
+++ b/engines/ultima/ultima1/views/stats.h
@@ -22,7 +22,7 @@
 #ifndef ULTIMA1_VIEWS_STATS_H
 #define ULTIMA1_VIEWS_STATS_H
 
-#include "ultima/shared/engine/events.h"
+#include "graphics/views/events.h"
 
 namespace Ultima {
 namespace Ultima1 {
@@ -32,9 +32,9 @@ namespace Views {
  * The always-visible Hits/Food/Exp./Coin display in the corner of the
  * game screen. Shared between the overworld/town and dungeon views.
  */
-class Stats : public Shared::UIElement {
+class Stats : public Graphics::Views::UIElement {
 public:
-	Stats(UIElement *parent) : Shared::UIElement("Stats", parent) {}
+	Stats(UIElement *parent) : Graphics::Views::UIElement("Stats", parent) {}
 	~Stats() override {}
 
 	void draw() override;
diff --git a/engines/ultima/ultima1/views/title.cpp b/engines/ultima/ultima1/views/title.cpp
index 72083de8af0..a76ed56b213 100644
--- a/engines/ultima/ultima1/views/title.cpp
+++ b/engines/ultima/ultima1/views/title.cpp
@@ -342,7 +342,7 @@ void Title::resetLogoReveal() {
 	_logoTextShown = false;
 }
 
-void Title::revealLogoPixels(Shared::Gfx::GfxSurface &s) {
+void Title::revealLogoPixels(Graphics::Views::GfxSurface &s) {
 	// Galois LFSR, polynomial x^17 + x^14 + 1: a maximal-length sequence
 	// giving a full-coverage pseudo-random pixel order, replicating the original's fade in
 	const uint32 TAP_MASK = (1u << 16) | (1u << 13);
@@ -366,7 +366,7 @@ void Title::revealLogoPixels(Shared::Gfx::GfxSurface &s) {
 	}
 }
 
-void Title::drawCreditsLogo(Shared::Gfx::GfxSurface &s) {
+void Title::drawCreditsLogo(Graphics::Views::GfxSurface &s) {
 	// New lines are revealed from the top (growing downward) and bottom
 	// (growing upward) each call, meeting in the middle after
 	// CREDITS_LOGO_LINES steps
@@ -429,7 +429,7 @@ void Title::timeout() {
 	redraw();
 }
 
-void Title::drawCastleFlag(Shared::Gfx::GfxSurface &s, int xp) {
+void Title::drawCastleFlag(Graphics::Views::GfxSurface &s, int xp) {
 	s.blitFrom(_flags[getRandomNumber(0, 2)], Common::Point(xp, FLAG_Y));
 }
 
diff --git a/engines/ultima/ultima1/views/title.h b/engines/ultima/ultima1/views/title.h
index 23ed564fa27..076f1600de7 100644
--- a/engines/ultima/ultima1/views/title.h
+++ b/engines/ultima/ultima1/views/title.h
@@ -24,19 +24,19 @@
 
 #include "graphics/managed_surface.h"
 #include "graphics/palette.h"
-#include "ultima/shared/gfx/view.h"
+#include "ultima/shared/engine/view.h"
 
 namespace Ultima {
 namespace Ultima1 {
 namespace Views {
 
-using namespace Shared::Messages;
+using namespace Graphics::Views;
 
 /**
  * Contains the loop of the Presents screen, blurb, and the castle scenes.
  * Any key press interrupts this.
  */
-class Title : public Shared::Gfx::View {
+class Title : public Shared::View {
 private:
 	enum State {
 		PRESENTS, INTRO_A, INTRO_B, CASTLE, CREDITS
@@ -61,10 +61,10 @@ private:
 
 	void showCredits();
 	void showMainMenu();
-	void drawCastleFlag(Shared::Gfx::GfxSurface &s, int xp);
+	void drawCastleFlag(Graphics::Views::GfxSurface &s, int xp);
 	void resetLogoReveal();
-	void revealLogoPixels(Shared::Gfx::GfxSurface &s);
-	void drawCreditsLogo(Shared::Gfx::GfxSurface &s);
+	void revealLogoPixels(Graphics::Views::GfxSurface &s);
+	void drawCreditsLogo(Graphics::Views::GfxSurface &s);
 
 public:
 	Title();
diff --git a/engines/ultima/ultima1/views/views.h b/engines/ultima/ultima1/views/views.h
index f82f46e2de5..ff65ec7d30e 100644
--- a/engines/ultima/ultima1/views/views.h
+++ b/engines/ultima/ultima1/views/views.h
@@ -22,7 +22,7 @@
 #ifndef ULTIMA1_VIEWS_H
 #define ULTIMA1_VIEWS_H
 
-#include "ultima/shared/engine/events.h"
+#include "graphics/views/events.h"
 #include "ultima/ultima1/views/interactions/dead.h"
 #include "ultima/ultima1/views/interactions/drop.h"
 #include "ultima/ultima1/views/interactions/entering_craft.h"
@@ -55,7 +55,7 @@ namespace Ultima {
 namespace Ultima1 {
 namespace Views {
 
-struct Views : public Shared::Views {
+struct Views {
 	Interactions::Dead _dead;
 	Interactions::Drop _drop;
 	Interactions::EnteringCraft _enteringCraft;
diff --git a/engines/ultima/ultima1/views/zstats.cpp b/engines/ultima/ultima1/views/zstats.cpp
index 198969b53b4..dbce560201b 100644
--- a/engines/ultima/ultima1/views/zstats.cpp
+++ b/engines/ultima/ultima1/views/zstats.cpp
@@ -52,9 +52,9 @@ void ZStats::draw() {
 	auto s = getSurface();
 	Dialog::draw();
 
-	s.writeString(Point(13, 0), "\x10 Inventory \x11");
-	s.writeString(Point(2, 2), "Player: %s", sg._name);
-	s.writeString(Point(2, 3), "A Level %d %s %s %s", sg.getCurrentLevel(), Data::SEX_NAMES[sg._sex],
+	s.writeString(Common::Point(13, 0), "\x10 Inventory \x11");
+	s.writeString(Common::Point(2, 2), "Player: %s", sg._name);
+	s.writeString(Common::Point(2, 3), "A Level %d %s %s %s", sg.getCurrentLevel(), Data::SEX_NAMES[sg._sex],
 		Data::RACE_NAMES[sg._race], Data::CLASS_NAMES[sg._class]);
 
 	uint pageEnd = MIN(_pageStart + (uint)LINES_PER_PAGE, (uint)_lines.size());
@@ -68,7 +68,7 @@ void ZStats::draw() {
 	// If there's more to show on a following page, prompt for it
 	if (pageEnd < _lines.size()) {
 		s.setColor(COLOR_TEXT);
-		s.writeString(Point(16, 19), "\x10 More \x11");
+		s.writeString(Common::Point(16, 19), "\x10 More \x11");
 	}
 }
 
diff --git a/engines/ultima/ultima1/views/zstats.h b/engines/ultima/ultima1/views/zstats.h
index 3af12cd0a79..9ad88150d23 100644
--- a/engines/ultima/ultima1/views/zstats.h
+++ b/engines/ultima/ultima1/views/zstats.h
@@ -30,7 +30,7 @@ namespace Ultima {
 namespace Ultima1 {
 namespace Views {
 
-using namespace Shared::Messages;
+using namespace Graphics::Views;
 
 class ZStats : public Dialog {
 private:
diff --git a/engines/ultima/ultima2/data/map.cpp b/engines/ultima/ultima2/data/map.cpp
index bc05e4a66f9..b12334dc5ac 100644
--- a/engines/ultima/ultima2/data/map.cpp
+++ b/engines/ultima/ultima2/data/map.cpp
@@ -25,7 +25,7 @@
 #include "ultima/ultima2/logic/overworld_logic.h"
 #include "ultima/ultima2/logic/city_castle_logic.h"
 #include "ultima/ultima2/logic/dungeon_logic.h"
-#include "ultima/shared/gfx/view.h"
+#include "graphics/views/view.h"
 
 namespace Ultima {
 namespace Ultima2 {
diff --git a/engines/ultima/ultima2/gfx/text_cursor.cpp b/engines/ultima/ultima2/gfx/text_cursor.cpp
index 2ee07ef3ac2..48fbd37da05 100644
--- a/engines/ultima/ultima2/gfx/text_cursor.cpp
+++ b/engines/ultima/ultima2/gfx/text_cursor.cpp
@@ -20,7 +20,7 @@
  */
 
 #include "ultima/ultima2/gfx/text_cursor.h"
-#include "ultima/shared/gfx/rect.h"
+#include "graphics/views/rect.h"
 
 namespace Ultima {
 namespace Ultima2 {
@@ -50,7 +50,7 @@ void TextCursor::hide() {
 }
 
 void TextCursor::setPosition(const Common::Point &pt) {
-	setBounds(TextRect(pt.x, pt.y, pt.x, pt.y));
+	setBounds(Graphics::Views::TextRect(pt.x, pt.y, pt.x, pt.y));
 }
 
 void TextCursor::draw() {
diff --git a/engines/ultima/ultima2/gfx/text_cursor.h b/engines/ultima/ultima2/gfx/text_cursor.h
index 8f1a5c813e4..d1104da27f8 100644
--- a/engines/ultima/ultima2/gfx/text_cursor.h
+++ b/engines/ultima/ultima2/gfx/text_cursor.h
@@ -22,7 +22,7 @@
 #ifndef ULTIMA2_GFX_TEXT_CURSOR_H
 #define ULTIMA2_GFX_TEXT_CURSOR_H
 
-#include "ultima/shared/engine/events.h"
+#include "graphics/views/events.h"
 
 namespace Ultima {
 namespace Ultima2 {
@@ -33,7 +33,7 @@ namespace Gfx {
  * "CHOICE:", and later character creation's text entry). Doesn't handle
  * keypresses itself - that's left to whichever view owns it.
  */
-class TextCursor : public Shared::UIElement {
+class TextCursor : public Graphics::Views::UIElement {
 private:
 	bool _active = false;
 	bool _visible = true;
diff --git a/engines/ultima/ultima2/logic/logic.cpp b/engines/ultima/ultima2/logic/logic.cpp
index a5cfb0ecae5..10786c38739 100644
--- a/engines/ultima/ultima2/logic/logic.cpp
+++ b/engines/ultima/ultima2/logic/logic.cpp
@@ -28,7 +28,7 @@ namespace Ultima {
 namespace Ultima2 {
 namespace Logic {
 
-using namespace Shared::Messages;
+using namespace Graphics::Views;
 
 void Logic::writeString(const Common::String &msg) {
 	g_engine->baseView()->findView("Commands")->send(GameMessage("TEXT", msg));
@@ -90,7 +90,7 @@ byte Logic::randByte() {
 }
 
 void Logic::showAttackTile(int x, int y) {
-	g_engine->focusedView()->send(AttackTileMessage(x, y, 0));
+	g_engine->focusedView()->send(Shared::AttackTileMessage(x, y, 0));
 }
 
 void Logic::playFX(Data::SoundEffect fx) {
@@ -274,7 +274,7 @@ bool Logic::trySpendGold(int amount) {
 	return true;
 }
 
-void Logic::keypress(const Shared::Messages::KeypressMessage &msg) {
+void Logic::keypress(const Graphics::Views::KeypressMessage &msg) {
 	writeString("-ILLEGAL COMMAND!\n");
 	endOfTurn();
 	prompt();
diff --git a/engines/ultima/ultima2/logic/logic.h b/engines/ultima/ultima2/logic/logic.h
index 31befeb3f6e..942a642d3c9 100644
--- a/engines/ultima/ultima2/logic/logic.h
+++ b/engines/ultima/ultima2/logic/logic.h
@@ -148,7 +148,7 @@ public:
 	}
 
 	virtual void action(int action);
-	virtual void keypress(const Shared::Messages::KeypressMessage &msg);
+	virtual void keypress(const Graphics::Views::KeypressMessage &msg);
 	virtual void entering() {
 	}
 
diff --git a/engines/ultima/ultima2/logic/overworld_logic.cpp b/engines/ultima/ultima2/logic/overworld_logic.cpp
index f77000edddd..e92e08b531f 100644
--- a/engines/ultima/ultima2/logic/overworld_logic.cpp
+++ b/engines/ultima/ultima2/logic/overworld_logic.cpp
@@ -590,7 +590,7 @@ void OverworldLogic::minaxDeathSequence() {
 
 	// The castle crumbles into rubble before the screen hands off to the
 	// endless victory pan
-	Shared::UIElement *curView = g_engine->focusedView();
+	Graphics::Views::UIElement *curView = g_engine->focusedView();
 	for (int step = 0; step < 64; ++step) {
 		for (int i = 0; i < 64; ++i) {
 			int x = randByte() & 0x3F, y = randByte() & 0x3F;
diff --git a/engines/ultima/ultima2/logic/space_logic.cpp b/engines/ultima/ultima2/logic/space_logic.cpp
index 55df798741e..cae61df9600 100644
--- a/engines/ultima/ultima2/logic/space_logic.cpp
+++ b/engines/ultima/ultima2/logic/space_logic.cpp
@@ -228,7 +228,7 @@ void SpaceLogic::action(int action) {
 	}
 }
 
-void SpaceLogic::keypress(const Shared::Messages::KeypressMessage &msg) {
+void SpaceLogic::keypress(const Graphics::Views::KeypressMessage &msg) {
 	static_cast<Views::SpaceMap *>(g_engine->findView("SpaceMap"))->setShip(CENTER_X, CENTER_Y);
 }
 
diff --git a/engines/ultima/ultima2/logic/space_logic.h b/engines/ultima/ultima2/logic/space_logic.h
index 7cf0ac83191..70911b5b7c4 100644
--- a/engines/ultima/ultima2/logic/space_logic.h
+++ b/engines/ultima/ultima2/logic/space_logic.h
@@ -85,7 +85,7 @@ public:
 	void warpFinished();
 
 	void action(int action) override;
-	void keypress(const Shared::Messages::KeypressMessage &msg) override;
+	void keypress(const Graphics::Views::KeypressMessage &msg) override;
 };
 
 } // namespace Logic
diff --git a/engines/ultima/ultima2/ultima2.cpp b/engines/ultima/ultima2/ultima2.cpp
index 11f79cb320b..2bc6b66a33c 100644
--- a/engines/ultima/ultima2/ultima2.cpp
+++ b/engines/ultima/ultima2/ultima2.cpp
@@ -40,8 +40,8 @@ namespace Ultima2 {
 
 Ultima2Engine *g_engine;
 
-Ultima2Engine::Ultima2Engine(OSystem *syst, const Ultima::UltimaGameDescription *gameDesc) : Engine(syst),
-_gameDescription(gameDesc) {
+Ultima2Engine::Ultima2Engine(OSystem *syst, const Ultima::UltimaGameDescription *gameDesc) :
+		Engine(syst), Shared::Events("ultima2"), _gameDescription(gameDesc) {
 	g_engine = this;
 	_pcSpeaker = new Audio::PCSpeaker();
 }
@@ -97,7 +97,8 @@ Common::Error Ultima2Engine::run() {
 	// Create all the views and run the game
 	Views::Views views;
 	addView("Title");
-	runGame(views);
+	runGame();
+	(void)views;		// Suppress any warnings of unused local
 
 	return Common::kNoError;
 }
@@ -254,7 +255,11 @@ void Ultima2Engine::setRenderMode(Data::RenderMode mode) {
 	// OverworldMap/LocationMap are constructed once up front as part of
 	// Views::Views, so they need to be explicitly told to re-read their
 	// tile graphics now rather than noticing this on their own
-	g_engine->send(Shared::Messages::GameMessage("RELOAD_TILES"));
+	g_engine->send(Graphics::Views::GameMessage("RELOAD_TILES"));
+}
+
+void Ultima2Engine::pauseMillis(uint32 millis) {
+	g_system->delayMillis(millis);
 }
 
 } // namespace Ultima2
diff --git a/engines/ultima/ultima2/ultima2.h b/engines/ultima/ultima2/ultima2.h
index 280fdbeb6f8..c81802a48c1 100644
--- a/engines/ultima/ultima2/ultima2.h
+++ b/engines/ultima/ultima2/ultima2.h
@@ -29,8 +29,8 @@
 #include "common/serializer.h"
 #include "common/util.h"
 #include "engines/engine.h"
-#include "ultima/detection.h"
 #include "ultima/shared/engine/events.h"
+#include "ultima/detection.h"
 #include "ultima/ultima2/data/map.h"
 #include "ultima/ultima2/data/map_dungeon.h"
 #include "ultima/ultima2/data/savegame.h"
@@ -160,6 +160,11 @@ public:
 	 * data themselves next time they're (re)constructed
 	 */
 	void setRenderMode(Data::RenderMode mode);
+
+	/**
+	 * Pause for a given number of milliseconds
+	 */
+	void pauseMillis(uint32 millis);
 };
 
 extern Ultima2Engine *g_engine;
diff --git a/engines/ultima/ultima2/views/commands.cpp b/engines/ultima/ultima2/views/commands.cpp
index 57b67054f45..728d6a16695 100644
--- a/engines/ultima/ultima2/views/commands.cpp
+++ b/engines/ultima/ultima2/views/commands.cpp
@@ -21,7 +21,7 @@
 
 #include "ultima/ultima2/views/commands.h"
 #include "ultima/ultima2/ultima2.h"
-#include "ultima/shared/gfx/rect.h"
+#include "graphics/views/rect.h"
 
 namespace Ultima {
 namespace Ultima2 {
@@ -32,8 +32,8 @@ constexpr int NEWLINE_DELAY = 50;
 constexpr int PROMPT_ROW = 3; // last of the 4 rows within Commands' own bounds
 constexpr int PROMPT_ABSOLUTE_ROW = 23;
 
-Commands::Commands(UIElement *parent) : Shared::UIElement("Commands", parent), _textCursor("CommandsCursor", this, COLOR_TEXT) {
-	setBounds(TextRect(0, 20, 29, 23));
+Commands::Commands(UIElement *parent) : Graphics::Views::UIElement("Commands", parent), _textCursor("CommandsCursor", this, COLOR_TEXT) {
+	setBounds(Graphics::Views::TextRect(0, 20, 29, 23));
 }
 
 void Commands::draw() {
@@ -76,7 +76,7 @@ void Commands::writeString(const Common::String &msg) {
 }
 
 void Commands::resetLine() {
-	_surface.fillRect(TextRect(0, PROMPT_ROW, 29, PROMPT_ROW), 0);
+	_surface.fillRect(Graphics::Views::TextRect(0, PROMPT_ROW, 29, PROMPT_ROW), 0);
 	_surface.setTextPos(Common::Point(0, PROMPT_ROW));
 }
 
diff --git a/engines/ultima/ultima2/views/commands.h b/engines/ultima/ultima2/views/commands.h
index 4598adeedc0..e4caf93aa46 100644
--- a/engines/ultima/ultima2/views/commands.h
+++ b/engines/ultima/ultima2/views/commands.h
@@ -22,22 +22,22 @@
 #ifndef ULTIMA2_VIEWS_COMMANDS_H
 #define ULTIMA2_VIEWS_COMMANDS_H
 
-#include "ultima/shared/engine/events.h"
+#include "graphics/views/events.h"
 #include "ultima/ultima2/gfx/text_cursor.h"
 
 namespace Ultima {
 namespace Ultima2 {
 namespace Views {
 
-using namespace Shared::Messages;
+using namespace Graphics::Views;
 
 /**
  * The scrolling message log and "CMD: " prompt at the bottom of the
  * game screen.
  */
-class Commands : public Shared::UIElement {
+class Commands : public Graphics::Views::UIElement {
 private:
-	Shared::Gfx::GfxSurface _surface;
+	Graphics::Views::GfxSurface _surface;
 	Gfx::TextCursor _textCursor;
 
 	void delay(uint milli);
diff --git a/engines/ultima/ultima2/views/create_character.h b/engines/ultima/ultima2/views/create_character.h
index 46cdd4f9ac6..f59855f4b39 100644
--- a/engines/ultima/ultima2/views/create_character.h
+++ b/engines/ultima/ultima2/views/create_character.h
@@ -22,14 +22,14 @@
 #ifndef ULTIMA2_VIEWS_CREATE_CHARACTER_H
 #define ULTIMA2_VIEWS_CREATE_CHARACTER_H
 
-#include "ultima/shared/gfx/view.h"
+#include "ultima/shared/engine/view.h"
 #include "ultima/ultima2/gfx/text_cursor.h"
 
 namespace Ultima {
 namespace Ultima2 {
 namespace Views {
 
-using namespace Shared::Messages;
+using namespace Graphics::Views;
 
 /**
  * Point-buy character creation: six attributes distributed from a shared
@@ -39,7 +39,7 @@ using namespace Shared::Messages;
  * remaining pool) discards all progress and starts over, matching the
  * harsh but simple validation of the original.
  */
-class CreateCharacter : public Shared::Gfx::View {
+class CreateCharacter : public Shared::View {
 private:
 	enum State {
 		STRENGTH, AGILITY, STAMINA, CHARISMA, WISDOM, INTELLIGENCE,
diff --git a/engines/ultima/ultima2/views/dungeon_map.cpp b/engines/ultima/ultima2/views/dungeon_map.cpp
index 0ad68ee61bd..01d31fb63ac 100644
--- a/engines/ultima/ultima2/views/dungeon_map.cpp
+++ b/engines/ultima/ultima2/views/dungeon_map.cpp
@@ -140,7 +140,7 @@ const byte SPRITE_BAND_OFFSETS[MAX_DEPTH] = { 0, 0, 0x80, 0xC0, 0xE0, 0xF0, 0xF8
  */
 class Painter {
 private:
-	Shared::Gfx::GfxSurface &_s;
+	Graphics::Views::GfxSurface &_s;
 
 	void plot(byte x, byte y) {
 		int px = x + VIEW_OFFSET, py = y + VIEW_OFFSET;
@@ -152,7 +152,7 @@ public:
 	byte _x1 = 0, _y1 = 0, _x2 = 0, _y2 = 0;
 	int _depth = 0;
 
-	Painter(Shared::Gfx::GfxSurface &s) : _s(s) {
+	Painter(Graphics::Views::GfxSurface &s) : _s(s) {
 	}
 
 	/**
@@ -401,7 +401,7 @@ bool DungeonMap::msgUnfocus(const UnfocusMessage &msg) {
 	return Map::msgUnfocus(msg);
 }
 
-bool DungeonMap::msgAttackTile(const AttackTileMessage &msg) {
+bool DungeonMap::msgAttackTile(const Shared::AttackTileMessage &msg) {
 	// Being hit inverts the whole view, briefly
 	for (int i = 0; i < 2; ++i) {
 		auto s = getSurface();
@@ -433,7 +433,7 @@ bool DungeonMap::msgKeypress(const KeypressMessage &msg) {
 	return Map::msgKeypress(msg);
 }
 
-void DungeonMap::drawMinimap(Shared::Gfx::GfxSurface &s) {
+void DungeonMap::drawMinimap(Graphics::Views::GfxSurface &s) {
 	Data::Savegame &sg = _G(savegame);
 	Data::MapDungeon &dungeon = _G(dungeon);
 	const int left = 320 - (Data::DUNGEON_WIDTH + 2) * MINIMAP_SCALE;
@@ -465,10 +465,10 @@ void DungeonMap::drawMinimap(Shared::Gfx::GfxSurface &s) {
 bool DungeonMap::tick() {
 	// There's no water or forcefield to animate here
 	checkIdle();
-	return Shared::Gfx::View::tick();
+	return Graphics::Views::View::tick();
 }
 
-int DungeonMap::drawCorridor(Shared::Gfx::GfxSurface &s) {
+int DungeonMap::drawCorridor(Graphics::Views::GfxSurface &s) {
 	Data::Savegame &sg = _G(savegame);
 	Data::MapDungeon &dungeon = _G(dungeon);
 	int level = sg._dungeonLevel;
@@ -554,7 +554,7 @@ int DungeonMap::drawCorridor(Shared::Gfx::GfxSurface &s) {
 	return d;
 }
 
-void DungeonMap::drawMonster(Shared::Gfx::GfxSurface &s, const byte *monsters, int depth) {
+void DungeonMap::drawMonster(Graphics::Views::GfxSurface &s, const byte *monsters, int depth) {
 	for (int d = 1; d < depth && d < MAX_DEPTH; ++d) {
 		if (monsters[d] == 0)
 			continue;
diff --git a/engines/ultima/ultima2/views/dungeon_map.h b/engines/ultima/ultima2/views/dungeon_map.h
index 07368c76f3a..7070de0ad52 100644
--- a/engines/ultima/ultima2/views/dungeon_map.h
+++ b/engines/ultima/ultima2/views/dungeon_map.h
@@ -41,17 +41,17 @@ private:
 	/**
 	 * Draws a small map of the current level in the top right corner
 	 */
-	void drawMinimap(Shared::Gfx::GfxSurface &s);
+	void drawMinimap(Graphics::Views::GfxSurface &s);
 
 	/**
 	 * Draws the corridor ahead. Returns the depth it was drawn out to
 	 */
-	int drawCorridor(Shared::Gfx::GfxSurface &s);
+	int drawCorridor(Graphics::Views::GfxSurface &s);
 
 	/**
 	 * Draws the nearest monster in the corridor, out to the given depth
 	 */
-	void drawMonster(Shared::Gfx::GfxSurface &s, const byte *monsters, int depth);
+	void drawMonster(Graphics::Views::GfxSurface &s, const byte *monsters, int depth);
 
 protected:
 	Graphics::Surface *tileGraphics() override {
@@ -64,7 +64,7 @@ public:
 
 	bool msgFocus(const FocusMessage &msg) override;
 	bool msgUnfocus(const UnfocusMessage &msg) override;
-	bool msgAttackTile(const AttackTileMessage &msg) override;
+	bool msgAttackTile(const Shared::AttackTileMessage &msg) override;
 	bool msgKeypress(const KeypressMessage &msg) override;
 	void draw() override;
 	bool tick() override;
diff --git a/engines/ultima/ultima2/views/ending.cpp b/engines/ultima/ultima2/views/ending.cpp
index 9d161cf5270..7df2657938a 100644
--- a/engines/ultima/ultima2/views/ending.cpp
+++ b/engines/ultima/ultima2/views/ending.cpp
@@ -44,7 +44,7 @@ constexpr uint32 STEP_DELAY = 90;
 } // namespace
 
 Ending::Ending() : View("Ending") {
-	setBounds(TextRect(0, 0, 39, 24));
+	setBounds(Graphics::Views::TextRect(0, 0, 39, 24));
 }
 
 Ending::~Ending() {
@@ -68,7 +68,7 @@ bool Ending::msgFocus(const FocusMessage &msg) {
 	_panX = _panY = 0;
 	_lastStep = g_system->getMillis();
 
-	g_engine->baseView()->findView("Commands")->send(Shared::Messages::GameMessage("TEXT",
+	g_engine->baseView()->findView("Commands")->send(Graphics::Views::GameMessage("TEXT",
 		"\n\nYOU HAVE SAVED THE UNIVERSE,\nAND COMPLETED ULTIMA ][! SEEK\n"
 		"NOW TO CONQUER WICKED EXODUS,\nFOUND IN ULTIMA ]I[-D ]II[-P!\n"));
 
diff --git a/engines/ultima/ultima2/views/ending.h b/engines/ultima/ultima2/views/ending.h
index 23d951a1749..18f6af9a83b 100644
--- a/engines/ultima/ultima2/views/ending.h
+++ b/engines/ultima/ultima2/views/ending.h
@@ -22,14 +22,14 @@
 #ifndef ULTIMA2_VIEWS_ENDING_H
 #define ULTIMA2_VIEWS_ENDING_H
 
-#include "ultima/shared/gfx/view.h"
+#include "ultima/shared/engine/view.h"
 #include "ultima/ultima2/data/map.h"
 
 namespace Ultima {
 namespace Ultima2 {
 namespace Views {
 
-using namespace Shared::Messages;
+using namespace Graphics::Views;
 
 /**
  * The game's final, non-interactive screen: the victory text over MAPX30,
@@ -37,7 +37,7 @@ using namespace Shared::Messages;
  * diagonal with the player shown as a rocket. There's no way back from
  * here short of quitting - matches the original, which loops forever
  */
-class Ending : public Shared::Gfx::View {
+class Ending : public Shared::View {
 private:
 	Data::TileId _tiles[Data::MAP_HEIGHT][Data::MAP_WIDTH] = {};
 	Graphics::Surface _tileGfx[Data::TILE_COUNT];
diff --git a/engines/ultima/ultima2/views/game.cpp b/engines/ultima/ultima2/views/game.cpp
index 617bec0749f..63e24204395 100644
--- a/engines/ultima/ultima2/views/game.cpp
+++ b/engines/ultima/ultima2/views/game.cpp
@@ -20,14 +20,14 @@
  */
 
 #include "ultima/ultima2/views/game.h"
-#include "ultima/shared/gfx/rect.h"
+#include "graphics/views/rect.h"
 
 namespace Ultima {
 namespace Ultima2 {
 namespace Views {
 
-Game::Game() : Shared::Gfx::View("Game"), _commands(this), _stats(this) {
-	setBounds(TextRect(0, 0, 39, 24));
+Game::Game() : Shared::View("Game"), _commands(this), _stats(this) {
+	setBounds(Graphics::Views::TextRect(0, 0, 39, 24));
 }
 
 } // namespace Views
diff --git a/engines/ultima/ultima2/views/game.h b/engines/ultima/ultima2/views/game.h
index 2b38eceb285..8a89b95d9ef 100644
--- a/engines/ultima/ultima2/views/game.h
+++ b/engines/ultima/ultima2/views/game.h
@@ -22,7 +22,7 @@
 #ifndef ULTIMA2_VIEWS_GAME_H
 #define ULTIMA2_VIEWS_GAME_H
 
-#include "ultima/shared/gfx/view.h"
+#include "ultima/shared/engine/view.h"
 #include "ultima/ultima2/views/commands.h"
 #include "ultima/ultima2/views/stats.h"
 
@@ -34,7 +34,7 @@ namespace Views {
  * The main in-game screen frame. Owns the Commands log/prompt and Stats
  * panel; the map viewport above them is a separate view pushed on top.
  */
-class Game : public Shared::Gfx::View {
+class Game : public Shared::View {
 private:
 	Commands _commands;
 	Stats _stats;
diff --git a/engines/ultima/ultima2/views/helm_map.cpp b/engines/ultima/ultima2/views/helm_map.cpp
index d44999d5d5f..54d830647ee 100644
--- a/engines/ultima/ultima2/views/helm_map.cpp
+++ b/engines/ultima/ultima2/views/helm_map.cpp
@@ -41,11 +41,11 @@ static const byte ICON_SWAMP[][2] = { {1, 0}, {3, 0} };
 static const byte ICON_ROAD[][2] = { {0, 0}, {0, 1}, {2, 0}, {2, 1} };
 static const byte ICON_OTHER[][2] = { {1, 0}, {2, 0}, {2, 1}, {1, 1} };
 
-HelmMap::HelmMap() : Shared::Gfx::View("HelmMap") {
-	setBounds(TextRect(0, 0, 39, 19));
+HelmMap::HelmMap() : Shared::View("HelmMap") {
+	setBounds(Graphics::Views::TextRect(0, 0, 39, 19));
 }
 
-void HelmMap::plotIcon(Shared::Gfx::GfxSurface &s, int cellX, int cellY, Data::TileId tile) {
+void HelmMap::plotIcon(Graphics::Views::GfxSurface &s, int cellX, int cellY, Data::TileId tile) {
 	const byte (*points)[2];
 	int count;
 
diff --git a/engines/ultima/ultima2/views/helm_map.h b/engines/ultima/ultima2/views/helm_map.h
index a7de1a36912..524b2be1751 100644
--- a/engines/ultima/ultima2/views/helm_map.h
+++ b/engines/ultima/ultima2/views/helm_map.h
@@ -22,22 +22,22 @@
 #ifndef ULTIMA2_VIEWS_HELM_MAP_H
 #define ULTIMA2_VIEWS_HELM_MAP_H
 
-#include "ultima/shared/gfx/view.h"
+#include "ultima/shared/engine/view.h"
 #include "ultima/ultima2/data/tiles.h"
 
 namespace Ultima {
 namespace Ultima2 {
 namespace Views {
 
-using namespace Shared::Messages;
+using namespace Graphics::Views;
 
 /**
  * The "view" command's full-map overview, shown as a small icon per world/location
  * cell. Closes and resumes the turn on any keypress.
  */
-class HelmMap : public Shared::Gfx::View {
+class HelmMap : public Shared::View {
 private:
-	void plotIcon(Shared::Gfx::GfxSurface &s, int cellX, int cellY, Data::TileId tile);
+	void plotIcon(Graphics::Views::GfxSurface &s, int cellX, int cellY, Data::TileId tile);
 
 public:
 	HelmMap();
diff --git a/engines/ultima/ultima2/views/interactions/dead.h b/engines/ultima/ultima2/views/interactions/dead.h
index 0ecfd47d3af..88ca1ef3958 100644
--- a/engines/ultima/ultima2/views/interactions/dead.h
+++ b/engines/ultima/ultima2/views/interactions/dead.h
@@ -29,7 +29,7 @@ namespace Ultima2 {
 namespace Views {
 namespace Interactions {
 
-using namespace Ultima::Shared::Messages;
+using namespace Graphics::Views;
 
 /**
  * Shown when the player dies, to allow them time to see the death message
diff --git a/engines/ultima/ultima2/views/interactions/interaction.cpp b/engines/ultima/ultima2/views/interactions/interaction.cpp
index 41ccdd88fd3..7991a538155 100644
--- a/engines/ultima/ultima2/views/interactions/interaction.cpp
+++ b/engines/ultima/ultima2/views/interactions/interaction.cpp
@@ -36,7 +36,7 @@ bool Interaction::tick() {
 	if (view)
 		view->tick();
 
-	return Shared::Gfx::View::tick();
+	return Graphics::Views::View::tick();
 }
 
 void Interaction::writeString(const Common::String &msg) {
diff --git a/engines/ultima/ultima2/views/interactions/interaction.h b/engines/ultima/ultima2/views/interactions/interaction.h
index 32258dd3dd2..39ac73b7a25 100644
--- a/engines/ultima/ultima2/views/interactions/interaction.h
+++ b/engines/ultima/ultima2/views/interactions/interaction.h
@@ -22,14 +22,14 @@
 #ifndef ULTIMA2_VIEWS_INTERACTIONS_INTERACTION_H
 #define ULTIMA2_VIEWS_INTERACTIONS_INTERACTION_H
 
-#include "ultima/shared/gfx/view.h"
+#include "ultima/shared/engine/view.h"
 
 namespace Ultima {
 namespace Ultima2 {
 namespace Views {
 namespace Interactions {
 
-using namespace Shared::Messages;
+using namespace Graphics::Views;
 
 /**
  * Base view for a modal interaction that prompts the player for input and
@@ -37,7 +37,7 @@ using namespace Shared::Messages;
  * window pushed on top of the current map/game view purely to take input
  * focus.
  */
-class Interaction : public Shared::Gfx::View {
+class Interaction : public Shared::View {
 protected:
 	void writeString(const Common::String &msg);
 	void writeString(const char *format, ...);
diff --git a/engines/ultima/ultima2/views/location_map.cpp b/engines/ultima/ultima2/views/location_map.cpp
index f79ecffb768..17a68901a54 100644
--- a/engines/ultima/ultima2/views/location_map.cpp
+++ b/engines/ultima/ultima2/views/location_map.cpp
@@ -63,7 +63,7 @@ bool LocationMap::msgUnfocus(const UnfocusMessage &msg) {
 	return Map::msgUnfocus(msg);
 }
 
-bool LocationMap::msgAttackTile(const AttackTileMessage &msg) {
+bool LocationMap::msgAttackTile(const Shared::AttackTileMessage &msg) {
 	Data::Savegame &sg = _G(savegame);
 	int mapLeft = sg._mapX - PLAYER_VIEWPORT_X;
 	int mapTop = sg._mapY - PLAYER_VIEWPORT_Y;
diff --git a/engines/ultima/ultima2/views/location_map.h b/engines/ultima/ultima2/views/location_map.h
index b12d2f3e7ac..e3f5628ec42 100644
--- a/engines/ultima/ultima2/views/location_map.h
+++ b/engines/ultima/ultima2/views/location_map.h
@@ -53,7 +53,7 @@ public:
 
 	bool msgFocus(const FocusMessage &msg) override;
 	bool msgUnfocus(const UnfocusMessage &msg) override;
-	bool msgAttackTile(const AttackTileMessage &msg) override;
+	bool msgAttackTile(const Shared::AttackTileMessage &msg) override;
 	bool msgGame(const GameMessage &msg) override;
 	void draw() override;
 };
diff --git a/engines/ultima/ultima2/views/map.h b/engines/ultima/ultima2/views/map.h
index f4be05e986c..28c43772f36 100644
--- a/engines/ultima/ultima2/views/map.h
+++ b/engines/ultima/ultima2/views/map.h
@@ -22,19 +22,19 @@
 #ifndef ULTIMA2_VIEWS_MAP_H
 #define ULTIMA2_VIEWS_MAP_H
 
-#include "ultima/shared/gfx/view.h"
+#include "ultima/shared/engine/view.h"
 #include "ultima/ultima2/data/tiles.h"
 
 namespace Ultima {
 namespace Ultima2 {
 namespace Views {
 
-using namespace Shared::Messages;
+using namespace Graphics::Views;
 
 /**
  * Base class for map views - forwards player input into the active Logic
  */
-class Map : public Shared::Gfx::View {
+class Map : public Shared::View {
 public:
 private:
 	uint32 _lastAnimation = 0;
@@ -62,7 +62,7 @@ public:
 	virtual void reloadTiles() {}
 
 	Map(const Common::String &name) : View(name) {
-		setBounds(TextRect(0, 0, 39, 19));
+		setBounds(Graphics::Views::TextRect(0, 0, 39, 19));
 	}
 	~Map() override {}
 
diff --git a/engines/ultima/ultima2/views/overworld_map.cpp b/engines/ultima/ultima2/views/overworld_map.cpp
index 4952c1613a7..d199e022921 100644
--- a/engines/ultima/ultima2/views/overworld_map.cpp
+++ b/engines/ultima/ultima2/views/overworld_map.cpp
@@ -64,7 +64,7 @@ bool OverworldMap::msgUnfocus(const UnfocusMessage &msg) {
 	return Map::msgUnfocus(msg);
 }
 
-bool OverworldMap::msgAttackTile(const AttackTileMessage &msg) {
+bool OverworldMap::msgAttackTile(const Shared::AttackTileMessage &msg) {
 	Data::Savegame &sg = _G(savegame);
 	int mapLeft = sg._mapX - PLAYER_VIEWPORT_X;
 	int mapTop = sg._mapY - PLAYER_VIEWPORT_Y;
diff --git a/engines/ultima/ultima2/views/overworld_map.h b/engines/ultima/ultima2/views/overworld_map.h
index d0a80775f3a..d2b57ee9da5 100644
--- a/engines/ultima/ultima2/views/overworld_map.h
+++ b/engines/ultima/ultima2/views/overworld_map.h
@@ -51,7 +51,7 @@ public:
 
 	bool msgFocus(const FocusMessage &msg) override;
 	bool msgUnfocus(const UnfocusMessage &msg) override;
-	bool msgAttackTile(const AttackTileMessage &msg) override;
+	bool msgAttackTile(const Shared::AttackTileMessage &msg) override;
 	bool msgGame(const GameMessage &msg) override;
 	void draw() override;
 };
diff --git a/engines/ultima/ultima2/views/space_map.cpp b/engines/ultima/ultima2/views/space_map.cpp
index f9398f1aebc..398729247c0 100644
--- a/engines/ultima/ultima2/views/space_map.cpp
+++ b/engines/ultima/ultima2/views/space_map.cpp
@@ -37,7 +37,7 @@ constexpr int COLOR_STAR = 3;
 constexpr int WARP_STEPS_PER_TICK = 2;
 
 SpaceMap::SpaceMap() : View("SpaceMap") {
-	setBounds(TextRect(0, 0, 39, 24));
+	setBounds(Graphics::Views::TextRect(0, 0, 39, 24));
 }
 
 void SpaceMap::seedStars() {
@@ -88,11 +88,11 @@ bool SpaceMap::msgKeypress(const KeypressMessage &msg) {
 	return true;
 }
 
-void SpaceMap::plot(Shared::Gfx::GfxSurface &s, int x, int y, int color) {
+void SpaceMap::plot(Graphics::Views::GfxSurface &s, int x, int y, int color) {
 	s.setPixel(x + VIEW_OFFSET, y + VIEW_OFFSET, color);
 }
 
-void SpaceMap::drawMarker(Shared::Gfx::GfxSurface &s, int color) {
+void SpaceMap::drawMarker(Graphics::Views::GfxSurface &s, int color) {
 	for (int i = -3; i <= 3; ++i) {
 		plot(s, _shipX, (byte)(_shipY + i), color);
 		if (i != 0)
diff --git a/engines/ultima/ultima2/views/space_map.h b/engines/ultima/ultima2/views/space_map.h
index 17df38a4697..6dcc5a786cf 100644
--- a/engines/ultima/ultima2/views/space_map.h
+++ b/engines/ultima/ultima2/views/space_map.h
@@ -22,14 +22,14 @@
 #ifndef ULTIMA2_VIEWS_SPACE_MAP_H
 #define ULTIMA2_VIEWS_SPACE_MAP_H
 
-#include "ultima/shared/gfx/view.h"
+#include "ultima/shared/engine/view.h"
 #include "ultima/ultima2/views/space_stats.h"
 
 namespace Ultima {
 namespace Ultima2 {
 namespace Views {
 
-using namespace Shared::Messages;
+using namespace Graphics::Views;
 
 /**
  * The starfield seen from a rocket in flight, with the steering marker and
@@ -37,7 +37,7 @@ using namespace Shared::Messages;
  * animation, which passes through several phases of stars streaking and
  * then speeding past
  */
-class SpaceMap : public Shared::Gfx::View {
+class SpaceMap : public Shared::View {
 private:
 	enum Phase {
 		PHASE_IDLE, PHASE_WARP_TRAILS, PHASE_WARP_ACCELERATE, PHASE_WARP_RUSH,
@@ -56,8 +56,8 @@ private:
 	int _counter = 0;
 
 	void seedStars();
-	void plot(Shared::Gfx::GfxSurface &s, int x, int y, int color);
-	void drawMarker(Shared::Gfx::GfxSurface &s, int color);
+	void plot(Graphics::Views::GfxSurface &s, int x, int y, int color);
+	void drawMarker(Graphics::Views::GfxSurface &s, int color);
 
 	/**
 	 * Moves every star one step away from the ship's steering position
diff --git a/engines/ultima/ultima2/views/space_stats.cpp b/engines/ultima/ultima2/views/space_stats.cpp
index 108ec8dc08d..61eabaa7ae1 100644
--- a/engines/ultima/ultima2/views/space_stats.cpp
+++ b/engines/ultima/ultima2/views/space_stats.cpp
@@ -21,7 +21,7 @@
 
 #include "ultima/ultima2/views/space_stats.h"
 #include "ultima/ultima2/ultima2.h"
-#include "ultima/shared/gfx/rect.h"
+#include "graphics/views/rect.h"
 
 namespace Ultima {
 namespace Ultima2 {
@@ -29,8 +29,8 @@ namespace Views {
 
 constexpr int COLOR_TEXT = 3; // white, within the game's 4-color CGA palette
 
-SpaceStats::SpaceStats(UIElement *parent) : Shared::UIElement("SpaceStats", parent) {
-	setBounds(TextRect(30, 20, 39, 23));
+SpaceStats::SpaceStats(UIElement *parent) : Graphics::Views::UIElement("SpaceStats", parent) {
+	setBounds(Graphics::Views::TextRect(30, 20, 39, 23));
 }
 
 void SpaceStats::draw() {
diff --git a/engines/ultima/ultima2/views/space_stats.h b/engines/ultima/ultima2/views/space_stats.h
index 7ef4024e231..d2d92c27bb9 100644
--- a/engines/ultima/ultima2/views/space_stats.h
+++ b/engines/ultima/ultima2/views/space_stats.h
@@ -22,7 +22,7 @@
 #ifndef ULTIMA2_VIEWS_SPACE_STATS_H
 #define ULTIMA2_VIEWS_SPACE_STATS_H
 
-#include "ultima/shared/engine/events.h"
+#include "graphics/views/events.h"
 
 namespace Ultima {
 namespace Ultima2 {
@@ -31,7 +31,7 @@ namespace Views {
 /**
  * The stats display shown when in outer space
  */
-class SpaceStats : public Shared::UIElement {
+class SpaceStats : public Graphics::Views::UIElement {
 public:
 	SpaceStats(UIElement *parent);
 	~SpaceStats() override {
diff --git a/engines/ultima/ultima2/views/stats.cpp b/engines/ultima/ultima2/views/stats.cpp
index 9bb5e47e204..fbf36f2dce3 100644
--- a/engines/ultima/ultima2/views/stats.cpp
+++ b/engines/ultima/ultima2/views/stats.cpp
@@ -21,7 +21,7 @@
 
 #include "ultima/ultima2/views/stats.h"
 #include "ultima/ultima2/ultima2.h"
-#include "ultima/shared/gfx/rect.h"
+#include "graphics/views/rect.h"
 
 namespace Ultima {
 namespace Ultima2 {
@@ -29,8 +29,8 @@ namespace Views {
 
 constexpr int COLOR_TEXT = 3; // white, within the game's 4-color CGA palette
 
-Stats::Stats(UIElement *parent) : Shared::UIElement("Stats", parent) {
-	setBounds(TextRect(30, 20, 39, 23));
+Stats::Stats(UIElement *parent) : Graphics::Views::UIElement("Stats", parent) {
+	setBounds(Graphics::Views::TextRect(30, 20, 39, 23));
 }
 
 void Stats::draw() {
diff --git a/engines/ultima/ultima2/views/stats.h b/engines/ultima/ultima2/views/stats.h
index f9fbb8aed43..b564515bac4 100644
--- a/engines/ultima/ultima2/views/stats.h
+++ b/engines/ultima/ultima2/views/stats.h
@@ -22,7 +22,7 @@
 #ifndef ULTIMA2_VIEWS_STATS_H
 #define ULTIMA2_VIEWS_STATS_H
 
-#include "ultima/shared/engine/events.h"
+#include "graphics/views/events.h"
 
 namespace Ultima {
 namespace Ultima2 {
@@ -32,7 +32,7 @@ namespace Views {
  * The always-visible H.P./FOOD/EXP./GOLD display in the corner of the
  * game screen.
  */
-class Stats : public Shared::UIElement {
+class Stats : public Graphics::Views::UIElement {
 public:
 	Stats(UIElement *parent);
 	~Stats() override {}
diff --git a/engines/ultima/ultima2/views/title.h b/engines/ultima/ultima2/views/title.h
index 8a519752360..f6032f66c0e 100644
--- a/engines/ultima/ultima2/views/title.h
+++ b/engines/ultima/ultima2/views/title.h
@@ -24,14 +24,14 @@
 
 #include "graphics/managed_surface.h"
 #include "graphics/palette.h"
-#include "ultima/shared/gfx/view.h"
+#include "ultima/shared/engine/view.h"
 #include "ultima/ultima2/gfx/text_cursor.h"
 
 namespace Ultima {
 namespace Ultima2 {
 namespace Views {
 
-using namespace Shared::Messages;
+using namespace Graphics::Views;
 
 /**
  * The attract-mode sequence: two text screens ("ORIGIN / PROUDLY
@@ -42,7 +42,7 @@ using namespace Shared::Messages;
  * start; any keypress or action before the menu is reached jumps
  * straight to it.
  */
-class Title : public Shared::Gfx::View {
+class Title : public Shared::View {
 private:
 	enum State {
 		TEXT1, TEXT2, PICDRA, MENU,
diff --git a/engines/ultima/ultima2/views/views.h b/engines/ultima/ultima2/views/views.h
index c20c7a19020..01ba5a0db2b 100644
--- a/engines/ultima/ultima2/views/views.h
+++ b/engines/ultima/ultima2/views/views.h
@@ -22,7 +22,7 @@
 #ifndef ULTIMA2_VIEWS_H
 #define ULTIMA2_VIEWS_H
 
-#include "ultima/shared/engine/events.h"
+#include "graphics/views/events.h"
 #include "ultima/ultima2/views/create_character.h"
 #include "ultima/ultima2/views/dungeon_map.h"
 #include "ultima/ultima2/views/ending.h"
@@ -53,7 +53,7 @@ namespace Ultima {
 namespace Ultima2 {
 namespace Views {
 
-struct Views : public Shared::Views {
+struct Views {
 	Interactions::ClueSeller _clueSeller;
 	Interactions::Dead _dead;
 	Interactions::Direction _direction;
diff --git a/engines/ultima/ultima2/views/zstats.cpp b/engines/ultima/ultima2/views/zstats.cpp
index 0dbfe33fd02..4e3488a8cc1 100644
--- a/engines/ultima/ultima2/views/zstats.cpp
+++ b/engines/ultima/ultima2/views/zstats.cpp
@@ -29,17 +29,17 @@ namespace Views {
 constexpr int COLOR_TEXT = 3;
 
 ZStats::ZStats() : View("ZStats") {
-	setBounds(TextRect(0, 0, 39, 24));
+	setBounds(Graphics::Views::TextRect(0, 0, 39, 24));
 }
 
 bool ZStats::msgFocus(const FocusMessage &msg) {
 	// Clear the entire screen
-	setBounds(TextRect(0, 0, 39, 24));
+	setBounds(Graphics::Views::TextRect(0, 0, 39, 24));
 	getSurface().clear();
 
 	// Set up a slightly reduced bounds to exclude columns 0 and 39
-	setBounds(TextRect(1, 0, 38, 24));
-	return Shared::Gfx::View::msgFocus(msg);
+	setBounds(Graphics::Views::TextRect(1, 0, 38, 24));
+	return Graphics::Views::View::msgFocus(msg);
 }
 
 void ZStats::draw() {
diff --git a/engines/ultima/ultima2/views/zstats.h b/engines/ultima/ultima2/views/zstats.h
index ab1857eca45..31a247774f7 100644
--- a/engines/ultima/ultima2/views/zstats.h
+++ b/engines/ultima/ultima2/views/zstats.h
@@ -22,20 +22,20 @@
 #ifndef ULTIMA2_VIEWS_ZSTATS_H
 #define ULTIMA2_VIEWS_ZSTATS_H
 
-#include "ultima/shared/gfx/view.h"
+#include "ultima/shared/engine/view.h"
 #include "ultima/ultima2/gfx/text_cursor.h"
 
 namespace Ultima {
 namespace Ultima2 {
 namespace Views {
 
-using namespace Shared::Messages;
+using namespace Graphics::Views;
 
 /**
  * The "Z" full character stats screen. Closes and resumes the turn on any
  * keypress.
  */
-class ZStats : public Shared::Gfx::View {
+class ZStats : public Shared::View {
 private:
 	Gfx::TextCursor _textCursor = Gfx::TextCursor("ZStatsCursor", this);
 


Commit: 313c7479154c52a57112eadd51b58a5f448d3953
    https://github.com/scummvm/scummvm/commit/313c7479154c52a57112eadd51b58a5f448d3953
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:40:59+11:00

Commit Message:
ULTIMA: ULTIMA3: Skeleton engine

Changed paths:
  A engines/ultima/ultima3/console.cpp
  A engines/ultima/ultima3/console.h
  A engines/ultima/ultima3/metaengine.cpp
  A engines/ultima/ultima3/metaengine.h
  A engines/ultima/ultima3/ultima3.cpp
  A engines/ultima/ultima3/ultima3.h
  A engines/ultima/ultima3/views/views.h
    engines/ultima/configure.engine
    engines/ultima/detection_tables.h
    engines/ultima/metaengine.cpp
    engines/ultima/module.mk


diff --git a/engines/ultima/configure.engine b/engines/ultima/configure.engine
index c6eccd44384..72adbaba9e0 100644
--- a/engines/ultima/configure.engine
+++ b/engines/ultima/configure.engine
@@ -1,9 +1,10 @@
 # This file is included from the main "configure" script
 # add_engine [name] [desc] [build-by-default] [subengines] [base games] [deps] [components]
-add_engine ultima "Ultima" yes "akalabeth ultima1 ultima2 ultima4 ultima6 ultima8" "" "midi"
+add_engine ultima "Ultima" yes "akalabeth ultima1 ultima2 ultima3 ultima4 ultima6 ultima8" "" "midi"
 add_engine akalabeth "Akalabeth" no "" "" ""
 add_engine ultima1 "Ultima I - The First Age of Darkness" no "" "" "views"
 add_engine ultima2 "Ultima II - The Revenge of the Enchantress" no "" "" "views"
+add_engine ultima3 "Ultima III - Exodus" no "" "" "views"
 add_engine ultima4 "Ultima IV - Quest of the Avatar" yes "" "" "16bit"
-add_engine ultima6 "Ultima VI = The False Prophet" yes "" "" "highres 16bit lua"
+add_engine ultima6 "Ultima VI - The False Prophet" yes "" "" "highres 16bit lua"
 add_engine ultima8 "Ultima VIII - Pagan" yes "" "" "highres 16bit" "imgui jyv1 xan"
diff --git a/engines/ultima/detection_tables.h b/engines/ultima/detection_tables.h
index d34f76fc4ee..3c66fb9a6f1 100644
--- a/engines/ultima/detection_tables.h
+++ b/engines/ultima/detection_tables.h
@@ -51,6 +51,7 @@ static const PlainGameDescriptor ULTIMA_GAMES[] = {
 	{ "akalabeth", "Akalabeth: World of Doom" },
 	{ "ultima1", "Ultima I: The First Age of Darkness" },
 	{ "ultima2", "Ultima II: Revenge of the Enchantress" },
+	{ "ultima3", "Ultima III: Exodus" },
 	{ "ultima4", "Ultima IV: Quest of the Avatar" },
 	{ "ultima4_enh", "Ultima IV: Quest of the Avatar - Enhanced" },
 	{ "ultima6", "Ultima VI: The False Prophet" },
@@ -148,6 +149,21 @@ static const UltimaGameDescription GAME_DESCRIPTIONS[] = {
 		0
 	},
 
+	{
+		// Ultima III - Exodus
+		{
+			"ultima3",
+			0,
+			AD_ENTRY1s("exod.ibm", "525bbaf8dd45a9bf737852f7719ae864", 16384),
+			Common::EN_ANY,
+			Common::kPlatformDOS,
+			ADGF_UNSTABLE,
+			GUI_OPTIONS_ULTIMA2
+		},
+		GAME_ULTIMA3,
+		0
+	},
+
 	{
 		// Ultima IV - Quest of the Avatar
 		{
diff --git a/engines/ultima/metaengine.cpp b/engines/ultima/metaengine.cpp
index f5f2f375e15..38b7f41d15c 100644
--- a/engines/ultima/metaengine.cpp
+++ b/engines/ultima/metaengine.cpp
@@ -41,6 +41,11 @@
 #include "ultima/ultima2/metaengine.h"
 #undef _G
 #endif
+#ifdef ENABLE_ULTIMA3
+#include "ultima/ultima3/ultima3.h"
+#include "ultima/ultima3/metaengine.h"
+#undef _G
+#endif
 #ifdef ENABLE_ULTIMA4
 #include "ultima/ultima4/ultima4.h"
 #include "ultima/ultima4/metaengine.h"
@@ -207,6 +212,11 @@ Common::Error UltimaMetaEngine::createInstance(OSystem *syst, Engine **engine, c
 		*engine = new Ultima::Ultima2::Ultima2Engine(syst, gd);
 		break;
 #endif
+#ifdef ENABLE_ULTIMA3
+	case Ultima::GAME_ULTIMA3:
+		*engine = new Ultima::Ultima3::Ultima3Engine(syst, gd);
+		break;
+#endif
 #ifdef ENABLE_ULTIMA4
 	case Ultima::GAME_ULTIMA4:
 		*engine = new Ultima::Ultima4::Ultima4Engine(syst, gd);
@@ -283,6 +293,10 @@ Common::KeymapArray UltimaMetaEngine::initKeymaps(const char *target) const {
 	if (gameId == "ultima2")
 		return Ultima::Ultima2::MetaEngine::initKeymaps();
 #endif
+#ifdef ENABLE_ULTIMA3
+	if (gameId == "ultima3")
+		return Ultima::Ultima3::MetaEngine::initKeymaps();
+#endif
 #ifdef ENABLE_ULTIMA4
 	if (gameId == "ultima4" || gameId == "ultima4_enh")
 		return Ultima::Ultima4::MetaEngine::initKeymaps();
diff --git a/engines/ultima/module.mk b/engines/ultima/module.mk
index 75b6edf6801..273e77276e3 100644
--- a/engines/ultima/module.mk
+++ b/engines/ultima/module.mk
@@ -157,6 +157,13 @@ MODULE_OBJS += \
 	ultima2/views/interactions/yell.o
 endif
 
+ifdef ENABLE_ULTIMA3
+MODULE_OBJS += \
+	ultima3/ultima3.o \
+	ultima3/console.o \
+	ultima3/metaengine.o
+endif
+
 ifdef ENABLE_ULTIMA4
 MODULE_OBJS += \
 	ultima4/controllers/alpha_action_controller.o \
diff --git a/engines/ultima/ultima3/console.cpp b/engines/ultima/ultima3/console.cpp
new file mode 100644
index 00000000000..7736a5cb715
--- /dev/null
+++ b/engines/ultima/ultima3/console.cpp
@@ -0,0 +1,36 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "common/file.h"
+#include "ultima/ultima3/console.h"
+#include "ultima/ultima3/ultima3.h"
+
+namespace Ultima {
+namespace Ultima3 {
+
+Console::Console() : GUI::Debugger() {
+}
+
+Console::~Console() {
+}
+
+} // namespace Ultima3
+} // namespace Ultima
diff --git a/engines/ultima/ultima3/console.h b/engines/ultima/ultima3/console.h
new file mode 100644
index 00000000000..2123680b6d7
--- /dev/null
+++ b/engines/ultima/ultima3/console.h
@@ -0,0 +1,41 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef ULTIMA3_CONSOLE_H
+#define ULTIMA3_CONSOLE_H
+
+#include "common/array.h"
+#include "common/rect.h"
+#include "gui/debugger.h"
+
+namespace Ultima {
+namespace Ultima3 {
+
+class Console : public GUI::Debugger {
+public:
+	Console();
+	~Console() override;
+};
+
+} // namespace Ultima3
+} // namespace Ultima
+
+#endif
diff --git a/engines/ultima/ultima3/metaengine.cpp b/engines/ultima/ultima3/metaengine.cpp
new file mode 100644
index 00000000000..21b793cad1d
--- /dev/null
+++ b/engines/ultima/ultima3/metaengine.cpp
@@ -0,0 +1,168 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "ultima/ultima3/metaengine.h"
+#include "ultima/ultima3/ultima3.h"
+#include "common/translation.h"
+#include "backends/keymapper/action.h"
+#include "backends/keymapper/standard-actions.h"
+
+namespace Ultima {
+namespace Ultima3 {
+
+struct KeybindingRecord {
+	KeybindingAction _action;
+	const char *_id;
+	const char *_desc;
+	const char *_key;
+	const char *_joy;
+};
+
+static const KeybindingRecord MINIMAL_KEYS[] = {
+	{ KEYBIND_NONE, nullptr, nullptr, nullptr, nullptr }
+};
+
+static const KeybindingRecord GAMEPLAY_KEYS[] = {
+	{ KEYBIND_UP, "UP", _s("Up"), "UP", "JOY_UP"},
+	{ KEYBIND_DOWN, "DOWN", _s("Down"), "DOWN", "JOY_DOWN"},
+	{ KEYBIND_LEFT, "LEFT", _s("Left"), "LEFT", "JOY_LEFT"},
+	{ KEYBIND_RIGHT, "RIGHT", _s("Right"), "RIGHT", "JOY_RIGHT"},
+	{ KEYBIND_ATTACK, "ATTACK", _s("Attack"), "a", nullptr },
+	{ KEYBIND_BOARD, "BOARD", _s("Board"), "b", nullptr },
+	{ KEYBIND_CAST, "CAST", _s("Cast"), "c", nullptr },
+	{ KEYBIND_DESCEND, "DESCEND", _s("Descend"), "d", nullptr },
+	{ KEYBIND_ENTER, "ENTER", _s("Enter"), "e", nullptr },
+	{ KEYBIND_FIRE, "FIRE", _s("Fire"), "f", nullptr },
+	{ KEYBIND_GET, "GET", _s("Get"), "g", nullptr },
+	{ KEYBIND_HYPER, "HYPER", _s("Hyper"), "h", nullptr },
+	{ KEYBIND_IGNITE_TORCH, "IGNITE_TORCH", _s("Ignite torch"), "i", nullptr },
+	{ KEYBIND_JUMP, "JUMP", _s("Jump"), "j", nullptr },
+	{ KEYBIND_KLIMB, "KLIMB", _s("Klimb"), "k", nullptr },
+	{ KEYBIND_LAUNCH, "LAUNCH", _s("Launch"), "l", nullptr },
+	{ KEYBIND_MAGIC, "MAGIC", _s("Magic"), "m", nullptr },
+	{ KEYBIND_NEGATE_TIME, "NEGATE_TIME", _s("Negate time"), "n", nullptr },
+	{ KEYBIND_OFFER, "OFFER", _s("Offer"), "o", nullptr },
+	{ KEYBIND_PASS, "PASS", _s("Pass"), "p", nullptr },
+	{ KEYBIND_QUIT, "QUIT", _s("Quit"), "q", nullptr },
+	{ KEYBIND_READY, "READY", _s("Ready"), "r", nullptr },
+	{ KEYBIND_STEAL, "STEAL", _s("Steal"), "s", nullptr },
+	{ KEYBIND_TRANSACT, "TRANSACT", _s("Transact"), "t", nullptr },
+	{ KEYBIND_UNLOCK, "UNLOCK", _s("Unlock"), "u", nullptr },
+	{ KEYBIND_VIEW, "VIEW", _s("View"), "v", nullptr },
+	{ KEYBIND_WEAR_ARMOR, "WEAR_ARMOR", _s("Wear armor"), "w", nullptr },
+	{ KEYBIND_X_IT, "X_IT", _s("eXit"), "x", nullptr },
+	{ KEYBIND_YELL, "YELL", _s("Yell"), "y", nullptr },
+	{ KEYBIND_ZSTATS, "ZSTATS", _s("Ztats"), "z", nullptr },
+	{ KEYBIND_NONE, nullptr, nullptr, nullptr, nullptr }
+};
+
+struct KeysRecord {
+	const char *_id;
+	const char *_desc;
+	const KeybindingRecord *_keys;
+};
+
+static const KeysRecord ALL_RECORDS[] = {
+	{ "Ultima3", _s("Basic keys"), MINIMAL_KEYS },
+	{ "gameplay", _s("Gameplay keys"), GAMEPLAY_KEYS },
+	{ nullptr, nullptr, nullptr }
+};
+
+static const KeysRecord MINIMAL_RECORDS[] = {
+	{ "Ultima3", _s("Basic keys"), MINIMAL_KEYS },
+	{ nullptr, nullptr, nullptr }
+};
+
+static const KeysRecord GAMEPLAY_RECORDS[] = {
+	{ "Ultima3", _s("Basic keys"), MINIMAL_KEYS },
+	{ "gameplay", _s("Gameplay keys"), GAMEPLAY_KEYS },
+	{ nullptr, nullptr, nullptr }
+};
+
+static const KeysRecord *MODE_RECORDS[] = {
+	ALL_RECORDS,
+	MINIMAL_RECORDS,
+	GAMEPLAY_RECORDS
+};
+
+Common::KeymapArray MetaEngine::initKeymaps(KeybindingMode mode) {
+	Common::KeymapArray keymapArray;
+	Common::Keymap *keyMap;
+	Common::Action *act;
+	const KeysRecord *recPtr = MODE_RECORDS[mode];
+
+	for (int kCtr = 0; recPtr->_id; ++recPtr, ++kCtr) {
+		// Core keymaps
+		keyMap = new Common::Keymap(Common::Keymap::kKeymapTypeGame,
+			recPtr->_id, recPtr->_desc);
+		keymapArray.push_back(keyMap);
+
+		if (kCtr == 0) {
+			addMouseClickActions(*keyMap);
+		}
+
+		for (const KeybindingRecord *r = recPtr->_keys; r->_id; ++r) {
+			act = new Common::Action(r->_id, _(r->_desc));
+			act->setCustomEngineActionEvent(r->_action);
+			act->addDefaultInputMapping(r->_key);
+			if (r->_joy)
+				act->addDefaultInputMapping(r->_joy);
+
+			if (r->_action == KEYBIND_UP || r->_action == KEYBIND_DOWN ||
+				r->_action == KEYBIND_LEFT || r->_action == KEYBIND_RIGHT)
+				// Allow movement actions to be triggered on keyboard repeats
+				act->allowKbdRepeats();
+
+			keyMap->addAction(act);
+		}
+	}
+
+	return keymapArray;
+}
+
+void MetaEngine::addMouseClickActions(Common::Keymap &keyMap) {
+	Common::Action *act;
+
+	act = new Common::Action(Common::kStandardActionLeftClick, _("Left click"));
+	act->setLeftClickEvent();
+	act->addDefaultInputMapping("MOUSE_LEFT");
+	act->addDefaultInputMapping("JOY_A");
+	keyMap.addAction(act);
+
+	act = new Common::Action(Common::kStandardActionRightClick, _("Right click"));
+	act->setRightClickEvent();
+	act->addDefaultInputMapping("MOUSE_RIGHT");
+	act->addDefaultInputMapping("JOY_B");
+	keyMap.addAction(act);
+}
+
+void MetaEngine::setKeybindingMode(KeybindingMode mode) {
+	Common::Keymapper *const mapper = g_engine->getEventManager()->getKeymapper();
+	mapper->cleanupGameKeymaps();
+
+	Common::KeymapArray arr = initKeymaps(mode);
+
+	for (uint idx = 0; idx < arr.size(); ++idx)
+		mapper->addGameKeymap(arr[idx]);
+}
+
+} // namespace Ultima3
+} // namespace Ultima
diff --git a/engines/ultima/ultima3/metaengine.h b/engines/ultima/ultima3/metaengine.h
new file mode 100644
index 00000000000..37569e84101
--- /dev/null
+++ b/engines/ultima/ultima3/metaengine.h
@@ -0,0 +1,67 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef ULTIMA3_METAENGINE_H
+#define ULTIMA3_METAENGINE_H
+
+#include "backends/keymapper/keymapper.h"
+
+namespace Ultima {
+namespace Ultima3 {
+
+enum KeybindingAction {
+	KEYBIND_UP, KEYBIND_DOWN, KEYBIND_LEFT, KEYBIND_RIGHT,
+	KEYBIND_ATTACK, KEYBIND_BOARD, KEYBIND_CAST, KEYBIND_DESCEND, KEYBIND_ENTER, KEYBIND_FIRE,
+	KEYBIND_GET, KEYBIND_HYPER, KEYBIND_IGNITE_TORCH, KEYBIND_JUMP, KEYBIND_KLIMB, KEYBIND_LAUNCH,
+	KEYBIND_MAGIC, KEYBIND_NEGATE_TIME, KEYBIND_OFFER, KEYBIND_PASS, KEYBIND_QUIT, KEYBIND_READY,
+	KEYBIND_STEAL, KEYBIND_TRANSACT, KEYBIND_UNLOCK, KEYBIND_VIEW, KEYBIND_WEAR_ARMOR,
+	KEYBIND_X_IT, KEYBIND_YELL, KEYBIND_ZSTATS,
+	KEYBIND_NONE
+};
+
+enum KeybindingMode {
+	KBMODE_ALL,
+	KBMODE_MINIMAL,
+	KBMODE_GAMEPLAY
+};
+
+class MetaEngine {
+private:
+	/**
+	 * Adds the default actions for the mouse buttons
+	 */
+	static void addMouseClickActions(Common::Keymap &keyMap);
+public:
+	/**
+	 * Initialize keymaps
+	 */
+	static Common::KeymapArray initKeymaps(KeybindingMode mode = KBMODE_ALL);
+
+	/**
+	 * Sets the current set of actions which are active
+	 */
+	static void setKeybindingMode(KeybindingMode mode);
+};
+
+} // namespace Ultima3
+} // namespace Ultima
+
+#endif
diff --git a/engines/ultima/ultima3/ultima3.cpp b/engines/ultima/ultima3/ultima3.cpp
new file mode 100644
index 00000000000..ac65d0a218e
--- /dev/null
+++ b/engines/ultima/ultima3/ultima3.cpp
@@ -0,0 +1,95 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "common/system.h"
+#include "common/savefile.h"
+#include "engines/util.h"
+#include "audio/softsynth/pcspk.h"
+#include "ultima/ultima3/ultima3.h"
+#include "ultima/ultima3/console.h"
+#include "ultima/ultima3/metaengine.h"
+#include "ultima/ultima3/views/views.h"
+
+namespace Ultima {
+namespace Ultima3 {
+
+Ultima3Engine *g_engine;
+
+Ultima3Engine::Ultima3Engine(OSystem *syst, const Ultima::UltimaGameDescription *gameDesc) :
+		Engine(syst), Shared::Events("ultima3"), _gameDescription(gameDesc) {
+	g_engine = this;
+	_pcSpeaker = new Audio::PCSpeaker();
+}
+
+Ultima3Engine::~Ultima3Engine() {
+	delete _pcSpeaker;
+}
+
+uint32 Ultima3Engine::getFeatures() const {
+	return _gameDescription->desc.flags;
+}
+
+Common::String Ultima3Engine::getGameId() const {
+	return _gameDescription->desc.gameId;
+}
+
+Common::Error Ultima3Engine::run() {
+	MetaEngine::setKeybindingMode(KBMODE_MINIMAL);
+
+	// Initialize 320x200 graphics mode
+	initGraphics(320, 200);
+	_pcSpeakerReady = _pcSpeaker->init();
+
+	// Set the engine's debugger console
+	setDebugger(new Console());
+
+	Views::Views views;
+	addView("Startup");
+	runGame(views);
+
+	return Common::kNoError;
+}
+
+bool Ultima3Engine::canSaveGameStateCurrently(Common::U32String *msg) {
+	return false;
+}
+
+bool Ultima3Engine::canLoadGameStateCurrently(Common::U32String *msg) {
+	return false;
+}
+
+Common::Error Ultima3Engine::syncGame(Common::Serializer &s) {
+	// TODO
+
+	return Common::kNoError;
+}
+
+bool Ultima3Engine::savegamesExist() const {
+	Common::String slotName = getSaveStateName(1);
+	Common::InSaveFile *saveFile = g_system->getSavefileManager()->openForLoading(slotName);
+	bool result = saveFile != nullptr;
+
+	delete saveFile;
+	return result;
+}
+
+} // namespace Ultima3
+} // namespace Ultima
diff --git a/engines/ultima/ultima3/ultima3.h b/engines/ultima/ultima3/ultima3.h
new file mode 100644
index 00000000000..18188fb201c
--- /dev/null
+++ b/engines/ultima/ultima3/ultima3.h
@@ -0,0 +1,128 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef ULTIMA3_H
+#define ULTIMA3_H
+
+#include "common/scummsys.h"
+#include "common/system.h"
+#include "common/error.h"
+#include "common/ptr.h"
+#include "common/serializer.h"
+#include "common/util.h"
+#include "engines/engine.h"
+#include "ultima/detection.h"
+#include "ultima/shared/engine/events.h"
+
+namespace Audio {
+class PCSpeaker;
+}
+
+namespace Ultima {
+namespace Ultima3 {
+
+struct Ultima3GameDescription;
+
+class Ultima3Engine : public Engine, public Shared::Events {
+private:
+	const Ultima::UltimaGameDescription *_gameDescription;
+
+protected:
+	// Engine APIs
+	Common::Error run() override;
+
+	/**
+	 * Returns true if the game should quit
+	 */
+	bool shouldQuit() const override {
+		return Engine::shouldQuit();
+	}
+
+private:
+	Audio::PCSpeaker *_pcSpeaker = nullptr;
+	bool _pcSpeakerReady = false;
+
+	/**
+	 * Queues a single square-wave note. divisor is the original's PIT
+	 * timer divisor (frequency = ~1193182/divisor), matching how each
+	 * original sound is specified
+	 */
+	void queueTone(int divisor, uint32 lengthMs);
+
+	/**
+	 * Queues a moment of silence
+	 */
+	void queueSilence(uint32 lengthMs);
+
+public:
+	// Debug flag toggled by the "intangible" console command, allowing
+	// movement through normally impassable terrain
+	bool _intangible = false;
+
+public:
+	Ultima3Engine(OSystem *syst, const Ultima::UltimaGameDescription *gameDesc);
+	~Ultima3Engine() override;
+
+	uint32 getFeatures() const;
+
+	/**
+	 * Returns the game Id
+	 */
+	Common::String getGameId() const;
+
+	bool hasFeature(EngineFeature f) const override {
+		return
+			(f == kSupportsLoadingDuringRuntime) ||
+			(f == kSupportsSavingDuringRuntime) ||
+			(f == kSupportsReturnToLauncher);
+	};
+
+	bool canSaveGameStateCurrently(Common::U32String *msg = nullptr) override;
+	bool canLoadGameStateCurrently(Common::U32String *msg = nullptr) override;
+
+	/**
+	 * Uses a serializer to allow implementing savegame
+	 * loading and saving using a single method
+	 */
+	Common::Error syncGame(Common::Serializer &s);
+
+	Common::Error saveGameStream(Common::WriteStream *stream, bool isAutosave = false) override {
+		Common::Serializer s(nullptr, stream);
+		return syncGame(s);
+	}
+	Common::Error loadGameStream(Common::SeekableReadStream *stream) override {
+		Common::Serializer s(stream, nullptr);
+		return syncGame(s);
+	}
+
+	/**
+	 * Returns true if any savegames exist
+	 */
+	bool savegamesExist() const;
+};
+
+extern Ultima3Engine *g_engine;
+#define _G(X) (Ultima3::g_engine->_##X)
+
+} // namespace Ultima3
+} // namespace Ultima
+
+#endif
diff --git a/engines/ultima/ultima3/views/views.h b/engines/ultima/ultima3/views/views.h
new file mode 100644
index 00000000000..a66535affe4
--- /dev/null
+++ b/engines/ultima/ultima3/views/views.h
@@ -0,0 +1,38 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef ULTIMA3_VIEWS_H
+#define ULTIMA3_VIEWS_H
+
+#include "ultima/shared/engine/events.h"
+
+namespace Ultima {
+namespace Ultima3 {
+namespace Views {
+
+struct Views : public Shared::Views {
+};
+
+} // namespace Views
+} // namespace Ultima3
+} // namespace Ultima
+
+#endif


Commit: 2cce959ecf70ac126a54db1b3741bd383eb98627
    https://github.com/scummvm/scummvm/commit/2cce959ecf70ac126a54db1b3741bd383eb98627
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:41:00+11:00

Commit Message:
ULTIMA: ULTIMA3: Title screen and boot chain

Changed paths:
  A engines/ultima/ultima3/data/data.cpp
  A engines/ultima/ultima3/data/data.h
  A engines/ultima/ultima3/gfx/pic_decoder.cpp
  A engines/ultima/ultima3/gfx/pic_decoder.h
  A engines/ultima/ultima3/views/main_menu.cpp
  A engines/ultima/ultima3/views/main_menu.h
  A engines/ultima/ultima3/views/startup.cpp
  A engines/ultima/ultima3/views/startup.h
  A engines/ultima/ultima3/views/title.cpp
  A engines/ultima/ultima3/views/title.h
    engines/ultima/module.mk
    engines/ultima/ultima3/ultima3.cpp
    engines/ultima/ultima3/views/views.h


diff --git a/engines/ultima/module.mk b/engines/ultima/module.mk
index 273e77276e3..492a5ab1cdd 100644
--- a/engines/ultima/module.mk
+++ b/engines/ultima/module.mk
@@ -161,7 +161,12 @@ ifdef ENABLE_ULTIMA3
 MODULE_OBJS += \
 	ultima3/ultima3.o \
 	ultima3/console.o \
-	ultima3/metaengine.o
+	ultima3/metaengine.o \
+	ultima3/data/data.o \
+	ultima3/gfx/pic_decoder.o \
+	ultima3/views/main_menu.o \
+	ultima3/views/startup.o \
+	ultima3/views/title.o
 endif
 
 ifdef ENABLE_ULTIMA4
diff --git a/engines/ultima/ultima3/data/data.cpp b/engines/ultima/ultima3/data/data.cpp
new file mode 100644
index 00000000000..dfa78af6378
--- /dev/null
+++ b/engines/ultima/ultima3/data/data.cpp
@@ -0,0 +1,45 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "common/system.h"
+#include "graphics/paletteman.h"
+#include "ultima/ultima3/data/data.h"
+
+namespace Ultima {
+namespace Ultima3 {
+namespace Data {
+
+const byte CGA_PALETTE1[4 * 3] = {
+	0x00, 0x00, 0x00, // 0: black
+	0x55, 0xff, 0xff, // 1: light cyan
+	0xff, 0x55, 0xff, // 2: light magenta
+	0xff, 0xff, 0xff  // 3: white
+};
+
+void setCGAPalette() {
+	Graphics::Palette palette(4);
+	palette.set(CGA_PALETTE1, 0, 4);
+	g_system->getPaletteManager()->setPalette(palette);
+}
+
+} // namespace Data
+} // namespace Ultima3
+} // namespace Ultima
diff --git a/engines/ultima/ultima3/data/data.h b/engines/ultima/ultima3/data/data.h
new file mode 100644
index 00000000000..3cb186e5f1d
--- /dev/null
+++ b/engines/ultima/ultima3/data/data.h
@@ -0,0 +1,41 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef ULTIMA3_DATA_DATA_H
+#define ULTIMA3_DATA_DATA_H
+
+#include "common/scummsys.h"
+
+namespace Ultima {
+namespace Ultima3 {
+namespace Data {
+
+// Ultima III renders everything (title screens, tiles, in-game text) in a
+// single CGA 4-color palette
+extern const byte CGA_PALETTE1[4 * 3];
+
+void setCGAPalette();
+
+} // namespace Data
+} // namespace Ultima3
+} // namespace Ultima
+
+#endif
diff --git a/engines/ultima/ultima3/gfx/pic_decoder.cpp b/engines/ultima/ultima3/gfx/pic_decoder.cpp
new file mode 100644
index 00000000000..f251725205e
--- /dev/null
+++ b/engines/ultima/ultima3/gfx/pic_decoder.cpp
@@ -0,0 +1,62 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "common/stream.h"
+#include "ultima/ultima3/data/data.h"
+#include "ultima/ultima3/gfx/pic_decoder.h"
+
+namespace Ultima {
+namespace Ultima3 {
+namespace Gfx {
+
+constexpr int BANK_SIZE = 0x2000;  // reserved size of each interlaced CGA bank
+constexpr int BYTES_PER_ROW = 80;  // 320 pixels / 4 pixels-per-byte
+
+bool PicDecoder::loadStream(Common::SeekableReadStream &stream) {
+	destroy();
+	_surface.create(320, 200, Graphics::PixelFormat::createFormatCLUT8());
+	byte *output_buffer = (byte *)_surface.getPixels();
+
+	Common::Array<byte> data;
+	data.resize(stream.size());
+	stream.read(&data[0], stream.size());
+
+	for (int y = 0; y < 200; ++y) {
+		int bank = y & 1;
+		const byte *row = &data[bank * BANK_SIZE + (y / 2) * BYTES_PER_ROW];
+		byte *outputRow = output_buffer + y * 320;
+
+		for (int byteX = 0; byteX < BYTES_PER_ROW; ++byteX) {
+			byte b = row[byteX];
+			outputRow[byteX * 4 + 0] = (b >> 6) & 3;
+			outputRow[byteX * 4 + 1] = (b >> 4) & 3;
+			outputRow[byteX * 4 + 2] = (b >> 2) & 3;
+			outputRow[byteX * 4 + 3] = b & 3;
+		}
+	}
+
+	_palette = Graphics::Palette(Data::CGA_PALETTE1, 4);
+	return true;
+}
+
+} // namespace Gfx
+} // namespace Ultima3
+} // namespace Ultima
diff --git a/engines/ultima/ultima3/gfx/pic_decoder.h b/engines/ultima/ultima3/gfx/pic_decoder.h
new file mode 100644
index 00000000000..ef4827e7ef1
--- /dev/null
+++ b/engines/ultima/ultima3/gfx/pic_decoder.h
@@ -0,0 +1,68 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef ULTIMA3_GFX_PIC_DECODER_H
+#define ULTIMA3_GFX_PIC_DECODER_H
+
+#include "graphics/palette.h"
+#include "graphics/surface.h"
+#include "image/image_decoder.h"
+
+namespace Ultima {
+namespace Ultima3 {
+namespace Gfx {
+
+/**
+ * Decodes Ultima III's raw "*.IBM" full-screen title art: a literal
+ * 16384-byte dump of the CGA mode 4 (320x200, 4-color, palette 1)
+ * framebuffer segment -- two interleaved 8192-byte banks (even scanlines
+ * in the first, odd in the second), 2 bits/pixel, 4 pixels per byte,
+ * MSB-first.
+ */
+class PicDecoder : public Image::ImageDecoder {
+private:
+	Graphics::Palette _palette;
+	Graphics::Surface _surface;
+public:
+	~PicDecoder() {
+		destroy();
+	}
+
+	bool loadStream(Common::SeekableReadStream &stream) override;
+
+	void destroy() override {
+		_surface.free();
+	}
+
+	const Graphics::Surface *getSurface() const override {
+		return &_surface;
+	}
+
+	const Graphics::Palette &getPalette() const override {
+		return _palette;
+	}
+};
+
+} // namespace Gfx
+} // namespace Ultima3
+} // namespace Ultima
+
+#endif
diff --git a/engines/ultima/ultima3/ultima3.cpp b/engines/ultima/ultima3/ultima3.cpp
index ac65d0a218e..c2ff5cbdf75 100644
--- a/engines/ultima/ultima3/ultima3.cpp
+++ b/engines/ultima/ultima3/ultima3.cpp
@@ -26,6 +26,7 @@
 #include "ultima/ultima3/ultima3.h"
 #include "ultima/ultima3/console.h"
 #include "ultima/ultima3/metaengine.h"
+#include "ultima/ultima3/data/data.h"
 #include "ultima/ultima3/views/views.h"
 
 namespace Ultima {
@@ -56,6 +57,7 @@ Common::Error Ultima3Engine::run() {
 
 	// Initialize 320x200 graphics mode
 	initGraphics(320, 200);
+	Data::setCGAPalette();
 	_pcSpeakerReady = _pcSpeaker->init();
 
 	// Set the engine's debugger console
@@ -63,7 +65,8 @@ Common::Error Ultima3Engine::run() {
 
 	Views::Views views;
 	addView("Startup");
-	runGame(views);
+	runGame();
+	(void)views;		// Suppress any warnings of unused local
 
 	return Common::kNoError;
 }
diff --git a/engines/ultima/ultima3/views/main_menu.cpp b/engines/ultima/ultima3/views/main_menu.cpp
new file mode 100644
index 00000000000..78419467f6c
--- /dev/null
+++ b/engines/ultima/ultima3/views/main_menu.cpp
@@ -0,0 +1,56 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "ultima/ultima3/views/main_menu.h"
+
+namespace Ultima {
+namespace Ultima3 {
+namespace Views {
+
+constexpr int COLOR_TEXT = 3; // white, within CGA_PALETTE1
+
+void MainMenu::draw() {
+	auto s = getSurface();
+	s.clear();
+	s.setColor(COLOR_TEXT);
+
+	s.writeString(Common::Point(11, 8), "R - Return to the View");
+	s.writeString(Common::Point(11, 10), "O - Organize a Party");
+	s.writeString(Common::Point(11, 12), "J - Journey Onward");
+}
+
+bool MainMenu::msgKeypress(const KeypressMessage &msg) {
+	switch (msg.keycode) {
+	case Common::KEYCODE_r:
+	case Common::KEYCODE_o:
+	case Common::KEYCODE_j:
+		// Wired up once the roster/party data model and world engine exist
+		break;
+	default:
+		break;
+	}
+
+	return true;
+}
+
+} // namespace Views
+} // namespace Ultima3
+} // namespace Ultima
diff --git a/engines/ultima/ultima3/views/main_menu.h b/engines/ultima/ultima3/views/main_menu.h
new file mode 100644
index 00000000000..cd777077154
--- /dev/null
+++ b/engines/ultima/ultima3/views/main_menu.h
@@ -0,0 +1,51 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef ULTIMA3_VIEWS_MAIN_MENU_H
+#define ULTIMA3_VIEWS_MAIN_MENU_H
+
+#include "graphics/views/view.h"
+
+namespace Ultima {
+namespace Ultima3 {
+namespace Views {
+
+using namespace Graphics::Views;
+
+/**
+ * BOOTUP.BIN's main menu: Return to the View / Organize a Party /
+ * Journey Onward. The option handlers are wired up as the roster/party
+ * data model and the world engine land in later stages.
+ */
+class MainMenu : public View {
+public:
+	MainMenu() : View("MainMenu") {}
+	~MainMenu() override {}
+
+	void draw() override;
+	bool msgKeypress(const KeypressMessage &msg) override;
+};
+
+} // namespace Views
+} // namespace Ultima3
+} // namespace Ultima
+
+#endif
diff --git a/engines/ultima/ultima3/views/startup.cpp b/engines/ultima/ultima3/views/startup.cpp
new file mode 100644
index 00000000000..5f4eacc003d
--- /dev/null
+++ b/engines/ultima/ultima3/views/startup.cpp
@@ -0,0 +1,54 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "ultima/ultima3/views/startup.h"
+#include "ultima/ultima3/data/data.h"
+
+namespace Ultima {
+namespace Ultima3 {
+namespace Views {
+
+#define DELAY_SECONDS 3
+
+#define COLOR_FOREGROUND 3 // white, within CGA_PALETTE1
+
+bool Startup::msgFocus(const FocusMessage &msg) {
+	Data::setCGAPalette();
+	delaySeconds(DELAY_SECONDS);
+	return View::msgFocus(msg);
+}
+
+void Startup::timeout() {
+	showTitle();
+}
+
+void Startup::draw() {
+	auto s = getSurface();
+	s.clear();
+
+	s.setColor(COLOR_FOREGROUND);
+	s.writeString(Common::Point(14, 8), "Ultima III");
+	s.writeString(Common::Point(11, 11), "Exodus");
+}
+
+} // namespace Views
+} // namespace Ultima3
+} // namespace Ultima
diff --git a/engines/ultima/ultima3/views/startup.h b/engines/ultima/ultima3/views/startup.h
new file mode 100644
index 00000000000..f869fd741e5
--- /dev/null
+++ b/engines/ultima/ultima3/views/startup.h
@@ -0,0 +1,68 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef ULTIMA3_VIEWS_STARTUP_H
+#define ULTIMA3_VIEWS_STARTUP_H
+
+#include "graphics/views/view.h"
+
+namespace Ultima {
+namespace Ultima3 {
+namespace Views {
+
+using namespace Graphics::Views;
+
+/**
+ * Brief ScummVM splash shown before handing off to the real attract-mode
+ * Title sequence.
+ */
+class Startup : public View {
+private:
+	void showTitle() {
+		replaceView("Title");
+	}
+public:
+	Startup() : View("Startup") {}
+	~Startup() override {}
+
+	void draw() override;
+
+	bool msgFocus(const FocusMessage &msg) override;
+	void timeout() override;
+	bool msgKeypress(const KeypressMessage &msg) override {
+		showTitle();
+		return true;
+	}
+	bool msgMouseDown(const MouseDownMessage &msg) override {
+		showTitle();
+		return true;
+	}
+	bool msgAction(const ActionMessage &msg) override {
+		showTitle();
+		return true;
+	}
+};
+
+} // namespace Views
+} // namespace Ultima3
+} // namespace Ultima
+
+#endif
diff --git a/engines/ultima/ultima3/views/title.cpp b/engines/ultima/ultima3/views/title.cpp
new file mode 100644
index 00000000000..2c49a696adc
--- /dev/null
+++ b/engines/ultima/ultima3/views/title.cpp
@@ -0,0 +1,132 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "common/file.h"
+#include "common/util.h"
+#include "ultima/ultima3/views/title.h"
+#include "ultima/ultima3/gfx/pic_decoder.h"
+
+namespace Ultima {
+namespace Ultima3 {
+namespace Views {
+
+constexpr int COLOR_TEXT = 3; // white, within CGA_PALETTE1
+
+// Cycling order confirmed from WIND_DIRECTION_TABLE, distinct from the
+// strings' own in-memory layout order
+static const char *const WIND_NAMES[] = {
+	"Calm Wind", "North Wind", "East Wind", "South Wind", "West Wind"
+};
+constexpr int WIND_COUNT = ARRAYSIZE(WIND_NAMES);
+constexpr int WIND_TICK_FRAMES = 25;
+
+Title::Title() : View("Title") {
+}
+
+void Title::loadPic(Graphics::ManagedSurface &surf, const Common::String &filename) {
+	Gfx::PicDecoder decoder;
+	Common::File f;
+	if (!f.open(filename.c_str()) || !decoder.loadStream(f))
+		error("Could not load %s", filename.c_str());
+
+	surf.create(320, 200);
+	surf.blitFrom(*decoder.getSurface());
+}
+
+bool Title::msgFocus(const FocusMessage &msg) {
+	loadPic(_background, "BLANK.IBM");
+	loadPic(_portrait, "EXOD.IBM");
+	_windIndex = 0;
+	showState(BACKGROUND);
+	return View::msgFocus(msg);
+}
+
+bool Title::msgUnfocus(const UnfocusMessage &msg) {
+	_background.free();
+	_portrait.free();
+	return View::msgUnfocus(msg);
+}
+
+void Title::showState(State state) {
+	_state = state;
+
+	switch (state) {
+	case BACKGROUND:
+		delaySeconds(3);
+		break;
+	case PORTRAIT:
+		delayFrames(WIND_TICK_FRAMES);
+		break;
+	}
+
+	redraw();
+}
+
+void Title::draw() {
+	auto s = getSurface();
+
+	switch (_state) {
+	case BACKGROUND:
+		s.blitFrom(_background);
+		break;
+	case PORTRAIT:
+		s.blitFrom(_portrait);
+		s.setColor(COLOR_TEXT);
+		s.writeString(Common::Point(0, 24), WIND_NAMES[_windIndex]);
+		break;
+	}
+}
+
+void Title::timeout() {
+	switch (_state) {
+	case BACKGROUND:
+		showState(PORTRAIT);
+		break;
+	case PORTRAIT:
+		_windIndex = (_windIndex + 1) % WIND_COUNT;
+		delayFrames(WIND_TICK_FRAMES);
+		redraw();
+		break;
+	}
+}
+
+void Title::showMainMenu() {
+	replaceView("MainMenu");
+}
+
+bool Title::msgKeypress(const KeypressMessage &msg) {
+	showMainMenu();
+	return true;
+}
+
+bool Title::msgMouseDown(const MouseDownMessage &msg) {
+	showMainMenu();
+	return true;
+}
+
+bool Title::msgAction(const ActionMessage &msg) {
+	showMainMenu();
+	return true;
+}
+
+} // namespace Views
+} // namespace Ultima3
+} // namespace Ultima
diff --git a/engines/ultima/ultima3/views/title.h b/engines/ultima/ultima3/views/title.h
new file mode 100644
index 00000000000..89a0c6d3d21
--- /dev/null
+++ b/engines/ultima/ultima3/views/title.h
@@ -0,0 +1,71 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef ULTIMA3_VIEWS_TITLE_H
+#define ULTIMA3_VIEWS_TITLE_H
+
+#include "graphics/managed_surface.h"
+#include "graphics/views/view.h"
+
+namespace Ultima {
+namespace Ultima3 {
+namespace Views {
+
+using namespace Graphics::Views;
+
+/**
+ * The title screen: BLANK.IBM as a background, then EXOD.IBM (Exodus's
+ * portrait) with the wind-direction indicator cycling underneath it. Any
+ * key or action moves straight on to the main menu.
+ */
+class Title : public View {
+private:
+	enum State {
+		BACKGROUND, PORTRAIT
+	};
+	State _state = BACKGROUND;
+	int _windIndex = 0;
+
+	Graphics::ManagedSurface _background, _portrait;
+
+	void loadPic(Graphics::ManagedSurface &surf, const Common::String &filename);
+	void showState(State state);
+	void showMainMenu();
+
+public:
+	Title();
+	~Title() override {}
+
+	bool msgFocus(const FocusMessage &msg) override;
+	bool msgUnfocus(const UnfocusMessage &msg) override;
+	void draw() override;
+	void timeout() override;
+
+	bool msgKeypress(const KeypressMessage &msg) override;
+	bool msgMouseDown(const MouseDownMessage &msg) override;
+	bool msgAction(const ActionMessage &msg) override;
+};
+
+} // namespace Views
+} // namespace Ultima3
+} // namespace Ultima
+
+#endif
diff --git a/engines/ultima/ultima3/views/views.h b/engines/ultima/ultima3/views/views.h
index a66535affe4..72015b4b0a4 100644
--- a/engines/ultima/ultima3/views/views.h
+++ b/engines/ultima/ultima3/views/views.h
@@ -23,12 +23,18 @@
 #define ULTIMA3_VIEWS_H
 
 #include "ultima/shared/engine/events.h"
+#include "ultima/ultima3/views/main_menu.h"
+#include "ultima/ultima3/views/startup.h"
+#include "ultima/ultima3/views/title.h"
 
 namespace Ultima {
 namespace Ultima3 {
 namespace Views {
 
-struct Views : public Shared::Views {
+struct Views {
+	MainMenu _mainMenu;
+	Startup _startup;
+	Title _title;
 };
 
 } // namespace Views


Commit: 9f5b373a85cbeeaef63a13ac7118d15ace0b3558
    https://github.com/scummvm/scummvm/commit/9f5b373a85cbeeaef63a13ac7118d15ace0b3558
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:41:00+11:00

Commit Message:
ULTIMA: ULTIMA3: Faithfully recreate the title screen sequence

Changed paths:
  R engines/ultima/ultima3/views/startup.cpp
  R engines/ultima/ultima3/views/startup.h
    engines/ultima/module.mk
    engines/ultima/ultima3/ultima3.cpp
    engines/ultima/ultima3/ultima3.h
    engines/ultima/ultima3/views/title.cpp
    engines/ultima/ultima3/views/title.h
    engines/ultima/ultima3/views/views.h


diff --git a/engines/ultima/module.mk b/engines/ultima/module.mk
index 492a5ab1cdd..c6c2af12666 100644
--- a/engines/ultima/module.mk
+++ b/engines/ultima/module.mk
@@ -165,7 +165,6 @@ MODULE_OBJS += \
 	ultima3/data/data.o \
 	ultima3/gfx/pic_decoder.o \
 	ultima3/views/main_menu.o \
-	ultima3/views/startup.o \
 	ultima3/views/title.o
 endif
 
diff --git a/engines/ultima/ultima3/ultima3.cpp b/engines/ultima/ultima3/ultima3.cpp
index c2ff5cbdf75..c2175a0d88c 100644
--- a/engines/ultima/ultima3/ultima3.cpp
+++ b/engines/ultima/ultima3/ultima3.cpp
@@ -64,7 +64,7 @@ Common::Error Ultima3Engine::run() {
 	setDebugger(new Console());
 
 	Views::Views views;
-	addView("Startup");
+	addView("Title");
 	runGame();
 	(void)views;		// Suppress any warnings of unused local
 
@@ -85,6 +85,21 @@ Common::Error Ultima3Engine::syncGame(Common::Serializer &s) {
 	return Common::kNoError;
 }
 
+void Ultima3Engine::queueTone(int divisor, uint32 lengthMs) {
+	if (!_pcSpeakerReady)
+		return;
+
+	float freq = divisor > 0 ? 1193182.0f / divisor : 0.0f;
+	_pcSpeaker->playQueue(Audio::PCSpeaker::kWaveFormSquare, freq, lengthMs * 1000);
+}
+
+void Ultima3Engine::queueSilence(uint32 lengthMs) {
+	if (!_pcSpeakerReady)
+		return;
+
+	_pcSpeaker->playQueue(Audio::PCSpeaker::kWaveFormSilence, 0.0f, lengthMs * 1000);
+}
+
 bool Ultima3Engine::savegamesExist() const {
 	Common::String slotName = getSaveStateName(1);
 	Common::InSaveFile *saveFile = g_system->getSavefileManager()->openForLoading(slotName);
diff --git a/engines/ultima/ultima3/ultima3.h b/engines/ultima/ultima3/ultima3.h
index 18188fb201c..9cb90417c1b 100644
--- a/engines/ultima/ultima3/ultima3.h
+++ b/engines/ultima/ultima3/ultima3.h
@@ -60,6 +60,7 @@ private:
 	Audio::PCSpeaker *_pcSpeaker = nullptr;
 	bool _pcSpeakerReady = false;
 
+public:
 	/**
 	 * Queues a single square-wave note. divisor is the original's PIT
 	 * timer divisor (frequency = ~1193182/divisor), matching how each
@@ -72,12 +73,10 @@ private:
 	 */
 	void queueSilence(uint32 lengthMs);
 
-public:
 	// Debug flag toggled by the "intangible" console command, allowing
 	// movement through normally impassable terrain
 	bool _intangible = false;
 
-public:
 	Ultima3Engine(OSystem *syst, const Ultima::UltimaGameDescription *gameDesc);
 	~Ultima3Engine() override;
 
diff --git a/engines/ultima/ultima3/views/startup.cpp b/engines/ultima/ultima3/views/startup.cpp
deleted file mode 100644
index 5f4eacc003d..00000000000
--- a/engines/ultima/ultima3/views/startup.cpp
+++ /dev/null
@@ -1,54 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-#include "ultima/ultima3/views/startup.h"
-#include "ultima/ultima3/data/data.h"
-
-namespace Ultima {
-namespace Ultima3 {
-namespace Views {
-
-#define DELAY_SECONDS 3
-
-#define COLOR_FOREGROUND 3 // white, within CGA_PALETTE1
-
-bool Startup::msgFocus(const FocusMessage &msg) {
-	Data::setCGAPalette();
-	delaySeconds(DELAY_SECONDS);
-	return View::msgFocus(msg);
-}
-
-void Startup::timeout() {
-	showTitle();
-}
-
-void Startup::draw() {
-	auto s = getSurface();
-	s.clear();
-
-	s.setColor(COLOR_FOREGROUND);
-	s.writeString(Common::Point(14, 8), "Ultima III");
-	s.writeString(Common::Point(11, 11), "Exodus");
-}
-
-} // namespace Views
-} // namespace Ultima3
-} // namespace Ultima
diff --git a/engines/ultima/ultima3/views/startup.h b/engines/ultima/ultima3/views/startup.h
deleted file mode 100644
index f869fd741e5..00000000000
--- a/engines/ultima/ultima3/views/startup.h
+++ /dev/null
@@ -1,68 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-#ifndef ULTIMA3_VIEWS_STARTUP_H
-#define ULTIMA3_VIEWS_STARTUP_H
-
-#include "graphics/views/view.h"
-
-namespace Ultima {
-namespace Ultima3 {
-namespace Views {
-
-using namespace Graphics::Views;
-
-/**
- * Brief ScummVM splash shown before handing off to the real attract-mode
- * Title sequence.
- */
-class Startup : public View {
-private:
-	void showTitle() {
-		replaceView("Title");
-	}
-public:
-	Startup() : View("Startup") {}
-	~Startup() override {}
-
-	void draw() override;
-
-	bool msgFocus(const FocusMessage &msg) override;
-	void timeout() override;
-	bool msgKeypress(const KeypressMessage &msg) override {
-		showTitle();
-		return true;
-	}
-	bool msgMouseDown(const MouseDownMessage &msg) override {
-		showTitle();
-		return true;
-	}
-	bool msgAction(const ActionMessage &msg) override {
-		showTitle();
-		return true;
-	}
-};
-
-} // namespace Views
-} // namespace Ultima3
-} // namespace Ultima
-
-#endif
diff --git a/engines/ultima/ultima3/views/title.cpp b/engines/ultima/ultima3/views/title.cpp
index 2c49a696adc..bd0ac97b383 100644
--- a/engines/ultima/ultima3/views/title.cpp
+++ b/engines/ultima/ultima3/views/title.cpp
@@ -20,23 +20,34 @@
  */
 
 #include "common/file.h"
-#include "common/util.h"
 #include "ultima/ultima3/views/title.h"
 #include "ultima/ultima3/gfx/pic_decoder.h"
+#include "ultima/ultima3/ultima3.h"
 
 namespace Ultima {
 namespace Ultima3 {
 namespace Views {
 
-constexpr int COLOR_TEXT = 3; // white, within CGA_PALETTE1
+// Box regions within EXOD.IBM, in pixels -- (srcY, dstY, x, width, height),
+// derived directly from drawTitleBox1-6's drawSparkleBox parameters
+// (bl/bh=source/dest row, cx=starting byte column *4, dh=width in *words*
+// i.e. *8, dl=row count)
+static const TitleBox BOX1 = { 8, 8, 28, 264, 77 };
+static const TitleBox BOX4 = { 85, 85, 28, 264, 43 };
+static const TitleBox BOX5 = { 132, 132, 68, 72, 4 };
+static const TitleBox BOX6 = { 146, 146, 20, 40, 32 };
+static const TitleBox BOX2 = { 168, 168, 116, 88, 16 };
+static const TitleBox BOX3 = { 152, 168, 116, 96, 16 };
 
-// Cycling order confirmed from WIND_DIRECTION_TABLE, distinct from the
-// strings' own in-memory layout order
-static const char *const WIND_NAMES[] = {
-	"Calm Wind", "North Wind", "East Wind", "South Wind", "West Wind"
-};
-constexpr int WIND_COUNT = ARRAYSIZE(WIND_NAMES);
-constexpr int WIND_TICK_FRAMES = 25;
+// runBootFlagAnimation's per-si (si=2,1,0) step tables, read directly from
+// the 12 raw bytes sitting between drawSparkleBox's end and
+// runBootFlagAnimation's start (0x15FE7-0x15FF2 in ultima.idb)
+static const int8 FLAG_STEP[3]       = { 1, -1, 1 };
+static const int FLAG_AL_LIMIT[3]    = { 4, -1, 4 }; // -1 stands for the 0FFh byte-wrap sentinel
+static const byte FLAG_BL_LIMIT[3]   = { 0x31, 0x2B, 0x34 };
+static const byte FLAG_INITIAL_AL[3] = { 0, 3, 0 };
+
+constexpr int WAIT_FRAMES_PER_UNIT = 5; // ~waitFrames(1)'s real-hardware duration, approximated
 
 Title::Title() : View("Title") {
 }
@@ -51,59 +62,303 @@ void Title::loadPic(Graphics::ManagedSurface &surf, const Common::String &filena
 	surf.blitFrom(*decoder.getSurface());
 }
 
+void Title::loadRaw(Common::Array<byte> &data, const Common::String &filename) {
+	Common::File f;
+	if (!f.open(filename.c_str()))
+		error("Could not load %s", filename.c_str());
+
+	data.resize((uint)f.size());
+	f.read(&data[0], data.size());
+}
+
 bool Title::msgFocus(const FocusMessage &msg) {
-	loadPic(_background, "BLANK.IBM");
 	loadPic(_portrait, "EXOD.IBM");
-	_windIndex = 0;
-	showState(BACKGROUND);
+	loadRaw(_nameData, "NAME.DAT");
+	loadRaw(_animateData, "ANIMATE.DAT");
+
+	_canvas.create(320, 200);
+	loadPic(_canvas, "BLANK.IBM");
+
+	_phase = PH_BOX1_SPARKLE;
+	_sparklePass = 0;
+	_keyPending = false;
+	_prngState = 0x9DE3;
+
+	delayFrames(1);
 	return View::msgFocus(msg);
 }
 
 bool Title::msgUnfocus(const UnfocusMessage &msg) {
-	_background.free();
+	_canvas.free();
 	_portrait.free();
+	_nameData.clear();
+	_animateData.clear();
 	return View::msgUnfocus(msg);
 }
 
-void Title::showState(State state) {
-	_state = state;
+void Title::draw() {
+	getSurface().blitFrom(_canvas);
+}
 
-	switch (state) {
-	case BACKGROUND:
-		delaySeconds(3);
-		break;
-	case PORTRAIT:
-		delayFrames(WIND_TICK_FRAMES);
-		break;
+void Title::drawBox(const TitleBox &box, bool sparkle, int threshold) {
+	int wordCols = box.width / 8;
+
+	for (int row = 0; row < box.height; ++row) {
+		for (int col = 0; col < wordCols; ++col) {
+			int px = box.x + col * 8;
+			bool reveal = true;
+
+			if (sparkle) {
+				// The original's additive congruential generator:
+				// al' = (al+0x1D); al'' = al'+ah; ah' = al'
+				byte al = _prngState & 0xFF, ah = _prngState >> 8;
+				byte step1 = al + 0x1D;
+				byte newAl = step1 + ah;
+				_prngState = (step1 << 8) | newAl;
+				reveal = newAl <= threshold;
+			}
+
+			for (int dx = 0; dx < 8; ++dx) {
+				byte color = reveal ?
+					*(const byte *)_portrait.getBasePtr(px + dx, box.srcY + row) : 0;
+				_canvas.setPixel(px + dx, box.dstY + row, color);
+			}
+		}
 	}
 
 	redraw();
 }
 
-void Title::draw() {
-	auto s = getSurface();
+void Title::drawFlagFrame(int bxParam, int axParam) {
+	int px = ((bxParam * 2 + 20) / 4) * 4;
+	uint32 srcOffset = (uint32)axParam * 1472 + (uint32)(bxParam & 1) * 736;
+	const byte *src = &_animateData[srcOffset];
 
-	switch (_state) {
-	case BACKGROUND:
-		s.blitFrom(_background);
-		break;
-	case PORTRAIT:
-		s.blitFrom(_portrait);
-		s.setColor(COLOR_TEXT);
-		s.writeString(Common::Point(0, 24), WIND_NAMES[_windIndex]);
-		break;
+	for (int row = 0; row < 16; ++row) {
+		int y = 168 + row;
+		const byte *rowBytes = src + row * 23;
+
+		for (int dx = -4; dx < 0; ++dx)
+			_canvas.setPixel(px + dx, y, 0);
+
+		for (int b = 0; b < 23; ++b) {
+			byte v = rowBytes[b];
+			for (int bit = 0; bit < 4; ++bit)
+				_canvas.setPixel(px + b * 4 + bit, y, (v >> (6 - bit * 2)) & 3);
+		}
+
+		for (int dx = 0; dx < 4; ++dx)
+			_canvas.setPixel(px + 23 * 4 + dx, y, 0);
+	}
+
+	redraw();
+}
+
+bool Title::stepPixelPath() {
+	if (_pixelPathPos + 1 >= _nameData.size())
+		return false;
+
+	byte lengthByte = _nameData[_pixelPathPos];
+	if (lengthByte == 0)
+		return false;
+	byte rowByte = _nameData[_pixelPathPos + 1];
+	_pixelPathPos += 2;
+
+	int x = lengthByte + 20, y = 0xC0 - rowByte;
+	_canvas.setPixel(x, y, 3);
+	_canvas.setPixel(x + 1, y, 3);
+
+	redraw();
+	return true;
+}
+
+bool Title::stepFlagAnimation() {
+	if (_flagSi < 0)
+		return false;
+
+	if (!_flagAlActive) {
+		_flagAl = FLAG_INITIAL_AL[_flagSi];
+		_flagAlActive = true;
+	}
+
+	drawFlagFrame(_flagBl, _flagAl);
+	_flagAl += FLAG_STEP[_flagSi];
+	int alLimit = FLAG_AL_LIMIT[_flagSi] < 0 ? 0x100 + FLAG_AL_LIMIT[_flagSi] : FLAG_AL_LIMIT[_flagSi];
+	if ((_flagAl & 0xFF) != alLimit)
+		return true;
+
+	_flagAlActive = false;
+	_flagBl = (_flagBl + FLAG_STEP[_flagSi]) & 0xFF;
+	if (_flagBl != FLAG_BL_LIMIT[_flagSi])
+		return true;
+
+	--_flagSi;
+	return _flagSi >= 0;
+}
+
+bool Title::tickWait() {
+	if (_keyPending)
+		return true;
+	if (--_waitCounter <= 0)
+		return true;
+
+	delayFrames(1);
+	return false;
+}
+
+void Title::playSoundBurst() {
+	// The original toggles the PC speaker's raw output bit ~1024 times at a
+	// CPU-speed-dependent rate (no fixed PIT divisor is ever programmed);
+	// approximated here as a short buzzy burst rather than an exact tone
+	for (int i = 0; i < 8; ++i) {
+		g_engine->queueTone(1500, 20);
+		g_engine->queueTone(1800, 20);
 	}
 }
 
 void Title::timeout() {
-	switch (_state) {
-	case BACKGROUND:
-		showState(PORTRAIT);
+	switch (_phase) {
+	case PH_BOX1_SPARKLE:
+		if (_keyPending || _sparklePass >= 64) {
+			drawBox(BOX1, false, 0);
+			_phase = PH_BOX1_WAIT;
+			_waitCounter = 2 * WAIT_FRAMES_PER_UNIT;
+		} else {
+			drawBox(BOX1, true, _sparklePass * 4);
+			++_sparklePass;
+		}
+		delayFrames(1);
+		break;
+
+	case PH_BOX1_WAIT:
+		if (tickWait()) {
+			_phase = PH_BOX4_SPARKLE;
+			_sparklePass = 0;
+			delayFrames(1);
+		}
+		break;
+
+	case PH_BOX4_SPARKLE:
+		if (_keyPending || _sparklePass >= 64) {
+			drawBox(BOX4, false, 0);
+			_phase = PH_BOX4_WAIT;
+			_waitCounter = 5 * WAIT_FRAMES_PER_UNIT;
+		} else {
+			drawBox(BOX4, true, _sparklePass * 4);
+			++_sparklePass;
+		}
+		delayFrames(1);
 		break;
-	case PORTRAIT:
-		_windIndex = (_windIndex + 1) % WIND_COUNT;
-		delayFrames(WIND_TICK_FRAMES);
-		redraw();
+
+	case PH_BOX4_WAIT:
+		if (tickWait()) {
+			_phase = PH_BOX5;
+			delayFrames(1);
+		}
+		break;
+
+	case PH_BOX5:
+		drawBox(BOX5, false, 0);
+		_phase = PH_BOX5_WAIT;
+		_waitCounter = 3 * WAIT_FRAMES_PER_UNIT;
+		delayFrames(1);
+		break;
+
+	case PH_BOX5_WAIT:
+		if (tickWait()) {
+			_phase = PH_PIXEL_PATH;
+			_pixelPathPos = 0;
+			delayFrames(1);
+		}
+		break;
+
+	case PH_PIXEL_PATH:
+		// ~6 signature steps per tick approximates the original's very
+		// short (~9ms) inter-step busy-wait at a modern 20fps frame rate
+		if (_keyPending) {
+			_phase = PH_PIXEL_PATH_WAIT;
+			_waitCounter = 2 * WAIT_FRAMES_PER_UNIT;
+		} else {
+			for (int i = 0; i < 6; ++i) {
+				if (!stepPixelPath()) {
+					_phase = PH_PIXEL_PATH_WAIT;
+					_waitCounter = 2 * WAIT_FRAMES_PER_UNIT;
+					break;
+				}
+			}
+		}
+		delayFrames(1);
+		break;
+
+	case PH_PIXEL_PATH_WAIT:
+		if (tickWait()) {
+			_phase = PH_BOX6;
+			delayFrames(1);
+		}
+		break;
+
+	case PH_BOX6:
+		drawBox(BOX6, false, 0);
+		_phase = PH_BOX6_WAIT;
+		_waitCounter = 6 * WAIT_FRAMES_PER_UNIT;
+		delayFrames(1);
+		break;
+
+	case PH_BOX6_WAIT:
+		if (tickWait()) {
+			_phase = PH_FLAG_ANIM;
+			_flagSi = 2;
+			_flagBl = 0x2A;
+			_flagAlActive = false;
+			delayFrames(1);
+		}
+		break;
+
+	case PH_FLAG_ANIM:
+		if (_keyPending || !stepFlagAnimation()) {
+			_phase = PH_FLAG_ANIM_WAIT;
+			_waitCounter = 4 * WAIT_FRAMES_PER_UNIT;
+		}
+		delayFrames(3); // ~drawAnimationFrameRow's own ~130ms inter-frame wait
+		break;
+
+	case PH_FLAG_ANIM_WAIT:
+		if (tickWait()) {
+			_phase = PH_BOX2;
+			delayFrames(1);
+		}
+		break;
+
+	case PH_BOX2:
+		drawBox(BOX2, false, 0);
+		_phase = PH_SOUND_BURST;
+		delayFrames(1);
+		break;
+
+	case PH_SOUND_BURST:
+		if (!_keyPending)
+			playSoundBurst();
+		_phase = PH_BOX3;
+		delayFrames(1);
+		break;
+
+	case PH_BOX3:
+		drawBox(BOX3, false, 0);
+		_phase = PH_BOX3_WAIT;
+		_waitCounter = 5 * WAIT_FRAMES_PER_UNIT;
+		delayFrames(1);
+		break;
+
+	case PH_BOX3_WAIT:
+		if (tickWait()) {
+			_phase = PH_DRAIN;
+			delayFrames(1);
+		}
+		break;
+
+	case PH_DRAIN:
+		_keyPending = false;
+		showMainMenu();
 		break;
 	}
 }
@@ -113,17 +368,17 @@ void Title::showMainMenu() {
 }
 
 bool Title::msgKeypress(const KeypressMessage &msg) {
-	showMainMenu();
+	_keyPending = true;
 	return true;
 }
 
 bool Title::msgMouseDown(const MouseDownMessage &msg) {
-	showMainMenu();
+	_keyPending = true;
 	return true;
 }
 
 bool Title::msgAction(const ActionMessage &msg) {
-	showMainMenu();
+	_keyPending = true;
 	return true;
 }
 
diff --git a/engines/ultima/ultima3/views/title.h b/engines/ultima/ultima3/views/title.h
index 89a0c6d3d21..c9af718c0d6 100644
--- a/engines/ultima/ultima3/views/title.h
+++ b/engines/ultima/ultima3/views/title.h
@@ -22,6 +22,7 @@
 #ifndef ULTIMA3_VIEWS_TITLE_H
 #define ULTIMA3_VIEWS_TITLE_H
 
+#include "common/array.h"
 #include "graphics/managed_surface.h"
 #include "graphics/views/view.h"
 
@@ -32,22 +33,93 @@ namespace Views {
 using namespace Graphics::Views;
 
 /**
- * The title screen: BLANK.IBM as a background, then EXOD.IBM (Exodus's
- * portrait) with the wind-direction indicator cycling underneath it. Any
- * key or action moves straight on to the main menu.
+ * A rectangular region of EXOD.IBM revealed onto the screen, in pixels:
+ * (srcY, dstY, x, width, height) -- see drawTitleBox1-6/drawSparkleBox
+ */
+struct TitleBox {
+	int srcY, dstY, x, width, height;
+};
+
+/**
+ * The title screen, ported directly from titleScreenAndChainToBootup and
+ * its helpers (drawTitleBox1-6/drawSparkleBox/plotPixel2bpp/
+ * drawAnimatedPixelPath/runBootFlagAnimation/drawAnimationFrameRow):
+ * BLANK.IBM as a background, then a sequence of rectangular regions of
+ * EXOD.IBM revealed on top of it (some instantly, some via a "sparkle"
+ * randomized reveal), NAME.DAT's hand-drawn signature pixel-path, and
+ * ANIMATE.DAT's waving-flag animation, each separated by a pause. Any
+ * key/action sets a pending flag that fast-forwards through every
+ * remaining reveal/pause (matching the original's keyboard-buffer-peek
+ * behaviour: a single buffered keystroke stays "pending" and skips every
+ * subsequent wait without needing to be pressed again) until a final
+ * step consumes it and moves on to the main menu.
  */
 class Title : public View {
 private:
-	enum State {
-		BACKGROUND, PORTRAIT
+	// Prefixed to avoid colliding with the file-scope TitleBox constants of
+	// the same names (BOX2/BOX3/BOX5/BOX6) in title.cpp -- an unscoped
+	// enum's values are injected into the class's own scope
+	enum Phase {
+		PH_BOX1_SPARKLE, PH_BOX1_WAIT,
+		PH_BOX4_SPARKLE, PH_BOX4_WAIT,
+		PH_BOX5, PH_BOX5_WAIT,
+		PH_PIXEL_PATH, PH_PIXEL_PATH_WAIT,
+		PH_BOX6, PH_BOX6_WAIT,
+		PH_FLAG_ANIM, PH_FLAG_ANIM_WAIT,
+		PH_BOX2,
+		PH_SOUND_BURST,
+		PH_BOX3, PH_BOX3_WAIT,
+		PH_DRAIN
 	};
-	State _state = BACKGROUND;
-	int _windIndex = 0;
 
-	Graphics::ManagedSurface _background, _portrait;
+	Phase _phase = PH_BOX1_SPARKLE;
+	bool _keyPending = false;
+	uint16 _prngState = 0x9DE3;
+	int _waitCounter = 0;
+
+	// Sparkle-box sub-state: 0-63 selects threshold (pass*4), 64 = the
+	// unconditional final full-detail pass
+	int _sparklePass = 0;
+
+	// drawAnimatedPixelPath (NAME.DAT) sub-state: byte offset of the next
+	// (length, row) pair
+	uint _pixelPathPos = 0;
+
+	// runBootFlagAnimation (ANIMATE.DAT) sub-state, mirroring si/bl/al
+	int _flagSi = 2;
+	int _flagBl = 0x2A;
+	int _flagAl = 0;
+	bool _flagAlActive = false;
+
+	Graphics::ManagedSurface _canvas;
+	Graphics::ManagedSurface _portrait;
+	Common::Array<byte> _nameData;
+	Common::Array<byte> _animateData;
 
 	void loadPic(Graphics::ManagedSurface &surf, const Common::String &filename);
-	void showState(State state);
+	void loadRaw(Common::Array<byte> &data, const Common::String &filename);
+
+	// Reveals one word-column (8 px) of `box` per PRNG roll when sparkle is
+	// true (drawSparkleBox's ah=0FFh mode); a plain full copy otherwise
+	void drawBox(const TitleBox &box, bool sparkle, int threshold);
+
+	// One 92x16px flag-flutter frame (drawAnimationFrameRow), plus its
+	// 4px erase margins on each side
+	void drawFlagFrame(int bxParam, int axParam);
+
+	// One step of the NAME.DAT signature reveal; returns false once the
+	// terminator is hit
+	bool stepPixelPath();
+
+	// One step of the flag animation's nested si/bl/al loop; returns false
+	// once fully finished
+	bool stepFlagAnimation();
+
+	// Advances _waitCounter by one tick; returns true once the wait is over
+	// (naturally, or because a key is already pending)
+	bool tickWait();
+
+	void playSoundBurst();
 	void showMainMenu();
 
 public:
diff --git a/engines/ultima/ultima3/views/views.h b/engines/ultima/ultima3/views/views.h
index 72015b4b0a4..31209bd3ffd 100644
--- a/engines/ultima/ultima3/views/views.h
+++ b/engines/ultima/ultima3/views/views.h
@@ -24,7 +24,6 @@
 
 #include "ultima/shared/engine/events.h"
 #include "ultima/ultima3/views/main_menu.h"
-#include "ultima/ultima3/views/startup.h"
 #include "ultima/ultima3/views/title.h"
 
 namespace Ultima {
@@ -33,7 +32,6 @@ namespace Views {
 
 struct Views {
 	MainMenu _mainMenu;
-	Startup _startup;
 	Title _title;
 };
 


Commit: a4b3d0cdff9f3027a9a94b174d5de5952d0e81f4
    https://github.com/scummvm/scummvm/commit/a4b3d0cdff9f3027a9a94b174d5de5952d0e81f4
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:41:00+11:00

Commit Message:
ULTIMA: ULTIMA3: Flesh out the main menu display

Changed paths:
  A engines/ultima/ultima3/gfx/charset.cpp
  A engines/ultima/ultima3/gfx/charset.h
    engines/ultima/module.mk
    engines/ultima/ultima3/ultima3.cpp
    engines/ultima/ultima3/ultima3.h
    engines/ultima/ultima3/views/main_menu.cpp
    engines/ultima/ultima3/views/main_menu.h
    engines/ultima/ultima3/views/title.cpp


diff --git a/engines/ultima/module.mk b/engines/ultima/module.mk
index c6c2af12666..a710ec016eb 100644
--- a/engines/ultima/module.mk
+++ b/engines/ultima/module.mk
@@ -163,6 +163,7 @@ MODULE_OBJS += \
 	ultima3/console.o \
 	ultima3/metaengine.o \
 	ultima3/data/data.o \
+	ultima3/gfx/charset.o \
 	ultima3/gfx/pic_decoder.o \
 	ultima3/views/main_menu.o \
 	ultima3/views/title.o
diff --git a/engines/ultima/ultima3/gfx/charset.cpp b/engines/ultima/ultima3/gfx/charset.cpp
new file mode 100644
index 00000000000..fb6c1e31378
--- /dev/null
+++ b/engines/ultima/ultima3/gfx/charset.cpp
@@ -0,0 +1,56 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "common/file.h"
+#include "ultima/ultima3/gfx/charset.h"
+
+namespace Ultima {
+namespace Ultima3 {
+namespace Gfx {
+
+byte CharSet::_data[CHARSET_GLYPHS * CHARSET_GLYPH_BYTES];
+
+void CharSet::load() {
+	Common::File f;
+	if (!f.open("CHARSET.ULT") || f.read(_data, sizeof(_data)) != sizeof(_data))
+		error("Could not load CHARSET.ULT");
+}
+
+void CharSet::drawChar(Graphics::Surface *dst, uint32 chr, int x, int y, uint32 color) const {
+	if (chr >= CHARSET_GLYPHS)
+		return;
+
+	// The first 8 bytes hold the even scanlines and the next 8 the odd ones,
+	// 2 bytes (8 pixels) per scanline
+	const byte *glyph = &_data[chr * CHARSET_GLYPH_BYTES];
+
+	for (int yp = 0; yp < 8; ++yp) {
+		const byte *line = glyph + (yp & 1) * 8 + (yp >> 1) * 2;
+		byte *destP = (byte *)dst->getBasePtr(x, y + yp);
+
+		for (int xp = 0; xp < 8; ++xp, ++destP)
+			*destP = (line[xp >> 2] >> (6 - (xp & 3) * 2)) & 3;
+	}
+}
+
+} // namespace Gfx
+} // namespace Ultima3
+} // namespace Ultima
diff --git a/engines/ultima/ultima3/gfx/charset.h b/engines/ultima/ultima3/gfx/charset.h
new file mode 100644
index 00000000000..e89b4a61fa2
--- /dev/null
+++ b/engines/ultima/ultima3/gfx/charset.h
@@ -0,0 +1,92 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef ULTIMA3_GFX_CHARSET_H
+#define ULTIMA3_GFX_CHARSET_H
+
+#include "graphics/font.h"
+#include "graphics/managed_surface.h"
+
+namespace Ultima {
+namespace Ultima3 {
+namespace Gfx {
+
+constexpr int CHARSET_GLYPHS = 128;
+constexpr int CHARSET_GLYPH_BYTES = 16;
+
+/**
+ * The game's CGA font from CHARSET.ULT: 128 glyphs of 8x8 pixels at 2 bits
+ * per pixel, so each glyph carries its own colors.
+ */
+class CharSet : public Graphics::Font {
+private:
+	static byte _data[CHARSET_GLYPHS * CHARSET_GLYPH_BYTES];
+
+public:
+	static void load();
+
+public:
+	/**
+	 * Return the height of the font.
+	 *
+	 * @return Font height in pixels.
+	 */
+	int getFontHeight() const override {
+		return 8;
+	}
+
+	/**
+	 * Return the maximum width of the font.
+	 *
+	 * @return Maximum font width in pixels.
+	 */
+	int getMaxCharWidth() const override {
+		return 8;
+	}
+
+	/**
+	 * Return the width of a specific character.
+	 *
+	 * @param chr  The character to query the width of.
+	 *
+	 * @return The width of the character in pixels.
+	 */
+	int getCharWidth(uint32 chr) const override {
+		return 8;
+	}
+
+	/**
+	 * Draw a character at a specific point on the surface.
+	 *
+	 * @param dst   The surface to draw on.
+	 * @param chr   The character to draw.
+	 * @param x     The x coordinate where to draw the character.
+	 * @param y     The y coordinate where to draw the character.
+	 * @param color The color of the character.
+	 */
+	void drawChar(Graphics::Surface *dst, uint32 chr, int x, int y, uint32 color) const override;
+};
+
+} // namespace Gfx
+} // namespace Ultima3
+} // namespace Ultima
+
+#endif
diff --git a/engines/ultima/ultima3/ultima3.cpp b/engines/ultima/ultima3/ultima3.cpp
index c2175a0d88c..e19db725e5e 100644
--- a/engines/ultima/ultima3/ultima3.cpp
+++ b/engines/ultima/ultima3/ultima3.cpp
@@ -28,6 +28,7 @@
 #include "ultima/ultima3/metaengine.h"
 #include "ultima/ultima3/data/data.h"
 #include "ultima/ultima3/views/views.h"
+#include "ultima/ultima3/gfx/charset.h"
 
 namespace Ultima {
 namespace Ultima3 {
@@ -58,6 +59,7 @@ Common::Error Ultima3Engine::run() {
 	// Initialize 320x200 graphics mode
 	initGraphics(320, 200);
 	Data::setCGAPalette();
+	Gfx::CharSet::load();
 	_pcSpeakerReady = _pcSpeaker->init();
 
 	// Set the engine's debugger console
@@ -100,6 +102,11 @@ void Ultima3Engine::queueSilence(uint32 lengthMs) {
 	_pcSpeaker->playQueue(Audio::PCSpeaker::kWaveFormSilence, 0.0f, lengthMs * 1000);
 }
 
+void Ultima3Engine::playErrorBeep() {
+	// ~371Hz for ~65ms, from the original's raw 48-toggle loop at 4.77MHz
+	queueTone(3216, 65);
+}
+
 bool Ultima3Engine::savegamesExist() const {
 	Common::String slotName = getSaveStateName(1);
 	Common::InSaveFile *saveFile = g_system->getSavefileManager()->openForLoading(slotName);
@@ -109,5 +116,9 @@ bool Ultima3Engine::savegamesExist() const {
 	return result;
 }
 
+Graphics::Font *Ultima3Engine::createFont() const {
+	return new Gfx::CharSet();
+}
+
 } // namespace Ultima3
 } // namespace Ultima
diff --git a/engines/ultima/ultima3/ultima3.h b/engines/ultima/ultima3/ultima3.h
index 9cb90417c1b..a9be0da34a6 100644
--- a/engines/ultima/ultima3/ultima3.h
+++ b/engines/ultima/ultima3/ultima3.h
@@ -73,6 +73,11 @@ public:
 	 */
 	void queueSilence(uint32 lengthMs);
 
+	/**
+	 * Plays the short low buzz used to reject invalid input
+	 */
+	void playErrorBeep();
+
 	// Debug flag toggled by the "intangible" console command, allowing
 	// movement through normally impassable terrain
 	bool _intangible = false;
@@ -116,6 +121,11 @@ public:
 	 * Returns true if any savegames exist
 	 */
 	bool savegamesExist() const;
+
+	/**
+	 * Returns a font object that GfxSurface instances can use
+	 */
+	Graphics::Font *createFont() const override;
 };
 
 extern Ultima3Engine *g_engine;
diff --git a/engines/ultima/ultima3/views/main_menu.cpp b/engines/ultima/ultima3/views/main_menu.cpp
index 78419467f6c..85207f2e4b3 100644
--- a/engines/ultima/ultima3/views/main_menu.cpp
+++ b/engines/ultima/ultima3/views/main_menu.cpp
@@ -19,33 +19,138 @@
  *
  */
 
+#include "common/keyboard.h"
 #include "ultima/ultima3/views/main_menu.h"
+#include "ultima/ultima3/ultima3.h"
 
 namespace Ultima {
 namespace Ultima3 {
 namespace Views {
 
-constexpr int COLOR_TEXT = 3; // white, within CGA_PALETTE1
+constexpr int GLYPH_UP_ARROW = 0x1E;
+constexpr int BORDER_TOP = 10;
+constexpr int BORDER_BOTTOM = 23;
+constexpr int BORDER_RIGHT = 39;
+constexpr int OPTION_ROW = 15;
+constexpr int OPTION_COL = 16;
+constexpr int CHOICE_COL = 23;
+
+// Letter keys for each option, with Escape (the last) acting as Return
+static const char OPTION_KEYS[] = { 'R', 'O', 'J' };
+static const char *const OPTION_WORDS[] = { "Return", "Organize", "Journey", "Return" };
+constexpr int OPTION_ESCAPE = 3;
+
+static bool isModifierKey(Common::KeyCode key) {
+	switch (key) {
+	case Common::KEYCODE_LSHIFT:
+	case Common::KEYCODE_RSHIFT:
+	case Common::KEYCODE_LCTRL:
+	case Common::KEYCODE_RCTRL:
+	case Common::KEYCODE_LALT:
+	case Common::KEYCODE_RALT:
+	case Common::KEYCODE_LMETA:
+	case Common::KEYCODE_RMETA:
+	case Common::KEYCODE_CAPSLOCK:
+	case Common::KEYCODE_NUMLOCK:
+	case Common::KEYCODE_SCROLLOCK:
+		return true;
+	default:
+		return false;
+	}
+}
+
+static int findOption(const KeypressMessage &msg) {
+	if (msg.keycode == Common::KEYCODE_ESCAPE)
+		return OPTION_ESCAPE;
+
+	char c = msg.ascii;
+	if (c >= 'a' && c <= 'z')
+		c -= 'a' - 'A';
+
+	for (int i = 0; i < ARRAYSIZE(OPTION_KEYS); ++i) {
+		if (OPTION_KEYS[i] == c)
+			return i;
+	}
+
+	return -1;
+}
+
+bool MainMenu::msgFocus(const FocusMessage &msg) {
+	_state = CHOOSING;
+	return View::msgFocus(msg);
+}
+
+void MainMenu::drawBorder(GfxSurface &s) {
+	// Alternating black and magenta pixels, filling whole 8x8 cells
+	auto cell = [&](int col, int row) {
+		for (int y = 0; y < 8; ++y)
+			for (int x = 0; x < 8; ++x)
+				s.setPixel(col * 8 + x, row * 8 + y, (x & 1) ? 2 : 0);
+	};
+
+	s.fillRect(Common::Rect(0, 24 * 8, 320, 25 * 8), 0);
+
+	for (int col = 0; col <= BORDER_RIGHT; ++col)
+		cell(col, BORDER_BOTTOM);
+	for (int col = 1; col < BORDER_RIGHT; ++col)
+		cell(col, BORDER_TOP);
+	for (int row = BORDER_TOP; row <= BORDER_BOTTOM; ++row) {
+		cell(0, row);
+		cell(BORDER_RIGHT, row);
+	}
+}
 
 void MainMenu::draw() {
 	auto s = getSurface();
-	s.clear();
-	s.setColor(COLOR_TEXT);
 
-	s.writeString(Common::Point(11, 8), "R - Return to the View");
-	s.writeString(Common::Point(11, 10), "O - Organize a Party");
-	s.writeString(Common::Point(11, 12), "J - Journey Onward");
+	s.fillRect(Common::Rect(8, 11 * 8, 39 * 8, 23 * 8), 0);
+	drawBorder(s);
+
+	s.writeString(Common::Point(3, 21), "(C)-1983 By James R. Van Artsdalen");
+	s.writeString(Common::Point(13, 22), "and Lord British");
+	s.writeString(Common::Point(7, 11), "From the depths of hell...");
+	s.writeString(Common::Point(7, 12), "...he comes for VENGEANCE!");
+	s.writeString(Common::Point(OPTION_COL, OPTION_ROW), "Option: ");
+	s.writeString(Common::Point(11, 17), "Return to the View");
+	s.writeString(Common::Point(12, 18), "Organize a Party");
+	s.writeString(Common::Point(13, 19), "Journey Onward");
+
+	s.setTextPos(Common::Point(CHOICE_COL, OPTION_ROW));
+	if (_state == CONFIRMING) {
+		const char *word = OPTION_WORDS[_choice];
+		s.writeString(word);
+	}
+	s.writeChar(GLYPH_UP_ARROW);
 }
 
 bool MainMenu::msgKeypress(const KeypressMessage &msg) {
-	switch (msg.keycode) {
-	case Common::KEYCODE_r:
-	case Common::KEYCODE_o:
-	case Common::KEYCODE_j:
-		// Wired up once the roster/party data model and world engine exist
-		break;
-	default:
-		break;
+	if (isModifierKey(msg.keycode))
+		return true;
+
+	if (_state == CONFIRMING) {
+		switch (msg.keycode) {
+		case Common::KEYCODE_RETURN:
+		case Common::KEYCODE_KP_ENTER:
+			// The confirmed option is wired up in later stages
+			break;
+		case Common::KEYCODE_BACKSPACE:
+		case Common::KEYCODE_LEFT:
+			_state = CHOOSING;
+			redraw();
+			break;
+		default:
+			g_engine->playErrorBeep();
+			break;
+		}
+	} else {
+		int option = findOption(msg);
+		if (option >= 0) {
+			_choice = option;
+			_state = CONFIRMING;
+			redraw();
+		} else {
+			g_engine->playErrorBeep();
+		}
 	}
 
 	return true;
diff --git a/engines/ultima/ultima3/views/main_menu.h b/engines/ultima/ultima3/views/main_menu.h
index cd777077154..3c6079157a6 100644
--- a/engines/ultima/ultima3/views/main_menu.h
+++ b/engines/ultima/ultima3/views/main_menu.h
@@ -31,15 +31,30 @@ namespace Views {
 using namespace Graphics::Views;
 
 /**
- * BOOTUP.BIN's main menu: Return to the View / Organize a Party /
- * Journey Onward. The option handlers are wired up as the roster/party
- * data model and the world engine land in later stages.
+ * The main menu: Return to the View / Organize a Party / Journey Onward.
+ * Like the original, it is drawn over whatever the title screen left on the
+ * display. Pressing R, O, J or Escape only echoes the choice on the Option
+ * line; it must then be confirmed with Enter, or taken back with Backspace
+ * or Left. The confirmed options are wired up as the roster/party data
+ * model and the world engine land in later stages.
  */
 class MainMenu : public View {
+private:
+	enum State {
+		CHOOSING,
+		CONFIRMING
+	};
+
+	State _state = CHOOSING;
+	int _choice = 0;
+
+	void drawBorder(GfxSurface &s);
+
 public:
 	MainMenu() : View("MainMenu") {}
 	~MainMenu() override {}
 
+	bool msgFocus(const FocusMessage &msg) override;
 	void draw() override;
 	bool msgKeypress(const KeypressMessage &msg) override;
 };
diff --git a/engines/ultima/ultima3/views/title.cpp b/engines/ultima/ultima3/views/title.cpp
index bd0ac97b383..bfe34bf55da 100644
--- a/engines/ultima/ultima3/views/title.cpp
+++ b/engines/ultima/ultima3/views/title.cpp
@@ -358,6 +358,7 @@ void Title::timeout() {
 
 	case PH_DRAIN:
 		_keyPending = false;
+		draw();
 		showMainMenu();
 		break;
 	}


Commit: 957b72f514c8e37bc521ea10fe453c2f7c38b1e6
    https://github.com/scummvm/scummvm/commit/957b72f514c8e37bc521ea10fe453c2f7c38b1e6
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:41:00+11:00

Commit Message:
ULTIMA: ULTIMA3: Add roster, party organization and character creation

Changed paths:
  A engines/ultima/ultima3/data/roster.h
  A engines/ultima/ultima3/data/savegame.cpp
  A engines/ultima/ultima3/data/savegame.h
  A engines/ultima/ultima3/views/character_details.cpp
  A engines/ultima/ultima3/views/character_details.h
  A engines/ultima/ultima3/views/create_character.cpp
  A engines/ultima/ultima3/views/create_character.h
  A engines/ultima/ultima3/views/disperse_party.cpp
  A engines/ultima/ultima3/views/disperse_party.h
  A engines/ultima/ultima3/views/form_party.cpp
  A engines/ultima/ultima3/views/form_party.h
  A engines/ultima/ultima3/views/journey_onward.cpp
  A engines/ultima/ultima3/views/journey_onward.h
  A engines/ultima/ultima3/views/menu_input.cpp
  A engines/ultima/ultima3/views/menu_input.h
  A engines/ultima/ultima3/views/party_menu.cpp
  A engines/ultima/ultima3/views/party_menu.h
  A engines/ultima/ultima3/views/register.cpp
  A engines/ultima/ultima3/views/register.h
  A engines/ultima/ultima3/views/terminate_character.cpp
  A engines/ultima/ultima3/views/terminate_character.h
  A engines/ultima/ultima3/views/window_view.cpp
  A engines/ultima/ultima3/views/window_view.h
    engines/ultima/module.mk
    engines/ultima/ultima3/data/data.cpp
    engines/ultima/ultima3/data/data.h
    engines/ultima/ultima3/ultima3.h
    engines/ultima/ultima3/views/main_menu.cpp
    engines/ultima/ultima3/views/main_menu.h
    engines/ultima/ultima3/views/views.h


diff --git a/engines/ultima/module.mk b/engines/ultima/module.mk
index a710ec016eb..30961892a19 100644
--- a/engines/ultima/module.mk
+++ b/engines/ultima/module.mk
@@ -163,10 +163,21 @@ MODULE_OBJS += \
 	ultima3/console.o \
 	ultima3/metaengine.o \
 	ultima3/data/data.o \
+	ultima3/data/savegame.o \
 	ultima3/gfx/charset.o \
 	ultima3/gfx/pic_decoder.o \
+	ultima3/views/character_details.o \
+	ultima3/views/create_character.o \
+	ultima3/views/disperse_party.o \
+	ultima3/views/form_party.o \
+	ultima3/views/journey_onward.o \
 	ultima3/views/main_menu.o \
-	ultima3/views/title.o
+	ultima3/views/menu_input.o \
+	ultima3/views/party_menu.o \
+	ultima3/views/register.o \
+	ultima3/views/terminate_character.o \
+	ultima3/views/title.o \
+	ultima3/views/window_view.o
 endif
 
 ifdef ENABLE_ULTIMA4
diff --git a/engines/ultima/ultima3/data/data.cpp b/engines/ultima/ultima3/data/data.cpp
index dfa78af6378..fedfe30c372 100644
--- a/engines/ultima/ultima3/data/data.cpp
+++ b/engines/ultima/ultima3/data/data.cpp
@@ -40,6 +40,35 @@ void setCGAPalette() {
 	g_system->getPaletteManager()->setPalette(palette);
 }
 
+const char SEX_KEYS[] = "MFO";
+const char RACE_KEYS[] = "HEDBF";
+const char CLASS_KEYS[] = "FCWTPLBDIAR";
+const char STATUS_KEYS[] = "GPDA";
+
+const char *const SEX_NAMES[SEX_COUNT] = { "Male", "Female", "Other" };
+const char *const RACE_NAMES[RACE_COUNT] = { "Human", "Elf", "Dwarf", "Bobbit", "Fuzzy" };
+const char *const CLASS_NAMES[CLASS_COUNT] = {
+	"Fighter", "Cleric", "Wizard", "Thief", "Paladin", "Lark", "Barbarian",
+	"Druid", "Illusionist", "Alchemist", "Ranger"
+};
+const char *const STATUS_NAMES[STATUS_COUNT] = { "Good", "Poisoned", "Dead", "Ashes" };
+const char *const WEAPON_NAMES[WEAPON_COUNT] = {
+	"Hand", "Dagger", "Mace", "Sling", "Axe", "Bow", "Sword", "2-H-Swd",
+	"+2 Axe", "+2 Bow", "+2 Swd", "Gloves", "+4 Axe", "+4 Bow", "+4 Swd", "Exotic"
+};
+const char *const ARMOUR_NAMES[ARMOUR_COUNT] = {
+	"Skin", "Cloth", "Leather", "Chain", "Plate", "+2 Chain", "+2 Plate", "Exotic"
+};
+
+int lookupIndex(char key, const char *keys, int count) {
+	for (int i = 0; i < count; ++i) {
+		if (keys[i] == key)
+			return i;
+	}
+
+	return count - 1;
+}
+
 } // namespace Data
 } // namespace Ultima3
 } // namespace Ultima
diff --git a/engines/ultima/ultima3/data/data.h b/engines/ultima/ultima3/data/data.h
index 3cb186e5f1d..3369f2f0435 100644
--- a/engines/ultima/ultima3/data/data.h
+++ b/engines/ultima/ultima3/data/data.h
@@ -34,6 +34,32 @@ extern const byte CGA_PALETTE1[4 * 3];
 
 void setCGAPalette();
 
+// The letters a character's sex, race and class are stored as, with the
+// names shown for each
+constexpr int SEX_COUNT = 3;
+constexpr int RACE_COUNT = 5;
+constexpr int CLASS_COUNT = 11;
+constexpr int STATUS_COUNT = 4;
+constexpr int WEAPON_COUNT = 16;
+constexpr int ARMOUR_COUNT = 8;
+
+extern const char SEX_KEYS[];
+extern const char RACE_KEYS[];
+extern const char CLASS_KEYS[];
+extern const char STATUS_KEYS[];
+extern const char *const SEX_NAMES[SEX_COUNT];
+extern const char *const RACE_NAMES[RACE_COUNT];
+extern const char *const CLASS_NAMES[CLASS_COUNT];
+extern const char *const STATUS_NAMES[STATUS_COUNT];
+extern const char *const WEAPON_NAMES[WEAPON_COUNT];
+extern const char *const ARMOUR_NAMES[ARMOUR_COUNT];
+
+/**
+ * Returns the index of a key within the first count entries of a key list.
+ * As in the original, a key that isn't present maps to the last entry.
+ */
+int lookupIndex(char key, const char *keys, int count);
+
 } // namespace Data
 } // namespace Ultima3
 } // namespace Ultima
diff --git a/engines/ultima/ultima3/data/roster.h b/engines/ultima/ultima3/data/roster.h
new file mode 100644
index 00000000000..7e108e52540
--- /dev/null
+++ b/engines/ultima/ultima3/data/roster.h
@@ -0,0 +1,102 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef ULTIMA3_DATA_ROSTER_H
+#define ULTIMA3_DATA_ROSTER_H
+
+#include "common/scummsys.h"
+
+namespace Ultima {
+namespace Ultima3 {
+namespace Data {
+
+constexpr int ROSTER_COUNT = 20;
+constexpr int PARTY_MAX = 4;
+constexpr int NAME_MAX = 9;
+
+constexpr byte IN_PARTY = 0xFF;
+constexpr byte STATUS_GOOD = 'G';
+constexpr byte STATUS_POISONED = 'P';
+constexpr byte STATUS_DEAD = 'D';
+constexpr byte STATUS_ASHES = 'A';
+
+/**
+ * Converts a value of 0-99 to packed BCD, the form the original stores
+ * attributes, hit points and so on in
+ */
+inline byte toBcd(int value) {
+	return ((value / 10) << 4) | (value % 10);
+}
+
+/**
+ * A character record. Numeric fields hold BCD values, exactly as in the
+ * original, so the same digits are shown when they're printed as hex.
+ */
+struct RosterEntry {
+	char _name[NAME_MAX + 1] = {};
+	byte _marksAndCards = 0;
+	byte _torches = 0;
+	byte _partyMember = 0;
+	byte _status = 0;
+	byte _strength = 0;
+	byte _dexterity = 0;
+	byte _intelligence = 0;
+	byte _wisdom = 0;
+	byte _race = 0;
+	byte _class = 0;
+	byte _sex = 0;
+	byte _magicPoints = 0;
+	uint16 _hitPoints = 0;
+	uint16 _maxHitPoints = 0;
+	uint16 _experience = 0;
+	byte _foodSubCounter = 0;
+	uint16 _food = 0;
+	uint16 _gold = 0;
+	byte _gems = 0;
+	byte _keys = 0;
+	byte _powder = 0;
+	byte _armourIndex = 0;
+	byte _armourOwned[7] = {};
+	byte _weaponIndex = 0;
+	byte _weaponOwned[15] = {};
+
+	void clear() {
+		*this = RosterEntry();
+	}
+
+	bool isEmpty() const {
+		return _name[0] == '\0';
+	}
+
+	bool isInParty() const {
+		return _partyMember == IN_PARTY;
+	}
+
+	bool isAlive() const {
+		return _status == STATUS_GOOD || _status == STATUS_POISONED;
+	}
+};
+
+} // namespace Data
+} // namespace Ultima3
+} // namespace Ultima
+
+#endif
diff --git a/engines/ultima/ultima3/data/savegame.cpp b/engines/ultima/ultima3/data/savegame.cpp
new file mode 100644
index 00000000000..d58495f6ac6
--- /dev/null
+++ b/engines/ultima/ultima3/data/savegame.cpp
@@ -0,0 +1,64 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "ultima/ultima3/data/savegame.h"
+
+namespace Ultima {
+namespace Ultima3 {
+namespace Data {
+
+constexpr byte TRANSPORT_ON_FOOT = 0x3F;
+constexpr byte LOCATION_SOSARIA = 0;
+constexpr byte START_X = 44;
+constexpr byte START_Y = 20;
+
+bool Savegame::hasLivingPartyMember() {
+	for (int i = 0; i < _partySize; ++i) {
+		if (partyMember(i).isAlive())
+			return true;
+	}
+
+	return false;
+}
+
+void Savegame::addToParty(int number) {
+	entry(number)._partyMember = IN_PARTY;
+	_partyEntries[_partySize++] = number;
+}
+
+void Savegame::clearPartySelection() {
+	while (_partySize > 0) {
+		--_partySize;
+		partyMember(_partySize)._partyMember = 0;
+		_partyEntries[_partySize] = 0;
+	}
+}
+
+void Savegame::formParty() {
+	_transport = TRANSPORT_ON_FOOT;
+	_location = LOCATION_SOSARIA;
+	_posX = START_X;
+	_posY = START_Y;
+}
+
+} // namespace Data
+} // namespace Ultima3
+} // namespace Ultima
diff --git a/engines/ultima/ultima3/data/savegame.h b/engines/ultima/ultima3/data/savegame.h
new file mode 100644
index 00000000000..380e8e384dd
--- /dev/null
+++ b/engines/ultima/ultima3/data/savegame.h
@@ -0,0 +1,81 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef ULTIMA3_DATA_SAVEGAME_H
+#define ULTIMA3_DATA_SAVEGAME_H
+
+#include "ultima/ultima3/data/roster.h"
+
+namespace Ultima {
+namespace Ultima3 {
+namespace Data {
+
+/**
+ * The persistent game state: the roster of up to 20 characters, and which
+ * of them (by 1-based roster number) make up the active party.
+ * Party members are referenced in place rather than copied.
+ */
+struct Savegame {
+	RosterEntry _roster[ROSTER_COUNT];
+	byte _partyEntries[PARTY_MAX] = {};
+	int _partySize = 0;
+	byte _transport = 0;
+	byte _location = 0;
+	byte _posX = 0;
+	byte _posY = 0;
+
+	/**
+	 * Returns a roster entry by its 1-based number
+	 */
+	RosterEntry &entry(int number) {
+		return _roster[number - 1];
+	}
+
+	RosterEntry &partyMember(int slot) {
+		return entry(_partyEntries[slot]);
+	}
+
+	/**
+	 * Returns true if any party member is in a condition to adventure
+	 */
+	bool hasLivingPartyMember();
+
+	/**
+	 * Adds a roster entry to the party being selected
+	 */
+	void addToParty(int number);
+
+	/**
+	 * Undoes a partially selected party
+	 */
+	void clearPartySelection();
+
+	/**
+	 * Completes a selected party, placing it at the starting point on foot
+	 */
+	void formParty();
+};
+
+} // namespace Data
+} // namespace Ultima3
+} // namespace Ultima
+
+#endif
diff --git a/engines/ultima/ultima3/ultima3.h b/engines/ultima/ultima3/ultima3.h
index a9be0da34a6..40d18028cfe 100644
--- a/engines/ultima/ultima3/ultima3.h
+++ b/engines/ultima/ultima3/ultima3.h
@@ -31,6 +31,7 @@
 #include "engines/engine.h"
 #include "ultima/detection.h"
 #include "ultima/shared/engine/events.h"
+#include "ultima/ultima3/data/savegame.h"
 
 namespace Audio {
 class PCSpeaker;
@@ -78,6 +79,8 @@ public:
 	 */
 	void playErrorBeep();
 
+	Data::Savegame _savegame;
+
 	// Debug flag toggled by the "intangible" console command, allowing
 	// movement through normally impassable terrain
 	bool _intangible = false;
diff --git a/engines/ultima/ultima3/views/character_details.cpp b/engines/ultima/ultima3/views/character_details.cpp
new file mode 100644
index 00000000000..734c7c59fcc
--- /dev/null
+++ b/engines/ultima/ultima3/views/character_details.cpp
@@ -0,0 +1,115 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "ultima/ultima3/views/character_details.h"
+#include "ultima/ultima3/data/data.h"
+#include "ultima/ultima3/ultima3.h"
+
+namespace Ultima {
+namespace Ultima3 {
+namespace Views {
+
+CharacterDetails::CharacterDetails() : WindowView("CharacterDetails") {
+	_entry.setup(22, 18);
+}
+
+bool CharacterDetails::msgFocus(const FocusMessage &msg) {
+	_state = ENTRY;
+	_entry.reset();
+	return View::msgFocus(msg);
+}
+
+void CharacterDetails::drawDetails(GfxSurface &s) {
+	const Data::RosterEntry &e = _G(savegame).entry(_entry.decimal());
+
+	s.writeString(Common::Point(15, 11), Common::String::format("Entry#%02d", _entry.decimal()));
+	s.writeString(Common::Point(3, 13), Common::String("Name:") + e._name);
+	s.writeString(Common::Point(3, 14), Common::String(" Sex:") +
+		Data::SEX_NAMES[Data::lookupIndex(e._sex, Data::SEX_KEYS, Data::SEX_COUNT)]);
+	s.writeString(Common::Point(3, 15), Common::String("Race:") +
+		Data::RACE_NAMES[Data::lookupIndex(e._race, Data::RACE_KEYS, Data::RACE_COUNT)]);
+	s.writeString(Common::Point(3, 16), Common::String("Type:") +
+		Data::CLASS_NAMES[Data::lookupIndex(e._class, Data::CLASS_KEYS, Data::CLASS_COUNT)]);
+	s.writeString(Common::Point(1, 17), Common::String("Status:") +
+		Data::STATUS_NAMES[Data::lookupIndex(e._status, Data::STATUS_KEYS, Data::STATUS_COUNT)]);
+	s.writeString(Common::Point(1, 19), Common::String("Weapon:") +
+		Data::WEAPON_NAMES[MIN<int>(e._weaponIndex, Data::WEAPON_COUNT - 1)]);
+	s.writeString(Common::Point(1, 20), Common::String("Armour:") +
+		Data::ARMOUR_NAMES[MIN<int>(e._armourIndex, Data::ARMOUR_COUNT - 1)]);
+
+	s.writeString(Common::Point(27, 13), Common::String::format("Strength:%02X", e._strength));
+	s.writeString(Common::Point(26, 14), Common::String::format("Dexterity:%02X", e._dexterity));
+	s.writeString(Common::Point(23, 15), Common::String::format("Intelligence:%02X", e._intelligence));
+	s.writeString(Common::Point(29, 16), Common::String::format("Wisdom:%02X", e._wisdom));
+	s.writeString(Common::Point(23, 18), Common::String::format("Hit points:%04X", e._hitPoints));
+	s.writeString(Common::Point(23, 19), Common::String::format("Experience:%04X", e._experience));
+	s.writeString(Common::Point(29, 20), Common::String::format("Food:%04X", e._food));
+	s.writeString(Common::Point(29, 21), Common::String::format("Gold:%04X", e._gold));
+}
+
+void CharacterDetails::draw() {
+	auto s = getSurface();
+	clearWindow(s);
+
+	if (_state == DETAILS) {
+		drawDetails(s);
+	} else {
+		s.writeString(Common::Point(10, 15), "Look at a Character");
+		s.writeString(Common::Point(16, 18), "Entry#");
+		_entry.draw(s, _state == ENTRY);
+
+		if (_state == MESSAGE)
+			s.writeString(Common::Point(_messageCol, 21), _message);
+	}
+
+	if (_state != ENTRY)
+		drawSpacePrompt(s);
+}
+
+bool CharacterDetails::msgKeypress(const KeypressMessage &msg) {
+	if (_state == ENTRY) {
+		if (_entry.handleKey(msg)) {
+			int number = _entry.decimal();
+
+			if (number < 1 || number > Data::ROSTER_COUNT) {
+				_state = MESSAGE;
+				_message = "(1-20 Only!)";
+				_messageCol = 14;
+			} else if (_G(savegame).entry(number).isEmpty()) {
+				_state = MESSAGE;
+				_message = "(No one there)";
+				_messageCol = 13;
+			} else {
+				_state = DETAILS;
+			}
+		}
+
+		redraw();
+	} else if (isSpaceKey(msg)) {
+		close();
+	}
+
+	return true;
+}
+
+} // namespace Views
+} // namespace Ultima3
+} // namespace Ultima
diff --git a/engines/ultima/ultima3/views/character_details.h b/engines/ultima/ultima3/views/character_details.h
new file mode 100644
index 00000000000..a4f156a1546
--- /dev/null
+++ b/engines/ultima/ultima3/views/character_details.h
@@ -0,0 +1,63 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef ULTIMA3_VIEWS_CHARACTER_DETAILS_H
+#define ULTIMA3_VIEWS_CHARACTER_DETAILS_H
+
+#include "ultima/ultima3/views/menu_input.h"
+#include "ultima/ultima3/views/window_view.h"
+
+namespace Ultima {
+namespace Ultima3 {
+namespace Views {
+
+/**
+ * Prompts for a roster entry number and shows that character's details
+ */
+class CharacterDetails : public WindowView {
+private:
+	enum State {
+		ENTRY,
+		MESSAGE,
+		DETAILS
+	};
+
+	State _state = ENTRY;
+	NumberInput _entry;
+	const char *_message = nullptr;
+	int _messageCol = 0;
+
+	void drawDetails(GfxSurface &s);
+
+public:
+	CharacterDetails();
+	~CharacterDetails() override {}
+
+	bool msgFocus(const FocusMessage &msg) override;
+	void draw() override;
+	bool msgKeypress(const KeypressMessage &msg) override;
+};
+
+} // namespace Views
+} // namespace Ultima3
+} // namespace Ultima
+
+#endif
diff --git a/engines/ultima/ultima3/views/create_character.cpp b/engines/ultima/ultima3/views/create_character.cpp
new file mode 100644
index 00000000000..f20e617c86a
--- /dev/null
+++ b/engines/ultima/ultima3/views/create_character.cpp
@@ -0,0 +1,233 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "common/util.h"
+#include "ultima/ultima3/views/create_character.h"
+#include "ultima/ultima3/data/data.h"
+#include "ultima/ultima3/ultima3.h"
+
+namespace Ultima {
+namespace Ultima3 {
+namespace Views {
+
+constexpr int STARTING_POINTS = 50;
+constexpr int ATTRIBUTE_MIN = 5;
+constexpr int ATTRIBUTE_MAX = 25;
+constexpr int FIELD_COL = 19;
+constexpr uint16 STARTING_VALUE = 0x150;
+
+static const char *const ATTRIBUTE_LABELS[4] = {
+	"Strength........", "Dexterity.......", "Intelligence....", "Wisdom.........."
+};
+static const char *const YES_NO_WORDS[2] = { "Yes", "No" };
+
+CreateCharacter::CreateCharacter() : WindowView("CreateCharacter") {
+	_entry.setup(22, 18);
+	_name.setup(Data::NAME_MAX, FIELD_COL, 13);
+	_sex.setup(Data::SEX_KEYS, Data::SEX_NAMES, Data::SEX_COUNT, FIELD_COL, 14);
+	_race.setup(Data::RACE_KEYS, Data::RACE_NAMES, Data::RACE_COUNT, FIELD_COL, 15);
+	_class.setup(Data::CLASS_KEYS, Data::CLASS_NAMES, Data::CLASS_COUNT, FIELD_COL, 16);
+	_confirm.setup("YN", YES_NO_WORDS, 2, FIELD_COL, 21);
+
+	for (int i = 0; i < 4; ++i)
+		_attributes[i].setup(27, 17 + i);
+}
+
+bool CreateCharacter::msgFocus(const FocusMessage &msg) {
+	_state = ENTRY;
+	_showForm = false;
+	_entry.reset();
+	_name.reset();
+	_sex.reset();
+	_race.reset();
+	_class.reset();
+	_confirm.reset();
+
+	for (int i = 0; i < 4; ++i)
+		_attributes[i].reset();
+
+	return View::msgFocus(msg);
+}
+
+void CreateCharacter::drawForm(GfxSurface &s) {
+	s.writeString(Common::Point(11, 11), Common::String::format("Entry#%02d", _number));
+	s.writeString(Common::Point(20, 11), Common::String::format("Points:%02d", _points));
+	s.writeString(Common::Point(14, 13), "Name:");
+	s.writeString(Common::Point(14, 14), " Sex:");
+	s.writeString(Common::Point(14, 15), "Race:");
+	s.writeString(Common::Point(14, 16), "Type:");
+	s.writeString(Common::Point(14, 21), "O.K.?");
+
+	for (int i = 0; i < 4; ++i)
+		s.writeString(Common::Point(11, 17 + i), ATTRIBUTE_LABELS[i]);
+
+	_name.draw(s, _state == NAME);
+	_sex.draw(s, _state == SEX);
+	_race.draw(s, _state == RACE);
+	_class.draw(s, _state == CLASS);
+	_confirm.draw(s, _state == CONFIRM);
+
+	for (int i = 0; i < 4; ++i)
+		_attributes[i].draw(s, _state == ATTRIBUTE && _attribute == i);
+}
+
+void CreateCharacter::draw() {
+	auto s = getSurface();
+	clearWindow(s);
+
+	if (_showForm) {
+		drawForm(s);
+	} else {
+		s.writeString(Common::Point(17, 15), "Create");
+		s.writeString(Common::Point(16, 18), "Entry#");
+		_entry.draw(s, _state == ENTRY);
+
+		if (_state == MESSAGE)
+			s.writeString(Common::Point(14, 21), _message);
+	}
+
+	if (_state == MESSAGE || _state == FINISHED)
+		drawSpacePrompt(s);
+}
+
+bool CreateCharacter::acceptAttribute(int value) {
+	if (value < ATTRIBUTE_MIN || value > ATTRIBUTE_MAX)
+		return false;
+
+	// The points left have to cover the minimum for the attributes still to
+	// come, with the last one only needing to fit within what's left
+	int remaining = _points - value;
+	switch (_attribute) {
+	case 1:
+		if (remaining < 10)
+			return false;
+		break;
+	case 2:
+		if (remaining < ATTRIBUTE_MIN)
+			return false;
+		break;
+	case 3:
+		if (remaining < 0)
+			return false;
+		break;
+	default:
+		break;
+	}
+
+	_values[_attribute] = value;
+	_points = remaining;
+	return true;
+}
+
+void CreateCharacter::createCharacter() {
+	Data::RosterEntry &e = _G(savegame).entry(_number);
+	e.clear();
+
+	Common::strlcpy(e._name, _name.text().c_str(), sizeof(e._name));
+	e._sex = _sex.key();
+	e._race = _race.key();
+	e._class = _class.key();
+	e._strength = Data::toBcd(_values[0]);
+	e._dexterity = Data::toBcd(_values[1]);
+	e._intelligence = Data::toBcd(_values[2]);
+	e._wisdom = Data::toBcd(_values[3]);
+	e._status = Data::STATUS_GOOD;
+	e._hitPoints = e._maxHitPoints = e._food = e._gold = STARTING_VALUE;
+	e._weaponOwned[0] = 1;
+	e._armourOwned[0] = 1;
+}
+
+bool CreateCharacter::msgKeypress(const KeypressMessage &msg) {
+	switch (_state) {
+	case ENTRY:
+		if (_entry.handleKey(msg)) {
+			int number = _entry.decimal();
+
+			if (number < 1 || number > Data::ROSTER_COUNT) {
+				_state = MESSAGE;
+				_message = "(1-20 Only!)";
+			} else if (!_G(savegame).entry(number).isEmpty()) {
+				_state = MESSAGE;
+				_message = "(Not Empty!)";
+			} else {
+				_number = number;
+				_points = STARTING_POINTS;
+				_showForm = true;
+				_state = NAME;
+			}
+		}
+		break;
+
+	case NAME:
+		if (_name.handleKey(msg))
+			_state = _name.text().empty() ? FINISHED : SEX;
+		break;
+
+	case SEX:
+		if (_sex.handleKey(msg))
+			_state = RACE;
+		break;
+
+	case RACE:
+		if (_race.handleKey(msg))
+			_state = CLASS;
+		break;
+
+	case CLASS:
+		if (_class.handleKey(msg)) {
+			_attribute = 0;
+			_state = ATTRIBUTE;
+		}
+		break;
+
+	case ATTRIBUTE:
+		if (_attributes[_attribute].handleKey(msg)) {
+			if (acceptAttribute(_attributes[_attribute].decimal())) {
+				if (++_attribute == 4)
+					_state = CONFIRM;
+			} else {
+				_attributes[_attribute].reset();
+			}
+		}
+		break;
+
+	case CONFIRM:
+		if (_confirm.handleKey(msg)) {
+			if (_confirm.key() == 'Y')
+				createCharacter();
+			_state = FINISHED;
+		}
+		break;
+
+	case MESSAGE:
+	case FINISHED:
+		if (isSpaceKey(msg))
+			close();
+		break;
+	}
+
+	redraw();
+	return true;
+}
+
+} // namespace Views
+} // namespace Ultima3
+} // namespace Ultima
diff --git a/engines/ultima/ultima3/views/create_character.h b/engines/ultima/ultima3/views/create_character.h
new file mode 100644
index 00000000000..2182f18a127
--- /dev/null
+++ b/engines/ultima/ultima3/views/create_character.h
@@ -0,0 +1,79 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef ULTIMA3_VIEWS_CREATE_CHARACTER_H
+#define ULTIMA3_VIEWS_CREATE_CHARACTER_H
+
+#include "ultima/ultima3/views/menu_input.h"
+#include "ultima/ultima3/views/window_view.h"
+
+namespace Ultima {
+namespace Ultima3 {
+namespace Views {
+
+/**
+ * Creates a character in an empty roster slot: name, sex, race and class,
+ * then four attributes drawn from a pool of 50 points
+ */
+class CreateCharacter : public WindowView {
+private:
+	enum State {
+		ENTRY,
+		MESSAGE,
+		NAME,
+		SEX,
+		RACE,
+		CLASS,
+		ATTRIBUTE,
+		CONFIRM,
+		FINISHED
+	};
+
+	State _state = ENTRY;
+	NumberInput _entry;
+	LineInput _name;
+	MenuChoice _sex, _race, _class, _confirm;
+	NumberInput _attributes[4];
+	int _attribute = 0;
+	int _values[4] = {};
+	int _points = 0;
+	int _number = 0;
+	bool _showForm = false;
+	const char *_message = nullptr;
+
+	void drawForm(GfxSurface &s);
+	bool acceptAttribute(int value);
+	void createCharacter();
+
+public:
+	CreateCharacter();
+	~CreateCharacter() override {}
+
+	bool msgFocus(const FocusMessage &msg) override;
+	void draw() override;
+	bool msgKeypress(const KeypressMessage &msg) override;
+};
+
+} // namespace Views
+} // namespace Ultima3
+} // namespace Ultima
+
+#endif
diff --git a/engines/ultima/ultima3/views/disperse_party.cpp b/engines/ultima/ultima3/views/disperse_party.cpp
new file mode 100644
index 00000000000..efa8f6b11fb
--- /dev/null
+++ b/engines/ultima/ultima3/views/disperse_party.cpp
@@ -0,0 +1,60 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "ultima/ultima3/views/disperse_party.h"
+#include "ultima/ultima3/ultima3.h"
+
+namespace Ultima {
+namespace Ultima3 {
+namespace Views {
+
+bool DisperseParty::msgFocus(const FocusMessage &msg) {
+	Data::Savegame &save = _G(savegame);
+
+	_hadParty = save._partySize != 0;
+	save.clearPartySelection();
+
+	return View::msgFocus(msg);
+}
+
+void DisperseParty::draw() {
+	auto s = getSurface();
+	clearWindow(s);
+
+	s.writeString(Common::Point(11, 17), "Disperse the Party");
+
+	if (_hadParty)
+		s.writeString(Common::Point(14, 19), "(Dispersed!)");
+	else
+		s.writeString(Common::Point(15, 20), "(No Party)");
+
+	drawSpacePrompt(s);
+}
+
+bool DisperseParty::msgKeypress(const KeypressMessage &msg) {
+	if (isSpaceKey(msg))
+		close();
+	return true;
+}
+
+} // namespace Views
+} // namespace Ultima3
+} // namespace Ultima
diff --git a/engines/ultima/ultima3/views/disperse_party.h b/engines/ultima/ultima3/views/disperse_party.h
new file mode 100644
index 00000000000..fe8fa429841
--- /dev/null
+++ b/engines/ultima/ultima3/views/disperse_party.h
@@ -0,0 +1,52 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef ULTIMA3_VIEWS_DISPERSE_PARTY_H
+#define ULTIMA3_VIEWS_DISPERSE_PARTY_H
+
+#include "ultima/ultima3/views/window_view.h"
+
+namespace Ultima {
+namespace Ultima3 {
+namespace Views {
+
+/**
+ * Breaks up the party as soon as it's shown, returning its members to the
+ * roster
+ */
+class DisperseParty : public WindowView {
+private:
+	bool _hadParty = false;
+
+public:
+	DisperseParty() : WindowView("DisperseParty") {}
+	~DisperseParty() override {}
+
+	bool msgFocus(const FocusMessage &msg) override;
+	void draw() override;
+	bool msgKeypress(const KeypressMessage &msg) override;
+};
+
+} // namespace Views
+} // namespace Ultima3
+} // namespace Ultima
+
+#endif
diff --git a/engines/ultima/ultima3/views/form_party.cpp b/engines/ultima/ultima3/views/form_party.cpp
new file mode 100644
index 00000000000..aa931f405d0
--- /dev/null
+++ b/engines/ultima/ultima3/views/form_party.cpp
@@ -0,0 +1,124 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "ultima/ultima3/views/form_party.h"
+#include "ultima/ultima3/ultima3.h"
+
+namespace Ultima {
+namespace Ultima3 {
+namespace Views {
+
+FormParty::FormParty() : WindowView("FormParty") {
+	for (int i = 0; i < Data::PARTY_MAX; ++i)
+		_numbers[i].setup(24, 16 + i);
+}
+
+bool FormParty::msgFocus(const FocusMessage &msg) {
+	for (int i = 0; i < Data::PARTY_MAX; ++i)
+		_numbers[i].reset();
+
+	if (_G(savegame)._partySize != 0) {
+		_showSelection = false;
+		showMessage("(Party in Use)", 13, 16);
+	} else {
+		_showSelection = true;
+		_state = ENTRY;
+	}
+
+	return View::msgFocus(msg);
+}
+
+void FormParty::showMessage(const char *message, int col, int row) {
+	_state = MESSAGE;
+	_message = message;
+	_messageCol = col;
+	_messageRow = row;
+}
+
+void FormParty::fail(const char *message) {
+	_G(savegame).clearPartySelection();
+	showMessage(message, 13, 21);
+}
+
+void FormParty::finish() {
+	if (_G(savegame)._partySize == 0) {
+		fail("(No one there)");
+	} else {
+		_G(savegame).formParty();
+		showMessage("(Formed)", 16, 21);
+	}
+}
+
+void FormParty::draw() {
+	auto s = getSurface();
+	clearWindow(s);
+
+	s.writeString(Common::Point(13, 13), "Form the Party");
+
+	if (_showSelection) {
+		for (int i = 0; i < Data::PARTY_MAX; ++i) {
+			s.writeString(Common::Point(15, 16 + i), Common::String::format("Player-%d-", i + 1));
+			_numbers[i].draw(s, _state == ENTRY && i == _G(savegame)._partySize);
+		}
+	}
+
+	if (_state == MESSAGE) {
+		s.writeString(Common::Point(_messageCol, _messageRow), _message);
+		drawSpacePrompt(s);
+	}
+}
+
+bool FormParty::msgKeypress(const KeypressMessage &msg) {
+	if (_state == MESSAGE) {
+		if (isSpaceKey(msg))
+			close();
+		return true;
+	}
+
+	Data::Savegame &save = _G(savegame);
+	NumberInput &input = _numbers[save._partySize];
+
+	if (input.handleKey(msg)) {
+		int number = input.decimal();
+
+		if (number > Data::ROSTER_COUNT) {
+			fail("(No one there)");
+		} else if (number == 0) {
+			finish();
+		} else if (save.entry(number).isEmpty()) {
+			fail("(No one there)");
+		} else if (save.entry(number).isInParty()) {
+			fail("Already Selected");
+		} else {
+			save.addToParty(number);
+
+			if (save._partySize == Data::PARTY_MAX)
+				finish();
+		}
+	}
+
+	redraw();
+	return true;
+}
+
+} // namespace Views
+} // namespace Ultima3
+} // namespace Ultima
diff --git a/engines/ultima/ultima3/views/form_party.h b/engines/ultima/ultima3/views/form_party.h
new file mode 100644
index 00000000000..b7f9823d565
--- /dev/null
+++ b/engines/ultima/ultima3/views/form_party.h
@@ -0,0 +1,67 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef ULTIMA3_VIEWS_FORM_PARTY_H
+#define ULTIMA3_VIEWS_FORM_PARTY_H
+
+#include "ultima/ultima3/data/roster.h"
+#include "ultima/ultima3/views/menu_input.h"
+#include "ultima/ultima3/views/window_view.h"
+
+namespace Ultima {
+namespace Ultima3 {
+namespace Views {
+
+/**
+ * Selects up to four roster characters to form the party. Entering 0 ends
+ * the selection early
+ */
+class FormParty : public WindowView {
+private:
+	enum State {
+		ENTRY,
+		MESSAGE
+	};
+
+	State _state = ENTRY;
+	NumberInput _numbers[Data::PARTY_MAX];
+	bool _showSelection = true;
+	const char *_message = nullptr;
+	int _messageCol = 0, _messageRow = 0;
+
+	void showMessage(const char *message, int col, int row);
+	void fail(const char *message);
+	void finish();
+
+public:
+	FormParty();
+	~FormParty() override {}
+
+	bool msgFocus(const FocusMessage &msg) override;
+	void draw() override;
+	bool msgKeypress(const KeypressMessage &msg) override;
+};
+
+} // namespace Views
+} // namespace Ultima3
+} // namespace Ultima
+
+#endif
diff --git a/engines/ultima/ultima3/views/journey_onward.cpp b/engines/ultima/ultima3/views/journey_onward.cpp
new file mode 100644
index 00000000000..c4217c69b07
--- /dev/null
+++ b/engines/ultima/ultima3/views/journey_onward.cpp
@@ -0,0 +1,49 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "ultima/ultima3/views/journey_onward.h"
+#include "ultima/ultima3/ultima3.h"
+
+namespace Ultima {
+namespace Ultima3 {
+namespace Views {
+
+void JourneyOnward::draw() {
+	auto s = getSurface();
+	clearWindow(s);
+
+	if (_G(savegame)._partySize == 0)
+		s.writeString(Common::Point(15, 21), "(No Party)");
+	else
+		s.writeString(Common::Point(9, 21), "(No Active Players)");
+
+	drawSpacePrompt(s);
+}
+
+bool JourneyOnward::msgKeypress(const KeypressMessage &msg) {
+	if (isSpaceKey(msg))
+		close();
+	return true;
+}
+
+} // namespace Views
+} // namespace Ultima3
+} // namespace Ultima
diff --git a/engines/ultima/ultima3/views/journey_onward.h b/engines/ultima/ultima3/views/journey_onward.h
new file mode 100644
index 00000000000..77a0a6f9fe4
--- /dev/null
+++ b/engines/ultima/ultima3/views/journey_onward.h
@@ -0,0 +1,48 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef ULTIMA3_VIEWS_JOURNEY_ONWARD_H
+#define ULTIMA3_VIEWS_JOURNEY_ONWARD_H
+
+#include "ultima/ultima3/views/window_view.h"
+
+namespace Ultima {
+namespace Ultima3 {
+namespace Views {
+
+/**
+ * Explains why the party can't set out yet: there isn't one, or none of its
+ * members are fit to travel
+ */
+class JourneyOnward : public WindowView {
+public:
+	JourneyOnward() : WindowView("JourneyOnward") {}
+	~JourneyOnward() override {}
+
+	void draw() override;
+	bool msgKeypress(const KeypressMessage &msg) override;
+};
+
+} // namespace Views
+} // namespace Ultima3
+} // namespace Ultima
+
+#endif
diff --git a/engines/ultima/ultima3/views/main_menu.cpp b/engines/ultima/ultima3/views/main_menu.cpp
index 85207f2e4b3..bea5a9687c7 100644
--- a/engines/ultima/ultima3/views/main_menu.cpp
+++ b/engines/ultima/ultima3/views/main_menu.cpp
@@ -19,7 +19,6 @@
  *
  */
 
-#include "common/keyboard.h"
 #include "ultima/ultima3/views/main_menu.h"
 #include "ultima/ultima3/ultima3.h"
 
@@ -27,132 +26,55 @@ namespace Ultima {
 namespace Ultima3 {
 namespace Views {
 
-constexpr int GLYPH_UP_ARROW = 0x1E;
-constexpr int BORDER_TOP = 10;
-constexpr int BORDER_BOTTOM = 23;
-constexpr int BORDER_RIGHT = 39;
-constexpr int OPTION_ROW = 15;
-constexpr int OPTION_COL = 16;
-constexpr int CHOICE_COL = 23;
-
-// Letter keys for each option, with Escape (the last) acting as Return
-static const char OPTION_KEYS[] = { 'R', 'O', 'J' };
+// Escape (the last key) acts as Return
+static const char OPTION_KEYS[] = "ROJ\x1B";
 static const char *const OPTION_WORDS[] = { "Return", "Organize", "Journey", "Return" };
-constexpr int OPTION_ESCAPE = 3;
-
-static bool isModifierKey(Common::KeyCode key) {
-	switch (key) {
-	case Common::KEYCODE_LSHIFT:
-	case Common::KEYCODE_RSHIFT:
-	case Common::KEYCODE_LCTRL:
-	case Common::KEYCODE_RCTRL:
-	case Common::KEYCODE_LALT:
-	case Common::KEYCODE_RALT:
-	case Common::KEYCODE_LMETA:
-	case Common::KEYCODE_RMETA:
-	case Common::KEYCODE_CAPSLOCK:
-	case Common::KEYCODE_NUMLOCK:
-	case Common::KEYCODE_SCROLLOCK:
-		return true;
-	default:
-		return false;
-	}
-}
-
-static int findOption(const KeypressMessage &msg) {
-	if (msg.keycode == Common::KEYCODE_ESCAPE)
-		return OPTION_ESCAPE;
-
-	char c = msg.ascii;
-	if (c >= 'a' && c <= 'z')
-		c -= 'a' - 'A';
-
-	for (int i = 0; i < ARRAYSIZE(OPTION_KEYS); ++i) {
-		if (OPTION_KEYS[i] == c)
-			return i;
-	}
 
-	return -1;
+MainMenu::MainMenu() : WindowView("MainMenu") {
+	_choice.setup(OPTION_KEYS, OPTION_WORDS, 4, 23, 15);
 }
 
 bool MainMenu::msgFocus(const FocusMessage &msg) {
-	_state = CHOOSING;
+	_choice.reset();
 	return View::msgFocus(msg);
 }
 
-void MainMenu::drawBorder(GfxSurface &s) {
-	// Alternating black and magenta pixels, filling whole 8x8 cells
-	auto cell = [&](int col, int row) {
-		for (int y = 0; y < 8; ++y)
-			for (int x = 0; x < 8; ++x)
-				s.setPixel(col * 8 + x, row * 8 + y, (x & 1) ? 2 : 0);
-	};
-
-	s.fillRect(Common::Rect(0, 24 * 8, 320, 25 * 8), 0);
-
-	for (int col = 0; col <= BORDER_RIGHT; ++col)
-		cell(col, BORDER_BOTTOM);
-	for (int col = 1; col < BORDER_RIGHT; ++col)
-		cell(col, BORDER_TOP);
-	for (int row = BORDER_TOP; row <= BORDER_BOTTOM; ++row) {
-		cell(0, row);
-		cell(BORDER_RIGHT, row);
-	}
-}
-
 void MainMenu::draw() {
 	auto s = getSurface();
 
-	s.fillRect(Common::Rect(8, 11 * 8, 39 * 8, 23 * 8), 0);
+	clearWindow(s);
 	drawBorder(s);
 
 	s.writeString(Common::Point(3, 21), "(C)-1983 By James R. Van Artsdalen");
 	s.writeString(Common::Point(13, 22), "and Lord British");
 	s.writeString(Common::Point(7, 11), "From the depths of hell...");
 	s.writeString(Common::Point(7, 12), "...he comes for VENGEANCE!");
-	s.writeString(Common::Point(OPTION_COL, OPTION_ROW), "Option: ");
+	s.writeString(Common::Point(16, 15), "Option: ");
 	s.writeString(Common::Point(11, 17), "Return to the View");
 	s.writeString(Common::Point(12, 18), "Organize a Party");
 	s.writeString(Common::Point(13, 19), "Journey Onward");
 
-	s.setTextPos(Common::Point(CHOICE_COL, OPTION_ROW));
-	if (_state == CONFIRMING) {
-		const char *word = OPTION_WORDS[_choice];
-		s.writeString(word);
-	}
-	s.writeChar(GLYPH_UP_ARROW);
+	_choice.draw(s, true);
 }
 
 bool MainMenu::msgKeypress(const KeypressMessage &msg) {
-	if (isModifierKey(msg.keycode))
-		return true;
-
-	if (_state == CONFIRMING) {
-		switch (msg.keycode) {
-		case Common::KEYCODE_RETURN:
-		case Common::KEYCODE_KP_ENTER:
-			// The confirmed option is wired up in later stages
+	if (_choice.handleKey(msg)) {
+		switch (_choice.key()) {
+		case 'O':
+			addView("PartyMenu");
 			break;
-		case Common::KEYCODE_BACKSPACE:
-		case Common::KEYCODE_LEFT:
-			_state = CHOOSING;
-			redraw();
+		case 'J':
+			// Setting out is wired up once the world engine lands
+			if (_G(savegame)._partySize == 0 || !_G(savegame).hasLivingPartyMember())
+				addView("JourneyOnward");
 			break;
 		default:
-			g_engine->playErrorBeep();
+			// Returning to the view is wired up once the world engine lands
 			break;
 		}
-	} else {
-		int option = findOption(msg);
-		if (option >= 0) {
-			_choice = option;
-			_state = CONFIRMING;
-			redraw();
-		} else {
-			g_engine->playErrorBeep();
-		}
 	}
 
+	redraw();
 	return true;
 }
 
diff --git a/engines/ultima/ultima3/views/main_menu.h b/engines/ultima/ultima3/views/main_menu.h
index 3c6079157a6..d9494e0a8a9 100644
--- a/engines/ultima/ultima3/views/main_menu.h
+++ b/engines/ultima/ultima3/views/main_menu.h
@@ -22,36 +22,24 @@
 #ifndef ULTIMA3_VIEWS_MAIN_MENU_H
 #define ULTIMA3_VIEWS_MAIN_MENU_H
 
-#include "graphics/views/view.h"
+#include "ultima/ultima3/views/menu_input.h"
+#include "ultima/ultima3/views/window_view.h"
 
 namespace Ultima {
 namespace Ultima3 {
 namespace Views {
 
-using namespace Graphics::Views;
-
 /**
  * The main menu: Return to the View / Organize a Party / Journey Onward.
  * Like the original, it is drawn over whatever the title screen left on the
- * display. Pressing R, O, J or Escape only echoes the choice on the Option
- * line; it must then be confirmed with Enter, or taken back with Backspace
- * or Left. The confirmed options are wired up as the roster/party data
- * model and the world engine land in later stages.
+ * display. Choosing Return is wired up once the world engine lands.
  */
-class MainMenu : public View {
+class MainMenu : public WindowView {
 private:
-	enum State {
-		CHOOSING,
-		CONFIRMING
-	};
-
-	State _state = CHOOSING;
-	int _choice = 0;
-
-	void drawBorder(GfxSurface &s);
+	MenuChoice _choice;
 
 public:
-	MainMenu() : View("MainMenu") {}
+	MainMenu();
 	~MainMenu() override {}
 
 	bool msgFocus(const FocusMessage &msg) override;
diff --git a/engines/ultima/ultima3/views/menu_input.cpp b/engines/ultima/ultima3/views/menu_input.cpp
new file mode 100644
index 00000000000..734a8635738
--- /dev/null
+++ b/engines/ultima/ultima3/views/menu_input.cpp
@@ -0,0 +1,206 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "ultima/ultima3/views/menu_input.h"
+#include "ultima/ultima3/ultima3.h"
+
+namespace Ultima {
+namespace Ultima3 {
+namespace Views {
+
+bool isModifierKey(Common::KeyCode key) {
+	switch (key) {
+	case Common::KEYCODE_LSHIFT:
+	case Common::KEYCODE_RSHIFT:
+	case Common::KEYCODE_LCTRL:
+	case Common::KEYCODE_RCTRL:
+	case Common::KEYCODE_LALT:
+	case Common::KEYCODE_RALT:
+	case Common::KEYCODE_LMETA:
+	case Common::KEYCODE_RMETA:
+	case Common::KEYCODE_CAPSLOCK:
+	case Common::KEYCODE_NUMLOCK:
+	case Common::KEYCODE_SCROLLOCK:
+		return true;
+	default:
+		return false;
+	}
+}
+
+static bool isEnterKey(Common::KeyCode key) {
+	return key == Common::KEYCODE_RETURN || key == Common::KEYCODE_KP_ENTER;
+}
+
+static bool isEraseKey(Common::KeyCode key) {
+	return key == Common::KEYCODE_BACKSPACE || key == Common::KEYCODE_LEFT;
+}
+
+/*------------------------------------------------------------------------*/
+
+void MenuChoice::setup(const char *keys, const char *const *words, int count, int col, int row) {
+	_keys = keys;
+	_words = words;
+	_count = count;
+	_col = col;
+	_row = row;
+	_choice = -1;
+}
+
+bool MenuChoice::handleKey(const KeypressMessage &msg) {
+	if (isModifierKey(msg.keycode))
+		return false;
+
+	if (_choice >= 0) {
+		if (isEnterKey(msg.keycode))
+			return true;
+
+		if (isEraseKey(msg.keycode))
+			_choice = -1;
+		else
+			g_engine->playErrorBeep();
+		return false;
+	}
+
+	char c = 0;
+	if (msg.keycode == Common::KEYCODE_ESCAPE) {
+		c = 0x1B;
+	} else if (msg.ascii > 0 && msg.ascii < 0x80) {
+		c = msg.ascii;
+		if (c >= 'a' && c <= 'z')
+			c -= 'a' - 'A';
+	}
+
+	for (int i = 0; c && i < _count; ++i) {
+		if (_keys[i] == c) {
+			_choice = i;
+			return false;
+		}
+	}
+
+	g_engine->playErrorBeep();
+	return false;
+}
+
+void MenuChoice::draw(GfxSurface &s, bool active) const {
+	int col = _col;
+
+	if (_choice >= 0) {
+		const Common::String word(_words[_choice]);
+		s.writeString(Common::Point(_col, _row), word);
+		col += word.size();
+	}
+
+	if (active) {
+		s.setTextPos(Common::Point(col, _row));
+		s.writeChar(GLYPH_UP_ARROW);
+	}
+}
+
+/*------------------------------------------------------------------------*/
+
+void LineInput::setup(uint maxLength, int col, int row) {
+	_maxLength = maxLength;
+	_col = col;
+	_row = row;
+	_text.clear();
+}
+
+bool LineInput::handleKey(const KeypressMessage &msg) {
+	if (isModifierKey(msg.keycode))
+		return false;
+
+	if (isEnterKey(msg.keycode))
+		return true;
+
+	if (isEraseKey(msg.keycode)) {
+		if (_text.empty())
+			g_engine->playErrorBeep();
+		else
+			_text.deleteLastChar();
+	} else if (msg.keycode != Common::KEYCODE_DELETE && msg.ascii >= 0x20 && msg.ascii < 0x80 &&
+			_text.size() < _maxLength) {
+		_text += (char)msg.ascii;
+	} else {
+		g_engine->playErrorBeep();
+	}
+
+	return false;
+}
+
+void LineInput::draw(GfxSurface &s, bool active) const {
+	s.writeString(Common::Point(_col, _row), _text);
+
+	if (active) {
+		s.setTextPos(Common::Point(_col + _text.size(), _row));
+		s.writeChar(GLYPH_UP_ARROW);
+	}
+}
+
+/*------------------------------------------------------------------------*/
+
+bool NumberInput::handleKey(const KeypressMessage &msg) {
+	if (!LineInput::handleKey(msg))
+		return false;
+
+	// Leading spaces are skipped, and digits are read until the first
+	// non-digit. Hex letters are read too, but can't form a decimal number
+	uint i = 0;
+	while (i < _text.size() && _text[i] == ' ')
+		++i;
+
+	uint16 hex = 0;
+	int decimal = 0, digits = 0;
+	bool isDecimal = true;
+
+	for (; i < _text.size(); ++i, ++digits) {
+		char c = _text[i];
+		int nibble;
+
+		if (c >= '0' && c <= '9')
+			nibble = c - '0';
+		else if (c >= 'A' && c <= 'F')
+			nibble = c - 'A' + 10;
+		else if (c >= 'a' && c <= 'f')
+			nibble = c - 'a' + 10;
+		else
+			break;
+
+		hex = (hex << 4) | nibble;
+		if (nibble > 9)
+			isDecimal = false;
+		else
+			decimal = decimal * 10 + nibble;
+	}
+
+	if (digits == 0 || !isDecimal) {
+		g_engine->playErrorBeep();
+		_text.clear();
+		return false;
+	}
+
+	_bcd = hex & 0xFF;
+	_decimal = decimal;
+	return true;
+}
+
+} // namespace Views
+} // namespace Ultima3
+} // namespace Ultima
diff --git a/engines/ultima/ultima3/views/menu_input.h b/engines/ultima/ultima3/views/menu_input.h
new file mode 100644
index 00000000000..ec7de836a1c
--- /dev/null
+++ b/engines/ultima/ultima3/views/menu_input.h
@@ -0,0 +1,150 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef ULTIMA3_VIEWS_MENU_INPUT_H
+#define ULTIMA3_VIEWS_MENU_INPUT_H
+
+#include "common/keyboard.h"
+#include "common/str.h"
+#include "graphics/views/view.h"
+
+namespace Ultima {
+namespace Ultima3 {
+namespace Views {
+
+using namespace Graphics::Views;
+
+constexpr int GLYPH_UP_ARROW = 0x1E;
+
+/**
+ * Returns true for keys that are only a modifier being pressed
+ */
+bool isModifierKey(Common::KeyCode key);
+
+/**
+ * A menu prompt. Pressing one of the option keys only echoes the matching
+ * word; it then has to be confirmed with Enter, or taken back with
+ * Backspace or Left. Anything else is rejected with a beep.
+ */
+class MenuChoice {
+private:
+	const char *_keys = nullptr;
+	const char *const *_words = nullptr;
+	int _count = 0;
+	int _col = 0, _row = 0;
+	int _choice = -1;
+
+public:
+	/**
+	 * Sets up the prompt. The word at each index is echoed for the key at the
+	 * same index; the Escape key is represented in the keys by 0x1B
+	 */
+	void setup(const char *keys, const char *const *words, int count, int col, int row);
+
+	void reset() {
+		_choice = -1;
+	}
+
+	/**
+	 * Returns true if a choice has been echoed and is awaiting confirmation
+	 */
+	bool hasChoice() const {
+		return _choice >= 0;
+	}
+
+	/**
+	 * Returns the key of the choice made
+	 */
+	char key() const {
+		return _keys[_choice];
+	}
+
+	/**
+	 * Handles a keypress, returning true once a choice has been confirmed
+	 */
+	bool handleKey(const KeypressMessage &msg);
+
+	/**
+	 * Draws the echoed word, and the cursor if the prompt is still active
+	 */
+	void draw(GfxSurface &s, bool active) const;
+};
+
+/**
+ * A line of text being typed at a cell position, with the cursor following it
+ */
+class LineInput {
+protected:
+	Common::String _text;
+	uint _maxLength = 0;
+	int _col = 0, _row = 0;
+
+public:
+	virtual ~LineInput() {}
+
+	void setup(uint maxLength, int col, int row);
+
+	void reset() {
+		_text.clear();
+	}
+
+	const Common::String &text() const {
+		return _text;
+	}
+
+	/**
+	 * Handles a keypress, returning true once the entry has been accepted
+	 */
+	virtual bool handleKey(const KeypressMessage &msg);
+
+	void draw(GfxSurface &s, bool active) const;
+};
+
+/**
+ * A two character entry that has to be a valid decimal number. It's
+ * available as the decimal value, and as the BCD value the game stores
+ */
+class NumberInput : public LineInput {
+private:
+	byte _bcd = 0;
+	int _decimal = 0;
+
+public:
+	void setup(int col, int row) {
+		LineInput::setup(2, col, row);
+	}
+
+	bool handleKey(const KeypressMessage &msg) override;
+
+	byte bcd() const {
+		return _bcd;
+	}
+
+	int decimal() const {
+		return _decimal;
+	}
+};
+
+} // namespace Views
+} // namespace Ultima3
+} // namespace Ultima
+
+#endif
diff --git a/engines/ultima/ultima3/views/party_menu.cpp b/engines/ultima/ultima3/views/party_menu.cpp
new file mode 100644
index 00000000000..0a626cdec67
--- /dev/null
+++ b/engines/ultima/ultima3/views/party_menu.cpp
@@ -0,0 +1,95 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "ultima/ultima3/views/party_menu.h"
+
+namespace Ultima {
+namespace Ultima3 {
+namespace Views {
+
+// Q and Escape also go back to the main menu
+static const char OPTION_KEYS[] = "ECFDTMQL\x1B";
+static const char *const OPTION_WORDS[] = {
+	"Examine", "Create", "Form", "Disperse", "Terminate", "Main", "Main", "Look", "Main"
+};
+
+PartyMenu::PartyMenu() : WindowView("PartyMenu") {
+	_choice.setup(OPTION_KEYS, OPTION_WORDS, 9, 23, 13);
+}
+
+bool PartyMenu::msgFocus(const FocusMessage &msg) {
+	_choice.reset();
+	return View::msgFocus(msg);
+}
+
+void PartyMenu::draw() {
+	auto s = getSurface();
+
+	clearWindow(s);
+	drawBorder(s);
+
+	s.writeString(Common::Point(11, 11), "Party Organization");
+	s.writeString(Common::Point(16, 13), "Option:");
+	s.writeString(Common::Point(10, 15), "Examine the Register");
+	s.writeString(Common::Point(11, 16), "Create a Character");
+	s.writeString(Common::Point(13, 17), "Form the Party");
+	s.writeString(Common::Point(11, 18), "Disperse the Party");
+	s.writeString(Common::Point(10, 19), "Terminate a Character");
+	s.writeString(Common::Point(11, 20), "Look at a Character");
+	s.writeString(Common::Point(15, 21), "Main Menu");
+
+	_choice.draw(s, true);
+}
+
+bool PartyMenu::msgKeypress(const KeypressMessage &msg) {
+	if (_choice.handleKey(msg)) {
+		switch (_choice.key()) {
+		case 'E':
+			addView("Register");
+			break;
+		case 'C':
+			addView("CreateCharacter");
+			break;
+		case 'F':
+			addView("FormParty");
+			break;
+		case 'D':
+			addView("DisperseParty");
+			break;
+		case 'T':
+			addView("TerminateCharacter");
+			break;
+		case 'L':
+			addView("CharacterDetails");
+			break;
+		default:
+			close();
+			return true;
+		}
+	}
+
+	redraw();
+	return true;
+}
+
+} // namespace Views
+} // namespace Ultima3
+} // namespace Ultima
diff --git a/engines/ultima/ultima3/views/party_menu.h b/engines/ultima/ultima3/views/party_menu.h
new file mode 100644
index 00000000000..8fb2db83075
--- /dev/null
+++ b/engines/ultima/ultima3/views/party_menu.h
@@ -0,0 +1,52 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef ULTIMA3_VIEWS_PARTY_MENU_H
+#define ULTIMA3_VIEWS_PARTY_MENU_H
+
+#include "ultima/ultima3/views/menu_input.h"
+#include "ultima/ultima3/views/window_view.h"
+
+namespace Ultima {
+namespace Ultima3 {
+namespace Views {
+
+/**
+ * The Party Organization menu, reached from the main menu's Organize a Party
+ */
+class PartyMenu : public WindowView {
+private:
+	MenuChoice _choice;
+
+public:
+	PartyMenu();
+	~PartyMenu() override {}
+
+	bool msgFocus(const FocusMessage &msg) override;
+	void draw() override;
+	bool msgKeypress(const KeypressMessage &msg) override;
+};
+
+} // namespace Views
+} // namespace Ultima3
+} // namespace Ultima
+
+#endif
diff --git a/engines/ultima/ultima3/views/register.cpp b/engines/ultima/ultima3/views/register.cpp
new file mode 100644
index 00000000000..52779ae68ed
--- /dev/null
+++ b/engines/ultima/ultima3/views/register.cpp
@@ -0,0 +1,67 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "ultima/ultima3/views/register.h"
+#include "ultima/ultima3/ultima3.h"
+
+namespace Ultima {
+namespace Ultima3 {
+namespace Views {
+
+void Register::draw() {
+	auto s = getSurface();
+	clearWindow(s);
+
+	s.writeString(Common::Point(16, 11), "Register");
+
+	for (int number = 1; number <= Data::ROSTER_COUNT; ++number) {
+		// The first ten fill the left column and the rest the right
+		int col = number <= 10 ? 1 : 20;
+		int row = number <= 10 ? number + 12 : number + 2;
+		const Data::RosterEntry &entry = _G(savegame).entry(number);
+
+		Common::String line = Common::String::format("%02d", number);
+		if (!entry.isEmpty()) {
+			line += entry.isInParty() ? '*' : '-';
+			line += ' ';
+			line += (char)entry._sex;
+			line += (char)entry._race;
+			line += (char)entry._class;
+			line += (char)entry._status;
+			line += ' ';
+			line += entry._name;
+		}
+
+		s.writeString(Common::Point(col, row), line);
+	}
+
+	drawSpacePrompt(s);
+}
+
+bool Register::msgKeypress(const KeypressMessage &msg) {
+	if (isSpaceKey(msg))
+		close();
+	return true;
+}
+
+} // namespace Views
+} // namespace Ultima3
+} // namespace Ultima
diff --git a/engines/ultima/ultima3/views/register.h b/engines/ultima/ultima3/views/register.h
new file mode 100644
index 00000000000..d5ca66378f8
--- /dev/null
+++ b/engines/ultima/ultima3/views/register.h
@@ -0,0 +1,48 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef ULTIMA3_VIEWS_REGISTER_H
+#define ULTIMA3_VIEWS_REGISTER_H
+
+#include "ultima/ultima3/views/window_view.h"
+
+namespace Ultima {
+namespace Ultima3 {
+namespace Views {
+
+/**
+ * Lists all 20 roster entries: whether they're in a party, their sex, race,
+ * class and status letters, and their name
+ */
+class Register : public WindowView {
+public:
+	Register() : WindowView("Register") {}
+	~Register() override {}
+
+	void draw() override;
+	bool msgKeypress(const KeypressMessage &msg) override;
+};
+
+} // namespace Views
+} // namespace Ultima3
+} // namespace Ultima
+
+#endif
diff --git a/engines/ultima/ultima3/views/terminate_character.cpp b/engines/ultima/ultima3/views/terminate_character.cpp
new file mode 100644
index 00000000000..cb9a4d6187f
--- /dev/null
+++ b/engines/ultima/ultima3/views/terminate_character.cpp
@@ -0,0 +1,91 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "ultima/ultima3/views/terminate_character.h"
+#include "ultima/ultima3/ultima3.h"
+
+namespace Ultima {
+namespace Ultima3 {
+namespace Views {
+
+TerminateCharacter::TerminateCharacter() : WindowView("TerminateCharacter") {
+	_entry.setup(22, 18);
+}
+
+bool TerminateCharacter::msgFocus(const FocusMessage &msg) {
+	_message = nullptr;
+	_entry.reset();
+	return View::msgFocus(msg);
+}
+
+void TerminateCharacter::showMessage(const char *message, int col, int row) {
+	_message = message;
+	_messageCol = col;
+	_messageRow = row;
+}
+
+void TerminateCharacter::draw() {
+	auto s = getSurface();
+	clearWindow(s);
+
+	s.writeString(Common::Point(15, 15), "Terminate!");
+	s.writeString(Common::Point(16, 18), "Entry#");
+	_entry.draw(s, !_message);
+
+	if (_message) {
+		s.writeString(Common::Point(_messageCol, _messageRow), _message);
+		drawSpacePrompt(s);
+	}
+}
+
+bool TerminateCharacter::msgKeypress(const KeypressMessage &msg) {
+	if (_message) {
+		if (isSpaceKey(msg))
+			close();
+		return true;
+	}
+
+	if (_entry.handleKey(msg)) {
+		int number = _entry.decimal();
+
+		if (number < 1 || number > Data::ROSTER_COUNT) {
+			showMessage("(1-20 Only!)", 14, 21);
+		} else {
+			Data::RosterEntry &entry = _G(savegame).entry(number);
+
+			if (entry.isEmpty()) {
+				showMessage("(No one there)", 13, 20);
+			} else if (entry.isInParty()) {
+				showMessage("(With a party)", 13, 21);
+			} else {
+				entry.clear();
+				showMessage("(Terminated)", 14, 21);
+			}
+		}
+	}
+
+	redraw();
+	return true;
+}
+
+} // namespace Views
+} // namespace Ultima3
+} // namespace Ultima
diff --git a/engines/ultima/ultima3/views/terminate_character.h b/engines/ultima/ultima3/views/terminate_character.h
new file mode 100644
index 00000000000..cfb8ca6a464
--- /dev/null
+++ b/engines/ultima/ultima3/views/terminate_character.h
@@ -0,0 +1,56 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef ULTIMA3_VIEWS_TERMINATE_CHARACTER_H
+#define ULTIMA3_VIEWS_TERMINATE_CHARACTER_H
+
+#include "ultima/ultima3/views/menu_input.h"
+#include "ultima/ultima3/views/window_view.h"
+
+namespace Ultima {
+namespace Ultima3 {
+namespace Views {
+
+/**
+ * Permanently removes a character from the roster, unless they're in a party
+ */
+class TerminateCharacter : public WindowView {
+private:
+	NumberInput _entry;
+	const char *_message = nullptr;
+	int _messageCol = 0, _messageRow = 0;
+
+	void showMessage(const char *message, int col, int row);
+
+public:
+	TerminateCharacter();
+	~TerminateCharacter() override {}
+
+	bool msgFocus(const FocusMessage &msg) override;
+	void draw() override;
+	bool msgKeypress(const KeypressMessage &msg) override;
+};
+
+} // namespace Views
+} // namespace Ultima3
+} // namespace Ultima
+
+#endif
diff --git a/engines/ultima/ultima3/views/views.h b/engines/ultima/ultima3/views/views.h
index 31209bd3ffd..ea768eee6fa 100644
--- a/engines/ultima/ultima3/views/views.h
+++ b/engines/ultima/ultima3/views/views.h
@@ -23,7 +23,15 @@
 #define ULTIMA3_VIEWS_H
 
 #include "ultima/shared/engine/events.h"
+#include "ultima/ultima3/views/character_details.h"
+#include "ultima/ultima3/views/create_character.h"
+#include "ultima/ultima3/views/disperse_party.h"
+#include "ultima/ultima3/views/form_party.h"
+#include "ultima/ultima3/views/journey_onward.h"
 #include "ultima/ultima3/views/main_menu.h"
+#include "ultima/ultima3/views/party_menu.h"
+#include "ultima/ultima3/views/register.h"
+#include "ultima/ultima3/views/terminate_character.h"
 #include "ultima/ultima3/views/title.h"
 
 namespace Ultima {
@@ -31,7 +39,15 @@ namespace Ultima3 {
 namespace Views {
 
 struct Views {
+	CharacterDetails _characterDetails;
+	CreateCharacter _createCharacter;
+	DisperseParty _disperseParty;
+	FormParty _formParty;
+	JourneyOnward _journeyOnward;
 	MainMenu _mainMenu;
+	PartyMenu _partyMenu;
+	Register _register;
+	TerminateCharacter _terminateCharacter;
 	Title _title;
 };
 
diff --git a/engines/ultima/ultima3/views/window_view.cpp b/engines/ultima/ultima3/views/window_view.cpp
new file mode 100644
index 00000000000..585d20fdfa9
--- /dev/null
+++ b/engines/ultima/ultima3/views/window_view.cpp
@@ -0,0 +1,69 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "ultima/ultima3/views/window_view.h"
+
+namespace Ultima {
+namespace Ultima3 {
+namespace Views {
+
+constexpr int BORDER_TOP = 10;
+constexpr int BORDER_BOTTOM = 23;
+constexpr int BORDER_RIGHT = 39;
+
+void WindowView::clearWindow(GfxSurface &s) {
+	s.fillRect(Common::Rect(8, 11 * 8, 39 * 8, 23 * 8), 0);
+}
+
+void WindowView::drawBorder(GfxSurface &s) {
+	// Alternating black and magenta pixels, filling whole 8x8 cells
+	auto cell = [&](int col, int row) {
+		for (int y = 0; y < 8; ++y)
+			for (int x = 0; x < 8; ++x)
+				s.setPixel(col * 8 + x, row * 8 + y, (x & 1) ? 2 : 0);
+	};
+
+	s.fillRect(Common::Rect(0, 24 * 8, 320, 25 * 8), 0);
+
+	for (int col = 0; col <= BORDER_RIGHT; ++col)
+		cell(col, BORDER_BOTTOM);
+	for (int col = 1; col < BORDER_RIGHT; ++col)
+		cell(col, BORDER_TOP);
+	for (int row = BORDER_TOP; row <= BORDER_BOTTOM; ++row) {
+		cell(0, row);
+		cell(BORDER_RIGHT, row);
+	}
+
+	// setPixel doesn't flag the changed area for updating on screen
+	s.addDirtyRect(Common::Rect(0, BORDER_TOP * 8, 320, 25 * 8));
+}
+
+void WindowView::drawSpacePrompt(GfxSurface &s) {
+	s.writeString(Common::Point(12, 23), "\x10Press <Space>\x11");
+}
+
+bool WindowView::isSpaceKey(const KeypressMessage &msg) {
+	return msg.ascii == ' ';
+}
+
+} // namespace Views
+} // namespace Ultima3
+} // namespace Ultima
diff --git a/engines/ultima/ultima3/views/window_view.h b/engines/ultima/ultima3/views/window_view.h
new file mode 100644
index 00000000000..35b4946b8b7
--- /dev/null
+++ b/engines/ultima/ultima3/views/window_view.h
@@ -0,0 +1,69 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef ULTIMA3_VIEWS_WINDOW_VIEW_H
+#define ULTIMA3_VIEWS_WINDOW_VIEW_H
+
+#include "graphics/views/view.h"
+
+namespace Ultima {
+namespace Ultima3 {
+namespace Views {
+
+using namespace Graphics::Views;
+
+/**
+ * Base for the party management screens, which are all drawn inside the
+ * bordered window at the bottom of the display, over whatever the title
+ * screen left above it
+ */
+class WindowView : public View {
+protected:
+	/**
+	 * Blanks the inside of the window
+	 */
+	static void clearWindow(GfxSurface &s);
+
+	/**
+	 * Draws the magenta window border
+	 */
+	static void drawBorder(GfxSurface &s);
+
+	/**
+	 * Draws the "Press <Space>" label on the bottom border
+	 */
+	static void drawSpacePrompt(GfxSurface &s);
+
+	/**
+	 * Returns true if the keypress is the space bar
+	 */
+	static bool isSpaceKey(const KeypressMessage &msg);
+
+public:
+	WindowView(const Common::String &name) : View(name) {}
+	~WindowView() override {}
+};
+
+} // namespace Views
+} // namespace Ultima3
+} // namespace Ultima
+
+#endif


Commit: 6857e951c42756f531cb281cdbba2ce9519a2095
    https://github.com/scummvm/scummvm/commit/6857e951c42756f531cb281cdbba2ce9519a2095
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:41:00+11:00

Commit Message:
ULTIMA: ULTIMA3: Add the animated logo screen and tile shapes

Changed paths:
  A engines/ultima/ultima3/gfx/shapes.cpp
  A engines/ultima/ultima3/gfx/shapes.h
  A engines/ultima/ultima3/views/logo_screen.cpp
  A engines/ultima/ultima3/views/logo_screen.h
    engines/ultima/module.mk
    engines/ultima/ultima3/ultima3.h
    engines/ultima/ultima3/views/main_menu.cpp
    engines/ultima/ultima3/views/title.cpp
    engines/ultima/ultima3/views/title.h
    engines/ultima/ultima3/views/views.h


diff --git a/engines/ultima/module.mk b/engines/ultima/module.mk
index 30961892a19..de8ef042ba8 100644
--- a/engines/ultima/module.mk
+++ b/engines/ultima/module.mk
@@ -166,11 +166,13 @@ MODULE_OBJS += \
 	ultima3/data/savegame.o \
 	ultima3/gfx/charset.o \
 	ultima3/gfx/pic_decoder.o \
+	ultima3/gfx/shapes.o \
 	ultima3/views/character_details.o \
 	ultima3/views/create_character.o \
 	ultima3/views/disperse_party.o \
 	ultima3/views/form_party.o \
 	ultima3/views/journey_onward.o \
+	ultima3/views/logo_screen.o \
 	ultima3/views/main_menu.o \
 	ultima3/views/menu_input.o \
 	ultima3/views/party_menu.o \
diff --git a/engines/ultima/ultima3/gfx/shapes.cpp b/engines/ultima/ultima3/gfx/shapes.cpp
new file mode 100644
index 00000000000..a0364574513
--- /dev/null
+++ b/engines/ultima/ultima3/gfx/shapes.cpp
@@ -0,0 +1,131 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "common/file.h"
+#include "common/util.h"
+#include "ultima/ultima3/gfx/shapes.h"
+
+namespace Ultima {
+namespace Ultima3 {
+namespace Gfx {
+
+constexpr int BYTES_PER_LINE = 4;
+
+// Tiles scrolled one pixel at a time, and how many ticks pass between each
+static const int SCROLL_TILES[4] = { 0, 33, 32, 34 };
+static const byte SCROLL_PERIODS[4] = { 3, 2, 3, 2 };
+
+// Pairs of scanlines swapped in a tile to make it flicker, and their periods
+static const int FLICKER_TILES[3] = { 7, 6, 11 };
+static const int FLICKER_LINES[3][2] = { { 1, 2 }, { 3, 4 }, { 2, 3 } };
+static const byte FLICKER_PERIODS[3] = { 4, 3, 2 };
+
+// Every few ticks the frames of the animated tiles are swapped for their
+// alternates: tiles 16-30 with 64-78, and tile 12 with 79
+constexpr byte SWAP_PERIOD = 10;
+
+static int lineOffset(int line) {
+	return (line & 1) * (SHAPE_BYTES / 2) + (line >> 1) * BYTES_PER_LINE;
+}
+
+void Shapes::load() {
+	Common::File f;
+	if (!f.open("SHAPES.ULT") || f.read(_data, sizeof(_data)) != sizeof(_data))
+		error("Could not load SHAPES.ULT");
+
+	for (int i = 0; i < 4; ++i)
+		_scrollCounters[i] = SCROLL_PERIODS[i];
+	for (int i = 0; i < 3; ++i)
+		_flickerCounters[i] = FLICKER_PERIODS[i];
+	_swapCounter = SWAP_PERIOD;
+}
+
+void Shapes::scrollTile(int index) {
+	byte *t = tile(index);
+	byte carry[BYTES_PER_LINE];
+	memcpy(carry, t + lineOffset(15), BYTES_PER_LINE);
+
+	for (int line = 0; line < SHAPE_SIZE; ++line) {
+		byte old[BYTES_PER_LINE];
+		byte *dest = t + lineOffset(line);
+
+		memcpy(old, dest, BYTES_PER_LINE);
+		memcpy(dest, carry, BYTES_PER_LINE);
+		memcpy(carry, old, BYTES_PER_LINE);
+	}
+}
+
+void Shapes::swapLines(int index, int line1, int line2) {
+	byte *t = tile(index);
+	byte temp[BYTES_PER_LINE];
+
+	memcpy(temp, t + lineOffset(line1), BYTES_PER_LINE);
+	memcpy(t + lineOffset(line1), t + lineOffset(line2), BYTES_PER_LINE);
+	memcpy(t + lineOffset(line2), temp, BYTES_PER_LINE);
+}
+
+void Shapes::swapTiles(int index1, int index2, int count) {
+	for (int i = 0; i < count * SHAPE_BYTES; ++i)
+		SWAP(_data[index1 * SHAPE_BYTES + i], _data[index2 * SHAPE_BYTES + i]);
+}
+
+void Shapes::animate() {
+	for (int i = 0; i < 4; ++i) {
+		if (--_scrollCounters[i] == 0) {
+			scrollTile(SCROLL_TILES[i]);
+			_scrollCounters[i] = SCROLL_PERIODS[i];
+		}
+	}
+
+	for (int i = 0; i < 3; ++i) {
+		if (--_flickerCounters[i] == 0) {
+			swapLines(FLICKER_TILES[i], FLICKER_LINES[i][0], FLICKER_LINES[i][1]);
+			_flickerCounters[i] = FLICKER_PERIODS[i];
+		}
+	}
+
+	if (--_swapCounter == 0) {
+		swapTiles(16, 64, 15);
+		swapTiles(12, 79, 1);
+		_swapCounter = SWAP_PERIOD;
+	}
+}
+
+void Shapes::drawTile(Graphics::ManagedSurface &dest, int x, int y, int index) const {
+	if (index < 0 || index >= SHAPE_COUNT)
+		return;
+
+	const byte *t = &_data[index * SHAPE_BYTES];
+
+	for (int line = 0; line < SHAPE_SIZE; ++line) {
+		const byte *src = t + lineOffset(line);
+		byte *destP = (byte *)dest.getBasePtr(x, y + line);
+
+		for (int b = 0; b < BYTES_PER_LINE; ++b) {
+			for (int p = 0; p < 4; ++p)
+				*destP++ = (src[b] >> (6 - p * 2)) & 3;
+		}
+	}
+}
+
+} // namespace Gfx
+} // namespace Ultima3
+} // namespace Ultima
diff --git a/engines/ultima/ultima3/gfx/shapes.h b/engines/ultima/ultima3/gfx/shapes.h
new file mode 100644
index 00000000000..d6cf5bdcf22
--- /dev/null
+++ b/engines/ultima/ultima3/gfx/shapes.h
@@ -0,0 +1,90 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef ULTIMA3_GFX_SHAPES_H
+#define ULTIMA3_GFX_SHAPES_H
+
+#include "graphics/managed_surface.h"
+
+namespace Ultima {
+namespace Ultima3 {
+namespace Gfx {
+
+constexpr int SHAPE_COUNT = 80;
+constexpr int SHAPE_SIZE = 16;
+constexpr int SHAPE_BYTES = 64;
+
+/**
+ * The map tile graphics from SHAPES.ULT: 80 tiles of 16x16 pixels at 2 bits
+ * per pixel. Each tile holds its even scanlines first, then its odd ones.
+ * The animated tiles are changed in place as the animation ticks.
+ */
+class Shapes {
+private:
+	byte _data[SHAPE_COUNT * SHAPE_BYTES] = {};
+
+	// Ticks left before each animation step is next applied
+	byte _scrollCounters[4];
+	byte _flickerCounters[3];
+	byte _swapCounter;
+
+	byte *tile(int index) {
+		return &_data[index * SHAPE_BYTES];
+	}
+
+	/**
+	 * Moves every scanline of a tile down one pixel, wrapping the last to the top
+	 */
+	void scrollTile(int index);
+
+	/**
+	 * Swaps two scanlines of a tile
+	 */
+	void swapLines(int index, int line1, int line2);
+
+	/**
+	 * Swaps a run of whole tiles with another
+	 */
+	void swapTiles(int index1, int index2, int count);
+
+public:
+	/**
+	 * Loads the graphics, restarting the animation
+	 */
+	void load();
+
+	/**
+	 * Advances the tile animations by one tick
+	 */
+	void animate();
+
+	/**
+	 * Draws a tile, overwriting all 256 pixels. The caller is responsible
+	 * for flagging the changed area as dirty
+	 */
+	void drawTile(Graphics::ManagedSurface &dest, int x, int y, int index) const;
+};
+
+} // namespace Gfx
+} // namespace Ultima3
+} // namespace Ultima
+
+#endif
diff --git a/engines/ultima/ultima3/ultima3.h b/engines/ultima/ultima3/ultima3.h
index 40d18028cfe..ced6fc06d66 100644
--- a/engines/ultima/ultima3/ultima3.h
+++ b/engines/ultima/ultima3/ultima3.h
@@ -32,6 +32,7 @@
 #include "ultima/detection.h"
 #include "ultima/shared/engine/events.h"
 #include "ultima/ultima3/data/savegame.h"
+#include "ultima/ultima3/gfx/shapes.h"
 
 namespace Audio {
 class PCSpeaker;
@@ -80,6 +81,7 @@ public:
 	void playErrorBeep();
 
 	Data::Savegame _savegame;
+	Gfx::Shapes _shapes;
 
 	// Debug flag toggled by the "intangible" console command, allowing
 	// movement through normally impassable terrain
diff --git a/engines/ultima/ultima3/views/logo_screen.cpp b/engines/ultima/ultima3/views/logo_screen.cpp
new file mode 100644
index 00000000000..6135128d1bf
--- /dev/null
+++ b/engines/ultima/ultima3/views/logo_screen.cpp
@@ -0,0 +1,114 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "common/file.h"
+#include "ultima/ultima3/views/logo_screen.h"
+#include "ultima/ultima3/views/menu_input.h"
+#include "ultima/ultima3/ultima3.h"
+
+namespace Ultima {
+namespace Ultima3 {
+namespace Views {
+
+// Each round advances the tile animations six ticks. Roughly the time the
+// original took to redraw the whole scene that many times on its first PCs
+constexpr int ANIMATIONS_PER_ROUND = 6;
+constexpr int FRAMES_PER_ROUND = 3;
+
+// Edits that set a tile below this value take effect without a round of
+// animation before the next one
+constexpr byte MIN_VISIBLE_TILE = 8;
+
+void LogoScreen::fetchMove() {
+	for (;;) {
+		_movePos = (_movePos + 1) % MOVES_COUNT;
+		byte tile = _moves[_movePos];
+		byte value = _moves[MOVES_COUNT + _movePos];
+
+		if (tile == 0xFF) {
+			_roundsLeft = value ? value : 256;
+			return;
+		}
+
+		_demo[tile] = value >> 1;
+		if (_demo[tile] >= MIN_VISIBLE_TILE) {
+			_roundsLeft = 1;
+			return;
+		}
+	}
+}
+
+bool LogoScreen::msgFocus(const FocusMessage &msg) {
+	// Coming back from the main menu carries on from where the scene was
+	if (!msg._priorView || msg._priorView->getName() != "MainMenu") {
+		Common::File f;
+		if (!f.open("DEMO.ULT") || f.read(_demo, sizeof(_demo)) != sizeof(_demo))
+			error("Could not load DEMO.ULT");
+		f.close();
+		if (!f.open("MOVES.ULT") || f.read(_moves, sizeof(_moves)) != sizeof(_moves))
+			error("Could not load MOVES.ULT");
+
+		_G(shapes).load();
+		_movePos = MOVES_COUNT - 1;
+		_roundsLeft = 0;
+	}
+
+	delayFrames(FRAMES_PER_ROUND);
+	return View::msgFocus(msg);
+}
+
+void LogoScreen::draw() {
+	auto s = getSurface();
+
+	drawBorder(s);
+	s.writeString(Common::Point(14, 10), "\x10Ultima III\x11");
+
+	for (int row = 0; row < DEMO_ROWS; ++row) {
+		for (int col = 0; col < DEMO_COLS; ++col)
+			_G(shapes).drawTile(s, 8 + col * 16, 88 + row * 16, _demo[row * DEMO_COLS + col]);
+	}
+	s.addDirtyRect(Common::Rect(8, 88, 312, 184));
+
+	drawSpacePrompt(s);
+}
+
+void LogoScreen::timeout() {
+	if (_roundsLeft == 0)
+		fetchMove();
+
+	for (int i = 0; i < ANIMATIONS_PER_ROUND; ++i)
+		_G(shapes).animate();
+	--_roundsLeft;
+
+	redraw();
+	delayFrames(FRAMES_PER_ROUND);
+}
+
+bool LogoScreen::msgKeypress(const KeypressMessage &msg) {
+	if (!isModifierKey(msg.keycode))
+		addView("MainMenu");
+
+	return true;
+}
+
+} // namespace Views
+} // namespace Ultima3
+} // namespace Ultima
diff --git a/engines/ultima/ultima3/views/logo_screen.h b/engines/ultima/ultima3/views/logo_screen.h
new file mode 100644
index 00000000000..2c203d8e20f
--- /dev/null
+++ b/engines/ultima/ultima3/views/logo_screen.h
@@ -0,0 +1,65 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef ULTIMA3_VIEWS_LOGO_SCREEN_H
+#define ULTIMA3_VIEWS_LOGO_SCREEN_H
+
+#include "ultima/ultima3/views/window_view.h"
+
+namespace Ultima {
+namespace Ultima3 {
+namespace Views {
+
+constexpr int DEMO_COLS = 19;
+constexpr int DEMO_ROWS = 6;
+constexpr int MOVES_COUNT = 0x200;
+
+/**
+ * The attract-mode screen shown below the title art: a small animated view
+ * of the world, whose tiles are changed over time by a recorded script of
+ * edits. Any key opens the main menu.
+ */
+class LogoScreen : public WindowView {
+private:
+	byte _demo[DEMO_COLS * DEMO_ROWS] = {};
+	// The first half holds the tile each edit changes, and the second its new
+	// value. An edit with a tile of 0xFF is a pause of that many rounds
+	byte _moves[MOVES_COUNT * 2] = {};
+	int _movePos = MOVES_COUNT - 1;
+	int _roundsLeft = 0;
+
+	void fetchMove();
+
+public:
+	LogoScreen() : WindowView("LogoScreen") {}
+	~LogoScreen() override {}
+
+	bool msgFocus(const FocusMessage &msg) override;
+	void draw() override;
+	void timeout() override;
+	bool msgKeypress(const KeypressMessage &msg) override;
+};
+
+} // namespace Views
+} // namespace Ultima3
+} // namespace Ultima
+
+#endif
diff --git a/engines/ultima/ultima3/views/main_menu.cpp b/engines/ultima/ultima3/views/main_menu.cpp
index bea5a9687c7..a5c46ebc9bd 100644
--- a/engines/ultima/ultima3/views/main_menu.cpp
+++ b/engines/ultima/ultima3/views/main_menu.cpp
@@ -69,8 +69,8 @@ bool MainMenu::msgKeypress(const KeypressMessage &msg) {
 				addView("JourneyOnward");
 			break;
 		default:
-			// Returning to the view is wired up once the world engine lands
-			break;
+			close();
+			return true;
 		}
 	}
 
diff --git a/engines/ultima/ultima3/views/title.cpp b/engines/ultima/ultima3/views/title.cpp
index bfe34bf55da..3c8c74d1625 100644
--- a/engines/ultima/ultima3/views/title.cpp
+++ b/engines/ultima/ultima3/views/title.cpp
@@ -359,13 +359,13 @@ void Title::timeout() {
 	case PH_DRAIN:
 		_keyPending = false;
 		draw();
-		showMainMenu();
+		showLogoScreen();
 		break;
 	}
 }
 
-void Title::showMainMenu() {
-	replaceView("MainMenu");
+void Title::showLogoScreen() {
+	replaceView("LogoScreen");
 }
 
 bool Title::msgKeypress(const KeypressMessage &msg) {
diff --git a/engines/ultima/ultima3/views/title.h b/engines/ultima/ultima3/views/title.h
index c9af718c0d6..0df846ad683 100644
--- a/engines/ultima/ultima3/views/title.h
+++ b/engines/ultima/ultima3/views/title.h
@@ -52,7 +52,7 @@ struct TitleBox {
  * remaining reveal/pause (matching the original's keyboard-buffer-peek
  * behaviour: a single buffered keystroke stays "pending" and skips every
  * subsequent wait without needing to be pressed again) until a final
- * step consumes it and moves on to the main menu.
+ * step consumes it and moves on to the logo screen.
  */
 class Title : public View {
 private:
@@ -120,7 +120,7 @@ private:
 	bool tickWait();
 
 	void playSoundBurst();
-	void showMainMenu();
+	void showLogoScreen();
 
 public:
 	Title();
diff --git a/engines/ultima/ultima3/views/views.h b/engines/ultima/ultima3/views/views.h
index ea768eee6fa..d23dc2af5d9 100644
--- a/engines/ultima/ultima3/views/views.h
+++ b/engines/ultima/ultima3/views/views.h
@@ -28,6 +28,7 @@
 #include "ultima/ultima3/views/disperse_party.h"
 #include "ultima/ultima3/views/form_party.h"
 #include "ultima/ultima3/views/journey_onward.h"
+#include "ultima/ultima3/views/logo_screen.h"
 #include "ultima/ultima3/views/main_menu.h"
 #include "ultima/ultima3/views/party_menu.h"
 #include "ultima/ultima3/views/register.h"
@@ -44,6 +45,7 @@ struct Views {
 	DisperseParty _disperseParty;
 	FormParty _formParty;
 	JourneyOnward _journeyOnward;
+	LogoScreen _logoScreen;
 	MainMenu _mainMenu;
 	PartyMenu _partyMenu;
 	Register _register;


Commit: d4c5200064f7bb0e4a8a4abfb4162e1168075f94
    https://github.com/scummvm/scummvm/commit/d4c5200064f7bb0e4a8a4abfb4162e1168075f94
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:41:00+11:00

Commit Message:
ULTIMA: ULTIMA3: Add the overworld map, party panel and movement

Changed paths:
  A engines/ultima/ultima3/data/map.cpp
  A engines/ultima/ultima3/data/map.h
  A engines/ultima/ultima3/gfx/message_log.cpp
  A engines/ultima/ultima3/gfx/message_log.h
  A engines/ultima/ultima3/gfx/screen_effects.h
  A engines/ultima/ultima3/logic/logic.cpp
  A engines/ultima/ultima3/logic/logic.h
  A engines/ultima/ultima3/logic/overworld_logic.cpp
  A engines/ultima/ultima3/logic/overworld_logic.h
  A engines/ultima/ultima3/views/game.cpp
  A engines/ultima/ultima3/views/game.h
  A engines/ultima/ultima3/views/overworld_map.cpp
  A engines/ultima/ultima3/views/overworld_map.h
    engines/ultima/module.mk
    engines/ultima/ultima3/data/roster.h
    engines/ultima/ultima3/data/savegame.h
    engines/ultima/ultima3/ultima3.cpp
    engines/ultima/ultima3/ultima3.h
    engines/ultima/ultima3/views/main_menu.cpp
    engines/ultima/ultima3/views/views.h


diff --git a/engines/ultima/module.mk b/engines/ultima/module.mk
index de8ef042ba8..059c90c45ad 100644
--- a/engines/ultima/module.mk
+++ b/engines/ultima/module.mk
@@ -163,18 +163,24 @@ MODULE_OBJS += \
 	ultima3/console.o \
 	ultima3/metaengine.o \
 	ultima3/data/data.o \
+	ultima3/data/map.o \
 	ultima3/data/savegame.o \
 	ultima3/gfx/charset.o \
+	ultima3/gfx/message_log.o \
 	ultima3/gfx/pic_decoder.o \
 	ultima3/gfx/shapes.o \
+	ultima3/logic/logic.o \
+	ultima3/logic/overworld_logic.o \
 	ultima3/views/character_details.o \
 	ultima3/views/create_character.o \
 	ultima3/views/disperse_party.o \
 	ultima3/views/form_party.o \
+	ultima3/views/game.o \
 	ultima3/views/journey_onward.o \
 	ultima3/views/logo_screen.o \
 	ultima3/views/main_menu.o \
 	ultima3/views/menu_input.o \
+	ultima3/views/overworld_map.o \
 	ultima3/views/party_menu.o \
 	ultima3/views/register.o \
 	ultima3/views/terminate_character.o \
diff --git a/engines/ultima/ultima3/data/map.cpp b/engines/ultima/ultima3/data/map.cpp
new file mode 100644
index 00000000000..b58d8437877
--- /dev/null
+++ b/engines/ultima/ultima3/data/map.cpp
@@ -0,0 +1,37 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "common/file.h"
+#include "ultima/ultima3/data/map.h"
+
+namespace Ultima {
+namespace Ultima3 {
+namespace Data {
+
+void Map::load(const char *filename) {
+	Common::File f;
+	if (!f.open(filename) || f.read(_cells, sizeof(_cells)) != sizeof(_cells))
+		error("Could not load %s", filename);
+}
+
+} // namespace Data
+} // namespace Ultima3
+} // namespace Ultima
diff --git a/engines/ultima/ultima3/data/map.h b/engines/ultima/ultima3/data/map.h
new file mode 100644
index 00000000000..9e6cf045f93
--- /dev/null
+++ b/engines/ultima/ultima3/data/map.h
@@ -0,0 +1,70 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef ULTIMA3_DATA_MAP_H
+#define ULTIMA3_DATA_MAP_H
+
+#include "common/scummsys.h"
+
+namespace Ultima {
+namespace Ultima3 {
+namespace Data {
+
+constexpr int MAP_SIZE = 64;
+
+/**
+ * A 64x64 location map, as used by the overworld, towns and castles. Each
+ * cell holds a tile number multiplied by 4
+ */
+class Map {
+private:
+	byte _cells[MAP_SIZE * MAP_SIZE] = {};
+
+public:
+	/**
+	 * Loads a map from the start of a .ULT file
+	 */
+	void load(const char *filename);
+
+	/**
+	 * Returns the raw cell value. The coordinates wrap around the map
+	 */
+	byte cell(int x, int y) const {
+		return _cells[(y & (MAP_SIZE - 1)) * MAP_SIZE + (x & (MAP_SIZE - 1))];
+	}
+
+	void setCell(int x, int y, byte value) {
+		_cells[(y & (MAP_SIZE - 1)) * MAP_SIZE + (x & (MAP_SIZE - 1))] = value;
+	}
+
+	/**
+	 * Returns the number of the tile graphic in a cell
+	 */
+	byte tile(int x, int y) const {
+		return cell(x, y) >> 2;
+	}
+};
+
+} // namespace Data
+} // namespace Ultima3
+} // namespace Ultima
+
+#endif
diff --git a/engines/ultima/ultima3/data/roster.h b/engines/ultima/ultima3/data/roster.h
index 7e108e52540..8bb2f75d183 100644
--- a/engines/ultima/ultima3/data/roster.h
+++ b/engines/ultima/ultima3/data/roster.h
@@ -46,6 +46,18 @@ inline byte toBcd(int value) {
 	return ((value / 10) << 4) | (value % 10);
 }
 
+inline uint16 toBcdWord(int value) {
+	return (toBcd(value / 100) << 8) | toBcd(value % 100);
+}
+
+inline int fromBcd(byte value) {
+	return (value >> 4) * 10 + (value & 0xF);
+}
+
+inline int fromBcdWord(uint16 value) {
+	return fromBcd(value >> 8) * 100 + fromBcd(value & 0xFF);
+}
+
 /**
  * A character record. Numeric fields hold BCD values, exactly as in the
  * original, so the same digits are shown when they're printed as hex.
diff --git a/engines/ultima/ultima3/data/savegame.h b/engines/ultima/ultima3/data/savegame.h
index 380e8e384dd..fbab96c1ebb 100644
--- a/engines/ultima/ultima3/data/savegame.h
+++ b/engines/ultima/ultima3/data/savegame.h
@@ -41,6 +41,7 @@ struct Savegame {
 	byte _location = 0;
 	byte _posX = 0;
 	byte _posY = 0;
+	byte _moveCount[4] = {};
 
 	/**
 	 * Returns a roster entry by its 1-based number
diff --git a/engines/ultima/ultima3/gfx/message_log.cpp b/engines/ultima/ultima3/gfx/message_log.cpp
new file mode 100644
index 00000000000..0b197e94962
--- /dev/null
+++ b/engines/ultima/ultima3/gfx/message_log.cpp
@@ -0,0 +1,92 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "common/util.h"
+#include "ultima/ultima3/gfx/message_log.h"
+
+namespace Ultima {
+namespace Ultima3 {
+namespace Gfx {
+
+constexpr int LOG_COL = 24;
+constexpr int LOG_ROW = 17;
+constexpr char GLYPH_CURSOR = 0x1E;
+
+void MessageLog::clear() {
+	for (int i = 0; i < LOG_LINES; ++i)
+		_lines[i].clear();
+	_column = 0;
+}
+
+void MessageLog::scroll() {
+	for (int i = 1; i < LOG_LINES; ++i)
+		_lines[i - 1] = _lines[i];
+
+	_lines[LOG_LINES - 1].clear();
+	_column = 0;
+}
+
+void MessageLog::putChar(char ch) {
+	Common::String &line = _lines[LOG_LINES - 1];
+
+	// Each line is kept as long as the characters actually placed on it
+	while ((int)line.size() < _column)
+		line += ' ';
+	if ((int)line.size() == _column)
+		line += ch;
+	else
+		line.setChar(ch, _column);
+	++_column;
+}
+
+void MessageLog::print(const char *text) {
+	for (; *text; ++text) {
+		if (*text == '\n') {
+			scroll();
+		} else if (_column == LOG_WIDTH - 1) {
+			// The last column is filled, but the cursor stays put
+			putChar(*text);
+			_column = LOG_WIDTH;
+		} else if (_column > LOG_WIDTH - 1) {
+			scroll();
+			putChar(*text);
+		} else {
+			putChar(*text);
+		}
+	}
+}
+
+void MessageLog::draw(Graphics::Views::GfxSurface &s, bool showCursor) const {
+	s.fillRect(Common::Rect(LOG_COL * 8, LOG_ROW * 8, (LOG_COL + LOG_WIDTH) * 8,
+		(LOG_ROW + LOG_LINES) * 8), 0);
+
+	for (int i = 0; i < LOG_LINES; ++i)
+		s.writeString(Common::Point(LOG_COL, LOG_ROW + i), _lines[i]);
+
+	if (showCursor) {
+		s.setTextPos(Common::Point(LOG_COL + MIN(_column, LOG_WIDTH - 1), LOG_ROW + LOG_LINES - 1));
+		s.writeChar(GLYPH_CURSOR);
+	}
+}
+
+} // namespace Gfx
+} // namespace Ultima3
+} // namespace Ultima
diff --git a/engines/ultima/ultima3/gfx/message_log.h b/engines/ultima/ultima3/gfx/message_log.h
new file mode 100644
index 00000000000..a114ea79520
--- /dev/null
+++ b/engines/ultima/ultima3/gfx/message_log.h
@@ -0,0 +1,74 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef ULTIMA3_GFX_MESSAGE_LOG_H
+#define ULTIMA3_GFX_MESSAGE_LOG_H
+
+#include "common/str.h"
+#include "graphics/views/gfx_surface.h"
+
+namespace Ultima {
+namespace Ultima3 {
+namespace Gfx {
+
+constexpr int LOG_LINES = 7;
+constexpr int LOG_WIDTH = 16;
+
+/**
+ * The scrolling message window at the bottom right of the game screen: seven
+ * lines of sixteen characters, with text always added to the bottom line
+ */
+class MessageLog {
+private:
+	Common::String _lines[LOG_LINES];
+	int _column = 0;
+
+	void scroll();
+
+public:
+	/**
+	 * Clears the window
+	 */
+	void clear();
+
+	/**
+	 * Adds text at the cursor. A newline scrolls the window up, as does
+	 * running off the end of the bottom line
+	 */
+	void print(const char *text);
+
+	/**
+	 * Adds a single character (including the glyphs used for prompts) at
+	 * the cursor without wrapping
+	 */
+	void putChar(char ch);
+
+	/**
+	 * Draws the window, with the cursor arrow shown if waiting for input
+	 */
+	void draw(Graphics::Views::GfxSurface &s, bool showCursor) const;
+};
+
+} // namespace Gfx
+} // namespace Ultima3
+} // namespace Ultima
+
+#endif
diff --git a/engines/ultima/ultima3/gfx/screen_effects.h b/engines/ultima/ultima3/gfx/screen_effects.h
new file mode 100644
index 00000000000..e53466433d3
--- /dev/null
+++ b/engines/ultima/ultima3/gfx/screen_effects.h
@@ -0,0 +1,62 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef ULTIMA3_GFX_SCREEN_EFFECTS_H
+#define ULTIMA3_GFX_SCREEN_EFFECTS_H
+
+namespace Ultima {
+namespace Ultima3 {
+namespace Gfx {
+
+constexpr int FLASH_FRAMES = 3;
+
+/**
+ * Brief colour inversions of part of the game screen, used to show a party
+ * member being hurt or the whole view being struck
+ */
+struct ScreenEffects {
+	int _slot = -1;
+	bool _viewport = false;
+	int _frames = 0;
+
+	void flashSlot(int slot) {
+		_slot = slot;
+		_frames = FLASH_FRAMES;
+	}
+
+	void flashViewport() {
+		_viewport = true;
+		_frames = FLASH_FRAMES;
+	}
+
+	void tick() {
+		if (_frames > 0 && --_frames == 0) {
+			_slot = -1;
+			_viewport = false;
+		}
+	}
+};
+
+} // namespace Gfx
+} // namespace Ultima3
+} // namespace Ultima
+
+#endif
diff --git a/engines/ultima/ultima3/logic/logic.cpp b/engines/ultima/ultima3/logic/logic.cpp
new file mode 100644
index 00000000000..43eae1ed0a5
--- /dev/null
+++ b/engines/ultima/ultima3/logic/logic.cpp
@@ -0,0 +1,143 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "ultima/ultima3/logic/logic.h"
+#include "ultima/ultima3/ultima3.h"
+
+namespace Ultima {
+namespace Ultima3 {
+
+constexpr int HUNGER_STEP = 10;
+constexpr int STARVATION_DAMAGE = 5;
+
+// Magic points regenerate up to half of the attribute they depend on
+static int maxMagicPoints(byte attribute) {
+	return Data::fromBcd(attribute) / 2;
+}
+
+void Logic::incrementMoveCounter() {
+	Data::Savegame &save = _G(savegame);
+	int carry = save._partySize;
+
+	for (int i = 0; i < 4 && carry; ++i) {
+		int total = Data::fromBcd(save._moveCount[i]) + carry;
+		save._moveCount[i] = Data::toBcd(total % 100);
+		carry = total / 100;
+	}
+}
+
+void Logic::regenerateMagicPoint(Data::RosterEntry &e) {
+	if (e.isAlive())
+		e._magicPoints = Data::toBcd(Data::fromBcd(e._magicPoints) + 1);
+}
+
+void Logic::applyHunger(int slot) {
+	Data::RosterEntry &e = _G(savegame).partyMember(slot);
+
+	// Food only drops by one every few turns, tracked in a hidden counter
+	int counter = Data::fromBcd(e._foodSubCounter) - HUNGER_STEP;
+	int borrow = 0;
+	if (counter < 0) {
+		counter += 100;
+		borrow = 1;
+	}
+	e._foodSubCounter = Data::toBcd(counter);
+
+	int food = Data::fromBcdWord(e._food) - borrow;
+	if (food < 0) {
+		e._food = 0;
+		_G(messages).print("Starving!\n");
+		_G(effects).flashSlot(slot);
+		g_engine->playSoundEffect(0xF7);
+		damageCharacter(slot, STARVATION_DAMAGE);
+	} else {
+		e._food = Data::toBcdWord(food);
+	}
+}
+
+bool Logic::damageCharacter(int slot, int amount) {
+	Data::RosterEntry &e = _G(savegame).partyMember(slot);
+	int hitPoints = Data::fromBcdWord(e._hitPoints) - amount;
+
+	if (hitPoints < 0) {
+		e._status = Data::STATUS_DEAD;
+		e._hitPoints = 0;
+		return true;
+	}
+
+	e._hitPoints = Data::toBcdWord(hitPoints);
+	return false;
+}
+
+void Logic::processPartyTurnEffects(bool everyTurn) {
+	if (!everyTurn) {
+		if (--_upkeepCounter != 0)
+			return;
+		_upkeepCounter = 4;
+	}
+
+	if (--_healCounter < 0)
+		_healCounter = 9;
+
+	Data::Savegame &save = _G(savegame);
+
+	for (int slot = save._partySize - 1; slot >= 0; --slot) {
+		Data::RosterEntry &e = save.partyMember(slot);
+		if (!e.isAlive())
+			continue;
+
+		int magic = Data::fromBcd(e._magicPoints);
+		int intelligence = Data::fromBcd(e._intelligence);
+		int wisdom = Data::fromBcd(e._wisdom);
+
+		if (e._class == 'W' && magic < intelligence)
+			regenerateMagicPoint(e);
+
+		if (e._class == 'C' && Data::fromBcd(e._magicPoints) < wisdom)
+			regenerateMagicPoint(e);
+
+		if ((e._class == 'L' || e._class == 'D' || e._class == 'A') &&
+				maxMagicPoints(e._intelligence) > Data::fromBcd(e._magicPoints))
+			regenerateMagicPoint(e);
+
+		if ((e._class == 'P' || e._class == 'I' || e._class == 'D') &&
+				maxMagicPoints(e._wisdom) > Data::fromBcd(e._magicPoints))
+			regenerateMagicPoint(e);
+
+		if (e._class == 'R' && maxMagicPoints(e._wisdom) > Data::fromBcd(e._magicPoints) &&
+				maxMagicPoints(e._intelligence) > Data::fromBcd(e._magicPoints))
+			regenerateMagicPoint(e);
+
+		applyHunger(slot);
+
+		if (e._status == Data::STATUS_POISONED) {
+			damageCharacter(slot, 1);
+			_G(effects).flashSlot(slot);
+			_G(messages).print("Poisoned!\n");
+		}
+
+		if (_healCounter == 0 && Data::fromBcdWord(e._hitPoints) < Data::fromBcdWord(e._maxHitPoints))
+			e._hitPoints = Data::toBcdWord(Data::fromBcdWord(e._hitPoints) + 1);
+	}
+}
+
+} // namespace Ultima3
+} // namespace Ultima
diff --git a/engines/ultima/ultima3/logic/logic.h b/engines/ultima/ultima3/logic/logic.h
new file mode 100644
index 00000000000..e6683cad2e7
--- /dev/null
+++ b/engines/ultima/ultima3/logic/logic.h
@@ -0,0 +1,83 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef ULTIMA3_LOGIC_LOGIC_H
+#define ULTIMA3_LOGIC_LOGIC_H
+
+#include "ultima/ultima3/data/roster.h"
+
+namespace Ultima {
+namespace Ultima3 {
+
+// The numbering is shared with the wind direction
+enum Direction {
+	DIR_NONE = 0,
+	DIR_NORTH = 1,
+	DIR_EAST = 2,
+	DIR_SOUTH = 3,
+	DIR_WEST = 4
+};
+
+/**
+ * Game rules common to every location: the turn counter, and the upkeep
+ * of the party each turn
+ */
+class Logic {
+private:
+	int _healCounter = 9;
+	int _upkeepCounter = 4;
+
+	/**
+	 * Gives a character a magic point
+	 */
+	void regenerateMagicPoint(Data::RosterEntry &e);
+
+	/**
+	 * Uses up some of a character's food, starving them once it runs out
+	 */
+	void applyHunger(int slot);
+
+public:
+	virtual ~Logic() {}
+
+	/**
+	 * Counts a turn taken by the party
+	 */
+	void incrementMoveCounter();
+
+	/**
+	 * Applies the effects of a turn passing on the party: magic point
+	 * regeneration, hunger, poison and natural healing. Outside the
+	 * overworld this only happens on every fourth turn
+	 */
+	void processPartyTurnEffects(bool everyTurn);
+
+	/**
+	 * Reduces the hit points of a party member, killing them if they run
+	 * out. Returns true if they were killed
+	 */
+	bool damageCharacter(int slot, int amount);
+};
+
+} // namespace Ultima3
+} // namespace Ultima
+
+#endif
diff --git a/engines/ultima/ultima3/logic/overworld_logic.cpp b/engines/ultima/ultima3/logic/overworld_logic.cpp
new file mode 100644
index 00000000000..5afb2439cc1
--- /dev/null
+++ b/engines/ultima/ultima3/logic/overworld_logic.cpp
@@ -0,0 +1,108 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "ultima/ultima3/logic/overworld_logic.h"
+#include "ultima/ultima3/ultima3.h"
+
+namespace Ultima {
+namespace Ultima3 {
+
+constexpr byte TILE_WATER = 0;
+constexpr byte TILE_MOUNTAINS = 4;
+constexpr byte TILE_SHIP_WATER = 12;
+constexpr byte TILE_FIRE = 0x20;
+constexpr byte TILE_FORCE_FIELD = 0x21;
+constexpr byte TILE_WHIRLPOOL = 0x22;
+constexpr byte TILE_SHALLOWS = 0x3E;
+constexpr byte FIRST_BLOCKING_TILE = 12;
+
+// Bits of a character's marks and cards that protect against terrain
+constexpr byte MARK_FIRE = 0x10;
+constexpr byte MARK_FORCE = 0x20;
+
+constexpr int FIRE_DAMAGE = 99;
+constexpr int FORCE_FIELD_DAMAGE = 50;
+
+bool OverworldLogic::isShipBlockedByWind(Direction dir) const {
+	if (_G(savegame)._transport != TRANSPORT_SHIP)
+		return false;
+
+	return _G(windDirection) == 0 || _G(windDirection) == (byte)dir;
+}
+
+bool OverworldLogic::isTerrainBlocked(byte tile) {
+	Data::Savegame &save = _G(savegame);
+
+	if (save._transport == TRANSPORT_SHIP)
+		return tile != TILE_WATER && tile != TILE_SHIP_WATER;
+
+	switch (tile) {
+	case TILE_FIRE:
+		// The whole party needs the Mark of Fire to cross it. Otherwise the
+		// first without it is burnt, and the fire can't be crossed
+		_G(effects).flashViewport();
+		for (int slot = 0; slot < save._partySize; ++slot) {
+			if (!(save.partyMember(slot)._marksAndCards & MARK_FIRE)) {
+				damageCharacter(slot, FIRE_DAMAGE);
+				_G(effects).flashSlot(slot);
+				return true;
+			}
+		}
+		return false;
+
+	case TILE_FORCE_FIELD:
+		// Anyone without the Mark of Force is hurt, but it can be crossed
+		for (int slot = 0; slot < save._partySize; ++slot) {
+			Data::RosterEntry &e = save.partyMember(slot);
+
+			if (e.isAlive() && !(e._marksAndCards & MARK_FORCE)) {
+				damageCharacter(slot, FORCE_FIELD_DAMAGE);
+				_G(effects).flashSlot(slot);
+			}
+		}
+		return false;
+
+	case TILE_WHIRLPOOL:
+	case TILE_SHALLOWS:
+		return false;
+
+	default:
+		return tile >= FIRST_BLOCKING_TILE || tile == TILE_WATER || tile == TILE_MOUNTAINS;
+	}
+}
+
+bool OverworldLogic::move(Direction dir) {
+	Data::Savegame &save = _G(savegame);
+	int dx = (dir == DIR_EAST) ? 1 : (dir == DIR_WEST) ? -1 : 0;
+	int dy = (dir == DIR_SOUTH) ? 1 : (dir == DIR_NORTH) ? -1 : 0;
+
+	if (isShipBlockedByWind(dir))
+		return false;
+	if (isTerrainBlocked(_G(map).tile(save._posX + dx, save._posY + dy)))
+		return false;
+
+	save._posX = (save._posX + dx) & (Data::MAP_SIZE - 1);
+	save._posY = (save._posY + dy) & (Data::MAP_SIZE - 1);
+	return true;
+}
+
+} // namespace Ultima3
+} // namespace Ultima
diff --git a/engines/ultima/ultima3/logic/overworld_logic.h b/engines/ultima/ultima3/logic/overworld_logic.h
new file mode 100644
index 00000000000..af9447535d9
--- /dev/null
+++ b/engines/ultima/ultima3/logic/overworld_logic.h
@@ -0,0 +1,62 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef ULTIMA3_LOGIC_OVERWORLD_LOGIC_H
+#define ULTIMA3_LOGIC_OVERWORLD_LOGIC_H
+
+#include "ultima/ultima3/logic/logic.h"
+
+namespace Ultima {
+namespace Ultima3 {
+
+constexpr byte TRANSPORT_HORSE = 0x0A;
+constexpr byte TRANSPORT_SHIP = 0x0B;
+constexpr byte TRANSPORT_ON_FOOT = 0x3F;
+
+/**
+ * Rules for travelling around the world map
+ */
+class OverworldLogic : public Logic {
+private:
+	/**
+	 * Returns true if a ship can't sail in a direction because the wind is
+	 * absent or blowing against it
+	 */
+	bool isShipBlockedByWind(Direction dir) const;
+
+	/**
+	 * Returns true if the party can't step onto terrain. Some terrain
+	 * doesn't stop them but hurts, and some hurts and does stop them
+	 */
+	bool isTerrainBlocked(byte tile);
+
+public:
+	/**
+	 * Moves the party a step in a direction, if they can
+	 * @returns		True if they moved
+	 */
+	bool move(Direction dir);
+};
+
+} // namespace Ultima3
+} // namespace Ultima
+
+#endif
diff --git a/engines/ultima/ultima3/ultima3.cpp b/engines/ultima/ultima3/ultima3.cpp
index e19db725e5e..1df3d0469af 100644
--- a/engines/ultima/ultima3/ultima3.cpp
+++ b/engines/ultima/ultima3/ultima3.cpp
@@ -107,6 +107,20 @@ void Ultima3Engine::playErrorBeep() {
 	queueTone(3216, 65);
 }
 
+void Ultima3Engine::playSoundEffect(byte effect) {
+	switch (effect) {
+	case 0xFE:
+		playErrorBeep();
+		break;
+	case 0xFF:
+		// ~132Hz for ~60ms, from the original's raw 16-toggle loop at 4.77MHz
+		queueTone(9040, 60);
+		break;
+	default:
+		break;
+	}
+}
+
 bool Ultima3Engine::savegamesExist() const {
 	Common::String slotName = getSaveStateName(1);
 	Common::InSaveFile *saveFile = g_system->getSavefileManager()->openForLoading(slotName);
diff --git a/engines/ultima/ultima3/ultima3.h b/engines/ultima/ultima3/ultima3.h
index ced6fc06d66..efce7fc11ec 100644
--- a/engines/ultima/ultima3/ultima3.h
+++ b/engines/ultima/ultima3/ultima3.h
@@ -31,7 +31,10 @@
 #include "engines/engine.h"
 #include "ultima/detection.h"
 #include "ultima/shared/engine/events.h"
+#include "ultima/ultima3/data/map.h"
 #include "ultima/ultima3/data/savegame.h"
+#include "ultima/ultima3/gfx/message_log.h"
+#include "ultima/ultima3/gfx/screen_effects.h"
 #include "ultima/ultima3/gfx/shapes.h"
 
 namespace Audio {
@@ -80,8 +83,17 @@ public:
 	 */
 	void playErrorBeep();
 
+	/**
+	 * Plays one of the game's sound effects, identified by its original number
+	 */
+	void playSoundEffect(byte effect);
+
 	Data::Savegame _savegame;
+	Data::Map _map;
 	Gfx::Shapes _shapes;
+	Gfx::MessageLog _messages;
+	Gfx::ScreenEffects _effects;
+	byte _windDirection = 0;
 
 	// Debug flag toggled by the "intangible" console command, allowing
 	// movement through normally impassable terrain
diff --git a/engines/ultima/ultima3/views/game.cpp b/engines/ultima/ultima3/views/game.cpp
new file mode 100644
index 00000000000..9b110a1212b
--- /dev/null
+++ b/engines/ultima/ultima3/views/game.cpp
@@ -0,0 +1,191 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "ultima/ultima3/views/game.h"
+#include "ultima/ultima3/ultima3.h"
+
+namespace Ultima {
+namespace Ultima3 {
+namespace Views {
+
+constexpr int PANEL_COL = 24;
+constexpr int PANEL_SLOT_ROWS = 4;
+constexpr int WIND_CHANGE_TICKS = 25;
+constexpr int IDLE_FRAMES = 100;
+constexpr char GLYPH_LABEL_START = 0x10;
+constexpr char GLYPH_LABEL_END = 0x11;
+constexpr char GLYPH_PROMPT = 0x10;
+
+static const char *const WIND_NAMES[5] = {
+	"Calm  Wind", "North Wind", "East  Wind", "South Wind", "West  Wind"
+};
+
+void Game::startGame() {
+	_gameOver = false;
+	_idleFrames = 0;
+	_windCounter = 1;
+	_G(messages).clear();
+	_G(effects) = Gfx::ScreenEffects();
+	updateWind();
+}
+
+void Game::startPrompt() {
+	_G(messages).putChar(GLYPH_PROMPT);
+	_idleFrames = 0;
+	redraw();
+}
+
+bool Game::checkPartyWipedOut() {
+	if (_G(savegame).hasLivingPartyMember())
+		return false;
+
+	_G(messages).print("\n\nAll Players Out!\n");
+	_gameOver = true;
+	redraw();
+	return true;
+}
+
+void Game::updateWind() {
+	if (--_windCounter != 0)
+		return;
+	_windCounter = WIND_CHANGE_TICKS;
+
+	// Calm or any of the four directions, but never the one it already is
+	// when the choice comes from the four-in-nine chance of changing
+	for (;;) {
+		int wind = g_events->getRandomNumber(8);
+		if (wind >= 5) {
+			wind -= 4;
+			if (wind == _G(windDirection))
+				continue;
+		}
+
+		_G(windDirection) = wind;
+		break;
+	}
+}
+
+bool Game::msgFocus(const FocusMessage &msg) {
+	_idleFrames = 0;
+	delayFrames(1);
+	return View::msgFocus(msg);
+}
+
+void Game::timeout() {
+	_G(shapes).animate();
+	_G(effects).tick();
+	updateWind();
+
+	if (!_gameOver && ++_idleFrames >= IDLE_FRAMES)
+		idleTimeout();
+
+	redraw();
+	delayFrames(1);
+}
+
+void Game::invertRect(GfxSurface &s, const Common::Rect &r) {
+	for (int y = r.top; y < r.bottom; ++y) {
+		byte *p = (byte *)s.getBasePtr(r.left, y);
+
+		for (int x = r.left; x < r.right; ++x, ++p)
+			*p ^= 3;
+	}
+}
+
+void Game::drawFrame(GfxSurface &s) {
+	// Alternating black and magenta pixels, filling whole 8x8 cells
+	auto cell = [&](int col, int row) {
+		for (int y = 0; y < 8; ++y)
+			for (int x = 0; x < 8; ++x)
+				s.setPixel(col * 8 + x, row * 8 + y, (x & 1) ? 2 : 0);
+	};
+
+	for (int row = 0; row < 24; ++row) {
+		cell(0, row);
+		cell(23, row);
+	}
+	for (int col = 0; col < 24; ++col) {
+		cell(col, 0);
+		cell(col, 23);
+	}
+
+	for (int row = 0; row <= 16; ++row)
+		cell(FRAME_COLS - 1, row);
+	for (int row = 0; row <= 16; row += PANEL_SLOT_ROWS) {
+		for (int col = PANEL_COL; col < FRAME_COLS; ++col)
+			cell(col, row);
+	}
+
+	s.addDirtyRect(Common::Rect(0, 0, 320, 200));
+}
+
+void Game::drawPartyStatus(GfxSurface &s) {
+	Data::Savegame &save = _G(savegame);
+
+	for (int slot = 0; slot < Data::PARTY_MAX; ++slot) {
+		int row = slot * PANEL_SLOT_ROWS;
+
+		s.writeString(Common::Point(30, row),
+			Common::String::format("%c%d%c", GLYPH_LABEL_START, slot + 1, GLYPH_LABEL_END));
+		if (slot >= save._partySize)
+			continue;
+
+		const Data::RosterEntry &e = save.partyMember(slot);
+		int level = Data::fromBcd(e._experience >> 8) + 1;
+		if (level > 99)
+			level = 99;
+
+		s.writeString(Common::Point((63 - (int)strlen(e._name)) / 2, row + 1), e._name);
+		s.writeString(Common::Point(38, row + 1), Common::String::format("%c", e._status));
+		s.writeString(Common::Point(25, row + 2),
+			Common::String::format("%c%c%c M:%02X L:%02X", e._sex, e._race, e._class,
+				e._magicPoints, Data::toBcd(level)));
+		s.writeString(Common::Point(25, row + 3),
+			Common::String::format("H:%04X F:%04X", e._hitPoints, e._food));
+	}
+}
+
+void Game::drawWind(GfxSurface &s) {
+	s.writeString(Common::Point(6, 23), Common::String::format("%c%s%c",
+		GLYPH_LABEL_START, WIND_NAMES[_G(windDirection)], GLYPH_LABEL_END));
+}
+
+void Game::draw() {
+	auto s = getSurface();
+
+	s.fillRect(Common::Rect(0, 0, 320, 200), 0);
+	drawFrame(s);
+	drawPartyStatus(s);
+	drawWind(s);
+	drawViewport(s);
+	_G(messages).draw(s, !_gameOver);
+
+	Gfx::ScreenEffects &fx = _G(effects);
+	if (fx._viewport)
+		invertRect(s, Common::Rect(8, 8, 184, 184));
+	if (fx._slot >= 0)
+		invertRect(s, Common::Rect(PANEL_COL * 8, (fx._slot * PANEL_SLOT_ROWS + 1) * 8, 39 * 8,
+			(fx._slot * PANEL_SLOT_ROWS + 4) * 8));
+}
+
+} // namespace Views
+} // namespace Ultima3
+} // namespace Ultima
diff --git a/engines/ultima/ultima3/views/game.h b/engines/ultima/ultima3/views/game.h
new file mode 100644
index 00000000000..27762c6a895
--- /dev/null
+++ b/engines/ultima/ultima3/views/game.h
@@ -0,0 +1,98 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef ULTIMA3_VIEWS_GAME_H
+#define ULTIMA3_VIEWS_GAME_H
+
+#include "graphics/views/view.h"
+
+namespace Ultima {
+namespace Ultima3 {
+namespace Views {
+
+using namespace Graphics::Views;
+
+constexpr int FRAME_COLS = 40;
+
+/**
+ * Base for the in-game screens. It draws the frame around the 11x11 tile
+ * viewport on the left, the party's status panels and the scrolling message
+ * window on the right, and runs the animation that goes on while waiting
+ * for a command. Derived views supply the contents of the viewport.
+ */
+class Game : public View {
+private:
+	int _idleFrames = 0;
+	int _windCounter = 1;
+
+	void drawFrame(GfxSurface &s);
+	void drawPartyStatus(GfxSurface &s);
+	void drawWind(GfxSurface &s);
+	void invertRect(GfxSurface &s, const Common::Rect &r);
+
+	/**
+	 * Every so often picks a new wind direction
+	 */
+	void updateWind();
+
+protected:
+	bool _gameOver = false;
+
+	/**
+	 * Draws the 11x11 tile viewport
+	 */
+	virtual void drawViewport(GfxSurface &s) = 0;
+
+	/**
+	 * Called when no command has been given for several seconds
+	 */
+	virtual void idleTimeout() = 0;
+
+	/**
+	 * Resets the state for a new game
+	 */
+	void startGame();
+
+	/**
+	 * Prints the command prompt and restarts the wait for a command
+	 */
+	void startPrompt();
+
+	/**
+	 * Ends the game if every party member is dead, showing why
+	 * @returns		True if the game is over
+	 */
+	bool checkPartyWipedOut();
+
+public:
+	Game(const Common::String &name) : View(name) {}
+	~Game() override {}
+
+	bool msgFocus(const FocusMessage &msg) override;
+	void draw() override;
+	void timeout() override;
+};
+
+} // namespace Views
+} // namespace Ultima3
+} // namespace Ultima
+
+#endif
diff --git a/engines/ultima/ultima3/views/main_menu.cpp b/engines/ultima/ultima3/views/main_menu.cpp
index a5c46ebc9bd..25bd2de406d 100644
--- a/engines/ultima/ultima3/views/main_menu.cpp
+++ b/engines/ultima/ultima3/views/main_menu.cpp
@@ -64,9 +64,12 @@ bool MainMenu::msgKeypress(const KeypressMessage &msg) {
 			addView("PartyMenu");
 			break;
 		case 'J':
-			// Setting out is wired up once the world engine lands
-			if (_G(savegame)._partySize == 0 || !_G(savegame).hasLivingPartyMember())
+			if (_G(savegame)._partySize == 0 || !_G(savegame).hasLivingPartyMember()) {
 				addView("JourneyOnward");
+			} else {
+				replaceView("OverworldMap", true);
+				return true;
+			}
 			break;
 		default:
 			close();
diff --git a/engines/ultima/ultima3/views/overworld_map.cpp b/engines/ultima/ultima3/views/overworld_map.cpp
new file mode 100644
index 00000000000..4d897e889fc
--- /dev/null
+++ b/engines/ultima/ultima3/views/overworld_map.cpp
@@ -0,0 +1,181 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "ultima/ultima3/views/overworld_map.h"
+#include "ultima/ultima3/views/menu_input.h"
+#include "ultima/ultima3/ultima3.h"
+
+namespace Ultima {
+namespace Ultima3 {
+namespace Views {
+
+constexpr int VIEWPORT_CELLS = VIEWPORT_TILES * VIEWPORT_TILES;
+constexpr int VIEWPORT_CENTER = VIEWPORT_CELLS / 2;
+constexpr byte TILE_HIDDEN = 0x24;
+constexpr byte TILE_FOREST = 3;
+constexpr byte TILE_MOUNTAINS = 4;
+constexpr byte TILE_WALL = 0x23;
+
+// Tiles that block the view of whatever lies behind them
+static bool blocksView(byte tile) {
+	return tile == TILE_FOREST || tile == TILE_MOUNTAINS || tile == TILE_WALL || tile == TILE_HIDDEN;
+}
+
+// The direction a position at a given offset from the centre should step to
+// get a line closer to the middle of the viewport
+static int stepToCentre(int pos) {
+	const int centre = VIEWPORT_TILES / 2;
+	return pos < centre ? 1 : (pos > centre ? -1 : 0);
+}
+
+bool OverworldMap::msgFocus(const FocusMessage &msg) {
+	// A new game starts when arriving from the main menu
+	if (msg._priorView && msg._priorView->getName() == "MainMenu") {
+		startGame();
+		_G(map).load("SOSARIA.ULT");
+		_G(shapes).load();
+		startPrompt();
+	}
+
+	return Game::msgFocus(msg);
+}
+
+void OverworldMap::buildViewport(byte *tiles) const {
+	const Data::Savegame &save = _G(savegame);
+	const int half = VIEWPORT_TILES / 2;
+
+	for (int row = 0; row < VIEWPORT_TILES; ++row) {
+		for (int col = 0; col < VIEWPORT_TILES; ++col)
+			tiles[row * VIEWPORT_TILES + col] = _G(map).tile(save._posX - half + col, save._posY - half + row);
+	}
+
+	tiles[VIEWPORT_CENTER] = save._transport;
+
+	// Working from the far corner in, hide each tile if the straight run of
+	// tiles between it and the party is blocked. Tiles hidden earlier hide
+	// in turn whatever is behind them
+	for (int idx = VIEWPORT_CELLS - 1; idx >= 0; --idx) {
+		int col = idx % VIEWPORT_TILES, row = idx / VIEWPORT_TILES;
+		int pos = idx;
+
+		for (;;) {
+			pos += stepToCentre(col) + stepToCentre(row) * VIEWPORT_TILES;
+			if (pos == VIEWPORT_CENTER)
+				break;
+
+			if (blocksView(tiles[pos])) {
+				tiles[idx] = TILE_HIDDEN;
+				break;
+			}
+
+			col += stepToCentre(col);
+			row += stepToCentre(row);
+		}
+	}
+}
+
+void OverworldMap::drawViewport(GfxSurface &s) {
+	byte tiles[VIEWPORT_CELLS];
+	buildViewport(tiles);
+
+	for (int row = 0; row < VIEWPORT_TILES; ++row) {
+		for (int col = 0; col < VIEWPORT_TILES; ++col)
+			_G(shapes).drawTile(s, 8 + col * Gfx::SHAPE_SIZE, 8 + row * Gfx::SHAPE_SIZE,
+				tiles[row * VIEWPORT_TILES + col]);
+	}
+
+	s.addDirtyRect(Common::Rect(8, 8, 8 + VIEWPORT_TILES * Gfx::SHAPE_SIZE, 8 + VIEWPORT_TILES * Gfx::SHAPE_SIZE));
+}
+
+void OverworldMap::endTurn() {
+	_logic.incrementMoveCounter();
+	_logic.processPartyTurnEffects(true);
+
+	if (!checkPartyWipedOut())
+		startPrompt();
+}
+
+void OverworldMap::doMove(Direction dir, const char *label) {
+	_G(messages).print(label);
+
+	if (!_logic.move(dir)) {
+		_G(messages).print("Invalid Move!\n");
+		g_engine->playSoundEffect(0xFF);
+	}
+
+	endTurn();
+}
+
+void OverworldMap::doPass() {
+	_G(messages).print("Pass\n");
+	endTurn();
+}
+
+void OverworldMap::doInvalid() {
+	_G(messages).print("<-What?\n");
+	g_engine->playSoundEffect(0xFE);
+	endTurn();
+}
+
+void OverworldMap::idleTimeout() {
+	doPass();
+}
+
+bool OverworldMap::msgKeypress(const KeypressMessage &msg) {
+	if (isModifierKey(msg.keycode))
+		return true;
+
+	if (_gameOver) {
+		replaceView("Title", true);
+		return true;
+	}
+
+	switch (msg.keycode) {
+	case Common::KEYCODE_UP:
+	case Common::KEYCODE_KP8:
+		doMove(DIR_NORTH, "North\n");
+		break;
+	case Common::KEYCODE_DOWN:
+	case Common::KEYCODE_KP2:
+		doMove(DIR_SOUTH, "South\n");
+		break;
+	case Common::KEYCODE_RIGHT:
+	case Common::KEYCODE_KP6:
+		doMove(DIR_EAST, "East\n");
+		break;
+	case Common::KEYCODE_LEFT:
+	case Common::KEYCODE_KP4:
+		doMove(DIR_WEST, "West\n");
+		break;
+	case Common::KEYCODE_SPACE:
+		doPass();
+		break;
+	default:
+		doInvalid();
+		break;
+	}
+
+	return true;
+}
+
+} // namespace Views
+} // namespace Ultima3
+} // namespace Ultima
diff --git a/engines/ultima/ultima3/views/overworld_map.h b/engines/ultima/ultima3/views/overworld_map.h
new file mode 100644
index 00000000000..b08fdb7c459
--- /dev/null
+++ b/engines/ultima/ultima3/views/overworld_map.h
@@ -0,0 +1,73 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef ULTIMA3_VIEWS_OVERWORLD_MAP_H
+#define ULTIMA3_VIEWS_OVERWORLD_MAP_H
+
+#include "ultima/ultima3/logic/overworld_logic.h"
+#include "ultima/ultima3/views/game.h"
+
+namespace Ultima {
+namespace Ultima3 {
+namespace Views {
+
+constexpr int VIEWPORT_TILES = 11;
+
+/**
+ * The world map, seen as an 11x11 area of tiles centred on the party.
+ * Forests and mountains hide whatever is behind them
+ */
+class OverworldMap : public Game {
+private:
+	OverworldLogic _logic;
+
+	/**
+	 * Fills in the tile numbers for the viewport, with the party's transport
+	 * in the middle and hidden tiles blanked out
+	 */
+	void buildViewport(byte *tiles) const;
+
+	void doMove(Direction dir, const char *label);
+	void doPass();
+	void doInvalid();
+
+	/**
+	 * Carries out what happens once a command has taken a turn
+	 */
+	void endTurn();
+
+protected:
+	void drawViewport(GfxSurface &s) override;
+	void idleTimeout() override;
+
+public:
+	OverworldMap() : Game("OverworldMap") {}
+	~OverworldMap() override {}
+
+	bool msgFocus(const FocusMessage &msg) override;
+	bool msgKeypress(const KeypressMessage &msg) override;
+};
+
+} // namespace Views
+} // namespace Ultima3
+} // namespace Ultima
+
+#endif
diff --git a/engines/ultima/ultima3/views/views.h b/engines/ultima/ultima3/views/views.h
index d23dc2af5d9..9ea84b20cd3 100644
--- a/engines/ultima/ultima3/views/views.h
+++ b/engines/ultima/ultima3/views/views.h
@@ -30,6 +30,7 @@
 #include "ultima/ultima3/views/journey_onward.h"
 #include "ultima/ultima3/views/logo_screen.h"
 #include "ultima/ultima3/views/main_menu.h"
+#include "ultima/ultima3/views/overworld_map.h"
 #include "ultima/ultima3/views/party_menu.h"
 #include "ultima/ultima3/views/register.h"
 #include "ultima/ultima3/views/terminate_character.h"
@@ -47,6 +48,7 @@ struct Views {
 	JourneyOnward _journeyOnward;
 	LogoScreen _logoScreen;
 	MainMenu _mainMenu;
+	OverworldMap _overworldMap;
 	PartyMenu _partyMenu;
 	Register _register;
 	TerminateCharacter _terminateCharacter;


Commit: 56bc443edc55da6e9525ec517ffff1090ac0fc80
    https://github.com/scummvm/scummvm/commit/56bc443edc55da6e9525ec517ffff1090ac0fc80
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:41:00+11:00

Commit Message:
ULTIMA: ULTIMA3: Add saving and loading of the roster, party and world

Changed paths:
  A engines/ultima/ultima3/data/roster.cpp
    engines/ultima/module.mk
    engines/ultima/ultima3/data/map.cpp
    engines/ultima/ultima3/data/map.h
    engines/ultima/ultima3/data/roster.h
    engines/ultima/ultima3/data/savegame.cpp
    engines/ultima/ultima3/data/savegame.h
    engines/ultima/ultima3/ultima3.cpp
    engines/ultima/ultima3/ultima3.h
    engines/ultima/ultima3/views/overworld_map.cpp


diff --git a/engines/ultima/module.mk b/engines/ultima/module.mk
index 059c90c45ad..4c48d3c7d5d 100644
--- a/engines/ultima/module.mk
+++ b/engines/ultima/module.mk
@@ -164,6 +164,7 @@ MODULE_OBJS += \
 	ultima3/metaengine.o \
 	ultima3/data/data.o \
 	ultima3/data/map.o \
+	ultima3/data/roster.o \
 	ultima3/data/savegame.o \
 	ultima3/gfx/charset.o \
 	ultima3/gfx/message_log.o \
diff --git a/engines/ultima/ultima3/data/map.cpp b/engines/ultima/ultima3/data/map.cpp
index b58d8437877..66f000f318f 100644
--- a/engines/ultima/ultima3/data/map.cpp
+++ b/engines/ultima/ultima3/data/map.cpp
@@ -32,6 +32,10 @@ void Map::load(const char *filename) {
 		error("Could not load %s", filename);
 }
 
+void Map::synchronize(Common::Serializer &s) {
+	s.syncBytes(_cells, sizeof(_cells));
+}
+
 } // namespace Data
 } // namespace Ultima3
 } // namespace Ultima
diff --git a/engines/ultima/ultima3/data/map.h b/engines/ultima/ultima3/data/map.h
index 9e6cf045f93..0c5adf6b7d9 100644
--- a/engines/ultima/ultima3/data/map.h
+++ b/engines/ultima/ultima3/data/map.h
@@ -23,6 +23,7 @@
 #define ULTIMA3_DATA_MAP_H
 
 #include "common/scummsys.h"
+#include "common/serializer.h"
 
 namespace Ultima {
 namespace Ultima3 {
@@ -44,6 +45,8 @@ public:
 	 */
 	void load(const char *filename);
 
+	void synchronize(Common::Serializer &s);
+
 	/**
 	 * Returns the raw cell value. The coordinates wrap around the map
 	 */
diff --git a/engines/ultima/ultima3/data/roster.cpp b/engines/ultima/ultima3/data/roster.cpp
new file mode 100644
index 00000000000..c85b570e0f2
--- /dev/null
+++ b/engines/ultima/ultima3/data/roster.cpp
@@ -0,0 +1,59 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "ultima/ultima3/data/roster.h"
+
+namespace Ultima {
+namespace Ultima3 {
+namespace Data {
+
+void RosterEntry::synchronize(Common::Serializer &s) {
+	s.syncBytes((byte *)_name, sizeof(_name));
+	s.syncAsByte(_marksAndCards);
+	s.syncAsByte(_torches);
+	s.syncAsByte(_partyMember);
+	s.syncAsByte(_status);
+	s.syncAsByte(_strength);
+	s.syncAsByte(_dexterity);
+	s.syncAsByte(_intelligence);
+	s.syncAsByte(_wisdom);
+	s.syncAsByte(_race);
+	s.syncAsByte(_class);
+	s.syncAsByte(_sex);
+	s.syncAsByte(_magicPoints);
+	s.syncAsUint16LE(_hitPoints);
+	s.syncAsUint16LE(_maxHitPoints);
+	s.syncAsUint16LE(_experience);
+	s.syncAsByte(_foodSubCounter);
+	s.syncAsUint16LE(_food);
+	s.syncAsUint16LE(_gold);
+	s.syncAsByte(_gems);
+	s.syncAsByte(_keys);
+	s.syncAsByte(_powder);
+	s.syncAsByte(_armourIndex);
+	s.syncBytes(_armourOwned, sizeof(_armourOwned));
+	s.syncAsByte(_weaponIndex);
+	s.syncBytes(_weaponOwned, sizeof(_weaponOwned));
+}
+
+} // namespace Data
+} // namespace Ultima3
+} // namespace Ultima
diff --git a/engines/ultima/ultima3/data/roster.h b/engines/ultima/ultima3/data/roster.h
index 8bb2f75d183..9c5a9f0e535 100644
--- a/engines/ultima/ultima3/data/roster.h
+++ b/engines/ultima/ultima3/data/roster.h
@@ -23,6 +23,7 @@
 #define ULTIMA3_DATA_ROSTER_H
 
 #include "common/scummsys.h"
+#include "common/serializer.h"
 
 namespace Ultima {
 namespace Ultima3 {
@@ -105,6 +106,8 @@ struct RosterEntry {
 	bool isAlive() const {
 		return _status == STATUS_GOOD || _status == STATUS_POISONED;
 	}
+
+	void synchronize(Common::Serializer &s);
 };
 
 } // namespace Data
diff --git a/engines/ultima/ultima3/data/savegame.cpp b/engines/ultima/ultima3/data/savegame.cpp
index d58495f6ac6..b5a66947e2a 100644
--- a/engines/ultima/ultima3/data/savegame.cpp
+++ b/engines/ultima/ultima3/data/savegame.cpp
@@ -52,6 +52,23 @@ void Savegame::clearPartySelection() {
 	}
 }
 
+void Savegame::synchronize(Common::Serializer &s) {
+	for (int i = 0; i < ROSTER_COUNT; ++i)
+		_roster[i].synchronize(s);
+
+	byte partySize = _partySize;
+	s.syncBytes(_partyEntries, PARTY_MAX);
+	s.syncAsByte(partySize);
+	_partySize = partySize;
+
+	s.syncAsByte(_transport);
+	s.syncAsByte(_location);
+	s.syncAsByte(_posX);
+	s.syncAsByte(_posY);
+	s.syncBytes(_moveCount, sizeof(_moveCount));
+	s.syncAsByte(_mapLoaded);
+}
+
 void Savegame::formParty() {
 	_transport = TRANSPORT_ON_FOOT;
 	_location = LOCATION_SOSARIA;
diff --git a/engines/ultima/ultima3/data/savegame.h b/engines/ultima/ultima3/data/savegame.h
index fbab96c1ebb..95b4bb6b6c1 100644
--- a/engines/ultima/ultima3/data/savegame.h
+++ b/engines/ultima/ultima3/data/savegame.h
@@ -43,6 +43,9 @@ struct Savegame {
 	byte _posY = 0;
 	byte _moveCount[4] = {};
 
+	// Set once the world map has been loaded, which the map in a save then replaces
+	bool _mapLoaded = false;
+
 	/**
 	 * Returns a roster entry by its 1-based number
 	 */
@@ -69,6 +72,8 @@ struct Savegame {
 	 */
 	void clearPartySelection();
 
+	void synchronize(Common::Serializer &s);
+
 	/**
 	 * Completes a selected party, placing it at the starting point on foot
 	 */
diff --git a/engines/ultima/ultima3/ultima3.cpp b/engines/ultima/ultima3/ultima3.cpp
index 1df3d0469af..8dab72f71ef 100644
--- a/engines/ultima/ultima3/ultima3.cpp
+++ b/engines/ultima/ultima3/ultima3.cpp
@@ -74,15 +74,31 @@ Common::Error Ultima3Engine::run() {
 }
 
 bool Ultima3Engine::canSaveGameStateCurrently(Common::U32String *msg) {
-	return false;
+	// Anything but the title sequence, which isn't a state worth keeping
+	UIElement *view = focusedView();
+
+	return dynamic_cast<Views::Game *>(view) != nullptr ||
+		dynamic_cast<Views::WindowView *>(view) != nullptr;
 }
 
 bool Ultima3Engine::canLoadGameStateCurrently(Common::U32String *msg) {
-	return false;
+	return true;
 }
 
 Common::Error Ultima3Engine::syncGame(Common::Serializer &s) {
-	// TODO
+	s.syncVersion(1);
+
+	_savegame.synchronize(s);
+	if (_savegame._mapLoaded)
+		_map.synchronize(s);
+
+	if (s.isLoading()) {
+		// Carry on in the world if there's a party able to adventure in it,
+		// otherwise return to where the party can be organized
+		_resumeGame = _savegame._mapLoaded && _savegame._partySize > 0 &&
+			_savegame.hasLivingPartyMember();
+		replaceView(_resumeGame ? "OverworldMap" : "LogoScreen", true);
+	}
 
 	return Common::kNoError;
 }
diff --git a/engines/ultima/ultima3/ultima3.h b/engines/ultima/ultima3/ultima3.h
index efce7fc11ec..0437b9a7392 100644
--- a/engines/ultima/ultima3/ultima3.h
+++ b/engines/ultima/ultima3/ultima3.h
@@ -95,6 +95,9 @@ public:
 	Gfx::ScreenEffects _effects;
 	byte _windDirection = 0;
 
+	// Set when a loaded game should continue in the world rather than start it
+	bool _resumeGame = false;
+
 	// Debug flag toggled by the "intangible" console command, allowing
 	// movement through normally impassable terrain
 	bool _intangible = false;
diff --git a/engines/ultima/ultima3/views/overworld_map.cpp b/engines/ultima/ultima3/views/overworld_map.cpp
index 4d897e889fc..06210632935 100644
--- a/engines/ultima/ultima3/views/overworld_map.cpp
+++ b/engines/ultima/ultima3/views/overworld_map.cpp
@@ -47,11 +47,18 @@ static int stepToCentre(int pos) {
 }
 
 bool OverworldMap::msgFocus(const FocusMessage &msg) {
-	// A new game starts when arriving from the main menu
-	if (msg._priorView && msg._priorView->getName() == "MainMenu") {
+	// The game starts when arriving from the main menu, or continues on from a load
+	bool fromMenu = msg._priorView && msg._priorView->getName() == "MainMenu";
+	if (fromMenu || _G(resumeGame)) {
 		startGame();
-		_G(map).load("SOSARIA.ULT");
 		_G(shapes).load();
+
+		if (!_G(savegame)._mapLoaded) {
+			_G(map).load("SOSARIA.ULT");
+			_G(savegame)._mapLoaded = true;
+		}
+
+		_G(resumeGame) = false;
 		startPrompt();
 	}
 


Commit: f3dee90464800a485eaef3da53d47ce269e3fb29
    https://github.com/scummvm/scummvm/commit/f3dee90464800a485eaef3da53d47ce269e3fb29
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:41:00+11:00

Commit Message:
ULTIMA: ULTIMA3: Added f5/f7 keys for save/load game dialog

Changed paths:
  A engines/ultima/shared/engine/view.cpp
    engines/ultima/module.mk
    engines/ultima/shared/engine/view.h
    engines/ultima/ultima2/views/map.cpp
    engines/ultima/ultima3/views/game.h
    engines/ultima/ultima3/views/overworld_map.cpp
    engines/ultima/ultima3/views/window_view.h


diff --git a/engines/ultima/module.mk b/engines/ultima/module.mk
index 4c48d3c7d5d..ca13ed6feda 100644
--- a/engines/ultima/module.mk
+++ b/engines/ultima/module.mk
@@ -7,7 +7,8 @@ MODULE_OBJS := \
 	shared/engine/events.o \
 	shared/engine/messages.o \
 	shared/gfx/gfx_surface.o \
-	shared/gfx/view.o
+	shared/gfx/view.o \
+	shared/engine/view.o
 
 ifdef ENABLE_AKALABETH
 MODULE_OBJS += \
diff --git a/engines/ultima/shared/engine/view.cpp b/engines/ultima/shared/engine/view.cpp
new file mode 100644
index 00000000000..847aa1f1310
--- /dev/null
+++ b/engines/ultima/shared/engine/view.cpp
@@ -0,0 +1,42 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "ultima/shared/engine/view.h"
+#include "engines/engine.h"
+
+namespace Ultima {
+namespace Shared {
+
+bool View::msgKeypress(const Graphics::Views::KeypressMessage &msg) {
+	switch (msg.keycode) {
+	case Common::KEYCODE_F5:
+		g_engine->saveGameDialog();
+		return true;
+	case Common::KEYCODE_F7:
+		g_engine->loadGameDialog();
+		return true;
+	default:
+		return Graphics::Views::View::msgKeypress(msg);
+	}
+}
+
+} // namespace Shared
+} // namespace Ultima
diff --git a/engines/ultima/shared/engine/view.h b/engines/ultima/shared/engine/view.h
index ced1b1c5551..db0c6da9037 100644
--- a/engines/ultima/shared/engine/view.h
+++ b/engines/ultima/shared/engine/view.h
@@ -50,6 +50,8 @@ public:
 		s.setColor(15);		// EGA white color
 		return s;
 	}
+
+	bool msgKeypress(const Graphics::Views::KeypressMessage &msg) override;
 };
 
 } // namespace Shared
diff --git a/engines/ultima/ultima2/views/map.cpp b/engines/ultima/ultima2/views/map.cpp
index 3be9a21553a..a0bdc66840a 100644
--- a/engines/ultima/ultima2/views/map.cpp
+++ b/engines/ultima/ultima2/views/map.cpp
@@ -72,9 +72,13 @@ bool Map::tick() {
 }
 
 bool Map::msgKeypress(const KeypressMessage &msg) {
-	_lastInput = g_system->getMillis();
-	g_engine->_logic->keypress(msg);
-	return true;
+	if (Shared::View::msgKeypress(msg)) {
+		return true;
+	} else {
+		_lastInput = g_system->getMillis();
+		g_engine->_logic->keypress(msg);
+		return true;
+	}
 }
 
 } // namespace Views
diff --git a/engines/ultima/ultima3/views/game.h b/engines/ultima/ultima3/views/game.h
index 27762c6a895..8d2a14dae80 100644
--- a/engines/ultima/ultima3/views/game.h
+++ b/engines/ultima/ultima3/views/game.h
@@ -22,7 +22,7 @@
 #ifndef ULTIMA3_VIEWS_GAME_H
 #define ULTIMA3_VIEWS_GAME_H
 
-#include "graphics/views/view.h"
+#include "ultima/shared/engine/view.h"
 
 namespace Ultima {
 namespace Ultima3 {
@@ -38,7 +38,7 @@ constexpr int FRAME_COLS = 40;
  * window on the right, and runs the animation that goes on while waiting
  * for a command. Derived views supply the contents of the viewport.
  */
-class Game : public View {
+class Game : public Shared::View {
 private:
 	int _idleFrames = 0;
 	int _windCounter = 1;
diff --git a/engines/ultima/ultima3/views/overworld_map.cpp b/engines/ultima/ultima3/views/overworld_map.cpp
index 06210632935..45e04a6ac47 100644
--- a/engines/ultima/ultima3/views/overworld_map.cpp
+++ b/engines/ultima/ultima3/views/overworld_map.cpp
@@ -149,6 +149,8 @@ void OverworldMap::idleTimeout() {
 bool OverworldMap::msgKeypress(const KeypressMessage &msg) {
 	if (isModifierKey(msg.keycode))
 		return true;
+	if (Game::msgKeypress(msg))
+		return true;
 
 	if (_gameOver) {
 		replaceView("Title", true);
diff --git a/engines/ultima/ultima3/views/window_view.h b/engines/ultima/ultima3/views/window_view.h
index 35b4946b8b7..cc70e8c84e3 100644
--- a/engines/ultima/ultima3/views/window_view.h
+++ b/engines/ultima/ultima3/views/window_view.h
@@ -22,7 +22,7 @@
 #ifndef ULTIMA3_VIEWS_WINDOW_VIEW_H
 #define ULTIMA3_VIEWS_WINDOW_VIEW_H
 
-#include "graphics/views/view.h"
+#include "ultima/shared/engine/view.h"
 
 namespace Ultima {
 namespace Ultima3 {
@@ -35,7 +35,7 @@ using namespace Graphics::Views;
  * bordered window at the bottom of the display, over whatever the title
  * screen left above it
  */
-class WindowView : public View {
+class WindowView : public Shared::View {
 protected:
 	/**
 	 * Blanks the inside of the window


Commit: 8b6486a94040375ed87986c913d0cc00f8ac7a9f
    https://github.com/scummvm/scummvm/commit/8b6486a94040375ed87986c913d0cc00f8ac7a9f
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:41:00+11:00

Commit Message:
ULTIMA: ULTIMA3: Fix force field and lava terrain names

Changed paths:
    engines/ultima/ultima3/logic/overworld_logic.cpp


diff --git a/engines/ultima/ultima3/logic/overworld_logic.cpp b/engines/ultima/ultima3/logic/overworld_logic.cpp
index 5afb2439cc1..746ca9cf84d 100644
--- a/engines/ultima/ultima3/logic/overworld_logic.cpp
+++ b/engines/ultima/ultima3/logic/overworld_logic.cpp
@@ -28,18 +28,18 @@ namespace Ultima3 {
 constexpr byte TILE_WATER = 0;
 constexpr byte TILE_MOUNTAINS = 4;
 constexpr byte TILE_SHIP_WATER = 12;
-constexpr byte TILE_FIRE = 0x20;
-constexpr byte TILE_FORCE_FIELD = 0x21;
-constexpr byte TILE_WHIRLPOOL = 0x22;
+constexpr byte TILE_FORCE_FIELD = 0x20;
+constexpr byte TILE_LAVA = 0x21;
+constexpr byte TILE_MOON_GATE = 0x22;
 constexpr byte TILE_SHALLOWS = 0x3E;
 constexpr byte FIRST_BLOCKING_TILE = 12;
 
 // Bits of a character's marks and cards that protect against terrain
-constexpr byte MARK_FIRE = 0x10;
-constexpr byte MARK_FORCE = 0x20;
+constexpr byte MARK_FORCE = 0x10;
+constexpr byte MARK_FIRE = 0x20;
 
-constexpr int FIRE_DAMAGE = 99;
-constexpr int FORCE_FIELD_DAMAGE = 50;
+constexpr int FORCE_FIELD_DAMAGE = 99;
+constexpr int LAVA_DAMAGE = 50;
 
 bool OverworldLogic::isShipBlockedByWind(Direction dir) const {
 	if (_G(savegame)._transport != TRANSPORT_SHIP)
@@ -55,32 +55,32 @@ bool OverworldLogic::isTerrainBlocked(byte tile) {
 		return tile != TILE_WATER && tile != TILE_SHIP_WATER;
 
 	switch (tile) {
-	case TILE_FIRE:
-		// The whole party needs the Mark of Fire to cross it. Otherwise the
-		// first without it is burnt, and the fire can't be crossed
+	case TILE_FORCE_FIELD:
+		// The whole party needs the Mark of Force to cross it. Otherwise the
+		// first without it is hurt, and the field can't be crossed
 		_G(effects).flashViewport();
 		for (int slot = 0; slot < save._partySize; ++slot) {
-			if (!(save.partyMember(slot)._marksAndCards & MARK_FIRE)) {
-				damageCharacter(slot, FIRE_DAMAGE);
+			if (!(save.partyMember(slot)._marksAndCards & MARK_FORCE)) {
+				damageCharacter(slot, FORCE_FIELD_DAMAGE);
 				_G(effects).flashSlot(slot);
 				return true;
 			}
 		}
 		return false;
 
-	case TILE_FORCE_FIELD:
-		// Anyone without the Mark of Force is hurt, but it can be crossed
+	case TILE_LAVA:
+		// Anyone without the Mark of Fire is burnt, but it can be crossed
 		for (int slot = 0; slot < save._partySize; ++slot) {
 			Data::RosterEntry &e = save.partyMember(slot);
 
-			if (e.isAlive() && !(e._marksAndCards & MARK_FORCE)) {
-				damageCharacter(slot, FORCE_FIELD_DAMAGE);
+			if (e.isAlive() && !(e._marksAndCards & MARK_FIRE)) {
+				damageCharacter(slot, LAVA_DAMAGE);
 				_G(effects).flashSlot(slot);
 			}
 		}
 		return false;
 
-	case TILE_WHIRLPOOL:
+	case TILE_MOON_GATE:
 	case TILE_SHALLOWS:
 		return false;
 


Commit: be850c63e28e1b81476dcb2f41462f63d3f0dc16
    https://github.com/scummvm/scummvm/commit/be850c63e28e1b81476dcb2f41462f63d3f0dc16
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:41:00+11:00

Commit Message:
ULTIMA: ULTIMA3: Add the board, exit, look, ztats, ready, wear, order and volume commands

Changed paths:
  A engines/ultima/ultima3/views/interactions/equip.cpp
  A engines/ultima/ultima3/views/interactions/equip.h
  A engines/ultima/ultima3/views/interactions/exchange.cpp
  A engines/ultima/ultima3/views/interactions/exchange.h
  A engines/ultima/ultima3/views/interactions/interaction.cpp
  A engines/ultima/ultima3/views/interactions/interaction.h
  A engines/ultima/ultima3/views/interactions/look.cpp
  A engines/ultima/ultima3/views/interactions/look.h
  A engines/ultima/ultima3/views/interactions/ztats.cpp
  A engines/ultima/ultima3/views/interactions/ztats.h
    engines/ultima/module.mk
    engines/ultima/ultima3/data/data.cpp
    engines/ultima/ultima3/data/data.h
    engines/ultima/ultima3/data/savegame.cpp
    engines/ultima/ultima3/data/savegame.h
    engines/ultima/ultima3/gfx/message_log.cpp
    engines/ultima/ultima3/gfx/message_log.h
    engines/ultima/ultima3/gfx/screen_effects.h
    engines/ultima/ultima3/logic/overworld_logic.cpp
    engines/ultima/ultima3/logic/overworld_logic.h
    engines/ultima/ultima3/ultima3.cpp
    engines/ultima/ultima3/ultima3.h
    engines/ultima/ultima3/views/game.cpp
    engines/ultima/ultima3/views/game.h
    engines/ultima/ultima3/views/menu_input.cpp
    engines/ultima/ultima3/views/menu_input.h
    engines/ultima/ultima3/views/overworld_map.cpp
    engines/ultima/ultima3/views/overworld_map.h


diff --git a/engines/ultima/module.mk b/engines/ultima/module.mk
index ca13ed6feda..094fc7068ee 100644
--- a/engines/ultima/module.mk
+++ b/engines/ultima/module.mk
@@ -178,6 +178,11 @@ MODULE_OBJS += \
 	ultima3/views/disperse_party.o \
 	ultima3/views/form_party.o \
 	ultima3/views/game.o \
+	ultima3/views/interactions/equip.o \
+	ultima3/views/interactions/exchange.o \
+	ultima3/views/interactions/interaction.o \
+	ultima3/views/interactions/look.o \
+	ultima3/views/interactions/ztats.o \
 	ultima3/views/journey_onward.o \
 	ultima3/views/logo_screen.o \
 	ultima3/views/main_menu.o \
diff --git a/engines/ultima/ultima3/data/data.cpp b/engines/ultima/ultima3/data/data.cpp
index fedfe30c372..fa339949a4f 100644
--- a/engines/ultima/ultima3/data/data.cpp
+++ b/engines/ultima/ultima3/data/data.cpp
@@ -60,6 +60,28 @@ const char *const ARMOUR_NAMES[ARMOUR_COUNT] = {
 	"Skin", "Cloth", "Leather", "Chain", "Plate", "+2 Chain", "+2 Plate", "Exotic"
 };
 
+const char *const NAMES[NAME_COUNT] = {
+	"Water", "Grass", "Brush", "Forest", "Mountains", "Dungeon", "Towne",
+	"Castle", "Floor", "Chest", "Horse", "Frigate", "Whirlpool", "Serpent",
+	"Man-O-War", "Pirate", "Merchant", "Jester", "Guard", "Lord British",
+	"Fighter", "Cleric", "Wizard", "Thief", "Orc", "Skeleton", "Giant",
+	"Daemon", "Pincher", "Dragon", "Balron", "Exodus", "Force Field", "Lava",
+	"Moon Gate", "Wall", "Void", "Wall", "A", "B", "C", "D", "E", "F", "G", "H",
+	"I", "U", "Y", "L", "M", "N", "O", "P", "W", "R", "S", "T", "Snake",
+	"Snake", "Magic", "Fire", "Shrine", "Ranger", "Hand", "Dagger", "Mace",
+	"Sling", "Axe", "Bow", "Sword", "2-H-Swd", "+2 Axe", "+2 Bow", "+2 Swd",
+	"Gloves", "+4 Axe", "+4 Bow", "+4 Swd", "Exotic", "Skin", "Cloth",
+	"Leather", "Chain", "Plate", "+2 Chain", "+2 Plate", "Exotic", "Repond",
+	"Mittar", "Lorum", "Dor Acron", "Sur Acron", "Fulgar", "Dag Acron",
+	"Mentar", "Dag Lorum", "Fal Divi", "Noxum", "Decorp", "Altair",
+	"Dag Mentar", "Necorp", "", "Pontori", "Appar Unem", "Sanctu", "Luminae",
+	"Rec Su", "Rec Du", "Lib Rec", "Alcort", "Sequitu", "Sominae",
+	"Sanctu Mani", "Vieda", "Excuun", "Surmandum", "Zxkuqyb", "Anju Sermani",
+	"Brigand", "Cutpurse", "Goblin", "Troll", "Ghoul", "Zombie", "Golem",
+	"Titan", "Gargoyle", "Mane", "Snatch", "Bradle", "Griffon", "Wyvern",
+	"Orcus", "Devil"
+};
+
 int lookupIndex(char key, const char *keys, int count) {
 	for (int i = 0; i < count; ++i) {
 		if (keys[i] == key)
diff --git a/engines/ultima/ultima3/data/data.h b/engines/ultima/ultima3/data/data.h
index 3369f2f0435..c2802f08673 100644
--- a/engines/ultima/ultima3/data/data.h
+++ b/engines/ultima/ultima3/data/data.h
@@ -42,6 +42,7 @@ constexpr int CLASS_COUNT = 11;
 constexpr int STATUS_COUNT = 4;
 constexpr int WEAPON_COUNT = 16;
 constexpr int ARMOUR_COUNT = 8;
+constexpr int NAME_COUNT = 136;
 
 extern const char SEX_KEYS[];
 extern const char RACE_KEYS[];
@@ -54,6 +55,10 @@ extern const char *const STATUS_NAMES[STATUS_COUNT];
 extern const char *const WEAPON_NAMES[WEAPON_COUNT];
 extern const char *const ARMOUR_NAMES[ARMOUR_COUNT];
 
+// The game's table of terrain, creature, equipment and spell names, which
+// are referred to by a number starting at 1
+extern const char *const NAMES[NAME_COUNT];
+
 /**
  * Returns the index of a key within the first count entries of a key list.
  * As in the original, a key that isn't present maps to the last entry.
diff --git a/engines/ultima/ultima3/data/savegame.cpp b/engines/ultima/ultima3/data/savegame.cpp
index b5a66947e2a..506a9865a38 100644
--- a/engines/ultima/ultima3/data/savegame.cpp
+++ b/engines/ultima/ultima3/data/savegame.cpp
@@ -67,6 +67,13 @@ void Savegame::synchronize(Common::Serializer &s) {
 	s.syncAsByte(_posY);
 	s.syncBytes(_moveCount, sizeof(_moveCount));
 	s.syncAsByte(_mapLoaded);
+
+	if (s.getVersion() >= 2) {
+		s.syncAsByte(_allWeapons);
+		s.syncAsByte(_allArmour);
+		s.syncAsByte(_plusTwoWeapons);
+		s.syncAsByte(_plusTwoArmour);
+	}
 }
 
 void Savegame::formParty() {
diff --git a/engines/ultima/ultima3/data/savegame.h b/engines/ultima/ultima3/data/savegame.h
index 95b4bb6b6c1..b74cafaa485 100644
--- a/engines/ultima/ultima3/data/savegame.h
+++ b/engines/ultima/ultima3/data/savegame.h
@@ -43,6 +43,13 @@ struct Savegame {
 	byte _posY = 0;
 	byte _moveCount[4] = {};
 
+	// Set once the party has seen the more powerful gear offered in the
+	// shops, making it available for readying and wearing
+	bool _allWeapons = false;
+	bool _allArmour = false;
+	bool _plusTwoWeapons = false;
+	bool _plusTwoArmour = false;
+
 	// Set once the world map has been loaded, which the map in a save then replaces
 	bool _mapLoaded = false;
 
diff --git a/engines/ultima/ultima3/gfx/message_log.cpp b/engines/ultima/ultima3/gfx/message_log.cpp
index 0b197e94962..7550199f8be 100644
--- a/engines/ultima/ultima3/gfx/message_log.cpp
+++ b/engines/ultima/ultima3/gfx/message_log.cpp
@@ -57,6 +57,11 @@ void MessageLog::putChar(char ch) {
 	++_column;
 }
 
+void MessageLog::backspace(int count) {
+	_column = MAX(0, _column - count);
+	_lines[LOG_LINES - 1].erase(_column);
+}
+
 void MessageLog::print(const char *text) {
 	for (; *text; ++text) {
 		if (*text == '\n') {
diff --git a/engines/ultima/ultima3/gfx/message_log.h b/engines/ultima/ultima3/gfx/message_log.h
index a114ea79520..dd2bd424dd3 100644
--- a/engines/ultima/ultima3/gfx/message_log.h
+++ b/engines/ultima/ultima3/gfx/message_log.h
@@ -61,6 +61,11 @@ public:
 	 */
 	void putChar(char ch);
 
+	/**
+	 * Takes back the last characters added to the bottom line
+	 */
+	void backspace(int count);
+
 	/**
 	 * Draws the window, with the cursor arrow shown if waiting for input
 	 */
diff --git a/engines/ultima/ultima3/gfx/screen_effects.h b/engines/ultima/ultima3/gfx/screen_effects.h
index e53466433d3..11fbc279766 100644
--- a/engines/ultima/ultima3/gfx/screen_effects.h
+++ b/engines/ultima/ultima3/gfx/screen_effects.h
@@ -35,6 +35,9 @@ constexpr int FLASH_FRAMES = 3;
 struct ScreenEffects {
 	int _slot = -1;
 	bool _viewport = false;
+
+	// A party member's number kept inverted while their details are shown
+	int _highlight = -1;
 	int _frames = 0;
 
 	void flashSlot(int slot) {
diff --git a/engines/ultima/ultima3/logic/overworld_logic.cpp b/engines/ultima/ultima3/logic/overworld_logic.cpp
index 746ca9cf84d..380865abd37 100644
--- a/engines/ultima/ultima3/logic/overworld_logic.cpp
+++ b/engines/ultima/ultima3/logic/overworld_logic.cpp
@@ -38,6 +38,13 @@ constexpr byte FIRST_BLOCKING_TILE = 12;
 constexpr byte MARK_FORCE = 0x10;
 constexpr byte MARK_FIRE = 0x20;
 
+// Map cells the party's mounts are left in, and the highest cell they can
+// be left on, which is the ground they can travel over
+constexpr byte CELL_WATER = 0;
+constexpr byte CELL_GRASS = 4;
+constexpr byte CELL_HORSE = TRANSPORT_HORSE * 4;
+constexpr byte CELL_SHIP = TRANSPORT_SHIP * 4;
+
 constexpr int FORCE_FIELD_DAMAGE = 99;
 constexpr int LAVA_DAMAGE = 50;
 
@@ -104,5 +111,38 @@ bool OverworldLogic::move(Direction dir) {
 	return true;
 }
 
+const char *OverworldLogic::board() {
+	Data::Savegame &save = _G(savegame);
+	if (save._transport != TRANSPORT_ON_FOOT)
+		return nullptr;
+
+	byte cell = _G(map).cell(save._posX, save._posY);
+	if (cell == CELL_HORSE) {
+		_G(map).setCell(save._posX, save._posY, CELL_GRASS);
+		save._transport = TRANSPORT_HORSE;
+		return "Mount Horse!\n";
+	}
+	if (cell == CELL_SHIP) {
+		_G(map).setCell(save._posX, save._posY, CELL_WATER);
+		save._transport = TRANSPORT_SHIP;
+		return "Board Frigate!\n";
+	}
+
+	return nullptr;
+}
+
+OverworldLogic::ExitResult OverworldLogic::exitVehicle() {
+	Data::Savegame &save = _G(savegame);
+	if (save._transport == TRANSPORT_ON_FOOT)
+		return EXIT_NOT_RIDING;
+
+	if (_G(map).cell(save._posX, save._posY) > CELL_GRASS)
+		return EXIT_NOT_HERE;
+
+	_G(map).setCell(save._posX, save._posY, save._transport * 4);
+	save._transport = TRANSPORT_ON_FOOT;
+	return EXIT_DONE;
+}
+
 } // namespace Ultima3
 } // namespace Ultima
diff --git a/engines/ultima/ultima3/logic/overworld_logic.h b/engines/ultima/ultima3/logic/overworld_logic.h
index af9447535d9..ebfcb46fa4e 100644
--- a/engines/ultima/ultima3/logic/overworld_logic.h
+++ b/engines/ultima/ultima3/logic/overworld_logic.h
@@ -49,11 +49,28 @@ private:
 	bool isTerrainBlocked(byte tile);
 
 public:
+	enum ExitResult {
+		EXIT_NOT_RIDING,
+		EXIT_NOT_HERE,
+		EXIT_DONE
+	};
+
 	/**
 	 * Moves the party a step in a direction, if they can
 	 * @returns		True if they moved
 	 */
 	bool move(Direction dir);
+
+	/**
+	 * Mounts a horse or boards a ship that the party is standing on
+	 * @returns		What to say about it, or null if there's nothing to board
+	 */
+	const char *board();
+
+	/**
+	 * Gets off a horse or ship, leaving it behind
+	 */
+	ExitResult exitVehicle();
 };
 
 } // namespace Ultima3
diff --git a/engines/ultima/ultima3/ultima3.cpp b/engines/ultima/ultima3/ultima3.cpp
index 8dab72f71ef..c5bf5a0b897 100644
--- a/engines/ultima/ultima3/ultima3.cpp
+++ b/engines/ultima/ultima3/ultima3.cpp
@@ -86,7 +86,7 @@ bool Ultima3Engine::canLoadGameStateCurrently(Common::U32String *msg) {
 }
 
 Common::Error Ultima3Engine::syncGame(Common::Serializer &s) {
-	s.syncVersion(1);
+	s.syncVersion(2);
 
 	_savegame.synchronize(s);
 	if (_savegame._mapLoaded)
@@ -104,7 +104,7 @@ Common::Error Ultima3Engine::syncGame(Common::Serializer &s) {
 }
 
 void Ultima3Engine::queueTone(int divisor, uint32 lengthMs) {
-	if (!_pcSpeakerReady)
+	if (!_pcSpeakerReady || !_soundEnabled)
 		return;
 
 	float freq = divisor > 0 ? 1193182.0f / divisor : 0.0f;
@@ -112,7 +112,7 @@ void Ultima3Engine::queueTone(int divisor, uint32 lengthMs) {
 }
 
 void Ultima3Engine::queueSilence(uint32 lengthMs) {
-	if (!_pcSpeakerReady)
+	if (!_pcSpeakerReady || !_soundEnabled)
 		return;
 
 	_pcSpeaker->playQueue(Audio::PCSpeaker::kWaveFormSilence, 0.0f, lengthMs * 1000);
diff --git a/engines/ultima/ultima3/ultima3.h b/engines/ultima/ultima3/ultima3.h
index 0437b9a7392..90bb10e91cf 100644
--- a/engines/ultima/ultima3/ultima3.h
+++ b/engines/ultima/ultima3/ultima3.h
@@ -95,6 +95,9 @@ public:
 	Gfx::ScreenEffects _effects;
 	byte _windDirection = 0;
 
+	// Toggled in the game by the Volume command
+	bool _soundEnabled = true;
+
 	// Set when a loaded game should continue in the world rather than start it
 	bool _resumeGame = false;
 
diff --git a/engines/ultima/ultima3/views/game.cpp b/engines/ultima/ultima3/views/game.cpp
index 9b110a1212b..cb126c8556b 100644
--- a/engines/ultima/ultima3/views/game.cpp
+++ b/engines/ultima/ultima3/views/game.cpp
@@ -20,6 +20,10 @@
  */
 
 #include "ultima/ultima3/views/game.h"
+#include "ultima/ultima3/views/menu_input.h"
+#include "ultima/ultima3/views/interactions/equip.h"
+#include "ultima/ultima3/views/interactions/exchange.h"
+#include "ultima/ultima3/views/interactions/ztats.h"
 #include "ultima/ultima3/ultima3.h"
 
 namespace Ultima {
@@ -42,6 +46,8 @@ void Game::startGame() {
 	_gameOver = false;
 	_idleFrames = 0;
 	_windCounter = 1;
+	_interaction.reset();
+	_G(soundEnabled) = true;
 	_G(messages).clear();
 	_G(effects) = Gfx::ScreenEffects();
 	updateWind();
@@ -94,13 +100,85 @@ void Game::timeout() {
 	_G(effects).tick();
 	updateWind();
 
-	if (!_gameOver && ++_idleFrames >= IDLE_FRAMES)
+	if (!_gameOver && !_interaction && ++_idleFrames >= IDLE_FRAMES)
 		idleTimeout();
 
 	redraw();
 	delayFrames(1);
 }
 
+void Game::startInteraction(Interactions::Interaction *interaction) {
+	_interaction.reset(interaction);
+	redraw();
+}
+
+void Game::commandFailed(const char *text, byte sound) {
+	_G(messages).print(text);
+	g_engine->playSoundEffect(sound);
+	endTurn();
+}
+
+bool Game::handleCommand(const KeypressMessage &msg) {
+	switch (commandKey(msg)) {
+	case 'Z':
+		_G(messages).print("Ztats for # ");
+		startInteraction(new Interactions::Ztats());
+		return true;
+
+	case 'M':
+		_G(messages).print("Modify order!\nPlayer: ");
+		startInteraction(new Interactions::Exchange());
+		return true;
+
+	case 'R':
+		_G(messages).print("Ready for # ");
+		startInteraction(new Interactions::Equip(true));
+		return true;
+
+	case 'W':
+		_G(messages).print("Wear for # ");
+		startInteraction(new Interactions::Equip(false));
+		return true;
+
+	case 'V':
+		_G(soundEnabled) = !_G(soundEnabled);
+		_G(messages).print("Volume ");
+		_G(messages).print(_G(soundEnabled) ? "On!\n" : "Off!\n");
+		endTurn();
+		return true;
+
+	default:
+		return false;
+	}
+}
+
+bool Game::msgKeypress(const KeypressMessage &msg) {
+	if (isModifierKey(msg.keycode))
+		return true;
+
+	if (_gameOver) {
+		_G(soundEnabled) = true;
+		replaceView("Title", true);
+		return true;
+	}
+
+	_idleFrames = 0;
+
+	if (_interaction) {
+		if (_interaction->keypress(msg)) {
+			_interaction.reset();
+			endTurn();
+		} else {
+			redraw();
+		}
+
+		return true;
+	}
+
+	handleCommand(msg);
+	return true;
+}
+
 void Game::invertRect(GfxSurface &s, const Common::Rect &r) {
 	for (int y = r.top; y < r.bottom; ++y) {
 		byte *p = (byte *)s.getBasePtr(r.left, y);
@@ -184,6 +262,9 @@ void Game::draw() {
 	if (fx._slot >= 0)
 		invertRect(s, Common::Rect(PANEL_COL * 8, (fx._slot * PANEL_SLOT_ROWS + 1) * 8, 39 * 8,
 			(fx._slot * PANEL_SLOT_ROWS + 4) * 8));
+	if (fx._highlight >= 0)
+		invertRect(s, Common::Rect(31 * 8, fx._highlight * PANEL_SLOT_ROWS * 8, 32 * 8,
+			(fx._highlight * PANEL_SLOT_ROWS + 1) * 8));
 }
 
 } // namespace Views
diff --git a/engines/ultima/ultima3/views/game.h b/engines/ultima/ultima3/views/game.h
index 8d2a14dae80..70e68695c42 100644
--- a/engines/ultima/ultima3/views/game.h
+++ b/engines/ultima/ultima3/views/game.h
@@ -22,7 +22,9 @@
 #ifndef ULTIMA3_VIEWS_GAME_H
 #define ULTIMA3_VIEWS_GAME_H
 
+#include "common/ptr.h"
 #include "ultima/shared/engine/view.h"
+#include "ultima/ultima3/views/interactions/interaction.h"
 
 namespace Ultima {
 namespace Ultima3 {
@@ -42,6 +44,7 @@ class Game : public Shared::View {
 private:
 	int _idleFrames = 0;
 	int _windCounter = 1;
+	Common::ScopedPtr<Interactions::Interaction> _interaction;
 
 	void drawFrame(GfxSurface &s);
 	void drawPartyStatus(GfxSurface &s);
@@ -66,6 +69,29 @@ protected:
 	 */
 	virtual void idleTimeout() = 0;
 
+	/**
+	 * Carries out what happens once a command has taken a turn
+	 */
+	virtual void endTurn() = 0;
+
+	/**
+	 * Carries out the command for a key press, if it's one that works the
+	 * same wherever the party is
+	 * @returns		True if the key was a command
+	 */
+	virtual bool handleCommand(const KeypressMessage &msg);
+
+	/**
+	 * Takes over the keyboard to finish a command that needs further input
+	 */
+	void startInteraction(Interactions::Interaction *interaction);
+
+	/**
+	 * Prints the error shown for a command that can't be used right now,
+	 * and ends the turn
+	 */
+	void commandFailed(const char *text, byte sound = 0xFE);
+
 	/**
 	 * Resets the state for a new game
 	 */
@@ -87,6 +113,7 @@ public:
 	~Game() override {}
 
 	bool msgFocus(const FocusMessage &msg) override;
+	bool msgKeypress(const KeypressMessage &msg) override;
 	void draw() override;
 	void timeout() override;
 };
diff --git a/engines/ultima/ultima3/views/interactions/equip.cpp b/engines/ultima/ultima3/views/interactions/equip.cpp
new file mode 100644
index 00000000000..205cd82359d
--- /dev/null
+++ b/engines/ultima/ultima3/views/interactions/equip.cpp
@@ -0,0 +1,140 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "ultima/ultima3/views/interactions/equip.h"
+#include "ultima/ultima3/data/data.h"
+#include "ultima/ultima3/ultima3.h"
+
+namespace Ultima {
+namespace Ultima3 {
+namespace Views {
+namespace Interactions {
+
+// The last weapon and armour letters, plus one, that each class may use
+static const char CLASS_ORDER[] = "FCWTPBLIDAR";
+static const char WEAPON_LIMITS[] = "QDCHQQQDDCL";
+static const char ARMOUR_LIMITS[] = "IECDFDCDCCH";
+
+constexpr char ESCAPE_KEY = 0x1B;
+constexpr char EXOTIC_WEAPON = 'P';
+constexpr char EXOTIC_ARMOUR = 'H';
+
+void Equip::startMenu() {
+	const Data::Savegame &save = _G(savegame);
+	int letters;
+
+	if (_weapons) {
+		letters = save._allWeapons ? 16 : (save._plusTwoWeapons ? 15 : 8);
+	} else {
+		letters = save._allArmour ? 8 : (save._plusTwoArmour ? 7 : 5);
+	}
+
+	_keys[0] = 'Q';
+	_keys[1] = ESCAPE_KEY;
+	_words[0] = _words[1] = "Quit";
+
+	for (int i = 0; i < letters; ++i) {
+		_keys[2 + i] = 'A' + i;
+		_words[2 + i] = _weapons ? Data::WEAPON_NAMES[i] : Data::ARMOUR_NAMES[i];
+	}
+
+	_keys[2 + letters] = '\0';
+	_menu.setup(_keys, _words, 2 + letters, 0, 0);
+}
+
+void Equip::equip(char letter) {
+	Data::RosterEntry &e = _G(savegame).partyMember(_chooser.slot());
+
+	const char *classPos = strchr(CLASS_ORDER, e._class);
+	int classNum = (classPos && *classPos) ? classPos - CLASS_ORDER : 0;
+	char limit = (_weapons ? WEAPON_LIMITS : ARMOUR_LIMITS)[classNum];
+	char exotic = _weapons ? EXOTIC_WEAPON : EXOTIC_ARMOUR;
+
+	if (letter != exotic && letter >= limit) {
+		_G(messages).print("\nNot allowed!\n");
+		g_engine->playSoundEffect(0xFF);
+		return;
+	}
+
+	int index = letter - 'A';
+	byte *owned = _weapons ? e._weaponOwned : e._armourOwned;
+	byte &current = _weapons ? e._weaponIndex : e._armourIndex;
+
+	// The first item, bare hands or skin, is always held
+	if (index != 0 && owned[index - 1] == 0) {
+		_G(messages).print("\nNone owned\n");
+		g_engine->playSoundEffect(0xFF);
+		return;
+	}
+
+	_G(messages).print("\nReadied!\n");
+	current = index;
+}
+
+bool Equip::keypress(const KeypressMessage &msg) {
+	Common::String word;
+
+	if (_choosing) {
+		PlayerChooser::Result result = _chooser.handleKey(msg);
+		if (result == PlayerChooser::PENDING)
+			return false;
+		if (result == PlayerChooser::CANCELLED)
+			return true;
+
+		if (!_G(savegame).partyMember(_chooser.slot()).isAlive()) {
+			_G(messages).print("Incapacitated!\n");
+			g_engine->playSoundEffect(0xFF);
+			return true;
+		}
+
+		_choosing = false;
+		_G(messages).print(_weapons ? "Weapon:\n" : "Armour:\n");
+		startMenu();
+		return false;
+	}
+
+	bool hadChoice = _menu.hasChoice();
+	if (hadChoice)
+		word = _words[_menu.index()];
+
+	bool confirmed = _menu.handleKey(msg);
+
+	if (!hadChoice && _menu.hasChoice())
+		_G(messages).print(_words[_menu.index()]);
+	else if (hadChoice && !_menu.hasChoice())
+		_G(messages).backspace(word.size());
+
+	if (!confirmed)
+		return false;
+
+	char letter = _menu.key();
+	if (letter == 'Q' || letter == ESCAPE_KEY)
+		_G(messages).print("\n");
+	else
+		equip(letter);
+
+	return true;
+}
+
+} // namespace Interactions
+} // namespace Views
+} // namespace Ultima3
+} // namespace Ultima
diff --git a/engines/ultima/ultima3/views/interactions/equip.h b/engines/ultima/ultima3/views/interactions/equip.h
new file mode 100644
index 00000000000..04c64ff46e6
--- /dev/null
+++ b/engines/ultima/ultima3/views/interactions/equip.h
@@ -0,0 +1,70 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef ULTIMA3_VIEWS_INTERACTIONS_EQUIP_H
+#define ULTIMA3_VIEWS_INTERACTIONS_EQUIP_H
+
+#include "ultima/ultima3/views/interactions/interaction.h"
+#include "ultima/ultima3/views/menu_input.h"
+
+namespace Ultima {
+namespace Ultima3 {
+namespace Views {
+namespace Interactions {
+
+/**
+ * Has a party member take up a weapon, or put on a set of armour
+ */
+class Equip : public Interaction {
+private:
+	bool _weapons;
+	PlayerChooser _chooser;
+	bool _choosing = true;
+	MenuChoice _menu;
+	char _keys[20];
+	const char *_words[19];
+
+	/**
+	 * Sets up the menu of what can be picked once a party member is chosen
+	 */
+	void startMenu();
+
+	/**
+	 * Makes the item picked in the menu the one in use, if allowed
+	 */
+	void equip(char letter);
+
+public:
+	/**
+	 * Constructor
+	 * @param weapons	True for weapons, false for armour
+	 */
+	Equip(bool weapons) : _weapons(weapons) {}
+
+	bool keypress(const KeypressMessage &msg) override;
+};
+
+} // namespace Interactions
+} // namespace Views
+} // namespace Ultima3
+} // namespace Ultima
+
+#endif
diff --git a/engines/ultima/ultima3/views/interactions/exchange.cpp b/engines/ultima/ultima3/views/interactions/exchange.cpp
new file mode 100644
index 00000000000..57e11b31684
--- /dev/null
+++ b/engines/ultima/ultima3/views/interactions/exchange.cpp
@@ -0,0 +1,52 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "ultima/ultima3/views/interactions/exchange.h"
+#include "ultima/ultima3/ultima3.h"
+
+namespace Ultima {
+namespace Ultima3 {
+namespace Views {
+namespace Interactions {
+
+bool Exchange::keypress(const KeypressMessage &msg) {
+	PlayerChooser::Result result = _chooser.handleKey(msg);
+	if (result == PlayerChooser::PENDING)
+		return false;
+	if (result == PlayerChooser::CANCELLED)
+		return true;
+
+	if (_first < 0) {
+		_first = _chooser.slot();
+		_G(messages).print("Player: ");
+		return false;
+	}
+
+	Data::Savegame &save = _G(savegame);
+	SWAP(save._partyEntries[_first], save._partyEntries[_chooser.slot()]);
+	_G(messages).print("Exchanged!\n");
+	return true;
+}
+
+} // namespace Interactions
+} // namespace Views
+} // namespace Ultima3
+} // namespace Ultima
diff --git a/engines/ultima/ultima3/views/interactions/exchange.h b/engines/ultima/ultima3/views/interactions/exchange.h
new file mode 100644
index 00000000000..0eef3d78e09
--- /dev/null
+++ b/engines/ultima/ultima3/views/interactions/exchange.h
@@ -0,0 +1,49 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef ULTIMA3_VIEWS_INTERACTIONS_EXCHANGE_H
+#define ULTIMA3_VIEWS_INTERACTIONS_EXCHANGE_H
+
+#include "ultima/ultima3/views/interactions/interaction.h"
+
+namespace Ultima {
+namespace Ultima3 {
+namespace Views {
+namespace Interactions {
+
+/**
+ * Swaps the marching order of two party members
+ */
+class Exchange : public Interaction {
+private:
+	PlayerChooser _chooser;
+	int _first = -1;
+
+public:
+	bool keypress(const KeypressMessage &msg) override;
+};
+
+} // namespace Interactions
+} // namespace Views
+} // namespace Ultima3
+} // namespace Ultima
+
+#endif
diff --git a/engines/ultima/ultima3/views/interactions/interaction.cpp b/engines/ultima/ultima3/views/interactions/interaction.cpp
new file mode 100644
index 00000000000..84c649401e2
--- /dev/null
+++ b/engines/ultima/ultima3/views/interactions/interaction.cpp
@@ -0,0 +1,88 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "ultima/ultima3/views/interactions/interaction.h"
+#include "ultima/ultima3/ultima3.h"
+
+namespace Ultima {
+namespace Ultima3 {
+namespace Views {
+namespace Interactions {
+
+PlayerChooser::Result PlayerChooser::handleKey(const KeypressMessage &msg) {
+	if (msg.keycode == Common::KEYCODE_ESCAPE) {
+		_G(messages).print("\n");
+		return CANCELLED;
+	}
+
+	int number = msg.ascii - '0';
+	if (number < 0 || number > Data::PARTY_MAX) {
+		g_engine->playSoundEffect(0xFE);
+		return PENDING;
+	}
+
+	_G(messages).putChar('0' + number);
+	Result result = CHOSEN;
+
+	if (number == 0) {
+		result = CANCELLED;
+	} else if (number > _G(savegame)._partySize) {
+		_G(messages).print("\nNo one there!");
+		g_engine->playSoundEffect(0xFE);
+		result = CANCELLED;
+	}
+
+	_slot = number - 1;
+	_G(messages).print("\n");
+	return result;
+}
+
+DirectionChooser::Result DirectionChooser::handleKey(const KeypressMessage &msg) {
+	switch (msg.keycode) {
+	case Common::KEYCODE_UP:
+		_dir = DIR_NORTH;
+		_G(messages).print("North\n");
+		return CHOSEN;
+	case Common::KEYCODE_DOWN:
+		_dir = DIR_SOUTH;
+		_G(messages).print("South\n");
+		return CHOSEN;
+	case Common::KEYCODE_RIGHT:
+		_dir = DIR_EAST;
+		_G(messages).print("East\n");
+		return CHOSEN;
+	case Common::KEYCODE_LEFT:
+		_dir = DIR_WEST;
+		_G(messages).print("West\n");
+		return CHOSEN;
+	case Common::KEYCODE_ESCAPE:
+		_G(messages).print("\n");
+		return CANCELLED;
+	default:
+		g_engine->playSoundEffect(0xFE);
+		return PENDING;
+	}
+}
+
+} // namespace Interactions
+} // namespace Views
+} // namespace Ultima3
+} // namespace Ultima
diff --git a/engines/ultima/ultima3/views/interactions/interaction.h b/engines/ultima/ultima3/views/interactions/interaction.h
new file mode 100644
index 00000000000..aee8b71d5c8
--- /dev/null
+++ b/engines/ultima/ultima3/views/interactions/interaction.h
@@ -0,0 +1,108 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef ULTIMA3_VIEWS_INTERACTIONS_INTERACTION_H
+#define ULTIMA3_VIEWS_INTERACTIONS_INTERACTION_H
+
+#include "graphics/views/view.h"
+#include "ultima/ultima3/logic/logic.h"
+
+namespace Ultima {
+namespace Ultima3 {
+namespace Views {
+namespace Interactions {
+
+using namespace Graphics::Views;
+
+/**
+ * The remainder of a command that needs more input than the key that
+ * started it, such as choosing a party member. It reads the keys that follow
+ * and writes its prompts and results to the message window
+ */
+class Interaction {
+public:
+	virtual ~Interaction() {}
+
+	/**
+	 * Handles a keypress
+	 * @returns		True once the command is finished
+	 */
+	virtual bool keypress(const KeypressMessage &msg) = 0;
+};
+
+/**
+ * Asks for a party member by their number
+ */
+class PlayerChooser {
+private:
+	int _slot = -1;
+
+public:
+	enum Result {
+		PENDING,
+		CANCELLED,
+		CHOSEN
+	};
+
+	/**
+	 * Handles a keypress. Escape and 0 cancel, and a number with nobody
+	 * in that position is turned down
+	 */
+	Result handleKey(const KeypressMessage &msg);
+
+	/**
+	 * Returns the party slot chosen, counting from zero
+	 */
+	int slot() const {
+		return _slot;
+	}
+};
+
+/**
+ * Asks for one of the four directions
+ */
+class DirectionChooser {
+private:
+	Direction _dir = DIR_NONE;
+
+public:
+	enum Result {
+		PENDING,
+		CANCELLED,
+		CHOSEN
+	};
+
+	/**
+	 * Handles a keypress, echoing the direction picked
+	 */
+	Result handleKey(const KeypressMessage &msg);
+
+	Direction direction() const {
+		return _dir;
+	}
+};
+
+} // namespace Interactions
+} // namespace Views
+} // namespace Ultima3
+} // namespace Ultima
+
+#endif
diff --git a/engines/ultima/ultima3/views/interactions/look.cpp b/engines/ultima/ultima3/views/interactions/look.cpp
new file mode 100644
index 00000000000..1d67049f01e
--- /dev/null
+++ b/engines/ultima/ultima3/views/interactions/look.cpp
@@ -0,0 +1,56 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "ultima/ultima3/views/interactions/look.h"
+#include "ultima/ultima3/data/data.h"
+#include "ultima/ultima3/ultima3.h"
+
+namespace Ultima {
+namespace Ultima3 {
+namespace Views {
+namespace Interactions {
+
+bool Look::keypress(const KeypressMessage &msg) {
+	DirectionChooser::Result result = _chooser.handleKey(msg);
+	if (result == DirectionChooser::PENDING)
+		return false;
+	if (result == DirectionChooser::CANCELLED)
+		return true;
+
+	const Data::Savegame &save = _G(savegame);
+	int x = save._posX, y = save._posY;
+	switch (_chooser.direction()) {
+	case DIR_NORTH: --y; break;
+	case DIR_SOUTH: ++y; break;
+	case DIR_EAST: ++x; break;
+	default: --x; break;
+	}
+
+	_G(messages).print("->");
+	_G(messages).print(Data::NAMES[_G(map).tile(x, y)]);
+	_G(messages).print("\n");
+	return true;
+}
+
+} // namespace Interactions
+} // namespace Views
+} // namespace Ultima3
+} // namespace Ultima
diff --git a/engines/ultima/ultima3/views/interactions/look.h b/engines/ultima/ultima3/views/interactions/look.h
new file mode 100644
index 00000000000..7bace79e7dd
--- /dev/null
+++ b/engines/ultima/ultima3/views/interactions/look.h
@@ -0,0 +1,48 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef ULTIMA3_VIEWS_INTERACTIONS_LOOK_H
+#define ULTIMA3_VIEWS_INTERACTIONS_LOOK_H
+
+#include "ultima/ultima3/views/interactions/interaction.h"
+
+namespace Ultima {
+namespace Ultima3 {
+namespace Views {
+namespace Interactions {
+
+/**
+ * Names what lies on the map next to the party in a chosen direction
+ */
+class Look : public Interaction {
+private:
+	DirectionChooser _chooser;
+
+public:
+	bool keypress(const KeypressMessage &msg) override;
+};
+
+} // namespace Interactions
+} // namespace Views
+} // namespace Ultima3
+} // namespace Ultima
+
+#endif
diff --git a/engines/ultima/ultima3/views/interactions/ztats.cpp b/engines/ultima/ultima3/views/interactions/ztats.cpp
new file mode 100644
index 00000000000..a07d1937e0c
--- /dev/null
+++ b/engines/ultima/ultima3/views/interactions/ztats.cpp
@@ -0,0 +1,134 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "ultima/ultima3/views/interactions/ztats.h"
+#include "ultima/ultima3/data/data.h"
+#include "ultima/ultima3/ultima3.h"
+
+namespace Ultima {
+namespace Ultima3 {
+namespace Views {
+namespace Interactions {
+
+// The marks and cards a character can hold, from the highest bit down
+static const char *const MARK_NAMES[8] = {
+	"Mark of Kings", "Mark of Snake", "Mark of Fire", "Mark of Force",
+	"Card of Death", "Card of Moons", "Card of Sol", "Card of Love"
+};
+
+Ztats::~Ztats() {
+	_G(effects)._highlight = -1;
+}
+
+void Ztats::buildPages(const Data::RosterEntry &e) {
+	using Common::String;
+	_pages.clear();
+
+	_pages.push_back(String::format("%s\nStr...%02X\nDex...%02X\nInt...%02X\nWis...%02X\nH.P...%04X",
+		e._name, e._strength, e._dexterity, e._intelligence, e._wisdom, e._hitPoints));
+	_pages.push_back(String::format("\nH.M...%04X", e._maxHitPoints));
+	_pages.push_back(String::format("\nGold: %04X", e._gold));
+	_pages.push_back(String::format("\nExp...%04X", e._experience));
+	_pages.push_back(String::format("\nGems..%02X", e._gems));
+	_pages.push_back(String::format("\nKeys..%02X", e._keys));
+	_pages.push_back(String::format("\nPowd..%02X", e._powder));
+	_pages.push_back(String::format("\nTrch..%02X", e._torches));
+
+	for (int bit = 0; bit < 8; ++bit) {
+		if (e._marksAndCards & (0x80 >> bit))
+			_pages.push_back(String("\n") + MARK_NAMES[bit]);
+	}
+
+	_pages.push_back(String("\nWeapon:") + Data::WEAPON_NAMES[e._weaponIndex]);
+	_pages.push_back(String("\nArmour:") + Data::ARMOUR_NAMES[e._armourIndex]);
+
+	// The headings are shown along with the first item under them, and the
+	// fixed hands and skin entries aren't waited on
+	String pending = "\n***Weapons***";
+	for (int i = Data::WEAPON_COUNT - 1; i >= 1; --i) {
+		if (e._weaponOwned[i - 1] == 0)
+			continue;
+
+		_pages.push_back(pending + String::format("\n%02X-%s-(%c)", e._weaponOwned[i - 1],
+			Data::WEAPON_NAMES[i], 'A' + i));
+		pending.clear();
+	}
+
+	pending += "\n02-Hands-(A)\n**Armour**";
+	for (int i = Data::ARMOUR_COUNT - 1; i >= 1; --i) {
+		if (e._armourOwned[i - 1] == 0)
+			continue;
+
+		_pages.push_back(pending + String::format("\n%02X-%s-(%c)", e._armourOwned[i - 1],
+			Data::ARMOUR_NAMES[i], 'A' + i));
+		pending.clear();
+	}
+
+	_tail = pending + "\n01-Skin-(A)\n";
+}
+
+void Ztats::finish() {
+	_G(effects)._highlight = -1;
+}
+
+bool Ztats::keypress(const KeypressMessage &msg) {
+	if (!_showing) {
+		PlayerChooser::Result result = _chooser.handleKey(msg);
+		if (result == PlayerChooser::PENDING)
+			return false;
+		if (result == PlayerChooser::CANCELLED)
+			return true;
+
+		_showing = true;
+		_G(effects)._highlight = _chooser.slot();
+		buildPages(_G(savegame).partyMember(_chooser.slot()));
+		_G(messages).print(_pages[0].c_str());
+		return false;
+	}
+
+	switch (msg.keycode) {
+	case Common::KEYCODE_RETURN:
+	case Common::KEYCODE_KP_ENTER:
+	case Common::KEYCODE_DOWN:
+	case Common::KEYCODE_SPACE:
+		break;
+	case Common::KEYCODE_ESCAPE:
+		_G(messages).print("\n");
+		finish();
+		return true;
+	default:
+		return false;
+	}
+
+	if (++_page < _pages.size()) {
+		_G(messages).print(_pages[_page].c_str());
+		return false;
+	}
+
+	_G(messages).print(_tail.c_str());
+	finish();
+	return true;
+}
+
+} // namespace Interactions
+} // namespace Views
+} // namespace Ultima3
+} // namespace Ultima
diff --git a/engines/ultima/ultima3/views/interactions/ztats.h b/engines/ultima/ultima3/views/interactions/ztats.h
new file mode 100644
index 00000000000..1676ab5c95f
--- /dev/null
+++ b/engines/ultima/ultima3/views/interactions/ztats.h
@@ -0,0 +1,63 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef ULTIMA3_VIEWS_INTERACTIONS_ZTATS_H
+#define ULTIMA3_VIEWS_INTERACTIONS_ZTATS_H
+
+#include "common/array.h"
+#include "ultima/ultima3/views/interactions/interaction.h"
+
+namespace Ultima {
+namespace Ultima3 {
+namespace Views {
+namespace Interactions {
+
+/**
+ * Shows a party member's attributes and belongings in the message window a
+ * few lines at a time, moving on at each key press
+ */
+class Ztats : public Interaction {
+private:
+	PlayerChooser _chooser;
+	bool _showing = false;
+	Common::Array<Common::String> _pages;
+	Common::String _tail;
+	uint _page = 0;
+
+	/**
+	 * Works out the text to be shown for a party member
+	 */
+	void buildPages(const Data::RosterEntry &e);
+
+	void finish();
+
+public:
+	~Ztats() override;
+
+	bool keypress(const KeypressMessage &msg) override;
+};
+
+} // namespace Interactions
+} // namespace Views
+} // namespace Ultima3
+} // namespace Ultima
+
+#endif
diff --git a/engines/ultima/ultima3/views/menu_input.cpp b/engines/ultima/ultima3/views/menu_input.cpp
index 734a8635738..0765908de78 100644
--- a/engines/ultima/ultima3/views/menu_input.cpp
+++ b/engines/ultima/ultima3/views/menu_input.cpp
@@ -45,6 +45,11 @@ bool isModifierKey(Common::KeyCode key) {
 	}
 }
 
+char commandKey(const KeypressMessage &msg) {
+	char c = (msg.ascii > 0 && msg.ascii < 0x80) ? msg.ascii : 0;
+	return (c >= 'a' && c <= 'z') ? c - ('a' - 'A') : c;
+}
+
 static bool isEnterKey(Common::KeyCode key) {
 	return key == Common::KEYCODE_RETURN || key == Common::KEYCODE_KP_ENTER;
 }
diff --git a/engines/ultima/ultima3/views/menu_input.h b/engines/ultima/ultima3/views/menu_input.h
index ec7de836a1c..461b93dd6be 100644
--- a/engines/ultima/ultima3/views/menu_input.h
+++ b/engines/ultima/ultima3/views/menu_input.h
@@ -39,6 +39,12 @@ constexpr int GLYPH_UP_ARROW = 0x1E;
  */
 bool isModifierKey(Common::KeyCode key);
 
+/**
+ * Returns the upper case letter or other character typed, or zero for keys
+ * that don't give one
+ */
+char commandKey(const KeypressMessage &msg);
+
 /**
  * A menu prompt. Pressing one of the option keys only echoes the matching
  * word; it then has to be confirmed with Enter, or taken back with
@@ -70,6 +76,13 @@ public:
 		return _choice >= 0;
 	}
 
+	/**
+	 * Returns the number of the option currently echoed
+	 */
+	int index() const {
+		return _choice;
+	}
+
 	/**
 	 * Returns the key of the choice made
 	 */
diff --git a/engines/ultima/ultima3/views/overworld_map.cpp b/engines/ultima/ultima3/views/overworld_map.cpp
index 45e04a6ac47..01c7f59df56 100644
--- a/engines/ultima/ultima3/views/overworld_map.cpp
+++ b/engines/ultima/ultima3/views/overworld_map.cpp
@@ -21,6 +21,7 @@
 
 #include "ultima/ultima3/views/overworld_map.h"
 #include "ultima/ultima3/views/menu_input.h"
+#include "ultima/ultima3/views/interactions/look.h"
 #include "ultima/ultima3/ultima3.h"
 
 namespace Ultima {
@@ -146,42 +147,76 @@ void OverworldMap::idleTimeout() {
 	doPass();
 }
 
-bool OverworldMap::msgKeypress(const KeypressMessage &msg) {
-	if (isModifierKey(msg.keycode))
-		return true;
-	if (Game::msgKeypress(msg))
-		return true;
+void OverworldMap::doBoard() {
+	const char *text = _logic.board();
+	if (text) {
+		_G(messages).print(text);
+		endTurn();
+	} else {
+		_G(messages).print("Board");
+		commandFailed("<-What?\n");
+	}
+}
 
-	if (_gameOver) {
-		replaceView("Title", true);
-		return true;
+void OverworldMap::doExitVehicle() {
+	_G(messages).print("X-it ");
+
+	switch (_logic.exitVehicle()) {
+	case OverworldLogic::EXIT_DONE:
+		_G(messages).print("Craft\n");
+		endTurn();
+		break;
+	case OverworldLogic::EXIT_NOT_HERE:
+		commandFailed("Not Here!\n", 0xFF);
+		break;
+	default:
+		commandFailed("<-What?\n");
+		break;
 	}
+}
 
+bool OverworldMap::handleCommand(const KeypressMessage &msg) {
 	switch (msg.keycode) {
 	case Common::KEYCODE_UP:
 	case Common::KEYCODE_KP8:
 		doMove(DIR_NORTH, "North\n");
-		break;
+		return true;
 	case Common::KEYCODE_DOWN:
 	case Common::KEYCODE_KP2:
 		doMove(DIR_SOUTH, "South\n");
-		break;
+		return true;
 	case Common::KEYCODE_RIGHT:
 	case Common::KEYCODE_KP6:
 		doMove(DIR_EAST, "East\n");
-		break;
+		return true;
 	case Common::KEYCODE_LEFT:
 	case Common::KEYCODE_KP4:
 		doMove(DIR_WEST, "West\n");
-		break;
+		return true;
 	case Common::KEYCODE_SPACE:
 		doPass();
+		return true;
+	default:
 		break;
+	}
+
+	switch (commandKey(msg)) {
+	case 'B':
+		doBoard();
+		return true;
+	case 'X':
+		doExitVehicle();
+		return true;
+	case 'L':
+		_G(messages).print("Look-");
+		startInteraction(new Interactions::Look());
+		return true;
 	default:
-		doInvalid();
 		break;
 	}
 
+	if (!Game::handleCommand(msg))
+		doInvalid();
 	return true;
 }
 
diff --git a/engines/ultima/ultima3/views/overworld_map.h b/engines/ultima/ultima3/views/overworld_map.h
index b08fdb7c459..0441874f7d3 100644
--- a/engines/ultima/ultima3/views/overworld_map.h
+++ b/engines/ultima/ultima3/views/overworld_map.h
@@ -48,22 +48,20 @@ private:
 	void doMove(Direction dir, const char *label);
 	void doPass();
 	void doInvalid();
-
-	/**
-	 * Carries out what happens once a command has taken a turn
-	 */
-	void endTurn();
+	void doBoard();
+	void doExitVehicle();
 
 protected:
 	void drawViewport(GfxSurface &s) override;
 	void idleTimeout() override;
+	void endTurn() override;
+	bool handleCommand(const KeypressMessage &msg) override;
 
 public:
 	OverworldMap() : Game("OverworldMap") {}
 	~OverworldMap() override {}
 
 	bool msgFocus(const FocusMessage &msg) override;
-	bool msgKeypress(const KeypressMessage &msg) override;
 };
 
 } // namespace Views


Commit: 625025efe131163fa32f34a7c11342e1e8e70ee8
    https://github.com/scummvm/scummvm/commit/625025efe131163fa32f34a7c11342e1e8e70ee8
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:41:00+11:00

Commit Message:
ULTIMA: ULTIMA3: Rename the overworld view and logic to cover every surface location

Changed paths:
  A engines/ultima/ultima3/logic/location_logic.cpp
  A engines/ultima/ultima3/logic/location_logic.h
  A engines/ultima/ultima3/views/location_map.cpp
  A engines/ultima/ultima3/views/location_map.h
  R engines/ultima/ultima3/logic/overworld_logic.cpp
  R engines/ultima/ultima3/logic/overworld_logic.h
  R engines/ultima/ultima3/views/overworld_map.cpp
  R engines/ultima/ultima3/views/overworld_map.h
    engines/ultima/module.mk
    engines/ultima/ultima3/ultima3.cpp
    engines/ultima/ultima3/views/main_menu.cpp
    engines/ultima/ultima3/views/views.h


diff --git a/engines/ultima/module.mk b/engines/ultima/module.mk
index 094fc7068ee..d1c851f832d 100644
--- a/engines/ultima/module.mk
+++ b/engines/ultima/module.mk
@@ -171,8 +171,8 @@ MODULE_OBJS += \
 	ultima3/gfx/message_log.o \
 	ultima3/gfx/pic_decoder.o \
 	ultima3/gfx/shapes.o \
+	ultima3/logic/location_logic.o \
 	ultima3/logic/logic.o \
-	ultima3/logic/overworld_logic.o \
 	ultima3/views/character_details.o \
 	ultima3/views/create_character.o \
 	ultima3/views/disperse_party.o \
@@ -184,10 +184,10 @@ MODULE_OBJS += \
 	ultima3/views/interactions/look.o \
 	ultima3/views/interactions/ztats.o \
 	ultima3/views/journey_onward.o \
+	ultima3/views/location_map.o \
 	ultima3/views/logo_screen.o \
 	ultima3/views/main_menu.o \
 	ultima3/views/menu_input.o \
-	ultima3/views/overworld_map.o \
 	ultima3/views/party_menu.o \
 	ultima3/views/register.o \
 	ultima3/views/terminate_character.o \
diff --git a/engines/ultima/ultima3/logic/overworld_logic.cpp b/engines/ultima/ultima3/logic/location_logic.cpp
similarity index 93%
rename from engines/ultima/ultima3/logic/overworld_logic.cpp
rename to engines/ultima/ultima3/logic/location_logic.cpp
index 380865abd37..4ab07dc242f 100644
--- a/engines/ultima/ultima3/logic/overworld_logic.cpp
+++ b/engines/ultima/ultima3/logic/location_logic.cpp
@@ -19,7 +19,7 @@
  *
  */
 
-#include "ultima/ultima3/logic/overworld_logic.h"
+#include "ultima/ultima3/logic/location_logic.h"
 #include "ultima/ultima3/ultima3.h"
 
 namespace Ultima {
@@ -48,14 +48,14 @@ constexpr byte CELL_SHIP = TRANSPORT_SHIP * 4;
 constexpr int FORCE_FIELD_DAMAGE = 99;
 constexpr int LAVA_DAMAGE = 50;
 
-bool OverworldLogic::isShipBlockedByWind(Direction dir) const {
+bool LocationLogic::isShipBlockedByWind(Direction dir) const {
 	if (_G(savegame)._transport != TRANSPORT_SHIP)
 		return false;
 
 	return _G(windDirection) == 0 || _G(windDirection) == (byte)dir;
 }
 
-bool OverworldLogic::isTerrainBlocked(byte tile) {
+bool LocationLogic::isTerrainBlocked(byte tile) {
 	Data::Savegame &save = _G(savegame);
 
 	if (save._transport == TRANSPORT_SHIP)
@@ -96,7 +96,7 @@ bool OverworldLogic::isTerrainBlocked(byte tile) {
 	}
 }
 
-bool OverworldLogic::move(Direction dir) {
+bool LocationLogic::move(Direction dir) {
 	Data::Savegame &save = _G(savegame);
 	int dx = (dir == DIR_EAST) ? 1 : (dir == DIR_WEST) ? -1 : 0;
 	int dy = (dir == DIR_SOUTH) ? 1 : (dir == DIR_NORTH) ? -1 : 0;
@@ -111,7 +111,7 @@ bool OverworldLogic::move(Direction dir) {
 	return true;
 }
 
-const char *OverworldLogic::board() {
+const char *LocationLogic::board() {
 	Data::Savegame &save = _G(savegame);
 	if (save._transport != TRANSPORT_ON_FOOT)
 		return nullptr;
@@ -131,7 +131,7 @@ const char *OverworldLogic::board() {
 	return nullptr;
 }
 
-OverworldLogic::ExitResult OverworldLogic::exitVehicle() {
+LocationLogic::ExitResult LocationLogic::exitVehicle() {
 	Data::Savegame &save = _G(savegame);
 	if (save._transport == TRANSPORT_ON_FOOT)
 		return EXIT_NOT_RIDING;
diff --git a/engines/ultima/ultima3/logic/overworld_logic.h b/engines/ultima/ultima3/logic/location_logic.h
similarity index 92%
rename from engines/ultima/ultima3/logic/overworld_logic.h
rename to engines/ultima/ultima3/logic/location_logic.h
index ebfcb46fa4e..a297d996535 100644
--- a/engines/ultima/ultima3/logic/overworld_logic.h
+++ b/engines/ultima/ultima3/logic/location_logic.h
@@ -19,8 +19,8 @@
  *
  */
 
-#ifndef ULTIMA3_LOGIC_OVERWORLD_LOGIC_H
-#define ULTIMA3_LOGIC_OVERWORLD_LOGIC_H
+#ifndef ULTIMA3_LOGIC_LOCATION_LOGIC_H
+#define ULTIMA3_LOGIC_LOCATION_LOGIC_H
 
 #include "ultima/ultima3/logic/logic.h"
 
@@ -32,9 +32,9 @@ constexpr byte TRANSPORT_SHIP = 0x0B;
 constexpr byte TRANSPORT_ON_FOOT = 0x3F;
 
 /**
- * Rules for travelling around the world map
+ * Rules for moving the party around a map
  */
-class OverworldLogic : public Logic {
+class LocationLogic : public Logic {
 private:
 	/**
 	 * Returns true if a ship can't sail in a direction because the wind is
diff --git a/engines/ultima/ultima3/ultima3.cpp b/engines/ultima/ultima3/ultima3.cpp
index c5bf5a0b897..0de063008c1 100644
--- a/engines/ultima/ultima3/ultima3.cpp
+++ b/engines/ultima/ultima3/ultima3.cpp
@@ -97,7 +97,7 @@ Common::Error Ultima3Engine::syncGame(Common::Serializer &s) {
 		// otherwise return to where the party can be organized
 		_resumeGame = _savegame._mapLoaded && _savegame._partySize > 0 &&
 			_savegame.hasLivingPartyMember();
-		replaceView(_resumeGame ? "OverworldMap" : "LogoScreen", true);
+		replaceView(_resumeGame ? "LocationMap" : "LogoScreen", true);
 	}
 
 	return Common::kNoError;
diff --git a/engines/ultima/ultima3/views/overworld_map.cpp b/engines/ultima/ultima3/views/location_map.cpp
similarity index 89%
rename from engines/ultima/ultima3/views/overworld_map.cpp
rename to engines/ultima/ultima3/views/location_map.cpp
index 01c7f59df56..e3efe671bdb 100644
--- a/engines/ultima/ultima3/views/overworld_map.cpp
+++ b/engines/ultima/ultima3/views/location_map.cpp
@@ -19,7 +19,7 @@
  *
  */
 
-#include "ultima/ultima3/views/overworld_map.h"
+#include "ultima/ultima3/views/location_map.h"
 #include "ultima/ultima3/views/menu_input.h"
 #include "ultima/ultima3/views/interactions/look.h"
 #include "ultima/ultima3/ultima3.h"
@@ -47,7 +47,7 @@ static int stepToCentre(int pos) {
 	return pos < centre ? 1 : (pos > centre ? -1 : 0);
 }
 
-bool OverworldMap::msgFocus(const FocusMessage &msg) {
+bool LocationMap::msgFocus(const FocusMessage &msg) {
 	// The game starts when arriving from the main menu, or continues on from a load
 	bool fromMenu = msg._priorView && msg._priorView->getName() == "MainMenu";
 	if (fromMenu || _G(resumeGame)) {
@@ -66,7 +66,7 @@ bool OverworldMap::msgFocus(const FocusMessage &msg) {
 	return Game::msgFocus(msg);
 }
 
-void OverworldMap::buildViewport(byte *tiles) const {
+void LocationMap::buildViewport(byte *tiles) const {
 	const Data::Savegame &save = _G(savegame);
 	const int half = VIEWPORT_TILES / 2;
 
@@ -100,7 +100,7 @@ void OverworldMap::buildViewport(byte *tiles) const {
 	}
 }
 
-void OverworldMap::drawViewport(GfxSurface &s) {
+void LocationMap::drawViewport(GfxSurface &s) {
 	byte tiles[VIEWPORT_CELLS];
 	buildViewport(tiles);
 
@@ -113,7 +113,7 @@ void OverworldMap::drawViewport(GfxSurface &s) {
 	s.addDirtyRect(Common::Rect(8, 8, 8 + VIEWPORT_TILES * Gfx::SHAPE_SIZE, 8 + VIEWPORT_TILES * Gfx::SHAPE_SIZE));
 }
 
-void OverworldMap::endTurn() {
+void LocationMap::endTurn() {
 	_logic.incrementMoveCounter();
 	_logic.processPartyTurnEffects(true);
 
@@ -121,7 +121,7 @@ void OverworldMap::endTurn() {
 		startPrompt();
 }
 
-void OverworldMap::doMove(Direction dir, const char *label) {
+void LocationMap::doMove(Direction dir, const char *label) {
 	_G(messages).print(label);
 
 	if (!_logic.move(dir)) {
@@ -132,22 +132,22 @@ void OverworldMap::doMove(Direction dir, const char *label) {
 	endTurn();
 }
 
-void OverworldMap::doPass() {
+void LocationMap::doPass() {
 	_G(messages).print("Pass\n");
 	endTurn();
 }
 
-void OverworldMap::doInvalid() {
+void LocationMap::doInvalid() {
 	_G(messages).print("<-What?\n");
 	g_engine->playSoundEffect(0xFE);
 	endTurn();
 }
 
-void OverworldMap::idleTimeout() {
+void LocationMap::idleTimeout() {
 	doPass();
 }
 
-void OverworldMap::doBoard() {
+void LocationMap::doBoard() {
 	const char *text = _logic.board();
 	if (text) {
 		_G(messages).print(text);
@@ -158,15 +158,15 @@ void OverworldMap::doBoard() {
 	}
 }
 
-void OverworldMap::doExitVehicle() {
+void LocationMap::doExitVehicle() {
 	_G(messages).print("X-it ");
 
 	switch (_logic.exitVehicle()) {
-	case OverworldLogic::EXIT_DONE:
+	case LocationLogic::EXIT_DONE:
 		_G(messages).print("Craft\n");
 		endTurn();
 		break;
-	case OverworldLogic::EXIT_NOT_HERE:
+	case LocationLogic::EXIT_NOT_HERE:
 		commandFailed("Not Here!\n", 0xFF);
 		break;
 	default:
@@ -175,7 +175,7 @@ void OverworldMap::doExitVehicle() {
 	}
 }
 
-bool OverworldMap::handleCommand(const KeypressMessage &msg) {
+bool LocationMap::handleCommand(const KeypressMessage &msg) {
 	switch (msg.keycode) {
 	case Common::KEYCODE_UP:
 	case Common::KEYCODE_KP8:
diff --git a/engines/ultima/ultima3/views/overworld_map.h b/engines/ultima/ultima3/views/location_map.h
similarity index 87%
rename from engines/ultima/ultima3/views/overworld_map.h
rename to engines/ultima/ultima3/views/location_map.h
index 0441874f7d3..bf509c64f06 100644
--- a/engines/ultima/ultima3/views/overworld_map.h
+++ b/engines/ultima/ultima3/views/location_map.h
@@ -19,10 +19,10 @@
  *
  */
 
-#ifndef ULTIMA3_VIEWS_OVERWORLD_MAP_H
-#define ULTIMA3_VIEWS_OVERWORLD_MAP_H
+#ifndef ULTIMA3_VIEWS_LOCATION_MAP_H
+#define ULTIMA3_VIEWS_LOCATION_MAP_H
 
-#include "ultima/ultima3/logic/overworld_logic.h"
+#include "ultima/ultima3/logic/location_logic.h"
 #include "ultima/ultima3/views/game.h"
 
 namespace Ultima {
@@ -35,9 +35,9 @@ constexpr int VIEWPORT_TILES = 11;
  * The world map, seen as an 11x11 area of tiles centred on the party.
  * Forests and mountains hide whatever is behind them
  */
-class OverworldMap : public Game {
+class LocationMap : public Game {
 private:
-	OverworldLogic _logic;
+	LocationLogic _logic;
 
 	/**
 	 * Fills in the tile numbers for the viewport, with the party's transport
@@ -58,8 +58,8 @@ protected:
 	bool handleCommand(const KeypressMessage &msg) override;
 
 public:
-	OverworldMap() : Game("OverworldMap") {}
-	~OverworldMap() override {}
+	LocationMap() : Game("LocationMap") {}
+	~LocationMap() override {}
 
 	bool msgFocus(const FocusMessage &msg) override;
 };
diff --git a/engines/ultima/ultima3/views/main_menu.cpp b/engines/ultima/ultima3/views/main_menu.cpp
index 25bd2de406d..db434ebb79f 100644
--- a/engines/ultima/ultima3/views/main_menu.cpp
+++ b/engines/ultima/ultima3/views/main_menu.cpp
@@ -67,7 +67,7 @@ bool MainMenu::msgKeypress(const KeypressMessage &msg) {
 			if (_G(savegame)._partySize == 0 || !_G(savegame).hasLivingPartyMember()) {
 				addView("JourneyOnward");
 			} else {
-				replaceView("OverworldMap", true);
+				replaceView("LocationMap", true);
 				return true;
 			}
 			break;
diff --git a/engines/ultima/ultima3/views/views.h b/engines/ultima/ultima3/views/views.h
index 9ea84b20cd3..e37cd3e2e59 100644
--- a/engines/ultima/ultima3/views/views.h
+++ b/engines/ultima/ultima3/views/views.h
@@ -28,9 +28,9 @@
 #include "ultima/ultima3/views/disperse_party.h"
 #include "ultima/ultima3/views/form_party.h"
 #include "ultima/ultima3/views/journey_onward.h"
+#include "ultima/ultima3/views/location_map.h"
 #include "ultima/ultima3/views/logo_screen.h"
 #include "ultima/ultima3/views/main_menu.h"
-#include "ultima/ultima3/views/overworld_map.h"
 #include "ultima/ultima3/views/party_menu.h"
 #include "ultima/ultima3/views/register.h"
 #include "ultima/ultima3/views/terminate_character.h"
@@ -46,9 +46,9 @@ struct Views {
 	DisperseParty _disperseParty;
 	FormParty _formParty;
 	JourneyOnward _journeyOnward;
+	LocationMap _locationMap;
 	LogoScreen _logoScreen;
 	MainMenu _mainMenu;
-	OverworldMap _overworldMap;
 	PartyMenu _partyMenu;
 	Register _register;
 	TerminateCharacter _terminateCharacter;


Commit: 5159e0774470fa4f11aa5e83af8e4eb3a1a22858
    https://github.com/scummvm/scummvm/commit/5159e0774470fa4f11aa5e83af8e4eb3a1a22858
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:41:00+11:00

Commit Message:
ULTIMA: ULTIMA3: Add entering and leaving towns and castles

Changed paths:
    engines/ultima/ultima3/data/map.cpp
    engines/ultima/ultima3/data/map.h
    engines/ultima/ultima3/data/savegame.cpp
    engines/ultima/ultima3/data/savegame.h
    engines/ultima/ultima3/logic/location_logic.cpp
    engines/ultima/ultima3/logic/location_logic.h
    engines/ultima/ultima3/ultima3.cpp
    engines/ultima/ultima3/ultima3.h
    engines/ultima/ultima3/views/form_party.cpp
    engines/ultima/ultima3/views/location_map.cpp
    engines/ultima/ultima3/views/location_map.h


diff --git a/engines/ultima/ultima3/data/map.cpp b/engines/ultima/ultima3/data/map.cpp
index 66f000f318f..e000e3a204f 100644
--- a/engines/ultima/ultima3/data/map.cpp
+++ b/engines/ultima/ultima3/data/map.cpp
@@ -26,14 +26,38 @@ namespace Ultima {
 namespace Ultima3 {
 namespace Data {
 
+bool Map::exists(const char *filename) {
+	return Common::File::exists(filename);
+}
+
 void Map::load(const char *filename) {
 	Common::File f;
-	if (!f.open(filename) || f.read(_cells, sizeof(_cells)) != sizeof(_cells))
+	if (!f.open(filename))
+		error("Could not load %s", filename);
+
+	Common::Serializer s(&f, nullptr);
+	synchronizeData(s);
+	if (f.err() || f.eos())
 		error("Could not load %s", filename);
 }
 
 void Map::synchronize(Common::Serializer &s) {
+	// Earlier saves only held the cells
+	if (s.getVersion() < 3)
+		s.syncBytes(_cells, sizeof(_cells));
+	else
+		synchronizeData(s);
+}
+
+void Map::synchronizeData(Common::Serializer &s) {
 	s.syncBytes(_cells, sizeof(_cells));
+	s.syncBytes(_text, sizeof(_text));
+	s.syncBytes(_creatures._tile, CREATURE_COUNT);
+	s.syncBytes(_creatures._floor, CREATURE_COUNT);
+	s.syncBytes(_creatures._x, CREATURE_COUNT);
+	s.syncBytes(_creatures._y, CREATURE_COUNT);
+	s.syncBytes(_creatures._flags, CREATURE_COUNT);
+	s.syncBytes(_extra, sizeof(_extra));
 }
 
 } // namespace Data
diff --git a/engines/ultima/ultima3/data/map.h b/engines/ultima/ultima3/data/map.h
index 0c5adf6b7d9..3c8b3a94b6e 100644
--- a/engines/ultima/ultima3/data/map.h
+++ b/engines/ultima/ultima3/data/map.h
@@ -30,18 +30,53 @@ namespace Ultima3 {
 namespace Data {
 
 constexpr int MAP_SIZE = 64;
+constexpr int CREATURE_COUNT = 32;
+
+/**
+ * The creatures wandering a location: the monsters of the overworld or the
+ * people of a town or castle. Their tiles are also placed in the map cells
+ * they stand on, with what's underneath them kept here
+ */
+struct Creatures {
+	byte _tile[CREATURE_COUNT] = {};
+	byte _floor[CREATURE_COUNT] = {};
+	byte _x[CREATURE_COUNT] = {};
+	byte _y[CREATURE_COUNT] = {};
+
+	// The top two bits give how it behaves, and the rest what a person says
+	byte _flags[CREATURE_COUNT] = {};
+};
 
 /**
  * A 64x64 location map, as used by the overworld, towns and castles. Each
- * cell holds a tile number multiplied by 4
+ * cell holds a tile number multiplied by 4. The rest of a location's data,
+ * which includes the things said there, follows it
  */
 class Map {
 private:
+	static const int TEXT_SIZE = 0x180;
+	static const int EXTRA_SIZE = 8;
+
 	byte _cells[MAP_SIZE * MAP_SIZE] = {};
 
+	// The offsets of the things said in a town, followed by the things
+	byte _text[TEXT_SIZE] = {};
+
+	// The whirlpool and moon phases on the overworld
+	byte _extra[EXTRA_SIZE] = {};
+
+	void synchronizeData(Common::Serializer &s);
+
 public:
+	Creatures _creatures;
+
+	/**
+	 * Returns true if a location data file exists
+	 */
+	static bool exists(const char *filename);
+
 	/**
-	 * Loads a map from the start of a .ULT file
+	 * Loads a location from a .ULT file
 	 */
 	void load(const char *filename);
 
diff --git a/engines/ultima/ultima3/data/savegame.cpp b/engines/ultima/ultima3/data/savegame.cpp
index 506a9865a38..b00cc6454ef 100644
--- a/engines/ultima/ultima3/data/savegame.cpp
+++ b/engines/ultima/ultima3/data/savegame.cpp
@@ -26,7 +26,6 @@ namespace Ultima3 {
 namespace Data {
 
 constexpr byte TRANSPORT_ON_FOOT = 0x3F;
-constexpr byte LOCATION_SOSARIA = 0;
 constexpr byte START_X = 44;
 constexpr byte START_Y = 20;
 
@@ -74,6 +73,11 @@ void Savegame::synchronize(Common::Serializer &s) {
 		s.syncAsByte(_plusTwoWeapons);
 		s.syncAsByte(_plusTwoArmour);
 	}
+
+	if (s.getVersion() >= 3) {
+		s.syncAsByte(_worldX);
+		s.syncAsByte(_worldY);
+	}
 }
 
 void Savegame::formParty() {
diff --git a/engines/ultima/ultima3/data/savegame.h b/engines/ultima/ultima3/data/savegame.h
index b74cafaa485..3b684e90b6f 100644
--- a/engines/ultima/ultima3/data/savegame.h
+++ b/engines/ultima/ultima3/data/savegame.h
@@ -28,6 +28,11 @@ namespace Ultima {
 namespace Ultima3 {
 namespace Data {
 
+constexpr byte LOCATION_SOSARIA = 0;
+constexpr byte LOCATION_DUNGEON = 1;
+constexpr byte LOCATION_TOWN = 2;
+constexpr byte LOCATION_CASTLE = 3;
+
 /**
  * The persistent game state: the roster of up to 20 characters, and which
  * of them (by 1-based roster number) make up the active party.
@@ -41,6 +46,10 @@ struct Savegame {
 	byte _location = 0;
 	byte _posX = 0;
 	byte _posY = 0;
+
+	// Where the party was on the overworld, while they're somewhere else
+	byte _worldX = 0;
+	byte _worldY = 0;
 	byte _moveCount[4] = {};
 
 	// Set once the party has seen the more powerful gear offered in the
diff --git a/engines/ultima/ultima3/logic/location_logic.cpp b/engines/ultima/ultima3/logic/location_logic.cpp
index 4ab07dc242f..e551ca75cd9 100644
--- a/engines/ultima/ultima3/logic/location_logic.cpp
+++ b/engines/ultima/ultima3/logic/location_logic.cpp
@@ -111,6 +111,75 @@ bool LocationLogic::move(Direction dir) {
 	return true;
 }
 
+// The towns, castles and dungeons on the world map, with the entrance of each
+struct Entrance {
+	const char *_filename;
+	byte _x, _y;
+};
+
+static const Entrance ENTRANCES[] = {
+	{ "BRITISH.ULT", 45, 18 }, { "EXODUS.ULT", 10, 53 }, { "LCB.ULT", 46, 19 },
+	{ "MOON.ULT", 6, 13 }, { "YEW.ULT", 34, 16 }, { "MONTOR_E.ULT", 49, 58 },
+	{ "MONTOR_W.ULT", 47, 58 }, { "GREY.ULT", 7, 44 }, { "DAWN.ULT", 37, 53 },
+	{ "DEVIL.ULT", 18, 31 }, { "FAWN.ULT", 30, 2 }, { "DEATH.ULT", 56, 31 }
+};
+
+constexpr byte TILE_TOWN = 6;
+constexpr byte TILE_CASTLE = 7;
+
+// Where the party starts out in each kind of location
+constexpr byte TOWN_START_X = 0x01;
+constexpr byte TOWN_START_Y = 0x20;
+constexpr byte CASTLE_START_X = 0x20;
+constexpr byte CASTLE_START_Y = 0x3E;
+
+const char *LocationLogic::enter() {
+	Data::Savegame &save = _G(savegame);
+	if (save._location != Data::LOCATION_SOSARIA)
+		return nullptr;
+
+	const Entrance *entrance = nullptr;
+	for (uint i = 0; i < ARRAYSIZE(ENTRANCES) && !entrance; ++i) {
+		if (ENTRANCES[i]._x == save._posX && ENTRANCES[i]._y == save._posY)
+			entrance = &ENTRANCES[i];
+	}
+
+	byte tile = _G(map).tile(save._posX, save._posY);
+	if (!entrance || (tile != TILE_TOWN && tile != TILE_CASTLE) || !Data::Map::exists(entrance->_filename))
+		return nullptr;
+
+	_G(worldMap) = _G(map);
+	save._worldX = save._posX;
+	save._worldY = save._posY;
+	_G(map).load(entrance->_filename);
+
+	if (tile == TILE_TOWN) {
+		save._location = Data::LOCATION_TOWN;
+		save._posX = TOWN_START_X;
+		save._posY = TOWN_START_Y;
+		return "Towne!\n";
+	} else {
+		save._location = Data::LOCATION_CASTLE;
+		save._posX = CASTLE_START_X;
+		save._posY = CASTLE_START_Y;
+		return "Castle!\n";
+	}
+}
+
+bool LocationLogic::isAtExit() const {
+	const Data::Savegame &save = _G(savegame);
+	return save._location >= Data::LOCATION_TOWN && (save._posX == 0 || save._posY == 0);
+}
+
+void LocationLogic::exitToWorld() {
+	Data::Savegame &save = _G(savegame);
+
+	_G(map) = _G(worldMap);
+	save._location = Data::LOCATION_SOSARIA;
+	save._posX = save._worldX;
+	save._posY = save._worldY;
+}
+
 const char *LocationLogic::board() {
 	Data::Savegame &save = _G(savegame);
 	if (save._transport != TRANSPORT_ON_FOOT)
diff --git a/engines/ultima/ultima3/logic/location_logic.h b/engines/ultima/ultima3/logic/location_logic.h
index a297d996535..7dfe702cd67 100644
--- a/engines/ultima/ultima3/logic/location_logic.h
+++ b/engines/ultima/ultima3/logic/location_logic.h
@@ -71,6 +71,24 @@ public:
 	 * Gets off a horse or ship, leaving it behind
 	 */
 	ExitResult exitVehicle();
+
+	/**
+	 * Takes the party into the town or castle they're standing at the
+	 * entrance to
+	 * @returns		What to say about it, or null if there's nowhere to enter
+	 */
+	const char *enter();
+
+	/**
+	 * Returns true if the party has reached the edge of a town or castle,
+	 * and so leaves it
+	 */
+	bool isAtExit() const;
+
+	/**
+	 * Takes the party back out onto the world map
+	 */
+	void exitToWorld();
 };
 
 } // namespace Ultima3
diff --git a/engines/ultima/ultima3/ultima3.cpp b/engines/ultima/ultima3/ultima3.cpp
index 0de063008c1..8548e6ecced 100644
--- a/engines/ultima/ultima3/ultima3.cpp
+++ b/engines/ultima/ultima3/ultima3.cpp
@@ -86,12 +86,17 @@ bool Ultima3Engine::canLoadGameStateCurrently(Common::U32String *msg) {
 }
 
 Common::Error Ultima3Engine::syncGame(Common::Serializer &s) {
-	s.syncVersion(2);
+	s.syncVersion(3);
 
 	_savegame.synchronize(s);
-	if (_savegame._mapLoaded)
+	if (_savegame._mapLoaded) {
 		_map.synchronize(s);
 
+		// The world is kept aside while the party is in a town or castle
+		if (_savegame._location != Data::LOCATION_SOSARIA)
+			_worldMap.synchronize(s);
+	}
+
 	if (s.isLoading()) {
 		// Carry on in the world if there's a party able to adventure in it,
 		// otherwise return to where the party can be organized
diff --git a/engines/ultima/ultima3/ultima3.h b/engines/ultima/ultima3/ultima3.h
index 90bb10e91cf..3bfc01b586e 100644
--- a/engines/ultima/ultima3/ultima3.h
+++ b/engines/ultima/ultima3/ultima3.h
@@ -90,6 +90,7 @@ public:
 
 	Data::Savegame _savegame;
 	Data::Map _map;
+	Data::Map _worldMap;
 	Gfx::Shapes _shapes;
 	Gfx::MessageLog _messages;
 	Gfx::ScreenEffects _effects;
diff --git a/engines/ultima/ultima3/views/form_party.cpp b/engines/ultima/ultima3/views/form_party.cpp
index aa931f405d0..1cce0f122f3 100644
--- a/engines/ultima/ultima3/views/form_party.cpp
+++ b/engines/ultima/ultima3/views/form_party.cpp
@@ -62,6 +62,10 @@ void FormParty::finish() {
 	if (_G(savegame)._partySize == 0) {
 		fail("(No one there)");
 	} else {
+		// A party that came to grief in a town starts out again on the world map
+		if (_G(savegame)._mapLoaded && _G(savegame)._location != Data::LOCATION_SOSARIA)
+			_G(map) = _G(worldMap);
+
 		_G(savegame).formParty();
 		showMessage("(Formed)", 16, 21);
 	}
diff --git a/engines/ultima/ultima3/views/location_map.cpp b/engines/ultima/ultima3/views/location_map.cpp
index e3efe671bdb..4b1bbf2496b 100644
--- a/engines/ultima/ultima3/views/location_map.cpp
+++ b/engines/ultima/ultima3/views/location_map.cpp
@@ -31,6 +31,7 @@ namespace Views {
 constexpr int VIEWPORT_CELLS = VIEWPORT_TILES * VIEWPORT_TILES;
 constexpr int VIEWPORT_CENTER = VIEWPORT_CELLS / 2;
 constexpr byte TILE_HIDDEN = 0x24;
+constexpr byte TILE_GRASS = 1;
 constexpr byte TILE_FOREST = 3;
 constexpr byte TILE_MOUNTAINS = 4;
 constexpr byte TILE_WALL = 0x23;
@@ -70,9 +71,16 @@ void LocationMap::buildViewport(byte *tiles) const {
 	const Data::Savegame &save = _G(savegame);
 	const int half = VIEWPORT_TILES / 2;
 
+	// The world wraps around, whereas beyond the edge of a town is open grass
+	const bool wraps = save._location == Data::LOCATION_SOSARIA;
+
 	for (int row = 0; row < VIEWPORT_TILES; ++row) {
-		for (int col = 0; col < VIEWPORT_TILES; ++col)
-			tiles[row * VIEWPORT_TILES + col] = _G(map).tile(save._posX - half + col, save._posY - half + row);
+		for (int col = 0; col < VIEWPORT_TILES; ++col) {
+			int x = save._posX - half + col, y = save._posY - half + row;
+			bool outside = x < 0 || x >= Data::MAP_SIZE || y < 0 || y >= Data::MAP_SIZE;
+
+			tiles[row * VIEWPORT_TILES + col] = (outside && !wraps) ? TILE_GRASS : _G(map).tile(x, y);
+		}
 	}
 
 	tiles[VIEWPORT_CENTER] = save._transport;
@@ -115,7 +123,13 @@ void LocationMap::drawViewport(GfxSurface &s) {
 
 void LocationMap::endTurn() {
 	_logic.incrementMoveCounter();
-	_logic.processPartyTurnEffects(true);
+
+	if (_logic.isAtExit()) {
+		_G(messages).print("Exit to Sosaria!\nPlease wait...\n");
+		_logic.exitToWorld();
+	}
+
+	_logic.processPartyTurnEffects(_G(savegame)._location == Data::LOCATION_SOSARIA);
 
 	if (!checkPartyWipedOut())
 		startPrompt();
@@ -158,6 +172,19 @@ void LocationMap::doBoard() {
 	}
 }
 
+void LocationMap::doEnter() {
+	_G(messages).print("Enter ");
+
+	const char *text = _logic.enter();
+	if (text) {
+		_G(messages).print(text);
+		_G(messages).print("Please wait...\n");
+		endTurn();
+	} else {
+		commandFailed("<-What?\n");
+	}
+}
+
 void LocationMap::doExitVehicle() {
 	_G(messages).print("X-it ");
 
@@ -207,6 +234,9 @@ bool LocationMap::handleCommand(const KeypressMessage &msg) {
 	case 'X':
 		doExitVehicle();
 		return true;
+	case 'E':
+		doEnter();
+		return true;
 	case 'L':
 		_G(messages).print("Look-");
 		startInteraction(new Interactions::Look());
diff --git a/engines/ultima/ultima3/views/location_map.h b/engines/ultima/ultima3/views/location_map.h
index bf509c64f06..762fa391b3e 100644
--- a/engines/ultima/ultima3/views/location_map.h
+++ b/engines/ultima/ultima3/views/location_map.h
@@ -49,6 +49,7 @@ private:
 	void doPass();
 	void doInvalid();
 	void doBoard();
+	void doEnter();
 	void doExitVehicle();
 
 protected:


Commit: 40b41eef7c44bd61e6ec0bc6a024aba3a7e2dcdd
    https://github.com/scummvm/scummvm/commit/40b41eef7c44bd61e6ec0bc6a024aba3a7e2dcdd
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:41:01+11:00

Commit Message:
ULTIMA: ULTIMA3: Add movement of monsters and townspeople

Changed paths:
  A engines/ultima/ultima3/logic/creature_logic.cpp
  A engines/ultima/ultima3/logic/creature_logic.h
    engines/ultima/module.mk
    engines/ultima/ultima3/views/location_map.cpp
    engines/ultima/ultima3/views/location_map.h


diff --git a/engines/ultima/module.mk b/engines/ultima/module.mk
index d1c851f832d..9d3887b5db5 100644
--- a/engines/ultima/module.mk
+++ b/engines/ultima/module.mk
@@ -171,6 +171,7 @@ MODULE_OBJS += \
 	ultima3/gfx/message_log.o \
 	ultima3/gfx/pic_decoder.o \
 	ultima3/gfx/shapes.o \
+	ultima3/logic/creature_logic.o \
 	ultima3/logic/location_logic.o \
 	ultima3/logic/logic.o \
 	ultima3/views/character_details.o \
diff --git a/engines/ultima/ultima3/logic/creature_logic.cpp b/engines/ultima/ultima3/logic/creature_logic.cpp
new file mode 100644
index 00000000000..9c2983140cc
--- /dev/null
+++ b/engines/ultima/ultima3/logic/creature_logic.cpp
@@ -0,0 +1,218 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "ultima/ultima3/logic/creature_logic.h"
+#include "ultima/ultima3/logic/location_logic.h"
+#include "ultima/ultima3/ultima3.h"
+
+namespace Ultima {
+namespace Ultima3 {
+
+constexpr int MAP_MASK = Data::MAP_SIZE - 1;
+
+// How a creature goes about things, from the top two bits of its flags
+enum Behaviour {
+	STAY_PUT = 0,
+	WANDER = 1,
+	APPROACH = 2,
+	ATTACK = 3
+};
+
+// The monsters that appear in the world, and what each has to stand on
+constexpr int MONSTER_TYPES = 13;
+static const byte MONSTER_TILES[MONSTER_TYPES] = {
+	0x60, 0x5C, 0x64, 0x50, 0x68, 0x6C, 0x34, 0x70, 0x58, 0x38, 0x3C, 0x74, 0x78
+};
+static const byte MONSTER_FLOORS[MONSTER_TYPES] = {
+	0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x00, 0x04, 0x04, 0x00, 0x00, 0x04, 0x04
+};
+
+constexpr byte CELL_WATER = 0;
+constexpr byte CELL_GRASS = 4;
+constexpr byte CELL_BRUSH = 8;
+constexpr byte CELL_FOREST = 0x0C;
+constexpr byte CELL_FLOOR = 0x20;
+constexpr byte FIRST_SEA_CREATURE = 0x2C;
+constexpr byte FIRST_NON_CREATURE = 0x40;
+
+static int randomBelow(int limit) {
+	return Graphics::Views::g_events->getRandomNumber(limit - 1);
+}
+
+int CreatureLogic::stepToward(int from, int to) const {
+	int delta = (byte)(to - from);
+
+	// On the world map, the way round the edge can be shorter
+	if (_G(savegame)._location == Data::LOCATION_SOSARIA)
+		delta = (byte)(delta << 2);
+
+	int8 signedDelta = (int8)delta;
+	return (signedDelta > 0) - (signedDelta < 0);
+}
+
+void CreatureLogic::stepTowardParty(int index, int &x, int &y) const {
+	const Data::Savegame &save = _G(savegame);
+	const Data::Creatures &c = _G(map)._creatures;
+
+	x = (c._x[index] + stepToward(c._x[index], save._posX)) & MAP_MASK;
+	y = (c._y[index] + stepToward(c._y[index], save._posY)) & MAP_MASK;
+}
+
+int CreatureLogic::creatureAt(int x, int y) const {
+	const Data::Creatures &c = _G(map)._creatures;
+
+	for (int i = Data::CREATURE_COUNT - 1; i >= 0; --i) {
+		if (c._tile[i] && c._x[i] == x && c._y[i] == y)
+			return i;
+	}
+
+	return -1;
+}
+
+bool CreatureLogic::canMoveTo(int index, int x, int y) const {
+	const Data::Creatures &c = _G(map)._creatures;
+	byte cell = _G(map).cell(x, y);
+	byte tile = c._tile[index];
+	bool terrainOk;
+
+	if (tile == CELL_GRASS) {
+		terrainOk = cell == tile;
+	} else if (tile < FIRST_NON_CREATURE && tile >= FIRST_SEA_CREATURE) {
+		terrainOk = cell == CELL_WATER;
+	} else {
+		terrainOk = cell == CELL_GRASS || cell == CELL_BRUSH || cell == CELL_FOREST || cell == CELL_FLOOR;
+	}
+
+	return terrainOk && creatureAt(x, y) < 0;
+}
+
+void CreatureLogic::moveTo(int index, int x, int y) {
+	Data::Map &map = _G(map);
+	Data::Creatures &c = map._creatures;
+
+	map.setCell(c._x[index], c._y[index], c._floor[index]);
+	c._x[index] = x;
+	c._y[index] = y;
+	c._floor[index] = map.cell(x, y);
+	map.setCell(x, y, c._tile[index]);
+}
+
+int CreatureLogic::update(bool moved) {
+	const Data::Savegame &save = _G(savegame);
+	const Data::Creatures &c = _G(map)._creatures;
+	const bool world = save._location == Data::LOCATION_SOSARIA;
+
+	// When riding or sailing, a step of the party only lets creatures move half the time
+	if (save._transport != TRANSPORT_ON_FOOT) {
+		if (!moved)
+			_stepToggle = -1;
+
+		_stepToggle = -_stepToggle;
+		if (_stepToggle < 0)
+			return -1;
+	}
+
+	// Time held still stops everyone
+	if (_negateTimeTurns > 0) {
+		--_negateTimeTurns;
+		return -1;
+	}
+
+	for (int i = Data::CREATURE_COUNT - 1; i >= 0; --i) {
+		if (!c._tile[i])
+			continue;
+
+		int x, y;
+		int behaviour = world ? ATTACK : (c._flags[i] >> 6);
+
+		if (behaviour == STAY_PUT)
+			continue;
+
+		if (behaviour == WANDER) {
+			// Half the time, a step in a random direction on each axis
+			if (randomBelow(255) < 128)
+				continue;
+
+			x = (c._x[i] + stepToward(0, randomBelow(255))) & MAP_MASK;
+			if (x == 0)
+				continue;
+
+			y = (c._y[i] + stepToward(0, randomBelow(255))) & MAP_MASK;
+			if (y == 0)
+				continue;
+		} else {
+			stepTowardParty(i, x, y);
+
+			if (behaviour == ATTACK && x == save._posX && y == save._posY)
+				return i;
+		}
+
+		// If it can't go straight there, it tries one axis at a time
+		if (!canMoveTo(i, x, y)) {
+			if (canMoveTo(i, c._x[i], y)) {
+				x = c._x[i];
+			} else if (canMoveTo(i, x, c._y[i])) {
+				y = c._y[i];
+			} else {
+				continue;
+			}
+		}
+
+		if (x != save._posX || y != save._posY)
+			moveTo(i, x, y);
+	}
+
+	spawnMonster();
+	return -1;
+}
+
+void CreatureLogic::spawnMonster() {
+	Data::Map &map = _G(map);
+	Data::Creatures &c = map._creatures;
+	const Data::Savegame &save = _G(savegame);
+
+	if (save._location != Data::LOCATION_SOSARIA || randomBelow(0x87) < 0x80)
+		return;
+
+	int slot = 0;
+	while (slot < Data::CREATURE_COUNT && c._tile[slot])
+		++slot;
+	if (slot == Data::CREATURE_COUNT)
+		return;
+
+	// Lower numbered kinds are more likely
+	int type = randomBelow(MONSTER_TYPES) & randomBelow(MONSTER_TYPES);
+
+	int x = randomBelow(Data::MAP_SIZE);
+	int y = randomBelow(Data::MAP_SIZE);
+	if (x == save._posX || y == save._posY || map.cell(x, y) != MONSTER_FLOORS[type])
+		return;
+
+	c._tile[slot] = MONSTER_TILES[type];
+	c._floor[slot] = MONSTER_FLOORS[type];
+	c._x[slot] = x;
+	c._y[slot] = y;
+	c._flags[slot] = ATTACK << 6;
+	map.setCell(x, y, MONSTER_TILES[type]);
+}
+
+} // namespace Ultima3
+} // namespace Ultima
diff --git a/engines/ultima/ultima3/logic/creature_logic.h b/engines/ultima/ultima3/logic/creature_logic.h
new file mode 100644
index 00000000000..043e0a5bf27
--- /dev/null
+++ b/engines/ultima/ultima3/logic/creature_logic.h
@@ -0,0 +1,88 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef ULTIMA3_LOGIC_CREATURE_LOGIC_H
+#define ULTIMA3_LOGIC_CREATURE_LOGIC_H
+
+#include "ultima/ultima3/data/map.h"
+
+namespace Ultima {
+namespace Ultima3 {
+
+/**
+ * The movement of the creatures on a map: the monsters that roam the world
+ * and the people of the towns and castles
+ */
+class CreatureLogic {
+private:
+	// Alternates when travelling by horse or ship, so that creatures only
+	// get to move on every other step
+	int _stepToggle = 1;
+
+	/**
+	 * Returns the sign of the distance that moving along an axis has to
+	 * cover to reach a target, taking the shortest way round the world
+	 */
+	int stepToward(int from, int to) const;
+
+	/**
+	 * Works out where a creature would stand after a step toward the party
+	 */
+	void stepTowardParty(int index, int &x, int &y) const;
+
+	/**
+	 * Returns true if a creature may step to a position
+	 */
+	bool canMoveTo(int index, int x, int y) const;
+
+	/**
+	 * Returns the creature standing at a position, or -1
+	 */
+	int creatureAt(int x, int y) const;
+
+	/**
+	 * Moves a creature to a position, leaving behind what it was standing on
+	 */
+	void moveTo(int index, int x, int y);
+
+	/**
+	 * Every so often adds a new monster to the world
+	 */
+	void spawnMonster();
+
+public:
+	// How many turns remain of time being held still
+	int _negateTimeTurns = 0;
+
+	/**
+	 * Lets each creature take a turn, and may add a new monster to the world
+	 * @param moved		True if the party just moved, which matters
+	 *		when they're riding or sailing
+	 * @returns		The creature that has reached the party and so starts a
+	 *		fight, or -1
+	 */
+	int update(bool moved);
+};
+
+} // namespace Ultima3
+} // namespace Ultima
+
+#endif
diff --git a/engines/ultima/ultima3/views/location_map.cpp b/engines/ultima/ultima3/views/location_map.cpp
index 4b1bbf2496b..d10a8a11af0 100644
--- a/engines/ultima/ultima3/views/location_map.cpp
+++ b/engines/ultima/ultima3/views/location_map.cpp
@@ -131,12 +131,17 @@ void LocationMap::endTurn() {
 
 	_logic.processPartyTurnEffects(_G(savegame)._location == Data::LOCATION_SOSARIA);
 
+	// A creature reaching the party starts a fight
+	_creatures.update(_moved);
+	_moved = false;
+
 	if (!checkPartyWipedOut())
 		startPrompt();
 }
 
 void LocationMap::doMove(Direction dir, const char *label) {
 	_G(messages).print(label);
+	_moved = true;
 
 	if (!_logic.move(dir)) {
 		_G(messages).print("Invalid Move!\n");
diff --git a/engines/ultima/ultima3/views/location_map.h b/engines/ultima/ultima3/views/location_map.h
index 762fa391b3e..543550bedd6 100644
--- a/engines/ultima/ultima3/views/location_map.h
+++ b/engines/ultima/ultima3/views/location_map.h
@@ -22,6 +22,7 @@
 #ifndef ULTIMA3_VIEWS_LOCATION_MAP_H
 #define ULTIMA3_VIEWS_LOCATION_MAP_H
 
+#include "ultima/ultima3/logic/creature_logic.h"
 #include "ultima/ultima3/logic/location_logic.h"
 #include "ultima/ultima3/views/game.h"
 
@@ -38,6 +39,10 @@ constexpr int VIEWPORT_TILES = 11;
 class LocationMap : public Game {
 private:
 	LocationLogic _logic;
+	CreatureLogic _creatures;
+
+	// Set while a step is being taken, as opposed to some other command
+	bool _moved = false;
 
 	/**
 	 * Fills in the tile numbers for the viewport, with the party's transport


Commit: 625893e6c954d1ff188c91a481bac3763c2361bb
    https://github.com/scummvm/scummvm/commit/625893e6c954d1ff188c91a481bac3763c2361bb
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:41:01+11:00

Commit Message:
ULTIMA: ULTIMA3: Add fights between the party and monsters

Changed paths:
  A engines/ultima/ultima3/data/arena.cpp
  A engines/ultima/ultima3/data/arena.h
  A engines/ultima/ultima3/logic/combat_logic.cpp
  A engines/ultima/ultima3/logic/combat_logic.h
  A engines/ultima/ultima3/views/combat_map.cpp
  A engines/ultima/ultima3/views/combat_map.h
  A engines/ultima/ultima3/views/interactions/combat_attack.cpp
  A engines/ultima/ultima3/views/interactions/combat_attack.h
    engines/ultima/module.mk
    engines/ultima/ultima3/data/data.cpp
    engines/ultima/ultima3/data/data.h
    engines/ultima/ultima3/logic/creature_logic.h
    engines/ultima/ultima3/logic/logic.cpp
    engines/ultima/ultima3/logic/logic.h
    engines/ultima/ultima3/ultima3.cpp
    engines/ultima/ultima3/ultima3.h
    engines/ultima/ultima3/views/game.cpp
    engines/ultima/ultima3/views/game.h
    engines/ultima/ultima3/views/interactions/equip.cpp
    engines/ultima/ultima3/views/interactions/equip.h
    engines/ultima/ultima3/views/interactions/ztats.cpp
    engines/ultima/ultima3/views/interactions/ztats.h
    engines/ultima/ultima3/views/location_map.cpp
    engines/ultima/ultima3/views/location_map.h
    engines/ultima/ultima3/views/views.h


diff --git a/engines/ultima/module.mk b/engines/ultima/module.mk
index 9d3887b5db5..4f79ed36ef4 100644
--- a/engines/ultima/module.mk
+++ b/engines/ultima/module.mk
@@ -163,6 +163,7 @@ MODULE_OBJS += \
 	ultima3/ultima3.o \
 	ultima3/console.o \
 	ultima3/metaengine.o \
+	ultima3/data/arena.o \
 	ultima3/data/data.o \
 	ultima3/data/map.o \
 	ultima3/data/roster.o \
@@ -171,14 +172,17 @@ MODULE_OBJS += \
 	ultima3/gfx/message_log.o \
 	ultima3/gfx/pic_decoder.o \
 	ultima3/gfx/shapes.o \
+	ultima3/logic/combat_logic.o \
 	ultima3/logic/creature_logic.o \
 	ultima3/logic/location_logic.o \
 	ultima3/logic/logic.o \
 	ultima3/views/character_details.o \
+	ultima3/views/combat_map.o \
 	ultima3/views/create_character.o \
 	ultima3/views/disperse_party.o \
 	ultima3/views/form_party.o \
 	ultima3/views/game.o \
+	ultima3/views/interactions/combat_attack.o \
 	ultima3/views/interactions/equip.o \
 	ultima3/views/interactions/exchange.o \
 	ultima3/views/interactions/interaction.o \
diff --git a/engines/ultima/ultima3/data/arena.cpp b/engines/ultima/ultima3/data/arena.cpp
new file mode 100644
index 00000000000..5f978e60170
--- /dev/null
+++ b/engines/ultima/ultima3/data/arena.cpp
@@ -0,0 +1,57 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "common/file.h"
+#include "ultima/ultima3/data/arena.h"
+
+namespace Ultima {
+namespace Ultima3 {
+namespace Data {
+
+void Arena::load(const char *filename) {
+	Common::File f;
+	if (!f.open(filename))
+		error("Could not load %s", filename);
+
+	f.read(_tiles, sizeof(_tiles));
+	f.skip(7);
+	f.read(_monsterX, sizeof(_monsterX));
+	f.read(_monsterY, sizeof(_monsterY));
+	f.read(_monsterUnder, sizeof(_monsterUnder));
+	f.read(_monsterHp, sizeof(_monsterHp));
+	f.read(_playerX, sizeof(_playerX));
+	f.read(_playerY, sizeof(_playerY));
+	f.read(_playerUnder, sizeof(_playerUnder));
+	f.read(_playerTile, sizeof(_playerTile));
+
+	if (f.err() || f.eos())
+		error("Could not load %s", filename);
+
+	// What's in the file for these is left over from the last time it was used
+	memset(_monsterUnder, 0, sizeof(_monsterUnder));
+	memset(_monsterHp, 0, sizeof(_monsterHp));
+	memset(_playerUnder, 0, sizeof(_playerUnder));
+	memset(_playerTile, 0, sizeof(_playerTile));
+}
+
+} // namespace Data
+} // namespace Ultima3
+} // namespace Ultima
diff --git a/engines/ultima/ultima3/data/arena.h b/engines/ultima/ultima3/data/arena.h
new file mode 100644
index 00000000000..5c25834fe08
--- /dev/null
+++ b/engines/ultima/ultima3/data/arena.h
@@ -0,0 +1,75 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef ULTIMA3_DATA_ARENA_H
+#define ULTIMA3_DATA_ARENA_H
+
+#include "common/scummsys.h"
+
+namespace Ultima {
+namespace Ultima3 {
+namespace Data {
+
+constexpr int ARENA_SIZE = 11;
+constexpr int ARENA_MONSTERS = 8;
+constexpr int ARENA_PLAYERS = 4;
+
+// Marks a party member who isn't in the fight
+constexpr byte ARENA_ABSENT = 0xFF;
+
+/**
+ * The ground a fight takes place on: an 11x11 area of tiles, the places the
+ * monsters may start from, and where each of the party starts out. As the
+ * fight goes on it also records who is where, with what they stand on
+ */
+struct Arena {
+	byte _tiles[ARENA_SIZE * ARENA_SIZE] = {};
+	byte _monsterX[ARENA_MONSTERS] = {};
+	byte _monsterY[ARENA_MONSTERS] = {};
+	byte _monsterUnder[ARENA_MONSTERS] = {};
+
+	// Hit points, with none meaning there's no monster
+	byte _monsterHp[ARENA_MONSTERS] = {};
+
+	byte _playerX[ARENA_PLAYERS] = {};
+	byte _playerY[ARENA_PLAYERS] = {};
+	byte _playerUnder[ARENA_PLAYERS] = {};
+	byte _playerTile[ARENA_PLAYERS] = {};
+
+	/**
+	 * Loads an arena from a .ULT file
+	 */
+	void load(const char *filename);
+
+	byte tile(int x, int y) const {
+		return _tiles[y * ARENA_SIZE + x];
+	}
+
+	void setTile(int x, int y, byte value) {
+		_tiles[y * ARENA_SIZE + x] = value;
+	}
+};
+
+} // namespace Data
+} // namespace Ultima3
+} // namespace Ultima
+
+#endif
diff --git a/engines/ultima/ultima3/data/data.cpp b/engines/ultima/ultima3/data/data.cpp
index fa339949a4f..8cd91f34e03 100644
--- a/engines/ultima/ultima3/data/data.cpp
+++ b/engines/ultima/ultima3/data/data.cpp
@@ -82,6 +82,21 @@ const char *const NAMES[NAME_COUNT] = {
 	"Orcus", "Devil"
 };
 
+const byte MONSTER_HIT_POINTS[16] = {
+	0x20, 0x20, 0xF0, 0xF0, 0xC0, 0x60, 0xA0, 0x80, 0x30, 0x50, 0x70, 0xA0, 0xC0, 0xE0, 0xF0, 0xF0
+};
+const byte MONSTER_EXPERIENCE[16] = {
+	0x01, 0x02, 0x15, 0x20, 0x08, 0x06, 0x10, 0x05, 0x03, 0x04, 0x06, 0x08, 0x10, 0x15, 0x20, 0x05
+};
+
+byte fightingTile(char classKey) {
+	static const char CLASSES[] = "FCWTPBLIDA";
+	static const byte TILES[] = { 0x14, 0x15, 0x16, 0x17, 0x14, 0x14, 0x11, 0x16, 0x15, 0x16 };
+
+	const char *pos = classKey ? strchr(CLASSES, classKey) : nullptr;
+	return pos ? TILES[pos - CLASSES] : 0x3F;
+}
+
 int lookupIndex(char key, const char *keys, int count) {
 	for (int i = 0; i < count; ++i) {
 		if (keys[i] == key)
diff --git a/engines/ultima/ultima3/data/data.h b/engines/ultima/ultima3/data/data.h
index c2802f08673..e3bbd407fa1 100644
--- a/engines/ultima/ultima3/data/data.h
+++ b/engines/ultima/ultima3/data/data.h
@@ -59,6 +59,17 @@ extern const char *const ARMOUR_NAMES[ARMOUR_COUNT];
 // are referred to by a number starting at 1
 extern const char *const NAMES[NAME_COUNT];
 
+// The most hit points each kind of monster starts out with, and the
+// experience it gives (in BCD) when killed, found from the low four bits of
+// its tile number
+extern const byte MONSTER_HIT_POINTS[16];
+extern const byte MONSTER_EXPERIENCE[16];
+
+/**
+ * Returns the tile showing a party member of a class in a fight
+ */
+byte fightingTile(char classKey);
+
 /**
  * Returns the index of a key within the first count entries of a key list.
  * As in the original, a key that isn't present maps to the last entry.
diff --git a/engines/ultima/ultima3/logic/combat_logic.cpp b/engines/ultima/ultima3/logic/combat_logic.cpp
new file mode 100644
index 00000000000..a6a399677b5
--- /dev/null
+++ b/engines/ultima/ultima3/logic/combat_logic.cpp
@@ -0,0 +1,631 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "ultima/ultima3/logic/combat_logic.h"
+#include "ultima/ultima3/logic/location_logic.h"
+#include "ultima/ultima3/data/data.h"
+#include "ultima/ultima3/ultima3.h"
+
+namespace Ultima {
+namespace Ultima3 {
+
+using Data::ARENA_SIZE;
+using Data::ARENA_MONSTERS;
+using Data::ARENA_ABSENT;
+
+constexpr byte TILE_GRASS = 1;
+constexpr byte TILE_BRUSH = 2;
+constexpr byte TILE_FOREST = 3;
+constexpr byte TILE_FLOOR = 8;
+constexpr byte TILE_CHEST = 9;
+constexpr byte TILE_FORCE_FIELD = 0x20;
+constexpr byte TILE_LAVA = 0x21;
+constexpr byte TILE_SHOT = 0x3D;
+constexpr byte TILE_SPELL_SHOT = 0x3C;
+
+constexpr byte CELL_CHEST = 0x24;
+constexpr byte CELL_SHIP = 0x2C;
+constexpr byte CELL_GUARD = 0x48;
+constexpr byte CELL_ROYAL_GUARD = 0x4C;
+constexpr byte FLAGS_HOSTILE = 0xC0;
+
+// The monsters that matter for how they behave
+constexpr byte MONSTER_PIRATE = 0x0F;
+constexpr byte MONSTER_THIEF = 0x17;
+constexpr byte MONSTER_LORD_BRITISH = 0x13;
+constexpr byte MONSTER_DRAGON = 0x1D;
+
+constexpr int ALTERNATE_NAMES = 0x79;
+constexpr byte EXODUS_ENTRANCE_X = 10;
+constexpr byte EXOTIC_WEAPON = 0x0F;
+constexpr byte EXOTIC_ARMOUR = 7;
+
+int CombatLogic::rollBelow(int limit) {
+	return Graphics::Views::g_events->getRandomNumber(limit - 1);
+}
+
+void CombatLogic::print(const Common::String &text) {
+	_events.push_back(CombatEvent(text));
+}
+
+void CombatLogic::sound(int effect) {
+	_events.push_back(CombatEvent(CombatEvent::SOUND, effect));
+}
+
+void CombatLogic::overlay(int x, int y, int tile) {
+	_events.push_back(CombatEvent(CombatEvent::OVERLAY, x, y, tile));
+}
+
+void CombatLogic::flashSlot(int slot) {
+	_events.push_back(CombatEvent(CombatEvent::FLASH_SLOT, slot));
+}
+
+void CombatLogic::show() {
+	_events.push_back(CombatEvent(CombatEvent::SHOW));
+}
+
+void CombatLogic::syncShown() {
+	memcpy(_shown, _arena._tiles, sizeof(_shown));
+}
+
+bool CombatLogic::isExodusFight() const {
+	return _savedLocation == Data::LOCATION_CASTLE && _G(savegame)._worldX == EXODUS_ENTRANCE_X;
+}
+
+Common::String CombatLogic::monsterName(bool heading) const {
+	Data::Savegame &save = _G(savegame);
+	int name;
+
+	// People and things of the kinds higher up the list go by two names
+	if ((save._posY & 1) && _monsterClass >= MONSTER_THIEF) {
+		name = ALTERNATE_NAMES + (((_monsterClass - MONSTER_THIEF) << 1) | (save._posX & 1));
+	} else if (_monsterClass == MONSTER_THIEF && heading) {
+		return "Thieves\n\n";
+	} else {
+		name = _monsterClass + 1;
+	}
+
+	Common::String result = Data::NAMES[name - 1];
+
+	if (heading) {
+		switch (name) {
+		case 2:
+		case 9:
+		case 0x14:
+		case 0x87:
+			result += "\n\n";
+			break;
+		case 0x83:
+			result += "es\n\n";
+			break;
+		default:
+			result += "s\n\n";
+			break;
+		}
+	}
+
+	return result;
+}
+
+const char *CombatLogic::chooseArena() {
+	Data::Savegame &save = _G(savegame);
+	const bool onShip = save._transport == TRANSPORT_SHIP;
+
+	if (_savedLocation == Data::LOCATION_DUNGEON)
+		return "CNFLCT_C.ULT";
+
+	if (_monsterClass == MONSTER_PIRATE) {
+		_monsterClass = MONSTER_THIEF;
+		return onShip ? "CNFLCT_S.ULT" : "CNFLCT_A.ULT";
+	}
+
+	if (onShip)
+		return _monsterClass < 0x10 ? "CNFLCT_Q.ULT" : "CNFLCT_R.ULT";
+
+	if (_monsterClass >= 0x0B && _monsterClass < 0x10)
+		return "CNFLCT_M.ULT";
+
+	// Otherwise the ground the party is on decides
+	int terrain = _G(map).tile(save._posX, save._posY);
+	if (terrain == TILE_CHEST) {
+		terrain = _G(map).cell(save._posX, save._posY) & 3;
+		if (terrain == 0)
+			terrain = TILE_FLOOR;
+	}
+
+	switch (terrain) {
+	case TILE_GRASS:
+		return "CNFLCT_G.ULT";
+	case TILE_BRUSH:
+		return "CNFLCT_B.ULT";
+	case TILE_FOREST:
+		return "CNFLCT_F.ULT";
+	case TILE_FLOOR:
+	case TILE_FORCE_FIELD:
+	case TILE_LAVA:
+		return "CNFLCT_C.ULT";
+	default:
+		return _monsterClass == TILE_FLOOR ? "CNFLCT_C.ULT" : "CNFLCT_G.ULT";
+	}
+}
+
+void CombatLogic::begin(int creature) {
+	Data::Savegame &save = _G(savegame);
+	Data::Map &map = _G(map);
+	Data::Creatures &c = map._creatures;
+
+	// Whatever the creature was standing on is left behind as a chest
+	int x = c._x[creature], y = c._y[creature];
+	byte floor = c._floor[creature];
+	map.setCell(x, y, floor ? (((floor >> 2) & 3) | CELL_CHEST) : 0);
+
+	_monsterClass = c._tile[creature] >> 2;
+	c._tile[creature] = 0;
+	if (_monsterClass == MONSTER_PIRATE && save._transport != TRANSPORT_SHIP)
+		map.setCell(x, y, CELL_SHIP);
+
+	// Guards turn on the party
+	for (int i = 0; i < Data::CREATURE_COUNT; ++i) {
+		if (c._tile[i] == CELL_GUARD || c._tile[i] == CELL_ROYAL_GUARD)
+			c._flags[i] = FLAGS_HOSTILE;
+	}
+
+	_savedLocation = save._location;
+	_events.clear();
+	_negateTurns = 0;
+	_combatant = 0;
+
+	_G(messages).print("\n---Conflict!!---\n->");
+	_G(messages).print(monsterName(true).c_str());
+	_G(messages).print("\n\n");
+
+	_arena.load(chooseArena());
+
+	// Everyone able to fight takes their place
+	for (int slot = 0; slot < Data::PARTY_MAX; ++slot) {
+		if (slot < save._partySize && save.partyMember(slot).isAlive()) {
+			const Data::RosterEntry &e = save.partyMember(slot);
+
+			_arena._playerTile[slot] = Data::fightingTile(e._class);
+			_arena._playerUnder[slot] = _arena.tile(_arena._playerX[slot], _arena._playerY[slot]);
+			_arena.setTile(_arena._playerX[slot], _arena._playerY[slot], _arena._playerTile[slot]);
+		} else {
+			_arena._playerX[slot] = _arena._playerY[slot] = ARENA_ABSENT;
+		}
+	}
+
+	int count;
+	if (isExodusFight())
+		count = ARENA_MONSTERS;
+	else if (_savedLocation >= Data::LOCATION_TOWN && _savedLocation != 0xFF)
+		count = (_monsterClass == 0x12) ? ARENA_MONSTERS : 1;
+	else
+		count = rollBelow(ARENA_MONSTERS) + 1;
+
+	while (count-- > 0) {
+		int slot;
+		do {
+			slot = rollBelow(ARENA_MONSTERS);
+		} while (_arena._monsterHp[slot] != 0);
+
+		int maxHp = Data::MONSTER_HIT_POINTS[_monsterClass & 0xF];
+		_arena._monsterHp[slot] = rollBelow(maxHp) | 0x0F;
+
+		int mx = _arena._monsterX[slot], my = _arena._monsterY[slot];
+		_arena._monsterUnder[slot] = _arena.tile(mx, my);
+		_arena.setTile(mx, my, _monsterClass);
+	}
+
+	syncShown();
+}
+
+bool CombatLogic::allMonstersDead() const {
+	for (int i = 0; i < ARENA_MONSTERS; ++i) {
+		if (_arena._monsterHp[i])
+			return false;
+	}
+
+	return true;
+}
+
+int CombatLogic::monsterAt(int x, int y) const {
+	for (int i = ARENA_MONSTERS - 1; i >= 0; --i) {
+		if (_arena._monsterHp[i] && _arena._monsterX[i] == x && _arena._monsterY[i] == y)
+			return i;
+	}
+
+	return -1;
+}
+
+bool CombatLogic::movePlayer(int slot, int dx, int dy) {
+	int x = (byte)(_arena._playerX[slot] + dx);
+	int y = (byte)(_arena._playerY[slot] + dy);
+	if (x >= ARENA_SIZE || y >= ARENA_SIZE)
+		return false;
+
+	byte tile = _arena.tile(x, y);
+	if (tile != TILE_GRASS && tile != TILE_BRUSH && tile != TILE_FOREST && tile != TILE_FLOOR)
+		return false;
+
+	sound(0xF6);
+	_arena.setTile(_arena._playerX[slot], _arena._playerY[slot], _arena._playerUnder[slot]);
+	_arena._playerUnder[slot] = tile;
+	_arena.setTile(x, y, _arena._playerTile[slot]);
+	_arena._playerX[slot] = x;
+	_arena._playerY[slot] = y;
+	show();
+	return true;
+}
+
+int CombatLogic::shoot(int x, int y, int dx, int dy, int tile) {
+	for (;;) {
+		x += dx;
+		y += dy;
+		if ((byte)y >= ARENA_SIZE || (byte)x >= ARENA_SIZE)
+			return -1;
+
+		overlay(x, y, tile);
+
+		int monster = monsterAt(x, y);
+		if (monster >= 0)
+			return monster;
+	}
+}
+
+void CombatLogic::playerAttack(int slot, Direction dir) {
+	Data::RosterEntry &e = _G(savegame).partyMember(slot);
+	const int dx = (dir == DIR_EAST) ? 1 : (dir == DIR_WEST) ? -1 : 0;
+	const int dy = (dir == DIR_SOUTH) ? 1 : (dir == DIR_NORTH) ? -1 : 0;
+	const int x = _arena._playerX[slot], y = _arena._playerY[slot];
+
+	const byte weapon = e._weaponIndex;
+	bool ranged = weapon == 3 || weapon == 5 || weapon == 9 || weapon == 0x0D;
+	int monster = -1;
+
+	sound(0xFD);
+
+	// Close in, a monster has to be right beside the attacker
+	if (!ranged) {
+		int tx = x + dx, ty = y + dy;
+		if (tx >= 0 && ty >= 0 && tx < ARENA_SIZE && ty < ARENA_SIZE)
+			monster = monsterAt(tx, ty);
+
+		// Otherwise daggers can be thrown
+		if (monster < 0 && weapon == 1) {
+			int left = Data::fromBcd(e._weaponOwned[0]) - 1;
+			e._weaponOwned[0] = Data::toBcd(left);
+			if (left == 0)
+				e._weaponIndex = 0;
+
+			ranged = true;
+		}
+	}
+
+	if (ranged)
+		monster = shoot(x, y, dx, dy, TILE_SHOT);
+
+	if (monster < 0) {
+		print("Missed!\n");
+		return;
+	}
+
+	playerHit(slot, monster);
+}
+
+void CombatLogic::playerHit(int slot, int monster) {
+	Data::RosterEntry &e = _G(savegame).partyMember(slot);
+
+	// Only the exotic weapon harms what's found in Exodus's castle
+	if (isExodusFight() && e._weaponIndex != EXOTIC_WEAPON) {
+		print("Missed!\n");
+		return;
+	}
+
+	bool hit = rollBelow(255) >= 128;
+	if (!hit)
+		hit = Data::toBcd(rollBelow(99)) < e._dexterity;
+
+	if (!hit) {
+		print("Missed!\n");
+		return;
+	}
+
+	print(monsterName(false));
+	print("\nHit!\n");
+
+	overlay(_arena._monsterX[monster], _arena._monsterY[monster], TILE_SHOT);
+	sound(0xF7);
+
+	int strength = Data::fromBcd(e._strength);
+	int bonus = rollBelow(strength | 1) + (e._strength >> 1) + (e._strength & 1);
+	byte damage = e._weaponIndex * 3 + bonus + 4;
+
+	damageMonster(slot, monster, damage);
+}
+
+void CombatLogic::damageMonster(int slot, int monster, int damage) {
+	if (_monsterClass == MONSTER_LORD_BRITISH)
+		return;
+
+	if (damage < _arena._monsterHp[monster]) {
+		_arena._monsterHp[monster] -= damage;
+		return;
+	}
+
+	Data::RosterEntry &e = _G(savegame).partyMember(slot);
+	byte gain = Data::MONSTER_EXPERIENCE[_monsterClass & 0xF];
+
+	_arena._monsterHp[monster] = 0;
+	_arena.setTile(_arena._monsterX[monster], _arena._monsterY[monster], _arena._monsterUnder[monster]);
+	print(Common::String::format("Killed! Exp.+%02X\n", gain));
+
+	int experience = Data::fromBcdWord(e._experience) + Data::fromBcd(gain);
+	e._experience = Data::toBcdWord(MIN(experience, 9999));
+	show();
+}
+
+bool CombatLogic::canMonsterMoveTo(int x, int y) const {
+	if (x < 0 || y < 0 || x >= ARENA_SIZE || y >= ARENA_SIZE)
+		return false;
+
+	byte tile = _arena.tile(x, y);
+	bool terrain;
+
+	// The things of the sea stay in the water
+	if (_monsterClass >= 0x0B && _monsterClass < 0x10)
+		terrain = tile == 0;
+	else
+		terrain = tile == TILE_GRASS || tile == TILE_BRUSH || tile == TILE_FOREST || tile == TILE_FLOOR;
+
+	return terrain && monsterAt(x, y) < 0;
+}
+
+static int sign(int value) {
+	return (value > 0) - (value < 0);
+}
+
+int CombatLogic::findTarget(int monster, int &target, int &stepX, int &stepY, int &toX, int &toY) const {
+	Data::Savegame &save = _G(savegame);
+	const int mx = _arena._monsterX[monster], my = _arena._monsterY[monster];
+	int best = 0xFF;
+	target = -1;
+
+	for (int slot = 0; slot < save._partySize; ++slot) {
+		if (!save.partyMember(slot).isAlive())
+			continue;
+
+		int dx = _arena._playerX[slot] - mx;
+		int dy = _arena._playerY[slot] - my;
+
+		// Right beside someone
+		if (ABS(dx) <= 1 && ABS(dy) <= 1) {
+			target = slot;
+			return 0;
+		}
+
+		int distance = ABS(dx) + ABS(dy);
+		if (distance > best)
+			continue;
+
+		// Try heading straight for them, then along each axis in turn
+		int sx = sign(dx), sy = sign(dy);
+		int tx, ty;
+		if (canMonsterMoveTo(mx + sx, my + sy)) {
+			tx = mx + sx;
+			ty = my + sy;
+		} else if (canMonsterMoveTo(mx, my + sy)) {
+			tx = mx;
+			ty = my + sy;
+		} else if (canMonsterMoveTo(mx + sx, my)) {
+			tx = mx + sx;
+			ty = my;
+		} else {
+			continue;
+		}
+
+		best = distance;
+		target = slot;
+		stepX = sx;
+		stepY = sy;
+		toX = tx;
+		toY = ty;
+	}
+
+	return best;
+}
+
+void CombatLogic::killPlayer(int slot) {
+	_arena.setTile(_arena._playerX[slot], _arena._playerY[slot], _arena._playerUnder[slot]);
+	_arena._playerX[slot] = _arena._playerY[slot] = ARENA_ABSENT;
+	print("Killed!!!\n");
+	show();
+}
+
+void CombatLogic::damagePlayer(int slot, int tile) {
+	Data::RosterEntry &e = _G(savegame).partyMember(slot);
+
+	int limit = ((Data::MONSTER_HIT_POINTS[_monsterClass & 0xF] >> 3) + (e._maxHitPoints >> 8)) & 0xFF;
+	int roll = rollBelow(limit | 1) + 1;
+
+	// The amount is worked out in tens and units, which only matters for big rolls
+	int amount = Data::fromBcd((byte)(((roll / 10) << 4) | (roll % 10)));
+	int extra = (_savedLocation & 3) * 10;
+
+	damageCharacter(slot, amount);
+	damageCharacter(slot, extra);
+
+	flashSlot(slot);
+	overlay(_arena._playerX[slot], _arena._playerY[slot], tile);
+	sound(0xF7);
+
+	if (e._status == Data::STATUS_DEAD)
+		killPlayer(slot);
+}
+
+void CombatLogic::monsterPoison(int slot) {
+	Data::RosterEntry &e = _G(savegame).partyMember(slot);
+
+	if (rollBelow(255) & 3 || e._status != Data::STATUS_GOOD)
+		return;
+
+	e._status = Data::STATUS_POISONED;
+	print(Common::String::format("Plr %d Poisoned!\n", slot + 1));
+	sound(0xFA);
+}
+
+void CombatLogic::monsterSteal(int slot) {
+	Data::RosterEntry &e = _G(savegame).partyMember(slot);
+	byte *owned;
+	int pick;
+
+	// Either a weapon or a set of armour is taken
+	if (rollBelow(255) >= 128) {
+		pick = rollBelow(8);
+		if (pick == 0 || pick == e._armourIndex)
+			return;
+		owned = &e._armourOwned[pick - 1];
+	} else {
+		pick = rollBelow(16);
+		if (pick == 0 || pick == e._weaponIndex)
+			return;
+		owned = &e._weaponOwned[pick - 1];
+	}
+
+	if (*owned == 0)
+		return;
+
+	*owned = Data::toBcd(Data::fromBcd(*owned) - 1);
+	print(Common::String::format("Plr %d Pilfered!\n", slot + 1));
+	sound(0xFA);
+}
+
+void CombatLogic::monsterAttack(int slot, int tile) {
+	const Data::RosterEntry &e = _G(savegame).partyMember(slot);
+
+	if (_monsterClass == 0x0E || _monsterClass == 0x1E || _monsterClass == 0x1C)
+		monsterPoison(slot);
+	else if (_monsterClass == MONSTER_THIEF)
+		monsterSteal(slot);
+
+	print(Common::String::format("Plr %d", slot + 1));
+	sound(0xF8);
+
+	bool hit = true;
+	if (!isExodusFight() || e._armourIndex == EXOTIC_ARMOUR)
+		hit = rollBelow(0x10 + e._armourIndex) < 8;
+
+	if (hit) {
+		print(" Hit!\n");
+		damagePlayer(slot, tile);
+	} else {
+		print(" Missed!\n");
+	}
+}
+
+void CombatLogic::monsterBreath(int monster, int stepX, int stepY) {
+	Data::Savegame &save = _G(savegame);
+	int x = _arena._monsterX[monster], y = _arena._monsterY[monster];
+
+	sound(0xFB);
+
+	for (;;) {
+		x += stepX;
+		y += stepY;
+		if ((byte)x >= ARENA_SIZE || (byte)y >= ARENA_SIZE)
+			return;
+
+		for (int slot = save._partySize - 1; slot >= 0; --slot) {
+			if (_arena._playerX[slot] == x && _arena._playerY[slot] == y) {
+				damagePlayer(slot, TILE_SHOT);
+				return;
+			}
+		}
+
+		overlay(x, y, TILE_SHOT);
+	}
+}
+
+void CombatLogic::monsterTurn(int monster) {
+	Data::Savegame &save = _G(savegame);
+	int target, stepX = 0, stepY = 0, toX = 0, toY = 0;
+	int distance = findTarget(monster, target, stepX, stepY, toX, toY);
+
+	// Beside one of the party
+	if (distance == 0) {
+		monsterAttack(target, TILE_SHOT);
+		return;
+	}
+
+	// Dragons breathe fire along the line they're heading
+	if (target >= 0 && rollBelow(255) < 128 && _monsterClass == MONSTER_DRAGON) {
+		monsterBreath(monster, stepX, stepY);
+		return;
+	}
+
+	bool move = distance != 0xFF;
+
+	if (rollBelow(0xC0) >= 0x80) {
+		switch (_monsterClass) {
+		case 0x0D:
+		case 0x0E:
+		case 0x16:
+		case 0x1B:
+		case 0x1D:
+		case 0x1E: {
+			// Some attack from a distance, at anyone in good health
+			int slot = rollBelow(255) & 3;
+			if (slot < save._partySize && save.partyMember(slot)._status == Data::STATUS_GOOD) {
+				_events.push_back(CombatEvent(CombatEvent::FLASH_VIEW));
+				monsterAttack(slot, TILE_SPELL_SHOT);
+				return;
+			}
+			break;
+		}
+
+		default:
+			break;
+		}
+	}
+
+	if (!move)
+		return;
+
+	_arena.setTile(_arena._monsterX[monster], _arena._monsterY[monster], _arena._monsterUnder[monster]);
+	_arena._monsterX[monster] = toX;
+	_arena._monsterY[monster] = toY;
+	_arena._monsterUnder[monster] = _arena.tile(toX, toY);
+	_arena.setTile(toX, toY, _monsterClass);
+	show();
+}
+
+void CombatLogic::monstersTurn() {
+	for (int monster = 0; monster < ARENA_MONSTERS; ++monster) {
+		if (!_arena._monsterHp[monster])
+			continue;
+		if (!_G(savegame).hasLivingPartyMember())
+			break;
+
+		monsterTurn(monster);
+	}
+}
+
+} // namespace Ultima3
+} // namespace Ultima
diff --git a/engines/ultima/ultima3/logic/combat_logic.h b/engines/ultima/ultima3/logic/combat_logic.h
new file mode 100644
index 00000000000..2b40c97ae2b
--- /dev/null
+++ b/engines/ultima/ultima3/logic/combat_logic.h
@@ -0,0 +1,203 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef ULTIMA3_LOGIC_COMBAT_LOGIC_H
+#define ULTIMA3_LOGIC_COMBAT_LOGIC_H
+
+#include "common/array.h"
+#include "common/str.h"
+#include "ultima/ultima3/data/arena.h"
+#include "ultima/ultima3/logic/logic.h"
+
+namespace Ultima {
+namespace Ultima3 {
+
+/**
+ * One thing to show or do as a fight plays out. The rules are carried out
+ * as soon as a command is given, and these are then played back a frame at
+ * a time so what's seen matches the order things happened in
+ */
+struct CombatEvent {
+	enum Type {
+		PRINT,			// Adds text to the message window
+		SOUND,			// Plays a sound effect
+		OVERLAY,		// Shows a tile over the arena for a moment
+		FLASH_SLOT,		// Inverts a party member's panel for a moment
+		FLASH_VIEW,		// Inverts the arena for a moment
+		SHOW			// Brings what's shown up to date with the fight
+	};
+
+	Type _type;
+	int _arg1 = 0, _arg2 = 0, _arg3 = 0;
+	Common::String _text;
+
+	CombatEvent(Type type, int a = 0, int b = 0, int c = 0) : _type(type), _arg1(a), _arg2(b), _arg3(c) {}
+	CombatEvent(const Common::String &text) : _type(PRINT), _text(text) {}
+};
+
+/**
+ * A fight between the party and a group of monsters on a small arena
+ */
+class CombatLogic : public Logic {
+private:
+	// What's drawn on the arena, which lags behind the real state while the
+	// events for a command are being played
+	byte _shown[Data::ARENA_SIZE * Data::ARENA_SIZE] = {};
+
+	Common::Array<CombatEvent> _events;
+	int _negateTurns = 0;
+
+	void print(const Common::String &text);
+	void sound(int effect);
+	void overlay(int x, int y, int tile);
+	void flashSlot(int slot);
+	void show();
+
+	/**
+	 * Returns the file holding the arena for a fight
+	 */
+	const char *chooseArena();
+
+	/**
+	 * Returns a number from 0 up to but not including a limit
+	 */
+	static int rollBelow(int limit);
+
+	/**
+	 * Returns true if the fight is one of those within Exodus's castle,
+	 * where only the strongest weapons work
+	 */
+	bool isExodusFight() const;
+
+	/**
+	 * Returns the name of the monsters being fought
+	 * @param heading	True for the heading shown as a fight starts, which has them in the plural
+	 */
+	Common::String monsterName(bool heading) const;
+
+	int monsterAt(int x, int y) const;
+	bool canMonsterMoveTo(int x, int y) const;
+
+	/**
+	 * Follows a shot from a position until it leaves the arena or reaches a monster
+	 * @returns		The monster hit, or -1
+	 */
+	int shoot(int x, int y, int dx, int dy, int tile);
+
+	/**
+	 * Works out whether a player hits with the weapon they're using, and
+	 * if so how much damage is done to a monster
+	 */
+	void playerHit(int slot, int monster);
+	void damageMonster(int slot, int monster, int damage);
+
+	/**
+	 * Finds the nearest party member a monster can head toward
+	 * @returns		How far away they are, or zero if it's already beside one
+	 *		of the party, in which case the target is that member
+	 */
+	int findTarget(int monster, int &target, int &stepX, int &stepY, int &toX, int &toY) const;
+
+	void monsterTurn(int monster);
+	void monsterAttack(int slot, int tile);
+	void monsterPoison(int slot);
+	void monsterSteal(int slot);
+	void monsterBreath(int monster, int stepX, int stepY);
+	void damagePlayer(int slot, int tile);
+	void killPlayer(int slot);
+
+public:
+	Data::Arena _arena;
+
+	// The tile number of the monsters being fought
+	byte _monsterClass = 0;
+
+	// Where the party was when the fight began
+	byte _savedLocation = 0;
+
+	int _combatant = 0;
+
+	/**
+	 * Starts a fight with one of the creatures on the current map
+	 */
+	void begin(int creature);
+
+	/**
+	 * Brings what's shown up to date with the fight
+	 */
+	void syncShown();
+
+	/**
+	 * Returns the tile to show at a place in the arena
+	 */
+	byte shownTile(int x, int y) const {
+		return _shown[y * Data::ARENA_SIZE + x];
+	}
+
+	/**
+	 * Returns the events waiting to be played back
+	 */
+	Common::Array<CombatEvent> &events() {
+		return _events;
+	}
+
+	bool allMonstersDead() const;
+
+	/**
+	 * Returns how many turns of time being held still are left
+	 */
+	int negateTurns() const {
+		return _negateTurns;
+	}
+
+	void holdTime() {
+		_negateTurns = 10;
+	}
+
+	void decrementHold() {
+		--_negateTurns;
+	}
+
+	void endHold() {
+		_negateTurns = 0;
+	}
+
+	/**
+	 * Lets a party member step in a direction
+	 * @returns		False if something is in the way
+	 */
+	bool movePlayer(int slot, int dx, int dy);
+
+	/**
+	 * Has a party member attack in a direction with the weapon they're using
+	 */
+	void playerAttack(int slot, Direction dir);
+
+	/**
+	 * Lets every monster take its turn
+	 */
+	void monstersTurn();
+};
+
+} // namespace Ultima3
+} // namespace Ultima
+
+#endif
diff --git a/engines/ultima/ultima3/logic/creature_logic.h b/engines/ultima/ultima3/logic/creature_logic.h
index 043e0a5bf27..61faf4bac73 100644
--- a/engines/ultima/ultima3/logic/creature_logic.h
+++ b/engines/ultima/ultima3/logic/creature_logic.h
@@ -53,11 +53,6 @@ private:
 	 */
 	bool canMoveTo(int index, int x, int y) const;
 
-	/**
-	 * Returns the creature standing at a position, or -1
-	 */
-	int creatureAt(int x, int y) const;
-
 	/**
 	 * Moves a creature to a position, leaving behind what it was standing on
 	 */
@@ -72,6 +67,11 @@ public:
 	// How many turns remain of time being held still
 	int _negateTimeTurns = 0;
 
+	/**
+	 * Returns the creature standing at a position, or -1
+	 */
+	int creatureAt(int x, int y) const;
+
 	/**
 	 * Lets each creature take a turn, and may add a new monster to the world
 	 * @param moved		True if the party just moved, which matters
diff --git a/engines/ultima/ultima3/logic/logic.cpp b/engines/ultima/ultima3/logic/logic.cpp
index 43eae1ed0a5..9f0e652ab06 100644
--- a/engines/ultima/ultima3/logic/logic.cpp
+++ b/engines/ultima/ultima3/logic/logic.cpp
@@ -25,6 +25,9 @@
 namespace Ultima {
 namespace Ultima3 {
 
+int Logic::_healCounter = 9;
+int Logic::_upkeepCounter = 4;
+
 constexpr int HUNGER_STEP = 10;
 constexpr int STARVATION_DAMAGE = 5;
 
@@ -33,9 +36,9 @@ static int maxMagicPoints(byte attribute) {
 	return Data::fromBcd(attribute) / 2;
 }
 
-void Logic::incrementMoveCounter() {
+void Logic::incrementMoveCounter(int amount) {
 	Data::Savegame &save = _G(savegame);
-	int carry = save._partySize;
+	int carry = (amount < 0) ? save._partySize : amount;
 
 	for (int i = 0; i < 4 && carry; ++i) {
 		int total = Data::fromBcd(save._moveCount[i]) + carry;
diff --git a/engines/ultima/ultima3/logic/logic.h b/engines/ultima/ultima3/logic/logic.h
index e6683cad2e7..221a9dd1d41 100644
--- a/engines/ultima/ultima3/logic/logic.h
+++ b/engines/ultima/ultima3/logic/logic.h
@@ -42,8 +42,9 @@ enum Direction {
  */
 class Logic {
 private:
-	int _healCounter = 9;
-	int _upkeepCounter = 4;
+	// Shared by every kind of location, so the upkeep carries on unbroken
+	static int _healCounter;
+	static int _upkeepCounter;
 
 	/**
 	 * Gives a character a magic point
@@ -60,8 +61,9 @@ public:
 
 	/**
 	 * Counts a turn taken by the party
+	 * @param amount	How many moves to add, defaulting to one per party member
 	 */
-	void incrementMoveCounter();
+	void incrementMoveCounter(int amount = -1);
 
 	/**
 	 * Applies the effects of a turn passing on the party: magic point
diff --git a/engines/ultima/ultima3/ultima3.cpp b/engines/ultima/ultima3/ultima3.cpp
index 8548e6ecced..7a8056f8973 100644
--- a/engines/ultima/ultima3/ultima3.cpp
+++ b/engines/ultima/ultima3/ultima3.cpp
@@ -77,7 +77,8 @@ bool Ultima3Engine::canSaveGameStateCurrently(Common::U32String *msg) {
 	// Anything but the title sequence, which isn't a state worth keeping
 	UIElement *view = focusedView();
 
-	return dynamic_cast<Views::Game *>(view) != nullptr ||
+	return (dynamic_cast<Views::Game *>(view) != nullptr &&
+		dynamic_cast<Views::CombatMap *>(view) == nullptr) ||
 		dynamic_cast<Views::WindowView *>(view) != nullptr;
 }
 
diff --git a/engines/ultima/ultima3/ultima3.h b/engines/ultima/ultima3/ultima3.h
index 3bfc01b586e..f6a637185bf 100644
--- a/engines/ultima/ultima3/ultima3.h
+++ b/engines/ultima/ultima3/ultima3.h
@@ -36,6 +36,7 @@
 #include "ultima/ultima3/gfx/message_log.h"
 #include "ultima/ultima3/gfx/screen_effects.h"
 #include "ultima/ultima3/gfx/shapes.h"
+#include "ultima/ultima3/logic/combat_logic.h"
 
 namespace Audio {
 class PCSpeaker;
@@ -91,6 +92,7 @@ public:
 	Data::Savegame _savegame;
 	Data::Map _map;
 	Data::Map _worldMap;
+	CombatLogic _combat;
 	Gfx::Shapes _shapes;
 	Gfx::MessageLog _messages;
 	Gfx::ScreenEffects _effects;
diff --git a/engines/ultima/ultima3/views/combat_map.cpp b/engines/ultima/ultima3/views/combat_map.cpp
new file mode 100644
index 00000000000..ee5bd70576e
--- /dev/null
+++ b/engines/ultima/ultima3/views/combat_map.cpp
@@ -0,0 +1,295 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "ultima/ultima3/views/combat_map.h"
+#include "ultima/ultima3/views/menu_input.h"
+#include "ultima/ultima3/views/interactions/combat_attack.h"
+#include "ultima/ultima3/views/interactions/equip.h"
+#include "ultima/ultima3/views/interactions/ztats.h"
+#include "ultima/ultima3/data/data.h"
+#include "ultima/ultima3/ultima3.h"
+
+namespace Ultima {
+namespace Ultima3 {
+namespace Views {
+
+constexpr int ARENA_LEFT = 8;
+constexpr int ARENA_TOP = 8;
+
+bool CombatMap::msgFocus(const FocusMessage &msg) {
+	if (!_started) {
+		_started = true;
+		_next = NOTHING;
+		_overlay = false;
+		beginRound();
+	}
+
+	return Game::msgFocus(msg);
+}
+
+void CombatMap::beginRound() {
+	_G(combat).processPartyTurnEffects(false);
+	_G(combat)._combatant = 0;
+	beginTurn();
+}
+
+void CombatMap::beginTurn() {
+	CombatLogic &combat = _G(combat);
+	Data::Savegame &save = _G(savegame);
+
+	for (; combat._combatant < save._partySize; ++combat._combatant) {
+		_G(effects)._highlight = combat._combatant;
+
+		if (save.partyMember(combat._combatant).isAlive()) {
+			_G(messages).print(Common::String::format("----Player %d----\n", combat._combatant + 1).c_str());
+			startPrompt();
+			return;
+		}
+
+		combat.incrementMoveCounter(1);
+	}
+
+	_G(effects)._highlight = -1;
+	monstersTurn();
+}
+
+void CombatMap::advanceTurn() {
+	CombatLogic &combat = _G(combat);
+
+	combat.incrementMoveCounter(1);
+	_G(effects)._highlight = -1;
+
+	if (combat.allMonstersDead()) {
+		victory();
+		return;
+	}
+
+	++combat._combatant;
+	beginTurn();
+}
+
+void CombatMap::monstersTurn() {
+	CombatLogic &combat = _G(combat);
+
+	if (combat.negateTurns() > 0)
+		combat.decrementHold();
+	else
+		combat.monstersTurn();
+
+	_next = NEXT_ROUND;
+}
+
+void CombatMap::victory() {
+	_G(messages).print("****Victory!****\n\n");
+	g_engine->playSoundEffect(0xFD);
+
+	_G(combat).endHold();
+	_G(effects)._highlight = -1;
+	_started = false;
+	close();
+}
+
+void CombatMap::endTurn() {
+	_next = NEXT_PLAYER;
+}
+
+bool CombatMap::isWaiting() const {
+	return _next == NOTHING && _G(combat).events().empty();
+}
+
+void CombatMap::processFrame() {
+	_overlay = false;
+	Common::Array<CombatEvent> &events = _G(combat).events();
+
+	while (!events.empty()) {
+		CombatEvent event = events[0];
+		events.remove_at(0);
+
+		switch (event._type) {
+		case CombatEvent::PRINT:
+			_G(messages).print(event._text.c_str());
+			break;
+		case CombatEvent::SOUND:
+			g_engine->playSoundEffect(event._arg1);
+			break;
+		case CombatEvent::OVERLAY:
+			_overlay = true;
+			_overlayX = event._arg1;
+			_overlayY = event._arg2;
+			_overlayTile = event._arg3;
+			return;
+		case CombatEvent::FLASH_SLOT:
+			_G(effects).flashSlot(event._arg1);
+			break;
+		case CombatEvent::FLASH_VIEW:
+			_G(effects).flashViewport();
+			return;
+		case CombatEvent::SHOW:
+			_G(combat).syncShown();
+			return;
+		}
+	}
+
+	if (_next == NOTHING || _gameOver)
+		return;
+
+	if (checkPartyWipedOut()) {
+		_next = NOTHING;
+		return;
+	}
+
+	Next next = _next;
+	_next = NOTHING;
+
+	if (next == NEXT_PLAYER)
+		advanceTurn();
+	else
+		beginRound();
+}
+
+void CombatMap::idleTimeout() {
+	_G(messages).print("Pass\n");
+	endTurn();
+}
+
+bool CombatMap::msgKeypress(const KeypressMessage &msg) {
+	// Keys are ignored while the last command is still playing out
+	if (!isWaiting() && !_gameOver)
+		return true;
+
+	return Game::msgKeypress(msg);
+}
+
+void CombatMap::doMove(int dx, int dy, const char *label) {
+	_G(messages).print(label);
+
+	if (!_G(combat).movePlayer(_G(combat)._combatant, dx, dy)) {
+		_G(messages).print("Invalid Move!\n");
+		g_engine->playSoundEffect(0xFF);
+	}
+
+	endTurn();
+}
+
+void CombatMap::doNegateTime() {
+	Data::RosterEntry &e = _G(savegame).partyMember(_G(combat)._combatant);
+	_G(messages).print("Negate Time!\n");
+
+	if (e._powder == 0) {
+		_G(messages).print("None Left!\n");
+		g_engine->playSoundEffect(0xFE);
+	} else {
+		e._powder = Data::toBcd(Data::fromBcd(e._powder) - 1);
+		_G(combat).holdTime();
+	}
+
+	endTurn();
+}
+
+void CombatMap::doAttack() {
+	const Data::RosterEntry &e = _G(savegame).partyMember(_G(combat)._combatant);
+
+	_G(messages).print(Data::WEAPON_NAMES[e._weaponIndex]);
+	_G(messages).print(" Attack\nDir-");
+	startInteraction(new Interactions::CombatAttack(_G(combat)._combatant));
+}
+
+bool CombatMap::handleCommand(const KeypressMessage &msg) {
+	const int slot = _G(combat)._combatant;
+
+	switch (msg.keycode) {
+	case Common::KEYCODE_UP:
+	case Common::KEYCODE_KP8:
+		doMove(0, -1, "North\n");
+		return true;
+	case Common::KEYCODE_DOWN:
+	case Common::KEYCODE_KP2:
+		doMove(0, 1, "South\n");
+		return true;
+	case Common::KEYCODE_RIGHT:
+	case Common::KEYCODE_KP6:
+		doMove(1, 0, "East\n");
+		return true;
+	case Common::KEYCODE_LEFT:
+	case Common::KEYCODE_KP4:
+		doMove(-1, 0, "West\n");
+		return true;
+	case Common::KEYCODE_SPACE:
+		_G(messages).print("Pass\n");
+		endTurn();
+		return true;
+	default:
+		break;
+	}
+
+	switch (commandKey(msg)) {
+	case 'R':
+		_G(messages).print("Ready a weapon!\n");
+		startInteraction(new Interactions::Equip(true, slot));
+		return true;
+	case 'Z':
+		_G(messages).print("Ztats\n");
+		startInteraction(new Interactions::Ztats(slot));
+		return true;
+	case 'N':
+		doNegateTime();
+		return true;
+	case 'A':
+		doAttack();
+		return true;
+	case 'V':
+		return Game::handleCommand(msg);
+
+	// Keys for commands that can't be used in a fight don't take a turn
+	case 'U': case 'B': case 'D': case 'E': case 'F': case 'G': case 'I':
+	case 'K': case 'P': case 'Q': case 'S': case 'T': case 'W': case 'X':
+	case 'H': case 'J': case 'L': case 'M': case 'O': case 'Y':
+		_G(messages).print("Not usable cmd!\n");
+		g_engine->playSoundEffect(0xFE);
+		startPrompt();
+		return true;
+
+	default:
+		_G(messages).print("<-What?\n");
+		g_engine->playSoundEffect(0xFE);
+		endTurn();
+		return true;
+	}
+}
+
+void CombatMap::drawViewport(GfxSurface &s) {
+	const CombatLogic &combat = _G(combat);
+
+	for (int y = 0; y < Data::ARENA_SIZE; ++y) {
+		for (int x = 0; x < Data::ARENA_SIZE; ++x) {
+			byte tile = (_overlay && x == _overlayX && y == _overlayY) ? _overlayTile : combat.shownTile(x, y);
+
+			_G(shapes).drawTile(s, ARENA_LEFT + x * Gfx::SHAPE_SIZE, ARENA_TOP + y * Gfx::SHAPE_SIZE, tile);
+		}
+	}
+
+	s.addDirtyRect(Common::Rect(ARENA_LEFT, ARENA_TOP, ARENA_LEFT + Data::ARENA_SIZE * Gfx::SHAPE_SIZE,
+		ARENA_TOP + Data::ARENA_SIZE * Gfx::SHAPE_SIZE));
+}
+
+} // namespace Views
+} // namespace Ultima3
+} // namespace Ultima
diff --git a/engines/ultima/ultima3/views/combat_map.h b/engines/ultima/ultima3/views/combat_map.h
new file mode 100644
index 00000000000..de204337bb3
--- /dev/null
+++ b/engines/ultima/ultima3/views/combat_map.h
@@ -0,0 +1,93 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef ULTIMA3_VIEWS_COMBAT_MAP_H
+#define ULTIMA3_VIEWS_COMBAT_MAP_H
+
+#include "ultima/ultima3/views/game.h"
+
+namespace Ultima {
+namespace Ultima3 {
+namespace Views {
+
+/**
+ * A fight on a small arena. The party members each take a turn in order,
+ * followed by the monsters, until one side is beaten
+ */
+class CombatMap : public Game {
+private:
+	// What happens once the events from a command have been played
+	enum Next {
+		NOTHING,
+		NEXT_PLAYER,
+		NEXT_ROUND
+	};
+
+	bool _started = false;
+	Next _next = NOTHING;
+
+	// A tile shown over the arena for a frame
+	bool _overlay = false;
+	int _overlayX = 0, _overlayY = 0, _overlayTile = 0;
+
+	/**
+	 * Starts a round, in which each party member and then the monsters act
+	 */
+	void beginRound();
+
+	/**
+	 * Starts the turn of the party member whose turn it is, passing over
+	 * any who can't act
+	 */
+	void beginTurn();
+
+	/**
+	 * Moves on from a turn that has taken place
+	 */
+	void advanceTurn();
+
+	void monstersTurn();
+	void victory();
+	void doMove(int dx, int dy, const char *label);
+	void doNegateTime();
+	void doAttack();
+
+protected:
+	void drawViewport(GfxSurface &s) override;
+	void idleTimeout() override;
+	void endTurn() override;
+	void processFrame() override;
+	bool isWaiting() const override;
+	bool handleCommand(const KeypressMessage &msg) override;
+
+public:
+	CombatMap() : Game("CombatMap") {}
+	~CombatMap() override {}
+
+	bool msgFocus(const FocusMessage &msg) override;
+	bool msgKeypress(const KeypressMessage &msg) override;
+};
+
+} // namespace Views
+} // namespace Ultima3
+} // namespace Ultima
+
+#endif
diff --git a/engines/ultima/ultima3/views/game.cpp b/engines/ultima/ultima3/views/game.cpp
index cb126c8556b..dedaea7a56c 100644
--- a/engines/ultima/ultima3/views/game.cpp
+++ b/engines/ultima/ultima3/views/game.cpp
@@ -99,8 +99,9 @@ void Game::timeout() {
 	_G(shapes).animate();
 	_G(effects).tick();
 	updateWind();
+	processFrame();
 
-	if (!_gameOver && !_interaction && ++_idleFrames >= IDLE_FRAMES)
+	if (!_gameOver && !_interaction && isWaiting() && ++_idleFrames >= IDLE_FRAMES)
 		idleTimeout();
 
 	redraw();
diff --git a/engines/ultima/ultima3/views/game.h b/engines/ultima/ultima3/views/game.h
index 70e68695c42..e837d6c5f42 100644
--- a/engines/ultima/ultima3/views/game.h
+++ b/engines/ultima/ultima3/views/game.h
@@ -74,6 +74,18 @@ protected:
 	 */
 	virtual void endTurn() = 0;
 
+	/**
+	 * Called every frame, for anything the view has going on
+	 */
+	virtual void processFrame() {}
+
+	/**
+	 * Returns true if the view is waiting for a command, rather than busy
+	 */
+	virtual bool isWaiting() const {
+		return true;
+	}
+
 	/**
 	 * Carries out the command for a key press, if it's one that works the
 	 * same wherever the party is
diff --git a/engines/ultima/ultima3/views/interactions/combat_attack.cpp b/engines/ultima/ultima3/views/interactions/combat_attack.cpp
new file mode 100644
index 00000000000..b1473dc0544
--- /dev/null
+++ b/engines/ultima/ultima3/views/interactions/combat_attack.cpp
@@ -0,0 +1,44 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "ultima/ultima3/views/interactions/combat_attack.h"
+#include "ultima/ultima3/ultima3.h"
+
+namespace Ultima {
+namespace Ultima3 {
+namespace Views {
+namespace Interactions {
+
+bool CombatAttack::keypress(const KeypressMessage &msg) {
+	DirectionChooser::Result result = _chooser.handleKey(msg);
+	if (result == DirectionChooser::PENDING)
+		return false;
+
+	if (result == DirectionChooser::CHOSEN)
+		_G(combat).playerAttack(_slot, _chooser.direction());
+
+	return true;
+}
+
+} // namespace Interactions
+} // namespace Views
+} // namespace Ultima3
+} // namespace Ultima
diff --git a/engines/ultima/ultima3/views/interactions/combat_attack.h b/engines/ultima/ultima3/views/interactions/combat_attack.h
new file mode 100644
index 00000000000..c8a8c3f5ae2
--- /dev/null
+++ b/engines/ultima/ultima3/views/interactions/combat_attack.h
@@ -0,0 +1,51 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef ULTIMA3_VIEWS_INTERACTIONS_COMBAT_ATTACK_H
+#define ULTIMA3_VIEWS_INTERACTIONS_COMBAT_ATTACK_H
+
+#include "ultima/ultima3/views/interactions/interaction.h"
+
+namespace Ultima {
+namespace Ultima3 {
+namespace Views {
+namespace Interactions {
+
+/**
+ * Asks which way a party member in a fight is to attack
+ */
+class CombatAttack : public Interaction {
+private:
+	DirectionChooser _chooser;
+	int _slot;
+
+public:
+	CombatAttack(int slot) : _slot(slot) {}
+
+	bool keypress(const KeypressMessage &msg) override;
+};
+
+} // namespace Interactions
+} // namespace Views
+} // namespace Ultima3
+} // namespace Ultima
+
+#endif
diff --git a/engines/ultima/ultima3/views/interactions/equip.cpp b/engines/ultima/ultima3/views/interactions/equip.cpp
index 205cd82359d..3c2fe3d41bf 100644
--- a/engines/ultima/ultima3/views/interactions/equip.cpp
+++ b/engines/ultima/ultima3/views/interactions/equip.cpp
@@ -37,6 +37,14 @@ constexpr char ESCAPE_KEY = 0x1B;
 constexpr char EXOTIC_WEAPON = 'P';
 constexpr char EXOTIC_ARMOUR = 'H';
 
+Equip::Equip(bool weapons, int slot) : _weapons(weapons), _slot(slot) {
+	if (slot >= 0) {
+		_choosing = false;
+		_G(messages).print(_weapons ? "Weapon:\n" : "Armour:\n");
+		startMenu();
+	}
+}
+
 void Equip::startMenu() {
 	const Data::Savegame &save = _G(savegame);
 	int letters;
@@ -61,7 +69,7 @@ void Equip::startMenu() {
 }
 
 void Equip::equip(char letter) {
-	Data::RosterEntry &e = _G(savegame).partyMember(_chooser.slot());
+	Data::RosterEntry &e = _G(savegame).partyMember(_slot);
 
 	const char *classPos = strchr(CLASS_ORDER, e._class);
 	int classNum = (classPos && *classPos) ? classPos - CLASS_ORDER : 0;
@@ -99,7 +107,8 @@ bool Equip::keypress(const KeypressMessage &msg) {
 		if (result == PlayerChooser::CANCELLED)
 			return true;
 
-		if (!_G(savegame).partyMember(_chooser.slot()).isAlive()) {
+		_slot = _chooser.slot();
+		if (!_G(savegame).partyMember(_slot).isAlive()) {
 			_G(messages).print("Incapacitated!\n");
 			g_engine->playSoundEffect(0xFF);
 			return true;
diff --git a/engines/ultima/ultima3/views/interactions/equip.h b/engines/ultima/ultima3/views/interactions/equip.h
index 04c64ff46e6..4454c783918 100644
--- a/engines/ultima/ultima3/views/interactions/equip.h
+++ b/engines/ultima/ultima3/views/interactions/equip.h
@@ -38,6 +38,7 @@ private:
 	bool _weapons;
 	PlayerChooser _chooser;
 	bool _choosing = true;
+	int _slot = -1;
 	MenuChoice _menu;
 	char _keys[20];
 	const char *_words[19];
@@ -56,8 +57,9 @@ public:
 	/**
 	 * Constructor
 	 * @param weapons	True for weapons, false for armour
+	 * @param slot		The party member, or -1 to ask who
 	 */
-	Equip(bool weapons) : _weapons(weapons) {}
+	Equip(bool weapons, int slot = -1);
 
 	bool keypress(const KeypressMessage &msg) override;
 };
diff --git a/engines/ultima/ultima3/views/interactions/ztats.cpp b/engines/ultima/ultima3/views/interactions/ztats.cpp
index a07d1937e0c..c266fb33ea4 100644
--- a/engines/ultima/ultima3/views/interactions/ztats.cpp
+++ b/engines/ultima/ultima3/views/interactions/ztats.cpp
@@ -34,6 +34,18 @@ static const char *const MARK_NAMES[8] = {
 	"Card of Death", "Card of Moons", "Card of Sol", "Card of Love"
 };
 
+Ztats::Ztats(int slot) {
+	if (slot >= 0)
+		begin(slot);
+}
+
+void Ztats::begin(int slot) {
+	_showing = true;
+	_G(effects)._highlight = slot;
+	buildPages(_G(savegame).partyMember(slot));
+	_G(messages).print(_pages[0].c_str());
+}
+
 Ztats::~Ztats() {
 	_G(effects)._highlight = -1;
 }
@@ -97,10 +109,7 @@ bool Ztats::keypress(const KeypressMessage &msg) {
 		if (result == PlayerChooser::CANCELLED)
 			return true;
 
-		_showing = true;
-		_G(effects)._highlight = _chooser.slot();
-		buildPages(_G(savegame).partyMember(_chooser.slot()));
-		_G(messages).print(_pages[0].c_str());
+		begin(_chooser.slot());
 		return false;
 	}
 
diff --git a/engines/ultima/ultima3/views/interactions/ztats.h b/engines/ultima/ultima3/views/interactions/ztats.h
index 1676ab5c95f..0668add6664 100644
--- a/engines/ultima/ultima3/views/interactions/ztats.h
+++ b/engines/ultima/ultima3/views/interactions/ztats.h
@@ -49,7 +49,17 @@ private:
 
 	void finish();
 
+	/**
+	 * Starts showing a party member's details
+	 */
+	void begin(int slot);
+
 public:
+	/**
+	 * Constructor
+	 * @param slot		The party member, or -1 to ask who
+	 */
+	Ztats(int slot = -1);
 	~Ztats() override;
 
 	bool keypress(const KeypressMessage &msg) override;
diff --git a/engines/ultima/ultima3/views/location_map.cpp b/engines/ultima/ultima3/views/location_map.cpp
index d10a8a11af0..5a15d19b068 100644
--- a/engines/ultima/ultima3/views/location_map.cpp
+++ b/engines/ultima/ultima3/views/location_map.cpp
@@ -121,7 +121,19 @@ void LocationMap::drawViewport(GfxSurface &s) {
 	s.addDirtyRect(Common::Rect(8, 8, 8 + VIEWPORT_TILES * Gfx::SHAPE_SIZE, 8 + VIEWPORT_TILES * Gfx::SHAPE_SIZE));
 }
 
+void LocationMap::startFight(int creature) {
+	_G(combat).begin(creature);
+	_fightOver = true;
+	addView("CombatMap");
+}
+
 void LocationMap::endTurn() {
+	// A fight begun by the party's own command carries on the turn when it's over
+	if (_fightStarted) {
+		_fightStarted = false;
+		return;
+	}
+
 	_logic.incrementMoveCounter();
 
 	if (_logic.isAtExit()) {
@@ -132,13 +144,75 @@ void LocationMap::endTurn() {
 	_logic.processPartyTurnEffects(_G(savegame)._location == Data::LOCATION_SOSARIA);
 
 	// A creature reaching the party starts a fight
-	_creatures.update(_moved);
+	int creature = _creatures.update(_moved);
 	_moved = false;
+	if (creature >= 0) {
+		startFight(creature);
+		return;
+	}
 
 	if (!checkPartyWipedOut())
 		startPrompt();
 }
 
+void LocationMap::processFrame() {
+	if (_fightOver) {
+		_fightOver = false;
+		endTurn();
+	}
+}
+
+void LocationMap::attackDirection(Direction dir) {
+	const Data::Savegame &save = _G(savegame);
+	int x = save._posX, y = save._posY;
+
+	switch (dir) {
+	case DIR_NORTH: --y; break;
+	case DIR_SOUTH: ++y; break;
+	case DIR_EAST: ++x; break;
+	default: --x; break;
+	}
+
+	int creature = _creatures.creatureAt(x & (Data::MAP_SIZE - 1), y & (Data::MAP_SIZE - 1));
+	if (creature >= 0) {
+		_fightStarted = true;
+		startFight(creature);
+	} else {
+		_G(messages).print("Not Here!\n");
+		g_engine->playSoundEffect(0xFF);
+	}
+}
+
+namespace {
+
+// Asks which way the party attacks on the map
+class MapAttack : public Interactions::Interaction {
+private:
+	LocationMap *_map;
+	Interactions::DirectionChooser _chooser;
+
+public:
+	MapAttack(LocationMap *map) : _map(map) {}
+
+	bool keypress(const KeypressMessage &msg) override {
+		Interactions::DirectionChooser::Result result = _chooser.handleKey(msg);
+		if (result == Interactions::DirectionChooser::PENDING)
+			return false;
+
+		if (result == Interactions::DirectionChooser::CHOSEN)
+			_map->attackDirection(_chooser.direction());
+
+		return true;
+	}
+};
+
+} // End of anonymous namespace
+
+void LocationMap::doAttack() {
+	_G(messages).print("Attack-");
+	startInteraction(new MapAttack(this));
+}
+
 void LocationMap::doMove(Direction dir, const char *label) {
 	_G(messages).print(label);
 	_moved = true;
@@ -242,6 +316,9 @@ bool LocationMap::handleCommand(const KeypressMessage &msg) {
 	case 'E':
 		doEnter();
 		return true;
+	case 'A':
+		doAttack();
+		return true;
 	case 'L':
 		_G(messages).print("Look-");
 		startInteraction(new Interactions::Look());
diff --git a/engines/ultima/ultima3/views/location_map.h b/engines/ultima/ultima3/views/location_map.h
index 543550bedd6..7303d094eb9 100644
--- a/engines/ultima/ultima3/views/location_map.h
+++ b/engines/ultima/ultima3/views/location_map.h
@@ -44,6 +44,16 @@ private:
 	// Set while a step is being taken, as opposed to some other command
 	bool _moved = false;
 
+	// Set when a fight has just begun, and when one has finished and the
+	// turn it interrupted needs completing
+	bool _fightStarted = false;
+	bool _fightOver = false;
+
+	/**
+	 * Starts a fight with a creature
+	 */
+	void startFight(int creature);
+
 	/**
 	 * Fills in the tile numbers for the viewport, with the party's transport
 	 * in the middle and hidden tiles blanked out
@@ -55,12 +65,14 @@ private:
 	void doInvalid();
 	void doBoard();
 	void doEnter();
+	void doAttack();
 	void doExitVehicle();
 
 protected:
 	void drawViewport(GfxSurface &s) override;
 	void idleTimeout() override;
 	void endTurn() override;
+	void processFrame() override;
 	bool handleCommand(const KeypressMessage &msg) override;
 
 public:
@@ -68,6 +80,11 @@ public:
 	~LocationMap() override {}
 
 	bool msgFocus(const FocusMessage &msg) override;
+
+	/**
+	 * Has the party attack whatever is in a direction
+	 */
+	void attackDirection(Direction dir);
 };
 
 } // namespace Views
diff --git a/engines/ultima/ultima3/views/views.h b/engines/ultima/ultima3/views/views.h
index e37cd3e2e59..d8b13d888fc 100644
--- a/engines/ultima/ultima3/views/views.h
+++ b/engines/ultima/ultima3/views/views.h
@@ -24,6 +24,7 @@
 
 #include "ultima/shared/engine/events.h"
 #include "ultima/ultima3/views/character_details.h"
+#include "ultima/ultima3/views/combat_map.h"
 #include "ultima/ultima3/views/create_character.h"
 #include "ultima/ultima3/views/disperse_party.h"
 #include "ultima/ultima3/views/form_party.h"
@@ -42,6 +43,7 @@ namespace Views {
 
 struct Views {
 	CharacterDetails _characterDetails;
+	CombatMap _combatMap;
 	CreateCharacter _createCharacter;
 	DisperseParty _disperseParty;
 	FormParty _formParty;


Commit: e60c6b973e81501a30ec314c26eab15a80af9bd8
    https://github.com/scummvm/scummvm/commit/e60c6b973e81501a30ec314c26eab15a80af9bd8
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:41:01+11:00

Commit Message:
ULTIMA: ULTIMA3: Add the get, steal and unlock commands

Changed paths:
  A engines/ultima/ultima3/logic/chest_logic.cpp
  A engines/ultima/ultima3/logic/chest_logic.h
  A engines/ultima/ultima3/views/interactions/get_chest.cpp
  A engines/ultima/ultima3/views/interactions/get_chest.h
  A engines/ultima/ultima3/views/interactions/steal_chest.cpp
  A engines/ultima/ultima3/views/interactions/steal_chest.h
  A engines/ultima/ultima3/views/interactions/unlock_door.cpp
  A engines/ultima/ultima3/views/interactions/unlock_door.h
    engines/ultima/module.mk
    engines/ultima/ultima3/views/location_map.cpp


diff --git a/engines/ultima/module.mk b/engines/ultima/module.mk
index 4f79ed36ef4..270e5537f90 100644
--- a/engines/ultima/module.mk
+++ b/engines/ultima/module.mk
@@ -172,6 +172,7 @@ MODULE_OBJS += \
 	ultima3/gfx/message_log.o \
 	ultima3/gfx/pic_decoder.o \
 	ultima3/gfx/shapes.o \
+	ultima3/logic/chest_logic.o \
 	ultima3/logic/combat_logic.o \
 	ultima3/logic/creature_logic.o \
 	ultima3/logic/location_logic.o \
@@ -185,8 +186,11 @@ MODULE_OBJS += \
 	ultima3/views/interactions/combat_attack.o \
 	ultima3/views/interactions/equip.o \
 	ultima3/views/interactions/exchange.o \
+	ultima3/views/interactions/get_chest.o \
 	ultima3/views/interactions/interaction.o \
 	ultima3/views/interactions/look.o \
+	ultima3/views/interactions/steal_chest.o \
+	ultima3/views/interactions/unlock_door.o \
 	ultima3/views/interactions/ztats.o \
 	ultima3/views/journey_onward.o \
 	ultima3/views/location_map.o \
diff --git a/engines/ultima/ultima3/logic/chest_logic.cpp b/engines/ultima/ultima3/logic/chest_logic.cpp
new file mode 100644
index 00000000000..11817e31e08
--- /dev/null
+++ b/engines/ultima/ultima3/logic/chest_logic.cpp
@@ -0,0 +1,160 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "ultima/ultima3/logic/chest_logic.h"
+#include "ultima/ultima3/data/data.h"
+#include "ultima/ultima3/ultima3.h"
+
+namespace Ultima {
+namespace Ultima3 {
+
+int ChestLogic::rollBelow(int limit) {
+	return Graphics::Views::g_events->getRandomNumber(limit - 1);
+}
+
+bool ChestLogic::evadesTrap(int slot) {
+	const Data::RosterEntry &e = _G(savegame).partyMember(slot);
+	int chance = Data::fromBcd(e._dexterity);
+
+	switch (e._class) {
+	case 'T':
+		chance += 0x80;
+		break;
+	case 'B':
+	case 'I':
+	case 'R':
+		chance += 0x40;
+		break;
+	default:
+		break;
+	}
+
+	return rollBelow(255) < chance;
+}
+
+void ChestLogic::damageParty() {
+	Data::Savegame &save = _G(savegame);
+
+	for (int slot = 0; slot < save._partySize; ++slot) {
+		if (!save.partyMember(slot).isAlive())
+			continue;
+
+		_G(effects).flashSlot(slot);
+		g_engine->playSoundEffect(0xF7);
+
+		damageCharacter(slot, Data::fromBcd(rollBelow(255) & 0x77));
+		damageCharacter(slot, Data::fromBcd(8));
+	}
+}
+
+void ChestLogic::loot(int slot) {
+	Data::RosterEntry &e = _G(savegame).partyMember(slot);
+
+	int gold = rollBelow(100) | 0x30;
+	if (gold >= 100)
+		gold -= 100;
+
+	_G(messages).print(Common::String::format("Gold+%02X\n", Data::toBcd(gold)).c_str());
+	e._gold = Data::toBcdWord(MIN(Data::fromBcdWord(e._gold) + gold, 9999));
+
+	if (rollBelow(255) >= 0x40)
+		return;
+
+	// Sometimes a weapon is found as well, or failing that some armour
+	int roll = rollBelow(255);
+	if (roll < 0x80) {
+		int weapon = rollBelow(255) & roll & 7;
+
+		if (weapon != 0) {
+			_G(messages).print("and a ");
+			_G(messages).print(Data::WEAPON_NAMES[weapon]);
+			_G(messages).print("\n");
+			e._weaponOwned[weapon - 1] = Data::toBcd(MIN(Data::fromBcd(e._weaponOwned[weapon - 1]) + 1, 99));
+			return;
+		}
+	}
+
+	roll = rollBelow(255);
+	if (roll >= 0x80)
+		return;
+
+	int armour = rollBelow(255) & roll & 3;
+	if (armour != 0) {
+		_G(messages).print("and ");
+		_G(messages).print(Data::ARMOUR_NAMES[armour]);
+		_G(messages).print("\n");
+		e._armourOwned[armour - 1] = Data::toBcd(MIN(Data::fromBcd(e._armourOwned[armour - 1]) + 1, 99));
+	}
+}
+
+void ChestLogic::open(int slot) {
+	Data::Savegame &save = _G(savegame);
+	Data::RosterEntry &e = save.partyMember(slot);
+
+	// Half of them are trapped
+	if (rollBelow(255) < 0x80) {
+		loot(slot);
+		return;
+	}
+
+	int first = rollBelow(255);
+	int second = rollBelow(255);
+	bool acid = (first & second & 3) == 0;
+
+	if (acid)
+		_G(messages).print("Acid trap!\n");
+	else if (first == 1)
+		_G(messages).print("Poison trap!\n");
+	else if (first == 2)
+		_G(messages).print("Gas trap!\n");
+	else
+		_G(messages).print("Bomb trap!\n");
+
+	if (evadesTrap(slot)) {
+		_G(messages).print("Trap evaded!\n");
+		g_engine->playSoundEffect(0xFA);
+	} else if (acid) {
+		_G(effects).flashSlot(slot);
+		g_engine->playSoundEffect(0xF7);
+		damageCharacter(slot, Data::fromBcd(rollBelow(255) & 0x37));
+	} else if (first == 1) {
+		_G(effects).flashSlot(slot);
+		g_engine->playSoundEffect(0xF7);
+		e._status = Data::STATUS_POISONED;
+	} else if (first == 2) {
+		for (int i = 0; i < save._partySize; ++i) {
+			Data::RosterEntry &member = save.partyMember(i);
+
+			if (member.isAlive()) {
+				_G(effects).flashSlot(i);
+				g_engine->playSoundEffect(0xF7);
+				member._status = Data::STATUS_POISONED;
+			}
+		}
+	} else {
+		damageParty();
+	}
+
+	loot(slot);
+}
+
+} // namespace Ultima3
+} // namespace Ultima
diff --git a/engines/ultima/ultima3/logic/chest_logic.h b/engines/ultima/ultima3/logic/chest_logic.h
new file mode 100644
index 00000000000..b9f63a657f4
--- /dev/null
+++ b/engines/ultima/ultima3/logic/chest_logic.h
@@ -0,0 +1,68 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef ULTIMA3_LOGIC_CHEST_LOGIC_H
+#define ULTIMA3_LOGIC_CHEST_LOGIC_H
+
+#include "ultima/ultima3/logic/logic.h"
+
+namespace Ultima {
+namespace Ultima3 {
+
+/**
+ * Opening chests, which may be trapped, and what's found inside them
+ */
+class ChestLogic : public Logic {
+private:
+	/**
+	 * Returns a number from 0 up to but not including a limit
+	 */
+	static int rollBelow(int limit);
+
+	/**
+	 * Hurts every member of the party who can still fight
+	 */
+	void damageParty();
+
+public:
+	/**
+	 * Rolls to see whether a party member avoids a trap, which the
+	 * agile classes are better at
+	 * @returns		True if they got clear of it
+	 */
+	bool evadesTrap(int slot);
+
+	/**
+	 * Gives a party member the contents of a chest
+	 */
+	void loot(int slot);
+
+	/**
+	 * Opens a chest that a party member has found, possibly setting off a
+	 * trap on the way
+	 */
+	void open(int slot);
+};
+
+} // namespace Ultima3
+} // namespace Ultima
+
+#endif
diff --git a/engines/ultima/ultima3/views/interactions/get_chest.cpp b/engines/ultima/ultima3/views/interactions/get_chest.cpp
new file mode 100644
index 00000000000..b5b14bbc822
--- /dev/null
+++ b/engines/ultima/ultima3/views/interactions/get_chest.cpp
@@ -0,0 +1,70 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "ultima/ultima3/views/interactions/get_chest.h"
+#include "ultima/ultima3/logic/chest_logic.h"
+#include "ultima/ultima3/ultima3.h"
+
+namespace Ultima {
+namespace Ultima3 {
+namespace Views {
+namespace Interactions {
+
+constexpr byte FIRST_CHEST_CELL = 0x24;
+constexpr byte LAST_CHEST_CELL = 0x27;
+constexpr byte CELL_FLOOR = 0x20;
+
+bool GetChest::keypress(const KeypressMessage &msg) {
+	PlayerChooser::Result result = _chooser.handleKey(msg);
+	if (result == PlayerChooser::PENDING)
+		return false;
+	if (result == PlayerChooser::CANCELLED)
+		return true;
+
+	const int slot = _chooser.slot();
+	Data::Savegame &save = _G(savegame);
+
+	if (!save.partyMember(slot).isAlive()) {
+		_G(messages).print("Incapacitated!\n");
+		g_engine->playSoundEffect(0xFF);
+		return true;
+	}
+
+	byte cell = _G(map).cell(save._posX, save._posY);
+	if (cell < FIRST_CHEST_CELL || cell > LAST_CHEST_CELL) {
+		_G(messages).print("Not Here!\n");
+		g_engine->playSoundEffect(0xFF);
+		return true;
+	}
+
+	// The chest goes, leaving the ground it was on
+	byte ground = (cell & 3) << 2;
+	_G(map).setCell(save._posX, save._posY, ground ? ground : CELL_FLOOR);
+
+	ChestLogic chest;
+	chest.open(slot);
+	return true;
+}
+
+} // namespace Interactions
+} // namespace Views
+} // namespace Ultima3
+} // namespace Ultima
diff --git a/engines/ultima/ultima3/views/interactions/get_chest.h b/engines/ultima/ultima3/views/interactions/get_chest.h
new file mode 100644
index 00000000000..16a039f0cbb
--- /dev/null
+++ b/engines/ultima/ultima3/views/interactions/get_chest.h
@@ -0,0 +1,48 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef ULTIMA3_VIEWS_INTERACTIONS_GET_CHEST_H
+#define ULTIMA3_VIEWS_INTERACTIONS_GET_CHEST_H
+
+#include "ultima/ultima3/views/interactions/interaction.h"
+
+namespace Ultima {
+namespace Ultima3 {
+namespace Views {
+namespace Interactions {
+
+/**
+ * Has a party member open the chest they are standing on
+ */
+class GetChest : public Interaction {
+private:
+	PlayerChooser _chooser;
+
+public:
+	bool keypress(const KeypressMessage &msg) override;
+};
+
+} // namespace Interactions
+} // namespace Views
+} // namespace Ultima3
+} // namespace Ultima
+
+#endif
diff --git a/engines/ultima/ultima3/views/interactions/steal_chest.cpp b/engines/ultima/ultima3/views/interactions/steal_chest.cpp
new file mode 100644
index 00000000000..b9ae1927c1e
--- /dev/null
+++ b/engines/ultima/ultima3/views/interactions/steal_chest.cpp
@@ -0,0 +1,115 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "ultima/ultima3/views/interactions/steal_chest.h"
+#include "ultima/ultima3/logic/chest_logic.h"
+#include "ultima/ultima3/ultima3.h"
+
+namespace Ultima {
+namespace Ultima3 {
+namespace Views {
+namespace Interactions {
+
+constexpr byte FIRST_COUNTER_CELL = 0x94;
+constexpr byte LAST_COUNTER_CELL = 0xE4;
+constexpr byte CELL_CHEST = 0x24;
+constexpr byte CELL_FLOOR = 0x20;
+constexpr byte CELL_GUARD = 0x48;
+constexpr byte FLAGS_HOSTILE = 0xC0;
+
+bool StealChest::keypress(const KeypressMessage &msg) {
+	Data::Savegame &save = _G(savegame);
+
+	if (!_chosen) {
+		PlayerChooser::Result result = _players.handleKey(msg);
+		if (result == PlayerChooser::PENDING)
+			return false;
+		if (result == PlayerChooser::CANCELLED)
+			return true;
+
+		if (!save.partyMember(_players.slot()).isAlive()) {
+			_G(messages).print("Incapacitated!\n");
+			g_engine->playSoundEffect(0xFF);
+			return true;
+		}
+
+		_chosen = true;
+		_G(messages).print("Direct? ");
+		return false;
+	}
+
+	DirectionChooser::Result result = _directions.handleKey(msg);
+	if (result == DirectionChooser::PENDING)
+		return false;
+	if (result == DirectionChooser::CANCELLED)
+		return true;
+
+	const int slot = _players.slot();
+	int dx = 0, dy = 0;
+	switch (_directions.direction()) {
+	case DIR_NORTH: dy = -1; break;
+	case DIR_SOUTH: dy = 1; break;
+	case DIR_EAST: dx = 1; break;
+	default: dx = -1; break;
+	}
+
+	ChestLogic chest;
+	bool stolen = false;
+
+	// The chest has to be a couple of steps beyond the counter beside the party
+	if (chest.evadesTrap(slot)) {
+		byte counter = _G(map).cell(save._posX + dx, save._posY + dy);
+
+		if (counter >= FIRST_COUNTER_CELL && counter <= LAST_COUNTER_CELL) {
+			int x = save._posX + dx * 3, y = save._posY + dy * 3;
+
+			if (_G(map).cell(x, y) == CELL_CHEST) {
+				_G(map).setCell(x, y, CELL_FLOOR);
+				chest.loot(slot);
+				stolen = true;
+			}
+		}
+	}
+
+	if (stolen)
+		return true;
+
+	if (Graphics::Views::g_events->getRandomNumber(254) & 3) {
+		_G(messages).print("Failed!\n");
+		return true;
+	}
+
+	// Caught in the act, the guards turn hostile
+	Data::Creatures &creatures = _G(map)._creatures;
+	for (int i = 0; i < Data::CREATURE_COUNT; ++i) {
+		if (creatures._tile[i] == CELL_GUARD)
+			creatures._flags[i] = FLAGS_HOSTILE;
+	}
+
+	_G(messages).print("Watch out!\n");
+	g_engine->playSoundEffect(0xFA);
+	return true;
+}
+
+} // namespace Interactions
+} // namespace Views
+} // namespace Ultima3
+} // namespace Ultima
diff --git a/engines/ultima/ultima3/views/interactions/steal_chest.h b/engines/ultima/ultima3/views/interactions/steal_chest.h
new file mode 100644
index 00000000000..74969d7c5a0
--- /dev/null
+++ b/engines/ultima/ultima3/views/interactions/steal_chest.h
@@ -0,0 +1,50 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef ULTIMA3_VIEWS_INTERACTIONS_STEAL_CHEST_H
+#define ULTIMA3_VIEWS_INTERACTIONS_STEAL_CHEST_H
+
+#include "ultima/ultima3/views/interactions/interaction.h"
+
+namespace Ultima {
+namespace Ultima3 {
+namespace Views {
+namespace Interactions {
+
+/**
+ * Has a party member try to take a chest from behind a counter
+ */
+class StealChest : public Interaction {
+private:
+	PlayerChooser _players;
+	DirectionChooser _directions;
+	bool _chosen = false;
+
+public:
+	bool keypress(const KeypressMessage &msg) override;
+};
+
+} // namespace Interactions
+} // namespace Views
+} // namespace Ultima3
+} // namespace Ultima
+
+#endif
diff --git a/engines/ultima/ultima3/views/interactions/unlock_door.cpp b/engines/ultima/ultima3/views/interactions/unlock_door.cpp
new file mode 100644
index 00000000000..309e5707b55
--- /dev/null
+++ b/engines/ultima/ultima3/views/interactions/unlock_door.cpp
@@ -0,0 +1,81 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "ultima/ultima3/views/interactions/unlock_door.h"
+#include "ultima/ultima3/data/data.h"
+#include "ultima/ultima3/ultima3.h"
+
+namespace Ultima {
+namespace Ultima3 {
+namespace Views {
+namespace Interactions {
+
+constexpr byte CELL_LOCKED_DOOR = 0xB8;
+
+bool UnlockDoor::keypress(const KeypressMessage &msg) {
+	Data::Savegame &save = _G(savegame);
+
+	if (!_chosen) {
+		DirectionChooser::Result result = _directions.handleKey(msg);
+		if (result == DirectionChooser::PENDING)
+			return false;
+		if (result == DirectionChooser::CANCELLED)
+			return true;
+
+		// Doors are only found to the sides
+		Direction dir = _directions.direction();
+		_doorX = save._posX + (dir == DIR_EAST ? 1 : (dir == DIR_WEST ? -1 : 0));
+		_doorY = save._posY;
+
+		if ((dir != DIR_EAST && dir != DIR_WEST) || _G(map).cell(_doorX, _doorY) != CELL_LOCKED_DOOR) {
+			_G(messages).print("Not Here!\n");
+			g_engine->playSoundEffect(0xFF);
+			return true;
+		}
+
+		_chosen = true;
+		_G(messages).print("Whose key? ");
+		return false;
+	}
+
+	PlayerChooser::Result result = _players.handleKey(msg);
+	if (result == PlayerChooser::PENDING)
+		return false;
+	if (result == PlayerChooser::CANCELLED)
+		return true;
+
+	Data::RosterEntry &e = save.partyMember(_players.slot());
+	if (e._keys == 0) {
+		_G(messages).print("None Left!\n");
+		g_engine->playSoundEffect(0xFE);
+		return true;
+	}
+
+	// The door opens onto the same kind of ground the party stands on
+	e._keys = Data::toBcd(Data::fromBcd(e._keys) - 1);
+	_G(map).setCell(_doorX, _doorY, _G(map).tile(save._posX, save._posY) << 2);
+	return true;
+}
+
+} // namespace Interactions
+} // namespace Views
+} // namespace Ultima3
+} // namespace Ultima
diff --git a/engines/ultima/ultima3/views/interactions/unlock_door.h b/engines/ultima/ultima3/views/interactions/unlock_door.h
new file mode 100644
index 00000000000..359d5b5454a
--- /dev/null
+++ b/engines/ultima/ultima3/views/interactions/unlock_door.h
@@ -0,0 +1,51 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef ULTIMA3_VIEWS_INTERACTIONS_UNLOCK_DOOR_H
+#define ULTIMA3_VIEWS_INTERACTIONS_UNLOCK_DOOR_H
+
+#include "ultima/ultima3/views/interactions/interaction.h"
+
+namespace Ultima {
+namespace Ultima3 {
+namespace Views {
+namespace Interactions {
+
+/**
+ * Uses a key to open a locked door beside the party
+ */
+class UnlockDoor : public Interaction {
+private:
+	DirectionChooser _directions;
+	PlayerChooser _players;
+	int _doorX = 0, _doorY = 0;
+	bool _chosen = false;
+
+public:
+	bool keypress(const KeypressMessage &msg) override;
+};
+
+} // namespace Interactions
+} // namespace Views
+} // namespace Ultima3
+} // namespace Ultima
+
+#endif
diff --git a/engines/ultima/ultima3/views/location_map.cpp b/engines/ultima/ultima3/views/location_map.cpp
index 5a15d19b068..d2068bfb5d4 100644
--- a/engines/ultima/ultima3/views/location_map.cpp
+++ b/engines/ultima/ultima3/views/location_map.cpp
@@ -21,7 +21,10 @@
 
 #include "ultima/ultima3/views/location_map.h"
 #include "ultima/ultima3/views/menu_input.h"
+#include "ultima/ultima3/views/interactions/get_chest.h"
 #include "ultima/ultima3/views/interactions/look.h"
+#include "ultima/ultima3/views/interactions/steal_chest.h"
+#include "ultima/ultima3/views/interactions/unlock_door.h"
 #include "ultima/ultima3/ultima3.h"
 
 namespace Ultima {
@@ -319,6 +322,18 @@ bool LocationMap::handleCommand(const KeypressMessage &msg) {
 	case 'A':
 		doAttack();
 		return true;
+	case 'G':
+		_G(messages).print("Get Chest!\nPlr to search-");
+		startInteraction(new Interactions::GetChest());
+		return true;
+	case 'S':
+		_G(messages).print("Steal Chest!\nPlayer? ");
+		startInteraction(new Interactions::StealChest());
+		return true;
+	case 'U':
+		_G(messages).print("Unlock-");
+		startInteraction(new Interactions::UnlockDoor());
+		return true;
 	case 'L':
 		_G(messages).print("Look-");
 		startInteraction(new Interactions::Look());


Commit: 8505d0534b6c1bb9a34de4fd668ac3b4dd7b2263
    https://github.com/scummvm/scummvm/commit/8505d0534b6c1bb9a34de4fd668ac3b4dd7b2263
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:41:01+11:00

Commit Message:
ULTIMA: ULTIMA3: Add the transact command for talking and shops

Changed paths:
  A engines/ultima/ultima3/views/interactions/log_input.cpp
  A engines/ultima/ultima3/views/interactions/log_input.h
  A engines/ultima/ultima3/views/interactions/shops.cpp
  A engines/ultima/ultima3/views/interactions/shops.h
  A engines/ultima/ultima3/views/interactions/transact.cpp
  A engines/ultima/ultima3/views/interactions/transact.h
    engines/ultima/module.mk
    engines/ultima/ultima3/data/map.cpp
    engines/ultima/ultima3/data/map.h
    engines/ultima/ultima3/views/interactions/equip.cpp
    engines/ultima/ultima3/views/interactions/equip.h
    engines/ultima/ultima3/views/location_map.cpp
    engines/ultima/ultima3/views/menu_input.h


diff --git a/engines/ultima/module.mk b/engines/ultima/module.mk
index 270e5537f90..fe82f680317 100644
--- a/engines/ultima/module.mk
+++ b/engines/ultima/module.mk
@@ -188,8 +188,11 @@ MODULE_OBJS += \
 	ultima3/views/interactions/exchange.o \
 	ultima3/views/interactions/get_chest.o \
 	ultima3/views/interactions/interaction.o \
+	ultima3/views/interactions/log_input.o \
 	ultima3/views/interactions/look.o \
+	ultima3/views/interactions/shops.o \
 	ultima3/views/interactions/steal_chest.o \
+	ultima3/views/interactions/transact.o \
 	ultima3/views/interactions/unlock_door.o \
 	ultima3/views/interactions/ztats.o \
 	ultima3/views/journey_onward.o \
diff --git a/engines/ultima/ultima3/data/map.cpp b/engines/ultima/ultima3/data/map.cpp
index e000e3a204f..e5a5a85355d 100644
--- a/engines/ultima/ultima3/data/map.cpp
+++ b/engines/ultima/ultima3/data/map.cpp
@@ -41,6 +41,19 @@ void Map::load(const char *filename) {
 		error("Could not load %s", filename);
 }
 
+const char *Map::text(int index) const {
+	int pos = index * 2;
+	if (index < 0 || pos + 1 >= TEXT_SIZE)
+		return nullptr;
+
+	// The strings are found by offsets listed at the start
+	int offset = _text[pos] | (_text[pos + 1] << 8);
+	if (offset >= TEXT_SIZE || !memchr(_text + offset, 0, TEXT_SIZE - offset))
+		return nullptr;
+
+	return (const char *)_text + offset;
+}
+
 void Map::synchronize(Common::Serializer &s) {
 	// Earlier saves only held the cells
 	if (s.getVersion() < 3)
diff --git a/engines/ultima/ultima3/data/map.h b/engines/ultima/ultima3/data/map.h
index 3c8b3a94b6e..0f07714a712 100644
--- a/engines/ultima/ultima3/data/map.h
+++ b/engines/ultima/ultima3/data/map.h
@@ -93,6 +93,12 @@ public:
 		_cells[(y & (MAP_SIZE - 1)) * MAP_SIZE + (x & (MAP_SIZE - 1))] = value;
 	}
 
+	/**
+	 * Returns one of the pieces of text kept with a town, which are what its
+	 * people and signs say, or null if there isn't one
+	 */
+	const char *text(int index) const;
+
 	/**
 	 * Returns the number of the tile graphic in a cell
 	 */
diff --git a/engines/ultima/ultima3/views/interactions/equip.cpp b/engines/ultima/ultima3/views/interactions/equip.cpp
index 3c2fe3d41bf..7273870dbbc 100644
--- a/engines/ultima/ultima3/views/interactions/equip.cpp
+++ b/engines/ultima/ultima3/views/interactions/equip.cpp
@@ -65,7 +65,7 @@ void Equip::startMenu() {
 	}
 
 	_keys[2 + letters] = '\0';
-	_menu.setup(_keys, _words, 2 + letters, 0, 0);
+	_menu.setup(_keys, _words, 2 + letters);
 }
 
 void Equip::equip(char letter) {
@@ -98,8 +98,6 @@ void Equip::equip(char letter) {
 }
 
 bool Equip::keypress(const KeypressMessage &msg) {
-	Common::String word;
-
 	if (_choosing) {
 		PlayerChooser::Result result = _chooser.handleKey(msg);
 		if (result == PlayerChooser::PENDING)
@@ -120,18 +118,7 @@ bool Equip::keypress(const KeypressMessage &msg) {
 		return false;
 	}
 
-	bool hadChoice = _menu.hasChoice();
-	if (hadChoice)
-		word = _words[_menu.index()];
-
-	bool confirmed = _menu.handleKey(msg);
-
-	if (!hadChoice && _menu.hasChoice())
-		_G(messages).print(_words[_menu.index()]);
-	else if (hadChoice && !_menu.hasChoice())
-		_G(messages).backspace(word.size());
-
-	if (!confirmed)
+	if (!_menu.handleKey(msg))
 		return false;
 
 	char letter = _menu.key();
diff --git a/engines/ultima/ultima3/views/interactions/equip.h b/engines/ultima/ultima3/views/interactions/equip.h
index 4454c783918..e5e0cbd4cb3 100644
--- a/engines/ultima/ultima3/views/interactions/equip.h
+++ b/engines/ultima/ultima3/views/interactions/equip.h
@@ -23,7 +23,7 @@
 #define ULTIMA3_VIEWS_INTERACTIONS_EQUIP_H
 
 #include "ultima/ultima3/views/interactions/interaction.h"
-#include "ultima/ultima3/views/menu_input.h"
+#include "ultima/ultima3/views/interactions/log_input.h"
 
 namespace Ultima {
 namespace Ultima3 {
@@ -39,7 +39,7 @@ private:
 	PlayerChooser _chooser;
 	bool _choosing = true;
 	int _slot = -1;
-	MenuChoice _menu;
+	LogMenu _menu;
 	char _keys[20];
 	const char *_words[19];
 
diff --git a/engines/ultima/ultima3/views/interactions/log_input.cpp b/engines/ultima/ultima3/views/interactions/log_input.cpp
new file mode 100644
index 00000000000..90f85276239
--- /dev/null
+++ b/engines/ultima/ultima3/views/interactions/log_input.cpp
@@ -0,0 +1,141 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "ultima/ultima3/views/interactions/log_input.h"
+#include "ultima/ultima3/ultima3.h"
+
+namespace Ultima {
+namespace Ultima3 {
+namespace Views {
+namespace Interactions {
+
+void LogMenu::setup(const char *keys, const char *const *words, int count) {
+	_menu.setup(keys, words, count, 0, 0);
+	_echo.clear();
+}
+
+bool LogMenu::handleKey(const KeypressMessage &msg) {
+	bool hadChoice = _menu.hasChoice();
+	bool confirmed = _menu.handleKey(msg);
+
+	if (!hadChoice && _menu.hasChoice()) {
+		_echo = _menu.word();
+		_G(messages).print(_echo.c_str());
+	} else if (hadChoice && !_menu.hasChoice()) {
+		_G(messages).backspace(_echo.size());
+		_echo.clear();
+	}
+
+	return confirmed;
+}
+
+/*------------------------------------------------------------------------*/
+
+LogYesNo::LogYesNo() {
+	static const char *const WORDS[4] = { "Yes", "No", "No", "No" };
+	_menu.setup("YNQ\033", WORDS, 4);
+}
+
+/*------------------------------------------------------------------------*/
+
+void LogNumber::setup(int maxDigits, bool rejectLetters) {
+	_maxDigits = maxDigits;
+	_rejectLetters = rejectLetters;
+	_text.clear();
+	_bcd = 0;
+	_hasLetters = false;
+}
+
+static int hexDigit(char c) {
+	if (c >= '0' && c <= '9')
+		return c - '0';
+	if (c >= 'A' && c <= 'F')
+		return c - 'A' + 10;
+	if (c >= 'a' && c <= 'f')
+		return c - 'a' + 10;
+	return -1;
+}
+
+bool LogNumber::evaluate() {
+	uint pos = 0;
+	while (pos < _text.size() && _text[pos] == ' ')
+		++pos;
+
+	// There has to be a digit to start with, and the number ends where they stop
+	if (pos == _text.size() || hexDigit(_text[pos]) < 0)
+		return false;
+
+	_bcd = 0;
+	_hasLetters = false;
+	for (; pos < _text.size(); ++pos) {
+		int digit = hexDigit(_text[pos]);
+		if (digit < 0)
+			break;
+
+		_bcd = (_bcd << 4) | digit;
+		if (digit > 9)
+			_hasLetters = true;
+	}
+
+	return !(_rejectLetters && _hasLetters);
+}
+
+bool LogNumber::handleKey(const KeypressMessage &msg) {
+	if (isModifierKey(msg.keycode))
+		return false;
+
+	if (msg.keycode == Common::KEYCODE_RETURN || msg.keycode == Common::KEYCODE_KP_ENTER) {
+		if (evaluate())
+			return true;
+
+		// Not a number, so it's wiped and tried again
+		_G(messages).backspace(_text.size());
+		_text.clear();
+		g_engine->playSoundEffect(0xFE);
+		return false;
+	}
+
+	if (msg.keycode == Common::KEYCODE_BACKSPACE || msg.keycode == Common::KEYCODE_LEFT ||
+			msg.keycode == Common::KEYCODE_DELETE) {
+		if (_text.empty()) {
+			g_engine->playSoundEffect(0xFE);
+		} else {
+			_text.deleteLastChar();
+			_G(messages).backspace(1);
+		}
+
+		return false;
+	}
+
+	if (msg.ascii >= 0x20 && msg.ascii < 0x80 && (int)_text.size() < _maxDigits) {
+		_text += (char)msg.ascii;
+		_G(messages).putChar((char)msg.ascii);
+	} else {
+		g_engine->playSoundEffect(0xFE);
+	}
+
+	return false;
+}
+
+} // namespace Interactions
+} // namespace Views
+} // namespace Ultima3
+} // namespace Ultima
diff --git a/engines/ultima/ultima3/views/interactions/log_input.h b/engines/ultima/ultima3/views/interactions/log_input.h
new file mode 100644
index 00000000000..53a2839f4cd
--- /dev/null
+++ b/engines/ultima/ultima3/views/interactions/log_input.h
@@ -0,0 +1,146 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef ULTIMA3_VIEWS_INTERACTIONS_LOG_INPUT_H
+#define ULTIMA3_VIEWS_INTERACTIONS_LOG_INPUT_H
+
+#include "ultima/ultima3/views/interactions/interaction.h"
+#include "ultima/ultima3/views/menu_input.h"
+
+namespace Ultima {
+namespace Ultima3 {
+namespace Views {
+namespace Interactions {
+
+/**
+ * A menu answered in the message window. Pressing an option's key writes
+ * its name, which then has to be confirmed with Enter or taken back
+ */
+class LogMenu {
+private:
+	MenuChoice _menu;
+	Common::String _echo;
+
+public:
+	/**
+	 * Sets up the choices. The word at each index is shown for the key at
+	 * the same index, with escape written as 0x1B
+	 */
+	void setup(const char *keys, const char *const *words, int count);
+
+	/**
+	 * Handles a keypress, returning true once a choice has been confirmed
+	 */
+	bool handleKey(const KeypressMessage &msg);
+
+	/**
+	 * Returns the key of the choice made
+	 */
+	char key() const {
+		return _menu.key();
+	}
+};
+
+/**
+ * A yes or no question answered in the message window
+ */
+class LogYesNo {
+private:
+	LogMenu _menu;
+
+public:
+	LogYesNo();
+
+	/**
+	 * Handles a keypress, returning true once an answer has been confirmed
+	 */
+	bool handleKey(const KeypressMessage &msg) {
+		return _menu.handleKey(msg);
+	}
+
+	bool yes() const {
+		return _menu.key() == 'Y';
+	}
+};
+
+/**
+ * A number typed in the message window, as a couple of digits or as a
+ * quantity of up to four. Letters from A to F are taken as digits too
+ */
+class LogNumber {
+private:
+	int _maxDigits = 0;
+	bool _rejectLetters = false;
+	Common::String _text;
+
+	// What was entered, read one digit at a time as BCD
+	int _bcd = 0;
+	bool _hasLetters = false;
+
+	/**
+	 * Works out what has been typed
+	 * @returns		False if it isn't a number
+	 */
+	bool evaluate();
+
+public:
+	/**
+	 * Starts an entry
+	 * @param maxDigits			How many characters can be typed
+	 * @param rejectLetters		True if letters are turned down like any other non-number
+	 */
+	void setup(int maxDigits, bool rejectLetters = false);
+
+	/**
+	 * Handles a keypress, returning true once a number has been accepted.
+	 * Entries that aren't numbers are turned down
+	 */
+	bool handleKey(const KeypressMessage &msg);
+
+	/**
+	 * Returns what was entered, the digits held as BCD
+	 */
+	int bcd() const {
+		return _bcd;
+	}
+
+	/**
+	 * Returns what was entered as an ordinary number
+	 */
+	int value() const {
+		return Data::fromBcdWord(_bcd);
+	}
+
+	/**
+	 * Returns true if letters were used as digits, which gives a value that
+	 * can't be relied on
+	 */
+	bool hasLetters() const {
+		return _hasLetters;
+	}
+};
+
+} // namespace Interactions
+} // namespace Views
+} // namespace Ultima3
+} // namespace Ultima
+
+#endif
diff --git a/engines/ultima/ultima3/views/interactions/shops.cpp b/engines/ultima/ultima3/views/interactions/shops.cpp
new file mode 100644
index 00000000000..f3d572b9897
--- /dev/null
+++ b/engines/ultima/ultima3/views/interactions/shops.cpp
@@ -0,0 +1,711 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "ultima/ultima3/views/interactions/shops.h"
+#include "ultima/ultima3/logic/location_logic.h"
+#include "ultima/ultima3/data/data.h"
+#include "ultima/ultima3/ultima3.h"
+
+namespace Ultima {
+namespace Ultima3 {
+namespace Views {
+namespace Interactions {
+
+constexpr char ESCAPE_KEY = 0x1B;
+constexpr int MAX_GOLD = 9999;
+constexpr int BEST_SHOP_X = 0x25;
+constexpr byte MAX_OWNED = 0x99;
+
+static bool isContinueKey(const KeypressMessage &msg) {
+	return msg.keycode == Common::KEYCODE_RETURN || msg.keycode == Common::KEYCODE_KP_ENTER ||
+		msg.keycode == Common::KEYCODE_DOWN || msg.keycode == Common::KEYCODE_SPACE;
+}
+
+Data::RosterEntry &Shop::payer() const {
+	return _G(savegame).partyMember(_payer);
+}
+
+bool Shop::canAfford(int gold) const {
+	return Data::fromBcdWord(payer()._gold) >= gold;
+}
+
+void Shop::spend(int gold) {
+	Data::RosterEntry &e = payer();
+	e._gold = Data::toBcdWord(Data::fromBcdWord(e._gold) - gold);
+}
+
+void Shop::say(const char *text, int sound) {
+	_G(messages).print(text);
+	if (sound)
+		g_engine->playSoundEffect(sound);
+}
+
+/*------------------------------------------------------------------------*/
+
+static const char *const PUB_TALK[10] = {
+	"\n\nThank you,\nkindly!\n",
+	"\nAmbrosia,\never heard\nof it?\n",
+	"\nDawn,\nthe city of\nmyths & magic!\n",
+	"\nThe conjunction\nof the moons\nfinds link!\n",
+	"Nasty creatures,\n  nasty dark,\nsure thee ready,\nfore thee embark\n",
+	"None return or\n so I'm told,\nfrom the pool,\ndark and cold!\n",
+	"  Shrines of\n  knowledge,\n  shrines of\n   strength,\n all are lost\ninto the brink!",
+	" Fountains fair\n       &\n fountains foul\nall are found in\n dungeons bowel\n",
+	"     EXODUS:\n   Ultima ]I[\n which is next?\nNow could it be.\n",
+	"Seek ye out the\n Lord of Time,\nand the one way\nis a sure find!\n"
+};
+
+static const char *const CANT_PAY = "\nWhat? Can't pay!\nOut you scum!\n";
+
+Tavern::Tavern(int payer) : Shop(payer) {
+	_G(messages).print("\n   Welcome to\n    the Pub!\n");
+	askForPayment();
+}
+
+void Tavern::askForPayment() {
+	_asking = false;
+	_G(messages).print("\nHere, friend,\nhave a drink!\nIt costs 7 g.p.\nYou pay? ");
+	_number.setup(2);
+}
+
+bool Tavern::keypress(const KeypressMessage &msg) {
+	if (_asking) {
+		if (!_another.handleKey(msg))
+			return false;
+
+		_G(messages).print("\n\n");
+		if (_another.yes()) {
+			_another = LogYesNo();
+			askForPayment();
+			return false;
+		}
+
+		say("It's been a\npleasure!!\n");
+		return true;
+	}
+
+	if (!_number.handleKey(msg))
+		return false;
+
+	if (_number.hasLetters()) {
+		say("\n<-What?\n", 0xFE);
+		return true;
+	}
+
+	_G(messages).print("\n");
+	int amount = _number.value();
+
+	if (_number.bcd() < 7) {
+		say("\n Leave my shop!\n   You scum!!\n", 0xFF);
+		return true;
+	}
+
+	if (amount >= Data::fromBcdWord(payer()._gold)) {
+		say(CANT_PAY, 0xFE);
+		return true;
+	}
+
+	_G(messages).print("\n");
+	spend(amount);
+	say(PUB_TALK[_number.bcd() >> 4]);
+	say("\nAnother? ");
+	_asking = true;
+	return false;
+}
+
+/*------------------------------------------------------------------------*/
+
+Grocer::Grocer(int payer) : Shop(payer) {
+	_G(messages).print("    Ye local\n     Grocer\n\nRations:\n1 g.p. each.\nHow many would\nyou like? ");
+	_number.setup(4, true);
+}
+
+bool Grocer::keypress(const KeypressMessage &msg) {
+	if (!_number.handleKey(msg))
+		return false;
+
+	Data::RosterEntry &e = payer();
+	int quantity = _number.value();
+
+	if (quantity != 0) {
+		if (quantity > Data::fromBcdWord(e._gold)) {
+			say(CANT_PAY, 0xFF);
+			return true;
+		}
+
+		int food = Data::fromBcdWord(e._food) + quantity;
+		if (food > MAX_GOLD) {
+			say("\nToo much to\ncarry!\n", 0xFF);
+			return true;
+		}
+
+		e._food = Data::toBcdWord(food);
+		spend(quantity);
+	}
+
+	say("\n\nThank you,\nCome again!\n");
+	return true;
+}
+
+/*------------------------------------------------------------------------*/
+
+static const int TEMPLE_COSTS[4] = { 100, 200, 500, 900 };
+
+static const char *const TEMPLE_OFFERS[4] = {
+	"\nA curing will\ncost 100 g.p.\nWilt thou pay?\n",
+	"\nHealings cost\n200 g.p.  Wilt\nthou pay? ",
+	"\nResurrections\ncost 500 g.p.\nWilt thou pay?\n",
+	"Recallings\ncost 900 g.p.\nWilt thou pay?\n"
+};
+
+static const char *const TEMPLE_WHOM[4] = {
+	"Cure whom? ", "Heal whom? ", "Resurrect whom? ", "Recall whom? "
+};
+
+Temple::Temple(int payer) : Shop(payer) {
+	static const char *const WORDS[6] = { "1", "2", "3", "4", "Q", "Q" };
+
+	_G(messages).print("\nClerical Healing\nSacraments:\n 1-Curing,\n 2-Healing,\n 3-Resurrection,\n 4-Recallings.\nYour needs: ");
+	_menu.setup("1234Q\033", WORDS, 6);
+}
+
+void Temple::farewell() {
+	say("\nFare thee well\nmy children.\n");
+}
+
+bool Temple::serve(int slot) {
+	Data::RosterEntry &e = _G(savegame).partyMember(slot);
+	bool restored = false;
+
+	// A flash of light goes over everything
+	auto flash = [&]() {
+		_G(effects).flashViewport();
+		_G(effects).flashSlot(slot);
+		g_engine->playSoundEffect(0xFD);
+	};
+
+	switch (_service) {
+	case 0:
+		if (e._status == Data::STATUS_GOOD) {
+			say("Not injured!\n", 0xFF);
+			return false;
+		}
+
+		flash();
+		if (e._status != Data::STATUS_POISONED) {
+			say("Failed!\n", 0xFF);
+			return false;
+		}
+
+		e._status = Data::STATUS_GOOD;
+		restored = true;
+		break;
+
+	case 1:
+		if (Data::fromBcdWord(e._maxHitPoints) < Data::fromBcdWord(e._hitPoints)) {
+			say("Not injured!\n", 0xFF);
+			return false;
+		}
+
+		e._hitPoints = e._maxHitPoints;
+		flash();
+		restored = true;
+		break;
+
+	case 2:
+		if (e._status == Data::STATUS_GOOD) {
+			say("Not injured!\n", 0xFF);
+			return false;
+		}
+		if (e._status == Data::STATUS_POISONED) {
+			say("Not dead!\n", 0xFF);
+			return false;
+		}
+
+		flash();
+		if (e._status != Data::STATUS_DEAD) {
+			say("Failed!\n", 0xFF);
+			return false;
+		}
+
+		e._status = Data::STATUS_GOOD;
+		restored = true;
+		break;
+
+	default:
+		if (e._status == Data::STATUS_GOOD) {
+			say("Not injured!\n", 0xFF);
+			return false;
+		}
+		if (e._status != Data::STATUS_ASHES) {
+			say("Not ashes!\n", 0xFF);
+			return false;
+		}
+
+		e._status = Data::STATUS_GOOD;
+		flash();
+		restored = true;
+		break;
+	}
+
+	if (restored)
+		spend(TEMPLE_COSTS[_service]);
+
+	return restored;
+}
+
+bool Temple::keypress(const KeypressMessage &msg) {
+	switch (_stage) {
+	case CHOOSE_SERVICE: {
+		if (!_menu.handleKey(msg))
+			return false;
+
+		char key = _menu.key();
+		if (key == 'Q' || key == ESCAPE_KEY) {
+			farewell();
+			return true;
+		}
+
+		_service = key - '1';
+		say(TEMPLE_OFFERS[_service]);
+		_stage = CONFIRM;
+		return false;
+	}
+
+	case CONFIRM:
+		if (!_confirm.handleKey(msg))
+			return false;
+
+		_G(messages).print("\n");
+		if (!_confirm.yes()) {
+			say("\nWithout proper\nofferings I\ncannot help!\n");
+			return true;
+		}
+
+		if (!canAfford(TEMPLE_COSTS[_service])) {
+			say("I'm sorry, but\nthou hast not\ngold enough.\n", 0xFF);
+			return true;
+		}
+
+		say(TEMPLE_WHOM[_service]);
+		_stage = CHOOSE_PLAYER;
+		return false;
+
+	default: {
+		PlayerChooser::Result result = _chooser.handleKey(msg);
+		if (result == PlayerChooser::PENDING)
+			return false;
+		if (result == PlayerChooser::CANCELLED)
+			return true;
+
+		if (serve(_chooser.slot()))
+			farewell();
+		return true;
+	}
+	}
+}
+
+/*------------------------------------------------------------------------*/
+
+// What each kind of weapon and armour costs, in the order the shops list them
+static const int WEAPON_PRICES[14] = {
+	5, 30, 60, 125, 350, 200, 250, 400, 1050, 800, 1200, 2700, 6550, 4550
+};
+static const int ARMOUR_PRICES[6] = { 75, 195, 575, 2500, 6130, 8250 };
+
+EquipmentShop::EquipmentShop(int payer, bool weapons) : Shop(payer), _weapons(weapons) {
+	_G(messages).print(weapons ? "\nWelcome to the\nWeapons Shop!\n\nList? " :
+		"\nWelcome to the\nArmour Shop!\n\nList? ");
+}
+
+bool EquipmentShop::isBestShop() const {
+	return _G(savegame)._worldX == BEST_SHOP_X;
+}
+
+int EquipmentShop::itemCount() const {
+	const Data::Savegame &save = _G(savegame);
+
+	if (_weapons)
+		return (isBestShop() && save._plusTwoWeapons) ? 14 : 7;
+	else
+		return (isBestShop() && save._plusTwoArmour) ? 6 : 4;
+}
+
+void EquipmentShop::showPage() {
+	if (_weapons) {
+		if (_page == 0) {
+			_G(messages).print("\nAvailable:\nB:Dagger    5gp\nC:Mace     30gp\nD:Sling    60gp\n"
+				"E:Axe     125gp\nF:Bow     350gp\nG:Sword   200gp");
+		} else {
+			_G(messages).print("I:+2 Axe  400gp\nJ:+2 Bow 1050gp\nK:+2 Swd  800gp\nL:Gloves 1200gp\n"
+				"M:+4 Axe 2700gp\nN:+4 Bow 6550gp");
+		}
+	} else {
+		_G(messages).print("\nAvailable:\nB:Cloth     75gp\nC:Leather  195gp\nD:Chain    575gp\nE:Plate   2500gp");
+	}
+
+	_stage = LIST_PAGE;
+}
+
+void EquipmentShop::askAction() {
+	static const char *const WORDS[4] = { "Buy", "Sell", "Quit", "Quit" };
+
+	_G(messages).print("\nBuy or sell?\n");
+	_action.setup("BSQ\033", WORDS, 4);
+	_stage = ASK_ACTION;
+}
+
+void EquipmentShop::askItem() {
+	_G(messages).print(_buying ? "Your interest?\n" : "For sale?\n");
+
+	int count = itemCount();
+	_keys[0] = 'Q';
+	_keys[1] = ESCAPE_KEY;
+	_words[0] = _words[1] = "Quit";
+
+	for (int i = 0; i < count; ++i) {
+		_keys[2 + i] = 'B' + i;
+		_words[2 + i] = _weapons ? Data::WEAPON_NAMES[1 + i] : Data::ARMOUR_NAMES[1 + i];
+	}
+
+	_item.setup(_keys, _words, 2 + count);
+	_stage = CHOOSE_ITEM;
+}
+
+bool EquipmentShop::buy(int item) {
+	Data::RosterEntry &e = payer();
+	byte &owned = _weapons ? e._weaponOwned[item] : e._armourOwned[item];
+
+	if (owned == MAX_OWNED) {
+		say("\nNo more room!\n", 0xFE);
+		return false;
+	}
+
+	int price = _weapons ? WEAPON_PRICES[item] : ARMOUR_PRICES[item];
+	if (!canAfford(price)) {
+		say("\nI'm very sorry,\nbut you haven't\nthe gold!\n", 0xFE);
+		return false;
+	}
+
+	spend(price);
+	owned = Data::toBcd(Data::fromBcd(owned) + 1);
+	say("\nHere you are.\nMay it serve\nyou well.\n");
+	return true;
+}
+
+bool EquipmentShop::sell(int item) {
+	Data::RosterEntry &e = payer();
+	byte &owned = _weapons ? e._weaponOwned[item] : e._armourOwned[item];
+
+	if (owned == 0) {
+		say("\nYou don't own\none of those!\n", 0xFE);
+		return false;
+	}
+
+	int price = _weapons ? WEAPON_PRICES[item] : ARMOUR_PRICES[item];
+	int gold = Data::fromBcdWord(e._gold) + price;
+	if (gold > MAX_GOLD) {
+		say("\nToo much gold!\n", 0xFE);
+		return false;
+	}
+
+	e._gold = Data::toBcdWord(gold);
+	owned = Data::toBcd(Data::fromBcd(owned) - 1);
+
+	// Whatever was in use is put away
+	if (_weapons)
+		e._weaponIndex = 0;
+	else
+		e._armourIndex = 0;
+
+	say("\nThank you!\n");
+	return true;
+}
+
+bool EquipmentShop::keypress(const KeypressMessage &msg) {
+	Data::Savegame &save = _G(savegame);
+
+	switch (_stage) {
+	case ASK_LIST:
+		if (!_list.handleKey(msg))
+			return false;
+
+		_G(messages).print("\n");
+		if (_list.yes())
+			showPage();
+		else
+			askAction();
+		return false;
+
+	case LIST_PAGE:
+		if (msg.keycode == Common::KEYCODE_ESCAPE) {
+			_G(messages).print("\n");
+			askAction();
+			return false;
+		}
+		if (!isContinueKey(msg))
+			return false;
+
+		if (_weapons) {
+			if (_page == 0) {
+				_G(messages).print("\nH:2H Swd  250gp\n");
+
+				// The best shop has the better weapons too
+				if (isBestShop()) {
+					save._plusTwoWeapons = true;
+					_page = 1;
+					showPage();
+					return false;
+				}
+			} else {
+				_G(messages).print("\nO:+4 Swd 4550gp\n");
+			}
+		} else {
+			if (isBestShop()) {
+				save._plusTwoArmour = true;
+				_G(messages).print("\nF:+2Chain 6130gp\nG:+2Plate 8250gp");
+			}
+
+			_G(messages).print("\n");
+		}
+
+		askAction();
+		return false;
+
+	case ASK_ACTION: {
+		if (!_action.handleKey(msg))
+			return false;
+
+		_G(messages).print("\n");
+		char key = _action.key();
+		if (key == 'Q' || key == ESCAPE_KEY)
+			return true;
+
+		_buying = key == 'B';
+		askItem();
+		return false;
+	}
+
+	default: {
+		if (!_item.handleKey(msg))
+			return false;
+
+		char key = _item.key();
+		if (key == 'Q' || key == ESCAPE_KEY) {
+			_G(messages).print("\n");
+			return true;
+		}
+
+		bool carryOn = _buying ? buy(key - 'B') : sell(key - 'B');
+		if (!carryOn)
+			return true;
+
+		askItem();
+		return false;
+	}
+	}
+}
+
+/*------------------------------------------------------------------------*/
+
+static const int GUILD_PRICES[4] = { 75, 50, 90, 6 };
+
+Guild::Guild(int payer) : Shop(payer) {
+	showGoods();
+}
+
+void Guild::showGoods() {
+	static const char *const WORDS[6] = { "Gems", "Keys", "Powders", "Torches", "Quit", "Quit" };
+
+	_G(messages).print("The Guild shop:\n Keys      50gp\n Torches    6gp\n Powders   90gp\n Gems      75gp\nYour needs:\n");
+	_menu.setup("GKPTQ\033", WORDS, 6);
+	_stage = CHOOSE_GOODS;
+}
+
+bool Guild::keypress(const KeypressMessage &msg) {
+	Data::RosterEntry &e = payer();
+
+	switch (_stage) {
+	case CHOOSE_GOODS: {
+		if (!_menu.handleKey(msg))
+			return false;
+
+		char key = _menu.key();
+		if (key == 'Q' || key == ESCAPE_KEY) {
+			say("\nThank you,\ncome again!\n");
+			return true;
+		}
+
+		_goods = (key == 'G') ? 0 : (key == 'K') ? 1 : (key == 'P') ? 2 : 3;
+		_G(messages).print("\nHow many? ");
+		_number.setup(2);
+		_stage = CHOOSE_AMOUNT;
+		return false;
+	}
+
+	case CHOOSE_AMOUNT: {
+		if (!_number.handleKey(msg))
+			return false;
+
+		if (_number.hasLetters()) {
+			_G(messages).print("\n");
+			g_engine->playSoundEffect(0xFF);
+			return true;
+		}
+
+		byte *held = (_goods == 0) ? &e._gems : (_goods == 1) ? &e._keys : (_goods == 2) ? &e._powder : &e._torches;
+		int quantity = Data::fromBcd(_number.bcd());
+		int total = Data::fromBcd(*held) + quantity;
+
+		if (total > 99) {
+			say("\nToo much to\ncarry!\n", 0xFF);
+			return true;
+		}
+
+		if (!canAfford(GUILD_PRICES[_goods] * quantity)) {
+			say("\nI'm sorry,\nbut you have\nnot the funds!\n");
+			_G(messages).print("\n");
+			g_engine->playSoundEffect(0xFF);
+			return true;
+		}
+
+		spend(GUILD_PRICES[_goods] * quantity);
+		*held = Data::toBcd(total);
+		say("\nAnything else?\n");
+		_stage = ANYTHING_ELSE;
+		return false;
+	}
+
+	default:
+		if (!_more.handleKey(msg))
+			return false;
+
+		_G(messages).print("\n");
+		if (_more.yes()) {
+			_more = LogYesNo();
+			showGoods();
+			return false;
+		}
+
+		say("\nThank you,\ncome again!\n");
+		return true;
+	}
+}
+
+/*------------------------------------------------------------------------*/
+
+static const char *const ORACLE_CLUES[10] = {
+	"And so the sage\nsaid unto thee\n`If thou can\nsolve my rhyme\n",
+	"you'll learn of\nmarks & playing\ncards & hidden\nholy shrines.\n",
+	"Of marks I say\nthere are but 4\nof fire, force,\nsnake & king.\n",
+	"Learn their use\nin Devil Guard,\nor death you'll\nsurely bring.\n",
+	"Shrines there\nare again but 4\nto which you\ngo and pray.\n",
+	"Their uses are\ninumerable and\nclues throughout\nI say.\n",
+	"The cards their\nsuits do number\n4, called Sol\nMoon, Death\nand Love.",
+	"Unto the Montors\nthou must go\nfor guidence\nfrom above.\n",
+	"To aid thee in\nthy cryptic\nsearch, to\ndungeons thou\nmust fare.",
+	"There seek out\nthe Lord of Time\nto help you\nif he cares.'\n"
+};
+
+Oracle::Oracle(int payer) : Shop(payer) {
+	_G(messages).print("\n    Radrion:\nProphet of Life!\n");
+	askForOffering();
+}
+
+void Oracle::askForOffering() {
+	_asking = false;
+	_G(messages).print("\nHow many 100gp\nis your\noffering? ");
+	_number.setup(2);
+}
+
+bool Oracle::keypress(const KeypressMessage &msg) {
+	if (_asking) {
+		if (!_more.handleKey(msg))
+			return false;
+
+		_G(messages).print("\n");
+		if (_more.yes()) {
+			_more = LogYesNo();
+			askForOffering();
+			return false;
+		}
+
+		_G(messages).print("\n");
+		say("\nFare thee well\nand good luck!\n");
+		return true;
+	}
+
+	if (!_number.handleKey(msg))
+		return false;
+
+	if (_number.hasLetters()) {
+		say("\n<-What?\n", 0xFE);
+		return true;
+	}
+
+	_G(messages).print("\n\n");
+	int cost = Data::fromBcd(_number.bcd()) * 100;
+	if (!canAfford(cost)) {
+		say(CANT_PAY, 0xFE);
+		return true;
+	}
+
+	spend(cost);
+	say(ORACLE_CLUES[MIN(_number.bcd(), 9)]);
+	say("\nMore offering?\n");
+	_asking = true;
+	return false;
+}
+
+/*------------------------------------------------------------------------*/
+
+Stable::Stable(int payer) : Shop(payer) {
+	int size = _G(savegame)._partySize;
+	_G(messages).print(Common::String::format("\n\nEquine Emporium:\n\n%X horses cost\n%X00gp. Will you\nbuy? ",
+		size, size * 2).c_str());
+}
+
+bool Stable::keypress(const KeypressMessage &msg) {
+	if (!_buy.handleKey(msg))
+		return false;
+
+	_G(messages).print("\n");
+	if (!_buy.yes()) {
+		say("Ah, too bad.\nThese are the\nbest in town!\n");
+		return true;
+	}
+
+	int cost = _G(savegame)._partySize * 200;
+	if (!canAfford(cost)) {
+		say("I'm sorry, but\nthou hast not\ngold enough.\n", 0xFF);
+		return true;
+	}
+
+	spend(cost);
+	say("May you ride\nfast and true\nfriend!\n");
+	_G(savegame)._transport = TRANSPORT_HORSE;
+	return true;
+}
+
+} // namespace Interactions
+} // namespace Views
+} // namespace Ultima3
+} // namespace Ultima
diff --git a/engines/ultima/ultima3/views/interactions/shops.h b/engines/ultima/ultima3/views/interactions/shops.h
new file mode 100644
index 00000000000..7017df57be8
--- /dev/null
+++ b/engines/ultima/ultima3/views/interactions/shops.h
@@ -0,0 +1,214 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef ULTIMA3_VIEWS_INTERACTIONS_SHOPS_H
+#define ULTIMA3_VIEWS_INTERACTIONS_SHOPS_H
+
+#include "ultima/ultima3/views/interactions/log_input.h"
+
+namespace Ultima {
+namespace Ultima3 {
+namespace Views {
+namespace Interactions {
+
+/**
+ * What the shops, inns and temples of a town have in common: the party
+ * member who deals with them is the one who pays
+ */
+class Shop : public Interaction {
+protected:
+	int _payer;
+
+	Data::RosterEntry &payer() const;
+
+	/**
+	 * Returns true if the payer has at least an amount of gold
+	 */
+	bool canAfford(int gold) const;
+
+	/**
+	 * Takes gold from the payer
+	 */
+	void spend(int gold);
+
+	/**
+	 * Writes some text, followed by a sound if one is given
+	 */
+	void say(const char *text, int sound = 0);
+
+public:
+	Shop(int payer) : _payer(payer) {}
+};
+
+/**
+ * The pub, where the more is paid for a drink the more is learnt
+ */
+class Tavern : public Shop {
+private:
+	LogNumber _number;
+	LogYesNo _another;
+	bool _asking = false;
+
+	void askForPayment();
+
+public:
+	Tavern(int payer);
+	bool keypress(const KeypressMessage &msg) override;
+};
+
+/**
+ * Rations of food are sold at the grocer, a gold piece each
+ */
+class Grocer : public Shop {
+private:
+	LogNumber _number;
+
+public:
+	Grocer(int payer);
+	bool keypress(const KeypressMessage &msg) override;
+};
+
+/**
+ * The temple cures, heals, resurrects and recalls for a price
+ */
+class Temple : public Shop {
+private:
+	enum Stage {
+		CHOOSE_SERVICE,
+		CONFIRM,
+		CHOOSE_PLAYER
+	};
+
+	Stage _stage = CHOOSE_SERVICE;
+	int _service = 0;
+	LogMenu _menu;
+	LogYesNo _confirm;
+	PlayerChooser _chooser;
+
+	void farewell();
+	bool serve(int slot);
+
+public:
+	Temple(int payer);
+	bool keypress(const KeypressMessage &msg) override;
+};
+
+/**
+ * Weapons and armour are bought and sold at the shops for each
+ */
+class EquipmentShop : public Shop {
+private:
+	enum Stage {
+		ASK_LIST,
+		LIST_PAGE,
+		ASK_ACTION,
+		CHOOSE_ITEM
+	};
+
+	bool _weapons;
+	Stage _stage = ASK_LIST;
+	int _page = 0;
+	bool _buying = false;
+	LogYesNo _list;
+	LogMenu _action;
+	LogMenu _item;
+	char _keys[20];
+	const char *_words[20];
+
+	/**
+	 * Returns true if the shop is the one holding the best equipment
+	 */
+	bool isBestShop() const;
+
+	/**
+	 * Returns how many different things the shop deals in
+	 */
+	int itemCount() const;
+
+	void showPage();
+	void askAction();
+	void askItem();
+	bool buy(int item);
+	bool sell(int item);
+
+public:
+	EquipmentShop(int payer, bool weapons);
+	bool keypress(const KeypressMessage &msg) override;
+};
+
+/**
+ * The guild sells keys, torches, powder and gems
+ */
+class Guild : public Shop {
+private:
+	enum Stage {
+		CHOOSE_GOODS,
+		CHOOSE_AMOUNT,
+		ANYTHING_ELSE
+	};
+
+	Stage _stage = CHOOSE_GOODS;
+	int _goods = 0;
+	LogMenu _menu;
+	LogNumber _number;
+	LogYesNo _more;
+
+	void showGoods();
+
+public:
+	Guild(int payer);
+	bool keypress(const KeypressMessage &msg) override;
+};
+
+/**
+ * The oracle gives clues in return for gold
+ */
+class Oracle : public Shop {
+private:
+	LogNumber _number;
+	LogYesNo _more;
+	bool _asking = false;
+
+	void askForOffering();
+
+public:
+	Oracle(int payer);
+	bool keypress(const KeypressMessage &msg) override;
+};
+
+/**
+ * Horses are sold at the stables, for the whole party
+ */
+class Stable : public Shop {
+private:
+	LogYesNo _buy;
+
+public:
+	Stable(int payer);
+	bool keypress(const KeypressMessage &msg) override;
+};
+
+} // namespace Interactions
+} // namespace Views
+} // namespace Ultima3
+} // namespace Ultima
+
+#endif
diff --git a/engines/ultima/ultima3/views/interactions/transact.cpp b/engines/ultima/ultima3/views/interactions/transact.cpp
new file mode 100644
index 00000000000..3fd0bfaab3d
--- /dev/null
+++ b/engines/ultima/ultima3/views/interactions/transact.cpp
@@ -0,0 +1,204 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "ultima/ultima3/views/interactions/transact.h"
+#include "ultima/ultima3/views/interactions/shops.h"
+#include "ultima/ultima3/ultima3.h"
+
+namespace Ultima {
+namespace Ultima3 {
+namespace Views {
+namespace Interactions {
+
+constexpr byte FIRST_COUNTER_CELL = 0x94;
+constexpr byte LAST_COUNTER_CELL = 0xE4;
+constexpr byte CELL_MERCHANT = 0x40;
+constexpr byte CELL_LORD_BRITISH = 0x4C;
+constexpr byte FLAGS_HOSTILE = 0xC0;
+constexpr byte MARK_OF_KINGS = 0x80;
+
+// The levels that can be reached without the Mark of Kings, and the most there are
+constexpr int LEVEL_NEEDING_MARK = 5;
+constexpr int LEVEL_LIMIT = 0x25;
+
+Transact::~Transact() {
+	_G(effects)._highlight = -1;
+}
+
+void Transact::lordBritish() {
+	Data::RosterEntry &e = _G(savegame).partyMember(_players.slot());
+	byte level = e._maxHitPoints >> 8;
+
+	_G(messages).print("\nWelcome my child\n");
+
+	if (level > (e._experience >> 8)) {
+		_G(messages).print("Experience more!\n\n");
+	} else if (level >= LEVEL_LIMIT) {
+		_G(messages).print("No more!\n");
+	} else if (level >= LEVEL_NEEDING_MARK && !(e._marksAndCards & MARK_OF_KINGS)) {
+		_G(messages).print("Seek ye, the\nMark of Kings!\n");
+	} else {
+		e._maxHitPoints = (e._maxHitPoints & 0xFF) | (Data::toBcd(Data::fromBcd(level) + 1) << 8);
+		_G(messages).print("Thou art greater\n\n");
+		_G(effects).flashViewport();
+		g_engine->playSoundEffect(0xFD);
+	}
+}
+
+void Transact::talkTo(int creature) {
+	const Data::Creatures &c = _G(map)._creatures;
+
+	if (c._tile[creature] == CELL_LORD_BRITISH) {
+		lordBritish();
+		return;
+	}
+
+	byte flags = c._flags[creature];
+	if (flags == FLAGS_HOSTILE) {
+		_G(messages).print("\nEat Death Scum!\n\n");
+	} else if ((flags & 0x3F) == 0) {
+		_G(messages).print("\nGood day!\n\n");
+	} else {
+		const char *text = _G(map).text((flags & 0x3F) - 1);
+		if (text)
+			_G(messages).print(text);
+	}
+}
+
+bool Transact::startShop(int dx, int dy) {
+	const Data::Savegame &save = _G(savegame);
+
+	byte counter = _G(map).cell(save._posX + dx, save._posY + dy);
+	if (counter < FIRST_COUNTER_CELL || counter > LAST_COUNTER_CELL)
+		return false;
+	if (_G(map).cell(save._posX + dx * 2, save._posY + dy * 2) != CELL_MERCHANT)
+		return false;
+
+	const int payer = _players.slot();
+	_G(effects)._highlight = payer;
+
+	// Horses are bought facing west, and the rest according to where the shop is
+	if (dx < 0) {
+		_shop.reset(new Stable(payer));
+		return true;
+	}
+
+	switch (save._posY & 7) {
+	case 0:
+		_shop.reset(new Tavern(payer));
+		break;
+	case 1:
+		_shop.reset(new Grocer(payer));
+		break;
+	case 2:
+		_shop.reset(new Temple(payer));
+		break;
+	case 3:
+		_shop.reset(new EquipmentShop(payer, true));
+		break;
+	case 4:
+		_shop.reset(new EquipmentShop(payer, false));
+		break;
+	case 5:
+		_shop.reset(new Guild(payer));
+		break;
+	case 6:
+		_shop.reset(new Oracle(payer));
+		break;
+	default:
+		_shop.reset(new Stable(payer));
+		break;
+	}
+
+	return true;
+}
+
+bool Transact::keypress(const KeypressMessage &msg) {
+	Data::Savegame &save = _G(savegame);
+
+	switch (_stage) {
+	case CHOOSE_PLAYER: {
+		PlayerChooser::Result result = _players.handleKey(msg);
+		if (result == PlayerChooser::PENDING)
+			return false;
+		if (result == PlayerChooser::CANCELLED)
+			return true;
+
+		if (!save.partyMember(_players.slot()).isAlive()) {
+			_G(messages).print("Incapacitated!\n");
+			g_engine->playSoundEffect(0xFF);
+			return true;
+		}
+
+		_G(messages).print("Direct? ");
+		_stage = CHOOSE_DIRECTION;
+		return false;
+	}
+
+	case CHOOSE_DIRECTION: {
+		DirectionChooser::Result result = _directions.handleKey(msg);
+		if (result == DirectionChooser::PENDING)
+			return false;
+		if (result == DirectionChooser::CANCELLED)
+			return true;
+
+		int dx = 0, dy = 0;
+		switch (_directions.direction()) {
+		case DIR_NORTH: dy = -1; break;
+		case DIR_SOUTH: dy = 1; break;
+		case DIR_EAST: dx = 1; break;
+		default: dx = -1; break;
+		}
+
+		// Someone standing there is spoken to
+		const Data::Creatures &c = _G(map)._creatures;
+		int x = (save._posX + dx) & (Data::MAP_SIZE - 1), y = (save._posY + dy) & (Data::MAP_SIZE - 1);
+		for (int i = Data::CREATURE_COUNT - 1; i >= 0; --i) {
+			if (c._tile[i] && c._x[i] == x && c._y[i] == y) {
+				talkTo(i);
+				return true;
+			}
+		}
+
+		if (startShop(dx, dy)) {
+			_stage = IN_SHOP;
+			return false;
+		}
+
+		_G(messages).print("Not Here!\n");
+		g_engine->playSoundEffect(0xFF);
+		return true;
+	}
+
+	default:
+		if (_shop->keypress(msg)) {
+			_shop.reset();
+			return true;
+		}
+
+		return false;
+	}
+}
+
+} // namespace Interactions
+} // namespace Views
+} // namespace Ultima3
+} // namespace Ultima
diff --git a/engines/ultima/ultima3/views/interactions/transact.h b/engines/ultima/ultima3/views/interactions/transact.h
new file mode 100644
index 00000000000..86c14369934
--- /dev/null
+++ b/engines/ultima/ultima3/views/interactions/transact.h
@@ -0,0 +1,78 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef ULTIMA3_VIEWS_INTERACTIONS_TRANSACT_H
+#define ULTIMA3_VIEWS_INTERACTIONS_TRANSACT_H
+
+#include "common/ptr.h"
+#include "ultima/ultima3/views/interactions/interaction.h"
+
+namespace Ultima {
+namespace Ultima3 {
+namespace Views {
+namespace Interactions {
+
+/**
+ * Has a party member speak to someone next to them, or deal with the shop
+ * whose counter they're facing
+ */
+class Transact : public Interaction {
+private:
+	enum Stage {
+		CHOOSE_PLAYER,
+		CHOOSE_DIRECTION,
+		IN_SHOP
+	};
+
+	Stage _stage = CHOOSE_PLAYER;
+	PlayerChooser _players;
+	DirectionChooser _directions;
+	Common::ScopedPtr<Interaction> _shop;
+
+	/**
+	 * Says what someone in the town has to say
+	 */
+	void talkTo(int creature);
+
+	/**
+	 * Lord British lets those who have earned it grow stronger
+	 */
+	void lordBritish();
+
+	/**
+	 * Starts dealing with the shop whose counter is in a direction
+	 * @returns		False if there isn't one
+	 */
+	bool startShop(int dx, int dy);
+
+public:
+	Transact() {}
+	~Transact() override;
+
+	bool keypress(const KeypressMessage &msg) override;
+};
+
+} // namespace Interactions
+} // namespace Views
+} // namespace Ultima3
+} // namespace Ultima
+
+#endif
diff --git a/engines/ultima/ultima3/views/location_map.cpp b/engines/ultima/ultima3/views/location_map.cpp
index d2068bfb5d4..4d626d49bab 100644
--- a/engines/ultima/ultima3/views/location_map.cpp
+++ b/engines/ultima/ultima3/views/location_map.cpp
@@ -24,6 +24,7 @@
 #include "ultima/ultima3/views/interactions/get_chest.h"
 #include "ultima/ultima3/views/interactions/look.h"
 #include "ultima/ultima3/views/interactions/steal_chest.h"
+#include "ultima/ultima3/views/interactions/transact.h"
 #include "ultima/ultima3/views/interactions/unlock_door.h"
 #include "ultima/ultima3/ultima3.h"
 
@@ -330,6 +331,10 @@ bool LocationMap::handleCommand(const KeypressMessage &msg) {
 		_G(messages).print("Steal Chest!\nPlayer? ");
 		startInteraction(new Interactions::StealChest());
 		return true;
+	case 'T':
+		_G(messages).print("Who will\nTransact? ");
+		startInteraction(new Interactions::Transact());
+		return true;
 	case 'U':
 		_G(messages).print("Unlock-");
 		startInteraction(new Interactions::UnlockDoor());
diff --git a/engines/ultima/ultima3/views/menu_input.h b/engines/ultima/ultima3/views/menu_input.h
index 461b93dd6be..00eb6308b0f 100644
--- a/engines/ultima/ultima3/views/menu_input.h
+++ b/engines/ultima/ultima3/views/menu_input.h
@@ -76,6 +76,13 @@ public:
 		return _choice >= 0;
 	}
 
+	/**
+	 * Returns the word of the option currently echoed
+	 */
+	const char *word() const {
+		return _words[_choice];
+	}
+
 	/**
 	 * Returns the number of the option currently echoed
 	 */


Commit: 7e974b2460d1ed6e86868f3bd05ec02562b8e098
    https://github.com/scummvm/scummvm/commit/7e974b2460d1ed6e86868f3bd05ec02562b8e098
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:41:01+11:00

Commit Message:
ULTIMA: ULTIMA3: Add spell casting and the negate time command

Changed paths:
  A engines/ultima/ultima3/views/interactions/cast_spell.cpp
  A engines/ultima/ultima3/views/interactions/cast_spell.h
  A engines/ultima/ultima3/views/interactions/negate_time.cpp
  A engines/ultima/ultima3/views/interactions/negate_time.h
    engines/ultima/module.mk
    engines/ultima/ultima3/data/savegame.cpp
    engines/ultima/ultima3/data/savegame.h
    engines/ultima/ultima3/logic/combat_logic.cpp
    engines/ultima/ultima3/logic/combat_logic.h
    engines/ultima/ultima3/logic/creature_logic.cpp
    engines/ultima/ultima3/logic/creature_logic.h
    engines/ultima/ultima3/logic/location_logic.cpp
    engines/ultima/ultima3/logic/location_logic.h
    engines/ultima/ultima3/ultima3.cpp
    engines/ultima/ultima3/ultima3.h
    engines/ultima/ultima3/views/combat_map.cpp
    engines/ultima/ultima3/views/game.cpp
    engines/ultima/ultima3/views/interactions/interaction.h
    engines/ultima/ultima3/views/location_map.cpp


diff --git a/engines/ultima/module.mk b/engines/ultima/module.mk
index fe82f680317..5d327ad2238 100644
--- a/engines/ultima/module.mk
+++ b/engines/ultima/module.mk
@@ -183,6 +183,7 @@ MODULE_OBJS += \
 	ultima3/views/disperse_party.o \
 	ultima3/views/form_party.o \
 	ultima3/views/game.o \
+	ultima3/views/interactions/cast_spell.o \
 	ultima3/views/interactions/combat_attack.o \
 	ultima3/views/interactions/equip.o \
 	ultima3/views/interactions/exchange.o \
@@ -190,6 +191,7 @@ MODULE_OBJS += \
 	ultima3/views/interactions/interaction.o \
 	ultima3/views/interactions/log_input.o \
 	ultima3/views/interactions/look.o \
+	ultima3/views/interactions/negate_time.o \
 	ultima3/views/interactions/shops.o \
 	ultima3/views/interactions/steal_chest.o \
 	ultima3/views/interactions/transact.o \
diff --git a/engines/ultima/ultima3/data/savegame.cpp b/engines/ultima/ultima3/data/savegame.cpp
index b00cc6454ef..a286bc1a8fe 100644
--- a/engines/ultima/ultima3/data/savegame.cpp
+++ b/engines/ultima/ultima3/data/savegame.cpp
@@ -78,6 +78,9 @@ void Savegame::synchronize(Common::Serializer &s) {
 		s.syncAsByte(_worldX);
 		s.syncAsByte(_worldY);
 	}
+
+	if (s.getVersion() >= 4)
+		s.syncAsByte(_lightTurns);
 }
 
 void Savegame::formParty() {
diff --git a/engines/ultima/ultima3/data/savegame.h b/engines/ultima/ultima3/data/savegame.h
index 3b684e90b6f..c056d6c3495 100644
--- a/engines/ultima/ultima3/data/savegame.h
+++ b/engines/ultima/ultima3/data/savegame.h
@@ -52,6 +52,9 @@ struct Savegame {
 	byte _worldY = 0;
 	byte _moveCount[4] = {};
 
+	// How much longer a light spell or torch lasts
+	byte _lightTurns = 0;
+
 	// Set once the party has seen the more powerful gear offered in the
 	// shops, making it available for readying and wearing
 	bool _allWeapons = false;
diff --git a/engines/ultima/ultima3/logic/combat_logic.cpp b/engines/ultima/ultima3/logic/combat_logic.cpp
index a6a399677b5..552743116fe 100644
--- a/engines/ultima/ultima3/logic/combat_logic.cpp
+++ b/engines/ultima/ultima3/logic/combat_logic.cpp
@@ -190,7 +190,8 @@ void CombatLogic::begin(int creature) {
 
 	_savedLocation = save._location;
 	_events.clear();
-	_negateTurns = 0;
+	_G(holdTime) = 0;
+	_slayUsed = false;
 	_combatant = 0;
 
 	_G(messages).print("\n---Conflict!!---\n->");
@@ -237,6 +238,18 @@ void CombatLogic::begin(int creature) {
 	syncShown();
 }
 
+int CombatLogic::negateTurns() const {
+	return _G(holdTime);
+}
+
+void CombatLogic::decrementHold() {
+	--_G(holdTime);
+}
+
+void CombatLogic::endHold() {
+	_G(holdTime) = 0;
+}
+
 bool CombatLogic::allMonstersDead() const {
 	for (int i = 0; i < ARENA_MONSTERS; ++i) {
 		if (_arena._monsterHp[i])
@@ -627,5 +640,51 @@ void CombatLogic::monstersTurn() {
 	}
 }
 
+void CombatLogic::castProjectile(int slot, int damage, Direction dir) {
+	const int dx = (dir == DIR_EAST) ? 1 : (dir == DIR_WEST) ? -1 : 0;
+	const int dy = (dir == DIR_SOUTH) ? 1 : (dir == DIR_NORTH) ? -1 : 0;
+
+	int monster = shoot(_arena._playerX[slot], _arena._playerY[slot], dx, dy, TILE_SPELL_SHOT);
+	if (monster < 0)
+		return;
+
+	sound(0xF7);
+	damageMonster(slot, monster, (byte)damage);
+}
+
+void CombatLogic::castGroupDamage(int slot, int damage) {
+	for (int monster = 0; monster < ARENA_MONSTERS; ++monster) {
+		if ((rollBelow(255) & 3) == 0 || !_arena._monsterHp[monster])
+			continue;
+
+		overlay(_arena._monsterX[monster], _arena._monsterY[monster], TILE_SPELL_SHOT);
+		sound(0xF7);
+		damageMonster(slot, monster, (byte)damage);
+	}
+}
+
+void CombatLogic::castDrain() {
+	for (int monster = 0; monster < ARENA_MONSTERS; ++monster) {
+		if (!_arena._monsterHp[monster])
+			continue;
+
+		_arena._monsterHp[monster] = 5;
+		overlay(_arena._monsterX[monster], _arena._monsterY[monster], TILE_SPELL_SHOT);
+		sound(0xF7);
+	}
+}
+
+bool CombatLogic::castSlay(int slot, byte monsterClass) {
+	if (_monsterClass != monsterClass || _slayUsed)
+		return false;
+
+	_slayUsed = true;
+	if (rollBelow(255) >= 128)
+		return false;
+
+	castGroupDamage(slot, 0xFF);
+	return true;
+}
+
 } // namespace Ultima3
 } // namespace Ultima
diff --git a/engines/ultima/ultima3/logic/combat_logic.h b/engines/ultima/ultima3/logic/combat_logic.h
index 2b40c97ae2b..44555727e27 100644
--- a/engines/ultima/ultima3/logic/combat_logic.h
+++ b/engines/ultima/ultima3/logic/combat_logic.h
@@ -63,7 +63,7 @@ private:
 	byte _shown[Data::ARENA_SIZE * Data::ARENA_SIZE] = {};
 
 	Common::Array<CombatEvent> _events;
-	int _negateTurns = 0;
+	bool _slayUsed = false;
 
 	void print(const Common::String &text);
 	void sound(int effect);
@@ -164,21 +164,11 @@ public:
 	/**
 	 * Returns how many turns of time being held still are left
 	 */
-	int negateTurns() const {
-		return _negateTurns;
-	}
+	int negateTurns() const;
 
-	void holdTime() {
-		_negateTurns = 10;
-	}
+	void decrementHold();
 
-	void decrementHold() {
-		--_negateTurns;
-	}
-
-	void endHold() {
-		_negateTurns = 0;
-	}
+	void endHold();
 
 	/**
 	 * Lets a party member step in a direction
@@ -195,6 +185,28 @@ public:
 	 * Lets every monster take its turn
 	 */
 	void monstersTurn();
+
+	/**
+	 * Casts a spell that flies in a direction from a party member, harming
+	 * the first monster it reaches
+	 */
+	void castProjectile(int slot, int damage, Direction dir);
+
+	/**
+	 * Casts a spell that can harm any of the monsters
+	 */
+	void castGroupDamage(int slot, int damage);
+
+	/**
+	 * Casts a spell that leaves every monster with little life
+	 */
+	void castDrain();
+
+	/**
+	 * Casts a spell that only works once a fight, against one kind of monster
+	 * @returns		False if it fails
+	 */
+	bool castSlay(int slot, byte monsterClass);
 };
 
 } // namespace Ultima3
diff --git a/engines/ultima/ultima3/logic/creature_logic.cpp b/engines/ultima/ultima3/logic/creature_logic.cpp
index 9c2983140cc..d5cb4d65bde 100644
--- a/engines/ultima/ultima3/logic/creature_logic.cpp
+++ b/engines/ultima/ultima3/logic/creature_logic.cpp
@@ -131,8 +131,8 @@ int CreatureLogic::update(bool moved) {
 	}
 
 	// Time held still stops everyone
-	if (_negateTimeTurns > 0) {
-		--_negateTimeTurns;
+	if (_G(holdTime) > 0) {
+		--_G(holdTime);
 		return -1;
 	}
 
diff --git a/engines/ultima/ultima3/logic/creature_logic.h b/engines/ultima/ultima3/logic/creature_logic.h
index 61faf4bac73..18c7d86fb4d 100644
--- a/engines/ultima/ultima3/logic/creature_logic.h
+++ b/engines/ultima/ultima3/logic/creature_logic.h
@@ -64,9 +64,6 @@ private:
 	void spawnMonster();
 
 public:
-	// How many turns remain of time being held still
-	int _negateTimeTurns = 0;
-
 	/**
 	 * Returns the creature standing at a position, or -1
 	 */
diff --git a/engines/ultima/ultima3/logic/location_logic.cpp b/engines/ultima/ultima3/logic/location_logic.cpp
index e551ca75cd9..93cbf4b3bee 100644
--- a/engines/ultima/ultima3/logic/location_logic.cpp
+++ b/engines/ultima/ultima3/logic/location_logic.cpp
@@ -180,6 +180,26 @@ void LocationLogic::exitToWorld() {
 	save._posY = save._worldY;
 }
 
+void LocationLogic::teleportRandomly() {
+	Data::Savegame &save = _G(savegame);
+	Graphics::Views::Events *events = Graphics::Views::g_events;
+
+	for (;;) {
+		int x = events->getRandomNumber(Data::MAP_SIZE - 1);
+		int y = events->getRandomNumber(Data::MAP_SIZE - 1);
+		byte cell = _G(map).cell(x, y);
+
+		// Not into whirlpools, lava or force fields. As in the original, the
+		// map cell rather than its tile is what's tested for being passable
+		if (cell == 0x30 || cell == 0x80 || cell == 0x84 || isTerrainBlocked(cell))
+			continue;
+
+		save._posX = x;
+		save._posY = y;
+		return;
+	}
+}
+
 const char *LocationLogic::board() {
 	Data::Savegame &save = _G(savegame);
 	if (save._transport != TRANSPORT_ON_FOOT)
diff --git a/engines/ultima/ultima3/logic/location_logic.h b/engines/ultima/ultima3/logic/location_logic.h
index 7dfe702cd67..729223620c7 100644
--- a/engines/ultima/ultima3/logic/location_logic.h
+++ b/engines/ultima/ultima3/logic/location_logic.h
@@ -61,6 +61,11 @@ public:
 	 */
 	bool move(Direction dir);
 
+	/**
+	 * Moves the party to a random place on the world map
+	 */
+	void teleportRandomly();
+
 	/**
 	 * Mounts a horse or boards a ship that the party is standing on
 	 * @returns		What to say about it, or null if there's nothing to board
diff --git a/engines/ultima/ultima3/ultima3.cpp b/engines/ultima/ultima3/ultima3.cpp
index 7a8056f8973..719151e0ee9 100644
--- a/engines/ultima/ultima3/ultima3.cpp
+++ b/engines/ultima/ultima3/ultima3.cpp
@@ -87,7 +87,7 @@ bool Ultima3Engine::canLoadGameStateCurrently(Common::U32String *msg) {
 }
 
 Common::Error Ultima3Engine::syncGame(Common::Serializer &s) {
-	s.syncVersion(3);
+	s.syncVersion(4);
 
 	_savegame.synchronize(s);
 	if (_savegame._mapLoaded) {
diff --git a/engines/ultima/ultima3/ultima3.h b/engines/ultima/ultima3/ultima3.h
index f6a637185bf..42fb3af0833 100644
--- a/engines/ultima/ultima3/ultima3.h
+++ b/engines/ultima/ultima3/ultima3.h
@@ -98,6 +98,9 @@ public:
 	Gfx::ScreenEffects _effects;
 	byte _windDirection = 0;
 
+	// How many more turns time is held still for, by powder or a spell
+	byte _holdTime = 0;
+
 	// Toggled in the game by the Volume command
 	bool _soundEnabled = true;
 
diff --git a/engines/ultima/ultima3/views/combat_map.cpp b/engines/ultima/ultima3/views/combat_map.cpp
index ee5bd70576e..aa8ca83589b 100644
--- a/engines/ultima/ultima3/views/combat_map.cpp
+++ b/engines/ultima/ultima3/views/combat_map.cpp
@@ -21,6 +21,7 @@
 
 #include "ultima/ultima3/views/combat_map.h"
 #include "ultima/ultima3/views/menu_input.h"
+#include "ultima/ultima3/views/interactions/cast_spell.h"
 #include "ultima/ultima3/views/interactions/combat_attack.h"
 #include "ultima/ultima3/views/interactions/equip.h"
 #include "ultima/ultima3/views/interactions/ztats.h"
@@ -198,7 +199,7 @@ void CombatMap::doNegateTime() {
 		g_engine->playSoundEffect(0xFE);
 	} else {
 		e._powder = Data::toBcd(Data::fromBcd(e._powder) - 1);
-		_G(combat).holdTime();
+		_G(holdTime) = 10;
 	}
 
 	endTurn();
@@ -252,6 +253,10 @@ bool CombatMap::handleCommand(const KeypressMessage &msg) {
 	case 'N':
 		doNegateTime();
 		return true;
+	case 'C':
+		_G(messages).print("Cast Spell!\n");
+		startInteraction(new Interactions::CastSpell(slot));
+		return true;
 	case 'A':
 		doAttack();
 		return true;
diff --git a/engines/ultima/ultima3/views/game.cpp b/engines/ultima/ultima3/views/game.cpp
index dedaea7a56c..12adccf43f9 100644
--- a/engines/ultima/ultima3/views/game.cpp
+++ b/engines/ultima/ultima3/views/game.cpp
@@ -110,6 +110,13 @@ void Game::timeout() {
 
 void Game::startInteraction(Interactions::Interaction *interaction) {
 	_interaction.reset(interaction);
+
+	if (interaction->isFinished()) {
+		_interaction.reset();
+		endTurn();
+		return;
+	}
+
 	redraw();
 }
 
diff --git a/engines/ultima/ultima3/views/interactions/cast_spell.cpp b/engines/ultima/ultima3/views/interactions/cast_spell.cpp
new file mode 100644
index 00000000000..5058294d78d
--- /dev/null
+++ b/engines/ultima/ultima3/views/interactions/cast_spell.cpp
@@ -0,0 +1,400 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "ultima/ultima3/views/interactions/cast_spell.h"
+#include "ultima/ultima3/logic/chest_logic.h"
+#include "ultima/ultima3/logic/location_logic.h"
+#include "ultima/ultima3/data/data.h"
+#include "ultima/ultima3/views/menu_input.h"
+#include "ultima/ultima3/ultima3.h"
+
+namespace Ultima {
+namespace Ultima3 {
+namespace Views {
+namespace Interactions {
+
+constexpr int SPELLS_PER_BOOK = 16;
+constexpr int SPELL_NAMES_START = 88;
+constexpr int MP_PER_LEVEL = 5;
+constexpr int CURE_REFUND = 35;
+constexpr byte MONSTER_ORC = 0x18;
+constexpr byte MONSTER_SKELETON = 0x19;
+constexpr byte FIRST_CHEST_CELL = 0x24;
+constexpr byte LAST_CHEST_CELL = 0x27;
+constexpr byte CELL_FLOOR = 0x20;
+
+// What each spell does, in the order they are lettered in each book
+static const byte WIZARD_EFFECTS[SPELLS_PER_BOOK] = {
+	0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15
+};
+static const byte CLERIC_EFFECTS[SPELLS_PER_BOOK] = {
+	16, 17, 18, 2, 4, 3, 19, 20, 21, 8, 22, 23, 11, 24, 15, 25
+};
+
+static int rollBelow(int limit) {
+	return Graphics::Views::g_events->getRandomNumber(limit - 1);
+}
+
+CastSpell::CastSpell(int slot) : _inCombat(slot >= 0), _slot(slot) {
+	if (slot >= 0)
+		begin();
+}
+
+void CastSpell::begin() {
+	const Data::RosterEntry &e = _G(savegame).partyMember(_slot);
+
+	switch (e._class) {
+	case 'D':
+	case 'R':
+		_G(messages).print("Spell type W/C-");
+		_stage = CHOOSE_TYPE;
+		break;
+
+	case 'C':
+	case 'P':
+	case 'I':
+		_cleric = true;
+		_G(messages).print("Cleric spell-");
+		_stage = CHOOSE_SPELL;
+		break;
+
+	case 'W':
+	case 'L':
+	case 'A':
+		_G(messages).print("Wizard spell-");
+		_stage = CHOOSE_SPELL;
+		break;
+
+	default:
+		_G(messages).print("Not a mage!\n");
+		g_engine->playSoundEffect(0xFF);
+		_finished = true;
+		break;
+	}
+}
+
+bool CastSpell::fail() {
+	_G(messages).print("Failed!\n");
+	g_engine->playSoundEffect(0xFA);
+	return true;
+}
+
+void CastSpell::fanfare() {
+	g_engine->playSoundEffect(0xF5);
+	_G(effects).flashViewport();
+	g_engine->playSoundEffect(0xFD);
+}
+
+bool CastSpell::perform(Effect effect) {
+	Data::Savegame &save = _G(savegame);
+	CombatLogic &combat = _G(combat);
+	const Data::RosterEntry &caster = save.partyMember(_slot);
+	_effect = effect;
+
+	switch (effect) {
+	case SLAY_ORCS:
+	case SLAY_SKELETONS:
+		if (!_inCombat || !combat.castSlay(_slot, effect == SLAY_ORCS ? MONSTER_ORC : MONSTER_SKELETON))
+			return fail();
+		fanfare();
+		return true;
+
+	case MISSILE:
+		_amount = rollBelow(0x28) | 0x10;
+		break;
+	case FIREBALL:
+		_amount = 0x4B;
+		break;
+	case MIND_BLAST:
+		_amount = (Data::fromBcd(caster._intelligence) * 2) & 0xFF;
+		break;
+	case ANNIHILATE:
+		_amount = 0xFF;
+		break;
+
+	case LIGHT:
+	case GREAT_LIGHT:
+		save._lightTurns = (effect == LIGHT) ? 10 : 0xFA;
+		fanfare();
+		return true;
+
+	case TELEPORT:
+		if (save._location != Data::LOCATION_SOSARIA)
+			return fail();
+
+		fanfare();
+		LocationLogic().teleportRandomly();
+		return true;
+
+	case WIZARD_TO_CLERIC:
+		fanfare();
+		_cleric = true;
+		_G(messages).print("Cleric spell-");
+		_stage = CHOOSE_SPELL;
+		return false;
+
+	case FIRE_STORM:
+	case MIND_STORM:
+	case DEATH_STORM:
+		if (!_inCombat)
+			return fail();
+
+		fanfare();
+		combat.castGroupDamage(_slot, effect == FIRE_STORM ? 0x4B : (effect == DEATH_STORM ? 0xFF :
+			(Data::fromBcd(caster._intelligence) * 2) & 0xFF));
+		return true;
+
+	case HOLD_TIME:
+		_G(holdTime) = 10;
+		fanfare();
+		return true;
+
+	case DRAIN:
+		if (!_inCombat)
+			return fail();
+
+		fanfare();
+		combat.castDrain();
+		return true;
+
+	case UNLOCK: {
+		fanfare();
+		if (rollBelow(255) & 3) {
+			byte cell = _G(map).cell(save._posX, save._posY);
+
+			if (cell >= FIRST_CHEST_CELL && cell <= LAST_CHEST_CELL) {
+				byte ground = (cell & 3) << 2;
+				_G(map).setCell(save._posX, save._posY, ground ? ground : CELL_FLOOR);
+				ChestLogic().loot(_slot);
+				return true;
+			}
+
+			_G(messages).print("Not Here!\n");
+			g_engine->playSoundEffect(0xFF);
+		}
+
+		return fail();
+	}
+
+	case HEAL_SMALL:
+		_amount = rollBelow(20) + 10;
+		_G(messages).print("Heal whom? ");
+		_stage = TARGET;
+		return false;
+
+	case HEAL_LARGE:
+		_amount = rollBelow(80) + 20;
+		_G(messages).print("Heal whom? ");
+		_stage = TARGET;
+		return false;
+
+	case CURE:
+		_G(messages).print("Cure whom? ");
+		_stage = TARGET;
+		return false;
+
+	case RESURRECT:
+		if (_inCombat)
+			return fail();
+
+		_G(messages).print("Resurect whom? ");
+		_stage = TARGET;
+		return false;
+
+	case RECALL:
+		if (_inCombat)
+			return fail();
+
+		_G(messages).print("Recall whom? ");
+		_stage = TARGET;
+		return false;
+
+	default:
+		// These need somewhere to be cast that isn't available
+		return fail();
+	}
+
+	// The spells that fly in a direction
+	if (!_inCombat)
+		return fail();
+
+	_G(messages).print("Direct? ");
+	_stage = DIRECTION;
+	return false;
+}
+
+bool CastSpell::applyToPlayer(int target) {
+	Data::RosterEntry &e = _G(savegame).partyMember(target);
+	Data::RosterEntry &caster = _G(savegame).partyMember(_slot);
+
+	switch (_effect) {
+	case HEAL_SMALL:
+	case HEAL_LARGE: {
+		int hitPoints = MIN(Data::fromBcdWord(e._hitPoints) + _amount, Data::fromBcdWord(e._maxHitPoints));
+		e._hitPoints = Data::toBcdWord(hitPoints);
+		_G(effects).flashSlot(target);
+		fanfare();
+		return true;
+	}
+
+	case CURE:
+		if (e._status != Data::STATUS_POISONED)
+			return fail();
+
+		_G(effects).flashSlot(target);
+		fanfare();
+		e._status = Data::STATUS_GOOD;
+		return true;
+
+	case RESURRECT:
+		if (e._status != Data::STATUS_DEAD)
+			return fail();
+
+		_G(effects).flashSlot(target);
+		fanfare();
+		e._status = (rollBelow(255) & 3) ? Data::STATUS_GOOD : Data::STATUS_ASHES;
+		return true;
+
+	default:
+		if (e._status != Data::STATUS_ASHES)
+			return fail();
+
+		_G(effects).flashSlot(target);
+		fanfare();
+		e._status = Data::STATUS_GOOD;
+		caster._wisdom = Data::toBcd(MAX(Data::fromBcd(caster._wisdom) - 5, 0));
+		return true;
+	}
+}
+
+bool CastSpell::keypress(const KeypressMessage &msg) {
+	Data::Savegame &save = _G(savegame);
+
+	switch (_stage) {
+	case CHOOSE_CASTER: {
+		PlayerChooser::Result result = _players.handleKey(msg);
+		if (result == PlayerChooser::PENDING)
+			return false;
+		if (result == PlayerChooser::CANCELLED)
+			return true;
+
+		_slot = _players.slot();
+		if (!save.partyMember(_slot).isAlive()) {
+			_G(messages).print("Incapacitated!\n");
+			g_engine->playSoundEffect(0xFF);
+			return true;
+		}
+
+		begin();
+		return _finished;
+	}
+
+	case CHOOSE_TYPE: {
+		char key = commandKey(msg);
+
+		if (msg.keycode == Common::KEYCODE_ESCAPE) {
+			_G(messages).print("\n");
+			return true;
+		}
+		if (key != 'W' && key != 'C') {
+			g_engine->playSoundEffect(0xFF);
+			return false;
+		}
+
+		_cleric = key == 'C';
+		_G(messages).putChar((char)msg.ascii);
+		_G(messages).print(_cleric ? "Cleric spell-" : "Wizard spell-");
+		_stage = CHOOSE_SPELL;
+		return false;
+	}
+
+	case CHOOSE_SPELL: {
+		char key = commandKey(msg);
+
+		if (msg.keycode == Common::KEYCODE_ESCAPE) {
+			_G(messages).print("\n");
+			return true;
+		}
+		if (key < 'A' || key > 'P') {
+			g_engine->playSoundEffect(0xFF);
+			return false;
+		}
+
+		_G(messages).putChar((char)msg.ascii);
+		_G(messages).print("\n");
+
+		// Spells cost five magic points for each place down the book
+		int spell = key - 'A';
+		Data::RosterEntry &caster = save.partyMember(_slot);
+		_cost = spell * MP_PER_LEVEL;
+		if (_cost > Data::fromBcd(caster._magicPoints)) {
+			_G(messages).print("M.P. too low!\n");
+			g_engine->playSoundEffect(0xFF);
+			return true;
+		}
+
+		caster._magicPoints = Data::toBcd(Data::fromBcd(caster._magicPoints) - _cost);
+
+		_G(messages).print("\n");
+		_G(messages).print(Data::NAMES[SPELL_NAMES_START + spell + (_cleric ? SPELLS_PER_BOOK : 0)]);
+		_G(messages).print("\n\n");
+
+		return perform((Effect)(_cleric ? CLERIC_EFFECTS[spell] : WIZARD_EFFECTS[spell]));
+	}
+
+	case DIRECTION: {
+		DirectionChooser::Result result = _directions.handleKey(msg);
+		if (result == DirectionChooser::PENDING)
+			return false;
+
+		if (result == DirectionChooser::CHOSEN) {
+			fanfare();
+			_G(combat).castProjectile(_slot, _amount, _directions.direction());
+		}
+
+		return true;
+	}
+
+	default: {
+		PlayerChooser::Result result = _players.handleKey(msg);
+		if (result == PlayerChooser::PENDING)
+			return false;
+
+		if (result == PlayerChooser::CANCELLED) {
+			// Curing is refunded if no one is picked, and the rest don't mind
+			if (_effect == CURE) {
+				Data::RosterEntry &caster = save.partyMember(_slot);
+				caster._magicPoints = Data::toBcd(MIN(Data::fromBcd(caster._magicPoints) + CURE_REFUND, 99));
+				return true;
+			}
+
+			return (_effect == RESURRECT || _effect == RECALL) ? fail() : true;
+		}
+
+		return applyToPlayer(_players.slot());
+	}
+	}
+}
+
+} // namespace Interactions
+} // namespace Views
+} // namespace Ultima3
+} // namespace Ultima
diff --git a/engines/ultima/ultima3/views/interactions/cast_spell.h b/engines/ultima/ultima3/views/interactions/cast_spell.h
new file mode 100644
index 00000000000..024996504df
--- /dev/null
+++ b/engines/ultima/ultima3/views/interactions/cast_spell.h
@@ -0,0 +1,103 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef ULTIMA3_VIEWS_INTERACTIONS_CAST_SPELL_H
+#define ULTIMA3_VIEWS_INTERACTIONS_CAST_SPELL_H
+
+#include "ultima/ultima3/views/interactions/interaction.h"
+
+namespace Ultima {
+namespace Ultima3 {
+namespace Views {
+namespace Interactions {
+
+/**
+ * Has a party member cast a wizard or cleric spell, which costs magic points
+ * and may need a direction or a party member to aim it at
+ */
+class CastSpell : public Interaction {
+private:
+	enum Stage {
+		CHOOSE_CASTER,
+		CHOOSE_TYPE,
+		CHOOSE_SPELL,
+		DIRECTION,
+		TARGET
+	};
+
+	// The things the spells do
+	enum Effect {
+		SLAY_ORCS, MISSILE, LIGHT, DESCEND, ASCEND, FIREBALL, TELEPORT, MIND_BLAST,
+		GREAT_LIGHT, WIZARD_TO_CLERIC, FIRE_STORM, ANNIHILATE, HOLD_TIME, MIND_STORM,
+		DRAIN, DEATH_STORM, SLAY_SKELETONS, UNLOCK, HEAL_SMALL, RECALL_FLOOR,
+		CURE, LEAVE_DUNGEON, HEAL_LARGE, VISION, RESURRECT, RECALL
+	};
+
+	Stage _stage = CHOOSE_CASTER;
+	bool _inCombat;
+	bool _finished = false;
+	bool _cleric = false;
+	int _slot;
+	int _cost = 0;
+	Effect _effect = SLAY_ORCS;
+	int _amount = 0;
+	PlayerChooser _players;
+	DirectionChooser _directions;
+
+	/**
+	 * Gets going once a caster is known
+	 */
+	void begin();
+
+	/**
+	 * Carries out a spell that has been paid for
+	 * @returns		True if it is finished
+	 */
+	bool perform(Effect effect);
+
+	bool fail();
+	void fanfare();
+
+	/**
+	 * Carries out a spell on a party member chosen as its target
+	 */
+	bool applyToPlayer(int target);
+
+public:
+	/**
+	 * Constructor
+	 * @param slot		The party member casting, or -1 to ask who
+	 */
+	CastSpell(int slot = -1);
+
+	bool isFinished() const override {
+		return _finished;
+	}
+
+	bool keypress(const KeypressMessage &msg) override;
+};
+
+} // namespace Interactions
+} // namespace Views
+} // namespace Ultima3
+} // namespace Ultima
+
+#endif
diff --git a/engines/ultima/ultima3/views/interactions/interaction.h b/engines/ultima/ultima3/views/interactions/interaction.h
index aee8b71d5c8..14ce1b52cc6 100644
--- a/engines/ultima/ultima3/views/interactions/interaction.h
+++ b/engines/ultima/ultima3/views/interactions/interaction.h
@@ -41,6 +41,13 @@ class Interaction {
 public:
 	virtual ~Interaction() {}
 
+	/**
+	 * Returns true if the command was over as soon as it was started
+	 */
+	virtual bool isFinished() const {
+		return false;
+	}
+
 	/**
 	 * Handles a keypress
 	 * @returns		True once the command is finished
diff --git a/engines/ultima/ultima3/views/interactions/negate_time.cpp b/engines/ultima/ultima3/views/interactions/negate_time.cpp
new file mode 100644
index 00000000000..8ccdf434fa9
--- /dev/null
+++ b/engines/ultima/ultima3/views/interactions/negate_time.cpp
@@ -0,0 +1,55 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "ultima/ultima3/views/interactions/negate_time.h"
+#include "ultima/ultima3/data/data.h"
+#include "ultima/ultima3/ultima3.h"
+
+namespace Ultima {
+namespace Ultima3 {
+namespace Views {
+namespace Interactions {
+
+constexpr int HOLD_TURNS = 10;
+
+bool NegateTime::keypress(const KeypressMessage &msg) {
+	PlayerChooser::Result result = _chooser.handleKey(msg);
+	if (result == PlayerChooser::PENDING)
+		return false;
+	if (result == PlayerChooser::CANCELLED)
+		return true;
+
+	Data::RosterEntry &e = _G(savegame).partyMember(_chooser.slot());
+	if (e._powder == 0) {
+		_G(messages).print("None Left!\n");
+		g_engine->playSoundEffect(0xFE);
+		return true;
+	}
+
+	e._powder = Data::toBcd(Data::fromBcd(e._powder) - 1);
+	_G(holdTime) = HOLD_TURNS;
+	return true;
+}
+
+} // namespace Interactions
+} // namespace Views
+} // namespace Ultima3
+} // namespace Ultima
diff --git a/engines/ultima/ultima3/views/interactions/negate_time.h b/engines/ultima/ultima3/views/interactions/negate_time.h
new file mode 100644
index 00000000000..9d219625c6f
--- /dev/null
+++ b/engines/ultima/ultima3/views/interactions/negate_time.h
@@ -0,0 +1,48 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef ULTIMA3_VIEWS_INTERACTIONS_NEGATE_TIME_H
+#define ULTIMA3_VIEWS_INTERACTIONS_NEGATE_TIME_H
+
+#include "ultima/ultima3/views/interactions/interaction.h"
+
+namespace Ultima {
+namespace Ultima3 {
+namespace Views {
+namespace Interactions {
+
+/**
+ * Has a party member use a powder to hold time still for a while
+ */
+class NegateTime : public Interaction {
+private:
+	PlayerChooser _chooser;
+
+public:
+	bool keypress(const KeypressMessage &msg) override;
+};
+
+} // namespace Interactions
+} // namespace Views
+} // namespace Ultima3
+} // namespace Ultima
+
+#endif
diff --git a/engines/ultima/ultima3/views/location_map.cpp b/engines/ultima/ultima3/views/location_map.cpp
index 4d626d49bab..f936662176c 100644
--- a/engines/ultima/ultima3/views/location_map.cpp
+++ b/engines/ultima/ultima3/views/location_map.cpp
@@ -21,7 +21,9 @@
 
 #include "ultima/ultima3/views/location_map.h"
 #include "ultima/ultima3/views/menu_input.h"
+#include "ultima/ultima3/views/interactions/cast_spell.h"
 #include "ultima/ultima3/views/interactions/get_chest.h"
+#include "ultima/ultima3/views/interactions/negate_time.h"
 #include "ultima/ultima3/views/interactions/look.h"
 #include "ultima/ultima3/views/interactions/steal_chest.h"
 #include "ultima/ultima3/views/interactions/transact.h"
@@ -331,6 +333,14 @@ bool LocationMap::handleCommand(const KeypressMessage &msg) {
 		_G(messages).print("Steal Chest!\nPlayer? ");
 		startInteraction(new Interactions::StealChest());
 		return true;
+	case 'C':
+		_G(messages).print("Cast by whom-");
+		startInteraction(new Interactions::CastSpell());
+		return true;
+	case 'N':
+		_G(messages).print("Negate Time!\nWhose Powd? ");
+		startInteraction(new Interactions::NegateTime());
+		return true;
 	case 'T':
 		_G(messages).print("Who will\nTransact? ");
 		startInteraction(new Interactions::Transact());


Commit: e355366f2b61a4748e9e11899dd36fe07372f607
    https://github.com/scummvm/scummvm/commit/e355366f2b61a4748e9e11899dd36fe07372f607
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:41:01+11:00

Commit Message:
ULTIMA: ULTIMA3: Add dungeons with their first person view

Changed paths:
  A engines/ultima/ultima3/data/dungeon.cpp
  A engines/ultima/ultima3/data/dungeon.h
  A engines/ultima/ultima3/gfx/dungeon_view.cpp
  A engines/ultima/ultima3/gfx/dungeon_view.h
  A engines/ultima/ultima3/logic/dungeon_logic.cpp
  A engines/ultima/ultima3/logic/dungeon_logic.h
  A engines/ultima/ultima3/views/dungeon_map.cpp
  A engines/ultima/ultima3/views/dungeon_map.h
  A engines/ultima/ultima3/views/interactions/dungeon_special.cpp
  A engines/ultima/ultima3/views/interactions/dungeon_special.h
  A engines/ultima/ultima3/views/interactions/ignite_torch.cpp
  A engines/ultima/ultima3/views/interactions/ignite_torch.h
    engines/ultima/module.mk
    engines/ultima/ultima3/data/savegame.cpp
    engines/ultima/ultima3/data/savegame.h
    engines/ultima/ultima3/logic/chest_logic.cpp
    engines/ultima/ultima3/logic/chest_logic.h
    engines/ultima/ultima3/logic/combat_logic.cpp
    engines/ultima/ultima3/logic/combat_logic.h
    engines/ultima/ultima3/logic/location_logic.cpp
    engines/ultima/ultima3/ultima3.cpp
    engines/ultima/ultima3/ultima3.h
    engines/ultima/ultima3/views/form_party.cpp
    engines/ultima/ultima3/views/game.cpp
    engines/ultima/ultima3/views/game.h
    engines/ultima/ultima3/views/interactions/cast_spell.cpp
    engines/ultima/ultima3/views/interactions/get_chest.cpp
    engines/ultima/ultima3/views/location_map.cpp
    engines/ultima/ultima3/views/main_menu.cpp
    engines/ultima/ultima3/views/views.h


diff --git a/engines/ultima/module.mk b/engines/ultima/module.mk
index 5d327ad2238..79bb0527aa4 100644
--- a/engines/ultima/module.mk
+++ b/engines/ultima/module.mk
@@ -165,29 +165,35 @@ MODULE_OBJS += \
 	ultima3/metaengine.o \
 	ultima3/data/arena.o \
 	ultima3/data/data.o \
+	ultima3/data/dungeon.o \
 	ultima3/data/map.o \
 	ultima3/data/roster.o \
 	ultima3/data/savegame.o \
 	ultima3/gfx/charset.o \
+	ultima3/gfx/dungeon_view.o \
 	ultima3/gfx/message_log.o \
 	ultima3/gfx/pic_decoder.o \
 	ultima3/gfx/shapes.o \
 	ultima3/logic/chest_logic.o \
 	ultima3/logic/combat_logic.o \
 	ultima3/logic/creature_logic.o \
+	ultima3/logic/dungeon_logic.o \
 	ultima3/logic/location_logic.o \
 	ultima3/logic/logic.o \
 	ultima3/views/character_details.o \
 	ultima3/views/combat_map.o \
 	ultima3/views/create_character.o \
 	ultima3/views/disperse_party.o \
+	ultima3/views/dungeon_map.o \
 	ultima3/views/form_party.o \
 	ultima3/views/game.o \
 	ultima3/views/interactions/cast_spell.o \
 	ultima3/views/interactions/combat_attack.o \
+	ultima3/views/interactions/dungeon_special.o \
 	ultima3/views/interactions/equip.o \
 	ultima3/views/interactions/exchange.o \
 	ultima3/views/interactions/get_chest.o \
+	ultima3/views/interactions/ignite_torch.o \
 	ultima3/views/interactions/interaction.o \
 	ultima3/views/interactions/log_input.o \
 	ultima3/views/interactions/look.o \
diff --git a/engines/ultima/ultima3/data/dungeon.cpp b/engines/ultima/ultima3/data/dungeon.cpp
new file mode 100644
index 00000000000..2950ec8b91d
--- /dev/null
+++ b/engines/ultima/ultima3/data/dungeon.cpp
@@ -0,0 +1,47 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "common/file.h"
+#include "ultima/ultima3/data/dungeon.h"
+
+namespace Ultima {
+namespace Ultima3 {
+namespace Data {
+
+void Dungeon::load(const char *filename) {
+	Common::File f;
+	if (!f.open(filename))
+		error("Could not load %s", filename);
+
+	Common::Serializer s(&f, nullptr);
+	synchronize(s);
+	if (f.err() || f.eos())
+		error("Could not load %s", filename);
+}
+
+void Dungeon::synchronize(Common::Serializer &s) {
+	s.syncBytes(_tiles, sizeof(_tiles));
+	s.syncBytes(_signs, sizeof(_signs));
+}
+
+} // namespace Data
+} // namespace Ultima3
+} // namespace Ultima
diff --git a/engines/ultima/ultima3/data/dungeon.h b/engines/ultima/ultima3/data/dungeon.h
new file mode 100644
index 00000000000..90dce836340
--- /dev/null
+++ b/engines/ultima/ultima3/data/dungeon.h
@@ -0,0 +1,84 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef ULTIMA3_DATA_DUNGEON_H
+#define ULTIMA3_DATA_DUNGEON_H
+
+#include "common/scummsys.h"
+#include "common/serializer.h"
+
+namespace Ultima {
+namespace Ultima3 {
+namespace Data {
+
+constexpr int DUNGEON_LEVELS = 8;
+constexpr int DUNGEON_SIZE = 16;
+
+// Kinds of dungeon square, held in the low bits of a tile
+constexpr byte DTILE_TIME_LORD = 1;
+constexpr byte DTILE_FOUNTAIN = 2;
+constexpr byte DTILE_WIND = 3;
+constexpr byte DTILE_TRAP = 4;
+constexpr byte DTILE_MARK = 5;
+constexpr byte DTILE_GREMLINS = 6;
+
+// Flags in the bits above those
+constexpr byte DTILE_LADDER_UP = 0x10;
+constexpr byte DTILE_LADDER_DOWN = 0x20;
+constexpr byte DTILE_CHEST = 0x40;
+constexpr byte DTILE_WALL = 0x80;
+constexpr byte DTILE_DOOR = 0xC0;
+
+/**
+ * A dungeon: eight levels of 16x16 squares, and the signs that are on them
+ */
+class Dungeon {
+private:
+	static const int SIGNS_SIZE = 0x90;
+
+	byte _tiles[DUNGEON_LEVELS * DUNGEON_SIZE * DUNGEON_SIZE] = {};
+	byte _signs[SIGNS_SIZE] = {};
+
+public:
+	/**
+	 * Loads a dungeon from a .ULT file
+	 */
+	void load(const char *filename);
+
+	void synchronize(Common::Serializer &s);
+
+	/**
+	 * Returns a square. The coordinates wrap around the level
+	 */
+	byte tile(int level, int x, int y) const {
+		return _tiles[(level << 8) + ((y & (DUNGEON_SIZE - 1)) << 4) + (x & (DUNGEON_SIZE - 1))];
+	}
+
+	void setTile(int level, int x, int y, byte value) {
+		_tiles[(level << 8) + ((y & (DUNGEON_SIZE - 1)) << 4) + (x & (DUNGEON_SIZE - 1))] = value;
+	}
+};
+
+} // namespace Data
+} // namespace Ultima3
+} // namespace Ultima
+
+#endif
diff --git a/engines/ultima/ultima3/data/savegame.cpp b/engines/ultima/ultima3/data/savegame.cpp
index a286bc1a8fe..5e210470c70 100644
--- a/engines/ultima/ultima3/data/savegame.cpp
+++ b/engines/ultima/ultima3/data/savegame.cpp
@@ -81,6 +81,11 @@ void Savegame::synchronize(Common::Serializer &s) {
 
 	if (s.getVersion() >= 4)
 		s.syncAsByte(_lightTurns);
+
+	if (s.getVersion() >= 5) {
+		s.syncAsByte(_dungeonLevel);
+		s.syncAsByte(_facing);
+	}
 }
 
 void Savegame::formParty() {
@@ -88,6 +93,8 @@ void Savegame::formParty() {
 	_location = LOCATION_SOSARIA;
 	_posX = START_X;
 	_posY = START_Y;
+	_dungeonLevel = 0;
+	_lightTurns = 0;
 }
 
 } // namespace Data
diff --git a/engines/ultima/ultima3/data/savegame.h b/engines/ultima/ultima3/data/savegame.h
index c056d6c3495..db04e7234cd 100644
--- a/engines/ultima/ultima3/data/savegame.h
+++ b/engines/ultima/ultima3/data/savegame.h
@@ -55,6 +55,10 @@ struct Savegame {
 	// How much longer a light spell or torch lasts
 	byte _lightTurns = 0;
 
+	// Where in a dungeon the party is, the level and the way they face
+	byte _dungeonLevel = 0;
+	byte _facing = 0;
+
 	// Set once the party has seen the more powerful gear offered in the
 	// shops, making it available for readying and wearing
 	bool _allWeapons = false;
diff --git a/engines/ultima/ultima3/gfx/dungeon_view.cpp b/engines/ultima/ultima3/gfx/dungeon_view.cpp
new file mode 100644
index 00000000000..66a02819ed8
--- /dev/null
+++ b/engines/ultima/ultima3/gfx/dungeon_view.cpp
@@ -0,0 +1,380 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "common/util.h"
+#include "ultima/ultima3/gfx/dungeon_view.h"
+
+namespace Ultima {
+namespace Ultima3 {
+namespace Gfx {
+
+// How far sideways each of the places in view is from the party, before the facing is applied
+static const byte CELL_DX[32] = {
+	0x00, 0xFF, 0x01, 0xFF, 0x00, 0x01, 0xFE, 0xFF,
+	0x01, 0x02, 0xFE, 0xFF, 0x00, 0x01, 0x02, 0xFD,
+	0xFE, 0xFF, 0x01, 0x02, 0x03, 0xFD, 0xFE, 0xFF,
+	0x00, 0x01, 0x02, 0x03, 0xFE, 0xFF, 0x01, 0x02
+};
+
+// How far ahead each place in view is
+static const byte CELL_DY[32] = {
+	0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+	0xFF, 0xFF, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE,
+	0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFD, 0xFD, 0xFD,
+	0xFD, 0xFD, 0xFD, 0xFD, 0xFD, 0xFD, 0xFD, 0xFD
+};
+
+// Where the lines of a ladder hole are drawn for each place
+static const byte LADDERS[21][8] = {
+	{ 0x30, 0x50, 0x10, 0x10, 0x20, 0x34, 0x4C, 0x60 },
+	{ 0x00, 0x10, 0x00, 0x10, 0x20, 0x34, 0x4C, 0x60 },
+	{ 0x70, 0x80, 0x10, 0x00, 0x20, 0x34, 0x4C, 0x60 },
+	{ 0x18, 0x20, 0x28, 0x00, 0x30, 0x3A, 0x46, 0x50 },
+	{ 0x38, 0x48, 0x28, 0x28, 0x30, 0x3A, 0x46, 0x50 },
+	{ 0x60, 0x68, 0x00, 0x28, 0x30, 0x3A, 0x46, 0x50 },
+	{ 0x00, 0x08, 0x00, 0x28, 0x30, 0x3A, 0x46, 0x50 },
+	{ 0x20, 0x28, 0x00, 0x28, 0x30, 0x3A, 0x46, 0x50 },
+	{ 0x58, 0x60, 0x28, 0x00, 0x30, 0x3A, 0x46, 0x50 },
+	{ 0x78, 0x80, 0x28, 0x00, 0x30, 0x3A, 0x46, 0x50 },
+	{ 0x1C, 0x20, 0x34, 0x00, 0x38, 0x3D, 0x42, 0x48 },
+	{ 0x2C, 0x30, 0x34, 0x00, 0x38, 0x3D, 0x42, 0x48 },
+	{ 0x3C, 0x44, 0x34, 0x34, 0x38, 0x3D, 0x42, 0x48 },
+	{ 0x50, 0x54, 0x00, 0x34, 0x38, 0x3D, 0x42, 0x48 },
+	{ 0x60, 0x64, 0x00, 0x34, 0x38, 0x3D, 0x42, 0x48 },
+	{ 0x00, 0x04, 0x00, 0x34, 0x38, 0x3D, 0x42, 0x48 },
+	{ 0x20, 0x24, 0x00, 0x34, 0x38, 0x3D, 0x42, 0x48 },
+	{ 0x30, 0x34, 0x00, 0x34, 0x38, 0x3D, 0x42, 0x48 },
+	{ 0x4C, 0x50, 0x34, 0x00, 0x38, 0x3D, 0x42, 0x48 },
+	{ 0x5C, 0x60, 0x34, 0x00, 0x38, 0x3D, 0x42, 0x48 },
+	{ 0x7C, 0x80, 0x34, 0x00, 0x38, 0x3D, 0x42, 0x48 }
+};
+
+// The extent of a chest drawn in each place
+static const byte CHESTS[21][4] = {
+	{ 0x30, 0x50, 0x68, 0x78 },
+	{ 0x00, 0x10, 0x68, 0x78 },
+	{ 0x70, 0x80, 0x68, 0x78 },
+	{ 0x18, 0x20, 0x54, 0x5C },
+	{ 0x38, 0x48, 0x54, 0x5C },
+	{ 0x60, 0x68, 0x54, 0x5C },
+	{ 0x00, 0x08, 0x54, 0x5C },
+	{ 0x20, 0x28, 0x54, 0x5C },
+	{ 0x58, 0x60, 0x54, 0x5C },
+	{ 0x78, 0x80, 0x54, 0x5C },
+	{ 0x1C, 0x20, 0x4A, 0x4E },
+	{ 0x2C, 0x30, 0x4A, 0x4E },
+	{ 0x3C, 0x44, 0x4A, 0x4E },
+	{ 0x50, 0x54, 0x4A, 0x4E },
+	{ 0x60, 0x64, 0x4A, 0x4E },
+	{ 0x0C, 0x14, 0x4A, 0x4E },
+	{ 0x20, 0x24, 0x4A, 0x4E },
+	{ 0x30, 0x34, 0x4A, 0x4E },
+	{ 0x4C, 0x50, 0x4A, 0x4E },
+	{ 0x5C, 0x60, 0x4A, 0x4E },
+	{ 0x6C, 0x74, 0x4A, 0x4E }
+};
+
+// The wall faces seen from each place, the second half being the parts cut away by doors
+static const byte WALLS[64][8] = {
+	{ 0x00, 0x00, 0x80, 0x02, 0xFF, 0xFF, 0x41, 0x00 },
+	{ 0x01, 0x00, 0x80, 0x02, 0x01, 0x01, 0x10, 0x00 },
+	{ 0x7F, 0x00, 0x80, 0xFE, 0x01, 0x01, 0x10, 0x00 },
+	{ 0x00, 0x20, 0x60, 0x02, 0xFF, 0xFF, 0x10, 0x00 },
+	{ 0x20, 0x20, 0x60, 0x02, 0xFF, 0xFF, 0x21, 0x00 },
+	{ 0x80, 0x20, 0x60, 0xFE, 0xFF, 0xFF, 0x10, 0x00 },
+	{ 0x01, 0x20, 0x60, 0x02, 0x02, 0x02, 0x10, 0x00 },
+	{ 0x21, 0x20, 0x60, 0x02, 0x01, 0x01, 0x08, 0x00 },
+	{ 0x5F, 0x20, 0x60, 0xFE, 0x01, 0x01, 0x08, 0x00 },
+	{ 0x7F, 0x20, 0x60, 0xFE, 0x02, 0x02, 0x10, 0x00 },
+	{ 0x00, 0x30, 0x50, 0x02, 0xFF, 0xFF, 0x10, 0x00 },
+	{ 0x20, 0x30, 0x50, 0x02, 0xFF, 0xFF, 0x08, 0x00 },
+	{ 0x30, 0x30, 0x50, 0x02, 0xFF, 0xFF, 0x11, 0x00 },
+	{ 0x60, 0x30, 0x50, 0xFE, 0xFF, 0xFF, 0x08, 0x00 },
+	{ 0x80, 0x30, 0x50, 0xFE, 0xFF, 0xFF, 0x10, 0x00 },
+	{ 0x01, 0x30, 0x50, 0x02, 0x04, 0x04, 0x10, 0x00 },
+	{ 0x21, 0x30, 0x50, 0x02, 0x02, 0x02, 0x08, 0x00 },
+	{ 0x31, 0x30, 0x50, 0x02, 0x01, 0x01, 0x04, 0x00 },
+	{ 0x4F, 0x30, 0x50, 0xFE, 0x01, 0x01, 0x04, 0x00 },
+	{ 0x5F, 0x30, 0x50, 0xFE, 0x02, 0x02, 0x08, 0x00 },
+	{ 0x7F, 0x30, 0x50, 0xFE, 0x04, 0x04, 0x10, 0x00 },
+	{ 0x00, 0x38, 0x48, 0x02, 0xFF, 0xFF, 0x10, 0x00 },
+	{ 0x20, 0x38, 0x48, 0x02, 0xFF, 0xFF, 0x08, 0x00 },
+	{ 0x30, 0x38, 0x48, 0x02, 0xFF, 0xFF, 0x04, 0x00 },
+	{ 0x38, 0x38, 0x48, 0x02, 0xFF, 0xFF, 0x09, 0x00 },
+	{ 0x50, 0x38, 0x48, 0xFE, 0xFF, 0xFF, 0x04, 0x00 },
+	{ 0x60, 0x38, 0x48, 0xFE, 0xFF, 0xFF, 0x08, 0x00 },
+	{ 0x80, 0x38, 0x48, 0xFE, 0xFF, 0xFF, 0x10, 0x00 },
+	{ 0x31, 0x38, 0x48, 0x02, 0x02, 0x02, 0x04, 0x00 },
+	{ 0x39, 0x38, 0x48, 0x02, 0x01, 0x01, 0x04, 0x00 },
+	{ 0x47, 0x38, 0x48, 0xFE, 0x01, 0x01, 0x04, 0x00 },
+	{ 0x4F, 0x38, 0x48, 0xFE, 0x02, 0x02, 0x04, 0x00 },
+	{ 0x20, 0x20, 0x80, 0x02, 0xFF, 0xFF, 0x21, 0x00 },
+	{ 0x02, 0x20, 0x80, 0x02, 0x02, 0x01, 0x08, 0x00 },
+	{ 0x7E, 0x20, 0x80, 0xFE, 0x02, 0x01, 0x08, 0x00 },
+	{ 0x01, 0x30, 0x60, 0x02, 0xFF, 0xFF, 0x08, 0x00 },
+	{ 0x31, 0x30, 0x60, 0x02, 0xFF, 0xFF, 0x10, 0x00 },
+	{ 0x7F, 0x30, 0x60, 0xFE, 0xFF, 0xFF, 0x08, 0x00 },
+	{ 0x0C, 0x2E, 0x5B, 0x02, 0x04, 0x02, 0x06, 0x00 },
+	{ 0x26, 0x2E, 0x5B, 0x02, 0x02, 0x01, 0x03, 0x00 },
+	{ 0x5A, 0x2E, 0x5B, 0xFE, 0x02, 0x01, 0x03, 0x00 },
+	{ 0x74, 0x2E, 0x5B, 0xFE, 0x04, 0x02, 0x06, 0x00 },
+	{ 0x11, 0x38, 0x50, 0x02, 0xFF, 0xFF, 0x05, 0x00 },
+	{ 0x23, 0x38, 0x50, 0x02, 0xFF, 0xFF, 0x05, 0x00 },
+	{ 0x3B, 0x38, 0x50, 0x02, 0xFF, 0xFF, 0x06, 0x00 },
+	{ 0x5D, 0x38, 0x50, 0xFE, 0xFF, 0xFF, 0x05, 0x00 },
+	{ 0x6F, 0x38, 0x50, 0xFE, 0xFF, 0xFF, 0x05, 0x00 },
+	{ 0x0E, 0x36, 0x4D, 0x02, 0x08, 0x04, 0x04, 0x00 },
+	{ 0x26, 0x36, 0x4D, 0x02, 0x04, 0x02, 0x02, 0x00 },
+	{ 0x34, 0x36, 0x4D, 0x02, 0x02, 0x01, 0x01, 0x00 },
+	{ 0x4C, 0x36, 0x4D, 0xFE, 0x02, 0x01, 0x01, 0x00 },
+	{ 0x5A, 0x36, 0x4D, 0xFE, 0x04, 0x02, 0x02, 0x00 },
+	{ 0x72, 0x36, 0x4D, 0xFE, 0x08, 0x04, 0x04, 0x00 },
+	{ 0x11, 0x3C, 0x48, 0x02, 0xFF, 0xFF, 0x03, 0x00 },
+	{ 0x25, 0x3C, 0x48, 0x02, 0xFF, 0xFF, 0x03, 0x00 },
+	{ 0x33, 0x3C, 0x48, 0x02, 0xFF, 0xFF, 0x03, 0x00 },
+	{ 0x3D, 0x3C, 0x48, 0x02, 0xFF, 0xFF, 0x04, 0x00 },
+	{ 0x4D, 0x3C, 0x48, 0xFE, 0xFF, 0xFF, 0x03, 0x00 },
+	{ 0x5B, 0x3C, 0x48, 0xFE, 0xFF, 0xFF, 0x03, 0x00 },
+	{ 0x7F, 0x3C, 0x48, 0xFE, 0xFF, 0xFF, 0x03, 0x00 },
+	{ 0x34, 0x3F, 0x46, 0x02, 0x01, 0x02, 0x01, 0x00 },
+	{ 0x3C, 0x3F, 0x46, 0x02, 0x01, 0x01, 0x01, 0x00 },
+	{ 0x44, 0x3F, 0x46, 0xFE, 0x01, 0x01, 0x01, 0x00 },
+	{ 0x4C, 0x3F, 0x46, 0xFE, 0x01, 0x02, 0x01, 0x00 }
+};
+
+constexpr int LADDER_PLACES = 21;
+constexpr int MIDDLE = 0x40;
+constexpr int DOOR_CUTOUT = 0x20;
+
+void DungeonView::plot(int x, int y) {
+	x = (byte)(x + OFFSET);
+	y = (byte)(y + OFFSET);
+
+	if (y < HEIGHT)
+		_pixels[y * WIDTH + x] = 3;
+}
+
+void DungeonView::column(int x, int top, int bottom, bool erase) {
+	x = (byte)(x + OFFSET);
+	int height = (byte)(bottom - top);
+
+	// Hatched walls are made of columns of pixels, which this fills in or clears
+	for (int y = (byte)top + OFFSET; height > 0 && y < HEIGHT; ++y, --height)
+		_pixels[y * WIDTH + x] = erase ? 0 : 3;
+}
+
+void DungeonView::line(int x0, int y0, int x1, int y1) {
+	int dx = ABS(x1 - x0), dy = ABS(y1 - y0);
+	int stepX = (x1 < x0) ? -1 : 1;
+	int stepY = (y1 < y0) ? -1 : 1;
+	int x = x0, y = y0;
+
+	if (dx >= dy) {
+		int error = dx / 2;
+
+		for (int count = dx; count > 0; --count) {
+			error += dy;
+			if (error >= dx) {
+				error -= dx;
+				y += stepY;
+			}
+
+			x += stepX;
+			plot(x, y);
+		}
+	} else {
+		int error = dy / 2;
+
+		for (int count = dy; count > 0; --count) {
+			error += dx;
+			if (error >= dy) {
+				error -= dy;
+				x += stepX;
+			}
+
+			y += stepY;
+			plot(x, y);
+		}
+	}
+}
+
+void DungeonView::drawWall(int face) {
+	const byte *rec = WALLS[face];
+	int x = rec[0], top = rec[1], bottom = rec[2];
+	const int8 stepX = (int8)rec[3];
+	const bool erase = face == DOOR_CUTOUT;
+
+	// The slope of each edge is a number of columns for every row it drops
+	int topCount = rec[4], bottomCount = rec[5];
+	int columns = rec[6];
+
+	// Walls seen side-on are shifted a column so their hatching lines up
+	if (_facing & 1)
+		x = (byte)(x + 1);
+
+	auto slope = [&]() {
+		topCount = (byte)(topCount - 1);
+		if (topCount == 0) {
+			topCount = rec[4];
+			top = (byte)(top + 1);
+		}
+
+		bottomCount = (byte)(bottomCount - 1);
+		if (bottomCount == 0) {
+			bottomCount = rec[5];
+			bottom = (byte)(bottom - 1);
+		}
+	};
+
+	for (;;) {
+		column(x, top, bottom, erase);
+		if (--columns == 0)
+			break;
+
+		x = (byte)(x + stepX);
+		slope();
+		if (stepX != 1)
+			slope();
+	}
+}
+
+void DungeonView::drawLadder(bool down, int place) {
+	if (place >= LADDER_PLACES)
+		return;
+
+	const byte *rec = LADDERS[place];
+	if (rec[0] & 0x80)
+		return;
+
+	// A ladder going down is seen from the other side, so upside down
+	auto at = [&](int value) { return down ? 0x7F - value : value; };
+
+	int left = rec[0], right = rec[1];
+
+	if (rec[2] != 0) {
+		line(left, at(rec[2]), left, MIDDLE);
+		line(left + 1, at(rec[2]), left + 1, MIDDLE);
+	}
+	if (rec[3] != 0) {
+		line(right, at(rec[3]), right, MIDDLE);
+		line(right - 1, at(rec[3]), right - 1, MIDDLE);
+	}
+
+	line(left, at(rec[4]), right, at(rec[4]));
+	line(left, at(rec[5]), right, at(rec[5]));
+}
+
+void DungeonView::drawChest(int place) {
+	if (place >= LADDER_PLACES)
+		return;
+
+	const byte *rec = CHESTS[place];
+	if (rec[0] & 0x80)
+		return;
+
+	int x = rec[0];
+	do {
+		column(x, rec[2], rec[3], false);
+		++x;
+	} while (x < rec[1]);
+}
+
+DungeonView::Sight DungeonView::look(const Data::Dungeon &dungeon, int level, int x, int y, int place) {
+	int dx = (int8)CELL_DX[place], dy = (int8)CELL_DY[place];
+
+	// The places are laid out for looking north, so turn them to match
+	for (int turns = _facing; turns > 0; --turns) {
+		SWAP(dx, dy);
+		dx = -dx;
+	}
+
+	byte tile = dungeon.tile(level, x + dx, y + dy);
+
+	if (!(tile & Data::DTILE_WALL)) {
+		if (tile & Data::DTILE_LADDER_UP)
+			drawLadder(false, place);
+		if (tile & Data::DTILE_LADDER_DOWN)
+			drawLadder(true, place);
+		if (tile & Data::DTILE_CHEST)
+			drawChest(place);
+		return OPEN;
+	}
+
+	drawWall(place);
+	if (tile < Data::DTILE_DOOR)
+		return WALL;
+
+	// A door has the opening cut out of the wall
+	drawWall(place + DOOR_CUTOUT);
+	return place == 0 ? DOOR : WALL;
+}
+
+void DungeonView::lookAlong(const Data::Dungeon &dungeon, int level, int x, int y, const byte *places, int count) {
+	for (int i = 0; i < count; ++i) {
+		if (look(dungeon, level, x, y, places[i]) == WALL)
+			return;
+	}
+}
+
+void DungeonView::draw(const Data::Dungeon &dungeon, int level, int x, int y, int facing) {
+	static const byte LEFT_A[] = { 1, 3, 6, 10, 15, 21 };
+	static const byte RIGHT_A[] = { 2, 5, 9, 14, 20, 27 };
+	static const byte LEFT_B[] = { 7, 11, 16, 22 };
+	static const byte RIGHT_B[] = { 8, 13, 19, 26 };
+	static const byte LEFT_C[] = { 17, 23, 28 };
+	static const byte RIGHT_C[] = { 18, 25, 31 };
+
+	memset(_pixels, 0, sizeof(_pixels));
+	_facing = facing;
+
+	// Working outwards from the party's own square, each line of sight is
+	// followed until it meets a wall
+	Sight here = look(dungeon, level, x, y, 0);
+	if (here == WALL)
+		return;
+
+	if (here == OPEN) {
+		lookAlong(dungeon, level, x, y, LEFT_A, ARRAYSIZE(LEFT_A));
+		lookAlong(dungeon, level, x, y, RIGHT_A, ARRAYSIZE(RIGHT_A));
+	}
+
+	if (look(dungeon, level, x, y, 4) != OPEN)
+		return;
+
+	lookAlong(dungeon, level, x, y, LEFT_B, ARRAYSIZE(LEFT_B));
+	lookAlong(dungeon, level, x, y, RIGHT_B, ARRAYSIZE(RIGHT_B));
+
+	if (look(dungeon, level, x, y, 12) != OPEN)
+		return;
+
+	lookAlong(dungeon, level, x, y, LEFT_C, ARRAYSIZE(LEFT_C));
+	lookAlong(dungeon, level, x, y, RIGHT_C, ARRAYSIZE(RIGHT_C));
+
+	if (look(dungeon, level, x, y, 24) == WALL)
+		return;
+
+	look(dungeon, level, x, y, 29);
+	look(dungeon, level, x, y, 30);
+}
+
+} // namespace Gfx
+} // namespace Ultima3
+} // namespace Ultima
diff --git a/engines/ultima/ultima3/gfx/dungeon_view.h b/engines/ultima/ultima3/gfx/dungeon_view.h
new file mode 100644
index 00000000000..2b78a10d46b
--- /dev/null
+++ b/engines/ultima/ultima3/gfx/dungeon_view.h
@@ -0,0 +1,93 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef ULTIMA3_GFX_DUNGEON_VIEW_H
+#define ULTIMA3_GFX_DUNGEON_VIEW_H
+
+#include "ultima/ultima3/data/dungeon.h"
+
+namespace Ultima {
+namespace Ultima3 {
+namespace Gfx {
+
+/**
+ * The first person view down the corridors of a dungeon: the walls, doors,
+ * ladders and chests in sight drawn as white lines
+ */
+class DungeonView {
+private:
+	// The picture is built a pixel at a time at the position it has on the
+	// screen, which leaves the view with a margin on all sides
+	static const int WIDTH = 256;
+	static const int HEIGHT = 200;
+	static const int OFFSET = 0x20;
+
+	byte _pixels[WIDTH * HEIGHT];
+	int _facing = 0;
+
+	enum Sight {
+		OPEN,
+		WALL,
+		DOOR
+	};
+
+	void plot(int x, int y);
+	void line(int x0, int y0, int x1, int y1);
+	void column(int x, int top, int bottom, bool erase);
+	void drawWall(int face);
+	void drawLadder(bool down, int place);
+	void drawChest(int place);
+
+	/**
+	 * Draws whatever is at a place in view, and says what kind of obstacle it is
+	 */
+	Sight look(const Data::Dungeon &dungeon, int level, int x, int y, int place);
+
+	/**
+	 * Looks at a series of places, going no further down the series once
+	 * something blocks the way
+	 */
+	void lookAlong(const Data::Dungeon &dungeon, int level, int x, int y, const byte *places, int count);
+
+public:
+	DungeonView() {
+		memset(_pixels, 0, sizeof(_pixels));
+	}
+
+	/**
+	 * Draws the view from a square in a direction, for later reading back
+	 */
+	void draw(const Data::Dungeon &dungeon, int level, int x, int y, int facing);
+
+	/**
+	 * Returns true if a pixel of the picture, whose position is that on the
+	 * screen, is lit
+	 */
+	bool isLit(int x, int y) const {
+		return _pixels[y * WIDTH + x] != 0;
+	}
+};
+
+} // namespace Gfx
+} // namespace Ultima3
+} // namespace Ultima
+
+#endif
diff --git a/engines/ultima/ultima3/logic/chest_logic.cpp b/engines/ultima/ultima3/logic/chest_logic.cpp
index 11817e31e08..495f39554f2 100644
--- a/engines/ultima/ultima3/logic/chest_logic.cpp
+++ b/engines/ultima/ultima3/logic/chest_logic.cpp
@@ -50,7 +50,7 @@ bool ChestLogic::evadesTrap(int slot) {
 	return rollBelow(255) < chance;
 }
 
-void ChestLogic::damageParty() {
+void ChestLogic::damageAll(int level) {
 	Data::Savegame &save = _G(savegame);
 
 	for (int slot = 0; slot < save._partySize; ++slot) {
@@ -61,7 +61,7 @@ void ChestLogic::damageParty() {
 		g_engine->playSoundEffect(0xF7);
 
 		damageCharacter(slot, Data::fromBcd(rollBelow(255) & 0x77));
-		damageCharacter(slot, Data::fromBcd(8));
+		damageCharacter(slot, Data::fromBcd(((level + 1) * 8) & 0xFF));
 	}
 }
 
@@ -150,7 +150,7 @@ void ChestLogic::open(int slot) {
 			}
 		}
 	} else {
-		damageParty();
+		damageAll(save._dungeonLevel);
 	}
 
 	loot(slot);
diff --git a/engines/ultima/ultima3/logic/chest_logic.h b/engines/ultima/ultima3/logic/chest_logic.h
index b9f63a657f4..c5fb3525a86 100644
--- a/engines/ultima/ultima3/logic/chest_logic.h
+++ b/engines/ultima/ultima3/logic/chest_logic.h
@@ -37,12 +37,13 @@ private:
 	 */
 	static int rollBelow(int limit);
 
+public:
 	/**
-	 * Hurts every member of the party who can still fight
+	 * Hurts every member of the party who can still fight, more so the
+	 * deeper in a dungeon they are
 	 */
-	void damageParty();
+	void damageAll(int level);
 
-public:
 	/**
 	 * Rolls to see whether a party member avoids a trap, which the
 	 * agile classes are better at
diff --git a/engines/ultima/ultima3/logic/combat_logic.cpp b/engines/ultima/ultima3/logic/combat_logic.cpp
index 552743116fe..bf7ad9921a5 100644
--- a/engines/ultima/ultima3/logic/combat_logic.cpp
+++ b/engines/ultima/ultima3/logic/combat_logic.cpp
@@ -182,6 +182,18 @@ void CombatLogic::begin(int creature) {
 	if (_monsterClass == MONSTER_PIRATE && save._transport != TRANSPORT_SHIP)
 		map.setCell(x, y, CELL_SHIP);
 
+	startFight();
+}
+
+void CombatLogic::beginDungeon(byte monsterClass) {
+	_monsterClass = monsterClass;
+	startFight();
+}
+
+void CombatLogic::startFight() {
+	Data::Savegame &save = _G(savegame);
+	Data::Creatures &c = _G(map)._creatures;
+
 	// Guards turn on the party
 	for (int i = 0; i < Data::CREATURE_COUNT; ++i) {
 		if (c._tile[i] == CELL_GUARD || c._tile[i] == CELL_ROYAL_GUARD)
diff --git a/engines/ultima/ultima3/logic/combat_logic.h b/engines/ultima/ultima3/logic/combat_logic.h
index 44555727e27..9c0669258de 100644
--- a/engines/ultima/ultima3/logic/combat_logic.h
+++ b/engines/ultima/ultima3/logic/combat_logic.h
@@ -93,6 +93,11 @@ private:
 	 */
 	Common::String monsterName(bool heading) const;
 
+	/**
+	 * Gets a fight ready once the kind of monster is known
+	 */
+	void startFight();
+
 	int monsterAt(int x, int y) const;
 	bool canMonsterMoveTo(int x, int y) const;
 
@@ -140,6 +145,12 @@ public:
 	 */
 	void begin(int creature);
 
+	/**
+	 * Starts a fight with monsters met in a dungeon
+	 * @param monsterClass		The tile number of the monsters
+	 */
+	void beginDungeon(byte monsterClass);
+
 	/**
 	 * Brings what's shown up to date with the fight
 	 */
diff --git a/engines/ultima/ultima3/logic/dungeon_logic.cpp b/engines/ultima/ultima3/logic/dungeon_logic.cpp
new file mode 100644
index 00000000000..1aa821912cc
--- /dev/null
+++ b/engines/ultima/ultima3/logic/dungeon_logic.cpp
@@ -0,0 +1,141 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "ultima/ultima3/logic/dungeon_logic.h"
+#include "ultima/ultima3/logic/location_logic.h"
+#include "ultima/ultima3/ultima3.h"
+
+namespace Ultima {
+namespace Ultima3 {
+
+constexpr int LAST_LEVEL = Data::DUNGEON_LEVELS - 1;
+constexpr byte TILE_BLOCKED = 0x80;
+constexpr byte TILE_NO_TURNING = 0xA0;
+constexpr byte FIRST_MONSTER = 0x18;
+constexpr int LAST_MONSTER_KIND = 6;
+
+// How far a step in each direction goes
+static const int FACING_DX[4] = { 0, 1, 0, -1 };
+static const int FACING_DY[4] = { -1, 0, 1, 0 };
+
+static int rollBelow(int limit) {
+	return Graphics::Views::g_events->getRandomNumber(limit - 1);
+}
+
+byte DungeonLogic::tile() const {
+	const Data::Savegame &save = _G(savegame);
+	return _G(dungeon).tile(save._dungeonLevel, save._posX, save._posY);
+}
+
+bool DungeonLogic::moveForward() {
+	Data::Savegame &save = _G(savegame);
+	int x = (save._posX + FACING_DX[save._facing]) & (Data::DUNGEON_SIZE - 1);
+	int y = (save._posY + FACING_DY[save._facing]) & (Data::DUNGEON_SIZE - 1);
+
+	// Only the plainest walls can't be walked through
+	if (_G(dungeon).tile(save._dungeonLevel, x, y) == TILE_BLOCKED)
+		return false;
+
+	save._posX = x;
+	save._posY = y;
+	return true;
+}
+
+bool DungeonLogic::moveBackward() {
+	Data::Savegame &save = _G(savegame);
+	int behind = (save._facing + 2) & 3;
+	int x = (save._posX + FACING_DX[behind]) & (Data::DUNGEON_SIZE - 1);
+	int y = (save._posY + FACING_DY[behind]) & (Data::DUNGEON_SIZE - 1);
+
+	if (_G(dungeon).tile(save._dungeonLevel, x, y) & TILE_BLOCKED)
+		return false;
+
+	save._posX = x;
+	save._posY = y;
+	return true;
+}
+
+bool DungeonLogic::turn(bool right) {
+	Data::Savegame &save = _G(savegame);
+	if (tile() >= TILE_NO_TURNING)
+		return false;
+
+	save._facing = (save._facing + (right ? 1 : 3)) & 3;
+	return true;
+}
+
+DungeonLogic::Ladder DungeonLogic::climb() {
+	Data::Savegame &save = _G(savegame);
+	if (!(tile() & Data::DTILE_LADDER_UP))
+		return LADDER_NONE;
+
+	if (save._dungeonLevel == 0) {
+		LocationLogic().exitToWorld();
+		return LADDER_OUT;
+	}
+
+	--save._dungeonLevel;
+	return LADDER_TAKEN;
+}
+
+bool DungeonLogic::descend() {
+	Data::Savegame &save = _G(savegame);
+	byte here = tile();
+
+	if ((here & TILE_BLOCKED) || !(here & Data::DTILE_LADDER_DOWN) || save._dungeonLevel >= LAST_LEVEL)
+		return false;
+
+	++save._dungeonLevel;
+	return true;
+}
+
+int DungeonLogic::rollEncounter() {
+	Data::Savegame &save = _G(savegame);
+	if (tile() != 0)
+		return -1;
+
+	// The deeper the party goes the likelier and fiercer the monsters
+	if (rollBelow(0x82 + save._dungeonLevel) < 0x80)
+		return -1;
+
+	int kind = MIN(rollBelow(save._dungeonLevel + 2), LAST_MONSTER_KIND);
+
+	// Where they were met is left as a chest
+	_G(dungeon).setTile(save._dungeonLevel, save._posX, save._posY, Data::DTILE_CHEST);
+	return FIRST_MONSTER + kind;
+}
+
+void DungeonLogic::teleportRandomly() {
+	Data::Savegame &save = _G(savegame);
+
+	for (;;) {
+		int x = rollBelow(Data::DUNGEON_SIZE), y = rollBelow(Data::DUNGEON_SIZE);
+
+		if (_G(dungeon).tile(save._dungeonLevel, x, y) == 0) {
+			save._posX = x;
+			save._posY = y;
+			return;
+		}
+	}
+}
+
+} // namespace Ultima3
+} // namespace Ultima
diff --git a/engines/ultima/ultima3/logic/dungeon_logic.h b/engines/ultima/ultima3/logic/dungeon_logic.h
new file mode 100644
index 00000000000..71834cb538f
--- /dev/null
+++ b/engines/ultima/ultima3/logic/dungeon_logic.h
@@ -0,0 +1,86 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef ULTIMA3_LOGIC_DUNGEON_LOGIC_H
+#define ULTIMA3_LOGIC_DUNGEON_LOGIC_H
+
+#include "ultima/ultima3/logic/logic.h"
+
+namespace Ultima {
+namespace Ultima3 {
+
+/**
+ * Rules for moving the party around a dungeon
+ */
+class DungeonLogic : public Logic {
+public:
+	enum Ladder {
+		LADDER_NONE,
+		LADDER_TAKEN,
+		LADDER_OUT
+	};
+
+	/**
+	 * Returns the square the party is on
+	 */
+	byte tile() const;
+
+	/**
+	 * Moves the party a step forward or backward, if they can
+	 * @returns		True if they moved
+	 */
+	bool moveForward();
+	bool moveBackward();
+
+	/**
+	 * Turns the party a quarter turn, if they can
+	 * @returns		True if they turned
+	 */
+	bool turn(bool right);
+
+	/**
+	 * Climbs up a ladder. If this was from the first level it takes the party
+	 * out of the dungeon
+	 */
+	Ladder climb();
+
+	/**
+	 * Goes down a ladder, if there's one
+	 * @returns		True if they did
+	 */
+	bool descend();
+
+	/**
+	 * Sometimes monsters are met on an empty square
+	 * @returns		The tile number of the monsters, or -1
+	 */
+	int rollEncounter();
+
+	/**
+	 * Moves the party to a random empty square on the level
+	 */
+	void teleportRandomly();
+};
+
+} // namespace Ultima3
+} // namespace Ultima
+
+#endif
diff --git a/engines/ultima/ultima3/logic/location_logic.cpp b/engines/ultima/ultima3/logic/location_logic.cpp
index 93cbf4b3bee..116210deffa 100644
--- a/engines/ultima/ultima3/logic/location_logic.cpp
+++ b/engines/ultima/ultima3/logic/location_logic.cpp
@@ -121,13 +121,19 @@ static const Entrance ENTRANCES[] = {
 	{ "BRITISH.ULT", 45, 18 }, { "EXODUS.ULT", 10, 53 }, { "LCB.ULT", 46, 19 },
 	{ "MOON.ULT", 6, 13 }, { "YEW.ULT", 34, 16 }, { "MONTOR_E.ULT", 49, 58 },
 	{ "MONTOR_W.ULT", 47, 58 }, { "GREY.ULT", 7, 44 }, { "DAWN.ULT", 37, 53 },
-	{ "DEVIL.ULT", 18, 31 }, { "FAWN.ULT", 30, 2 }, { "DEATH.ULT", 56, 31 }
+	{ "DEVIL.ULT", 18, 31 }, { "FAWN.ULT", 30, 2 }, { "DEATH.ULT", 56, 31 },
+	{ "M.ULT", 19, 57 }, { "FIRE.ULT", 49, 34 }, { "TIME.ULT", 58, 30 },
+	{ "P.ULT", 58, 44 }, { "PERINIAN.ULT", 56, 6 }, { "MINE.ULT", 9, 28 },
+	{ "DARDIN.ULT", 46, 7 }
 };
 
 constexpr byte TILE_TOWN = 6;
 constexpr byte TILE_CASTLE = 7;
+constexpr byte TILE_DUNGEON = 5;
 
 // Where the party starts out in each kind of location
+constexpr byte DUNGEON_START = 1;
+constexpr byte DUNGEON_START_FACING = 1;
 constexpr byte TOWN_START_X = 0x01;
 constexpr byte TOWN_START_Y = 0x20;
 constexpr byte CASTLE_START_X = 0x20;
@@ -145,12 +151,26 @@ const char *LocationLogic::enter() {
 	}
 
 	byte tile = _G(map).tile(save._posX, save._posY);
-	if (!entrance || (tile != TILE_TOWN && tile != TILE_CASTLE) || !Data::Map::exists(entrance->_filename))
+	if (!entrance || (tile != TILE_TOWN && tile != TILE_CASTLE && tile != TILE_DUNGEON) ||
+			!Data::Map::exists(entrance->_filename))
 		return nullptr;
 
-	_G(worldMap) = _G(map);
 	save._worldX = save._posX;
 	save._worldY = save._posY;
+
+	// Dungeons are entered at the top left, facing east
+	if (tile == TILE_DUNGEON) {
+		_G(dungeon).load(entrance->_filename);
+		save._location = Data::LOCATION_DUNGEON;
+		save._posX = DUNGEON_START;
+		save._posY = DUNGEON_START;
+		save._facing = DUNGEON_START_FACING;
+		save._dungeonLevel = 0;
+		save._lightTurns = 0;
+		return "Dungeon!\n";
+	}
+
+	_G(worldMap) = _G(map);
 	_G(map).load(entrance->_filename);
 
 	if (tile == TILE_TOWN) {
@@ -174,10 +194,16 @@ bool LocationLogic::isAtExit() const {
 void LocationLogic::exitToWorld() {
 	Data::Savegame &save = _G(savegame);
 
-	_G(map) = _G(worldMap);
+	_G(messages).print("Exit to Sosaria!\nPlease wait...\n");
+
+	// A dungeon is entered without the world map being put aside
+	if (save._location != Data::LOCATION_DUNGEON)
+		_G(map) = _G(worldMap);
+
 	save._location = Data::LOCATION_SOSARIA;
 	save._posX = save._worldX;
 	save._posY = save._worldY;
+	save._dungeonLevel = 0;
 }
 
 void LocationLogic::teleportRandomly() {
diff --git a/engines/ultima/ultima3/ultima3.cpp b/engines/ultima/ultima3/ultima3.cpp
index 719151e0ee9..01b7517577b 100644
--- a/engines/ultima/ultima3/ultima3.cpp
+++ b/engines/ultima/ultima3/ultima3.cpp
@@ -87,15 +87,18 @@ bool Ultima3Engine::canLoadGameStateCurrently(Common::U32String *msg) {
 }
 
 Common::Error Ultima3Engine::syncGame(Common::Serializer &s) {
-	s.syncVersion(4);
+	s.syncVersion(5);
 
 	_savegame.synchronize(s);
 	if (_savegame._mapLoaded) {
 		_map.synchronize(s);
 
 		// The world is kept aside while the party is in a town or castle
-		if (_savegame._location != Data::LOCATION_SOSARIA)
+		if (_savegame._location == Data::LOCATION_TOWN || _savegame._location == Data::LOCATION_CASTLE)
 			_worldMap.synchronize(s);
+
+		if (_savegame._location == Data::LOCATION_DUNGEON && s.getVersion() >= 5)
+			_dungeon.synchronize(s);
 	}
 
 	if (s.isLoading()) {
@@ -103,7 +106,7 @@ Common::Error Ultima3Engine::syncGame(Common::Serializer &s) {
 		// otherwise return to where the party can be organized
 		_resumeGame = _savegame._mapLoaded && _savegame._partySize > 0 &&
 			_savegame.hasLivingPartyMember();
-		replaceView(_resumeGame ? "LocationMap" : "LogoScreen", true);
+		replaceView(_resumeGame ? gameViewName() : "LogoScreen", true);
 	}
 
 	return Common::kNoError;
diff --git a/engines/ultima/ultima3/ultima3.h b/engines/ultima/ultima3/ultima3.h
index 42fb3af0833..a5527827c06 100644
--- a/engines/ultima/ultima3/ultima3.h
+++ b/engines/ultima/ultima3/ultima3.h
@@ -31,6 +31,8 @@
 #include "engines/engine.h"
 #include "ultima/detection.h"
 #include "ultima/shared/engine/events.h"
+#include "ultima/ultima3/data/arena.h"
+#include "ultima/ultima3/data/dungeon.h"
 #include "ultima/ultima3/data/map.h"
 #include "ultima/ultima3/data/savegame.h"
 #include "ultima/ultima3/gfx/message_log.h"
@@ -92,6 +94,7 @@ public:
 	Data::Savegame _savegame;
 	Data::Map _map;
 	Data::Map _worldMap;
+	Data::Dungeon _dungeon;
 	CombatLogic _combat;
 	Gfx::Shapes _shapes;
 	Gfx::MessageLog _messages;
@@ -101,6 +104,10 @@ public:
 	// How many more turns time is held still for, by powder or a spell
 	byte _holdTime = 0;
 
+	// A full viewport picture shown in place of the dungeon, such as a fountain
+	byte _scene[Data::ARENA_SIZE * Data::ARENA_SIZE] = {};
+	bool _sceneShown = false;
+
 	// Toggled in the game by the Volume command
 	bool _soundEnabled = true;
 
@@ -151,6 +158,13 @@ public:
 	 */
 	bool savegamesExist() const;
 
+	/**
+	 * Returns the name of the view for the place the party is in
+	 */
+	const char *gameViewName() const {
+		return _savegame._location == Data::LOCATION_DUNGEON ? "DungeonMap" : "LocationMap";
+	}
+
 	/**
 	 * Returns a font object that GfxSurface instances can use
 	 */
diff --git a/engines/ultima/ultima3/views/dungeon_map.cpp b/engines/ultima/ultima3/views/dungeon_map.cpp
new file mode 100644
index 00000000000..b6efb77411e
--- /dev/null
+++ b/engines/ultima/ultima3/views/dungeon_map.cpp
@@ -0,0 +1,274 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "ultima/ultima3/views/dungeon_map.h"
+#include "ultima/ultima3/views/menu_input.h"
+#include "ultima/ultima3/views/interactions/cast_spell.h"
+#include "ultima/ultima3/views/interactions/dungeon_special.h"
+#include "ultima/ultima3/views/interactions/get_chest.h"
+#include "ultima/ultima3/views/interactions/ignite_torch.h"
+#include "ultima/ultima3/views/interactions/negate_time.h"
+#include "ultima/ultima3/ultima3.h"
+
+namespace Ultima {
+namespace Ultima3 {
+namespace Views {
+
+constexpr int VIEW_LEFT = 8;
+constexpr int VIEW_TOP = 8;
+constexpr int VIEW_SIZE = 176;
+constexpr int FIRST_SPECIAL = 1;
+constexpr int LAST_SPECIAL = 6;
+
+// What is shown for each way of facing at the bottom of the frame
+static const char *const FACING_NAMES[4] = { "North", "-East", "South", "-West" };
+
+bool DungeonMap::msgFocus(const FocusMessage &msg) {
+	const Common::String prior = msg._priorView ? msg._priorView->getName() : "";
+	_viewValid = false;
+
+	if (prior == "MainMenu" || _G(resumeGame)) {
+		startGame();
+		_G(shapes).load();
+		_G(resumeGame) = false;
+		beginCommand();
+	} else if (prior == "LocationMap") {
+		beginCommand();
+	} else if (prior == "CombatMap") {
+		_turnPending = true;
+	}
+
+	return Game::msgFocus(msg);
+}
+
+void DungeonMap::beginCommand() {
+	if (checkPartyWipedOut())
+		return;
+
+	if (_G(savegame)._lightTurns == 0)
+		_G(messages).print("It's dark!\n");
+
+	startPrompt();
+}
+
+void DungeonMap::processFrame() {
+	if (_turnPending) {
+		_turnPending = false;
+		endTurn();
+	}
+}
+
+void DungeonMap::drawViewport(GfxSurface &s) {
+	const Data::Savegame &save = _G(savegame);
+
+	if (_G(sceneShown)) {
+		for (int y = 0; y < Data::ARENA_SIZE; ++y) {
+			for (int x = 0; x < Data::ARENA_SIZE; ++x)
+				_G(shapes).drawTile(s, VIEW_LEFT + x * Gfx::SHAPE_SIZE, VIEW_TOP + y * Gfx::SHAPE_SIZE,
+					_G(scene)[y * Data::ARENA_SIZE + x]);
+		}
+	} else if (save._lightTurns > 0) {
+		if (!_viewValid) {
+			_view.draw(_G(dungeon), save._dungeonLevel, save._posX, save._posY, save._facing);
+			_viewValid = true;
+		}
+
+		for (int y = VIEW_TOP; y < VIEW_TOP + VIEW_SIZE; ++y) {
+			for (int x = VIEW_LEFT; x < VIEW_LEFT + VIEW_SIZE; ++x) {
+				if (_view.isLit(x, y))
+					s.setPixel(x, y, 3);
+			}
+		}
+	}
+
+	s.addDirtyRect(Common::Rect(VIEW_LEFT, VIEW_TOP, VIEW_LEFT + VIEW_SIZE, VIEW_TOP + VIEW_SIZE));
+}
+
+void DungeonMap::drawLabels(GfxSurface &s) {
+	const Data::Savegame &save = _G(savegame);
+
+	s.writeString(Common::Point(9, 0), Common::String::format("LVL:0%d", save._dungeonLevel + 1));
+	s.writeString(Common::Point(6, 23), Common::String::format("%cHead-%s%c", 0x10,
+		FACING_NAMES[save._facing & 3], 0x11));
+}
+
+void DungeonMap::idleTimeout() {
+	_G(messages).print("Pass\n");
+	endTurn();
+}
+
+void DungeonMap::endTurn() {
+	Data::Savegame &save = _G(savegame);
+
+	// The squares that make something happen don't take up a turn
+	if (_special) {
+		_special = false;
+		beginCommand();
+		return;
+	}
+
+	// Climbing out, by ladder or spell, goes on with the turn above ground
+	if (save._location != Data::LOCATION_DUNGEON) {
+		replaceView("LocationMap");
+		return;
+	}
+
+	_logic.incrementMoveCounter();
+	_logic.processPartyTurnEffects(false);
+	if (save._lightTurns > 0)
+		--save._lightTurns;
+	_viewValid = false;
+
+	byte tile = _logic.tile();
+	if (tile == 0) {
+		int monsters = _logic.rollEncounter();
+
+		if (monsters >= 0) {
+			_G(combat).beginDungeon(monsters);
+			_turnPending = true;
+			addView("CombatMap");
+			return;
+		}
+	} else if (tile >= FIRST_SPECIAL && tile <= LAST_SPECIAL) {
+		_special = true;
+		startInteraction(new Interactions::DungeonSpecial(tile));
+		return;
+	}
+
+	beginCommand();
+}
+
+void DungeonMap::doMove(bool forward) {
+	_G(messages).print(forward ? "Advance\n" : "Retreat\n");
+
+	if (!(forward ? _logic.moveForward() : _logic.moveBackward())) {
+		_G(messages).print("Invalid Move!\n");
+		g_engine->playSoundEffect(0xFF);
+	}
+
+	endTurn();
+}
+
+void DungeonMap::doTurn(bool right) {
+	_G(messages).print(right ? "Turn right\n" : "Turn left\n");
+
+	if (!_logic.turn(right)) {
+		_G(messages).print("Invalid Move!\n");
+		g_engine->playSoundEffect(0xFF);
+	}
+
+	endTurn();
+}
+
+void DungeonMap::doClimb() {
+	_G(messages).print("Klimb\n");
+
+	switch (_logic.climb()) {
+	case DungeonLogic::LADDER_NONE:
+		_G(messages).print("Invalid Move!\n");
+		g_engine->playSoundEffect(0xFF);
+		break;
+	default:
+		break;
+	}
+
+	endTurn();
+}
+
+void DungeonMap::doDescend() {
+	_G(messages).print("Descend\n");
+
+	if (!_logic.descend()) {
+		_G(messages).print("Invalid Move!\n");
+		g_engine->playSoundEffect(0xFF);
+	}
+
+	endTurn();
+}
+
+bool DungeonMap::handleCommand(const KeypressMessage &msg) {
+	switch (msg.keycode) {
+	case Common::KEYCODE_UP:
+	case Common::KEYCODE_KP8:
+		doMove(true);
+		return true;
+	case Common::KEYCODE_DOWN:
+	case Common::KEYCODE_KP2:
+		doMove(false);
+		return true;
+	case Common::KEYCODE_RIGHT:
+	case Common::KEYCODE_KP6:
+		doTurn(true);
+		return true;
+	case Common::KEYCODE_LEFT:
+	case Common::KEYCODE_KP4:
+		doTurn(false);
+		return true;
+	case Common::KEYCODE_SPACE:
+		_G(messages).print("Pass\n");
+		endTurn();
+		return true;
+	default:
+		break;
+	}
+
+	switch (commandKey(msg)) {
+	case 'K':
+		doClimb();
+		return true;
+	case 'D':
+		doDescend();
+		return true;
+	case 'C':
+		_G(messages).print("Cast by whom-");
+		startInteraction(new Interactions::CastSpell());
+		return true;
+	case 'G':
+		_G(messages).print("Get Chest!\nPlr to search-");
+		startInteraction(new Interactions::GetChest());
+		return true;
+	case 'I':
+		_G(messages).print("Ignite a torch\nWhose torch: ");
+		startInteraction(new Interactions::IgniteTorch());
+		return true;
+	case 'N':
+		_G(messages).print("Negate Time!\nWhose Powd? ");
+		startInteraction(new Interactions::NegateTime());
+		return true;
+
+	// Commands that only make sense above ground
+	case 'B': case 'A': case 'E': case 'F': case 'L': case 'Q': case 'T':
+	case 'U': case 'X': case 'S':
+		commandFailed("Not a DNG cmd!\n", 0xFF);
+		return true;
+
+	default:
+		break;
+	}
+
+	if (!Game::handleCommand(msg))
+		commandFailed("<-What?\n");
+	return true;
+}
+
+} // namespace Views
+} // namespace Ultima3
+} // namespace Ultima
diff --git a/engines/ultima/ultima3/views/dungeon_map.h b/engines/ultima/ultima3/views/dungeon_map.h
new file mode 100644
index 00000000000..99e950fb3e8
--- /dev/null
+++ b/engines/ultima/ultima3/views/dungeon_map.h
@@ -0,0 +1,79 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef ULTIMA3_VIEWS_DUNGEON_MAP_H
+#define ULTIMA3_VIEWS_DUNGEON_MAP_H
+
+#include "ultima/ultima3/gfx/dungeon_view.h"
+#include "ultima/ultima3/logic/dungeon_logic.h"
+#include "ultima/ultima3/views/game.h"
+
+namespace Ultima {
+namespace Ultima3 {
+namespace Views {
+
+/**
+ * Exploring a dungeon, seen from the party's point of view. The view
+ * can only be made out when there's light to see it by
+ */
+class DungeonMap : public Game {
+private:
+	DungeonLogic _logic;
+	Gfx::DungeonView _view;
+
+	// Whether the picture of the view is up to date
+	bool _viewValid = false;
+
+	// Set while the effects of a special square are being dealt with, which
+	// don't count as a turn, and when a fight has ended and the turn is to be completed
+	bool _special = false;
+	bool _turnPending = false;
+
+	/**
+	 * Starts waiting for the next command
+	 */
+	void beginCommand();
+
+	void doMove(bool forward);
+	void doTurn(bool right);
+	void doClimb();
+	void doDescend();
+
+protected:
+	void drawViewport(GfxSurface &s) override;
+	void drawLabels(GfxSurface &s) override;
+	void idleTimeout() override;
+	void endTurn() override;
+	void processFrame() override;
+	bool handleCommand(const KeypressMessage &msg) override;
+
+public:
+	DungeonMap() : Game("DungeonMap") {}
+	~DungeonMap() override {}
+
+	bool msgFocus(const FocusMessage &msg) override;
+};
+
+} // namespace Views
+} // namespace Ultima3
+} // namespace Ultima
+
+#endif
diff --git a/engines/ultima/ultima3/views/form_party.cpp b/engines/ultima/ultima3/views/form_party.cpp
index 1cce0f122f3..8239f657275 100644
--- a/engines/ultima/ultima3/views/form_party.cpp
+++ b/engines/ultima/ultima3/views/form_party.cpp
@@ -63,7 +63,8 @@ void FormParty::finish() {
 		fail("(No one there)");
 	} else {
 		// A party that came to grief in a town starts out again on the world map
-		if (_G(savegame)._mapLoaded && _G(savegame)._location != Data::LOCATION_SOSARIA)
+		if (_G(savegame)._mapLoaded && (_G(savegame)._location == Data::LOCATION_TOWN ||
+				_G(savegame)._location == Data::LOCATION_CASTLE))
 			_G(map) = _G(worldMap);
 
 		_G(savegame).formParty();
diff --git a/engines/ultima/ultima3/views/game.cpp b/engines/ultima/ultima3/views/game.cpp
index 12adccf43f9..df14eb3b35f 100644
--- a/engines/ultima/ultima3/views/game.cpp
+++ b/engines/ultima/ultima3/views/game.cpp
@@ -249,6 +249,10 @@ void Game::drawPartyStatus(GfxSurface &s) {
 	}
 }
 
+void Game::drawLabels(GfxSurface &s) {
+	drawWind(s);
+}
+
 void Game::drawWind(GfxSurface &s) {
 	s.writeString(Common::Point(6, 23), Common::String::format("%c%s%c",
 		GLYPH_LABEL_START, WIND_NAMES[_G(windDirection)], GLYPH_LABEL_END));
@@ -260,7 +264,7 @@ void Game::draw() {
 	s.fillRect(Common::Rect(0, 0, 320, 200), 0);
 	drawFrame(s);
 	drawPartyStatus(s);
-	drawWind(s);
+	drawLabels(s);
 	drawViewport(s);
 	_G(messages).draw(s, !_gameOver);
 
diff --git a/engines/ultima/ultima3/views/game.h b/engines/ultima/ultima3/views/game.h
index e837d6c5f42..5150a9b1d50 100644
--- a/engines/ultima/ultima3/views/game.h
+++ b/engines/ultima/ultima3/views/game.h
@@ -64,6 +64,11 @@ protected:
 	 */
 	virtual void drawViewport(GfxSurface &s) = 0;
 
+	/**
+	 * Draws the labels set in the frame, which are the wind by default
+	 */
+	virtual void drawLabels(GfxSurface &s);
+
 	/**
 	 * Called when no command has been given for several seconds
 	 */
diff --git a/engines/ultima/ultima3/views/interactions/cast_spell.cpp b/engines/ultima/ultima3/views/interactions/cast_spell.cpp
index 5058294d78d..7cca925d155 100644
--- a/engines/ultima/ultima3/views/interactions/cast_spell.cpp
+++ b/engines/ultima/ultima3/views/interactions/cast_spell.cpp
@@ -21,6 +21,7 @@
 
 #include "ultima/ultima3/views/interactions/cast_spell.h"
 #include "ultima/ultima3/logic/chest_logic.h"
+#include "ultima/ultima3/logic/dungeon_logic.h"
 #include "ultima/ultima3/logic/location_logic.h"
 #include "ultima/ultima3/data/data.h"
 #include "ultima/ultima3/views/menu_input.h"
@@ -178,9 +179,15 @@ bool CastSpell::perform(Effect effect) {
 	case UNLOCK: {
 		fanfare();
 		if (rollBelow(255) & 3) {
-			byte cell = _G(map).cell(save._posX, save._posY);
-
-			if (cell >= FIRST_CHEST_CELL && cell <= LAST_CHEST_CELL) {
+			if (save._location == Data::LOCATION_DUNGEON) {
+				if (DungeonLogic().tile() == Data::DTILE_CHEST) {
+					_G(dungeon).setTile(save._dungeonLevel, save._posX, save._posY, 0);
+					ChestLogic().loot(_slot);
+					return true;
+				}
+			} else if (_G(map).cell(save._posX, save._posY) >= FIRST_CHEST_CELL &&
+					_G(map).cell(save._posX, save._posY) <= LAST_CHEST_CELL) {
+				byte cell = _G(map).cell(save._posX, save._posY);
 				byte ground = (cell & 3) << 2;
 				_G(map).setCell(save._posX, save._posY, ground ? ground : CELL_FLOOR);
 				ChestLogic().loot(_slot);
@@ -227,8 +234,33 @@ bool CastSpell::perform(Effect effect) {
 		_stage = TARGET;
 		return false;
 
+	case DESCEND:
+	case ASCEND:
+	case RECALL_FLOOR:
+	case LEAVE_DUNGEON:
+		if (save._location != Data::LOCATION_DUNGEON)
+			return fail();
+
+		fanfare();
+		if (effect == DESCEND) {
+			if (save._dungeonLevel >= Data::DUNGEON_LEVELS - 1)
+				return fail();
+
+			++save._dungeonLevel;
+			DungeonLogic().teleportRandomly();
+		} else if (effect == ASCEND && save._dungeonLevel > 0) {
+			--save._dungeonLevel;
+			DungeonLogic().teleportRandomly();
+		} else if (effect == RECALL_FLOOR) {
+			DungeonLogic().teleportRandomly();
+		} else {
+			LocationLogic().exitToWorld();
+		}
+
+		return true;
+
 	default:
-		// These need somewhere to be cast that isn't available
+		// The view of the world isn't available yet
 		return fail();
 	}
 
diff --git a/engines/ultima/ultima3/views/interactions/dungeon_special.cpp b/engines/ultima/ultima3/views/interactions/dungeon_special.cpp
new file mode 100644
index 00000000000..904acb5b029
--- /dev/null
+++ b/engines/ultima/ultima3/views/interactions/dungeon_special.cpp
@@ -0,0 +1,214 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "common/file.h"
+#include "ultima/ultima3/views/interactions/dungeon_special.h"
+#include "ultima/ultima3/logic/chest_logic.h"
+#include "ultima/ultima3/data/data.h"
+#include "ultima/ultima3/views/menu_input.h"
+#include "ultima/ultima3/ultima3.h"
+
+namespace Ultima {
+namespace Ultima3 {
+namespace Views {
+namespace Interactions {
+
+constexpr int FOUNTAIN_DAMAGE = 25;
+constexpr int ROD_DAMAGE = 50;
+constexpr int GREMLIN_DAMAGE = 5;
+constexpr int GREMLIN_FOOD = 100;
+
+DungeonSpecial::DungeonSpecial(byte kind) : _kind(kind) {
+	Data::Savegame &save = _G(savegame);
+
+	switch (kind) {
+	case Data::DTILE_TIME_LORD:
+		_G(dungeon).setTile(save._dungeonLevel, save._posX, save._posY, 0);
+		showScene("TIME.IMG");
+		_G(messages).print("You see a vision\nof the Time Lord\n  He tells you\n The one way is\n"
+			"   Love, Sol,\n Moons & Death,\nAll else fails.");
+		_waiting = true;
+		break;
+
+	case Data::DTILE_FOUNTAIN:
+		showScene("FOUNTAIN.IMG");
+		askWhoDrinks();
+		break;
+
+	case Data::DTILE_WIND:
+		_G(messages).print("Strange wind!\n");
+		save._lightTurns = 0;
+		_finished = true;
+		break;
+
+	case Data::DTILE_TRAP:
+		_G(dungeon).setTile(save._dungeonLevel, save._posX, save._posY, 0);
+		trap();
+		_finished = true;
+		break;
+
+	case Data::DTILE_MARK:
+		showScene("BRAND.IMG");
+		_G(messages).print("A red hot rod\nin the wall. Who\nwill touch? ");
+		break;
+
+	default:
+		_G(dungeon).setTile(save._dungeonLevel, save._posX, save._posY, 0);
+		gremlins();
+		_finished = true;
+		break;
+	}
+}
+
+DungeonSpecial::~DungeonSpecial() {
+	hideScene();
+}
+
+void DungeonSpecial::showScene(const char *filename) {
+	Common::File f;
+	if (!f.open(filename) || f.read(_G(scene), sizeof(_G(scene))) != sizeof(_G(scene)))
+		error("Could not load %s", filename);
+
+	_G(sceneShown) = true;
+}
+
+void DungeonSpecial::hideScene() {
+	_G(sceneShown) = false;
+}
+
+void DungeonSpecial::askWhoDrinks() {
+	_G(messages).print("\nA fountain.  Who\nwill drink? ");
+}
+
+void DungeonSpecial::drink(int slot) {
+	Data::RosterEntry &e = _G(savegame).partyMember(slot);
+
+	if (!e.isAlive()) {
+		_G(messages).print("Can't!\n");
+		g_engine->playSoundEffect(0xFF);
+		return;
+	}
+
+	// Which fountain it is depends on where it is
+	switch (_G(savegame)._posY & 3) {
+	case 0:
+		_G(messages).print("Yuck! Horrible!\n");
+		e._status = Data::STATUS_POISONED;
+		_G(effects).flashSlot(slot);
+		g_engine->playSoundEffect(0xF7);
+		break;
+
+	case 1:
+		e._hitPoints = e._maxHitPoints;
+		_G(messages).print("How wonderful!\n");
+		break;
+
+	case 2:
+		_G(messages).print("Argh! Blah! Yuk!\n");
+		ChestLogic().damageCharacter(slot, FOUNTAIN_DAMAGE);
+		_G(effects).flashViewport();
+		_G(effects).flashSlot(slot);
+		g_engine->playSoundEffect(0xF7);
+		break;
+
+	default:
+		_G(messages).print("Ah! That's nice!\n");
+		e._status = Data::STATUS_GOOD;
+		break;
+	}
+}
+
+void DungeonSpecial::touchRod(int slot) {
+	Data::RosterEntry &e = _G(savegame).partyMember(slot);
+
+	// Each rod leaves a different mark, depending on where it is
+	e._marksAndCards |= 1 << ((_G(savegame)._posY & 3) + 4);
+
+	_G(effects).flashSlot(slot);
+	g_engine->playSoundEffect(0xF7);
+	ChestLogic().damageCharacter(slot, ROD_DAMAGE);
+	_G(messages).print("It left a mark!\n");
+}
+
+void DungeonSpecial::trap() {
+	ChestLogic chest;
+
+	_G(messages).print("Argh!! A trap!!\n");
+	g_engine->playSoundEffect(0xF6);
+
+	if (chest.evadesTrap(0))
+		_G(messages).print("Evaded!!\n");
+	else
+		chest.damageAll(_G(savegame)._dungeonLevel);
+}
+
+void DungeonSpecial::gremlins() {
+	Data::Savegame &save = _G(savegame);
+	int slot = Graphics::Views::g_events->getRandomNumber(save._partySize - 1);
+	Data::RosterEntry &e = save.partyMember(slot);
+
+	if (e.isAlive()) {
+		_G(messages).print("Gremlins!\n");
+
+		int food = Data::fromBcdWord(e._food) - GREMLIN_FOOD;
+		if (food >= 0) {
+			e._food = Data::toBcdWord(food);
+		} else {
+			e._food = 0;
+			_G(messages).print("Starving!\n");
+			_G(effects).flashSlot(slot);
+			g_engine->playSoundEffect(0xF7);
+			ChestLogic().damageCharacter(slot, GREMLIN_DAMAGE);
+		}
+	}
+
+	g_engine->playSoundEffect(0xFA);
+}
+
+bool DungeonSpecial::keypress(const KeypressMessage &msg) {
+	if (_waiting) {
+		if (isModifierKey(msg.keycode))
+			return false;
+
+		_G(messages).print("\n");
+		return true;
+	}
+
+	PlayerChooser::Result result = _chooser.handleKey(msg);
+	if (result == PlayerChooser::PENDING)
+		return false;
+	if (result == PlayerChooser::CANCELLED)
+		return true;
+
+	if (_kind == Data::DTILE_FOUNTAIN) {
+		drink(_chooser.slot());
+		askWhoDrinks();
+		return false;
+	}
+
+	touchRod(_chooser.slot());
+	return true;
+}
+
+} // namespace Interactions
+} // namespace Views
+} // namespace Ultima3
+} // namespace Ultima
diff --git a/engines/ultima/ultima3/views/interactions/dungeon_special.h b/engines/ultima/ultima3/views/interactions/dungeon_special.h
new file mode 100644
index 00000000000..525046517fb
--- /dev/null
+++ b/engines/ultima/ultima3/views/interactions/dungeon_special.h
@@ -0,0 +1,71 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef ULTIMA3_VIEWS_INTERACTIONS_DUNGEON_SPECIAL_H
+#define ULTIMA3_VIEWS_INTERACTIONS_DUNGEON_SPECIAL_H
+
+#include "ultima/ultima3/views/interactions/interaction.h"
+
+namespace Ultima {
+namespace Ultima3 {
+namespace Views {
+namespace Interactions {
+
+/**
+ * What happens when the party step onto one of the special squares of a
+ * dungeon: a vision, a fountain, a wind, a trap, a hot rod or gremlins
+ */
+class DungeonSpecial : public Interaction {
+private:
+	byte _kind;
+	bool _finished = false;
+	bool _waiting = false;
+	PlayerChooser _chooser;
+
+	/**
+	 * Shows one of the pictures that take the place of the dungeon view
+	 */
+	void showScene(const char *filename);
+	void hideScene();
+
+	void askWhoDrinks();
+	void drink(int slot);
+	void touchRod(int slot);
+	void trap();
+	void gremlins();
+
+public:
+	DungeonSpecial(byte kind);
+	~DungeonSpecial() override;
+
+	bool isFinished() const override {
+		return _finished;
+	}
+
+	bool keypress(const KeypressMessage &msg) override;
+};
+
+} // namespace Interactions
+} // namespace Views
+} // namespace Ultima3
+} // namespace Ultima
+
+#endif
diff --git a/engines/ultima/ultima3/views/interactions/get_chest.cpp b/engines/ultima/ultima3/views/interactions/get_chest.cpp
index b5b14bbc822..0ea47cfe1e3 100644
--- a/engines/ultima/ultima3/views/interactions/get_chest.cpp
+++ b/engines/ultima/ultima3/views/interactions/get_chest.cpp
@@ -21,6 +21,7 @@
 
 #include "ultima/ultima3/views/interactions/get_chest.h"
 #include "ultima/ultima3/logic/chest_logic.h"
+#include "ultima/ultima3/logic/dungeon_logic.h"
 #include "ultima/ultima3/ultima3.h"
 
 namespace Ultima {
@@ -48,16 +49,26 @@ bool GetChest::keypress(const KeypressMessage &msg) {
 		return true;
 	}
 
-	byte cell = _G(map).cell(save._posX, save._posY);
-	if (cell < FIRST_CHEST_CELL || cell > LAST_CHEST_CELL) {
-		_G(messages).print("Not Here!\n");
-		g_engine->playSoundEffect(0xFF);
-		return true;
-	}
+	if (save._location == Data::LOCATION_DUNGEON) {
+		if (DungeonLogic().tile() != Data::DTILE_CHEST) {
+			_G(messages).print("Not Here!\n");
+			g_engine->playSoundEffect(0xFF);
+			return true;
+		}
 
-	// The chest goes, leaving the ground it was on
-	byte ground = (cell & 3) << 2;
-	_G(map).setCell(save._posX, save._posY, ground ? ground : CELL_FLOOR);
+		_G(dungeon).setTile(save._dungeonLevel, save._posX, save._posY, 0);
+	} else {
+		byte cell = _G(map).cell(save._posX, save._posY);
+		if (cell < FIRST_CHEST_CELL || cell > LAST_CHEST_CELL) {
+			_G(messages).print("Not Here!\n");
+			g_engine->playSoundEffect(0xFF);
+			return true;
+		}
+
+		// The chest goes, leaving the ground it was on
+		byte ground = (cell & 3) << 2;
+		_G(map).setCell(save._posX, save._posY, ground ? ground : CELL_FLOOR);
+	}
 
 	ChestLogic chest;
 	chest.open(slot);
diff --git a/engines/ultima/ultima3/views/interactions/ignite_torch.cpp b/engines/ultima/ultima3/views/interactions/ignite_torch.cpp
new file mode 100644
index 00000000000..6577b0fcc3e
--- /dev/null
+++ b/engines/ultima/ultima3/views/interactions/ignite_torch.cpp
@@ -0,0 +1,55 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "ultima/ultima3/views/interactions/ignite_torch.h"
+#include "ultima/ultima3/data/data.h"
+#include "ultima/ultima3/ultima3.h"
+
+namespace Ultima {
+namespace Ultima3 {
+namespace Views {
+namespace Interactions {
+
+constexpr byte TORCH_LIGHT = 0xFF;
+
+bool IgniteTorch::keypress(const KeypressMessage &msg) {
+	PlayerChooser::Result result = _chooser.handleKey(msg);
+	if (result == PlayerChooser::PENDING)
+		return false;
+	if (result == PlayerChooser::CANCELLED)
+		return true;
+
+	Data::RosterEntry &e = _G(savegame).partyMember(_chooser.slot());
+	if (e._torches == 0) {
+		_G(messages).print("None Left!\n");
+		g_engine->playSoundEffect(0xFE);
+		return true;
+	}
+
+	e._torches = Data::toBcd(Data::fromBcd(e._torches) - 1);
+	_G(savegame)._lightTurns = TORCH_LIGHT;
+	return true;
+}
+
+} // namespace Interactions
+} // namespace Views
+} // namespace Ultima3
+} // namespace Ultima
diff --git a/engines/ultima/ultima3/views/interactions/ignite_torch.h b/engines/ultima/ultima3/views/interactions/ignite_torch.h
new file mode 100644
index 00000000000..a0a4d74a76a
--- /dev/null
+++ b/engines/ultima/ultima3/views/interactions/ignite_torch.h
@@ -0,0 +1,48 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef ULTIMA3_VIEWS_INTERACTIONS_IGNITE_TORCH_H
+#define ULTIMA3_VIEWS_INTERACTIONS_IGNITE_TORCH_H
+
+#include "ultima/ultima3/views/interactions/interaction.h"
+
+namespace Ultima {
+namespace Ultima3 {
+namespace Views {
+namespace Interactions {
+
+/**
+ * Has a party member light a torch to see by in a dungeon
+ */
+class IgniteTorch : public Interaction {
+private:
+	PlayerChooser _chooser;
+
+public:
+	bool keypress(const KeypressMessage &msg) override;
+};
+
+} // namespace Interactions
+} // namespace Views
+} // namespace Ultima3
+} // namespace Ultima
+
+#endif
diff --git a/engines/ultima/ultima3/views/location_map.cpp b/engines/ultima/ultima3/views/location_map.cpp
index f936662176c..8abd8859fd0 100644
--- a/engines/ultima/ultima3/views/location_map.cpp
+++ b/engines/ultima/ultima3/views/location_map.cpp
@@ -57,6 +57,11 @@ static int stepToCentre(int pos) {
 bool LocationMap::msgFocus(const FocusMessage &msg) {
 	// The game starts when arriving from the main menu, or continues on from a load
 	bool fromMenu = msg._priorView && msg._priorView->getName() == "MainMenu";
+
+	// Coming up out of a dungeon completes the turn it was left on
+	if (msg._priorView && msg._priorView->getName() == "DungeonMap")
+		_fightOver = true;
+
 	if (fromMenu || _G(resumeGame)) {
 		startGame();
 		_G(shapes).load();
@@ -142,10 +147,8 @@ void LocationMap::endTurn() {
 
 	_logic.incrementMoveCounter();
 
-	if (_logic.isAtExit()) {
-		_G(messages).print("Exit to Sosaria!\nPlease wait...\n");
+	if (_logic.isAtExit())
 		_logic.exitToWorld();
-	}
 
 	_logic.processPartyTurnEffects(_G(savegame)._location == Data::LOCATION_SOSARIA);
 
@@ -264,7 +267,12 @@ void LocationMap::doEnter() {
 	if (text) {
 		_G(messages).print(text);
 		_G(messages).print("Please wait...\n");
-		endTurn();
+
+		// Dungeons are explored in a view of their own, and don't count as a turn
+		if (_G(savegame)._location == Data::LOCATION_DUNGEON)
+			replaceView("DungeonMap");
+		else
+			endTurn();
 	} else {
 		commandFailed("<-What?\n");
 	}
@@ -333,6 +341,10 @@ bool LocationMap::handleCommand(const KeypressMessage &msg) {
 		_G(messages).print("Steal Chest!\nPlayer? ");
 		startInteraction(new Interactions::StealChest());
 		return true;
+	case 'I':
+		_G(messages).print("Ignite a torch\n");
+		commandFailed("Not Here!\n", 0xFF);
+		return true;
 	case 'C':
 		_G(messages).print("Cast by whom-");
 		startInteraction(new Interactions::CastSpell());
diff --git a/engines/ultima/ultima3/views/main_menu.cpp b/engines/ultima/ultima3/views/main_menu.cpp
index db434ebb79f..36e23b2c30f 100644
--- a/engines/ultima/ultima3/views/main_menu.cpp
+++ b/engines/ultima/ultima3/views/main_menu.cpp
@@ -67,7 +67,7 @@ bool MainMenu::msgKeypress(const KeypressMessage &msg) {
 			if (_G(savegame)._partySize == 0 || !_G(savegame).hasLivingPartyMember()) {
 				addView("JourneyOnward");
 			} else {
-				replaceView("LocationMap", true);
+				replaceView(g_engine->gameViewName(), true);
 				return true;
 			}
 			break;
diff --git a/engines/ultima/ultima3/views/views.h b/engines/ultima/ultima3/views/views.h
index d8b13d888fc..414910fe9e3 100644
--- a/engines/ultima/ultima3/views/views.h
+++ b/engines/ultima/ultima3/views/views.h
@@ -27,6 +27,7 @@
 #include "ultima/ultima3/views/combat_map.h"
 #include "ultima/ultima3/views/create_character.h"
 #include "ultima/ultima3/views/disperse_party.h"
+#include "ultima/ultima3/views/dungeon_map.h"
 #include "ultima/ultima3/views/form_party.h"
 #include "ultima/ultima3/views/journey_onward.h"
 #include "ultima/ultima3/views/location_map.h"
@@ -46,6 +47,7 @@ struct Views {
 	CombatMap _combatMap;
 	CreateCharacter _createCharacter;
 	DisperseParty _disperseParty;
+	DungeonMap _dungeonMap;
 	FormParty _formParty;
 	JourneyOnward _journeyOnward;
 	LocationMap _locationMap;


Commit: a818951b47d94dfe53dbf694a0dd6d3eb013cf8a
    https://github.com/scummvm/scummvm/commit/a818951b47d94dfe53dbf694a0dd6d3eb013cf8a
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:41:01+11:00

Commit Message:
ULTIMA: ULTIMA3: Add the debugger console commands

Changed paths:
    engines/ultima/ultima3/console.cpp
    engines/ultima/ultima3/console.h
    engines/ultima/ultima3/data/data.cpp
    engines/ultima/ultima3/data/data.h
    engines/ultima/ultima3/data/roster.cpp
    engines/ultima/ultima3/data/roster.h
    engines/ultima/ultima3/data/savegame.cpp
    engines/ultima/ultima3/data/savegame.h
    engines/ultima/ultima3/logic/dungeon_logic.cpp
    engines/ultima/ultima3/logic/location_logic.cpp
    engines/ultima/ultima3/logic/location_logic.h
    engines/ultima/ultima3/views/dungeon_map.cpp
    engines/ultima/ultima3/views/dungeon_map.h
    engines/ultima/ultima3/views/game.cpp
    engines/ultima/ultima3/views/interactions/equip.cpp


diff --git a/engines/ultima/ultima3/console.cpp b/engines/ultima/ultima3/console.cpp
index 7736a5cb715..702d5d62ba4 100644
--- a/engines/ultima/ultima3/console.cpp
+++ b/engines/ultima/ultima3/console.cpp
@@ -22,15 +22,474 @@
 #include "common/file.h"
 #include "ultima/ultima3/console.h"
 #include "ultima/ultima3/ultima3.h"
+#include "ultima/ultima3/data/data.h"
+#include "ultima/ultima3/logic/location_logic.h"
 
 namespace Ultima {
 namespace Ultima3 {
 
+constexpr int MAX_VALUE = 9999;
+constexpr int MAX_ITEMS = 99;
+constexpr byte DEFAULT_ENEMY = 0x18;
+constexpr byte MARKS_AND_CARDS = 0xFF;
+constexpr const char *WORLD_FILE = "SOSARIA.ULT";
+constexpr const char *ROSTER_FILE = "ROSTER.ULT";
+constexpr const char *PARTY_FILE = "PARTY.ULT";
+
 Console::Console() : GUI::Debugger() {
+	registerCmd("map", WRAP_METHOD(Console, cmdMap));
+	registerCmd("tiles", WRAP_METHOD(Console, cmdTiles));
+	registerCmd("teleport", WRAP_METHOD(Console, cmdTeleport));
+	registerCmd("locations", WRAP_METHOD(Console, cmdLocations));
+	registerCmd("intangible", WRAP_METHOD(Console, cmdIntangible));
+	registerCmd("enemy", WRAP_METHOD(Console, cmdEnemy));
+	registerCmd("hp", WRAP_METHOD(Console, cmdHP));
+	registerCmd("food", WRAP_METHOD(Console, cmdFood));
+	registerCmd("gold", WRAP_METHOD(Console, cmdGold));
+	registerCmd("inventory", WRAP_METHOD(Console, cmdInventory));
+	registerCmd("load", WRAP_METHOD(Console, cmdLoad));
+	registerCmd("save", WRAP_METHOD(Console, cmdSave));
 }
 
 Console::~Console() {
 }
 
+bool Console::getTargets(int argc, const char **argv, int index, int &first, int &last) {
+	const Data::Savegame &sg = _G(savegame);
+
+	if (sg._partySize == 0) {
+		debugPrintf("There is no party\n");
+		return false;
+	}
+
+	if (argc > index) {
+		int position = atoi(argv[index]);
+		if (position < 1 || position > sg._partySize) {
+			debugPrintf("Party position must be between 1 and %d\n", sg._partySize);
+			return false;
+		}
+
+		first = last = position - 1;
+	} else {
+		first = 0;
+		last = sg._partySize - 1;
+	}
+
+	return true;
+}
+
+void Console::ensureGame() {
+	Data::Savegame &sg = _G(savegame);
+
+	if (sg._partySize == 0)
+		sg.setupDummyParty();
+
+	if (!sg._mapLoaded) {
+		_G(map).load(WORLD_FILE);
+		sg._mapLoaded = true;
+	}
+}
+
+void Console::restartGame() {
+	_G(resumeGame) = true;
+	g_engine->replaceView(g_engine->gameViewName(), true);
+}
+
+bool Console::cmdMap(int argc, const char **argv) {
+	if (argc != 2) {
+		debugPrintf("map <name>  - SOSARIA for the world, or the name of a town, castle or dungeon:\n");
+
+		for (int i = 0; i < LocationLogic::entranceCount(); ++i) {
+			Common::String name(LocationLogic::entranceFilename(i));
+			name.erase(name.size() - 4);
+			debugPrintf("  %s\n", name.c_str());
+		}
+
+		return true;
+	}
+
+	int index = -1;
+	Common::String wanted(argv[1]);
+	wanted.toUppercase();
+
+	if (wanted != "SOSARIA") {
+		for (int i = 0; i < LocationLogic::entranceCount() && index < 0; ++i) {
+			Common::String name(LocationLogic::entranceFilename(i));
+			name.erase(name.size() - 4);
+			if (name == wanted)
+				index = i;
+		}
+
+		if (index < 0) {
+			debugPrintf("No such map: %s\n", argv[1]);
+			return true;
+		}
+	}
+
+	ensureGame();
+	LocationLogic logic;
+
+	if (_G(savegame)._location != Data::LOCATION_SOSARIA)
+		logic.exitToWorld();
+
+	if (index >= 0 && !logic.enterLocation(index)) {
+		debugPrintf("Could not enter %s, which has no data file\n", argv[1]);
+		return true;
+	}
+
+	restartGame();
+	return false;
+}
+
+bool Console::cmdTiles(int argc, const char **argv) {
+	Graphics::ManagedSurface surface(Gfx::SHAPE_SIZE, Gfx::SHAPE_SIZE, Graphics::PixelFormat::createFormatCLUT8());
+
+	_G(shapes).load();
+	debugPrintf("Loaded %d tiles\n", Gfx::SHAPE_COUNT);
+
+	for (int t = 0; t < Gfx::SHAPE_COUNT; ++t) {
+		_G(shapes).drawTile(surface, 0, 0, t);
+
+		uint32 sum = 0;
+		const byte *pixels = (const byte *)surface.getPixels();
+		for (int i = 0; i < Gfx::SHAPE_SIZE * Gfx::SHAPE_SIZE; ++i)
+			sum += pixels[i];
+
+		debugPrintf("Tile %2d: pixel sum=%u\n", t, sum);
+	}
+
+	// The town tile has a distinctive shape, useful as a visual sanity check
+	// that the graphics have been decoded correctly
+	const int sanityTile = 6;
+	debugPrintf("Tile %d (Towne):\n", sanityTile);
+	_G(shapes).drawTile(surface, 0, 0, sanityTile);
+	const byte *pixels = (const byte *)surface.getPixels();
+
+	for (int y = 0; y < Gfx::SHAPE_SIZE; ++y) {
+		Common::String line;
+		for (int x = 0; x < Gfx::SHAPE_SIZE; ++x)
+			line += (char)('0' + pixels[y * Gfx::SHAPE_SIZE + x]);
+		debugPrintf("%s\n", line.c_str());
+	}
+
+	return true;
+}
+
+bool Console::cmdTeleport(int argc, const char **argv) {
+	Data::Savegame &sg = _G(savegame);
+	const bool inDungeon = sg._location == Data::LOCATION_DUNGEON;
+
+	if (argc == 3 || (argc == 4 && inDungeon)) {
+		const int mask = inDungeon ? Data::DUNGEON_SIZE - 1 : Data::MAP_SIZE - 1;
+		sg._posX = atoi(argv[1]) & mask;
+		sg._posY = atoi(argv[2]) & mask;
+
+		if (argc == 4)
+			sg._dungeonLevel = CLIP(atoi(argv[3]), 0, Data::DUNGEON_LEVELS - 1);
+
+		g_engine->focusedView()->redraw();
+	} else if (argc != 1) {
+		debugPrintf("teleport [<x> <y>%s]\n", inDungeon ? " [<level>]" : "");
+		return true;
+	}
+
+	if (inDungeon)
+		debugPrintf("Position: (%d,%d) on level %d\n", sg._posX, sg._posY, sg._dungeonLevel);
+	else
+		debugPrintf("Position: (%d,%d)\n", sg._posX, sg._posY);
+	return true;
+}
+
+bool Console::cmdLocations(int argc, const char **argv) {
+	if (argc > 2) {
+		debugPrintf("locations [<index>]\n");
+		return true;
+	}
+
+	if (argc == 2) {
+		Data::Savegame &sg = _G(savegame);
+		int index = atoi(argv[1]);
+
+		if (index < 0 || index >= LocationLogic::entranceCount()) {
+			debugPrintf("Invalid location index\n");
+			return true;
+		}
+		if (sg._location != Data::LOCATION_SOSARIA) {
+			debugPrintf("Only supported on the world map\n");
+			return true;
+		}
+
+		Common::Point pos = LocationLogic::entrancePosition(index);
+		sg._posX = pos.x;
+		sg._posY = pos.y;
+		g_engine->focusedView()->redraw();
+		debugPrintf("Teleported to %d: (%d,%d)\n", index, pos.x, pos.y);
+		return true;
+	}
+
+	for (int i = 0; i < LocationLogic::entranceCount(); ++i) {
+		Common::String name(LocationLogic::entranceFilename(i));
+		name.erase(name.size() - 4);
+		Common::Point pos = LocationLogic::entrancePosition(i);
+
+		debugPrintf("%2d: %-10s (%d,%d)\n", i, name.c_str(), pos.x, pos.y);
+	}
+
+	return true;
+}
+
+bool Console::cmdIntangible(int argc, const char **argv) {
+	_G(intangible) = !_G(intangible);
+	debugPrintf("Intangible mode %s\n", _G(intangible) ? "ON" : "OFF");
+	return true;
+}
+
+bool Console::cmdEnemy(int argc, const char **argv) {
+	Data::Savegame &sg = _G(savegame);
+	if (sg._location != Data::LOCATION_SOSARIA && sg._location != Data::LOCATION_TOWN &&
+			sg._location != Data::LOCATION_CASTLE) {
+		debugPrintf("Only supported on the world map and in towns and castles\n");
+		return true;
+	}
+	if (argc > 2) {
+		debugPrintf("enemy [<tile>]  - tile number of the creature, defaulting to an orc\n");
+		return true;
+	}
+
+	byte tile = (argc == 2) ? atoi(argv[1]) & 0x3F : DEFAULT_ENEMY;
+	Data::Creatures &c = _G(map)._creatures;
+
+	int slot = -1;
+	for (int i = 0; i < Data::CREATURE_COUNT && slot < 0; ++i) {
+		if (!c._tile[i])
+			slot = i;
+	}
+	if (slot < 0) {
+		debugPrintf("No free creature slots\n");
+		return true;
+	}
+
+	// Things of the sea need water, and the rest need open ground
+	const bool sea = tile >= 0x0B && tile < 0x10;
+	int spawnX = -1, spawnY = -1;
+
+	for (int radius = 1; radius <= 10 && spawnX < 0; ++radius) {
+		for (int dy = -radius; dy <= radius && spawnX < 0; ++dy) {
+			for (int dx = -radius; dx <= radius && spawnX < 0; ++dx) {
+				if (MAX(ABS(dx), ABS(dy)) != radius)
+					continue;
+
+				int x = (sg._posX + dx) & (Data::MAP_SIZE - 1);
+				int y = (sg._posY + dy) & (Data::MAP_SIZE - 1);
+				byte cell = _G(map).cell(x, y);
+				bool fits = sea ? cell == 0 : (cell == 4 || cell == 8 || cell == 0x0C || cell == 0x20);
+				if (!fits)
+					continue;
+
+				bool occupied = false;
+				for (int i = 0; i < Data::CREATURE_COUNT; ++i)
+					occupied |= c._tile[i] && c._x[i] == x && c._y[i] == y;
+
+				if (!occupied) {
+					spawnX = x;
+					spawnY = y;
+				}
+			}
+		}
+	}
+
+	if (spawnX < 0) {
+		debugPrintf("Couldn't find a free place nearby\n");
+		return true;
+	}
+
+	c._tile[slot] = tile * 4;
+	c._floor[slot] = _G(map).cell(spawnX, spawnY);
+	c._x[slot] = spawnX;
+	c._y[slot] = spawnY;
+	c._flags[slot] = 0xC0;
+	_G(map).setCell(spawnX, spawnY, tile * 4);
+
+	g_engine->focusedView()->redraw();
+	debugPrintf("Spawned %s in slot %d at (%d,%d)\n", Data::NAMES[tile], slot, spawnX, spawnY);
+	return true;
+}
+
+bool Console::cmdHP(int argc, const char **argv) {
+	int first, last;
+	if (argc > 2 || !getTargets(argc, argv, 1, first, last)) {
+		debugPrintf("hp [<position>]\n");
+		return true;
+	}
+
+	// Anyone who has fallen is raised too
+	for (int i = first; i <= last; ++i) {
+		Data::RosterEntry &e = _G(savegame).partyMember(i);
+		e._hitPoints = e._maxHitPoints = Data::toBcdWord(MAX_VALUE);
+		e._status = Data::STATUS_GOOD;
+	}
+
+	g_engine->focusedView()->redraw();
+	debugPrintf("HP set to %d\n", MAX_VALUE);
+	return true;
+}
+
+bool Console::cmdFood(int argc, const char **argv) {
+	int first, last;
+	if (argc > 2 || !getTargets(argc, argv, 1, first, last)) {
+		debugPrintf("food [<position>]\n");
+		return true;
+	}
+
+	for (int i = first; i <= last; ++i) {
+		Data::RosterEntry &e = _G(savegame).partyMember(i);
+		e._food = Data::toBcdWord(MAX_VALUE);
+		e._foodSubCounter = 0;
+	}
+
+	g_engine->focusedView()->redraw();
+	debugPrintf("Food set to %d\n", MAX_VALUE);
+	return true;
+}
+
+bool Console::cmdGold(int argc, const char **argv) {
+	int first, last;
+	if (argc > 2 || !getTargets(argc, argv, 1, first, last)) {
+		debugPrintf("gold [<position>]\n");
+		return true;
+	}
+
+	for (int i = first; i <= last; ++i)
+		_G(savegame).partyMember(i)._gold = Data::toBcdWord(MAX_VALUE);
+
+	g_engine->focusedView()->redraw();
+	debugPrintf("Gold set to %d\n", MAX_VALUE);
+	return true;
+}
+
+bool Console::cmdInventory(int argc, const char **argv) {
+	int first, last;
+	if (argc > 2 || !getTargets(argc, argv, 1, first, last)) {
+		debugPrintf("inventory [<position>]\n");
+		return true;
+	}
+
+	Data::Savegame &sg = _G(savegame);
+	sg._allWeapons = sg._allArmour = sg._plusTwoWeapons = sg._plusTwoArmour = true;
+
+	for (int i = first; i <= last; ++i) {
+		Data::RosterEntry &e = sg.partyMember(i);
+
+		for (int w = 0; w < Data::WEAPON_COUNT - 1; ++w)
+			e._weaponOwned[w] = Data::toBcd(MAX_ITEMS);
+		for (int a = 0; a < Data::ARMOUR_COUNT - 1; ++a)
+			e._armourOwned[a] = Data::toBcd(MAX_ITEMS);
+
+		e._torches = e._keys = e._powder = e._gems = e._magicPoints = Data::toBcd(MAX_ITEMS);
+		e._marksAndCards = MARKS_AND_CARDS;
+		e._hitPoints = e._maxHitPoints = e._food = e._gold = Data::toBcdWord(MAX_VALUE);
+		e._foodSubCounter = 0;
+		e._status = Data::STATUS_GOOD;
+
+		// Ready the best that the character's class is allowed to, which
+		// leaves out the exotic weapon and armour that anyone can use
+		e._weaponIndex = 0;
+		for (int w = Data::WEAPON_COUNT - 2; w > 0; --w) {
+			if ('A' + w < Data::weaponLimit(e._class)) {
+				e._weaponIndex = w;
+				break;
+			}
+		}
+
+		e._armourIndex = 0;
+		for (int a = Data::ARMOUR_COUNT - 2; a > 0; --a) {
+			if ('A' + a < Data::armourLimit(e._class)) {
+				e._armourIndex = a;
+				break;
+			}
+		}
+
+		debugPrintf("%s: readied %s and %s armour\n", e._name, Data::WEAPON_NAMES[e._weaponIndex],
+			Data::ARMOUR_NAMES[e._armourIndex]);
+	}
+
+	g_engine->focusedView()->redraw();
+	debugPrintf("Full inventory given\n");
+	return true;
+}
+
+bool Console::cmdLoad(int argc, const char **argv) {
+	if (argc != 1 && argc != 3) {
+		debugPrintf("load [<roster file> <party file>]  - imports original DOS save files; "
+			"defaults to ROSTER.ULT and PARTY.ULT\n");
+		return true;
+	}
+
+	Common::String rosterName = (argc == 3) ? argv[1] : ROSTER_FILE;
+	Common::String partyName = (argc == 3) ? argv[2] : PARTY_FILE;
+
+	Common::File rosterFile, partyFile;
+	if (!rosterFile.open(rosterName.c_str())) {
+		debugPrintf("Could not open %s\n", rosterName.c_str());
+		return true;
+	}
+	if (!partyFile.open(partyName.c_str())) {
+		debugPrintf("Could not open %s\n", partyName.c_str());
+		return true;
+	}
+
+	Data::Savegame &sg = _G(savegame);
+	if (!sg.importOriginal(rosterFile, partyFile)) {
+		debugPrintf("%s and %s are too short to be save files\n", rosterName.c_str(), partyName.c_str());
+		return true;
+	}
+
+	// The world they were saved in comes with the party
+	if (Common::File::exists(WORLD_FILE)) {
+		_G(map).load(WORLD_FILE);
+		sg._mapLoaded = true;
+	} else {
+		ensureGame();
+	}
+
+	debugPrintf("Imported a party of %d at (%d,%d)\n", sg._partySize, sg._posX, sg._posY);
+	if (sg._partySize == 0)
+		return true;
+
+	restartGame();
+	return false;
+}
+
+bool Console::cmdSave(int argc, const char **argv) {
+	if (argc != 1 && argc != 3) {
+		debugPrintf("save [<roster file> <party file>]  - exports original DOS save files; "
+			"defaults to ROSTER.ULT and PARTY.ULT\n");
+		return true;
+	}
+
+	Data::Savegame &sg = _G(savegame);
+	if (sg._partySize == 0) {
+		debugPrintf("There is no party to save\n");
+		return true;
+	}
+
+	Common::String rosterName = (argc == 3) ? argv[1] : ROSTER_FILE;
+	Common::String partyName = (argc == 3) ? argv[2] : PARTY_FILE;
+
+	Common::DumpFile rosterFile, partyFile;
+	if (!rosterFile.open(Common::Path(rosterName), true)) {
+		debugPrintf("Could not create %s\n", rosterName.c_str());
+		return true;
+	}
+	if (!partyFile.open(Common::Path(partyName), true)) {
+		debugPrintf("Could not create %s\n", partyName.c_str());
+		return true;
+	}
+
+	sg.exportOriginal(rosterFile, partyFile);
+	debugPrintf("Exported %s and %s\n", rosterName.c_str(), partyName.c_str());
+	return true;
+}
+
 } // namespace Ultima3
 } // namespace Ultima
diff --git a/engines/ultima/ultima3/console.h b/engines/ultima/ultima3/console.h
index 2123680b6d7..7230a7b4269 100644
--- a/engines/ultima/ultima3/console.h
+++ b/engines/ultima/ultima3/console.h
@@ -30,6 +30,37 @@ namespace Ultima {
 namespace Ultima3 {
 
 class Console : public GUI::Debugger {
+private:
+	/**
+	 * Works out which party members a command applies to from an optional
+	 * position given as an argument, defaulting to all of them
+	 * @returns		False if the argument isn't a position in the party
+	 */
+	bool getTargets(int argc, const char **argv, int index, int &first, int &last);
+
+	/**
+	 * Makes sure there's a party and a world to be in
+	 */
+	void ensureGame();
+
+	/**
+	 * Switches to the view for wherever the party is now
+	 */
+	void restartGame();
+
+	bool cmdMap(int argc, const char **argv);
+	bool cmdTiles(int argc, const char **argv);
+	bool cmdTeleport(int argc, const char **argv);
+	bool cmdLocations(int argc, const char **argv);
+	bool cmdIntangible(int argc, const char **argv);
+	bool cmdEnemy(int argc, const char **argv);
+	bool cmdHP(int argc, const char **argv);
+	bool cmdFood(int argc, const char **argv);
+	bool cmdGold(int argc, const char **argv);
+	bool cmdInventory(int argc, const char **argv);
+	bool cmdLoad(int argc, const char **argv);
+	bool cmdSave(int argc, const char **argv);
+
 public:
 	Console();
 	~Console() override;
diff --git a/engines/ultima/ultima3/data/data.cpp b/engines/ultima/ultima3/data/data.cpp
index 8cd91f34e03..61553f2158d 100644
--- a/engines/ultima/ultima3/data/data.cpp
+++ b/engines/ultima/ultima3/data/data.cpp
@@ -89,6 +89,24 @@ const byte MONSTER_EXPERIENCE[16] = {
 	0x01, 0x02, 0x15, 0x20, 0x08, 0x06, 0x10, 0x05, 0x03, 0x04, 0x06, 0x08, 0x10, 0x15, 0x20, 0x05
 };
 
+// Classes in the order the equipment limits are given in
+static const char EQUIPMENT_CLASSES[] = "FCWTPBLIDAR";
+static const char WEAPON_LIMITS[] = "QDCHQQQDDCL";
+static const char ARMOUR_LIMITS[] = "IECDFDCDCCH";
+
+static int equipmentClass(char classKey) {
+	const char *pos = classKey ? strchr(EQUIPMENT_CLASSES, classKey) : nullptr;
+	return pos ? pos - EQUIPMENT_CLASSES : 0;
+}
+
+char weaponLimit(char classKey) {
+	return WEAPON_LIMITS[equipmentClass(classKey)];
+}
+
+char armourLimit(char classKey) {
+	return ARMOUR_LIMITS[equipmentClass(classKey)];
+}
+
 byte fightingTile(char classKey) {
 	static const char CLASSES[] = "FCWTPBLIDA";
 	static const byte TILES[] = { 0x14, 0x15, 0x16, 0x17, 0x14, 0x14, 0x11, 0x16, 0x15, 0x16 };
diff --git a/engines/ultima/ultima3/data/data.h b/engines/ultima/ultima3/data/data.h
index e3bbd407fa1..f115ba475b2 100644
--- a/engines/ultima/ultima3/data/data.h
+++ b/engines/ultima/ultima3/data/data.h
@@ -65,6 +65,13 @@ extern const char *const NAMES[NAME_COUNT];
 extern const byte MONSTER_HIT_POINTS[16];
 extern const byte MONSTER_EXPERIENCE[16];
 
+/**
+ * Returns the letter after those of the weapons and armour that a class may
+ * use, apart from the exotic ones which anyone may
+ */
+char weaponLimit(char classKey);
+char armourLimit(char classKey);
+
 /**
  * Returns the tile showing a party member of a class in a fight
  */
diff --git a/engines/ultima/ultima3/data/roster.cpp b/engines/ultima/ultima3/data/roster.cpp
index c85b570e0f2..babf1551c74 100644
--- a/engines/ultima/ultima3/data/roster.cpp
+++ b/engines/ultima/ultima3/data/roster.cpp
@@ -25,8 +25,11 @@ namespace Ultima {
 namespace Ultima3 {
 namespace Data {
 
-void RosterEntry::synchronize(Common::Serializer &s) {
+void RosterEntry::synchronize(Common::Serializer &s, bool original) {
 	s.syncBytes((byte *)_name, sizeof(_name));
+	if (original)
+		s.skip(4);
+
 	s.syncAsByte(_marksAndCards);
 	s.syncAsByte(_torches);
 	s.syncAsByte(_partyMember);
diff --git a/engines/ultima/ultima3/data/roster.h b/engines/ultima/ultima3/data/roster.h
index 9c5a9f0e535..698221f81e7 100644
--- a/engines/ultima/ultima3/data/roster.h
+++ b/engines/ultima/ultima3/data/roster.h
@@ -107,7 +107,12 @@ struct RosterEntry {
 		return _status == STATUS_GOOD || _status == STATUS_POISONED;
 	}
 
-	void synchronize(Common::Serializer &s);
+	/**
+	 * Saves or loads the record
+	 * @param original		True to use the form it has in the original's files, which
+	 *		has some unused bytes after the name
+	 */
+	void synchronize(Common::Serializer &s, bool original = false);
 };
 
 } // namespace Data
diff --git a/engines/ultima/ultima3/data/savegame.cpp b/engines/ultima/ultima3/data/savegame.cpp
index 5e210470c70..db259e7fa63 100644
--- a/engines/ultima/ultima3/data/savegame.cpp
+++ b/engines/ultima/ultima3/data/savegame.cpp
@@ -88,6 +88,117 @@ void Savegame::synchronize(Common::Serializer &s) {
 	}
 }
 
+constexpr int ORIGINAL_ROSTER_SIZE = ROSTER_COUNT * 0x40;
+constexpr int ORIGINAL_PARTY_SIZE = 0x12 + PARTY_MAX * 0x40;
+constexpr byte FLAG_SET = 0xFF;
+
+bool Savegame::importOriginal(Common::SeekableReadStream &roster, Common::SeekableReadStream &party) {
+	if (roster.size() < ORIGINAL_ROSTER_SIZE || party.size() < ORIGINAL_PARTY_SIZE)
+		return false;
+
+	Common::Serializer rosterSer(&roster, nullptr);
+	for (int i = 0; i < ROSTER_COUNT; ++i)
+		_roster[i].synchronize(rosterSer, true);
+
+	Common::Serializer ser(&party, nullptr);
+	byte location, size, x, y, flags[4];
+	ser.syncAsByte(_transport);
+	ser.skip(1);
+	ser.syncAsByte(location);
+	ser.syncBytes(_moveCount, sizeof(_moveCount));
+	ser.syncAsByte(size);
+	ser.syncAsByte(x);
+	ser.syncAsByte(y);
+	ser.syncBytes(_partyEntries, PARTY_MAX);
+	ser.syncBytes(flags, sizeof(flags));
+
+	// The party's own copies of the characters are the up to date ones
+	RosterEntry members[PARTY_MAX];
+	for (int i = 0; i < PARTY_MAX; ++i)
+		members[i].synchronize(ser, true);
+
+	_partySize = MIN<int>(size, PARTY_MAX);
+	for (int i = 0; i < _partySize; ++i) {
+		if (_partyEntries[i] >= 1 && _partyEntries[i] <= ROSTER_COUNT)
+			entry(_partyEntries[i]) = members[i];
+	}
+
+	// A place other than the world can't be returned to, so the party is placed back on it
+	_allWeapons = flags[0] == FLAG_SET;
+	_allArmour = flags[1] == FLAG_SET;
+	_plusTwoWeapons = flags[2] == FLAG_SET;
+	_plusTwoArmour = flags[3] == FLAG_SET;
+	_location = LOCATION_SOSARIA;
+	_posX = _worldX = x;
+	_posY = _worldY = y;
+	_dungeonLevel = 0;
+	_lightTurns = 0;
+	return true;
+}
+
+void Savegame::exportOriginal(Common::WriteStream &roster, Common::WriteStream &party) {
+	Common::Serializer rosterSer(nullptr, &roster);
+	for (int i = 0; i < ROSTER_COUNT; ++i)
+		_roster[i].synchronize(rosterSer, true);
+
+	// Where the party is elsewhere can't be put in the file, so it has the place they entered from
+	Common::Serializer ser(nullptr, &party);
+	byte location = LOCATION_SOSARIA, size = _partySize;
+	byte x = (_location == LOCATION_SOSARIA) ? _posX : _worldX;
+	byte y = (_location == LOCATION_SOSARIA) ? _posY : _worldY;
+	byte flags[4] = {
+		_allWeapons ? FLAG_SET : (byte)0, _allArmour ? FLAG_SET : (byte)0,
+		_plusTwoWeapons ? FLAG_SET : (byte)0, _plusTwoArmour ? FLAG_SET : (byte)0
+	};
+
+	ser.syncAsByte(_transport);
+	ser.skip(1);
+	ser.syncAsByte(location);
+	ser.syncBytes(_moveCount, sizeof(_moveCount));
+	ser.syncAsByte(size);
+	ser.syncAsByte(x);
+	ser.syncAsByte(y);
+	ser.syncBytes(_partyEntries, PARTY_MAX);
+	ser.syncBytes(flags, sizeof(flags));
+
+	for (int i = 0; i < PARTY_MAX; ++i) {
+		RosterEntry blank;
+		(i < _partySize ? partyMember(i) : blank).synchronize(ser, true);
+	}
+}
+
+void Savegame::setupDummyParty() {
+	static const struct {
+		const char *_name;
+		char _sex, _race, _class;
+	} CHARACTERS[PARTY_MAX] = {
+		{ "Anna", 'F', 'H', 'F' }, { "Boris", 'M', 'D', 'C' },
+		{ "Cora", 'F', 'E', 'W' }, { "Dax", 'M', 'B', 'T' }
+	};
+
+	clearPartySelection();
+	for (int i = 0; i < PARTY_MAX; ++i) {
+		RosterEntry &e = _roster[i];
+		e.clear();
+
+		Common::strlcpy(e._name, CHARACTERS[i]._name, sizeof(e._name));
+		e._sex = CHARACTERS[i]._sex;
+		e._race = CHARACTERS[i]._race;
+		e._class = CHARACTERS[i]._class;
+		e._status = STATUS_GOOD;
+		e._strength = e._dexterity = e._intelligence = e._wisdom = toBcd(25);
+		e._magicPoints = toBcd(25);
+		e._hitPoints = e._maxHitPoints = toBcdWord(150);
+		e._food = e._gold = toBcdWord(200);
+		e._torches = toBcd(5);
+		e._weaponOwned[0] = 1;
+		e._armourOwned[0] = 1;
+		addToParty(i + 1);
+	}
+
+	formParty();
+}
+
 void Savegame::formParty() {
 	_transport = TRANSPORT_ON_FOOT;
 	_location = LOCATION_SOSARIA;
diff --git a/engines/ultima/ultima3/data/savegame.h b/engines/ultima/ultima3/data/savegame.h
index db04e7234cd..fee3e7977ac 100644
--- a/engines/ultima/ultima3/data/savegame.h
+++ b/engines/ultima/ultima3/data/savegame.h
@@ -97,6 +97,24 @@ struct Savegame {
 
 	void synchronize(Common::Serializer &s);
 
+	/**
+	 * Reads the roster and the party from the files the original game keeps
+	 * them in, ROSTER.ULT and PARTY.ULT
+	 * @returns		False if the files are too short
+	 */
+	bool importOriginal(Common::SeekableReadStream &roster, Common::SeekableReadStream &party);
+
+	/**
+	 * Writes the roster and the party in the form the original game uses
+	 */
+	void exportOriginal(Common::WriteStream &roster, Common::WriteStream &party);
+
+	/**
+	 * Fills the roster with four ready made characters, and puts them
+	 * together as the party
+	 */
+	void setupDummyParty();
+
 	/**
 	 * Completes a selected party, placing it at the starting point on foot
 	 */
diff --git a/engines/ultima/ultima3/logic/dungeon_logic.cpp b/engines/ultima/ultima3/logic/dungeon_logic.cpp
index 1aa821912cc..79f24913b5e 100644
--- a/engines/ultima/ultima3/logic/dungeon_logic.cpp
+++ b/engines/ultima/ultima3/logic/dungeon_logic.cpp
@@ -51,7 +51,7 @@ bool DungeonLogic::moveForward() {
 	int y = (save._posY + FACING_DY[save._facing]) & (Data::DUNGEON_SIZE - 1);
 
 	// Only the plainest walls can't be walked through
-	if (_G(dungeon).tile(save._dungeonLevel, x, y) == TILE_BLOCKED)
+	if (!_G(intangible) && _G(dungeon).tile(save._dungeonLevel, x, y) == TILE_BLOCKED)
 		return false;
 
 	save._posX = x;
@@ -65,7 +65,7 @@ bool DungeonLogic::moveBackward() {
 	int x = (save._posX + FACING_DX[behind]) & (Data::DUNGEON_SIZE - 1);
 	int y = (save._posY + FACING_DY[behind]) & (Data::DUNGEON_SIZE - 1);
 
-	if (_G(dungeon).tile(save._dungeonLevel, x, y) & TILE_BLOCKED)
+	if (!_G(intangible) && (_G(dungeon).tile(save._dungeonLevel, x, y) & TILE_BLOCKED))
 		return false;
 
 	save._posX = x;
diff --git a/engines/ultima/ultima3/logic/location_logic.cpp b/engines/ultima/ultima3/logic/location_logic.cpp
index 116210deffa..d39a539963a 100644
--- a/engines/ultima/ultima3/logic/location_logic.cpp
+++ b/engines/ultima/ultima3/logic/location_logic.cpp
@@ -101,10 +101,13 @@ bool LocationLogic::move(Direction dir) {
 	int dx = (dir == DIR_EAST) ? 1 : (dir == DIR_WEST) ? -1 : 0;
 	int dy = (dir == DIR_SOUTH) ? 1 : (dir == DIR_NORTH) ? -1 : 0;
 
-	if (isShipBlockedByWind(dir))
-		return false;
-	if (isTerrainBlocked(_G(map).tile(save._posX + dx, save._posY + dy)))
-		return false;
+	// The debugger can make the party able to go anywhere
+	if (!_G(intangible)) {
+		if (isShipBlockedByWind(dir))
+			return false;
+		if (isTerrainBlocked(_G(map).tile(save._posX + dx, save._posY + dy)))
+			return false;
+	}
 
 	save._posX = (save._posX + dx) & (Data::MAP_SIZE - 1);
 	save._posY = (save._posY + dy) & (Data::MAP_SIZE - 1);
@@ -112,25 +115,31 @@ bool LocationLogic::move(Direction dir) {
 }
 
 // The towns, castles and dungeons on the world map, with the entrance of each
+constexpr byte TILE_TOWN = 6;
+constexpr byte TILE_CASTLE = 7;
+constexpr byte TILE_DUNGEON = 5;
+
 struct Entrance {
 	const char *_filename;
 	byte _x, _y;
+
+	// The kind of place it is, which is the tile shown for it on the world map
+	byte _tile;
 };
 
 static const Entrance ENTRANCES[] = {
-	{ "BRITISH.ULT", 45, 18 }, { "EXODUS.ULT", 10, 53 }, { "LCB.ULT", 46, 19 },
-	{ "MOON.ULT", 6, 13 }, { "YEW.ULT", 34, 16 }, { "MONTOR_E.ULT", 49, 58 },
-	{ "MONTOR_W.ULT", 47, 58 }, { "GREY.ULT", 7, 44 }, { "DAWN.ULT", 37, 53 },
-	{ "DEVIL.ULT", 18, 31 }, { "FAWN.ULT", 30, 2 }, { "DEATH.ULT", 56, 31 },
-	{ "M.ULT", 19, 57 }, { "FIRE.ULT", 49, 34 }, { "TIME.ULT", 58, 30 },
-	{ "P.ULT", 58, 44 }, { "PERINIAN.ULT", 56, 6 }, { "MINE.ULT", 9, 28 },
-	{ "DARDIN.ULT", 46, 7 }
+	{ "BRITISH.ULT", 45, 18, TILE_CASTLE }, { "EXODUS.ULT", 10, 53, TILE_CASTLE },
+	{ "LCB.ULT", 46, 19, TILE_TOWN }, { "MOON.ULT", 6, 13, TILE_TOWN },
+	{ "YEW.ULT", 34, 16, TILE_TOWN }, { "MONTOR_E.ULT", 49, 58, TILE_TOWN },
+	{ "MONTOR_W.ULT", 47, 58, TILE_TOWN }, { "GREY.ULT", 7, 44, TILE_TOWN },
+	{ "DAWN.ULT", 37, 53, TILE_TOWN }, { "DEVIL.ULT", 18, 31, TILE_TOWN },
+	{ "FAWN.ULT", 30, 2, TILE_TOWN }, { "DEATH.ULT", 56, 31, TILE_TOWN },
+	{ "M.ULT", 19, 57, TILE_DUNGEON }, { "FIRE.ULT", 49, 34, TILE_DUNGEON },
+	{ "TIME.ULT", 58, 30, TILE_DUNGEON }, { "P.ULT", 58, 44, TILE_DUNGEON },
+	{ "PERINIAN.ULT", 56, 6, TILE_DUNGEON }, { "MINE.ULT", 9, 28, TILE_DUNGEON },
+	{ "DARDIN.ULT", 46, 7, TILE_DUNGEON }
 };
 
-constexpr byte TILE_TOWN = 6;
-constexpr byte TILE_CASTLE = 7;
-constexpr byte TILE_DUNGEON = 5;
-
 // Where the party starts out in each kind of location
 constexpr byte DUNGEON_START = 1;
 constexpr byte DUNGEON_START_FACING = 1;
@@ -151,8 +160,38 @@ const char *LocationLogic::enter() {
 	}
 
 	byte tile = _G(map).tile(save._posX, save._posY);
-	if (!entrance || (tile != TILE_TOWN && tile != TILE_CASTLE && tile != TILE_DUNGEON) ||
-			!Data::Map::exists(entrance->_filename))
+	if (!entrance || (tile != TILE_TOWN && tile != TILE_CASTLE && tile != TILE_DUNGEON))
+		return nullptr;
+
+	return go(*entrance, tile);
+}
+
+int LocationLogic::entranceCount() {
+	return ARRAYSIZE(ENTRANCES);
+}
+
+const char *LocationLogic::entranceFilename(int index) {
+	return ENTRANCES[index]._filename;
+}
+
+Common::Point LocationLogic::entrancePosition(int index) {
+	return Common::Point(ENTRANCES[index]._x, ENTRANCES[index]._y);
+}
+
+const char *LocationLogic::enterLocation(int index) {
+	Data::Savegame &save = _G(savegame);
+	if (save._location != Data::LOCATION_SOSARIA)
+		return nullptr;
+
+	const Entrance &entrance = ENTRANCES[index];
+	save._posX = entrance._x;
+	save._posY = entrance._y;
+	return go(entrance, entrance._tile);
+}
+
+const char *LocationLogic::go(const Entrance &entrance, byte tile) {
+	Data::Savegame &save = _G(savegame);
+	if (!Data::Map::exists(entrance._filename))
 		return nullptr;
 
 	save._worldX = save._posX;
@@ -160,7 +199,7 @@ const char *LocationLogic::enter() {
 
 	// Dungeons are entered at the top left, facing east
 	if (tile == TILE_DUNGEON) {
-		_G(dungeon).load(entrance->_filename);
+		_G(dungeon).load(entrance._filename);
 		save._location = Data::LOCATION_DUNGEON;
 		save._posX = DUNGEON_START;
 		save._posY = DUNGEON_START;
@@ -171,7 +210,7 @@ const char *LocationLogic::enter() {
 	}
 
 	_G(worldMap) = _G(map);
-	_G(map).load(entrance->_filename);
+	_G(map).load(entrance._filename);
 
 	if (tile == TILE_TOWN) {
 		save._location = Data::LOCATION_TOWN;
diff --git a/engines/ultima/ultima3/logic/location_logic.h b/engines/ultima/ultima3/logic/location_logic.h
index 729223620c7..eee96b1194b 100644
--- a/engines/ultima/ultima3/logic/location_logic.h
+++ b/engines/ultima/ultima3/logic/location_logic.h
@@ -22,11 +22,14 @@
 #ifndef ULTIMA3_LOGIC_LOCATION_LOGIC_H
 #define ULTIMA3_LOGIC_LOCATION_LOGIC_H
 
+#include "common/rect.h"
 #include "ultima/ultima3/logic/logic.h"
 
 namespace Ultima {
 namespace Ultima3 {
 
+struct Entrance;
+
 constexpr byte TRANSPORT_HORSE = 0x0A;
 constexpr byte TRANSPORT_SHIP = 0x0B;
 constexpr byte TRANSPORT_ON_FOOT = 0x3F;
@@ -36,6 +39,11 @@ constexpr byte TRANSPORT_ON_FOOT = 0x3F;
  */
 class LocationLogic : public Logic {
 private:
+	/**
+	 * Takes the party into a place from its entrance on the world map
+	 */
+	const char *go(const Entrance &entrance, byte tile);
+
 	/**
 	 * Returns true if a ship can't sail in a direction because the wind is
 	 * absent or blowing against it
@@ -84,6 +92,20 @@ public:
 	 */
 	const char *enter();
 
+	/**
+	 * Takes the party into one of the places that have an entrance on the
+	 * world map, wherever they are on it
+	 * @returns		What to say about it, or null if it can't be entered
+	 */
+	const char *enterLocation(int index);
+
+	/**
+	 * Returns details of the places that have an entrance on the world map
+	 */
+	static int entranceCount();
+	static const char *entranceFilename(int index);
+	static Common::Point entrancePosition(int index);
+
 	/**
 	 * Returns true if the party has reached the edge of a town or castle,
 	 * and so leaves it
diff --git a/engines/ultima/ultima3/views/dungeon_map.cpp b/engines/ultima/ultima3/views/dungeon_map.cpp
index b6efb77411e..3bf8a82b4d0 100644
--- a/engines/ultima/ultima3/views/dungeon_map.cpp
+++ b/engines/ultima/ultima3/views/dungeon_map.cpp
@@ -86,9 +86,13 @@ void DungeonMap::drawViewport(GfxSurface &s) {
 					_G(scene)[y * Data::ARENA_SIZE + x]);
 		}
 	} else if (save._lightTurns > 0) {
-		if (!_viewValid) {
+		// The view is only redrawn once something has changed it, or the party
+		// has been moved by something other than a command
+		uint32 key = (save._dungeonLevel << 24) | (save._posX << 16) | (save._posY << 8) | save._facing;
+		if (!_viewValid || key != _viewKey) {
 			_view.draw(_G(dungeon), save._dungeonLevel, save._posX, save._posY, save._facing);
 			_viewValid = true;
+			_viewKey = key;
 		}
 
 		for (int y = VIEW_TOP; y < VIEW_TOP + VIEW_SIZE; ++y) {
diff --git a/engines/ultima/ultima3/views/dungeon_map.h b/engines/ultima/ultima3/views/dungeon_map.h
index 99e950fb3e8..9a7cdce2dd8 100644
--- a/engines/ultima/ultima3/views/dungeon_map.h
+++ b/engines/ultima/ultima3/views/dungeon_map.h
@@ -39,8 +39,9 @@ private:
 	DungeonLogic _logic;
 	Gfx::DungeonView _view;
 
-	// Whether the picture of the view is up to date
+	// Whether the picture of the view is up to date, and where it was taken from
 	bool _viewValid = false;
+	uint32 _viewKey = 0;
 
 	// Set while the effects of a special square are being dealt with, which
 	// don't count as a turn, and when a fight has ended and the turn is to be completed
diff --git a/engines/ultima/ultima3/views/game.cpp b/engines/ultima/ultima3/views/game.cpp
index df14eb3b35f..4f7bf8735e1 100644
--- a/engines/ultima/ultima3/views/game.cpp
+++ b/engines/ultima/ultima3/views/game.cpp
@@ -163,6 +163,8 @@ bool Game::handleCommand(const KeypressMessage &msg) {
 bool Game::msgKeypress(const KeypressMessage &msg) {
 	if (isModifierKey(msg.keycode))
 		return true;
+	if (Shared::View::msgKeypress(msg))
+		return true;
 
 	if (_gameOver) {
 		_G(soundEnabled) = true;
diff --git a/engines/ultima/ultima3/views/interactions/equip.cpp b/engines/ultima/ultima3/views/interactions/equip.cpp
index 7273870dbbc..519366e08cc 100644
--- a/engines/ultima/ultima3/views/interactions/equip.cpp
+++ b/engines/ultima/ultima3/views/interactions/equip.cpp
@@ -28,11 +28,6 @@ namespace Ultima3 {
 namespace Views {
 namespace Interactions {
 
-// The last weapon and armour letters, plus one, that each class may use
-static const char CLASS_ORDER[] = "FCWTPBLIDAR";
-static const char WEAPON_LIMITS[] = "QDCHQQQDDCL";
-static const char ARMOUR_LIMITS[] = "IECDFDCDCCH";
-
 constexpr char ESCAPE_KEY = 0x1B;
 constexpr char EXOTIC_WEAPON = 'P';
 constexpr char EXOTIC_ARMOUR = 'H';
@@ -71,9 +66,7 @@ void Equip::startMenu() {
 void Equip::equip(char letter) {
 	Data::RosterEntry &e = _G(savegame).partyMember(_slot);
 
-	const char *classPos = strchr(CLASS_ORDER, e._class);
-	int classNum = (classPos && *classPos) ? classPos - CLASS_ORDER : 0;
-	char limit = (_weapons ? WEAPON_LIMITS : ARMOUR_LIMITS)[classNum];
+	char limit = _weapons ? Data::weaponLimit(e._class) : Data::armourLimit(e._class);
 	char exotic = _weapons ? EXOTIC_WEAPON : EXOTIC_ARMOUR;
 
 	if (letter != exotic && letter >= limit) {


Commit: c82b9587b3ed83033a8e0b1d3b812551284a3aaa
    https://github.com/scummvm/scummvm/commit/c82b9587b3ed83033a8e0b1d3b812551284a3aaa
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:41:01+11:00

Commit Message:
ULTIMA: ULTIMA3: Add the hand, join gold, yell, other and quit commands

Changed paths:
  A engines/ultima/ultima3/views/interactions/hand_equipment.cpp
  A engines/ultima/ultima3/views/interactions/hand_equipment.h
  A engines/ultima/ultima3/views/interactions/join_gold.cpp
  A engines/ultima/ultima3/views/interactions/join_gold.h
  A engines/ultima/ultima3/views/interactions/other_command.cpp
  A engines/ultima/ultima3/views/interactions/other_command.h
  A engines/ultima/ultima3/views/interactions/yell.cpp
  A engines/ultima/ultima3/views/interactions/yell.h
    engines/ultima/module.mk
    engines/ultima/ultima3/views/dungeon_map.cpp
    engines/ultima/ultima3/views/interactions/log_input.cpp
    engines/ultima/ultima3/views/interactions/log_input.h
    engines/ultima/ultima3/views/location_map.cpp
    engines/ultima/ultima3/views/location_map.h


diff --git a/engines/ultima/module.mk b/engines/ultima/module.mk
index 79bb0527aa4..ebbc81b1b61 100644
--- a/engines/ultima/module.mk
+++ b/engines/ultima/module.mk
@@ -193,15 +193,19 @@ MODULE_OBJS += \
 	ultima3/views/interactions/equip.o \
 	ultima3/views/interactions/exchange.o \
 	ultima3/views/interactions/get_chest.o \
+	ultima3/views/interactions/hand_equipment.o \
 	ultima3/views/interactions/ignite_torch.o \
 	ultima3/views/interactions/interaction.o \
 	ultima3/views/interactions/log_input.o \
+	ultima3/views/interactions/join_gold.o \
 	ultima3/views/interactions/look.o \
 	ultima3/views/interactions/negate_time.o \
+	ultima3/views/interactions/other_command.o \
 	ultima3/views/interactions/shops.o \
 	ultima3/views/interactions/steal_chest.o \
 	ultima3/views/interactions/transact.o \
 	ultima3/views/interactions/unlock_door.o \
+	ultima3/views/interactions/yell.o \
 	ultima3/views/interactions/ztats.o \
 	ultima3/views/journey_onward.o \
 	ultima3/views/location_map.o \
diff --git a/engines/ultima/ultima3/views/dungeon_map.cpp b/engines/ultima/ultima3/views/dungeon_map.cpp
index 3bf8a82b4d0..73245fc96f2 100644
--- a/engines/ultima/ultima3/views/dungeon_map.cpp
+++ b/engines/ultima/ultima3/views/dungeon_map.cpp
@@ -24,6 +24,10 @@
 #include "ultima/ultima3/views/interactions/cast_spell.h"
 #include "ultima/ultima3/views/interactions/dungeon_special.h"
 #include "ultima/ultima3/views/interactions/get_chest.h"
+#include "ultima/ultima3/views/interactions/hand_equipment.h"
+#include "ultima/ultima3/views/interactions/join_gold.h"
+#include "ultima/ultima3/views/interactions/other_command.h"
+#include "ultima/ultima3/views/interactions/yell.h"
 #include "ultima/ultima3/views/interactions/ignite_torch.h"
 #include "ultima/ultima3/views/interactions/negate_time.h"
 #include "ultima/ultima3/ultima3.h"
@@ -249,6 +253,22 @@ bool DungeonMap::handleCommand(const KeypressMessage &msg) {
 		_G(messages).print("Get Chest!\nPlr to search-");
 		startInteraction(new Interactions::GetChest());
 		return true;
+	case 'H':
+		_G(messages).print("Hand Equipment!\nFrom Player: ");
+		startInteraction(new Interactions::HandEquipment());
+		return true;
+	case 'J':
+		_G(messages).print("Join gold to:");
+		startInteraction(new Interactions::JoinGold());
+		return true;
+	case 'Y':
+		_G(messages).print("Yell, whom? ");
+		startInteraction(new Interactions::Yell());
+		return true;
+	case 'O':
+		_G(messages).print("Other command!\nWhose action? ");
+		startInteraction(new Interactions::OtherCommand());
+		return true;
 	case 'I':
 		_G(messages).print("Ignite a torch\nWhose torch: ");
 		startInteraction(new Interactions::IgniteTorch());
diff --git a/engines/ultima/ultima3/views/interactions/hand_equipment.cpp b/engines/ultima/ultima3/views/interactions/hand_equipment.cpp
new file mode 100644
index 00000000000..e4a768a34cd
--- /dev/null
+++ b/engines/ultima/ultima3/views/interactions/hand_equipment.cpp
@@ -0,0 +1,281 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "ultima/ultima3/views/interactions/hand_equipment.h"
+#include "ultima/ultima3/data/data.h"
+#include "ultima/ultima3/ultima3.h"
+
+namespace Ultima {
+namespace Ultima3 {
+namespace Views {
+namespace Interactions {
+
+constexpr char ESCAPE_KEY = 0x1B;
+constexpr int MAX_QUANTITY = 9999;
+constexpr int MAX_ITEMS = 99;
+
+void HandEquipment::startAmount(int digits, bool rejectLetters) {
+	_G(messages).print(digits == 4 ? "\nHow much? " : (_kind == WEAPONS || _kind == ARMOUR) ?
+		"\nHow many? " : "\nHow much? ");
+	_number.setup(digits, rejectLetters);
+	_stage = ENTER_AMOUNT;
+}
+
+void HandEquipment::startEquipmentMenu() {
+	const Data::Savegame &save = _G(savegame);
+	const bool weapons = _kind == WEAPONS;
+	int letters;
+
+	if (weapons)
+		letters = save._allWeapons ? 16 : (save._plusTwoWeapons ? 15 : 8);
+	else
+		letters = save._allArmour ? 8 : (save._plusTwoArmour ? 7 : 5);
+
+	_keys[0] = 'Q';
+	_keys[1] = ESCAPE_KEY;
+	_words[0] = _words[1] = "Quit";
+
+	for (int i = 0; i < letters; ++i) {
+		_keys[2 + i] = 'A' + i;
+		_words[2 + i] = weapons ? Data::WEAPON_NAMES[i] : Data::ARMOUR_NAMES[i];
+	}
+
+	_G(messages).print("\n");
+	_menu.setup(_keys, _words, 2 + letters);
+	_stage = CHOOSE_EQUIPMENT;
+}
+
+void HandEquipment::transfer() {
+	Data::Savegame &save = _G(savegame);
+	Data::RosterEntry &from = save.partyMember(_giver);
+	Data::RosterEntry &to = save.partyMember(_receiver);
+
+	int amount = _number.value();
+	int have, room;
+	uint16 *wordFrom = nullptr, *wordTo = nullptr;
+	byte *byteFrom = nullptr, *byteTo = nullptr;
+	int limit = MAX_ITEMS;
+
+	switch (_kind) {
+	case FOOD:
+		wordFrom = &from._food;
+		wordTo = &to._food;
+		break;
+	case GOLD:
+		wordFrom = &from._gold;
+		wordTo = &to._gold;
+		break;
+	case GEMS:
+		byteFrom = &from._gems;
+		byteTo = &to._gems;
+		break;
+	case KEYS:
+		byteFrom = &from._keys;
+		byteTo = &to._keys;
+		break;
+	case POWDER:
+		byteFrom = &from._powder;
+		byteTo = &to._powder;
+		break;
+	case TORCHES:
+		byteFrom = &from._torches;
+		byteTo = &to._torches;
+		break;
+	case WEAPONS:
+		byteFrom = &from._weaponOwned[_which - 1];
+		byteTo = &to._weaponOwned[_which - 1];
+		break;
+	default:
+		byteFrom = &from._armourOwned[_which - 1];
+		byteTo = &to._armourOwned[_which - 1];
+		break;
+	}
+
+	if (wordFrom) {
+		have = Data::fromBcdWord(*wordFrom);
+		room = Data::fromBcdWord(*wordTo);
+		limit = MAX_QUANTITY;
+	} else {
+		have = Data::fromBcd(*byteFrom);
+		room = Data::fromBcd(*byteTo);
+	}
+
+	if (amount > have) {
+		_G(messages).print("\nNot enough!");
+		g_engine->playSoundEffect(0xFE);
+		_G(messages).print("\n");
+	} else if (room + amount > limit) {
+		_G(messages).print("\nNo more room!\n");
+		g_engine->playSoundEffect(0xFE);
+	} else {
+		if (wordFrom) {
+			*wordFrom = Data::toBcdWord(have - amount);
+			*wordTo = Data::toBcdWord(room + amount);
+		} else {
+			*byteFrom = Data::toBcd(have - amount);
+			*byteTo = Data::toBcd(room + amount);
+		}
+
+		_G(messages).print("\nDone!\n");
+	}
+}
+
+bool HandEquipment::keypress(const KeypressMessage &msg) {
+	switch (_stage) {
+	case CHOOSE_GIVER: {
+		PlayerChooser::Result result = _players.handleKey(msg);
+		if (result == PlayerChooser::PENDING)
+			return false;
+		if (result == PlayerChooser::CANCELLED)
+			return true;
+
+		_giver = _players.slot();
+		_G(messages).print("  To Player: ");
+		_stage = CHOOSE_RECEIVER;
+		return false;
+	}
+
+	case CHOOSE_RECEIVER: {
+		PlayerChooser::Result result = _players.handleKey(msg);
+		if (result == PlayerChooser::PENDING)
+			return false;
+		if (result == PlayerChooser::CANCELLED)
+			return true;
+
+		_receiver = _players.slot();
+		if (_receiver == _giver) {
+			_G(messages).print("<-What?\n");
+			g_engine->playSoundEffect(0xFE);
+			return true;
+		}
+
+		static const char *const WORDS[7] = { "Food", "Gold", "Equipment", "Weapons", "Armour", "Quit", "Quit" };
+		_G(messages).print("F, G, E, W, A:\n");
+		_menu.setup("FGEWAQ\033", WORDS, 7);
+		_stage = CHOOSE_KIND;
+		return false;
+	}
+
+	case CHOOSE_KIND: {
+		if (!_menu.handleKey(msg))
+			return false;
+
+		switch (_menu.key()) {
+		case 'F':
+		case 'G':
+			_kind = (_menu.key() == 'F') ? FOOD : GOLD;
+			startAmount(4, true);
+			return false;
+
+		case 'E': {
+			static const char *const WORDS[6] = { "Gems", "Keys", "Powder", "Torch", "Quit", "Quit" };
+			_G(messages).print("\nG, K, P, T:\n");
+			_menu.setup("GKPTQ\033", WORDS, 6);
+			_stage = CHOOSE_ITEM;
+			return false;
+		}
+
+		case 'W':
+		case 'A':
+			_kind = (_menu.key() == 'W') ? WEAPONS : ARMOUR;
+			startEquipmentMenu();
+			return false;
+
+		default:
+			_G(messages).print("\n");
+			return true;
+		}
+	}
+
+	case CHOOSE_ITEM: {
+		if (!_menu.handleKey(msg))
+			return false;
+
+		switch (_menu.key()) {
+		case 'G': _kind = GEMS; break;
+		case 'K': _kind = KEYS; break;
+		case 'P': _kind = POWDER; break;
+		case 'T': _kind = TORCHES; break;
+		default:
+			_G(messages).print("\n");
+			return true;
+		}
+
+		startAmount(2, false);
+		return false;
+	}
+
+	case CHOOSE_EQUIPMENT: {
+		if (!_menu.handleKey(msg))
+			return false;
+
+		char key = _menu.key();
+		if (key == 'Q' || key == ESCAPE_KEY) {
+			_G(messages).print("\n");
+			return true;
+		}
+		if (key == 'A') {
+			_G(messages).print("<-What?\n");
+			g_engine->playSoundEffect(0xFE);
+			return true;
+		}
+
+		_which = key - 'A';
+		startAmount(2, false);
+		return false;
+	}
+
+	default: {
+		if (!_number.handleKey(msg))
+			return false;
+
+		if (_number.hasLetters()) {
+			g_engine->playSoundEffect(0xFE);
+			_G(messages).print("\n");
+			return true;
+		}
+
+		// Weapons and armour need to be amounts of more than none, and
+		// the one in use can't be passed on
+		if (_kind == WEAPONS || _kind == ARMOUR) {
+			if (_number.value() == 0) {
+				_G(messages).print("\n");
+				return true;
+			}
+
+			const Data::RosterEntry &from = _G(savegame).partyMember(_giver);
+			if ((_kind == WEAPONS ? from._weaponIndex : from._armourIndex) == _which) {
+				g_engine->playSoundEffect(0xFE);
+				_G(messages).print("\nIn use!\n");
+				return true;
+			}
+		}
+
+		transfer();
+		return true;
+	}
+	}
+}
+
+} // namespace Interactions
+} // namespace Views
+} // namespace Ultima3
+} // namespace Ultima
diff --git a/engines/ultima/ultima3/views/interactions/hand_equipment.h b/engines/ultima/ultima3/views/interactions/hand_equipment.h
new file mode 100644
index 00000000000..1135d465621
--- /dev/null
+++ b/engines/ultima/ultima3/views/interactions/hand_equipment.h
@@ -0,0 +1,88 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef ULTIMA3_VIEWS_INTERACTIONS_HAND_EQUIPMENT_H
+#define ULTIMA3_VIEWS_INTERACTIONS_HAND_EQUIPMENT_H
+
+#include "ultima/ultima3/views/interactions/log_input.h"
+
+namespace Ultima {
+namespace Ultima3 {
+namespace Views {
+namespace Interactions {
+
+/**
+ * Passes food, gold or belongings from one party member to another
+ */
+class HandEquipment : public Interaction {
+private:
+	enum Stage {
+		CHOOSE_GIVER,
+		CHOOSE_RECEIVER,
+		CHOOSE_KIND,
+		CHOOSE_ITEM,
+		CHOOSE_EQUIPMENT,
+		ENTER_AMOUNT
+	};
+
+	// What is being passed on
+	enum Kind {
+		FOOD,
+		GOLD,
+		GEMS,
+		KEYS,
+		POWDER,
+		TORCHES,
+		WEAPONS,
+		ARMOUR
+	};
+
+	Stage _stage = CHOOSE_GIVER;
+	Kind _kind = FOOD;
+	int _giver = 0, _receiver = 0;
+
+	// For weapons and armour, which of them
+	int _which = 0;
+
+	PlayerChooser _players;
+	LogMenu _menu;
+	LogNumber _number;
+	char _keys[20];
+	const char *_words[19];
+
+	void startAmount(int digits, bool rejectLetters);
+	void startEquipmentMenu();
+
+	/**
+	 * Passes the amount entered, saying how it went
+	 */
+	void transfer();
+
+public:
+	bool keypress(const KeypressMessage &msg) override;
+};
+
+} // namespace Interactions
+} // namespace Views
+} // namespace Ultima3
+} // namespace Ultima
+
+#endif
diff --git a/engines/ultima/ultima3/views/interactions/join_gold.cpp b/engines/ultima/ultima3/views/interactions/join_gold.cpp
new file mode 100644
index 00000000000..6ad603545d1
--- /dev/null
+++ b/engines/ultima/ultima3/views/interactions/join_gold.cpp
@@ -0,0 +1,59 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "ultima/ultima3/views/interactions/join_gold.h"
+#include "ultima/ultima3/ultima3.h"
+
+namespace Ultima {
+namespace Ultima3 {
+namespace Views {
+namespace Interactions {
+
+constexpr int MAX_GOLD = 9999;
+
+bool JoinGold::keypress(const KeypressMessage &msg) {
+	PlayerChooser::Result result = _chooser.handleKey(msg);
+	if (result == PlayerChooser::PENDING)
+		return false;
+	if (result == PlayerChooser::CANCELLED)
+		return true;
+
+	Data::Savegame &save = _G(savegame);
+	int total = 0;
+	for (int i = 0; i < save._partySize; ++i)
+		total += Data::fromBcdWord(save.partyMember(i)._gold);
+
+	if (total > MAX_GOLD) {
+		_G(messages).print("No more room!\n");
+		g_engine->playSoundEffect(0xFF);
+		return true;
+	}
+
+	for (int i = 0; i < save._partySize; ++i)
+		save.partyMember(i)._gold = 0;
+	save.partyMember(_chooser.slot())._gold = Data::toBcdWord(total);
+	return true;
+}
+
+} // namespace Interactions
+} // namespace Views
+} // namespace Ultima3
+} // namespace Ultima
diff --git a/engines/ultima/ultima3/views/interactions/join_gold.h b/engines/ultima/ultima3/views/interactions/join_gold.h
new file mode 100644
index 00000000000..d261f3ab46a
--- /dev/null
+++ b/engines/ultima/ultima3/views/interactions/join_gold.h
@@ -0,0 +1,48 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef ULTIMA3_VIEWS_INTERACTIONS_JOIN_GOLD_H
+#define ULTIMA3_VIEWS_INTERACTIONS_JOIN_GOLD_H
+
+#include "ultima/ultima3/views/interactions/log_input.h"
+
+namespace Ultima {
+namespace Ultima3 {
+namespace Views {
+namespace Interactions {
+
+/**
+ * Gathers all the gold of the party together with one member
+ */
+class JoinGold : public Interaction {
+private:
+	PlayerChooser _chooser;
+
+public:
+	bool keypress(const KeypressMessage &msg) override;
+};
+
+} // namespace Interactions
+} // namespace Views
+} // namespace Ultima3
+} // namespace Ultima
+
+#endif
diff --git a/engines/ultima/ultima3/views/interactions/log_input.cpp b/engines/ultima/ultima3/views/interactions/log_input.cpp
index 90f85276239..ea36fd12629 100644
--- a/engines/ultima/ultima3/views/interactions/log_input.cpp
+++ b/engines/ultima/ultima3/views/interactions/log_input.cpp
@@ -56,6 +56,43 @@ LogYesNo::LogYesNo() {
 
 /*------------------------------------------------------------------------*/
 
+void LogText::setup(uint maxChars) {
+	_maxChars = maxChars;
+	_text.clear();
+}
+
+Common::String LogText::word() const {
+	Common::String result = _text;
+	result.trim();
+	result.toUppercase();
+	return result;
+}
+
+bool LogText::handleKey(const KeypressMessage &msg) {
+	if (isModifierKey(msg.keycode))
+		return false;
+
+	if (msg.keycode == Common::KEYCODE_RETURN || msg.keycode == Common::KEYCODE_KP_ENTER)
+		return true;
+
+	if (msg.keycode == Common::KEYCODE_BACKSPACE || msg.keycode == Common::KEYCODE_LEFT ||
+			msg.keycode == Common::KEYCODE_DELETE) {
+		if (_text.empty()) {
+			g_engine->playSoundEffect(0xFE);
+		} else {
+			_text.deleteLastChar();
+			_G(messages).backspace(1);
+		}
+	} else if (msg.ascii >= 0x20 && msg.ascii < 0x80 && _text.size() < _maxChars) {
+		_text += (char)msg.ascii;
+		_G(messages).putChar((char)msg.ascii);
+	} else {
+		g_engine->playSoundEffect(0xFE);
+	}
+
+	return false;
+}
+
 void LogNumber::setup(int maxDigits, bool rejectLetters) {
 	_maxDigits = maxDigits;
 	_rejectLetters = rejectLetters;
diff --git a/engines/ultima/ultima3/views/interactions/log_input.h b/engines/ultima/ultima3/views/interactions/log_input.h
index 53a2839f4cd..fdc1381809a 100644
--- a/engines/ultima/ultima3/views/interactions/log_input.h
+++ b/engines/ultima/ultima3/views/interactions/log_input.h
@@ -81,6 +81,28 @@ public:
 	}
 };
 
+/**
+ * A line of text typed in the message window
+ */
+class LogText {
+private:
+	uint _maxChars = 0;
+	Common::String _text;
+
+public:
+	void setup(uint maxChars);
+
+	/**
+	 * Handles a keypress, returning true once the line has been accepted
+	 */
+	bool handleKey(const KeypressMessage &msg);
+
+	/**
+	 * Returns what was typed, in upper case with any spaces from around it removed
+	 */
+	Common::String word() const;
+};
+
 /**
  * A number typed in the message window, as a couple of digits or as a
  * quantity of up to four. Letters from A to F are taken as digits too
diff --git a/engines/ultima/ultima3/views/interactions/other_command.cpp b/engines/ultima/ultima3/views/interactions/other_command.cpp
new file mode 100644
index 00000000000..24c54cf61c9
--- /dev/null
+++ b/engines/ultima/ultima3/views/interactions/other_command.cpp
@@ -0,0 +1,192 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "ultima/ultima3/views/interactions/other_command.h"
+#include "ultima/ultima3/data/data.h"
+#include "ultima/ultima3/ultima3.h"
+
+namespace Ultima {
+namespace Ultima3 {
+namespace Views {
+namespace Interactions {
+
+constexpr int COMMAND_LENGTH = 10;
+constexpr byte SHRINE_TILE = 0x3E;
+constexpr byte GUARD_TILE = 0x48;
+constexpr int BRIBE_COST = 100;
+
+// The places on the world map where something can be dug up
+constexpr byte WEAPON_SPOT_X = 0x21, WEAPON_SPOT_Y = 0x03;
+constexpr byte ARMOUR_SPOT_X = 0x13, ARMOUR_SPOT_Y = 0x2C;
+
+// The place in Yew where praying gives a hint
+constexpr byte PRAYER_TOWN_X = 0x22;
+constexpr byte PRAYER_X = 0x30, PRAYER_Y = 0x30;
+
+static void noEffect() {
+	_G(messages).print("No effect!\n");
+}
+
+void OtherCommand::dig() {
+	Data::Savegame &save = _G(savegame);
+	Data::RosterEntry &e = save.partyMember(_players.slot());
+
+	if (save._location != Data::LOCATION_SOSARIA) {
+		noEffect();
+		return;
+	}
+
+	// Digging in the right place turns up the exotic weapon or armour
+	if (save._posX == WEAPON_SPOT_X && save._posY == WEAPON_SPOT_Y) {
+		byte &owned = e._weaponOwned[Data::WEAPON_COUNT - 2];
+		owned = Data::toBcd(MIN(Data::fromBcd(owned) + 1, 99));
+		save._allWeapons = save._plusTwoWeapons = true;
+	} else if (save._posX == ARMOUR_SPOT_X && save._posY == ARMOUR_SPOT_Y) {
+		byte &owned = e._armourOwned[Data::ARMOUR_COUNT - 2];
+		owned = Data::toBcd(MIN(Data::fromBcd(owned) + 1, 99));
+		save._allArmour = save._plusTwoArmour = true;
+	} else {
+		noEffect();
+		return;
+	}
+
+	_G(messages).print("Exotics!\n");
+}
+
+void OtherCommand::search() {
+	const Data::Savegame &save = _G(savegame);
+	Data::RosterEntry &e = _G(savegame).partyMember(_players.slot());
+
+	// A card is found on one of the four shrines
+	if (_G(map).tile(save._posX, save._posY) != SHRINE_TILE) {
+		noEffect();
+		return;
+	}
+
+	e._marksAndCards |= 1 << (save._posX & 3);
+	_G(messages).print("A card, with\nstrange marks!\n");
+}
+
+void OtherCommand::pray() {
+	const Data::Savegame &save = _G(savegame);
+
+	if (save._location == Data::LOCATION_TOWN && save._worldX == PRAYER_TOWN_X &&
+			save._posX == PRAYER_X && save._posY == PRAYER_Y)
+		_G(messages).print("Yell 'Evocare'\n\n");
+	else
+		noEffect();
+}
+
+bool OtherCommand::bribe(Direction dir) {
+	Data::Savegame &save = _G(savegame);
+	Data::RosterEntry &e = save.partyMember(_players.slot());
+	Data::Creatures &c = _G(map)._creatures;
+
+	int x = save._posX + (dir == DIR_EAST ? 1 : (dir == DIR_WEST ? -1 : 0));
+	int y = save._posY + (dir == DIR_SOUTH ? 1 : (dir == DIR_NORTH ? -1 : 0));
+	x &= Data::MAP_SIZE - 1;
+	y &= Data::MAP_SIZE - 1;
+
+	// A guard can be paid off, to go away
+	for (int i = 0; i < Data::CREATURE_COUNT; ++i) {
+		if (!c._tile[i] || c._x[i] != x || c._y[i] != y || c._tile[i] != GUARD_TILE)
+			continue;
+
+		int gold = Data::fromBcdWord(e._gold);
+		if (gold < BRIBE_COST) {
+			_G(messages).print("Not enough gold!\n");
+			g_engine->playSoundEffect(0xFF);
+			return true;
+		}
+
+		e._gold = Data::toBcdWord(gold - BRIBE_COST);
+		_G(map).setCell(x, y, c._floor[i]);
+		c._tile[i] = 0;
+		return true;
+	}
+
+	noEffect();
+	return true;
+}
+
+bool OtherCommand::keypress(const KeypressMessage &msg) {
+	Data::Savegame &save = _G(savegame);
+
+	switch (_stage) {
+	case CHOOSE_PLAYER: {
+		PlayerChooser::Result result = _players.handleKey(msg);
+		if (result == PlayerChooser::PENDING)
+			return false;
+		if (result == PlayerChooser::CANCELLED)
+			return true;
+
+		if (!save.partyMember(_players.slot()).isAlive()) {
+			_G(messages).print("Incapacitated!\n");
+			g_engine->playSoundEffect(0xFF);
+			return true;
+		}
+
+		_G(messages).print("Cmd: ");
+		_text.setup(COMMAND_LENGTH);
+		_stage = TYPE_COMMAND;
+		return false;
+	}
+
+	case TYPE_COMMAND: {
+		if (!_text.handleKey(msg))
+			return false;
+
+		_G(messages).print("\n");
+		Common::String word = _text.word();
+
+		if (word == "DIG") {
+			dig();
+		} else if (word == "SEARCH") {
+			search();
+		} else if (word == "PRAY") {
+			pray();
+		} else if (word == "BRIBE") {
+			_G(messages).print("Direct? ");
+			_stage = DIRECTION;
+			return false;
+		} else {
+			noEffect();
+		}
+
+		return true;
+	}
+
+	default: {
+		DirectionChooser::Result result = _directions.handleKey(msg);
+		if (result == DirectionChooser::PENDING)
+			return false;
+		if (result == DirectionChooser::CANCELLED)
+			return true;
+
+		return bribe(_directions.direction());
+	}
+	}
+}
+
+} // namespace Interactions
+} // namespace Views
+} // namespace Ultima3
+} // namespace Ultima
diff --git a/engines/ultima/ultima3/views/interactions/other_command.h b/engines/ultima/ultima3/views/interactions/other_command.h
new file mode 100644
index 00000000000..5e49bf56dbc
--- /dev/null
+++ b/engines/ultima/ultima3/views/interactions/other_command.h
@@ -0,0 +1,63 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef ULTIMA3_VIEWS_INTERACTIONS_OTHER_COMMAND_H
+#define ULTIMA3_VIEWS_INTERACTIONS_OTHER_COMMAND_H
+
+#include "ultima/ultima3/views/interactions/log_input.h"
+
+namespace Ultima {
+namespace Ultima3 {
+namespace Views {
+namespace Interactions {
+
+/**
+ * Has a party member carry out a command typed in as a word, such as digging
+ * or searching
+ */
+class OtherCommand : public Interaction {
+private:
+	enum Stage {
+		CHOOSE_PLAYER,
+		TYPE_COMMAND,
+		DIRECTION
+	};
+
+	Stage _stage = CHOOSE_PLAYER;
+	PlayerChooser _players;
+	LogText _text;
+	DirectionChooser _directions;
+
+	void dig();
+	void search();
+	void pray();
+	bool bribe(Direction dir);
+
+public:
+	bool keypress(const KeypressMessage &msg) override;
+};
+
+} // namespace Interactions
+} // namespace Views
+} // namespace Ultima3
+} // namespace Ultima
+
+#endif
diff --git a/engines/ultima/ultima3/views/interactions/yell.cpp b/engines/ultima/ultima3/views/interactions/yell.cpp
new file mode 100644
index 00000000000..66d990c85b9
--- /dev/null
+++ b/engines/ultima/ultima3/views/interactions/yell.cpp
@@ -0,0 +1,85 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "ultima/ultima3/views/interactions/yell.h"
+#include "ultima/ultima3/ultima3.h"
+
+namespace Ultima {
+namespace Ultima3 {
+namespace Views {
+namespace Interactions {
+
+constexpr int WORD_LENGTH = 9;
+constexpr byte MARK_OF_SNAKE = 0x40;
+
+// The place by the water where the right word carries the party across
+constexpr byte CROSSING_X = 0x0A;
+constexpr byte CROSSING_NEAR_Y = 0x38;
+constexpr byte CROSSING_FAR_Y = 0x3B;
+
+bool Yell::keypress(const KeypressMessage &msg) {
+	Data::Savegame &save = _G(savegame);
+
+	if (!_asking) {
+		PlayerChooser::Result result = _players.handleKey(msg);
+		if (result == PlayerChooser::PENDING)
+			return false;
+		if (result == PlayerChooser::CANCELLED)
+			return true;
+
+		if (!save.partyMember(_players.slot()).isAlive()) {
+			_G(messages).print("Incapacitated!\n");
+			g_engine->playSoundEffect(0xFF);
+			return true;
+		}
+
+		_G(messages).print("Word: ");
+		_text.setup(WORD_LENGTH);
+		_asking = true;
+		return false;
+	}
+
+	if (!_text.handleKey(msg))
+		return false;
+
+	_G(messages).print("\n");
+
+	// Only the right word, said by someone with the Mark of Snake at the
+	// right place on the world map, does anything
+	const Data::RosterEntry &e = save.partyMember(_players.slot());
+	const bool atCrossing = save._location == Data::LOCATION_SOSARIA && save._posX == CROSSING_X &&
+		(save._posY == CROSSING_NEAR_Y || save._posY == CROSSING_FAR_Y);
+
+	if (_text.word() == "EVOCARE" && (e._marksAndCards & MARK_OF_SNAKE) && atCrossing) {
+		save._posY ^= 3;
+		_G(effects).flashViewport();
+		g_engine->playSoundEffect(0xFD);
+	} else {
+		_G(messages).print("No effect!\n");
+	}
+
+	return true;
+}
+
+} // namespace Interactions
+} // namespace Views
+} // namespace Ultima3
+} // namespace Ultima
diff --git a/engines/ultima/ultima3/views/interactions/yell.h b/engines/ultima/ultima3/views/interactions/yell.h
new file mode 100644
index 00000000000..1b207d4782f
--- /dev/null
+++ b/engines/ultima/ultima3/views/interactions/yell.h
@@ -0,0 +1,50 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef ULTIMA3_VIEWS_INTERACTIONS_YELL_H
+#define ULTIMA3_VIEWS_INTERACTIONS_YELL_H
+
+#include "ultima/ultima3/views/interactions/log_input.h"
+
+namespace Ultima {
+namespace Ultima3 {
+namespace Views {
+namespace Interactions {
+
+/**
+ * Has a party member shout a word, which can have an effect in the right place
+ */
+class Yell : public Interaction {
+private:
+	PlayerChooser _players;
+	LogText _text;
+	bool _asking = false;
+
+public:
+	bool keypress(const KeypressMessage &msg) override;
+};
+
+} // namespace Interactions
+} // namespace Views
+} // namespace Ultima3
+} // namespace Ultima
+
+#endif
diff --git a/engines/ultima/ultima3/views/location_map.cpp b/engines/ultima/ultima3/views/location_map.cpp
index 8abd8859fd0..c3744b2c4e0 100644
--- a/engines/ultima/ultima3/views/location_map.cpp
+++ b/engines/ultima/ultima3/views/location_map.cpp
@@ -23,6 +23,10 @@
 #include "ultima/ultima3/views/menu_input.h"
 #include "ultima/ultima3/views/interactions/cast_spell.h"
 #include "ultima/ultima3/views/interactions/get_chest.h"
+#include "ultima/ultima3/views/interactions/hand_equipment.h"
+#include "ultima/ultima3/views/interactions/join_gold.h"
+#include "ultima/ultima3/views/interactions/other_command.h"
+#include "ultima/ultima3/views/interactions/yell.h"
 #include "ultima/ultima3/views/interactions/negate_time.h"
 #include "ultima/ultima3/views/interactions/look.h"
 #include "ultima/ultima3/views/interactions/steal_chest.h"
@@ -278,6 +282,27 @@ void LocationMap::doEnter() {
 	}
 }
 
+void LocationMap::doQuitSave() {
+	const Data::Savegame &save = _G(savegame);
+	_G(messages).print("Quit & Save\n");
+
+	if (save._location != Data::LOCATION_SOSARIA) {
+		_G(messages).print("Only on surface!\n");
+		g_engine->playSoundEffect(0xFF);
+		endTurn();
+		return;
+	}
+
+	_G(messages).print(Common::String::format("%02X%02X%02X%02X moves\n", save._moveCount[3],
+		save._moveCount[2], save._moveCount[1], save._moveCount[0]).c_str());
+	_G(messages).print("Please wait...\n");
+
+	// The game carries on afterwards, so this is just a save made from within it
+	redraw();
+	g_engine->saveGameDialog();
+	endTurn();
+}
+
 void LocationMap::doExitVehicle() {
 	_G(messages).print("X-it ");
 
@@ -341,6 +366,25 @@ bool LocationMap::handleCommand(const KeypressMessage &msg) {
 		_G(messages).print("Steal Chest!\nPlayer? ");
 		startInteraction(new Interactions::StealChest());
 		return true;
+	case 'H':
+		_G(messages).print("Hand Equipment!\nFrom Player: ");
+		startInteraction(new Interactions::HandEquipment());
+		return true;
+	case 'J':
+		_G(messages).print("Join gold to:");
+		startInteraction(new Interactions::JoinGold());
+		return true;
+	case 'Y':
+		_G(messages).print("Yell, whom? ");
+		startInteraction(new Interactions::Yell());
+		return true;
+	case 'O':
+		_G(messages).print("Other command!\nWhose action? ");
+		startInteraction(new Interactions::OtherCommand());
+		return true;
+	case 'Q':
+		doQuitSave();
+		return true;
 	case 'I':
 		_G(messages).print("Ignite a torch\n");
 		commandFailed("Not Here!\n", 0xFF);
diff --git a/engines/ultima/ultima3/views/location_map.h b/engines/ultima/ultima3/views/location_map.h
index 7303d094eb9..3b2157917cd 100644
--- a/engines/ultima/ultima3/views/location_map.h
+++ b/engines/ultima/ultima3/views/location_map.h
@@ -65,6 +65,7 @@ private:
 	void doInvalid();
 	void doBoard();
 	void doEnter();
+	void doQuitSave();
 	void doAttack();
 	void doExitVehicle();
 


Commit: 10b19db40622184f55dc4db43a1db5162934a1e7
    https://github.com/scummvm/scummvm/commit/10b19db40622184f55dc4db43a1db5162934a1e7
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:41:01+11:00

Commit Message:
ULTIMA: ULTIMA3: Add peering at a gem and the vision spell

Changed paths:
  A engines/ultima/ultima3/gfx/overview.cpp
  A engines/ultima/ultima3/gfx/overview.h
  A engines/ultima/ultima3/views/interactions/peer_gem.cpp
  A engines/ultima/ultima3/views/interactions/peer_gem.h
    engines/ultima/module.mk
    engines/ultima/ultima3/ultima3.h
    engines/ultima/ultima3/views/dungeon_map.cpp
    engines/ultima/ultima3/views/game.cpp
    engines/ultima/ultima3/views/interactions/cast_spell.cpp
    engines/ultima/ultima3/views/interactions/cast_spell.h
    engines/ultima/ultima3/views/location_map.cpp


diff --git a/engines/ultima/module.mk b/engines/ultima/module.mk
index ebbc81b1b61..9dbcae4428a 100644
--- a/engines/ultima/module.mk
+++ b/engines/ultima/module.mk
@@ -172,6 +172,7 @@ MODULE_OBJS += \
 	ultima3/gfx/charset.o \
 	ultima3/gfx/dungeon_view.o \
 	ultima3/gfx/message_log.o \
+	ultima3/gfx/overview.o \
 	ultima3/gfx/pic_decoder.o \
 	ultima3/gfx/shapes.o \
 	ultima3/logic/chest_logic.o \
@@ -201,6 +202,7 @@ MODULE_OBJS += \
 	ultima3/views/interactions/look.o \
 	ultima3/views/interactions/negate_time.o \
 	ultima3/views/interactions/other_command.o \
+	ultima3/views/interactions/peer_gem.o \
 	ultima3/views/interactions/shops.o \
 	ultima3/views/interactions/steal_chest.o \
 	ultima3/views/interactions/transact.o \
diff --git a/engines/ultima/ultima3/gfx/overview.cpp b/engines/ultima/ultima3/gfx/overview.cpp
new file mode 100644
index 00000000000..c6cc69025c7
--- /dev/null
+++ b/engines/ultima/ultima3/gfx/overview.cpp
@@ -0,0 +1,162 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "ultima/ultima3/gfx/overview.h"
+#include "ultima/ultima3/ultima3.h"
+
+namespace Ultima {
+namespace Ultima3 {
+namespace Gfx {
+
+constexpr int SCREEN_OFFSET = 0x20;
+constexpr int STEPS_PER_FLICKER = 2;
+constexpr char GLYPH_PARTY = '*';
+
+// The pixels of a square that the party flickers in, in the order they're changed
+static const int FLICKER_X[4] = { 0, 1, 1, 0 };
+static const int FLICKER_Y[4] = { 0, 1, 0, 1 };
+
+void Overview::plot(int x, int y, int value) {
+	_pixels[y * MAP_SIZE * 2 + x] ^= value;
+}
+
+void Overview::showMap() {
+	const Data::Savegame &save = _G(savegame);
+	memset(_pixels, 0, sizeof(_pixels));
+
+	// Each square of the map becomes a block of four pixels with a shape
+	// depending on what's in it
+	for (int y = 0; y < MAP_SIZE; ++y) {
+		for (int x = 0; x < MAP_SIZE; ++x) {
+			byte cell = _G(map).cell(x, y);
+			int px = x * 2, py = y * 2;
+
+			switch (cell) {
+			case 0:
+				break;
+			case 4:
+				plot(px + 1, py + (x & 1), 1);
+				break;
+			case 8:
+				plot(px + 1, py + 1, 1);
+				break;
+			case 0x0C:
+				plot(px + 1, py, 1);
+				plot(px + 1, py + 1, 1);
+				break;
+			case 0x10:
+			case 0x8C:
+				plot(px, py, 3);
+				plot(px, py + 1, 3);
+				plot(px + 1, py, 3);
+				plot(px + 1, py + 1, 3);
+				break;
+			case 0x20:
+				plot(px, py, 3);
+				plot(px, py + 1, 3);
+				break;
+			default:
+				plot(px, py, 3);
+				plot(px + 1, py, 3);
+				break;
+			}
+		}
+	}
+
+	_partyX = save._posX;
+	_partyY = save._posY;
+	_step = 0;
+	memset(_lit, 0, sizeof(_lit));
+	_type = WORLD;
+}
+
+void Overview::showLevel() {
+	const Data::Savegame &save = _G(savegame);
+
+	for (int y = 0; y < DUNGEON_SIZE; ++y) {
+		for (int x = 0; x < DUNGEON_SIZE; ++x) {
+			byte tile = _G(dungeon).tile(save._dungeonLevel, x, y);
+			byte glyph;
+
+			switch (tile) {
+			case 0xC0: glyph = 1; break;
+			case 0xA0: glyph = 2; break;
+			case 0x80: glyph = 3; break;
+			case 0x30: glyph = 4; break;
+			case 0x20: glyph = 5; break;
+			case 0x10: glyph = 6; break;
+			case 0: glyph = 0; break;
+			default: glyph = '?'; break;
+			}
+
+			_glyphs[y * DUNGEON_SIZE + x] = glyph;
+		}
+	}
+
+	_partyX = save._posX;
+	_partyY = save._posY;
+	_step = 0;
+	_type = LEVEL;
+}
+
+void Overview::tick() {
+	if (_type == NONE)
+		return;
+
+	++_step;
+	if (_type == WORLD && _step % STEPS_PER_FLICKER == 0) {
+		int which = (_step / STEPS_PER_FLICKER) & 3;
+		_lit[which] = !_lit[which];
+	}
+}
+
+void Overview::draw(Graphics::Views::GfxSurface &s) const {
+	if (_type == WORLD) {
+		for (int y = 0; y < MAP_SIZE * 2; ++y) {
+			for (int x = 0; x < MAP_SIZE * 2; ++x) {
+				int value = _pixels[y * MAP_SIZE * 2 + x];
+
+				// The flickering shows up as the opposite of what's there
+				for (int i = 0; i < 4; ++i) {
+					if (_lit[i] && x == _partyX * 2 + FLICKER_X[i] && y == _partyY * 2 + FLICKER_Y[i])
+						value ^= 3;
+				}
+
+				if (value)
+					s.setPixel(SCREEN_OFFSET + x, SCREEN_OFFSET + y, value);
+			}
+		}
+	} else if (_type == LEVEL) {
+		const int column = SCREEN_OFFSET / 8, row = SCREEN_OFFSET / 8;
+
+		for (int y = 0; y < DUNGEON_SIZE; ++y) {
+			for (int x = 0; x < DUNGEON_SIZE; ++x)
+				s.writeChar(Common::Point(column + x, row + y), _glyphs[y * DUNGEON_SIZE + x]);
+		}
+
+		bool shown = (_step / (STEPS_PER_FLICKER * 2)) & 1;
+		s.writeChar(Common::Point(column + _partyX, row + _partyY), shown ? GLYPH_PARTY : ' ');
+	}
+}
+
+} // namespace Gfx
+} // namespace Ultima3
+} // namespace Ultima
diff --git a/engines/ultima/ultima3/gfx/overview.h b/engines/ultima/ultima3/gfx/overview.h
new file mode 100644
index 00000000000..5b732b47c64
--- /dev/null
+++ b/engines/ultima/ultima3/gfx/overview.h
@@ -0,0 +1,88 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef ULTIMA3_GFX_OVERVIEW_H
+#define ULTIMA3_GFX_OVERVIEW_H
+
+#include "graphics/views/gfx_surface.h"
+
+namespace Ultima {
+namespace Ultima3 {
+namespace Gfx {
+
+/**
+ * The picture of the whole of a map or dungeon level that a gem or a vision
+ * shows, with the position of the party flickering on it
+ */
+class Overview {
+private:
+	static const int MAP_SIZE = 64;
+	static const int DUNGEON_SIZE = 16;
+
+	enum Type {
+		NONE,
+		WORLD,
+		LEVEL
+	};
+
+	Type _type = NONE;
+	byte _pixels[MAP_SIZE * 2 * MAP_SIZE * 2] = {};
+	byte _glyphs[DUNGEON_SIZE * DUNGEON_SIZE] = {};
+	int _partyX = 0, _partyY = 0;
+	int _step = 0;
+
+	// Which of the four pixels the party flickers in have been lit
+	bool _lit[4] = {};
+
+	void plot(int x, int y, int value);
+
+public:
+	/**
+	 * Builds the picture of the current map
+	 */
+	void showMap();
+
+	/**
+	 * Builds the picture of the current level of the dungeon
+	 */
+	void showLevel();
+
+	void hide() {
+		_type = NONE;
+	}
+
+	bool isActive() const {
+		return _type != NONE;
+	}
+
+	/**
+	 * Moves the flickering of the party's position on a step
+	 */
+	void tick();
+
+	void draw(Graphics::Views::GfxSurface &s) const;
+};
+
+} // namespace Gfx
+} // namespace Ultima3
+} // namespace Ultima
+
+#endif
diff --git a/engines/ultima/ultima3/ultima3.h b/engines/ultima/ultima3/ultima3.h
index a5527827c06..622cb18d718 100644
--- a/engines/ultima/ultima3/ultima3.h
+++ b/engines/ultima/ultima3/ultima3.h
@@ -36,6 +36,7 @@
 #include "ultima/ultima3/data/map.h"
 #include "ultima/ultima3/data/savegame.h"
 #include "ultima/ultima3/gfx/message_log.h"
+#include "ultima/ultima3/gfx/overview.h"
 #include "ultima/ultima3/gfx/screen_effects.h"
 #include "ultima/ultima3/gfx/shapes.h"
 #include "ultima/ultima3/logic/combat_logic.h"
@@ -98,6 +99,7 @@ public:
 	CombatLogic _combat;
 	Gfx::Shapes _shapes;
 	Gfx::MessageLog _messages;
+	Gfx::Overview _overview;
 	Gfx::ScreenEffects _effects;
 	byte _windDirection = 0;
 
diff --git a/engines/ultima/ultima3/views/dungeon_map.cpp b/engines/ultima/ultima3/views/dungeon_map.cpp
index 73245fc96f2..8ba703c73df 100644
--- a/engines/ultima/ultima3/views/dungeon_map.cpp
+++ b/engines/ultima/ultima3/views/dungeon_map.cpp
@@ -27,6 +27,7 @@
 #include "ultima/ultima3/views/interactions/hand_equipment.h"
 #include "ultima/ultima3/views/interactions/join_gold.h"
 #include "ultima/ultima3/views/interactions/other_command.h"
+#include "ultima/ultima3/views/interactions/peer_gem.h"
 #include "ultima/ultima3/views/interactions/yell.h"
 #include "ultima/ultima3/views/interactions/ignite_torch.h"
 #include "ultima/ultima3/views/interactions/negate_time.h"
@@ -253,6 +254,10 @@ bool DungeonMap::handleCommand(const KeypressMessage &msg) {
 		_G(messages).print("Get Chest!\nPlr to search-");
 		startInteraction(new Interactions::GetChest());
 		return true;
+	case 'P':
+		_G(messages).print("Peer at gem!\nWhose gem? ");
+		startInteraction(new Interactions::PeerGem());
+		return true;
 	case 'H':
 		_G(messages).print("Hand Equipment!\nFrom Player: ");
 		startInteraction(new Interactions::HandEquipment());
diff --git a/engines/ultima/ultima3/views/game.cpp b/engines/ultima/ultima3/views/game.cpp
index 4f7bf8735e1..3acfe12eddb 100644
--- a/engines/ultima/ultima3/views/game.cpp
+++ b/engines/ultima/ultima3/views/game.cpp
@@ -99,6 +99,7 @@ void Game::timeout() {
 	_G(shapes).animate();
 	_G(effects).tick();
 	updateWind();
+	_G(overview).tick();
 	processFrame();
 
 	if (!_gameOver && !_interaction && isWaiting() && ++_idleFrames >= IDLE_FRAMES)
@@ -267,7 +268,14 @@ void Game::draw() {
 	drawFrame(s);
 	drawPartyStatus(s);
 	drawLabels(s);
-	drawViewport(s);
+
+	if (_G(overview).isActive()) {
+		// A picture of the whole place takes over from the usual view
+		s.fillRect(Common::Rect(8, 8, 184, 184), 0);
+		_G(overview).draw(s);
+	} else {
+		drawViewport(s);
+	}
 	_G(messages).draw(s, !_gameOver);
 
 	Gfx::ScreenEffects &fx = _G(effects);
diff --git a/engines/ultima/ultima3/views/interactions/cast_spell.cpp b/engines/ultima/ultima3/views/interactions/cast_spell.cpp
index 7cca925d155..a78ca368cd1 100644
--- a/engines/ultima/ultima3/views/interactions/cast_spell.cpp
+++ b/engines/ultima/ultima3/views/interactions/cast_spell.cpp
@@ -234,6 +234,19 @@ bool CastSpell::perform(Effect effect) {
 		_stage = TARGET;
 		return false;
 
+	case VISION:
+		if (_inCombat)
+			return fail();
+
+		fanfare();
+		if (save._location == Data::LOCATION_DUNGEON)
+			_G(overview).showLevel();
+		else
+			_G(overview).showMap();
+
+		_stage = OVERVIEW;
+		return false;
+
 	case DESCEND:
 	case ASCEND:
 	case RECALL_FLOOR:
@@ -317,10 +330,21 @@ bool CastSpell::applyToPlayer(int target) {
 	}
 }
 
+CastSpell::~CastSpell() {
+	_G(overview).hide();
+}
+
 bool CastSpell::keypress(const KeypressMessage &msg) {
 	Data::Savegame &save = _G(savegame);
 
 	switch (_stage) {
+	case OVERVIEW:
+		if (isModifierKey(msg.keycode))
+			return false;
+
+		_G(overview).hide();
+		return true;
+
 	case CHOOSE_CASTER: {
 		PlayerChooser::Result result = _players.handleKey(msg);
 		if (result == PlayerChooser::PENDING)
diff --git a/engines/ultima/ultima3/views/interactions/cast_spell.h b/engines/ultima/ultima3/views/interactions/cast_spell.h
index 024996504df..fdb8da92d0e 100644
--- a/engines/ultima/ultima3/views/interactions/cast_spell.h
+++ b/engines/ultima/ultima3/views/interactions/cast_spell.h
@@ -40,7 +40,8 @@ private:
 		CHOOSE_TYPE,
 		CHOOSE_SPELL,
 		DIRECTION,
-		TARGET
+		TARGET,
+		OVERVIEW
 	};
 
 	// The things the spells do
@@ -87,6 +88,7 @@ public:
 	 * @param slot		The party member casting, or -1 to ask who
 	 */
 	CastSpell(int slot = -1);
+	~CastSpell() override;
 
 	bool isFinished() const override {
 		return _finished;
diff --git a/engines/ultima/ultima3/views/interactions/peer_gem.cpp b/engines/ultima/ultima3/views/interactions/peer_gem.cpp
new file mode 100644
index 00000000000..5af5276c713
--- /dev/null
+++ b/engines/ultima/ultima3/views/interactions/peer_gem.cpp
@@ -0,0 +1,72 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "ultima/ultima3/views/interactions/peer_gem.h"
+#include "ultima/ultima3/data/data.h"
+#include "ultima/ultima3/views/menu_input.h"
+#include "ultima/ultima3/ultima3.h"
+
+namespace Ultima {
+namespace Ultima3 {
+namespace Views {
+namespace Interactions {
+
+PeerGem::~PeerGem() {
+	_G(overview).hide();
+}
+
+bool PeerGem::keypress(const KeypressMessage &msg) {
+	if (_viewing) {
+		if (isModifierKey(msg.keycode))
+			return false;
+
+		_G(overview).hide();
+		return true;
+	}
+
+	PlayerChooser::Result result = _chooser.handleKey(msg);
+	if (result == PlayerChooser::PENDING)
+		return false;
+	if (result == PlayerChooser::CANCELLED)
+		return true;
+
+	Data::RosterEntry &e = _G(savegame).partyMember(_chooser.slot());
+	if (e._gems == 0) {
+		_G(messages).print("None Left!\n");
+		g_engine->playSoundEffect(0xFE);
+		return true;
+	}
+
+	e._gems = Data::toBcd(Data::fromBcd(e._gems) - 1);
+
+	if (_G(savegame)._location == Data::LOCATION_DUNGEON)
+		_G(overview).showLevel();
+	else
+		_G(overview).showMap();
+
+	_viewing = true;
+	return false;
+}
+
+} // namespace Interactions
+} // namespace Views
+} // namespace Ultima3
+} // namespace Ultima
diff --git a/engines/ultima/ultima3/views/interactions/peer_gem.h b/engines/ultima/ultima3/views/interactions/peer_gem.h
new file mode 100644
index 00000000000..3b01ca705be
--- /dev/null
+++ b/engines/ultima/ultima3/views/interactions/peer_gem.h
@@ -0,0 +1,51 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef ULTIMA3_VIEWS_INTERACTIONS_PEER_GEM_H
+#define ULTIMA3_VIEWS_INTERACTIONS_PEER_GEM_H
+
+#include "ultima/ultima3/views/interactions/interaction.h"
+
+namespace Ultima {
+namespace Ultima3 {
+namespace Views {
+namespace Interactions {
+
+/**
+ * Has a party member use up a gem to see the whole of where they are
+ */
+class PeerGem : public Interaction {
+private:
+	PlayerChooser _chooser;
+	bool _viewing = false;
+
+public:
+	~PeerGem() override;
+
+	bool keypress(const KeypressMessage &msg) override;
+};
+
+} // namespace Interactions
+} // namespace Views
+} // namespace Ultima3
+} // namespace Ultima
+
+#endif
diff --git a/engines/ultima/ultima3/views/location_map.cpp b/engines/ultima/ultima3/views/location_map.cpp
index c3744b2c4e0..c09fb40ae41 100644
--- a/engines/ultima/ultima3/views/location_map.cpp
+++ b/engines/ultima/ultima3/views/location_map.cpp
@@ -26,6 +26,7 @@
 #include "ultima/ultima3/views/interactions/hand_equipment.h"
 #include "ultima/ultima3/views/interactions/join_gold.h"
 #include "ultima/ultima3/views/interactions/other_command.h"
+#include "ultima/ultima3/views/interactions/peer_gem.h"
 #include "ultima/ultima3/views/interactions/yell.h"
 #include "ultima/ultima3/views/interactions/negate_time.h"
 #include "ultima/ultima3/views/interactions/look.h"
@@ -366,6 +367,10 @@ bool LocationMap::handleCommand(const KeypressMessage &msg) {
 		_G(messages).print("Steal Chest!\nPlayer? ");
 		startInteraction(new Interactions::StealChest());
 		return true;
+	case 'P':
+		_G(messages).print("Peer at gem!\nWhose gem? ");
+		startInteraction(new Interactions::PeerGem());
+		return true;
 	case 'H':
 		_G(messages).print("Hand Equipment!\nFrom Player: ");
 		startInteraction(new Interactions::HandEquipment());


Commit: 9632dc7afdc37496ff6623d51e47f436bde7a123
    https://github.com/scummvm/scummvm/commit/9632dc7afdc37496ff6623d51e47f436bde7a123
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:41:01+11:00

Commit Message:
ULTIMA: ULTIMA3: Add moon gates, whirlpools, Ambrosia and the shrines

Changed paths:
  A engines/ultima/ultima3/views/interactions/enter_shrine.cpp
  A engines/ultima/ultima3/views/interactions/enter_shrine.h
    engines/ultima/module.mk
    engines/ultima/ultima3/data/map.h
    engines/ultima/ultima3/data/savegame.cpp
    engines/ultima/ultima3/data/savegame.h
    engines/ultima/ultima3/logic/location_logic.cpp
    engines/ultima/ultima3/logic/location_logic.h
    engines/ultima/ultima3/ultima3.cpp
    engines/ultima/ultima3/views/dungeon_map.cpp
    engines/ultima/ultima3/views/form_party.cpp
    engines/ultima/ultima3/views/game.cpp
    engines/ultima/ultima3/views/game.h
    engines/ultima/ultima3/views/location_map.cpp
    engines/ultima/ultima3/views/location_map.h


diff --git a/engines/ultima/module.mk b/engines/ultima/module.mk
index 9dbcae4428a..f3f9ac1860f 100644
--- a/engines/ultima/module.mk
+++ b/engines/ultima/module.mk
@@ -191,6 +191,7 @@ MODULE_OBJS += \
 	ultima3/views/interactions/cast_spell.o \
 	ultima3/views/interactions/combat_attack.o \
 	ultima3/views/interactions/dungeon_special.o \
+	ultima3/views/interactions/enter_shrine.o \
 	ultima3/views/interactions/equip.o \
 	ultima3/views/interactions/exchange.o \
 	ultima3/views/interactions/get_chest.o \
diff --git a/engines/ultima/ultima3/data/map.h b/engines/ultima/ultima3/data/map.h
index 0f07714a712..c0ec848d9e5 100644
--- a/engines/ultima/ultima3/data/map.h
+++ b/engines/ultima/ultima3/data/map.h
@@ -70,6 +70,14 @@ private:
 public:
 	Creatures _creatures;
 
+	/**
+	 * Returns one of the bytes held after the creatures, which on the world
+	 * map give where the whirlpool is and the way it is heading
+	 */
+	byte &extra(int index) {
+		return _extra[index];
+	}
+
 	/**
 	 * Returns true if a location data file exists
 	 */
diff --git a/engines/ultima/ultima3/data/savegame.cpp b/engines/ultima/ultima3/data/savegame.cpp
index db259e7fa63..06596ee55f1 100644
--- a/engines/ultima/ultima3/data/savegame.cpp
+++ b/engines/ultima/ultima3/data/savegame.cpp
@@ -86,6 +86,11 @@ void Savegame::synchronize(Common::Serializer &s) {
 		s.syncAsByte(_dungeonLevel);
 		s.syncAsByte(_facing);
 	}
+
+	if (s.getVersion() >= 6) {
+		s.syncBytes(_moonPhase, sizeof(_moonPhase));
+		s.syncBytes(_moonCountdown, sizeof(_moonCountdown));
+	}
 }
 
 constexpr int ORIGINAL_ROSTER_SIZE = ROSTER_COUNT * 0x40;
diff --git a/engines/ultima/ultima3/data/savegame.h b/engines/ultima/ultima3/data/savegame.h
index fee3e7977ac..ec2701ef5ab 100644
--- a/engines/ultima/ultima3/data/savegame.h
+++ b/engines/ultima/ultima3/data/savegame.h
@@ -32,6 +32,7 @@ constexpr byte LOCATION_SOSARIA = 0;
 constexpr byte LOCATION_DUNGEON = 1;
 constexpr byte LOCATION_TOWN = 2;
 constexpr byte LOCATION_CASTLE = 3;
+constexpr byte LOCATION_AMBROSIA = 0xFF;
 
 /**
  * The persistent game state: the roster of up to 20 characters, and which
@@ -52,6 +53,11 @@ struct Savegame {
 	byte _worldY = 0;
 	byte _moveCount[4] = {};
 
+	// The phases of the two moons, from 0 to 7, and how long each has left in
+	// its current phase
+	byte _moonPhase[2] = { 0, 0 };
+	byte _moonCountdown[2] = { 0x0C, 4 };
+
 	// How much longer a light spell or torch lasts
 	byte _lightTurns = 0;
 
diff --git a/engines/ultima/ultima3/logic/location_logic.cpp b/engines/ultima/ultima3/logic/location_logic.cpp
index d39a539963a..1ded837227d 100644
--- a/engines/ultima/ultima3/logic/location_logic.cpp
+++ b/engines/ultima/ultima3/logic/location_logic.cpp
@@ -245,6 +245,156 @@ void LocationLogic::exitToWorld() {
 	save._dungeonLevel = 0;
 }
 
+// Moon gates and whirlpools are shown by particular map cells
+constexpr byte CELL_WHIRLPOOL = 0x30;
+constexpr byte CELL_MOON_GATE = 0x88;
+
+// Where the moon gate is found for each phase of the moon
+static const byte GATE_X[8] = { 0x08, 0x39, 0x0F, 0x24, 0x0F, 0x0C, 0x1F, 0x3A };
+static const byte GATE_Y[8] = { 0x08, 0x2E, 0x1B, 0x3A, 0x1D, 0x37, 0x1F, 0x1F };
+
+// The directions a whirlpool may drift in
+static const int8 WHIRLPOOL_DX[8] = { 0, 1, 1, 1, 0, -1, -1, -1 };
+static const int8 WHIRLPOOL_DY[8] = { 1, 1, 0, -1, -1, -1, 0, 1 };
+
+// Where the party wakes up in Ambrosia
+constexpr byte AMBROSIA_START_X = 0x20;
+constexpr byte AMBROSIA_START_Y = 0x36;
+
+// Where a whirlpool turns up after taking the party away
+constexpr byte WHIRLPOOL_RESET_X = 3;
+constexpr int WHIRLPOOL_RESET_Y_RANGE = 0x37;
+constexpr int WHIRLPOOL_RESET_Y_MIN = 7;
+
+static int rollBelow(int limit) {
+	return Graphics::Views::g_events->getRandomNumber(limit - 1);
+}
+
+void LocationLogic::updateMoons() {
+	Data::Savegame &save = _G(savegame);
+	if (save._location != Data::LOCATION_SOSARIA)
+		return;
+
+	const byte oldLeft = save._moonPhase[0], oldRight = save._moonPhase[1];
+
+	// Each moon spends a number of turns in each phase
+	if ((int8)--save._moonCountdown[0] < 0) {
+		save._moonCountdown[0] = 0x0B;
+		save._moonPhase[0] = (save._moonPhase[0] + 1) & 7;
+	}
+	if ((int8)--save._moonCountdown[1] < 0) {
+		save._moonCountdown[1] = 3;
+		save._moonPhase[1] = (save._moonPhase[1] + 1) & 7;
+	}
+
+	// The moon gate follows the left moon, but only moves when the right one changes
+	if (oldRight == save._moonPhase[1])
+		return;
+
+	_G(map).setCell(GATE_X[oldLeft], GATE_Y[oldLeft], CELL_GRASS);
+	_G(map).setCell(GATE_X[save._moonPhase[0]], GATE_Y[save._moonPhase[0]], CELL_MOON_GATE);
+}
+
+bool LocationLogic::isOnMoonGate() const {
+	const Data::Savegame &save = _G(savegame);
+	return _G(map).cell(save._posX, save._posY) == CELL_MOON_GATE;
+}
+
+void LocationLogic::teleportThroughMoonGate() {
+	Data::Savegame &save = _G(savegame);
+
+	// The gate leads to where the right moon points
+	save._posX = GATE_X[save._moonPhase[1]];
+	save._posY = GATE_Y[save._moonPhase[1]];
+	_G(effects).flashViewport();
+	g_engine->playSoundEffect(0xFD);
+}
+
+bool LocationLogic::isOnWhirlpool() const {
+	const Data::Savegame &save = _G(savegame);
+	return _G(map).cell(save._posX, save._posY) == CELL_WHIRLPOOL;
+}
+
+bool LocationLogic::updateWhirlpool() {
+	Data::Savegame &save = _G(savegame);
+	Data::Map &map = _G(map);
+	if (save._location != Data::LOCATION_SOSARIA)
+		return false;
+
+	byte &x = map.extra(0), &y = map.extra(1);
+	byte &dx = map.extra(2), &dy = map.extra(3);
+
+	// Mostly it drifts on in the direction it's going
+	if (rollBelow(8) != 0) {
+		int newX = (x + (int8)dx) & (Data::MAP_SIZE - 1);
+		int newY = (y + (int8)dy) & (Data::MAP_SIZE - 1);
+		byte cell = map.cell(newX, newY);
+
+		if (cell == 0 || cell == CELL_SHIP) {
+			map.setCell(newX, newY, CELL_WHIRLPOOL);
+			map.setCell(x, y, 0);
+			x = newX;
+			y = newY;
+
+			if (x == save._posX && y == save._posY)
+				return true;
+
+			if (cell == CELL_SHIP) {
+				g_engine->playSoundEffect(0xF4);
+				_G(messages).print(" A ship was\n   Destroyed!\n");
+				return false;
+			}
+
+			return false;
+		}
+	}
+
+	// Or else it sets off in a new direction
+	int heading = rollBelow(8);
+	dx = WHIRLPOOL_DX[heading];
+	dy = WHIRLPOOL_DY[heading];
+
+	return x == save._posX && y == save._posY;
+}
+
+void LocationLogic::teleportToAmbrosia() {
+	Data::Savegame &save = _G(savegame);
+
+	_G(messages).print("\nA huge swirling\n --WhirlPool--\n engulfs you\n and your ship\n dragging both\n     to a\n watery grave!");
+	g_engine->playSoundEffect(0xF4);
+
+	if (save._location == Data::LOCATION_AMBROSIA) {
+		// Coming back, the party finds themselves on a ship again
+		_G(messages).print("\n\n\n\n\n All is Dark!\n\n");
+		_G(map) = _G(worldMap);
+		_G(messages).print(" You made it!\n");
+
+		save._location = Data::LOCATION_SOSARIA;
+		save._posX = save._worldX;
+		save._posY = save._worldY;
+		save._transport = TRANSPORT_SHIP;
+		return;
+	}
+
+	// The whirlpool takes the ship, and is found elsewhere afterwards
+	save._worldX = save._posX;
+	save._worldY = save._posY;
+	_G(map).setCell(save._posX, save._posY, 0);
+	_G(map).extra(0) = WHIRLPOOL_RESET_X;
+	_G(map).extra(1) = rollBelow(WHIRLPOOL_RESET_Y_RANGE) + WHIRLPOOL_RESET_Y_MIN;
+	_G(worldMap) = _G(map);
+
+	_G(messages).print("\n\n As the water\n enters  your\nlungs you pass\ninto Darkness!\n\n");
+	_G(map).load("AMBROSIA.ULT");
+
+	save._transport = TRANSPORT_ON_FOOT;
+	save._posX = AMBROSIA_START_X;
+	save._posY = AMBROSIA_START_Y;
+	save._location = Data::LOCATION_AMBROSIA;
+
+	_G(messages).print("\n You awaken on\n the shores of\n a forgotten\nLand.  Your ship\n and crew lost\n  to the sea!\n");
+}
+
 void LocationLogic::teleportRandomly() {
 	Data::Savegame &save = _G(savegame);
 	Graphics::Views::Events *events = Graphics::Views::g_events;
diff --git a/engines/ultima/ultima3/logic/location_logic.h b/engines/ultima/ultima3/logic/location_logic.h
index eee96b1194b..fa81b6eda87 100644
--- a/engines/ultima/ultima3/logic/location_logic.h
+++ b/engines/ultima/ultima3/logic/location_logic.h
@@ -74,6 +74,32 @@ public:
 	 */
 	void teleportRandomly();
 
+	/**
+	 * Moves the moons on a turn, and the moon gate to where they say
+	 */
+	void updateMoons();
+
+	bool isOnMoonGate() const;
+
+	/**
+	 * Moves the party from a moon gate to the one the moons lead to
+	 */
+	void teleportThroughMoonGate();
+
+	bool isOnWhirlpool() const;
+
+	/**
+	 * Lets the whirlpool of the sea drift on a step
+	 * @returns		True if it has come upon the party
+	 */
+	bool updateWhirlpool();
+
+	/**
+	 * Takes the ship of the party to Ambrosia in a whirlpool, or brings
+	 * them back from there
+	 */
+	void teleportToAmbrosia();
+
 	/**
 	 * Mounts a horse or boards a ship that the party is standing on
 	 * @returns		What to say about it, or null if there's nothing to board
diff --git a/engines/ultima/ultima3/ultima3.cpp b/engines/ultima/ultima3/ultima3.cpp
index 01b7517577b..d3bb0ffb290 100644
--- a/engines/ultima/ultima3/ultima3.cpp
+++ b/engines/ultima/ultima3/ultima3.cpp
@@ -87,14 +87,15 @@ bool Ultima3Engine::canLoadGameStateCurrently(Common::U32String *msg) {
 }
 
 Common::Error Ultima3Engine::syncGame(Common::Serializer &s) {
-	s.syncVersion(5);
+	s.syncVersion(6);
 
 	_savegame.synchronize(s);
 	if (_savegame._mapLoaded) {
 		_map.synchronize(s);
 
 		// The world is kept aside while the party is in a town or castle
-		if (_savegame._location == Data::LOCATION_TOWN || _savegame._location == Data::LOCATION_CASTLE)
+		if (_savegame._location == Data::LOCATION_TOWN || _savegame._location == Data::LOCATION_CASTLE ||
+				_savegame._location == Data::LOCATION_AMBROSIA)
 			_worldMap.synchronize(s);
 
 		if (_savegame._location == Data::LOCATION_DUNGEON && s.getVersion() >= 5)
diff --git a/engines/ultima/ultima3/views/dungeon_map.cpp b/engines/ultima/ultima3/views/dungeon_map.cpp
index 8ba703c73df..7d019cac696 100644
--- a/engines/ultima/ultima3/views/dungeon_map.cpp
+++ b/engines/ultima/ultima3/views/dungeon_map.cpp
@@ -84,13 +84,7 @@ void DungeonMap::processFrame() {
 void DungeonMap::drawViewport(GfxSurface &s) {
 	const Data::Savegame &save = _G(savegame);
 
-	if (_G(sceneShown)) {
-		for (int y = 0; y < Data::ARENA_SIZE; ++y) {
-			for (int x = 0; x < Data::ARENA_SIZE; ++x)
-				_G(shapes).drawTile(s, VIEW_LEFT + x * Gfx::SHAPE_SIZE, VIEW_TOP + y * Gfx::SHAPE_SIZE,
-					_G(scene)[y * Data::ARENA_SIZE + x]);
-		}
-	} else if (save._lightTurns > 0) {
+	if (save._lightTurns > 0) {
 		// The view is only redrawn once something has changed it, or the party
 		// has been moved by something other than a command
 		uint32 key = (save._dungeonLevel << 24) | (save._posX << 16) | (save._posY << 8) | save._facing;
@@ -114,6 +108,8 @@ void DungeonMap::drawViewport(GfxSurface &s) {
 void DungeonMap::drawLabels(GfxSurface &s) {
 	const Data::Savegame &save = _G(savegame);
 
+	// The level is written over the middle of the moons' label
+	drawMoons(s);
 	s.writeString(Common::Point(9, 0), Common::String::format("LVL:0%d", save._dungeonLevel + 1));
 	s.writeString(Common::Point(6, 23), Common::String::format("%cHead-%s%c", 0x10,
 		FACING_NAMES[save._facing & 3], 0x11));
diff --git a/engines/ultima/ultima3/views/form_party.cpp b/engines/ultima/ultima3/views/form_party.cpp
index 8239f657275..e8eaeda6531 100644
--- a/engines/ultima/ultima3/views/form_party.cpp
+++ b/engines/ultima/ultima3/views/form_party.cpp
@@ -64,7 +64,7 @@ void FormParty::finish() {
 	} else {
 		// A party that came to grief in a town starts out again on the world map
 		if (_G(savegame)._mapLoaded && (_G(savegame)._location == Data::LOCATION_TOWN ||
-				_G(savegame)._location == Data::LOCATION_CASTLE))
+				_G(savegame)._location == Data::LOCATION_CASTLE || _G(savegame)._location == Data::LOCATION_AMBROSIA))
 			_G(map) = _G(worldMap);
 
 		_G(savegame).formParty();
diff --git a/engines/ultima/ultima3/views/game.cpp b/engines/ultima/ultima3/views/game.cpp
index 3acfe12eddb..c62fae08a98 100644
--- a/engines/ultima/ultima3/views/game.cpp
+++ b/engines/ultima/ultima3/views/game.cpp
@@ -254,6 +254,14 @@ void Game::drawPartyStatus(GfxSurface &s) {
 
 void Game::drawLabels(GfxSurface &s) {
 	drawWind(s);
+	drawMoons(s);
+}
+
+void Game::drawMoons(GfxSurface &s) {
+	const Data::Savegame &save = _G(savegame);
+
+	s.writeString(Common::Point(8, 0), Common::String::format("%c(%X)(%X)%c", GLYPH_LABEL_START,
+		save._moonPhase[0], save._moonPhase[1], GLYPH_LABEL_END));
 }
 
 void Game::drawWind(GfxSurface &s) {
@@ -273,6 +281,15 @@ void Game::draw() {
 		// A picture of the whole place takes over from the usual view
 		s.fillRect(Common::Rect(8, 8, 184, 184), 0);
 		_G(overview).draw(s);
+	} else if (_G(sceneShown)) {
+		// So does a picture of a place that is being visited
+		for (int y = 0; y < Data::ARENA_SIZE; ++y) {
+			for (int x = 0; x < Data::ARENA_SIZE; ++x)
+				_G(shapes).drawTile(s, 8 + x * Gfx::SHAPE_SIZE, 8 + y * Gfx::SHAPE_SIZE,
+					_G(scene)[y * Data::ARENA_SIZE + x]);
+		}
+
+		s.addDirtyRect(Common::Rect(8, 8, 184, 184));
 	} else {
 		drawViewport(s);
 	}
diff --git a/engines/ultima/ultima3/views/game.h b/engines/ultima/ultima3/views/game.h
index 5150a9b1d50..72314e024de 100644
--- a/engines/ultima/ultima3/views/game.h
+++ b/engines/ultima/ultima3/views/game.h
@@ -69,6 +69,18 @@ protected:
 	 */
 	virtual void drawLabels(GfxSurface &s);
 
+	/**
+	 * Draws the label giving the phases of the moons
+	 */
+	void drawMoons(GfxSurface &s);
+
+	/**
+	 * Returns true if a command is part way through being given
+	 */
+	bool hasInteraction() const {
+		return _interaction.get() != nullptr;
+	}
+
 	/**
 	 * Called when no command has been given for several seconds
 	 */
diff --git a/engines/ultima/ultima3/views/interactions/enter_shrine.cpp b/engines/ultima/ultima3/views/interactions/enter_shrine.cpp
new file mode 100644
index 00000000000..3096320e990
--- /dev/null
+++ b/engines/ultima/ultima3/views/interactions/enter_shrine.cpp
@@ -0,0 +1,115 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "common/file.h"
+#include "ultima/ultima3/views/interactions/enter_shrine.h"
+#include "ultima/ultima3/data/data.h"
+#include "ultima/ultima3/ultima3.h"
+
+namespace Ultima {
+namespace Ultima3 {
+namespace Views {
+namespace Interactions {
+
+constexpr int ATTRIBUTES = 4;
+
+// The names of the four shrines, and the most each race can gain at each of them
+static const char *const SHRINE_NAMES[ATTRIBUTES] = {
+	"    Strength\n\n", "   Dexterity\n\n", "  Intelligence\n\n", "     Wisdom\n\n"
+};
+
+static const byte ATTRIBUTE_LIMITS[Data::RACE_COUNT][ATTRIBUTES] = {
+	{ 0x75, 0x75, 0x75, 0x75 }, { 0x75, 0x99, 0x75, 0x50 }, { 0x99, 0x75, 0x50, 0x75 },
+	{ 0x75, 0x50, 0x75, 0x99 }, { 0x25, 0x99, 0x99, 0x75 }
+};
+
+EnterShrine::~EnterShrine() {
+	_G(sceneShown) = false;
+}
+
+bool EnterShrine::keypress(const KeypressMessage &msg) {
+	Data::Savegame &save = _G(savegame);
+
+	if (!_offering) {
+		PlayerChooser::Result result = _chooser.handleKey(msg);
+		if (result == PlayerChooser::PENDING)
+			return false;
+		if (result == PlayerChooser::CANCELLED)
+			return true;
+
+		if (!save.partyMember(_chooser.slot()).isAlive()) {
+			_G(messages).print("Incapacitated!\n");
+			g_engine->playSoundEffect(0xFF);
+			return true;
+		}
+
+		Common::File f;
+		if (!f.open("SHRINE.IMG") || f.read(_G(scene), sizeof(_G(scene))) != sizeof(_G(scene)))
+			error("Could not load SHRINE.IMG");
+
+		_G(sceneShown) = true;
+		_G(messages).print("\n Welcome to the\n   Shrine of\n");
+		_G(messages).print(SHRINE_NAMES[save._posX & 3]);
+		_G(messages).print("Offering*100-");
+		_number.setup(2);
+		_offering = true;
+		return false;
+	}
+
+	if (!_number.handleKey(msg))
+		return false;
+
+	Data::RosterEntry &e = save.partyMember(_chooser.slot());
+	const int attribute = save._posX & 3;
+	const int offering = _number.hasLetters() ? 0 : _number.value();
+
+	// The offering is made in hundreds of gold
+	if (offering == 0) {
+		_G(messages).print("\nThen be off!\n");
+		return true;
+	}
+
+	if (offering * 100 > Data::fromBcdWord(e._gold)) {
+		_G(messages).print("\nYou can't cheat\nthe Gods!\n");
+		g_engine->playSoundEffect(0xFF);
+		return true;
+	}
+
+	e._gold = Data::toBcdWord(Data::fromBcdWord(e._gold) - offering * 100);
+
+	// Whichever attribute the shrine is for goes up by as much, to the most the race can reach
+	byte *attributes[ATTRIBUTES] = { &e._strength, &e._dexterity, &e._intelligence, &e._wisdom };
+	int race = Data::lookupIndex(e._race, Data::RACE_KEYS, Data::RACE_COUNT);
+	int limit = Data::fromBcd(ATTRIBUTE_LIMITS[race][attribute]);
+
+	*attributes[attribute] = Data::toBcd(MIN(Data::fromBcd(*attributes[attribute]) + offering, limit));
+
+	_G(messages).print("\nShazam!\n");
+	_G(effects).flashSlot(_chooser.slot());
+	_G(effects).flashViewport();
+	g_engine->playSoundEffect(0xFD);
+	return true;
+}
+
+} // namespace Interactions
+} // namespace Views
+} // namespace Ultima3
+} // namespace Ultima
diff --git a/engines/ultima/ultima3/views/interactions/enter_shrine.h b/engines/ultima/ultima3/views/interactions/enter_shrine.h
new file mode 100644
index 00000000000..29084a8babb
--- /dev/null
+++ b/engines/ultima/ultima3/views/interactions/enter_shrine.h
@@ -0,0 +1,53 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef ULTIMA3_VIEWS_INTERACTIONS_ENTER_SHRINE_H
+#define ULTIMA3_VIEWS_INTERACTIONS_ENTER_SHRINE_H
+
+#include "ultima/ultima3/views/interactions/log_input.h"
+
+namespace Ultima {
+namespace Ultima3 {
+namespace Views {
+namespace Interactions {
+
+/**
+ * Has a party member enter a shrine to make an offering of gold, which
+ * improves one of their attributes
+ */
+class EnterShrine : public Interaction {
+private:
+	PlayerChooser _chooser;
+	LogNumber _number;
+	bool _offering = false;
+
+public:
+	~EnterShrine() override;
+
+	bool keypress(const KeypressMessage &msg) override;
+};
+
+} // namespace Interactions
+} // namespace Views
+} // namespace Ultima3
+} // namespace Ultima
+
+#endif
diff --git a/engines/ultima/ultima3/views/location_map.cpp b/engines/ultima/ultima3/views/location_map.cpp
index c09fb40ae41..2601f253e41 100644
--- a/engines/ultima/ultima3/views/location_map.cpp
+++ b/engines/ultima/ultima3/views/location_map.cpp
@@ -22,6 +22,7 @@
 #include "ultima/ultima3/views/location_map.h"
 #include "ultima/ultima3/views/menu_input.h"
 #include "ultima/ultima3/views/interactions/cast_spell.h"
+#include "ultima/ultima3/views/interactions/enter_shrine.h"
 #include "ultima/ultima3/views/interactions/get_chest.h"
 #include "ultima/ultima3/views/interactions/hand_equipment.h"
 #include "ultima/ultima3/views/interactions/join_gold.h"
@@ -39,6 +40,8 @@ namespace Ultima {
 namespace Ultima3 {
 namespace Views {
 
+constexpr int WHIRLPOOL_FRAMES = 4;
+constexpr byte CELL_SHRINE = 0xF8;
 constexpr int VIEWPORT_CELLS = VIEWPORT_TILES * VIEWPORT_TILES;
 constexpr int VIEWPORT_CENTER = VIEWPORT_CELLS / 2;
 constexpr byte TILE_HIDDEN = 0x24;
@@ -88,7 +91,7 @@ void LocationMap::buildViewport(byte *tiles) const {
 	const int half = VIEWPORT_TILES / 2;
 
 	// The world wraps around, whereas beyond the edge of a town is open grass
-	const bool wraps = save._location == Data::LOCATION_SOSARIA;
+	const bool wraps = save._location == Data::LOCATION_SOSARIA || save._location == Data::LOCATION_AMBROSIA;
 
 	for (int row = 0; row < VIEWPORT_TILES; ++row) {
 		for (int col = 0; col < VIEWPORT_TILES; ++col) {
@@ -157,6 +160,22 @@ void LocationMap::endTurn() {
 
 	_logic.processPartyTurnEffects(_G(savegame)._location == Data::LOCATION_SOSARIA);
 
+	// Moon gates take the party to where the moons lead, and whirlpools to Ambrosia
+	bool throughGate = _logic.isOnMoonGate();
+	if (throughGate) {
+		_logic.teleportThroughMoonGate();
+		_logic.updateMoons();
+	} else {
+		_logic.updateMoons();
+		if (_logic.isOnMoonGate()) {
+			_logic.teleportThroughMoonGate();
+			throughGate = true;
+		}
+	}
+
+	if (!throughGate && _logic.isOnWhirlpool())
+		_logic.teleportToAmbrosia();
+
 	// A creature reaching the party starts a fight
 	int creature = _creatures.update(_moved);
 	_moved = false;
@@ -173,6 +192,17 @@ void LocationMap::processFrame() {
 	if (_fightOver) {
 		_fightOver = false;
 		endTurn();
+		return;
+	}
+
+	// While waiting for a command, the whirlpool of the sea drifts along
+	if (isWaiting() && !hasInteraction() && !_gameOver && ++_whirlpoolFrames >= WHIRLPOOL_FRAMES) {
+		_whirlpoolFrames = 0;
+
+		if (_logic.updateWhirlpool()) {
+			_logic.teleportToAmbrosia();
+			startPrompt();
+		}
 	}
 }
 
@@ -268,6 +298,14 @@ void LocationMap::doBoard() {
 void LocationMap::doEnter() {
 	_G(messages).print("Enter ");
 
+	// The shrines of Ambrosia
+	const Data::Savegame &save = _G(savegame);
+	if (save._location == Data::LOCATION_AMBROSIA && _G(map).cell(save._posX, save._posY) == CELL_SHRINE) {
+		_G(messages).print("shrine!\nWho enters? ");
+		startInteraction(new Interactions::EnterShrine());
+		return;
+	}
+
 	const char *text = _logic.enter();
 	if (text) {
 		_G(messages).print(text);
diff --git a/engines/ultima/ultima3/views/location_map.h b/engines/ultima/ultima3/views/location_map.h
index 3b2157917cd..4b5022036c3 100644
--- a/engines/ultima/ultima3/views/location_map.h
+++ b/engines/ultima/ultima3/views/location_map.h
@@ -49,6 +49,9 @@ private:
 	bool _fightStarted = false;
 	bool _fightOver = false;
 
+	// How long since the whirlpool last moved
+	int _whirlpoolFrames = 0;
+
 	/**
 	 * Starts a fight with a creature
 	 */


Commit: 9ec24bd6f704b5ffce535e0ca6038f8c0e652438
    https://github.com/scummvm/scummvm/commit/9ec24bd6f704b5ffce535e0ca6038f8c0e652438
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:41:01+11:00

Commit Message:
ULTIMA: ULTIMA3: Add inserting the Exodus cards and the victory ending

Changed paths:
  A engines/ultima/ultima3/views/interactions/insert_card.cpp
  A engines/ultima/ultima3/views/interactions/insert_card.h
    engines/ultima/module.mk
    engines/ultima/ultima3/logic/location_logic.cpp
    engines/ultima/ultima3/ultima3.h
    engines/ultima/ultima3/views/game.cpp
    engines/ultima/ultima3/views/interactions/interaction.h
    engines/ultima/ultima3/views/interactions/other_command.cpp
    engines/ultima/ultima3/views/interactions/other_command.h


diff --git a/engines/ultima/module.mk b/engines/ultima/module.mk
index f3f9ac1860f..a5d3a10c89b 100644
--- a/engines/ultima/module.mk
+++ b/engines/ultima/module.mk
@@ -197,6 +197,7 @@ MODULE_OBJS += \
 	ultima3/views/interactions/get_chest.o \
 	ultima3/views/interactions/hand_equipment.o \
 	ultima3/views/interactions/ignite_torch.o \
+	ultima3/views/interactions/insert_card.o \
 	ultima3/views/interactions/interaction.o \
 	ultima3/views/interactions/log_input.o \
 	ultima3/views/interactions/join_gold.o \
diff --git a/engines/ultima/ultima3/logic/location_logic.cpp b/engines/ultima/ultima3/logic/location_logic.cpp
index 1ded837227d..f7f224461c6 100644
--- a/engines/ultima/ultima3/logic/location_logic.cpp
+++ b/engines/ultima/ultima3/logic/location_logic.cpp
@@ -219,6 +219,7 @@ const char *LocationLogic::go(const Entrance &entrance, byte tile) {
 		return "Towne!\n";
 	} else {
 		save._location = Data::LOCATION_CASTLE;
+		_G(exodusProgress) = 0;
 		save._posX = CASTLE_START_X;
 		save._posY = CASTLE_START_Y;
 		return "Castle!\n";
diff --git a/engines/ultima/ultima3/ultima3.h b/engines/ultima/ultima3/ultima3.h
index 622cb18d718..02be2e73c38 100644
--- a/engines/ultima/ultima3/ultima3.h
+++ b/engines/ultima/ultima3/ultima3.h
@@ -106,6 +106,9 @@ public:
 	// How many more turns time is held still for, by powder or a spell
 	byte _holdTime = 0;
 
+	// How many of the four Exodus cards have been put in its machine
+	int _exodusProgress = 0;
+
 	// A full viewport picture shown in place of the dungeon, such as a fountain
 	byte _scene[Data::ARENA_SIZE * Data::ARENA_SIZE] = {};
 	bool _sceneShown = false;
diff --git a/engines/ultima/ultima3/views/game.cpp b/engines/ultima/ultima3/views/game.cpp
index c62fae08a98..62ac3383b71 100644
--- a/engines/ultima/ultima3/views/game.cpp
+++ b/engines/ultima/ultima3/views/game.cpp
@@ -102,6 +102,11 @@ void Game::timeout() {
 	_G(overview).tick();
 	processFrame();
 
+	if (_interaction && _interaction->timeout()) {
+		_interaction.reset();
+		endTurn();
+	}
+
 	if (!_gameOver && !_interaction && isWaiting() && ++_idleFrames >= IDLE_FRAMES)
 		idleTimeout();
 
@@ -295,6 +300,9 @@ void Game::draw() {
 	}
 	_G(messages).draw(s, !_gameOver);
 
+	if (_interaction)
+		_interaction->draw(s);
+
 	Gfx::ScreenEffects &fx = _G(effects);
 	if (fx._viewport)
 		invertRect(s, Common::Rect(8, 8, 184, 184));
diff --git a/engines/ultima/ultima3/views/interactions/insert_card.cpp b/engines/ultima/ultima3/views/interactions/insert_card.cpp
new file mode 100644
index 00000000000..da6c57ac31f
--- /dev/null
+++ b/engines/ultima/ultima3/views/interactions/insert_card.cpp
@@ -0,0 +1,212 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "ultima/ultima3/views/interactions/insert_card.h"
+#include "ultima/ultima3/data/data.h"
+#include "ultima/ultima3/ultima3.h"
+
+namespace Ultima {
+namespace Ultima3 {
+namespace Views {
+namespace Interactions {
+
+constexpr byte MACHINE_CELL = 0x7C;
+constexpr byte FLASH_CELL = 0xF0;
+constexpr byte EMPTY_CELL = 0x20;
+constexpr int FIRST_SLOT_X = 0x1E;
+constexpr int CARD_COUNT = 4;
+constexpr int FLASH_COUNT = 5;
+constexpr int FLASH_STEP_FRAMES = 2;
+constexpr int VIEWPORT_LEFT = 8, VIEWPORT_RIGHT = 184;
+
+// The word that goes with each card, in the order they go in
+static const char CARD_WORDS[CARD_COUNT + 1] = "LSMD";
+
+// Which pixel columns each step of the ending inverts: 3 for both, 2 for the
+// odd ones and 1 for the even ones
+static const byte SHATTER_STEPS[21] = {
+	3, 2, 1, 3, 2, 3, 1, 3, 2, 1, 3, 2, 3, 1, 3, 2, 1, 3, 2, 3, 1
+};
+
+static const char *const VICTORY_LINES[10] = {
+	"And so it came to", "pass  that  on  this", "day EXODUS,hell-born",
+	"incarnate  of  evil,", "was vanquished  from", "Sosaria.    What now",
+	"lies  ahead  in  the", "ULTIMA saga can only", "be pure speculation!",
+	"Onward to ULTIMA IV!"
+};
+
+static void noEffect() {
+	_G(messages).print("No effect!\n");
+}
+
+void InsertCard::start(int slot) {
+	_slot = slot;
+	_stage = DIRECTION;
+	_G(messages).print("Direct? ");
+}
+
+bool InsertCard::chooseCell() {
+	const Data::Savegame &save = _G(savegame);
+	Direction dir = _directions.direction();
+
+	_targetX = (save._posX + (dir == DIR_EAST ? 1 : (dir == DIR_WEST ? -1 : 0))) & (Data::MAP_SIZE - 1);
+	_targetY = (save._posY + (dir == DIR_SOUTH ? 1 : (dir == DIR_NORTH ? -1 : 0))) & (Data::MAP_SIZE - 1);
+
+	if (_G(map).cell(_targetX, _targetY) != MACHINE_CELL) {
+		noEffect();
+		return true;
+	}
+
+	static const char *const WORDS[6] = { "Moons", "Death", "Love", "Sol", "Quit", "Quit" };
+	_G(messages).print("D, S, L, M:\n");
+	_menu.setup("MDLSQ\033", WORDS, 6);
+	_stage = CHOOSE_WORD;
+	return false;
+}
+
+bool InsertCard::tryWord() {
+	Data::RosterEntry &e = _G(savegame).partyMember(_slot);
+	int progress = _G(exodusProgress);
+	char key = _menu.key();
+
+	_G(messages).print("\n");
+	if (key == 'Q' || key == '\033')
+		return true;
+
+	// The card for this slot has to be in this person's hands
+	if (!(e._marksAndCards & (1 << progress))) {
+		noEffect();
+		return true;
+	}
+
+	if (_targetX != FIRST_SLOT_X + progress || key != CARD_WORDS[progress]) {
+		// Anything else is fatal
+		_G(effects).flashSlot(_slot);
+		g_engine->playSoundEffect(0xF7);
+		e._hitPoints = 0;
+		Logic().damageCharacter(_slot, 0xFF);
+		return true;
+	}
+
+	++_G(exodusProgress);
+	_step = 0;
+	_frames = 0;
+	_stage = FLASH;
+	return false;
+}
+
+void InsertCard::startVictory() {
+	const Data::Savegame &save = _G(savegame);
+
+	_G(messages).print("\nCongratulations!\n   Thou hast\n   compleated\nExodus: Ultima 3\n       in\n");
+	_G(messages).print(Common::String::format("%02X%02X%02X%02X moves\n", save._moveCount[3],
+		save._moveCount[2], save._moveCount[1], save._moveCount[0]).c_str());
+	_G(messages).print("Report thy feat!");
+
+	_step = 0;
+	_stage = SHATTER;
+}
+
+bool InsertCard::keypress(const KeypressMessage &msg) {
+	switch (_stage) {
+	case DIRECTION: {
+		DirectionChooser::Result result = _directions.handleKey(msg);
+		if (result == DirectionChooser::PENDING)
+			return false;
+		if (result == DirectionChooser::CANCELLED)
+			return true;
+
+		return chooseCell();
+	}
+
+	case CHOOSE_WORD:
+		return _menu.handleKey(msg) ? tryWord() : false;
+
+	case DONE:
+		if (!isModifierKey(msg.keycode)) {
+			_G(soundEnabled) = true;
+			g_events->replaceView("Title", true);
+		}
+		return false;
+
+	default:
+		return false;
+	}
+}
+
+bool InsertCard::timeout() {
+	if (_stage == FLASH) {
+		if (++_frames < FLASH_STEP_FRAMES)
+			return false;
+		_frames = 0;
+
+		// The slot lights up and goes dark again, and then stays empty
+		if (_step < FLASH_COUNT * 2) {
+			_G(map).setCell(_targetX, _targetY, (_step & 1) ? MACHINE_CELL : FLASH_CELL);
+			g_engine->playSoundEffect(0xF7);
+			++_step;
+			return false;
+		}
+
+		_G(map).setCell(_targetX, _targetY, EMPTY_CELL);
+		if (_G(exodusProgress) != CARD_COUNT)
+			return true;
+
+		startVictory();
+	} else if (_stage == SHATTER) {
+		g_engine->playSoundEffect(0xF7);
+		byte step = SHATTER_STEPS[_step];
+		_invertEven ^= (step & 1) != 0;
+		_invertOdd ^= (step & 2) != 0;
+
+		if (++_step == ARRAYSIZE(SHATTER_STEPS))
+			_stage = TEXT;
+	} else if (_stage == TEXT) {
+		_stage = DONE;
+	}
+
+	return false;
+}
+
+void InsertCard::draw(GfxSurface &s) {
+	if (_stage == SHATTER) {
+		for (int y = VIEWPORT_LEFT; y < VIEWPORT_RIGHT; ++y) {
+			byte *p = (byte *)s.getBasePtr(VIEWPORT_LEFT, y);
+
+			for (int x = VIEWPORT_LEFT; x < VIEWPORT_RIGHT; ++x, ++p) {
+				if ((x & 1) ? _invertOdd : _invertEven)
+					*p ^= 3;
+			}
+		}
+
+		s.addDirtyRect(Common::Rect(VIEWPORT_LEFT, VIEWPORT_LEFT, VIEWPORT_RIGHT, VIEWPORT_RIGHT));
+	} else if (_stage == TEXT || _stage == DONE) {
+		s.fillRect(Common::Rect(VIEWPORT_LEFT, VIEWPORT_LEFT, VIEWPORT_RIGHT, VIEWPORT_RIGHT), 0);
+
+		for (int i = 0; i < ARRAYSIZE(VICTORY_LINES); ++i)
+			s.writeString(Common::Point(2, 3 + i * 2), VICTORY_LINES[i]);
+	}
+}
+
+} // namespace Interactions
+} // namespace Views
+} // namespace Ultima3
+} // namespace Ultima
diff --git a/engines/ultima/ultima3/views/interactions/insert_card.h b/engines/ultima/ultima3/views/interactions/insert_card.h
new file mode 100644
index 00000000000..5d5b7735987
--- /dev/null
+++ b/engines/ultima/ultima3/views/interactions/insert_card.h
@@ -0,0 +1,92 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef ULTIMA3_VIEWS_INTERACTIONS_INSERT_CARD_H
+#define ULTIMA3_VIEWS_INTERACTIONS_INSERT_CARD_H
+
+#include "ultima/ultima3/views/interactions/log_input.h"
+
+namespace Ultima {
+namespace Ultima3 {
+namespace Views {
+namespace Interactions {
+
+/**
+ * Puts a card into the Exodus machine. The four have to go in the right
+ * order, with the right word said for each, and the last one finishes the game
+ */
+class InsertCard : public Interaction {
+private:
+	enum Stage {
+		DIRECTION,
+		CHOOSE_WORD,
+		FLASH,
+		SHATTER,
+		TEXT,
+		DONE
+	};
+
+	Stage _stage = DIRECTION;
+	int _slot = 0;
+	int _frames = 0;
+	int _step = 0;
+	int _targetX = 0, _targetY = 0;
+
+	DirectionChooser _directions;
+	LogMenu _menu;
+
+	// Which of the two sets of alternate pixel columns are inverted
+	bool _invertEven = false;
+	bool _invertOdd = false;
+
+	/**
+	 * Works out which cell was chosen, and asks for a word if it's the machine
+	 */
+	bool chooseCell();
+
+	/**
+	 * Tries the word chosen at the machine
+	 */
+	bool tryWord();
+
+	/**
+	 * Starts the congratulations
+	 */
+	void startVictory();
+
+public:
+	/**
+	 * Starts putting a card in
+	 * @param slot		The party member holding the card
+	 */
+	void start(int slot);
+
+	bool keypress(const KeypressMessage &msg) override;
+	bool timeout() override;
+	void draw(GfxSurface &s) override;
+};
+
+} // namespace Interactions
+} // namespace Views
+} // namespace Ultima3
+} // namespace Ultima
+
+#endif
diff --git a/engines/ultima/ultima3/views/interactions/interaction.h b/engines/ultima/ultima3/views/interactions/interaction.h
index 14ce1b52cc6..1ba2104e86a 100644
--- a/engines/ultima/ultima3/views/interactions/interaction.h
+++ b/engines/ultima/ultima3/views/interactions/interaction.h
@@ -53,6 +53,19 @@ public:
 	 * @returns		True once the command is finished
 	 */
 	virtual bool keypress(const KeypressMessage &msg) = 0;
+
+	/**
+	 * Called every frame, for commands that animate
+	 * @returns		True once the command is finished
+	 */
+	virtual bool timeout() {
+		return false;
+	}
+
+	/**
+	 * Draws over the game view
+	 */
+	virtual void draw(GfxSurface &s) {}
 };
 
 /**
diff --git a/engines/ultima/ultima3/views/interactions/other_command.cpp b/engines/ultima/ultima3/views/interactions/other_command.cpp
index 24c54cf61c9..c77a3054ae1 100644
--- a/engines/ultima/ultima3/views/interactions/other_command.cpp
+++ b/engines/ultima/ultima3/views/interactions/other_command.cpp
@@ -167,6 +167,10 @@ bool OtherCommand::keypress(const KeypressMessage &msg) {
 			_G(messages).print("Direct? ");
 			_stage = DIRECTION;
 			return false;
+		} else if (word == "INSERT") {
+			_insert.start(_players.slot());
+			_stage = INSERT;
+			return false;
 		} else {
 			noEffect();
 		}
@@ -174,6 +178,9 @@ bool OtherCommand::keypress(const KeypressMessage &msg) {
 		return true;
 	}
 
+	case INSERT:
+		return _insert.keypress(msg);
+
 	default: {
 		DirectionChooser::Result result = _directions.handleKey(msg);
 		if (result == DirectionChooser::PENDING)
@@ -186,6 +193,15 @@ bool OtherCommand::keypress(const KeypressMessage &msg) {
 	}
 }
 
+bool OtherCommand::timeout() {
+	return _stage == INSERT && _insert.timeout();
+}
+
+void OtherCommand::draw(GfxSurface &s) {
+	if (_stage == INSERT)
+		_insert.draw(s);
+}
+
 } // namespace Interactions
 } // namespace Views
 } // namespace Ultima3
diff --git a/engines/ultima/ultima3/views/interactions/other_command.h b/engines/ultima/ultima3/views/interactions/other_command.h
index 5e49bf56dbc..480577272ed 100644
--- a/engines/ultima/ultima3/views/interactions/other_command.h
+++ b/engines/ultima/ultima3/views/interactions/other_command.h
@@ -22,7 +22,7 @@
 #ifndef ULTIMA3_VIEWS_INTERACTIONS_OTHER_COMMAND_H
 #define ULTIMA3_VIEWS_INTERACTIONS_OTHER_COMMAND_H
 
-#include "ultima/ultima3/views/interactions/log_input.h"
+#include "ultima/ultima3/views/interactions/insert_card.h"
 
 namespace Ultima {
 namespace Ultima3 {
@@ -38,13 +38,15 @@ private:
 	enum Stage {
 		CHOOSE_PLAYER,
 		TYPE_COMMAND,
-		DIRECTION
+		DIRECTION,
+		INSERT
 	};
 
 	Stage _stage = CHOOSE_PLAYER;
 	PlayerChooser _players;
 	LogText _text;
 	DirectionChooser _directions;
+	InsertCard _insert;
 
 	void dig();
 	void search();
@@ -53,6 +55,8 @@ private:
 
 public:
 	bool keypress(const KeypressMessage &msg) override;
+	bool timeout() override;
+	void draw(GfxSurface &s) override;
 };
 
 } // namespace Interactions


Commit: cab8ad160a8bf9956435a3b78dec35127965dc7b
    https://github.com/scummvm/scummvm/commit/cab8ad160a8bf9956435a3b78dec35127965dc7b
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:41:01+11:00

Commit Message:
ULTIMA: ULTIMA3: Add dragons and ships breathing fire on the map

Changed paths:
    engines/ultima/ultima3/logic/creature_logic.cpp
    engines/ultima/ultima3/logic/creature_logic.h
    engines/ultima/ultima3/views/location_map.cpp
    engines/ultima/ultima3/views/location_map.h


diff --git a/engines/ultima/ultima3/logic/creature_logic.cpp b/engines/ultima/ultima3/logic/creature_logic.cpp
index d5cb4d65bde..21163bb3a4e 100644
--- a/engines/ultima/ultima3/logic/creature_logic.cpp
+++ b/engines/ultima/ultima3/logic/creature_logic.cpp
@@ -45,6 +45,10 @@ static const byte MONSTER_FLOORS[MONSTER_TYPES] = {
 	0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x00, 0x04, 0x04, 0x00, 0x00, 0x04, 0x04
 };
 
+constexpr byte DRAGON_TILE = 0x74;
+constexpr byte SHIP_TILE = 0x3C;
+constexpr int VIEW_SIZE = 11;
+
 constexpr byte CELL_WATER = 0;
 constexpr byte CELL_GRASS = 4;
 constexpr byte CELL_BRUSH = 8;
@@ -172,18 +176,45 @@ int CreatureLogic::update(bool moved) {
 			} else if (canMoveTo(i, x, c._y[i])) {
 				y = c._y[i];
 			} else {
+				breathAttack(i);
 				continue;
 			}
 		}
 
-		if (x != save._posX || y != save._posY)
+		if (x != save._posX || y != save._posY) {
 			moveTo(i, x, y);
+			breathAttack(i);
+		}
 	}
 
 	spawnMonster();
 	return -1;
 }
 
+void CreatureLogic::breathAttack(int index) {
+	const Data::Savegame &save = _G(savegame);
+	const Data::Creatures &c = _G(map)._creatures;
+
+	if (c._tile[index] != DRAGON_TILE && c._tile[index] != SHIP_TILE)
+		return;
+	if (randomBelow(255) >= 128)
+		return;
+
+	// Only if it's in view, which puts the party in the middle of it
+	const int centre = VIEW_SIZE / 2;
+	byte x = centre - save._posX + c._x[index];
+	byte y = centre - save._posY + c._y[index];
+	if (x >= VIEW_SIZE || y >= VIEW_SIZE)
+		return;
+
+	Breath breath;
+	breath._x = x;
+	breath._y = y;
+	breath._dx = stepToward(c._x[index], save._posX);
+	breath._dy = stepToward(c._y[index], save._posY);
+	_breaths.push_back(breath);
+}
+
 void CreatureLogic::spawnMonster() {
 	Data::Map &map = _G(map);
 	Data::Creatures &c = map._creatures;
diff --git a/engines/ultima/ultima3/logic/creature_logic.h b/engines/ultima/ultima3/logic/creature_logic.h
index 18c7d86fb4d..324a0726204 100644
--- a/engines/ultima/ultima3/logic/creature_logic.h
+++ b/engines/ultima/ultima3/logic/creature_logic.h
@@ -22,6 +22,7 @@
 #ifndef ULTIMA3_LOGIC_CREATURE_LOGIC_H
 #define ULTIMA3_LOGIC_CREATURE_LOGIC_H
 
+#include "common/array.h"
 #include "ultima/ultima3/data/map.h"
 
 namespace Ultima {
@@ -32,7 +33,19 @@ namespace Ultima3 {
  * and the people of the towns and castles
  */
 class CreatureLogic {
+public:
+	/**
+	 * A blast of fire breathed or fired at the party by a dragon or a ship,
+	 * given by where it starts in the 11x11 viewport and how it steps
+	 */
+	struct Breath {
+		int _x, _y;
+		int _dx, _dy;
+	};
+
 private:
+	Common::Array<Breath> _breaths;
+
 	// Alternates when travelling by horse or ship, so that creatures only
 	// get to move on every other step
 	int _stepToggle = 1;
@@ -63,6 +76,11 @@ private:
 	 */
 	void spawnMonster();
 
+	/**
+	 * Gives a dragon or ship a chance to fire at the party
+	 */
+	void breathAttack(int index);
+
 public:
 	/**
 	 * Returns the creature standing at a position, or -1
@@ -77,6 +95,15 @@ public:
 	 *		fight, or -1
 	 */
 	int update(bool moved);
+
+	/**
+	 * Returns the attacks made during the last update, and forgets them
+	 */
+	Common::Array<Breath> takeBreaths() {
+		Common::Array<Breath> result = _breaths;
+		_breaths.clear();
+		return result;
+	}
 };
 
 } // namespace Ultima3
diff --git a/engines/ultima/ultima3/views/location_map.cpp b/engines/ultima/ultima3/views/location_map.cpp
index 2601f253e41..6afee9d1c5f 100644
--- a/engines/ultima/ultima3/views/location_map.cpp
+++ b/engines/ultima/ultima3/views/location_map.cpp
@@ -20,6 +20,7 @@
  */
 
 #include "ultima/ultima3/views/location_map.h"
+#include "ultima/ultima3/logic/chest_logic.h"
 #include "ultima/ultima3/views/menu_input.h"
 #include "ultima/ultima3/views/interactions/cast_spell.h"
 #include "ultima/ultima3/views/interactions/enter_shrine.h"
@@ -41,6 +42,9 @@ namespace Ultima3 {
 namespace Views {
 
 constexpr int WHIRLPOOL_FRAMES = 4;
+constexpr int BREATH_FRAMES = 2;
+constexpr int BREATH_RANGE = 3;
+constexpr byte TILE_BREATH = 0x3D;
 constexpr byte CELL_SHRINE = 0xF8;
 constexpr int VIEWPORT_CELLS = VIEWPORT_TILES * VIEWPORT_TILES;
 constexpr int VIEWPORT_CENTER = VIEWPORT_CELLS / 2;
@@ -137,6 +141,11 @@ void LocationMap::drawViewport(GfxSurface &s) {
 				tiles[row * VIEWPORT_TILES + col]);
 	}
 
+	if (!_breaths.empty()) {
+		const Common::Point &p = _breaths[0]._tiles[_breathStep];
+		_G(shapes).drawTile(s, 8 + p.x * Gfx::SHAPE_SIZE, 8 + p.y * Gfx::SHAPE_SIZE, TILE_BREATH);
+	}
+
 	s.addDirtyRect(Common::Rect(8, 8, 8 + VIEWPORT_TILES * Gfx::SHAPE_SIZE, 8 + VIEWPORT_TILES * Gfx::SHAPE_SIZE));
 }
 
@@ -179,6 +188,14 @@ void LocationMap::endTurn() {
 	// A creature reaching the party starts a fight
 	int creature = _creatures.update(_moved);
 	_moved = false;
+
+	_pendingCreature = creature;
+	startBreaths(_creatures.takeBreaths());
+	if (_breaths.empty())
+		finishTurn(creature);
+}
+
+void LocationMap::finishTurn(int creature) {
 	if (creature >= 0) {
 		startFight(creature);
 		return;
@@ -188,7 +205,71 @@ void LocationMap::endTurn() {
 		startPrompt();
 }
 
+void LocationMap::startBreaths(const Common::Array<CreatureLogic::Breath> &breaths) {
+	byte tiles[VIEWPORT_CELLS];
+	buildViewport(tiles);
+
+	const int centre = VIEWPORT_TILES / 2;
+	_breathStep = 0;
+	_breathFrames = 0;
+
+	for (uint i = 0; i < breaths.size(); ++i) {
+		BreathPath path;
+		path._hits = false;
+		int x = breaths[i]._x, y = breaths[i]._y;
+
+		// The blast goes a few tiles in, stopping short of anything in the way
+		for (int step = 0; step < BREATH_RANGE; ++step) {
+			y += breaths[i]._dy;
+			x += breaths[i]._dx;
+			if (x < 0 || y < 0 || x >= VIEWPORT_TILES || y >= VIEWPORT_TILES)
+				break;
+
+			byte tile = tiles[y * VIEWPORT_TILES + x];
+			if (tile == TILE_MOUNTAINS || tile == TILE_WALL || tile == TILE_HIDDEN)
+				break;
+
+			path._tiles.push_back(Common::Point(x, y));
+			if (x == centre && y == centre) {
+				path._hits = true;
+				break;
+			}
+		}
+
+		g_engine->playSoundEffect(0xFB);
+		if (!path._tiles.empty())
+			_breaths.push_back(path);
+	}
+
+	if (!_breaths.empty())
+		checkBreathHit();
+}
+
+void LocationMap::checkBreathHit() {
+	if (_breaths[0]._hits && _breathStep == (int)_breaths[0]._tiles.size() - 1)
+		ChestLogic().damageAll(_G(savegame)._dungeonLevel);
+}
+
 void LocationMap::processFrame() {
+	if (!_breaths.empty()) {
+		if (++_breathFrames < BREATH_FRAMES)
+			return;
+		_breathFrames = 0;
+
+		if (++_breathStep == (int)_breaths[0]._tiles.size()) {
+			_breaths.remove_at(0);
+			_breathStep = 0;
+
+			if (_breaths.empty()) {
+				finishTurn(_pendingCreature);
+				return;
+			}
+		}
+
+		checkBreathHit();
+		return;
+	}
+
 	if (_fightOver) {
 		_fightOver = false;
 		endTurn();
@@ -360,6 +441,9 @@ void LocationMap::doExitVehicle() {
 }
 
 bool LocationMap::handleCommand(const KeypressMessage &msg) {
+	if (!_breaths.empty())
+		return true;
+
 	switch (msg.keycode) {
 	case Common::KEYCODE_UP:
 	case Common::KEYCODE_KP8:
diff --git a/engines/ultima/ultima3/views/location_map.h b/engines/ultima/ultima3/views/location_map.h
index 4b5022036c3..70482bffc8e 100644
--- a/engines/ultima/ultima3/views/location_map.h
+++ b/engines/ultima/ultima3/views/location_map.h
@@ -25,6 +25,7 @@
 #include "ultima/ultima3/logic/creature_logic.h"
 #include "ultima/ultima3/logic/location_logic.h"
 #include "ultima/ultima3/views/game.h"
+#include "common/array.h"
 
 namespace Ultima {
 namespace Ultima3 {
@@ -52,6 +53,32 @@ private:
 	// How long since the whirlpool last moved
 	int _whirlpoolFrames = 0;
 
+	// The fire breathed at the party during the last turn, shown one after
+	// the other before the turn is over
+	struct BreathPath {
+		Common::Array<Common::Point> _tiles;
+		bool _hits;
+	};
+	Common::Array<BreathPath> _breaths;
+	int _breathStep = 0;
+	int _breathFrames = 0;
+	int _pendingCreature = -1;
+
+	/**
+	 * Works out where each blast of fire goes, and starts showing them
+	 */
+	void startBreaths(const Common::Array<CreatureLogic::Breath> &breaths);
+
+	/**
+	 * Hurts the party if the blast on show has reached them
+	 */
+	void checkBreathHit();
+
+	/**
+	 * Finishes a turn once the creatures are done, with a fight if one has begun
+	 */
+	void finishTurn(int creature);
+
 	/**
 	 * Starts a fight with a creature
 	 */
@@ -79,6 +106,10 @@ protected:
 	void processFrame() override;
 	bool handleCommand(const KeypressMessage &msg) override;
 
+	bool isWaiting() const override {
+		return _breaths.empty();
+	}
+
 public:
 	LocationMap() : Game("LocationMap") {}
 	~LocationMap() override {}


Commit: 6378f92297f73422a24286e17489b0058b6ae2f0
    https://github.com/scummvm/scummvm/commit/6378f92297f73422a24286e17489b0058b6ae2f0
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:41:01+11:00

Commit Message:
ULTIMA: ULTIMA3: Add the PC speaker sound effects

Changed paths:
  A engines/ultima/ultima3/sound_effects.cpp
  A engines/ultima/ultima3/sound_effects.h
    engines/ultima/module.mk
    engines/ultima/ultima3/logic/combat_logic.cpp
    engines/ultima/ultima3/logic/combat_logic.h
    engines/ultima/ultima3/logic/location_logic.cpp
    engines/ultima/ultima3/ultima3.cpp
    engines/ultima/ultima3/ultima3.h
    engines/ultima/ultima3/views/combat_map.cpp
    engines/ultima/ultima3/views/interactions/cast_spell.cpp
    engines/ultima/ultima3/views/interactions/cast_spell.h
    engines/ultima/ultima3/views/interactions/enter_shrine.cpp
    engines/ultima/ultima3/views/interactions/shops.cpp
    engines/ultima/ultima3/views/interactions/transact.cpp
    engines/ultima/ultima3/views/interactions/yell.cpp


diff --git a/engines/ultima/module.mk b/engines/ultima/module.mk
index a5d3a10c89b..8fc9e4d54e0 100644
--- a/engines/ultima/module.mk
+++ b/engines/ultima/module.mk
@@ -163,6 +163,7 @@ MODULE_OBJS += \
 	ultima3/ultima3.o \
 	ultima3/console.o \
 	ultima3/metaengine.o \
+	ultima3/sound_effects.o \
 	ultima3/data/arena.o \
 	ultima3/data/data.o \
 	ultima3/data/dungeon.o \
diff --git a/engines/ultima/ultima3/logic/combat_logic.cpp b/engines/ultima/ultima3/logic/combat_logic.cpp
index bf7ad9921a5..40da1901f83 100644
--- a/engines/ultima/ultima3/logic/combat_logic.cpp
+++ b/engines/ultima/ultima3/logic/combat_logic.cpp
@@ -66,8 +66,8 @@ void CombatLogic::print(const Common::String &text) {
 	_events.push_back(CombatEvent(text));
 }
 
-void CombatLogic::sound(int effect) {
-	_events.push_back(CombatEvent(CombatEvent::SOUND, effect));
+void CombatLogic::sound(int effect, int arg1, int arg2) {
+	_events.push_back(CombatEvent(CombatEvent::SOUND, effect, arg1, arg2));
 }
 
 void CombatLogic::overlay(int x, int y, int tile) {
@@ -247,6 +247,10 @@ void CombatLogic::startFight() {
 		_arena.setTile(mx, my, _monsterClass);
 	}
 
+	sound(0xFD, 0xF0, 0x10);
+	sound(0xFD, 0xF0, 0x10);
+	sound(0xFD, 0xF0, 4);
+	sound(0xFD, 0xF0, 0x10);
 	syncShown();
 }
 
@@ -325,7 +329,7 @@ void CombatLogic::playerAttack(int slot, Direction dir) {
 	bool ranged = weapon == 3 || weapon == 5 || weapon == 9 || weapon == 0x0D;
 	int monster = -1;
 
-	sound(0xFD);
+	sound(0xFD, 0xE0 + slot * 8, 6);
 
 	// Close in, a monster has to be right beside the attacker
 	if (!ranged) {
diff --git a/engines/ultima/ultima3/logic/combat_logic.h b/engines/ultima/ultima3/logic/combat_logic.h
index 9c0669258de..07d33ee6fa2 100644
--- a/engines/ultima/ultima3/logic/combat_logic.h
+++ b/engines/ultima/ultima3/logic/combat_logic.h
@@ -66,7 +66,7 @@ private:
 	bool _slayUsed = false;
 
 	void print(const Common::String &text);
-	void sound(int effect);
+	void sound(int effect, int arg1 = 0, int arg2 = 0);
 	void overlay(int x, int y, int tile);
 	void flashSlot(int slot);
 	void show();
diff --git a/engines/ultima/ultima3/logic/location_logic.cpp b/engines/ultima/ultima3/logic/location_logic.cpp
index f7f224461c6..a7963c2c831 100644
--- a/engines/ultima/ultima3/logic/location_logic.cpp
+++ b/engines/ultima/ultima3/logic/location_logic.cpp
@@ -308,7 +308,7 @@ void LocationLogic::teleportThroughMoonGate() {
 	save._posX = GATE_X[save._moonPhase[1]];
 	save._posY = GATE_Y[save._moonPhase[1]];
 	_G(effects).flashViewport();
-	g_engine->playSoundEffect(0xFD);
+	g_engine->playSoundEffect(0xFD, 0xC0, 0x20);
 }
 
 bool LocationLogic::isOnWhirlpool() const {
diff --git a/engines/ultima/ultima3/sound_effects.cpp b/engines/ultima/ultima3/sound_effects.cpp
new file mode 100644
index 00000000000..57705715f0d
--- /dev/null
+++ b/engines/ultima/ultima3/sound_effects.cpp
@@ -0,0 +1,284 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "ultima/ultima3/sound_effects.h"
+#include "graphics/views/events.h"
+
+namespace Ultima {
+namespace Ultima3 {
+
+// The clock of the processor the timing loops were written for
+constexpr uint32 CPU_HZ = 4772727;
+
+// Cost in clock cycles of the code that flips the speaker, and of
+// the pseudo random number routine
+constexpr uint32 TOGGLE_CYCLES = 4 + 14;
+constexpr uint32 RANDOM_CYCLES = 1100;
+
+constexpr int AMPLITUDE = 0x30;
+
+namespace {
+
+/**
+ * Counts the clock cycles spent and notes when the speaker was flipped
+ */
+class Speaker {
+public:
+	uint32 _cycles = 0;
+	Common::Array<uint32> _edges;
+
+	void run(uint32 cycles) {
+		_cycles += cycles;
+	}
+
+	void toggle() {
+		_cycles += TOGGLE_CYCLES;
+		_edges.push_back(_cycles);
+	}
+
+	// A loop of decrementing a byte register until it reaches zero
+	void countByte(int count) {
+		if (count == 0)
+			count = 256;
+		_cycles += 19 * count - 12;
+	}
+
+	// The same, with a word register
+	void countWord(int count) {
+		if (count == 0)
+			count = 65536;
+		_cycles += 18 * count - 10;
+	}
+
+	// The cost of a conditional jump that is taken or isn't
+	void jump(bool taken) {
+		_cycles += taken ? 16 : 4;
+	}
+
+	// A random number up to a limit, which the original then reduces to fit
+	int getRandomNumber(int limit) {
+		_cycles += RANDOM_CYCLES;
+		return Graphics::Views::g_events->getRandomNumber(255) % limit;
+	}
+};
+
+// A sweep up and down in the width of the pulses
+void sweep(Speaker &s, byte start, byte repeats) {
+	int high = start, low = 1;
+
+	auto pulses = [&]() {
+		s.run(2);
+		for (int left = repeats ? repeats : 256; left > 0; --left) {
+			s.run(2);
+			s.countByte(high);
+			s.toggle();
+			s.run(2);
+			s.countByte(low);
+			s.toggle();
+			s.run(3);
+			s.jump(left > 1);
+		}
+	};
+
+	do {
+		pulses();
+		high = (high - 1) & 0xFF;
+		++low;
+		s.run(3 + 3 + 4);
+		s.jump(low != 0x1B);
+	} while (low != 0x1B);
+
+	do {
+		pulses();
+		--low;
+		high = (high + 1) & 0xFF;
+		s.run(3 + 3 + 4);
+		s.jump(low != 0);
+	} while (low != 0);
+}
+
+// Bursts of noise, each a pulse of random length
+void noise(Speaker &s, int count, int minimum) {
+	for (int left = count; left > 0; --left) {
+		int length = s.getRandomNumber(255) | minimum;
+		s.run(3);
+		s.countByte(length);
+		s.toggle();
+		s.run(3);
+		s.jump(left > 1);
+	}
+}
+
+void rumble(Speaker &s, byte base) {
+	for (int left = 0x80; left > 0; --left) {
+		s.run(2);
+		int length = (s.getRandomNumber(15) + base) & 0xFF;
+		s.run(3);
+
+		do {
+			s.run(4);
+			s.run(17 * 2 + 5);
+			s.run(3);
+			length = (length - 1) & 0xFF;
+			s.jump(length != 0);
+		} while (length != 0);
+
+		s.toggle();
+		s.run(3);
+		s.jump(left > 1);
+	}
+}
+
+// A fall in pitch
+void descend(Speaker &s) {
+	for (int low = 0xFB; low > 0; --low) {
+		s.toggle();
+		s.run(2);
+		s.run(19 * (256 - low) - 12);
+		s.run(3);
+		s.jump(low > 1);
+	}
+}
+
+// A rise in pitch
+void ascend(Speaker &s) {
+	for (int count = 0xA0; count > 0; --count) {
+		s.run(2);
+		s.countWord(count);
+		s.toggle();
+		s.run(3);
+		s.jump(count > 1);
+	}
+}
+
+// Noise getting steadily lower
+void crackle(Speaker &s) {
+	for (int low = 0xE0; low != 0x40; --low) {
+		int length = s.getRandomNumber(255) | low;
+		s.run(3);
+		s.countByte(length);
+		s.toggle();
+		s.run(3 + 3);
+		s.jump(low - 1 != 0x40);
+	}
+}
+
+// Short bursts of tone at random pitches
+void warble(Speaker &s, byte seed) {
+	int bursts = ((seed & 0x0F) << 1) + 8;
+
+	for (; bursts > 0; --bursts) {
+		int length = s.getRandomNumber(255);
+		s.run(2);
+
+		for (int left = 0x28; left > 0; --left) {
+			s.run(2);
+			s.countByte(length);
+			s.toggle();
+			s.run(3);
+			s.jump(left > 1);
+		}
+
+		s.run(3);
+		s.jump(bursts > 1);
+	}
+}
+
+// A long fall in pitch
+void swirl(Speaker &s) {
+	for (int low = 0x40; low < 0xC0; ++low) {
+		for (int left = 0x1E; left > 0; --left) {
+			s.run(2);
+			s.countByte(low);
+			s.toggle();
+			s.run(3);
+			s.jump(left > 1);
+		}
+
+		s.run(3 + 4);
+		s.jump(low + 1 < 0xC0);
+	}
+}
+
+} // End of anonymous namespace
+
+Common::Array<byte> SoundEffects::render(byte effect, byte arg1, byte arg2) {
+	Speaker s;
+
+	switch (effect) {
+	case 0xFD:
+		sweep(s, arg1, arg2);
+		break;
+	case 0xFC:
+		rumble(s, arg1);
+		break;
+	case 0xFB:
+		descend(s);
+		break;
+	case 0xFA:
+		ascend(s);
+		break;
+	case 0xF9:
+		sweep(s, 0xE0, 4);
+		break;
+	case 0xF8:
+		crackle(s);
+		break;
+	case 0xF7:
+		noise(s, 0xFF, 0);
+		break;
+	case 0xF6:
+		noise(s, 8, 0);
+		break;
+	case 0xF5:
+		warble(s, arg1);
+		break;
+	case 0xF4:
+		swirl(s);
+		break;
+	default:
+		return Common::Array<byte>();
+	}
+
+	// The speaker is let go of at the end
+	if (s._edges.size() & 1)
+		s._edges.push_back(s._cycles);
+
+	Common::Array<byte> samples;
+	uint32 total = (uint32)(((uint64)s._cycles * SAMPLE_RATE) / CPU_HZ) + 1;
+	samples.resize(total);
+
+	uint32 pos = 0;
+	bool high = false;
+	for (uint i = 0; i <= s._edges.size(); ++i) {
+		uint32 end = (i < s._edges.size()) ? (uint32)(((uint64)s._edges[i] * SAMPLE_RATE) / CPU_HZ) : total;
+		byte level = high ? 0x80 + AMPLITUDE : 0x80 - AMPLITUDE;
+
+		for (; pos < end && pos < total; ++pos)
+			samples[pos] = level;
+		high = !high;
+	}
+
+	return samples;
+}
+
+} // namespace Ultima3
+} // namespace Ultima
diff --git a/engines/ultima/ultima3/sound_effects.h b/engines/ultima/ultima3/sound_effects.h
new file mode 100644
index 00000000000..1121f9a66a8
--- /dev/null
+++ b/engines/ultima/ultima3/sound_effects.h
@@ -0,0 +1,51 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef ULTIMA3_SOUND_EFFECTS_H
+#define ULTIMA3_SOUND_EFFECTS_H
+
+#include "common/array.h"
+
+namespace Ultima {
+namespace Ultima3 {
+
+/**
+ * Recreates the sound effects the original made by switching the PC speaker
+ * on and off in timing loops
+ */
+class SoundEffects {
+public:
+	static constexpr int SAMPLE_RATE = 44100;
+
+	/**
+	 * Works out the sound of an effect as unsigned 8-bit samples
+	 * @param effect	The effect number, from 0xF4 to 0xFD
+	 * @param arg1		The first of the values the effect is varied by
+	 * @param arg2		The second
+	 * @returns			The samples, or nothing if the effect isn't a sound
+	 */
+	static Common::Array<byte> render(byte effect, byte arg1, byte arg2);
+};
+
+} // namespace Ultima3
+} // namespace Ultima
+
+#endif
diff --git a/engines/ultima/ultima3/ultima3.cpp b/engines/ultima/ultima3/ultima3.cpp
index d3bb0ffb290..3349c78d769 100644
--- a/engines/ultima/ultima3/ultima3.cpp
+++ b/engines/ultima/ultima3/ultima3.cpp
@@ -22,11 +22,13 @@
 #include "common/system.h"
 #include "common/savefile.h"
 #include "engines/util.h"
+#include "audio/decoders/raw.h"
 #include "audio/softsynth/pcspk.h"
 #include "ultima/ultima3/ultima3.h"
 #include "ultima/ultima3/console.h"
 #include "ultima/ultima3/metaengine.h"
 #include "ultima/ultima3/data/data.h"
+#include "ultima/ultima3/sound_effects.h"
 #include "ultima/ultima3/views/views.h"
 #include "ultima/ultima3/gfx/charset.h"
 
@@ -42,6 +44,7 @@ Ultima3Engine::Ultima3Engine(OSystem *syst, const Ultima::UltimaGameDescription
 }
 
 Ultima3Engine::~Ultima3Engine() {
+	_mixer->stopHandle(_effectHandle);
 	delete _pcSpeaker;
 }
 
@@ -133,7 +136,27 @@ void Ultima3Engine::playErrorBeep() {
 	queueTone(3216, 65);
 }
 
-void Ultima3Engine::playSoundEffect(byte effect) {
+void Ultima3Engine::queueEffect(const Common::Array<byte> &samples) {
+	// Don't let effects pile up behind the action
+	constexpr int MAX_QUEUED = 6;
+
+	if (samples.empty())
+		return;
+
+	if (!_mixer->isSoundHandleActive(_effectHandle)) {
+		_effectStream = Audio::makeQueuingAudioStream(SoundEffects::SAMPLE_RATE, false);
+		_mixer->playStream(Audio::Mixer::kSFXSoundType, &_effectHandle, _effectStream);
+	}
+
+	if (_effectStream->numQueuedStreams() >= MAX_QUEUED)
+		return;
+
+	byte *data = (byte *)malloc(samples.size());
+	memcpy(data, &samples[0], samples.size());
+	_effectStream->queueBuffer(data, samples.size(), DisposeAfterUse::YES, Audio::FLAG_UNSIGNED);
+}
+
+void Ultima3Engine::playSoundEffect(byte effect, byte arg1, byte arg2) {
 	switch (effect) {
 	case 0xFE:
 		playErrorBeep();
@@ -143,6 +166,8 @@ void Ultima3Engine::playSoundEffect(byte effect) {
 		queueTone(9040, 60);
 		break;
 	default:
+		if (_soundEnabled)
+			queueEffect(SoundEffects::render(effect, arg1, arg2));
 		break;
 	}
 }
diff --git a/engines/ultima/ultima3/ultima3.h b/engines/ultima/ultima3/ultima3.h
index 02be2e73c38..5674983ad86 100644
--- a/engines/ultima/ultima3/ultima3.h
+++ b/engines/ultima/ultima3/ultima3.h
@@ -28,6 +28,8 @@
 #include "common/ptr.h"
 #include "common/serializer.h"
 #include "common/util.h"
+#include "audio/audiostream.h"
+#include "audio/mixer.h"
 #include "engines/engine.h"
 #include "ultima/detection.h"
 #include "ultima/shared/engine/events.h"
@@ -68,6 +70,13 @@ protected:
 private:
 	Audio::PCSpeaker *_pcSpeaker = nullptr;
 	bool _pcSpeakerReady = false;
+	Audio::QueuingAudioStream *_effectStream = nullptr;
+	Audio::SoundHandle _effectHandle;
+
+	/**
+	 * Queues up the samples of a sound effect to be played
+	 */
+	void queueEffect(const Common::Array<byte> &samples);
 
 public:
 	/**
@@ -88,9 +97,10 @@ public:
 	void playErrorBeep();
 
 	/**
-	 * Plays one of the game's sound effects, identified by its original number
+	 * Plays one of the game's sound effects, identified by its original
+	 * number. Some effects are varied by values from where they're played
 	 */
-	void playSoundEffect(byte effect);
+	void playSoundEffect(byte effect, byte arg1 = 0, byte arg2 = 0);
 
 	Data::Savegame _savegame;
 	Data::Map _map;
diff --git a/engines/ultima/ultima3/views/combat_map.cpp b/engines/ultima/ultima3/views/combat_map.cpp
index aa8ca83589b..c882e808c15 100644
--- a/engines/ultima/ultima3/views/combat_map.cpp
+++ b/engines/ultima/ultima3/views/combat_map.cpp
@@ -100,7 +100,7 @@ void CombatMap::monstersTurn() {
 
 void CombatMap::victory() {
 	_G(messages).print("****Victory!****\n\n");
-	g_engine->playSoundEffect(0xFD);
+	g_engine->playSoundEffect(0xFD, 0x80, 0x10);
 
 	_G(combat).endHold();
 	_G(effects)._highlight = -1;
@@ -129,7 +129,7 @@ void CombatMap::processFrame() {
 			_G(messages).print(event._text.c_str());
 			break;
 		case CombatEvent::SOUND:
-			g_engine->playSoundEffect(event._arg1);
+			g_engine->playSoundEffect(event._arg1, event._arg2, event._arg3);
 			break;
 		case CombatEvent::OVERLAY:
 			_overlay = true;
diff --git a/engines/ultima/ultima3/views/interactions/cast_spell.cpp b/engines/ultima/ultima3/views/interactions/cast_spell.cpp
index a78ca368cd1..0e615fe0363 100644
--- a/engines/ultima/ultima3/views/interactions/cast_spell.cpp
+++ b/engines/ultima/ultima3/views/interactions/cast_spell.cpp
@@ -99,9 +99,9 @@ bool CastSpell::fail() {
 }
 
 void CastSpell::fanfare() {
-	g_engine->playSoundEffect(0xF5);
+	g_engine->playSoundEffect(0xF5, _spell);
 	_G(effects).flashViewport();
-	g_engine->playSoundEffect(0xFD);
+	g_engine->playSoundEffect(0xFD, (_spell & 0x0F) | 0x60, 0x30);
 }
 
 bool CastSpell::perform(Effect effect) {
@@ -399,6 +399,7 @@ bool CastSpell::keypress(const KeypressMessage &msg) {
 
 		// Spells cost five magic points for each place down the book
 		int spell = key - 'A';
+		_spell = spell;
 		Data::RosterEntry &caster = save.partyMember(_slot);
 		_cost = spell * MP_PER_LEVEL;
 		if (_cost > Data::fromBcd(caster._magicPoints)) {
diff --git a/engines/ultima/ultima3/views/interactions/cast_spell.h b/engines/ultima/ultima3/views/interactions/cast_spell.h
index fdb8da92d0e..cd129977aa5 100644
--- a/engines/ultima/ultima3/views/interactions/cast_spell.h
+++ b/engines/ultima/ultima3/views/interactions/cast_spell.h
@@ -58,6 +58,7 @@ private:
 	bool _cleric = false;
 	int _slot;
 	int _cost = 0;
+	int _spell = 0;
 	Effect _effect = SLAY_ORCS;
 	int _amount = 0;
 	PlayerChooser _players;
diff --git a/engines/ultima/ultima3/views/interactions/enter_shrine.cpp b/engines/ultima/ultima3/views/interactions/enter_shrine.cpp
index 3096320e990..8791b0402fc 100644
--- a/engines/ultima/ultima3/views/interactions/enter_shrine.cpp
+++ b/engines/ultima/ultima3/views/interactions/enter_shrine.cpp
@@ -105,7 +105,7 @@ bool EnterShrine::keypress(const KeypressMessage &msg) {
 	_G(messages).print("\nShazam!\n");
 	_G(effects).flashSlot(_chooser.slot());
 	_G(effects).flashViewport();
-	g_engine->playSoundEffect(0xFD);
+	g_engine->playSoundEffect(0xFD, 0xD8, 0x30);
 	return true;
 }
 
diff --git a/engines/ultima/ultima3/views/interactions/shops.cpp b/engines/ultima/ultima3/views/interactions/shops.cpp
index f3d572b9897..89d7942789d 100644
--- a/engines/ultima/ultima3/views/interactions/shops.cpp
+++ b/engines/ultima/ultima3/views/interactions/shops.cpp
@@ -199,7 +199,7 @@ bool Temple::serve(int slot) {
 	auto flash = [&]() {
 		_G(effects).flashViewport();
 		_G(effects).flashSlot(slot);
-		g_engine->playSoundEffect(0xFD);
+		g_engine->playSoundEffect(0xFD, 0xC0, 0x80);
 	};
 
 	switch (_service) {
diff --git a/engines/ultima/ultima3/views/interactions/transact.cpp b/engines/ultima/ultima3/views/interactions/transact.cpp
index 3fd0bfaab3d..6410c6dda95 100644
--- a/engines/ultima/ultima3/views/interactions/transact.cpp
+++ b/engines/ultima/ultima3/views/interactions/transact.cpp
@@ -59,7 +59,7 @@ void Transact::lordBritish() {
 		e._maxHitPoints = (e._maxHitPoints & 0xFF) | (Data::toBcd(Data::fromBcd(level) + 1) << 8);
 		_G(messages).print("Thou art greater\n\n");
 		_G(effects).flashViewport();
-		g_engine->playSoundEffect(0xFD);
+		g_engine->playSoundEffect(0xFD, 0x80, 0x40);
 	}
 }
 
diff --git a/engines/ultima/ultima3/views/interactions/yell.cpp b/engines/ultima/ultima3/views/interactions/yell.cpp
index 66d990c85b9..a69c76c711c 100644
--- a/engines/ultima/ultima3/views/interactions/yell.cpp
+++ b/engines/ultima/ultima3/views/interactions/yell.cpp
@@ -71,7 +71,7 @@ bool Yell::keypress(const KeypressMessage &msg) {
 	if (_text.word() == "EVOCARE" && (e._marksAndCards & MARK_OF_SNAKE) && atCrossing) {
 		save._posY ^= 3;
 		_G(effects).flashViewport();
-		g_engine->playSoundEffect(0xFD);
+		g_engine->playSoundEffect(0xFD, 0xC0, 0x40);
 	} else {
 		_G(messages).print("No effect!\n");
 	}


Commit: 9499ec9bbbaba721c83a12c9655d2cc7a5d3c658
    https://github.com/scummvm/scummvm/commit/9499ec9bbbaba721c83a12c9655d2cc7a5d3c658
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:41:02+11:00

Commit Message:
ULTIMA: ULTIMA3: Add the bolts of the castle of Exodus

Changed paths:
    engines/ultima/ultima3/logic/location_logic.cpp
    engines/ultima/ultima3/logic/location_logic.h
    engines/ultima/ultima3/views/location_map.cpp
    engines/ultima/ultima3/views/location_map.h


diff --git a/engines/ultima/ultima3/logic/location_logic.cpp b/engines/ultima/ultima3/logic/location_logic.cpp
index a7963c2c831..6b296c9ebf8 100644
--- a/engines/ultima/ultima3/logic/location_logic.cpp
+++ b/engines/ultima/ultima3/logic/location_logic.cpp
@@ -25,6 +25,7 @@
 namespace Ultima {
 namespace Ultima3 {
 
+constexpr int EXODUS_CASTLE_X = 10;
 constexpr byte TILE_WATER = 0;
 constexpr byte TILE_MOUNTAINS = 4;
 constexpr byte TILE_SHIP_WATER = 12;
@@ -309,6 +310,12 @@ void LocationLogic::teleportThroughMoonGate() {
 	save._posY = GATE_Y[save._moonPhase[1]];
 	_G(effects).flashViewport();
 	g_engine->playSoundEffect(0xFD, 0xC0, 0x20);
+	g_engine->playSoundEffect(0xFD, 0xC0, 0x20);
+}
+
+bool LocationLogic::isInExodusCastle() const {
+	const Data::Savegame &save = _G(savegame);
+	return save._location == Data::LOCATION_CASTLE && save._worldX == EXODUS_CASTLE_X;
 }
 
 bool LocationLogic::isOnWhirlpool() const {
diff --git a/engines/ultima/ultima3/logic/location_logic.h b/engines/ultima/ultima3/logic/location_logic.h
index fa81b6eda87..11d51d9af1a 100644
--- a/engines/ultima/ultima3/logic/location_logic.h
+++ b/engines/ultima/ultima3/logic/location_logic.h
@@ -81,6 +81,11 @@ public:
 
 	bool isOnMoonGate() const;
 
+	/**
+	 * Returns true if the party is in the castle of Exodus
+	 */
+	bool isInExodusCastle() const;
+
 	/**
 	 * Moves the party from a moon gate to the one the moons lead to
 	 */
diff --git a/engines/ultima/ultima3/views/location_map.cpp b/engines/ultima/ultima3/views/location_map.cpp
index 6afee9d1c5f..46fd9904b1a 100644
--- a/engines/ultima/ultima3/views/location_map.cpp
+++ b/engines/ultima/ultima3/views/location_map.cpp
@@ -53,6 +53,7 @@ constexpr byte TILE_GRASS = 1;
 constexpr byte TILE_FOREST = 3;
 constexpr byte TILE_MOUNTAINS = 4;
 constexpr byte TILE_WALL = 0x23;
+constexpr byte TILE_FLOOR = 8;
 
 // Tiles that block the view of whatever lies behind them
 static bool blocksView(byte tile) {
@@ -185,12 +186,17 @@ void LocationMap::endTurn() {
 	if (!throughGate && _logic.isOnWhirlpool())
 		_logic.teleportToAmbrosia();
 
+	// The castle of Exodus breaks any holding of time, and lashes out
+	const bool exodus = _logic.isInExodusCastle();
+	if (exodus)
+		_G(holdTime) = 0;
+
 	// A creature reaching the party starts a fight
 	int creature = _creatures.update(_moved);
 	_moved = false;
 
 	_pendingCreature = creature;
-	startBreaths(_creatures.takeBreaths());
+	startBreaths(_creatures.takeBreaths(), exodus);
 	if (_breaths.empty())
 		finishTurn(creature);
 }
@@ -205,7 +211,7 @@ void LocationMap::finishTurn(int creature) {
 		startPrompt();
 }
 
-void LocationMap::startBreaths(const Common::Array<CreatureLogic::Breath> &breaths) {
+void LocationMap::startBreaths(const Common::Array<CreatureLogic::Breath> &breaths, bool exodusBolt) {
 	byte tiles[VIEWPORT_CELLS];
 	buildViewport(tiles);
 
@@ -213,6 +219,22 @@ void LocationMap::startBreaths(const Common::Array<CreatureLogic::Breath> &breat
 	_breathStep = 0;
 	_breathFrames = 0;
 
+	if (exodusBolt) {
+		// A bolt lands somewhere in view, only doing anything on the party or the floor
+		BreathPath bolt;
+		int x = g_events->getRandomNumber(VIEWPORT_TILES - 1);
+		int y = g_events->getRandomNumber(VIEWPORT_TILES - 1);
+		bolt._hits = x == centre && y == centre;
+
+		if (bolt._hits || tiles[y * VIEWPORT_TILES + x] == TILE_FLOOR) {
+			bolt._tiles.push_back(Common::Point(x, y));
+			_breaths.push_back(bolt);
+
+			if (!bolt._hits)
+				g_engine->playSoundEffect(0xF7);
+		}
+	}
+
 	for (uint i = 0; i < breaths.size(); ++i) {
 		BreathPath path;
 		path._hits = false;
diff --git a/engines/ultima/ultima3/views/location_map.h b/engines/ultima/ultima3/views/location_map.h
index 70482bffc8e..29218680a2b 100644
--- a/engines/ultima/ultima3/views/location_map.h
+++ b/engines/ultima/ultima3/views/location_map.h
@@ -67,7 +67,7 @@ private:
 	/**
 	 * Works out where each blast of fire goes, and starts showing them
 	 */
-	void startBreaths(const Common::Array<CreatureLogic::Breath> &breaths);
+	void startBreaths(const Common::Array<CreatureLogic::Breath> &breaths, bool exodusBolt);
 
 	/**
 	 * Hurts the party if the blast on show has reached them


Commit: fc9c9d7b0efcbca1a2a4cff1fec93294cf859142
    https://github.com/scummvm/scummvm/commit/fc9c9d7b0efcbca1a2a4cff1fec93294cf859142
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:41:02+11:00

Commit Message:
ULTIMA: ULTIMA3: Make the town of Dawn appear with the full moons

Changed paths:
    engines/ultima/ultima3/logic/location_logic.cpp


diff --git a/engines/ultima/ultima3/logic/location_logic.cpp b/engines/ultima/ultima3/logic/location_logic.cpp
index 6b296c9ebf8..e23ec774ed3 100644
--- a/engines/ultima/ultima3/logic/location_logic.cpp
+++ b/engines/ultima/ultima3/logic/location_logic.cpp
@@ -26,6 +26,9 @@ namespace Ultima {
 namespace Ultima3 {
 
 constexpr int EXODUS_CASTLE_X = 10;
+constexpr int DAWN_X = 37, DAWN_Y = 53;
+constexpr byte CELL_TOWN = 0x18;
+constexpr byte CELL_FOREST = 0x0C;
 constexpr byte TILE_WATER = 0;
 constexpr byte TILE_MOUNTAINS = 4;
 constexpr byte TILE_SHIP_WATER = 12;
@@ -295,6 +298,12 @@ void LocationLogic::updateMoons() {
 
 	_G(map).setCell(GATE_X[oldLeft], GATE_Y[oldLeft], CELL_GRASS);
 	_G(map).setCell(GATE_X[save._moonPhase[0]], GATE_Y[save._moonPhase[0]], CELL_MOON_GATE);
+
+	// The town of Dawn only shows itself when both moons were full, and hides again when both were new
+	if ((oldLeft & oldRight) == 7)
+		_G(map).setCell(DAWN_X, DAWN_Y, CELL_TOWN);
+	else if ((oldLeft | oldRight) == 0)
+		_G(map).setCell(DAWN_X, DAWN_Y, CELL_FOREST);
 }
 
 bool LocationLogic::isOnMoonGate() const {


Commit: 697a6d07fc202a16da794b6e9d00d6d3ea47d164
    https://github.com/scummvm/scummvm/commit/697a6d07fc202a16da794b6e9d00d6d3ea47d164
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:41:02+11:00

Commit Message:
ULTIMA: ULTIMA3: Add a console command to go to the Exodus machine with the cards

Changed paths:
    engines/ultima/ultima3/console.cpp
    engines/ultima/ultima3/console.h


diff --git a/engines/ultima/ultima3/console.cpp b/engines/ultima/ultima3/console.cpp
index 702d5d62ba4..a31e76c0ffd 100644
--- a/engines/ultima/ultima3/console.cpp
+++ b/engines/ultima/ultima3/console.cpp
@@ -49,6 +49,7 @@ Console::Console() : GUI::Debugger() {
 	registerCmd("inventory", WRAP_METHOD(Console, cmdInventory));
 	registerCmd("load", WRAP_METHOD(Console, cmdLoad));
 	registerCmd("save", WRAP_METHOD(Console, cmdSave));
+	registerCmd("exodus", WRAP_METHOD(Console, cmdExodus));
 }
 
 Console::~Console() {
@@ -141,6 +142,37 @@ bool Console::cmdMap(int argc, const char **argv) {
 	return false;
 }
 
+bool Console::cmdExodus(int argc, const char **argv) {
+	constexpr byte ALL_CARDS = 0x0F;
+	constexpr int START_X = 30, START_Y = 12;
+
+	ensureGame();
+	LocationLogic logic;
+
+	if (_G(savegame)._location != Data::LOCATION_SOSARIA)
+		logic.exitToWorld();
+
+	int index = -1;
+	for (int i = 0; i < LocationLogic::entranceCount() && index < 0; ++i) {
+		if (!strcmp(LocationLogic::entranceFilename(i), "EXODUS.ULT"))
+			index = i;
+	}
+
+	if (index < 0 || !logic.enterLocation(index)) {
+		debugPrintf("Could not enter the castle of Exodus, which has no data file\n");
+		return true;
+	}
+
+	// In front of the machine's first slot, holding all four cards
+	Data::Savegame &sg = _G(savegame);
+	sg._posX = START_X;
+	sg._posY = START_Y;
+	sg.partyMember(0)._marksAndCards |= ALL_CARDS;
+
+	restartGame();
+	return false;
+}
+
 bool Console::cmdTiles(int argc, const char **argv) {
 	Graphics::ManagedSurface surface(Gfx::SHAPE_SIZE, Gfx::SHAPE_SIZE, Graphics::PixelFormat::createFormatCLUT8());
 
diff --git a/engines/ultima/ultima3/console.h b/engines/ultima/ultima3/console.h
index 7230a7b4269..fe066323ac0 100644
--- a/engines/ultima/ultima3/console.h
+++ b/engines/ultima/ultima3/console.h
@@ -60,6 +60,7 @@ private:
 	bool cmdInventory(int argc, const char **argv);
 	bool cmdLoad(int argc, const char **argv);
 	bool cmdSave(int argc, const char **argv);
+	bool cmdExodus(int argc, const char **argv);
 
 public:
 	Console();


Commit: 57553e013bedd768aff8025d255b72d43889abf8
    https://github.com/scummvm/scummvm/commit/57553e013bedd768aff8025d255b72d43889abf8
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:41:02+11:00

Commit Message:
ULTIMA: ULTIMA3: Import and export the original world file and moons with the save files

Changed paths:
    engines/ultima/ultima3/console.cpp
    engines/ultima/ultima3/data/map.cpp
    engines/ultima/ultima3/data/map.h


diff --git a/engines/ultima/ultima3/console.cpp b/engines/ultima/ultima3/console.cpp
index a31e76c0ffd..82a71dd7e13 100644
--- a/engines/ultima/ultima3/console.cpp
+++ b/engines/ultima/ultima3/console.cpp
@@ -20,6 +20,7 @@
  */
 
 #include "common/file.h"
+#include "common/fs.h"
 #include "ultima/ultima3/console.h"
 #include "ultima/ultima3/ultima3.h"
 #include "ultima/ultima3/data/data.h"
@@ -450,35 +451,71 @@ bool Console::cmdInventory(int argc, const char **argv) {
 	return true;
 }
 
-bool Console::cmdLoad(int argc, const char **argv) {
-	if (argc != 1 && argc != 3) {
-		debugPrintf("load [<roster file> <party file>]  - imports original DOS save files; "
-			"defaults to ROSTER.ULT and PARTY.ULT\n");
-		return true;
+// Where the moons are kept in the world file, after the whirlpool
+constexpr int MOON_PHASES = 4;
+constexpr int MOON_COUNTDOWNS = 6;
+
+// Opens a file of a saved game, from a folder if given or else from the game's own
+static Common::SeekableReadStream *openSaved(const Common::String &folder, const char *name) {
+	if (!folder.empty())
+		return Common::FSNode(Common::Path(folder)).getChild(name).createReadStream();
+
+	Common::File *f = new Common::File();
+	if (!f->open(name)) {
+		delete f;
+		return nullptr;
+	}
+
+	return f;
+}
+
+static Common::WriteStream *createSaved(const Common::String &folder, const char *name) {
+	if (!folder.empty())
+		return Common::FSNode(Common::Path(folder)).getChild(name).createWriteStream();
+
+	Common::DumpFile *f = new Common::DumpFile();
+	if (!f->open(Common::Path(name), true)) {
+		delete f;
+		return nullptr;
 	}
 
-	Common::String rosterName = (argc == 3) ? argv[1] : ROSTER_FILE;
-	Common::String partyName = (argc == 3) ? argv[2] : PARTY_FILE;
+	return f;
+}
 
-	Common::File rosterFile, partyFile;
-	if (!rosterFile.open(rosterName.c_str())) {
-		debugPrintf("Could not open %s\n", rosterName.c_str());
+bool Console::cmdLoad(int argc, const char **argv) {
+	if (argc > 2) {
+		debugPrintf("load [<folder>]  - imports the original DOS save files ROSTER.ULT, PARTY.ULT "
+			"and SOSARIA.ULT from a folder, defaulting to the game's own\n");
 		return true;
 	}
-	if (!partyFile.open(partyName.c_str())) {
-		debugPrintf("Could not open %s\n", partyName.c_str());
+
+	Common::String folder = (argc == 2) ? argv[1] : "";
+	Common::ScopedPtr<Common::SeekableReadStream> roster(openSaved(folder, ROSTER_FILE));
+	Common::ScopedPtr<Common::SeekableReadStream> party(openSaved(folder, PARTY_FILE));
+	if (!roster || !party) {
+		debugPrintf("Could not open %s and %s\n", ROSTER_FILE, PARTY_FILE);
 		return true;
 	}
 
 	Data::Savegame &sg = _G(savegame);
-	if (!sg.importOriginal(rosterFile, partyFile)) {
-		debugPrintf("%s and %s are too short to be save files\n", rosterName.c_str(), partyName.c_str());
+	if (!sg.importOriginal(*roster, *party)) {
+		debugPrintf("%s and %s are too short to be save files\n", ROSTER_FILE, PARTY_FILE);
 		return true;
 	}
 
-	// The world they were saved in comes with the party
-	if (Common::File::exists(WORLD_FILE)) {
-		_G(map).load(WORLD_FILE);
+	// The world they were saved in comes with the party, including where the moons are
+	Common::ScopedPtr<Common::SeekableReadStream> world(openSaved(folder, WORLD_FILE));
+	if (world) {
+		if (!_G(map).load(*world)) {
+			debugPrintf("%s is too short to be a map\n", WORLD_FILE);
+			return true;
+		}
+
+		for (int i = 0; i < 2; ++i) {
+			sg._moonPhase[i] = _G(map).extra(MOON_PHASES + i);
+			sg._moonCountdown[i] = _G(map).extra(MOON_COUNTDOWNS + i);
+		}
+
 		sg._mapLoaded = true;
 	} else {
 		ensureGame();
@@ -493,9 +530,9 @@ bool Console::cmdLoad(int argc, const char **argv) {
 }
 
 bool Console::cmdSave(int argc, const char **argv) {
-	if (argc != 1 && argc != 3) {
-		debugPrintf("save [<roster file> <party file>]  - exports original DOS save files; "
-			"defaults to ROSTER.ULT and PARTY.ULT\n");
+	if (argc > 2) {
+		debugPrintf("save [<folder>]  - exports the original DOS save files ROSTER.ULT, PARTY.ULT "
+			"and SOSARIA.ULT to a folder, defaulting to the dumps folder\n");
 		return true;
 	}
 
@@ -505,21 +542,26 @@ bool Console::cmdSave(int argc, const char **argv) {
 		return true;
 	}
 
-	Common::String rosterName = (argc == 3) ? argv[1] : ROSTER_FILE;
-	Common::String partyName = (argc == 3) ? argv[2] : PARTY_FILE;
-
-	Common::DumpFile rosterFile, partyFile;
-	if (!rosterFile.open(Common::Path(rosterName), true)) {
-		debugPrintf("Could not create %s\n", rosterName.c_str());
+	Common::String folder = (argc == 2) ? argv[1] : "";
+	Common::ScopedPtr<Common::WriteStream> roster(createSaved(folder, ROSTER_FILE));
+	Common::ScopedPtr<Common::WriteStream> party(createSaved(folder, PARTY_FILE));
+	Common::ScopedPtr<Common::WriteStream> world(createSaved(folder, WORLD_FILE));
+	if (!roster || !party || !world) {
+		debugPrintf("Could not create the save files\n");
 		return true;
 	}
-	if (!partyFile.open(Common::Path(partyName), true)) {
-		debugPrintf("Could not create %s\n", partyName.c_str());
-		return true;
+
+	sg.exportOriginal(*roster, *party);
+
+	// The world is the one the party came from if they're somewhere else
+	Data::Map map = (sg._location == Data::LOCATION_SOSARIA) ? _G(map) : _G(worldMap);
+	for (int i = 0; i < 2; ++i) {
+		map.extra(MOON_PHASES + i) = sg._moonPhase[i];
+		map.extra(MOON_COUNTDOWNS + i) = sg._moonCountdown[i];
 	}
+	map.save(*world);
 
-	sg.exportOriginal(rosterFile, partyFile);
-	debugPrintf("Exported %s and %s\n", rosterName.c_str(), partyName.c_str());
+	debugPrintf("Exported %s, %s and %s\n", ROSTER_FILE, PARTY_FILE, WORLD_FILE);
 	return true;
 }
 
diff --git a/engines/ultima/ultima3/data/map.cpp b/engines/ultima/ultima3/data/map.cpp
index e5a5a85355d..c196b02bc96 100644
--- a/engines/ultima/ultima3/data/map.cpp
+++ b/engines/ultima/ultima3/data/map.cpp
@@ -35,12 +35,21 @@ void Map::load(const char *filename) {
 	if (!f.open(filename))
 		error("Could not load %s", filename);
 
-	Common::Serializer s(&f, nullptr);
-	synchronizeData(s);
-	if (f.err() || f.eos())
+	if (!load(f))
 		error("Could not load %s", filename);
 }
 
+bool Map::load(Common::SeekableReadStream &src) {
+	Common::Serializer s(&src, nullptr);
+	synchronizeData(s);
+	return !src.err() && !src.eos();
+}
+
+void Map::save(Common::WriteStream &dest) {
+	Common::Serializer s(nullptr, &dest);
+	synchronizeData(s);
+}
+
 const char *Map::text(int index) const {
 	int pos = index * 2;
 	if (index < 0 || pos + 1 >= TEXT_SIZE)
diff --git a/engines/ultima/ultima3/data/map.h b/engines/ultima/ultima3/data/map.h
index c0ec848d9e5..1f664135bad 100644
--- a/engines/ultima/ultima3/data/map.h
+++ b/engines/ultima/ultima3/data/map.h
@@ -88,6 +88,17 @@ public:
 	 */
 	void load(const char *filename);
 
+	/**
+	 * Loads a location from a stream in the form of a .ULT file
+	 * @returns		False if the stream is too short
+	 */
+	bool load(Common::SeekableReadStream &src);
+
+	/**
+	 * Writes a location out in the form of a .ULT file
+	 */
+	void save(Common::WriteStream &dest);
+
 	void synchronize(Common::Serializer &s);
 
 	/**


Commit: 0726b13c8c0a89d017bbedc7712dd144c26c37df
    https://github.com/scummvm/scummvm/commit/0726b13c8c0a89d017bbedc7712dd144c26c37df
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:41:02+11:00

Commit Message:
ULTIMA: ULTIMA3: Add the misty writing on the dungeon walls

Changed paths:
    engines/ultima/ultima3/data/dungeon.cpp
    engines/ultima/ultima3/data/dungeon.h
    engines/ultima/ultima3/views/dungeon_map.cpp


diff --git a/engines/ultima/ultima3/data/dungeon.cpp b/engines/ultima/ultima3/data/dungeon.cpp
index 2950ec8b91d..b386825fce9 100644
--- a/engines/ultima/ultima3/data/dungeon.cpp
+++ b/engines/ultima/ultima3/data/dungeon.cpp
@@ -37,6 +37,18 @@ void Dungeon::load(const char *filename) {
 		error("Could not load %s", filename);
 }
 
+const char *Dungeon::sign(int level) const {
+	if (level < 0 || level >= DUNGEON_LEVELS)
+		return nullptr;
+
+	// The strings are found by offsets listed at the start
+	int offset = _signs[level * 2] | (_signs[level * 2 + 1] << 8);
+	if (offset >= SIGNS_SIZE || !memchr(_signs + offset, 0, SIGNS_SIZE - offset))
+		return nullptr;
+
+	return (const char *)_signs + offset;
+}
+
 void Dungeon::synchronize(Common::Serializer &s) {
 	s.syncBytes(_tiles, sizeof(_tiles));
 	s.syncBytes(_signs, sizeof(_signs));
diff --git a/engines/ultima/ultima3/data/dungeon.h b/engines/ultima/ultima3/data/dungeon.h
index 90dce836340..b83da8dce17 100644
--- a/engines/ultima/ultima3/data/dungeon.h
+++ b/engines/ultima/ultima3/data/dungeon.h
@@ -39,6 +39,7 @@ constexpr byte DTILE_WIND = 3;
 constexpr byte DTILE_TRAP = 4;
 constexpr byte DTILE_MARK = 5;
 constexpr byte DTILE_GREMLINS = 6;
+constexpr byte DTILE_SIGN = 8;
 
 // Flags in the bits above those
 constexpr byte DTILE_LADDER_UP = 0x10;
@@ -75,6 +76,11 @@ public:
 	void setTile(int level, int x, int y, byte value) {
 		_tiles[(level << 8) + ((y & (DUNGEON_SIZE - 1)) << 4) + (x & (DUNGEON_SIZE - 1))] = value;
 	}
+
+	/**
+	 * Returns what the sign on a level says, or null if there isn't one
+	 */
+	const char *sign(int level) const;
 };
 
 } // namespace Data
diff --git a/engines/ultima/ultima3/views/dungeon_map.cpp b/engines/ultima/ultima3/views/dungeon_map.cpp
index 7d019cac696..8646bafa55c 100644
--- a/engines/ultima/ultima3/views/dungeon_map.cpp
+++ b/engines/ultima/ultima3/views/dungeon_map.cpp
@@ -152,6 +152,14 @@ void DungeonMap::endTurn() {
 			addView("CombatMap");
 			return;
 		}
+	} else if (tile == Data::DTILE_SIGN) {
+		// Writing on the wall for this level, which then fades
+		const char *sign = _G(dungeon).sign(save._dungeonLevel);
+		_G(dungeon).setTile(save._dungeonLevel, save._posX, save._posY, 0);
+		_G(messages).print("Misty writing:\n");
+		if (sign)
+			_G(messages).print(sign);
+		_G(messages).print("\n");
 	} else if (tile >= FIRST_SPECIAL && tile <= LAST_SPECIAL) {
 		_special = true;
 		startInteraction(new Interactions::DungeonSpecial(tile));


Commit: bc3951987e7c526dd206550a2e6df2c3512bfd5d
    https://github.com/scummvm/scummvm/commit/bc3951987e7c526dd206550a2e6df2c3512bfd5d
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:41:02+11:00

Commit Message:
ULTIMA: ULTIMA3: Add firing the ship's cannon and the disabled surface commands

Changed paths:
    engines/ultima/ultima3/views/location_map.cpp
    engines/ultima/ultima3/views/location_map.h


diff --git a/engines/ultima/ultima3/views/location_map.cpp b/engines/ultima/ultima3/views/location_map.cpp
index 46fd9904b1a..cd803fdb101 100644
--- a/engines/ultima/ultima3/views/location_map.cpp
+++ b/engines/ultima/ultima3/views/location_map.cpp
@@ -20,6 +20,7 @@
  */
 
 #include "ultima/ultima3/views/location_map.h"
+#include "ultima/ultima3/data/data.h"
 #include "ultima/ultima3/logic/chest_logic.h"
 #include "ultima/ultima3/views/menu_input.h"
 #include "ultima/ultima3/views/interactions/cast_spell.h"
@@ -54,6 +55,8 @@ constexpr byte TILE_FOREST = 3;
 constexpr byte TILE_MOUNTAINS = 4;
 constexpr byte TILE_WALL = 0x23;
 constexpr byte TILE_FLOOR = 8;
+constexpr byte TILE_PIRATE_SHIP = 0x3C;
+constexpr int CANNON_RANGE = 3;
 
 // Tiles that block the view of whatever lies behind them
 static bool blocksView(byte tile) {
@@ -330,24 +333,70 @@ void LocationMap::attackDirection(Direction dir) {
 	}
 }
 
+void LocationMap::fireCannon(Direction dir) {
+	const Data::Savegame &save = _G(savegame);
+	Data::Creatures &c = _G(map)._creatures;
+	const int dx = (dir == DIR_EAST) ? 1 : (dir == DIR_WEST) ? -1 : 0;
+	const int dy = (dir == DIR_SOUTH) ? 1 : (dir == DIR_NORTH) ? -1 : 0;
+	const int centre = VIEWPORT_TILES / 2;
+	auto succeeds = []() {
+		return g_events->getRandomNumber(255) >= 128;
+	};
+
+	g_engine->playSoundEffect(0xFB);
+	BreathPath ball;
+	ball._hits = false;
+
+	// The cannonball flies a few tiles, stopping at the first creature
+	for (int step = 1; step <= CANNON_RANGE; ++step) {
+		ball._tiles.push_back(Common::Point(centre + dx * step, centre + dy * step));
+
+		int x = (save._posX + dx * step) & (Data::MAP_SIZE - 1);
+		int y = (save._posY + dy * step) & (Data::MAP_SIZE - 1);
+		int creature = _creatures.creatureAt(x, y);
+		if (creature < 0)
+			continue;
+
+		g_engine->playSoundEffect(0xF7);
+
+		// Pirate ships are harder to sink
+		byte tile = c._tile[creature];
+		if ((tile != TILE_PIRATE_SHIP || succeeds()) && succeeds()) {
+			_G(messages).print(Data::NAMES[tile >> 2]);
+			_G(messages).print("s\nDestroyed!\n");
+			_G(map).setCell(x, y, c._floor[creature]);
+			c._tile[creature] = 0;
+		}
+
+		break;
+	}
+
+	_breaths.push_back(ball);
+}
+
 namespace {
 
 // Asks which way the party attacks on the map
 class MapAttack : public Interactions::Interaction {
 private:
 	LocationMap *_map;
+	bool _fire;
 	Interactions::DirectionChooser _chooser;
 
 public:
-	MapAttack(LocationMap *map) : _map(map) {}
+	MapAttack(LocationMap *map, bool fire = false) : _map(map), _fire(fire) {}
 
 	bool keypress(const KeypressMessage &msg) override {
 		Interactions::DirectionChooser::Result result = _chooser.handleKey(msg);
 		if (result == Interactions::DirectionChooser::PENDING)
 			return false;
 
-		if (result == Interactions::DirectionChooser::CHOSEN)
-			_map->attackDirection(_chooser.direction());
+		if (result == Interactions::DirectionChooser::CHOSEN) {
+			if (_fire)
+				_map->fireCannon(_chooser.direction());
+			else
+				_map->attackDirection(_chooser.direction());
+		}
 
 		return true;
 	}
@@ -360,6 +409,18 @@ void LocationMap::doAttack() {
 	startInteraction(new MapAttack(this));
 }
 
+void LocationMap::doFire() {
+	_G(messages).print("Fire");
+
+	if (_G(savegame)._transport != TRANSPORT_SHIP) {
+		commandFailed("<-What?\n");
+		return;
+	}
+
+	_G(messages).print("\nDirect-");
+	startInteraction(new MapAttack(this, true));
+}
+
 void LocationMap::doMove(Direction dir, const char *label) {
 	_G(messages).print(label);
 	_moved = true;
@@ -503,6 +564,17 @@ bool LocationMap::handleCommand(const KeypressMessage &msg) {
 	case 'A':
 		doAttack();
 		return true;
+	case 'F':
+		doFire();
+		return true;
+	case 'K':
+		_G(messages).print("Klimb");
+		commandFailed("<-What?\n");
+		return true;
+	case 'D':
+		_G(messages).print("Descend");
+		commandFailed("<-What?\n");
+		return true;
 	case 'G':
 		_G(messages).print("Get Chest!\nPlr to search-");
 		startInteraction(new Interactions::GetChest());
diff --git a/engines/ultima/ultima3/views/location_map.h b/engines/ultima/ultima3/views/location_map.h
index 29218680a2b..849608af16f 100644
--- a/engines/ultima/ultima3/views/location_map.h
+++ b/engines/ultima/ultima3/views/location_map.h
@@ -97,6 +97,7 @@ private:
 	void doEnter();
 	void doQuitSave();
 	void doAttack();
+	void doFire();
 	void doExitVehicle();
 
 protected:
@@ -120,6 +121,11 @@ public:
 	 * Has the party attack whatever is in a direction
 	 */
 	void attackDirection(Direction dir);
+
+	/**
+	 * Fires the ship's cannon in a direction
+	 */
+	void fireCannon(Direction dir);
 };
 
 } // namespace Views


Commit: bbe5ead264b71afe617b448c5992ff0dbc92e0c0
    https://github.com/scummvm/scummvm/commit/bbe5ead264b71afe617b448c5992ff0dbc92e0c0
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:41:02+11:00

Commit Message:
ULTIMA: ULTIMA2: Added u2 upgrade Composite render mode

Changed paths:
  A engines/ultima/ultima2/gfx/composite.cpp
  A engines/ultima/ultima2/gfx/composite.h
    engines/ultima/module.mk
    engines/ultima/ultima2/data/data.cpp
    engines/ultima/ultima2/data/data.h
    engines/ultima/ultima2/data/tiles.cpp
    engines/ultima/ultima2/data/tiles.h
    engines/ultima/ultima2/gfx/ega_picture.h
    engines/ultima/ultima2/ultima2.cpp
    engines/ultima/ultima2/views/dungeon_map.cpp
    engines/ultima/ultima2/views/dungeon_map.h
    engines/ultima/ultima2/views/ending.cpp
    engines/ultima/ultima2/views/helm_map.cpp
    engines/ultima/ultima2/views/location_map.cpp
    engines/ultima/ultima2/views/map.cpp
    engines/ultima/ultima2/views/map.h
    engines/ultima/ultima2/views/overworld_map.cpp
    engines/ultima/ultima2/views/title.cpp


diff --git a/engines/ultima/module.mk b/engines/ultima/module.mk
index 8fc9e4d54e0..e06a1efd0bf 100644
--- a/engines/ultima/module.mk
+++ b/engines/ultima/module.mk
@@ -118,6 +118,7 @@ MODULE_OBJS += \
 	ultima2/data/savegame.o \
 	ultima2/data/secret_archive.o \
 	ultima2/data/tiles.o \
+	ultima2/gfx/composite.o \
 	ultima2/gfx/ega_picture.o \
 	ultima2/gfx/pic_decoder.o \
 	ultima2/gfx/text_cursor.o \
diff --git a/engines/ultima/ultima2/data/data.cpp b/engines/ultima/ultima2/data/data.cpp
index 05a47b3b2fa..7cfa1a4dbf8 100644
--- a/engines/ultima/ultima2/data/data.cpp
+++ b/engines/ultima/ultima2/data/data.cpp
@@ -19,6 +19,9 @@
  *
  */
 
+#include "common/archive.h"
+#include "common/ptr.h"
+#include "common/stream.h"
 #include "common/system.h"
 #include "graphics/paletteman.h"
 #include "ultima/ultima2/data/data.h"
@@ -35,13 +38,10 @@ const byte CGA_PALETTE1[4 * 3] = {
 };
 
 const char *const RENDER_MODE_NAMES[RENDER_MODE_COUNT] = {
-	"ORIGINAL", "EGA", "EGA (V1.0)", "EGA (WILTSHIRE)", "EGA (C64)"
+	"ORIGINAL", "COMPOSITE", "EGA", "EGA (V1.0)", "EGA (WILTSHIRE)", "EGA (C64)"
 };
 
-// The standard 16-color EGA/VGA palette, confirmed as the one ega.drv
-// relies on (via the BIOS's default mode 13h palette, rather than
-// loading its own - see docs/enhanced-patch.md §3.6) - EGATILES' pixel
-// values are literal indices into this
+// The standard 16-color EGA/VGA palette
 const byte EGA_PALETTE16[EGA_PALETTE_SIZE * 3] = {
 	0x00, 0x00, 0x00, // 0: black
 	0x00, 0x00, 0xaa, // 1: blue
@@ -70,14 +70,34 @@ const byte PLANET_COORDS[PLANET_COUNT + 1][3] = {
 	{ 2, 8, 5 }, { 9, 4, 6 }, { 4, 0, 5 }, { 0, 1, 4 }, { 9, 9, 9 }
 };
 
+// CGACOMP.PAL is a standard VGA palette file: 256 entries of 6-bit R, G, B.
+// The composite decode only ever produces the first 16
+static void loadCompositePalette(Graphics::Palette &palette) {
+	Common::ScopedPtr<Common::SeekableReadStream> f(
+		SearchMan.createReadStreamForMember(Common::Path("cgacomp.pal")));
+	if (!f)
+		return;
+
+	for (int i = 0; i < COMPOSITE_PALETTE_SIZE; ++i) {
+		byte rgb[3];
+		if (f->read(rgb, 3) != 3)
+			return;
+
+		for (int c = 0; c < 3; ++c)
+			rgb[c] = (rgb[c] << 2) | (rgb[c] >> 4);
+		palette.set(rgb, COMPOSITE_PALETTE_BASE + i, 1);
+	}
+}
+
 void setPalette() {
-	Graphics::Palette palette(EGA_PALETTE_BASE + EGA_PALETTE_SIZE);
+	Graphics::Palette palette(COMPOSITE_PALETTE_BASE + COMPOSITE_PALETTE_SIZE);
 	palette.set(CGA_PALETTE1, 0, 4);
 
 	const byte green[3] = { 0x55, 0xff, 0x55 };
 	palette.set(green, PALETTE_PLAYER_MARKER, 1);
 
 	palette.set(EGA_PALETTE16, EGA_PALETTE_BASE, EGA_PALETTE_SIZE);
+	loadCompositePalette(palette);
 	g_system->getPaletteManager()->setPalette(palette);
 }
 
diff --git a/engines/ultima/ultima2/data/data.h b/engines/ultima/ultima2/data/data.h
index 9c4556b2f3f..b4ba06aa573 100644
--- a/engines/ultima/ultima2/data/data.h
+++ b/engines/ultima/ultima2/data/data.h
@@ -36,19 +36,17 @@ extern const byte CGA_PALETTE1[4 * 3];
 // dungeon minimap's player marker
 constexpr int PALETTE_PLAYER_MARKER = 4;
 
-// The "Ultima II Upgrade" fan patch's alternate renderers: each is VGA
-// mode 13h under the hood (not real EGA hardware - see
-// docs/enhanced-patch.md §3.6-3.8), using 16-of-256 palette entries and
-// tile/picture data from EGATILES-format files instead of the CGA
-// tileset embedded in the EXE. The EGA_* themes are pure data swaps
-// (alternate EGATILES/EGACOLOR/picture files), not different rendering
-// logic
+// The "Ultima II Upgrade" fan patch's alternate renderers
 enum RenderMode {
-	RENDER_CGA = 0, RENDER_EGA = 1, RENDER_EGA_V1 = 2, RENDER_EGA_WILTSHIRE = 3,
-	RENDER_EGA_C64 = 4, RENDER_MODE_COUNT = 5
+	RENDER_CGA = 0, RENDER_CGA_COMPOSITE = 1, RENDER_EGA = 2, RENDER_EGA_V1 = 3,
+	RENDER_EGA_WILTSHIRE = 4, RENDER_EGA_C64 = 5, RENDER_MODE_COUNT = 6
 };
 extern const char *const RENDER_MODE_NAMES[RENDER_MODE_COUNT];
 
+inline bool isEgaMode(RenderMode mode) {
+	return mode >= RENDER_EGA && mode < RENDER_MODE_COUNT;
+}
+
 // The EGA-family renderers' 16-color palette occupies this range, kept
 // well away from CGA_PALETTE1/PALETTE_PLAYER_MARKER (indices 0-4) so
 // CGA-drawn chrome (text, the pic??? title art) keeps rendering
@@ -57,6 +55,12 @@ constexpr int EGA_PALETTE_BASE = 16;
 constexpr int EGA_PALETTE_SIZE = 16;
 extern const byte EGA_PALETTE16[EGA_PALETTE_SIZE * 3];
 
+// The composite renderer's 16 artifact colors, which are loaded from
+// CGACOMP.PAL by setPalette. Gfx::compositeDecode maps each decoded CGA
+// pixel to one of these
+constexpr int COMPOSITE_PALETTE_BASE = 32;
+constexpr int COMPOSITE_PALETTE_SIZE = 16;
+
 // Names of the worlds that can be orbited, indexed by Savegame::_orbitTarget
 constexpr int PLANET_COUNT = 9;
 extern const char *const PLANET_NAMES[PLANET_COUNT];
@@ -66,20 +70,13 @@ extern const char *const PLANET_NAMES[PLANET_COUNT];
 extern const byte PLANET_COORDS[PLANET_COUNT + 1][3];
 
 /**
- * Switches the screen to the palette the game needs: CGA_PALETTE1 plus
- * the player-marker green at their fixed low indices (always active, so
- * CGA-drawn chrome keeps working in any render mode), plus EGA_PALETTE16
- * at EGA_PALETTE_BASE for whichever EGA-family renderer is active
+ * Switches the screen to the palette the game needs
  */
 void setPalette();
 
 constexpr int MAX_NAME_LENGTH = 12;
 
-// Ceilings for stats that round-trip through the original PLAYER file's
-// packed-BCD fields: items/weapons/armour/spells/torches/keys/thieves'
-// tools each use a single BCD byte (00-99), while food/gold/experience
-// use two (0000-9999). Gains are clamped at these rather than allowed to
-// overflow, unlike the original, which just rolls back around to 0
+// Ceilings for stats that round-trip through the original PLAYER file's packed-BCD fields
 constexpr int MAX_BCD_BYTE = 99;
 constexpr int MAX_BCD_WORD = 9999;
 
diff --git a/engines/ultima/ultima2/data/tiles.cpp b/engines/ultima/ultima2/data/tiles.cpp
index d5a3faeb3ce..59ff6e381f8 100644
--- a/engines/ultima/ultima2/data/tiles.cpp
+++ b/engines/ultima/ultima2/data/tiles.cpp
@@ -55,11 +55,9 @@ static void decodeTileRecord(const byte record[TILE_RECORD_SIZE], SurfaceT &surf
 	}
 }
 
-// EGATILES-format files (see docs/enhanced-patch.md §3.8): 65 headerless
-// 128-byte records (the 64 tiles, same order as TileId, plus the attack
-// sprite as a 65th), 4 bits/pixel, 8 bytes/row x 16 rows, high nibble
-// first. Pixel values are literal EGA_PALETTE16 indices, so they're
-// offset by EGA_PALETTE_BASE to land in that palette's reserved range
+// EGATILES-format file: 65 headerless 128-byte records (the 64 tiles, same order as TileId,
+// plus the attack sprite as a 65th), 4 bits/pixel, 8 bytes/row x 16 rows, high nibble
+// first. Pixel values are literal EGA_PALETTE16 indices, so they're offset by EGA_PALETTE_BASE
 constexpr int EGA_RECORD_SIZE = 128;
 constexpr int EGA_ATTACK_SPRITE_RECORD = 64;
 
@@ -77,9 +75,8 @@ static void decodeEgaTileRecord(const byte record[EGA_RECORD_SIZE], SurfaceT &su
 	}
 }
 
-// The base EGA data files live at the data root; each "theme" is a
-// subfolder holding alternate copies of some of them (confirmed pure data
-// swaps, no code differences - see docs/enhanced-patch.md §3.6)
+// The base EGA data files live at the data root; each "theme" is a subfolder holding
+// alternate copies of some of them
 static const char *egaThemeFolder(RenderMode mode) {
 	switch (mode) {
 	case RENDER_EGA_V1:
@@ -120,7 +117,7 @@ static void loadEgaTiles(Graphics::Surface tiles[TILE_COUNT], RenderMode mode) {
 }
 
 void loadTiles(Graphics::Surface tiles[TILE_COUNT], RenderMode mode) {
-	if (mode != RENDER_CGA) {
+	if (isEgaMode(mode)) {
 		loadEgaTiles(tiles, mode);
 		return;
 	}
@@ -141,7 +138,7 @@ void loadTiles(Graphics::Surface tiles[TILE_COUNT], RenderMode mode) {
 }
 
 void loadAttackSprite(Graphics::ManagedSurface &sprite, RenderMode mode) {
-	if (mode != RENDER_CGA) {
+	if (isEgaMode(mode)) {
 		Common::ScopedPtr<Common::SeekableReadStream> egaFile(openEgaFile(mode, "egatiles"));
 		if (!egaFile)
 			error("Could not open egatiles");
diff --git a/engines/ultima/ultima2/data/tiles.h b/engines/ultima/ultima2/data/tiles.h
index b909340578a..354f9ab2c4c 100644
--- a/engines/ultima/ultima2/data/tiles.h
+++ b/engines/ultima/ultima2/data/tiles.h
@@ -54,29 +54,19 @@ constexpr int TILE_WIDTH = 16;
 constexpr int TILE_HEIGHT = 16;
 
 /**
- * Opens one of the EGA-family renderers' data files by name (e.g.
- * "egatiles" or "picdng.ega") the way the upgrade's ega.drv does: the
- * active theme's own copy if it has one, otherwise the base copy at the
- * data root. Returns nullptr if neither exists; the caller owns the stream
+ * Opens one of the EGA-family renderers' data files by name. Returns nullptr
+ * if it doesn't exist; the caller owns the stream
  */
 Common::SeekableReadStream *openEgaFile(RenderMode mode, const Common::String &filename);
 
 /**
- * Decodes the 64 overworld/town tile graphics and (RENDER_CGA only) puts
- * them into CLUT8 surfaces indexed into the 4-color CGA_PALETTE1 (see
- * Gfx::PicDecoder). RENDER_CGA reads them embedded directly in
- * ULTIMAII.EXE, as the original does; the EGA-family modes instead read
- * an EGATILES-format file (see docs/enhanced-patch.md §3.8) and index
- * into EGA_PALETTE16 at EGA_PALETTE_BASE instead
+ * Decodes the 64 overworld/town tile graphics into CLUT8 surfaces
  */
 void loadTiles(Graphics::Surface tiles[TILE_COUNT], RenderMode mode);
 
 /**
  * Decodes the "sprite circle" graphic used to flash a hit indicator over
- * the player's position during combat (xorSpriteDrawCenter in the
- * original), in the same 16x16 CLUT8 format and palette convention as
- * loadTiles above. A ManagedSurface, unlike the plain map tiles, since it
- * needs to be XOR-blitted (see GfxSurface::xorBlitFrom)
+ * the player's position during combat
  */
 void loadAttackSprite(Graphics::ManagedSurface &sprite, RenderMode mode);
 
diff --git a/engines/ultima/ultima2/gfx/composite.cpp b/engines/ultima/ultima2/gfx/composite.cpp
new file mode 100644
index 00000000000..ad7c5f8ad41
--- /dev/null
+++ b/engines/ultima/ultima2/gfx/composite.cpp
@@ -0,0 +1,109 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "common/array.h"
+#include "ultima/ultima2/data/data.h"
+#include "ultima/ultima2/gfx/composite.h"
+#include "ultima/ultima2/ultima2.h"
+
+namespace Ultima {
+namespace Ultima2 {
+namespace Gfx {
+
+namespace {
+
+// For each possible window of 4 consecutive pixels (the first in the top
+// two bits), the colors of the middle two. A middle pixel shows as a solid
+// CGA color only if it matches a neighbor, otherwise as the "transition"
+// color of the two middle pixels together. Built the same way as the
+// driver's own table
+byte g_leftColor[256];
+byte g_rightColor[256];
+bool g_tableReady = false;
+
+void buildTable() {
+	for (int w = 0; w < 256; ++w) {
+		int p0 = (w >> 6) & 3, p1 = (w >> 4) & 3, p2 = (w >> 2) & 3, p3 = w & 3;
+		int mid = (p1 << 2) | p2;
+
+		g_leftColor[w] = (p1 == p0 || p1 == p2) ? (p1 << 2) | p1 : mid;
+		g_rightColor[w] = (p3 == p2 || p1 == p2) ? (p2 << 2) | p2 : mid;
+	}
+
+	g_tableReady = true;
+}
+
+} // End of anonymous namespace
+
+void compositeDecode(Graphics::ManagedSurface &surf, const Common::Rect &area) {
+	if (!g_tableReady)
+		buildTable();
+
+	Common::Rect r = area;
+	r.clip(Common::Rect(surf.w, surf.h));
+	if (r.isEmpty())
+		return;
+
+	// The output overwrites the pixels it reads, so work from a copy
+	int w = r.width(), h = r.height();
+	Common::Array<byte> src(w * h);
+	for (int y = 0; y < h; ++y)
+		memcpy(&src[y * w], surf.getBasePtr(r.left, r.top + y), w);
+
+	// Anything that isn't a CGA color doesn't take part in the decode
+	auto cga = [&](int x, int y) -> int {
+		byte v = src[y * w + x];
+		return v <= 3 ? v : 0;
+	};
+
+	for (int y = 0; y < h; ++y) {
+		byte *dst = (byte *)surf.getBasePtr(r.left, r.top + y);
+
+		for (int x = 0; x < w; x += 2) {
+			// The driver reads the byte after the end of a line from the start
+			// of the line after next in the same CGA bank, rather than
+			// treating it as blank
+			int p0 = (x > 0) ? cga(x - 1, y) : 0;
+			int p3 = (x + 2 < w) ? cga(x + 2, y) : ((y + 2 < h) ? cga(0, y + 2) : 0);
+			int window = (p0 << 6) | (cga(x, y) << 4) | (cga(x + 1, y) << 2) | p3;
+
+			if (src[y * w + x] <= 3)
+				dst[x] = Data::COMPOSITE_PALETTE_BASE + g_leftColor[window];
+			if (x + 1 < w && src[y * w + x + 1] <= 3)
+				dst[x + 1] = Data::COMPOSITE_PALETTE_BASE + g_rightColor[window];
+		}
+	}
+
+	surf.markAllDirty();
+}
+
+void compositeFinish(Graphics::ManagedSurface &surf, const Common::Rect &area) {
+	if (g_engine->getRenderMode() == Data::RENDER_CGA_COMPOSITE)
+		compositeDecode(surf, area);
+}
+
+void compositeFinish(Graphics::ManagedSurface &surf) {
+	compositeFinish(surf, Common::Rect(surf.w, surf.h));
+}
+
+} // namespace Gfx
+} // namespace Ultima2
+} // namespace Ultima
diff --git a/engines/ultima/ultima2/gfx/composite.h b/engines/ultima/ultima2/gfx/composite.h
new file mode 100644
index 00000000000..1d662621cac
--- /dev/null
+++ b/engines/ultima/ultima2/gfx/composite.h
@@ -0,0 +1,51 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef ULTIMA2_GFX_COMPOSITE_H
+#define ULTIMA2_GFX_COMPOSITE_H
+
+#include "common/rect.h"
+#include "graphics/managed_surface.h"
+
+namespace Ultima {
+namespace Ultima2 {
+namespace Gfx {
+
+/**
+ * Decodes CGA-indexed pixels (0-3) in the given area of a surface, in
+ * place, into the composite monitor's artifact colors: pixel values in
+ * the COMPOSITE_PALETTE_BASE range.
+ */
+void compositeDecode(Graphics::ManagedSurface &surf, const Common::Rect &area);
+
+/**
+ * Called by views of CGA-indexed graphics once they've finished drawing:
+ * decodes the area if the composite renderer is the active one, and does
+ * nothing otherwise
+ */
+void compositeFinish(Graphics::ManagedSurface &surf, const Common::Rect &area);
+void compositeFinish(Graphics::ManagedSurface &surf);
+
+} // namespace Gfx
+} // namespace Ultima2
+} // namespace Ultima
+
+#endif
diff --git a/engines/ultima/ultima2/gfx/ega_picture.h b/engines/ultima/ultima2/gfx/ega_picture.h
index ceffe8568b1..402074acd9a 100644
--- a/engines/ultima/ultima2/gfx/ega_picture.h
+++ b/engines/ultima/ultima2/gfx/ega_picture.h
@@ -35,14 +35,6 @@ namespace Gfx {
  * EGA-family renderers show it, into a 320x200 CLUT8 surface whose pixels
  * index EGA_PALETTE16 at EGA_PALETTE_BASE. The name is the picture's
  * original CGA filename, in lower case ("picdra", "picout", ...).
- *
- * As in the patch's ega.drv, three pictures (picdra, picdng, picspa) got
- * full 64,000-byte redraws, one byte per pixel. The rest (picout, pictwn,
- * piccas, picmin) are instead a 20x10 map of game tiles - a 200 byte .idx
- * file of tile codes, same encoding as the map files - drawn with the
- * current theme's own tileset. See docs/enhanced-patch.md §3.9
- *
- * Returns false if the picture's data couldn't be found
  */
 bool loadEgaPicture(const Common::String &name, Data::RenderMode mode,
 	Graphics::ManagedSurface &surf);
diff --git a/engines/ultima/ultima2/ultima2.cpp b/engines/ultima/ultima2/ultima2.cpp
index 2bc6b66a33c..8c1c1d90eb0 100644
--- a/engines/ultima/ultima2/ultima2.cpp
+++ b/engines/ultima/ultima2/ultima2.cpp
@@ -63,7 +63,6 @@ Common::Error Ultima2Engine::run() {
 
 	// Initialize 320x200 paletted graphics mode
 	initGraphics(320, 200);
-	Data::setPalette();
 	_pcSpeakerReady = _pcSpeaker->init();
 
 	// Set the engine's debugger console
@@ -91,6 +90,10 @@ Common::Error Ultima2Engine::run() {
 	_renderMode = (renderMode >= 0 && renderMode < Data::RENDER_MODE_COUNT) ?
 		(Data::RenderMode)renderMode : Data::RENDER_CGA;
 
+	// Set the palette now that the engine data is available, since the
+	// composite renderer's colors come from a file in it
+	Data::setPalette();
+
 	// Set up secret map
 	SearchMan.add("Secret", new Data::SecretMapArchive());
 
diff --git a/engines/ultima/ultima2/views/dungeon_map.cpp b/engines/ultima/ultima2/views/dungeon_map.cpp
index 01d31fb63ac..ccd98e8b370 100644
--- a/engines/ultima/ultima2/views/dungeon_map.cpp
+++ b/engines/ultima/ultima2/views/dungeon_map.cpp
@@ -23,6 +23,7 @@
 #include "common/system.h"
 #include "graphics/paletteman.h"
 #include "ultima/ultima2/data/data.h"
+#include "ultima/ultima2/gfx/composite.h"
 #include "ultima/ultima2/gfx/pic_decoder.h"
 #include "ultima/ultima2/views/dungeon_map.h"
 #include "ultima/ultima2/ultima2.h"
@@ -402,22 +403,19 @@ bool DungeonMap::msgUnfocus(const UnfocusMessage &msg) {
 }
 
 bool DungeonMap::msgAttackTile(const Shared::AttackTileMessage &msg) {
-	// Being hit inverts the whole view, briefly
-	for (int i = 0; i < 2; ++i) {
-		auto s = getSurface();
-		for (int y = 0; y < s.h; ++y) {
-			byte *pixels = (byte *)s.getBasePtr(0, y);
-			for (int x = 0; x < s.w; ++x)
-				pixels[x] ^= 3;
-		}
+	// Being hit inverts the whole view, briefly. It's done by redrawing the
+	// view, rather than inverting the screen, since in the composite
+	// renderer the screen doesn't hold the CGA pixels
+	_inverted = true;
+	draw();
+	g_engine->updateScreen();
 
-		s.markAllDirty();
-		g_engine->updateScreen();
+	// Pause briefly after initial inversion
+	g_engine->pauseMillis(80);
 
-		if (i == 0)
-			// Pause briefly after initial inversion
-			g_engine->pauseMillis(80);
-	}
+	_inverted = false;
+	draw();
+	g_engine->updateScreen();
 
 	return true;
 }
@@ -587,6 +585,18 @@ void DungeonMap::draw() {
 
 	if (_showMinimap)
 		drawMinimap(s);
+
+	if (_inverted) {
+		for (int y = 0; y < s.h; ++y) {
+			byte *pixels = (byte *)s.getBasePtr(0, y);
+			for (int x = 0; x < s.w; ++x)
+				pixels[x] ^= 3;
+		}
+
+		s.markAllDirty();
+	}
+
+	Gfx::compositeFinish(s);
 }
 
 } // namespace Views
diff --git a/engines/ultima/ultima2/views/dungeon_map.h b/engines/ultima/ultima2/views/dungeon_map.h
index 7070de0ad52..d3e797f24b7 100644
--- a/engines/ultima/ultima2/views/dungeon_map.h
+++ b/engines/ultima/ultima2/views/dungeon_map.h
@@ -37,6 +37,7 @@ class DungeonMap : public Map {
 private:
 	byte _monsterSprites[2048] = {};
 	bool _showMinimap = false;
+	bool _inverted = false;
 
 	/**
 	 * Draws a small map of the current level in the top right corner
diff --git a/engines/ultima/ultima2/views/ending.cpp b/engines/ultima/ultima2/views/ending.cpp
index 7df2657938a..a2c9a9eb193 100644
--- a/engines/ultima/ultima2/views/ending.cpp
+++ b/engines/ultima/ultima2/views/ending.cpp
@@ -21,6 +21,7 @@
 
 #include "common/file.h"
 #include "common/system.h"
+#include "ultima/ultima2/gfx/composite.h"
 #include "ultima/ultima2/views/ending.h"
 #include "ultima/ultima2/data/map.h"
 #include "ultima/ultima2/ultima2.h"
@@ -94,6 +95,8 @@ void Ending::draw() {
 			s.blitFrom(_tileGfx[tileId], Common::Point(ox * TILE_WIDTH, oy * TILE_HEIGHT));
 		}
 	}
+
+	Gfx::compositeFinish(s);
 }
 
 bool Ending::tick() {
diff --git a/engines/ultima/ultima2/views/helm_map.cpp b/engines/ultima/ultima2/views/helm_map.cpp
index 54d830647ee..cbf1067b294 100644
--- a/engines/ultima/ultima2/views/helm_map.cpp
+++ b/engines/ultima/ultima2/views/helm_map.cpp
@@ -19,6 +19,7 @@
  *
  */
 
+#include "ultima/ultima2/gfx/composite.h"
 #include "ultima/ultima2/views/helm_map.h"
 #include "ultima/ultima2/data/map.h"
 #include "ultima/ultima2/ultima2.h"
@@ -84,6 +85,8 @@ void HelmMap::draw() {
 		for (int x = 0; x < Data::MAP_WIDTH; ++x)
 			plotIcon(s, x, y, _G(map).tileAt(x, y));
 	}
+
+	Gfx::compositeFinish(s);
 }
 
 bool HelmMap::msgKeypress(const KeypressMessage &msg) {
diff --git a/engines/ultima/ultima2/views/location_map.cpp b/engines/ultima/ultima2/views/location_map.cpp
index 17a68901a54..a64f32fb5d9 100644
--- a/engines/ultima/ultima2/views/location_map.cpp
+++ b/engines/ultima/ultima2/views/location_map.cpp
@@ -73,16 +73,7 @@ bool LocationMap::msgAttackTile(const Shared::AttackTileMessage &msg) {
 	if (ox < 0 || ox >= VIEWPORT_WIDTH || oy < 0 || oy >= VIEWPORT_HEIGHT)
 		return true;
 
-	Common::Point pt(ox * TILE_WIDTH, oy * TILE_HEIGHT);
-	auto s = getSurface();
-
-	s.xorBlitFrom(_attackSprite, pt);
-	g_engine->updateScreen();
-	g_engine->pauseMillis(80);
-
-	s.xorBlitFrom(_attackSprite, pt);
-	g_engine->updateScreen();
-
+	flashSprite(_attackSprite, Common::Point(ox * TILE_WIDTH, oy * TILE_HEIGHT));
 	return true;
 }
 
@@ -126,6 +117,8 @@ void LocationMap::draw() {
 			s.blitFrom(_tiles[tileId], Common::Point(ox * TILE_WIDTH, oy * TILE_HEIGHT));
 		}
 	}
+
+	finishGraphics(s);
 }
 
 } // namespace Views
diff --git a/engines/ultima/ultima2/views/map.cpp b/engines/ultima/ultima2/views/map.cpp
index a0bdc66840a..10ac693889d 100644
--- a/engines/ultima/ultima2/views/map.cpp
+++ b/engines/ultima/ultima2/views/map.cpp
@@ -20,6 +20,7 @@
  */
 
 #include "common/system.h"
+#include "ultima/ultima2/gfx/composite.h"
 #include "ultima/ultima2/views/map.h"
 #include "ultima/ultima2/ultima2.h"
 #include "ultima/ultima2/metaengine.h"
@@ -42,6 +43,26 @@ bool Map::msgFocus(const FocusMessage &msg) {
 	return View::msgFocus(msg);
 }
 
+void Map::finishGraphics(Graphics::Views::GfxSurface &s) {
+	// The sprite goes on first, since composite colors depend on neighbors
+	if (_flashSprite)
+		s.xorBlitFrom(*_flashSprite, _flashPos);
+
+	Gfx::compositeFinish(s);
+}
+
+void Map::flashSprite(const Graphics::ManagedSurface &sprite, const Common::Point &pos) {
+	_flashSprite = &sprite;
+	_flashPos = pos;
+	draw();
+	g_engine->updateScreen();
+	g_engine->pauseMillis(80);
+
+	_flashSprite = nullptr;
+	draw();
+	g_engine->updateScreen();
+}
+
 bool Map::msgAction(const ActionMessage &msg) {
 	_lastInput = g_system->getMillis();
 	g_engine->_logic->action(msg._action);
diff --git a/engines/ultima/ultima2/views/map.h b/engines/ultima/ultima2/views/map.h
index 28c43772f36..8aec6dc7351 100644
--- a/engines/ultima/ultima2/views/map.h
+++ b/engines/ultima/ultima2/views/map.h
@@ -40,6 +40,10 @@ private:
 	uint32 _lastAnimation = 0;
 	uint32 _lastInput = 0;
 
+	// A sprite currently being flashed over the view, see flashSprite
+	const Graphics::ManagedSurface *_flashSprite = nullptr;
+	Common::Point _flashPos;
+
 protected:
 	/**
 	 * Returns the view's TILE_COUNT tile graphics
@@ -51,6 +55,21 @@ protected:
 	 */
 	void checkIdle();
 
+	/**
+	 * Called at the end of draw() by views that draw CGA-indexed tiles:
+	 * adds any sprite being flashed, then applies the composite renderer's
+	 * decode if that's active
+	 */
+	void finishGraphics(Graphics::Views::GfxSurface &s);
+
+	/**
+	 * XOR-flashes a sprite on and then off again over the view, with a
+	 * pause in between, as the original does for hit indicators. It's done
+	 * by redrawing the view, rather than XORing onto the screen, since in
+	 * the composite renderer the screen doesn't hold the CGA pixels
+	 */
+	void flashSprite(const Graphics::ManagedSurface &sprite, const Common::Point &pos);
+
 public:
 	/**
 	 * Re-reads whatever tile/sprite graphics this view uses for the
diff --git a/engines/ultima/ultima2/views/overworld_map.cpp b/engines/ultima/ultima2/views/overworld_map.cpp
index d199e022921..3e5f14c4356 100644
--- a/engines/ultima/ultima2/views/overworld_map.cpp
+++ b/engines/ultima/ultima2/views/overworld_map.cpp
@@ -74,18 +74,7 @@ bool OverworldMap::msgAttackTile(const Shared::AttackTileMessage &msg) {
 	if (ox < 0 || ox >= VIEWPORT_WIDTH || oy < 0 || oy >= VIEWPORT_HEIGHT)
 		return true;
 
-	Common::Point pt(ox * TILE_WIDTH, oy * TILE_HEIGHT);
-	auto s = getSurface();
-
-	// XOR-flash the hit indicator on, then off again - matches the
-	// original's xorSpriteDrawCenter-twice-with-a-pause-between pattern
-	s.xorBlitFrom(_attackSprite, pt);
-	g_engine->updateScreen();
-	g_engine->pauseMillis(80);
-
-	s.xorBlitFrom(_attackSprite, pt);
-	g_engine->updateScreen();
-
+	flashSprite(_attackSprite, Common::Point(ox * TILE_WIDTH, oy * TILE_HEIGHT));
 	return true;
 }
 
@@ -123,6 +112,8 @@ void OverworldMap::draw() {
 			s.blitFrom(_tiles[tileId], Common::Point(ox * TILE_WIDTH, oy * TILE_HEIGHT));
 		}
 	}
+
+	finishGraphics(s);
 }
 
 } // namespace Views
diff --git a/engines/ultima/ultima2/views/title.cpp b/engines/ultima/ultima2/views/title.cpp
index c8139093598..996c16cbef0 100644
--- a/engines/ultima/ultima2/views/title.cpp
+++ b/engines/ultima/ultima2/views/title.cpp
@@ -24,6 +24,7 @@
 #include "graphics/paletteman.h"
 #include "ultima/ultima2/data/data.h"
 #include "ultima/ultima2/views/title.h"
+#include "ultima/ultima2/gfx/composite.h"
 #include "ultima/ultima2/gfx/ega_picture.h"
 #include "ultima/ultima2/gfx/pic_decoder.h"
 #include "ultima/ultima2/ultima2.h"
@@ -43,7 +44,7 @@ Title::Title() : View("Title"), _cursor("Cursor", this) {
 void Title::loadPic(const Common::String &filename) {
 	// The upgrade patch's EGA-family renderers show their own versions
 	Data::RenderMode mode = g_engine->getRenderMode();
-	if (mode != Data::RENDER_CGA) {
+	if (Data::isEgaMode(mode)) {
 		if (!Gfx::loadEgaPicture(filename, mode, _pic))
 			error("Could not load %s", filename.c_str());
 		return;
@@ -56,6 +57,7 @@ void Title::loadPic(const Common::String &filename) {
 
 	_pic.create(320, 200);
 	_pic.blitFrom(*decoder.getSurface());
+	Gfx::compositeFinish(_pic);
 }
 
 bool Title::msgFocus(const FocusMessage &msg) {


Commit: 1b0cd2bb5c21cd92e1418179375a94c7897492e3
    https://github.com/scummvm/scummvm/commit/1b0cd2bb5c21cd92e1418179375a94c7897492e3
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:41:02+11:00

Commit Message:
ULTIMA: ULTIMA2: Added graphics mode as an engine option

Changed paths:
  A engines/ultima/shared/engine/graphics_options.cpp
  A engines/ultima/shared/engine/graphics_options.h
    engines/ultima/POTFILES
    engines/ultima/metaengine.cpp
    engines/ultima/metaengine.h
    engines/ultima/module.mk
    engines/ultima/ultima2/data/data.cpp
    engines/ultima/ultima2/data/data.h
    engines/ultima/ultima2/ultima2.cpp
    engines/ultima/ultima2/ultima2.h
    engines/ultima/ultima2/views/dungeon_map.cpp
    engines/ultima/ultima2/views/dungeon_map.h


diff --git a/engines/ultima/POTFILES b/engines/ultima/POTFILES
index 7714725d574..ebbad40209f 100644
--- a/engines/ultima/POTFILES
+++ b/engines/ultima/POTFILES
@@ -1,6 +1,7 @@
 engines/ultima/metaengine.cpp
 engines/ultima/shared/early/ultima_early.cpp
 engines/ultima/ultima0/metaengine.cpp
+engines/ultima/ultima2/data/data.cpp
 engines/ultima/ultima4/metaengine.cpp
 engines/ultima/nuvie/keybinding/key_help_dialog.cpp
 engines/ultima/nuvie/keybinding/keys.cpp
diff --git a/engines/ultima/metaengine.cpp b/engines/ultima/metaengine.cpp
index 38b7f41d15c..d21f8a71d9f 100644
--- a/engines/ultima/metaengine.cpp
+++ b/engines/ultima/metaengine.cpp
@@ -27,6 +27,7 @@
 #include "common/str-array.h"
 #include "common/memstream.h"
 #include "common/translation.h"
+#include "ultima/shared/engine/graphics_options.h"
 #ifdef ENABLE_AKALABETH
 #include "ultima/ultima0/ultima0.h"
 #include "ultima/ultima0/metaengine.h"
@@ -195,6 +196,17 @@ const ADExtraGuiOptionsMap *UltimaMetaEngine::getAdvancedExtraGuiOptions() const
 	return optionsList;
 }
 
+GUI::OptionsContainerWidget *UltimaMetaEngine::buildEngineOptionsWidget(GUI::GuiObject *boss,
+		const Common::String &name, const Common::String &target) const {
+#ifdef ENABLE_ULTIMA2
+	if (getGameId(target) == "ultima2")
+		return new Ultima::Shared::GraphicsOptionsWidget(boss, name, target,
+			Ultima::Ultima2::Data::RENDER_MODE_LABELS, Ultima::Ultima2::Data::RENDER_MODE_COUNT);
+#endif
+
+	return AdvancedMetaEngine::buildEngineOptionsWidget(boss, name, target);
+}
+
 Common::Error UltimaMetaEngine::createInstance(OSystem *syst, Engine **engine, const Ultima::UltimaGameDescription *gd) const {
 	switch (gd->gameId) {
 #ifdef ENABLE_AKALABETH
diff --git a/engines/ultima/metaengine.h b/engines/ultima/metaengine.h
index 99ee90bfa56..5947ec73d07 100644
--- a/engines/ultima/metaengine.h
+++ b/engines/ultima/metaengine.h
@@ -37,6 +37,14 @@ public:
 	const char *getName() const override;
 	const ADExtraGuiOptionsMap *getAdvancedExtraGuiOptions() const override;
 
+	/**
+	 * Returns the options widget for the game. Most use the standard
+	 * checkboxes from getAdvancedExtraGuiOptions, but games with alternate
+	 * renderers have a drop-down for picking the graphics mode
+	 */
+	GUI::OptionsContainerWidget *buildEngineOptionsWidget(GUI::GuiObject *boss,
+		const Common::String &name, const Common::String &target) const override;
+
 	Common::Error createInstance(OSystem *syst, Engine **engine, const Ultima::UltimaGameDescription *desc) const override;
 	int getMaximumSaveSlot() const override;
 
diff --git a/engines/ultima/module.mk b/engines/ultima/module.mk
index e06a1efd0bf..24dc458a11e 100644
--- a/engines/ultima/module.mk
+++ b/engines/ultima/module.mk
@@ -5,6 +5,7 @@ MODULE_OBJS := \
 	shared/conf/xml_node.o \
 	shared/conf/xml_tree.o \
 	shared/engine/events.o \
+	shared/engine/graphics_options.o \
 	shared/engine/messages.o \
 	shared/gfx/gfx_surface.o \
 	shared/gfx/view.o \
diff --git a/engines/ultima/shared/engine/graphics_options.cpp b/engines/ultima/shared/engine/graphics_options.cpp
new file mode 100644
index 00000000000..21699e15299
--- /dev/null
+++ b/engines/ultima/shared/engine/graphics_options.cpp
@@ -0,0 +1,74 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "common/config-manager.h"
+#include "common/translation.h"
+#include "gui/ThemeEval.h"
+#include "gui/widgets/popup.h"
+#include "ultima/shared/engine/graphics_options.h"
+
+namespace Ultima {
+namespace Shared {
+
+GraphicsOptionsWidget::GraphicsOptionsWidget(GUI::GuiObject *boss, const Common::String &name,
+		const Common::String &domain, const char *const *modes, int modeCount) :
+		GUI::OptionsContainerWidget(boss, name, "UltimaGraphicsOptionsDialog", domain),
+		_modes(modes), _modeCount(modeCount) {
+	GUI::StaticTextWidget *label = new GUI::StaticTextWidget(widgetsBoss(),
+		_dialogLayout + ".graphics_mode_desc", _("Graphics mode:"),
+		_("Which of the game's renderers to use. This can also be changed from the game's title screen."));
+	label->setAlign(Graphics::kTextAlignLeft);
+
+	_modePopUp = new GUI::PopUpWidget(widgetsBoss(), _dialogLayout + ".graphics_mode",
+		_("Which of the game's renderers to use. This can also be changed from the game's title screen."));
+
+	for (int i = 0; i < _modeCount; ++i)
+		_modePopUp->appendEntry(_(_modes[i]), i);
+}
+
+void GraphicsOptionsWidget::load() {
+	// A missing or stale value means the original graphics
+	int mode = 0;
+	if (ConfMan.hasKey(GRAPHICS_MODE_KEY, _domain))
+		mode = ConfMan.getInt(GRAPHICS_MODE_KEY, _domain);
+	if (mode < 0 || mode >= _modeCount)
+		mode = 0;
+
+	_modePopUp->setSelectedTag(mode);
+}
+
+bool GraphicsOptionsWidget::save() {
+	ConfMan.setInt(GRAPHICS_MODE_KEY, _modePopUp->getSelectedTag(), _domain);
+	return true;
+}
+
+void GraphicsOptionsWidget::defineLayout(GUI::ThemeEval &layouts, const Common::String &layoutName,
+		const Common::String &overlayedLayout) const {
+	layouts.addDialog(layoutName, overlayedLayout);
+
+	layouts.addLayout(GUI::ThemeLayout::kLayoutVertical).addPadding(16, 0, 0, 0);
+		layouts.addWidget("graphics_mode_desc", "OptionsLabel");
+		layouts.addWidget("graphics_mode", "PopUp");
+	layouts.closeLayout().closeDialog();
+}
+
+} // namespace Shared
+} // namespace Ultima
diff --git a/engines/ultima/shared/engine/graphics_options.h b/engines/ultima/shared/engine/graphics_options.h
new file mode 100644
index 00000000000..13232fba532
--- /dev/null
+++ b/engines/ultima/shared/engine/graphics_options.h
@@ -0,0 +1,73 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef ULTIMA_SHARED_ENGINE_GRAPHICS_OPTIONS_H
+#define ULTIMA_SHARED_ENGINE_GRAPHICS_OPTIONS_H
+
+#include "gui/widget.h"
+
+namespace GUI {
+class PopUpWidget;
+}
+
+namespace Ultima {
+namespace Shared {
+
+/**
+ * ConfMan key holding the graphics mode (an index into the game's own list
+ * of modes) for the games that have alternate renderers, such as the ones
+ * from the Ultima II Upgrade patch. 0 is always the original graphics
+ */
+constexpr const char *GRAPHICS_MODE_KEY = "graphics_mode";
+
+/**
+ * Game options widget with a drop-down for picking the graphics mode. It's
+ * given the (untranslated, marked with _s) labels of the game's modes, in
+ * the order of the game's own mode enum - the selected entry's index is what
+ * gets stored under GRAPHICS_MODE_KEY, for the game to read when it starts
+ * or when it's told the game options have changed
+ */
+class GraphicsOptionsWidget : public GUI::OptionsContainerWidget {
+private:
+	const char *const *_modes;
+	int _modeCount;
+	GUI::PopUpWidget *_modePopUp;
+
+protected:
+	// OptionsContainerWidget API
+	void defineLayout(GUI::ThemeEval &layouts, const Common::String &layoutName,
+		const Common::String &overlayedLayout) const override;
+
+public:
+	GraphicsOptionsWidget(GUI::GuiObject *boss, const Common::String &name,
+		const Common::String &domain, const char *const *modes, int modeCount);
+	~GraphicsOptionsWidget() override {
+	}
+
+	// OptionsContainerWidget API
+	void load() override;
+	bool save() override;
+};
+
+} // namespace Shared
+} // namespace Ultima
+
+#endif
diff --git a/engines/ultima/ultima2/data/data.cpp b/engines/ultima/ultima2/data/data.cpp
index 7cfa1a4dbf8..94acb5770d4 100644
--- a/engines/ultima/ultima2/data/data.cpp
+++ b/engines/ultima/ultima2/data/data.cpp
@@ -23,6 +23,7 @@
 #include "common/ptr.h"
 #include "common/stream.h"
 #include "common/system.h"
+#include "common/translation.h"
 #include "graphics/paletteman.h"
 #include "ultima/ultima2/data/data.h"
 
@@ -41,6 +42,11 @@ const char *const RENDER_MODE_NAMES[RENDER_MODE_COUNT] = {
 	"ORIGINAL", "COMPOSITE", "EGA", "EGA (V1.0)", "EGA (WILTSHIRE)", "EGA (C64)"
 };
 
+const char *const RENDER_MODE_LABELS[RENDER_MODE_COUNT] = {
+	_s("Original (CGA)"), _s("Composite monitor (CGA)"), _s("Standard EGA"),
+	_s("Classic EGA (v1.0)"), _s("Alternate EGA (Wiltshire Dragon)"), _s("Commodore 64")
+};
+
 // The standard 16-color EGA/VGA palette
 const byte EGA_PALETTE16[EGA_PALETTE_SIZE * 3] = {
 	0x00, 0x00, 0x00, // 0: black
diff --git a/engines/ultima/ultima2/data/data.h b/engines/ultima/ultima2/data/data.h
index b4ba06aa573..24f86997ae0 100644
--- a/engines/ultima/ultima2/data/data.h
+++ b/engines/ultima/ultima2/data/data.h
@@ -43,6 +43,10 @@ enum RenderMode {
 };
 extern const char *const RENDER_MODE_NAMES[RENDER_MODE_COUNT];
 
+// Descriptions of the modes for the launcher's graphics mode drop-down, in
+// the same order. Marked for translation, but not translated
+extern const char *const RENDER_MODE_LABELS[RENDER_MODE_COUNT];
+
 inline bool isEgaMode(RenderMode mode) {
 	return mode >= RENDER_EGA && mode < RENDER_MODE_COUNT;
 }
diff --git a/engines/ultima/ultima2/ultima2.cpp b/engines/ultima/ultima2/ultima2.cpp
index 8c1c1d90eb0..c302b2b7c25 100644
--- a/engines/ultima/ultima2/ultima2.cpp
+++ b/engines/ultima/ultima2/ultima2.cpp
@@ -25,6 +25,7 @@
 #include "common/savefile.h"
 #include "engines/util.h"
 #include "audio/softsynth/pcspk.h"
+#include "ultima/shared/engine/graphics_options.h"
 #include "ultima/ultima2/ultima2.h"
 #include "ultima/ultima2/console.h"
 #include "ultima/ultima2/metaengine.h"
@@ -58,6 +59,14 @@ Common::String Ultima2Engine::getGameId() const {
 	return _gameDescription->desc.gameId;
 }
 
+// The graphics renderer mode stored in the configuration, falling back
+// to the original CGA look if it's missing or stale
+static Data::RenderMode configuredRenderMode() {
+	int mode = ConfMan.getInt(Shared::GRAPHICS_MODE_KEY);
+	return (mode >= 0 && mode < Data::RENDER_MODE_COUNT) ?
+		(Data::RenderMode)mode : Data::RENDER_CGA;
+}
+
 Common::Error Ultima2Engine::run() {
 	MetaEngine::setKeybindingMode(KBMODE_MINIMAL);
 
@@ -81,14 +90,8 @@ Common::Error Ultima2Engine::run() {
 		return Common::kNoError;
 	}
 
-	// Restore the player's preferred renderer, falling back to the
-	// original CGA look if the stored value is missing or stale. Uses
-	// its own key rather than the generic "render_mode" - that one's
-	// already a reserved, string-valued ScummVM-wide GUI setting (the
-	// "Render mode:" dropdown, see gui/options.cpp), not an engine-local int
-	int renderMode = ConfMan.getInt("graphics_mode");
-	_renderMode = (renderMode >= 0 && renderMode < Data::RENDER_MODE_COUNT) ?
-		(Data::RenderMode)renderMode : Data::RENDER_CGA;
+	// Restore the player's preferred renderer
+	_renderMode = configuredRenderMode();
 
 	// Set the palette now that the engine data is available, since the
 	// composite renderer's colors come from a file in it
@@ -246,12 +249,17 @@ void Ultima2Engine::playFX(Data::SoundEffect fx) {
 	}
 }
 
+void Ultima2Engine::applyGameSettings() {
+	// The graphics mode can be changed from the in-game options dialog
+	setRenderMode(configuredRenderMode());
+}
+
 void Ultima2Engine::setRenderMode(Data::RenderMode mode) {
 	if (mode == _renderMode)
 		return;
 
 	_renderMode = mode;
-	ConfMan.setInt("graphics_mode", (int)mode);
+	ConfMan.setInt(Shared::GRAPHICS_MODE_KEY, (int)mode);
 	ConfMan.flushToDisk();
 	Data::setPalette();
 
diff --git a/engines/ultima/ultima2/ultima2.h b/engines/ultima/ultima2/ultima2.h
index c81802a48c1..1db9ab06313 100644
--- a/engines/ultima/ultima2/ultima2.h
+++ b/engines/ultima/ultima2/ultima2.h
@@ -161,6 +161,12 @@ public:
 	 */
 	void setRenderMode(Data::RenderMode mode);
 
+	/**
+	 * Called when the in-game options dialog may have changed settings, such
+	 * as the graphics mode
+	 */
+	void applyGameSettings() override;
+
 	/**
 	 * Pause for a given number of milliseconds
 	 */
diff --git a/engines/ultima/ultima2/views/dungeon_map.cpp b/engines/ultima/ultima2/views/dungeon_map.cpp
index ccd98e8b370..6292d949bb2 100644
--- a/engines/ultima/ultima2/views/dungeon_map.cpp
+++ b/engines/ultima/ultima2/views/dungeon_map.cpp
@@ -420,6 +420,14 @@ bool DungeonMap::msgAttackTile(const Shared::AttackTileMessage &msg) {
 	return true;
 }
 
+bool DungeonMap::msgGame(const GameMessage &msg) {
+	// Whether the corridor is decoded to composite colors depends on the
+	// graphics mode, but there are no tiles to reload
+	if (msg._name == "RELOAD_TILES")
+		redraw();
+	return false;
+}
+
 bool DungeonMap::msgKeypress(const KeypressMessage &msg) {
 	// Secret debugging aid: minmap toggle
 	if (msg.keycode == Common::KEYCODE_BACKQUOTE || msg.keycode == Common::KEYCODE_TILDE) {
diff --git a/engines/ultima/ultima2/views/dungeon_map.h b/engines/ultima/ultima2/views/dungeon_map.h
index d3e797f24b7..37d7871c8e3 100644
--- a/engines/ultima/ultima2/views/dungeon_map.h
+++ b/engines/ultima/ultima2/views/dungeon_map.h
@@ -67,6 +67,7 @@ public:
 	bool msgUnfocus(const UnfocusMessage &msg) override;
 	bool msgAttackTile(const Shared::AttackTileMessage &msg) override;
 	bool msgKeypress(const KeypressMessage &msg) override;
+	bool msgGame(const GameMessage &msg) override;
 	void draw() override;
 	bool tick() override;
 };


Commit: 7dfd67189ef6dd9c09af85013075b88dbc3244d4
    https://github.com/scummvm/scummvm/commit/7dfd67189ef6dd9c09af85013075b88dbc3244d4
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:41:02+11:00

Commit Message:
ULTIMA: ULTIMA2: Change a SearchMan call to Common::File

Changed paths:
    engines/ultima/ultima2/data/data.cpp
    engines/ultima/ultima2/data/tiles.cpp


diff --git a/engines/ultima/ultima2/data/data.cpp b/engines/ultima/ultima2/data/data.cpp
index 94acb5770d4..8ae72ae2440 100644
--- a/engines/ultima/ultima2/data/data.cpp
+++ b/engines/ultima/ultima2/data/data.cpp
@@ -19,9 +19,7 @@
  *
  */
 
-#include "common/archive.h"
-#include "common/ptr.h"
-#include "common/stream.h"
+#include "common/file.h"
 #include "common/system.h"
 #include "common/translation.h"
 #include "graphics/paletteman.h"
@@ -79,14 +77,13 @@ const byte PLANET_COORDS[PLANET_COUNT + 1][3] = {
 // CGACOMP.PAL is a standard VGA palette file: 256 entries of 6-bit R, G, B.
 // The composite decode only ever produces the first 16
 static void loadCompositePalette(Graphics::Palette &palette) {
-	Common::ScopedPtr<Common::SeekableReadStream> f(
-		SearchMan.createReadStreamForMember(Common::Path("cgacomp.pal")));
-	if (!f)
+	Common::File f;
+	if (!f.open("cgacomp.pal"))
 		return;
 
 	for (int i = 0; i < COMPOSITE_PALETTE_SIZE; ++i) {
 		byte rgb[3];
-		if (f->read(rgb, 3) != 3)
+		if (f.read(rgb, 3) != 3)
 			return;
 
 		for (int c = 0; c < 3; ++c)
diff --git a/engines/ultima/ultima2/data/tiles.cpp b/engines/ultima/ultima2/data/tiles.cpp
index 59ff6e381f8..0db2aced90b 100644
--- a/engines/ultima/ultima2/data/tiles.cpp
+++ b/engines/ultima/ultima2/data/tiles.cpp
@@ -139,13 +139,13 @@ void loadTiles(Graphics::Surface tiles[TILE_COUNT], RenderMode mode) {
 
 void loadAttackSprite(Graphics::ManagedSurface &sprite, RenderMode mode) {
 	if (isEgaMode(mode)) {
-		Common::ScopedPtr<Common::SeekableReadStream> egaFile(openEgaFile(mode, "egatiles"));
-		if (!egaFile)
+		Common::File egaFile;
+		if (!egaFile.open("egatiles"))
 			error("Could not open egatiles");
 
-		egaFile->seek(EGA_ATTACK_SPRITE_RECORD * EGA_RECORD_SIZE);
+		egaFile.seek(EGA_ATTACK_SPRITE_RECORD * EGA_RECORD_SIZE);
 		byte record[EGA_RECORD_SIZE];
-		if (egaFile->read(record, EGA_RECORD_SIZE) != (uint32)EGA_RECORD_SIZE)
+		if (egaFile.read(record, EGA_RECORD_SIZE) != (uint32)EGA_RECORD_SIZE)
 			error("Could not read attack sprite from egatiles");
 
 		decodeEgaTileRecord(record, sprite);


Commit: fddc44d8e369d68ae2ac70b5e5c2339c62092f1a
    https://github.com/scummvm/scummvm/commit/fddc44d8e369d68ae2ac70b5e5c2339c62092f1a
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:41:02+11:00

Commit Message:
ULTIMA: ULTIMA3: Add game options for the Ultima III Upgrade's monster and food rate changes

Changed paths:
    engines/ultima/detection.h
    engines/ultima/detection_tables.h
    engines/ultima/metaengine.cpp
    engines/ultima/ultima3/logic/creature_logic.cpp
    engines/ultima/ultima3/logic/dungeon_logic.cpp
    engines/ultima/ultima3/logic/logic.cpp
    engines/ultima/ultima3/ultima3.cpp
    engines/ultima/ultima3/ultima3.h


diff --git a/engines/ultima/detection.h b/engines/ultima/detection.h
index 89acbad61cd..c644a0505bb 100644
--- a/engines/ultima/detection.h
+++ b/engines/ultima/detection.h
@@ -81,6 +81,8 @@ struct UltimaGameDescription {
 #define GAMEOPTION_FONT_ANTIALIASING GUIO_GAMEOPTIONS9
 #define GAMEOPTION_CAMERA_WITH_SILENCER GUIO_GAMEOPTIONS10
 #define GAMEOPTION_ALWAYS_CHRISTMAS     GUIO_GAMEOPTIONS11
+#define GAMEOPTION_ULTIMA3_MORE_MONSTERS GUIO_GAMEOPTIONS12
+#define GAMEOPTION_ULTIMA3_LESS_HUNGER   GUIO_GAMEOPTIONS13
 
 } // End of namespace Ultima
 
diff --git a/engines/ultima/detection_tables.h b/engines/ultima/detection_tables.h
index 3c66fb9a6f1..cb7ca98a8d3 100644
--- a/engines/ultima/detection_tables.h
+++ b/engines/ultima/detection_tables.h
@@ -24,6 +24,7 @@ namespace Ultima {
 #define GUI_OPTIONS_ULTIMA0	GUIO0()
 #define GUI_OPTIONS_ULTIMA1	GUIO0()
 #define GUI_OPTIONS_ULTIMA2	GUIO0()
+#define GUI_OPTIONS_ULTIMA3	GUIO2(GAMEOPTION_ULTIMA3_MORE_MONSTERS, GAMEOPTION_ULTIMA3_LESS_HUNGER)
 #define GUI_OPTIONS_ULTIMA4	GUIO1(GUIO_NOSPEECH)
 #define GUI_OPTIONS_ULTIMA6	GUIO0()
 #define GUI_OPTIONS_ULTIMA8	GUIO9(GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FRAME_SKIPPING, GAMEOPTION_FRAME_LIMITING, GAMEOPTION_CHEATS, GAMEOPTION_HIGH_RESOLUTION, GAMEOPTION_FOOTSTEP_SOUNDS, GAMEOPTION_JUMP_TO_MOUSE, GAMEOPTION_FONT_REPLACEMENT, GAMEOPTION_FONT_ANTIALIASING)
@@ -158,7 +159,7 @@ static const UltimaGameDescription GAME_DESCRIPTIONS[] = {
 			Common::EN_ANY,
 			Common::kPlatformDOS,
 			ADGF_UNSTABLE,
-			GUI_OPTIONS_ULTIMA2
+			GUI_OPTIONS_ULTIMA3
 		},
 		GAME_ULTIMA3,
 		0
diff --git a/engines/ultima/metaengine.cpp b/engines/ultima/metaengine.cpp
index d21f8a71d9f..da3c2279f29 100644
--- a/engines/ultima/metaengine.cpp
+++ b/engines/ultima/metaengine.cpp
@@ -174,6 +174,28 @@ static const ADExtraGuiOptionsMap optionsList[] = {
 			0
 		}
 	},
+	{
+		GAMEOPTION_ULTIMA3_MORE_MONSTERS,
+		{
+			_s("Increase monster generation"),
+			_s("Doubles the rate monsters and ships appear in the world, and increases it in dungeons, as in the Ultima III Upgrade"),
+			"more_monsters",
+			false,
+			0,
+			0
+		}
+	},
+	{
+		GAMEOPTION_ULTIMA3_LESS_HUNGER,
+		{
+			_s("Halve food consumption"),
+			_s("The party eats food at half the original rate, as in the Ultima III Upgrade"),
+			"less_hunger",
+			false,
+			0,
+			0
+		}
+	},
 	{
 		GAMEOPTION_ALWAYS_CHRISTMAS,
 		{
diff --git a/engines/ultima/ultima3/logic/creature_logic.cpp b/engines/ultima/ultima3/logic/creature_logic.cpp
index 21163bb3a4e..1c2c00fc58b 100644
--- a/engines/ultima/ultima3/logic/creature_logic.cpp
+++ b/engines/ultima/ultima3/logic/creature_logic.cpp
@@ -45,6 +45,9 @@ static const byte MONSTER_FLOORS[MONSTER_TYPES] = {
 	0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x00, 0x04, 0x04, 0x00, 0x00, 0x04, 0x04
 };
 
+// The range the roll for a new monster is taken from, of which the top part spawns one
+constexpr int SPAWN_RANGE = 0x87;
+constexpr int SPAWN_RANGE_FIXED = 0x8F;
 constexpr byte DRAGON_TILE = 0x74;
 constexpr byte SHIP_TILE = 0x3C;
 constexpr int VIEW_SIZE = 11;
@@ -220,7 +223,7 @@ void CreatureLogic::spawnMonster() {
 	Data::Creatures &c = map._creatures;
 	const Data::Savegame &save = _G(savegame);
 
-	if (save._location != Data::LOCATION_SOSARIA || randomBelow(0x87) < 0x80)
+	if (save._location != Data::LOCATION_SOSARIA || randomBelow(_G(moreMonsters) ? SPAWN_RANGE_FIXED : SPAWN_RANGE) < 0x80)
 		return;
 
 	int slot = 0;
diff --git a/engines/ultima/ultima3/logic/dungeon_logic.cpp b/engines/ultima/ultima3/logic/dungeon_logic.cpp
index 79f24913b5e..379700dd83a 100644
--- a/engines/ultima/ultima3/logic/dungeon_logic.cpp
+++ b/engines/ultima/ultima3/logic/dungeon_logic.cpp
@@ -32,6 +32,11 @@ constexpr byte TILE_NO_TURNING = 0xA0;
 constexpr byte FIRST_MONSTER = 0x18;
 constexpr int LAST_MONSTER_KIND = 6;
 
+// The range the roll for a fight is taken from before adding the level, and how much more it has
+// with the gameplay fixes, which makes fights likelier
+constexpr int ENCOUNTER_RANGE = 0x82;
+constexpr int ENCOUNTER_RANGE_FIXED = 2;
+
 // How far a step in each direction goes
 static const int FACING_DX[4] = { 0, 1, 0, -1 };
 static const int FACING_DY[4] = { -1, 0, 1, 0 };
@@ -113,7 +118,7 @@ int DungeonLogic::rollEncounter() {
 		return -1;
 
 	// The deeper the party goes the likelier and fiercer the monsters
-	if (rollBelow(0x82 + save._dungeonLevel) < 0x80)
+	if (rollBelow(ENCOUNTER_RANGE + (_G(moreMonsters) ? ENCOUNTER_RANGE_FIXED : 0) + save._dungeonLevel) < 0x80)
 		return -1;
 
 	int kind = MIN(rollBelow(save._dungeonLevel + 2), LAST_MONSTER_KIND);
diff --git a/engines/ultima/ultima3/logic/logic.cpp b/engines/ultima/ultima3/logic/logic.cpp
index 9f0e652ab06..d1faa8137e6 100644
--- a/engines/ultima/ultima3/logic/logic.cpp
+++ b/engines/ultima/ultima3/logic/logic.cpp
@@ -29,6 +29,7 @@ int Logic::_healCounter = 9;
 int Logic::_upkeepCounter = 4;
 
 constexpr int HUNGER_STEP = 10;
+constexpr int HUNGER_STEP_FIXED = 5;
 constexpr int STARVATION_DAMAGE = 5;
 
 // Magic points regenerate up to half of the attribute they depend on
@@ -56,7 +57,7 @@ void Logic::applyHunger(int slot) {
 	Data::RosterEntry &e = _G(savegame).partyMember(slot);
 
 	// Food only drops by one every few turns, tracked in a hidden counter
-	int counter = Data::fromBcd(e._foodSubCounter) - HUNGER_STEP;
+	int counter = Data::fromBcd(e._foodSubCounter) - (_G(lessHunger) ? HUNGER_STEP_FIXED : HUNGER_STEP);
 	int borrow = 0;
 	if (counter < 0) {
 		counter += 100;
diff --git a/engines/ultima/ultima3/ultima3.cpp b/engines/ultima/ultima3/ultima3.cpp
index 3349c78d769..cab598df3d4 100644
--- a/engines/ultima/ultima3/ultima3.cpp
+++ b/engines/ultima/ultima3/ultima3.cpp
@@ -19,6 +19,7 @@
  *
  */
 
+#include "common/config-manager.h"
 #include "common/system.h"
 #include "common/savefile.h"
 #include "engines/util.h"
@@ -41,6 +42,8 @@ Ultima3Engine::Ultima3Engine(OSystem *syst, const Ultima::UltimaGameDescription
 		Engine(syst), Shared::Events("ultima3"), _gameDescription(gameDesc) {
 	g_engine = this;
 	_pcSpeaker = new Audio::PCSpeaker();
+	_moreMonsters = ConfMan.getBool("more_monsters");
+	_lessHunger = ConfMan.getBool("less_hunger");
 }
 
 Ultima3Engine::~Ultima3Engine() {
diff --git a/engines/ultima/ultima3/ultima3.h b/engines/ultima/ultima3/ultima3.h
index 5674983ad86..ee2cc72d284 100644
--- a/engines/ultima/ultima3/ultima3.h
+++ b/engines/ultima/ultima3/ultima3.h
@@ -123,6 +123,11 @@ public:
 	byte _scene[Data::ARENA_SIZE * Data::ARENA_SIZE] = {};
 	bool _sceneShown = false;
 
+	// Set by the game options that bring in the Ultima III Upgrade's changes to
+	// the monster generation and food rates
+	bool _moreMonsters = false;
+	bool _lessHunger = false;
+
 	// Toggled in the game by the Volume command
 	bool _soundEnabled = true;
 


Commit: 77e323294788c8eeb0fe090e257d2f12cb53b8a7
    https://github.com/scummvm/scummvm/commit/77e323294788c8eeb0fe090e257d2f12cb53b8a7
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:41:02+11:00

Commit Message:
ULTIMA: ULTIMA3: Added the Upgrade Patch graphics modes as an engine option

Changed paths:
  A devtools/create_ultima/files/ultima3/animate.ega
  A devtools/create_ultima/files/ultima3/animate.vga
  A devtools/create_ultima/files/ultima3/blank.ega
  A devtools/create_ultima/files/ultima3/blank.vga
  A devtools/create_ultima/files/ultima3/cgacomp.pal
  A devtools/create_ultima/files/ultima3/charset.ega
  A devtools/create_ultima/files/ultima3/charset.vga
  A devtools/create_ultima/files/ultima3/exod.ega
  A devtools/create_ultima/files/ultima3/exod.vga
  A devtools/create_ultima/files/ultima3/moons.ega
  A devtools/create_ultima/files/ultima3/moons.ult
  A devtools/create_ultima/files/ultima3/moons.vga
  A devtools/create_ultima/files/ultima3/shapes.ega
  A devtools/create_ultima/files/ultima3/shapes.vga
  A devtools/create_ultima/files/ultima3/u3vga.pal
  A devtools/create_ultima/files/ultima3/version.txt
  A engines/ultima/ultima3/gfx/composite.cpp
  A engines/ultima/ultima3/gfx/composite.h
  A engines/ultima/ultima3/gfx/frame.cpp
  A engines/ultima/ultima3/gfx/frame.h
  A engines/ultima/ultima3/gfx/pixels.h
    engines/ultima/POTFILES
    engines/ultima/metaengine.cpp
    engines/ultima/module.mk
    engines/ultima/shared/engine/graphics_options.cpp
    engines/ultima/shared/engine/graphics_options.h
    engines/ultima/ultima3/data/data.cpp
    engines/ultima/ultima3/data/data.h
    engines/ultima/ultima3/gfx/charset.cpp
    engines/ultima/ultima3/gfx/charset.h
    engines/ultima/ultima3/gfx/dungeon_view.cpp
    engines/ultima/ultima3/gfx/dungeon_view.h
    engines/ultima/ultima3/gfx/overview.cpp
    engines/ultima/ultima3/gfx/overview.h
    engines/ultima/ultima3/gfx/pic_decoder.cpp
    engines/ultima/ultima3/gfx/pic_decoder.h
    engines/ultima/ultima3/gfx/shapes.cpp
    engines/ultima/ultima3/gfx/shapes.h
    engines/ultima/ultima3/ultima3.cpp
    engines/ultima/ultima3/ultima3.h
    engines/ultima/ultima3/views/character_details.cpp
    engines/ultima/ultima3/views/create_character.cpp
    engines/ultima/ultima3/views/disperse_party.cpp
    engines/ultima/ultima3/views/dungeon_map.cpp
    engines/ultima/ultima3/views/form_party.cpp
    engines/ultima/ultima3/views/game.cpp
    engines/ultima/ultima3/views/interactions/insert_card.cpp
    engines/ultima/ultima3/views/journey_onward.cpp
    engines/ultima/ultima3/views/logo_screen.cpp
    engines/ultima/ultima3/views/main_menu.cpp
    engines/ultima/ultima3/views/party_menu.cpp
    engines/ultima/ultima3/views/register.cpp
    engines/ultima/ultima3/views/terminate_character.cpp
    engines/ultima/ultima3/views/title.cpp
    engines/ultima/ultima3/views/title.h
    engines/ultima/ultima3/views/window_view.cpp
    engines/ultima/ultima3/views/window_view.h


diff --git a/devtools/create_ultima/files/ultima3/animate.ega b/devtools/create_ultima/files/ultima3/animate.ega
new file mode 100644
index 00000000000..7757e12722f
Binary files /dev/null and b/devtools/create_ultima/files/ultima3/animate.ega differ
diff --git a/devtools/create_ultima/files/ultima3/animate.vga b/devtools/create_ultima/files/ultima3/animate.vga
new file mode 100644
index 00000000000..abb94346312
Binary files /dev/null and b/devtools/create_ultima/files/ultima3/animate.vga differ
diff --git a/devtools/create_ultima/files/ultima3/blank.ega b/devtools/create_ultima/files/ultima3/blank.ega
new file mode 100644
index 00000000000..f5d250cce73
Binary files /dev/null and b/devtools/create_ultima/files/ultima3/blank.ega differ
diff --git a/devtools/create_ultima/files/ultima3/blank.vga b/devtools/create_ultima/files/ultima3/blank.vga
new file mode 100644
index 00000000000..6a8cbc5773d
Binary files /dev/null and b/devtools/create_ultima/files/ultima3/blank.vga differ
diff --git a/devtools/create_ultima/files/ultima3/cgacomp.pal b/devtools/create_ultima/files/ultima3/cgacomp.pal
new file mode 100644
index 00000000000..31809093e94
Binary files /dev/null and b/devtools/create_ultima/files/ultima3/cgacomp.pal differ
diff --git a/devtools/create_ultima/files/ultima3/charset.ega b/devtools/create_ultima/files/ultima3/charset.ega
new file mode 100644
index 00000000000..341b52e6de0
Binary files /dev/null and b/devtools/create_ultima/files/ultima3/charset.ega differ
diff --git a/devtools/create_ultima/files/ultima3/charset.vga b/devtools/create_ultima/files/ultima3/charset.vga
new file mode 100644
index 00000000000..dddf123695b
Binary files /dev/null and b/devtools/create_ultima/files/ultima3/charset.vga differ
diff --git a/devtools/create_ultima/files/ultima3/exod.ega b/devtools/create_ultima/files/ultima3/exod.ega
new file mode 100644
index 00000000000..846ba3f7921
Binary files /dev/null and b/devtools/create_ultima/files/ultima3/exod.ega differ
diff --git a/devtools/create_ultima/files/ultima3/exod.vga b/devtools/create_ultima/files/ultima3/exod.vga
new file mode 100644
index 00000000000..aeea5659115
Binary files /dev/null and b/devtools/create_ultima/files/ultima3/exod.vga differ
diff --git a/devtools/create_ultima/files/ultima3/moons.ega b/devtools/create_ultima/files/ultima3/moons.ega
new file mode 100644
index 00000000000..47a1a899a25
Binary files /dev/null and b/devtools/create_ultima/files/ultima3/moons.ega differ
diff --git a/devtools/create_ultima/files/ultima3/moons.ult b/devtools/create_ultima/files/ultima3/moons.ult
new file mode 100644
index 00000000000..b0cd8fb82e2
Binary files /dev/null and b/devtools/create_ultima/files/ultima3/moons.ult differ
diff --git a/devtools/create_ultima/files/ultima3/moons.vga b/devtools/create_ultima/files/ultima3/moons.vga
new file mode 100644
index 00000000000..ff60772090f
Binary files /dev/null and b/devtools/create_ultima/files/ultima3/moons.vga differ
diff --git a/devtools/create_ultima/files/ultima3/shapes.ega b/devtools/create_ultima/files/ultima3/shapes.ega
new file mode 100644
index 00000000000..92a96bbf2ac
Binary files /dev/null and b/devtools/create_ultima/files/ultima3/shapes.ega differ
diff --git a/devtools/create_ultima/files/ultima3/shapes.vga b/devtools/create_ultima/files/ultima3/shapes.vga
new file mode 100644
index 00000000000..72e72c41789
Binary files /dev/null and b/devtools/create_ultima/files/ultima3/shapes.vga differ
diff --git a/devtools/create_ultima/files/ultima3/u3vga.pal b/devtools/create_ultima/files/ultima3/u3vga.pal
new file mode 100644
index 00000000000..49772a843f5
Binary files /dev/null and b/devtools/create_ultima/files/ultima3/u3vga.pal differ
diff --git a/devtools/create_ultima/files/ultima3/version.txt b/devtools/create_ultima/files/ultima3/version.txt
new file mode 100644
index 00000000000..9f8e9b69a33
--- /dev/null
+++ b/devtools/create_ultima/files/ultima3/version.txt
@@ -0,0 +1 @@
+1.0
\ No newline at end of file
diff --git a/engines/ultima/POTFILES b/engines/ultima/POTFILES
index ebbad40209f..d2cb5ae0b2a 100644
--- a/engines/ultima/POTFILES
+++ b/engines/ultima/POTFILES
@@ -2,6 +2,7 @@ engines/ultima/metaengine.cpp
 engines/ultima/shared/early/ultima_early.cpp
 engines/ultima/ultima0/metaengine.cpp
 engines/ultima/ultima2/data/data.cpp
+engines/ultima/ultima3/data/data.cpp
 engines/ultima/ultima4/metaengine.cpp
 engines/ultima/nuvie/keybinding/key_help_dialog.cpp
 engines/ultima/nuvie/keybinding/keys.cpp
diff --git a/engines/ultima/metaengine.cpp b/engines/ultima/metaengine.cpp
index da3c2279f29..02653843945 100644
--- a/engines/ultima/metaengine.cpp
+++ b/engines/ultima/metaengine.cpp
@@ -225,6 +225,12 @@ GUI::OptionsContainerWidget *UltimaMetaEngine::buildEngineOptionsWidget(GUI::Gui
 		return new Ultima::Shared::GraphicsOptionsWidget(boss, name, target,
 			Ultima::Ultima2::Data::RENDER_MODE_LABELS, Ultima::Ultima2::Data::RENDER_MODE_COUNT);
 #endif
+#ifdef ENABLE_ULTIMA3
+	if (getGameId(target) == "ultima3")
+		return new Ultima::Shared::GraphicsOptionsWidget(boss, name, target,
+			Ultima::Ultima3::Data::RENDER_MODE_LABELS, Ultima::Ultima3::Data::RENDER_MODE_COUNT,
+			getExtraGuiOptions(target), false);
+#endif
 
 	return AdvancedMetaEngine::buildEngineOptionsWidget(boss, name, target);
 }
diff --git a/engines/ultima/module.mk b/engines/ultima/module.mk
index 24dc458a11e..cdf0f3da32f 100644
--- a/engines/ultima/module.mk
+++ b/engines/ultima/module.mk
@@ -173,7 +173,9 @@ MODULE_OBJS += \
 	ultima3/data/roster.o \
 	ultima3/data/savegame.o \
 	ultima3/gfx/charset.o \
+	ultima3/gfx/composite.o \
 	ultima3/gfx/dungeon_view.o \
+	ultima3/gfx/frame.o \
 	ultima3/gfx/message_log.o \
 	ultima3/gfx/overview.o \
 	ultima3/gfx/pic_decoder.o \
diff --git a/engines/ultima/shared/engine/graphics_options.cpp b/engines/ultima/shared/engine/graphics_options.cpp
index 21699e15299..3251fbdc454 100644
--- a/engines/ultima/shared/engine/graphics_options.cpp
+++ b/engines/ultima/shared/engine/graphics_options.cpp
@@ -29,19 +29,28 @@ namespace Ultima {
 namespace Shared {
 
 GraphicsOptionsWidget::GraphicsOptionsWidget(GUI::GuiObject *boss, const Common::String &name,
-		const Common::String &domain, const char *const *modes, int modeCount) :
+		const Common::String &domain, const char *const *modes, int modeCount,
+		const ExtraGuiOptions &options, bool onTitleScreen) :
 		GUI::OptionsContainerWidget(boss, name, "UltimaGraphicsOptionsDialog", domain),
-		_modes(modes), _modeCount(modeCount) {
+		_modes(modes), _modeCount(modeCount), _options(options) {
+	const Common::U32String tooltip = onTitleScreen ?
+		_("Which of the game's renderers to use. This can also be changed from the game's title screen.") :
+		_("Which of the game's renderers to use.");
+
 	GUI::StaticTextWidget *label = new GUI::StaticTextWidget(widgetsBoss(),
-		_dialogLayout + ".graphics_mode_desc", _("Graphics mode:"),
-		_("Which of the game's renderers to use. This can also be changed from the game's title screen."));
+		_dialogLayout + ".graphics_mode_desc", _("Graphics mode:"), tooltip);
 	label->setAlign(Graphics::kTextAlignLeft);
 
-	_modePopUp = new GUI::PopUpWidget(widgetsBoss(), _dialogLayout + ".graphics_mode",
-		_("Which of the game's renderers to use. This can also be changed from the game's title screen."));
+	_modePopUp = new GUI::PopUpWidget(widgetsBoss(), _dialogLayout + ".graphics_mode", tooltip);
 
 	for (int i = 0; i < _modeCount; ++i)
 		_modePopUp->appendEntry(_(_modes[i]), i);
+
+	for (uint i = 0; i < _options.size(); ++i) {
+		_checkboxes.push_back(new GUI::CheckboxWidget(widgetsBoss(),
+			_dialogLayout + Common::String::format(".customOption%dCheckbox", i + 1),
+			_(_options[i].label), _(_options[i].tooltip)));
+	}
 }
 
 void GraphicsOptionsWidget::load() {
@@ -53,10 +62,22 @@ void GraphicsOptionsWidget::load() {
 		mode = 0;
 
 	_modePopUp->setSelectedTag(mode);
+
+	// The options that are checkboxes start from what the game says unless set
+	for (uint i = 0; i < _options.size(); ++i) {
+		bool isChecked = _options[i].defaultState;
+		if (ConfMan.hasKey(_options[i].configOption, _domain))
+			isChecked = ConfMan.getBool(_options[i].configOption, _domain);
+		_checkboxes[i]->setState(isChecked);
+	}
 }
 
 bool GraphicsOptionsWidget::save() {
 	ConfMan.setInt(GRAPHICS_MODE_KEY, _modePopUp->getSelectedTag(), _domain);
+
+	for (uint i = 0; i < _options.size(); ++i)
+		ConfMan.setBool(_options[i].configOption, _checkboxes[i]->getState(), _domain);
+
 	return true;
 }
 
@@ -67,6 +88,9 @@ void GraphicsOptionsWidget::defineLayout(GUI::ThemeEval &layouts, const Common::
 	layouts.addLayout(GUI::ThemeLayout::kLayoutVertical).addPadding(16, 0, 0, 0);
 		layouts.addWidget("graphics_mode_desc", "OptionsLabel");
 		layouts.addWidget("graphics_mode", "PopUp");
+
+		for (uint i = 0; i < _options.size(); ++i)
+			layouts.addWidget(Common::String::format("customOption%dCheckbox", i + 1), "Checkbox");
 	layouts.closeLayout().closeDialog();
 }
 
diff --git a/engines/ultima/shared/engine/graphics_options.h b/engines/ultima/shared/engine/graphics_options.h
index 13232fba532..fb76f660432 100644
--- a/engines/ultima/shared/engine/graphics_options.h
+++ b/engines/ultima/shared/engine/graphics_options.h
@@ -22,6 +22,7 @@
 #ifndef ULTIMA_SHARED_ENGINE_GRAPHICS_OPTIONS_H
 #define ULTIMA_SHARED_ENGINE_GRAPHICS_OPTIONS_H
 
+#include "engines/metaengine.h"
 #include "gui/widget.h"
 
 namespace GUI {
@@ -43,13 +44,16 @@ constexpr const char *GRAPHICS_MODE_KEY = "graphics_mode";
  * given the (untranslated, marked with _s) labels of the game's modes, in
  * the order of the game's own mode enum - the selected entry's index is what
  * gets stored under GRAPHICS_MODE_KEY, for the game to read when it starts
- * or when it's told the game options have changed
+ * or when it's told the game options have changed. Any of the game's other
+ * options that are checkboxes can be shown below it
  */
 class GraphicsOptionsWidget : public GUI::OptionsContainerWidget {
 private:
 	const char *const *_modes;
 	int _modeCount;
 	GUI::PopUpWidget *_modePopUp;
+	ExtraGuiOptions _options;
+	Common::Array<GUI::CheckboxWidget *> _checkboxes;
 
 protected:
 	// OptionsContainerWidget API
@@ -57,8 +61,16 @@ protected:
 		const Common::String &overlayedLayout) const override;
 
 public:
+	/**
+	 * Constructor
+	 * @param modes				The labels of the modes
+	 * @param modeCount			How many modes there are
+	 * @param options			The game's other options to show
+	 * @param onTitleScreen		True if the mode can be changed from the game's title screen
+	 */
 	GraphicsOptionsWidget(GUI::GuiObject *boss, const Common::String &name,
-		const Common::String &domain, const char *const *modes, int modeCount);
+		const Common::String &domain, const char *const *modes, int modeCount,
+		const ExtraGuiOptions &options = ExtraGuiOptions(), bool onTitleScreen = true);
 	~GraphicsOptionsWidget() override {
 	}
 
diff --git a/engines/ultima/ultima3/data/data.cpp b/engines/ultima/ultima3/data/data.cpp
index 61553f2158d..8e0bc28aabb 100644
--- a/engines/ultima/ultima3/data/data.cpp
+++ b/engines/ultima/ultima3/data/data.cpp
@@ -19,7 +19,10 @@
  *
  */
 
+#include "common/file.h"
 #include "common/system.h"
+#include "common/translation.h"
+#include "graphics/palette.h"
 #include "graphics/paletteman.h"
 #include "ultima/ultima3/data/data.h"
 
@@ -34,9 +37,64 @@ const byte CGA_PALETTE1[4 * 3] = {
 	0xff, 0xff, 0xff  // 3: white
 };
 
-void setCGAPalette() {
-	Graphics::Palette palette(4);
-	palette.set(CGA_PALETTE1, 0, 4);
+const char *const RENDER_MODE_LABELS[RENDER_MODE_COUNT] = {
+	_s("Original (CGA)"), _s("Composite monitor (CGA)"), _s("EGA (16 colors)"), _s("VGA (256 colors)")
+};
+
+// The standard 16-color EGA/VGA palette
+static const byte EGA_PALETTE16[16 * 3] = {
+	0x00, 0x00, 0x00, // 0: black
+	0x00, 0x00, 0xaa, // 1: blue
+	0x00, 0xaa, 0x00, // 2: green
+	0x00, 0xaa, 0xaa, // 3: cyan
+	0xaa, 0x00, 0x00, // 4: red
+	0xaa, 0x00, 0xaa, // 5: magenta
+	0xaa, 0x55, 0x00, // 6: brown
+	0xaa, 0xaa, 0xaa, // 7: light gray
+	0x55, 0x55, 0x55, // 8: dark gray
+	0x55, 0x55, 0xff, // 9: light blue
+	0x55, 0xff, 0x55, // 10: light green
+	0x55, 0xff, 0xff, // 11: light cyan
+	0xff, 0x55, 0x55, // 12: light red
+	0xff, 0x55, 0xff, // 13: light magenta
+	0xff, 0xff, 0x55, // 14: yellow
+	0xff, 0xff, 0xff  // 15: white
+};
+
+// Reads a VGA palette file, whose entries are 6-bit R, G, B, into a palette
+static void loadPaletteFile(Graphics::Palette &palette, const char *filename, int base, int count) {
+	Common::File f;
+	if (!f.open(filename))
+		error("Could not load %s", filename);
+
+	for (int i = 0; i < count; ++i) {
+		byte rgb[3];
+		if (f.read(rgb, 3) != 3)
+			error("%s is too short", filename);
+
+		for (int c = 0; c < 3; ++c)
+			rgb[c] = (rgb[c] << 2) | (rgb[c] >> 4);
+		palette.set(rgb, base + i, 1);
+	}
+}
+
+void setPalette(RenderMode mode) {
+	Graphics::Palette palette(256);
+
+	switch (mode) {
+	case RENDER_EGA:
+		palette.set(EGA_PALETTE16, 0, 16);
+		break;
+	case RENDER_VGA:
+		loadPaletteFile(palette, "u3vga.pal", 0, 256);
+		break;
+	default:
+		palette.set(CGA_PALETTE1, 0, 4);
+		if (mode == RENDER_CGA_COMPOSITE)
+			loadPaletteFile(palette, "cgacomp.pal", COMPOSITE_PALETTE_BASE, COMPOSITE_PALETTE_SIZE);
+		break;
+	}
+
 	g_system->getPaletteManager()->setPalette(palette);
 }
 
diff --git a/engines/ultima/ultima3/data/data.h b/engines/ultima/ultima3/data/data.h
index f115ba475b2..3a9d8564354 100644
--- a/engines/ultima/ultima3/data/data.h
+++ b/engines/ultima/ultima3/data/data.h
@@ -28,11 +28,48 @@ namespace Ultima {
 namespace Ultima3 {
 namespace Data {
 
-// Ultima III renders everything (title screens, tiles, in-game text) in a
-// single CGA 4-color palette
+// The original CGA 4-color palette, used by the original and composite modes
 extern const byte CGA_PALETTE1[4 * 3];
 
-void setCGAPalette();
+// The renderers from the Ultima III Upgrade patch
+enum RenderMode {
+	RENDER_CGA = 0, RENDER_CGA_COMPOSITE = 1, RENDER_EGA = 2, RENDER_VGA = 3,
+	RENDER_MODE_COUNT = 4
+};
+
+// Descriptions of the modes for the launcher's graphics mode drop-down, in
+// the same order. Marked for translation, but not translated
+extern const char *const RENDER_MODE_LABELS[RENDER_MODE_COUNT];
+
+// EGA and VGA draw everything from the upgrade's coloured graphics files
+inline bool isEnhancedMode(RenderMode mode) {
+	return mode == RENDER_EGA || mode == RENDER_VGA;
+}
+
+// The composite renderer's 16 artifact colors, loaded from CGACOMP.PAL, are
+// kept clear of the CGA colors. Gfx::compositeDecode maps each decoded CGA
+// pixel to one of these
+constexpr int COMPOSITE_PALETTE_BASE = 32;
+constexpr int COMPOSITE_PALETTE_SIZE = 16;
+
+// The colors the game draws with, which differ between the modes
+inline byte whiteColor(RenderMode mode) {
+	return isEnhancedMode(mode) ? 15 : 3;
+}
+
+// The color of the frame around the screens in the EGA renderer, which is made of solid cells
+constexpr byte EGA_FRAME_COLOR = 9;
+
+// What the pixels flipped to show something inverted are XORed with
+inline byte invertMask(RenderMode mode) {
+	return isEnhancedMode(mode) ? 0x0F : 3;
+}
+
+/**
+ * Sets the screen palette for a mode, which is the CGA colors, the EGA colors
+ * or the VGA palette file
+ */
+void setPalette(RenderMode mode);
 
 // The letters a character's sex, race and class are stored as, with the
 // names shown for each
diff --git a/engines/ultima/ultima3/gfx/charset.cpp b/engines/ultima/ultima3/gfx/charset.cpp
index fb6c1e31378..2bd1ccac41d 100644
--- a/engines/ultima/ultima3/gfx/charset.cpp
+++ b/engines/ultima/ultima3/gfx/charset.cpp
@@ -21,34 +21,61 @@
 
 #include "common/file.h"
 #include "ultima/ultima3/gfx/charset.h"
+#include "ultima/ultima3/gfx/pixels.h"
+#include "ultima/ultima3/ultima3.h"
 
 namespace Ultima {
 namespace Ultima3 {
 namespace Gfx {
 
-byte CharSet::_data[CHARSET_GLYPHS * CHARSET_GLYPH_BYTES];
+constexpr int CGA_GLYPH_BYTES = 16;
+
+byte CharSet::_data[CHARSET_GLYPHS * CHARSET_GLYPH_PIXELS];
 
 void CharSet::load() {
 	Common::File f;
-	if (!f.open("CHARSET.ULT") || f.read(_data, sizeof(_data)) != sizeof(_data))
-		error("Could not load CHARSET.ULT");
+
+	switch (_G(renderMode)) {
+	case Data::RENDER_EGA: {
+		byte data[CHARSET_GLYPHS * CHARSET_GLYPH_PIXELS / 2];
+		if (!f.open("charset.ega") || f.read(data, sizeof(data)) != sizeof(data))
+			error("Could not load charset.ega");
+
+		unpack4bpp(data, _data, sizeof(_data));
+		break;
+	}
+
+	case Data::RENDER_VGA:
+		if (!f.open("charset.vga") || f.read(_data, sizeof(_data)) != sizeof(_data))
+			error("Could not load charset.vga");
+		break;
+
+	default: {
+		byte data[CHARSET_GLYPHS * CGA_GLYPH_BYTES];
+		if (!f.open("CHARSET.ULT") || f.read(data, sizeof(data)) != sizeof(data))
+			error("Could not load CHARSET.ULT");
+
+		// The first 8 bytes of a glyph hold the even scanlines and the next 8 the odd
+		// ones, 2 bytes (8 pixels) per scanline
+		for (int chr = 0; chr < CHARSET_GLYPHS; ++chr) {
+			const byte *glyph = &data[chr * CGA_GLYPH_BYTES];
+
+			for (int y = 0; y < 8; ++y)
+				unpack2bpp(glyph + (y & 1) * 8 + (y >> 1) * 2, &_data[chr * CHARSET_GLYPH_PIXELS + y * 8], 8);
+		}
+		break;
+	}
+	}
 }
 
 void CharSet::drawChar(Graphics::Surface *dst, uint32 chr, int x, int y, uint32 color) const {
 	if (chr >= CHARSET_GLYPHS)
 		return;
 
-	// The first 8 bytes hold the even scanlines and the next 8 the odd ones,
-	// 2 bytes (8 pixels) per scanline
-	const byte *glyph = &_data[chr * CHARSET_GLYPH_BYTES];
-
-	for (int yp = 0; yp < 8; ++yp) {
-		const byte *line = glyph + (yp & 1) * 8 + (yp >> 1) * 2;
-		byte *destP = (byte *)dst->getBasePtr(x, y + yp);
+	const byte *glyph = &_data[chr * CHARSET_GLYPH_PIXELS];
 
-		for (int xp = 0; xp < 8; ++xp, ++destP)
-			*destP = (line[xp >> 2] >> (6 - (xp & 3) * 2)) & 3;
-	}
+	for (int yp = 0; yp < 8; ++yp)
+		memcpy(dst->getBasePtr(x, y + yp), glyph + yp * 8, 8);
 }
 
 } // namespace Gfx
diff --git a/engines/ultima/ultima3/gfx/charset.h b/engines/ultima/ultima3/gfx/charset.h
index e89b4a61fa2..f76823472e4 100644
--- a/engines/ultima/ultima3/gfx/charset.h
+++ b/engines/ultima/ultima3/gfx/charset.h
@@ -30,15 +30,16 @@ namespace Ultima3 {
 namespace Gfx {
 
 constexpr int CHARSET_GLYPHS = 128;
-constexpr int CHARSET_GLYPH_BYTES = 16;
+constexpr int CHARSET_GLYPH_PIXELS = 8 * 8;
 
 /**
- * The game's CGA font from CHARSET.ULT: 128 glyphs of 8x8 pixels at 2 bits
- * per pixel, so each glyph carries its own colors.
+ * The game's font from CHARSET.ULT: 128 glyphs of 8x8 pixels at 2 bits per
+ * pixel, or from the upgrade's EGA or VGA files, depending on the renderer.
+ * Each glyph carries its own colors, and is kept a byte per pixel.
  */
 class CharSet : public Graphics::Font {
 private:
-	static byte _data[CHARSET_GLYPHS * CHARSET_GLYPH_BYTES];
+	static byte _data[CHARSET_GLYPHS * CHARSET_GLYPH_PIXELS];
 
 public:
 	static void load();
diff --git a/engines/ultima/ultima3/gfx/composite.cpp b/engines/ultima/ultima3/gfx/composite.cpp
new file mode 100644
index 00000000000..566dfeb5615
--- /dev/null
+++ b/engines/ultima/ultima3/gfx/composite.cpp
@@ -0,0 +1,98 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "common/array.h"
+#include "ultima/ultima3/gfx/composite.h"
+#include "ultima/ultima3/ultima3.h"
+
+namespace Ultima {
+namespace Ultima3 {
+namespace Gfx {
+
+namespace {
+
+// For each possible window of 4 consecutive pixels (the first in the top
+// two bits), the colors of the middle two. A middle pixel shows as a solid
+// CGA color only if it matches a neighbor, otherwise as the "transition"
+// color of the two middle pixels together
+byte g_leftColor[256];
+byte g_rightColor[256];
+bool g_tableReady = false;
+
+void buildTable() {
+	for (int w = 0; w < 256; ++w) {
+		int p0 = (w >> 6) & 3, p1 = (w >> 4) & 3, p2 = (w >> 2) & 3, p3 = w & 3;
+		int mid = (p1 << 2) | p2;
+
+		g_leftColor[w] = (p1 == p0 || p1 == p2) ? (p1 << 2) | p1 : mid;
+		g_rightColor[w] = (p3 == p2 || p1 == p2) ? (p2 << 2) | p2 : mid;
+	}
+
+	g_tableReady = true;
+}
+
+} // End of anonymous namespace
+
+void compositeDecode(Graphics::ManagedSurface &surf) {
+	if (!g_tableReady)
+		buildTable();
+
+	// The output overwrites the pixels it reads, so work from a copy
+	int w = surf.w, h = surf.h;
+	Common::Array<byte> src(w * h);
+	for (int y = 0; y < h; ++y)
+		memcpy(&src[y * w], surf.getBasePtr(0, y), w);
+
+	// Anything that isn't a CGA color doesn't take part in the decode
+	auto cga = [&](int x, int y) -> int {
+		byte v = src[y * w + x];
+		return v <= 3 ? v : 0;
+	};
+
+	for (int y = 0; y < h; ++y) {
+		byte *dst = (byte *)surf.getBasePtr(0, y);
+
+		for (int x = 0; x < w; x += 2) {
+			// The driver reads the byte after the end of a line from the start
+			// of the line after next in the same CGA bank, rather than
+			// treating it as blank
+			int p0 = (x > 0) ? cga(x - 1, y) : 0;
+			int p3 = (x + 2 < w) ? cga(x + 2, y) : ((y + 2 < h) ? cga(0, y + 2) : 0);
+			int window = (p0 << 6) | (cga(x, y) << 4) | (cga(x + 1, y) << 2) | p3;
+
+			if (src[y * w + x] <= 3)
+				dst[x] = Data::COMPOSITE_PALETTE_BASE + g_leftColor[window];
+			if (x + 1 < w && src[y * w + x + 1] <= 3)
+				dst[x + 1] = Data::COMPOSITE_PALETTE_BASE + g_rightColor[window];
+		}
+	}
+
+	surf.markAllDirty();
+}
+
+void compositeFinish(Graphics::ManagedSurface &surf) {
+	if (g_engine->_renderMode == Data::RENDER_CGA_COMPOSITE)
+		compositeDecode(surf);
+}
+
+} // namespace Gfx
+} // namespace Ultima3
+} // namespace Ultima
diff --git a/engines/ultima/ultima3/gfx/composite.h b/engines/ultima/ultima3/gfx/composite.h
new file mode 100644
index 00000000000..b28009bdf6d
--- /dev/null
+++ b/engines/ultima/ultima3/gfx/composite.h
@@ -0,0 +1,48 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef ULTIMA3_GFX_COMPOSITE_H
+#define ULTIMA3_GFX_COMPOSITE_H
+
+#include "graphics/managed_surface.h"
+
+namespace Ultima {
+namespace Ultima3 {
+namespace Gfx {
+
+/**
+ * Decodes CGA-indexed pixels (0-3) of a surface, in place, into the
+ * composite monitor's artifact colors: pixel values in the
+ * COMPOSITE_PALETTE_BASE range
+ */
+void compositeDecode(Graphics::ManagedSurface &surf);
+
+/**
+ * Called by views once they've finished drawing: decodes the surface if the
+ * composite renderer is the active one, and does nothing otherwise
+ */
+void compositeFinish(Graphics::ManagedSurface &surf);
+
+} // namespace Gfx
+} // namespace Ultima3
+} // namespace Ultima
+
+#endif
diff --git a/engines/ultima/ultima3/gfx/dungeon_view.cpp b/engines/ultima/ultima3/gfx/dungeon_view.cpp
index 66a02819ed8..b46e83cce19 100644
--- a/engines/ultima/ultima3/gfx/dungeon_view.cpp
+++ b/engines/ultima/ultima3/gfx/dungeon_view.cpp
@@ -21,6 +21,7 @@
 
 #include "common/util.h"
 #include "ultima/ultima3/gfx/dungeon_view.h"
+#include "ultima/ultima3/ultima3.h"
 
 namespace Ultima {
 namespace Ultima3 {
@@ -164,21 +165,39 @@ constexpr int LADDER_PLACES = 21;
 constexpr int MIDDLE = 0x40;
 constexpr int DOOR_CUTOUT = 0x20;
 
+// The colors drawn in the upgrade's renderers, all of which are white in the original
+constexpr byte COLOR_ORIGINAL = 3;
+constexpr byte COLOR_WALL = 6;
+constexpr byte COLOR_DOOR = 7;
+constexpr byte COLOR_CHEST = 0x0E;
+constexpr byte COLOR_LADDER = 0x0F;
+
+// Faces up to this number are walls, with the doors and so on after
+constexpr int LAST_WALL_FACE = 0x20;
+
+static bool isEnhanced() {
+	return Data::isEnhancedMode(_G(renderMode));
+}
+
 void DungeonView::plot(int x, int y) {
 	x = (byte)(x + OFFSET);
 	y = (byte)(y + OFFSET);
 
 	if (y < HEIGHT)
-		_pixels[y * WIDTH + x] = 3;
+		_pixels[y * WIDTH + x] |= isEnhanced() ? COLOR_LADDER : COLOR_ORIGINAL;
 }
 
-void DungeonView::column(int x, int top, int bottom, bool erase) {
+void DungeonView::column(int x, int top, int bottom, bool erase, byte color) {
 	x = (byte)(x + OFFSET);
 	int height = (byte)(bottom - top);
 
 	// Hatched walls are made of columns of pixels, which this fills in or clears
-	for (int y = (byte)top + OFFSET; height > 0 && y < HEIGHT; ++y, --height)
-		_pixels[y * WIDTH + x] = erase ? 0 : 3;
+	for (int y = (byte)top + OFFSET; height > 0 && y < HEIGHT; ++y, --height) {
+		if (erase)
+			_pixels[y * WIDTH + x] = 0;
+		else
+			_pixels[y * WIDTH + x] |= color;
+	}
 }
 
 void DungeonView::line(int x0, int y0, int x1, int y1) {
@@ -244,8 +263,15 @@ void DungeonView::drawWall(int face) {
 		}
 	};
 
+	// The color depends on what's being drawn, and the sides of doors are a column wider
+	const bool enhanced = isEnhanced();
+	const byte color = !enhanced ? COLOR_ORIGINAL : (face <= LAST_WALL_FACE ? COLOR_WALL : COLOR_DOOR);
+	const bool wide = enhanced && face > LAST_WALL_FACE;
+
 	for (;;) {
-		column(x, top, bottom, erase);
+		column(x, top, bottom, erase, color);
+		if (wide)
+			column(x + 1, top, bottom, erase, color);
 		if (--columns == 0)
 			break;
 
@@ -292,7 +318,7 @@ void DungeonView::drawChest(int place) {
 
 	int x = rec[0];
 	do {
-		column(x, rec[2], rec[3], false);
+		column(x, rec[2], rec[3], false, isEnhanced() ? COLOR_CHEST : COLOR_ORIGINAL);
 		++x;
 	} while (x < rec[1]);
 }
diff --git a/engines/ultima/ultima3/gfx/dungeon_view.h b/engines/ultima/ultima3/gfx/dungeon_view.h
index 2b78a10d46b..03ebdd204c0 100644
--- a/engines/ultima/ultima3/gfx/dungeon_view.h
+++ b/engines/ultima/ultima3/gfx/dungeon_view.h
@@ -30,7 +30,8 @@ namespace Gfx {
 
 /**
  * The first person view down the corridors of a dungeon: the walls, doors,
- * ladders and chests in sight drawn as white lines
+ * ladders and chests in sight drawn as lines, which are all white in the
+ * original and have colors in the upgrade's EGA and VGA renderers
  */
 class DungeonView {
 private:
@@ -51,7 +52,7 @@ private:
 
 	void plot(int x, int y);
 	void line(int x0, int y0, int x1, int y1);
-	void column(int x, int top, int bottom, bool erase);
+	void column(int x, int top, int bottom, bool erase, byte color);
 	void drawWall(int face);
 	void drawLadder(bool down, int place);
 	void drawChest(int place);
@@ -78,11 +79,11 @@ public:
 	void draw(const Data::Dungeon &dungeon, int level, int x, int y, int facing);
 
 	/**
-	 * Returns true if a pixel of the picture, whose position is that on the
-	 * screen, is lit
+	 * Returns the color of a pixel of the picture, whose position is that on
+	 * the screen, which is zero if it's not lit
 	 */
-	bool isLit(int x, int y) const {
-		return _pixels[y * WIDTH + x] != 0;
+	byte color(int x, int y) const {
+		return _pixels[y * WIDTH + x];
 	}
 };
 
diff --git a/engines/ultima/ultima3/gfx/frame.cpp b/engines/ultima/ultima3/gfx/frame.cpp
new file mode 100644
index 00000000000..672ec6ba6fd
--- /dev/null
+++ b/engines/ultima/ultima3/gfx/frame.cpp
@@ -0,0 +1,88 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "ultima/ultima3/gfx/charset.h"
+#include "ultima/ultima3/gfx/frame.h"
+
+namespace Ultima {
+namespace Ultima3 {
+namespace Gfx {
+
+// The characters the frame is made of: the ends of each run have a corner
+constexpr char GLYPH_HORIZONTAL = 0x0D;
+constexpr char GLYPH_VERTICAL = 0x0E;
+constexpr char GLYPH_CORNER = 0x0F;
+
+constexpr int GAME_VIEW_SIZE = 24;
+constexpr int PANEL_COL = 23;
+constexpr int PANEL_END = 39;
+constexpr int PANEL_ROWS = 17;
+constexpr int PANEL_SLOT_ROWS = 4;
+
+constexpr int WINDOW_TOP = 10;
+constexpr int WINDOW_BOTTOM = 23;
+constexpr int WINDOW_LAST_COL = 39;
+
+// The ornaments on the top of the window sit half a cell in from the corners
+constexpr int ORNAMENT_LEFT = 2 * 8 + 4;
+constexpr int ORNAMENT_RIGHT = 36 * 8 + 4;
+
+using Graphics::Views::GfxSurface;
+
+static void horizontal(GfxSurface &s, int col, int row, int count) {
+	for (int i = 0; i < count; ++i)
+		s.writeChar(Common::Point(col + i, row), (i == 0 || i == count - 1) ? GLYPH_CORNER : GLYPH_HORIZONTAL);
+}
+
+static void vertical(GfxSurface &s, int col, int row, int count) {
+	for (int i = 0; i < count; ++i)
+		s.writeChar(Common::Point(col, row + i), (i == 0 || i == count - 1) ? GLYPH_CORNER : GLYPH_VERTICAL);
+}
+
+void drawGameFrame(GfxSurface &s) {
+	vertical(s, 0, 0, GAME_VIEW_SIZE);
+	horizontal(s, 0, 0, GAME_VIEW_SIZE);
+	vertical(s, PANEL_COL, 0, GAME_VIEW_SIZE);
+	horizontal(s, 0, WINDOW_BOTTOM, GAME_VIEW_SIZE);
+	vertical(s, PANEL_END, 0, PANEL_ROWS);
+
+	// The party members' panels are divided by lines
+	for (int row = 0; row < PANEL_ROWS; row += PANEL_SLOT_ROWS)
+		horizontal(s, PANEL_COL, row, PANEL_ROWS);
+}
+
+void drawWindowFrame(GfxSurface &s) {
+	horizontal(s, 0, WINDOW_BOTTOM, WINDOW_LAST_COL + 1);
+	horizontal(s, 0, WINDOW_TOP, WINDOW_LAST_COL + 1);
+
+	// The ornaments are half way between character cells
+	CharSet font;
+	font.drawChar(s.surfacePtr(), GLYPH_CORNER, ORNAMENT_LEFT, WINDOW_TOP * 8, 0);
+	font.drawChar(s.surfacePtr(), GLYPH_CORNER, ORNAMENT_RIGHT, WINDOW_TOP * 8, 0);
+	s.addDirtyRect(Common::Rect(0, WINDOW_TOP * 8, 320, (WINDOW_TOP + 1) * 8));
+
+	vertical(s, 0, WINDOW_TOP, WINDOW_BOTTOM - WINDOW_TOP + 1);
+	vertical(s, WINDOW_LAST_COL, WINDOW_TOP, WINDOW_BOTTOM - WINDOW_TOP + 1);
+}
+
+} // namespace Gfx
+} // namespace Ultima3
+} // namespace Ultima
diff --git a/engines/ultima/ultima3/gfx/frame.h b/engines/ultima/ultima3/gfx/frame.h
new file mode 100644
index 00000000000..a01bf841a77
--- /dev/null
+++ b/engines/ultima/ultima3/gfx/frame.h
@@ -0,0 +1,47 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef ULTIMA3_GFX_FRAME_H
+#define ULTIMA3_GFX_FRAME_H
+
+#include "graphics/views/gfx_surface.h"
+
+namespace Ultima {
+namespace Ultima3 {
+namespace Gfx {
+
+/**
+ * Draws the frame around the game screen in the VGA renderer, which is made
+ * of characters from the font rather than the original's patterned cells
+ */
+void drawGameFrame(Graphics::Views::GfxSurface &s);
+
+/**
+ * Draws the border of the window at the bottom of the menu screens in the
+ * VGA renderer
+ */
+void drawWindowFrame(Graphics::Views::GfxSurface &s);
+
+} // namespace Gfx
+} // namespace Ultima3
+} // namespace Ultima
+
+#endif
diff --git a/engines/ultima/ultima3/gfx/overview.cpp b/engines/ultima/ultima3/gfx/overview.cpp
index c6cc69025c7..ad9b46444bc 100644
--- a/engines/ultima/ultima3/gfx/overview.cpp
+++ b/engines/ultima/ultima3/gfx/overview.cpp
@@ -34,17 +34,71 @@ constexpr char GLYPH_PARTY = '*';
 static const int FLICKER_X[4] = { 0, 1, 1, 0 };
 static const int FLICKER_Y[4] = { 0, 1, 0, 1 };
 
+// The colors the upgrade's renderers give the terrain: for the cells that are
+// told apart, the pair of EGA colors the pixels of the first row take and the
+// VGA color
+struct TerrainColor {
+	byte _cell;
+	byte _ega;
+	byte _vga;
+};
+
+static const TerrainColor TERRAIN_COLORS[] = {
+	{ 0x00, 0x11, 0x01 }, { 0x04, 0x02, 0x22 }, { 0x08, 0x22, 0x42 }, { 0x0C, 0x2A, 0x62 },
+	{ 0x10, 0x66, 0x16 }, { 0x20, 0x04, 0x44 }, { 0x80, 0xEE, 0x68 }, { 0x84, 0x44, 0x74 },
+	{ 0x8C, 0xFF, 0x0F }
+};
+constexpr byte OTHER_EGA = 0x77;
+constexpr byte OTHER_VGA = 0x77;
+
+// What the party's square is flipped by to make it flash, which is the same
+// in both the pixels it's made of
+constexpr byte MARKER_EGA = 0x0C;
+constexpr byte MARKER_VGA = 0xCC;
+
 void Overview::plot(int x, int y, int value) {
 	_pixels[y * MAP_SIZE * 2 + x] ^= value;
 }
 
+void Overview::showEnhancedMap() {
+	const bool ega = _G(renderMode) == Data::RENDER_EGA;
+
+	for (int y = 0; y < MAP_SIZE; ++y) {
+		for (int x = 0; x < MAP_SIZE; ++x) {
+			byte cell = _G(map).cell(x, y);
+			byte egaColor = OTHER_EGA, vgaColor = OTHER_VGA;
+
+			for (const TerrainColor &t : TERRAIN_COLORS) {
+				if (t._cell == cell) {
+					egaColor = t._ega;
+					vgaColor = t._vga;
+					break;
+				}
+			}
+
+			// In EGA the pair of colors is swapped on the second row to make a dither
+			byte *top = &_pixels[y * 2 * MAP_SIZE * 2 + x * 2];
+			byte *bottom = top + MAP_SIZE * 2;
+			if (ega) {
+				top[0] = bottom[1] = egaColor >> 4;
+				top[1] = bottom[0] = egaColor & 0x0F;
+			} else {
+				top[0] = top[1] = bottom[0] = bottom[1] = vgaColor;
+			}
+		}
+	}
+}
+
 void Overview::showMap() {
 	const Data::Savegame &save = _G(savegame);
 	memset(_pixels, 0, sizeof(_pixels));
 
+	if (Data::isEnhancedMode(_G(renderMode)))
+		showEnhancedMap();
+
 	// Each square of the map becomes a block of four pixels with a shape
 	// depending on what's in it
-	for (int y = 0; y < MAP_SIZE; ++y) {
+	for (int y = 0; y < MAP_SIZE && !Data::isEnhancedMode(_G(renderMode)); ++y) {
 		for (int x = 0; x < MAP_SIZE; ++x) {
 			byte cell = _G(map).cell(x, y);
 			int px = x * 2, py = y * 2;
@@ -130,14 +184,22 @@ void Overview::tick() {
 
 void Overview::draw(Graphics::Views::GfxSurface &s) const {
 	if (_type == WORLD) {
+		const bool enhanced = Data::isEnhancedMode(_G(renderMode));
+
 		for (int y = 0; y < MAP_SIZE * 2; ++y) {
 			for (int x = 0; x < MAP_SIZE * 2; ++x) {
 				int value = _pixels[y * MAP_SIZE * 2 + x];
 
-				// The flickering shows up as the opposite of what's there
-				for (int i = 0; i < 4; ++i) {
-					if (_lit[i] && x == _partyX * 2 + FLICKER_X[i] && y == _partyY * 2 + FLICKER_Y[i])
-						value ^= 3;
+				if (enhanced) {
+					// The party's whole square flashes
+					if (((_step / (STEPS_PER_FLICKER * 2)) & 1) && x / 2 == _partyX && y / 2 == _partyY)
+						value ^= (_G(renderMode) == Data::RENDER_EGA) ? MARKER_EGA : MARKER_VGA;
+				} else {
+					// The flickering shows up as the opposite of what's there
+					for (int i = 0; i < 4; ++i) {
+						if (_lit[i] && x == _partyX * 2 + FLICKER_X[i] && y == _partyY * 2 + FLICKER_Y[i])
+							value ^= 3;
+					}
 				}
 
 				if (value)
diff --git a/engines/ultima/ultima3/gfx/overview.h b/engines/ultima/ultima3/gfx/overview.h
index 5b732b47c64..76261b1e0d8 100644
--- a/engines/ultima/ultima3/gfx/overview.h
+++ b/engines/ultima/ultima3/gfx/overview.h
@@ -54,6 +54,11 @@ private:
 
 	void plot(int x, int y, int value);
 
+	/**
+	 * Builds the picture of the current map in the colors of the upgrade's renderers
+	 */
+	void showEnhancedMap();
+
 public:
 	/**
 	 * Builds the picture of the current map
diff --git a/engines/ultima/ultima3/gfx/pic_decoder.cpp b/engines/ultima/ultima3/gfx/pic_decoder.cpp
index f251725205e..24659596da3 100644
--- a/engines/ultima/ultima3/gfx/pic_decoder.cpp
+++ b/engines/ultima/ultima3/gfx/pic_decoder.cpp
@@ -22,6 +22,8 @@
 #include "common/stream.h"
 #include "ultima/ultima3/data/data.h"
 #include "ultima/ultima3/gfx/pic_decoder.h"
+#include "ultima/ultima3/gfx/pixels.h"
+#include "ultima/ultima3/ultima3.h"
 
 namespace Ultima {
 namespace Ultima3 {
@@ -39,6 +41,16 @@ bool PicDecoder::loadStream(Common::SeekableReadStream &stream) {
 	data.resize(stream.size());
 	stream.read(&data[0], stream.size());
 
+	if (_G(renderMode) == Data::RENDER_EGA) {
+		if (data.size() >= 320 * 200 / 2)
+			unpack4bpp(&data[0], output_buffer, 320 * 200);
+		return data.size() >= 320 * 200 / 2;
+	} else if (_G(renderMode) == Data::RENDER_VGA) {
+		if (data.size() >= 320 * 200)
+			memcpy(output_buffer, &data[0], 320 * 200);
+		return data.size() >= 320 * 200;
+	}
+
 	for (int y = 0; y < 200; ++y) {
 		int bank = y & 1;
 		const byte *row = &data[bank * BANK_SIZE + (y / 2) * BYTES_PER_ROW];
diff --git a/engines/ultima/ultima3/gfx/pic_decoder.h b/engines/ultima/ultima3/gfx/pic_decoder.h
index ef4827e7ef1..9445a1dc414 100644
--- a/engines/ultima/ultima3/gfx/pic_decoder.h
+++ b/engines/ultima/ultima3/gfx/pic_decoder.h
@@ -31,11 +31,13 @@ namespace Ultima3 {
 namespace Gfx {
 
 /**
- * Decodes Ultima III's raw "*.IBM" full-screen title art: a literal
- * 16384-byte dump of the CGA mode 4 (320x200, 4-color, palette 1)
- * framebuffer segment -- two interleaved 8192-byte banks (even scanlines
- * in the first, odd in the second), 2 bits/pixel, 4 pixels per byte,
- * MSB-first.
+ * Decodes Ultima III's raw full-screen title art. The original "*.IBM" files
+ * are a literal 16384-byte dump of the CGA mode 4 (320x200, 4-color,
+ * palette 1) framebuffer segment -- two interleaved 8192-byte banks (even
+ * scanlines in the first, odd in the second), 2 bits/pixel, 4 pixels per
+ * byte, MSB-first. The upgrade's "*.EGA" and "*.VGA" files are the 320x200
+ * pixels in order, at 4 and 8 bits per pixel. Which is read depends on the
+ * renderer in use.
  */
 class PicDecoder : public Image::ImageDecoder {
 private:
diff --git a/engines/ultima/ultima3/gfx/pixels.h b/engines/ultima/ultima3/gfx/pixels.h
new file mode 100644
index 00000000000..ae8815cc0c4
--- /dev/null
+++ b/engines/ultima/ultima3/gfx/pixels.h
@@ -0,0 +1,53 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef ULTIMA3_GFX_PIXELS_H
+#define ULTIMA3_GFX_PIXELS_H
+
+#include "common/scummsys.h"
+
+namespace Ultima {
+namespace Ultima3 {
+namespace Gfx {
+
+/**
+ * Expands pixels held two bits each, the first in the top bits of a byte,
+ * into a pixel per byte
+ */
+inline void unpack2bpp(const byte *src, byte *dest, int count) {
+	for (int i = 0; i < count; ++i)
+		dest[i] = (src[i >> 2] >> (6 - (i & 3) * 2)) & 3;
+}
+
+/**
+ * Expands pixels held four bits each, the first in the top half of a byte,
+ * into a pixel per byte
+ */
+inline void unpack4bpp(const byte *src, byte *dest, int count) {
+	for (int i = 0; i < count; ++i)
+		dest[i] = (i & 1) ? (src[i >> 1] & 0x0F) : (src[i >> 1] >> 4);
+}
+
+} // namespace Gfx
+} // namespace Ultima3
+} // namespace Ultima
+
+#endif
diff --git a/engines/ultima/ultima3/gfx/shapes.cpp b/engines/ultima/ultima3/gfx/shapes.cpp
index a0364574513..3505cd9bcd0 100644
--- a/engines/ultima/ultima3/gfx/shapes.cpp
+++ b/engines/ultima/ultima3/gfx/shapes.cpp
@@ -22,12 +22,15 @@
 #include "common/file.h"
 #include "common/util.h"
 #include "ultima/ultima3/gfx/shapes.h"
+#include "ultima/ultima3/gfx/pixels.h"
+#include "ultima/ultima3/ultima3.h"
 
 namespace Ultima {
 namespace Ultima3 {
 namespace Gfx {
 
 constexpr int BYTES_PER_LINE = 4;
+constexpr int SHAPE_BYTES = 64;
 
 // Tiles scrolled one pixel at a time, and how many ticks pass between each
 static const int SCROLL_TILES[4] = { 0, 33, 32, 34 };
@@ -42,14 +45,49 @@ static const byte FLICKER_PERIODS[3] = { 4, 3, 2 };
 // alternates: tiles 16-30 with 64-78, and tile 12 with 79
 constexpr byte SWAP_PERIOD = 10;
 
+// The tile of the moon gate, whose rings of color are cycled in VGA
+constexpr int GATE_TILE = 34;
+constexpr int GATE_RINGS = 5;
+
+// In VGA the flickering only affects the middle of a scanline
+constexpr int VGA_FLICKER_START = 4;
+constexpr int VGA_FLICKER_WIDTH = 8;
+
 static int lineOffset(int line) {
 	return (line & 1) * (SHAPE_BYTES / 2) + (line >> 1) * BYTES_PER_LINE;
 }
 
 void Shapes::load() {
 	Common::File f;
-	if (!f.open("SHAPES.ULT") || f.read(_data, sizeof(_data)) != sizeof(_data))
-		error("Could not load SHAPES.ULT");
+
+	switch (_G(renderMode)) {
+	case Data::RENDER_EGA: {
+		byte data[SHAPE_COUNT * SHAPE_PIXELS / 2];
+		if (!f.open("shapes.ega") || f.read(data, sizeof(data)) != sizeof(data))
+			error("Could not load shapes.ega");
+
+		unpack4bpp(data, _pixels, sizeof(_pixels));
+		break;
+	}
+
+	case Data::RENDER_VGA:
+		if (!f.open("shapes.vga") || f.read(_pixels, sizeof(_pixels)) != sizeof(_pixels))
+			error("Could not load shapes.vga");
+		break;
+
+	default: {
+		byte data[SHAPE_COUNT * SHAPE_BYTES];
+		if (!f.open("SHAPES.ULT") || f.read(data, sizeof(data)) != sizeof(data))
+			error("Could not load SHAPES.ULT");
+
+		for (int index = 0; index < SHAPE_COUNT; ++index) {
+			for (int line = 0; line < SHAPE_SIZE; ++line)
+				unpack2bpp(&data[index * SHAPE_BYTES + lineOffset(line)],
+					tile(index) + line * SHAPE_SIZE, SHAPE_SIZE);
+		}
+		break;
+	}
+	}
 
 	for (int i = 0; i < 4; ++i)
 		_scrollCounters[i] = SCROLL_PERIODS[i];
@@ -60,37 +98,69 @@ void Shapes::load() {
 
 void Shapes::scrollTile(int index) {
 	byte *t = tile(index);
-	byte carry[BYTES_PER_LINE];
-	memcpy(carry, t + lineOffset(15), BYTES_PER_LINE);
+	byte carry[SHAPE_SIZE];
+	memcpy(carry, t + (SHAPE_SIZE - 1) * SHAPE_SIZE, SHAPE_SIZE);
 
 	for (int line = 0; line < SHAPE_SIZE; ++line) {
-		byte old[BYTES_PER_LINE];
-		byte *dest = t + lineOffset(line);
+		byte old[SHAPE_SIZE];
+		byte *dest = t + line * SHAPE_SIZE;
+
+		memcpy(old, dest, SHAPE_SIZE);
+		memcpy(dest, carry, SHAPE_SIZE);
+		memcpy(carry, old, SHAPE_SIZE);
+	}
+}
+
+void Shapes::cycleRings(int index) {
+	byte *t = tile(index);
+
+	// Each ring is an arch, with the outer one starting at the top left. They
+	// each take the color of the ring outside them
+	byte color = t[1 * SHAPE_SIZE + 3];
+
+	for (int ring = GATE_RINGS - 1; ring >= 0; --ring) {
+		int x = 3 + ring;
+		byte next = t[14 * SHAPE_SIZE + x];
+		int width = 2 * (GATE_RINGS - 1 - ring) + 1;
+		int rows = 13 - ring;
+		int pos = 14 * SHAPE_SIZE + x;
+
+		for (int i = 0; i < rows; ++i, pos -= SHAPE_SIZE) {
+			t[pos] = color;
+			t[pos + width] = color;
+		}
+		for (int i = 0; i <= width; ++i)
+			t[pos + i] = color;
 
-		memcpy(old, dest, BYTES_PER_LINE);
-		memcpy(dest, carry, BYTES_PER_LINE);
-		memcpy(carry, old, BYTES_PER_LINE);
+		color = next;
 	}
 }
 
 void Shapes::swapLines(int index, int line1, int line2) {
 	byte *t = tile(index);
-	byte temp[BYTES_PER_LINE];
+	int start = 0, width = SHAPE_SIZE;
 
-	memcpy(temp, t + lineOffset(line1), BYTES_PER_LINE);
-	memcpy(t + lineOffset(line1), t + lineOffset(line2), BYTES_PER_LINE);
-	memcpy(t + lineOffset(line2), temp, BYTES_PER_LINE);
+	if (_G(renderMode) == Data::RENDER_VGA) {
+		start = VGA_FLICKER_START;
+		width = VGA_FLICKER_WIDTH;
+	}
+
+	for (int i = 0; i < width; ++i)
+		SWAP(t[line1 * SHAPE_SIZE + start + i], t[line2 * SHAPE_SIZE + start + i]);
 }
 
 void Shapes::swapTiles(int index1, int index2, int count) {
-	for (int i = 0; i < count * SHAPE_BYTES; ++i)
-		SWAP(_data[index1 * SHAPE_BYTES + i], _data[index2 * SHAPE_BYTES + i]);
+	for (int i = 0; i < count * SHAPE_PIXELS; ++i)
+		SWAP(_pixels[index1 * SHAPE_PIXELS + i], _pixels[index2 * SHAPE_PIXELS + i]);
 }
 
 void Shapes::animate() {
 	for (int i = 0; i < 4; ++i) {
 		if (--_scrollCounters[i] == 0) {
-			scrollTile(SCROLL_TILES[i]);
+			if (SCROLL_TILES[i] == GATE_TILE && _G(renderMode) == Data::RENDER_VGA)
+				cycleRings(GATE_TILE);
+			else
+				scrollTile(SCROLL_TILES[i]);
 			_scrollCounters[i] = SCROLL_PERIODS[i];
 		}
 	}
@@ -113,17 +183,10 @@ void Shapes::drawTile(Graphics::ManagedSurface &dest, int x, int y, int index) c
 	if (index < 0 || index >= SHAPE_COUNT)
 		return;
 
-	const byte *t = &_data[index * SHAPE_BYTES];
-
-	for (int line = 0; line < SHAPE_SIZE; ++line) {
-		const byte *src = t + lineOffset(line);
-		byte *destP = (byte *)dest.getBasePtr(x, y + line);
+	const byte *t = &_pixels[index * SHAPE_PIXELS];
 
-		for (int b = 0; b < BYTES_PER_LINE; ++b) {
-			for (int p = 0; p < 4; ++p)
-				*destP++ = (src[b] >> (6 - p * 2)) & 3;
-		}
-	}
+	for (int line = 0; line < SHAPE_SIZE; ++line)
+		memcpy(dest.getBasePtr(x, y + line), t + line * SHAPE_SIZE, SHAPE_SIZE);
 }
 
 } // namespace Gfx
diff --git a/engines/ultima/ultima3/gfx/shapes.h b/engines/ultima/ultima3/gfx/shapes.h
index d6cf5bdcf22..ef9d5b4506e 100644
--- a/engines/ultima/ultima3/gfx/shapes.h
+++ b/engines/ultima/ultima3/gfx/shapes.h
@@ -30,16 +30,18 @@ namespace Gfx {
 
 constexpr int SHAPE_COUNT = 80;
 constexpr int SHAPE_SIZE = 16;
-constexpr int SHAPE_BYTES = 64;
+constexpr int SHAPE_PIXELS = SHAPE_SIZE * SHAPE_SIZE;
 
 /**
- * The map tile graphics from SHAPES.ULT: 80 tiles of 16x16 pixels at 2 bits
- * per pixel. Each tile holds its even scanlines first, then its odd ones.
- * The animated tiles are changed in place as the animation ticks.
+ * The map tile graphics: 80 tiles of 16x16 pixels, from SHAPES.ULT, which
+ * has 2 bits per pixel with each tile holding its even scanlines first and
+ * then its odd ones, or from the upgrade's EGA or VGA files, depending on
+ * the renderer. They're kept a byte per pixel. The animated tiles are
+ * changed in place as the animation ticks.
  */
 class Shapes {
 private:
-	byte _data[SHAPE_COUNT * SHAPE_BYTES] = {};
+	byte _pixels[SHAPE_COUNT * SHAPE_PIXELS] = {};
 
 	// Ticks left before each animation step is next applied
 	byte _scrollCounters[4];
@@ -47,7 +49,7 @@ private:
 	byte _swapCounter;
 
 	byte *tile(int index) {
-		return &_data[index * SHAPE_BYTES];
+		return &_pixels[index * SHAPE_PIXELS];
 	}
 
 	/**
@@ -55,6 +57,11 @@ private:
 	 */
 	void scrollTile(int index);
 
+	/**
+	 * Passes the colors of the rings of the moon gate inwards by one ring
+	 */
+	void cycleRings(int index);
+
 	/**
 	 * Swaps two scanlines of a tile
 	 */
diff --git a/engines/ultima/ultima3/ultima3.cpp b/engines/ultima/ultima3/ultima3.cpp
index cab598df3d4..7cc446773ca 100644
--- a/engines/ultima/ultima3/ultima3.cpp
+++ b/engines/ultima/ultima3/ultima3.cpp
@@ -20,30 +20,41 @@
  */
 
 #include "common/config-manager.h"
+#include "common/engine_data.h"
 #include "common/system.h"
 #include "common/savefile.h"
 #include "engines/util.h"
 #include "audio/decoders/raw.h"
 #include "audio/softsynth/pcspk.h"
+#include "ultima/shared/engine/graphics_options.h"
 #include "ultima/ultima3/ultima3.h"
 #include "ultima/ultima3/console.h"
 #include "ultima/ultima3/metaengine.h"
-#include "ultima/ultima3/data/data.h"
 #include "ultima/ultima3/sound_effects.h"
-#include "ultima/ultima3/views/views.h"
+#include "ultima/ultima3/data/data.h"
 #include "ultima/ultima3/gfx/charset.h"
+#include "ultima/ultima3/gfx/shapes.h"
+#include "ultima/ultima3/views/views.h"
 
 namespace Ultima {
 namespace Ultima3 {
 
 Ultima3Engine *g_engine;
 
+// The renderer stored in the configuration, falling back to the original CGA
+// graphics if it's missing or stale
+static Data::RenderMode configuredRenderMode() {
+	int mode = ConfMan.getInt(Shared::GRAPHICS_MODE_KEY);
+	return (mode >= 0 && mode < Data::RENDER_MODE_COUNT) ? (Data::RenderMode)mode : Data::RENDER_CGA;
+}
+
 Ultima3Engine::Ultima3Engine(OSystem *syst, const Ultima::UltimaGameDescription *gameDesc) :
 		Engine(syst), Shared::Events("ultima3"), _gameDescription(gameDesc) {
 	g_engine = this;
 	_pcSpeaker = new Audio::PCSpeaker();
 	_moreMonsters = ConfMan.getBool("more_monsters");
 	_lessHunger = ConfMan.getBool("less_hunger");
+	_renderMode = configuredRenderMode();
 }
 
 Ultima3Engine::~Ultima3Engine() {
@@ -64,7 +75,17 @@ Common::Error Ultima3Engine::run() {
 
 	// Initialize 320x200 graphics mode
 	initGraphics(320, 200);
-	Data::setCGAPalette();
+
+	// Initialise engine data for the game, which has the graphics for the
+	// upgrade's renderers
+	Common::U32String errMsg;
+	if (!Common::load_engine_data("ultima.dat", "ultima3", 1, 0, errMsg)) {
+		GUIErrorMessage(errMsg);
+		return Common::kNoError;
+	}
+
+	// Set the palette and fonts of the renderer in use
+	Data::setPalette(_renderMode);
 	Gfx::CharSet::load();
 	_pcSpeakerReady = _pcSpeaker->init();
 
@@ -79,6 +100,24 @@ Common::Error Ultima3Engine::run() {
 	return Common::kNoError;
 }
 
+void Ultima3Engine::applyGameSettings() {
+	_moreMonsters = ConfMan.getBool("more_monsters");
+	_lessHunger = ConfMan.getBool("less_hunger");
+
+	// The renderer can be changed from the game options dialog
+	Data::RenderMode mode = configuredRenderMode();
+	if (mode == _renderMode)
+		return;
+
+	_renderMode = mode;
+	Data::setPalette(_renderMode);
+	Gfx::CharSet::load();
+	_shapes.load();
+
+	if (focusedView())
+		focusedView()->redraw();
+}
+
 bool Ultima3Engine::canSaveGameStateCurrently(Common::U32String *msg) {
 	// Anything but the title sequence, which isn't a state worth keeping
 	UIElement *view = focusedView();
diff --git a/engines/ultima/ultima3/ultima3.h b/engines/ultima/ultima3/ultima3.h
index ee2cc72d284..4b675622f87 100644
--- a/engines/ultima/ultima3/ultima3.h
+++ b/engines/ultima/ultima3/ultima3.h
@@ -34,6 +34,7 @@
 #include "ultima/detection.h"
 #include "ultima/shared/engine/events.h"
 #include "ultima/ultima3/data/arena.h"
+#include "ultima/ultima3/data/data.h"
 #include "ultima/ultima3/data/dungeon.h"
 #include "ultima/ultima3/data/map.h"
 #include "ultima/ultima3/data/savegame.h"
@@ -59,6 +60,7 @@ private:
 protected:
 	// Engine APIs
 	Common::Error run() override;
+	void applyGameSettings() override;
 
 	/**
 	 * Returns true if the game should quit
@@ -128,6 +130,9 @@ public:
 	bool _moreMonsters = false;
 	bool _lessHunger = false;
 
+	// Which of the upgrade's renderers is in use
+	Data::RenderMode _renderMode = Data::RENDER_CGA;
+
 	// Toggled in the game by the Volume command
 	bool _soundEnabled = true;
 
diff --git a/engines/ultima/ultima3/views/character_details.cpp b/engines/ultima/ultima3/views/character_details.cpp
index 734c7c59fcc..ccd38696067 100644
--- a/engines/ultima/ultima3/views/character_details.cpp
+++ b/engines/ultima/ultima3/views/character_details.cpp
@@ -20,6 +20,7 @@
  */
 
 #include "ultima/ultima3/views/character_details.h"
+#include "ultima/ultima3/gfx/composite.h"
 #include "ultima/ultima3/data/data.h"
 #include "ultima/ultima3/ultima3.h"
 
@@ -82,6 +83,8 @@ void CharacterDetails::draw() {
 
 	if (_state != ENTRY)
 		drawSpacePrompt(s);
+
+	Gfx::compositeFinish(s);
 }
 
 bool CharacterDetails::msgKeypress(const KeypressMessage &msg) {
diff --git a/engines/ultima/ultima3/views/create_character.cpp b/engines/ultima/ultima3/views/create_character.cpp
index f20e617c86a..9dc8a71c952 100644
--- a/engines/ultima/ultima3/views/create_character.cpp
+++ b/engines/ultima/ultima3/views/create_character.cpp
@@ -21,6 +21,7 @@
 
 #include "common/util.h"
 #include "ultima/ultima3/views/create_character.h"
+#include "ultima/ultima3/gfx/composite.h"
 #include "ultima/ultima3/data/data.h"
 #include "ultima/ultima3/ultima3.h"
 
@@ -106,6 +107,8 @@ void CreateCharacter::draw() {
 
 	if (_state == MESSAGE || _state == FINISHED)
 		drawSpacePrompt(s);
+
+	Gfx::compositeFinish(s);
 }
 
 bool CreateCharacter::acceptAttribute(int value) {
diff --git a/engines/ultima/ultima3/views/disperse_party.cpp b/engines/ultima/ultima3/views/disperse_party.cpp
index efa8f6b11fb..74e7c96c4f9 100644
--- a/engines/ultima/ultima3/views/disperse_party.cpp
+++ b/engines/ultima/ultima3/views/disperse_party.cpp
@@ -20,6 +20,7 @@
  */
 
 #include "ultima/ultima3/views/disperse_party.h"
+#include "ultima/ultima3/gfx/composite.h"
 #include "ultima/ultima3/ultima3.h"
 
 namespace Ultima {
@@ -47,6 +48,8 @@ void DisperseParty::draw() {
 		s.writeString(Common::Point(15, 20), "(No Party)");
 
 	drawSpacePrompt(s);
+
+	Gfx::compositeFinish(s);
 }
 
 bool DisperseParty::msgKeypress(const KeypressMessage &msg) {
diff --git a/engines/ultima/ultima3/views/dungeon_map.cpp b/engines/ultima/ultima3/views/dungeon_map.cpp
index 8646bafa55c..4447d28ea19 100644
--- a/engines/ultima/ultima3/views/dungeon_map.cpp
+++ b/engines/ultima/ultima3/views/dungeon_map.cpp
@@ -96,8 +96,9 @@ void DungeonMap::drawViewport(GfxSurface &s) {
 
 		for (int y = VIEW_TOP; y < VIEW_TOP + VIEW_SIZE; ++y) {
 			for (int x = VIEW_LEFT; x < VIEW_LEFT + VIEW_SIZE; ++x) {
-				if (_view.isLit(x, y))
-					s.setPixel(x, y, 3);
+				byte color = _view.color(x, y);
+				if (color)
+					s.setPixel(x, y, color);
 			}
 		}
 	}
diff --git a/engines/ultima/ultima3/views/form_party.cpp b/engines/ultima/ultima3/views/form_party.cpp
index e8eaeda6531..2171594dfc8 100644
--- a/engines/ultima/ultima3/views/form_party.cpp
+++ b/engines/ultima/ultima3/views/form_party.cpp
@@ -20,6 +20,7 @@
  */
 
 #include "ultima/ultima3/views/form_party.h"
+#include "ultima/ultima3/gfx/composite.h"
 #include "ultima/ultima3/ultima3.h"
 
 namespace Ultima {
@@ -89,6 +90,8 @@ void FormParty::draw() {
 		s.writeString(Common::Point(_messageCol, _messageRow), _message);
 		drawSpacePrompt(s);
 	}
+
+	Gfx::compositeFinish(s);
 }
 
 bool FormParty::msgKeypress(const KeypressMessage &msg) {
diff --git a/engines/ultima/ultima3/views/game.cpp b/engines/ultima/ultima3/views/game.cpp
index 62ac3383b71..c33e27641cc 100644
--- a/engines/ultima/ultima3/views/game.cpp
+++ b/engines/ultima/ultima3/views/game.cpp
@@ -20,6 +20,8 @@
  */
 
 #include "ultima/ultima3/views/game.h"
+#include "ultima/ultima3/gfx/composite.h"
+#include "ultima/ultima3/gfx/frame.h"
 #include "ultima/ultima3/views/menu_input.h"
 #include "ultima/ultima3/views/interactions/equip.h"
 #include "ultima/ultima3/views/interactions/exchange.h"
@@ -196,20 +198,28 @@ bool Game::msgKeypress(const KeypressMessage &msg) {
 }
 
 void Game::invertRect(GfxSurface &s, const Common::Rect &r) {
+	const byte mask = Data::invertMask(_G(renderMode));
+
 	for (int y = r.top; y < r.bottom; ++y) {
 		byte *p = (byte *)s.getBasePtr(r.left, y);
 
 		for (int x = r.left; x < r.right; ++x, ++p)
-			*p ^= 3;
+			*p ^= mask;
 	}
 }
 
 void Game::drawFrame(GfxSurface &s) {
-	// Alternating black and magenta pixels, filling whole 8x8 cells
+	if (_G(renderMode) == Data::RENDER_VGA) {
+		Gfx::drawGameFrame(s);
+		return;
+	}
+
+	// Alternating black and magenta pixels, or solid light blue in EGA, filling whole 8x8 cells
+	const bool ega = _G(renderMode) == Data::RENDER_EGA;
 	auto cell = [&](int col, int row) {
 		for (int y = 0; y < 8; ++y)
 			for (int x = 0; x < 8; ++x)
-				s.setPixel(col * 8 + x, row * 8 + y, (x & 1) ? 2 : 0);
+				s.setPixel(col * 8 + x, row * 8 + y, ega ? Data::EGA_FRAME_COLOR : ((x & 1) ? 2 : 0));
 	};
 
 	for (int row = 0; row < 24; ++row) {
@@ -312,6 +322,8 @@ void Game::draw() {
 	if (fx._highlight >= 0)
 		invertRect(s, Common::Rect(31 * 8, fx._highlight * PANEL_SLOT_ROWS * 8, 32 * 8,
 			(fx._highlight * PANEL_SLOT_ROWS + 1) * 8));
+
+	Gfx::compositeFinish(s);
 }
 
 } // namespace Views
diff --git a/engines/ultima/ultima3/views/interactions/insert_card.cpp b/engines/ultima/ultima3/views/interactions/insert_card.cpp
index da6c57ac31f..98d30be1d8a 100644
--- a/engines/ultima/ultima3/views/interactions/insert_card.cpp
+++ b/engines/ultima/ultima3/views/interactions/insert_card.cpp
@@ -188,12 +188,13 @@ bool InsertCard::timeout() {
 
 void InsertCard::draw(GfxSurface &s) {
 	if (_stage == SHATTER) {
+		const byte mask = Data::invertMask(_G(renderMode));
 		for (int y = VIEWPORT_LEFT; y < VIEWPORT_RIGHT; ++y) {
 			byte *p = (byte *)s.getBasePtr(VIEWPORT_LEFT, y);
 
 			for (int x = VIEWPORT_LEFT; x < VIEWPORT_RIGHT; ++x, ++p) {
 				if ((x & 1) ? _invertOdd : _invertEven)
-					*p ^= 3;
+					*p ^= mask;
 			}
 		}
 
diff --git a/engines/ultima/ultima3/views/journey_onward.cpp b/engines/ultima/ultima3/views/journey_onward.cpp
index c4217c69b07..23cabe15064 100644
--- a/engines/ultima/ultima3/views/journey_onward.cpp
+++ b/engines/ultima/ultima3/views/journey_onward.cpp
@@ -20,6 +20,7 @@
  */
 
 #include "ultima/ultima3/views/journey_onward.h"
+#include "ultima/ultima3/gfx/composite.h"
 #include "ultima/ultima3/ultima3.h"
 
 namespace Ultima {
@@ -36,6 +37,8 @@ void JourneyOnward::draw() {
 		s.writeString(Common::Point(9, 21), "(No Active Players)");
 
 	drawSpacePrompt(s);
+
+	Gfx::compositeFinish(s);
 }
 
 bool JourneyOnward::msgKeypress(const KeypressMessage &msg) {
diff --git a/engines/ultima/ultima3/views/logo_screen.cpp b/engines/ultima/ultima3/views/logo_screen.cpp
index 6135128d1bf..94e3c8b24b2 100644
--- a/engines/ultima/ultima3/views/logo_screen.cpp
+++ b/engines/ultima/ultima3/views/logo_screen.cpp
@@ -21,6 +21,7 @@
 
 #include "common/file.h"
 #include "ultima/ultima3/views/logo_screen.h"
+#include "ultima/ultima3/gfx/composite.h"
 #include "ultima/ultima3/views/menu_input.h"
 #include "ultima/ultima3/ultima3.h"
 
@@ -88,6 +89,8 @@ void LogoScreen::draw() {
 	s.addDirtyRect(Common::Rect(8, 88, 312, 184));
 
 	drawSpacePrompt(s);
+
+	Gfx::compositeFinish(s);
 }
 
 void LogoScreen::timeout() {
diff --git a/engines/ultima/ultima3/views/main_menu.cpp b/engines/ultima/ultima3/views/main_menu.cpp
index 36e23b2c30f..072e9af0d92 100644
--- a/engines/ultima/ultima3/views/main_menu.cpp
+++ b/engines/ultima/ultima3/views/main_menu.cpp
@@ -20,6 +20,7 @@
  */
 
 #include "ultima/ultima3/views/main_menu.h"
+#include "ultima/ultima3/gfx/composite.h"
 #include "ultima/ultima3/ultima3.h"
 
 namespace Ultima {
@@ -55,6 +56,8 @@ void MainMenu::draw() {
 	s.writeString(Common::Point(13, 19), "Journey Onward");
 
 	_choice.draw(s, true);
+
+	Gfx::compositeFinish(s);
 }
 
 bool MainMenu::msgKeypress(const KeypressMessage &msg) {
diff --git a/engines/ultima/ultima3/views/party_menu.cpp b/engines/ultima/ultima3/views/party_menu.cpp
index 0a626cdec67..e633c200d23 100644
--- a/engines/ultima/ultima3/views/party_menu.cpp
+++ b/engines/ultima/ultima3/views/party_menu.cpp
@@ -20,6 +20,7 @@
  */
 
 #include "ultima/ultima3/views/party_menu.h"
+#include "ultima/ultima3/gfx/composite.h"
 
 namespace Ultima {
 namespace Ultima3 {
@@ -57,6 +58,8 @@ void PartyMenu::draw() {
 	s.writeString(Common::Point(15, 21), "Main Menu");
 
 	_choice.draw(s, true);
+
+	Gfx::compositeFinish(s);
 }
 
 bool PartyMenu::msgKeypress(const KeypressMessage &msg) {
diff --git a/engines/ultima/ultima3/views/register.cpp b/engines/ultima/ultima3/views/register.cpp
index 52779ae68ed..d24cca47cad 100644
--- a/engines/ultima/ultima3/views/register.cpp
+++ b/engines/ultima/ultima3/views/register.cpp
@@ -20,6 +20,7 @@
  */
 
 #include "ultima/ultima3/views/register.h"
+#include "ultima/ultima3/gfx/composite.h"
 #include "ultima/ultima3/ultima3.h"
 
 namespace Ultima {
@@ -54,6 +55,8 @@ void Register::draw() {
 	}
 
 	drawSpacePrompt(s);
+
+	Gfx::compositeFinish(s);
 }
 
 bool Register::msgKeypress(const KeypressMessage &msg) {
diff --git a/engines/ultima/ultima3/views/terminate_character.cpp b/engines/ultima/ultima3/views/terminate_character.cpp
index cb9a4d6187f..5fda0d198e0 100644
--- a/engines/ultima/ultima3/views/terminate_character.cpp
+++ b/engines/ultima/ultima3/views/terminate_character.cpp
@@ -20,6 +20,7 @@
  */
 
 #include "ultima/ultima3/views/terminate_character.h"
+#include "ultima/ultima3/gfx/composite.h"
 #include "ultima/ultima3/ultima3.h"
 
 namespace Ultima {
@@ -54,6 +55,8 @@ void TerminateCharacter::draw() {
 		s.writeString(Common::Point(_messageCol, _messageRow), _message);
 		drawSpacePrompt(s);
 	}
+
+	Gfx::compositeFinish(s);
 }
 
 bool TerminateCharacter::msgKeypress(const KeypressMessage &msg) {
diff --git a/engines/ultima/ultima3/views/title.cpp b/engines/ultima/ultima3/views/title.cpp
index 3c8c74d1625..0c18dc98662 100644
--- a/engines/ultima/ultima3/views/title.cpp
+++ b/engines/ultima/ultima3/views/title.cpp
@@ -21,7 +21,9 @@
 
 #include "common/file.h"
 #include "ultima/ultima3/views/title.h"
+#include "ultima/ultima3/gfx/composite.h"
 #include "ultima/ultima3/gfx/pic_decoder.h"
+#include "ultima/ultima3/gfx/pixels.h"
 #include "ultima/ultima3/ultima3.h"
 
 namespace Ultima {
@@ -47,6 +49,12 @@ static const int FLAG_AL_LIMIT[3]    = { 4, -1, 4 }; // -1 stands for the 0FFh b
 static const byte FLAG_BL_LIMIT[3]   = { 0x31, 0x2B, 0x34 };
 static const byte FLAG_INITIAL_AL[3] = { 0, 3, 0 };
 
+// The waving flag picture, and the color of the signature that is drawn in
+// the upgrade's renderers
+constexpr int FLAG_WIDTH = 92;
+constexpr int FLAG_HEIGHT = 16;
+constexpr byte PATH_COLOR_ENHANCED = 0x0B;
+
 constexpr int WAIT_FRAMES_PER_UNIT = 5; // ~waitFrames(1)'s real-hardware duration, approximated
 
 Title::Title() : View("Title") {
@@ -72,12 +80,14 @@ void Title::loadRaw(Common::Array<byte> &data, const Common::String &filename) {
 }
 
 bool Title::msgFocus(const FocusMessage &msg) {
-	loadPic(_portrait, "EXOD.IBM");
+	// The upgrade's renderers have their own versions of the pictures
+	const bool ega = _G(renderMode) == Data::RENDER_EGA, vga = _G(renderMode) == Data::RENDER_VGA;
+	loadPic(_portrait, ega ? "exod.ega" : (vga ? "exod.vga" : "EXOD.IBM"));
 	loadRaw(_nameData, "NAME.DAT");
-	loadRaw(_animateData, "ANIMATE.DAT");
+	loadRaw(_animateData, ega ? "animate.ega" : (vga ? "animate.vga" : "ANIMATE.DAT"));
 
 	_canvas.create(320, 200);
-	loadPic(_canvas, "BLANK.IBM");
+	loadPic(_canvas, ega ? "blank.ega" : (vga ? "blank.vga" : "BLANK.IBM"));
 
 	_phase = PH_BOX1_SPARKLE;
 	_sparklePass = 0;
@@ -97,7 +107,9 @@ bool Title::msgUnfocus(const UnfocusMessage &msg) {
 }
 
 void Title::draw() {
-	getSurface().blitFrom(_canvas);
+	auto s = getSurface();
+	s.blitFrom(_canvas);
+	Gfx::compositeFinish(s);
 }
 
 void Title::drawBox(const TitleBox &box, bool sparkle, int threshold) {
@@ -130,6 +142,11 @@ void Title::drawBox(const TitleBox &box, bool sparkle, int threshold) {
 }
 
 void Title::drawFlagFrame(int bxParam, int axParam) {
+	if (Data::isEnhancedMode(_G(renderMode))) {
+		drawEnhancedFlagFrame(bxParam, axParam);
+		return;
+	}
+
 	int px = ((bxParam * 2 + 20) / 4) * 4;
 	uint32 srcOffset = (uint32)axParam * 1472 + (uint32)(bxParam & 1) * 736;
 	const byte *src = &_animateData[srcOffset];
@@ -154,6 +171,37 @@ void Title::drawFlagFrame(int bxParam, int axParam) {
 	redraw();
 }
 
+void Title::drawEnhancedFlagFrame(int bxParam, int axParam) {
+	// A frame is made of four copies of the picture, each moved a pixel across,
+	// of which the one for where it's drawn is used
+	const bool ega = _G(renderMode) == Data::RENDER_EGA;
+	const int rowBytes = ega ? FLAG_WIDTH / 2 : FLAG_WIDTH;
+	const int copyBytes = FLAG_HEIGHT * rowBytes;
+	int px = bxParam * 2 + 20;
+
+	const byte *src = &_animateData[axParam * 4 * copyBytes + (px & 3) * copyBytes];
+
+	for (int row = 0; row < FLAG_HEIGHT; ++row) {
+		int y = 168 + row;
+		const byte *rowData = src + row * rowBytes;
+		byte pixels[FLAG_WIDTH];
+
+		if (ega)
+			Gfx::unpack4bpp(rowData, pixels, FLAG_WIDTH);
+		else
+			memcpy(pixels, rowData, FLAG_WIDTH);
+
+		for (int dx = -2; dx < 0; ++dx)
+			_canvas.setPixel(px + dx, y, 0);
+		for (int x = 0; x < FLAG_WIDTH; ++x)
+			_canvas.setPixel(px + x, y, pixels[x]);
+		for (int dx = 0; dx < 2; ++dx)
+			_canvas.setPixel(px + FLAG_WIDTH + dx, y, 0);
+	}
+
+	redraw();
+}
+
 bool Title::stepPixelPath() {
 	if (_pixelPathPos + 1 >= _nameData.size())
 		return false;
@@ -165,8 +213,9 @@ bool Title::stepPixelPath() {
 	_pixelPathPos += 2;
 
 	int x = lengthByte + 20, y = 0xC0 - rowByte;
-	_canvas.setPixel(x, y, 3);
-	_canvas.setPixel(x + 1, y, 3);
+	byte color = Data::isEnhancedMode(_G(renderMode)) ? PATH_COLOR_ENHANCED : 3;
+	_canvas.setPixel(x, y, color);
+	_canvas.setPixel(x + 1, y, color);
 
 	redraw();
 	return true;
diff --git a/engines/ultima/ultima3/views/title.h b/engines/ultima/ultima3/views/title.h
index 0df846ad683..1cf626b0046 100644
--- a/engines/ultima/ultima3/views/title.h
+++ b/engines/ultima/ultima3/views/title.h
@@ -106,6 +106,7 @@ private:
 	// One 92x16px flag-flutter frame (drawAnimationFrameRow), plus its
 	// 4px erase margins on each side
 	void drawFlagFrame(int bxParam, int axParam);
+	void drawEnhancedFlagFrame(int bxParam, int axParam);
 
 	// One step of the NAME.DAT signature reveal; returns false once the
 	// terminator is hit
diff --git a/engines/ultima/ultima3/views/window_view.cpp b/engines/ultima/ultima3/views/window_view.cpp
index 585d20fdfa9..6c9ee0ac02a 100644
--- a/engines/ultima/ultima3/views/window_view.cpp
+++ b/engines/ultima/ultima3/views/window_view.cpp
@@ -20,6 +20,8 @@
  */
 
 #include "ultima/ultima3/views/window_view.h"
+#include "ultima/ultima3/gfx/frame.h"
+#include "ultima/ultima3/ultima3.h"
 
 namespace Ultima {
 namespace Ultima3 {
@@ -34,11 +36,18 @@ void WindowView::clearWindow(GfxSurface &s) {
 }
 
 void WindowView::drawBorder(GfxSurface &s) {
-	// Alternating black and magenta pixels, filling whole 8x8 cells
+	if (_G(renderMode) == Data::RENDER_VGA) {
+		s.fillRect(Common::Rect(0, 24 * 8, 320, 25 * 8), 0);
+		Gfx::drawWindowFrame(s);
+		return;
+	}
+
+	// Alternating black and magenta pixels, or solid light blue in EGA, filling whole 8x8 cells
+	const bool ega = _G(renderMode) == Data::RENDER_EGA;
 	auto cell = [&](int col, int row) {
 		for (int y = 0; y < 8; ++y)
 			for (int x = 0; x < 8; ++x)
-				s.setPixel(col * 8 + x, row * 8 + y, (x & 1) ? 2 : 0);
+				s.setPixel(col * 8 + x, row * 8 + y, ega ? Data::EGA_FRAME_COLOR : ((x & 1) ? 2 : 0));
 	};
 
 	s.fillRect(Common::Rect(0, 24 * 8, 320, 25 * 8), 0);
diff --git a/engines/ultima/ultima3/views/window_view.h b/engines/ultima/ultima3/views/window_view.h
index cc70e8c84e3..ae1d1fa0f5d 100644
--- a/engines/ultima/ultima3/views/window_view.h
+++ b/engines/ultima/ultima3/views/window_view.h
@@ -43,7 +43,7 @@ protected:
 	static void clearWindow(GfxSurface &s);
 
 	/**
-	 * Draws the magenta window border
+	 * Draws the window border, which is magenta in the original
 	 */
 	static void drawBorder(GfxSurface &s);
 


Commit: 9fe6d67e917002541064ae1c25f52799b97478ba
    https://github.com/scummvm/scummvm/commit/9fe6d67e917002541064ae1c25f52799b97478ba
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:41:02+11:00

Commit Message:
ULTIMA: ULTIMA3: Added the Upgrade Patch moon phase icons as a game option

Changed paths:
    engines/ultima/detection.h
    engines/ultima/detection_tables.h
    engines/ultima/metaengine.cpp
    engines/ultima/ultima3/console.cpp
    engines/ultima/ultima3/console.h
    engines/ultima/ultima3/gfx/charset.cpp
    engines/ultima/ultima3/gfx/charset.h
    engines/ultima/ultima3/logic/location_logic.cpp
    engines/ultima/ultima3/logic/location_logic.h
    engines/ultima/ultima3/ultima3.cpp
    engines/ultima/ultima3/ultima3.h
    engines/ultima/ultima3/views/game.cpp


diff --git a/engines/ultima/detection.h b/engines/ultima/detection.h
index c644a0505bb..114a6a2d2ad 100644
--- a/engines/ultima/detection.h
+++ b/engines/ultima/detection.h
@@ -83,6 +83,7 @@ struct UltimaGameDescription {
 #define GAMEOPTION_ALWAYS_CHRISTMAS     GUIO_GAMEOPTIONS11
 #define GAMEOPTION_ULTIMA3_MORE_MONSTERS GUIO_GAMEOPTIONS12
 #define GAMEOPTION_ULTIMA3_LESS_HUNGER   GUIO_GAMEOPTIONS13
+#define GAMEOPTION_ULTIMA3_MOON_ICONS    GUIO_GAMEOPTIONS14
 
 } // End of namespace Ultima
 
diff --git a/engines/ultima/detection_tables.h b/engines/ultima/detection_tables.h
index cb7ca98a8d3..59106e253d5 100644
--- a/engines/ultima/detection_tables.h
+++ b/engines/ultima/detection_tables.h
@@ -24,7 +24,7 @@ namespace Ultima {
 #define GUI_OPTIONS_ULTIMA0	GUIO0()
 #define GUI_OPTIONS_ULTIMA1	GUIO0()
 #define GUI_OPTIONS_ULTIMA2	GUIO0()
-#define GUI_OPTIONS_ULTIMA3	GUIO2(GAMEOPTION_ULTIMA3_MORE_MONSTERS, GAMEOPTION_ULTIMA3_LESS_HUNGER)
+#define GUI_OPTIONS_ULTIMA3	GUIO3(GAMEOPTION_ULTIMA3_MORE_MONSTERS, GAMEOPTION_ULTIMA3_LESS_HUNGER, GAMEOPTION_ULTIMA3_MOON_ICONS)
 #define GUI_OPTIONS_ULTIMA4	GUIO1(GUIO_NOSPEECH)
 #define GUI_OPTIONS_ULTIMA6	GUIO0()
 #define GUI_OPTIONS_ULTIMA8	GUIO9(GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FRAME_SKIPPING, GAMEOPTION_FRAME_LIMITING, GAMEOPTION_CHEATS, GAMEOPTION_HIGH_RESOLUTION, GAMEOPTION_FOOTSTEP_SOUNDS, GAMEOPTION_JUMP_TO_MOUSE, GAMEOPTION_FONT_REPLACEMENT, GAMEOPTION_FONT_ANTIALIASING)
diff --git a/engines/ultima/metaengine.cpp b/engines/ultima/metaengine.cpp
index 02653843945..6f5a40756b1 100644
--- a/engines/ultima/metaengine.cpp
+++ b/engines/ultima/metaengine.cpp
@@ -196,6 +196,17 @@ static const ADExtraGuiOptionsMap optionsList[] = {
 			0
 		}
 	},
+	{
+		GAMEOPTION_ULTIMA3_MOON_ICONS,
+		{
+			_s("Show moon phase icons"),
+			_s("Shows the phases of the moons as pictures rather than numbers, as in the Ultima III Upgrade"),
+			"moon_icons",
+			true,
+			0,
+			0
+		}
+	},
 	{
 		GAMEOPTION_ALWAYS_CHRISTMAS,
 		{
diff --git a/engines/ultima/ultima3/console.cpp b/engines/ultima/ultima3/console.cpp
index 82a71dd7e13..644784e2d34 100644
--- a/engines/ultima/ultima3/console.cpp
+++ b/engines/ultima/ultima3/console.cpp
@@ -51,6 +51,7 @@ Console::Console() : GUI::Debugger() {
 	registerCmd("load", WRAP_METHOD(Console, cmdLoad));
 	registerCmd("save", WRAP_METHOD(Console, cmdSave));
 	registerCmd("exodus", WRAP_METHOD(Console, cmdExodus));
+	registerCmd("moon", WRAP_METHOD(Console, cmdMoon));
 }
 
 Console::~Console() {
@@ -174,6 +175,37 @@ bool Console::cmdExodus(int argc, const char **argv) {
 	return false;
 }
 
+bool Console::cmdMoon(int argc, const char **argv) {
+	if (argc > 3) {
+		debugPrintf("moon [<left phase 0-7> [<right phase 0-7>]]\n");
+		return true;
+	}
+
+	ensureGame();
+	Data::Savegame &sg = _G(savegame);
+
+	// Without any phase both moons move on to the next, otherwise only those given change
+	int phases[2] = { sg._moonPhase[0], sg._moonPhase[1] };
+	if (argc == 1) {
+		++phases[0];
+		++phases[1];
+	}
+
+	for (int i = 0; i < argc - 1; ++i) {
+		phases[i] = atoi(argv[i + 1]);
+		if (phases[i] < 0 || phases[i] > 7) {
+			debugPrintf("Moon phases must be between 0 and 7\n");
+			return true;
+		}
+	}
+
+	LocationLogic().setMoonPhases(phases[0], phases[1]);
+
+	g_engine->focusedView()->redraw();
+	debugPrintf("Moon phases are now %d and %d\n", sg._moonPhase[0], sg._moonPhase[1]);
+	return true;
+}
+
 bool Console::cmdTiles(int argc, const char **argv) {
 	Graphics::ManagedSurface surface(Gfx::SHAPE_SIZE, Gfx::SHAPE_SIZE, Graphics::PixelFormat::createFormatCLUT8());
 
diff --git a/engines/ultima/ultima3/console.h b/engines/ultima/ultima3/console.h
index fe066323ac0..a54bd1daea0 100644
--- a/engines/ultima/ultima3/console.h
+++ b/engines/ultima/ultima3/console.h
@@ -61,6 +61,7 @@ private:
 	bool cmdLoad(int argc, const char **argv);
 	bool cmdSave(int argc, const char **argv);
 	bool cmdExodus(int argc, const char **argv);
+	bool cmdMoon(int argc, const char **argv);
 
 public:
 	Console();
diff --git a/engines/ultima/ultima3/gfx/charset.cpp b/engines/ultima/ultima3/gfx/charset.cpp
index 2bd1ccac41d..d32cb4202c6 100644
--- a/engines/ultima/ultima3/gfx/charset.cpp
+++ b/engines/ultima/ultima3/gfx/charset.cpp
@@ -32,42 +32,65 @@ constexpr int CGA_GLYPH_BYTES = 16;
 
 byte CharSet::_data[CHARSET_GLYPHS * CHARSET_GLYPH_PIXELS];
 
-void CharSet::load() {
+// Reads a file of a number of glyphs into the pixels given
+static void loadGlyphs(const char *filename, byte *dest, int count) {
 	Common::File f;
 
 	switch (_G(renderMode)) {
 	case Data::RENDER_EGA: {
 		byte data[CHARSET_GLYPHS * CHARSET_GLYPH_PIXELS / 2];
-		if (!f.open("charset.ega") || f.read(data, sizeof(data)) != sizeof(data))
-			error("Could not load charset.ega");
+		if (!f.open(filename) || f.read(data, count * CHARSET_GLYPH_PIXELS / 2) != (uint)(count * CHARSET_GLYPH_PIXELS / 2))
+			error("Could not load %s", filename);
 
-		unpack4bpp(data, _data, sizeof(_data));
+		unpack4bpp(data, dest, count * CHARSET_GLYPH_PIXELS);
 		break;
 	}
 
 	case Data::RENDER_VGA:
-		if (!f.open("charset.vga") || f.read(_data, sizeof(_data)) != sizeof(_data))
-			error("Could not load charset.vga");
+		if (!f.open(filename) || f.read(dest, count * CHARSET_GLYPH_PIXELS) != (uint)(count * CHARSET_GLYPH_PIXELS))
+			error("Could not load %s", filename);
 		break;
 
 	default: {
 		byte data[CHARSET_GLYPHS * CGA_GLYPH_BYTES];
-		if (!f.open("CHARSET.ULT") || f.read(data, sizeof(data)) != sizeof(data))
-			error("Could not load CHARSET.ULT");
+		if (!f.open(filename) || f.read(data, count * CGA_GLYPH_BYTES) != (uint)(count * CGA_GLYPH_BYTES))
+			error("Could not load %s", filename);
 
 		// The first 8 bytes of a glyph hold the even scanlines and the next 8 the odd
 		// ones, 2 bytes (8 pixels) per scanline
-		for (int chr = 0; chr < CHARSET_GLYPHS; ++chr) {
+		for (int chr = 0; chr < count; ++chr) {
 			const byte *glyph = &data[chr * CGA_GLYPH_BYTES];
 
 			for (int y = 0; y < 8; ++y)
-				unpack2bpp(glyph + (y & 1) * 8 + (y >> 1) * 2, &_data[chr * CHARSET_GLYPH_PIXELS + y * 8], 8);
+				unpack2bpp(glyph + (y & 1) * 8 + (y >> 1) * 2, &dest[chr * CHARSET_GLYPH_PIXELS + y * 8], 8);
 		}
 		break;
 	}
 	}
 }
 
+void CharSet::load() {
+	const char *charset, *moons;
+
+	switch (_G(renderMode)) {
+	case Data::RENDER_EGA:
+		charset = "charset.ega";
+		moons = "moons.ega";
+		break;
+	case Data::RENDER_VGA:
+		charset = "charset.vga";
+		moons = "moons.vga";
+		break;
+	default:
+		charset = "CHARSET.ULT";
+		moons = "moons.ult";
+		break;
+	}
+
+	loadGlyphs(charset, _data, CHARSET_TEXT_GLYPHS);
+	loadGlyphs(moons, &_data[CHARSET_TEXT_GLYPHS * CHARSET_GLYPH_PIXELS], CHARSET_MOON_GLYPHS);
+}
+
 void CharSet::drawChar(Graphics::Surface *dst, uint32 chr, int x, int y, uint32 color) const {
 	if (chr >= CHARSET_GLYPHS)
 		return;
diff --git a/engines/ultima/ultima3/gfx/charset.h b/engines/ultima/ultima3/gfx/charset.h
index f76823472e4..4b354d8be0d 100644
--- a/engines/ultima/ultima3/gfx/charset.h
+++ b/engines/ultima/ultima3/gfx/charset.h
@@ -29,13 +29,16 @@ namespace Ultima {
 namespace Ultima3 {
 namespace Gfx {
 
-constexpr int CHARSET_GLYPHS = 128;
+constexpr int CHARSET_TEXT_GLYPHS = 128;
+constexpr int CHARSET_MOON_GLYPHS = 8;
+constexpr int CHARSET_GLYPHS = CHARSET_TEXT_GLYPHS + CHARSET_MOON_GLYPHS;
 constexpr int CHARSET_GLYPH_PIXELS = 8 * 8;
 
 /**
  * The game's font from CHARSET.ULT: 128 glyphs of 8x8 pixels at 2 bits per
  * pixel, or from the upgrade's EGA or VGA files, depending on the renderer.
- * Each glyph carries its own colors, and is kept a byte per pixel.
+ * Each glyph carries its own colors, and is kept a byte per pixel. The moon
+ * icons of the upgrade follow the text characters.
  */
 class CharSet : public Graphics::Font {
 private:
@@ -44,6 +47,13 @@ private:
 public:
 	static void load();
 
+	/**
+	 * Returns the character that is drawn as the icon for a phase of a moon
+	 */
+	static uint32 moonIcon(byte phase) {
+		return CHARSET_TEXT_GLYPHS + ((phase - 1) & (CHARSET_MOON_GLYPHS - 1));
+	}
+
 public:
 	/**
 	 * Return the height of the font.
diff --git a/engines/ultima/ultima3/logic/location_logic.cpp b/engines/ultima/ultima3/logic/location_logic.cpp
index e23ec774ed3..3d9411e0cfa 100644
--- a/engines/ultima/ultima3/logic/location_logic.cpp
+++ b/engines/ultima/ultima3/logic/location_logic.cpp
@@ -306,6 +306,27 @@ void LocationLogic::updateMoons() {
 		_G(map).setCell(DAWN_X, DAWN_Y, CELL_FOREST);
 }
 
+void LocationLogic::setMoonPhases(byte left, byte right) {
+	Data::Savegame &save = _G(savegame);
+	save._moonPhase[0] = left & 7;
+	save._moonPhase[1] = right & 7;
+
+	// The world map is only there to change when it is where the party is
+	if (save._location != Data::LOCATION_SOSARIA)
+		return;
+
+	for (int i = 0; i < 8; ++i) {
+		if (_G(map).cell(GATE_X[i], GATE_Y[i]) == CELL_MOON_GATE)
+			_G(map).setCell(GATE_X[i], GATE_Y[i], CELL_GRASS);
+	}
+	_G(map).setCell(GATE_X[save._moonPhase[0]], GATE_Y[save._moonPhase[0]], CELL_MOON_GATE);
+
+	if ((save._moonPhase[0] & save._moonPhase[1]) == 7)
+		_G(map).setCell(DAWN_X, DAWN_Y, CELL_TOWN);
+	else if ((save._moonPhase[0] | save._moonPhase[1]) == 0)
+		_G(map).setCell(DAWN_X, DAWN_Y, CELL_FOREST);
+}
+
 bool LocationLogic::isOnMoonGate() const {
 	const Data::Savegame &save = _G(savegame);
 	return _G(map).cell(save._posX, save._posY) == CELL_MOON_GATE;
diff --git a/engines/ultima/ultima3/logic/location_logic.h b/engines/ultima/ultima3/logic/location_logic.h
index 11d51d9af1a..5afaec040a9 100644
--- a/engines/ultima/ultima3/logic/location_logic.h
+++ b/engines/ultima/ultima3/logic/location_logic.h
@@ -79,6 +79,11 @@ public:
 	 */
 	void updateMoons();
 
+	/**
+	 * Puts the moons in the given phases, and the moon gate and Dawn where they say
+	 */
+	void setMoonPhases(byte left, byte right);
+
 	bool isOnMoonGate() const;
 
 	/**
diff --git a/engines/ultima/ultima3/ultima3.cpp b/engines/ultima/ultima3/ultima3.cpp
index 7cc446773ca..501d8a70934 100644
--- a/engines/ultima/ultima3/ultima3.cpp
+++ b/engines/ultima/ultima3/ultima3.cpp
@@ -54,6 +54,7 @@ Ultima3Engine::Ultima3Engine(OSystem *syst, const Ultima::UltimaGameDescription
 	_pcSpeaker = new Audio::PCSpeaker();
 	_moreMonsters = ConfMan.getBool("more_monsters");
 	_lessHunger = ConfMan.getBool("less_hunger");
+	_moonIcons = ConfMan.getBool("moon_icons");
 	_renderMode = configuredRenderMode();
 }
 
@@ -103,6 +104,7 @@ Common::Error Ultima3Engine::run() {
 void Ultima3Engine::applyGameSettings() {
 	_moreMonsters = ConfMan.getBool("more_monsters");
 	_lessHunger = ConfMan.getBool("less_hunger");
+	_moonIcons = ConfMan.getBool("moon_icons");
 
 	// The renderer can be changed from the game options dialog
 	Data::RenderMode mode = configuredRenderMode();
diff --git a/engines/ultima/ultima3/ultima3.h b/engines/ultima/ultima3/ultima3.h
index 4b675622f87..d7c506ff6f5 100644
--- a/engines/ultima/ultima3/ultima3.h
+++ b/engines/ultima/ultima3/ultima3.h
@@ -129,6 +129,7 @@ public:
 	// the monster generation and food rates
 	bool _moreMonsters = false;
 	bool _lessHunger = false;
+	bool _moonIcons = true;
 
 	// Which of the upgrade's renderers is in use
 	Data::RenderMode _renderMode = Data::RENDER_CGA;
diff --git a/engines/ultima/ultima3/views/game.cpp b/engines/ultima/ultima3/views/game.cpp
index c33e27641cc..98f6d5a1696 100644
--- a/engines/ultima/ultima3/views/game.cpp
+++ b/engines/ultima/ultima3/views/game.cpp
@@ -20,6 +20,7 @@
  */
 
 #include "ultima/ultima3/views/game.h"
+#include "ultima/ultima3/gfx/charset.h"
 #include "ultima/ultima3/gfx/composite.h"
 #include "ultima/ultima3/gfx/frame.h"
 #include "ultima/ultima3/views/menu_input.h"
@@ -275,8 +276,18 @@ void Game::drawLabels(GfxSurface &s) {
 void Game::drawMoons(GfxSurface &s) {
 	const Data::Savegame &save = _G(savegame);
 
-	s.writeString(Common::Point(8, 0), Common::String::format("%c(%X)(%X)%c", GLYPH_LABEL_START,
-		save._moonPhase[0], save._moonPhase[1], GLYPH_LABEL_END));
+	if (!g_engine->_moonIcons) {
+		s.writeString(Common::Point(8, 0), Common::String::format("%c(%X)(%X)%c", GLYPH_LABEL_START,
+			save._moonPhase[0], save._moonPhase[1], GLYPH_LABEL_END));
+		return;
+	}
+
+	// The phases are pictures rather than digits, which are past the text characters
+	s.writeString(Common::Point(8, 0), Common::String::format("%c(", GLYPH_LABEL_START));
+	s.writeChar(Gfx::CharSet::moonIcon(save._moonPhase[0]));
+	s.writeString(")(");
+	s.writeChar(Gfx::CharSet::moonIcon(save._moonPhase[1]));
+	s.writeString(Common::String::format(")%c", GLYPH_LABEL_END));
 }
 
 void Game::drawWind(GfxSurface &s) {


Commit: 58ba1ff5f31ecc91dc147644f43532d89ce30cc4
    https://github.com/scummvm/scummvm/commit/58ba1ff5f31ecc91dc147644f43532d89ce30cc4
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:41:02+11:00

Commit Message:
ULTIMA: ULTIMA3: Added enhanced detection entry for U3 & U2

This turns on all the enhancement options by default.

Changed paths:
    engines/ultima/detection.h
    engines/ultima/detection_tables.h
    engines/ultima/metaengine.cpp
    engines/ultima/nuvie/nuvie.cpp
    engines/ultima/shared/engine/graphics_options.cpp
    engines/ultima/shared/engine/graphics_options.h
    engines/ultima/ultima2/ultima2.cpp
    engines/ultima/ultima3/ultima3.cpp
    engines/ultima/ultima3/ultima3.h
    engines/ultima/ultima4/ultima4.cpp


diff --git a/engines/ultima/detection.h b/engines/ultima/detection.h
index 114a6a2d2ad..895f31b76ae 100644
--- a/engines/ultima/detection.h
+++ b/engines/ultima/detection.h
@@ -46,7 +46,7 @@ enum GameId {
 };
 
 enum UltimaGameFeatures {
-	GF_VGA_ENHANCED = 1 << 0
+	GF_ENHANCED = 1 << 0
 };
 
 // Custom game detector flags used by Ultima engines
diff --git a/engines/ultima/detection_tables.h b/engines/ultima/detection_tables.h
index 59106e253d5..58d35f57bf5 100644
--- a/engines/ultima/detection_tables.h
+++ b/engines/ultima/detection_tables.h
@@ -38,7 +38,7 @@ namespace Ultima {
 #define ENTRY_ULTIMA6_NORMAL(FILENAME, MD5, FILESIZE, LANG, PLATFORM) {{"ultima6", 0, AD_ENTRY1s(FILENAME, MD5, FILESIZE), LANG, PLATFORM, ADGF_NO_FLAGS, GUI_OPTIONS_ULTIMA6}, GAME_ULTIMA6, 0}
 
 // Ultima 6 enhanced mode only
-#define ENTRY_ULTIMA6_ENHANCED(FILENAME, MD5, FILESIZE, LANG, PLATFORM) {{"ultima6_enh", 0, AD_ENTRY1s(FILENAME, MD5, FILESIZE), LANG, PLATFORM, ADGF_NO_FLAGS, GUI_OPTIONS_ULTIMA6}, GAME_ULTIMA6, GF_VGA_ENHANCED}
+#define ENTRY_ULTIMA6_ENHANCED(FILENAME, MD5, FILESIZE, LANG, PLATFORM) {{"ultima6_enh", 0, AD_ENTRY1s(FILENAME, MD5, FILESIZE), LANG, PLATFORM, ADGF_NO_FLAGS, GUI_OPTIONS_ULTIMA6}, GAME_ULTIMA6, GF_ENHANCED}
 
 // Ultima 6 both normal and enhanced mode (this should normally be used)
 #define ENTRY_ULTIMA6(FILENAME, MD5, FILESIZE, LANG, PLATFORM) \
@@ -52,7 +52,9 @@ static const PlainGameDescriptor ULTIMA_GAMES[] = {
 	{ "akalabeth", "Akalabeth: World of Doom" },
 	{ "ultima1", "Ultima I: The First Age of Darkness" },
 	{ "ultima2", "Ultima II: Revenge of the Enchantress" },
+	{ "ultima2_enh", "Ultima II: Revenge of the Enchantress - Enhanced" },
 	{ "ultima3", "Ultima III: Exodus" },
+	{ "ultima3_enh", "Ultima III: Exodus - Enhanced" },
 	{ "ultima4", "Ultima IV: Quest of the Avatar" },
 	{ "ultima4_enh", "Ultima IV: Quest of the Avatar - Enhanced" },
 	{ "ultima6", "Ultima VI: The False Prophet" },
@@ -101,7 +103,7 @@ static const UltimaGameDescription GAME_DESCRIPTIONS[] = {
 			GUI_OPTIONS_ULTIMA1
 		},
 		GAME_ULTIMA1,
-		GF_VGA_ENHANCED
+		GF_ENHANCED
 	},
 
 	{
@@ -150,6 +152,21 @@ static const UltimaGameDescription GAME_DESCRIPTIONS[] = {
 		0
 	},
 
+	{
+		// Ultima II - Revenge of the Enchantress - Enhanced
+		{
+			"ultima2_enh",
+			0,
+			AD_ENTRY1s("monsters", "29160ad200758650d8a4a6af2474d075", 2176),
+			Common::EN_ANY,
+			Common::kPlatformDOS,
+			ADGF_UNSTABLE,
+			GUI_OPTIONS_ULTIMA2
+		},
+		GAME_ULTIMA2,
+		GF_ENHANCED
+	},
+
 	{
 		// Ultima III - Exodus
 		{
@@ -165,6 +182,21 @@ static const UltimaGameDescription GAME_DESCRIPTIONS[] = {
 		0
 	},
 
+	{
+		// Ultima III - Exodus - Enhanced
+		{
+			"ultima3_enh",
+			0,
+			AD_ENTRY1s("exod.ibm", "525bbaf8dd45a9bf737852f7719ae864", 16384),
+			Common::EN_ANY,
+			Common::kPlatformDOS,
+			ADGF_UNSTABLE,
+			GUI_OPTIONS_ULTIMA3
+		},
+		GAME_ULTIMA3,
+		GF_ENHANCED
+	},
+
 	{
 		// Ultima IV - Quest of the Avatar
 		{
@@ -192,7 +224,7 @@ static const UltimaGameDescription GAME_DESCRIPTIONS[] = {
 			GUI_OPTIONS_ULTIMA4
 		},
 		GAME_ULTIMA4,
-		GF_VGA_ENHANCED
+		GF_ENHANCED
 	},
 
 	{
@@ -222,7 +254,7 @@ static const UltimaGameDescription GAME_DESCRIPTIONS[] = {
 			GUI_OPTIONS_ULTIMA4
 		},
 		GAME_ULTIMA4,
-		GF_VGA_ENHANCED
+		GF_ENHANCED
 	},
 
 	// GOG Ultima VI
@@ -689,7 +721,7 @@ static const UltimaGameDescription GAME_DESCRIPTIONS[] = {
 			GUI_OPTIONS_MARTIAN_DREAMS
 		},
 		GAME_MARTIAN_DREAMS,
-		GF_VGA_ENHANCED
+		GF_ENHANCED
 	},
 	// Martian Dreams - Enhanced V1.4 VGA - Time saving installation (available on GOG)
 	{
@@ -707,7 +739,7 @@ static const UltimaGameDescription GAME_DESCRIPTIONS[] = {
 			GUI_OPTIONS_MARTIAN_DREAMS
 		},
 		GAME_MARTIAN_DREAMS,
-		GF_VGA_ENHANCED
+		GF_ENHANCED
 	},
 
 	// REMARK: SE can have many versions, so the detection is a bit tricky:
@@ -821,7 +853,7 @@ static const UltimaGameDescription GAME_DESCRIPTIONS[] = {
 			GUI_OPTIONS_SAVAGE_EMPIRE
 		},
 		GAME_SAVAGE_EMPIRE,
-		GF_VGA_ENHANCED
+		GF_ENHANCED
 	},
 	// The Savage Empire v1.6 VGA - Time saving installation
 	{
@@ -840,7 +872,7 @@ static const UltimaGameDescription GAME_DESCRIPTIONS[] = {
 			GUI_OPTIONS_SAVAGE_EMPIRE
 		},
 		GAME_SAVAGE_EMPIRE,
-		GF_VGA_ENHANCED
+		GF_ENHANCED
 	},
 
 	// REMARK: The next 4 versions are unsupported!
@@ -943,7 +975,7 @@ static const UltimaGameDescription GAME_DESCRIPTIONS[] = {
 			GUI_OPTIONS_SAVAGE_EMPIRE
 		},
 		GAME_SAVAGE_EMPIRE,
-		GF_VGA_ENHANCED
+		GF_ENHANCED
 	},
 	// The Savage Empire v2.1 VGA - Time saving installation
 	{
@@ -962,7 +994,7 @@ static const UltimaGameDescription GAME_DESCRIPTIONS[] = {
 			GUI_OPTIONS_SAVAGE_EMPIRE
 		},
 		GAME_SAVAGE_EMPIRE,
-		GF_VGA_ENHANCED
+		GF_ENHANCED
 	},
 
 	{ AD_TABLE_END_MARKER, (GameId)0, 0 }
diff --git a/engines/ultima/metaengine.cpp b/engines/ultima/metaengine.cpp
index 6f5a40756b1..a3ce9bb6441 100644
--- a/engines/ultima/metaengine.cpp
+++ b/engines/ultima/metaengine.cpp
@@ -232,15 +232,30 @@ const ADExtraGuiOptionsMap *UltimaMetaEngine::getAdvancedExtraGuiOptions() const
 GUI::OptionsContainerWidget *UltimaMetaEngine::buildEngineOptionsWidget(GUI::GuiObject *boss,
 		const Common::String &name, const Common::String &target) const {
 #ifdef ENABLE_ULTIMA2
-	if (getGameId(target) == "ultima2")
+	if (getGameId(target) == "ultima2" || getGameId(target) == "ultima2_enh") {
+		// The enhanced version starts off using the best of the graphics
+		const bool enhanced = getGameId(target) == "ultima2_enh";
 		return new Ultima::Shared::GraphicsOptionsWidget(boss, name, target,
-			Ultima::Ultima2::Data::RENDER_MODE_LABELS, Ultima::Ultima2::Data::RENDER_MODE_COUNT);
+			Ultima::Ultima2::Data::RENDER_MODE_LABELS, Ultima::Ultima2::Data::RENDER_MODE_COUNT,
+			ExtraGuiOptions(), true,
+			enhanced ? Ultima::Ultima2::Data::RENDER_EGA : Ultima::Ultima2::Data::RENDER_CGA);
+	}
 #endif
 #ifdef ENABLE_ULTIMA3
-	if (getGameId(target) == "ultima3")
+	if (getGameId(target) == "ultima3" || getGameId(target) == "ultima3_enh") {
+		// The enhanced version starts off with all the options on, and the best graphics
+		const bool enhanced = getGameId(target) == "ultima3_enh";
+		ExtraGuiOptions options = getExtraGuiOptions(target);
+		if (enhanced) {
+			for (uint i = 0; i < options.size(); ++i)
+				options[i].defaultState = true;
+		}
+
 		return new Ultima::Shared::GraphicsOptionsWidget(boss, name, target,
 			Ultima::Ultima3::Data::RENDER_MODE_LABELS, Ultima::Ultima3::Data::RENDER_MODE_COUNT,
-			getExtraGuiOptions(target), false);
+			options, false,
+			enhanced ? Ultima::Ultima3::Data::RENDER_VGA : Ultima::Ultima3::Data::RENDER_CGA);
+	}
 #endif
 
 	return AdvancedMetaEngine::buildEngineOptionsWidget(boss, name, target);
@@ -341,11 +356,11 @@ Common::KeymapArray UltimaMetaEngine::initKeymaps(const char *target) const {
 		return Ultima::Ultima1::MetaEngine::initKeymaps();
 #endif
 #ifdef ENABLE_ULTIMA2
-	if (gameId == "ultima2")
+	if (gameId == "ultima2" || gameId == "ultima2_enh")
 		return Ultima::Ultima2::MetaEngine::initKeymaps();
 #endif
 #ifdef ENABLE_ULTIMA3
-	if (gameId == "ultima3")
+	if (gameId == "ultima3" || gameId == "ultima3_enh")
 		return Ultima::Ultima3::MetaEngine::initKeymaps();
 #endif
 #ifdef ENABLE_ULTIMA4
diff --git a/engines/ultima/nuvie/nuvie.cpp b/engines/ultima/nuvie/nuvie.cpp
index 9a35ad36863..edda1b34b7a 100644
--- a/engines/ultima/nuvie/nuvie.cpp
+++ b/engines/ultima/nuvie/nuvie.cpp
@@ -76,7 +76,7 @@ GameId NuvieEngine::getGameId() const {
 }
 
 bool NuvieEngine::isEnhanced() const {
-	return _gameDescription->features & GF_VGA_ENHANCED;
+	return _gameDescription->features & GF_ENHANCED;
 }
 
 bool NuvieEngine::initialize() {
diff --git a/engines/ultima/shared/engine/graphics_options.cpp b/engines/ultima/shared/engine/graphics_options.cpp
index 3251fbdc454..a039c1e4428 100644
--- a/engines/ultima/shared/engine/graphics_options.cpp
+++ b/engines/ultima/shared/engine/graphics_options.cpp
@@ -28,11 +28,21 @@
 namespace Ultima {
 namespace Shared {
 
+int configuredGraphicsMode(int defaultMode) {
+	const Common::String domain = ConfMan.getActiveDomainName();
+	return ConfMan.hasKey(GRAPHICS_MODE_KEY, domain) ? ConfMan.getInt(GRAPHICS_MODE_KEY, domain) : defaultMode;
+}
+
+bool configuredOption(const char *key, bool defaultState) {
+	const Common::String domain = ConfMan.getActiveDomainName();
+	return ConfMan.hasKey(key, domain) ? ConfMan.getBool(key, domain) : defaultState;
+}
+
 GraphicsOptionsWidget::GraphicsOptionsWidget(GUI::GuiObject *boss, const Common::String &name,
 		const Common::String &domain, const char *const *modes, int modeCount,
-		const ExtraGuiOptions &options, bool onTitleScreen) :
+		const ExtraGuiOptions &options, bool onTitleScreen, int defaultMode) :
 		GUI::OptionsContainerWidget(boss, name, "UltimaGraphicsOptionsDialog", domain),
-		_modes(modes), _modeCount(modeCount), _options(options) {
+		_modes(modes), _modeCount(modeCount), _options(options), _defaultMode(defaultMode) {
 	const Common::U32String tooltip = onTitleScreen ?
 		_("Which of the game's renderers to use. This can also be changed from the game's title screen.") :
 		_("Which of the game's renderers to use.");
@@ -54,12 +64,12 @@ GraphicsOptionsWidget::GraphicsOptionsWidget(GUI::GuiObject *boss, const Common:
 }
 
 void GraphicsOptionsWidget::load() {
-	// A missing or stale value means the original graphics
-	int mode = 0;
+	// A missing or stale value means the game's default graphics
+	int mode = _defaultMode;
 	if (ConfMan.hasKey(GRAPHICS_MODE_KEY, _domain))
 		mode = ConfMan.getInt(GRAPHICS_MODE_KEY, _domain);
 	if (mode < 0 || mode >= _modeCount)
-		mode = 0;
+		mode = _defaultMode;
 
 	_modePopUp->setSelectedTag(mode);
 
diff --git a/engines/ultima/shared/engine/graphics_options.h b/engines/ultima/shared/engine/graphics_options.h
index fb76f660432..26af85ac939 100644
--- a/engines/ultima/shared/engine/graphics_options.h
+++ b/engines/ultima/shared/engine/graphics_options.h
@@ -39,6 +39,18 @@ namespace Shared {
  */
 constexpr const char *GRAPHICS_MODE_KEY = "graphics_mode";
 
+/**
+ * Returns the graphics mode of the game being run, or the given one if it
+ * has never been chosen. Enhanced versions of games default to a better one
+ */
+extern int configuredGraphicsMode(int defaultMode);
+
+/**
+ * Returns a checkbox option of the game being run, or the given state if it
+ * has never been set. Enhanced versions of games default to having them on
+ */
+extern bool configuredOption(const char *key, bool defaultState);
+
 /**
  * Game options widget with a drop-down for picking the graphics mode. It's
  * given the (untranslated, marked with _s) labels of the game's modes, in
@@ -53,6 +65,7 @@ private:
 	int _modeCount;
 	GUI::PopUpWidget *_modePopUp;
 	ExtraGuiOptions _options;
+	int _defaultMode;
 	Common::Array<GUI::CheckboxWidget *> _checkboxes;
 
 protected:
@@ -67,10 +80,12 @@ public:
 	 * @param modeCount			How many modes there are
 	 * @param options			The game's other options to show
 	 * @param onTitleScreen		True if the mode can be changed from the game's title screen
+	 * @param defaultMode		The mode that's selected until one has been chosen
 	 */
 	GraphicsOptionsWidget(GUI::GuiObject *boss, const Common::String &name,
 		const Common::String &domain, const char *const *modes, int modeCount,
-		const ExtraGuiOptions &options = ExtraGuiOptions(), bool onTitleScreen = true);
+		const ExtraGuiOptions &options = ExtraGuiOptions(), bool onTitleScreen = true,
+		int defaultMode = 0);
 	~GraphicsOptionsWidget() override {
 	}
 
diff --git a/engines/ultima/ultima2/ultima2.cpp b/engines/ultima/ultima2/ultima2.cpp
index c302b2b7c25..09647600508 100644
--- a/engines/ultima/ultima2/ultima2.cpp
+++ b/engines/ultima/ultima2/ultima2.cpp
@@ -59,12 +59,13 @@ Common::String Ultima2Engine::getGameId() const {
 	return _gameDescription->desc.gameId;
 }
 
-// The graphics renderer mode stored in the configuration, falling back
-// to the original CGA look if it's missing or stale
-static Data::RenderMode configuredRenderMode() {
-	int mode = ConfMan.getInt(Shared::GRAPHICS_MODE_KEY);
+// The graphics renderer mode stored in the configuration, falling back to
+// the default for the version of the game if it's missing or stale
+static Data::RenderMode configuredRenderMode(bool enhanced) {
+	const Data::RenderMode defaultMode = enhanced ? Data::RENDER_EGA : Data::RENDER_CGA;
+	int mode = Shared::configuredGraphicsMode(defaultMode);
 	return (mode >= 0 && mode < Data::RENDER_MODE_COUNT) ?
-		(Data::RenderMode)mode : Data::RENDER_CGA;
+		(Data::RenderMode)mode : defaultMode;
 }
 
 Common::Error Ultima2Engine::run() {
@@ -91,7 +92,7 @@ Common::Error Ultima2Engine::run() {
 	}
 
 	// Restore the player's preferred renderer
-	_renderMode = configuredRenderMode();
+	_renderMode = configuredRenderMode((_gameDescription->features & GF_ENHANCED) != 0);
 
 	// Set the palette now that the engine data is available, since the
 	// composite renderer's colors come from a file in it
@@ -251,7 +252,7 @@ void Ultima2Engine::playFX(Data::SoundEffect fx) {
 
 void Ultima2Engine::applyGameSettings() {
 	// The graphics mode can be changed from the in-game options dialog
-	setRenderMode(configuredRenderMode());
+	setRenderMode(configuredRenderMode((_gameDescription->features & GF_ENHANCED) != 0));
 }
 
 void Ultima2Engine::setRenderMode(Data::RenderMode mode) {
diff --git a/engines/ultima/ultima3/ultima3.cpp b/engines/ultima/ultima3/ultima3.cpp
index 501d8a70934..44557c6f330 100644
--- a/engines/ultima/ultima3/ultima3.cpp
+++ b/engines/ultima/ultima3/ultima3.cpp
@@ -41,21 +41,32 @@ namespace Ultima3 {
 
 Ultima3Engine *g_engine;
 
-// The renderer stored in the configuration, falling back to the original CGA
-// graphics if it's missing or stale
-static Data::RenderMode configuredRenderMode() {
-	int mode = ConfMan.getInt(Shared::GRAPHICS_MODE_KEY);
-	return (mode >= 0 && mode < Data::RENDER_MODE_COUNT) ? (Data::RenderMode)mode : Data::RENDER_CGA;
+// The renderer stored in the configuration, falling back to the default one
+// for the version of the game if it's missing or stale
+static Data::RenderMode configuredRenderMode(bool enhanced) {
+	const Data::RenderMode defaultMode = enhanced ? Data::RENDER_VGA : Data::RENDER_CGA;
+	int mode = Shared::configuredGraphicsMode(defaultMode);
+	return (mode >= 0 && mode < Data::RENDER_MODE_COUNT) ? (Data::RenderMode)mode : defaultMode;
 }
 
 Ultima3Engine::Ultima3Engine(OSystem *syst, const Ultima::UltimaGameDescription *gameDesc) :
 		Engine(syst), Shared::Events("ultima3"), _gameDescription(gameDesc) {
 	g_engine = this;
 	_pcSpeaker = new Audio::PCSpeaker();
-	_moreMonsters = ConfMan.getBool("more_monsters");
-	_lessHunger = ConfMan.getBool("less_hunger");
-	_moonIcons = ConfMan.getBool("moon_icons");
-	_renderMode = configuredRenderMode();
+	loadOptions();
+	_renderMode = configuredRenderMode(isEnhanced());
+}
+
+bool Ultima3Engine::isEnhanced() const {
+	return (_gameDescription->features & GF_ENHANCED) != 0;
+}
+
+void Ultima3Engine::loadOptions() {
+	const bool enhanced = isEnhanced();
+
+	_moreMonsters = Shared::configuredOption("more_monsters", enhanced);
+	_lessHunger = Shared::configuredOption("less_hunger", enhanced);
+	_moonIcons = Shared::configuredOption("moon_icons", true);
 }
 
 Ultima3Engine::~Ultima3Engine() {
@@ -102,12 +113,10 @@ Common::Error Ultima3Engine::run() {
 }
 
 void Ultima3Engine::applyGameSettings() {
-	_moreMonsters = ConfMan.getBool("more_monsters");
-	_lessHunger = ConfMan.getBool("less_hunger");
-	_moonIcons = ConfMan.getBool("moon_icons");
+	loadOptions();
 
 	// The renderer can be changed from the game options dialog
-	Data::RenderMode mode = configuredRenderMode();
+	Data::RenderMode mode = configuredRenderMode(isEnhanced());
 	if (mode == _renderMode)
 		return;
 
diff --git a/engines/ultima/ultima3/ultima3.h b/engines/ultima/ultima3/ultima3.h
index d7c506ff6f5..3d77372c822 100644
--- a/engines/ultima/ultima3/ultima3.h
+++ b/engines/ultima/ultima3/ultima3.h
@@ -57,6 +57,16 @@ class Ultima3Engine : public Engine, public Shared::Events {
 private:
 	const Ultima::UltimaGameDescription *_gameDescription;
 
+	/**
+	 * Returns true for the entry that has the Ultima III Upgrade's changes on by default
+	 */
+	bool isEnhanced() const;
+
+	/**
+	 * Reads the game options
+	 */
+	void loadOptions();
+
 protected:
 	// Engine APIs
 	Common::Error run() override;
diff --git a/engines/ultima/ultima4/ultima4.cpp b/engines/ultima/ultima4/ultima4.cpp
index 7586cb5e1f9..55ee83e64a0 100644
--- a/engines/ultima/ultima4/ultima4.cpp
+++ b/engines/ultima/ultima4/ultima4.cpp
@@ -241,7 +241,7 @@ bool Ultima4Engine::hasFeature(EngineFeature f) const {
 }
 
 bool Ultima4Engine::isEnhanced() const {
-	return _gameDescription->features & GF_VGA_ENHANCED;
+	return _gameDescription->features & GF_ENHANCED;
 }
 
 Common::Error Ultima4Engine::loadGameStream(Common::SeekableReadStream *stream) {


Commit: 55cd93159e03118a5ada14929b73cb32593b1e82
    https://github.com/scummvm/scummvm/commit/55cd93159e03118a5ada14929b73cb32593b1e82
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:41:02+11:00

Commit Message:
ULTIMA: ULTIMA3: Added the Upgrade Patch MIDI music as a game option

Changed paths:
  A devtools/create_ultima/files/ultima3/sounds/alive.xmi
  A devtools/create_ultima/files/ultima3/sounds/castles.xmi
  A devtools/create_ultima/files/ultima3/sounds/combat.xmi
  A devtools/create_ultima/files/ultima3/sounds/dungeon.xmi
  A devtools/create_ultima/files/ultima3/sounds/exodus.xmi
  A devtools/create_ultima/files/ultima3/sounds/fanfare.xmi
  A devtools/create_ultima/files/ultima3/sounds/midpak.ad
  A devtools/create_ultima/files/ultima3/sounds/rulebrit.xmi
  A devtools/create_ultima/files/ultima3/sounds/setm.xmi
  A devtools/create_ultima/files/ultima3/sounds/shopping.xmi
  A devtools/create_ultima/files/ultima3/sounds/towns.xmi
  A devtools/create_ultima/files/ultima3/sounds/wander.xmi
  A engines/ultima/ultima3/music.cpp
  A engines/ultima/ultima3/music.h
    engines/ultima/detection.h
    engines/ultima/detection_tables.h
    engines/ultima/metaengine.cpp
    engines/ultima/module.mk
    engines/ultima/ultima3/console.cpp
    engines/ultima/ultima3/console.h
    engines/ultima/ultima3/ultima3.cpp
    engines/ultima/ultima3/ultima3.h
    engines/ultima/ultima3/views/combat_map.h
    engines/ultima/ultima3/views/game.cpp
    engines/ultima/ultima3/views/game.h
    engines/ultima/ultima3/views/interactions/insert_card.cpp
    engines/ultima/ultima3/views/interactions/shops.cpp
    engines/ultima/ultima3/views/interactions/transact.cpp
    engines/ultima/ultima3/views/main_menu.cpp


diff --git a/devtools/create_ultima/files/ultima3/sounds/alive.xmi b/devtools/create_ultima/files/ultima3/sounds/alive.xmi
new file mode 100644
index 00000000000..b3acd2801a0
Binary files /dev/null and b/devtools/create_ultima/files/ultima3/sounds/alive.xmi differ
diff --git a/devtools/create_ultima/files/ultima3/sounds/castles.xmi b/devtools/create_ultima/files/ultima3/sounds/castles.xmi
new file mode 100644
index 00000000000..4431b61fcda
Binary files /dev/null and b/devtools/create_ultima/files/ultima3/sounds/castles.xmi differ
diff --git a/devtools/create_ultima/files/ultima3/sounds/combat.xmi b/devtools/create_ultima/files/ultima3/sounds/combat.xmi
new file mode 100644
index 00000000000..4dc50b06f3e
Binary files /dev/null and b/devtools/create_ultima/files/ultima3/sounds/combat.xmi differ
diff --git a/devtools/create_ultima/files/ultima3/sounds/dungeon.xmi b/devtools/create_ultima/files/ultima3/sounds/dungeon.xmi
new file mode 100644
index 00000000000..d13eed79d18
Binary files /dev/null and b/devtools/create_ultima/files/ultima3/sounds/dungeon.xmi differ
diff --git a/devtools/create_ultima/files/ultima3/sounds/exodus.xmi b/devtools/create_ultima/files/ultima3/sounds/exodus.xmi
new file mode 100644
index 00000000000..92e27c80b4d
Binary files /dev/null and b/devtools/create_ultima/files/ultima3/sounds/exodus.xmi differ
diff --git a/devtools/create_ultima/files/ultima3/sounds/fanfare.xmi b/devtools/create_ultima/files/ultima3/sounds/fanfare.xmi
new file mode 100644
index 00000000000..2a344326b54
Binary files /dev/null and b/devtools/create_ultima/files/ultima3/sounds/fanfare.xmi differ
diff --git a/devtools/create_ultima/files/ultima3/sounds/midpak.ad b/devtools/create_ultima/files/ultima3/sounds/midpak.ad
new file mode 100644
index 00000000000..1ec5dcfb18a
Binary files /dev/null and b/devtools/create_ultima/files/ultima3/sounds/midpak.ad differ
diff --git a/devtools/create_ultima/files/ultima3/sounds/rulebrit.xmi b/devtools/create_ultima/files/ultima3/sounds/rulebrit.xmi
new file mode 100644
index 00000000000..2097aa7243f
Binary files /dev/null and b/devtools/create_ultima/files/ultima3/sounds/rulebrit.xmi differ
diff --git a/devtools/create_ultima/files/ultima3/sounds/setm.xmi b/devtools/create_ultima/files/ultima3/sounds/setm.xmi
new file mode 100644
index 00000000000..77d3a6c2915
Binary files /dev/null and b/devtools/create_ultima/files/ultima3/sounds/setm.xmi differ
diff --git a/devtools/create_ultima/files/ultima3/sounds/shopping.xmi b/devtools/create_ultima/files/ultima3/sounds/shopping.xmi
new file mode 100644
index 00000000000..27d0724a319
Binary files /dev/null and b/devtools/create_ultima/files/ultima3/sounds/shopping.xmi differ
diff --git a/devtools/create_ultima/files/ultima3/sounds/towns.xmi b/devtools/create_ultima/files/ultima3/sounds/towns.xmi
new file mode 100644
index 00000000000..23406154eca
Binary files /dev/null and b/devtools/create_ultima/files/ultima3/sounds/towns.xmi differ
diff --git a/devtools/create_ultima/files/ultima3/sounds/wander.xmi b/devtools/create_ultima/files/ultima3/sounds/wander.xmi
new file mode 100644
index 00000000000..d1886c1b0de
Binary files /dev/null and b/devtools/create_ultima/files/ultima3/sounds/wander.xmi differ
diff --git a/engines/ultima/detection.h b/engines/ultima/detection.h
index 895f31b76ae..568f5304053 100644
--- a/engines/ultima/detection.h
+++ b/engines/ultima/detection.h
@@ -84,6 +84,7 @@ struct UltimaGameDescription {
 #define GAMEOPTION_ULTIMA3_MORE_MONSTERS GUIO_GAMEOPTIONS12
 #define GAMEOPTION_ULTIMA3_LESS_HUNGER   GUIO_GAMEOPTIONS13
 #define GAMEOPTION_ULTIMA3_MOON_ICONS    GUIO_GAMEOPTIONS14
+#define GAMEOPTION_ULTIMA3_MIDI_MUSIC    GUIO_GAMEOPTIONS15
 
 } // End of namespace Ultima
 
diff --git a/engines/ultima/detection_tables.h b/engines/ultima/detection_tables.h
index 58d35f57bf5..cb9e46b7606 100644
--- a/engines/ultima/detection_tables.h
+++ b/engines/ultima/detection_tables.h
@@ -24,7 +24,7 @@ namespace Ultima {
 #define GUI_OPTIONS_ULTIMA0	GUIO0()
 #define GUI_OPTIONS_ULTIMA1	GUIO0()
 #define GUI_OPTIONS_ULTIMA2	GUIO0()
-#define GUI_OPTIONS_ULTIMA3	GUIO3(GAMEOPTION_ULTIMA3_MORE_MONSTERS, GAMEOPTION_ULTIMA3_LESS_HUNGER, GAMEOPTION_ULTIMA3_MOON_ICONS)
+#define GUI_OPTIONS_ULTIMA3	GUIO4(GAMEOPTION_ULTIMA3_MORE_MONSTERS, GAMEOPTION_ULTIMA3_LESS_HUNGER, GAMEOPTION_ULTIMA3_MOON_ICONS, GAMEOPTION_ULTIMA3_MIDI_MUSIC)
 #define GUI_OPTIONS_ULTIMA4	GUIO1(GUIO_NOSPEECH)
 #define GUI_OPTIONS_ULTIMA6	GUIO0()
 #define GUI_OPTIONS_ULTIMA8	GUIO9(GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FRAME_SKIPPING, GAMEOPTION_FRAME_LIMITING, GAMEOPTION_CHEATS, GAMEOPTION_HIGH_RESOLUTION, GAMEOPTION_FOOTSTEP_SOUNDS, GAMEOPTION_JUMP_TO_MOUSE, GAMEOPTION_FONT_REPLACEMENT, GAMEOPTION_FONT_ANTIALIASING)
diff --git a/engines/ultima/metaengine.cpp b/engines/ultima/metaengine.cpp
index a3ce9bb6441..0c59faa4aa7 100644
--- a/engines/ultima/metaengine.cpp
+++ b/engines/ultima/metaengine.cpp
@@ -207,6 +207,17 @@ static const ADExtraGuiOptionsMap optionsList[] = {
 			0
 		}
 	},
+	{
+		GAMEOPTION_ULTIMA3_MIDI_MUSIC,
+		{
+			_s("Play MIDI music"),
+			_s("Plays the music that the Ultima III Upgrade adds to the game"),
+			"midi_music",
+			false,
+			0,
+			0
+		}
+	},
 	{
 		GAMEOPTION_ALWAYS_CHRISTMAS,
 		{
diff --git a/engines/ultima/module.mk b/engines/ultima/module.mk
index cdf0f3da32f..f792fb92058 100644
--- a/engines/ultima/module.mk
+++ b/engines/ultima/module.mk
@@ -165,6 +165,7 @@ MODULE_OBJS += \
 	ultima3/ultima3.o \
 	ultima3/console.o \
 	ultima3/metaengine.o \
+	ultima3/music.o \
 	ultima3/sound_effects.o \
 	ultima3/data/arena.o \
 	ultima3/data/data.o \
diff --git a/engines/ultima/ultima3/console.cpp b/engines/ultima/ultima3/console.cpp
index 644784e2d34..f161b1f81fd 100644
--- a/engines/ultima/ultima3/console.cpp
+++ b/engines/ultima/ultima3/console.cpp
@@ -52,6 +52,7 @@ Console::Console() : GUI::Debugger() {
 	registerCmd("save", WRAP_METHOD(Console, cmdSave));
 	registerCmd("exodus", WRAP_METHOD(Console, cmdExodus));
 	registerCmd("moon", WRAP_METHOD(Console, cmdMoon));
+	registerCmd("music", WRAP_METHOD(Console, cmdMusic));
 }
 
 Console::~Console() {
@@ -206,6 +207,23 @@ bool Console::cmdMoon(int argc, const char **argv) {
 	return true;
 }
 
+bool Console::cmdMusic(int argc, const char **argv) {
+	if (argc != 2) {
+		debugPrintf("music <name>  - plays a song from the sounds folder, such as wander\n");
+		return true;
+	}
+
+	// The extension is added, though it's fine to give it
+	Common::String name(argv[1]);
+	name.toLowercase();
+	if (name.hasSuffix(".xmi"))
+		name = name.substr(0, name.size() - 4);
+
+	if (!_G(music).playFile(name))
+		debugPrintf("Could not play %s.xmi\n", name.c_str());
+	return true;
+}
+
 bool Console::cmdTiles(int argc, const char **argv) {
 	Graphics::ManagedSurface surface(Gfx::SHAPE_SIZE, Gfx::SHAPE_SIZE, Graphics::PixelFormat::createFormatCLUT8());
 
diff --git a/engines/ultima/ultima3/console.h b/engines/ultima/ultima3/console.h
index a54bd1daea0..be220c752e5 100644
--- a/engines/ultima/ultima3/console.h
+++ b/engines/ultima/ultima3/console.h
@@ -62,6 +62,7 @@ private:
 	bool cmdSave(int argc, const char **argv);
 	bool cmdExodus(int argc, const char **argv);
 	bool cmdMoon(int argc, const char **argv);
+	bool cmdMusic(int argc, const char **argv);
 
 public:
 	Console();
diff --git a/engines/ultima/ultima3/music.cpp b/engines/ultima/ultima3/music.cpp
new file mode 100644
index 00000000000..601aef87419
--- /dev/null
+++ b/engines/ultima/ultima3/music.cpp
@@ -0,0 +1,237 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "audio/miles.h"
+#include "audio/midiparser.h"
+#include "common/config-manager.h"
+#include "common/file.h"
+#include "ultima/ultima3/music.h"
+#include "ultima/ultima3/data/savegame.h"
+
+namespace Ultima {
+namespace Ultima3 {
+
+static const char *const SONG_NAMES[SONG_COUNT] = {
+	"wander", "castles", "rulebrit", "towns", "shopping", "combat", "dungeon", "alive", "fanfare", "exodus"
+};
+
+// The instruments for the AdLib are the same as for the OPL3
+static const char *const INSTRUMENT_BANK = "sounds/midpak.ad";
+
+void Music::openDriver() {
+	_driverOpened = true;
+
+	MidiDriver::DeviceHandle dev = MidiDriver::detectDevice(MDT_MIDI | MDT_ADLIB | MDT_PREFER_GM);
+	MusicType type = MidiDriver::getMusicType(dev);
+	if (type == MT_GM && ConfMan.getBool("native_mt32"))
+		type = MT_MT32;
+
+	switch (type) {
+	case MT_ADLIB:
+		_miles = true;
+		_driver = Audio::MidiDriver_Miles_AdLib_create(INSTRUMENT_BANK, INSTRUMENT_BANK);
+		break;
+	case MT_MT32:
+		_miles = true;
+		_driver = Audio::MidiDriver_Miles_MT32_create(Common::Path());
+		break;
+	default:
+		createDriver();
+		break;
+	}
+
+	if (!_driver)
+		return;
+
+	if (_driver->open() != 0) {
+		delete _driver;
+		_driver = nullptr;
+		return;
+	}
+
+	// The Miles drivers reset themselves
+	if (!_miles) {
+		if (_nativeMT32)
+			_driver->sendMT32Reset();
+		else
+			_driver->sendGMReset();
+	}
+
+	_driver->setTimerCallback(this, &timerCallback);
+}
+
+void Music::send(uint32 b) {
+	// The Miles drivers mix the channels themselves
+	if (_miles)
+		_driver->send(b);
+	else
+		Audio::MidiPlayer::send(b);
+}
+
+void Music::start(int song, bool loop) {
+	if (startFile(SONG_NAMES[song], loop))
+		_current = song;
+}
+
+bool Music::startFile(const Common::String &name, bool loop) {
+	Common::StackLock lock(_mutex);
+	stop();
+	_current = SONG_NONE;
+
+	Common::File f;
+	if (!f.open(Common::Path("sounds/" + name + ".xmi")))
+		return false;
+
+	const uint32 size = f.size();
+	_midiData = (byte *)malloc(size);
+	if (f.read(_midiData, size) != size) {
+		stop();
+		return false;
+	}
+
+	_parser = MidiParser::createParser_XMIDI(nullptr, nullptr, 0);
+	_parser->setMidiDriver(this);
+	_parser->setTimerRate(_driver->getBaseTempo());
+	_parser->property(MidiParser::mpCenterPitchWheelOnUnload, 1);
+	_parser->property(MidiParser::mpSendSustainOffOnNotesOff, 1);
+
+	if (!_parser->loadMusic(_midiData, size)) {
+		stop();
+		return false;
+	}
+
+	_isLooping = loop;
+	_parser->property(MidiParser::mpAutoLoop, loop ? 1 : 0);
+	_parser->setTrack(0);
+
+	syncVolume();
+	_isPlaying = true;
+	return true;
+}
+
+bool Music::playFile(const Common::String &name) {
+	if (!_driverOpened)
+		openDriver();
+	if (!_driver)
+		return false;
+
+	// Nothing carries on from or after it
+	_song = _jingle = SONG_NONE;
+	return startFile(name, true);
+}
+
+void Music::setEnabled(bool enabled) {
+	if (enabled == _enabled)
+		return;
+
+	_enabled = enabled;
+	if (_enabled)
+		resync();
+	else
+		silence();
+}
+
+void Music::silence() {
+	_song = _jingle = _current = SONG_NONE;
+	stop();
+}
+
+void Music::play(int song) {
+	if (!_enabled)
+		return;
+
+	if (!_driverOpened)
+		openDriver();
+	if (!_driver)
+		return;
+
+	_song = song;
+
+	// A jingle goes on to completion, and then the song takes over
+	if (_jingle != SONG_NONE)
+		return;
+
+	if (song != _current || !isPlaying())
+		start(song, true);
+}
+
+void Music::jingle(int song) {
+	if (!_enabled)
+		return;
+
+	if (!_driverOpened)
+		openDriver();
+	if (!_driver)
+		return;
+
+	_jingle = song;
+	start(song, false);
+}
+
+void Music::update() {
+	if (!_driver || isPlaying())
+		return;
+
+	// A jingle has finished, or a song that doesn't loop has
+	_jingle = SONG_NONE;
+	if (_song != SONG_NONE)
+		start(_song, true);
+}
+
+void Music::autoSelect(byte location, bool inExodus) {
+	int song;
+
+	switch (location) {
+	case Data::LOCATION_SOSARIA:
+		song = SONG_WANDER;
+		break;
+	case Data::LOCATION_DUNGEON:
+		song = SONG_DUNGEON;
+		break;
+	case Data::LOCATION_TOWN:
+		song = SONG_TOWNS;
+		break;
+	case Data::LOCATION_CASTLE:
+		song = inExodus ? SONG_EXODUS : SONG_CASTLES;
+		break;
+	case MUSIC_LOCATION_COMBAT:
+		song = SONG_COMBAT;
+		break;
+	case MUSIC_LOCATION_SCENE:
+	case MUSIC_LOCATION_GEM:
+		song = SONG_ALIVE;
+		break;
+	case Data::LOCATION_AMBROSIA:
+		song = SONG_FANFARE;
+		break;
+	default:
+		return;
+	}
+
+	if (song == _selected)
+		return;
+
+	_selected = song;
+	play(song);
+}
+
+} // namespace Ultima3
+} // namespace Ultima
diff --git a/engines/ultima/ultima3/music.h b/engines/ultima/ultima3/music.h
new file mode 100644
index 00000000000..59dc44d845b
--- /dev/null
+++ b/engines/ultima/ultima3/music.h
@@ -0,0 +1,142 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef ULTIMA3_MUSIC_H
+#define ULTIMA3_MUSIC_H
+
+#include "audio/midiplayer.h"
+
+namespace Ultima {
+namespace Ultima3 {
+
+/**
+ * The songs of the Ultima III Upgrade's MIDI music, numbered as in the game
+ */
+enum Song {
+	SONG_NONE = -1,
+	SONG_WANDER = 0,
+	SONG_CASTLES = 1,
+	SONG_RULEBRIT = 2,
+	SONG_TOWNS = 3,
+	SONG_SHOPPING = 4,
+	SONG_COMBAT = 5,
+	SONG_DUNGEON = 6,
+	SONG_ALIVE = 7,
+	SONG_FANFARE = 8,
+	SONG_EXODUS = 9,
+	SONG_COUNT = 10
+};
+
+// The kinds of place that have a song, other than the ones in the savegame
+constexpr byte MUSIC_LOCATION_SCENE = 4;
+constexpr byte MUSIC_LOCATION_GEM = 0x11;
+constexpr byte MUSIC_LOCATION_COMBAT = 0x80;
+
+/**
+ * Plays the XMIDI songs that the Upgrade adds. A song carries on until
+ * another is chosen, and a jingle is played once on top of it
+ */
+class Music : public Audio::MidiPlayer {
+private:
+	static constexpr int UNSELECTED = -2;
+
+	bool _enabled = false;
+	bool _driverOpened = false;
+	bool _miles = false;
+	int _song = SONG_NONE;
+	int _current = SONG_NONE;
+	int _jingle = SONG_NONE;
+	int _selected = UNSELECTED;
+
+	/**
+	 * Creates the device the music is played on
+	 */
+	void openDriver();
+
+	/**
+	 * Starts a song from the beginning
+	 */
+	void start(int song, bool loop);
+
+	/**
+	 * Starts a song file from the beginning
+	 * @returns		False if it couldn't be played
+	 */
+	bool startFile(const Common::String &name, bool loop);
+
+public:
+	Music() {}
+	~Music() override {}
+
+	/**
+	 * Sets whether music plays at all
+	 */
+	void setEnabled(bool enabled);
+
+	/**
+	 * Plays a song until another is chosen. Nothing happens if it's already playing
+	 */
+	void play(int song);
+
+	/**
+	 * Plays a song once, after which the one that was playing carries on
+	 */
+	void jingle(int song);
+
+	/**
+	 * Plays one of the song files, whether it's one of the game's or not
+	 * @param name		The name of the file, without its extension
+	 * @returns			False if it couldn't be played
+	 */
+	bool playFile(const Common::String &name);
+
+	/**
+	 * Stops all the music
+	 */
+	void silence();
+
+	/**
+	 * Plays the song that suits where the party is, if that's changed
+	 * @param location		The kind of place, as in the savegame, or 0x80 for a fight
+	 * @param inExodus		True if in the castle of Exodus
+	 */
+	void autoSelect(byte location, bool inExodus);
+
+	/**
+	 * Makes the next autoSelect play its song even if it hasn't changed
+	 */
+	void resync() {
+		_selected = UNSELECTED;
+	}
+
+	/**
+	 * Called every frame to carry on from a jingle
+	 */
+	void update();
+
+	// MidiDriver_BASE API
+	void send(uint32 b) override;
+};
+
+} // namespace Ultima3
+} // namespace Ultima
+
+#endif
diff --git a/engines/ultima/ultima3/ultima3.cpp b/engines/ultima/ultima3/ultima3.cpp
index 44557c6f330..0e2630c65ed 100644
--- a/engines/ultima/ultima3/ultima3.cpp
+++ b/engines/ultima/ultima3/ultima3.cpp
@@ -30,6 +30,7 @@
 #include "ultima/ultima3/ultima3.h"
 #include "ultima/ultima3/console.h"
 #include "ultima/ultima3/metaengine.h"
+#include "ultima/ultima3/music.h"
 #include "ultima/ultima3/sound_effects.h"
 #include "ultima/ultima3/data/data.h"
 #include "ultima/ultima3/gfx/charset.h"
@@ -67,6 +68,8 @@ void Ultima3Engine::loadOptions() {
 	_moreMonsters = Shared::configuredOption("more_monsters", enhanced);
 	_lessHunger = Shared::configuredOption("less_hunger", enhanced);
 	_moonIcons = Shared::configuredOption("moon_icons", true);
+	_music.setEnabled(Shared::configuredOption("midi_music", enhanced));
+	_music.syncVolume();
 }
 
 Ultima3Engine::~Ultima3Engine() {
diff --git a/engines/ultima/ultima3/ultima3.h b/engines/ultima/ultima3/ultima3.h
index 3d77372c822..a612d9fd70f 100644
--- a/engines/ultima/ultima3/ultima3.h
+++ b/engines/ultima/ultima3/ultima3.h
@@ -42,6 +42,7 @@
 #include "ultima/ultima3/gfx/overview.h"
 #include "ultima/ultima3/gfx/screen_effects.h"
 #include "ultima/ultima3/gfx/shapes.h"
+#include "ultima/ultima3/music.h"
 #include "ultima/ultima3/logic/combat_logic.h"
 
 namespace Audio {
@@ -141,6 +142,9 @@ public:
 	bool _lessHunger = false;
 	bool _moonIcons = true;
 
+	// Plays the Upgrade's MIDI music, if that's been turned on
+	Music _music;
+
 	// Which of the upgrade's renderers is in use
 	Data::RenderMode _renderMode = Data::RENDER_CGA;
 
diff --git a/engines/ultima/ultima3/views/combat_map.h b/engines/ultima/ultima3/views/combat_map.h
index de204337bb3..c380b8eb47a 100644
--- a/engines/ultima/ultima3/views/combat_map.h
+++ b/engines/ultima/ultima3/views/combat_map.h
@@ -23,6 +23,7 @@
 #define ULTIMA3_VIEWS_COMBAT_MAP_H
 
 #include "ultima/ultima3/views/game.h"
+#include "ultima/ultima3/music.h"
 
 namespace Ultima {
 namespace Ultima3 {
@@ -75,6 +76,9 @@ protected:
 	void idleTimeout() override;
 	void endTurn() override;
 	void processFrame() override;
+	byte musicLocation() const override {
+		return MUSIC_LOCATION_COMBAT;
+	}
 	bool isWaiting() const override;
 	bool handleCommand(const KeypressMessage &msg) override;
 
diff --git a/engines/ultima/ultima3/views/game.cpp b/engines/ultima/ultima3/views/game.cpp
index 98f6d5a1696..ee532865670 100644
--- a/engines/ultima/ultima3/views/game.cpp
+++ b/engines/ultima/ultima3/views/game.cpp
@@ -23,6 +23,7 @@
 #include "ultima/ultima3/gfx/charset.h"
 #include "ultima/ultima3/gfx/composite.h"
 #include "ultima/ultima3/gfx/frame.h"
+#include "ultima/ultima3/logic/location_logic.h"
 #include "ultima/ultima3/views/menu_input.h"
 #include "ultima/ultima3/views/interactions/equip.h"
 #include "ultima/ultima3/views/interactions/exchange.h"
@@ -94,11 +95,32 @@ void Game::updateWind() {
 
 bool Game::msgFocus(const FocusMessage &msg) {
 	_idleFrames = 0;
+	_G(music).resync();
 	delayFrames(1);
 	return View::msgFocus(msg);
 }
 
+byte Game::musicLocation() const {
+	if (_gameOver || _G(sceneShown))
+		return MUSIC_LOCATION_SCENE;
+	if (_G(overview).isActive() && _G(savegame)._location == Data::LOCATION_DUNGEON)
+		return MUSIC_LOCATION_GEM;
+
+	return _G(savegame)._location;
+}
+
+void Game::updateMusic() {
+	// The music for what was going on before a command is found again once it's over
+	if (_wasInteracting && !_interaction)
+		_G(music).resync();
+	_wasInteracting = _interaction.get() != nullptr;
+
+	_G(music).update();
+	_G(music).autoSelect(musicLocation(), LocationLogic().isInExodusCastle());
+}
+
 void Game::timeout() {
+	updateMusic();
 	_G(shapes).animate();
 	_G(effects).tick();
 	updateWind();
diff --git a/engines/ultima/ultima3/views/game.h b/engines/ultima/ultima3/views/game.h
index 72314e024de..79af0a42197 100644
--- a/engines/ultima/ultima3/views/game.h
+++ b/engines/ultima/ultima3/views/game.h
@@ -43,6 +43,7 @@ constexpr int FRAME_COLS = 40;
 class Game : public Shared::View {
 private:
 	int _idleFrames = 0;
+	bool _wasInteracting = false;
 	int _windCounter = 1;
 	Common::ScopedPtr<Interactions::Interaction> _interaction;
 
@@ -56,6 +57,11 @@ private:
 	 */
 	void updateWind();
 
+	/**
+	 * Has the music follow where the party is
+	 */
+	void updateMusic();
+
 protected:
 	bool _gameOver = false;
 
@@ -91,6 +97,11 @@ protected:
 	 */
 	virtual void endTurn() = 0;
 
+	/**
+	 * Returns the kind of place the party is in as far as the music goes
+	 */
+	virtual byte musicLocation() const;
+
 	/**
 	 * Called every frame, for anything the view has going on
 	 */
diff --git a/engines/ultima/ultima3/views/interactions/insert_card.cpp b/engines/ultima/ultima3/views/interactions/insert_card.cpp
index 98d30be1d8a..fe07579580b 100644
--- a/engines/ultima/ultima3/views/interactions/insert_card.cpp
+++ b/engines/ultima/ultima3/views/interactions/insert_card.cpp
@@ -177,8 +177,10 @@ bool InsertCard::timeout() {
 		_invertEven ^= (step & 1) != 0;
 		_invertOdd ^= (step & 2) != 0;
 
-		if (++_step == ARRAYSIZE(SHATTER_STEPS))
+		if (++_step == ARRAYSIZE(SHATTER_STEPS)) {
 			_stage = TEXT;
+			_G(music).play(SONG_ALIVE);
+		}
 	} else if (_stage == TEXT) {
 		_stage = DONE;
 	}
diff --git a/engines/ultima/ultima3/views/interactions/shops.cpp b/engines/ultima/ultima3/views/interactions/shops.cpp
index 89d7942789d..c28bd5d13d4 100644
--- a/engines/ultima/ultima3/views/interactions/shops.cpp
+++ b/engines/ultima/ultima3/views/interactions/shops.cpp
@@ -266,9 +266,14 @@ bool Temple::serve(int slot) {
 		break;
 	}
 
-	if (restored)
+	if (restored) {
 		spend(TEMPLE_COSTS[_service]);
 
+		// Bringing someone back from the dead is celebrated
+		if (_service >= 2)
+			_G(music).jingle(SONG_ALIVE);
+	}
+
 	return restored;
 }
 
diff --git a/engines/ultima/ultima3/views/interactions/transact.cpp b/engines/ultima/ultima3/views/interactions/transact.cpp
index 6410c6dda95..9ab80d55c15 100644
--- a/engines/ultima/ultima3/views/interactions/transact.cpp
+++ b/engines/ultima/ultima3/views/interactions/transact.cpp
@@ -67,6 +67,7 @@ void Transact::talkTo(int creature) {
 	const Data::Creatures &c = _G(map)._creatures;
 
 	if (c._tile[creature] == CELL_LORD_BRITISH) {
+		_G(music).jingle(SONG_RULEBRIT);
 		lordBritish();
 		return;
 	}
@@ -94,6 +95,7 @@ bool Transact::startShop(int dx, int dy) {
 
 	const int payer = _players.slot();
 	_G(effects)._highlight = payer;
+	_G(music).play(SONG_SHOPPING);
 
 	// Horses are bought facing west, and the rest according to where the shop is
 	if (dx < 0) {
diff --git a/engines/ultima/ultima3/views/main_menu.cpp b/engines/ultima/ultima3/views/main_menu.cpp
index 072e9af0d92..885016122bb 100644
--- a/engines/ultima/ultima3/views/main_menu.cpp
+++ b/engines/ultima/ultima3/views/main_menu.cpp
@@ -37,6 +37,7 @@ MainMenu::MainMenu() : WindowView("MainMenu") {
 
 bool MainMenu::msgFocus(const FocusMessage &msg) {
 	_choice.reset();
+	_G(music).play(SONG_WANDER);
 	return View::msgFocus(msg);
 }
 
@@ -75,6 +76,7 @@ bool MainMenu::msgKeypress(const KeypressMessage &msg) {
 			}
 			break;
 		default:
+			_G(music).silence();
 			close();
 			return true;
 		}


Commit: 7d9e18a80e5587fb99ef98c2896db3b57ba5549f
    https://github.com/scummvm/scummvm/commit/7d9e18a80e5587fb99ef98c2896db3b57ba5549f
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:41:03+11:00

Commit Message:
ULTIMA: ULTIMA3: Added the Upgrade Patch Alt-X, Alt-R and Alt-M hotkeys

Changed paths:
    engines/ultima/shared/engine/view.cpp
    engines/ultima/shared/engine/view.h
    engines/ultima/ultima3/ultima3.cpp
    engines/ultima/ultima3/ultima3.h
    engines/ultima/ultima3/views/game.cpp
    engines/ultima/ultima3/views/game.h
    engines/ultima/ultima3/views/main_menu.cpp


diff --git a/engines/ultima/shared/engine/view.cpp b/engines/ultima/shared/engine/view.cpp
index 847aa1f1310..432827408b4 100644
--- a/engines/ultima/shared/engine/view.cpp
+++ b/engines/ultima/shared/engine/view.cpp
@@ -26,6 +26,9 @@ namespace Ultima {
 namespace Shared {
 
 bool View::msgKeypress(const Graphics::Views::KeypressMessage &msg) {
+	if ((msg.flags & Common::KBD_ALT) && msgHotkey(msg.keycode))
+		return true;
+
 	switch (msg.keycode) {
 	case Common::KEYCODE_F5:
 		g_engine->saveGameDialog();
diff --git a/engines/ultima/shared/engine/view.h b/engines/ultima/shared/engine/view.h
index db0c6da9037..303257bd9b4 100644
--- a/engines/ultima/shared/engine/view.h
+++ b/engines/ultima/shared/engine/view.h
@@ -34,6 +34,16 @@ namespace Shared {
  */
 class View : public Graphics::Views::View {
 	ULTIMA_CUSTOM_MESSAGES(Graphics::Views::View)
+protected:
+	/**
+	 * Called for a key pressed with Alt held, which games can give a
+	 * meaning to
+	 * @returns		True if the key was handled
+	 */
+	virtual bool msgHotkey(Common::KeyCode key) {
+		return false;
+	}
+
 public:
 	View(const Common::String &name, Graphics::Views::UIElement *uiParent) : Graphics::Views::View(name, uiParent) {
 	}
diff --git a/engines/ultima/ultima3/ultima3.cpp b/engines/ultima/ultima3/ultima3.cpp
index 0e2630c65ed..0e7b8c072ab 100644
--- a/engines/ultima/ultima3/ultima3.cpp
+++ b/engines/ultima/ultima3/ultima3.cpp
@@ -115,6 +115,15 @@ Common::Error Ultima3Engine::run() {
 	return Common::kNoError;
 }
 
+bool Ultima3Engine::msgKeypress(const Graphics::Views::KeypressMessage &msg) {
+	if ((msg.flags & Common::KBD_ALT) && msg.keycode == Common::KEYCODE_x) {
+		quitGame();
+		return true;
+	}
+
+	return Shared::Events::msgKeypress(msg);
+}
+
 void Ultima3Engine::applyGameSettings() {
 	loadOptions();
 
diff --git a/engines/ultima/ultima3/ultima3.h b/engines/ultima/ultima3/ultima3.h
index a612d9fd70f..84f5023365e 100644
--- a/engines/ultima/ultima3/ultima3.h
+++ b/engines/ultima/ultima3/ultima3.h
@@ -80,6 +80,11 @@ protected:
 		return Engine::shouldQuit();
 	}
 
+	/**
+	 * Handles the upgrade's Alt-X hotkey, which exits from anywhere
+	 */
+	bool msgKeypress(const Graphics::Views::KeypressMessage &msg) override;
+
 private:
 	Audio::PCSpeaker *_pcSpeaker = nullptr;
 	bool _pcSpeakerReady = false;
diff --git a/engines/ultima/ultima3/views/game.cpp b/engines/ultima/ultima3/views/game.cpp
index ee532865670..92be57e125b 100644
--- a/engines/ultima/ultima3/views/game.cpp
+++ b/engines/ultima/ultima3/views/game.cpp
@@ -191,6 +191,24 @@ bool Game::handleCommand(const KeypressMessage &msg) {
 	}
 }
 
+bool Game::msgHotkey(Common::KeyCode key) {
+	switch (key) {
+	case Common::KEYCODE_r:
+		g_engine->loadGameDialog();
+		return true;
+
+	case Common::KEYCODE_m:
+		// Back to the start of the game, which has no music
+		_interaction.reset();
+		_G(music).silence();
+		replaceView("Title", true);
+		return true;
+
+	default:
+		return false;
+	}
+}
+
 bool Game::msgKeypress(const KeypressMessage &msg) {
 	if (isModifierKey(msg.keycode))
 		return true;
diff --git a/engines/ultima/ultima3/views/game.h b/engines/ultima/ultima3/views/game.h
index 79af0a42197..d3b99b67005 100644
--- a/engines/ultima/ultima3/views/game.h
+++ b/engines/ultima/ultima3/views/game.h
@@ -102,6 +102,12 @@ protected:
 	 */
 	virtual byte musicLocation() const;
 
+	/**
+	 * Handles the upgrade's Alt hotkeys: R to restore a saved game and M to go
+	 * back to the title
+	 */
+	bool msgHotkey(Common::KeyCode key) override;
+
 	/**
 	 * Called every frame, for anything the view has going on
 	 */
diff --git a/engines/ultima/ultima3/views/main_menu.cpp b/engines/ultima/ultima3/views/main_menu.cpp
index 885016122bb..6a3a7b0a519 100644
--- a/engines/ultima/ultima3/views/main_menu.cpp
+++ b/engines/ultima/ultima3/views/main_menu.cpp
@@ -68,7 +68,10 @@ bool MainMenu::msgKeypress(const KeypressMessage &msg) {
 			addView("PartyMenu");
 			break;
 		case 'J':
-			if (_G(savegame)._partySize == 0 || !_G(savegame).hasLivingPartyMember()) {
+			if (_G(savegame)._partySize == 0) {
+				// With nobody to journey with, a saved party is the way to carry on
+				g_engine->loadGameDialog();
+			} else if (!_G(savegame).hasLivingPartyMember()) {
 				addView("JourneyOnward");
 			} else {
 				replaceView(g_engine->gameViewName(), true);


Commit: 8ca907a7e99bcc74bc52b8e548225512e86df5c9
    https://github.com/scummvm/scummvm/commit/8ca907a7e99bcc74bc52b8e548225512e86df5c9
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:41:03+11:00

Commit Message:
ULTIMA: ULTIMA3: Added the Upgrade Patch timed sound effects as a game option

Changed paths:
    engines/ultima/detection.h
    engines/ultima/detection_tables.h
    engines/ultima/metaengine.cpp
    engines/ultima/ultima3/sound_effects.cpp
    engines/ultima/ultima3/sound_effects.h
    engines/ultima/ultima3/ultima3.cpp
    engines/ultima/ultima3/ultima3.h


diff --git a/engines/ultima/detection.h b/engines/ultima/detection.h
index 568f5304053..b9e4d4ef743 100644
--- a/engines/ultima/detection.h
+++ b/engines/ultima/detection.h
@@ -85,6 +85,7 @@ struct UltimaGameDescription {
 #define GAMEOPTION_ULTIMA3_LESS_HUNGER   GUIO_GAMEOPTIONS13
 #define GAMEOPTION_ULTIMA3_MOON_ICONS    GUIO_GAMEOPTIONS14
 #define GAMEOPTION_ULTIMA3_MIDI_MUSIC    GUIO_GAMEOPTIONS15
+#define GAMEOPTION_ULTIMA3_TIMED_SOUNDS  GUIO_GAMEOPTIONS16
 
 } // End of namespace Ultima
 
diff --git a/engines/ultima/detection_tables.h b/engines/ultima/detection_tables.h
index cb9e46b7606..f613e6a7f79 100644
--- a/engines/ultima/detection_tables.h
+++ b/engines/ultima/detection_tables.h
@@ -24,7 +24,7 @@ namespace Ultima {
 #define GUI_OPTIONS_ULTIMA0	GUIO0()
 #define GUI_OPTIONS_ULTIMA1	GUIO0()
 #define GUI_OPTIONS_ULTIMA2	GUIO0()
-#define GUI_OPTIONS_ULTIMA3	GUIO4(GAMEOPTION_ULTIMA3_MORE_MONSTERS, GAMEOPTION_ULTIMA3_LESS_HUNGER, GAMEOPTION_ULTIMA3_MOON_ICONS, GAMEOPTION_ULTIMA3_MIDI_MUSIC)
+#define GUI_OPTIONS_ULTIMA3	GUIO5(GAMEOPTION_ULTIMA3_MORE_MONSTERS, GAMEOPTION_ULTIMA3_LESS_HUNGER, GAMEOPTION_ULTIMA3_MOON_ICONS, GAMEOPTION_ULTIMA3_MIDI_MUSIC, GAMEOPTION_ULTIMA3_TIMED_SOUNDS)
 #define GUI_OPTIONS_ULTIMA4	GUIO1(GUIO_NOSPEECH)
 #define GUI_OPTIONS_ULTIMA6	GUIO0()
 #define GUI_OPTIONS_ULTIMA8	GUIO9(GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FRAME_SKIPPING, GAMEOPTION_FRAME_LIMITING, GAMEOPTION_CHEATS, GAMEOPTION_HIGH_RESOLUTION, GAMEOPTION_FOOTSTEP_SOUNDS, GAMEOPTION_JUMP_TO_MOUSE, GAMEOPTION_FONT_REPLACEMENT, GAMEOPTION_FONT_ANTIALIASING)
diff --git a/engines/ultima/metaengine.cpp b/engines/ultima/metaengine.cpp
index 0c59faa4aa7..3a7faa03a5b 100644
--- a/engines/ultima/metaengine.cpp
+++ b/engines/ultima/metaengine.cpp
@@ -218,6 +218,17 @@ static const ADExtraGuiOptionsMap optionsList[] = {
 			0
 		}
 	},
+	{
+		GAMEOPTION_ULTIMA3_TIMED_SOUNDS,
+		{
+			_s("Use Upgrade sound effects"),
+			_s("Plays the sound effects with the timing of the Ultima III Upgrade, which doesn't depend on the speed of the computer"),
+			"timed_sounds",
+			false,
+			0,
+			0
+		}
+	},
 	{
 		GAMEOPTION_ALWAYS_CHRISTMAS,
 		{
diff --git a/engines/ultima/ultima3/sound_effects.cpp b/engines/ultima/ultima3/sound_effects.cpp
index 57705715f0d..371db00169c 100644
--- a/engines/ultima/ultima3/sound_effects.cpp
+++ b/engines/ultima/ultima3/sound_effects.cpp
@@ -28,6 +28,10 @@ namespace Ultima3 {
 // The clock of the processor the timing loops were written for
 constexpr uint32 CPU_HZ = 4772727;
 
+// The rate of the timer the upgrade's sound effects count in, which is the
+// PC's 1193182Hz clock divided by 11
+constexpr uint32 TICK_HZ = 1193182 / 11;
+
 // Cost in clock cycles of the code that flips the speaker, and of
 // the pseudo random number routine
 constexpr uint32 TOGGLE_CYCLES = 4 + 14;
@@ -42,15 +46,21 @@ namespace {
  */
 class Speaker {
 public:
+	// The upgrade's version of the effects counts timer ticks, one for each time
+	// around a delay loop, and nothing else takes any time
+	const bool _timed;
 	uint32 _cycles = 0;
 	Common::Array<uint32> _edges;
 
+	Speaker(bool timed) : _timed(timed) {}
+
 	void run(uint32 cycles) {
-		_cycles += cycles;
+		if (!_timed)
+			_cycles += cycles;
 	}
 
 	void toggle() {
-		_cycles += TOGGLE_CYCLES;
+		run(TOGGLE_CYCLES);
 		_edges.push_back(_cycles);
 	}
 
@@ -58,24 +68,24 @@ public:
 	void countByte(int count) {
 		if (count == 0)
 			count = 256;
-		_cycles += 19 * count - 12;
+		_cycles += _timed ? count : 19 * count - 12;
 	}
 
 	// The same, with a word register
 	void countWord(int count) {
 		if (count == 0)
 			count = 65536;
-		_cycles += 18 * count - 10;
+		_cycles += _timed ? count : 18 * count - 10;
 	}
 
 	// The cost of a conditional jump that is taken or isn't
 	void jump(bool taken) {
-		_cycles += taken ? 16 : 4;
+		run(taken ? 16 : 4);
 	}
 
 	// A random number up to a limit, which the original then reduces to fit
 	int getRandomNumber(int limit) {
-		_cycles += RANDOM_CYCLES;
+		run(RANDOM_CYCLES);
 		return Graphics::Views::g_events->getRandomNumber(255) % limit;
 	}
 };
@@ -84,6 +94,10 @@ public:
 void sweep(Speaker &s, byte start, byte repeats) {
 	int high = start, low = 1;
 
+	// The upgrade has a quarter of the repeats, since its delays are longer
+	if (s._timed)
+		repeats >>= 2;
+
 	auto pulses = [&]() {
 		s.run(2);
 		for (int left = repeats ? repeats : 256; left > 0; --left) {
@@ -133,13 +147,20 @@ void rumble(Speaker &s, byte base) {
 		int length = (s.getRandomNumber(15) + base) & 0xFF;
 		s.run(3);
 
-		do {
-			s.run(4);
-			s.run(17 * 2 + 5);
-			s.run(3);
-			length = (length - 1) & 0xFF;
-			s.jump(length != 0);
-		} while (length != 0);
+		if (s._timed) {
+			// Three ticks each time round
+			s.countByte(length);
+			s.countByte(length);
+			s.countByte(length);
+		} else {
+			do {
+				s.run(4);
+				s.run(17 * 2 + 5);
+				s.run(3);
+				length = (length - 1) & 0xFF;
+				s.jump(length != 0);
+			} while (length != 0);
+		}
 
 		s.toggle();
 		s.run(3);
@@ -152,7 +173,7 @@ void descend(Speaker &s) {
 	for (int low = 0xFB; low > 0; --low) {
 		s.toggle();
 		s.run(2);
-		s.run(19 * (256 - low) - 12);
+		s.countByte(256 - low);
 		s.run(3);
 		s.jump(low > 1);
 	}
@@ -220,8 +241,8 @@ void swirl(Speaker &s) {
 
 } // End of anonymous namespace
 
-Common::Array<byte> SoundEffects::render(byte effect, byte arg1, byte arg2) {
-	Speaker s;
+Common::Array<byte> SoundEffects::render(byte effect, byte arg1, byte arg2, bool timed) {
+	Speaker s(timed);
 
 	switch (effect) {
 	case 0xFD:
@@ -263,13 +284,14 @@ Common::Array<byte> SoundEffects::render(byte effect, byte arg1, byte arg2) {
 		s._edges.push_back(s._cycles);
 
 	Common::Array<byte> samples;
-	uint32 total = (uint32)(((uint64)s._cycles * SAMPLE_RATE) / CPU_HZ) + 1;
+	const uint32 rate = timed ? TICK_HZ : CPU_HZ;
+	uint32 total = (uint32)(((uint64)s._cycles * SAMPLE_RATE) / rate) + 1;
 	samples.resize(total);
 
 	uint32 pos = 0;
 	bool high = false;
 	for (uint i = 0; i <= s._edges.size(); ++i) {
-		uint32 end = (i < s._edges.size()) ? (uint32)(((uint64)s._edges[i] * SAMPLE_RATE) / CPU_HZ) : total;
+		uint32 end = (i < s._edges.size()) ? (uint32)(((uint64)s._edges[i] * SAMPLE_RATE) / rate) : total;
 		byte level = high ? 0x80 + AMPLITUDE : 0x80 - AMPLITUDE;
 
 		for (; pos < end && pos < total; ++pos)
diff --git a/engines/ultima/ultima3/sound_effects.h b/engines/ultima/ultima3/sound_effects.h
index 1121f9a66a8..e3825d21726 100644
--- a/engines/ultima/ultima3/sound_effects.h
+++ b/engines/ultima/ultima3/sound_effects.h
@@ -40,9 +40,11 @@ public:
 	 * @param effect	The effect number, from 0xF4 to 0xFD
 	 * @param arg1		The first of the values the effect is varied by
 	 * @param arg2		The second
+	 * @param timed		True to make the effects as the Ultima III Upgrade does, which
+	 *					times them by a timer rather than by how long the processor takes
 	 * @returns			The samples, or nothing if the effect isn't a sound
 	 */
-	static Common::Array<byte> render(byte effect, byte arg1, byte arg2);
+	static Common::Array<byte> render(byte effect, byte arg1, byte arg2, bool timed = false);
 };
 
 } // namespace Ultima3
diff --git a/engines/ultima/ultima3/ultima3.cpp b/engines/ultima/ultima3/ultima3.cpp
index 0e7b8c072ab..3e6cbd3ff02 100644
--- a/engines/ultima/ultima3/ultima3.cpp
+++ b/engines/ultima/ultima3/ultima3.cpp
@@ -68,6 +68,7 @@ void Ultima3Engine::loadOptions() {
 	_moreMonsters = Shared::configuredOption("more_monsters", enhanced);
 	_lessHunger = Shared::configuredOption("less_hunger", enhanced);
 	_moonIcons = Shared::configuredOption("moon_icons", true);
+	_timedSounds = Shared::configuredOption("timed_sounds", enhanced);
 	_music.setEnabled(Shared::configuredOption("midi_music", enhanced));
 	_music.syncVolume();
 }
@@ -197,8 +198,11 @@ void Ultima3Engine::queueSilence(uint32 lengthMs) {
 }
 
 void Ultima3Engine::playErrorBeep() {
-	// ~371Hz for ~65ms, from the original's raw 48-toggle loop at 4.77MHz
-	queueTone(3216, 65);
+	if (_timedSounds)
+		queueTone(0x1630, 120);
+	else
+		// ~371Hz for ~65ms, from the original's raw 48-toggle loop at 4.77MHz
+		queueTone(3216, 65);
 }
 
 void Ultima3Engine::queueEffect(const Common::Array<byte> &samples) {
@@ -227,12 +231,15 @@ void Ultima3Engine::playSoundEffect(byte effect, byte arg1, byte arg2) {
 		playErrorBeep();
 		break;
 	case 0xFF:
-		// ~132Hz for ~60ms, from the original's raw 16-toggle loop at 4.77MHz
-		queueTone(9040, 60);
+		if (_timedSounds)
+			queueTone(0x3E80, 110);
+		else
+			// ~132Hz for ~60ms, from the original's raw 16-toggle loop at 4.77MHz
+			queueTone(9040, 60);
 		break;
 	default:
 		if (_soundEnabled)
-			queueEffect(SoundEffects::render(effect, arg1, arg2));
+			queueEffect(SoundEffects::render(effect, arg1, arg2, _timedSounds));
 		break;
 	}
 }
diff --git a/engines/ultima/ultima3/ultima3.h b/engines/ultima/ultima3/ultima3.h
index 84f5023365e..4004976325e 100644
--- a/engines/ultima/ultima3/ultima3.h
+++ b/engines/ultima/ultima3/ultima3.h
@@ -146,6 +146,7 @@ public:
 	bool _moreMonsters = false;
 	bool _lessHunger = false;
 	bool _moonIcons = true;
+	bool _timedSounds = false;
 
 	// Plays the Upgrade's MIDI music, if that's been turned on
 	Music _music;


Commit: ee21d468981b021a74c207a6002bb91a2a2cc274
    https://github.com/scummvm/scummvm/commit/ee21d468981b021a74c207a6002bb91a2a2cc274
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:41:03+11:00

Commit Message:
ULTIMA: ULTIMA3: Fixes the title screen rendering and SFX

Changed paths:
    engines/ultima/ultima3/sound_effects.cpp
    engines/ultima/ultima3/sound_effects.h
    engines/ultima/ultima3/ultima3.h
    engines/ultima/ultima3/views/title.cpp
    engines/ultima/ultima3/views/title.h


diff --git a/engines/ultima/ultima3/sound_effects.cpp b/engines/ultima/ultima3/sound_effects.cpp
index 371db00169c..330a446526b 100644
--- a/engines/ultima/ultima3/sound_effects.cpp
+++ b/engines/ultima/ultima3/sound_effects.cpp
@@ -37,6 +37,15 @@ constexpr uint32 TICK_HZ = 1193182 / 11;
 constexpr uint32 TOGGLE_CYCLES = 4 + 14;
 constexpr uint32 RANDOM_CYCLES = 1100;
 
+// The timer the upgrade counts the reveal of the title pictures by: the PC's
+// clock divided by 42
+constexpr uint32 SPARKLE_TICK_HZ = 1193182 / 42;
+
+// How long the original takes to deal with a part of a title picture that is
+// drawn, and one that is left out. The speaker is flipped for those drawn
+constexpr uint32 SPARKLE_DRAWN_CYCLES = 150;
+constexpr uint32 SPARKLE_SKIPPED_CYCLES = 120;
+
 constexpr int AMPLITUDE = 0x30;
 
 namespace {
@@ -239,6 +248,30 @@ void swirl(Speaker &s) {
 	}
 }
 
+// Turns when the speaker was flipped into samples
+Common::Array<byte> toSamples(Speaker &s, uint32 rate) {
+	// The speaker is let go of at the end
+	if (s._edges.size() & 1)
+		s._edges.push_back(s._cycles);
+
+	Common::Array<byte> samples;
+	uint32 total = (uint32)(((uint64)s._cycles * SoundEffects::SAMPLE_RATE) / rate) + 1;
+	samples.resize(total);
+
+	uint32 pos = 0;
+	bool high = false;
+	for (uint i = 0; i <= s._edges.size(); ++i) {
+		uint32 end = (i < s._edges.size()) ? (uint32)(((uint64)s._edges[i] * SoundEffects::SAMPLE_RATE) / rate) : total;
+		byte level = high ? 0x80 + AMPLITUDE : 0x80 - AMPLITUDE;
+
+		for (; pos < end && pos < total; ++pos)
+			samples[pos] = level;
+		high = !high;
+	}
+
+	return samples;
+}
+
 } // End of anonymous namespace
 
 Common::Array<byte> SoundEffects::render(byte effect, byte arg1, byte arg2, bool timed) {
@@ -275,31 +308,36 @@ Common::Array<byte> SoundEffects::render(byte effect, byte arg1, byte arg2, bool
 	case 0xF4:
 		swirl(s);
 		break;
+	case TITLE_BURST:
+		noise(s, 0x400, 0);
+		break;
 	default:
 		return Common::Array<byte>();
 	}
 
-	// The speaker is let go of at the end
-	if (s._edges.size() & 1)
-		s._edges.push_back(s._cycles);
-
-	Common::Array<byte> samples;
-	const uint32 rate = timed ? TICK_HZ : CPU_HZ;
-	uint32 total = (uint32)(((uint64)s._cycles * SAMPLE_RATE) / rate) + 1;
-	samples.resize(total);
+	return toSamples(s, timed ? TICK_HZ : CPU_HZ);
+}
 
-	uint32 pos = 0;
-	bool high = false;
-	for (uint i = 0; i <= s._edges.size(); ++i) {
-		uint32 end = (i < s._edges.size()) ? (uint32)(((uint64)s._edges[i] * SAMPLE_RATE) / rate) : total;
-		byte level = high ? 0x80 + AMPLITUDE : 0x80 - AMPLITUDE;
+Common::Array<byte> SoundEffects::renderSparkle(const Common::Array<bool> &revealed, bool timed) {
+	Speaker s(timed);
 
-		for (; pos < end && pos < total; ++pos)
-			samples[pos] = level;
-		high = !high;
+	for (uint i = 0; i < revealed.size(); ++i) {
+		if (timed) {
+			// A tick of the timer for each, with the speaker flipped for those that are drawn
+			if (revealed[i])
+				s.toggle();
+			++s._cycles;
+		} else {
+			if (revealed[i]) {
+				s.run(SPARKLE_DRAWN_CYCLES - TOGGLE_CYCLES);
+				s.toggle();
+			} else {
+				s.run(SPARKLE_SKIPPED_CYCLES);
+			}
+		}
 	}
 
-	return samples;
+	return toSamples(s, timed ? SPARKLE_TICK_HZ : CPU_HZ);
 }
 
 } // namespace Ultima3
diff --git a/engines/ultima/ultima3/sound_effects.h b/engines/ultima/ultima3/sound_effects.h
index e3825d21726..7785b3de89e 100644
--- a/engines/ultima/ultima3/sound_effects.h
+++ b/engines/ultima/ultima3/sound_effects.h
@@ -35,6 +35,11 @@ class SoundEffects {
 public:
 	static constexpr int SAMPLE_RATE = 44100;
 
+	/**
+	 * The effect that is the noise at the end of the title screen's pictures being drawn
+	 */
+	static constexpr byte TITLE_BURST = 0xF3;
+
 	/**
 	 * Works out the sound of an effect as unsigned 8-bit samples
 	 * @param effect	The effect number, from 0xF4 to 0xFD
@@ -45,6 +50,15 @@ public:
 	 * @returns			The samples, or nothing if the effect isn't a sound
 	 */
 	static Common::Array<byte> render(byte effect, byte arg1, byte arg2, bool timed = false);
+
+	/**
+	 * Works out the buzz made as a title picture is revealed bit by bit, a
+	 * pass of it at a time
+	 * @param revealed	Whether each bit of the pass was drawn rather than left out
+	 * @param timed		True to make the buzz as the Ultima III Upgrade does
+	 * @returns			The samples, which also give how long the pass takes
+	 */
+	static Common::Array<byte> renderSparkle(const Common::Array<bool> &revealed, bool timed);
 };
 
 } // namespace Ultima3
diff --git a/engines/ultima/ultima3/ultima3.h b/engines/ultima/ultima3/ultima3.h
index 4004976325e..c9ad196d8bf 100644
--- a/engines/ultima/ultima3/ultima3.h
+++ b/engines/ultima/ultima3/ultima3.h
@@ -91,12 +91,12 @@ private:
 	Audio::QueuingAudioStream *_effectStream = nullptr;
 	Audio::SoundHandle _effectHandle;
 
+public:
 	/**
 	 * Queues up the samples of a sound effect to be played
 	 */
 	void queueEffect(const Common::Array<byte> &samples);
 
-public:
 	/**
 	 * Queues a single square-wave note. divisor is the original's PIT
 	 * timer divisor (frequency = ~1193182/divisor), matching how each
diff --git a/engines/ultima/ultima3/views/title.cpp b/engines/ultima/ultima3/views/title.cpp
index 0c18dc98662..4211d08aecf 100644
--- a/engines/ultima/ultima3/views/title.cpp
+++ b/engines/ultima/ultima3/views/title.cpp
@@ -24,6 +24,7 @@
 #include "ultima/ultima3/gfx/composite.h"
 #include "ultima/ultima3/gfx/pic_decoder.h"
 #include "ultima/ultima3/gfx/pixels.h"
+#include "ultima/ultima3/sound_effects.h"
 #include "ultima/ultima3/ultima3.h"
 
 namespace Ultima {
@@ -36,8 +37,8 @@ namespace Views {
 // i.e. *8, dl=row count)
 static const TitleBox BOX1 = { 8, 8, 28, 264, 77 };
 static const TitleBox BOX4 = { 85, 85, 28, 264, 43 };
-static const TitleBox BOX5 = { 132, 132, 68, 72, 4 };
-static const TitleBox BOX6 = { 146, 146, 20, 40, 32 };
+static const TitleBox BOX5 = { 132, 132, 68, 32, 9 };
+static const TitleBox BOX6 = { 146, 146, 20, 256, 5 };
 static const TitleBox BOX2 = { 168, 168, 116, 88, 16 };
 static const TitleBox BOX3 = { 152, 168, 116, 96, 16 };
 
@@ -55,11 +56,20 @@ constexpr int FLAG_WIDTH = 92;
 constexpr int FLAG_HEIGHT = 16;
 constexpr byte PATH_COLOR_ENHANCED = 0x0B;
 
+constexpr int FRAME_MS = 50;
+
+// How long the upgrade holds the finished picture, which is 16 of its waits of 4 frame limiter
+// ticks of 55ms each, rather than the original's 5 of its slightly shorter waits
+constexpr int UPGRADE_FINAL_WAIT_FRAMES = 70;
 constexpr int WAIT_FRAMES_PER_UNIT = 5; // ~waitFrames(1)'s real-hardware duration, approximated
 
 Title::Title() : View("Title") {
 }
 
+bool Title::isUpgraded() const {
+	return _G(renderMode) != Data::RENDER_CGA;
+}
+
 void Title::loadPic(Graphics::ManagedSurface &surf, const Common::String &filename) {
 	Gfx::PicDecoder decoder;
 	Common::File f;
@@ -114,6 +124,7 @@ void Title::draw() {
 
 void Title::drawBox(const TitleBox &box, bool sparkle, int threshold) {
 	int wordCols = box.width / 8;
+	Common::Array<bool> revealedSteps;
 
 	for (int row = 0; row < box.height; ++row) {
 		for (int col = 0; col < wordCols; ++col) {
@@ -121,13 +132,21 @@ void Title::drawBox(const TitleBox &box, bool sparkle, int threshold) {
 			bool reveal = true;
 
 			if (sparkle) {
-				// The original's additive congruential generator:
-				// al' = (al+0x1D); al'' = al'+ah; ah' = al'
 				byte al = _prngState & 0xFF, ah = _prngState >> 8;
 				byte step1 = al + 0x1D;
-				byte newAl = step1 + ah;
-				_prngState = (step1 << 8) | newAl;
-				reveal = newAl <= threshold;
+
+				if (isUpgraded()) {
+					// The upgrade's, which takes what was the high byte, and adds to the low
+					_prngState = (step1 << 8) | ah;
+					reveal = ah <= threshold;
+				} else {
+					// The original's additive congruential generator:
+					// al' = (al+0x1D); al'' = al'+ah; ah' = al'
+					byte newAl = step1 + ah;
+					_prngState = (step1 << 8) | newAl;
+					reveal = newAl <= threshold;
+				}
+				revealedSteps.push_back(reveal);
 			}
 
 			for (int dx = 0; dx < 8; ++dx) {
@@ -138,9 +157,22 @@ void Title::drawBox(const TitleBox &box, bool sparkle, int threshold) {
 		}
 	}
 
+	if (sparkle)
+		playSparkle(revealedSteps);
+
 	redraw();
 }
 
+void Title::playSparkle(const Common::Array<bool> &revealed) {
+	// The pass takes as long as the buzz does, which is made as each bit is drawn
+	Common::Array<byte> samples = SoundEffects::renderSparkle(revealed, g_engine->_timedSounds);
+	if (g_engine->_soundEnabled)
+		g_engine->queueEffect(samples);
+
+	const int ms = (int)((uint64)samples.size() * 1000 / SoundEffects::SAMPLE_RATE);
+	_sparkleFrames = MAX(1, (ms + FRAME_MS * 4 / 5) / FRAME_MS);
+}
+
 void Title::drawFlagFrame(int bxParam, int axParam) {
 	if (Data::isEnhancedMode(_G(renderMode))) {
 		drawEnhancedFlagFrame(bxParam, axParam);
@@ -256,13 +288,7 @@ bool Title::tickWait() {
 }
 
 void Title::playSoundBurst() {
-	// The original toggles the PC speaker's raw output bit ~1024 times at a
-	// CPU-speed-dependent rate (no fixed PIT divisor is ever programmed);
-	// approximated here as a short buzzy burst rather than an exact tone
-	for (int i = 0; i < 8; ++i) {
-		g_engine->queueTone(1500, 20);
-		g_engine->queueTone(1800, 20);
-	}
+	g_engine->playSoundEffect(SoundEffects::TITLE_BURST);
 }
 
 void Title::timeout() {
@@ -276,7 +302,7 @@ void Title::timeout() {
 			drawBox(BOX1, true, _sparklePass * 4);
 			++_sparklePass;
 		}
-		delayFrames(1);
+		delayFrames(_phase == PH_BOX1_SPARKLE ? _sparkleFrames : 1);
 		break;
 
 	case PH_BOX1_WAIT:
@@ -296,7 +322,7 @@ void Title::timeout() {
 			drawBox(BOX4, true, _sparklePass * 4);
 			++_sparklePass;
 		}
-		delayFrames(1);
+		delayFrames(_phase == PH_BOX4_SPARKLE ? _sparkleFrames : 1);
 		break;
 
 	case PH_BOX4_WAIT:
@@ -394,7 +420,7 @@ void Title::timeout() {
 	case PH_BOX3:
 		drawBox(BOX3, false, 0);
 		_phase = PH_BOX3_WAIT;
-		_waitCounter = 5 * WAIT_FRAMES_PER_UNIT;
+		_waitCounter = isUpgraded() ? UPGRADE_FINAL_WAIT_FRAMES : 5 * WAIT_FRAMES_PER_UNIT;
 		delayFrames(1);
 		break;
 
diff --git a/engines/ultima/ultima3/views/title.h b/engines/ultima/ultima3/views/title.h
index 1cf626b0046..cb81ce7d29f 100644
--- a/engines/ultima/ultima3/views/title.h
+++ b/engines/ultima/ultima3/views/title.h
@@ -81,6 +81,9 @@ private:
 	// unconditional final full-detail pass
 	int _sparklePass = 0;
 
+	// How many frames the last pass of a sparkle takes, which is how long its buzz lasts
+	int _sparkleFrames = 1;
+
 	// drawAnimatedPixelPath (NAME.DAT) sub-state: byte offset of the next
 	// (length, row) pair
 	uint _pixelPathPos = 0;
@@ -99,6 +102,13 @@ private:
 	void loadPic(Graphics::ManagedSurface &surf, const Common::String &filename);
 	void loadRaw(Common::Array<byte> &data, const Common::String &filename);
 
+	// Returns true if the picture is being shown any way other than the original CGA, which
+	// has the upgrade's changes to the title screen
+	bool isUpgraded() const;
+
+	// Makes the buzz for a pass of a sparkle and works out how long it takes
+	void playSparkle(const Common::Array<bool> &revealed);
+
 	// Reveals one word-column (8 px) of `box` per PRNG roll when sparkle is
 	// true (drawSparkleBox's ah=0FFh mode); a plain full copy otherwise
 	void drawBox(const TitleBox &box, bool sparkle, int threshold);


Commit: fbda6009ab23e6bf5fdee3165fccd23e1e276fcb
    https://github.com/scummvm/scummvm/commit/fbda6009ab23e6bf5fdee3165fccd23e1e276fcb
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:41:03+11:00

Commit Message:
ULTIMA: ULTIMA2: Added Upgrade Patch EGA monster and helm map colors

Changed paths:
    engines/ultima/ultima2/data/tiles.cpp
    engines/ultima/ultima2/data/tiles.h
    engines/ultima/ultima2/views/dungeon_map.cpp
    engines/ultima/ultima2/views/helm_map.cpp


diff --git a/engines/ultima/ultima2/data/tiles.cpp b/engines/ultima/ultima2/data/tiles.cpp
index 0db2aced90b..2dce4bb19bf 100644
--- a/engines/ultima/ultima2/data/tiles.cpp
+++ b/engines/ultima/ultima2/data/tiles.cpp
@@ -165,6 +165,56 @@ void loadAttackSprite(Graphics::ManagedSurface &sprite, RenderMode mode) {
 	decodeTileRecord(record, sprite);
 }
 
+// The colors the driver starts with, kept if a theme has no EGACOLOR of its own
+static const byte DEFAULT_EGA_COLORS[EGA_COLORS_SIZE] = {
+	0x0F, 0x02, 0x04, 0x0C, 0x09, 0x00, 0x00, 0x00, 0x0B, 0x0D, 0x0F, 0x0D, 0x0C, 0x0C, 0x09, 0x0F,
+	0x0F, 0x09, 0x0C, 0x0E, 0x01, 0x03, 0x02, 0x0A, 0x08, 0x0E, 0x04, 0x0B, 0x0D, 0x07, 0x0F, 0x08
+};
+
+const byte *egaColors(RenderMode mode) {
+	static byte colors[EGA_COLORS_SIZE];
+	static RenderMode loadedMode = RENDER_MODE_COUNT;
+
+	if (mode != loadedMode) {
+		loadedMode = mode;
+		memcpy(colors, DEFAULT_EGA_COLORS, EGA_COLORS_SIZE);
+
+		Common::ScopedPtr<Common::SeekableReadStream> f(openEgaFile(mode, "egacolor"));
+		if (f)
+			f->read(colors, EGA_COLORS_SIZE);
+	}
+
+	return colors;
+}
+
+int egaIconCategory(TileId tile) {
+	// Individual terrain types get a category of their own, and the rest by range
+	switch (tile) {
+	case TILE_WATER:
+		return 0;
+	case TILE_SWAMP:
+		return 1;
+	case TILE_GRASS:
+		return 2;
+	case TILE_FOREST:
+		return 3;
+	case TILE_MOUNTAIN:
+		return 4;
+	case TILE_FORCEFIELD:
+		return 5;
+	case TILE_ROAD:
+		return 6;
+	case TILE_MOONGATE:
+		return 7;
+	default:
+		break;
+	}
+
+	if (tile <= TILE_SIGNPOST)
+		return 8;
+	return (tile <= TILE_TITHE_ALTAR || tile > TILE_COUNTER_END_LEFT) ? 9 : 10;
+}
+
 void scrollTileRows(Graphics::Surface &tile, int rows) {
 	byte copy[TILE_WIDTH * TILE_HEIGHT];
 	byte *pixels = (byte *)tile.getPixels();
diff --git a/engines/ultima/ultima2/data/tiles.h b/engines/ultima/ultima2/data/tiles.h
index 354f9ab2c4c..69fe1c3a5c7 100644
--- a/engines/ultima/ultima2/data/tiles.h
+++ b/engines/ultima/ultima2/data/tiles.h
@@ -70,6 +70,22 @@ void loadTiles(Graphics::Surface tiles[TILE_COUNT], RenderMode mode);
  */
 void loadAttackSprite(Graphics::ManagedSurface &sprite, RenderMode mode);
 
+/**
+ * The EGA renderers' color tables, from the theme's EGACOLOR file or the driver's built-in
+ * defaults if it has none. The first 8 entries give the color of a dungeon monster's blocks by
+ * its facing/type, and the 11 from EGA_ICON_COLORS are the helm map's colors by terrain category
+ */
+constexpr int EGA_COLORS_SIZE = 32;
+constexpr int EGA_MONSTER_COLORS = 0;
+constexpr int EGA_ICON_COLORS = 20;
+constexpr int EGA_ICON_CATEGORIES = 11;
+const byte *egaColors(RenderMode mode);
+
+/**
+ * Returns which of the helm map's EGA_ICON_CATEGORIES color a tile is drawn with
+ */
+int egaIconCategory(TileId tile);
+
 /**
  * Scrolls a tile's rows upwards with wraparound, which is how the water and
  * forcefield tiles animate
diff --git a/engines/ultima/ultima2/views/dungeon_map.cpp b/engines/ultima/ultima2/views/dungeon_map.cpp
index 6292d949bb2..7c129a677ae 100644
--- a/engines/ultima/ultima2/views/dungeon_map.cpp
+++ b/engines/ultima/ultima2/views/dungeon_map.cpp
@@ -142,18 +142,19 @@ const byte SPRITE_BAND_OFFSETS[MAX_DEPTH] = { 0, 0, 0x80, 0xC0, 0xE0, 0xF0, 0xF8
 class Painter {
 private:
 	Graphics::Views::GfxSurface &_s;
+	byte _color;
 
 	void plot(byte x, byte y) {
 		int px = x + VIEW_OFFSET, py = y + VIEW_OFFSET;
 		if (px < 320 && py < 160)
-			_s.setPixel(px, py, COLOR_LINE);
+			_s.setPixel(px, py, _color);
 	}
 
 public:
 	byte _x1 = 0, _y1 = 0, _x2 = 0, _y2 = 0;
 	int _depth = 0;
 
-	Painter(Graphics::Views::GfxSurface &s) : _s(s) {
+	Painter(Graphics::Views::GfxSurface &s, byte color) : _s(s), _color(color) {
 	}
 
 	/**
@@ -507,7 +508,8 @@ int DungeonMap::drawCorridor(Graphics::Views::GfxSurface &s) {
 		ry = y + fy;
 	}
 
-	Painter p(s);
+	Painter p(s, Data::isEgaMode(g_engine->getRenderMode()) ?
+		Data::EGA_PALETTE_BASE + 15 : COLOR_LINE);
 	p._depth = 0;
 	p.frontWall();
 
@@ -567,15 +569,23 @@ void DungeonMap::drawMonster(Graphics::Views::GfxSurface &s, const byte *monster
 
 		// Only the nearest monster in view is drawn
 		int offset = (d == 1) ? monsters[d] * 256 : SPRITE_BAND_OFFSETS[d];
+		Data::RenderMode mode = g_engine->getRenderMode();
+		bool ega = Data::isEgaMode(mode);
+
 		while (offset + 1 < (int)sizeof(_monsterSprites) && _monsterSprites[offset] != 0) {
 			int x = (_monsterSprites[offset] + 4) * 4;
 			int y = (_monsterSprites[offset + 1] & 0x1F) * 4 + VIEW_OFFSET;
-			byte pattern = SPRITE_PATTERNS[_monsterSprites[offset + 1] >> 5];
+			byte facing = _monsterSprites[offset + 1] >> 5;
+			byte pattern = SPRITE_PATTERNS[facing];
 			offset += 2;
 
+			// The EGA renderers fill the block with a color for the facing instead of a pattern
+			byte color = ega ? Data::EGA_PALETTE_BASE +
+				Data::egaColors(mode)[Data::EGA_MONSTER_COLORS + facing] : 0;
+
 			for (int row = 0; row < 4; ++row) {
 				for (int col = 0; col < 4; ++col)
-					s.setPixel(x + col, y + row, (pattern >> ((3 - col) * 2)) & 3);
+					s.setPixel(x + col, y + row, ega ? color : (pattern >> ((3 - col) * 2)) & 3);
 			}
 		}
 
@@ -595,10 +605,13 @@ void DungeonMap::draw() {
 		drawMinimap(s);
 
 	if (_inverted) {
+		// Inverts the bits of the color, which for the EGA colors is all four
+		const bool ega = Data::isEgaMode(g_engine->getRenderMode());
+
 		for (int y = 0; y < s.h; ++y) {
 			byte *pixels = (byte *)s.getBasePtr(0, y);
 			for (int x = 0; x < s.w; ++x)
-				pixels[x] ^= 3;
+				pixels[x] = ega ? Data::EGA_PALETTE_BASE + ((pixels[x] ^ 0xF) & 0xF) : pixels[x] ^ 3;
 		}
 
 		s.markAllDirty();
diff --git a/engines/ultima/ultima2/views/helm_map.cpp b/engines/ultima/ultima2/views/helm_map.cpp
index cbf1067b294..a6220da58f1 100644
--- a/engines/ultima/ultima2/views/helm_map.cpp
+++ b/engines/ultima/ultima2/views/helm_map.cpp
@@ -50,6 +50,17 @@ void HelmMap::plotIcon(Graphics::Views::GfxSurface &s, int cellX, int cellY, Dat
 	const byte (*points)[2];
 	int count;
 
+	if (Data::isEgaMode(g_engine->getRenderMode())) {
+		// The EGA renderers fill each cell's block with a color for its terrain, water included
+		byte color = Data::egaColors(g_engine->getRenderMode())[Data::EGA_ICON_COLORS + Data::egaIconCategory(tile)];
+		int bx = cellX * 4 + VIEW_OFFSET, by = cellY * 2 + VIEW_OFFSET;
+		for (int y = 0; y < 2; ++y) {
+			for (int x = 0; x < 4; ++x)
+				s.setPixel(bx + x, by + y, Data::EGA_PALETTE_BASE + color);
+		}
+		return;
+	}
+
 	if (tile == Data::TILE_WATER) {
 		return;
 	} else if (tile == Data::TILE_MOUNTAIN || (tile >= Data::TILE_WALL && tile <= Data::TILE_COUNTER_END_LEFT)) {


Commit: 41befa6d7c3289280f2bbdfff00f7ca39c412d46
    https://github.com/scummvm/scummvm/commit/41befa6d7c3289280f2bbdfff00f7ca39c412d46
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:41:03+11:00

Commit Message:
ULTIMA: ULTIMA2: Added composite mode decoding to the space flight view

Changed paths:
    engines/ultima/ultima2/gfx/composite.cpp
    engines/ultima/ultima2/gfx/composite.h
    engines/ultima/ultima2/views/space_map.cpp
    engines/ultima/ultima2/views/space_map.h


diff --git a/engines/ultima/ultima2/gfx/composite.cpp b/engines/ultima/ultima2/gfx/composite.cpp
index ad7c5f8ad41..0337b1d089f 100644
--- a/engines/ultima/ultima2/gfx/composite.cpp
+++ b/engines/ultima/ultima2/gfx/composite.cpp
@@ -95,6 +95,37 @@ void compositeDecode(Graphics::ManagedSurface &surf, const Common::Rect &area) {
 	surf.markAllDirty();
 }
 
+void compositeDecodeFrom(const byte *src, Graphics::ManagedSurface &dst, const Common::Rect &area) {
+	if (!g_tableReady)
+		buildTable();
+
+	Common::Rect r = area;
+	r.clip(Common::Rect(dst.w, dst.h));
+	if (r.isEmpty())
+		return;
+
+	const int w = dst.w;
+	auto cga = [&](int x, int y) -> int {
+		return src[y * w + x] & 3;
+	};
+
+	for (int y = r.top; y < r.bottom; ++y) {
+		byte *out = (byte *)dst.getBasePtr(0, y);
+
+		// Pairs are aligned to even columns of the whole picture
+		for (int x = r.left & ~1; x < r.right; x += 2) {
+			int p0 = (x > 0) ? cga(x - 1, y) : 0;
+			int p3 = (x + 2 < w) ? cga(x + 2, y) : ((y + 2 < dst.h) ? cga(0, y + 2) : 0);
+			int window = (p0 << 6) | (cga(x, y) << 4) | (cga(x + 1, y) << 2) | p3;
+
+			out[x] = Data::COMPOSITE_PALETTE_BASE + g_leftColor[window];
+			out[x + 1] = Data::COMPOSITE_PALETTE_BASE + g_rightColor[window];
+		}
+	}
+
+	dst.addDirtyRect(Common::Rect(r.left & ~1, r.top, MIN<int>(r.right + 1, w), r.bottom));
+}
+
 void compositeFinish(Graphics::ManagedSurface &surf, const Common::Rect &area) {
 	if (g_engine->getRenderMode() == Data::RENDER_CGA_COMPOSITE)
 		compositeDecode(surf, area);
diff --git a/engines/ultima/ultima2/gfx/composite.h b/engines/ultima/ultima2/gfx/composite.h
index 1d662621cac..56c0f8c6679 100644
--- a/engines/ultima/ultima2/gfx/composite.h
+++ b/engines/ultima/ultima2/gfx/composite.h
@@ -36,6 +36,14 @@ namespace Gfx {
  */
 void compositeDecode(Graphics::ManagedSurface &surf, const Common::Rect &area);
 
+/**
+ * Decodes part of a picture held elsewhere as CGA-indexed pixels, with the
+ * same dimensions as the destination, rather than in the destination itself.
+ * Used by views that change pixels one at a time, so that what's drawn already
+ * isn't lost. The area is widened to take in the pixel pairs it touches
+ */
+void compositeDecodeFrom(const byte *src, Graphics::ManagedSurface &dst, const Common::Rect &area);
+
 /**
  * Called by views of CGA-indexed graphics once they've finished drawing:
  * decodes the area if the composite renderer is the active one, and does
diff --git a/engines/ultima/ultima2/views/space_map.cpp b/engines/ultima/ultima2/views/space_map.cpp
index 398729247c0..44629bd61f1 100644
--- a/engines/ultima/ultima2/views/space_map.cpp
+++ b/engines/ultima/ultima2/views/space_map.cpp
@@ -19,6 +19,7 @@
  *
  */
 
+#include "ultima/ultima2/gfx/composite.h"
 #include "ultima/ultima2/views/space_map.h"
 #include "ultima/ultima2/logic/space_logic.h"
 #include "ultima/ultima2/ultima2.h"
@@ -38,6 +39,14 @@ constexpr int WARP_STEPS_PER_TICK = 2;
 
 SpaceMap::SpaceMap() : View("SpaceMap") {
 	setBounds(Graphics::Views::TextRect(0, 0, 39, 24));
+	_staging.resize(320 * 200);
+}
+
+bool SpaceMap::msgGame(const GameMessage &msg) {
+	// The starfield is drawn differently by the composite renderer
+	if (msg._name == "RELOAD_TILES")
+		redraw();
+	return false;
 }
 
 void SpaceMap::seedStars() {
@@ -89,7 +98,15 @@ bool SpaceMap::msgKeypress(const KeypressMessage &msg) {
 }
 
 void SpaceMap::plot(Graphics::Views::GfxSurface &s, int x, int y, int color) {
-	s.setPixel(x + VIEW_OFFSET, y + VIEW_OFFSET, color);
+	int px = x + VIEW_OFFSET, py = y + VIEW_OFFSET;
+	if (px < 0 || px >= s.w || py < 0 || py >= s.h)
+		return;
+
+	_staging[py * s.w + px] = color;
+	if (g_engine->getRenderMode() == Data::RENDER_CGA_COMPOSITE)
+		Gfx::compositeDecodeFrom(&_staging[0], s, Common::Rect(px - 1, py, px + 2, py + 1));
+	else
+		s.setPixel(px, py, color);
 }
 
 void SpaceMap::drawMarker(Graphics::Views::GfxSurface &s, int color) {
@@ -112,6 +129,7 @@ void SpaceMap::setShip(byte x, byte y) {
 void SpaceMap::draw() {
 	auto s = getSurface();
 	s.fillRect(Common::Rect(0, 0, 320, 160), 0);
+	memset(&_staging[0], 0, 320 * 160);
 
 	for (int i = 0; i < STAR_COUNT; ++i)
 		plot(s, _starX[i], _starY[i], COLOR_STAR);
diff --git a/engines/ultima/ultima2/views/space_map.h b/engines/ultima/ultima2/views/space_map.h
index 6dcc5a786cf..dff1b29e720 100644
--- a/engines/ultima/ultima2/views/space_map.h
+++ b/engines/ultima/ultima2/views/space_map.h
@@ -22,6 +22,7 @@
 #ifndef ULTIMA2_VIEWS_SPACE_MAP_H
 #define ULTIMA2_VIEWS_SPACE_MAP_H
 
+#include "common/array.h"
 #include "ultima/shared/engine/view.h"
 #include "ultima/ultima2/views/space_stats.h"
 
@@ -55,6 +56,10 @@ private:
 	Phase _phase = PHASE_IDLE;
 	int _counter = 0;
 
+	// The CGA colors of the starfield, since the composite renderer
+	// colors a pixel by its neighbors and so can't read them back off the screen
+	Common::Array<byte> _staging;
+
 	void seedStars();
 	void plot(Graphics::Views::GfxSurface &s, int x, int y, int color);
 	void drawMarker(Graphics::Views::GfxSurface &s, int color);
@@ -95,6 +100,7 @@ public:
 	 */
 	byte nextStarCoord();
 
+	bool msgGame(const GameMessage &msg) override;
 	bool msgFocus(const FocusMessage &msg) override;
 	bool msgUnfocus(const UnfocusMessage &msg) override;
 	bool msgAction(const ActionMessage &msg) override;


Commit: 0ad64777ab9f64c1a5fad38d6bcebd4890f0e925
    https://github.com/scummvm/scummvm/commit/0ad64777ab9f64c1a5fad38d6bcebd4890f0e925
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:41:03+11:00

Commit Message:
ULTIMA: ULTIMA2: Added the Upgrade Patch Alt-X, Alt-R and Alt-M hotkeys

Changed paths:
    engines/ultima/ultima2/ultima2.cpp
    engines/ultima/ultima2/ultima2.h


diff --git a/engines/ultima/ultima2/ultima2.cpp b/engines/ultima/ultima2/ultima2.cpp
index 09647600508..56d2eb04619 100644
--- a/engines/ultima/ultima2/ultima2.cpp
+++ b/engines/ultima/ultima2/ultima2.cpp
@@ -59,6 +59,29 @@ Common::String Ultima2Engine::getGameId() const {
 	return _gameDescription->desc.gameId;
 }
 
+bool Ultima2Engine::msgKeypress(const Graphics::Views::KeypressMessage &msg) {
+	if (msg.flags & Common::KBD_ALT) {
+		switch (msg.keycode) {
+		case Common::KEYCODE_x:
+			quitGame();
+			return true;
+
+		case Common::KEYCODE_r:
+			loadGameDialog();
+			return true;
+
+		case Common::KEYCODE_m:
+			replaceView("Title", true);
+			return true;
+
+		default:
+			break;
+		}
+	}
+
+	return Shared::Events::msgKeypress(msg);
+}
+
 // The graphics renderer mode stored in the configuration, falling back to
 // the default for the version of the game if it's missing or stale
 static Data::RenderMode configuredRenderMode(bool enhanced) {
diff --git a/engines/ultima/ultima2/ultima2.h b/engines/ultima/ultima2/ultima2.h
index 1db9ab06313..fcff5e99368 100644
--- a/engines/ultima/ultima2/ultima2.h
+++ b/engines/ultima/ultima2/ultima2.h
@@ -60,6 +60,12 @@ protected:
 		return Engine::shouldQuit();
 	}
 
+	/**
+	 * Handles the upgrade's Alt hotkeys, which work from anywhere: X to exit,
+	 * R to restore a saved game, and M to go back to the title
+	 */
+	bool msgKeypress(const Graphics::Views::KeypressMessage &msg) override;
+
 private:
 	// 6-byte lagged-Fibonacci-style state for randByte(), matching the
 	// original's rand_byte generator


Commit: 233fb66756d198cc230909873f8cb2f0e86e2c0a
    https://github.com/scummvm/scummvm/commit/233fb66756d198cc230909873f8cb2f0e86e2c0a
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:41:03+11:00

Commit Message:
ULTIMA: ULTIMA2: Added the Upgrade Patch's stat boost choice as a game option

Changed paths:
  A engines/ultima/ultima2/views/interactions/stat_boost.cpp
  A engines/ultima/ultima2/views/interactions/stat_boost.h
    engines/ultima/detection.h
    engines/ultima/detection_tables.h
    engines/ultima/metaengine.cpp
    engines/ultima/module.mk
    engines/ultima/ultima2/logic/city_castle_logic.cpp
    engines/ultima/ultima2/logic/city_castle_logic.h
    engines/ultima/ultima2/logic/logic.h
    engines/ultima/ultima2/ultima2.cpp
    engines/ultima/ultima2/ultima2.h
    engines/ultima/ultima2/views/views.h


diff --git a/engines/ultima/detection.h b/engines/ultima/detection.h
index b9e4d4ef743..5f16f5de19b 100644
--- a/engines/ultima/detection.h
+++ b/engines/ultima/detection.h
@@ -86,6 +86,7 @@ struct UltimaGameDescription {
 #define GAMEOPTION_ULTIMA3_MOON_ICONS    GUIO_GAMEOPTIONS14
 #define GAMEOPTION_ULTIMA3_MIDI_MUSIC    GUIO_GAMEOPTIONS15
 #define GAMEOPTION_ULTIMA3_TIMED_SOUNDS  GUIO_GAMEOPTIONS16
+#define GAMEOPTION_ULTIMA2_STAT_BOOST    GUIO_GAMEOPTIONS17
 
 } // End of namespace Ultima
 
diff --git a/engines/ultima/detection_tables.h b/engines/ultima/detection_tables.h
index f613e6a7f79..750339ff6a1 100644
--- a/engines/ultima/detection_tables.h
+++ b/engines/ultima/detection_tables.h
@@ -23,7 +23,7 @@ namespace Ultima {
 
 #define GUI_OPTIONS_ULTIMA0	GUIO0()
 #define GUI_OPTIONS_ULTIMA1	GUIO0()
-#define GUI_OPTIONS_ULTIMA2	GUIO0()
+#define GUI_OPTIONS_ULTIMA2	GUIO1(GAMEOPTION_ULTIMA2_STAT_BOOST)
 #define GUI_OPTIONS_ULTIMA3	GUIO5(GAMEOPTION_ULTIMA3_MORE_MONSTERS, GAMEOPTION_ULTIMA3_LESS_HUNGER, GAMEOPTION_ULTIMA3_MOON_ICONS, GAMEOPTION_ULTIMA3_MIDI_MUSIC, GAMEOPTION_ULTIMA3_TIMED_SOUNDS)
 #define GUI_OPTIONS_ULTIMA4	GUIO1(GUIO_NOSPEECH)
 #define GUI_OPTIONS_ULTIMA6	GUIO0()
diff --git a/engines/ultima/metaengine.cpp b/engines/ultima/metaengine.cpp
index 3a7faa03a5b..633e2c6ecfe 100644
--- a/engines/ultima/metaengine.cpp
+++ b/engines/ultima/metaengine.cpp
@@ -174,6 +174,17 @@ static const ADExtraGuiOptionsMap optionsList[] = {
 			0
 		}
 	},
+	{
+		GAMEOPTION_ULTIMA2_STAT_BOOST,
+		{
+			_s("Choose the attribute to boost"),
+			_s("Lets you choose which attribute is raised by the \"ALAKAZAM!\" gift from the Offer command, as the Ultima II Upgrade does, instead of it being random"),
+			"stat_boost_choice",
+			false,
+			0,
+			0
+		}
+	},
 	{
 		GAMEOPTION_ULTIMA3_MORE_MONSTERS,
 		{
@@ -257,9 +268,15 @@ GUI::OptionsContainerWidget *UltimaMetaEngine::buildEngineOptionsWidget(GUI::Gui
 	if (getGameId(target) == "ultima2" || getGameId(target) == "ultima2_enh") {
 		// The enhanced version starts off using the best of the graphics
 		const bool enhanced = getGameId(target) == "ultima2_enh";
+		ExtraGuiOptions options = getExtraGuiOptions(target);
+		if (enhanced) {
+			for (uint i = 0; i < options.size(); ++i)
+				options[i].defaultState = true;
+		}
+
 		return new Ultima::Shared::GraphicsOptionsWidget(boss, name, target,
 			Ultima::Ultima2::Data::RENDER_MODE_LABELS, Ultima::Ultima2::Data::RENDER_MODE_COUNT,
-			ExtraGuiOptions(), true,
+			options, true,
 			enhanced ? Ultima::Ultima2::Data::RENDER_EGA : Ultima::Ultima2::Data::RENDER_CGA);
 	}
 #endif
diff --git a/engines/ultima/module.mk b/engines/ultima/module.mk
index f792fb92058..2a5a8b2c532 100644
--- a/engines/ultima/module.mk
+++ b/engines/ultima/module.mk
@@ -155,6 +155,7 @@ MODULE_OBJS += \
 	ultima2/views/interactions/ready_weapon.o \
 	ultima2/views/interactions/rocket_landing.o \
 	ultima2/views/interactions/shop.o \
+	ultima2/views/interactions/stat_boost.o \
 	ultima2/views/interactions/transport.o \
 	ultima2/views/interactions/wear_armor.o \
 	ultima2/views/interactions/yell.o
diff --git a/engines/ultima/ultima2/logic/city_castle_logic.cpp b/engines/ultima/ultima2/logic/city_castle_logic.cpp
index d15ca24df87..7f636003eb1 100644
--- a/engines/ultima/ultima2/logic/city_castle_logic.cpp
+++ b/engines/ultima/ultima2/logic/city_castle_logic.cpp
@@ -371,21 +371,26 @@ void CityCastleLogic::completeOffer(int goldHundreds) {
 	}
 
 	default:
+		if (g_engine->_statBoostChoice) {
+			// The upgrade lets the player pick the attribute
+			writeString("1-STR, 2-AGI, 3-STA, 4-CHA, 5-WIS, 6-INT,\nYOUR INTEREST? ");
+			_offerBoost = goldHundreds;
+			g_engine->addView("StatBoost");
+			return;
+		}
+
 		int stat = randByte() & 7;
 		if (stat >= 6) {
 			writeString("THANK YOU VERY MUCH!\n");
 		} else {
-			int16 *attrs[6] = {
-				&sg._strength, &sg._agility, &sg._stamina,
-				&sg._charisma, &sg._wisdom, &sg._intelligence
-			};
-			// The original adds goldHundreds in 4 unclamped BCD steps, so a
-			// big enough boost wraps back down past 0. The 1989 "Ultima II
-			// Upgrade" patch clamps each of the 4 steps to 99 instead;
-			// since the same amount is added every step, clamping the
-			// combined total once here gives the same result
-			*attrs[stat] = (int16)MIN(*attrs[stat] + 4 * goldHundreds, Data::MAX_BCD_BYTE);
-			writeString("ALAKAZAM!\n");
+			// The upgrade moves on to the next attribute down if the one rolled is already at 99
+			for (int i = 0; i < 6 && attribute(stat) >= Data::MAX_BCD_BYTE; ++i)
+				stat = (stat + 5) % 6;
+
+			if (attribute(stat) < Data::MAX_BCD_BYTE)
+				boostAttribute(stat, goldHundreds);
+			else
+				writeString("THANK YOU VERY MUCH!\n");
 		}
 		break;
 	}
@@ -393,6 +398,34 @@ void CityCastleLogic::completeOffer(int goldHundreds) {
 	resumeTurn();
 }
 
+int16 &CityCastleLogic::attribute(int stat) const {
+	Data::Savegame &sg = _G(savegame);
+	int16 *attrs[6] = {
+		&sg._strength, &sg._agility, &sg._stamina,
+		&sg._charisma, &sg._wisdom, &sg._intelligence
+	};
+	return *attrs[stat];
+}
+
+void CityCastleLogic::boostAttribute(int stat, int goldHundreds) {
+	// The original adds goldHundreds in 4 unclamped BCD steps, so a big enough
+	// boost wraps back down past 0. The 1989 "Ultima II Upgrade" patch clamps
+	// each of the 4 steps to 99 instead; since the same amount is added every
+	// step, clamping the combined total once here gives the same result
+	int16 &value = attribute(stat);
+	value = (int16)MIN(value + 4 * goldHundreds, Data::MAX_BCD_BYTE);
+	writeString("ALAKAZAM!\n");
+}
+
+void CityCastleLogic::completeStatBoost(int choice) {
+	if (choice >= 1 && choice <= 6)
+		boostAttribute(choice - 1, _offerBoost);
+	else
+		writeString("THANK YOU VERY MUCH!\n");
+
+	resumeTurn();
+}
+
 bool CityCastleLogic::tithe() {
 	Data::Savegame &sg = _G(savegame);
 	writeString("WELCOME MY CHILD %s\nFIRST MY 50 G.P. TRIBUTE!\n", sg._name);
diff --git a/engines/ultima/ultima2/logic/city_castle_logic.h b/engines/ultima/ultima2/logic/city_castle_logic.h
index 8f442e64153..a2e3b21b34d 100644
--- a/engines/ultima/ultima2/logic/city_castle_logic.h
+++ b/engines/ultima/ultima2/logic/city_castle_logic.h
@@ -42,6 +42,19 @@ private:
 	// interaction resolving and the OfferGold interaction completing
 	int _offerTargetSlot = -1;
 
+	// The hundreds of gold offered, held while the attribute to boost is chosen
+	int _offerBoost = 0;
+
+	/**
+	 * Returns a reference to one of the six attributes, from strength to intelligence
+	 */
+	int16 &attribute(int stat) const;
+
+	/**
+	 * Raises an attribute (0 to 5) for an offer that was worth it
+	 */
+	void boostAttribute(int stat, int goldHundreds);
+
 	/**
 	 * Returns true if a shopkeeper is currently standing at (x,y)
 	 */
@@ -75,6 +88,7 @@ public:
 	bool offer(Data::Direction dir) override;
 	bool transact(Data::Direction dir) override;
 	void completeOffer(int goldHundreds) override;
+	void completeStatBoost(int choice) override;
 };
 
 } // namespace Logic
diff --git a/engines/ultima/ultima2/logic/logic.h b/engines/ultima/ultima2/logic/logic.h
index 942a642d3c9..0c4320d6e30 100644
--- a/engines/ultima/ultima2/logic/logic.h
+++ b/engines/ultima/ultima2/logic/logic.h
@@ -178,6 +178,13 @@ public:
 	virtual void completeOffer(int goldHundreds) {
 	}
 
+	/**
+	 * Called once an attribute has been chosen by the StatBoost interaction
+	 * (1 to 6, anything else being none of them)
+	 */
+	virtual void completeStatBoost(int choice) {
+	}
+
 	/**
 	 * Called once per game frame for any logic updates
 	 */
diff --git a/engines/ultima/ultima2/ultima2.cpp b/engines/ultima/ultima2/ultima2.cpp
index 56d2eb04619..7225dbb56de 100644
--- a/engines/ultima/ultima2/ultima2.cpp
+++ b/engines/ultima/ultima2/ultima2.cpp
@@ -45,6 +45,7 @@ Ultima2Engine::Ultima2Engine(OSystem *syst, const Ultima::UltimaGameDescription
 		Engine(syst), Shared::Events("ultima2"), _gameDescription(gameDesc) {
 	g_engine = this;
 	_pcSpeaker = new Audio::PCSpeaker();
+	loadOptions();
 }
 
 Ultima2Engine::~Ultima2Engine() {
@@ -55,6 +56,14 @@ uint32 Ultima2Engine::getFeatures() const {
 	return _gameDescription->desc.flags;
 }
 
+bool Ultima2Engine::isEnhanced() const {
+	return (_gameDescription->features & GF_ENHANCED) != 0;
+}
+
+void Ultima2Engine::loadOptions() {
+	_statBoostChoice = Shared::configuredOption("stat_boost_choice", isEnhanced());
+}
+
 Common::String Ultima2Engine::getGameId() const {
 	return _gameDescription->desc.gameId;
 }
@@ -115,7 +124,7 @@ Common::Error Ultima2Engine::run() {
 	}
 
 	// Restore the player's preferred renderer
-	_renderMode = configuredRenderMode((_gameDescription->features & GF_ENHANCED) != 0);
+	_renderMode = configuredRenderMode(isEnhanced());
 
 	// Set the palette now that the engine data is available, since the
 	// composite renderer's colors come from a file in it
@@ -274,8 +283,9 @@ void Ultima2Engine::playFX(Data::SoundEffect fx) {
 }
 
 void Ultima2Engine::applyGameSettings() {
-	// The graphics mode can be changed from the in-game options dialog
-	setRenderMode(configuredRenderMode((_gameDescription->features & GF_ENHANCED) != 0));
+	// The options can be changed from the in-game options dialog
+	loadOptions();
+	setRenderMode(configuredRenderMode(isEnhanced()));
 }
 
 void Ultima2Engine::setRenderMode(Data::RenderMode mode) {
diff --git a/engines/ultima/ultima2/ultima2.h b/engines/ultima/ultima2/ultima2.h
index fcff5e99368..42ed6163f99 100644
--- a/engines/ultima/ultima2/ultima2.h
+++ b/engines/ultima/ultima2/ultima2.h
@@ -92,6 +92,10 @@ public:
 	Data::MapDungeon _dungeon;
 	Common::SharedPtr<Logic::Logic> _logic;
 
+	// Lets the player choose which attribute the Offer command's gift raises,
+	// as in the Ultima II Upgrade, rather than it being random
+	bool _statBoostChoice = false;
+
 	// Debug flag toggled by the "intangible" console command, allowing
 	// movement through normally impassable terrain
 	bool _intangible = false;
@@ -99,12 +103,22 @@ public:
 private:
 	Data::RenderMode _renderMode = Data::RENDER_CGA;
 
+	/**
+	 * Reads the game options from the configuration
+	 */
+	void loadOptions();
+
 public:
 	Ultima2Engine(OSystem *syst, const Ultima::UltimaGameDescription *gameDesc);
 	~Ultima2Engine() override;
 
 	uint32 getFeatures() const;
 
+	/**
+	 * Returns true for the version with the Ultima II Upgrade applied
+	 */
+	bool isEnhanced() const;
+
 	/**
 	 * Returns the game Id
 	 */
diff --git a/engines/ultima/ultima2/views/interactions/stat_boost.cpp b/engines/ultima/ultima2/views/interactions/stat_boost.cpp
new file mode 100644
index 00000000000..e5836d2a977
--- /dev/null
+++ b/engines/ultima/ultima2/views/interactions/stat_boost.cpp
@@ -0,0 +1,49 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "ultima/ultima2/views/interactions/stat_boost.h"
+#include "ultima/ultima2/ultima2.h"
+
+namespace Ultima {
+namespace Ultima2 {
+namespace Views {
+namespace Interactions {
+
+StatBoost::StatBoost() : Interaction("StatBoost") {
+}
+
+bool StatBoost::msgKeypress(const KeypressMessage &msg) {
+	// Only a digit answers the question
+	if (msg.ascii < '0' || msg.ascii > '9')
+		return true;
+
+	int digit = msg.ascii - '0';
+	writeString("%d\n", digit);
+
+	close();
+	_G(logic)->completeStatBoost(digit);
+	return true;
+}
+
+} // namespace Interactions
+} // namespace Views
+} // namespace Ultima2
+} // namespace Ultima
diff --git a/engines/ultima/ultima2/views/interactions/stat_boost.h b/engines/ultima/ultima2/views/interactions/stat_boost.h
new file mode 100644
index 00000000000..8193c71483e
--- /dev/null
+++ b/engines/ultima/ultima2/views/interactions/stat_boost.h
@@ -0,0 +1,50 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef ULTIMA2_VIEWS_INTERACTIONS_STAT_BOOST_H
+#define ULTIMA2_VIEWS_INTERACTIONS_STAT_BOOST_H
+
+#include "ultima/ultima2/views/interactions/interaction.h"
+
+namespace Ultima {
+namespace Ultima2 {
+namespace Views {
+namespace Interactions {
+
+/**
+ * Asks which attribute the "offer" command's gift should raise, in the
+ * Ultima II Upgrade, then hands it back to the active Logic's
+ * completeStatBoost()
+ */
+class StatBoost : public Interaction {
+public:
+	StatBoost();
+	~StatBoost() override {}
+
+	bool msgKeypress(const KeypressMessage &msg) override;
+};
+
+} // namespace Interactions
+} // namespace Views
+} // namespace Ultima2
+} // namespace Ultima
+
+#endif
diff --git a/engines/ultima/ultima2/views/views.h b/engines/ultima/ultima2/views/views.h
index 01ba5a0db2b..8f630b459ec 100644
--- a/engines/ultima/ultima2/views/views.h
+++ b/engines/ultima/ultima2/views/views.h
@@ -45,6 +45,7 @@
 #include "ultima/ultima2/views/interactions/ready_weapon.h"
 #include "ultima/ultima2/views/interactions/rocket_landing.h"
 #include "ultima/ultima2/views/interactions/shop.h"
+#include "ultima/ultima2/views/interactions/stat_boost.h"
 #include "ultima/ultima2/views/interactions/transport.h"
 #include "ultima/ultima2/views/interactions/wear_armor.h"
 #include "ultima/ultima2/views/interactions/yell.h"
@@ -65,6 +66,7 @@ struct Views {
 	Interactions::ReadySpell _readySpell;
 	Interactions::ReadyWeapon _readyWeapon;
 	Interactions::RocketLanding _rocketLanding;
+	Interactions::StatBoost _statBoost;
 	Interactions::Transport _transport;
 	Interactions::WearArmor _wearArmor;
 	Interactions::Yell _yell;


Commit: 84523b5c3d77a2d720932d54c3f303ab80e1ff54
    https://github.com/scummvm/scummvm/commit/84523b5c3d77a2d720932d54c3f303ab80e1ff54
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:41:03+11:00

Commit Message:
ULTIMA: ULTIMA2: Added misc Upgrade Patch functions

Horse entry, quit anywhere and shorter hyperwarp

Changed paths:
    engines/ultima/ultima2/logic/logic.cpp
    engines/ultima/ultima2/logic/overworld_logic.cpp
    engines/ultima/ultima2/views/space_map.cpp
    engines/ultima/ultima2/views/space_map.h


diff --git a/engines/ultima/ultima2/logic/logic.cpp b/engines/ultima/ultima2/logic/logic.cpp
index 10786c38739..c173f97a601 100644
--- a/engines/ultima/ultima2/logic/logic.cpp
+++ b/engines/ultima/ultima2/logic/logic.cpp
@@ -539,9 +539,9 @@ bool Logic::quit() {
 
 	if (sg._mapType != 0)
 		writeString("\nONLY OUTDOORS!\n");
-	else if (sg.saveDisabled())
+	else if (sg.saveDisabled() && !g_engine->isEnhanced())
 		writeString("\nONLY ON EARTH!\n");
-	else if (sg._mount != 0)
+	else if (sg._mount != 0 && !g_engine->isEnhanced())
 		writeString("\nONLY ON FOOT!\n");
 	else {
 		writeString("\nONE MOMENT PLEASE!\n");
diff --git a/engines/ultima/ultima2/logic/overworld_logic.cpp b/engines/ultima/ultima2/logic/overworld_logic.cpp
index e92e08b531f..8e3142d2b2c 100644
--- a/engines/ultima/ultima2/logic/overworld_logic.cpp
+++ b/engines/ultima/ultima2/logic/overworld_logic.cpp
@@ -751,7 +751,9 @@ bool OverworldLogic::enter() {
 		return true;
 	}
 
-	if (sg._mount != 0) {
+	// The upgrade lets a horse be ridden into places, but not a vehicle
+	const bool onHorse = sg._mount == Data::TILE_HORSE && g_engine->isEnhanced();
+	if (sg._mount != 0 && !onHorse) {
 		writeString("-ONLY ON FOOT!\n");
 		return true;
 	}
diff --git a/engines/ultima/ultima2/views/space_map.cpp b/engines/ultima/ultima2/views/space_map.cpp
index 44629bd61f1..68ea79a3a23 100644
--- a/engines/ultima/ultima2/views/space_map.cpp
+++ b/engines/ultima/ultima2/views/space_map.cpp
@@ -210,9 +210,22 @@ void SpaceMap::startWarp() {
 	_phase = PHASE_WARP_TRAILS;
 }
 
+void SpaceMap::finishWarp() {
+	_phase = PHASE_IDLE;
+	if (auto *logic = dynamic_cast<Logic::SpaceLogic *>(_G(logic).get()))
+		logic->warpFinished();
+}
+
 void SpaceMap::startSpinDown() {
 	seedStars();
-	_phase = PHASE_SPIN_DOWN;
+
+	if (g_engine->isEnhanced()) {
+		// The upgrade skips slowing the ship down, and holds for half as long
+		_counter = 0x20;
+		_phase = PHASE_SPIN_HOLD;
+	} else {
+		_phase = PHASE_SPIN_DOWN;
+	}
 }
 
 bool SpaceMap::tick() {
@@ -238,6 +251,12 @@ bool SpaceMap::tick() {
 
 		case PHASE_WARP_ACCELERATE:
 			if (--_counter == 0) {
+				// The upgrade skips speeding the stars up to warp speed
+				if (g_engine->isEnhanced()) {
+					finishWarp();
+					return true;
+				}
+
 				++_speed;
 				_phase = PHASE_WARP_RUSH;
 			}
@@ -246,9 +265,7 @@ bool SpaceMap::tick() {
 		case PHASE_WARP_RUSH:
 			_speed += 2;
 			if (_speed & 0x80) {
-				_phase = PHASE_IDLE;
-				if (auto *logic = dynamic_cast<Logic::SpaceLogic *>(_G(logic).get()))
-					logic->warpFinished();
+				finishWarp();
 				return true;
 			}
 			break;
diff --git a/engines/ultima/ultima2/views/space_map.h b/engines/ultima/ultima2/views/space_map.h
index dff1b29e720..d6bf9cd99c8 100644
--- a/engines/ultima/ultima2/views/space_map.h
+++ b/engines/ultima/ultima2/views/space_map.h
@@ -74,6 +74,11 @@ private:
 	 */
 	void startWarp();
 
+	/**
+	 * Ends the hyperwarp animation and carries on with the warp
+	 */
+	void finishWarp();
+
 public:
 	SpaceMap();
 	~SpaceMap() override {}


Commit: 52577a8a84a1e7b68928553d8b7576808b40998a
    https://github.com/scummvm/scummvm/commit/52577a8a84a1e7b68928553d8b7576808b40998a
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:41:03+11:00

Commit Message:
ULTIMA: ULTIMA2: Added the Upgrade Patch's colored text, with a mixed case text option

Changed paths:
  A engines/ultima/ultima2/gfx/text.cpp
  A engines/ultima/ultima2/gfx/text.h
    engines/ultima/detection.h
    engines/ultima/detection_tables.h
    engines/ultima/metaengine.cpp
    engines/ultima/module.mk
    engines/ultima/ultima2/ultima2.cpp
    engines/ultima/ultima2/ultima2.h
    engines/ultima/ultima2/views/commands.cpp
    engines/ultima/ultima2/views/create_character.cpp
    engines/ultima/ultima2/views/space_stats.cpp
    engines/ultima/ultima2/views/stats.cpp
    engines/ultima/ultima2/views/title.cpp
    engines/ultima/ultima2/views/zstats.cpp


diff --git a/engines/ultima/detection.h b/engines/ultima/detection.h
index 5f16f5de19b..bd1abbdd2f4 100644
--- a/engines/ultima/detection.h
+++ b/engines/ultima/detection.h
@@ -87,6 +87,7 @@ struct UltimaGameDescription {
 #define GAMEOPTION_ULTIMA3_MIDI_MUSIC    GUIO_GAMEOPTIONS15
 #define GAMEOPTION_ULTIMA3_TIMED_SOUNDS  GUIO_GAMEOPTIONS16
 #define GAMEOPTION_ULTIMA2_STAT_BOOST    GUIO_GAMEOPTIONS17
+#define GAMEOPTION_ULTIMA2_MIXED_CASE    GUIO_GAMEOPTIONS18
 
 } // End of namespace Ultima
 
diff --git a/engines/ultima/detection_tables.h b/engines/ultima/detection_tables.h
index 750339ff6a1..e0ef4799a9c 100644
--- a/engines/ultima/detection_tables.h
+++ b/engines/ultima/detection_tables.h
@@ -23,7 +23,7 @@ namespace Ultima {
 
 #define GUI_OPTIONS_ULTIMA0	GUIO0()
 #define GUI_OPTIONS_ULTIMA1	GUIO0()
-#define GUI_OPTIONS_ULTIMA2	GUIO1(GAMEOPTION_ULTIMA2_STAT_BOOST)
+#define GUI_OPTIONS_ULTIMA2	GUIO2(GAMEOPTION_ULTIMA2_STAT_BOOST, GAMEOPTION_ULTIMA2_MIXED_CASE)
 #define GUI_OPTIONS_ULTIMA3	GUIO5(GAMEOPTION_ULTIMA3_MORE_MONSTERS, GAMEOPTION_ULTIMA3_LESS_HUNGER, GAMEOPTION_ULTIMA3_MOON_ICONS, GAMEOPTION_ULTIMA3_MIDI_MUSIC, GAMEOPTION_ULTIMA3_TIMED_SOUNDS)
 #define GUI_OPTIONS_ULTIMA4	GUIO1(GUIO_NOSPEECH)
 #define GUI_OPTIONS_ULTIMA6	GUIO0()
diff --git a/engines/ultima/metaengine.cpp b/engines/ultima/metaengine.cpp
index 633e2c6ecfe..5147ac8b2f7 100644
--- a/engines/ultima/metaengine.cpp
+++ b/engines/ultima/metaengine.cpp
@@ -185,6 +185,17 @@ static const ADExtraGuiOptionsMap optionsList[] = {
 			0
 		}
 	},
+	{
+		GAMEOPTION_ULTIMA2_MIXED_CASE,
+		{
+			_s("Mixed case, colored text"),
+			_s("Shows text in mixed case, and in color with the EGA graphics, as the Ultima II Upgrade does, instead of in capitals"),
+			"mixed_case_text",
+			false,
+			0,
+			0
+		}
+	},
 	{
 		GAMEOPTION_ULTIMA3_MORE_MONSTERS,
 		{
diff --git a/engines/ultima/module.mk b/engines/ultima/module.mk
index 2a5a8b2c532..8ba38c783de 100644
--- a/engines/ultima/module.mk
+++ b/engines/ultima/module.mk
@@ -122,6 +122,7 @@ MODULE_OBJS += \
 	ultima2/gfx/composite.o \
 	ultima2/gfx/ega_picture.o \
 	ultima2/gfx/pic_decoder.o \
+	ultima2/gfx/text.o \
 	ultima2/gfx/text_cursor.o \
 	ultima2/logic/city_castle_logic.o \
 	ultima2/logic/dungeon_logic.o \
diff --git a/engines/ultima/ultima2/gfx/text.cpp b/engines/ultima/ultima2/gfx/text.cpp
new file mode 100644
index 00000000000..1debe8cf48e
--- /dev/null
+++ b/engines/ultima/ultima2/gfx/text.cpp
@@ -0,0 +1,75 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#include "ultima/ultima2/gfx/text.h"
+#include "ultima/ultima2/data/data.h"
+#include "ultima/ultima2/data/tiles.h"
+#include "ultima/ultima2/ultima2.h"
+
+namespace Ultima {
+namespace Ultima2 {
+namespace Gfx {
+
+// White and magenta, within the original 4-color CGA palette
+constexpr byte COLOR_WHITE = 3;
+constexpr byte COLOR_MAGENTA = 2;
+
+// Where the table of colors of the text starts within the colors of an EGA theme
+constexpr int EGA_TEXT_COLORS = 8;
+
+// Magenta, within the composite colors
+constexpr int COMPOSITE_MAGENTA = 10;
+
+byte textColor(TextColor color) {
+	if (!g_engine->_mixedCaseText)
+		return (color == TEXT_HIGHLIGHT) ? COLOR_MAGENTA : COLOR_WHITE;
+
+	const Data::RenderMode mode = g_engine->getRenderMode();
+	if (Data::isEgaMode(mode))
+		return Data::EGA_PALETTE_BASE + Data::egaColors(mode)[EGA_TEXT_COLORS + color];
+
+	// The CGA drivers have everything white apart from highlighted text
+	if (color == TEXT_HIGHLIGHT) {
+		return (mode == Data::RENDER_CGA_COMPOSITE) ?
+			Data::COMPOSITE_PALETTE_BASE + COMPOSITE_MAGENTA : COLOR_MAGENTA;
+	}
+
+	return COLOR_WHITE;
+}
+
+void setReverseText(Graphics::Views::GfxSurface &s, bool on) {
+	if (on)
+		s.setColor(0, textColor(TEXT_REVERSE));
+	else
+		s.setColor(textColor(TEXT_NORMAL), 0);
+}
+
+void TextFont::drawChar(Graphics::Surface *dst, uint32 chr, int x, int y, uint32 color) const {
+	if (!g_engine->_mixedCaseText && chr >= 'a' && chr <= 'z')
+		chr -= 'a' - 'A';
+
+	DosFont::drawChar(dst, chr, x, y, color);
+}
+
+} // namespace Gfx
+} // namespace Ultima2
+} // namespace Ultima
diff --git a/engines/ultima/ultima2/gfx/text.h b/engines/ultima/ultima2/gfx/text.h
new file mode 100644
index 00000000000..3bfbbad7b6f
--- /dev/null
+++ b/engines/ultima/ultima2/gfx/text.h
@@ -0,0 +1,74 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#ifndef ULTIMA2_GFX_TEXT_H
+#define ULTIMA2_GFX_TEXT_H
+
+#include "graphics/fonts/dosfont.h"
+#include "graphics/views/gfx_surface.h"
+
+namespace Ultima {
+namespace Ultima2 {
+namespace Gfx {
+
+/**
+ * The kinds of text that the Ultima II Upgrade shows in different colors. Each
+ * is a number the game gives its text drawing, which the graphics driver then
+ * turns into a color. They're named for what they were used for, but are only
+ * ever different colors in the EGA graphics modes
+ */
+enum TextColor {
+	TEXT_NORMAL = 0,		// Most text
+	TEXT_TITLE = 1,			// The name of the game on the title screen
+	TEXT_NAME = 2,			// The character's name and the credits
+	TEXT_HEADING = 3,		// Headings, and things chosen when creating a character
+	TEXT_HIGHLIGHT = 4,		// An empty hit points or food value
+	TEXT_LIST = 5,			// What's readied, and a name being typed in
+	TEXT_NUMBER = 6,		// Numbers on the character's status screen
+	TEXT_REVERSE = 7		// Reverse video, which is drawn as the background color instead
+};
+
+/**
+ * Returns the palette color for a type of text, which depends on the graphics
+ * mode. Without the upgrade's style of text, all text is white
+ */
+extern byte textColor(TextColor color);
+
+/**
+ * Switches reverse video on or off for a surface drawing text
+ */
+extern void setReverseText(Graphics::Views::GfxSurface &s, bool on);
+
+/**
+ * The font the game's text is drawn with, which shows letters in capitals
+ * unless the upgrade's mixed case text is on
+ */
+class TextFont : public Graphics::DosFont {
+public:
+	void drawChar(Graphics::Surface *dst, uint32 chr, int x, int y, uint32 color) const override;
+};
+
+} // namespace Gfx
+} // namespace Ultima2
+} // namespace Ultima
+
+#endif
diff --git a/engines/ultima/ultima2/ultima2.cpp b/engines/ultima/ultima2/ultima2.cpp
index 7225dbb56de..01723de4b97 100644
--- a/engines/ultima/ultima2/ultima2.cpp
+++ b/engines/ultima/ultima2/ultima2.cpp
@@ -30,6 +30,7 @@
 #include "ultima/ultima2/console.h"
 #include "ultima/ultima2/metaengine.h"
 #include "ultima/ultima2/data/secret_archive.h"
+#include "ultima/ultima2/gfx/text.h"
 #include "ultima/ultima2/logic/space_logic.h"
 #include "ultima/ultima2/views/views.h"
 #include "ultima/ultima2/views/map.h"
@@ -56,12 +57,17 @@ uint32 Ultima2Engine::getFeatures() const {
 	return _gameDescription->desc.flags;
 }
 
+Graphics::Font *Ultima2Engine::createFont() const {
+	return new Gfx::TextFont();
+}
+
 bool Ultima2Engine::isEnhanced() const {
 	return (_gameDescription->features & GF_ENHANCED) != 0;
 }
 
 void Ultima2Engine::loadOptions() {
 	_statBoostChoice = Shared::configuredOption("stat_boost_choice", isEnhanced());
+	_mixedCaseText = Shared::configuredOption("mixed_case_text", isEnhanced());
 }
 
 Common::String Ultima2Engine::getGameId() const {
diff --git a/engines/ultima/ultima2/ultima2.h b/engines/ultima/ultima2/ultima2.h
index 42ed6163f99..9887e9430a4 100644
--- a/engines/ultima/ultima2/ultima2.h
+++ b/engines/ultima/ultima2/ultima2.h
@@ -96,6 +96,10 @@ public:
 	// as in the Ultima II Upgrade, rather than it being random
 	bool _statBoostChoice = false;
 
+	// Shows text in mixed case, and in color in the EGA modes, as the Ultima II
+	// Upgrade does. When off, all text is in capitals
+	bool _mixedCaseText = false;
+
 	// Debug flag toggled by the "intangible" console command, allowing
 	// movement through normally impassable terrain
 	bool _intangible = false;
@@ -114,6 +118,11 @@ public:
 
 	uint32 getFeatures() const;
 
+	/**
+	 * Returns the font the game's text is drawn with
+	 */
+	Graphics::Font *createFont() const override;
+
 	/**
 	 * Returns true for the version with the Ultima II Upgrade applied
 	 */
diff --git a/engines/ultima/ultima2/views/commands.cpp b/engines/ultima/ultima2/views/commands.cpp
index 728d6a16695..cd2ca163b0a 100644
--- a/engines/ultima/ultima2/views/commands.cpp
+++ b/engines/ultima/ultima2/views/commands.cpp
@@ -20,6 +20,7 @@
  */
 
 #include "ultima/ultima2/views/commands.h"
+#include "ultima/ultima2/gfx/text.h"
 #include "ultima/ultima2/ultima2.h"
 #include "graphics/views/rect.h"
 
@@ -41,7 +42,6 @@ void Commands::draw() {
 	_surface.clear();
 	_surface.setTextPos(Common::Point(0, PROMPT_ROW));
 	_surface.setScrollable(true);
-	_surface.setColor(COLOR_TEXT);
 
 	prompt();
 }
@@ -69,6 +69,7 @@ bool Commands::msgGame(const GameMessage &msg) {
 
 void Commands::writeString(const Common::String &msg) {
 	_textCursor.hide();
+	_surface.setColor(Gfx::textColor(Gfx::TEXT_NORMAL));
 	_surface.writeString(msg);
 
 	if (msg.contains('\n'))
@@ -87,6 +88,7 @@ void Commands::showCursor() {
 
 void Commands::prompt() {
 	resetLine();
+	_surface.setColor(Gfx::textColor(Gfx::TEXT_NORMAL));
 	_surface.writeString("CMD: ");
 	showCursor();
 }
diff --git a/engines/ultima/ultima2/views/create_character.cpp b/engines/ultima/ultima2/views/create_character.cpp
index dcb9a50ed46..8666714c811 100644
--- a/engines/ultima/ultima2/views/create_character.cpp
+++ b/engines/ultima/ultima2/views/create_character.cpp
@@ -20,14 +20,13 @@
  */
 
 #include "ultima/ultima2/views/create_character.h"
+#include "ultima/ultima2/gfx/text.h"
 #include "ultima/ultima2/ultima2.h"
 
 namespace Ultima {
 namespace Ultima2 {
 namespace Views {
 
-constexpr int COLOR_TEXT = 3; // white, within CGA_PALETTE1
-
 constexpr int STARTING_POINTS = 90;
 constexpr int MIN_ATTRIBUTE = 10;
 
@@ -127,60 +126,65 @@ void CreateCharacter::positionCursor() {
 void CreateCharacter::draw() {
 	auto s = getSurface();
 	s.clear();
-	s.setColor(COLOR_TEXT);
 
 	Data::Savegame &sg = _G(savegame);
 
-	s.writeString(Common::Point(10, 1), "PLAYER GENERATION :");
-
-	s.writeString(Common::Point(5, 2), "POINTS LEFT TO DISTRIBUTE : ");
-	s.reverseColor();
-	s.writeString(Common::Point(33, 2), "%d", _pointsRemaining);
-	s.reverseColor();
-
-	s.writeString(Common::Point(11, 4), "STRENGTH.......");
-	s.writeString(Common::Point(11, 5), "AGILITY........");
-	s.writeString(Common::Point(11, 6), "STAMINA........");
-	s.writeString(Common::Point(11, 7), "CHARISMA.......");
-	s.writeString(Common::Point(11, 8), "WISDOM.........");
-	s.writeString(Common::Point(11, 9), "INTELLIGENCE...");
-
-	if (_state > STRENGTH) s.writeString(Common::Point(26, 4), "%d", sg._strength);
-	if (_state > AGILITY) s.writeString(Common::Point(26, 5), "%d", sg._agility);
-	if (_state > STAMINA) s.writeString(Common::Point(26, 6), "%d", sg._stamina);
-	if (_state > CHARISMA) s.writeString(Common::Point(26, 7), "%d", sg._charisma);
-	if (_state > WISDOM) s.writeString(Common::Point(26, 8), "%d", sg._wisdom);
-	if (_state > INTELLIGENCE) s.writeString(Common::Point(26, 9), "%d", sg._intelligence);
+	// Writes text at a position in one of the colors
+	auto put = [&](int x, int y, Gfx::TextColor color, const Common::String &text) {
+		s.setColor(Gfx::textColor(color));
+		s.writeString(Common::Point(x, y), text);
+	};
+
+	put(10, 1, Gfx::TEXT_NORMAL, "PLAYER GENERATION :");
+
+	put(5, 2, Gfx::TEXT_NORMAL, "POINTS LEFT TO DISTRIBUTE : ");
+	Gfx::setReverseText(s, true);
+	s.writeString(Common::Point(33, 2), Common::String::format("%d", _pointsRemaining));
+	Gfx::setReverseText(s, false);
+
+	put(11, 4, Gfx::TEXT_NORMAL, "STRENGTH.......");
+	put(11, 5, Gfx::TEXT_NORMAL, "AGILITY........");
+	put(11, 6, Gfx::TEXT_NORMAL, "STAMINA........");
+	put(11, 7, Gfx::TEXT_NORMAL, "CHARISMA.......");
+	put(11, 8, Gfx::TEXT_NORMAL, "WISDOM.........");
+	put(11, 9, Gfx::TEXT_NORMAL, "INTELLIGENCE...");
+
+	if (_state > STRENGTH) put(26, 4, Gfx::TEXT_NUMBER, Common::String::format("%d", sg._strength));
+	if (_state > AGILITY) put(26, 5, Gfx::TEXT_NUMBER, Common::String::format("%d", sg._agility));
+	if (_state > STAMINA) put(26, 6, Gfx::TEXT_NUMBER, Common::String::format("%d", sg._stamina));
+	if (_state > CHARISMA) put(26, 7, Gfx::TEXT_NUMBER, Common::String::format("%d", sg._charisma));
+	if (_state > WISDOM) put(26, 8, Gfx::TEXT_NUMBER, Common::String::format("%d", sg._wisdom));
+	if (_state > INTELLIGENCE) put(26, 9, Gfx::TEXT_NUMBER, Common::String::format("%d", sg._intelligence));
 
 	// The digits typed so far for whichever attribute is currently active
 	if (_state <= INTELLIGENCE && _digitCount > 0) {
 		Common::String digits;
 		for (int i = 0; i < _digitCount; ++i)
 			digits += (char)('0' + _digits[i]);
-		s.writeString(Common::Point(26, 4 + (int)_state), digits);
+		put(26, 4 + (int)_state, Gfx::TEXT_NUMBER, digits);
 	}
 
-	s.writeString(Common::Point(16, 11), "M/F-");
-	s.writeString(Common::Point(15, 12), "RACE-");
-	s.writeString(Common::Point(15, 13), "TYPE-");
-	s.writeString(Common::Point(15, 14), "NAME-");
+	put(16, 11, Gfx::TEXT_NORMAL, "M/F-");
+	put(15, 12, Gfx::TEXT_NORMAL, "RACE-");
+	put(15, 13, Gfx::TEXT_NORMAL, "TYPE-");
+	put(15, 14, Gfx::TEXT_NORMAL, "NAME-");
 
 	if (_state > SEX)
-		s.writeString(Common::Point(20, 11), sg._sex == Data::SEX_MALE ? "MALE" : "FEMALE");
+		put(20, 11, Gfx::TEXT_HEADING, sg._sex == Data::SEX_MALE ? "MALE" : "FEMALE");
 	if (_state > RACE)
-		s.writeString(Common::Point(20, 12), Data::raceName(sg._race));
+		put(20, 12, Gfx::TEXT_HEADING, Data::raceName(sg._race));
 	if (_state > CLASS)
-		s.writeString(Common::Point(20, 13), Data::className(sg._class));
+		put(20, 13, Gfx::TEXT_HEADING, Data::className(sg._class));
 	if (_state >= NAME)
-		s.writeString(Common::Point(20, 14), _name);
+		put(20, 14, Gfx::TEXT_LIST, _name);
 
-	s.writeString(Common::Point(10, 16), "SATISFACTORY (Y/N)-");
+	put(10, 16, Gfx::TEXT_NORMAL, "SATISFACTORY (Y/N)-");
 
-	s.writeString(Common::Point(8, 18), "RACES:         TYPES:");
-	s.writeString(Common::Point(9, 19), "1-HUMAN        1-FIGHTER");
-	s.writeString(Common::Point(9, 20), "2-ELF          2-CLERIC");
-	s.writeString(Common::Point(9, 21), "3-DWARF        3-WIZARD");
-	s.writeString(Common::Point(9, 22), "4-HOBBIT       4-THIEF");
+	put(8, 18, Gfx::TEXT_NORMAL, "RACES:         TYPES:");
+	put(9, 19, Gfx::TEXT_NORMAL, "1-HUMAN        1-FIGHTER");
+	put(9, 20, Gfx::TEXT_NORMAL, "2-ELF          2-CLERIC");
+	put(9, 21, Gfx::TEXT_NORMAL, "3-DWARF        3-WIZARD");
+	put(9, 22, Gfx::TEXT_NORMAL, "4-HOBBIT       4-THIEF");
 }
 
 bool CreateCharacter::msgKeypress(const KeypressMessage &msg) {
diff --git a/engines/ultima/ultima2/views/space_stats.cpp b/engines/ultima/ultima2/views/space_stats.cpp
index 61eabaa7ae1..22323839678 100644
--- a/engines/ultima/ultima2/views/space_stats.cpp
+++ b/engines/ultima/ultima2/views/space_stats.cpp
@@ -20,6 +20,7 @@
  */
 
 #include "ultima/ultima2/views/space_stats.h"
+#include "ultima/ultima2/gfx/text.h"
 #include "ultima/ultima2/ultima2.h"
 #include "graphics/views/rect.h"
 
@@ -27,8 +28,6 @@ namespace Ultima {
 namespace Ultima2 {
 namespace Views {
 
-constexpr int COLOR_TEXT = 3; // white, within the game's 4-color CGA palette
-
 SpaceStats::SpaceStats(UIElement *parent) : Graphics::Views::UIElement("SpaceStats", parent) {
 	setBounds(Graphics::Views::TextRect(30, 20, 39, 23));
 }
@@ -38,7 +37,7 @@ void SpaceStats::draw() {
 	s.clear();
 
 	Data::Savegame &sg = _G(savegame);
-	s.setColor(COLOR_TEXT);
+	s.setColor(Gfx::textColor(Gfx::TEXT_NORMAL));
 	s.writeString(Common::Point(0, 0), "  FUEL=%.2d", sg._items[Data::ITEM_TRI_LITHIUM] % 100);
 	s.writeString(Common::Point(0, 1), "  XENO=%.2d", sg._hyperwarpCoords[0]);
 	s.writeString(Common::Point(0, 2), "  YAKO=%.2d", sg._hyperwarpCoords[1]);
diff --git a/engines/ultima/ultima2/views/stats.cpp b/engines/ultima/ultima2/views/stats.cpp
index fbf36f2dce3..02752553607 100644
--- a/engines/ultima/ultima2/views/stats.cpp
+++ b/engines/ultima/ultima2/views/stats.cpp
@@ -20,6 +20,7 @@
  */
 
 #include "ultima/ultima2/views/stats.h"
+#include "ultima/ultima2/gfx/text.h"
 #include "ultima/ultima2/ultima2.h"
 #include "graphics/views/rect.h"
 
@@ -27,8 +28,6 @@ namespace Ultima {
 namespace Ultima2 {
 namespace Views {
 
-constexpr int COLOR_TEXT = 3; // white, within the game's 4-color CGA palette
-
 Stats::Stats(UIElement *parent) : Graphics::Views::UIElement("Stats", parent) {
 	setBounds(Graphics::Views::TextRect(30, 20, 39, 23));
 }
@@ -38,23 +37,21 @@ void Stats::draw() {
 	auto s = getSurface();
 	s.clear();
 
-	s.setColor(COLOR_TEXT);
+	// A value that's run out is highlighted
+	const byte normal = Gfx::textColor(Gfx::TEXT_NORMAL);
+	const byte highlight = Gfx::textColor(Gfx::TEXT_HIGHLIGHT);
+
+	s.setColor(normal);
 	s.writeString(Common::Point(0, 0), "H.P.=");
-	if (sg._hp == 0)
-		s.reverseColor();
+	s.setColor(sg._hp == 0 ? highlight : normal);
 	s.writeString(Common::Point(5, 0), "%4d", sg._hp);
-	if (sg._hp == 0)
-		s.reverseColor();
 
-	s.setColor(COLOR_TEXT);
+	s.setColor(normal);
 	s.writeString(Common::Point(0, 1), "FOOD=");
-	if (sg._food == 0)
-		s.reverseColor();
+	s.setColor(sg._food == 0 ? highlight : normal);
 	s.writeString(Common::Point(5, 1), "%4d", sg._food);
-	if (sg._food == 0)
-		s.reverseColor();
 
-	s.setColor(COLOR_TEXT);
+	s.setColor(normal);
 	s.writeString(Common::Point(0, 2), "EXP.=");
 	s.writeString(Common::Point(5, 2), "%4d", sg._experience);
 
diff --git a/engines/ultima/ultima2/views/title.cpp b/engines/ultima/ultima2/views/title.cpp
index 996c16cbef0..ea489d23200 100644
--- a/engines/ultima/ultima2/views/title.cpp
+++ b/engines/ultima/ultima2/views/title.cpp
@@ -27,14 +27,13 @@
 #include "ultima/ultima2/gfx/composite.h"
 #include "ultima/ultima2/gfx/ega_picture.h"
 #include "ultima/ultima2/gfx/pic_decoder.h"
+#include "ultima/ultima2/gfx/text.h"
 #include "ultima/ultima2/ultima2.h"
 
 namespace Ultima {
 namespace Ultima2 {
 namespace Views {
 
-constexpr int COLOR_TEXT = 3; // white, within CGA_PALETTE1
-
 Title::Title() : View("Title"), _cursor("Cursor", this) {
 	// Position the cursor right after "CHOICE:"
 	_cursor.setPosition(Common::Point(12, 19));
@@ -126,13 +125,11 @@ void Title::draw() {
 	auto s = getSurface();
 	bool hasPicture = _state == PICDRA || _state >= DEMO_OUT;
 
-	if (hasPicture) {
+	if (hasPicture)
 		s.blitFrom(_pic);
-		s.setColor(COLOR_TEXT);
-	} else {
+	else
 		s.clear();
-		s.setColor(COLOR_TEXT);
-	}
+	s.setColor(Gfx::textColor(Gfx::TEXT_NORMAL));
 
 	switch (_state) {
 	case TEXT1:
@@ -182,12 +179,15 @@ void Title::draw() {
 		break;
 
 	case MENU:
+		s.setColor(Gfx::textColor(Gfx::TEXT_TITLE));
 		s.writeString(Common::Point(15, 1), "ULTIMA ][");
+		s.setColor(Gfx::textColor(Gfx::TEXT_NAME));
 		s.writeString(Common::Point(16, 3), "REVENGE");
 		s.writeString(Common::Point(16, 5), "OF  THE");
 		s.writeString(Common::Point(14, 7), "ENCHANTRESS");
 		s.writeString(Common::Point(6, 22), "(C)-1983,1989 BY LORD BRITISH");
 		s.writeString(Common::Point(15, 23), "AND ORIGIN");
+		s.setColor(Gfx::textColor(Gfx::TEXT_NORMAL));
 		s.writeString(Common::Point(5, 10), "TYPE -");
 		s.writeString(Common::Point(6, 11), "'D' - FOR A DEMONSTRATION");
 		s.writeString(Common::Point(6, 13), "'P' - PLAY A GAME OF ULTIMA ][");
diff --git a/engines/ultima/ultima2/views/zstats.cpp b/engines/ultima/ultima2/views/zstats.cpp
index 4e3488a8cc1..6ffa60f0b13 100644
--- a/engines/ultima/ultima2/views/zstats.cpp
+++ b/engines/ultima/ultima2/views/zstats.cpp
@@ -20,14 +20,13 @@
  */
 
 #include "ultima/ultima2/views/zstats.h"
+#include "ultima/ultima2/gfx/text.h"
 #include "ultima/ultima2/ultima2.h"
 
 namespace Ultima {
 namespace Ultima2 {
 namespace Views {
 
-constexpr int COLOR_TEXT = 3;
-
 ZStats::ZStats() : View("ZStats") {
 	setBounds(Graphics::Views::TextRect(0, 0, 39, 24));
 }
@@ -45,64 +44,94 @@ bool ZStats::msgFocus(const FocusMessage &msg) {
 void ZStats::draw() {
 	auto s = getSurface();
 	s.clear();
-	s.setColor(COLOR_TEXT);
 
 	Data::Savegame &sg = _G(savegame);
 
-	s.writeString(Common::Point(0, 0), "%s", sg._name);
-	s.writeString(Common::Point(0, 1), "A LEVEL %.2d %s %s %s", sg._experience,
+	// Write text in one of the colors, at a position or from where the last text ended
+	auto put = [&](Gfx::TextColor color, const Common::String &text) {
+		s.setColor(Gfx::textColor(color));
+		s.writeString(text);
+	};
+	auto putAt = [&](int x, int y, Gfx::TextColor color, const Common::String &text) {
+		s.setTextPos(Common::Point(x, y));
+		put(color, text);
+	};
+	auto number = [](int value) {
+		return Common::String::format("%.2d", value);
+	};
+
+	// A label followed by a number, ending at the right edge when x is negative
+	auto labelled = [&](int x, int y, const Common::String &label, int value) {
+		if (x < 0)
+			x = 38 - (int)(label.size() + 2);
+		putAt(x, y, Gfx::TEXT_NORMAL, label);
+		put(Gfx::TEXT_NUMBER, number(value));
+	};
+
+	putAt(0, 0, Gfx::TEXT_NAME, sg._name);
+	putAt(0, 1, Gfx::TEXT_NAME, Common::String::format("A LEVEL %.2d %s %s %s", sg._experience,
 		sg._sex == Data::SEX_MALE ? "MALE" : "FEMALE",
 		Data::raceName(sg._race),
-		Data::className(sg._class));
-
-	s.writeString(Common::Point(2, 4), "WEAPON-%s", Data::weaponName(sg._readiedWeapon));
-	s.writeString(Common::Point(2, 5), "ARMOUR-%s", Data::armorName(sg._readiedArmor));
-	s.writeString(Common::Point(2, 6), " SPELL-%s", Data::spellName(sg._readiedSpell));
-
-	s.writeString(Common::Point(38, 4), Common::String::format("TORCHES-%.2d", sg._torches), Graphics::kTextAlignRight);
-	s.writeString(Common::Point(38, 5), Common::String::format("KEYS-%.2d", sg._keys), Graphics::kTextAlignRight);
-	s.writeString(Common::Point(38, 6), Common::String::format("TOOLS-%.2d", sg._thievesTools), Graphics::kTextAlignRight);
-
-	s.writeString(Common::Point(0, 7), "STRENGTH-%.2d", sg._strength);
-	s.writeString(Common::Point(14, 7), " STAMINA-%.2d", sg._stamina);
-	s.writeString(Common::Point(38, 7), Common::String::format(" WISDOM-%.2d", sg._wisdom), Graphics::kTextAlignRight);
-	s.writeString(Common::Point(0, 8), " AGILITY-%.2d", sg._agility);
-	s.writeString(Common::Point(14, 8), "CHARISMA-%.2d", sg._charisma);
-	s.writeString(Common::Point(38, 8), Common::String::format("INTELL.-%.2d", sg._intelligence), Graphics::kTextAlignRight);
+		Data::className(sg._class)));
+
+	putAt(2, 4, Gfx::TEXT_NORMAL, "WEAPON-");
+	put(Gfx::TEXT_LIST, Data::weaponName(sg._readiedWeapon));
+	putAt(2, 5, Gfx::TEXT_NORMAL, "ARMOUR-");
+	put(Gfx::TEXT_LIST, Data::armorName(sg._readiedArmor));
+	putAt(2, 6, Gfx::TEXT_NORMAL, " SPELL-");
+	put(Gfx::TEXT_LIST, Data::spellName(sg._readiedSpell));
+
+	labelled(-1, 4, "TORCHES-", sg._torches);
+	labelled(-1, 5, "KEYS-", sg._keys);
+	labelled(-1, 6, "TOOLS-", sg._thievesTools);
+
+	labelled(0, 7, "STRENGTH-", sg._strength);
+	labelled(14, 7, " STAMINA-", sg._stamina);
+	labelled(-1, 7, " WISDOM-", sg._wisdom);
+	labelled(0, 8, " AGILITY-", sg._agility);
+	labelled(14, 8, "CHARISMA-", sg._charisma);
+	labelled(-1, 8, "INTELL.-", sg._intelligence);
 
 	int row = 10;
-	Common::String line = "WEAPONS: ";
+	putAt(0, row, Gfx::TEXT_HEADING, "WEAPONS: ");
 	for (int i = 0; i < Data::WEAPON_COUNT; ++i) {
-		if (sg._weaponOwned[i] != 0)
-			line += Common::String::format("%sS-%.2d ", Data::weaponName((Data::WeaponType)i), sg._weaponOwned[i]);
+		if (sg._weaponOwned[i] != 0) {
+			put(Gfx::TEXT_NORMAL, Common::String::format("%sS-", Data::weaponName((Data::WeaponType)i)));
+			put(Gfx::TEXT_NUMBER, number(sg._weaponOwned[i]));
+			put(Gfx::TEXT_NORMAL, " ");
+		}
 	}
-	s.writeString(Common::Point(0, row), line);
 	row += 3; // two blank rows below WEAPONS
 
-	line = "ARMOUR: ";
+	putAt(0, row, Gfx::TEXT_HEADING, "ARMOUR: ");
 	for (int i = 0; i < Data::ARMOR_COUNT; ++i) {
-		if (sg._armorOwned[i] != 0)
-			line += Common::String::format("%s-%.2d ", Data::armorName((Data::ArmorType)i), sg._armorOwned[i]);
+		if (sg._armorOwned[i] != 0) {
+			put(Gfx::TEXT_NORMAL, Common::String::format("%s-", Data::armorName((Data::ArmorType)i)));
+			put(Gfx::TEXT_NUMBER, number(sg._armorOwned[i]));
+			put(Gfx::TEXT_NORMAL, " ");
+		}
 	}
-	s.writeString(Common::Point(0, row), line);
 	row += 2; // one blank row below ARMOUR
 
-	line = "SPELLS: ";
+	putAt(0, row, Gfx::TEXT_HEADING, "SPELLS: ");
 	for (int i = 0; i < Data::SPELL_COUNT; ++i) {
-		if (sg._spellCharges[i] != 0)
-			line += Common::String::format("%sS-%.2d ", Data::spellName((Data::SpellType)i), sg._spellCharges[i]);
+		if (sg._spellCharges[i] != 0) {
+			put(Gfx::TEXT_NORMAL, Common::String::format("%sS-", Data::spellName((Data::SpellType)i)));
+			put(Gfx::TEXT_NUMBER, number(sg._spellCharges[i]));
+			put(Gfx::TEXT_NORMAL, " ");
+		}
 	}
-	s.writeString(Common::Point(0, row), line);
 	row += 3; // two blank rows below SPELLS
 
-	line = "ITEMS: ";
+	putAt(0, row, Gfx::TEXT_HEADING, "ITEMS: ");
 	for (int i = 0; i < Data::ITEM_COUNT; ++i) {
 		if (sg._items[i] != 0) {
-			line += Common::String::format("%s%s-%.2d ", Data::itemName(i),
-				i == Data::ITEM_BOOTS ? "" : "S", sg._items[i]);
+			put(Gfx::TEXT_NORMAL, Common::String::format("%s%s-", Data::itemName(i),
+				i == Data::ITEM_BOOTS ? "" : "S"));
+			put(Gfx::TEXT_NUMBER, number(sg._items[i]));
+			put(Gfx::TEXT_NORMAL, " ");
 		}
 	}
-	s.writeString(Common::Point(0, row), line);
 
 	// Show the blinking cursor
 	_textCursor.setPosition(s.getTextPos());


Commit: a7c793f44ce8f8fc3705e14f21c9a1d5b470c72d
    https://github.com/scummvm/scummvm/commit/a7c793f44ce8f8fc3705e14f21c9a1d5b470c72d
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:41:03+11:00

Commit Message:
ULTIMA: ULTIMA2: Changed the game's text to the Upgrade Patch's mixed case

Changed paths:
    engines/ultima/ultima2/data/data.cpp
    engines/ultima/ultima2/logic/city_castle_logic.cpp
    engines/ultima/ultima2/logic/dungeon_logic.cpp
    engines/ultima/ultima2/logic/logic.cpp
    engines/ultima/ultima2/logic/overworld_logic.cpp
    engines/ultima/ultima2/logic/space_logic.cpp
    engines/ultima/ultima2/views/commands.cpp
    engines/ultima/ultima2/views/create_character.cpp
    engines/ultima/ultima2/views/ending.cpp
    engines/ultima/ultima2/views/interactions/clue_seller.cpp
    engines/ultima/ultima2/views/interactions/direction.cpp
    engines/ultima/ultima2/views/interactions/food_shop.cpp
    engines/ultima/ultima2/views/interactions/hyperwarp_target.cpp
    engines/ultima/ultima2/views/interactions/plane_flight.cpp
    engines/ultima/ultima2/views/interactions/pub.cpp
    engines/ultima/ultima2/views/interactions/ready_spell.cpp
    engines/ultima/ultima2/views/interactions/ready_weapon.cpp
    engines/ultima/ultima2/views/interactions/rocket_landing.cpp
    engines/ultima/ultima2/views/interactions/shop.cpp
    engines/ultima/ultima2/views/interactions/transport.cpp
    engines/ultima/ultima2/views/interactions/wear_armor.cpp
    engines/ultima/ultima2/views/interactions/yell.cpp
    engines/ultima/ultima2/views/space_map.cpp
    engines/ultima/ultima2/views/space_stats.cpp
    engines/ultima/ultima2/views/stats.cpp
    engines/ultima/ultima2/views/title.cpp
    engines/ultima/ultima2/views/zstats.cpp


diff --git a/engines/ultima/ultima2/data/data.cpp b/engines/ultima/ultima2/data/data.cpp
index 8ae72ae2440..e2f5cbf1384 100644
--- a/engines/ultima/ultima2/data/data.cpp
+++ b/engines/ultima/ultima2/data/data.cpp
@@ -37,7 +37,7 @@ const byte CGA_PALETTE1[4 * 3] = {
 };
 
 const char *const RENDER_MODE_NAMES[RENDER_MODE_COUNT] = {
-	"ORIGINAL", "COMPOSITE", "EGA", "EGA (V1.0)", "EGA (WILTSHIRE)", "EGA (C64)"
+	"Original", "Composite", "EGA", "EGA (v1.0)", "EGA (Wiltshire)", "EGA (C64)"
 };
 
 const char *const RENDER_MODE_LABELS[RENDER_MODE_COUNT] = {
@@ -66,7 +66,7 @@ const byte EGA_PALETTE16[EGA_PALETTE_SIZE * 3] = {
 };
 
 const char *const PLANET_NAMES[PLANET_COUNT] = {
-	"EARTH", "MERCURY", "VENUS", "MARS", "JUPITER", "SATURN", "URANUS", "NEPTUNE", "PLUTO"
+	"Earth", "Mercury", "Venus", "Mars", "Jupiter", "Saturn", "Uranus", "Neptune", "Pluto"
 };
 
 const byte PLANET_COORDS[PLANET_COUNT + 1][3] = {
@@ -105,31 +105,31 @@ void setPalette() {
 }
 
 const char *const RACE_NAMES[RACE_COUNT] = {
-	"HUMAN", "ELF", "DWARF", "HOBBIT"
+	"Human", "Elf", "Dwarf", "Hobbit"
 };
 
 const char *const CLASS_NAMES[CLASS_COUNT] = {
-	"FIGHTER", "CLERIC", "WIZARD", "THIEF"
+	"Fighter", "Cleric", "Wizard", "Thief"
 };
 
 const char *const WEAPON_NAMES[WEAPON_COUNT] = {
-	"HANDS", "DAGGER", "MACE", "AXE", "BOW", "SWORD",
-	"GREAT SWORD", "LIGHT SWORD", "PHASER", "QUICK SWORD"
+	"Hands", "Dagger", "Mace", "Axe", "Bow", "Sword",
+	"Great Sword", "Light Sword", "Phaser", "Quick Sword"
 };
 
 const char *const ARMOR_NAMES[ARMOR_COUNT] = {
-	"SKIN", "CLOTH", "LEATHER", "CHAIN", "PLATE", "REFLECT", "POWER"
+	"Skin", "Cloth", "Leather", "Chain", "Plate", "Reflect", "Power"
 };
 
 const char *const SPELL_NAMES[SPELL_COUNT] = {
-	"NONE", "LIGHT", "DOWN LADDER", "UP LADDER", "PASSWALL",
-	"SURFACE", "PRAYER", "MAGIC MISSILE", "BLINK", "KILL"
+	"None", "Light", "Down Ladder", "Up Ladder", "PassWall",
+	"Surface", "Prayer", "Magic Missile", "Blink", "Kill"
 };
 
 const char *const ITEM_NAMES[ITEM_COUNT] = {
-	"RING", "WAND", "STAFF", "BOOTS", "CLOAK", "HELM", "GEM", "ANKH",
-	"RED GEM", "SKULL KEY", "GREEN GEM", "BRASS BUTTON", "BLUE TASSLE",
-	"STRANGE COIN", "GREEN IDOL", "TRI LITHIUM"
+	"Ring", "Wand", "Staff", "Boots", "Cloak", "Helm", "Gem", "Ankh",
+	"Red Gem", "Skull Key", "Green Gem", "Brass Button", "Blue Tassle",
+	"Strange Coin", "Green Idol", "Tri-lithium"
 };
 
 const char *raceName(Race race) {
diff --git a/engines/ultima/ultima2/logic/city_castle_logic.cpp b/engines/ultima/ultima2/logic/city_castle_logic.cpp
index 7f636003eb1..7984ce0caa3 100644
--- a/engines/ultima/ultima2/logic/city_castle_logic.cpp
+++ b/engines/ultima/ultima2/logic/city_castle_logic.cpp
@@ -48,10 +48,10 @@ bool CityCastleLogic::move(Data::Direction dir) {
 	int newX = sg._mapX, newY = sg._mapY;
 	const char *dirName;
 	switch (dir) {
-	case Data::DIR_UP:    --newY; dirName = "NORTH"; break;
-	case Data::DIR_DOWN:  ++newY; dirName = "SOUTH"; break;
-	case Data::DIR_LEFT:  --newX; dirName = "WEST"; break;
-	case Data::DIR_RIGHT: ++newX; dirName = "EAST"; break;
+	case Data::DIR_UP:    --newY; dirName = "North"; break;
+	case Data::DIR_DOWN:  ++newY; dirName = "South"; break;
+	case Data::DIR_LEFT:  --newX; dirName = "West"; break;
+	case Data::DIR_RIGHT: ++newX; dirName = "East"; break;
 	default: return true;
 	}
 
@@ -69,7 +69,7 @@ bool CityCastleLogic::move(Data::Direction dir) {
 	case STEP_PARALYZED:
 		return true;
 	case STEP_BLOCKED:
-		writeString("--INVALID MOVE!\n");
+		writeString("--Invalid move!\n");
 		return true;
 	default:
 		break;
@@ -175,7 +175,7 @@ void CityCastleLogic::updateCreatures() {
 
 bool CityCastleLogic::steal(Data::Direction dir) {
 	if (dir == Data::DIR_UNSPECIFIED) {
-		writeString("STEAL DIRECT-");
+		writeString("Steal direct-");
 		_directionPurpose = DirectionPurpose::STEAL;
 		g_engine->addView("Direction");
 		return false;
@@ -200,7 +200,7 @@ bool CityCastleLogic::steal(Data::Direction dir) {
 	bool foundShopkeep = counterFound && shopkeeperAt(x2, y2);
 
 	auto noLuck = [this]() {
-		writeString("NO LUCK!\n");
+		writeString("No luck!\n");
 		if ((randByte() & 7) == 0)
 			alertTownGuards();
 	};
@@ -256,7 +256,7 @@ bool CityCastleLogic::steal(Data::Direction dir) {
 
 bool CityCastleLogic::unlock(Data::Direction dir) {
 	if (dir == Data::DIR_UNSPECIFIED) {
-		writeString("UNLOCK DIRECTION-");
+		writeString("Unlock direction-");
 		_directionPurpose = DirectionPurpose::UNLOCK;
 		g_engine->addView("Direction");
 		return false;
@@ -275,25 +275,25 @@ bool CityCastleLogic::unlock(Data::Direction dir) {
 	int x = sg._mapX + dx, y = sg._mapY + dy;
 	if (x < 0 || x >= Data::MAP_WIDTH || y < 0 || y >= Data::MAP_HEIGHT ||
 			_G(map).tileAt(x, y) != Data::TILE_I_DOOR) {
-		writeString("\nNO DOOR THERE!\n");
+		writeString("\nNo door there!\n");
 		return true;
 	}
 
 	if (sg._keys == 0) {
-		writeString("\nNO KEYS THAT FIT!\n");
+		writeString("\nNo keys that fit!\n");
 		return true;
 	}
 
 	--sg._keys;
 	// The door is replaced by the tile the player is standing on
 	_G(map)._tiles[y][x] = _G(map).tileAt(sg._mapX, sg._mapY);
-	writeString("\nDOOR UNLOCKED!\n");
+	writeString("\nDoor unlocked!\n");
 	return true;
 }
 
 bool CityCastleLogic::offer(Data::Direction dir) {
 	if (dir == Data::DIR_UNSPECIFIED) {
-		writeString("OFFER GOLD DIRECT-");
+		writeString("Offer gold direct-");
 		_directionPurpose = DirectionPurpose::OFFER;
 		g_engine->addView("Direction");
 		return false;
@@ -315,12 +315,12 @@ bool CityCastleLogic::offer(Data::Direction dir) {
 		findTargetMonster(x, y) : -1;
 
 	if (slot < 0) {
-		writeString("OFFER TO WHOM?\n");
+		writeString("Offer to whom?\n");
 		return true;
 	}
 
 	_offerTargetSlot = slot;
-	writeString("HOW MUCH (*100) ? ");
+	writeString("How much (*100) ? ");
 	g_engine->addView("OfferGold");
 	return false;
 }
@@ -337,7 +337,7 @@ void CityCastleLogic::completeOffer(int goldHundreds) {
 	bool wrongMap = !(sg._mapType == 2 && sg._mapEra == 3);
 
 	if ((int8)flag >= 0 || wrongMap) {
-		writeString("THANK YOU VERY MUCH!\n");
+		writeString("Thank you very much!\n");
 		resumeTurn();
 		return;
 	}
@@ -345,20 +345,20 @@ void CityCastleLogic::completeOffer(int goldHundreds) {
 	switch (flag) {
 	case 0x81:
 		if (goldHundreds < 5) {
-			writeString("THANK YOU VERY MUCH!\n");
+			writeString("Thank you very much!\n");
 		} else {
-			writeString("ENILNO IS YOURS!\n");
+			writeString("Enilno is yours!\n");
 			sg._enilnoOwned = true;
 		}
 		break;
 
 	case 0x82:
 		if (goldHundreds < 5) {
-			writeString("THANK YOU VERY MUCH!\n");
+			writeString("Thank you very much!\n");
 		} else if (!sg._ringQuestFlag) {
-			writeString("EARN THE RING!\n");
+			writeString("Earn the Ring!\n");
 		} else {
-			writeString("THE RING IS YOURS!\n");
+			writeString("The Ring is yours!\n");
 			sg._items[Data::ITEM_RING] = MIN(sg._items[Data::ITEM_RING] + 1, Data::MAX_BCD_BYTE);
 		}
 		break;
@@ -366,14 +366,14 @@ void CityCastleLogic::completeOffer(int goldHundreds) {
 	case 0x83: {
 		int idx = 1 + (randByte() & 7);
 		++sg._offerRewardItems[idx];
-		writeString("HERE TAKE THIS!\n");
+		writeString("Here take this!\n");
 		break;
 	}
 
 	default:
 		if (g_engine->_statBoostChoice) {
 			// The upgrade lets the player pick the attribute
-			writeString("1-STR, 2-AGI, 3-STA, 4-CHA, 5-WIS, 6-INT,\nYOUR INTEREST? ");
+			writeString("1-Str, 2-Agi, 3-Sta, 4-Cha, 5-Wis, 6-Int,\nYour interest? ");
 			_offerBoost = goldHundreds;
 			g_engine->addView("StatBoost");
 			return;
@@ -381,7 +381,7 @@ void CityCastleLogic::completeOffer(int goldHundreds) {
 
 		int stat = randByte() & 7;
 		if (stat >= 6) {
-			writeString("THANK YOU VERY MUCH!\n");
+			writeString("Thank you very much!\n");
 		} else {
 			// The upgrade moves on to the next attribute down if the one rolled is already at 99
 			for (int i = 0; i < 6 && attribute(stat) >= Data::MAX_BCD_BYTE; ++i)
@@ -390,7 +390,7 @@ void CityCastleLogic::completeOffer(int goldHundreds) {
 			if (attribute(stat) < Data::MAX_BCD_BYTE)
 				boostAttribute(stat, goldHundreds);
 			else
-				writeString("THANK YOU VERY MUCH!\n");
+				writeString("Thank you very much!\n");
 		}
 		break;
 	}
@@ -414,21 +414,21 @@ void CityCastleLogic::boostAttribute(int stat, int goldHundreds) {
 	// step, clamping the combined total once here gives the same result
 	int16 &value = attribute(stat);
 	value = (int16)MIN(value + 4 * goldHundreds, Data::MAX_BCD_BYTE);
-	writeString("ALAKAZAM!\n");
+	writeString("Alakazam!\n");
 }
 
 void CityCastleLogic::completeStatBoost(int choice) {
 	if (choice >= 1 && choice <= 6)
 		boostAttribute(choice - 1, _offerBoost);
 	else
-		writeString("THANK YOU VERY MUCH!\n");
+		writeString("Thank you very much!\n");
 
 	resumeTurn();
 }
 
 bool CityCastleLogic::tithe() {
 	Data::Savegame &sg = _G(savegame);
-	writeString("WELCOME MY CHILD %s\nFIRST MY 50 G.P. TRIBUTE!\n", sg._name);
+	writeString("Welcome my child %s\nFirst my 50 G.P. tribute!\n", sg._name);
 	if (!trySpendGold(50))
 		return true;
 
@@ -436,7 +436,7 @@ bool CityCastleLogic::tithe() {
 	int hundreds = sg._hp / 100;
 	int heal = (hundreds < 50) ? 3 : (hundreds < 75) ? 2 : (hundreds < 99) ? 1 : 0;
 	sg._hp = MIN(sg._hp + heal * 100, 9999);
-	writeString("AND FOR IT I RAISE THEE %.4d\n", heal * 100);
+	writeString("And for it I raise thee %.4d\n", heal * 100);
 	return true;
 }
 
@@ -451,7 +451,7 @@ bool CityCastleLogic::openShopForCurrentQuadrant() {
 			g_engine->addView("WeaponShop");
 			return false;
 		}
-		writeString("A HOODED FIGURE OFFERS A CLUE FOR GOLD...\n");
+		writeString("A hooded figure offers a clue for gold...\n");
 		return true;
 	}
 
@@ -461,7 +461,7 @@ bool CityCastleLogic::openShopForCurrentQuadrant() {
 			return false;
 		}
 		if (sg._class != Data::CLASS_WIZARD) {
-			writeString("%s YOU ARE NOT A WIZARD!\n", sg._name);
+			writeString("%s you are not a wizard!\n", sg._name);
 			return true;
 		}
 		g_engine->addView("WizardSpellShop");
@@ -483,7 +483,7 @@ bool CityCastleLogic::openShopForCurrentQuadrant() {
 		return false;
 	}
 	if (sg._class != Data::CLASS_CLERIC) {
-		writeString("%s YOU ARE NOT A CLERIC!\n", sg._name);
+		writeString("%s you are not a cleric!\n", sg._name);
 		return true;
 	}
 	g_engine->addView("ClericSpellShop");
@@ -492,7 +492,7 @@ bool CityCastleLogic::openShopForCurrentQuadrant() {
 
 bool CityCastleLogic::transact(Data::Direction dir) {
 	if (dir == Data::DIR_UNSPECIFIED) {
-		writeString("TRANSACT-");
+		writeString("Transact-");
 		_directionPurpose = DirectionPurpose::TRANSACT;
 		g_engine->addView("Direction");
 		return false;
@@ -527,28 +527,28 @@ bool CityCastleLogic::transact(Data::Direction dir) {
 		case Data::TILE_TITHE_ALTAR:
 			return tithe();
 		case Data::TILE_GUARD:
-			writeString("A GUARD SAYS:\nPAY YOUR TAXES!\n");
+			writeString("A guard says:\nPay your taxes!\n");
 			return true;
 		case Data::TILE_JESTER:
-			writeString("A JESTER SINGS:\nHO HO HO!\n");
+			writeString("A jester sings:\nHO HO HO!\n");
 			return true;
 		case Data::TILE_SHOPKEEP:
-			writeString("A MERCHANT SAYS:\nWILL YOU BUY MY APPLES?\n");
+			writeString("A merchant says:\nWill you buy my apples?\n");
 			return true;
 		case Data::TILE_FIGHTER:
-			writeString("A FIGHTER SAYS:\nUGH, ME TOUGH!\n");
+			writeString("A fighter says:\nUGH, ME TOUGH!\n");
 			return true;
 		case Data::TILE_CLERIC:
-			writeString("A CLERIC SAYS:\nBELIEVE!\n");
+			writeString("A cleric says:\nBelieve!\n");
 			return true;
 		case Data::TILE_MAGE:
-			writeString("A WIZARD SAYS:\nHEX-E-POO-HEX-ON-YOU!\n");
+			writeString("A wizard says:\nHex-e-poo-hex-on-you!\n");
 			return true;
 		case Data::TILE_THIEF:
-			writeString("A THIEF SAYS:\nPSST, WANNA BUY A WATCH?\n");
+			writeString("A thief says:\nPsst, wanna buy a watch?\n");
 			return true;
 		default:
-			writeString("FUNNY, NO RESPONSE!\n");
+			writeString("Funny, no response!\n");
 			return true;
 		}
 	}
@@ -557,12 +557,12 @@ bool CityCastleLogic::transact(Data::Direction dir) {
 	Data::TileId t1 = (x1 >= 0 && x1 < Data::MAP_WIDTH && y1 >= 0 && y1 < Data::MAP_HEIGHT) ?
 		_G(map).tileAt(x1, y1) : Data::TILE_WATER;
 	if (t1 < Data::TILE_A && t1 != Data::TILE_EMPTY_COUNTER) {
-		writeString("FUNNY, NO RESPONSE!\n");
+		writeString("Funny, no response!\n");
 		return true;
 	}
 
 	if (!shopkeeperAt(sg._mapX + dx * 2, sg._mapY + dy * 2)) {
-		writeString("FUNNY, NO RESPONSE!\n");
+		writeString("Funny, no response!\n");
 		return true;
 	}
 
diff --git a/engines/ultima/ultima2/logic/dungeon_logic.cpp b/engines/ultima/ultima2/logic/dungeon_logic.cpp
index 9470f9dcfcd..71784b12d8f 100644
--- a/engines/ultima/ultima2/logic/dungeon_logic.cpp
+++ b/engines/ultima/ultima2/logic/dungeon_logic.cpp
@@ -78,11 +78,11 @@ bool DungeonLogic::move(Data::Direction dir) {
 
 bool DungeonLogic::advance() {
 	Data::Savegame &sg = _G(savegame);
-	writeString("ADVANCE");
+	writeString("Advance");
 
 	byte front = cellAt((byte)(sg._mapX + sg._facingX), (byte)(sg._mapY + sg._facingY));
 	if ((front & 0x0F) != 0 || front == CELL_WALL) {
-		writeString("-BLOCKED!\n");
+		writeString("-Blocked!\n");
 		return true;
 	}
 
@@ -97,25 +97,25 @@ bool DungeonLogic::advance() {
 
 	sg._lightTurns = 0;
 	playFX(Data::SFX_TRAP);
-	writeString("\nARGH! A TRAP!\n");
+	writeString("\nARGH! A trap!\n");
 
 	if (sg._thievesTools == 0) {
 		playerDied();
 		return false;
 	}
 
-	writeString("ESCAPED! BY USE OF TOOLS!\n");
+	writeString("Escaped! By use of tools!\n");
 	--sg._thievesTools;
 	return true;
 }
 
 bool DungeonLogic::retreat() {
 	Data::Savegame &sg = _G(savegame);
-	writeString("RETREAT");
+	writeString("Retreat");
 
 	byte back = cellAt((byte)(sg._mapX - sg._facingX), (byte)(sg._mapY - sg._facingY));
 	if ((back & 0x8F) != 0) {
-		writeString("-BLOCKED!\n");
+		writeString("-Blocked!\n");
 		return true;
 	}
 
@@ -127,7 +127,7 @@ bool DungeonLogic::retreat() {
 
 bool DungeonLogic::turn(bool left) {
 	Data::Savegame &sg = _G(savegame);
-	writeString(left ? "TURN LEFT\n" : "TURN RIGHT\n");
+	writeString(left ? "Turn left\n" : "Turn right\n");
 
 	int8 fx = sg._facingX, fy = sg._facingY;
 	if (left) {
@@ -152,7 +152,7 @@ bool DungeonLogic::turn(bool left) {
 }
 
 void DungeonLogic::printLevel() {
-	writeString("\nTO LEVEL %02d\n", _G(savegame)._dungeonLevel);
+	writeString("\nTo level %02d\n", _G(savegame)._dungeonLevel);
 }
 
 void DungeonLogic::surface() {
@@ -178,10 +178,10 @@ void DungeonLogic::changeLevel(int delta) {
 
 bool DungeonLogic::descend() {
 	Data::Savegame &sg = _G(savegame);
-	writeString("DESCEND");
+	writeString("Descend");
 
 	if ((cellAt(sg._mapX, sg._mapY) & CELL_LADDER_DOWN) == 0) {
-		writeString("-WHAT?\n");
+		writeString("-what?\n");
 		return true;
 	}
 
@@ -192,10 +192,10 @@ bool DungeonLogic::descend() {
 
 bool DungeonLogic::klimb() {
 	Data::Savegame &sg = _G(savegame);
-	writeString("KLIMB");
+	writeString("Klimb");
 
 	if ((cellAt(sg._mapX, sg._mapY) & CELL_LADDER_UP) == 0) {
-		writeString("-WHAT?\n");
+		writeString("-what?\n");
 		return true;
 	}
 
@@ -205,26 +205,26 @@ bool DungeonLogic::klimb() {
 
 bool DungeonLogic::get() {
 	Data::Savegame &sg = _G(savegame);
-	writeString("GET");
+	writeString("Get");
 
 	byte &cell = cellAt(sg._mapX, sg._mapY);
 	if (cell != CELL_CHEST) {
-		writeString(" WHAT?\n");
+		writeString(" What?\n");
 		return true;
 	}
 
-	writeString(" CHEST!\nIT CONTAINS ");
+	writeString(" Chest!\nIt contains ");
 	cell = 0;
 
 	int level = sg._dungeonLevel;
 	if (level == MAX_LEVEL) {
-		writeString("TRI-LITHIUM!\n");
+		writeString("Tri-lithium!\n");
 		sg._items[Data::ITEM_TRI_LITHIUM] = MIN(sg._items[Data::ITEM_TRI_LITHIUM] + 1, Data::MAX_BCD_BYTE);
 		return true;
 	}
 
 	if (randByte() >= 0x40) {
-		writeString("GOLD!\n");
+		writeString("Gold!\n");
 		int amount = ((randByte() & 0x1F) + level * 2) & 0x77;
 		sg._gold = MIN(sg._gold + Data::bcdValue(amount), Data::MAX_BCD_WORD);
 		return true;
@@ -232,7 +232,7 @@ bool DungeonLogic::get() {
 
 	// Even levels hold weapons, odd ones armour
 	if ((level & 1) == 0) {
-		writeString("A  WEAPON");
+		writeString("A  Weapon");
 		int r = randByte() & 7;
 		if (r != 0) {
 			sg._weaponOwned[r] = MIN(sg._weaponOwned[r] + 1, Data::MAX_BCD_BYTE);
@@ -240,7 +240,7 @@ bool DungeonLogic::get() {
 			return true;
 		}
 	} else {
-		writeString(" ARMOUR");
+		writeString(" Armour");
 		int r = randByte() & 3;
 		if (r != 0) {
 			sg._armorOwned[r] = MIN(sg._armorOwned[r] + 1, Data::MAX_BCD_BYTE);
@@ -249,7 +249,7 @@ bool DungeonLogic::get() {
 		}
 	}
 
-	writeString(" EMPTY!\n");
+	writeString(" Empty!\n");
 	return true;
 }
 
@@ -263,11 +263,11 @@ void DungeonLogic::killMonster(int slot) {
 	monsters._glyphTile[slot] = 0;
 
 	int gold = Data::bcdValue((randByte() & 0x17) | 1);
-	writeString("\nKILLED--GOLD+%.2d", gold);
+	writeString("\nKilled--Gold+%.2d", gold);
 	sg._gold = MIN(sg._gold + gold, Data::MAX_BCD_WORD);
 
 	int exp = randByte() & 7;
-	writeString("--EXP.+%.2d\n", exp);
+	writeString("--Exp.+%.2d\n", exp);
 	sg._experience = MIN(sg._experience + exp, Data::MAX_BCD_WORD);
 }
 
@@ -275,11 +275,11 @@ bool DungeonLogic::attack(Data::Direction dir) {
 	Data::Savegame &sg = _G(savegame);
 	Data::MapMonsters &monsters = _G(map)._monsters;
 	playFX(Data::SFX_ATTACK);
-	writeString("ATTACK--");
+	writeString("Attack--");
 
 	byte x = sg._mapX + sg._facingX, y = sg._mapY + sg._facingY;
 	if ((cellAt(x, y) & 7) == 0) {
-		writeString("MISS\n");
+		writeString("Miss\n");
 		return true;
 	}
 
@@ -295,12 +295,12 @@ bool DungeonLogic::attack(Data::Direction dir) {
 	// Both checks compare against the raw packed-BCD attribute bytes, not
 	// their decimal values, matching the original's own arithmetic
 	if (slot < 0 || (randByte() >> 1) >= Data::toBcd(sg._agility)) {
-		writeString("MISS\n");
+		writeString("Miss\n");
 		return true;
 	}
 
 	playFX(Data::SFX_HIT);
-	writeString("HIT!");
+	writeString("Hit!");
 	int dmg = (sg._readiedWeapon * 8 + Data::toBcd(sg._strength)) >> 2;
 	byte &hp = monsters._spellHP[slot];
 
@@ -405,7 +405,7 @@ bool DungeonLogic::castSpell(Data::SpellType spell) {
 	}
 
 	playFX(Data::SFX_FAIL);
-	writeString("-FAILED!\n");
+	writeString("-Failed!\n");
 	return true;
 }
 
@@ -452,13 +452,13 @@ bool DungeonLogic::monsterAttacks(int slot) {
 		switch (monsters._type[slot]) {
 		case 2:
 			if (sg._lightTurns != 0) {
-				writeString("YOUR TORCH IS BLOWN OUT!\n");
+				writeString("Your torch is blown out!\n");
 				sg._lightTurns = 0;
 			}
 			return true;
 
 		case 5:
-			writeString("A GREMLIN STOLE SOME FOOD!\n");
+			writeString("A Gremlin stole some food!\n");
 			if (sg._food < 100) {
 				playerDied();
 				return false;
@@ -467,7 +467,7 @@ bool DungeonLogic::monsterAttacks(int slot) {
 			return true;
 
 		case 7:
-			writeString("YOU FEEL A STRONG MAGIC!\n");
+			writeString("You feel a strong magic!\n");
 			sg._sleepTurns = randByte() & 7;
 			return true;
 
@@ -558,9 +558,9 @@ void DungeonLogic::updateCreatures() {
 	}
 
 	if (sg._lightTurns == 0) {
-		writeString("IT'S DARK!\n");
+		writeString("It's dark!\n");
 	} else if (--sg._lightTurns == 0) {
-		writeString("TORCH BURNED OUT!\n");
+		writeString("Torch Burned out!\n");
 	}
 
 	if (!sg.deductFood(16))
diff --git a/engines/ultima/ultima2/logic/logic.cpp b/engines/ultima/ultima2/logic/logic.cpp
index c173f97a601..e5707bbaa94 100644
--- a/engines/ultima/ultima2/logic/logic.cpp
+++ b/engines/ultima/ultima2/logic/logic.cpp
@@ -59,7 +59,7 @@ void Logic::redrawStats() {
 
 void Logic::playerDied() {
 	Data::Savegame &sg = _G(savegame);
-	writeString("\n%s IS DEAD!\n", sg._name);
+	writeString("\n%s is dead!\n", sg._name);
 
 	g_engine->replaceView("Dead", true);
 }
@@ -221,7 +221,7 @@ void Logic::action(int action) {
 		doEndOfTurn = zstats();
 		break;
 	default:
-		writeString("-ILLEGAL COMMAND!\n");
+		writeString("-Illegal Command!\n");
 		break;
 	}
 
@@ -275,7 +275,7 @@ bool Logic::trySpendGold(int amount) {
 }
 
 void Logic::keypress(const Graphics::Views::KeypressMessage &msg) {
-	writeString("-ILLEGAL COMMAND!\n");
+	writeString("-Illegal Command!\n");
 	endOfTurn();
 	prompt();
 }
@@ -287,10 +287,10 @@ bool Logic::attack(Data::Direction dir) {
 
 bool Logic::board() {
 	Data::Savegame &sg = _G(savegame);
-	writeString("BOARD");
+	writeString("Board");
 
 	if (sg._mapType >= 4 || sg._mount != 0) {
-		writeString("\nTHINK AGAIN %s\n", sg._name);
+		writeString("\nThink again %s\n", sg._name);
 		return true;
 	}
 
@@ -299,32 +299,32 @@ bool Logic::board() {
 
 	switch (vehicle) {
 	case Data::TILE_HORSE:
-		writeString(" HORSE");
+		writeString(" Horse");
 		break;
 	case Data::TILE_SHIP:
 		if (sg._items[Data::ITEM_BLUE_TASSLE] == 0) {
-			writeString(" SHIP\nTHE CREW OF THIS SHIP\nWILL NOT LET YOU BOARD!\n");
+			writeString(" Ship\nThe crew of this ship\nwill not let you board!\n");
 			return true;
 		}
-		writeString(" FRIGATE");
+		writeString(" Frigate");
 		under = Data::TILE_WATER;
 		break;
 	case Data::TILE_AIRPLANE:
 		if (sg._items[Data::ITEM_SKULL_KEY] == 0) {
-			writeString(" PLANE\nSTRANGE YOU CAN'T GET IN!\n");
+			writeString(" Plane\nStrange you can't get in!\n");
 			return true;
 		}
-		writeString(" PLANE");
+		writeString(" Plane");
 		break;
 	case Data::TILE_ROCKET:
-		writeString(" ROCKET");
+		writeString(" Rocket");
 		if (sg._items[Data::ITEM_ANKH] == 0) {
-			writeString("\nA METALIC VOICE COMMANDS:\nYOU MUST HAVE AN ANKH!\n");
+			writeString("\nA metalic voice commands:\nYou must have an Ankh!\n");
 			return true;
 		}
 		break;
 	default:
-		writeString(" WHAT?\n");
+		writeString(" what?\n");
 		return true;
 	}
 
@@ -336,11 +336,11 @@ bool Logic::board() {
 
 bool Logic::cast() {
 	Data::Savegame &sg = _G(savegame);
-	writeString("CAST-%s", Data::SPELL_NAMES[sg._readiedSpell]);
+	writeString("Cast-%s", Data::SPELL_NAMES[sg._readiedSpell]);
 
 	if (sg._items[Data::ITEM_WAND] + sg._items[Data::ITEM_STAFF] == 0) {
 		playFX(Data::SFX_FAIL);
-		writeString("\nNEED WAND OR STAFF!\n");
+		writeString("\nNeed wand or staff!\n");
 		return true;
 	}
 
@@ -351,7 +351,7 @@ bool Logic::cast() {
 
 	if (sg._spellCharges[sg._readiedSpell] == 0) {
 		playFX(Data::SFX_FAIL);
-		writeString("\nNO SPELL!\n");
+		writeString("\nNo spell!\n");
 		return true;
 	}
 
@@ -362,40 +362,40 @@ bool Logic::cast() {
 bool Logic::castSpell(Data::SpellType spell) {
 	// Spells only work in towers and dungeons
 	playFX(Data::SFX_FAIL);
-	writeString("-FAILED!\n");
+	writeString("-Failed!\n");
 	return true;
 }
 
 bool Logic::descend() {
 	// Ladders only exist in towers and dungeons
-	writeString("DESCEND-WHAT?\n");
+	writeString("Descend-what?\n");
 	return true;
 }
 
 bool Logic::enter() {
-	writeString("ENTER WHAT?\n");
+	writeString("Enter what?\n");
 	return true;
 }
 
 bool Logic::fire(Data::Direction dir) {
-	writeString("FIRE WHAT?\n");
+	writeString("Fire what?\n");
 	return true;
 }
 
 bool Logic::get() {
 	Data::Savegame &sg = _G(savegame);
-	writeString("GET");
+	writeString("Get");
 
 	Data::TileId tile = _G(map).tileAt(sg._mapX, sg._mapY);
 	if (tile != Data::TILE_SWORD && tile != Data::TILE_SHIELD) {
-		writeString(" WHAT?\n");
+		writeString(" what?\n");
 		return true;
 	}
 
 	_G(map)._tiles[sg._mapY][sg._mapX] = Data::TILE_GRASS;
 
 	if (tile == Data::TILE_SWORD) {
-		writeString(" WEAPON");
+		writeString(" Weapon");
 		int r = randByte() & 7;
 		if (r != 0) {
 			sg._weaponOwned[r] = MIN(sg._weaponOwned[r] + 1, Data::MAX_BCD_BYTE);
@@ -403,7 +403,7 @@ bool Logic::get() {
 			return true;
 		}
 	} else {
-		writeString(" ARMOUR");
+		writeString(" Armour");
 		int r = randByte() & 3;
 		if (r != 0) {
 			sg._armorOwned[r] = MIN(sg._armorOwned[r] + 1, Data::MAX_BCD_BYTE);
@@ -412,24 +412,24 @@ bool Logic::get() {
 		}
 	}
 
-	writeString(" EMPTY!\n");
+	writeString(" Empty!\n");
 	return true;
 }
 
 bool Logic::hyper() {
-	writeString("HYPER WHAT?\n");
+	writeString("Hyper WHAT?\n");
 	return true;
 }
 
 bool Logic::igniteTorch() {
-	writeString("IGNITE TORCH\n");
+	writeString("Ignite Torch\n");
 	Data::Savegame &sg = _G(savegame);
 
 	if (sg._mapType < 4)
 		return true;
 
 	if (sg._torches == 0) {
-		writeString("NONE OWNED!\n");
+		writeString("None owned!\n");
 		return true;
 	}
 
@@ -439,13 +439,13 @@ bool Logic::igniteTorch() {
 }
 
 bool Logic::jump() {
-	writeString("JUMP...WHEE...\n");
+	writeString("Jump...WHEE...\n");
 	return true;
 }
 
 bool Logic::klimb() {
 	// Ladders only exist in towers and dungeons
-	writeString("KLIMB-WHAT?\n");
+	writeString("Klimb-what?\n");
 	return true;
 }
 
@@ -453,22 +453,22 @@ bool Logic::launch() {
 	Data::Savegame &sg = _G(savegame);
 
 	if (sg._mount == Data::TILE_AIRPLANE) {
-		writeString("LAUNCH--PLANE");
+		writeString("Launch--Plane");
 		if (sg._items[Data::ITEM_BRASS_BUTTON] == 0) {
-			writeString("\nFUNNY THIS PLANE IS\nMISSING A BRASS BUTTON!\n");
+			writeString("\nFunny this plane is\nmissing a Brass Button!\n");
 			return true;
 		}
 
 		g_engine->addView("PlaneFlight");
 		return false;
 	} else if (sg._mount == Data::TILE_ROCKET) {
-		writeString("LAUNCH--ROCKET");
+		writeString("Launch--Rocket");
 		if (sg._items[Data::ITEM_TRI_LITHIUM] == 0) {
-			writeString("\nA METALLIC VOICE SAYS:\nSHIP INCAPABLE OF LAUNCH!\n");
+			writeString("\nA Metallic voice says:\nShip incapable of launch!\n");
 			return true;
 		}
 
-		writeString("\nPREPARE FOR LAUNCH!\n");
+		writeString("\nPrepare for launch!\n");
 
 		// The first launch from Earth remembers where to come back to
 		if (sg._orbitTarget == 0 && sg._mapType == 0) {
@@ -480,7 +480,7 @@ bool Logic::launch() {
 		SpaceLogic::takeOff();
 		return false;
 	} else {
-		writeString("LAUNCH WHAT?\n");
+		writeString("Launch what?\n");
 	}
 
 	return true;
@@ -493,14 +493,14 @@ bool Logic::magic() {
 
 bool Logic::negateTime() {
 	Data::Savegame &sg = _G(savegame);
-	writeString("NEGATE TIME");
+	writeString("Negate Time");
 
 	if (sg._items[Data::ITEM_STRANGE_COIN] == 0) {
-		writeString(" HOW?\nYOU'RE NOT EINSTEIN\n");
+		writeString(" How?\nYou're not Einstein\n");
 
 	} else {
 		--sg._items[Data::ITEM_STRANGE_COIN];
-		writeString("\nYOU RUB A COIN...\n");
+		writeString("\nYou rub a Coin...\n");
 		sg._negateTimeTurns = 20;
 	}
 
@@ -509,20 +509,20 @@ bool Logic::negateTime() {
 
 bool Logic::offer(Data::Direction dir) {
 	if (dir == Data::DIR_UNSPECIFIED) {
-		writeString("OFFER GOLD DIRECT-");
+		writeString("Offer gold direct-");
 		_directionPurpose = DirectionPurpose::OFFER;
 		g_engine->addView("Direction");
 		return false;
 	}
 
 	// Outside a settlement there's never anyone to give gold to
-	writeString("\nOFFER TO WHOM?\n");
+	writeString("\nOffer to whom?\n");
 	return true;
 }
 
 bool Logic::pass() {
 	Data::Savegame &sg = _G(savegame);
-	writeString("PASS\n");
+	writeString("Pass\n");
 
 	// Waiting costs a little food outside towers and dungeons
 	if (sg._mapType < 4 && !sg.deductFood(10)) {
@@ -535,16 +535,16 @@ bool Logic::pass() {
 
 bool Logic::quit() {
 	Data::Savegame &sg = _G(savegame);
-	writeString("QUIT OR SAVE GAME.");
+	writeString("Quit or save game.");
 
 	if (sg._mapType != 0)
-		writeString("\nONLY OUTDOORS!\n");
+		writeString("\nOnly outdoors!\n");
 	else if (sg.saveDisabled() && !g_engine->isEnhanced())
-		writeString("\nONLY ON EARTH!\n");
+		writeString("\nOnly on Earth!\n");
 	else if (sg._mount != 0 && !g_engine->isEnhanced())
-		writeString("\nONLY ON FOOT!\n");
+		writeString("\nOnly on foot!\n");
 	else {
-		writeString("\nONE MOMENT PLEASE!\n");
+		writeString("\nOne moment please!\n");
 		g_engine->saveGameDialog();
 	}
 
@@ -558,14 +558,14 @@ bool Logic::ready() {
 
 bool Logic::steal(Data::Direction dir) {
 	if (dir == Data::DIR_UNSPECIFIED) {
-		writeString("STEAL DIRECT-");
+		writeString("Steal direct-");
 		_directionPurpose = DirectionPurpose::STEAL;
 		g_engine->addView("Direction");
 		return false;
 	}
 
 	// Outside a settlement there's nothing to steal
-	writeString("\nNO LUCK!\n");
+	writeString("\nNo luck!\n");
 	if ((randByte() & 7) == 0)
 		alertTownGuards();
 	return true;
@@ -573,26 +573,26 @@ bool Logic::steal(Data::Direction dir) {
 
 bool Logic::transact(Data::Direction dir) {
 	if (dir == Data::DIR_UNSPECIFIED) {
-		writeString("TRANSACT-");
+		writeString("Transact-");
 		_directionPurpose = DirectionPurpose::TRANSACT;
 		g_engine->addView("Direction");
 		return false;
 	}
 
-	writeString("\nFUNNY, NO RESPONSE!\n");
+	writeString("\nFunny, no response!\n");
 	return true;
 }
 
 bool Logic::unlock(Data::Direction dir) {
 	if (dir == Data::DIR_UNSPECIFIED) {
-		writeString("UNLOCK DIRECTION-");
+		writeString("Unlock direction-");
 		_directionPurpose = DirectionPurpose::UNLOCK;
 		g_engine->addView("Direction");
 		return false;
 	}
 
 	// Outside a settlement there are no doors
-	writeString("\nNO DOOR THERE!\n");
+	writeString("\nNo door there!\n");
 	return true;
 }
 
@@ -600,11 +600,11 @@ bool Logic::view() {
 	Data::Savegame &sg = _G(savegame);
 
 	if (sg._items[Data::ITEM_HELM] == 0 || sg._mapType >= 4) {
-		writeString("VIEW WHAT?\n");
+		writeString("View what?\n");
 		return true;
 	}
 
-	writeString("VIEW\nWITH MAGICAL HELM!\n");
+	writeString("View\nwith Magical Helm!\n");
 	--sg._items[Data::ITEM_HELM];
 	g_engine->addView("HelmMap");
 	return false;
@@ -617,16 +617,16 @@ bool Logic::wearArmor() {
 
 bool Logic::xit() {
 	Data::Savegame &sg = _G(savegame);
-	writeString("X-IT");
+	writeString("X-it");
 
 	if (sg._mount == 0) {
-		writeString(" WHAT?\n");
+		writeString(" what?\n");
 		return true;
 	}
 
 	Data::TileId under = _G(map).tileAt(sg._mapX, sg._mapY);
 	if (under != Data::TILE_GRASS && !(under == Data::TILE_WATER && sg._mount == Data::TILE_SHIP)) {
-		writeString("-NOT HERE!\n");
+		writeString("-Not here!\n");
 		return true;
 	}
 
diff --git a/engines/ultima/ultima2/logic/overworld_logic.cpp b/engines/ultima/ultima2/logic/overworld_logic.cpp
index 8e3142d2b2c..bcdcd8f6686 100644
--- a/engines/ultima/ultima2/logic/overworld_logic.cpp
+++ b/engines/ultima/ultima2/logic/overworld_logic.cpp
@@ -103,9 +103,9 @@ OverworldLogic::StepResult OverworldLogic::stepOnto(int x, int y) {
 		}
 	} else if (dest == Data::TILE_FORCEFIELD) {
 		if (sg._items[Data::ITEM_RING] != 0) {
-			writeString("RING PROTECTS FROM FIELD!\n");
+			writeString("Ring protects from field!\n");
 		} else {
-			writeString("FIELD CAUSES 1000 DAMAGE!\n");
+			writeString("Field causes 1000 damage!\n");
 			if (!sg.deductHP(1000)) {
 				playerDied();
 				return STEP_DIED;
@@ -114,7 +114,7 @@ OverworldLogic::StepResult OverworldLogic::stepOnto(int x, int y) {
 	}
 
 	if (sg._legParalysisTurns > 0) {
-		writeString("--PARALIZED!\n");
+		writeString("--Paralized!\n");
 		return STEP_PARALYZED;
 	}
 
@@ -155,19 +155,19 @@ bool OverworldLogic::move(Data::Direction dir) {
 	switch (dir) {
 	case Data::DIR_UP:
 		newY = (newY + Data::MAP_HEIGHT - 1) % Data::MAP_HEIGHT;
-		dirName = "NORTH";
+		dirName = "North";
 		break;
 	case Data::DIR_DOWN:
 		newY = (newY + 1) % Data::MAP_HEIGHT;
-		dirName = "SOUTH";
+		dirName = "South";
 		break;
 	case Data::DIR_LEFT:
 		newX = (newX + Data::MAP_WIDTH - 1) % Data::MAP_WIDTH;
-		dirName = "WEST";
+		dirName = "West";
 		break;
 	case Data::DIR_RIGHT:
 		newX = (newX + 1) % Data::MAP_WIDTH;
-		dirName = "EAST";
+		dirName = "East";
 		break;
 	default:
 		return true;
@@ -182,7 +182,7 @@ bool OverworldLogic::move(Data::Direction dir) {
 	case STEP_PARALYZED:
 		return true;
 	case STEP_BLOCKED:
-		writeString("--INVALID MOVE!\n");
+		writeString("--Invalid move!\n");
 		return true;
 	case STEP_MOONGATE:
 		enterMoongate(newX, newY);
@@ -211,7 +211,7 @@ void OverworldLogic::enterMoongate(int x, int y) {
 	// show corrupted terrain if that era's map data turns out to be
 	// missing or truncated; bail out untouched rather than risk the same
 	if (!_G(map).canLoad(era, 0)) {
-		writeString("THE GATE FLICKERS AND FAILS!\n");
+		writeString("The gate flickers and fails!\n");
 		return;
 	}
 
@@ -358,7 +358,7 @@ void OverworldLogic::updateCreatures() {
 				int itemIdx = randByte() & 0xF;
 				if (sg._items[itemIdx] > 0) {
 					--sg._items[itemIdx];
-					writeString("A THIEF STOLE SOMETHING!\n");
+					writeString("A thief stole something!\n");
 				}
 			}
 
@@ -464,10 +464,10 @@ bool OverworldLogic::attack(Data::Direction dir) {
 	Data::Savegame &sg = _G(savegame);
 
 	if (dir == Data::DIR_UNSPECIFIED) {
-		writeString("ATTACK--");
+		writeString("Attack--");
 
 		if (sg._armParalysisTurns > 0) {
-			writeString("PARALIZED!\n");
+			writeString("Paralized!\n");
 			return true;
 		}
 
@@ -494,7 +494,7 @@ bool OverworldLogic::attack(Data::Direction dir) {
 	// Both checks compare against the raw packed-BCD attribute bytes, not
 	// their decimal values, matching the original's own arithmetic
 	if (slot < 0 || (randByte() >> 1) >= Data::toBcd(sg._agility)) {
-		writeString("--MISS\n");
+		writeString("--Miss\n");
 		resumeTurn();
 		return false;
 	}
@@ -524,14 +524,14 @@ bool OverworldLogic::fire(Data::Direction dir) {
 	Data::Savegame &sg = _G(savegame);
 
 	if (dir == Data::DIR_UNSPECIFIED) {
-		writeString("FIRE");
+		writeString("Fire");
 
 		if (sg._mount != Data::TILE_SHIP) {
-			writeString(" WHAT?\n");
+			writeString(" what?\n");
 			return true;
 		}
 
-		writeString(" DIRECT-");
+		writeString(" Direct-");
 		_directionPurpose = DirectionPurpose::FIRE;
 		g_engine->addView("Direction");
 		return false;
@@ -551,7 +551,7 @@ bool OverworldLogic::fire(Data::Direction dir) {
 	int slot = findTargetMonster(tx, ty);
 
 	if (slot < 0) {
-		writeString("--MISS\n");
+		writeString("--Miss\n");
 		return true;
 	}
 
@@ -582,11 +582,11 @@ void OverworldLogic::minaxFlees(int slot) {
 	monsters._mapY[slot] = oldX;
 	monsters._offerFlag[slot] = 0x84;
 
-	writeString("\nSHE'S GONE!!!\n");
+	writeString("\nShe's gone!!!\n");
 }
 
 void OverworldLogic::minaxDeathSequence() {
-	writeString("\n\n     MINAX IS DEAD!!\nALL HER WORKS SHALL DIE!\n");
+	writeString("\n\n     Minax is dead!!\nAll her works shall die!\n");
 
 	// The castle crumbles into rubble before the screen hands off to the
 	// endless victory pan
@@ -602,18 +602,18 @@ void OverworldLogic::minaxDeathSequence() {
 		g_engine->pauseMillis(30);
 	}
 
-	writeString("\nYOU FEEL A STRANGE FORCE!\n");
+	writeString("\nYou feel a strange force!\n");
 	g_engine->addView("Ending");
 }
 
 void OverworldLogic::legParalysisTrap() {
 	Data::Savegame &sg = _G(savegame);
-	writeString("LEGS PARALIZED!\n");
+	writeString("Legs paralized!\n");
 	playFX(Data::SFX_MAGIC);
 	showAttackTile(sg._mapX, sg._mapY);
 
 	if (sg._items[Data::ITEM_BOOTS] != 0 && randByte() >= 0x40) {
-		writeString("SAVED BY MAGICAL BOOTS!\n");
+		writeString("Saved by Magical Boots!\n");
 		return;
 	}
 
@@ -622,12 +622,12 @@ void OverworldLogic::legParalysisTrap() {
 
 void OverworldLogic::armParalysisTrap() {
 	Data::Savegame &sg = _G(savegame);
-	writeString("ARMS PARALIZED!\n");
+	writeString("Arms paralized!\n");
 	playFX(Data::SFX_MAGIC);
 	showAttackTile(sg._mapX, sg._mapY);
 
 	if (sg._items[Data::ITEM_CLOAK] != 0 && randByte() >= 0x40) {
-		writeString("SAVED BY MAGICAL CLOAK\n");
+		writeString("Saved by Magical Cloak\n");
 		return;
 	}
 
@@ -636,19 +636,19 @@ void OverworldLogic::armParalysisTrap() {
 
 void OverworldLogic::magicMissileTrap() {
 	Data::Savegame &sg = _G(savegame);
-	writeString("MAGIC MISSILE!\n");
+	writeString("Magic Missile!\n");
 	playFX(Data::SFX_MAGIC);
 	showAttackTile(sg._mapX, sg._mapY);
 }
 
 void OverworldLogic::sleepTrap() {
 	Data::Savegame &sg = _G(savegame);
-	writeString("SLEEP SPELL!\n");
+	writeString("Sleep Spell!\n");
 	playFX(Data::SFX_MAGIC);
 	showAttackTile(sg._mapX, sg._mapY);
 
 	if (sg._items[Data::ITEM_GREEN_IDOL] != 0 && randByte() >= 0x40) {
-		writeString("SAVED BY IDOL!\n");
+		writeString("Saved by Idol!\n");
 		return;
 	}
 
@@ -657,7 +657,7 @@ void OverworldLogic::sleepTrap() {
 
 bool OverworldLogic::minaxCurseTrap() {
 	Data::Savegame &sg = _G(savegame);
-	writeString("MINAX CRIES: DIE FOOL!\n");
+	writeString("Minax cries: Die fool!\n");
 	showAttackTile(sg._mapX, sg._mapY);
 
 	if (!sg.deductHP(1)) {
@@ -715,7 +715,7 @@ void OverworldLogic::killMonster(int slot) {
 	int expAmt = (randByte() & 3) + 1;
 	sg._gold = MIN(sg._gold + goldAmt, Data::MAX_BCD_WORD);
 	sg._experience = MIN(sg._experience + expAmt, Data::MAX_BCD_WORD);
-	writeString("KILLED--GOLD+%.2d--EXP.+%.2d\n", goldAmt, expAmt);
+	writeString("Killed--Gold+%.2d--Exp.+%.2d\n", goldAmt, expAmt);
 }
 
 void OverworldLogic::enterLocalMap(int mapType) {
@@ -744,53 +744,53 @@ void OverworldLogic::enterDungeon(int mapType) {
 
 bool OverworldLogic::enter() {
 	Data::Savegame &sg = _G(savegame);
-	writeString("ENTER");
+	writeString("Enter");
 
 	if (sg._mapType != 0) {
-		writeString(" WHAT?\n");
+		writeString(" what?\n");
 		return true;
 	}
 
 	// The upgrade lets a horse be ridden into places, but not a vehicle
 	const bool onHorse = sg._mount == Data::TILE_HORSE && g_engine->isEnhanced();
 	if (sg._mount != 0 && !onHorse) {
-		writeString("-ONLY ON FOOT!\n");
+		writeString("-Only on foot!\n");
 		return true;
 	}
 
 	Data::TileId tile = _G(map).tileAt(sg._mapX, sg._mapY);
 	switch (tile) {
 	case Data::TILE_VILLAGE:
-		writeString("-VILLAGE\n");
+		writeString("-Village\n");
 		enterLocalMap(1);
 		return true;
 	case Data::TILE_TOWN:
-		writeString("-TOWN\n");
+		writeString("-Town\n");
 		enterLocalMap(2);
 		return true;
 	case Data::TILE_CASTLE:
-		writeString("-CASTLE\n");
+		writeString("-Castle\n");
 		enterLocalMap(3);
 		return true;
 	case Data::TILE_TOWER:
-		writeString("-TOWER\n");
+		writeString("-Tower\n");
 		enterDungeon(4);
 		return true;
 	case Data::TILE_DUNGEON_ENTRANCE:
-		writeString("-DUNGEON\n");
+		writeString("-Dungeon\n");
 		enterDungeon(5);
 		return true;
 	case Data::TILE_SIGNPOST: {
 		static const char *const ERA_TEXT[5] = {
-			"ANOS: LEGENDS!", "ANOS: 9,000,000 B.C.", "ANOS: 1423 B.C.",
-			"ANOS: 1990 A.D.", "ANOS: 2112 A.D."
+			"Anos: Legends!", "Anos: 9,000,000 B.C.", "Anos: 1423 B.C.",
+			"Anos: 1990 A.D.", "Anos: 2112 A.D."
 		};
 		int era = (sg._mapEra < 5) ? sg._mapEra : 4;
-		writeString("-THE SIGN READS:\n%s\n", ERA_TEXT[era]);
+		writeString("-The sign reads:\n%s\n", ERA_TEXT[era]);
 		return true;
 	}
 	default:
-		writeString(" WHAT?\n");
+		writeString(" what?\n");
 		return true;
 	}
 }
diff --git a/engines/ultima/ultima2/logic/space_logic.cpp b/engines/ultima/ultima2/logic/space_logic.cpp
index cae61df9600..5283bc8c5d6 100644
--- a/engines/ultima/ultima2/logic/space_logic.cpp
+++ b/engines/ultima/ultima2/logic/space_logic.cpp
@@ -92,7 +92,7 @@ bool SpaceLogic::announceOrbit() {
 	const byte *coords = sg._hyperwarpCoords;
 
 	if (coords[0] == 4 && coords[1] == 4 && coords[2] == 4) {
-		writeString("\n\nYOU HIT THE SUN!\n");
+		writeString("\n\nYou hit the Sun!\n");
 		playerDied();
 		return false;
 	}
@@ -101,13 +101,13 @@ bool SpaceLogic::announceOrbit() {
 		if (coords[0] == Data::PLANET_COORDS[world][0] && coords[1] == Data::PLANET_COORDS[world][1] &&
 				coords[2] == Data::PLANET_COORDS[world][2]) {
 			sg._orbitTarget = world;
-			writeString("YOU ARE ORBITING %s.\n", world == PLANET_X ? "X" : Data::PLANET_NAMES[world]);
+			writeString("You are orbiting %s.\n", world == PLANET_X ? "X" : Data::PLANET_NAMES[world]);
 			return true;
 		}
 	}
 
 	sg._orbitTarget = DEEP_SPACE;
-	writeString("YOU ARE IN DEEP SPACE.\n");
+	writeString("You are in deep space.\n");
 	return true;
 }
 
@@ -117,7 +117,7 @@ void SpaceLogic::warpFinished() {
 
 	// The ship strays when the fuel level's low digit is a 3 or 7
 	if ((Data::toBcd(sg._items[Data::ITEM_TRI_LITHIUM] % 100) & 3) == 3) {
-		writeString("SHIP OFF COURSE!\n");
+		writeString("Ship off course!\n");
 		for (int i = 0; i < 3; ++i)
 			sg._hyperwarpCoords[i] = view->nextStarCoord() & 7;
 	}
@@ -129,7 +129,7 @@ void SpaceLogic::warpFinished() {
 		_launching = false;
 
 		if (sg._readiedArmor < SAFE_ARMOR) {
-			writeString("\nYOU HAVE EXPLODED!\n\n");
+			writeString("\nYou have exploded!\n\n");
 			playerDied();
 			return;
 		}
@@ -143,7 +143,7 @@ void SpaceLogic::hyperwarp() {
 	Data::Savegame &sg = _G(savegame);
 
 	if (sg._items[Data::ITEM_TRI_LITHIUM] == 0) {
-		writeString("NO FUEL!\n");
+		writeString("No fuel!\n");
 		prompt();
 		return;
 	}
@@ -151,7 +151,7 @@ void SpaceLogic::hyperwarp() {
 	--sg._items[Data::ITEM_TRI_LITHIUM];
 	static_cast<Views::SpaceMap *>(g_engine->findView("SpaceMap"))->setShip(CENTER_X, CENTER_Y);
 
-	writeString("HYPERWARP TO:\n");
+	writeString("Hyperwarp to:\n");
 	g_engine->addView("HyperwarpTarget");
 }
 
@@ -160,7 +160,7 @@ void SpaceLogic::land() {
 	auto *view = static_cast<Views::SpaceMap *>(g_engine->findView("SpaceMap"));
 
 	view->setShip(CENTER_X, CENTER_Y);
-	writeString("LANDING REQUESTED!\n");
+	writeString("Landing requested!\n");
 	if (!announceOrbit())
 		return;
 
@@ -170,7 +170,7 @@ void SpaceLogic::land() {
 	int era = (world == 0) ? 4 : world;
 	if (world == DEEP_SPACE || !Common::File::exists(Data::mapFilename(era, 0).c_str()) ||
 			!Common::File::exists(Data::monsterFilename(era, 0).c_str())) {
-		writeString("REQUEST DENIED!\n");
+		writeString("Request denied!\n");
 		prompt();
 		return;
 	}
@@ -197,22 +197,22 @@ void SpaceLogic::action(int action) {
 
 	switch (action) {
 	case KEYBIND_LEFT:
-		writeString("LEFT\n");
+		writeString("Left\n");
 		view->setShip(0x20, CENTER_Y);
 		prompt();
 		break;
 	case KEYBIND_RIGHT:
-		writeString("RIGHT\n");
+		writeString("Right\n");
 		view->setShip(0xDF, CENTER_Y);
 		prompt();
 		break;
 	case KEYBIND_UP:
-		writeString("CLIMB\n");
+		writeString("Climb\n");
 		view->setShip(CENTER_X, 0x10);
 		prompt();
 		break;
 	case KEYBIND_DOWN:
-		writeString("DIVE\n");
+		writeString("Dive\n");
 		view->setShip(CENTER_X, 0x6F);
 		prompt();
 		break;
diff --git a/engines/ultima/ultima2/views/commands.cpp b/engines/ultima/ultima2/views/commands.cpp
index cd2ca163b0a..a207bd774f3 100644
--- a/engines/ultima/ultima2/views/commands.cpp
+++ b/engines/ultima/ultima2/views/commands.cpp
@@ -89,7 +89,7 @@ void Commands::showCursor() {
 void Commands::prompt() {
 	resetLine();
 	_surface.setColor(Gfx::textColor(Gfx::TEXT_NORMAL));
-	_surface.writeString("CMD: ");
+	_surface.writeString("Cmd: ");
 	showCursor();
 }
 
diff --git a/engines/ultima/ultima2/views/create_character.cpp b/engines/ultima/ultima2/views/create_character.cpp
index 8666714c811..60f49cd37bd 100644
--- a/engines/ultima/ultima2/views/create_character.cpp
+++ b/engines/ultima/ultima2/views/create_character.cpp
@@ -135,19 +135,19 @@ void CreateCharacter::draw() {
 		s.writeString(Common::Point(x, y), text);
 	};
 
-	put(10, 1, Gfx::TEXT_NORMAL, "PLAYER GENERATION :");
+	put(10, 1, Gfx::TEXT_NORMAL, "Player Generation :");
 
-	put(5, 2, Gfx::TEXT_NORMAL, "POINTS LEFT TO DISTRIBUTE : ");
+	put(5, 2, Gfx::TEXT_NORMAL, "Points left to distribute : ");
 	Gfx::setReverseText(s, true);
 	s.writeString(Common::Point(33, 2), Common::String::format("%d", _pointsRemaining));
 	Gfx::setReverseText(s, false);
 
-	put(11, 4, Gfx::TEXT_NORMAL, "STRENGTH.......");
-	put(11, 5, Gfx::TEXT_NORMAL, "AGILITY........");
-	put(11, 6, Gfx::TEXT_NORMAL, "STAMINA........");
-	put(11, 7, Gfx::TEXT_NORMAL, "CHARISMA.......");
-	put(11, 8, Gfx::TEXT_NORMAL, "WISDOM.........");
-	put(11, 9, Gfx::TEXT_NORMAL, "INTELLIGENCE...");
+	put(11, 4, Gfx::TEXT_NORMAL, "Strength.......");
+	put(11, 5, Gfx::TEXT_NORMAL, "Agility........");
+	put(11, 6, Gfx::TEXT_NORMAL, "Stamina........");
+	put(11, 7, Gfx::TEXT_NORMAL, "Charisma.......");
+	put(11, 8, Gfx::TEXT_NORMAL, "Wisdom.........");
+	put(11, 9, Gfx::TEXT_NORMAL, "Intelligence...");
 
 	if (_state > STRENGTH) put(26, 4, Gfx::TEXT_NUMBER, Common::String::format("%d", sg._strength));
 	if (_state > AGILITY) put(26, 5, Gfx::TEXT_NUMBER, Common::String::format("%d", sg._agility));
@@ -165,12 +165,12 @@ void CreateCharacter::draw() {
 	}
 
 	put(16, 11, Gfx::TEXT_NORMAL, "M/F-");
-	put(15, 12, Gfx::TEXT_NORMAL, "RACE-");
-	put(15, 13, Gfx::TEXT_NORMAL, "TYPE-");
-	put(15, 14, Gfx::TEXT_NORMAL, "NAME-");
+	put(15, 12, Gfx::TEXT_NORMAL, "Race-");
+	put(15, 13, Gfx::TEXT_NORMAL, "Type-");
+	put(15, 14, Gfx::TEXT_NORMAL, "Name-");
 
 	if (_state > SEX)
-		put(20, 11, Gfx::TEXT_HEADING, sg._sex == Data::SEX_MALE ? "MALE" : "FEMALE");
+		put(20, 11, Gfx::TEXT_HEADING, sg._sex == Data::SEX_MALE ? "Male" : "Female");
 	if (_state > RACE)
 		put(20, 12, Gfx::TEXT_HEADING, Data::raceName(sg._race));
 	if (_state > CLASS)
@@ -178,13 +178,13 @@ void CreateCharacter::draw() {
 	if (_state >= NAME)
 		put(20, 14, Gfx::TEXT_LIST, _name);
 
-	put(10, 16, Gfx::TEXT_NORMAL, "SATISFACTORY (Y/N)-");
+	put(10, 16, Gfx::TEXT_NORMAL, "Satisfactory (Y/N)-");
 
 	put(8, 18, Gfx::TEXT_NORMAL, "RACES:         TYPES:");
-	put(9, 19, Gfx::TEXT_NORMAL, "1-HUMAN        1-FIGHTER");
-	put(9, 20, Gfx::TEXT_NORMAL, "2-ELF          2-CLERIC");
-	put(9, 21, Gfx::TEXT_NORMAL, "3-DWARF        3-WIZARD");
-	put(9, 22, Gfx::TEXT_NORMAL, "4-HOBBIT       4-THIEF");
+	put(9, 19, Gfx::TEXT_NORMAL, "1-Human        1-Fighter");
+	put(9, 20, Gfx::TEXT_NORMAL, "2-Elf          2-Cleric");
+	put(9, 21, Gfx::TEXT_NORMAL, "3-Dwarf        3-Wizard");
+	put(9, 22, Gfx::TEXT_NORMAL, "4-Hobbit       4-Thief");
 }
 
 bool CreateCharacter::msgKeypress(const KeypressMessage &msg) {
diff --git a/engines/ultima/ultima2/views/ending.cpp b/engines/ultima/ultima2/views/ending.cpp
index a2c9a9eb193..f16cea92247 100644
--- a/engines/ultima/ultima2/views/ending.cpp
+++ b/engines/ultima/ultima2/views/ending.cpp
@@ -70,8 +70,8 @@ bool Ending::msgFocus(const FocusMessage &msg) {
 	_lastStep = g_system->getMillis();
 
 	g_engine->baseView()->findView("Commands")->send(Graphics::Views::GameMessage("TEXT",
-		"\n\nYOU HAVE SAVED THE UNIVERSE,\nAND COMPLETED ULTIMA ][! SEEK\n"
-		"NOW TO CONQUER WICKED EXODUS,\nFOUND IN ULTIMA ]I[-D ]II[-P!\n"));
+		"\n\nYou have saved the universe,\nand completed Ultima ][! Seek\n"
+		"now to conquer wicked Exodus,\nFound in Ultima ]I[-D ]II[-P!\n"));
 
 	return View::msgFocus(msg);
 }
diff --git a/engines/ultima/ultima2/views/interactions/clue_seller.cpp b/engines/ultima/ultima2/views/interactions/clue_seller.cpp
index a15174249ac..16f5721b546 100644
--- a/engines/ultima/ultima2/views/interactions/clue_seller.cpp
+++ b/engines/ultima/ultima2/views/interactions/clue_seller.cpp
@@ -29,16 +29,16 @@ namespace Views {
 namespace Interactions {
 
 static const char *const CLUES[10] = {
-	"ASK ME NO QUESTIONS,\nI'LL TELL YOU NO LIES.",
-	"THE QUEEN IS THE KING\nAND THE KING IS A SPY.",
-	"THE EVIL MEN DO\nIS A HORRIBLE THING.",
-	"BUT DISPELLING MEANS\nTHAT YOU MUST HAVE THE RING.",
-	"JUST WHERE IT IS,\nI CANNOT SAY.",
-	"BUT I'LL TELL YOU RIGHT NOW,\nTHERE IS NO OTHER WAY.",
-	"I HEAR IN A TOWN\nWHERE THE WATER RUNS FREE.",
-	"THERE IS AN OLD MAN\nLIVING UNDER A TREE.",
-	"HE HAS NOT A NAME\nBUT HE DOES HAVE A CLUE",
-	"MAYHAPS IF YOU FIND HIM,\nHE'LL TELL IT TO YOU!"
+	"Ask me no questions,\nI'll tell you no lies.",
+	"The Queen is the King\nand the King is a spy.",
+	"The evil men do\nis a horrible thing.",
+	"But dispelling means\nthat you must have the Ring.",
+	"Just where it is,\nI cannot say.",
+	"But I'll tell you right now,\nthere is no other way.",
+	"I hear in a town\nwhere the water runs free.",
+	"There is an old man\nliving under a tree.",
+	"He has not a name\nbut he does have a clue",
+	"Mayhaps if you find him,\nhe'll tell it to you!"
 };
 
 ClueSeller::ClueSeller() : Interaction("ClueSeller") {
@@ -46,7 +46,7 @@ ClueSeller::ClueSeller() : Interaction("ClueSeller") {
 
 bool ClueSeller::msgFocus(const FocusMessage &msg) {
 	MetaEngine::setKeybindingMode(KBMODE_MINIMAL);
-	writeString("TIME AND TRAVEL MADE ME WISE,\nPRECIOUS GOLD, A CLUE IT BUYS!HOW MUCH WILL YOU PAY *100? ");
+	writeString("Time and travel made me wise,\nPrecious gold, a clue it buys!How much will you pay *100? ");
 
 	return Interaction::msgFocus(msg);
 }
diff --git a/engines/ultima/ultima2/views/interactions/direction.cpp b/engines/ultima/ultima2/views/interactions/direction.cpp
index 717cf6fe445..169b2b2255f 100644
--- a/engines/ultima/ultima2/views/interactions/direction.cpp
+++ b/engines/ultima/ultima2/views/interactions/direction.cpp
@@ -42,7 +42,7 @@ bool Direction::msgFocus(const FocusMessage &msg) {
 bool Direction::tick() {
 	// If no direction is given in time, the command is abandoned and a turn passes
 	if (g_system->getMillis() - _startTime >= TIMEOUT) {
-		writeString("PASS\n");
+		writeString("Pass\n");
 		close();
 		_G(logic)->resumeTurn();
 		return true;
@@ -54,10 +54,10 @@ bool Direction::tick() {
 bool Direction::msgKeypress(const KeypressMessage &msg) {
 	Data::Direction dir;
 	switch (msg.keycode) {
-	case Common::KEYCODE_UP: dir = Data::DIR_UP; writeString("NORTH"); break;
-	case Common::KEYCODE_DOWN: dir = Data::DIR_DOWN; writeString("SOUTH"); break;
-	case Common::KEYCODE_LEFT: dir = Data::DIR_LEFT; writeString("WEST"); break;
-	case Common::KEYCODE_RIGHT: dir = Data::DIR_RIGHT; writeString("EAST"); break;
+	case Common::KEYCODE_UP: dir = Data::DIR_UP; writeString("North"); break;
+	case Common::KEYCODE_DOWN: dir = Data::DIR_DOWN; writeString("South"); break;
+	case Common::KEYCODE_LEFT: dir = Data::DIR_LEFT; writeString("West"); break;
+	case Common::KEYCODE_RIGHT: dir = Data::DIR_RIGHT; writeString("East"); break;
 	default:
 		return true;
 	}
diff --git a/engines/ultima/ultima2/views/interactions/food_shop.cpp b/engines/ultima/ultima2/views/interactions/food_shop.cpp
index 14a8e269c99..d480cb1ed80 100644
--- a/engines/ultima/ultima2/views/interactions/food_shop.cpp
+++ b/engines/ultima/ultima2/views/interactions/food_shop.cpp
@@ -37,7 +37,7 @@ FoodShop::FoodShop() : Interaction("FoodShop") {
 bool FoodShop::msgFocus(const FocusMessage &msg) {
 	MetaEngine::setKeybindingMode(KBMODE_MINIMAL);
 	_price = _G(savegame).computeItemPrice(FOOD_PRICE_INDEX);
-	writeString("THE FOOD HERE COSTS %.4d\nPER 100, WANT ONE? ", _price);
+	writeString("The food here costs %.4d\nper 100, Want one? ", _price);
 
 	return Interaction::msgFocus(msg);
 }
@@ -47,11 +47,11 @@ bool FoodShop::msgKeypress(const KeypressMessage &msg) {
 	if (toupper(msg.ascii) != 'Y') {
 		writeString("NO\n");
 	} else {
-		writeString("YES,\nNO ONIONS AND TO GO PLEASE!\n");
+		writeString("YES,\nNo onions and to go please!\n");
 		if (_G(logic)->trySpendGold(_price)) {
 			Data::Savegame &sg = _G(savegame);
 			sg._food = MIN(sg._food + 100, MAX_FOOD);
-			writeString("THANK YOU, COME AGAIN!\n");
+			writeString("Thank you, come again!\n");
 		}
 	}
 
diff --git a/engines/ultima/ultima2/views/interactions/hyperwarp_target.cpp b/engines/ultima/ultima2/views/interactions/hyperwarp_target.cpp
index 9235a9d2646..82ed152bf06 100644
--- a/engines/ultima/ultima2/views/interactions/hyperwarp_target.cpp
+++ b/engines/ultima/ultima2/views/interactions/hyperwarp_target.cpp
@@ -29,7 +29,7 @@ namespace Ultima2 {
 namespace Views {
 namespace Interactions {
 
-static const char *const PROMPTS[3] = { "XENO=", " YAKO=", " ZABO=" };
+static const char *const PROMPTS[3] = { "Xeno=", " Yako=", " Zabo=" };
 
 HyperwarpTarget::HyperwarpTarget() : Interaction("HyperwarpTarget") {
 }
@@ -54,7 +54,7 @@ bool HyperwarpTarget::msgKeypress(const KeypressMessage &msg) {
 	}
 
 	close();
-	writeString("\nPREPARE FOR HYPERWARP!\n");
+	writeString("\nPrepare for Hyperwarp!\n");
 
 	auto *logic = dynamic_cast<Logic::SpaceLogic *>(_G(logic).get());
 	if (logic)
diff --git a/engines/ultima/ultima2/views/interactions/plane_flight.cpp b/engines/ultima/ultima2/views/interactions/plane_flight.cpp
index d23e0437f81..f2a9082b311 100644
--- a/engines/ultima/ultima2/views/interactions/plane_flight.cpp
+++ b/engines/ultima/ultima2/views/interactions/plane_flight.cpp
@@ -56,21 +56,21 @@ void PlaneFlight::land() {
 	Data::Savegame &sg = _G(savegame);
 
 	if (_G(map).tileAt(sg._mapX, sg._mapY) == Data::TILE_GRASS) {
-		writeString("LAND PLANE.\n");
+		writeString("Land plane.\n");
 		close();
 		_G(logic)->resumeTurn();
 	} else {
-		writeString("LAND--NOT HERE!!!!!\n");
+		writeString("Land--Not here!!!!!\n");
 		prompt();
 	}
 }
 
 bool PlaneFlight::msgKeypress(const KeypressMessage &msg) {
 	switch (msg.keycode) {
-	case Common::KEYCODE_UP: setHeading(0, -1, "NORTH"); break;
-	case Common::KEYCODE_DOWN: setHeading(0, 1, "SOUTH"); break;
-	case Common::KEYCODE_LEFT: setHeading(-1, 0, "WEST"); break;
-	case Common::KEYCODE_RIGHT: setHeading(1, 0, "EAST"); break;
+	case Common::KEYCODE_UP: setHeading(0, -1, "North"); break;
+	case Common::KEYCODE_DOWN: setHeading(0, 1, "South"); break;
+	case Common::KEYCODE_LEFT: setHeading(-1, 0, "West"); break;
+	case Common::KEYCODE_RIGHT: setHeading(1, 0, "East"); break;
 	default:
 		if (toupper(msg.ascii) == 'L')
 			land();
diff --git a/engines/ultima/ultima2/views/interactions/pub.cpp b/engines/ultima/ultima2/views/interactions/pub.cpp
index 8bcc45b7fc7..8af034c2fed 100644
--- a/engines/ultima/ultima2/views/interactions/pub.cpp
+++ b/engines/ultima/ultima2/views/interactions/pub.cpp
@@ -29,16 +29,16 @@ namespace Views {
 namespace Interactions {
 
 static const char *const HINTS[10] = {
-	"CAUGH...",
-	"ISN'T THIS A GREAT GAME?",
-	"HHMMM...",
-	"SOME FIGHTERS WEAR MAGIC HELMS!",
-	"AVIATORS USE SKULL KEYS!",
-	"SAYLORS WEAR BLUE TASSLES!",
-	"MAGES CARRY WANDS OR STAFFS!",
-	"GUARDS CARRY KEYS!",
-	"ANKHS OPEN SPACE!",
-	"PLANES NEED BRASS BUTTONS!"
+	"Caugh...",
+	"Isn't this a great game?",
+	"Hhmmm...",
+	"Some fighters wear Magic Helms!",
+	"Aviators use Skull Keys!",
+	"Saylors wear Blue tassles!",
+	"Mages carry Wands or Staffs!",
+	"Guards carry Keys!",
+	"Ankhs open space!",
+	"Planes need Brass Buttons!"
 };
 
 constexpr int DRINK_PRICE = 5;
@@ -49,13 +49,13 @@ Pub::Pub() : Interaction("Pub") {
 bool Pub::msgFocus(const FocusMessage &msg) {
 	MetaEngine::setKeybindingMode(KBMODE_MINIMAL);
 	_state = MENU;
-	writeString("WELCOME TO THE PUB!\n1-BUY, 2-TIP --- ");
+	writeString("Welcome to the Pub!\n1-Buy, 2-Tip --- ");
 
 	return Interaction::msgFocus(msg);
 }
 
 void Pub::barkeepSays(int hint) {
-	writeString("THE BARKEEP SAYS:\n%s\n", HINTS[hint]);
+	writeString("The barkeep says:\n%s\n", HINTS[hint]);
 }
 
 bool Pub::msgKeypress(const KeypressMessage &msg) {
@@ -72,14 +72,14 @@ bool Pub::msgKeypress(const KeypressMessage &msg) {
 
 	if (_state == MENU) {
 		if (digit == 2) {
-			writeString("TIP HOW MUCH? ");
+			writeString("Tip how much? ");
 			_state = TIP;
 			return true;
 		}
 
 		close();
 		if (digit == 1 && _G(logic)->trySpendGold(DRINK_PRICE)) {
-			writeString("HERE, HAVE A STRONG ONE!\n");
+			writeString("Here, Have a strong one!\n");
 			g_engine->randByte();
 			barkeepSays(1);
 		}
diff --git a/engines/ultima/ultima2/views/interactions/ready_spell.cpp b/engines/ultima/ultima2/views/interactions/ready_spell.cpp
index 828aebe4eee..5b0679f66cc 100644
--- a/engines/ultima/ultima2/views/interactions/ready_spell.cpp
+++ b/engines/ultima/ultima2/views/interactions/ready_spell.cpp
@@ -31,7 +31,7 @@ ReadySpell::ReadySpell() : Interaction("ReadySpell") {
 }
 
 bool ReadySpell::msgFocus(const FocusMessage &msg) {
-	writeString("MAGIC SPELL READY #");
+	writeString("Magic spell ready #");
 	return Interaction::msgFocus(msg);
 }
 
@@ -41,7 +41,7 @@ bool ReadySpell::msgKeypress(const KeypressMessage &msg) {
 
 	int digit = msg.ascii - '0';
 	_G(savegame)._readiedSpell = (Data::SpellType)digit;
-	writeString("%d\nSPELL READY => %s\n", digit, Data::SPELL_NAMES[digit]);
+	writeString("%d\nSpell ready => %s\n", digit, Data::SPELL_NAMES[digit]);
 
 	close();
 	_G(logic)->resumeTurn();
diff --git a/engines/ultima/ultima2/views/interactions/ready_weapon.cpp b/engines/ultima/ultima2/views/interactions/ready_weapon.cpp
index f17119b6bcb..ffb2c8230b1 100644
--- a/engines/ultima/ultima2/views/interactions/ready_weapon.cpp
+++ b/engines/ultima/ultima2/views/interactions/ready_weapon.cpp
@@ -31,7 +31,7 @@ ReadyWeapon::ReadyWeapon() : Interaction("ReadyWeapon") {
 }
 
 bool ReadyWeapon::msgFocus(const FocusMessage &msg) {
-	writeString("READY WEAPON:\n1-DA, 2-MA, 3-AX, 4-BO,\n5-SW, 6-GR, 7-LI, 8-PH.\n9-QU, WHICH? ");
+	writeString("Ready weapon:\n1-Da, 2-Ma, 3-Ax, 4-Bo,\n5-Sw, 6-Gr, 7-Li, 8-Ph.\n9-Qu, Which? ");
 	return Interaction::msgFocus(msg);
 }
 
@@ -43,14 +43,14 @@ bool ReadyWeapon::msgKeypress(const KeypressMessage &msg) {
 	Data::Savegame &sg = _G(savegame);
 
 	if (digit != Data::WEAPON_HANDS && sg._weaponOwned[digit] == 0) {
-		writeString("%d\n%s NOT OWNED!\n", digit, Data::WEAPON_NAMES[digit]);
+		writeString("%d\n%s not owned!\n", digit, Data::WEAPON_NAMES[digit]);
 	} else if (digit * 8 >= Data::toBcd(sg._agility)) {
 		// The original compares against the raw packed-BCD agility byte,
 		// not its decimal value - see WearArmor's equivalent check
-		writeString("%d\n<-THOU ART NOT AGILE ENOUGH TO WIELD!\n", digit);
+		writeString("%d\n<-Thou art not \nagile enough to wield!\n", digit);
 	} else {
 		sg._readiedWeapon = (Data::WeaponType)digit;
-		writeString("%d\n%s READY.\n", digit, Data::WEAPON_NAMES[digit]);
+		writeString("%d\n%s Ready.\n", digit, Data::WEAPON_NAMES[digit]);
 	}
 
 	close();
diff --git a/engines/ultima/ultima2/views/interactions/rocket_landing.cpp b/engines/ultima/ultima2/views/interactions/rocket_landing.cpp
index ff32529d5a9..b5a80f6ff4d 100644
--- a/engines/ultima/ultima2/views/interactions/rocket_landing.cpp
+++ b/engines/ultima/ultima2/views/interactions/rocket_landing.cpp
@@ -37,7 +37,7 @@ bool RocketLanding::msgFocus(const FocusMessage &msg) {
 	MetaEngine::setKeybindingMode(KBMODE_MINIMAL);
 	_lastStep = g_system->getMillis();
 
-	writeString("(PRESS ANY KEY)");
+	writeString("(Press Any Key)");
 	return Interaction::msgFocus(msg);
 }
 
diff --git a/engines/ultima/ultima2/views/interactions/shop.cpp b/engines/ultima/ultima2/views/interactions/shop.cpp
index faf434bc22b..a1440106dd1 100644
--- a/engines/ultima/ultima2/views/interactions/shop.cpp
+++ b/engines/ultima/ultima2/views/interactions/shop.cpp
@@ -47,17 +47,17 @@ bool Shop::msgFocus(const FocusMessage &msg) {
 
 	switch (_kind) {
 	case WEAPON:
-		writeString("  THE WEAPONS SHOPPE:\n1-DA, 2-MA, 3-AX, 4-BO,\n5-SW, 6-GR, 7-LI, 8-PH.\nYOUR INTEREST? ");
+		writeString("  The Weapons Shoppe:\n1-Da, 2-Ma, 3-Ax, 4-Bo,\n5-Sw, 6-Gr, 7-Li, 8-Ph.\nYour interest? ");
 		break;
 	case ARMOR:
-		writeString("     THE ARMOUR SHOPPE:\n1-CLOTH, 2-LEATHER, 3-CHAIN,\n4-PLATE, 5-REFLECT, 6-POWER,\nYOUR INTEREST? ");
+		writeString("     The Armour Shoppe:\n1-Cloth, 2-Leather, 3-Chain,\n4-Plate, 5-Reflect, 6-Power,\nYour interest? ");
 		break;
 	case SPELL_CLERIC:
-		writeString("WELCOME %s%s\n1-LIGHT, 2-L.D., 3-L.U.,\n4-PASS 5-SURFACE, 6-PRAYER.\nYOUR INTEREST? ",
-			sg._sex == Data::SEX_FEMALE ? "SISTER " : "BROTHER ", sg._name);
+		writeString("Welcome %s%s\n1-Light, 2-L.D., 3-L.U.,\n4-Pass 5-Surface, 6-Prayer.\nYour interest? ",
+			sg._sex == Data::SEX_FEMALE ? "Sister " : "Brother ", sg._name);
 		break;
 	case SPELL_WIZARD:
-		writeString("%s MUSERREF OLDUM!\n1-LIGHT, 2-L.D., 3-L.U.,\n4-M.M., 5-BLINK, 6-KILL,\nBIR IKI UC...? ", sg._name);
+		writeString("%s Muserref Oldum!\n1-Light, 2-L.D., 3-L.U.,\n4-M.M., 5-Blink, 6-Kill,\nBir iki uc...? ", sg._name);
 		break;
 	}
 
@@ -78,13 +78,13 @@ void Shop::chooseItem(int digit) {
 		switch (_kind) {
 		case WEAPON:
 		case ARMOR:
-			finish("THANKS FOR COMING BY...");
+			finish("Thanks for coming by...");
 			break;
 		case SPELL_CLERIC:
-			finish("FOLLOW THE LIGHT, FRIEND!");
+			finish("Follow the Light, friend!");
 			break;
 		case SPELL_WIZARD:
-			finish("\nUGURLA OLSUN!");
+			finish("\nUgurla olsun!");
 			break;
 		}
 		return;
@@ -95,19 +95,19 @@ void Shop::chooseItem(int digit) {
 	case WEAPON:
 		_item = digit;
 		_price = sg.computeItemPrice(_item);
-		writeString("AH! YES! A %s\nFOR YOU ONLY %.4d\nHOW 'BOUT IT? ", Data::WEAPON_NAMES[_item], _price);
+		writeString("Ah! Yes! A %s\nFor you only %.4d\nHow 'bout it? ", Data::WEAPON_NAMES[_item], _price);
 		break;
 	case ARMOR:
 		_item = digit;
 		_price = sg.computeItemPrice(_item * 2);
-		writeString("AH! YES! %s\nFOR YOU ONLY %.4d\nHOW 'BOUT IT? ", Data::ARMOR_NAMES[_item], _price);
+		writeString("Ah! Yes! %s\nFor you only %.4d\nHow 'bout it? ", Data::ARMOR_NAMES[_item], _price);
 		break;
 	case SPELL_CLERIC:
 	case SPELL_WIZARD:
 		_item = (_kind == SPELL_WIZARD && digit >= 4) ? digit + 3 : digit;
 		_price = sg.computeItemPrice(_item);
-		writeString("FIVE %sS FOR %.4d\n%s ", Data::SPELL_NAMES[_item], _price,
-			_kind == SPELL_CLERIC ? "YES, FRIEND?" : "LUTFEN EVET?");
+		writeString("Five %ss for %.4d\n%s ", Data::SPELL_NAMES[_item], _price,
+			_kind == SPELL_CLERIC ? "Yes, friend?" : "Lutfen evet?");
 		break;
 	}
 
@@ -126,7 +126,7 @@ void Shop::confirm(char key) {
 			writeString("%c", key);
 		writeString("\n");
 		if (!yes) {
-			writeString("OH, WELL.\n");
+			writeString("Oh, well.\n");
 		} else if (_G(logic)->trySpendGold(_price)) {
 			if (_kind == WEAPON)
 				sg._weaponOwned[_item] = MIN(sg._weaponOwned[_item] + 1, Data::MAX_BCD_BYTE);
@@ -138,9 +138,9 @@ void Shop::confirm(char key) {
 
 	case SPELL_CLERIC:
 		if (!yes) {
-			writeString("NO\nI'M SORRY, GOOD DAY.\n");
+			writeString("No\nI'm sorry, good day.\n");
 		} else {
-			writeString("YES,\nI WILL TAKE 5!");
+			writeString("Yes,\nI will take 5!");
 			if (_G(logic)->trySpendGold(_price)) {
 				sg._spellCharges[_item] = MIN(sg._spellCharges[_item] + 5, Data::MAX_BCD_BYTE);
 				writeString("\n");
@@ -155,7 +155,7 @@ void Shop::confirm(char key) {
 			writeString("YES\n");
 			if (_G(logic)->trySpendGold(_price)) {
 				sg._spellCharges[_item] = MIN(sg._spellCharges[_item] + 5, Data::MAX_BCD_BYTE);
-				writeString("GULE GULE!\n");
+				writeString("Gule gule!\n");
 			}
 		}
 		break;
diff --git a/engines/ultima/ultima2/views/interactions/transport.cpp b/engines/ultima/ultima2/views/interactions/transport.cpp
index d7d84c9108f..c75a023ae7d 100644
--- a/engines/ultima/ultima2/views/interactions/transport.cpp
+++ b/engines/ultima/ultima2/views/interactions/transport.cpp
@@ -36,7 +36,7 @@ Transport::Transport() : Interaction("Transport") {
 bool Transport::msgFocus(const FocusMessage &msg) {
 	MetaEngine::setKeybindingMode(KBMODE_MINIMAL);
 	_price = _G(savegame).computeItemPrice(HORSE_PRICE_INDEX);
-	writeString("WELCOME, TO THE TRANSPORT\nSHOPPE. I SELL YOU HORSE %.4d\nGOLD, DEAL, OK? --- ", _price);
+	writeString("Welcome, to the Transport\nShoppe. I sell you horse %.4d\ngold, deal, ok? --- ", _price);
 
 	return Interaction::msgFocus(msg);
 }
@@ -49,9 +49,9 @@ bool Transport::msgKeypress(const KeypressMessage &msg) {
 	close();
 
 	if (key != 'Y') {
-		writeString("\nO.K. BYE THEN...\n");
+		writeString("\nO.K. bye then...\n");
 	} else if (_G(logic)->trySpendGold(_price)) {
-		writeString("\nRIDE SWIFTLY!\n");
+		writeString("\nRide swiftly!\n");
 		_G(savegame)._mount = Data::TILE_HORSE;
 	}
 
diff --git a/engines/ultima/ultima2/views/interactions/wear_armor.cpp b/engines/ultima/ultima2/views/interactions/wear_armor.cpp
index de12aabc2ef..43be72b1c20 100644
--- a/engines/ultima/ultima2/views/interactions/wear_armor.cpp
+++ b/engines/ultima/ultima2/views/interactions/wear_armor.cpp
@@ -31,7 +31,7 @@ WearArmor::WearArmor() : Interaction("WearArmor") {
 }
 
 bool WearArmor::msgFocus(const FocusMessage &msg) {
-	writeString("WEAR ARMOUR:\n1-CLOTH, 2-LEATHER, 3-CHAIN,\n4-PLATE, 5-REFLECT, 6-POWER,\nWHICH? ");
+	writeString("Wear armour:\n1-Cloth, 2-Leather, 3-Chain,\n4-Plate, 5-Reflect, 6-Power,\nWhich? ");
 	return Interaction::msgFocus(msg);
 }
 
@@ -44,17 +44,17 @@ bool WearArmor::msgKeypress(const KeypressMessage &msg) {
 	Data::Savegame &sg = _G(savegame);
 
 	if (armorIdx >= Data::ARMOR_COUNT) {
-		writeString("%d\nNOT OWNED!\n", digit);
+		writeString("%d\nNot owned!\n", digit);
 	} else if (armorIdx != Data::ARMOR_SKIN && sg._armorOwned[armorIdx] == 0) {
-		writeString("%d\n%s NOT OWNED!\n", digit, Data::ARMOR_NAMES[armorIdx]);
+		writeString("%d\n%s Not owned!\n", digit, Data::ARMOR_NAMES[armorIdx]);
 	} else if (armorIdx * 8 >= Data::toBcd(sg._strength)) {
 		// The original compares against the raw packed-BCD strength byte,
 		// not its decimal value, so e.g. leather (index 2) needs strength
 		// 11+ (2*8=16 < BCD 0x11=17), not 17+
-		writeString("%d\n<-THOU ART NOT\nSTRONG ENOUGH TO WEAR!\n", digit);
+		writeString("%d\n<-Thou art not\nstrong enough to wear!\n", digit);
 	} else {
 		sg._readiedArmor = (Data::ArmorType)armorIdx;
-		writeString("%d\n%s READY.\n", digit, Data::ARMOR_NAMES[armorIdx]);
+		writeString("%d\n%s Ready.\n", digit, Data::ARMOR_NAMES[armorIdx]);
 	}
 
 	close();
diff --git a/engines/ultima/ultima2/views/interactions/yell.cpp b/engines/ultima/ultima2/views/interactions/yell.cpp
index e2a0f3f6c42..801b900a4b9 100644
--- a/engines/ultima/ultima2/views/interactions/yell.cpp
+++ b/engines/ultima/ultima2/views/interactions/yell.cpp
@@ -33,7 +33,7 @@ Yell::Yell() : Interaction("Yell") {
 }
 
 bool Yell::msgFocus(const FocusMessage &msg) {
-	writeString("YELL WHAT?\n");
+	writeString("Yell what?\n");
 	MetaEngine::setKeybindingMode(KBMODE_MINIMAL);
 	return Interaction::msgFocus(msg);
 }
diff --git a/engines/ultima/ultima2/views/space_map.cpp b/engines/ultima/ultima2/views/space_map.cpp
index 68ea79a3a23..ec6acfc0191 100644
--- a/engines/ultima/ultima2/views/space_map.cpp
+++ b/engines/ultima/ultima2/views/space_map.cpp
@@ -202,7 +202,7 @@ void SpaceMap::animate() {
 }
 
 void SpaceMap::startWarp() {
-	g_engine->baseView()->findView("Commands")->send(GameMessage("TEXT", "HYPERWARP ENGAGED!\n"));
+	g_engine->baseView()->findView("Commands")->send(GameMessage("TEXT", "Hyperwarp engaged!\n"));
 
 	_speed = 0;
 	_counter = 0x80;
diff --git a/engines/ultima/ultima2/views/space_stats.cpp b/engines/ultima/ultima2/views/space_stats.cpp
index 22323839678..b2824e14b4f 100644
--- a/engines/ultima/ultima2/views/space_stats.cpp
+++ b/engines/ultima/ultima2/views/space_stats.cpp
@@ -38,10 +38,10 @@ void SpaceStats::draw() {
 
 	Data::Savegame &sg = _G(savegame);
 	s.setColor(Gfx::textColor(Gfx::TEXT_NORMAL));
-	s.writeString(Common::Point(0, 0), "  FUEL=%.2d", sg._items[Data::ITEM_TRI_LITHIUM] % 100);
-	s.writeString(Common::Point(0, 1), "  XENO=%.2d", sg._hyperwarpCoords[0]);
-	s.writeString(Common::Point(0, 2), "  YAKO=%.2d", sg._hyperwarpCoords[1]);
-	s.writeString(Common::Point(0, 3), "  ZABO=%.2d", sg._hyperwarpCoords[2]);
+	s.writeString(Common::Point(0, 0), "  Fuel=%.2d", sg._items[Data::ITEM_TRI_LITHIUM] % 100);
+	s.writeString(Common::Point(0, 1), "  Xeno=%.2d", sg._hyperwarpCoords[0]);
+	s.writeString(Common::Point(0, 2), "  Yako=%.2d", sg._hyperwarpCoords[1]);
+	s.writeString(Common::Point(0, 3), "  Zabo=%.2d", sg._hyperwarpCoords[2]);
 }
 
 } // namespace Views
diff --git a/engines/ultima/ultima2/views/stats.cpp b/engines/ultima/ultima2/views/stats.cpp
index 02752553607..0bf630a340f 100644
--- a/engines/ultima/ultima2/views/stats.cpp
+++ b/engines/ultima/ultima2/views/stats.cpp
@@ -47,15 +47,15 @@ void Stats::draw() {
 	s.writeString(Common::Point(5, 0), "%4d", sg._hp);
 
 	s.setColor(normal);
-	s.writeString(Common::Point(0, 1), "FOOD=");
+	s.writeString(Common::Point(0, 1), "Food=");
 	s.setColor(sg._food == 0 ? highlight : normal);
 	s.writeString(Common::Point(5, 1), "%4d", sg._food);
 
 	s.setColor(normal);
-	s.writeString(Common::Point(0, 2), "EXP.=");
+	s.writeString(Common::Point(0, 2), "Exp.=");
 	s.writeString(Common::Point(5, 2), "%4d", sg._experience);
 
-	s.writeString(Common::Point(0, 3), "GOLD=");
+	s.writeString(Common::Point(0, 3), "Gold=");
 	s.writeString(Common::Point(5, 3), "%4d", sg._gold);
 }
 
diff --git a/engines/ultima/ultima2/views/title.cpp b/engines/ultima/ultima2/views/title.cpp
index ea489d23200..5fcac53a4a2 100644
--- a/engines/ultima/ultima2/views/title.cpp
+++ b/engines/ultima/ultima2/views/title.cpp
@@ -133,15 +133,15 @@ void Title::draw() {
 
 	switch (_state) {
 	case TEXT1:
-		s.writeString(Common::Point(16, 10), "ORIGIN");
-		s.writeString(Common::Point(11, 12), "PROUDLY PRESENTS");
+		s.writeString(Common::Point(16, 10), "Origin");
+		s.writeString(Common::Point(11, 12), "proudly presents");
 		break;
 
 	case TEXT2:
-		s.writeString(Common::Point(16, 8), "PART ][");
-		s.writeString(Common::Point(9, 10), "OF THE #1 BEST SELLING");
-		s.writeString(Common::Point(7, 12), "FANTASY ROLE-PLAYING GAME");
-		s.writeString(Common::Point(12, 14), "BY LORD BRITISH");
+		s.writeString(Common::Point(16, 8), "Part ][");
+		s.writeString(Common::Point(9, 10), "of the #1 best selling");
+		s.writeString(Common::Point(7, 12), "fantasy role-playing game");
+		s.writeString(Common::Point(12, 14), "by Lord British");
 		break;
 
 	case PICDRA:
@@ -149,52 +149,52 @@ void Title::draw() {
 		break;
 
 	case DEMO_OUT:
-		s.writeString(Common::Point(0, 23), "        BATTLE STRANGE CREATURES");
-		s.writeString(Common::Point(0, 24), "      ACROSS THE FACE OF THE EARTH");
+		s.writeString(Common::Point(0, 23), "        Battle Strange Creatures");
+		s.writeString(Common::Point(0, 24), "      Across the Face of the Earth");
 		break;
 
 	case DEMO_TWN:
-		s.writeString(Common::Point(0, 23), "   SEARCH FOR CLUES IN CARELESS WORDS");
-		s.writeString(Common::Point(2, 24), "      SPOKEN AT THE LOCAL PUB");
+		s.writeString(Common::Point(0, 23), "   Search for Clues in Careless Words");
+		s.writeString(Common::Point(2, 24), "      Spoken at the Local Pub");
 		break;
 
 	case DEMO_CAS:
-		s.writeString(Common::Point(0, 23), "        PLEAD WITH MEDIEVAL KINGS");
-		s.writeString(Common::Point(4, 24), "         FOR ASSISTANCE");
+		s.writeString(Common::Point(0, 23), "        Plead with Medieval Kings");
+		s.writeString(Common::Point(4, 24), "         for Assistance");
 		break;
 
 	case DEMO_DNG:
-		s.writeString(Common::Point(0, 23), "   TRAVERSE DEEP DARK DEADLY DUNGEONS");
-		s.writeString(Common::Point(1, 24), "      AND TALL TERRIFYING TOWERS");
+		s.writeString(Common::Point(0, 23), "   Traverse Deep Dark Deadly Dungeons");
+		s.writeString(Common::Point(1, 24), "      and Tall Terrifying Towers");
 		break;
 
 	case DEMO_SPA:
-		s.writeString(Common::Point(0, 23), "      TRAVEL THROUGHOUT THE GALAXY");
-		s.writeString(Common::Point(1, 24), "  TO THE PLANETS OF OUR SOLAR SYSTEM");
+		s.writeString(Common::Point(0, 23), "      Travel Throughout the Galaxy");
+		s.writeString(Common::Point(1, 24), "  to the Planets of Our Solar System");
 		break;
 
 	case DEMO_MIN:
-		s.writeString(Common::Point(0, 23), "   AND CONQUER TIME ITSELF TO BATTLE");
-		s.writeString(Common::Point(8, 24), "MINAX THE ENCHANTRESS");
+		s.writeString(Common::Point(0, 23), "   And Conquer Time Itself to Battle");
+		s.writeString(Common::Point(8, 24), "Minax the Enchantress");
 		break;
 
 	case MENU:
 		s.setColor(Gfx::textColor(Gfx::TEXT_TITLE));
-		s.writeString(Common::Point(15, 1), "ULTIMA ][");
+		s.writeString(Common::Point(15, 1), "Ultima ][");
 		s.setColor(Gfx::textColor(Gfx::TEXT_NAME));
-		s.writeString(Common::Point(16, 3), "REVENGE");
-		s.writeString(Common::Point(16, 5), "OF  THE");
-		s.writeString(Common::Point(14, 7), "ENCHANTRESS");
-		s.writeString(Common::Point(6, 22), "(C)-1983,1989 BY LORD BRITISH");
-		s.writeString(Common::Point(15, 23), "AND ORIGIN");
+		s.writeString(Common::Point(16, 3), "Revenge");
+		s.writeString(Common::Point(16, 5), "of  the");
+		s.writeString(Common::Point(14, 7), "Enchantress");
+		s.writeString(Common::Point(6, 22), "(C)-1983,1989 by Lord British");
+		s.writeString(Common::Point(15, 23), "and Origin");
 		s.setColor(Gfx::textColor(Gfx::TEXT_NORMAL));
-		s.writeString(Common::Point(5, 10), "TYPE -");
-		s.writeString(Common::Point(6, 11), "'D' - FOR A DEMONSTRATION");
-		s.writeString(Common::Point(6, 13), "'P' - PLAY A GAME OF ULTIMA ][");
-		s.writeString(Common::Point(6, 15), "'C' - CREATE A NEW CHARACTER");
-		s.writeString(Common::Point(6, 17), Common::String::format("'G' - GRAPHICS: %s",
+		s.writeString(Common::Point(5, 10), "Type -");
+		s.writeString(Common::Point(6, 11), "'D' - For a Demonstration");
+		s.writeString(Common::Point(6, 13), "'P' - Play a game of Ultima ][");
+		s.writeString(Common::Point(6, 15), "'C' - Create a new character");
+		s.writeString(Common::Point(6, 17), Common::String::format("'G' - Graphics: %s",
 			Data::RENDER_MODE_NAMES[g_engine->getRenderMode()]));
-		s.writeString(Common::Point(5, 19), "CHOICE:");
+		s.writeString(Common::Point(5, 19), "Choice:");
 		break;
 	}
 }
diff --git a/engines/ultima/ultima2/views/zstats.cpp b/engines/ultima/ultima2/views/zstats.cpp
index 6ffa60f0b13..915a588da07 100644
--- a/engines/ultima/ultima2/views/zstats.cpp
+++ b/engines/ultima/ultima2/views/zstats.cpp
@@ -69,8 +69,8 @@ void ZStats::draw() {
 	};
 
 	putAt(0, 0, Gfx::TEXT_NAME, sg._name);
-	putAt(0, 1, Gfx::TEXT_NAME, Common::String::format("A LEVEL %.2d %s %s %s", sg._experience,
-		sg._sex == Data::SEX_MALE ? "MALE" : "FEMALE",
+	putAt(0, 1, Gfx::TEXT_NAME, Common::String::format("A Level %.2d %s %s %s", sg._experience,
+		sg._sex == Data::SEX_MALE ? "Male" : "Female",
 		Data::raceName(sg._race),
 		Data::className(sg._class)));
 
@@ -81,9 +81,9 @@ void ZStats::draw() {
 	putAt(2, 6, Gfx::TEXT_NORMAL, " SPELL-");
 	put(Gfx::TEXT_LIST, Data::spellName(sg._readiedSpell));
 
-	labelled(-1, 4, "TORCHES-", sg._torches);
-	labelled(-1, 5, "KEYS-", sg._keys);
-	labelled(-1, 6, "TOOLS-", sg._thievesTools);
+	labelled(-1, 4, "Torches-", sg._torches);
+	labelled(-1, 5, "Keys-", sg._keys);
+	labelled(-1, 6, "Tools-", sg._thievesTools);
 
 	labelled(0, 7, "STRENGTH-", sg._strength);
 	labelled(14, 7, " STAMINA-", sg._stamina);
@@ -93,17 +93,17 @@ void ZStats::draw() {
 	labelled(-1, 8, "INTELL.-", sg._intelligence);
 
 	int row = 10;
-	putAt(0, row, Gfx::TEXT_HEADING, "WEAPONS: ");
+	putAt(0, row, Gfx::TEXT_HEADING, "Weapons: ");
 	for (int i = 0; i < Data::WEAPON_COUNT; ++i) {
 		if (sg._weaponOwned[i] != 0) {
-			put(Gfx::TEXT_NORMAL, Common::String::format("%sS-", Data::weaponName((Data::WeaponType)i)));
+			put(Gfx::TEXT_NORMAL, Common::String::format("%ss-", Data::weaponName((Data::WeaponType)i)));
 			put(Gfx::TEXT_NUMBER, number(sg._weaponOwned[i]));
 			put(Gfx::TEXT_NORMAL, " ");
 		}
 	}
 	row += 3; // two blank rows below WEAPONS
 
-	putAt(0, row, Gfx::TEXT_HEADING, "ARMOUR: ");
+	putAt(0, row, Gfx::TEXT_HEADING, "Armour: ");
 	for (int i = 0; i < Data::ARMOR_COUNT; ++i) {
 		if (sg._armorOwned[i] != 0) {
 			put(Gfx::TEXT_NORMAL, Common::String::format("%s-", Data::armorName((Data::ArmorType)i)));
@@ -113,21 +113,21 @@ void ZStats::draw() {
 	}
 	row += 2; // one blank row below ARMOUR
 
-	putAt(0, row, Gfx::TEXT_HEADING, "SPELLS: ");
+	putAt(0, row, Gfx::TEXT_HEADING, "Spells: ");
 	for (int i = 0; i < Data::SPELL_COUNT; ++i) {
 		if (sg._spellCharges[i] != 0) {
-			put(Gfx::TEXT_NORMAL, Common::String::format("%sS-", Data::spellName((Data::SpellType)i)));
+			put(Gfx::TEXT_NORMAL, Common::String::format("%ss-", Data::spellName((Data::SpellType)i)));
 			put(Gfx::TEXT_NUMBER, number(sg._spellCharges[i]));
 			put(Gfx::TEXT_NORMAL, " ");
 		}
 	}
 	row += 3; // two blank rows below SPELLS
 
-	putAt(0, row, Gfx::TEXT_HEADING, "ITEMS: ");
+	putAt(0, row, Gfx::TEXT_HEADING, "Items: ");
 	for (int i = 0; i < Data::ITEM_COUNT; ++i) {
 		if (sg._items[i] != 0) {
 			put(Gfx::TEXT_NORMAL, Common::String::format("%s%s-", Data::itemName(i),
-				i == Data::ITEM_BOOTS ? "" : "S"));
+				i == Data::ITEM_BOOTS ? "" : "s"));
 			put(Gfx::TEXT_NUMBER, number(sg._items[i]));
 			put(Gfx::TEXT_NORMAL, " ");
 		}


Commit: b536d8c0fc51ba6bdbd9acdd88750b34397585ff
    https://github.com/scummvm/scummvm/commit/b536d8c0fc51ba6bdbd9acdd88750b34397585ff
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:41:03+11:00

Commit Message:
ULTIMA: ULTIMA2: Changed the remaining capitalized text to mixed case

Changed paths:
    engines/ultima/ultima2/logic/city_castle_logic.cpp
    engines/ultima/ultima2/logic/dungeon_logic.cpp
    engines/ultima/ultima2/logic/logic.cpp
    engines/ultima/ultima2/logic/overworld_logic.cpp
    engines/ultima/ultima2/views/create_character.cpp
    engines/ultima/ultima2/views/interactions/food_shop.cpp
    engines/ultima/ultima2/views/interactions/shop.cpp
    engines/ultima/ultima2/views/zstats.cpp


diff --git a/engines/ultima/ultima2/logic/city_castle_logic.cpp b/engines/ultima/ultima2/logic/city_castle_logic.cpp
index 7984ce0caa3..ba27da607dd 100644
--- a/engines/ultima/ultima2/logic/city_castle_logic.cpp
+++ b/engines/ultima/ultima2/logic/city_castle_logic.cpp
@@ -227,7 +227,7 @@ bool CityCastleLogic::steal(Data::Direction dir) {
 	switch (sg._mapType) {
 	case 1: // Village
 		if (sg._mapY < 32 && sg._mapX >= 32) {
-			writeString("STEAL FOOD!\n");
+			writeString("Steal food!\n");
 			sg._food = MIN(sg._food + 100, 9999);
 		} else {
 			noLuck();
@@ -237,11 +237,11 @@ bool CityCastleLogic::steal(Data::Direction dir) {
 		if (sg._mapY >= 32) {
 			noLuck();
 		} else if (sg._mapX >= 32) {
-			writeString("STEAL ARMOUR!\n");
+			writeString("Steal armour!\n");
 			int idx = 1 + (randByte() & 3);
 			sg._armorOwned[idx] = MIN(sg._armorOwned[idx] + 1, Data::MAX_BCD_BYTE);
 		} else {
-			writeString("STEAL WEAPONS!\n");
+			writeString("Steal weapons!\n");
 			int idx = 1 + (randByte() & 7);
 			sg._weaponOwned[idx] = MIN(sg._weaponOwned[idx] + 1, Data::MAX_BCD_BYTE);
 		}
@@ -530,13 +530,13 @@ bool CityCastleLogic::transact(Data::Direction dir) {
 			writeString("A guard says:\nPay your taxes!\n");
 			return true;
 		case Data::TILE_JESTER:
-			writeString("A jester sings:\nHO HO HO!\n");
+			writeString("A jester sings:\nHo ho ho!\n");
 			return true;
 		case Data::TILE_SHOPKEEP:
 			writeString("A merchant says:\nWill you buy my apples?\n");
 			return true;
 		case Data::TILE_FIGHTER:
-			writeString("A fighter says:\nUGH, ME TOUGH!\n");
+			writeString("A fighter says:\nUgh, me tough!\n");
 			return true;
 		case Data::TILE_CLERIC:
 			writeString("A cleric says:\nBelieve!\n");
diff --git a/engines/ultima/ultima2/logic/dungeon_logic.cpp b/engines/ultima/ultima2/logic/dungeon_logic.cpp
index 71784b12d8f..65577cdc964 100644
--- a/engines/ultima/ultima2/logic/dungeon_logic.cpp
+++ b/engines/ultima/ultima2/logic/dungeon_logic.cpp
@@ -97,7 +97,7 @@ bool DungeonLogic::advance() {
 
 	sg._lightTurns = 0;
 	playFX(Data::SFX_TRAP);
-	writeString("\nARGH! A trap!\n");
+	writeString("\nArgh! A trap!\n");
 
 	if (sg._thievesTools == 0) {
 		playerDied();
diff --git a/engines/ultima/ultima2/logic/logic.cpp b/engines/ultima/ultima2/logic/logic.cpp
index e5707bbaa94..f6d4db63904 100644
--- a/engines/ultima/ultima2/logic/logic.cpp
+++ b/engines/ultima/ultima2/logic/logic.cpp
@@ -266,7 +266,7 @@ void Logic::resolveDirection(Data::Direction dir) {
 bool Logic::trySpendGold(int amount) {
 	Data::Savegame &sg = _G(savegame);
 	if (sg._gold < amount) {
-		writeString("YOU DONT HAVE THAT MUCH!\n");
+		writeString("You dont have that much!\n");
 		return false;
 	}
 
@@ -417,7 +417,7 @@ bool Logic::get() {
 }
 
 bool Logic::hyper() {
-	writeString("Hyper WHAT?\n");
+	writeString("Hyper what?\n");
 	return true;
 }
 
@@ -439,7 +439,7 @@ bool Logic::igniteTorch() {
 }
 
 bool Logic::jump() {
-	writeString("Jump...WHEE...\n");
+	writeString("Jump...Whee...\n");
 	return true;
 }
 
diff --git a/engines/ultima/ultima2/logic/overworld_logic.cpp b/engines/ultima/ultima2/logic/overworld_logic.cpp
index bcdcd8f6686..a166d7337ed 100644
--- a/engines/ultima/ultima2/logic/overworld_logic.cpp
+++ b/engines/ultima/ultima2/logic/overworld_logic.cpp
@@ -500,7 +500,7 @@ bool OverworldLogic::attack(Data::Direction dir) {
 	}
 
 	playFX(Data::SFX_HIT);
-	writeString("--HIT!!!\n");
+	writeString("--Hit!!!\n");
 	alertTownGuards(slot);
 
 	int dmg = (sg._readiedWeapon * 8 + Data::toBcd(sg._strength)) >> 2;
diff --git a/engines/ultima/ultima2/views/create_character.cpp b/engines/ultima/ultima2/views/create_character.cpp
index 60f49cd37bd..4474f403300 100644
--- a/engines/ultima/ultima2/views/create_character.cpp
+++ b/engines/ultima/ultima2/views/create_character.cpp
@@ -180,7 +180,7 @@ void CreateCharacter::draw() {
 
 	put(10, 16, Gfx::TEXT_NORMAL, "Satisfactory (Y/N)-");
 
-	put(8, 18, Gfx::TEXT_NORMAL, "RACES:         TYPES:");
+	put(8, 18, Gfx::TEXT_NORMAL, "Races:         Types:");
 	put(9, 19, Gfx::TEXT_NORMAL, "1-Human        1-Fighter");
 	put(9, 20, Gfx::TEXT_NORMAL, "2-Elf          2-Cleric");
 	put(9, 21, Gfx::TEXT_NORMAL, "3-Dwarf        3-Wizard");
diff --git a/engines/ultima/ultima2/views/interactions/food_shop.cpp b/engines/ultima/ultima2/views/interactions/food_shop.cpp
index d480cb1ed80..f23e21421d1 100644
--- a/engines/ultima/ultima2/views/interactions/food_shop.cpp
+++ b/engines/ultima/ultima2/views/interactions/food_shop.cpp
@@ -45,9 +45,9 @@ bool FoodShop::msgFocus(const FocusMessage &msg) {
 bool FoodShop::msgKeypress(const KeypressMessage &msg) {
 	close();
 	if (toupper(msg.ascii) != 'Y') {
-		writeString("NO\n");
+		writeString("No\n");
 	} else {
-		writeString("YES,\nNo onions and to go please!\n");
+		writeString("Yes,\nNo onions and to go please!\n");
 		if (_G(logic)->trySpendGold(_price)) {
 			Data::Savegame &sg = _G(savegame);
 			sg._food = MIN(sg._food + 100, MAX_FOOD);
diff --git a/engines/ultima/ultima2/views/interactions/shop.cpp b/engines/ultima/ultima2/views/interactions/shop.cpp
index a1440106dd1..108b02e1e3e 100644
--- a/engines/ultima/ultima2/views/interactions/shop.cpp
+++ b/engines/ultima/ultima2/views/interactions/shop.cpp
@@ -132,7 +132,7 @@ void Shop::confirm(char key) {
 				sg._weaponOwned[_item] = MIN(sg._weaponOwned[_item] + 1, Data::MAX_BCD_BYTE);
 			else
 				sg._armorOwned[_item] = MIN(sg._armorOwned[_item] + 1, Data::MAX_BCD_BYTE);
-			writeString("SOLD!\n");
+			writeString("Sold!\n");
 		}
 		break;
 
@@ -150,9 +150,9 @@ void Shop::confirm(char key) {
 
 	case SPELL_WIZARD:
 		if (!yes) {
-			writeString("NO!\nUGURLA OLSUN!\n");
+			writeString("No!\nUgurla olsun!\n");
 		} else {
-			writeString("YES\n");
+			writeString("Yes\n");
 			if (_G(logic)->trySpendGold(_price)) {
 				sg._spellCharges[_item] = MIN(sg._spellCharges[_item] + 5, Data::MAX_BCD_BYTE);
 				writeString("Gule gule!\n");
diff --git a/engines/ultima/ultima2/views/zstats.cpp b/engines/ultima/ultima2/views/zstats.cpp
index 915a588da07..a6923f5fb1d 100644
--- a/engines/ultima/ultima2/views/zstats.cpp
+++ b/engines/ultima/ultima2/views/zstats.cpp
@@ -74,23 +74,23 @@ void ZStats::draw() {
 		Data::raceName(sg._race),
 		Data::className(sg._class)));
 
-	putAt(2, 4, Gfx::TEXT_NORMAL, "WEAPON-");
+	putAt(2, 4, Gfx::TEXT_NORMAL, "Weapon-");
 	put(Gfx::TEXT_LIST, Data::weaponName(sg._readiedWeapon));
-	putAt(2, 5, Gfx::TEXT_NORMAL, "ARMOUR-");
+	putAt(2, 5, Gfx::TEXT_NORMAL, "Armour-");
 	put(Gfx::TEXT_LIST, Data::armorName(sg._readiedArmor));
-	putAt(2, 6, Gfx::TEXT_NORMAL, " SPELL-");
+	putAt(2, 6, Gfx::TEXT_NORMAL, " Spell-");
 	put(Gfx::TEXT_LIST, Data::spellName(sg._readiedSpell));
 
 	labelled(-1, 4, "Torches-", sg._torches);
 	labelled(-1, 5, "Keys-", sg._keys);
 	labelled(-1, 6, "Tools-", sg._thievesTools);
 
-	labelled(0, 7, "STRENGTH-", sg._strength);
-	labelled(14, 7, " STAMINA-", sg._stamina);
-	labelled(-1, 7, " WISDOM-", sg._wisdom);
-	labelled(0, 8, " AGILITY-", sg._agility);
-	labelled(14, 8, "CHARISMA-", sg._charisma);
-	labelled(-1, 8, "INTELL.-", sg._intelligence);
+	labelled(0, 7, "Strength-", sg._strength);
+	labelled(14, 7, " Stamina-", sg._stamina);
+	labelled(-1, 7, " Wisdom-", sg._wisdom);
+	labelled(0, 8, " Agility-", sg._agility);
+	labelled(14, 8, "Charisma-", sg._charisma);
+	labelled(-1, 8, "Intell.-", sg._intelligence);
 
 	int row = 10;
 	putAt(0, row, Gfx::TEXT_HEADING, "Weapons: ");


Commit: c3f8f2b77efcc60bee26c94f011d90f485684720
    https://github.com/scummvm/scummvm/commit/c3f8f2b77efcc60bee26c94f011d90f485684720
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:41:03+11:00

Commit Message:
ULTIMA: ULTIMA1: Implement sound effects

Changed paths:
  A engines/ultima/ultima1/sound_effects.cpp
  A engines/ultima/ultima1/sound_effects.h
    engines/ultima/module.mk
    engines/ultima/ultima1/ultima1.cpp
    engines/ultima/ultima1/ultima1.h


diff --git a/engines/ultima/module.mk b/engines/ultima/module.mk
index 8ba38c783de..387bf9d14ce 100644
--- a/engines/ultima/module.mk
+++ b/engines/ultima/module.mk
@@ -49,6 +49,7 @@ MODULE_OBJS += \
 	ultima1/events.o \
 	ultima1/messages.o \
 	ultima1/metaengine.o \
+	ultima1/sound_effects.o \
 	ultima1/core/strings.o \
 	ultima1/data/data.o \
 	ultima1/data/entity.o \
diff --git a/engines/ultima/ultima1/sound_effects.cpp b/engines/ultima/ultima1/sound_effects.cpp
new file mode 100644
index 00000000000..4e1050127cc
--- /dev/null
+++ b/engines/ultima/ultima1/sound_effects.cpp
@@ -0,0 +1,266 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "ultima/ultima1/sound_effects.h"
+
+namespace Ultima {
+namespace Ultima1 {
+
+// The clock of the processor the timing loops were written for
+constexpr uint32 CPU_HZ = 4772727;
+
+// Cost in clock cycles of writing to the speaker's port, and of flipping the
+// bit that is written
+constexpr uint32 OUT_CYCLES = 14;
+constexpr uint32 FLIP_CYCLES = 4;
+
+constexpr int AMPLITUDE = 0x30;
+
+namespace {
+
+/**
+ * Counts the clock cycles spent and notes when the speaker changed level
+ */
+class Speaker {
+private:
+	uint32 _cycles = 0;
+	bool _bit = false;
+	bool _level = false;
+
+public:
+	Common::Array<uint32> _edges;
+
+	uint32 cycles() const {
+		return _cycles;
+	}
+
+	void run(uint32 cycles) {
+		_cycles += cycles;
+	}
+
+	// Writes the current bit to the speaker
+	void out() {
+		run(OUT_CYCLES);
+		if (_bit != _level) {
+			_level = _bit;
+			_edges.push_back(_cycles);
+		}
+	}
+
+	// Flips the bit the next write will use
+	void flip() {
+		run(FLIP_CYCLES);
+		_bit = !_bit;
+	}
+
+	// A loop of decrementing a byte register until it reaches zero
+	void countByte(int count) {
+		if (count == 0)
+			count = 256;
+		_cycles += 19 * count - 12;
+	}
+
+	// The same, with a word register
+	void countWord(int count) {
+		if (count == 0)
+			count = 65536;
+		_cycles += 18 * count - 10;
+	}
+
+	// The cost of a conditional jump that is taken or isn't
+	void jump(bool taken) {
+		run(taken ? 16 : 4);
+	}
+
+	// The same for the loop instruction
+	void loop(bool taken) {
+		run(taken ? 17 : 5);
+	}
+
+	// Lets go of the speaker at the end
+	void release() {
+		_bit = false;
+		out();
+	}
+};
+
+// Sixteen long pulses
+void bump(Speaker &s) {
+	s.run(4);
+	for (int left = 0x10; left > 0; --left) {
+		s.out();
+		s.flip();
+		s.run(4);
+		s.countWord(0x3E8);
+		s.loop(left > 1);
+	}
+}
+
+// Forty eight shorter pulses
+void ack(Speaker &s) {
+	s.run(4);
+	for (int left = 0x30; left > 0; --left) {
+		s.out();
+		s.flip();
+		s.run(4);
+		s.run(4);
+		s.countWord(0x163);
+		s.run(2);
+		s.jump(false);
+		s.loop(left > 1);
+	}
+}
+
+// Pulses that lengthen steadily, starting from a given length. The length is
+// a byte, so it wraps back to short again if the effect is long enough
+void chirp(Speaker &s, byte repeats, byte length) {
+	s.run(4 + 4);
+	for (int left = repeats; left > 0; --left) {
+		length = (byte)(length + 5);
+		s.run(4 + 2);
+		s.countByte(length);
+		s.out();
+		s.flip();
+		s.run(3);
+		s.jump(left > 1);
+	}
+}
+
+// Pairs of pulses, one lengthening and one shortening, which sweep up and down
+void siren(Speaker &s, byte high, byte repeats) {
+	byte low = 1;
+	s.run(2 + 2);
+
+	do {
+		s.run(2);
+		for (int left = repeats; left > 0; --left) {
+			s.run(2);
+			s.countByte(high);
+			s.out();
+			s.flip();
+			s.run(2);
+			s.countByte(low);
+			s.out();
+			s.flip();
+			s.run(3);
+			s.jump(left > 1);
+		}
+
+		--high;
+		++low;
+		s.run(3 + 3 + 4);
+		s.jump(low != 0x1B);
+	} while (low != 0x1B);
+}
+
+// Pulses that steadily shorten
+void fall(Speaker &s) {
+	s.run(4 + 3);
+	for (int length = 0xA0; length > 0; --length) {
+		s.run(2);
+		s.countWord(length);
+		s.out();
+		s.flip();
+		s.run(3);
+		s.jump(length > 1);
+	}
+}
+
+// Pulses that steadily lengthen, getting faster than a chirp
+void zap(Speaker &s) {
+	s.run(4);
+	for (int low = 0xFB; low > 0; --low) {
+		s.out();
+		s.flip();
+		s.run(2);
+		s.countByte(256 - low);
+		s.run(3);
+		s.jump(low > 1);
+	}
+}
+
+// Turns when the speaker changed level into samples
+Common::Array<byte> toSamples(Speaker &s) {
+	s.release();
+
+	Common::Array<byte> samples;
+	uint32 total = (uint32)(((uint64)s.cycles() * SoundEffects::SAMPLE_RATE) / CPU_HZ) + 1;
+	samples.resize(total);
+
+	uint32 pos = 0;
+	bool high = false;
+	for (uint i = 0; i <= s._edges.size(); ++i) {
+		uint32 end = (i < s._edges.size()) ? (uint32)(((uint64)s._edges[i] * SoundEffects::SAMPLE_RATE) / CPU_HZ) : total;
+		byte level = high ? 0x80 + AMPLITUDE : 0x80 - AMPLITUDE;
+
+		for (; pos < end && pos < total; ++pos)
+			samples[pos] = level;
+		high = !high;
+	}
+
+	return samples;
+}
+
+} // End of anonymous namespace
+
+Common::Array<byte> SoundEffects::render(int effect) {
+	Speaker s;
+
+	switch (effect) {
+	case 0:
+		bump(s);
+		break;
+	case 1:
+		ack(s);
+		break;
+	case 2:
+		chirp(s, 200, 0x7E);
+		break;
+	case 3:
+		chirp(s, 255, 0x7E);
+		break;
+	case 4:
+		chirp(s, 8, 0x7E);
+		break;
+	case 5:
+		siren(s, 0xC0, 0x3C);
+		break;
+	case 6:
+		fall(s);
+		break;
+	case 7:
+		siren(s, 5, 0x0F);
+		break;
+	case 8:
+		zap(s);
+		break;
+	case 9:
+		chirp(s, 4, 0);
+		break;
+	default:
+		return Common::Array<byte>();
+	}
+
+	return toSamples(s);
+}
+
+} // namespace Ultima1
+} // namespace Ultima
diff --git a/engines/ultima/ultima1/sound_effects.h b/engines/ultima/ultima1/sound_effects.h
new file mode 100644
index 00000000000..78077a19d62
--- /dev/null
+++ b/engines/ultima/ultima1/sound_effects.h
@@ -0,0 +1,50 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef ULTIMA1_SOUND_EFFECTS_H
+#define ULTIMA1_SOUND_EFFECTS_H
+
+#include "common/array.h"
+
+namespace Ultima {
+namespace Ultima1 {
+
+/**
+ * Recreates the sound effects the original made by switching the PC speaker
+ * on and off in timing loops
+ */
+class SoundEffects {
+public:
+	static constexpr int SAMPLE_RATE = 44100;
+	static constexpr int EFFECT_COUNT = 10;
+
+	/**
+	 * Works out the sound of an effect as unsigned 8-bit samples
+	 * @param effect	The effect number, from 0 to 9
+	 * @returns			The samples, or nothing if there's no such effect
+	 */
+	static Common::Array<byte> render(int effect);
+};
+
+} // namespace Ultima1
+} // namespace Ultima
+
+#endif
diff --git a/engines/ultima/ultima1/ultima1.cpp b/engines/ultima/ultima1/ultima1.cpp
index 6f6c76774f1..d39cb60a52e 100644
--- a/engines/ultima/ultima1/ultima1.cpp
+++ b/engines/ultima/ultima1/ultima1.cpp
@@ -25,9 +25,11 @@
 #include "common/savefile.h"
 #include "common/system.h"
 #include "engines/util.h"
+#include "audio/decoders/raw.h"
 #include "graphics/paletteman.h"
 #include "ultima/ultima1/ultima1.h"
 #include "ultima/ultima1/console.h"
+#include "ultima/ultima1/sound_effects.h"
 #include "ultima/ultima1/views/views.h"
 #include "ultima/ultima1/views/map.h"
 #include "ultima/ultima1/metaengine.h"
@@ -44,6 +46,7 @@ Ultima1Engine::Ultima1Engine(OSystem *syst, const Ultima::UltimaGameDescription
 
 
 Ultima1Engine::~Ultima1Engine() {
+	_mixer->stopHandle(_effectHandle);
 }
 
 uint32 Ultima1Engine::getFeatures() const {
@@ -109,7 +112,28 @@ bool Ultima1Engine::savegamesExist() const {
 }
 
 void Ultima1Engine::playFX(int num) {
-	warning("TODO: playFX(%d)", num);
+	if (_savegame._soundOn)
+		queueEffect(SoundEffects::render(num));
+}
+
+void Ultima1Engine::queueEffect(const Common::Array<byte> &samples) {
+	// Don't let effects pile up behind the action
+	constexpr int MAX_QUEUED = 6;
+
+	if (samples.empty())
+		return;
+
+	if (!_mixer->isSoundHandleActive(_effectHandle)) {
+		_effectStream = Audio::makeQueuingAudioStream(SoundEffects::SAMPLE_RATE, false);
+		_mixer->playStream(Audio::Mixer::kSFXSoundType, &_effectHandle, _effectStream);
+	}
+
+	if (_effectStream->numQueuedStreams() >= MAX_QUEUED)
+		return;
+
+	byte *data = (byte *)malloc(samples.size());
+	memcpy(data, &samples[0], samples.size());
+	_effectStream->queueBuffer(data, samples.size(), DisposeAfterUse::YES, Audio::FLAG_UNSIGNED);
 }
 
 void Ultima1Engine::pauseMillis(uint32 millis) {
diff --git a/engines/ultima/ultima1/ultima1.h b/engines/ultima/ultima1/ultima1.h
index c0ca5679c82..b8670c84cf6 100644
--- a/engines/ultima/ultima1/ultima1.h
+++ b/engines/ultima/ultima1/ultima1.h
@@ -31,6 +31,8 @@
 #include "common/random.h"
 #include "common/serializer.h"
 #include "common/util.h"
+#include "audio/audiostream.h"
+#include "audio/mixer.h"
 #include "engines/engine.h"
 #include "engines/savestate.h"
 #include "graphics/palette.h"
@@ -52,6 +54,13 @@ struct Ultima1GameDescription;
 class Ultima1Engine : public Engine, public Shared::Events {
 private:
 	const Ultima::UltimaGameDescription *_gameDescription;
+	Audio::QueuingAudioStream *_effectStream = nullptr;
+	Audio::SoundHandle _effectHandle;
+
+	/**
+	 * Queues up the samples of a sound effect to be played after any already playing
+	 */
+	void queueEffect(const Common::Array<byte> &samples);
 
 protected:
 	// Engine APIs
@@ -135,7 +144,7 @@ public:
 	bool savegamesExist() const;
 
 	/**
-	 * Play a sound effect
+	 * Plays one of the sound effects (0 to 9), if sound is turned on
 	 */
 	void playFX(int num);
 


Commit: 598e9dc34496a946ff43946f9f5e76365661d477
    https://github.com/scummvm/scummvm/commit/598e9dc34496a946ff43946f9f5e76365661d477
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:41:03+11:00

Commit Message:
ULTIMA: ULTIMA1: Fix Britain/Gwenno mis-spellings

Changed paths:
    engines/ultima/ultima1/data/map.cpp
    engines/ultima/ultima1/logic/city_castle_logic.cpp


diff --git a/engines/ultima/ultima1/data/map.cpp b/engines/ultima/ultima1/data/map.cpp
index b805a4a4566..4902f23b871 100644
--- a/engines/ultima/ultima1/data/map.cpp
+++ b/engines/ultima/ultima1/data/map.cpp
@@ -59,7 +59,7 @@ static const byte LOCATION_POS_Y[LOCATION_COUNT] = {
 // Indexed the same way as LOCATION_POS_X/Y (locationNum - 1) - cities
 // (1-32), castles (33-40), pillars/sign posts (41-47), then dungeons (48-84)
 const char *LOCATION_NAMES[LOCATION_COUNT] = {
-	"Britian", "Moon", "Fawn", "Paws", "Montor", "Yew", "Tune", "Grey",
+	"Britain", "Moon", "Fawn", "Paws", "Montor", "Yew", "Tune", "Grey",
 	"Arnold", "Linda", "Helen", "Owen", "John", "Gerry", "Wolf", "The Snake",
 	"Nassau", "Clear Lagoon", "Stout", "Gauntlet", "Imagination", "Ponder",
 	"Wealth", "Poor", "Gorlab", "Dextron", "Magic", "Wheeler", "Bulldozer",
diff --git a/engines/ultima/ultima1/logic/city_castle_logic.cpp b/engines/ultima/ultima1/logic/city_castle_logic.cpp
index 83226501725..858f54c7eee 100644
--- a/engines/ultima/ultima1/logic/city_castle_logic.cpp
+++ b/engines/ultima/ultima1/logic/city_castle_logic.cpp
@@ -526,7 +526,7 @@ void CityCastleLogic::updateBardJester(int entityIndex) {
 			writeString("Iolo the Bard sings:\n");
 			writeString("Ho eyoh he hum!\n");
 		} else {
-			writeString("Gwino the jester sings:\n");
+			writeString("Gwenno the jester sings:\n");
 			writeString("I've got the key!\n");
 		}
 	}


Commit: a8ad9245919d284aa47fe7275177338b55ab2086
    https://github.com/scummvm/scummvm/commit/a8ad9245919d284aa47fe7275177338b55ab2086
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:41:04+11:00

Commit Message:
ULTIMA: Add Voyager Dragon to credits for patch upgrades

Changed paths:
    engines/ultima/credits.pl


diff --git a/engines/ultima/credits.pl b/engines/ultima/credits.pl
index e1d93eba033..3f1074d5231 100644
--- a/engines/ultima/credits.pl
+++ b/engines/ultima/credits.pl
@@ -4,6 +4,8 @@ begin_section("Ultima");
 	add_person("Matthew Jimenez", "OMGPizzaGuy", "");
 
 	add_person("Paul Robson", "", "(Akalabeth)");
+	add_person("", "Voyager Dragon", "(U2 Patch)");
+	add_person("", "Voyager Dragon", "(U3 Patch)");
 	add_person("Daniel c. Würl", "dwuerl", "(Nuvie)");
 	add_person("Eric Fry", "yuv422", "(Nuvie)");
 	add_person("Jeremy Newman", "laxdragon", "(Nuvie)");


Commit: 755b3bb9189d8aaf00e538f05a74fff59c9eef0e
    https://github.com/scummvm/scummvm/commit/755b3bb9189d8aaf00e538f05a74fff59c9eef0e
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:41:04+11:00

Commit Message:
ULTIMA: ULTIMA1: Create custom font for handling arrow symbols

The two arrows are always drawn in blue with white edges,
using custom drawing rather than the standard font glyphs

Changed paths:
  A engines/ultima/ultima1/gfx/font.cpp
  A engines/ultima/ultima1/gfx/font.h
    engines/ultima/module.mk
    engines/ultima/ultima1/ultima1.cpp
    engines/ultima/ultima1/ultima1.h


diff --git a/engines/ultima/module.mk b/engines/ultima/module.mk
index 387bf9d14ce..a12aa5c18c4 100644
--- a/engines/ultima/module.mk
+++ b/engines/ultima/module.mk
@@ -58,6 +58,7 @@ MODULE_OBJS += \
 	ultima1/data/savegame.o \
 	ultima1/data/space_map.o \
 	ultima1/data/tiles.o \
+	ultima1/gfx/font.o \
 	ultima1/gfx/pic_decoder.o \
 	ultima1/gfx/text_cursor.o \
 	ultima1/gfx/text_input.o \
diff --git a/engines/ultima/ultima1/gfx/font.cpp b/engines/ultima/ultima1/gfx/font.cpp
new file mode 100644
index 00000000000..56c10e2dd04
--- /dev/null
+++ b/engines/ultima/ultima1/gfx/font.cpp
@@ -0,0 +1,62 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "graphics/surface.h"
+#include "ultima/ultima1/gfx/font.h"
+
+namespace Ultima {
+namespace Ultima1 {
+namespace Gfx {
+
+static const byte ARROW[8][8] = {
+	{ 15, 15,  0,  0,  0,  0,  0,  0 },
+	{  1,  1, 15, 15,  0,  0,  0,  0 },
+	{  1,  1,  1,  1, 15, 15,  0,  0 },
+	{  1,  1,  1,  1,  1,  1, 15, 15 },
+	{  1,  1,  1,  1,  1, 15, 15,  0 },
+	{  1,  1,  1, 15, 15,  0,  0,  0 },
+	{  1, 15, 15,  0,  0,  0,  0,  0 },
+	{ 15,  0,  0,  0,  0,  0,  0,  0 },
+};
+
+void Font::drawChar(Graphics::Surface *dst, uint32 chr, int x, int y, uint32 color) const {
+	if (chr == '\x10' || chr == '\x11') {
+		// Get area for the arrow
+		Graphics::Surface sub = dst->getSubArea(Common::Rect(x, y, x + getMaxCharWidth(), y + getFontHeight()));
+
+		// Handle drawing left/right arrow in blue with white outline
+		for (int yp = 0; yp < getFontHeight(); ++yp) {
+			const byte *src = &ARROW[yp][0];
+			byte *dest = (byte *)sub.getBasePtr(0, yp);
+
+			for (int xp = 0; xp < getMaxCharWidth(); ++xp, ++src)
+				dest[chr == '\x10' ? xp : 7 - xp] = *src;
+		}
+
+	} else {
+		// Otherwise, dispatch to the standard DosFont drawing
+		Graphics::DosFont::drawChar(dst, chr, x, y, color);
+	}
+}
+
+} // namespace Gfx
+} // namespace Ultima1
+} // namespace Ultima
diff --git a/engines/ultima/ultima1/gfx/font.h b/engines/ultima/ultima1/gfx/font.h
new file mode 100644
index 00000000000..e288e059e35
--- /dev/null
+++ b/engines/ultima/ultima1/gfx/font.h
@@ -0,0 +1,50 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef ULTIMA1_GFX_FONT_H
+#define ULTIMA1_GFX_FONT_H
+
+#include "graphics/fonts/dosfont.h"
+
+namespace Ultima {
+namespace Ultima1 {
+namespace Gfx {
+
+/**
+ * Derived DosFont variant - the left ('\x10') and right ('\x11') characters
+ * will always be drawn as blue solids with a white outline
+ */
+class Font : public Graphics::DosFont {
+public:
+	~Font() override {
+	}
+
+	/**
+	 * Draw a character at a specific point on the surface.
+	 */
+	void drawChar(Graphics::Surface *dst, uint32 chr, int x, int y, uint32 color) const override;
+};
+
+} // namespace Gfx
+} // namespace Ultima1
+} // namespace Ultima
+
+#endif
diff --git a/engines/ultima/ultima1/ultima1.cpp b/engines/ultima/ultima1/ultima1.cpp
index d39cb60a52e..8b8044aa9ca 100644
--- a/engines/ultima/ultima1/ultima1.cpp
+++ b/engines/ultima/ultima1/ultima1.cpp
@@ -30,6 +30,7 @@
 #include "ultima/ultima1/ultima1.h"
 #include "ultima/ultima1/console.h"
 #include "ultima/ultima1/sound_effects.h"
+#include "ultima/ultima1/gfx/font.h"
 #include "ultima/ultima1/views/views.h"
 #include "ultima/ultima1/views/map.h"
 #include "ultima/ultima1/metaengine.h"
@@ -140,5 +141,9 @@ void Ultima1Engine::pauseMillis(uint32 millis) {
 	g_system->delayMillis(millis);
 }
 
+Graphics::Font *Ultima1Engine::createFont() const {
+	return new Gfx::Font();
+}
+
 } // namespace Ultima1
 } // namespace Ultima
diff --git a/engines/ultima/ultima1/ultima1.h b/engines/ultima/ultima1/ultima1.h
index b8670c84cf6..aff3bf45289 100644
--- a/engines/ultima/ultima1/ultima1.h
+++ b/engines/ultima/ultima1/ultima1.h
@@ -152,6 +152,11 @@ public:
 	 * Pause for a given number of milliseconds
 	 */
 	void pauseMillis(uint32 millis);
+
+	/**
+	 * Returns a font object that GfxSurface instances can use
+	 */
+	Graphics::Font *createFont() const override;
 };
 
 extern Ultima1Engine *g_engine;


Commit: 80d127a03385f7aeff238cd0d389d20af6bb41df
    https://github.com/scummvm/scummvm/commit/80d127a03385f7aeff238cd0d389d20af6bb41df
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:41:04+11:00

Commit Message:
ULTIMA: ULTIMA1: Fix f5/f7 savegame handling

Changed paths:
    engines/ultima/ultima1/ultima1.cpp
    engines/ultima/ultima1/views/main_menu.cpp
    engines/ultima/ultima1/views/map.cpp


diff --git a/engines/ultima/ultima1/ultima1.cpp b/engines/ultima/ultima1/ultima1.cpp
index 8b8044aa9ca..f864ab1c5c6 100644
--- a/engines/ultima/ultima1/ultima1.cpp
+++ b/engines/ultima/ultima1/ultima1.cpp
@@ -85,9 +85,8 @@ bool Ultima1Engine::canSaveGameStateCurrently(Common::U32String *msg) {
 }
 
 bool Ultima1Engine::canLoadGameStateCurrently(Common::U32String *msg) {
-	return canSaveGameStateCurrently() ||
-		dynamic_cast<Views::Interactions::Dead *>(focusedView()) != nullptr ||
-		dynamic_cast<Views::Interactions::SpaceDead *>(focusedView()) != nullptr;
+	// Allow loading savegames anywhere
+	return true;
 }
 
 Common::Error Ultima1Engine::syncGame(Common::Serializer &s) {
diff --git a/engines/ultima/ultima1/views/main_menu.cpp b/engines/ultima/ultima1/views/main_menu.cpp
index 77dee41a9aa..88766961e22 100644
--- a/engines/ultima/ultima1/views/main_menu.cpp
+++ b/engines/ultima/ultima1/views/main_menu.cpp
@@ -52,6 +52,9 @@ void MainMenu::draw() {
 }
 
 bool MainMenu::msgKeypress(const KeypressMessage &msg) {
+	if (FullScreenDialog::msgKeypress(msg))
+		return true;
+
 	switch (toupper(msg.ascii)) {
 	case 'A':
 		replaceView("CreateCharacter");
diff --git a/engines/ultima/ultima1/views/map.cpp b/engines/ultima/ultima1/views/map.cpp
index 3533a56f254..27555cbf4ae 100644
--- a/engines/ultima/ultima1/views/map.cpp
+++ b/engines/ultima/ultima1/views/map.cpp
@@ -44,6 +44,9 @@ bool Map::msgAction(const ActionMessage &msg) {
 }
 
 bool Map::msgKeypress(const KeypressMessage &msg) {
+	if (Dialog::msgKeypress(msg))
+		return true;
+
 	_passStartTime = g_system->getMillis();
 	g_engine->_logic->keypress(msg.keycode);
 	return true;


Commit: d24305ac15201baa2620384ba7d47e91cf2e55c6
    https://github.com/scummvm/scummvm/commit/d24305ac15201baa2620384ba7d47e91cf2e55c6
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:41:04+11:00

Commit Message:
ULTIMA: ULTIMA1: Clear the game background before drawing elements

This fixes a bug where some of the dialog from character creation
remained on-screen after starting the game.

Changed paths:
    engines/ultima/ultima1/views/game.cpp
    engines/ultima/ultima1/views/space_game.cpp


diff --git a/engines/ultima/ultima1/views/game.cpp b/engines/ultima/ultima1/views/game.cpp
index acd37ac1ee8..f5c7e1e35bb 100644
--- a/engines/ultima/ultima1/views/game.cpp
+++ b/engines/ultima/ultima1/views/game.cpp
@@ -43,6 +43,7 @@ Game::Game() : Shared::View("Game"), _commands(this), _stats(this) {
 
 void Game::draw() {
 	auto s = getSurface();
+	s.clear();
 	Graphics::Views::UIElement::draw();
 
 	// Vertical divider between the command/message log (left) and the stats panel (right)
diff --git a/engines/ultima/ultima1/views/space_game.cpp b/engines/ultima/ultima1/views/space_game.cpp
index f78e46817b3..7cd32d011c3 100644
--- a/engines/ultima/ultima1/views/space_game.cpp
+++ b/engines/ultima/ultima1/views/space_game.cpp
@@ -38,6 +38,7 @@ SpaceGame::SpaceGame() : Shared::View("SpaceGame"), _commands(this), _stats(this
 
 void SpaceGame::draw() {
 	auto s = getSurface();
+	s.clear();
 	Graphics::Views::UIElement::draw();
 
 	// Divider between the command/message log (left) and the stats corner


Commit: 7eaeb3a8ae4ab47857fd835f6c92c3df90e83cb0
    https://github.com/scummvm/scummvm/commit/7eaeb3a8ae4ab47857fd835f6c92c3df90e83cb0
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:41:04+11:00

Commit Message:
ULTIMA: ULTIMA1: Fix enemy spaceship rendering

Changed paths:
    engines/ultima/ultima1/data/map.cpp
    engines/ultima/ultima1/data/map.h
    engines/ultima/ultima1/data/tiles.cpp
    engines/ultima/ultima1/data/tiles.h
    engines/ultima/ultima1/views/space_cockpit.cpp


diff --git a/engines/ultima/ultima1/data/map.cpp b/engines/ultima/ultima1/data/map.cpp
index 4902f23b871..16a2089679b 100644
--- a/engines/ultima/ultima1/data/map.cpp
+++ b/engines/ultima/ultima1/data/map.cpp
@@ -160,7 +160,8 @@ void Map::init() {
 	loadTiles("egamond.bin", &_mondainTiles[1], MONDAIN_TILES_COUNT, 16);
 	_mondainTiles[20] = _overworldTiles[TILE_PLAYER];
 
-	loadShipTiles("egaspace.bin", _spaceShipTiles, SPACE_SHIP_TILES_COUNT);
+	loadShipTiles("egaspace.bin", _spaceShipTiles, SPACE_SHIP_TILES_COUNT, SPACE_SHIP_TILE_WIDTH);
+	loadShipTiles("egafight.bin", _enemyFighterTiles, SPACE_ENEMY_TILES_COUNT, SPACE_ENEMY_TILE_WIDTH);
 }
 
 void Map::resetMondainMap() {
diff --git a/engines/ultima/ultima1/data/map.h b/engines/ultima/ultima1/data/map.h
index d6137f5522f..5624cf27bb2 100644
--- a/engines/ultima/ultima1/data/map.h
+++ b/engines/ultima/ultima1/data/map.h
@@ -118,6 +118,7 @@ private:
 	Graphics::ManagedSurface _cityTiles[CITY_TILES_COUNT];
 	Graphics::ManagedSurface _mondainTiles[MONDAIN_TILES_COUNT + 2];
 	Graphics::ManagedSurface _spaceShipTiles[SPACE_SHIP_TILES_COUNT];
+	Graphics::ManagedSurface _enemyFighterTiles[SPACE_ENEMY_TILES_COUNT];
 
 	/**
 	 * Used to generate the dungeon.
@@ -185,6 +186,13 @@ public:
 		return _spaceShipTiles;
 	}
 
+	/**
+	 * Get the cockpit-view enemy fighter glyphs, indexed by approach stage
+	 */
+	const Graphics::ManagedSurface *enemyFighterTiles() const {
+		return _enemyFighterTiles;
+	}
+
 	/**
 	 * Access tiles of the current map
 	 */
diff --git a/engines/ultima/ultima1/data/tiles.cpp b/engines/ultima/ultima1/data/tiles.cpp
index d22edb01e56..22543a02b07 100644
--- a/engines/ultima/ultima1/data/tiles.cpp
+++ b/engines/ultima/ultima1/data/tiles.cpp
@@ -66,35 +66,35 @@ void loadTiles(const char *filename, Graphics::ManagedSurface *tiles, int count,
 	delete[] data;
 }
 
-constexpr int SHIP_TILE_WIDTH = SPACE_SHIP_TILE_WIDTH;
 constexpr int SHIP_TILE_HEIGHT = SPACE_SHIP_TILE_HEIGHT;
-constexpr int SHIP_TILE_ROW_BYTES = SHIP_TILE_WIDTH / 8;
-constexpr int SHIP_TILE_BYTES = SHIP_TILE_ROW_BYTES * SHIP_TILE_HEIGHT;
 constexpr int SHIP_TILE_SHIFT_VARIANTS = 8;
-constexpr int SHIP_TILE_SLOT_BYTES = SHIP_TILE_BYTES * SHIP_TILE_SHIFT_VARIANTS;
 constexpr byte SHIP_TILE_MASK_COLOR = 15;
 
-void loadShipTiles(const char *filename, Graphics::ManagedSurface *tiles, int count) {
+void loadShipTiles(const char *filename, Graphics::ManagedSurface *tiles, int count, int width) {
+	const int rowBytes = width / 8;
+	const int tileBytes = rowBytes * SHIP_TILE_HEIGHT;
+	const int slotBytes = tileBytes * SHIP_TILE_SHIFT_VARIANTS;
+
 	Common::File f;
 	if (!f.open(filename))
 		error("Could not open %s", filename);
 
-	byte data[SHIP_TILE_BYTES];
+	byte *data = new byte[tileBytes];
 
 	for (int tileNum = 0; tileNum < count; ++tileNum) {
-		f.seek(tileNum * SHIP_TILE_SLOT_BYTES);
-		if (f.read(data, SHIP_TILE_BYTES) != (uint32)SHIP_TILE_BYTES)
+		f.seek(tileNum * slotBytes);
+		if (f.read(data, tileBytes) != (uint32)tileBytes)
 			error("Unexpected end of %s", filename);
 
 		Graphics::ManagedSurface &tile = tiles[tileNum];
-		tile.create(SHIP_TILE_WIDTH, SHIP_TILE_HEIGHT, Graphics::PixelFormat::createFormatCLUT8());
+		tile.create(width, SHIP_TILE_HEIGHT, Graphics::PixelFormat::createFormatCLUT8());
 		tile.clear(0);
 
 		for (int y = 0; y < SHIP_TILE_HEIGHT; ++y) {
-			const byte *row = &data[y * SHIP_TILE_ROW_BYTES];
+			const byte *row = &data[y * rowBytes];
 			byte *destRow = (byte *)tile.getBasePtr(0, y);
 
-			for (int x = 0; x < SHIP_TILE_WIDTH; ++x) {
+			for (int x = 0; x < width; ++x) {
 				int byteIdx = x / 8;
 				int bitMask = 0x80 >> (x % 8);
 				if (row[byteIdx] & bitMask)
@@ -102,6 +102,8 @@ void loadShipTiles(const char *filename, Graphics::ManagedSurface *tiles, int co
 			}
 		}
 	}
+
+	delete[] data;
 }
 
 } // namespace Data
diff --git a/engines/ultima/ultima1/data/tiles.h b/engines/ultima/ultima1/data/tiles.h
index faf0d7c4b35..85e67015c5e 100644
--- a/engines/ultima/ultima1/data/tiles.h
+++ b/engines/ultima/ultima1/data/tiles.h
@@ -38,6 +38,11 @@ constexpr int SPACE_SHIP_TILES_COUNT = 12;
 constexpr int SPACE_SHIP_TILE_WIDTH = 32;
 constexpr int SPACE_SHIP_TILE_HEIGHT = 19;
 
+// One cockpit-view enemy fighter glyph per approach stage, growing as it
+// closes in (same height as the ship glyphs, but narrower)
+constexpr int SPACE_ENEMY_TILES_COUNT = 7;
+constexpr int SPACE_ENEMY_TILE_WIDTH = 24;
+
 enum OverworldTileId {
 	TILE_OCEAN = 0,
 	TILE_GRASS = 1,
@@ -127,18 +132,20 @@ enum MondainTileId {
 extern void loadTiles(const char *filename, Graphics::ManagedSurface *tiles, int count, int size);
 
 /**
- * Loads the outer-space ship glyph sheet (egaspace.bin) into a
- * caller-supplied array of SPACE_SHIP_TILES_COUNT surfaces, one 32x19
- * 1-bit-per-pixel XOR mask glyph per shipType*4+facing combination
- * (blitShipSpriteXor). Each glyph is followed in the file by 7 more
- * byte-alignment-shifted copies of itself (for the original's hardware
- * byte-aligned blitter) - only the first, unshifted copy is loaded, since a
- * software blit isn't limited to byte-aligned X positions
+ * Loads a sheet of 1-bit-per-pixel mask glyphs, 19 pixels high, into a
+ * caller-supplied array of surfaces - the outer-space ship glyphs
+ * (egaspace.bin, one per shipType*4+facing combination) and the cockpit
+ * enemy fighter glyphs (egafight.bin, one per approach stage). Each glyph
+ * is followed in the file by 7 more byte-alignment-shifted copies of itself
+ * (for the original's hardware byte-aligned blitter) - only the first,
+ * unshifted copy is loaded, since a software blit isn't limited to
+ * byte-aligned X positions
  * @param filename		Filename to load
  * @param tiles			Tiles array to load into
  * @param count			Number of glyphs
+ * @param width			Width of each glyph in pixels, a multiple of 8
  */
-extern void loadShipTiles(const char *filename, Graphics::ManagedSurface *tiles, int count);
+extern void loadShipTiles(const char *filename, Graphics::ManagedSurface *tiles, int count, int width);
 
 } // namespace Data
 } // namespace Ultima1
diff --git a/engines/ultima/ultima1/views/space_cockpit.cpp b/engines/ultima/ultima1/views/space_cockpit.cpp
index d824eedf351..1225940183f 100644
--- a/engines/ultima/ultima1/views/space_cockpit.cpp
+++ b/engines/ultima/ultima1/views/space_cockpit.cpp
@@ -75,6 +75,12 @@ void SpaceCockpit::draw() {
 			s.setPixel(x, y, STAR_COLOR);
 	}
 
+	// The enemy fighter currently being engaged, if any
+	if (_G(cockpitTargetX) != 0) {
+		const Graphics::ManagedSurface &fighter = _G(map).enemyFighterTiles()[_G(cockpitTargetStage)];
+		s.transBlitFrom(fighter, Common::Point(_G(cockpitTargetX), _G(cockpitTargetY)), 0);
+	}
+
 	// The brief laser-bolt flash from a shot just fired, converging on the
 	// crosshair from both bottom corners of the viewport
 	if (_laserFlashTicks > 0) {


Commit: 77cb3cebb187a843b19f5645882a357734dc9e02
    https://github.com/scummvm/scummvm/commit/77cb3cebb187a843b19f5645882a357734dc9e02
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:41:04+11:00

Commit Message:
ULTIMA: ULTIMA1: Hyperjump display/sound fixes

Changed paths:
    engines/ultima/ultima1/data/space_map.cpp
    engines/ultima/ultima1/data/space_map.h
    engines/ultima/ultima1/logic/space_cockpit_logic.cpp
    engines/ultima/ultima1/logic/space_cockpit_logic.h
    engines/ultima/ultima1/views/space_cockpit.cpp
    engines/ultima/ultima1/views/space_cockpit.h


diff --git a/engines/ultima/ultima1/data/space_map.cpp b/engines/ultima/ultima1/data/space_map.cpp
index b150d6e3813..611b200b8f7 100644
--- a/engines/ultima/ultima1/data/space_map.cpp
+++ b/engines/ultima/ultima1/data/space_map.cpp
@@ -222,12 +222,18 @@ void SpaceMap::setupSector(int x, int y) {
 	// and the checkOverlap* helpers). Not needed for the sector scan
 }
 
+// The short chirp played at the start and end of every starfield frame
+constexpr int SOUND_ENGINE_CHIRP = 9;
+
+SpaceStarfield::SpaceStarfield() : _rnd("ultima1starfield") {
+}
+
 void SpaceStarfield::spawnStar(int index) {
 	// A random quadrant and a random offset magnitude, so the star starts
 	// somewhere near an edge and heads outward
-	int quadrant = g_engine->getRandomNumber(0, 255) / 64;
-	int dx = g_engine->getRandomNumber(2, 255) / 2;
-	int dy = g_engine->getRandomNumber(4, 255) / 4;
+	int quadrant = _rnd.getRandomNumberRng(0, 255) / 64;
+	int dx = _rnd.getRandomNumberRng(2, 255) / 2;
+	int dy = _rnd.getRandomNumberRng(4, 255) / 4;
 
 	if (quadrant == 1 || quadrant == 2)
 		dx = -dx;
@@ -250,11 +256,23 @@ void SpaceStarfield::reset() {
 	_centerY = 0x4f;
 	_panX = _panY = 0;
 
-	for (int i = 0; i < SPACE_STAR_COUNT; ++i)
+	reseed(g_engine->getRandomNumber(0x7FFFFF));
+}
+
+void SpaceStarfield::reseed(uint32 seed) {
+	_rnd.setSeed(seed);
+
+	for (int i = 0; i < SPACE_STAR_COUNT; ++i) {
 		spawnStar(i);
+		_prevX[i] = (int16)(_centerX + 3);
+		_prevY[i] = (int16)(_centerY + 3);
+		_visible[i] = false;
+	}
 }
 
 void SpaceStarfield::advance() {
+	g_engine->playFX(SOUND_ENGINE_CHIRP);
+
 	for (int i = 0; i < SPACE_STAR_COUNT; ++i) {
 		int stepX = _starX[i] / 8;
 		int stepY = _starY[i] / 6;
@@ -268,8 +286,12 @@ void SpaceStarfield::advance() {
 		_starX[i] = (int16)(_starX[i] + stepX);
 		_starY[i] = (int16)(_starY[i] + stepY);
 
-		if (!withinView(_centerX + _starX[i], _centerY + _starY[i]))
+		_visible[i] = withinView(_centerX + _starX[i], _centerY + _starY[i]);
+		if (!_visible[i])
 			spawnStar(i);
+
+		_prevX[i] = (int16)(_centerX + _starX[i]);
+		_prevY[i] = (int16)(_centerY + _starY[i]);
 	}
 
 	// Pan the centre, stopping dead (and dropping the pan) at a viewport edge
@@ -283,6 +305,8 @@ void SpaceStarfield::advance() {
 		_centerY = (int16)(_centerY - _panY);
 		_panY = 0;
 	}
+
+	g_engine->playFX(SOUND_ENGINE_CHIRP);
 }
 
 } // namespace Data
diff --git a/engines/ultima/ultima1/data/space_map.h b/engines/ultima/ultima1/data/space_map.h
index 946f6115c76..c087368cac6 100644
--- a/engines/ultima/ultima1/data/space_map.h
+++ b/engines/ultima/ultima1/data/space_map.h
@@ -23,6 +23,7 @@
 #define ULTIMA1_DATA_SPACE_MAP_H
 
 #include "common/scummsys.h"
+#include "common/random.h"
 #include "common/serializer.h"
 
 namespace Ultima {
@@ -217,11 +218,27 @@ struct SpaceStarfield {
 	int16 _starX[SPACE_STAR_COUNT] = {};
 	int16 _starY[SPACE_STAR_COUNT] = {};
 
+	// Where each star sat on screen after the last advance(), and whether it
+	// was in view rather than just respawned - what the hyperjump needs to
+	// leave trails behind them or erase them again
+	int16 _prevX[SPACE_STAR_COUNT] = {};
+	int16 _prevY[SPACE_STAR_COUNT] = {};
+	bool _visible[SPACE_STAR_COUNT] = {};
+
+	SpaceStarfield();
+
 	/**
 	 * Fresh random stars, centre and pan back to their defaults (setupStars)
 	 */
 	void reset();
 
+	/**
+	 * Replaces every star with new ones rolled from a seed. The same seed
+	 * always gives the same stars, and the same ones replacing them as they
+	 * leave the view, so a run of advance() calls can be replayed exactly
+	 */
+	void reseed(uint32 seed);
+
 	/**
 	 * One frame: every star drifts further from the centre (respawning at
 	 * an edge once it leaves the viewport), then the centre pans by the
@@ -238,6 +255,8 @@ struct SpaceStarfield {
 	}
 
 private:
+	Common::RandomSource _rnd;
+
 	void spawnStar(int index);
 };
 
diff --git a/engines/ultima/ultima1/logic/space_cockpit_logic.cpp b/engines/ultima/ultima1/logic/space_cockpit_logic.cpp
index 3477be3bbe5..f069d621d7e 100644
--- a/engines/ultima/ultima1/logic/space_cockpit_logic.cpp
+++ b/engines/ultima/ultima1/logic/space_cockpit_logic.cpp
@@ -81,6 +81,9 @@ void SpaceCockpitLogic::keypress(Common::KeyCode keycode) {
 }
 
 void SpaceCockpitLogic::tick() {
+	if (_hyperjumping)
+		return;
+
 	// The original advances the starfield every cockpit frame; at 20fps
 	// that's far too fast, so only every 3rd tick
 	if (++_tickCounter < 3)
@@ -288,6 +291,7 @@ bool SpaceCockpitLogic::hyperjump() {
 
 	Views::SpaceCockpit *view = dynamic_cast<Views::SpaceCockpit *>(g_engine->findView("SpaceCockpit"));
 	assert(view);
+	_hyperjumping = true;
 	view->startHyperjump(dx, dy);
 
 	// The animation owns the commands area until it finishes or is
@@ -314,6 +318,7 @@ void SpaceCockpitLogic::hyperjumpLightspeed() {
 }
 
 void SpaceCockpitLogic::completeHyperjump(int dx, int dy) {
+	_hyperjumping = false;
 	subtractFuel(100);
 
 	int newSectorX = (_G(savegame)._sectorX + dx + Data::SPACE_SECTOR_COUNT) % Data::SPACE_SECTOR_COUNT;
@@ -359,6 +364,7 @@ void SpaceCockpitLogic::completeHyperjump(int dx, int dy) {
 }
 
 void SpaceCockpitLogic::abortHyperjump() {
+	_hyperjumping = false;
 	resetLine();
 	writeString("Hyperjump aborted!\n");
 	redrawMap();
diff --git a/engines/ultima/ultima1/logic/space_cockpit_logic.h b/engines/ultima/ultima1/logic/space_cockpit_logic.h
index 43dabf58a92..57965f78b41 100644
--- a/engines/ultima/ultima1/logic/space_cockpit_logic.h
+++ b/engines/ultima/ultima1/logic/space_cockpit_logic.h
@@ -40,6 +40,10 @@ private:
 	// it doesn't streak by too fast
 	int _tickCounter = 0;
 
+	// True while the SpaceCockpit view is animating a hyperjump, which
+	// then drives the starfield itself
+	bool _hyperjumping = false;
+
 	/**
 	 * Sets the flight speed (1-8), spending 4 fuel per step of change
 	 * (setSpeed) - the number keys
diff --git a/engines/ultima/ultima1/views/space_cockpit.cpp b/engines/ultima/ultima1/views/space_cockpit.cpp
index 1225940183f..cf3c47399c3 100644
--- a/engines/ultima/ultima1/views/space_cockpit.cpp
+++ b/engines/ultima/ultima1/views/space_cockpit.cpp
@@ -50,6 +50,10 @@ bool SpaceCockpit::msgFocus(const FocusMessage &msg) {
 
 bool SpaceCockpit::msgUnfocus(const UnfocusMessage &msg) {
 	MetaEngine::setKeybindingMode(KBMODE_MINIMAL);
+
+	_hyperjumpState = HYPERJUMP_IDLE;
+	_trails.free();
+
 	return Map::msgUnfocus(msg);
 }
 
@@ -67,12 +71,17 @@ void SpaceCockpit::draw() {
 	s.drawLine(sf._centerX - 2, sf._centerY, sf._centerX + 2, sf._centerY, STAR_COLOR);
 	s.drawLine(sf._centerX, sf._centerY - 2, sf._centerX, sf._centerY + 2, STAR_COLOR);
 
-	// The warp stars
-	for (int i = 0; i < Data::SPACE_STAR_COUNT; ++i) {
-		int x = sf._centerX + sf._starX[i];
-		int y = sf._centerY + sf._starY[i];
-		if (Data::SpaceStarfield::withinView(x, y))
-			s.setPixel(x, y, STAR_COLOR);
+	if (_hyperjumpState == HYPERJUMP_WARP_IN || _hyperjumpState == HYPERJUMP_WARP_OUT) {
+		// The stars along with all the trails behind them
+		s.transBlitFrom(_trails, Common::Point(0, 0), 0);
+	} else {
+		// The warp stars
+		for (int i = 0; i < Data::SPACE_STAR_COUNT; ++i) {
+			int x = sf._centerX + sf._starX[i];
+			int y = sf._centerY + sf._starY[i];
+			if (Data::SpaceStarfield::withinView(x, y))
+				s.setPixel(x, y, STAR_COLOR);
+		}
 	}
 
 	// The enemy fighter currently being engaged, if any
@@ -94,6 +103,10 @@ void SpaceCockpit::draw() {
 }
 
 bool SpaceCockpit::msgMouseMove(const MouseMoveMessage &msg) {
+	// The warp's stars are measured from the centre, so leave it where it is
+	if (_hyperjumpState != HYPERJUMP_IDLE)
+		return true;
+
 	Data::SpaceStarfield &sf = _G(starfield);
 	sf._panX = 0;
 	sf._panY = 0;
@@ -104,7 +117,8 @@ bool SpaceCockpit::msgMouseMove(const MouseMoveMessage &msg) {
 }
 
 bool SpaceCockpit::msgMouseDown(const MouseDownMessage &msg) {
-	_G(logic)->action(KEYBIND_FIRE);
+	if (!cancelHyperjump())
+		_G(logic)->action(KEYBIND_FIRE);
 	return true;
 }
 
@@ -120,66 +134,168 @@ void SpaceCockpit::alienFireFlash(int x1, int y1, int x2, int y2) {
 	redraw();
 }
 
-// Ticks per +/-1 step while ramping the display speed up/down
-constexpr int HYPERJUMP_SPEED_STEP_TICKS = 2;
-// How long (in ticks) to hold at full warp, streaking the starfield
-constexpr int HYPERJUMP_WARP_TICKS = 30;
-// Extra starfield advances per tick while at full warp, on top of the
-// normal per-frame one - this is the "speeded up" part of the animation
-constexpr int HYPERJUMP_WARP_ADVANCES = 5;
+constexpr int HYPERJUMP_MAX_SPEED = 8;
+
+// Frames cruised at each speed, depending on whether the ship started out
+// slow or fast
+constexpr int HYPERJUMP_SLOW_LEVEL_FRAMES = 11;
+constexpr int HYPERJUMP_FAST_LEVEL_FRAMES = 16;
+constexpr int HYPERJUMP_FAST_SPEED = 4;
+
+// Frames of each half of the warp: the first leaves the trails, the second
+// erases them again
+constexpr int HYPERJUMP_WARP_IN_FRAMES = 201;
+constexpr int HYPERJUMP_WARP_OUT_FRAMES = 200;
+
+// Vertical retraces a cruise frame waits for at each speed, so frames come
+// faster as the ship does. Ticks are 20 a second against 60 retraces
+constexpr int HYPERJUMP_FRAME_DELAY[HYPERJUMP_MAX_SPEED + 1] = { 0, 8, 7, 6, 5, 4, 3, 2, 1 };
+constexpr int HYPERJUMP_VBLANKS_PER_TICK = 3;
+
+// The warp itself runs flat out in the original, so this is chosen to take a
+// few seconds
+constexpr int HYPERJUMP_WARP_FRAMES_PER_TICK = 4;
 
 void SpaceCockpit::startHyperjump(int dx, int dy) {
-	_hyperjumpState = HYPERJUMP_RAMP_UP;
-	_hyperjumpTicks = 0;
+	_hyperjumpState = HYPERJUMP_ACCELERATE;
 	_hyperjumpDX = dx;
 	_hyperjumpDY = dy;
 	_hyperjumpOrigSpeed = _G(cockpitSpeed);
+	_hyperjumpLevelFrames = (_hyperjumpOrigSpeed < HYPERJUMP_FAST_SPEED) ?
+		HYPERJUMP_SLOW_LEVEL_FRAMES : HYPERJUMP_FAST_LEVEL_FRAMES;
+	_hyperjumpFrames = _hyperjumpLevelFrames;
+	_hyperjumpBudget = 0;
 
 	// Stop any manual steering - the animation takes over the view
 	_G(starfield)._panX = 0;
 	_G(starfield)._panY = 0;
 }
 
-void SpaceCockpit::tickHyperjump() {
-	++_hyperjumpTicks;
+void SpaceCockpit::startWarp() {
+	// The ship has stopped, as far as the stars are concerned
+	_G(cockpitSpeed) = 0;
+
+	_trails.create(320, 200, Graphics::PixelFormat::createFormatCLUT8());
+	_trails.clear(0);
+
+	auto *logic = dynamic_cast<Logic::SpaceCockpitLogic *>(_G(logic).get());
+	if (logic)
+		logic->hyperjumpLightspeed();
+
+	_hyperjumpSeed = g_engine->getRandomNumber(0x7FFFFF);
+	_G(starfield).reseed(_hyperjumpSeed);
+	_hyperjumpState = HYPERJUMP_WARP_IN;
+	_hyperjumpFrames = HYPERJUMP_WARP_IN_FRAMES;
+}
+
+void SpaceCockpit::plotTrail(int x, int y, int color) {
+	if (x >= 0 && x < _trails.w && y >= 0 && y < _trails.h)
+		*(byte *)_trails.getBasePtr(x, y) = (byte)color;
+}
+
+void SpaceCockpit::finishHyperjump() {
+	_hyperjumpState = HYPERJUMP_IDLE;
+	_G(cockpitSpeed) = _hyperjumpOrigSpeed;
+
+	auto *logic = dynamic_cast<Logic::SpaceCockpitLogic *>(_G(logic).get());
+	if (logic)
+		logic->completeHyperjump(_hyperjumpDX, _hyperjumpDY);
+}
+
+void SpaceCockpit::hyperjumpFrame() {
+	Data::SpaceStarfield &sf = _G(starfield);
 
 	switch (_hyperjumpState) {
-	case HYPERJUMP_RAMP_UP:
-		if (_hyperjumpTicks % HYPERJUMP_SPEED_STEP_TICKS == 0 && _G(cockpitSpeed) < 8)
-			++_G(cockpitSpeed);
-		if (_G(cockpitSpeed) >= 8) {
-			_hyperjumpState = HYPERJUMP_WARP;
-			_hyperjumpTicks = 0;
-
-			auto *logic = dynamic_cast<Logic::SpaceCockpitLogic *>(_G(logic).get());
-			if (logic)
-				logic->hyperjumpLightspeed();
+	case HYPERJUMP_ACCELERATE:
+		sf.advance();
+
+		if (--_hyperjumpFrames == 0) {
+			if (_G(cockpitSpeed) < HYPERJUMP_MAX_SPEED) {
+				++_G(cockpitSpeed);
+				_hyperjumpFrames = _hyperjumpLevelFrames;
+			} else {
+				startWarp();
+			}
 		}
 		break;
 
-	case HYPERJUMP_WARP:
-		for (int i = 0; i < HYPERJUMP_WARP_ADVANCES; ++i)
-			_G(starfield).advance();
-		if (_hyperjumpTicks >= HYPERJUMP_WARP_TICKS) {
-			_hyperjumpState = HYPERJUMP_RAMP_DOWN;
-			_hyperjumpTicks = 0;
+	case HYPERJUMP_WARP_IN:
+		// Nothing is erased, so every star leaves its whole path behind it
+		sf.advance();
+		for (int i = 0; i < Data::SPACE_STAR_COUNT; ++i) {
+			if (sf._visible[i])
+				plotTrail(sf._prevX[i], sf._prevY[i], STAR_COLOR);
+		}
+
+		if (--_hyperjumpFrames == 0) {
+			// Replaying the same stars, each wipes out the pixels it left
+			sf.reseed(_hyperjumpSeed);
+			_hyperjumpState = HYPERJUMP_WARP_OUT;
+			_hyperjumpFrames = HYPERJUMP_WARP_OUT_FRAMES;
 		}
 		break;
 
-	case HYPERJUMP_RAMP_DOWN:
-		if (_hyperjumpTicks % HYPERJUMP_SPEED_STEP_TICKS == 0 && _G(cockpitSpeed) > _hyperjumpOrigSpeed)
-			--_G(cockpitSpeed);
-		if (_G(cockpitSpeed) <= _hyperjumpOrigSpeed) {
-			_hyperjumpState = HYPERJUMP_IDLE;
-			auto *logic = dynamic_cast<Logic::SpaceCockpitLogic *>(_G(logic).get());
-			if (logic)
-				logic->completeHyperjump(_hyperjumpDX, _hyperjumpDY);
+	case HYPERJUMP_WARP_OUT:
+		for (int i = 0; i < Data::SPACE_STAR_COUNT; ++i) {
+			if (Data::SpaceStarfield::withinView(sf._prevX[i], sf._prevY[i]))
+				plotTrail(sf._prevX[i], sf._prevY[i], 0);
+		}
+
+		sf.advance();
+		for (int i = 0; i < Data::SPACE_STAR_COUNT; ++i) {
+			if (sf._visible[i])
+				plotTrail(sf._prevX[i], sf._prevY[i], STAR_COLOR);
+		}
+
+		if (--_hyperjumpFrames == 0) {
+			_trails.free();
+			_hyperjumpBudget = 0;
+
+			if (_hyperjumpOrigSpeed < HYPERJUMP_MAX_SPEED) {
+				_G(cockpitSpeed) = HYPERJUMP_MAX_SPEED;
+				_hyperjumpState = HYPERJUMP_DECELERATE;
+				_hyperjumpFrames = _hyperjumpLevelFrames;
+			} else {
+				finishHyperjump();
+			}
+		}
+		break;
+
+	case HYPERJUMP_DECELERATE:
+		sf.advance();
+
+		if (--_hyperjumpFrames == 0) {
+			if (_G(cockpitSpeed) - 1 > _hyperjumpOrigSpeed) {
+				--_G(cockpitSpeed);
+				_hyperjumpFrames = _hyperjumpLevelFrames;
+			} else {
+				finishHyperjump();
+			}
 		}
 		break;
 
 	default:
 		break;
 	}
+}
+
+void SpaceCockpit::tickHyperjump() {
+	_hyperjumpBudget += HYPERJUMP_VBLANKS_PER_TICK;
+	int warpFrames = HYPERJUMP_WARP_FRAMES_PER_TICK;
+
+	while (_hyperjumpState != HYPERJUMP_IDLE) {
+		if (_hyperjumpState == HYPERJUMP_WARP_IN || _hyperjumpState == HYPERJUMP_WARP_OUT) {
+			if (warpFrames-- == 0)
+				break;
+		} else {
+			int delay = HYPERJUMP_FRAME_DELAY[_G(cockpitSpeed)];
+			if (delay > _hyperjumpBudget)
+				break;
+			_hyperjumpBudget -= delay;
+		}
+
+		hyperjumpFrame();
+	}
 
 	redraw();
 }
@@ -196,31 +312,26 @@ bool SpaceCockpit::tick() {
 	return Map::tick();
 }
 
-static void abortHyperjumpAndNotify(int origSpeed) {
-	_G(cockpitSpeed) = origSpeed;
+bool SpaceCockpit::cancelHyperjump() {
+	if (_hyperjumpState == HYPERJUMP_IDLE)
+		return false;
+
+	_hyperjumpState = HYPERJUMP_IDLE;
+	_trails.free();
+	_G(cockpitSpeed) = _hyperjumpOrigSpeed;
+
 	auto *logic = dynamic_cast<Logic::SpaceCockpitLogic *>(_G(logic).get());
 	if (logic)
 		logic->abortHyperjump();
+	return true;
 }
 
 bool SpaceCockpit::msgAction(const ActionMessage &msg) {
-	if (_hyperjumpState != HYPERJUMP_IDLE) {
-		_hyperjumpState = HYPERJUMP_IDLE;
-		abortHyperjumpAndNotify(_hyperjumpOrigSpeed);
-		return true;
-	}
-
-	return Map::msgAction(msg);
+	return cancelHyperjump() || Map::msgAction(msg);
 }
 
 bool SpaceCockpit::msgKeypress(const KeypressMessage &msg) {
-	if (_hyperjumpState != HYPERJUMP_IDLE) {
-		_hyperjumpState = HYPERJUMP_IDLE;
-		abortHyperjumpAndNotify(_hyperjumpOrigSpeed);
-		return true;
-	}
-
-	return Map::msgKeypress(msg);
+	return cancelHyperjump() || Map::msgKeypress(msg);
 }
 
 void SpaceCockpit::drawCockpitFrame(Graphics::Views::GfxSurface &s) {
diff --git a/engines/ultima/ultima1/views/space_cockpit.h b/engines/ultima/ultima1/views/space_cockpit.h
index 8edfa71aeff..36270dc4800 100644
--- a/engines/ultima/ultima1/views/space_cockpit.h
+++ b/engines/ultima/ultima1/views/space_cockpit.h
@@ -42,15 +42,22 @@ class SpaceCockpit : public Map {
 private:
 	enum HyperjumpState {
 		HYPERJUMP_IDLE,
-		HYPERJUMP_RAMP_UP,
-		HYPERJUMP_WARP,
-		HYPERJUMP_RAMP_DOWN
+		HYPERJUMP_ACCELERATE,	// Cruising at each speed up to the maximum
+		HYPERJUMP_WARP_IN,		// Stars streak outward, leaving their trails behind them
+		HYPERJUMP_WARP_OUT,		// The same stars replayed, erasing the trails again
+		HYPERJUMP_DECELERATE	// Cruising back down to the original speed
 	};
 
 	HyperjumpState _hyperjumpState = HYPERJUMP_IDLE;
-	int _hyperjumpTicks = 0;
 	int _hyperjumpDX = 0, _hyperjumpDY = 0;
 	int _hyperjumpOrigSpeed = 0;
+	int _hyperjumpLevelFrames = 0;		// Frames cruised at each speed
+	int _hyperjumpFrames = 0;			// Frames left in the current speed or warp phase
+	int _hyperjumpBudget = 0;			// Vertical retraces left to spend on cruise frames
+	uint32 _hyperjumpSeed = 0;
+
+	// The pixels the stars have left behind during the warp
+	Graphics::ManagedSurface _trails;
 
 	// Ticks left to keep showing the laser-bolt flash from fireLaser() (0 =
 	// not showing)
@@ -67,13 +74,40 @@ private:
 	void drawCockpitFrame(Graphics::Views::GfxSurface &s);
 
 	/**
-	 * Advances whichever phase of the hyperjump animation is running -
-	 * ramping the display speed up to 8, streaking the starfield hard for
-	 * a bit, then ramping back down to the original speed and handing off
-	 * to SpaceCockpitLogic::completeHyperjump()
+	 * Runs however many frames of the hyperjump animation are due: cruising
+	 * up through the speeds, then a warp that stops erasing the stars so
+	 * they fill the screen with trails, replayed to wipe them away again,
+	 * then cruising back down and handing off to
+	 * SpaceCockpitLogic::completeHyperjump()
 	 */
 	void tickHyperjump();
 
+	/**
+	 * Runs a single frame of whichever phase is under way
+	 */
+	void hyperjumpFrame();
+
+	/**
+	 * Starts the warp once the ship has reached full speed
+	 */
+	void startWarp();
+
+	/**
+	 * Ends the hyperjump animation, and carries on with the jump
+	 */
+	void finishHyperjump();
+
+	/**
+	 * Marks a pixel of the warp trails, or erases it with color 0
+	 */
+	void plotTrail(int x, int y, int color);
+
+	/**
+	 * Stops a hyperjump in progress, if there is one
+	 * @returns		True if there was one
+	 */
+	bool cancelHyperjump();
+
 public:
 	SpaceCockpit() : Map("SpaceCockpit") {}
 	~SpaceCockpit() override {}


Commit: 0f8d747986dbc953180943e0ce714d795c72d59f
    https://github.com/scummvm/scummvm/commit/0f8d747986dbc953180943e0ce714d795c72d59f
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:41:04+11:00

Commit Message:
ULTIMA: ULTIMA1: Tie flight frame rate to speed

Changed paths:
    engines/ultima/ultima1/data/space_map.cpp
    engines/ultima/ultima1/data/space_map.h
    engines/ultima/ultima1/logic/space_cockpit_logic.cpp
    engines/ultima/ultima1/logic/space_cockpit_logic.h
    engines/ultima/ultima1/views/space_cockpit.cpp


diff --git a/engines/ultima/ultima1/data/space_map.cpp b/engines/ultima/ultima1/data/space_map.cpp
index 611b200b8f7..657e57490a2 100644
--- a/engines/ultima/ultima1/data/space_map.cpp
+++ b/engines/ultima/ultima1/data/space_map.cpp
@@ -29,6 +29,8 @@ namespace Data {
 
 const char *SPACE_COCKPIT_DIRECTION_NAMES[5] = { nullptr, "Left", "Right", "Climb", "Dive" };
 
+const int SPACE_COCKPIT_FRAME_DELAY[SPACE_COCKPIT_MAX_SPEED + 1] = { 0, 8, 7, 6, 5, 4, 3, 2, 1 };
+
 const int16 SPACE_FACING_DX[4] = { -1, 1, 0, 0 };
 const int16 SPACE_FACING_DY[4] = { 0, 0, -1, 1 };
 
diff --git a/engines/ultima/ultima1/data/space_map.h b/engines/ultima/ultima1/data/space_map.h
index c087368cac6..4ca97d9dd59 100644
--- a/engines/ultima/ultima1/data/space_map.h
+++ b/engines/ultima/ultima1/data/space_map.h
@@ -200,6 +200,13 @@ public:
 	void synchronize(Common::Serializer &s);
 };
 
+// The highest cockpit flight speed, and how many screen refreshes (60 a
+// second) a cockpit frame waits for at each speed - so frames come faster as
+// the ship does. The engine ticks 20 times a second, 3 refreshes each
+constexpr int SPACE_COCKPIT_MAX_SPEED = 8;
+constexpr int SPACE_COCKPIT_VBLANKS_PER_TICK = 3;
+extern const int SPACE_COCKPIT_FRAME_DELAY[SPACE_COCKPIT_MAX_SPEED + 1];
+
 // The cockpit view's warp starfield holds this many stars
 constexpr int SPACE_STAR_COUNT = 40;
 
diff --git a/engines/ultima/ultima1/logic/space_cockpit_logic.cpp b/engines/ultima/ultima1/logic/space_cockpit_logic.cpp
index f069d621d7e..b185f18b8d3 100644
--- a/engines/ultima/ultima1/logic/space_cockpit_logic.cpp
+++ b/engines/ultima/ultima1/logic/space_cockpit_logic.cpp
@@ -84,15 +84,25 @@ void SpaceCockpitLogic::tick() {
 	if (_hyperjumping)
 		return;
 
-	// The original advances the starfield every cockpit frame; at 20fps
-	// that's far too fast, so only every 3rd tick
-	if (++_tickCounter < 3)
-		return;
-	_tickCounter = 0;
+	// Each frame waits a number of screen refreshes that shrinks with speed
+	int delay = Data::SPACE_COCKPIT_FRAME_DELAY[CLIP<int>(_G(cockpitSpeed), 0, Data::SPACE_COCKPIT_MAX_SPEED)];
+	_frameBudget += Data::SPACE_COCKPIT_VBLANKS_PER_TICK;
+
+	int frames = 1;
+	if (delay) {
+		frames = _frameBudget / delay;
+		_frameBudget %= delay;
+	} else {
+		_frameBudget = 0;
+	}
 
-	_G(starfield).advance();
-	tickEncounter();
-	redrawMap();
+	for (int i = 0; i < frames; ++i) {
+		_G(starfield).advance();
+		tickEncounter();
+	}
+
+	if (frames)
+		redrawMap();
 }
 
 void SpaceCockpitLogic::tickEncounter() {
diff --git a/engines/ultima/ultima1/logic/space_cockpit_logic.h b/engines/ultima/ultima1/logic/space_cockpit_logic.h
index 57965f78b41..8845416a3f2 100644
--- a/engines/ultima/ultima1/logic/space_cockpit_logic.h
+++ b/engines/ultima/ultima1/logic/space_cockpit_logic.h
@@ -36,9 +36,9 @@ namespace Logic {
  */
 class SpaceCockpitLogic : public SpaceLogic {
 private:
-	// tick() fires ~20/sec; only advance the starfield every few calls so
-	// it doesn't streak by too fast
-	int _tickCounter = 0;
+	// Screen refreshes carried over towards the next cockpit frame - ticks
+	// come faster than the frames, which wait longer at lower speeds
+	int _frameBudget = 0;
 
 	// True while the SpaceCockpit view is animating a hyperjump, which
 	// then drives the starfield itself
diff --git a/engines/ultima/ultima1/views/space_cockpit.cpp b/engines/ultima/ultima1/views/space_cockpit.cpp
index cf3c47399c3..5fcf385df20 100644
--- a/engines/ultima/ultima1/views/space_cockpit.cpp
+++ b/engines/ultima/ultima1/views/space_cockpit.cpp
@@ -134,7 +134,7 @@ void SpaceCockpit::alienFireFlash(int x1, int y1, int x2, int y2) {
 	redraw();
 }
 
-constexpr int HYPERJUMP_MAX_SPEED = 8;
+constexpr int HYPERJUMP_MAX_SPEED = Data::SPACE_COCKPIT_MAX_SPEED;
 
 // Frames cruised at each speed, depending on whether the ship started out
 // slow or fast
@@ -147,11 +147,6 @@ constexpr int HYPERJUMP_FAST_SPEED = 4;
 constexpr int HYPERJUMP_WARP_IN_FRAMES = 201;
 constexpr int HYPERJUMP_WARP_OUT_FRAMES = 200;
 
-// Vertical retraces a cruise frame waits for at each speed, so frames come
-// faster as the ship does. Ticks are 20 a second against 60 retraces
-constexpr int HYPERJUMP_FRAME_DELAY[HYPERJUMP_MAX_SPEED + 1] = { 0, 8, 7, 6, 5, 4, 3, 2, 1 };
-constexpr int HYPERJUMP_VBLANKS_PER_TICK = 3;
-
 // The warp itself runs flat out in the original, so this is chosen to take a
 // few seconds
 constexpr int HYPERJUMP_WARP_FRAMES_PER_TICK = 4;
@@ -280,7 +275,7 @@ void SpaceCockpit::hyperjumpFrame() {
 }
 
 void SpaceCockpit::tickHyperjump() {
-	_hyperjumpBudget += HYPERJUMP_VBLANKS_PER_TICK;
+	_hyperjumpBudget += Data::SPACE_COCKPIT_VBLANKS_PER_TICK;
 	int warpFrames = HYPERJUMP_WARP_FRAMES_PER_TICK;
 
 	while (_hyperjumpState != HYPERJUMP_IDLE) {
@@ -288,7 +283,7 @@ void SpaceCockpit::tickHyperjump() {
 			if (warpFrames-- == 0)
 				break;
 		} else {
-			int delay = HYPERJUMP_FRAME_DELAY[_G(cockpitSpeed)];
+			int delay = Data::SPACE_COCKPIT_FRAME_DELAY[_G(cockpitSpeed)];
 			if (delay > _hyperjumpBudget)
 				break;
 			_hyperjumpBudget -= delay;


Commit: 535d0eb60582b0a0975798f2ec34630e22a444a9
    https://github.com/scummvm/scummvm/commit/535d0eb60582b0a0975798f2ec34630e22a444a9
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:41:04+11:00

Commit Message:
ULTIMA: ULTIMA1: Adding graphics mode engine option

Changed paths:
  A engines/ultima/ultima1/data/render_mode.cpp
  A engines/ultima/ultima1/data/render_mode.h
    engines/ultima/metaengine.cpp
    engines/ultima/module.mk
    engines/ultima/ultima1/data/map.cpp
    engines/ultima/ultima1/data/map.h
    engines/ultima/ultima1/data/tiles.cpp
    engines/ultima/ultima1/data/tiles.h
    engines/ultima/ultima1/gfx/font.cpp
    engines/ultima/ultima1/gfx/pic_decoder.cpp
    engines/ultima/ultima1/gfx/pic_decoder.h
    engines/ultima/ultima1/gfx/text_cursor.cpp
    engines/ultima/ultima1/ultima1.cpp
    engines/ultima/ultima1/ultima1.h
    engines/ultima/ultima1/views/commands.cpp
    engines/ultima/ultima1/views/create_character.cpp
    engines/ultima/ultima1/views/dialog.cpp
    engines/ultima/ultima1/views/dungeon_map.cpp
    engines/ultima/ultima1/views/full_screen_dialog.cpp
    engines/ultima/ultima1/views/game.cpp
    engines/ultima/ultima1/views/interactions/dead.cpp
    engines/ultima/ultima1/views/interactions/drop.cpp
    engines/ultima/ultima1/views/interactions/entering_craft.cpp
    engines/ultima/ultima1/views/interactions/lose.cpp
    engines/ultima/ultima1/views/interactions/merchant.cpp
    engines/ultima/ultima1/views/interactions/pillar.cpp
    engines/ultima/ultima1/views/interactions/ready.cpp
    engines/ultima/ultima1/views/interactions/sector_scan.cpp
    engines/ultima/ultima1/views/interactions/win.cpp
    engines/ultima/ultima1/views/main_menu.cpp
    engines/ultima/ultima1/views/space_cockpit.cpp
    engines/ultima/ultima1/views/space_game.cpp
    engines/ultima/ultima1/views/space_map.cpp
    engines/ultima/ultima1/views/space_stats.cpp
    engines/ultima/ultima1/views/stats.cpp
    engines/ultima/ultima1/views/title.cpp
    engines/ultima/ultima1/views/title.h
    engines/ultima/ultima1/views/zstats.cpp


diff --git a/engines/ultima/metaengine.cpp b/engines/ultima/metaengine.cpp
index 5147ac8b2f7..6c630ae3980 100644
--- a/engines/ultima/metaengine.cpp
+++ b/engines/ultima/metaengine.cpp
@@ -275,6 +275,13 @@ const ADExtraGuiOptionsMap *UltimaMetaEngine::getAdvancedExtraGuiOptions() const
 
 GUI::OptionsContainerWidget *UltimaMetaEngine::buildEngineOptionsWidget(GUI::GuiObject *boss,
 		const Common::String &name, const Common::String &target) const {
+#ifdef ENABLE_ULTIMA1
+	if (getGameId(target) == "ultima1") {
+		return new Ultima::Shared::GraphicsOptionsWidget(boss, name, target,
+			Ultima::Ultima1::Data::RENDER_MODE_LABELS, Ultima::Ultima1::Data::RENDER_MODE_COUNT,
+			ExtraGuiOptions(), false, Ultima::Ultima1::Data::RENDER_EGA);
+	}
+#endif
 #ifdef ENABLE_ULTIMA2
 	if (getGameId(target) == "ultima2" || getGameId(target) == "ultima2_enh") {
 		// The enhanced version starts off using the best of the graphics
diff --git a/engines/ultima/module.mk b/engines/ultima/module.mk
index a12aa5c18c4..fa575ca1bc0 100644
--- a/engines/ultima/module.mk
+++ b/engines/ultima/module.mk
@@ -55,6 +55,7 @@ MODULE_OBJS += \
 	ultima1/data/entity.o \
 	ultima1/data/map.o \
 	ultima1/data/map_dungeon.o \
+	ultima1/data/render_mode.o \
 	ultima1/data/savegame.o \
 	ultima1/data/space_map.o \
 	ultima1/data/tiles.o \
diff --git a/engines/ultima/ultima1/data/map.cpp b/engines/ultima/ultima1/data/map.cpp
index 16a2089679b..e7fb0507b08 100644
--- a/engines/ultima/ultima1/data/map.cpp
+++ b/engines/ultima/ultima1/data/map.cpp
@@ -151,17 +151,24 @@ void Map::init() {
 	// Copy the Mondain map
 	resetMondainMap();
 
-	// Load tiles
-	loadTiles("egatiles.bin", _overworldTiles, OVERWORLD_TILES_COUNT, 16);
-	loadTiles("egatown.bin", _cityTiles, CITY_TILES_COUNT, 8);
+	loadGraphics();
+}
+
+void Map::loadGraphics() {
+	const bool cga = _G(renderMode) == RENDER_CGA;
+
+	loadTiles(cga ? "cgatiles.bin" : "egatiles.bin", _overworldTiles, OVERWORLD_TILES_COUNT, 16, cga);
+	loadTiles(cga ? "cgatown.bin" : "egatown.bin", _cityTiles, CITY_TILES_COUNT, 8, cga);
 
-	// Tile 0 is a blank empty floor tile, followed by 19 tiles, and tile 20 is duplicated from egatiles.bin
+	// Tile 0 is a blank empty floor tile, followed by 19 tiles, and tile 20 is duplicated from the overworld tiles
 	_mondainTiles[0].create(16, 16, Graphics::PixelFormat::createFormatCLUT8());
-	loadTiles("egamond.bin", &_mondainTiles[1], MONDAIN_TILES_COUNT, 16);
+	loadTiles(cga ? "cgamond.bin" : "egamond.bin", &_mondainTiles[1], MONDAIN_TILES_COUNT, 16, cga);
 	_mondainTiles[20] = _overworldTiles[TILE_PLAYER];
 
-	loadShipTiles("egaspace.bin", _spaceShipTiles, SPACE_SHIP_TILES_COUNT, SPACE_SHIP_TILE_WIDTH);
-	loadShipTiles("egafight.bin", _enemyFighterTiles, SPACE_ENEMY_TILES_COUNT, SPACE_ENEMY_TILE_WIDTH);
+	loadShipTiles(cga ? "cgaspace.bin" : "egaspace.bin", _spaceShipTiles, SPACE_SHIP_TILES_COUNT,
+		SPACE_SHIP_TILE_WIDTH, cga);
+	loadShipTiles(cga ? "cgafight.bin" : "egafight.bin", _enemyFighterTiles, SPACE_ENEMY_TILES_COUNT,
+		SPACE_ENEMY_TILE_WIDTH, cga);
 }
 
 void Map::resetMondainMap() {
diff --git a/engines/ultima/ultima1/data/map.h b/engines/ultima/ultima1/data/map.h
index 5624cf27bb2..e9954dc5911 100644
--- a/engines/ultima/ultima1/data/map.h
+++ b/engines/ultima/ultima1/data/map.h
@@ -144,6 +144,11 @@ public:
 	 */
 	void init();
 
+	/**
+	 * Loads the tile graphics for the current graphics mode
+	 */
+	void loadGraphics();
+
 	/**
 	 * Loads a specified map.
 	 * @param mapNum
diff --git a/engines/ultima/ultima1/data/render_mode.cpp b/engines/ultima/ultima1/data/render_mode.cpp
new file mode 100644
index 00000000000..f882aece1b8
--- /dev/null
+++ b/engines/ultima/ultima1/data/render_mode.cpp
@@ -0,0 +1,95 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "common/system.h"
+#include "common/translation.h"
+#include "graphics/palette.h"
+#include "graphics/paletteman.h"
+#include "ultima/ultima1/data/render_mode.h"
+
+namespace Ultima {
+namespace Ultima1 {
+namespace Data {
+
+const char *const RENDER_MODE_LABELS[RENDER_MODE_COUNT] = {
+	_s("CGA (4 colors)"), _s("EGA / Tandy (16 colors)")
+};
+
+// CGA's palette 1 at low intensity, as the original sets it up
+static const byte CGA_PALETTE[4 * 3] = {
+	0x00, 0x00, 0x00, // 0: black
+	0x00, 0xaa, 0xaa, // 1: cyan
+	0xaa, 0x00, 0xaa, // 2: magenta
+	0xaa, 0xaa, 0xaa  // 3: white
+};
+
+void RenderColors::set(RenderMode mode) {
+	if (mode == RENDER_CGA) {
+		_edge = 3;
+		_border = 2;
+		_text = 3;
+		_highlight = 1;
+		_shuttle = _border;
+
+		_cockpitFrame = _edge;
+		_star1 = _border;
+		_star2 = _edge;
+		_stationHighlight = _highlight;
+		_stationBorder = _border;
+		_stationEdge = _edge;
+		_flag1 = 1;
+		_flag2 = 2;
+	} else {
+		_edge = 15;
+		_border = 1;
+		_text = 11;
+		_highlight = 12;
+		_shuttle = _highlight;
+
+		_cockpitFrame = 7;
+		_star1 = 12;
+		_star2 = 14;
+		_stationHighlight = 1;
+		_stationBorder = 10;
+		_stationEdge = 7;
+		_flag1 = 11;
+		_flag2 = 10;
+	}
+}
+
+void setPalette(RenderMode mode) {
+	if (mode == RENDER_EGA) {
+		g_system->getPaletteManager()->setPalette(Graphics::Palette::createEGAPalette());
+		return;
+	}
+
+	// Only the first four colors are ever used, so show any others as white
+	Graphics::Palette palette(256);
+	for (int i = 0; i < 256; ++i)
+		palette.set(&CGA_PALETTE[3 * 3], i, 1);
+	palette.set(CGA_PALETTE, 0, 4);
+
+	g_system->getPaletteManager()->setPalette(palette);
+}
+
+} // namespace Data
+} // namespace Ultima1
+} // namespace Ultima
diff --git a/engines/ultima/ultima1/data/render_mode.h b/engines/ultima/ultima1/data/render_mode.h
new file mode 100644
index 00000000000..af7bea334c3
--- /dev/null
+++ b/engines/ultima/ultima1/data/render_mode.h
@@ -0,0 +1,79 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef ULTIMA1_DATA_RENDER_MODE_H
+#define ULTIMA1_DATA_RENDER_MODE_H
+
+#include "common/scummsys.h"
+
+namespace Ultima {
+namespace Ultima1 {
+namespace Data {
+
+/**
+ * The graphics the game can be shown with. The original also had a mode for
+ * the Tandy 1000, but it draws the very same pictures as EGA, only stored
+ * differently, so there's nothing to choose between them
+ */
+enum RenderMode {
+	RENDER_CGA = 0,		// 4 colors
+	RENDER_EGA = 1,		// 16 colors
+	RENDER_MODE_COUNT = 2
+};
+
+// Descriptions of the modes for the launcher's graphics mode drop-down, in
+// the same order. Marked for translation, but not translated
+extern const char *const RENDER_MODE_LABELS[RENDER_MODE_COUNT];
+
+/**
+ * The palette indices the game draws things with, which differ between the
+ * modes since CGA only has four colors to share between everything
+ */
+struct RenderColors {
+	byte _edge = 15;			// White lines and the most common highlight
+	byte _border = 1;			// Frames around the screens
+	byte _text = 11;			// Text and values
+	byte _highlight = 12;		// Warnings, laser fire and other emphasis
+	byte _shuttle = 12;			// The body of a ship's exhaust trail
+
+	// Colors the original chooses a different way for CGA, rather than
+	// by their role in the game
+	byte _cockpitFrame = 7;
+	byte _star1 = 12, _star2 = 14;
+	byte _stationHighlight = 1, _stationBorder = 10, _stationEdge = 7;
+	byte _flag1 = 11, _flag2 = 10;		// The two colors of the flags over the castle
+
+	/**
+	 * Sets the colors to use for a mode
+	 */
+	void set(RenderMode mode);
+};
+
+/**
+ * Sets the screen palette for a mode
+ */
+void setPalette(RenderMode mode);
+
+} // namespace Data
+} // namespace Ultima1
+} // namespace Ultima
+
+#endif
diff --git a/engines/ultima/ultima1/data/tiles.cpp b/engines/ultima/ultima1/data/tiles.cpp
index 22543a02b07..b31cac718d0 100644
--- a/engines/ultima/ultima1/data/tiles.cpp
+++ b/engines/ultima/ultima1/data/tiles.cpp
@@ -26,8 +26,9 @@ namespace Ultima {
 namespace Ultima1 {
 namespace Data {
 
-void loadTiles(const char *filename, Graphics::ManagedSurface *tiles, int count, int tileSize) {
-	const int BYTES_PER_ROW = tileSize / 2;		// 4 planes, so 2 pixels per byte
+void loadTiles(const char *filename, Graphics::ManagedSurface *tiles, int count, int tileSize, bool cga) {
+	// EGA is 4 planes, so 2 pixels per byte, and CGA is 4 pixels per byte
+	const int BYTES_PER_ROW = cga ? tileSize / 4 : tileSize / 2;
 	const int BYTES_PER_PLANE_ROW = BYTES_PER_ROW / 4;	// bytes per row, within a single plane
 	const int BYTES_PER_TILE = BYTES_PER_ROW * tileSize;
 
@@ -49,6 +50,11 @@ void loadTiles(const char *filename, Graphics::ManagedSurface *tiles, int count,
 			byte *destRow = (byte *)tile.getBasePtr(0, y);
 
 			for (int x = 0; x < tileSize; ++x) {
+				if (cga) {
+					destRow[x] = (row[x / 4] >> (6 - 2 * (x % 4))) & 3;
+					continue;
+				}
+
 				int byteIdx = x / 8;
 				int bitMask = 0x80 >> (x % 8);
 
@@ -67,13 +73,14 @@ void loadTiles(const char *filename, Graphics::ManagedSurface *tiles, int count,
 }
 
 constexpr int SHIP_TILE_HEIGHT = SPACE_SHIP_TILE_HEIGHT;
-constexpr int SHIP_TILE_SHIFT_VARIANTS = 8;
-constexpr byte SHIP_TILE_MASK_COLOR = 15;
+constexpr int EGA_SHIP_TILE_SHIFT_VARIANTS = 8;
+constexpr int CGA_SHIP_TILE_SHIFT_VARIANTS = 4;
+constexpr byte EGA_SHIP_TILE_MASK_COLOR = 15;
 
-void loadShipTiles(const char *filename, Graphics::ManagedSurface *tiles, int count, int width) {
-	const int rowBytes = width / 8;
+void loadShipTiles(const char *filename, Graphics::ManagedSurface *tiles, int count, int width, bool cga) {
+	const int rowBytes = cga ? width / 4 : width / 8;
 	const int tileBytes = rowBytes * SHIP_TILE_HEIGHT;
-	const int slotBytes = tileBytes * SHIP_TILE_SHIFT_VARIANTS;
+	const int slotBytes = tileBytes * (cga ? CGA_SHIP_TILE_SHIFT_VARIANTS : EGA_SHIP_TILE_SHIFT_VARIANTS);
 
 	Common::File f;
 	if (!f.open(filename))
@@ -95,10 +102,11 @@ void loadShipTiles(const char *filename, Graphics::ManagedSurface *tiles, int co
 			byte *destRow = (byte *)tile.getBasePtr(0, y);
 
 			for (int x = 0; x < width; ++x) {
-				int byteIdx = x / 8;
-				int bitMask = 0x80 >> (x % 8);
-				if (row[byteIdx] & bitMask)
-					destRow[x] = SHIP_TILE_MASK_COLOR;
+				if (cga) {
+					destRow[x] = (row[x / 4] >> (6 - 2 * (x % 4))) & 3;
+				} else if (row[x / 8] & (0x80 >> (x % 8))) {
+					destRow[x] = EGA_SHIP_TILE_MASK_COLOR;
+				}
 			}
 		}
 	}
diff --git a/engines/ultima/ultima1/data/tiles.h b/engines/ultima/ultima1/data/tiles.h
index 85e67015c5e..1005842bb46 100644
--- a/engines/ultima/ultima1/data/tiles.h
+++ b/engines/ultima/ultima1/data/tiles.h
@@ -121,31 +121,34 @@ enum MondainTileId {
 };
 
 /**
- * Loads the overworld tile sheet (52 16x16 tiles, 4-bit EGA planar,
- * row-interleaved: each 16-pixel row is 4 planes x 2 bytes) into a
- * caller-supplied array of TILE_COUNT surfaces
+ * Loads a tile sheet (such as the 52 16x16 overworld tiles) into a
+ * caller-supplied array of surfaces. The EGA ones are 4 bits per pixel in
+ * planes, each row of 16 pixels being 4 planes x 2 bytes. The CGA ones are
+ * 2 bits per pixel, 4 pixels to a byte, left to right
  * @param filename		Filename to load
  * @param tiles			Tiles array to load into
  * @param count			Number of tiles
  * @param tileSize		Width/Height of individual tiles
+ * @param cga			True if the sheet is the CGA version
  */
-extern void loadTiles(const char *filename, Graphics::ManagedSurface *tiles, int count, int size);
+extern void loadTiles(const char *filename, Graphics::ManagedSurface *tiles, int count, int size, bool cga);
 
 /**
- * Loads a sheet of 1-bit-per-pixel mask glyphs, 19 pixels high, into a
- * caller-supplied array of surfaces - the outer-space ship glyphs
- * (egaspace.bin, one per shipType*4+facing combination) and the cockpit
- * enemy fighter glyphs (egafight.bin, one per approach stage). Each glyph
- * is followed in the file by 7 more byte-alignment-shifted copies of itself
- * (for the original's hardware byte-aligned blitter) - only the first,
- * unshifted copy is loaded, since a software blit isn't limited to
- * byte-aligned X positions
+ * Loads a sheet of glyphs, 19 pixels high, into a caller-supplied array of
+ * surfaces - the outer-space ship glyphs (one per shipType*4+facing
+ * combination) and the cockpit enemy fighter glyphs (one per approach
+ * stage). The EGA ones are 1 bit per pixel masks, and the CGA ones 2 bits
+ * per pixel. Each glyph is followed in the file by byte-alignment-shifted
+ * copies of itself (7 for EGA, 3 for CGA, for the original's hardware
+ * byte-aligned blitter) - only the first, unshifted copy is loaded, since a
+ * software blit isn't limited to byte-aligned X positions
  * @param filename		Filename to load
  * @param tiles			Tiles array to load into
  * @param count			Number of glyphs
  * @param width			Width of each glyph in pixels, a multiple of 8
+ * @param cga			True if the sheet is the CGA version
  */
-extern void loadShipTiles(const char *filename, Graphics::ManagedSurface *tiles, int count, int width);
+extern void loadShipTiles(const char *filename, Graphics::ManagedSurface *tiles, int count, int width, bool cga);
 
 } // namespace Data
 } // namespace Ultima1
diff --git a/engines/ultima/ultima1/gfx/font.cpp b/engines/ultima/ultima1/gfx/font.cpp
index 56c10e2dd04..31480adbd42 100644
--- a/engines/ultima/ultima1/gfx/font.cpp
+++ b/engines/ultima/ultima1/gfx/font.cpp
@@ -21,6 +21,7 @@
 
 #include "graphics/surface.h"
 #include "ultima/ultima1/gfx/font.h"
+#include "ultima/ultima1/ultima1.h"
 
 namespace Ultima {
 namespace Ultima1 {
@@ -42,13 +43,20 @@ void Font::drawChar(Graphics::Surface *dst, uint32 chr, int x, int y, uint32 col
 		// Get area for the arrow
 		Graphics::Surface sub = dst->getSubArea(Common::Rect(x, y, x + getMaxCharWidth(), y + getFontHeight()));
 
-		// Handle drawing left/right arrow in blue with white outline
+		// Handle drawing left/right arrow in the border color with an edge color outline
 		for (int yp = 0; yp < getFontHeight(); ++yp) {
 			const byte *src = &ARROW[yp][0];
 			byte *dest = (byte *)sub.getBasePtr(0, yp);
 
-			for (int xp = 0; xp < getMaxCharWidth(); ++xp, ++src)
-				dest[chr == '\x10' ? xp : 7 - xp] = *src;
+			for (int xp = 0; xp < getMaxCharWidth(); ++xp, ++src) {
+				byte pixel = *src;
+				if (pixel == 15)
+					pixel = _G(colors)._edge;
+				else if (pixel == 1)
+					pixel = _G(colors)._border;
+
+				dest[chr == '\x10' ? xp : 7 - xp] = pixel;
+			}
 		}
 
 	} else {
diff --git a/engines/ultima/ultima1/gfx/pic_decoder.cpp b/engines/ultima/ultima1/gfx/pic_decoder.cpp
index d775ca226fb..934cc346a9e 100644
--- a/engines/ultima/ultima1/gfx/pic_decoder.cpp
+++ b/engines/ultima/ultima1/gfx/pic_decoder.cpp
@@ -72,6 +72,30 @@ bool PicDecoder::loadStream(Common::SeekableReadStream &stream) {
 	return true;
 }
 
+bool PicDecoder::loadCgaStream(Common::SeekableReadStream &stream) {
+	constexpr int BANK_SIZE = 0x2000;
+	constexpr int ROW_BYTES = 80;
+
+	destroy();
+	_surface.create(320, 200, Graphics::PixelFormat::createFormatCLUT8());
+	_palette = Graphics::Palette();
+
+	Common::Array<byte> data;
+	data.resize(2 * BANK_SIZE);
+	if (stream.read(&data[0], data.size()) != data.size())
+		return false;
+
+	for (int y = 0; y < 200; ++y) {
+		const byte *row = &data[(y & 1) * BANK_SIZE + (y >> 1) * ROW_BYTES];
+		byte *outputRow = (byte *)_surface.getBasePtr(0, y);
+
+		for (int x = 0; x < 320; ++x)
+			outputRow[x] = (row[x / 4] >> (6 - 2 * (x % 4))) & 3;
+	}
+
+	return true;
+}
+
 } // namespace Gfx
 } // namespace Ultima1
 } // namespace Ultima
diff --git a/engines/ultima/ultima1/gfx/pic_decoder.h b/engines/ultima/ultima1/gfx/pic_decoder.h
index a0522222caf..e0d0d580995 100644
--- a/engines/ultima/ultima1/gfx/pic_decoder.h
+++ b/engines/ultima/ultima1/gfx/pic_decoder.h
@@ -65,6 +65,14 @@ public:
 	 */
 	bool loadStream(Common::SeekableReadStream &stream) override;
 
+	/**
+	 * Loads the CGA version of a picture (e.g. "castle.4"), which is a
+	 * dump of the CGA's screen memory: 320x200, 2 bits/pixel, 4 pixels to
+	 * a byte, with the even lines in the first 8K, the odd lines in the
+	 * second 8K, and no palette of its own
+	 */
+	bool loadCgaStream(Common::SeekableReadStream &stream);
+
 	/**
 	 * Destroy this decoder's surface and palette.
 	 *
diff --git a/engines/ultima/ultima1/gfx/text_cursor.cpp b/engines/ultima/ultima1/gfx/text_cursor.cpp
index fbaa6b26674..48918b0c389 100644
--- a/engines/ultima/ultima1/gfx/text_cursor.cpp
+++ b/engines/ultima/ultima1/gfx/text_cursor.cpp
@@ -20,6 +20,7 @@
  */
 
 #include "ultima/ultima1/gfx/text_cursor.h"
+#include "ultima/ultima1/ultima1.h"
 #include "graphics/views/rect.h"
 
 namespace Ultima {
@@ -27,7 +28,6 @@ namespace Ultima1 {
 namespace Gfx {
 
 #define DELAY_FRAMES 2
-constexpr int COLOR_CURSOR = 11; // light cyan
 
 // 4-frame 8x8 glyph, one byte per row, low bit = leftmost pixel
 static const byte CURSOR_FRAMES[4][8] = {
@@ -69,7 +69,7 @@ void TextCursor::draw() {
 		byte bits = CURSOR_FRAMES[_frame][y];
 		for (int x = 0; x < 8; ++x, bits >>= 1) {
 			if (bits & 1)
-				s.drawLine(x, y, x, y, COLOR_CURSOR);
+				s.drawLine(x, y, x, y, _G(colors)._text);
 		}
 	}
 }
diff --git a/engines/ultima/ultima1/ultima1.cpp b/engines/ultima/ultima1/ultima1.cpp
index f864ab1c5c6..374881def68 100644
--- a/engines/ultima/ultima1/ultima1.cpp
+++ b/engines/ultima/ultima1/ultima1.cpp
@@ -30,6 +30,7 @@
 #include "ultima/ultima1/ultima1.h"
 #include "ultima/ultima1/console.h"
 #include "ultima/ultima1/sound_effects.h"
+#include "ultima/shared/engine/graphics_options.h"
 #include "ultima/ultima1/gfx/font.h"
 #include "ultima/ultima1/views/views.h"
 #include "ultima/ultima1/views/map.h"
@@ -58,12 +59,22 @@ Common::String Ultima1Engine::getGameId() const {
 	return _gameDescription->desc.gameId;
 }
 
+// The graphics mode stored in the configuration, falling back to EGA if it's
+// missing or stale
+static Data::RenderMode configuredRenderMode() {
+	int mode = Shared::configuredGraphicsMode(Data::RENDER_EGA);
+	return (mode >= 0 && mode < Data::RENDER_MODE_COUNT) ?
+		(Data::RenderMode)mode : Data::RENDER_EGA;
+}
+
 Common::Error Ultima1Engine::run() {
 	MetaEngine::setKeybindingMode(KBMODE_MINIMAL);
 
 	// Initialize 320x200 paletted graphics mode
 	initGraphics(320, 200);
-	g_system->getPaletteManager()->setPalette(Graphics::Palette::createEGAPalette());
+	_renderMode = configuredRenderMode();
+	_colors.set(_renderMode);
+	Data::setPalette(_renderMode);
 
 	// Set the engine's debugger console
 	setDebugger(new Console());
@@ -140,6 +151,24 @@ void Ultima1Engine::pauseMillis(uint32 millis) {
 	g_system->delayMillis(millis);
 }
 
+void Ultima1Engine::applyGameSettings() {
+	// The graphics can be changed from the in-game options dialog
+	setRenderMode(configuredRenderMode());
+}
+
+void Ultima1Engine::setRenderMode(Data::RenderMode mode) {
+	if (mode == _renderMode)
+		return;
+
+	_renderMode = mode;
+	_colors.set(mode);
+	Data::setPalette(mode);
+	_map.loadGraphics();
+
+	if (focusedView())
+		focusedView()->redraw();
+}
+
 Graphics::Font *Ultima1Engine::createFont() const {
 	return new Gfx::Font();
 }
diff --git a/engines/ultima/ultima1/ultima1.h b/engines/ultima/ultima1/ultima1.h
index aff3bf45289..6fad1534a8d 100644
--- a/engines/ultima/ultima1/ultima1.h
+++ b/engines/ultima/ultima1/ultima1.h
@@ -41,6 +41,7 @@
 #include "ultima/detection.h"
 #include "ultima/ultima1/data/map.h"
 #include "ultima/ultima1/data/map_dungeon.h"
+#include "ultima/ultima1/data/render_mode.h"
 #include "ultima/ultima1/data/savegame.h"
 #include "ultima/ultima1/data/space_map.h"
 #include "ultima/ultima1/data/tiles.h"
@@ -74,6 +75,10 @@ protected:
 	}
 
 public:
+	// The graphics being shown, and the palette indices things are drawn
+	// with in them
+	Data::RenderMode _renderMode = Data::RENDER_EGA;
+	Data::RenderColors _colors;
 	Data::Map _map;
 	Data::MapDungeon _dungeon;
 	Data::SpaceStarfield _starfield;
@@ -153,6 +158,16 @@ public:
 	 */
 	void pauseMillis(uint32 millis);
 
+	/**
+	 * Switches to a different set of graphics
+	 */
+	void setRenderMode(Data::RenderMode mode);
+
+	/**
+	 * Picks up changes made to the game options
+	 */
+	void applyGameSettings() override;
+
 	/**
 	 * Returns a font object that GfxSurface instances can use
 	 */
diff --git a/engines/ultima/ultima1/views/commands.cpp b/engines/ultima/ultima1/views/commands.cpp
index 27f0ce51db8..009d43f3718 100644
--- a/engines/ultima/ultima1/views/commands.cpp
+++ b/engines/ultima/ultima1/views/commands.cpp
@@ -27,7 +27,6 @@ namespace Ultima {
 namespace Ultima1 {
 namespace Views {
 
-constexpr int COLOR_TEXT = 11;      // light cyan - normal values
 constexpr int NEWLINE_DELAY = 50;	// Delay after a newline
 
 Commands::Commands(UIElement *parent) : Graphics::Views::UIElement("Commands", parent), _textCursor("CommandsCursor", this) {
@@ -40,7 +39,7 @@ void Commands::draw() {
 	_surface.clear();
 	_surface.setTextPos(Common::Point(0, 4));
 	_surface.setScrollable(true);
-	_surface.setColor(COLOR_TEXT);
+	_surface.setColor(_G(colors)._text);
 
 	prompt();
 }
diff --git a/engines/ultima/ultima1/views/create_character.cpp b/engines/ultima/ultima1/views/create_character.cpp
index 02a3b2092d1..3bf33849306 100644
--- a/engines/ultima/ultima1/views/create_character.cpp
+++ b/engines/ultima/ultima1/views/create_character.cpp
@@ -29,8 +29,6 @@ namespace Views {
 using namespace Data;
 
 // Colors used
-constexpr int COLOR_EDGE = 15; // white
-constexpr int COLOR_TEXT = 11; // light cyan
 
 // Pads a label out with dots to a fixed width, matching the original's
 // dot-leader alignment for the attribute list
@@ -45,10 +43,10 @@ CreateCharacter::CreateCharacter() : FullScreenDialog("CreateCharacter"),
 		_cursor("Cursor", this), _nameInput("NameInput", this, _cursor) {
 	// Hidden until race/sex/class/save selection needs it
 	_cursor.hide();
-	_nameInput.setColor(COLOR_TEXT);
 }
 
 bool CreateCharacter::msgFocus(const FocusMessage &msg) {
+	_nameInput.setColor(_G(colors)._text);
 	reset();
 	return View::msgFocus(msg);
 }
@@ -87,7 +85,7 @@ void CreateCharacter::draw() {
 
 	switch (_state) {
 	case ATTRIBUTES:
-		s.setColor(COLOR_TEXT);
+		s.setColor(_G(colors)._text);
 		s.writeString(Common::Point(6, 4),
 			Common::String::format("Points left to distribute: %d", _pointsRemaining));
 		drawHelp(s);
@@ -98,7 +96,7 @@ void CreateCharacter::draw() {
 		break;
 
 	case RACE:
-		s.setColor(COLOR_TEXT);
+		s.setColor(_G(colors)._text);
 		s.writeString(Common::Point(3, 17), "Select thy race: ");
 		s.writeString(Common::Point(12, 19), "a) Human");
 		s.writeString(Common::Point(12, 20), "b) Elf");
@@ -108,7 +106,7 @@ void CreateCharacter::draw() {
 
 	case SEX:
 		drawConfirmedRace(s);
-		s.setColor(COLOR_TEXT);
+		s.setColor(_G(colors)._text);
 		s.writeString(Common::Point(3, 17), "Select thy sex: ");
 		s.writeString(Common::Point(12, 19), "a) Male");
 		s.writeString(Common::Point(12, 20), "b) Female");
@@ -117,7 +115,7 @@ void CreateCharacter::draw() {
 	case CLASS:
 		drawConfirmedRace(s);
 		drawConfirmedSex(s);
-		s.setColor(COLOR_TEXT);
+		s.setColor(_G(colors)._text);
 		s.writeString(Common::Point(3, 17), "Select thy class: ");
 		s.writeString(Common::Point(12, 19), "a) Fighter");
 		s.writeString(Common::Point(12, 20), "b) Cleric");
@@ -129,7 +127,7 @@ void CreateCharacter::draw() {
 		drawConfirmedRace(s);
 		drawConfirmedSex(s);
 		drawConfirmedClass(s);
-		s.setColor(COLOR_TEXT);
+		s.setColor(_G(colors)._text);
 		s.writeString(Common::Point(3, 17), "Enter thy name: ");
 		break;
 
@@ -137,7 +135,7 @@ void CreateCharacter::draw() {
 		drawConfirmedRace(s);
 		drawConfirmedSex(s);
 		drawConfirmedClass(s);
-		s.setColor(COLOR_TEXT);
+		s.setColor(_G(colors)._text);
 		s.writeString(Common::Point(12, 4), _G(savegame)._name);
 		s.writeString(Common::Point(3, 22), "Use this character? (Y-N) ");
 		break;
@@ -146,7 +144,7 @@ void CreateCharacter::draw() {
 
 void CreateCharacter::drawAttributes(Graphics::Views::GfxSurface &s) {
 	const Savegame &p = _G(savegame);
-	s.setColor(COLOR_TEXT);
+	s.setColor(_G(colors)._text);
 
 	s.writeString(Common::Point(12, 6), padLabel("Strength", 16) + Common::String::format("%2d", p._strength));
 	s.writeString(Common::Point(12, 7), padLabel("Agility", 16) + Common::String::format("%2d", p._agility));
@@ -157,7 +155,7 @@ void CreateCharacter::drawAttributes(Graphics::Views::GfxSurface &s) {
 }
 
 void CreateCharacter::drawHelp(Graphics::Views::GfxSurface &s) {
-	s.setColor(COLOR_TEXT);
+	s.setColor(_G(colors)._text);
 	s.writeString(Common::Point(2, 16), "Move cursor with up and down arrows;");
 	s.writeString(Common::Point(2, 17), "increase and decrease attributes");
 	s.writeString(Common::Point(2, 18), "with left and right arrows.  Press");
@@ -166,19 +164,19 @@ void CreateCharacter::drawHelp(Graphics::Views::GfxSurface &s) {
 }
 
 void CreateCharacter::drawConfirmedRace(Graphics::Views::GfxSurface &s) {
-	s.setColor(COLOR_TEXT);
+	s.setColor(_G(colors)._text);
 	s.writeString(Common::Point(14, 13),
 		Common::String::format("Race: %s", RACE_NAMES[_G(savegame)._race]));
 }
 
 void CreateCharacter::drawConfirmedSex(Graphics::Views::GfxSurface &s) {
-	s.setColor(COLOR_TEXT);
+	s.setColor(_G(colors)._text);
 	s.writeString(Common::Point(15, 14),
 		Common::String::format("Sex: %s", SEX_NAMES[_G(savegame)._sex]));
 }
 
 void CreateCharacter::drawConfirmedClass(Graphics::Views::GfxSurface &s) {
-	s.setColor(COLOR_TEXT);
+	s.setColor(_G(colors)._text);
 	s.writeString(Common::Point(13, 15),
 		Common::String::format("Class: %s", CLASS_NAMES[_G(savegame)._class]));
 }
diff --git a/engines/ultima/ultima1/views/dialog.cpp b/engines/ultima/ultima1/views/dialog.cpp
index 21e61606e01..98c54f4a7bb 100644
--- a/engines/ultima/ultima1/views/dialog.cpp
+++ b/engines/ultima/ultima1/views/dialog.cpp
@@ -28,8 +28,6 @@ namespace Ultima1 {
 namespace Views {
 
 // Colors used
-constexpr int COLOR_BORDER = 1;  // blue - thick outer band
-constexpr int COLOR_EDGE = 15;   // white - thin inner highlight line
 constexpr int COLOR_NOTCH = 0;   // black - corner notch pixels
 
 Dialog::Dialog(const Common::String &name) : View(name) {
@@ -42,15 +40,15 @@ void Dialog::draw() {
 
 	// Thick outer border band - each edge flush against both the screen edge
 	// and the inner highlight line drawn just inside it
-	s.fillRect(Common::Rect(0, 0, 320, 7), COLOR_BORDER);
-	s.fillRect(Common::Rect(0, 7, 7, 159), COLOR_BORDER);
-	s.fillRect(Common::Rect(313, 7, 320, 159), COLOR_BORDER);
-	s.fillRect(Common::Rect(0, 152, 320, 160), COLOR_BORDER);
+	s.fillRect(Common::Rect(0, 0, 320, 7), _G(colors)._border);
+	s.fillRect(Common::Rect(0, 7, 7, 159), _G(colors)._border);
+	s.fillRect(Common::Rect(313, 7, 320, 159), _G(colors)._border);
+	s.fillRect(Common::Rect(0, 152, 320, 160), _G(colors)._border);
 
 	// Thin inner highlight line
-	s.frameRect(Common::Rect(7, 7, 313, 153), COLOR_EDGE);
-	s.drawLine(0, 159, 240, 159, COLOR_EDGE);
-	s.drawLine(247, 159, 319, 159, COLOR_EDGE);
+	s.frameRect(Common::Rect(7, 7, 313, 153), _G(colors)._edge);
+	s.drawLine(0, 159, 240, 159, _G(colors)._edge);
+	s.drawLine(247, 159, 319, 159, _G(colors)._edge);
 
 	// Diagonal-notched corners, cut as a growing staircase into each corner
 	for (int idx = 1; idx <= 4; ++idx) {
diff --git a/engines/ultima/ultima1/views/dungeon_map.cpp b/engines/ultima/ultima1/views/dungeon_map.cpp
index e034b4979ae..e3b4f601b90 100644
--- a/engines/ultima/ultima1/views/dungeon_map.cpp
+++ b/engines/ultima/ultima1/views/dungeon_map.cpp
@@ -28,8 +28,6 @@ namespace Ultima1 {
 namespace Views {
 
 // Colours used by the dungeon view's wireframe lines
-constexpr int EDGE_COLOR = 15;
-constexpr int HIGHLIGHT_COLOR = 12;
 
 // Perspective coordinate table, indexed by distance (0-5). Matches the
 // original's DUNGEON_ARRAY_X/DUNGEONL_ARRAY_Y
@@ -209,7 +207,7 @@ void DungeonMap::drawFacingDirection() {
 		break;
 	}
 
-	s.setColor(EDGE_COLOR);
+	s.setColor(_G(colors)._edge);
 	s.writeString(Common::Point(16, 19), "\x10 %s \x11", dirName);
 }
 
@@ -225,8 +223,8 @@ void DungeonMap::drawWall(int distance) {
 	int yTop = DUNGEON_ARRAY_Y[distance] + 8 + offset;
 	int yBottom = 151 - DUNGEON_ARRAY_Y[distance] - offset;
 
-	s.drawLine(x1, yTop, x2, yTop, EDGE_COLOR);
-	s.drawLine(x1, yBottom, x2, yBottom, EDGE_COLOR);
+	s.drawLine(x1, yTop, x2, yTop, _G(colors)._edge);
+	s.drawLine(x1, yBottom, x2, yBottom, _G(colors)._edge);
 }
 
 void DungeonMap::drawLeftWall(int distance) {
@@ -237,8 +235,8 @@ void DungeonMap::drawLeftWall(int distance) {
 	int x1 = DUNGEON_ARRAY_X[distance - 1] + 16;
 	int x2 = DUNGEON_ARRAY_X[distance] + 16;
 
-	s.drawLine(x1, DUNGEON_ARRAY_Y[distance - 1] + 8, x2, DUNGEON_ARRAY_Y[distance] + 8, EDGE_COLOR);
-	s.drawLine(x1, 151 - DUNGEON_ARRAY_Y[distance - 1], x2, 151 - DUNGEON_ARRAY_Y[distance], EDGE_COLOR);
+	s.drawLine(x1, DUNGEON_ARRAY_Y[distance - 1] + 8, x2, DUNGEON_ARRAY_Y[distance] + 8, _G(colors)._edge);
+	s.drawLine(x1, 151 - DUNGEON_ARRAY_Y[distance - 1], x2, 151 - DUNGEON_ARRAY_Y[distance], _G(colors)._edge);
 }
 
 void DungeonMap::drawRightWall(int distance) {
@@ -249,8 +247,8 @@ void DungeonMap::drawRightWall(int distance) {
 	int x1 = 303 - DUNGEON_ARRAY_X[distance - 1];
 	int x2 = 303 - DUNGEON_ARRAY_X[distance];
 
-	s.drawLine(x1, DUNGEON_ARRAY_Y[distance - 1] + 8, x2, DUNGEON_ARRAY_Y[distance] + 8, EDGE_COLOR);
-	s.drawLine(x1, 151 - DUNGEON_ARRAY_Y[distance - 1], x2, 151 - DUNGEON_ARRAY_Y[distance], EDGE_COLOR);
+	s.drawLine(x1, DUNGEON_ARRAY_Y[distance - 1] + 8, x2, DUNGEON_ARRAY_Y[distance] + 8, _G(colors)._edge);
+	s.drawLine(x1, 151 - DUNGEON_ARRAY_Y[distance - 1], x2, 151 - DUNGEON_ARRAY_Y[distance], _G(colors)._edge);
 }
 
 void DungeonMap::drawLeftBlank(int distance) {
@@ -263,8 +261,8 @@ void DungeonMap::drawLeftBlank(int distance) {
 	int yTop = DUNGEON_ARRAY_Y[distance] + 8;
 	int yBottom = 151 - DUNGEON_ARRAY_Y[distance];
 
-	s.drawLine(x1, yTop, x2, yTop, EDGE_COLOR);
-	s.drawLine(x1, yBottom, x2, yBottom, EDGE_COLOR);
+	s.drawLine(x1, yTop, x2, yTop, _G(colors)._edge);
+	s.drawLine(x1, yBottom, x2, yBottom, _G(colors)._edge);
 }
 
 void DungeonMap::drawRightBlank(int distance) {
@@ -277,8 +275,8 @@ void DungeonMap::drawRightBlank(int distance) {
 	int yTop = DUNGEON_ARRAY_Y[distance] + 8;
 	int yBottom = 151 - DUNGEON_ARRAY_Y[distance];
 
-	s.drawLine(x1, yTop, x2, yTop, EDGE_COLOR);
-	s.drawLine(x1, yBottom, x2, yBottom, EDGE_COLOR);
+	s.drawLine(x1, yTop, x2, yTop, _G(colors)._edge);
+	s.drawLine(x1, yBottom, x2, yBottom, _G(colors)._edge);
 }
 
 void DungeonMap::drawLeftEdge(int distance) {
@@ -287,7 +285,7 @@ void DungeonMap::drawLeftEdge(int distance) {
 	auto s = getSurface();
 
 	int x = DUNGEON_ARRAY_X[distance] + 16;
-	s.drawLine(x, DUNGEON_ARRAY_Y[distance] + 8, x, 151 - DUNGEON_ARRAY_Y[distance], EDGE_COLOR);
+	s.drawLine(x, DUNGEON_ARRAY_Y[distance] + 8, x, 151 - DUNGEON_ARRAY_Y[distance], _G(colors)._edge);
 }
 
 void DungeonMap::drawRightEdge(int distance) {
@@ -296,7 +294,7 @@ void DungeonMap::drawRightEdge(int distance) {
 	auto s = getSurface();
 
 	int x = 303 - DUNGEON_ARRAY_X[distance];
-	s.drawLine(x, DUNGEON_ARRAY_Y[distance] + 8, x, 151 - DUNGEON_ARRAY_Y[distance], EDGE_COLOR);
+	s.drawLine(x, DUNGEON_ARRAY_Y[distance] + 8, x, 151 - DUNGEON_ARRAY_Y[distance], _G(colors)._edge);
 }
 
 void DungeonMap::drawLeftDoor(int distance) {
@@ -314,14 +312,14 @@ void DungeonMap::drawLeftDoor(int distance) {
 	int y2 = DUNGEON_ARRAY_Y[distance] + 8 - diffY;
 
 	auto s = getSurface();
-	s.drawLine(x1, y1, x2, y2, EDGE_COLOR);
+	s.drawLine(x1, y1, x2, y2, _G(colors)._edge);
 
 	int xp = diffX * 6 + 16 + DUNGEON_ARRAY_X[distance - 1];
 	int yp = DUNGEON_ARRAY_Y[distance] + 8 + diffY;
-	s.drawLine(x2, y2, xp, yp, EDGE_COLOR);
+	s.drawLine(x2, y2, xp, yp, _G(colors)._edge);
 
 	int yp2 = 151 - DUNGEON_ARRAY_Y[distance] + diffY + diffY - ((distance == 1) ? 2 : 0);
-	s.drawLine(xp, yp, xp, yp2, EDGE_COLOR);
+	s.drawLine(xp, yp, xp, yp2, _G(colors)._edge);
 }
 
 void DungeonMap::drawRightDoor(int distance) {
@@ -339,19 +337,19 @@ void DungeonMap::drawRightDoor(int distance) {
 	int y2 = DUNGEON_ARRAY_Y[distance] + 8 - diffY;
 
 	auto s = getSurface();
-	s.drawLine(x1, y1, x2, y2, EDGE_COLOR);
+	s.drawLine(x1, y1, x2, y2, _G(colors)._edge);
 
 	int xp = 303 - (diffX * 6 + DUNGEON_ARRAY_X[distance - 1]);
 	int yp = DUNGEON_ARRAY_Y[distance] + 8 + diffY;
-	s.drawLine(x2, y2, xp, yp, EDGE_COLOR);
+	s.drawLine(x2, y2, xp, yp, _G(colors)._edge);
 
 	int yp2 = 151 - DUNGEON_ARRAY_Y[distance] + diffY + diffY - ((distance == 1) ? 2 : 0);
-	s.drawLine(xp, yp, xp, yp2, EDGE_COLOR);
+	s.drawLine(xp, yp, xp, yp2, _G(colors)._edge);
 }
 
 void DungeonMap::drawDoorway(int distance) {
 	int offsetY = 0;
-	int bottomColor = EDGE_COLOR;
+	int bottomColor = _G(colors)._edge;
 	if (distance == 0) {
 		offsetY = 8;
 		// Standing right at the threshold, so the near edge (right at the
@@ -371,9 +369,9 @@ void DungeonMap::drawDoorway(int distance) {
 	int topY = DUNGEON_ARRAY_Y[distance + 1] + 8;
 
 	s.drawLine(farRightX, bottomY, farLeftX, bottomY, bottomColor);
-	s.drawLine(farLeftX, bottomY, farLeftX, topY, EDGE_COLOR);
-	s.drawLine(farLeftX, topY, farRightX, topY, EDGE_COLOR);
-	s.drawLine(farRightX, topY, farRightX, bottomY, EDGE_COLOR);
+	s.drawLine(farLeftX, bottomY, farLeftX, topY, _G(colors)._edge);
+	s.drawLine(farLeftX, topY, farRightX, topY, _G(colors)._edge);
+	s.drawLine(farRightX, topY, farRightX, bottomY, _G(colors)._edge);
 }
 
 void DungeonMap::drawBeams(int distance) {
@@ -387,36 +385,36 @@ void DungeonMap::drawBeams(int distance) {
 	auto s = getSurface();
 	for (int beamNum = 1; beamNum <= 3; ++beamNum) {
 		int y = DUNGEON_ARRAY_Y[distance] + 8 + height * beamNum + distance / 2;
-		s.drawLine(x1, y, x2, y, HIGHLIGHT_COLOR);
+		s.drawLine(x1, y, x2, y, _G(colors)._highlight);
 	}
 }
 
 void DungeonMap::drawLadderUpFaceOn(int distance) {
 	if (distance > 5)
 		return;
-	dungeonDrawWidget(LADDER_UP_TOP_DATA, distance, EDGE_COLOR);
-	dungeonDrawWidget(LADDER_SHAFT_FACEON_DATA, distance, EDGE_COLOR);
+	dungeonDrawWidget(LADDER_UP_TOP_DATA, distance, _G(colors)._edge);
+	dungeonDrawWidget(LADDER_SHAFT_FACEON_DATA, distance, _G(colors)._edge);
 }
 
 void DungeonMap::drawLadderDownFaceOn(int distance) {
 	if (distance > 5)
 		return;
-	dungeonDrawWidget(LADDER_DOWN_TOP_DATA, distance, EDGE_COLOR);
-	dungeonDrawWidget(LADDER_SHAFT_FACEON_DATA, distance, EDGE_COLOR);
+	dungeonDrawWidget(LADDER_DOWN_TOP_DATA, distance, _G(colors)._edge);
+	dungeonDrawWidget(LADDER_SHAFT_FACEON_DATA, distance, _G(colors)._edge);
 }
 
 void DungeonMap::drawLadderUpSideways(int distance) {
 	if (distance > 5)
 		return;
-	dungeonDrawWidget(LADDER_UP_TOP_DATA, distance, EDGE_COLOR);
-	dungeonDrawWidget(LADDER_SHAFT_SIDE_DATA, distance, EDGE_COLOR);
+	dungeonDrawWidget(LADDER_UP_TOP_DATA, distance, _G(colors)._edge);
+	dungeonDrawWidget(LADDER_SHAFT_SIDE_DATA, distance, _G(colors)._edge);
 }
 
 void DungeonMap::drawLadderDownSideways(int distance) {
 	if (distance > 5)
 		return;
-	dungeonDrawWidget(LADDER_DOWN_TOP_DATA, distance, EDGE_COLOR);
-	dungeonDrawWidget(LADDER_SHAFT_SIDE_DATA, distance, EDGE_COLOR);
+	dungeonDrawWidget(LADDER_DOWN_TOP_DATA, distance, _G(colors)._edge);
+	dungeonDrawWidget(LADDER_SHAFT_SIDE_DATA, distance, _G(colors)._edge);
 }
 
 void DungeonMap::drawLeftCell(int distance, int tileNum) {
@@ -448,9 +446,9 @@ void DungeonMap::dungeonDrawCell(int distance, int x, int y) {
 		// A monster sharing a ladder's cell only gets the "hole" opening
 		// drawn, not the full shaft - matching the original's dungeonDrawCell2
 		if (cell._tileNum == Data::DTILE_LADDER_DOWN)
-			dungeonDrawWidget(LADDER_DOWN_TOP_DATA, distance + 1, EDGE_COLOR);
+			dungeonDrawWidget(LADDER_DOWN_TOP_DATA, distance + 1, _G(colors)._edge);
 		else if (cell._tileNum == Data::DTILE_LADDER_UP)
-			dungeonDrawWidget(LADDER_UP_TOP_DATA, distance + 1, EDGE_COLOR);
+			dungeonDrawWidget(LADDER_UP_TOP_DATA, distance + 1, _G(colors)._edge);
 
 		dungeonDrawMonster(cell._monsterId, distance);
 		return;
@@ -531,7 +529,7 @@ void DungeonMap::dungeonDrawWidget(const uint8 *data, int distance, int color) {
 void DungeonMap::drawCoffin(int distance) {
 	// The original also shows "Coffin" in the commands area here - that's
 	// handled by DungeonLogic::endOfTurn instead, as with monster names
-	dungeonDrawWidget(COFFIN_DRAW_DATA, distance, EDGE_COLOR);
+	dungeonDrawWidget(COFFIN_DRAW_DATA, distance, _G(colors)._edge);
 }
 
 void DungeonMap::drawChest(int distance) {
@@ -539,7 +537,7 @@ void DungeonMap::drawChest(int distance) {
 	// handled by DungeonLogic::endOfTurn instead, as with monster names.
 	// Reuses the mimic's widget shape, since the original draws chests and
 	// mimics identically
-	dungeonDrawWidget(UWIDGET_DRAW_TABLE[Data::UMONS_MIMIC], distance, EDGE_COLOR);
+	dungeonDrawWidget(UWIDGET_DRAW_TABLE[Data::UMONS_MIMIC], distance, _G(colors)._edge);
 }
 
 void DungeonMap::dungeonDrawMonster(int monsterId, int distance) {
@@ -556,7 +554,7 @@ void DungeonMap::dungeonDrawMonster(int monsterId, int distance) {
 		drawLeftEdge(distance);
 		drawRightEdge(distance);
 	} else {
-		dungeonDrawWidget(UWIDGET_DRAW_TABLE[monsterId], distance, EDGE_COLOR);
+		dungeonDrawWidget(UWIDGET_DRAW_TABLE[monsterId], distance, _G(colors)._edge);
 	}
 }
 
diff --git a/engines/ultima/ultima1/views/full_screen_dialog.cpp b/engines/ultima/ultima1/views/full_screen_dialog.cpp
index 7236502f7f5..36b8de531c5 100644
--- a/engines/ultima/ultima1/views/full_screen_dialog.cpp
+++ b/engines/ultima/ultima1/views/full_screen_dialog.cpp
@@ -21,14 +21,13 @@
 
 #include "common/util.h"
 #include "ultima/ultima1/views/full_screen_dialog.h"
+#include "ultima/ultima1/ultima1.h"
 
 namespace Ultima {
 namespace Ultima1 {
 namespace Views {
 
 // Colors used
-constexpr int COLOR_BORDER = 1;  // blue - thick outer band
-constexpr int COLOR_EDGE = 15;   // white - thin inner highlight line
 constexpr int COLOR_NOTCH = 0;   // black - corner notch pixels
 
 void FullScreenDialog::draw() {
@@ -37,16 +36,16 @@ void FullScreenDialog::draw() {
 
 	// Thick outer border band - each edge flush against both the screen edge
 	// and the inner highlight line drawn just inside it
-	s.fillRect(Common::Rect(0, 0, 320, 7), COLOR_BORDER);
-	s.fillRect(Common::Rect(0, 7, 7, 193), COLOR_BORDER);
-	s.fillRect(Common::Rect(313, 7, 320, 193), COLOR_BORDER);
-	s.fillRect(Common::Rect(0, 193, 320, 200), COLOR_BORDER);
+	s.fillRect(Common::Rect(0, 0, 320, 7), _G(colors)._border);
+	s.fillRect(Common::Rect(0, 7, 7, 193), _G(colors)._border);
+	s.fillRect(Common::Rect(313, 7, 320, 193), _G(colors)._border);
+	s.fillRect(Common::Rect(0, 193, 320, 200), _G(colors)._border);
 
 	// Thin inner highlight line
-	s.drawLine(7, 7, 312, 7, COLOR_EDGE);
-	s.drawLine(7, 7, 7, 192, COLOR_EDGE);
-	s.drawLine(312, 7, 312, 192, COLOR_EDGE);
-	s.drawLine(7, 192, 312, 192, COLOR_EDGE);
+	s.drawLine(7, 7, 312, 7, _G(colors)._edge);
+	s.drawLine(7, 7, 7, 192, _G(colors)._edge);
+	s.drawLine(312, 7, 312, 192, _G(colors)._edge);
+	s.drawLine(7, 192, 312, 192, _G(colors)._edge);
 
 	// Diagonal-notched corners, cut as a growing staircase into each corner
 	for (int idx = 1; idx <= 4; ++idx) {
diff --git a/engines/ultima/ultima1/views/game.cpp b/engines/ultima/ultima1/views/game.cpp
index f5c7e1e35bb..2f7e76771c9 100644
--- a/engines/ultima/ultima1/views/game.cpp
+++ b/engines/ultima/ultima1/views/game.cpp
@@ -26,14 +26,13 @@
 #include "ultima/ultima1/data/tiles.h"
 #include "ultima/ultima1/metaengine.h"
 #include "graphics/views/rect.h"
+#include "ultima/ultima1/ultima1.h"
 
 namespace Ultima {
 namespace Ultima1 {
 namespace Views {
 
 // Colors used
-constexpr int COLOR_BORDER = 1;  // blue - thick outer band
-constexpr int COLOR_EDGE = 15;   // white - thin inner highlight line
 
 Game::Game() : Shared::View("Game"), _commands(this), _stats(this) {
 	setBounds(Graphics::Views::TextRect(0, 0, 39, 24));
@@ -47,9 +46,9 @@ void Game::draw() {
 	Graphics::Views::UIElement::draw();
 
 	// Vertical divider between the command/message log (left) and the stats panel (right)
-	s.fillRect(Common::Rect(241, 160, 247, 200), COLOR_BORDER);
-	s.drawLine(240, 160, 240, 199, COLOR_EDGE);
-	s.drawLine(247, 160, 247, 199, COLOR_EDGE);
+	s.fillRect(Common::Rect(241, 160, 247, 200), _G(colors)._border);
+	s.drawLine(240, 160, 240, 199, _G(colors)._edge);
+	s.drawLine(247, 160, 247, 199, _G(colors)._edge);
 }
 
 } // namespace Views
diff --git a/engines/ultima/ultima1/views/interactions/dead.cpp b/engines/ultima/ultima1/views/interactions/dead.cpp
index c1d3c546f7d..007148af4fe 100644
--- a/engines/ultima/ultima1/views/interactions/dead.cpp
+++ b/engines/ultima/ultima1/views/interactions/dead.cpp
@@ -36,7 +36,6 @@ constexpr int COUNT_DELAY = 1;
 // Hits/food the player is resurrected with
 constexpr int RESURRECTED_AMOUNT = 99;
 
-constexpr int EDGE_COLOR = 15;
 
 // The skull glyph shown while the player is dead - a 64x95 1-bit-per-pixel
 // bitmap, stored as 95 rows of 4 big-endian 16-bit words (bit 15 = leftmost
@@ -118,7 +117,7 @@ static void drawSkullGraphic(Graphics::Views::GfxSurface &s) {
 
 			for (int bit = 15; bit >= 0; --bit, ++x) {
 				if (word & (1 << bit))
-					s.setPixel(x, startY + row, EDGE_COLOR);
+					s.setPixel(x, startY + row, _G(colors)._edge);
 			}
 		}
 	}
diff --git a/engines/ultima/ultima1/views/interactions/drop.cpp b/engines/ultima/ultima1/views/interactions/drop.cpp
index 54b660c42d4..aa062f568de 100644
--- a/engines/ultima/ultima1/views/interactions/drop.cpp
+++ b/engines/ultima/ultima1/views/interactions/drop.cpp
@@ -27,7 +27,6 @@ namespace Ultima1 {
 namespace Views {
 namespace Interactions {
 
-constexpr int COLOR_TEXT = 11; // light cyan
 
 // Returns how many of items[1..maxIndex] are actually owned (index 0,
 // the innate/default state, is never droppable)
@@ -159,7 +158,7 @@ void Drop::drawItemList(const int16 *items, const char *const *names, int maxInd
 	int count = countOwned(items, maxIndex);
 	int y = 10 - count / 2;
 
-	s.setColor(COLOR_TEXT);
+	s.setColor(_G(colors)._text);
 	for (int idx = 1; idx <= maxIndex; ++idx) {
 		if (items[idx]) {
 			s.writeString(Common::Point(col, y), "%c) %s", 'a' + idx, names[idx]);
diff --git a/engines/ultima/ultima1/views/interactions/entering_craft.cpp b/engines/ultima/ultima1/views/interactions/entering_craft.cpp
index cc87ec21362..57a1447464f 100644
--- a/engines/ultima/ultima1/views/interactions/entering_craft.cpp
+++ b/engines/ultima/ultima1/views/interactions/entering_craft.cpp
@@ -29,8 +29,6 @@ namespace Ultima1 {
 namespace Views {
 namespace Interactions {
 
-constexpr int TEXT_COLOR = 11;   // light cyan - matches Commands/Stats
-constexpr int BORDER_COLOR = 1;  // dark blue
 
 // The dialog's own area (matching fillDialogArea's fill rect) and, inset
 // within it, the thin border line (matching drawDialogBorder) - both given
@@ -89,7 +87,8 @@ static const int GEM_HOLE_X[4] = { 9, 14, 19, 24 };
 constexpr int GEM_HOLE_Y = 5;
 
 // Red/Green/Blue/White, matching the gem each hole is labelled for
-static const byte GEM_COLORS[4] = { 4, 2, 9, 15 };
+static const byte EGA_GEM_COLORS[4] = { 4, 2, 9, 15 };
+static const byte CGA_GEM_COLORS[4] = { 2, 1, 1, 3 };
 
 // Per-row half-width of an 8x8 diamond, used to draw each gem as a small
 // solid diamond rather than relying on font glyphs (which the DosFont
@@ -114,7 +113,7 @@ void EnteringCraft::draw() {
 	auto s = getSurface();
 	s.fillRect(Common::Rect(0, 0, DIALOG_X2 - DIALOG_X1, DIALOG_Y2 - DIALOG_Y1), 0);
 	s.frameRect(Common::Rect(BORDER_X1 - DIALOG_X1, BORDER_Y1 - DIALOG_Y1,
-		BORDER_X2 - DIALOG_X1, BORDER_Y2 - DIALOG_Y1), BORDER_COLOR);
+		BORDER_X2 - DIALOG_X1, BORDER_Y2 - DIALOG_Y1), _G(colors)._border);
 
 	drawPageText();
 	if (_page == 1)
@@ -147,14 +146,16 @@ void EnteringCraft::drawPageText() {
 	}
 
 	auto s = getSurface();
-	s.setColor(TEXT_COLOR);
+	s.setColor(_G(colors)._text);
 	for (int i = 0; i < count; ++i)
 		s.writeString(Common::Point(lines[i]._x, lines[i]._y), lines[i]._text);
 }
 
 void EnteringCraft::drawGemHoles() {
+	const byte *colors = (_G(renderMode) == Data::RENDER_CGA) ? CGA_GEM_COLORS : EGA_GEM_COLORS;
+
 	for (int i = 0; i < 4; ++i)
-		drawGem(GEM_HOLE_X[i], GEM_HOLE_Y, GEM_COLORS[i]);
+		drawGem(GEM_HOLE_X[i], GEM_HOLE_Y, colors[i]);
 }
 
 void EnteringCraft::drawGem(int cellX, int cellY, byte color) {
diff --git a/engines/ultima/ultima1/views/interactions/lose.cpp b/engines/ultima/ultima1/views/interactions/lose.cpp
index bdae6b7d932..f634e06716c 100644
--- a/engines/ultima/ultima1/views/interactions/lose.cpp
+++ b/engines/ultima/ultima1/views/interactions/lose.cpp
@@ -27,8 +27,6 @@ namespace Ultima1 {
 namespace Views {
 namespace Interactions {
 
-constexpr int TEXT_COLOR = 15;   // white
-constexpr int BORDER_COLOR = 1;  // dark blue
 
 // Same generic drawDialog box geometry the Win cutscene uses
 constexpr int DIALOG_X1 = 31, DIALOG_Y1 = 23, DIALOG_X2 = 287, DIALOG_Y2 = 127;
@@ -52,9 +50,9 @@ void Lose::draw() {
 void Lose::drawDialog() {
 	auto s = getSurface();
 	s.fillRect(Common::Rect(DIALOG_X1, DIALOG_Y1, DIALOG_X2, DIALOG_Y2), 0);
-	s.frameRect(Common::Rect(BORDER_X1, BORDER_Y1, BORDER_X2, BORDER_Y2), BORDER_COLOR);
+	s.frameRect(Common::Rect(BORDER_X1, BORDER_Y1, BORDER_X2, BORDER_Y2), _G(colors)._border);
 
-	s.setColor(TEXT_COLOR);
+	s.setColor(_G(colors)._edge);
 	s.writeString(Common::Point(5, 6), "   Thou hast been defeated by");
 	s.writeString(Common::Point(5, 7), "      Mondain the Wizard!");
 	s.writeString(Common::Point(5, 12), "    THE UNIVERSE IS DOOMED!");
diff --git a/engines/ultima/ultima1/views/interactions/merchant.cpp b/engines/ultima/ultima1/views/interactions/merchant.cpp
index 66d26deb663..de8246ea983 100644
--- a/engines/ultima/ultima1/views/interactions/merchant.cpp
+++ b/engines/ultima/ultima1/views/interactions/merchant.cpp
@@ -28,7 +28,6 @@ namespace Ultima1 {
 namespace Views {
 namespace Interactions {
 
-constexpr int COLOR_TEXT = 11; // light cyan
 
 struct ShopName {
 	const char *_line1;
@@ -241,7 +240,7 @@ void Merchant::drawShopName() {
 		return;
 
 	auto s = getSurface();
-	s.setColor(COLOR_TEXT);
+	s.setColor(_G(colors)._text);
 	s.writeString(Common::Point(19 - (int)Common::String(name._line1).size() / 2, 2), "%s", name._line1);
 	if (name._line2)
 		s.writeString(Common::Point(19 - (int)Common::String(name._line2).size() / 2, 3), "%s", name._line2);
@@ -412,7 +411,7 @@ void Merchant::chooseSell() {
 void Merchant::drawArmoryBuy() {
 	drawShopName();
 	auto s = getSurface();
-	s.setColor(COLOR_TEXT);
+	s.setColor(_G(colors)._text);
 
 	int maxIdx = (_G(moveCtr) > 3000) ? 5 : 3;
 	int y = 8;
@@ -453,7 +452,7 @@ void Merchant::armoryBuyKeypress(Common::KeyCode keycode) {
 void Merchant::drawArmorySell() {
 	drawShopName();
 	auto s = getSurface();
-	s.setColor(COLOR_TEXT);
+	s.setColor(_G(colors)._text);
 
 	int y = 8;
 	for (int idx = 1; idx < Data::ARMOR_COUNT; ++idx) {
@@ -505,7 +504,7 @@ void Merchant::weaponsRange(int &minIdx, int &maxIdx) const {
 void Merchant::drawWeaponsBuy() {
 	drawShopName();
 	auto s = getSurface();
-	s.setColor(COLOR_TEXT);
+	s.setColor(_G(colors)._text);
 
 	int minIdx, maxIdx;
 	weaponsRange(minIdx, maxIdx);
@@ -549,7 +548,7 @@ void Merchant::weaponsBuyKeypress(Common::KeyCode keycode) {
 void Merchant::drawWeaponsSell() {
 	drawShopName();
 	auto s = getSurface();
-	s.setColor(COLOR_TEXT);
+	s.setColor(_G(colors)._text);
 
 	int y = 6;
 	for (int idx = 1; idx < Data::WEAPON_COUNT; ++idx) {
@@ -595,7 +594,7 @@ void Merchant::magicRange(int &minIdx, int &maxIdx) const {
 void Merchant::drawMagicBuy() {
 	drawShopName();
 	auto s = getSurface();
-	s.setColor(COLOR_TEXT);
+	s.setColor(_G(colors)._text);
 
 	int minIdx, maxIdx;
 	magicRange(minIdx, maxIdx);
@@ -739,7 +738,7 @@ void Merchant::tavernBuy() {
 void Merchant::drawTransportBuy() {
 	drawShopName();
 	auto s = getSurface();
-	s.setColor(COLOR_TEXT);
+	s.setColor(_G(colors)._text);
 
 	int y = 8;
 	for (int i = 0; i < 6; ++i, ++y) {
diff --git a/engines/ultima/ultima1/views/interactions/pillar.cpp b/engines/ultima/ultima1/views/interactions/pillar.cpp
index 3dc0c33fc94..a276dc85212 100644
--- a/engines/ultima/ultima1/views/interactions/pillar.cpp
+++ b/engines/ultima/ultima1/views/interactions/pillar.cpp
@@ -28,9 +28,6 @@ namespace Ultima1 {
 namespace Views {
 namespace Interactions {
 
-constexpr int COLOR_TEXT = 11;   // light cyan - matches Commands/Stats
-constexpr int COLOR_BORDER = 1;  // dark blue
-constexpr int COLOR_EDGE = 15;   // white - brief "success" flash colour
 
 // The dialog box's own area, and the thin border line inset within it -
 // both given here in absolute screen pixels, as in the original
@@ -77,7 +74,7 @@ bool Pillar::msgGame(const GameMessage &msg) {
 
 bool Pillar::msgFocus(const FocusMessage &msg) {
 	setBounds(Graphics::Views::TextRect(0, 0, 39, 19));
-	_borderColor = COLOR_BORDER;
+	_borderColor = _G(colors)._border;
 
 	auto &sg = _G(savegame);
 	bool success;
@@ -100,7 +97,7 @@ bool Pillar::msgFocus(const FocusMessage &msg) {
 
 	if (success) {
 		// Flash the border briefly to celebrate the reward
-		_borderColor = COLOR_EDGE;
+		_borderColor = _G(colors)._edge;
 		g_engine->playFX(5);
 		delaySeconds(1);
 	} else if (_locationNum != 6) {
@@ -113,7 +110,7 @@ bool Pillar::msgFocus(const FocusMessage &msg) {
 }
 
 void Pillar::timeout() {
-	_borderColor = COLOR_BORDER;
+	_borderColor = _G(colors)._border;
 	redraw();
 }
 
@@ -122,7 +119,7 @@ void Pillar::draw() {
 	s.fillRect(Common::Rect(DIALOG_X1, DIALOG_Y1, DIALOG_X2, DIALOG_Y2), 0);
 	s.frameRect(Common::Rect(BORDER_X1, BORDER_Y1, BORDER_X2, BORDER_Y2), _borderColor);
 
-	s.setColor(COLOR_TEXT);
+	s.setColor(_G(colors)._text);
 	drawInscription();
 }
 
diff --git a/engines/ultima/ultima1/views/interactions/ready.cpp b/engines/ultima/ultima1/views/interactions/ready.cpp
index afa8c932071..2be6ae8ce51 100644
--- a/engines/ultima/ultima1/views/interactions/ready.cpp
+++ b/engines/ultima/ultima1/views/interactions/ready.cpp
@@ -27,7 +27,6 @@ namespace Ultima1 {
 namespace Views {
 namespace Interactions {
 
-constexpr int COLOR_TEXT = 11; // light cyan
 
 Ready::Ready() : Interaction("Ready") {
 }
@@ -154,7 +153,7 @@ void Ready::drawItemList(const int16 *items, const char *const *names, int maxIn
 	}
 
 	int y = 10 - count / 2;
-	s.setColor(COLOR_TEXT);
+	s.setColor(_G(colors)._text);
 
 	for (int idx = 0; idx <= maxIndex; ++idx) {
 		if (items[idx]) {
diff --git a/engines/ultima/ultima1/views/interactions/sector_scan.cpp b/engines/ultima/ultima1/views/interactions/sector_scan.cpp
index cbd382033f6..1a48394bed0 100644
--- a/engines/ultima/ultima1/views/interactions/sector_scan.cpp
+++ b/engines/ultima/ultima1/views/interactions/sector_scan.cpp
@@ -32,11 +32,6 @@ namespace Interactions {
 constexpr int DIALOG_X1 = 31, DIALOG_Y1 = 23, DIALOG_X2 = 287, DIALOG_Y2 = 127;
 constexpr int BORDER_X1 = 34, BORDER_Y1 = 26, BORDER_X2 = 284, BORDER_Y2 = 124;
 
-constexpr int TEXT_COLOR = 15;
-constexpr int FRAME_COLOR = 1;
-constexpr int MARKER_COLOR = 15;
-constexpr int EMPTY_HILIGHT_COLOR = 14;
-constexpr int EMPTY_DIM_COLOR = 1;
 
 // The scan grid's own outline, and where sector (sx, sy)'s glyph sits
 // within it - matching the original's drawSectorMapIcon
@@ -60,16 +55,16 @@ void SectorScan::draw() {
 
 	// Inset dialog box
 	s.fillRect(Common::Rect(DIALOG_X1, DIALOG_Y1, DIALOG_X2, DIALOG_Y2), 0);
-	s.frameRect(Common::Rect(BORDER_X1, BORDER_Y1, BORDER_X2, BORDER_Y2), FRAME_COLOR);
+	s.frameRect(Common::Rect(BORDER_X1, BORDER_Y1, BORDER_X2, BORDER_Y2), _G(colors)._border);
 
-	s.setColor(TEXT_COLOR);
+	s.setColor(_G(colors)._edge);
 	s.writeString(Common::Point(5, 4), "Sector Scan:");
 
 	// The scan grid outline
-	s.drawLine(GRID_X1, GRID_Y1, GRID_X2, GRID_Y1, MARKER_COLOR);
-	s.drawLine(GRID_X2, GRID_Y1, GRID_X2, GRID_Y2, MARKER_COLOR);
-	s.drawLine(GRID_X2, GRID_Y2, GRID_X1, GRID_Y2, MARKER_COLOR);
-	s.drawLine(GRID_X1, GRID_Y2, GRID_X1, GRID_Y1, MARKER_COLOR);
+	s.drawLine(GRID_X1, GRID_Y1, GRID_X2, GRID_Y1, _G(colors)._edge);
+	s.drawLine(GRID_X2, GRID_Y1, GRID_X2, GRID_Y2, _G(colors)._edge);
+	s.drawLine(GRID_X2, GRID_Y2, GRID_X1, GRID_Y2, _G(colors)._edge);
+	s.drawLine(GRID_X1, GRID_Y2, GRID_X1, GRID_Y1, _G(colors)._edge);
 
 	// One glyph per sector
 	for (int sx = 0; sx < Data::SPACE_SECTOR_COUNT; ++sx)
@@ -101,35 +96,35 @@ void SectorScan::drawSectorIcon(Graphics::Views::GfxSurface &s, int sx, int sy)
 void SectorScan::drawEnemyMarker(Graphics::Views::GfxSurface &s, int x, int y) {
 	// Two side bars each end, two rungs across the middle - a fighter shape
 	for (int i = 0; i < 2; ++i) {
-		s.drawLine(x + i, y, x + i, y + 7, MARKER_COLOR);
-		s.drawLine(x + i + 5, y, x + i + 5, y + 7, MARKER_COLOR);
-		s.drawLine(x, y + 3 + i, x + 6, y + 3 + i, MARKER_COLOR);
+		s.drawLine(x + i, y, x + i, y + 7, _G(colors)._edge);
+		s.drawLine(x + i + 5, y, x + i + 5, y + 7, _G(colors)._edge);
+		s.drawLine(x, y + 3 + i, x + 6, y + 3 + i, _G(colors)._edge);
 	}
 }
 
 void SectorScan::drawStationMarker(Graphics::Views::GfxSurface &s, int x, int y) {
 	// A cross
 	for (int i = 0; i < 2; ++i) {
-		s.drawLine(x + i + 3, y, x + i + 3, y + 7, MARKER_COLOR);
-		s.drawLine(x, y + i + 3, x + 7, y + i + 3, MARKER_COLOR);
+		s.drawLine(x + i + 3, y, x + i + 3, y + 7, _G(colors)._edge);
+		s.drawLine(x, y + i + 3, x + 7, y + i + 3, _G(colors)._edge);
 	}
 }
 
 void SectorScan::drawStarMarker(Graphics::Views::GfxSurface &s, int x, int y) {
 	// A small diamond
 	for (int i = 0; i < 3; ++i) {
-		s.drawLine(x + 3 - i, y + i + 1, x + 3 + i, y + i + 1, MARKER_COLOR);
-		s.drawLine(x + 3 - i, y + 6 - i, x + 3 + i, y + 6 - i, MARKER_COLOR);
+		s.drawLine(x + 3 - i, y + i + 1, x + 3 + i, y + i + 1, _G(colors)._edge);
+		s.drawLine(x + 3 - i, y + 6 - i, x + 3 + i, y + 6 - i, _G(colors)._edge);
 	}
 }
 
 void SectorScan::drawEmptyMarker(Graphics::Views::GfxSurface &s, int x, int y) {
 	// A sparse scattering of dots
-	s.setPixel(x + 1, y + 1, MARKER_COLOR);
-	s.setPixel(x + 3, y + 3, EMPTY_HILIGHT_COLOR);
-	s.setPixel(x + 6, y + 2, EMPTY_DIM_COLOR);
-	s.setPixel(x + 4, y + 5, MARKER_COLOR);
-	s.setPixel(x + 2, y + 6, EMPTY_DIM_COLOR);
+	s.setPixel(x + 1, y + 1, _G(colors)._edge);
+	s.setPixel(x + 3, y + 3, _G(colors)._highlight);
+	s.setPixel(x + 6, y + 2, _G(colors)._border);
+	s.setPixel(x + 4, y + 5, _G(colors)._edge);
+	s.setPixel(x + 2, y + 6, _G(colors)._border);
 }
 
 bool SectorScan::tick() {
diff --git a/engines/ultima/ultima1/views/interactions/win.cpp b/engines/ultima/ultima1/views/interactions/win.cpp
index 242b4c9d0a1..27f5b2edc53 100644
--- a/engines/ultima/ultima1/views/interactions/win.cpp
+++ b/engines/ultima/ultima1/views/interactions/win.cpp
@@ -28,8 +28,6 @@ namespace Ultima1 {
 namespace Views {
 namespace Interactions {
 
-constexpr int TEXT_COLOR = 15;   // white
-constexpr int BORDER_COLOR = 1;  // dark blue
 
 // The small "Mondain is dead!" dialog reuses the same generic drawDialog
 // box geometry as Pillar's inscription dialog - both come from the
@@ -86,7 +84,7 @@ bool Win::msgFocus(const FocusMessage &msg) {
 
 void Win::renderEndingText() {
 	_textSurface.create(ENDING_WIDTH, ENDING_HEIGHT, Graphics::PixelFormat::createFormatCLUT8());
-	_textSurface.setColor(TEXT_COLOR);
+	_textSurface.setColor(_G(colors)._edge);
 
 	for (int i = 0; i < ARRAYSIZE(ENDING_TEXT); ++i)
 		_textSurface.writeString(Common::Point(0, i), ENDING_TEXT[i]);
@@ -106,9 +104,9 @@ void Win::draw() {
 void Win::drawDialog() {
 	auto s = getSurface();
 	s.fillRect(Common::Rect(DIALOG_X1, DIALOG_Y1, DIALOG_X2, DIALOG_Y2), 0);
-	s.frameRect(Common::Rect(BORDER_X1, BORDER_Y1, BORDER_X2, BORDER_Y2), BORDER_COLOR);
+	s.frameRect(Common::Rect(BORDER_X1, BORDER_Y1, BORDER_X2, BORDER_Y2), _G(colors)._border);
 
-	s.setColor(TEXT_COLOR);
+	s.setColor(_G(colors)._edge);
 	s.writeString(Common::Point(11, 8), "THOU ART VICTORIOUS!");
 }
 
diff --git a/engines/ultima/ultima1/views/main_menu.cpp b/engines/ultima/ultima1/views/main_menu.cpp
index 88766961e22..c6cdc57b3c8 100644
--- a/engines/ultima/ultima1/views/main_menu.cpp
+++ b/engines/ultima/ultima1/views/main_menu.cpp
@@ -27,8 +27,6 @@ namespace Ultima1 {
 namespace Views {
 
 // Colors used
-constexpr int COLOR_EDGE = 15; // white - used for the title/tagline
-constexpr int COLOR_TEXT = 11; // light cyan - used for the menu options
 
 MainMenu::MainMenu() : FullScreenDialog("MainMenu"), _cursor("Cursor", this) {
 	// Position the cursor right after "Thy choice: "
@@ -39,13 +37,13 @@ void MainMenu::draw() {
 	FullScreenDialog::draw();
 
 	auto s = getSurface();
-	s.setColor(COLOR_EDGE);
+	s.setColor(_G(colors)._edge);
 	s.writeString(Common::Point(12, 6), "*** Ultima I ***");
 	s.writeString(Common::Point(14, 9), "from darkest");
 	s.writeString(Common::Point(14, 10), "dungeons, to");
 	s.writeString(Common::Point(13, 11), "deepest space!");
 
-	s.setColor(COLOR_TEXT);
+	s.setColor(_G(colors)._text);
 	s.writeString(Common::Point(8, 14), "a) Generate new character");
 	s.writeString(Common::Point(8, 15), "b) Continue previous game");
 	s.writeString(Common::Point(13, 18), "Thy choice: ");
diff --git a/engines/ultima/ultima1/views/space_cockpit.cpp b/engines/ultima/ultima1/views/space_cockpit.cpp
index 5fcf385df20..a4ee7a53a8c 100644
--- a/engines/ultima/ultima1/views/space_cockpit.cpp
+++ b/engines/ultima/ultima1/views/space_cockpit.cpp
@@ -30,10 +30,7 @@ namespace Ultima {
 namespace Ultima1 {
 namespace Views {
 
-constexpr int FRAME_COLOR = 7;		// light grey cockpit surround
-constexpr int STAR_COLOR = 15;		// white stars / crosshair
 constexpr int RIVET_COLOR = 0;		// black detail punched into the frame
-constexpr int LASER_COLOR = 12;	// light red laser-bolt flash
 
 // How many ticks the laser-bolt flash from fireLaser() stays on-screen
 constexpr int LASER_FLASH_TICKS = 3;
@@ -68,8 +65,8 @@ void SpaceCockpit::draw() {
 	const Data::SpaceStarfield &sf = _G(starfield);
 
 	// The aiming crosshair marking the viewport centre
-	s.drawLine(sf._centerX - 2, sf._centerY, sf._centerX + 2, sf._centerY, STAR_COLOR);
-	s.drawLine(sf._centerX, sf._centerY - 2, sf._centerX, sf._centerY + 2, STAR_COLOR);
+	s.drawLine(sf._centerX - 2, sf._centerY, sf._centerX + 2, sf._centerY, _G(colors)._edge);
+	s.drawLine(sf._centerX, sf._centerY - 2, sf._centerX, sf._centerY + 2, _G(colors)._edge);
 
 	if (_hyperjumpState == HYPERJUMP_WARP_IN || _hyperjumpState == HYPERJUMP_WARP_OUT) {
 		// The stars along with all the trails behind them
@@ -80,7 +77,7 @@ void SpaceCockpit::draw() {
 			int x = sf._centerX + sf._starX[i];
 			int y = sf._centerY + sf._starY[i];
 			if (Data::SpaceStarfield::withinView(x, y))
-				s.setPixel(x, y, STAR_COLOR);
+				s.setPixel(x, y, _G(colors)._edge);
 		}
 	}
 
@@ -93,13 +90,13 @@ void SpaceCockpit::draw() {
 	// The brief laser-bolt flash from a shot just fired, converging on the
 	// crosshair from both bottom corners of the viewport
 	if (_laserFlashTicks > 0) {
-		s.drawLine(LASER_ORIGIN_LEFT_X, LASER_ORIGIN_Y, sf._centerX, sf._centerY, LASER_COLOR);
-		s.drawLine(LASER_ORIGIN_RIGHT_X, LASER_ORIGIN_Y, sf._centerX, sf._centerY, LASER_COLOR);
+		s.drawLine(LASER_ORIGIN_LEFT_X, LASER_ORIGIN_Y, sf._centerX, sf._centerY, _G(colors)._highlight);
+		s.drawLine(LASER_ORIGIN_RIGHT_X, LASER_ORIGIN_Y, sf._centerX, sf._centerY, _G(colors)._highlight);
 	}
 
 	// The brief laser-bolt flash from the current target firing back
 	if (_alienFlashTicks > 0)
-		s.drawLine(_alienFlashX1, _alienFlashY1, _alienFlashX2, _alienFlashY2, LASER_COLOR);
+		s.drawLine(_alienFlashX1, _alienFlashY1, _alienFlashX2, _alienFlashY2, _G(colors)._highlight);
 }
 
 bool SpaceCockpit::msgMouseMove(const MouseMoveMessage &msg) {
@@ -219,7 +216,7 @@ void SpaceCockpit::hyperjumpFrame() {
 		sf.advance();
 		for (int i = 0; i < Data::SPACE_STAR_COUNT; ++i) {
 			if (sf._visible[i])
-				plotTrail(sf._prevX[i], sf._prevY[i], STAR_COLOR);
+				plotTrail(sf._prevX[i], sf._prevY[i], _G(colors)._edge);
 		}
 
 		if (--_hyperjumpFrames == 0) {
@@ -239,7 +236,7 @@ void SpaceCockpit::hyperjumpFrame() {
 		sf.advance();
 		for (int i = 0; i < Data::SPACE_STAR_COUNT; ++i) {
 			if (sf._visible[i])
-				plotTrail(sf._prevX[i], sf._prevY[i], STAR_COLOR);
+				plotTrail(sf._prevX[i], sf._prevY[i], _G(colors)._edge);
 		}
 
 		if (--_hyperjumpFrames == 0) {
@@ -331,10 +328,10 @@ bool SpaceCockpit::msgKeypress(const KeypressMessage &msg) {
 
 void SpaceCockpit::drawCockpitFrame(Graphics::Views::GfxSurface &s) {
 	// The ~7px surround around the viewport
-	s.fillRect(Common::Rect(8, 8, 312, 16), FRAME_COLOR);
-	s.fillRect(Common::Rect(8, 144, 312, 152), FRAME_COLOR);
-	s.fillRect(Common::Rect(8, 16, 16, 145), FRAME_COLOR);
-	s.fillRect(Common::Rect(304, 16, 312, 145), FRAME_COLOR);
+	s.fillRect(Common::Rect(8, 8, 312, 16), _G(colors)._cockpitFrame);
+	s.fillRect(Common::Rect(8, 144, 312, 152), _G(colors)._cockpitFrame);
+	s.fillRect(Common::Rect(8, 16, 16, 145), _G(colors)._cockpitFrame);
+	s.fillRect(Common::Rect(304, 16, 312, 145), _G(colors)._cockpitFrame);
 
 	// Rivet detail along the top and bottom
 	for (int i = 1; i < 20; ++i) {
diff --git a/engines/ultima/ultima1/views/space_game.cpp b/engines/ultima/ultima1/views/space_game.cpp
index 7cd32d011c3..837870bf7c0 100644
--- a/engines/ultima/ultima1/views/space_game.cpp
+++ b/engines/ultima/ultima1/views/space_game.cpp
@@ -21,14 +21,13 @@
 
 #include "ultima/ultima1/views/space_game.h"
 #include "graphics/views/rect.h"
+#include "ultima/ultima1/ultima1.h"
 
 namespace Ultima {
 namespace Ultima1 {
 namespace Views {
 
 // Colors used
-constexpr int COLOR_BORDER = 1;  // blue - thick outer band
-constexpr int COLOR_EDGE = 15;   // white - thin inner highlight line
 
 SpaceGame::SpaceGame() : Shared::View("SpaceGame"), _commands(this), _stats(this) {
 	setBounds(Graphics::Views::TextRect(0, 0, 39, 24));
@@ -42,9 +41,9 @@ void SpaceGame::draw() {
 	Graphics::Views::UIElement::draw();
 
 	// Divider between the command/message log (left) and the stats corner
-	s.fillRect(Common::Rect(241, 160, 247, 200), COLOR_BORDER);
-	s.drawLine(240, 160, 240, 199, COLOR_EDGE);
-	s.drawLine(247, 160, 247, 199, COLOR_EDGE);
+	s.fillRect(Common::Rect(241, 160, 247, 200), _G(colors)._border);
+	s.drawLine(240, 160, 240, 199, _G(colors)._edge);
+	s.drawLine(247, 160, 247, 199, _G(colors)._edge);
 }
 
 } // namespace Views
diff --git a/engines/ultima/ultima1/views/space_map.cpp b/engines/ultima/ultima1/views/space_map.cpp
index 48982fb68d9..a04b2364165 100644
--- a/engines/ultima/ultima1/views/space_map.cpp
+++ b/engines/ultima/ultima1/views/space_map.cpp
@@ -31,14 +31,6 @@ namespace Views {
 // outlines - the disassembly's own hardcoded non-CGA fallback values for
 // drawStarGraphic/drawStationGraphic, and (for the ships) the closest
 // equivalents already established elsewhere in this port's space UI
-constexpr int STAR_COLOR_1 = 12;
-constexpr int STAR_COLOR_2 = 14;
-constexpr int ANCHOR_COLOR = 15;
-constexpr int STATION_COLOR_HILIGHT = 1;
-constexpr int STATION_COLOR_BORDER = 10;
-constexpr int STATION_COLOR_EDGE = 7;
-constexpr int EXHAUST_COLOR_MAIN = 12;
-constexpr int EXHAUST_COLOR_HILIGHT = 14;
 
 // Bounds plotShipPixelBounded clips the exhaust trail's individual pixels to
 static bool withinShipView(int x, int y) {
@@ -96,7 +88,7 @@ static void drawWrappedTile(Graphics::Views::GfxSurface &s, const Graphics::Mana
 }
 
 // Star/heat hazard bitmap (18 rows x 19 cols), matching SPACE.EXE's own raw
-// table for drawStarGraphic. 1 -> STAR_COLOR_1, 2 -> STAR_COLOR_2
+// table for drawStarGraphic. 1 -> _G(colors)._star1, 2 -> _G(colors)._star2
 static const int8 STAR_BITMAP[18][19] = {
 	{ 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0 },
 	{ 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0 },
@@ -119,7 +111,7 @@ static const int8 STAR_BITMAP[18][19] = {
 };
 
 // Docking/encounter anchor bitmap (20 rows x 20 cols), matching SPACE.EXE's
-// own raw table for drawPlanetGraphic. Any nonzero value -> ANCHOR_COLOR
+// own raw table for drawPlanetGraphic. Any nonzero value -> _G(colors)._edge
 static const int8 PLANET_BITMAP[20][20] = {
 	{ 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0 },
 	{ 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0 },
@@ -144,8 +136,8 @@ static const int8 PLANET_BITMAP[20][20] = {
 };
 
 // Space station bitmap (18 rows x 21 cols), matching SPACE.EXE's own raw
-// table for drawStationGraphic. 1/2 -> STATION_COLOR_HILIGHT,
-// 4 -> STATION_COLOR_EDGE, 3 -> STATION_COLOR_BORDER
+// table for drawStationGraphic. 1/2 -> _G(colors)._stationHighlight,
+// 4 -> _G(colors)._stationEdge, 3 -> _G(colors)._stationBorder
 static const int8 STATION_BITMAP[18][21] = {
 	{ 0, 0, 0, 0, 0, 0, 0, 0, 4, 4, 4, 4, 4, 0, 0, 0, 0, 0, 0, 0, 0 },
 	{ 0, 0, 0, 0, 0, 0, 4, 1, 1, 1, 1, 1, 1, 1, 4, 0, 0, 0, 0, 0, 0 },
@@ -223,10 +215,10 @@ void SpaceMap::drawStarGraphic(Graphics::Views::GfxSurface &s, int x, int y) {
 		for (int col = 0; col < 19; ++col) {
 			switch (STAR_BITMAP[row][col]) {
 			case 1:
-				s.setPixel(x + col, y + row, STAR_COLOR_1);
+				s.setPixel(x + col, y + row, _G(colors)._star1);
 				break;
 			case 2:
-				s.setPixel(x + col, y + row, STAR_COLOR_2);
+				s.setPixel(x + col, y + row, _G(colors)._star2);
 				break;
 			default:
 				break;
@@ -239,7 +231,7 @@ void SpaceMap::drawPlanetGraphic(Graphics::Views::GfxSurface &s, int x, int y) {
 	for (int row = 0; row < 20; ++row) {
 		for (int col = 0; col < 20; ++col) {
 			if (PLANET_BITMAP[row][col] != 0)
-				s.setPixel(x + col, y + row, ANCHOR_COLOR);
+				s.setPixel(x + col, y + row, _G(colors)._edge);
 		}
 	}
 }
@@ -250,13 +242,13 @@ void SpaceMap::drawStationGraphic(Graphics::Views::GfxSurface &s, int x, int y)
 			switch (STATION_BITMAP[row][col]) {
 			case 1:
 			case 2:
-				s.setPixel(x + col, y + row, STATION_COLOR_HILIGHT);
+				s.setPixel(x + col, y + row, _G(colors)._stationHighlight);
 				break;
 			case 4:
-				s.setPixel(x + col, y + row, STATION_COLOR_EDGE);
+				s.setPixel(x + col, y + row, _G(colors)._stationEdge);
 				break;
 			case 3:
-				s.setPixel(x + col, y + row, STATION_COLOR_BORDER);
+				s.setPixel(x + col, y + row, _G(colors)._stationBorder);
 				break;
 			default:
 				break;
@@ -295,55 +287,55 @@ void SpaceMap::drawShuttleExhaust(Graphics::Views::GfxSurface &s, int x, int y,
 	switch (facing) {
 	case Data::FACING_LEFT:
 		for (int i = 0; i < 3; ++i) {
-			plot(x + 19, y + 4 + i, EXHAUST_COLOR_MAIN);
-			plot(x + 19, y + 11 + i, EXHAUST_COLOR_MAIN);
+			plot(x + 19, y + 4 + i, _G(colors)._shuttle);
+			plot(x + 19, y + 11 + i, _G(colors)._shuttle);
 		}
-		plot(x + 20, y + 5, EXHAUST_COLOR_HILIGHT);
-		plot(x + 20, y + 6, EXHAUST_COLOR_HILIGHT);
-		plot(x + 20, y + 11, EXHAUST_COLOR_HILIGHT);
-		plot(x + 20, y + 12, EXHAUST_COLOR_HILIGHT);
-		plot(x + 21, y + 6, EXHAUST_COLOR_MAIN);
-		plot(x + 21, y + 11, EXHAUST_COLOR_MAIN);
+		plot(x + 20, y + 5, _G(colors)._edge);
+		plot(x + 20, y + 6, _G(colors)._edge);
+		plot(x + 20, y + 11, _G(colors)._edge);
+		plot(x + 20, y + 12, _G(colors)._edge);
+		plot(x + 21, y + 6, _G(colors)._shuttle);
+		plot(x + 21, y + 11, _G(colors)._shuttle);
 		break;
 
 	case Data::FACING_RIGHT:
 		for (int i = 0; i < 3; ++i) {
-			plot(x - 1, y + 4 + i, EXHAUST_COLOR_MAIN);
-			plot(x - 1, y + 11 + i, EXHAUST_COLOR_MAIN);
+			plot(x - 1, y + 4 + i, _G(colors)._shuttle);
+			plot(x - 1, y + 11 + i, _G(colors)._shuttle);
 		}
-		plot(x - 2, y + 5, EXHAUST_COLOR_HILIGHT);
-		plot(x - 2, y + 6, EXHAUST_COLOR_HILIGHT);
-		plot(x - 2, y + 11, EXHAUST_COLOR_HILIGHT);
-		plot(x - 2, y + 12, EXHAUST_COLOR_HILIGHT);
-		plot(x - 3, y + 6, EXHAUST_COLOR_MAIN);
-		plot(x - 3, y + 11, EXHAUST_COLOR_MAIN);
+		plot(x - 2, y + 5, _G(colors)._edge);
+		plot(x - 2, y + 6, _G(colors)._edge);
+		plot(x - 2, y + 11, _G(colors)._edge);
+		plot(x - 2, y + 12, _G(colors)._edge);
+		plot(x - 3, y + 6, _G(colors)._shuttle);
+		plot(x - 3, y + 11, _G(colors)._shuttle);
 		break;
 
 	case Data::FACING_UP:
 		for (int i = 0; i < 3; ++i) {
-			plot(x + 5 + i, y + 19, EXHAUST_COLOR_MAIN);
-			plot(x + 12 + i, y + 19, EXHAUST_COLOR_MAIN);
+			plot(x + 5 + i, y + 19, _G(colors)._shuttle);
+			plot(x + 12 + i, y + 19, _G(colors)._shuttle);
 		}
-		plot(x + 6, y + 20, EXHAUST_COLOR_HILIGHT);
-		plot(x + 7, y + 20, EXHAUST_COLOR_HILIGHT);
-		plot(x + 12, y + 20, EXHAUST_COLOR_HILIGHT);
-		plot(x + 13, y + 20, EXHAUST_COLOR_HILIGHT);
-		plot(x + 7, y + 21, EXHAUST_COLOR_MAIN);
-		plot(x + 12, y + 21, EXHAUST_COLOR_MAIN);
+		plot(x + 6, y + 20, _G(colors)._edge);
+		plot(x + 7, y + 20, _G(colors)._edge);
+		plot(x + 12, y + 20, _G(colors)._edge);
+		plot(x + 13, y + 20, _G(colors)._edge);
+		plot(x + 7, y + 21, _G(colors)._shuttle);
+		plot(x + 12, y + 21, _G(colors)._shuttle);
 		break;
 
 	case Data::FACING_DOWN:
 	default:
 		for (int i = 0; i < 3; ++i) {
-			plot(x + 5 + i, y - 1, EXHAUST_COLOR_MAIN);
-			plot(x + 12 + i, y - 1, EXHAUST_COLOR_MAIN);
+			plot(x + 5 + i, y - 1, _G(colors)._shuttle);
+			plot(x + 12 + i, y - 1, _G(colors)._shuttle);
 		}
-		plot(x + 6, y - 2, EXHAUST_COLOR_HILIGHT);
-		plot(x + 7, y - 2, EXHAUST_COLOR_HILIGHT);
-		plot(x + 12, y - 2, EXHAUST_COLOR_HILIGHT);
-		plot(x + 13, y - 2, EXHAUST_COLOR_HILIGHT);
-		plot(x + 7, y - 3, EXHAUST_COLOR_MAIN);
-		plot(x + 12, y - 3, EXHAUST_COLOR_MAIN);
+		plot(x + 6, y - 2, _G(colors)._edge);
+		plot(x + 7, y - 2, _G(colors)._edge);
+		plot(x + 12, y - 2, _G(colors)._edge);
+		plot(x + 13, y - 2, _G(colors)._edge);
+		plot(x + 7, y - 3, _G(colors)._shuttle);
+		plot(x + 12, y - 3, _G(colors)._shuttle);
 		break;
 	}
 }
@@ -351,7 +343,7 @@ void SpaceMap::drawShuttleExhaust(Graphics::Views::GfxSurface &s, int x, int y,
 void SpaceMap::drawSmallFighterExhaust(Graphics::Views::GfxSurface &s, int x, int y, int facing) {
 	auto plot = [&s](int px, int py) {
 		if (withinShipView(px, py))
-			s.setPixel(px, py, EXHAUST_COLOR_MAIN);
+			s.setPixel(px, py, _G(colors)._shuttle);
 	};
 
 	switch (facing) {
@@ -413,7 +405,7 @@ void SpaceMap::drawSmallFighterExhaust(Graphics::Views::GfxSurface &s, int x, in
 void SpaceMap::drawLargeFighterExhaust(Graphics::Views::GfxSurface &s, int x, int y, int facing) {
 	auto plot = [&s](int px, int py) {
 		if (withinShipView(px, py))
-			s.setPixel(px, py, EXHAUST_COLOR_MAIN);
+			s.setPixel(px, py, _G(colors)._shuttle);
 	};
 
 	switch (facing) {
diff --git a/engines/ultima/ultima1/views/space_stats.cpp b/engines/ultima/ultima1/views/space_stats.cpp
index 4f9c471838c..853d22f0323 100644
--- a/engines/ultima/ultima1/views/space_stats.cpp
+++ b/engines/ultima/ultima1/views/space_stats.cpp
@@ -27,8 +27,6 @@ namespace Ultima {
 namespace Ultima1 {
 namespace Views {
 
-constexpr int COLOR_TEXT = 11;			// light cyan - normal values
-constexpr int COLOR_HIGHLIGHT = 12;		// light red - low shield/fuel warning
 
 void SpaceStats::draw() {
 	Data::Savegame &p = _G(savegame);
@@ -45,17 +43,17 @@ void SpaceStats::draw() {
 
 	// Shield and fuel go red once they're running low, matching
 	// displayShieldNumber / displayFuelNumber
-	s.setColor(COLOR_TEXT);
+	s.setColor(_G(colors)._text);
 	s.writeString(Common::Point(0, 0), "Shld:");
-	s.setColor(ship._shield < 100 ? COLOR_HIGHLIGHT : COLOR_TEXT);
+	s.setColor(ship._shield < 100 ? _G(colors)._highlight : _G(colors)._text);
 	s.writeString(Common::Point(5, 0), Common::String::format("%4d", ship._shield));
 
-	s.setColor(COLOR_TEXT);
+	s.setColor(_G(colors)._text);
 	s.writeString(Common::Point(0, 1), "Fuel:");
-	s.setColor(ship._fuel < 100 ? COLOR_HIGHLIGHT : COLOR_TEXT);
+	s.setColor(ship._fuel < 100 ? _G(colors)._highlight : _G(colors)._text);
 	s.writeString(Common::Point(5, 1), Common::String::format("%4d", ship._fuel));
 
-	s.setColor(COLOR_TEXT);
+	s.setColor(_G(colors)._text);
 	s.writeString(Common::Point(0, 2), "Exp.:");
 	s.writeString(Common::Point(5, 2), Common::String::format("%4d", p._experience));
 
diff --git a/engines/ultima/ultima1/views/stats.cpp b/engines/ultima/ultima1/views/stats.cpp
index 155252d78d7..8e2a72418d0 100644
--- a/engines/ultima/ultima1/views/stats.cpp
+++ b/engines/ultima/ultima1/views/stats.cpp
@@ -27,8 +27,6 @@ namespace Ultima1 {
 namespace Views {
 
 // Colors used
-constexpr int COLOR_TEXT = 11;      // light cyan - normal values
-constexpr int COLOR_HIGHLIGHT = 12; // light red - low hits/food warning
 
 void Stats::draw() {
 	Data::Savegame &p = _G(savegame);
@@ -49,17 +47,17 @@ void Stats::draw() {
 	if (p._coins > 9999)
 		p._coins = 9999;
 
-	s.setColor(COLOR_TEXT);
+	s.setColor(_G(colors)._text);
 	s.writeString(Common::Point(0, 0), "Hits:");
-	s.setColor(p._hits < 100 ? COLOR_HIGHLIGHT : COLOR_TEXT);
+	s.setColor(p._hits < 100 ? _G(colors)._highlight : _G(colors)._text);
 	s.writeString(Common::Point(5, 0), Common::String::format("%4d", p._hits));
 
-	s.setColor(COLOR_TEXT);
+	s.setColor(_G(colors)._text);
 	s.writeString(Common::Point(0, 1), "Food:");
-	s.setColor(p._food < 100 ? COLOR_HIGHLIGHT : COLOR_TEXT);
+	s.setColor(p._food < 100 ? _G(colors)._highlight : _G(colors)._text);
 	s.writeString(Common::Point(5, 1), Common::String::format("%4d", p._food));
 
-	s.setColor(COLOR_TEXT);
+	s.setColor(_G(colors)._text);
 	s.writeString(Common::Point(0, 2), "Exp.:");
 	s.writeString(Common::Point(5, 2), Common::String::format("%4d", p._experience));
 
diff --git a/engines/ultima/ultima1/views/title.cpp b/engines/ultima/ultima1/views/title.cpp
index a76ed56b213..63ec1135132 100644
--- a/engines/ultima/ultima1/views/title.cpp
+++ b/engines/ultima/ultima1/views/title.cpp
@@ -28,14 +28,13 @@
 #include "image/xbm.h"
 #include "ultima/ultima1/views/title.h"
 #include "ultima/ultima1/gfx/pic_decoder.h"
+#include "ultima/ultima1/ultima1.h"
 
 namespace Ultima {
 namespace Ultima1 {
 namespace Views {
 
 // Colors used
-constexpr int COLOR_FOREGROUND = 15;	// white - used by the credits text
-constexpr int COLOR_TEXT       = 11;	// light cyan - used by blurb text
 
 // Flag pole x positions either side of the castle gate
 constexpr int FLAG_X1 = 123;
@@ -204,10 +203,6 @@ static const byte FLAGS_BITS[] = {
 	0x0c,0x00,0x00,0x18,0x00,0x00,0x00,0x00,0x00
 };
 
-// In XBM images, 0 is white and 1 is black. We need to remap this to the order required by the engine.
-static const uint32  LOGO_MAP[] = { 1,  0 };
-static const uint32 FLAGS_MAP[] = { 11, 10 };
-
 // Raw LFSR steps taken per draw() call while revealing the logo. Most are
 // discarded (see revealLogoPixels), so this is much larger than the
 // number of pixels actually drawn per call
@@ -225,15 +220,21 @@ constexpr int CREDITS_LOGO_STEP = 2;
 Title::Title() : View("Title") {
 }
 
-bool Title::msgFocus(const FocusMessage &msg) {
-	// Load images for display
+void Title::loadImages() {
+	const bool cga = _G(renderMode) == Data::RENDER_CGA;
+
+	// In XBM images, 0 is white and 1 is black. We need to remap this to the
+	// order required by the engine, and its colors
+	const uint32 logoMap[] = { _G(colors)._border, 0 };
+	const uint32 flagsMap[] = { _G(colors)._flag1, _G(colors)._flag2 };
+
 	Image::XBMDecoder logo;
 	if (!logo.loadBits(LOGO_BITS, LOGO_WIDTH, LOGO_HEIGHT))
 		error("Could not load logo");
 	const Graphics::Surface *src = logo.getSurface();
 	_logo.create(src->w, src->h);
 	Graphics::crossBlitMap((byte *)_logo.getPixels(), (const byte *)src->getPixels(),
-		_logo.pitch, src->pitch, _logo.w, _logo.h, _logo.format.bytesPerPixel, LOGO_MAP);
+		_logo.pitch, src->pitch, _logo.w, _logo.h, _logo.format.bytesPerPixel, logoMap);
 
 	Image::XBMDecoder flags;
 	if (!flags.loadBits(FLAGS_BITS, FLAGS_WIDTH, FLAGS_HEIGHT))
@@ -242,17 +243,24 @@ bool Title::msgFocus(const FocusMessage &msg) {
 	for (int idx = 0; idx < 3; ++idx) {
 		_flags[idx].create(8, 8);
 		Graphics::crossBlitMap((byte *)_flags[idx].getPixels(), (const byte *)src->getBasePtr(idx * 8, 0),
-			_flags[idx].pitch, src->pitch, _flags[idx].w, _flags[idx].h, _flags[idx].format.bytesPerPixel, FLAGS_MAP);
+			_flags[idx].pitch, src->pitch, _flags[idx].w, _flags[idx].h, _flags[idx].format.bytesPerPixel, flagsMap);
 	}
 
+	const char *castleFilename = cga ? "castle.4" : "castle.16";
 	Gfx::PicDecoder decoder;
 	Common::File f;
-	if (!f.open("castle.16") || !decoder.loadStream(f))
-		error("Could not load castle.16");
+	if (!f.open(castleFilename) || !(cga ? decoder.loadCgaStream(f) : decoder.loadStream(f)))
+		error("Could not load %s", castleFilename);
 	_castle.create(320, 200);
 	_castle.blitFrom(*decoder.getSurface());
 	_castlePalette = decoder.getPalette();
 
+	_loadedMode = _G(renderMode);
+}
+
+bool Title::msgFocus(const FocusMessage &msg) {
+	loadImages();
+
 	_state = PRESENTS;
 	resetLogoReveal();
 	delayFrames(1);
@@ -272,10 +280,14 @@ bool Title::msgUnfocus(const UnfocusMessage &msg) {
 void Title::draw() {
 	auto s = getSurface();
 
-	// The castle picture uses its own custom palette (see PicDecoder);
-	// every other state uses the engine's standard EGA palette
-	if (_state != CASTLE)
-		g_system->getPaletteManager()->setPalette(Graphics::Palette::createEGAPalette());
+	// The graphics can be changed from the game options while here
+	if (_loadedMode != _G(renderMode))
+		loadImages();
+
+	// The EGA castle picture uses its own custom palette (see PicDecoder);
+	// every other state uses the standard palette
+	if (_state != CASTLE || _G(renderMode) == Data::RENDER_CGA)
+		Data::setPalette(_G(renderMode));
 
 	switch (_state) {
 	case PRESENTS:
@@ -288,7 +300,7 @@ void Title::draw() {
 		if (_logoPixelsDrawn < _logo.w * _logo.h) {
 			revealLogoPixels(s);
 		} else {
-			s.setColor(COLOR_TEXT);
+			s.setColor(_G(colors)._text);
 			s.writeString(Common::Point(14, 13), "Presents...");
 		}
 		break;
@@ -296,7 +308,7 @@ void Title::draw() {
 	case INTRO_A:
 		s.clear();
 		s.blitFrom(_logo, Common::Point(20, 21));
-		s.setColor(COLOR_TEXT);
+		s.setColor(_G(colors)._text);
 		s.writeString(Common::Point(5, 12), "...a new release of the best");
 		s.writeString(Common::Point(5, 13), "   selling personal computer");
 		s.writeString(Common::Point(5, 14), "   role-playing adventure...");
@@ -305,13 +317,14 @@ void Title::draw() {
 	case INTRO_B:
 		s.clear();
 		s.blitFrom(_logo, Common::Point(20, 21));
-		s.setColor(COLOR_TEXT);
+		s.setColor(_G(colors)._text);
 		s.writeString(Common::Point(6, 12), "...Lord British's original");
 		s.writeString(Common::Point(6, 13), "   fantasy masterpiece...");
 		break;
 
 	case CASTLE:
-		g_system->getPaletteManager()->setPalette(_castlePalette);
+		if (_G(renderMode) == Data::RENDER_EGA)
+			g_system->getPaletteManager()->setPalette(_castlePalette);
 		s.blitFrom(_castle);
 		drawCastleFlag(s, FLAG_X1);
 		drawCastleFlag(s, FLAG_X2);
@@ -326,7 +339,7 @@ void Title::draw() {
 		if (_creditsLine < CREDITS_LOGO_LINES) {
 			drawCreditsLogo(s);
 		} else {
-			s.setColor(COLOR_FOREGROUND);
+			s.setColor(_G(colors)._edge);
 			s.writeString(Common::Point(1, 17), "ULTIMA and LORD BRITISH are registered");
 			s.writeString(Common::Point(2, 18), "trademarks of Richard Garriott and");
 			s.writeString(Common::Point(11, 19), "Origin Systems, Inc.");
diff --git a/engines/ultima/ultima1/views/title.h b/engines/ultima/ultima1/views/title.h
index 076f1600de7..b4f3b6d7b73 100644
--- a/engines/ultima/ultima1/views/title.h
+++ b/engines/ultima/ultima1/views/title.h
@@ -25,6 +25,7 @@
 #include "graphics/managed_surface.h"
 #include "graphics/palette.h"
 #include "ultima/shared/engine/view.h"
+#include "ultima/ultima1/data/render_mode.h"
 
 namespace Ultima {
 namespace Ultima1 {
@@ -58,6 +59,12 @@ private:
 	Graphics::ManagedSurface _logo, _castle;
 	Graphics::ManagedSurface _flags[3];
 	Graphics::Palette _castlePalette;
+	Data::RenderMode _loadedMode = Data::RENDER_EGA;
+
+	/**
+	 * Loads the images for the current graphics mode
+	 */
+	void loadImages();
 
 	void showCredits();
 	void showMainMenu();
diff --git a/engines/ultima/ultima1/views/zstats.cpp b/engines/ultima/ultima1/views/zstats.cpp
index dbce560201b..670f91f11a6 100644
--- a/engines/ultima/ultima1/views/zstats.cpp
+++ b/engines/ultima/ultima1/views/zstats.cpp
@@ -27,8 +27,6 @@ namespace Ultima {
 namespace Ultima1 {
 namespace Views {
 
-constexpr int COLOR_TEXT = 11;      // light cyan - normal values
-constexpr int COLOR_HIGHLIGHT = 12; // light red - currently equipped/readied item
 
 // Two columns of 13 rows each per page
 constexpr int LINES_PER_PAGE = 26;
@@ -67,7 +65,7 @@ void ZStats::draw() {
 
 	// If there's more to show on a following page, prompt for it
 	if (pageEnd < _lines.size()) {
-		s.setColor(COLOR_TEXT);
+		s.setColor(_G(colors)._text);
 		s.writeString(Common::Point(16, 19), "\x10 More \x11");
 	}
 }
@@ -83,7 +81,7 @@ void ZStats::addLine(const char *name, int value, bool highlighted) {
 
 	StatLine line;
 	line._text = getLine(name, value);
-	line._color = highlighted ? COLOR_HIGHLIGHT : COLOR_TEXT;
+	line._color = highlighted ? _G(colors)._highlight : _G(colors)._text;
 	_lines.push_back(line);
 }
 


Commit: 3ee1400692b435d8b6ee35cdd6483beedd3afe8b
    https://github.com/scummvm/scummvm/commit/3ee1400692b435d8b6ee35cdd6483beedd3afe8b
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:41:04+11:00

Commit Message:
ULTIMA: Fix hotkeys across Ultima 1, 2, 3

Changed paths:
  A engines/ultima/shared/engine/events.cpp
  A engines/ultima/shared/engine/hotkeys.h
  R engines/ultima/shared/engine/view.cpp
    engines/ultima/shared/engine/events.h
    engines/ultima/shared/engine/view.h
    engines/ultima/ultima1/metaengine.cpp
    engines/ultima/ultima1/metaengine.h
    engines/ultima/ultima1/ultima1.cpp
    engines/ultima/ultima1/ultima1.h
    engines/ultima/ultima2/metaengine.cpp
    engines/ultima/ultima2/metaengine.h
    engines/ultima/ultima2/ultima2.cpp
    engines/ultima/ultima2/ultima2.h
    engines/ultima/ultima3/metaengine.cpp
    engines/ultima/ultima3/metaengine.h
    engines/ultima/ultima3/ultima3.cpp
    engines/ultima/ultima3/ultima3.h
    engines/ultima/ultima3/views/game.cpp
    engines/ultima/ultima3/views/game.h


diff --git a/engines/ultima/shared/engine/view.cpp b/engines/ultima/shared/engine/events.cpp
similarity index 76%
rename from engines/ultima/shared/engine/view.cpp
rename to engines/ultima/shared/engine/events.cpp
index 432827408b4..e8c88bb8a8f 100644
--- a/engines/ultima/shared/engine/view.cpp
+++ b/engines/ultima/shared/engine/events.cpp
@@ -19,25 +19,33 @@
  *
  */
 
-#include "ultima/shared/engine/view.h"
+
+#include "ultima/shared/engine/events.h"
 #include "engines/engine.h"
 
 namespace Ultima {
 namespace Shared {
 
-bool View::msgKeypress(const Graphics::Views::KeypressMessage &msg) {
-	if ((msg.flags & Common::KBD_ALT) && msgHotkey(msg.keycode))
-		return true;
-
-	switch (msg.keycode) {
-	case Common::KEYCODE_F5:
+bool Events::msgAction(const Graphics::Views::ActionMessage &msg) {
+	switch (msg._action) {
+	case HOTKEY_SAVE:
 		g_engine->saveGameDialog();
 		return true;
-	case Common::KEYCODE_F7:
+
+	case HOTKEY_RESTORE:
 		g_engine->loadGameDialog();
 		return true;
+
+	case HOTKEY_EXIT:
+		g_engine->quitGame();
+		return true;
+
+	case HOTKEY_MAIN_MENU:
+		returnToMainMenu();
+		return true;
+
 	default:
-		return Graphics::Views::View::msgKeypress(msg);
+		return Graphics::Views::Events::msgAction(msg);
 	}
 }
 
diff --git a/engines/ultima/shared/engine/events.h b/engines/ultima/shared/engine/events.h
index a8b0ec820c0..af93fbfdc06 100644
--- a/engines/ultima/shared/engine/events.h
+++ b/engines/ultima/shared/engine/events.h
@@ -23,6 +23,7 @@
 #define ULTIMA_SHARED_ENGINE_EVENTS_H
 
 #include "graphics/views/events.h"
+#include "ultima/shared/engine/hotkeys.h"
 #include "ultima/shared/engine/messages.h"
 
 namespace Ultima {
@@ -58,6 +59,19 @@ public:
 };
 
 class Events : public Graphics::Views::Events {
+protected:
+	/**
+	 * Handles the actions common to the Ultima engines (see HotkeyAction)
+	 * before passing others to the focused view
+	 */
+	bool msgAction(const Graphics::Views::ActionMessage &msg) override;
+
+	/**
+	 * Goes back to the start of the game, such as its title screen
+	 */
+	virtual void returnToMainMenu() {
+	}
+
 public:
 	Events(const Common::String &engineName) : Graphics::Views::Events(engineName) {
 	}
diff --git a/engines/ultima/shared/engine/hotkeys.h b/engines/ultima/shared/engine/hotkeys.h
new file mode 100644
index 00000000000..99b3df49d2f
--- /dev/null
+++ b/engines/ultima/shared/engine/hotkeys.h
@@ -0,0 +1,43 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#ifndef ULTIMA_SHARED_ENGINE_HOTKEYS_H
+#define ULTIMA_SHARED_ENGINE_HOTKEYS_H
+
+namespace Ultima {
+namespace Shared {
+
+/**
+ * Keymap actions that every Ultima engine handles in the same way, from any
+ * view. The values are kept well clear of the actions of the games themselves
+ */
+enum HotkeyAction {
+	HOTKEY_SAVE = 1000,		// Opens the save dialog
+	HOTKEY_RESTORE,			// Opens the restore dialog
+	HOTKEY_EXIT,			// Exits the game
+	HOTKEY_MAIN_MENU		// Goes back to the start of the game
+};
+
+} // namespace Shared
+} // namespace Ultima
+
+#endif
diff --git a/engines/ultima/shared/engine/view.h b/engines/ultima/shared/engine/view.h
index 303257bd9b4..ced1b1c5551 100644
--- a/engines/ultima/shared/engine/view.h
+++ b/engines/ultima/shared/engine/view.h
@@ -34,16 +34,6 @@ namespace Shared {
  */
 class View : public Graphics::Views::View {
 	ULTIMA_CUSTOM_MESSAGES(Graphics::Views::View)
-protected:
-	/**
-	 * Called for a key pressed with Alt held, which games can give a
-	 * meaning to
-	 * @returns		True if the key was handled
-	 */
-	virtual bool msgHotkey(Common::KeyCode key) {
-		return false;
-	}
-
 public:
 	View(const Common::String &name, Graphics::Views::UIElement *uiParent) : Graphics::Views::View(name, uiParent) {
 	}
@@ -60,8 +50,6 @@ public:
 		s.setColor(15);		// EGA white color
 		return s;
 	}
-
-	bool msgKeypress(const Graphics::Views::KeypressMessage &msg) override;
 };
 
 } // namespace Shared
diff --git a/engines/ultima/ultima1/metaengine.cpp b/engines/ultima/ultima1/metaengine.cpp
index 48af7f8677d..32752dc92de 100644
--- a/engines/ultima/ultima1/metaengine.cpp
+++ b/engines/ultima/ultima1/metaengine.cpp
@@ -34,10 +34,15 @@ struct KeybindingRecord {
 	const char *_desc;
 	const char *_key;
 	const char *_joy;
+	const char *_keyAlt;
 };
 
 static const KeybindingRecord MINIMAL_KEYS[] = {
-	{ KEYBIND_NONE, nullptr, nullptr, nullptr, nullptr }
+	{ KEYBIND_SAVE, "SAVE_GAME", _s("Save game"), "F5", nullptr, nullptr },
+	{ KEYBIND_RESTORE, "RESTORE_GAME", _s("Restore game"), "F7", nullptr, "A+r" },
+	{ KEYBIND_EXIT_GAME, "EXIT_GAME", _s("Exit game"), "A+x", nullptr, nullptr },
+	{ KEYBIND_MAIN_MENU, "MAIN_MENU", _s("Main menu"), "A+m", nullptr, nullptr },
+	{ KEYBIND_NONE, nullptr, nullptr, nullptr, nullptr, nullptr }
 };
 
 static const KeybindingRecord GAMEPLAY_KEYS[] = {
@@ -162,6 +167,8 @@ Common::KeymapArray MetaEngine::initKeymaps(KeybindingMode mode) {
 			act->addDefaultInputMapping(r->_key);
 			if (r->_joy)
 				act->addDefaultInputMapping(r->_joy);
+			if (r->_keyAlt)
+				act->addDefaultInputMapping(r->_keyAlt);
 
 			if (r->_action == KEYBIND_UP || r->_action == KEYBIND_DOWN ||
 				r->_action == KEYBIND_LEFT || r->_action == KEYBIND_RIGHT)
diff --git a/engines/ultima/ultima1/metaengine.h b/engines/ultima/ultima1/metaengine.h
index b5c4a6e411c..7acef397808 100644
--- a/engines/ultima/ultima1/metaengine.h
+++ b/engines/ultima/ultima1/metaengine.h
@@ -23,6 +23,7 @@
 #define ULTIMA1_METAENGINE_H
 
 #include "backends/keymapper/keymapper.h"
+#include "ultima/shared/engine/hotkeys.h"
 
 namespace Ultima {
 namespace Ultima1 {
@@ -34,7 +35,13 @@ enum KeybindingAction {
 	KEYBIND_GET, KEYBIND_HYPERJUMP, KEYBIND_INFORM, KEYBIND_CLIMB, KEYBIND_NOISE,
 	KEYBIND_OPEN, KEYBIND_QUIT, KEYBIND_READY, KEYBIND_STEAL, KEYBIND_TRANSACT,
 	KEYBIND_UNLOCK, KEYBIND_VIEW, KEYBIND_EXIT, KEYBIND_STATS, KEYBIND_PASS,
-	KEYBIND_NONE
+	KEYBIND_NONE,
+
+	// Actions common to the Ultima games
+	KEYBIND_SAVE = Shared::HOTKEY_SAVE,
+	KEYBIND_RESTORE = Shared::HOTKEY_RESTORE,
+	KEYBIND_EXIT_GAME = Shared::HOTKEY_EXIT,
+	KEYBIND_MAIN_MENU = Shared::HOTKEY_MAIN_MENU
 };
 
 enum KeybindingMode {
diff --git a/engines/ultima/ultima1/ultima1.cpp b/engines/ultima/ultima1/ultima1.cpp
index 374881def68..e7aa7fe8176 100644
--- a/engines/ultima/ultima1/ultima1.cpp
+++ b/engines/ultima/ultima1/ultima1.cpp
@@ -90,6 +90,10 @@ Common::Error Ultima1Engine::run() {
 	return Common::kNoError;
 }
 
+void Ultima1Engine::returnToMainMenu() {
+	replaceView("MainMenu", true);
+}
+
 bool Ultima1Engine::canSaveGameStateCurrently(Common::U32String *msg) {
 	// Only allow saving when any of the different map views are active
 	return dynamic_cast<Views::Map *>(focusedView()) != nullptr;
diff --git a/engines/ultima/ultima1/ultima1.h b/engines/ultima/ultima1/ultima1.h
index 6fad1534a8d..75355faad28 100644
--- a/engines/ultima/ultima1/ultima1.h
+++ b/engines/ultima/ultima1/ultima1.h
@@ -74,6 +74,11 @@ protected:
 		return Engine::shouldQuit();
 	}
 
+	/**
+	 * Goes back to the main menu
+	 */
+	void returnToMainMenu() override;
+
 public:
 	// The graphics being shown, and the palette indices things are drawn
 	// with in them
diff --git a/engines/ultima/ultima2/metaengine.cpp b/engines/ultima/ultima2/metaengine.cpp
index b10a769b675..cc689c9f282 100644
--- a/engines/ultima/ultima2/metaengine.cpp
+++ b/engines/ultima/ultima2/metaengine.cpp
@@ -34,10 +34,15 @@ struct KeybindingRecord {
 	const char *_desc;
 	const char *_key;
 	const char *_joy;
+	const char *_keyAlt;
 };
 
 static const KeybindingRecord MINIMAL_KEYS[] = {
-	{ KEYBIND_NONE, nullptr, nullptr, nullptr, nullptr }
+	{ KEYBIND_SAVE, "SAVE_GAME", _s("Save game"), "F5", nullptr, nullptr },
+	{ KEYBIND_RESTORE, "RESTORE_GAME", _s("Restore game"), "F7", nullptr, "A+r" },
+	{ KEYBIND_EXIT_GAME, "EXIT_GAME", _s("Exit game"), "A+x", nullptr, nullptr },
+	{ KEYBIND_MAIN_MENU, "MAIN_MENU", _s("Main menu"), "A+m", nullptr, nullptr },
+	{ KEYBIND_NONE, nullptr, nullptr, nullptr, nullptr, nullptr }
 };
 
 static const KeybindingRecord GAMEPLAY_KEYS[] = {
@@ -125,6 +130,8 @@ Common::KeymapArray MetaEngine::initKeymaps(KeybindingMode mode) {
 			act->addDefaultInputMapping(r->_key);
 			if (r->_joy)
 				act->addDefaultInputMapping(r->_joy);
+			if (r->_keyAlt)
+				act->addDefaultInputMapping(r->_keyAlt);
 
 			if (r->_action == KEYBIND_UP || r->_action == KEYBIND_DOWN ||
 				r->_action == KEYBIND_LEFT || r->_action == KEYBIND_RIGHT)
diff --git a/engines/ultima/ultima2/metaengine.h b/engines/ultima/ultima2/metaengine.h
index 39343c30d8c..f4d6757e888 100644
--- a/engines/ultima/ultima2/metaengine.h
+++ b/engines/ultima/ultima2/metaengine.h
@@ -23,6 +23,7 @@
 #define ULTIMA2_METAENGINE_H
 
 #include "backends/keymapper/keymapper.h"
+#include "ultima/shared/engine/hotkeys.h"
 
 namespace Ultima {
 namespace Ultima2 {
@@ -34,7 +35,13 @@ enum KeybindingAction {
 	KEYBIND_MAGIC, KEYBIND_NEGATE_TIME, KEYBIND_OFFER, KEYBIND_PASS, KEYBIND_QUIT, KEYBIND_READY,
 	KEYBIND_STEAL, KEYBIND_TRANSACT, KEYBIND_UNLOCK, KEYBIND_VIEW, KEYBIND_WEAR_ARMOR,
 	KEYBIND_X_IT, KEYBIND_YELL, KEYBIND_ZSTATS,
-	KEYBIND_NONE
+	KEYBIND_NONE,
+
+	// Actions common to the Ultima games
+	KEYBIND_SAVE = Shared::HOTKEY_SAVE,
+	KEYBIND_RESTORE = Shared::HOTKEY_RESTORE,
+	KEYBIND_EXIT_GAME = Shared::HOTKEY_EXIT,
+	KEYBIND_MAIN_MENU = Shared::HOTKEY_MAIN_MENU
 };
 
 enum KeybindingMode {
diff --git a/engines/ultima/ultima2/ultima2.cpp b/engines/ultima/ultima2/ultima2.cpp
index 01723de4b97..30469ae06e5 100644
--- a/engines/ultima/ultima2/ultima2.cpp
+++ b/engines/ultima/ultima2/ultima2.cpp
@@ -74,27 +74,8 @@ Common::String Ultima2Engine::getGameId() const {
 	return _gameDescription->desc.gameId;
 }
 
-bool Ultima2Engine::msgKeypress(const Graphics::Views::KeypressMessage &msg) {
-	if (msg.flags & Common::KBD_ALT) {
-		switch (msg.keycode) {
-		case Common::KEYCODE_x:
-			quitGame();
-			return true;
-
-		case Common::KEYCODE_r:
-			loadGameDialog();
-			return true;
-
-		case Common::KEYCODE_m:
-			replaceView("Title", true);
-			return true;
-
-		default:
-			break;
-		}
-	}
-
-	return Shared::Events::msgKeypress(msg);
+void Ultima2Engine::returnToMainMenu() {
+	replaceView("Title", true);
 }
 
 // The graphics renderer mode stored in the configuration, falling back to
diff --git a/engines/ultima/ultima2/ultima2.h b/engines/ultima/ultima2/ultima2.h
index 9887e9430a4..54994105992 100644
--- a/engines/ultima/ultima2/ultima2.h
+++ b/engines/ultima/ultima2/ultima2.h
@@ -61,10 +61,9 @@ protected:
 	}
 
 	/**
-	 * Handles the upgrade's Alt hotkeys, which work from anywhere: X to exit,
-	 * R to restore a saved game, and M to go back to the title
+	 * Goes back to the title screen
 	 */
-	bool msgKeypress(const Graphics::Views::KeypressMessage &msg) override;
+	void returnToMainMenu() override;
 
 private:
 	// 6-byte lagged-Fibonacci-style state for randByte(), matching the
diff --git a/engines/ultima/ultima3/metaengine.cpp b/engines/ultima/ultima3/metaengine.cpp
index 21b793cad1d..f7b763a0afa 100644
--- a/engines/ultima/ultima3/metaengine.cpp
+++ b/engines/ultima/ultima3/metaengine.cpp
@@ -34,10 +34,15 @@ struct KeybindingRecord {
 	const char *_desc;
 	const char *_key;
 	const char *_joy;
+	const char *_keyAlt;
 };
 
 static const KeybindingRecord MINIMAL_KEYS[] = {
-	{ KEYBIND_NONE, nullptr, nullptr, nullptr, nullptr }
+	{ KEYBIND_SAVE, "SAVE_GAME", _s("Save game"), "F5", nullptr, nullptr },
+	{ KEYBIND_RESTORE, "RESTORE_GAME", _s("Restore game"), "F7", nullptr, "A+r" },
+	{ KEYBIND_EXIT_GAME, "EXIT_GAME", _s("Exit game"), "A+x", nullptr, nullptr },
+	{ KEYBIND_MAIN_MENU, "MAIN_MENU", _s("Main menu"), "A+m", nullptr, nullptr },
+	{ KEYBIND_NONE, nullptr, nullptr, nullptr, nullptr, nullptr }
 };
 
 static const KeybindingRecord GAMEPLAY_KEYS[] = {
@@ -125,6 +130,8 @@ Common::KeymapArray MetaEngine::initKeymaps(KeybindingMode mode) {
 			act->addDefaultInputMapping(r->_key);
 			if (r->_joy)
 				act->addDefaultInputMapping(r->_joy);
+			if (r->_keyAlt)
+				act->addDefaultInputMapping(r->_keyAlt);
 
 			if (r->_action == KEYBIND_UP || r->_action == KEYBIND_DOWN ||
 				r->_action == KEYBIND_LEFT || r->_action == KEYBIND_RIGHT)
diff --git a/engines/ultima/ultima3/metaengine.h b/engines/ultima/ultima3/metaengine.h
index 37569e84101..c21544ef127 100644
--- a/engines/ultima/ultima3/metaengine.h
+++ b/engines/ultima/ultima3/metaengine.h
@@ -23,6 +23,7 @@
 #define ULTIMA3_METAENGINE_H
 
 #include "backends/keymapper/keymapper.h"
+#include "ultima/shared/engine/hotkeys.h"
 
 namespace Ultima {
 namespace Ultima3 {
@@ -34,7 +35,13 @@ enum KeybindingAction {
 	KEYBIND_MAGIC, KEYBIND_NEGATE_TIME, KEYBIND_OFFER, KEYBIND_PASS, KEYBIND_QUIT, KEYBIND_READY,
 	KEYBIND_STEAL, KEYBIND_TRANSACT, KEYBIND_UNLOCK, KEYBIND_VIEW, KEYBIND_WEAR_ARMOR,
 	KEYBIND_X_IT, KEYBIND_YELL, KEYBIND_ZSTATS,
-	KEYBIND_NONE
+	KEYBIND_NONE,
+
+	// Actions common to the Ultima games
+	KEYBIND_SAVE = Shared::HOTKEY_SAVE,
+	KEYBIND_RESTORE = Shared::HOTKEY_RESTORE,
+	KEYBIND_EXIT_GAME = Shared::HOTKEY_EXIT,
+	KEYBIND_MAIN_MENU = Shared::HOTKEY_MAIN_MENU
 };
 
 enum KeybindingMode {
diff --git a/engines/ultima/ultima3/ultima3.cpp b/engines/ultima/ultima3/ultima3.cpp
index 3e6cbd3ff02..ebcacb156db 100644
--- a/engines/ultima/ultima3/ultima3.cpp
+++ b/engines/ultima/ultima3/ultima3.cpp
@@ -116,13 +116,14 @@ Common::Error Ultima3Engine::run() {
 	return Common::kNoError;
 }
 
-bool Ultima3Engine::msgKeypress(const Graphics::Views::KeypressMessage &msg) {
-	if ((msg.flags & Common::KBD_ALT) && msg.keycode == Common::KEYCODE_x) {
-		quitGame();
-		return true;
-	}
-
-	return Shared::Events::msgKeypress(msg);
+void Ultima3Engine::returnToMainMenu() {
+	// Back to the start of the game, which has no music
+	auto *game = dynamic_cast<Views::Game *>(baseView()->findView(gameViewName()));
+	if (game)
+		game->cancelInteraction();
+
+	_music.silence();
+	replaceView("Title", true);
 }
 
 void Ultima3Engine::applyGameSettings() {
diff --git a/engines/ultima/ultima3/ultima3.h b/engines/ultima/ultima3/ultima3.h
index c9ad196d8bf..44fca2f060b 100644
--- a/engines/ultima/ultima3/ultima3.h
+++ b/engines/ultima/ultima3/ultima3.h
@@ -81,9 +81,9 @@ protected:
 	}
 
 	/**
-	 * Handles the upgrade's Alt-X hotkey, which exits from anywhere
+	 * Goes back to the title screen
 	 */
-	bool msgKeypress(const Graphics::Views::KeypressMessage &msg) override;
+	void returnToMainMenu() override;
 
 private:
 	Audio::PCSpeaker *_pcSpeaker = nullptr;
diff --git a/engines/ultima/ultima3/views/game.cpp b/engines/ultima/ultima3/views/game.cpp
index 92be57e125b..ee532865670 100644
--- a/engines/ultima/ultima3/views/game.cpp
+++ b/engines/ultima/ultima3/views/game.cpp
@@ -191,24 +191,6 @@ bool Game::handleCommand(const KeypressMessage &msg) {
 	}
 }
 
-bool Game::msgHotkey(Common::KeyCode key) {
-	switch (key) {
-	case Common::KEYCODE_r:
-		g_engine->loadGameDialog();
-		return true;
-
-	case Common::KEYCODE_m:
-		// Back to the start of the game, which has no music
-		_interaction.reset();
-		_G(music).silence();
-		replaceView("Title", true);
-		return true;
-
-	default:
-		return false;
-	}
-}
-
 bool Game::msgKeypress(const KeypressMessage &msg) {
 	if (isModifierKey(msg.keycode))
 		return true;
diff --git a/engines/ultima/ultima3/views/game.h b/engines/ultima/ultima3/views/game.h
index d3b99b67005..bd2334d1c3e 100644
--- a/engines/ultima/ultima3/views/game.h
+++ b/engines/ultima/ultima3/views/game.h
@@ -102,12 +102,6 @@ protected:
 	 */
 	virtual byte musicLocation() const;
 
-	/**
-	 * Handles the upgrade's Alt hotkeys: R to restore a saved game and M to go
-	 * back to the title
-	 */
-	bool msgHotkey(Common::KeyCode key) override;
-
 	/**
 	 * Called every frame, for anything the view has going on
 	 */
@@ -155,6 +149,13 @@ protected:
 	bool checkPartyWipedOut();
 
 public:
+	/**
+	 * Gives up any command that's part way through being given
+	 */
+	void cancelInteraction() {
+		_interaction.reset();
+	}
+
 	Game(const Common::String &name) : View(name) {}
 	~Game() override {}
 


Commit: 9e6d0db6153874c13c3e554c9c698e609768e735
    https://github.com/scummvm/scummvm/commit/9e6d0db6153874c13c3e554c9c698e609768e735
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:41:04+11:00

Commit Message:
ULTIMA: ULTIMA1: Fix incorrect NPC rendering in Castle British

Changed paths:
    engines/ultima/ultima1/data/savegame.cpp


diff --git a/engines/ultima/ultima1/data/savegame.cpp b/engines/ultima/ultima1/data/savegame.cpp
index a3783692de1..50f2ed75174 100644
--- a/engines/ultima/ultima1/data/savegame.cpp
+++ b/engines/ultima/ultima1/data/savegame.cpp
@@ -167,7 +167,7 @@ int Savegame::getLocationEntityAt(int x, int y) const {
 	int foundIndex = -1;
 	for (int startingIndex = 0; startingIndex < LOCATION_ENTITY_COUNT && foundIndex == -1; ++startingIndex) {
 		const auto &e = _locationEntities[startingIndex];
-		if (e._position.x == x && e._position.y == y)
+		if (e._type != -1 && e._position.x == x && e._position.y == y)
 			foundIndex = startingIndex;
 	}
 


Commit: 296b9c7c0808831f375d4ce85937f3030baa29e2
    https://github.com/scummvm/scummvm/commit/296b9c7c0808831f375d4ce85937f3030baa29e2
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:41:04+11:00

Commit Message:
ULTIMA: ULTIMA1: Fix walk sound in castle locations

Changed paths:
    engines/ultima/ultima1/logic/city_castle_logic.cpp


diff --git a/engines/ultima/ultima1/logic/city_castle_logic.cpp b/engines/ultima/ultima1/logic/city_castle_logic.cpp
index 858f54c7eee..26bd0d49cd2 100644
--- a/engines/ultima/ultima1/logic/city_castle_logic.cpp
+++ b/engines/ultima/ultima1/logic/city_castle_logic.cpp
@@ -149,7 +149,7 @@ bool CityCastleLogic::move(Data::Direction dir) {
 			writeString(Common::String::format("%s\n", Data::DIRECTION_NAMES[dir]));
 
 			_G(savegame)._locationPosition = Common::Point(x, y);
-			playFX(1);
+			playFX(4);
 			redrawMap();
 
 		} else {


Commit: 5d356ede0f0adf68ab8654592ad0cac0c300f07b
    https://github.com/scummvm/scummvm/commit/5d356ede0f0adf68ab8654592ad0cac0c300f07b
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:41:04+11:00

Commit Message:
ULTIMA: ULTIMA1: Fixes for king quest display

Changed paths:
    engines/ultima/ultima1/views/commands.cpp
    engines/ultima/ultima1/views/commands.h
    engines/ultima/ultima1/views/interactions/king.cpp
    engines/ultima/ultima1/views/interactions/king.h


diff --git a/engines/ultima/ultima1/views/commands.cpp b/engines/ultima/ultima1/views/commands.cpp
index 009d43f3718..6987a234f2a 100644
--- a/engines/ultima/ultima1/views/commands.cpp
+++ b/engines/ultima/ultima1/views/commands.cpp
@@ -60,6 +60,9 @@ bool Commands::msgGame(const GameMessage &msg) {
 	} else if (msg._name == "SPACE") {
 		space();
 		return true;
+	} else if (msg._name == "SPACE2") {
+		space2();
+		return true;
 	} else if (msg._name == "DELAY") {
 		delay(msg._value);
 		return true;
@@ -99,6 +102,12 @@ void Commands::space() {
 	showCursor();
 }
 
+void Commands::space2() {
+	resetLine();
+	_surface.writeString(" Press Space to continue: ");
+	showCursor();
+}
+
 void Commands::delay(uint milli) {
 	g_engine->updateScreen();
 	g_engine->pauseMillis(NEWLINE_DELAY);
diff --git a/engines/ultima/ultima1/views/commands.h b/engines/ultima/ultima1/views/commands.h
index 137b5794020..fb9798bace9 100644
--- a/engines/ultima/ultima1/views/commands.h
+++ b/engines/ultima/ultima1/views/commands.h
@@ -49,6 +49,7 @@ private:
 	void showCursor();
 	void prompt();
 	void space();
+	void space2();
 
 public:
 	Commands(UIElement *parent);
diff --git a/engines/ultima/ultima1/views/interactions/king.cpp b/engines/ultima/ultima1/views/interactions/king.cpp
index b855bf64e1d..775e9defa1e 100644
--- a/engines/ultima/ultima1/views/interactions/king.cpp
+++ b/engines/ultima/ultima1/views/interactions/king.cpp
@@ -28,16 +28,24 @@ namespace Ultima1 {
 namespace Views {
 namespace Interactions {
 
+// Same generic dialog box geometry the Lose and Win views use
+constexpr int DIALOG_X1 = 31, DIALOG_Y1 = 23, DIALOG_X2 = 287, DIALOG_Y2 = 127;
+constexpr int BORDER_X1 = 34, BORDER_Y1 = 26, BORDER_X2 = 284, BORDER_Y2 = 124;
+
 // The four dungeon monsters kings with an even castle index send the
-// player to kill, indexed by (castleIndex - 2) / 2
+// player to kill, indexed by (castleIndex - 2) / 2. They're padded to
+// roughly center under the heading
 static const char *const QUEST_MONSTER_NAMES[4] = {
-	"Gelatinous Cube", "Carrion Creeper", "Lich", "Balron"
+	" Gelatinous Cube", " Carrion Creeper", "     Lich", "    Balron"
 };
 
 // The four landmarks kings with an odd castle index send the player to
 // find, as indexes into Data::LOCATION_NAMES, indexed by (castleIndex - 1) / 2
 static const int QUEST_LOCATION_INDEXES[4] = { 47, 45, 43, 41 };
 
+// Text column of each of those landmark names within the quest dialog
+static const int QUEST_LOCATION_X[4] = { 8, 10, 9, 9 };
+
 // Reward text shown for a completed "kill a monster" quest, indexed by the
 // continent the player is currently standing on
 static const char *const GEM_REWARD_MESSAGES[4] = {
@@ -66,6 +74,9 @@ bool King::msgFocus(const FocusMessage &msg) {
 }
 
 bool King::msgAction(const ActionMessage &msg) {
+	if (_mode == KING_QUEST)
+		return true;
+
 	writeString("neither\n");
 	finish();
 	return true;
@@ -73,6 +84,13 @@ bool King::msgAction(const ActionMessage &msg) {
 
 bool King::msgKeypress(const KeypressMessage &msg) {
 	switch (_mode) {
+	case KING_QUEST:
+		if (msg.keycode == Common::KEYCODE_SPACE || msg.keycode == Common::KEYCODE_RETURN) {
+			prompt();
+			close();
+		}
+		break;
+
 	case KING_PROMPT:
 		if (msg.keycode == Common::KEYCODE_p) {
 			_mode = KING_PENCE;
@@ -89,10 +107,10 @@ bool King::msgKeypress(const KeypressMessage &msg) {
 				writeString("\n");
 				writeString("Thou art on a quest\n");
 				writeString("for me already!\n");
+				finish();
 			} else {
 				giveQuest();
 			}
-			finish();
 
 		} else {
 			writeString("neither\n");
@@ -165,26 +183,43 @@ bool King::checkQuestReward() {
 }
 
 void King::giveQuest() {
-	auto &sg = _G(savegame);
+	_G(savegame)._questStatus[_G(map)._castleNum2] = -1;
+	_mode = KING_QUEST;
+
+	setBounds(Graphics::Views::TextRect(0, 0, 39, 19));
+	redraw();
+	g_engine->send("Commands", GameMessage("SPACE2"));
+}
+
+void King::draw() {
+	if (_mode == KING_QUEST)
+		drawQuest();
+}
+
+void King::drawQuest() {
 	int castleIdx = _G(map)._castleNum2;
-	sg._questStatus[castleIdx] = -1;
+
+	auto s = getSurface();
+	s.fillRect(Common::Rect(DIALOG_X1, DIALOG_Y1, DIALOG_X2, DIALOG_Y2), 0);
+	s.frameRect(Common::Rect(BORDER_X1, BORDER_Y1, BORDER_X2, BORDER_Y2), _G(colors)._border);
+	s.setColor(_G(colors)._text);
 
 	if (castleIdx % 2 == 0) {
-		writeString("Go now and kill a\n");
+		s.writeString(Common::Point(12, 6), "Go now and kill a");
 
 		int monsterIdx = (castleIdx - 2) / 2;
 		if (monsterIdx >= 0 && monsterIdx < 4)
-			writeString(Common::String::format("%s\n", QUEST_MONSTER_NAMES[monsterIdx]));
+			s.writeString(Common::Point(12, 8), QUEST_MONSTER_NAMES[monsterIdx]);
 	} else {
-		writeString("Go forth and find\n");
+		s.writeString(Common::Point(11, 6), "Go forth and find");
 
 		int locIdx = (castleIdx - 1) / 2;
 		if (locIdx >= 0 && locIdx < 4)
-			writeString(Common::String::format("%s\n", Data::LOCATION_NAMES[QUEST_LOCATION_INDEXES[locIdx]]));
+			s.writeString(Common::Point(QUEST_LOCATION_X[locIdx], 8), Data::LOCATION_NAMES[QUEST_LOCATION_INDEXES[locIdx]]);
 	}
 
-	writeString("Do not return until\n");
-	writeString("thy quest is done!\n");
+	s.writeString(Common::Point(11, 10), "Do not return until");
+	s.writeString(Common::Point(11, 11), "thy quest is done!");
 }
 
 void King::penceKeypress(const KeypressMessage &msg) {
@@ -229,7 +264,6 @@ void King::penceKeypress(const KeypressMessage &msg) {
 }
 
 void King::finish() {
-	writeString("\n");
 	prompt();
 	close();
 }
diff --git a/engines/ultima/ultima1/views/interactions/king.h b/engines/ultima/ultima1/views/interactions/king.h
index fa18832eeec..44f94852f87 100644
--- a/engines/ultima/ultima1/views/interactions/king.h
+++ b/engines/ultima/ultima1/views/interactions/king.h
@@ -39,7 +39,7 @@ using namespace Graphics::Views;
  */
 class King : public Interaction {
 	enum Mode {
-		KING_PROMPT, KING_PENCE
+		KING_PROMPT, KING_PENCE, KING_QUEST
 	};
 private:
 	Mode _mode = KING_PROMPT;
@@ -58,10 +58,16 @@ private:
 	/**
 	 * Starts a new quest for this castle - either to kill a specific
 	 * dungeon monster, or to find a specific landmark - depending on
-	 * whether the castle's index is even or odd
+	 * whether the castle's index is even or odd. The quest is shown in
+	 * a dialog until the player continues
 	 */
 	void giveQuest();
 
+	/**
+	 * Draws the quest dialog
+	 */
+	void drawQuest();
+
 	/**
 	 * Handles the pence amount entry, digit by digit
 	 */
@@ -72,6 +78,7 @@ public:
 	~King() override {
 	}
 
+	void draw() override;
 	bool msgFocus(const FocusMessage &msg) override;
 	bool msgAction(const ActionMessage &msg) override;
 	bool msgKeypress(const KeypressMessage &msg) override;


Commit: 5ff95a1e9bdd1a0b3858f6254718346554757d8e
    https://github.com/scummvm/scummvm/commit/5ff95a1e9bdd1a0b3858f6254718346554757d8e
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:41:05+11:00

Commit Message:
ULTIMA: ULTIMA1: Fix crash loading savegame directly in castle

Changed paths:
    engines/ultima/ultima1/data/tiles.h
    engines/ultima/ultima1/logic/city_castle_logic.cpp


diff --git a/engines/ultima/ultima1/data/tiles.h b/engines/ultima/ultima1/data/tiles.h
index 1005842bb46..6492cef00a7 100644
--- a/engines/ultima/ultima1/data/tiles.h
+++ b/engines/ultima/ultima1/data/tiles.h
@@ -78,6 +78,7 @@ enum OverworldTileId {
 enum LocationTileId {
 	CTILE_WALL = 0,
 	CTILE_GROUND = 1,
+	CTILE_BARRED_DOOR = 11,
 	CTILE_GUARD = 17,
 	CTILE_PLAYER = 18,
 	CTILE_BARD = 19,
diff --git a/engines/ultima/ultima1/logic/city_castle_logic.cpp b/engines/ultima/ultima1/logic/city_castle_logic.cpp
index 26bd0d49cd2..8f6e4583cd7 100644
--- a/engines/ultima/ultima1/logic/city_castle_logic.cpp
+++ b/engines/ultima/ultima1/logic/city_castle_logic.cpp
@@ -686,12 +686,6 @@ CastleLogic::CastleLogic() {
 	_G(savegame)._freeingPrincess = 0;
 	_G(savegame)._castleItemAllowance = 0;
 
-	// The two castle map styles are vertical mirrors of each other, so
-	// the row these two cells sit on differs between them
-	int row = (_G(map)._mapStyle == 0) ? 14 : 4;
-	_G(map)[row][35] = 11;
-	_G(map)[row][31] = 11;
-
 	_G(savegame)._castleKeyVal = getRandomNumber(1) == 1 ? 61 : 60;
 }
 
@@ -754,6 +748,12 @@ bool CastleLogic::unlock() {
 void CastleLogic::entering() {
 	_G(savegame)._locationPosition = Common::Point(0, 9);
 	CityCastleLogic::entering();
+
+	// The two castle map styles are vertical mirrors of each other, so
+	// the row these two cells sit on differs between them
+	int row = (_G(map)._mapStyle == 0) ? 14 : 4;
+	_G(map)[row][35] = Data::CTILE_BARRED_DOOR;
+	_G(map)[row][31] = Data::CTILE_BARRED_DOOR;
 }
 
 void CastleLogic::leaving() {


Commit: de5c5d081fa15f83deab0b2e1ec2e74572a14937
    https://github.com/scummvm/scummvm/commit/de5c5d081fa15f83deab0b2e1ec2e74572a14937
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:41:05+11:00

Commit Message:
ULTIMA: ULTIMA1: Extra console commands

Changed paths:
    engines/ultima/ultima1/console.cpp
    engines/ultima/ultima1/console.h


diff --git a/engines/ultima/ultima1/console.cpp b/engines/ultima/ultima1/console.cpp
index 39cd98090a5..8e20d787435 100644
--- a/engines/ultima/ultima1/console.cpp
+++ b/engines/ultima/ultima1/console.cpp
@@ -35,6 +35,10 @@ Console::Console() : GUI::Debugger() {
 	registerCmd("coins", WRAP_METHOD(Console, cmdCoins));
 	registerCmd("fuel", WRAP_METHOD(Console, cmdFuel));
 	registerCmd("space", WRAP_METHOD(Console, cmdSpace));
+	registerCmd("inventory", WRAP_METHOD(Console, cmdInventory));
+	registerCmd("teleport", WRAP_METHOD(Console, cmdTeleport));
+	registerCmd("locations", WRAP_METHOD(Console, cmdLocations));
+	registerCmd("enemy", WRAP_METHOD(Console, cmdEnemy));
 }
 
 Console::~Console() {
@@ -138,5 +142,150 @@ bool Console::cmdSpace(int argc, const char **argv) {
 	return false;
 }
 
+bool Console::cmdInventory(int argc, const char **argv) {
+	Data::Savegame &sg = _G(savegame);
+
+	for (int i = 1; i < Data::ARMOR_COUNT; ++i)
+		sg._armor[i] = 9;
+	for (int i = 1; i < Data::WEAPON_COUNT; ++i)
+		sg._weapons[i] = 9;
+	for (int i = 1; i < Data::SPELL_COUNT; ++i)
+		sg._spells[i] = 99;
+	for (int i = 1; i < Data::TRANSPORT_COUNT; ++i)
+		sg._transports[i] = 9;
+
+	sg._redGems = sg._greenGems = sg._blueGem = sg._whiteGem = 1;
+	sg._hits = sg._food = sg._coins = 9999;
+
+	sg._equippedWeapon = Data::WEAPON_BLASTER;
+	sg._equippedArmor = Data::ARMOR_REFLECT_SUIT;
+	sg._equippedSpell = Data::SPELL_KILL;
+
+	g_engine->baseView()->findView("Stats")->draw();
+	debugPrintf("Full inventory given; readied %s, %s and %s\n",
+		Data::WEAPON_NAMES[sg._equippedWeapon], Data::ARMOR_NAMES[sg._equippedArmor],
+		Data::SPELL_NAMES[sg._equippedSpell]);
+	return true;
+}
+
+// Returns to the overworld if the player is elsewhere, so a position
+// change on it makes sense
+static void ensureOverworld() {
+	if (_G(savegame)._mapNum != Data::MAP_OVERWORLD) {
+		_G(map).load(Data::MAP_OVERWORLD);
+		_G(logic)->entering();
+	}
+}
+
+bool Console::cmdTeleport(int argc, const char **argv) {
+	Data::Savegame &sg = _G(savegame);
+
+	if (argc == 3) {
+		int x = atoi(argv[1]), y = atoi(argv[2]);
+		if (x < 0 || x >= Data::OVERWORLD_WIDTH || y < 0 || y >= Data::OVERWORLD_HEIGHT) {
+			debugPrintf("Position must be within (0,0) - (%d,%d)\n",
+				Data::OVERWORLD_WIDTH - 1, Data::OVERWORLD_HEIGHT - 1);
+			return true;
+		}
+
+		ensureOverworld();
+		sg._overworldPos = Common::Point(x, y);
+		g_engine->focusedView()->redraw();
+	} else if (argc != 1) {
+		debugPrintf("teleport [<x> <y>]\n");
+		return true;
+	}
+
+	debugPrintf("Position: (%d,%d)\n", sg._overworldPos.x, sg._overworldPos.y);
+	return true;
+}
+
+bool Console::cmdLocations(int argc, const char **argv) {
+	if (argc > 2) {
+		debugPrintf("locations [<number>]\n");
+		return true;
+	}
+
+	int target = (argc == 2) ? atoi(argv[1]) : 0;
+	if (argc == 2 && (target < 1 || target > Data::LOCATION_COUNT)) {
+		debugPrintf("Location number must be 1 to %d\n", Data::LOCATION_COUNT);
+		return true;
+	}
+
+	for (int y = 0; y < Data::OVERWORLD_HEIGHT; ++y) {
+		for (int x = 0; x < Data::OVERWORLD_WIDTH; ++x) {
+			int location = _G(map).getLocationAt(x, y);
+			if (!location)
+				continue;
+
+			if (argc == 1) {
+				debugPrintf("%2d: %-30s (%d,%d)\n", location, Data::LOCATION_NAMES[location - 1], x, y);
+			} else if (location == target) {
+				ensureOverworld();
+				_G(savegame)._overworldPos = Common::Point(x, y);
+				g_engine->focusedView()->redraw();
+				debugPrintf("Teleported to %s (%d,%d)\n", Data::LOCATION_NAMES[location - 1], x, y);
+				return true;
+			}
+		}
+	}
+
+	return true;
+}
+
+bool Console::cmdEnemy(int argc, const char **argv) {
+	Data::Savegame &sg = _G(savegame);
+	if (sg._mapNum != Data::MAP_OVERWORLD) {
+		debugPrintf("Only supported on the overworld map\n");
+		return true;
+	}
+
+	int typeIdx = (argc == 2) ? atoi(argv[1]) : 9;
+	if (argc > 2 || typeIdx < 0 || typeIdx >= Data::MONSTER_TYPE_COUNT) {
+		debugPrintf("enemy [<type>], where type is:\n");
+		for (int i = 0; i < Data::MONSTER_TYPE_COUNT; ++i)
+			debugPrintf("%2d: %s\n", i, Data::OVERWORLD_MONSTERS[i]);
+		return true;
+	}
+
+	if (_G(overworldEntityCount) >= Data::OVERWORLD_ENTITY_COUNT - 1) {
+		debugPrintf("No free entity slots\n");
+		return true;
+	}
+
+	// Each type only appears on its own home terrain
+	int terrain = (typeIdx < 4) ? Data::TILE_OCEAN : (typeIdx < 9) ? Data::TILE_WOODS : Data::TILE_GRASS;
+
+	for (int radius = 2; radius <= 8; ++radius) {
+		for (int dy = -radius; dy <= radius; ++dy) {
+			for (int dx = -radius; dx <= radius; ++dx) {
+				if (MAX(ABS(dx), ABS(dy)) != radius)
+					continue;
+
+				int x = sg._overworldPos.x + dx, y = sg._overworldPos.y + dy;
+				if (x < 0 || x >= Data::OVERWORLD_WIDTH || y < 0 || y >= Data::OVERWORLD_HEIGHT ||
+						_G(map).getTileAt(x, y) != terrain)
+					continue;
+
+				++_G(overworldEntityCount);
+				auto &e = sg._overworldEntities[_G(overworldEntityCount)];
+				e._type = Data::TILE_FIRST_MONSTER + typeIdx * 2;
+				e._data = terrain;
+				e._x = x;
+				e._y = y;
+				e._hits = Data::OVERWORLD_MONSTERS_HITS[typeIdx] * 10 + 2;
+				++_G(creaturesCount);
+
+				g_engine->focusedView()->redraw();
+				debugPrintf("Spawned %s at (%d,%d)\n", Data::OVERWORLD_MONSTERS[typeIdx], x, y);
+				return true;
+			}
+		}
+	}
+
+	debugPrintf("No suitable terrain for a %s nearby\n", Data::OVERWORLD_MONSTERS[typeIdx]);
+	return true;
+}
+
 } // namespace Ultima1
 } // namespace Ultima
diff --git a/engines/ultima/ultima1/console.h b/engines/ultima/ultima1/console.h
index 0829afc257b..81ce083421d 100644
--- a/engines/ultima/ultima1/console.h
+++ b/engines/ultima/ultima1/console.h
@@ -37,6 +37,10 @@ private:
 	bool cmdCoins(int argc, const char **argv);
 	bool cmdFuel(int argc, const char **argv);
 	bool cmdSpace(int argc, const char **argv);
+	bool cmdInventory(int argc, const char **argv);
+	bool cmdTeleport(int argc, const char **argv);
+	bool cmdLocations(int argc, const char **argv);
+	bool cmdEnemy(int argc, const char **argv);
 
 public:
 	Console();


Commit: 0104372dac1db43ae5ceee93fb9b50a1c0bc5507
    https://github.com/scummvm/scummvm/commit/0104372dac1db43ae5ceee93fb9b50a1c0bc5507
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:41:05+11:00

Commit Message:
ULTIMA: ULTIMA1: Attack action fixes

Changed paths:
    engines/ultima/ultima1/console.cpp
    engines/ultima/ultima1/logic/city_castle_logic.cpp
    engines/ultima/ultima1/logic/logic.cpp
    engines/ultima/ultima1/logic/overworld_logic.cpp
    engines/ultima/ultima1/views/interactions/direction.cpp
    engines/ultima/ultima1/views/interactions/direction.h
    engines/ultima/ultima1/views/views.h


diff --git a/engines/ultima/ultima1/console.cpp b/engines/ultima/ultima1/console.cpp
index 8e20d787435..3f5d0552b08 100644
--- a/engines/ultima/ultima1/console.cpp
+++ b/engines/ultima/ultima1/console.cpp
@@ -157,6 +157,9 @@ bool Console::cmdInventory(int argc, const char **argv) {
 	sg._redGems = sg._greenGems = sg._blueGem = sg._whiteGem = 1;
 	sg._hits = sg._food = sg._coins = 9999;
 
+	if (_G(map)._mapType == Data::MAPTYPE_CASTLE)
+		sg._hasCastleKey = 1;
+
 	sg._equippedWeapon = Data::WEAPON_BLASTER;
 	sg._equippedArmor = Data::ARMOR_REFLECT_SUIT;
 	sg._equippedSpell = Data::SPELL_KILL;
diff --git a/engines/ultima/ultima1/logic/city_castle_logic.cpp b/engines/ultima/ultima1/logic/city_castle_logic.cpp
index 8f6e4583cd7..43672d38de3 100644
--- a/engines/ultima/ultima1/logic/city_castle_logic.cpp
+++ b/engines/ultima/ultima1/logic/city_castle_logic.cpp
@@ -223,6 +223,7 @@ void CityCastleLogic::attackPerson(Data::Direction dir, int maxDistance, int str
 
 	if (!hit) {
 		writeString("Missed!\n");
+		endOfTurn();
 		return;
 	}
 
@@ -284,6 +285,8 @@ void CityCastleLogic::attackPerson(Data::Direction dir, int maxDistance, int str
 
 		writeString("%d damage!\n", strike);
 	}
+
+	endOfTurn();
 }
 
 bool CityCastleLogic::drop() {
@@ -680,13 +683,6 @@ CastleLogic::CastleLogic() {
 	_G(map)._mapStyle = (_G(savegame)._mapNum - 1) % 2;
 	_G(map)._castleNum2 = _G(map)._castleNum + 1;
 	_G(map)._mapType = Data::MAPTYPE_CASTLE;
-
-	_G(savegame)._guardsHostile = 0;
-	_G(savegame)._hasCastleKey = 0;
-	_G(savegame)._freeingPrincess = 0;
-	_G(savegame)._castleItemAllowance = 0;
-
-	_G(savegame)._castleKeyVal = getRandomNumber(1) == 1 ? 61 : 60;
 }
 
 bool CastleLogic::transact() {
@@ -749,6 +745,12 @@ void CastleLogic::entering() {
 	_G(savegame)._locationPosition = Common::Point(0, 9);
 	CityCastleLogic::entering();
 
+	_G(savegame)._guardsHostile = 0;
+	_G(savegame)._hasCastleKey = 0;
+	_G(savegame)._freeingPrincess = 0;
+	_G(savegame)._castleItemAllowance = 0;
+	_G(savegame)._castleKeyVal = getRandomNumber(1) == 1 ? 61 : 60;
+
 	// The two castle map styles are vertical mirrors of each other, so
 	// the row these two cells sit on differs between them
 	int row = (_G(map)._mapStyle == 0) ? 14 : 4;
diff --git a/engines/ultima/ultima1/logic/logic.cpp b/engines/ultima/ultima1/logic/logic.cpp
index 8085c6ebac5..883ab28f5ce 100644
--- a/engines/ultima/ultima1/logic/logic.cpp
+++ b/engines/ultima/ultima1/logic/logic.cpp
@@ -88,6 +88,8 @@ void Logic::endOfTurn() {
 
 	if (_G(savegame)._hits <= 0)
 		g_engine->addView("Dead");
+	else
+		prompt();
 }
 
 void Logic::action(int action) {
@@ -193,9 +195,6 @@ void Logic::action(int action) {
 		// still in the same map we started on
 		if (_G(logic) == currLogic)
 			endOfTurn();
-
-		if (_G(savegame)._hits > 0)
-			prompt();
 	}
 }
 
@@ -374,6 +373,7 @@ bool Logic::pass() {
 void Logic::combat(Data::Direction direction, int effect) {
 	if (direction == Data::DIR_UNSPECIFIED) {
 		writeString("nothing\n");
+		prompt();
 	} else {
 		writeString("%s\n", Data::DIRECTION_NAMES[direction]);
 		combatDir(direction, effect);
@@ -407,6 +407,8 @@ DirectionLogic::DirectionLogic(Mode mode) : _mode(mode) {
 
 void DirectionLogic::action(int action) {
 	Data::Direction dir;
+	Common::SharedPtr<Logic> old = _oldLogic;
+	Mode mode = _mode;
 
 	switch (action) {
 	case KEYBIND_UP:
@@ -426,18 +428,20 @@ void DirectionLogic::action(int action) {
 		break;
 	}
 
-	_G(logic) = _oldLogic;
+	// Restore the old logic handler. This will remove the only reference to this,
+	// which will delete it. So after this line, 'this' will no longer be valid
+	_G(logic) = old;
 
-	switch (_mode) {
+	switch (mode) {
 	case SPELL:
-		_oldLogic->castSpellAttack(dir);
+		old->castSpellAttack(dir);
 		break;
 	case WEAPON:
-		_oldLogic->combat(dir, 7);
+		old->combat(dir, 7);
 		break;
 	case FIRE:
 	default:
-		_oldLogic->combat(dir, 8);
+		old->combat(dir, 8);
 		break;
 	}
 }
diff --git a/engines/ultima/ultima1/logic/overworld_logic.cpp b/engines/ultima/ultima1/logic/overworld_logic.cpp
index f5d2e81d5a4..d13920d7031 100644
--- a/engines/ultima/ultima1/logic/overworld_logic.cpp
+++ b/engines/ultima/ultima1/logic/overworld_logic.cpp
@@ -732,6 +732,7 @@ void OverworldLogic::damage(Data::Direction dir, int effectNum, int maxDistance,
 	if (tile < Data::TILE_FIRST_MONSTER) {
 		// Ran out of range, or blocked by mountains, without finding a monster
 		writeString("Miss!\n");
+		endOfTurn();
 		return;
 	}
 
@@ -740,6 +741,7 @@ void OverworldLogic::damage(Data::Direction dir, int effectNum, int maxDistance,
 
 	if (getRandomNumber(1, 100) > hitChance) {
 		writeString("Missed the %s!\n", monsterName);
+		endOfTurn();
 		return;
 	}
 
@@ -749,6 +751,7 @@ void OverworldLogic::damage(Data::Direction dir, int effectNum, int maxDistance,
 		// Shouldn't normally happen - the scan found a monster tile with no
 		// matching entity there
 		writeString("Miss!\n");
+		endOfTurn();
 		return;
 	}
 
@@ -774,6 +777,8 @@ void OverworldLogic::damage(Data::Direction dir, int effectNum, int maxDistance,
 		giveCoins(coins);
 		redrawStats();
 	}
+
+	endOfTurn();
 }
 
 void OverworldLogic::castSpellAttack(Data::Direction dir) {
diff --git a/engines/ultima/ultima1/views/interactions/direction.cpp b/engines/ultima/ultima1/views/interactions/direction.cpp
index 577823ce9ea..593947e90e2 100644
--- a/engines/ultima/ultima1/views/interactions/direction.cpp
+++ b/engines/ultima/ultima1/views/interactions/direction.cpp
@@ -30,11 +30,19 @@ namespace Views {
 namespace Interactions {
 
 bool Direction::msgFocus(const FocusMessage &msg) {
+	MetaEngine::setKeybindingMode(KBMODE_GAMEPLAY);	// Need for direction keybindings
 	showCursor();
 	return true;
 }
 
+bool Direction::msgUnfocus(const UnfocusMessage &msg) {
+	MetaEngine::setKeybindingMode(KBMODE_MINIMAL);
+	return Interaction::msgUnfocus(msg);
+}
+
 bool Direction::msgAction(const ActionMessage &msg) {
+	close();
+
 	switch (msg._action) {
 	case KEYBIND_UP:
 	case KEYBIND_ATTACK_UP:
diff --git a/engines/ultima/ultima1/views/interactions/direction.h b/engines/ultima/ultima1/views/interactions/direction.h
index eeece8b01b8..5ad55bd0050 100644
--- a/engines/ultima/ultima1/views/interactions/direction.h
+++ b/engines/ultima/ultima1/views/interactions/direction.h
@@ -44,6 +44,7 @@ public:
 	}
 
 	bool msgFocus(const FocusMessage &msg) override;
+	bool msgUnfocus(const UnfocusMessage &msg) override;
 	bool msgAction(const ActionMessage &msg) override;
 	bool msgKeypress(const KeypressMessage &msg) override;
 };
diff --git a/engines/ultima/ultima1/views/views.h b/engines/ultima/ultima1/views/views.h
index ff65ec7d30e..b898f29b20c 100644
--- a/engines/ultima/ultima1/views/views.h
+++ b/engines/ultima/ultima1/views/views.h
@@ -24,6 +24,7 @@
 
 #include "graphics/views/events.h"
 #include "ultima/ultima1/views/interactions/dead.h"
+#include "ultima/ultima1/views/interactions/direction.h"
 #include "ultima/ultima1/views/interactions/drop.h"
 #include "ultima/ultima1/views/interactions/entering_craft.h"
 #include "ultima/ultima1/views/interactions/king.h"
@@ -57,6 +58,7 @@ namespace Views {
 
 struct Views {
 	Interactions::Dead _dead;
+	Interactions::Direction _direction;
 	Interactions::Drop _drop;
 	Interactions::EnteringCraft _enteringCraft;
 	Interactions::King _king;


Commit: c47e409791cc57707f3e946963ae94029c841ca8
    https://github.com/scummvm/scummvm/commit/c47e409791cc57707f3e946963ae94029c841ca8
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:41:05+11:00

Commit Message:
ULTIMA: ULTIMA1: Fixes for saving princess

Changed paths:
    engines/ultima/ultima1/logic/city_castle_logic.cpp
    engines/ultima/ultima1/views/interactions/princess_saved.cpp
    engines/ultima/ultima1/views/interactions/princess_saved.h


diff --git a/engines/ultima/ultima1/logic/city_castle_logic.cpp b/engines/ultima/ultima1/logic/city_castle_logic.cpp
index 43672d38de3..249c5ce5d48 100644
--- a/engines/ultima/ultima1/logic/city_castle_logic.cpp
+++ b/engines/ultima/ultima1/logic/city_castle_logic.cpp
@@ -140,6 +140,7 @@ bool CityCastleLogic::move(Data::Direction dir) {
 
 	if (x < 0 || y < 0 || x >= Data::CITY_WIDTH || y >= Data::CITY_HEIGHT) {
 		leaving();
+		return false;
 
 	} else {
 		int tile = checkAt(x, y);
@@ -157,9 +158,9 @@ bool CityCastleLogic::move(Data::Direction dir) {
 			writeString("Blocked!\n");
 			playFX(1);
 		}
-	}
 
-	return true;
+		return true;
+	}
 }
 
 void CityCastleLogic::updateCreatures() {
diff --git a/engines/ultima/ultima1/views/interactions/princess_saved.cpp b/engines/ultima/ultima1/views/interactions/princess_saved.cpp
index 9e31ab46c1b..53358f4b4e0 100644
--- a/engines/ultima/ultima1/views/interactions/princess_saved.cpp
+++ b/engines/ultima/ultima1/views/interactions/princess_saved.cpp
@@ -28,6 +28,10 @@ namespace Ultima1 {
 namespace Views {
 namespace Interactions {
 
+// Same generic dialog box geometry the Lose and Win views use
+constexpr int DIALOG_X1 = 31, DIALOG_Y1 = 23, DIALOG_X2 = 287, DIALOG_Y2 = 127;
+constexpr int BORDER_X1 = 34, BORDER_Y1 = 26, BORDER_X2 = 284, BORDER_Y2 = 124;
+
 // Indexed by Map::_castleNum (0-7)
 static const char *const PRINCESS_NAMES[8] = {
 	"Julia", "Cassandra", "Marsha", "Donna", "Kristen", "Beth", "Lori", "Dianne"
@@ -37,38 +41,49 @@ PrincessSaved::PrincessSaved() : Interaction("PrincessSaved") {
 }
 
 bool PrincessSaved::msgFocus(const FocusMessage &msg) {
-	setBounds(Common::Rect(0, 0, 0, 0));
+	setBounds(Graphics::Views::TextRect(0, 0, 39, 19));
 	auto &sg = _G(savegame);
 
-	// Whether the player has already done enough to be ready to win, checked
-	// before this rescue's reward is applied, matching the original
-	bool readyForTimeTravel = sg._enemyVessels >= 20 && sg._experience >= 7000;
-
-	writeString(Common::String::format("Thou hast saved the princess %s.  She giveth thee\n",
-		PRINCESS_NAMES[_G(map)._castleNum]));
-	writeString("500 hit points, pence and experience points.\n");
+	// Whether the player has already done enough to be ready to win
+	_readyForTimeTravel = sg._enemyVessels >= 20 && sg._experience >= 7000;
 
 	sg._coins += 500;
 	sg._hits += 500;
 	sg._experience += 500;
 	g_engine->findView("Stats")->draw();
 
-	if (readyForTimeTravel) {
-		writeString("\n");
-		writeString("She informs thee that thou art now ready for time travel,\n");
-		writeString("and that there is a time machine far to the northwest!\n");
-
-		if (sg._transports[Data::TRANSPORT_TIME_MACHINE] < 9) {
-			++sg._transports[Data::TRANSPORT_TIME_MACHINE];
-			spawnTimeMachine();
-		}
+	if (_readyForTimeTravel && sg._transports[Data::TRANSPORT_TIME_MACHINE] < 9) {
+		++sg._transports[Data::TRANSPORT_TIME_MACHINE];
+		spawnTimeMachine();
 	}
 
-	writeString("\n");
-	showCursor();
+	g_engine->send("Commands", GameMessage("SPACE2"));
 	return true;
 }
 
+void PrincessSaved::draw() {
+	// Without the time travel message the text sits a little lower
+	int y = _readyForTimeTravel ? 0 : 2;
+
+	auto s = getSurface();
+	s.fillRect(Common::Rect(DIALOG_X1, DIALOG_Y1, DIALOG_X2, DIALOG_Y2), 0);
+	s.frameRect(Common::Rect(BORDER_X1, BORDER_Y1, BORDER_X2, BORDER_Y2), _G(colors)._border);
+	s.setColor(_G(colors)._text);
+
+	s.writeString(Common::Point(5, y + 5), " Thou hast saved the princess");
+	s.writeString(Common::Point(5, y + 6), Common::String::format("%s.  She giveth thee",
+		PRINCESS_NAMES[_G(map)._castleNum]));
+	s.writeString(Common::Point(8, y + 7), "500 hit points, pence and");
+	s.writeString(Common::Point(12, y + 8), "experience points.");
+
+	if (_readyForTimeTravel) {
+		s.writeString(Common::Point(5, 10), "  She informs thee that thou");
+		s.writeString(Common::Point(5, 11), "art now ready for time travel,");
+		s.writeString(Common::Point(5, 12), "    and that there is a time");
+		s.writeString(Common::Point(5, 13), " machine far to the northwest!");
+	}
+}
+
 bool PrincessSaved::msgAction(const ActionMessage &msg) {
 	finish();
 	return true;
diff --git a/engines/ultima/ultima1/views/interactions/princess_saved.h b/engines/ultima/ultima1/views/interactions/princess_saved.h
index 123a2ef795d..fd5b0714147 100644
--- a/engines/ultima/ultima1/views/interactions/princess_saved.h
+++ b/engines/ultima/ultima1/views/interactions/princess_saved.h
@@ -41,6 +41,8 @@ using namespace Graphics::Views;
  */
 class PrincessSaved : public Interaction {
 private:
+	bool _readyForTimeTravel = false;
+
 	/**
 	 * Hides a time machine on the overworld, near the continent the player
 	 * is currently on, on a random patch of woods
@@ -57,6 +59,7 @@ public:
 	~PrincessSaved() override {
 	}
 
+	void draw() override;
 	bool msgFocus(const FocusMessage &msg) override;
 	bool msgAction(const ActionMessage &msg) override;
 	bool msgKeypress(const KeypressMessage &msg) override;


Commit: 3fe5e3cb2aa037d8b70943850124e9e8763d4f13
    https://github.com/scummvm/scummvm/commit/3fe5e3cb2aa037d8b70943850124e9e8763d4f13
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:41:05+11:00

Commit Message:
ULTIMA: ULTIMA1: Fix Pass action keybinding

Changed paths:
    engines/ultima/ultima1/metaengine.cpp


diff --git a/engines/ultima/ultima1/metaengine.cpp b/engines/ultima/ultima1/metaengine.cpp
index 32752dc92de..82659d0a8c9 100644
--- a/engines/ultima/ultima1/metaengine.cpp
+++ b/engines/ultima/ultima1/metaengine.cpp
@@ -74,7 +74,7 @@ static const KeybindingRecord GAMEPLAY_KEYS[] = {
 	{ KEYBIND_VIEW, "VIEW", _s("View change"), "v", nullptr },
 	{ KEYBIND_EXIT, "EXIT", _s("eXit"), "x", nullptr },
 	{ KEYBIND_STATS, "STATS", _s("Ztats"), "z", nullptr },
-	{ KEYBIND_PASS, "PASS", _s("Pass"), " ", nullptr },
+	{ KEYBIND_PASS, "PASS", _s("Pass"), "SPACE", nullptr },
 	{ KEYBIND_NONE, nullptr, nullptr, nullptr, nullptr }
 };
 


Commit: c7b33eaa77736034e31c7f3df5fe4370da13a9c2
    https://github.com/scummvm/scummvm/commit/c7b33eaa77736034e31c7f3df5fe4370da13a9c2
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:41:05+11:00

Commit Message:
ULTIMA: ULTIMA1: Merchant fixes

Changed paths:
    engines/ultima/ultima1/data/map.h
    engines/ultima/ultima1/data/savegame.cpp
    engines/ultima/ultima1/data/savegame.h
    engines/ultima/ultima1/logic/overworld_logic.cpp
    engines/ultima/ultima1/views/interactions/king.cpp
    engines/ultima/ultima1/views/interactions/king.h
    engines/ultima/ultima1/views/interactions/merchant.cpp
    engines/ultima/ultima1/views/interactions/merchant.h
    engines/ultima/ultima1/views/interactions/operate_craft.cpp
    engines/ultima/ultima1/views/interactions/operate_craft.h


diff --git a/engines/ultima/ultima1/data/map.h b/engines/ultima/ultima1/data/map.h
index e9954dc5911..02fc505c8a0 100644
--- a/engines/ultima/ultima1/data/map.h
+++ b/engines/ultima/ultima1/data/map.h
@@ -130,7 +130,6 @@ public:
 	byte _tilePlayerCenter = 0;
 	byte _tilePlayerUp = 0, _tilePlayerDown = 0,
 		_tilePlayerLeft = 0, _tilePlayerRight = 0;
-	int _woodsCount = 0, _grassCount = 0, _waterCount = 0;	// Tiles surrounding entered locations
 	bool _isLordBritishCastle = false;
 	int _mapStyle = 0;
 	int _mapType = MAPTYPE_OVERWORLD;
diff --git a/engines/ultima/ultima1/data/savegame.cpp b/engines/ultima/ultima1/data/savegame.cpp
index 50f2ed75174..55d9e9db61b 100644
--- a/engines/ultima/ultima1/data/savegame.cpp
+++ b/engines/ultima/ultima1/data/savegame.cpp
@@ -79,6 +79,8 @@ void Savegame::synchronizeBasic(Common::Serializer &s) {
 	for (int i = 0; i < TRANSPORT_COUNT; ++i)
 		s.syncAsSint16LE(_transports[i]);
 
+	s.syncMultipleLE(_woodsCount, _grassCount, _waterCount);
+
 	s.syncAsSint16LE(_enemyVessels);
 	s.syncAsSint16LE(_signMarker);
 	s.syncAsSint16LE(_overworldEntityCount);
diff --git a/engines/ultima/ultima1/data/savegame.h b/engines/ultima/ultima1/data/savegame.h
index a50ec8a2fbd..d7acc404e1c 100644
--- a/engines/ultima/ultima1/data/savegame.h
+++ b/engines/ultima/ultima1/data/savegame.h
@@ -127,6 +127,7 @@ public:
 	uint8 _dungeonLevel = 1;
 	uint8 _dungeonDirection = 4;
 	uint16 _dungeonExitHitPoints = 0;
+	int8 _woodsCount = 0, _grassCount = 0, _waterCount = 0;	// Tiles surrounding entered locations
 
 	// Outer space state - synchronized only while _mapNum == MAP_SPACE
 	int16 _sectorX = SPACE_STATION_X;
diff --git a/engines/ultima/ultima1/logic/overworld_logic.cpp b/engines/ultima/ultima1/logic/overworld_logic.cpp
index d13920d7031..e5c8fd4ff36 100644
--- a/engines/ultima/ultima1/logic/overworld_logic.cpp
+++ b/engines/ultima/ultima1/logic/overworld_logic.cpp
@@ -137,22 +137,22 @@ bool OverworldLogic::enter() {
 		playFX(1);
 	} else {
 		// Check for tiles surrounding the location
-		_G(map)._waterCount = 0;
-		_G(map)._grassCount = 0;
-		_G(map)._woodsCount = 0;
+		_G(savegame)._waterCount = 0;
+		_G(savegame)._grassCount = 0;
+		_G(savegame)._woodsCount = 0;
 
 		for (int deltaY = -1; deltaY <= 1; ++deltaY) {
 			for (int deltaX = -1; deltaX <= 1; ++deltaX) {
 				int tile = _G(map).getTileAt(_G(savegame)._overworldPos.x + deltaX, _G(savegame)._overworldPos.y + deltaY);
 				switch (tile) {
 				case Data::TILE_OCEAN:
-					_G(map)._waterCount++;
+					_G(savegame)._waterCount++;
 					break;
 				case Data::TILE_GRASS:
-					_G(map)._grassCount++;
+					_G(savegame)._grassCount++;
 					break;
 				case Data::TILE_WOODS:
-					_G(map)._woodsCount++;
+					_G(savegame)._woodsCount++;
 					break;
 				default:
 					break;
diff --git a/engines/ultima/ultima1/views/interactions/king.cpp b/engines/ultima/ultima1/views/interactions/king.cpp
index 775e9defa1e..07a403714af 100644
--- a/engines/ultima/ultima1/views/interactions/king.cpp
+++ b/engines/ultima/ultima1/views/interactions/king.cpp
@@ -47,12 +47,13 @@ static const int QUEST_LOCATION_INDEXES[4] = { 47, 45, 43, 41 };
 static const int QUEST_LOCATION_X[4] = { 8, 10, 9, 9 };
 
 // Reward text shown for a completed "kill a monster" quest, indexed by the
-// continent the player is currently standing on
-static const char *const GEM_REWARD_MESSAGES[4] = {
-	"that it requires all four gems\nto launch a time machine!\n\nThe king gives thee a red gem.\n",
-	"that the time machine must be\nused in order to win.\n\nThe king gives thee a green gem!\n",
-	"the princess will help a\nspace ace through time!\n\nThe king gives thee a blue gem!\n",
-	"to take nine items from my\nstorerooms - but only nine!\n\nThe king also gives thee a white gem!\n"
+// continent the player is currently standing on. These are the lines for
+// rows 9, 10, 12 and 13 of the dialog
+static const char *const GEM_REWARD_LINES[4][4] = {
+	{ "that it requires all four gems", "  to launch a time machine!", "The king gives thee a red gem.", nullptr },
+	{ "that the time machine must be", "     used in order to win.", "     The king gives thee a", "           green gem!" },
+	{ "   the princess will help a", "   space ace through time!", "    The king gives thee a", "          blue gem!" },
+	{ "   to take nine items from my", "  storerooms - but only nine!", "   The king also gives thee a", "          white gem!" }
 };
 
 King::King() : Interaction("King") {
@@ -62,10 +63,8 @@ bool King::msgFocus(const FocusMessage &msg) {
 	_mode = KING_PROMPT;
 	setBounds(Common::Rect(0, 0, 0, 0));
 
-	if (checkQuestReward()) {
-		finish();
+	if (checkQuestReward())
 		return true;
-	}
 
 	writeString("Dost thou offer pence\n");
 	writeString("or service: ");
@@ -74,7 +73,7 @@ bool King::msgFocus(const FocusMessage &msg) {
 }
 
 bool King::msgAction(const ActionMessage &msg) {
-	if (_mode == KING_QUEST)
+	if (_mode == KING_QUEST || _mode == KING_REWARD)
 		return true;
 
 	writeString("neither\n");
@@ -85,6 +84,7 @@ bool King::msgAction(const ActionMessage &msg) {
 bool King::msgKeypress(const KeypressMessage &msg) {
 	switch (_mode) {
 	case KING_QUEST:
+	case KING_REWARD:
 		if (msg.keycode == Common::KEYCODE_SPACE || msg.keycode == Common::KEYCODE_RETURN) {
 			prompt();
 			close();
@@ -135,18 +135,14 @@ bool King::checkQuestReward() {
 
 	sg._questStatus[castleIdx] = 0;
 
-	writeString(Common::String::format("Ah, %s!  Thou hast\n", sg._name));
-	writeString("completed thy quest.\n");
-
 	if (castleIdx % 2 != 0) {
 		// Odd castle index - a "find a location" quest rewards strength points
-		int amount = (99 - sg._strength) / 8;
-		if (amount == 0 && sg._strength != 99)
-			amount = 1;
+		_rewardContinent = -1;
+		_rewardPoints = (99 - sg._strength) / 8;
+		if (_rewardPoints == 0 && sg._strength != 99)
+			_rewardPoints = 1;
 
-		writeString(Common::String::format("For this I will give thee %d point%s of strength.\n",
-			amount, amount == 1 ? "" : "s"));
-		sg._strength += amount;
+		sg._strength += _rewardPoints;
 
 	} else {
 		// Even castle index - a "kill a monster" quest rewards a gem, based
@@ -155,11 +151,9 @@ bool King::checkQuestReward() {
 		// coordinates, so this ends up passing meaningless in-castle
 		// coordinates to the continent lookup; using the real overworld
 		// position instead
-		int continent = _G(map).getContinentAt(sg._overworldPos);
-		writeString("For this I shall tell thee\n");
-		writeString(GEM_REWARD_MESSAGES[continent]);
+		_rewardContinent = _G(map).getContinentAt(sg._overworldPos);
 
-		switch (continent) {
+		switch (_rewardContinent) {
 		case 0:
 			++sg._redGems;
 			break;
@@ -169,16 +163,18 @@ bool King::checkQuestReward() {
 		case 2:
 			++sg._blueGem;
 			break;
-		case 3:
+		default:
 			++sg._whiteGem;
 			sg._castleItemAllowance = 9;
 			break;
-		default:
-			break;
 		}
 	}
 
+	_mode = KING_REWARD;
+	setBounds(Graphics::Views::TextRect(0, 0, 39, 19));
+	redraw();
 	redrawStats();
+	g_engine->send("Commands", GameMessage("SPACE2"));
 	return true;
 }
 
@@ -194,15 +190,44 @@ void King::giveQuest() {
 void King::draw() {
 	if (_mode == KING_QUEST)
 		drawQuest();
+	else if (_mode == KING_REWARD)
+		drawReward();
 }
 
-void King::drawQuest() {
-	int castleIdx = _G(map)._castleNum2;
-
+void King::drawBox() {
 	auto s = getSurface();
 	s.fillRect(Common::Rect(DIALOG_X1, DIALOG_Y1, DIALOG_X2, DIALOG_Y2), 0);
 	s.frameRect(Common::Rect(BORDER_X1, BORDER_Y1, BORDER_X2, BORDER_Y2), _G(colors)._border);
 	s.setColor(_G(colors)._text);
+}
+
+void King::drawReward() {
+	drawBox();
+	auto s = getSurface();
+
+	const char *name = _G(savegame)._name;
+	s.writeString(Common::Point(12 - (int)strlen(name) / 2, 5), "Ah, %s!  Thou hast", name);
+	s.writeString(Common::Point(10, 6), "completed thy quest.");
+
+	if (_rewardContinent < 0) {
+		s.writeString(Common::Point(8, 8), "For this I will give thee");
+		s.writeString(Common::Point(10, 9), "%d point%s of strength.", _rewardPoints, _rewardPoints == 1 ? "" : "s");
+	} else {
+		s.writeString(Common::Point(7, 8), "For this I shall tell thee");
+
+		static const int ROWS[4] = { 9, 10, 12, 13 };
+		for (int i = 0; i < 4; ++i) {
+			if (GEM_REWARD_LINES[_rewardContinent][i])
+				s.writeString(Common::Point(5, ROWS[i]), "%s", GEM_REWARD_LINES[_rewardContinent][i]);
+		}
+	}
+}
+
+void King::drawQuest() {
+	int castleIdx = _G(map)._castleNum2;
+
+	drawBox();
+	auto s = getSurface();
 
 	if (castleIdx % 2 == 0) {
 		s.writeString(Common::Point(12, 6), "Go now and kill a");
diff --git a/engines/ultima/ultima1/views/interactions/king.h b/engines/ultima/ultima1/views/interactions/king.h
index 44f94852f87..485a1e7df6a 100644
--- a/engines/ultima/ultima1/views/interactions/king.h
+++ b/engines/ultima/ultima1/views/interactions/king.h
@@ -39,11 +39,15 @@ using namespace Graphics::Views;
  */
 class King : public Interaction {
 	enum Mode {
-		KING_PROMPT, KING_PENCE, KING_QUEST
+		KING_PROMPT, KING_PENCE, KING_QUEST, KING_REWARD
 	};
 private:
 	Mode _mode = KING_PROMPT;
 	Common::String _amount;
+	// Details of a quest reward being shown: the strength points given, or
+	// the continent the gem reward is for when not a strength reward
+	int _rewardPoints = 0;
+	int _rewardContinent = 0;
 
 	void finish();
 	void redrawStats();
@@ -63,11 +67,21 @@ private:
 	 */
 	void giveQuest();
 
+	/**
+	 * Draws the dialog box that quest and reward screens appear in
+	 */
+	void drawBox();
+
 	/**
 	 * Draws the quest dialog
 	 */
 	void drawQuest();
 
+	/**
+	 * Draws the quest completion reward dialog
+	 */
+	void drawReward();
+
 	/**
 	 * Handles the pence amount entry, digit by digit
 	 */
diff --git a/engines/ultima/ultima1/views/interactions/merchant.cpp b/engines/ultima/ultima1/views/interactions/merchant.cpp
index de8246ea983..2cd31fa5537 100644
--- a/engines/ultima/ultima1/views/interactions/merchant.cpp
+++ b/engines/ultima/ultima1/views/interactions/merchant.cpp
@@ -29,6 +29,10 @@ namespace Views {
 namespace Interactions {
 
 
+// Same generic dialog box geometry the Lose and Win views use
+constexpr int DIALOG_X1 = 31, DIALOG_Y1 = 23, DIALOG_X2 = 287, DIALOG_Y2 = 127;
+constexpr int BORDER_X1 = 34, BORDER_Y1 = 26, BORDER_X2 = 284, BORDER_Y2 = 124;
+
 struct ShopName {
 	const char *_line1;
 	const char *_line2;
@@ -73,26 +77,29 @@ static const ShopName TRANSPORT_SHOP_NAMES[8] = {
 	{ nullptr, nullptr }, { "Sly Sam's Transportation", "Specialists" }
 };
 
-// Tavern tip/rumor flavor texts. Index 0 is the drunk penalty message
-// (no header); indices 1-8 are prefixed with "Thou had best know " when
-// shown. Index 2 is sex-dependent and filled in at the point of use
-static const char *const TAVERN_TIPS[9] = {
-	"Thou hast been seduced!\nAfter a long night,\nthou art back.",
-	"about space travel!\nThou must destroy at least 20 enemy vessels\nto become an ace!",
-	nullptr,
-	"that the princess will give great reward to the one who\nrescues her, and an extra gift to an 8th level ace!",
-	"thou must go back in time.",
-	"thou should destroy the evil gem!",
-	"that many lakes and ponds have strong magical powers!",
-	"this is a great game!",
-	"that over 1000 years ago, Mondain the Wizard created an evil gem.\n"
-	"With this gem, he is immortal and cannot be defeated.\n\n"
-	"The quest of --Ultima-- is to traverse the lands in search\n"
-	"of a time machine.  Upon finding such a device, thou\n"
-	"should go back in time to the days before Mondain created\n"
-	"the evil gem and destroy him!"
+// Text column of each shop's first name line, in the same order and per
+// variant as the name tables above. Their second lines (only the
+// armoury/weapon shops' first variant and the transport shops' first and
+// last variants have one) are at a fixed column
+static const byte NAME_X[6][8] = {
+	{ 11, 15, 13, 10, 0, 5, 0, 11 },
+	{ 11, 11, 12, 10, 12, 13, 12, 10 },
+	{ 9, 12, 13, 5, 0, 0, 0, 11 },
+	{ 5, 8, 0, 13, 9, 11, 6, 8 },
+	{ 14, 11, 13, 13, 0, 12, 10, 11 },
+	{ 10, 0, 0, 9, 0, 7, 0, 8 }
 };
 
+// Looks up the proprietor name for a shop, which varies per city
+static const ShopName &shopNameFor(int shopType, int variant) {
+	static const ShopName *const TABLES[6] = {
+		ARMORY_NAMES, WEAPON_SHOP_NAMES, MAGIC_SHOP_NAMES,
+		GROCER_SHOP_NAMES, TAVERN_SHOP_NAMES, TRANSPORT_SHOP_NAMES
+	};
+
+	return TABLES[shopType][variant];
+}
+
 Merchant::Merchant() : Interaction("Merchant") {
 }
 
@@ -131,7 +138,10 @@ bool Merchant::msgFocus(const FocusMessage &msg) {
 }
 
 bool Merchant::msgAction(const ActionMessage &msg) {
-	nothing();
+	if (_mode == SHOP_MESSAGE)
+		nextScreen();
+	else
+		nothing();
 	return true;
 }
 
@@ -146,6 +156,10 @@ bool Merchant::msgKeypress(const KeypressMessage &msg) {
 			nothing();
 		break;
 
+	case SHOP_MESSAGE:
+		nextScreen();
+		break;
+
 	case SHOP_BUY:
 		switch (_shopType) {
 		case SHOP_ARMORY:
@@ -187,14 +201,25 @@ bool Merchant::msgKeypress(const KeypressMessage &msg) {
 }
 
 void Merchant::draw() {
-	if (_mode != SHOP_BUY && _mode != SHOP_SELL)
+	if (_mode == SHOP_PROMPT)
 		return;
 
-	auto s = getSurface();
-	s.writeString(Common::Point(15, 0), "\x10 Transact \x11");
-	s.fillRect(Graphics::Views::TextRect(1, 1, 38, 18), 0);
+	drawFrame();
+
+	if (_mode == SHOP_MESSAGE) {
+		const Screen &screen = _screens[0];
+		auto s = getSurface();
+		if (screen._clear)
+			s.fillRect(Common::Rect(39, 48, 280, 120), 0);
+
+		s.setColor(_G(colors)._text);
+		for (const ScreenLine &line : screen._lines)
+			s.writeString(Common::Point(line._x, line._y), "%s", line._text);
+
+	} else if (_mode == SHOP_QTY) {
+		drawGroceryPrompt();
 
-	if (_mode == SHOP_BUY) {
+	} else if (_mode == SHOP_BUY) {
 		switch (_shopType) {
 		case SHOP_ARMORY:
 			drawArmoryBuy();
@@ -229,21 +254,32 @@ int Merchant::shopVariant() const {
 	return _G(map)._mapStyle - 2;
 }
 
-void Merchant::drawShopName() {
-	static const ShopName *const TABLES[6] = {
-		ARMORY_NAMES, WEAPON_SHOP_NAMES, MAGIC_SHOP_NAMES,
-		GROCER_SHOP_NAMES, TAVERN_SHOP_NAMES, TRANSPORT_SHOP_NAMES
-	};
+void Merchant::drawFrame() {
+	auto s = getSurface();
+	s.fillRect(Common::Rect(DIALOG_X1, DIALOG_Y1, DIALOG_X2, DIALOG_Y2), 0);
+	s.frameRect(Common::Rect(BORDER_X1, BORDER_Y1, BORDER_X2, BORDER_Y2), _G(colors)._border);
+	s.setColor(_G(colors)._text);
 
-	const ShopName &name = TABLES[_shopType][shopVariant()];
-	if (!name._line1)
-		return;
+	const int variant = shopVariant();
+	const ShopName &name = shopNameFor(_shopType, variant);
 
+	if (name._line1)
+		s.writeString(Common::Point(NAME_X[_shopType][variant], 4), "%s", name._line1);
+	if (name._line2) {
+		int x = (_shopType == SHOP_TRANSPORT) ? (variant == 0 ? 13 : 15) : 8;
+		s.writeString(Common::Point(x, 5), "%s", name._line2);
+	}
+}
+
+int Merchant::listY() const {
+	return shopNameFor(_shopType, shopVariant())._line2 ? 7 : 6;
+}
+
+void Merchant::drawShopLine(int y, int nameX, int priceX, int letterIdx, const char *name, int price, int digits) {
 	auto s = getSurface();
 	s.setColor(_G(colors)._text);
-	s.writeString(Common::Point(19 - (int)Common::String(name._line1).size() / 2, 2), "%s", name._line1);
-	if (name._line2)
-		s.writeString(Common::Point(19 - (int)Common::String(name._line2).size() / 2, 3), "%s", name._line2);
+	s.writeString(Common::Point(nameX, y), "%c) %s", 'a' + letterIdx, name);
+	s.writeString(Common::Point(priceX, y), digits == 4 ? "- %4d" : "- %3d", price);
 }
 
 bool Merchant::isWenchNearby() const {
@@ -274,6 +310,88 @@ int Merchant::overworldTransportCount() const {
 	return count;
 }
 
+void Merchant::addScreen(bool clear, std::initializer_list<ScreenLine> lines) {
+	Screen screen;
+	screen._clear = clear;
+	for (const ScreenLine &line : lines)
+		screen._lines.push_back(line);
+
+	_screens.push_back(screen);
+}
+
+void Merchant::showScreens(bool nothingAfter) {
+	_nothingAfter = nothingAfter;
+	_mode = SHOP_MESSAGE;
+	setBounds(Graphics::Views::TextRect(0, 0, 39, 19));
+	redraw();
+	showCursor();
+}
+
+void Merchant::showText(bool nothingAfter, bool clear, std::initializer_list<ScreenLine> lines) {
+	_screens.clear();
+	addScreen(clear, lines);
+	showScreens(nothingAfter);
+}
+
+void Merchant::nextScreen() {
+	_screens.remove_at(0);
+
+	if (!_screens.empty()) {
+		redraw();
+	} else if (_nothingAfter) {
+		nothing();
+	} else {
+		writeString("\n");
+		finish();
+	}
+}
+
+void Merchant::addTip(int tipIdx) {
+	switch (tipIdx) {
+	case 0:
+		addScreen(true, { { 9, 8, "Thou hast been seduced!" }, { 11, 10, "After a long night," },
+			{ 13, 11, "thou art back." } });
+		break;
+	case 1:
+		addScreen(true, { { 11, 7, "Thou had best know" }, { 10, 8, "about space travel!" },
+			{ 10, 9, "Thou must destroy at" }, { 9, 10, "least 20 enemy vessels" },
+			{ 11, 11, "to become an ace!" } });
+		break;
+	case 2:
+		addScreen(true, { { 11, 7, "Thou had best know" },
+			{ 11, 8, _G(savegame)._sex == Data::SEX_MALE ? "to watch the wench." : "to watch the lecher." } });
+		break;
+	case 3:
+		addScreen(true, { { 11, 7, "Thou had best know" }, { 5, 8, " that the princess will give" },
+			{ 5, 9, " great reward to the one who" }, { 5, 10, "rescues her, and an extra gift" },
+			{ 10, 11, "to an 8th level ace!" } });
+		break;
+	case 4:
+		addScreen(true, { { 11, 7, "Thou had best know" }, { 7, 8, "thou must go back in time." } });
+		break;
+	case 5:
+		addScreen(true, { { 11, 7, "Thou had best know" }, { 10, 8, "thou should destroy" },
+			{ 13, 9, "the evil gem!" } });
+		break;
+	case 6:
+		addScreen(true, { { 11, 7, "Thou had best know" }, { 5, 8, "   that many lakes and ponds" },
+			{ 5, 9, "  have strong magical powers!" } });
+		break;
+	case 7:
+		addScreen(true, { { 11, 7, "Thou had best know" }, { 10, 8, "this is a great game!" } });
+		break;
+	default:
+		addScreen(true, { { 11, 7, "Thou had best know" }, { 5, 8, "   that over 1000 years ago," },
+			{ 5, 9, "Mondain the Wizard created an" }, { 5, 10, " evil gem.  With this gem, he" },
+			{ 5, 11, "   is immortal and cannot be" }, { 15, 12, "defeated." } });
+		addScreen(true, { { 5, 7, "The quest of --Ultima-- is to" }, { 5, 8, " traverse the lands in search" },
+			{ 8, 9, "of a time machine.  Upon" }, { 5, 10, " finding such a device, thou" },
+			{ 5, 11, "should go back in time to the" }, { 5, 12, " days before Mondain created" },
+			{ 5, 13, "the evil gem and destroy him!" } });
+		break;
+	}
+}
+
 void Merchant::chooseBuy() {
 	resetLine();
 	writeString("Transact-Buy: ");
@@ -297,7 +415,6 @@ void Merchant::chooseBuy() {
 		break;
 
 	case SHOP_TRANSPORT: {
-		auto &map = _G(map);
 		auto &sg = _G(savegame);
 		bool fleetFull = sg._transports[Data::TRANSPORT_SHUTTLE] == 0 &&
 			overworldTransportCount() >= 15;
@@ -305,16 +422,16 @@ void Merchant::chooseBuy() {
 		for (int i = 0; i < 6; ++i)
 			_transportIds[i] = 0;
 
-		if ((map._woodsCount || map._grassCount) && !fleetFull) {
+		if ((sg._woodsCount || sg._grassCount) && !fleetFull) {
 			_transportIds[0] = Data::TRANSPORT_HORSE;
 			_transportIds[1] = Data::TRANSPORT_CART;
 		}
-		if (map._waterCount && !fleetFull) {
+		if (sg._waterCount && !fleetFull) {
 			_transportIds[2] = Data::TRANSPORT_RAFT;
 			_transportIds[3] = Data::TRANSPORT_FRIGATE;
 		}
 		if (_G(moveCtr) > 3000) {
-			if (map._grassCount && !fleetFull)
+			if (sg._grassCount && !fleetFull)
 				_transportIds[4] = Data::TRANSPORT_AIRCAR;
 			if (sg._transports[Data::TRANSPORT_SHUTTLE] == 0)
 				_transportIds[5] = Data::TRANSPORT_SHUTTLE;
@@ -325,9 +442,7 @@ void Merchant::chooseBuy() {
 			any = _transportIds[i] != 0;
 
 		if (!any) {
-			writeString("\n");
-			writeString("Closed for the day.\n");
-			finish();
+			showText(false, false, { { 11, listY() + 2, "Closed for the day." } });
 			break;
 		}
 
@@ -354,9 +469,7 @@ void Merchant::chooseSell() {
 			anyOwned = _G(savegame)._armor[idx] != 0;
 
 		if (!anyOwned) {
-			writeString("\n");
-			writeString("Thou hast no armour to sell!\n");
-			nothing();
+			showText(true, false, { { 5, listY() + 1, "  Thou hast no armour to sell!" } });
 		} else {
 			_mode = SHOP_SELL;
 			setBounds(Graphics::Views::TextRect(0, 0, 39, 19));
@@ -371,9 +484,7 @@ void Merchant::chooseSell() {
 			anyOwned = _G(savegame)._weapons[idx] != 0;
 
 		if (!anyOwned) {
-			writeString("\n");
-			writeString("Thou hast no weaponry to sell!\n");
-			nothing();
+			showText(true, false, { { 5, listY() + 1, "Thou hast no weaponry to sell!" } });
 		} else {
 			_mode = SHOP_SELL;
 			setBounds(Graphics::Views::TextRect(0, 0, 39, 19));
@@ -383,42 +494,28 @@ void Merchant::chooseSell() {
 	}
 
 	case SHOP_MAGIC:
-		writeString("\n");
-		writeString("Sorry, we don't buy spells!\n");
-		nothing();
+		showText(true, false, { { 5, listY() + 2, "  Sorry, we don't buy spells!" } });
 		break;
 
 	case SHOP_GROCER:
-		writeString("\n");
-		writeString("Used food?  No thanks!\n");
-		nothing();
+		showText(true, false, { { 9, listY() + 2, "Used food?  No thanks!" } });
 		break;
 
 	case SHOP_TAVERN:
-		writeString("\n");
-		writeString("We have plenty of booze already!\n");
-		nothing();
+		showText(true, false, { { 8, listY() + 2, "We have plenty of booze" }, { 17, listY() + 3, "already!" } });
 		break;
 
 	case SHOP_TRANSPORT:
-		writeString("\n");
-		writeString("Sorry, we don't deal in used stuff.\n");
-		nothing();
+		showText(true, false, { { 9, listY() + 2, "Sorry, we don't deal in" }, { 15, listY() + 3, "used stuff." } });
 		break;
 	}
 }
 
 void Merchant::drawArmoryBuy() {
-	drawShopName();
-	auto s = getSurface();
-	s.setColor(_G(colors)._text);
-
 	int maxIdx = (_G(moveCtr) > 3000) ? 5 : 3;
-	int y = 8;
-	for (int idx = 1; idx <= maxIdx; ++idx, ++y) {
+	for (int idx = 1; idx <= maxIdx; ++idx) {
 		int price = ((200 - _G(savegame)._intelligence) / 4) * idx;
-		s.writeString(Common::Point(10, y), "%c) %s", 'a' + idx, Data::ARMOR_NAMES[idx]);
-		s.writeString(Common::Point(27, y), "-%3d", price);
+		drawShopLine(listY() + idx, 9, 26, idx, Data::ARMOR_NAMES[idx], price, 3);
 	}
 }
 
@@ -444,23 +541,15 @@ void Merchant::armoryBuyKeypress(Common::KeyCode keycode) {
 
 	writeString(Data::ARMOR_NAMES[idx]);
 	redrawStats();
-	writeString("\n");
-	writeString("Sold!\n");
-	finish();
+	showText(false, true, { { 18, 9, "Sold!" } });
 }
 
 void Merchant::drawArmorySell() {
-	drawShopName();
-	auto s = getSurface();
-	s.setColor(_G(colors)._text);
-
-	int y = 8;
+	int y = listY() + 1;
 	for (int idx = 1; idx < Data::ARMOR_COUNT; ++idx) {
 		if (_G(savegame)._armor[idx]) {
 			int price = (_G(savegame)._charisma + 40) * idx * idx / 256 + 1;
-			s.writeString(Common::Point(10, y), "%c) %s", 'a' + idx, Data::ARMOR_NAMES[idx]);
-			s.writeString(Common::Point(27, y), "-%3d", price);
-			++y;
+			drawShopLine(y++, 9, 26, idx, Data::ARMOR_NAMES[idx], price, 3);
 		}
 	}
 }
@@ -482,9 +571,7 @@ void Merchant::armorySellKeypress(Common::KeyCode keycode) {
 
 	writeString(Data::ARMOR_NAMES[idx]);
 	redrawStats();
-	writeString("\n");
-	writeString("Done!\n");
-	finish();
+	showText(false, true, { { 18, 9, "Done!" } });
 }
 
 void Merchant::weaponsRange(int &minIdx, int &maxIdx) const {
@@ -502,18 +589,13 @@ void Merchant::weaponsRange(int &minIdx, int &maxIdx) const {
 }
 
 void Merchant::drawWeaponsBuy() {
-	drawShopName();
-	auto s = getSurface();
-	s.setColor(_G(colors)._text);
-
 	int minIdx, maxIdx;
 	weaponsRange(minIdx, maxIdx);
 
-	int y = 8;
-	for (int idx = minIdx; idx <= maxIdx; idx += 2, ++y) {
+	int y = listY();
+	for (int idx = minIdx; idx <= maxIdx; idx += 2) {
 		int price = (255 - _G(savegame)._intelligence) * idx * idx / 256 + 5;
-		s.writeString(Common::Point(9, y), "%c) %s", 'a' + idx, Data::WEAPON_NAMES[idx]);
-		s.writeString(Common::Point(26, y), "-%3d", price);
+		drawShopLine(y++, 9, 26, idx, Data::WEAPON_NAMES[idx], price, 3);
 	}
 }
 
@@ -540,23 +622,15 @@ void Merchant::weaponsBuyKeypress(Common::KeyCode keycode) {
 
 	writeString(Data::WEAPON_NAMES[idx]);
 	redrawStats();
-	writeString("\n");
-	writeString("Sold!\n");
-	finish();
+	showText(false, true, { { 18, 9, "Sold!" } });
 }
 
 void Merchant::drawWeaponsSell() {
-	drawShopName();
-	auto s = getSurface();
-	s.setColor(_G(colors)._text);
-
-	int y = 6;
+	int y = listY();
 	for (int idx = 1; idx < Data::WEAPON_COUNT; ++idx) {
 		if (_G(savegame)._weapons[idx]) {
 			int price = (_G(savegame)._charisma + 40) * idx * idx / 256 + 1;
-			s.writeString(Common::Point(9, y), "%c) %s", 'a' + idx, Data::WEAPON_NAMES[idx]);
-			s.writeString(Common::Point(26, y), "-%3d", price);
-			++y;
+			drawShopLine(y++, 9, 26, idx, Data::WEAPON_NAMES[idx], price, 3);
 		}
 	}
 }
@@ -578,9 +652,7 @@ void Merchant::weaponsSellKeypress(Common::KeyCode keycode) {
 
 	writeString(Data::WEAPON_NAMES[idx]);
 	redrawStats();
-	writeString("\n");
-	writeString("Done!\n");
-	finish();
+	showText(false, true, { { 18, 9, "Done!" } });
 }
 
 void Merchant::magicRange(int &minIdx, int &maxIdx) const {
@@ -592,22 +664,16 @@ void Merchant::magicRange(int &minIdx, int &maxIdx) const {
 }
 
 void Merchant::drawMagicBuy() {
-	drawShopName();
-	auto s = getSurface();
-	s.setColor(_G(colors)._text);
-
 	int minIdx, maxIdx;
 	magicRange(minIdx, maxIdx);
 
-	int y = 8;
+	int y = listY();
 	for (int idx = minIdx; idx <= maxIdx; idx += 2) {
 		if (idx == Data::SPELL_STEAL)
 			continue;
 
 		int price = ((200 - _G(savegame)._wisdom) / 32) * idx;
-		s.writeString(Common::Point(9, y), "%c) %s", 'a' + idx, Data::SPELL_NAMES[idx]);
-		s.writeString(Common::Point(26, y), "-%3d", price);
-		++y;
+		drawShopLine(y++, 9, 26, idx, Data::SPELL_NAMES[idx], price, 3);
 	}
 }
 
@@ -634,21 +700,24 @@ void Merchant::magicBuyKeypress(Common::KeyCode keycode) {
 
 	writeString(Data::SPELL_NAMES[idx]);
 	redrawStats();
-	writeString("\n");
-	writeString("Sold!\n");
-	finish();
+	showText(false, true, { { 18, 9, "Sold!" } });
 }
 
 void Merchant::groceryPrompt() {
 	_mode = SHOP_QTY;
 	_amount.clear();
+	setBounds(Graphics::Views::TextRect(0, 0, 39, 19));
+	redraw();
+}
 
-	int pricePerPack = 5 - _G(savegame)._intelligence / 20;
-	writeString("\n");
-	writeString(Common::String::format("Packs of 10 food cost %d pence each.\n", pricePerPack));
-	resetLine();
-	writeString("\x10""How many dost thou wish to purchase? ");
-	showCursor();
+void Merchant::drawGroceryPrompt() {
+	auto s = getSurface();
+	s.setColor(_G(colors)._text);
+
+	int y = listY();
+	s.writeString(Common::Point(5, y + 2), " Packs of 10 food cost %d pence", 5 - _G(savegame)._intelligence / 20);
+	s.writeString(Common::Point(8, y + 3), "each.  How many dost thou");
+	s.writeString(Common::Point(11, y + 4), "wish to purchase?");
 }
 
 void Merchant::groceryKeypress(const KeypressMessage &msg) {
@@ -663,7 +732,7 @@ void Merchant::groceryKeypress(const KeypressMessage &msg) {
 		if (!_amount.empty()) {
 			_amount.deleteLastChar();
 			resetLine();
-			writeString(Common::String::format("\x10""How many dost thou wish to purchase? %s", _amount.c_str()));
+			writeString(Common::String::format("Transact-Buy: %s", _amount.c_str()));
 			showCursor();
 		}
 
@@ -673,45 +742,45 @@ void Merchant::groceryKeypress(const KeypressMessage &msg) {
 		int pricePerPack = 5 - sg._intelligence / 20;
 		int total = pricePerPack * qty;
 
-		writeString("\n");
-		if (qty == 0) {
-			nothing();
-		} else if (total > sg._coins) {
-			cantAfford();
+		if (qty == 0 || total > sg._coins) {
+			// The typed amount is replaced by "nothing"
+			resetLine();
+			writeString("Transact-Buy: ");
+
+			if (qty == 0)
+				nothing();
+			else
+				cantAfford();
 		} else {
 			sg._coins -= total;
 			sg._food += qty * 10;
 			redrawStats();
-			writeString(Common::String::format("%d packs food\n", qty));
-			writeString("Sold!\n");
-			finish();
+			writeString(" packs food");
+			showText(false, true, { { 18, 9, "Sold!" } });
 		}
 	}
 }
 
 void Merchant::tavernBuy() {
 	auto &sg = _G(savegame);
+	const int y = listY();
 
 	if (sg._coins == 0) {
-		writeString("\n");
-		writeString("Thou art broke!\n");
-		writeString("Come back when thou hast some money to spend.\n");
-		nothing();
+		showText(true, false, { { 12, y + 1, "Thou art broke!" }, { 8, y + 4, "Come back when thou hast" },
+			{ 10, y + 5, "some money to spend." } });
 		return;
 	}
 
 	--sg._coins;
 	redrawStats();
-	writeString("\n");
-	writeString("The tavern keeper sayeth:\n");
-	writeString("Here, have a cold one!\n");
 	writeString("ale");
 	++_G(map)._tavernCtr;
 
+	_screens.clear();
+	addScreen(false, { { 8, y + 1, "The tavern keeper sayeth:" }, { 9, y + 4, "Here, have a cold one!" } });
+
 	if (_G(map)._tavernCtr > sg._stamina / 4 && isWenchNearby()) {
-		writeString("\n");
-		writeString(TAVERN_TIPS[0]);
-		writeString("\n");
+		addTip(0);
 
 		sg._coins /= 2;
 		redrawStats();
@@ -720,35 +789,21 @@ void Merchant::tavernBuy() {
 			++sg._wisdom;
 	}
 
-	if (g_engine->getRandomNumber(1, 255) < 75) {
-		int tipIdx = g_engine->getRandomNumber(11, 89) / 10;
-		writeString("\n");
-		writeString("Thou had best know ");
-
-		if (tipIdx == 2)
-			writeString(Common::String::format("to watch the %s.", sg._sex == Data::SEX_MALE ? "wench" : "lecher"));
-		else
-			writeString(TAVERN_TIPS[tipIdx]);
-		writeString("\n");
-	}
+	if (g_engine->getRandomNumber(1, 255) < 75)
+		addTip(g_engine->getRandomNumber(11, 89) / 10);
 
-	finish();
+	showScreens(false);
 }
 
 void Merchant::drawTransportBuy() {
-	drawShopName();
-	auto s = getSurface();
-	s.setColor(_G(colors)._text);
-
-	int y = 8;
-	for (int i = 0; i < 6; ++i, ++y) {
+	int y = listY();
+	for (int i = 0; i < 6; ++i) {
 		if (_transportIds[i] == 0)
 			continue;
 
 		int transportId = _transportIds[i];
 		int price = ((200 - _G(savegame)._intelligence) / 5) * transportId * transportId;
-		s.writeString(Common::Point(11, y), "%c) %s", 'a' + i, Data::TRANSPORT_NAMES[transportId]);
-		s.writeString(Common::Point(22, y), "-%4d", price);
+		drawShopLine(y++, 12, 23, i, Data::TRANSPORT_NAMES[transportId], price, 4);
 	}
 }
 
@@ -782,9 +837,7 @@ void Merchant::transportBuyKeypress(Common::KeyCode keycode) {
 
 	spawnTransport(transportId);
 
-	writeString("\n");
-	writeString("Sold!\n");
-	finish();
+	showText(false, true, { { 18, 9, "Sold!" } });
 }
 
 void Merchant::spawnTransport(int transportId) {
@@ -797,7 +850,7 @@ void Merchant::spawnTransport(int transportId) {
 	switch (transportId) {
 	case Data::TRANSPORT_HORSE:
 	case Data::TRANSPORT_CART:
-		neededTile = (_G(map)._woodsCount > 0) ? Data::TILE_WOODS : Data::TILE_GRASS;
+		neededTile = (_G(savegame)._woodsCount > 0) ? Data::TILE_WOODS : Data::TILE_GRASS;
 		break;
 	case Data::TRANSPORT_RAFT:
 	case Data::TRANSPORT_FRIGATE:
@@ -834,20 +887,16 @@ void Merchant::spawnTransport(int transportId) {
 }
 
 void Merchant::nothing() {
-	writeString("nothing");
+	writeString("nothing\n");
 	finish();
 }
 
 void Merchant::cantAfford() {
-	writeString("nothing");
-	writeString("\n");
-	writeString("Thou canst not afford it!\n");
 	g_engine->playFX(1);
-	finish();
+	showText(true, true, { { 8, 9, "Thou canst not afford it!" } });
 }
 
 void Merchant::finish() {
-	writeString("\n");
 	prompt();
 	close();
 }
diff --git a/engines/ultima/ultima1/views/interactions/merchant.h b/engines/ultima/ultima1/views/interactions/merchant.h
index b4d3fd8ef09..13cc031c95b 100644
--- a/engines/ultima/ultima1/views/interactions/merchant.h
+++ b/engines/ultima/ultima1/views/interactions/merchant.h
@@ -23,6 +23,7 @@
 #ifndef ULTIMA1_VIEWS_INTERACTIONS_MERCHANT_H
 #define ULTIMA1_VIEWS_INTERACTIONS_MERCHANT_H
 
+#include "common/array.h"
 #include "ultima/ultima1/views/interactions/interaction.h"
 
 namespace Ultima {
@@ -46,11 +47,26 @@ enum ShopType {
  */
 class Merchant : public Interaction {
 	enum Mode {
-		SHOP_PROMPT, SHOP_BUY, SHOP_SELL, SHOP_QTY
+		SHOP_PROMPT, SHOP_BUY, SHOP_SELL, SHOP_QTY, SHOP_MESSAGE
+	};
+
+	// A line of text within one of the shop dialog's message screens
+	struct ScreenLine {
+		int _x, _y;
+		const char *_text;
+	};
+
+	// A message screen shown in the shop dialog, optionally first clearing its inner area
+	struct Screen {
+		bool _clear = false;
+		Common::Array<ScreenLine> _lines;
 	};
 private:
 	ShopType _shopType = SHOP_ARMORY;
 	Mode _mode = SHOP_PROMPT;
+	Common::Array<Screen> _screens;
+	// Whether to finish with "nothing" typed after the last screen rather than a newline
+	bool _nothingAfter = false;
 	Common::String _amount;
 	// Which of the 6 transports (Horse..Shuttle) are offered this visit,
 	// indexed by the letter (a-f) used to select them; 0 means unavailable
@@ -68,10 +84,20 @@ private:
 	int shopVariant() const;
 
 	/**
-	 * Draws the current shop's proprietor name(s), if any, centered near
-	 * the top of the dialog
+	 * Draws the shop dialog's box and the shop's proprietor name(s)
+	 */
+	void drawFrame();
+
+	/**
+	 * Returns the row of the first line below the shop's name, which is
+	 * lower when the name takes two lines
 	 */
-	void drawShopName();
+	int listY() const;
+
+	/**
+	 * Draws one line of a shop's list of items, with its price
+	 */
+	void drawShopLine(int y, int nameX, int priceX, int letterIdx, const char *name, int price, int digits);
 
 	/**
 	 * Returns true if a wench (or, for a female player, a lecher) NPC is
@@ -85,6 +111,36 @@ private:
 	 */
 	int overworldTransportCount() const;
 
+	/**
+	 * Adds a message screen to the queue of screens to show
+	 */
+	void addScreen(bool clear, std::initializer_list<ScreenLine> lines);
+
+	/**
+	 * Shows the queued message screens one at a time, each waiting for a keypress
+	 */
+	void showScreens(bool nothingAfter);
+
+	/**
+	 * Shows a single message screen
+	 */
+	void showText(bool nothingAfter, bool clear, std::initializer_list<ScreenLine> lines);
+
+	/**
+	 * Moves on from the current message screen
+	 */
+	void nextScreen();
+
+	/**
+	 * Adds the screen(s) for one of the tavern keeper's tips
+	 */
+	void addTip(int tipIdx);
+
+	/**
+	 * Draws the grocer's quantity prompt
+	 */
+	void drawGroceryPrompt();
+
 	void chooseBuy();
 	void chooseSell();
 
diff --git a/engines/ultima/ultima1/views/interactions/operate_craft.cpp b/engines/ultima/ultima1/views/interactions/operate_craft.cpp
index 4a4e3870f42..b3fb32dc059 100644
--- a/engines/ultima/ultima1/views/interactions/operate_craft.cpp
+++ b/engines/ultima/ultima1/views/interactions/operate_craft.cpp
@@ -20,23 +20,34 @@
  */
 
 #include "ultima/ultima1/views/interactions/operate_craft.h"
+#include "ultima/ultima1/ultima1.h"
 
 namespace Ultima {
 namespace Ultima1 {
 namespace Views {
 namespace Interactions {
 
-bool OperateCraft::msgFocus(const FocusMessage &msg) {
-	setBounds(Common::Rect(0, 0, 0, 0));
-
-	writeString("Thou canst not determine how\n");
-	writeString("to operate the craft at this\n");
-	writeString("time.\n");
+// Same generic dialog box geometry the Lose and Win views use
+constexpr int DIALOG_X1 = 31, DIALOG_Y1 = 23, DIALOG_X2 = 287, DIALOG_Y2 = 127;
+constexpr int BORDER_X1 = 34, BORDER_Y1 = 26, BORDER_X2 = 284, BORDER_Y2 = 124;
 
+bool OperateCraft::msgFocus(const FocusMessage &msg) {
+	setBounds(Graphics::Views::TextRect(0, 0, 39, 19));
 	showCursor();
 	return true;
 }
 
+void OperateCraft::draw() {
+	auto s = getSurface();
+	s.fillRect(Common::Rect(DIALOG_X1, DIALOG_Y1, DIALOG_X2, DIALOG_Y2), 0);
+	s.frameRect(Common::Rect(BORDER_X1, BORDER_Y1, BORDER_X2, BORDER_Y2), _G(colors)._border);
+
+	s.setColor(_G(colors)._text);
+	s.writeString(Common::Point(6, 7), "Thou canst not determine how");
+	s.writeString(Common::Point(6, 8), "to operate the craft at this");
+	s.writeString(Common::Point(6, 9), "           time.");
+}
+
 bool OperateCraft::msgAction(const ActionMessage &msg) {
 	finish();
 	return true;
@@ -48,6 +59,7 @@ bool OperateCraft::msgKeypress(const KeypressMessage &msg) {
 }
 
 void OperateCraft::finish() {
+	prompt();
 	close();
 }
 
diff --git a/engines/ultima/ultima1/views/interactions/operate_craft.h b/engines/ultima/ultima1/views/interactions/operate_craft.h
index 92e68fc898b..8c0687bea39 100644
--- a/engines/ultima/ultima1/views/interactions/operate_craft.h
+++ b/engines/ultima/ultima1/views/interactions/operate_craft.h
@@ -46,6 +46,7 @@ public:
 	~OperateCraft() override {
 	}
 
+	void draw() override;
 	bool msgFocus(const FocusMessage &msg) override;
 	bool msgAction(const ActionMessage &msg) override;
 	bool msgKeypress(const KeypressMessage &msg) override;


Commit: 786c8bbd91e252383d71ba315ed7a8f1be5f222d
    https://github.com/scummvm/scummvm/commit/786c8bbd91e252383d71ba315ed7a8f1be5f222d
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:41:05+11:00

Commit Message:
ULTIMA: ULTIMA1: Fix for boarding vechiles/horses

Changed paths:
    engines/ultima/ultima1/data/map.cpp
    engines/ultima/ultima1/data/map.h
    engines/ultima/ultima1/views/create_character.cpp
    engines/ultima/ultima1/views/overworld_map.cpp


diff --git a/engines/ultima/ultima1/data/map.cpp b/engines/ultima/ultima1/data/map.cpp
index e7fb0507b08..c3147b55672 100644
--- a/engines/ultima/ultima1/data/map.cpp
+++ b/engines/ultima/ultima1/data/map.cpp
@@ -196,9 +196,6 @@ void Map::load(int mapNum) {
 		_tiles = _cityTiles;
 	}
 
-	// Set up copies of the map position and player tile to use
-	_playerTileId = TILE_PLAYER;
-
 	// Set up logic handler for the mode and which view it'll be using
 	Common::String viewName;
 	if (mapNum == MAP_SPACE) {
diff --git a/engines/ultima/ultima1/data/map.h b/engines/ultima/ultima1/data/map.h
index 02fc505c8a0..72bef9a4c40 100644
--- a/engines/ultima/ultima1/data/map.h
+++ b/engines/ultima/ultima1/data/map.h
@@ -126,7 +126,6 @@ private:
 	void loadDungeonMap();
 
 public:
-	byte _playerTileId = 0;
 	byte _tilePlayerCenter = 0;
 	byte _tilePlayerUp = 0, _tilePlayerDown = 0,
 		_tilePlayerLeft = 0, _tilePlayerRight = 0;
diff --git a/engines/ultima/ultima1/views/create_character.cpp b/engines/ultima/ultima1/views/create_character.cpp
index 3bf33849306..40b641cc27e 100644
--- a/engines/ultima/ultima1/views/create_character.cpp
+++ b/engines/ultima/ultima1/views/create_character.cpp
@@ -377,6 +377,12 @@ void CreateCharacter::confirmAndSave() {
 	p._equippedArmor = ARMOR_LEATHER;
 	p._transportType = TRANSPORT_FOOT;
 	p._overworldPos = Common::Point(49, 40);
+
+	auto &player = p._overworldEntities[0];
+	player._type = TILE_PLAYER;
+	player._data = TILE_GRASS;
+	player._x = p._overworldPos.x;
+	player._y = p._overworldPos.y;
 	p._soundOn = true;
 
 	for (int i = 0; i < QUEST_COUNT; ++i)
diff --git a/engines/ultima/ultima1/views/overworld_map.cpp b/engines/ultima/ultima1/views/overworld_map.cpp
index 32fbd784bd4..16164b7d97c 100644
--- a/engines/ultima/ultima1/views/overworld_map.cpp
+++ b/engines/ultima/ultima1/views/overworld_map.cpp
@@ -142,8 +142,12 @@ void OverworldMap::prepareMapForDrawing() {
 	map._tilePlayerLeft = _mapTilesId[Data::OVERWORLD_VISIBLE_CENTER_Y][Data::OVERWORLD_VISIBLE_CENTER_X - 1];
 	map._tilePlayerRight = _mapTilesId[Data::OVERWORLD_VISIBLE_CENTER_Y][Data::OVERWORLD_VISIBLE_CENTER_X + 1];
 
-	// Place the player tile at the center
-	_mapTilesId[Data::OVERWORLD_VISIBLE_CENTER_Y][Data::OVERWORLD_VISIBLE_CENTER_X] = map._playerTileId;
+	// The player's own entity gives the tile at the center - either the player, or whatever they're riding
+	int playerTile = _G(savegame)._overworldEntities[0]._type;
+	if (playerTile < Data::TILE_PLAYER || playerTile > Data::TILE_TIME_MACHINE)
+		playerTile = Data::TILE_PLAYER;
+
+	_mapTilesId[Data::OVERWORLD_VISIBLE_CENTER_Y][Data::OVERWORLD_VISIBLE_CENTER_X] = playerTile;
 }
 
 } // namespace Views


Commit: a98de5cdf8a1c8392288d0b4344bc5884d042c4c
    https://github.com/scummvm/scummvm/commit/a98de5cdf8a1c8392288d0b4344bc5884d042c4c
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:41:05+11:00

Commit Message:
ULTIMA: ULTIMA1: Fix purchased transport placement in overworld

Changed paths:
    engines/ultima/ultima1/data/map.cpp
    engines/ultima/ultima1/data/map.h
    engines/ultima/ultima1/views/interactions/dead.cpp
    engines/ultima/ultima1/views/interactions/merchant.cpp
    engines/ultima/ultima1/views/interactions/princess_saved.cpp


diff --git a/engines/ultima/ultima1/data/map.cpp b/engines/ultima/ultima1/data/map.cpp
index c3147b55672..a1fafdd5034 100644
--- a/engines/ultima/ultima1/data/map.cpp
+++ b/engines/ultima/ultima1/data/map.cpp
@@ -307,6 +307,25 @@ int Map::getTileAt(int x, int y, int creatureIndex) const {
 	return _G(map).getMapTile(x, y);
 }
 
+int Map::getOverworldTileAt(int x, int y) const {
+	int entityIndex = _G(savegame).getOverworldEntityAt(x, y, 1);
+	if (entityIndex >= 0)
+		return _G(savegame)._overworldEntities[entityIndex]._type;
+
+	x = (x % OVERWORLD_WIDTH + OVERWORLD_WIDTH) % OVERWORLD_WIDTH;
+	y = (y % OVERWORLD_HEIGHT + OVERWORLD_HEIGHT) % OVERWORLD_HEIGHT;
+
+	// Skip the castle/city flag animation frames, as getMapTile does
+	int tile = _overworldMap[y * OVERWORLD_WIDTH + x];
+	if (tile > TILE_CASTLE1) {
+		++tile;
+		if (tile == TILE_CITY2)
+			++tile;
+	}
+
+	return tile;
+}
+
 int Map::getContinentAt(int x, int y) const {
 	return (y > 77 ? 2 : 0) + (x > 83 ? 1 : 0);
 }
diff --git a/engines/ultima/ultima1/data/map.h b/engines/ultima/ultima1/data/map.h
index 72bef9a4c40..fcc1dc5aa69 100644
--- a/engines/ultima/ultima1/data/map.h
+++ b/engines/ultima/ultima1/data/map.h
@@ -223,6 +223,13 @@ public:
 	 */
 	int getTileAt(int x, int y, int creatureIndex = 1) const;
 
+	/**
+	 * Returns a tile or creature/entity at a given overworld position, regardless of
+	 * which map is currently loaded. Used when a location needs to look at the overworld
+	 * around itself, such as when a purchased vehicle is placed outside a city
+	 */
+	int getOverworldTileAt(int x, int y) const;
+
 	/**
 	 * Returns the continent number at a given position
 	 */
diff --git a/engines/ultima/ultima1/views/interactions/dead.cpp b/engines/ultima/ultima1/views/interactions/dead.cpp
index 007148af4fe..3b2eecd5646 100644
--- a/engines/ultima/ultima1/views/interactions/dead.cpp
+++ b/engines/ultima/ultima1/views/interactions/dead.cpp
@@ -225,7 +225,7 @@ void Dead::resetPlayerPosition() {
 		if (_G(map).getContinentAt(x, y) != origContinent)
 			continue;
 
-		tile = _G(map).getTileAt(x, y);
+		tile = _G(map).getOverworldTileAt(x, y);
 		found = tile == Data::TILE_GRASS || tile == Data::TILE_WOODS;
 	}
 
diff --git a/engines/ultima/ultima1/views/interactions/merchant.cpp b/engines/ultima/ultima1/views/interactions/merchant.cpp
index 2cd31fa5537..2482977ebeb 100644
--- a/engines/ultima/ultima1/views/interactions/merchant.cpp
+++ b/engines/ultima/ultima1/views/interactions/merchant.cpp
@@ -846,40 +846,44 @@ void Merchant::spawnTransport(int transportId) {
 		Data::TILE_AIRCAR, Data::TILE_SHUTTLE, 0
 	};
 
-	int neededTile;
-	switch (transportId) {
-	case Data::TRANSPORT_HORSE:
-	case Data::TRANSPORT_CART:
-		neededTile = (_G(savegame)._woodsCount > 0) ? Data::TILE_WOODS : Data::TILE_GRASS;
-		break;
-	case Data::TRANSPORT_RAFT:
-	case Data::TRANSPORT_FRIGATE:
-		neededTile = Data::TILE_OCEAN;
-		break;
-	default:
-		neededTile = Data::TILE_GRASS;
-		break;
-	}
-
-	const Common::Point &pos = _G(savegame)._overworldPos;
-	int dx = 1, dy = 1;
-	bool found = false;
-
-	for (int y = -1; y <= 1 && !found; ++y) {
-		for (int x = -1; x <= 1 && !found; ++x) {
-			if (_G(map).getTileAt(pos.x + x, pos.y + y) == neededTile) {
-				dx = x;
-				dy = y;
-				found = true;
-			}
-		}
-	}
+	// Each kind of transport goes on the terrain it needs, using up one of
+	// the surrounding tiles of that terrain counted when the location was entered
+	auto &sg = _G(savegame);
+	int terrain;
+	if (transportId <= Data::TRANSPORT_CART && sg._woodsCount) {
+		--sg._woodsCount;
+		terrain = Data::TILE_WOODS;
+	} else if (transportId == Data::TRANSPORT_RAFT || transportId == Data::TRANSPORT_FRIGATE) {
+		--sg._waterCount;
+		terrain = Data::TILE_OCEAN;
+	} else {
+		--sg._grassCount;
+		terrain = Data::TILE_GRASS;
+	}
+
+	// Find the first matching tile around the location. If none match, it ends
+	// up two tiles down and right, as in the original
+	const Common::Point &pos = sg._overworldPos;
+	int dx, dy = -1;
+	bool match;
+	do {
+		dx = -1;
+		do {
+			match = _G(map).getOverworldTileAt(pos.x + dx, pos.y + dy) == terrain;
+			++dx;
+		} while (dx < 2 && !match);
+
+		if (match)
+			--dx;
+		else
+			++dy;
+	} while (dy < 2 && !match);
 
 	if (_G(overworldEntityCount) < Data::OVERWORLD_ENTITY_COUNT - 1) {
 		++_G(overworldEntityCount);
-		auto &e = _G(savegame)._overworldEntities[_G(overworldEntityCount)];
+		auto &e = sg._overworldEntities[_G(overworldEntityCount)];
 		e._type = TRANSPORT_TILES[transportId];
-		e._data = neededTile;
+		e._data = terrain;
 		e._x = pos.x + dx;
 		e._y = pos.y + dy;
 		e._hits = 0;
diff --git a/engines/ultima/ultima1/views/interactions/princess_saved.cpp b/engines/ultima/ultima1/views/interactions/princess_saved.cpp
index 53358f4b4e0..a270d252f83 100644
--- a/engines/ultima/ultima1/views/interactions/princess_saved.cpp
+++ b/engines/ultima/ultima1/views/interactions/princess_saved.cpp
@@ -106,7 +106,7 @@ void PrincessSaved::spawnTimeMachine() {
 		int x = baseX + g_engine->getRandomNumber(12, 21);
 		int y = baseY + g_engine->getRandomNumber(11, 15);
 
-		if (_G(map).getTileAt(x, y) == Data::TILE_WOODS) {
+		if (_G(map).getOverworldTileAt(x, y) == Data::TILE_WOODS) {
 			if (_G(overworldEntityCount) < Data::OVERWORLD_ENTITY_COUNT - 1) {
 				++_G(overworldEntityCount);
 				auto &e = _G(savegame)._overworldEntities[_G(overworldEntityCount)];


Commit: 408b75ccae120dced678727abc4febbe91d9b50e
    https://github.com/scummvm/scummvm/commit/408b75ccae120dced678727abc4febbe91d9b50e
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:41:05+11:00

Commit Message:
ULTIMA: ULTIMA1: Move surrounding tile counts back into Map, removed from savegame

Changed paths:
    engines/ultima/ultima1/data/map.cpp
    engines/ultima/ultima1/data/map.h
    engines/ultima/ultima1/data/savegame.cpp
    engines/ultima/ultima1/data/savegame.h
    engines/ultima/ultima1/logic/city_castle_logic.cpp
    engines/ultima/ultima1/logic/city_castle_logic.h
    engines/ultima/ultima1/logic/overworld_logic.cpp
    engines/ultima/ultima1/views/interactions/merchant.cpp


diff --git a/engines/ultima/ultima1/data/map.cpp b/engines/ultima/ultima1/data/map.cpp
index a1fafdd5034..f652f7ec048 100644
--- a/engines/ultima/ultima1/data/map.cpp
+++ b/engines/ultima/ultima1/data/map.cpp
@@ -326,6 +326,29 @@ int Map::getOverworldTileAt(int x, int y) const {
 	return tile;
 }
 
+void Map::countSurroundingTiles() {
+	const Common::Point &pos = _G(savegame)._overworldPos;
+	_waterCount = _grassCount = _woodsCount = 0;
+
+	for (int deltaY = -1; deltaY <= 1; ++deltaY) {
+		for (int deltaX = -1; deltaX <= 1; ++deltaX) {
+			switch (getOverworldTileAt(pos.x + deltaX, pos.y + deltaY)) {
+			case TILE_OCEAN:
+				++_waterCount;
+				break;
+			case TILE_GRASS:
+				++_grassCount;
+				break;
+			case TILE_WOODS:
+				++_woodsCount;
+				break;
+			default:
+				break;
+			}
+		}
+	}
+}
+
 int Map::getContinentAt(int x, int y) const {
 	return (y > 77 ? 2 : 0) + (x > 83 ? 1 : 0);
 }
diff --git a/engines/ultima/ultima1/data/map.h b/engines/ultima/ultima1/data/map.h
index fcc1dc5aa69..6dab72a21a7 100644
--- a/engines/ultima/ultima1/data/map.h
+++ b/engines/ultima/ultima1/data/map.h
@@ -129,6 +129,7 @@ public:
 	byte _tilePlayerCenter = 0;
 	byte _tilePlayerUp = 0, _tilePlayerDown = 0,
 		_tilePlayerLeft = 0, _tilePlayerRight = 0;
+	int _woodsCount = 0, _grassCount = 0, _waterCount = 0;	// Tiles surrounding entered locations
 	bool _isLordBritishCastle = false;
 	int _mapStyle = 0;
 	int _mapType = MAPTYPE_OVERWORLD;
@@ -230,6 +231,12 @@ public:
 	 */
 	int getOverworldTileAt(int x, int y) const;
 
+	/**
+	 * Counts the ocean, grass and woods tiles in the overworld around the player's
+	 * position, which a location uses to know what vehicles can be bought there
+	 */
+	void countSurroundingTiles();
+
 	/**
 	 * Returns the continent number at a given position
 	 */
diff --git a/engines/ultima/ultima1/data/savegame.cpp b/engines/ultima/ultima1/data/savegame.cpp
index 55d9e9db61b..50f2ed75174 100644
--- a/engines/ultima/ultima1/data/savegame.cpp
+++ b/engines/ultima/ultima1/data/savegame.cpp
@@ -79,8 +79,6 @@ void Savegame::synchronizeBasic(Common::Serializer &s) {
 	for (int i = 0; i < TRANSPORT_COUNT; ++i)
 		s.syncAsSint16LE(_transports[i]);
 
-	s.syncMultipleLE(_woodsCount, _grassCount, _waterCount);
-
 	s.syncAsSint16LE(_enemyVessels);
 	s.syncAsSint16LE(_signMarker);
 	s.syncAsSint16LE(_overworldEntityCount);
diff --git a/engines/ultima/ultima1/data/savegame.h b/engines/ultima/ultima1/data/savegame.h
index d7acc404e1c..a50ec8a2fbd 100644
--- a/engines/ultima/ultima1/data/savegame.h
+++ b/engines/ultima/ultima1/data/savegame.h
@@ -127,7 +127,6 @@ public:
 	uint8 _dungeonLevel = 1;
 	uint8 _dungeonDirection = 4;
 	uint16 _dungeonExitHitPoints = 0;
-	int8 _woodsCount = 0, _grassCount = 0, _waterCount = 0;	// Tiles surrounding entered locations
 
 	// Outer space state - synchronized only while _mapNum == MAP_SPACE
 	int16 _sectorX = SPACE_STATION_X;
diff --git a/engines/ultima/ultima1/logic/city_castle_logic.cpp b/engines/ultima/ultima1/logic/city_castle_logic.cpp
index 249c5ce5d48..1a9ec36c002 100644
--- a/engines/ultima/ultima1/logic/city_castle_logic.cpp
+++ b/engines/ultima/ultima1/logic/city_castle_logic.cpp
@@ -122,6 +122,11 @@ static const int8 DELTA_X[5] = { 0, -1, 1, 0, 0 };
 static const int8 DELTA_Y[5] = { 0, 0, 0, -1, 1 };
 
 
+CityCastleLogic::CityCastleLogic() {
+	// Done here rather than on entering, so it also applies when a savegame inside a location is loaded
+	_G(map).countSurroundingTiles();
+}
+
 void CityCastleLogic::entering() {
 	loadEntities();
 	_G(savegame)._guardsHostile = false;
diff --git a/engines/ultima/ultima1/logic/city_castle_logic.h b/engines/ultima/ultima1/logic/city_castle_logic.h
index c2d67090ce1..9468070e784 100644
--- a/engines/ultima/ultima1/logic/city_castle_logic.h
+++ b/engines/ultima/ultima1/logic/city_castle_logic.h
@@ -165,6 +165,7 @@ protected:
 	void findArmor(bool checkCaught);
 
 public:
+	CityCastleLogic();
 	~CityCastleLogic() override {
 	}
 
diff --git a/engines/ultima/ultima1/logic/overworld_logic.cpp b/engines/ultima/ultima1/logic/overworld_logic.cpp
index e5c8fd4ff36..a77fe2d0e46 100644
--- a/engines/ultima/ultima1/logic/overworld_logic.cpp
+++ b/engines/ultima/ultima1/logic/overworld_logic.cpp
@@ -136,30 +136,6 @@ bool OverworldLogic::enter() {
 		writeString("Enter?\n");
 		playFX(1);
 	} else {
-		// Check for tiles surrounding the location
-		_G(savegame)._waterCount = 0;
-		_G(savegame)._grassCount = 0;
-		_G(savegame)._woodsCount = 0;
-
-		for (int deltaY = -1; deltaY <= 1; ++deltaY) {
-			for (int deltaX = -1; deltaX <= 1; ++deltaX) {
-				int tile = _G(map).getTileAt(_G(savegame)._overworldPos.x + deltaX, _G(savegame)._overworldPos.y + deltaY);
-				switch (tile) {
-				case Data::TILE_OCEAN:
-					_G(savegame)._waterCount++;
-					break;
-				case Data::TILE_GRASS:
-					_G(savegame)._grassCount++;
-					break;
-				case Data::TILE_WOODS:
-					_G(savegame)._woodsCount++;
-					break;
-				default:
-					break;
-				}
-			}
-		}
-
 		// Display the enter message
 		_G(map)._isLordBritishCastle = location == 33;
 
diff --git a/engines/ultima/ultima1/views/interactions/merchant.cpp b/engines/ultima/ultima1/views/interactions/merchant.cpp
index 2482977ebeb..8e417c8442d 100644
--- a/engines/ultima/ultima1/views/interactions/merchant.cpp
+++ b/engines/ultima/ultima1/views/interactions/merchant.cpp
@@ -422,16 +422,16 @@ void Merchant::chooseBuy() {
 		for (int i = 0; i < 6; ++i)
 			_transportIds[i] = 0;
 
-		if ((sg._woodsCount || sg._grassCount) && !fleetFull) {
+		if ((_G(map)._woodsCount || _G(map)._grassCount) && !fleetFull) {
 			_transportIds[0] = Data::TRANSPORT_HORSE;
 			_transportIds[1] = Data::TRANSPORT_CART;
 		}
-		if (sg._waterCount && !fleetFull) {
+		if (_G(map)._waterCount && !fleetFull) {
 			_transportIds[2] = Data::TRANSPORT_RAFT;
 			_transportIds[3] = Data::TRANSPORT_FRIGATE;
 		}
 		if (_G(moveCtr) > 3000) {
-			if (sg._grassCount && !fleetFull)
+			if (_G(map)._grassCount && !fleetFull)
 				_transportIds[4] = Data::TRANSPORT_AIRCAR;
 			if (sg._transports[Data::TRANSPORT_SHUTTLE] == 0)
 				_transportIds[5] = Data::TRANSPORT_SHUTTLE;
@@ -850,14 +850,14 @@ void Merchant::spawnTransport(int transportId) {
 	// the surrounding tiles of that terrain counted when the location was entered
 	auto &sg = _G(savegame);
 	int terrain;
-	if (transportId <= Data::TRANSPORT_CART && sg._woodsCount) {
-		--sg._woodsCount;
+	if (transportId <= Data::TRANSPORT_CART && _G(map)._woodsCount) {
+		--_G(map)._woodsCount;
 		terrain = Data::TILE_WOODS;
 	} else if (transportId == Data::TRANSPORT_RAFT || transportId == Data::TRANSPORT_FRIGATE) {
-		--sg._waterCount;
+		--_G(map)._waterCount;
 		terrain = Data::TILE_OCEAN;
 	} else {
-		--sg._grassCount;
+		--_G(map)._grassCount;
 		terrain = Data::TILE_GRASS;
 	}
 


Commit: d7e7be70af25b83f6efaa3b19e05cf8410985485
    https://github.com/scummvm/scummvm/commit/d7e7be70af25b83f6efaa3b19e05cf8410985485
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:41:05+11:00

Commit Message:
ULTIMA: ULTIMA1: Properly erase the visible cursor when hidden

Changed paths:
    engines/ultima/ultima1/data/map.cpp
    engines/ultima/ultima1/gfx/text_cursor.cpp
    engines/ultima/ultima1/gfx/text_cursor.h


diff --git a/engines/ultima/ultima1/data/map.cpp b/engines/ultima/ultima1/data/map.cpp
index f652f7ec048..1f6ef9b8f87 100644
--- a/engines/ultima/ultima1/data/map.cpp
+++ b/engines/ultima/ultima1/data/map.cpp
@@ -304,7 +304,7 @@ int Map::getTileAt(int x, int y, int creatureIndex) const {
 			return _G(savegame)._locationEntities[entityIndex]._type;
 	}
 
-	return _G(map).getMapTile(x, y);
+	return getMapTile(x, y);
 }
 
 int Map::getOverworldTileAt(int x, int y) const {
diff --git a/engines/ultima/ultima1/gfx/text_cursor.cpp b/engines/ultima/ultima1/gfx/text_cursor.cpp
index 48918b0c389..c97e7068753 100644
--- a/engines/ultima/ultima1/gfx/text_cursor.cpp
+++ b/engines/ultima/ultima1/gfx/text_cursor.cpp
@@ -49,6 +49,11 @@ void TextCursor::show() {
 }
 
 void TextCursor::hide() {
+	if (_visible) {
+		auto s = getSurface();
+		s.clear();
+	}
+
 	_visible = false;
 	cancelDelay();
 	redraw();
diff --git a/engines/ultima/ultima1/gfx/text_cursor.h b/engines/ultima/ultima1/gfx/text_cursor.h
index bd526e115b3..bf6c545400a 100644
--- a/engines/ultima/ultima1/gfx/text_cursor.h
+++ b/engines/ultima/ultima1/gfx/text_cursor.h
@@ -36,7 +36,7 @@ namespace Gfx {
 class TextCursor : public Graphics::Views::UIElement {
 private:
 	int _frame = 0;
-	bool _visible = true;
+	bool _visible = false;
 
 public:
 	TextCursor(const Common::String &name, UIElement *parent = nullptr);


Commit: fd416878e658756608f874ff27f20b498ee02055
    https://github.com/scummvm/scummvm/commit/fd416878e658756608f874ff27f20b498ee02055
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:41:05+11:00

Commit Message:
ULTIMA: ULTIMA1: Fix persisting overworld transports in savegames

Changed paths:
    engines/ultima/ultima1/console.cpp
    engines/ultima/ultima1/data/savegame.cpp
    engines/ultima/ultima1/logic/overworld_logic.cpp
    engines/ultima/ultima1/ultima1.cpp
    engines/ultima/ultima1/ultima1.h
    engines/ultima/ultima1/views/create_character.cpp
    engines/ultima/ultima1/views/interactions/dead.cpp
    engines/ultima/ultima1/views/interactions/merchant.cpp
    engines/ultima/ultima1/views/interactions/princess_saved.cpp


diff --git a/engines/ultima/ultima1/console.cpp b/engines/ultima/ultima1/console.cpp
index 3f5d0552b08..c9e4e003d4b 100644
--- a/engines/ultima/ultima1/console.cpp
+++ b/engines/ultima/ultima1/console.cpp
@@ -251,7 +251,7 @@ bool Console::cmdEnemy(int argc, const char **argv) {
 		return true;
 	}
 
-	if (_G(overworldEntityCount) >= Data::OVERWORLD_ENTITY_COUNT - 1) {
+	if (_G(savegame)._overworldEntityCount >= Data::OVERWORLD_ENTITY_COUNT - 1) {
 		debugPrintf("No free entity slots\n");
 		return true;
 	}
@@ -270,8 +270,8 @@ bool Console::cmdEnemy(int argc, const char **argv) {
 						_G(map).getTileAt(x, y) != terrain)
 					continue;
 
-				++_G(overworldEntityCount);
-				auto &e = sg._overworldEntities[_G(overworldEntityCount)];
+				++_G(savegame)._overworldEntityCount;
+				auto &e = sg._overworldEntities[_G(savegame)._overworldEntityCount];
 				e._type = Data::TILE_FIRST_MONSTER + typeIdx * 2;
 				e._data = terrain;
 				e._x = x;
diff --git a/engines/ultima/ultima1/data/savegame.cpp b/engines/ultima/ultima1/data/savegame.cpp
index 50f2ed75174..b08b30645c7 100644
--- a/engines/ultima/ultima1/data/savegame.cpp
+++ b/engines/ultima/ultima1/data/savegame.cpp
@@ -142,7 +142,7 @@ void Savegame::synchronizeOriginal(Common::Serializer &s) {
 
 int Savegame::getOverworldEntityAt(int x, int y, int startingIndex) const {
 	int foundIndex = -1;
-	for (; startingIndex <= _G(overworldEntityCount) && foundIndex == -1; ++startingIndex) {
+	for (; startingIndex <= _overworldEntityCount && foundIndex == -1; ++startingIndex) {
 		const auto &e = _overworldEntities[startingIndex];
 		if (e._x == x && e._y == y)
 			foundIndex = startingIndex;
@@ -157,10 +157,10 @@ void Savegame::removeOverworldCreatureAt(int x, int y) {
 		return;
 
 	// Shift all following entities down a slot, removing the found one
-	for (int idx = creatureNum; idx < _G(overworldEntityCount); ++idx)
+	for (int idx = creatureNum; idx < _overworldEntityCount; ++idx)
 		_overworldEntities[idx] = _overworldEntities[idx + 1];
 
-	--_G(overworldEntityCount);
+	--_overworldEntityCount;
 }
 
 int Savegame::getLocationEntityAt(int x, int y) const {
diff --git a/engines/ultima/ultima1/logic/overworld_logic.cpp b/engines/ultima/ultima1/logic/overworld_logic.cpp
index a77fe2d0e46..fb4cef6dfe0 100644
--- a/engines/ultima/ultima1/logic/overworld_logic.cpp
+++ b/engines/ultima/ultima1/logic/overworld_logic.cpp
@@ -219,9 +219,9 @@ bool OverworldLogic::xit() {
 	// Drop the vehicle where the player stands as a re-boardable entity,
 	// then carry on afoot
 	int vehicleTile = sg._overworldEntities[0]._type;
-	if (_G(overworldEntityCount) < Data::OVERWORLD_ENTITY_COUNT - 1) {
-		++_G(overworldEntityCount);
-		auto &e = sg._overworldEntities[_G(overworldEntityCount)];
+	if (_G(savegame)._overworldEntityCount < Data::OVERWORLD_ENTITY_COUNT - 1) {
+		++_G(savegame)._overworldEntityCount;
+		auto &e = sg._overworldEntities[_G(savegame)._overworldEntityCount];
 		e._type = vehicleTile;
 		e._data = terrain;
 		e._x = pos.x;
@@ -362,7 +362,7 @@ void OverworldLogic::moveDown() {
 }
 
 void OverworldLogic::continentChanged(int oldContinent) {
-	for (int index = 1; index < _G(overworldEntityCount); ++index) {
+	for (int index = 1; index < _G(savegame)._overworldEntityCount; ++index) {
 		auto &e = _G(savegame)._overworldEntities[index];
 		int continent = _G(map).getContinentAt(e._x, e._y);
 
@@ -433,9 +433,9 @@ void OverworldLogic::generateCreatures() {
 		return;
 
 	// Add the new entity (addOverworldEntity)
-	if (_G(overworldEntityCount) < Data::OVERWORLD_ENTITY_COUNT - 1) {
-		++_G(overworldEntityCount);
-		auto &e = _G(savegame)._overworldEntities[_G(overworldEntityCount)];
+	if (_G(savegame)._overworldEntityCount < Data::OVERWORLD_ENTITY_COUNT - 1) {
+		++_G(savegame)._overworldEntityCount;
+		auto &e = _G(savegame)._overworldEntities[_G(savegame)._overworldEntityCount];
 		e._type = tile;
 		e._data = data;
 		e._x = x;
@@ -449,7 +449,7 @@ void OverworldLogic::generateCreatures() {
 void OverworldLogic::updateCreatures() {
 	Common::Stack<int> attackers;
 
-	for (int idx = 1; idx <= _G(overworldEntityCount); ++idx) {
+	for (int idx = 1; idx <= _G(savegame)._overworldEntityCount; ++idx) {
 		auto &e = _G(savegame)._overworldEntities[idx];
 
 		if (e._type >= Data::TILE_FIRST_MONSTER && e._type <= Data::TILE_LAST_MONSTER) {
@@ -634,7 +634,7 @@ void OverworldLogic::castPrayer() {
 		// at the player is whisked away
 		Data::Savegame &sg = _G(savegame);
 
-		for (int idx = 1; idx <= _G(overworldEntityCount); ++idx) {
+		for (int idx = 1; idx <= _G(savegame)._overworldEntityCount; ++idx) {
 			Data::OverworldEntity &e = sg._overworldEntities[idx];
 			if (e._type < Data::TILE_FIRST_MONSTER)
 				continue;
diff --git a/engines/ultima/ultima1/ultima1.cpp b/engines/ultima/ultima1/ultima1.cpp
index e7aa7fe8176..76522241833 100644
--- a/engines/ultima/ultima1/ultima1.cpp
+++ b/engines/ultima/ultima1/ultima1.cpp
@@ -111,6 +111,13 @@ Common::Error Ultima1Engine::syncGame(Common::Serializer &s) {
 	_savegame.synchronize(s);
 
 	if (s.isLoading()) {
+		_creaturesCount = 0;
+		for (int i = 1; i <= _savegame._overworldEntityCount; ++i) {
+			int type = _savegame._overworldEntities[i]._type;
+			if (type >= Data::TILE_FIRST_MONSTER && type <= Data::TILE_LAST_MONSTER)
+				++_creaturesCount;
+		}
+
 		_G(map).load(_G(savegame)._mapNum);
 	}
 
diff --git a/engines/ultima/ultima1/ultima1.h b/engines/ultima/ultima1/ultima1.h
index 75355faad28..81d086883d3 100644
--- a/engines/ultima/ultima1/ultima1.h
+++ b/engines/ultima/ultima1/ultima1.h
@@ -89,7 +89,6 @@ public:
 	Data::SpaceStarfield _starfield;
 	Data::Savegame _savegame;
 	Common::SharedPtr<Logic::Logic> _logic;
-	int _overworldEntityCount = 0;
 	int _creaturesCount = 0;
 	uint32 _moveCtr = 0;
 	int _transportFoodCtr = 0;
diff --git a/engines/ultima/ultima1/views/create_character.cpp b/engines/ultima/ultima1/views/create_character.cpp
index 40b641cc27e..00d15c90894 100644
--- a/engines/ultima/ultima1/views/create_character.cpp
+++ b/engines/ultima/ultima1/views/create_character.cpp
@@ -410,6 +410,8 @@ void CreateCharacter::confirmAndSave() {
 	p._enemyVessels = 0;
 	p._signMarker = -1;
 	p._moveCount = 0;
+	p._overworldEntityCount = 0;
+	_G(creaturesCount) = 0;
 
 	_cursor.hide();
 
diff --git a/engines/ultima/ultima1/views/interactions/dead.cpp b/engines/ultima/ultima1/views/interactions/dead.cpp
index 3b2eecd5646..6b800d9d82c 100644
--- a/engines/ultima/ultima1/views/interactions/dead.cpp
+++ b/engines/ultima/ultima1/views/interactions/dead.cpp
@@ -197,7 +197,7 @@ bool Dead::tick() {
 }
 
 void Dead::removeCreaturesOnContinent(int continent) {
-	for (int index = 1; index < _G(overworldEntityCount); ++index) {
+	for (int index = 1; index < _G(savegame)._overworldEntityCount; ++index) {
 		auto &e = _G(savegame)._overworldEntities[index];
 
 		if (_G(map).getContinentAt(e._x, e._y) == continent) {
diff --git a/engines/ultima/ultima1/views/interactions/merchant.cpp b/engines/ultima/ultima1/views/interactions/merchant.cpp
index 8e417c8442d..f5b17713838 100644
--- a/engines/ultima/ultima1/views/interactions/merchant.cpp
+++ b/engines/ultima/ultima1/views/interactions/merchant.cpp
@@ -301,7 +301,7 @@ bool Merchant::isWenchNearby() const {
 
 int Merchant::overworldTransportCount() const {
 	int count = 0;
-	for (int idx = 1; idx <= _G(overworldEntityCount); ++idx) {
+	for (int idx = 1; idx <= _G(savegame)._overworldEntityCount; ++idx) {
 		int type = _G(savegame)._overworldEntities[idx]._type;
 		if (type >= Data::TILE_HORSE && type <= Data::TILE_SHUTTLE)
 			++count;
@@ -879,9 +879,9 @@ void Merchant::spawnTransport(int transportId) {
 			++dy;
 	} while (dy < 2 && !match);
 
-	if (_G(overworldEntityCount) < Data::OVERWORLD_ENTITY_COUNT - 1) {
-		++_G(overworldEntityCount);
-		auto &e = sg._overworldEntities[_G(overworldEntityCount)];
+	if (_G(savegame)._overworldEntityCount < Data::OVERWORLD_ENTITY_COUNT - 1) {
+		++_G(savegame)._overworldEntityCount;
+		auto &e = sg._overworldEntities[_G(savegame)._overworldEntityCount];
 		e._type = TRANSPORT_TILES[transportId];
 		e._data = terrain;
 		e._x = pos.x + dx;
diff --git a/engines/ultima/ultima1/views/interactions/princess_saved.cpp b/engines/ultima/ultima1/views/interactions/princess_saved.cpp
index a270d252f83..b03c31c83e1 100644
--- a/engines/ultima/ultima1/views/interactions/princess_saved.cpp
+++ b/engines/ultima/ultima1/views/interactions/princess_saved.cpp
@@ -107,9 +107,9 @@ void PrincessSaved::spawnTimeMachine() {
 		int y = baseY + g_engine->getRandomNumber(11, 15);
 
 		if (_G(map).getOverworldTileAt(x, y) == Data::TILE_WOODS) {
-			if (_G(overworldEntityCount) < Data::OVERWORLD_ENTITY_COUNT - 1) {
-				++_G(overworldEntityCount);
-				auto &e = _G(savegame)._overworldEntities[_G(overworldEntityCount)];
+			if (_G(savegame)._overworldEntityCount < Data::OVERWORLD_ENTITY_COUNT - 1) {
+				++_G(savegame)._overworldEntityCount;
+				auto &e = _G(savegame)._overworldEntities[_G(savegame)._overworldEntityCount];
 				e._type = Data::TILE_TIME_MACHINE;
 				e._data = Data::TILE_WOODS;
 				e._x = x;


Commit: 29f4cf5603d4d9c2301a108e71ae9d93e4d6b6f0
    https://github.com/scummvm/scummvm/commit/29f4cf5603d4d9c2301a108e71ae9d93e4d6b6f0
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:41:05+11:00

Commit Message:
ULTIMA: ULTIMA1: Fix prompt when entering/exiting city/castles

Changed paths:
    engines/ultima/ultima1/logic/city_castle_logic.cpp
    engines/ultima/ultima1/logic/overworld_logic.cpp


diff --git a/engines/ultima/ultima1/logic/city_castle_logic.cpp b/engines/ultima/ultima1/logic/city_castle_logic.cpp
index 1a9ec36c002..d5eb01f6a1b 100644
--- a/engines/ultima/ultima1/logic/city_castle_logic.cpp
+++ b/engines/ultima/ultima1/logic/city_castle_logic.cpp
@@ -145,6 +145,7 @@ bool CityCastleLogic::move(Data::Direction dir) {
 
 	if (x < 0 || y < 0 || x >= Data::CITY_WIDTH || y >= Data::CITY_HEIGHT) {
 		leaving();
+		prompt();		// Called since end of turn processing will be skipped
 		return false;
 
 	} else {
diff --git a/engines/ultima/ultima1/logic/overworld_logic.cpp b/engines/ultima/ultima1/logic/overworld_logic.cpp
index fb4cef6dfe0..67b8423292a 100644
--- a/engines/ultima/ultima1/logic/overworld_logic.cpp
+++ b/engines/ultima/ultima1/logic/overworld_logic.cpp
@@ -135,6 +135,8 @@ bool OverworldLogic::enter() {
 	if (location == 0) {
 		writeString("Enter?\n");
 		playFX(1);
+		return true;
+
 	} else {
 		// Display the enter message
 		_G(map)._isLordBritishCastle = location == 33;
@@ -156,9 +158,12 @@ bool OverworldLogic::enter() {
 
 		// Run any logic for entering it
 		_G(logic)->entering();
-	}
 
-	return true;
+		// Do separate prompt call, since end of turn logic will be skipped
+		prompt();
+
+		return false;
+	}
 }
 
 bool OverworldLogic::fire() {


Commit: ad1579880ada506558b87248c3240e8528b6c0ab
    https://github.com/scummvm/scummvm/commit/ad1579880ada506558b87248c3240e8528b6c0ab
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:41:05+11:00

Commit Message:
ULTIMA: ULTIMA1: Cleanup dungeon monster Id tracking

Changed paths:
    engines/ultima/ultima1/data/map_dungeon.h
    engines/ultima/ultima1/logic/dungeon_logic.cpp


diff --git a/engines/ultima/ultima1/data/map_dungeon.h b/engines/ultima/ultima1/data/map_dungeon.h
index ece20713e8f..b9cd613c92a 100644
--- a/engines/ultima/ultima1/data/map_dungeon.h
+++ b/engines/ultima/ultima1/data/map_dungeon.h
@@ -37,7 +37,7 @@ constexpr int DUNGEON_MONSTER_SLOTS = 5;
 // No monster is present in a cell. Real monster Ids are 0-24 (5 tiers of
 // 5 types, tier = (dungeonLevel - 1) / 2), so this can't use 0 like the
 // _itemId sentinel does
-constexpr uint8 DUNGEON_NO_MONSTER = 0xff;
+constexpr int16 DUNGEON_NO_MONSTER = -1;
 
 // Disguised monster Ids that don't block movement/view like a normal
 // monster would - a mimic looks (and is named) like a chest, an
@@ -78,11 +78,9 @@ enum DungeonItemId {
 
 struct DungeonCell {
 	DungeonTileId _tileNum;
-	uint8 _monsterId;
-	uint8 _itemId;
-	uint16 _monsterHp;
-
-	void synchronize(Common::Serializer &s);
+	int16 _monsterId;
+	int16 _itemId;
+	int16 _monsterHp;
 };
 
 struct MapDungeon {
diff --git a/engines/ultima/ultima1/logic/dungeon_logic.cpp b/engines/ultima/ultima1/logic/dungeon_logic.cpp
index 12b40a731f3..0a86e3bc657 100644
--- a/engines/ultima/ultima1/logic/dungeon_logic.cpp
+++ b/engines/ultima/ultima1/logic/dungeon_logic.cpp
@@ -597,7 +597,7 @@ void DungeonLogic::endOfTurn() {
 int DungeonLogic::getMonsterDistance(int maxDistance) const {
 	int deltaX = getDirDeltaX();
 	int deltaY = getDirDeltaY();
-	int x, y, tile = 0, monsterId = -1;
+	int x, y, tile = 0, monsterId = Data::DUNGEON_NO_MONSTER;
 	int dist;
 
 	for (dist = 0; dist < maxDistance; ++dist) {
@@ -606,13 +606,13 @@ int DungeonLogic::getMonsterDistance(int maxDistance) const {
 		tile = _G(dungeon)._cells[y][x]._tileNum;
 		monsterId = _G(dungeon)._cells[y][x]._monsterId;
 
-		if (monsterId != -1 || tile == Data::DTILE_WALL || tile == Data::DTILE_SECRET_DOOR ||
+		if (monsterId != Data::DUNGEON_NO_MONSTER || tile == Data::DTILE_WALL || tile == Data::DTILE_SECRET_DOOR ||
 			tile == Data::DTILE_BEAMS || tile == Data::DTILE_DOOR)
 			break;
 	}
 
-	return (monsterId != -1 && tile != Data::DTILE_WALL &&
-		tile != Data::DTILE_SECRET_DOOR && tile != Data::DTILE_BEAMS) ? dist : 0;;
+	return (monsterId != Data::DUNGEON_NO_MONSTER && tile != Data::DTILE_WALL &&
+		tile != Data::DTILE_SECRET_DOOR && tile != Data::DTILE_BEAMS) ? dist : 0;
 }
 
 void DungeonLogic::writeMonsterName(int monsterId) {


Commit: 9b464ab509679edf5f0c28c79577ae72fcb4891e
    https://github.com/scummvm/scummvm/commit/9b464ab509679edf5f0c28c79577ae72fcb4891e
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:41:06+11:00

Commit Message:
ULTIMA: ULTIMA1: Don't show prompt when entering pillars/signs

Changed paths:
    engines/ultima/ultima1/logic/city_castle_logic.cpp
    engines/ultima/ultima1/logic/dungeon_logic.cpp
    engines/ultima/ultima1/logic/overworld_logic.cpp


diff --git a/engines/ultima/ultima1/logic/city_castle_logic.cpp b/engines/ultima/ultima1/logic/city_castle_logic.cpp
index d5eb01f6a1b..eaf1076589c 100644
--- a/engines/ultima/ultima1/logic/city_castle_logic.cpp
+++ b/engines/ultima/ultima1/logic/city_castle_logic.cpp
@@ -130,6 +130,7 @@ CityCastleLogic::CityCastleLogic() {
 void CityCastleLogic::entering() {
 	loadEntities();
 	_G(savegame)._guardsHostile = false;
+	prompt();
 }
 
 void CityCastleLogic::leaving() {
diff --git a/engines/ultima/ultima1/logic/dungeon_logic.cpp b/engines/ultima/ultima1/logic/dungeon_logic.cpp
index 0a86e3bc657..3e8ccae0113 100644
--- a/engines/ultima/ultima1/logic/dungeon_logic.cpp
+++ b/engines/ultima/ultima1/logic/dungeon_logic.cpp
@@ -44,6 +44,7 @@ void DungeonLogic::entering() {
 	_G(savegame)._dungeonLevel = 1;
 	_G(savegame)._dungeonDirection = 4;
 	_G(savegame)._dungeonExitHitPoints = 0;
+	prompt();
 }
 
 int DungeonLogic::getDirDeltaX() const {
diff --git a/engines/ultima/ultima1/logic/overworld_logic.cpp b/engines/ultima/ultima1/logic/overworld_logic.cpp
index 67b8423292a..619fe25c45f 100644
--- a/engines/ultima/ultima1/logic/overworld_logic.cpp
+++ b/engines/ultima/ultima1/logic/overworld_logic.cpp
@@ -159,9 +159,6 @@ bool OverworldLogic::enter() {
 		// Run any logic for entering it
 		_G(logic)->entering();
 
-		// Do separate prompt call, since end of turn logic will be skipped
-		prompt();
-
 		return false;
 	}
 }


Commit: 8b599aeced69422cf63313aad5a2abded81a2ee6
    https://github.com/scummvm/scummvm/commit/8b599aeced69422cf63313aad5a2abded81a2ee6
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:41:06+11:00

Commit Message:
ULTIMA: ULTIMA1: Fix display of treasure after killing monster

Changed paths:
    engines/ultima/ultima1/logic/dungeon_logic.cpp
    engines/ultima/ultima1/logic/dungeon_logic.h
    engines/ultima/ultima1/logic/logic.cpp
    engines/ultima/ultima1/logic/logic.h
    engines/ultima/ultima1/logic/overworld_logic.cpp
    engines/ultima/ultima1/logic/overworld_logic.h


diff --git a/engines/ultima/ultima1/logic/dungeon_logic.cpp b/engines/ultima/ultima1/logic/dungeon_logic.cpp
index 3e8ccae0113..546a0ef24cc 100644
--- a/engines/ultima/ultima1/logic/dungeon_logic.cpp
+++ b/engines/ultima/ultima1/logic/dungeon_logic.cpp
@@ -320,7 +320,7 @@ bool DungeonLogic::unlock() {
 
 	cell._itemId = Data::DITEM_NONE;
 	writeString("Thou dost find: ");
-	giveCoins(getRandomNumber(3, sg._dungeonLevel * sg._dungeonLevel + 9));
+	giveTreasure(getRandomNumber(3, sg._dungeonLevel * sg._dungeonLevel + 9), 0);
 	return true;
 }
 
@@ -355,7 +355,7 @@ bool DungeonLogic::open() {
 
 	cell._itemId = Data::DITEM_NONE;
 	writeString("Thou dost find: ");
-	giveCoins(getRandomNumber(3, sg._dungeonLevel * sg._dungeonLevel + 9));
+	giveTreasure(getRandomNumber(3, sg._dungeonLevel * sg._dungeonLevel + 9), 0);
 	return true;
 }
 
@@ -653,15 +653,6 @@ void DungeonLogic::monsterDead(int monsterId) {
 	}
 }
 
-void DungeonLogic::giveCoins(int coins) {
-	Data::Savegame &sg = _G(savegame);
-	if (sg._coins + coins > 9999)
-		coins = 9999 - sg._coins;
-
-	sg._coins += coins;
-	writeString("%d gold\n", coins);
-}
-
 void DungeonLogic::dungeonAttackAt(int effectNum, int agility, int strike, int x, int y) {
 	Data::MapDungeon &dungeon = _G(dungeon);
 	Data::Savegame &sg = _G(savegame);
@@ -703,7 +694,7 @@ void DungeonLogic::dungeonAttackAt(int effectNum, int agility, int strike, int x
 
 		int coins = getRandomNumber(2, sg._dungeonLevel * 3 + 10 + cell._monsterId);
 		writeString("Thou dost find: ");
-		giveCoins(coins);
+		giveTreasure(coins, 0);
 
 		dungeon.killMonster(x, y);
 
@@ -751,7 +742,7 @@ void DungeonLogic::castOpen() {
 
 	writeString("Thou dost find: ");
 	int coins = getRandomNumber(3, sg._dungeonLevel * sg._dungeonLevel + 9);
-	giveCoins(coins);
+	giveTreasure(coins, 0);
 }
 
 void DungeonLogic::castSpell(int spell, bool showPhrase) {
diff --git a/engines/ultima/ultima1/logic/dungeon_logic.h b/engines/ultima/ultima1/logic/dungeon_logic.h
index b668655e31c..fa72f466544 100644
--- a/engines/ultima/ultima1/logic/dungeon_logic.h
+++ b/engines/ultima/ultima1/logic/dungeon_logic.h
@@ -99,11 +99,6 @@ private:
 	 */
 	void monsterDead(int monsterId);
 
-	/**
-	 * Adds coins to the player's purse, capped at 9999
-	 */
-	void giveCoins(int coins);
-
 	/**
 	 * Resolves an attack (physical or magical) landing at the given
 	 * dungeon cell - rolls to hit, then applies damage or kills the
diff --git a/engines/ultima/ultima1/logic/logic.cpp b/engines/ultima/ultima1/logic/logic.cpp
index 883ab28f5ce..38bf42fd980 100644
--- a/engines/ultima/ultima1/logic/logic.cpp
+++ b/engines/ultima/ultima1/logic/logic.cpp
@@ -67,6 +67,54 @@ void Logic::redrawStats() {
 	g_engine->baseView()->findView("Stats")->draw();
 }
 
+void Logic::giveTreasure(int coins, int nameLen) {
+	Data::Savegame &sg = _G(savegame);
+	if (sg._coins + coins > 9999)
+		coins = 9999 - sg._coins;
+
+	if (coins == 0)
+		return;
+
+	// Whether the next amount shown ends its line
+	bool endLine;
+	if (nameLen == 0) {
+		endLine = true;
+	} else if (nameLen > 6) {
+		writeString("!\n");
+		endLine = false;
+	} else {
+		writeString("! ");
+		endLine = true;
+	}
+
+	int copper = coins % 10;
+	int silver = (coins % 100 - copper) / 10;
+	int gold = coins / 1000;
+
+	auto showAmount = [&](int value, const char *format) {
+		if (value == 0)
+			return;
+
+		writeString(format, value);
+		if (endLine) {
+			writeString("\n");
+			endLine = false;
+		} else {
+			endLine = true;
+		}
+	};
+
+	showAmount(copper, "%d copper!");
+	showAmount(silver, "%2d silver!");
+	showAmount(gold, "%2d gold!");
+
+	if (endLine)
+		writeString("\n");
+
+	sg._coins += coins;
+	redrawStats();
+}
+
 void Logic::playFX(int num) {
 	g_engine->playFX(num);
 }
diff --git a/engines/ultima/ultima1/logic/logic.h b/engines/ultima/ultima1/logic/logic.h
index 6b3667e7751..e112400960d 100644
--- a/engines/ultima/ultima1/logic/logic.h
+++ b/engines/ultima/ultima1/logic/logic.h
@@ -94,6 +94,14 @@ protected:
 	 */
 	void redrawStats();
 
+	/**
+	 * Adds coins to the player's purse, capped at 9999, and lists the copper,
+	 * silver and gold found. When nameLen is the length of a just-shown
+	 * monster name, the amounts continue on from it; zero means they start a
+	 * fresh line
+	 */
+	void giveTreasure(int coins, int nameLen);
+
 	/**
 	 * Triggers combat action
 	 */
diff --git a/engines/ultima/ultima1/logic/overworld_logic.cpp b/engines/ultima/ultima1/logic/overworld_logic.cpp
index 619fe25c45f..c014e7daacc 100644
--- a/engines/ultima/ultima1/logic/overworld_logic.cpp
+++ b/engines/ultima/ultima1/logic/overworld_logic.cpp
@@ -676,15 +676,6 @@ int OverworldLogic::getMagicWeaponPower() {
 	return result;
 }
 
-void OverworldLogic::giveCoins(int coins) {
-	Data::Savegame &sg = _G(savegame);
-	if (sg._coins + coins > 9999)
-		coins = 9999 - sg._coins;
-
-	sg._coins += coins;
-	writeString("%d gold\n", coins);
-}
-
 void OverworldLogic::damage(Data::Direction dir, int effectNum, int maxDistance, int strike, int hitChance, int tileId) {
 	// DELTA_X/Y aren't valid for DIR_UNSPECIFIED (-1) - treat it the same
 	// as DELTA_X/Y's own unused index 0, i.e. the projectile just stays put
@@ -740,7 +731,7 @@ void OverworldLogic::damage(Data::Direction dir, int effectNum, int maxDistance,
 
 	if (e._hits > 0) {
 		writeString(Common::String(monsterName).size() > 6 ? "!\n" : "! ");
-		writeString("%d damage\n", strike);
+		writeString("%2d damage\n", strike);
 		playFX(2);
 
 	} else {
@@ -752,8 +743,7 @@ void OverworldLogic::damage(Data::Direction dir, int effectNum, int maxDistance,
 		sg._experience += expGain;
 		playFX(2);
 
-		giveCoins(coins);
-		redrawStats();
+		giveTreasure(coins, strlen(monsterName));
 	}
 
 	endOfTurn();
diff --git a/engines/ultima/ultima1/logic/overworld_logic.h b/engines/ultima/ultima1/logic/overworld_logic.h
index 38c0fdd9e63..27cbb7ee691 100644
--- a/engines/ultima/ultima1/logic/overworld_logic.h
+++ b/engines/ultima/ultima1/logic/overworld_logic.h
@@ -118,11 +118,6 @@ private:
 	 */
 	int getMagicWeaponPower();
 
-	/**
-	 * Adds coins to the player's purse, capped at 9999
-	 */
-	void giveCoins(int coins);
-
 protected:
 	/**
 	 * Board a vehicle the player is standing on


Commit: aab5565a125295666b1ab654e97b4bb084ebb03b
    https://github.com/scummvm/scummvm/commit/aab5565a125295666b1ab654e97b4bb084ebb03b
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:41:06+11:00

Commit Message:
ULTIMA: ULTIMA1: Command area text shold start at column 1

Changed paths:
    engines/ultima/ultima1/logic/dungeon_logic.cpp
    engines/ultima/ultima1/views/commands.cpp
    engines/ultima/ultima1/views/interactions/merchant.cpp
    engines/ultima/ultima1/views/interactions/pillar.cpp


diff --git a/engines/ultima/ultima1/logic/dungeon_logic.cpp b/engines/ultima/ultima1/logic/dungeon_logic.cpp
index 546a0ef24cc..22e40af5273 100644
--- a/engines/ultima/ultima1/logic/dungeon_logic.cpp
+++ b/engines/ultima/ultima1/logic/dungeon_logic.cpp
@@ -649,7 +649,6 @@ void DungeonLogic::monsterDead(int monsterId) {
 		sg._questStatus[castleIdx] = 1;
 		writeString("A quest has been completed!\n");
 		playFX(5);
-		writeString("\n");
 	}
 }
 
diff --git a/engines/ultima/ultima1/views/commands.cpp b/engines/ultima/ultima1/views/commands.cpp
index 6987a234f2a..5567ce2a8e7 100644
--- a/engines/ultima/ultima1/views/commands.cpp
+++ b/engines/ultima/ultima1/views/commands.cpp
@@ -73,7 +73,20 @@ bool Commands::msgGame(const GameMessage &msg) {
 
 void Commands::writeString(const Common::String &msg) {
 	_textCursor.hide();
-	_surface.writeString(msg);
+
+	// Text starting a line is indented a column, lining up with the command
+	// text that follows the '>' prompt. The prompt glyph itself stays in column 0
+	Common::String text;
+	bool lineStart = _surface.getTextPos().x == 0;
+	for (uint i = 0; i < msg.size(); ++i) {
+		if (lineStart && msg[i] != '\n' && msg[i] != '\x10')
+			text += ' ';
+
+		text += msg[i];
+		lineStart = msg[i] == '\n';
+	}
+
+	_surface.writeString(text);
 
 	if (msg.contains('\n')) {
 		delay(NEWLINE_DELAY);
diff --git a/engines/ultima/ultima1/views/interactions/merchant.cpp b/engines/ultima/ultima1/views/interactions/merchant.cpp
index f5b17713838..cf4ea8662b4 100644
--- a/engines/ultima/ultima1/views/interactions/merchant.cpp
+++ b/engines/ultima/ultima1/views/interactions/merchant.cpp
@@ -394,7 +394,7 @@ void Merchant::addTip(int tipIdx) {
 
 void Merchant::chooseBuy() {
 	resetLine();
-	writeString("Transact-Buy: ");
+	writeString("\x10Transact-Buy: ");
 	showCursor();
 
 	switch (_shopType) {
@@ -459,7 +459,7 @@ void Merchant::chooseBuy() {
 
 void Merchant::chooseSell() {
 	resetLine();
-	writeString("Transact-Sell: ");
+	writeString("\x10Transact-Sell: ");
 	showCursor();
 
 	switch (_shopType) {
@@ -732,7 +732,7 @@ void Merchant::groceryKeypress(const KeypressMessage &msg) {
 		if (!_amount.empty()) {
 			_amount.deleteLastChar();
 			resetLine();
-			writeString(Common::String::format("Transact-Buy: %s", _amount.c_str()));
+			writeString(Common::String::format("\x10Transact-Buy: %s", _amount.c_str()));
 			showCursor();
 		}
 
@@ -745,7 +745,7 @@ void Merchant::groceryKeypress(const KeypressMessage &msg) {
 		if (qty == 0 || total > sg._coins) {
 			// The typed amount is replaced by "nothing"
 			resetLine();
-			writeString("Transact-Buy: ");
+			writeString("\x10Transact-Buy: ");
 
 			if (qty == 0)
 				nothing();
diff --git a/engines/ultima/ultima1/views/interactions/pillar.cpp b/engines/ultima/ultima1/views/interactions/pillar.cpp
index a276dc85212..3372ecf5e2a 100644
--- a/engines/ultima/ultima1/views/interactions/pillar.cpp
+++ b/engines/ultima/ultima1/views/interactions/pillar.cpp
@@ -180,7 +180,6 @@ void Pillar::questCompleted(int locationNum) {
 		sg._questStatus[castleIdx] = 1;
 		writeString("A quest has been completed!\n");
 		g_engine->playFX(5);
-		writeString("\n");
 	}
 }
 


Commit: 48f35d96b591ad40d9ca478039933ffbe68e2120
    https://github.com/scummvm/scummvm/commit/48f35d96b591ad40d9ca478039933ffbe68e2120
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:41:06+11:00

Commit Message:
ULTIMA: ULTIMA1: Fix monster placement with continent changes

Changed paths:
    engines/ultima/ultima1/data/map.cpp
    engines/ultima/ultima1/data/map.h
    engines/ultima/ultima1/logic/overworld_logic.cpp
    engines/ultima/ultima1/logic/overworld_logic.h


diff --git a/engines/ultima/ultima1/data/map.cpp b/engines/ultima/ultima1/data/map.cpp
index 1f6ef9b8f87..b5c608e97f4 100644
--- a/engines/ultima/ultima1/data/map.cpp
+++ b/engines/ultima/ultima1/data/map.cpp
@@ -295,7 +295,7 @@ int Map::getTileAt(int x, int y, int creatureIndex) const {
 	int entityIndex;
 
 	if (_mapType == MAPTYPE_OVERWORLD) {
-		entityIndex = _G(savegame).getOverworldEntityAt(x, y, creatureIndex);
+		entityIndex = _G(savegame).getOverworldEntityAt(wrapOverworldX(x), wrapOverworldY(y), creatureIndex);
 		if (entityIndex >= 0)
 			return _G(savegame)._overworldEntities[entityIndex]._type;
 	} else {
@@ -307,14 +307,22 @@ int Map::getTileAt(int x, int y, int creatureIndex) const {
 	return getMapTile(x, y);
 }
 
+int Map::wrapOverworldX(int x) const {
+	return (x % OVERWORLD_WIDTH + OVERWORLD_WIDTH) % OVERWORLD_WIDTH;
+}
+
+int Map::wrapOverworldY(int y) const {
+	return (y % OVERWORLD_HEIGHT + OVERWORLD_HEIGHT) % OVERWORLD_HEIGHT;
+}
+
 int Map::getOverworldTileAt(int x, int y) const {
+	x = wrapOverworldX(x);
+	y = wrapOverworldY(y);
+
 	int entityIndex = _G(savegame).getOverworldEntityAt(x, y, 1);
 	if (entityIndex >= 0)
 		return _G(savegame)._overworldEntities[entityIndex]._type;
 
-	x = (x % OVERWORLD_WIDTH + OVERWORLD_WIDTH) % OVERWORLD_WIDTH;
-	y = (y % OVERWORLD_HEIGHT + OVERWORLD_HEIGHT) % OVERWORLD_HEIGHT;
-
 	// Skip the castle/city flag animation frames, as getMapTile does
 	int tile = _overworldMap[y * OVERWORLD_WIDTH + x];
 	if (tile > TILE_CASTLE1) {
diff --git a/engines/ultima/ultima1/data/map.h b/engines/ultima/ultima1/data/map.h
index 6dab72a21a7..ed55bb8497e 100644
--- a/engines/ultima/ultima1/data/map.h
+++ b/engines/ultima/ultima1/data/map.h
@@ -231,6 +231,13 @@ public:
 	 */
 	int getOverworldTileAt(int x, int y) const;
 
+	/**
+	 * Wraps an X or Y position around the edges of the overworld. Entities
+	 * are always stored wrapped, so positions must be wrapped before comparing them
+	 */
+	int wrapOverworldX(int x) const;
+	int wrapOverworldY(int y) const;
+
 	/**
 	 * Counts the ocean, grass and woods tiles in the overworld around the player's
 	 * position, which a location uses to know what vehicles can be bought there
diff --git a/engines/ultima/ultima1/logic/overworld_logic.cpp b/engines/ultima/ultima1/logic/overworld_logic.cpp
index c014e7daacc..308e66b034b 100644
--- a/engines/ultima/ultima1/logic/overworld_logic.cpp
+++ b/engines/ultima/ultima1/logic/overworld_logic.cpp
@@ -364,13 +364,17 @@ void OverworldLogic::moveDown() {
 }
 
 void OverworldLogic::continentChanged(int oldContinent) {
-	for (int index = 1; index < _G(savegame)._overworldEntityCount; ++index) {
+	// Monsters left behind on the old continent are dropped. A removal shifts
+	// the following entities down, so the same slot is rechecked
+	int index = 1;
+	while (index <= _G(savegame)._overworldEntityCount) {
 		auto &e = _G(savegame)._overworldEntities[index];
-		int continent = _G(map).getContinentAt(e._x, e._y);
 
-		if (continent == oldContinent) {
+		if (e._type >= Data::TILE_FIRST_MONSTER && _G(map).getContinentAt(e._x, e._y) == oldContinent) {
 			_G(savegame).removeOverworldCreatureAt(e._x, e._y);
 			_G(creaturesCount)--;
+		} else {
+			++index;
 		}
 	}
 }
@@ -424,8 +428,8 @@ void OverworldLogic::generateCreatures() {
 		if (getRandomNumber(1, 16) & 1)
 			yOff = -yOff;
 
-		x = pos.x + xOff;	// getViewportX(xOff + Data::OVERWORLD_VISIBLE_CENTER_X);
-		y = pos.y + yOff;	// getViewportY(yOff + Data::OVERWORLD_VISIBLE_CENTER_Y);
+		x = _G(map).wrapOverworldX(pos.x + xOff);
+		y = _G(map).wrapOverworldY(pos.y + yOff);
 		tileAtSpot = _G(map).getTileAt(x, y);
 
 		rangeOk = _G(map).mapRangeCheckX(x) && _G(map).mapRangeCheckY(y);
@@ -511,8 +515,8 @@ bool OverworldLogic::monsterTransportCheck(int entityIndex, int xDiff, int yDiff
 		tile2 = Data::TILE_GRASS;
 	}
 
-	int newX = _G(savegame)._overworldPos.x - xDiff;
-	int newY = _G(savegame)._overworldPos.y - yDiff;
+	int newX = _G(map).wrapOverworldX(_G(savegame)._overworldPos.x - xDiff);
+	int newY = _G(map).wrapOverworldY(_G(savegame)._overworldPos.y - yDiff);
 	int tile = _G(map).getTileAt(newX, newY);
 
 	// Single-terrain (amphibious) monster types are also allowed to move
@@ -524,6 +528,15 @@ bool OverworldLogic::monsterTransportCheck(int entityIndex, int xDiff, int yDiff
 		_G(map).mapRangeCheckX(newX) && _G(map).mapRangeCheckY(newY);
 }
 
+void OverworldLogic::moveEntityFromPlayer(int entityIndex, int xDiff, int yDiff) {
+	const Common::Point &pos = _G(savegame)._overworldPos;
+	auto &e = _G(savegame)._overworldEntities[entityIndex];
+
+	e._x = _G(map).wrapOverworldX(pos.x - xDiff);
+	e._y = _G(map).wrapOverworldY(pos.y - yDiff);
+	e._data = _G(map).getMapTile(e._x, e._y);
+}
+
 bool OverworldLogic::monsterMoveCheckX(int entityIndex, int xDiff, int yDiff) {
 	if (xDiff == 0)
 		return false;
@@ -532,7 +545,7 @@ bool OverworldLogic::monsterMoveCheckX(int entityIndex, int xDiff, int yDiff) {
 	if (!monsterTransportCheck(entityIndex, xDiff + step, yDiff))
 		return false;
 
-	_G(savegame)._overworldEntities[entityIndex]._x -= step;
+	moveEntityFromPlayer(entityIndex, xDiff + step, yDiff);
 	return true;
 }
 
@@ -544,7 +557,7 @@ bool OverworldLogic::monsterMoveCheckY(int entityIndex, int xDiff, int yDiff) {
 	if (!monsterTransportCheck(entityIndex, xDiff, yDiff + step))
 		return false;
 
-	_G(savegame)._overworldEntities[entityIndex]._y -= step;
+	moveEntityFromPlayer(entityIndex, xDiff, yDiff + step);
 	return true;
 }
 
@@ -715,6 +728,8 @@ void OverworldLogic::damage(Data::Direction dir, int effectNum, int maxDistance,
 	}
 
 	Data::Savegame &sg = _G(savegame);
+	x = _G(map).wrapOverworldX(x);
+	y = _G(map).wrapOverworldY(y);
 	int entityIdx = sg.getOverworldEntityAt(x, y, 1);
 	if (entityIdx == -1) {
 		// Shouldn't normally happen - the scan found a monster tile with no
diff --git a/engines/ultima/ultima1/logic/overworld_logic.h b/engines/ultima/ultima1/logic/overworld_logic.h
index 27cbb7ee691..10b553930cf 100644
--- a/engines/ultima/ultima1/logic/overworld_logic.h
+++ b/engines/ultima/ultima1/logic/overworld_logic.h
@@ -91,6 +91,12 @@ private:
 	 */
 	bool monsterTransportCheck(int entityIndex, int xDiff, int yDiff);
 
+	/**
+	 * Places an entity at the overworld position that is the given distance
+	 * from the player, wrapped around the map edges
+	 */
+	void moveEntityFromPlayer(int entityIndex, int xDiff, int yDiff);
+
 	/**
 	 * Attempts to move a monster one step closer to the player along the
 	 * X axis. Returns true if it moved


Commit: 593bb1af5b16929d0c5adc1b88749092d1417eb1
    https://github.com/scummvm/scummvm/commit/593bb1af5b16929d0c5adc1b88749092d1417eb1
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:41:06+11:00

Commit Message:
ULTIMA: ULTIMA1: Fix dungeon attacks when standing in a doorway

Changed paths:
    engines/ultima/ultima1/logic/dungeon_logic.cpp


diff --git a/engines/ultima/ultima1/logic/dungeon_logic.cpp b/engines/ultima/ultima1/logic/dungeon_logic.cpp
index 22e40af5273..e4e7f90e4ac 100644
--- a/engines/ultima/ultima1/logic/dungeon_logic.cpp
+++ b/engines/ultima/ultima1/logic/dungeon_logic.cpp
@@ -599,18 +599,17 @@ int DungeonLogic::getMonsterDistance(int maxDistance) const {
 	int deltaX = getDirDeltaX();
 	int deltaY = getDirDeltaY();
 	int x, y, tile = 0, monsterId = Data::DUNGEON_NO_MONSTER;
-	int dist;
+	int dist = 0;
 
-	for (dist = 0; dist < maxDistance; ++dist) {
+	// Scanning starts at the cell in front of the player
+	do {
+		++dist;
 		x = _G(savegame)._locationPosition.x + deltaX * dist;
 		y = _G(savegame)._locationPosition.y + deltaY * dist;
 		tile = _G(dungeon)._cells[y][x]._tileNum;
 		monsterId = _G(dungeon)._cells[y][x]._monsterId;
-
-		if (monsterId != Data::DUNGEON_NO_MONSTER || tile == Data::DTILE_WALL || tile == Data::DTILE_SECRET_DOOR ||
-			tile == Data::DTILE_BEAMS || tile == Data::DTILE_DOOR)
-			break;
-	}
+	} while (dist < maxDistance && monsterId == Data::DUNGEON_NO_MONSTER && tile != Data::DTILE_WALL &&
+		tile != Data::DTILE_SECRET_DOOR && tile != Data::DTILE_BEAMS && tile != Data::DTILE_DOOR);
 
 	return (monsterId != Data::DUNGEON_NO_MONSTER && tile != Data::DTILE_WALL &&
 		tile != Data::DTILE_SECRET_DOOR && tile != Data::DTILE_BEAMS) ? dist : 0;


Commit: 286ea0548ad495820f37761751e55e4991edfe8e
    https://github.com/scummvm/scummvm/commit/286ea0548ad495820f37761751e55e4991edfe8e
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:41:06+11:00

Commit Message:
ULTIMA: ULTIMA1: Fix prompt after climbing dungeon ladder

Changed paths:
    engines/ultima/ultima1/logic/dungeon_logic.cpp


diff --git a/engines/ultima/ultima1/logic/dungeon_logic.cpp b/engines/ultima/ultima1/logic/dungeon_logic.cpp
index e4e7f90e4ac..229ec1e4914 100644
--- a/engines/ultima/ultima1/logic/dungeon_logic.cpp
+++ b/engines/ultima/ultima1/logic/dungeon_logic.cpp
@@ -290,6 +290,8 @@ bool DungeonLogic::climb() {
 	else
 		climbLadderDown();
 
+	// We want end of turn logic, but changing level will suppress the prompt display
+	prompt();
 	return true;
 }
 


Commit: b154b9dd44633f68c91d3e09c12692b8f427645d
    https://github.com/scummvm/scummvm/commit/b154b9dd44633f68c91d3e09c12692b8f427645d
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:41:06+11:00

Commit Message:
ULTIMA: ULTIMA1: Fix action ordering for dungeon monster attacks

Changed paths:
    engines/ultima/ultima1/logic/dungeon_logic.cpp
    engines/ultima/ultima1/logic/dungeon_logic.h


diff --git a/engines/ultima/ultima1/logic/dungeon_logic.cpp b/engines/ultima/ultima1/logic/dungeon_logic.cpp
index 229ec1e4914..43f84aa92bf 100644
--- a/engines/ultima/ultima1/logic/dungeon_logic.cpp
+++ b/engines/ultima/ultima1/logic/dungeon_logic.cpp
@@ -382,6 +382,12 @@ bool DungeonLogic::inform() {
 }
 
 void DungeonLogic::updateCreatures() {
+	// The view is updated after the monsters have acted
+	moveCreatures();
+	showNearbyText();
+}
+
+void DungeonLogic::moveCreatures() {
 	Data::Savegame &sg = _G(savegame);
 	Data::MapDungeon &dungeon = _G(dungeon);
 	const Common::Point &pos = sg._locationPosition;
@@ -590,13 +596,6 @@ void DungeonLogic::showNearbyText() {
 	}
 }
 
-void DungeonLogic::endOfTurn() {
-	showNearbyText();
-
-	// Calls updateCreatures() in turn
-	Logic::endOfTurn();
-}
-
 int DungeonLogic::getMonsterDistance(int maxDistance) const {
 	int deltaX = getDirDeltaX();
 	int deltaY = getDirDeltaY();
diff --git a/engines/ultima/ultima1/logic/dungeon_logic.h b/engines/ultima/ultima1/logic/dungeon_logic.h
index fa72f466544..7d4142cd3f6 100644
--- a/engines/ultima/ultima1/logic/dungeon_logic.h
+++ b/engines/ultima/ultima1/logic/dungeon_logic.h
@@ -79,6 +79,11 @@ private:
 	 */
 	void showNearbyText();
 
+	/**
+	 * Gives each monster its turn to attack the player or step closer
+	 */
+	void moveCreatures();
+
 	/**
 	 * Get the distance to the closest monster, if any, in front of the player
 	 */
@@ -189,15 +194,10 @@ protected:
 	bool inform() override;
 
 	/**
-	 * Handles updating creatures/NPCs
+	 * Handles updating creatures/NPCs, then announcing what's in view
 	 */
 	void updateCreatures() override;
 
-	/**
-	 * Called after an action is done
-	 */
-	void endOfTurn() override;
-
 public:
 	DungeonLogic();
 	~DungeonLogic() override {


Commit: 75af50357559f470c94fe7a4dc61c03856c106d9
    https://github.com/scummvm/scummvm/commit/75af50357559f470c94fe7a4dc61c03856c106d9
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:41:06+11:00

Commit Message:
ULTIMA: ULTIMA1: Handle newlines for lines fitting width exactly

The font drawing automatically scrolls when a line is filled, so
it was resulting in a blank line due to \n scrolling a 2nd time

Changed paths:
    engines/ultima/ultima1/views/commands.cpp
    engines/ultima/ultima1/views/commands.h


diff --git a/engines/ultima/ultima1/views/commands.cpp b/engines/ultima/ultima1/views/commands.cpp
index 5567ce2a8e7..80b55b7d04c 100644
--- a/engines/ultima/ultima1/views/commands.cpp
+++ b/engines/ultima/ultima1/views/commands.cpp
@@ -74,19 +74,37 @@ bool Commands::msgGame(const GameMessage &msg) {
 void Commands::writeString(const Common::String &msg) {
 	_textCursor.hide();
 
-	// Text starting a line is indented a column, lining up with the command
-	// text that follows the '>' prompt. The prompt glyph itself stays in column 0
-	Common::String text;
-	bool lineStart = _surface.getTextPos().x == 0;
-	for (uint i = 0; i < msg.size(); ++i) {
-		if (lineStart && msg[i] != '\n' && msg[i] != '\x10')
-			text += ' ';
+	Common::String line;
+	auto flush = [&]() {
+		if (line.empty())
+			return;
+
+		// Text starting a line is indented a column, lining up with the command
+		// text that follows the '>' prompt. The prompt glyph itself stays in column 0
+		if (_surface.getTextPos().x == 0 && line[0] != '\x10')
+			line = " " + line;
 
-		text += msg[i];
-		lineStart = msg[i] == '\n';
+		_surface.writeString(line);
+		_lineWrapped = _surface.getTextPos().x == 0;
+		line.clear();
+	};
+
+	for (uint i = 0; i < msg.size(); ++i) {
+		if (msg[i] != '\n') {
+			line += msg[i];
+			continue;
+		}
+
+		flush();
+
+		// Text that exactly filled the line has already moved to the next one
+		if (_lineWrapped)
+			_lineWrapped = false;
+		else
+			_surface.writeString("\n");
 	}
 
-	_surface.writeString(text);
+	flush();
 
 	if (msg.contains('\n')) {
 		delay(NEWLINE_DELAY);
@@ -96,6 +114,7 @@ void Commands::writeString(const Common::String &msg) {
 void Commands::resetLine() {
 	_surface.fillRect(Graphics::Views::TextRect(0, 4, 29, 4), 0);	// Clear entire bottom row
 	_surface.setTextPos(Common::Point(0, 4));
+	_lineWrapped = false;
 }
 
 void Commands::showCursor() {
diff --git a/engines/ultima/ultima1/views/commands.h b/engines/ultima/ultima1/views/commands.h
index fb9798bace9..c988dacf1a6 100644
--- a/engines/ultima/ultima1/views/commands.h
+++ b/engines/ultima/ultima1/views/commands.h
@@ -35,6 +35,7 @@ class Commands : public Graphics::Views::UIElement {
 private:
 	Graphics::Views::GfxSurface _surface;
 	Gfx::TextCursor _textCursor;
+	bool _lineWrapped = false;		// Text filled the line, leaving the cursor at the start of the next
 
 	/**
 	 * Ensures the commands view is updated on-screen, and then delays for a set amount.


Commit: 3c02cb019ee68c4c284fc95877fa94fd7f8141db
    https://github.com/scummvm/scummvm/commit/3c02cb019ee68c4c284fc95877fa94fd7f8141db
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:41:06+11:00

Commit Message:
ULTIMA: ULTIMA1: Fix original loot bug when purse is full

Changed paths:
    engines/ultima/ultima1/logic/logic.cpp


diff --git a/engines/ultima/ultima1/logic/logic.cpp b/engines/ultima/ultima1/logic/logic.cpp
index 38bf42fd980..fedb96bf895 100644
--- a/engines/ultima/ultima1/logic/logic.cpp
+++ b/engines/ultima/ultima1/logic/logic.cpp
@@ -72,9 +72,6 @@ void Logic::giveTreasure(int coins, int nameLen) {
 	if (sg._coins + coins > 9999)
 		coins = 9999 - sg._coins;
 
-	if (coins == 0)
-		return;
-
 	// Whether the next amount shown ends its line
 	bool endLine;
 	if (nameLen == 0) {
@@ -87,6 +84,13 @@ void Logic::giveTreasure(int coins, int nameLen) {
 		endLine = true;
 	}
 
+	// A full purse leaves nothing to give. The original prints nothing at all
+	// here, which leaves the line unfinished
+	if (coins == 0) {
+		writeString("nothing\n");
+		return;
+	}
+
 	int copper = coins % 10;
 	int silver = (coins % 100 - copper) / 10;
 	int gold = coins / 1000;


Commit: c612d44b5496c43d0d98af4591db6ed662419a30
    https://github.com/scummvm/scummvm/commit/c612d44b5496c43d0d98af4591db6ed662419a30
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:41:06+11:00

Commit Message:
ULTIMA: ULTIMA1: Increase delay for lines in the commands area

Changed paths:
    engines/ultima/ultima1/logic/dungeon_logic.cpp
    engines/ultima/ultima1/views/commands.cpp
    engines/ultima/ultima2/views/commands.cpp


diff --git a/engines/ultima/ultima1/logic/dungeon_logic.cpp b/engines/ultima/ultima1/logic/dungeon_logic.cpp
index 43f84aa92bf..2ed692325f3 100644
--- a/engines/ultima/ultima1/logic/dungeon_logic.cpp
+++ b/engines/ultima/ultima1/logic/dungeon_logic.cpp
@@ -148,15 +148,13 @@ void DungeonLogic::moveForward() {
 	int deltaX = getDirDeltaX();
 	int deltaY = getDirDeltaY();
 
-	writeString("Forward");
-
 	if (isBlocked(deltaX, deltaY)) {
+		writeString("Forward - path blocked!\n");
 		playFX(0);
-		writeString(" - path blocked!\n");
 	} else {
+		writeString("Forward\n");
 		_G(savegame)._locationPosition.x += deltaX;
 		_G(savegame)._locationPosition.y += deltaY;
-		writeString("\n");
 	}
 }
 
diff --git a/engines/ultima/ultima1/views/commands.cpp b/engines/ultima/ultima1/views/commands.cpp
index 80b55b7d04c..27577994f46 100644
--- a/engines/ultima/ultima1/views/commands.cpp
+++ b/engines/ultima/ultima1/views/commands.cpp
@@ -27,7 +27,8 @@ namespace Ultima {
 namespace Ultima1 {
 namespace Views {
 
-constexpr int NEWLINE_DELAY = 50;	// Delay after a newline
+constexpr int NEWLINE_DELAY_LONG = 500;
+constexpr int NEWLINE_DELAY_SHORT = 50;
 
 Commands::Commands(UIElement *parent) : Graphics::Views::UIElement("Commands", parent), _textCursor("CommandsCursor", this) {
 }
@@ -72,6 +73,9 @@ bool Commands::msgGame(const GameMessage &msg) {
 }
 
 void Commands::writeString(const Common::String &msg) {
+	// We only want short delays when printing movement actions on the map
+	bool isShort = _surface.getTextPos().x == 1 && msg.hasSuffix("\n");
+
 	_textCursor.hide();
 
 	Common::String line;
@@ -106,9 +110,10 @@ void Commands::writeString(const Common::String &msg) {
 
 	flush();
 
-	if (msg.contains('\n')) {
-		delay(NEWLINE_DELAY);
-	}
+	// Delay after each line. For short lines, like movement east/west/etc. keep it short,
+	// but for longer lines have a more substantial delay to allow time for reading
+	if (msg.contains('\n'))
+		delay(isShort ? NEWLINE_DELAY_SHORT : NEWLINE_DELAY_LONG);
 }
 
 void Commands::resetLine() {
@@ -142,7 +147,7 @@ void Commands::space2() {
 
 void Commands::delay(uint milli) {
 	g_engine->updateScreen();
-	g_engine->pauseMillis(NEWLINE_DELAY);
+	g_engine->pauseMillis(milli);
 }
 
 } // namespace Views
diff --git a/engines/ultima/ultima2/views/commands.cpp b/engines/ultima/ultima2/views/commands.cpp
index a207bd774f3..3b07dbce344 100644
--- a/engines/ultima/ultima2/views/commands.cpp
+++ b/engines/ultima/ultima2/views/commands.cpp
@@ -29,7 +29,8 @@ namespace Ultima2 {
 namespace Views {
 
 constexpr int COLOR_TEXT = 3; // white, within the game's 4-color CGA palette
-constexpr int NEWLINE_DELAY = 50;
+constexpr int NEWLINE_DELAY_LONG = 500;
+constexpr int NEWLINE_DELAY_SHORT = 50;
 constexpr int PROMPT_ROW = 3; // last of the 4 rows within Commands' own bounds
 constexpr int PROMPT_ABSOLUTE_ROW = 23;
 
@@ -68,12 +69,17 @@ bool Commands::msgGame(const GameMessage &msg) {
 }
 
 void Commands::writeString(const Common::String &msg) {
+	// We only want short delays when printing movement actions on the map
+	bool isShort = _surface.getTextPos().x == 1 && msg.hasSuffix("\n");
+
 	_textCursor.hide();
 	_surface.setColor(Gfx::textColor(Gfx::TEXT_NORMAL));
 	_surface.writeString(msg);
 
+	// Delay after each line. For short lines, like movement east/west/etc. keep it short,
+	// but for longer lines have a more substantial delay to allow time for reading
 	if (msg.contains('\n'))
-		delay(NEWLINE_DELAY);
+		delay(isShort ? NEWLINE_DELAY_SHORT : NEWLINE_DELAY_LONG);
 }
 
 void Commands::resetLine() {


Commit: e4680d89ef48e3449251c427a6729ed743c3e1f3
    https://github.com/scummvm/scummvm/commit/e4680d89ef48e3449251c427a6729ed743c3e1f3
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:41:06+11:00

Commit Message:
ULTIMA: ULTIMA1: Fix dungeon random number generator

Changed paths:
    engines/ultima/ultima1/data/map_dungeon.cpp


diff --git a/engines/ultima/ultima1/data/map_dungeon.cpp b/engines/ultima/ultima1/data/map_dungeon.cpp
index 6dc77f621f2..b3a219111cb 100644
--- a/engines/ultima/ultima1/data/map_dungeon.cpp
+++ b/engines/ultima/ultima1/data/map_dungeon.cpp
@@ -55,6 +55,7 @@ void MapDungeon::setRandomSeed() {
 
 byte MapDungeon::getRandomNumber(int minVal, int maxVal) {
 	// Rotate the seed right by 3 bits after adding a fixed value
+	_randomSeed = (uint16)(_randomSeed + 0x9248);
 	uint16 low3 = _randomSeed & 7;
 	_randomSeed = (uint16)(_randomSeed >> 3) | (uint16)(low3 << 13);
 


Commit: 12714f5f309b20075b740e507d60a5003e61b0f1
    https://github.com/scummvm/scummvm/commit/12714f5f309b20075b740e507d60a5003e61b0f1
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:41:06+11:00

Commit Message:
ULTIMA: ULTIMA1: Don't set transports array in console inventory cmd

Changed paths:
    engines/ultima/ultima1/console.cpp


diff --git a/engines/ultima/ultima1/console.cpp b/engines/ultima/ultima1/console.cpp
index c9e4e003d4b..323bed56670 100644
--- a/engines/ultima/ultima1/console.cpp
+++ b/engines/ultima/ultima1/console.cpp
@@ -151,8 +151,6 @@ bool Console::cmdInventory(int argc, const char **argv) {
 		sg._weapons[i] = 9;
 	for (int i = 1; i < Data::SPELL_COUNT; ++i)
 		sg._spells[i] = 99;
-	for (int i = 1; i < Data::TRANSPORT_COUNT; ++i)
-		sg._transports[i] = 9;
 
 	sg._redGems = sg._greenGems = sg._blueGem = sg._whiteGem = 1;
 	sg._hits = sg._food = sg._coins = 9999;


Commit: 2b20fb178f64fdc09b4d85e2cbfd5503bde54b6d
    https://github.com/scummvm/scummvm/commit/2b20fb178f64fdc09b4d85e2cbfd5503bde54b6d
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:41:06+11:00

Commit Message:
ULTIMA: ULTIMA1: Merge _moveCtr global into savegame _moveCount field

Changed paths:
    engines/ultima/ultima1/logic/logic.cpp
    engines/ultima/ultima1/ultima1.cpp
    engines/ultima/ultima1/ultima1.h
    engines/ultima/ultima1/views/interactions/merchant.cpp


diff --git a/engines/ultima/ultima1/logic/logic.cpp b/engines/ultima/ultima1/logic/logic.cpp
index fedb96bf895..76f20ff5271 100644
--- a/engines/ultima/ultima1/logic/logic.cpp
+++ b/engines/ultima/ultima1/logic/logic.cpp
@@ -132,7 +132,7 @@ int Logic::getRandomNumber(int maxNumber) {
 }
 
 void Logic::endOfTurn() {
-	_G(moveCtr)++;
+	_G(savegame)._moveCount++;
 	updateCreatures();
 
 	redrawMap();
diff --git a/engines/ultima/ultima1/ultima1.cpp b/engines/ultima/ultima1/ultima1.cpp
index 76522241833..feaf40a4e94 100644
--- a/engines/ultima/ultima1/ultima1.cpp
+++ b/engines/ultima/ultima1/ultima1.cpp
@@ -105,9 +105,6 @@ bool Ultima1Engine::canLoadGameStateCurrently(Common::U32String *msg) {
 }
 
 Common::Error Ultima1Engine::syncGame(Common::Serializer &s) {
-	if (s.isSaving())
-		_G(savegame)._moveCount = _moveCtr;
-
 	_savegame.synchronize(s);
 
 	if (s.isLoading()) {
diff --git a/engines/ultima/ultima1/ultima1.h b/engines/ultima/ultima1/ultima1.h
index 81d086883d3..cae8bfd3d89 100644
--- a/engines/ultima/ultima1/ultima1.h
+++ b/engines/ultima/ultima1/ultima1.h
@@ -90,7 +90,6 @@ public:
 	Data::Savegame _savegame;
 	Common::SharedPtr<Logic::Logic> _logic;
 	int _creaturesCount = 0;
-	uint32 _moveCtr = 0;
 	int _transportFoodCtr = 0;
 	// The flight speed set while in the cockpit view (the overhead vs
 	// cockpit distinction is carried by which SpaceLogic subclass is active)
diff --git a/engines/ultima/ultima1/views/interactions/merchant.cpp b/engines/ultima/ultima1/views/interactions/merchant.cpp
index cf4ea8662b4..5308f652afa 100644
--- a/engines/ultima/ultima1/views/interactions/merchant.cpp
+++ b/engines/ultima/ultima1/views/interactions/merchant.cpp
@@ -430,7 +430,7 @@ void Merchant::chooseBuy() {
 			_transportIds[2] = Data::TRANSPORT_RAFT;
 			_transportIds[3] = Data::TRANSPORT_FRIGATE;
 		}
-		if (_G(moveCtr) > 3000) {
+		if (_G(savegame)._moveCount > 3000) {
 			if (_G(map)._grassCount && !fleetFull)
 				_transportIds[4] = Data::TRANSPORT_AIRCAR;
 			if (sg._transports[Data::TRANSPORT_SHUTTLE] == 0)
@@ -512,7 +512,7 @@ void Merchant::chooseSell() {
 }
 
 void Merchant::drawArmoryBuy() {
-	int maxIdx = (_G(moveCtr) > 3000) ? 5 : 3;
+	int maxIdx = (_G(savegame)._moveCount > 3000) ? 5 : 3;
 	for (int idx = 1; idx <= maxIdx; ++idx) {
 		int price = ((200 - _G(savegame)._intelligence) / 4) * idx;
 		drawShopLine(listY() + idx, 9, 26, idx, Data::ARMOR_NAMES[idx], price, 3);
@@ -520,7 +520,7 @@ void Merchant::drawArmoryBuy() {
 }
 
 void Merchant::armoryBuyKeypress(Common::KeyCode keycode) {
-	int maxIdx = (_G(moveCtr) > 3000) ? 5 : 3;
+	int maxIdx = (_G(savegame)._moveCount > 3000) ? 5 : 3;
 	int idx = keycode - Common::KEYCODE_a;
 
 	if (idx < 1 || idx > maxIdx) {
@@ -579,9 +579,9 @@ void Merchant::weaponsRange(int &minIdx, int &maxIdx) const {
 
 	// The stock widens as the game goes on: one more weapon offered per 1500
 	// moves, up to a cap of 3 extra tiers (then a 4th once past 3000 moves).
-	// The original takes moveCtr % 0x7FFF before the /1500, but with the
+	// The original takes the savegame _moveCount % 0x7FFF before the /1500, but with the
 	// > 3000 branch forcing tier 3 that modulo never changes the result
-	uint32 moveCtr = _G(moveCtr);
+	uint32 moveCtr = _G(savegame)._moveCount;
 	int tier = (moveCtr <= 3000) ? MIN<uint32>((moveCtr % 0x7FFF) / 1500, 3) : 3;
 
 	minIdx = base;


Commit: a3478865e38cdf084063893beb6d9dfe39eaddbd
    https://github.com/scummvm/scummvm/commit/a3478865e38cdf084063893beb6d9dfe39eaddbd
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:41:06+11:00

Commit Message:
ULTIMA: ULTIMA1: Keep space dead view on screen for 5 seconds

Changed paths:
    engines/ultima/ultima1/views/interactions/dead.cpp
    engines/ultima/ultima1/views/interactions/dead.h
    engines/ultima/ultima1/views/main_menu.cpp


diff --git a/engines/ultima/ultima1/views/interactions/dead.cpp b/engines/ultima/ultima1/views/interactions/dead.cpp
index 6b800d9d82c..9cde1f27497 100644
--- a/engines/ultima/ultima1/views/interactions/dead.cpp
+++ b/engines/ultima/ultima1/views/interactions/dead.cpp
@@ -263,11 +263,6 @@ void Dead::finish() {
 
 bool SpaceDead::msgFocus(const FocusMessage &msg) {
 	setBounds(Common::Rect(8, 8, 312, 152));
-
-	g_engine->playFX(2);
-	g_engine->playFX(2);
-	g_engine->playFX(2);
-
 	return true;
 }
 
@@ -275,16 +270,15 @@ void SpaceDead::draw() {
 	auto s = getSurface();
 	s.clear();
 	drawSkullGraphic(s);
-}
 
-bool SpaceDead::msgAction(const ActionMessage &msg) {
-	g_engine->replaceView("MainMenu", true);
-	return true;
+	delaySeconds(5);
+	g_engine->playFX(2);
+	g_engine->playFX(2);
+	g_engine->playFX(2);
 }
 
-bool SpaceDead::msgKeypress(const KeypressMessage &msg) {
+void SpaceDead::timeout() {
 	g_engine->replaceView("MainMenu", true);
-	return true;
 }
 
 } // namespace Interactions
diff --git a/engines/ultima/ultima1/views/interactions/dead.h b/engines/ultima/ultima1/views/interactions/dead.h
index 2122fe9016a..d3da18b2b46 100644
--- a/engines/ultima/ultima1/views/interactions/dead.h
+++ b/engines/ultima/ultima1/views/interactions/dead.h
@@ -115,9 +115,8 @@ public:
 	}
 
 	bool msgFocus(const FocusMessage &msg) override;
-	bool msgAction(const ActionMessage &msg) override;
-	bool msgKeypress(const KeypressMessage &msg) override;
 	void draw() override;
+	void timeout() override;
 };
 
 } // namespace Interactions
diff --git a/engines/ultima/ultima1/views/main_menu.cpp b/engines/ultima/ultima1/views/main_menu.cpp
index c6cdc57b3c8..9849f005243 100644
--- a/engines/ultima/ultima1/views/main_menu.cpp
+++ b/engines/ultima/ultima1/views/main_menu.cpp
@@ -31,6 +31,7 @@ namespace Views {
 MainMenu::MainMenu() : FullScreenDialog("MainMenu"), _cursor("Cursor", this) {
 	// Position the cursor right after "Thy choice: "
 	_cursor.setPosition(Common::Point(25, 18));
+	_cursor.show();
 }
 
 void MainMenu::draw() {


Commit: 1efe8192b72b2b4350318194a1cc7aa391c43339
    https://github.com/scummvm/scummvm/commit/1efe8192b72b2b4350318194a1cc7aa391c43339
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:41:07+11:00

Commit Message:
ULTIMA: ULTIMA1: Fixes for landing shuttle

Changed paths:
    engines/ultima/ultima1/logic/overworld_logic.cpp
    engines/ultima/ultima1/logic/space_map_logic.cpp


diff --git a/engines/ultima/ultima1/logic/overworld_logic.cpp b/engines/ultima/ultima1/logic/overworld_logic.cpp
index 308e66b034b..cf3ac9d3465 100644
--- a/engines/ultima/ultima1/logic/overworld_logic.cpp
+++ b/engines/ultima/ultima1/logic/overworld_logic.cpp
@@ -44,7 +44,9 @@ static const char *IMPASSABLE_REASONS[] = {
 	"Mountains are impassable!",
 	"Aircars can't pass woods!",
 	"Frigates like water!",
-	"Rafts like water!"
+	"Rafts like water!",
+	"Blocked by a",
+	"Can't move on land!"
 };
 
 static const int8 DELTA_X[5] = { 0, -1, 1, 0, 0 };
diff --git a/engines/ultima/ultima1/logic/space_map_logic.cpp b/engines/ultima/ultima1/logic/space_map_logic.cpp
index ec7c55cfc4c..6a7da91f9bb 100644
--- a/engines/ultima/ultima1/logic/space_map_logic.cpp
+++ b/engines/ultima/ultima1/logic/space_map_logic.cpp
@@ -35,6 +35,11 @@ constexpr int MAX_DRIFT = 9;
 // hazard is fatal (checkStarProximity)
 constexpr int STAR_DEATH_RANGE = 25;
 
+// Touching anything within this range (on both axes) of the station's docking
+// bay entrance lands the ship back on the planet - or destroys it, if it isn't
+// a shuttle
+constexpr int LANDING_RANGE = 25;
+
 // Rotating Left/Right cycles the ship's facing a quarter-turn counter-
 // clockwise/clockwise (word_17EA2), indexed by the ship's current facing
 constexpr Data::SpaceShipFacing ROTATE_CCW[4] = {
@@ -209,6 +214,32 @@ void SpaceMapLogic::tick() {
 					SHIP_COLLISION_WIDTH, SHIP_COLLISION_HEIGHT);
 		}
 
+		if (crunch && isStationSector && ABS(newX - Data::SPACE_STATION_SCREEN_X) < LANDING_RANGE &&
+				ABS(newY - Data::SPACE_STATION_SCREEN_Y) < LANDING_RANGE) {
+			_G(sectorDriftX) = 0;
+			_G(sectorDriftY) = 0;
+			_G(shipExhaustCountdown) = 0;
+
+			if (ship._shipType == Data::SHIP_SHUTTLE) {
+				writeString("Thou hast landed safely!\n");
+				_G(savegame)._shipFuel = ship._fuel;
+				_G(savegame)._shipShield = ship._shield;
+
+				// This logic is replaced by loading the overworld, so nothing
+				// of it can be used afterwards
+				prompt();
+				_G(map).load(Data::MAP_OVERWORLD);
+			} else {
+				writeString("Only space shuttles are heat\n");
+				writeString("shielded for landings!\n");
+				ship._fuel = ship._shield = 0;
+				_G(savegame)._shipFuel = _G(savegame)._shipShield = 0;
+				death();
+			}
+
+			return;
+		}
+
 		if (crunch) {
 			// Revert - stay where we were before this frame's drift
 			ship._x = (int16)oldX;


Commit: e0bd3819860b1e9f700d66f5c728934101644b79
    https://github.com/scummvm/scummvm/commit/e0bd3819860b1e9f700d66f5c728934101644b79
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:41:07+11:00

Commit Message:
ULTIMA: ULTIMA1: Spaceship collision fixes

Changed paths:
    engines/ultima/ultima1/data/space_map.cpp
    engines/ultima/ultima1/data/space_map.h
    engines/ultima/ultima1/logic/space_map_logic.cpp
    engines/ultima/ultima1/views/space_map.cpp


diff --git a/engines/ultima/ultima1/data/space_map.cpp b/engines/ultima/ultima1/data/space_map.cpp
index 657e57490a2..90ff5beabe5 100644
--- a/engines/ultima/ultima1/data/space_map.cpp
+++ b/engines/ultima/ultima1/data/space_map.cpp
@@ -27,6 +27,79 @@ namespace Ultima {
 namespace Ultima1 {
 namespace Data {
 
+// Star/heat hazard bitmap (18 rows x 19 cols), matching SPACE.EXE's own raw
+// table for drawStarGraphic. 1 -> _G(colors)._star1, 2 -> _G(colors)._star2
+const int8 SPACE_STAR_BITMAP[SPACE_STAR_HEIGHT][SPACE_STAR_WIDTH] = {
+	{ 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0 },
+	{ 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0 },
+	{ 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0 },
+	{ 0, 0, 1, 1, 0, 0, 0, 1, 1, 0, 1, 1, 0, 0, 0, 1, 1, 0, 0 },
+	{ 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0 },
+	{ 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0 },
+	{ 1, 1, 0, 0, 0, 0, 0, 0, 2, 2, 2, 0, 0, 0, 0, 0, 0, 1, 1 },
+	{ 0, 0, 1, 1, 0, 0, 2, 2, 2, 2, 2, 2, 2, 0, 0, 1, 1, 0, 0 },
+	{ 0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0 },
+	{ 0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0 },
+	{ 0, 0, 1, 1, 0, 0, 2, 2, 2, 2, 2, 2, 2, 0, 0, 1, 1, 0, 0 },
+	{ 1, 1, 0, 0, 0, 0, 0, 0, 2, 2, 2, 0, 0, 0, 0, 0, 0, 1, 1 },
+	{ 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0 },
+	{ 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0 },
+	{ 0, 0, 1, 1, 0, 0, 0, 1, 1, 0, 1, 1, 0, 0, 0, 1, 1, 0, 0 },
+	{ 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0 },
+	{ 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0 },
+	{ 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0 },
+};
+
+// Docking/encounter anchor bitmap (20 rows x 20 cols), matching SPACE.EXE's
+// own raw table for drawPlanetGraphic. Any nonzero value -> _G(colors)._edge
+const int8 SPACE_PLANET_BITMAP[SPACE_PLANET_HEIGHT][SPACE_PLANET_WIDTH] = {
+	{ 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0 },
+	{ 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0 },
+	{ 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0 },
+	{ 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0 },
+	{ 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0 },
+	{ 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0 },
+	{ 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0 },
+	{ 1, 1, 1, 0, 1, 1, 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 0, 1, 1, 1 },
+	{ 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1 },
+	{ 0, 0, 1, 1, 0, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 1, 1, 0, 0 },
+	{ 0, 0, 1, 1, 0, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 1, 1, 0, 0 },
+	{ 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1 },
+	{ 1, 1, 1, 0, 1, 1, 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 0, 1, 1, 1 },
+	{ 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0 },
+	{ 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0 },
+	{ 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0 },
+	{ 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0 },
+	{ 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0 },
+	{ 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0 },
+	{ 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0 },
+};
+
+// Space station bitmap (18 rows x 21 cols), matching SPACE.EXE's own raw
+// table for drawStationGraphic. 1/2 -> _G(colors)._stationHighlight,
+// 4 -> _G(colors)._stationEdge, 3 -> _G(colors)._stationBorder
+const int8 SPACE_STATION_BITMAP[SPACE_STATION_HEIGHT][SPACE_STATION_WIDTH] = {
+	{ 0, 0, 0, 0, 0, 0, 0, 0, 4, 4, 4, 4, 4, 0, 0, 0, 0, 0, 0, 0, 0 },
+	{ 0, 0, 0, 0, 0, 0, 4, 1, 1, 1, 1, 1, 1, 1, 4, 0, 0, 0, 0, 0, 0 },
+	{ 0, 0, 0, 0, 4, 1, 1, 1, 2, 3, 2, 3, 2, 3, 1, 1, 4, 0, 0, 0, 0 },
+	{ 0, 0, 0, 4, 1, 1, 2, 3, 2, 2, 2, 3, 2, 3, 2, 1, 1, 4, 0, 0, 0 },
+	{ 0, 0, 4, 1, 1, 3, 2, 2, 2, 2, 2, 3, 2, 3, 2, 2, 1, 1, 4, 0, 0 },
+	{ 0, 4, 1, 1, 3, 3, 2, 2, 2, 2, 2, 3, 2, 2, 2, 3, 2, 1, 1, 4, 0 },
+	{ 0, 4, 1, 1, 3, 3, 3, 2, 2, 3, 3, 3, 2, 3, 3, 3, 3, 1, 1, 4, 0 },
+	{ 4, 1, 1, 2, 3, 2, 2, 2, 2, 3, 3, 3, 3, 2, 3, 3, 3, 2, 1, 1, 4 },
+	{ 4, 1, 1, 1, 3, 2, 2, 3, 2, 2, 3, 3, 3, 3, 3, 3, 2, 2, 1, 1, 4 },
+	{ 4, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 2, 3, 2, 2, 1, 1, 4 },
+	{ 4, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 2, 2, 2, 2, 1, 1, 4 },
+	{ 0, 4, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 3, 2, 2, 2, 2, 1, 1, 4, 0 },
+	{ 0, 4, 1, 1, 2, 2, 2, 2, 2, 3, 3, 3, 2, 2, 2, 2, 2, 1, 1, 4, 0 },
+	{ 0, 0, 4, 1, 1, 2, 2, 3, 2, 3, 3, 3, 3, 2, 2, 2, 1, 1, 4, 0, 0 },
+	{ 0, 0, 0, 4, 1, 1, 2, 3, 2, 3, 2, 3, 2, 2, 2, 1, 1, 4, 0, 0, 0 },
+	{ 0, 0, 0, 0, 4, 1, 1, 1, 2, 3, 2, 3, 2, 1, 1, 1, 4, 0, 0, 0, 0 },
+	{ 0, 0, 0, 0, 0, 0, 4, 1, 1, 1, 1, 1, 1, 1, 4, 0, 0, 0, 0, 0, 0 },
+	{ 0, 0, 0, 0, 0, 0, 0, 0, 4, 4, 4, 4, 4, 0, 0, 0, 0, 0, 0, 0, 0 },
+};
+
+
 const char *SPACE_COCKPIT_DIRECTION_NAMES[5] = { nullptr, "Left", "Right", "Climb", "Dive" };
 
 const int SPACE_COCKPIT_FRAME_DELAY[SPACE_COCKPIT_MAX_SPEED + 1] = { 0, 8, 7, 6, 5, 4, 3, 2, 1 };
diff --git a/engines/ultima/ultima1/data/space_map.h b/engines/ultima/ultima1/data/space_map.h
index 4ca97d9dd59..6719224f6fb 100644
--- a/engines/ultima/ultima1/data/space_map.h
+++ b/engines/ultima/ultima1/data/space_map.h
@@ -57,6 +57,15 @@ constexpr int SPACE_SECTOR_WRAP_HEIGHT = SPACE_SECTOR_MAX_Y - SPACE_SECTOR_MIN_Y
 constexpr int SPACE_STATION_SCREEN_X = 60, SPACE_STATION_SCREEN_Y = 75;
 constexpr int SPACE_STATION_WIDTH = 21, SPACE_STATION_HEIGHT = 18;
 
+// The star/heat hazard and docking/encounter anchor bitmaps' dimensions, and
+// the raw bitmaps of all three sector graphics (row-major, 0 is transparent).
+// The collision checks need the same pixels the overhead view draws
+constexpr int SPACE_STAR_WIDTH = 19, SPACE_STAR_HEIGHT = 18;
+constexpr int SPACE_PLANET_WIDTH = 20, SPACE_PLANET_HEIGHT = 20;
+extern const int8 SPACE_STAR_BITMAP[SPACE_STAR_HEIGHT][SPACE_STAR_WIDTH];
+extern const int8 SPACE_PLANET_BITMAP[SPACE_PLANET_HEIGHT][SPACE_PLANET_WIDTH];
+extern const int8 SPACE_STATION_BITMAP[SPACE_STATION_HEIGHT][SPACE_STATION_WIDTH];
+
 // Direction names shown in the cockpit view, indexed by Data::Direction
 // (1-4): the arrow keys read as Left / Right / Climb / Dive rather than the
 // overhead view's West / East / North / South
diff --git a/engines/ultima/ultima1/logic/space_map_logic.cpp b/engines/ultima/ultima1/logic/space_map_logic.cpp
index 6a7da91f9bb..36f4c737557 100644
--- a/engines/ultima/ultima1/logic/space_map_logic.cpp
+++ b/engines/ultima/ultima1/logic/space_map_logic.cpp
@@ -57,25 +57,75 @@ static int wrapCoord(int value, int minVal, int maxVal, int wrapSize) {
 	return value;
 }
 
-// The ship tile is a 32x19 canvas, but most of that is blank padding left
-// over from the original's byte-alignment pre-shift copies (see
-// loadShipTiles) - the actual ship silhouette drawn within it is much
-// smaller. Using the full tile as the collision box was triggering "Crunch!"
-// roughly a whole ship-width before the ship visually touched anything, so
-// use a smaller, roughly-centred box instead
-constexpr int SHIP_COLLISION_WIDTH = 16;
-constexpr int SHIP_COLLISION_HEIGHT = 10;
-constexpr int SHIP_COLLISION_OFFSET_X = (Data::SPACE_SHIP_TILE_WIDTH - SHIP_COLLISION_WIDTH) / 2;
-constexpr int SHIP_COLLISION_OFFSET_Y = (Data::SPACE_SHIP_TILE_HEIGHT - SHIP_COLLISION_HEIGHT) / 2;
-
-// True if a ship at (x,y) (its tile's top-left) would overlap the given
-// rect - used to detect running into the station or another ship (the only
-// thing that actually triggers "Crunch!"; the sector edges just wrap)
-static bool overlapsRect(int x, int y, int rx, int ry, int rw, int rh) {
-	x += SHIP_COLLISION_OFFSET_X;
-	y += SHIP_COLLISION_OFFSET_Y;
-	return x < rx + rw && x + SHIP_COLLISION_WIDTH > rx &&
-		y < ry + rh && y + SHIP_COLLISION_HEIGHT > ry;
+// True if the given pixel of a row-major bitmap is set. Positions outside it are not
+static bool bitmapPixel(const int8 *bitmap, int width, int height, int x, int y) {
+	return x >= 0 && x < width && y >= 0 && y < height && bitmap[y * width + x] != 0;
+}
+
+static bool shipTilePixel(const Graphics::ManagedSurface &tile, int x, int y) {
+	return x >= 0 && x < tile.w && y >= 0 && y < tile.h && *(const byte *)tile.getBasePtr(x, y) != 0;
+}
+
+static const Graphics::ManagedSurface &shipTile(const Data::SpaceMapShip &ship) {
+	return _G(map).spaceShipTiles()[ship._shipType * 4 + ship._facing];
+}
+
+// True if anything other than the given ship is drawn on the given pixel of the
+// sector view: the station, the star, the docking anchor, or another ship
+static bool pixelDrawn(const Data::SpaceMapCell &cell, int shipIndex, bool isStationSector, int px, int py) {
+	if (isStationSector && bitmapPixel(&Data::SPACE_STATION_BITMAP[0][0], Data::SPACE_STATION_WIDTH,
+			Data::SPACE_STATION_HEIGHT, px - Data::SPACE_STATION_SCREEN_X, py - Data::SPACE_STATION_SCREEN_Y))
+		return true;
+
+	if (cell._hazardX != 0 && bitmapPixel(&Data::SPACE_STAR_BITMAP[0][0], Data::SPACE_STAR_WIDTH,
+			Data::SPACE_STAR_HEIGHT, px - cell._hazardX, py - cell._hazardY))
+		return true;
+
+	if (cell._anchorX != 0 && bitmapPixel(&Data::SPACE_PLANET_BITMAP[0][0], Data::SPACE_PLANET_WIDTH,
+			Data::SPACE_PLANET_HEIGHT, px - cell._anchorX, py - cell._anchorY))
+		return true;
+
+	for (int i = 0; i < Data::SPACE_SHIPS_PER_SECTOR; ++i) {
+		const Data::SpaceMapShip &other = cell._ships[i];
+		if (i == shipIndex || other._shipType == Data::SHIP_NONE)
+			continue;
+
+		// A ship drawn across the sector edge has its far part wrapped around
+		for (int wrapX = 0; wrapX <= Data::SPACE_SECTOR_WRAP_WIDTH; wrapX += Data::SPACE_SECTOR_WRAP_WIDTH) {
+			for (int wrapY = 0; wrapY <= Data::SPACE_SECTOR_WRAP_HEIGHT; wrapY += Data::SPACE_SECTOR_WRAP_HEIGHT) {
+				if (shipTilePixel(shipTile(other), px + wrapX - other._x, py + wrapY - other._y))
+					return true;
+			}
+		}
+	}
+
+	return false;
+}
+
+// True if the player's ship, were it at (x,y), would have any of its pixels
+// land on something already drawn in the sector. This is the only thing that
+// triggers a collision; the sector edges just wrap
+static bool shipCollides(const Data::SpaceMapCell &cell, int shipIndex, bool isStationSector, int x, int y) {
+	const Graphics::ManagedSurface &tile = shipTile(cell._ships[shipIndex]);
+
+	for (int row = 0; row < tile.h; ++row) {
+		for (int col = 0; col < tile.w; ++col) {
+			if (!shipTilePixel(tile, col, row))
+				continue;
+
+			// The part of the ship past the sector edge is drawn wrapped
+			int px = x + col, py = y + row;
+			if (px >= Data::SPACE_SECTOR_MAX_X)
+				px = Data::SPACE_SECTOR_MIN_X + px - Data::SPACE_SECTOR_MAX_X;
+			if (py >= Data::SPACE_SECTOR_MAX_Y)
+				py = Data::SPACE_SECTOR_MIN_Y + py - Data::SPACE_SECTOR_MAX_Y;
+
+			if (pixelDrawn(cell, shipIndex, isStationSector, px, py))
+				return true;
+		}
+	}
+
+	return false;
 }
 
 bool SpaceMapLogic::move(Data::Direction dir) {
@@ -177,22 +227,16 @@ void SpaceMapLogic::tick() {
 		int newX = wrapCoord(ship._x + _G(sectorDriftX), Data::SPACE_SECTOR_MIN_X, Data::SPACE_SECTOR_MAX_X, Data::SPACE_SECTOR_WRAP_WIDTH);
 		int newY = wrapCoord(ship._y + _G(sectorDriftY), Data::SPACE_SECTOR_MIN_Y, Data::SPACE_SECTOR_MAX_Y, Data::SPACE_SECTOR_WRAP_HEIGHT);
 
-		if (cell._hazardX != 0 && ABS(newX - cell._hazardX) < STAR_DEATH_RANGE && ABS(newY - cell._hazardY) < STAR_DEATH_RANGE) {
-			writeString("Thy ship melts near the star!\n");
-			death();
-			return;
-		}
-
 		int oldX = ship._x, oldY = ship._y;
 		ship._x = (int16)newX;
 		ship._y = (int16)newY;
 
 		bool isStationSector = _G(savegame)._sectorX == Data::SPACE_STATION_X && _G(savegame)._sectorY == Data::SPACE_STATION_Y;
+		bool crunch = shipCollides(cell, _G(savegame)._shipIndex, isStationSector, newX, newY);
 
 		// Coming to rest exactly in one of the station's docking slots (the
-		// right position AND facing, for the ship's own type) docks safely;
-		// anything else that touches the station or another ship is a crunch
-		if (isStationSector && cell.dockedEdge(_G(savegame)._shipIndex) >= 0) {
+		// right position AND facing, for the ship's own type) docks safely
+		if (!crunch && isStationSector && cell.dockedEdge(_G(savegame)._shipIndex) >= 0) {
 			_G(sectorDriftX) = 0;
 			_G(sectorDriftY) = 0;
 			g_engine->addView("SpaceStation");
@@ -200,18 +244,13 @@ void SpaceMapLogic::tick() {
 			return;
 		}
 
-		bool crunch = false;
-		if (isStationSector) {
-			crunch = overlapsRect(newX, newY, Data::SPACE_STATION_SCREEN_X, Data::SPACE_STATION_SCREEN_Y,
-				Data::SPACE_STATION_WIDTH, Data::SPACE_STATION_HEIGHT);
-		}
-		for (int i = 0; !crunch && i < Data::SPACE_SHIPS_PER_SECTOR; ++i) {
-			if (i == _G(savegame)._shipIndex)
-				continue;
-			const Data::SpaceMapShip &other = cell._ships[i];
-			if (other._shipType != Data::SHIP_NONE)
-				crunch = overlapsRect(newX, newY, other._x + SHIP_COLLISION_OFFSET_X, other._y + SHIP_COLLISION_OFFSET_Y,
-					SHIP_COLLISION_WIDTH, SHIP_COLLISION_HEIGHT);
+		// Touching anything within range of the star is fatal, wherever the
+		// ship was touching
+		if (crunch && cell._hazardX != 0 && ABS(newX - cell._hazardX) < STAR_DEATH_RANGE &&
+				ABS(newY - cell._hazardY) < STAR_DEATH_RANGE) {
+			writeString("Thy ship melts near the star!\n");
+			death();
+			return;
 		}
 
 		if (crunch && isStationSector && ABS(newX - Data::SPACE_STATION_SCREEN_X) < LANDING_RANGE &&
diff --git a/engines/ultima/ultima1/views/space_map.cpp b/engines/ultima/ultima1/views/space_map.cpp
index a04b2364165..0feabd7464e 100644
--- a/engines/ultima/ultima1/views/space_map.cpp
+++ b/engines/ultima/ultima1/views/space_map.cpp
@@ -87,78 +87,6 @@ static void drawWrappedTile(Graphics::Views::GfxSurface &s, const Graphics::Mana
 		s.xorBlitFrom(tile, Common::Rect(splitX, splitY, w, h), Common::Point(Data::SPACE_SECTOR_MIN_X, Data::SPACE_SECTOR_MIN_Y));
 }
 
-// Star/heat hazard bitmap (18 rows x 19 cols), matching SPACE.EXE's own raw
-// table for drawStarGraphic. 1 -> _G(colors)._star1, 2 -> _G(colors)._star2
-static const int8 STAR_BITMAP[18][19] = {
-	{ 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0 },
-	{ 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0 },
-	{ 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0 },
-	{ 0, 0, 1, 1, 0, 0, 0, 1, 1, 0, 1, 1, 0, 0, 0, 1, 1, 0, 0 },
-	{ 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0 },
-	{ 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0 },
-	{ 1, 1, 0, 0, 0, 0, 0, 0, 2, 2, 2, 0, 0, 0, 0, 0, 0, 1, 1 },
-	{ 0, 0, 1, 1, 0, 0, 2, 2, 2, 2, 2, 2, 2, 0, 0, 1, 1, 0, 0 },
-	{ 0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0 },
-	{ 0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0 },
-	{ 0, 0, 1, 1, 0, 0, 2, 2, 2, 2, 2, 2, 2, 0, 0, 1, 1, 0, 0 },
-	{ 1, 1, 0, 0, 0, 0, 0, 0, 2, 2, 2, 0, 0, 0, 0, 0, 0, 1, 1 },
-	{ 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0 },
-	{ 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0 },
-	{ 0, 0, 1, 1, 0, 0, 0, 1, 1, 0, 1, 1, 0, 0, 0, 1, 1, 0, 0 },
-	{ 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0 },
-	{ 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0 },
-	{ 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0 },
-};
-
-// Docking/encounter anchor bitmap (20 rows x 20 cols), matching SPACE.EXE's
-// own raw table for drawPlanetGraphic. Any nonzero value -> _G(colors)._edge
-static const int8 PLANET_BITMAP[20][20] = {
-	{ 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0 },
-	{ 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0 },
-	{ 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0 },
-	{ 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0 },
-	{ 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0 },
-	{ 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0 },
-	{ 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0 },
-	{ 1, 1, 1, 0, 1, 1, 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 0, 1, 1, 1 },
-	{ 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1 },
-	{ 0, 0, 1, 1, 0, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 1, 1, 0, 0 },
-	{ 0, 0, 1, 1, 0, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 1, 1, 0, 0 },
-	{ 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1 },
-	{ 1, 1, 1, 0, 1, 1, 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 0, 1, 1, 1 },
-	{ 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0 },
-	{ 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0 },
-	{ 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0 },
-	{ 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0 },
-	{ 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0 },
-	{ 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0 },
-	{ 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0 },
-};
-
-// Space station bitmap (18 rows x 21 cols), matching SPACE.EXE's own raw
-// table for drawStationGraphic. 1/2 -> _G(colors)._stationHighlight,
-// 4 -> _G(colors)._stationEdge, 3 -> _G(colors)._stationBorder
-static const int8 STATION_BITMAP[18][21] = {
-	{ 0, 0, 0, 0, 0, 0, 0, 0, 4, 4, 4, 4, 4, 0, 0, 0, 0, 0, 0, 0, 0 },
-	{ 0, 0, 0, 0, 0, 0, 4, 1, 1, 1, 1, 1, 1, 1, 4, 0, 0, 0, 0, 0, 0 },
-	{ 0, 0, 0, 0, 4, 1, 1, 1, 2, 3, 2, 3, 2, 3, 1, 1, 4, 0, 0, 0, 0 },
-	{ 0, 0, 0, 4, 1, 1, 2, 3, 2, 2, 2, 3, 2, 3, 2, 1, 1, 4, 0, 0, 0 },
-	{ 0, 0, 4, 1, 1, 3, 2, 2, 2, 2, 2, 3, 2, 3, 2, 2, 1, 1, 4, 0, 0 },
-	{ 0, 4, 1, 1, 3, 3, 2, 2, 2, 2, 2, 3, 2, 2, 2, 3, 2, 1, 1, 4, 0 },
-	{ 0, 4, 1, 1, 3, 3, 3, 2, 2, 3, 3, 3, 2, 3, 3, 3, 3, 1, 1, 4, 0 },
-	{ 4, 1, 1, 2, 3, 2, 2, 2, 2, 3, 3, 3, 3, 2, 3, 3, 3, 2, 1, 1, 4 },
-	{ 4, 1, 1, 1, 3, 2, 2, 3, 2, 2, 3, 3, 3, 3, 3, 3, 2, 2, 1, 1, 4 },
-	{ 4, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 2, 3, 2, 2, 1, 1, 4 },
-	{ 4, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 2, 2, 2, 2, 1, 1, 4 },
-	{ 0, 4, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 3, 2, 2, 2, 2, 1, 1, 4, 0 },
-	{ 0, 4, 1, 1, 2, 2, 2, 2, 2, 3, 3, 3, 2, 2, 2, 2, 2, 1, 1, 4, 0 },
-	{ 0, 0, 4, 1, 1, 2, 2, 3, 2, 3, 3, 3, 3, 2, 2, 2, 1, 1, 4, 0, 0 },
-	{ 0, 0, 0, 4, 1, 1, 2, 3, 2, 3, 2, 3, 2, 2, 2, 1, 1, 4, 0, 0, 0 },
-	{ 0, 0, 0, 0, 4, 1, 1, 1, 2, 3, 2, 3, 2, 1, 1, 1, 4, 0, 0, 0, 0 },
-	{ 0, 0, 0, 0, 0, 0, 4, 1, 1, 1, 1, 1, 1, 1, 4, 0, 0, 0, 0, 0, 0 },
-	{ 0, 0, 0, 0, 0, 0, 0, 0, 4, 4, 4, 4, 4, 0, 0, 0, 0, 0, 0, 0, 0 },
-};
-
 bool SpaceMap::msgFocus(const FocusMessage &msg) {
 	MetaEngine::setKeybindingMode(KBMODE_SPACE);
 	return Map::msgFocus(msg);
@@ -213,7 +141,7 @@ void SpaceMap::draw() {
 void SpaceMap::drawStarGraphic(Graphics::Views::GfxSurface &s, int x, int y) {
 	for (int row = 0; row < 18; ++row) {
 		for (int col = 0; col < 19; ++col) {
-			switch (STAR_BITMAP[row][col]) {
+			switch (Data::SPACE_STAR_BITMAP[row][col]) {
 			case 1:
 				s.setPixel(x + col, y + row, _G(colors)._star1);
 				break;
@@ -230,7 +158,7 @@ void SpaceMap::drawStarGraphic(Graphics::Views::GfxSurface &s, int x, int y) {
 void SpaceMap::drawPlanetGraphic(Graphics::Views::GfxSurface &s, int x, int y) {
 	for (int row = 0; row < 20; ++row) {
 		for (int col = 0; col < 20; ++col) {
-			if (PLANET_BITMAP[row][col] != 0)
+			if (Data::SPACE_PLANET_BITMAP[row][col] != 0)
 				s.setPixel(x + col, y + row, _G(colors)._edge);
 		}
 	}
@@ -239,7 +167,7 @@ void SpaceMap::drawPlanetGraphic(Graphics::Views::GfxSurface &s, int x, int y) {
 void SpaceMap::drawStationGraphic(Graphics::Views::GfxSurface &s, int x, int y) {
 	for (int row = 0; row < 18; ++row) {
 		for (int col = 0; col < 21; ++col) {
-			switch (STATION_BITMAP[row][col]) {
+			switch (Data::SPACE_STATION_BITMAP[row][col]) {
 			case 1:
 			case 2:
 				s.setPixel(x + col, y + row, _G(colors)._stationHighlight);


Commit: 649130abbb621f798d947719bd738feeba7140ee
    https://github.com/scummvm/scummvm/commit/649130abbb621f798d947719bd738feeba7140ee
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:41:07+11:00

Commit Message:
ULTIMA: ULTIMA1: Reset any active spaceship thrust on savegame load

Changed paths:
    engines/ultima/ultima1/ultima1.cpp


diff --git a/engines/ultima/ultima1/ultima1.cpp b/engines/ultima/ultima1/ultima1.cpp
index feaf40a4e94..66a3c7548e4 100644
--- a/engines/ultima/ultima1/ultima1.cpp
+++ b/engines/ultima/ultima1/ultima1.cpp
@@ -115,6 +115,11 @@ Common::Error Ultima1Engine::syncGame(Common::Serializer &s) {
 				++_creaturesCount;
 		}
 
+		// Space flight momentum isn't saved, so a ship doesn't keep thrusting from before the load
+		_G(sectorDriftX) = 0;
+		_G(sectorDriftY) = 0;
+		_G(shipExhaustCountdown) = 0;
+
 		_G(map).load(_G(savegame)._mapNum);
 	}
 


Commit: 1696d24b44fbb024fb7c4e6939b210dd2e36fe3c
    https://github.com/scummvm/scummvm/commit/1696d24b44fbb024fb7c4e6939b210dd2e36fe3c
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:41:07+11:00

Commit Message:
ULTIMA: ULTIMA1: Fixes to show command prompt in outer space

Changed paths:
    engines/ultima/ultima1/logic/space_cockpit_logic.cpp
    engines/ultima/ultima1/logic/space_logic.cpp
    engines/ultima/ultima1/logic/space_map_logic.cpp


diff --git a/engines/ultima/ultima1/logic/space_cockpit_logic.cpp b/engines/ultima/ultima1/logic/space_cockpit_logic.cpp
index b185f18b8d3..93beba102d0 100644
--- a/engines/ultima/ultima1/logic/space_cockpit_logic.cpp
+++ b/engines/ultima/ultima1/logic/space_cockpit_logic.cpp
@@ -389,7 +389,9 @@ bool SpaceCockpitLogic::view() {
 	// enemy craft first!")
 	_G(logic) = Common::SharedPtr<Logic>(new SpaceMapLogic());
 	g_engine->replaceView("SpaceMap");
-	return true;
+
+	prompt();
+	return false;
 }
 
 } // namespace Logic
diff --git a/engines/ultima/ultima1/logic/space_logic.cpp b/engines/ultima/ultima1/logic/space_logic.cpp
index e52b536ac40..62bbabfdaf6 100644
--- a/engines/ultima/ultima1/logic/space_logic.cpp
+++ b/engines/ultima/ultima1/logic/space_logic.cpp
@@ -63,8 +63,7 @@ void SpaceLogic::entering() {
 void SpaceLogic::endOfTurn() {
 	redrawMap();
 	redrawStats();
-	// TODO: death in space (hits/shields at zero) returns to Sosaria via
-	// OUT.EXE, not the land resurrection sequence
+	prompt();
 }
 
 int SpaceLogic::shipFuel() const {
diff --git a/engines/ultima/ultima1/logic/space_map_logic.cpp b/engines/ultima/ultima1/logic/space_map_logic.cpp
index 36f4c737557..c09c93056a0 100644
--- a/engines/ultima/ultima1/logic/space_map_logic.cpp
+++ b/engines/ultima/ultima1/logic/space_map_logic.cpp
@@ -321,7 +321,9 @@ bool SpaceMapLogic::view() {
 	cockpitLogic->setupSectorEnemies();
 	_G(logic) = cockpitLogic;
 	g_engine->replaceView("SpaceCockpit");
-	return true;
+
+	prompt();
+	return false;
 }
 
 } // namespace Logic


Commit: 72eaf00dd62d84e3466f5fa46ee63f22f091b98e
    https://github.com/scummvm/scummvm/commit/72eaf00dd62d84e3466f5fa46ee63f22f091b98e
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:41:07+11:00

Commit Message:
ULTIMA: ULTIMA1: Fix crash using ZStats in outer space

Changed paths:
    engines/ultima/ultima1/views/zstats.cpp


diff --git a/engines/ultima/ultima1/views/zstats.cpp b/engines/ultima/ultima1/views/zstats.cpp
index 670f91f11a6..4d714ea968e 100644
--- a/engines/ultima/ultima1/views/zstats.cpp
+++ b/engines/ultima/ultima1/views/zstats.cpp
@@ -32,7 +32,7 @@ namespace Views {
 constexpr int LINES_PER_PAGE = 26;
 
 bool ZStats::msgFocus(const FocusMessage &msg) {
-	g_engine->send("Commands", GameMessage("SPACE"));
+	g_engine->baseView()->findView("Commands")->send(GameMessage("SPACE"));
 
 	buildLines();
 	_pageStart = 0;
@@ -41,7 +41,7 @@ bool ZStats::msgFocus(const FocusMessage &msg) {
 
 bool ZStats::msgUnfocus(const UnfocusMessage &msg) {
 	// Switch back to an action prompt in the commands area
-	g_engine->send("Commands", GameMessage("PROMPT"));
+	g_engine->baseView()->findView("Commands")->send(GameMessage("PROMPT"));
 	return Dialog::msgUnfocus(msg);
 }
 


Commit: 9fe1d5656db0d01cf969e7e52803a27c9663c56d
    https://github.com/scummvm/scummvm/commit/9fe1d5656db0d01cf969e7e52803a27c9663c56d
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:41:07+11:00

Commit Message:
ULTIMA: ULTIMA1: Add missing constraints for switching outer space view mode

Changed paths:
    engines/ultima/ultima1/logic/space_cockpit_logic.cpp
    engines/ultima/ultima1/logic/space_map_logic.cpp
    engines/ultima/ultima1/ultima1.h


diff --git a/engines/ultima/ultima1/logic/space_cockpit_logic.cpp b/engines/ultima/ultima1/logic/space_cockpit_logic.cpp
index 93beba102d0..ccc2c9c64ae 100644
--- a/engines/ultima/ultima1/logic/space_cockpit_logic.cpp
+++ b/engines/ultima/ultima1/logic/space_cockpit_logic.cpp
@@ -381,13 +381,45 @@ void SpaceCockpitLogic::abortHyperjump() {
 	prompt();
 }
 
+// Scales one axis of the overhead view's drift by how the cockpit's speed has
+// changed since it was entered, rounding to the nearest whole step (the
+// original's updateSectorChangeX/Y and snapToNearestSector)
+static int scaleDrift(int drift) {
+	int ratio = _G(cockpitSpeed) * 1000 / MAX<int>(_G(cockpitEntrySpeed), 1);
+	int value = (int16)(drift * ratio);
+
+	if (value % 100 > 49)
+		value += 100;
+	if (value % 1000 > 499)
+		value += 1000;
+
+	return MIN(value / 1000, 6);
+}
+
 bool SpaceCockpitLogic::view() {
-	writeString("View\n");
+	writeString("View");
+
+	if (_G(savegame)._starmap._sectors[_G(savegame)._sectorX][_G(savegame)._sectorY]._enemyCount != 0) {
+		writeString("?\n");
+		writeString("Thou must eliminate all\n");
+		writeString("enemy craft first!\n");
+		return true;
+	}
+
+	writeString("\n");
+
+	_G(sectorDriftX) = scaleDrift(_G(sectorDriftX));
+	_G(sectorDriftY) = scaleDrift(_G(sectorDriftY));
+
+	// A ship brought to rest heads off slowly in the direction it's facing
+	if (_G(sectorDriftX) == 0 && _G(sectorDriftY) == 0) {
+		const Data::SpaceMapShip &ship = _G(savegame)._starmap
+			._sectors[_G(savegame)._sectorX][_G(savegame)._sectorY]._ships[_G(savegame)._shipIndex];
+		_G(sectorDriftX) = Data::SPACE_FACING_DX[ship._facing];
+		_G(sectorDriftY) = Data::SPACE_FACING_DY[ship._facing];
+	}
 
-	// TODO: the original refuses this switch back to the overhead view
-	// while any enemies remain in the sector ("Thou must eliminate all
-	// enemy craft first!")
-	_G(logic) = Common::SharedPtr<Logic>(new SpaceMapLogic());
+	_G(logic) =Common::SharedPtr<Logic>(new SpaceMapLogic());
 	g_engine->replaceView("SpaceMap");
 
 	prompt();
diff --git a/engines/ultima/ultima1/logic/space_map_logic.cpp b/engines/ultima/ultima1/logic/space_map_logic.cpp
index c09c93056a0..29fdf2163b5 100644
--- a/engines/ultima/ultima1/logic/space_map_logic.cpp
+++ b/engines/ultima/ultima1/logic/space_map_logic.cpp
@@ -31,6 +31,9 @@ namespace Logic {
 
 constexpr int MAX_DRIFT = 9;
 
+// The fastest the cockpit's speed can be set from the overhead view's drift
+constexpr int MAX_DRIFT_SPEED = 8;
+
 // Flying within this many units (on both axes) of a sector's star/heat
 // hazard is fatal (checkStarProximity)
 constexpr int STAR_DEATH_RANGE = 25;
@@ -312,11 +315,47 @@ bool SpaceMapLogic::fire() {
 	return true;
 }
 
+// The original's integer square root, which rounds up
+static int isqrt(int value) {
+	int result = 0;
+	while (value > 0)
+		value -= 2 * ++result - 1;
+
+	return result;
+}
+
 bool SpaceMapLogic::view() {
-	writeString("View\n");
+	writeString("View");
+
+	Data::SpaceMapCell &cell = _G(savegame)._starmap._sectors[_G(savegame)._sectorX][_G(savegame)._sectorY];
+	if (cell.dockedEdge(_G(savegame)._shipIndex) >= 0) {
+		writeString("?\n");
+		writeString("View can't be changed\n");
+		writeString("whilst in space dock.\n");
+		return true;
+	}
+
+	writeString("\n");
+	if (shipFuel() == 0) {
+		writeString("Not enough fuel!\n");
+		return true;
+	}
+
+	// The cockpit's speed is the overhead view's current drift. If the ship is
+	// at rest, it starts at the slowest speed in the direction it's facing
+	int speed = isqrt(_G(sectorDriftX) * _G(sectorDriftX) + _G(sectorDriftY) * _G(sectorDriftY));
+	if (speed > MAX_DRIFT_SPEED) {
+		speed = MAX_DRIFT_SPEED;
+	} else if (speed == 0) {
+		speed = 1;
+
+		const Data::SpaceMapShip &ship = cell._ships[_G(savegame)._shipIndex];
+		_G(sectorDriftX) = Data::SPACE_FACING_DX[ship._facing];
+		_G(sectorDriftY) = Data::SPACE_FACING_DY[ship._facing];
+	}
+
+	_G(cockpitSpeed) = _G(cockpitEntrySpeed) = speed;
 
-	// TODO: the original refuses the switch with no fuel or while docked,
-	// and seeds the cockpit's heading from the current drift
 	Common::SharedPtr<SpaceCockpitLogic> cockpitLogic(new SpaceCockpitLogic());
 	cockpitLogic->setupSectorEnemies();
 	_G(logic) = cockpitLogic;
diff --git a/engines/ultima/ultima1/ultima1.h b/engines/ultima/ultima1/ultima1.h
index cae8bfd3d89..39c05be8d7a 100644
--- a/engines/ultima/ultima1/ultima1.h
+++ b/engines/ultima/ultima1/ultima1.h
@@ -94,6 +94,9 @@ public:
 	// The flight speed set while in the cockpit view (the overhead vs
 	// cockpit distinction is carried by which SpaceLogic subclass is active)
 	int _cockpitSpeed = 0;
+	// The speed it was when the cockpit view was entered, which the drift on
+	// return to the overhead view is scaled relative to
+	int _cockpitEntrySpeed = 1;
 	// The overhead sector view's current drift velocity (sectorChangeX/Y),
 	// applied to the player's ship position each frame, and the number of
 	// frames left to keep showing its engine exhaust trail (_countdown)


Commit: d64f5895b9ae6f0fc6ae8f3af019b9392850e4e2
    https://github.com/scummvm/scummvm/commit/d64f5895b9ae6f0fc6ae8f3af019b9392850e4e2
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:41:07+11:00

Commit Message:
ULTIMA: ULTIMA1: Stats console command

Changed paths:
    engines/ultima/ultima1/console.cpp
    engines/ultima/ultima1/console.h


diff --git a/engines/ultima/ultima1/console.cpp b/engines/ultima/ultima1/console.cpp
index 323bed56670..1a295173c79 100644
--- a/engines/ultima/ultima1/console.cpp
+++ b/engines/ultima/ultima1/console.cpp
@@ -27,6 +27,9 @@
 namespace Ultima {
 namespace Ultima1 {
 
+// The highest any of the six attributes can reach, as with strength rewards
+constexpr int MAX_ATTRIBUTE = 99;
+
 Console::Console() : GUI::Debugger() {
 	registerCmd("view", WRAP_METHOD(Console, cmdView));
 	registerCmd("map", WRAP_METHOD(Console, cmdMap));
@@ -35,6 +38,7 @@ Console::Console() : GUI::Debugger() {
 	registerCmd("coins", WRAP_METHOD(Console, cmdCoins));
 	registerCmd("fuel", WRAP_METHOD(Console, cmdFuel));
 	registerCmd("space", WRAP_METHOD(Console, cmdSpace));
+	registerCmd("stats", WRAP_METHOD(Console, cmdStats));
 	registerCmd("inventory", WRAP_METHOD(Console, cmdInventory));
 	registerCmd("teleport", WRAP_METHOD(Console, cmdTeleport));
 	registerCmd("locations", WRAP_METHOD(Console, cmdLocations));
@@ -142,6 +146,16 @@ bool Console::cmdSpace(int argc, const char **argv) {
 	return false;
 }
 
+bool Console::cmdStats(int argc, const char **argv) {
+	Data::Savegame &sg = _G(savegame);
+
+	sg._strength = sg._agility = sg._stamina = sg._charisma = sg._wisdom = sg._intelligence = MAX_ATTRIBUTE;
+
+	g_engine->baseView()->findView("Stats")->draw();
+	debugPrintf("All attributes set to %d\n", MAX_ATTRIBUTE);
+	return true;
+}
+
 bool Console::cmdInventory(int argc, const char **argv) {
 	Data::Savegame &sg = _G(savegame);
 
diff --git a/engines/ultima/ultima1/console.h b/engines/ultima/ultima1/console.h
index 81ce083421d..f1b6ca54592 100644
--- a/engines/ultima/ultima1/console.h
+++ b/engines/ultima/ultima1/console.h
@@ -37,6 +37,7 @@ private:
 	bool cmdCoins(int argc, const char **argv);
 	bool cmdFuel(int argc, const char **argv);
 	bool cmdSpace(int argc, const char **argv);
+	bool cmdStats(int argc, const char **argv);
 	bool cmdInventory(int argc, const char **argv);
 	bool cmdTeleport(int argc, const char **argv);
 	bool cmdLocations(int argc, const char **argv);


Commit: f8069991b2ceb06d8b8f66bdeae80721797f3b43
    https://github.com/scummvm/scummvm/commit/f8069991b2ceb06d8b8f66bdeae80721797f3b43
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:41:07+11:00

Commit Message:
ULTIMA: ULTIMA1: Prompt fix after reaching Mondain

Changed paths:
    engines/ultima/ultima1/logic/mondain_logic.cpp
    engines/ultima/ultima1/views/interactions/entering_craft.cpp


diff --git a/engines/ultima/ultima1/logic/mondain_logic.cpp b/engines/ultima/ultima1/logic/mondain_logic.cpp
index 275e72c0e98..d097f0f665b 100644
--- a/engines/ultima/ultima1/logic/mondain_logic.cpp
+++ b/engines/ultima/ultima1/logic/mondain_logic.cpp
@@ -675,6 +675,8 @@ void MondainLogic::endOfTurn() {
 
 	if (_G(savegame)._hits <= 0)
 		g_engine->addView("Lose");
+	else
+		prompt();
 }
 
 bool MondainLogic::get() {
diff --git a/engines/ultima/ultima1/views/interactions/entering_craft.cpp b/engines/ultima/ultima1/views/interactions/entering_craft.cpp
index 57a1447464f..d65bd1137c8 100644
--- a/engines/ultima/ultima1/views/interactions/entering_craft.cpp
+++ b/engines/ultima/ultima1/views/interactions/entering_craft.cpp
@@ -186,6 +186,7 @@ void EnteringCraft::nextPage() {
 		close();
 		_G(map).load(Data::MAP_MONDAIN);
 		_G(logic)->entering();
+		prompt();
 	}
 }
 


Commit: 44c0ad1e6623852fc298dd9d0dbf69a1691c0b6a
    https://github.com/scummvm/scummvm/commit/44c0ad1e6623852fc298dd9d0dbf69a1691c0b6a
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:41:07+11:00

Commit Message:
ULTIMA: ULTIMA1: Don't render overworld entities in Mondain map

Changed paths:
    engines/ultima/ultima1/views/mondain_map.cpp


diff --git a/engines/ultima/ultima1/views/mondain_map.cpp b/engines/ultima/ultima1/views/mondain_map.cpp
index 8b098200e03..780330fd040 100644
--- a/engines/ultima/ultima1/views/mondain_map.cpp
+++ b/engines/ultima/ultima1/views/mondain_map.cpp
@@ -59,7 +59,8 @@ void MondainMap::draw() {
 	// Draw the visible map contents
 	for (int oy = 0; oy < Data::MONDAIN_HEIGHT; oy++) {
 		for (int ox = 0; ox < Data::MONDAIN_WIDTH; ox++) {
-			int tileId = _G(map).getTileAt(ox, oy);
+			// Not getTileAt, which would pick up the location entities left over from the last city or castle
+			int tileId = _G(map).getMapTile(ox, oy);
 
 			const Graphics::ManagedSurface &tileImg = tiles[tileId];
 			s.blitFrom(tileImg, Common::Point(ox * TILE_WIDTH + 8, oy * TILE_HEIGHT + 8));


Commit: 99217522643d353eabd0c2a35cca06983c935815
    https://github.com/scummvm/scummvm/commit/99217522643d353eabd0c2a35cca06983c935815
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:41:07+11:00

Commit Message:
ULTIMA: ULTIMA1: Mondain combat fix

Changed paths:
    engines/ultima/ultima1/logic/mondain_logic.cpp


diff --git a/engines/ultima/ultima1/logic/mondain_logic.cpp b/engines/ultima/ultima1/logic/mondain_logic.cpp
index d097f0f665b..df3c944c9cd 100644
--- a/engines/ultima/ultima1/logic/mondain_logic.cpp
+++ b/engines/ultima/ultima1/logic/mondain_logic.cpp
@@ -51,18 +51,11 @@ void MondainLogic::entering() {
 	// conjured hazards, stale position markers)
 	_G(map).resetMondainMap();
 
-	// Fixed starting positions - the player by the time machine on the west
-	// wall, Mondain across the room to the east. These match the MTILE_PLAYER
-	// marker baked into MONDAIN_MAP; Mondain is drawn purely as an overlay,
-	// so his cell stays 0 in the map data
+	// Set initial position
 	sg._locationPosition = Common::Point(3, 4);
 	sg._mondainPos = Common::Point(15, 4);
 
-	// The original re-launches a dedicated executable for this encounter, so
-	// every bit of its state starts from that executable's static
-	// initializers. We reuse the one long-lived Savegame, so reset the same
-	// state here to those values - otherwise a second visit (via the debug
-	// map command, say) would inherit a dead or half-fought Mondain
+	// Set Mondain's state
 	sg._mondainHits = 1000;
 	sg._mondainPhase = 2;
 	sg._mondainPhaseAnimOffset = 0;
@@ -165,6 +158,8 @@ void MondainLogic::damage(Data::Direction dir, int effectNum, int maxDistance, i
 	writeString("Hit Mondain! ");
 	writeString("%d damage!\n", strike);
 	playFX(2);
+
+	endOfTurn();
 }
 
 bool MondainLogic::isWithinRange7() const {


Commit: 237463a5b7a6778e125d9e94c04ddbeeb3f1f3fc
    https://github.com/scummvm/scummvm/commit/237463a5b7a6778e125d9e94c04ddbeeb3f1f3fc
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:41:07+11:00

Commit Message:
ULTIMA: ULTIMA1: Mondain gem fixes

Changed paths:
    engines/ultima/ultima1/data/map.h
    engines/ultima/ultima1/data/tiles.h
    engines/ultima/ultima1/logic/mondain_logic.cpp
    engines/ultima/ultima1/logic/mondain_logic.h
    engines/ultima/ultima1/views/mondain_map.cpp


diff --git a/engines/ultima/ultima1/data/map.h b/engines/ultima/ultima1/data/map.h
index ed55bb8497e..2042ad1f5f3 100644
--- a/engines/ultima/ultima1/data/map.h
+++ b/engines/ultima/ultima1/data/map.h
@@ -46,6 +46,10 @@ constexpr int CITY_SIZE = CITY_WIDTH * CITY_HEIGHT;
 constexpr int MONDAIN_WIDTH = 19;
 constexpr int MONDAIN_HEIGHT = 9;
 
+// Where the gem Mondain is creating sits in his room
+constexpr int MONDAIN_GEM_X = 14;
+constexpr int MONDAIN_GEM_Y = 4;
+
 constexpr int LOCATION_COUNT = 84;
 
 enum {
diff --git a/engines/ultima/ultima1/data/tiles.h b/engines/ultima/ultima1/data/tiles.h
index 6492cef00a7..75715ddefe4 100644
--- a/engines/ultima/ultima1/data/tiles.h
+++ b/engines/ultima/ultima1/data/tiles.h
@@ -115,6 +115,10 @@ enum LocationTileId {
 };
 
 enum MondainTileId {
+	// The gem Mondain is creating, which stays put in the room however he
+	// moves. While it's being struck, frames 1-4 of the hit animation (tiles
+	// 6-9) are drawn over it
+	MTILE_GEM = 6,
 	// Tiles 14-19 are the 6 animation frames of a hazard Mondain briefly
 	// conjures onto an empty cell (see updateMondainState / MondainLogic::tick)
 	MTILE_HAZARD = 14,
diff --git a/engines/ultima/ultima1/logic/mondain_logic.cpp b/engines/ultima/ultima1/logic/mondain_logic.cpp
index df3c944c9cd..64d7210b3a5 100644
--- a/engines/ultima/ultima1/logic/mondain_logic.cpp
+++ b/engines/ultima/ultima1/logic/mondain_logic.cpp
@@ -118,7 +118,7 @@ bool MondainLogic::move(Data::Direction dir) {
 		redrawStats();
 	}
 
-	if (isAdjacentToMondain() && sg._mondainHitAnimFrame == 0) {
+	if (isAdjacentToGem() && sg._mondainHitAnimFrame == 0) {
 		sg._mondainHitAnimFrame = 1;
 		sg._mondainHitAnimDir = 1;
 		sg._mondainCombatFlag = 1;
@@ -417,13 +417,21 @@ void MondainLogic::tick() {
 	}
 }
 
-bool MondainLogic::isAdjacentToMondain() const {
+bool MondainLogic::isAdjacentToGem() const {
 	const Common::Point &pos = _G(savegame)._locationPosition;
-	const Common::Point &mondainPos = _G(savegame)._mondainPos;
 
-	int dx = ABS(pos.x - mondainPos.x);
-	int dy = ABS(pos.y - mondainPos.y);
-	return dx <= 1 && dy <= 1 && (dx != 0 || dy != 0);
+	for (int dy = -1; dy <= 1; ++dy) {
+		for (int dx = -1; dx <= 1; ++dx) {
+			int x = pos.x + dx, y = pos.y + dy;
+			if ((dx == 0 && dy == 0) || x <= 0 || x >= Data::MONDAIN_WIDTH || y <= 0 || y >= Data::MONDAIN_HEIGHT)
+				continue;
+
+			if (_G(map).getMapTile(x, y) == Data::MTILE_GEM)
+				return true;
+		}
+	}
+
+	return false;
 }
 
 void MondainLogic::updateMondainState() {
@@ -678,7 +686,7 @@ bool MondainLogic::get() {
 	Data::Savegame &sg = _G(savegame);
 	writeString("Get (Gem)");
 
-	if (sg._gemDestroyedFlag || !isAdjacentToMondain()) {
+	if (sg._gemDestroyedFlag || !isAdjacentToGem()) {
 		writeString("..'tis nothing here!\n");
 		playFX(1);
 		return true;
@@ -687,6 +695,7 @@ bool MondainLogic::get() {
 	// Destroy the gem - it can only be done once, adjacent to Mondain
 	sg._mondainCombatFlag = 1;
 	sg._gemDestroyedFlag = true;
+	_G(map)[Data::MONDAIN_GEM_Y][Data::MONDAIN_GEM_X] = 0;
 	sg._mondainHitAnimFrame = 0;
 
 	int damage = sg._hits * 3 / 4;
diff --git a/engines/ultima/ultima1/logic/mondain_logic.h b/engines/ultima/ultima1/logic/mondain_logic.h
index e4a5d9b7f5b..3339e9a160e 100644
--- a/engines/ultima/ultima1/logic/mondain_logic.h
+++ b/engines/ultima/ultima1/logic/mondain_logic.h
@@ -43,10 +43,11 @@ private:
 	int _castSpell = 0;
 
 	/**
-	 * Returns true if Mondain is standing in any of the 8 cells surrounding
-	 * the player's current position
+	 * Returns true if the gem he's creating is in any of the 8 cells surrounding
+	 * the player's current position. As in the original, it's the gem's tile
+	 * that counts rather than where Mondain himself is standing
 	 */
-	bool isAdjacentToMondain() const;
+	bool isAdjacentToGem() const;
 
 	/**
 	 * Returns true if the player is within a Manhattan distance of 7 of
diff --git a/engines/ultima/ultima1/views/mondain_map.cpp b/engines/ultima/ultima1/views/mondain_map.cpp
index 780330fd040..6dee8446aa0 100644
--- a/engines/ultima/ultima1/views/mondain_map.cpp
+++ b/engines/ultima/ultima1/views/mondain_map.cpp
@@ -87,15 +87,16 @@ void MondainMap::draw() {
 			sg._mondainHazardPos.y * TILE_HEIGHT + 8));
 	}
 
-	// Draw Mondain himself - his current pose, plus (while he's reacting to
-	// a hit) a small flash effect just to the left of him
-	const auto &mondainPos = sg._mondainPos;
-
+	// While the gem is being struck, its animation plays over its own tile -
+	// it doesn't follow Mondain around the room
 	if (sg._mondainHitAnimFrame != 0) {
 		const Graphics::ManagedSurface &hitTileImg = tiles[sg._mondainHitAnimFrame + 5];
-		s.blitFrom(hitTileImg, Common::Point((mondainPos.x - 1) * TILE_WIDTH + 8, mondainPos.y * TILE_HEIGHT + 8));
+		s.blitFrom(hitTileImg, Common::Point(Data::MONDAIN_GEM_X * TILE_WIDTH + 8, Data::MONDAIN_GEM_Y * TILE_HEIGHT + 8));
 	}
 
+	// Draw Mondain himself - his current pose
+	const auto &mondainPos = sg._mondainPos;
+
 	const Graphics::ManagedSurface &mondainTileImg = tiles[sg._mondainPhase + sg._mondainPhaseAnimOffset];
 	s.blitFrom(mondainTileImg, Common::Point(mondainPos.x * TILE_WIDTH + 8, mondainPos.y * TILE_HEIGHT + 8));
 


Commit: 7cd93ecb3f7b5ca8ff68ce2a055ab006667f46b7
    https://github.com/scummvm/scummvm/commit/7cd93ecb3f7b5ca8ff68ce2a055ab006667f46b7
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:41:07+11:00

Commit Message:
ULTIMA: ULTIMA1: Mondain psionic attack screen inversion

Changed paths:
  A engines/ultima/ultima1/gfx/render_mode.cpp
  A engines/ultima/ultima1/gfx/render_mode.h
  R engines/ultima/ultima1/data/render_mode.cpp
  R engines/ultima/ultima1/data/render_mode.h
    engines/ultima/module.mk
    engines/ultima/ultima1/logic/mondain_logic.cpp
    engines/ultima/ultima1/ultima1.cpp
    engines/ultima/ultima1/ultima1.h
    engines/ultima/ultima1/views/title.h


diff --git a/engines/ultima/module.mk b/engines/ultima/module.mk
index fa575ca1bc0..61b4d89db4d 100644
--- a/engines/ultima/module.mk
+++ b/engines/ultima/module.mk
@@ -55,12 +55,12 @@ MODULE_OBJS += \
 	ultima1/data/entity.o \
 	ultima1/data/map.o \
 	ultima1/data/map_dungeon.o \
-	ultima1/data/render_mode.o \
 	ultima1/data/savegame.o \
 	ultima1/data/space_map.o \
 	ultima1/data/tiles.o \
 	ultima1/gfx/font.o \
 	ultima1/gfx/pic_decoder.o \
+	ultima1/gfx/render_mode.o \
 	ultima1/gfx/text_cursor.o \
 	ultima1/gfx/text_input.o \
 	ultima1/logic/logic.o \
diff --git a/engines/ultima/ultima1/data/render_mode.cpp b/engines/ultima/ultima1/gfx/render_mode.cpp
similarity index 71%
rename from engines/ultima/ultima1/data/render_mode.cpp
rename to engines/ultima/ultima1/gfx/render_mode.cpp
index f882aece1b8..5d8f5d3244a 100644
--- a/engines/ultima/ultima1/data/render_mode.cpp
+++ b/engines/ultima/ultima1/gfx/render_mode.cpp
@@ -23,7 +23,7 @@
 #include "common/translation.h"
 #include "graphics/palette.h"
 #include "graphics/paletteman.h"
-#include "ultima/ultima1/data/render_mode.h"
+#include "ultima/ultima1/gfx/render_mode.h"
 
 namespace Ultima {
 namespace Ultima1 {
@@ -75,6 +75,14 @@ void RenderColors::set(RenderMode mode) {
 	}
 }
 
+// CGA's palette 0, with a white background, as shown in the hit flash
+static const byte CGA_HIT_FLASH_PALETTE[4 * 3] = {
+	0xff, 0xff, 0xff, // 0: white
+	0x00, 0xaa, 0x00, // 1: green
+	0xaa, 0x00, 0x00, // 2: red
+	0xaa, 0x55, 0x00  // 3: brown
+};
+
 void setPalette(RenderMode mode) {
 	if (mode == RENDER_EGA) {
 		g_system->getPaletteManager()->setPalette(Graphics::Palette::createEGAPalette());
@@ -90,6 +98,30 @@ void setPalette(RenderMode mode) {
 	g_system->getPaletteManager()->setPalette(palette);
 }
 
+void setHitFlashPalette(RenderMode mode) {
+	if (mode == RENDER_EGA) {
+		// The standard EGA palette is read-only static data, so invert a copy of it
+		const Graphics::Palette egaPalette = Graphics::Palette::createEGAPalette();
+		Graphics::Palette palette(16);
+		byte r, g, b;
+
+		for (int i = 0; i < 16; ++i) {
+			egaPalette.get(i, r, g, b);
+			palette.set(i, 255 - r, 255 - g, 255 - b);
+		}
+
+		g_system->getPaletteManager()->setPalette(palette);
+		return;
+	}
+
+	Graphics::Palette palette(256);
+	for (int i = 0; i < 256; ++i)
+		palette.set(&CGA_HIT_FLASH_PALETTE[3 * 3], i, 1);
+	palette.set(CGA_HIT_FLASH_PALETTE, 0, 4);
+
+	g_system->getPaletteManager()->setPalette(palette);
+}
+
 } // namespace Data
 } // namespace Ultima1
 } // namespace Ultima
diff --git a/engines/ultima/ultima1/data/render_mode.h b/engines/ultima/ultima1/gfx/render_mode.h
similarity index 90%
rename from engines/ultima/ultima1/data/render_mode.h
rename to engines/ultima/ultima1/gfx/render_mode.h
index af7bea334c3..61c6e4fc6ef 100644
--- a/engines/ultima/ultima1/data/render_mode.h
+++ b/engines/ultima/ultima1/gfx/render_mode.h
@@ -19,8 +19,8 @@
  *
  */
 
-#ifndef ULTIMA1_DATA_RENDER_MODE_H
-#define ULTIMA1_DATA_RENDER_MODE_H
+#ifndef ULTIMA1_GFX_RENDER_MODE_H
+#define ULTIMA1_GFX_RENDER_MODE_H
 
 #include "common/scummsys.h"
 
@@ -72,6 +72,12 @@ struct RenderColors {
  */
 void setPalette(RenderMode mode);
 
+/**
+ * Sets the screen palette to the one shown briefly when the player is struck
+ * by Mondain - the colors inverted. setPalette restores the normal one
+ */
+void setHitFlashPalette(RenderMode mode);
+
 } // namespace Data
 } // namespace Ultima1
 } // namespace Ultima
diff --git a/engines/ultima/ultima1/logic/mondain_logic.cpp b/engines/ultima/ultima1/logic/mondain_logic.cpp
index 64d7210b3a5..75a125a52e3 100644
--- a/engines/ultima/ultima1/logic/mondain_logic.cpp
+++ b/engines/ultima/ultima1/logic/mondain_logic.cpp
@@ -110,12 +110,16 @@ bool MondainLogic::move(Data::Direction dir) {
 		if (damage == 0)
 			damage = 1;
 
+		// The screen is inverted while the player is burned
+		g_engine->setHitFlash(true);
 		writeString("Burned! ");
 		writeString("%d damage!\n", damage);
 		playFX(2);
 
 		sg._hits -= damage;
 		redrawStats();
+		g_engine->pauseForEffect(2);
+		g_engine->setHitFlash(false);
 	}
 
 	if (isAdjacentToGem() && sg._mondainHitAnimFrame == 0) {
@@ -645,7 +649,7 @@ void MondainLogic::mondainSpellAttack() {
 	default:
 		// Psionic shock
 		writeString("psionic shock!\n");
-		playFX(5);
+		g_engine->flashScreen(5);
 
 		hit = getRandomNumber(1, 200) > 140;
 		if (hit) {
diff --git a/engines/ultima/ultima1/ultima1.cpp b/engines/ultima/ultima1/ultima1.cpp
index 66a3c7548e4..af52337d06a 100644
--- a/engines/ultima/ultima1/ultima1.cpp
+++ b/engines/ultima/ultima1/ultima1.cpp
@@ -160,6 +160,26 @@ void Ultima1Engine::queueEffect(const Common::Array<byte> &samples) {
 	_effectStream->queueBuffer(data, samples.size(), DisposeAfterUse::YES, Audio::FLAG_UNSIGNED);
 }
 
+void Ultima1Engine::setHitFlash(bool on) {
+	if (on)
+		Data::setHitFlashPalette(_renderMode);
+	else
+		Data::setPalette(_renderMode);
+
+	updateScreen();
+}
+
+void Ultima1Engine::pauseForEffect(int num) {
+	pauseMillis(SoundEffects::render(num).size() * 1000 / SoundEffects::SAMPLE_RATE);
+}
+
+void Ultima1Engine::flashScreen(int effectNum) {
+	setHitFlash(true);
+	playFX(effectNum);
+	pauseForEffect(effectNum);
+	setHitFlash(false);
+}
+
 void Ultima1Engine::pauseMillis(uint32 millis) {
 	g_system->delayMillis(millis);
 }
diff --git a/engines/ultima/ultima1/ultima1.h b/engines/ultima/ultima1/ultima1.h
index 39c05be8d7a..cb70aa1b3d4 100644
--- a/engines/ultima/ultima1/ultima1.h
+++ b/engines/ultima/ultima1/ultima1.h
@@ -41,7 +41,7 @@
 #include "ultima/detection.h"
 #include "ultima/ultima1/data/map.h"
 #include "ultima/ultima1/data/map_dungeon.h"
-#include "ultima/ultima1/data/render_mode.h"
+#include "ultima/ultima1/gfx/render_mode.h"
 #include "ultima/ultima1/data/savegame.h"
 #include "ultima/ultima1/data/space_map.h"
 #include "ultima/ultima1/data/tiles.h"
@@ -159,6 +159,21 @@ public:
 	 */
 	void playFX(int num);
 
+	/**
+	 * Inverts the screen's colors, or puts them back, as when Mondain strikes the player
+	 */
+	void setHitFlash(bool on);
+
+	/**
+	 * Waits for as long as a sound effect lasts
+	 */
+	void pauseForEffect(int num);
+
+	/**
+	 * Briefly inverts the screen's colors for the duration of a sound effect
+	 */
+	void flashScreen(int effectNum);
+
 	/**
 	 * Pause for a given number of milliseconds
 	 */
diff --git a/engines/ultima/ultima1/views/title.h b/engines/ultima/ultima1/views/title.h
index b4f3b6d7b73..bdac6cf6642 100644
--- a/engines/ultima/ultima1/views/title.h
+++ b/engines/ultima/ultima1/views/title.h
@@ -25,7 +25,7 @@
 #include "graphics/managed_surface.h"
 #include "graphics/palette.h"
 #include "ultima/shared/engine/view.h"
-#include "ultima/ultima1/data/render_mode.h"
+#include "ultima/ultima1/gfx/render_mode.h"
 
 namespace Ultima {
 namespace Ultima1 {


Commit: c0a66a8d3a331b05426b8e28f8c7425d5806879e
    https://github.com/scummvm/scummvm/commit/c0a66a8d3a331b05426b8e28f8c7425d5806879e
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:41:07+11:00

Commit Message:
ULTIMA: ULTIMA1: Persist city/castle/Mondain maps in savegames

This fixes issues where the map contents are changed. Previously,
restoring a savegame was returning the maps to their default layout.

Changed paths:
    engines/ultima/ultima1/data/map.cpp
    engines/ultima/ultima1/data/map.h
    engines/ultima/ultima1/logic/city_castle_logic.h
    engines/ultima/ultima1/logic/logic.h
    engines/ultima/ultima1/logic/mondain_logic.h
    engines/ultima/ultima1/ultima1.cpp


diff --git a/engines/ultima/ultima1/data/map.cpp b/engines/ultima/ultima1/data/map.cpp
index b5c608e97f4..5a2b191e8a0 100644
--- a/engines/ultima/ultima1/data/map.cpp
+++ b/engines/ultima/ultima1/data/map.cpp
@@ -175,6 +175,22 @@ void Map::resetMondainMap() {
 	Common::copy(&MONDAIN_MAP[0][0], &MONDAIN_MAP[0][0] + MONDAIN_WIDTH * MONDAIN_HEIGHT, &_mondainMap[0][0]);
 }
 
+void Map::synchronize(Common::Serializer &s) {
+	switch (_mapType) {
+	case MAPTYPE_CITY:
+	case MAPTYPE_CASTLE:
+		s.syncBytes(&_cityMap[_mapStyle][0], CITY_SIZE);
+		break;
+
+	case MAPTYPE_MONDAIN:
+		s.syncBytes(&_mondainMap[0][0], MONDAIN_WIDTH * MONDAIN_HEIGHT);
+		break;
+
+	default:
+		break;
+	}
+}
+
 void Map::load(int mapNum) {
 	_G(savegame)._mapNum = mapNum;
 
diff --git a/engines/ultima/ultima1/data/map.h b/engines/ultima/ultima1/data/map.h
index 2042ad1f5f3..ff35c82b247 100644
--- a/engines/ultima/ultima1/data/map.h
+++ b/engines/ultima/ultima1/data/map.h
@@ -24,6 +24,7 @@
 
 #include "common/array.h"
 #include "common/rect.h"
+#include "common/serializer.h"
 #include "graphics/managed_surface.h"
 #include "ultima/ultima1/data/tiles.h"
 
@@ -158,6 +159,12 @@ public:
 	 */
 	void load(int mapNum);
 
+	/**
+	 * Saves or loads the contents of the current location's map, for the
+	 * locations the player can make changes to. Does nothing for any others
+	 */
+	void synchronize(Common::Serializer &s);
+
 	/**
 	 * Restores the Mondain encounter room to its pristine layout, discarding
 	 * anything left behind by a previous visit (placed barriers, conjured
diff --git a/engines/ultima/ultima1/logic/city_castle_logic.h b/engines/ultima/ultima1/logic/city_castle_logic.h
index 9468070e784..cde2c5f9698 100644
--- a/engines/ultima/ultima1/logic/city_castle_logic.h
+++ b/engines/ultima/ultima1/logic/city_castle_logic.h
@@ -170,6 +170,9 @@ public:
 	}
 
 	void entering() override;
+	bool isPersisted() const override {
+		return true;
+	}
 
 	/**
 	 * Called to leave the location
diff --git a/engines/ultima/ultima1/logic/logic.h b/engines/ultima/ultima1/logic/logic.h
index e112400960d..039b1d99610 100644
--- a/engines/ultima/ultima1/logic/logic.h
+++ b/engines/ultima/ultima1/logic/logic.h
@@ -20,8 +20,8 @@
  *
  */
 
-#ifndef ULTIMA2_LOGIC_H
-#define ULTIMA2_LOGIC_H
+#ifndef ULTIMA1_LOGIC_H
+#define ULTIMA1_LOGIC_H
 
 #include "common/events.h"
 #include "common/ptr.h"
@@ -188,6 +188,14 @@ public:
 	 * Called once per game frame for any logic updates
 	 */
 	virtual void tick() {}
+
+	/**
+	 * Returns whether this logic's map can be changed by the player, so its
+	 * contents have to be kept in savegames
+	 */
+	virtual bool isPersisted() const {
+		return false;
+	}
 };
 
 /**
diff --git a/engines/ultima/ultima1/logic/mondain_logic.h b/engines/ultima/ultima1/logic/mondain_logic.h
index 3339e9a160e..8b30d8867d8 100644
--- a/engines/ultima/ultima1/logic/mondain_logic.h
+++ b/engines/ultima/ultima1/logic/mondain_logic.h
@@ -197,6 +197,9 @@ public:
 	}
 
 	void entering() override;
+	bool isPersisted() const override {
+		return true;
+	}
 
 	/**
 	 * Called once per game frame - advances Mondain's hit-reaction and
diff --git a/engines/ultima/ultima1/ultima1.cpp b/engines/ultima/ultima1/ultima1.cpp
index af52337d06a..c901e03fda5 100644
--- a/engines/ultima/ultima1/ultima1.cpp
+++ b/engines/ultima/ultima1/ultima1.cpp
@@ -123,6 +123,10 @@ Common::Error Ultima1Engine::syncGame(Common::Serializer &s) {
 		_G(map).load(_G(savegame)._mapNum);
 	}
 
+	// Locations save their map as well, so changes to it like an unlocked cell aren't lost
+	if (_G(logic)->isPersisted())
+		_G(map).synchronize(s);
+
 	return Common::kNoError;
 }
 


Commit: 380d060618bacb4a2d080649f0a459d222b725da
    https://github.com/scummvm/scummvm/commit/380d060618bacb4a2d080649f0a459d222b725da
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:41:07+11:00

Commit Message:
ULTIMA: ULTIMA1: Missing prompt after Mondain attack misses

Changed paths:
    engines/ultima/ultima1/logic/mondain_logic.cpp


diff --git a/engines/ultima/ultima1/logic/mondain_logic.cpp b/engines/ultima/ultima1/logic/mondain_logic.cpp
index 75a125a52e3..147dce4a239 100644
--- a/engines/ultima/ultima1/logic/mondain_logic.cpp
+++ b/engines/ultima/ultima1/logic/mondain_logic.cpp
@@ -155,14 +155,13 @@ void MondainLogic::damage(Data::Direction dir, int effectNum, int maxDistance, i
 
 	if (!foundMondain || getRandomNumber(1, 100) > hitChance) {
 		writeString("Missed!\n");
-		return;
+	} else {
+		sg._mondainHits -= strike;
+		writeString("Hit Mondain! ");
+		writeString("%d damage!\n", strike);
+		playFX(2);
 	}
 
-	sg._mondainHits -= strike;
-	writeString("Hit Mondain! ");
-	writeString("%d damage!\n", strike);
-	playFX(2);
-
 	endOfTurn();
 }
 


Commit: b3f401874dc46def77ee060e16977f53455854d7
    https://github.com/scummvm/scummvm/commit/b3f401874dc46def77ee060e16977f53455854d7
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:41:07+11:00

Commit Message:
ULTIMA: ULTIMA2: Fix commands area delays

Changed paths:
    engines/ultima/ultima1/views/commands.cpp
    engines/ultima/ultima2/views/commands.cpp
    engines/ultima/ultima2/views/commands.h


diff --git a/engines/ultima/ultima1/views/commands.cpp b/engines/ultima/ultima1/views/commands.cpp
index 27577994f46..ca78160c2cf 100644
--- a/engines/ultima/ultima1/views/commands.cpp
+++ b/engines/ultima/ultima1/views/commands.cpp
@@ -110,8 +110,8 @@ void Commands::writeString(const Common::String &msg) {
 
 	flush();
 
-	// Delay after each line. For short lines, like movement east/west/etc. keep it short,
-	// but for longer lines have a more substantial delay to allow time for reading
+	// Delay after each line. For command lines, like movement east/west/etc. keep it short,
+	// but all other lines have a more substantial delay to allow time for reading
 	if (msg.contains('\n'))
 		delay(isShort ? NEWLINE_DELAY_SHORT : NEWLINE_DELAY_LONG);
 }
diff --git a/engines/ultima/ultima2/views/commands.cpp b/engines/ultima/ultima2/views/commands.cpp
index 3b07dbce344..e12bbe469d4 100644
--- a/engines/ultima/ultima2/views/commands.cpp
+++ b/engines/ultima/ultima2/views/commands.cpp
@@ -69,17 +69,16 @@ bool Commands::msgGame(const GameMessage &msg) {
 }
 
 void Commands::writeString(const Common::String &msg) {
-	// We only want short delays when printing movement actions on the map
-	bool isShort = _surface.getTextPos().x == 1 && msg.hasSuffix("\n");
-
 	_textCursor.hide();
 	_surface.setColor(Gfx::textColor(Gfx::TEXT_NORMAL));
 	_surface.writeString(msg);
 
-	// Delay after each line. For short lines, like movement east/west/etc. keep it short,
-	// but for longer lines have a more substantial delay to allow time for reading
-	if (msg.contains('\n'))
-		delay(isShort ? NEWLINE_DELAY_SHORT : NEWLINE_DELAY_LONG);
+	// Delay after each line. For command lines, like movement east/west/etc. keep it short,
+	// but for all other lines use a longer delay to give time to read it
+	if (msg.contains('\n')) {
+		delay(_isCommand ? NEWLINE_DELAY_SHORT : NEWLINE_DELAY_LONG);
+		_isCommand = false;
+	}
 }
 
 void Commands::resetLine() {
@@ -97,6 +96,7 @@ void Commands::prompt() {
 	_surface.setColor(Gfx::textColor(Gfx::TEXT_NORMAL));
 	_surface.writeString("Cmd: ");
 	showCursor();
+	_isCommand = true;
 }
 
 void Commands::delay(uint milli) {
diff --git a/engines/ultima/ultima2/views/commands.h b/engines/ultima/ultima2/views/commands.h
index e4caf93aa46..ce1b2e5722f 100644
--- a/engines/ultima/ultima2/views/commands.h
+++ b/engines/ultima/ultima2/views/commands.h
@@ -39,6 +39,7 @@ class Commands : public Graphics::Views::UIElement {
 private:
 	Graphics::Views::GfxSurface _surface;
 	Gfx::TextCursor _textCursor;
+	bool _isCommand = false;
 
 	void delay(uint milli);
 	void writeString(const Common::String &msg);


Commit: 42ca32c32227b88fdba07e1b4588166af3f4ceb7
    https://github.com/scummvm/scummvm/commit/42ca32c32227b88fdba07e1b4588166af3f4ceb7
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:41:07+11:00

Commit Message:
ULTIMA: ULTIMA2: Allow custom hp in hp console cmd

Changed paths:
    engines/ultima/ultima2/console.cpp


diff --git a/engines/ultima/ultima2/console.cpp b/engines/ultima/ultima2/console.cpp
index 3aac75b6ffc..20e1c330650 100644
--- a/engines/ultima/ultima2/console.cpp
+++ b/engines/ultima/ultima2/console.cpp
@@ -266,9 +266,10 @@ bool Console::cmdIntangible(int argc, const char **argv) {
 }
 
 bool Console::cmdHP(int argc, const char **argv) {
-	_G(savegame)._hp = 9999;
+	int hp = argc == 2 ? atoi(argv[1]) : 9999;
+	_G(savegame)._hp = hp;
 	g_engine->baseView()->findView("Stats")->draw();
-	debugPrintf("HP set to 9999\n");
+	debugPrintf("HP set to %d\n", hp);
 	return true;
 }
 


Commit: ace4c419cc94dd6c8f564b782ee725c7c69119cd
    https://github.com/scummvm/scummvm/commit/ace4c419cc94dd6c8f564b782ee725c7c69119cd
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:41:08+11:00

Commit Message:
ULTIMA: ULTIMA2: Fix stats highlight below 100

Changed paths:
    engines/ultima/ultima2/views/stats.cpp


diff --git a/engines/ultima/ultima2/views/stats.cpp b/engines/ultima/ultima2/views/stats.cpp
index 0bf630a340f..4aa7be7ebfe 100644
--- a/engines/ultima/ultima2/views/stats.cpp
+++ b/engines/ultima/ultima2/views/stats.cpp
@@ -43,12 +43,12 @@ void Stats::draw() {
 
 	s.setColor(normal);
 	s.writeString(Common::Point(0, 0), "H.P.=");
-	s.setColor(sg._hp == 0 ? highlight : normal);
+	s.setColor(sg._hp < 100 ? highlight : normal);
 	s.writeString(Common::Point(5, 0), "%4d", sg._hp);
 
 	s.setColor(normal);
 	s.writeString(Common::Point(0, 1), "Food=");
-	s.setColor(sg._food == 0 ? highlight : normal);
+	s.setColor(sg._food < 100 ? highlight : normal);
 	s.writeString(Common::Point(5, 1), "%4d", sg._food);
 
 	s.setColor(normal);


Commit: 6faae374f9af29d5c3eb1e41812b7066275d8146
    https://github.com/scummvm/scummvm/commit/6faae374f9af29d5c3eb1e41812b7066275d8146
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:41:08+11:00

Commit Message:
ULTIMA: ULTIMA2: Fixes to dead display to freeze game

Changed paths:
    engines/ultima/ultima2/logic/logic.cpp
    engines/ultima/ultima2/views/interactions/dead.cpp
    engines/ultima/ultima2/views/interactions/dead.h


diff --git a/engines/ultima/ultima2/logic/logic.cpp b/engines/ultima/ultima2/logic/logic.cpp
index f6d4db63904..bd000e2bfbe 100644
--- a/engines/ultima/ultima2/logic/logic.cpp
+++ b/engines/ultima/ultima2/logic/logic.cpp
@@ -59,8 +59,10 @@ void Logic::redrawStats() {
 
 void Logic::playerDied() {
 	Data::Savegame &sg = _G(savegame);
-	writeString("\n%s is dead!\n", sg._name);
+	sg._hp = sg._food = 0;
+	redrawStats();
 
+	writeString("\n%s is dead!\n", sg._name);
 	g_engine->replaceView("Dead", true);
 }
 
diff --git a/engines/ultima/ultima2/views/interactions/dead.cpp b/engines/ultima/ultima2/views/interactions/dead.cpp
index d61b76f9a41..ef57173cf3a 100644
--- a/engines/ultima/ultima2/views/interactions/dead.cpp
+++ b/engines/ultima/ultima2/views/interactions/dead.cpp
@@ -38,16 +38,6 @@ bool Dead::msgFocus(const FocusMessage &msg) {
 	return true;
 }
 
-bool Dead::msgAction(const ActionMessage &msg) {
-	g_engine->replaceView("Title", true);
-	return true;
-}
-
-bool Dead::msgKeypress(const KeypressMessage &msg) {
-	g_engine->replaceView("Title", true);
-	return true;
-}
-
 } // namespace Interactions
 } // namespace Views
 } // namespace Ultima2
diff --git a/engines/ultima/ultima2/views/interactions/dead.h b/engines/ultima/ultima2/views/interactions/dead.h
index 88ca1ef3958..2b52321b0a4 100644
--- a/engines/ultima/ultima2/views/interactions/dead.h
+++ b/engines/ultima/ultima2/views/interactions/dead.h
@@ -32,7 +32,7 @@ namespace Interactions {
 using namespace Graphics::Views;
 
 /**
- * Shown when the player dies, to allow them time to see the death message
+ * Shown when the player dies, consumes all events to freeze the display.
  */
 class Dead : public Interaction {
 public:
@@ -42,9 +42,6 @@ public:
 	}
 
 	bool msgFocus(const FocusMessage &msg) override;
-	bool msgAction(const ActionMessage &msg) override;
-	bool msgKeypress(const KeypressMessage &msg) override;
-	bool tick() override { return true; }
 };
 
 } // namespace Interactions


Commit: cccd713d2a775ca66de9c212e96726c49c5b1018
    https://github.com/scummvm/scummvm/commit/cccd713d2a775ca66de9c212e96726c49c5b1018
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:41:08+11:00

Commit Message:
ULTIMA: ULTIMA2: Fix using timegates

Changed paths:
    engines/ultima/ultima2/data/map.cpp


diff --git a/engines/ultima/ultima2/data/map.cpp b/engines/ultima/ultima2/data/map.cpp
index b12334dc5ac..55d964fcbaf 100644
--- a/engines/ultima/ultima2/data/map.cpp
+++ b/engines/ultima/ultima2/data/map.cpp
@@ -85,8 +85,9 @@ bool Map::canLoad(int mapEra, int mapType) const {
 		return false;
 
 	// Towers/dungeons use a different on-disk layout than the fixed-size
-	// overworld/town/castle grid, so only their existence is checked here
-	return (mapType >= 4 && mapType != 9) || f.size() == MAP_WIDTH * MAP_HEIGHT;
+	// overworld/town/castle grid, so only their existence is checked here.
+	// Many of the other files are padded out to 4224 bytes, which the game ignores
+	return (mapType >= 4 && mapType != 9) || f.size() >= (MAP_WIDTH * MAP_HEIGHT);
 }
 
 void Map::load(int mapEra, int mapType) {


Commit: 09612a26461abd88b906b38fdaf4652e58477715
    https://github.com/scummvm/scummvm/commit/09612a26461abd88b906b38fdaf4652e58477715
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:41:08+11:00

Commit Message:
ULTIMA: ULTIMA2: Renamed moongate savegame fields for clarity

Changed paths:
    engines/ultima/ultima2/data/savegame.cpp
    engines/ultima/ultima2/data/savegame.h
    engines/ultima/ultima2/logic/overworld_logic.cpp


diff --git a/engines/ultima/ultima2/data/savegame.cpp b/engines/ultima/ultima2/data/savegame.cpp
index 512dc62af20..353b09dcda6 100644
--- a/engines/ultima/ultima2/data/savegame.cpp
+++ b/engines/ultima/ultima2/data/savegame.cpp
@@ -95,9 +95,9 @@ void Savegame::synchronize(Common::Serializer &s) {
 
 	s.syncAsByte(_ringQuestFlag);
 	s.syncAsByte(_enilnoOwned);
-	s.syncAsByte(_patrolWaypoint);
-	s.syncAsByte(_patrolTimer);
-	s.syncAsByte(_patrolTerrain);
+	s.syncAsByte(_moongateWaypoint);
+	s.syncAsByte(_moongateTimer);
+	s.syncAsByte(_moongateTerrain);
 
 	s.syncAsByte(_dungeonLevel);
 	s.syncAsSByte(_facingX);
@@ -217,7 +217,7 @@ bool Savegame::importOriginal(Common::SeekableReadStream &stream) {
 	_launchMapY = buf[OFS_LAUNCH_MAP_Y];
 	_ringQuestFlag = buf[OFS_RING_QUEST_FLAG] != 0;
 	_orbitTarget = buf[OFS_ORBIT_TARGET];
-	_patrolWaypoint = buf[OFS_PATROL_WAYPOINT];
+	_moongateWaypoint = buf[OFS_PATROL_WAYPOINT];
 
 	for (int i = 0; i < 9; ++i)
 		_offerRewardItems[i] = buf[OFS_OFFER_REWARD_ITEMS + i];
@@ -281,7 +281,7 @@ void Savegame::exportOriginal(Common::WriteStream &stream) const {
 	buf[OFS_LAUNCH_MAP_Y] = _launchMapY;
 	buf[OFS_RING_QUEST_FLAG] = _ringQuestFlag ? 1 : 0;
 	buf[OFS_ORBIT_TARGET] = (byte)_orbitTarget;
-	buf[OFS_PATROL_WAYPOINT] = _patrolWaypoint;
+	buf[OFS_PATROL_WAYPOINT] = _moongateWaypoint;
 
 	for (int i = 0; i < 9; ++i)
 		buf[OFS_OFFER_REWARD_ITEMS + i] = _offerRewardItems[i];
diff --git a/engines/ultima/ultima2/data/savegame.h b/engines/ultima/ultima2/data/savegame.h
index db3f92d213f..8d6475bac2b 100644
--- a/engines/ultima/ultima2/data/savegame.h
+++ b/engines/ultima/ultima2/data/savegame.h
@@ -106,12 +106,12 @@ struct Savegame {
 
 	bool _ringQuestFlag = false;
 	bool _enilnoOwned = false;
-	byte _patrolWaypoint = 0;
+	byte _moongateWaypoint = 0;
 
 	// Turns until the moongate hops to its next waypoint, and the terrain
 	// tile it's currently covering
-	byte _patrolTimer = 0;
-	byte _patrolTerrain = 0;
+	byte _moongateTimer = 0;
+	byte _moongateTerrain = 0;
 
 	byte _offerRewardItems[9] = {};
 
diff --git a/engines/ultima/ultima2/logic/overworld_logic.cpp b/engines/ultima/ultima2/logic/overworld_logic.cpp
index a166d7337ed..f9d46f0ff9d 100644
--- a/engines/ultima/ultima2/logic/overworld_logic.cpp
+++ b/engines/ultima/ultima2/logic/overworld_logic.cpp
@@ -202,7 +202,7 @@ void OverworldLogic::enterMoongate(int x, int y) {
 
 	// Each waypoint leads to a different one of the other eras, arriving
 	// at that era's moongate for the same waypoint
-	int waypoint = sg._patrolWaypoint >> 1;
+	int waypoint = sg._moongateWaypoint >> 1;
 	int era = waypoint;
 	if (era >= sg._mapEra)
 		++era;
@@ -215,7 +215,7 @@ void OverworldLogic::enterMoongate(int x, int y) {
 		return;
 	}
 
-	_G(map)._tiles[y][x] = (Data::TileId)sg._patrolTerrain;
+	_G(map)._tiles[y][x] = (Data::TileId)sg._moongateTerrain;
 	sg._mapEra = era;
 	_G(map).load(era, 0);
 
@@ -226,7 +226,7 @@ void OverworldLogic::enterMoongate(int x, int y) {
 
 void OverworldLogic::updatePatrolMarker() {
 	Data::Savegame &sg = _G(savegame);
-	if (sg.saveDisabled() || --sg._patrolTimer != 0)
+	if (sg.saveDisabled() || --sg._moongateTimer != 0)
 		return;
 
 	auto moongateAt = [&](int waypoint) -> Data::TileId & {
@@ -234,19 +234,22 @@ void OverworldLogic::updatePatrolMarker() {
 		return _G(map)._tiles[pos[1]][pos[0]];
 	};
 
-	Data::TileId &oldTile = moongateAt(sg._patrolWaypoint >> 1);
+	Data::TileId &oldTile = moongateAt(sg._moongateWaypoint >> 1);
 	if (oldTile == Data::TILE_MOONGATE)
-		oldTile = (Data::TileId)sg._patrolTerrain;
+		oldTile = (Data::TileId)sg._moongateTerrain;
 
-	sg._patrolTimer = 8;
-	sg._patrolWaypoint = (sg._patrolWaypoint + 2) & 7;
+	sg._moongateTimer = 8;
+	sg._moongateWaypoint = (sg._moongateWaypoint + 2) & 7;
 
 	// Only bare terrain (water up to mountains) can host it
-	Data::TileId &newTile = moongateAt(sg._patrolWaypoint >> 1);
+	Data::TileId &newTile = moongateAt(sg._moongateWaypoint >> 1);
 	if (newTile > Data::TILE_MOUNTAIN)
 		return;
 
-	sg._patrolTerrain = newTile;
+	// Save the previous tile id
+	sg._moongateTerrain = newTile;
+
+	// Replace the tile with the moongate tile
 	newTile = Data::TILE_MOONGATE;
 }
 


Commit: 5c2948e59f8b95fa56f5df4e120b370977c8e092
    https://github.com/scummvm/scummvm/commit/5c2948e59f8b95fa56f5df4e120b370977c8e092
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:41:08+11:00

Commit Message:
ULTIMA: ULTIMA2: Added stats console cmd

Changed paths:
    engines/ultima/ultima2/console.cpp
    engines/ultima/ultima2/console.h


diff --git a/engines/ultima/ultima2/console.cpp b/engines/ultima/ultima2/console.cpp
index 20e1c330650..b2b7b6812a0 100644
--- a/engines/ultima/ultima2/console.cpp
+++ b/engines/ultima/ultima2/console.cpp
@@ -39,6 +39,7 @@ Console::Console() : GUI::Debugger() {
 	registerCmd("hp", WRAP_METHOD(Console, cmdHP));
 	registerCmd("food", WRAP_METHOD(Console, cmdFood));
 	registerCmd("gold", WRAP_METHOD(Console, cmdGold));
+	registerCmd("stats", WRAP_METHOD(Console, cmdStats));
 	registerCmd("inventory", WRAP_METHOD(Console, cmdInventory));
 	registerCmd("space", WRAP_METHOD(Console, cmdSpace));
 	registerCmd("load", WRAP_METHOD(Console, cmdLoad));
@@ -288,6 +289,15 @@ bool Console::cmdGold(int argc, const char **argv) {
 	return true;
 }
 
+bool Console::cmdStats(int argc, const char **argv) {
+	Data::Savegame &sg = _G(savegame);
+
+	sg._strength = sg._agility = sg._stamina = Data::MAX_BCD_BYTE;
+	sg._charisma = sg._wisdom = sg._intelligence = Data::MAX_BCD_BYTE;
+	debugPrintf("Attributes set to %d\n", Data::MAX_BCD_BYTE);
+	return true;
+}
+
 bool Console::cmdInventory(int argc, const char **argv) {
 	Data::Savegame &sg = _G(savegame);
 
diff --git a/engines/ultima/ultima2/console.h b/engines/ultima/ultima2/console.h
index 18b5393b25b..f5930d9ee64 100644
--- a/engines/ultima/ultima2/console.h
+++ b/engines/ultima/ultima2/console.h
@@ -40,6 +40,7 @@ private:
 	bool cmdHP(int argc, const char **argv);
 	bool cmdFood(int argc, const char **argv);
 	bool cmdGold(int argc, const char **argv);
+	bool cmdStats(int argc, const char **argv);
 	bool cmdInventory(int argc, const char **argv);
 	bool cmdSpace(int argc, const char **argv);
 	bool cmdLoad(int argc, const char **argv);


Commit: d965e5255713425aa9410ed9be0eee55f3b4054e
    https://github.com/scummvm/scummvm/commit/d965e5255713425aa9410ed9be0eee55f3b4054e
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:41:08+11:00

Commit Message:
ULTIMA: ULTIMA2: Added less hunger extra option

Changed paths:
    engines/ultima/detection.h
    engines/ultima/detection_tables.h
    engines/ultima/metaengine.cpp
    engines/ultima/ultima2/logic/dungeon_logic.cpp
    engines/ultima/ultima2/logic/logic.cpp
    engines/ultima/ultima2/logic/logic.h
    engines/ultima/ultima2/logic/overworld_logic.cpp
    engines/ultima/ultima2/ultima2.cpp
    engines/ultima/ultima2/ultima2.h


diff --git a/engines/ultima/detection.h b/engines/ultima/detection.h
index bd1abbdd2f4..73336885054 100644
--- a/engines/ultima/detection.h
+++ b/engines/ultima/detection.h
@@ -82,7 +82,7 @@ struct UltimaGameDescription {
 #define GAMEOPTION_CAMERA_WITH_SILENCER GUIO_GAMEOPTIONS10
 #define GAMEOPTION_ALWAYS_CHRISTMAS     GUIO_GAMEOPTIONS11
 #define GAMEOPTION_ULTIMA3_MORE_MONSTERS GUIO_GAMEOPTIONS12
-#define GAMEOPTION_ULTIMA3_LESS_HUNGER   GUIO_GAMEOPTIONS13
+#define GAMEOPTION_LESS_HUNGER           GUIO_GAMEOPTIONS13
 #define GAMEOPTION_ULTIMA3_MOON_ICONS    GUIO_GAMEOPTIONS14
 #define GAMEOPTION_ULTIMA3_MIDI_MUSIC    GUIO_GAMEOPTIONS15
 #define GAMEOPTION_ULTIMA3_TIMED_SOUNDS  GUIO_GAMEOPTIONS16
diff --git a/engines/ultima/detection_tables.h b/engines/ultima/detection_tables.h
index e0ef4799a9c..2054057ab63 100644
--- a/engines/ultima/detection_tables.h
+++ b/engines/ultima/detection_tables.h
@@ -23,8 +23,8 @@ namespace Ultima {
 
 #define GUI_OPTIONS_ULTIMA0	GUIO0()
 #define GUI_OPTIONS_ULTIMA1	GUIO0()
-#define GUI_OPTIONS_ULTIMA2	GUIO2(GAMEOPTION_ULTIMA2_STAT_BOOST, GAMEOPTION_ULTIMA2_MIXED_CASE)
-#define GUI_OPTIONS_ULTIMA3	GUIO5(GAMEOPTION_ULTIMA3_MORE_MONSTERS, GAMEOPTION_ULTIMA3_LESS_HUNGER, GAMEOPTION_ULTIMA3_MOON_ICONS, GAMEOPTION_ULTIMA3_MIDI_MUSIC, GAMEOPTION_ULTIMA3_TIMED_SOUNDS)
+#define GUI_OPTIONS_ULTIMA2	GUIO3(GAMEOPTION_ULTIMA2_STAT_BOOST, GAMEOPTION_ULTIMA2_MIXED_CASE, GAMEOPTION_LESS_HUNGER)
+#define GUI_OPTIONS_ULTIMA3	GUIO5(GAMEOPTION_ULTIMA3_MORE_MONSTERS, GAMEOPTION_LESS_HUNGER, GAMEOPTION_ULTIMA3_MOON_ICONS, GAMEOPTION_ULTIMA3_MIDI_MUSIC, GAMEOPTION_ULTIMA3_TIMED_SOUNDS)
 #define GUI_OPTIONS_ULTIMA4	GUIO1(GUIO_NOSPEECH)
 #define GUI_OPTIONS_ULTIMA6	GUIO0()
 #define GUI_OPTIONS_ULTIMA8	GUIO9(GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FRAME_SKIPPING, GAMEOPTION_FRAME_LIMITING, GAMEOPTION_CHEATS, GAMEOPTION_HIGH_RESOLUTION, GAMEOPTION_FOOTSTEP_SOUNDS, GAMEOPTION_JUMP_TO_MOUSE, GAMEOPTION_FONT_REPLACEMENT, GAMEOPTION_FONT_ANTIALIASING)
diff --git a/engines/ultima/metaengine.cpp b/engines/ultima/metaengine.cpp
index 6c630ae3980..2256758ef8a 100644
--- a/engines/ultima/metaengine.cpp
+++ b/engines/ultima/metaengine.cpp
@@ -208,10 +208,10 @@ static const ADExtraGuiOptionsMap optionsList[] = {
 		}
 	},
 	{
-		GAMEOPTION_ULTIMA3_LESS_HUNGER,
+		GAMEOPTION_LESS_HUNGER,
 		{
 			_s("Halve food consumption"),
-			_s("The party eats food at half the original rate, as in the Ultima III Upgrade"),
+			_s("Food is eaten at half the original rate. The Ultima III Upgrade does this"),
 			"less_hunger",
 			false,
 			0,
diff --git a/engines/ultima/ultima2/logic/dungeon_logic.cpp b/engines/ultima/ultima2/logic/dungeon_logic.cpp
index 65577cdc964..0b9e800b2c6 100644
--- a/engines/ultima/ultima2/logic/dungeon_logic.cpp
+++ b/engines/ultima/ultima2/logic/dungeon_logic.cpp
@@ -563,7 +563,7 @@ void DungeonLogic::updateCreatures() {
 		writeString("Torch Burned out!\n");
 	}
 
-	if (!sg.deductFood(16))
+	if (!eatFood(16))
 		playerDied();
 }
 
diff --git a/engines/ultima/ultima2/logic/logic.cpp b/engines/ultima/ultima2/logic/logic.cpp
index bd000e2bfbe..ab3f205d08c 100644
--- a/engines/ultima/ultima2/logic/logic.cpp
+++ b/engines/ultima/ultima2/logic/logic.cpp
@@ -522,12 +522,16 @@ bool Logic::offer(Data::Direction dir) {
 	return true;
 }
 
+bool Logic::eatFood(int amount) {
+	return _G(savegame).deductFood(g_engine->_lessHunger ? amount / 2 : amount);
+}
+
 bool Logic::pass() {
 	Data::Savegame &sg = _G(savegame);
 	writeString("Pass\n");
 
 	// Waiting costs a little food outside towers and dungeons
-	if (sg._mapType < 4 && !sg.deductFood(10)) {
+	if (sg._mapType < 4 && !eatFood(10)) {
 		playerDied();
 		return false;
 	}
diff --git a/engines/ultima/ultima2/logic/logic.h b/engines/ultima/ultima2/logic/logic.h
index 0c4320d6e30..29f3cbb16c2 100644
--- a/engines/ultima/ultima2/logic/logic.h
+++ b/engines/ultima/ultima2/logic/logic.h
@@ -191,6 +191,12 @@ public:
 	virtual void tick() {
 	}
 
+	/**
+	 * Uses up some food, given in hundredths of a unit, or half that if the
+	 * option for less hunger is on. Returns false if food ran out
+	 */
+	bool eatFood(int amount);
+
 	/**
 	 * Handles the player dying - clears their resources and returns to
 	 * the title screen
diff --git a/engines/ultima/ultima2/logic/overworld_logic.cpp b/engines/ultima/ultima2/logic/overworld_logic.cpp
index f9d46f0ff9d..88baaa05a94 100644
--- a/engines/ultima/ultima2/logic/overworld_logic.cpp
+++ b/engines/ultima/ultima2/logic/overworld_logic.cpp
@@ -121,7 +121,7 @@ OverworldLogic::StepResult OverworldLogic::stepOnto(int x, int y) {
 	if (sg._mapType == 0 && dest == Data::TILE_MOONGATE &&
 			sg._mount != Data::TILE_SHIP && sg._mount != Data::TILE_ROCKET) {
 		int cost = (sg._mount == Data::TILE_HORSE || sg._mount == Data::TILE_AIRPLANE) ? 50 : 25;
-		if (!sg.deductFood(cost)) {
+		if (!eatFood(cost)) {
 			playerDied();
 			return STEP_DIED;
 		}
@@ -136,7 +136,7 @@ OverworldLogic::StepResult OverworldLogic::stepOnto(int x, int y) {
 	else if (sg._mount == Data::TILE_HORSE || sg._mount == Data::TILE_AIRPLANE)
 		foodCost = 50;
 
-	if (foodCost != 0 && !sg.deductFood(foodCost)) {
+	if (foodCost != 0 && !eatFood(foodCost)) {
 		playerDied();
 		return STEP_DIED;
 	}
diff --git a/engines/ultima/ultima2/ultima2.cpp b/engines/ultima/ultima2/ultima2.cpp
index 30469ae06e5..60ce3aaef99 100644
--- a/engines/ultima/ultima2/ultima2.cpp
+++ b/engines/ultima/ultima2/ultima2.cpp
@@ -68,6 +68,7 @@ bool Ultima2Engine::isEnhanced() const {
 void Ultima2Engine::loadOptions() {
 	_statBoostChoice = Shared::configuredOption("stat_boost_choice", isEnhanced());
 	_mixedCaseText = Shared::configuredOption("mixed_case_text", isEnhanced());
+	_lessHunger = Shared::configuredOption("less_hunger", isEnhanced());
 }
 
 Common::String Ultima2Engine::getGameId() const {
diff --git a/engines/ultima/ultima2/ultima2.h b/engines/ultima/ultima2/ultima2.h
index 54994105992..fe204bb04d4 100644
--- a/engines/ultima/ultima2/ultima2.h
+++ b/engines/ultima/ultima2/ultima2.h
@@ -99,6 +99,9 @@ public:
 	// Upgrade does. When off, all text is in capitals
 	bool _mixedCaseText = false;
 
+	// Food is eaten at half the original rate
+	bool _lessHunger = false;
+
 	// Debug flag toggled by the "intangible" console command, allowing
 	// movement through normally impassable terrain
 	bool _intangible = false;


Commit: a39e7e52ae1d44ad99555c9794fa0b2689e55ecf
    https://github.com/scummvm/scummvm/commit/a39e7e52ae1d44ad99555c9794fa0b2689e55ecf
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:41:08+11:00

Commit Message:
ULTIMA: ULTIMA2: Added transport console cmd

Changed paths:
    engines/ultima/ultima2/console.cpp
    engines/ultima/ultima2/console.h


diff --git a/engines/ultima/ultima2/console.cpp b/engines/ultima/ultima2/console.cpp
index b2b7b6812a0..0b0c7df8123 100644
--- a/engines/ultima/ultima2/console.cpp
+++ b/engines/ultima/ultima2/console.cpp
@@ -39,6 +39,7 @@ Console::Console() : GUI::Debugger() {
 	registerCmd("hp", WRAP_METHOD(Console, cmdHP));
 	registerCmd("food", WRAP_METHOD(Console, cmdFood));
 	registerCmd("gold", WRAP_METHOD(Console, cmdGold));
+	registerCmd("transport", WRAP_METHOD(Console, cmdTransport));
 	registerCmd("stats", WRAP_METHOD(Console, cmdStats));
 	registerCmd("inventory", WRAP_METHOD(Console, cmdInventory));
 	registerCmd("space", WRAP_METHOD(Console, cmdSpace));
@@ -289,6 +290,96 @@ bool Console::cmdGold(int argc, const char **argv) {
 	return true;
 }
 
+bool Console::cmdTransport(int argc, const char **argv) {
+	static const Data::TileId TRANSPORTS[] = {
+		Data::TILE_HORSE, Data::TILE_SHIP, Data::TILE_AIRPLANE, Data::TILE_ROCKET
+	};
+	static const char *const NAMES[] = { "horse", "ship", "airplane", "rocket" };
+
+	// The items each needs, to board and then to launch
+	static const int ITEMS[][2] = {
+		{ -1, -1 },
+		{ Data::ITEM_BLUE_TASSLE, -1 },
+		{ Data::ITEM_SKULL_KEY, Data::ITEM_BRASS_BUTTON },
+		{ Data::ITEM_ANKH, Data::ITEM_TRI_LITHIUM }
+	};
+
+	int type = (argc == 2) ? atoi(argv[1]) : -1;
+	if (type < 0 || type >= (int)ARRAYSIZE(TRANSPORTS)) {
+		debugPrintf("transport <type>, where type is 0 for a horse, 1 for a ship, 2 for an airplane or 3 for a rocket\n");
+		return true;
+	}
+
+	Data::Savegame &sg = _G(savegame);
+	if (sg._mapType != 0) {
+		debugPrintf("Only supported on the overworld map\n");
+		return true;
+	}
+
+	Logic::OverworldLogic *logic = dynamic_cast<Logic::OverworldLogic *>(_G(logic).get());
+	assert(logic);
+
+	// Ships need water, and the others are put on grass
+	Data::TileId transport = TRANSPORTS[type];
+	Data::TileId terrain = (transport == Data::TILE_SHIP) ? Data::TILE_WATER : Data::TILE_GRASS;
+	Data::MapMonsters &monsters = _G(map)._monsters;
+
+	// Boarding means stepping onto it from the side, so one that's only
+	// diagonally next to somewhere to walk from can't be reached
+	auto reachable = [&](int x, int y) {
+		static const int OFFSETS[4][2] = { { 0, -1 }, { 0, 1 }, { -1, 0 }, { 1, 0 } };
+		for (int i = 0; i < 4; ++i) {
+			int nx = (x + OFFSETS[i][0] + Data::MAP_WIDTH) % Data::MAP_WIDTH;
+			int ny = (y + OFFSETS[i][1] + Data::MAP_HEIGHT) % Data::MAP_HEIGHT;
+			if (logic->isWalkable(_G(map).tileAt(nx, ny)))
+				return true;
+		}
+
+		return false;
+	};
+
+	// Prefer tiles that can be reached, but settle for any if there aren't any
+	for (int pass = 0; pass < 2; ++pass) {
+		for (int radius = 1; radius <= 10; ++radius) {
+			for (int dy = -radius; dy <= radius; ++dy) {
+				for (int dx = -radius; dx <= radius; ++dx) {
+					if (MAX(ABS(dx), ABS(dy)) != radius)
+						continue;
+
+					int x = (sg._mapX + dx + Data::MAP_WIDTH) % Data::MAP_WIDTH;
+					int y = (sg._mapY + dy + Data::MAP_HEIGHT) % Data::MAP_HEIGHT;
+					if (_G(map).tileAt(x, y) != terrain || (pass == 0 && !reachable(x, y)))
+						continue;
+
+					bool occupied = false;
+					for (int i = 0; i < Data::MAP_MONSTER_COUNT && !occupied; ++i)
+						occupied = monsters.isActive(i) && monsters._mapX[i] == x && monsters._mapY[i] == y;
+					if (occupied)
+						continue;
+
+					_G(map)._tiles[y][x] = transport;
+					g_engine->focusedView()->redraw();
+					debugPrintf("Spawned a %s at (%d,%d)\n", NAMES[type], x, y);
+
+					// Give any items needed to board and launch it that aren't already owned
+					for (int i = 0; i < 2 && ITEMS[type][i] >= 0; ++i) {
+						int item = ITEMS[type][i];
+						if (sg._items[item] == 0) {
+							sg._items[item] = 1;
+							debugPrintf("Added %s\n", Data::itemName(item));
+						}
+					}
+
+					return true;
+				}
+			}
+		}
+	}
+
+	debugPrintf("Couldn't find a free %s tile nearby\n", (terrain == Data::TILE_WATER) ? "water" : "grass");
+	return true;
+}
+
 bool Console::cmdStats(int argc, const char **argv) {
 	Data::Savegame &sg = _G(savegame);
 
diff --git a/engines/ultima/ultima2/console.h b/engines/ultima/ultima2/console.h
index f5930d9ee64..8894bd05868 100644
--- a/engines/ultima/ultima2/console.h
+++ b/engines/ultima/ultima2/console.h
@@ -40,6 +40,7 @@ private:
 	bool cmdHP(int argc, const char **argv);
 	bool cmdFood(int argc, const char **argv);
 	bool cmdGold(int argc, const char **argv);
+	bool cmdTransport(int argc, const char **argv);
 	bool cmdStats(int argc, const char **argv);
 	bool cmdInventory(int argc, const char **argv);
 	bool cmdSpace(int argc, const char **argv);


Commit: e9afefc9bc1efa9503f98e94e80985f87972b700
    https://github.com/scummvm/scummvm/commit/e9afefc9bc1efa9503f98e94e80985f87972b700
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:41:08+11:00

Commit Message:
ULTIMA: ULTIMA2: Savegane caching visited maps, version field

Changed paths:
    engines/ultima/ultima1/ultima1.cpp
    engines/ultima/ultima2/console.cpp
    engines/ultima/ultima2/data/map.cpp
    engines/ultima/ultima2/data/map.h
    engines/ultima/ultima2/logic/logic.cpp
    engines/ultima/ultima2/logic/overworld_logic.cpp
    engines/ultima/ultima2/ultima2.cpp
    engines/ultima/ultima2/views/create_character.cpp
    engines/ultima/ultima2/views/interactions/yell.cpp
    engines/ultima/ultima3/ultima3.cpp


diff --git a/engines/ultima/ultima1/ultima1.cpp b/engines/ultima/ultima1/ultima1.cpp
index c901e03fda5..a5919a0e84d 100644
--- a/engines/ultima/ultima1/ultima1.cpp
+++ b/engines/ultima/ultima1/ultima1.cpp
@@ -39,6 +39,8 @@
 namespace Ultima {
 namespace Ultima1 {
 
+constexpr int SAVEGAME_VERSION = 1;
+
 Ultima1Engine *g_engine;
 
 Ultima1Engine::Ultima1Engine(OSystem *syst, const Ultima::UltimaGameDescription *gameDesc) :
@@ -105,6 +107,8 @@ bool Ultima1Engine::canLoadGameStateCurrently(Common::U32String *msg) {
 }
 
 Common::Error Ultima1Engine::syncGame(Common::Serializer &s) {
+	s.syncVersion(SAVEGAME_VERSION);
+
 	_savegame.synchronize(s);
 
 	if (s.isLoading()) {
diff --git a/engines/ultima/ultima2/console.cpp b/engines/ultima/ultima2/console.cpp
index 0b0c7df8123..54545cc9849 100644
--- a/engines/ultima/ultima2/console.cpp
+++ b/engines/ultima/ultima2/console.cpp
@@ -478,6 +478,7 @@ bool Console::cmdLoad(int argc, const char **argv) {
 		return true;
 	}
 
+	_G(map).clearSaved();
 	_G(map).load(sg._mapEra, sg._mapType);
 	_G(logic)->entering();
 	debugPrintf("Imported %s: %s, HP=%d food=%d gold=%d, at (%d,%d) era %d type %d\n",
diff --git a/engines/ultima/ultima2/data/map.cpp b/engines/ultima/ultima2/data/map.cpp
index 55d964fcbaf..56cd3772acd 100644
--- a/engines/ultima/ultima2/data/map.cpp
+++ b/engines/ultima/ultima2/data/map.cpp
@@ -96,28 +96,40 @@ void Map::load(int mapEra, int mapType) {
 		return;
 	}
 
-	Common::File f;
 	Common::String filename = mapFilename(mapEra, mapType);
-	if (!f.open(filename.c_str()))
-		error("Could not open %s", filename.c_str());
+	auto saved = (mapType == 0) ? _saved.find(filename) : _saved.end();
 
-	for (int y = 0; y < MAP_HEIGHT; ++y) {
-		for (int x = 0; x < MAP_WIDTH; ++x)
-			_tiles[y][x] = (TileId)(f.readByte() / 4);
-	}
+	if (saved != _saved.end()) {
+		for (int y = 0; y < MAP_HEIGHT; ++y) {
+			for (int x = 0; x < MAP_WIDTH; ++x)
+				_tiles[y][x] = (TileId)saved->_value._tiles[y][x];
+		}
 
-	_monsters.load(mapEra, mapType);
-	loadTalk(mapEra, mapType);
+		_monsters = saved->_value._monsters;
+		loadTalk(mapEra, mapType);
+	} else {
+		Common::File f;
+		if (!f.open(filename.c_str()))
+			error("Could not open %s", filename.c_str());
 
-	// The files store each monster's tile baked into the map; restore the
-	// terrain underneath, since monsters are tracked and drawn separately
-	for (int slot = 0; slot < MAP_MONSTER_COUNT; ++slot) {
-		if (!_monsters.isActive(slot))
-			continue;
+		for (int y = 0; y < MAP_HEIGHT; ++y) {
+			for (int x = 0; x < MAP_WIDTH; ++x)
+				_tiles[y][x] = (TileId)(f.readByte() / 4);
+		}
+
+		_monsters.load(mapEra, mapType);
+		loadTalk(mapEra, mapType);
 
-		int x = _monsters._mapX[slot], y = _monsters._mapY[slot];
-		if (x < MAP_WIDTH && y < MAP_HEIGHT && _tiles[y][x] == _monsters.tileType(slot))
-			_tiles[y][x] = (TileId)(_monsters._glyphTile[slot] / 4);
+		// The files store each monster's tile baked into the map; restore the
+		// terrain underneath, since monsters are tracked and drawn separately
+		for (int slot = 0; slot < MAP_MONSTER_COUNT; ++slot) {
+			if (!_monsters.isActive(slot))
+				continue;
+
+			int x = _monsters._mapX[slot], y = _monsters._mapY[slot];
+			if (x < MAP_WIDTH && y < MAP_HEIGHT && _tiles[y][x] == _monsters.tileType(slot))
+				_tiles[y][x] = (TileId)(_monsters._glyphTile[slot] / 4);
+		}
 	}
 
 	if (mapType == 0)
@@ -128,6 +140,42 @@ void Map::load(int mapEra, int mapType) {
 	showMapView(mapType == 0 ? "OverworldMap" : "LocationMap");
 }
 
+void Map::saveOverworld() {
+	SavedMap &saved = _saved[mapFilename(_G(savegame)._mapEra, 0)];
+
+	for (int y = 0; y < MAP_HEIGHT; ++y) {
+		for (int x = 0; x < MAP_WIDTH; ++x)
+			saved._tiles[y][x] = _tiles[y][x];
+	}
+
+	saved._monsters = _monsters;
+}
+
+void Map::synchronizeSaved(Common::Serializer &s) {
+	uint32 count = _saved.size();
+	s.syncAsUint32LE(count);
+
+	if (s.isSaving()) {
+		for (auto &it : _saved) {
+			Common::String name = it._key;
+			s.syncString(name);
+			s.syncBytes(&it._value._tiles[0][0], MAP_WIDTH * MAP_HEIGHT);
+			it._value._monsters.synchronize(s);
+		}
+	} else {
+		_saved.clear();
+
+		for (uint32 i = 0; i < count; ++i) {
+			Common::String name;
+			s.syncString(name);
+
+			SavedMap &saved = _saved[name];
+			s.syncBytes(&saved._tiles[0][0], MAP_WIDTH * MAP_HEIGHT);
+			saved._monsters.synchronize(s);
+		}
+	}
+}
+
 void Map::synchronize(Common::Serializer &s, bool isDungeon) {
 	_monsters.synchronize(s);
 
diff --git a/engines/ultima/ultima2/data/map.h b/engines/ultima/ultima2/data/map.h
index caa5c06c960..aa1760b97b8 100644
--- a/engines/ultima/ultima2/data/map.h
+++ b/engines/ultima/ultima2/data/map.h
@@ -23,6 +23,7 @@
 #define ULTIMA2_DATA_MAP_H
 
 #include "common/array.h"
+#include "common/hash-str.h"
 #include "common/serializer.h"
 #include "common/str.h"
 #include "ultima/ultima2/data/tiles.h"
@@ -52,6 +53,17 @@ struct Map {
 	Common::Array<Common::String> _talk;
 
 private:
+	/**
+	 * An overworld map as it was when the party last left it. The original
+	 * writes these back to its map files, so that changes like a vehicle left
+	 * behind are still there when the party returns
+	 */
+	struct SavedMap {
+		byte _tiles[MAP_HEIGHT][MAP_WIDTH];
+		MapMonsters _monsters;
+	};
+	Common::HashMap<Common::String, SavedMap> _saved;
+
 	void loadTalk(int mapEra, int mapType);
 
 	/**
@@ -86,6 +98,24 @@ public:
 	 */
 	void synchronize(Common::Serializer &s, bool isDungeon);
 
+	/**
+	 * Keeps the current overworld map as it is, to be loaded again in place
+	 * of the one in its file. Called before leaving it for somewhere else
+	 */
+	void saveOverworld();
+
+	/**
+	 * Forgets all the overworld maps that were kept
+	 */
+	void clearSaved() {
+		_saved.clear();
+	}
+
+	/**
+	 * Saves or restores the overworld maps that were kept
+	 */
+	void synchronizeSaved(Common::Serializer &s);
+
 	/**
 	 * Returns the given line of the map's NPC dialogue, or an empty string
 	 * if there isn't one
diff --git a/engines/ultima/ultima2/logic/logic.cpp b/engines/ultima/ultima2/logic/logic.cpp
index ab3f205d08c..4d76c56d14d 100644
--- a/engines/ultima/ultima2/logic/logic.cpp
+++ b/engines/ultima/ultima2/logic/logic.cpp
@@ -479,6 +479,7 @@ bool Logic::launch() {
 			sg._inSpace = true;
 		}
 
+		_G(map).saveOverworld();
 		SpaceLogic::takeOff();
 		return false;
 	} else {
diff --git a/engines/ultima/ultima2/logic/overworld_logic.cpp b/engines/ultima/ultima2/logic/overworld_logic.cpp
index 88baaa05a94..d89b5ad0e39 100644
--- a/engines/ultima/ultima2/logic/overworld_logic.cpp
+++ b/engines/ultima/ultima2/logic/overworld_logic.cpp
@@ -216,6 +216,7 @@ void OverworldLogic::enterMoongate(int x, int y) {
 	}
 
 	_G(map)._tiles[y][x] = (Data::TileId)sg._moongateTerrain;
+	_G(map).saveOverworld();
 	sg._mapEra = era;
 	_G(map).load(era, 0);
 
@@ -725,6 +726,7 @@ void OverworldLogic::enterLocalMap(int mapType) {
 	Data::Savegame &sg = _G(savegame);
 	sg._overworldReturnX = sg._mapX;
 	sg._overworldReturnY = sg._mapY;
+	_G(map).saveOverworld();
 	sg._mapX = 31;
 	sg._mapY = 62;
 	sg._mapType = mapType;
@@ -735,6 +737,7 @@ void OverworldLogic::enterDungeon(int mapType) {
 	Data::Savegame &sg = _G(savegame);
 	sg._overworldReturnX = sg._mapX;
 	sg._overworldReturnY = sg._mapY;
+	_G(map).saveOverworld();
 	sg._mapX = 5;
 	sg._mapY = 5;
 	sg._dungeonLevel = 0;
diff --git a/engines/ultima/ultima2/ultima2.cpp b/engines/ultima/ultima2/ultima2.cpp
index 60ce3aaef99..52521099509 100644
--- a/engines/ultima/ultima2/ultima2.cpp
+++ b/engines/ultima/ultima2/ultima2.cpp
@@ -40,6 +40,8 @@
 namespace Ultima {
 namespace Ultima2 {
 
+constexpr int SAVEGAME_VERSION = 1;
+
 Ultima2Engine *g_engine;
 
 Ultima2Engine::Ultima2Engine(OSystem *syst, const Ultima::UltimaGameDescription *gameDesc) :
@@ -158,8 +160,15 @@ bool Ultima2Engine::canLoadGameStateCurrently(Common::U32String *msg) {
 }
 
 Common::Error Ultima2Engine::syncGame(Common::Serializer &s) {
+	Common::Serializer::Version version = SAVEGAME_VERSION;
+	s.syncAsUint32LE(version);
+	s.setVersion(version);
+
 	_savegame.synchronize(s);
 
+	// The overworld maps that have been left need to be in place before the map is loaded
+	_G(map).synchronizeSaved(s);
+
 	if (s.isLoading()) {
 		if (_G(savegame)._inFlight)
 			Logic::SpaceLogic::resume();
diff --git a/engines/ultima/ultima2/views/create_character.cpp b/engines/ultima/ultima2/views/create_character.cpp
index 4474f403300..e0d8dade6b1 100644
--- a/engines/ultima/ultima2/views/create_character.cpp
+++ b/engines/ultima/ultima2/views/create_character.cpp
@@ -45,6 +45,7 @@ void CreateCharacter::reset() {
 	_name.clear();
 
 	_G(savegame) = Data::Savegame();
+	_G(map).clearSaved();
 	positionCursor();
 	redraw();
 }
diff --git a/engines/ultima/ultima2/views/interactions/yell.cpp b/engines/ultima/ultima2/views/interactions/yell.cpp
index 801b900a4b9..6d2a4bf2000 100644
--- a/engines/ultima/ultima2/views/interactions/yell.cpp
+++ b/engines/ultima/ultima2/views/interactions/yell.cpp
@@ -52,6 +52,7 @@ bool Yell::msgKeypress(const KeypressMessage &msg) {
 			sg._items[Data::ITEM_HELM] = MIN(sg._items[Data::ITEM_HELM] + 1, Data::MAX_BCD_BYTE);
 
 			// Show the ScummVM secret map
+			_G(map).saveOverworld();
 			sg._overworldReturnX = sg._mapX;
 			sg._overworldReturnY = sg._mapY;
 			sg._mapX = 31;
diff --git a/engines/ultima/ultima3/ultima3.cpp b/engines/ultima/ultima3/ultima3.cpp
index ebcacb156db..8dfed678565 100644
--- a/engines/ultima/ultima3/ultima3.cpp
+++ b/engines/ultima/ultima3/ultima3.cpp
@@ -40,6 +40,8 @@
 namespace Ultima {
 namespace Ultima3 {
 
+constexpr int SAVEGAME_VERSION = 6;
+
 Ultima3Engine *g_engine;
 
 // The renderer stored in the configuration, falling back to the default one
@@ -157,7 +159,7 @@ bool Ultima3Engine::canLoadGameStateCurrently(Common::U32String *msg) {
 }
 
 Common::Error Ultima3Engine::syncGame(Common::Serializer &s) {
-	s.syncVersion(6);
+	s.syncVersion(SAVEGAME_VERSION);
 
 	_savegame.synchronize(s);
 	if (_savegame._mapLoaded) {


Commit: 75a318d2e4dea1a7ca6ee7065dcadd339e0b918f
    https://github.com/scummvm/scummvm/commit/75a318d2e4dea1a7ca6ee7065dcadd339e0b918f
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:41:08+11:00

Commit Message:
ULTIMA: ULTIMA2: Fix message for exploding in space

Changed paths:
    engines/ultima/ultima2/logic/logic.cpp
    engines/ultima/ultima2/logic/logic.h
    engines/ultima/ultima2/logic/space_logic.cpp


diff --git a/engines/ultima/ultima2/logic/logic.cpp b/engines/ultima/ultima2/logic/logic.cpp
index 4d76c56d14d..c598f192756 100644
--- a/engines/ultima/ultima2/logic/logic.cpp
+++ b/engines/ultima/ultima2/logic/logic.cpp
@@ -57,12 +57,13 @@ void Logic::redrawStats() {
 		view->draw();
 }
 
-void Logic::playerDied() {
+void Logic::playerDied(bool showDied) {
 	Data::Savegame &sg = _G(savegame);
 	sg._hp = sg._food = 0;
 	redrawStats();
 
-	writeString("\n%s is dead!\n", sg._name);
+	if (showDied)
+		writeString("\n%s is dead!\n", sg._name);
 	g_engine->replaceView("Dead", true);
 }
 
diff --git a/engines/ultima/ultima2/logic/logic.h b/engines/ultima/ultima2/logic/logic.h
index 29f3cbb16c2..219862fec8e 100644
--- a/engines/ultima/ultima2/logic/logic.h
+++ b/engines/ultima/ultima2/logic/logic.h
@@ -201,7 +201,7 @@ public:
 	 * Handles the player dying - clears their resources and returns to
 	 * the title screen
 	 */
-	void playerDied();
+	void playerDied(bool showDied = true);
 
 	/**
 	 * Resumes end of turn processing after a command deferred it (returned
diff --git a/engines/ultima/ultima2/logic/space_logic.cpp b/engines/ultima/ultima2/logic/space_logic.cpp
index 5283bc8c5d6..b2458471bb7 100644
--- a/engines/ultima/ultima2/logic/space_logic.cpp
+++ b/engines/ultima/ultima2/logic/space_logic.cpp
@@ -130,7 +130,7 @@ void SpaceLogic::warpFinished() {
 
 		if (sg._readiedArmor < SAFE_ARMOR) {
 			writeString("\nYou have exploded!\n\n");
-			playerDied();
+			playerDied(false);
 			return;
 		}
 	}


Commit: 53f74b7e23a89cc3e45edf0ee63df16ad9179f67
    https://github.com/scummvm/scummvm/commit/53f74b7e23a89cc3e45edf0ee63df16ad9179f67
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:41:08+11:00

Commit Message:
ULTIMA: ULTIMA2: Fix text after selecting hyperwarp dest

Changed paths:
    engines/ultima/ultima2/logic/space_logic.cpp
    engines/ultima/ultima2/views/space_map.cpp


diff --git a/engines/ultima/ultima2/logic/space_logic.cpp b/engines/ultima/ultima2/logic/space_logic.cpp
index b2458471bb7..0ddb78938ae 100644
--- a/engines/ultima/ultima2/logic/space_logic.cpp
+++ b/engines/ultima/ultima2/logic/space_logic.cpp
@@ -71,6 +71,7 @@ void SpaceLogic::takeOff() {
 	_G(logic) = Common::SharedPtr<Logic>(logic);
 
 	showSpaceView();
+	g_engine->focusedView()->send(Graphics::Views::GameMessage("LAUNCH"));
 }
 
 void SpaceLogic::resume() {
diff --git a/engines/ultima/ultima2/views/space_map.cpp b/engines/ultima/ultima2/views/space_map.cpp
index ec6acfc0191..40d557c4a49 100644
--- a/engines/ultima/ultima2/views/space_map.cpp
+++ b/engines/ultima/ultima2/views/space_map.cpp
@@ -43,6 +43,12 @@ SpaceMap::SpaceMap() : View("SpaceMap") {
 }
 
 bool SpaceMap::msgGame(const GameMessage &msg) {
+	if (msg._name == "LAUNCH") {
+		// The rocket has just taken off
+		startWarp();
+		return true;
+	}
+
 	// The starfield is drawn differently by the composite renderer
 	if (msg._name == "RELOAD_TILES")
 		redraw();
@@ -76,7 +82,6 @@ bool SpaceMap::msgFocus(const FocusMessage &msg) {
 	_shipX = 0x80;
 	_shipY = 0x40;
 	_speed = 0x80;
-	startWarp();
 	return View::msgFocus(msg);
 }
 


Commit: 3989d10c9cbf0eee159dd4aa449a0c5716995e4a
    https://github.com/scummvm/scummvm/commit/3989d10c9cbf0eee159dd4aa449a0c5716995e4a
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:41:08+11:00

Commit Message:
ULTIMA: ULTIMA2: Landing message fix

Changed paths:
    engines/ultima/ultima2/views/interactions/interaction.cpp
    engines/ultima/ultima2/views/interactions/interaction.h
    engines/ultima/ultima2/views/interactions/rocket_landing.cpp


diff --git a/engines/ultima/ultima2/views/interactions/interaction.cpp b/engines/ultima/ultima2/views/interactions/interaction.cpp
index 7991a538155..0426eaf52d5 100644
--- a/engines/ultima/ultima2/views/interactions/interaction.cpp
+++ b/engines/ultima/ultima2/views/interactions/interaction.cpp
@@ -52,6 +52,10 @@ void Interaction::writeString(const char *format, ...) {
 	writeString(msg);
 }
 
+void Interaction::resetLine() {
+	g_engine->baseView()->findView("Commands")->send(GameMessage("RESET_LINE"));
+}
+
 void Interaction::prompt() {
 	g_engine->baseView()->findView("Commands")->send(GameMessage("PROMPT"));
 }
diff --git a/engines/ultima/ultima2/views/interactions/interaction.h b/engines/ultima/ultima2/views/interactions/interaction.h
index 39ac73b7a25..98646d45e64 100644
--- a/engines/ultima/ultima2/views/interactions/interaction.h
+++ b/engines/ultima/ultima2/views/interactions/interaction.h
@@ -43,6 +43,11 @@ protected:
 	void writeString(const char *format, ...);
 	void prompt();
 
+	/**
+	 * Clears the Commands window's current line, such as the prompt
+	 */
+	void resetLine();
+
 public:
 	Interaction(const Common::String &name);
 	~Interaction() override {}
diff --git a/engines/ultima/ultima2/views/interactions/rocket_landing.cpp b/engines/ultima/ultima2/views/interactions/rocket_landing.cpp
index b5a80f6ff4d..b419799b941 100644
--- a/engines/ultima/ultima2/views/interactions/rocket_landing.cpp
+++ b/engines/ultima/ultima2/views/interactions/rocket_landing.cpp
@@ -37,6 +37,11 @@ bool RocketLanding::msgFocus(const FocusMessage &msg) {
 	MetaEngine::setKeybindingMode(KBMODE_MINIMAL);
 	_lastStep = g_system->getMillis();
 
+	// The map being shown has wiped the commands that got the ship here, so show them again
+	int world = _G(savegame)._orbitTarget;
+	resetLine();
+	writeString("Cmd: Landing requested!\n");
+	writeString("You are orbiting %s.\n", world < Data::PLANET_COUNT ? Data::PLANET_NAMES[world] : "X");
 	writeString("(Press Any Key)");
 	return Interaction::msgFocus(msg);
 }


Commit: 1af958b61c811888ca3601df81610e5bb53477fc
    https://github.com/scummvm/scummvm/commit/1af958b61c811888ca3601df81610e5bb53477fc
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:41:08+11:00

Commit Message:
ULTIMA: ULTIMA2: Fix NPC movement in cities/caastles

Changed paths:
    engines/ultima/ultima2/logic/city_castle_logic.cpp
    engines/ultima/ultima2/logic/city_castle_logic.h


diff --git a/engines/ultima/ultima2/logic/city_castle_logic.cpp b/engines/ultima/ultima2/logic/city_castle_logic.cpp
index ba27da607dd..83e0467fad6 100644
--- a/engines/ultima/ultima2/logic/city_castle_logic.cpp
+++ b/engines/ultima/ultima2/logic/city_castle_logic.cpp
@@ -104,33 +104,38 @@ void CityCastleLogic::updateCreatures() {
 		if (flag <= 0)
 			continue; // at rest (0), or a shop/quest NPC (negative/high-bit) - never moves
 
-		int sdx, sdy;
-		if (flag <= 2) {
-			int dx = sg._mapX - monsters._mapX[slot];
-			int dy = sg._mapY - monsters._mapY[slot];
-			sdx = signByte(dx * 4);
-			sdy = signByte(dy * 4);
-
-			// Hostile monsters below 15 HP flee instead of approaching
-			if (flag == 1 && monsters._spellHP[slot] < 15) {
-				sdx = -sdx;
-				sdy = -sdy;
+		if (flag >= 3) {
+			// Wanderers keep heading the way they were going (kept in _tempX/Y),
+			// picking a new random diagonal direction a quarter of the time
+			if (randByte() < 0x40) {
+				monsters._tempX[slot] = (byte)signByte(randByte());
+				monsters._tempY[slot] = (byte)signByte(randByte());
 			}
-		} else {
-			// Wander: 75% chance to pick a fresh random direction, else
-			// keep going the way it was already headed (kept in _tempX/Y)
-			if (randByte() < 0xC0 || (monsters._tempX[slot] == 0 && monsters._tempY[slot] == 0)) {
-				static const int8 DX[4] = { 0, 0, -1, 1 };
-				static const int8 DY[4] = { -1, 1, 0, 0 };
-				int r = randByte() & 3;
-				sdx = DX[r];
-				sdy = DY[r];
-				monsters._tempX[slot] = (byte)sdx;
-				monsters._tempY[slot] = (byte)sdy;
-			} else {
-				sdx = (int8)monsters._tempX[slot];
-				sdy = (int8)monsters._tempY[slot];
+
+			// They stay clear of the edges of the map and of the player's row and
+			// column, and only walk on grass and roads
+			int newX = (monsters._mapX[slot] + (int8)monsters._tempX[slot]) & 0x3F;
+			int newY = (monsters._mapY[slot] + (int8)monsters._tempY[slot]) & 0x3F;
+			if (newX >= 4 && newX < 0x3C && newX != sg._mapX && newY >= 4 && newY < 0x3C && newY != sg._mapY) {
+				Data::TileId tile = _G(map).tileAt(newX, newY);
+				if ((tile == Data::TILE_GRASS || tile == Data::TILE_ROAD) && !isOccupied(newX, newY)) {
+					monsters._mapX[slot] = newX;
+					monsters._mapY[slot] = newY;
+				}
 			}
+
+			continue;
+		}
+
+		int dx = sg._mapX - monsters._mapX[slot];
+		int dy = sg._mapY - monsters._mapY[slot];
+		int sdx = signByte(dx * 4);
+		int sdy = signByte(dy * 4);
+
+		// Hostile monsters below 15 HP flee instead of approaching
+		if (flag == 1 && monsters._spellHP[slot] < 15) {
+			sdx = -sdx;
+			sdy = -sdy;
 		}
 
 		int newX = (monsters._mapX[slot] + sdx + Data::MAP_WIDTH) % Data::MAP_WIDTH;
@@ -151,8 +156,8 @@ void CityCastleLogic::updateCreatures() {
 			if (monsters._spellHP[slot] < 16)
 				++monsters._spellHP[slot];
 
-			if (!tryMoveMonster(slot, sdx, sdy) && !tryMoveMonster(slot, 0, sdy))
-				tryMoveMonster(slot, sdx, 0);
+			if (!tryMoveCityMonster(slot, sdx, sdy) && !tryMoveCityMonster(slot, 0, sdy))
+				tryMoveCityMonster(slot, sdx, 0);
 		}
 	}
 
@@ -173,6 +178,39 @@ void CityCastleLogic::updateCreatures() {
 	// Villages/towns/castles don't spawn new monsters
 }
 
+bool CityCastleLogic::cityMonsterCanEnter(int slot, int x, int y) const {
+	Data::Savegame &sg = _G(savegame);
+	Data::MapMonsters &monsters = _G(map)._monsters;
+
+	// Nothing moves while time is negated
+	if (sg._negateTimeTurns > 0)
+		return false;
+
+	// Only grass, forest and roads can be walked on, and forcefields by all but the
+	// player's classes. The first row and column of a settlement's map can't be entered,
+	// which keeps them from wrapping around its edges
+	Data::TileId tile = _G(map).tileAt(x, y);
+	bool passable = tile == Data::TILE_GRASS || tile == Data::TILE_FOREST || tile == Data::TILE_ROAD ||
+		(tile == Data::TILE_FORCEFIELD && monsters._type[slot] < 0x78);
+
+	return passable && x != 0 && y != 0 && (x != sg._mapX || y != sg._mapY) && !isOccupied(x, y);
+}
+
+bool CityCastleLogic::tryMoveCityMonster(int slot, int dx, int dy) {
+	if (dx == 0 && dy == 0)
+		return false;
+
+	Data::MapMonsters &monsters = _G(map)._monsters;
+	int newX = (monsters._mapX[slot] + dx + Data::MAP_WIDTH) % Data::MAP_WIDTH;
+	int newY = (monsters._mapY[slot] + dy + Data::MAP_HEIGHT) % Data::MAP_HEIGHT;
+	if (!cityMonsterCanEnter(slot, newX, newY))
+		return false;
+
+	monsters._mapX[slot] = newX;
+	monsters._mapY[slot] = newY;
+	return true;
+}
+
 bool CityCastleLogic::steal(Data::Direction dir) {
 	if (dir == Data::DIR_UNSPECIFIED) {
 		writeString("Steal direct-");
diff --git a/engines/ultima/ultima2/logic/city_castle_logic.h b/engines/ultima/ultima2/logic/city_castle_logic.h
index a2e3b21b34d..38ac86531ae 100644
--- a/engines/ultima/ultima2/logic/city_castle_logic.h
+++ b/engines/ultima/ultima2/logic/city_castle_logic.h
@@ -55,6 +55,17 @@ private:
 	 */
 	void boostAttribute(int stat, int goldHundreds);
 
+	/**
+	 * Returns true if the monster in a slot can step onto (x,y)
+	 */
+	bool cityMonsterCanEnter(int slot, int x, int y) const;
+
+	/**
+	 * Attempts to move a monster by the given delta, wrapping around the
+	 * map; returns false if blocked
+	 */
+	bool tryMoveCityMonster(int slot, int dx, int dy);
+
 	/**
 	 * Returns true if a shopkeeper is currently standing at (x,y)
 	 */


Commit: 5cae9647cdf90639179d60a3709e6043d5b7fba9
    https://github.com/scummvm/scummvm/commit/5cae9647cdf90639179d60a3709e6043d5b7fba9
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:41:08+11:00

Commit Message:
ULTIMA: ULTIMA2: Fix overworld negate time

Changed paths:
    engines/ultima/ultima2/logic/overworld_logic.cpp


diff --git a/engines/ultima/ultima2/logic/overworld_logic.cpp b/engines/ultima/ultima2/logic/overworld_logic.cpp
index d89b5ad0e39..b176f92ef51 100644
--- a/engines/ultima/ultima2/logic/overworld_logic.cpp
+++ b/engines/ultima/ultima2/logic/overworld_logic.cpp
@@ -270,6 +270,10 @@ int OverworldLogic::findTargetMonster(int x, int y) const {
 }
 
 bool OverworldLogic::monsterCanEnter(Data::TileId monsterTile, Data::TileId destTile, int x, int y) const {
+	// Nothing moves while time is negated
+	if (_G(savegame)._negateTimeTurns > 0)
+		return false;
+
 	if (monsterTile == Data::TILE_SEA_MONSTER || monsterTile == Data::TILE_SHIP)
 		return destTile == Data::TILE_WATER;
 


Commit: c25b4d4dd6f13d10b84ae4c962afec451c39806d
    https://github.com/scummvm/scummvm/commit/c25b4d4dd6f13d10b84ae4c962afec451c39806d
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:41:08+11:00

Commit Message:
ULTIMA: ULTIMA2: Fix transact with fixed place shopkeepers

Changed paths:
    engines/ultima/ultima2/logic/city_castle_logic.cpp


diff --git a/engines/ultima/ultima2/logic/city_castle_logic.cpp b/engines/ultima/ultima2/logic/city_castle_logic.cpp
index 83e0467fad6..4144dbc587b 100644
--- a/engines/ultima/ultima2/logic/city_castle_logic.cpp
+++ b/engines/ultima/ultima2/logic/city_castle_logic.cpp
@@ -30,8 +30,13 @@ bool CityCastleLogic::shopkeeperAt(int x, int y) const {
 	if (x < 0 || x >= Data::MAP_WIDTH || y < 0 || y >= Data::MAP_HEIGHT)
 		return false;
 
+	// A monster moving about is a shopkeeper only if that's what it is, but
+	// some are part of the map itself and have no monster slot
 	int slot = findTargetMonster(x, y);
-	return slot >= 0 && _G(map)._monsters.tileType(slot) == Data::TILE_SHOPKEEP;
+	if (slot >= 0)
+		return _G(map)._monsters.tileType(slot) == Data::TILE_SHOPKEEP;
+
+	return _G(map).tileAt(x, y) == Data::TILE_SHOPKEEP;
 }
 
 void CityCastleLogic::exitToOverworld() {


Commit: c084f87c779cc9cf58fd65a8d914e0bc65af005c
    https://github.com/scummvm/scummvm/commit/c084f87c779cc9cf58fd65a8d914e0bc65af005c
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:41:08+11:00

Commit Message:
ULTIMA: ULTIMA2: Map pass command to space key as well

Changed paths:
    engines/ultima/ultima2/metaengine.cpp


diff --git a/engines/ultima/ultima2/metaengine.cpp b/engines/ultima/ultima2/metaengine.cpp
index cc689c9f282..ff3058b532c 100644
--- a/engines/ultima/ultima2/metaengine.cpp
+++ b/engines/ultima/ultima2/metaengine.cpp
@@ -65,7 +65,7 @@ static const KeybindingRecord GAMEPLAY_KEYS[] = {
 	{ KEYBIND_MAGIC, "MAGIC", _s("Magic"), "m", nullptr },
 	{ KEYBIND_NEGATE_TIME, "NEGATE_TIME", _s("Negate time"), "n", nullptr },
 	{ KEYBIND_OFFER, "OFFER", _s("Offer"), "o", nullptr },
-	{ KEYBIND_PASS, "PASS", _s("Pass"), "p", nullptr },
+	{ KEYBIND_PASS, "PASS", _s("Pass"), "p", "SPACE" },
 	{ KEYBIND_QUIT, "QUIT", _s("Quit"), "q", nullptr },
 	{ KEYBIND_READY, "READY", _s("Ready"), "r", nullptr },
 	{ KEYBIND_STEAL, "STEAL", _s("Steal"), "s", nullptr },


Commit: 6e7d52f7b0ac4b28890cead5935d048cfa1536bd
    https://github.com/scummvm/scummvm/commit/6e7d52f7b0ac4b28890cead5935d048cfa1536bd
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:41:09+11:00

Commit Message:
ULTIMA: ULTIMA2: Fix text on ending screen

Changed paths:
    engines/ultima/ultima2/views/ending.cpp


diff --git a/engines/ultima/ultima2/views/ending.cpp b/engines/ultima/ultima2/views/ending.cpp
index f16cea92247..c7481d92e46 100644
--- a/engines/ultima/ultima2/views/ending.cpp
+++ b/engines/ultima/ultima2/views/ending.cpp
@@ -22,6 +22,7 @@
 #include "common/file.h"
 #include "common/system.h"
 #include "ultima/ultima2/gfx/composite.h"
+#include "ultima/ultima2/gfx/text.h"
 #include "ultima/ultima2/views/ending.h"
 #include "ultima/ultima2/data/map.h"
 #include "ultima/ultima2/ultima2.h"
@@ -69,10 +70,6 @@ bool Ending::msgFocus(const FocusMessage &msg) {
 	_panX = _panY = 0;
 	_lastStep = g_system->getMillis();
 
-	g_engine->baseView()->findView("Commands")->send(Graphics::Views::GameMessage("TEXT",
-		"\n\nYou have saved the universe,\nand completed Ultima ][! Seek\n"
-		"now to conquer wicked Exodus,\nFound in Ultima ]I[-D ]II[-P!\n"));
-
 	return View::msgFocus(msg);
 }
 
@@ -96,6 +93,12 @@ void Ending::draw() {
 		}
 	}
 
+	s.setColor(textColor(Gfx::TEXT_NORMAL), 0);
+	s.writeString(Common::Point(0, 21), "You have saved the universe,\n"
+		"and completed Ultima ][! Seek\n"
+		"now to conquer wicked Exodus,\n"
+		"Found in Ultima ]I[-D ]II[-P!");
+
 	Gfx::compositeFinish(s);
 }
 


Commit: fc138273d7f288e8be4fdc3984254ca8272ca507
    https://github.com/scummvm/scummvm/commit/fc138273d7f288e8be4fdc3984254ca8272ca507
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:41:09+11:00

Commit Message:
ULTIMA: ULTIMA2: Allow loading savegame on ending screen

Changed paths:
    engines/ultima/ultima2/ultima2.cpp
    engines/ultima/ultima2/views/ending.cpp


diff --git a/engines/ultima/ultima2/ultima2.cpp b/engines/ultima/ultima2/ultima2.cpp
index 52521099509..b5862b54871 100644
--- a/engines/ultima/ultima2/ultima2.cpp
+++ b/engines/ultima/ultima2/ultima2.cpp
@@ -154,9 +154,11 @@ bool Ultima2Engine::canSaveGameStateCurrently(Common::U32String *msg) {
 }
 
 bool Ultima2Engine::canLoadGameStateCurrently(Common::U32String *msg) {
+	Views::UIElement *view = focusedView();
 	return canSaveGameStateCurrently() ||
-		dynamic_cast<Views::Interactions::Dead *>(focusedView()) != nullptr ||
-		dynamic_cast<Views::Title *>(focusedView()) != nullptr;
+		dynamic_cast<Views::Interactions::Dead *>(view) != nullptr ||
+		dynamic_cast<Views::Title *>(view) != nullptr ||
+		dynamic_cast<Views::Ending *>(view) != nullptr;
 }
 
 Common::Error Ultima2Engine::syncGame(Common::Serializer &s) {
diff --git a/engines/ultima/ultima2/views/ending.cpp b/engines/ultima/ultima2/views/ending.cpp
index c7481d92e46..7352fc2415e 100644
--- a/engines/ultima/ultima2/views/ending.cpp
+++ b/engines/ultima/ultima2/views/ending.cpp
@@ -94,7 +94,7 @@ void Ending::draw() {
 	}
 
 	s.setColor(textColor(Gfx::TEXT_NORMAL), 0);
-	s.writeString(Common::Point(0, 21), "You have saved the universe,\n"
+	s.writeString(Common::Point(0, 20), "You have saved the universe,\n"
 		"and completed Ultima ][! Seek\n"
 		"now to conquer wicked Exodus,\n"
 		"Found in Ultima ]I[-D ]II[-P!");


Commit: 00a8dbbff272a9ae1511ba8560db27d94e2a48bb
    https://github.com/scummvm/scummvm/commit/00a8dbbff272a9ae1511ba8560db27d94e2a48bb
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:41:09+11:00

Commit Message:
ULTIMA: ULTIMA2: Brief pause before showing ending screen

Changed paths:
    engines/ultima/ultima2/logic/overworld_logic.cpp


diff --git a/engines/ultima/ultima2/logic/overworld_logic.cpp b/engines/ultima/ultima2/logic/overworld_logic.cpp
index b176f92ef51..9b439ac0a1e 100644
--- a/engines/ultima/ultima2/logic/overworld_logic.cpp
+++ b/engines/ultima/ultima2/logic/overworld_logic.cpp
@@ -611,6 +611,7 @@ void OverworldLogic::minaxDeathSequence() {
 	}
 
 	writeString("\nYou feel a strange force!\n");
+	g_engine->pauseMillis(1000);
 	g_engine->addView("Ending");
 }
 


Commit: 3df3d343e3db199af509adaa19a5dc129c3d2f57
    https://github.com/scummvm/scummvm/commit/3df3d343e3db199af509adaa19a5dc129c3d2f57
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:41:09+11:00

Commit Message:
ULTIMA: ULTIMA2: Fix  mis-spelling of paralyzed

Changed paths:
    engines/ultima/ultima2/logic/overworld_logic.cpp


diff --git a/engines/ultima/ultima2/logic/overworld_logic.cpp b/engines/ultima/ultima2/logic/overworld_logic.cpp
index 9b439ac0a1e..cb6213dd751 100644
--- a/engines/ultima/ultima2/logic/overworld_logic.cpp
+++ b/engines/ultima/ultima2/logic/overworld_logic.cpp
@@ -114,7 +114,7 @@ OverworldLogic::StepResult OverworldLogic::stepOnto(int x, int y) {
 	}
 
 	if (sg._legParalysisTurns > 0) {
-		writeString("--Paralized!\n");
+		writeString("--paralyzed!\n");
 		return STEP_PARALYZED;
 	}
 
@@ -475,7 +475,7 @@ bool OverworldLogic::attack(Data::Direction dir) {
 		writeString("Attack--");
 
 		if (sg._armParalysisTurns > 0) {
-			writeString("Paralized!\n");
+			writeString("paralyzed!\n");
 			return true;
 		}
 
@@ -617,7 +617,7 @@ void OverworldLogic::minaxDeathSequence() {
 
 void OverworldLogic::legParalysisTrap() {
 	Data::Savegame &sg = _G(savegame);
-	writeString("Legs paralized!\n");
+	writeString("Legs paralyzed!\n");
 	playFX(Data::SFX_MAGIC);
 	showAttackTile(sg._mapX, sg._mapY);
 
@@ -631,7 +631,7 @@ void OverworldLogic::legParalysisTrap() {
 
 void OverworldLogic::armParalysisTrap() {
 	Data::Savegame &sg = _G(savegame);
-	writeString("Arms paralized!\n");
+	writeString("Arms paralyzed!\n");
 	playFX(Data::SFX_MAGIC);
 	showAttackTile(sg._mapX, sg._mapY);
 


Commit: 248b4a285cdf86bb1639217bbaa68d979d3334cf
    https://github.com/scummvm/scummvm/commit/248b4a285cdf86bb1639217bbaa68d979d3334cf
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:41:09+11:00

Commit Message:
ULTIMA: ULTIMA2: Fix clearing map tiles after Minax defeat

Changed paths:
    engines/ultima/ultima2/logic/overworld_logic.cpp
    engines/ultima/ultima2/ultima2.cpp
    engines/ultima/ultima2/views/ending.cpp


diff --git a/engines/ultima/ultima2/logic/overworld_logic.cpp b/engines/ultima/ultima2/logic/overworld_logic.cpp
index cb6213dd751..207dc469407 100644
--- a/engines/ultima/ultima2/logic/overworld_logic.cpp
+++ b/engines/ultima/ultima2/logic/overworld_logic.cpp
@@ -600,6 +600,8 @@ void OverworldLogic::minaxDeathSequence() {
 	// endless victory pan
 	Graphics::Views::UIElement *curView = g_engine->focusedView();
 	for (int step = 0; step < 64; ++step) {
+		playFX(Data::SFX_HIT);
+
 		for (int i = 0; i < 64; ++i) {
 			int x = randByte() & 0x3F, y = randByte() & 0x3F;
 			_G(map)._tiles[y][x] = Data::TILE_EMPTY;
@@ -607,10 +609,13 @@ void OverworldLogic::minaxDeathSequence() {
 
 		curView->draw();
 		g_engine->updateScreen();
-		g_engine->pauseMillis(30);
+
+		// Long enough for the sound to play out
+		g_engine->pauseMillis(120);
 	}
 
 	writeString("\nYou feel a strange force!\n");
+	playFX(Data::SFX_BEEP);
 	g_engine->pauseMillis(1000);
 	g_engine->addView("Ending");
 }
diff --git a/engines/ultima/ultima2/ultima2.cpp b/engines/ultima/ultima2/ultima2.cpp
index b5862b54871..6a20d1eb17c 100644
--- a/engines/ultima/ultima2/ultima2.cpp
+++ b/engines/ultima/ultima2/ultima2.cpp
@@ -133,7 +133,11 @@ Common::Error Ultima2Engine::run() {
 }
 
 byte Ultima2Engine::randByte() {
-	byte newVal = (byte)(_rngState[1] + _rngState[4] + _rngState[5] + 1);
+	// The original adds the three values with carry, so the carry from the
+	// first addition goes into the second. Without it the low bits repeat
+	// after only a few dozen values
+	int sum = _rngState[1] + _rngState[4] + 1;
+	byte newVal = (byte)(sum + _rngState[5] + (sum >> 8));
 	_rngState[5] = _rngState[4];
 	_rngState[4] = _rngState[3];
 	_rngState[3] = _rngState[2];
diff --git a/engines/ultima/ultima2/views/ending.cpp b/engines/ultima/ultima2/views/ending.cpp
index 7352fc2415e..8dc998ae454 100644
--- a/engines/ultima/ultima2/views/ending.cpp
+++ b/engines/ultima/ultima2/views/ending.cpp
@@ -70,6 +70,7 @@ bool Ending::msgFocus(const FocusMessage &msg) {
 	_panX = _panY = 0;
 	_lastStep = g_system->getMillis();
 
+	g_engine->playFX(Data::SFX_BEEP);
 	return View::msgFocus(msg);
 }
 


Commit: 5ffb45454d9076639b149bda15fd64377f7d61f0
    https://github.com/scummvm/scummvm/commit/5ffb45454d9076639b149bda15fd64377f7d61f0
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:41:09+11:00

Commit Message:
ULTIMA: ULTIMA2: Fix original line wrap for magic missile failure

Changed paths:
    engines/ultima/ultima2/logic/dungeon_logic.cpp
    engines/ultima/ultima2/logic/logic.cpp


diff --git a/engines/ultima/ultima2/logic/dungeon_logic.cpp b/engines/ultima/ultima2/logic/dungeon_logic.cpp
index 0b9e800b2c6..26747660081 100644
--- a/engines/ultima/ultima2/logic/dungeon_logic.cpp
+++ b/engines/ultima/ultima2/logic/dungeon_logic.cpp
@@ -405,7 +405,14 @@ bool DungeonLogic::castSpell(Data::SpellType spell) {
 	}
 
 	playFX(Data::SFX_FAIL);
-	writeString("-Failed!\n");
+
+	if (spell == Data::SPELL_MAGIC_MISSILE) {
+		// WORKAROUND: Original line wraps on the final '!'
+		writeString("-Failed");
+	} else {
+		writeString("-Failed!\n");
+	}
+
 	return true;
 }
 
diff --git a/engines/ultima/ultima2/logic/logic.cpp b/engines/ultima/ultima2/logic/logic.cpp
index c598f192756..3e84c81c65a 100644
--- a/engines/ultima/ultima2/logic/logic.cpp
+++ b/engines/ultima/ultima2/logic/logic.cpp
@@ -365,7 +365,14 @@ bool Logic::cast() {
 bool Logic::castSpell(Data::SpellType spell) {
 	// Spells only work in towers and dungeons
 	playFX(Data::SFX_FAIL);
-	writeString("-Failed!\n");
+
+	if (spell == Data::SPELL_MAGIC_MISSILE) {
+		// WORKAROUND: Original line wraps on the final '!'
+		writeString("-Failed");
+	} else {
+		writeString("-Failed!\n");
+	}
+
 	return true;
 }
 


Commit: 4495d4c05aecc00e12b025a7d3cf85ffafcc9535
    https://github.com/scummvm/scummvm/commit/4495d4c05aecc00e12b025a7d3cf85ffafcc9535
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:41:09+11:00

Commit Message:
ULTIMA: ULTIMA3: Reset savegame version back to 1

Changed paths:
    engines/ultima/ultima3/data/map.cpp
    engines/ultima/ultima3/data/savegame.cpp
    engines/ultima/ultima3/ultima3.cpp


diff --git a/engines/ultima/ultima3/data/map.cpp b/engines/ultima/ultima3/data/map.cpp
index c196b02bc96..6c9776556ba 100644
--- a/engines/ultima/ultima3/data/map.cpp
+++ b/engines/ultima/ultima3/data/map.cpp
@@ -64,11 +64,7 @@ const char *Map::text(int index) const {
 }
 
 void Map::synchronize(Common::Serializer &s) {
-	// Earlier saves only held the cells
-	if (s.getVersion() < 3)
-		s.syncBytes(_cells, sizeof(_cells));
-	else
-		synchronizeData(s);
+	synchronizeData(s);
 }
 
 void Map::synchronizeData(Common::Serializer &s) {
diff --git a/engines/ultima/ultima3/data/savegame.cpp b/engines/ultima/ultima3/data/savegame.cpp
index 06596ee55f1..1f7e584a708 100644
--- a/engines/ultima/ultima3/data/savegame.cpp
+++ b/engines/ultima/ultima3/data/savegame.cpp
@@ -67,30 +67,19 @@ void Savegame::synchronize(Common::Serializer &s) {
 	s.syncBytes(_moveCount, sizeof(_moveCount));
 	s.syncAsByte(_mapLoaded);
 
-	if (s.getVersion() >= 2) {
-		s.syncAsByte(_allWeapons);
-		s.syncAsByte(_allArmour);
-		s.syncAsByte(_plusTwoWeapons);
-		s.syncAsByte(_plusTwoArmour);
-	}
-
-	if (s.getVersion() >= 3) {
-		s.syncAsByte(_worldX);
-		s.syncAsByte(_worldY);
-	}
-
-	if (s.getVersion() >= 4)
-		s.syncAsByte(_lightTurns);
-
-	if (s.getVersion() >= 5) {
-		s.syncAsByte(_dungeonLevel);
-		s.syncAsByte(_facing);
-	}
-
-	if (s.getVersion() >= 6) {
-		s.syncBytes(_moonPhase, sizeof(_moonPhase));
-		s.syncBytes(_moonCountdown, sizeof(_moonCountdown));
-	}
+	s.syncAsByte(_allWeapons);
+	s.syncAsByte(_allArmour);
+	s.syncAsByte(_plusTwoWeapons);
+	s.syncAsByte(_plusTwoArmour);
+
+	s.syncAsByte(_worldX);
+	s.syncAsByte(_worldY);
+	s.syncAsByte(_lightTurns);
+	s.syncAsByte(_dungeonLevel);
+	s.syncAsByte(_facing);
+
+	s.syncBytes(_moonPhase, sizeof(_moonPhase));
+	s.syncBytes(_moonCountdown, sizeof(_moonCountdown));
 }
 
 constexpr int ORIGINAL_ROSTER_SIZE = ROSTER_COUNT * 0x40;
diff --git a/engines/ultima/ultima3/ultima3.cpp b/engines/ultima/ultima3/ultima3.cpp
index 8dfed678565..f1488d310eb 100644
--- a/engines/ultima/ultima3/ultima3.cpp
+++ b/engines/ultima/ultima3/ultima3.cpp
@@ -40,7 +40,7 @@
 namespace Ultima {
 namespace Ultima3 {
 
-constexpr int SAVEGAME_VERSION = 6;
+constexpr int SAVEGAME_VERSION = 1;
 
 Ultima3Engine *g_engine;
 
@@ -170,7 +170,7 @@ Common::Error Ultima3Engine::syncGame(Common::Serializer &s) {
 				_savegame._location == Data::LOCATION_AMBROSIA)
 			_worldMap.synchronize(s);
 
-		if (_savegame._location == Data::LOCATION_DUNGEON && s.getVersion() >= 5)
+		if (_savegame._location == Data::LOCATION_DUNGEON)
 			_dungeon.synchronize(s);
 	}
 


Commit: 8a97fc41e74ff10848f3ef0a3dd2aed48ccebf8e
    https://github.com/scummvm/scummvm/commit/8a97fc41e74ff10848f3ef0a3dd2aed48ccebf8e
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:41:09+11:00

Commit Message:
ULTIMA: ULTIMA3: Added level console cmd

Changed paths:
    engines/ultima/ultima3/console.cpp
    engines/ultima/ultima3/console.h


diff --git a/engines/ultima/ultima3/console.cpp b/engines/ultima/ultima3/console.cpp
index f161b1f81fd..13d1bbe0495 100644
--- a/engines/ultima/ultima3/console.cpp
+++ b/engines/ultima/ultima3/console.cpp
@@ -46,6 +46,7 @@ Console::Console() : GUI::Debugger() {
 	registerCmd("enemy", WRAP_METHOD(Console, cmdEnemy));
 	registerCmd("hp", WRAP_METHOD(Console, cmdHP));
 	registerCmd("food", WRAP_METHOD(Console, cmdFood));
+	registerCmd("level", WRAP_METHOD(Console, cmdLevel));
 	registerCmd("gold", WRAP_METHOD(Console, cmdGold));
 	registerCmd("inventory", WRAP_METHOD(Console, cmdInventory));
 	registerCmd("load", WRAP_METHOD(Console, cmdLoad));
@@ -435,6 +436,34 @@ bool Console::cmdFood(int argc, const char **argv) {
 	return true;
 }
 
+bool Console::cmdLevel(int argc, const char **argv) {
+	constexpr int MAX_LEVEL = 25;
+
+	int level = (argc == 2) ? atoi(argv[1]) : 0;
+	if (level < 1 || level > MAX_LEVEL) {
+		debugPrintf("level <1-%d>\n", MAX_LEVEL);
+		return true;
+	}
+
+	int first, last;
+	if (!getTargets(1, argv, 1, first, last))
+		return true;
+
+	for (int i = first; i <= last; ++i) {
+		Data::RosterEntry &e = _G(savegame).partyMember(i);
+
+		// The level is kept in the hundreds of the hit point limit, and takes
+		// a hundred experience for each level above the first
+		e._maxHitPoints = (Data::toBcd(level) << 8) | (e._maxHitPoints & 0xFF);
+		if (Data::fromBcd(e._experience >> 8) < level - 1)
+			e._experience = Data::toBcd(level - 1) << 8;
+	}
+
+	g_engine->focusedView()->redraw();
+	debugPrintf("Party level set to %d\n", level);
+	return true;
+}
+
 bool Console::cmdGold(int argc, const char **argv) {
 	int first, last;
 	if (argc > 2 || !getTargets(argc, argv, 1, first, last)) {
diff --git a/engines/ultima/ultima3/console.h b/engines/ultima/ultima3/console.h
index be220c752e5..c5527bffa67 100644
--- a/engines/ultima/ultima3/console.h
+++ b/engines/ultima/ultima3/console.h
@@ -56,6 +56,7 @@ private:
 	bool cmdEnemy(int argc, const char **argv);
 	bool cmdHP(int argc, const char **argv);
 	bool cmdFood(int argc, const char **argv);
+	bool cmdLevel(int argc, const char **argv);
 	bool cmdGold(int argc, const char **argv);
 	bool cmdInventory(int argc, const char **argv);
 	bool cmdLoad(int argc, const char **argv);


Commit: a69ed1c2f18cff0312af19686932793f2aee5894
    https://github.com/scummvm/scummvm/commit/a69ed1c2f18cff0312af19686932793f2aee5894
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:41:09+11:00

Commit Message:
ULTIMA: ULTIMA3: Added transport console cmd

Changed paths:
    engines/ultima/ultima3/console.cpp
    engines/ultima/ultima3/console.h


diff --git a/engines/ultima/ultima3/console.cpp b/engines/ultima/ultima3/console.cpp
index 13d1bbe0495..783a98918ba 100644
--- a/engines/ultima/ultima3/console.cpp
+++ b/engines/ultima/ultima3/console.cpp
@@ -47,6 +47,7 @@ Console::Console() : GUI::Debugger() {
 	registerCmd("hp", WRAP_METHOD(Console, cmdHP));
 	registerCmd("food", WRAP_METHOD(Console, cmdFood));
 	registerCmd("level", WRAP_METHOD(Console, cmdLevel));
+	registerCmd("transport", WRAP_METHOD(Console, cmdTransport));
 	registerCmd("gold", WRAP_METHOD(Console, cmdGold));
 	registerCmd("inventory", WRAP_METHOD(Console, cmdInventory));
 	registerCmd("load", WRAP_METHOD(Console, cmdLoad));
@@ -464,6 +465,75 @@ bool Console::cmdLevel(int argc, const char **argv) {
 	return true;
 }
 
+bool Console::cmdTransport(int argc, const char **argv) {
+	constexpr byte TILE_WATER = 0, TILE_GRASS = 1, TILE_FOREST = 3;
+	constexpr int MAX_RADIUS = 10;
+
+	static const byte TRANSPORTS[] = { TRANSPORT_HORSE, TRANSPORT_SHIP };
+	static const char *const NAMES[] = { "horse", "ship" };
+
+	int type = (argc == 2) ? atoi(argv[1]) : -1;
+	if (type < 0 || type >= (int)ARRAYSIZE(TRANSPORTS)) {
+		debugPrintf("transport <type>, where type is 0 for a horse or 1 for a ship\n");
+		return true;
+	}
+
+	ensureGame();
+	Data::Savegame &sg = _G(savegame);
+	if (sg._location != Data::LOCATION_SOSARIA) {
+		debugPrintf("Only supported on the world map\n");
+		return true;
+	}
+
+	// Ships need water, and horses are put on grass
+	const byte transport = TRANSPORTS[type];
+	const byte terrain = (transport == TRANSPORT_SHIP) ? TILE_WATER : TILE_GRASS;
+	const Data::Creatures &creatures = _G(map)._creatures;
+
+	// It's boarded by walking onto it, so there has to be land beside it to walk from
+	auto reachable = [&](int x, int y) {
+		static const int OFFSETS[4][2] = { { 0, -1 }, { 0, 1 }, { -1, 0 }, { 1, 0 } };
+		for (int i = 0; i < 4; ++i) {
+			byte tile = _G(map).tile(x + OFFSETS[i][0], y + OFFSETS[i][1]);
+			if (tile >= TILE_GRASS && tile <= TILE_FOREST)
+				return true;
+		}
+
+		return false;
+	};
+
+	// Prefer a place that can be reached, but settle for any if there isn't one
+	for (int pass = 0; pass < 2; ++pass) {
+		for (int radius = 1; radius <= MAX_RADIUS; ++radius) {
+			for (int dy = -radius; dy <= radius; ++dy) {
+				for (int dx = -radius; dx <= radius; ++dx) {
+					if (MAX(ABS(dx), ABS(dy)) != radius)
+						continue;
+
+					int x = (sg._posX + dx) & (Data::MAP_SIZE - 1);
+					int y = (sg._posY + dy) & (Data::MAP_SIZE - 1);
+					if (_G(map).tile(x, y) != terrain || (pass == 0 && !reachable(x, y)))
+						continue;
+
+					bool occupied = false;
+					for (int i = 0; i < Data::CREATURE_COUNT && !occupied; ++i)
+						occupied = creatures._tile[i] && creatures._x[i] == x && creatures._y[i] == y;
+					if (occupied)
+						continue;
+
+					_G(map).setCell(x, y, transport * 4);
+					g_engine->focusedView()->redraw();
+					debugPrintf("Spawned a %s at (%d,%d)\n", NAMES[type], x, y);
+					return true;
+				}
+			}
+		}
+	}
+
+	debugPrintf("No suitable place for a %s within %d squares\n", NAMES[type], MAX_RADIUS);
+	return true;
+}
+
 bool Console::cmdGold(int argc, const char **argv) {
 	int first, last;
 	if (argc > 2 || !getTargets(argc, argv, 1, first, last)) {
diff --git a/engines/ultima/ultima3/console.h b/engines/ultima/ultima3/console.h
index c5527bffa67..6d2567b8afe 100644
--- a/engines/ultima/ultima3/console.h
+++ b/engines/ultima/ultima3/console.h
@@ -57,6 +57,7 @@ private:
 	bool cmdHP(int argc, const char **argv);
 	bool cmdFood(int argc, const char **argv);
 	bool cmdLevel(int argc, const char **argv);
+	bool cmdTransport(int argc, const char **argv);
 	bool cmdGold(int argc, const char **argv);
 	bool cmdInventory(int argc, const char **argv);
 	bool cmdLoad(int argc, const char **argv);


Commit: 7cc0dce69184d503ef8b8da44c40b5ea8cebd3e6
    https://github.com/scummvm/scummvm/commit/7cc0dce69184d503ef8b8da44c40b5ea8cebd3e6
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:41:09+11:00

Commit Message:
ULTIMA: ULTIMA3: Added win and enemies console commands

Changed paths:
    engines/ultima/ultima3/console.cpp
    engines/ultima/ultima3/console.h
    engines/ultima/ultima3/logic/combat_logic.cpp
    engines/ultima/ultima3/logic/combat_logic.h
    engines/ultima/ultima3/views/combat_map.cpp
    engines/ultima/ultima3/views/combat_map.h


diff --git a/engines/ultima/ultima3/console.cpp b/engines/ultima/ultima3/console.cpp
index 783a98918ba..f8c7033cd3d 100644
--- a/engines/ultima/ultima3/console.cpp
+++ b/engines/ultima/ultima3/console.cpp
@@ -25,6 +25,7 @@
 #include "ultima/ultima3/ultima3.h"
 #include "ultima/ultima3/data/data.h"
 #include "ultima/ultima3/logic/location_logic.h"
+#include "ultima/ultima3/views/combat_map.h"
 
 namespace Ultima {
 namespace Ultima3 {
@@ -48,6 +49,8 @@ Console::Console() : GUI::Debugger() {
 	registerCmd("food", WRAP_METHOD(Console, cmdFood));
 	registerCmd("level", WRAP_METHOD(Console, cmdLevel));
 	registerCmd("transport", WRAP_METHOD(Console, cmdTransport));
+	registerCmd("enemies", WRAP_METHOD(Console, cmdEnemies));
+	registerCmd("win", WRAP_METHOD(Console, cmdWin));
 	registerCmd("gold", WRAP_METHOD(Console, cmdGold));
 	registerCmd("inventory", WRAP_METHOD(Console, cmdInventory));
 	registerCmd("load", WRAP_METHOD(Console, cmdLoad));
@@ -534,6 +537,50 @@ bool Console::cmdTransport(int argc, const char **argv) {
 	return true;
 }
 
+bool Console::cmdEnemies(int argc, const char **argv) {
+	const Data::Savegame &sg = _G(savegame);
+	int count = 0;
+
+	if (dynamic_cast<Views::CombatMap *>(g_engine->focusedView())) {
+		// The monsters in the arena
+		const Data::Arena &arena = _G(combat)._arena;
+		for (int i = 0; i < Data::ARENA_MONSTERS; ++i) {
+			if (!arena._monsterHp[i])
+				continue;
+
+			debugPrintf("%-12s (%d,%d)  HP %d\n", Data::NAMES[_G(combat)._monsterClass],
+				arena._monsterX[i], arena._monsterY[i], arena._monsterHp[i]);
+			++count;
+		}
+	} else if (sg._location == Data::LOCATION_DUNGEON) {
+		debugPrintf("Dungeon levels have no creatures until a fight starts\n");
+		return true;
+	} else {
+		const Data::Creatures &c = _G(map)._creatures;
+		for (int i = 0; i < Data::CREATURE_COUNT; ++i) {
+			if (!c._tile[i])
+				continue;
+
+			debugPrintf("%-12s (%d,%d)\n", Data::NAMES[c._tile[i] >> 2], c._x[i], c._y[i]);
+			++count;
+		}
+	}
+
+	debugPrintf("%d creature%s\n", count, count == 1 ? "" : "s");
+	return true;
+}
+
+bool Console::cmdWin(int argc, const char **argv) {
+	Views::CombatMap *combat = dynamic_cast<Views::CombatMap *>(g_engine->focusedView());
+	if (!combat) {
+		debugPrintf("Only works in a fight\n");
+		return true;
+	}
+
+	combat->win();
+	return false;
+}
+
 bool Console::cmdGold(int argc, const char **argv) {
 	int first, last;
 	if (argc > 2 || !getTargets(argc, argv, 1, first, last)) {
diff --git a/engines/ultima/ultima3/console.h b/engines/ultima/ultima3/console.h
index 6d2567b8afe..fd7e9f7c5ec 100644
--- a/engines/ultima/ultima3/console.h
+++ b/engines/ultima/ultima3/console.h
@@ -58,6 +58,8 @@ private:
 	bool cmdFood(int argc, const char **argv);
 	bool cmdLevel(int argc, const char **argv);
 	bool cmdTransport(int argc, const char **argv);
+	bool cmdEnemies(int argc, const char **argv);
+	bool cmdWin(int argc, const char **argv);
 	bool cmdGold(int argc, const char **argv);
 	bool cmdInventory(int argc, const char **argv);
 	bool cmdLoad(int argc, const char **argv);
diff --git a/engines/ultima/ultima3/logic/combat_logic.cpp b/engines/ultima/ultima3/logic/combat_logic.cpp
index 40da1901f83..d84c11b64e2 100644
--- a/engines/ultima/ultima3/logic/combat_logic.cpp
+++ b/engines/ultima/ultima3/logic/combat_logic.cpp
@@ -275,6 +275,18 @@ bool CombatLogic::allMonstersDead() const {
 	return true;
 }
 
+void CombatLogic::killAllMonsters() {
+	for (int i = 0; i < ARENA_MONSTERS; ++i) {
+		if (!_arena._monsterHp[i])
+			continue;
+
+		_arena._monsterHp[i] = 0;
+		_arena.setTile(_arena._monsterX[i], _arena._monsterY[i], _arena._monsterUnder[i]);
+	}
+
+	syncShown();
+}
+
 int CombatLogic::monsterAt(int x, int y) const {
 	for (int i = ARENA_MONSTERS - 1; i >= 0; --i) {
 		if (_arena._monsterHp[i] && _arena._monsterX[i] == x && _arena._monsterY[i] == y)
diff --git a/engines/ultima/ultima3/logic/combat_logic.h b/engines/ultima/ultima3/logic/combat_logic.h
index 07d33ee6fa2..d57cb6b5f05 100644
--- a/engines/ultima/ultima3/logic/combat_logic.h
+++ b/engines/ultima/ultima3/logic/combat_logic.h
@@ -172,6 +172,11 @@ public:
 
 	bool allMonstersDead() const;
 
+	/**
+	 * Removes every monster from the fight
+	 */
+	void killAllMonsters();
+
 	/**
 	 * Returns how many turns of time being held still are left
 	 */
diff --git a/engines/ultima/ultima3/views/combat_map.cpp b/engines/ultima/ultima3/views/combat_map.cpp
index c882e808c15..14dd51e67f2 100644
--- a/engines/ultima/ultima3/views/combat_map.cpp
+++ b/engines/ultima/ultima3/views/combat_map.cpp
@@ -108,6 +108,16 @@ void CombatMap::victory() {
 	close();
 }
 
+void CombatMap::win() {
+	_G(combat).killAllMonsters();
+	_G(combat).events().clear();
+
+	_next = NOTHING;
+	_overlay = false;
+	cancelInteraction();
+	victory();
+}
+
 void CombatMap::endTurn() {
 	_next = NEXT_PLAYER;
 }
diff --git a/engines/ultima/ultima3/views/combat_map.h b/engines/ultima/ultima3/views/combat_map.h
index c380b8eb47a..3630d97fee8 100644
--- a/engines/ultima/ultima3/views/combat_map.h
+++ b/engines/ultima/ultima3/views/combat_map.h
@@ -88,6 +88,11 @@ public:
 
 	bool msgFocus(const FocusMessage &msg) override;
 	bool msgKeypress(const KeypressMessage &msg) override;
+
+	/**
+	 * Wins the fight at once, by killing every monster
+	 */
+	void win();
 };
 
 } // namespace Views


Commit: 1ef2e532012f238bdbe261fa4cd6970ffa37f8ea
    https://github.com/scummvm/scummvm/commit/1ef2e532012f238bdbe261fa4cd6970ffa37f8ea
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:41:09+11:00

Commit Message:
ULTIMA: ULTIMA3: Slow down the Ambrosia whirlpool slightly

Changed paths:
    engines/ultima/ultima3/views/location_map.cpp


diff --git a/engines/ultima/ultima3/views/location_map.cpp b/engines/ultima/ultima3/views/location_map.cpp
index cd803fdb101..0515ae002ce 100644
--- a/engines/ultima/ultima3/views/location_map.cpp
+++ b/engines/ultima/ultima3/views/location_map.cpp
@@ -42,7 +42,7 @@ namespace Ultima {
 namespace Ultima3 {
 namespace Views {
 
-constexpr int WHIRLPOOL_FRAMES = 4;
+constexpr int WHIRLPOOL_FRAMES = 8;
 constexpr int BREATH_FRAMES = 2;
 constexpr int BREATH_RANGE = 3;
 constexpr byte TILE_BREATH = 0x3D;


Commit: c0eaf33372b7e5bfe1b147494bd5feea218fd73f
    https://github.com/scummvm/scummvm/commit/c0eaf33372b7e5bfe1b147494bd5feea218fd73f
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:41:09+11:00

Commit Message:
ULTIMA: ULTIMA3: Fix fountain and card determination

Changed paths:
    engines/ultima/ultima3/views/interactions/dungeon_special.cpp


diff --git a/engines/ultima/ultima3/views/interactions/dungeon_special.cpp b/engines/ultima/ultima3/views/interactions/dungeon_special.cpp
index 904acb5b029..720f0bad43b 100644
--- a/engines/ultima/ultima3/views/interactions/dungeon_special.cpp
+++ b/engines/ultima/ultima3/views/interactions/dungeon_special.cpp
@@ -108,7 +108,7 @@ void DungeonSpecial::drink(int slot) {
 	}
 
 	// Which fountain it is depends on where it is
-	switch (_G(savegame)._posY & 3) {
+	switch (_G(savegame)._posX & 3) {
 	case 0:
 		_G(messages).print("Yuck! Horrible!\n");
 		e._status = Data::STATUS_POISONED;
@@ -140,7 +140,7 @@ void DungeonSpecial::touchRod(int slot) {
 	Data::RosterEntry &e = _G(savegame).partyMember(slot);
 
 	// Each rod leaves a different mark, depending on where it is
-	e._marksAndCards |= 1 << ((_G(savegame)._posY & 3) + 4);
+	e._marksAndCards |= 1 << ((_G(savegame)._posX & 3) + 4);
 
 	_G(effects).flashSlot(slot);
 	g_engine->playSoundEffect(0xF7);


Commit: d18fe1e699ae28451337aa4464137e330c0ce87c
    https://github.com/scummvm/scummvm/commit/d18fe1e699ae28451337aa4464137e330c0ce87c
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:41:09+11:00

Commit Message:
ULTIMA: ULTIMA3: Inventory console cmd can now remove special items

This is for testing special locations actually give the items

Changed paths:
    engines/ultima/ultima3/console.cpp


diff --git a/engines/ultima/ultima3/console.cpp b/engines/ultima/ultima3/console.cpp
index f8c7033cd3d..1a29ca4a5d1 100644
--- a/engines/ultima/ultima3/console.cpp
+++ b/engines/ultima/ultima3/console.cpp
@@ -596,7 +596,46 @@ bool Console::cmdGold(int argc, const char **argv) {
 	return true;
 }
 
+// Readies the best normal weapon and armour that a character's class is allowed to, which
+// leaves out the exotic weapon and armour that anyone can use
+static void readyBest(Data::RosterEntry &e, bool mustOwn) {
+	e._weaponIndex = 0;
+	for (int w = Data::WEAPON_COUNT - 2; w > 0; --w) {
+		if ('A' + w < Data::weaponLimit(e._class) && (!mustOwn || Data::fromBcd(e._weaponOwned[w - 1]) > 0)) {
+			e._weaponIndex = w;
+			break;
+		}
+	}
+
+	e._armourIndex = 0;
+	for (int a = Data::ARMOUR_COUNT - 2; a > 0; --a) {
+		if ('A' + a < Data::armourLimit(e._class) && (!mustOwn || Data::fromBcd(e._armourOwned[a - 1]) > 0)) {
+			e._armourIndex = a;
+			break;
+		}
+	}
+}
+
 bool Console::cmdInventory(int argc, const char **argv) {
+	// Not in the usage text, 'off' takes the special items back from everyone
+	if (argc == 2 && !strcmp(argv[1], "off")) {
+		Data::Savegame &sg = _G(savegame);
+		sg._allWeapons = sg._allArmour = sg._plusTwoWeapons = sg._plusTwoArmour = false;
+
+		for (int i = 0; i < sg._partySize; ++i) {
+			Data::RosterEntry &e = sg.partyMember(i);
+
+			e._marksAndCards = 0;
+			e._weaponOwned[Data::WEAPON_COUNT - 2] = 0;
+			e._armourOwned[Data::ARMOUR_COUNT - 2] = 0;
+			readyBest(e, true);
+		}
+
+		g_engine->focusedView()->redraw();
+		debugPrintf("Marks, cards and exotic weapons and armour removed, and the best of the rest readied\n");
+		return true;
+	}
+
 	int first, last;
 	if (argc > 2 || !getTargets(argc, argv, 1, first, last)) {
 		debugPrintf("inventory [<position>]\n");
@@ -620,23 +659,7 @@ bool Console::cmdInventory(int argc, const char **argv) {
 		e._foodSubCounter = 0;
 		e._status = Data::STATUS_GOOD;
 
-		// Ready the best that the character's class is allowed to, which
-		// leaves out the exotic weapon and armour that anyone can use
-		e._weaponIndex = 0;
-		for (int w = Data::WEAPON_COUNT - 2; w > 0; --w) {
-			if ('A' + w < Data::weaponLimit(e._class)) {
-				e._weaponIndex = w;
-				break;
-			}
-		}
-
-		e._armourIndex = 0;
-		for (int a = Data::ARMOUR_COUNT - 2; a > 0; --a) {
-			if ('A' + a < Data::armourLimit(e._class)) {
-				e._armourIndex = a;
-				break;
-			}
-		}
+		readyBest(e, false);
 
 		debugPrintf("%s: readied %s and %s armour\n", e._name, Data::WEAPON_NAMES[e._weaponIndex],
 			Data::ARMOUR_NAMES[e._armourIndex]);


Commit: c88577577d6451874c31c09bc36db654bb41f39a
    https://github.com/scummvm/scummvm/commit/c88577577d6451874c31c09bc36db654bb41f39a
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:41:09+11:00

Commit Message:
ULTIMA: ULTIMA3: Added mp console cmd

Changed paths:
    engines/ultima/ultima3/console.cpp
    engines/ultima/ultima3/console.h


diff --git a/engines/ultima/ultima3/console.cpp b/engines/ultima/ultima3/console.cpp
index 1a29ca4a5d1..74ec98a23eb 100644
--- a/engines/ultima/ultima3/console.cpp
+++ b/engines/ultima/ultima3/console.cpp
@@ -47,6 +47,7 @@ Console::Console() : GUI::Debugger() {
 	registerCmd("enemy", WRAP_METHOD(Console, cmdEnemy));
 	registerCmd("hp", WRAP_METHOD(Console, cmdHP));
 	registerCmd("food", WRAP_METHOD(Console, cmdFood));
+	registerCmd("mp", WRAP_METHOD(Console, cmdMP));
 	registerCmd("level", WRAP_METHOD(Console, cmdLevel));
 	registerCmd("transport", WRAP_METHOD(Console, cmdTransport));
 	registerCmd("enemies", WRAP_METHOD(Console, cmdEnemies));
@@ -581,6 +582,21 @@ bool Console::cmdWin(int argc, const char **argv) {
 	return false;
 }
 
+bool Console::cmdMP(int argc, const char **argv) {
+	int first, last;
+	if (argc > 2 || !getTargets(argc, argv, 1, first, last)) {
+		debugPrintf("mp [<position>]\n");
+		return true;
+	}
+
+	for (int i = first; i <= last; ++i)
+		_G(savegame).partyMember(i)._magicPoints = Data::toBcd(MAX_ITEMS);
+
+	g_engine->focusedView()->redraw();
+	debugPrintf("MP set to %d\n", MAX_ITEMS);
+	return true;
+}
+
 bool Console::cmdGold(int argc, const char **argv) {
 	int first, last;
 	if (argc > 2 || !getTargets(argc, argv, 1, first, last)) {
diff --git a/engines/ultima/ultima3/console.h b/engines/ultima/ultima3/console.h
index fd7e9f7c5ec..ea537ebc356 100644
--- a/engines/ultima/ultima3/console.h
+++ b/engines/ultima/ultima3/console.h
@@ -56,6 +56,7 @@ private:
 	bool cmdEnemy(int argc, const char **argv);
 	bool cmdHP(int argc, const char **argv);
 	bool cmdFood(int argc, const char **argv);
+	bool cmdMP(int argc, const char **argv);
 	bool cmdLevel(int argc, const char **argv);
 	bool cmdTransport(int argc, const char **argv);
 	bool cmdEnemies(int argc, const char **argv);


Commit: 27459acf0e9c55c952bf00d7c2ca332c1e7b4a7e
    https://github.com/scummvm/scummvm/commit/27459acf0e9c55c952bf00d7c2ca332c1e7b4a7e
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:41:09+11:00

Commit Message:
ULTIMA: ULTIMA3: Fix dungeon level display in console

Changed paths:
    engines/ultima/ultima3/console.cpp


diff --git a/engines/ultima/ultima3/console.cpp b/engines/ultima/ultima3/console.cpp
index 74ec98a23eb..326cb642c8c 100644
--- a/engines/ultima/ultima3/console.cpp
+++ b/engines/ultima/ultima3/console.cpp
@@ -274,7 +274,7 @@ bool Console::cmdTeleport(int argc, const char **argv) {
 		sg._posY = atoi(argv[2]) & mask;
 
 		if (argc == 4)
-			sg._dungeonLevel = CLIP(atoi(argv[3]), 0, Data::DUNGEON_LEVELS - 1);
+			sg._dungeonLevel = CLIP(atoi(argv[3]) - 1, 0, Data::DUNGEON_LEVELS - 1);
 
 		g_engine->focusedView()->redraw();
 	} else if (argc != 1) {
@@ -283,7 +283,7 @@ bool Console::cmdTeleport(int argc, const char **argv) {
 	}
 
 	if (inDungeon)
-		debugPrintf("Position: (%d,%d) on level %d\n", sg._posX, sg._posY, sg._dungeonLevel);
+		debugPrintf("Position: (%d,%d) on level %d\n", sg._posX, sg._posY, sg._dungeonLevel + 1);
 	else
 		debugPrintf("Position: (%d,%d)\n", sg._posX, sg._posY);
 	return true;


Commit: db53a09a7ff4f277f02080b8cc5a4c5c67ee941a
    https://github.com/scummvm/scummvm/commit/db53a09a7ff4f277f02080b8cc5a4c5c67ee941a
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:41:10+11:00

Commit Message:
ULTIMA: ULTIMA3: Fix defeating Exodus from a savegame part-way through

Changed paths:
    engines/ultima/ultima3/logic/location_logic.cpp
    engines/ultima/ultima3/ultima3.h
    engines/ultima/ultima3/views/interactions/insert_card.cpp


diff --git a/engines/ultima/ultima3/logic/location_logic.cpp b/engines/ultima/ultima3/logic/location_logic.cpp
index 3d9411e0cfa..f9cb84ced5a 100644
--- a/engines/ultima/ultima3/logic/location_logic.cpp
+++ b/engines/ultima/ultima3/logic/location_logic.cpp
@@ -223,7 +223,6 @@ const char *LocationLogic::go(const Entrance &entrance, byte tile) {
 		return "Towne!\n";
 	} else {
 		save._location = Data::LOCATION_CASTLE;
-		_G(exodusProgress) = 0;
 		save._posX = CASTLE_START_X;
 		save._posY = CASTLE_START_Y;
 		return "Castle!\n";
diff --git a/engines/ultima/ultima3/ultima3.h b/engines/ultima/ultima3/ultima3.h
index 44fca2f060b..d05c4feec69 100644
--- a/engines/ultima/ultima3/ultima3.h
+++ b/engines/ultima/ultima3/ultima3.h
@@ -134,9 +134,6 @@ public:
 	// How many more turns time is held still for, by powder or a spell
 	byte _holdTime = 0;
 
-	// How many of the four Exodus cards have been put in its machine
-	int _exodusProgress = 0;
-
 	// A full viewport picture shown in place of the dungeon, such as a fountain
 	byte _scene[Data::ARENA_SIZE * Data::ARENA_SIZE] = {};
 	bool _sceneShown = false;
diff --git a/engines/ultima/ultima3/views/interactions/insert_card.cpp b/engines/ultima/ultima3/views/interactions/insert_card.cpp
index fe07579580b..64d7c4a91d4 100644
--- a/engines/ultima/ultima3/views/interactions/insert_card.cpp
+++ b/engines/ultima/ultima3/views/interactions/insert_card.cpp
@@ -32,6 +32,7 @@ constexpr byte MACHINE_CELL = 0x7C;
 constexpr byte FLASH_CELL = 0xF0;
 constexpr byte EMPTY_CELL = 0x20;
 constexpr int FIRST_SLOT_X = 0x1E;
+constexpr int SLOT_Y = 11;
 constexpr int CARD_COUNT = 4;
 constexpr int FLASH_COUNT = 5;
 constexpr int FLASH_STEP_FRAMES = 2;
@@ -53,6 +54,16 @@ static const char *const VICTORY_LINES[10] = {
 	"Onward to ULTIMA IV!"
 };
 
+// How many of the slots have had their card put in. Each is left empty, which means it can be
+// worked out from the map, and so doesn't need saving
+static int slotsFilled() {
+	int count = 0;
+	while (count < CARD_COUNT && _G(map).cell(FIRST_SLOT_X + count, SLOT_Y) != MACHINE_CELL)
+		++count;
+
+	return count;
+}
+
 static void noEffect() {
 	_G(messages).print("No effect!\n");
 }
@@ -84,7 +95,7 @@ bool InsertCard::chooseCell() {
 
 bool InsertCard::tryWord() {
 	Data::RosterEntry &e = _G(savegame).partyMember(_slot);
-	int progress = _G(exodusProgress);
+	int progress = slotsFilled();
 	char key = _menu.key();
 
 	_G(messages).print("\n");
@@ -106,7 +117,7 @@ bool InsertCard::tryWord() {
 		return true;
 	}
 
-	++_G(exodusProgress);
+	_finalCard = (progress == CARD_COUNT - 1);
 	_step = 0;
 	_frames = 0;
 	_stage = FLASH;
@@ -143,6 +154,7 @@ bool InsertCard::keypress(const KeypressMessage &msg) {
 	case DONE:
 		if (!isModifierKey(msg.keycode)) {
 			_G(soundEnabled) = true;
+			_G(music).silence();
 			g_events->replaceView("Title", true);
 		}
 		return false;
@@ -167,7 +179,7 @@ bool InsertCard::timeout() {
 		}
 
 		_G(map).setCell(_targetX, _targetY, EMPTY_CELL);
-		if (_G(exodusProgress) != CARD_COUNT)
+		if (slotsFilled() != CARD_COUNT)
 			return true;
 
 		startVictory();


Commit: e220a505f024cd43e3a007c2585b4ead48a562e0
    https://github.com/scummvm/scummvm/commit/e220a505f024cd43e3a007c2585b4ead48a562e0
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:41:10+11:00

Commit Message:
ULTIMA: ULTIMA3: Silence music on returning to title screen

Changed paths:
    engines/ultima/ultima3/views/game.cpp
    engines/ultima/ultima3/views/game.h
    engines/ultima/ultima3/views/interactions/insert_card.h
    engines/ultima/ultima3/views/interactions/interaction.h


diff --git a/engines/ultima/ultima3/views/game.cpp b/engines/ultima/ultima3/views/game.cpp
index ee532865670..4257f761bcf 100644
--- a/engines/ultima/ultima3/views/game.cpp
+++ b/engines/ultima/ultima3/views/game.cpp
@@ -123,7 +123,8 @@ void Game::timeout() {
 	updateMusic();
 	_G(shapes).animate();
 	_G(effects).tick();
-	updateWind();
+	if (!isEndgame())
+		updateWind();
 	_G(overview).tick();
 	processFrame();
 
diff --git a/engines/ultima/ultima3/views/game.h b/engines/ultima/ultima3/views/game.h
index bd2334d1c3e..f813adf5791 100644
--- a/engines/ultima/ultima3/views/game.h
+++ b/engines/ultima/ultima3/views/game.h
@@ -159,6 +159,13 @@ public:
 	Game(const Common::String &name) : View(name) {}
 	~Game() override {}
 
+	/**
+	 * Returns true once the game has been won, and what's left is the ending
+	 */
+	bool isEndgame() const {
+		return _interaction && _interaction->isEndgame();
+	}
+
 	bool msgFocus(const FocusMessage &msg) override;
 	bool msgKeypress(const KeypressMessage &msg) override;
 	void draw() override;
diff --git a/engines/ultima/ultima3/views/interactions/insert_card.h b/engines/ultima/ultima3/views/interactions/insert_card.h
index 5d5b7735987..566c21137c6 100644
--- a/engines/ultima/ultima3/views/interactions/insert_card.h
+++ b/engines/ultima/ultima3/views/interactions/insert_card.h
@@ -49,6 +49,7 @@ private:
 	int _frames = 0;
 	int _step = 0;
 	int _targetX = 0, _targetY = 0;
+	bool _finalCard = false;
 
 	DirectionChooser _directions;
 	LogMenu _menu;
@@ -79,6 +80,10 @@ public:
 	 */
 	void start(int slot);
 
+	bool isEndgame() const override {
+		return _stage >= SHATTER || (_stage == FLASH && _finalCard);
+	}
+
 	bool keypress(const KeypressMessage &msg) override;
 	bool timeout() override;
 	void draw(GfxSurface &s) override;
diff --git a/engines/ultima/ultima3/views/interactions/interaction.h b/engines/ultima/ultima3/views/interactions/interaction.h
index 1ba2104e86a..1195d846f14 100644
--- a/engines/ultima/ultima3/views/interactions/interaction.h
+++ b/engines/ultima/ultima3/views/interactions/interaction.h
@@ -48,6 +48,14 @@ public:
 		return false;
 	}
 
+	/**
+	 * Returns true once the command has won the game, after which nothing
+	 * more happens in the world and it can't be saved
+	 */
+	virtual bool isEndgame() const {
+		return false;
+	}
+
 	/**
 	 * Handles a keypress
 	 * @returns		True once the command is finished


Commit: 4cd60fd616e53badf5db6b2d95d57605969629cb
    https://github.com/scummvm/scummvm/commit/4cd60fd616e53badf5db6b2d95d57605969629cb
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:41:10+11:00

Commit Message:
ULTIMA: ULTIMA3: Prevent saving after defeating Exodus

Changed paths:
    engines/ultima/ultima3/ultima3.cpp


diff --git a/engines/ultima/ultima3/ultima3.cpp b/engines/ultima/ultima3/ultima3.cpp
index f1488d310eb..ffeee447fca 100644
--- a/engines/ultima/ultima3/ultima3.cpp
+++ b/engines/ultima/ultima3/ultima3.cpp
@@ -149,9 +149,11 @@ bool Ultima3Engine::canSaveGameStateCurrently(Common::U32String *msg) {
 	// Anything but the title sequence, which isn't a state worth keeping
 	UIElement *view = focusedView();
 
-	return (dynamic_cast<Views::Game *>(view) != nullptr &&
-		dynamic_cast<Views::CombatMap *>(view) == nullptr) ||
-		dynamic_cast<Views::WindowView *>(view) != nullptr;
+	Views::Game *game = dynamic_cast<Views::Game *>(view);
+	if (game)
+		return dynamic_cast<Views::CombatMap *>(view) == nullptr && !game->isEndgame();
+
+	return dynamic_cast<Views::WindowView *>(view) != nullptr;
 }
 
 bool Ultima3Engine::canLoadGameStateCurrently(Common::U32String *msg) {


Commit: 68b4ed52b5ea75fef101d8c59412dc3edd6e596b
    https://github.com/scummvm/scummvm/commit/68b4ed52b5ea75fef101d8c59412dc3edd6e596b
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-11-13T06:41:10+11:00

Commit Message:
ULTIMA: ULTIMA3: New optional dungeon renderer using PNG images

Changed paths:
  A devtools/create_ultima/files/ultima3/dungeons/chest_00.png
  A devtools/create_ultima/files/ultima3/dungeons/chest_01.png
  A devtools/create_ultima/files/ultima3/dungeons/chest_02.png
  A devtools/create_ultima/files/ultima3/dungeons/chest_03.png
  A devtools/create_ultima/files/ultima3/dungeons/chest_04.png
  A devtools/create_ultima/files/ultima3/dungeons/chest_05.png
  A devtools/create_ultima/files/ultima3/dungeons/chest_06.png
  A devtools/create_ultima/files/ultima3/dungeons/chest_07.png
  A devtools/create_ultima/files/ultima3/dungeons/chest_08.png
  A devtools/create_ultima/files/ultima3/dungeons/chest_09.png
  A devtools/create_ultima/files/ultima3/dungeons/chest_10.png
  A devtools/create_ultima/files/ultima3/dungeons/chest_11.png
  A devtools/create_ultima/files/ultima3/dungeons/chest_12.png
  A devtools/create_ultima/files/ultima3/dungeons/chest_13.png
  A devtools/create_ultima/files/ultima3/dungeons/chest_14.png
  A devtools/create_ultima/files/ultima3/dungeons/chest_15.png
  A devtools/create_ultima/files/ultima3/dungeons/chest_16.png
  A devtools/create_ultima/files/ultima3/dungeons/chest_17.png
  A devtools/create_ultima/files/ultima3/dungeons/chest_18.png
  A devtools/create_ultima/files/ultima3/dungeons/chest_19.png
  A devtools/create_ultima/files/ultima3/dungeons/chest_20.png
  A devtools/create_ultima/files/ultima3/dungeons/face_00.png
  A devtools/create_ultima/files/ultima3/dungeons/face_01.png
  A devtools/create_ultima/files/ultima3/dungeons/face_02.png
  A devtools/create_ultima/files/ultima3/dungeons/face_03.png
  A devtools/create_ultima/files/ultima3/dungeons/face_04.png
  A devtools/create_ultima/files/ultima3/dungeons/face_05.png
  A devtools/create_ultima/files/ultima3/dungeons/face_06.png
  A devtools/create_ultima/files/ultima3/dungeons/face_07.png
  A devtools/create_ultima/files/ultima3/dungeons/face_08.png
  A devtools/create_ultima/files/ultima3/dungeons/face_09.png
  A devtools/create_ultima/files/ultima3/dungeons/face_10.png
  A devtools/create_ultima/files/ultima3/dungeons/face_11.png
  A devtools/create_ultima/files/ultima3/dungeons/face_12.png
  A devtools/create_ultima/files/ultima3/dungeons/face_13.png
  A devtools/create_ultima/files/ultima3/dungeons/face_14.png
  A devtools/create_ultima/files/ultima3/dungeons/face_15.png
  A devtools/create_ultima/files/ultima3/dungeons/face_16.png
  A devtools/create_ultima/files/ultima3/dungeons/face_17.png
  A devtools/create_ultima/files/ultima3/dungeons/face_18.png
  A devtools/create_ultima/files/ultima3/dungeons/face_19.png
  A devtools/create_ultima/files/ultima3/dungeons/face_20.png
  A devtools/create_ultima/files/ultima3/dungeons/face_21.png
  A devtools/create_ultima/files/ultima3/dungeons/face_22.png
  A devtools/create_ultima/files/ultima3/dungeons/face_23.png
  A devtools/create_ultima/files/ultima3/dungeons/face_24.png
  A devtools/create_ultima/files/ultima3/dungeons/face_25.png
  A devtools/create_ultima/files/ultima3/dungeons/face_26.png
  A devtools/create_ultima/files/ultima3/dungeons/face_27.png
  A devtools/create_ultima/files/ultima3/dungeons/face_28.png
  A devtools/create_ultima/files/ultima3/dungeons/face_29.png
  A devtools/create_ultima/files/ultima3/dungeons/face_30.png
  A devtools/create_ultima/files/ultima3/dungeons/face_31.png
  A devtools/create_ultima/files/ultima3/dungeons/face_32.png
  A devtools/create_ultima/files/ultima3/dungeons/face_33.png
  A devtools/create_ultima/files/ultima3/dungeons/face_34.png
  A devtools/create_ultima/files/ultima3/dungeons/face_35.png
  A devtools/create_ultima/files/ultima3/dungeons/face_36.png
  A devtools/create_ultima/files/ultima3/dungeons/face_37.png
  A devtools/create_ultima/files/ultima3/dungeons/face_38.png
  A devtools/create_ultima/files/ultima3/dungeons/face_39.png
  A devtools/create_ultima/files/ultima3/dungeons/face_40.png
  A devtools/create_ultima/files/ultima3/dungeons/face_41.png
  A devtools/create_ultima/files/ultima3/dungeons/face_42.png
  A devtools/create_ultima/files/ultima3/dungeons/face_43.png
  A devtools/create_ultima/files/ultima3/dungeons/face_44.png
  A devtools/create_ultima/files/ultima3/dungeons/face_45.png
  A devtools/create_ultima/files/ultima3/dungeons/face_46.png
  A devtools/create_ultima/files/ultima3/dungeons/face_47.png
  A devtools/create_ultima/files/ultima3/dungeons/face_48.png
  A devtools/create_ultima/files/ultima3/dungeons/face_49.png
  A devtools/create_ultima/files/ultima3/dungeons/face_50.png
  A devtools/create_ultima/files/ultima3/dungeons/face_51.png
  A devtools/create_ultima/files/ultima3/dungeons/face_52.png
  A devtools/create_ultima/files/ultima3/dungeons/face_53.png
  A devtools/create_ultima/files/ultima3/dungeons/face_54.png
  A devtools/create_ultima/files/ultima3/dungeons/face_55.png
  A devtools/create_ultima/files/ultima3/dungeons/face_56.png
  A devtools/create_ultima/files/ultima3/dungeons/face_57.png
  A devtools/create_ultima/files/ultima3/dungeons/face_58.png
  A devtools/create_ultima/files/ultima3/dungeons/face_59.png
  A devtools/create_ultima/files/ultima3/dungeons/face_60.png
  A devtools/create_ultima/files/ultima3/dungeons/face_61.png
  A devtools/create_ultima/files/ultima3/dungeons/face_62.png
  A devtools/create_ultima/files/ultima3/dungeons/face_63.png
  A devtools/create_ultima/files/ultima3/dungeons/ladder_00.png
  A devtools/create_ultima/files/ultima3/dungeons/ladder_01.png
  A devtools/create_ultima/files/ultima3/dungeons/ladder_02.png
  A devtools/create_ultima/files/ultima3/dungeons/ladder_03.png
  A devtools/create_ultima/files/ultima3/dungeons/ladder_04.png
  A devtools/create_ultima/files/ultima3/dungeons/ladder_05.png
  A devtools/create_ultima/files/ultima3/dungeons/ladder_06.png
  A devtools/create_ultima/files/ultima3/dungeons/ladder_07.png
  A devtools/create_ultima/files/ultima3/dungeons/ladder_08.png
  A devtools/create_ultima/files/ultima3/dungeons/ladder_09.png
  A devtools/create_ultima/files/ultima3/dungeons/ladder_10.png
  A devtools/create_ultima/files/ultima3/dungeons/ladder_11.png
  A devtools/create_ultima/files/ultima3/dungeons/ladder_12.png
  A devtools/create_ultima/files/ultima3/dungeons/ladder_13.png
  A devtools/create_ultima/files/ultima3/dungeons/ladder_14.png
  A devtools/create_ultima/files/ultima3/dungeons/ladder_15.png
  A devtools/create_ultima/files/ultima3/dungeons/ladder_16.png
  A devtools/create_ultima/files/ultima3/dungeons/ladder_17.png
  A devtools/create_ultima/files/ultima3/dungeons/ladder_18.png
  A devtools/create_ultima/files/ultima3/dungeons/ladder_19.png
  A devtools/create_ultima/files/ultima3/dungeons/ladder_20.png
  A devtools/create_ultima/ultima3/gen_ultima3_dungeons.py
  A devtools/create_ultima/ultima3/ultima3_dungeons.txt
  A devtools/create_ultima/ultima4/create_ultima.cpp
  A devtools/create_ultima/ultima4/create_ultima.h
  A devtools/create_ultima/ultima4/file.cpp
  A devtools/create_ultima/ultima4/file.h
  A devtools/create_ultima/ultima4/module.mk
  A devtools/create_ultima/ultima4/ultima4_resources.cpp
  A devtools/create_ultima/ultima4/ultima4_resources.h
  R devtools/create_ultima/create_ultima.cpp
  R devtools/create_ultima/create_ultima.h
  R devtools/create_ultima/file.cpp
  R devtools/create_ultima/file.h
  R devtools/create_ultima/ultima4_resources.cpp
  R devtools/create_ultima/ultima4_resources.h
    .gitignore
    devtools/create_ultima/module.mk
    engines/ultima/detection.h
    engines/ultima/detection_tables.h
    engines/ultima/metaengine.cpp
    engines/ultima/ultima3/gfx/dungeon_view.cpp
    engines/ultima/ultima3/gfx/dungeon_view.h
    engines/ultima/ultima3/ultima3.cpp
    engines/ultima/ultima3/views/dungeon_map.cpp


diff --git a/.gitignore b/.gitignore
index 7cc0db1a124..4471e936a79 100644
--- a/.gitignore
+++ b/.gitignore
@@ -173,7 +173,7 @@ project.xcworkspace
 /devtools/create_tony/create_tony
 /devtools/create_toon/create_toon
 /devtools/create_translations/create_translations
-/devtools/create_ultima/create_ultima
+/devtools/create_ultima/ultima4/create_ultima
 /devtools/extract_mort/extract_mort
 /devtools/qtable/qtable
 /devtools/skycpt/skycpt
diff --git a/devtools/create_ultima/files/ultima3/dungeons/chest_00.png b/devtools/create_ultima/files/ultima3/dungeons/chest_00.png
new file mode 100644
index 00000000000..70cf564eb0f
Binary files /dev/null and b/devtools/create_ultima/files/ultima3/dungeons/chest_00.png differ
diff --git a/devtools/create_ultima/files/ultima3/dungeons/chest_01.png b/devtools/create_ultima/files/ultima3/dungeons/chest_01.png
new file mode 100644
index 00000000000..e9af13e636b
Binary files /dev/null and b/devtools/create_ultima/files/ultima3/dungeons/chest_01.png differ
diff --git a/devtools/create_ultima/files/ultima3/dungeons/chest_02.png b/devtools/create_ultima/files/ultima3/dungeons/chest_02.png
new file mode 100644
index 00000000000..914310ceca1
Binary files /dev/null and b/devtools/create_ultima/files/ultima3/dungeons/chest_02.png differ
diff --git a/devtools/create_ultima/files/ultima3/dungeons/chest_03.png b/devtools/create_ultima/files/ultima3/dungeons/chest_03.png
new file mode 100644
index 00000000000..e8c6d19e905
Binary files /dev/null and b/devtools/create_ultima/files/ultima3/dungeons/chest_03.png differ
diff --git a/devtools/create_ultima/files/ultima3/dungeons/chest_04.png b/devtools/create_ultima/files/ultima3/dungeons/chest_04.png
new file mode 100644
index 00000000000..09ac36b458e
Binary files /dev/null and b/devtools/create_ultima/files/ultima3/dungeons/chest_04.png differ
diff --git a/devtools/create_ultima/files/ultima3/dungeons/chest_05.png b/devtools/create_ultima/files/ultima3/dungeons/chest_05.png
new file mode 100644
index 00000000000..528eff067f1
Binary files /dev/null and b/devtools/create_ultima/files/ultima3/dungeons/chest_05.png differ
diff --git a/devtools/create_ultima/files/ultima3/dungeons/chest_06.png b/devtools/create_ultima/files/ultima3/dungeons/chest_06.png
new file mode 100644
index 00000000000..1dee4db6817
Binary files /dev/null and b/devtools/create_ultima/files/ultima3/dungeons/chest_06.png differ
diff --git a/devtools/create_ultima/files/ultima3/dungeons/chest_07.png b/devtools/create_ultima/files/ultima3/dungeons/chest_07.png
new file mode 100644
index 00000000000..49ad0d6c119
Binary files /dev/null and b/devtools/create_ultima/files/ultima3/dungeons/chest_07.png differ
diff --git a/devtools/create_ultima/files/ultima3/dungeons/chest_08.png b/devtools/create_ultima/files/ultima3/dungeons/chest_08.png
new file mode 100644
index 00000000000..bcfea02dd63
Binary files /dev/null and b/devtools/create_ultima/files/ultima3/dungeons/chest_08.png differ
diff --git a/devtools/create_ultima/files/ultima3/dungeons/chest_09.png b/devtools/create_ultima/files/ultima3/dungeons/chest_09.png
new file mode 100644
index 00000000000..a6007145480
Binary files /dev/null and b/devtools/create_ultima/files/ultima3/dungeons/chest_09.png differ
diff --git a/devtools/create_ultima/files/ultima3/dungeons/chest_10.png b/devtools/create_ultima/files/ultima3/dungeons/chest_10.png
new file mode 100644
index 00000000000..d64b7082334
Binary files /dev/null and b/devtools/create_ultima/files/ultima3/dungeons/chest_10.png differ
diff --git a/devtools/create_ultima/files/ultima3/dungeons/chest_11.png b/devtools/create_ultima/files/ultima3/dungeons/chest_11.png
new file mode 100644
index 00000000000..16814c85438
Binary files /dev/null and b/devtools/create_ultima/files/ultima3/dungeons/chest_11.png differ
diff --git a/devtools/create_ultima/files/ultima3/dungeons/chest_12.png b/devtools/create_ultima/files/ultima3/dungeons/chest_12.png
new file mode 100644
index 00000000000..74d9069a027
Binary files /dev/null and b/devtools/create_ultima/files/ultima3/dungeons/chest_12.png differ
diff --git a/devtools/create_ultima/files/ultima3/dungeons/chest_13.png b/devtools/create_ultima/files/ultima3/dungeons/chest_13.png
new file mode 100644
index 00000000000..b9e97bbb3b9
Binary files /dev/null and b/devtools/create_ultima/files/ultima3/dungeons/chest_13.png differ
diff --git a/devtools/create_ultima/files/ultima3/dungeons/chest_14.png b/devtools/create_ultima/files/ultima3/dungeons/chest_14.png
new file mode 100644
index 00000000000..3510cf148b6
Binary files /dev/null and b/devtools/create_ultima/files/ultima3/dungeons/chest_14.png differ
diff --git a/devtools/create_ultima/files/ultima3/dungeons/chest_15.png b/devtools/create_ultima/files/ultima3/dungeons/chest_15.png
new file mode 100644
index 00000000000..2d48b902284
Binary files /dev/null and b/devtools/create_ultima/files/ultima3/dungeons/chest_15.png differ
diff --git a/devtools/create_ultima/files/ultima3/dungeons/chest_16.png b/devtools/create_ultima/files/ultima3/dungeons/chest_16.png
new file mode 100644
index 00000000000..0118e6ecabe
Binary files /dev/null and b/devtools/create_ultima/files/ultima3/dungeons/chest_16.png differ
diff --git a/devtools/create_ultima/files/ultima3/dungeons/chest_17.png b/devtools/create_ultima/files/ultima3/dungeons/chest_17.png
new file mode 100644
index 00000000000..2b49954f1c8
Binary files /dev/null and b/devtools/create_ultima/files/ultima3/dungeons/chest_17.png differ
diff --git a/devtools/create_ultima/files/ultima3/dungeons/chest_18.png b/devtools/create_ultima/files/ultima3/dungeons/chest_18.png
new file mode 100644
index 00000000000..e2bc914efa5
Binary files /dev/null and b/devtools/create_ultima/files/ultima3/dungeons/chest_18.png differ
diff --git a/devtools/create_ultima/files/ultima3/dungeons/chest_19.png b/devtools/create_ultima/files/ultima3/dungeons/chest_19.png
new file mode 100644
index 00000000000..12198b96265
Binary files /dev/null and b/devtools/create_ultima/files/ultima3/dungeons/chest_19.png differ
diff --git a/devtools/create_ultima/files/ultima3/dungeons/chest_20.png b/devtools/create_ultima/files/ultima3/dungeons/chest_20.png
new file mode 100644
index 00000000000..466553be0f3
Binary files /dev/null and b/devtools/create_ultima/files/ultima3/dungeons/chest_20.png differ
diff --git a/devtools/create_ultima/files/ultima3/dungeons/face_00.png b/devtools/create_ultima/files/ultima3/dungeons/face_00.png
new file mode 100644
index 00000000000..6f95b3a7a78
Binary files /dev/null and b/devtools/create_ultima/files/ultima3/dungeons/face_00.png differ
diff --git a/devtools/create_ultima/files/ultima3/dungeons/face_01.png b/devtools/create_ultima/files/ultima3/dungeons/face_01.png
new file mode 100644
index 00000000000..fccd0891841
Binary files /dev/null and b/devtools/create_ultima/files/ultima3/dungeons/face_01.png differ
diff --git a/devtools/create_ultima/files/ultima3/dungeons/face_02.png b/devtools/create_ultima/files/ultima3/dungeons/face_02.png
new file mode 100644
index 00000000000..739c0f2249a
Binary files /dev/null and b/devtools/create_ultima/files/ultima3/dungeons/face_02.png differ
diff --git a/devtools/create_ultima/files/ultima3/dungeons/face_03.png b/devtools/create_ultima/files/ultima3/dungeons/face_03.png
new file mode 100644
index 00000000000..b8c6750bec7
Binary files /dev/null and b/devtools/create_ultima/files/ultima3/dungeons/face_03.png differ
diff --git a/devtools/create_ultima/files/ultima3/dungeons/face_04.png b/devtools/create_ultima/files/ultima3/dungeons/face_04.png
new file mode 100644
index 00000000000..605d3a4bd14
Binary files /dev/null and b/devtools/create_ultima/files/ultima3/dungeons/face_04.png differ
diff --git a/devtools/create_ultima/files/ultima3/dungeons/face_05.png b/devtools/create_ultima/files/ultima3/dungeons/face_05.png
new file mode 100644
index 00000000000..c769174e26c
Binary files /dev/null and b/devtools/create_ultima/files/ultima3/dungeons/face_05.png differ
diff --git a/devtools/create_ultima/files/ultima3/dungeons/face_06.png b/devtools/create_ultima/files/ultima3/dungeons/face_06.png
new file mode 100644
index 00000000000..cd4b1fb7786
Binary files /dev/null and b/devtools/create_ultima/files/ultima3/dungeons/face_06.png differ
diff --git a/devtools/create_ultima/files/ultima3/dungeons/face_07.png b/devtools/create_ultima/files/ultima3/dungeons/face_07.png
new file mode 100644
index 00000000000..fc359e4ecb4
Binary files /dev/null and b/devtools/create_ultima/files/ultima3/dungeons/face_07.png differ
diff --git a/devtools/create_ultima/files/ultima3/dungeons/face_08.png b/devtools/create_ultima/files/ultima3/dungeons/face_08.png
new file mode 100644
index 00000000000..9813a3e7ebc
Binary files /dev/null and b/devtools/create_ultima/files/ultima3/dungeons/face_08.png differ
diff --git a/devtools/create_ultima/files/ultima3/dungeons/face_09.png b/devtools/create_ultima/files/ultima3/dungeons/face_09.png
new file mode 100644
index 00000000000..69a152486b0
Binary files /dev/null and b/devtools/create_ultima/files/ultima3/dungeons/face_09.png differ
diff --git a/devtools/create_ultima/files/ultima3/dungeons/face_10.png b/devtools/create_ultima/files/ultima3/dungeons/face_10.png
new file mode 100644
index 00000000000..15fcbb04fcb
Binary files /dev/null and b/devtools/create_ultima/files/ultima3/dungeons/face_10.png differ
diff --git a/devtools/create_ultima/files/ultima3/dungeons/face_11.png b/devtools/create_ultima/files/ultima3/dungeons/face_11.png
new file mode 100644
index 00000000000..17ad5f175e7
Binary files /dev/null and b/devtools/create_ultima/files/ultima3/dungeons/face_11.png differ
diff --git a/devtools/create_ultima/files/ultima3/dungeons/face_12.png b/devtools/create_ultima/files/ultima3/dungeons/face_12.png
new file mode 100644
index 00000000000..a33e72e5f71
Binary files /dev/null and b/devtools/create_ultima/files/ultima3/dungeons/face_12.png differ
diff --git a/devtools/create_ultima/files/ultima3/dungeons/face_13.png b/devtools/create_ultima/files/ultima3/dungeons/face_13.png
new file mode 100644
index 00000000000..336bd1d2347
Binary files /dev/null and b/devtools/create_ultima/files/ultima3/dungeons/face_13.png differ
diff --git a/devtools/create_ultima/files/ultima3/dungeons/face_14.png b/devtools/create_ultima/files/ultima3/dungeons/face_14.png
new file mode 100644
index 00000000000..4d009d330e6
Binary files /dev/null and b/devtools/create_ultima/files/ultima3/dungeons/face_14.png differ
diff --git a/devtools/create_ultima/files/ultima3/dungeons/face_15.png b/devtools/create_ultima/files/ultima3/dungeons/face_15.png
new file mode 100644
index 00000000000..52b9670ede7
Binary files /dev/null and b/devtools/create_ultima/files/ultima3/dungeons/face_15.png differ
diff --git a/devtools/create_ultima/files/ultima3/dungeons/face_16.png b/devtools/create_ultima/files/ultima3/dungeons/face_16.png
new file mode 100644
index 00000000000..cf84b08a7de
Binary files /dev/null and b/devtools/create_ultima/files/ultima3/dungeons/face_16.png differ
diff --git a/devtools/create_ultima/files/ultima3/dungeons/face_17.png b/devtools/create_ultima/files/ultima3/dungeons/face_17.png
new file mode 100644
index 00000000000..504fa47363f
Binary files /dev/null and b/devtools/create_ultima/files/ultima3/dungeons/face_17.png differ
diff --git a/devtools/create_ultima/files/ultima3/dungeons/face_18.png b/devtools/create_ultima/files/ultima3/dungeons/face_18.png
new file mode 100644
index 00000000000..5b16559be3f
Binary files /dev/null and b/devtools/create_ultima/files/ultima3/dungeons/face_18.png differ
diff --git a/devtools/create_ultima/files/ultima3/dungeons/face_19.png b/devtools/create_ultima/files/ultima3/dungeons/face_19.png
new file mode 100644
index 00000000000..20ecbd4e38e
Binary files /dev/null and b/devtools/create_ultima/files/ultima3/dungeons/face_19.png differ
diff --git a/devtools/create_ultima/files/ultima3/dungeons/face_20.png b/devtools/create_ultima/files/ultima3/dungeons/face_20.png
new file mode 100644
index 00000000000..1dadff7c373
Binary files /dev/null and b/devtools/create_ultima/files/ultima3/dungeons/face_20.png differ
diff --git a/devtools/create_ultima/files/ultima3/dungeons/face_21.png b/devtools/create_ultima/files/ultima3/dungeons/face_21.png
new file mode 100644
index 00000000000..1423e65b6de
Binary files /dev/null and b/devtools/create_ultima/files/ultima3/dungeons/face_21.png differ
diff --git a/devtools/create_ultima/files/ultima3/dungeons/face_22.png b/devtools/create_ultima/files/ultima3/dungeons/face_22.png
new file mode 100644
index 00000000000..bc8d7666f18
Binary files /dev/null and b/devtools/create_ultima/files/ultima3/dungeons/face_22.png differ
diff --git a/devtools/create_ultima/files/ultima3/dungeons/face_23.png b/devtools/create_ultima/files/ultima3/dungeons/face_23.png
new file mode 100644
index 00000000000..c63035366db
Binary files /dev/null and b/devtools/create_ultima/files/ultima3/dungeons/face_23.png differ
diff --git a/devtools/create_ultima/files/ultima3/dungeons/face_24.png b/devtools/create_ultima/files/ultima3/dungeons/face_24.png
new file mode 100644
index 00000000000..2da88554620
Binary files /dev/null and b/devtools/create_ultima/files/ultima3/dungeons/face_24.png differ
diff --git a/devtools/create_ultima/files/ultima3/dungeons/face_25.png b/devtools/create_ultima/files/ultima3/dungeons/face_25.png
new file mode 100644
index 00000000000..6a361426495
Binary files /dev/null and b/devtools/create_ultima/files/ultima3/dungeons/face_25.png differ
diff --git a/devtools/create_ultima/files/ultima3/dungeons/face_26.png b/devtools/create_ultima/files/ultima3/dungeons/face_26.png
new file mode 100644
index 00000000000..ad4daddaed7
Binary files /dev/null and b/devtools/create_ultima/files/ultima3/dungeons/face_26.png differ
diff --git a/devtools/create_ultima/files/ultima3/dungeons/face_27.png b/devtools/create_ultima/files/ultima3/dungeons/face_27.png
new file mode 100644
index 00000000000..31c2ee9d45a
Binary files /dev/null and b/devtools/create_ultima/files/ultima3/dungeons/face_27.png differ
diff --git a/devtools/create_ultima/files/ultima3/dungeons/face_28.png b/devtools/create_ultima/files/ultima3/dungeons/face_28.png
new file mode 100644
index 00000000000..c9a15b51db0
Binary files /dev/null and b/devtools/create_ultima/files/ultima3/dungeons/face_28.png differ
diff --git a/devtools/create_ultima/files/ultima3/dungeons/face_29.png b/devtools/create_ultima/files/ultima3/dungeons/face_29.png
new file mode 100644
index 00000000000..a40eabcb0f1
Binary files /dev/null and b/devtools/create_ultima/files/ultima3/dungeons/face_29.png differ
diff --git a/devtools/create_ultima/files/ultima3/dungeons/face_30.png b/devtools/create_ultima/files/ultima3/dungeons/face_30.png
new file mode 100644
index 00000000000..d4d8575e0d0
Binary files /dev/null and b/devtools/create_ultima/files/ultima3/dungeons/face_30.png differ
diff --git a/devtools/create_ultima/files/ultima3/dungeons/face_31.png b/devtools/create_ultima/files/ultima3/dungeons/face_31.png
new file mode 100644
index 00000000000..9a4222377a9
Binary files /dev/null and b/devtools/create_ultima/files/ultima3/dungeons/face_31.png differ
diff --git a/devtools/create_ultima/files/ultima3/dungeons/face_32.png b/devtools/create_ultima/files/ultima3/dungeons/face_32.png
new file mode 100644
index 00000000000..ddb49a035bf
Binary files /dev/null and b/devtools/create_ultima/files/ultima3/dungeons/face_32.png differ
diff --git a/devtools/create_ultima/files/ultima3/dungeons/face_33.png b/devtools/create_ultima/files/ultima3/dungeons/face_33.png
new file mode 100644
index 00000000000..82b194cc2f1
Binary files /dev/null and b/devtools/create_ultima/files/ultima3/dungeons/face_33.png differ
diff --git a/devtools/create_ultima/files/ultima3/dungeons/face_34.png b/devtools/create_ultima/files/ultima3/dungeons/face_34.png
new file mode 100644
index 00000000000..c78b7b76b1f
Binary files /dev/null and b/devtools/create_ultima/files/ultima3/dungeons/face_34.png differ
diff --git a/devtools/create_ultima/files/ultima3/dungeons/face_35.png b/devtools/create_ultima/files/ultima3/dungeons/face_35.png
new file mode 100644
index 00000000000..00a7c1aeaa4
Binary files /dev/null and b/devtools/create_ultima/files/ultima3/dungeons/face_35.png differ
diff --git a/devtools/create_ultima/files/ultima3/dungeons/face_36.png b/devtools/create_ultima/files/ultima3/dungeons/face_36.png
new file mode 100644
index 00000000000..1eb77dd4afd
Binary files /dev/null and b/devtools/create_ultima/files/ultima3/dungeons/face_36.png differ
diff --git a/devtools/create_ultima/files/ultima3/dungeons/face_37.png b/devtools/create_ultima/files/ultima3/dungeons/face_37.png
new file mode 100644
index 00000000000..f05858beacc
Binary files /dev/null and b/devtools/create_ultima/files/ultima3/dungeons/face_37.png differ
diff --git a/devtools/create_ultima/files/ultima3/dungeons/face_38.png b/devtools/create_ultima/files/ultima3/dungeons/face_38.png
new file mode 100644
index 00000000000..d1059c85d55
Binary files /dev/null and b/devtools/create_ultima/files/ultima3/dungeons/face_38.png differ
diff --git a/devtools/create_ultima/files/ultima3/dungeons/face_39.png b/devtools/create_ultima/files/ultima3/dungeons/face_39.png
new file mode 100644
index 00000000000..6e776763c58
Binary files /dev/null and b/devtools/create_ultima/files/ultima3/dungeons/face_39.png differ
diff --git a/devtools/create_ultima/files/ultima3/dungeons/face_40.png b/devtools/create_ultima/files/ultima3/dungeons/face_40.png
new file mode 100644
index 00000000000..a5a173bd3d8
Binary files /dev/null and b/devtools/create_ultima/files/ultima3/dungeons/face_40.png differ
diff --git a/devtools/create_ultima/files/ultima3/dungeons/face_41.png b/devtools/create_ultima/files/ultima3/dungeons/face_41.png
new file mode 100644
index 00000000000..8c925b613bd
Binary files /dev/null and b/devtools/create_ultima/files/ultima3/dungeons/face_41.png differ
diff --git a/devtools/create_ultima/files/ultima3/dungeons/face_42.png b/devtools/create_ultima/files/ultima3/dungeons/face_42.png
new file mode 100644
index 00000000000..09b84d61874
Binary files /dev/null and b/devtools/create_ultima/files/ultima3/dungeons/face_42.png differ
diff --git a/devtools/create_ultima/files/ultima3/dungeons/face_43.png b/devtools/create_ultima/files/ultima3/dungeons/face_43.png
new file mode 100644
index 00000000000..80912bb71a7
Binary files /dev/null and b/devtools/create_ultima/files/ultima3/dungeons/face_43.png differ
diff --git a/devtools/create_ultima/files/ultima3/dungeons/face_44.png b/devtools/create_ultima/files/ultima3/dungeons/face_44.png
new file mode 100644
index 00000000000..0453a072be2
Binary files /dev/null and b/devtools/create_ultima/files/ultima3/dungeons/face_44.png differ
diff --git a/devtools/create_ultima/files/ultima3/dungeons/face_45.png b/devtools/create_ultima/files/ultima3/dungeons/face_45.png
new file mode 100644
index 00000000000..990bf4fdce8
Binary files /dev/null and b/devtools/create_ultima/files/ultima3/dungeons/face_45.png differ
diff --git a/devtools/create_ultima/files/ultima3/dungeons/face_46.png b/devtools/create_ultima/files/ultima3/dungeons/face_46.png
new file mode 100644
index 00000000000..05d9391e4f4
Binary files /dev/null and b/devtools/create_ultima/files/ultima3/dungeons/face_46.png differ
diff --git a/devtools/create_ultima/files/ultima3/dungeons/face_47.png b/devtools/create_ultima/files/ultima3/dungeons/face_47.png
new file mode 100644
index 00000000000..6dc9cdbec96
Binary files /dev/null and b/devtools/create_ultima/files/ultima3/dungeons/face_47.png differ
diff --git a/devtools/create_ultima/files/ultima3/dungeons/face_48.png b/devtools/create_ultima/files/ultima3/dungeons/face_48.png
new file mode 100644
index 00000000000..4cd7a033a33
Binary files /dev/null and b/devtools/create_ultima/files/ultima3/dungeons/face_48.png differ
diff --git a/devtools/create_ultima/files/ultima3/dungeons/face_49.png b/devtools/create_ultima/files/ultima3/dungeons/face_49.png
new file mode 100644
index 00000000000..7298d3b0506
Binary files /dev/null and b/devtools/create_ultima/files/ultima3/dungeons/face_49.png differ
diff --git a/devtools/create_ultima/files/ultima3/dungeons/face_50.png b/devtools/create_ultima/files/ultima3/dungeons/face_50.png
new file mode 100644
index 00000000000..43ee91bb9d6
Binary files /dev/null and b/devtools/create_ultima/files/ultima3/dungeons/face_50.png differ
diff --git a/devtools/create_ultima/files/ultima3/dungeons/face_51.png b/devtools/create_ultima/files/ultima3/dungeons/face_51.png
new file mode 100644
index 00000000000..06894884791
Binary files /dev/null and b/devtools/create_ultima/files/ultima3/dungeons/face_51.png differ
diff --git a/devtools/create_ultima/files/ultima3/dungeons/face_52.png b/devtools/create_ultima/files/ultima3/dungeons/face_52.png
new file mode 100644
index 00000000000..7e132ae7b35
Binary files /dev/null and b/devtools/create_ultima/files/ultima3/dungeons/face_52.png differ
diff --git a/devtools/create_ultima/files/ultima3/dungeons/face_53.png b/devtools/create_ultima/files/ultima3/dungeons/face_53.png
new file mode 100644
index 00000000000..0c7fa5b0cd1
Binary files /dev/null and b/devtools/create_ultima/files/ultima3/dungeons/face_53.png differ
diff --git a/devtools/create_ultima/files/ultima3/dungeons/face_54.png b/devtools/create_ultima/files/ultima3/dungeons/face_54.png
new file mode 100644
index 00000000000..68446762b27
Binary files /dev/null and b/devtools/create_ultima/files/ultima3/dungeons/face_54.png differ
diff --git a/devtools/create_ultima/files/ultima3/dungeons/face_55.png b/devtools/create_ultima/files/ultima3/dungeons/face_55.png
new file mode 100644
index 00000000000..06449fe2dee
Binary files /dev/null and b/devtools/create_ultima/files/ultima3/dungeons/face_55.png differ
diff --git a/devtools/create_ultima/files/ultima3/dungeons/face_56.png b/devtools/create_ultima/files/ultima3/dungeons/face_56.png
new file mode 100644
index 00000000000..f2ec5a4186b
Binary files /dev/null and b/devtools/create_ultima/files/ultima3/dungeons/face_56.png differ
diff --git a/devtools/create_ultima/files/ultima3/dungeons/face_57.png b/devtools/create_ultima/files/ultima3/dungeons/face_57.png
new file mode 100644
index 00000000000..640db5e62d8
Binary files /dev/null and b/devtools/create_ultima/files/ultima3/dungeons/face_57.png differ
diff --git a/devtools/create_ultima/files/ultima3/dungeons/face_58.png b/devtools/create_ultima/files/ultima3/dungeons/face_58.png
new file mode 100644
index 00000000000..6620cd3952a
Binary files /dev/null and b/devtools/create_ultima/files/ultima3/dungeons/face_58.png differ
diff --git a/devtools/create_ultima/files/ultima3/dungeons/face_59.png b/devtools/create_ultima/files/ultima3/dungeons/face_59.png
new file mode 100644
index 00000000000..2567374339a
Binary files /dev/null and b/devtools/create_ultima/files/ultima3/dungeons/face_59.png differ
diff --git a/devtools/create_ultima/files/ultima3/dungeons/face_60.png b/devtools/create_ultima/files/ultima3/dungeons/face_60.png
new file mode 100644
index 00000000000..077df0dcc6d
Binary files /dev/null and b/devtools/create_ultima/files/ultima3/dungeons/face_60.png differ
diff --git a/devtools/create_ultima/files/ultima3/dungeons/face_61.png b/devtools/create_ultima/files/ultima3/dungeons/face_61.png
new file mode 100644
index 00000000000..550d56461d7
Binary files /dev/null and b/devtools/create_ultima/files/ultima3/dungeons/face_61.png differ
diff --git a/devtools/create_ultima/files/ultima3/dungeons/face_62.png b/devtools/create_ultima/files/ultima3/dungeons/face_62.png
new file mode 100644
index 00000000000..9afe182f8a7
Binary files /dev/null and b/devtools/create_ultima/files/ultima3/dungeons/face_62.png differ
diff --git a/devtools/create_ultima/files/ultima3/dungeons/face_63.png b/devtools/create_ultima/files/ultima3/dungeons/face_63.png
new file mode 100644
index 00000000000..e13b5748a5c
Binary files /dev/null and b/devtools/create_ultima/files/ultima3/dungeons/face_63.png differ
diff --git a/devtools/create_ultima/files/ultima3/dungeons/ladder_00.png b/devtools/create_ultima/files/ultima3/dungeons/ladder_00.png
new file mode 100644
index 00000000000..4c94c8b1173
Binary files /dev/null and b/devtools/create_ultima/files/ultima3/dungeons/ladder_00.png differ
diff --git a/devtools/create_ultima/files/ultima3/dungeons/ladder_01.png b/devtools/create_ultima/files/ultima3/dungeons/ladder_01.png
new file mode 100644
index 00000000000..cd2d9423e41
Binary files /dev/null and b/devtools/create_ultima/files/ultima3/dungeons/ladder_01.png differ
diff --git a/devtools/create_ultima/files/ultima3/dungeons/ladder_02.png b/devtools/create_ultima/files/ultima3/dungeons/ladder_02.png
new file mode 100644
index 00000000000..e132701c6f2
Binary files /dev/null and b/devtools/create_ultima/files/ultima3/dungeons/ladder_02.png differ
diff --git a/devtools/create_ultima/files/ultima3/dungeons/ladder_03.png b/devtools/create_ultima/files/ultima3/dungeons/ladder_03.png
new file mode 100644
index 00000000000..b16a853485d
Binary files /dev/null and b/devtools/create_ultima/files/ultima3/dungeons/ladder_03.png differ
diff --git a/devtools/create_ultima/files/ultima3/dungeons/ladder_04.png b/devtools/create_ultima/files/ultima3/dungeons/ladder_04.png
new file mode 100644
index 00000000000..44c84ec9f37
Binary files /dev/null and b/devtools/create_ultima/files/ultima3/dungeons/ladder_04.png differ
diff --git a/devtools/create_ultima/files/ultima3/dungeons/ladder_05.png b/devtools/create_ultima/files/ultima3/dungeons/ladder_05.png
new file mode 100644
index 00000000000..ff2037a77b5
Binary files /dev/null and b/devtools/create_ultima/files/ultima3/dungeons/ladder_05.png differ
diff --git a/devtools/create_ultima/files/ultima3/dungeons/ladder_06.png b/devtools/create_ultima/files/ultima3/dungeons/ladder_06.png
new file mode 100644
index 00000000000..f71a8695c3b
Binary files /dev/null and b/devtools/create_ultima/files/ultima3/dungeons/ladder_06.png differ
diff --git a/devtools/create_ultima/files/ultima3/dungeons/ladder_07.png b/devtools/create_ultima/files/ultima3/dungeons/ladder_07.png
new file mode 100644
index 00000000000..a9a17f8f246
Binary files /dev/null and b/devtools/create_ultima/files/ultima3/dungeons/ladder_07.png differ
diff --git a/devtools/create_ultima/files/ultima3/dungeons/ladder_08.png b/devtools/create_ultima/files/ultima3/dungeons/ladder_08.png
new file mode 100644
index 00000000000..0b0e64528cf
Binary files /dev/null and b/devtools/create_ultima/files/ultima3/dungeons/ladder_08.png differ
diff --git a/devtools/create_ultima/files/ultima3/dungeons/ladder_09.png b/devtools/create_ultima/files/ultima3/dungeons/ladder_09.png
new file mode 100644
index 00000000000..aa33ddff022
Binary files /dev/null and b/devtools/create_ultima/files/ultima3/dungeons/ladder_09.png differ
diff --git a/devtools/create_ultima/files/ultima3/dungeons/ladder_10.png b/devtools/create_ultima/files/ultima3/dungeons/ladder_10.png
new file mode 100644
index 00000000000..a6de1500f2a
Binary files /dev/null and b/devtools/create_ultima/files/ultima3/dungeons/ladder_10.png differ
diff --git a/devtools/create_ultima/files/ultima3/dungeons/ladder_11.png b/devtools/create_ultima/files/ultima3/dungeons/ladder_11.png
new file mode 100644
index 00000000000..081f773f62c
Binary files /dev/null and b/devtools/create_ultima/files/ultima3/dungeons/ladder_11.png differ
diff --git a/devtools/create_ultima/files/ultima3/dungeons/ladder_12.png b/devtools/create_ultima/files/ultima3/dungeons/ladder_12.png
new file mode 100644
index 00000000000..9645f5b2001
Binary files /dev/null and b/devtools/create_ultima/files/ultima3/dungeons/ladder_12.png differ
diff --git a/devtools/create_ultima/files/ultima3/dungeons/ladder_13.png b/devtools/create_ultima/files/ultima3/dungeons/ladder_13.png
new file mode 100644
index 00000000000..d120453d5fe
Binary files /dev/null and b/devtools/create_ultima/files/ultima3/dungeons/ladder_13.png differ
diff --git a/devtools/create_ultima/files/ultima3/dungeons/ladder_14.png b/devtools/create_ultima/files/ultima3/dungeons/ladder_14.png
new file mode 100644
index 00000000000..ad35d457e09
Binary files /dev/null and b/devtools/create_ultima/files/ultima3/dungeons/ladder_14.png differ
diff --git a/devtools/create_ultima/files/ultima3/dungeons/ladder_15.png b/devtools/create_ultima/files/ultima3/dungeons/ladder_15.png
new file mode 100644
index 00000000000..97baaf5dc5b
Binary files /dev/null and b/devtools/create_ultima/files/ultima3/dungeons/ladder_15.png differ
diff --git a/devtools/create_ultima/files/ultima3/dungeons/ladder_16.png b/devtools/create_ultima/files/ultima3/dungeons/ladder_16.png
new file mode 100644
index 00000000000..4943945b261
Binary files /dev/null and b/devtools/create_ultima/files/ultima3/dungeons/ladder_16.png differ
diff --git a/devtools/create_ultima/files/ultima3/dungeons/ladder_17.png b/devtools/create_ultima/files/ultima3/dungeons/ladder_17.png
new file mode 100644
index 00000000000..c353aeaffaa
Binary files /dev/null and b/devtools/create_ultima/files/ultima3/dungeons/ladder_17.png differ
diff --git a/devtools/create_ultima/files/ultima3/dungeons/ladder_18.png b/devtools/create_ultima/files/ultima3/dungeons/ladder_18.png
new file mode 100644
index 00000000000..cd3d8ea8878
Binary files /dev/null and b/devtools/create_ultima/files/ultima3/dungeons/ladder_18.png differ
diff --git a/devtools/create_ultima/files/ultima3/dungeons/ladder_19.png b/devtools/create_ultima/files/ultima3/dungeons/ladder_19.png
new file mode 100644
index 00000000000..017ec5ebed7
Binary files /dev/null and b/devtools/create_ultima/files/ultima3/dungeons/ladder_19.png differ
diff --git a/devtools/create_ultima/files/ultima3/dungeons/ladder_20.png b/devtools/create_ultima/files/ultima3/dungeons/ladder_20.png
new file mode 100644
index 00000000000..47d427d3ef2
Binary files /dev/null and b/devtools/create_ultima/files/ultima3/dungeons/ladder_20.png differ
diff --git a/devtools/create_ultima/module.mk b/devtools/create_ultima/module.mk
index 4ef4ecf2dd2..975c35e2f9f 100644
--- a/devtools/create_ultima/module.mk
+++ b/devtools/create_ultima/module.mk
@@ -1,12 +1,2 @@
-MODULE := devtools/create_ultima
-
-MODULE_OBJS := \
-	create_ultima.o \
-	file.o \
-	ultima4_resources.o
-
-# Set the name of the executable
-TOOL_EXECUTABLE := create_ultima
-
-# Include common rules
-include $(srcdir)/rules.mk
+include $(srcdir)/devtools/create_ultima/ultima4/module.mk
+.PHONY: $(srcdir)/devtools/create_ultima/ultima4/module.mk
diff --git a/devtools/create_ultima/ultima3/gen_ultima3_dungeons.py b/devtools/create_ultima/ultima3/gen_ultima3_dungeons.py
new file mode 100644
index 00000000000..4aa7c2e257d
--- /dev/null
+++ b/devtools/create_ultima/ultima3/gen_ultima3_dungeons.py
@@ -0,0 +1,530 @@
+#!/usr/bin/env python3
+"""
+Generates the stand-in pictures for the Ultima III "textured dungeon" renderer, which is used with
+the Ultima III Upgrade's VGA graphics mode.
+
+Every picture is a 128x128 layer in the geometry of the original first person view, and uses the
+256 colors of the Upgrade's VGA palette (files/ultima3/u3vga.pal). Palette index 0 is transparent.
+The shapes come from the renderer's own tables in gfx/dungeon_view.cpp, so a face covers exactly
+the part of the view that the original line drawing did.
+
+  face_00..face_31.png   the wall seen from each place in view
+  face_32..face_63.png   the doors of each place: face_32 is the opening cut out of a wall
+                         the party stands in, and the rest are doors set in the walls
+  ladder_00..20.png      a ladder going up, which is flipped upside down for one going down
+  chest_00..20.png       a chest
+
+These are stand-in pictures made by a program, written with the help of an AI assistant (Claude).
+They are meant to be replaced by hand drawn art: any picture can be swapped for one of the same
+name, size and palette, and the renderer falls back to its lines for any that are missing.
+
+Usage: gen_ultima3_dungeons.py <dungeon_view.cpp> <u3vga.pal> <output folder> [<dungeon .ULT> <preview.png>]
+"""
+import math
+import os
+import random
+import re
+import struct
+import sys
+import zlib
+
+SIZE = 128
+
+
+# ------------------------------------------------------------------- palette
+
+class Palette:
+    # the entries in the file that are not used for anything are this color
+    UNUSED = (45, 255, 210)
+
+    def __init__(self, path):
+        data = open(path, "rb").read()
+        self.colors = [tuple(round(v * 255 / 63) for v in data[i * 3:i * 3 + 3]) for i in range(256)]
+
+        # the colors that a picture can use, which is each distinct one that's in use
+        self.usable = []
+        seen = set()
+        for index, color in enumerate(self.colors):
+            if index == 0 or color == self.UNUSED or color in seen:
+                continue
+            seen.add(color)
+            self.usable.append((index, color))
+
+        # the browns, which are used for wood so that it doesn't pick up olive or yellow speckles
+        self.browns = [(i, c) for (i, c) in self.usable
+                       if c[0] > c[1] > c[2] and 0.4 < c[1] / c[0] < 0.75 and c[0] - c[2] > 24]
+        self.cache = {}
+
+    def nearest(self, r, g, b, pool=None):
+        r, g, b = (max(0, min(255, int(v))) for v in (r, g, b))
+        key = (r >> 1, g >> 1, b >> 1, id(pool))
+        found = self.cache.get(key)
+        if found is None:
+            best, best_d = 1, 1 << 30
+            for index, (cr, cg, cb) in (pool or self.usable):
+                d = 3 * (cr - r) ** 2 + 5 * (cg - g) ** 2 + 2 * (cb - b) ** 2
+                if d < best_d:
+                    best, best_d = index, d
+            found = self.cache[key] = best
+        return found
+
+
+# ---------------------------------------------------------------- PNG output
+
+def chunk(tag, data):
+    body = tag + data
+    return struct.pack(">I", len(data)) + body + struct.pack(">I", zlib.crc32(body) & 0xFFFFFFFF)
+
+
+def write_indexed(path, pixels, w, h, palette):
+    """Writes an 8 bit paletted PNG, in which index 0 is transparent"""
+    raw = b"".join(b"\x00" + bytes(pixels[y * w:(y + 1) * w]) for y in range(h))
+    plte = b"".join(bytes(c) for c in palette.colors)
+    data = b"\x89PNG\r\n\x1a\n"
+    data += chunk(b"IHDR", struct.pack(">IIBBBBB", w, h, 8, 3, 0, 0, 0))
+    data += chunk(b"PLTE", plte)
+    data += chunk(b"tRNS", b"\x00")
+    data += chunk(b"IDAT", zlib.compress(raw, 9))
+    data += chunk(b"IEND", b"")
+    with open(path, "wb") as f:
+        f.write(data)
+
+
+def write_rgb(path, rgb, w, h):
+    raw = b"".join(b"\x00" + bytes(rgb[y * w * 3:(y + 1) * w * 3]) for y in range(h))
+    data = b"\x89PNG\r\n\x1a\n"
+    data += chunk(b"IHDR", struct.pack(">IIBBBBB", w, h, 8, 2, 0, 0, 0))
+    data += chunk(b"IDAT", zlib.compress(raw, 9))
+    data += chunk(b"IEND", b"")
+    with open(path, "wb") as f:
+        f.write(data)
+
+
+# ----------------------------------------------------------- renderer tables
+
+def parse_tables(source):
+    text = open(source).read()
+
+    def table(name):
+        m = re.search(name + r"\[(\d+)\](?:\[(\d+)\])? = \{(.*?)\n\};", text, re.S)
+        body = m.group(3)
+        if m.group(2):
+            rows = re.findall(r"\{([^}]*)\}", body)
+            return [[int(v, 0) for v in r.split(",") if v.strip()] for r in rows]
+        return [int(v, 0) for v in re.findall(r"0x[0-9A-Fa-f]+", body)]
+
+    return {
+        "walls": table("WALLS"), "ladders": table("LADDERS"), "chests": table("CHESTS"),
+        "dx": table("CELL_DX"), "dy": table("CELL_DY")
+    }
+
+
+def signed(v):
+    return v - 256 if v > 127 else v
+
+
+def face_columns(rec):
+    """The columns of a face, as the renderer works them out: (x, top, bottom, step)"""
+    x, top, bottom, step, top_n, bottom_n, count = rec[:7]
+    step = signed(step)
+    top_c, bottom_c = top_n, bottom_n
+    out = []
+    while True:
+        out.append((x, top, bottom, step))
+        count -= 1
+        if count == 0:
+            break
+
+        x = (x + step) & 0xFF
+        for _ in range(1 if step == 1 else 2):
+            top_c = (top_c - 1) & 0xFF
+            if top_c == 0:
+                top_c = top_n
+                top = (top + 1) & 0xFF
+            bottom_c = (bottom_c - 1) & 0xFF
+            if bottom_c == 0:
+                bottom_c = bottom_n
+                bottom = (bottom - 1) & 0xFF
+    return out
+
+
+class Face:
+    """The shape of a face, with where each of its pixels is on the wall"""
+
+    def __init__(self, rec):
+        self.rec = rec
+        self.cols = face_columns(rec)
+        self.frontal = rec[4] == 0xFF and rec[5] == 0xFF
+        self.cells = {}          # (x, y) -> (u, v, height)
+
+        heights = [(b - t) & 0xFF for (_, t, b, _) in self.cols]
+        self.h_near = max(heights[0], 1)
+        self.h_far = max(heights[-1], 1)
+        n = len(self.cols)
+
+        for i, (x, top, bottom, step) in enumerate(self.cols):
+            h = max((bottom - top) & 0xFF, 1)
+            if self.frontal or self.h_near == self.h_far:
+                u = (i + 0.5) / n
+            else:
+                # the distance along a side wall goes with 1 / height
+                u = (1.0 / h - 1.0 / self.h_near) / (1.0 / self.h_far - 1.0 / self.h_near)
+
+            xs = (x, x + 1) if step > 0 else (x - 1, x)
+            for xx in xs:
+                for y in range(top, top + h):
+                    if 0 <= xx < SIZE and 0 <= y < SIZE:
+                        self.cells[(xx, y)] = (u, (y - top + 0.5) / h, h)
+
+    def width_px(self, h):
+        """About how wide a cell of the wall is on the screen where the wall is h high"""
+        if self.frontal:
+            return len(self.cols) * 2
+        return max(len(self.cols) * 2 * h / max(self.h_near, 1), 1.0)
+
+
+# ------------------------------------------------------------------ painting
+
+def depth_level(h):
+    """How lit stone is, by how big it is in view: far stone is darker"""
+    return max(0.0, min(1.0, (h - 10) / 110.0))
+
+
+def mix(a, b, t):
+    return tuple(a[i] + (b[i] - a[i]) * t for i in range(3))
+
+
+def scale(c, k):
+    return tuple(v * k for v in c)
+
+
+STONE = (118, 110, 98)
+MORTAR = (36, 33, 30)
+RUST = (122, 66, 32)
+MOSS = (52, 98, 42)
+WOOD = (124, 82, 44)
+IRON = (76, 78, 88)
+FOG = (6, 6, 14)
+
+
+def put(img, palette, x, y, color, wood=False):
+    img[y * SIZE + x] = palette.nearest(*color, pool=palette.browns if wood else None)
+
+
+def stone(face, palette, seed, rows=8, bricks=4):
+    """Rough stone blocks laid in courses, dirtier and darker the further away they are"""
+    rng = random.Random(seed)
+    img = bytearray(SIZE * SIZE)
+    block = {}
+
+    def block_info(key):
+        if key not in block:
+            block[key] = (rng.uniform(-0.22, 0.22), rng.random(), rng.random(), rng.uniform(-1, 1))
+        return block[key]
+
+    for (x, y), (u, v, h) in face.cells.items():
+        row = int(v * rows)
+        bu = u * bricks + (0.5 if row & 1 else 0.0)
+        col = int(bu)
+        tone, stain, moss, hue = block_info((row, col))
+
+        brick_h = h / rows
+        fy = v * rows - row
+        fx = bu - int(bu)
+        brick_w = face.width_px(h) / bricks
+
+        mortar = (brick_h >= 3 and fy * brick_h < 1.0) or (brick_w >= 3 and fx * brick_w < 1.0)
+        light = 0.34 + 0.66 * depth_level(h)
+
+        # shadow where the wall meets the ceiling and floor, and in the corners
+        light *= 1.0 - 0.45 * max(0.0, (0.12 - v) / 0.12)
+        light *= 1.0 - 0.35 * max(0.0, (v - 0.85) / 0.15)
+        light *= 1.0 - 0.30 * max(0.0, (0.08 - u) / 0.08) - 0.30 * max(0.0, (u - 0.92) / 0.08)
+
+        if mortar:
+            color = scale(MORTAR, light * 1.4)
+        else:
+            color = (STONE[0] * (1 + 0.10 * hue), STONE[1], STONE[2] * (1 - 0.10 * hue))
+            color = scale(color, (1 + tone) * light)
+
+            # the top of each block catches the light, and the bottom is in shadow
+            if brick_h >= 4:
+                if 1.0 <= fy * brick_h < 2.0:
+                    color = scale(color, 1.18)
+                elif fy > 1 - 1.5 / brick_h:
+                    color = scale(color, 0.82)
+
+            # stains and moss on some blocks, and damp that runs down the lower walls
+            if stain > 0.9:
+                color = mix(color, scale(RUST, light), 0.55 * (0.6 + 0.4 * math.sin(x * 1.7)))
+            elif stain > 0.78:
+                color = scale(color, 0.8)
+            if moss > 0.92 and v > 0.5:
+                color = mix(color, scale(MOSS, light * 1.3), 0.65 * min(1.0, (v - 0.5) * 3))
+            color = mix(color, scale((70, 62, 50), light), 0.35 * max(0.0, (v - 0.8) / 0.2))
+
+        # the grain of the stone
+        color = scale(color, 1.0 + rng.gauss(0, 0.045))
+        put(img, palette, x, y, mix(color, FOG, 0.2 * (1 - depth_level(h))))
+
+    return img
+
+
+DOOR_WOOD = (150, 86, 42)
+
+
+def door(face, palette, seed):
+    """A wooden door of planks with iron bands, inside a dark frame"""
+    rng = random.Random(seed)
+    img = bytearray(SIZE * SIZE)
+    planks = 4
+
+    for (x, y), (u, v, h) in face.cells.items():
+        edge = (((x - 1, y) not in face.cells) or ((x + 1, y) not in face.cells) or
+                ((x, y - 1) not in face.cells) or ((x, y + 1) not in face.cells))
+
+        # doors stay as bright and rich a brown at a distance, so that they stand out from the walls
+        light = 0.85 + 0.25 * depth_level(h)
+
+        if edge:
+            put(img, palette, x, y, scale((50, 34, 22), light))
+            continue
+
+        pixels_per_plank = max(face.width_px(h) / planks, 1.0)
+        plank = int(u * planks)
+        fu = (u * planks - plank) * pixels_per_plank
+        grain = 0.07 * math.sin(y * 0.8 + plank * 2.7) + 0.05 * math.sin(y * 2.3 + x * 0.3 + plank)
+        color = scale(DOOR_WOOD, light * (1.0 + grain + (0.14 if plank & 1 else -0.08)))
+
+        # the gaps between the planks, and the lit edge of each
+        if fu < 1.3:
+            color = scale((46, 22, 10), light)
+        elif fu < 2.4:
+            color = scale(color, 1.2)
+
+        # iron bands across the door, edged dark, with rivets
+        on_wood = True
+        for band in (0.2, 0.8):
+            d = abs(v - band)
+            if d < 0.045:
+                color = scale((196, 196, 208), light)
+                on_wood = False
+                if int(u * 14) & 1 and d < 0.015 and h > 24:
+                    color = scale((120, 120, 132), light)
+            elif d < 0.065:
+                color = scale((52, 52, 60), light)
+                on_wood = False
+
+        color = scale(color, 1.0 + rng.gauss(0, 0.035))
+        put(img, palette, x, y, color, wood=on_wood)
+
+    return img
+
+
+def ladder(rec, palette, seed):
+    """A ladder with wooden rails and rungs, and nothing between them"""
+    rng = random.Random(seed)
+    left, right, top_l, top_r, edge_far, edge_near = rec[:6]
+    img = bytearray(SIZE * SIZE)
+
+    def dot(x, y, c):
+        if 0 <= x < SIZE and 0 <= y < SIZE:
+            put(img, palette, x, y, c, wood=True)
+
+    width = right - left
+    light = 0.5 + 0.5 * min(1.0, width / 32.0)
+    middle = 0x40
+
+    # the rails, which are missing where the ladder is out of view
+    rail_w = max(1, round(width / 12))
+    rails = []
+    if top_l != 0:
+        rails.append((left, top_l))
+    if top_r != 0:
+        rails.append((right - rail_w + 1, top_r))
+    if not rails:
+        return img
+
+    top = min(start for (_, start) in rails)
+    for rx, start in rails:
+        for y in range(start, middle + 1):
+            for w in range(rail_w):
+                shade = 1.15 - 0.4 * (w / rail_w)
+                dot(rx + w, y, scale(WOOD, light * shade * (1.0 + rng.gauss(0, 0.05))))
+
+    # the rungs are spread evenly down the rails, as far apart as the ladder is wide allows
+    length = middle - top
+    count = max(2, round(length / max(3.0, width * 0.45)))
+    for i in range(count):
+        y = int(top + (i + 0.5) * length / count)
+        for x in range(max(left, 0), right + 1):
+            if any(rx <= x < rx + rail_w for rx, _ in rails):
+                continue
+            dot(x, y, scale((154, 108, 62), light * 1.1))
+            if width >= 12:
+                dot(x, y + 1, scale((110, 74, 40), light))
+
+    return img
+
+
+def chest(rec, palette, seed):
+    x0, x1, y0, y1 = rec[:4]
+    rng = random.Random(seed)
+    img = bytearray(SIZE * SIZE)
+    w, h = x1 - x0, y1 - y0
+    light = 0.4 + 0.6 * min(1.0, w / 16.0)
+    lid = max(1, h // 3)
+
+    for y in range(y0, y1):
+        for x in range(x0, x1):
+            on_lid = y - y0 < lid
+            color = scale(WOOD, light * (1.12 if on_lid else 0.92))
+            color = scale(color, 1.0 + 0.08 * math.sin(x * 1.9 + y * 0.4))
+            if y == y0 or y == y1 - 1 or x == x0 or x == x1 - 1:
+                color = scale((40, 26, 14), light + 0.2)
+            elif y - y0 == lid:
+                color = scale((50, 32, 16), light + 0.2)
+            put(img, palette, x, y, scale(color, 1.0 + rng.gauss(0, 0.04)))
+
+    # iron bands and the lock
+    if w >= 6:
+        for bx in (x0 + max(1, w // 5), x1 - 1 - max(1, w // 5)):
+            for y in range(y0 + 1, y1 - 1):
+                put(img, palette, bx, y, scale(IRON, light * 1.5))
+        cx = (x0 + x1) // 2
+        for y in range(y0 + lid - 1, min(y1 - 1, y0 + lid + 2)):
+            if y > y0:
+                put(img, palette, cx, y, scale((232, 190, 62), light + 0.1))
+                if w >= 12:
+                    put(img, palette, cx + 1, y, scale((200, 160, 44), light))
+    return img
+
+
+# -------------------------------------------------------------- the preview
+
+def preview(tables, images, palette, dungeon_path, level, px, py, facing):
+    """Draws a view the way the renderer does, with these images, to see how they look"""
+    d = open(dungeon_path, "rb").read()
+    DT_WALL, DT_DOOR, DT_UP, DT_DOWN, DT_CHEST = 0x80, 0xC0, 0x10, 0x20, 0x40
+
+    def tile(x, y):
+        return d[(level << 8) + ((y & 15) << 4) + (x & 15)]
+
+    buf = bytearray(SIZE * SIZE)
+    deferred = []
+
+    def blit(img, flip=False, erase=False):
+        for y in range(SIZE):
+            sy = SIZE - 1 - y if flip else y
+            for x in range(SIZE):
+                c = img[sy * SIZE + x]
+                if c:
+                    buf[y * SIZE + x] = 0 if erase else c
+
+    def look(place):
+        dx, dy = signed(tables["dx"][place]), signed(tables["dy"][place])
+        for _ in range(facing):
+            dx, dy = dy, dx
+            dx = -dx
+        t = tile(px + dx, py + dy)
+        if not (t & DT_WALL):
+            if place < 21:
+                if t & DT_UP:
+                    deferred.append((images["ladder_%02d" % place], False))
+                if t & DT_DOWN:
+                    deferred.append((images["ladder_%02d" % place], True))
+                if t & DT_CHEST:
+                    deferred.append((images["chest_%02d" % place], False))
+            return "open"
+        blit(images["face_%02d" % place])
+        if t < DT_DOOR:
+            return "wall"
+        blit(images["face_%02d" % (place + 32)], erase=(place + 32 == 32))
+        return "door" if place == 0 else "wall"
+
+    def along(places):
+        for p in places:
+            if look(p) == "wall":
+                return
+
+    left_a, right_a = [1, 3, 6, 10, 15, 21], [2, 5, 9, 14, 20, 27]
+    left_b, right_b = [7, 11, 16, 22], [8, 13, 19, 26]
+    left_c, right_c = [17, 23, 28], [18, 25, 31]
+
+    here = look(0)
+    if here != "wall":
+        if here == "open":
+            along(left_a)
+            along(right_a)
+        if look(4) == "open":
+            along(left_b)
+            along(right_b)
+            if look(12) == "open":
+                along(left_c)
+                along(right_c)
+                if look(24) != "wall":
+                    look(29)
+                    look(30)
+
+    for img, flip in reversed(deferred):
+        blit(img, flip)
+
+    rgb = bytearray()
+    for y in range(SIZE):
+        for x in range(SIZE):
+            rgb += bytes(palette.colors[buf[y * SIZE + x]])
+    return rgb
+
+
+def enlarge(rgb, w, h, k):
+    out = bytearray()
+    for y in range(h):
+        row = bytearray()
+        for x in range(w):
+            row += bytes(rgb[(y * w + x) * 3:(y * w + x) * 3 + 3]) * k
+        out += bytes(row) * k
+    return out
+
+
+def main():
+    source, palette_path, outdir = sys.argv[1:4]
+    tables = parse_tables(source)
+    palette = Palette(palette_path)
+    os.makedirs(outdir, exist_ok=True)
+
+    images = {}
+    for i in range(64):
+        face = Face(tables["walls"][i])
+        if i < 32:
+            images["face_%02d" % i] = stone(face, palette, 1000 + i)
+        elif i == 32:
+            # the cut out only rubs out the wall, so it can be any color
+            cut = bytearray(SIZE * SIZE)
+            for (x, y) in face.cells:
+                cut[y * SIZE + x] = palette.nearest(60, 60, 60)
+            images["face_32"] = cut
+        else:
+            images["face_%02d" % i] = door(face, palette, 2000 + i)
+
+    for i in range(21):
+        images["ladder_%02d" % i] = ladder(tables["ladders"][i], palette, 3000 + i)
+        images["chest_%02d" % i] = chest(tables["chests"][i], palette, 4000 + i)
+
+    for name, img in images.items():
+        write_indexed(os.path.join(outdir, name + ".png"), img, SIZE, SIZE, palette)
+
+    if len(sys.argv) > 5:
+        dungeon, preview_path = sys.argv[4], sys.argv[5]
+        shots = [preview(tables, images, palette, dungeon, lvl, x, y, f)
+                 for (lvl, x, y, f) in [(0, 1, 3, 1), (0, 3, 1, 3), (0, 13, 2, 0), (0, 2, 1, 3)]]
+        k = 3
+        w = SIZE * len(shots)
+        rgb = bytearray()
+        for y in range(SIZE):
+            for s in shots:
+                rgb += s[y * SIZE * 3:(y + 1) * SIZE * 3]
+        write_rgb(preview_path, enlarge(rgb, w, SIZE, k), w * k, SIZE * k)
+
+
+if __name__ == "__main__":
+    main()
diff --git a/devtools/create_ultima/ultima3/ultima3_dungeons.txt b/devtools/create_ultima/ultima3/ultima3_dungeons.txt
new file mode 100644
index 00000000000..48d159e5bbe
--- /dev/null
+++ b/devtools/create_ultima/ultima3/ultima3_dungeons.txt
@@ -0,0 +1,43 @@
+Ultima III textured dungeon pictures
+====================================
+
+With the VGA graphics mode (the default of the enhanced game) and the "Use textured dungeon walls"
+option, the first person view in dungeons is drawn from the pictures in files/ultima3/dungeons
+rather than from lines. Any picture that is missing is drawn the old way, so they can be replaced
+one at a time.
+
+Format
+------
+* 128x128 pixel PNG, paletted with the 256 colors of the VGA mode (files/ultima3/u3vga.pal). The
+  game draws the palette indexes, so it doesn't matter what palette is in the PNG, but keep to the
+  one in the file so that they look right in an editor. Entries that are all the same cyan-green
+  (2dffd2) aren't used for anything and shouldn't be used.
+* Palette entry 0 is transparent (the PNG has a tRNS chunk saying so). Black can be drawn with a
+  near black entry such as 145 (040404).
+* Every picture is a layer the size of the view, so a piece goes where it sits in the view. The
+  view is the area 32 pixels in from the left and top of the game screen.
+
+The pieces
+----------
+The places in view are numbered as in gfx/dungeon_view.cpp. 0 is the square the party is on, 1 and 2
+are the squares to its left and right, 3, 4 and 5 are the squares in the row ahead (left, middle,
+right), and so on, going outwards and away. The shapes of the pieces are the same as the original's
+lines (they are worked out from the same tables), so none of the wall pieces overlap.
+
+* face_00 to face_31: the wall seen from each place, as the stone face of a block that is solid
+  (and also the face of a door, which gets its door from the next set).
+* face_33 to face_63: the door set in the wall of the place that is 32 less. Drawn over the wall.
+* face_32: the opening of the door that the party is standing in. It is only used to rub out the
+  part of face_00 that is in front of the party, so any opaque pixels will do.
+* ladder_00 to ladder_20: a ladder up, in the ceiling of that place. A ladder down is the same
+  picture flipped upside down, so draw the up one.
+* chest_00 to chest_20: a chest in that place.
+
+Ladders and chests are drawn over the walls, farthest first.
+
+Regenerating the stand-ins
+--------------------------
+python gen_ultima3_dungeons.py ../../../engines/ultima/ultima3/gfx/dungeon_view.cpp ../files/ultima3/u3vga.pal ../files/ultima3/dungeons
+
+Adding a dungeon .ULT file and a preview .png name after those arguments also draws a few views
+made of the pictures, to look at.
diff --git a/devtools/create_ultima/create_ultima.cpp b/devtools/create_ultima/ultima4/create_ultima.cpp
similarity index 100%
rename from devtools/create_ultima/create_ultima.cpp
rename to devtools/create_ultima/ultima4/create_ultima.cpp
diff --git a/devtools/create_ultima/create_ultima.h b/devtools/create_ultima/ultima4/create_ultima.h
similarity index 100%
rename from devtools/create_ultima/create_ultima.h
rename to devtools/create_ultima/ultima4/create_ultima.h
diff --git a/devtools/create_ultima/file.cpp b/devtools/create_ultima/ultima4/file.cpp
similarity index 100%
rename from devtools/create_ultima/file.cpp
rename to devtools/create_ultima/ultima4/file.cpp
diff --git a/devtools/create_ultima/file.h b/devtools/create_ultima/ultima4/file.h
similarity index 100%
rename from devtools/create_ultima/file.h
rename to devtools/create_ultima/ultima4/file.h
diff --git a/devtools/create_ultima/ultima4/module.mk b/devtools/create_ultima/ultima4/module.mk
new file mode 100644
index 00000000000..4d12a11c4b4
--- /dev/null
+++ b/devtools/create_ultima/ultima4/module.mk
@@ -0,0 +1,12 @@
+MODULE := devtools/create_ultima/ultima4
+
+MODULE_OBJS := \
+	create_ultima.o \
+	file.o \
+	ultima4_resources.o
+
+# Set the name of the executable
+TOOL_EXECUTABLE := create_ultima
+
+# Include common rules
+include $(srcdir)/rules.mk
diff --git a/devtools/create_ultima/ultima4_resources.cpp b/devtools/create_ultima/ultima4/ultima4_resources.cpp
similarity index 100%
rename from devtools/create_ultima/ultima4_resources.cpp
rename to devtools/create_ultima/ultima4/ultima4_resources.cpp
diff --git a/devtools/create_ultima/ultima4_resources.h b/devtools/create_ultima/ultima4/ultima4_resources.h
similarity index 100%
rename from devtools/create_ultima/ultima4_resources.h
rename to devtools/create_ultima/ultima4/ultima4_resources.h
diff --git a/engines/ultima/detection.h b/engines/ultima/detection.h
index 73336885054..d9947f8a049 100644
--- a/engines/ultima/detection.h
+++ b/engines/ultima/detection.h
@@ -86,6 +86,7 @@ struct UltimaGameDescription {
 #define GAMEOPTION_ULTIMA3_MOON_ICONS    GUIO_GAMEOPTIONS14
 #define GAMEOPTION_ULTIMA3_MIDI_MUSIC    GUIO_GAMEOPTIONS15
 #define GAMEOPTION_ULTIMA3_TIMED_SOUNDS  GUIO_GAMEOPTIONS16
+#define GAMEOPTION_ULTIMA3_PICTURE_DUNGEONS GUIO_GAMEOPTIONS17
 #define GAMEOPTION_ULTIMA2_STAT_BOOST    GUIO_GAMEOPTIONS17
 #define GAMEOPTION_ULTIMA2_MIXED_CASE    GUIO_GAMEOPTIONS18
 
diff --git a/engines/ultima/detection_tables.h b/engines/ultima/detection_tables.h
index 2054057ab63..5868eca9c9a 100644
--- a/engines/ultima/detection_tables.h
+++ b/engines/ultima/detection_tables.h
@@ -24,7 +24,7 @@ namespace Ultima {
 #define GUI_OPTIONS_ULTIMA0	GUIO0()
 #define GUI_OPTIONS_ULTIMA1	GUIO0()
 #define GUI_OPTIONS_ULTIMA2	GUIO3(GAMEOPTION_ULTIMA2_STAT_BOOST, GAMEOPTION_ULTIMA2_MIXED_CASE, GAMEOPTION_LESS_HUNGER)
-#define GUI_OPTIONS_ULTIMA3	GUIO5(GAMEOPTION_ULTIMA3_MORE_MONSTERS, GAMEOPTION_LESS_HUNGER, GAMEOPTION_ULTIMA3_MOON_ICONS, GAMEOPTION_ULTIMA3_MIDI_MUSIC, GAMEOPTION_ULTIMA3_TIMED_SOUNDS)
+#define GUI_OPTIONS_ULTIMA3	GUIO6(GAMEOPTION_ULTIMA3_MORE_MONSTERS, GAMEOPTION_LESS_HUNGER, GAMEOPTION_ULTIMA3_MOON_ICONS, GAMEOPTION_ULTIMA3_MIDI_MUSIC, GAMEOPTION_ULTIMA3_TIMED_SOUNDS, GAMEOPTION_ULTIMA3_PICTURE_DUNGEONS)
 #define GUI_OPTIONS_ULTIMA4	GUIO1(GUIO_NOSPEECH)
 #define GUI_OPTIONS_ULTIMA6	GUIO0()
 #define GUI_OPTIONS_ULTIMA8	GUIO9(GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FRAME_SKIPPING, GAMEOPTION_FRAME_LIMITING, GAMEOPTION_CHEATS, GAMEOPTION_HIGH_RESOLUTION, GAMEOPTION_FOOTSTEP_SOUNDS, GAMEOPTION_JUMP_TO_MOUSE, GAMEOPTION_FONT_REPLACEMENT, GAMEOPTION_FONT_ANTIALIASING)
diff --git a/engines/ultima/metaengine.cpp b/engines/ultima/metaengine.cpp
index 2256758ef8a..af816bd5289 100644
--- a/engines/ultima/metaengine.cpp
+++ b/engines/ultima/metaengine.cpp
@@ -251,6 +251,17 @@ static const ADExtraGuiOptionsMap optionsList[] = {
 			0
 		}
 	},
+	{
+		GAMEOPTION_ULTIMA3_PICTURE_DUNGEONS,
+		{
+			_s("Use textured dungeon walls"),
+			_s("Draws the view in dungeons using pictures of stone walls, doors, ladders and chests rather than lines. Only used with VGA graphics"),
+			"picture_dungeons",
+			false,
+			0,
+			0
+		}
+	},
 	{
 		GAMEOPTION_ALWAYS_CHRISTMAS,
 		{
diff --git a/engines/ultima/ultima3/gfx/dungeon_view.cpp b/engines/ultima/ultima3/gfx/dungeon_view.cpp
index b46e83cce19..1613905a468 100644
--- a/engines/ultima/ultima3/gfx/dungeon_view.cpp
+++ b/engines/ultima/ultima3/gfx/dungeon_view.cpp
@@ -19,7 +19,9 @@
  *
  */
 
+#include "common/file.h"
 #include "common/util.h"
+#include "image/png.h"
 #include "ultima/ultima3/gfx/dungeon_view.h"
 #include "ultima/ultima3/ultima3.h"
 
@@ -179,6 +181,59 @@ static bool isEnhanced() {
 	return Data::isEnhancedMode(_G(renderMode));
 }
 
+DungeonView::Picture DungeonView::_faces[FACES];
+DungeonView::Picture DungeonView::_ladders[PLACES];
+DungeonView::Picture DungeonView::_chests[PLACES];
+bool DungeonView::_loaded = false;
+bool DungeonView::_enabled = true;
+
+bool DungeonView::loadPicture(Picture &picture, const Common::String &name) {
+	Common::File f;
+	Image::PNGDecoder decoder;
+	decoder.setKeepTransparencyPaletted(true);
+
+	if (!f.open(Common::Path("dungeons/" + name + ".png")) || !decoder.loadStream(f))
+		return false;
+
+	const Graphics::Surface *surface = decoder.getSurface();
+	if (!surface || surface->format.bytesPerPixel != 1 || surface->w != PICTURE_SIZE ||
+			surface->h != PICTURE_SIZE)
+		return false;
+
+	for (int y = 0; y < PICTURE_SIZE; ++y)
+		memcpy(&picture._pixels[y * PICTURE_SIZE], surface->getBasePtr(0, y), PICTURE_SIZE);
+
+	picture._present = true;
+	return true;
+}
+
+void DungeonView::loadPictures() {
+	_loaded = true;
+
+	for (int i = 0; i < FACES; ++i)
+		loadPicture(_faces[i], Common::String::format("face_%02d", i));
+	for (int i = 0; i < PLACES; ++i) {
+		loadPicture(_ladders[i], Common::String::format("ladder_%02d", i));
+		loadPicture(_chests[i], Common::String::format("chest_%02d", i));
+	}
+}
+
+bool DungeonView::usesPictures() {
+	return _enabled && _G(renderMode) == Data::RENDER_VGA;
+}
+
+void DungeonView::drawPicture(const Picture &picture, bool flip, bool erase) {
+	for (int y = 0; y < PICTURE_SIZE; ++y) {
+		const byte *src = &picture._pixels[(flip ? PICTURE_SIZE - 1 - y : y) * PICTURE_SIZE];
+		byte *dest = &_pixels[(y + OFFSET) * WIDTH + OFFSET];
+
+		for (int x = 0; x < PICTURE_SIZE; ++x) {
+			if (src[x])
+				dest[x] = erase ? 0 : src[x];
+		}
+	}
+}
+
 void DungeonView::plot(int x, int y) {
 	x = (byte)(x + OFFSET);
 	y = (byte)(y + OFFSET);
@@ -236,6 +291,11 @@ void DungeonView::line(int x0, int y0, int x1, int y1) {
 }
 
 void DungeonView::drawWall(int face) {
+	if (_usePictures && _faces[face]._present) {
+		drawPicture(_faces[face], false, face == DOOR_CUTOUT);
+		return;
+	}
+
 	const byte *rec = WALLS[face];
 	int x = rec[0], top = rec[1], bottom = rec[2];
 	const int8 stepX = (int8)rec[3];
@@ -335,12 +395,13 @@ DungeonView::Sight DungeonView::look(const Data::Dungeon &dungeon, int level, in
 	byte tile = dungeon.tile(level, x + dx, y + dy);
 
 	if (!(tile & Data::DTILE_WALL)) {
+		// These are drawn last, since they're in front of any walls drawn after them
 		if (tile & Data::DTILE_LADDER_UP)
-			drawLadder(false, place);
+			_things.push_back({ false, false, place });
 		if (tile & Data::DTILE_LADDER_DOWN)
-			drawLadder(true, place);
+			_things.push_back({ false, true, place });
 		if (tile & Data::DTILE_CHEST)
-			drawChest(place);
+			_things.push_back({ true, false, place });
 		return OPEN;
 	}
 
@@ -361,6 +422,32 @@ void DungeonView::lookAlong(const Data::Dungeon &dungeon, int level, int x, int
 }
 
 void DungeonView::draw(const Data::Dungeon &dungeon, int level, int x, int y, int facing) {
+	if (!_loaded)
+		loadPictures();
+
+	memset(_pixels, 0, sizeof(_pixels));
+	_facing = facing;
+	_usePictures = usesPictures();
+	_things.clear();
+
+	drawPlaces(dungeon, level, x, y);
+
+	for (int i = (int)_things.size() - 1; i >= 0; --i) {
+		const Thing &thing = _things[i];
+		if (thing._place >= PLACES)
+			continue;
+
+		const Picture &picture = thing._chest ? _chests[thing._place] : _ladders[thing._place];
+		if (_usePictures && picture._present)
+			drawPicture(picture, thing._down, false);
+		else if (thing._chest)
+			drawChest(thing._place);
+		else
+			drawLadder(thing._down, thing._place);
+	}
+}
+
+void DungeonView::drawPlaces(const Data::Dungeon &dungeon, int level, int x, int y) {
 	static const byte LEFT_A[] = { 1, 3, 6, 10, 15, 21 };
 	static const byte RIGHT_A[] = { 2, 5, 9, 14, 20, 27 };
 	static const byte LEFT_B[] = { 7, 11, 16, 22 };
@@ -368,9 +455,6 @@ void DungeonView::draw(const Data::Dungeon &dungeon, int level, int x, int y, in
 	static const byte LEFT_C[] = { 17, 23, 28 };
 	static const byte RIGHT_C[] = { 18, 25, 31 };
 
-	memset(_pixels, 0, sizeof(_pixels));
-	_facing = facing;
-
 	// Working outwards from the party's own square, each line of sight is
 	// followed until it meets a wall
 	Sight here = look(dungeon, level, x, y, 0);
diff --git a/engines/ultima/ultima3/gfx/dungeon_view.h b/engines/ultima/ultima3/gfx/dungeon_view.h
index 03ebdd204c0..e53c4bdc330 100644
--- a/engines/ultima/ultima3/gfx/dungeon_view.h
+++ b/engines/ultima/ultima3/gfx/dungeon_view.h
@@ -22,6 +22,7 @@
 #ifndef ULTIMA3_GFX_DUNGEON_VIEW_H
 #define ULTIMA3_GFX_DUNGEON_VIEW_H
 
+#include "common/array.h"
 #include "ultima/ultima3/data/dungeon.h"
 
 namespace Ultima {
@@ -31,7 +32,9 @@ namespace Gfx {
 /**
  * The first person view down the corridors of a dungeon: the walls, doors,
  * ladders and chests in sight drawn as lines, which are all white in the
- * original and have colors in the upgrade's EGA and VGA renderers
+ * original and have colors in the upgrade's EGA and VGA renderers. The VGA
+ * renderer can instead use pictures of them, which are layers of the view
+ * that are drawn over each other
  */
 class DungeonView {
 private:
@@ -41,8 +44,42 @@ private:
 	static const int HEIGHT = 200;
 	static const int OFFSET = 0x20;
 
+	// The pictures are layers the size of the view, and 0 in them is clear
+	static const int PICTURE_SIZE = 0x80;
+	static const int FACES = 64;
+	static const int PLACES = 21;
+
+	struct Picture {
+		bool _present = false;
+		byte _pixels[PICTURE_SIZE * PICTURE_SIZE];
+	};
+
+	// Something that is drawn once all the walls have been, so that it's over them
+	struct Thing {
+		bool _chest;
+		bool _down;
+		int _place;
+	};
+
+	static Picture _faces[FACES];
+	static Picture _ladders[PLACES];
+	static Picture _chests[PLACES];
+	static bool _loaded;
+	static bool _enabled;
+
 	byte _pixels[WIDTH * HEIGHT];
 	int _facing = 0;
+	Common::Array<Thing> _things;
+	bool _usePictures = false;
+
+	static bool loadPicture(Picture &picture, const Common::String &name);
+
+	void drawPicture(const Picture &picture, bool flip, bool erase);
+
+	/**
+	 * Draws everything in view that isn't a ladder or a chest
+	 */
+	void drawPlaces(const Data::Dungeon &dungeon, int level, int x, int y);
 
 	enum Sight {
 		OPEN,
@@ -73,6 +110,23 @@ public:
 		memset(_pixels, 0, sizeof(_pixels));
 	}
 
+	/**
+	 * Reads the pictures that are drawn in place of lines, which any of can be missing
+	 */
+	static void loadPictures();
+
+	/**
+	 * Sets whether the pictures are drawn, if they've been found and it's the VGA renderer
+	 */
+	static void setPicturesEnabled(bool enabled) {
+		_enabled = enabled;
+	}
+
+	/**
+	 * Returns true if the view is made of pictures
+	 */
+	static bool usesPictures();
+
 	/**
 	 * Draws the view from a square in a direction, for later reading back
 	 */
diff --git a/engines/ultima/ultima3/ultima3.cpp b/engines/ultima/ultima3/ultima3.cpp
index ffeee447fca..17e92c70231 100644
--- a/engines/ultima/ultima3/ultima3.cpp
+++ b/engines/ultima/ultima3/ultima3.cpp
@@ -34,6 +34,7 @@
 #include "ultima/ultima3/sound_effects.h"
 #include "ultima/ultima3/data/data.h"
 #include "ultima/ultima3/gfx/charset.h"
+#include "ultima/ultima3/gfx/dungeon_view.h"
 #include "ultima/ultima3/gfx/shapes.h"
 #include "ultima/ultima3/views/views.h"
 
@@ -71,6 +72,7 @@ void Ultima3Engine::loadOptions() {
 	_lessHunger = Shared::configuredOption("less_hunger", enhanced);
 	_moonIcons = Shared::configuredOption("moon_icons", true);
 	_timedSounds = Shared::configuredOption("timed_sounds", enhanced);
+	Gfx::DungeonView::setPicturesEnabled(Shared::configuredOption("picture_dungeons", enhanced));
 	_music.setEnabled(Shared::configuredOption("midi_music", enhanced));
 	_music.syncVolume();
 }
diff --git a/engines/ultima/ultima3/views/dungeon_map.cpp b/engines/ultima/ultima3/views/dungeon_map.cpp
index 4447d28ea19..601f26f679c 100644
--- a/engines/ultima/ultima3/views/dungeon_map.cpp
+++ b/engines/ultima/ultima3/views/dungeon_map.cpp
@@ -88,6 +88,8 @@ void DungeonMap::drawViewport(GfxSurface &s) {
 		// The view is only redrawn once something has changed it, or the party
 		// has been moved by something other than a command
 		uint32 key = (save._dungeonLevel << 24) | (save._posX << 16) | (save._posY << 8) | save._facing;
+		if (Gfx::DungeonView::usesPictures())
+			key |= 0x10000000;
 		if (!_viewValid || key != _viewKey) {
 			_view.draw(_G(dungeon), save._dungeonLevel, save._posX, save._posY, save._facing);
 			_viewValid = true;




More information about the Scummvm-git-logs mailing list