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

@@ -138,6 +138,10 @@ MapSetupScript_Train:
db -1 ; end
MapSetupScript_NextPlayer:
; remove FadeMapMusicAndPalettes, InitSound, PlayMapMusicBike to not apply fading to music (and palettes).
; would require consistent music across all maps/states of the level.
mapsetup FadeMapMusicAndPalettes
mapsetup ClearBGPalettes
mapsetup DisableLCD
mapsetup InitSound
mapsetup BackupMapObjects
@@ -159,7 +163,6 @@ MapSetupScript_NextPlayer:
mapsetup SpawnInFacingDown
mapsetup RefreshMapSprites
mapsetup PlayMapMusicBike
mapsetup FadeInToMusic
mapsetup FadeInFromWhite
mapsetup ActivateMapAnims
mapsetup LoadWildMonData

View File

@@ -51,7 +51,7 @@ PlayerObjects:
.BugCatcher1:
object_event 0, 0, SPRITE_BUG_CATCHER, SPRITEMOVEDATA_STANDING_DOWN, 0, 0, -1, -1, PAL_NPC_BROWN, OBJECTTYPE_SCRIPT, 0, ObjectEvent, -1
; [wPlayerState], sprite id, palette
db PLAYER_NORMAL, SPRITE_YOUNGSTER, PAL_NPC_BROWN << 4 | OBJECTTYPE_SCRIPT
db PLAYER_SURF, SPRITE_YOUNGSTER, PAL_NPC_BROWN << 4 | OBJECTTYPE_SCRIPT
db PLAYER_BIKE, SPRITE_YOUNGSTER, PAL_NPC_BROWN << 4 | OBJECTTYPE_SCRIPT
db PLAYER_NORMAL, SPRITE_BUG_CATCHER, PAL_NPC_BROWN << 4 | OBJECTTYPE_SCRIPT
db PLAYER_SURF, SPRITE_BUG_CATCHER, PAL_NPC_BROWN << 4 | OBJECTTYPE_SCRIPT
db PLAYER_BIKE, SPRITE_BUG_CATCHER, PAL_NPC_BROWN << 4 | OBJECTTYPE_SCRIPT
db -1

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

View File

@@ -1273,6 +1273,8 @@ Script_reloadmaptonextplayer:
ldh [hMapEntryMethod], a
ld a, SPAWN_FROM_RAM
ld [wDefaultSpawnpoint], a
ld a, BOARDEVENT_DISPLAY_MENU
ldh [hCurBoardEvent], a
ld a, MAPSTATUS_ENTER
call LoadMapStatus
call StopScript