]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Cleanup self wrappers
authorTimePath <andrew.hardaker1995@gmail.com>
Sun, 22 May 2016 07:47:45 +0000 (17:47 +1000)
committerTimePath <andrew.hardaker1995@gmail.com>
Sun, 22 May 2016 07:47:45 +0000 (17:47 +1000)
qcsrc/client/main.qc
qcsrc/client/main.qh
qcsrc/lib/self.qh

index 7cbe6e125f14c5c7642bf8b3c039f4df2dc7ac70..4fc67a63d6a4c18916ec1167a70d09a20920badd 100644 (file)
@@ -379,19 +379,6 @@ float CSQC_InputEvent(int bInputType, float nPrimary, float nSecondary)
 // --------------------------------------------------------------------------
 // BEGIN OPTIONAL CSQC FUNCTIONS
 
-.void(entity) predraw_qc;
-void PreDraw_self()
-{
-       SELFPARAM();
-       if (this.predraw_qc) this.predraw_qc(this);
-}
-
-void setpredraw(entity this, void(entity) pdfunc)
-{
-       this.predraw = PreDraw_self;
-       this.predraw_qc = pdfunc;
-}
-
 void Ent_Remove(entity this);
 
 void Ent_RemovePlayerScore(entity this)
index 9d7c4068900967da4202dc23029f773d98566334..8601d26b589338b2dc8b18a342e0a68abc230396 100644 (file)
@@ -6,8 +6,6 @@
 // --------------------------------------------------------------------------
 // MENU Functionality
 
-void setpredraw(entity this, void(entity) pdfunc);
-
 // --------------------------------------------------------------------------
 // Onslaught
 
index 7822eefe3a64f779a0c2dee52fc310faa30576f6..ecb1d6fe563242f07583b5cb725842cfc8ea9272 100644 (file)
     #define WITHSELF(value, block) block
 #endif
 
-.void(entity this) selftouch;
-void touch_self() { SELFPARAM(); this.selftouch(this); }
-#define settouch(e, f) (e.touch = touch_self, e.selftouch = f)
+#define SELFWRAP(T, R) \
+    [[alias(#T)]] .R() __##T; \
+    .R(entity this) self##T; \
+    R T##_self() { SELFPARAM(); return this.self##T(this); }
 
-//.void(entity this) selfuse;
-//void use_self() { SELFPARAM(); this.selfuse(this); }
-//#define setuse(e, f) (e.use = use_self, e.selfuse = f)
+noref entity _selftemp;
+#define SELFWRAP_SET(T, e, f) \
+    (_selftemp = (e), _selftemp.__##T = T##_self, _selftemp.self##T = f)
 
-.void(entity this) selfthink;
-void think_self() { SELFPARAM(); this.selfthink(this); }
-#define setthink(e, f) (e.think = think_self, e.selfthink = f)
+SELFWRAP(think, void)
+#define setthink(e, f) SELFWRAP_SET(think, e, f)
+
+SELFWRAP(touch, void)
+#define settouch(e, f) SELFWRAP_SET(touch, e, f)
+
+SELFWRAP(predraw, void)
+#define setpredraw(e, f) SELFWRAP_SET(predraw, e, f)