use of jake2.util.Vargs in project narchy by automenta.
the class CL_inv method DrawInventory.
static void DrawInventory() {
int i, j;
int num, selected_num, item;
int[] index = new int[Defines.MAX_ITEMS];
String string;
int x, y;
String binding;
String bind;
int selected;
int top;
selected = Globals.cl.frame.playerstate.stats[Defines.STAT_SELECTED_ITEM];
num = 0;
selected_num = 0;
for (i = 0; i < Defines.MAX_ITEMS; i++) {
if (i == selected)
selected_num = num;
if (Globals.cl.inventory[i] != 0) {
index[num] = i;
num++;
}
}
// determine scroll point
top = selected_num - DISPLAY_ITEMS / 2;
if (num - top < DISPLAY_ITEMS)
top = num - DISPLAY_ITEMS;
if (top < 0)
top = 0;
x = (Globals.viddef.getWidth() - 256) / 2;
y = (Globals.viddef.getHeight() - 240) / 2;
// repaint everything next frame
SCR.DirtyScreen();
Globals.re.DrawPic(x, y + 8, "inventory");
y += 24;
x += 24;
Inv_DrawString(x, y, "hotkey ### item");
Inv_DrawString(x, y + 8, "------ --- ----");
y += 16;
for (i = top; i < num && i < top + DISPLAY_ITEMS; i++) {
item = index[i];
// search for a binding
// Com_sprintf (binding, sizeof(binding), "use %s",
// cl.configstrings[CS_ITEMS+item]);
binding = "use " + Globals.cl.configstrings[Defines.CS_ITEMS + item];
bind = "";
for (j = 0; j < 256; j++) if (Globals.keybindings[j] != null && Globals.keybindings[j].equals(binding)) {
bind = Key.KeynumToString(j);
break;
}
string = Com.sprintf("%6s %3i %s", new Vargs(3).add(bind).add(Globals.cl.inventory[item]).add(Globals.cl.configstrings[Defines.CS_ITEMS + item]));
if (item != selected)
string = getHighBitString(string);
else // draw a blinky cursor by the selected item
{
if ((Globals.cls.realtime * 10 & 1) != 0)
Globals.re.DrawChar(x - 8, y, 15);
}
Inv_DrawString(x, y, string);
y += 8;
}
}
use of jake2.util.Vargs in project narchy by automenta.
the class CL method Disconnect.
/**
* Disconnect
*
* Goes from a connected state to full screen console state Sends a
* disconnect message to the server This is also called on Com_Error, so it
* shouldn't cause any errors.
*/
static void Disconnect() {
String fin;
if (Globals.cls.state == Defines.ca_disconnected)
return;
if (Globals.cl_timedemo != null && Globals.cl_timedemo.value != 0.0f) {
int time;
time = Timer.Milliseconds() - Globals.cl.timedemo_start;
if (time > 0)
Com.Printf("%i frames, %3.1f seconds: %3.1f fps\n", new Vargs(3).add(Globals.cl.timedemo_frames).add(time / 1000.0).add(Globals.cl.timedemo_frames * 1000.0 / time));
}
Math3D.VectorClear(Globals.cl.refdef.blend);
Globals.re.CinematicSetPalette(null);
Menu.ForceMenuOff();
Globals.cls.connect_time = 0;
SCR.StopCinematic();
if (Globals.cls.demorecording)
Stop_f.execute();
// send a disconnect message to the server
fin = (char) Defines.clc_stringcmd + "disconnect";
Netchan.Transmit(Globals.cls.netchan, fin.length(), Lib.stringToBytes(fin));
Netchan.Transmit(Globals.cls.netchan, fin.length(), Lib.stringToBytes(fin));
Netchan.Transmit(Globals.cls.netchan, fin.length(), Lib.stringToBytes(fin));
ClearState();
// stop download
if (Globals.cls.download != null) {
Lib.fclose(Globals.cls.download);
Globals.cls.download = null;
}
Globals.cls.state = Defines.ca_disconnected;
}
use of jake2.util.Vargs in project narchy by automenta.
the class Model method Mod_LoadAliasModel.
/*
==============================================================================
ALIAS MODELS
==============================================================================
*/
/*
=================
Mod_LoadAliasModel
=================
*/
void Mod_LoadAliasModel(model_t mod, ByteBuffer buffer) {
int i;
qfiles.dmdl_t pheader;
qfiles.dstvert_t[] poutst;
qfiles.dtriangle_t[] pouttri;
qfiles.daliasframe_t[] poutframe;
int[] poutcmd;
pheader = new qfiles.dmdl_t(buffer);
if (pheader.version != qfiles.ALIAS_VERSION)
Com.Error(Defines.ERR_DROP, "%s has wrong version number (%i should be %i)", new Vargs(3).add(mod.name).add(pheader.version).add(qfiles.ALIAS_VERSION));
if (pheader.skinheight > MAX_LBM_HEIGHT)
Com.Error(Defines.ERR_DROP, "model " + mod.name + " has a skin taller than " + MAX_LBM_HEIGHT);
if (pheader.num_xyz <= 0)
Com.Error(Defines.ERR_DROP, "model " + mod.name + " has no vertices");
if (pheader.num_xyz > qfiles.MAX_VERTS)
Com.Error(Defines.ERR_DROP, "model " + mod.name + " has too many vertices");
if (pheader.num_st <= 0)
Com.Error(Defines.ERR_DROP, "model " + mod.name + " has no st vertices");
if (pheader.num_tris <= 0)
Com.Error(Defines.ERR_DROP, "model " + mod.name + " has no triangles");
if (pheader.num_frames <= 0)
Com.Error(Defines.ERR_DROP, "model " + mod.name + " has no frames");
//
// load base s and t vertices (not used in gl version)
//
poutst = new qfiles.dstvert_t[pheader.num_st];
buffer.position(pheader.ofs_st);
for (i = 0; i < pheader.num_st; i++) {
poutst[i] = new qfiles.dstvert_t(buffer);
}
//
// load triangle lists
//
pouttri = new qfiles.dtriangle_t[pheader.num_tris];
buffer.position(pheader.ofs_tris);
for (i = 0; i < pheader.num_tris; i++) {
pouttri[i] = new qfiles.dtriangle_t(buffer);
}
//
// load the frames
//
poutframe = new qfiles.daliasframe_t[pheader.num_frames];
buffer.position(pheader.ofs_frames);
for (i = 0; i < pheader.num_frames; i++) {
poutframe[i] = new qfiles.daliasframe_t(buffer);
// verts are all 8 bit, so no swapping needed
poutframe[i].verts = new int[pheader.num_xyz];
for (int k = 0; k < pheader.num_xyz; k++) {
poutframe[i].verts[k] = buffer.getInt();
}
}
mod.type = mod_alias;
//
// load the glcmds
//
poutcmd = new int[pheader.num_glcmds];
buffer.position(pheader.ofs_glcmds);
for (i = 0; i < pheader.num_glcmds; i++) // LittleLong (pincmd[i]);
poutcmd[i] = buffer.getInt();
// register all skins
String[] skinNames = new String[pheader.num_skins];
byte[] nameBuf = new byte[qfiles.MAX_SKINNAME];
buffer.position(pheader.ofs_skins);
for (i = 0; i < pheader.num_skins; i++) {
buffer.get(nameBuf);
skinNames[i] = new String(nameBuf);
int n = skinNames[i].indexOf('\0');
if (n > -1) {
skinNames[i] = skinNames[i].substring(0, n);
}
mod.skins[i] = GL_FindImage(skinNames[i], it_skin);
}
// set the model arrays
// skin names
pheader.skinNames = skinNames;
// textur koordinaten
pheader.stVerts = poutst;
// dreiecke
pheader.triAngles = pouttri;
// STRIP or FAN
pheader.glCmds = poutcmd;
// frames mit vertex array
pheader.aliasFrames = poutframe;
mod.extradata = pheader;
mod.mins[0] = -32;
mod.mins[1] = -32;
mod.mins[2] = -32;
mod.maxs[0] = 32;
mod.maxs[1] = 32;
mod.maxs[2] = 32;
precompileGLCmds(pheader);
}
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;
}
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');
}
Aggregations