Player Location Data - HoraceAndTheSpider/Bloodwych-68k GitHub Wiki
The following details where the player's position data is stored in memory and as a position offset in savedata files.
SPS 439
BLUE PLAYER (PLAYER 1)
-
Memory X/Y coords : $EE98 (longword)
-
Memory Floor : $EED4 (Word) or $EED5 (low byte; +$3C from X/Y)
-
Savefile Offset X/Y coords : $36E
-
Savefile Offset Floor : $3AA
RED PLAYER (PLAYER 2)
-
Memory X/Y coords : $EEFA (longword)
-
Memory Floor : $EF36 (Word) or $EF37 (low byte; +$3C from X/Y)
-
Savefile Offset X/Y coords : $3D0
-
Savefile Offset Floor : $40C
CURRENT TOWER
- Memory : $EE2F (byte)
- Savefile Offset : $305
1/2 PLAYER MODE
-
Memory : $EE30 (word)
-
Savefile Offset : $306
-
$0000/False = 2 player
-
$FFFF/True = 1 player
Further source details (SPS 439)
Each player remembers their own position and floor. They do not both have to be on the floor named by the map header's “special floor” values.
| Field | Player 1 runtime address | Player 2 runtime address | Player-record offset |
|---|---|---|---|
| X word | $EE98 |
$EEFA |
+$1C |
| Y word | $EE9A |
$EEFC |
+$1E |
| Facing word | $EE9C |
$EEFE |
+$20 |
| Floor word | $EED4 |
$EF36 |
+$58 |
The record bases are original Player1_Data at $EE7C and Player2_Data at $EEDE. X and Y can be loaded together as a longword with X in the high word and Y in the low word. These are runtime addresses; original-executable file offsets are lower by $384.
For saved data beginning with the champion-stat block at original runtime address $EB2A:
| Field | Player 1 save offset | Player 2 save offset |
|---|---|---|
| X/Y longword | $36E |
$3D0 |
| Floor word | $3AA |
$40C |
The current tower is a word at $EE2E; its low byte is $EE2F (save offset $305). The single-player flag is a word at $EE30 (save offset $306): $0000 enables two players; $FFFF selects one player.
Players on different floors
Original adrCd000C50 processes Player 1, then optionally Player 2. Before each player's action scan and dispatch, it calls adrCd0084D6, which reads that player's +$58 floor word and selects width, height and cell-data offset from the shared tower-header cache.
The game reuses its working copy of the floor details, loading whichever player's floor it is about to use. This does not restrict both players to the same floor. Stair and pit transitions update the particular player's floor word.
This behaviour and the addresses above follow the original SPS 439 source, including adrCd000B32, adrCd000C50, adrCd0084D6 and the two player-record definitions. See Map Data Structure for the shared header cache.
BEXT43
BLUE PLAYER (PLAYER 1)
-
Memory X/Y coords : $F9F4 (longword)
-
Memory Floor : $FA30 (Word) or $FA31 (+$3C diff)
-
Savefile Offset X/Y coords : $46E
-
Savefile Offset Floor : $4AA
RED PLAYER (PLAYER 2)
-
Memory X/Y coords : $FA56 (longwords)
-
Memory Floor : $FA92 (Word) or $FA93 (+$3C diff)
-
Savefile Offset X/Y coords : $4D0
-
Savefile Offset Floor : $50C
CURRENT TOWER
- Memory : $F98B (byte)
- Savefile Offset X/Y coords : $405
1/2 PLAYER MODER
-
Memory : $F98C (word)
-
Savefile Offset : $406
-
$0000/False = 2 player
-
$FFFF/True = 1 player