diff --git a/README.md b/README.md
index ab98f3aaf..7e289f8d8 100644
--- a/README.md
+++ b/README.md
@@ -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:
`T` force round end with Terrorists win.
`CT` force round end with Counter-Terrorists win.
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).
Args:
`0` - swap teams without restart.
`>0.001` - time delay in seconds to restart the round after swap. |
| give | Give weapon command.
Args:
Usage:
`give weapon_ak47`
`give weapon_usp`
NOTE: `sv_cheats 1` required. |
| impulse 255 | Give all weapons.
NOTE: `sv_cheats 1` required. |
@@ -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.
`0` disabled
`1` enabled |
| sv_enablebunnyhopping | 0 | 0 | 1 | Allow player speed to exceed maximum running speed.
`0` disabled
`1` enabled |
| mp_plant_c4_anywhere | 0 | 0 | 1 | When set, players can plant anywhere, not only in bombsites.
`0` disabled
`1` enabled |
+| mp_give_c4_frags | 3 | - | - | How many bonuses (frags) will get the player who defused or exploded the bomb. |
## How to install zBot for CS 1.6?
diff --git a/dist/game.cfg b/dist/game.cfg
index 09766cd04..eb6f511ff 100644
--- a/dist/game.cfg
+++ b/dist/game.cfg
@@ -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
diff --git a/regamedll/dlls/game.cpp b/regamedll/dlls/game.cpp
index 23c418321..9f3a9b496 100644
--- a/regamedll/dlls/game.cpp
+++ b/regamedll/dlls/game.cpp
@@ -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 };
@@ -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
@@ -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);
diff --git a/regamedll/dlls/game.h b/regamedll/dlls/game.h
index 0cf5f063d..cc0c033ba 100644
--- a/regamedll/dlls/game.h
+++ b/regamedll/dlls/game.h
@@ -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;
diff --git a/regamedll/dlls/ggrenade.cpp b/regamedll/dlls/ggrenade.cpp
index 7b8e96846..48c52622c 100644
--- a/regamedll/dlls/ggrenade.cpp
+++ b/regamedll/dlls/ggrenade.cpp
@@ -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();
@@ -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);
diff --git a/regamedll/dlls/items.cpp b/regamedll/dlls/items.cpp
index 9f122830c..f934947eb 100644
--- a/regamedll/dlls/items.cpp
+++ b/regamedll/dlls/items.cpp
@@ -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)
diff --git a/regamedll/dlls/triggers.cpp b/regamedll/dlls/triggers.cpp
index f218f0766..f454806ce 100644
--- a/regamedll/dlls/triggers.cpp
+++ b/regamedll/dlls/triggers.cpp
@@ -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;
@@ -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)
diff --git a/regamedll/dlls/util.cpp b/regamedll/dlls/util.cpp
index 79bd8c7d7..9d4608161 100644
--- a/regamedll/dlls/util.cpp
+++ b/regamedll/dlls/util.cpp
@@ -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);
diff --git a/regamedll/extra/Toolkit/GameDefinitionFile/regamedll-cs.fgd b/regamedll/extra/Toolkit/GameDefinitionFile/regamedll-cs.fgd
index 3953a969d..0e6838732 100644
--- a/regamedll/extra/Toolkit/GameDefinitionFile/regamedll-cs.fgd
+++ b/regamedll/extra/Toolkit/GameDefinitionFile/regamedll-cs.fgd
@@ -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"