Search in sources :

Example 21 with Vargs

use of jake2.util.Vargs in project narchy by automenta.

the class SCR method TimeRefresh_f.

/*
     * ================ SCR_TimeRefresh_f ================
     */
static void TimeRefresh_f() {
    int i;
    int start, stop;
    float time;
    if (cls.state != ca_active)
        return;
    start = Timer.Milliseconds();
    if (Cmd.Argc() == 2) {
        // run without page flipping
        if (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;
            if (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));
}
Also used : Vargs(jake2.util.Vargs)

Example 22 with Vargs

use of jake2.util.Vargs in project narchy by automenta.

the class SND_DMA method SoundList.

static void SoundList() {
    int i;
    sfx_t sfx;
    sfxcache_t sc;
    int size, total;
    total = 0;
    for (i = 0; i < num_sfx; i++) {
        sfx = known_sfx[i];
        if (sfx.registration_sequence == 0)
            continue;
        sc = sfx.cache;
        if (sc != null) {
            size = sc.length * sc.width * (sc.stereo + 1);
            total += size;
            if (sc.loopstart >= 0)
                Com.Printf("L");
            else
                Com.Printf(" ");
            Com.Printf("(%2db) %6i : %s\n", new Vargs(3).add(sc.width * 8).add(size).add(sfx.name));
        } else {
            if (sfx.name.charAt(0) == '*')
                Com.Printf("  placeholder : " + sfx.name + '\n');
            else
                Com.Printf("  not loaded  : " + sfx.name + '\n');
        }
    }
    Com.Printf("Total resident: " + total + '\n');
}
Also used : jake2.sound.sfxcache_t(jake2.sound.sfxcache_t) Vargs(jake2.util.Vargs) jake2.sound.sfx_t(jake2.sound.sfx_t)

Example 23 with Vargs

use of jake2.util.Vargs in project narchy by automenta.

the class Model method Mod_LoadSpriteModel.

/*
	==============================================================================

	SPRITE MODELS

	==============================================================================
	*/
/*
	=================
	Mod_LoadSpriteModel
	=================
	*/
void Mod_LoadSpriteModel(model_t mod, ByteBuffer buffer) {
    qfiles.dsprite_t sprout = new qfiles.dsprite_t(buffer);
    if (sprout.version != qfiles.SPRITE_VERSION)
        Com.Error(Defines.ERR_DROP, "%s has wrong version number (%i should be %i)", new Vargs(3).add(mod.name).add(sprout.version).add(qfiles.SPRITE_VERSION));
    if (sprout.numframes > qfiles.MAX_MD2SKINS)
        Com.Error(Defines.ERR_DROP, "%s has too many frames (%i > %i)", new Vargs(3).add(mod.name).add(sprout.numframes).add(qfiles.MAX_MD2SKINS));
    for (int i = 0; i < sprout.numframes; i++) {
        mod.skins[i] = GL_FindImage(sprout.frames[i].name, it_sprite);
    }
    mod.type = mod_sprite;
    mod.extradata = sprout;
}
Also used : Vargs(jake2.util.Vargs)

Example 24 with Vargs

use of jake2.util.Vargs in project narchy by automenta.

the class Model method Mod_Modellist_f.

// ===============================================================================
/*
	================
	Mod_Modellist_f
	================
	*/
@Override
void Mod_Modellist_f() {
    int i;
    model_t mod;
    int total;
    total = 0;
    VID.Printf(Defines.PRINT_ALL, "Loaded models:\n");
    for (i = 0; i < mod_numknown; i++) {
        mod = mod_known[i];
        if (mod.name.length() == 0)
            continue;
        VID.Printf(Defines.PRINT_ALL, "%8i : %s\n", new Vargs(2).add(mod.extradatasize).add(mod.name));
        total += mod.extradatasize;
    }
    VID.Printf(Defines.PRINT_ALL, "Total resident: " + total + '\n');
}
Also used : Vargs(jake2.util.Vargs)

Example 25 with Vargs

use of jake2.util.Vargs in project narchy by automenta.

the class SV_CCMDS method SV_WriteServerFile.

/*
	==============
	SV_WriteServerFile
	
	==============
	*/
public static void SV_WriteServerFile(boolean autosave) {
    QuakeFile f;
    cvar_t var;
    String filename, name, string, comment;
    Com.DPrintf("SV_WriteServerFile(" + (autosave ? "true" : "false") + ")\n");
    filename = FS.Gamedir() + "/save/current/server.ssv";
    try {
        f = new QuakeFile(filename, "rw");
        if (!autosave) {
            Calendar c = Calendar.getInstance();
            comment = Com.sprintf("%2i:%2i %2i/%2i  ", new Vargs().add(c.get(Calendar.HOUR_OF_DAY)).add(c.get(Calendar.MINUTE)).add(c.get(Calendar.MONTH) + 1).add(c.get(Calendar.DAY_OF_MONTH)));
            comment += SV_INIT.sv.configstrings[Defines.CS_NAME];
        } else {
            // autosaved
            comment = "ENTERING " + SV_INIT.sv.configstrings[Defines.CS_NAME];
        }
        f.writeString(comment);
        f.writeString(SV_INIT.svs.mapcmd);
        // these will be things like coop, skill, deathmatch, etc
        for (var = Globals.cvar_vars; var != null; var = var.next) {
            if (0 == (var.flags & Defines.CVAR_LATCH))
                continue;
            if (var.name.length() >= Defines.MAX_OSPATH - 1 || var.string.length() >= 128 - 1) {
                Com.Printf("Cvar too long: " + var.name + " = " + var.string + '\n');
                continue;
            }
            name = var.name;
            string = var.string;
            try {
                f.writeString(name);
                f.writeString(string);
            } catch (IOException e2) {
            }
        }
        // rst: for termination.
        f.writeString(null);
        f.close();
    } catch (Exception e) {
        Com.Printf("Couldn't write " + filename + '\n');
    }
    // write game state
    filename = FS.Gamedir() + "/save/current/game.ssv";
    GameSave.WriteGame(filename, autosave);
}
Also used : QuakeFile(jake2.util.QuakeFile) Calendar(java.util.Calendar) Vargs(jake2.util.Vargs) IOException(java.io.IOException) IOException(java.io.IOException) FileNotFoundException(java.io.FileNotFoundException)

Aggregations

Vargs (jake2.util.Vargs)26 IOException (java.io.IOException)3 jake2.render.image_t (jake2.render.image_t)2 jake2.sound.sfx_t (jake2.sound.sfx_t)1 jake2.sound.sfxcache_t (jake2.sound.sfxcache_t)1 QuakeFile (jake2.util.QuakeFile)1 FileNotFoundException (java.io.FileNotFoundException)1 FileWriter (java.io.FileWriter)1 ByteBuffer (java.nio.ByteBuffer)1 Calendar (java.util.Calendar)1