Exemple #1
0
///////////////////////////////
// Create a new view window
//
void CG_mvCreate(int pID)
{
    cg_window_t *w;

    if(CG_mvClientLocate(pID) != NULL) return;

    w = CG_windowAlloc(WFX_MULTIVIEW, 100);
    if(w == NULL) return;

    // Window specific
    w->id = WID_NONE;
    w->x = (cg.mv_cnt == 0) ? 0 : 30 + (12 * pID);
    w->y = (cg.mv_cnt == 0) ? 0 : 300 + (5 * pID);
    w->w = (cg.mv_cnt == 0) ? 640 : 128;
    w->h = (cg.mv_cnt == 0) ? 480 : 96;
    w->mvInfo = (pID & MV_PID) | MV_SELECTED;
    w->state = (cg.mv_cnt == 0) ? WSTATE_COMPLETE : WSTATE_START;

    if(cg.mv_cnt == 0) {
        cg.mvCurrentMainview = w;
        cg.mvCurrentActive = cg.mvCurrentMainview;

        if(cg_specHelp.integer > 0 && !cg.demoPlayback) {
            CG_ShowHelp_On(&cg.spechelpWindow);
        }
    }

    cg.mv_cnt++;
}
void CG_toggleSpecHelp_f(void)
{
	if(cg.mvTotalClients > 0 && !cg.demoPlayback) {
		if(cg.spechelpWindow != SHOW_ON && cg_specHelp.integer > 0) {
			CG_ShowHelp_On(&cg.spechelpWindow);
		} else if(cg.spechelpWindow == SHOW_ON) {
			CG_ShowHelp_Off(&cg.spechelpWindow);
		}
	}
}
void CG_keyOn_f(void)
{
	if(!cg.demoPlayback) {
		CG_Printf("[cgnotify]^3*** NOT PLAYING A DEMO!!\n");
		return;
	}

	if(demo_infoWindow.integer > 0) {
		CG_ShowHelp_On(&cg.demohelpWindow);
	}

	CG_EventHandling(CGAME_EVENT_DEMO, qtrue);
}
Exemple #4
0
// Demo playback key catcher support
void CG_DemoClick(int key, qboolean down) {
	int milli = trap_Milliseconds();

	// Avoid active console keypress issues
	if (!down && !cgs.fKeyPressed[key]) {
		return;
	}

	cgs.fKeyPressed[key] = down;

	switch (key) {
	case K_ESCAPE:
		CG_ShowHelp_Off(&cg.demohelpWindow);
		CG_keyOff_f();
		return;

	case K_TAB:
		if (down) {
			CG_ScoresDown_f();
		} else {
			CG_ScoresUp_f();
		}
		return;

	// Help info
	case K_BACKSPACE:
		if (!down) {
			if (cg.demohelpWindow != SHOW_ON) {
				CG_ShowHelp_On(&cg.demohelpWindow);
			} else {
				CG_ShowHelp_Off(&cg.demohelpWindow);
			}
		}
		return;

	// Screenshot keys
	case K_F11:
		if (!down) {
			trap_SendConsoleCommand(va("screenshot%s\n", ((cg_useScreenshotJPEG.integer) ? "JPEG" : "")));
		}
		return;
	case K_F12:
		if (!down) {
			CG_autoScreenShot_f();
		}
		return;

	// Window controls
	case K_SHIFT:
	case K_CTRL:
	case K_MOUSE4:
		cgs.fResize = down;
		return;
	case K_MOUSE1:
		cgs.fSelect = down;
		return;
	case K_MOUSE2:
	case K_INS:
	case K_KP_PGUP:
	case K_DEL:
	case K_KP_PGDN:
	case K_MOUSE3:
		return;

	// Third-person controls
	case K_ENTER:
		if (!down) {
			trap_Cvar_Set("cg_thirdperson", ((cg_thirdPerson.integer == 0) ? "1" : "0"));
		}
		return;
	case K_UPARROW:
		if (milli > cgs.thirdpersonUpdate) {
			float range = cg_thirdPersonRange.value;

			cgs.thirdpersonUpdate = milli + DEMO_THIRDPERSONUPDATE;
			range                -= ((range >= 4 * DEMO_RANGEDELTA) ? DEMO_RANGEDELTA : (range - DEMO_RANGEDELTA));
			trap_Cvar_Set("cg_thirdPersonRange", va("%f", range));
		}
		return;
	case K_DOWNARROW:
		if (milli > cgs.thirdpersonUpdate) {
			float range = cg_thirdPersonRange.value;

			cgs.thirdpersonUpdate = milli + DEMO_THIRDPERSONUPDATE;
			range                += ((range >= 120 * DEMO_RANGEDELTA) ? 0 : DEMO_RANGEDELTA);
			trap_Cvar_Set("cg_thirdPersonRange", va("%f", range));
		}
		return;
	case K_RIGHTARROW:
		if (milli > cgs.thirdpersonUpdate) {
			float angle = cg_thirdPersonAngle.value - DEMO_ANGLEDELTA;

			cgs.thirdpersonUpdate = milli + DEMO_THIRDPERSONUPDATE;
			if (angle < 0) {
				angle += 360.0f;
			}
			trap_Cvar_Set("cg_thirdPersonAngle", va("%f", angle));
		}
		return;
	case K_LEFTARROW:
		if (milli > cgs.thirdpersonUpdate) {
			float angle = cg_thirdPersonAngle.value + DEMO_ANGLEDELTA;

			cgs.thirdpersonUpdate = milli + DEMO_THIRDPERSONUPDATE;
			if (angle >= 360.0f) {
				angle -= 360.0f;
			}
			trap_Cvar_Set("cg_thirdPersonAngle", va("%f", angle));
		}
		return;

	// Timescale controls
	case K_KP_5:
	case K_KP_INS:
	case K_SPACE:
		if (!down) {
			trap_Cvar_Set("timescale", "1");
			cgs.timescaleUpdate = cg.time + 1000;
		}
		return;
	case K_KP_DOWNARROW:
		if (!down) {
			float tscale = cg_timescale.value;

			if (tscale <= 1.1f) {
				if (tscale > 0.1f) {
					tscale -= 0.1f;
				}
			} else {
				tscale -= 1.0;
			}
			trap_Cvar_Set("timescale", va("%f", tscale));
			cgs.timescaleUpdate = cg.time + (int)(1000.0f * tscale);
		}
		return;
	case K_MWHEELDOWN:
		if (!cgs.fKeyPressed[K_SHIFT]) {
			if (!down) {
				CG_ZoomOut_f();
			}
			return;
		}       // Roll over into timescale changes
	case K_KP_LEFTARROW:
		if (!down && cg_timescale.value > 0.1f) {
			trap_Cvar_Set("timescale", va("%f", cg_timescale.value - 0.1f));
			cgs.timescaleUpdate = cg.time + (int)(1000.0f * cg_timescale.value - 0.1f);
		}
		return;
	case K_KP_UPARROW:
		if (!down) {
			trap_Cvar_Set("timescale", va("%f", cg_timescale.value + 1.0f));
			cgs.timescaleUpdate = cg.time + (int)(1000.0f * cg_timescale.value + 1.0f);
		}
		return;
	case K_MWHEELUP:
		if (!cgs.fKeyPressed[K_SHIFT]) {
			if (!down) {
				CG_ZoomIn_f();
			}
			return;
		}       // Roll over into timescale changes
	case K_KP_RIGHTARROW:
		if (!down) {
			trap_Cvar_Set("timescale", va("%f", cg_timescale.value + 0.1f));
			cgs.timescaleUpdate = cg.time + (int)(1000.0f * cg_timescale.value + 0.1f);
		}
		return;

	// AVI recording controls
	case K_F1:
		if (down) {
			cgs.aviDemoRate = demo_avifpsF1.integer;
		} else {
			trap_Cvar_Set("cl_avidemo", demo_avifpsF1.string);
		}
		return;
	case K_F2:
		if (down) {
			cgs.aviDemoRate = demo_avifpsF2.integer;
		} else {
			trap_Cvar_Set("cl_avidemo", demo_avifpsF2.string);
		}
		return;
	case K_F3:
		if (down) {
			cgs.aviDemoRate = demo_avifpsF3.integer;
		} else {
			trap_Cvar_Set("cl_avidemo", demo_avifpsF3.string);
		}
		return;
	case K_F4:
		if (down) {
			cgs.aviDemoRate = demo_avifpsF4.integer;
		} else {
			trap_Cvar_Set("cl_avidemo", demo_avifpsF4.string);
		}
		return;
	case K_F5:
		if (down) {
			cgs.aviDemoRate = demo_avifpsF5.integer;
		} else {
			trap_Cvar_Set("cl_avidemo", demo_avifpsF5.string);
		}
		return;
	}
}
/*
==================
CG_SetInitialSnapshot

This will only happen on the very first snapshot, or
on tourney restarts.  All other times will use 
CG_TransitionSnapshot instead.

FIXME: Also called by map_restart?
==================
*/
void CG_SetInitialSnapshot( snapshot_t *snap ) {
	int				i;
	centity_t		*cent;
	entityState_t	*state;
	char			buff[16];

	cg.snap = snap;

//	trap_S_ClearSounds( qtrue );

	BG_PlayerStateToEntityState( &snap->ps, &cg_entities[ snap->ps.clientNum ].currentState, qfalse );

	// sort out solid entities
	CG_BuildSolidList();

	CG_ExecuteNewServerCommands( snap->serverCommandSequence );

	// set our local weapon selection pointer to
	// what the server has indicated the current weapon is
	CG_Respawn( qfalse );

	for ( i = 0 ; i < cg.snap->numEntities ; i++ ) {
		state = &cg.snap->entities[ i ];
		cent = &cg_entities[ state->number ];

		memcpy(&cent->currentState, state, sizeof(entityState_t));
		//cent->currentState = *state;
		cent->interpolate = qfalse;
		cent->currentValid = qtrue;

		CG_ResetEntity( cent );

		// check for events
		CG_CheckEvents( cent );
	}

	cg_fxflags = 0;


	trap_Cvar_VariableStringBuffer( "r_oldMode", buff, sizeof(buff) );
	if( atoi(buff) ) {
		// Arnout: confirmation screen
		trap_UI_Popup( UIMENU_INGAME );
	} else if(cg.demoPlayback) {
		ccInitial = qtrue;
	} else {
		static char prevmap[64] = { 0 };
		char curmap[64];

		trap_Cvar_VariableStringBuffer( "mapname", curmap, 64 );

		if ( Q_stricmp( curmap, prevmap ) ) {
			strcpy( prevmap, curmap );
			if(cgs.campaignInfoLoaded) {
				if( !cg.showGameView ) {
					CG_LimboMenu_f();
				}
/*			} else {
				ccInitial = qtrue;

				// Start the Initial Camera if specified
				CG_StartInitialCamera(); */
			}
		}
	}

	// OSP - remove motd window
	if(cg.motdWindow != NULL) {
		CG_windowFree(cg.motdWindow);
		cg.motdWindow = NULL;
	}

	// Activate alternate input handler during demo playback
	if(cg.demoPlayback) {
		CG_keyOn_f();
		if(demo_infoWindow.integer > 0) {
			CG_ShowHelp_On(&cg.demohelpWindow);
		}
	}
	// OSP

#if __MACOS__
#ifdef GAMERANGER
	// LBO 12/13/04. Add support for GameRanger team voice IDs
	GRSetMyTeamID(cg.snap->ps.persistant[PERS_TEAM]);
#endif
#endif
}
/*
==================
CG_SetInitialSnapshot

This will only happen on the very first snapshot, or
on tourney restarts.  All other times will use
CG_TransitionSnapshot instead.

FIXME: Also called by map_restart?
==================
*/
void CG_SetInitialSnapshot(snapshot_t *snap)
{
	int           i;
	centity_t     *cent;
	entityState_t *state;
	char          buff[16];

	cg.snap = snap;

	//  trap_S_ClearSounds( qtrue );

	BG_PlayerStateToEntityState(&snap->ps, &cg_entities[snap->ps.clientNum].currentState, cg.time, qfalse);

	// sort out solid entities
	CG_BuildSolidList();

	CG_ExecuteNewServerCommands(snap->serverCommandSequence);

	// set our local weapon selection pointer to
	// what the server has indicated the current weapon is
	CG_Respawn(qfalse);

	for (i = 0 ; i < cg.snap->numEntities ; i++)
	{
		state = &cg.snap->entities[i];
		cent  = &cg_entities[state->number];

		memcpy(&cent->currentState, state, sizeof(entityState_t));
		//cent->currentState = *state;
		cent->interpolate  = qfalse;
		cent->currentValid = qtrue;

		CG_ResetEntity(cent);

		// check for events
		CG_CheckEvents(cent);
	}

	trap_Cvar_VariableStringBuffer("r_oldMode", buff, sizeof(buff));
	if (atoi(buff))
	{
		// confirmation screen
		trap_UI_Popup(UIMENU_INGAME);
	}
	else if (cg.demoPlayback)
	{
		ccInitial = qtrue;
	}
	else
	{
		static char prevmap[64] = { 0 };
		char        curmap[64];

		trap_Cvar_VariableStringBuffer("mapname", curmap, 64);

		if (Q_stricmp(curmap, prevmap))
		{
			strcpy(prevmap, curmap);
			if (cgs.campaignInfoLoaded)
			{
				if (!cg.showGameView)
				{
					CG_LimboMenu_f();
				}
				/*          } else {
				                ccInitial = qtrue;

				                // Start the Initial Camera if specified
				                CG_StartInitialCamera(); */
			}
		}
	}

	// remove motd window
	if (cg.motdWindow != NULL)
	{
		CG_windowFree(cg.motdWindow);
		cg.motdWindow = NULL;
	}

	// Activate alternate input handler during demo playback
	if (cg.demoPlayback)
	{
		CG_keyOn_f();
		if (demo_infoWindow.integer > 0)
		{
			CG_ShowHelp_On(&cg.demohelpWindow);
		}
	}

	// update client XP for spectator frames
	if (cg.snap->ps.clientNum == cg.clientNum)    // sanity check
	{
		int cXP = (32768 * cg.snap->ps.stats[STAT_XP_OVERFLOW]) + cg.snap->ps.stats[STAT_XP];

		if (cg.xp < cXP)
		{
			cg.xpChangeTime = cg.time;
		}
		cg.xp = cXP;
	}
}
Exemple #7
0
/*
==================
CG_SetInitialSnapshot

This will only happen on the very first snapshot, or
on tourney restarts.  All other times will use
CG_TransitionSnapshot instead.
==================
*/
void CG_SetInitialSnapshot(snapshot_t *snap) {
	int       i;
	centity_t *cent;
	char      buff[16];

	cg.snap = snap;

	BG_PlayerStateToEntityState(&snap->ps, &cg_entities[snap->ps.clientNum].currentState, qfalse);

	// sort out solid entities
	CG_BuildSolidList();

	CG_ExecuteNewServerCommands(snap->serverCommandSequence);

	// set our local weapon selection pointer to
	// what the server has indicated the current weapon is
	CG_Respawn();

	for (i = 0 ; i < cg.snap->numEntities ; ++i) {
		entityState_t *state = &cg.snap->entities[i];
		cent = &cg_entities[state->number];

		memcpy(&cent->currentState, state, sizeof (entityState_t));
		cent->interpolate  = qfalse;
		cent->currentValid = qtrue;

		CG_ResetEntity(cent);

		// check for events
		CG_CheckEvents(cent);
	}

	cg_fxflags = 0;

	trap_Cvar_VariableStringBuffer("r_oldMode", buff, sizeof (buff));
	if (atoi(buff)) {
		// Arnout: confirmation screen
		trap_UI_Popup(UIMENU_INGAME);
	} else if (!cg.demoPlayback) {
		static char prevmap[64] = { 0 };
		char        curmap[64];

		trap_Cvar_VariableStringBuffer("mapname", curmap, 64);

		if (Q_stricmp(curmap, prevmap)) {
			strcpy(prevmap, curmap);
			if (cgs.campaignInfoLoaded) {
				if (!cg.showGameView) {
					CG_LimboMenu_f();
				}
			}
		}
	}

	// OSP - remove motd window
	if (cg.motdWindow != NULL) {
		CG_windowFree(cg.motdWindow);
		cg.motdWindow = NULL;
	}

	// Activate alternate input handler during demo playback
	if (cg.demoPlayback) {
		CG_keyOn_f();
		if (demo_infoWindow.integer > 0) {
			CG_ShowHelp_On(&cg.demohelpWindow);
		}
	}
}