mirror of
https://github.com/fedddddd/iw5-gsc-utils.git
synced 2025-07-09 04:31:53 +00:00
Add addCommand function
This commit is contained in:
@ -140,6 +140,7 @@ namespace scripting
|
||||
{
|
||||
const auto id = entity.get_entity_id();
|
||||
|
||||
stack_isolation _;
|
||||
for (auto i = arguments.rbegin(); i != arguments.rend(); ++i)
|
||||
{
|
||||
push_value(*i);
|
||||
@ -149,16 +150,9 @@ namespace scripting
|
||||
|
||||
const auto local_id = game::AllocThread(id);
|
||||
const auto result = game::VM_Execute(local_id, pos, arguments.size());
|
||||
game::RemoveRefToObject(result);
|
||||
|
||||
const auto value = get_return_value();
|
||||
|
||||
game::RemoveRefToValue(game::scr_VmPub->top->type, game::scr_VmPub->top->u);
|
||||
game::scr_VmPub->top->type = (game::scriptType_e)0;
|
||||
|
||||
--game::scr_VmPub->top;
|
||||
--game::scr_VmPub->inparamcount;
|
||||
|
||||
return value;
|
||||
return get_return_value();
|
||||
}
|
||||
|
||||
script_value call_script_function(const entity& entity, const std::string& filename,
|
||||
|
@ -17,6 +17,15 @@ namespace game
|
||||
int flags;
|
||||
};
|
||||
|
||||
struct CmdArgs
|
||||
{
|
||||
int nesting;
|
||||
int localClientNum[8];
|
||||
int controllerIndex[8];
|
||||
int argc[8];
|
||||
const char** argv[8];
|
||||
};
|
||||
|
||||
struct msg_t
|
||||
{
|
||||
int overflowed;
|
||||
|
@ -18,8 +18,9 @@ namespace game
|
||||
|
||||
WEAK symbol<const char*(int index)> ConcatArgs{0x502150};
|
||||
WEAK symbol<void(int localClientNum, const char* text)> Cbuf_AddText{0x545680};
|
||||
WEAK symbol<void(const char* cmdName, void(), cmd_function_t* allocedCmd)> Cmd_AddCommandInternal{0x0};
|
||||
WEAK symbol<const char*(int index)> Cmd_Argv{0x0};
|
||||
WEAK symbol<void(const char* cmdName, void(), cmd_function_t* allocedCmd)> Cmd_AddCommandInternal{0x545DF0};
|
||||
WEAK symbol<void(const char* cmdName)> Cmd_RemoveCommand{0x545E20};
|
||||
WEAK symbol<const char*(int index)> Cmd_Argv{0x467600};
|
||||
|
||||
WEAK symbol<const dvar_t*(const char*)> Dvar_FindVar{0x5BDCC0};
|
||||
|
||||
@ -60,6 +61,8 @@ namespace game
|
||||
|
||||
// Variables
|
||||
|
||||
WEAK symbol<CmdArgs> cmd_args{0x1C978D0};
|
||||
|
||||
WEAK symbol<int> g_script_error_level{0x20B21FC};
|
||||
WEAK symbol<jmp_buf> g_script_error{0x20B4218};
|
||||
|
||||
|
Reference in New Issue
Block a user