Activity CSDKPlayerAnimState::CalcMainActivity()
{
	Activity idealActivity = ACT_DA_STAND_IDLE;

	if (ShouldUseAimInAnims())
		idealActivity = ACT_DA_STAND_AIM;
	else if (m_pSDKPlayer->IsWeaponReady())
		idealActivity = ACT_DA_STAND_READY;

	if (HandleWallClimb (idealActivity) ||
		HandleWallFlip (idealActivity) ||
		HandleDiving( idealActivity ) ||

		HandleJumping( idealActivity ) || 
#if defined ( SDK_USE_PRONE )
		//Tony; handle these before ducking !!
		HandleProneTransition( idealActivity ) ||
		HandleProne( idealActivity ) ||
#endif
		HandleRollTransition( idealActivity ) ||
		HandleSlideTransition( idealActivity ) ||
		HandleSliding( idealActivity ) ||
		HandleDucking( idealActivity ) || 
		HandleSwimming( idealActivity ) || 
		HandleDying( idealActivity ) 
#if defined ( SDK_USE_SPRINTING )
		|| HandleSprinting( idealActivity )
#endif
		)
	{
		// intentionally blank
	}
	else
	{
		HandleMoving( idealActivity );
	}

	ShowDebugInfo();

	// Client specific.
#ifdef CLIENT_DLL

	if ( anim_showmainactivity.GetBool() )
	{
		DebugShowActivity( idealActivity );
	}

#endif

	return idealActivity;
}
Exemplo n.º 2
0
void Engine_Display()
{
    if(!done)
    {
        glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);//| GL_ACCUM_BUFFER_BIT);

        engine_camera.apply();
        engine_camera.recalcClipPlanes();
        // GL_VERTEX_ARRAY | GL_COLOR_ARRAY
        if(screen_info.show_debuginfo)
        {
            ShowDebugInfo();
        }

        glFrontFace(GL_CW);

        renderer.genWorldList();
        renderer.drawList();

        //glDisable(GL_CULL_FACE);
        //Render_DrawAxis(10000.0);
        /*if(engine_world.character)
        {
            glPushMatrix();
            glTranslatef(engine_world.character->transform[12], engine_world.character->transform[13], engine_world.character->transform[14]);
            Render_DrawAxis(1000.0);
            glPopMatrix();
        }*/

        Gui_SwitchGLMode(1);
        {
            Gui_DrawNotifier();
            if(engine_world.character && main_inventory_manager)
            {
                Gui_DrawInventory();
            }
        }

        Gui_Render();
        Gui_SwitchGLMode(0);

        renderer.drawListDebugLines();

        SDL_GL_SwapWindow(sdl_window);
    }
}
Exemplo n.º 3
0
float CClockDriftMgr::AdjustFrameTime( float inputFrameTime )
{
	float flAdjustmentThisFrame = 0;
	float flAdjustmentPerSec = 0;
	if ( IsClockCorrectionEnabled() 
#if !defined( _XBOX ) && !defined( SWDS )
		 && !demoplayer->IsPlayingBack()
#endif
		)
	{
		// Get the clock difference in seconds.
		float flCurDiffInSeconds = GetCurrentClockDifference() * host_state.interval_per_tick;
		float flCurDiffInMS = flCurDiffInSeconds * 1000.0f;

		// Is the server ahead or behind us?
		if ( flCurDiffInMS > cl_clock_correction_adjustment_min_offset.GetFloat() )
		{
			flAdjustmentPerSec = -GetClockAdjustmentAmount( flCurDiffInMS );
			flAdjustmentThisFrame = inputFrameTime * flAdjustmentPerSec;
			flAdjustmentThisFrame = max( flAdjustmentThisFrame, -flCurDiffInSeconds );
		}
		else if ( flCurDiffInMS < -cl_clock_correction_adjustment_min_offset.GetFloat() )
		{
			flAdjustmentPerSec = GetClockAdjustmentAmount( -flCurDiffInMS );
			flAdjustmentThisFrame = inputFrameTime * flAdjustmentPerSec;
			flAdjustmentThisFrame = min( flAdjustmentThisFrame, -flCurDiffInSeconds );
		}

		if ( IsEngineThreaded() )
		{
			flAdjustmentThisFrame = -flCurDiffInSeconds;
		}

		AdjustAverageDifferenceBy( flAdjustmentThisFrame );
	}

	ShowDebugInfo( flAdjustmentPerSec );
	return inputFrameTime + flAdjustmentThisFrame;
}
Exemplo n.º 4
0
Activity CSDKPlayerAnimState::CalcMainActivity()
{
	Activity idealActivity = ACT_MP_STAND_IDLE;

	if ( HandleJumping( idealActivity ) || 
#if defined ( SDK_USE_PRONE )
		//Tony; handle these before ducking !!
		HandleProneTransition( idealActivity ) ||
		HandleProne( idealActivity ) ||
#endif
		HandleDucking( idealActivity ) || 
		HandleSwimming( idealActivity ) || 
		HandleDying( idealActivity ) 
#if defined ( SDK_USE_SPRINTING )
		|| HandleSprinting( idealActivity )
#endif
		)
	{
		// intentionally blank
	}
	else
	{
		HandleMoving( idealActivity );
	}

	ShowDebugInfo();

	// Client specific.
#ifdef CLIENT_DLL

	if ( anim_showmainactivity.GetBool() )
	{
		DebugShowActivity( idealActivity );
	}

#endif

	return idealActivity;
}
Exemplo n.º 5
0
void AHUD::PostRender()
{
	// Theres nothing we can really do without a canvas or a world - so leave now in that case
	if ( (GetWorld() == nullptr) || (Canvas == nullptr))
	{
		return;
	}
	// Set up delta time
	RenderDelta = GetWorld()->TimeSeconds - LastHUDRenderTime;

	if ( PlayerOwner != NULL )
	{
		// draw any debug text in real-time
		DrawDebugTextList();
	}

	if ( bShowDebugInfo )
	{
		if (DebugCanvas)
		{
			DebugCanvas->DisplayDebugManager.Initialize(DebugCanvas, GEngine->GetTinyFont(), FVector2D(4.f, 50.f));
			ShowDebugInfo(DebugCanvas->DisplayDebugManager.GetMaxCharHeightRef(), DebugCanvas->DisplayDebugManager.GetYPosRef());
		}
	}
	else if ( bShowHUD && FApp::CanEverRender() )
	{
		DrawHUD();
		
		// No need to do work to determine hit box candidates if there will never be any
		if (HitBoxMap.Num() > 0)
		{
			ULocalPlayer* LocalPlayer = GetOwningPlayerController() ? Cast<ULocalPlayer>(GetOwningPlayerController()->Player) : NULL;

			if (LocalPlayer && LocalPlayer->ViewportClient)
			{
				TArray<FVector2D> ContactPoints;

				if (!FSlateApplication::Get().IsFakingTouchEvents())
				{
					FVector2D MousePosition;
					if (LocalPlayer->ViewportClient->GetMousePosition(MousePosition))
					{
						ContactPoints.Add(MousePosition);
					}
				}

				for (int32 FingerIndex = 0; FingerIndex < EKeys::NUM_TOUCH_KEYS; ++FingerIndex)
				{
					FVector2D TouchLocation;
					bool bPressed = false;

					GetOwningPlayerController()->GetInputTouchState((ETouchIndex::Type)FingerIndex, TouchLocation.X, TouchLocation.Y, bPressed);

					if (bPressed)
					{
						ContactPoints.Add(TouchLocation);
					}
				}

				const FVector2D ContactPointOffset = GetCoordinateOffset();

				if (!ContactPointOffset.IsZero())
				{
					for (FVector2D& ContactPoint : ContactPoints)
					{
						ContactPoint += ContactPointOffset;
					}
				}
				UpdateHitBoxCandidates( MoveTemp(ContactPoints) );
			}
		}
		else if (HitBoxesOver.Num() > 0)
		{
			// We still need to dispatch any end cursor over messages even if we don't have any hitboxes anymore
			for (const FName HitBoxName : HitBoxesOver)
			{
				NotifyHitBoxEndCursorOver(HitBoxName);
			}
			HitBoxesOver.Reset();
		}
	}
	
	if( bShowHitBoxDebugInfo )
	{
		RenderHitBoxes( Canvas->Canvas );
	}

	DrawSafeZoneOverlay();

	LastHUDRenderTime = GetWorld()->TimeSeconds;
}