+#if defined(CSQC)
+#elif defined(MENUQC)
+#elif defined(SVQC)
+ #include "../dpdefs/progsdefs.qc"
+ #include "../dpdefs/dpextensions.qc"
+ #include "sys-post.qh"
+ #include "../warpzonelib/mathlib.qh"
+ #include "../warpzonelib/common.qh"
+ #include "../warpzonelib/util_server.qh"
+ #include "../common/constants.qh"
+ #include "../common/util.qh"
+ #include "../common/weapons/weapons.qh"
+ #include "constants.qh"
+ #include "defs.qh"
+ #include "../common/notifications.qh"
+ #include "../common/deathtypes.qh"
+ #include "command/common.qh"
+ #include "../csqcmodellib/sv_model.qh"
+#endif
+
.float dmgtime2;
void generic_plat_blocked()
{
tmin = self.absmin + '25 25 0';
tmax = self.absmax - '25 25 -8';
- tmin_z = tmax_z - (self.pos1_z - self.pos2_z + 8);
+ tmin_z = tmax.z - (self.pos1_z - self.pos2_z + 8);
if (self.spawnflags & PLAT_LOW_TRIGGER)
- tmax_z = tmin_z + 8;
+ tmax_z = tmin.z + 8;
- if (self.size_x <= 50)
+ if (self.size.x <= 50)
{
- tmin_x = (self.mins_x + self.maxs_x) / 2;
- tmax_x = tmin_x + 1;
+ tmin_x = (self.mins.x + self.maxs.x) / 2;
+ tmax_x = tmin.x + 1;
}
- if (self.size_y <= 50)
+ if (self.size.y <= 50)
{
- tmin_y = (self.mins_y + self.maxs_y) / 2;
- tmax_y = tmin_y + 1;
+ tmin_y = (self.mins.y + self.maxs.y) / 2;
+ tmax_y = tmin.y + 1;
}
- if(tmin_x < tmax_x)
- if(tmin_y < tmax_y)
- if(tmin_z < tmax_z)
+ if(tmin.x < tmax.x)
+ if(tmin.y < tmax.y)
+ if(tmin.z < tmax.z)
{
setsize (trigger, tmin, tmax);
return;
if(n > 2)
if(argv(2) == "force")
- return TRUE; // no checking, return immediately
+ return true; // no checking, return immediately
if(!cubic_speedfunc_is_sane(e.platmovetype_start, e.platmovetype_end))
{
objerror("Invalid platform move type; platform would go in reverse, which is not allowed.");
- return FALSE;
+ return false;
}
- return TRUE;
+ return true;
}
void spawnfunc_path_corner()
if (!self.lip)
self.lip = 16;
if (!self.height)
- self.height = self.size_z - self.lip;
+ self.height = self.size.z - self.lip;
self.pos1 = self.origin;
self.pos2 = self.origin;
- self.pos2_z = self.origin_z - self.height;
+ self.pos2_z = self.origin.z - self.height;
self.reset = plat_reset;
plat_reset();
else // linear movement
ang = targ.origin - (self.origin - self.view_ofs); // use the origin of the next path_corner
ang = vectoangles(ang);
- ang_x = -ang_x; // flip up / down orientation
+ ang_x = -ang.x; // flip up / down orientation
if(self.wait > 0) // slow turning
SUB_CalcAngleMove(ang, TSPEED_TIME, self.ltime - time + self.wait, train_wait);
else // instant turning
SUB_CalcAngleMove(ang, TSPEED_TIME, 0.0000001, train_wait);
- self.train_wait_turning = TRUE;
+ self.train_wait_turning = true;
return;
}
if(self.wait < 0 || self.train_wait_turning) // no waiting or we already waited while turning
{
- self.train_wait_turning = FALSE;
+ self.train_wait_turning = false;
train_next();
}
else
if (self.spawnflags & 2)
{
- self.platmovetype_turn = TRUE;
+ self.platmovetype_turn = true;
self.view_ofs = '0 0 0'; // don't offset a rotating train, origin works differently now
}
else
vector v;
self.nextthink = time + 0.1;
- if (!(self.owner.active == ACTIVE_ACTIVE))
+ if(self.owner.active != ACTIVE_ACTIVE)
{
self.owner.velocity = '0 0 0';
return;
// calculate sinewave using makevectors
makevectors((self.nextthink * self.owner.cnt + self.owner.phase * 360) * '0 1 0');
- v = self.owner.destvec + self.owner.movedir * v_forward_y;
+ v = self.owner.destvec + self.owner.movedir * v_forward.y;
if(self.owner.classname == "func_bobbing") // don't brake stuff if the func_bobbing was killtarget'ed
// * 10 so it will arrive in 0.1 sec
self.owner.velocity = (v - self.owner.origin) * 10;
// calculate sinewave using makevectors
makevectors((self.nextthink * self.owner.freq + self.owner.phase) * '0 360 0');
- v = self.owner.speed * v_forward_y + self.cnt;
+ v = self.owner.speed * v_forward.y + self.cnt;
if(self.owner.classname == "func_pendulum") // don't brake stuff if the func_bobbing was killtarget'ed
{
// * 10 so it will arrive in 0.1 sec
- self.owner.avelocity_z = (remainder(v - self.owner.angles_z, 360)) * 10;
+ self.owner.avelocity_z = (remainder(v - self.owner.angles.z, 360)) * 10;
}
}
if(!self.freq)
{
// find pendulum length (same formula as Q3A)
- self.freq = 1 / (M_PI * 2) * sqrt(autocvar_sv_gravity / (3 * max(8, fabs(self.mins_z))));
+ self.freq = 1 / (M_PI * 2) * sqrt(autocvar_sv_gravity / (3 * max(8, fabs(self.mins.z))));
}
// copy initial angle
- self.cnt = self.angles_z;
+ self.cnt = self.angles.z;
// wait for targets to spawn
controller = spawn();
void button_use()
{
- if (!(self.active == ACTIVE_ACTIVE))
+ if(self.active != ACTIVE_ACTIVE)
return;
self.enemy = activator;
"speed" override the default 40 speed
"wait" override the default 1 second wait (-1 = never return)
"lip" override the default 4 pixel lip remaining at end of move
-"health" if set, the button must be killed instead of touched. If set to -1, the button will fire on ANY attack, even damageless ones like the MinstaGib laser
+"health" if set, the button must be killed instead of touched. If set to -1, the button will fire on ANY attack, even damageless ones like the InstaGib laser
"sounds"
0) steam metal
1) wooden clunk
*/
float door_check_keys(void) {
- local entity door;
-
-
- if (self.owner)
- door = self.owner;
- else
- door = self;
+ entity door = self.owner ? self.owner : self;
// no key needed
if (!door.itemkeys)
- return TRUE;
+ return true;
// this door require a key
// only a player can have a key
if (!IS_PLAYER(other))
- return FALSE;
+ return false;
if (item_keys_usekey(door, other)) {
// some keys were used
if (other.key_door_messagetime <= time) {
play2(other, "misc/talk.wav");
- centerprint(other, strcat("You also need ", item_keys_keylist(door.itemkeys), "!"));
+ Send_Notification(NOTIF_ONE, other, MSG_CENTER, CENTER_DOOR_LOCKED_ALSONEED, item_keys_keylist(door.itemkeys));
other.key_door_messagetime = time + 2;
}
} else {
// no keys were used
if (other.key_door_messagetime <= time) {
play2(other, "misc/talk.wav");
- centerprint(other, strcat("You need ", item_keys_keylist(door.itemkeys), "!"));
+ Send_Notification(NOTIF_ONE, other, MSG_CENTER, CENTER_DOOR_LOCKED_NEED, item_keys_keylist(door.itemkeys));
other.key_door_messagetime = time + 2;
}
}
if (door.itemkeys) {
// door is now unlocked
play2(other, "misc/talk.wav");
- centerprint(other, "Door unlocked!");
- return TRUE;
+ Send_Notification(NOTIF_ONE, other, MSG_CENTER, CENTER_DOOR_UNLOCKED);
+ return true;
} else
- return FALSE;
+ return false;
}
if (!(self.owner.dmg) && (self.owner.message != ""))
{
if (IS_CLIENT(other))
- centerprint (other, self.owner.message);
+ centerprint(other, self.owner.message);
play2(other, "misc/talk.wav");
}
}
float LinkDoors_isconnected(entity e1, entity e2, entity pass)
{
float DELTA = 4;
- if (e1.absmin_x > e2.absmax_x + DELTA)
- return FALSE;
- if (e1.absmin_y > e2.absmax_y + DELTA)
- return FALSE;
- if (e1.absmin_z > e2.absmax_z + DELTA)
- return FALSE;
- if (e2.absmin_x > e1.absmax_x + DELTA)
- return FALSE;
- if (e2.absmin_y > e1.absmax_y + DELTA)
- return FALSE;
- if (e2.absmin_z > e1.absmax_z + DELTA)
- return FALSE;
- return TRUE;
+ if (e1.absmin.x > e2.absmax.x + DELTA)
+ return false;
+ if (e1.absmin.y > e2.absmax.y + DELTA)
+ return false;
+ if (e1.absmin.z > e2.absmax.z + DELTA)
+ return false;
+ if (e2.absmin.x > e1.absmax.x + DELTA)
+ return false;
+ if (e2.absmin.y > e1.absmax.y + DELTA)
+ return false;
+ if (e2.absmin.z > e1.absmax.z + DELTA)
+ return false;
+ return true;
}
/*
self.targetname = t.targetname;
if((t.message != "") && (self.message == ""))
self.message = t.message;
- if (t.absmin_x < cmins_x)
- cmins_x = t.absmin_x;
- if (t.absmin_y < cmins_y)
- cmins_y = t.absmin_y;
- if (t.absmin_z < cmins_z)
- cmins_z = t.absmin_z;
- if (t.absmax_x > cmaxs_x)
- cmaxs_x = t.absmax_x;
- if (t.absmax_y > cmaxs_y)
- cmaxs_y = t.absmax_y;
- if (t.absmax_z > cmaxs_z)
- cmaxs_z = t.absmax_z;
+ if (t.absmin.x < cmins.x)
+ cmins_x = t.absmin.x;
+ if (t.absmin.y < cmins.y)
+ cmins_y = t.absmin.y;
+ if (t.absmin.z < cmins.z)
+ cmins_z = t.absmin.z;
+ if (t.absmax.x > cmaxs.x)
+ cmaxs_x = t.absmax.x;
+ if (t.absmax.y > cmaxs.y)
+ cmaxs_y = t.absmax.y;
+ if (t.absmax.z > cmaxs.z)
+ cmaxs_z = t.absmax.z;
if(t.enemy == self)
break;
}
}
// spawnflags require key (for now only func_door)
-#define SPAWNFLAGS_GOLD_KEY 8
-#define SPAWNFLAGS_SILVER_KEY 16
+const float SPAWNFLAGS_GOLD_KEY = 8;
+const float SPAWNFLAGS_SILVER_KEY = 16;
void spawnfunc_func_door()
{
// Quake 1 keys compatibility
else // Z
self.movedir = '0 1 0';
- if (self.angles_y==0) self.angles_y = 90;
+ if (self.angles_y ==0) self.angles_y = 90;
- self.movedir = self.movedir * self.angles_y;
+ self.movedir = self.movedir * self.angles.y;
self.angles = '0 0 0';
self.max_health = self.health;
string message_save;
self.health = 10000;
- self.bot_attack = TRUE;
+ self.bot_attack = true;
// exit if still moving around...
if (self.origin != self.oldorigin)
if (self.message)
{
if (IS_CLIENT(other))
- centerprint (other, self.message);
+ centerprint(other, self.message);
play2(other, "misc/talk.wav");
}
}
float n, i, t;
self.nextthink = time + 0.1;
- if (!(self.owner.active == ACTIVE_ACTIVE))
+ if(self.owner.active != ACTIVE_ACTIVE)
{
self.owner.velocity = '0 0 0';
return;
for(i = 0; i < n; ++i)
{
makevectors((t * stof(argv(i*5)) + stof(argv(i*5+1)) * 360) * '0 1 0');
- v = v + ('1 0 0' * stof(argv(i*5+2)) + '0 1 0' * stof(argv(i*5+3)) + '0 0 1' * stof(argv(i*5+4))) * self.owner.height * v_forward_y;
+ v = v + ('1 0 0' * stof(argv(i*5+2)) + '0 1 0' * stof(argv(i*5+3)) + '0 0 1' * stof(argv(i*5+4))) * self.owner.height * v_forward.y;
}
if(self.owner.classname == "func_fourier") // don't brake stuff if the func_fourier was killtarget'ed
{
self.nextthink = time + 0.1;
- if (!(self.owner.active == ACTIVE_ACTIVE))
+ if(self.owner.active != ACTIVE_ACTIVE)
{
self.owner.velocity = '0 0 0';
return;