if (j == CENTERPRINT_MAX_MSGS)
j = 0;
if (new_id && new_id == centerprint_msgID[j])
- {
- if(centerprint_messages[j])
- strunzone(centerprint_messages[j]);
- centerprint_messages[j] = strzone(strMessage);
-
- centerprint_time[j] = duration;
- centerprint_expire_time[j] = time + duration;
- centerprint_countdown_num[j] = countdown_num;
- return;
- }
+ break; // found a msg with the same id, at position j
}
- --cpm_index;
- if (cpm_index == -1)
- cpm_index = CENTERPRINT_MAX_MSGS - 1;
- if(centerprint_messages[cpm_index])
- strunzone(centerprint_messages[cpm_index]);
- centerprint_messages[cpm_index] = strzone(strMessage);
- centerprint_msgID[cpm_index] = new_id;
- centerprint_time[cpm_index] = duration;
- centerprint_expire_time[cpm_index] = time + duration;
- centerprint_countdown_num[cpm_index] = countdown_num;
+ if (i == CENTERPRINT_MAX_MSGS)
+ {
+ // a msg with the same id was not found, add the msg at the next position
+ --cpm_index;
+ if (cpm_index == -1)
+ cpm_index = CENTERPRINT_MAX_MSGS - 1;
+ j = cpm_index;
+ }
+ if(centerprint_messages[j])
+ strunzone(centerprint_messages[j]);
+ centerprint_messages[j] = strzone(strMessage);
+ centerprint_msgID[j] = new_id;
+ if (duration < 0)
+ centerprint_time[j] = -1;
+ else
+ {
+ centerprint_time[j] = duration;
+ centerprint_expire_time[j] = time + duration;
+ }
+ centerprint_countdown_num[j] = countdown_num;
}
void centerprint(string strMessage)
{
if (j == CENTERPRINT_MAX_MSGS)
j = 0;
- if (centerprint_expire_time[j] < time)
+ if (centerprint_time[j] > 0 && centerprint_expire_time[j] < time)
{
if (centerprint_countdown_num[j])
{
else
continue;
}
- if (centerprint_expire_time[j] - fade > time)
+ if (centerprint_time[j] < 0 || centerprint_expire_time[j] - fade > time)
{
a = 1 * alpha_factor;
sz = 1;
if (autocvar_g_campaign) {
if (self.classname == "player" && self.BUTTON_INFO) {
self.motd_actived_time = time;
- Send_CSQC_Centerprint_Generic(self, CPID_MOTD, campaign_message, 999, 0);
+ Send_CSQC_Centerprint_Generic(self, CPID_MOTD, campaign_message, -1, 0);
}
} else {
if ((self.classname == "player" || time - self.jointime > autocvar_welcome_message_time) && self.BUTTON_INFO) {
self.motd_actived_time = time;
- Send_CSQC_Centerprint_Generic(self, CPID_MOTD, getwelcomemessage(), 999, 0);
+ Send_CSQC_Centerprint_Generic(self, CPID_MOTD, getwelcomemessage(), -1, 0);
}
}
} else { // showing MOTD or campaign message
if(teams_missing == "")
kh_Controller_SetThink(autocvar_g_balance_keyhunt_delay_round, "Round starts in ", 1, kh_StartRound);
else
- kh_Controller_SetThink(1, strcat("Waiting for players to join...\n\nNeed active players for: ", teams_missing), 999, kh_WaitForPlayers);
+ kh_Controller_SetThink(1, strcat("Waiting for players to join...\n\nNeed active players for: ", teams_missing), -1, kh_WaitForPlayers);
}
void kh_EnableTrackingDevice() // runs after each round
teams_missing = kh_CheckEnoughPlayers();
if(teams_missing != "")
{
- kh_Controller_SetThink(1, strcat("Waiting for players to join...\n\nNeed active players for: ", teams_missing), 999, kh_WaitForPlayers);
+ kh_Controller_SetThink(1, strcat("Waiting for players to join...\n\nNeed active players for: ", teams_missing), -1, kh_WaitForPlayers);
return;
}
}
kh_tracking_enabled = FALSE;
- kh_Controller_SetThink(autocvar_g_balance_keyhunt_delay_tracking, "Scanning frequency range...", 999, kh_EnableTrackingDevice);
+ kh_Controller_SetThink(autocvar_g_balance_keyhunt_delay_tracking, "Scanning frequency range...", -1, kh_EnableTrackingDevice);
}
float kh_HandleFrags(entity attacker, entity targ, float f) // adds to the player score