Array support, name some funcs
This commit is contained in:
parent
90427d7324
commit
eadd83551a
@ -22,7 +22,7 @@ namespace scripting
|
|||||||
|
|
||||||
utils::hook::detour scr_add_class_field_hook;
|
utils::hook::detour scr_add_class_field_hook;
|
||||||
|
|
||||||
std::string last_event;
|
std::unordered_map<std::string, int> known_events;
|
||||||
|
|
||||||
void vm_notify_stub(const unsigned int notify_list_owner_id, const game::scr_string_t string_value,
|
void vm_notify_stub(const unsigned int notify_list_owner_id, const game::scr_string_t string_value,
|
||||||
game::VariableValue* top)
|
game::VariableValue* top)
|
||||||
@ -39,11 +39,11 @@ namespace scripting
|
|||||||
e.arguments.emplace_back(*value);
|
e.arguments.emplace_back(*value);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (last_event != e.name)
|
if (known_events.find(e.name) == known_events.end())
|
||||||
{
|
{
|
||||||
last_event = e.name;
|
|
||||||
|
|
||||||
//printf("notify: %s\n", e.name.data());
|
//printf("notify: %s\n", e.name.data());
|
||||||
|
|
||||||
|
known_events[e.name] = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
lua::engine::notify(e);
|
lua::engine::notify(e);
|
||||||
|
@ -39,13 +39,13 @@ namespace scripting
|
|||||||
{"setclientdvar", 52},
|
{"setclientdvar", 52},
|
||||||
{"sub_7ff7de27fa60", 54},
|
{"sub_7ff7de27fa60", 54},
|
||||||
{"isstring", 49},
|
{"isstring", 49},
|
||||||
{"sub_7ff7de27f560", 55},
|
{"setdvar", 55},
|
||||||
{"sub_7ff7de27fca0", 56},
|
{"sub_7ff7de27fca0", 56},
|
||||||
{"sub_7ff7de280730", 58},
|
{"getdvarint", 58},
|
||||||
{"sub_7ff7de280260", 57},
|
{"getdvar", 57},
|
||||||
{"sub_7ff7de281a20", 60},
|
{"sub_7ff7de281a20", 60},
|
||||||
{"sub_7ff7de282180", 61},
|
{"sub_7ff7de282180", 61},
|
||||||
{"sub_7ff7de281500", 59},
|
{"getdvarfloat", 59},
|
||||||
{"sub_7ff7de282330", 63},
|
{"sub_7ff7de282330", 63},
|
||||||
{"sub_7ff7de2821c0", 62},
|
{"sub_7ff7de2821c0", 62},
|
||||||
{"sub_7ff7de282380", 262},
|
{"sub_7ff7de282380", 262},
|
||||||
@ -131,9 +131,9 @@ namespace scripting
|
|||||||
{"setclientmatchdata", 284},
|
{"setclientmatchdata", 284},
|
||||||
{"axistoangles", 253},
|
{"axistoangles", 253},
|
||||||
{"sub_7ff7de2748a0", 598},
|
{"sub_7ff7de2748a0", 598},
|
||||||
{"sub_7ff7de274c70", 286},
|
{"anglestoright", 286},
|
||||||
{"anglestoup", 285},
|
{"anglestoup", 285},
|
||||||
{"sub_7ff7de274dd0", 287},
|
{"anglestoforward", 287},
|
||||||
{"anglesdelta", 288},
|
{"anglesdelta", 288},
|
||||||
{"sub_7ff7de275940", 289},
|
{"sub_7ff7de275940", 289},
|
||||||
{"sub_7ff7de275c10", 290},
|
{"sub_7ff7de275c10", 290},
|
||||||
@ -1234,7 +1234,7 @@ namespace scripting
|
|||||||
{"sub_7ff7de2460a0", 33562},
|
{"sub_7ff7de2460a0", 33562},
|
||||||
{"sub_7ff7de2442c0", 33717},
|
{"sub_7ff7de2442c0", 33717},
|
||||||
{"sub_7ff7de246600", 33565},
|
{"sub_7ff7de246600", 33565},
|
||||||
{"sub_7ff7de246350", 33564},
|
{"getcurrentweapon", 33564},
|
||||||
{"sethybridscopestate", 33567},
|
{"sethybridscopestate", 33567},
|
||||||
{"takeallweapons", 33563},
|
{"takeallweapons", 33563},
|
||||||
{"sub_7ff7de246a50", 33566},
|
{"sub_7ff7de246a50", 33566},
|
||||||
|
@ -5,7 +5,7 @@ namespace scripting::lua
|
|||||||
{
|
{
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
/*struct array_value
|
struct array_value
|
||||||
{
|
{
|
||||||
int index;
|
int index;
|
||||||
script_value value;
|
script_value value;
|
||||||
@ -18,7 +18,7 @@ namespace scripting::lua
|
|||||||
|
|
||||||
std::unordered_map<std::string, array_value> values;
|
std::unordered_map<std::string, array_value> values;
|
||||||
|
|
||||||
const auto offset = 64000 * (id & 3);
|
const auto offset = 40960 * (id & 3);
|
||||||
|
|
||||||
auto current = game::scr_VarGlob->objectVariableChildren[id].firstChild;
|
auto current = game::scr_VarGlob->objectVariableChildren[id].firstChild;
|
||||||
auto idx = 1;
|
auto idx = 1;
|
||||||
@ -107,7 +107,7 @@ namespace scripting::lua
|
|||||||
table[sol::metatable_key] = metatable;
|
table[sol::metatable_key] = metatable;
|
||||||
|
|
||||||
return {state, table};
|
return {state, table};
|
||||||
}*/
|
}
|
||||||
|
|
||||||
bool is_istring(const sol::lua_value& value)
|
bool is_istring(const sol::lua_value& value)
|
||||||
{
|
{
|
||||||
@ -206,10 +206,10 @@ namespace scripting::lua
|
|||||||
return {state, value.as<std::string>()};
|
return {state, value.as<std::string>()};
|
||||||
}
|
}
|
||||||
|
|
||||||
/*if (value.is<std::vector<script_value>>())
|
if (value.is<std::vector<script_value>>())
|
||||||
{
|
{
|
||||||
return entity_to_array(state, value.get_raw().u.uintValue);
|
return entity_to_array(state, value.get_raw().u.uintValue);
|
||||||
}*/
|
}
|
||||||
|
|
||||||
if (value.is<entity>())
|
if (value.is<entity>())
|
||||||
{
|
{
|
||||||
|
@ -196,7 +196,7 @@ namespace scripting
|
|||||||
template <>
|
template <>
|
||||||
bool script_value::is<std::vector<script_value>>() const
|
bool script_value::is<std::vector<script_value>>() const
|
||||||
{
|
{
|
||||||
/*if (this->get_raw().type != game::SCRIPT_OBJECT)
|
if (this->get_raw().type != game::SCRIPT_OBJECT)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -204,9 +204,7 @@ namespace scripting
|
|||||||
const auto id = this->get_raw().u.uintValue;
|
const auto id = this->get_raw().u.uintValue;
|
||||||
const auto type = game::scr_VarGlob->objectVariableValue[id].w.type;
|
const auto type = game::scr_VarGlob->objectVariableValue[id].w.type;
|
||||||
|
|
||||||
return type == game::SCRIPT_ARRAY;*/
|
return type == game::SCRIPT_ARRAY;
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/***************************************************************
|
/***************************************************************
|
||||||
|
@ -621,4 +621,94 @@ namespace game
|
|||||||
char charId;
|
char charId;
|
||||||
const char* name;
|
const char* name;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct ObjectVariableChildren
|
||||||
|
{
|
||||||
|
unsigned __int16 firstChild;
|
||||||
|
unsigned __int16 lastChild;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct ObjectVariableValue_u_f
|
||||||
|
{
|
||||||
|
unsigned __int16 prev;
|
||||||
|
unsigned __int16 next;
|
||||||
|
};
|
||||||
|
|
||||||
|
union ObjectVariableValue_u_o_u
|
||||||
|
{
|
||||||
|
unsigned __int16 size;
|
||||||
|
unsigned __int16 entnum;
|
||||||
|
unsigned __int16 nextEntId;
|
||||||
|
unsigned __int16 self;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct ObjectVariableValue_u_o
|
||||||
|
{
|
||||||
|
unsigned __int16 refCount;
|
||||||
|
ObjectVariableValue_u_o_u u;
|
||||||
|
};
|
||||||
|
|
||||||
|
union ObjectVariableValue_w
|
||||||
|
{
|
||||||
|
unsigned int type;
|
||||||
|
unsigned int classnum;
|
||||||
|
unsigned int notifyName;
|
||||||
|
unsigned int waitTime;
|
||||||
|
unsigned int parentLocalId;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct ChildVariableValue_u_f
|
||||||
|
{
|
||||||
|
unsigned __int16 prev;
|
||||||
|
unsigned __int16 next;
|
||||||
|
};
|
||||||
|
|
||||||
|
union ChildVariableValue_u
|
||||||
|
{
|
||||||
|
ChildVariableValue_u_f f;
|
||||||
|
VariableUnion u;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct ChildBucketMatchKeys_keys
|
||||||
|
{
|
||||||
|
unsigned __int16 name_hi;
|
||||||
|
unsigned __int16 parentId;
|
||||||
|
};
|
||||||
|
|
||||||
|
union ChildBucketMatchKeys
|
||||||
|
{
|
||||||
|
ChildBucketMatchKeys_keys keys;
|
||||||
|
unsigned int match;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct ChildVariableValue
|
||||||
|
{
|
||||||
|
ChildVariableValue_u u;
|
||||||
|
unsigned __int16 next;
|
||||||
|
char type;
|
||||||
|
char name_lo;
|
||||||
|
ChildBucketMatchKeys k;
|
||||||
|
unsigned __int16 nextSibling;
|
||||||
|
unsigned __int16 prevSibling;
|
||||||
|
};
|
||||||
|
|
||||||
|
union ObjectVariableValue_u
|
||||||
|
{
|
||||||
|
ObjectVariableValue_u_f f;
|
||||||
|
ObjectVariableValue_u_o o;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct ObjectVariableValue
|
||||||
|
{
|
||||||
|
ObjectVariableValue_u u;
|
||||||
|
ObjectVariableValue_w w;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct scrVarGlob_t
|
||||||
|
{
|
||||||
|
ObjectVariableValue objectVariableValue[56320];
|
||||||
|
ObjectVariableChildren objectVariableChildren[56320];
|
||||||
|
unsigned __int16 childVariableBucket[65536];
|
||||||
|
ChildVariableValue childVariableValue[384000];
|
||||||
|
};
|
||||||
}
|
}
|
@ -80,5 +80,6 @@ namespace game
|
|||||||
WEAK symbol<jmp_buf> g_script_error{0xBA9CD40};
|
WEAK symbol<jmp_buf> g_script_error{0xBA9CD40};
|
||||||
WEAK symbol<scr_classStruct_t> g_classMap{0xBF95C0};
|
WEAK symbol<scr_classStruct_t> g_classMap{0xBF95C0};
|
||||||
|
|
||||||
|
WEAK symbol<scrVarGlob_t> scr_VarGlob{0xB617C00};
|
||||||
WEAK symbol<scrVmPub_t> scr_VmPub{0xBA9EE40};
|
WEAK symbol<scrVmPub_t> scr_VmPub{0xBA9EE40};
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user