예제 #1
0
파일: g_main.c 프로젝트: janisl/quake2-game
void ShutdownGame (void)
{
	gi.dprintf ("==== ShutdownGame ====\n");

	gi.FreeTags (TAG_LEVEL);
	gi.FreeTags (TAG_GAME);
}
예제 #2
0
파일: g_main.c 프로젝트: turol/webquake2
void Com_Printf(const char *msg, int level, ...){
	va_list	argptr;
	char	text[1024];
	
	va_start(argptr, level);
	vsprintf(text, msg, argptr);
	va_end(argptr);
	
	gi.dprintf("%s", text);
}
예제 #3
0
파일: g_main.c 프로젝트: janisl/quake2-game
void Com_Printf (char *msg, ...)
{
	va_list		argptr;
	char		text[1024];

	va_start (argptr, msg);
	vsprintf (text, msg, argptr);
	va_end (argptr);

	gi.dprintf ("%s", text);
}
예제 #4
0
int Debug_Soundindex (char *name)
{
	int soundnum;
	soundnum = RealFunc.soundindex(name);
	if(soundnum > max_soundindex)
	{
		gi.dprintf("Sound %03d %s\n",soundnum,name);
		max_soundindex = soundnum;
	}
	return soundnum;
}
예제 #5
0
int Debug_Modelindex (char *name)
{
	int	modelnum;
	modelnum = RealFunc.modelindex(name);
	if(modelnum > max_modelindex)
	{
		gi.dprintf("Model %03d %s\n",modelnum,name);
		max_modelindex = modelnum;
	}
	return modelnum;
}
예제 #6
0
파일: g_main.c 프로젝트: qbism/qbq2
void Com_Printf (char *msg, ...)
{
	va_list		argptr;
	char		text[1024];

	va_start (argptr, msg);
//	vsprintf (text, msg, argptr);
	Q_vsnprintf (text, sizeof(text), msg, argptr);	// Knightmare- buffer overflow fix
	va_end (argptr);

	gi.dprintf ("%s", text);
}
예제 #7
0
void game_dprintf(char *fmt, ...)
{
	va_list args;
	char buf[1024];

	va_start(args, fmt);
	vsnprintf(buf, sizeof buf, fmt, args);
	buf[sizeof buf - 1] = 0;
	va_end(args);

	q2a_lua_LogMessage(buf);

	gi.dprintf("%s", buf);
}
예제 #8
0
void ShutdownGame (void)
{
	gi.dprintf ("==== ShutdownGame ====\n");
	if(!deathmatch->value && !coop->value) {
#ifndef KMQUAKE2_ENGINE_MOD // engine has zoom autosensitivity
		gi.cvar_forceset("m_pitch", va("%f",lazarus_pitch->value));
#endif
		//gi.cvar_forceset("cd_loopcount", va("%d",lazarus_cd_loop->value));
		//gi.cvar_forceset("gl_clear", va("%d", lazarus_gl_clear->value));
	}
	// Lazarus: Turn off fog if it's on
	if(!dedicated->value)
		Fog_Off();

	gi.FreeTags (TAG_LEVEL);
	gi.FreeTags (TAG_GAME);
}
예제 #9
0
/*
=================
GetGameAPI
 
Returns a pointer to the structure with all entry points
and global variables
=================
*/
game_export_t *GetGameAPI(game_import_t *import)
{
	char dllname[256];
	cvar_t *game;
	GAMEAPI *getapi;
	game_import_t g_import;

	gi = *import;

	game = gi.cvar ("game", "baseq2", 0);
	q2a_strcpy(moddir, game->string);
	
	if(moddir[0] == 0)
		q2a_strcpy(moddir, "baseq2");

	gi.dprintf ("Q2Admin %s running %s\n", Q2A_VERSION, moddir);
	gi.cvar ("*Q2Admin", Q2A_VERSION, CVAR_SERVERINFO|CVAR_NOSET);

	q2a_lua_init();

	sprintf(dllname, "%s/%s", moddir, DLLNAME);
#ifdef _WIN32
	hdll = LoadLibrary(dllname);
#else
	hdll = dlopen(dllname, RTLD_NOW);
#endif
	
	if(hdll == NULL)
	{
		gi.dprintf ("Q2A: Unable to load DLL %s.\n", dllname);
		return &globals;
	}

	gi.dprintf("Q2A: Loaded game DLL: %s.\n", dllname);
		
#ifdef _WIN32
	getapi = (GAMEAPI *)GetProcAddress (hdll, "GetGameAPI");
#else
	getapi = (GAMEAPI *)dlsym(hdll, "GetGameAPI");
#endif
	
	if(getapi == NULL)
	{
#ifdef _WIN32
		FreeLibrary(hdll);
#else
		dlclose(hdll);
#endif
		hdll = NULL;

		gi.dprintf ("Q2A: No \"GetGameApi\" entry in DLL %s.\n", dllname);
		return &globals;
	}

	/* proxy a few imports so we can capture the data */
	memcpy(&g_import, import, sizeof(game_import_t));
	g_import.bprintf = game_bprintf;
	g_import.dprintf = game_dprintf;
	g_import.cprintf = game_cprintf;

	dllglobals = (*getapi)(&g_import);

	globals.apiversion = dllglobals->apiversion;

	globals.Init = Init;
	globals.Shutdown = Shutdown;
	globals.SpawnEntities = SpawnEntities;

	globals.WriteGame = dllglobals->WriteGame;
	globals.ReadGame = dllglobals->ReadGame;

	globals.WriteLevel = dllglobals->WriteLevel;
	globals.ReadLevel = dllglobals->ReadLevel;
	
	globals.ClientConnect = ClientConnect;
	globals.ClientBegin = ClientBegin;
	globals.ClientUserinfoChanged = ClientUserinfoChanged;
	globals.ClientDisconnect = ClientDisconnect;
	globals.ClientCommand = ClientCommand;
	globals.ClientThink = ClientThink;
	
	globals.RunFrame = RunFrame;
	
	globals.ServerCommand = ServerCommand;

	copyDllInfo();

	return &globals;
}