Skip to content
This repository has been archived by the owner on Nov 15, 2021. It is now read-only.

Commit

Permalink
Make instant and post-round map changes less abrupt.
Browse files Browse the repository at this point in the history
  • Loading branch information
voided committed Jul 1, 2014
1 parent d04b9a4 commit 719a464
Showing 1 changed file with 19 additions and 3 deletions.
22 changes: 19 additions & 3 deletions plugins/mapchooser.sp
Expand Up @@ -397,7 +397,7 @@ public Event_TeamPlayWinPanel(Handle:event, const String:name[], bool:dontBroadc
if (g_ChangeMapAtRoundEnd)
{
g_ChangeMapAtRoundEnd = false;
CreateTimer(2.0, Timer_ChangeMap, INVALID_HANDLE, TIMER_FLAG_NO_MAPCHANGE);
CreateTimer(GetMapChangeTime(), Timer_ChangeMap, INVALID_HANDLE, TIMER_FLAG_NO_MAPCHANGE);
g_ChangeMapInProgress = true;
}

Expand Down Expand Up @@ -439,7 +439,7 @@ public Event_RoundEnd(Handle:event, const String:name[], bool:dontBroadcast)
if (g_ChangeMapAtRoundEnd)
{
g_ChangeMapAtRoundEnd = false;
CreateTimer(2.0, Timer_ChangeMap, INVALID_HANDLE, TIMER_FLAG_NO_MAPCHANGE);
CreateTimer(GetMapChangeTime(), Timer_ChangeMap, INVALID_HANDLE, TIMER_FLAG_NO_MAPCHANGE);
g_ChangeMapInProgress = true;
}

Expand Down Expand Up @@ -792,7 +792,7 @@ public Handler_VoteFinishedGeneric(Handle:menu,
else if (g_ChangeTime == MapChange_Instant)
{
new Handle:data;
CreateDataTimer(2.0, Timer_ChangeMap, data);
CreateDataTimer(GetMapChangeTime(), Timer_ChangeMap, data);
WritePackString(data, map);
g_ChangeMapInProgress = false;
}
Expand Down Expand Up @@ -1016,6 +1016,22 @@ bool:RemoveStringFromArray(Handle:array, String:str[])
return false;
}

Float:GetMapChangeTime()
{
new Float:changeTime = 2.0;

if (g_Cvar_Bonusroundtime != INVALID_HANDLE)
{
// this mod supports specifying time between rounds, so we can use it to change the map at the end of the in-between time
changeTime = GetConVarFloat(g_Cvar_Bonusroundtime) - 1.0;

if (changeTime < 0.0)
changeTime = 2.0;
}

return changeTime;
}

CreateNextVote()
{
assert(g_NextMapList)
Expand Down

0 comments on commit 719a464

Please sign in to comment.