]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/playerdemo.qc
Clean out self from some of the pathlib code
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / playerdemo.qc
index 5ca2c1ca99d4450c11ad86b526f23cfaa869ec74..3a01cb0756d93fbae542494e99e49948d6677783 100644 (file)
@@ -1,3 +1,4 @@
+#include "playerdemo.qh"
 #if defined(CSQC)
 #elif defined(MENUQC)
 #elif defined(SVQC)
 const float PLAYERDEMO_MODE_OFF = 0;
 const float PLAYERDEMO_MODE_READING = 1;
 const float PLAYERDEMO_MODE_WRITING = 2;
-void playerdemo_init()
-{SELFPARAM();
-       self.playerdemo_mode = PLAYERDEMO_MODE_OFF;
+void playerdemo_init(entity this)
+{
+       this.playerdemo_mode = PLAYERDEMO_MODE_OFF;
 }
-void playerdemo_shutdown()
-{SELFPARAM();
-       if(self.playerdemo_mode != PLAYERDEMO_MODE_OFF)
+void playerdemo_shutdown(entity this)
+{
+       if(this.playerdemo_mode != PLAYERDEMO_MODE_OFF)
        {
-               LOG_INFO("playerdemo: ", self.netname, " closed\n");
-               fclose(self.playerdemo_fh);
+               LOG_INFO("playerdemo: ", this.netname, " closed\n");
+               fclose(this.playerdemo_fh);
        }
-       self.playerdemo_mode = 0;
+       this.playerdemo_mode = 0;
 }
-void playerdemo_open_read(string f)
-{SELFPARAM();
-       playerdemo_shutdown();
-       self.playerdemo_mode = PLAYERDEMO_MODE_READING;
-       self.playerdemo_fh = fopen(f, FILE_READ);
-       self.playerdemo_starttime = time - 1;
-       self.playerdemo_time = stof(fgets(self.playerdemo_fh));
-       self.playerdemo_time += self.playerdemo_starttime;
-       self.movetype = MOVETYPE_NONE;
-       LOG_INFO("playerdemo: ", self.netname, " reading from ", f, "\n");
-}
-void playerdemo_open_write(string f)
-{SELFPARAM();
-       playerdemo_shutdown();
-       self.playerdemo_mode = PLAYERDEMO_MODE_WRITING;
-       self.playerdemo_fh = fopen(f, FILE_WRITE);
-       self.playerdemo_starttime = time - 1;
-       LOG_INFO("playerdemo: ", self.netname, " writing to ", f, "\n");
+void playerdemo_open_read(entity this, string f)
+{
+       playerdemo_shutdown(this);
+       this.playerdemo_mode = PLAYERDEMO_MODE_READING;
+       this.playerdemo_fh = fopen(f, FILE_READ);
+       this.playerdemo_starttime = time - 1;
+       this.playerdemo_time = stof(fgets(this.playerdemo_fh));
+       this.playerdemo_time += this.playerdemo_starttime;
+       this.movetype = MOVETYPE_NONE;
+       LOG_INFO("playerdemo: ", this.netname, " reading from ", f, "\n");
+}
+void playerdemo_open_write(entity this, string f)
+{
+       playerdemo_shutdown(this);
+       this.playerdemo_mode = PLAYERDEMO_MODE_WRITING;
+       this.playerdemo_fh = fopen(f, FILE_WRITE);
+       this.playerdemo_starttime = time - 1;
+       LOG_INFO("playerdemo: ", this.netname, " writing to ", f, "\n");
        LOG_INFO("WARNING: playerdemo file format is incomplete and not stable yet. DO NOT RELY ON IT!\n");
 }
 #define PLAYERDEMO_FIELD(func,t,f) func##t(f,#f);
@@ -58,12 +59,12 @@ void playerdemo_open_write(string f)
        PLAYERDEMO_FIELD(func,string,playerskin) \
        PLAYERDEMO_FIELD(func,float,frame) \
        PLAYERDEMO_FIELD(func,float,effects) \
-       PLAYERDEMO_FIELD(func,float,switchweapon) \
-       PLAYERDEMO_FIELD(func,float,BUTTON_ATCK) \
-       PLAYERDEMO_FIELD(func,float,BUTTON_ATCK2) \
-       PLAYERDEMO_FIELD(func,float,BUTTON_CROUCH) \
-       PLAYERDEMO_FIELD(func,float,BUTTON_HOOK) \
-       PLAYERDEMO_FIELD(func,float,BUTTON_USE) \
+       /* PLAYERDEMO_FIELD(func,float,switchweapon) */ \
+       PLAYERDEMO_FIELD(func,float,button0) /* TODO: PHYS_INPUT_BUTTON_ATCK */ \
+       PLAYERDEMO_FIELD(func,float,button3) /* TODO: PHYS_INPUT_BUTTON_ATCK2 */ \
+       PLAYERDEMO_FIELD(func,float,button5) /* TODO: PHYS_INPUT_BUTTON_CROUCH */ \
+       PLAYERDEMO_FIELD(func,float,button6) /* TODO: PHYS_INPUT_BUTTON_HOOK */ \
+       PLAYERDEMO_FIELD(func,float,buttonuse) /* TODO: PHYS_INPUT_BUTTON_USE */ \
        PLAYERDEMO_FIELD(func,float,flags) \
        // end of list
 
@@ -93,9 +94,9 @@ void playerdemo_write_float(.float f, string name)
 }
 void playerdemo_write()
 {SELFPARAM();
-       if(self.playerdemo_mode != PLAYERDEMO_MODE_WRITING)
+       if(this.playerdemo_mode != PLAYERDEMO_MODE_WRITING)
                return;
-       fputs(self.playerdemo_fh, strcat(ftos(time - self.playerdemo_starttime), "\n"));
+       fputs(this.playerdemo_fh, strcat(ftos(time - this.playerdemo_starttime), "\n"));
        PLAYERDEMO_FIELDS(playerdemo_write_)
 }
 void playerdemo_read_originvector(.vector f, string name)
@@ -146,9 +147,9 @@ float playerdemo_read(entity this)
                PLAYERDEMO_FIELDS(playerdemo_read_)
                {
                        time = this.playerdemo_time;
-                       WITH(entity, self, this, PlayerPreThink());
+                       WITHSELF(this, PlayerPreThink());
                        // not running physics though... this is just so we can run weapon stuff
-                       WITH(entity, self, this, PlayerPostThink());
+                       WITHSELF(this, PlayerPostThink());
                }
                this.playerdemo_time = stof(fgets(this.playerdemo_fh));
                if(this.playerdemo_time == 0)