コード例 #1
0
ファイル: Screen.java プロジェクト: ETH-CAT/quake2-gwt-port
  /*
   * ================ SCR_TimeRefresh_f ================
   */
  static void TimeRefresh_f() {
    int i;
    int start, stop;
    float time;

    if (cls.state != ca_active) return;

    start = Timer.Milliseconds();

    if (Commands.Argc() == 2) { // run without page flipping
      re.BeginFrame(0);
      for (i = 0; i < 128; i++) {
        cl.refdef.viewangles[1] = i / 128.0f * 360.0f;
        re.RenderFrame(cl.refdef);
      }
      re.EndFrame();
    } else {
      for (i = 0; i < 128; i++) {
        cl.refdef.viewangles[1] = i / 128.0f * 360.0f;

        re.BeginFrame(0);
        re.RenderFrame(cl.refdef);
        re.EndFrame();
      }
    }

    stop = Timer.Milliseconds();
    time = (stop - start) / 1000.0f;
    Com.Printf("%f seconds (%f fps)\n", new Vargs(2).add(time).add(128.0f / time));
  }
コード例 #2
0
  // ok.
  public static void Netchan_Init() {
    long port;

    // pick a port value that should be nice and random
    port = Timer.Milliseconds() & 0xffff;

    showpackets = ConsoleVariables.Get("showpackets", "0", 0);
    showdrop = ConsoleVariables.Get("showdrop", "0", 0);
    NetworkChannel.consoleQport = ConsoleVariables.Get("qport", "" + port, Constants.CVAR_NOSET);
  }
コード例 #3
0
ファイル: Screen.java プロジェクト: ETH-CAT/quake2-gwt-port
  /** PlayCinematic */
  static void PlayCinematic(String arg) {
    System.out.println("PlayCinematic(" + arg + ")");

    if (re.showVideo(arg)) {
      EndLoadingPlaque();
      cls.state = ca_active;
      cl.cinematictime = Timer.Milliseconds();
      cl.cinematicframe = 1;
    } else {
      FinishCinematic();
    }
  }
コード例 #4
0
ファイル: Screen.java プロジェクト: ETH-CAT/quake2-gwt-port
  /*
   * ================ SCR_BeginLoadingPlaque ================
   */
  public static void BeginLoadingPlaque() {
    Sound.StopAllSounds();
    cl.sound_prepped = false; // don't play ambients

    if (cls.disable_screen != 0) return;
    if (Globals.developer.value != 0) return;
    if (cls.state == ca_disconnected) return; // if at console, don't bring up the plaque
    if (cls.key_dest == key_console) return;
    if (cl.cinematictime > 0) scr_draw_loading = 2; // clear to balack first
    else scr_draw_loading = 1;

    UpdateScreen();
    cls.disable_screen = Timer.Milliseconds();
    cls.disable_servercount = cl.servercount;
  }
コード例 #5
0
ファイル: Screen.java プロジェクト: ETH-CAT/quake2-gwt-port
  public static void UpdateScreen2() {
    int numframes;
    int i;
    // if the screen is disabled (loading plaque is up, or vid mode
    // changing)
    // do nothing at all
    if (cls.disable_screen != 0) {
      if (Timer.Milliseconds() - cls.disable_screen > 120000) {
        cls.disable_screen = 0;
        Com.Printf("Loading plaque timed out.\n");
      }
      DrawConsole();
      DrawLoading();
      return;
    }

    if (!scr_initialized || !con.initialized) return; // not initialized yet

    /*
     * * range check cl_camera_separation so we don't inadvertently fry
     * someone's * brain
     */
    if (cl_stereo_separation.value > 1.0) ConsoleVariables.SetValue("cl_stereo_separation", 1.0f);
    else if (cl_stereo_separation.value < 0)
      ConsoleVariables.SetValue("cl_stereo_separation", 0.0f);

    if (cl_stereo.value != 0) {
      numframes = 2;
      separation[0] = -cl_stereo_separation.value / 2;
      separation[1] = cl_stereo_separation.value / 2;
    } else {
      separation[0] = 0;
      separation[1] = 0;
      numframes = 1;
    }

    for (i = 0; i < numframes; i++) {
      re.BeginFrame(separation[i]);

      if (scr_draw_loading == 2) { //  loading plaque over black screen
        Dimension dim = new Dimension();

        re.CinematicSetPalette(null);
        scr_draw_loading = 0; // false
        re.DrawGetPicSize(dim, "loading");
        re.DrawPic((viddef.width - dim.width) / 2, (viddef.height - dim.height) / 2, "loading");
      }
      // if a cinematic is supposed to be running, handle menus
      // and console specially
      else if (cl.cinematictime > 0) {
        if (cls.key_dest == key_menu) {
          if (cl.cinematicpalette_active) {
            re.CinematicSetPalette(null);
            cl.cinematicpalette_active = false;
          }
          Menu.Draw();
        } else if (cls.key_dest == key_console) {
          if (cl.cinematicpalette_active) {
            re.CinematicSetPalette(null);
            cl.cinematicpalette_active = false;
          }
          DrawConsole();
        } else {
          DrawCinematic();
        }
      } else if (ResourceLoader.Pump()) {
        TileClear();
        DrawStats();
        CheckDrawCenterString();
        DrawPause();
        DrawConsole();
        Menu.Draw();
        DrawLoading();
      } else {
        // make sure the game palette is active
        if (cl.cinematicpalette_active) {
          re.CinematicSetPalette(null);
          cl.cinematicpalette_active = false;
        }
        // do 3D refresh drawing, and then update the screen
        CalcVrect();

        // clear any dirty part of the background
        TileClear();

        Video.RenderView(separation[i]);

        DrawStats();

        if ((cl.frame.playerstate.stats[STAT_LAYOUTS] & 1) != 0) DrawLayout();
        if ((cl.frame.playerstate.stats[STAT_LAYOUTS] & 2) != 0) ClientInventory.DrawInventory();

        DrawNet();
        CheckDrawCenterString();
        DrawFPS();

        //
        //				if (scr_timegraph->value)
        //					SCR_DebugGraph (cls.frametime*300, 0);
        //
        //				if (scr_debuggraph->value || scr_timegraph->value ||
        // scr_netgraph->value)
        //					SCR_DrawDebugGraph ();
        //
        DrawPause();
        DrawConsole();
        Menu.Draw();
        DrawLoading();
      }
    }

    Globals.re.EndFrame();
  }