mirror of
https://github.com/JezuzLizard/T4SP-Server-Plugin.git
synced 2025-11-29 23:37:47 +00:00
Add script errors for added builtins.
Fix generatepath() to return nodenums instead of pathnodes to workaround an obscure VM bug which is caused by sending a random origin as an argument and returning pathnodes.
This commit is contained in:
@@ -23,6 +23,15 @@ namespace game
|
||||
}
|
||||
}
|
||||
|
||||
std::map<std::string, team_t> team_map =
|
||||
{
|
||||
{ "free", TEAM_FREE },
|
||||
{ "axis", TEAM_AXIS },
|
||||
{ "allies", TEAM_ALLIES },
|
||||
{ "neutral", TEAM_NEUTRAL },
|
||||
{ "dead", TEAM_DEAD }
|
||||
};
|
||||
|
||||
int Scr_GetInt(game::scriptInstance_t inst, unsigned int arg_index)
|
||||
{
|
||||
static const auto call_addr = SELECT(0x0, 0x699C50);
|
||||
@@ -252,13 +261,13 @@ namespace game
|
||||
return answer;
|
||||
}
|
||||
|
||||
void Scr_AddEntityNum(scriptInstance_t inst, unsigned short entid)
|
||||
void Scr_AddEntityNum(scriptInstance_t inst, unsigned int entid)
|
||||
{
|
||||
static const auto call_addr = SELECT(0x0, 0x69A770);
|
||||
|
||||
__asm
|
||||
{
|
||||
movzx esi, entid;
|
||||
mov esi, entid;
|
||||
mov eax, inst;
|
||||
call call_addr;
|
||||
}
|
||||
@@ -282,8 +291,8 @@ namespace game
|
||||
|
||||
void Scr_AddPathnode(scriptInstance_t inst, pathnode_t* node)
|
||||
{
|
||||
int entnum = node - (*gameWorldCurrent)->path.nodes;
|
||||
int entid = Scr_GetEntityId(inst, entnum, CLASS_NUM_PATHNODE, 0);
|
||||
unsigned int entnum = node - (*gameWorldCurrent)->path.nodes;
|
||||
auto entid = Scr_GetEntityId(inst, entnum, CLASS_NUM_PATHNODE, 0);
|
||||
Scr_AddEntityNum(inst, entid);
|
||||
}
|
||||
|
||||
@@ -310,6 +319,41 @@ namespace game
|
||||
}
|
||||
}
|
||||
|
||||
unsigned int Scr_GetNumParam(scriptInstance_t inst)
|
||||
{
|
||||
return scrVmPub[inst].outparamcount;
|
||||
}
|
||||
|
||||
VariableType Scr_GetType(scriptInstance_t inst, unsigned int index)
|
||||
{
|
||||
static const auto call_addr = SELECT(0x0, 0x69A4E0);
|
||||
VariableType answer;
|
||||
|
||||
__asm
|
||||
{
|
||||
mov eax, inst;
|
||||
mov ecx, index;
|
||||
call call_addr;
|
||||
mov answer, eax;
|
||||
}
|
||||
|
||||
return answer;
|
||||
}
|
||||
|
||||
void Scr_Error(const char* err, scriptInstance_t inst, bool is_terminal)
|
||||
{
|
||||
static const auto call_addr = SELECT(0x0, 0x69AB70);
|
||||
|
||||
__asm
|
||||
{
|
||||
push is_terminal;
|
||||
mov edi, inst;
|
||||
mov ecx, err;
|
||||
call call_addr;
|
||||
add esp, 4;
|
||||
}
|
||||
}
|
||||
|
||||
const char* SL_ConvertToString(scriptInstance_t inst, int id)
|
||||
{
|
||||
static const auto call_addr = SELECT(0x0, 0x68D950);
|
||||
|
||||
Reference in New Issue
Block a user