]> git.xonotic.org Git - xonotic/gmqcc.git/blob - data/fields.qc
7c29959487dc5dcef9d3d9393cb2020b530c958b
[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() fun;
16
17 void(entity a, .float f) printfield = {
18     ftos(3+4);
19     print3("The field is ", ftos(a.f), "\n");
20 };
21
22 void() funny = {
23     print("FUNNY\n");
24 };
25
26 void() main = {
27     entity pawn;
28
29     pawn = spawn();
30
31     pawn.mema = 9;
32     pawn.memv = '1 2 3';
33     pawn.memb = 10;
34
35     print3("x = ", ftos(pawn.memv_x), "\n");
36     print3("y = ", ftos(pawn.memv_y), "\n");
37     print3("z = ", ftos(pawn.memv_z), "\n");
38     print3("a = ", ftos(pawn.mema), "\n");
39     print3("b = ", ftos(pawn.memb), "\n");
40     pawn.memv_y += 3;
41     print3("x = ", ftos(pawn.memv_x), "\n");
42     print3("y = ", ftos(pawn.memv_y), "\n");
43     print3("z = ", ftos(pawn.memv_z), "\n");
44     printfield(pawn, memv_z);
45
46     pawn.fun = funny;
47
48     (pawn.fun)();
49 };