New Weapon Explosion Shader

Locked
gooball :D
Posts: 71
Joined: Wed Oct 27, 2010 10:27 am

New Weapon Explosion Shader

Post by gooball :D »

Hi d00ds, I am currently working on adding some new weapons to Quake 3. I want to assign a new weapon, based on the RL, a different explosion shader, but I can't figure out how to get the shader to work. (I'm a bit new with Q3 programming :) ) Thanks in advance :D
My Website:
[url=http://goostudios.weebly.com/][img]http://img839.imageshack.us/img839/2671/bg3t.png[/img][/url]
obsidian
Posts: 10970
Joined: Mon Feb 04, 2002 8:00 am

Re: New Weapon Explosion Shader

Post by obsidian »

Are you having problems with the shader script itself or having some kind of problem getting Q3 to work with your shader?
[size=85][url=http://gtkradiant.com]GtkRadiant[/url] | [url=http://q3map2.robotrenegade.com]Q3Map2[/url] | [url=http://q3map2.robotrenegade.com/docs/shader_manual/]Shader Manual[/url][/size]
gooball :D
Posts: 71
Joined: Wed Oct 27, 2010 10:27 am

Re: New Weapon Explosion Shader

Post by gooball :D »

This has nothing to do with the shader script. It puzzles me because I couldn't find an explosion shader for the RL or the GL. But, yes, I can't get the explosion to work with Q3. I haven't created an explosion shader since I could not find an explosion shader for the other weapons.
My Website:
[url=http://goostudios.weebly.com/][img]http://img839.imageshack.us/img839/2671/bg3t.png[/img][/url]
obsidian
Posts: 10970
Joined: Mon Feb 04, 2002 8:00 am

Re: New Weapon Explosion Shader

Post by obsidian »

Looks like they're in pak0.pk3/scripts/gfx.shader.

Code: Select all

rocketExplosion
{
	cull disable
	{
		animmap 8 models/weaphits/rlboom/rlboom_1.tga  models/weaphits/rlboom/rlboom_2.tga models/weaphits/rlboom/rlboom_3.tga models/weaphits/rlboom/rlboom_4.tga models/weaphits/rlboom/rlboom_5.tga models/weaphits/rlboom/rlboom_6.tga models/weaphits/rlboom/rlboom_7.tga models/weaphits/rlboom/rlboom_8.tga
		rgbGen wave inversesawtooth 0 1 0 8
		blendfunc add
	}
	{
		animmap 8 models/weaphits/rlboom/rlboom_2.tga models/weaphits/rlboom/rlboom_3.tga models/weaphits/rlboom/rlboom_4.tga models/weaphits/rlboom/rlboom_5.tga models/weaphits/rlboom/rlboom_6.tga models/weaphits/rlboom/rlboom_7.tga models/weaphits/rlboom/rlboom_8.tga gfx/colors/black.tga
		rgbGen wave sawtooth 0 1 0 8
		blendfunc add
	}
}
[size=85][url=http://gtkradiant.com]GtkRadiant[/url] | [url=http://q3map2.robotrenegade.com]Q3Map2[/url] | [url=http://q3map2.robotrenegade.com/docs/shader_manual/]Shader Manual[/url][/size]
gooball :D
Posts: 71
Joined: Wed Oct 27, 2010 10:27 am

Re: New Weapon Explosion Shader

Post by gooball :D »

Haha, WOW I'm blind. Thanks anyway :D
My Website:
[url=http://goostudios.weebly.com/][img]http://img839.imageshack.us/img839/2671/bg3t.png[/img][/url]
themuffinman
Posts: 384
Joined: Fri Mar 05, 2010 5:29 pm

Re: New Weapon Explosion Shader

Post by themuffinman »

So you haven't coded it in either? It's declared in cg_local.h:

Code: Select all

	qhandle_t	rocketExplosionShader;
cg_weapons.c::CG_RegisterWeapon gets the game to load the shader and other weapon projectile assets into memory during level loading:

Code: Select all

...
case WP_ROCKET_LAUNCHER:
		weaponInfo->missileModel = trap_R_RegisterModel( "models/ammo/rocket/rocket.md3" );
		weaponInfo->missileSound = trap_S_RegisterSound( "sound/weapons/rocket/rockfly.wav", qfalse );
		weaponInfo->missileTrailFunc = CG_RocketTrail;
		weaponInfo->missileDlight = 200;
		weaponInfo->wiTrailTime = 2000;
		weaponInfo->trailRadius = 64;
		
		MAKERGB( weaponInfo->missileDlightColor, 1, 0.75f, 0 );
		MAKERGB( weaponInfo->flashDlightColor, 1, 0.75f, 0 );

		weaponInfo->flashSound[0] = trap_S_RegisterSound( "sound/weapons/rocket/rocklf1a.wav", qfalse );
		cgs.media.rocketExplosionShader = trap_R_RegisterShader( "rocketExplosion" );
		break;
...
cg_weapons.c::CG_MissileHitWall handles the effect

Code: Select all

...
case WP_ROCKET_LAUNCHER:
		mod = cgs.media.dishFlashModel;
		shader = cgs.media.rocketExplosionShader;
		sfx = cgs.media.sfx_rockexp;
		mark = cgs.media.burnMarkShader;
		radius = 64;
		light = 300;
		isSprite = qtrue;
		duration = 1000;
		lightColor[0] = 1;
		lightColor[1] = 0.75;
		lightColor[2] = 0.0;
		if (cg_oldRocket.integer == 0) {
			// explosion sprite animation
			VectorMA( origin, 24, dir, sprOrg );
			VectorScale( dir, 64, sprVel );

			CG_ParticleExplosion( "explode1", sprOrg, sprVel, 1400, 20, 30 );
		}
		break;
...
Locked