Skip to content

Commit

Permalink
Update plugins & ext (#315)
Browse files Browse the repository at this point in the history
1. Add latest version 'l4dtoolz' by @accelerator74, bugs with 32 slots were found, now 31 slots are available, added earlier unlocking of slots before loading the map, some signature updates.
2. Add latest version 'builtinvotes' and update include.
3. Update include l4d2util , recompiling plugins using this. (Update method GetInfectedAbilityEntity, update syntax and minor fixes).
4. Update syntax l4d2_m2_control_eq and minor fixes
5. Fix compile with new syntax l4d_setscores
6. Add l4d2_m2_control_eq.smx
7. Delete SI_Targeting.sp unused file from hardcoop
8. Remove hardcode: offset zombiemanager will now be in gamedata l4d2_zombie_manager.txt
9. Fix l4d2_smoker_drag_damage_interval it didn't reset the timer tongue drag damage, if we use the first damage. This plugin is needed so that this timer does not depend on cvar 'tongue_choke_damage_interval', instead we use our 'tongue_drag_damage_interval'. This timer always resets back when dealing damage.
10. l4d2_uncommon_blocker correction of description.
11. Fix l4d2_dominatorscontrol.smx on windows
  • Loading branch information
A1mDev committed Jul 6, 2021
1 parent 8a0407c commit 9e833db
Show file tree
Hide file tree
Showing 37 changed files with 1,123 additions and 1,018 deletions.
Binary file modified addons/l4dtoolz/l4dtoolz_mm.so
Binary file not shown.
Binary file modified addons/sourcemod/extensions/builtinvotes.ext.2.l4d2.so
Binary file not shown.
82 changes: 78 additions & 4 deletions addons/sourcemod/gamedata/l4d2_dominators.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,53 @@
{
"bIsDominator"
{
/* @A1m`:
* How to find offset on windows:
*
* if ( *(&v17 + v6) < *(_DWORD *)(*((_DWORD *)*(&off_107A7F98 + v6) + 7) + 48) )
* {
* if ( !byte_107A7F90[v6] )
* goto LABEL_27;
* v7 = 0;
* if ( byte_107A7F90[0] ) //we need it 'byte_107A7F90'
* v7 = v23;
* if ( byte_107A7F91 )
* v7 += v24;
* if ( byte_107A7F92 )
* v7 += v25;
* if ( byte_107A7F93 )
* v7 += v26;
* if ( byte_107A7F94 )
* v7 += v27;
* if ( byte_107A7F95 )
* v7 += v28;
* if ( v7 >= 3 != 1 )
* {
* v13 = v4;
* v11 = v5;
* }
* }
*
* We need an offset from the signature to the instruction that uses this 'byte_107A7F90'
* + 2 bytes excluding the instruction itself (cmp) and other addresses, the address itself must occupy 4 bytes in memory.
* .text:10300CB3 38 05 90 7F 7A 10 cmp byte_107A7F90, al
*
* If we go to this 'byte_107A7F90', we will see an array like this (8 bytes 01 or 00):
*
* .data:107A7F90 ; char byte_107A7F90[]
* .data:107A7F90 01 byte_107A7F90 db 1 ; DATA XREF: sub_10300BD0+D8↑r
* .data:107A7F90 ; sub_10300BD0+E3↑r
* .data:107A7F91 00 byte_107A7F91 db 0 ; DATA XREF: sub_10300BD0+ED↑r
* .data:107A7F92 01 byte_107A7F92 db 1 ; DATA XREF: sub_10300BD0:loc_10300CC9↑r
* .data:107A7F93 00 byte_107A7F93 db 0 ; DATA XREF: sub_10300BD0:loc_10300CD5↑r
* .data:107A7F94 01 byte_107A7F94 db 1 ; DATA XREF: sub_10300BD0:loc_10300CE1↑r
* .data:107A7F95 01 byte_107A7F95 db 1 ; DATA XREF: sub_10300BD0:loc_10300CED↑r
* .data:107A7F96 00 00
*/
"windows"
{
"signature" "CTerrorPlayer::IsClassOverLimit"
"read" "156"
"read" "229" //227 + 2
}
"linux"
{
Expand All @@ -22,13 +65,44 @@
"CTerrorPlayer::IsClassOverLimit::bIsDominator"
{
"library" "server"
"linux" "@_ZZN13CTerrorPlayer16IsClassOverLimitEiE12bIsDominator"
"linux" "@_ZZN13CTerrorPlayer16IsClassOverLimitEiE12bIsDominator"
}

/* @A1m`:
* How to find it on windows:
* Need to find a string "Player %s spawned as %s after waiting %", this will point to a function 'CTerrorPlayer::Spawn(void)' (sub_103216A0)
* What we need is just above this string
*
* if ( (unsigned __int8)sub_102D51F0()
* && !(*(unsigned __int8 (__thiscall **)(int))(*(_DWORD *)v1 + 1908))(v1)
* && !*(_BYTE *)(v1 + 16373)
* && dword_10857790 != 8 )
* {
* if ( *(_DWORD *)(v1 + 11192) )
* {
* sub_10300400(v1 + 11192);
* *(_DWORD *)(v1 + 11192) = 0;
* }
* dword_10857790 = sub_10300BD0((_DWORD *)v1, 1); //we need this function sub_10300BD0
* v89 = *(_DWORD *)(dword_10835050 + 1416);
* dword_10857790 = sub_102764F0(dword_10857790);
* }
* (*(void (__thiscall **)(int, int))(*(_DWORD *)v1 + 2324))(v1, dword_10857790);
* v137 = *(_DWORD *)(v1 + 4 * dword_10857790 + 11560) + 1;
* sub_102B2B30(dword_10857790, &v137);
* if ( !(*(unsigned __int8 (__thiscall **)(int))(*(_DWORD *)v1 + 1908))(v1) && *(_DWORD *)(dword_10857C64 + 48) )
* {
* v90 = (*(int (__thiscall **)(int))(*(_DWORD *)v1 + 1344))(v1);
* v91 = sub_1034B5A0(v90);
* v92 = (*(int (__thiscall **)(int, int, _DWORD, _DWORD))(*(_DWORD *)v1 + 180))(v1, v91, *(unsigned __int64 *)&v138, *(unsigned __int64 *)&v138 >> 32);
* DevMsg("Player %s spawned as %s after waiting %3.2f seconds\n", v92);
* }
*/
"CTerrorPlayer::IsClassOverLimit"
{
"library" "server"
"windows" "\x83\xEC\x40\x56\x8B\x74\x24\x48\x83\xC6\xFF\x83\xFE\x05\x0F\x87\xEF\x00\x00\x00"
/* 83 EC 40 56 8B 74 24 48 83 C6 FF 83 FE 05 0F 87 EF 00 00 00 */
"windows" "\x55\x8B\xEC\x83\xEC\x58\xA1\x2A\x2A\x2A\x2A\x33\xC5\x89\x45\xFC\xA1\x2A\x2A\x2A\x2A"
/* 55 8B EC 83 EC 58 A1 ? ? ? ? 33 C5 89 45 FC A1 ? ? ? ? */
}
}
}
Expand Down
43 changes: 43 additions & 0 deletions addons/sourcemod/gamedata/l4d2_zombiemanager.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
"Games"
{
"left4dead2"
{
"Offsets"
{
/* @A1m`:
* How to find it in Linux:
* Function ZombieManager::SpawnMob(int)
*
* UTIL_LogPrintf("%3.2f: (MOB) SpawnMob requested of size %d.\n", *(float *)(gpGlobals + 12), a3);
* v3 = TheDirector;
* *((_DWORD *)this + 132) += a3; //we need this offset 132 * 4 = 528
* v4 = CDirector::GetMaxPendingMobCount(v3);
* if ( v4 <= 0 )
* {
* v4 = *((_DWORD *)this + 132);
* }
* else
* {
* if ( v4 > *((_DWORD *)this + 132) )
* v4 = *((_DWORD *)this + 132);
* *((_DWORD *)this + 132) = v4;
* }
* UTIL_LogPrintf("%3.2f: (MOB) SpawnMob pending count is now %d.\n", *(float *)(gpGlobals + 12), v4);
* if ( *((_DWORD *)this + 132) >= *(_DWORD *)(dword_1007E1C + 48) ) //z_mob_min_notify_count cvar
* {
* LOBYTE(v15) = 0;
* ForEachTerrorPlayer<MobAlert>(&v15);
* }
*
* How to find it in Windows:
* We can find the function by the lines indicated above in 'UTIL_LogPrintf'
* Everything's the same in linux, it looks like it is no different for windows
*/
"ZombieManager->m_nPendingMobCount"
{
"linux" "528" //0x210
"windows" "528" //0x210
}
}
}
}
Binary file modified addons/sourcemod/plugins/optional/l4d2_dominatorscontrol.smx
Binary file not shown.
Binary file modified addons/sourcemod/plugins/optional/l4d2_horde.smx
Binary file not shown.
Binary file modified addons/sourcemod/plugins/optional/l4d2_horde_equaliser.smx
Binary file not shown.
Binary file modified addons/sourcemod/plugins/optional/l4d2_m2_control_eq.smx
Binary file not shown.
Binary file modified addons/sourcemod/plugins/optional/l4d2_riotcops.smx
Binary file not shown.
Binary file modified addons/sourcemod/plugins/optional/l4d2_setscores.smx
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified addons/sourcemod/plugins/optional/l4d2_tongue_timer.smx
Binary file not shown.
Binary file modified addons/sourcemod/plugins/optional/l4d2_uncommon_blocker.smx
Binary file not shown.
Binary file modified addons/sourcemod/plugins/optional/l4d_tank_rush.smx
Binary file not shown.
12 changes: 5 additions & 7 deletions addons/sourcemod/scripting/current.sp
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,18 @@

#include <sourcemod>
#include <left4dhooks>
#define L4D2UTIL_STOCKS_ONLY
#include <l4d2util>

#define MAX(%0,%1) (((%0) > (%1)) ? (%0) : (%1))

new Handle:g_hVsBossBuffer;

public Plugin:myinfo =
{
name = "L4D2 Survivor Progress",
author = "CanadaRox, Visor",
description = "Print survivor progress in flow percents ",
version = "2.0.1",
url = "https://github.com/Attano/ProMod"
name = "L4D2 Survivor Progress",
author = "CanadaRox, Visor",
description = "Print survivor progress in flow percents ",
version = "2.0.1",
url = "https://github.com/Attano/ProMod"
};

public OnPluginStart()
Expand Down
3 changes: 2 additions & 1 deletion addons/sourcemod/scripting/double_getup.sp
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,14 @@
// Tank punch on rock getup
// Tank punch on jockeyed player

#pragma semicolon 1

#include <sourcemod>
#include <sdkhooks>
#define L4D2UTIL_STOCKS_ONLY
#include <l4d2util> // Needed for IdentifySurvivor calls. I use survivor indices rather than client indices in case someone leaves while incapped (with a pending getup).
#undef L4D2UTIL_STOCKS_ONLY
#include <left4dhooks> // Needed for forcing players to have a getup animation.
#pragma semicolon 1

public Plugin:myinfo =
{
Expand Down
15 changes: 13 additions & 2 deletions addons/sourcemod/scripting/include/builtinvotes.inc
Original file line number Diff line number Diff line change
Expand Up @@ -540,6 +540,16 @@ native bool BuiltinVote_IsVoteInProgress();
*/
native bool Game_IsVoteInProgress();

/**
* @brief Returns the number of the team in which the vote is progress
* @remarks Team number: 1 - spectators, 2 - survivors, 3 - infected
* @remarks It hardly works for a team of spectators
*
* @returns -1 if no vote in progress or vote is for everyone,
* otherwise the command number
*/
native int Game_GetVoteTeam();

/**
* Retrieves voting information from BuiltinVoteAction_VoteEnd.
*
Expand Down Expand Up @@ -725,6 +735,7 @@ public void __ext_builtinvotes_SetNTVOptional()
MarkNativeAsOptional("DisplayBuiltinVotePass");
MarkNativeAsOptional("DisplayBuiltinVotePass2");
MarkNativeAsOptional("DisplayBuiltinVoteFail");
MarkNativeAsOptional("Game_IsVoteInProgress");
MarkNativeAsOptional("BuiltinVote_IsVoteInProgress");
}
MarkNativeAsOptional("Game_IsVoteInProgress");
MarkNativeAsOptional("Game_GetVoteTeam");
}
22 changes: 12 additions & 10 deletions addons/sourcemod/scripting/include/l4d2util.inc
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#pragma semicolon 1

#if defined l4d2util_inc_
#endinput
#endinput
#endif
#define l4d2util_inc_

#pragma semicolon 1

#include <l4d2util_constants>
#include <l4d2util_infected>
#include <l4d2util_rounds>
Expand All @@ -15,18 +15,20 @@
#if !defined L4D2UTIL_STOCKS_ONLY
#if !defined __IN_L4D2UTIL__

public SharedPlugin:__pl_l4d2util = {
name = "l4d2util",
file = "l4d2util.smx",
public SharedPlugin __pl_l4d2util =
{
name = "l4d2util",
file = "l4d2util.smx",
#if defined REQUIRE_PLUGIN
required = 1,
required = 1,
#else
required = 0,
required = 0,
#endif
};

public __pl_l4d2util_SetNTVOptional() {
// Stub
public void __pl_l4d2util_SetNTVOptional()
{
// Stub
}

#endif // __IN_L4D2UTIL__
Expand Down
7 changes: 5 additions & 2 deletions addons/sourcemod/scripting/include/l4d2util_constants.inc
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
#endif
#define l4d2util_constants_inc_

#define IS_VALID_CLIENT(%1) (%1 > 0 && %1 <= MaxClients)

enum L4D2_Team
{
L4D2Team_Spectator = 1,
Expand Down Expand Up @@ -368,7 +370,8 @@ stock const char SurvivorModels[SurvivorCharacter][] =

// Animation IDs used by CTerrorPlayer::DoAnimationEvent
// Gaps do not mean the animation doesn't exist, just that I don't know what it maps to.
enum Animation {
enum Animation
{
ANIM_RELOAD_PISTOL_UZI_SNIPER = 4,
ANIM_RELOAD_SHOTGUN = 5,
ANIM_RELOAD_SHOTGUN_FINAL = 6,
Expand Down Expand Up @@ -416,4 +419,4 @@ enum Animation {
ANIM_TANK_CLIMB = 94, // Secondary value: Height (1-6)
ANIM_TANK_PUNCH_GETUP = 96,
ANIM_IDLE = 98,
}
}

0 comments on commit 9e833db

Please sign in to comment.