diff --git a/regamedll/build.gradle b/regamedll/build.gradle index a8b10582..a91135f1 100644 --- a/regamedll/build.gradle +++ b/regamedll/build.gradle @@ -199,7 +199,7 @@ void setupToolchain(NativeBinarySpec b) if (regamedllFixes) { - cfg.singleDefines 'REGAMEDLL_FIXES', 'REGAMEDLL_CHECKS' + cfg.singleDefines 'REGAMEDLL_FIXES', 'REGAMEDLL_CHECKS', 'REGAMEDLL_ADD' } ToolchainConfigUtils.apply(project, cfg, b) diff --git a/regamedll/dlls/client.cpp b/regamedll/dlls/client.cpp index 7a9bf49e..52b6ed1d 100644 --- a/regamedll/dlls/client.cpp +++ b/regamedll/dlls/client.cpp @@ -489,10 +489,21 @@ void CheckStartMoney(void) { int money = (int)startmoney.value; +#ifndef REGAMEDLL_ADD if (money > 16000) CVAR_SET_FLOAT("mp_startmoney", 16000); else if (money < 800) CVAR_SET_FLOAT("mp_startmoney", 800); +#else + int max_money = (int)maxmoney.value; + int min_money = (int)minmoney.value; + + if (money > max_money) + CVAR_SET_FLOAT("mp_startmoney", max_money); + else if (money < min_money) + CVAR_SET_FLOAT("mp_startmoney", min_money); +#endif // REGAMEDLL_ADD + } /* <4c084> ../cstrike/dlls/client.cpp:661 */ @@ -3322,6 +3333,7 @@ void EXT_FUNC ClientCommand(edict_t *pEntity) player->BuildRebuyStruct(); } + break; } case VGUI_MenuSlot_Buy_Item: { diff --git a/regamedll/dlls/game.cpp b/regamedll/dlls/game.cpp index 823f1eb7..3075ccf4 100644 --- a/regamedll/dlls/game.cpp +++ b/regamedll/dlls/game.cpp @@ -403,6 +403,14 @@ cvar_t sk_scientist_heal3; #endif // HOOK_GAMEDLL +#ifdef REGAMEDLL_ADD + +cvar_t maxmoney = { "mp_maxmoney", "16000", FCVAR_SERVER, 0.0f, NULL }; +cvar_t minmoney = { "mp_minmoney", "800", FCVAR_SERVER, 0.0f, NULL }; +cvar_t round_infinite = { "mp_round_infinite", "0", FCVAR_SERVER, 0.0f, NULL }; + +#endif // REGAMEDLL_ADD + /* <9c900> ../cstrike/dlls/game.cpp:500 */ void EXT_FUNC GameDLLInit(void) { @@ -493,6 +501,14 @@ void EXT_FUNC GameDLLInit(void) CVAR_REGISTER(&sk_scientist_heal2); CVAR_REGISTER(&sk_scientist_heal3); +#ifdef REGAMEDLL_ADD + + CVAR_REGISTER(&maxmoney); + CVAR_REGISTER(&minmoney); + CVAR_REGISTER(&round_infinite); + +#endif // REGAMEDLL_ADD + Bot_RegisterCvars(); Tutor_RegisterCVars(); Hostage_RegisterCVars(); diff --git a/regamedll/dlls/game.h b/regamedll/dlls/game.h index 04985a11..4b172dfe 100644 --- a/regamedll/dlls/game.h +++ b/regamedll/dlls/game.h @@ -221,6 +221,14 @@ extern cvar_t sk_scientist_heal1; extern cvar_t sk_scientist_heal2; extern cvar_t sk_scientist_heal3; +#ifdef REGAMEDLL_ADD + +extern cvar_t maxmoney; +extern cvar_t minmoney; +extern cvar_t round_infinite; + +#endif // REGAMEDLL_ADD + void GameDLLInit(void); #endif // GAME_H diff --git a/regamedll/dlls/multiplay_gamerules.cpp b/regamedll/dlls/multiplay_gamerules.cpp index c4fe0c54..d3ca081c 100644 --- a/regamedll/dlls/multiplay_gamerules.cpp +++ b/regamedll/dlls/multiplay_gamerules.cpp @@ -374,6 +374,7 @@ void ReadMultiplayCvars(CHalfLifeMultiplay *mp) mp->m_iIntroRoundTime = (int)CVAR_GET_FLOAT("mp_freezetime"); mp->m_iLimitTeams = (int)CVAR_GET_FLOAT("mp_limitteams"); +#ifndef REGAMEDLL_ADD if (mp->m_iRoundTime > 540) { CVAR_SET_FLOAT("mp_roundtime", 9); @@ -384,6 +385,20 @@ void ReadMultiplayCvars(CHalfLifeMultiplay *mp) CVAR_SET_FLOAT("mp_roundtime", 1); mp->m_iRoundTime = 60; } +#else + // a limit of 500 minutes because + // if you do more minutes would be a bug in the HUD RoundTime in the form 00:00 + if (mp->m_iRoundTime > 30000) + { + CVAR_SET_FLOAT("mp_roundtime", 500); + mp->m_iRoundTime = 30000; + } + else if (mp->m_iRoundTime < 0) + { + CVAR_SET_FLOAT("mp_roundtime", 0); + mp->m_iRoundTime = 0; + } +#endif // REGAMEDLL_ADD if (mp->m_iIntroRoundTime > 60) { @@ -1021,6 +1036,11 @@ void CHalfLifeMultiplay::QueueCareerRoundEndMenu(float tmDelay, int iWinStatus) /* <117750> ../cstrike/dlls/multiplay_gamerules.cpp:1084 */ void CHalfLifeMultiplay::__MAKE_VHOOK(CheckWinConditions)(void) { +#ifdef REGAMEDLL_ADD + if (round_infinite.string[0] == '1') + return; +#endif // REGAMEDLL_ADD + // If a winner has already been determined and game of started.. then get the heck out of here if (m_bFirstConnected && m_iRoundWinStatus != 0) { @@ -2817,6 +2837,11 @@ void CHalfLifeMultiplay::CheckFreezePeriodExpired(void) void CHalfLifeMultiplay::CheckRoundTimeExpired(void) { +#ifdef REGAMEDLL_ADD + if (round_infinite.string[0] == '1') + return; +#endif // REGAMEDLL_ADD + if (!HasRoundTimeExpired()) return; @@ -3672,8 +3697,14 @@ void CHalfLifeMultiplay::__MAKE_VHOOK(PlayerKilled)(CBasePlayer *pVictim, entvar { // if a player dies in a deathmatch game and the killer is a client, award the killer some points CBasePlayer *killer = GetClassPtr((CBasePlayer *)pKiller); + bool killedByFFA = false; - if (killer->m_iTeam == pVictim->m_iTeam) +#ifdef REGAMEDLL_ADD + if (friendlyfire.string[0] == '2') + killedByFFA = true; +#endif // REGAMEDLL_ADD + + if (killer->m_iTeam == pVictim->m_iTeam && !killedByFFA) { // if a player dies by from teammate pKiller->frags -= IPointsForKill(peKiller, pVictim); diff --git a/regamedll/dlls/player.cpp b/regamedll/dlls/player.cpp index 9a1dec6f..c030d08a 100644 --- a/regamedll/dlls/player.cpp +++ b/regamedll/dlls/player.cpp @@ -901,81 +901,81 @@ void CBasePlayer::__MAKE_VHOOK(TraceAttack)(entvars_t *pevAttacker, float flDama { switch (ptr->iHitgroup) { - case HITGROUP_GENERIC: - break; + case HITGROUP_GENERIC: + break; - case HITGROUP_HEAD: + case HITGROUP_HEAD: + { + if (m_iKevlar == ARMOR_TYPE_HELMET) { - if (m_iKevlar == ARMOR_TYPE_HELMET) - { - bShouldBleed = false; - bShouldSpark = true; - } - - flDamage *= 4; - if (bShouldBleed) - { - pev->punchangle.x = flDamage * -0.5; - - if (pev->punchangle.x < -12) - pev->punchangle.x = -12; - - pev->punchangle.z = flDamage * RANDOM_FLOAT(-1, 1); - - if (pev->punchangle.z < -9) - pev->punchangle.z = -9; - - else if (pev->punchangle.z > 9) - pev->punchangle.z = 9; - } - break; + bShouldBleed = false; + bShouldSpark = true; } - case HITGROUP_CHEST: + + flDamage *= 4; + if (bShouldBleed) { - flDamage *= 1; + pev->punchangle.x = flDamage * -0.5; - if (m_iKevlar != ARMOR_TYPE_EMPTY) - bShouldBleed = false; + if (pev->punchangle.x < -12) + pev->punchangle.x = -12; - else if (bShouldBleed) - { - pev->punchangle.x = flDamage * -0.1; + pev->punchangle.z = flDamage * RANDOM_FLOAT(-1, 1); - if (pev->punchangle.x < -4) - pev->punchangle.x = -4; - } - break; + if (pev->punchangle.z < -9) + pev->punchangle.z = -9; + + else if (pev->punchangle.z > 9) + pev->punchangle.z = 9; } - case HITGROUP_STOMACH: + break; + } + case HITGROUP_CHEST: + { + flDamage *= 1; + + if (m_iKevlar != ARMOR_TYPE_EMPTY) + bShouldBleed = false; + + else if (bShouldBleed) { - flDamage *= 1.25; + pev->punchangle.x = flDamage * -0.1; - if (m_iKevlar != ARMOR_TYPE_EMPTY) - bShouldBleed = false; - - else if (bShouldBleed) - { - pev->punchangle.x = flDamage * -0.1; - - if (pev->punchangle.x < -4) - pev->punchangle.x = -4; - } - break; + if (pev->punchangle.x < -4) + pev->punchangle.x = -4; } - case HITGROUP_LEFTARM: - case HITGROUP_RIGHTARM: + break; + } + case HITGROUP_STOMACH: + { + flDamage *= 1.25; + + if (m_iKevlar != ARMOR_TYPE_EMPTY) + bShouldBleed = false; + + else if (bShouldBleed) { - if (m_iKevlar != ARMOR_TYPE_EMPTY) - bShouldBleed = false; + pev->punchangle.x = flDamage * -0.1; - break; - } - case HITGROUP_LEFTLEG: - case HITGROUP_RIGHTLEG: - { - flDamage *= 0.75; - break; + if (pev->punchangle.x < -4) + pev->punchangle.x = -4; } + break; + } + case HITGROUP_LEFTARM: + case HITGROUP_RIGHTARM: + { + if (m_iKevlar != ARMOR_TYPE_EMPTY) + bShouldBleed = false; + + break; + } + case HITGROUP_LEFTLEG: + case HITGROUP_RIGHTLEG: + { + flDamage *= 0.75; + break; + } } } @@ -1130,7 +1130,10 @@ int CBasePlayer::__MAKE_VHOOK(TakeDamage)(entvars_t *pevInflictor, entvars_t *pe { if (pGrenade->m_iTeam == m_iTeam) teamAttack = TRUE; - +#ifdef REGAMEDLL_ADD + if (friendlyfire.string[0] == '2') + teamAttack = FALSE; +#endif // REGAMEDLL_ADD pAttack = reinterpret_cast(CBasePlayer::Instance(pevAttacker)); } else if (pGrenade->m_iTeam == m_iTeam && (&edict()->v != pevAttacker)) @@ -1288,7 +1291,13 @@ int CBasePlayer::__MAKE_VHOOK(TakeDamage)(entvars_t *pevInflictor, entvars_t *pe { pAttack = GetClassPtr((CBasePlayer *)pevAttacker); - if (pAttack != this && pAttack->m_iTeam == m_iTeam) + bool bAttackFFA = false; +#ifdef REGAMEDLL_ADD + if (friendlyfire.string[0] == '2') + bAttackFFA = true; +#endif // REGAMEDLL_ADD + + if (pAttack != this && pAttack->m_iTeam == m_iTeam && !bAttackFFA) { // TODO: this->m_flDisplayHistory!! if (!(m_flDisplayHistory & DHF_FRIEND_INJURED)) @@ -1318,7 +1327,7 @@ int CBasePlayer::__MAKE_VHOOK(TakeDamage)(entvars_t *pevInflictor, entvars_t *pe } } - if (pAttack->m_iTeam == m_iTeam) + if (pAttack->m_iTeam == m_iTeam && bAttackFFA) flDamage *= 0.35; iGunType = pAttack->m_pActiveItem->m_iId; @@ -2256,7 +2265,6 @@ void CBasePlayer::__MAKE_VHOOK(Killed)(entvars_t *pevAttacker, int iGib) } m_bIsDefusing = false; - BuyZoneIcon_Clear(this); SetThink(&CBasePlayer::PlayerDeathThink); @@ -3196,12 +3204,24 @@ void CBasePlayer::AddAccount(int amount, bool bTrackChange) { m_iAccount += amount; +#ifndef REGAMEDLL_ADD if (m_iAccount < 0) m_iAccount = 0; else if (m_iAccount > 16000) m_iAccount = 16000; +#else + int mmoney = (int)maxmoney.value; + + if (m_iAccount < 0) + m_iAccount = 0; + + else if (m_iAccount > mmoney) + m_iAccount = mmoney; + +#endif // REGAMEDLL_ADD + // Send money update to HUD MESSAGE_BEGIN(MSG_ONE, gmsgMoney, NULL, pev); WRITE_LONG(m_iAccount);