Process client events with the correct order

Effects that are using commanddelay were not working at all, this fixes the processing of delayed events so they get processed sequentially and at the correct time
This commit is contained in:
smallmodel 2024-10-19 22:38:46 +02:00 committed by GitHub
parent fd426926e9
commit 00421a7666
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1403,8 +1403,10 @@ qboolean ClientGameCommandManager::PostEventForEntity(Event *ev, float fWait)
int inttime;
if (m_fEventWait < 0 || current_entity_number < 0) {
if (!str::icmp(ev->getName(), ")")) {
m_fEventWait = 0.0;
if (m_fEventWait != 0.0) {
if (!str::icmp(ev->getName(), ")")) {
m_fEventWait = 0.0;
}
}
delete ev;
@ -1421,7 +1423,7 @@ qboolean ClientGameCommandManager::PostEventForEntity(Event *ev, float fWait)
event = EffectsEventQueue.next;
inttime = EVENT_msec + (fWait * 1000.0f + 0.5f);
while (event != &EffectsEventQueue && inttime > event->inttime) {
while (event != &EffectsEventQueue && inttime >= event->inttime) {
event = event->next;
}
@ -1560,7 +1562,6 @@ void ClientGameCommandManager::CommandDelay(Event *ev)
ev1->AddValue(ev->GetValue(i));
}
delay = ev->GetFloat(1) * 1000;
if (current_entity_number != -1) {
PostEventForEntity(ev1, fWait);
} else {
@ -1570,6 +1571,16 @@ void ClientGameCommandManager::CommandDelay(Event *ev)
current_tiki->name
);
}
if (IsBlockCommand(eventName)) {
m_fEventWait = fWait;
} else {
m_fEventWait = 0;
}
if (current_entity_number == -1 && m_fEventWait > 0) {
m_fEventWait = -1;
}
}
void ClientGameCommandManager::StartSFX(Event *ev)