Bugfix: to obtain hp more than expected by using drown-restored.

mini-code cleanup
This commit is contained in:
s1lentq 2016-12-09 19:39:16 +07:00
parent 7250ad7d3a
commit dd3e68fb69
3 changed files with 31 additions and 15 deletions

View File

@ -47,7 +47,7 @@ Archive's bin directory contains 2 subdirectories, 'bugfixed' and 'pure'
* Enter '-bots' option at the command line HLDS
## Build instructions
There are several software requirements for building rehlds:
There are several software requirements for building Regamedll_CS:
<ol>
<li>Java Development Kit (JDK) 7+ (http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html)</li>
<li>For Windows: Visual Studio 2013 and later</li>
@ -89,3 +89,7 @@ Compiled binaries will be placed in the build/binaries/ directory
### Credits
Thanks to the project [ReHLDS](https://github.com/dreamstalker/rehlds) ( ReGameDLL_CS was created on the basis of ReHLDS )
## How can I help the project?
Just install it on your game server and report problems you faced
Merge requests are also welcome :simple_smile:

View File

@ -1403,14 +1403,12 @@ bool CHalfLifeMultiplay::TeamExterminationCheck(int NumAliveTerrorist, int NumAl
{
if (NumAliveTerrorist == 0 && NumDeadTerrorist != 0 && NumAliveCT > 0)
{
CBaseEntity *temp = NULL;
CGrenade *pBomb = NULL;
bool nowin = false;
while ((temp = UTIL_FindEntityByClassname(temp, "grenade")))
while ((pBomb = (CGrenade *)UTIL_FindEntityByClassname(pBomb, "grenade")))
{
CGrenade *C4 = static_cast<CGrenade *>(temp);
if (C4->m_bIsC4 && !C4->m_bJustBlew)
if (pBomb->m_bIsC4 && !pBomb->m_bJustBlew)
{
nowin = true;
#ifdef REGAMEDLL_FIXES

View File

@ -1396,6 +1396,12 @@ BOOL EXT_FUNC CBasePlayer::__API_VHOOK(TakeDamage)(entvars_t *pevInflictor, entv
}
}
#ifdef REGAMEDLL_FIXES
if ((bitsDamageType & DMG_DROWN) && pev->waterlevel == 0) {
bitsDamageType &= ~DMG_DROWN;
}
#endif
// Save this so we can report it to the client
m_bitsHUDDamage = -1;
@ -2928,7 +2934,6 @@ void CBasePlayer::WaterMove()
m_rgbTimeBasedDamage[ itbd_DrownRecover ] = 0;
m_bitsDamageType |= DMG_DROWNRECOVER;
m_bitsDamageType &= ~DMG_DROWN;
}
}
else
@ -2950,6 +2955,14 @@ void CBasePlayer::WaterMove()
pev->dmg = 5;
TakeDamage(VARS(eoNullEntity), VARS(eoNullEntity), pev->dmg, DMG_DROWN);
#ifdef REGAMEDLL_FIXES
// NOTE: If we died after the damage of above and was followed respawn,
// so we should get out of code.
if (!(m_bitsDamageType & DMG_DROWN))
return;
#endif
pev->pain_finished = gpGlobals->time + 1;
// track drowning damage, give it back when
@ -5204,7 +5217,7 @@ void EXT_FUNC CBasePlayer::__API_VHOOK(Spawn)()
pev->flags &= FL_PROXY;
pev->flags |= FL_CLIENT;
pev->air_finished = gpGlobals->time + 12;
pev->air_finished = gpGlobals->time + AIRTIME;
pev->dmg = 2;
pev->effects = 0;
pev->deadflag = DEAD_NO;
@ -5958,12 +5971,13 @@ CBaseEntity *CBasePlayer::GiveNamedItemEx(const char *pszName)
return (CBaseEntity *)GET_PRIVATE(pent);
}
CBaseEntity *FindEntityForward(CBaseEntity *pMe)
CBaseEntity *FindEntityForward(CBaseEntity *pEntity)
{
TraceResult tr;
Vector vecStart(pEntity->pev->origin + pEntity->pev->view_ofs);
UTIL_MakeVectors(pMe->pev->v_angle);
UTIL_TraceLine(pMe->pev->origin + pMe->pev->view_ofs, pMe->pev->origin + pMe->pev->view_ofs + gpGlobals->v_forward * 8192, dont_ignore_monsters, pMe->edict(), &tr);
UTIL_MakeVectors(pEntity->pev->v_angle);
UTIL_TraceLine(vecStart, vecStart + gpGlobals->v_forward * 8192, dont_ignore_monsters, pEntity->edict(), &tr);
if (tr.flFraction != 1.0f && !FNullEnt(tr.pHit))
{