Search in sources :

Example 11 with Vargs

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

the class CM method CMod_LoadAreaPortals.

/**
 * Loads area portals.
 */
public static void CMod_LoadAreaPortals(lump_t l) {
    Com.DPrintf("CMod_LoadAreaPortals()\n");
    int i;
    qfiles.dareaportal_t out;
    qfiles.dareaportal_t in;
    int count;
    if ((l.filelen % qfiles.dareaportal_t.SIZE) != 0)
        Com.Error(Defines.ERR_DROP, "MOD_LoadBmodel: funny lump size");
    count = l.filelen / qfiles.dareaportal_t.SIZE;
    if (count > Defines.MAX_MAP_AREAS)
        Com.Error(Defines.ERR_DROP, "Map has too many areas");
    numareaportals = count;
    Com.DPrintf(" numareaportals=" + count + '\n');
    if (debugloadmap) {
        Com.DPrintf("areaportals(portalnum, otherarea)\n");
    }
    for (i = 0; i < count; i++) {
        in = new qfiles.dareaportal_t(ByteBuffer.wrap(cmod_base, i * qfiles.dareaportal_t.SIZE + l.fileofs, qfiles.dareaportal_t.SIZE));
        out = map_areaportals[i];
        out.portalnum = in.portalnum;
        out.otherarea = in.otherarea;
        if (debugloadmap) {
            Com.DPrintf("|%6i|%6i|\n", new Vargs().add(out.portalnum).add(out.otherarea));
        }
    }
}
Also used : Vargs(jake2.util.Vargs)

Example 12 with Vargs

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

the class Qcommon method Frame.

/**
 * Trigger generation of a frame for the given time. The setjmp/longjmp
 * mechanism of the original was replaced with exceptions.
 * @param msec the current game time
 */
public static void Frame(int msec) {
    try {
        if (Globals.log_stats.modified) {
            Globals.log_stats.modified = false;
            if (Globals.log_stats.value != 0.0f) {
                if (Globals.log_stats_file != null) {
                    try {
                        Globals.log_stats_file.close();
                    } catch (IOException e) {
                    }
                    Globals.log_stats_file = null;
                }
                try {
                    Globals.log_stats_file = new FileWriter("stats.log");
                } catch (IOException e) {
                    Globals.log_stats_file = null;
                }
                if (Globals.log_stats_file != null) {
                    try {
                        Globals.log_stats_file.write("entities,dlights,parts,frame time\n");
                    } catch (IOException e) {
                    }
                }
            } else {
                if (Globals.log_stats_file != null) {
                    try {
                        Globals.log_stats_file.close();
                    } catch (IOException e) {
                    }
                    Globals.log_stats_file = null;
                }
            }
        }
        if (Globals.fixedtime.value != 0.0f) {
            msec = (int) Globals.fixedtime.value;
        } else if (Globals.timescale.value != 0.0f) {
            msec *= Globals.timescale.value;
            if (msec < 1)
                msec = 1;
        }
        if (Globals.showtrace.value != 0.0f) {
            Com.Printf("%4i traces  %4i points\n", new Vargs(2).add(Globals.c_traces).add(Globals.c_pointcontents));
            Globals.c_traces = 0;
            Globals.c_brush_traces = 0;
            Globals.c_pointcontents = 0;
        }
        Cbuf.Execute();
        int time_before = 0;
        int time_between = 0;
        int time_after = 0;
        if (Globals.host_speeds.value != 0.0f)
            time_before = Timer.Milliseconds();
        Com.debugContext = "SV:";
        SV_MAIN.SV_Frame(msec);
        if (Globals.host_speeds.value != 0.0f)
            time_between = Timer.Milliseconds();
        Com.debugContext = "CL:";
        CL.Frame(msec);
        if (Globals.host_speeds.value != 0.0f) {
            time_after = Timer.Milliseconds();
            int all = time_after - time_before;
            int sv = time_between - time_before;
            int cl = time_after - time_between;
            int gm = Globals.time_after_game - Globals.time_before_game;
            int rf = Globals.time_after_ref - Globals.time_before_ref;
            sv -= gm;
            cl -= rf;
            Com.Printf("all:%3i sv:%3i gm:%3i cl:%3i rf:%3i\n", new Vargs(5).add(all).add(sv).add(gm).add(cl).add(rf));
        }
    } catch (longjmpException e) {
        Com.DPrintf("longjmp exception:" + e);
    }
}
Also used : FileWriter(java.io.FileWriter) Vargs(jake2.util.Vargs) IOException(java.io.IOException)

Example 13 with Vargs

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

the class Main method R_RenderView.

/**
 * R_RenderView
 * r_newrefdef must be set before the first call
 */
void R_RenderView(refdef_t fd) {
    if (r_norefresh.value != 0.0f)
        return;
    r_newrefdef = fd;
    // included by cwei
    if (r_newrefdef == null) {
        Com.Error(Defines.ERR_DROP, "R_RenderView: refdef_t fd is null");
    }
    if (r_worldmodel == null && (r_newrefdef.rdflags & Defines.RDF_NOWORLDMODEL) == 0)
        Com.Error(Defines.ERR_DROP, "R_RenderView: NULL worldmodel");
    if (r_speeds.value != 0.0f) {
        c_brush_polys = 0;
        c_alias_polys = 0;
    }
    R_PushDlights();
    if (gl_finish.value != 0.0f)
        gl.glFinish();
    R_SetupFrame();
    R_SetFrustum();
    R_SetupGL();
    // done here so we know if we're in water
    R_MarkLeaves();
    R_DrawWorld();
    R_DrawEntitiesOnList();
    R_RenderDlights();
    R_DrawParticles();
    R_DrawAlphaSurfaces();
    R_Flash();
    if (r_speeds.value != 0.0f) {
        VID.Printf(Defines.PRINT_ALL, "%4i wpoly %4i epoly %i tex %i lmaps\n", new Vargs(4).add(c_brush_polys).add(c_alias_polys).add(c_visible_textures).add(c_visible_lightmaps));
    }
}
Also used : Vargs(jake2.util.Vargs)

Example 14 with Vargs

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

the class Image method GL_ImageList_f.

/*
    ===============
    GL_ImageList_f
    ===============
    */
@Override
void GL_ImageList_f() {
    image_t image;
    int texels;
    final String[] palstrings = { "RGB", "PAL" };
    VID.Printf(Defines.PRINT_ALL, "------------------\n");
    texels = 0;
    for (int i = 0; i < numgltextures; i++) {
        image = gltextures[i];
        if (image.texnum <= 0)
            continue;
        texels += image.upload_width * image.upload_height;
        switch(image.type) {
            case it_skin:
                VID.Printf(Defines.PRINT_ALL, "M");
                break;
            case it_sprite:
                VID.Printf(Defines.PRINT_ALL, "S");
                break;
            case it_wall:
                VID.Printf(Defines.PRINT_ALL, "W");
                break;
            case it_pic:
                VID.Printf(Defines.PRINT_ALL, "P");
                break;
            default:
                VID.Printf(Defines.PRINT_ALL, " ");
                break;
        }
        VID.Printf(Defines.PRINT_ALL, " %3i %3i %s: %s\n", new Vargs(4).add(image.upload_width).add(image.upload_height).add(palstrings[(image.paletted) ? 1 : 0]).add(image.name));
    }
    VID.Printf(Defines.PRINT_ALL, "Total texel count (not counting mipmaps): " + texels + '\n');
}
Also used : jake2.render.image_t(jake2.render.image_t) Vargs(jake2.util.Vargs)

Example 15 with Vargs

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

the class CM method CMod_LoadPlanes.

/**
 * Loads planes.
 */
public static void CMod_LoadPlanes(lump_t l) {
    Com.DPrintf("CMod_LoadPlanes()\n");
    int i, j;
    cplane_t out;
    qfiles.dplane_t in;
    int count;
    int bits;
    if ((l.filelen % qfiles.dplane_t.SIZE) != 0)
        Com.Error(Defines.ERR_DROP, "MOD_LoadBmodel: funny lump size");
    count = l.filelen / qfiles.dplane_t.SIZE;
    if (count < 1)
        Com.Error(Defines.ERR_DROP, "Map with no planes");
    // need to save space for box planes
    if (count > Defines.MAX_MAP_PLANES)
        Com.Error(Defines.ERR_DROP, "Map has too many planes");
    Com.DPrintf(" numplanes=" + count + '\n');
    numplanes = count;
    if (debugloadmap) {
        Com.DPrintf("cplanes(normal[0],normal[1],normal[2], dist, type, signbits)\n");
    }
    for (i = 0; i < count; i++) {
        in = new qfiles.dplane_t(ByteBuffer.wrap(cmod_base, i * qfiles.dplane_t.SIZE + l.fileofs, qfiles.dplane_t.SIZE));
        out = map_planes[i];
        bits = 0;
        for (j = 0; j < 3; j++) {
            out.normal[j] = in.normal[j];
            if (out.normal[j] < 0)
                bits |= 1 << j;
        }
        out.dist = in.dist;
        out.type = (byte) in.type;
        out.signbits = (byte) bits;
        if (debugloadmap) {
            Com.DPrintf("|%6.2f|%6.2f|%6.2f| %10.2f|%3i| %1i|\n", new Vargs().add(out.normal[0]).add(out.normal[1]).add(out.normal[2]).add(out.dist).add(out.type).add(out.signbits));
        }
    }
}
Also used : Vargs(jake2.util.Vargs)

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