prozac-qfcc/debug.qc

89 lines
2.5 KiB
C++
Raw Normal View History

2001-07-17 05:58:10 +00:00
/*
TeamFortress V2.1 22/12/96
TeamFortress Software
*/
#include "defs.qh"
2001-07-17 05:58:10 +00:00
float() CheckExistence;
entity(float gno) Findgoal;
//- OfN -
void (string msg) Real_RPrint;
2001-07-17 05:58:10 +00:00
void(entity who) MakeMeDebug;
//==============================================================
// A remove function which makes sure the entity hasn't already
// been removed, and that it isn't the NIL object.
#ifdef DEBUG
2001-07-17 05:58:10 +00:00
void(entity te) dremove =
{
if (!te)
2001-07-17 05:58:10 +00:00
{
RPrint("***BUG BUG BUG BUG BUG BUG BUG BUG BUG BUG***\n");
RPrint("WORLD has nearly been removed. Don't worry!\n");
RPrint("***BUG BUG BUG BUG BUG BUG BUG BUG BUG BUG***\n");
return;
}
if (te.classname == "player") //- OfN -
{
RPrint("***BUG BUG BUG BUG BUG BUG BUG BUG BUG BUG***\n");
RPrint("Player entity was going to be removed. Don't worry!\n");
RPrint("***BUG BUG BUG BUG BUG BUG BUG BUG BUG BUG***\n");
return;
}
#if 0
if (te.is_removed == TRUE)
2001-07-17 05:58:10 +00:00
{
RPrint("***BUG BUG BUG BUG BUG BUG BUG***\n");
RPrint(" Entity has been removed twice. \n");
RPrint("***BUG BUG BUG BUG BUG BUG BUG***\n");
return;
}
#endif
2001-07-17 05:58:10 +00:00
te.is_removed = TRUE;
2001-07-17 05:58:10 +00:00
remove(te);
};
#endif
2001-07-17 05:58:10 +00:00
//==============================================================
// A command which just dumps your current location to the screen
//- OfN
// any client can remotely debug the server after using impulse 195 if "allow_debug" is set to 1
// and its and admin
// then RPrints will be sprinted to him also
// i coded this cause i dont have access to console in prozac server and wanted to see the dprints
// all the dprints in the code were replaced with RPrints
void (string msg) Real_RPrint =
2001-07-17 05:58:10 +00:00
{
dprint(msg);
if (!debug_target)
2001-07-17 05:58:10 +00:00
return;
sprint(debug_target,PRINT_HIGH,msg);
2001-07-17 05:58:10 +00:00
};
void (float oneline) printtrace =
{
local string sep = oneline ? " " : "\n";
RPrint ("allsolid: " + ftos (trace_allsolid) + sep);
RPrint ("startsolid: " + ftos (trace_startsolid) + sep);
RPrint ("fraction: " + ftos (trace_fraction) + sep);
RPrint ("endpos: " + vtos (trace_endpos) + sep);
RPrint ("plane_normal: " + vtos (trace_plane_normal) + sep);
RPrint ("plane_dist: " + ftos (trace_plane_dist) + sep);
RPrint ("ent: " + (trace_ent ? trace_ent.classname : "no") + sep);
RPrint ("inopen: " + ftos (trace_inopen) + sep);
RPrint ("inwater: " + ftos (trace_inwater) + "\n");
2003-12-09 20:16:51 +00:00
if (trace_ent.solid == SOLID_NOT)
RPrint ("SV_Move on crack: clipped on SOLID_NOT.");
else if (trace_ent.solid == SOLID_TRIGGER)
RPrint ("SV_Move on crack: clipped on SOLID_TRIGGER.");
};