mirror of
https://github.com/Q3Rally-Team/q3rally.git
synced 2024-11-24 04:41:23 +00:00
Added more options to func_breakable
!!! use the new entities.def !!!
This commit is contained in:
parent
1fe5dba1f0
commit
e0418bd2d4
8 changed files with 107 additions and 50 deletions
|
@ -1334,16 +1334,17 @@ static void CG_RegisterGraphics( void ) {
|
|||
// wall marks
|
||||
cgs.media.bulletMarkShader = trap_R_RegisterShader( "gfx/damage/bullet_mrk" );
|
||||
cgs.media.burnMarkShader = trap_R_RegisterShader( "gfx/damage/burn_med_mrk" );
|
||||
// Q3Rally Code Start
|
||||
cgs.media.bioMarkShader = trap_R_RegisterShader( "gfx/damage/bio_mark" );
|
||||
cgs.media.oilMarkShader = trap_R_RegisterShader( "gfx/damage/oil_mark" );
|
||||
cgs.media.sparkShader = trap_R_RegisterShader( "gfx/damage/spark" );
|
||||
// Q3Rally Code END
|
||||
cgs.media.holeMarkShader = trap_R_RegisterShader( "gfx/damage/hole_lg_mrk" );
|
||||
cgs.media.energyMarkShader = trap_R_RegisterShader( "gfx/damage/plasma_mrk" );
|
||||
cgs.media.shadowMarkShader = trap_R_RegisterShader( "markShadow" );
|
||||
cgs.media.wakeMarkShader = trap_R_RegisterShader( "wake" );
|
||||
cgs.media.bloodMarkShader = trap_R_RegisterShader( "bloodMark" );
|
||||
|
||||
//explosion effect
|
||||
cgs.media.rocketExplosionShader = trap_R_RegisterShader("rocketExplosion");
|
||||
|
||||
// register the inline models
|
||||
cgs.numInlineModels = trap_CM_NumInlineModels();
|
||||
|
|
|
@ -763,7 +763,7 @@ void CG_RegisterWeapon( int weaponNum ) {
|
|||
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" );
|
||||
//cgs.media.rocketExplosionShader = trap_R_RegisterShader( "rocketExplosion" );
|
||||
break;
|
||||
|
||||
#ifdef MISSIONPACK
|
||||
|
|
|
@ -1434,7 +1434,7 @@ if (cinTable[currentHandle].fileType == FT_OGM)
|
|||
cinTable[currentHandle].buf = Cin_OGM_GetOutput(&newW, &newH);
|
||||
|
||||
if (newW != cinTable[currentHandle].CIN_WIDTH)
|
||||
{
|
||||
{
|
||||
cinTable[currentHandle].CIN_WIDTH = newW;
|
||||
resolutionChange = qtrue;
|
||||
}
|
||||
|
@ -1693,7 +1693,7 @@ int CIN_PlayCinematic( const char *arg, int x, int y, int w, int h, int systemBi
|
|||
*/
|
||||
|
||||
if (cinTable[currentHandle].alterGameState) {
|
||||
CL_ShowMainMenu();
|
||||
VM_Call( uivm, UI_SET_ACTIVE_MENU, UIMENU_NONE );
|
||||
} else {
|
||||
cinTable[currentHandle].playonwalls = cl_inGameVideo->integer;
|
||||
}
|
||||
|
|
|
@ -764,9 +764,7 @@ typedef enum {
|
|||
MOD_ROCKET_SPLASH,
|
||||
MOD_PLASMA,
|
||||
MOD_PLASMA_SPLASH,
|
||||
// Q3Rally Code Start
|
||||
MOD_FLAME_THROWER,
|
||||
// Q3Rally Code End
|
||||
MOD_RAILGUN,
|
||||
MOD_LIGHTNING,
|
||||
MOD_BFG,
|
||||
|
@ -787,7 +785,6 @@ typedef enum {
|
|||
MOD_KAMIKAZE,
|
||||
MOD_JUICED,
|
||||
#endif
|
||||
// STONELANCE
|
||||
MOD_UPSIDEDOWN,
|
||||
MOD_BO_SHOCKS,
|
||||
MOD_CAR_COLLISION,
|
||||
|
@ -799,8 +796,8 @@ typedef enum {
|
|||
MOD_MINE,
|
||||
MOD_POISON,
|
||||
MOD_FIRE,
|
||||
// END
|
||||
MOD_GRAPPLE
|
||||
MOD_GRAPPLE,
|
||||
MOD_BREAKABLE_SPLASH
|
||||
} meansOfDeath_t;
|
||||
|
||||
|
||||
|
|
|
@ -1869,57 +1869,110 @@ BREAKABLE
|
|||
===============================================================================
|
||||
*/
|
||||
|
||||
void Think_Breakable( gentity_t *ent ) {
|
||||
Break_Breakable( ent, ent->activator );
|
||||
}
|
||||
|
||||
//other is the player that broke the func_breakable
|
||||
void Break_Breakable(gentity_t *ent, gentity_t *other) {
|
||||
vec3_t size;
|
||||
vec3_t center;
|
||||
int count = 0;
|
||||
int spawnflags = 0;
|
||||
gentity_t *tmp;
|
||||
//int type = EV_EMIT_DEBRIS_LIGHT;
|
||||
vec3_t size;
|
||||
vec3_t center;
|
||||
int count = 0;
|
||||
int sound = 0;
|
||||
int spawnflags = 0;
|
||||
gentity_t *tmp, *tmp2;
|
||||
int type = EV_EMIT_DEBRIS_LIGHT;
|
||||
|
||||
// Get the center of the glass (code donated by Perle)
|
||||
VectorSubtract(ent->r.maxs, ent->r.mins, size);
|
||||
if ( other != ent->activator && !strcmp( other->classname, "func_breakable" ) ) {
|
||||
//if the splash damage from another func_breakable is causing this func_breakable to break
|
||||
//then delay the break to get a nice chain explosion effect
|
||||
ent->activator = other;
|
||||
ent->think = Think_Breakable;
|
||||
ent->nextthink = level.time + 400;
|
||||
return;
|
||||
}
|
||||
|
||||
// Get the center of the func_breakable (code donated by Perle)
|
||||
VectorSubtract(ent->r.maxs, ent->r.mins, size);
|
||||
VectorScale(size, 0.5, size);
|
||||
VectorAdd(ent->r.mins, size, center);
|
||||
|
||||
ent->takedamage = qfalse;
|
||||
ent->s.eType = ET_INVISIBLE;
|
||||
G_UseTargets( ent, other );
|
||||
|
||||
ent->takedamage = qfalse;
|
||||
ent->s.eType = ET_INVISIBLE;
|
||||
G_UseTargets( ent, other );
|
||||
|
||||
//need to store properties of the entity in seperate variables because we're going to free the entity
|
||||
if ( ent->count > 0) {
|
||||
count = ent->count;
|
||||
spawnflags = ent->spawnflags;
|
||||
}
|
||||
|
||||
G_FreeEntity( ent );
|
||||
//need to store properties of the entity in separate variables because we're going to free the entity
|
||||
if ( ent->count > 0) {
|
||||
count = ent->count;
|
||||
spawnflags = ent->spawnflags;
|
||||
}
|
||||
|
||||
//spray out debris
|
||||
if ( count > 0 ) {
|
||||
tmp = G_TempEntity( center, PickDebrisType ( spawnflags ) );
|
||||
tmp->s.eventParm = count;
|
||||
}
|
||||
|
||||
|
||||
|
||||
if ( ent->soundPos2 )
|
||||
sound = ent->soundPos2;
|
||||
|
||||
//apply radius damage
|
||||
if ( ent->damage )
|
||||
G_RadiusDamage( center, ent, ent->damage, ent->splashRadius, ent, MOD_BREAKABLE_SPLASH );
|
||||
|
||||
|
||||
//free the entity so it disappears
|
||||
G_FreeEntity( ent );
|
||||
|
||||
|
||||
//spray out debris
|
||||
if ( count > 0 ) {
|
||||
tmp = G_TempEntity( center, PickDebrisType( spawnflags ) );
|
||||
tmp->s.eventParm = count;
|
||||
}
|
||||
|
||||
//play sound
|
||||
if ( sound )
|
||||
{
|
||||
tmp2 = G_TempEntity( center, EV_GENERAL_SOUND );
|
||||
tmp2->s.eventParm = sound;
|
||||
}
|
||||
|
||||
//show explosion effect
|
||||
if (spawnflags & 8192) {
|
||||
G_TempEntity(center, EV_EXPLOSION);
|
||||
}
|
||||
}
|
||||
|
||||
void Use_Breakable (gentity_t *ent, gentity_t *other, gentity_t *activator) {
|
||||
Break_Breakable( ent, activator );
|
||||
}
|
||||
|
||||
/*QUAKED func_breakable (0 .5 .8) ? see PickDebrisType in g_util.c for spawnflags
|
||||
A bmodel that just sits there, doing nothing. It is removed when it received a set amount of damage.
|
||||
"model2" .md3 model to also draw
|
||||
"color" constantLight color
|
||||
"light" constantLight radius
|
||||
"health" the amount of damage required before this entity is removed
|
||||
"model2" .md3 model to also draw
|
||||
"color" constantLight color
|
||||
"light" constantLight radius
|
||||
"health" the amount of damage required before this entity is removed
|
||||
*/
|
||||
void SP_func_breakable( gentity_t *ent ) {
|
||||
trap_SetBrushModel( ent, ent->model );
|
||||
InitMover( ent );
|
||||
VectorCopy( ent->s.origin, ent->s.pos.trBase );
|
||||
VectorCopy( ent->s.origin, ent->r.currentOrigin );
|
||||
ent->takedamage = qtrue;
|
||||
ent->use = 0;
|
||||
ent->r.contents = CONTENTS_SOLID;
|
||||
ent->clipmask = MASK_SOLID;
|
||||
char *noise;
|
||||
|
||||
trap_SetBrushModel( ent, ent->model );
|
||||
InitMover( ent );
|
||||
VectorCopy( ent->s.origin, ent->s.pos.trBase );
|
||||
VectorCopy( ent->s.origin, ent->r.currentOrigin );
|
||||
ent->takedamage = qtrue;
|
||||
ent->use = Use_Breakable;
|
||||
ent->r.contents = CONTENTS_SOLID;
|
||||
ent->clipmask = MASK_SOLID;
|
||||
|
||||
G_SpawnInt( "dmg", "0", &ent->damage );
|
||||
G_SpawnInt( "radius", "120", &ent->splashRadius ); //120 is default splash radius of a rocket
|
||||
|
||||
G_SpawnString("breaksound", "", &noise);
|
||||
if (strlen(noise) > 0) {
|
||||
ent->soundPos2 = G_SoundIndex(noise);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -67,7 +67,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|||
#define BASETA "missionpack"
|
||||
|
||||
#ifndef PRODUCT_VERSION
|
||||
#define PRODUCT_VERSION "v0.4_r518"
|
||||
#define PRODUCT_VERSION "v0.4_r519"
|
||||
#endif
|
||||
|
||||
|
||||
|
@ -1609,7 +1609,7 @@ signed signed_10bit4:10; //-511 to 511
|
|||
unsigned :24; //Do not use
|
||||
unsigned c7:8; //Unsigned char 0 to 255
|
||||
|
||||
//powerups
|
||||
ÿ |