Permalink
Browse files

cgame: factorise smokePuffShaderb shader usage

  • Loading branch information...
Aranud committed Sep 12, 2018
1 parent 7fdab2a commit bfbc09a09dacc89ae51539fbe73ed1ac47b84811
Showing with 9 additions and 30 deletions.
  1. +2 −6 src/cgame/cg_local.h
  2. +5 −5 src/cgame/cg_main.c
  3. +2 −19 src/cgame/cg_particles.c
View
@@ -1430,11 +1430,7 @@ typedef struct
// cannon
qhandle_t smokePuffShaderdirty;
qhandle_t smokePuffShaderb1;
qhandle_t smokePuffShaderb2;
qhandle_t smokePuffShaderb3;
qhandle_t smokePuffShaderb4;
qhandle_t smokePuffShaderb5;
qhandle_t smokePuffShaderb[5];
// blood pool
qhandle_t bloodPool;
@@ -2007,7 +2003,7 @@ typedef enum
#endif
#define SECONDARY_SLOT 0
#define PRIMARY_SLOT 1
#define PRIMARY_SLOT 1
/**
* @struct cgs_s
View
@@ -1621,11 +1621,11 @@ static void CG_RegisterGraphics(void)
// cannon
cgs.media.smokePuffShaderdirty = trap_R_RegisterShader("smokePuffdirty");
cgs.media.smokePuffShaderb1 = trap_R_RegisterShader("smokePuffblack1");
cgs.media.smokePuffShaderb2 = trap_R_RegisterShader("smokePuffblack2");
cgs.media.smokePuffShaderb3 = trap_R_RegisterShader("smokePuffblack3");
cgs.media.smokePuffShaderb4 = trap_R_RegisterShader("smokePuffblack4");
cgs.media.smokePuffShaderb5 = trap_R_RegisterShader("smokePuffblack5");
for (i = 0; i < 5; i++)
{
cgs.media.smokePuffShaderb[i] = trap_R_RegisterShader(va("smokePuffblack%i", i + 1));
}
// bleedanim
for (i = 0; i < 5; i++)
View
@@ -771,7 +771,7 @@ void CG_AddParticleToScene(cparticle_t *p, vec3_t org, float alpha)
{
vec3_t point, rr, ru, rotate_ang;
float width, height;
float time = cg.time - p->time;
float time = cg.time - p->time;
float time2 = p->endtime - p->time;
float ratio = time / time2;
int i, j;
@@ -1330,24 +1330,7 @@ void CG_ParticleSmoke(qhandle_t pshader, centity_t *cent)
p->endheight = cent->currentState.angles2[1];
p->endwidth = cent->currentState.angles2[1];
switch (rand() % 6)
{
case 1:
p->pshader = cgs.media.smokePuffShaderb1;
break;
case 2:
p->pshader = cgs.media.smokePuffShaderb2;
break;
case 3:
p->pshader = cgs.media.smokePuffShaderb3;
break;
case 4:
p->pshader = cgs.media.smokePuffShaderb4;
break;
default:
p->pshader = cgs.media.smokePuffShaderb5;
break;
}
p->pshader = cgs.media.smokePuffShaderb[rand() % 6];
}
p->type = P_SMOKE;

0 comments on commit bfbc09a

Please sign in to comment.