Home » MODDING HQ 1.13 » v1.13 Bug Reports » Minor bugs with proposed workarounds (not necessarily fixes)
Minor bugs with proposed workarounds (not necessarily fixes)[message #337185] Sun, 26 October 2014 21:00 Go to next message
Ocular

 
Messages:24
Registered:September 2014
Hello, two minor issues to report with workarounds:

  • Placing an LBE item onto a body slot fails when choosing from a stack of objects.

    Choosing from a stack of one object works correctly.

    This is most likely a data problem and not a code problem, as the following returns 0:

    LBEPocketType[ pocketType ].ItemCapacityPerSize[ Item[pObj->usItem].ItemSize ]


    However, there is a simple workaround: it appears that popupCallbackPlaceLeastDamagedFromStack() can safely always return at least 1 as this callback is only triggered when there is at least one valid item.

    Trivial patch, as produced by `svn diff`:

    Index: Build/Tactical/Interface Items.cpp
    ===================================================================
    --- Build/Tactical/Interface Items.cpp	(revision 7616)
    +++ Build/Tactical/Interface Items.cpp	(working copy)
    @@ -1931,7 +1931,7 @@
     				INT16 pocketType = pocketTypeInSlot( pSoldier, pocket );
     
     				if( pocketType != -1 ){
    -					numObjectsToPlace =  min( pObj->objectStack.size(), LBEPocketType[ pocketType ].ItemCapacityPerSize[ Item[pObj->usItem].ItemSize ] ); 
    +					numObjectsToPlace = min( pObj->objectStack.size(), max( 1, LBEPocketType[ pocketType ].ItemCapacityPerSize[ Item[pObj->usItem].ItemSize ] ) );
     				} else {
     					numObjectsToPlace = 1;
     				}
     
    

  • Breath damage from regular smoke is incredibly high; even stepping into the mini puff of smoke left behind by a frag grenade will knock out an opponent for several turns!

    It appears that the original x100 multiplier present in the original code for pExplosive->ubStunDamage was actually moved into the GetModifiedExplosiveDamage() function for the EXPLOSIVES_DAMAGE_MODIFIER feature, but was never removed from HandleGotoNewGridNo().

    This causes x100 breath damage for all gas effects on first hit! Trivial patch to remove this extra x100 below:

    Index: Build/Tactical/Overhead.cpp
    ===================================================================
    --- Build/Tactical/Overhead.cpp	(revision 7616)
    +++ Build/Tactical/Overhead.cpp	(working copy)
    @@ -2397,7 +2397,7 @@
                                 //pSoldier->EVENT_StopMerc( pSoldier->sGridNo, pSoldier->ubDirection );
                                 //fDontContinue = TRUE;
     							INT16 iGasHealthDamage = GetModifiedExplosiveDamage( pExplosive->ubDamage, 0 ) + (INT16)PreRandom( GetModifiedExplosiveDamage( pExplosive->ubDamage, 0 ));
    -							INT16 iGasBreathDamage = ( 100 * ( GetModifiedExplosiveDamage( pExplosive->ubStunDamage, 1 ) + (INT16)PreRandom( ( GetModifiedExplosiveDamage( pExplosive->ubStunDamage, 1 ) / 2 ) ) ) );
    +							INT16 iGasBreathDamage = GetModifiedExplosiveDamage( pExplosive->ubStunDamage, 1 ) + (INT16)PreRandom( ( GetModifiedExplosiveDamage( pExplosive->ubStunDamage, 1 ) / 2 ) );
     
                                 DishOutGasDamage( pSoldier, pExplosive, TRUE, FALSE, iGasHealthDamage, iGasBreathDamage, NOBODY );
                             }
     
    

EDIT: I guess the gas breath damage is actually a little more than a minor bug

[Updated on: Sun, 26 October 2014 21:01] by Moderator

Re: Minor bugs with proposed workarounds (not necessarily fixes)[message #337191] Sun, 26 October 2014 22:31 Go to previous messageGo to next message
silversurfer

 
Messages:2551
Registered:May 2009
Explosives seem to have an even bigger problem. For testing I just tossed a mustard grenade at an enemy. While debugging I noticed that pExplosive->ubType was 1 (stun) although it should be 3 (mustard). :headscratch:
This also leads to pSoldier->flags.fHitByGasFlags not being set correctly making the victim take full damage all the time instead of the modified damage for subsequent hits.

Seems to be a recent breakage as this was working before.


edit: Fixed in r7617. This problem wasn't present in the stable build because there the if statement is different. I have no idea why it was changed in the first place.

Also the x100 Factor has to remain in the code. This is intended to overcome the internal breath regeneration threshold. If it was removed the victim would take almost no breath damage. The real issue with breath damage was the broken explosive type processing.

One more thing - I have no idea what you try to fix with the first one. I can place stacks of LBE wherever I want (LBE vest, leg gear). Can you please explain?

Also I found MOLLE items with incorrect pocket definition. Have to check that when I'm back home.

[Updated on: Sun, 26 October 2014 23:22] by Moderator


Re: Minor bugs with proposed workarounds (not necessarily fixes)[message #337193] Sun, 26 October 2014 23:55 Go to previous messageGo to next message
Ocular

 
Messages:24
Registered:September 2014
silversurfer
edit: Fixed in r7617. This problem wasn't present in the stable build because there the if statement is different. I have no idea why it was changed in the first place.


Nice, thank you. Removing the x100 was a guess that seemed to produce the intended behaviour. I should have been more suspicious about the electric stun sound that played when a merc walks into gas. Smile

silversurfer
One more thing - I have no idea what you try to fix with the first one. I can place stacks of LBE wherever I want (LBE vest, leg gear). Can you please explain?


Yes, I wasn't being clear: Trying to place an LBE item from a >1 stack of that item from a pocket popup does not work.

Test:

Stack 2 vests of the same type in the map screen inventory, then click on the vest area in the merc inventory panel and choose that vest from the pocket popup. We expect to place the least damaged LBE, but nothing happens.

Now separate the two LBEs into two stacks and retry equipping the vest via the pocket popup. It should work now.

Hand placing LBEs isn't really a very big deal since LBE status has no negative effects, but it does require searching through the sector inventory instead of using the convenient popup.
Re: Minor bugs with proposed workarounds (not necessarily fixes)[message #337242] Mon, 27 October 2014 21:27 Go to previous messageGo to next message
silversurfer

 
Messages:2551
Registered:May 2009
Ocular

Stack 2 vests of the same type in the map screen inventory, then click on the vest area in the merc inventory panel and choose that vest from the pocket popup. We expect to place the least damaged LBE, but nothing happens.

Ah, now I understand. I never used that functionality because I always keep my sector inventory clean. Wink

I can commit your fix when I'm back home at the end of the week.

Re: Minor bugs with proposed workarounds (not necessarily fixes)[message #337386] Thu, 30 October 2014 18:10 Go to previous messageGo to next message
silversurfer

 
Messages:2551
Registered:May 2009
So I was able to look at your fix for pocket popups today. I decided to not implement it and instead fix function "pocketTypeInSlot" in "Interface Items.cpp". Very Happy
It didn't return the correct pocket type for LBE slots which lead to the problem in the first place.

Fixed in r7619 (r7620).

Re: Minor bugs with proposed workarounds (not necessarily fixes)[message #337404] Fri, 31 October 2014 05:10 Go to previous messageGo to next message
Ocular

 
Messages:24
Registered:September 2014
silversurfer
So I was able to look at your fix for pocket popups today. I decided to not implement it and instead fix function "pocketTypeInSlot" in "Interface Items.cpp". Very Happy
It didn't return the correct pocket type for LBE slots which lead to the problem in the first place.


Per the title, these two patches were more like sweeping the ugly under the rug than actual attempts to fix anything Smile

But now the issues are fixed and the bugs are dead at the source thanks to you!
Re: Minor bugs with proposed workarounds (not necessarily fixes)[message #337409] Fri, 31 October 2014 14:09 Go to previous message
silversurfer

 
Messages:2551
Registered:May 2009
It's already a big help that you spotted these bugs and also the location in the code where they did their evil work. :thumbsup: Searching the code always takes me lots of time.

With "hackfixes" I tend to take a closer look to try and find a "proper" fix. This time I was successful. I just hope I didn't break anything else in the process... This code is nasty. You fix one thing in one location only to break something else in a completely different location. Wink

Previous Topic: Opponent's turn constantly stuck - can't bypass
Next Topic: Shotgun spread patterns
Goto Forum:
  


Current Time: Wed Jul 17 23:50:30 EEST 2019

Total time taken to generate the page: 0.00976 seconds