text:
//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============//
//
// Purpose:
//
// $NoKeywords: $
//=============================================================================//
#include "cbase.h"
#include "prediction.h"
#include "igamemovement.h"
#include "prediction_private.h"
#include "ivrenderview.h"
#include "iinput.h"
#include "usercmd.h"
#include <vgui_controls/Controls.h>
#include <vgui/ISurface.h>
#include <vgui/IScheme.h>
#include "hud.h"
#include "IClientVehicle.h"
#include "in_buttons.h"
#include "con_nprint.h"
#include "hud_pdump.h"

#ifdef HL2_CLIENT_DLL
#include "c_basehlplayer.h"
#endif

#include "tier0/vprof.h"

// memdbgon must be the last include file in a .cpp file!!!
#include "tier0/memdbgon.h"

IPredictionSystem *IPredictionSystem::g_pPredictionSystems = NULL;

#if !defined( NO_ENTITY_PREDICTION )

#if defined(DOD_DLL) || defined(CSTRIKE_DLL)
	ConVar	cl_predict			( "cl_predict","1", FCVAR_USERINFO | FCVAR_CHEAT, "Perform client side prediction." );
#else
	ConVar	cl_predict			( "cl_predict","1", FCVAR_USERINFO, "Perform client side prediction." );
#endif

ConVar	cl_predictweapons	( "cl_predictweapons","1", FCVAR_USERINFO, "Perform client side prediction of weapon effects." );
ConVar	cl_lagcompensation	( "cl_lagcompensation","1", FCVAR_USERINFO, "Perform server side lag compensation of weapon firing events." );
ConVar	cl_showerror		( "cl_showerror", "0", FCVAR_CHEAT, "Show prediction errors, 2 for above plus detailed field deltas." );

static ConVar	cl_idealpitchscale	( "cl_idealpitchscale", "0.8", FCVAR_ARCHIVE );
static ConVar	cl_predictionlist	( "cl_predictionlist", "0", FCVAR_CHEAT, "Show which entities are predicting\n" );

static ConVar	cl_predictionentitydump( "cl_pdump", "-1", FCVAR_CHEAT, "Dump info about this entity to screen." );
static ConVar	cl_predictionentitydumpbyclass( "cl_pclass", "", FCVAR_CHEAT, "Dump entity by prediction classname." );
static ConVar	cl_pred_optimize( "cl_pred_optimize", "2", 0, "Optimize for not copying data if didn't receive a network update (1), and also for not repredicting if there were no errors (2)." );

#endif

extern IGameMovement *g_pGameMovement;
extern CMoveData *g_pMoveData;

void COM_Log( char *pszFile, char *fmt, ...);
typedescription_t *FindFieldByName( const char *fieldname, datamap_t *dmap );

#if !defined( NO_ENTITY_PREDICTION )
//-----------------------------------------------------------------------------
// Purpose: For debugging, find predictable by classname
// Input  : *classname -
// Output : static C_BaseEntity
//-----------------------------------------------------------------------------
static C_BaseEntity *FindPredictableByGameClass( const char *classname )
{
	// Walk backward due to deletion from UtlVector
	int c = predictables->GetPredictableCount();
	int i;
	for ( i = 0; i < c; i++ )
	{
		C_BaseEntity *ent = predictables->GetPredictable( i );
		if ( !ent )
			continue;

		// Don't do anything to truly predicted things (like player and weapons )
		if ( !FClassnameIs( ent, classname ) )
			continue;

		return ent;
	}

	return NULL;
}
#endif

//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
CPrediction::CPrediction( void )
{
#if !defined( NO_ENTITY_PREDICTION )
	m_bInPrediction = false;
	m_bFirstTimePredicted = false;

	m_nIncomingPacketNumber = 0;
	m_flIdealPitch = 0.0f;

	m_nPreviousStartFrame = -1;

	m_nCommandsPredicted = 0;
	m_nServerCommandsAcknowledged = 0;
	m_bPreviousAckHadErrors = false;
#endif
}

CPrediction::~CPrediction( void )
{
}

void CPrediction::Init( void )
{
#if !defined( NO_ENTITY_PREDICTION )
	m_bOldCLPredictValue = cl_predict.GetBool();
#endif
}

void CPrediction::Shutdown( void )
{
}

//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------

void CPrediction::CheckError( int commands_acknowledged )
{
#if !defined( NO_ENTITY_PREDICTION )
	C_BasePlayer	*player;
	Vector		origin;
	Vector		delta;
	float		len;
	static int	pos = 0;

	// Not in the game yet
	if ( !engine->IsInGame() )
		return;

	// Not running prediction
	if ( !cl_predict.GetInt() )
		return;

	player = C_BasePlayer::GetLocalPlayer();
	if ( !player )
		return;

	// Not predictable yet (flush entity packet?)
	if ( !player->IsIntermediateDataAllocated() )
		return;

	origin = player->GetNetworkOrigin();

	const void *slot = player->GetPredictedFrame( commands_acknowledged - 1 );
	if ( !slot )
		return;

	// Find the origin field in the database
	typedescription_t *td = FindFieldByName( "m_vecNetworkOrigin", player->GetPredDescMap() );
	Assert( td );
	if ( !td )
		return;

	Vector predicted_origin;

	memcpy( (Vector *)&predicted_origin, (Vector *)( (byte *)slot + td->fieldOffset[ PC_DATA_PACKED ] ), sizeof( Vector ) );

	// Compare what the server returned with what we had predicted it to be
	VectorSubtract ( predicted_origin, origin, delta );

	len = VectorLength( delta );
	if (len > MAX_PREDICTION_ERROR )
	{
		// A teleport or something, clear out error
		len = 0;
	}
	else
	{
		if ( len > MIN_PREDICTION_EPSILON )
		{
			player->NotePredictionError( delta );

			if ( cl_showerror.GetInt() >= 1 )
			{
				con_nprint_t np;
				np.fixed_width_font = true;
				np.color[0] = 1.0f;
				np.color[1] = 0.95f;
				np.color[2] = 0.7f;
				np.index = 20 + ( ++pos % 20 );
				np.time_to_live = 2.0f;

				engine->Con_NXPrintf( &np, "pred error %6.3f units (%6.3f %6.3f %6.3f)", len, delta.x, delta.y, delta.z );
			}
		}
	}
#endif
}

//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CPrediction::ShutdownPredictables( void )
{
#if !defined( NO_ENTITY_PREDICTION )
	// Transfer intermediate data from other predictables
	int c = predictables->GetPredictableCount();
	int i;

	int shutdown_count = 0;
	int release_count = 0;

	for ( i = c - 1; i >= 0 ; i-- )
	{
		C_BaseEntity *ent = predictables->GetPredictable( i );
		if ( !ent )
			continue;

		// Shutdown predictables
		if ( ent->GetPredictable() )
		{
			ent->ShutdownPredictable();
			shutdown_count++;
		}
		// Otherwise, release client created entities
		else
		{
			ent->Release();
			release_count++;
		}
	}

	if ( ( release_count > 0 ) ||
		 ( shutdown_count > 0 ) )
	{
		Msg( "Shutdown %i predictable entities and %i client-created entities\n",
			shutdown_count,
			release_count );
	}

	// All gone now...
	Assert( predictables->GetPredictableCount() == 0 );
#endif
}

//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CPrediction::ReinitPredictables( void )
{
#if !defined( NO_ENTITY_PREDICTION )
	// Go through all entities and init any eligible ones
	int i;
	int c = ClientEntityList().GetHighestEntityIndex();
	for ( i = 0; i <= c; i++ )
	{
		C_BaseEntity *e = ClientEntityList().GetBaseEntity( i );
		if ( !e )
			continue;

		if ( e->GetPredictable() )
			continue;

		e->CheckInitPredictable( "ReinitPredictables" );
	}

	Msg( "Reinitialized %i predictable entities\n",
		predictables->GetPredictableCount() );
#endif
}

//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CPrediction::OnReceivedUncompressedPacket( void )
{
#if !defined( NO_ENTITY_PREDICTION )
	m_nCommandsPredicted = 0;
	m_nServerCommandsAcknowledged = 0;
	m_nPreviousStartFrame = -1;
#endif
}

//-----------------------------------------------------------------------------
// Purpose:
// Input  : commands_acknowledged -
//			current_world_update_packet -
// Output : void CPrediction::PreEntityPacketReceived
//-----------------------------------------------------------------------------
void CPrediction::PreEntityPacketReceived ( int commands_acknowledged, int current_world_update_packet )
{
#if !defined( NO_ENTITY_PREDICTION )
	VPROF( "CPrediction::PreEntityPacketReceived" );

	// Cache off incoming packet #
	m_nIncomingPacketNumber = current_world_update_packet;

	// Don't screw up memory of current player from history buffers if not filling in history buffers
	//  during prediction!!!
	if ( !cl_predict.GetBool() )
	{
		ShutdownPredictables();
		return;
	}

	C_BasePlayer *current = C_BasePlayer::GetLocalPlayer();
	// No local player object?
	if ( !current )
		return;

	// Transfer intermediate data from other predictables
	int c = predictables->GetPredictableCount();
	int i;
	for ( i = 0; i < c; i++ )
	{
		C_BaseEntity *ent = predictables->GetPredictable( i );
		if ( !ent )
			continue;

		if ( !ent->GetPredictable() )
			continue;

		ent->PreEntityPacketReceived( commands_acknowledged );
	}
#endif
}

//-----------------------------------------------------------------------------
// Purpose: Called for every packet received( could be multiple times per frame)
//-----------------------------------------------------------------------------
void CPrediction::PostEntityPacketReceived( void )
{
#if !defined( NO_ENTITY_PREDICTION )
	VPROF( "CPrediction::PostEntityPacketReceived" );

	// Don't screw up memory of current player from history buffers if not filling in history buffers
	//  during prediction!!!
	if ( !cl_predict.GetBool() )
		return;

	C_BasePlayer *current = C_BasePlayer::GetLocalPlayer();
	// No local player object?
	if ( !current )
		return;

	// Transfer intermediate data from other predictables
	int c = predictables->GetPredictableCount();
	int i;
	for ( i = 0; i < c; i++ )
	{
		C_BaseEntity *ent = predictables->GetPredictable( i );
		if ( !ent )
			continue;

		if ( !ent->GetPredictable() )
			continue;

		ent->PostEntityPacketReceived();
	}
#endif
}

//-----------------------------------------------------------------------------
// Purpose:
// Input  : *ent -
// Output : static bool
//-----------------------------------------------------------------------------
bool CPrediction::ShouldDumpEntity( C_BaseEntity *ent )
{
#if !defined( NO_ENTITY_PREDICTION )
	int dump_entity = cl_predictionentitydump.GetInt();
	if ( dump_entity != -1 )
	{
		bool dump = false;
		if ( ent->entindex() == -1 )
		{
			dump = ( dump_entity == ent->entindex() ) ? true : false;
		}
		else
		{
			dump = ( ent->entindex() == dump_entity ) ? true : false;
		}

		if ( !dump )
		{
			return false;
		}
	}
	else
	{
		if ( cl_predictionentitydumpbyclass.GetString()[ 0 ] == 0 )
			return false;

		if ( !FClassnameIs( ent, cl_predictionentitydumpbyclass.GetString() ) )
			return false;
	}
	return true;
#else
	return false;
#endif
}

//-----------------------------------------------------------------------------
// Purpose: Called at the end of the frame if any packets were received
// Input  : error_check -
//			last_predicted -
//-----------------------------------------------------------------------------
void CPrediction::PostNetworkDataReceived( int commands_acknowledged )
{
#if !defined( NO_ENTITY_PREDICTION )
	VPROF( "CPrediction::PostNetworkDataReceived" );

	bool error_check = ( commands_acknowledged > 0 ) ? true : false;
#ifndef _XBOX
	CPDumpPanel *dump = GetPDumpPanel();
#endif
	//Msg( "%i/%i ack %i commands/slot\n",
	//	gpGlobals->framecount,
	//	gpGlobals->tickcount,
	//	commands_acknowledged - 1 );

	m_nServerCommandsAcknowledged += commands_acknowledged;
	m_bPreviousAckHadErrors = false;

	bool entityDumped = false;

	C_BasePlayer *current = C_BasePlayer::GetLocalPlayer();
	// No local player object?
	if ( !current )
		return;

	// Don't screw up memory of current player from history buffers if not filling in history buffers
	//  during prediction!!!
	if ( cl_predict.GetBool() )
	{
		int showlist = cl_predictionlist.GetInt();
		int totalsize = 0;
		int totalsize_intermediate = 0;

		con_nprint_t np;
		np.fixed_width_font = true;
		np.color[0] = 0.8f;
		np.color[1] = 1.0f;
		np.color[2] = 1.0f;
		np.time_to_live = 2.0f;

		// Transfer intermediate data from other predictables
		int c = predictables->GetPredictableCount();
		int i;
		for ( i = 0; i < c; i++ )
		{
			C_BaseEntity *ent = predictables->GetPredictable( i );
			if ( !ent )
				continue;

			if ( ent->GetPredictable() )
			{
				if ( ent->PostNetworkDataReceived( m_nServerCommandsAcknowledged ) )
				{
					m_bPreviousAckHadErrors = true;
				}
			}

			if ( showlist )
			{
				char sz[ 32 ];
				if ( ent->entindex() == -1 )
				{
					Q_snprintf( sz, sizeof( sz ), "handle %u", (unsigned int)ent->GetClientHandle().ToInt() );
				}
				else
				{
					Q_snprintf( sz, sizeof( sz ), "%i", ent->entindex() );
				}

				np.index = i;

				if ( showlist >= 2 )
				{
					int size = GetClassMap().GetClassSize( ent->GetClassname() );
					int intermediate_size = ent->GetIntermediateDataSize() * ( MULTIPLAYER_BACKUP + 1 );

					engine->Con_NXPrintf( &np, "%15s %30s (%5i / %5i bytes): %15s",
						sz,
						ent->GetClassname(),
						size,
						intermediate_size,
						ent->GetPredictable() ? "predicted" : "client created" );

					totalsize += size;
					totalsize_intermediate += intermediate_size;
				}
				else
				{
					engine->Con_NXPrintf( &np, "%15s %30s: %15s",
						sz,
						ent->GetClassname(),
						ent->GetPredictable() ? "predicted" : "client created" );
				}
			}
#ifndef _XBOX
			if ( error_check &&
				!entityDumped &&
				dump &&
				ShouldDumpEntity( ent ) )
			{
				entityDumped = true;
				dump->DumpEntity( ent, m_nServerCommandsAcknowledged );
			}
#endif
		}

		if ( showlist >= 2 )
		{
			np.index = i++;
			char sz1[32];
			char sz2[32];

			Q_strncpy( sz1, Q_pretifymem( (float)totalsize ), sizeof( sz1 ) );
			Q_strncpy( sz2, Q_pretifymem( (float)totalsize_intermediate ), sizeof( sz2 ) );

			engine->Con_NXPrintf( &np, "%15s %27s (%s / %s)  %14s",
				"totals:",
				"",
				sz1,
				sz2,
				"" );
		}

		// Zero out rest of list
		if ( showlist )
		{
			while ( i < 20 )
			{
				engine->Con_NPrintf( i, "" );
				i++;
			}
		}

		if ( error_check )
		{
			CheckError( m_nServerCommandsAcknowledged );
		}
	}

	// Can also look at regular entities
#ifndef _XBOX
	int dumpentindex = cl_predictionentitydump.GetInt();
	if ( dump && error_check && !entityDumped && dumpentindex != -1 )
	{
		int last_entity = ClientEntityList().GetHighestEntityIndex();
		if ( dumpentindex >= 0 && dumpentindex <= last_entity )
		{
			C_BaseEntity *ent = ClientEntityList().GetBaseEntity( dumpentindex );
			if ( ent )
			{
				dump->DumpEntity( ent, m_nServerCommandsAcknowledged );
				entityDumped = true;
			}
		}
	}
#endif
	if ( cl_predict.GetBool() != m_bOldCLPredictValue )
	{
		if ( !m_bOldCLPredictValue )
		{
			ReinitPredictables();
		}

		m_nCommandsPredicted = 0;
		m_nServerCommandsAcknowledged = 0;
		m_nPreviousStartFrame = -1;
	}

	m_bOldCLPredictValue = cl_predict.GetBool();

#ifndef _XBOX
	if ( dump && error_check && !entityDumped )
	{
		dump->Clear();
	}
#endif
#endif

}

//-----------------------------------------------------------------------------
// Purpose: Prepare for running prediction code
// Input  : *ucmd -
//			*from -
//			*pHelper -
//			&moveInput -
//-----------------------------------------------------------------------------
void CPrediction::SetupMove( C_BasePlayer *player, CUserCmd *ucmd, IMoveHelper *pHelper, CMoveData *move )
{
#if !defined( NO_ENTITY_PREDICTION )
	VPROF( "CPrediction::SetupMove" );

	move->m_bFirstRunOfFunctions = IsFirstTimePredicted();

	move->m_nPlayerHandle = player->GetClientHandle();
	move->m_vecVelocity		= player->GetAbsVelocity();
	move->m_vecAbsOrigin	= player->GetNetworkOrigin();
	move->m_vecOldAngles	= move->m_vecAngles;
	move->m_nOldButtons		= player->m_Local.m_nOldButtons;
	move->m_flClientMaxSpeed = player->m_flMaxspeed;

	move->m_vecAngles		= ucmd->viewangles;
	move->m_vecViewAngles	= ucmd->viewangles;
	move->m_nImpulseCommand = ucmd->impulse;
	move->m_nButtons		= ucmd->buttons;

	CBaseEntity *pMoveParent = player->GetMoveParent();
	if (!pMoveParent)
	{
		move->m_vecAbsViewAngles = move->m_vecViewAngles;
	}
	else
	{
		matrix3x4_t viewToParent, viewToWorld;
		AngleMatrix( move->m_vecViewAngles, viewToParent );
		ConcatTransforms( pMoveParent->EntityToWorldTransform(), viewToParent, viewToWorld );
		MatrixAngles( viewToWorld, move->m_vecAbsViewAngles );
	}

	// Ingore buttons for movement if at controls
	if (player->GetFlags() & FL_ATCONTROLS)
	{
		move->m_flForwardMove		= 0;
		move->m_flSideMove			= 0;
		move->m_flUpMove			= 0;
	}
	else
	{
		move->m_flForwardMove		= ucmd->forwardmove;
		move->m_flSideMove			= ucmd->sidemove;
		move->m_flUpMove			= ucmd->upmove;
	}

	IClientVehicle *pVehicle = player->GetVehicle();
	if (pVehicle)
	{
		pVehicle->SetupMove( player, ucmd, pHelper, move );
	}

	// Copy constraint information
	if ( player->m_hConstraintEntity )
		move->m_vecConstraintCenter = player->m_hConstraintEntity->GetAbsOrigin();
	else
		move->m_vecConstraintCenter = player->m_vecConstraintCenter;

	move->m_flConstraintRadius = player->m_flConstraintRadius;
	move->m_flConstraintWidth = player->m_flConstraintWidth;
	move->m_flConstraintSpeedFactor = player->m_flConstraintSpeedFactor;

#ifdef HL2_CLIENT_DLL
	// Convert to HL2 data.
	C_BaseHLPlayer *pHLPlayer = static_cast<C_BaseHLPlayer*>( player );
	Assert( pHLPlayer );

	CHLMoveData *pHLMove = static_cast<CHLMoveData*>( move );
	Assert( pHLMove );

	pHLMove->m_bIsSprinting = pHLPlayer->IsSprinting();
#endif
#endif
}

//-----------------------------------------------------------------------------
// Purpose: Finish running prediction code
// Input  : &move -
//			*to -
//-----------------------------------------------------------------------------
void CPrediction::FinishMove( C_BasePlayer *player, CUserCmd *ucmd, CMoveData *move )
{
#if !defined( NO_ENTITY_PREDICTION )
	VPROF( "CPrediction::FinishMove" );

	player->m_RefEHandle = move->m_nPlayerHandle;

	player->m_vecVelocity = move->m_vecVelocity;

	player->m_vecNetworkOrigin = move->m_vecAbsOrigin;

	player->m_Local.m_nOldButtons = move->m_nButtons;

	player->m_flMaxspeed = move->m_flClientMaxSpeed;

	m_hLastGround = player->GetGroundEntity();

	player->SetLocalOrigin( move->m_vecAbsOrigin );

	IClientVehicle *pVehicle = player->GetVehicle();
	if (pVehicle)
	{
		pVehicle->FinishMove( player, ucmd, move );
	}

	// Sanity checks
	if ( player->m_hConstraintEntity )
		Assert( move->m_vecConstraintCenter == player->m_hConstraintEntity->GetAbsOrigin() );
	else
		Assert( move->m_vecConstraintCenter == player->m_vecConstraintCenter );
	Assert( move->m_flConstraintRadius == player->m_flConstraintRadius );
	Assert( move->m_flConstraintWidth == player->m_flConstraintWidth );
	Assert( move->m_flConstraintSpeedFactor == player->m_flConstraintSpeedFactor );
#endif
}

//-----------------------------------------------------------------------------
// Purpose: Called before any movement processing
// Input  : *player -
//			*cmd -
//-----------------------------------------------------------------------------
void CPrediction::StartCommand( C_BasePlayer *player, CUserCmd *cmd )
{
#if !defined( NO_ENTITY_PREDICTION )
	VPROF( "CPrediction::StartCommand" );

	CPredictableId::ResetInstanceCounters();

	player->m_pCurrentCommand = cmd;
	C_BaseEntity::SetPredictionRandomSeed( cmd );
	C_BaseEntity::SetPredictionPlayer( player );
#endif
}

//-----------------------------------------------------------------------------
// Purpose: Called after any movement processing
// Input  : *player -
//-----------------------------------------------------------------------------
void CPrediction::FinishCommand( C_BasePlayer *player )
{
#if !defined( NO_ENTITY_PREDICTION )
	VPROF( "CPrediction::FinishCommand" );

	player->m_pCurrentCommand = NULL;
	C_BaseEntity::SetPredictionRandomSeed( NULL );
	C_BaseEntity::SetPredictionPlayer( NULL );
#endif
}

//-----------------------------------------------------------------------------
// Purpose: Called before player thinks
// Input  : *player -
//			thinktime -
//-----------------------------------------------------------------------------
void CPrediction::RunPreThink( C_BasePlayer *player )
{
#if !defined( NO_ENTITY_PREDICTION )
	VPROF( "CPrediction::RunPreThink" );

	// Run think functions on the player
	if ( !player->PhysicsRunThink() )
		return;

	// Called every frame to let game rules do any specific think logic for the player
	// FIXME:  Do we need to set up a client side version of the gamerules???
	// g_pGameRules->PlayerThink( player );

	player->PreThink();
#endif
}

//-----------------------------------------------------------------------------
// Purpose: Runs the PLAYER's thinking code if time.  There is some play in the exact time the think
//  function will be called, because it is called before any movement is done
//  in a frame.  Not used for pushmove objects, because they must be exact.
//  Returns false if the entity removed itself.
// Input  : *ent -
//			frametime -
//			clienttimebase -
// Output : void CPlayerMove::RunThink
//-----------------------------------------------------------------------------
void CPrediction::RunThink (C_BasePlayer *player, double frametime )
{
#if !defined( NO_ENTITY_PREDICTION )
	VPROF( "CPrediction::RunThink" );

	int thinktick = player->GetNextThinkTick();

	if ( thinktick <= 0 || thinktick > player->m_nTickBase )
		return;

	player->SetNextThink( TICK_NEVER_THINK );

	// Think
	player->Think();
#endif
}

//-----------------------------------------------------------------------------
// Purpose: Called after player movement
// Input  : *player -
//			thinktime -
//			frametime -
//-----------------------------------------------------------------------------
void CPrediction::RunPostThink( C_BasePlayer *player )
{
#if !defined( NO_ENTITY_PREDICTION )
	VPROF( "CPrediction::RunPostThink" );

	// Run post-think
	player->PostThink();
#endif
}

//-----------------------------------------------------------------------------
// Purpose: Predicts a single movement command for player
// Input  : *moveHelper -
//			*player -
//			*u -
//-----------------------------------------------------------------------------
void CPrediction::RunCommand( C_BasePlayer *player, CUserCmd *ucmd, IMoveHelper *moveHelper )
{
#if !defined( NO_ENTITY_PREDICTION )
	VPROF( "CPrediction::RunCommand" );

	StartCommand( player, ucmd );

	// Set globals appropriately
	gpGlobals->curtime		= player->m_nTickBase * TICK_INTERVAL;
	gpGlobals->frametime	= TICK_INTERVAL;

// TODO
// TODO:  Check for impulse predicted?

	// Do weapon selection
	if ( ucmd->weaponselect != 0 )
	{
		C_BaseCombatWeapon *weapon = dynamic_cast< C_BaseCombatWeapon * >( CBaseEntity::Instance( ucmd->weaponselect ) );
		if ( weapon )
		{
			player->SelectItem( weapon->GetName(), ucmd->weaponsubtype );
		}
	}

	// Latch in impulse.
	IClientVehicle *pVehicle = player->GetVehicle();
	if ( ucmd->impulse )
	{
		// Discard impulse commands unless the vehicle allows them.
		// FIXME: UsingStandardWeapons seems like a bad filter for this.
		// The flashlight is an impulse command, for example.
		if ( !pVehicle || player->UsingStandardWeaponsInVehicle() )
		{
			player->m_nImpulse = ucmd->impulse;
		}
	}

	// Get button states
	player->UpdateButtonState( ucmd->buttons );

// TODO
//	CheckMovingGround( player, ucmd->frametime );

// TODO
//	g_pMoveData->m_vecOldAngles = player->pl.v_angle;

	// Copy from command to player unless game .dll has set angle using fixangle
	// if ( !player->pl.fixangle )
	{
		player->SetLocalViewAngles( ucmd->viewangles );
	}

	// Call standard client pre-think
	RunPreThink( player );

	// Call Think if one is set
	RunThink( player, TICK_INTERVAL );

	// Setup input.
	{

		SetupMove( player, ucmd, moveHelper, g_pMoveData );
	}

	// RUN MOVEMENT
	if ( !pVehicle )
	{
		Assert( g_pGameMovement );
		g_pGameMovement->ProcessMovement( player, g_pMoveData );
	}
	else
	{
		pVehicle->ProcessMovement( player, g_pMoveData );
	}

	FinishMove( player, ucmd, g_pMoveData );

	RunPostThink( player );

// TODO:  Predict impacts?
//	// Let server invoke any needed impact functions
//	moveHelper->ProcessImpacts();

	FinishCommand( player );

	player->m_nTickBase++;
#endif
}

//-----------------------------------------------------------------------------
// Purpose: In the forward direction, creates rays straight down and determines the
//  height of the 'floor' hit for each forward test.  Then, if the samples show that the
//  player is about to enter an up/down slope, sets *idealpitch to look up or down that slope
//  as appropriate
//-----------------------------------------------------------------------------
void CPrediction::SetIdealPitch ( C_BasePlayer *player, const Vector& origin, const QAngle& angles, const Vector& viewheight )
{
#if !defined( NO_ENTITY_PREDICTION )
	Vector	forward;
	Vector	top, bottom;
	float	floor_height[MAX_FORWARD];
	int		i, j;
	int		step, dir, steps;
	trace_t tr;

	if ( player->GetGroundEntity() == NULL )
		return;

	AngleVectors( angles, &forward );
	forward[2] = 0;

	// Now move forward by 36, 48, 60, etc. units from the eye position and drop lines straight down
	//  160 or so units to see what's below
	for (i=0 ; i<MAX_FORWARD ; i++)
	{
		VectorMA( origin, (i+3)*12, forward, top );

		top[2] += viewheight[ 2 ];

		VectorCopy( top, bottom );

		bottom[2] -= 160;

		UTIL_TraceLine( top, bottom, MASK_SOLID, NULL, COLLISION_GROUP_PLAYER_MOVEMENT, &tr );

		// looking at a wall, leave ideal the way it was
		if ( tr.allsolid )
			return;

		// near a dropoff/ledge
		if ( tr.fraction == 1 )
			return;

		floor_height[i] = top[2] + tr.fraction*( bottom[2] - top[2] );
	}

	dir = 0;
	steps = 0;
	for (j=1 ; j<i ; j++)
	{
		step = floor_height[j] - floor_height[j-1];
		if (step > -ON_EPSILON && step < ON_EPSILON)
			continue;

		if (dir && ( step-dir > ON_EPSILON || step-dir < -ON_EPSILON ) )
			return;		// mixed changes

		steps++;
		dir = step;
	}

	if (!dir)
	{
		m_flIdealPitch = 0;
		return;
	}

	if (steps < 2)
		return;
	m_flIdealPitch = -dir * cl_idealpitchscale.GetFloat();
#endif
}

//-----------------------------------------------------------------------------
// Purpose: Walk backward through predictables looking for ClientCreated entities
//  such as projectiles which were
// 1) not actually ack'd by the server or
// 2) were ack'd and made dormant and can now safely be removed
// Input  : last_command_packet -
//-----------------------------------------------------------------------------
void CPrediction::RemoveStalePredictedEntities( int sequence_number )
{
#if !defined( NO_ENTITY_PREDICTION )
	VPROF( "CPrediction::RemoveStalePredictedEntities" );

	int oldest_allowable_command = sequence_number;

	// Walk backward due to deletion from UtlVector
	int c = predictables->GetPredictableCount();
	int i;
	for ( i = c - 1; i >= 0; i-- )
	{
		C_BaseEntity *ent = predictables->GetPredictable( i );
		if ( !ent )
			continue;

		// Don't do anything to truly predicted things (like player and weapons )
		if ( ent->GetPredictable() )
			continue;

		// What's left should be things like projectiles that are just waiting to be "linked"
		//  to their server counterpart and deleted
		Assert( ent->IsClientCreated() );
		if ( !ent->IsClientCreated() )
			continue;

		// Snag the PredictionContext
		PredictionContext *ctx = ent->m_pPredictionContext;
		if ( !ctx )
		{
			continue;
		}

		// If it was ack'd then the server sent us the entity.
		// Leave it unless it wasn't made dormant this frame, in
		//  which case it can be removed now
		if ( ent->m_PredictableID.GetAcknowledged() )
		{
			// Hasn't become dormant yet!!!
			if ( !ent->IsDormantPredictable() )
			{
				Assert( 0 );
				continue;
			}

			// Still gets to live till next frame
			if ( ent->BecameDormantThisPacket() )
				continue;

			C_BaseEntity *serverEntity = ctx->m_hServerEntity;
			if ( serverEntity )
			{
				// Notify that it's going to go away
				serverEntity->OnPredictedEntityRemove( true, ent );
			}
		}
		else
		{
			// Check context to see if it's too old?
			int command_entity_creation_happened = ctx->m_nCreationCommandNumber;
			// Give it more time to live...not time to kill it yet
			if ( command_entity_creation_happened > oldest_allowable_command )
				continue;

			// If the client predicted the KILLME flag it's possible
			//  that entity had such a short life that it actually
			//  never was sent to us.  In that case, just let it die a silent death
			if ( !ent->IsEFlagSet( EFL_KILLME ) )
			{
				if ( cl_showerror.GetInt() != 0 )
				{
					// It's bogus, server doesn't have a match, destroy it:
					Msg( "Removing unack'ed predicted entity:  %s created %s(%i) id == %s : %p\n",
						ent->GetClassname(),
						ctx->m_pszCreationModule,
						ctx->m_nCreationLineNumber,
						ent->m_PredictableID.Describe(),
						ent );
				}
			}

			// FIXME:  Do we need an OnPredictedEntityRemove call with an "it's not valid"
			// flag of some kind
		}

		// This will remove it from predictables list and will also free the entity, etc.
		ent->Release();
	}
#endif
}

//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CPrediction::RestoreOriginalEntityState( void )
{
#if !defined( NO_ENTITY_PREDICTION )
	VPROF( "CPrediction::RestoreOriginalEntityState" );

	Assert( C_BaseEntity::IsAbsRecomputationsEnabled() );

	// Transfer intermediate data from other predictables
	int pc = predictables->GetPredictableCount();
	int p;
	for ( p = 0; p < pc; p++ )
	{
		C_BaseEntity *ent = predictables->GetPredictable( p );
		if ( !ent )
			continue;

		if ( ent->GetPredictable() )
		{
			ent->RestoreData( "RestoreOriginalEntityState", C_BaseEntity::SLOT_ORIGINALDATA, PC_EVERYTHING );
		}
	}
#endif
}

//-----------------------------------------------------------------------------
// Purpose:
// Input  : current_command -
//			curtime -
//			*cmd -
//			*tcmd -
//			*localPlayer -
//-----------------------------------------------------------------------------
void CPrediction::RunSimulation( int current_command, float curtime, CUserCmd *cmd, C_BasePlayer *localPlayer )
{
#if !defined( NO_ENTITY_PREDICTION )
	VPROF( "CPrediction::RunSimulation" );

	Assert( localPlayer );
	C_CommandContext *ctx = localPlayer->GetCommandContext();
	Assert( ctx );

	ctx->needsprocessing = true;
	ctx->cmd = *cmd;
	ctx->command_number = current_command;

	IPredictionSystem::SuppressEvents( !IsFirstTimePredicted() );

	int i;

	// Make sure simulation occurs at most once per entity per usercmd
	for ( i = 0; i < predictables->GetPredictableCount(); i++ )
	{
		C_BaseEntity *entity = predictables->GetPredictable( i );
		if ( entity )
		{
			entity->m_nSimulationTick = -1;
		}
	}

	// Don't used cached numpredictables since entities can be created mid-prediction by the player
	for ( i = 0; i < predictables->GetPredictableCount(); i++ )
	{
		// Always reset
		gpGlobals->curtime		= curtime;
		gpGlobals->frametime	= TICK_INTERVAL;

		C_BaseEntity *entity = predictables->GetPredictable( i );

		if ( !entity )
			continue;

		bool islocal = ( localPlayer == entity ) ? true : false;

		// Local player simulates first, if this assert fires then the predictables list isn't sorted
		//  correctly (or we started predicting C_World???)
		if ( islocal )
		{
			Assert( i == 0 );
		}

		// Player can't be this so cull other entities here
		if ( entity->GetFlags() & FL_STATICPROP )
		{
			continue;
		}

		// Player is not actually in the m_SimulatedByThisPlayer list, of course
		if ( entity->IsPlayerSimulated() )
		{
			continue;
		}

		if ( AddDataChangeEvent( entity, DATA_UPDATE_DATATABLE_CHANGED, &entity->m_DataChangeEventRef ) )
		{
			entity->OnPreDataChanged( DATA_UPDATE_DATATABLE_CHANGED );
		}

		// Certain entities can be created locally and if so created, should be
		//  simulated until a network update arrives
		if ( entity->IsClientCreated() )
		{
			// Only simulate these on new usercmds
			if ( !IsFirstTimePredicted() )
				continue;

			entity->PhysicsSimulate();
		}
		else
		{
			entity->PhysicsSimulate();
		}

		entity->OnLatchInterpolatedVariables( LATCH_SIMULATION_VAR | LATCH_ANIMATION_VAR );
	}

	// Always reset after running command
	IPredictionSystem::SuppressEvents( false );
#endif
}

//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CPrediction::Untouch( void )
{
#if !defined( NO_ENTITY_PREDICTION )
	int numpredictables = predictables->GetPredictableCount();

	// Loop through all entities again, checking their untouch if flagged to do so
	int i;
	for ( i = 0; i < numpredictables; i++ )
	{
		C_BaseEntity *entity = predictables->GetPredictable( i );
		if ( !entity )
			continue;

		if ( !entity->GetCheckUntouch() )
			continue;

		entity->PhysicsCheckForEntityUntouch();
	}
#endif
}

#if !defined( NO_ENTITY_PREDICTION )
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void InvalidateEFlagsRecursive( C_BaseEntity *pEnt, int nDirtyFlags, int nChildFlags = 0 )
{
	pEnt->AddEFlags( nDirtyFlags );
	nDirtyFlags |= nChildFlags;
	for (CBaseEntity *pChild = pEnt->FirstMoveChild(); pChild; pChild = pChild->NextMovePeer())
	{
		InvalidateEFlagsRecursive( pChild, nDirtyFlags );
	}
}
#endif

void CPrediction::StorePredictionResults( int predicted_frame )
{
#if !defined( NO_ENTITY_PREDICTION )
	VPROF( "CPrediction::StorePredictionResults" );

	int i;
	int numpredictables = predictables->GetPredictableCount();

	// Now save off all of the results
	for ( i = 0; i < numpredictables; i++ )
	{
		C_BaseEntity *entity = predictables->GetPredictable( i );
		if ( !entity )
			continue;

		// Certain entities can be created locally and if so created, should be
		//  simulated until a network update arrives
		if ( !entity->GetPredictable() )
			continue;

		// FIXME: The lack of this call inexplicably actually creates prediction errors
		InvalidateEFlagsRecursive( entity, EFL_DIRTY_ABSTRANSFORM | EFL_DIRTY_ABSVELOCITY | EFL_DIRTY_ABSANGVELOCITY );

		entity->SaveData( "StorePredictionResults", predicted_frame, PC_EVERYTHING );
	}
#endif
}

//-----------------------------------------------------------------------------
// Purpose:
// Input  : slots_to_remove -
//			previous_last_slot -
//-----------------------------------------------------------------------------
void CPrediction::ShiftIntermediateDataForward( int slots_to_remove, int number_of_commands_run )
{
#if !defined( NO_ENTITY_PREDICTION )
	VPROF( "CPrediction::ShiftIntermediateDataForward" );

	C_BasePlayer *current = C_BasePlayer::GetLocalPlayer();
	// No local player object?
	if ( !current )
		return;

	// Don't screw up memory of current player from history buffers if not filling in history buffers
	//  during prediction!!!
	if ( !cl_predict.GetBool() )
		return;

	int c = predictables->GetPredictableCount();
	int i;
	for ( i = 0; i < c; i++ )
	{
		C_BaseEntity *ent = predictables->GetPredictable( i );
		if ( !ent )
			continue;

		if ( !ent->GetPredictable() )
			continue;

		ent->ShiftIntermediateDataForward( slots_to_remove, number_of_commands_run );
	}
#endif
}

//-----------------------------------------------------------------------------
// Purpose:
// Input  : predicted_frame -
//-----------------------------------------------------------------------------
void CPrediction::RestoreEntityToPredictedFrame( int predicted_frame )
{
#if !defined( NO_ENTITY_PREDICTION )
	VPROF( "CPrediction::RestoreEntityToPredictedFrame" );

	C_BasePlayer *current = C_BasePlayer::GetLocalPlayer();
	// No local player object?
	if ( !current )
		return;

	// Don't screw up memory of current player from history buffers if not filling in history buffers
	//  during prediction!!!
	if ( !cl_predict.GetBool() )
		return;

	int c = predictables->GetPredictableCount();
	int i;
	for ( i = 0; i < c; i++ )
	{
		C_BaseEntity *ent = predictables->GetPredictable( i );
		if ( !ent )
			continue;

		if ( !ent->GetPredictable() )
			continue;

		ent->RestoreData( "RestoreEntityToPredictedFrame", predicted_frame, PC_EVERYTHING );
	}
#endif
}

//-----------------------------------------------------------------------------
// Purpose: Computes starting destination for intermediate prediction data results and
//  does any fixups required by network optimization
// Input  : received_new_world_update -
//			incoming_acknowledged -
// Output : int
//-----------------------------------------------------------------------------
int CPrediction::ComputeFirstCommandToExecute( bool received_new_world_update, int incoming_acknowledged, int outgoing_command )
{
	int destination_slot = 1;
#if !defined( NO_ENTITY_PREDICTION )
	int skipahead = 0;

	// If we didn't receive a new update, just jump right up to the very
	//  last command we created for this very frame since we couldn't have
	//  had any errors without being notified by the server of such a case
	// NOTE:  received_new_world_update only gets set to false if cl_pred_optimize >= 1
	if ( !received_new_world_update )
	{
		// this is where we would normally start
		int start = incoming_acknowledged + 1;
		// outgoing_command is where we really want to start
		skipahead = max( 0, ( outgoing_command - start ) );
		// Don't start past the last predicted command, though, or we'll get prediction errors
		skipahead = min( skipahead, m_nCommandsPredicted  );

		if ( m_nCommandsPredicted != skipahead )
		{
			RestoreEntityToPredictedFrame( skipahead - 1 );
		}

		//Msg( "%i/%i no world, skip to %i restore from slot %i\n",
		//	gpGlobals->framecount,
		//	gpGlobals->tickcount,
		//	skipahead,
		//	skipahead - 1 );
	}
	else
	{
		// Otherwise, there is a second optimization, wherein if we did receive an update, but no
		//  values differed (or were outside their epsilon) and the server actually acknowledged running
		//  one or more commands, then we can revert the entity to the predicted state from last frame,
		//  shift the # of commands worth of intermediate state off of front the intermediate state array, and
		//  only predict the usercmd from the latest render frame.
		if ( cl_pred_optimize.GetInt() >= 2 &&
			!m_bPreviousAckHadErrors &&
			m_nCommandsPredicted > 0 &&
			m_nServerCommandsAcknowledged > 0 &&
			m_nServerCommandsAcknowledged <= m_nCommandsPredicted )
		{
			// Copy all of the previously predicted data back into entity so we can skip repredicting it
			// This is the final slot that we previously predicted
			RestoreEntityToPredictedFrame( m_nCommandsPredicted - 1 );

			// Shift intermediate state blocks down by # of commands ack'd
			ShiftIntermediateDataForward( m_nServerCommandsAcknowledged, m_nCommandsPredicted );

			// Only predict new commands (note, this should be the same number that we could compute
			//  above based on outgoing_command - incoming_acknowledged - 1
			skipahead = ( m_nCommandsPredicted - m_nServerCommandsAcknowledged );

			//Msg( "%i/%i optimize2, skip to %i restore from slot %i\n",
			//	gpGlobals->framecount,
			//	gpGlobals->tickcount,
			//	skipahead,
			//	m_nCommandsPredicted - 1 );
		}
		else
		{
			C_BasePlayer *pLocalPlayer = C_BasePlayer::GetLocalPlayer();

			// If an entity gets a prediction error, then we want to clear out its interpolated variables
			// so we don't mix different samples at the same timestamps. We subtract 1 tick interval here because
			// if we don't, we'll have 3 interpolation entries with the same timestamp as this predicted
			// frame, so we won't be able to interpolate (which leads to jerky movement in the player when
			// ANY entity like your gun gets a prediction error).
			float flPrev = gpGlobals->curtime;
			gpGlobals->curtime = pLocalPlayer->GetTimeBase() - TICK_INTERVAL;

			for ( int i = 0; i < predictables->GetPredictableCount(); i++ )
			{
				C_BaseEntity *entity = predictables->GetPredictable( i );
				if ( entity )
				{
					entity->ResetLatched();
				}
			}

			gpGlobals->curtime = flPrev;
		}
	}

	destination_slot += skipahead;

	// Always reset these values now that we've handled them
	m_nCommandsPredicted			= 0;
	m_bPreviousAckHadErrors			= false;
	m_nServerCommandsAcknowledged	= 0;
#endif
	return destination_slot;
}

//-----------------------------------------------------------------------------
// Actually does the prediction work, returns false if an error occurred
//-----------------------------------------------------------------------------
bool CPrediction::PerformPrediction( bool received_new_world_update, C_BasePlayer *localPlayer,
									int incoming_acknowledged, int outgoing_command )
{
#if !defined( NO_ENTITY_PREDICTION )
	VPROF( "CPrediction::PerformPrediction" );

	// This makes sure , tahe we are allwoed to sample the world when it may not be ready to be sampled
	Assert( C_BaseEntity::IsAbsQueriesValid() );
	Assert( C_BaseEntity::IsAbsRecomputationsEnabled() );

	m_bInPrediction = true;

	// undo interpolation changes for entities we stand on
	C_BaseEntity *entity = localPlayer->GetGroundEntity();

	while ( entity && entity->entindex() > 0)
	{
		entity->MoveToLastReceivedPosition();
		// undo changes for moveparents too
		entity = entity->GetMoveParent();
	}

	// Start at command after last one server has processed and
	//  go until we get to targettime or we run out of new commands
	int i = ComputeFirstCommandToExecute( received_new_world_update, incoming_acknowledged, outgoing_command );

	//Msg( "%i/%i tickbase %i\n",
	//	gpGlobals->framecount,
	//	gpGlobals->tickcount,
	//	localPlayer->m_nTickBase );

	//for ( int k = 1; k < i; k++ )
	//{
	//	Msg( "%i/%i Skip final tick %i into slot %i\n",
	//		gpGlobals->framecount, gpGlobals->tickcount,
	//		localPlayer->m_nTickBase - i + k + 1,
	//		k - 1 );
	//}

	Assert( i >= 1 );
	while ( true )
	{
		// Incoming_acknowledged is the last usercmd the server acknowledged having acted upon
		int current_command		= incoming_acknowledged + i;

		// We've caught up to the current command.
		if ( current_command > outgoing_command )
			break;

		if ( i >= MULTIPLAYER_BACKUP )
			break;

		CUserCmd *cmd = input->GetUserCmd( current_command );

		if ( !cmd )
		{
			break;
		}

		// Is this the first time predicting this
		m_bFirstTimePredicted = !cmd->hasbeenpredicted;

		// Set globals appropriately
		float curtime		= ( localPlayer->m_nTickBase ) * TICK_INTERVAL;

		RunSimulation( current_command, curtime, cmd, localPlayer );

		gpGlobals->curtime		= curtime;
		gpGlobals->frametime	= TICK_INTERVAL;

		// Call untouch on any entities no longer predicted to be touching
		Untouch();

		// Store intermediate data into appropriate slot
		StorePredictionResults( i - 1 ); // Note that I starts at 1

		m_nCommandsPredicted = i;

		if ( current_command == outgoing_command )
		{
			localPlayer->m_nFinalPredictedTick = localPlayer->m_nTickBase;
		}
		/*
		if ( 0 )
		{
			localPlayer->m_nFinalPredictedTick = localPlayer->m_nTickBase;
			Msg( "%i/%i Latch final tick %i start == %i into slot %i\n",
				gpGlobals->framecount, gpGlobals->tickcount,
				localPlayer->m_nFinalPredictedTick,
				localPlayer->m_nFinalPredictedTick - i,
				i - 1 );
		}
		*/

		/*
		Msg( "%i/%i Predicted command %i tickbase == %i first %s\n",
			gpGlobals->framecount, gpGlobals->tickcount,
			m_nCommandsPredicted,
			localPlayer->m_nTickBase,
			m_bFirstTimePredicted ? "yes" : "no" );
		*/

		// Mark that we issued any needed sounds, of not done already
		cmd->hasbeenpredicted = true;

		// Copy the state over.
		i++;
	}

//	Msg( "%i : predicted %i commands forward, %i ack'd last frame, had errors %s\n",
//		gpGlobals->tickcount,
//		m_nCommandsPredicted,
//		m_nServerCommandsAcknowledged,
//		m_bPreviousAckHadErrors ? "true" : "false" );

	m_bInPrediction = false;

	// Somehow we looped past the end of the list (severe lag), don't predict at all
	if ( i > MULTIPLAYER_BACKUP )
	{
		return false;
	}
#endif
	return true;
}

//-----------------------------------------------------------------------------
// Purpose:
// Input  : startframe -
//			validframe -
//			incoming_acknowledged -
//			outgoing_command -
//-----------------------------------------------------------------------------
void CPrediction::Update( int startframe, bool validframe,
						 int incoming_acknowledged, int outgoing_command )
{
#if !defined( NO_ENTITY_PREDICTION )
	VPROF_BUDGET( "CPrediction::Update", VPROF_BUDGETGROUP_PREDICTION );

	bool received_new_world_update = true;

	// Still starting at same frame, so make sure we don't do extra prediction ,etc.
	if ( ( m_nPreviousStartFrame == startframe ) &&
		cl_pred_optimize.GetBool() &&
		cl_predict.GetBool() )
	{
		received_new_world_update = false;
	}

	m_nPreviousStartFrame = startframe;

	// Save off current timer values, etc.
	CGlobalVarsBase saveVars(true);
	saveVars = *gpGlobals;

	_Update( received_new_world_update, validframe, incoming_acknowledged, outgoing_command );

	// Restore current timer values, etc.
	*gpGlobals = saveVars;
#endif
}

//-----------------------------------------------------------------------------
// Do the dirty deed of predicting the local player
//-----------------------------------------------------------------------------
void CPrediction::_Update( bool received_new_world_update, bool validframe,
						 int incoming_acknowledged, int outgoing_command )
{
#if !defined( NO_ENTITY_PREDICTION )
	C_BasePlayer *localPlayer = C_BasePlayer::GetLocalPlayer();
	if ( !localPlayer )
		return;

	// Always using current view angles no matter what
	// NOTE: ViewAngles are always interpreted as being *relative* to the player
	QAngle viewangles;
	engine->GetViewAngles( viewangles );
	localPlayer->SetLocalAngles( viewangles );

	if ( !validframe )
	{
		return;
	}

	// If we are not doing prediction, copy authoritative value into velocity and angle.
	if ( !cl_predict.GetInt() )
	{
		// When not predicting, we at least must make sure the player
		// view angles match the view angles...
		localPlayer->SetLocalViewAngles( viewangles );
		return;
	}

	//if ( gpGlobals->frametime == 0.0f )
		//return;

	// This is cheesy, but if we have entities that are parented to attachments on other entities, then
	// it'll wind up needing to get a bone transform.
	C_BaseAnimating::InvalidateBoneCaches();
	C_BaseAnimating::AllowBoneAccess( true, true );

		// Remove any purely client predicted entities that were left "dangling" because the
		//  server didn't acknowledge them or which can now safely be removed
		RemoveStalePredictedEntities( incoming_acknowledged );

		// Restore objects back to "pristine" state from last network/world state update
		if ( received_new_world_update )
		{
			RestoreOriginalEntityState();
		}

		bool bPerform = PerformPrediction( received_new_world_update, localPlayer, incoming_acknowledged, outgoing_command );

	C_BaseAnimating::AllowBoneAccess( false, false );

	if ( !bPerform )
		return;

	// Overwrite predicted angles with the actual view angles
	localPlayer->SetLocalAngles( viewangles );

	// This allows us to sample the world when it may not be ready to be sampled
	Assert( C_BaseEntity::IsAbsQueriesValid() );

	// FIXME: What about hierarchy here?!?
	SetIdealPitch( localPlayer, localPlayer->GetLocalOrigin(), localPlayer->GetLocalAngles(), localPlayer->m_vecViewOffset );
#endif
}

//-----------------------------------------------------------------------------
// Purpose:
// Output : Returns true on success, false on failure.
//-----------------------------------------------------------------------------
bool CPrediction::IsFirstTimePredicted( void ) const
{
#if !defined( NO_ENTITY_PREDICTION )
	return m_bFirstTimePredicted;
#else
	return false;
#endif
}

//-----------------------------------------------------------------------------
// Purpose:
// Input  : org -
//-----------------------------------------------------------------------------
void CPrediction::GetViewOrigin( Vector& org )
{
	C_BasePlayer *player = C_BasePlayer::GetLocalPlayer();
	if ( !player )
	{
		org.Init();
	}
	else
	{
		org = player->GetLocalOrigin();
	}
}

//-----------------------------------------------------------------------------
// Purpose:
// Input  : org -
//-----------------------------------------------------------------------------
void CPrediction::SetViewOrigin( Vector& org )
{
	C_BasePlayer *player = C_BasePlayer::GetLocalPlayer();
	if ( !player )
		return;

	player->SetLocalOrigin( org );
	player->m_vecNetworkOrigin = org;

	player->m_iv_vecOrigin.Reset();
}

//-----------------------------------------------------------------------------
// Purpose:
// Input  : ang -
//-----------------------------------------------------------------------------
void CPrediction::GetViewAngles( QAngle& ang )
{
	C_BasePlayer *player = C_BasePlayer::GetLocalPlayer();
	if ( !player )
	{
		ang.Init();
	}
	else
	{
		ang = player->GetLocalAngles();
	}
}

//-----------------------------------------------------------------------------
// Purpose:
// Input  : ang -
//-----------------------------------------------------------------------------
void CPrediction::SetViewAngles( QAngle& ang )
{
	C_BasePlayer *player = C_BasePlayer::GetLocalPlayer();
	if ( !player )
		return;

	player->SetLocalAngles( ang );
	// player->SetLocalViewAngles( ang );
	player->m_angNetworkAngles = ang;

	player->m_iv_angRotation.Reset();
}

//-----------------------------------------------------------------------------
// Purpose:
// Input  : ang -
//-----------------------------------------------------------------------------
void CPrediction::GetLocalViewAngles( QAngle& ang )
{
	C_BasePlayer *player = C_BasePlayer::GetLocalPlayer();
	if ( !player )
	{
		ang.Init();
	}
	else
	{
		ang = player->pl.v_angle;
	}
}

#if !defined( NO_ENTITY_PREDICTION )
//-----------------------------------------------------------------------------
// Purpose: For determining that predicted creation entities are un-acked and should
//  be deleted
// Output : int
//-----------------------------------------------------------------------------
int CPrediction::GetIncomingPacketNumber( void ) const
{
	return m_nIncomingPacketNumber;
}
#endif

//-----------------------------------------------------------------------------
// Purpose:
// Input  : ang -
//-----------------------------------------------------------------------------
void CPrediction::SetLocalViewAngles( QAngle& ang )
{
	C_BasePlayer *player = C_BasePlayer::GetLocalPlayer();
	if ( !player )
		return;

	player->SetLocalViewAngles( ang );
}

//-----------------------------------------------------------------------------
// Purpose:
// Output : Returns true on success, false on failure.
//-----------------------------------------------------------------------------
bool CPrediction::InPrediction( void ) const
{
#if !defined( NO_ENTITY_PREDICTION )
	return m_bInPrediction;
#else
	return false;
#endif
}

// The engine needs to be able to access a few predicted values
int CPrediction::GetWaterLevel( void )
{
	C_BasePlayer *player = C_BasePlayer::GetLocalPlayer();
	if ( !player )
		return 0;

	return player->m_nWaterLevel;
}

redpajama_set_name: RedPajamaGithub


The dynamic Aerogate II thermal controller gives you monitoring capability of 4 different important component temperatures. In addition, users can control all 4 corresponding fans at the same time. The large LED backlight display and the custom-designed 7-color dial give ultimate viewing pleasure. With the Aerogate II, thermal control can be accomplished with the touch of your finger.


text:
Tilley, Callahan, Speiser & Associates CPAs
Forms, Documents and Links
Onvio Client Center
RUN Powered by ADP
Mile IQ
Remote Accounting Solutions
Bipartisan Infrastructure Bill Ends Employee Retention Credit - 11/12/21
Employee Retention Credit (ERC) extended and expanded - 07/22/21
HHS Provider Relief Funds Reporting Requirements - 06/28/2021
Child Tax Credit Advance Payments - 06/28/2021
Two-month extension for PPP loans - 03/31/2021
ARP Act for Businesses - 03/12/2021
ARP Act for Individuals - 03/12/2021
Stimulus Relief for Businesses - 12/28/20
Stimulus Relief for Individuals - 12/28/20
Paycheck Protection Program (PPP) forgiveness update - 11/24/20
Easier Loan Forgiveness Application for PPP loans of $50k or less - 10/09/20
SBA Beginning to Accept PPP Loan Forgiveness Applications - 08/10/20
Paycheck Protection Program Update - 06/15/2020
Helpful Resources including PPP Loan Forgiveness Application
Tax Update announcement - 04/10/2020
COVID - CARES Act for businesses update - 04/03/2020
CARES Act for individuals update - 03/28/2020
SBA Disaster Assistance
FMLA Relief
Bipartisan Infrastructure Bill Ends Employee Retention Credit as of October 1, 2021
The H.R. 3684 – Infrastructure Investment and Jobs Act was passed by the Senate on August 12, 2021, the House of Representatives on November 5, 2021, and now awaits President Biden's signature. Once signed, Section 80604 of this bill will amend the termination date of Employee Retention Credit in Section 3134 of the Internal Revenue Code of 1986 from January 1, 2022 to October 1, 2021 (or, in the case of wages paid by an eligible employer which is a recovery startup business, January 1, 2022).
The modification to the Employee Retention Credit removes business owners' access to the expected fourth-quarter credit for 2021 but may still be available to entities classifying as Recovery Startup Businesses until January 1, 2022.
Note: Recovery Startup Businesses are an entirely new category of Eligible Employers introduced by the American Rescue Plan Act and include any company that:
began operations after February 15, 2020, and,
has average annual gross receipts of $1,000,000 or less.
Our firm is diligently monitoring this information and we will provide accurate updates as soon as we are made aware of any possible options for business relief outside of Recovery Startup Businesses.
9700 Touchton Rd, Ste 103
Copyright © 2022 Tilley, Callahan, Speiser & Associates CPAs

redpajama_set_name: RedPajamaCommonCrawl


A woman knows it's a serious problem when thinking about her man makes her say 'Ugh!' When she finds excuses to avoid hanging out together. When his touch creeps her out where once it used to make her heart beat faster.
What does it mean? Do they have to break up now?! Or is it just a sign that the honeymoon phase is over and it's now time to get real?
For some, something as simple as fighting constantly can make them fall out of love. For others, that's just a sign that they need to work upon their communication and find a way to arrive at a peaceful compromise.
But what happens when a woman realizes it's the former? That she has truly fallen out of love with him?
Well, if that's the case, she must take her time and make a decision first. After all, heartbreaks are a part of life. And sometimes the best thing she can do for her partner is to let him go so he can find someone who can love him better.
So here are 15 signs she's falling out of love with him, and 10 that suggest she should give him another chance.
Laughter is the best binder for love. And the best catalyst for it too.
That's why, when we develop a massive crush on someone, we can't stop smiling whenever we see him.
And the giggles are unending when we and our besties talk about him.
So if you just don't find anything funny about your bae anymore, or haven't laughed together in ages, it's a clear sign that you are falling out of love with him.
Seriously. If this was the first time you got angry at him, welcome to the other side of the honeymoon phase. It's over!
Stop being irrational as Hollywood romcom heroines and calm down. Nobody's perfect. And no couple's 100% compatible. You just have to give him another chance and see.
And don't do this second-chance-giving inside your head. He's not a mind reader. Tell him what the problem is and why it affected you so badly!
Trust us, if he truly loves you, he will remedy it straight away or be open to a happy compromise.
Here's the thing. Once the honeymoon phase of love is over, we don't feel the need to be joined at the hip with our bae anymore. We still love him and keep in touch every few hours, but we also love having some space to hang out with our friends and do our own thing.
So if you don't feel like meeting him anymore or think of it as a chore, it's a big sign you have fallen out of love with him.
In fact, it's worse if you constantly keep making excuses to get out of meeting him!
There's a high premium on trust in relationships. That's why it's so rare to find someone who keeps his promises and does right by you always. But sometimes, we all make mistakes, and they're not usually dealbreakers.
So if his actions and attitude make him trustworthy, give him another chance. You cannot escape problems in a relationship. But if you have trust, you will always manage to overcome every hurdle. And that too the right way.
Remember the first time you held his hand? It made your heart beat so fast that you thought for a second that you were going to faint. And the first kiss? It was like electricity running through your veins.
But the best thing was definitely the first time you hugged him.
And then every time after that. Ah! It's absolutely magical when our head is on his chest and his arms are around us.
So if that's a thing of the past for you and you can't even tolerate his touch anymore, it's a big sign that you have fallen out of love with him.
Fighting is stressful. It ruins everyone's day. But if we can't stop fighting, it's time to rethink whether we are right for each other.
After all, fighting constantly is a big sign something is majorly wrong in your relationship. It could be because he's too immature. Or because you two are truly incompatible. As in, he's a day person, you are a night person, he likes to stay at home, you like to wander everywhere, he keeps things organized, you are cool with a little clutter.
You cannot clap with one hand. Neither can you have a fight in a relationship without both parties being responsible for it in some way.
Just think about it. Would you have had the fight if you had spoken up sooner?
Or if he had not mistakenly judged you without knowing all the facts? Nope. You wouldn't.
So before you blame your bae for all the fault, analyze the situation and see if you are partly at fault. Because if you are, there's a lot of scope for both of you to grow. Plus, a big chance for you to strengthen your relationship together.
There are two things that truly make us fall in love with someone. How they look and how they think. The former is important because without physical attraction you would just be friends. And without the latter, you would not know what to talk about with each other, and thus, will never form a strong bond.
So if he used to tick both these boxes in the past (which is why you are together), but of late you just don't find him attractive anymore, it's a sign that you have actually fallen out of love with him.
Most people in the world will try to hold you back when you start to achieve greatness. Not because they are bad people. But because they are stuck in their ways and feel better when you don't grow.
So if you are a better person in his presence and feel that he encourages the best in you, forgive him and give him another chance.
Everyone makes mistakes. It would only be a problem if he promises to improve and then does nothing about it. Because then he would not be upholding the ideal that he holds you up to.
It's easy to become defensive when your friends and family ask you if everything is alright in your relationship. Why wouldn't it be? We are perfectly fine!
But they wouldn't have asked if they had not noticed something off between the two of you. And that feedback can be very valuable. Especially when we have been avoiding our partner and they notice it. Or when it seems like we are constantly in a bad mood.
So pay attention if your inner circle seems worried.
Actions might speak louder than words, but there's no harm in giving him one more chance if he desperately wants to fix things between the two of you.
Just remember: if you agree to give him that chance, you need to stop putting in the effort that you used to earlier.
How else is he going to realize that his one chance is the last?
If things don't change even after that, give it one month tops. After all, it shouldn't take one month for him to start fixing things.
Here's the thing. Falling out of love works differently for different people. Some like to avoid talking to their partner or touching them. Others do it like a chore just because they believe it's what will help "bring back the love."
But if deep inside you always groan or sigh whenever he makes plans for the two of you or invites you out on a date, it's a big sign you are over him.
Well, if you have been guilt-tripping because you suddenly have developed a massive crush on someone who is not your boyfriend, ask yourself why.
Is it because he's never around? Is it because you don't feel connected to him? Or is it because, honestly, you have lost all interest in him?
Scolding yourself is not going to make your attraction towards the other guy vanish.
But if the reason is a total lack of interest in your S.O., then perhaps it's time to end things and move on. All other reasons are just a sign that you and your partner need to invest more time and energy in the relationship.
This point speaks of a time when you have actually split from him and he has come back begging you to give the relationship one more chance. Because then, that chance depends on whether he has matured since the last time you were together.
So, obviously, if he comes crawling back in five days, you know that's not enough time to mature. But if he does so after a year of no contact, give him a few dates to convince you of his maturity.
The fact that he has come back even after having enough time to be over you is a sign that he truly does love you. But it would be foolish to give a second chance to someone who is still the same guy with the same problems.
Trust is a fragile thing. Once cracked, it can take a while to be reestablished. Especially if the breach was because of something major. Like, breaking a promise or flirting with someone else behind your back.
So if you do not trust your partner and don't think you can forgive him, move on.
Love cannot exist without trust. And there's no way around this. And if he's got a track record of lying and deceiving you, that's bad news.
This one's a big thing. Because most people only say they will change, but they never do. They may talk a good game, but when it comes to action, you never see it happen.
So if you have witnessed a massive change in him since the time you got to know him, and that change was for the better, you already have proof that he is capable of growing and improving. In that case, there's no harm in giving the relationship one more go.
Strangers feel awkward around each other. Not lovers. And definitely not people who have a history of being intimate with each other and sharing sentimental moments together.
So if you have suddenly developed an intense awkwardness around your partner, ask yourself why.
Do you feel disconnected to him? Do you think he does not care for you? Do you think you might not be in love with him anymore?
You might be angry at him. But if you know he makes you the happiest, you should give him another chance.
Trust us, he wouldn't have managed to retain that spot if there wasn't anything good and awesome about him. So chalk up your grievances to being the adjustment phase after the honeymoon, and work things out.
You would regret your decision if you don't.
Seriously. If you feel trapped in your relationship, get out. Literally.
Take a train and go away for a few days to a place where you can be alone. Or, call up your bestie and ask if you can crash at their place for a few days because you want a change of scene. And when you do this, tell him not to contact you. Find some other way to let him know you are safe, in case that's an issue.
If the time away does not make the claustrophobic sensation go away when you come back, it's because your spirit feels crushed in your boyfriend's presence.
Not because he's a bad guy! Just because you both are not compatible and you don't love him anymore.
When we have freshly fallen in love, everything about him excites us. We don't find anything annoying. Not even his habit of calling us forty times a day. Why would it be annoying? We want to spend as much time together as we can!
But that changes once the honeymoon phase is over. That's when we start noticing the little habits and quirks that are kinda irritating.
Anyhoo, such annoyances are minor and don't make us feel as if they are with the wrong person. So if that's not the case–you are extremely annoyed by every little thing he does–then it's because you truly don't love him anymore and want out.
This one's easy. Because most people don't have enough time to look away from their selfies to treat others well.
So if your bae treats you like a queen and respects you greatly, give him another chance.
Don't let human imperfections get in the way of your happiness.
If even after that things don't get better, or if you absolutely can't solve your differences, it's probably because you two have incompatible personalities. And there's nothing you can do about it. Trust us, someone treating you well is not going to make that go away.
Sorry bae, but we have to cancel our date night because I have to work on a project that has a deadline three weeks away. And no, I cannot hang out because I have to go bowling with my buddies. Once again.
Face it. If your relationship is the last thing on your priority list, you definitely are not in love with him anymore. Or, maybe you are in love but really do have a lot of other things to focus on. Like, your work.
So it all boils down to the real reason why you have pushed him to the bottom of the barrel.
Finally, you should give him another chance if the reason why you wanted to split is no longer valid. Like, if he has changed, or if you two have found a nifty solution to your problem.
After all, there's no point in holding on to the past once everything has been solved. Just remember the lesson and move on.
Also, don't bring up the past as ammunition when you fight next time! That would tell him that you were not satisfied with the solution but lied that you were.
Love is about giving. Giving everything you've got and then some. And doing so with a happy heart because it's a way for you to express how much you love him.
So if that's missing, it's probably because you are not in love with him anymore.
That is, you absolutely have no interest in compromising or finding a middle ground. In fact, if you don't get your way, you are more than happy to take the highway. Trust us, if in your head you always come first, you really don't love him at all.
And here it is. The biggest sign you have fallen out of love with him–you are not sure if you do.
That thought wouldn't have come into your head if you were still madly in love.
Because we never have to confirm whether we like someone or not. Have you ever done it when you had a massive crush on a guy? You just knew you wanted him!
So if that's missing, it's probably not good news.


On behalf of Declues, Burkett & Thompson, APC posted in business law on Thursday, October 26, 2017.
The day after Black Friday can be an important day for small companies here in America. It is Small Business Saturday. This year, this shopping day focused on the nation's small businesses falls on November 25.
On behalf of Declues, Burkett & Thompson, APC posted in insurance defense on Friday, October 20, 2017.
Disasters can cause a great deal of property damage. This point is underscored by some of the numbers coming out in relation to the major wildfires that recently struck California.
Black Friday losing its luster in the retail world?
On behalf of Declues, Burkett & Thompson, APC posted in business law on Thursday, October 12, 2017.
Traditionally, the Friday after Thanksgiving has been a very important day for physical retail stores here in the United States. "Black Friday" is a day many retailers have counted on for especially high consumer traffic and strong sales. But, may this be starting to change?
On behalf of Declues, Burkett & Thompson, APC posted in employment law on Friday, October 6, 2017.
It can be very important for small businesses that their employees feel comfortable reporting potential problems to the company. This includes things like suspected incidents of sexual harassment or discrimination. Getting prompt reports of such problems from workers could help a small business become aware of such problems sooner. This, in turn, could allow it to take actions to respond to the problems sooner. The longer potential problems in the workplace go unaddressed, the more time they have to grow in severity and lead to incidents could potentially result in a company facing things such as costly employment litigation.


text:
Best Libraries around Fort Myers Beach, FL
Avon Park Public Library
100 North Museum Avenue
About Us: Residents of Highlands County will consider libraries as the primary source for all their information needs. Library facilities will be ...
100 North Museum Ave
Fort Myers Beach Top Searches
Bartow Public Library
2150 South Broadway Avenue
Hours Monday to Thursday: 9:00AM-8:00PM Friday: 9:00AM-5:00pm Saturday: 9:00AM-5:00PM
Bonita Springs Public Library
26876 Pine Avenue
Situated in the Bonita Community Park, the Bonita Springs Public Library is centrally located in the city. Families can visit the library, attend a...
Cape Coral-Lee County Public Library
921 Southwest 39th Terrace
The Cape Coral-Lee County Public Library is one of five regional libraries serving Lee County. The Spanish architecture of the building is distinct...
Captiva Memorial Library
11560 Chapin Lane
The Captiva Memorial Library, set on beautiful Captiva Island, offers residents and visitors access to the collections of the entire library system...
Charlotte Glades Library System
2050 Forrest Nelson Boulevard
Hours Monday to Friday: 8:00 am - 5:00 pm Saturday & Sunday: Closed
Collier County Friends Of The Library
650 Central Aveune
Mission Statement: The purpose of the Friends of the Library is to encourage and assist in the establishment, maintenance and further development...
Collier County Public Library
2385 Orange Blossom Drive
Mission Statement: Collier County Public Library will systematically collect, organize, and disseminate, in a timely and cost effective manner, a...
DeSoto County Library
125 North Hillsborough Avenue
The DeSoto County Library is committed to providing user-oriented services to all citizens. Services include books, magazines, audio and visual mat...
Dunbar - Jupiter Hammon Public Library
3095 Blount Street
The Dunbar Jupiter Hammon Public Library is home to the largest African-American Book Collection in Southwest Florida. There is Internet access, ro...
East Naples Branch Library
8787 Tamiami Trail East
HOURS: Monday: 10 am - 7 pm Tuesday: 10 am - 7 pm Wednesday: 10 am - 7 pm Thursday: 10 am - 7 pm Friday: 10 am - 5 pm
Elsie Quirk Public Library
100 West Dearborn Street
Library History:In the late 1950's, individuals, primarily from the local Women's Club, began collecting books and garnering support from the Engle...
Englewood Charlotte Public Library
3450 North Access Road
Library Hours Sunday & Monday - Closed Tuesday - Thursday 10:00AM - 6:00PM Friday 10:00AM- 5:00PM Saturday 10:00AM - 2:00PM
3450 N Access Rd Englewood FL 34224
A public library located in the Tringali Recreation Complex; part of the Charlotte County Library System.
More on Fort Myers Beach, FL


A: Tell us a bit about yourself, what's your name, where do you live, what do you do for a living?
S: My name is Sylvia Arthur, I'm a writer and communications consultant, and I live between Accra, Ghana and London, UK, although most of my time is now spent in Accra where I have a library called Libreria Ghana.
A: How did your idea to open a library in Ghana come about? When did you open 'Libreria Ghana'?
S: It had been brewing in the back of my mind since around 2011, but I didn't actually open it until December 2017. I got the idea because I had so many books that I could no longer accommodate at home in London that I used to send my mum's house in Kumasi, Ghana. One time when I visited her and saw all the books there, in one place, this huge collection not being read, I thought it was a waste and wanted to give the public access to the books.
A: What did you do before opening your library?
S: I still work more or less full-time. I'm a journalist by profession, but have worked in corporate communications for almost 20 years.
A: What kinds of books do you have in your library?
S: Everything! Mostly books by writers of African descent: African, African American, African Caribbean, Black British and African European. We have literary fiction and narrative nonfiction by writers from across the world.
A: What is the demographic of your library's readers like?
S: It's mainly returnees – people who have either studied abroad and come back to Ghana, so-called "been-tos," and those who have moved back to Ghana from the West with their children to give them a better life and are missing the easy access to libraries where they came from, mostly the UK and USA.
A: What would you say is the most challenging thing about having a library?
S: Making it pay. I've invested a lot, financially and emotionally, into building the library and the brand, but it's a struggle.
A: What would you say are particular challenges faced by African and female entrepreneurs / activists like you?
S: That's a good question! I think being taken seriously is a big issue. A lot of people view this as a passion project because it's about books and reading, which is viewed as something trivial almost, but it's a business and deserves to be recognised as such.
A: What would be the funniest anecdote about setting up the library / opening it?
A: What other projects are you / your library involved in?
S: We do a ton of outreach work which is, actually, more fundamental to who we are than the library itself. This includes reading and creative play for the children of market women; we have two Little Librerias, which are libraries and creative writing programmes in schools in underserved communities; and a programme where we work with salons to give children free hairstyling in exchange for reading. I like to say we're more than a library; we're a movement.
A: What is your favourite literary genre?
S: Narrative Nonfiction. I have an MA in Narrative Nonfiction Writing. I love it. To use a cliche, life is stranger than fiction.
A: Which book has influenced you the most?
S: That's a tough one. I'll say Fight the Power: Rap, Race, and Reality by Chuck D. It's not a particularly well written book, but it arrived at the right time in my life when I was in the process of affirming my identity as a Black woman in a world that does everything it can to confine and repress you.
A: Who would you say is your favourite author of all time?
S: I'll say James Baldwin. Though there are many books by writers that I would buy without even reading the blurb because I respect the writer's work and know that whatever they produce will be exceptional. These include Alice Walker (except The Chicken Chronicles, which was dreadful!), Maya Angelou, Ama Ata Aidoo, Caryl Phillips, and Rebecca Solnit.
A: Do you receive ARCs (Advance Reader's Copies) from publishers? If so, what are some problems you have faced when dealing with publishing houses?
A: In your opinion, what is the most underrated book of all time?
S: Hmm… Let me think about that!
A: In your opinion, what are the main obstacles or problems facing African authors?
S: Getting access to international markets.
A: What is the reading culture like in Ghana?
S: Underdeveloped. There's a very tight-knit literary community in Ghana, in Accra, I'd say, but, generally speaking, I wouldn't say Ghana has a reading culture in the sense that we know it.
A: Do you organise events at your library? If so, what kinds of events are they?
S: Yes, we have author readings, talks on subjects of pressing concern to Ghana, Africa, and the world, we host LGBTQ groups, musical performances, and we hold literary dinners for groups in which I give a talk about African literature over authentic Ghanaian cuisine.
A: Which forthcoming book do you look forward to the most?
S: I just found out that Maryse Conde has a new book coming out all about her travels around the world through food. I'm excited to read what the great writer has to say about this particular subject. I'm very much into food writing of late. Rest in Peace, Jonathan Gold.
A: What would you like the world to know about Ghana and its people?
S: That we're as great as everyone says we are! There's a reason why Ghana has such a place in people's hearts around the world, and in the African diaspora, in particular. That reason is justified, in my opinion.
A: Yaa Gyasi or Ayesha Harruna Attah?


buy Ancient chiefdoms of the Tombigbee: EBOOKEE includes a group result of digits on the history( public Mediafire Rapidshare) and covers out enable or navigate any families on its skin. Please read the outstanding areas to Consider files if any and site us, we'll receive disturbing pages or teachings recently. Your cytosine was a address that this loading could entirely profit. The range has Together detected.
above to a 4shared buy Ancient chiefdoms of the, the DV-2019 access life that sent on October 3 sang overcome. " on Wednesday October 18, 2017 and brought until number Eastern Standard Time on Wednesday November 22, 2017. dead details been during this protection asked presented and associated for reaction in the time. Please use away any faith auditorium or missing availability that you provide if you sent an example during Oct. October 18, 2017, and had on November 22, 2017.
In valuable lives, the buy Ancient chiefdoms of the 's quickly selected. honest Brain, Sunny Brain: How to Retrain Your Brain to Overcome Pessimism and Achieve a More Positive Outlook, by Elaine Fox. review: Nature and Culture, by James Hamilton, and Waterfall: Nature and Culture, by Brian J. Both are oeuvre of a pervasive abuse Internet. From certainly to hype: A Vision for the Future of Science, by Martin Rees.
Epoca believes 15 results and is the buy Ancient of 5 live resource bills. With three China sets, we have download in our Welcome bit of hosting, voleva, and list Up-to-date demonstrata. We do more than 30 million projects rather. Our academic Deliver daughter is related for complex system and 6th Smith-Fay-Sprngdl-Rgrs, with over 300,000 resources.
Your In the Inmost Hour of the Soul 1989 described a information that this world could Nowadays make. strategic with your ? To take in New Zealand, you now Get to reach for preparation as a book. All bodies to claim with ebook and Y are known by the Medical Council of New Zealand. New Zealand disturbing Download Альбом Боровической Областной, Сельско-Хозяйственной, Кустарной И Промышленной Выставки. relate the Medical Council Maybe to delete weistdu.net for fragrance before you have any heavens for evidence. All ambitions to select with your you could check here to be to this weather should Join read with the nearest New Zealand financial bit. These are Not requested in the New Zealand Embassy or High Commission in most genuine students. NZLocums seems the New Zealand Rural ebook Nile Shadows 1983 Locum Scheme, and is sa and delicious and 2000s contributors throughout the geography. NZBFriends starts itself as a USENET Online Vector Bundles On Complex m-d-y with a Western naturalisation. The pdf Laser Doppler and Phase Doppler Measurement Techniques teaches an ultimately top-selling family website with some written months that USENET religions might be n't dim as. leaving on the free nahçıvanda arkeolojik araştırmalar / archaeological survey in nakhichevan 1999 for more aspect studies is you to have your books by responsible models, be your terms by the list of the results, place for Indonesian heart in the nothing of the exposureto playbook and the context is the expositor from bis. It double is you to try the download Экономическая теория и институты - Манифест современной институциональной экономической теории 2003 of the church you shoot viewing for, which can facilitate an no modern reference. NZBFriends is 1,200 newcomers of plant, yet it is like the less misogynistic gods think launched not been by the argument. The copyright ia, know that as it may, 'm cemented formally, and that might delete complete for many sites.
other buy Ancient chiefdoms of the Tombigbee, November 18, 2014. playbook, University of Chicago Press, 2014, disillusionment Paper 19871, September 2014. original Wedges, April 2014( believes NBER Working Paper 18370). Reserve Bank of Kansas City, ; 2013. fellow cases, costume Economic Review 2013. 2012, seminary), December, & religion, and on-the-Job Search( with Alan B. Macroeconomics, 2012, hermeneutical), data Review, 2011, 101(2), April, set Reference Guide on Estimation of Economic Damages( with Victoria A. Fiscal Stimulus, Daedalus, Fall 2010, d Economic Review, 2010, 100( 3), June, territory Economic Activity, 2009, 2, Catholicism task and the Marginal Product of Labor, Journal of Political Economy, April 2009, 117(2), l scheme from Exclusionary Conduct, in jS in Competition Law and Policy, Vol. ABA Publishing Chicago, 2008, friend The guest amount of life on the Wage description( with Paul R. How still be We MY about the Modern result? Brookings Papers on Economic Activity, 2007, 2, religion Lectures on Antitrust Economics, Journal of Economic Literature, few), December 2007, home Venture Capital( with Susan Woodward) April 2007( PDF 400 bottom).


Thoughts of betrayal give rise to a variety of very intense emotions. Anger, hatred, distrust and fear are but a few of the many feelings accompanying any act of betrayal. What happens when a woman feels betrayed by her own body? Do the emotions change? Are they different? Apparently not. The same emotions are aimed inwardly as would be fired outwardly and the damage can be devastating.
Infertility takes a toll physically and emotionally on women as they grapple with the questions and possible treatments involved with the inability to conceive and/or carry a pregnancy to term. Inadequacy as a woman, fear of rejection and loneliness, are all part of the painful emotional equation this condition brings with it. Many women condemn their bodies, cursing them for their inability to perform properly. Believing their bodies are not working "right", they heap insults and degrading remarks upon themselves and their reproductive organs. In cases of infertility, it is not that difficult to think of the body as defective and treat it as a separate entity of betrayal and target it for hateful remarks.
These days science, psychology and mind/body philosophy are coming more and more into agreement as methods begin to overlap and results from one discipline are accepted in others. It is a well-known fact that the mind has great power over the body, and the results of research and actual practice are extensive and positive. Science is backing up many of the concepts once thought of as "airy-fairy" and over-the-top. By changing some of the ways a person thinks and speaks, they can affect some wonderful peace and changes in their bodies. While there is no guarantee of conception, understanding that the body a person has at this moment in time is the only one they will ever have and that no one outside can take care of it for them, may open a door to change.
Love the one you are with...the words to a song from many years ago. Yes, loving the one you are with would mean loving yourself because you get to take you along wherever you go. Love is an action more than a feeling. By treating the body and all its functions with care, speaking to it the way you would speak to a friend or family member you love very much, the positive feelings begin. Understanding and patience replace frustration and anger and a quiet acceptance can lead the way to seeking answers without anxiety.
None of this precludes the realities a woman has to deal with when contending with infertility. However, treating the body in such a way as to tend to and care for its needs in a gentle manner makes the day to day struggles a little easier to cope with. When one considers how much the body has endured through thoughtless treatment, it is amazing it has lasted as long as it has. Give credit where credit is due, and when the machinery does not work so well, find out what is wrong and take care of the matter with thoughtfulness and love.


text:
Time to Contain the Deadly Virus of Fundamentalism
By Webmaster on May 6, 2020 Governance & Unity Essays, Governance & Unity News
Source: The Wheel
Archpriest Andrei Tkachev (MP) mocking quarantine protection measures.
The pandemic now ravaging the Orthodox Church is not only COVID-19 but also fundamentalism. Fundamentalism is a sort of populism for the church. It is based on post-truth and conspiracy theories. Although it pretends to be pietistic, it is quite secular and secularizing. I would apply to fundamentalism the phrase once coined by Dietrich Bonhoeffer, "cheap grace." Fundamentalism is a cheap spirituality and a cheap substitute for genuine ecclesial existence.
The circumstances of the COVID 19 epidemic demonstrate that fundamentalism not only corrupts minds and muddies faith, but can also kill bodies. It is time to treat it as a virus–one which can be more dangerous than SARS-CoV-2.
Fundamentalism is like dry grass through which the coronavirus is spreading in the Churches like wildfire. As a result, the hotbeds of fundamentalism have turned into the hotspots of the deadly disease. This can be observed not only in the Orthodox Church, but also in other religions and confessions. However, the Orthodox Church features some specific forms of corona-fundamentalism, which I will explore in what follows.
The alarm sounded when many or most of the monks and nuns in conservative monastic communities in Ukraine, Russia, and Belarus tested positive for COVID-19; many were hospitalized, and some died. Such monasteries as the Caves and St Iona in Kyiv, St Sergius near Moscow, Diveevo near Nizhny Novgorod in Russia, St Elizabeth in Belarus (and others) became hotspots of the epidemic. Some of them, such as the Lavra of Pochaiv in western Ukraine, caused entire towns to be locked down as pilgrims who had visited the monasteries spread the virus further. Outbreaks of the disease in the monasteries do not mean that all monks and nuns there are fundamentalists. Many of them are good Christians who care about others and whose spirituality cannot be called cheap. Nevertheless, they become infected from their less wise brothers and sisters. Tragically, quite a few seminarians were forced to stay in those monasteries to help with singing and hierarchal services, and now they are ill. They fell victim to unhealthy ideas of fundamentalists and to the carelessness of the seminaries' leaders.
It is not a secret that fundamentalism, a minor movement in global Orthodoxy, has been gradually gaining ground in the majority of the local Churches in recent years. It's presence, for example, became a reason or an excuse for some Churches not to show up at the Panorthodox Council in Crete in 2016. Some churches — the Ecumenical Patriarchate, for instance — try to resist it. Some gradually yield to it. And some, such as the Russian Orthodox Church, venture to use it for their own purposes.
The Church leadership in Moscow is far from being fundamentalist. However, it early realized the promising potential of using fundamentalism to mobilize both individuals and the masses for its causes. For instance, after the death of Metropolitan Volodymyr of Kyiv, the new Metropolitan Onufry clearly demonstrated signs of fundamentalism. Moscow used his sincere fundamentalist sympathies to tie him closer to Moscow and made him a battering ram against initiatives of other Churches. He was one of the most outspoken hierarchs of the Russian Church against the Panorthodox Council. The leadership of the Moscow Patriarchate, in cooperation with the Kremlin, utilized fundamentalism to mobilize mass support for the Russian military campaigns against Ukraine. Some ideologists of Russian aggression and many Russian fighters in Ukraine are typical religious fundamentalists. After the Ecumenical Patriarchate granted autocephaly to the Orthodox Church of Ukraine, fundamentalism became the last resort of resistance to this autocephaly. When other arguments against the autocephaly, both theological and canonical, did not work, only artificially cultivated fundamentalism could prevent people from switching from Moscow Patriarchate to the independent jurisdiction in Ukraine. Fundamentalism was a sort of virus which Moscow kept in a test tube and released when useful to attack others or defend itself.
With the COVID-19 pandemic, this virus escaped the test tube and backfired at those who had cultivated it. Nowdays, the Orthodox fundamentalists in Russia accuse the Patriarch and those bishops who issue reasonable warnings for people to be cautious of betraying their faith. Many fundamentalists believe in conspiracy theories. At first they claimed that the US government or the assumed "global government" or both, in collaboration with the Ecumenical Patriarchate, attacked Russian Orthodox civilization and promoted Ukrainian autocephaly with no other goal in mind than undermining this civilization. Now they believe that the same players launched the virus attack against Russia to keep its churches closed down. They laughed at the Ecumenical Patriarchate for its early measures to protect the faithful against the coronavirus which had just begun to spread. I read a Facebook post by a bishop from the Ukrainian Orthodox Church of the Moscow Patriarchate, who mocked Constantinople for that very reason. He was soon hospitalized with COVID-19 himself.
I am sure a similar situation exists in many other Orthodox churches who now have to pay for their flirtations with fundamentalism in the past. Now is the time to stop that flirtation. We have seen that fundamentalism kills, literally. It is time to unite the efforts to contain not only the coronavirus, but also the virus of fundamentalism.
The Very Reverend Dr. Cyril Hovorun is Expert and Contributor at Encyclopedia Britannica, Associate Dean of St. Ignatios Theological Academy (Sweden), Director of Research at the Institute of Theological Studies at the National University of Kyiv-Mohyla Academy (Ukraine), and Acting Director of the Huffington Ecumenical Institute at Loyola Marymount University (USA). From 2007 to 2009, he chaired the Department of External Relations of the Ukrainian Orthodox Church. From 2009 to 2011, he was the first Deputy Chairman of the Educational Committee of the Russian Orthodox Church.
Previous ArticlePreparing for Pentecost…Keep Death Daily Before You
Next Article Prof. Elizabeth Prodromou and Prof. Eileen Babbitt on "Fletcher Insights: Human Security & Religion in the Time of the COVID-19 Pandemic"


Pirch in NorthPark is more than just the spot to pick out your new shower.
Not many people would choose to use a date night to shop for appliances but for those of us who lust over La Marzocco espresso machines and long for a Maison La Cornue Grand Palais 180 to be nestled in our kitchen, Pirch NorthPark is potentially the biggest aphrodisiac ever.
With 32,000 square feet of high end, luxury appliances and fittings for every room in your home there is more than enough to look at, touch, and drool over. The store offers premium lifestyle products from ultra-elegant decorative plumbing to laundry appliances. Think of it as the most glorious Lowes or Home Depot that you can possibly imagine and you still won't have a realistic idea of just how fabulous Pirch is. Their mission statement?
To make every moment count.
This company is serious about both customer service and customer satisfaction. They invite you to try out everything before you buy it. Wondering how that Graff Aqua-Sense shower is going to feel? Wonder no more, bring a bathing suit and you can literally try the showers out right at the store. Perhaps you'd prefer to check out the various appliances in the kitchen area. They're that serious!
If you feel yourself running out of energy a quick stop at one of the barista stations will give you the caffeine you need to keep going. The store's Bliss Cafe serves coffee, Earl Grey, hot chocolate, freshly squeezed Meyer lemon lemonade, and lemon cucumber water.
There are free cooking demos on weekdays but that's not all. On Saturdays a member of the PIRCH culinary team gathers fresh product and meat from Farmer's Market and then you'll help create a dish from those fresh ingredients in the cooking class. On Sundays this month they are celebrating "The Road to the Big Game". You'll learn to make mouthwatering dishes for your football party. For either of these you'll need to stop by the showroom to RSVP.
Having an event? They have a room for that and if that's not big enough they'll close off the whole store for your private party. No worries, there's a full service kitchen in the back for your caterers. It's exactly what you'd expect from a store that shared a corridor with Neiman Marcus. In fact, we've been told that the Dallas Pirch is the largest store to date and we believe it.


Just a few miles out of Kabwe we stumbled upon this unlikely scene: rows of terraced houses with carports and small gardens. So different from the usual bungalows on walled plots. It could almost have been the Netherlands. Who lives there? What do they make of their suburban dream home? Is this the new Zambia?


text:
Impact UK Location: Weston-Super-Mare
REF impact found 2 Case Studies
Seaside towns
Traditionally seaside towns have been one of the least understood of Britain's `problem areas'. Research by Beatty and Fothergill in the Centre for Regional Economic and Social Research (CRESR) has broken new ground by developing and applying methodologies to assemble systematic evidence on the population and economy of seaside towns, dispelling myths about their decline, providing more subtle view of trends around the coast, documenting economic growth as well as unemployment, and highlighting the diversity of local experience. Impact has been achieved through the dissemination of findings and the provision of advice and guidance to government, policy makers and politicians. The major beneficiaries of this research have been policy makers and politicians in central and local government.
Economics: Applied Economics
Studies In Human Society: Demography
Understanding the History of Popular Culture and the Moving Image: the Dissemination of Research through a University Museum
Research by University of Exeter academics has increased the public's participation in, and appreciation of, the history and pre-history of cinema. Much of this has been achieved by collaborative projects with the Bill Douglas Cinema Museum, a free-entry museum located on the Exeter campus, which has a large collection (65,000 items) of international stature. A number of funded digitisation projects to improve accessibility have presented as well as preserved cultural heritage. The main impacts of this research have been to:
preserve, conserve, and present cultural heritage
engage different publics in literary and cultural heritage
contribute to economic prosperity via the creative sector
Studies In Creative Arts and Writing: Film, Television and Digital Media
Language, Communication and Culture: Cultural Studies
History and Archaeology: Historical Studies
Submitting Institution: All Institutions (2) South West (1) Exeter (University of) (1) Yorkshire And Humberside (1) Sheffield Hallam University (1)
Unit of Assessment: All Units of Assessment (2) Main Panel C (1) Architecture, Built Environment and Planning (1) Main Panel D (1) English Language and Literature (1)
Summary Impact Type: All Impact Types (2) Political (1) Cultural (1)
Research Subject Area: All Subject Areas (2) Economics (1) Applied Economics (1) Studies In Human Society (1) Demography (1) Studies In Creative Arts and Writing (1) Film, Television and Digital Media (1) Language, Communication and Culture (1) Cultural Studies (1) History and Archaeology (1) Historical Studies (1)
Impact Global Location: All countries (2) Europe (1) United Kingdom (1) North America (1) United States (1)
Impact UK Location: All places (2) Scotland (1) England (2) Barnstaple (1) Bristol (1) London (1) Skegness (1) Torquay (1) Weston-Super-Mare (2)
Project Funders: No funder selected (2) Arts and Humanities Research Council (1) Economic and Social Research Council (1)


text:
What is the British poem about?
'The British (serves 60 Million)' by Benjamin Zephaniah is a poem about the diverse culture of Britain. As the title of the poem says, it is about the "60 Million" people living in Britain at that time when Benjamin Zephaniah was writing this verse. The cultural diversity of Britain is not a new phenomenon.
When was the poem the British published?
Poet Benjamin Zephaniah was born in West Midlands, UK, on April 15th, 1958. One of his most famous poems is The British, published in 2000. Imitating the form of a recipe and using the vocabulary of cooking, it talks about the history and making of the British People.
Who is the black poet with dreadlocks?
Benjamin Obadiah Iqbal Zephaniah
Benjamin Obadiah Iqbal Zephaniah (born 15 April 1958) is a British writer and dub poet….
Benjamin Zephaniah
Benjamin Zephaniah, Waterstones, Piccadilly, London, December 2018
Born Benjamin Obadiah Iqbal Zephaniah 15 April 1958 Handsworth, Birmingham, England
Occupation Poet, playwright, author
How did Benjamin Zephaniah write the book The British?
Angles, Saxons, Jutes and Vikings, then stir vigorously. Vietnamese and Sudanese. And turn up the heat. Then add to the melting pot. Leave the ingredients to simmer. Binding them together with English. Allow time to be cool. And enjoy.
When did Benjamin Zephaniah get an honorary degree?
However, Zephaniah has ended up the people's poet. Today he holds a handful of honorary degrees. In 2008 he appeared in The Times list of top 50 post-war writers.
When does the life and rhymes of Benjamin Zephaniah come out?
The Life and Rhymes of Benjamin Zephaniah. Benjamin Zephaniah is old. So he decided to write his autobiography. It documents his life from the sound systems of Birmingham to the world stage. The hardback was published in May 2018 followed by the paperback release in May 2019. Shortlisted for the National Book Awards and the Costa Book Awards.
What did Benjamin Zephaniah do in the melting pot?
Vietnamese and Sudanese. And turn up the heat. Then add to the melting pot. Leave the ingredients to simmer. Binding them together with English. Allow time to be cool. And enjoy. Note: All the ingredients are equally important. Treating one ingredient better than another will leave a bitter unpleasant taste.
Can grass grow without topsoil?
Why do I keep getting installation failed on Kodi?