#include "../lib/warpzone/anglestransform.qh"
#include "../lib/warpzone/util_server.qh"
-void CopyBody(float keepvelocity);
+void CopyBody(entity this, float keepvelocity);
#ifdef NOCHEATS
-float CheatImpulse(float i) { return 0; }
+float CheatImpulse(int imp) { return 0; }
float CheatCommand(float argc) { return 0; }
float CheatFrame() { return 0; }
void CheatInit() { cheatcount_total = world.cheatcount; }
void CheatShutdown() { }
-void CheatInitClient() { }
void CheatShutdownClient() { }
void Drag_MoveDrag(entity from, entity to) { }
{
}
-void CheatInitClient()
-{
-}
-
void CheatShutdownClient()
{
}
float CheatsAllowed(float i, float argc, float fr) // the cheat gets passed as argument for possible future ACL checking
{SELFPARAM();
// dead people cannot cheat
- if(self.deadflag != DEAD_NO)
+ if(IS_DEAD(self))
return 0;
if(gamestart_sv_cheats < 2 && !IS_PLAYER(self))
return 0;
// this one just has to exist
}
-float CheatImpulse(float i)
+float CheatImpulse(int imp)
{SELFPARAM();
BEGIN_CHEAT_FUNCTION();
- switch(i)
+ switch(imp)
{
entity e, e2;
self.personal.teleport_time = time;
break; // this part itself doesn't cheat, so let's not count this
case CHIMPULSE_CLONE_MOVING.impulse:
- IS_CHEAT(i, 0, 0);
+ IS_CHEAT(imp, 0, 0);
makevectors (self.v_angle);
self.velocity = self.velocity + v_forward * 300;
- CopyBody(1);
+ CopyBody(self, 1);
self.lip += 1;
self.velocity = self.velocity - v_forward * 300;
DID_CHEAT();
break;
case CHIMPULSE_CLONE_STANDING.impulse:
- IS_CHEAT(i, 0, 0);
- CopyBody(0);
+ IS_CHEAT(imp, 0, 0);
+ CopyBody(self, 0);
self.lip += 1;
DID_CHEAT();
break;
case CHIMPULSE_GIVE_ALL.impulse:
- IS_CHEAT(i, 0, 0);
+ IS_CHEAT(imp, 0, 0);
CheatCommand(tokenize_console("give all"));
break; // already counted as cheat
case CHIMPULSE_SPEEDRUN.impulse:
- IS_CHEAT(i, 0, 0);
+ IS_CHEAT(imp, 0, 0);
if(self.personal)
{
self.speedrunning = true;
DID_CHEAT();
break;
}
- if(self.deadflag != DEAD_NO)
+ if(IS_DEAD(self))
sprint(self, "UR DEAD AHAHAH))\n");
else
sprint(self, "No waypoint set, cheater (use g_waypointsprite_personal to set one)\n");
break;
case CHIMPULSE_TELEPORT.impulse:
- IS_CHEAT(i, 0, 0);
+ IS_CHEAT(imp, 0, 0);
if(self.movetype == MOVETYPE_NOCLIP)
{
e = find(world, classname, "info_autoscreenshot");
sprint(self, "Emergency teleport could not find a good location, forget it!\n");
break;
case CHIMPULSE_R00T.impulse:
- IS_CHEAT(i, 0, 0);
+ IS_CHEAT(imp, 0, 0);
RandomSelection_Init();
- FOR_EACH_PLAYER(e)
- if(e.deadflag == DEAD_NO)
- if(DIFF_TEAM(e, self))
- RandomSelection_Add(e, 0, string_null, 1, 1);
+ FOREACH_CLIENT(IS_PLAYER(it) && !IS_DEAD(it) && DIFF_TEAM(it, self), LAMBDA(RandomSelection_Add(it, 0, string_null, 1, 1)));
if(RandomSelection_chosen_ent)
e = RandomSelection_chosen_ent;
else
e.nextthink = time;
e.solid = 0; // nothing special
setmodel(e, MDL_MARKER);
- setsize(e, PL_MIN, PL_MAX);
+ setsize(e, STAT(PL_MIN, NULL), STAT(PL_MAX, NULL));
e.skin = 2;
if(argc == 3)
e.cnt = stof(argv(1));
draggee.draggravity = draggee.gravity;
draggee.movetype = MOVETYPE_WALK;
draggee.gravity = 0.00001;
- draggee.flags &= ~FL_ONGROUND;
+ UNSET_ONGROUND(draggee);
draggee.draggedby = dragger;
dragger.dragentity = draggee;
if((draggee.flags & FL_ITEM) && (vlen(draggee.velocity) < 32))
{
draggee.velocity = '0 0 0';
- draggee.flags |= FL_ONGROUND; // floating items are FUN
+ SET_ONGROUND(draggee); // floating items are FUN
}
}
entity draggee;
draggee = dragger.dragentity;
- draggee.flags &= ~FL_ONGROUND;
+ UNSET_ONGROUND(draggee);
curorigin = gettaginfo(draggee, 0);
curorigin = curorigin + v_forward * dragger.draglocalvector.x + v_right * dragger.draglocalvector.y + v_up * dragger.draglocalvector.z;
float Drag_CanDrag(entity dragger)
{
- return (dragger.deadflag == DEAD_NO) || (IS_PLAYER(dragger));
+ return (!IS_DEAD(dragger)) || (IS_PLAYER(dragger));
}
float Drag_IsDragging(entity dragger)