Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions src/multiplayer/game_multiplayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,9 @@ void Game_Multiplayer::InitConnection() {
Connect(room_id); // wrong room, reconnect
return;
}
// Game_Multiplayer::Connect runs before the pictures from
// the previous map are erased so we can't call it there
SendShownPictures();
// set this to true to enable players entering
switching_room = false;
Web_API::OnRoomSwitch();
Expand Down Expand Up @@ -705,6 +708,24 @@ void Game_Multiplayer::PictureErased(int pic_id) {
}
}

void Game_Multiplayer::SendShownPictures() {
auto scene_map = Scene::Find(Scene::SceneType::Map);
if (!scene_map || !scene_map->IsInitialized()) return;

for (auto& sp : sync_picture_cache) {
int id = sp.first;
auto* pic = Main_Data::game_pictures->GetPicturePtr(id);
if (pic == nullptr || !pic->Exists()) continue;
auto params = pic->GetShowParams();
if (!IsPictureSynced(id, params.name)) continue;

auto& p = Main_Data::game_player;
connection.SendPacketAsync<ShowPicturePacket>(id, params,
Game_Map::GetPositionX(), Game_Map::GetPositionY(),
p->GetPanX(), p->GetPanY());
}
}

bool Game_Multiplayer::IsBattleAnimSynced(int anim_id) {
bool anim_synced = false;

Expand Down
1 change: 1 addition & 0 deletions src/multiplayer/game_multiplayer.h
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ class Game_Multiplayer {
void SpawnOtherPlayer(int id);
void ResetRepeatingFlash();
void InitConnection();
void SendShownPictures();
};

inline Game_Multiplayer& GMI() { return Game_Multiplayer::Instance(); }
Expand Down
Loading