コード例 #1
0
ファイル: host.c プロジェクト: VenFPS/Vengeance
/*
===============
Host_Shutdown

FIXME: this is a callback from Sys_Quit and Sys_Error.  It would be better
to run quit through here before the final handoff to the sys code.
===============
*/
void Host_Shutdown(void)
{
	static qboolean isdown = false;

	if (isdown)
	{
		Con_Print("recursive shutdown\n");
		return;
	}
	if (setjmp(host_abortframe))
	{
		Con_Print("aborted the quitting frame?!?\n");
		return;
	}
	isdown = true;

	// be quiet while shutting down
	S_StopAllSounds();

	// disconnect client from server if active
	CL_Disconnect();

	// shut down local server if active
	Host_ShutdownServer ();

	// Shutdown menu
	if(MR_Shutdown)
		MR_Shutdown();

	// AK shutdown PRVM
	// AK hmm, no PRVM_Shutdown(); yet

	CL_Gecko_Shutdown();
	CL_Video_Shutdown();

	Host_SaveConfig();

	CDAudio_Shutdown ();
	S_Terminate ();
	Curl_Shutdown ();
	NetConn_Shutdown ();
	//PR_Shutdown ();

	if (cls.state != ca_dedicated)
	{
		R_Modules_Shutdown();
		VID_Shutdown();
		Thread_Shutdown();
	}

	Cmd_Shutdown();
	Key_Shutdown();
	CL_Shutdown();
	Sys_Shutdown();
	Log_Close();
	Crypto_Shutdown();
	FS_Shutdown();
	Con_Shutdown();
	Memory_Shutdown();
}
コード例 #2
0
ファイル: cd_win.c プロジェクト: Blub/darkplaces
int CDAudio_SysGetAudioDiskInfo(void)
{
	DWORD				dwReturn;
	MCI_STATUS_PARMS	mciStatusParms;

	mciStatusParms.dwItem = MCI_STATUS_READY;
	dwReturn = mciSendCommand(wDeviceID, MCI_STATUS, MCI_STATUS_ITEM | MCI_WAIT, (DWORD_PTR) (LPVOID) &mciStatusParms);
	if (dwReturn)
	{
		Con_Print("CDAudio_SysGetAudioDiskInfo: drive ready test - get status failed\n");
		return -1;
	}
	if (!mciStatusParms.dwReturn)
	{
		Con_Print("CDAudio_SysGetAudioDiskInfo: drive not ready\n");
		return -1;
	}

	mciStatusParms.dwItem = MCI_STATUS_NUMBER_OF_TRACKS;
	dwReturn = mciSendCommand(wDeviceID, MCI_STATUS, MCI_STATUS_ITEM | MCI_WAIT, (DWORD_PTR) (LPVOID) &mciStatusParms);
	if (dwReturn)
	{
		Con_Print("CDAudio_SysGetAudioDiskInfo: get tracks - status failed\n");
		return -1;
	}
	if (mciStatusParms.dwReturn < 1)
	{
		Con_Print("CDAudio_SysGetAudioDiskInfo: no music tracks\n");
		return -1;
	}

	return mciStatusParms.dwReturn;
}
コード例 #3
0
ファイル: libcurl.c プロジェクト: MarioMario/smbnex-engine
// TODO rewrite using Curl_GetDownloadInfo?
static void Curl_Info_f(void)
{
	downloadinfo *di;
	if(!curl_dll)
		return;
	if(Curl_Running())
	{
		Con_Print("Currently running downloads:\n");
		for(di = downloads; di; di = di->next)
		{
			double speed, percent;
			Con_Printf("  %s -> %s ",  CleanURL(di->url), di->filename);
			percent = 100.0 * Curl_GetDownloadAmount(di);
			speed = Curl_GetDownloadSpeed(di);
			if(percent >= 0)
				Con_Printf("(%.1f%% @ %.1f KiB/s)\n", percent, speed / 1024.0);
			else
				Con_Print("(queued)\n");
		}
	}
	else
	{
		Con_Print("No downloads running.\n");
	}
}
コード例 #4
0
ファイル: cd_shared.c プロジェクト: Blub/darkplaces
int CDAudio_Startup (void)
{
	if (COM_CheckParm("-nocdaudio"))
		return -1;

	CDAudio_SysStartup ();

	if (CDAudio_GetAudioDiskInfo())
	{
		Con_Print("CDAudio_Init: No CD in player.\n");
		cdValid = false;
	}

	saved_vol = CDAudio_SysGetVolume ();
	if (saved_vol < 0.0f)
	{
		Con_Print ("Can't get initial CD volume\n");
		saved_vol = 1.0f;
	}
	else
		Con_Printf ("Initial CD volume: %g\n", saved_vol);

	initialized = true;

	Con_Print("CD Audio Initialized\n");

	return 0;
}
コード例 #5
0
ファイル: cl_demo.c プロジェクト: chekoopa/darkplaces-rus
/*
====================
CL_Stop_f

stop recording a demo
====================
*/
void CL_Stop_f (void)
{
	sizebuf_t buf;
	unsigned char bufdata[64];

	if (!cls.demorecording)
	{
		Con_Print("Деморолик не записывается.\n");
		return;
	}

// write a disconnect message to the demo file
	// LordHavoc: don't replace the cl_message when doing this
	buf.data = bufdata;
	buf.maxsize = sizeof(bufdata);
	SZ_Clear(&buf);
	MSG_WriteByte(&buf, svc_disconnect);
	CL_WriteDemoMessage(&buf);

// finish up
	if(cl_autodemo.integer && (cl_autodemo_delete.integer & 1))
	{
		FS_RemoveOnClose(cls.demofile);
		Con_Print("Деморолик записан и удален\n");
	}
	else
		Con_Print("Деморолик записан\n");
	FS_Close (cls.demofile);
	cls.demofile = NULL;
	cls.demorecording = false;
}
コード例 #6
0
ファイル: wad.c プロジェクト: divVerent/darkplaces-travis
/*
====================
W_LoadTextureWadFile
====================
*/
void W_LoadTextureWadFile (char *filename, int complain)
{
	wadinfo_t		header;
	int				infotableofs;
	qfile_t			*file;
	int				numlumps;
	mwad_t			*w;

	file = FS_OpenVirtualFile(filename, false);
	if (!file)
	{
		if (complain)
			Con_Printf("W_LoadTextureWadFile: couldn't find %s\n", filename);
		return;
	}

	if (FS_Read(file, &header, sizeof(wadinfo_t)) != sizeof(wadinfo_t))
	{Con_Print("W_LoadTextureWadFile: unable to read wad header\n");FS_Close(file);file = NULL;return;}

	if(memcmp(header.identification, "WAD3", 4))
	{Con_Printf("W_LoadTextureWadFile: Wad file %s doesn't have WAD3 id\n",filename);FS_Close(file);file = NULL;return;}

	numlumps = LittleLong(header.numlumps);
	if (numlumps < 1 || numlumps > 65536)
	{Con_Printf("W_LoadTextureWadFile: invalid number of lumps (%i)\n", numlumps);FS_Close(file);file = NULL;return;}
	infotableofs = LittleLong(header.infotableofs);
	if (FS_Seek (file, infotableofs, SEEK_SET))
	{Con_Print("W_LoadTextureWadFile: unable to seek to lump table\n");FS_Close(file);file = NULL;return;}

	if (!wad.hlwads.mempool)
		Mem_ExpandableArray_NewArray(&wad.hlwads, cls.permanentmempool, sizeof(mwad_t), 16);
	w = (mwad_t *) Mem_ExpandableArray_AllocRecord(&wad.hlwads);
	w->file = file;
	w->numlumps = numlumps;
	w->lumps = (lumpinfo_t *) Mem_Alloc(cls.permanentmempool, w->numlumps * sizeof(lumpinfo_t));

	if (!w->lumps)
	{
		Con_Print("W_LoadTextureWadFile: unable to allocate temporary memory for lump table\n");
		FS_Close(w->file);
		w->file = NULL;
		w->numlumps = 0;
		return;
	}

	if (FS_Read(file, w->lumps, sizeof(lumpinfo_t) * w->numlumps) != (fs_offset_t)sizeof(lumpinfo_t) * numlumps)
	{
		Con_Print("W_LoadTextureWadFile: unable to read lump table\n");
		FS_Close(w->file);
		w->file = NULL;
		w->numlumps = 0;
		Mem_Free(w->lumps);
		w->lumps = NULL;
		return;
	}

	W_SwapLumps(w->numlumps, w->lumps);

	// leaves the file open
}
コード例 #7
0
ファイル: r_sky.c プロジェクト: CyberSys/darkplaces
// LordHavoc: added LoadSky console command
static void LoadSky_f (void)
{
	switch (Cmd_Argc())
	{
	case 1:
		if (skyname[0])
			Con_Printf("current sky: %s\n", skyname);
		else
			Con_Print("no skybox has been set\n");
		break;
	case 2:
		if (R_SetSkyBox(Cmd_Argv(1)))
		{
			if (skyname[0])
				Con_Printf("skybox set to %s\n", skyname);
			else
				Con_Print("skybox disabled\n");
		}
		else
			Con_Printf("failed to load skybox %s\n", Cmd_Argv(1));
		break;
	default:
		Con_Print("usage: loadsky skyname\n");
		break;
	}
}
コード例 #8
0
ファイル: prvm_exec.c プロジェクト: paulvortex/DpOmnicide
static void PRVM_PrintStatement(prvm_prog_t *prog, mstatement_t *s)
{
    size_t i;
    int opnum = (int)(s - prog->statements);
    char valuebuf[MAX_INPUTLINE];

    Con_Printf("s%i: ", opnum);
    if( prog->statement_linenums )
    {
        if ( prog->statement_columnnums )
            Con_Printf( "%s:%i:%i: ", PRVM_GetString( prog, prog->xfunction->s_file ), prog->statement_linenums[ opnum ], prog->statement_columnnums[ opnum ] );
        else
            Con_Printf( "%s:%i: ", PRVM_GetString( prog, prog->xfunction->s_file ), prog->statement_linenums[ opnum ] );
    }

    if (prvm_statementprofiling.integer)
        Con_Printf("%7.0f ", prog->statement_profile[s - prog->statements]);

    if ( (unsigned)s->op < sizeof(prvm_opnames)/sizeof(prvm_opnames[0]))
    {
        Con_Printf("%s ",  prvm_opnames[s->op]);
        i = strlen(prvm_opnames[s->op]);
        // don't count a preceding color tag when padding the name
        if (prvm_opnames[s->op][0] == STRING_COLOR_TAG)
            i -= 2;
        for ( ; i<10 ; i++)
            Con_Print(" ");
    }
    if (s->operand[0] >= 0) Con_Printf(  "%s", PRVM_GlobalString(prog, s->operand[0], valuebuf, sizeof(valuebuf)));
    if (s->operand[1] >= 0) Con_Printf(", %s", PRVM_GlobalString(prog, s->operand[1], valuebuf, sizeof(valuebuf)));
    if (s->operand[2] >= 0) Con_Printf(", %s", PRVM_GlobalString(prog, s->operand[2], valuebuf, sizeof(valuebuf)));
    if (s->jumpabsolute >= 0) Con_Printf(", statement %i", s->jumpabsolute);
    Con_Print("\n");
}
コード例 #9
0
ファイル: qvis.c プロジェクト: raynorpat/cake
/*
================
CalcPHS

Calculate the PHS (Potentially Hearable Set)
by ORing together all the PVS visible from a leaf
================
*/
void CalcPHS (void)
{
	int		i, j, k, l, index;
	int		bitbyte;
	long	*dest, *src;
	byte	*scan;
	int		count;
	byte	uncompressed[MAX_MAP_LEAFS/8];
	byte	compressed[MAX_MAP_LEAFS/8];

	Con_Print("Building PHS...\n");

	count = 0;
	for (i=0 ; i<portalclusters ; i++)
	{
		scan = uncompressedvis + i*leafbytes;
		memcpy (uncompressed, scan, leafbytes);
		for (j=0 ; j<leafbytes ; j++)
		{
			bitbyte = scan[j];
			if (!bitbyte)
				continue;
			for (k=0 ; k<8 ; k++)
			{
				if (! (bitbyte & (1<<k)) )
					continue;
				// OR this pvs row into the phs
				index = ((j<<3)+k);
				if (index >= portalclusters)
					Con_Error("Bad bit in PVS\n");	// pad bits should be 0
				src = (long *)(uncompressedvis + index*leafbytes);
				dest = (long *)uncompressed;
				for (l=0 ; l<leaflongs ; l++)
					((long *)uncompressed)[l] |= src[l];
			}
		}
		for (j=0 ; j<portalclusters ; j++)
			if (uncompressed[j>>3] & (1<<(j&7)) )
				count++;

	//
	// compress the bit string
	//
		j = CompressVis (uncompressed, compressed);

		dest = (long *)vismap_p;
		vismap_p += j;
		
		if (vismap_p > vismap_end)
			Con_Error("Vismap expansion overflow\n");

		dvis->bitofs[i][DVIS_PHS] = (byte *)dest-vismap;

		memcpy (dest, compressed, j);	
	}

	Con_Print("Average clusters hearable: %i\n", count/portalclusters);
}
コード例 #10
0
ファイル: snd_win.c プロジェクト: kasymovga/DarkPlacesRM
/*
====================
SndSys_Init

Create "snd_renderbuffer" with the proper sound format if the call is successful
May return a suggested format if the requested format isn't available
====================
*/
qboolean SndSys_Init (const snd_format_t* requested, snd_format_t* suggested)
{
#ifdef SUPPORTDIRECTX
	qboolean wavonly;
    sndinitstat stat;
#endif

	if (!sndsys_registeredcvars)
	{
		sndsys_registeredcvars = true;
		Cvar_RegisterVariable(&snd_wav_partitionsize);
	}

	Con_Print ("SndSys_Init: using the Win32 module\n");

#ifdef SUPPORTDIRECTX
// COMMANDLINEOPTION: Windows Sound: -wavonly uses wave sound instead of DirectSound
	wavonly = (COM_CheckParm ("-wavonly") != 0);
	dsound_init = false;
#endif
	wav_init = false;

#ifdef SUPPORTDIRECTX
    stat = SIS_FAILURE; // assume DirectSound won't initialize

	// Init DirectSound
	if (!wavonly)
	{
		stat = SndSys_InitDirectSound (requested);

		if (stat == SIS_SUCCESS)
			Con_Print("DirectSound initialized\n");
		else
			Con_Print("DirectSound failed to init\n");
	}
#endif

	// if DirectSound didn't succeed in initializing, try to initialize
	// waveOut sound, unless DirectSound failed because the hardware is
	// already allocated (in which case the user has already chosen not
	// to have sound)
#ifdef SUPPORTDIRECTX
	if (!dsound_init && (stat != SIS_NOTAVAIL))
#endif
	{
		if (SndSys_InitMmsystem (requested))
			Con_Print("Wave sound (MMSYSTEM) initialized\n");
		else
			Con_Print("Wave sound failed to init\n");
	}

#ifdef SUPPORTDIRECTX
	return (dsound_init || wav_init);
#else
	return wav_init;
#endif
}
コード例 #11
0
ファイル: irc.c プロジェクト: Hanzo-nex/DarkPlacesRM
/*
====================
IRC_Printf

Internal, used for logging.
====================
*/
static void IRC_Printf(const char *fmt, ...) {
    va_list args;
    char msg[MAX_INPUTLINE];
    
    va_start(args, fmt);
    dpvsnprintf(msg, sizeof(msg), fmt, args);
    va_end(args);
    
    Con_Print("IRC: ");
    Con_Print(msg);
}
コード例 #12
0
ファイル: ref_d3d9_debug.cpp プロジェクト: gejza/Hoe3D
void ListState()
{
	Con_Print("List render states");
	for (dword dw=0;dw<210;dw++)
	{
		if (GetRenderStateString(dw))
		{
			DWORD state;
			D3DDevice()->GetRenderState((D3DRENDERSTATETYPE)dw, &state);
			Con_Print("%s = %d", GetRenderStateString(dw), state);
		}
	}
}
コード例 #13
0
ファイル: snd_win.c プロジェクト: kasymovga/DarkPlacesRM
/*
====================
SndSys_LockRenderBuffer

Get the exclusive lock on "snd_renderbuffer"
====================
*/
qboolean SndSys_LockRenderBuffer (void)
{
#ifdef SUPPORTDIRECTX
	int reps;
	HRESULT hresult;
	DWORD	dwStatus;

	if (pDSBuf)
	{
		// if the buffer was lost or stopped, restore it and/or restart it
		if (IDirectSoundBuffer_GetStatus (pDSBuf, &dwStatus) != DS_OK)
			Con_Print("Couldn't get sound buffer status\n");

		if (dwStatus & DSBSTATUS_BUFFERLOST)
		{
			Con_Print("DSound buffer is lost!!\n");
			IDirectSoundBuffer_Restore (pDSBuf);
		}

		if (!(dwStatus & DSBSTATUS_PLAYING))
			IDirectSoundBuffer_Play(pDSBuf, 0, 0, DSBPLAY_LOOPING);

		reps = 0;

		while ((hresult = IDirectSoundBuffer_Lock(pDSBuf, 0, gSndBufSize, (LPVOID*)&dsound_pbuf, &dsound_dwSize, (LPVOID*)&dsound_pbuf2, &dsound_dwSize2, 0)) != DS_OK)
		{
			if (hresult != DSERR_BUFFERLOST)
			{
				Con_Print("S_LockBuffer: DS: Lock Sound Buffer Failed\n");
				S_Shutdown ();
				S_Startup ();
				return false;
			}

			if (++reps > 10000)
			{
				Con_Print("S_LockBuffer: DS: couldn't restore buffer\n");
				S_Shutdown ();
				S_Startup ();
				return false;
			}
		}

		if ((void*)dsound_pbuf != snd_renderbuffer->ring)
			Sys_Error("SndSys_LockRenderBuffer: the ring address has changed!!!\n");
		return true;
	}
#endif

	return wav_init;
}
コード例 #14
0
ファイル: mvm_cmds.c プロジェクト: AidHamza/eviltoys
/*
=========
VM_M_getserverliststring

string	getserverliststring(float field, float hostnr)
=========
*/
static void VM_M_getserverliststring(prvm_prog_t *prog)
{
	serverlist_entry_t *cache;
	int hostnr;

	VM_SAFEPARMCOUNT(2, VM_M_getserverliststring);

	PRVM_G_INT(OFS_RETURN) = OFS_NULL;

	hostnr = (int)PRVM_G_FLOAT(OFS_PARM1);

	if(hostnr < 0 || hostnr >= serverlist_viewcount)
	{
		Con_Print("VM_M_getserverliststring: bad hostnr passed!\n");
		return;
	}
	cache = ServerList_GetViewEntry(hostnr);
	switch( (int) PRVM_G_FLOAT(OFS_PARM0) ) {
		case SLIF_CNAME:
			PRVM_G_INT( OFS_RETURN ) = PRVM_SetTempString( prog, cache->info.cname );
			break;
		case SLIF_NAME:
			PRVM_G_INT( OFS_RETURN ) = PRVM_SetTempString( prog, cache->info.name );
			break;
		case SLIF_QCSTATUS:
			PRVM_G_INT (OFS_RETURN ) = PRVM_SetTempString( prog, cache->info.qcstatus );
			break;
		case SLIF_PLAYERS:
			PRVM_G_INT (OFS_RETURN ) = PRVM_SetTempString( prog, cache->info.players );
			break;
		case SLIF_GAME:
			PRVM_G_INT( OFS_RETURN ) = PRVM_SetTempString( prog, cache->info.game );
			break;
		case SLIF_MOD:
			PRVM_G_INT( OFS_RETURN ) = PRVM_SetTempString( prog, cache->info.mod );
			break;
		case SLIF_MAP:
			PRVM_G_INT( OFS_RETURN ) = PRVM_SetTempString( prog, cache->info.map );
			break;
		// TODO remove this again
		case 1024:
			PRVM_G_INT( OFS_RETURN ) = PRVM_SetTempString( prog, cache->line1 );
			break;
		case 1025:
			PRVM_G_INT( OFS_RETURN ) = PRVM_SetTempString( prog, cache->line2 );
			break;
		default:
			Con_Print("VM_M_getserverliststring: bad field number passed!\n");
	}
}
コード例 #15
0
ファイル: pop3noti.c プロジェクト: ProfessorKaos64/ftequake
int Plug_Init(int *args)
{
	if (!Plug_Export("Tick", EmailNotification_Frame) || !Plug_Export("ExecuteCommand", EmailNotification_ExecuteCommand))
	{
		Con_Print("email notification plugin failed\n");
		return false;
	}

	Cmd_AddCommand("imapaccount");
	Cmd_AddCommand("pop3account");

	Con_Print("email notification plugin loaded\n");

	return true;
}
コード例 #16
0
ファイル: sv_demo.c プロジェクト: paulvortex/DpOmnicide
void SV_StartDemoRecording(client_t *client, const char *filename, int forcetrack)
{
	prvm_prog_t *prog = SVVM_prog;
	char name[MAX_QPATH];

	if(client->sv_demo_file != NULL)
		return; // we already have a demo

	strlcpy(name, filename, sizeof(name));
	FS_DefaultExtension(name, ".dem", sizeof(name));

	Con_Printf("Recording demo for # %d (%s) to %s\n", PRVM_NUM_FOR_EDICT(client->edict), client->netaddress, name);

	// Reset discardable flag for every new demo.
	PRVM_serveredictfloat(client->edict, discardabledemo) = 0;

	client->sv_demo_file = FS_OpenRealFile(name, "wb", false);
	if(!client->sv_demo_file)
	{
		Con_Print("ERROR: couldn't open.\n");
		return;
	}

	FS_Printf(client->sv_demo_file, "%i\n", forcetrack);
}
コード例 #17
0
ファイル: cvar.c プロジェクト: DrLabman/Vengeance-r2
void Cvar_SetA_f (void)
{
	cvar_t *cvar;

	// make sure it's the right number of parameters
	if (Cmd_Argc() < 3)
	{
		Con_Printf("SetA: wrong number of parameters, usage: seta <variablename> <value>\n");
		return;
	}

	// check if it's read-only
	cvar = Cvar_FindVar(Cmd_Argv(1));
/*	if (cvar && cvar->flags & CVAR_READONLY)
	{
		Con_Printf("SetA: %s is read-only\n", cvar->name);
		return;
	}*/

	if (developer.value)
		Con_Print("SetA: ");

	// all looks ok, create/modify the cvar
	Cvar_Get(Cmd_Argv(1), Cmd_Argv(2), 0);
}
コード例 #18
0
ファイル: vid_agl.c プロジェクト: CyberSys/darkplaces
int VID_GetGamma(unsigned short *ramps, int rampsize)
{
	CGGammaValue table_red [GAMMA_TABLE_SIZE];
	CGGammaValue table_green [GAMMA_TABLE_SIZE];
	CGGammaValue table_blue [GAMMA_TABLE_SIZE];
	CGTableCount actualsize = 0;
	int i;

	// Get the gamma ramps from the system
	if (CGGetDisplayTransferByTable(CGMainDisplayID(), rampsize, table_red, table_green, table_blue, &actualsize) != CGDisplayNoErr)
	{
		Con_Print("VID_GetGamma: ERROR: CGGetDisplayTransferByTable failed!\n");
		return false;
	}
	if (actualsize != (unsigned int)rampsize)
	{
		Con_Printf("VID_GetGamma: ERROR: invalid gamma table size (%u != %u)\n", actualsize, rampsize);
		return false;
	}

	// Convert the 3 float tables into 1 unsigned short table
	for (i = 0; i < rampsize; i++)
		ramps[i] = table_red[i] * 65535.0f;
	for (i = 0; i < rampsize; i++)
		ramps[i + rampsize] = table_green[i] * 65535.0f;
	for (i = 0; i < rampsize; i++)
		ramps[i + 2 * rampsize] = table_blue[i] * 65535.0f;

	return true;
}
コード例 #19
0
ファイル: cd_shared.c プロジェクト: Blub/darkplaces
qboolean CDAudio_Play_real (int track, qboolean looping, qboolean complain)
{
	if(track < 1)
	{
		if(complain)
			Con_Print("Could not load BGM track.\n");
		return false;
	}

	if (!cdValid)
	{
		CDAudio_GetAudioDiskInfo();
		if (!cdValid)
		{
			if(complain)
				Con_DPrint ("No CD in player.\n");
			return false;
		}
	}

	if (track > maxTrack)
	{
		if(complain)
			Con_DPrintf("CDAudio: Bad track number %u.\n", track);
		return false;
	}

	if (CDAudio_SysPlay(track) == -1)
		return false;

	if(cdaudio.integer != 3)
		Con_DPrintf ("CD track %u playing...\n", track);

	return true;
}
コード例 #20
0
ファイル: cd_sdl.c プロジェクト: Blub/darkplaces
void CDAudio_SDL_CDDrive_f( void )
{
	int i;
	int numdrives = SDL_CDNumDrives();

	if( Cmd_Argc() != 2 ) {
		Con_Print( "cddrive <drivenr>\n" );
		return;
	}

	i = atoi( Cmd_Argv( 1 ) );
	if( i >= numdrives ) {
		Con_Printf("Only %i drives!\n", numdrives );
		return;
	}

	if( cd )
		SDL_CDClose( cd );

	cd = SDL_CDOpen( i );
	if( !cd ) {
		Con_Printf( "Couldn't open drive %i.\n", i );
		return;
	}

	if( !CD_INDRIVE( SDL_CDStatus( cd ) ) )
		Con_Printf( "No cd in drive %i.\n", i );
	else if( !IsAudioCD() )
		Con_Printf( "The CD in drive %i is not an audio CD.\n", i );

	ValidateDrive();
}
コード例 #21
0
ファイル: cd_sdl.c プロジェクト: Blub/darkplaces
void CDAudio_SysInit (void)
{
	if( SDL_InitSubSystem( SDL_INIT_CDROM ) == -1 )
		Con_Print( "Failed to init the CDROM SDL subsystem!\n" );

	Cmd_AddCommand( "cddrive", CDAudio_SDL_CDDrive_f, "select an SDL-detected CD drive by number" );
}
コード例 #22
0
ファイル: cl_tent.c プロジェクト: SpiritQuaddicted/reQuiem
/*
=================
CL_ParseBeam
=================
*/
void CL_ParseBeam (const char *modelname, qboolean parse_only)
{
	int		i, ent, index;
	vec3_t	start, end;
	beam_t	*b;
	
	ent = MSG_ReadShort ();
	
	start[0] = MSG_ReadCoord ();
	start[1] = MSG_ReadCoord ();
	start[2] = MSG_ReadCoord ();
	
	end[0] = MSG_ReadCoord ();
	end[1] = MSG_ReadCoord ();
	end[2] = MSG_ReadCoord ();

	if (parse_only)
		return;		// JDH: parse message only, don't do anything
	
	
	if (ent == cl.viewentity)
		VectorCopy (end, playerbeam_end);	// for cl_truelightning

	index = MAX_BEAMS;

	for (i = 0, b = cl_beams ; i < MAX_BEAMS ; i++, b++)
	{
		// override any beam with the same entity
		if (b->entity == ent)
		{
			index = i;
			break;
		}
		
		// make note of first available slot, but continue checking for same ent:
//		if ((index == MAX_BEAMS) && (!b->model || (b->endtime < cl.time)))
		if ((index == MAX_BEAMS) && (!b->model || BEAM_INACTIVE(b)))
		{
			index = i;
		}
	}

	if (index < MAX_BEAMS)
	{
		b = cl_beams + index;
		b->entity = ent;
		b->model = Mod_ForName (modelname, true);
		b->starttime = cl.time - 0.2;			// JDH: for demo rewind (see note in AllocParticle)
		b->endtime = cl.time + 0.2;
		VectorCopy (start, b->start);
		VectorCopy (end, b->end);
#ifdef _DEBUG
//		if (cls.demoplayback && !cl_demorewind.value)
//			CL_PushBeam (b);
#endif
		return;	
	}

	Con_Print ("beam list overflow!\n");	
}
コード例 #23
0
ファイル: prvm_exec.c プロジェクト: paulvortex/DpOmnicide
void PRVM_ChildProfile_f (void)
{
    prvm_prog_t *prog;
    int howmany;

    if (prvm_coverage.integer & 1)
    {
        Con_Printf("Collecting function coverage, cannot profile - sorry!\n");
        return;
    }

    howmany = 1<<30;
    if (Cmd_Argc() == 3)
        howmany = atoi(Cmd_Argv(2));
    else if (Cmd_Argc() != 2)
    {
        Con_Print("prvm_childprofile <program name>\n");
        return;
    }

    if (!(prog = PRVM_FriendlyProgFromString(Cmd_Argv(1))))
        return;

    PRVM_Profile(prog, howmany, 0, 1);
}
コード例 #24
0
ファイル: cl_demo.c プロジェクト: SMBXon/darkplaces
/*
====================
CL_TimeDemo_f

timedemo [demoname]
====================
*/
void CL_TimeDemo_f (void)
{
	if (Cmd_Argc() != 2)
	{
		Con_Print("timedemo <demoname> : gets demo speeds\n");
		return;
	}

	srand(0); // predictable random sequence for benchmarking

	CL_PlayDemo_f ();

// cls.td_starttime will be grabbed at the second frame of the demo, so
// all the loading time doesn't get counted

	// instantly hide console and deactivate it
	key_dest = key_game;
	key_consoleactive = 0;
	scr_con_current = 0;

	cls.timedemo = true;
	cls.td_frames = -2;		// skip the first frame
	cls.demonum = -1;		// stop demo loop
	cls.demonum = -1;		// stop demo loop
}
コード例 #25
0
ファイル: cd_linux.c プロジェクト: CyberSys/darkplaces
int CDAudio_SysUpdate (void)
{
	struct cdrom_subchnl subchnl;
	static time_t lastchk = 0;

	if (cdPlaying && lastchk < time(NULL) && cdfile != -1)
	{
		lastchk = time(NULL) + 2; //two seconds between chks
		subchnl.cdsc_format = CDROM_MSF;
		if (ioctl(cdfile, CDROMSUBCHNL, &subchnl) == -1)
		{
			Con_Print("ioctl CDROMSUBCHNL failed\n");
			cdPlaying = false;
			return -1;
		}
		if (subchnl.cdsc_audiostatus != CDROM_AUDIO_PLAY &&
			subchnl.cdsc_audiostatus != CDROM_AUDIO_PAUSED)
		{
			cdPlaying = false;
			if (cdPlayLooping)
				CDAudio_Play(cdPlayTrack, true);
		}
		else
			cdPlayTrack = subchnl.cdsc_trk;
	}

	return 0;
}
コード例 #26
0
ファイル: prvm_exec.c プロジェクト: paulvortex/DpOmnicide
/*
============
PRVM_StackTrace
============
*/
void PRVM_StackTrace (prvm_prog_t *prog)
{
    mfunction_t	*f;
    int			i;

    prog->stack[prog->depth].s = prog->xstatement;
    prog->stack[prog->depth].f = prog->xfunction;
    for (i = prog->depth; i > 0; i--)
    {
        f = prog->stack[i].f;

        if (!f)
            Con_Print("<NULL FUNCTION>\n");
        else
        {
            if (prog->statement_linenums)
            {
                if (prog->statement_columnnums)
                    Con_Printf("%12s:%i:%i : %s : statement %i\n", PRVM_GetString(prog, f->s_file), prog->statement_linenums[prog->stack[i].s], prog->statement_columnnums[prog->stack[i].s], PRVM_GetString(prog, f->s_name), prog->stack[i].s - f->first_statement);
                else
                    Con_Printf("%12s:%i : %s : statement %i\n", PRVM_GetString(prog, f->s_file), prog->statement_linenums[prog->stack[i].s], PRVM_GetString(prog, f->s_name), prog->stack[i].s - f->first_statement);
            }
            else
                Con_Printf("%12s : %s : statement %i\n", PRVM_GetString(prog, f->s_file), PRVM_GetString(prog, f->s_name), prog->stack[i].s - f->first_statement);
        }
    }
}
コード例 #27
0
ファイル: r_modules.c プロジェクト: Blub/darkplaces
void R_Modules_Restart(void)
{
	Host_StartVideo();
	Con_Print("restarting renderer\n");
	R_Modules_Shutdown();
	R_Modules_Start();
}
コード例 #28
0
ファイル: sys_win.c プロジェクト: bmk10/sing-engine
/*
================
Sys_Print

print into window console
================
*/
void Sys_Print( const char *pMsg )
{
	const char	*msg;
	char		buffer[32768];
	char		logbuf[32768];
	char		*b = buffer;
	char		*c = logbuf;	
	int		i = 0;

	if( host.type == HOST_NORMAL )
		Con_Print( pMsg );

	// if the message is REALLY long, use just the last portion of it
	if( Q_strlen( pMsg ) > sizeof( buffer ) - 1 )
		msg = pMsg + Q_strlen( pMsg ) - sizeof( buffer ) + 1;
	else msg = pMsg;

	// copy into an intermediate buffer
	while( msg[i] && (( b - buffer ) < sizeof( buffer ) - 1 ))
	{
		if( msg[i] == '\n' && msg[i+1] == '\r' )
		{
			b[0] = '\r';
			b[1] = c[0] = '\n';
			b += 2, c++;
			i++;
		}
		else if( msg[i] == '\r' )
		{
			b[0] = c[0] = '\r';
			b[1] = '\n';
			b += 2, c++;
		}
		else if( msg[i] == '\n' )
		{
			b[0] = '\r';
			b[1] = c[0] = '\n';
			b += 2, c++;
		}
		else if( msg[i] == '\35' || msg[i] == '\36' || msg[i] == '\37' )
		{
			i++; // skip console pseudo graph
		}
		else if( IsColorString( &msg[i] ))
		{
			i++; // skip color prefix
		}
		else
		{
			*b = *c = msg[i];
			b++, c++;
		}
		i++;
	}

	*b = *c = 0; // cutoff garbage

	Sys_PrintLog( logbuf );
	Con_WinPrint( buffer );
}
コード例 #29
0
ファイル: conproc.c プロジェクト: Blub/darkplaces
DWORD RequestProc (DWORD dwNichts)
{
	int		*pBuffer;
	DWORD	dwRet;
	HANDLE	heventWait[2];
	int		iBeginLine, iEndLine;
	
	heventWait[0] = heventParentSend;
	heventWait[1] = heventDone;

	while (1)
	{
		dwRet = WaitForMultipleObjects (2, heventWait, false, INFINITE);

	// heventDone fired, so we're exiting.
		if (dwRet == WAIT_OBJECT_0 + 1)	
			break;

		pBuffer = (int *) GetMappedBuffer (hfileBuffer);
		
	// hfileBuffer is invalid.  Just leave.
		if (!pBuffer)
		{
			Con_Print("Invalid hfileBuffer\n");
			break;
		}

		switch (pBuffer[0])
		{
			case CCOM_WRITE_TEXT:
			// Param1 : Text
				pBuffer[0] = WriteText ((LPCTSTR) (pBuffer + 1));
				break;

			case CCOM_GET_TEXT:
			// Param1 : Begin line
			// Param2 : End line
				iBeginLine = pBuffer[1];
				iEndLine = pBuffer[2];
				pBuffer[0] = ReadText ((LPTSTR) (pBuffer + 1), iBeginLine, 
									   iEndLine);
				break;

			case CCOM_GET_SCR_LINES:
			// No params
				pBuffer[0] = GetScreenBufferLines (&pBuffer[1]);
				break;

			case CCOM_SET_SCR_LINES:
			// Param1 : Number of lines
				pBuffer[0] = SetScreenBufferLines (pBuffer[1]);
				break;
		}

		ReleaseMappedBuffer (pBuffer);
		SetEvent (heventChildSend);
	}

	return 0;
}
コード例 #30
0
ファイル: cd_win.c プロジェクト: Blub/darkplaces
LONG CDAudio_MessageHandler (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
	if (lParam != (LPARAM)wDeviceID)
		return 1;

	switch (wParam)
	{
		case MCI_NOTIFY_SUCCESSFUL:
			if (cdPlaying)
			{
				cdPlaying = false;
				if (cdPlayLooping)
					CDAudio_Play(cdPlayTrack, true);
			}
			break;

		case MCI_NOTIFY_ABORTED:
		case MCI_NOTIFY_SUPERSEDED:
			break;

		case MCI_NOTIFY_FAILURE:
			Con_Print("MCI_NOTIFY_FAILURE\n");
			CDAudio_Stop ();
			cdValid = false;
			break;

		default:
			Con_Printf("Unexpected MM_MCINOTIFY type (%i)\n", (int)wParam);
			return 1;
	}

	return 0;
}