#ifndef BASE_H
#define BASE_H
-#if defined(CSQC)
-#elif defined(MENUQC)
- #include "../../common/util-pre.qh"
- #include "../sys-pre.qh"
- #include "../../dpdefs/menudefs.qc"
- #include "../../dpdefs/keycodes.qc"
- #include "../sys-post.qh"
- #include "../config.qh"
- #include "../../warpzonelib/mathlib.qh"
- #include "../../common/util.qh"
- #include "../../common/test.qh"
-#elif defined(SVQC)
-#endif
+#define NULL (null_entity)
+#define world NULL
.string classname;
-entity Object_vtbl;
.string vtblname;
.entity vtblbase;
-// THIS LINE INTENTIONALLY LEFT BLANK
-entity spawnVtbl(entity e, entity b)
+entity spawnVtbl(entity this, entity base)
{
- entity v;
- v = spawn();
- copyentity(e, v);
- v.vtblname = v.classname;
- v.classname = "vtbl";
- if(b)
- v.vtblbase = b;
- else
- v.vtblbase = v;
- return v;
+ entity vtbl = spawn();
+ copyentity(this, vtbl);
+ vtbl.vtblname = vtbl.classname;
+ vtbl.classname = "vtbl";
+ vtbl.vtblbase = base ? base : vtbl; // Top level objects use vtbl as base
+ return vtbl;
}
-entity spawnObject()
+
+entity Object_vtbl;
+entity spawnObject(entity this, entity)
{
- entity e;
- e = spawn();
- e.classname = "Object";
- if(!Object_vtbl)
- Object_vtbl = spawnVtbl(e, null_entity);
- return e;
+ this = spawn();
+ this.classname = "Object";
+ if (!Object_vtbl) Object_vtbl = spawnVtbl(this, null_entity);
+ return this;
}
-#endif
\ No newline at end of file
+
+#define NEW(cname) (spawn##cname(null_entity, null_entity))
+
+#endif