Jump to content

Home

[code] Four-Barreled Weapon


recombinant

Recommended Posts

BooYahh is right!!!

 

FourBarrelShot.jpg

 

Many thanks again to the master!!!

 

:D

 

But I'd really like to know *why* it works - what the concept is behind the functions. I'm happy to copy and paste the code, but I really need to understand what's going on here! Ack!

Link to comment
Share on other sites

static void ShootFourShots( gentity_t *ent )
{

[i]//racc - create missile entities[/i]    
       gentity_t *missile1;
       gentity_t *missile2;
       gentity_t *missile3;
       gentity_t *missile4;

[i]//racc - initialize origin point vectors
//tmpMzzle = muzzle point in x/y orientation from the player (doesn't worry about the z axis)
//newMuzzle = working muzzle origin vector.  This is where your
//desired muzzle point vector will be at the end of the calculations.[/i]
       vec3_t  tmpMuzzle, newMuzzle;

       VectorCopy(fusionMuzzle[0], tmpMuzzle);
       VectorCopy(ent->s.pos.trBase, newMuzzle);

[i]//racc - Translate the x factor of the fusionMuzzle into the current
//muzzle position by using the forward/right vectors determined 
//earlier.[/i]
       VectorMA(newMuzzle, tmpMuzzle[0], forward, newMuzzle);

[i]//racc - Translate the y factor with the same method.[/i]
       VectorMA(newMuzzle, tmpMuzzle[1], right, newMuzzle);

[i]//racc - Bump up the muzzle point so it's in terms of the viewpoint inside of the player origin.[/i]
       newMuzzle[2] += ent->client->ps.viewheight + tmpMuzzle[2];

[i]//racc - Convert the data to integers to make it easier on the network connection.[/i]
       SnapVector( newMuzzle );

[i]//racc - Configure missile1 with the newly calculated muzzle point.[/i]
       missile1 = CreateMissile( newMuzzle, forward, FUSION_CUTTER_VELOCITY, 10000, ent, qfalse); 

Link to comment
Share on other sites

To be perfect, you'd have to adjust the firing sequences to the inclination of the weapon, since it is lower on the right side of your screenshot.

And it seems the two left and the two right projectiles are closer to each other, leaving a gap between the middle two.

But its not that important.

Cool its working!!!

Link to comment
Share on other sites

Thanks for the inline comments, razorace - they help immensely...

 

Fracman - yes it's not perfect, but I'm really happy with the results so far, and I still have some tweaking to do with it anyway.

 

Thanks for all the great help, guys!! YOU ROCK!!!

 

:D

Link to comment
Share on other sites

Originally posted by Fracman

To be perfect, you'd have to adjust the firing sequences to the inclination of the weapon, since it is lower on the right side of your screenshot.

And it seems the two left and the two right projectiles are closer to each other, leaving a gap between the middle two.

 

After playing around with the code for a bit I think I've got it looking much better:

 

FusionCutter070203a.jpg

 

FusionCutter070203b.jpg

 

There's still an issue with the sequencing on the primary fire that Salv pointed out to me privately, but that shouldn't be too difficult to fix.

 

:holosid:

Link to comment
Share on other sites

  • 3 weeks later...

If you could do half of it.... hmmm...... that brings up a good point. How do you do half this stuff.

 

Ok, let me reitterate. I've scoured the base pk3s, searched them up and down. I still havent found the files that control the weaponry. Furthermore, I've only ever seen lightsaber mods, and not very good ones at that. I've yet to find a mod that actually edits the gun's projectiles. Reskins and new models all over the place, with some quickened fire rates, dubbed as weapon mods. But none of the projectiles have changed. But looking at the FC here... It appears you guys have pulled it off.to my knowledge, you guys are the only people to actually successfully turn one weapon into another.

 

My question is: What files controll the weapon actions? sounds?what controls the projectiles? I might be able to pull off making some very unique guns, I'm good at figuring out code. But I need to know file names and directories first. Any help here?

Link to comment
Share on other sites

The source. Download the second set of editing tools and you will get the source code for the game, cgame and ui modules of JK2 (in C code).

 

When the .c files are compiled they make .qvm files (which are located in the vm directory in the .pk3s).

Link to comment
Share on other sites

The source has those weapon related files:

bg_weapons.h (defines to enable each weapons and ammo separately)

bg_weapons.c (properties of each weapon, e.g. ammo, damage)

cg_weaponinit.c (initialize weapon structures and assign models & sounds)

cg_weapon.c (insert weapons in game)

fx_xxx.c (weapon effects)

g_weapon.c (firing weapons, primary and secondary fire)

Link to comment
Share on other sites

Originally posted by Commodus

The source. Download the second set of editing tools and you will get the source code for the game, cgame and ui modules of JK2 (in C code).

 

When the .c files are compiled they make .qvm files (which are located in the vm directory in the .pk3s).

 

...succinctly put. well done!

 

:D

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...