Unjam function added to reload hotkey#583
Open
Greysa wants to merge 6 commits into1dot13:masterfrom
Open
Conversation
TODO: text strings check dual wielding
Contributor
Author
|
sorry for fix #580 being a part of this pull request. I am a dummy and forgot to create a branch before working on either of these items. |
Asdow
requested changes
Apr 17, 2026
| PlayJA2Sample( Weapon[ Item[pObj->usItem].ubClassIndex ].ManualReloadSound, RATE_11025, SoundVolume( HIGHVOLUME, pSoldier->sGridNo ), 1, SoundDir( pSoldier->sGridNo ) ); | ||
|
|
||
| if ( pSoldier->IsValidSecondHandShot( ) ) | ||
| if (pObj2 != NULL)//( pSoldier->IsValidSecondHandShot( ) ) |
Contributor
There was a problem hiding this comment.
Delete the commented out code. No need to clutter the codebase with commented out code, unless there's a good reason to do so.
| if (pObj2 != NULL)//( pSoldier->IsValidSecondHandShot( ) ) | ||
| { | ||
| pObj2 = &(pSoldier->inv[SECONDHANDPOS]); | ||
| //pObj2 = &(pSoldier->inv[SECONDHANDPOS]); |
| { | ||
| // Flugente: check for underbarrel weapons and use that object if necessary | ||
| pObj = pSoldier->GetUsedWeapon( &( pSoldier->inv[SECONDHANDPOS] ) ); | ||
| //pObj2 = pSoldier->GetUsedWeapon( &( pSoldier->inv[SECONDHANDPOS] ) ); |
Contributor
There was a problem hiding this comment.
Remove instead of commenting out
|
|
||
| // Flugente: check for underbarrel weapons and use that object if necessary | ||
| pObj = pSoldier->GetUsedWeapon( &(pSoldier->inv[HANDPOS]) ); | ||
| if (pSoldier->IsValidSecondHandShotForReloadingPurposes()) //check for valid second hand weapon for reloading purposes (something that doesn't use ammo) |
Contributor
There was a problem hiding this comment.
Initialize pObj2 to null and then you only need to have the if {} block without else {}. Not strictly necessary, but I do find that more readable and c++ being what it is, initializing values is a good habit to have :)
| else | ||
| { | ||
| if ( pSoldier->IsValidSecondHandShot( ) ) | ||
| if (pObj2 != NULL)//( pSoldier->IsValidSecondHandShot( ) ) |
| if (pObj2 != NULL)//( pSoldier->IsValidSecondHandShot( ) ) | ||
| { | ||
| pObj2 = &(pSoldier->inv[SECONDHANDPOS]); | ||
| //pObj2 = &(pSoldier->inv[SECONDHANDPOS]); |
| // then do a reload of both guns! | ||
| // Flugente: only reload if it's empty, or we really want to | ||
| if ( pSoldier->IsValidSecondHandShotForReloadingPurposes() | ||
| if ( pObj2 != NULL //pSoldier->IsValidSecondHandShotForReloadingPurposes() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds unjam function to the Alt + r reload hotkey.
Currently, when a weapon is jammed, the only way to unjam it in tactical is to shoot the weapon again. This may or may not unjam the weapon based on the skill of the character wielding the weapon. Repeated attempts may be required to unjam the weapon, potentially leaving the character exposed to atttack. Alternatively, the character can find cover, but shooting is still required to unjam the weapon, potentially wasting AP (and ammo) on an unnecesary action.
This change allows the character to unjam the weapon without needing to shoot. The character can now find cover and deal with the jam without spending AP shooting at nothing. A reload is not performed if the weapon is jammed, allowing a character to clear the jam and continue shooting without spending AP on an unnecesary reload.
The reload now has two functions based on the jam state of the weapon.
If the weapon is jammed, attempt to clear jam. Do not reload.
If the weapon is not jammed, reload weapon.
This also functions with dual wielded weapons. No reload will occur if either weapon is jammed and either or both weapons will be unjammed as required.