-
-
Notifications
You must be signed in to change notification settings - Fork 93
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Show designator & inhibitor range #1124
Show designator & inhibitor range #1124
Conversation
Nightly build for this pull request:
This comment is automatic and is meant to allow guests to get latest nightly builds for this pull request without registering. It is updated on every successful build. |
Not sure if both hotkey and user INI setting are needed for this, should probably pick one or the other. Although I guess if it is just hotkey it won't save the preference across sessions but if it is a feature where you'd want that then just having the user INI option is better anyway. Code itself looks good, but it should really be extended to work with inhibitors too. Display the indicators in the inhibitor's owner's color. Not sure what would do when/if Suppressors/Attractors (friendly inhibitors and enemy designators) are added but that is a bridge that can be crossed then. |
Considering those ranges only get displayed when you're firing a superweapon (btw does it only show relevant designators/inhibitors?) I don't think it's ever needed to be manually toggleable because it's not obstructive and it's kinda toggled automatically when firing the SW anyways. |
7af6265
to
fa4099e
Compare
What technical reasons? I replaced your hook with: DEFINE_HOOK(0x6DBE74, Tactical_SuperLinesCircles_ShowDesignatorRange, 0x7)
{
if (!Phobos::Config::ShowDesignatorRange || !(RulesExt::Global()->ShowDesignatorRange) || Unsorted::CurrentSWType == -1)
return 0;
const auto pSuperType = SuperWeaponTypeClass::Array()->GetItem(Unsorted::CurrentSWType);
const auto pExt = SWTypeExt::ExtMap.Find(pSuperType);
if (!pExt->ShowDesignatorRange)
return 0;
for (const auto pCurrentTechno : *TechnoClass::Array)
{
const auto pCurrentTechnoType = pCurrentTechno->GetTechnoType();
const auto pOwner = pCurrentTechno->Owner;
if (!pCurrentTechno->IsAlive
|| pCurrentTechno->InLimbo
|| !pExt->SW_Designators.Contains(pCurrentTechnoType)
|| !((pOwner == HouseClass::CurrentPlayer)
|| EnumFunctions::CanTargetHouse(AffectedHouse::Enemies, HouseClass::CurrentPlayer, pOwner)))
{
continue;
}
const auto pTechnoTypeExt = TechnoTypeExt::ExtMap.Find(pCurrentTechnoType);
const float radius = pOwner == HouseClass::CurrentPlayer ?
(float)(pTechnoTypeExt->DesignatorRange.Get(pCurrentTechnoType->Sight)) :
(float)(pTechnoTypeExt->InhibitorRange.Get(pCurrentTechnoType->Sight));
CoordStruct coords = pCurrentTechno->GetCenterCoords();
coords.Z = MapClass::Instance->GetCellFloorHeight(coords);
const auto color = pOwner->Color;
Game::DrawRadialIndicator(false, true, coords, color, radius, false, true);
}
return 0;
} E.g move it to the start of the function and fetch the SW type yourself. And it appears to work just fine, only issue is that the hook will be entered much more often (idk if this is a major performance hog though) and minor redundancy in fetching the SW type potentially twice but this comes in exchange for working independently from SW's |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM after fixing
[SuperWeapon]->SW.Designators
will display a circle with radius set in[TechnoType]->DesignatorRange
orSight
.[SuperWeapon]->SW.Inhibitors
will display a circle with radius set in[TechnoType]->InhibitorRange
orSight
.[AudioVisual]->ShowDesignatorRange=false
or per SuperWeaponType with[SuperWeapon]->ShowDesignatorRange=false
.ShowDesignatorRange
inRa2MD.ini
or with "Toggle Designator Range" hotkey in "Interface" category.In
rulesmd.ini
:In
Ra2MD.ini
: