예제 #1
0
파일: p_hud.c 프로젝트: ZwS/qudos
/*
 * ================== Cmd_Help_f
 *
 * Display the current help message ==================
 */
void
Cmd_Help_f(edict_t * ent)
{
	/* this is for backwards compatability */
	if (deathmatch->value) {
		Cmd_Score_f(ent);
		return;
	}
	ent->client->showinventory = false;
	ent->client->showscores = false;

	if (ent->client->showhelp && (ent->client->pers.game_helpchanged == game.helpchanged)) {
		ent->client->showhelp = false;
		return;
	}
	ent->client->showhelp = true;
	ent->client->pers.helpchanged = 0;
	HelpComputer(ent);
}
예제 #2
0
/*
==================
Cmd_Help_f

Display the current help message
==================
*/
void Cmd_Help_f (edict_t *ent)
{
	// this is for backwards compatability
	if (deathmatch->value)
	{
		Cmd_Score_f (ent);
		return;
	}

	ent->client->showinventory = false;
	ent->client->showscores = false;
	ent->client->showabilities = false;		//TMF7 GHOST MODE ( ghud )
	ent->client->showcollection = false;		//TMF7 GHOST MODE ( ghud )

	if (ent->client->showhelp && (ent->client->pers.game_helpchanged == game.helpchanged))
	{
		ent->client->showhelp = false;
		return;
	}

	ent->client->showhelp = true;
	ent->client->pers.helpchanged = 0;
	HelpComputer (ent);
}
예제 #3
0
파일: p_view.c 프로젝트: basecq/q2dos
/*
 * Called for each player at the end of
 * the server frame and right after spawning
 */
void
ClientEndServerFrame(edict_t *ent)
{
	float	bobtime;
	int		i;

	if (!ent)
	{
		return;
	}

	current_player = ent;
	current_client = ent->client;

	/* If the origin or velocity have changed since ClientThink(),
	   update the pmove values. This will happen when the client
	   is pushed by a bmodel or kicked by an explosion.
	   If it wasn't updated here, the view position would lag a frame
	   behind the body position when pushed -- "sinking into plats" */
	for (i = 0; i < 3; i++)
	{
		current_client->ps.pmove.origin[i] = ent->s.origin[i] * 8.0;
		current_client->ps.pmove.velocity[i] = ent->velocity[i] * 8.0;
	}

	/* If the end of unit layout is displayed, don't give
	   the player any normal movement attributes */
	if (level.intermissiontime)
	{
		// FIXME: add view drifting here?
		current_client->ps.blend[3] = 0;
		current_client->ps.fov = 90;
		G_SetStats (ent);

		if (level.fadeFrames > 0) /* FS: Zaero specific game dll changes */
		{
			float ratio = (float)(50 - level.fadeFrames) / 50.0;
			SV_AddBlend (1, 1, 1, ratio, current_client->ps.blend);
		}

		return;
	}

	AngleVectors(ent->client->v_angle, forward, right, up);

	/* burn from lava, etc */
	P_WorldEffects();

	/* set model angles from view angles so other things in
	   the world can tell which direction you are looking */
	if (ent->client->v_angle[PITCH] > 180)
	{
		ent->s.angles[PITCH] = (-360 + ent->client->v_angle[PITCH]) / 3;
	}
	else
	{
		ent->s.angles[PITCH] = ent->client->v_angle[PITCH] / 3;
	}

	ent->s.angles[YAW] = ent->client->v_angle[YAW];
	ent->s.angles[ROLL] = 0;
	ent->s.angles[ROLL] = SV_CalcRoll(ent->s.angles, ent->velocity) * 4;

	/* calculate speed and cycle to be used for
	   all cyclic walking effects */
	xyspeed = sqrt(
			ent->velocity[0] * ent->velocity[0] + ent->velocity[1] *
			ent->velocity[1]);

	if (xyspeed < 5)
	{
		bobmove = 0;
		current_client->bobtime = 0; /* start at beginning of cycle again */
	}
	else if (ent->groundentity)
	{
		/* so bobbing only cycles when on ground */
		if (xyspeed > 210)
		{
			bobmove = 0.25;
		}
		else if (xyspeed > 100)
		{
			bobmove = 0.125;
		}
		else
		{
			bobmove = 0.0625;
		}
	}

	bobtime = (current_client->bobtime += bobmove);

	if (current_client->ps.pmove.pm_flags & PMF_DUCKED)
	{
		bobtime *= 4;
	}

	bobcycle = (int)bobtime;
	bobfracsin = fabs(sin(bobtime*M_PI));

	// detect hitting the floor
	P_FallingDamage (ent);

	// apply all the damage taken this frame
	P_DamageFeedback (ent);

	// determine the view offsets
	SV_CalcViewOffset (ent);

	// determine the gun offsets
	SV_CalcGunOffset (ent);

	/* determine the full screen color blend
	   must be after viewoffset, so eye contents
	   can be accurately determined */
	SV_CalcBlend(ent);

	/* chase cam stuff */
	if (ent->client->resp.spectator)
	{
		G_SetSpectatorStats(ent);
	}
	else
	{
		G_SetStats(ent);
	}

	G_CheckChaseStats(ent);

	G_SetClientEvent (ent);

	G_SetClientEffects (ent);

	G_SetClientSound (ent);

	G_SetClientFrame (ent);

	VectorCopy (ent->velocity, ent->client->oldvelocity);
	VectorCopy (ent->client->ps.viewangles, ent->client->oldviewangles);

	// clear weapon kicks
	VectorClear (ent->client->kick_origin);
	VectorClear (ent->client->kick_angles);

	if (!(level.framenum & 31))
	{
		/* if the scoreboard is up, update it */
		if (ent->client->showscores)
		{
			if (ent->client->zCameraTrack) /* FS: Zaero specific game dll changes */
			{
				updateVisorHud(ent);
			}
			else
			{
				DeathmatchScoreboardMessage (ent, ent->enemy);
			}
			gi.unicast(ent, false);
		}

		/* if the help computer is up, update it */
		if (ent->client->showhelp)
		{
			ent->client->pers.helpchanged = 0;
			HelpComputer(ent);
			gi.unicast(ent, false);
		}
	}

	// this we want to do regardless
	if (ent->client->zCameraTrack)  /* FS: Zaero specific game dll changes */
	{
		// decrease the visor frame time
		ent->client->pers.visorFrames--;
		if (ent->client->pers.visorFrames == 0)
		{
			stopCamera(ent);
			ent->client->pers.inventory[ITEM_INDEX(FindItem("Visor"))]--;
			ValidateSelectedItem (ent);
		}
	}

	/* if the inventory is up, update it */
	if (ent->client->showinventory)
	{
		InventoryMessage(ent);
		gi.unicast(ent, false);
	}
}