mirror of
https://github.com/nzp-team/fteqw.git
synced 2025-02-17 01:11:18 +00:00
qw: fix recording mid-map. q2: add support for recording demos on q2 servers. q: fix setattachment not using the correct orientations. q2: now supports splitscreen, as well as increased model and sound limits. cl: fix crosshair not appearing in splitscreen. cl: splitscreen clients now get their own colour tints (like the bf command) snd: tweak audio to be a bit more usable in splitscreen by default. cl: added con_logcenterprint cvar, for shoving a copy of centerprints onto the console. by default only appears in single player. qc: add checkbuiltin builtin. for all those #0 builtins without their own extension name. gl: fix r_dynamic -1 bug that was painfully visible in AD. mdl: validate per-frame bounds of mdl files (stuff that would crash software renderers). sv: fix -port or +sv_port commandline args to override the port correctly. win: attempt to cope with windows symlinks enumerating with the wrong filesizes. gl: fix skyboxes not appearing properly. gl: fix sprite alpha/edge issue resulting in some invisible sprites in AD. gl: fix screenshot_mega, in combination with r_projection. yay for HUGE panoramic screenshots. q2: fix replacement textures issue. qw: fix download demonum/X issue, both in client and server. qw: fix multicast dimensions not always being honoured properly. nq: fix starting angles sometimes being wrong. menusys: I'm finally uploading my menusys library, plus example mod, which I'll now be providing like csaddon is. git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4997 fc73d0e0-1445-4013-8a0c-d673dee63da5
139 lines
5 KiB
C++
139 lines
5 KiB
C++
/*
|
|
renderscene stuff is always available in csqc.
|
|
If the engine supports DP_QC_RENDER_SCENE then its meant to be available in menuqc too.
|
|
In practise, DP advertises this to menuqc even though it has never officially supported it.
|
|
At the time of writing, FTE's dev builds can do it (and only advertise the extension in builds that try to support it).
|
|
|
|
Note: the basemenu mod does not make use of this in menuqc if only because its vaugely trying to support both engines, and its easier to just use an ifdef.
|
|
|
|
The mitem_spinnymodel item just shows a rotating model centered on the z axis. Simple as that.
|
|
For the sake of fun gimmicks, you can specify frame information with firstframe and framecount.
|
|
Additionally, you can cause it to switch to a different animation when it faces towards the camera with shootframe and shootframes.
|
|
This style of animation shouldn't really be considered very complex, but might help give a small demo of the basic concept of animation.
|
|
*/
|
|
/*
|
|
Note - DP Bugs:
|
|
1: viewport positions are interpreted in physical pixels in DP.
|
|
there is no reliable way to know how many physical pixels there actually are.
|
|
custom viewports are thus near unusable.
|
|
2: failure to revert the viewport to default afterwards fucks over any 2d stuff drawn afterwards.
|
|
including the console.
|
|
3: bloom on worldless models draws the world.
|
|
4: lighting is applied on models even if there's no world.
|
|
enabling rtlights really fucks everything up.
|
|
5: gamma/contrast/brightness are applied to the 3d view. even if there's no world.
|
|
this results in horrible squares if these settings are used.
|
|
6: DP_QC_RENDER_SCENE is advertised in menuqc, but renderscene is not supported there at all.
|
|
7: avoid the use of cltime. DP doesn't support it.
|
|
|
|
probably others. it really wouldn't surprise me.
|
|
*/
|
|
|
|
//helper function to work around a DP bug.
|
|
static vector(vector v) vtodpp =
|
|
{
|
|
//so fucking disgustingly ugly.
|
|
if (dp_workarounds)
|
|
{
|
|
v_x *= cvar("vid_width") / cvar("vid_conwidth");
|
|
v_y *= cvar("vid_height") / cvar("vid_conheight");
|
|
}
|
|
return v;
|
|
};
|
|
//make sure the fields are all defined if we're in menuqc or something
|
|
.vector origin;
|
|
.vector angles;
|
|
.vector mins;
|
|
.vector maxs;
|
|
.string model;
|
|
.float frame, frame2, lerpfrac, renderflags;
|
|
float frametime;
|
|
class mitem_spinnymodel : mitem
|
|
{
|
|
float zbias;
|
|
float firstframe;
|
|
float framecount;
|
|
float shootframe;
|
|
float shootframes;
|
|
|
|
//might as well use the class as the entity that is drawn.
|
|
//it might end up clobbering any fields used for multiple things...
|
|
virtual void(vector pos) item_draw =
|
|
{
|
|
vector orgbias;
|
|
orgbias = '0 0 0';
|
|
if (dp_workarounds)
|
|
orgbias = (vector)getviewprop(VF_ORIGIN); //DP still lights the entity even if the world isn't drawn. this results in inconsistant/buggy light levels. there's nothing we can do about that other than stopping it from being completely black.
|
|
origin = orgbias;
|
|
origin_z += zbias;
|
|
|
|
// angles_y = cltime*90;//frametime*90;
|
|
angles_y += frametime*90;
|
|
|
|
clearscene(); //wipe the scene, and apply the default rendering values.
|
|
setviewprop(VF_MIN, vtodpp(pos)); //min pos
|
|
setviewprop(VF_SIZE, vtodpp(item_size)); //size=maxpos-minpos
|
|
if (dp_workarounds)
|
|
setviewprop(VF_FOV, [25, atan(item_size_y/(item_size_x/tan(25/360*6.28))) * 360/6.28]); //set an explicit fov. this thing had better be square. DP doesn't support VF_AFOV
|
|
else
|
|
setviewprop(VF_AFOV, 25); //set the aproximate fov (ie: engine takes care of aspect ratio).
|
|
#ifdef CSQC
|
|
setproperty(VF_DRAWENGINESBAR, FALSE);
|
|
setproperty(VF_DRAWWORLD, FALSE);
|
|
setproperty(VF_DRAWCROSSHAIR, FALSE);
|
|
#endif
|
|
setviewprop(VF_ORIGIN, orgbias + '-128 0 0'); //look towards it.
|
|
setviewprop(VF_ANGLES, '0 0 0');
|
|
|
|
//animate it a bit
|
|
lerpfrac -= frametime*10;
|
|
while(lerpfrac < 0)
|
|
{
|
|
lerpfrac += 1;
|
|
frame2 = frame;
|
|
frame += 1;
|
|
if (angles_y >= 170 && shootframes)
|
|
{
|
|
if (frame == shootframe+shootframes)
|
|
{ //reached the last frame. clear the shooting 'flag' and go back to idle
|
|
frame = firstframe;
|
|
angles_y -= 360;
|
|
}
|
|
else if (frame < shootframe || frame >= shootframe+shootframes)
|
|
frame = shootframe; //we were still idle, apparently.
|
|
}
|
|
else
|
|
{
|
|
if (frame < firstframe || frame >= firstframe+framecount)
|
|
frame = firstframe;
|
|
}
|
|
}
|
|
|
|
addentity(this);
|
|
renderscene();
|
|
if (dp_workarounds)
|
|
{ //dp fucks up 2d stuff if we don't explicitly restore the 3d view to fullscreen
|
|
setviewprop(VF_MIN, vtodpp('0 0 0'));
|
|
setviewprop(VF_SIZE, vtodpp(ui.screensize));
|
|
}
|
|
};
|
|
|
|
virtual void(vector pos) dp_draw =
|
|
{
|
|
};
|
|
|
|
void() mitem_spinnymodel =
|
|
{
|
|
#ifdef MENU
|
|
if (!checkextension("DP_QC_RENDER_SCENE") || dp_workarounds)
|
|
{
|
|
item_draw = dp_draw;
|
|
return;
|
|
}
|
|
#endif
|
|
precache_model(item_text);
|
|
setmodel(this, item_text); //use the size information from the engine, woo for unreliability.
|
|
zbias += (mins_z - maxs_z)/2 - mins_z; //center the model on its z axis, so the whole thing is visible.
|
|
frame = firstframe;
|
|
};
|
|
};
|