]> git.xonotic.org Git - xonotic/gmqcc.git/blob - data/fields.qc
data/fields.qc now tests fieldpointer parameters - requires -std=qcc to build
[xonotic/gmqcc.git] / data / fields.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 .float mema;
12 .float memb;
13 .vector memv;
14
15 void(entity a, .float f) printfield = {
16     print3("The field is ", ftos(a.f), "\n");
17 };
18
19 void() main = {
20     entity pawn;
21
22     pawn = spawn();
23
24     pawn.mema = 9;
25     pawn.memv = '1 2 3';
26     pawn.memb = 10;
27
28     print3("x = ", ftos(pawn.memv_x), "\n");
29     print3("y = ", ftos(pawn.memv_y), "\n");
30     print3("z = ", ftos(pawn.memv_z), "\n");
31     print3("a = ", ftos(pawn.mema), "\n");
32     print3("b = ", ftos(pawn.memb), "\n");
33     pawn.memv_y += 3;
34     print3("x = ", ftos(pawn.memv_x), "\n");
35     print3("y = ", ftos(pawn.memv_y), "\n");
36     print3("z = ", ftos(pawn.memv_z), "\n");
37     printfield(pawn, memv_z);
38 };