reworking for a third or fourth time the special map case to work for mako race mode. special zones got special names. when not special stage on special map do normal zones work. when special stage on special map are the normal zones disabled

This commit is contained in:
jenz
2026-10-18 22:32:39 +02:00
parent 847181ff18
commit 9ed37c2bcf
3 changed files with 46 additions and 29 deletions
@@ -1,15 +1,11 @@
#if defined _unloze_racetimer_specialmaps_included_
#endinput
#endif
#define _unloze_racetimer_specialmaps_included_
/**
* Called on Every Round start to identify if special roundzones exist
* @char resultStart returns name of special startzone
* @char resultEnd returns name of special endzone
*/
forward void CheckIfSpecialRoundZones(char[] resultstart, char[] resultend);
/**
* @returns true if mako currently
*/
native bool unloze_gBSpecialMapDisplay();
#if defined _unloze_racetimer_specialmaps_included_
#endinput
#endif
#define _unloze_racetimer_specialmaps_included_
/**
* Called on Every Round start to identify if special roundzones exist
* @char resultStart returns name of special startzone
* @char resultEnd returns name of special endzone
*/
forward void CheckIfSpecialRoundZones(char[] resultstart, char[] resultend);
@@ -9,7 +9,8 @@
#include <unloze_zones>
#pragma newdecls required
static Handle g_hSpecialRoundCheck;
char g_cMapname[g_dIndex];
bool g_bCurrentMapSpecialMako;
public Plugin myinfo =
{
name = "unloze racetimer specialmaps",
@@ -24,17 +25,16 @@ public Plugin myinfo =
public APLRes AskPluginLoad2(Handle myself, bool late, char [] error, int err_max)
{
g_hSpecialRoundCheck = CreateGlobalForward("CheckIfSpecialRoundZones", ET_Ignore, Param_String, Param_String);
CreateNative("unloze_gBSpecialMapDisplay", Native_Isspecialmap);
return APLRes_Success;
}
//----------------------------------------------------------------------------------------------------
// Purpose:
//----------------------------------------------------------------------------------------------------
public int Native_Isspecialmap(Handle handler, int numParams)
public void OnMapStart()
{
GetCurrentMap(g_cMapname, sizeof(g_cMapname));
return view_as<bool>(StrEqual(g_cMapname, "ze_FFVII_Mako_Reactor_v5_3", false));
char Mapname[256];
GetCurrentMap(Mapname, sizeof(Mapname));
g_bCurrentMapSpecialMako = view_as<bool>(StrEqual(Mapname, "ze_FFVII_Mako_Reactor_v5_3", false));
}
//----------------------------------------------------------------------------------------------------
// Purpose: http://git.unloze.com/UNLOZE/sm-plugins/src/master/MakoVote/scripting/MakoVote.sp
//----------------------------------------------------------------------------------------------------
@@ -100,8 +100,7 @@ public void OnPluginStart()
//----------------------------------------------------------------------------------------------------
public Action Timer_CheckStage(Handle timer, any userid)
{
GetCurrentMap(g_cMapname, sizeof(g_cMapname));
if (StrEqual(g_cMapname, "ze_FFVII_Mako_Reactor_v5_3", false))
if (g_bCurrentMapSpecialMako)
{
// == 11 means its racemode on mako
if (GetCurrentStage() == 11)
@@ -112,6 +111,7 @@ public Action Timer_CheckStage(Handle timer, any userid)
//ZONE_PREFIX_MAKO_START_1
//ZONE_PREFIX_MAKO_RACE_2
Call_StartForward(g_hSpecialRoundCheck);
while (i < l_iZoneCount)
{
ZoneNameBasedOnIndex(i, l_cIndexName[i]);
@@ -124,6 +124,7 @@ public Action Timer_CheckStage(Handle timer, any userid)
Call_Finish();
}
}
return Plugin_Handled;
}
//----------------------------------------------------------------------------------------------------
// Purpose:
@@ -277,6 +277,7 @@ public void OnMapStart()
GetCurrentMap(g_cMapname, sizeof(g_cMapname));
Format(g_cSpecialMapStart, sizeof(g_cSpecialMapStart), "");
Format(g_cSpecialMapEnd, sizeof(g_cSpecialMapEnd), "");
g_hCurrentMapClientRecords.Clear();
g_hCurrentMapAllTopRecords.Clear();
@@ -693,9 +694,20 @@ public void unloze_zoneEntry(int client, char[] zone)
return;
}
int zoneIndex = RetrieveZoneIndex(zone);
int race_zone_count = GetTotalRaceZones();
if (!(StrEqual(zone, g_cSpecialMapEnd)) && !race_zone_count)
//no race zones. Its also not a special round on a map (mako race mode) where the only zones have unusual names (like MAKO_RACE)
if (!GetTotalRaceZones() && strlen(g_cSpecialMapStart) == 0)
{
return;
}
if (!StrEqual(zone, g_cSpecialMapEnd) && !GetTotalRaceZones())
return;
//it is a race mode on a special map, so disable the normal racezones.
if (strlen(g_cSpecialMapStart) != 0 && !StrEqual(zone, g_cSpecialMapEnd))
{
return;
}
int l_iZoneCount = unloze_zoneCount();
@@ -728,14 +740,22 @@ public void unloze_zoneLeave(int client, char[] zone)
{
return;
}
int race_zone_count = GetTotalRaceZones();
if (!(StrEqual(zone, g_cSpecialMapStart)) && !race_zone_count)
//no race zones. Its also not a special round on a map (mako race mode) where the only zones have unusual names (like MAKO_RACE)
if (!GetTotalRaceZones() && strlen(g_cSpecialMapStart) == 0)
{
return;
}
//it is right now a special map that is doing a special round so we disable the normal race timers from running
if (strlen(g_cSpecialMapStart) != 0 && !StrEqual(zone, g_cSpecialMapStart))
{
return;
}
if (GetClientTeam(client) == CS_TEAM_CT)
{
//a normal zone or the special map condition for race zone on one stage of a map
if ((StrContains(zone, "ZONE_PREFIX_START") > -1) || StrEqual(zone, g_cSpecialMapStart))
{
if (!PM_IsPlayerSteam(client))