Skip to content

Commit 1dbdcc2

Browse files
committed
Don't treat two different consecutive flashes as repeating
Caused by not comparing the previous frame's flash parameters during the repeating flash check. The issue can be reproduced in maps with parallel flash+wait by using a flashing effect action like the rat form toggle in Collective Unconscious or rainbow/fairy in Yume 2kki. The effect action triggers the repeating flash condition, even though the two flashes have different parameters. Examples of affected maps: - Yume 2kki: MAP0160 (Monochrome Street) - Yume 2kki: MAP0703 (Florist) - Yume 2kki: MAP3594 (Firefly Lake) - Collective Unconscious: MAP1407 (Forest) Regression introduced in a545830.
1 parent b998167 commit 1dbdcc2

File tree

2 files changed

+11
-10
lines changed

2 files changed

+11
-10
lines changed

src/multiplayer/game_multiplayer.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -112,9 +112,10 @@ static bool MovePlayerToPos(Game_PlayerOther& player, int x, int y) {
112112
}
113113

114114
void Game_Multiplayer::ResetRepeatingFlash() {
115+
repeating_flash_active = false;
115116
frame_index = 0;
116117
last_flash_frame_index = -1;
117-
last_frame_flash.reset();
118+
last_flash_frame_flash.fill(0);
118119
repeating_flashes.clear();
119120
}
120121

@@ -593,16 +594,16 @@ void Game_Multiplayer::MainPlayerFlashed(int r, int g, int b, int p, int f) {
593594
std::array<int, 5> flash_array = std::array<int, 5>{ r, g, b, p, f };
594595
if (last_flash_frame_index > -1
595596
&& frame_index - last_flash_frame_index <= 1
596-
&& (last_frame_flash.get() == nullptr || *last_frame_flash == flash_array)) {
597-
if (last_frame_flash.get() == nullptr) {
598-
last_frame_flash = std::make_unique<std::array<int, 5>>(flash_array);
597+
&& last_flash_frame_flash == flash_array) {
598+
if (!repeating_flash_active) {
599+
repeating_flash_active = true;
599600
connection.SendPacketAsync<RepeatingFlashPacket>(r, g, b, p, f);
600601
}
601602
} else {
602603
connection.SendPacketAsync<FlashPacket>(r, g, b, p, f);
603-
last_frame_flash.reset();
604604
}
605605
last_flash_frame_index = frame_index;
606+
last_flash_frame_flash = flash_array;
606607
}
607608

608609
void Game_Multiplayer::MainPlayerChangedTransparency(int transparency) {
@@ -804,12 +805,11 @@ void Game_Multiplayer::UpdateServerVariables() {
804805

805806
void Game_Multiplayer::Update() {
806807
if (session_active) {
807-
if (last_flash_frame_index > -1
808-
&& last_frame_flash.get() != nullptr
809-
&& frame_index > last_flash_frame_index) {
808+
if (repeating_flash_active && frame_index > last_flash_frame_index) {
810809
connection.SendPacketAsync<RemoveRepeatingFlashPacket>();
810+
repeating_flash_active = false;
811811
last_flash_frame_index = -1;
812-
last_frame_flash.reset();
812+
last_flash_frame_flash.fill(0);
813813
}
814814

815815
++frame_index;

src/multiplayer/game_multiplayer.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,8 +108,9 @@ class Game_Multiplayer {
108108
std::vector<std::string> global_sync_picture_prefixes;
109109
std::map<int, bool> sync_picture_cache;
110110
std::vector<int> sync_battle_anim_ids;
111+
bool repeating_flash_active;
111112
int last_flash_frame_index{-1};
112-
std::unique_ptr<std::array<int, 5>> last_frame_flash;
113+
std::array<int, 5> last_flash_frame_flash;
113114
std::map<int, std::array<int, 5>> repeating_flashes;
114115

115116
std::unordered_set<std::string> hrs_set{

0 commit comments

Comments
 (0)