Skip to content

Commit 85669c3

Browse files
FryoneBelonitCoronia
authored
Fix VoiceDeploy not playing when deploying through hot-key/command bar. (#1115)
VoiceDeploy now plays when 1 unit is ordered to deploy through hot-key/command bar. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **Bug Fixes** - Fixed an issue where the deployment sound was not played when using hot-key/command bar for `VoiceDeploy`. - **New Features** - Added audio feedback for player actions through `VoiceDeploy` feature. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: Belonit <[email protected]> Co-authored-by: Coronia <[email protected]>
1 parent 9afc212 commit 85669c3

File tree

4 files changed

+37
-0
lines changed

4 files changed

+37
-0
lines changed

CREDITS.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -416,6 +416,7 @@ This page lists all the individual contributions to the project by their author.
416416
- Flashing Technos on selecting
417417
- Promotion animation
418418
- Damaged unit image changes
419+
- `VoiceDeploy` through hot-key/command bar fix
419420
- **ZivDero**:
420421
- Re-enable the Veinhole Monster and Weeds from TS
421422
- Recreate the weed-charging of SWs like the TS Chemical Missile

docs/Fixed-or-Improved-Logics.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,7 @@ This page describes all ingame logics that are fixed or improved in Phobos witho
223223
- Fixed the bug that `AllowAirstrike=no` cannot completely prevent air strikes from being launched against it.
224224
- Fixed the issue where computer players did not search for new enemies after defeating them or forming alliances with them.
225225
- Fixed the bug that infantry ignored `Passengers` and `SizeLimit` when entering buildings.
226+
- Fixed `VoiceDeploy` not played, when deployed through hot-key/command bar.
226227

227228
## Fixes / interactions with other extensions
228229

docs/Whats-New.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -684,6 +684,7 @@ Vanilla fixes:
684684
- Fixed an issue that harvesters with amphibious movement zone can not automatically return to refineries with `WaterBound` on water surface (by NetsuNegi)
685685
- Fixed an issue that game crashes (EIP:7FB178) when infantry are about to enter an occupiable building that has been removed and is not real dead (by CrimRecya)
686686
- Fixed an issue that game crashes when spawnee has been removed and is not real dead (by CrimRecya)
687+
- Fixed `VoiceDeploy` not played, when deployed through hot-key/command bar (by Fryone)
687688
688689
Phobos fixes:
689690
- Fixed a few errors of calling for superweapon launch by `LaunchSW` or building infiltration (by Trsdy)

src/Ext/Techno/Hooks.Misc.cpp

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -764,4 +764,38 @@ DEFINE_HOOK(0x70FB73, FootClass_IsBunkerableNow_Dehardcode, 0x6)
764764
auto const pTypeExt = TechnoTypeExt::ExtMap.Find(pType);
765765
return pTypeExt->BunkerableAnyway ? CanEnter : 0;
766766
}
767+
768+
DEFINE_HOOK(0x730D1F, DeployCommandClass_Execute_VoiceDeploy, 0x5)
769+
{
770+
GET_STACK(int, unitsToDeploy, STACK_OFFSET(0x18, -0x4));
771+
772+
if (unitsToDeploy != 1)
773+
return 0;
774+
775+
GET(TechnoClass* const, pThis, ESI);
776+
auto const whatAmI = pThis->WhatAmI();
777+
778+
if (whatAmI == AbstractType::Infantry)
779+
{
780+
auto pInfantry = static_cast<InfantryClass*>(pThis);
781+
782+
if (!pInfantry->IsDeploying)
783+
{
784+
if (pInfantry->IsDeployed())
785+
pThis->QueueVoice(pThis->GetTechnoType()->VoiceUndeploy);
786+
else
787+
pThis->QueueVoice(pThis->GetTechnoType()->VoiceDeploy);
788+
}
789+
}
790+
else if (whatAmI == AbstractType::Unit)
791+
{
792+
auto pUnit = static_cast<UnitClass*>(pThis);
793+
794+
if (pUnit->TryToDeploy() || pUnit->Type->IsSimpleDeployer)
795+
pThis->QueueVoice(pThis->GetTechnoType()->VoiceDeploy);
796+
}
797+
798+
return 0;
799+
}
800+
767801
#pragma endregion

0 commit comments

Comments
 (0)