diff --git a/SaveLoadGame.cpp b/SaveLoadGame.cpp index 895a6c70..4314d33d 100644 --- a/SaveLoadGame.cpp +++ b/SaveLoadGame.cpp @@ -2350,6 +2350,7 @@ BOOLEAN SOLDIERTYPE::Load(HWFILE hFile) numBytesRead = ReadFieldByField( hFile, &this->sDiseaseFlag, sizeof(sDiseaseFlag), sizeof(UINT8), numBytesRead ); numBytesRead = ReadFieldByField( hFile, &this->ubFiller, sizeof( ubFiller ), sizeof( UINT8 ), numBytesRead ); numBytesRead = ReadFieldByField( hFile, &this->ubFiller1, sizeof( ubFiller1 ), sizeof( UINT8 ), numBytesRead ); + numBytesRead = ReadFieldByField( hFile, &this->usGLDelayMode, sizeof( usGLDelayMode ), sizeof( UINT8 ), numBytesRead ); numBytesRead = ReadFieldByField( hFile, &this->usBarrelMode, sizeof( usBarrelMode ), sizeof( UINT8 ), numBytesRead ); numBytesRead = ReadFieldByField( hFile, &this->usBarrelCounter, sizeof( usBarrelCounter ), sizeof( UINT8 ), numBytesRead ); numBytesRead = ReadFieldByField( hFile, &this->sFocusGridNo, sizeof(sFocusGridNo), sizeof(INT32), numBytesRead ); @@ -2370,6 +2371,7 @@ BOOLEAN SOLDIERTYPE::Load(HWFILE hFile) numBytesRead = ReadFieldByField( hFile, &this->ubFiller, sizeof(ubFiller), sizeof(UINT8), numBytesRead ); buffer += sizeof( ubFiller1 ); + buffer += sizeof( usGLDelayMode ); buffer += sizeof( usBarrelMode ); buffer += sizeof( usBarrelCounter ); while ( ( buffer % 4 ) > 0 ) ++buffer; @@ -2417,6 +2419,7 @@ BOOLEAN SOLDIERTYPE::Load(HWFILE hFile) buffer++; buffer += sizeof( ubFiller1 ); + buffer += sizeof( usGLDelayMode ); buffer += sizeof( usBarrelMode ); buffer += sizeof( usBarrelCounter ); while ( ( buffer % 4 ) > 0 ) ++buffer; diff --git a/Tactical/Interface Items.cpp b/Tactical/Interface Items.cpp index 0e9a4491..9a964185 100644 --- a/Tactical/Interface Items.cpp +++ b/Tactical/Interface Items.cpp @@ -4246,6 +4246,13 @@ void INVRenderItem( UINT32 uiBuffer, SOLDIERTYPE * pSoldier, OBJECTTYPE *pObjec SetFontForeground( FONT_ORANGE ); } + if ( ( ( pSoldier->bWeaponMode == WM_ATTACHED_GL || pSoldier->bWeaponMode == WM_ATTACHED_GL_BURST || pSoldier->bWeaponMode == WM_ATTACHED_GL_AUTO ) || + ( Item[pSoldier->inv[HANDPOS].usItem].usItemClass & IC_LAUNCHER && !Item[pSoldier->inv[HANDPOS].usItem].rocketlauncher ) ) && + pSoldier->usGLDelayMode ) + { + wcscat( pStr, New113Message[MSG113_FIREMODE_GL_DELAYED] ); + } + // Flugente: display barrel mode if necessary if ( pSoldier->usBarrelMode > 1 ) swprintf( pStr2, L"%s x%d", pStr, pSoldier->usBarrelMode ); diff --git a/Tactical/Soldier Control.h b/Tactical/Soldier Control.h index e0cd4494..20dcb0c8 100644 --- a/Tactical/Soldier Control.h +++ b/Tactical/Soldier Control.h @@ -1550,9 +1550,10 @@ public: // Flugente: Decrease this filler by 1 for each new UINT8 / BOOLEAN variable, so we can maintain savegame compatibility!! // Note that we also have to account for padding, so you might need to substract more than just the size of the new variables UINT8 ubFiller[12]; - UINT8 ubFiller1[2]; - - // Flugente: keep track of data for multi-barrel guns + UINT8 ubFiller1; + + // Flugente: modifiers to fire modes + UINT8 usGLDelayMode; // if > 0, delay GL grenade explosions UINT8 usBarrelMode; // states how many barrels we are currently using as modifier for our fire mode UINT8 usBarrelCounter; // states which barrel we are currently firing from (used during the firing process) diff --git a/Tactical/Weapons.cpp b/Tactical/Weapons.cpp index 709c2ece..169a6b12 100644 --- a/Tactical/Weapons.cpp +++ b/Tactical/Weapons.cpp @@ -4503,6 +4503,12 @@ BOOLEAN UseLauncher( SOLDIERTYPE *pSoldier, INT32 sTargetGridNo ) CalculateLaunchItemParamsForThrow( pSoldier, sTargetGridNo, pSoldier->bTargetLevel, 0, &Launchable, uiHitChance, THROW_ARM_ITEM, 0, usItemNum ); + // Flugente: depending on fire mode, delay explosion + if ( pSoldier->usGLDelayMode ) + { + ( *pSoldier->pTempObject )[0]->data.sObjectFlag |= DELAYED_GRENADE_EXPLOSION; + } + iID = CreatePhysicalObject( pSoldier->pTempObject, pSoldier->pThrowParams->dLifeSpan, pSoldier->pThrowParams->dX, pSoldier->pThrowParams->dY, pSoldier->pThrowParams->dZ, pSoldier->pThrowParams->dForceX, pSoldier->pThrowParams->dForceY, pSoldier->pThrowParams->dForceZ, pSoldier->ubID, pSoldier->pThrowParams->ubActionCode, pSoldier->pThrowParams->uiActionData, FALSE ); // OJW - 20091002 - Explosives @@ -9619,44 +9625,56 @@ void ChangeWeaponMode( SOLDIERTYPE * pSoldier ) return; } - // Flugente: if there is a higher barrel configuration, use that - // otherwise, go back to one barrel and try next mode - pSoldier->usBarrelMode = max( 1, pSoldier->usBarrelMode ); - UINT8 nextbarrelmode = GetNextBarrelMode( pSoldier->inv[HANDPOS].usItem, pSoldier->usBarrelMode ); - if ( nextbarrelmode > pSoldier->usBarrelMode ) + // Flugente: if we are in a GL fire mode, switch between impact/delayed mode + if ( ( ( pSoldier->bWeaponMode == WM_ATTACHED_GL || pSoldier->bWeaponMode == WM_ATTACHED_GL_BURST || pSoldier->bWeaponMode == WM_ATTACHED_GL_AUTO) || + ( Item[pSoldier->inv[HANDPOS].usItem].usItemClass & IC_LAUNCHER && !Item[pSoldier->inv[HANDPOS].usItem].rocketlauncher) ) && + !pSoldier->usGLDelayMode ) { - pSoldier->usBarrelMode = nextbarrelmode; + pSoldier->usGLDelayMode = 1; } else { - // start again with the first barrel configuration - pSoldier->usBarrelMode = nextbarrelmode; + pSoldier->usGLDelayMode = 0; - do + // Flugente: if there is a higher barrel configuration, use that + // otherwise, go back to one barrel and try next mode + pSoldier->usBarrelMode = max( 1, pSoldier->usBarrelMode ); + UINT8 nextbarrelmode = GetNextBarrelMode( pSoldier->inv[HANDPOS].usItem, pSoldier->usBarrelMode ); + if ( nextbarrelmode > pSoldier->usBarrelMode ) { - pSoldier->bWeaponMode++; + pSoldier->usBarrelMode = nextbarrelmode; + } + else + { + // start again with the first barrel configuration + pSoldier->usBarrelMode = nextbarrelmode; - if ( pSoldier->bWeaponMode == NUM_WEAPON_MODES ) + do { - if ( Weapon[pSoldier->inv[HANDPOS].usItem].NoSemiAuto ) - pSoldier->bWeaponMode = WM_AUTOFIRE; - else - pSoldier->bWeaponMode = WM_NORMAL; + pSoldier->bWeaponMode++; - if ( HasAttachmentOfClass( &( pSoldier->inv[HANDPOS] ), AC_RIFLEGRENADE ) ) + if ( pSoldier->bWeaponMode == NUM_WEAPON_MODES ) { - OBJECTTYPE* pRifleGrenadeDeviceObj = FindAttachment_GrenadeLauncher( &( pSoldier->inv[HANDPOS] ) ); + if ( Weapon[pSoldier->inv[HANDPOS].usItem].NoSemiAuto ) + pSoldier->bWeaponMode = WM_AUTOFIRE; + else + pSoldier->bWeaponMode = WM_NORMAL; - if ( pRifleGrenadeDeviceObj && FindLaunchableAttachment( &( pSoldier->inv[HANDPOS] ), pRifleGrenadeDeviceObj->usItem ) ) + if ( HasAttachmentOfClass( &( pSoldier->inv[HANDPOS] ), AC_RIFLEGRENADE ) ) { - pSoldier->bWeaponMode = WM_ATTACHED_GL; + OBJECTTYPE* pRifleGrenadeDeviceObj = FindAttachment_GrenadeLauncher( &( pSoldier->inv[HANDPOS] ) ); + + if ( pRifleGrenadeDeviceObj && FindLaunchableAttachment( &( pSoldier->inv[HANDPOS] ), pRifleGrenadeDeviceObj->usItem ) ) + { + pSoldier->bWeaponMode = WM_ATTACHED_GL; + } } } } + // Changed by ADB, rev 1513 + //while(IsGunWeaponModeCapable( pSoldier, HANDPOS, pSoldier->bWeaponMode ) == FALSE && pSoldier->bWeaponMode != WM_NORMAL); + while ( IsGunWeaponModeCapable( &pSoldier->inv[HANDPOS], static_cast( pSoldier->bWeaponMode ), pSoldier ) == FALSE && pSoldier->bWeaponMode != WM_NORMAL ); } - // Changed by ADB, rev 1513 - //while(IsGunWeaponModeCapable( pSoldier, HANDPOS, pSoldier->bWeaponMode ) == FALSE && pSoldier->bWeaponMode != WM_NORMAL); - while ( IsGunWeaponModeCapable( &pSoldier->inv[HANDPOS], static_cast( pSoldier->bWeaponMode ), pSoldier ) == FALSE && pSoldier->bWeaponMode != WM_NORMAL ); } if (pSoldier->bWeaponMode == WM_AUTOFIRE || pSoldier->bWeaponMode == WM_ATTACHED_GL_AUTO || pSoldier->bWeaponMode == WM_ATTACHED_UB_AUTO) diff --git a/TileEngine/physics.cpp b/TileEngine/physics.cpp index 7255503a..840b28f5 100644 --- a/TileEngine/physics.cpp +++ b/TileEngine/physics.cpp @@ -2596,17 +2596,18 @@ void HandleArmedObjectImpact( REAL_OBJECT *pObject ) } else { - // Flugente: explosions on the roof do work... - // If we landed on anything other than the floor, always! go off... - if ( pObject->fInWater || - !fCanDelayExplosion || - fGoodStatus && !gGameExternalOptions.fDelayedGrenadeExplosion && !fDelayedExplosion ) - { - fDoImpact = TRUE; - fIsDud = false; - } - else // didn't go off! + fDoImpact = TRUE; + fIsDud = false; + + // Flugente: explosion does not happen instantly if grenade + // is not in water and + // either has a bad status or is a delayed grenade + if ( !pObject->fInWater && + ( !fGoodStatus || + ( fCanDelayExplosion && gGameExternalOptions.fDelayedGrenadeExplosion && fDelayedExplosion) ) ) { + // didn't go off! + fDoImpact = FALSE; fIsDud = true; } } diff --git a/Utils/Text.h b/Utils/Text.h index 8e196c72..c0bb3180 100644 --- a/Utils/Text.h +++ b/Utils/Text.h @@ -2534,6 +2534,7 @@ enum MSG113_BINOCULAR, MSG113_PATIENCE, MSG113_SHIELD_DESTROYED, + MSG113_FIREMODE_GL_DELAYED, TEXT_NUM_MSG113, }; diff --git a/Utils/_ChineseText.cpp b/Utils/_ChineseText.cpp index 39886704..cf4c2de0 100644 --- a/Utils/_ChineseText.cpp +++ b/Utils/_ChineseText.cpp @@ -7454,6 +7454,7 @@ STR16 New113Message[] = L"望远镜", L"耐心", L"%s 的防护盾毁坏了!", //L"%s's shield has been destroyed!", + L" DELAY", // TODO.Translate }; STR16 New113HAMMessage[] = diff --git a/Utils/_DutchText.cpp b/Utils/_DutchText.cpp index fcf2e984..45a609cc 100644 --- a/Utils/_DutchText.cpp +++ b/Utils/_DutchText.cpp @@ -7466,6 +7466,7 @@ STR16 New113Message[] = L"a binocular", L"patience", L"%s's shield has been destroyed!", // TODO.Translate + L" DELAY", // TODO.Translate }; // TODO.Translate diff --git a/Utils/_EnglishText.cpp b/Utils/_EnglishText.cpp index ead64f52..a3d7915b 100644 --- a/Utils/_EnglishText.cpp +++ b/Utils/_EnglishText.cpp @@ -7454,6 +7454,7 @@ STR16 New113Message[] = L"a binocular", L"patience", L"%s's shield has been destroyed!", + L" DELAY", }; STR16 New113HAMMessage[] = diff --git a/Utils/_FrenchText.cpp b/Utils/_FrenchText.cpp index 27c6f496..bb8b27dd 100644 --- a/Utils/_FrenchText.cpp +++ b/Utils/_FrenchText.cpp @@ -7463,6 +7463,7 @@ STR16 New113Message[] = L"des jumelles", L"de la patience", L"%s's shield has been destroyed!", // TODO.Translate + L" DELAY", // TODO.Translate }; STR16 New113HAMMessage[] = diff --git a/Utils/_GermanText.cpp b/Utils/_GermanText.cpp index eff3b7d6..2a20deda 100644 --- a/Utils/_GermanText.cpp +++ b/Utils/_GermanText.cpp @@ -7290,6 +7290,7 @@ STR16 New113Message[] = L"a binocular", L"patience", L"%s's shield has been destroyed!", // TODO.Translate + L" DELAY", // TODO.Translate }; STR16 New113HAMMessage[] = diff --git a/Utils/_ItalianText.cpp b/Utils/_ItalianText.cpp index 15b2d6ed..7f45e1f7 100644 --- a/Utils/_ItalianText.cpp +++ b/Utils/_ItalianText.cpp @@ -7457,6 +7457,7 @@ STR16 New113Message[] = L"a binocular", L"patience", L"%s's shield has been destroyed!", // TODO.Translate + L" DELAY", // TODO.Translate }; // TODO.Translate diff --git a/Utils/_PolishText.cpp b/Utils/_PolishText.cpp index fc0c1ea3..8dd66062 100644 --- a/Utils/_PolishText.cpp +++ b/Utils/_PolishText.cpp @@ -7466,6 +7466,7 @@ STR16 New113Message[] = L"a binocular", L"patience", L"%s's shield has been destroyed!", // TODO.Translate + L" DELAY", // TODO.Translate }; STR16 New113HAMMessage[] = diff --git a/Utils/_RussianText.cpp b/Utils/_RussianText.cpp index 73e37154..58ee525d 100644 --- a/Utils/_RussianText.cpp +++ b/Utils/_RussianText.cpp @@ -7454,6 +7454,7 @@ STR16 New113Message[] = L"бинокль", L"терпение", L"%s's shield has been destroyed!", // TODO.Translate + L" DELAY", // TODO.Translate }; STR16 New113HAMMessage[] =