From 23d89122b35b53c913f0b921132eae7fbb32ead2 Mon Sep 17 00:00:00 2001 From: aMannus Date: Wed, 10 May 2023 15:15:33 +0200 Subject: [PATCH] CC: No longer rely on received parameter to be 0 (#2870) --- .../crowd-control/CrowdControl.cpp | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/soh/soh/Enhancements/crowd-control/CrowdControl.cpp b/soh/soh/Enhancements/crowd-control/CrowdControl.cpp index a3af11682..a7265a23a 100644 --- a/soh/soh/Enhancements/crowd-control/CrowdControl.cpp +++ b/soh/soh/Enhancements/crowd-control/CrowdControl.cpp @@ -417,6 +417,7 @@ CrowdControl::Effect* CrowdControl::ParseMessage(char payload[512]) { break; case kEffectFillHeart: effect->giEffect = new GameInteractionEffect::ModifyHealth(); + effect->giEffect->parameters[0] = receivedParameter; break; case kEffectKnockbackLinkWeak: effect->giEffect = new GameInteractionEffect::KnockbackPlayer(); @@ -454,6 +455,7 @@ CrowdControl::Effect* CrowdControl::ParseMessage(char payload[512]) { break; case kEffectAddRupees: effect->giEffect = new GameInteractionEffect::ModifyRupees(); + effect->giEffect->parameters[0] = receivedParameter; break; case kEffectGiveDekuShield: effect->giEffect = new GameInteractionEffect::GiveOrTakeShield(); @@ -465,26 +467,32 @@ CrowdControl::Effect* CrowdControl::ParseMessage(char payload[512]) { break; case kEffectRefillSticks: effect->giEffect = new GameInteractionEffect::AddOrTakeAmmo(); + effect->giEffect->parameters[0] = receivedParameter; effect->giEffect->parameters[1] = ITEM_STICK; break; case kEffectRefillNuts: effect->giEffect = new GameInteractionEffect::AddOrTakeAmmo(); + effect->giEffect->parameters[0] = receivedParameter; effect->giEffect->parameters[1] = ITEM_NUT; break; case kEffectRefillBombs: effect->giEffect = new GameInteractionEffect::AddOrTakeAmmo(); + effect->giEffect->parameters[0] = receivedParameter; effect->giEffect->parameters[1] = ITEM_BOMB; break; case kEffectRefillSeeds: effect->giEffect = new GameInteractionEffect::AddOrTakeAmmo(); + effect->giEffect->parameters[0] = receivedParameter; effect->giEffect->parameters[1] = ITEM_SLINGSHOT; break; case kEffectRefillArrows: effect->giEffect = new GameInteractionEffect::AddOrTakeAmmo(); + effect->giEffect->parameters[0] = receivedParameter; effect->giEffect->parameters[1] = ITEM_BOW; break; case kEffectRefillBombchus: effect->giEffect = new GameInteractionEffect::AddOrTakeAmmo(); + effect->giEffect->parameters[0] = receivedParameter; effect->giEffect->parameters[1] = ITEM_BOMBCHU; break; @@ -811,16 +819,6 @@ CrowdControl::Effect* CrowdControl::ParseMessage(char payload[512]) { break; } - // If no value is specifically set, default to using whatever CC sends us. - // Values are used for various things depending on the effect, but they - // usually represent the "amount" of an effect. Amount of hearts healed, - // strength of knockback, etc. - if (effect->giEffect != NULL) { - if (!effect->giEffect->parameters[0]) { - effect->giEffect->parameters[0] = receivedParameter; - } - } - return effect; }