Skip to content

Commit

Permalink
Merge branch 's1lentq:master' into personnal_v1
Browse files Browse the repository at this point in the history
  • Loading branch information
StevenKal authored Oct 11, 2022
2 parents adf793e + d8702df commit 6f73d3b
Show file tree
Hide file tree
Showing 9 changed files with 80 additions and 13 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ This means that plugins that do binary code analysis (Orpheu for example) probab
| :---------------------------------- | :---------------------------------------------- |
| game version | Will show GameDLL build version, date & URL. |
| endround | Args:<br/>`T` force round end with Terrorists win. <br/>`CT` force round end with Counter-Terrorists win. <br/> or terminate round draw when called without arguments. |
| swapteams | Swap the teams and restart the game. |
| swapteams | Swap the teams and restart the game (1 sec delay to restart by default).<br/> Args: <br/>`0` - swap teams without restart. <br/> `>0.001` - time delay in seconds to restart the round after swap. |
| give | Give weapon command.<br/> Args:<br/><weapon_name><br/>Usage:<br/>`give weapon_ak47`<br/>`give weapon_usp`<br/><br/>NOTE: `sv_cheats 1` required. |
| impulse 255 | Give all weapons.<br/><br/>NOTE: `sv_cheats 1` required. |

Expand Down Expand Up @@ -104,6 +104,7 @@ This means that plugins that do binary code analysis (Orpheu for example) probab
| sv_autobunnyhopping | 0 | 0 | 1 | Players automatically re-jump while holding jump button.<br/>`0` disabled <br/>`1` enabled |
| sv_enablebunnyhopping | 0 | 0 | 1 | Allow player speed to exceed maximum running speed.<br/>`0` disabled <br/>`1` enabled |
| mp_plant_c4_anywhere | 0 | 0 | 1 | When set, players can plant anywhere, not only in bombsites.<br/>`0` disabled <br/>`1` enabled |
| mp_give_c4_frags | 3 | - | - | How many bonuses (frags) will get the player who defused or exploded the bomb. |
</details>

## How to install zBot for CS 1.6?
Expand Down
6 changes: 6 additions & 0 deletions dist/game.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -483,3 +483,9 @@ sv_enablebunnyhopping 0
//
// Default value: "0"
mp_plant_c4_anywhere 0
// How many bonuses (frags) will get the player who defused or exploded the bomb.
// 3 - (default behaviour)
//
// Default value: "3"
mp_give_c4_frags 3
14 changes: 13 additions & 1 deletion regamedll/dlls/game.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@ cvar_t allchat = { "sv_allchat", "0", 0, 0.0f, nullptr
cvar_t sv_autobunnyhopping = { "sv_autobunnyhopping", "0", 0, 0.0f, nullptr };
cvar_t sv_enablebunnyhopping = { "sv_enablebunnyhopping", "0", 0, 0.0f, nullptr };
cvar_t plant_c4_anywhere = { "mp_plant_c4_anywhere", "0", 0, 0.0f, nullptr };
cvar_t give_c4_frags = { "mp_give_c4_frags", "3", 0, 3.0f, nullptr };

// Note: Just for my plugins & cie.
cvar_t game_version_personnal = { "game_version_personnal", "1.3.0-public-AMXModDev", FCVAR_SERVER, 0.0f, nullptr };
Expand Down Expand Up @@ -202,7 +203,17 @@ void GameDLL_EndRound_f()
void GameDLL_SwapTeams_f()
{
CSGameRules()->SwapAllPlayers();
CVAR_SET_FLOAT("sv_restartround", 1.0);

float value = 1.0f;
if(CMD_ARGC() >= 2)
{
value = Q_atof(CMD_ARGV(1));
}

if (value > 0.0f)
{
CVAR_SET_FLOAT("sv_restartround", value);
}
}

#endif // REGAMEDLL_ADD
Expand Down Expand Up @@ -398,6 +409,7 @@ void EXT_FUNC GameDLLInit()
CVAR_REGISTER(&sv_autobunnyhopping);
CVAR_REGISTER(&sv_enablebunnyhopping);
CVAR_REGISTER(&plant_c4_anywhere);
CVAR_REGISTER(&give_c4_frags);

CVAR_REGISTER(&game_version_personnal);

Expand Down
1 change: 1 addition & 0 deletions regamedll/dlls/game.h
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,7 @@ extern cvar_t allchat;
extern cvar_t sv_autobunnyhopping;
extern cvar_t sv_enablebunnyhopping;
extern cvar_t plant_c4_anywhere;
extern cvar_t give_c4_frags;

extern cvar_t game_version_personnal;

Expand Down
12 changes: 10 additions & 2 deletions regamedll/dlls/ggrenade.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1084,8 +1084,12 @@ void CGrenade::__API_HOOK(DefuseBombEnd)(CBasePlayer *pPlayer, bool bDefused)
CSGameRules()->m_bBombDefused = true;
CSGameRules()->CheckWinConditions();

// give the defuser credit for defusing the bomb
m_pBombDefuser->pev->frags += 3.0f;
#ifdef REGAMEDLL_ADD
m_pBombDefuser->pev->frags += (int)give_c4_frags.value;
#else
// give the defuser credit for defusing the bomb
m_pBombDefuser->pev->frags += 3.0f;
#endif

MESSAGE_BEGIN(MSG_ALL, gmsgBombPickup);
MESSAGE_END();
Expand Down Expand Up @@ -1435,7 +1439,11 @@ void CGrenade::C4Think()
CBasePlayer *pBombOwner = CBasePlayer::Instance(pev->owner);
if (pBombOwner)
{
#ifdef REGAMEDLL_ADD
pBombOwner->pev->frags += (int)give_c4_frags.value;
#else
pBombOwner->pev->frags += 3.0f;
#endif
}

MESSAGE_BEGIN(MSG_ALL, gmsgBombPickup);
Expand Down
2 changes: 2 additions & 0 deletions regamedll/dlls/items.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -536,6 +536,8 @@ BOOL CItemThighPack::MyTouch(CBasePlayer *pPlayer)
MESSAGE_END();

pPlayer->SendItemStatus();
pPlayer->SetScoreboardAttributes();

EMIT_SOUND(pPlayer->edict(), CHAN_VOICE, "items/kevlar.wav", VOL_NORM, ATTN_NORM);

if (TheTutor && g_bItemCreatedByBuying)
Expand Down
39 changes: 34 additions & 5 deletions regamedll/dlls/triggers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1712,6 +1712,10 @@ void CTriggerPush::Touch(CBaseEntity *pOther)
}
}

#define SF_TELEPORT_KEEP_ANGLES 256
#define SF_TELEPORT_KEEP_VELOCITY 512
#define SF_TELEPORT_REDIRECT_VELOCITY_WITH_YAW_DESTINATION 1024

void CBaseTrigger::TeleportTouch(CBaseEntity *pOther)
{
entvars_t *pevToucher = pOther->pev;
Expand Down Expand Up @@ -1766,15 +1770,40 @@ void CBaseTrigger::TeleportTouch(CBaseEntity *pOther)

UTIL_SetOrigin(pevToucher, tmp);

pevToucher->angles = pentTarget->v.angles;
#ifdef REGAMEDLL_ADD
if (!(pev->spawnflags & SF_TELEPORT_KEEP_ANGLES))
#endif
{
pevToucher->angles = pentTarget->v.angles;

if (pOther->IsPlayer())
if (pOther->IsPlayer())
{
pevToucher->v_angle = pentTarget->v.angles;
}

pevToucher->fixangle = 1;
}

#ifdef REGAMEDLL_ADD
if (!(pev->spawnflags & SF_TELEPORT_KEEP_VELOCITY))
#endif
{
pevToucher->v_angle = pentTarget->v.angles;
pevToucher->velocity = pevToucher->basevelocity = g_vecZero;
}

pevToucher->fixangle = 1;
pevToucher->velocity = pevToucher->basevelocity = g_vecZero;
#ifdef REGAMEDLL_ADD
if ((pev->spawnflags & SF_TELEPORT_REDIRECT_VELOCITY_WITH_YAW_DESTINATION) && (pev->spawnflags & SF_TELEPORT_KEEP_VELOCITY))
{
float xy_vel = pevToucher->velocity.Length2D();

Vector vecAngles = Vector(0, pentTarget->v.angles.y, 0);
Vector vecForward;
AngleVectors(vecAngles, vecForward, nullptr, nullptr);

pevToucher->velocity.x = vecForward.x * xy_vel;
pevToucher->velocity.y = vecForward.y * xy_vel;
}
#endif
}

LINK_ENTITY_TO_CLASS(trigger_teleport, CTriggerTeleport, CCSTriggerTeleport)
Expand Down
6 changes: 3 additions & 3 deletions regamedll/dlls/util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1502,10 +1502,10 @@ void UTIL_RestartOther(const char *szClassname)

void UTIL_ResetEntities()
{
edict_t *pEdict = INDEXENT(1);
for (int i = 1; i < gpGlobals->maxEntities; i++, pEdict++)
for (int i = 1; i < gpGlobals->maxEntities; i++)
{
if (pEdict->free)
edict_t *pEdict = INDEXENT(i);
if (!pEdict || pEdict->free)
continue;

CBaseEntity *pEntity = CBaseEntity::Instance(pEdict);
Expand Down
10 changes: 9 additions & 1 deletion regamedll/extra/Toolkit/GameDefinitionFile/regamedll-cs.fgd
Original file line number Diff line number Diff line change
Expand Up @@ -2262,7 +2262,15 @@
]
]

@SolidClass base(Trigger) = trigger_teleport : "Trigger teleport" []
@SolidClass base(Trigger) = trigger_teleport : "Trigger teleport"
[
spawnflags(flags) =
[
256: "Keep angles" : 0
512: "Keep velocity" : 0
1024: "Redirect velocity with yaw from destination" : 0
]
]

// Function entities
@SolidClass = func_bomb_target : "Bomb target zone"
Expand Down

0 comments on commit 6f73d3b

Please sign in to comment.