- disabled all the debug messages in P_AimLineAttack but left them in with a CVAR check so that the debug output can be reenabled, should some problem require it in the future.

This commit is contained in:
Christoph Oelckers 2016-03-03 13:31:21 +01:00
parent ec258c9588
commit b8abafb486

View file

@ -3436,6 +3436,8 @@ bool P_BounceActor(AActor *mo, AActor *BlockingMobj, bool ontop)
// //
//============================================================================ //============================================================================
CVAR(Bool, aimdebug, false, 0)
struct AimTarget : public FTranslatedLineTarget struct AimTarget : public FTranslatedLineTarget
{ {
angle_t pitch; angle_t pitch;
@ -3678,11 +3680,13 @@ struct aim_t
newtrace.startfrac = frac + FixedDiv(FRACUNIT, attackrange); // this is to skip the transition line to the portal which would produce a bogus opening newtrace.startfrac = frac + FixedDiv(FRACUNIT, attackrange); // this is to skip the transition line to the portal which would produce a bogus opening
newtrace.lastsector = P_PointInSector(newtrace.startpos.x + FixedMul(aimtrace.x, newtrace.startfrac) , newtrace.startpos.y + FixedMul(aimtrace.y, newtrace.startfrac)); newtrace.lastsector = P_PointInSector(newtrace.startpos.x + FixedMul(aimtrace.x, newtrace.startfrac) , newtrace.startpos.y + FixedMul(aimtrace.y, newtrace.startfrac));
newtrace.limitz = portal->threshold; newtrace.limitz = portal->threshold;
if (aimdebug)
Printf("-----Entering %s portal from sector %d to sector %d\n", position ? "ceiling" : "floor", lastsector->sectornum, newtrace.lastsector->sectornum); Printf("-----Entering %s portal from sector %d to sector %d\n", position ? "ceiling" : "floor", lastsector->sectornum, newtrace.lastsector->sectornum);
newtrace.AimTraverse(); newtrace.AimTraverse();
SetResult(linetarget, newtrace.linetarget); SetResult(linetarget, newtrace.linetarget);
SetResult(thing_friend, newtrace.thing_friend); SetResult(thing_friend, newtrace.thing_friend);
SetResult(thing_other, newtrace.thing_other); SetResult(thing_other, newtrace.thing_other);
if (aimdebug)
Printf("-----Exiting %s portal\n", position ? "ceiling" : "floor"); Printf("-----Exiting %s portal\n", position ? "ceiling" : "floor");
} }
@ -3716,6 +3720,7 @@ struct aim_t
newtrace.lastsector = P_PointInSector(x, y); newtrace.lastsector = P_PointInSector(x, y);
P_TranslatePortalZ(li, limitz); P_TranslatePortalZ(li, limitz);
if (aimdebug)
Printf("-----Entering line portal from sector %d to sector %d\n", lastsector->sectornum, newtrace.lastsector->sectornum); Printf("-----Entering line portal from sector %d to sector %d\n", lastsector->sectornum, newtrace.lastsector->sectornum);
newtrace.AimTraverse(); newtrace.AimTraverse();
SetResult(linetarget, newtrace.linetarget); SetResult(linetarget, newtrace.linetarget);
@ -3771,9 +3776,11 @@ struct aim_t
FPathTraverse it(startpos.x, startpos.y, aimtrace.x, aimtrace.y, PT_ADDLINES | PT_ADDTHINGS | PT_COMPATIBLE | PT_DELTA, startfrac); FPathTraverse it(startpos.x, startpos.y, aimtrace.x, aimtrace.y, PT_ADDLINES | PT_ADDTHINGS | PT_COMPATIBLE | PT_DELTA, startfrac);
intercept_t *in; intercept_t *in;
if (aimdebug)
Printf("Start AimTraverse, start = %f,%f,%f, vect = %f,%f,%f\n", Printf("Start AimTraverse, start = %f,%f,%f, vect = %f,%f,%f\n",
startpos.x / 65536., startpos.y / 65536., startpos.y / 65536., startpos.x / 65536., startpos.y / 65536., startpos.y / 65536.,
aimtrace.x / 65536., aimtrace.y / 65536.); aimtrace.x / 65536., aimtrace.y / 65536.);
while ((in = it.Next())) while ((in = it.Next()))
{ {
line_t* li; line_t* li;
@ -3791,6 +3798,7 @@ struct aim_t
li = in->d.line; li = in->d.line;
int frontflag = P_PointOnLineSidePrecise(startpos.x, startpos.y, li); int frontflag = P_PointOnLineSidePrecise(startpos.x, startpos.y, li);
if (aimdebug)
Printf("Found line %d: toppitch = %f, bottompitch = %f\n", int(li - lines), ANGLE2DBL(toppitch), ANGLE2DBL(bottompitch)); Printf("Found line %d: toppitch = %f, bottompitch = %f\n", int(li - lines), ANGLE2DBL(toppitch), ANGLE2DBL(bottompitch));
if (li->isLinePortal() && frontflag == 0) if (li->isLinePortal() && frontflag == 0)
@ -3834,6 +3842,7 @@ struct aim_t
if (!AimTraverse3DFloors(it.Trace(), in, frontflag, &planestocheck)) if (!AimTraverse3DFloors(it.Trace(), in, frontflag, &planestocheck))
return; return;
if (aimdebug)
Printf("After line %d: toppitch = %f, bottompitch = %f, planestocheck = %d\n", int(li - lines), ANGLE2DBL(toppitch), ANGLE2DBL(bottompitch), planestocheck); Printf("After line %d: toppitch = %f, bottompitch = %f, planestocheck = %d\n", int(li - lines), ANGLE2DBL(toppitch), ANGLE2DBL(bottompitch), planestocheck);
sector_t *entersec = frontflag ? li->frontsector : li->backsector; sector_t *entersec = frontflag ? li->frontsector : li->backsector;
@ -3990,12 +3999,14 @@ struct aim_t
if (sv_smartaim < 3) if (sv_smartaim < 3)
{ {
// don't autoaim at barrels and other shootable stuff unless no monsters have been found // don't autoaim at barrels and other shootable stuff unless no monsters have been found
if (aimdebug)
Printf("Hit other %s at %f,%f,%f\n", th->GetClass()->TypeName.GetChars(), th->X() / 65536., th->Y() / 65536., th->Z() / 65536.); Printf("Hit other %s at %f,%f,%f\n", th->GetClass()->TypeName.GetChars(), th->X() / 65536., th->Y() / 65536., th->Z() / 65536.);
SetResult(thing_other, in->frac, th, thingpitch); SetResult(thing_other, in->frac, th, thingpitch);
} }
} }
else else
{ {
if (aimdebug)
Printf("Hit target %s at %f,%f,%f\n", th->GetClass()->TypeName.GetChars(), th->X() / 65536., th->Y() / 65536., th->Z() / 65536.); Printf("Hit target %s at %f,%f,%f\n", th->GetClass()->TypeName.GetChars(), th->X() / 65536., th->Y() / 65536., th->Z() / 65536.);
SetResult(linetarget, in->frac, th, thingpitch); SetResult(linetarget, in->frac, th, thingpitch);
return; return;
@ -4003,6 +4014,7 @@ struct aim_t
} }
else else
{ {
if (aimdebug)
Printf("Hit target %s at %f,%f,%f\n", th->GetClass()->TypeName.GetChars(), th->X() / 65536., th->Y() / 65536., th->Z() / 65536.); Printf("Hit target %s at %f,%f,%f\n", th->GetClass()->TypeName.GetChars(), th->X() / 65536., th->Y() / 65536., th->Z() / 65536.);
SetResult(linetarget, in->frac, th, thingpitch); SetResult(linetarget, in->frac, th, thingpitch);
return; return;