]> git.xonotic.org Git - xonotic/gmqcc.git/blob - data/frames.qc
setting data/frames.qc right again
[xonotic/gmqcc.git] / data / frames.qc
1 /* this is the WIP test for the parser...
2  * constantly adding stuff here to see if things break
3  */
4 void(string)        print  = #1;
5 void(string,string) print2 = #1;
6 void(string,string,string) print3 = #1;
7 string(float)       ftos   = #2;
8 entity()            spawn  = #3;
9 void(entity)        kill   = #4;
10
11 $frame stand1 stand2 standX
12 .float  frame;
13 .float  nextthink;
14 .void() think;
15
16 entity self;
17 float  time;
18
19 void() stand2;
20 void() stand1 = [ 0, stand2 ] {
21     // expands to:
22     //self.frame = 0;
23     //self.nextthink = time + 0.1;
24     //self.think = stand2
25     print("In stand 1...\n");
26     print3("--> self.frame should be 0, is ", ftos(self.frame), "\n");
27 };
28
29 void() stand2 = [ 1, stand1 ] {
30     print("In stand 2...\n");
31     print3("--> self.frame should be 1, is ", ftos(self.frame), "\n");
32 };
33
34 void() standm = {
35     local string bar;
36     bar = ftos(self);
37     print3("Foo ", ftos(self), "\n");
38     self.frame = 0;
39     self.nextthink = time + 0.1;
40 };
41
42 void() main = {
43     self = spawn();
44
45     time = 10;
46
47     print("Setting think\n");
48     self.think = stand1;
49
50     print("Running think\n");
51     standm();
52     print("Running from 'self'\n");
53     self.think();
54     self.think();
55     self.think();
56 };