Ejemplo n.º 1
0
Archivo: init.c Proyecto: Zoxc/gltron
void initVideo(void) {
	videoInit();
	runScript(PATH_SCRIPTS, "video.lua");

	initVideoData();

	consoleInit();
	initArtpacks();
	runScript(PATH_SCRIPTS, "menu.lua");
	runScript(PATH_SCRIPTS, "menu_functions.lua");
  setupDisplay(gScreen);
}
Ejemplo n.º 2
0
int main( int argc, char *argv[] ) {
  char *path;
  list *l;
#ifdef SOUND
  int c;
#endif

#ifdef __FreeBSD__
  fpsetmask(0);
#endif

#ifdef macintosh
    setupHomeEnvironment ();
#endif

  SystemInit(&argc, argv);

#ifndef CURRENT_EQ_DATA_DIR
  goto_installpath(argv[0]);
#endif

  /* initialize artpack list before loading settigns! */
  initArtpacks();

  path = getFullPath("settings.txt");
  if(path != NULL)
    initMainGameSettings(path); /* reads defaults from ~/.gltronrc */
  else {
    printf("fatal: could not settings.txt, exiting...\n");
    exit(1);
  }

  parse_args(argc, argv);

  consoleInit();
  initGameStructures();
  resetScores();

  /* sound */
  path = getMusicPath(MUSIC_DIR);
  game->settings->soundList = 
    readDirectoryContents(path, SONG_PREFIX);
  
  game->settings->soundIndex = -1;

  l = game->settings->soundList;

#ifdef SOUND
  printf("initializing sound\n");
  initSound();
  setFxVolume(game->settings->fxVolume);

  if(l->next != NULL) {
    char *tmp;
    tmp = malloc(strlen(path) + 1 + /* seperator */
		 strlen((char*) l->data) + 1);
    sprintf(tmp, "%s%c%s", path, SEPERATOR, 
	    (char*) l->data);
    fprintf(stderr, "loading song %s\n", tmp);
    loadSound(tmp);
    free(tmp);
    game->settings->soundIndex = 0;
  }

  c = 0;
  while(l->next != NULL) {
    l = l->next;
    c++;
  }
  game->settings->soundSongCount = c;

  if(game->settings->playMusic)
    playSound();
  fprintf(stderr, "setting music volume to %.3f\n",
	  game->settings->musicVolume);
  setMusicVolume(game->settings->musicVolume);
  free(path);
#endif

  printf("loading menu\n");
  path = getFullPath("menu.txt");
  if(path != NULL)
    pMenuList = loadMenuFile(path);
  else {
    printf("fatal: could not load menu.txt, exiting...\n");
    exit(1);
  }
  printf("menu loaded\n");
  free(path);

  setupDisplay(game->screen);
  switchCallbacks(&guiCallbacks);
  switchCallbacks(&guiCallbacks);

  SystemMainLoop();

  return 0;
}