Skip to content
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
82 changes: 81 additions & 1 deletion regamedll/dlls/player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8310,6 +8310,50 @@ void CDeadHEV::KeyValue(KeyValueData *pkvd)

LINK_ENTITY_TO_CLASS(player_weaponstrip, CStripWeapons, CCSStripWeapons)

void CStripWeapons::KeyValue(KeyValueData *pkvd)
{
#ifdef REGAMEDLL_ADD
if (FStrEq(pkvd->szKeyName, "primary") && Q_atoi(pkvd->szValue) > 0)
{
m_bitsIgnoreSlots |= (1 << PRIMARY_WEAPON_SLOT);
pkvd->fHandled = TRUE;
}
else if (FStrEq(pkvd->szKeyName, "secondary") && Q_atoi(pkvd->szValue) > 0)
{
m_bitsIgnoreSlots |= (1 << PISTOL_SLOT);
pkvd->fHandled = TRUE;
}
else if (FStrEq(pkvd->szKeyName, "knife") && Q_atoi(pkvd->szValue) > 0)
{
m_bitsIgnoreSlots |= (1 << KNIFE_SLOT);
pkvd->fHandled = TRUE;
}
else if (FStrEq(pkvd->szKeyName, "grenade") && Q_atoi(pkvd->szValue) > 0)
{
m_bitsIgnoreSlots |= (1 << GRENADE_SLOT);
pkvd->fHandled = TRUE;
}
else if (FStrEq(pkvd->szKeyName, "bomb") && Q_atoi(pkvd->szValue) > 0)
{
m_bitsIgnoreSlots |= (1 << C4_SLOT);
pkvd->fHandled = TRUE;
}
else if (FStrEq(pkvd->szKeyName, "items") && Q_atoi(pkvd->szValue) > 0)
{
m_bitsIgnoreSlots |= (1 << ALL_OTHER_ITEMS);
pkvd->fHandled = TRUE;
}
else if (FStrEq(pkvd->szKeyName, "special"))
{
m_iszSpecialItem = ALLOC_STRING(pkvd->szValue);
}
else
#endif
{
CPointEntity::KeyValue(pkvd);
}
}

void CStripWeapons::Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value)
{
CBasePlayer *pPlayer = nullptr;
Expand All @@ -8324,7 +8368,43 @@ void CStripWeapons::Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE

if (pPlayer)
{
pPlayer->RemoveAllItems(FALSE);
#ifdef REGAMEDLL_ADD
if (m_bitsIgnoreSlots != 0 || m_iszSpecialItem)
{
if (m_iszSpecialItem)
{
pPlayer->CSPlayer()->RemovePlayerItem(STRING(m_iszSpecialItem));
}

for (int slot = PRIMARY_WEAPON_SLOT; slot <= ALL_OTHER_ITEMS; slot++)
{
if (m_bitsIgnoreSlots & (1 << slot))
continue;

if (slot == ALL_OTHER_ITEMS)
{
pPlayer->CSPlayer()->RemovePlayerItem("item_thighpack");
pPlayer->CSPlayer()->RemovePlayerItem("item_longjump");
pPlayer->CSPlayer()->RemovePlayerItem("item_assaultsuit");
pPlayer->CSPlayer()->RemovePlayerItem("item_kevlar");
pPlayer->CSPlayer()->RemovePlayerItem("item_thighpack");
pPlayer->CSPlayer()->RemovePlayerItem("weapon_shield");
}
else
{
pPlayer->ForEachItem(slot, [pPlayer](CBasePlayerItem *pItem)
{
pPlayer->CSPlayer()->RemovePlayerItem(STRING(pItem->pev->classname));
return false;
});
}
}
}
else
#endif
{
pPlayer->RemoveAllItems(FALSE);
}
}
}

Expand Down
9 changes: 9 additions & 0 deletions regamedll/dlls/player.h
Original file line number Diff line number Diff line change
Expand Up @@ -298,9 +298,18 @@ enum MusicState { SILENT, CALM, INTENSE };

class CCSPlayer;

#define ALL_OTHER_ITEMS 6

class CStripWeapons: public CPointEntity {
public:
virtual void Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value);
virtual void KeyValue(KeyValueData *pkvd);

#ifdef REGAMEDLL_ADD
public:
int m_bitsIgnoreSlots;
int m_iszSpecialItem;
#endif
};

// Dead HEV suit prop
Expand Down
35 changes: 34 additions & 1 deletion regamedll/extra/Toolkit/GameDefinitionFile/regamedll-cs.fgd
Original file line number Diff line number Diff line change
Expand Up @@ -2033,7 +2033,40 @@
speed(integer) : "New Train Speed" : 0
]

@PointClass base(Targetname) size(-16 -16 -16, 16 16 16) iconsprite("sprites/CS/player_weaponstrip.spr") = player_weaponstrip : "Strips player's weapons" []
@PointClass base(Targetname) size(-16 -16 -16, 16 16 16) iconsprite("sprites/CS/player_weaponstrip.spr") = player_weaponstrip : "Strips player's weapons"
[
primary(choices) : "Ignore primary weapons" : 0 =
[
0 : "No"
1 : "Yes"
]
secondary(choices) : "Ignore pistols" : 0 =
[
0 : "No"
1 : "Yes"
]
knife(choices) : "Ignore knife" : 0 =
[
0 : "No"
1 : "Yes"
]
grenade(choices) : "Ignore grenades" : 0 =
[
0 : "No"
1 : "Yes"
]
bomb(choices) : "Ignore bomb" : 0 =
[
0 : "No"
1 : "Yes"
]
items(choices) : "Ignore other items (shield, defuser, kevlar etc)" : 0 =
[
0 : "No"
1 : "Yes"
]
special(string) : "Special item to strip"
]

// Monsters
@PointClass iconsprite("sprites/CS/hostage_entity.spr") base(PlayerClass, RenderFields) size(-16 -16 0, 16 16 72) = monster_scientist : "Scientist Hostage"
Expand Down