Nothing entered.
[http://sourceforge.net/p/ufoai/patches/502 Item 502] imported from sourceforge.net tracker on 2013-01-28 20:43:43
http://ufoai.ninex.info/forum/index.php?topic=4564.15
Here's the .diff file.
But first, some reading :
Context notes :
- I started editing UFO AI source to test personnal gameplay ideas and tweaks a few things to my taste. So the modifications arent limited to a new Reaction Fire mode (see below).
- Im not familiar with the project structure and some modifications might be out of place.
- The modifications could break game balance (not sure if really sensible), and probably differs from UFO:AI creator's vision.
- The modifications most certainly arent compatible with multiplayer games (stuning does not apply to aliens, mobility for multiplayer weapons are not set, im pretty sure some network code is missing).
- I like well enclosed things. i will use { } for even the simplest "if", and over parenthesis maths things.
- Ive added "(yatta)" in most comments so if something breaks arrounds those comments, you know you can blame me.
- I used lots of "gi.BroadcastPrintf(PRINT_CONSOLE ..." for debugging, so you'll find quite a few, commented out.
- Novice coding errors or complexity is to be expected.
- No difference between the two RF modes.
WTF ?!
This might be your reaction in some situations, where soldiers start shooting altough you didnt give them the order.
What happens is the following : you have soldiers ON RF. One of them moves, trigerring an alien RF, but as the alien start aiming/shooting, one of your other soldier, who had the alien well spotted already, start shooting too. Follows a quick gun fight for the burst duration. Yes two burst can be fired at the same time.
What it does :
- Changed Reaction Fire behavior. RF now depends on character's mind (mainly) and speed. Other factors included : target's speed, position and activity, weapon mobility ...
- Point survey : When you right-click with the mouse to make your soldier face a direction, you now also register an "Aim Point" : if an enemy enters that point, your soldier has a bonus to trigger its reaction fire. Very good to guard doors & building corners.
- Changed burst fire system. Your soldier wont discharge the full burst at one point when RF shooting at a moving enemy, but rather will shoot while the enemy move.
- Added critical hits : depending on the type of weapons, you can inflict more damage, or do special effect sur has making fall (well, sit), lose weapon, stun (except aliens), panic, ...
- Stun on hard hits : your soldiers might faint when badly hit. Bad : you have one less active soldier on the field. Good : he can be healed at the hospital. A little chance to keep good soldiers alive, and makes accepting combat losses easier.
- Tried to tweak camera travels during shoots to gain time and lose sickness. Not so successful.
- Dazed (flashbang grenade) now makes the actor start with half the TU on next round
- Actors loses a few TU when hit.
weapons ufo files : added 'mobility' parameter
cl_actor : added message writing PA_POINT when orienting a soldier with mouse
e_time : barbaricly tried to reduce camera travels delay
e_event_actormove : ActorDoMove returns on actor death
e_event_actorstartshoot : changed cameraroute to reduce camera travels in ActorStartShoot
scripts : added the mobility parameter for weapon defs
g_actor : RF modes reserves no TU, dazed unit start round with half TU, barbaric return on ActorInvMove to handle (in case of weapon drop/destruction by RF), changed how TU are handled at some points, added func g_ActorUseTU needed for RF
g_client : when reseting time units, reset a param for RF, modified how TU are used, added message PA_POINT handling (for aiming point)
g_combat : added critical hits & effects (can be turned off by setting the COMBAT_CRITICAL_FACTOR to 0, critical effects table depending on weapons damage type, stun chance on hard hits (for humans only to avoid easy capture of live alien), TU loss on hit, modified ShootSingle to add inaccuracy on RF, removed obsolete RF functions, modified ClientShoot to handle new RF and new management of bursts
g_local : added / removed stuff for new RF
g_main : remove of prototype of obsolete RF functions
g_match : made uncouncious-yet-alive soldiers have low health after a mission (so they HAVE to be healed before next mission
g_move : added a default AimAt point when moving soldiers, flag IsMoving for ents to manage RF accuracy
g_reaction : well ... mostly rewritten / changed
g_round : removed a call to an obsolete RF function
game_h : added an array to manage awareness of actors
inv_shared : added 'mobility' parameter
q_shared : added 'PA_POINT' message for AimAts
===== Comments Ported from Sourceforge =====
====== tlh2000 (2010-03-23 17:09:49) ======
====== tlh2000 (2010-03-27 06:23:31) ======
some comments from me:
the "int dw_*" and chance calculation should really go into the scripts.
there is a bug in line 981 of your patch. the vector you defined was a vec2_t, but line 981 sets the third value.
please watch out the coding guidelines ;)
don't add { and } to single if statements just to make the patch bigger.
submit typos as single patches. to be sure to submit a feature only patch. the smaller it is the easier it is for us to check it.
introduction of new functions like G_ActorUseTU should be a single patch, too. even if you do nothing more than ent->TU -= TU_*; in it, it would reduce the size of your "main" patch.
-qboolean G_ClientShoot (const player_t * player, edict_t* ent, const pos3_t at, shoot_types_t shootType,
+qboolean G_ClientShoot (const player_t *player, edict_t *ent, const pos3_t at, shoot_types_t shootType,
feel free to also submit a single patch for changes like these.
+ /** reaction fire */
+ vec3_t AimAt; /**< point actor is currently aiming at (for reaction fire) (yatta)*/
+ int NextReactionShoot; /**< in how many reaction UT will the next bullet be shot (yatta)*/
+ qboolean IsMoving; /**< is actor currently moving */
camelCase please - not AimAt but aimAt - even better would be reactionAimAt, reactionNextShoot and isMoving.
+ ent->AimAt[0] = ent->pos[0];
+ ent->AimAt[1] = ent->pos[1];
+ ent->AimAt[2] = ent->pos[2];
use vector macros (in this case VectorCopy)
+/*
+ gi.BroadcastPrintf(PRINT_CONSOLE, "------- %s \n",ent->chr.name);
+ gi.BroadcastPrintf(PRINT_CONSOLE, "AimAt x : %i\n",ent->AimAt[0]);
+ gi.BroadcastPrintf(PRINT_CONSOLE, "AimAt y : %i\n",ent->AimAt[1]);
+ gi.BroadcastPrintf(PRINT_CONSOLE, "AimAt z : %i\n",ent->AimAt[2]);
+ gi.BroadcastPrintf(PRINT_CONSOLE, "pos x : %i\n",ent->pos[0]);
+ gi.BroadcastPrintf(PRINT_CONSOLE, "pos y : %i\n",ent->pos[1]);
+ gi.BroadcastPrintf(PRINT_CONSOLE, "pos z : %i\n",ent->pos[2]);
+*/
please do not include inactive code in your patches (except there is a todo comment which you plan to build up further patches on)
+ /* find the firemode firing the most shots */
+ fireDefIndex_t bfd;
+ int bshots = 0;
+ int bUT = 99;
please try to use existing variable name conventions. fd is firedef, but bfd is what? search for the use of other fireDefIndex_t variables and try to use a similiar (if not an equal) name. Try to use variable names where others are still knowing you is meant with them - bshots and bUT says nothing to me.
====== *anonymous (2010-03-27 13:28:52) ======
Working on it.
Notes :
I didnt use { } "to make the patch bigger", im not competing on patch size. I just use this structure because I find it cleaner and easier de read. Ill change that since it does not seem to fit the guidelines.
Removing typos corrections
G_ActorUseTu cant be a single patch : its useless as a stand-alone, and necessary for the new reaction fire mode.
changing AimAt to aimAt
====== tlh2000 (2010-03-27 14:40:52) ======
please change to reactionAimAt and use the existing G_ActorUseTu
====== aduke1 (2012-11-06 23:47:18.692000) ======
Mattn,
looks to me like this patch is completely outdated and the author gave up on following the coding guidelines.
Can we draw any ideas from the ruins ?
====== aduke1 (2012-11-12 17:36:33.435000) ======
- **assigned_to**: Martin Gerhardy
- **milestone**: --> git_master