entarrowstyle

This commit is contained in:
flowtron
2022-04-06 17:48:53 +02:00
parent 083f47bafe
commit 74a1a98ca9
3 changed files with 89 additions and 21 deletions
+4
View File
@@ -752,6 +752,10 @@ docargument [S] [Scale] [min 0.1/max 1/default 1];
docident [screenshottype] [Toggle format of screenshot image. Your choice is for BMP (0), JPEG (1) or PNG (2).];
docargument [T] [0=BMP, 1=JPEG, 2=PNG] [min 0/max 2/default 1];
docref [getscrext];
docident [entarrowstyle] [Which way the arrow is drawn for playerstarts and vantage points.];
docargument [S] [0=cone, 1=multihead] [min 0/max 1/default 1];
docremark [The cone style draws 4 triangles approximating the cone of the arrowhead.];
docremark [The multihead style draws 4 triangles rotated around the shaft, two of which are coloured slightly differently.];
docident [securemap] [Adds a map to the list of secured maps.];
docargument [S] [the name of the map] [] [0];
docremark [Secured maps can not be overwritten by the commands sendmap and getmap.];
+14 -5
View File
@@ -3985,10 +3985,10 @@ name="AssaultCube Documentation" version="Current" xsi:schemaLocation="xml/cuber
<description>Sets the behavior of weapon switching upon akimbo expiration.</description>
<value token="N" description="akimbo end action" minValue="0" maxValue="3" defaultValue="3"/>
<arguments>
<argument description="switch to knife" valueNotes="0"/>
<argument description="stay with pistol" valueNotes="1"/>
<argument description="switch to grenades" valueNotes="2"/>
<argument description="switch to primary" valueNotes="3"/>
<argument token="N" description="switch to knife" valueNotes="0"/>
<argument token="N" description="stay with pistol" valueNotes="1"/>
<argument token="N" description="switch to grenades" valueNotes="2"/>
<argument token="N" description="switch to primary" valueNotes="3"/>
</arguments>
<remarks>
<remark>If no ammunition is detected for the target weapon, it will fallback to the previous weapon until it finds a weapon with ammunition to use.</remark>
@@ -7137,7 +7137,7 @@ name="AssaultCube Documentation" version="Current" xsi:schemaLocation="xml/cuber
<variable name="pointatentmaxangle">
<description>Specifies the required precision for pointing at entities sparklies.</description>
<value token="N" description="0: not changed, 1: changed" minValue="0.01" maxValue="180.0" defaultValue="2.0" valueNotes="float"/>
<value token="N" description="float" minValue="0.01" maxValue="180.0" defaultValue="2.0"/>
<references>
<identifierReference identifier="pointatent"/>
</references>
@@ -7147,6 +7147,15 @@ name="AssaultCube Documentation" version="Current" xsi:schemaLocation="xml/cuber
<description>Integer variable containing a bitmask of hidden entity types.</description>
</variable>
<variable name="entarrowstyle">
<description>Which way the arrow is drawn for playerstarts and vantage points.</description>
<value token="S" description="style" minValue="0" maxValue="1" defaultValue="1" valueNotes="0: cone, 1: multihead"/>
<remarks>
<remark>The cone style draws 4 triangles approximating the cone of the arrowhead.</remark>
<remark>The multihead style draws 4 triangles rotated around the shaft, two of which are coloured slightly differently.</remark>
</remarks>
</variable>
<command name="getdeletedentities">
<description>Returns a list of deleted entities.</description>
<remarks>
+71 -16
View File
@@ -12,14 +12,14 @@ void toucheditingsettings(bool forcerestart){
{
if(keepshowingeditingsettingsfrom == 0 || forcerestart)
{
keepshowingeditingsettingsfrom = lastmillis;
keepshowingeditingsettingsfrom = lastmillis;
keepshowingeditingsettingstill = lastmillis + editingsettingsvisibletime;
}
else
{
int deltat_a = keepshowingeditingsettingstill - lastmillis;
int deltat_b = lastmillis - keepshowingeditingsettingsfrom;
int showfrac = editingsettingsvisibletime / 5;
int showfrac = editingsettingsvisibletime / 5;
if( deltat_b >= showfrac )// we ignore quick-changes inside the slide-in period
{
if( deltat_a <= showfrac )// changes in the slide-out period take that slide back and stay for almost the entire visibletime longer
@@ -30,7 +30,7 @@ void toucheditingsettings(bool forcerestart){
{
keepshowingeditingsettingsfrom = lastmillis - showfrac;
}
keepshowingeditingsettingstill = keepshowingeditingsettingsfrom + editingsettingsvisibletime;
keepshowingeditingsettingstill = keepshowingeditingsettingsfrom + editingsettingsvisibletime;
}
}
}
@@ -112,15 +112,20 @@ void rendermapmodels()
}
}
void renderentarrow(const entity &e, const vec &dir, float radius)
VARP(entarrowstyle,0,1,1);
void renderentarrow(const entity &e, const vec &dir, float radius, GLfloat color[4])
{
if(cleanedit || radius <= 0) return;
glColor4f(color[0],color[1],color[2],color[3]);
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;
vec spoke;
spoke.orthogonal(dir);
spoke.normalize();
spoke.mul(arrowsize);
spoke.mul(3*arrowsize/4);
arrowsize += arrowsize/2.0f;
vec epos(e.x, e.y, e.z);
vec target = vec(dir).mul(radius).add(epos), arrowbase = vec(dir).mul(radius - arrowsize).add(epos);
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);
@@ -128,21 +133,58 @@ void renderentarrow(const entity &e, const vec &dir, float radius)
glVertex3fv(epos.v);
glVertex3fv(target.v);
glEnd();
glBegin(GL_TRIANGLE_FAN);
glVertex3fv(target.v);
loopi(5)
switch(entarrowstyle)
{
vec p(spoke);
p.rotate(PI2 * i / 4.0f, dir);
p.add(arrowbase);
glVertex3fv(p.v);
case 0: // 4seg cone at tip
glBegin(GL_TRIANGLE_FAN);
glVertex3fv(target.v);
loopi(5)
{
vec p(spoke);
p.rotate(PI2 * i / 4.0f, dir);
p.add(arrowbase);
glVertex3fv(p.v);
}
glEnd();
break;
case 1: // 4 rotated & tinted tips
float rothead[] = {0,PI/2,PI/4,3*PI/4};
glBegin(GL_TRIANGLES);
loopi(4)
{
glVertex3fv(target.v);
vec p1(spoke);
vec p2(spoke.mul(-1));
if(i>0)
{
p1.rotate(rothead[i],dir);
p2.rotate(rothead[i],dir);
}
if(i==2)
{
float csf = (((color[1]+color[2]+color[3])/3.0f)>0.5f)?.75f:1.25f;
glColor4f( csf*color[0], csf*color[1], csf*color[2], color[3]>0.5f?(color[3]/2.0f):(color[3]*2.0f) );
}
p1.add(arrowbase);
glVertex3fv(p1.v);
p2.add(arrowbase);
glVertex3fv(p2.v);
}
glEnd();
break;
default: break;
}
glEnd();
glLineWidth(1);
glEnable(GL_CULL_FACE);
glEnable(GL_TEXTURE_2D);
}
void renderentarrow(const entity &e, const vec &dir, float radius)
{
GLfloat color[4] = {0,1.0f,1.0f,1.0f}; // usual call from rendereditentites:PLAYERSTART
renderentarrow(e,dir,radius,color);
}
void rendereditentities()
{
if(!editmode || cleanedit) return;
@@ -232,13 +274,26 @@ void rendereditentities()
}
if(i == closest)
{
glColor3f(0, 1, 1);
//glColor3f(0, 1, 1);//default for 3arg renderentarrow now
vec dir(0, -1, 0);
dir.rotate_around_z(float(e.attr1) / ENTSCALE10 * RAD);
renderentarrow(e, dir, 4);
glColor3f(1, 1, 1);
}
break;
case DUMMYENT: // sparkly will be golden unless closestent
// why is VANTAGEPOINT stored in header instead of as an entity type? too easy? would come with multiples, viewing and editing instead of .. this:
if(e.attr2==VANTAGEDUMMY2){ // attr2 used as dummyent type indicator
int worldyaw = iabs(e.attr1+180) % 360;
vec dir( -sinf(RAD*worldyaw), cosf(RAD*worldyaw), sinf(RAD*e.attr5));
float cos4pitch = cosf(RAD*e.attr5);
dir.x *= cos4pitch;
dir.y *= cos4pitch;
GLfloat color[4] = {0.5f,0.5f,0.5f,1.0f};
renderentarrow(e, dir, 4, color);
glColor3f(1, 1, 1);
}
break;
}
}
}