*** empty log message ***

git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@905 e016b1c5-ed68-44aa-a2f7-31cac88cffde
This commit is contained in:
Lee Salzman
2007-04-03 19:30:31 +00:00
parent a14b20ac6b
commit 42488388de
4 changed files with 91 additions and 93 deletions
+16 -70
View File
@@ -365,76 +365,6 @@ void moveplayer(physent *p, int moveres, bool local)
loopi(physicsrepeat) moveplayer(p, moveres, local, min(curtime, minframetime));
}
vector<bounceent *> bounceents;
bounceent *newbounceent()
{
bounceent *p = new bounceent;
bounceents.add(p);
return p;
}
extern void explode_nade(bounceent *i);
void mbounceents()
{
loopv(bounceents) if(bounceents[i])
{
bounceent *p = bounceents[i];
if(p->bouncestate == NADE_THROWED || p->bouncestate == GIB) //moveplayer(p, 2, false);
loopi(physicsrepeat) moveplayer(p, 2, false, min(curtime, minframetime));
if(lastmillis - p->millis >= p->timetolife)
{
if(p->bouncestate==NADE_ACTIVATED || p->bouncestate==NADE_THROWED) explode_nade(bounceents[i]);
delete p;
bounceents.remove(i);
i--;
}
}
}
void clearbounceents()
{
loopv(bounceents) if(bounceents[i]) { delete bounceents[i]; bounceents.remove(i); }
}
VARP(gibnum, 0, 6, 1000);
VARP(gibttl, 0, 5000, 15000);
VARP(gibspeed, 1, 30, 100);
void addgib(playerent *d)
{
if(!d) return;
playsound(S_GIB, &d->o);
loopi(gibnum)
{
bounceent *p = newbounceent();
p->owner = d;
p->millis = lastmillis;
p->timetolife = gibttl+rnd(10)*100;
p->bouncestate = GIB;
p->o = d->o;
p->o.z -= d->aboveeye;
p->yaw = (float)rnd(360);
p->pitch = (float)rnd(360);
p->maxspeed = 30.0f;
p->rotspeed = 3.0f;
const float angle = (float)rnd(360);
const float speed = (float)gibspeed;
p->vel.x = sinf(RAD*angle)*rnd(1000)/1000.0f;
p->vel.y = cosf(RAD*angle)*rnd(1000)/1000.0f;
p->vel.z = rnd(1000)/1000.0f;
p->vel.mul(speed/100.0f);
}
}
// movement input code
#define dir(name,v,d,s,os) void name(bool isdown) { player1->s = isdown; player1->v = isdown ? d : (player1->os ? -(d) : 0); player1->lastmove = lastmillis; }
@@ -496,3 +426,19 @@ void mousemove(int dx, int dy)
}
}
void entinmap(physent *d) // brute force but effective way to find a free spawn spot in the map
{
loopi(100) // try max 100 times
{
float dx = (rnd(21)-10)/10.0f*i; // increasing distance
float dy = (rnd(21)-10)/10.0f*i;
d->o.x += dx;
d->o.y += dy;
if(collide(d, true, 0, 0)) return;
d->o.x -= dx;
d->o.y -= dy;
}
conoutf("can't find entity spawn spot! (%d, %d)", d->o.x, d->o.y);
// leave ent at original pos, possibly stuck
}