quakeforge/tools/qwaq/main.qc

146 lines
2.4 KiB
C++
Raw Normal View History

#define NIT_TESLA 32768 //The *real* bug zapper!
#define NIT_SECURITY_CAMERA 65536 //CH Security Camera
#define NIT_TELEPORTER 131072 //CH Teleporter
#define PC_ENGINEER_TF_ITEMS NIT_TESLA | NIT_SECURITY_CAMERA | NIT_TELEPORTER
//float messed_or = PC_ENGINEER_TF_ITEMS;
float foo = 1;
float bar = 1;
float snafu = 2;
2001-08-20 22:16:07 +00:00
float negative = - - - - - - -2;
void () eek;
float (float a, float b) boing;
float () main =
{/*
local float messed_or;
Initial integer type support. qfcc /is/ partially broken when it comes to integer constants and float function args/return values. pr_comp.h: o add the integer opcodes to pr_opcode_e pr_edict.c: o add "quaternion" and "integer" to type_name[] o support quatnernion and integers types when printing values o support the integer opcodes when bounds checking pr_exec.c o enable the integer opcodes pr_opcode: o add the integer opcodes to the opcode table o logical operators all result in an integer rather than a value expr.h: o rename int_val to integer_val qfcc.h: o kill another magic number expr.c: o move the opcode to string conversion out of type_mismatch and into get_op_string o rename int_val to integer_val o general integer type support. o generate an internal comipiler error for null opcodes rather than segging. pr_imm.c: o rename int_val to integer_val o support integer constants, converting to float when needed. pr_lex.c: o magic number death and support quaternions and integers in type_size[] qc-lex.l o rename int_val to integer_val o support quaternion and integer type keywords qc-parse.y: o rename int_val to integer_val o use binary_expr instead of new_binary_expr for local initialized variables builtins.c: o rename int_val to integer_val o fix most (all?) of the INT related FIXMEs defs.qc: o use integer instead of float where it makes sense main.c: o read_result is now integer rather than float main.qc: o float -> integer where appropriate o new test for int const to float arg
2001-07-23 01:31:22 +00:00
local integer handle;
local string buffer;
traceon();
messed_or = PC_ENGINEER_TF_ITEMS;
handle = open ("main.qc", 0);
if (handle == -1) {
print (strerror (errno ()) + "\n");
return 1;
}
do {
buffer = read (handle, 1024);
if (read_result == -1) {
print (strerror (errno ()) + "\n");
return 1;
}
print (buffer);
} while (read_result == 1024);
close (handle);
eek ();
traceon();
local float foo = 0;
foo += 1;
foo *= 3;
foo -= 5;
foo &= 11;
foo /= 3;
foo ^= 1;
foo |= 7;
foo <<= 3;
foo >>= 1;
local integer bar;
bar = 12 % 5;
bar %= 3;
foo %= 5;
return foo;*/
traceon ();
boing (boing (1, 2), boing (3, 4));
boing (boing (0, 2), boing (3, -3));
return 0;
};
float () baz =
{
return foo + bar;
};
2001-06-08 22:54:34 +00:00
void (float x) test =
{
local string str;
Initial integer type support. qfcc /is/ partially broken when it comes to integer constants and float function args/return values. pr_comp.h: o add the integer opcodes to pr_opcode_e pr_edict.c: o add "quaternion" and "integer" to type_name[] o support quatnernion and integers types when printing values o support the integer opcodes when bounds checking pr_exec.c o enable the integer opcodes pr_opcode: o add the integer opcodes to the opcode table o logical operators all result in an integer rather than a value expr.h: o rename int_val to integer_val qfcc.h: o kill another magic number expr.c: o move the opcode to string conversion out of type_mismatch and into get_op_string o rename int_val to integer_val o general integer type support. o generate an internal comipiler error for null opcodes rather than segging. pr_imm.c: o rename int_val to integer_val o support integer constants, converting to float when needed. pr_lex.c: o magic number death and support quaternions and integers in type_size[] qc-lex.l o rename int_val to integer_val o support quaternion and integer type keywords qc-parse.y: o rename int_val to integer_val o use binary_expr instead of new_binary_expr for local initialized variables builtins.c: o rename int_val to integer_val o fix most (all?) of the INT related FIXMEs defs.qc: o use integer instead of float where it makes sense main.c: o read_result is now integer rather than float main.qc: o float -> integer where appropriate o new test for int const to float arg
2001-07-23 01:31:22 +00:00
local integer urk = 0;
2001-06-08 22:54:34 +00:00
if (urk) {
urk = foo || snafu;
} else {
print ("owie");
}
2001-06-08 22:54:34 +00:00
};
2001-06-27 21:15:15 +00:00
void () blarg =
{
local float foo = -1;
local float bar;
2001-07-25 21:48:20 +00:00
local entity te;
while (te) {
if (bar)
bar = 0;
}
2001-06-27 21:15:15 +00:00
do {
foo = 1;
} while (foo);
if (bar = foo);
foo = 2;
2001-07-15 01:49:24 +00:00
while (foo) {
bar = foo;
}
2001-06-27 21:15:15 +00:00
};
float (float a, float b) boing =
{
return a ? a + b : b;
};
Initial integer type support. qfcc /is/ partially broken when it comes to integer constants and float function args/return values. pr_comp.h: o add the integer opcodes to pr_opcode_e pr_edict.c: o add "quaternion" and "integer" to type_name[] o support quatnernion and integers types when printing values o support the integer opcodes when bounds checking pr_exec.c o enable the integer opcodes pr_opcode: o add the integer opcodes to the opcode table o logical operators all result in an integer rather than a value expr.h: o rename int_val to integer_val qfcc.h: o kill another magic number expr.c: o move the opcode to string conversion out of type_mismatch and into get_op_string o rename int_val to integer_val o general integer type support. o generate an internal comipiler error for null opcodes rather than segging. pr_imm.c: o rename int_val to integer_val o support integer constants, converting to float when needed. pr_lex.c: o magic number death and support quaternions and integers in type_size[] qc-lex.l o rename int_val to integer_val o support quaternion and integer type keywords qc-parse.y: o rename int_val to integer_val o use binary_expr instead of new_binary_expr for local initialized variables builtins.c: o rename int_val to integer_val o fix most (all?) of the INT related FIXMEs defs.qc: o use integer instead of float where it makes sense main.c: o read_result is now integer rather than float main.qc: o float -> integer where appropriate o new test for int const to float arg
2001-07-23 01:31:22 +00:00
float (float baz) test_int =
{
2001-07-25 02:28:04 +00:00
return 1;
Initial integer type support. qfcc /is/ partially broken when it comes to integer constants and float function args/return values. pr_comp.h: o add the integer opcodes to pr_opcode_e pr_edict.c: o add "quaternion" and "integer" to type_name[] o support quatnernion and integers types when printing values o support the integer opcodes when bounds checking pr_exec.c o enable the integer opcodes pr_opcode: o add the integer opcodes to the opcode table o logical operators all result in an integer rather than a value expr.h: o rename int_val to integer_val qfcc.h: o kill another magic number expr.c: o move the opcode to string conversion out of type_mismatch and into get_op_string o rename int_val to integer_val o general integer type support. o generate an internal comipiler error for null opcodes rather than segging. pr_imm.c: o rename int_val to integer_val o support integer constants, converting to float when needed. pr_lex.c: o magic number death and support quaternions and integers in type_size[] qc-lex.l o rename int_val to integer_val o support quaternion and integer type keywords qc-parse.y: o rename int_val to integer_val o use binary_expr instead of new_binary_expr for local initialized variables builtins.c: o rename int_val to integer_val o fix most (all?) of the INT related FIXMEs defs.qc: o use integer instead of float where it makes sense main.c: o read_result is now integer rather than float main.qc: o float -> integer where appropriate o new test for int const to float arg
2001-07-23 01:31:22 +00:00
};
.entity owner;
entity sent;
void () eek =
{
2001-07-24 22:29:16 +00:00
local string bop = "";
2001-07-25 21:48:20 +00:00
local vector v = '1 2 3';
2001-07-27 20:56:16 +00:00
local float expr = v * '0 1 0';
2001-07-25 21:48:20 +00:00
traceon();
if (sent && sent.owner != self )
2001-07-18 06:37:59 +00:00
self.origin = '0 0 0';
self.origin = self.origin + '1 2 3';
Initial integer type support. qfcc /is/ partially broken when it comes to integer constants and float function args/return values. pr_comp.h: o add the integer opcodes to pr_opcode_e pr_edict.c: o add "quaternion" and "integer" to type_name[] o support quatnernion and integers types when printing values o support the integer opcodes when bounds checking pr_exec.c o enable the integer opcodes pr_opcode: o add the integer opcodes to the opcode table o logical operators all result in an integer rather than a value expr.h: o rename int_val to integer_val qfcc.h: o kill another magic number expr.c: o move the opcode to string conversion out of type_mismatch and into get_op_string o rename int_val to integer_val o general integer type support. o generate an internal comipiler error for null opcodes rather than segging. pr_imm.c: o rename int_val to integer_val o support integer constants, converting to float when needed. pr_lex.c: o magic number death and support quaternions and integers in type_size[] qc-lex.l o rename int_val to integer_val o support quaternion and integer type keywords qc-parse.y: o rename int_val to integer_val o use binary_expr instead of new_binary_expr for local initialized variables builtins.c: o rename int_val to integer_val o fix most (all?) of the INT related FIXMEs defs.qc: o use integer instead of float where it makes sense main.c: o read_result is now integer rather than float main.qc: o float -> integer where appropriate o new test for int const to float arg
2001-07-23 01:31:22 +00:00
test_int (1);
2001-07-24 22:29:16 +00:00
if (bop)
traceoff();
2001-07-25 21:48:20 +00:00
printf ("%v\n", v);
v = ~2 * v;
2001-07-25 21:48:20 +00:00
printf ("%v\n", v);
v = v * ~2;
2001-07-25 21:48:20 +00:00
printf ("%v\n", v);
v = -v;
printf ("%v\n", v);
2001-08-09 16:39:08 +00:00
printf ("%f %f %f\n", expr, expr ^ 3, ~expr);
};
2001-07-27 20:56:16 +00:00
void () assign = {
local float foo;
local float bar;
foo = bar;
foo = bar = 1;
foo = bar = bar + 1;
Initial integer type support. qfcc /is/ partially broken when it comes to integer constants and float function args/return values. pr_comp.h: o add the integer opcodes to pr_opcode_e pr_edict.c: o add "quaternion" and "integer" to type_name[] o support quatnernion and integers types when printing values o support the integer opcodes when bounds checking pr_exec.c o enable the integer opcodes pr_opcode: o add the integer opcodes to the opcode table o logical operators all result in an integer rather than a value expr.h: o rename int_val to integer_val qfcc.h: o kill another magic number expr.c: o move the opcode to string conversion out of type_mismatch and into get_op_string o rename int_val to integer_val o general integer type support. o generate an internal comipiler error for null opcodes rather than segging. pr_imm.c: o rename int_val to integer_val o support integer constants, converting to float when needed. pr_lex.c: o magic number death and support quaternions and integers in type_size[] qc-lex.l o rename int_val to integer_val o support quaternion and integer type keywords qc-parse.y: o rename int_val to integer_val o use binary_expr instead of new_binary_expr for local initialized variables builtins.c: o rename int_val to integer_val o fix most (all?) of the INT related FIXMEs defs.qc: o use integer instead of float where it makes sense main.c: o read_result is now integer rather than float main.qc: o float -> integer where appropriate o new test for int const to float arg
2001-07-23 01:31:22 +00:00
foo = self.nextthink = self.nextthink + 1.0;
self.frame = self.nextthink = self.nextthink + 1.0;
2001-07-25 21:48:20 +00:00
foo = self.nextthink = foo + 1.0;
self.nextthink = foo = foo + 1.0;
self.frame = self.nextthink = foo + 1.0;
foo = self.nextthink = foo;
self.frame = self.nextthink = foo;
};