project-navigation
Personal tools

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - TDarklighter

Pages: [1]
1
Discussion / Reaction Fire Fix
« on: June 30, 2010, 06:52:10 am »
I'm not sure if we're allowed to modify the code, but I believe I've found a fix for the "No Reaction Fire" issue that a lot of people are having and want to submit it.  This may not work for everyone, but it did make a change for me.  This fix requires modifying a source code file, so be careful not to fool around with anything else unless you REALLY REALLY know what you're doing.  This was all done with code I found in 2.2.1's g_combat.c - all I did was compare notes and copy and paste what seemed to be missing.

The process:
Open up the reaction.c module with a C editor (Pelles C is what I use), and then scroll down until you find the entry of:

/* see how quickly ent can fire (if it can fire at all) */
tus = G_ReactionFireGetTUsForItem(ent, target, RIGHT(ent));
if (tus < 0)
  continue;

Replace the first line under the "see how quickly" comment with this:

tus = G_ReactionFireGetTUsForItem(ent, target, NULL, RIGHT(ent));

Also, at the end of:
/* An enemy entering the line of fire of a soldier on reaction
* fire should have the opportunity to spend time equal to the
* sum of these values. */
ent->reactionTUs = max(0, target->TU - (tus / 4.0));
ent->reactionNoDraw = qfalse;

Add the line:
queued = qtrue;

Put it between the last line and the } mark right below it.

The result:
My soldiers now occasionally make reaction fire.  I ran through three battles like this and there was at least one instance where my guys shot in response to being shot at.  It was worth it just to see them defend themselves finally. :)  I'm not sure how to make them fire with a left-handed weapon, but the three reactions I clearly remember were one flamethrower (cooked a bloodspider), and two laser pistol shots: One from my Lance-Corporal and one from one of my rifleman-ranked guys.  Both missed, but it was pretty to see, lol.

Hope this helps!  Awesome game, guys, and great work.  Keep it coming! :)

Pages: [1]