mirror of
https://github.com/nzp-team/fteqw.git
synced 2024-11-30 07:31:13 +00:00
b973799d06
inventory system now works a bit better. git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@1761 fc73d0e0-1445-4013-8a0c-d673dee63da5
81 lines
No EOL
1.4 KiB
C++
81 lines
No EOL
1.4 KiB
C++
entity viewentity;
|
|
float viewmodelindex;
|
|
|
|
.float lerptime;
|
|
|
|
void() DoThatViewModelThing =
|
|
{
|
|
float newframe, newmodel;
|
|
|
|
newframe = getstati(STAT_WEAPONFRAME);
|
|
newmodel = getstati(STAT_WEAPONMODEL);
|
|
|
|
if (newmodel != viewmodelindex)
|
|
{ //changed entirly.
|
|
viewmodelindex = newmodel;
|
|
self.frame2 = self.frame = newframe;
|
|
self.lerptime = time;
|
|
}
|
|
else if (newframe != self.frame)
|
|
{
|
|
self.frame2 = self.frame;
|
|
self.frame = newframe;
|
|
self.lerptime = time;
|
|
}
|
|
self.lerpfrac = 1-(time-self.lerptime)*10;
|
|
|
|
if (self.lerpfrac < 0) self.lerpfrac = 0;
|
|
|
|
|
|
self.modelindex = viewmodelindex;
|
|
};
|
|
|
|
void() CSQC_Init =
|
|
{
|
|
viewentity = spawn();
|
|
viewentity.predraw = DoThatViewModelThing;
|
|
viewentity.drawmask = MASK_NORMAL;
|
|
viewentity.renderflags = RF_VIEWMODEL | RF_DEPTHHACK;
|
|
|
|
|
|
FigureOutButtons();
|
|
};
|
|
|
|
|
|
|
|
void(float do2d) CSQC_UpdateView =
|
|
{
|
|
float width,height;
|
|
float usehud;
|
|
width = cvar("vid_conwidth");
|
|
height = cvar("vid_conheight");
|
|
|
|
clearscene();
|
|
|
|
if (0)//!cvar("cg_usehud"))
|
|
{
|
|
setviewprop(VF_DRAWENGINESBAR, 0);
|
|
usehud = true;
|
|
}
|
|
else
|
|
{
|
|
setviewprop(VF_DRAWENGINESBAR, 1);
|
|
}
|
|
|
|
setviewprop(VF_DRAWCROSSHAIR, 1);
|
|
|
|
//force fullscreen views.
|
|
setviewprop(VF_MIN, '0 0 0');
|
|
setviewprop(VF_SIZE_X, width);
|
|
setviewprop(VF_SIZE_Y, height);
|
|
|
|
addentities(MASK_ENGINE | MASK_NORMAL);
|
|
|
|
renderscene();
|
|
|
|
// if (usehud)
|
|
// Hud_Draw();
|
|
|
|
if (show_inventory)
|
|
Invent_Draw();
|
|
}; |