Exemple #1
0
void NavRep_Startup()
{
	Cmd_Register("navrep_process", NavRep_Process);
	Cmd_Register("navrep_allocs", NavRep_Allocs);
	
	Cvar_Register(&navrep_render);
	Cvar_Register(&navrep_rendertess);
	Cvar_Register(&navrep_debug);

	BSP_Startup();
	NavMesh_Startup();
	NavPoly_Startup();

	NavRep_Init();
}
void	World_InitLighting()
{

	Cvar_Register(&wr_sun_x);
	Cvar_Register(&wr_sun_y);
	Cvar_Register(&wr_sun_z);
	
	Cvar_Register(&wr_sun_phi);
	
	Cvar_Register(&obj_ambient_r);
	Cvar_Register(&obj_ambient_g);
	Cvar_Register(&obj_ambient_b);
	
	Cvar_Register(&obj_light0_r);
	Cvar_Register(&obj_light0_g);
	Cvar_Register(&obj_light0_b);
	Cvar_Register(&obj_light1_r);
	Cvar_Register(&obj_light1_g);
	Cvar_Register(&obj_light1_b);
	
	memset(&lights, 0, sizeof(worldLight_t)*MAX_LIGHTS);
	
	memset(&sunLight, 0, sizeof(worldLight_t));
	sunLight.ambient[0] = 0.3;
	sunLight.ambient[1] = 0.3;
	sunLight.ambient[2] = 0.4;
	sunLight.type = LIGHT_DIRECTIONAL;
	
	Cmd_Register("createLight", WL_CreateLight_Cmd);
}
Exemple #3
0
void	Scene_Init()
{
	Console_Printf("- Initializing World Engine...\n");

	Cvar_Register(&gfx_lod1range);
	Cvar_Register(&gfx_lod2range);
	Cvar_Register(&gfx_lod3range);
	
	Cvar_Register(&gfx_fog);
	Cvar_Register(&gfx_fog_near);
	Cvar_Register(&gfx_fog_far);
	Cvar_Register(&gfx_fogr);
	Cvar_Register(&gfx_fogg);
	Cvar_Register(&gfx_fogb);
	Cvar_Register(&gfx_farclip);
#ifndef DEDICATED_SERVER
	Cvar_Register(&gfx_nearclip);
	Cvar_Register(&gfx_polycount);
	Cvar_Register(&gfx_sky);
	Cvar_Register(&gfx_skycirrus);
	Cvar_Register(&gfx_soundSpace);
	Cvar_Register(&gfx_objects);
	Cvar_Register(&gfx_toon);
	Cvar_Register(&gfx_lockfrustum);
	Cvar_Register(&gfx_dbgplanes);
	Cvar_Register(&gfx_selectionScale);
	Cvar_Register(&gfx_nocull);	
	Cvar_Register(&gfx_sceneStats);
	Cvar_Register(&gfx_dynamicLighting);
	Cvar_Register(&gfx_maxDLights);
	Cvar_Register(&gfx_occlusion);
	Cvar_Register(&gfx_maxSceneOccluders);
	Cvar_Register(&gfx_drawOccluders);

	//! CASE 
	Cvar_Register(&xr_cullMeshes);
	Cvar_Register(&gfx_terrain_farclip);

	Cmd_Register("raytrace", Scene_Raytrace_Cmd);

	Scene_Clear();

	if (!dedicated_server.integer)
	{
		Vid_InitScene();
		Scene_InitFramePool();
	}
	
	for(int i=0;i<4;i++) {
		wind_waves[i].amplitude = 0.8+M_Randnum(-0.2,0.3);
		wind_waves[i].wavelength = M_Randnum(200,400);
		wind_waves[i].speed = M_Randnum(1.1f,1.5f);
	}
#endif
}
Exemple #4
0
/*
===================
Key_Init
===================
*/
void Key_Init(void)
{
    int     i;

//
// init ascii characters in console mode
//
    for (i = K_ASCIIFIRST; i <= K_ASCIILAST; i++)
        Q_SetBit(consolekeys, i);

#define K(x) \
    Q_SetBit(consolekeys, K_##x)

    K(BACKSPACE);
    K(TAB);
    K(ENTER);

    K(UPARROW);
    K(DOWNARROW);
    K(LEFTARROW);
    K(RIGHTARROW);

    K(ALT);
    K(LALT);
    K(RALT);
    K(CTRL);
    K(LCTRL);
    K(RCTRL);
    K(SHIFT);
    K(LSHIFT);
    K(RSHIFT);

    K(INS);
    K(DEL);
    K(PGDN);
    K(PGUP);
    K(HOME);
    K(END);

    K(KP_HOME);
    K(KP_UPARROW);
    K(KP_PGUP);
    K(KP_LEFTARROW);
    K(KP_5);
    K(KP_RIGHTARROW);
    K(KP_END);
    K(KP_DOWNARROW);
    K(KP_PGDN);
    K(KP_ENTER);
    K(KP_INS);
    K(KP_DEL);
    K(KP_SLASH);
    K(KP_MINUS);
    K(KP_PLUS);
    K(KP_MULTIPLY);

    K(MOUSE3);

    K(MWHEELUP);
    K(MWHEELDOWN);

#undef K

//
// init ascii keyshift characters
//
    for (i = 0; i < 256; i++)
        keyshift[i] = i;
    for (i = 'a'; i <= 'z'; i++)
        keyshift[i] = i - 'a' + 'A';

    keyshift['1'] = '!';
    keyshift['2'] = '@';
    keyshift['3'] = '#';
    keyshift['4'] = '$';
    keyshift['5'] = '%';
    keyshift['6'] = '^';
    keyshift['7'] = '&';
    keyshift['8'] = '*';
    keyshift['9'] = '(';
    keyshift['0'] = ')';
    keyshift['-'] = '_';
    keyshift['='] = '+';
    keyshift[','] = '<';
    keyshift['.'] = '>';
    keyshift['/'] = '?';
    keyshift[';'] = ':';
    keyshift['\''] = '"';
    keyshift['['] = '{';
    keyshift[']'] = '}';
    keyshift['`'] = '~';
    keyshift['\\'] = '|';

//
// register our functions
//
    Cmd_Register(c_keys);
}
Exemple #5
0
void SV_RegisterSavegames(void)
{
    Cmd_Register(c_savegames);
}
int main(int argc, char *argv[])
{	
  	SDL_Event event;
	double time, lasttime;
	int i, length, x, y;
	bool done;

/* Hethrep: Remove traps for signals if DEBUG env var is set
 *          so print_backtrace doesn't get called anymore,
 *          this allows proper coredumps and backtraces for SIGSEGV.
 *          print_backtrace is mostly useless but cleans up after a crash,
 *          so it is useful for users, but bad for backtracing / debugging.
 */

#ifndef DEBUG
	if(NULL == getenv("DEBUG")) {
		signal(SIGILL, print_backtrace);
		signal(SIGQUIT, print_backtrace);
		signal(SIGABRT, print_backtrace);
		signal(SIGFPE, print_backtrace);
		signal(SIGSEGV, print_backtrace);
		signal(SIGBUS, print_backtrace);
#ifdef SIGSYS
		signal(SIGSYS, print_backtrace);
#endif	
		printf("traps installed\n");
	} else 
#endif
		printf("DEBUG enabled\n");
	
	Completion_Init();
	System_Init();

	//Big: PhysFS init needs the command line
	PHYSFS_init(argv[0]);
	PHYSFS_setSaneConfig("savage", "", NULL, 0, 0);
	
	length = 1;
	for (i = 0; i < argc; i++)
		length += 1 + strlen(argv[i]);
	sys_cmdline = Tag_Malloc(length, MEM_SYSTEM);
	strcpy(sys_cmdline, "");
	for (i = 0; i < argc; i++)
	{
		strcat(sys_cmdline, argv[i]);
	    strcat(sys_cmdline, " ");
	}

	signal(SIGCHLD, killchild); /* this eliminates zombies */
	
	Host_Init();

	Cmd_Register("launchurl", &LaunchURL_cmd);
	
	//hash the file once it's already opened, to make a file switch harder
	//engine_hashlen = Hash_Filename(argv[0], (unsigned char*)engine_hash);
	
	lasttime = System_Milliseconds();
	sys_time = 0;

	SDL_EnableUNICODE(sys_useUnicode.integer);
	
#ifdef linux
	Clipboard_Init();
#endif
	
	while(1)
	{				
		int elapsed;

		if (!sys_forcefocus.integer && (dedicated_server.integer || sys_sleep.integer || !sys_focus.integer))
			System_Sleep(1);		//allow time for other processes

		//the following loop is necessary because System_GetTime() - lasttime could be dangerously close to 0
		do
		{
			time = System_Milliseconds();
		} while (time-lasttime < 1);

		elapsed = (time-lasttime);
		
		if (gfx.integer)
		{
			ResetButtonData();
			/* Check if there's a pending event. */
			while( SDL_PollEvent( &event ) ) 
			{
				done = HandleEvent(&event);
			}
			SDL_GetMouseState(&x, &y);
			//if(y != Vid_GetScreenH()>>1 && x != Vid_GetScreenW()>>1) {
				if (inverty.integer)
					y = Vid_GetScreenH() - y;
				Input_UpdateMouse(x, y);
			//}
		}
		if (sys_useUnicode.modified)
		{
			SDL_EnableUNICODE(sys_useUnicode.integer);
			sys_useUnicode.modified = false;
		}

		sys_time += elapsed;

		Host_Frame((float)elapsed);

		lasttime = time;
	}
	return TRUE;  //this will never get called
}