Skip to content

Commit

Permalink
Merge pull request #456 from KZGlobalTeam/dev
Browse files Browse the repository at this point in the history
3.5.5
  • Loading branch information
zealain authored Feb 5, 2023
2 parents 9867f2c + 6b62a4c commit 8f1eea6
Show file tree
Hide file tree
Showing 18 changed files with 168 additions and 43 deletions.
8 changes: 4 additions & 4 deletions addons/sourcemod/gamedata/gokz-core.games.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,15 @@
// applies to trigger_vphysics_motion and trigger_wind
"CBaseVPhysicsTrigger::PassesTriggerFilters"
{
"windows" "199"
"linux" "200"
"windows" "200"
"linux" "201"
}

// applies to all other triggers
"CBaseTrigger::PassesTriggerFilters"
{
"windows" "209"
"linux" "210"
"windows" "210"
"linux" "211"
}

"IServerGameEnts::MarkEntitiesAsTouching"
Expand Down
29 changes: 19 additions & 10 deletions addons/sourcemod/gamedata/gokz-momsurffix.games.txt
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,6 @@
"CGameTrace::surface" "60"
"CGameTrace::hitgroup" "68"
"CGameTrace::physicsbone" "72"
"CGameTrace::m_pEnt" "74"
"CGameTrace::hitbox" "80"
"CGameTrace::size" "84"

//CTraceFilterSimple
"CTraceFilterSimple::vptr" "0"
Expand Down Expand Up @@ -80,6 +77,11 @@
//...
"CMoveData::m_vecAbsOrigin" "152"

//CGameTrace
"CGameTrace::m_pEnt" "74"
"CGameTrace::hitbox" "80"
"CGameTrace::size" "84"

//CBaseHandle
"CBaseHandle::m_Index" "0"

Expand Down Expand Up @@ -124,12 +126,12 @@
"windows"
{
"signature" "CGameMovement::TracePlayerBBox"
"read" "83"
"read" "82"
}
"linux"
{
"signature" "CGameMovement::TracePlayerBBox"
"read" "579"
"read" "598"
}
}

Expand Down Expand Up @@ -285,6 +287,11 @@
//...
"CMoveData::m_vecAbsOrigin" "172"

//CGameTrace
"CGameTrace::m_pEnt" "76"
"CGameTrace::hitbox" "82"
"CGameTrace::size" "86"

//CBasePlayer
//Offset is relative to m_ubEFNoInterpParity netprop and will be substracted from it
"CBasePlayer::m_surfaceFriction" "8"
Expand Down Expand Up @@ -313,7 +320,7 @@
"linux"
{
"signature" "g_pMemAllocFunc"
"read" "142"
"read" "191"
}

"read" "0"
Expand All @@ -329,7 +336,7 @@
"linux"
{
"signature" "CGameMovement::TryPlayerMove"
"read" "596"
"read" "483"
}

"read" "0"
Expand All @@ -342,21 +349,23 @@
{
"library" "server"
"windows" "\x55\x8B\xEC\x83\xE4\xF0\x83\xEC\x5C"
"linux" "\x55\x89\xE5\x57\x56\x53\x81\xEC\x8C\x00\x00\x00\x8B\x5D\x08\x8B\x7D\x10"
// Look for string CGameMovement::TracePlayerBBox
"linux" "\x55\x89\xE5\x57\x56\x53\x83\xEC\x7C\x8B\x5D\x08\x8B\x7D\x10"
}

"CGameMovement::TryPlayerMove"
{
"library" "server"
"windows" "\x55\x8B\xEC\x83\xE4\xF8\x81\xEC\x38\x01\x00\x00\xF3\x0F\x10\x35\x2A\x2A\x2A\x2A"
"linux" "\x55\x89\xE5\x57\x56\x31\xF6\x53\x81\xEC\x2A\x2A\x2A\x2A\xC7\x85\x2A\x2A\x2A\x2A\x2A\x2A\x2A\x2A\xC7\x85"
// Look for vtable with CGameMovement__TracePlayerBBox and count 29 entries down. Look for a very long function if that doesn't work
"linux" "\x55\x66\x0F\xEF\xDB\x89\xE5\x57\x56\x53\x81\xEC\x2A\x2A\x2A\x2A\x8B\x7D\x08"
}

"g_pMemAllocFunc"
{
"library" "server"
"windows" "\x55\x8B\xEC\x56\x8B\xF1\x83\x4E\x30\x04"
"linux" "\x55\x89\xE5\x57\x56\x53\x81\xEC\x6C\x03\x00\x00\x8B\x55\x08"
"linux" "\x55\x89\xE5\x57\x56\x53\x81\xEC\x3C\x01\x00\x00\x8B\x45\x08\x65\x8B\x0D\x14\x00\x00\x00\x89\x4D\xE4\x31\xC9\x89\xC1"
}
}

Expand Down
2 changes: 1 addition & 1 deletion addons/sourcemod/gamedata/gokz-replays.games.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"CCSGameRules::TeamFull"
{
"windows" "\x55\x8B\xEC\x56\x8B\xF1\xE8\x2A\x2A\x2A\x2A\x8B\x45\x08\x83\xE8\x01"
"linux" "\x55\x89\xE5\x83\xEC\x18\x89\x5D\xF8\x8B\x5D\x08\x89\x75\xFC\x8B\x75\x0C\x89\x1C\x24\xE8\x2A\x2A\x2A\x2A\x83\xFE\x02"
"linux" "\x55\x89\xE5\x56\x53\x8B\x5D\x08\x8B\x75\x0C\x80\xBB\xAD\x0E\x00\x00\x00"
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion addons/sourcemod/scripting/gokz-core/commands.sp
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ public Action CommandSetStartPos(int client, int args)
GOKZ_PrintToChat(client, true, "%t", "Set Custom Start Position");
if (GOKZ_GetCoreOption(client, Option_CheckpointSounds) == CheckpointSounds_Enabled)
{
EmitSoundToClient(client, GOKZ_SOUND_CHECKPOINT);
GOKZ_EmitSoundToClient(client, GOKZ_SOUND_CHECKPOINT, _, "Set Start Position");
}

return Plugin_Handled;
Expand Down
13 changes: 12 additions & 1 deletion addons/sourcemod/scripting/gokz-core/forwards.sp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ static GlobalForward H_OnOptionsMenuCreated;
static GlobalForward H_OnOptionsMenuReady;
static GlobalForward H_OnCourseRegistered;
static GlobalForward H_OnRunInvalidated;

static GlobalForward H_OnEmitSoundToClient;

void CreateGlobalForwards()
{
Expand Down Expand Up @@ -82,6 +82,7 @@ void CreateGlobalForwards()
H_OnOptionsMenuReady = new GlobalForward("GOKZ_OnOptionsMenuReady", ET_Ignore, Param_Cell);
H_OnCourseRegistered = new GlobalForward("GOKZ_OnCourseRegistered", ET_Ignore, Param_Cell);
H_OnRunInvalidated = new GlobalForward("GOKZ_OnRunInvalidated", ET_Ignore, Param_Cell);
H_OnEmitSoundToClient = new GlobalForward("GOKZ_OnEmitSoundToClient", ET_Hook, Param_Cell, Param_String, Param_FloatByRef, Param_String);
}

void Call_GOKZ_OnOptionsLoaded(int client)
Expand Down Expand Up @@ -387,4 +388,14 @@ void Call_GOKZ_OnRunInvalidated(int client)
Call_StartForward(H_OnRunInvalidated);
Call_PushCell(client);
Call_Finish();
}

void Call_GOKZ_OnEmitSoundToClient(int client, const char[] sample, float &volume, const char[] description, Action &result)
{
Call_StartForward(H_OnEmitSoundToClient);
Call_PushCell(client);
Call_PushString(sample);
Call_PushFloatRef(volume);
Call_PushString(description);
Call_Finish(result);
}
2 changes: 1 addition & 1 deletion addons/sourcemod/scripting/gokz-core/misc.sp
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ void PlayErrorSound(int client)
{
if (GOKZ_GetCoreOption(client, Option_ErrorSounds) == ErrorSounds_Enabled)
{
EmitSoundToClient(client, SOUND_ERROR);
GOKZ_EmitSoundToClient(client, SOUND_ERROR, _, "Error");
}
}

Expand Down
29 changes: 29 additions & 0 deletions addons/sourcemod/scripting/gokz-core/natives.sp
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ void CreateNatives()
CreateNative("GOKZ_SetTakeoffSpeed", Native_SetTakeoffSpeed);
CreateNative("GOKZ_GetValidJump", Native_GetValidJump);
CreateNative("GOKZ_JoinTeam", Native_JoinTeam);

CreateNative("GOKZ_EmitSoundToClient", Native_EmitSoundToClient);
}

public int Native_GetModeLoaded(Handle plugin, int numParams)
Expand Down Expand Up @@ -599,7 +601,34 @@ public int Native_JoinTeam(Handle plugin, int numParams)
return 0;
}

public int Native_EmitSoundToClient(Handle plugin, int numParams)
{
int client = GetNativeCell(1);

char sample[PLATFORM_MAX_PATH];
GetNativeString(2, sample, sizeof(sample));

float volume = GetNativeCell(3);
float newVolume = volume;

char description[64];
GetNativeString(4, description, sizeof(description));

Action result;

Call_GOKZ_OnEmitSoundToClient(client, sample, newVolume, description, result);
if (result == Plugin_Stop)
{
return 0;
}
if (result == Plugin_Changed)
{
EmitSoundToClient(client, sample, _, _, _, _, newVolume);
return 0;
}
EmitSoundToClient(client, sample, _, _, _, _, volume);
return 0;
}

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

Expand Down
4 changes: 2 additions & 2 deletions addons/sourcemod/scripting/gokz-core/teleports.sp
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ void MakeCheckpoint(int client)

if (GOKZ_GetCoreOption(client, Option_CheckpointSounds) == CheckpointSounds_Enabled)
{
EmitSoundToClient(client, GOKZ_SOUND_CHECKPOINT);
GOKZ_EmitSoundToClient(client, GOKZ_SOUND_CHECKPOINT, _, "Checkpoint");
}
if (GOKZ_GetCoreOption(client, Option_CheckpointMessages) == CheckpointMessages_Enabled)
{
Expand Down Expand Up @@ -879,7 +879,7 @@ static void TeleportDo(int client, const float destOrigin[3], const float destAn
undoTeleportData[client].Update();
if (GOKZ_GetCoreOption(client, Option_TeleportSounds) == TeleportSounds_Enabled)
{
EmitSoundToClient(client, GOKZ_SOUND_TELEPORT);
GOKZ_EmitSoundToClient(client, GOKZ_SOUND_TELEPORT, _, "Teleport");
}

// Call Post Foward
Expand Down
16 changes: 8 additions & 8 deletions addons/sourcemod/scripting/gokz-core/timer/timer.sp
Original file line number Diff line number Diff line change
Expand Up @@ -179,8 +179,8 @@ void PlayTimerStartSound(int client)
{
if (GetGameTime() - lastStartSoundTime[client] > GOKZ_TIMER_SOUND_COOLDOWN)
{
EmitSoundToClient(client, gC_ModeStartSounds[GOKZ_GetCoreOption(client, Option_Mode)]);
EmitSoundToClientSpectators(client, gC_ModeStartSounds[GOKZ_GetCoreOption(client, Option_Mode)]);
GOKZ_EmitSoundToClient(client, gC_ModeStartSounds[GOKZ_GetCoreOption(client, Option_Mode)], _, "Timer Start");
GOKZ_EmitSoundToClientSpectators(client, gC_ModeStartSounds[GOKZ_GetCoreOption(client, Option_Mode)], _, "Timer Start");
lastStartSoundTime[client] = GetGameTime();
}
}
Expand Down Expand Up @@ -301,24 +301,24 @@ static bool JustEndedTimer(int client)

static void PlayTimerEndSound(int client)
{
EmitSoundToClient(client, gC_ModeEndSounds[GOKZ_GetCoreOption(client, Option_Mode)]);
EmitSoundToClientSpectators(client, gC_ModeEndSounds[GOKZ_GetCoreOption(client, Option_Mode)]);
GOKZ_EmitSoundToClient(client, gC_ModeEndSounds[GOKZ_GetCoreOption(client, Option_Mode)], _, "Timer End");
GOKZ_EmitSoundToClientSpectators(client, gC_ModeEndSounds[GOKZ_GetCoreOption(client, Option_Mode)], _, "Timer End");
}

static void PlayTimerFalseEndSound(int client)
{
if (!JustEndedTimer(client)
&& (GetGameTime() - lastFalseEndTime[client]) > GOKZ_TIMER_SOUND_COOLDOWN)
{
EmitSoundToClient(client, gC_ModeFalseEndSounds[GOKZ_GetCoreOption(client, Option_Mode)]);
EmitSoundToClientSpectators(client, gC_ModeFalseEndSounds[GOKZ_GetCoreOption(client, Option_Mode)]);
GOKZ_EmitSoundToClient(client, gC_ModeFalseEndSounds[GOKZ_GetCoreOption(client, Option_Mode)], _, "Timer False End");
GOKZ_EmitSoundToClientSpectators(client, gC_ModeFalseEndSounds[GOKZ_GetCoreOption(client, Option_Mode)], _, "Timer False End");
}
}

static void PlayTimerStopSound(int client)
{
EmitSoundToClient(client, GOKZ_SOUND_TIMER_STOP);
EmitSoundToClientSpectators(client, GOKZ_SOUND_TIMER_STOP);
GOKZ_EmitSoundToClient(client, GOKZ_SOUND_TIMER_STOP, _, "Timer Stop");
GOKZ_EmitSoundToClientSpectators(client, GOKZ_SOUND_TIMER_STOP, _, "Timer Stop");
}

static void PrintEndTimeString(int client)
Expand Down
4 changes: 2 additions & 2 deletions addons/sourcemod/scripting/gokz-global.sp
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ public void FPSCheck(QueryCookie cookie, int client, ConVarQueryResult result, c
}
else
{
EmitSoundToClient(client, GOKZ_SOUND_TIMER_STOP);
GOKZ_EmitSoundToClient(client, GOKZ_SOUND_TIMER_STOP, _, "Timer Stop");
}
}
}
Expand Down Expand Up @@ -524,7 +524,7 @@ void AnnounceNewTopTime(int client, int course, int mode, int timeType, int rank

void PlayBeatRecordSound()
{
EmitSoundToAll(GL_SOUND_NEW_RECORD);
GOKZ_EmitSoundToAll(GL_SOUND_NEW_RECORD, _, "World Record");
}


Expand Down
4 changes: 2 additions & 2 deletions addons/sourcemod/scripting/gokz-hud/racing_text.sp
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ static void ShowCountdownText(KZPlayer player, KZPlayer targetPlayer)
int colour[4];
GetCountdownColour(timeToStart, colour);

SetHudTextParams(-1.0, 0.3, 1.0, colour[0], colour[1], colour[2], colour[3], 0, 1.0, 0.0, 0.0);
SetHudTextParams(-1.0, 0.3, GetTextHoldTime(gB_FastUpdateRate[player.ID] ? 3 : 6), colour[0], colour[1], colour[2], colour[3], 0, 1.0, 0.0, 0.0);
ShowSyncHudText(player.ID, racingHudSynchronizer, "%t\n\n%d", "Get Ready", IntMax(RoundToCeil(timeToStart), 1));
}

Expand Down Expand Up @@ -162,6 +162,6 @@ static void ShowStartedText(KZPlayer player, KZPlayer targetPlayer)
return;
}

SetHudTextParams(-1.0, 0.3, 1.0, 0, 255, 0, 255, 0, 1.0, 0.0, 0.0);
SetHudTextParams(-1.0, 0.3, GetTextHoldTime(gB_FastUpdateRate[player.ID] ? 3 : 6), 0, 255, 0, 255, 0, 1.0, 0.0, 0.0);
ShowSyncHudText(player.ID, racingHudSynchronizer, "%t", "Go!");
}
4 changes: 2 additions & 2 deletions addons/sourcemod/scripting/gokz-hud/speed_text.sp
Original file line number Diff line number Diff line change
Expand Up @@ -98,11 +98,11 @@ static void ShowSpeedText(KZPlayer player, HUDInfo info)
// Set params based on the available screen space at max scaling HUD
if (!IsDrawingInfoPanel(player.ID))
{
SetHudTextParams(-1.0, 0.75, 1.0, colour[0], colour[1], colour[2], colour[3], 0, 1.0, 0.0, 0.0);
SetHudTextParams(-1.0, 0.75, GetTextHoldTime(gB_FastUpdateRate[player.ID] ? 3 : 6), colour[0], colour[1], colour[2], colour[3], 0, 1.0, 0.0, 0.0);
}
else
{
SetHudTextParams(-1.0, 0.65, 1.0, colour[0], colour[1], colour[2], colour[3], 0, 1.0, 0.0, 0.0);
SetHudTextParams(-1.0, 0.65, GetTextHoldTime(gB_FastUpdateRate[player.ID] ? 3 : 6), colour[0], colour[1], colour[2], colour[3], 0, 1.0, 0.0, 0.0);
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions addons/sourcemod/scripting/gokz-hud/timer_text.sp
Original file line number Diff line number Diff line change
Expand Up @@ -154,11 +154,11 @@ static void ShowTimerText(KZPlayer player, HUDInfo info)
{
case TimerText_Top:
{
SetHudTextParams(-1.0, 0.07, 1.0, colour[0], colour[1], colour[2], colour[3], 0, 1.0, 0.0, 0.0);
SetHudTextParams(-1.0, 0.07, GetTextHoldTime(gB_FastUpdateRate[player.ID] ? 3 : 6), colour[0], colour[1], colour[2], colour[3], 0, 1.0, 0.0, 0.0);
}
case TimerText_Bottom:
{
SetHudTextParams(-1.0, 0.9, 1.0, colour[0], colour[1], colour[2], colour[3], 0, 1.0, 0.0, 0.0);
SetHudTextParams(-1.0, 0.9, GetTextHoldTime(gB_FastUpdateRate[player.ID] ? 3 : 6), colour[0], colour[1], colour[2], colour[3], 0, 1.0, 0.0, 0.0);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ void PlayJumpstatSound(int client, int tier)
return;
}

EmitSoundToClient(client, sounds[tier]);
GOKZ_EmitSoundToClient(client, sounds[tier], _, "Jumpstats");
}


Expand Down
4 changes: 2 additions & 2 deletions addons/sourcemod/scripting/gokz-localranks/misc.sp
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ static bool LoadSounds()

static void PlayBeatRecordSound()
{
EmitSoundToAll(gC_BeatRecordSound);
GOKZ_EmitSoundToAll(gC_BeatRecordSound, _, "Server Record");
}

void AnnounceNewTime(
Expand Down Expand Up @@ -315,5 +315,5 @@ void DoPBMissedReport(int client, float pbTime, int recordType)
case RecordType_Pro:GOKZ_PrintToChat(client, true, "%t", "Missed PB (PRO)", GOKZ_FormatTime(pbTime));
case RecordType_NubAndPro:GOKZ_PrintToChat(client, true, "%t", "Missed PB (NUB and PRO)", GOKZ_FormatTime(pbTime));
}
EmitSoundToClient(client, MISSED_PB_SOUND);
GOKZ_EmitSoundToClient(client, MISSED_PB_SOUND, _, "Missed PB");
}
Loading

0 comments on commit 8f1eea6

Please sign in to comment.