diff --git a/VisualC/HatchGameEngine.vcxproj b/VisualC/HatchGameEngine.vcxproj
index 944cde4d..b66f3d3c 100644
--- a/VisualC/HatchGameEngine.vcxproj
+++ b/VisualC/HatchGameEngine.vcxproj
@@ -154,9 +154,9 @@ CD ..
-
+
diff --git a/VisualC/HatchGameEngine.vcxproj.filters b/VisualC/HatchGameEngine.vcxproj.filters
index 4de54360..cf4440b3 100644
--- a/VisualC/HatchGameEngine.vcxproj.filters
+++ b/VisualC/HatchGameEngine.vcxproj.filters
@@ -39,15 +39,15 @@
Source Files
-
- Source Files
-
Source Files
Source Files
+
+ Source Files
+
Source Files
diff --git a/source/Engine/Application.cpp b/source/Engine/Application.cpp
index c33457c5..587dfcc7 100644
--- a/source/Engine/Application.cpp
+++ b/source/Engine/Application.cpp
@@ -53,7 +53,7 @@ class Application {
#include
#include
-#include
+#include
#include
#include
#include
@@ -517,7 +517,7 @@ PRIVATE STATIC void Application::Restart() {
Graphics::SpriteSheetTextureMap->Clear();
ScriptManager::LoadAllClasses = false;
- BytecodeObject::DisableAutoAnimate = false;
+ ScriptEntity::DisableAutoAnimate = false;
Graphics::Reset();
diff --git a/source/Engine/Bytecode/GarbageCollector.cpp b/source/Engine/Bytecode/GarbageCollector.cpp
index c1352044..5a2c01a5 100644
--- a/source/Engine/Bytecode/GarbageCollector.cpp
+++ b/source/Engine/Bytecode/GarbageCollector.cpp
@@ -19,7 +19,7 @@ class GarbageCollector {
#include
-#include
+#include
#include
#include
#include
@@ -72,7 +72,7 @@ PUBLIC STATIC void GarbageCollector::Collect() {
for (Entity* ent = Scene::StaticObjectFirst, *next; ent; ent = next) {
next = ent->NextEntity;
- BytecodeObject* bobj = (BytecodeObject*)ent;
+ ScriptEntity* bobj = (ScriptEntity*)ent;
GrayObject(bobj->Instance);
GrayHashMap(bobj->Properties);
}
@@ -80,7 +80,7 @@ PUBLIC STATIC void GarbageCollector::Collect() {
for (Entity* ent = Scene::DynamicObjectFirst, *next; ent; ent = next) {
next = ent->NextEntity;
- BytecodeObject* bobj = (BytecodeObject*)ent;
+ ScriptEntity* bobj = (ScriptEntity*)ent;
GrayObject(bobj->Instance);
GrayHashMap(bobj->Properties);
}
diff --git a/source/Engine/Bytecode/BytecodeObject.cpp b/source/Engine/Bytecode/ScriptEntity.cpp
similarity index 89%
rename from source/Engine/Bytecode/BytecodeObject.cpp
rename to source/Engine/Bytecode/ScriptEntity.cpp
index 52b221e1..48797d53 100644
--- a/source/Engine/Bytecode/BytecodeObject.cpp
+++ b/source/Engine/Bytecode/ScriptEntity.cpp
@@ -2,7 +2,7 @@
#include
#include
-class BytecodeObject : public Entity {
+class ScriptEntity : public Entity {
public:
static bool DisableAutoAnimate;
@@ -11,12 +11,12 @@ class BytecodeObject : public Entity {
};
#endif
-#include
+#include
#include
#include
#include
-bool BytecodeObject::DisableAutoAnimate = false;
+bool ScriptEntity::DisableAutoAnimate = false;
#define LINK_INT(VAR) Instance->Fields->Put(#VAR, INTEGER_LINK_VAL(&VAR))
#define LINK_DEC(VAR) Instance->Fields->Put(#VAR, DECIMAL_LINK_VAL(&VAR))
@@ -37,7 +37,7 @@ Uint32 Hash_OnSceneRestart = 0;
Uint32 Hash_GameStart = 0;
Uint32 Hash_Dispose = 0;
-PUBLIC void BytecodeObject::Link(ObjInstance* instance) {
+PUBLIC void ScriptEntity::Link(ObjInstance* instance) {
Instance = instance;
Instance->EntityPtr = this;
Properties = new HashMap(NULL, 4);
@@ -63,7 +63,7 @@ PUBLIC void BytecodeObject::Link(ObjInstance* instance) {
LinkFields();
}
-PUBLIC void BytecodeObject::LinkFields() {
+PUBLIC void ScriptEntity::LinkFields() {
/***
* \field X
* \type Decimal
@@ -659,7 +659,7 @@ PUBLIC void BytecodeObject::LinkFields() {
#undef LINK_DEC
#undef LINK_BOOL
-PRIVATE bool BytecodeObject::GetCallableValue(Uint32 hash, VMValue& value) {
+PRIVATE bool ScriptEntity::GetCallableValue(Uint32 hash, VMValue& value) {
// First look for a field which may shadow a method.
VMValue result;
if (Instance->Fields->GetIfExists(hash, &result)) {
@@ -680,14 +680,14 @@ PRIVATE bool BytecodeObject::GetCallableValue(Uint32 hash, VMValue& value) {
return false;
}
-PRIVATE ObjFunction* BytecodeObject::GetCallableFunction(Uint32 hash) {
+PRIVATE ObjFunction* ScriptEntity::GetCallableFunction(Uint32 hash) {
ObjClass* klass = Instance->Object.Class;
VMValue result;
if (klass->Methods->GetIfExists(hash, &result))
return AS_FUNCTION(result);
return NULL;
}
-PUBLIC bool BytecodeObject::RunFunction(Uint32 hash) {
+PUBLIC bool ScriptEntity::RunFunction(Uint32 hash) {
if (!Instance)
return false;
@@ -695,7 +695,7 @@ PUBLIC bool BytecodeObject::RunFunction(Uint32 hash) {
// If the function doesn't exist, this is not an error VM side,
// treat whatever we call from C++ as a virtual-like function.
VMValue value;
- if (!BytecodeObject::GetCallableValue(hash, value))
+ if (!ScriptEntity::GetCallableValue(hash, value))
return true;
VMThread* thread = ScriptManager::Threads + 0;
@@ -709,11 +709,11 @@ PUBLIC bool BytecodeObject::RunFunction(Uint32 hash) {
return true;
}
-PUBLIC bool BytecodeObject::RunCreateFunction(VMValue flag) {
+PUBLIC bool ScriptEntity::RunCreateFunction(VMValue flag) {
// NOTE:
// If the function doesn't exist, this is not an error VM side,
// treat whatever we call from C++ as a virtual-like function.
- ObjFunction* func = BytecodeObject::GetCallableFunction(Hash_Create);
+ ObjFunction* func = ScriptEntity::GetCallableFunction(Hash_Create);
if (!func)
return true;
@@ -735,7 +735,7 @@ PUBLIC bool BytecodeObject::RunCreateFunction(VMValue flag) {
return false;
}
-PUBLIC bool BytecodeObject::RunInitializer() {
+PUBLIC bool ScriptEntity::RunInitializer() {
if (!HasInitializer(Instance->Object.Class))
return true;
@@ -752,7 +752,7 @@ PUBLIC bool BytecodeObject::RunInitializer() {
return true;
}
-PUBLIC void BytecodeObject::Copy(BytecodeObject* other, bool copyClass, bool destroySrc) {
+PUBLIC void ScriptEntity::Copy(ScriptEntity* other, bool copyClass, bool destroySrc) {
CopyFields(other);
if (copyClass)
@@ -773,13 +773,13 @@ PUBLIC void BytecodeObject::Copy(BytecodeObject* other, bool copyClass, bool des
}
-PUBLIC void BytecodeObject::CopyFields(BytecodeObject* other) {
+PUBLIC void ScriptEntity::CopyFields(ScriptEntity* other) {
Entity::CopyFields(other);
CopyVMFields(other);
}
-PUBLIC void BytecodeObject::CopyVMFields(BytecodeObject* other) {
+PUBLIC void ScriptEntity::CopyVMFields(ScriptEntity* other) {
Table* srcFields = Instance->Fields;
Table* destFields = other->Instance->Fields;
@@ -796,7 +796,7 @@ PUBLIC void BytecodeObject::CopyVMFields(BytecodeObject* other) {
}
// Events called from C++
-PUBLIC void BytecodeObject::Initialize() {
+PUBLIC void ScriptEntity::Initialize() {
if (!Instance) return;
// Set defaults
@@ -843,7 +843,7 @@ PUBLIC void BytecodeObject::Initialize() {
CurrentFrameCount = 0;
AnimationSpeedMult = 1.0;
AnimationSpeedAdd = 0;
- AutoAnimate = BytecodeObject::DisableAutoAnimate ? false : true;
+ AutoAnimate = ScriptEntity::DisableAutoAnimate ? false : true;
AnimationSpeed = 0;
AnimationTimer = 0.0;
AnimationFrameDuration = 0;
@@ -867,7 +867,7 @@ PUBLIC void BytecodeObject::Initialize() {
RunInitializer();
}
-PUBLIC void BytecodeObject::Create(VMValue flag) {
+PUBLIC void ScriptEntity::Create(VMValue flag) {
if (!Instance) return;
Created = true;
@@ -877,27 +877,27 @@ PUBLIC void BytecodeObject::Create(VMValue flag) {
SetAnimation(0, 0);
}
}
-PUBLIC void BytecodeObject::Create() {
+PUBLIC void ScriptEntity::Create() {
Create(INTEGER_VAL(0));
}
-PUBLIC void BytecodeObject::PostCreate() {
+PUBLIC void ScriptEntity::PostCreate() {
if (!Instance) return;
PostCreated = true;
RunFunction(Hash_PostCreate);
}
-PUBLIC void BytecodeObject::UpdateEarly() {
+PUBLIC void ScriptEntity::UpdateEarly() {
if (!Active) return;
RunFunction(Hash_UpdateEarly);
}
-PUBLIC void BytecodeObject::Update() {
+PUBLIC void ScriptEntity::Update() {
if (!Active) return;
RunFunction(Hash_Update);
}
-PUBLIC void BytecodeObject::UpdateLate() {
+PUBLIC void ScriptEntity::UpdateLate() {
if (!Active) return;
RunFunction(Hash_UpdateLate);
@@ -907,40 +907,40 @@ PUBLIC void BytecodeObject::UpdateLate() {
if (AutoPhysics)
ApplyMotion();
}
-PUBLIC void BytecodeObject::RenderEarly() {
+PUBLIC void ScriptEntity::RenderEarly() {
if (!Active) return;
RunFunction(Hash_RenderEarly);
}
-PUBLIC void BytecodeObject::Render(int CamX, int CamY) {
+PUBLIC void ScriptEntity::Render(int CamX, int CamY) {
if (!Active) return;
if (RunFunction(Hash_Render)) {
// Default render
}
}
-PUBLIC void BytecodeObject::RenderLate() {
+PUBLIC void ScriptEntity::RenderLate() {
if (!Active) return;
RunFunction(Hash_RenderLate);
}
-PUBLIC void BytecodeObject::OnAnimationFinish() {
+PUBLIC void ScriptEntity::OnAnimationFinish() {
RunFunction(Hash_OnAnimationFinish);
}
-PUBLIC void BytecodeObject::OnSceneLoad() {
+PUBLIC void ScriptEntity::OnSceneLoad() {
if (!Active) return;
RunFunction(Hash_OnSceneLoad);
}
-PUBLIC void BytecodeObject::OnSceneRestart() {
+PUBLIC void ScriptEntity::OnSceneRestart() {
if (!Active) return;
RunFunction(Hash_OnSceneRestart);
}
-PUBLIC void BytecodeObject::GameStart() {
+PUBLIC void ScriptEntity::GameStart() {
RunFunction(Hash_GameStart);
}
-PUBLIC void BytecodeObject::Remove() {
+PUBLIC void ScriptEntity::Remove() {
if (Removed) return;
if (!Instance) return;
@@ -949,7 +949,7 @@ PUBLIC void BytecodeObject::Remove() {
Active = false;
Removed = true;
}
-PUBLIC void BytecodeObject::Dispose() {
+PUBLIC void ScriptEntity::Dispose() {
Entity::Dispose();
if (Properties) {
delete Properties;
@@ -963,13 +963,13 @@ PUBLIC void BytecodeObject::Dispose() {
#define GET_ARG(argIndex, argFunction) (StandardLibrary::argFunction(args, argIndex, threadID))
#define GET_ARG_OPT(argIndex, argFunction, argDefault) (argIndex < argCount ? GET_ARG(argIndex, StandardLibrary::argFunction) : argDefault)
#define GET_ENTITY(argIndex) (GetEntity(args, argIndex, threadID))
-BytecodeObject* GetEntity(VMValue* args, int index, Uint32 threadID) {
+ScriptEntity* GetEntity(VMValue* args, int index, Uint32 threadID) {
ObjInstance* entity = GET_ARG(index, GetInstance);
if (!entity->EntityPtr)
return nullptr;
- return (BytecodeObject*)entity->EntityPtr;
+ return (ScriptEntity*)entity->EntityPtr;
}
-bool TestEntityCollision(BytecodeObject* other, BytecodeObject* self) {
+bool TestEntityCollision(ScriptEntity* other, ScriptEntity* self) {
if (!other->Active || other->Removed) return false;
// if (!other->Instance) return false;
if (other->HitboxW == 0.0f ||
@@ -990,7 +990,7 @@ bool TestEntityCollision(BytecodeObject* other, BytecodeObject* self) {
* \param frame (Integer): The frame index.
* \ns Instance
*/
-PUBLIC STATIC VMValue BytecodeObject::VM_SetAnimation(int argCount, VMValue* args, Uint32 threadID) {
+PUBLIC STATIC VMValue ScriptEntity::VM_SetAnimation(int argCount, VMValue* args, Uint32 threadID) {
StandardLibrary::CheckArgCount(argCount, 3);
Entity* self = GET_ENTITY(0);
int animation = GET_ARG(1, GetInteger);
@@ -1024,7 +1024,7 @@ PUBLIC STATIC VMValue BytecodeObject::VM_SetAnimation(int argCount, VMValue* arg
* \param frame (Integer): The frame index.
* \ns Instance
*/
-PUBLIC STATIC VMValue BytecodeObject::VM_ResetAnimation(int argCount, VMValue* args, Uint32 threadID) {
+PUBLIC STATIC VMValue ScriptEntity::VM_ResetAnimation(int argCount, VMValue* args, Uint32 threadID) {
StandardLibrary::CheckArgCount(argCount, 3);
Entity* self = GET_ENTITY(0);
int animation = GET_ARG(1, GetInteger);
@@ -1057,7 +1057,7 @@ PUBLIC STATIC VMValue BytecodeObject::VM_ResetAnimation(int argCount, VMValue* a
* \desc Animates the entity.
* \ns Instance
*/
-PUBLIC STATIC VMValue BytecodeObject::VM_Animate(int argCount, VMValue* args, Uint32 threadID) {
+PUBLIC STATIC VMValue ScriptEntity::VM_Animate(int argCount, VMValue* args, Uint32 threadID) {
StandardLibrary::CheckArgCount(argCount, 1);
Entity* self = GET_ENTITY(0);
if (self)
@@ -1070,7 +1070,7 @@ PUBLIC STATIC VMValue BytecodeObject::VM_Animate(int argCount, VMValue* args, Ui
* \param registry (String): The registry name.
* \ns Instance
*/
-PUBLIC STATIC VMValue BytecodeObject::VM_AddToRegistry(int argCount, VMValue* args, Uint32 threadID) {
+PUBLIC STATIC VMValue ScriptEntity::VM_AddToRegistry(int argCount, VMValue* args, Uint32 threadID) {
StandardLibrary::CheckArgCount(argCount, 2);
Entity* self = GET_ENTITY(0);
char* registry = GET_ARG(1, GetString);
@@ -1097,7 +1097,7 @@ PUBLIC STATIC VMValue BytecodeObject::VM_AddToRegistry(int argCount, VMValue* ar
* \param registry (String): The registry name.
* \ns Instance
*/
-PUBLIC STATIC VMValue BytecodeObject::VM_RemoveFromRegistry(int argCount, VMValue* args, Uint32 threadID) {
+PUBLIC STATIC VMValue ScriptEntity::VM_RemoveFromRegistry(int argCount, VMValue* args, Uint32 threadID) {
StandardLibrary::CheckArgCount(argCount, 2);
Entity* self = GET_ENTITY(0);
char* registry = GET_ARG(1, GetString);
@@ -1121,7 +1121,7 @@ PUBLIC STATIC VMValue BytecodeObject::VM_RemoveFromRegistry(int argCount, VMValu
* \return
* \ns Instance
*/
-PUBLIC STATIC VMValue BytecodeObject::VM_ApplyMotion(int argCount, VMValue* args, Uint32 threadID) {
+PUBLIC STATIC VMValue ScriptEntity::VM_ApplyMotion(int argCount, VMValue* args, Uint32 threadID) {
StandardLibrary::CheckArgCount(argCount, 1);
Entity* self = GET_ENTITY(0);
if (self)
@@ -1139,7 +1139,7 @@ PUBLIC STATIC VMValue BytecodeObject::VM_ApplyMotion(int argCount, VMValue* args
* \return Returns true
if the specified positions and ranges are within the specified view, false
if otherwise.
* \ns Instance
*/
-PUBLIC STATIC VMValue BytecodeObject::VM_InView(int argCount, VMValue* args, Uint32 threadID) {
+PUBLIC STATIC VMValue ScriptEntity::VM_InView(int argCount, VMValue* args, Uint32 threadID) {
StandardLibrary::CheckArgCount(argCount, 6);
// Entity* self = (Entity*)AS_INSTANCE(args[0])->EntityPtr;
int view = GET_ARG(1, GetInteger);
@@ -1163,15 +1163,15 @@ PUBLIC STATIC VMValue BytecodeObject::VM_InView(int argCount, VMValue* args, Uin
* \return Returns the entity that was collided with, or null
if it did not collide with any entity.
* \ns Instance
*/
-PUBLIC STATIC VMValue BytecodeObject::VM_CollidedWithObject(int argCount, VMValue* args, Uint32 threadID) {
+PUBLIC STATIC VMValue ScriptEntity::VM_CollidedWithObject(int argCount, VMValue* args, Uint32 threadID) {
StandardLibrary::CheckArgCount(argCount, 2);
- BytecodeObject* self = GET_ENTITY(0);
+ ScriptEntity* self = GET_ENTITY(0);
if (!self)
return NULL_VAL;
if (IS_INSTANCE(args[1])) {
- BytecodeObject* other = GET_ENTITY(1);
+ ScriptEntity* other = GET_ENTITY(1);
if (!other)
return NULL_VAL;
if (TestEntityCollision(other, self))
@@ -1191,11 +1191,11 @@ PUBLIC STATIC VMValue BytecodeObject::VM_CollidedWithObject(int argCount, VMValu
if (self->HitboxW == 0.0f ||
self->HitboxH == 0.0f) return NULL_VAL;
- BytecodeObject* other = NULL;
+ ScriptEntity* other = NULL;
ObjectList* objectList = Scene::ObjectLists->Get(object);
- other = (BytecodeObject*)objectList->EntityFirst;
- for (Entity* next; other; other = (BytecodeObject*)next) {
+ other = (ScriptEntity*)objectList->EntityFirst;
+ for (Entity* next; other; other = (ScriptEntity*)next) {
next = other->NextEntityInList;
if (TestEntityCollision(other, self))
return OBJECT_VAL(other->Instance);
@@ -1212,9 +1212,9 @@ PUBLIC STATIC VMValue BytecodeObject::VM_CollidedWithObject(int argCount, VMValu
* \param hitbox (Integer): The hitbox ID.
* \ns Instance
*/
-PUBLIC STATIC VMValue BytecodeObject::VM_GetHitboxFromSprite(int argCount, VMValue* args, Uint32 threadID) {
+PUBLIC STATIC VMValue ScriptEntity::VM_GetHitboxFromSprite(int argCount, VMValue* args, Uint32 threadID) {
StandardLibrary::CheckArgCount(argCount, 5);
- BytecodeObject* self = GET_ENTITY(0);
+ ScriptEntity* self = GET_ENTITY(0);
ISprite* sprite = GET_ARG(1, GetSprite);
int animation = GET_ARG(2, GetInteger);
int frame = GET_ARG(3, GetInteger);
@@ -1261,9 +1261,9 @@ PUBLIC STATIC VMValue BytecodeObject::VM_GetHitboxFromSprite(int argCount, VMVal
* \return Returns an array containing the hitbox top, left, right and bottom sides in that order.
* \ns Instance
*/
-PUBLIC STATIC VMValue BytecodeObject::VM_ReturnHitboxFromSprite(int argCount, VMValue* args, Uint32 threadID) {
+PUBLIC STATIC VMValue ScriptEntity::VM_ReturnHitboxFromSprite(int argCount, VMValue* args, Uint32 threadID) {
StandardLibrary::CheckArgCount(argCount, 5);
- BytecodeObject* self = GET_ENTITY(0);
+ ScriptEntity* self = GET_ENTITY(0);
ISprite* sprite = GET_ARG(1, GetSprite);
int animation = GET_ARG(2, GetInteger);
int frame = GET_ARG(3, GetInteger);
@@ -1304,10 +1304,10 @@ PUBLIC STATIC VMValue BytecodeObject::VM_ReturnHitboxFromSprite(int argCount, VM
* \return Returns true
if the entity collided, false
if otherwise.
* \ns Instance
*/
-PUBLIC STATIC VMValue BytecodeObject::VM_CollideWithObject(int argCount, VMValue* args, Uint32 threadID) {
+PUBLIC STATIC VMValue ScriptEntity::VM_CollideWithObject(int argCount, VMValue* args, Uint32 threadID) {
StandardLibrary::CheckArgCount(argCount, 2);
- BytecodeObject* self = GET_ENTITY(0);
- BytecodeObject* other = GET_ENTITY(1);
+ ScriptEntity* self = GET_ENTITY(0);
+ ScriptEntity* other = GET_ENTITY(1);
if (!self || !other)
return NULL_VAL;
return INTEGER_VAL(self->CollideWithObject(other));
@@ -1319,10 +1319,10 @@ PUBLIC STATIC VMValue BytecodeObject::VM_CollideWithObject(int argCount, VMValue
* \return Returns true
if the entity collided, false
if otherwise.
* \ns Instance
*/
-PUBLIC STATIC VMValue BytecodeObject::VM_SolidCollideWithObject(int argCount, VMValue* args, Uint32 threadID) {
+PUBLIC STATIC VMValue ScriptEntity::VM_SolidCollideWithObject(int argCount, VMValue* args, Uint32 threadID) {
StandardLibrary::CheckArgCount(argCount, 3);
- BytecodeObject* self = GET_ENTITY(0);
- BytecodeObject* other = GET_ENTITY(1);
+ ScriptEntity* self = GET_ENTITY(0);
+ ScriptEntity* other = GET_ENTITY(1);
int flag = GET_ARG(2, GetInteger);
if (!self || !other)
return NULL_VAL;
@@ -1335,19 +1335,19 @@ PUBLIC STATIC VMValue BytecodeObject::VM_SolidCollideWithObject(int argCount, VM
* \return Returns true
if the entity collided, false
if otherwise.
* \ns Instance
*/
-PUBLIC STATIC VMValue BytecodeObject::VM_TopSolidCollideWithObject(int argCount, VMValue* args, Uint32 threadID) {
+PUBLIC STATIC VMValue ScriptEntity::VM_TopSolidCollideWithObject(int argCount, VMValue* args, Uint32 threadID) {
StandardLibrary::CheckArgCount(argCount, 3);
- BytecodeObject* self = GET_ENTITY(0);
- BytecodeObject* other = GET_ENTITY(1);
+ ScriptEntity* self = GET_ENTITY(0);
+ ScriptEntity* other = GET_ENTITY(1);
int flag = GET_ARG(2, GetInteger);
if (!self || !other)
return NULL_VAL;
return INTEGER_VAL(self->TopSolidCollideWithObject(other, flag));
}
-PUBLIC STATIC VMValue BytecodeObject::VM_ApplyPhysics(int argCount, VMValue* args, Uint32 threadID) {
+PUBLIC STATIC VMValue ScriptEntity::VM_ApplyPhysics(int argCount, VMValue* args, Uint32 threadID) {
StandardLibrary::CheckArgCount(argCount, 1);
- BytecodeObject* self = GET_ENTITY(0);
+ ScriptEntity* self = GET_ENTITY(0);
if (self)
self->ApplyPhysics();
return NULL_VAL;
@@ -1360,9 +1360,9 @@ PUBLIC STATIC VMValue BytecodeObject::VM_ApplyPhysics(int argCount, VMValue* arg
* \return Returns true
if the property exists, false
if otherwise.
* \ns Instance
*/
-PUBLIC STATIC VMValue BytecodeObject::VM_PropertyExists(int argCount, VMValue* args, Uint32 threadID) {
+PUBLIC STATIC VMValue ScriptEntity::VM_PropertyExists(int argCount, VMValue* args, Uint32 threadID) {
StandardLibrary::CheckArgCount(argCount, 2);
- BytecodeObject* self = GET_ENTITY(0);
+ ScriptEntity* self = GET_ENTITY(0);
char* property = GET_ARG(1, GetString);
if (self && self->Properties->Exists(property))
return INTEGER_VAL(1);
@@ -1375,9 +1375,9 @@ PUBLIC STATIC VMValue BytecodeObject::VM_PropertyExists(int argCount, VMValue* a
* \return Returns the property if it exists, and null
if the property does not exist.
* \ns Instance
*/
-PUBLIC STATIC VMValue BytecodeObject::VM_PropertyGet(int argCount, VMValue* args, Uint32 threadID) {
+PUBLIC STATIC VMValue ScriptEntity::VM_PropertyGet(int argCount, VMValue* args, Uint32 threadID) {
StandardLibrary::CheckArgCount(argCount, 2);
- BytecodeObject* self = GET_ENTITY(0);
+ ScriptEntity* self = GET_ENTITY(0);
char* property = GET_ARG(1, GetString);
if (!self || !self->Properties->Exists(property))
return NULL_VAL;
@@ -1391,9 +1391,9 @@ PUBLIC STATIC VMValue BytecodeObject::VM_PropertyGet(int argCount, VMValue* args
* \param visible (Boolean): Whether the entity will be visible or not on the specified view.
* \ns Instance
*/
-PUBLIC STATIC VMValue BytecodeObject::VM_SetViewVisibility(int argCount, VMValue* args, Uint32 threadID) {
+PUBLIC STATIC VMValue ScriptEntity::VM_SetViewVisibility(int argCount, VMValue* args, Uint32 threadID) {
StandardLibrary::CheckArgCount(argCount, 3);
- BytecodeObject* self = GET_ENTITY(0);
+ ScriptEntity* self = GET_ENTITY(0);
int viewIndex = GET_ARG(1, GetInteger);
bool visible = GET_ARG(2, GetInteger);
if (self) {
@@ -1412,9 +1412,9 @@ PUBLIC STATIC VMValue BytecodeObject::VM_SetViewVisibility(int argCount, VMValue
* \param visible (Boolean): Whether the entity will always be visible or not on the specified view.
* \ns Instance
*/
-PUBLIC STATIC VMValue BytecodeObject::VM_SetViewOverride(int argCount, VMValue* args, Uint32 threadID) {
+PUBLIC STATIC VMValue ScriptEntity::VM_SetViewOverride(int argCount, VMValue* args, Uint32 threadID) {
StandardLibrary::CheckArgCount(argCount, 3);
- BytecodeObject* self = GET_ENTITY(0);
+ ScriptEntity* self = GET_ENTITY(0);
int viewIndex = GET_ARG(1, GetInteger);
bool override = GET_ARG(2, GetInteger);
if (self) {
@@ -1433,9 +1433,9 @@ PUBLIC STATIC VMValue BytecodeObject::VM_SetViewOverride(int argCount, VMValue*
* \param drawGroup (Integer): The draw group.
* \ns Instance
*/
-PUBLIC STATIC VMValue BytecodeObject::VM_AddToDrawGroup(int argCount, VMValue* args, Uint32 threadID) {
+PUBLIC STATIC VMValue ScriptEntity::VM_AddToDrawGroup(int argCount, VMValue* args, Uint32 threadID) {
StandardLibrary::CheckArgCount(argCount, 2);
- BytecodeObject* self = GET_ENTITY(0);
+ ScriptEntity* self = GET_ENTITY(0);
int drawGroup = GET_ARG(1, GetInteger);
if (drawGroup >= 0 && drawGroup < Scene::PriorityPerLayer) {
if (!Scene::PriorityLists[drawGroup].Contains(self))
@@ -1452,9 +1452,9 @@ PUBLIC STATIC VMValue BytecodeObject::VM_AddToDrawGroup(int argCount, VMValue* a
* \return Returns true
if the entity is in the specified draw group, false
if otherwise.
* \ns Instance
*/
-PUBLIC STATIC VMValue BytecodeObject::VM_IsInDrawGroup(int argCount, VMValue* args, Uint32 threadID) {
+PUBLIC STATIC VMValue ScriptEntity::VM_IsInDrawGroup(int argCount, VMValue* args, Uint32 threadID) {
StandardLibrary::CheckArgCount(argCount, 2);
- BytecodeObject* self = GET_ENTITY(0);
+ ScriptEntity* self = GET_ENTITY(0);
int drawGroup = GET_ARG(1, GetInteger);
if (drawGroup >= 0 && drawGroup < Scene::PriorityPerLayer)
return INTEGER_VAL(!!(Scene::PriorityLists[drawGroup].Contains(self)));
@@ -1468,9 +1468,9 @@ PUBLIC STATIC VMValue BytecodeObject::VM_IsInDrawGroup(int argCount, VMValue* ar
* \param drawGroup (Integer): The draw group.
* \ns Instance
*/
-PUBLIC STATIC VMValue BytecodeObject::VM_RemoveFromDrawGroup(int argCount, VMValue* args, Uint32 threadID) {
+PUBLIC STATIC VMValue ScriptEntity::VM_RemoveFromDrawGroup(int argCount, VMValue* args, Uint32 threadID) {
StandardLibrary::CheckArgCount(argCount, 2);
- BytecodeObject* self = GET_ENTITY(0);
+ ScriptEntity* self = GET_ENTITY(0);
int drawGroup = GET_ARG(1, GetInteger);
if (drawGroup >= 0 && drawGroup < Scene::PriorityPerLayer)
Scene::PriorityLists[drawGroup].Remove(self);
@@ -1489,9 +1489,9 @@ PUBLIC STATIC VMValue BytecodeObject::VM_RemoveFromDrawGroup(int argCount, VMVal
* \return Returns the channel index where the sound began to play.
* \ns Instance
*/
-PUBLIC STATIC VMValue BytecodeObject::VM_PlaySound(int argCount, VMValue* args, Uint32 threadID) {
+PUBLIC STATIC VMValue ScriptEntity::VM_PlaySound(int argCount, VMValue* args, Uint32 threadID) {
StandardLibrary::CheckAtLeastArgCount(argCount, 2);
- BytecodeObject* self = GET_ENTITY(0);
+ ScriptEntity* self = GET_ENTITY(0);
ISound* audio = GET_ARG(1, GetSound);
float panning = GET_ARG_OPT(2, GetDecimal, 0.0f);
float speed = GET_ARG_OPT(3, GetDecimal, 1.0f);
@@ -1514,9 +1514,9 @@ PUBLIC STATIC VMValue BytecodeObject::VM_PlaySound(int argCount, VMValue* args,
* \return Returns the channel index where the sound began to play.
* \ns Instance
*/
-PUBLIC STATIC VMValue BytecodeObject::VM_LoopSound(int argCount, VMValue* args, Uint32 threadID) {
+PUBLIC STATIC VMValue ScriptEntity::VM_LoopSound(int argCount, VMValue* args, Uint32 threadID) {
StandardLibrary::CheckAtLeastArgCount(argCount, 2);
- BytecodeObject* self = GET_ENTITY(0);
+ ScriptEntity* self = GET_ENTITY(0);
ISound* audio = GET_ARG(1, GetSound);
int loopPoint = GET_ARG_OPT(2, GetInteger, 0);
float panning = GET_ARG_OPT(3, GetDecimal, 0.0f);
@@ -1535,9 +1535,9 @@ PUBLIC STATIC VMValue BytecodeObject::VM_LoopSound(int argCount, VMValue* args,
* \param sound (Integer): The sound index to interrupt.
* \ns Instance
*/
-PUBLIC STATIC VMValue BytecodeObject::VM_StopSound(int argCount, VMValue* args, Uint32 threadID) {
+PUBLIC STATIC VMValue ScriptEntity::VM_StopSound(int argCount, VMValue* args, Uint32 threadID) {
StandardLibrary::CheckArgCount(argCount, 2);
- BytecodeObject* self = GET_ENTITY(0);
+ ScriptEntity* self = GET_ENTITY(0);
ISound* audio = GET_ARG(1, GetSound);
if (self)
AudioManager::StopOriginSound((void*)self, audio);
@@ -1548,9 +1548,9 @@ PUBLIC STATIC VMValue BytecodeObject::VM_StopSound(int argCount, VMValue* args,
* \desc Stops all sounds the entity is playing.
* \ns Instance
*/
-PUBLIC STATIC VMValue BytecodeObject::VM_StopAllSounds(int argCount, VMValue* args, Uint32 threadID) {
+PUBLIC STATIC VMValue ScriptEntity::VM_StopAllSounds(int argCount, VMValue* args, Uint32 threadID) {
StandardLibrary::CheckArgCount(argCount, 1);
- BytecodeObject* self = GET_ENTITY(0);
+ ScriptEntity* self = GET_ENTITY(0);
if (self)
AudioManager::StopAllOriginSounds((void*)self);
return NULL_VAL;
diff --git a/source/Engine/Bytecode/ScriptManager.cpp b/source/Engine/Bytecode/ScriptManager.cpp
index a707a6d0..efd8da0a 100644
--- a/source/Engine/Bytecode/ScriptManager.cpp
+++ b/source/Engine/Bytecode/ScriptManager.cpp
@@ -1,5 +1,5 @@
#if INTERFACE
-need_t BytecodeObject;
+need_t ScriptEntity;
#include
#include
@@ -35,7 +35,7 @@ class ScriptManager {
#endif
#include
-#include
+#include
#include
#include
#include
@@ -746,7 +746,7 @@ PUBLIC STATIC Entity* ScriptManager::SpawnObject(const char* objectName) {
return nullptr;
}
- BytecodeObject* object = new BytecodeObject;
+ ScriptEntity* object = new ScriptEntity;
ObjInstance* instance = NewInstance(AS_CLASS(val));
object->Link(instance);
@@ -864,7 +864,7 @@ PUBLIC STATIC bool ScriptManager::LoadObjectClass(const char* objectName, boo
return true;
}
PUBLIC STATIC void ScriptManager::AddNativeObjectFunctions(ObjClass* klass) {
-#define DEF_NATIVE(name) ScriptManager::DefineNative(klass, #name, BytecodeObject::VM_##name)
+#define DEF_NATIVE(name) ScriptManager::DefineNative(klass, #name, ScriptEntity::VM_##name)
DEF_NATIVE(InView);
DEF_NATIVE(Animate);
DEF_NATIVE(ApplyPhysics);
diff --git a/source/Engine/Bytecode/StandardLibrary.cpp b/source/Engine/Bytecode/StandardLibrary.cpp
index 9ba89a3f..a4ea386a 100644
--- a/source/Engine/Bytecode/StandardLibrary.cpp
+++ b/source/Engine/Bytecode/StandardLibrary.cpp
@@ -15,7 +15,7 @@ class StandardLibrary {
#include
#include
#include
-#include
+#include
#include
#include
#include
@@ -5566,7 +5566,7 @@ VMValue Instance_Create(int argCount, VMValue* args, Uint32 threadID) {
return NULL_VAL;
}
- BytecodeObject* obj = (BytecodeObject*)objectList->Spawn();
+ ScriptEntity* obj = (ScriptEntity*)objectList->Spawn();
if (!obj) {
THROW_ERROR("Could not spawn object of class \"%s\"!", objectName);
return NULL_VAL;
@@ -5609,7 +5609,7 @@ VMValue Instance_GetNth(int argCount, VMValue* args, Uint32 threadID) {
}
ObjectList* objectList = Scene::ObjectLists->Get(objectName);
- BytecodeObject* object = (BytecodeObject*)objectList->GetNth(n);
+ ScriptEntity* object = (ScriptEntity*)objectList->GetNth(n);
if (object) {
return OBJECT_VAL(object->Instance);
@@ -5718,7 +5718,7 @@ VMValue Instance_GetNextInstance(int argCount, VMValue* args, Uint32 threadID) {
}
if (object)
- return OBJECT_VAL(((BytecodeObject*)object)->Instance);
+ return OBJECT_VAL(((ScriptEntity*)object)->Instance);
return NULL_VAL;
}
@@ -5739,7 +5739,7 @@ VMValue Instance_GetBySlotID(int argCount, VMValue* args, Uint32 threadID) {
// Search backwards
for (Entity* ent = Scene::ObjectLast; ent; ent = ent->PrevSceneEntity) {
if (ent->SlotID == slotID)
- return OBJECT_VAL(((BytecodeObject*)ent)->Instance);
+ return OBJECT_VAL(((ScriptEntity*)ent)->Instance);
}
return NULL_VAL;
@@ -5752,7 +5752,7 @@ VMValue Instance_GetBySlotID(int argCount, VMValue* args, Uint32 threadID) {
*/
VMValue Instance_DisableAutoAnimate(int argCount, VMValue* args, Uint32 threadID) {
CHECK_ARGCOUNT(1);
- BytecodeObject::DisableAutoAnimate = !!GET_ARG(0, GetInteger);
+ ScriptEntity::DisableAutoAnimate = !!GET_ARG(0, GetInteger);
return NULL_VAL;
}
// TODO: Finish these
@@ -5771,8 +5771,8 @@ VMValue Instance_Copy(int argCount, VMValue* args, Uint32 threadID) {
bool copyClass = argCount >= 3 ? !!GET_ARG(2, GetInteger) : true;
bool destroySrc = argCount >= 4 ? !!GET_ARG(3, GetInteger) : false;
- BytecodeObject* destEntity = (BytecodeObject*)destInstance->EntityPtr;
- BytecodeObject* srcEntity = (BytecodeObject*)srcInstance->EntityPtr;
+ ScriptEntity* destEntity = (ScriptEntity*)destInstance->EntityPtr;
+ ScriptEntity* srcEntity = (ScriptEntity*)srcInstance->EntityPtr;
if (destEntity && srcEntity)
srcEntity->Copy(destEntity, copyClass, destroySrc);
@@ -5792,7 +5792,7 @@ VMValue Instance_ChangeClass(int argCount, VMValue* args, Uint32 threadID) {
ObjInstance* instance = GET_ARG(0, GetInstance);
char* objectName = GET_ARG(1, GetString);
- BytecodeObject* self = (BytecodeObject*)instance->EntityPtr;
+ ScriptEntity* self = (ScriptEntity*)instance->EntityPtr;
if (!self)
return INTEGER_VAL(false);
@@ -9368,7 +9368,7 @@ VMValue Scene_GetDebugMode(int argCount, VMValue* args, Uint32 threadID) {
VMValue Scene_GetFirstInstance(int argCount, VMValue* args, Uint32 threadID) {
CHECK_ARGCOUNT(0);
- BytecodeObject* object = (BytecodeObject*)Scene::ObjectFirst;
+ ScriptEntity* object = (ScriptEntity*)Scene::ObjectFirst;
if (object) {
return OBJECT_VAL(object->Instance);
}
@@ -9384,7 +9384,7 @@ VMValue Scene_GetFirstInstance(int argCount, VMValue* args, Uint32 threadID) {
VMValue Scene_GetLastInstance(int argCount, VMValue* args, Uint32 threadID) {
CHECK_ARGCOUNT(0);
- BytecodeObject* object = (BytecodeObject*)Scene::ObjectLast;
+ ScriptEntity* object = (ScriptEntity*)Scene::ObjectLast;
if (object) {
return OBJECT_VAL(object->Instance);
}
diff --git a/source/Engine/Bytecode/VMThread.cpp b/source/Engine/Bytecode/VMThread.cpp
index ce2b5cc5..6ee57c79 100644
--- a/source/Engine/Bytecode/VMThread.cpp
+++ b/source/Engine/Bytecode/VMThread.cpp
@@ -32,7 +32,7 @@ class VMThread {
#endif
#include
-#include
+#include
#include
#include
#include
@@ -1296,7 +1296,7 @@ PUBLIC int VMThread::RunInstruction() {
break;
}
- BytecodeObject* objectStart = NULL;
+ ScriptEntity* objectStart = NULL;
int startIndex = 0;
// If in list,
@@ -1308,7 +1308,7 @@ PUBLIC int VMThread::RunInstruction() {
for (Entity* ent = objectList->EntityFirst; ent; ent = ent->NextEntityInList) {
if (ent->Active && ent->Interactable) {
- objectStart = (BytecodeObject*)ent;
+ objectStart = (ScriptEntity*)ent;
break;
}
}
@@ -1324,7 +1324,7 @@ PUBLIC int VMThread::RunInstruction() {
for (int o = 0; o < count; o++) {
Entity* ent = registry->GetNth(o);
if (ent && ent->Active && ent->Interactable) {
- objectStart = (BytecodeObject*)ent;
+ objectStart = (ScriptEntity*)ent;
startIndex = o;
break;
}
@@ -1380,7 +1380,7 @@ PUBLIC int VMThread::RunInstruction() {
Entity* objectNext = NULL;
for (Entity* ent = (Entity*)it.entityNext; ent; ent = ent->NextEntityInList) {
if (ent->Active && ent->Interactable) {
- objectNext = (BytecodeObject*)ent;
+ objectNext = (ScriptEntity*)ent;
break;
}
}
@@ -1397,7 +1397,7 @@ PUBLIC int VMThread::RunInstruction() {
// Backup original receiver
frame->WithReceiverStackTop[-1] = originalReceiver;
// Replace receiver
- BytecodeObject* object = (BytecodeObject*)it.entity;
+ ScriptEntity* object = (ScriptEntity*)it.entity;
frame->Slots[receiverSlot] = OBJECT_VAL(object->Instance);
}
}
@@ -1413,7 +1413,7 @@ PUBLIC int VMThread::RunInstruction() {
// Backup original receiver
frame->WithReceiverStackTop[-1] = originalReceiver;
// Replace receiver
- BytecodeObject* object = (BytecodeObject*)registry->GetNth(it.index);
+ ScriptEntity* object = (ScriptEntity*)registry->GetNth(it.index);
frame->Slots[receiverSlot] = OBJECT_VAL(object->Instance);
}
}
diff --git a/source/Engine/ResourceTypes/SceneFormats/HatchSceneReader.cpp b/source/Engine/ResourceTypes/SceneFormats/HatchSceneReader.cpp
index 992b92d3..e9420052 100644
--- a/source/Engine/ResourceTypes/SceneFormats/HatchSceneReader.cpp
+++ b/source/Engine/ResourceTypes/SceneFormats/HatchSceneReader.cpp
@@ -14,7 +14,7 @@ class HatchSceneReader {
#include
#include
-#include
+#include
#include
#include
#include
@@ -420,7 +420,7 @@ PRIVATE STATIC void HatchSceneReader::ReadEntities(Stream *r) {
// Spawn the object, if the class exists
ObjectList* objectList = Scene::GetStaticObjectList(objectName);
if (objectList->SpawnFunction) {
- BytecodeObject* obj = (BytecodeObject*)objectList->Spawn();
+ ScriptEntity* obj = (ScriptEntity*)objectList->Spawn();
if (!obj) {
HatchSceneReader::SkipEntityProperties(r, numProps);
continue;
diff --git a/source/Engine/ResourceTypes/SceneFormats/RSDKSceneReader.cpp b/source/Engine/ResourceTypes/SceneFormats/RSDKSceneReader.cpp
index b20fe3cc..30bba007 100644
--- a/source/Engine/ResourceTypes/SceneFormats/RSDKSceneReader.cpp
+++ b/source/Engine/ResourceTypes/SceneFormats/RSDKSceneReader.cpp
@@ -12,7 +12,7 @@ class RSDKSceneReader {
#include
#include
-#include
+#include
#include
#include
#include
@@ -438,7 +438,7 @@ PUBLIC STATIC bool RSDKSceneReader::ReadObjectDefinition(Stream* r, Entity** obj
}
if (PropertyHashes->Exists(argumentHashes[a])) {
- ((BytecodeObject*)obj)->Properties->Put(PropertyHashes->Get(argumentHashes[a]), val);
+ ((ScriptEntity*)obj)->Properties->Put(PropertyHashes->Get(argumentHashes[a]), val);
}
}
}
diff --git a/source/Engine/ResourceTypes/SceneFormats/TiledMapReader.cpp b/source/Engine/ResourceTypes/SceneFormats/TiledMapReader.cpp
index 2446f996..3a130cde 100644
--- a/source/Engine/ResourceTypes/SceneFormats/TiledMapReader.cpp
+++ b/source/Engine/ResourceTypes/SceneFormats/TiledMapReader.cpp
@@ -3,14 +3,13 @@
#include
class TiledMapReader {
public:
- // static bool Initialized;
};
#endif
#include
#include
-#include
+#include
#include
#include
#include
@@ -506,7 +505,7 @@ PUBLIC STATIC void TiledMapReader::Read(const char* sourceF, const char* parentF
ObjectList* objectList = Scene::GetStaticObjectList(object_type_string);
if (objectList->SpawnFunction) {
- BytecodeObject* obj = (BytecodeObject*)objectList->Spawn();
+ ScriptEntity* obj = (ScriptEntity*)objectList->Spawn();
if (!obj)
continue;
diff --git a/source/Engine/Scene.cpp b/source/Engine/Scene.cpp
index e7a42978..aeea6ac2 100644
--- a/source/Engine/Scene.cpp
+++ b/source/Engine/Scene.cpp
@@ -140,7 +140,7 @@ class Scene {
#include
#include
-#include
+#include
#include
#include
#include
@@ -1739,7 +1739,7 @@ PRIVATE STATIC void Scene::AddStaticClass() {
obj->List = StaticObjectList;
obj->Persistence = Persistence_GAME;
- ScriptManager::Globals->Put("global", OBJECT_VAL(((BytecodeObject*)obj)->Instance));
+ ScriptManager::Globals->Put("global", OBJECT_VAL(((ScriptEntity*)obj)->Instance));
}
StaticObject = obj;
diff --git a/tools/HatchDocGen.exe b/tools/HatchDocGen.exe
index 67b610bb..fd15d6ac 100644
Binary files a/tools/HatchDocGen.exe and b/tools/HatchDocGen.exe differ