View Full Version : Getting weapon data dynamically without having a monstrosity of code
See http://www.gamedeception.net/threads/23554-Dynamically-Get-Weapon-Data
FORCEINLINE DWORD CWeaponInfo::dwGetWeaponInfo( C_BaseCombatWeapon* pWeapon )
{
return reinterpret_cast< DWORD ( __cdecl* )( WORD ) >( g_dwWeaponInfoFromHandle )( *Memory::MakePtr< WORD >( pWeapon, 0x966 ) );
}
I couldn't resist posting this due to how much Korruption's code just sucks and the thread was locked due to Jews or something like that.
Forza
01-23-2012, 08:15 AM
Nice job, but someone already mentioned that all you have to do is call a virtual function in C_BaseCombatWeapon to get the pointer in my thread.
Nice job, but someone already mentioned that all you have to do is call a virtual function in C_BaseCombatWeapon to get the pointer in my thread.
This is basically what the vfunc does, shows that it's not needed at all.
Forza
01-23-2012, 08:49 AM
This is basically what the vfunc does, shows that it's not needed at all.
Well it's not 'basically' what the vfunc does, it's EXACTLY what the vfunc does. :D I was only mentioning it to let you know this was pretty much already posted in my thread, without C+P capabilities. I should have cleaned up my code (yea it's incredibly ugly) but I just never really got around to it. Either way though nice job as this is definitely cleaner than what I posted. ;)
goodest
07-07-2012, 07:53 AM
wow using FORCEINLINE for what, if u set right the compiler settings you dont need to tell him what to inline and what not
Forza
07-07-2012, 08:05 AM
wow using FORCEINLINE for what, if u set right the compiler settings you dont need to tell him what to inline and what not
A function like that should automatically be inlined regardless of what your compiler settings are in Visual Studio. However, it's still not a bad idea to use FORCEINLINE if you want to make sure it's an inline function on all compilers, which aren't as well suited at optimization as Visual Studio is. Also, once again, very productive and informative bump that I'm sure we all learned a lot from.
Powered by vBulletin® Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.