Home » PLAYER'S HQ 1.13 » JA2 Complete Mods & Sequels » Stracciatella Project (Platform Independent JA2) » [Patch/Fix] Cleaning throwing knives
[Patch/Fix] Cleaning throwing knives[message #251253] Sun, 09 May 2010 23:15
mgl is currently offline mgl

 
Messages:255
Registered:December 2007
Location: France
This patch makes the game stop accounting throwing a bloody knife on the ground as a (missed) shot. For me, it's more a bug fix.

I added a message in the message box to acknowledge that you are cleaning a knife. A portion (the word "cleans") is in English. Internationalization would require to patch much more files and I don't speak all the languages of the game.

Index: Build/Tactical/LOS.cc
===================================================================
--- Build/Tactical/LOS.cc	(revision 7063)
+++ Build/Tactical/LOS.cc	(working copy)
@@ -3221,8 +3221,48 @@
 		// increment shots fired if shooter has a merc profile
 	  if( ( pFirer->ubProfile != NO_PROFILE ) && ( pFirer->bTeam == 0 ) )
 		{
-		  // another shot fired
-		  gMercProfiles[ pFirer->ubProfile ].usShotsFired++;
+			bool shot_ack = true; 
+			
+			/* mgl: Cleaning a bloody throwing knife is not firing.
+			 * mgl: Don't count that as a (missed) shot.
+			 */
+			if (pFirer->usAttackingWeapon == BLOODY_THROWING_KNIFE
+			    && pFirer->target == NULL // targets no-one
+			    && pFirer->bTargetLevel <= pFirer->bLevel
+			                              // altitude >= tgt
+			   )
+			{
+				/* There is a chance that the merc is cleaning
+				 * a bloody throwing knife. Loop the
+				 * structures on the target gridno to check.
+				 */ 
+				STRUCTURE const *s = gpWorldLevelData[pFirer->sTargetGridNo].pStructureHead;
+				shot_ack = false;
+				while (s)
+				{
+					if (s->fFlags & STRUCTURE_OBSTACLE)
+					{
+						shot_ack = true;
+						break;
+					}
+					else
+					{
+						s = s->pNext;
+					}
+				}	
+
+				if (!shot_ack)
+				{
+					ScreenMsg(FONT_MCOLOR_LTYELLOW,
+					          MSG_INTERFACE,
+					          L"%ls cleans a %ls.",
+					          pFirer->name,
+					          ShortItemNames[pFirer->usAttackingWeapon]
+					         );
+				}
+			}
+			// another shot fired
+			shot_ack && ++gMercProfiles[pFirer->ubProfile].usShotsFired;
 		}
 
 		if ( Item[ pFirer->usAttackingWeapon ].usItemClass == IC_THROWING_KNIFE )

Report message to a moderator

Master Sergeant
 
Read Message
Previous Topic: [Patch] Miguel and Carlos
Next Topic: Platform independent: SLF extractor
Goto Forum:
  


Current Time: Mon Jan 27 14:52:11 GMT+2 2025

Total time taken to generate the page: 0.01242 seconds