예제 #1
0
int main(int argc, char **argv) {

#ifdef COREDUMP
#ifndef WIN32
	struct rlimit rlim;
	getrlimit(RLIMIT_CORE, &rlim);
	rlim.rlim_cur=rlim.rlim_max;
	setrlimit(RLIMIT_CORE, &rlim);
#endif
#endif

	char *path;
	FILE *file;

	srand(time(0));
	glutInit(&argc, argv);
	glutInitWindowSize(1024, 768);
	glutInitDisplayMode(GLUT_MULTISAMPLE|GLUT_RGB|GLUT_DOUBLE|GLUT_DEPTH);
	glutCreateWindow("Geometric figures");
	hidInit();
	consoleInit();
	figureInit();
	drawerInit();
	animInit();
	scriptInit();


	glutDisplayFunc(drawerDisplay);
	glutReshapeFunc(drawerResize);
	glutKeyboardFunc(mainKeyPress);
	glutSpecialFunc(mainSpecialKeyPress);
	glutKeyboardUpFunc(mainKeyRelease);
	glutSpecialUpFunc(mainSpecialKeyRelease);
	glutMouseFunc(mainMouseEvent);
	glutMotionFunc(mainMouseMoveEvent);

	consolePrintNamedBlock("help", "welcome");
	path=utilExpandPath("%/config.py");
	if ((file=fopen(path, "r"))) {
		fclose(file);
		consoleExecFile(path);
	}

	for (int i=1; i<argc; i++) {
		consoleExecFile(argv[i]);
	}

	glutMainLoop();

	drawerFree();
	scriptFinalize();

	return 0;
}
예제 #2
0
// ////////////////////////////////////////////////////////////////////////////
static BOOL gameInit(void)
{
    UDWORD			player;

    scriptInit();

    // If this is from a savegame, stop here!
    if (getSaveGameType() == GTYPE_SAVE_START || getSaveGameType() == GTYPE_SAVE_MIDMISSION)
    {
        // these two lines are the biggest hack in the world.
        // the reticule seems to get detached from 'reticuleup'
        // this forces it back in sync...
        intRemoveReticule();
        intAddReticule();

        return true;
    }

    for(player = 0; player<game.maxPlayers; player++)			// clean up only to the player limit for this map..
    {
        cleanMap(player);
    }

    for (player = 1; player < MAX_PLAYERS; player++)
    {
        // we want to remove disabled AI & all the other players that don't belong
        if ((game.skDiff[player] == 0 || player >= game.maxPlayers) && (!game.scavengers || player != 7))
        {
            clearPlayer(player, true);			// do this quietly
            debug(LOG_NET, "removing disabled AI (%d) from map.", player);
        }
    }

    if (game.scavengers)	// FIXME - not sure if we still need this hack - Per
    {
        // ugly hack for now
        game.skDiff[7] = DIFF_SLIDER_STOPS / 2;
    }

    if (NetPlay.isHost)	// add oil drums
    {
        addOilDrum(NetPlay.playercount * 2);
    }

    playerResponding();			// say howdy!

    return true;
}
예제 #3
0
파일: init.cpp 프로젝트: kerbys/warzone2100
bool stageOneInitialise(void)
{
	debug(LOG_WZ, "== stageOneInitalise ==");

	// Initialise all globals and statics everwhere.
	if(!InitialiseGlobals())
	{
		return false;
	}

	iV_Reset(); // Reset the IV library

	if (!stringsInitialise())	/* Initialise the string system */
	{
		return false;
	}

	if (!objInitialise())		/* Initialise the object system */
	{
		return false;
	}

	if (!droidInit())
	{
		return false;
	}

	if (!initViewData())
	{
		return false;
	}

	if (!grpInitialise())
	{
		return false;
	}

   	if (!aiInitialise())		/* Initialise the AI system */ // pregame
	{
		return false;
	}

	if (!anim_Init())
	{
		return false;
	}

	if ( !animObj_Init( init_ObjectDead ) )
	{
		return false;
	}

	if (!allocPlayerPower())	/*set up the PlayerPower for each player - this should only be done ONCE now*/
	{
		return false;
	}

	// initialise the visibility stuff
	if (!visInitialise())
	{
		return false;
	}

	/* Initialise the movement system */
	if (!moveInitialise())
	{
		return false;
	}

	if (!proj_InitSystem())
	{
		return false;
	}

	if (!scrTabInitialise())	// Initialise the old wzscript system
	{
		return false;
	}

	if (!initScripts())		// Initialise the new javascript system
	{
		return false;
	}

	if (!gridInitialise())
	{
		return false;
	}

	initMission();
	initTransporters();
	scriptInit();

	// do this here so that the very first mission has it initialised
	initRunData();

	gameTimeInit();
	eventTimeReset(gameTime / SCR_TICKRATE);

	return true;
}
예제 #4
0
파일: init.cpp 프로젝트: perim/warzone2100
bool stageOneInitialise()
{
	debug(LOG_WZ, "== stageOneInitialise ==");
	wzSceneEnd("Main menu loop");
	wzSceneBegin("Main game loop");

	// Initialise all globals and statics everywhere.
	if (!InitialiseGlobals())
	{
		return false;
	}

	if (!stringsInitialise())	/* Initialise the string system */
	{
		return false;
	}

	if (!objInitialise())		/* Initialise the object system */
	{
		return false;
	}

	if (!droidInit())
	{
		return false;
	}

	if (!initViewData())
	{
		return false;
	}

	if (!grpInitialise())
	{
		return false;
	}

	if (!aiInitialise())		/* Initialise the AI system */ // pregame
	{
		return false;
	}

	if (!allocPlayerPower())	/*set up the PlayerPower for each player - this should only be done ONCE now*/
	{
		return false;
	}

	// initialise the visibility stuff
	if (!visInitialise())
	{
		return false;
	}

	if (!proj_InitSystem())
	{
		return false;
	}

	if (!scrTabInitialise())	// Initialise the old wzscript system
	{
		return false;
	}

	if (!gridInitialise())
	{
		return false;
	}

	initMission();
	initTransporters();
	scriptInit();

	// do this here so that the very first mission has it initialised
	initRunData();

	gameTimeInit();
	eventTimeReset(gameTime / SCR_TICKRATE);

	return true;
}