NS: Fix ns_remove_upgrade() native

This commit is contained in:
Arkshine 2015-07-29 20:23:24 +02:00
parent a35af02494
commit aa5c340029
3 changed files with 22 additions and 1 deletions

View File

@ -31,6 +31,7 @@ TitleManager TitleMan;
ParticleManager ParticleMan; ParticleManager ParticleMan;
void MFuncs_Initialize(char *base); void MFuncs_Initialize(char *base);
void MPlayerFuncs_Initialize(char *base);
// Native register calls here // Native register calls here
void AddNatives_MemberFunc(); void AddNatives_MemberFunc();
@ -100,5 +101,6 @@ void OnAmxxAttach()
DLCLOSE(DLLBase); DLCLOSE(DLLBase);
MFuncs_Initialize(FuncBase); MFuncs_Initialize(FuncBase);
MPlayerFuncs_Initialize(FuncBase);
} }

View File

@ -20,6 +20,16 @@
#include "GameManager.h" #include "GameManager.h"
#include "CPlayer.h" #include "CPlayer.h"
#include "FastDelegate.h"
using namespace fastdelegate::detail;
static bool (GenericClass::*MFP_SetResearchDone)(int inMessageID, bool inState);
void MPlayerFuncs_Initialize(char *base)
{
set_mfp(MFP_SetResearchDone, MFP(MEMBER_SET_RESEARCH_DONE));
};
// Float:ns_get_res(Player) // Float:ns_get_res(Player)
static cell AMX_NATIVE_CALL ns_get_res(AMX *amx, cell *params) static cell AMX_NATIVE_CALL ns_get_res(AMX *amx, cell *params)
@ -378,6 +388,9 @@ static cell AMX_NATIVE_CALL ns_remove_upgrade(AMX *amx, cell *params)
if (bfound) if (bfound)
{ {
void *pTechTree = reinterpret_cast<char*>(player->GetEdict()->pvPrivateData) + MAKE_OFFSET(COMBAT_TECHTREE);
(reinterpret_cast<GenericClass *>(pTechTree)->*(MFP_SetResearchDone))(params[2], false);
if (afound) if (afound)
{ {
return 2; return 2;

View File

@ -122,6 +122,10 @@
#define OFFSET_WIN_UPGRADES_ACTIVE 0x198C #define OFFSET_WIN_UPGRADES_ACTIVE 0x198C
#define OFFSET_LIN_UPGRADES_ACTIVE 0x19A0 #define OFFSET_LIN_UPGRADES_ACTIVE 0x19A0
#define OFFSET_WIN_COMBAT_TECHTREE 0x1998
#define OFFSET_LIN_COMBAT_TECHTREE 0x19AC
// TODO: Symbols / signatures instead // TODO: Symbols / signatures instead
// Not actually offsets, but easier to use MAKE_OFFSET stuff for this :o // Not actually offsets, but easier to use MAKE_OFFSET stuff for this :o
@ -147,7 +151,9 @@
#define OFFSET_WIN_MEMBER_TRIGGER_WELDABLE MAKE_MEMBER_OFFSET(0x000A0E20) #define OFFSET_WIN_MEMBER_TRIGGER_WELDABLE MAKE_MEMBER_OFFSET(0x000A0E20)
#define OFFSET_LIN_MEMBER_TRIGGER_WELDABLE MAKE_MEMBER_OFFSET(0x00232840) #define OFFSET_LIN_MEMBER_TRIGGER_WELDABLE MAKE_MEMBER_OFFSET(0x00232840)
// Research: bool AvHTechTree::SetResearchDone(AvHMessageID inMessageID, bool inState)
#define OFFSET_WIN_MEMBER_SET_RESEARCH_DONE MAKE_MEMBER_OFFSET(0x0009EC40)
#define OFFSET_LIN_MEMBER_SET_RESEARCH_DONE MAKE_MEMBER_OFFSET(0x0022E740)
// Game Rules: AvHGameRules *GetGameRules(void) // Game Rules: AvHGameRules *GetGameRules(void)
#define OFFSET_WIN_GETGAMERULES MAKE_MEMBER_OFFSET(0x00068000) #define OFFSET_WIN_GETGAMERULES MAKE_MEMBER_OFFSET(0x00068000)