above head icon blending, voicecom menu
git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@1651 e016b1c5-ed68-44aa-a2f7-31cac88cffde
This commit is contained in:
@@ -317,7 +317,7 @@ void flagdropped(int flag, int action, short x, short y, short z)
|
||||
p.o.y = y;
|
||||
p.o.z = (short)floor(x, y);
|
||||
p.vel.z = -1.0f;
|
||||
loopi(50) moveplayer(&p, 50, true);
|
||||
loopi(50) moveplayer(&p, 50, true); // calc drop position
|
||||
f.flag->x = p.o.x;
|
||||
f.flag->y = p.o.y;
|
||||
f.flag->z = p.o.z;
|
||||
|
||||
@@ -419,7 +419,7 @@ struct mitemcheckbox : mitem
|
||||
|
||||
// console iface
|
||||
|
||||
void *addmenu(const char *name, const char *title, bool allowinput, void (__cdecl *refreshfunc)(void *, bool), bool hotkeys)
|
||||
void *addmenu(const char *name, const char *title, bool allowinput, void (__cdecl *refreshfunc)(void *, bool), bool hotkeys, bool forwardkeys)
|
||||
{
|
||||
name = newstring(name);
|
||||
gmenu &menu = menus[name];
|
||||
@@ -433,13 +433,14 @@ void *addmenu(const char *name, const char *title, bool allowinput, void (__cdec
|
||||
menu.hotkeys = hotkeys;
|
||||
menu.refreshfunc = refreshfunc;
|
||||
menu.dirlist = NULL;
|
||||
menu.forwardkeys = forwardkeys;
|
||||
lastmenu = &menu;
|
||||
return &menu;
|
||||
}
|
||||
|
||||
void newmenu(char *name, char *hotkeys)
|
||||
void newmenu(char *name, char *hotkeys, char *forwardkeys)
|
||||
{
|
||||
addmenu(name, NULL, true, NULL, atoi(hotkeys) > 0);
|
||||
addmenu(name, NULL, true, NULL, atoi(hotkeys) > 0, atoi(forwardkeys) > 0);
|
||||
}
|
||||
|
||||
void menumanual(void *menu, int n, char *text, char *action, color *bgcolor)
|
||||
@@ -520,7 +521,7 @@ void chmenumdl(char *menu, char *mdl, char *anim, char *rotspeed, char *scale)
|
||||
}
|
||||
|
||||
|
||||
COMMAND(newmenu, ARG_2STR);
|
||||
COMMAND(newmenu, ARG_3STR);
|
||||
COMMAND(menumdl, ARG_5STR);
|
||||
COMMAND(menudirlist, ARG_3STR);
|
||||
COMMAND(chmenumdl, ARG_6STR);
|
||||
@@ -586,7 +587,7 @@ bool menukey(int code, bool isdown, int unicode)
|
||||
if(!curmenu->allowinput || !curmenu->items.inrange(menusel)) return false;
|
||||
mitem &m = *curmenu->items[menusel];
|
||||
m.key(code, isdown, unicode);
|
||||
return true;
|
||||
return !curmenu->forwardkeys;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -651,8 +652,8 @@ void gmenu::refresh()
|
||||
void gmenu::open()
|
||||
{
|
||||
inited = false;
|
||||
if(allowinput) player1->stopmoving();
|
||||
else menusel = 0;
|
||||
if(!allowinput) menusel = 0;
|
||||
if(!forwardkeys) player1->stopmoving();
|
||||
if(items.inrange(menusel)) items[menusel]->focus(true);
|
||||
init();
|
||||
}
|
||||
|
||||
+2
-2
@@ -73,7 +73,7 @@ extern bool menuvisible();
|
||||
extern void menumanual(void *menu, int n, char *text, char *action = NULL, color *bgcolor = NULL);
|
||||
extern void menuheader(void *menu, char *header = NULL, char *footer = NULL);
|
||||
extern bool menukey(int code, bool isdown, int unicode);
|
||||
extern void *addmenu(const char *name, const char *title = NULL, bool allowinput = true, void (__cdecl *refreshfunc)(void *, bool) = NULL, bool hotkeys = false);
|
||||
extern void *addmenu(const char *name, const char *title = NULL, bool allowinput = true, void (__cdecl *refreshfunc)(void *, bool) = NULL, bool hotkeys = false, bool forwardkeys = false);
|
||||
extern void rendermenumdl();
|
||||
extern void menuset(void *m);
|
||||
extern void menuselect(void *menu, int sel);
|
||||
@@ -115,7 +115,7 @@ struct gmenu
|
||||
vector<mitem *> items;
|
||||
int mwidth;
|
||||
int menusel;
|
||||
bool allowinput, inited, hotkeys;
|
||||
bool allowinput, inited, hotkeys, forwardkeys;
|
||||
void (__cdecl *refreshfunc)(void *, bool);
|
||||
|
||||
const char *mdl;
|
||||
|
||||
@@ -261,22 +261,23 @@ void blendbox(int x1, int y1, int x2, int y2, bool border, int tex, color *c)
|
||||
}
|
||||
|
||||
VARP(aboveheadiconsize, 0, 50, 1000);
|
||||
VARP(aboveheadiconfadetime, 1, 1000, 10000);
|
||||
VARP(aboveheadiconfadetime, 1, 2000, 10000);
|
||||
|
||||
void renderaboveheadicon(playerent *p)
|
||||
{
|
||||
int t = lastmillis-p->lastvoicecom;
|
||||
if(!aboveheadiconsize || !p->lastvoicecom || t > aboveheadiconfadetime) return;
|
||||
glPushMatrix();
|
||||
glDisable(GL_CULL_FACE);
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
glEnable(GL_BLEND);
|
||||
glTranslatef(p->o.x, p->o.y, p->o.z+p->aboveeye);
|
||||
glRotatef(camera1->yaw-180, 0, 0, 1);
|
||||
glColor3f(1.0f, 1.0f, 1.0f);
|
||||
glColor3f(1.0f, 0.0f, 0.0f);
|
||||
static Texture *tex = NULL;
|
||||
if(!tex) tex = textureload("packages/misc/com.png");
|
||||
float s = aboveheadiconsize/100.0f;
|
||||
quad(tex->id, vec(s/2.0f, 0.0f, s), vec(s/-2.0f, 0.0f, 0.0f), 0.0f, 0.0f, 1.0f, 1.0f);
|
||||
glEnable(GL_CULL_FACE);
|
||||
glDisable(GL_BLEND);
|
||||
glPopMatrix();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user