NX/VITA: Fix Muzzleflash offsets (with help from shpuld)

This commit is contained in:
Ian 2023-09-08 15:27:59 -04:00
parent fb428464cb
commit a47a06b5cb
2 changed files with 39 additions and 42 deletions

View file

@ -541,7 +541,7 @@ void CL_RelinkEntities (void)
AngleVectors (tempangles, v_forward, v_right, v_up); AngleVectors (tempangles, v_forward, v_right, v_up);
VectorCopy (cl_entities[cl.viewentity].origin, smokeorg); VectorCopy (cl_entities[cl.viewentity].origin, smokeorg);
smokeorg[2] += 32; smokeorg[2] += cl.viewheight;
VectorCopy(smokeorg,start); VectorCopy(smokeorg,start);
right_offset = sv_player->v.Flash_Offset[0]; right_offset = sv_player->v.Flash_Offset[0];
@ -551,9 +551,6 @@ void CL_RelinkEntities (void)
right_offset = right_offset/1000; right_offset = right_offset/1000;
up_offset = up_offset/1000; up_offset = up_offset/1000;
forward_offset = forward_offset/1000; forward_offset = forward_offset/1000;
up_offset -= (34 - cl.viewheight);
right_offset -= 4;
VectorMA (start, forward_offset, v_forward ,smokeorg); VectorMA (start, forward_offset, v_forward ,smokeorg);
VectorMA (smokeorg, up_offset, v_up ,smokeorg); VectorMA (smokeorg, up_offset, v_up ,smokeorg);

View file

@ -862,8 +862,7 @@ void AddParticle (part_type_t type, vec3_t org, int count, float size, double ti
case p_muzzleflash3: case p_muzzleflash3:
VectorCopy (org, p->org); VectorCopy (org, p->org);
p->rotspeed = (rand() & 45) - 90; p->rotspeed = (rand() & 45) - 90;
//p->size = size * (rand() % 6) / 4;//r00k p->size = size * (0.75 +((0.05 * (rand() % 20)) * 0.5));//blubs: resultant size range: [size * 0.75, size * 1.25)
p->size = size * (0.85 +((0.05 * (rand() % 16)) * 0.35));//naievil: resultant size range: [size * 0.85, size * 1.1125)
break; break;
case p_flare: case p_flare:
@ -1717,53 +1716,54 @@ inline static void QMB_UpdateParticles(void)
// naievil -- hacky particle drawing...NOT OPTIMIZED // naievil -- hacky particle drawing...NOT OPTIMIZED
void DRAW_PARTICLE_BILLBOARD(particle_texture_t *ptex, particle_t *p, vec3_t *coord) { void DRAW_PARTICLE_BILLBOARD(particle_texture_t *ptex, particle_t *p, vec3_t *coord) {
float scale;
vec3_t up, right, p_downleft, p_upleft, p_downright, p_upright;
GLubyte color[4], *c;
float scale; VectorScale (vup, 1.5, up);
vec3_t up, right, p_up, p_right, p_upright; VectorScale (vright, 1.5, right);
GLubyte color[4], *c;
VectorScale (vup, 1.5, up); glEnable (GL_BLEND);
VectorScale (vright, 1.5, right); glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
glDepthMask (GL_FALSE);
glBegin (GL_QUADS);
glEnable (GL_BLEND); scale = p->size;
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); color[0] = p->color[0];
glDepthMask (GL_FALSE); color[1] = p->color[1];
glBegin (GL_QUADS); color[2] = p->color[2];
color[3] = p->color[3];
glColor4ubv(color);
scale = p->size; float subTexLeft = ptex->coords[p->texindex][0];
color[0] = p->color[0]; float subTexTop = ptex->coords[p->texindex][1];
color[1] = p->color[1]; float subTexRight = ptex->coords[p->texindex][2];
color[2] = p->color[2]; float subTexBottom = ptex->coords[p->texindex][3];
color[3] = p->color[3];
glColor4ubv(color);
float subTexLeft = ptex->coords[p->texindex][0]; glTexCoord2f(subTexLeft, subTexTop);
float subTexTop = ptex->coords[p->texindex][1]; VectorMA(p->org, -scale * 0.5, up, p_downleft);
float subTexRight = ptex->coords[p->texindex][2]; VectorMA(p_downleft, -scale * 0.5, right, p_downleft);
float subTexBottom = ptex->coords[p->texindex][3]; glVertex3fv (p_downleft);
glTexCoord2f(subTexLeft, subTexTop); glTexCoord2f(subTexRight, subTexTop);
glVertex3fv (p->org); VectorMA (p_downleft, scale, up, p_upleft);
glVertex3fv (p_upleft);
glTexCoord2f(subTexRight, subTexTop); glTexCoord2f(subTexRight, subTexBottom);
VectorMA (p->org, scale, up, p_up); VectorMA (p_upleft, scale, right, p_upright);
glVertex3fv (p_up); glVertex3fv (p_upright);
glTexCoord2f(subTexRight, subTexBottom); glTexCoord2f(subTexLeft, subTexBottom);
VectorMA (p_up, scale, right, p_upright); VectorMA (p_downleft, scale, right, p_downright);
glVertex3fv (p_upright); glVertex3fv (p_downright);
glTexCoord2f(subTexLeft, subTexBottom); glEnd ();
VectorMA (p->org, scale, right, p_right);
glVertex3fv (p_right);
glEnd ();
glDepthMask (GL_TRUE); glDepthMask (GL_TRUE);
glDisable (GL_BLEND); glDisable (GL_BLEND);
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE); glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
glColor3f(1,1,1); glColor3f(1,1,1);
} }