diff --git a/engine/code/cgame/cg_main.c b/engine/code/cgame/cg_main.c index 5f7e7023..bfa0a1de 100644 --- a/engine/code/cgame/cg_main.c +++ b/engine/code/cgame/cg_main.c @@ -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(); diff --git a/engine/code/cgame/cg_weapons.c b/engine/code/cgame/cg_weapons.c index 643a5840..1c22b022 100644 --- a/engine/code/cgame/cg_weapons.c +++ b/engine/code/cgame/cg_weapons.c @@ -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 diff --git a/engine/code/client/cl_cin.c b/engine/code/client/cl_cin.c index 4e0dbbdf..0be0d895 100644 --- a/engine/code/client/cl_cin.c +++ b/engine/code/client/cl_cin.c @@ -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; } diff --git a/engine/code/game/bg_public.h b/engine/code/game/bg_public.h index 3d3d4933..441d3a85 100644 --- a/engine/code/game/bg_public.h +++ b/engine/code/game/bg_public.h @@ -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; diff --git a/engine/code/game/g_mover.c b/engine/code/game/g_mover.c index 7b61399b..d0de82ca 100644 --- a/engine/code/game/g_mover.c +++ b/engine/code/game/g_mover.c @@ -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); + } } /* diff --git a/engine/code/qcommon/q_shared.h b/engine/code/qcommon/q_shared.h index 81862195..8f706595 100644 --- a/engine/code/qcommon/q_shared.h +++ b/engine/code/qcommon/q_shared.h @@ -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 +ÿpo??ps unsigned :16; //Do not use signed s2:16; //Signed -32767 to 32767 diff --git a/q3rallycode.ppr b/q3rallycode.ppr index c796c51e..9bb15e04 100644 Binary files a/q3rallycode.ppr and b/q3rallycode.ppr differ diff --git a/tools/radiant-config/radiant15-netradiant/q3rally.game/baseq3r/entities.def b/tools/radiant-config/radiant15-netradiant/q3rally.game/baseq3r/entities.def index a0a76af5..94825a64 100644 --- a/tools/radiant-config/radiant15-netradiant/q3rally.game/baseq3r/entities.def +++ b/tools/radiant-config/radiant15-netradiant/q3rally.game/baseq3r/entities.def @@ -313,18 +313,20 @@ Target this entity with a misc_model to have the model attached to the entity (s //============================================================================= -/*QUAKED func_breakable (0 .5 .8) ? LIGHT_DEBRIS DARK_DEBRIS LIGHT_LARGE_DEBRIS DARK_LARGE_DEBRIS WOOD_DEBRIS FLESH_DEBRIS GLASS_DEBRIS STONE_DEBRIS +/*QUAKED func_breakable (0 .5 .8) ? LIGHT_DEBRIS DARK_DEBRIS LIGHT_LARGE_DEBRIS DARK_LARGE_DEBRIS WOOD_DEBRIS FLESH_DEBRIS GLASS_DEBRIS STONE_DEBRIS - - NO_PLAYER NO_BOTS NO_SHOOTER EXPLOSION A static entity that is removed when it receives a set amount of damage. -------- KEYS -------- health : The entire entity is removed once this amount of damages has been inflicted to it. count : The entity will spew out this number of chunks of debris when it's broken (default = 0). +dmg : Amount of splashdamage the func_breakable will deal when it is removed (default = 0). +radius : The radius in which the splashdamage is dealt (default = 120). +breaksound : Sound to play when it's broken (by default, no sound will be played) target : Targetted entity will be triggered once the func_breakable is destroyed. target2 : Targetted entity will be triggered once the func_breakable is destroyed. +targetname : activating entity points to this. +targetname2 : activating entity points to this. light : constantLight radius of .md3 model included with entity. Has no effect on the entity's brushes (default 0). color : constantLight color of .md3 model included with entity. Has no effect on the entity's brushes (default 1 1 1). -notfree : when set to 1, entity will not spawn in "Free for all" and "Tournament" modes. -notteam : when set to 1, entity will not spawn in "Teamplay" and "CTF" modes. -notsingle : when set to 1, entity will not spawn in Single Player mode. -------- Q3MAP2 KEYS -------- _targetname : Used to attach a misc_model entity to this entity. _lightmapscale : Floating point value scaling the resolution of lightmaps on brushes/patches in this entity (default 1.0). @@ -344,6 +346,10 @@ WOOD_DEBRIS : Emit pieces of wooden debris. FLESH_DEBRIS : Emit gibs. GLASS_DEBRIS : Emit shards of glass. STONE_DEBRIS : Emit chunks of stone. +NO_PLAYER : The player cannot damage the func_breakable. +NO_BOTS : Bots cannot damage the func_breakable. +NO_SHOOTER : Shooter entities cannot damage the func_breakable. +EXPLOSION : When the func_breakable is destroyed, an explosion effect is shown. -------- NOTES -------- Target this entity with a misc_model to have the model attached to the entity (set the model's "target" key to the same value as this entity's "targetname").