make muzzle flashes track the muzzle
git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@1746 e016b1c5-ed68-44aa-a2f7-31cac88cffde
This commit is contained in:
+2
-2
@@ -393,10 +393,10 @@ extern void updatedmgindicator(vec &attack);
|
||||
// renderparticles
|
||||
extern void particleinit();
|
||||
extern void particlereset();
|
||||
extern void particle_flash(int type, float scale, int fade, vec &p);
|
||||
extern void particle_flash(int type, float scale, float angle, vec &p);
|
||||
extern void particle_splash(int type, int num, int fade, vec &p);
|
||||
extern void particle_trail(int type, int fade, vec &from, vec &to);
|
||||
extern void particle_emit(int type, int *args, vec &p);
|
||||
extern void particle_emit(int type, int *args, int basetime, int seed, vec &p);
|
||||
extern void particle_fireball(int type, vec &o);
|
||||
extern void addshotline(dynent *d, vec &from, vec &to);
|
||||
extern bool addbullethole(vec &from, vec &to, float radius = 1, bool noisy = true);
|
||||
|
||||
@@ -475,7 +475,7 @@ void render_particles(int time)
|
||||
}
|
||||
|
||||
if(!time) pp = &p->next;
|
||||
else if(lastmillis-p->millis>p->fade)
|
||||
else if(!p->fade || lastmillis-p->millis>p->fade)
|
||||
{
|
||||
*pp = p->next;
|
||||
p->next = parempty;
|
||||
@@ -542,19 +542,23 @@ void render_particles(int time)
|
||||
}
|
||||
}
|
||||
|
||||
void particle_emit(int type, int *args, vec &p)
|
||||
void particle_emit(int type, int *args, int basetime, int seed, vec &p)
|
||||
{
|
||||
if(type<0 || type>=MAXPARTYPES) return;
|
||||
parttype &pt = parttypes[type];
|
||||
if(pt.type==PT_FIREBALL) particle_fireball(type, p);
|
||||
else if(pt.type==PT_FLASH) particle_flash(type, args[1]>0 ? args[1]/100.0f : 1.0f, args[0], p);
|
||||
else if(pt.type==PT_FLASH)
|
||||
{
|
||||
if(lastmillis - basetime < args[0])
|
||||
particle_flash(type, args[1]>0 ? args[1]/100.0f : 1.0f, seed%360, p);
|
||||
}
|
||||
else particle_splash(type, args[0], args[1], p);
|
||||
}
|
||||
|
||||
void particle_flash(int type, float scale, int fade, vec &p)
|
||||
void particle_flash(int type, float scale, float angle, vec &p)
|
||||
{
|
||||
float angle = rnd(360)*RAD;
|
||||
newparticle(p, vec(cosf(angle), sinf(angle), scale), fade, type);
|
||||
angle *= RAD;
|
||||
newparticle(p, vec(cosf(angle), sinf(angle), scale), 0, type);
|
||||
}
|
||||
|
||||
void particle_splash(int type, int num, int fade, vec &p)
|
||||
|
||||
@@ -190,9 +190,9 @@ struct vertmodel : model
|
||||
|
||||
struct particleemitter
|
||||
{
|
||||
int type, args[2];
|
||||
int type, args[2], seed, lastemit;
|
||||
|
||||
particleemitter() : type(-1)
|
||||
particleemitter() : type(-1), seed(-1), lastemit(-1)
|
||||
{
|
||||
memset(args, 0, sizeof(args));
|
||||
}
|
||||
@@ -418,6 +418,12 @@ struct vertmodel : model
|
||||
|
||||
if(anim&ANIM_PARTICLE && emitters && emitters[i].type>=0)
|
||||
{
|
||||
if(emitters[i].lastemit!=basetime)
|
||||
{
|
||||
emitters[i].seed = rnd(0x1000000);
|
||||
emitters[i].lastemit = basetime;
|
||||
}
|
||||
|
||||
vec tagpos(matrix[12], matrix[13], matrix[14]);
|
||||
GLdouble mm[16];
|
||||
glGetDoublev(GL_MODELVIEW_MATRIX, mm);
|
||||
@@ -426,7 +432,7 @@ struct vertmodel : model
|
||||
extern GLdouble invmm[16];
|
||||
vec worldpos;
|
||||
loopk(3) worldpos[k] = eyepos.x*invmm[0+k] + eyepos.y*invmm[4+k] + eyepos.z*invmm[8+k] + invmm[12+k];
|
||||
particle_emit(emitters[i].type, emitters[i].args, worldpos);
|
||||
particle_emit(emitters[i].type, emitters[i].args, basetime, emitters[i].seed, worldpos);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -628,10 +628,9 @@ void weapon::renderhudmodel(int lastaction, int index)
|
||||
if(!intermission) wm.calcmove(unitv, lastaction);
|
||||
s_sprintfd(path)("weapons/%s", info.modelname);
|
||||
static int lastanim[2], lastswitch[2];
|
||||
bool emit = false;
|
||||
bool emit = (wm.anim&ANIM_INDEX)==ANIM_GUN_SHOOT;
|
||||
if(lastanim[index]!=(wm.anim|(type<<24)))
|
||||
{
|
||||
if((lastanim[index]&ANIM_INDEX)!=ANIM_GUN_SHOOT && (wm.anim&ANIM_INDEX)==ANIM_GUN_SHOOT) emit = true;
|
||||
lastanim[index] = wm.anim|(type<<24);
|
||||
lastswitch[index] = lastmillis;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user