예제 #1
0
void SetupEmptyNetGame() {
	Com_Printf( "SetupEmptyNetGame()\n" );
	// no current setup packet, so initialize with this phone's default values
	localGameID = SysIphoneMicroseconds();
	memset( &setupPacket, 0, sizeof( setupPacket ) );
	setupPacket.gameID = localGameID;
	setupPacket.packetType = PACKET_VERSION_SETUP;
	setupPacket.map.dataset = mpDataset->value;
	setupPacket.map.episode = mpEpisode->value;
	setupPacket.map.map = mpMap->value;
	setupPacket.map.skill = mpSkill->value;
	setupPacket.deathmatch = mpDeathmatch->value;
	setupPacket.timelimit = timeLimit->value;
	setupPacket.fraglimit = fragLimit->value;
	setupPacket.playerID[0] = playerID;
}
예제 #2
0
int SysIphoneMilliseconds() {
	return SysIphoneMicroseconds()/1000;
}
예제 #3
0
void iphoneStartup() {
	int		start = SysIphoneMilliseconds();
	
	// microseconds will be plenty random for playerID and localGameID
	playerID = localGameID = SysIphoneMicroseconds();
	
	InitImmediateModeGL();

	// init OpenAL before pak file, so the pak file can
	// make all the al static buffers
	Sound_Init();
	
	char buffer[1028];
	sprintf( buffer, "%s/base.iPack", SysIphoneGetAppDir() );
	// get our new-style pak file
	PK_Init( buffer );

	// register console commands
	Cmd_AddCommand( "listcvars", Cvar_List_f );
	Cmd_AddCommand( "resetcvars", Cvar_Reset_f );
	Cmd_AddCommand( "resetmaps", ResetMaps_f );
	Cmd_AddCommand( "listcmds", Cmd_ListCommands_f );
	Cmd_AddCommand( "give", Give_f );
	Cmd_AddCommand( "god", God_f );
	Cmd_AddCommand( "mail", EmailConsole );  //gsh, mails the console to id

	// register console variables
	Cvar_Get( "version", va( "%3.1f %s %s", DOOM_IPHONE_VERSION, __DATE__, __TIME__ ), 0 );
    
    freeLevelOfWeek = Cvar_Get("freeLevelOfWeek", "0", 0 );
	skill = Cvar_Get( "skill", "1", CVAR_ARCHIVE );
	episode = Cvar_Get( "episode", "0", CVAR_ARCHIVE );

	controlScheme = Cvar_Get( "controlScheme", "0", CVAR_ARCHIVE );
	stickTurn = Cvar_Get( "stickTurn", "128", CVAR_ARCHIVE );
	stickMove = Cvar_Get( "stickMove", "128", CVAR_ARCHIVE );
	stickDeadBand = Cvar_Get( "stickDeadBand", "0.05", CVAR_ARCHIVE );
	rotorTurn = Cvar_Get( "rotorTurn", "50000", CVAR_ARCHIVE );
	tiltTurn = Cvar_Get( "tiltTurn", "0", CVAR_ARCHIVE );
	tiltMove = Cvar_Get( "tiltMove", "0", CVAR_ARCHIVE );
	tiltDeadBand = Cvar_Get( "tiltDeadBand", "0.08", CVAR_ARCHIVE );
	tiltAverages = Cvar_Get( "tiltAverages", "3", CVAR_ARCHIVE );
	centerSticks = Cvar_Get( "centerSticks", "1", CVAR_ARCHIVE );
	rampTurn = Cvar_Get( "rampTurn", "1", CVAR_ARCHIVE );

	music = Cvar_Get( "music", "1", CVAR_ARCHIVE );
	cropSprites = Cvar_Get( "cropSprites", "1", 0 );
	mapScale = Cvar_Get( "mapScale", "10", CVAR_ARCHIVE );
	drawControls = Cvar_Get( "drawControls", "1", CVAR_ARCHIVE );
	autoUse = Cvar_Get( "autoUse", "1", CVAR_ARCHIVE );
	statusBar = Cvar_Get( "statusBar", "1", CVAR_ARCHIVE );
	touchClick = Cvar_Get( "touchClick", "1", CVAR_ARCHIVE );
	messages = Cvar_Get( "messages", "1", CVAR_ARCHIVE );
	mapSelectY = Cvar_Get( "mapSelectY", "0", CVAR_ARCHIVE );
	miniNet = Cvar_Get( "miniNet", "1", CVAR_ARCHIVE );

	// multiplayer setup
	timeLimit = Cvar_Get( "timeLimit", "0", CVAR_ARCHIVE );
	fragLimit = Cvar_Get( "fragLimit", "5", CVAR_ARCHIVE );
	mpDeathmatch = Cvar_Get( "mpDeathmatch", "0", CVAR_ARCHIVE );
	mpDataset = Cvar_Get( "mpDataset", "0", CVAR_ARCHIVE );
	mpEpisode = Cvar_Get( "mpEpisode", "1", CVAR_ARCHIVE );
	mpSkill = Cvar_Get( "mpSkill", "1", CVAR_ARCHIVE );
	mpMap = Cvar_Get( "mpMap", "1", CVAR_ARCHIVE );
	mpExpansion = Cvar_Get( "mpExpansion", "0", CVAR_ARCHIVE | CVAR_NOSET );
	
	// debug tools
	showTilt = Cvar_Get( "showTilt", "-1", 0 );
	showTime = Cvar_Get( "showTime", "0", 0 );
	showNet = Cvar_Get( "showNet", "0", 0 );
	showSound = Cvar_Get( "showSound", "0", 0 );
	noBlend = Cvar_Get( "noBlend", "0", 0 );	// disable the damae blends for screenshots
	glfinish = Cvar_Get( "glfinish", "0", 0 );
	throttle = Cvar_Get( "throttle", "0", 0 );	// network packet throttle enable
	
	// Was origiinally 4. Trying different values to help internet play.
	netBuffer = Cvar_Get( "netBuffer", "12", 0 );	// max tics to buffer ahead
	
	// load the archived cvars
	Cmd_ExecuteFile( va( "%s/config.cfg", SysIphoneGetDocDir() ) );
	
	// start the intro music if it wasn't disabled with the music cvar
	iphonePlayMusic( "intro" );
//	iphonePlayMusic( "e1m1" );
	
	// these should get overwritten by the config loading
	memset( &playState, 0, sizeof( playState ) );
	playState.map.skill = 1;
	playState.map.episode = 1;
	playState.map.map = 1;
	HudSetForScheme( 0 );
	
	// load the binary config file
	FILE *f = fopen( va( "%s/binaryConfig.bin", SysIphoneGetDocDir() ), "rb" );
	if ( f ) {
		int version;
		
		version = 0;
		fread( &version, 1, sizeof( version ), f );
		if ( version != VERSION_BCONFIG ) {
			Com_Printf( "Binary config file bad version.\n" );
		} else {
			fread( &playState, 1, sizeof( playState ), f );
			fread( &huds, 1, sizeof( huds ), f );

			version = 0;
			fread( &version, 1, sizeof( version ), f );
			if ( version != VERSION_BCONFIG ) {
				Com_Error( "Binary config file bad trailing version.\n" );
			}
		}
		fclose( f );
	}

	
	Com_Printf( "startup time: %i msec\n", SysIphoneMilliseconds() - start );

	start = SysIphoneMilliseconds();
	
	// the texnums might have been different in the savegame
	HudSetTexnums();
	
	arialFontTexture = PK_FindTexture( "iphone/arialImageLAL.tga" );
	
	Com_Printf( "preloadBeforePlay(): %i msec\n", SysIphoneMilliseconds() - start );	

	// prBoom seems to draw the static pic screens without setting up 2D, causing
	// a bad first frame
	iphoneSet2D();	
	
	menuState = IPM_MAIN;
    lastState = IPM_MAIN;
	
#if 0
	// jump right to the save spot for debugging
	ResumeGame();
#endif
}