예제 #1
0
void Pointfile_Delete (void)
{
  const char* mapname = Map_Name(g_map);
  StringOutputStream name(256);
  name << StringRange(mapname, path_get_filename_base_end(mapname)) << ".lin";
	file_remove(name.c_str());
}
예제 #2
0
파일: qe3.cpp 프로젝트: raynorpat/cake
void bsp_init()
{
  build_set_variable("RadiantPath", AppPath_get());
  build_set_variable("ExecutableType", RADIANT_EXECUTABLE);
  build_set_variable("EnginePath", EnginePath_get());
  build_set_variable("UserEnginePath", g_qeglobals.m_userEnginePath.c_str());
  build_set_variable("MonitorAddress", (g_WatchBSP_Enabled) ? "127.0.0.1:39000" : "");
  build_set_variable("GameName", gamename_get());

  build_set_variable("MapFile", Map_Name(g_map));
}
예제 #3
0
void Pointfile_Parse(CPointfile& pointfile)
{
	int		size;
	char	*data;
  char  *text;
  int   line = 1;

  const char* mapname = Map_Name(g_map);
  StringOutputStream name(256);
  name << StringRange(mapname, path_get_filename_base_end(mapname)) << ".lin";

	size = LoadFile (name.c_str(), (void**)&data);
  if (size == -1)
  {
    globalErrorStream() << "Pointfile " << name.c_str() << " not found\n";
		return;
  }

  // store a pointer
  text = data;

	globalOutputStream() << "Reading pointfile " << name.c_str() << "\n";

  pointfile.Init();

	while (*data)
	{
	  Vector3 v;
    if (sscanf(data,"%f %f %f", &v[0], &v[1], &v[2]) != 3)
    {
      globalOutputStream() << "Corrupt point file, line " << line << "\n";
			break;
    }

  	while (*data && *data != '\n')
    {
      if (*(data-1) == ' ' && *(data) == '-' && *(data+1) == ' ')
        break;
		  data++;
    }
    // deal with zhlt style point files.
    if (*data == '-')
    {
      if (sscanf(data,"- %f %f %f", &v[0], &v[1], &v[2]) != 3)
      {
        globalOutputStream() << "Corrupt point file, line " << line << "\n";
        break;
      }

      while (*data && *data != '\n')
		    data++;

    }
    while (*data == '\n')
    {
      data++; // skip the \n
      line++;
    }
		pointfile.PushPoint (v);
	}

  g_free(text);
}
예제 #4
0
const char* getMapName(){
	return Map_Name( g_map );
}
예제 #5
0
파일: qe3.cpp 프로젝트: raynorpat/cake
void RunBSP(const char* name)
{
  // http://zerowing.idsoftware.com/bugzilla/show_bug.cgi?id=503
  // make sure we don't attempt to region compile a map with the camera outside the region
  if (region_active && !Region_cameraValid())
  {
    globalErrorStream() << "The camera must be in the region to start a region compile.\n";
    return;
  }

  SaveMap();

  if(Map_Unnamed(g_map))
  {
    globalOutputStream() << "build cancelled\n";
    return;
  }

  if (g_SnapShots_Enabled && !Map_Unnamed(g_map) && Map_Modified(g_map))
  {
    Map_Snapshot();
  }

  if (region_active)
  {
    const char* mapname = Map_Name(g_map);
    StringOutputStream name(256);
    name << StringRange(mapname, path_get_filename_base_end(mapname)) << ".reg";
    Map_SaveRegion(name.c_str());
  }

  Pointfile_Delete();

  bsp_init();

  if (g_WatchBSP_Enabled)
  {
    ArrayCommandListener listener;
    build_run(name, listener);
    // grab the file name for engine running
    const char* fullname = Map_Name(g_map);
    StringOutputStream bspname(64);
    bspname << StringRange(path_get_filename_start(fullname), path_get_filename_base_end(fullname));
    BuildMonitor_Run( listener.array(), bspname.c_str() );
  }
  else
  {
    char junkpath[PATH_MAX];
    strcpy(junkpath, SettingsPath_get());
    strcat(junkpath, "junk.txt");

    char batpath[PATH_MAX];
#if defined(POSIX)
    strcpy(batpath, SettingsPath_get());
    strcat(batpath, "qe3bsp.sh");
#elif defined(WIN32)
    strcpy(batpath, SettingsPath_get());
    strcat(batpath, "qe3bsp.bat");
#else
#error "unsupported platform"
#endif
    bool written = false;
    {
      TextFileOutputStream batchFile(batpath);
      if(!batchFile.failed())
      {
#if defined (POSIX)
        batchFile << "#!/bin/sh \n\n";
#endif
        BatchCommandListener listener(batchFile, junkpath);
        build_run(name, listener);
        written = true;
      }
    }
    if(written)
    {
#if defined (POSIX)
      chmod (batpath, 0744);
#endif
      globalOutputStream() << "Writing the compile script to '" << batpath << "'\n";
      globalOutputStream() << "The build output will be saved in '" << junkpath << "'\n";
      Q_Exec(batpath, NULL, NULL, true);
    }
  }

  bsp_shutdown();
}