Jump to content

Different Visual Efx for Bryar, blaster and jawa weapon.


Go to solution Solved by Asgarath83,

Recommended Posts

Posted

I have a little coding trouble.

time ago i edited cg_weapons.cpp

about:

 

 

        cgs.effects.bryarShotEffect = theFxScheduler.RegisterEffect("bow/shot");
        theFxScheduler.RegisterEffect("bow/NPCshot");
        cgs.effects.bryarPowerupShotEffect = theFxScheduler.RegisterEffect("bow/crackleShot");
        cgs.effects.bryarWallImpactEffect = theFxScheduler.RegisterEffect("bow/wall_impact");
        cgs.effects.bryarWallImpactEffect2 = theFxScheduler.RegisterEffect("bow/wall_impact2");
        cgs.effects.bryarWallImpactEffect3 = theFxScheduler.RegisterEffect("bow/wall_impact3");
        cgs.effects.bryarFleshImpactEffect = theFxScheduler.RegisterEffect("bow/flesh_impact");
        break;


        cgs.effects.bryarShotEffect = theFxScheduler.RegisterEffect("bryar/shot");
        cgs.effects.bryarPowerupShotEffect = theFxScheduler.RegisterEffect("bryar/crackleShot");
        cgs.effects.bryarWallImpactEffect = theFxScheduler.RegisterEffect("bryar/wall_impact");
        cgs.effects.bryarWallImpactEffect2 = theFxScheduler.RegisterEffect("bryar/wall_impact2");
        cgs.effects.bryarWallImpactEffect3 = theFxScheduler.RegisterEffect("bryar/wall_impact3");
        cgs.effects.bryarFleshImpactEffect = theFxScheduler.RegisterEffect("bryar/flesh_impact");
        break;


        cgs.effects.bryarShotEffect            = theFxScheduler.RegisterEffect( "howler/shot" );
                                            theFxScheduler.RegisterEffect( "howler/NPCshot" );
        cgs.effects.bryarPowerupShotEffect    = theFxScheduler.RegisterEffect( "howler/crackleShot" );
        cgs.effects.bryarWallImpactEffect    = theFxScheduler.RegisterEffect( "howler/wall_impact" );
        cgs.effects.bryarWallImpactEffect2    = theFxScheduler.RegisterEffect( "howler/wall_impact2" );
        cgs.effects.bryarWallImpactEffect3    = theFxScheduler.RegisterEffect( "howler/wall_impact3" );
        cgs.effects.bryarFleshImpactEffect    = theFxScheduler.RegisterEffect( "howler/flesh_impact" );
  

this is my edit, doing that, into the game, NPCs and player can use different visual efx for shoot with JAWA weapon, BRYAR and BLASTER pistol. on JKA defaulting code, the 3 weapons shot with the same visual ex.

 

the problem is when the player get the WP_BLASTER_PISTOL. at this point, also the NPC that have BRYAR or JAWA as weapon shoots with blaster_pistol efx of shoot and wall and flesh impact.

i fixed the crash of Jawa weapon years ago and i can equip it also with player using give all weapons, selecting a shooting weapons no saber weapons and using "give weapon_jawa" as consolle command, it not crash, it's like a repeater blaster pistol.

So, how can i fix it into the code? what is missing for avoid that equiped player weapon change also the efx of Npc equiped weapons?

i wanna simply that bryar, blaster and jawa weapons got 3 different visual efx. with muzzle flash efx i can edit weapons.dat but for the other i need a little help to fix this bug.

@@Serenity937 @@ensiform @@eezstreet.

Posted

Okay @@eezstreet, i check ASAP. ^^

PS : sorry for bad pasting of the code, now i past better the part edited.

case WP_BRYAR_PISTOL:

        cgs.effects.bryarShotEffect = theFxScheduler.RegisterEffect("bow/shot");
        theFxScheduler.RegisterEffect("bow/NPCshot");
        cgs.effects.bryarPowerupShotEffect = theFxScheduler.RegisterEffect("bow/crackleShot");
        cgs.effects.bryarWallImpactEffect = theFxScheduler.RegisterEffect("bow/wall_impact");
        cgs.effects.bryarWallImpactEffect2 = theFxScheduler.RegisterEffect("bow/wall_impact2");
        cgs.effects.bryarWallImpactEffect3 = theFxScheduler.RegisterEffect("bow/wall_impact3");
        cgs.effects.bryarFleshImpactEffect = theFxScheduler.RegisterEffect("bow/flesh_impact");
        break;

case WP_BLASTER_PISTOL:
        cgs.effects.bryarShotEffect = theFxScheduler.RegisterEffect("bryar/shot");
        theFxScheduler.RegisterEffect("bryar/NPCshot");
        cgs.effects.bryarPowerupShotEffect = theFxScheduler.RegisterEffect("bryar/crackleShot");
        cgs.effects.bryarWallImpactEffect = theFxScheduler.RegisterEffect("bryar/wall_impact");
        cgs.effects.bryarWallImpactEffect2 = theFxScheduler.RegisterEffect("bryar/wall_impact2");
        cgs.effects.bryarWallImpactEffect3 = theFxScheduler.RegisterEffect("bryar/wall_impact3");
        cgs.effects.bryarFleshImpactEffect = theFxScheduler.RegisterEffect("bryar/flesh_impact");
        break;

case WP_JAWA:
        cgs.effects.bryarShotEffect            = theFxScheduler.RegisterEffect( "howler/shot" );
        theFxScheduler.RegisterEffect( "howler/NPCshot" );
        cgs.effects.bryarPowerupShotEffect    = theFxScheduler.RegisterEffect( "howler/crackleShot" );
        cgs.effects.bryarWallImpactEffect    = theFxScheduler.RegisterEffect( "howler/wall_impact" );
        cgs.effects.bryarWallImpactEffect2    = theFxScheduler.RegisterEffect( "howler/wall_impact2" );
        cgs.effects.bryarWallImpactEffect3    = theFxScheduler.RegisterEffect( "howler/wall_impact3" );
        cgs.effects.bryarFleshImpactEffect    = theFxScheduler.RegisterEffect( "howler/flesh_impact" );
  

 

Sorry, i got some trouble about spoiler and code fields >.<

Posted

Okay, CGmedia.h contain the definition

 

 

// BRYAR PISTOL
    fxHandle_t    bryarShotEffect;
    fxHandle_t    bryarPowerupShotEffect;
    fxHandle_t    bryarWallImpactEffect;
    fxHandle_t    bryarWallImpactEffect2;
    fxHandle_t    bryarWallImpactEffect3;
    fxHandle_t    bryarFleshImpactEffect;

 

 

It's also called as function on: fx_bryarpistol.cpp.

i not found any other corrispondende into the solution.

theFxScheduler.PlayEffect( cgs.effects.bryarShotEffect, cent->lerpOrigin, forward );

 

let me think @@eezstreet...

what i need is:

1 add on media.h new definition for the new effects.

2: add if on scheduler.playeffect related to bryar pistol, blaster pistol and jawa weapon code. so i need to find also the code related to these misterious 2 weapons. o.o

after i found, i need to set a different fxschedulerentry for their effect of shooting and impacts.

Posted

I study better the problem. it's like the engine got some preference into the displaying of using of effect of this 3 weapons:

the preferences it's like that:

WP_BLASTER_PISTOL > WP_JAWA > WP_BRYAR_PISTOL.

the WP_BRYAR_PISTOL not get any problem about projectiles but get problems about the wall impact \ flesh impact efx.

example. if player use WP_BLASTER_PISTOL, the WP_BRYAR_PISTOL wall impact efx is the same of weapon_blaster_pistol.

WP_JAWA, instead, got the problems about the projectiles, they assume the appearences of the BLASTER_PISTOL sometime. they never assume efx shot of WP_JAWA.

so.

WP_BLASTER_PISTOL: its effects are fine, also if sometime can change the shot efx into WP_BRYAR_PISTOL shooting. o.o

WP_JAWA: can get the blaster_pistol projectile, not the bryar_pistol_projectiles.

WP_BRYAR_PISTOL:: can get the wall impact efx of BLASTER_PISTOL or JAWA.

the exchange happened when i use console and i type playermodel or npc spawn and i reload the savegame, when some of the NPC embrace on the weapons.

@@eezstreet,.

ON SP code i found the call for that efx, only in fx_bryar_pistol and cg_media.h

Posted

@@eezstreet

i found this on fx_bryarpistol.cpp

 

if ( cent->gent && cent->gent->owner && cent->gent->owner->s.number > 0 )
{
theFxScheduler.PlayEffect( "bryar/NPCshot", cent->lerpOrigin, forward );
}
else
{
theFxScheduler.PlayEffect( cgs.effects.bryarShotEffect, cent->lerpOrigin, forward );
}
Posted

Found it!

cg_weapons.cpp

 

 

=================
CG_MissileHitWall

Caused by an EV_MISSILE_MISS event, or directly by local bullet tracing
=================
*/
void CG_MissileHitWall( centity_t *cent, int weapon, vec3_t origin, vec3_t dir, qboolean altFire )
{
    int parm;

    switch( weapon )
    {
    case WP_BRYAR_PISTOL:
    case WP_BLASTER_PISTOL:
    case WP_JAWA:
        if ( altFire )
        {
            parm = 0;

            if ( cent->gent )
            {
                parm += cent->gent->count;
            }

            FX_BryarAltHitWall( origin, dir, parm );
        }
        else
        {
            FX_BryarHitWall( origin, dir );
        }
        break;

    case WP_BLASTER:
        FX_BlasterWeaponHitWall( origin, dir );
        break;

    case WP_BOWCASTER:
        FX_BowcasterHitWall( origin, dir );
        break;

    case WP_REPEATER:
        if ( altFire )
        {
            FX_RepeaterAltHitWall( origin, dir );
        }
        else
        {
            FX_RepeaterHitWall( origin, dir );
        }
        break;

    case WP_DEMP2:
        if ( altFire )
        {
        }
        else
        {
            FX_DEMP2_HitWall( origin, dir );
        }
        break;

    case WP_FLECHETTE:
        if ( altFire )
        {
            theFxScheduler.PlayEffect( "flechette/alt_blow", origin, dir );
        }
        else
        {
            FX_FlechetteWeaponHitWall( origin, dir );
        }
        break;

    case WP_ROCKET_LAUNCHER:
        FX_RocketHitWall( origin, dir );
        break;

    case WP_CONCUSSION:
        FX_ConcHitWall( origin, dir );
        break;

    case WP_THERMAL:
        theFxScheduler.PlayEffect( "thermal/explosion", origin, dir );
        theFxScheduler.PlayEffect( "thermal/shockwave", origin );
        break;

    case WP_EMPLACED_GUN:
        FX_EmplacedHitWall( origin, dir, (cent->gent&&cent->gent->alt_fire) );
        break;

    case WP_ATST_MAIN:
        FX_ATSTMainHitWall( origin, dir );
        break;

    case WP_ATST_SIDE:
        if ( altFire )
        {
            theFxScheduler.PlayEffect( "atst/side_alt_explosion", origin, dir );
        }
        else
        {
            theFxScheduler.PlayEffect( "atst/side_main_impact", origin, dir );
        }
        break;

    case WP_TRIP_MINE:
        theFxScheduler.PlayEffect( "tripmine/explosion", origin, dir );
        break;

    case WP_DET_PACK:
        theFxScheduler.PlayEffect( "detpack/explosion", origin, dir );
        break;

    case WP_TURRET:
        theFxScheduler.PlayEffect( "turret/wall_impact", origin, dir );
        break;

    case WP_TUSKEN_RIFLE:
        FX_TuskenShotWeaponHitWall( origin, dir );
        break;

    case WP_NOGHRI_STICK:
        FX_NoghriShotWeaponHitWall( origin, dir );
        break;
    }
}

/*
-------------------------
CG_MissileHitPlayer
-------------------------
*/

void CG_MissileHitPlayer( centity_t *cent, int weapon, vec3_t origin, vec3_t dir, qboolean altFire )
{
    gentity_t *other = NULL;
    qboolean    humanoid = qtrue;
    
    if ( cent->gent )
    {
        other = &g_entities[cent->gent->s.otherEntityNum];
        if( other->client )
        {
            class_t    npc_class = other->client->NPC_class;
            // check for all droids, maybe check for certain monsters if they're considered non-humanoid..?        
            if ( npc_class == CLASS_SEEKER || npc_class == CLASS_PROBE || npc_class == CLASS_MOUSE ||
                 npc_class == CLASS_GONK || npc_class == CLASS_R2D2 || npc_class == CLASS_R5D2 ||
                 npc_class == CLASS_PROTOCOL || npc_class == CLASS_MARK1 || npc_class == CLASS_MARK2 ||
                 npc_class == CLASS_INTERROGATOR || npc_class == CLASS_ATST || npc_class == CLASS_SENTRY )
            {
                humanoid = qfalse;
            }
        }
    }

    switch( weapon )
    {
    case WP_BRYAR_PISTOL:
    case WP_BLASTER_PISTOL:
    case WP_JAWA:
        if ( altFire )
        {
            FX_BryarAltHitPlayer( origin, dir, humanoid );
        }
        else
        {
            FX_BryarHitPlayer( origin, dir, humanoid );
        }
        break;

    case WP_BLASTER:
        FX_BlasterWeaponHitPlayer( other, origin, dir, humanoid );
        break;

    case WP_BOWCASTER:
        FX_BowcasterHitPlayer( origin, dir, humanoid );
        break;

    case WP_REPEATER:
        if ( altFire )
        {
            FX_RepeaterAltHitPlayer( origin, dir, humanoid );
        }
        else
        {
            FX_RepeaterHitPlayer( origin, dir, humanoid );
        }
        break;

    case WP_DEMP2:
        if ( !altFire )
        {
            FX_DEMP2_HitPlayer( origin, dir, humanoid );
        }

        // Do a full body effect here for some more feedback
        if ( other && other->client )
        {
            other->s.powerups |= ( 1 << PW_SHOCKED );
            other->client->ps.powerups[PW_SHOCKED] = cg.time + 1000;
        }
        break;

    case WP_FLECHETTE:
        if ( altFire )
        {
            theFxScheduler.PlayEffect( "flechette/alt_blow", origin, dir );
        }
        else
        {
            FX_FlechetteWeaponHitPlayer( origin, dir, humanoid );
        }    
        break;

    case WP_ROCKET_LAUNCHER:
        FX_RocketHitPlayer( origin, dir, humanoid );
        break;

    case WP_CONCUSSION:
        FX_ConcHitPlayer( origin, dir, humanoid );
        break;

    case WP_THERMAL:
        theFxScheduler.PlayEffect( "thermal/explosion", origin, dir );
        theFxScheduler.PlayEffect( "thermal/shockwave", origin );
        break;

    case WP_EMPLACED_GUN:
        FX_EmplacedHitPlayer( origin, dir, (cent->gent&&cent->gent->alt_fire) );
        break;

    case WP_TRIP_MINE:
        theFxScheduler.PlayEffect( "tripmine/explosion", origin, dir );
        break;

    case WP_DET_PACK:
        theFxScheduler.PlayEffect( "detpack/explosion", origin, dir );
        break;

    case WP_TURRET:
        theFxScheduler.PlayEffect( "turret/flesh_impact", origin, dir );
        break;

    case WP_ATST_MAIN:
        FX_EmplacedHitWall( origin, dir, qfalse );
        break;

    case WP_ATST_SIDE:
        if ( altFire )
        {
            theFxScheduler.PlayEffect( "atst/side_alt_explosion", origin, dir );
        }
        else
        {
            theFxScheduler.PlayEffect( "atst/side_main_impact", origin, dir );
        }
        break;
    case WP_TUSKEN_RIFLE:
        FX_TuskenShotWeaponHitPlayer( other, origin, dir, humanoid );
        break;

    case WP_NOGHRI_STICK:
        FX_NoghriShotWeaponHitPlayer( other, origin, dir, humanoid );
        break;
    }
}
 
Posted

So i need to work on cg_media.h for add new definition effect, , cg_weapons.cpp, for register effect and play the case about wall and flesh impact efx. and  fx_bryarpistol.cpp for shooting efxs of projectiles. o.o 

1 - declaire effect

2 - register new effect

3 - insert new effect into the switch case.

am i right?

@@eezstreet.

  • Solution
Posted

Okay! I fix this!

I copy here my edit code if someone desire to use for his mod is free to do!

this code hallow to change efx to WP_BRYAR_PISTOL and WP_JAWA, instead of have the same of WP_BLASTER_PISTOL in this mod the Npcs of your mod can got a more weapon variety. WP_BRYAR_PISTOL work like WP_BLASTER_PISTOL. WP_JAWA is a rapid fire repeater.

you can simply replace "bow" and "howler" with your personal definition for your code.

this is for SINGLE PLAYER game, not for MP.

First step:

go in cg_local.h and add this after void FX_saber . these add the definition fpr the NEW visual efx.

void FX_BryarHitWall( vec3_t origin, vec3_t normal );

void FX_BryarAltHitWall( vec3_t origin, vec3_t normal, int power );

void FX_BryarHitPlayer( vec3_t origin, vec3_t normal, qboolean humanoid );

void FX_BryarAltHitPlayer( vec3_t origin, vec3_t normal, qboolean humanoid );



void FX_BowHitWall( vec3_t origin, vec3_t normal );

void FX_BowAltHitWall( vec3_t origin, vec3_t normal, int power );

void FX_BowHitPlayer( vec3_t origin, vec3_t normal, qboolean humanoid );

void FX_BowAltHitPlayer( vec3_t origin, vec3_t normal, qboolean humanoid );



void FX_HowlerHitWall( vec3_t origin, vec3_t normal );

void FX_HowlerAltHitWall( vec3_t origin, vec3_t normal, int power );

void FX_HowlerHitPlayer( vec3_t origin, vec3_t normal, qboolean humanoid );

void FX_HowlerAltHitPlayer( vec3_t origin, vec3_t normal, qboolean humanoid )

second step:

cg_media.h add the definition of your new efx played by the FX functions add this on fx_handle table

// BLASTER PISTOL DARKNESS

    fxHandle_t    bryarShotEffect;

    fxHandle_t    bryarPowerupShotEffect;

    fxHandle_t    bryarWallImpactEffect;

    fxHandle_t    bryarWallImpactEffect2;

    fxHandle_t    bryarWallImpactEffect3;

    fxHandle_t    bryarFleshImpactEffect;



    // BOW - BRYAR PISTOL

    fxHandle_t    bowShotEffect;

    fxHandle_t    bowPowerupShotEffect;

    fxHandle_t    bowWallImpactEffect;

    fxHandle_t    bowWallImpactEffect2;

    fxHandle_t    bowWallImpactEffect3;

    fxHandle_t    bowFleshImpactEffect;



    // JAWA - SONIC PISTOL

    fxHandle_t    howlerShotEffect;

    fxHandle_t    howlerPowerupShotEffect;

    fxHandle_t    howlerWallImpactEffect;

    fxHandle_t    howlerWallImpactEffect2;

    fxHandle_t    howlerWallImpactEffect3;

    fxHandle_t    howlerFleshImpactEffect;

third step:

cg_weaponLoad.cpp

add this for add in weapons.dat the new func definition of projectiles.

func_t    funcs[] = {

    {"bryar_func",            FX_BryarProjectileThink},

    {"bryar_alt_func",        FX_BryarAltProjectileThink},

    {"bow_func",            FX_BowProjectileThink},

    {"bow_alt_func",        FX_BowAltProjectileThink},

    {"howler_func",            FX_HowlerProjectileThink},

    {"howler_alt_func",        FX_HowlerAltProjectileThink},

Now the hardest part. Cg_weapons.cpp

found the case WP_BRYAR_PISTOL

case WP_BLASTER_PISTOL

and CASE_WP_JAWA switch, as you can see they got the effects displayed in common.

edit  in this:

Now go in cg_missilehitwall part of the same file.  edit like this the switch case of BRYAR \ BLASTER \ JAWA. this customize the wall impact efx. basically this told "if weapon is that, play this efx, if is another play this other efx, etc."

void CG_MissileHitWall( centity_t *cent, int weapon, vec3_t origin, vec3_t dir, qboolean altFire ){    int parm;    switch( weapon )    {    case WP_BRYAR_PISTOL:        if ( altFire )        {            parm = 0;            if ( cent->gent )            {                parm += cent->gent->count;            }            FX_BowAltHitWall( origin, dir, parm );        }        else        {            FX_BowHitWall( origin, dir );        }        break;    case WP_BLASTER_PISTOL:        if ( altFire )        {            parm = 0;            if ( cent->gent )            {                parm += cent->gent->count;            }            FX_BryarAltHitWall( origin, dir, parm );        }        else        {            FX_BryarHitWall( origin, dir );        }        break;    case WP_JAWA:        if ( altFire )        {            parm = 0;            if ( cent->gent )            {                parm += cent->gent->count;            }            FX_HowlerAltHitWall( origin, dir, parm );        }        else        {            FX_HowlerHitWall( origin, dir );        }        break;    case WP_BLASTER:        FX_BlasterWeaponHitWall( origin, dir );        break;

same thing for Flesh impact efx of when weapons hit a NPC or player

void CG_MissileHitPlayer( centity_t *cent, int weapon, vec3_t origin, vec3_t dir, qboolean altFire )

{

    gentity_t *other = NULL;

    qboolean    humanoid = qtrue;

    

    if ( cent->gent )

    {

        other = &g_entities[cent->gent->s.otherEntityNum];

        if( other->client )

        {

            class_t    npc_class = other->client->NPC_class;

            // check for all droids, maybe check for certain monsters if they're considered non-humanoid..?        

            if ( npc_class == CLASS_SEEKER || npc_class == CLASS_PROBE || npc_class == CLASS_MOUSE ||

                 npc_class == CLASS_GONK || npc_class == CLASS_R2D2 || npc_class == CLASS_R5D2 ||

                 npc_class == CLASS_PROTOCOL || npc_class == CLASS_MARK1 || npc_class == CLASS_MARK2 ||

                 npc_class == CLASS_INTERROGATOR || npc_class == CLASS_ATST || npc_class == CLASS_SENTRY )

            {

                humanoid = qfalse;

            }

        }

    }



    switch( weapon )

    {

    case WP_BRYAR_PISTOL:

        if ( altFire )

        {

            FX_BowAltHitPlayer( origin, dir, humanoid );

        }

        else

        {

            FX_BowHitPlayer( origin, dir, humanoid );

        }

        break;

    case WP_BLASTER_PISTOL:

        if ( altFire )

        {

            FX_BryarAltHitPlayer( origin, dir, humanoid );

        }

        else

        {

            FX_BryarHitPlayer( origin, dir, humanoid );

        }

        break;

    case WP_JAWA:

        if ( altFire )

        {

            FX_HowlerAltHitPlayer( origin, dir, humanoid );

        }

        else

        {

            FX_HowlerHitPlayer( origin, dir, humanoid );

        }

        break;

At the end, for FX_bryarpistol.cpp you need to edit this part of code that get the definition of each efx called and displayed by FX parameters you added in cg_local.h

so now the FX functions are working and they called the specific efxs you have add on cg_weapons.cpp first edit part.

-------------------------



    MAIN FIRE



-------------------------

FX_BryarProjectileThink

-------------------------

*/

void FX_BryarProjectileThink(  centity_t *cent, const struct weaponInfo_s *weapon )

{

    vec3_t forward;



    if ( VectorNormalize2( cent->gent->s.pos.trDelta, forward ) == 0.0f )

    {

        if ( VectorNormalize2( cent->currentState.pos.trDelta, forward ) == 0.0f )

        {

            forward[2] = 1.0f;

        }

    }



    // hack the scale of the forward vector if we were just fired or bounced...this will shorten up the tail for a split second so tails don't clip so harshly

    int dif = cg.time - cent->gent->s.pos.trTime;



    if ( dif < 75 )

    {

        if ( dif < 0 )

        {

            dif = 0;

        }



        float scale = ( dif / 75.0f ) * 0.95f + 0.05f;



        VectorScale( forward, scale, forward );

    }



    if ( cent->gent && cent->gent->owner && cent->gent->owner->s.number > 0 )

    {

        theFxScheduler.PlayEffect( "bryar/NPCshot", cent->lerpOrigin, forward );

    }

    else

    {

        theFxScheduler.PlayEffect( cgs.effects.bryarShotEffect, cent->lerpOrigin, forward );

    }

}



void FX_BowProjectileThink(  centity_t *cent, const struct weaponInfo_s *weapon )

{

    vec3_t forward;



    if ( VectorNormalize2( cent->gent->s.pos.trDelta, forward ) == 0.0f )

    {

        if ( VectorNormalize2( cent->currentState.pos.trDelta, forward ) == 0.0f )

        {

            forward[2] = 1.0f;

        }

    }



    // hack the scale of the forward vector if we were just fired or bounced...this will shorten up the tail for a split second so tails don't clip so harshly

    int dif = cg.time - cent->gent->s.pos.trTime;



    if ( dif < 75 )

    {

        if ( dif < 0 )

        {

            dif = 0;

        }



        float scale = ( dif / 75.0f ) * 0.95f + 0.05f;



        VectorScale( forward, scale, forward );

    }



    if ( cent->gent && cent->gent->owner && cent->gent->owner->s.number > 0 )

    {

        theFxScheduler.PlayEffect( "bow/NPCshot", cent->lerpOrigin, forward );

    }

    else

    {

        theFxScheduler.PlayEffect( cgs.effects.bowShotEffect, cent->lerpOrigin, forward );

    }

}



void FX_HowlerProjectileThink(  centity_t *cent, const struct weaponInfo_s *weapon )

{

    vec3_t forward;



    if ( VectorNormalize2( cent->gent->s.pos.trDelta, forward ) == 0.0f )

    {

        if ( VectorNormalize2( cent->currentState.pos.trDelta, forward ) == 0.0f )

        {

            forward[2] = 1.0f;

        }

    }



    // hack the scale of the forward vector if we were just fired or bounced...this will shorten up the tail for a split second so tails don't clip so harshly

    int dif = cg.time - cent->gent->s.pos.trTime;



    if ( dif < 75 )

    {

        if ( dif < 0 )

        {

            dif = 0;

        }



        float scale = ( dif / 75.0f ) * 0.95f + 0.05f;



        VectorScale( forward, scale, forward );

    }



    if ( cent->gent && cent->gent->owner && cent->gent->owner->s.number > 0 )

    {

        theFxScheduler.PlayEffect( "howler/NPCshot", cent->lerpOrigin, forward );

    }

    else

    {

        theFxScheduler.PlayEffect( cgs.effects.howlerShotEffect, cent->lerpOrigin, forward );

    }

}



/*

-------------------------

FX_BryarHitWall

-------------------------

*/

void FX_BryarHitWall( vec3_t origin, vec3_t normal )

{

    theFxScheduler.PlayEffect( cgs.effects.bryarWallImpactEffect, origin, normal );

}



void FX_BowHitWall( vec3_t origin, vec3_t normal )

{

    theFxScheduler.PlayEffect( cgs.effects.bowWallImpactEffect, origin, normal );

}



void FX_HowlerHitWall( vec3_t origin, vec3_t normal )

{

    theFxScheduler.PlayEffect( cgs.effects.howlerWallImpactEffect, origin, normal );

}





/*

-------------------------

FX_BryarHitPlayer

-------------------------

*/

void FX_BryarHitPlayer( vec3_t origin, vec3_t normal, qboolean humanoid )

{

    theFxScheduler.PlayEffect( cgs.effects.bryarFleshImpactEffect, origin, normal );

}



void FX_BowHitPlayer( vec3_t origin, vec3_t normal, qboolean humanoid )

{

    theFxScheduler.PlayEffect( cgs.effects.bowFleshImpactEffect, origin, normal );

}



void FX_HowlerHitPlayer( vec3_t origin, vec3_t normal, qboolean humanoid )

{

    theFxScheduler.PlayEffect( cgs.effects.howlerFleshImpactEffect, origin, normal );

}



/*

-------------------------



    ALT FIRE



-------------------------

FX_BryarAltProjectileThink

-------------------------

*/

void FX_BryarAltProjectileThink(  centity_t *cent, const struct weaponInfo_s *weapon )

{

    vec3_t forward;



    if ( VectorNormalize2( cent->gent->s.pos.trDelta, forward ) == 0.0f )

    {

        if ( VectorNormalize2( cent->currentState.pos.trDelta, forward ) == 0.0f )

        {

            forward[2] = 1.0f;

        }

    }



    // hack the scale of the forward vector if we were just fired or bounced...this will shorten up the tail for a split second so tails don't clip so harshly

    int dif = cg.time - cent->gent->s.pos.trTime;



    if ( dif < 75 )

    {

        if ( dif < 0 )

        {

            dif = 0;

        }



        float scale = ( dif / 75.0f ) * 0.95f + 0.05f;



        VectorScale( forward, scale, forward );

    }



    // see if we have some sort of extra charge going on

    for ( int t = 1; t < cent->gent->count; t++ )

    {

        // just add ourselves over, and over, and over when we are charged

        theFxScheduler.PlayEffect( cgs.effects.bryarPowerupShotEffect, cent->lerpOrigin, forward );

    }



    theFxScheduler.PlayEffect( cgs.effects.bryarShotEffect, cent->lerpOrigin, forward );

}



void FX_BowAltProjectileThink(  centity_t *cent, const struct weaponInfo_s *weapon )

{

    vec3_t forward;



    if ( VectorNormalize2( cent->gent->s.pos.trDelta, forward ) == 0.0f )

    {

        if ( VectorNormalize2( cent->currentState.pos.trDelta, forward ) == 0.0f )

        {

            forward[2] = 1.0f;

        }

    }



    // hack the scale of the forward vector if we were just fired or bounced...this will shorten up the tail for a split second so tails don't clip so harshly

    int dif = cg.time - cent->gent->s.pos.trTime;



    if ( dif < 75 )

    {

        if ( dif < 0 )

        {

            dif = 0;

        }



        float scale = ( dif / 75.0f ) * 0.95f + 0.05f;



        VectorScale( forward, scale, forward );

    }



    // see if we have some sort of extra charge going on

    for ( int t = 1; t < cent->gent->count; t++ )

    {

        // just add ourselves over, and over, and over when we are charged

        theFxScheduler.PlayEffect( cgs.effects.bowPowerupShotEffect, cent->lerpOrigin, forward );

    }



    theFxScheduler.PlayEffect( cgs.effects.bowShotEffect, cent->lerpOrigin, forward );

}



void FX_HowlerAltProjectileThink(  centity_t *cent, const struct weaponInfo_s *weapon )

{

    vec3_t forward;



    if ( VectorNormalize2( cent->gent->s.pos.trDelta, forward ) == 0.0f )

    {

        if ( VectorNormalize2( cent->currentState.pos.trDelta, forward ) == 0.0f )

        {

            forward[2] = 1.0f;

        }

    }



    // hack the scale of the forward vector if we were just fired or bounced...this will shorten up the tail for a split second so tails don't clip so harshly

    int dif = cg.time - cent->gent->s.pos.trTime;



    if ( dif < 75 )

    {

        if ( dif < 0 )

        {

            dif = 0;

        }



        float scale = ( dif / 75.0f ) * 0.95f + 0.05f;



        VectorScale( forward, scale, forward );

    }



    // see if we have some sort of extra charge going on

    for ( int t = 1; t < cent->gent->count; t++ )

    {

        // just add ourselves over, and over, and over when we are charged

        theFxScheduler.PlayEffect( cgs.effects.howlerPowerupShotEffect, cent->lerpOrigin, forward );

    }



    theFxScheduler.PlayEffect( cgs.effects.howlerShotEffect, cent->lerpOrigin, forward );

}



/*

-------------------------

FX_BryarAltHitWall

-------------------------

*/

void FX_BryarAltHitWall( vec3_t origin, vec3_t normal, int power )

{

    switch( power )

    {

    case 4:

    case 5:

        theFxScheduler.PlayEffect( cgs.effects.bryarWallImpactEffect3, origin, normal );

        break;



    case 2:

    case 3:

        theFxScheduler.PlayEffect( cgs.effects.bryarWallImpactEffect2, origin, normal );

        break;



    default:

        theFxScheduler.PlayEffect( cgs.effects.bryarWallImpactEffect, origin, normal );

        break;

    }

}



void FX_BowAltHitWall( vec3_t origin, vec3_t normal, int power )

{

    switch( power )

    {

    case 4:

    case 5:

        theFxScheduler.PlayEffect( cgs.effects.bowWallImpactEffect3, origin, normal );

        break;



    case 2:

    case 3:

        theFxScheduler.PlayEffect( cgs.effects.bowWallImpactEffect2, origin, normal );

        break;



    default:

        theFxScheduler.PlayEffect( cgs.effects.bowWallImpactEffect, origin, normal );

        break;

    }

}



void FX_HowlerAltHitWall( vec3_t origin, vec3_t normal, int power )

{

    switch( power )

    {

    case 4:

    case 5:

        theFxScheduler.PlayEffect( cgs.effects.howlerWallImpactEffect3, origin, normal );

        break;



    case 2:

    case 3:

        theFxScheduler.PlayEffect( cgs.effects.howlerWallImpactEffect2, origin, normal );

        break;



    default:

        theFxScheduler.PlayEffect( cgs.effects.howlerWallImpactEffect, origin, normal );

        break;

    }

}



/*

-------------------------

FX_BryarAltHitPlayer

-------------------------

*/

void FX_BryarAltHitPlayer( vec3_t origin, vec3_t normal, qboolean humanoid )

{

    theFxScheduler.PlayEffect( cgs.effects.bryarFleshImpactEffect, origin, normal );

}



void FX_BowAltHitPlayer( vec3_t origin, vec3_t normal, qboolean humanoid )

{

    theFxScheduler.PlayEffect( cgs.effects.bowFleshImpactEffect, origin, normal );

}



void FX_HowlerAltHitPlayer( vec3_t origin, vec3_t normal, qboolean humanoid )

{

    theFxScheduler.PlayEffect( cgs.effects.howlerFleshImpactEffect, origin, normal );

}

Build the SP client and exe of OPENJKit, and that's all. :)

I think this should be useful also for understand how to add a new weapon into SP game, because is missing a tutorial about that. the difference i suppose it's that you need to add the new weapons definition, the function for making it usable by player and NPCs and for add it into ammo and items, and the functions and the functions about how the weapons works for projectiles and impacts. i am not so expert about this tecnique part but this work for visual efx of weapons like BLASTER_PISTOLS.

 

i hope this can help someone. :)

 

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...