mirror of
https://github.com/JezuzLizard/T4SP-Server-Plugin.git
synced 2025-07-05 02:32:01 +00:00
Fix bugs related to variable getting and settingfunctions.
Add unit test functions fpr GSC builtins.
This commit is contained in:
@ -83,7 +83,7 @@ namespace game
|
||||
|
||||
char* Scr_GetString(game::scriptInstance_t inst, unsigned int arg_index)
|
||||
{
|
||||
static const auto call_addr = SELECT(0x0, 0x699F30);
|
||||
static const auto call_addr = SELECT(0x0, 0x69A0D0);
|
||||
char* answer;
|
||||
|
||||
__asm
|
||||
@ -114,7 +114,7 @@ namespace game
|
||||
{
|
||||
static const auto call_addr = SELECT(0x0, 0x69A1A0); //Scr_GetConstIString
|
||||
|
||||
unsigned short id;
|
||||
int id;
|
||||
|
||||
__asm
|
||||
{
|
||||
@ -148,7 +148,7 @@ namespace game
|
||||
push arg_index;
|
||||
mov eax, inst;
|
||||
call call_addr;
|
||||
mov answer, eax;
|
||||
mov answer, cx;
|
||||
add esp, 4;
|
||||
}
|
||||
|
||||
@ -161,7 +161,7 @@ namespace game
|
||||
|
||||
__asm
|
||||
{
|
||||
mov esi, id;
|
||||
mov si, id;
|
||||
mov eax, inst;
|
||||
call call_addr;
|
||||
}
|
||||
@ -232,9 +232,36 @@ namespace game
|
||||
}
|
||||
}
|
||||
|
||||
int Scr_GetEntityId@<eax>(int entNum@<eax>, scriptInstance_t inst, classNum_e classnum, unsigned __int16 clientnum)
|
||||
unsigned int Scr_GetEntityId(scriptInstance_t inst, int entNum, classNum_e classnum, unsigned int clientnum)
|
||||
{
|
||||
static const auto call_addr = SELECT(0x0, 0x692520);
|
||||
|
||||
unsigned int answer;
|
||||
|
||||
__asm
|
||||
{
|
||||
push clientnum;
|
||||
push classnum;
|
||||
push inst;
|
||||
mov eax, entNum;
|
||||
call call_addr;
|
||||
add esp, 0xC;
|
||||
mov answer, eax;
|
||||
}
|
||||
|
||||
return answer;
|
||||
}
|
||||
|
||||
void Scr_AddEntityNum(scriptInstance_t inst, unsigned short entid)
|
||||
{
|
||||
static const auto call_addr = SELECT(0x0, 0x69A770);
|
||||
|
||||
__asm
|
||||
{
|
||||
movzx esi, entid;
|
||||
mov eax, inst;
|
||||
call call_addr;
|
||||
}
|
||||
}
|
||||
|
||||
//Only supports getting the first argument as a path node
|
||||
@ -255,9 +282,12 @@ namespace game
|
||||
|
||||
void Scr_AddPathnode(scriptInstance_t inst, pathnode_t* node)
|
||||
{
|
||||
printf("Scr_AddPathnode Targetname %s\n", SL_ConvertToString(game::SCRIPTINSTANCE_SERVER, node->constant.targetname));
|
||||
int entnum = node - (*gameWorldCurrent)->path.nodes;
|
||||
int entid = Scr_GetEntityId(entnum >> 7, SCRIPTINSTANCE_SERVER, CLASS_NUM_PATHNODE, 0);
|
||||
Scr_AddEntityNum(SCRIPTINSTANCE_SERVER, entid);
|
||||
printf("1 entnum: %d\n", entnum);
|
||||
int entid = Scr_GetEntityId(inst, entnum, CLASS_NUM_PATHNODE, 0);
|
||||
printf("2 entid: %d\n", entid);
|
||||
Scr_AddEntityNum(inst, entid);
|
||||
}
|
||||
|
||||
void Scr_MakeArray(scriptInstance_t inst)
|
||||
@ -278,14 +308,14 @@ namespace game
|
||||
__asm
|
||||
{
|
||||
mov edi, inst;
|
||||
mov cx, id;
|
||||
movzx ecx, id;
|
||||
call call_addr;
|
||||
}
|
||||
}
|
||||
|
||||
const char* SL_ConvertToString(scriptInstance_t inst, unsigned short id)
|
||||
const char* SL_ConvertToString(scriptInstance_t inst, int id)
|
||||
{
|
||||
static const auto call_addr = SELECT(0x0, 0x699F30);
|
||||
static const auto call_addr = SELECT(0x0, 0x68D950);
|
||||
const char* answer;
|
||||
|
||||
__asm
|
||||
|
@ -28,27 +28,28 @@ namespace game
|
||||
dvar_s* Dvar_RegisterInt(const char* name, int value, int min, int max, DvarFlags flags, const char* desc);
|
||||
dvar_s* Dvar_RegisterString(const char* name, const char* value, DvarFlags flags, const char* desc);
|
||||
|
||||
int Scr_GetInt(game::scriptInstance_t inst, unsigned int arg_index);
|
||||
void Scr_AddInt(game::scriptInstance_t inst, int value);
|
||||
float Scr_GetFloat(game::scriptInstance_t inst, unsigned int arg_index);
|
||||
void Scr_AddFloat(game::scriptInstance_t inst, float value);
|
||||
char* Scr_GetString(game::scriptInstance_t inst, unsigned int arg_index);
|
||||
void Scr_AddString(game::scriptInstance_t inst, const char* string);
|
||||
const char* Scr_GetIString(game::scriptInstance_t inst, unsigned int arg_index);
|
||||
void Scr_AddIString(game::scriptInstance_t inst, const char* string);
|
||||
unsigned short Scr_GetConstString(game::scriptInstance_t inst, unsigned int arg_index);
|
||||
void Scr_AddConstString(game::scriptInstance_t inst, unsigned short id);
|
||||
void Scr_GetVector(game::scriptInstance_t inst, unsigned int arg_index, float* value);
|
||||
void Scr_AddVector(game::scriptInstance_t inst, float* value);
|
||||
void Scr_AddUndefined(game::scriptInstance_t inst);
|
||||
gentity_s* Scr_GetEntity(unsigned int arg_index);
|
||||
void Scr_AddEntity(game::scriptInstance_t inst, gentity_s* ent);
|
||||
int Scr_GetEntityId(int entNum, scriptInstance_t inst, classNum_e classnum, unsigned __int16 clientnum);
|
||||
pathnode_t* Scr_GetPathnode(scriptInstance_t inst);
|
||||
void Scr_AddPathnode(scriptInstance_t inst, pathnode_t* node);
|
||||
void Scr_MakeArray(scriptInstance_t inst);
|
||||
void Scr_AddArrayStringIndexed(scriptInstance_t inst, unsigned short id);
|
||||
const char* SL_ConvertToString(scriptInstance_t inst, unsigned short id);
|
||||
int Scr_GetInt(game::scriptInstance_t inst, unsigned int arg_index); //testing
|
||||
void Scr_AddInt(game::scriptInstance_t inst, int value); //testing
|
||||
float Scr_GetFloat(game::scriptInstance_t inst, unsigned int arg_index); //testing
|
||||
void Scr_AddFloat(game::scriptInstance_t inst, float value); //testing
|
||||
char* Scr_GetString(game::scriptInstance_t inst, unsigned int arg_index); //testing
|
||||
void Scr_AddString(game::scriptInstance_t inst, const char* string); //testing
|
||||
const char* Scr_GetIString(game::scriptInstance_t inst, unsigned int arg_index); //testing
|
||||
void Scr_AddIString(game::scriptInstance_t inst, const char* string); //testing
|
||||
unsigned short Scr_GetConstString(game::scriptInstance_t inst, unsigned int arg_index); //testing
|
||||
void Scr_AddConstString(game::scriptInstance_t inst, unsigned short id); //testing
|
||||
void Scr_GetVector(game::scriptInstance_t inst, unsigned int arg_index, float* value); //testing
|
||||
void Scr_AddVector(game::scriptInstance_t inst, float* value); //testing
|
||||
void Scr_AddUndefined(game::scriptInstance_t inst); //testing
|
||||
gentity_s* Scr_GetEntity(unsigned int arg_index); //testing
|
||||
void Scr_AddEntity(game::scriptInstance_t inst, gentity_s* ent); //testing
|
||||
unsigned int Scr_GetEntityId(scriptInstance_t inst, int entNum, classNum_e classnum, unsigned int clientnum); //testing
|
||||
void Scr_AddEntityNum(scriptInstance_t inst, unsigned short entid); //testing
|
||||
pathnode_t* Scr_GetPathnode(scriptInstance_t inst); //testing
|
||||
void Scr_AddPathnode(scriptInstance_t inst, pathnode_t* node); //testing
|
||||
void Scr_MakeArray(scriptInstance_t inst); //testing
|
||||
void Scr_AddArrayStringIndexed(scriptInstance_t inst, unsigned short id); //testing
|
||||
const char* SL_ConvertToString(scriptInstance_t inst, int id); //testing
|
||||
|
||||
template <typename T>
|
||||
class symbol
|
||||
|
@ -13,6 +13,8 @@ namespace game
|
||||
struct tagInfo_s;
|
||||
union gentity_u;
|
||||
struct animscripted_s;
|
||||
union pathnode_tree_info_t;
|
||||
struct pathnode_tree_t;
|
||||
|
||||
typedef float vec_t;
|
||||
typedef vec_t vec2_t[2];
|
||||
@ -181,7 +183,7 @@ namespace game
|
||||
SCRIPT_INSTANCE_MAX = 0x2,
|
||||
};
|
||||
|
||||
enum classNum_e
|
||||
enum classNum_e : unsigned int
|
||||
{
|
||||
CLASS_NUM_ENTITY = 0x0,
|
||||
CLASS_NUM_HUDELEM = 0x1,
|
||||
@ -1515,7 +1517,6 @@ namespace game
|
||||
unsigned __int16* nodes;
|
||||
};
|
||||
|
||||
|
||||
union __declspec(align(4)) pathnode_tree_info_t
|
||||
{
|
||||
pathnode_tree_t* child[2];
|
||||
|
@ -10,14 +10,16 @@ namespace game
|
||||
WEAK symbol<dvar_s*(const char* name, dvarType_t type, DvarFlags flags, DvarValue dval, DvarLimits dom, const char* desc)> Dvar_RegisterVariant{ 0x0, 0x5EED90 };
|
||||
|
||||
WEAK symbol<void(scriptInstance_t inst)> Scr_AddArray { 0x0, 0x69AA50 };
|
||||
WEAK symbol<int(scriptInstance_t inst, char* string, int user, unsigned int len)> SL_GetStringOfSize { 0x0, 0x68DE50 };
|
||||
WEAK symbol<unsigned int(scriptInstance_t inst, char* string, int user, unsigned int len)> SL_GetStringOfSize { 0x0, 0x68DE50 };
|
||||
|
||||
// Variables
|
||||
|
||||
WEAK symbol<cmd_function_s*> cmd_functions{ 0x0, 0x1F416F4 };
|
||||
WEAK symbol<CmdArgs> cmd_args{ 0x0, 0x1F41670 };
|
||||
|
||||
WEAK symbol<GameWorldSp*> gameWorldCurrent{0x0, 0x8E1D80 };
|
||||
WEAK symbol<GameWorldSp*> gameWorldCurrent{ 0x0, 0x8E1D80 };
|
||||
|
||||
WEAK symbol<gentity_s> g_entities{ 0x0, 0x176C6F0 };
|
||||
|
||||
namespace plutonium
|
||||
{
|
||||
|
Reference in New Issue
Block a user