NEW BREAKABLE CODE - will break all old breakables(wont appear in maps)

This commit is contained in:
Scott Brooks 2002-04-03 03:13:49 +00:00
parent eaec2203cd
commit fed270d963
19 changed files with 683 additions and 353 deletions

View file

@ -5,6 +5,9 @@
//-----------------------------------------------------------------------------
//
// $Log$
// Revision 1.24 2002/04/03 03:13:48 blaze
// NEW BREAKABLE CODE - will break all old breakables(wont appear in maps)
//
// Revision 1.23 2002/03/31 03:31:24 jbravo
// Compiler warning cleanups
//
@ -577,6 +580,7 @@ localEntity_t *CG_MakeExplosion( vec3_t origin, vec3_t dir,
ex->refEntity.hModel = hModel;
ex->refEntity.customShader = shader;
// set origin
VectorCopy( newOrigin, ex->refEntity.origin );
@ -1026,6 +1030,7 @@ void CG_LaunchGlass( vec3_t origin, vec3_t velocity, vec3_t rotation,
le->leMarkType = LEMT_NONE;
}
/*
===================
CG_BreakGlass
@ -1035,123 +1040,64 @@ Elder: don't be mislead by the name - this breaks more than glass
===================
*/
void CG_BreakGlass( vec3_t playerOrigin, int glassParm, int type ) {
vec3_t origin, velocity, rotation;
int value;
int count;
int states[] = {1,2,3}; // Select model variations
// Get the size of the array
int numstates = sizeof(states)/sizeof(states[0]);
// Elder: debris model handles
qhandle_t debris1;
void CG_BreakGlass( vec3_t playerOrigin, int glassParm, int number, int type, int isChip ) {
vec3_t origin, velocity, rotation;
int value;
int count;
int states[] = {1,2,3}; // Select model variations
// Get the size of the array
int numstates = sizeof(states)/sizeof(states[0]);
// Elder: debris model handles
qhandle_t debris1;
qhandle_t debris2;
qhandle_t debris3;
int bounceFactor;
float bounceFactor;
int newParm;
if ( (glassParm & RQ3_DEBRIS_MEDIUM) == RQ3_DEBRIS_MEDIUM &&
int id;
qhandle_t sound;
id = (glassParm & 63);
// Com_Printf("ID is %d\n",id);
glassParm = glassParm >> 6;
sound = cgs.media.breakables[id].sound[rand() % 3];
trap_S_StartSound( NULL, number, CHAN_BODY, sound );
bounceFactor = 0.3;
if ( (glassParm & RQ3_DEBRIS_MEDIUM) == RQ3_DEBRIS_MEDIUM &&
(glassParm & RQ3_DEBRIS_HIGH) == RQ3_DEBRIS_HIGH)
{
//Tons
count = 65 + rand() % 16;
}
}
else if ( (glassParm & RQ3_DEBRIS_HIGH) == RQ3_DEBRIS_HIGH)
{
//Large
count = 40 + rand() % 11;
}
else if ( (glassParm & RQ3_DEBRIS_MEDIUM) == RQ3_DEBRIS_MEDIUM)
}
else if ( (glassParm & RQ3_DEBRIS_MEDIUM) == RQ3_DEBRIS_MEDIUM)
{
//Medium
count = 20 + rand() % 6;
}
else
}
else
{
//Small
count = 8 + rand() % 6;
count = 8 + rand() % 6;
}
/*
===============================
TODO: Utilize variation bits!
==============================
*/
//If it's just a chip, dont make so many
if (isChip == 1)
{
count /= 8;
}
//Strip off amount info and revert eParm back to server-side size
newParm = glassParm & 15;
glassParm &= ~newParm;
glassParm = glassParm << (type * 4);
//CG_Printf("glassParm: %i\n", glassParm);
//Elder: check debris type and assign debris models
if ( (glassParm & RQ3_DEBRIS_WOOD) == RQ3_DEBRIS_WOOD)
{
//CG_Printf("Launching wood\n");
debris1 = cgs.media.wood01;
debris2 = cgs.media.wood02;
debris3 = cgs.media.wood03;
bounceFactor = 0.8f;
}
else if ( (glassParm & RQ3_DEBRIS_METAL) == RQ3_DEBRIS_METAL)
{
//CG_Printf("Launching metal\n");
debris1 = cgs.media.metal01;
debris2 = cgs.media.metal02;
debris3 = cgs.media.metal03;
bounceFactor = 0.7f;
}
else if ( (glassParm & RQ3_DEBRIS_CERAMIC) == RQ3_DEBRIS_CERAMIC)
{
//CG_Printf("Launching ceramic\n");
debris1 = cgs.media.ceramic01;
debris2 = cgs.media.ceramic02;
debris3 = cgs.media.ceramic03;
bounceFactor = 0.7f;
}
else if ( (glassParm & RQ3_DEBRIS_PAPER) == RQ3_DEBRIS_PAPER)
{
//CG_Printf("Launching paper\n");
debris1 = cgs.media.paper01;
debris2 = cgs.media.paper02;
debris3 = cgs.media.paper03;
bounceFactor = 0.2f;
}
else if ( (glassParm & RQ3_DEBRIS_BRICK) == RQ3_DEBRIS_BRICK)
{
//CG_Printf("Launching brick\n");
debris1 = cgs.media.brick01;
debris2 = cgs.media.brick02;
debris3 = cgs.media.brick03;
bounceFactor = 0.4f;
}
else if ( (glassParm & RQ3_DEBRIS_CONCRETE) == RQ3_DEBRIS_CONCRETE)
{
//CG_Printf("Launching concrete\n");
debris1 = cgs.media.concrete01;
debris2 = cgs.media.concrete02;
debris3 = cgs.media.concrete03;
bounceFactor = 0.5f;
}
/*
else if ( (glassParm & RQ3_DEBRIS_POPCAN) == RQ3_DEBRIS_POPCAN)
{
CG_Printf("Launching pop cans\n");
debris1 = cgs.media.popcan01;
debris2 = cgs.media.popcan02;
debris3 = cgs.media.popcan03;
}
*/
else
{
//glass is default
//CG_Printf("Launching glass\n");
debris1 = cgs.media.glass01;
debris2 = cgs.media.glass02;
debris3 = cgs.media.glass03;
bounceFactor = 0.7f;
}
debris1 = cgs.media.breakables[id].model[0];
debris2 = cgs.media.breakables[id].model[1];
debris3 = cgs.media.breakables[id].model[2];
//launch loop
while ( count-- ) {
// Generate the random number every count so every shard is a
@ -1226,6 +1172,27 @@ void CG_LaunchBreakableFrag( vec3_t origin, vec3_t velocity, qhandle_t hModel, f
le->leBounceSoundType = LEBS_NONE;
le->leMarkType = LEMT_NONE;
}
/*
=============
VectorToString
This is just a convenience function
for printing vectors
=============
*/
char *vtos( const vec3_t v ) {
static int index;
static char str[8][32];
char *s;
// use an array so that multiple vtos won't collide
s = str[index];
index = (index + 1)&7;
Com_sprintf (s, 32, "(%i %i %i)", (int)v[0], (int)v[1], (int)v[2]);
return s;
}
// JBravo: also for func_explosive
/*
@ -1238,11 +1205,9 @@ Generated a bunch of gibs launching out from the breakables location
#define BREAK_VELOCITY 550
#define BREAK_JUMP 1500
void CG_BreakBreakable( centity_t *cent, int eParam ) {
void CG_BreakBreakable( centity_t *cent,int eParam, int number ) {
localEntity_t *le;
vec3_t origin, velocity;
qhandle_t model;
sfxHandle_t sound;
qhandle_t mod;
qhandle_t shader;
vec3_t shrapnelDest;
@ -1253,44 +1218,62 @@ void CG_BreakBreakable( centity_t *cent, int eParam ) {
vec3_t lightColor;
int duration;
int sparkCount;
int i, mass, material;
float tension, bouncyness, size;
// int modelbias[10] = { 0, 0, 0, 0, 1, 1, 1, 2, 2 };
mass = ((eParam >> 4) & 0x0F) + 1;
tension = 0.25 * (((eParam >> 2) & 0x03) + 1);
bouncyness = 0.25 * (((eParam) & 0x3) + 1);
int i;
int modelbias[10] = { 0, 0, 0, 0, 1, 1, 1, 2, 2 };
int id;
int count;
mass = eParam;
material = (cent->currentState.powerups >> 12) & 0x000F;
tension = 0.0667 * (float)((cent->currentState.powerups >> 8) & 0x000F);
bouncyness = 0.0667 * (float)((cent->currentState.powerups >> 4) & 0x000F);
size = 0.1333 * (float)((cent->currentState.powerups) & 0x000F);
if (mass == 0) mass = 1;
if (size <= 0) size = 1;
id = (eParam & 63);
eParam = eParam >> 6;
trap_S_StartSound( NULL, number, CHAN_BODY, cgs.media.breakables[id].exp_sound );
if ( (eParam & RQ3_DEBRIS_MEDIUM) == RQ3_DEBRIS_MEDIUM &&
(eParam & RQ3_DEBRIS_HIGH) == RQ3_DEBRIS_HIGH)
{
//Tons
count = 65 + rand() % 16;
}
else if ( (eParam & RQ3_DEBRIS_HIGH) == RQ3_DEBRIS_HIGH)
{
//Large
count = 40 + rand() % 11;
}
else if ( (eParam & RQ3_DEBRIS_MEDIUM) == RQ3_DEBRIS_MEDIUM)
{
//Medium
count = 20 + rand() % 6;
}
else
{
//Small
count = 8 + rand() % 6;
}
//if (material) material--;
VectorCopy( cent->currentState.origin, origin );
sound = cgs.media.breakable_snd[material];
trap_S_StartSound( origin, cent->currentState.number, CHAN_BODY, sound );
VectorCopy( cent->lerpOrigin, origin );
/*
sound = cgs.media.breakables[id].sound;
trap_S_StartSound( origin, cent->currentState.number, CHAN_BODY, sound );*/
// create an explosion
mod = cgs.media.dishFlashModel;
shader = cgs.media.grenadeExplosionShader;
light = 350;
shader = cgs.media.breakables[id].shader;
//Com_Printf("Explosion, %d, breakableshader %d at %s ep %d\n",shader,cgs.media.breakables[id].shader, vtos(origin), eParam);
light = 550;
lightColor[0] = 1;
lightColor[1] = 1;
lightColor[2] = 0;
duration = 600;
duration = 1000;
velocity[0] = (crandom() * BREAK_VELOCITY) * tension;
velocity[1] = (crandom() * BREAK_VELOCITY) * tension;
velocity[2] = ( random() * BREAK_JUMP) * tension;
velocity[0] = 1;
velocity[1] = 1;
velocity[2] = 1;
le = CG_MakeExplosion( origin, velocity,
le = CG_MakeExplosion( origin, velocity,
mod, shader,
duration, qtrue );
le->light = light;
@ -1322,20 +1305,11 @@ void CG_BreakBreakable( centity_t *cent, int eParam ) {
puffDir[2] = 20;
origin[2] -= 16;
smokePuff = CG_SmokePuff( origin, puffDir,
rand() % 12 + 48,
1, 1, 1, 0.4f,
1750,
rand() % 12 + 100,
1, 1, 1, 0.6f,
3000,
cg.time, 0,
0,
cgs.media.smokePuffShader );
for (i = 0; i < mass; i++) {
velocity[0] = (crandom() * BREAK_VELOCITY) * tension;
velocity[1] = (crandom() * BREAK_VELOCITY) * tension;
velocity[2] = ( random() * BREAK_JUMP) * tension;
model = cgs.media.breakable_frag[material][(int)(2.0 * random())];
CG_LaunchBreakableFrag( origin, velocity, model, bouncyness, size );
}
}

View file

@ -5,6 +5,9 @@
//-----------------------------------------------------------------------------
//
// $Log$
// Revision 1.23 2002/04/03 03:13:48 blaze
// NEW BREAKABLE CODE - will break all old breakables(wont appear in maps)
//
// Revision 1.22 2002/03/31 13:52:48 jbravo
// More cleanups
//
@ -37,6 +40,9 @@
static void CG_LaserSight( centity_t *cent );
static void CG_Dlight( centity_t *cent );
extern char rq3_breakables[RQ3_MAX_BREAKABLES][80];
extern void trap_R_AddAdditiveLightToScene( const vec3_t org, float intensity, float r, float g, float b );
/*
======================
CG_PositionEntityOnTag

View file

@ -5,6 +5,9 @@
//-----------------------------------------------------------------------------
//
// $Log$
// Revision 1.48 2002/04/03 03:13:48 blaze
// NEW BREAKABLE CODE - will break all old breakables(wont appear in maps)
//
// Revision 1.47 2002/03/31 03:31:24 jbravo
// Compiler warning cleanups
//
@ -68,7 +71,7 @@
#include "cg_local.h"
// JBravo: warning fix
void CG_BreakBreakable(centity_t *cent, int eParam);
void CG_BreakBreakable(centity_t *cent, int eParam, int number);
// for the voice chats
#ifdef MISSIONPACK // bk001205
@ -2496,30 +2499,22 @@ void CG_EntityEvent( centity_t *cent, vec3_t position ) {
// Change cgs.media.gibSound to whatever sound you want it to use
// I think the gib sound sounds pretty good
//Elder: gonna move this into the function some day
if ( rand() % 2 )
trap_S_StartSound( NULL, es->number, CHAN_BODY, cgs.media.glassSound );
else
trap_S_StartSound( NULL, es->number, CHAN_BODY, cgs.media.glass2Sound );
//Elder: modified
CG_BreakGlass( cent->lerpOrigin, es->eventParm, 0 );
CG_BreakGlass( cent->lerpOrigin, es->eventParm, es->number, 0, 0 );
break;
case EV_BREAK_GLASS2:
DEBUGNAME("EV_BREAK_GLASS2");
if ( rand() % 2 )
trap_S_StartSound( NULL, es->number, CHAN_BODY, cgs.media.glassSound );
else
trap_S_StartSound( NULL, es->number, CHAN_BODY, cgs.media.glass2Sound );
CG_BreakGlass( cent->lerpOrigin, es->eventParm, 1 );
CG_BreakGlass( cent->lerpOrigin, es->eventParm, es->number, 1, 0 );
break;
case EV_BREAK_GLASS3:
DEBUGNAME("EV_BREAK_GLASS3");
if ( rand() % 2 )
trap_S_StartSound( NULL, es->number, CHAN_BODY, cgs.media.glassSound );
else
trap_S_StartSound( NULL, es->number, CHAN_BODY, cgs.media.glass2Sound );
CG_BreakGlass( cent->lerpOrigin, es->eventParm, 2 );
CG_BreakGlass( cent->lerpOrigin, es->eventParm, es->number, 2, 0 );
break;
case EV_STOPLOOPINGSOUND:
case EV_CHIP_GLASS:
DEBUGNAME("EV_CHIP_GLASS");
CG_BreakGlass( cent->lerpOrigin, es->eventParm, es->number, 1, 1 );
break;
case EV_STOPLOOPINGSOUND:
DEBUGNAME("EV_STOPLOOPINGSOUND");
trap_S_StopLoopingSound( es->number );
es->loopSound = 0;
@ -2530,11 +2525,11 @@ void CG_EntityEvent( centity_t *cent, vec3_t position ) {
CG_Beam( cent );
break;
// JBravo: adding func_explosive
case EV_GIB_GLASS:
DEBUGNAME("EV_GIB_GLASS");
// Blaze: an exploding breakable
case EV_EXPLODE_BREAKABLE:
DEBUGNAME("EV_EXPLODE_BREAKABLE");
//trap_S_StartSound( NULL, es->number, CHAN_BODY, cgs.media.gibSound );
CG_BreakBreakable( cent, es->eventParm );
CG_BreakBreakable( cent, es->eventParm, es->number );
break;
default:

View file

@ -5,6 +5,9 @@
//-----------------------------------------------------------------------------
//
// $Log$
// Revision 1.63 2002/04/03 03:13:48 blaze
// NEW BREAKABLE CODE - will break all old breakables(wont appear in maps)
//
// Revision 1.62 2002/03/31 02:03:13 niceass
// added tag declaration
//
@ -840,7 +843,13 @@ typedef struct {
int records[REC_NUM_RECORDS]; // Blaze: for our statistics tracking
} cg_t;
//Blaze: struct to hold the func_breakable stuff
typedef struct {
qhandle_t model[3];
sfxHandle_t sound[3];
sfxHandle_t exp_sound;
qhandle_t shader;
} breakable_t;
// all of the model, shader, and sound references that are
// loaded at gamestate time are stored in cgMedia_t
@ -933,9 +942,9 @@ typedef struct {
qhandle_t akimbo1stModel;
qhandle_t akimboHandModel;
// JBravo: func_brakable stuff
qhandle_t breakable_frag[15][3];
sfxHandle_t breakable_snd[15];
// Blaze: func_explosive stuff
breakable_t breakables[16];
qhandle_t smoke2;
@ -1149,8 +1158,9 @@ typedef struct {
sfxHandle_t youSuckSound;
#endif
sfxHandle_t gibSound;
sfxHandle_t glassSound; //Blaze: Reaction breakable glass
sfxHandle_t glass2Sound;
//Blaze: Dont need this any more
// sfxHandle_t glassSound; //Blaze: Reaction breakable glass
// sfxHandle_t glass2Sound;
sfxHandle_t gibBounce1Sound;
sfxHandle_t gibBounce2Sound;
sfxHandle_t gibBounce3Sound;
@ -1841,7 +1851,7 @@ void CG_ShrapnelSpark( vec3_t source, vec3_t dest, float width, float length );
void CG_GibPlayer( vec3_t playerOrigin );
void CG_BigExplode( vec3_t playerOrigin );
// Blaze: Breakable glass Elder: modified
void CG_BreakGlass( vec3_t playerOrigin, int glassParm, int type );
void CG_BreakGlass( vec3_t playerOrigin, int glassParm, int number, int type, int isChip );
void CG_Bleed( vec3_t origin, int entityNum );
//Elder: for SSG shots
void CG_BleedSpray ( vec3_t start, vec3_t end, int entityNum, int numBursts );

View file

@ -5,6 +5,9 @@
//-----------------------------------------------------------------------------
//
// $Log$
// Revision 1.52 2002/04/03 03:13:49 blaze
// NEW BREAKABLE CODE - will break all old breakables(wont appear in maps)
//
// Revision 1.51 2002/03/26 10:32:51 jbravo
// Bye bye LCA lag
//
@ -82,6 +85,9 @@ void CG_Init( int serverMessageNum, int serverCommandSequence, int clientNum );
void CG_Shutdown( void );
//Blaze: used to access the names of the breakables
char rq3_breakables[RQ3_MAX_BREAKABLES][80];
/*
================
vmMain
@ -817,16 +823,12 @@ static void CG_RegisterSounds( void ) {
cgs.media.useNothingSound = trap_S_RegisterSound( "sound/items/use_nothing.wav", qfalse );
cgs.media.gibSound = trap_S_RegisterSound( "sound/player/gibsplt1.wav", qfalse );
//Blaze: Reaction breakable glass
cgs.media.glassSound = trap_S_RegisterSound( "sound/world/glassbk.wav", qfalse );
cgs.media.glass2Sound = trap_S_RegisterSound( "sound/world/glassbk2.wav", qfalse );
/*cgs.media.glassSound = trap_S_RegisterSound( "sound/world/glassbk.wav", qfalse );
cgs.media.glass2Sound = trap_S_RegisterSound( "sound/world/glassbk2.wav", qfalse );*/
cgs.media.gibBounce1Sound = trap_S_RegisterSound( "sound/player/gibimp1.wav", qfalse );
cgs.media.gibBounce2Sound = trap_S_RegisterSound( "sound/player/gibimp2.wav", qfalse );
cgs.media.gibBounce3Sound = trap_S_RegisterSound( "sound/player/gibimp3.wav", qfalse );
//Blaze: func_explosive sounds
cgs.media.breakable_snd[0] = trap_S_RegisterSound( "sound/world/glassbk.wav", qfalse );
cgs.media.breakable_snd[1] = trap_S_RegisterSound ("sound/weapons/rocket/rocklx1a.wav", qfalse);
//Elder: RQ3 sounds
cgs.media.kickSound = trap_S_RegisterSound( "sound/misc/kick.wav", qfalse);
cgs.media.lensSound = trap_S_RegisterSound( "sound/misc/lens.wav", qfalse);
@ -1238,12 +1240,8 @@ static void CG_RegisterGraphics( void ) {
cgs.media.gibLeg = trap_R_RegisterModel( "models/gibs/leg.md3" );
cgs.media.gibSkull = trap_R_RegisterModel( "models/gibs/skull.md3" );
cgs.media.gibBrain = trap_R_RegisterModel( "models/gibs/brain.md3" );
//Blaze: Breakable Glass
i=0;
cgs.media.breakable_frag[i][0] = cgs.media.glass01 = trap_R_RegisterModel( "models/breakables/glass01.md3" );
cgs.media.breakable_frag[i][1] = cgs.media.glass02 = trap_R_RegisterModel( "models/breakables/glass02.md3" );
cgs.media.breakable_frag[i][2] = cgs.media.glass03 = trap_R_RegisterModel( "models/breakables/glass03.md3" );
//Blaze: Delay loading the breakable stuff
/*
//Elder: additional debris
//Todo: load only if in the level
i++;
@ -1276,7 +1274,7 @@ static void CG_RegisterGraphics( void ) {
cgs.media.breakable_frag[i][0] = cgs.media.concrete01 = trap_R_RegisterModel( "models/breakables/concrete01.md3" );
cgs.media.breakable_frag[i][1] = cgs.media.concrete02 = trap_R_RegisterModel( "models/breakables/concrete02.md3" );
cgs.media.breakable_frag[i][2] = cgs.media.concrete03 = trap_R_RegisterModel( "models/breakables/concrete03.md3" );
*/
//Elder: akimbos - some of the stuff isn't in yet :p
cgs.media.akimboModel = trap_R_RegisterModel( "models/weapons2/akimbo/akimbo.md3" );
cgs.media.akimboFlashModel = trap_R_RegisterModel( "models/weapons2/akimbo/akimbo_flash.md3" );

View file

@ -5,6 +5,9 @@
//-----------------------------------------------------------------------------
//
// $Log$
// Revision 1.27 2002/04/03 03:13:49 blaze
// NEW BREAKABLE CODE - will break all old breakables(wont appear in maps)
//
// Revision 1.26 2002/04/02 04:18:58 jbravo
// Made the TP scoreboard go down at round beginig (not for spectators) and
// pop up at intermission. Also added special to the use command
@ -62,6 +65,9 @@
#include "cg_local.h"
#include "../ui/menudef.h" // bk001205 - for Q3_ui as well
//Blaze: holds the id to name mapping of the breakables
extern char rq3_breakables[RQ3_MAX_BREAKABLES][80];
typedef struct {
const char *order;
int taskNum;
@ -1239,6 +1245,31 @@ static void CG_ServerCommand( void ) {
return;
}
if ( !strcmp( cmd, "breakable" ) )
{
int id;
id = atoi(CG_Argv(1));
if (id >= 0 && id < RQ3_MAX_BREAKABLES)
{
//Com_Printf("Registering breakable %s ID=%d\n",CG_Argv(2), id);
//Blaze: Breakable stuff - register the models, sounds, and explosion shader
cgs.media.breakables[id].model[0] = trap_R_RegisterModel( va("breakables/%s/models/break1.md3",CG_Argv(2)) );
cgs.media.breakables[id].model[1] = trap_R_RegisterModel( va("breakables/%s/models/break2.md3",CG_Argv(2)) );
cgs.media.breakables[id].model[2] = trap_R_RegisterModel( va("breakables/%s/models/break3.md3",CG_Argv(2)) );
cgs.media.breakables[id].shader = trap_R_RegisterShader( va("breakable_%s_explosion",CG_Argv(2)) );
cgs.media.breakables[id].sound[0] = trap_S_RegisterSound( va("breakables/%s/sounds/break1.wav", CG_Argv(2)), qfalse );
cgs.media.breakables[id].sound[1] = trap_S_RegisterSound( va("breakables/%s/sounds/break2.wav", CG_Argv(2)), qfalse );
cgs.media.breakables[id].sound[2] = trap_S_RegisterSound( va("breakables/%s/sounds/break3.wav", CG_Argv(2)), qfalse );
cgs.media.breakables[id].exp_sound = trap_S_RegisterSound( va("breakables/%s/sounds/explosion.wav", CG_Argv(2)), qfalse );
return;
}
else
{
CG_Printf("ID was %d\n",id);
}
return;
}
if ( !strcmp( cmd, "selectpistol") ) {
//CG_Printf("Selecting pistol\n");

View file

@ -5,6 +5,9 @@
//-----------------------------------------------------------------------------
//
// $Log$
// Revision 1.63 2002/04/03 03:13:49 blaze
// NEW BREAKABLE CODE - will break all old breakables(wont appear in maps)
//
// Revision 1.62 2002/04/01 22:23:38 slicer
// Added "weapon" command buffering
//
@ -3203,6 +3206,7 @@ void CG_MissileHitWall( int weapon, int clientNum, vec3_t origin,
duration, isSprite );
le->light = light;
VectorCopy( lightColor, le->lightColor );
}
else if ( cg_RQ3_impactEffects.integer )
{
@ -3410,6 +3414,7 @@ void CG_MissileHitWall( int weapon, int clientNum, vec3_t origin,
// Elder: grenade explosion
if (cg_RQ3_impactEffects.integer && weapon == WP_GRENADE)
{
vec3_t shrapnelDest;
sparkCount = 60 + rand() % 10;

View file

@ -6,13 +6,37 @@
--------------------Configuration: cgame - Win32 Debug--------------------
</h3>
<h3>Command Lines</h3>
Creating temporary file "C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\RSP9D0.tmp" with contents
Creating temporary file "C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\RSPBB.tmp" with contents
[
/nologo /G5 /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /FR"Debug/" /Fp"Debug/cgame.pch" /YX /Fo"Debug/" /Fd"Debug/" /FD /c
"C:\Development\reaction\game\bg_misc.c"
"C:\Development\reaction\game\bg_pmove.c"
"C:\Development\reaction\game\bg_slidemove.c"
"C:\Development\reaction\cgame\cg_consolecmds.c"
"C:\Development\reaction\cgame\cg_draw.c"
"C:\Development\reaction\cgame\cg_drawtools.c"
"C:\Development\reaction\cgame\cg_effects.c"
"C:\Development\reaction\cgame\cg_ents.c"
"C:\Development\reaction\cgame\cg_event.c"
"C:\Development\reaction\cgame\cg_info.c"
"C:\Development\reaction\cgame\cg_localents.c"
"C:\Development\reaction\cgame\cg_main.c"
"C:\Development\reaction\cgame\cg_marks.c"
"C:\Development\reaction\cgame\cg_players.c"
"C:\Development\reaction\cgame\cg_playerstate.c"
"C:\Development\reaction\cgame\cg_predict.c"
"C:\Development\reaction\cgame\cg_scoreboard.c"
"C:\Development\reaction\cgame\cg_servercmds.c"
"C:\Development\reaction\cgame\cg_snapshot.c"
"C:\Development\reaction\cgame\cg_syscalls.c"
"C:\Development\reaction\cgame\cg_view.c"
"C:\Development\reaction\cgame\cg_weapons.c"
"C:\Development\reaction\game\q_math.c"
"C:\Development\reaction\game\q_shared.c"
"C:\Development\reaction\ui\ui_shared.c"
]
Creating command line "cl.exe @C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\RSP9D0.tmp"
Creating temporary file "C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\RSP9D1.tmp" with contents
Creating command line "cl.exe @C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\RSPBB.tmp"
Creating temporary file "C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\RSPBC.tmp" with contents
[
/nologo /base:"0x30000000" /subsystem:windows /dll /incremental:yes /pdb:"Debug/cgamex86.pdb" /map:"Debug/cgamex86.map" /debug /machine:I386 /def:".\cgame.def" /out:"../Debug/cgamex86.dll" /implib:"Debug/cgamex86.lib"
.\Debug\bg_misc.obj
@ -41,17 +65,42 @@ Creating temporary file "C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\RSP9D1.tmp" with con
.\Debug\q_shared.obj
.\Debug\ui_shared.obj
]
Creating command line "link.exe @C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\RSP9D1.tmp"
Creating command line "link.exe @C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\RSPBC.tmp"
<h3>Output Window</h3>
Compiling...
bg_misc.c
bg_pmove.c
bg_slidemove.c
cg_consolecmds.c
cg_draw.c
cg_drawtools.c
cg_effects.c
cg_ents.c
cg_event.c
cg_info.c
cg_localents.c
cg_main.c
cg_marks.c
cg_players.c
cg_playerstate.c
cg_predict.c
cg_scoreboard.c
cg_servercmds.c
cg_snapshot.c
cg_syscalls.c
cg_view.c
cg_weapons.c
q_math.c
C:\Development\reaction\cgame\cg_weapons.c(1600) : warning C4700: local variable 'Offset' used without having been initialized
q_shared.c
ui_shared.c
Linking...
Creating library Debug/cgamex86.lib and object Debug/cgamex86.exp
<h3>Results</h3>
cgamex86.dll - 0 error(s), 0 warning(s)
cgamex86.dll - 0 error(s), 1 warning(s)
</pre>
</body>
</html>

View file

@ -5,6 +5,9 @@
//-----------------------------------------------------------------------------
//
// $Log$
// Revision 1.32 2002/04/03 03:13:16 blaze
// NEW BREAKABLE CODE - will break all old breakables(wont appear in maps)
//
// Revision 1.31 2002/03/31 03:31:24 jbravo
// Compiler warning cleanups
//
@ -1410,6 +1413,7 @@ char *eventnames[] = {
"EV_BREAK_GLASS1", // Blaze: Breakable glass
"EV_BREAK_GLASS2",
"EV_BREAK_GLASS3",
"EV_CHIP_GLASS", //Blaze: this even just breaks it a little bit.
"EV_SCOREPLUM", // score plum
//#ifdef MISSIONPACK

View file

@ -5,6 +5,9 @@
//-----------------------------------------------------------------------------
//
// $Log$
// Revision 1.54 2002/04/03 03:13:16 blaze
// NEW BREAKABLE CODE - will break all old breakables(wont appear in maps)
//
// Revision 1.53 2002/03/30 17:37:48 jbravo
// Added damage tracking to the server. Added zcam flic mode. cleaned up g_damage.
//
@ -125,6 +128,9 @@
#define DLIGHT_PULSE 4
#define DLIGHT_STROBE 8
//Blaze: Max number of breakables
#define RQ3_MAX_BREAKABLES 10
//Old debris definitions
//Elder: debris bit parms to pass to break_glass - maybe I should enum this?
/*
@ -875,8 +881,8 @@ typedef enum {
EV_FOOTWADE,
EV_SWIM,
// JBravo: for func_explosive
EV_GIB_GLASS,
//Blaze: For exploding breakables
EV_EXPLODE_BREAKABLE,
EV_STEP_4,
EV_STEP_8,
@ -976,7 +982,8 @@ typedef enum {
EV_BREAK_GLASS1, // Blaze: Breakable glass
EV_BREAK_GLASS2,
EV_BREAK_GLASS3,
EV_SCOREPLUM, // score plum
EV_CHIP_GLASS, //Blaze: this even just breaks it a little bit.
EV_SCOREPLUM, // score plum
//#ifdef MISSIONPACK
EV_PROXIMITY_MINE_STICK,

View file

@ -5,6 +5,9 @@
//-----------------------------------------------------------------------------
//
// $Log$
// Revision 1.69 2002/04/03 03:13:16 blaze
// NEW BREAKABLE CODE - will break all old breakables(wont appear in maps)
//
// Revision 1.68 2002/04/02 20:23:12 jbravo
// Bots dont get to use any specmode other than FREE and the recive radio cmds
// as text and not sounds.
@ -104,7 +107,7 @@
//-----------------------------------------------------------------------------
// Copyright (C) 1999-2000 Id Software, Inc.
//
#define __ZCAM__
#include "g_local.h"
// JBravo: need TP functions
#include "g_teamplay.h"

View file

@ -5,6 +5,9 @@
//-----------------------------------------------------------------------------
//
// $Log$
// Revision 1.60 2002/04/03 03:13:16 blaze
// NEW BREAKABLE CODE - will break all old breakables(wont appear in maps)
//
// Revision 1.59 2002/04/02 20:23:12 jbravo
// Bots dont get to use any specmode other than FREE and the recive radio cmds
// as text and not sounds.
@ -125,6 +128,9 @@
// JBravo: fixme. Hack to use SelectInitialSpawnPoint() in ClientSpawn.
gentity_t *SelectInitialSpawnPoint( vec3_t origin, vec3_t angles );
//Blaze:for the breakable code
char rq3_breakables[RQ3_MAX_BREAKABLES][80];
#define RQ3_NONAMEPLAYER "Nameless"
// g_client.c -- client functions that don't happen every frame
@ -1096,6 +1102,27 @@ int G_SendCheatVars(int clientNum)
}
return qtrue;
}
/*
===============
G_SendBreakableInfo
sends out info to the clients about the breakables to load
===============
*/
int G_SendBreakableInfo(int clientNum)
{
int i;
char cl_breakableinfo[128];
for (i=0;i< RQ3_MAX_BREAKABLES; i++)
{
if ( (strcmp(rq3_breakables[i],"") ) )
{
Com_sprintf(cl_breakableinfo, sizeof(cl_breakableinfo), "breakable %d %s\n",i,rq3_breakables[i]);
trap_SendServerCommand(clientNum, va("%s",cl_breakableinfo));
}
}
return 0;
}
/*
===========
@ -1205,6 +1232,16 @@ char *ClientConnect( int clientNum, qboolean firstTime, qboolean isBot ) {
RQ3_SpectatorMode(ent);
}
//Blaze: Send out the breakable names to the clients
if (!isBot && G_SendBreakableInfo(clientNum))
{
Com_Printf("Error sending breakable info to client\n");
}
// for statistics
// client->areabits = areabits;
// if ( !client->areabits )
// client->areabits = G_Alloc( (trap_AAS_PointReachabilityAreaIndex( NULL ) + 7) / 8 );
return NULL;
}

View file

@ -5,6 +5,9 @@
//-----------------------------------------------------------------------------
//
// $Log$
// Revision 1.56 2002/04/03 03:13:16 blaze
// NEW BREAKABLE CODE - will break all old breakables(wont appear in maps)
//
// Revision 1.55 2002/03/31 03:31:24 jbravo
// Compiler warning cleanups
//
@ -1455,9 +1458,14 @@ void G_Damage( gentity_t *targ, gentity_t *inflictor, gentity_t *attacker,
}
//Blaze: If we shot a breakable item subtract the damage from its health and try to break it
if (targ->s.eType == ET_BREAKABLE) {
targ->health -= damage;
G_BreakGlass(targ, point, mod);
if ( targ->s.eType == ET_BREAKABLE )
{
if (!targ->unbreakable)
{
targ->health -= damage;
}
G_BreakGlass( targ, inflictor, attacker, point, mod, damage );
return;
}
@ -1523,6 +1531,9 @@ void G_Damage( gentity_t *targ, gentity_t *inflictor, gentity_t *attacker,
//Elder: do some calculation here?
knockback = 400;
break;
case MOD_TRIGGER_HURT:
knockback = (int)(0.75 * damage);
break;
default:
G_Printf("G_Damage: Received unknown MOD - using default knockback\n");
knockback = 50;
@ -1660,7 +1671,7 @@ void G_Damage( gentity_t *targ, gentity_t *inflictor, gentity_t *attacker,
// Elder: removed M3, handcannon, and grenades from location damage code
if (take && (mod == MOD_M3 || mod == MOD_HANDCANNON ||
mod == MOD_GRENADE || mod == MOD_GRENADE_SPLASH)) {
mod == MOD_GRENADE || mod == MOD_GRENADE_SPLASH || mod == MOD_TRIGGER_HURT)) {
bleeding = 1;
instant_dam = 0;
@ -2062,10 +2073,11 @@ qboolean G_RadiusDamage ( vec3_t origin, gentity_t *attacker, float damage, floa
if ( dist > radius ) {
continue;
}
//Blaze: lets use the q3 damage because it works the same for grenades, but lets breakables work better.
// Q2 radius damage
points = damage - 0.5f * dist;
//points = damage - 0.5f * dist;
// Q3 radius damage
//points = damage * ( 1.0 - dist / radius );
points = damage * ( 1.0 - dist / radius );
//Elder: reduce grenade damage if crouching
if (ent->r.maxs[2] < 20)
@ -2073,7 +2085,7 @@ qboolean G_RadiusDamage ( vec3_t origin, gentity_t *attacker, float damage, floa
points = points * 0.5f; // hefty reduction in damage
}
if( CanDamage (ent, origin) ) {
if( CanDamage (ent, origin) ) {
if( LogAccuracyHit( ent, attacker ) ) {
hitClient = qtrue;
}

View file

@ -5,6 +5,9 @@
//-----------------------------------------------------------------------------
//
// $Log$
// Revision 1.64 2002/04/03 03:13:16 blaze
// NEW BREAKABLE CODE - will break all old breakables(wont appear in maps)
//
// Revision 1.63 2002/04/02 00:56:18 jbravo
// Removed the zcam defines again and did some cleanups
//
@ -249,11 +252,20 @@ struct gentity_s {
void (*use)(gentity_t *self, gentity_t *other, gentity_t *activator);
void (*pain)(gentity_t *self, gentity_t *attacker, int damage);
void (*die)(gentity_t *self, gentity_t *inflictor, gentity_t *attacker, int damage, int mod);
int pain_debounce_time;
int fly_sound_debounce_time; // wind tunnel
int last_move_time;
int health;
qboolean takedamage;
int pain_debounce_time;
int fly_sound_debounce_time; // wind tunnel
int last_move_time;
int health;
//Blaze: holds if we can "chip" off peices
qboolean chippable;
//true if we cant break it
qboolean unbreakable;
//true if it's explosive
qboolean explosive;
qboolean takedamage;
int damage;
int splashDamage; // quad will increase this without increasing radius
int splashRadius;
@ -283,6 +295,7 @@ struct gentity_s {
};
typedef enum {
CON_DISCONNECTED,
CON_CONNECTING,
@ -791,7 +804,7 @@ void DropPortalSource( gentity_t *ent );
void DropPortalDestination( gentity_t *ent );
#endif
void G_BreakGlass( gentity_t *ent, vec3_t point, int mod );//Blaze: Breakable glass
void G_BreakGlass( gentity_t *ent, gentity_t *inflictor, gentity_t *attacker, vec3_t point, int mod, int damage );//Blaze: Breakable glass
void G_RunDlight ( gentity_t *ent ); // Elder: dlight running
void G_EvaluateTrajectory( const trajectory_t *tr, int atTime, vec3_t result );
void G_EvaluateTrajectoryDelta( const trajectory_t *tr, int atTime, vec3_t result );
@ -838,6 +851,8 @@ void InitBodyQue (void);
void ClientSpawn( gentity_t *ent );
//Blaze: for the cheat vars stuff
int G_SendCheatVars(int);
//Blaze: for the breakable stuff
int G_SendBreakableInfo(int);
void player_die (gentity_t *self, gentity_t *inflictor, gentity_t *attacker, int damage, int mod);
void AddScore( gentity_t *ent, vec3_t origin, int score );
void CalculateRanks( void );

View file

@ -5,6 +5,9 @@
//-----------------------------------------------------------------------------
//
// $Log$
// Revision 1.26 2002/04/03 03:13:16 blaze
// NEW BREAKABLE CODE - will break all old breakables(wont appear in maps)
//
// Revision 1.25 2002/03/31 03:31:24 jbravo
// Compiler warning cleanups
//
@ -42,6 +45,9 @@
#include "g_local.h"
extern char rq3_breakables[RQ3_MAX_BREAKABLES][80];
void G_ExplodeMissile( gentity_t *ent );
/*QUAKED func_group (0 0 0) ?
Used to group brushes together just for editor convenience. They are turned into normal brushes by the utilities.
@ -413,75 +419,95 @@ Fires at either the target or the current direction.
//void SP_shooter_grenade( gentity_t *ent ) {
// InitShooter( ent, WP_GRENADE_LAUNCHER);
//}
// Blaze: adding for func_breakable explosions
void func_breakable_explode( gentity_t *self , vec3_t pos ) {
int eParam;
gentity_t *tent;
// GibEntity( self, 0 );
eParam = self->s.eventParm;
tent = G_TempEntity2( pos, EV_EXPLODE_BREAKABLE, eParam);
self->takedamage = qfalse;
self->s.eType = ET_INVISIBLE;
self->r.contents = 0;
self->s.solid = 0;
}
// Blaze: adding for func_breakable explosions
void func_breakable_die( gentity_t *self, gentity_t *inflictor, gentity_t *attacker, int damage, int meansOfDeath )
{
G_RadiusDamage(self->s.origin,attacker,self->damage,self->damage_radius,self, meansOfDeath);
func_breakable_explode( self , self->s.origin );
G_ExplodeMissile(self);
// radius damage
}
//Blaze: Breakable glasss
//Elder: Breakable anything!* -- we define, that is
/*QUAKED func_breakable (1 0 0) (-16 -16 -16) (16 16 16)
Explodes any defined type of debris
"health" overrides the default health value of 5
"debris" overrides the default glass shards
0 - glass
1 - wood
2 - metal
3 - ceramics
4 - paper
5 - brick
6 - concrete
"amount" overrides the default quantity
0 - small: about 10 pieces
1 - medium: about 25 pieces
2 - large: about 50 pieces
3 - tons (watch out when using this)
"variation" (0 to 3) allows you to pick one of 4 variations
*/
/*QUAKED func_breakable (0 .5 .8) ? CHIPPABLE UNBREAKABLE EXPLOSIVE
Breakable object entity that breaks, chips or explodes when damaged.
-------- KEYS --------
health : determines the strength of the glass (default 5).
id : a unique identification. Each type of breakable in a given map needs to have a separate id. Valid values are 0 through 63.
type : type of breakable. See notes below.
amount : sets the number of fragments to generate when the entity breaks. 0 ~ 10 pieces; 1 ~ 25 pieces; 2 ~ 50 pieces; 3 ~ lots of pieces (default 0).
damage : sets the amount of damage dealt to nearbly players if the entity is made to be explosive (default 100).
damage_radius : sets the maximum distance from the explosion players will take damage (default 128).
-------- SPAWNFLAGS --------
CHIPPABLE : little pieces will spawn when the entity is shot.
UNBREAKABLE : entity will never break. To make the entity chip, but never break, check the first two spawnflags. To make the entity chip and eventually break, only set the first spawnflag.
EXPLOSIVE : entity will explode.
-------- NOTES --------
Breakables are defined in sets by the 'type' key (e.g. type : glass, type : wood). Each type used in a map must be given a unique id number. Each entity of a particular type must have the same id number (i.e. if your first glass breakable has id : 1, then every glass breakable must have id : 1). To add custom breakables, use this format:
Models: breakables/type/models/break1.md3, breakables/type/models/break2.md3, breakables/type/models/break3.md3
Type is the value set in the type key. No more, no less than three models are required. The names must be break#. Texture/shader information is contained in the .md3 file just like regular mapobjects.
Sounds: breakables/type/sounds/break1.wav, breakables/type/sounds/break2.wav, breakables/type/sounds/break3.wav, breakables/type/sounds/explosion.wav
Type is the value set in the type key. No more, no less than three break sounds are required. The names must be break#. If the entity will be exploding (explosive : 1), then the explosion.wav sound must be included as well.
Explosion graphic: breakables/type/explosion/texture
Type is the value set in the type key. Texture is any texture(s) referenced by the explosion shader. The shader script should be added to yourmap.shader.
If you wish to add a custom breakable to your map, please include your mapname (or perhaps 3 letters of it) in the type name to prevent conflicts (i.e. don't use 'brick', use 'tequila_brick' or just 'teq_brick'). See the breakables folder included in Reaction Quake 3 for the proper format.
*/
void SP_func_breakable( gentity_t *ent ) {
int health;
int amount;
int variation;
int debris;
int temp;
int id;
int temp;
int damage;
int damage_radius;
char *name;
// Make it appear as the brush
trap_SetBrushModel( ent, ent->model );
// Make it appear as the brush
trap_SetBrushModel( ent, ent->model );
// Setup health of breakable
G_SpawnInt( "health", "0", &health );
if( health <= 0 )
health = 5;
G_SpawnInt( "health", "0", &health );
if( health <= 0 ) health = 5;
G_SpawnInt("damage","170", &damage);
ent->damage = damage;
G_SpawnInt("damage_radius","340", &damage_radius);
ent->damage_radius = damage_radius;
// Setup debris type
G_SpawnInt( "debris", "0", &temp );
switch (temp)
{
case 0:
debris = RQ3_DEBRIS_GLASS;
break;
case 1:
debris = RQ3_DEBRIS_WOOD;
break;
case 2:
debris = RQ3_DEBRIS_METAL;
break;
case 3:
debris = RQ3_DEBRIS_CERAMIC;
break;
case 4:
debris = RQ3_DEBRIS_PAPER;
break;
case 5:
debris = RQ3_DEBRIS_BRICK;
break;
case 6:
debris = RQ3_DEBRIS_CONCRETE;
break;
default:
debris = RQ3_DEBRIS_GLASS;
break;
}
// Setup amount type
G_SpawnInt( "amount", "0", &temp );
G_SpawnInt( "amount", "0", &temp );
switch (temp)
{
case 0:
@ -500,43 +526,79 @@ void SP_func_breakable( gentity_t *ent ) {
amount = RQ3_DEBRIS_MEDIUM;
break;
}
// Setup variation type
G_SpawnInt( "variation", "0", &temp);
switch (temp)
{
case 0:
variation = 0;
break;
case 1:
variation = RQ3_DEBRIS_VAR1;
break;
case 2:
variation = RQ3_DEBRIS_VAR2;
break;
case 3:
variation = RQ3_DEBRIS_VAR1|RQ3_DEBRIS_VAR2;
break;
default:
variation = 0;
break;
}
if ( ent->spawnflags & 1)
{
ent->chippable = qtrue;
}
else
{
ent->chippable = qfalse;
}
if ( ent->spawnflags & 2)
{
ent->unbreakable = qtrue;
}
else
{
ent->unbreakable = qfalse;
}
if ( ent->spawnflags & 4)
{
ent->explosive = qtrue;
}
else
{
ent->explosive = qfalse;
}
if ( !ent->damage_radius )
{
ent->damage_radius=GRENADE_SPLASH_RADIUS;
}
G_SpawnInt( "id","0", &id);
if (id < 0 || id >= RQ3_MAX_BREAKABLES )
{
G_Printf("^2ERROR: ID too high\n");
G_FreeEntity( ent );
return;
}
if (G_SpawnString( "name", "", &name) )
{
Q_strncpyz(rq3_breakables[id],name,80);
}
else
{
G_Printf("^2ERROR: broken breakable name (%s)\n", rq3_breakables[id]);
G_FreeEntity( ent );
return;
}
amount = amount << 6;
id = id & 0x0FFF;
//Elder: merge the bits
ent->s.eventParm = amount|variation|debris;
ent->health = health;
ent->takedamage = qtrue;
ent->s.eventParm = amount | id ;
// Let it know it is a breakable object
ent->s.eType = ET_BREAKABLE;
ent->health = health;
ent->takedamage = qtrue;
// If the mapper gave it a model, use it
if ( ent->model2 ) {
ent->s.modelindex2 = G_ModelIndex( ent->model2 );
}
trap_LinkEntity (ent);
ent->s.origin[0] = ent->r.mins[0] + (0.5 * (ent->r.maxs[0] - ent->r.mins[0]));
ent->s.origin[1] = ent->r.mins[1] + (0.5 * (ent->r.maxs[1] - ent->r.mins[1]));
ent->s.origin[2] = ent->r.mins[2] + (0.5 * (ent->r.maxs[2] - ent->r.mins[2]));
// Let it know it is a breakable object
ent->s.eType = ET_BREAKABLE;
// If the mapper gave it a model, use it
if ( ent->model2 ) {
ent->s.modelindex2 = G_ModelIndex( ent->model2 );
}
trap_LinkEntity (ent);
}
@ -548,7 +610,7 @@ Create/process a breakable event entity
Original by inolen, heavy modifications by Elder
=================
*/
void G_BreakGlass( gentity_t *ent, vec3_t point, int mod )
void G_BreakGlass( gentity_t *ent, gentity_t *inflictor, gentity_t *attacker, vec3_t point, int mod, int damage )
{
gentity_t *tent;
vec3_t size;
@ -565,11 +627,11 @@ void G_BreakGlass( gentity_t *ent, vec3_t point, int mod )
//This way, the mappers can use a single func_breakable
//while we process it on the server-side.
//Places to stuff: eventParm
eParm = ent->s.eventParm;
if( ent->health <= 0 ) {
//G_Printf("Original eParm: %i \n", ent->s.eventParm);
//Copy the first four bits and strip them out of the original
eParm = ent->s.eventParm & 15;
/* eParm = ent->s.eventParm & 15;
ent->s.eventParm &= ~eParm;
//Shift-op loop
@ -580,7 +642,7 @@ void G_BreakGlass( gentity_t *ent, vec3_t point, int mod )
}
eParm |= ent->s.eventParm;
*/
//eParm should now be under 1 byte and shiftCount >= 0
//G_Printf("New eParm: %i Shifts: %i\n", eParm, shiftCount);
@ -609,6 +671,11 @@ void G_BreakGlass( gentity_t *ent, vec3_t point, int mod )
break;
}
if (ent->explosive)
{
mod = MOD_TRIGGER_HURT;
func_breakable_die(ent, inflictor, attacker, damage, mod);
}
G_FreeEntity( ent );
//G_Printf("%s shift: %i\n", vtos(impactPoint), shiftCount);
switch ( shiftCount )
@ -626,11 +693,61 @@ void G_BreakGlass( gentity_t *ent, vec3_t point, int mod )
G_Error("G_BreakGlass: shiftCount > 2\n");
break;
}
//G_Printf("eType: %i\n", tent->s.event & ~EV_EVENT_BITS);
//Elder: use TempEntity2 to stuff params
//tent = G_TempEntity( center, EV_BREAK_GLASS );
//tent->s.eventParm = eParm;
}
else if(ent->chippable)
{
//Stil has some life left, so chip it
//Copy the first four bits and strip them out of the original
/*eParm = ent->s.eventParm & 15;
ent->s.eventParm &= ~eParm;
//Shift-op loop
while (ent->s.eventParm > 255)
{
shiftCount++;
ent->s.eventParm = ent->s.eventParm >> 4;
}
eParm |= ent->s.eventParm;
*/
//eParm should now be under 1 byte and shiftCount >= 0
//G_Printf("New eParm: %i Shifts: %i\n", eParm, shiftCount);
// Tell the program based on the gun if it was caused by splash damage
switch( mod ) {
//Elder: added + compacted
case MOD_KNIFE:
case MOD_KNIFE_THROWN:
case MOD_MP5:
case MOD_M4:
case MOD_M3:
case MOD_PISTOL:
case MOD_HANDCANNON:
case MOD_AKIMBO:
case MOD_SNIPER:
case MOD_GAUNTLET:
case MOD_KICK:
//Use actual impact point
VectorCopy(point, impactPoint);
break;
default:
//Splash damage weapons: use center of the glass
VectorSubtract(ent->r.maxs, ent->r.mins, size);
VectorScale(size, 0.5, size);
VectorAdd(ent->r.mins, size, impactPoint);
break;
}
//G_FreeEntity( ent );
//G_Printf("%s shift: %i\n", vtos(impactPoint), shiftCount);
tent = G_TempEntity2( impactPoint, EV_CHIP_GLASS, eParm);
}
}

View file

@ -5,6 +5,9 @@
//-----------------------------------------------------------------------------
//
// $Log$
// Revision 1.24 2002/04/03 03:13:16 blaze
// NEW BREAKABLE CODE - will break all old breakables(wont appear in maps)
//
// Revision 1.23 2002/03/31 03:31:24 jbravo
// Compiler warning cleanups
//
@ -2297,31 +2300,9 @@ void SP_func_pendulum(gentity_t *ent) {
ent->s.apos.trDelta[2] = speed;
}
// JBravo: adding for func_explosive
void func_explosive_explode( gentity_t *self , vec3_t pos ) {
int eParam;
// GibEntity( self, 0 );
eParam = self->mass;
G_AddEvent(self, EV_GIB_GLASS, eParam);
// G_Printf("Explode_explode\n" );
self->takedamage = qfalse;
self->s.eType = ET_INVISIBLE;
self->r.contents = 0;
self->s.solid = 0;
}
// JBravo: adding for func_explosive
void func_explosive_die( gentity_t *self, gentity_t *inflictor, gentity_t *attacker, int damage, int meansOfDeath )
{
G_RadiusDamage(self->s.origin,attacker,self->damage,self->damage_radius,self,0);
// G_Printf("%s: explode @ %s\n", self->classname , vtos(self->s.origin) );
G_ExplodeMissile(self);
// radius damage
func_explosive_explode( self , self->s.origin );
}
//Blaze: Merged into func_breakable in g_misc.c
/*
// JBravo: adding for func_explosive
void SP_func_explosive (gentity_t *ent)
{
@ -2347,11 +2328,12 @@ void SP_func_explosive (gentity_t *ent)
InitMover( ent );
// VectorSubtract( ent->r.maxs, ent->r.mins, ent->s.origin );
VectorCopy( ent->s.pos.trBase, ent->s.origin );
VectorCopy( ent->s.pos.trBase, ent->s.origin );*/
/* VectorCopy( ent->s.origin, ent->s.pos.trBase );
VectorCopy( ent->s.pos.trBase, ent->r.currentOrigin );
VectorCopy( ent->s.apos.trBase, ent->r.currentAngles );
VectorCopy( ent->s.origin, ent->r.currentOrigin ); */
/*
ent->s.origin[0] = ent->r.mins[0] + (0.5 * (ent->r.maxs[0] - ent->r.mins[0]));
ent->s.origin[1] = ent->r.mins[1] + (0.5 * (ent->r.maxs[1] - ent->r.mins[1]));
ent->s.origin[2] = ent->r.mins[2] + (0.5 * (ent->r.maxs[2] - ent->r.mins[2]));
@ -2360,7 +2342,8 @@ void SP_func_explosive (gentity_t *ent)
((ent->tension << 8) & 0x0F00) |
((ent->bounce << 4) & 0x00F0) |
((ent->size) & 0x000F);
G_Printf("%d %d %d %d %d\n",((ent->material << 12) & 0xF000),((ent->tension << 8) & 0x0F00),((ent->bounce << 4) & 0x00F0), ((ent->size) & 0x000F), ent->s.powerups);
trap_LinkEntity( ent );
G_Printf("at : %s %s Material (%d)\n", vtos(ent->r.currentAngles), vtos(ent->r.currentOrigin ), ent->material );
}
*/

View file

@ -5,6 +5,9 @@
//-----------------------------------------------------------------------------
//
// $Log$
// Revision 1.14 2002/04/03 03:13:16 blaze
// NEW BREAKABLE CODE - will break all old breakables(wont appear in maps)
//
// Revision 1.13 2002/03/31 03:31:24 jbravo
// Compiler warning cleanups
//
@ -208,9 +211,12 @@ void SP_team_blueobelisk( gentity_t *ent );
void SP_team_redobelisk( gentity_t *ent );
void SP_team_neutralobelisk( gentity_t *ent );
#endif
//void SP_item_botroam( gentity_t *ent ) {};
void SP_item_botroam( gentity_t *ent ) {};
//Blaze: merged func_explosive into func_breakable
// JBravo: adding explosive
void SP_func_explosive (gentity_t *self);
//void SP_func_explosive (gentity_t *self);
spawn_t spawns[] = {
// info entities don't do anything at all, but provide positional
@ -286,8 +292,10 @@ spawn_t spawns[] = {
{"team_blueobelisk", SP_team_blueobelisk},
{"team_neutralobelisk", SP_team_neutralobelisk},
#endif
{"func_explosive", SP_func_explosive}, // JBravo: for explosive.
// {"item_botroam", SP_item_botroam},
//Blaze: Merged func_explosive into func_breakable
// {"func_explosive", SP_func_explosive}, // JBravo: for explosive.
{"item_botroam", SP_item_botroam},
{0, 0}
};

View file

@ -175,6 +175,10 @@ SOURCE=.\g_main.c
# End Source File
# Begin Source File
SOURCE=.\g_matchmode.c
# End Source File
# Begin Source File
SOURCE=.\g_mem.c
# End Source File
# Begin Source File
@ -245,6 +249,14 @@ SOURCE=.\q_shared.c
SOURCE=.\rxn_game.c
# End Source File
# Begin Source File
SOURCE=.\zcam.c
# End Source File
# Begin Source File
SOURCE=.\zcam_target.c
# End Source File
# End Group
# Begin Group "Header Files"
@ -331,6 +343,10 @@ SOURCE=.\g_local.h
# End Source File
# Begin Source File
SOURCE=.\g_matchmode.h
# End Source File
# Begin Source File
SOURCE=.\g_public.h
# End Source File
# Begin Source File
@ -361,6 +377,10 @@ SOURCE=.\surfaceflags.h
SOURCE=.\syn.h
# End Source File
# Begin Source File
SOURCE=.\zcam.h
# End Source File
# End Group
# Begin Group "Resource Files"

View file

@ -6,15 +6,51 @@
--------------------Configuration: game - Win32 Debug--------------------
</h3>
<h3>Command Lines</h3>
Creating temporary file "C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\RSP5C.tmp" with contents
Creating temporary file "C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\RSP2D7.tmp" with contents
[
/nologo /G5 /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "BUILDING_REF_GL" /D "DEBUG" /FR"c:\reactionoutput/" /Fp"c:\reactionoutput/game.pch" /YX /Fo"c:\reactionoutput/" /Fd"c:\reactionoutput/" /FD /c
"C:\Development\reaction\game\ai_chat.c"
"C:\Development\reaction\game\ai_cmd.c"
"C:\Development\reaction\game\ai_dmnet.c"
"C:\Development\reaction\game\ai_dmq3.c"
"C:\Development\reaction\game\ai_main.c"
"C:\Development\reaction\game\ai_team.c"
"C:\Development\reaction\game\ai_vcmd.c"
"C:\Development\reaction\game\bg_misc.c"
"C:\Development\reaction\game\bg_pmove.c"
"C:\Development\reaction\game\bg_slidemove.c"
"C:\Development\reaction\game\g_active.c"
"C:\Development\reaction\game\g_arenas.c"
"C:\Development\reaction\game\g_bot.c"
"C:\Development\reaction\game\g_client.c"
"C:\Development\reaction\game\g_cmds.c"
"C:\Development\reaction\game\g_combat.c"
"C:\Development\reaction\game\g_fileio.c"
"C:\Development\reaction\game\g_items.c"
"C:\Development\reaction\game\g_main.c"
"C:\Development\reaction\game\g_matchmode.c"
"C:\Development\reaction\game\g_mem.c"
"C:\Development\reaction\game\g_misc.c"
"C:\Development\reaction\game\g_missile.c"
"C:\Development\reaction\game\g_mover.c"
"C:\Development\reaction\game\g_session.c"
"C:\Development\reaction\game\g_spawn.c"
"C:\Development\reaction\game\g_svcmds.c"
"C:\Development\reaction\game\g_syscalls.c"
"C:\Development\reaction\game\g_target.c"
"C:\Development\reaction\game\g_team.c"
"C:\Development\reaction\game\g_teamplay.c"
"C:\Development\reaction\game\g_trigger.c"
"C:\Development\reaction\game\g_utils.c"
"C:\Development\reaction\game\g_weapon.c"
"C:\Development\reaction\game\q_math.c"
"C:\Development\reaction\game\q_shared.c"
"C:\Development\reaction\game\rxn_game.c"
"C:\Development\reaction\game\zcam.c"
"C:\Development\reaction\game\zcam_target.c"
]
Creating command line "cl.exe @C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\RSP5C.tmp"
Creating temporary file "C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\RSP5D.tmp" with contents
Creating command line "cl.exe @C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\RSP2D7.tmp"
Creating temporary file "C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\RSP2D8.tmp" with contents
[
kernel32.lib user32.lib winmm.lib /nologo /base:"0x20000000" /subsystem:windows /dll /incremental:yes /pdb:"c:\reactionoutput/qagamex86.pdb" /map:"c:\reactionoutput/qagamex86.map" /debug /machine:I386 /def:".\game.def" /out:"..\Debug/qagamex86.dll" /implib:"c:\reactionoutput/qagamex86.lib"
\reactionoutput\ai_chat.obj
@ -36,6 +72,7 @@ kernel32.lib user32.lib winmm.lib /nologo /base:"0x20000000" /subsystem:windows
\reactionoutput\g_fileio.obj
\reactionoutput\g_items.obj
\reactionoutput\g_main.obj
\reactionoutput\g_matchmode.obj
\reactionoutput\g_mem.obj
\reactionoutput\g_misc.obj
\reactionoutput\g_missile.obj
@ -53,42 +90,61 @@ kernel32.lib user32.lib winmm.lib /nologo /base:"0x20000000" /subsystem:windows
\reactionoutput\q_math.obj
\reactionoutput\q_shared.obj
\reactionoutput\rxn_game.obj
\reactionoutput\zcam.obj
\reactionoutput\zcam_target.obj
]
Creating command line "link.exe @C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\RSP5D.tmp"
Creating command line "link.exe @C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\RSP2D8.tmp"
<h3>Output Window</h3>
Compiling...
ai_chat.c
ai_cmd.c
ai_dmnet.c
C:\Development\reaction\game\ai_dmnet.c(1517) : warning C4013: 'BotMoveTowardsEnt' undefined; assuming extern returning int
C:\Development\reaction\game\ai_dmnet.c(2408) : warning C4013: 'Cmd_Bandage' undefined; assuming extern returning int
ai_dmq3.c
C:\Development\reaction\game\ai_dmq3.c(2132) : warning C4013: 'Cmd_Bandage' undefined; assuming extern returning int
ai_main.c
ai_team.c
ai_vcmd.c
bg_misc.c
bg_pmove.c
bg_slidemove.c
g_active.c
g_arenas.c
g_bot.c
g_client.c
g_cmds.c
g_combat.c
C:\Development\reaction\game\g_combat.c(1359) : warning C4101: 'max' : unreferenced local variable
g_fileio.c
g_items.c
g_main.c
g_matchmode.c
g_mem.c
g_misc.c
g_missile.c
g_mover.c
g_session.c
g_spawn.c
g_svcmds.c
g_syscalls.c
g_target.c
g_team.c
g_teamplay.c
g_trigger.c
g_utils.c
g_weapon.c
C:\Development\reaction\game\g_weapon.c(1436) : warning C4101: 'i' : unreferenced local variable
C:\Development\reaction\game\g_weapon.c(2409) : warning C4101: 'tent' : unreferenced local variable
C:\Development\reaction\game\g_weapon.c(2410) : warning C4101: 'fogStart' : unreferenced local variable
C:\Development\reaction\game\g_weapon.c(2405) : warning C4101: 'tr2' : unreferenced local variable
q_math.c
q_shared.c
rxn_game.c
zcam.c
zcam_target.c
Linking...
Creating library c:\reactionoutput/qagamex86.lib and object c:\reactionoutput/qagamex86.exp
g_active.obj : error LNK2001: unresolved external symbol _camera_think
g_client.obj : error LNK2001: unresolved external symbol _camera_begin
g_client.obj : error LNK2001: unresolved external symbol _camera_disconnect
g_cmds.obj : error LNK2001: unresolved external symbol _camera_cmd
g_cmds.obj : error LNK2001: unresolved external symbol _Ref_Resign
g_cmds.obj : error LNK2001: unresolved external symbol _Ref_Command
g_cmds.obj : error LNK2001: unresolved external symbol _Ref_Auth
g_cmds.obj : error LNK2001: unresolved external symbol _MM_Sub_f
g_cmds.obj : error LNK2001: unresolved external symbol _MM_Ready_f
g_cmds.obj : error LNK2001: unresolved external symbol _MM_Captain_f
g_main.obj : error LNK2001: unresolved external symbol _camera_init
g_main.obj : error LNK2001: unresolved external symbol _camera_shutdown
g_main.obj : error LNK2001: unresolved external symbol _MM_RunFrame
g_session.obj : error LNK2001: unresolved external symbol _camera_state_save
g_session.obj : error LNK2001: unresolved external symbol _camera_state_load
..\Debug/qagamex86.dll : fatal error LNK1120: 15 unresolved externals
Error executing link.exe.
<h3>Results</h3>
qagamex86.dll - 16 error(s), 5 warning(s)
qagamex86.dll - 0 error(s), 3 warning(s)
</pre>
</body>
</html>