spawn ent render:arrow in editmode
git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@5688 e016b1c5-ed68-44aa-a2f7-31cac88cffde
This commit is contained in:
+48
-1
@@ -118,15 +118,47 @@ void seteditshow(char *just)
|
||||
}
|
||||
COMMAND(seteditshow, ARG_1STR);
|
||||
|
||||
void renderentarrow(const entity &e, const vec &dir, float radius)
|
||||
{
|
||||
if(radius <= 0) return;
|
||||
float arrowsize = min(radius/8, 0.5f);
|
||||
vec epos(e.x, e.y, e.z);
|
||||
vec target = vec(dir).mul(radius).add(epos), arrowbase = vec(dir).mul(radius - arrowsize).add(epos), spoke;
|
||||
spoke.orthogonal(dir);
|
||||
spoke.normalize();
|
||||
spoke.mul(arrowsize);
|
||||
glDisable(GL_TEXTURE_2D); // this disables reaction to light, but also emphasizes shadows .. a nice effect, but should be independent
|
||||
glDisable(GL_CULL_FACE);
|
||||
glLineWidth(3);
|
||||
glBegin(GL_LINES);
|
||||
glVertex3fv(epos.v);
|
||||
glVertex3fv(target.v);
|
||||
glEnd();
|
||||
glBegin(GL_TRIANGLE_FAN);
|
||||
glVertex3fv(target.v);
|
||||
loopi(5)
|
||||
{
|
||||
vec p(spoke);
|
||||
p.rotate(2*M_PI*i/4.0f, dir);
|
||||
p.add(arrowbase);
|
||||
glVertex3fv(p.v);
|
||||
}
|
||||
glEnd();
|
||||
glLineWidth(1);
|
||||
glEnable(GL_CULL_FACE);
|
||||
glEnable(GL_TEXTURE_2D);
|
||||
}
|
||||
|
||||
void renderentities()
|
||||
{
|
||||
int closest = editmode ? closestent() : -1;
|
||||
if(editmode && !reflecting && !refracting && !stenciling)
|
||||
{
|
||||
static int lastsparkle = 0;
|
||||
if(lastmillis - lastsparkle >= 20)
|
||||
{
|
||||
lastsparkle = lastmillis - (lastmillis%20);
|
||||
int closest = closestent();
|
||||
// closest see above
|
||||
loopv(ents)
|
||||
{
|
||||
entity &e = ents[i];
|
||||
@@ -172,6 +204,21 @@ void renderentities()
|
||||
}
|
||||
}
|
||||
}
|
||||
if(editmode && i==closest && !stenciling)//closest see above
|
||||
{
|
||||
switch(e.type)
|
||||
{
|
||||
case PLAYERSTART:
|
||||
{
|
||||
glColor3f(0, 1, 1);
|
||||
vec dir;
|
||||
vecfromyawpitch(e.attr1, 0, -1, 0, dir);
|
||||
renderentarrow(e, dir, 4);
|
||||
glColor3f(1, 1, 1);
|
||||
}
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(m_flags) loopi(2)
|
||||
{
|
||||
|
||||
+31
-1
@@ -783,6 +783,7 @@ VARP(invmouse, 0, 0, 1);
|
||||
FVARP(mouseaccel, 0, 0, 1000);
|
||||
FVARP(mfilter, 0.0f, 0.0f, 6.0f);
|
||||
VARP(autoscopesens, 0, 0, 1);
|
||||
|
||||
float testsens=0;
|
||||
bool senst=0;
|
||||
int tsens(int x)
|
||||
@@ -889,6 +890,7 @@ int tsens(int x)
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void findsens()
|
||||
{
|
||||
if(!watchingdemo) {
|
||||
@@ -901,7 +903,6 @@ void findsens()
|
||||
}
|
||||
COMMAND(findsens,ARG_NONE);
|
||||
|
||||
|
||||
inline bool zooming(playerent *plx) { return (plx->weaponsel->type == GUN_SNIPER && ((sniperrifle *)plx->weaponsel)->scoped); }
|
||||
|
||||
void mousemove(int odx, int ody)
|
||||
@@ -957,3 +958,32 @@ void entinmap(physent *d) // brute force but effective way to find a free spa
|
||||
conoutf(_("can't find entity spawn spot! (%d, %d)"), d->o.x, d->o.y);
|
||||
}
|
||||
|
||||
void vecfromyawpitch(float yaw, float pitch, int move, int strafe, vec &m)
|
||||
{
|
||||
if(move)
|
||||
{
|
||||
m.x = move*-sinf(RAD*yaw);
|
||||
m.y = move*cosf(RAD*yaw);
|
||||
}
|
||||
else m.x = m.y = 0;
|
||||
|
||||
if(pitch)
|
||||
{
|
||||
m.x *= cosf(RAD*pitch);
|
||||
m.y *= cosf(RAD*pitch);
|
||||
m.z = move*sinf(RAD*pitch);
|
||||
}
|
||||
else m.z = 0;
|
||||
|
||||
if(strafe)
|
||||
{
|
||||
m.x += strafe*cosf(RAD*yaw);
|
||||
m.y += strafe*sinf(RAD*yaw);
|
||||
}
|
||||
}
|
||||
|
||||
void vectoyawpitch(const vec &v, float &yaw, float &pitch)
|
||||
{
|
||||
yaw = -atan2(v.x, v.y)/RAD;
|
||||
pitch = asin(v.z/v.magnitude())/RAD;
|
||||
}
|
||||
|
||||
+4
-1
@@ -544,7 +544,8 @@ extern void editequalisexy(bool isfloor, block &sel);
|
||||
extern void edittypexy(int type, block &sel);
|
||||
extern void edittexxy(int type, int t, block &sel);
|
||||
extern void editheightxy(bool isfloor, int amount, block &sel);
|
||||
extern bool noteditmode();
|
||||
//extern bool noteditmode();
|
||||
extern bool noteditmode(const char* func = NULL);
|
||||
extern void pruneundos(int maxremain = 0);
|
||||
|
||||
// renderhud
|
||||
@@ -618,6 +619,8 @@ extern void updatecrouch(playerent *p, bool on);
|
||||
extern bool objcollide(physent *d, const vec &objpos, float objrad, float objheight);
|
||||
extern bool collide(physent *d, bool spawn = false, float drop = 0, float rise = 0, int level = 7);
|
||||
extern void attack(bool on);
|
||||
extern void vecfromyawpitch(float yaw, float pitch, int move, int strafe, vec &m);
|
||||
extern void vectoyawpitch(const vec &v, float &yaw, float &pitch);
|
||||
|
||||
// sound
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user