mirror of
https://github.com/shavitush/bhoptimer.git
synced 2025-12-07 10:28:26 +00:00
czones: use same settings for all bonuses & let more types be editable
This commit is contained in:
parent
2616712c9e
commit
ab73e36a15
@ -433,17 +433,17 @@ stock bool GuessBestMapName(ArrayList maps, const char input[PLATFORM_MAX_PATH],
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
stock void GetTrackName(int client, int track, char[] output, int size)
|
stock void GetTrackName(int client, int track, char[] output, int size, bool include_bonus_num=true)
|
||||||
{
|
{
|
||||||
if (track == Track_Main)
|
if (track == Track_Main)
|
||||||
{
|
{
|
||||||
FormatEx(output, size, "%T", "Track_Main", client);
|
FormatEx(output, size, "%T", "Track_Main", client);
|
||||||
}
|
}
|
||||||
else if (track >= Track_Bonus)
|
else if (Track_Bonus <= track < TRACKS_SIZE)
|
||||||
{
|
{
|
||||||
FormatEx(output, size, "%T", "Track_Bonus", client, track);
|
FormatEx(output, size, "%T", include_bonus_num ? "Track_Bonus" : "Track_Bonus_NoNum", client, track);
|
||||||
}
|
}
|
||||||
else //if (track < Track_Main)
|
else
|
||||||
{
|
{
|
||||||
FormatEx(output, size, "%T", "Track_Unknown", client);
|
FormatEx(output, size, "%T", "Track_Unknown", client);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -182,6 +182,7 @@ float gF_StartAng[MAXPLAYERS+1][TRACKS_SIZE][3];
|
|||||||
bool gB_Eventqueuefix = false;
|
bool gB_Eventqueuefix = false;
|
||||||
bool gB_ReplayRecorder = false;
|
bool gB_ReplayRecorder = false;
|
||||||
|
|
||||||
|
#define CZONE_VER 'b'
|
||||||
// custom zone stuff
|
// custom zone stuff
|
||||||
Cookie gH_CustomZoneCookie = null;
|
Cookie gH_CustomZoneCookie = null;
|
||||||
int gI_ZoneDisplayType[MAXPLAYERS+1][ZONETYPES_SIZE][TRACKS_SIZE];
|
int gI_ZoneDisplayType[MAXPLAYERS+1][ZONETYPES_SIZE][TRACKS_SIZE];
|
||||||
@ -1608,17 +1609,29 @@ public void OnClientCookiesCached(int client)
|
|||||||
gH_DrawAllZonesCookie.Get(client, setting, sizeof(setting));
|
gH_DrawAllZonesCookie.Get(client, setting, sizeof(setting));
|
||||||
gB_DrawAllZones[client] = view_as<bool>(StringToInt(setting));
|
gB_DrawAllZones[client] = view_as<bool>(StringToInt(setting));
|
||||||
|
|
||||||
char czone[1 + 2*2*TRACKS_SIZE + 1]; // version + ((start + end) * 2 chars * tracks) + NUL terminator
|
char czone[100]; // #define MAX_VALUE_LENGTH 100
|
||||||
gH_CustomZoneCookie.Get(client, czone, sizeof(czone));
|
gH_CustomZoneCookie.Get(client, czone, sizeof(czone));
|
||||||
|
|
||||||
if (czone[0] == 'a') // "version number"
|
char ver = czone[0];
|
||||||
|
|
||||||
|
if (ver == 'a' || ver == 'b') // "version number"
|
||||||
{
|
{
|
||||||
|
// a = [1 + 2*2*TRACKS_SIZE + 1]; // version + ((start + end) * 2 chars * tracks) + NUL terminator
|
||||||
|
// b = [1 + ZONETYPES_SIZE*2*2 + 1] // version + (ZONETYPES_SIZE * 2 chars * (main+bonus)) + NUL terminator
|
||||||
|
|
||||||
int p = 1;
|
int p = 1;
|
||||||
char c;
|
char c;
|
||||||
|
|
||||||
while ((c = czone[p++]) != 0)
|
while ((c = czone[p++]) != 0)
|
||||||
{
|
{
|
||||||
int track = c & 0xf;
|
int track = c & 0xf;
|
||||||
|
#if CZONE_VER == 'b'
|
||||||
|
if (track > Track_Bonus)
|
||||||
|
{
|
||||||
|
++p;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
int type = (c >> 4) & 1;
|
int type = (c >> 4) & 1;
|
||||||
gI_ZoneDisplayType[client][type][track] = (c >> 5) & 3;
|
gI_ZoneDisplayType[client][type][track] = (c >> 5) & 3;
|
||||||
c = czone[p++];
|
c = czone[p++];
|
||||||
@ -2475,16 +2488,22 @@ void OpenCustomZoneMenu(int client, int pos=0)
|
|||||||
menu.SetTitle("%T", "CustomZone_MainMenuTitle", client);
|
menu.SetTitle("%T", "CustomZone_MainMenuTitle", client);
|
||||||
|
|
||||||
// Only start zone and end zone are customizable imo, why do you even want to customize the zones that arent often used/seen???
|
// Only start zone and end zone are customizable imo, why do you even want to customize the zones that arent often used/seen???
|
||||||
|
#if CZONE_VER == 'b'
|
||||||
|
for (int i = 0; i <= Track_Bonus; i++)
|
||||||
|
{
|
||||||
|
for (int j = 0; j < ZONETYPES_SIZE; j++)
|
||||||
|
#else
|
||||||
for (int i = 0; i < TRACKS_SIZE; i++)
|
for (int i = 0; i < TRACKS_SIZE; i++)
|
||||||
{
|
{
|
||||||
for (int j = 0; j <= Zone_End; j++)
|
for (int j = 0; j <= Zone_End; j++)
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
if (gA_ZoneSettings[j][0].bVisible)
|
if (j != Zone_CustomSpawn)// && gA_ZoneSettings[j][i].bVisible)
|
||||||
{
|
{
|
||||||
char info[8];
|
char info[8];
|
||||||
FormatEx(info, sizeof(info), "%i;%i", i, j);
|
FormatEx(info, sizeof(info), "%i;%i", i, j);
|
||||||
char trackName[32], zoneName[32], display[64];
|
char trackName[32], zoneName[32], display[64];
|
||||||
GetTrackName(client, i, trackName, sizeof(trackName));
|
GetTrackName(client, i, trackName, sizeof(trackName), !(CZONE_VER == 'b'));
|
||||||
GetZoneName(client, j, zoneName, sizeof(zoneName));
|
GetZoneName(client, j, zoneName, sizeof(zoneName));
|
||||||
|
|
||||||
FormatEx(display, sizeof(display), "%s - %s", trackName, zoneName);
|
FormatEx(display, sizeof(display), "%s - %s", trackName, zoneName);
|
||||||
@ -2581,16 +2600,22 @@ void OpenSubCustomZoneMenu(int client, int track, int zoneType)
|
|||||||
|
|
||||||
void HandleCustomZoneCookie(int client)
|
void HandleCustomZoneCookie(int client)
|
||||||
{
|
{
|
||||||
char buf[1 + 2*2*TRACKS_SIZE + 1]; // version + ((start + end) * 2 chars * tracks) + NUL terminator
|
char buf[100]; // #define MAX_VALUE_LENGTH 100
|
||||||
int p = 0;
|
int p = 0;
|
||||||
|
|
||||||
|
#if CZONE_VER == 'b'
|
||||||
|
for (int type = Zone_Start; type < ZONETYPES_SIZE; type++)
|
||||||
|
{
|
||||||
|
for (int track = Track_Main; track <= Track_Bonus; track++)
|
||||||
|
#else
|
||||||
for (int type = Zone_Start; type <= Zone_End; type++)
|
for (int type = Zone_Start; type <= Zone_End; type++)
|
||||||
{
|
{
|
||||||
for (int track = Track_Main; track < TRACKS_SIZE; track++)
|
for (int track = Track_Main; track < TRACKS_SIZE; track++)
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
if (gI_ZoneDisplayType[client][type][track] || gI_ZoneColor[client][type][track] || gI_ZoneWidth[client][type][track])
|
if (gI_ZoneDisplayType[client][type][track] || gI_ZoneColor[client][type][track] || gI_ZoneWidth[client][type][track])
|
||||||
{
|
{
|
||||||
if (!p) buf[p++] = 'a'; // "version number"
|
if (!p) buf[p++] = CZONE_VER;
|
||||||
// highest bit (0x80) set so we don't get a zero byte terminating the cookie early
|
// highest bit (0x80) set so we don't get a zero byte terminating the cookie early
|
||||||
buf[p++] = 0x80 | (gI_ZoneDisplayType[client][type][track] << 5) | (type << 4) | track;
|
buf[p++] = 0x80 | (gI_ZoneDisplayType[client][type][track] << 5) | (type << 4) | track;
|
||||||
buf[p++] = 0x80 | (gI_ZoneWidth[client][type][track] << 4) | gI_ZoneColor[client][type][track];
|
buf[p++] = 0x80 | (gI_ZoneWidth[client][type][track] << 4) | gI_ZoneColor[client][type][track];
|
||||||
@ -3924,6 +3949,10 @@ void DrawZone(float points[8][3], int color[4], float life, float width, bool fl
|
|||||||
0.1, 0.5, 2.0, 8.0
|
0.1, 0.5, 2.0, 8.0
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#if CZONE_VER == 'b'
|
||||||
|
track = (track > Track_Bonus) ? Track_Bonus : Track_Main;
|
||||||
|
#endif
|
||||||
|
|
||||||
int clients[MAXPLAYERS+1];
|
int clients[MAXPLAYERS+1];
|
||||||
int count = 0;
|
int count = 0;
|
||||||
|
|
||||||
|
|||||||
@ -18,6 +18,10 @@
|
|||||||
"#format" "{1:d}"
|
"#format" "{1:d}"
|
||||||
"en" "Bonus {1}"
|
"en" "Bonus {1}"
|
||||||
}
|
}
|
||||||
|
"Track_Bonus_NoNum"
|
||||||
|
{
|
||||||
|
"en" "Bonus"
|
||||||
|
}
|
||||||
// ---------- Commands ---------- //
|
// ---------- Commands ---------- //
|
||||||
"NoCommandAccess"
|
"NoCommandAccess"
|
||||||
{
|
{
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user