mirror of
https://github.com/fedddddd/iw5-gsc-utils.git
synced 2025-04-22 05:35:43 +00:00
Cleanup
This commit is contained in:
parent
dc150bb940
commit
1eacc72295
@ -6,52 +6,15 @@
|
||||
#include "game/scripting/execution.hpp"
|
||||
#include "game/scripting/functions.hpp"
|
||||
|
||||
#include "gsc.hpp"
|
||||
|
||||
namespace gsc
|
||||
{
|
||||
using function_args = std::vector<scripting::script_value>;
|
||||
|
||||
using builtin_function = void(*)();
|
||||
using builtin_method = void(*)(game::scr_entref_t);
|
||||
|
||||
using script_function = std::function<scripting::script_value(function_args)>;
|
||||
using script_method = std::function<scripting::script_value(game::scr_entref_t, function_args)>;
|
||||
|
||||
std::unordered_map<unsigned, script_function> functions;
|
||||
std::unordered_map<unsigned, script_method> methods;
|
||||
|
||||
namespace
|
||||
{
|
||||
void gsc_function_stub(game::scr_entref_t ent)
|
||||
{
|
||||
/*const auto function = scripting::script_value(*game::scr_VmPub->top);
|
||||
|
||||
if (!function.is<std::string>())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
const auto function_str = function.as<std::string>();
|
||||
|
||||
if (gsc_functions.find(function_str) != gsc_functions.end())
|
||||
{
|
||||
std::vector<scripting::script_value> arguments;
|
||||
|
||||
for (auto i = 1; i < game::scr_VmPub->outparamcount; i++)
|
||||
{
|
||||
const auto value = game::scr_VmPub->top[-i];
|
||||
|
||||
arguments.emplace_back(value);
|
||||
}
|
||||
|
||||
const auto value = gsc_functions[function_str](ent, arguments);
|
||||
if (*reinterpret_cast<const int*>(&value))
|
||||
{
|
||||
game::Scr_ClearOutParams();
|
||||
scripting::push_value(value);
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
std::string method_name(unsigned int id)
|
||||
{
|
||||
const auto map = *game::plutonium::method_map_rev;
|
||||
|
22
src/component/gsc.hpp
Normal file
22
src/component/gsc.hpp
Normal file
@ -0,0 +1,22 @@
|
||||
#pragma once
|
||||
|
||||
namespace gsc
|
||||
{
|
||||
using function_args = std::vector<scripting::script_value>;
|
||||
|
||||
using builtin_function = void(*)();
|
||||
using builtin_method = void(*)(game::scr_entref_t);
|
||||
|
||||
using script_function = std::function<scripting::script_value(function_args)>;
|
||||
using script_method = std::function<scripting::script_value(game::scr_entref_t, function_args)>;
|
||||
|
||||
namespace function
|
||||
{
|
||||
void add(const std::string& name, const script_function& func);
|
||||
}
|
||||
|
||||
namespace method
|
||||
{
|
||||
void add(const std::string& name, const script_method& func);
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user