Multiplayer engine: bug fixes [Commit 9] (#40)

This commit is contained in:
xCrystal
2024-03-05 14:03:31 +01:00
parent 3c5308e9de
commit b97470e032
4 changed files with 25 additions and 9 deletions

View File

@@ -852,7 +852,6 @@ RepositionMockedPlayerObjects_NextPlayer:
; once the new map blocks have been loaded to wOverworldMapBlocks.
; position all players according to wNumLevelPlayers, except for the player at wCurTurnPlayer (which isn't being mocked).
ld a, [wNumLevelPlayers]
maskbits MAX_PLAYERS
cp 1
ret z ; return if single player mode
.loop
@@ -880,7 +879,6 @@ RepositionMockedPlayerObjects_Connection::
cp BOARDEVENT_VIEW_MAP_MODE
jr nz, RepositionMockedPlayerObjects_NextPlayer
ld a, [wNumLevelPlayers]
maskbits MAX_PLAYERS
.loop
dec a
cp -1
@@ -906,7 +904,7 @@ RepositionMockedPlayerObject:
jr nz, .next_map_1
ld a, [wMapNumber]
cp c
jp z, MockPlayerObject_ViewMapMode ; is current map
jp z, .is_current_map ; is current map
.next_map_1
ld a, [wNorthConnectedMapGroup]
cp b
@@ -942,7 +940,7 @@ RepositionMockedPlayerObject:
.is_connected_map
ld [wTempByteValue], a
ld hl, .got_sprite_coords
ld hl, .connected_sprite_coords_obtained
push hl
ld a, [wMockingWhichPlayer]
ld hl, wPlayer1YCoord
@@ -960,7 +958,20 @@ RepositionMockedPlayerObject:
dw GetWestConnectedSpriteCoords
dw GetEastConnectedSpriteCoords
.got_sprite_coords
.is_current_map
ld a, [wMockingWhichPlayer]
ld hl, wPlayer1MockYCoord
ld bc, wPlayer2MockYCoord - wPlayer1MockYCoord
call AddNTimes
push hl
ld a, [wMockingWhichPlayer]
ld hl, wPlayer1YCoord
ld bc, wPlayer2YCoord - wPlayer1YCoord
call AddNTimes
pop de
jr MockPlayerObject
.connected_sprite_coords_obtained
ret nc ; return if sprite is not in visible part of connected map
; hl is y,x coordinates: load them into wPlayer*MockYCoord and wPlayer*MockXCoord
push hl