aboutsummaryrefslogtreecommitdiff
path: root/NorthstarDLL/squirrel.h
diff options
context:
space:
mode:
authorBobTheBob9 <for.oliver.kirkham@gmail.com>2022-10-21 00:17:48 +0100
committerBobTheBob9 <for.oliver.kirkham@gmail.com>2022-10-21 00:17:48 +0100
commit0c729c609cd052f4e720ce885c1d5322b63c9edd (patch)
tree1e9c47ab45d9d684a8c0994e6331a6311a2ceaed /NorthstarDLL/squirrel.h
parent841881af9ea6ec73b1d505d5a8f7c1f766273724 (diff)
downloadNorthstarLauncher-0c729c609cd052f4e720ce885c1d5322b63c9edd.tar.gz
NorthstarLauncher-0c729c609cd052f4e720ce885c1d5322b63c9edd.zip
fix up squirrel sq_getentity defs
Diffstat (limited to 'NorthstarDLL/squirrel.h')
-rw-r--r--NorthstarDLL/squirrel.h17
1 files changed, 14 insertions, 3 deletions
diff --git a/NorthstarDLL/squirrel.h b/NorthstarDLL/squirrel.h
index de99b9d0..bc738428 100644
--- a/NorthstarDLL/squirrel.h
+++ b/NorthstarDLL/squirrel.h
@@ -122,12 +122,16 @@ typedef SQRESULT (*sq_getassetType)(HSquirrelVM* sqvm, SQInteger iStackpos, cons
typedef SQRESULT (*sq_getuserdataType)(HSquirrelVM* sqvm, SQInteger iStackpos, void** pData, uint64_t* pTypeId);
typedef SQFloat* (*sq_getvectorType)(HSquirrelVM* sqvm, SQInteger iStackpos);
typedef SQBool (*sq_getthisentityType)(HSquirrelVM*, void** ppEntity);
-typedef void* (*sq_getentityType)(HSquirrelVM*, SQInteger iStackPos);
+typedef void (*sq_getobjectType)(HSquirrelVM*, SQInteger iStackPos, SQObject* pOutObj);
// sq stack userpointer funcs
typedef void* (*sq_createuserdataType)(HSquirrelVM* sqvm, SQInteger iSize);
typedef SQRESULT (*sq_setuserdatatypeidType)(HSquirrelVM* sqvm, SQInteger iStackpos, uint64_t iTypeId);
+// sq misc entity funcs
+typedef void* (*sq_getentityfrominstanceType)(CSquirrelVM* sqvm, SQObject* pInstance, char** ppEntityConstant);
+typedef char** (*sq_GetEntityConstantType)();
+
template <ScriptContext context> class SquirrelManager
{
private:
@@ -171,10 +175,13 @@ template <ScriptContext context> class SquirrelManager
sq_getuserdataType __sq_getuserdata;
sq_getvectorType __sq_getvector;
sq_getthisentityType __sq_getthisentity;
- sq_getentityType __sq_getentity;
+ sq_getobjectType __sq_getobject;
sq_createuserdataType __sq_createuserdata;
sq_setuserdatatypeidType __sq_setuserdatatypeid;
+
+ sq_getentityfrominstanceType __sq_getentityfrominstance;
+ sq_GetEntityConstantType __sq_GetEntityConstant_CBaseEntity;
#pragma endregion
public:
@@ -324,7 +331,11 @@ template <ScriptContext context> class SquirrelManager
template <typename T> inline T* getentity(HSquirrelVM* sqvm, SQInteger iStackPos)
{
- return (T*)__sq_getentity(sqvm, iStackPos);
+ SQObject obj;
+ __sq_getobject(sqvm, iStackPos, &obj);
+
+ // there are entity constants for other types, but seemingly CBaseEntity's is the only one needed
+ return (T*) __sq_getentityfrominstance(m_pSQVM, &obj, __sq_GetEntityConstant_CBaseEntity());
}
#pragma endregion
};