Example #1
0
/* For the Windows platform, this is the start of the application. */
int WINAPI
WinMain(HINSTANCE hInst, HINSTANCE hPrev, LPSTR lpszArg, int nCmdShow)
{
    wchar_t **argw = NULL;
    int	argc, i;

    /* Set this to the default value (windowed mode). */
    video_fullscreen = 0;

    /* We need this later. */
    hinstance = hInst;

    /* Set the application version ID string. */
    sprintf(emu_version, "%s v%s", EMU_NAME, EMU_VERSION);

#ifdef USE_CRASHDUMP
    /* Enable crash dump services. */
    InitCrashDump();
#endif

    /* First, set our (default) language. */
    set_language(0x0409);

    /* Create console window. */
    CreateConsole(1);

    /* Process the command line for options. */
    argc = ProcessCommandLine(&argw);

    /* Pre-initialize the system, this loads the config file. */
    if (! pc_init(argc, argw)) {
	/* Detach from console. */
	CreateConsole(0);
	return(1);
    }

    /* Cleanup: we may no longer need the console. */
    if (! force_debug)
	CreateConsole(0);

    /* Handle our GUI. */
    i = ui_init(nCmdShow);

    return(i);
}
Example #2
0
int main(int argc,char *argv[])
  {
  char *s;
  char *pr;
  char test[50];
  char *mask;
  InitCrashDump();
  SetConsoleCtrlHandler(HandlerRoutine,TRUE);
  filename[0] ='\0';
  //  strcpy(filename,"TEST.MAP");
  args_support(argc-1,argv);
  printf("Hledam konfiguracni soubor\n");
  config_file = read_config("WSKELDAL.INI");
  if (config_file == NULL)
    {
    puts("...nemohu najit WSKELDAL.INI\n");
    return 1;
    }
  if (strlen(filename)>3 && stricmp(filename+strlen(filename)-3,"adv") == 0)
  {
	TSTR_LIST adv_cfg = read_config(filename);
	config_file = merge_configs(config_file,adv_cfg);
	filename[0] = 0;
  }  
  sample_path = get_text_field(config_file,"CESTA_ZVUKY");
  if (sample_path == NULL) sample_path ="";
  mob_dir = get_text_field(config_file,"CESTA_ENEMY");
  if (mob_dir == NULL) mob_dir ="";
  init_sound();
  init();

  concat(mask,get_text_field(config_file,"CESTA_MAPY"),"*.map");  
  atexit(shut_down);
//  signal(SIGABRT,shut_down);
  init_mob_list();
  InitMapFiles(get_text_field(config_file,"CESTA_MAPY"));
  do
     {
     ask_exit_status = 2;
     if (filename[0] =='\0') browser(mask,filename);
     if (filename[0]!='\0')
	 {
	   char *mapy = get_text_field(config_file,"CESTA_MAPY");
	   memmove(filename+strlen(mapy),filename,strlen(filename)+1);
	   memcpy(filename,mapy,strlen(mapy));
	   s = pripona(filename,".HI");
	   background_file = (char *)getmem(strlen(s)+1);strcpy(background_file,s);
       load_background();
	 }
     do_events();
     logo();
     pr = pripona(filename,SCR);
     script_name = NewArr(char,strlen(pr)+1);
     strcpy(script_name,pr);
     read_full_side_script(pr);
     read_spec_procs();
     read_side_list(ITEMS_SCRIPT,&vzhled_veci,0,4);
     read_side_list(ITEMS_PICS,&pohledy_veci,0,2);
     read_dlg_list(DLG_SCRIPT,&dlg_names,&dlg_pgfs);
     read_side_list(WEAPONS_SCRIPT,&weapons,0,3);
     read_side_list(WEAPONS_SCRIPT,&weapons_pos,2,3);
     set_defaults();
     init_multiactions();
     memset(vyklenky,0,sizeof(vyklenky));
     init_item_system();
     if (filename[0]!='\0' )
       {
       int sel = 1;

       init_maps();
       set_defaults();
       if (load_map(filename))
          msg_box(filename,'\01',"Tento soubor je buƒ ne‡iteln˜, nebo po¨kozen˜","Pokra‡ovat",NULL);
       if (check_password(NULL) == 0)
          if (ask_password(test,0) == 0 || check_password(test) == 0)
            {
            filename[0] = 0;
            ask_exit_status = 1;
            goto preskoc;
            }
       if (maplen<2)
          {
          sel = msg_box(filename,' ',"Soubor neexistuje, bude vytvo©en nov˜. Nyn¡ je nutn‚ nastavit z kladn¡ stˆny"
                               " a jin‚ dal¨¡ parametry pro tuto mapu","Pokra‡ujem","Zav©it",NULL);
          if (sel == 1)
             {
             newmap = 1;
             }

          }
       if (sel == 1)
           {
          create_menu();
          redraw_window();
          escape();
          filename[0] = 0;
          close_current();
          }
        }
     preskoc:
     free(background_file);
     }
  while (ask_exit_status == 1);
  ClearMapFiles();
  redraw_desktop();
  close_manager();
  return 0;
  }