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
@@ -9,7 +9,3 @@
* @char resultEnd returns name of special endzone * @char resultEnd returns name of special endzone
*/ */
forward void CheckIfSpecialRoundZones(char[] resultstart, char[] resultend); forward void CheckIfSpecialRoundZones(char[] resultstart, char[] resultend);
/**
* @returns true if mako currently
*/
native bool unloze_gBSpecialMapDisplay();
@@ -9,7 +9,8 @@
#include <unloze_zones> #include <unloze_zones>
#pragma newdecls required #pragma newdecls required
static Handle g_hSpecialRoundCheck; static Handle g_hSpecialRoundCheck;
char g_cMapname[g_dIndex]; bool g_bCurrentMapSpecialMako;
public Plugin myinfo = public Plugin myinfo =
{ {
name = "unloze racetimer specialmaps", name = "unloze racetimer specialmaps",
@@ -24,17 +25,16 @@ public Plugin myinfo =
public APLRes AskPluginLoad2(Handle myself, bool late, char [] error, int err_max) public APLRes AskPluginLoad2(Handle myself, bool late, char [] error, int err_max)
{ {
g_hSpecialRoundCheck = CreateGlobalForward("CheckIfSpecialRoundZones", ET_Ignore, Param_String, Param_String); g_hSpecialRoundCheck = CreateGlobalForward("CheckIfSpecialRoundZones", ET_Ignore, Param_String, Param_String);
CreateNative("unloze_gBSpecialMapDisplay", Native_Isspecialmap);
return APLRes_Success; return APLRes_Success;
} }
//----------------------------------------------------------------------------------------------------
// Purpose: public void OnMapStart()
//----------------------------------------------------------------------------------------------------
public int Native_Isspecialmap(Handle handler, int numParams)
{ {
GetCurrentMap(g_cMapname, sizeof(g_cMapname)); char Mapname[256];
return view_as<bool>(StrEqual(g_cMapname, "ze_FFVII_Mako_Reactor_v5_3", false)); 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 // 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) public Action Timer_CheckStage(Handle timer, any userid)
{ {
GetCurrentMap(g_cMapname, sizeof(g_cMapname)); if (g_bCurrentMapSpecialMako)
if (StrEqual(g_cMapname, "ze_FFVII_Mako_Reactor_v5_3", false))
{ {
// == 11 means its racemode on mako // == 11 means its racemode on mako
if (GetCurrentStage() == 11) if (GetCurrentStage() == 11)
@@ -112,6 +111,7 @@ public Action Timer_CheckStage(Handle timer, any userid)
//ZONE_PREFIX_MAKO_START_1 //ZONE_PREFIX_MAKO_START_1
//ZONE_PREFIX_MAKO_RACE_2 //ZONE_PREFIX_MAKO_RACE_2
Call_StartForward(g_hSpecialRoundCheck); Call_StartForward(g_hSpecialRoundCheck);
while (i < l_iZoneCount) while (i < l_iZoneCount)
{ {
ZoneNameBasedOnIndex(i, l_cIndexName[i]); ZoneNameBasedOnIndex(i, l_cIndexName[i]);
@@ -124,6 +124,7 @@ public Action Timer_CheckStage(Handle timer, any userid)
Call_Finish(); Call_Finish();
} }
} }
return Plugin_Handled;
} }
//---------------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------------
// Purpose: // Purpose:
@@ -277,6 +277,7 @@ public void OnMapStart()
GetCurrentMap(g_cMapname, sizeof(g_cMapname)); GetCurrentMap(g_cMapname, sizeof(g_cMapname));
Format(g_cSpecialMapStart, sizeof(g_cSpecialMapStart), ""); Format(g_cSpecialMapStart, sizeof(g_cSpecialMapStart), "");
Format(g_cSpecialMapEnd, sizeof(g_cSpecialMapEnd), ""); Format(g_cSpecialMapEnd, sizeof(g_cSpecialMapEnd), "");
g_hCurrentMapClientRecords.Clear(); g_hCurrentMapClientRecords.Clear();
g_hCurrentMapAllTopRecords.Clear(); g_hCurrentMapAllTopRecords.Clear();
@@ -693,9 +694,20 @@ public void unloze_zoneEntry(int client, char[] zone)
return; return;
} }
int zoneIndex = RetrieveZoneIndex(zone); 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; 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(); int l_iZoneCount = unloze_zoneCount();
@@ -728,14 +740,22 @@ public void unloze_zoneLeave(int client, char[] zone)
{ {
return; 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; return;
} }
if (GetClientTeam(client) == CS_TEAM_CT) 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 ((StrContains(zone, "ZONE_PREFIX_START") > -1) || StrEqual(zone, g_cSpecialMapStart))
{ {
if (!PM_IsPlayerSteam(client)) if (!PM_IsPlayerSteam(client))