Skip to content

Commit

Permalink
Fixed work of dbg_show_ani_info console command
Browse files Browse the repository at this point in the history
The code for it was partially disabled. Not it's fully functional
disabled by default)
I changed the output for it to be more organized
Also I deleted IReceived and ICoincidenced variables that were just
unused
  • Loading branch information
Xottab-DUTY committed Jun 17, 2018
1 parent 6ba3e68 commit 83e98fb
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 54 deletions.
37 changes: 1 addition & 36 deletions src/xrGame/Actor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,6 @@ const u32 patch_frames = 50;
const float respawn_delay = 1.f;
const float respawn_auto = 7.f;

static float IReceived = 0;
static float ICoincidenced = 0;
extern float cammera_into_collision_shift;

string32 ACTOR_DEFS::g_quick_use_slots[4] = {NULL, NULL, NULL, NULL};
Expand Down Expand Up @@ -1459,46 +1457,13 @@ bool CActor::use_default_throw_force()
}

float CActor::missile_throw_force() { return 0.f; }
#ifdef DEBUG
extern BOOL g_ShowAnimationInfo;
#endif // DEBUG
// HUD

// HUD
void CActor::OnHUDDraw(CCustomHUD*)
{
R_ASSERT(IsFocused());
if (!((mstate_real & mcLookout) && !IsGameTypeSingle()))
g_player_hud->render_hud();

#if 0 // ndef NDEBUG
if (Level().CurrentControlEntity() == this && g_ShowAnimationInfo)
{
string128 buf;
UI().Font().pFontStat->SetColor (0xffffffff);
UI().Font().pFontStat->OutSet (170,530);
UI().Font().pFontStat->OutNext ("Position: [%3.2f, %3.2f, %3.2f]",VPUSH(Position()));
UI().Font().pFontStat->OutNext ("Velocity: [%3.2f, %3.2f, %3.2f]",VPUSH(m_PhysicMovementControl->GetVelocity()));
UI().Font().pFontStat->OutNext ("Vel Magnitude: [%3.2f]",m_PhysicMovementControl->GetVelocityMagnitude());
UI().Font().pFontStat->OutNext ("Vel Actual: [%3.2f]",m_PhysicMovementControl->GetVelocityActual());
switch (m_PhysicMovementControl->Environment())
{
case CPHMovementControl::peOnGround: xr_strcpy(buf,"ground"); break;
case CPHMovementControl::peInAir: xr_strcpy(buf,"air"); break;
case CPHMovementControl::peAtWall: xr_strcpy(buf,"wall"); break;
}
UI().Font().pFontStat->OutNext (buf);

if (IReceived != 0)
{
float Size = 0;
Size = UI().Font().pFontStat->GetSize();
UI().Font().pFontStat->SetSize(Size*2);
UI().Font().pFontStat->SetColor (0xffff0000);
UI().Font().pFontStat->OutNext ("Input : [%3.2f]", ICoincidenced/IReceived * 100.0f);
UI().Font().pFontStat->SetSize(Size);
};
};
#endif
}

void CActor::RenderIndicator(Fvector dpos, float r1, float r2, const ui_shader& IndShader)
Expand Down
50 changes: 32 additions & 18 deletions src/xrGame/ActorAnimation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ CMotion* FindMotionKeys(MotionID motion_ID, IRenderVisual* V)
}

#ifdef DEBUG
BOOL g_ShowAnimationInfo = TRUE;
BOOL g_ShowAnimationInfo = FALSE;
#endif // DEBUG
constexpr pcstr mov_state[] = {
"idle", "walk", "run", "sprint",
Expand Down Expand Up @@ -644,26 +644,40 @@ void CActor::g_SetAnimation(u32 mstate_rl)
#endif

#ifdef DEBUG
if ((Level().CurrentControlEntity() == this) && g_ShowAnimationInfo)
if (g_ShowAnimationInfo && Level().CurrentControlEntity() == this)
{
auto movement = character_physics_support()->movement();
auto pFontStat = UI().Font().pFontStat;
u32 color = pFontStat->GetColor();
pFontStat->SetColor(0xffffffff);
pFontStat->OutSet(170, 530);

string128 buf;
ConvState(mstate_rl, &buf);
UI().Font().pFontStat->OutNext("MSTATE: [%s]", buf);
/*
switch (m_PhysicMovementControl->Environment())
{
case CPHMovementControl::peOnGround: xr_strcpy(buf,"ground"); break;
case CPHMovementControl::peInAir: xr_strcpy(buf,"air"); break;
case CPHMovementControl::peAtWall: xr_strcpy(buf,"wall"); break;
}
UI().Font().pFontStat->OutNext (buf);
UI().Font().pFontStat->OutNext ("Accel [%3.2f, %3.2f, %3.2f]",VPUSH(NET_SavedAccel));
UI().Font().pFontStat->OutNext ("V [%3.2f, %3.2f,
%3.2f]",VPUSH(m_PhysicMovementControl->GetVelocity()));
UI().Font().pFontStat->OutNext ("vertex ID %d",ai_location().level_vertex_id());
Game().m_WeaponUsageStatistic->Draw();
*/
pFontStat->OutNext("Movement state: [%s]", buf);
switch (movement->Environment())
{
case CPHMovementControl::peOnGround:
pFontStat->OutNext("Movement environment: [OnGround]");
break;
case CPHMovementControl::peInAir:
pFontStat->OutNext("Movement environment: [InAir]");
break;
case CPHMovementControl::peAtWall:
pFontStat->OutNext("Movement environment: [AtWall]");
break;
}

pFontStat->OutNext("Vertex ID: [%d]", ai_location().level_vertex_id());
pFontStat->OutNext("Position: [%3.2f, %3.2f, %3.2f]", VPUSH(Position()));
pFontStat->OutNext("Accel: [%3.2f, %3.2f, %3.2f]", VPUSH(NET_SavedAccel));
pFontStat->OutNext("Velocity: [%3.2f, %3.2f, %3.2f]", VPUSH(movement->GetVelocity()));
pFontStat->OutNext("Vel Magnitude: [%3.2f]", movement->GetVelocityMagnitude());
pFontStat->OutNext("Vel Actual: [%3.2f]", movement->GetVelocityActual());

pFontStat->SetColor(color);

//Game().m_WeaponUsageStatistic->Draw();
};
#endif

Expand Down

0 comments on commit 83e98fb

Please sign in to comment.