Search in sources :

Example 16 with Vargs

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

the class Qcommon method Init.

/**
 * This function initializes the different subsystems of
 * the game engine. The setjmp/longjmp mechanism of the original
 * was replaced with exceptions.
 * @param args the original unmodified command line arguments
 */
public static void Init(String[] args) {
    try {
        // prepare enough of the subsystems to handle
        // cvar and command buffer management
        Com.InitArgv(args);
        Cbuf.Init();
        Cmd.Init();
        Cvar.Init();
        Key.Init();
        // we need to add the early commands twice, because
        // a basedir or cddir needs to be set before execing
        // config files, but we want other parms to override
        // the settings of the config files
        Cbuf.AddEarlyCommands(false);
        Cbuf.Execute();
        if (Globals.dedicated.value != 1.0f) {
            Jake2.q2DataTool.setStatus("initializing filesystem...");
        }
        FS.InitFilesystem();
        if (Globals.dedicated.value != 1.0f) {
            Jake2.q2DataTool.setStatus("loading config...");
        }
        reconfigure(false);
        // use cddir from config.cfg
        FS.setCDDir();
        // mark the default search paths
        FS.markBaseSearchPaths();
        if (Globals.dedicated.value != 1.0f) {
            // test for valid baseq2
            Jake2.q2DataTool.testQ2Data();
        }
        // reload default.cfg and config.cfg
        reconfigure(true);
        // 
        // init commands and vars
        // 
        Cmd.AddCommand("error", Com.Error_f);
        Globals.host_speeds = Cvar.Get("host_speeds", "0", 0);
        Globals.log_stats = Cvar.Get("log_stats", "0", 0);
        Globals.developer = Cvar.Get("developer", "0", CVAR_ARCHIVE);
        Globals.timescale = Cvar.Get("timescale", "0", 0);
        Globals.fixedtime = Cvar.Get("fixedtime", "0", 0);
        Globals.logfile_active = Cvar.Get("logfile", "0", 0);
        Globals.showtrace = Cvar.Get("showtrace", "0", 0);
        Globals.dedicated = Cvar.Get("dedicated", "0", CVAR_NOSET);
        String s = Com.sprintf("%4.2f %s %s %s", new Vargs(4).add(Globals.VERSION).add(CPUSTRING).add(Globals.__DATE__).add(BUILDSTRING));
        Cvar.Get("version", s, CVAR_SERVERINFO | CVAR_NOSET);
        if (Globals.dedicated.value != 1.0f) {
            Jake2.q2DataTool.setStatus("initializing network subsystem...");
        }
        // ok
        NET.Init();
        // ok
        Netchan.Netchan_Init();
        if (Globals.dedicated.value != 1.0f) {
            Jake2.q2DataTool.setStatus("initializing server subsystem...");
        }
        // ok
        SV_MAIN.SV_Init();
        if (Globals.dedicated.value != 1.0f) {
            Jake2.q2DataTool.setStatus("initializing client subsystem...");
        }
        CL.Init();
        // add + commands from command line
        if (!Cbuf.AddLateCommands()) {
            // if the user didn't give any commands, run default action
            if (Globals.dedicated.value == 0)
                Cbuf.AddText("d1\n");
            else
                Cbuf.AddText("dedicated_start\n");
            Cbuf.Execute();
        } else {
            // the user asked for something explicit
            // so drop the loading plaque
            SCR.EndLoadingPlaque();
        }
        Com.Printf("====== Quake2 Initialized ======\n\n");
        // save config when configuration is completed
        CL.WriteConfiguration();
        if (Globals.dedicated.value != 1.0f) {
            Jake2.q2DataTool.dispose();
        }
    } catch (longjmpException e) {
        Sys.Error("Error during initialization");
    }
}
Also used : Vargs(jake2.util.Vargs)

Example 17 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 18 with Vargs

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

the class CM method CMod_LoadLeafBrushes.

/**
 * Loads leaf brushes.
 */
public static void CMod_LoadLeafBrushes(lump_t l) {
    Com.DPrintf("CMod_LoadLeafBrushes()\n");
    if ((l.filelen % 2) != 0)
        Com.Error(Defines.ERR_DROP, "MOD_LoadBmodel: funny lump size");
    int count = l.filelen / 2;
    Com.DPrintf(" numbrushes=" + count + '\n');
    if (count < 1)
        Com.Error(Defines.ERR_DROP, "Map with no planes");
    // need to save space for box planes
    if (count > Defines.MAX_MAP_LEAFBRUSHES)
        Com.Error(Defines.ERR_DROP, "Map has too many leafbrushes");
    int[] out = map_leafbrushes;
    numleafbrushes = count;
    ByteBuffer bb = ByteBuffer.wrap(cmod_base, l.fileofs, count * 2).order(ByteOrder.LITTLE_ENDIAN);
    if (debugloadmap) {
        Com.DPrintf("map_brushes:\n");
    }
    for (int i = 0; i < count; i++) {
        out[i] = bb.getShort();
        if (debugloadmap) {
            Com.DPrintf("|%6i|%6i|\n", new Vargs().add(i).add(out[i]));
        }
    }
}
Also used : Vargs(jake2.util.Vargs) ByteBuffer(java.nio.ByteBuffer)

Example 19 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 20 with Vargs

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

the class V method RenderView.

/*
     * ================== V_RenderView
     * 
     * ==================
     */
static void RenderView(float stereo_separation) {
    // 
    if (cls.state != ca_active)
        return;
    if (!cl.refresh_prepped)
        // still loading
        return;
    if (cl_timedemo.value != 0.0f) {
        if (cl.timedemo_start == 0)
            cl.timedemo_start = Timer.Milliseconds();
        cl.timedemo_frames++;
    }
    // we can't use the old frame if the video mode has changed, though...
    if (cl.frame.valid && (cl.force_refdef || cl_paused.value == 0.0f)) {
        cl.force_refdef = false;
        V.ClearScene();
        // builder a refresh entity list and calc cl.sim*
        // this also calls CL_CalcViewValues which loads
        // v_forward, etc.
        CL_ents.AddEntities();
        if (cl_testparticles.value != 0.0f)
            TestParticles();
        if (cl_testentities.value != 0.0f)
            TestEntities();
        if (cl_testlights.value != 0.0f)
            TestLights();
        if (cl_testblend.value != 0.0f) {
            cl.refdef.blend[0] = 1.0f;
            cl.refdef.blend[1] = 0.5f;
            cl.refdef.blend[2] = 0.25f;
            cl.refdef.blend[3] = 0.5f;
        }
        // offset vieworg appropriately if we're doing stereo separation
        if (stereo_separation != 0) {
            float[] tmp = new float[3];
            Math3D.VectorScale(cl.v_right, stereo_separation, tmp);
            Math3D.VectorAdd(cl.refdef.vieworg, tmp, cl.refdef.vieworg);
        }
        // never let it sit exactly on a node line, because a water plane
        // can
        // dissapear when viewed with the eye exactly on it.
        // the server protocol only specifies to 1/8 pixel, so add 1/16 in
        // each axis
        cl.refdef.vieworg[0] += 1.0 / 16;
        cl.refdef.vieworg[1] += 1.0 / 16;
        cl.refdef.vieworg[2] += 1.0 / 16;
        cl.refdef.x = scr_vrect.x;
        cl.refdef.y = scr_vrect.y;
        cl.refdef.width = scr_vrect.width;
        cl.refdef.height = scr_vrect.height;
        cl.refdef.fov_y = Math3D.CalcFov(cl.refdef.fov_x, cl.refdef.width, cl.refdef.height);
        cl.refdef.time = cl.time * 0.001f;
        cl.refdef.areabits = cl.frame.areabits;
        if (cl_add_entities.value == 0.0f)
            r_numentities = 0;
        if (cl_add_particles.value == 0.0f)
            r_numparticles = 0;
        if (cl_add_lights.value == 0.0f)
            r_numdlights = 0;
        if (cl_add_blend.value == 0) {
            Math3D.VectorClear(cl.refdef.blend);
        }
        cl.refdef.num_entities = r_numentities;
        cl.refdef.entities = r_entities;
        cl.refdef.num_particles = r_numparticles;
        cl.refdef.num_dlights = r_numdlights;
        cl.refdef.dlights = r_dlights;
        cl.refdef.lightstyles = r_lightstyles;
        cl.refdef.rdflags = cl.frame.playerstate.rdflags;
    // sort entities for better cache locality
    // !!! useless in Java !!!
    // Arrays.sort(cl.refdef.entities, entitycmpfnc);
    }
    re.RenderFrame(cl.refdef);
    if (cl_stats.value != 0.0f)
        Com.Printf("ent:%i  lt:%i  part:%i\n", new Vargs(3).add(r_numentities).add(r_numdlights).add(r_numparticles));
    if (log_stats.value != 0.0f && (log_stats_file != null))
        try {
            log_stats_file.write(r_numentities + "," + r_numdlights + ',' + r_numparticles);
        } catch (IOException e) {
        }
    SCR.AddDirtyPoint(scr_vrect.x, scr_vrect.y);
    SCR.AddDirtyPoint(scr_vrect.x + scr_vrect.width - 1, scr_vrect.y + scr_vrect.height - 1);
    SCR.DrawCrosshair();
}
Also used : Vargs(jake2.util.Vargs) IOException(java.io.IOException)

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