add edit info panel
updateeditinfopanel is a cubescript hook to provide additional information
about the current edit situation, like, for example, the closest entity.
The returned text is rendered on the right side of the screen.
Default for updateeditinfopanel is explainclosestentity which provides
detailed info about the closest entity.
editinfopanelmillis <n>
update the edit info panel every n milliseconds
hideeditinfopanel 0|1
render (0) or hide (1) the edit info panel
DOCREF updateeditinfopanel editinfopanelmillis hideeditinfopanel
This commit is contained in:
@@ -1171,6 +1171,7 @@ menuitemslider "Grid/Selection style: " 0 1 "$oldselstyle" 1 [triangles "squa
|
||||
menuitemcheckbox "Show mapmodel clippings: " "$showmodelclipping" [ showmodelclipping $arg1 ]
|
||||
menuitemcheckbox "Show ladder entities: " "$showladderentities" [ showladderentities $arg1 ]
|
||||
menuitemcheckbox "Show all playerstarts (spawn points): " "$showplayerstarts" [ showplayerstarts $arg1 ]
|
||||
menuitemcheckbox "Show edit info panel: " "(! $hideeditinfopanel)" [ hideeditinfopanel (! $arg1) ]
|
||||
menuitemslider "Fly speeds multiplier: " 1 5 "$flyspeed" 1 [] [ flyspeed $arg1 ]
|
||||
// opt/autosave.cfg may add some entries
|
||||
|
||||
|
||||
@@ -593,6 +593,7 @@ menuinit [
|
||||
onCallVote "when a vote was called"
|
||||
onVoteEnd "after voting ended"
|
||||
onChangeVote "when a vote is changed"
|
||||
updateeditinfopanel "during editing"
|
||||
] [ cmd desc ] [
|
||||
menuitem (concatword "\fs\f2" $cmd ":\fr gets executed " $desc) (concat editalias $cmd) "" (if (checkalias $cmd) [ concatword "\fs\f4current: \fr" $$cmd ])
|
||||
]
|
||||
|
||||
@@ -429,6 +429,32 @@ const shrinkselection [
|
||||
] [ result 0 ]
|
||||
]
|
||||
|
||||
alias updateeditinfopanel explainclosestentity // default hook
|
||||
|
||||
const __entexp_light [ at [ "radius: %1\nintensity: %2\n\n\f4(white light)" "radius: %1\nr: %2\ng: %3\nb: %4\n\n\f4(colored light)" ] (|| (getentattr 2 1) (getentattr 3 1)) ]
|
||||
const __entexp_playerstart [ result "angle: %1\nteam: %2" ]
|
||||
const __entexp_pistol [ result "elevation: %1" ]
|
||||
const __entexp_ammobox __entexp_pistol
|
||||
const __entexp_grenades __entexp_pistol
|
||||
const __entexp_health __entexp_pistol
|
||||
const __entexp_helmet __entexp_pistol
|
||||
const __entexp_armour __entexp_pistol
|
||||
const __entexp_akimbo __entexp_pistol
|
||||
const __entexp_mapmodel [ concatword "angle: %1\nconfig slot: #%2\n\elevation: %3\ntexture: %4\npitch: %5\nroll: %6\n\n\fs\f1slot #%2 info:\n" (format2 "\f9%5\fr\nclip radius: %1\nclip height: %2\nelevation: %3 scale: %4" (editmapmodelslot (getentattr 1)))]
|
||||
const __entexp_trigger [ result "tag: %1\ntype: %2" ]
|
||||
const __entexp_ladder [ result "height: %1" ]
|
||||
const __entexp_ctf-flag [ result "angle: %1\nteam: %2" ]
|
||||
const __entexp_sound [ concatword "config slot: #%1\nradius: %2\nsize: %3\nvolume: %4\n\n\fs\f1slot #%1 info:\n" (format2 "\f9%1\fr\nmaxuses: %2" (editmapsoundslot (getentattr 0)))]
|
||||
const __entexp_clip [ result "elevation: %1\nx-radius: %2\ny-radius: %3\nheight: %4\nslope: %6\nshape: %7" ]
|
||||
const __entexp_plclip __entexp_clip
|
||||
const __entexp_dummy [ result "n/a" ]
|
||||
|
||||
const explainclosestentity [
|
||||
if (>= (getclosestent) 0) [
|
||||
concatword "\fs\f1" (getenttype) "\fr entity:\n\n" (format2 ((concatword __entexp_ (getenttype))) (format2 "%5 %6 %7 %8 %9 %010 %011" (editentity (getclosestent))))
|
||||
]
|
||||
]
|
||||
|
||||
// megabind - Binds a key to many different actions depending on the current game state.
|
||||
const megabind [ if (> $numargs 5) [ bind $arg1 (format "if (watchingdemo) [ %1 ] [ if (|| $editing (= $gamemode 1)) [ %2 ] [ if $connected [ %3 ] [ if (curmodeattr bot) [ %4 ] [ %5 ] ] ] ]" $arg2 $arg3 $arg4 $arg5 $arg6) ] ]
|
||||
|
||||
|
||||
+2
-2
@@ -1338,7 +1338,7 @@ int main(int argc, char **argv)
|
||||
computeraytable(camera1->o.x, camera1->o.y, dynfov());
|
||||
if(frames>3 && !minimized)
|
||||
{
|
||||
gl_drawframe(screen->w, screen->h, fps<lowfps ? fps/lowfps : (fps>highfps ? fps/highfps : 1.0f), fps);
|
||||
gl_drawframe(screen->w, screen->h, fps<lowfps ? fps/lowfps : (fps>highfps ? fps/highfps : 1.0f), fps, elapsed);
|
||||
if(frames>4) SDL_GL_SwapBuffers();
|
||||
}
|
||||
|
||||
@@ -1349,7 +1349,7 @@ int main(int argc, char **argv)
|
||||
// in the screenshot regardless of which frame buffer is current
|
||||
if (!minimized)
|
||||
{
|
||||
gl_drawframe(screen->w, screen->h, fps<lowfps ? fps/lowfps : (fps>highfps ? fps/highfps : 1.0f), fps);
|
||||
gl_drawframe(screen->w, screen->h, fps<lowfps ? fps/lowfps : (fps>highfps ? fps/highfps : 1.0f), fps, elapsed);
|
||||
}
|
||||
addsleep(0, "screenshot");
|
||||
needsautoscreenshot = false;
|
||||
|
||||
@@ -1316,6 +1316,7 @@ bool rendermenumdl()
|
||||
rendermodel(isplayermodel ? "playermodels" : m.mdl, m.anim|ANIM_DYNALLOC, tex, -1, pos, 0, yaw, pitch, 0, 0, NULL, a, m.scale ? m.scale/25.0f : 1.0f);
|
||||
|
||||
glPopMatrix();
|
||||
dimeditinfopanel = 0;
|
||||
return !(isplayermodel || isweapon);
|
||||
}
|
||||
|
||||
|
||||
+3
-2
@@ -392,7 +392,7 @@ extern void circle(GLuint tex, float x, float y, float r, float tx, float ty, fl
|
||||
extern void framedquadtexture(GLuint tex, int x, int y, int xs, int ys, int border = 0, int backlight = 255, bool blend = false);
|
||||
extern void setperspective(float fovy, float aspect, float nearplane, float farplane);
|
||||
extern void sethudgunperspective(bool on);
|
||||
extern void gl_drawframe(int w, int h, float changelod, float curfps);
|
||||
extern void gl_drawframe(int w, int h, float changelod, float curfps, int elapsed);
|
||||
extern void clearminimap();
|
||||
extern void resetzones();
|
||||
extern void rendercursor(int x, int y, int w);
|
||||
@@ -775,8 +775,9 @@ enum
|
||||
HUDMSG_TYPE = 0xFF,
|
||||
HUDMSG_OVERWRITE = 1<<8
|
||||
};
|
||||
extern int dimeditinfopanel;
|
||||
extern void damageblend(int n, void *p);
|
||||
extern void gl_drawhud(int w, int h, int curfps, int nquads, int curvert, bool underwater);
|
||||
extern void gl_drawhud(int w, int h, int curfps, int nquads, int curvert, bool underwater, int elapsed);
|
||||
extern void loadingscreen(const char *fmt = NULL, ...) PRINTFARGS(1, 2);
|
||||
extern void hudoutf(const char *s, ...) PRINTFARGS(1, 2);
|
||||
extern void hudonlyf(const char *s, ...) PRINTFARGS(1, 2);
|
||||
|
||||
@@ -404,6 +404,7 @@ void framedquadtexture(GLuint tex, int x, int y, int xs, int ys, int border, int
|
||||
glTexCoord2f(1, 1); glVertex2f(x + xs, y + ys);
|
||||
glEnd();
|
||||
xtraverts += 4;
|
||||
dimeditinfopanel = 99;
|
||||
if(!blend) glEnable(GL_BLEND);
|
||||
}
|
||||
|
||||
@@ -1012,7 +1013,7 @@ VARP(ignoreoverride_nostencilshadows, 0, 0, 1);
|
||||
|
||||
int effective_stencilshadow = 0;
|
||||
|
||||
void gl_drawframe(int w, int h, float changelod, float curfps)
|
||||
void gl_drawframe(int w, int h, float changelod, float curfps, int elapsed)
|
||||
{
|
||||
extern int mapoverride_nostencilshadows, mapoverride_nowaterreflect;
|
||||
effective_stencilshadow = mapoverride_nostencilshadows && !ignoreoverride_nostencilshadows ? 0 : stencilshadow;
|
||||
@@ -1155,7 +1156,7 @@ void gl_drawframe(int w, int h, float changelod, float curfps)
|
||||
tagclipcubes.setsize(0);
|
||||
|
||||
extern vector<vertex> verts;
|
||||
gl_drawhud(w, h, int(curfps + 0.5f), nquads, verts.length(), underwater);
|
||||
gl_drawhud(w, h, int(curfps + 0.5f), nquads, verts.length(), underwater, elapsed);
|
||||
|
||||
glEnable(GL_CULL_FACE);
|
||||
glEnable(GL_FOG);
|
||||
|
||||
@@ -83,12 +83,14 @@ VARP(hideradar, 0, 0, 1);
|
||||
VARP(hidecompass, 0, 0, 1);
|
||||
VARP(hideteam, 0, 0, 1);
|
||||
VARP(hideteamscorehud, 0, 0, 1);
|
||||
VARP(hideeditinfopanel, 0, 0, 1);
|
||||
VARP(hidevote, 0, 0, 2);
|
||||
VARP(hidehudmsgs, 0, 0, 1);
|
||||
VARP(hidehudequipment, 0, 0, 1);
|
||||
VARP(hideconsole, 0, 0, 1);
|
||||
VARP(hidespecthud, 0, 0, 1);
|
||||
VAR(showmap, 0, 0, 1);
|
||||
VARP(editinfopanelmillis, 5, 80, 2000);
|
||||
|
||||
void drawscope(bool preload)
|
||||
{
|
||||
@@ -769,10 +771,12 @@ VARP(showtargetname,0,1,1);
|
||||
VARP(showspeed, 0, 0, 1);
|
||||
VAR(blankouthud, 0, 0, 10000); //for "clean" screenshot
|
||||
string gtime;
|
||||
int dimeditinfopanel = 255;
|
||||
|
||||
void gl_drawhud(int w, int h, int curfps, int nquads, int curvert, bool underwater)
|
||||
void gl_drawhud(int w, int h, int curfps, int nquads, int curvert, bool underwater, int elapsed)
|
||||
{
|
||||
if(blankouthud > 0) { blankouthud--; return; }
|
||||
if(blankouthud > 0) { blankouthud -= elapsed; return; }
|
||||
else blankouthud = 0;
|
||||
playerent *p = camera1->type<ENT_CAMERA ? (playerent *)camera1 : player1;
|
||||
bool spectating = player1->isspectating();
|
||||
|
||||
@@ -911,6 +915,27 @@ void gl_drawhud(int w, int h, int curfps, int nquads, int curvert, bool underwat
|
||||
}
|
||||
else if(wallclock) draw_text(ltime, VIRTW*2 - text_width(ltime) - FONTH, VIRTH*2 - 3*FONTH/2);
|
||||
|
||||
if(editmode && !hideeditinfopanel)
|
||||
{
|
||||
static int lasteditip = 0;
|
||||
static char *editip = NULL;
|
||||
if(!lasteditip || totalmillis - lasteditip > editinfopanelmillis)
|
||||
{ // update edit info panel
|
||||
lasteditip = totalmillis;
|
||||
const char *editipfunc = getalias("updateeditinfopanel");
|
||||
DELSTRING(editip);
|
||||
editip = executeret(editipfunc);
|
||||
}
|
||||
if(editip && dimeditinfopanel)
|
||||
{
|
||||
int w, h;
|
||||
text_bounds(editip, w, h, -1);
|
||||
draw_text(editip, VIRTW*2 - w - FONTH, VIRTH*13/8 - h, 255, 255, 255, dimeditinfopanel);
|
||||
}
|
||||
dimeditinfopanel += elapsed;
|
||||
if(dimeditinfopanel > 255) dimeditinfopanel = 255;
|
||||
}
|
||||
|
||||
if(!intermission && lastgametimeupdate!=0)
|
||||
{
|
||||
int cssec = (gametimecurrent+(lastmillis-lastgametimeupdate))/1000;
|
||||
|
||||
Reference in New Issue
Block a user