Skip to content

Commit

Permalink
SP Ironsights #20, Tau Prediction Fix, SP Crossbow Bolts #21
Browse files Browse the repository at this point in the history
  • Loading branch information
ampreeT committed Sep 11, 2024
1 parent d8aecd7 commit 98caf32
Show file tree
Hide file tree
Showing 12 changed files with 772 additions and 65 deletions.
27 changes: 14 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -217,22 +217,23 @@ ConVar: `sc_ft <FEATURE> <0 or 1>`
>
> It is recommended to leave these features at the default values as these are configured per map within EDT configurations. __Modifying feature values could negatively impact the gameplay experience__.
| **Feature** | **Description** |
| **Feature** | **Description** |
|-----------------------------|--------------------------------------------------------------------------------------------------------------------------------|
| `FIRSTPERSON_DEATHCAM` | Enables the first-person death camera. |
| `HEV_SOUNDS` | Enables HEV sounds. |
| `INSTANCE_ITEMS` | Instances pickup items and weapons for each player. Instanced items disappear once picked up and 'respawn' along with the player. |
| `INSTANCE_ITEMS_NORESET` | If enabled, items will not 'respawn' picked up items after death. |
| `KEEP_EQUIPMENT` | Makes players spawn with previously picked up equipment (suit, weapons). Global for all players. |
| `STRIP_DEFAULT_EQUIPMENT` | Removes default multiplayer equipment. |
| `STRIP_DEFAULT_EQUIPMENT_KEEPSUIT` | |
| `DISABLE_CANISTER_DROPS` | Disables item drops when players die in multiplayer. |
| `NO_TELEFRAGGING` | Prevents teleporting props and players from slaying other players. |
| `NOBLOCK` | Prevents player-on-player collisions. (This feature requires `mp_teamplay 1` to fix smoothness issues.) |
| `SHOW_WELCOME_MESSAGE` | Shows players a greeting message with basic plugin info. |
| `FIRSTPERSON_DEATHCAM` | Enables the first-person death camera. |
| `HEV_SOUNDS` | Enables HEV sounds. |
| `INSTANCE_ITEMS` | Instances pickup items and weapons for each player. Instanced items disappear once picked up and 'respawn' along with the player. |
| `INSTANCE_ITEMS_NORESET` | If enabled, items will not 'respawn' picked up items after death. |
| `KEEP_EQUIPMENT` | Makes players spawn with previously picked up equipment (suit, weapons). Global for all players. |
| `STRIP_DEFAULT_EQUIPMENT` | Removes default multiplayer equipment. |
| `STRIP_DEFAULT_EQUIPMENT_KEEPSUIT` | |
| `DISABLE_CANISTER_DROPS` | Disables item drops when players die in multiplayer. |
| `NO_TELEFRAGGING` | Prevents teleporting props and players from slaying other players. |
| `NOBLOCK` | Prevents player-on-player collisions. (This feature requires `mp_teamplay 1` to fix smoothness issues.) |
| `SHOW_WELCOME_MESSAGE` | Shows players a greeting message with basic plugin info. |
| `AUTODETECT_MAP_END` | Detects commonly used commands for ending singleplayer maps from `point_clientcommand` and `point_servercommand` entities and changes the map. At first, this feature checks `sourcecoop_homemap` is set (see below), then checks if `nextmap` is set. If none are set, the map is not changed. Recommended to keep enabled. |
| `CHANGELEVEL_FX` | Show visual effects (spawn particles) at level change locations. |
| `CHANGELEVEL_FX` | Show visual effects (spawn particles) at level change locations. |
| `TRANSFER_PLAYER_STATE` | Enables player persistence through level changes. Currently, players will carry over their health, armor and equipment for the first spawn point (checkpoint) in the map. Afterwards, the default map equipment is used. |
| `SP_WEAPONS` | Sets whether to use the singleplayer variants of weapons. |
<a id="contributing"></a>
## 🌱 Contributing
Expand Down
1 change: 1 addition & 0 deletions edt/common/base/coop_base_sp_conversion.edt
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"INSTANCE_ITEMS" "1"
"STRIP_DEFAULT_EQUIPMENT" "1"
"DISABLE_CANISTER_DROPS" "1"
"SP_WEAPONS" "1"
}
"console"
{
Expand Down
156 changes: 147 additions & 9 deletions gamedata/srccoop.games.txt
Original file line number Diff line number Diff line change
Expand Up @@ -501,13 +501,55 @@
}
}
}
"CWeapon_Tau::ItemPostFrame"
"CBaseCombatWeapon::Deploy"
{
"offset" "CWeapon_Tau::ItemPostFrame"
"offset" "CBaseCombatWeapon::Deploy"
"hooktype" "entity"
"return" "void"
"this" "entity"
}
"CBaseCombatWeapon::ItemPostFrame"
{
"offset" "CBaseCombatWeapon::ItemPostFrame"
"hooktype" "entity"
"return" "void"
"this" "entity"
}
"CBaseCombatWeapon::PrimaryAttack"
{
"offset" "CBaseCombatWeapon::PrimaryAttack"
"hooktype" "entity"
"return" "void"
"this" "entity"
}
"CBaseCombatWeapon::GetPrimaryAttackActivity"
{
"offset" "CBaseCombatWeapon::GetPrimaryAttackActivity"
"hooktype" "entity"
"return" "int"
"this" "entity"
}
"CBaseCombatWeapon::GetDrawActivity"
{
"offset" "CBaseCombatWeapon::GetDrawActivity"
"hooktype" "entity"
"return" "int"
"this" "entity"
}
"CWeapon_Crossbow::FireBolt"
{
"offset" "CWeapon_Crossbow::FireBolt"
"hooktype" "entity"
"return" "bool"
"this" "entity"
"arguments"
{
"bUnknown"
{
"type" "bool"
}
}
}

// _____ ______ _______ ____ _ _ _____
// | __ \| ____|__ __/ __ \| | | | __ \
Expand Down Expand Up @@ -664,6 +706,32 @@
}
}
}
"CBlackMesaBaseWeaponIronSights::ToggleIronSights"
{
"signature" "CBlackMesaBaseWeaponIronSights::ToggleIronSights"
"callconv" "thiscall"
"return" "void"
"this" "entity"
}
"CWeapon_Tau::FireBeam"
{
"signature" "CWeapon_Tau::FireBeam"
"callconv" "thiscall"
"return" "void"
"this" "entity"
"arguments"
{
"pfUnknown1"
{
// the real type is float*
"type" "int"
}
"bUnknown2"
{
"type" "bool"
}
}
}
}
}

Expand Down Expand Up @@ -780,21 +848,31 @@
"CAI_ScriptConditions::EvaluationThink" // void CAI_ScriptConditions::EvaluationThink()
{
// str: "%s WARNING: Player is NOTARGET"
"windows" "\x55\x8B\xEC\x83\xEC\x1C\x56\x8B\xF1\x80\xBE\x94\x03\x00\x00\x01"
"linux" "@_ZN20CAI_ScriptConditions15EvaluationThinkEv"
"windows" "\x55\x8B\xEC\x83\xEC\x1C\x56\x8B\xF1\x80\xBE\x94\x03\x00\x00\x01"
"linux" "@_ZN20CAI_ScriptConditions15EvaluationThinkEv"
}
"CLagCompensationManager::RestoreEntityFromRecords"
{
// str: " restore got most of the way\n"
// On win, this is a 1:1 sub call of CLagCompensationManager::FinishLagCompensation, str: "FinishLagCompensation"
"windows" "\x55\x8B\xEC\x83\xEC\x14\x53\x8B\x5D\x0C"
"linux" "@_ZN23CLagCompensationManager24RestoreEntityFromRecordsEP11CBaseEntityP9LagRecordS3_b"
"windows" "\x55\x8B\xEC\x83\xEC\x14\x53\x8B\x5D\x0C"
"linux" "@_ZN23CLagCompensationManager24RestoreEntityFromRecordsEP11CBaseEntityP9LagRecordS3_b"
}
"CLagCompensationManager::BacktrackEntity"
{
// str: "Backtrack failed completely"
"windows" "\x55\x8B\xEC\x81\xEC\x00\x01\x00\x00\xA1\x2A\x2A\x2A\x2A\x33\xC5\x89\x45\xFC\x8B\x45\x14"
"linux" "@_ZN23CLagCompensationManager15BacktrackEntityEP11CBaseEntityfP19CUtlFixedLinkedListI9LagRecordEPS3_S6_b"
"windows" "\x55\x8B\xEC\x81\xEC\x00\x01\x00\x00\xA1\x2A\x2A\x2A\x2A\x33\xC5\x89\x45\xFC\x8B\x45\x14"
"linux" "@_ZN23CLagCompensationManager15BacktrackEntityEP11CBaseEntityfP19CUtlFixedLinkedListI9LagRecordEPS3_S6_b"
}
"CBlackMesaBaseWeaponIronSights::ToggleIronSights"
{
"windows" "\x55\x8B\xEC\x83\xEC\x14\x56\x57\x8B\xF9\x2A\x2A\x2A\x2A\x2A\x8B\xF0\x89\x75\xEC\x85\xF6\x2A\x2A\x5F\x32\xC0\x5E\x8B"
"linux" "@_ZN30CBlackMesaBaseWeaponIronSights16ToggleIronSightsEv"
}
"CWeapon_Tau::FireBeam"
{
"windows" "\x55\x8B\xEC\x83\xEC\x5C\x56\x57\x8B\xF9\x2A\x2A\x2A\x2A\x2A\x8B\xF0\x85\xF6\x2A\x2A\x2A\x2A\x2A\x2A"
"linux" "@_ZN11CWeapon_Tau8FireBeamERKfb"
}
}

Expand Down Expand Up @@ -1069,11 +1147,41 @@
"windows" "343"
"linux" "344"
}
"CWeapon_Tau::ItemPostFrame" // CWeapon_Tau::ItemPostFrame(CWeapon_Tau *)
"CBaseAnimating::SelectWeightedSequence" // CBaseAnimating::SelectWeightedSequence(Activity)
{
"windows" "211"
"linux" "212"
}
"CBaseCombatWeapon::Deploy" // CBaseCombatWeapon::Deploy()
{
"windows" "268"
"linux" "269"
}
"CBaseCombatWeapon::ItemPostFrame" // CBaseCombatWeapon::ItemPostFrame()
{
"windows" "279"
"linux" "280"
}
"CBaseCombatWeapon::PrimaryAttack" // CBaseCombatWeapon::PrimaryAttack()
{
"windows" "295"
"linux" "296"
}
"CBaseCombatWeapon::GetPrimaryAttackActivity" // CBaseCombatWeapon::GetPrimaryAttackActivity()
{
"windows" "297"
"linux" "298"
}
"CBaseCombatWeapon::GetDrawActivity" // CBaseCombatWeapon::GetDrawActivity() const
{
"windows" "299"
"linux" "300"
}
"CWeapon_Crossbow::FireBolt" // CWeapon_Crossbow::FireBolt(bool)
{
"windows" "423"
"linux" "424"
}
}
}

Expand Down Expand Up @@ -1354,6 +1462,36 @@
"windows" "149"
"linux" "150"
}

// This is not implemented for this game.
//"CBaseAnimating::SelectWeightedSequence" // CBaseAnimating::SelectWeightedSequence(Activity)
//{
//}
"CBaseCombatWeapon::Deploy" // CBaseCombatWeapon::Deploy()
{
"windows" "248"
"linux" "249"
}
"CBaseCombatWeapon::ItemPostFrame" // CBaseCombatWeapon::ItemPostFrame()
{
"windows" "259"
"linux" "260"
}
"CBaseCombatWeapon::PrimaryAttack" // CBaseCombatWeapon::PrimaryAttack()
{
"windows" "273"
"linux" "274"
}
"CBaseCombatWeapon::GetPrimaryAttackActivity" // CBaseCombatWeapon::GetPrimaryAttackActivity()
{
"windows" "275"
"linux" "276"
}
"CBaseCombatWeapon::GetDrawActivity" // CBaseCombatWeapon::GetDrawActivity() const
{
"windows" "277"
"linux" "278"
}
}
}
}
2 changes: 1 addition & 1 deletion scripting/include/srccoop.inc
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@
#define ENTPATCH_BM_MISC_MARIONETTIST
#define ENTPATCH_BM_MUSIC_TRACK
#define ENTPATCH_BM_SNARK_NEST
#define ENTPATCH_BM_TAU_VELOCITY
#define ENTPATCH_BM_SP_WEAPONS

#define PLAYERPATCH_SETSUITUPDATE
#define PLAYERPATCH_PICKUP_FORCEPLAYERTODROPTHISOBJECT
Expand Down
54 changes: 54 additions & 0 deletions scripting/include/srccoop/blackmesa/classdef.inc
Original file line number Diff line number Diff line change
Expand Up @@ -164,3 +164,57 @@ methodmap CBM_MP_GameRules < CMultiplayRules
GameRules_SetProp(szStateProp, bInIntermission, _, STATE_ELEMENT_IS_IN_INTERMISSION);
}
}

methodmap CBlackMesaBaseCombatWeapon < CBaseCombatWeapon
{
public CBlackMesaBaseCombatWeapon(const int iEntIndex = -1)
{
return view_as<CBlackMesaBaseCombatWeapon>(CBaseCombatWeapon(iEntIndex));
}
}

methodmap CBlackMesaBaseCombatWeaponIronsights < CBlackMesaBaseCombatWeapon
{
public CBlackMesaBaseCombatWeaponIronsights(const int iEntIndex = -1)
{
return view_as<CBlackMesaBaseCombatWeaponIronsights>(CBlackMesaBaseCombatWeapon(iEntIndex));
}

public bool IsInIronsights()
{
return view_as<bool>(GetEntProp(this.GetEntIndex(), Prop_Send, "m_bIronSights"));
}
public bool IsInIronsightsPostProcess()
{
return view_as<bool>(GetEntProp(this.GetEntIndex(), Prop_Send, "m_bIronSightsScopePostprocess"));
}
public bool SetIronsights(const bool bIronsights)
{
SetEntProp(this.GetEntIndex(), Prop_Send, "m_bIronSights", bIronsights);
}
public bool SetIronsightsPostProcess(const bool bIronsights)
{
SetEntProp(this.GetEntIndex(), Prop_Send, "m_bIronSightsScopePostprocess", bIronsights);
}
}

methodmap CWeapon_Crossbow < CBlackMesaBaseCombatWeaponIronsights
{
public CWeapon_Crossbow(const int iEntIndex = -1)
{
return view_as<CWeapon_Crossbow>(CBlackMesaBaseCombatWeaponIronsights(iEntIndex));
}
public static CWeapon_Crossbow Create()
{
return CWeapon_Crossbow(CreateEntityByName("weapon_crossbow"));
}

public bool IsRearming()
{
return GetEntProp(this.GetEntIndex(), Prop_Send, "m_bNeedsToRearm") != 0;
}
public void SetRearming(const bool bRearming)
{
SetEntProp(this.GetEntIndex(), Prop_Send, "m_bNeedsToRearm", bRearming);
}
}
Loading

0 comments on commit 98caf32

Please sign in to comment.