Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update GOKZ to be 1.11 compatible #359

Merged
merged 21 commits into from
Oct 6, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: CI

env:
SM_VERSION: "1.10"
SM_VERSION: "1.11"

on:
push:
Expand Down
2 changes: 1 addition & 1 deletion addons/sourcemod/scripting/gokz-anticheat/bhop_tracking.sp
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ static bool JustLanded(int client, int cmdnum)
}

// Records current button inputs
static int RecordButtons(int client, int buttons)
static void RecordButtons(int client, int buttons)
{
gI_ButtonsIndex[client] = NextIndex(gI_ButtonsIndex[client], AC_MAX_BUTTON_SAMPLES);
gI_Buttons[client][gI_ButtonsIndex[client]] = buttons;
Expand Down
1 change: 1 addition & 0 deletions addons/sourcemod/scripting/gokz-chat.sp
Original file line number Diff line number Diff line change
Expand Up @@ -305,4 +305,5 @@ public int Native_SetChatTag(Handle plugin, int numParams)
}

GetNativeString(3, gC_PlayerTagColors[client], sizeof(gC_PlayerTagColors[]));
return 0;
}
9 changes: 5 additions & 4 deletions addons/sourcemod/scripting/gokz-core.sp
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,6 @@ ConVar gCV_gokz_chat_prefix;
ConVar gCV_sv_full_alltalk;

#include "gokz-core/commands.sp"
#include "gokz-core/forwards.sp"
#include "gokz-core/natives.sp"
#include "gokz-core/modes.sp"
#include "gokz-core/misc.sp"
#include "gokz-core/options.sp"
Expand All @@ -77,6 +75,9 @@ ConVar gCV_sv_full_alltalk;
#include "gokz-core/timer/timer.sp"
#include "gokz-core/timer/virtual_buttons.sp"

#include "gokz-core/forwards.sp"
#include "gokz-core/natives.sp"



// =====[ PLUGIN EVENTS ]=====
Expand Down Expand Up @@ -370,7 +371,7 @@ public void OnConfigsExecuted()
OnConfigsExecuted_OptionsMenu();
}

public Action OnNormalSound(int[] clients, int &numClients, char[] sample, int &entity, int &channel, float &volume, int &level, int &pitch, int &flags, char[] soundEntry, int &seed)
public Action OnNormalSound(int clients[MAXPLAYERS], int &numClients, char sample[PLATFORM_MAX_PATH], int &entity, int &channel, float &volume, int &level, int &pitch, int &flags, char soundEntry[PLATFORM_MAX_PATH], int &seed)
{
if (OnNormalSound_StopSounds(entity) == Plugin_Handled)
{
Expand Down Expand Up @@ -484,7 +485,7 @@ static void HookEvents()
HookEvent("player_death", OnPlayerDeath, EventHookMode_Pre);
HookEvent("player_jump", OnPlayerJump);
HookEvent("round_start", OnRoundStart, EventHookMode_PostNoCopy);
AddNormalSoundHook(view_as<NormalSHook>(OnNormalSound));
AddNormalSoundHook(OnNormalSound);

GameData gameData = new GameData("sdktools.games");
int offset;
Expand Down
1 change: 1 addition & 0 deletions addons/sourcemod/scripting/gokz-core/demofix.sp
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ void OnRoundStart_Demofix()
public Action Command_Demorestart(int client, const char[] command, int argc)
{
FixRecord(client);
return Plugin_Continue;
}

static void FixRecord(int client)
Expand Down
2 changes: 1 addition & 1 deletion addons/sourcemod/scripting/gokz-core/map/mapfile.sp
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ static int EntlumpGetString(char[] result, int maxLength, int copyCount, char[]
return finalLength;
}

static EntlumpToken[] EntlumpGetToken(char[] entityLump, int &entlumpIndex)
static EntlumpToken EntlumpGetToken(char[] entityLump, int &entlumpIndex)
{
EntlumpToken result;

Expand Down
1 change: 1 addition & 0 deletions addons/sourcemod/scripting/gokz-core/menus/mode_menu.sp
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,5 @@ public int MenuHandler_Mode(Menu menu, MenuAction action, int param1, int param2
{
delete menu;
}
return 0;
}
1 change: 1 addition & 0 deletions addons/sourcemod/scripting/gokz-core/misc.sp
Original file line number Diff line number Diff line change
Expand Up @@ -500,6 +500,7 @@ public Action Timer_TimeLimit(Handle timer)
public Action Timer_EndRound(Handle timer)
{
CS_TerminateRound(1.0, CSRoundEnd_Draw, true);
return Plugin_Continue;
}


Expand Down
24 changes: 24 additions & 0 deletions addons/sourcemod/scripting/gokz-core/natives.sp
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ public int Native_GetModeVersion(Handle plugin, int numParams)
public int Native_SetModeLoaded(Handle plugin, int numParams)
{
SetModeLoaded(GetNativeCell(1), GetNativeCell(2), GetNativeCell(3));
return 0;
}

public int Native_GetLoadedModeCount(Handle plugin, int numParams)
Expand All @@ -97,11 +98,13 @@ public int Native_SetMode(Handle plugin, int numParams)
public int Native_PrintToChatAndLog(Handle plugin, int numParams)
{
NativeHelper_PrintToChatOrLog(true);
return 0;
}

public int Native_PrintToChat(Handle plugin, int numParams)
{
NativeHelper_PrintToChatOrLog(false);
return 0;
}

static int NativeHelper_PrintToChatOrLog(bool alwaysLog)
Expand Down Expand Up @@ -155,6 +158,7 @@ static int NativeHelper_PrintToChatOrLog(bool alwaysLog)

CPrintToChat(client, "%s", buffer);
}
return 0;
}

public int Native_GetOptionsTopMenu(Handle plugin, int numParams)
Expand Down Expand Up @@ -195,16 +199,19 @@ public int Native_StopTimer(Handle plugin, int numParams)
public int Native_StopTimerAll(Handle plugin, int numParams)
{
TimerStopAll(GetNativeCell(1));
return 0;
}

public int Native_TeleportToStart(Handle plugin, int numParams)
{
TeleportToStart(GetNativeCell(1));
return 0;
}

public int Native_TeleportToSearchStart(Handle plugin, int numParams)
{
TeleportToSearchStart(GetNativeCell(1), GetNativeCell(2));
return 0;
}

public int Native_GetVirtualButtonPosition(Handle plugin, int numParams)
Expand All @@ -224,11 +231,13 @@ public int Native_SetVirtualButtonPosition(Handle plugin, int numParams)

GetNativeArray(2, position, sizeof(position));
SetVirtualButtonPosition(GetNativeCell(1), position, GetNativeCell(3), view_as<bool>(GetNativeCell(4)));
return 0;
}

public int Native_LockVirtualButtons(Handle plugin, int numParams)
{
LockVirtualButtons(GetNativeCell(1));
return 0;
}

public int Native_GetStartPosition(Handle plugin, int numParams)
Expand All @@ -250,11 +259,13 @@ public int Native_SetStartPosition(Handle plugin, int numParams)
GetNativeArray(3, position, sizeof(position));
GetNativeArray(4, angles, sizeof(angles));
SetStartPosition(GetNativeCell(1), GetNativeCell(2), position, angles);
return 0;
}

public int Native_TeleportToEnd(Handle plugin, int numParams)
{
TeleportToEnd(GetNativeCell(1), GetNativeCell(2));
return 0;
}

public int Native_GetStartPositionType(Handle plugin, int numParams)
Expand All @@ -270,11 +281,13 @@ public int Native_SetStartPositionToMapStart(Handle plugin, int numParams)
public int Native_MakeCheckpoint(Handle plugin, int numParams)
{
MakeCheckpoint(GetNativeCell(1));
return 0;
}

public int Native_TeleportToCheckpoint(Handle plugin, int numParams)
{
TeleportToCheckpoint(GetNativeCell(1));
return 0;
}

public int Native_GetCanTeleportToCheckpoint(Handle plugin, int numParams)
Expand All @@ -285,6 +298,7 @@ public int Native_GetCanTeleportToCheckpoint(Handle plugin, int numParams)
public int Native_PrevCheckpoint(Handle plugin, int numParams)
{
PrevCheckpoint(GetNativeCell(1));
return 0;
}

public int Native_GetCanPrevCheckpoint(Handle plugin, int numParams)
Expand All @@ -295,6 +309,7 @@ public int Native_GetCanPrevCheckpoint(Handle plugin, int numParams)
public int Native_NextCheckpoint(Handle plugin, int numParams)
{
NextCheckpoint(GetNativeCell(1));
return 0;
}

public int Native_GetCanNextCheckpoint(Handle plugin, int numParams)
Expand All @@ -305,6 +320,7 @@ public int Native_GetCanNextCheckpoint(Handle plugin, int numParams)
public int Native_UndoTeleport(Handle plugin, int numParams)
{
UndoTeleport(GetNativeCell(1));
return 0;
}

public int Native_GetCanUndoTeleport(Handle plugin, int numParams)
Expand All @@ -315,6 +331,7 @@ public int Native_GetCanUndoTeleport(Handle plugin, int numParams)
public int Native_Pause(Handle plugin, int numParams)
{
Pause(GetNativeCell(1));
return 0;
}

public int Native_GetCanPause(Handle plugin, int numParams)
Expand All @@ -325,16 +342,19 @@ public int Native_GetCanPause(Handle plugin, int numParams)
public int Native_Resume(Handle plugin, int numParams)
{
Resume(GetNativeCell(1));
return 0;
}

public int Native_TogglePause(Handle plugin, int numParams)
{
TogglePause(GetNativeCell(1));
return 0;
}

public int Native_PlayErrorSound(Handle plugin, int numParams)
{
PlayErrorSound(GetNativeCell(1));
return 0;
}

public int Native_SetValidJumpOrigin(Handle plugin, int numParams)
Expand All @@ -348,6 +368,7 @@ public int Native_SetValidJumpOrigin(Handle plugin, int numParams)

// Using Movement_SetOrigin instead causes considerable lag for spectators
SetEntPropVector(client, Prop_Data, "m_vecAbsOrigin", origin);
return 0;
}

public int Native_GetTimerRunning(Handle plugin, int numParams)
Expand Down Expand Up @@ -522,6 +543,7 @@ public int Native_GetHitPerf(Handle plugin, int numParams)
public int Native_SetHitPerf(Handle plugin, int numParams)
{
SetGOKZHitPerf(GetNativeCell(1), view_as<bool>(GetNativeCell(2)));
return 0;
}

public int Native_GetTakeoffSpeed(Handle plugin, int numParams)
Expand All @@ -532,6 +554,7 @@ public int Native_GetTakeoffSpeed(Handle plugin, int numParams)
public int Native_SetTakeoffSpeed(Handle plugin, int numParams)
{
SetGOKZTakeoffSpeed(GetNativeCell(1), view_as<float>(GetNativeCell(2)));
return 0;
}

public int Native_GetValidJump(Handle plugin, int numParams)
Expand All @@ -542,6 +565,7 @@ public int Native_GetValidJump(Handle plugin, int numParams)
public int Native_JoinTeam(Handle plugin, int numParams)
{
JoinTeam(GetNativeCell(1), GetNativeCell(2), GetNativeCell(3));
return 0;
}


Expand Down
2 changes: 1 addition & 1 deletion addons/sourcemod/scripting/gokz-core/options.sp
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ static bool IsValueInRange(OptionType type, any value, any minValue, any maxValu
}
}

static bool LoadOption(int client, const char[] option)
static void LoadOption(int client, const char[] option)
{
char valueString[100];
Cookie cookie = GetOptionProp(option, OptionProp_Cookie);
Expand Down
10 changes: 0 additions & 10 deletions addons/sourcemod/scripting/gokz-core/teleports.sp
Original file line number Diff line number Diff line change
Expand Up @@ -756,16 +756,6 @@ void OnStartZoneStartTouch_Teleports(int client, int course)

// =====[ PRIVATE ]=====

static int NextIndex(int current, int maximum)
{
int next = current + 1;
if (next >= maximum)
{
return 0;
}
return next;
}

static int PrevIndex(int current, int maximum)
{
int prev = current - 1;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ bool ToggleVirtualButtonsLock(int client)
return virtualButtonsLocked[client];
}

bool LockVirtualButtons(int client)
void LockVirtualButtons(int client)
{
virtualButtonsLocked[client] = true;
}
Expand Down
11 changes: 7 additions & 4 deletions addons/sourcemod/scripting/gokz-global.sp
Original file line number Diff line number Diff line change
Expand Up @@ -606,7 +606,7 @@ public int GetAuthStatusCallback(JSON_Object auth_json, GlobalAPIRequestData req
if (request.Failure)
{
LogError("Failed to check API key with Global API.");
return;
return 0;
}

APIAuth auth = view_as<APIAuth>(auth_json);
Expand All @@ -615,20 +615,21 @@ public int GetAuthStatusCallback(JSON_Object auth_json, GlobalAPIRequestData req
LogError("Global API key was found to be missing or invalid.");
}
gB_APIKeyCheck = auth.IsValid;
return 0;
}

public int GetModeInfoCallback(JSON_Object modes, GlobalAPIRequestData request)
{
if (request.Failure)
{
LogError("Failed to check mode versions with Global API.");
return;
return 0;
}

if (!modes.IsArray)
{
LogError("GlobalAPI returned a malformed response while looking up the modes.");
return;
return 0;
}

for (int i = 0; i < modes.Length; i++)
Expand All @@ -653,14 +654,15 @@ public int GetModeInfoCallback(JSON_Object modes, GlobalAPIRequestData request)
gC_ModeNames[mode_id], mode.LatestVersion, desc, GOKZ_GetModeVersion(mode_id), GOKZ_VERSION);
}
}
return 0;
}

public int GetMapCallback(JSON_Object map_json, GlobalAPIRequestData request)
{
if (request.Failure || map_json == INVALID_HANDLE)
{
LogError("Failed to get map info.");
return;
return 0;
}

APIMap map = view_as<APIMap>(map_json);
Expand All @@ -678,6 +680,7 @@ public int GetMapCallback(JSON_Object map_json, GlobalAPIRequestData request)
UpdatePoints(client);
}
}
return 0;
}

void CheckClientGlobalBan(int client)
Expand Down
3 changes: 3 additions & 0 deletions addons/sourcemod/scripting/gokz-global/api.sp
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ public int Native_PrintRecords(Handle plugin, int numParams)
{
PrintRecords(GetNativeCell(1), map, GetNativeCell(3), GetNativeCell(4), steamid);
}
return 0;
}

public int Native_DisplayMapTopMenu(Handle plugin, int numParams)
Expand All @@ -85,6 +86,7 @@ public int Native_DisplayMapTopMenu(Handle plugin, int numParams)
{
DisplayMapTopSubmenu(GetNativeCell(1), map, GetNativeCell(3), GetNativeCell(4), GetNativeCell(5), localRanksCall);
}
return 0;
}

public int Native_GetPoints(Handle plugin, int numParams)
Expand All @@ -111,6 +113,7 @@ public int Native_UpdatePoints(Handle plugin, int numParams)
{
// We're gonna always force an update here, cause otherwise the call doesn't really make sense
UpdatePoints(GetNativeCell(1), true, GetNativeCell(2));
return 0;
}

public int Native_GetAPIKeyValid(Handle plugin, int numParams)
Expand Down
1 change: 1 addition & 0 deletions addons/sourcemod/scripting/gokz-global/ban_player.sp
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,5 @@ public int BanPlayerCallback(JSON_Object response, GlobalAPIRequestData request,
{
LogError("Failed to globally ban %s (%s).", playerName, steamid);
}
return 0;
}
Loading