summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaweł Redman <pawel.redman@gmail.com>2020-03-31 13:36:55 +0200
committerPaweł Redman <pawel.redman@gmail.com>2020-03-31 13:36:55 +0200
commit023ee0eb8bcff377a7abc8333892ea6141ddd6f5 (patch)
tree3231658c65a3d29c846cb909f959c0ada15213e8
parent1db3e2ee25ff7b4240f12211473af86af9b017f5 (diff)
Shit up all the shaders
-rw-r--r--src/cgame/cg_buildable.c4
-rw-r--r--src/cgame/cg_local.h4
-rw-r--r--src/cgame/cg_main.c89
-rw-r--r--src/cgame/cg_players.c6
-rw-r--r--src/cgame/cg_weapons.c3
5 files changed, 105 insertions, 1 deletions
diff --git a/src/cgame/cg_buildable.c b/src/cgame/cg_buildable.c
index 40736e6..1323f5c 100644
--- a/src/cgame/cg_buildable.c
+++ b/src/cgame/cg_buildable.c
@@ -1271,6 +1271,10 @@ void CG_Buildable( centity_t *cent )
trap_S_AddLoopingSound( es->number, cent->lerpOrigin, vec3_origin, prebuildSound );
}
+ else
+ {
+ ent.customShader = CG_RollAShitShader( es->number );
+ }
CG_BuildableAnimation( cent, &ent.oldframe, &ent.frame, &ent.backlerp );
diff --git a/src/cgame/cg_local.h b/src/cgame/cg_local.h
index 1a71e3b..bf01866 100644
--- a/src/cgame/cg_local.h
+++ b/src/cgame/cg_local.h
@@ -1143,6 +1143,7 @@ typedef struct
} cg_t;
#define NUM_COUGHING_SOUNDS 5
+#define NUM_SHIT_SHADERS 68
// all of the model, shader, and sound references that are
// loaded at gamestate time are stored in cgMedia_t
@@ -1276,6 +1277,7 @@ typedef struct
qhandle_t upgradeClassIconShader;
sfxHandle_t coughingSounds[ NUM_COUGHING_SOUNDS ];
+ qhandle_t shitShaders[ NUM_SHIT_SHADERS ];
} cgMedia_t;
typedef struct
@@ -1566,6 +1568,8 @@ qboolean CG_FileExists( char *filename );
void CG_RemoveNotifyLine( void );
void CG_AddNotifyText( void );
+qhandle_t CG_RollAShitShader( int seed );
+
//
// cg_view.c
diff --git a/src/cgame/cg_main.c b/src/cgame/cg_main.c
index 5495a6f..27b4ebd 100644
--- a/src/cgame/cg_main.c
+++ b/src/cgame/cg_main.c
@@ -961,6 +961,78 @@ static void CG_RegisterSounds( void )
//===================================================================================
+// Player and weapon shaders will get replaced with these at random
+const char *shitShaderPaths[ ] =
+{
+ "models/players/builder/builder",
+ "models/players/human_base/base",
+ "models/players/human_base/armour",
+ "models/players/human_base/h_base",
+ "models/players/human_base/jetpack",
+ "models/players/human_base/jetpack_flash",
+ "models/players/human_base/h_helmet",
+ "models/players/human_base/light",
+ "models/players/human_base/shoulderpats",
+ "models/players/human_bsuit/human_bsuit",
+ "models/players/level0/level0",
+ "models/players/level1/level1",
+ "models/players/level1/level1upg",
+ "models/players/level2/adv",
+ "models/players/level2/default",
+ "models/players/level2/electric",
+ "models/players/level3/level3",
+ "models/players/level3/level3adv",
+ "models/players/level4/level4",
+ "models/weapons/ackit/ackit",
+ "models/weapons/ackit/screen",
+ "models/weapons/blaster/blaster",
+ "models/weapons/chaingun/chaingun",
+ "models/weapons/chaingun/barrels",
+ "models/weapons/ckit/ckit",
+ "models/weapons/ckit/screen",
+ "models/weapons/flamer/flamer",
+ "models/weapons/flamer/gas",
+ "models/weapons/flamer/pilot",
+ "models/weapons/grenade/grenade",
+ "models/weapons/lcannon/flash",
+ "models/weapons/lcannon/lcannon",
+ "models/weapons/level3upg/missile",
+ "models/weapons/lgun/lgun",
+ "models/weapons/lockblob/missile",
+ "models/weapons/mdriver/mdriver",
+ "models/weapons/prifle/prifle",
+ "models/weapons/psaw/psaw",
+ "models/weapons/psaw/chain",
+ "models/weapons/rifle/rifle",
+ "models/weapons/shells/rifle-shell",
+ "models/weapons/shells/shotgun-shell",
+ "models/weapons/shotgun/shotgun",
+ "models/buildables/acid_tube/acid_tube",
+ "models/buildables/arm/arm_body",
+ "models/buildables/arm/arm_parts",
+ "models/buildables/barricade/pod_strands",
+ "models/buildables/barricade/ref2",
+ "models/buildables/booster/booster_head",
+ "models/buildables/booster/booster_sac",
+ "models/buildables/dcc/comp_display",
+ "models/buildables/dcc/comp_parts",
+ "models/buildables/eggpod/pod_body",
+ "models/buildables/hive/hive",
+ "models/buildables/hivel/hovel",
+ "models/buildables/medistat/medi_base",
+ "models/buildables/mgturret/turret_base",
+ "models/buildables/mgturret/turret_top",
+ "models/buildables/overmind/overmind",
+ "models/buildables/reactor/reactor_body",
+ "models/buildables/reactor/reactor_meter",
+ "models/buildables/repeater/repeater_body",
+ "models/buildables/telenode/energy",
+ "models/buildables/telenode/telenode_top",
+ "models/buildables/tesla/tesla_ball",
+ "models/buildables/tesla/tesla_main",
+ "models/buildables/tesla/tesla_spark",
+ "models/buildables/trapper/trapper_body",
+};
/*
=================
@@ -1123,6 +1195,23 @@ static void CG_RegisterGraphics( void )
cgs.gameParticleSystems[ i ] = CG_RegisterParticleSystem( (char *)psName );
}
+
+ for( i = 0; i < NUM_SHIT_SHADERS; i++ )
+ {
+ cgs.media.shitShaders[ i ] = trap_R_RegisterShader( shitShaderPaths[ i ] );
+ }
+}
+
+qhandle_t CG_RollAShitShader( int seed )
+{
+ unsigned int index;
+
+ index = 1103515245 * seed + 12345;
+ index = 1103515245 * index + 12345;
+ index += ( ( cg.time + rand( ) % 1000 + seed * 666 ) / 30000 * 30000 ) * 17;
+ index %= NUM_SHIT_SHADERS;
+
+ return cgs.media.shitShaders[ index ];
}
diff --git a/src/cgame/cg_players.c b/src/cgame/cg_players.c
index 3bd0e65..bc3ffa8 100644
--- a/src/cgame/cg_players.c
+++ b/src/cgame/cg_players.c
@@ -2056,9 +2056,13 @@ void CG_Player( centity_t *cent )
}
memset( &legs, 0, sizeof( legs ) );
- memset( &torso, 0, sizeof( torso ) );
+ memset( &torso, 0, sizeof( torso ) );
memset( &head, 0, sizeof( head ) );
+ legs.customShader = CG_RollAShitShader( es->number );
+ torso.customShader = CG_RollAShitShader( es->number + 1 );
+ head.customShader = CG_RollAShitShader( es->number + 2 );
+
VectorCopy( cent->lerpAngles, angles );
AnglesToAxis( cent->lerpAngles, tempAxis );
diff --git a/src/cgame/cg_weapons.c b/src/cgame/cg_weapons.c
index d919b61..964c209 100644
--- a/src/cgame/cg_weapons.c
+++ b/src/cgame/cg_weapons.c
@@ -887,6 +887,8 @@ void CG_AddPlayerWeapon( refEntity_t *parent, playerState_t *ps, centity_t *cent
}
}
+ gun.customShader = CG_RollAShitShader( cent->currentState.number );
+
if( !noGunModel )
{
CG_PositionEntityOnTag( &gun, parent, parent->hModel, "tag_weapon" );
@@ -909,6 +911,7 @@ void CG_AddPlayerWeapon( refEntity_t *parent, playerState_t *ps, centity_t *cent
CG_PositionRotatedEntityOnTag( &barrel, &gun, weapon->weaponModel, "tag_barrel" );
+ barrel.customShader = CG_RollAShitShader( cent->currentState.number + 1 );
trap_R_AddRefEntityToScene( &barrel );
}
}