Esempio n. 1
0
EXPORT game_export_t *GetGameAPI (game_import_t *import)
{
	gi = *import;
    
#ifdef Q2VR_ENGINE_MOD
	globals.apiversion = GAME_API_VERSION;
#else
    globals.apiversion = LEGACY_API_VERSION;
#endif
    
	globals.Init = InitGame;
	globals.Shutdown = ShutdownGame;
	globals.SpawnEntities = SpawnEntities;

	globals.WriteGame = WriteGame;
	globals.ReadGame = ReadGame;
	globals.WriteLevel = WriteLevel;
	globals.ReadLevel = ReadLevel;

	globals.ClientThink = ClientThink;
	globals.ClientConnect = ClientConnect;
	globals.ClientUserinfoChanged = ClientUserinfoChanged;
	globals.ClientDisconnect = ClientDisconnect;
	globals.ClientBegin = ClientBegin;
	globals.ClientCommand = ClientCommand;

	globals.RunFrame = G_RunFrame;

	globals.ServerCommand = ServerCommand;

	globals.edict_size = sizeof(edict_t);

    // initialize these so ShutdownGame doesn't crash
    dedicated = gi.cvar ("dedicated", "0", CVAR_NOSET);
    deathmatch = gi.cvar ("deathmatch", "0", CVAR_LATCH);
    coop = gi.cvar ("coop", "0", CVAR_LATCH);
    lazarus_pitch = gi.cvar("lazarus_pitch",   "0", 0);
    
	gl_driver = gi.cvar ("gl_driver", "", 0);
	vid_ref = gi.cvar ("vid_ref", "", 0);

	Fog_Init();

	developer = gi.cvar("developer", "0", CVAR_SERVERINFO);
	readout   = gi.cvar("readout", "0", CVAR_SERVERINFO);
	if(readout->value)
	{
		max_modelindex = 0;
		max_soundindex = 0;
		RealFunc.modelindex = gi.modelindex;
		gi.modelindex       = Debug_Modelindex;
		RealFunc.soundindex = gi.soundindex;
		gi.soundindex       = Debug_Soundindex;
	}

	return &globals;
}
Esempio n. 2
0
/*
=================
GetGameAPI

Returns a pointer to the structure with all entry points and global variables
=================
*/
game_export_t *GetGameAPI (game_import_t *import)
{
	gi = *import;

	globals.apiversion = GAME_API_VERSION;
	globals.Init = InitGame;
	globals.Shutdown = ShutdownGame;
	globals.SpawnEntities = SpawnEntities;

	globals.WriteGame = WriteGame;
	globals.ReadGame = ReadGame;
	globals.WriteLevel = WriteLevel;
	globals.ReadLevel = ReadLevel;

	globals.ClientThink = ClientThink;
	globals.ClientConnect = ClientConnect;
	globals.ClientUserinfoChanged = ClientUserinfoChanged;
	globals.ClientDisconnect = ClientDisconnect;
	globals.ClientBegin = ClientBegin;
	globals.ClientCommand = ClientCommand;

	globals.RunFrame = G_RunFrame;

	globals.ServerCommand = ServerCommand;

	globals.edict_size = sizeof(edict_t);

	gl_driver = gi.cvar("gl_driver", "", 0);
	vid_ref = gi.cvar("vid_ref", "", 0);
	gl_driver_fog = gi.cvar("gl_driver_fog", "opengl32", CVAR_NOSET | CVAR_ARCHIVE);

	Fog_Init();

	developer = gi.cvar("developer", "0", CVAR_SERVERINFO);
	readout = gi.cvar("readout", "0", CVAR_SERVERINFO);

	if (readout->value)
	{
		max_modelindex = 0;
		max_soundindex = 0;
		RealFunc.modelindex = gi.modelindex;
		gi.modelindex = Debug_Modelindex;
		RealFunc.soundindex = gi.soundindex;
		gi.soundindex = Debug_Soundindex;
	}

	return &globals;
}
void R_Init (void)
{
	extern cvar_t	r_norefresh;

	Cmd_AddCommand ("timerefresh", R_TimeRefresh_f);
	Cmd_AddCommand ("envmap", R_Envmap_f);

	Cvar_RegisterVariable (&r_norefresh, NULL);
	Cvar_RegisterVariable (&r_lightmap, NULL);
	Cvar_RegisterVariable (&r_fullbright, NULL);
	Cvar_RegisterVariable (&r_drawentities, NULL);
	Cvar_RegisterVariable(&cv_video_drawbrushes, NULL);
	Cvar_RegisterVariable (&r_drawviewmodel, NULL);
	Cvar_RegisterVariable (&r_shadows, NULL);
	Cvar_RegisterVariable (&r_dynamic, NULL);
	Cvar_RegisterVariable (&r_novis, R_Novis_f);
	Cvar_RegisterVariable (&r_nocull, NULL);
	Cvar_RegisterVariable (&r_speeds, NULL);
	Cvar_RegisterVariable (&gl_cull, NULL);
	Cvar_RegisterVariable (&gl_polyblend, NULL);
	Cvar_RegisterVariable (&gl_flashblend, NULL);
	Cvar_RegisterVariable (&r_stereo, NULL);
	Cvar_RegisterVariable (&r_stereodepth, NULL);
	Cvar_RegisterVariable (&r_waterquality, NULL);
	Cvar_RegisterVariable (&r_oldwater, NULL);
	Cvar_RegisterVariable (&r_waterwarp, NULL);
	Cvar_RegisterVariable (&r_drawflat, NULL);
	Cvar_RegisterVariable (&r_flatlightstyles, NULL);
	Cvar_RegisterVariable (&r_oldskyleaf, R_OldSkyLeaf_f);
	Cvar_RegisterVariable (&r_drawworld, NULL);
	Cvar_RegisterVariable (&r_showtris, NULL);
	Cvar_RegisterVariable (&r_showbboxes, NULL);
	Cvar_RegisterVariable (&gl_farclip, NULL);
	Cvar_RegisterVariable (&gl_fullbrights, NULL);
	Cvar_RegisterVariable(&cv_video_lightmapoversample, GL_Overbright_f);
	Cvar_RegisterVariable (&r_lerpmodels, NULL);
	Cvar_RegisterVariable (&r_lerpmove, NULL);
	Cvar_RegisterVariable (&gl_subdivide_size, NULL);

	Particle_Initialize();

	Sky_Init();
	Fog_Init();
}