Site hosted by Angelfire.com: Build your free website today!
Removing damage


There are 3 basic kind of damage you need to warry about in quake 3.

Fall Damage
Well first lents talk about fall damage. In most of the mod source code i have seen ID left a flag in to remove fall damage.
It's dmflags 8

Self Damage

Next lents talk about self damage. That is damage you take from blowback many rocket,bfg and most other missel weapons.

If you open up the quake 3 source code and look in g_combat.c and look for a line like below in G_Damage.

 
// always give half damage if hurting self
// calculated after knockback, so rocket jumping works

	if ( targ == attacker) {
		damage *= 0.5;
	}

	if ( damage < 1 ) {
		damage = 1;
	}
Now just after that add your now if targ == attacker statmant. Like so.

// always give half damage if hurting self
// calculated after knockback, so rocket jumping works
	if ( targ == attacker) {
		damage *= 0.5;
	}

	if ( damage < 1 ) {
		damage = 1;
	}
	if ( targ == attacker && some_cvar.integer) {
		damage *= 0;
	}
What is going on here is the game runs down the list of if's and if every thing checks out gives damage.
But what we are telling it to do here is to look for the some_cvar to be on, And if it is, do NO damage
insted of half damage to the player.

Map damage

Now lents talk about Map damage aka lava/slime contents and drowning.
For now lents just call it P_WorldEffects damage removel.
P_WorldEffects In g_atcive.c handes this damage,and how it effects the player.
But to remove it we need to when the damage effects the player not how.
If you search will is P_WorldEffects only come up in 3 places. One of these is the one were looking for.
But which one. 2 of the refer to P_WorldEffects it's self so the last one must be it.

So we strole of happy butts down to ware it says this.

	// burn from lava, etc
	P_WorldEffects (ent);


	// apply all the damage taken this frame
	P_DamageFeedback (ent);
Now if you look just below P_WorldEffects it says P_DamageFeedback with the note //apply all the damage taken this frame.
So if we use a cvar to turn P_WorldEffects on / off. Then P_DamageFeedback will not read it.
We do that like so.
 
	 // burn from lava, etc
    //	P_WorldEffects (ent);
	if( some_cvar.integer ) P_WorldEffects (ent);


	// apply all the damage taken this frame
	P_DamageFeedback (ent);

There you go no more world damage.

Well hope that help someone anyway enjoy --powerr