Partially disassembly of the pathfinding code and miscellaneous support methods

svn-id: r21418
This commit is contained in:
Paul Gilbert 2006-03-23 21:26:13 +00:00
parent 140c0d9a3c
commit f596612344
2 changed files with 1395 additions and 1197 deletions
engines/lure/diassembly

File diff suppressed because it is too large Load Diff

@ -81,16 +81,66 @@ character_check_room_change - Checks whether the given character is within the
Input: si = Character hotspot Id
di = Chracter animation slot
character_update_frame - Handles updating a character's current frame
Input: ?
Output: ax = 1 for end of ?? list, 0 = frame successfully changed
character_face_hotspot - Makes a given character face a given hotspot
Input: di = Character animation slot
si = Hotspot record being used
character_face_hotspot_2 - Makes a given character face a given hotspot
Input: ax = Character Id
bx = Hotspot Id of object being used
character_find_impinging_chars - Scans through the animation list for any
characters whose position is impinging that of the given character
Input: di = Character animation slot
character_pathfind - Handles pathfinding a segment of a walking path to a
given destination
Input: ax = character Id
bx = Dest X Pos
cx = Dest Y Pos
dl = Hotspot[4Ch]
Output: added segment to the line path in data Hotspot[HS_MOVEMENT_SRC_OFFSET]
ax = 1 => end of pathfinding reached, 0 => pathfinding still needed
character_reset_direction - Rounds off the given character's position, and sets
their current frame to the default frame for the character's
current direction
Input: si = Character hotspot Id
di = Character animation slot
character_translate_movements - Translates a set of instructions of movement
instructions into a set of offsets to movement records
(containing frame number sequence and position changes) for each
direction, followed by the number of steps to go in that direction
Input: si = Hotspot offset
dx = Offset to a sequence of source movement data to process,
which consist of a repeating set of number of steps followed
by a direction number. It ends with a step count of 0ffffh
Output: Hotspot[HS_MOVEMENT_SRC_OFFSET] => translated movement data
character_update_frame - Handles updating a character's current frame in a
movement sequence each tick.
Output: ax = 1 => for end of the path finding list (ie. at destination),
0 => Some walking still remaining
characters_impinging_check - Checks to see if the given character is close enough
to the player
Input: bx = First character hotspot record
si = Second character hotspot record
Output: ax = 1 -> Characters are close together, 0 -> Characters are not
check_for_impinging_characters - Scans through the animation list for any
animations that are impinging the specified character
Input: si = Character hotspot record
Output: ZF = Set => Character found, Clear => No character found
bx = animation slot of found character
check_keypress - Non-blocking method to return the next pending keypress, if any
Output: zero-flag = if set, indicates no key was pending
al = character
clear_layer_rects - Clears the data structure storing the status of each 32x32
rect in each layer of a room
rect in each layer of a room
confirm_quit - Displays a dialog asking the user whether they want to quit
Output: ZF = If set, indicates the user wants to quit
@ -201,6 +251,10 @@ hotspots_load - Loads any hotspots registered for the current room into the
hotspots_unload - Unloads all hotspots from the animation list that don't have
the special hotspot Id of 0ffffh
increment_action_offset - Moves the current action offset for the given
character to the next record position
Input: si = Character hotspot record
install_palette - Installs a sub-palette of 64 entries from a set of palettes,
each of which is 64*3 bytes long
Input: ax = index of sub-palette in list of sub-palettes
@ -248,6 +302,24 @@ open_file2 - sets the default drive to the specified drive and then calls
the open_file method
Input: al=drive number
pathfind_clear_covered_cells - Clears the cells covered by the base of a given
animation from being occupied in the path finding data block. This
prevents characters from walking through each other
Input: di = Animation slot
pathfind_flag_covered_cells - Flags the cells covered by the base of a given
animation as occupied in the path finding data block. This
prevents characters from walking through each other
Input: di = Animation slot
pathfind_get_cell - Returns the byte and bit index for the given animation's
position in the pathfinding data block for the room
Input: di = Animation slot
Output: bx = Byte offset in path finding data block
ax = Bit mask indicating which bit
cx = Number of bits covering the width of the animation
ZF = If set, animation is not onscreen
pause_for_input - Waits until either a key or a mouse button is pressed
player_inc_inventory_items - Checks if the specified hotspot is the player,
@ -339,12 +411,19 @@ room_check_x_extents - Checks whether a given hotspot's position is within
the clipping x range for the room
Input: si = Hotspot
Output: ax = 0 = Hotspot within valid range, 1 = otherwise
room_exit_hs_get_pointer - Scans through a list of room exit hotspots that
connect to each other.
Input: ax = Hotspot Id
Output: si = Record Id for room exit hotspot join
bx = 2 or 8, representing whether the hotspot was #1 or #2 in the record
room_exit_play_sound - Plays a sound for a room exit opening or closing if the
player is in the same room
Input: si = Room exit join record
bx = Index of active hotspot in join record
cx = 1 for door closing, 0 for door opening
room_handle_click - Checks to see if the mouse has been clicked, and if so,
handles the various things that can be done, such as closing floating
dialogs, showing the right-click menu, etc.
@ -385,13 +464,6 @@ show_disk_cursor - Shows the disk cursor
show_startup - Shows the starting screens of the game, and then calls the
show_introduction method to show the animated introduction sequence
skorl_caught_check - Checks to see if the Skorl is close enough to the player
for it to 'catch' the player
Input: bx = Player hotspot record
si = Skorl hotspot record
di = Skorl animation slot
Output: ax = 1 -> Skorl is close to player, 0 -> Skorl is not
skorl_knockout - Runs the animation sequence of a Skorl knocking out the player
sleep - Sleeps for a given number of clock cycles (each being 1/18th of a second)
@ -403,21 +475,6 @@ sleep_with_kbd_mouse_break - Pause with breakout by keypress and mouse
Output: carry = breakout occurred
zero = if set, indicates Escape was pressed
sub23 - processing the loaded entry. Does not get called during the intro
It seems that dx should always be a loaded entry? As one of the first
things sub_74 does is add 8 to dx segment, representing a start at
dx:80h, which is precisely where entries are loaded
sub28 - Get data block. Seems to handle returning in SI a pointer to a block
of data about a given Id (room #?). [SI+9] can be used to get the Id of
the palette to use by ANDing with $ffe0 and subtracting 1
sub_92 - Change character room and do other stuff
Input: dx = new room number
cx = new x
bx = new y
sub_107 - Gets a ax (0 or 3) and bx pointer used later in a call to sub_132
to get a sequence offset
Input: ax = Hotspot Id
@ -692,27 +749,38 @@ The format of hotspots are as follows:
static image)
23h 1 Colour offset start for source pixel data
24h 2 Offset for data in scripts2_seg, used in
hotspot_script_execute. Also seems to be used by the
player hotspot (and perhaps others?) as a table offset
containing data for character movement
26h 2 ???
28h 2 ???
2Ah 1 Current frame number ?
hotspot_script_execute. Also seems to be used by
characters (including the player) as a table offset
containing data for movement sequence
26h 2 Step counter - used as in incrementor when a character
is moving in a direction to determine when they have
reached the requisite number of steps required before
moving to the next direction in a path-finding sequence
28h 2 Frame offset - used as a pointer within the movement
frames for a given direction to quickly retrieve the
position change and frame number in a walking sequence -
used along with offset 26h to handling walking
2Ah 1 Current frame number
2Bh 2 ???
2Dh 2 Script Id of a hotspot the character is to use
2Fh 2 Hotspot Id of a hotspot the character is to use
33h 2 ??? Talk data record
35h 1 Some kind of x offset (perhaps for centroid?)
36h 1 Some kind of y offset
37h 2 ???
39h 2 Stores the hotspot Id of the character being talked to
3Ch 2 Stores the String Id of a response
3Ch 2 Stores the String Id of a response
42h 2 ??? Copy of selected hotspot
44h 1 ??? 0 or 2 for further actions in player_tick_proc
??? Copy of low byte of selected hotspot
45h 2 Hotspot Script Id to use. I'm not yet sure why a
different field that 2Dh/2Fh to use
47h 2 Hotspot Id to use.
50h 2 Character direction: 80h=up, 40h=down, 20h=left, 10h=right
52h 2 Hotspot Id for selected hotspot
54h 2 X ending position for character + 80h - 10h
56h 2 Y ending position for character + 80h
5Ah 2 For player (and other characters?) indicates the
5Ah 2 For player and other characters indicates the
assigned offset in the data segment to load the
details of movement frames. Note that this gets copied
to offset 24h for use at runtime.
@ -722,7 +790,23 @@ The format of hotspots are as follows:
consists of three bytes: a single byte command Id, and
an offset to a support data record.
The player actions can be one of the following:
Movement sequence
=================
When a character has to move, sub_90 is
Character actions
=================
Character hotspots have a buffer for a set of current actions. Each record
of this list consists of 5 bytes, with the following format:
Offset Size Meaning
------ ---- -------
0 1 Currenat atcion
1 2 Pointer to support data structure
3 2 ?? May be room number action occurs in
The possible commands are listed below:
Command
-------
@ -732,16 +816,25 @@ The player actions can be one of the following:
02 = Dispatch action*
Support data:
word value = 10h
word value = action to perform
word value = hotspot Id of selected hotspot
[03] = Room Number
03 = Execute Script
04 = Processing walking path
05 = Walking in progress
* Note that actions (both looking at a hotspot and all other actions) are
handled by doing an initial dispatch of the action, then a standard walk sequence,
and finally dispatching the action again when the player is at the appropriate
proximity to the hotspot
Actions Table
=============
The actions table offset points to a list that indicates any actions for the
hotspot that have script sequences attached to them. The table has the following
format:
@ -754,6 +847,8 @@ format:
3 2 Sequence offset
---------
Animation Resources
===================
The raw data for animations is stored in disk resources. They have the following
format:
@ -821,7 +916,8 @@ aren't necessarily animated.
1Eh 2 So far it's only known use is to store the hotspot Id
of the character the special 'voice' animation is
associated with
22h 2 ???
22h 2 Related to direction handling: 0 for up/down,
4 for left/right
24h 2 So far it's only known use is as a countdown timer
for closing the special "voice" animation shown on
top of characters when they're speaking
@ -918,15 +1014,17 @@ the same record. Each record is 17 bytes long, and the format is as follows:
0h 2 First hotspot Id of the pair
2h 1 Current frame number for hotspot #1
3h 1 Ending frame number for hotspot #1
4h 2 ???
4h 1 Sound for hotspot #1 opening
5h 1 Sound for hotspot #1 closing
6h 2 Second hotspot Id of the pair
8h 1 Current frame number for hotspot #2
9h 1 Ending frame number for hotspot #1
Ah 2 ???
Ah 1 Sound for hotspot #1 opening
Bh 1 Sound for hotspot #2 closing
Ch 1 If zero, then exit is currently active. Non-zero
indicates that the exit is blocked
Dh 2 ???
Fh 2 ???
Dh 2 Pointer to first hotspot's record
Fh 2 Pointer to second hotspot's record
Sequence Table