*** empty log message ***

git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@854 e016b1c5-ed68-44aa-a2f7-31cac88cffde
This commit is contained in:
Lee Salzman
2007-03-23 08:02:23 +00:00
parent e52950d5a7
commit 5d70da1e55
3 changed files with 38 additions and 0 deletions
+1
View File
@@ -38,6 +38,7 @@ void renderclient(playerent *d, char *mdlname, char *vwepname)
{ anim = ANIM_ATTACK; speed = 300.0f/8; basetime = d->lastaction; }
else if(!d->move && !d->strafe) { anim = ANIM_IDLE|ANIM_LOOP; }
else { anim = ANIM_RUN|ANIM_LOOP; speed = 1860/d->maxspeed; };
if(d->state==CS_ALIVE) rendershadow(d);
rendermodel(mdlname, anim, 0, 1.5f, d->o.x, mz, d->o.y, d->yaw+90, d->pitch/4, speed, basetime, d, vwepname);
};
+1
View File
@@ -244,6 +244,7 @@ extern void cleansound();
extern void music(char *name);
// rendermodel
extern void rendershadow(playerent *d);
extern void rendermodel(char *mdl, int anim, int tex, float rad, float x, float y, float z, float yaw, float pitch, float speed, int basetime = 0, playerent *d = NULL, char *vwepmdl = NULL, float scale = 1.0f);
extern mapmodelinfo &getmminfo(int i);
extern int findanim(const char *name);
+36
View File
@@ -121,6 +121,42 @@ void rendermodel(char *mdl, int anim, int tex, float rad, float x, float y, floa
if(anim&ANIM_MIRROR) glCullFace(GL_FRONT);
};
VAR(dynshadow, 0, 40, 100);
void rendershadow(playerent *d)
{
if(OUTBORD((int)d->o.x, (int)d->o.y)) return;
sqr *s = S((int)d->o.x, (int)d->o.y);
float floor = s->floor;
if(s->type==FHF) floor -= s->vdelta/4.0f;
float radius = 1.25f*d->radius;
radius *= 1.0f + min(1.0f, max(0.0f, 0.5f*(d->o.z - d->eyeheight - floor)/(d->aboveeye + d->eyeheight)));
static Texture *shadowtex = NULL;
if(!shadowtex) shadowtex = textureload("packages/misc/shadow.png", 3);
glColor4f(1, 1, 1, dynshadow/100.0f);
glBindTexture(GL_TEXTURE_2D, shadowtex->id);
glDepthMask(GL_FALSE);
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
floor += 0.1f;
glBegin(GL_POLYGON);
glTexCoord2f(0, 0); glVertex3f(d->o.x-radius, floor, d->o.y-radius);
glTexCoord2f(1, 0); glVertex3f(d->o.x+radius, floor, d->o.y-radius);
glTexCoord2f(1, 1); glVertex3f(d->o.x+radius, floor, d->o.y+radius);
glTexCoord2f(0, 1); glVertex3f(d->o.x-radius, floor, d->o.y+radius);
glEnd();
glDepthMask(GL_TRUE);
glDisable(GL_BLEND);
};
int findanim(const char *name)
{
const char *names[] = { "idle", "run", "attack", "pain", "jump", "land", "flipoff", "salute", "taunt", "wave", "point", "crouch idle", "crouch walk", "crouch attack", "crouch pain", "crouch death", "death", "lying dead", "flag", "gun idle", "gun shoot", "gun reload", "gun throw", "mapmodel", "trigger", "all" };