Added reversed weapon_knife.

Update README.md
Cleanup.
This commit is contained in:
s1lentq 2015-09-27 19:59:44 +06:00
parent 625ef14d46
commit 8508f2d517
18 changed files with 729 additions and 259 deletions

View File

@ -1,5 +1,5 @@
# ReGameDLL_CS
Reverse-engineered gamedll (mp.dll / Counter-Strike 1.6)
Reverse-engineered gamedll (mp.dll / Counter-Strike)
## What is this?
Regamedll_CS is a result of reverse engineering of original library mods HLDS (build 6153beta) using DWARF debug info embedded into linux version of HLDS, cs.so

View File

@ -337,7 +337,7 @@ model {
task buildRelease {
dependsOn binaries.withType(SharedLibraryBinarySpec).matching { SharedLibraryBinarySpec blib ->
blib.buildable && (/*blib.buildType.name == 'release' || */blib.buildType.name == 'debug') && !blib.name.contains('RegamedllFixes')
blib.buildable && (blib.buildType.name == 'release' /*|| blib.buildType.name == 'debug'*/) && !blib.name.contains('RegamedllFixes')
}
}

View File

@ -32,7 +32,7 @@ const TaskInfo taskInfo[] =
{ NULL, EVENT_INVALID, &CCareerTask::NewTask }
};
#else // HOOK_GAMEDLL
#else
CCareerTaskManager *TheCareerTasks;
const TaskInfo taskInfo[21];

View File

@ -109,6 +109,7 @@ int CaseInsensitiveHash(const char *string, int iBounds)
hash = *string + 2 * hash + ' ';
string++;
}
return (hash % iBounds);
}
@ -116,9 +117,7 @@ int CaseInsensitiveHash(const char *string, int iBounds)
void EmptyEntityHashTable(void)
{
int i;
hash_item_t *item;
hash_item_t *temp;
hash_item_t *free;
hash_item_t *item, *temp, *free;
for (i = 0; i < stringsHashTable.Count(); i++)
{
@ -143,12 +142,8 @@ void EmptyEntityHashTable(void)
void AddEntityHashValue(entvars_t *pev, const char *value, hash_types_e fieldType)
{
int count;
hash_item_t *item;
hash_item_t *next;
hash_item_t *temp;
hash_item_t *newp;
int hash;
int pevIndex;
hash_item_t *item, *next, *temp, *newp;
int hash, pevIndex;
entvars_t *pevtemp;
if (fieldType != CLASSNAME)
@ -164,7 +159,7 @@ void AddEntityHashValue(entvars_t *pev, const char *value, hash_types_e fieldTyp
while (item->pev)
{
if (!strcmp(STRING(item->pev->classname), STRING(pev->classname)))
if (!Q_strcmp(STRING(item->pev->classname), STRING(pev->classname)))
break;
hash = (hash + 1) % count;
@ -238,7 +233,7 @@ void RemoveEntityHashValue(entvars_t *pev, const char *value, hash_types_e field
while (item->pev)
{
if (!strcmp(STRING(item->pev->classname), STRING(pev->classname)))
if (!Q_strcmp(STRING(item->pev->classname), STRING(pev->classname)))
break;
hash = (hash + 1) % count;
@ -308,16 +303,21 @@ void printEntities(void)
edict_t *CREATE_NAMED_ENTITY(string_t iClass)
{
edict_t *named = g_engfuncs.pfnCreateNamedEntity(iClass);
if (named)
if (named != NULL)
{
AddEntityHashValue(&named->v, STRING(iClass), CLASSNAME);
}
return named;
}
/* <31249> ../cstrike/dlls/cbase.cpp:366 */
void REMOVE_ENTITY(edict_t *e)
{
if (e)
if (e != NULL)
{
(*g_engfuncs.pfnRemoveEntity)(e);
}
}
/* <30158> ../cstrike/dlls/cbase.cpp:375 */
@ -425,6 +425,7 @@ extern "C" C_EXPORT int GetNewDLLFunctions(NEW_DLL_FUNCTIONS *pFunctionTable, in
*interfaceVersion = NEW_DLL_FUNCTIONS_VERSION;
return 0;
}
Q_memcpy(pFunctionTable, &gNewDLLFunctions, sizeof(NEW_DLL_FUNCTIONS));
return 1;
}
@ -446,7 +447,7 @@ int DispatchSpawn(edict_t *pent)
// that would touch too much code for me to do that right now.
pEntity = (CBaseEntity *)GET_PRIVATE(pent);
if (pEntity)
if (pEntity != NULL)
{
if (g_pGameRules && !g_pGameRules->IsAllowedToSpawn(pEntity))
{
@ -461,7 +462,7 @@ int DispatchSpawn(edict_t *pent)
}
// Handle global stuff here
if (pEntity && pEntity->pev->globalname)
if (pEntity != NULL && pEntity->pev->globalname)
{
const globalentity_t *pGlobal = gGlobalState.EntityFromTable(pEntity->pev->globalname);
@ -551,6 +552,7 @@ void DispatchThink(edict_t *pent)
{
ALERT(at_error, "Dormant entity %s is thinking!!\n", STRING(pEntity->pev->classname));
}
pEntity->Think();
}
}
@ -799,7 +801,7 @@ EHANDLE::operator CBaseEntity *(void)
/* <31b30> ../cstrike/dlls/cbase.cpp:829 */
CBaseEntity *EHANDLE::operator=(CBaseEntity *pEntity)
{
if (pEntity)
if (pEntity != NULL)
{
m_pent = ENT(pEntity->pev);
if (m_pent)
@ -810,6 +812,7 @@ CBaseEntity *EHANDLE::operator=(CBaseEntity *pEntity)
m_pent = NULL;
m_serialnumber = 0;
}
return pEntity;
}
@ -837,7 +840,9 @@ int CBaseEntity::__MAKE_VHOOK(TakeHealth)(float flHealth, int bitsDamageType)
pev->health += flHealth;
if (pev->health > pev->max_health)
{
pev->health = pev->max_health;
}
return 1;
}

View File

@ -7069,6 +7069,7 @@ Vector CBasePlayer::__MAKE_VHOOK(GetAutoaimVector)(float flDelta)
m_lasty = m_vecAutoAim.y;
}
}
UTIL_MakeVectors(pev->v_angle + pev->punchangle + m_vecAutoAim);
return gpGlobals->v_forward;
}

View File

@ -730,7 +730,7 @@ public:
BOOL ShouldDoLargeFlinch(int nHitGroup, int nGunType);
void SetPrefsFromUserinfo(char *infobuffer);
void SendWeatherInfo(void);
void UpdateShieldCrosshair(bool);
void UpdateShieldCrosshair(bool draw);
bool HasShield(void);
bool IsProtectedByShield(void)
{

View File

@ -1114,15 +1114,15 @@ public:
class CKnife: public CBasePlayerWeapon
{
public:
NOBODY virtual void Spawn(void);
NOBODY virtual void Precache(void);
NOBODY virtual int GetItemInfo(ItemInfo *p);
virtual void Spawn(void);
virtual void Precache(void);
virtual int GetItemInfo(ItemInfo *p);
virtual BOOL CanDrop(void)
{
return FALSE;
}
NOBODY virtual BOOL Deploy(void);
NOBODY virtual void Holster(int skiplocal);
virtual BOOL Deploy(void);
virtual void Holster(int skiplocal);
virtual float GetMaxSpeed(void)
{
return m_fMaxSpeed;
@ -1131,27 +1131,45 @@ public:
{
return KNIFE_SLOT;
}
NOBODY virtual void PrimaryAttack(void);
NOBODY virtual void SecondaryAttack(void);
virtual void PrimaryAttack(void);
virtual void SecondaryAttack(void);
virtual BOOL UseDecrement(void)
{
return TRUE;
}
NOBODY virtual void WeaponIdle(void);
virtual void WeaponIdle(void);
#ifdef HOOK_GAMEDLL
void Spawn_(void);
void Precache_(void);
int GetItemInfo_(ItemInfo *p);
BOOL Deploy_(void);
void Holster_(int skiplocal);
void PrimaryAttack_(void);
void SecondaryAttack_(void);
void WeaponIdle_(void);
#endif // HOOK_GAMEDLL
public:
NOBODY void EXPORT SwingAgain(void);
NOBODY void EXPORT Smack(void);
void EXPORT SwingAgain(void);
void EXPORT Smack(void);
public:
NOBODY void WeaponAnimation(int iAnimation);
NOBODY int Stab(int fFirst);
NOBODY int Swing(int fFirst);
NOXREF void WeaponAnimation(int iAnimation);
int Stab(int fFirst);
int Swing(int fFirst);
public:
NOBODY virtual bool ShieldSecondaryFire(int iUpAnim,int iDownAnim);
NOBODY virtual void SetPlayerShieldAnim(void);
NOBODY virtual void ResetPlayerShieldAnim(void);
virtual bool ShieldSecondaryFire(int iUpAnim,int iDownAnim);
virtual void SetPlayerShieldAnim(void);
virtual void ResetPlayerShieldAnim(void);
public:
TraceResult m_trHit;
unsigned short m_usKnife;
};/* size: 396, cachelines: 7, members: 3 */
/* <275d5a> ../cstrike/dlls/weapons.h:910 */
@ -1733,7 +1751,7 @@ extern int giAmmoIndex;
extern short g_sModelIndexRadio;
extern MULTIDAMAGE gMultiDamage;
NOBODY void FindHullIntersection(Vector &vecSrc, TraceResult &tr, float *mins, float *maxs, edict_t *pEntity);
void FindHullIntersection(Vector &vecSrc, TraceResult &tr, float *mins, float *maxs, edict_t *pEntity);
void AnnounceFlashInterval(float interval, float offset = 0);
int MaxAmmoCarry(int iszName);

View File

@ -1,176 +1,630 @@
#include "precompiled.h"
#define KNIFE_BODYHIT_VOLUME 128
#define KNIFE_WALLHIT_VOLUME 512
#define KNIFE_MAX_SPEED 250
#define KNIFE_MAX_SPEED_SHIELD 180
enum knife_e
{
KNIFE_IDLE,
KNIFE_ATTACK1HIT,
KNIFE_ATTACK2HIT,
KNIFE_DRAW,
KNIFE_STABHIT,
KNIFE_STABMISS,
KNIFE_MIDATTACK1HIT,
KNIFE_MIDATTACK2HIT
};
enum knife_shield_e
{
KNIFE_SHIELD_IDLE,
KNIFE_SHIELD_SLASH,
KNIFE_SHIELD_ATTACKHIT,
KNIFE_SHIELD_DRAW,
KNIFE_SHIELD_UPIDLE,
KNIFE_SHIELD_UP,
KNIFE_SHIELD_DOWN
};
/* <270ca6> ../cstrike/dlls/wpn_shared/wpn_knife.cpp:28 */
LINK_ENTITY_TO_CLASS(weapon_knife, CKnife);
/* <270586> ../cstrike/dlls/wpn_shared/wpn_knife.cpp:53 */
NOBODY void CKnife::Spawn(void)
void CKnife::__MAKE_VHOOK(Spawn)(void)
{
Precache();
m_iId = WEAPON_KNIFE;
SET_MODEL(edict(), "models/w_knife.mdl");
m_iWeaponState &= ~WPNSTATE_SHIELD_DRAWN;
m_iClip = WEAPON_NOCLIP;
FallInit();
}
/* <2704d2> ../cstrike/dlls/wpn_shared/wpn_knife.cpp:66 */
NOBODY void CKnife::Precache(void)
void CKnife::__MAKE_VHOOK(Precache)(void)
{
PRECACHE_MODEL("models/v_knife.mdl");
PRECACHE_MODEL("models/shield/v_shield_knife.mdl");
PRECACHE_MODEL("models/w_knife.mdl");
PRECACHE_SOUND("weapons/knife_deploy1.wav");
PRECACHE_SOUND("weapons/knife_hit1.wav");
PRECACHE_SOUND("weapons/knife_hit2.wav");
PRECACHE_SOUND("weapons/knife_hit3.wav");
PRECACHE_SOUND("weapons/knife_hit4.wav");
PRECACHE_SOUND("weapons/knife_slash1.wav");
PRECACHE_SOUND("weapons/knife_slash2.wav");
PRECACHE_SOUND("weapons/knife_stab.wav");
PRECACHE_SOUND("weapons/knife_hitwall1.wav");
m_usKnife = PRECACHE_EVENT(1, "events/knife.sc");
}
/* <2704f9> ../cstrike/dlls/wpn_shared/wpn_knife.cpp:85 */
NOBODY int CKnife::GetItemInfo(ItemInfo *p)
int CKnife::__MAKE_VHOOK(GetItemInfo)(ItemInfo *p)
{
p->pszName = STRING(pev->classname);
p->pszAmmo1 = NULL;
p->iMaxAmmo1 = -1;
p->pszAmmo2 = NULL;
p->iMaxAmmo2 = -1;
p->iMaxClip = WEAPON_NOCLIP;
p->iSlot = 2;
p->iPosition = 1;
p->iId = WEAPON_KNIFE;
//p->iFlags = 0;
p->iWeight = KNIFE_WEIGHT;
return 1;
}
/* <2707c0> ../cstrike/dlls/wpn_shared/wpn_knife.cpp:102 */
NOBODY BOOL CKnife::Deploy(void)
BOOL CKnife::__MAKE_VHOOK(Deploy)(void)
{
// EMIT_SOUND(edict_t *entity,
// int channel,
// const char *sample,
// float volume,
// float attenuation); // 104
EMIT_SOUND(m_pPlayer->edict(), CHAN_ITEM, "weapons/knife_deploy1.wav", 0.3, 2.4);
m_iSwing = 0;
m_fMaxSpeed = KNIFE_MAX_SPEED;
m_iWeaponState &= ~WPNSTATE_SHIELD_DRAWN;
m_pPlayer->m_bShieldDrawn = false;
if (m_pPlayer->HasShield())
{
return DefaultDeploy("models/shield/v_shield_knife.mdl", "models/shield/p_shield_knife.mdl", KNIFE_SHIELD_DRAW, "shieldknife", UseDecrement() != FALSE);
}
else
return DefaultDeploy("models/v_knife.mdl", "models/p_knife.mdl", KNIFE_DRAW, "knife", UseDecrement() != FALSE);
}
/* <27052b> ../cstrike/dlls/wpn_shared/wpn_knife.cpp:119 */
NOBODY void CKnife::Holster(int skiplocal)
void CKnife::__MAKE_VHOOK(Holster)(int skiplocal)
{
m_pPlayer->m_flNextAttack = WEAPON_TIMEBASED + 0.5;
}
/* <270d70> ../cstrike/dlls/wpn_shared/wpn_knife.cpp:124 */
NOBODY void CKnife::WeaponAnimation(int iAnimation)
NOXREF void CKnife::WeaponAnimation(int iAnimation)
{
// {
// int flag; // 126
// edict(CBaseEntity *const this); // 133
// }
int flag;
#ifdef CLIENT_WEAPONS
flag = FEV_NOTHOST;
#else
flag = 0;
#endif // CLIENT_WEAPONS
PLAYBACK_EVENT_FULL
(
flag,
m_pPlayer->edict(),
m_usKnife,
0,
(float *)&g_vecZero,
(float*)&g_vecZero,
0,
0,
iAnimation,
2, // param noxref
3, // param noxref
4 // param noxref
);
}
/* <26f852> ../cstrike/dlls/wpn_shared/wpn_knife.cpp:140 */
NOBODY void FindHullIntersection(Vector &vecSrc, TraceResult &tr, float *mins, float *maxs, edict_t *pEntity)
void FindHullIntersection(Vector &vecSrc, TraceResult &tr, float *mins, float *maxs, edict_t *pEntity)
{
// {
// int i; // 142
// int j; // 142
// int k; // 142
// float distance; // 143
// float *minmaxs; // 144
// TraceResult tmpTrace; // 145
// Vector vecHullEnd; // 146
// Vector vecEnd; // 147
// {
// float thisDistance; // 172
// }
// }
int i, j, k;
float distance = 1000000.0;
float *minmaxs[2] = { mins, maxs };
TraceResult tmpTrace;
Vector vecHullEnd, vecEnd;
vecHullEnd = ((tr.vecEndPos - vecSrc) * 2) + vecSrc;
UTIL_TraceLine(vecSrc, vecHullEnd, dont_ignore_monsters, pEntity, &tmpTrace);
if (tmpTrace.flFraction < 1.0f)
{
tr = tmpTrace;
return;
}
for (i = 0; i < 2; i++)
{
for (j = 0; j < 2; j++)
{
for (k = 0; k < 2; k++)
{
vecEnd.x = vecHullEnd.x + minmaxs[i][0];
vecEnd.y = vecHullEnd.y + minmaxs[j][1];
vecEnd.z = vecHullEnd.z + minmaxs[k][2];
UTIL_TraceLine(vecSrc, vecEnd, dont_ignore_monsters, pEntity, &tmpTrace);
if (tmpTrace.flFraction < 1.0f)
{
float_precision thisDistance = (tmpTrace.vecEndPos - vecSrc).Length();
if (thisDistance < distance)
{
tr = tmpTrace;
distance = thisDistance;
}
}
}
}
}
}
/* <2714ba> ../cstrike/dlls/wpn_shared/wpn_knife.cpp:185 */
NOBODY void CKnife::PrimaryAttack(void)
void CKnife::__MAKE_VHOOK(PrimaryAttack)(void)
{
Swing(TRUE);
}
/* <270f18> ../cstrike/dlls/wpn_shared/wpn_knife.cpp:190 */
NOBODY void CKnife::SetPlayerShieldAnim(void)
void CKnife::SetPlayerShieldAnim(void)
{
if (!m_pPlayer->HasShield())
return;
if (m_iWeaponState & WPNSTATE_SHIELD_DRAWN)
{
Q_strcpy(m_pPlayer->m_szAnimExtention, "shield");
}
else
{
Q_strcpy(m_pPlayer->m_szAnimExtention, "shieldknife");
}
}
/* <270f53> ../cstrike/dlls/wpn_shared/wpn_knife.cpp:201 */
NOBODY void CKnife::ResetPlayerShieldAnim(void)
void CKnife::ResetPlayerShieldAnim(void)
{
if (!m_pPlayer->HasShield())
return;
if (m_iWeaponState & WPNSTATE_SHIELD_DRAWN)
{
Q_strcpy(m_pPlayer->m_szAnimExtention, "shieldknife");
}
}
/* <270f75> ../cstrike/dlls/wpn_shared/wpn_knife.cpp:211 */
NOBODY bool CKnife::ShieldSecondaryFire(int iUpAnim, int iDownAnim)
bool CKnife::ShieldSecondaryFire(int iUpAnim, int iDownAnim)
{
if (!m_pPlayer->HasShield())
{
return false;
}
if (m_iWeaponState & WPNSTATE_SHIELD_DRAWN)
{
m_iWeaponState &= ~WPNSTATE_SHIELD_DRAWN;
SendWeaponAnim(iDownAnim, UseDecrement() != FALSE);
Q_strcpy(m_pPlayer->m_szAnimExtention, "shieldknife");
m_fMaxSpeed = KNIFE_MAX_SPEED;
m_pPlayer->m_bShieldDrawn = false;
}
else
{
m_iWeaponState |= WPNSTATE_SHIELD_DRAWN;
SendWeaponAnim(iUpAnim, UseDecrement() != FALSE);
Q_strcpy(m_pPlayer->m_szAnimExtention, "shielded");
m_fMaxSpeed = KNIFE_MAX_SPEED_SHIELD;
m_pPlayer->m_bShieldDrawn = true;
}
m_pPlayer->UpdateShieldCrosshair((m_iWeaponState & WPNSTATE_SHIELD_DRAWN) == 0);
m_pPlayer->ResetMaxSpeed();
m_flNextPrimaryAttack = GetNextAttackDelay(0.4);
m_flNextSecondaryAttack = WEAPON_TIMEBASED + 0.4;
m_flTimeWeaponIdle = WEAPON_TIMEBASED + 0.6;
return true;
}
/* <270826> ../cstrike/dlls/wpn_shared/wpn_knife.cpp:245 */
NOBODY void CKnife::SecondaryAttack(void)
void CKnife::__MAKE_VHOOK(SecondaryAttack)(void)
{
// ShieldSecondaryFire(CKnife::SecondaryAttack(// int iUpAnim,
// int iDownAnim); // 247
// SecondaryAttack(CKnife *const this); // 245
if (!ShieldSecondaryFire(KNIFE_SHIELD_UP, KNIFE_SHIELD_DOWN))
{
Stab(TRUE);
pev->nextthink = WEAPON_TIMEBASED + 0.35;
}
}
/* <27055f> ../cstrike/dlls/wpn_shared/wpn_knife.cpp:254 */
NOBODY void CKnife::Smack(void)
void CKnife::Smack(void)
{
DecalGunshot(&m_trHit, BULLET_PLAYER_CROWBAR, false, m_pPlayer->pev, false);
}
/* <271493> ../cstrike/dlls/wpn_shared/wpn_knife.cpp:260 */
NOBODY void CKnife::SwingAgain(void)
void CKnife::SwingAgain(void)
{
Swing(FALSE);
}
/* <2705fc> ../cstrike/dlls/wpn_shared/wpn_knife.cpp:265 */
NOBODY void CKnife::WeaponIdle(void)
void CKnife::__MAKE_VHOOK(WeaponIdle)(void)
{
// WeaponIdle(CKnife *const this); // 265
ResetEmptySound();
m_pPlayer->GetAutoaimVector(AUTOAIM_10DEGREES);
if (m_flTimeWeaponIdle > WEAPON_TIMEBASED)
{
return;
}
if (!m_pPlayer->m_bShieldDrawn)
{
m_flTimeWeaponIdle = WEAPON_TIMEBASED + 20.0;
SendWeaponAnim(KNIFE_IDLE, UseDecrement() != FALSE);
}
}
/* <270fa7> ../cstrike/dlls/wpn_shared/wpn_knife.cpp:283 */
NOBODY int CKnife::Swing(int fFirst)
int CKnife::Swing(int fFirst)
{
// {
// int fDidHit; // 285
// TraceResult tr; // 287
// Vector vecSrc; // 290
// Vector vecEnd; // 291
// operator*(const Vector *const this,
// float fl); // 291
// operator+(const Vector *const this,
// const Vector &v); // 291
// {
// class CBaseEntity *pHit; // 302
// Instance(edict_t *pent); // 302
// edict(CBaseEntity *const this); // 304
// Vector(Vector *const this,
// float X,
// float Y,
// float Z); // 304
// Vector(Vector *const this,
// float X,
// float Y,
// float Z); // 304
// }
// {
// float flVol; // 379
// int fHitWorld; // 380
// class CBaseEntity *pEntity; // 385
// Instance(edict_t *pent); // 385
// SetPlayerShieldAnim(CKnife *const this); // 387
// Vector(Vector *const this,
// const Vector &v); // 396
// {
// float fvolbar; // 436
// operator-(const Vector *const this,
// const Vector &v); // 436
// operator*(const Vector *const this,
// float fl); // 436
// operator+(const Vector *const this,
// const Vector &v); // 436
// Vector(Vector *const this,
// const Vector &v); // 436
// }
// ResetPlayerShieldAnim(CKnife *const this); // 461
// Vector(Vector *const this,
// const Vector &v); // 401
// EMIT_SOUND(edict_t *entity,
// int channel,
// const char *sample,
// float volume,
// float attenuation); // 419
// EMIT_SOUND(edict_t *entity,
// int channel,
// const char *sample,
// float volume,
// float attenuation); // 417
// EMIT_SOUND(edict_t *entity,
// int channel,
// const char *sample,
// float volume,
// float attenuation); // 415
// EMIT_SOUND(edict_t *entity,
// int channel,
// const char *sample,
// float volume,
// float attenuation); // 413
// }
// }
int fDidHit = FALSE;
TraceResult tr;
Vector vecSrc, vecEnd;
UTIL_MakeVectors(m_pPlayer->pev->v_angle);
vecSrc = m_pPlayer->GetGunPosition();
vecEnd = vecSrc + gpGlobals->v_forward * 48;
UTIL_TraceLine(vecSrc, vecEnd, dont_ignore_monsters, m_pPlayer->edict(), &tr);
if (tr.flFraction >= 1.0f)
{
UTIL_TraceHull(vecSrc, vecEnd, dont_ignore_monsters, head_hull, m_pPlayer->edict(), &tr);
if (tr.flFraction < 1.0f)
{
CBaseEntity *pHit = CBaseEntity::Instance(tr.pHit);
if (!pHit || pHit->IsBSPModel())
{
FindHullIntersection(vecSrc, tr, VEC_DUCK_HULL_MIN, VEC_DUCK_HULL_MAX, m_pPlayer->edict());
}
vecEnd = tr.vecEndPos;
}
}
if (tr.flFraction >= 1.0f)
{
if (fFirst)
{
if (!m_pPlayer->HasShield())
{
switch (m_iSwing++ % 2)
{
case 0: SendWeaponAnim(KNIFE_MIDATTACK1HIT, UseDecrement() != FALSE); break;
case 1: SendWeaponAnim(KNIFE_MIDATTACK2HIT, UseDecrement() != FALSE); break;
}
m_flNextPrimaryAttack = GetNextAttackDelay(0.35);
m_flNextSecondaryAttack = WEAPON_TIMEBASED + 0.5;
}
else
{
SendWeaponAnim(KNIFE_SHIELD_ATTACKHIT, UseDecrement() != FALSE);
m_flNextPrimaryAttack = GetNextAttackDelay(1.0);
m_flNextSecondaryAttack = WEAPON_TIMEBASED + 1.2;
}
m_flTimeWeaponIdle = WEAPON_TIMEBASED + 2.0;
if (RANDOM_LONG(0, 1))
EMIT_SOUND_DYN(m_pPlayer->edict(), CHAN_WEAPON, "weapons/knife_slash1.wav", VOL_NORM, ATTN_NORM, 0, 94);
else
EMIT_SOUND_DYN(m_pPlayer->edict(), CHAN_WEAPON, "weapons/knife_slash2.wav", VOL_NORM, ATTN_NORM, 0, 94);
m_pPlayer->SetAnimation(PLAYER_ATTACK1);
}
}
else
{
fDidHit = TRUE;
if (!m_pPlayer->HasShield())
{
switch (m_iSwing++ % 2)
{
case 0: SendWeaponAnim(KNIFE_MIDATTACK1HIT, UseDecrement() != FALSE); break;
case 1: SendWeaponAnim(KNIFE_MIDATTACK2HIT, UseDecrement() != FALSE); break;
}
m_flNextPrimaryAttack = GetNextAttackDelay(0.4);
m_flNextSecondaryAttack = WEAPON_TIMEBASED + 0.5;
}
else
{
SendWeaponAnim(KNIFE_SHIELD_ATTACKHIT, UseDecrement() != FALSE);
m_flNextPrimaryAttack = GetNextAttackDelay(1.0);
m_flNextSecondaryAttack = WEAPON_TIMEBASED + 1.2;
}
m_flTimeWeaponIdle = WEAPON_TIMEBASED + 2.0;
CBaseEntity *pEntity = CBaseEntity::Instance(tr.pHit);
SetPlayerShieldAnim();
m_pPlayer->SetAnimation(PLAYER_ATTACK1);
ClearMultiDamage();
if (m_flNextPrimaryAttack + 0.4 < WEAPON_TIMEBASED)
pEntity->TraceAttack(m_pPlayer->pev, 20, gpGlobals->v_forward, &tr, (DMG_NEVERGIB | DMG_BULLET));
else
pEntity->TraceAttack(m_pPlayer->pev, 15, gpGlobals->v_forward, &tr, (DMG_NEVERGIB | DMG_BULLET));
ApplyMultiDamage(m_pPlayer->pev, m_pPlayer->pev);
float flVol = 1;
int fHitWorld = TRUE;
if (pEntity != NULL && pEntity->Classify() != CLASS_NONE && pEntity->Classify() != CLASS_MACHINE)
{
switch (RANDOM_LONG(0, 3))
{
case 0: EMIT_SOUND(m_pPlayer->edict(), CHAN_WEAPON, "weapons/knife_hit1.wav", VOL_NORM, ATTN_NORM); break;
case 1: EMIT_SOUND(m_pPlayer->edict(), CHAN_WEAPON, "weapons/knife_hit2.wav", VOL_NORM, ATTN_NORM); break;
case 2: EMIT_SOUND(m_pPlayer->edict(), CHAN_WEAPON, "weapons/knife_hit3.wav", VOL_NORM, ATTN_NORM); break;
case 3: EMIT_SOUND(m_pPlayer->edict(), CHAN_WEAPON, "weapons/knife_hit4.wav", VOL_NORM, ATTN_NORM); break;
}
m_pPlayer->m_iWeaponVolume = KNIFE_BODYHIT_VOLUME;
if (!pEntity->IsAlive())
{
return TRUE;
}
flVol = 0.1;
fHitWorld = FALSE;
}
if (fHitWorld)
{
TEXTURETYPE_PlaySound(&tr, vecSrc, vecSrc + (vecEnd - vecSrc) * 2, BULLET_PLAYER_CROWBAR);
if (RANDOM_LONG(0, 1) > 1)
{
fHitWorld = FALSE;
}
}
if (!fHitWorld)
{
m_trHit = tr;
SetThink(&CKnife::Smack);
pev->nextthink = 0.2;
m_pPlayer->m_iWeaponVolume = (int)(flVol * KNIFE_WALLHIT_VOLUME);
ResetPlayerShieldAnim();
}
else
{
float fvolbar = RANDOM_LONG(0, 3) + 98;
EMIT_SOUND_DYN(m_pPlayer->edict(), CHAN_ITEM, "weapons/knife_hitwall1.wav", VOL_NORM, ATTN_NORM, 0, fvolbar);
}
}
return fDidHit;
}
/* <2714e1> ../cstrike/dlls/wpn_shared/wpn_knife.cpp:468 */
int CKnife::Stab(int fFirst)
{
int fDidHit = FALSE;
TraceResult tr;
Vector vecSrc, vecEnd;
UTIL_MakeVectors(m_pPlayer->pev->v_angle);
vecSrc = m_pPlayer->GetGunPosition();
vecEnd = vecSrc + gpGlobals->v_forward * 32;
UTIL_TraceLine(vecSrc, vecEnd, dont_ignore_monsters, m_pPlayer->edict(), &tr);
if (tr.flFraction >= 1.0f)
{
UTIL_TraceHull(vecSrc, vecEnd, dont_ignore_monsters, head_hull, m_pPlayer->edict(), &tr);
if (tr.flFraction < 1.0f)
{
CBaseEntity *pHit = CBaseEntity::Instance(tr.pHit);
if (!pHit || pHit->IsBSPModel())
{
FindHullIntersection(vecSrc, tr, VEC_DUCK_HULL_MIN, VEC_DUCK_HULL_MAX, m_pPlayer->edict());
}
vecEnd = tr.vecEndPos;
}
}
if (tr.flFraction >= 1.0f)
{
if (fFirst)
{
SendWeaponAnim(KNIFE_STABMISS, UseDecrement() != FALSE);
m_flNextPrimaryAttack = GetNextAttackDelay(1.0);
m_flNextSecondaryAttack = WEAPON_TIMEBASED + 1.0;
if (RANDOM_LONG(0, 1))
EMIT_SOUND_DYN(m_pPlayer->edict(), CHAN_WEAPON, "weapons/knife_slash1.wav", VOL_NORM, ATTN_NORM, 0, 94);
else
EMIT_SOUND_DYN(m_pPlayer->edict(), CHAN_WEAPON, "weapons/knife_slash2.wav", VOL_NORM, ATTN_NORM, 0, 94);
m_pPlayer->SetAnimation(PLAYER_ATTACK1);
}
}
else
{
fDidHit = TRUE;
SendWeaponAnim(KNIFE_STABHIT, UseDecrement() != FALSE);
m_flNextPrimaryAttack = GetNextAttackDelay(1.1);
m_flNextSecondaryAttack = WEAPON_TIMEBASED + 1.1;
CBaseEntity *pEntity = CBaseEntity::Instance(tr.pHit);
m_pPlayer->SetAnimation(PLAYER_ATTACK1);
float flDamage = 65.0;
if (pEntity && pEntity->IsPlayer())
{
Vector2D vec2LOS;
float flDot;
Vector vMyForward = gpGlobals->v_forward;
UTIL_MakeVectors(pEntity->pev->angles);
vec2LOS = vMyForward.Make2D();
vec2LOS = vec2LOS.Normalize();
flDot = DotProduct(vec2LOS, gpGlobals->v_forward.Make2D());
if (flDot > 0.8)
{
flDamage *= 3.0;
}
}
UTIL_MakeVectors(m_pPlayer->pev->v_angle);
ClearMultiDamage();
pEntity->TraceAttack(m_pPlayer->pev, flDamage, gpGlobals->v_forward, &tr, (DMG_NEVERGIB | DMG_BULLET));
ApplyMultiDamage(m_pPlayer->pev, m_pPlayer->pev);
float flVol = 1.0f;
int fHitWorld = TRUE;
if (pEntity != NULL && pEntity->Classify() != CLASS_NONE && pEntity->Classify() != CLASS_MACHINE)
{
EMIT_SOUND(m_pPlayer->edict(), CHAN_WEAPON, "weapons/knife_stab.wav", VOL_NORM, ATTN_NORM);
m_pPlayer->m_iWeaponVolume = KNIFE_BODYHIT_VOLUME;
if (!pEntity->IsAlive())
{
return TRUE;
}
flVol = 0.1;
fHitWorld = FALSE;
}
if (fHitWorld)
{
TEXTURETYPE_PlaySound(&tr, vecSrc, vecSrc + (vecEnd - vecSrc) * 2, BULLET_PLAYER_CROWBAR);
if (RANDOM_LONG(0, 1) > 1)
{
fHitWorld = FALSE;
}
}
if (!fHitWorld)
{
m_trHit = tr;
m_pPlayer->m_iWeaponVolume = (int)(flVol * KNIFE_WALLHIT_VOLUME);
SetThink(&CKnife::Smack);
pev->nextthink = 0.2;
ResetPlayerShieldAnim();
}
else
{
float fvolbar = RANDOM_LONG(0, 3) + 98;
EMIT_SOUND_DYN(m_pPlayer->edict(), CHAN_ITEM, "weapons/knife_hitwall1.wav", VOL_NORM, ATTN_NORM, 0, fvolbar);
}
}
return fDidHit;
}
#ifdef HOOK_GAMEDLL
void CKnife::Spawn(void)
{
Spawn_();
}
void CKnife::Precache(void)
{
Precache_();
}
int CKnife::GetItemInfo(ItemInfo *p)
{
return GetItemInfo_(p);
}
BOOL CKnife::Deploy(void)
{
return Deploy_();
}
void CKnife::Holster(int skiplocal)
{
Holster_(skiplocal);
}
void CKnife::PrimaryAttack(void)
{
PrimaryAttack_();
}
void CKnife::SecondaryAttack(void)
{
SecondaryAttack_();
}
void CKnife::WeaponIdle(void)
{
WeaponIdle_();
}
#endif // HOOK_GAMEDLL

View File

@ -80,12 +80,10 @@ typedef struct incomingtransfer_s
#ifndef _WIN32
#define _strlwr(p) for (int i = 0; p[i] != 0; i++) p[i] = tolower(p[i]);
#endif
#endif // _WIN32
#ifdef _WIN32
#define printf2 _printf2
#define chatf _print_chat
#endif // _WIN32
#define Q_close _close
#define Q_write _write

View File

@ -34,20 +34,20 @@ NOBODY CBot::CBot(void)
}
/* <48f6ef> ../game_shared/bot/bot.cpp:50 */
bool CBot::Initialize_(const BotProfile *profile)
bool CBot::__MAKE_VHOOK(Initialize)(const BotProfile *profile)
{
m_profile = profile;
return true;
}
/* <48fbbd> ../game_shared/bot/bot.cpp:57 */
NOBODY void CBot::Spawn_(void)
NOBODY void CBot::__MAKE_VHOOK(Spawn)(void)
{
// ResetCommand(CBot *const this); // 80
}
/* <48fa37> ../game_shared/bot/bot.cpp:88 */
NOBODY Vector CBot::GetAutoaimVector_(float flDelta)
NOBODY Vector CBot::__MAKE_VHOOK(GetAutoaimVector)(float flDelta)
{
// operator+(const Vector *const this,
// const Vector &v); // 90
@ -76,31 +76,31 @@ void CBot::BotThink(void)
}
/* <48f723> ../game_shared/bot/bot.cpp:119 */
NOBODY void CBot::MoveForward_(void)
NOBODY void CBot::__MAKE_VHOOK(MoveForward)(void)
{
// GetMoveSpeed(CBot *const this); // 121
}
/* <48f761> ../game_shared/bot/bot.cpp:130 */
NOBODY void CBot::MoveBackward_(void)
NOBODY void CBot::__MAKE_VHOOK(MoveBackward)(void)
{
// GetMoveSpeed(CBot *const this); // 132
}
/* <48f79f> ../game_shared/bot/bot.cpp:140 */
NOBODY void CBot::StrafeLeft_(void)
NOBODY void CBot::__MAKE_VHOOK(StrafeLeft)(void)
{
// GetMoveSpeed(CBot *const this); // 142
}
/* <48f7dd> ../game_shared/bot/bot.cpp:150 */
NOBODY void CBot::StrafeRight_(void)
NOBODY void CBot::__MAKE_VHOOK(StrafeRight)(void)
{
// GetMoveSpeed(CBot *const this); // 152
}
/* <48fe00> ../game_shared/bot/bot.cpp:160 */
NOBODY bool CBot::Jump_(bool mustJump)
NOBODY bool CBot::__MAKE_VHOOK(Jump)(bool mustJump)
{
// {
// float const sanityInterval; // 173
@ -114,7 +114,7 @@ NOBODY bool CBot::Jump_(bool mustJump)
}
/* <48f81b> ../game_shared/bot/bot.cpp:187 */
NOBODY void CBot::ClearMovement_(void)
NOBODY void CBot::__MAKE_VHOOK(ClearMovement)(void)
{
// ResetCommand(CBot *const this); // 189
}
@ -125,32 +125,32 @@ NOBODY bool CBot::IsJumping(void)
}
/* <48f859> ../game_shared/bot/bot.cpp:214 */
NOBODY void CBot::Crouch_(void)
NOBODY void CBot::__MAKE_VHOOK(Crouch)(void)
{
}
/* <48f87f> ../game_shared/bot/bot.cpp:220 */
NOBODY void CBot::StandUp_(void)
NOBODY void CBot::__MAKE_VHOOK(StandUp)(void)
{
}
/* <48f8a5> ../game_shared/bot/bot.cpp:227 */
NOBODY void CBot::UseEnvironment_(void)
NOBODY void CBot::__MAKE_VHOOK(UseEnvironment)(void)
{
}
/* <48f8cb> ../game_shared/bot/bot.cpp:234 */
NOBODY void CBot::PrimaryAttack_(void)
NOBODY void CBot::__MAKE_VHOOK(PrimaryAttack)(void)
{
}
/* <48f8f1> ../game_shared/bot/bot.cpp:240 */
NOBODY void CBot::ClearPrimaryAttack_(void)
NOBODY void CBot::__MAKE_VHOOK(ClearPrimaryAttack)(void)
{
}
/* <48f917> ../game_shared/bot/bot.cpp:246 */
void CBot::TogglePrimaryAttack_(void)
void CBot::__MAKE_VHOOK(TogglePrimaryAttack)(void)
{
if (m_buttonFlags & IN_ATTACK)
m_buttonFlags &= ~IN_ATTACK;
@ -159,12 +159,12 @@ void CBot::TogglePrimaryAttack_(void)
}
/* <48f93d> ../game_shared/bot/bot.cpp:260 */
NOBODY void CBot::SecondaryAttack_(void)
NOBODY void CBot::__MAKE_VHOOK(SecondaryAttack)(void)
{
}
/* <48f963> ../game_shared/bot/bot.cpp:266 */
NOBODY void CBot::Reload_(void)
NOBODY void CBot::__MAKE_VHOOK(Reload)(void)
{
}
@ -204,7 +204,7 @@ bool CBot::IsUsingScope(void) const
}
/* <48f989> ../game_shared/bot/bot.cpp:338 */
void CBot::ExecuteCommand_(void)
void CBot::__MAKE_VHOOK(ExecuteCommand)(void)
{
byte adjustedMSec;

View File

@ -44,12 +44,12 @@ NOBODY CBotManager::CBotManager()
}
/* <49f586> ../game_shared/bot/bot_manager.cpp:78 */
void CBotManager::RestartRound_(void)
void CBotManager::__MAKE_VHOOK(RestartRound)(void)
{
DestroyAllGrenades();
}
void CBotManager::StartFrame_(void)
void CBotManager::__MAKE_VHOOK(StartFrame)(void)
{
// debug smoke grenade visualization
if (cv_bot_debug.value == 5)
@ -130,7 +130,7 @@ const char *CBotManager::GetNavMapFilename(void) const
}
/* <49f17b> ../game_shared/bot/bot_manager.cpp:219 */
void CBotManager::OnEvent_(GameEventType event, CBaseEntity *entity, CBaseEntity *other)
void CBotManager::__MAKE_VHOOK(OnEvent)(GameEventType event, CBaseEntity *entity, CBaseEntity *other)
{
// propogate event to all bots
for (int i = 1; i <= gpGlobals->maxClients; i++)

View File

@ -199,7 +199,7 @@ const char *BotProfileManager::GetCustomSkinFname(int index)
return NULL;
}
return m_skinFilenames[ index - FirstCustomSkin ]; //return m_skinModelnames[ index - FirstCustomSkin ];
return m_skinFilenames[ index - FirstCustomSkin ];
}
/* <4a8053> ../game_shared/bot/bot_profile.cpp:607 */
@ -210,7 +210,7 @@ const char *BotProfileManager::GetCustomSkinModelname(int index)
return NULL;
}
return m_skinModelnames[ index - FirstCustomSkin ]; //return m_skins[ index - FirstCustomSkin ];
return m_skinModelnames[ index - FirstCustomSkin ];
}
/* <4a80db> ../game_shared/bot/bot_profile.cpp:621 */

View File

@ -172,6 +172,7 @@ NOBODY int UTIL_HumansOnTeam(int teamID, bool isAlive)
iCount++;
}
return iCount;
}
@ -198,6 +199,7 @@ NOBODY int UTIL_BotsInGame(void)
iCount++;
}
return iCount;
}
@ -257,6 +259,7 @@ bool UTIL_KickBotFromTeam(TeamName kickTeam)
return true;
}
}
return false;
}
@ -285,6 +288,7 @@ NOBODY bool UTIL_IsTeamAllBots(int team)
++botCount;
}
return (botCount) ? true : false;
}
@ -407,6 +411,7 @@ NOBODY bool UTIL_IsVisibleToTeam(const Vector &spot, int team, float maxRange)
if (result.flFraction == 1.0f)
return true;
}
return false;
}

View File

@ -415,7 +415,7 @@ NOBODY bool CNavArea::IsConnected(const CNavArea *area, NavDirType dir) const
if (dir == NUM_DIRECTIONS)
{
// search all directions
for (int d = 0; d<NUM_DIRECTIONS; ++d)
for (int d = 0; d < NUM_DIRECTIONS; ++d)
{
for (iter = m_connect[ d ].begin(); iter != m_connect[ d ].end(); ++iter)
{
@ -2037,7 +2037,7 @@ public:
if (m_count == 0)
return;
for (int j= i + 1; j < m_count; ++j)
for (int j = i + 1; j < m_count; ++j)
m_hidingSpot[j-1] = m_hidingSpot[j];
--m_count;
@ -3062,7 +3062,9 @@ Place CNavAreaGrid::GetPlace(const Vector *pos) const
CNavArea *area = GetNearestNavArea(pos, true);
if (area)
{
return area->GetPlace();
}
return UNDEFINED_PLACE;
}

View File

@ -43,7 +43,7 @@ size_t mfunc_ptr_cast(MFUNC f)
#ifdef _WIN32
extern const size_t g_BaseOffset = 0x01D00000;
#else
extern const size_t g_BaseOffset = NULL;
extern const size_t g_BaseOffset = 0x00000000;
#endif
//#define Mem_Region
@ -3211,29 +3211,29 @@ FunctionHook g_FunctionHooks[] =
//{ 0x0, "_ZN10CHEGrenade21ResetPlayerShieldAnimEv", mfunc_ptr_cast(&CHEGrenade::ResetPlayerShieldAnim) },
//CKnife
//virtual func
//{ 0x0, "_ZN6CKnife5SpawnEv", mfunc_ptr_cast(&CKnife::Spawn) },
//{ 0x0, "_ZN6CKnife8PrecacheEv", mfunc_ptr_cast(&CKnife::Precache) },
//{ 0x0, "_ZN6CKnife11GetItemInfoEP8ItemInfo", mfunc_ptr_cast(&CKnife::GetItemInfo) },
//{ 0x0, "_ZN6CKnife7CanDropEv", mfunc_ptr_cast(&CKnife::CanDrop) },
//{ 0x0, "_ZN6CKnife6DeployEv", mfunc_ptr_cast(&CKnife::Deploy) },
//{ 0x0, "_ZN6CKnife7HolsterEi", mfunc_ptr_cast(&CKnife::Holster) },
//{ 0x0, "_ZN6CKnife11GetMaxSpeedEv", mfunc_ptr_cast(&CKnife::GetMaxSpeed) },
//{ 0x0, "_ZN6CKnife9iItemSlotEv", mfunc_ptr_cast(&CKnife::iItemSlot) },
//{ 0x0, "_ZN6CKnife13PrimaryAttackEv", mfunc_ptr_cast(&CKnife::PrimaryAttack) },
//{ 0x0, "_ZN6CKnife15SecondaryAttackEv", mfunc_ptr_cast(&CKnife::SecondaryAttack) },
//{ 0x0, "_ZN6CKnife12UseDecrementEv", mfunc_ptr_cast(&CKnife::UseDecrement) },
//{ 0x0, "_ZN6CKnife10WeaponIdleEv", mfunc_ptr_cast(&CKnife::WeaponIdle) },
{ 0x01D08500, "_ZN6CKnife5SpawnEv", mfunc_ptr_cast(&CKnife::Spawn_) },
{ 0x01D08550, "_ZN6CKnife8PrecacheEv", mfunc_ptr_cast(&CKnife::Precache_) },
{ 0x01D085F0, "_ZN6CKnife11GetItemInfoEP8ItemInfo", mfunc_ptr_cast(&CKnife::GetItemInfo_) },
//{ 0x01D09910, "_ZN6CKnife7CanDropEv", mfunc_ptr_cast(&CKnife::CanDrop_) }, // DEFAULT
{ 0x01D08640, "_ZN6CKnife6DeployEv", mfunc_ptr_cast(&CKnife::Deploy_) },
{ 0x01D08710, "_ZN6CKnife7HolsterEi", mfunc_ptr_cast(&CKnife::Holster_) },
//{ 0x01D09900, "_ZN6CKnife11GetMaxSpeedEv", mfunc_ptr_cast(&CKnife::GetMaxSpeed_) }, // DEFAULT
//{ 0x01D098F0, "_ZN6CKnife9iItemSlotEv", mfunc_ptr_cast(&CKnife::iItemSlot_) }, // DEFAULT
{ 0x01D08980, "_ZN6CKnife13PrimaryAttackEv", mfunc_ptr_cast(&CKnife::PrimaryAttack_) },
{ 0x01D08B50, "_ZN6CKnife15SecondaryAttackEv", mfunc_ptr_cast(&CKnife::SecondaryAttack_) },
//{ 0x01D09920, "_ZN6CKnife12UseDecrementEv", mfunc_ptr_cast(&CKnife::UseDecrement_) }, // DEFAULT
{ 0x01D08BB0, "_ZN6CKnife10WeaponIdleEv", mfunc_ptr_cast(&CKnife::WeaponIdle_) },
//non-virtual func
{ 0x01D084B0, "weapon_knife", (size_t)&weapon_knife },
//{ 0x0, "FindHullIntersection", (size_t)&FindHullIntersection },
//{ 0x0, "_ZN6CKnife10SwingAgainEv", mfunc_ptr_cast(&CKnife::SwingAgain) },
//{ 0x0, "_ZN6CKnife5SmackEv", mfunc_ptr_cast(&CKnife::Smack) },
//{ 0x0, "_ZN6CKnife15WeaponAnimationEi", mfunc_ptr_cast(&CKnife::WeaponAnimation) },
//{ 0x0, "_ZN6CKnife4StabEi", mfunc_ptr_cast(&CKnife::Stab) },
//{ 0x0, "_ZN6CKnife5SwingEi", mfunc_ptr_cast(&CKnife::Swing) },
//{ 0x0, "_ZN6CKnife19ShieldSecondaryFireEii", mfunc_ptr_cast(&CKnife::ShieldSecondaryFire) },
//{ 0x0, "_ZN6CKnife19SetPlayerShieldAnimEv", mfunc_ptr_cast(&CKnife::SetPlayerShieldAnim) },
//{ 0x0, "_ZN6CKnife21ResetPlayerShieldAnimEv", mfunc_ptr_cast(&CKnife::ResetPlayerShieldAnim) },
{ 0x01D08780, "FindHullIntersection", (size_t)&FindHullIntersection },
{ 0x01D08BA0, "_ZN6CKnife10SwingAgainEv", mfunc_ptr_cast(&CKnife::SwingAgain) },
{ 0x01D08B80, "_ZN6CKnife5SmackEv", mfunc_ptr_cast(&CKnife::Smack) },
//{ 0x01D08730, "_ZN6CKnife15WeaponAnimationEi", mfunc_ptr_cast(&CKnife::WeaponAnimation) }, // NOXREF
{ 0x01D09390, "_ZN6CKnife4StabEi", mfunc_ptr_cast(&CKnife::Stab) },
{ 0x01D08C30, "_ZN6CKnife5SwingEi", mfunc_ptr_cast(&CKnife::Swing) },
{ 0x01D08A20, "_ZN6CKnife19ShieldSecondaryFireEii", mfunc_ptr_cast(&CKnife::ShieldSecondaryFire) },
//{ 0x01D08990, "_ZN6CKnife19SetPlayerShieldAnimEv", mfunc_ptr_cast(&CKnife::SetPlayerShieldAnim) }, // NOXREF
//{ 0x01D089E0, "_ZN6CKnife21ResetPlayerShieldAnimEv", mfunc_ptr_cast(&CKnife::ResetPlayerShieldAnim) }, // NOXREF
//CM249
//virtual func
//{ 0x0, "_ZN5CM2495SpawnEv", mfunc_ptr_cast(&CM249::Spawn) },
@ -5330,7 +5330,6 @@ VirtualTableRef g_TableRefs[] =
{
// Weapon shared
{ 0x01DF46BC, "CKnife", CWEAPON_VIRTUAL_COUNT },
{ 0x01DF46BC, "CKnife", CWEAPON_VIRTUAL_COUNT },
{ 0x01DF34E4, "CAWP", CWEAPON_VIRTUAL_COUNT },
{ 0x01DF51AC, "CP90", CWEAPON_VIRTUAL_COUNT },
@ -5617,20 +5616,20 @@ AddressRef g_DataRefs[] =
{ 0x01E1F5B0, "rgdpvpreset", (size_t)&prgdpvpreset },
{ 0x01E75488, "fTextureTypeInit", (size_t)&pfTextureTypeInit },
{ 0x01E7548C, "gcTextures_1", (size_t)&pgcTextures },
{ 0x01E70C80, "grgszTextureName_1", (size_t)&pgrgszTextureName },
{ 0x01E75080, "grgchTextureType_1", (size_t)&pgrgchTextureType },
//implementation at PM_Shared
{ 0x01E7548C, "gcTextures", (size_t)&pgcTextures, 2 },
{ 0x01E70C80, "grgszTextureName", (size_t)&pgrgszTextureName, 2 },
{ 0x01E75080, "grgchTextureType", (size_t)&pgrgchTextureType, 2 },
//implementation at PM_Shared
{ 0x01E68390, "gcTextures", (size_t)&ppm_gcTextures, 1 },
{ 0x01E63B88, "grgszTextureName", (size_t)&ppm_grgszTextureName, 1 },
{ 0x01E67F88, "grgchTextureType", (size_t)&ppm_grgchTextureType, 1 },
{ 0x01E63B88, "grgszTextureName", (size_t)&ppm_grgszTextureName },
{ 0x01E67F88, "grgchTextureType", (size_t)&ppm_grgchTextureType },
{ 0x01E68388, "pm_shared_initialized", (size_t)&ppm_shared_initialized },
{ 0x01E63700, "rgv3tStuckTable", (size_t)&prgv3tStuckTable },
{ 0x01E63A88, "rgStuckLast", (size_t)&prgStuckLast },
{ 0x01E68394, "g_onladder", (size_t)&pg_onladder },
{ 0x01E68390, "gcTextures", (size_t)&ppm_gcTextures },
{ 0x01E6838C, "pmove", (size_t)&pg_ppmove },
{ 0x01E76578, "g_flWeaponCheat", (size_t)&pg_flWeaponCheat },
{ 0x01E62778, "gEvilImpulse101", (size_t)&pgEvilImpulse101 },

View File

@ -35,10 +35,10 @@ extern const size_t g_BaseOffset;
extern FunctionHook g_FunctionHooks[];
extern VirtualTableRef g_TableRefs[];
extern AddressRef g_FunctionRefs[];
extern AddressRef g_DataRefs[];
VirtualTableRef *GetVirtualTableRefAddr(const char *szClassName)
{
extern AddressRef g_DataRefs[];
VirtualTableRef *GetVirtualTableRefAddr(const char *szClassName)
{
VirtualTableRef *refData = g_TableRefs;
while (refData->symbolName != NULL)
{
@ -47,16 +47,16 @@ VirtualTableRef *GetVirtualTableRefAddr(const char *szClassName)
if (refData->originalAddress != NULL)
{
return refData;
}
}
refData++;
}
return NULL;
}
bool GetAddressUsingHook(size_t addr)
{
}
}
refData++;
}
return NULL;
}
bool GetAddressUsingHook(size_t addr)
{
for (FunctionHook *cfh = &g_FunctionHooks[0]; cfh->symbolName; cfh++)
{
if (addr == cfh->originalAddress)
@ -64,24 +64,24 @@ bool GetAddressUsingHook(size_t addr)
return true;
}
}
return false;
}
size_t OffsetToRebase(size_t addr)
{
return (addr - g_GameDLLModule.base + g_BaseOffset);
}
void *GetFunctionEntity(const char *szClassName)
{
return Sys_GetProcAddress((HMODULE)g_GameDLLModule.base, szClassName);
}
void printAddrRebase(size_t addr, const char *funcName)
{
static int inum = 0;
addr += g_BaseOffset - g_GameDLLModule.base;
printf("#%d. %s - 0x%p\n", ++inum, funcName, (void *)addr);
return false;
}
size_t OffsetToRebase(size_t addr)
{
return (addr - g_GameDLLModule.base + g_BaseOffset);
}
void *GetFunctionEntity(const char *szClassName)
{
return Sys_GetProcAddress((HMODULE)g_GameDLLModule.base, szClassName);
}
void printAddrRebase(size_t addr, const char *funcName)
{
static int inum = 0;
addr += g_BaseOffset - g_GameDLLModule.base;
printf("#%d. %s - 0x%p\n", ++inum, funcName, (void *)addr);
}
FunctionHook *GetFunctionPtrByName(const char *funcName)
@ -160,10 +160,8 @@ int HookGameDLL(size_t gameAddr, size_t engAddr)
{
if (!GetAddress(&g_GameDLLModule, (Address *)refData, g_BaseOffset))
{
#if defined(_DEBUG) || !defined(_WIN32)
_logf(__FUNCTION__ ": symbol not found \"%s\", symbol index: %i\n", refData->symbolName, refData->symbolIndex);
_logf(__FUNCTION__ ": symbol not found \"%s\", symbol index: %i", refData->symbolName, refData->symbolIndex);
success = false;
#endif // _DEBUG
}
refData++;
}
@ -173,23 +171,20 @@ int HookGameDLL(size_t gameAddr, size_t engAddr)
{
if (!GetAddress(&g_GameDLLModule, (Address *)refFunc, g_BaseOffset))
{
#if defined(_DEBUG) || !defined(_WIN32)
_logf(__FUNCTION__ ": symbol not found \"%s\", symbol index: %i\n", refFunc->symbolName, refFunc->symbolIndex);
_logf(__FUNCTION__ ": symbol not found \"%s\", symbol index: %i", refFunc->symbolName, refFunc->symbolIndex);
success = false;
#endif // _DEBUG
}
refFunc++;
}
FunctionHook *hookFunc = g_FunctionHooks;
while (hookFunc->handlerFunc != NULL)
{
if (!GetAddress(&g_GameDLLModule, (Address*)hookFunc, g_BaseOffset))
{
#if defined(_DEBUG) || !defined(_WIN32)
_logf(__FUNCTION__ ": symbol not found \"%s\", symbol index: %i\n", hookFunc->symbolName, hookFunc->symbolIndex);
_logf(__FUNCTION__ ": symbol not found \"%s\", symbol index: %i", hookFunc->symbolName, hookFunc->symbolIndex);
success = false;
#endif // _DEBUG
}
hookFunc++;
}
@ -199,19 +194,15 @@ int HookGameDLL(size_t gameAddr, size_t engAddr)
{
if (!GetAddress(&g_GameDLLModule, (Address *)refVtbl, g_BaseOffset))
{
#if defined(_DEBUG) || !defined(_WIN32)
_logf(__FUNCTION__ ": symbol not found \"%s\"\n", refVtbl->symbolName);
_logf(__FUNCTION__ ": symbol not found \"%s\"", refVtbl->symbolName);
success = false;
#endif // _DEBUG
}
refVtbl++;
}
refVtbl++;
}
if (!success)
{
#if defined(_DEBUG) || !defined(_WIN32)
_logf(__FUNCTION__ ": failed to hook gamedll!\n");
#endif // _DEBUG
_logf(__FUNCTION__ ": failed to hook gamedll!");
return (FALSE);
}

View File

@ -81,7 +81,8 @@ void Regamedll_Game_Init(void)
return;
#endif // _WIN32
_printf2("[Hooker]: The total number hooks of functions is - %d", nCountHook);
printf2("[Hooker]: The total number hooks of functions is - %d", nCountHook);
}
#endif // HOOK_GAMEDLL

View File

@ -4,8 +4,6 @@ IReGameDLLPlatform *CRegamedllPlatformHolder::m_Platform;
void regamedll_log(const char *fmt, ...)
{
#ifdef _MSC_VER
va_list argptr;
static char data[8192];
@ -22,15 +20,13 @@ void regamedll_log(const char *fmt, ...)
_write(fd, data, len);
_close(fd);
#else // _WIN32
#else
FILE *fd = fopen("regamedll.log", "at");
fprintf(fd, "%s", data);
fclose(fd);
#endif // _WIN32
#endif // _MSC_VER
}
void regamedll_syserror(const char *fmt, ...)