Skip to content
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

New Infotypes and new display method #1287

Open
wants to merge 30 commits into
base: develop
Choose a base branch
from

Conversation

CrimRecya
Copy link
Contributor

@CrimRecya CrimRecya commented Jun 23, 2024

New InfoType: ROF timer, Reload timer, Spawn timer, Gattling timer, Produce cash timer, Passenger kill timer, Auto death timer, SW timer, IronCurtain timer, Temporal remainder.

  • If Shape.PercentageFrame set to true, it will only draw one frame that corresponds to total frames by percentage.
  • VisibleInSpecialState controls whether this display type will show when the owner is in ironcurtain or is attacked by a temporal weapon.
  • ValueAsTimer controls whether the value will be displayed in the form of a timer (i.e. 5:00, 25:00 or 1:00:00).

In rulesmd.ini:

InfoType=Health                         ; Displayed value enumeration (health|shield|ammo|mindcontrol|spawns|passengers|tiberium|experience|occupants|gattlingstage|ROF|Reload|SpawnTimer|GattlingTimer|ProduceCash|PassengerKill|AutoDeath|SuperWeapon|IronCurtain|TemporalLife)
Shape.PercentageFrame=false             ; boolean
VisibleInSpecialState=true              ; boolean
ValueAsTimer=false                      ; boolean

@CrimRecya CrimRecya changed the title New Infotypes and New display method New Infotypes and new display method Jun 23, 2024
@chaserli
Copy link
Contributor

I get the idea of having visuals of misc info on the techno. I would like to elaborate the plan/vision on "custom healthbar" here. We may want to choose between a bar or a digital display, or even to keep both.
The idea is to redirect the drawhealthbar vtbl call completely, and draw both the bars and the "digital displays" there. We need to redesign a system with minimum overhead for this.
I wonder if you can get the idea and help working on it

@CrimRecya
Copy link
Contributor Author

I get the idea of having visuals of misc info on the techno. I would like to elaborate the plan/vision on "custom healthbar" here. We may want to choose between a bar or a digital display, or even to keep both. The idea is to redirect the drawhealthbar vtbl call completely, and draw both the bars and the "digital displays" there. We need to redesign a system with minimum overhead for this. I wonder if you can get the idea and help working on it

That's really good!
Although I also really want to join, I haven't had much time in these months. So I only have these little features to share. Besides, I really don't know much about decompilation yet, so even if I have time, I'm afraid I won't be able to help much. Waiting the news of your success :)

@Metadorius
Copy link
Member

Metadorius commented Jun 23, 2024

That's really good! Although I also really want to join, I haven't had much time in these months. So I only have these little features to share. Besides, I really don't know much about decompilation yet, so even if I have time, I'm afraid I won't be able to help much. Waiting the news of your success :)

Are you on our Discord channel? I am sure we can collaborate on that and help you :)

@CrimRecya
Copy link
Contributor Author

That's really good! Although I also really want to join, I haven't had much time in these months. So I only have these little features to share. Besides, I really don't know much about decompilation yet, so even if I have time, I'm afraid I won't be able to help much. Waiting the news of your success :)

Are you on our Discord channel? I am sure we can collaborate on that and help you :)

I really want to join, but due to some special reasons, even if I use my VPN, I still cannot connect to Discord's server ;-(
It seems like I need to change my VPN in the future when I have more time

@chaserli chaserli marked this pull request as draft June 30, 2024 08:11
@chaserli
Copy link
Contributor

That's really good! Although I also really want to join, I haven't had much time in these months. So I only have these little features to share. Besides, I really don't know much about decompilation yet, so even if I have time, I'm afraid I won't be able to help much. Waiting the news of your success :)

No it's just a framework we need to establish and I think it would be better if you can help working on that rather than patching this one.
Do you need some hint for what I was saying?
Basically if you look into TechnoClass::DrawHealthBar you'll see there were too much overhead, the idea is that you use its nature of being virtual and rewrite 4 functions for 4 final technoclasses.
For example

void __fastcall BuildingClass_DrawHealthbar_New(BuildingClass* self,void*,Point2D* loc, RectangleStruct* bounds, bool disguise)
{
Draw healthbar
Draw shieldbar
Draw ic bar
Draw temporal bar
Draw other bars...
Draw digital displays...
All these shit managed by a new framework

if(....)
drawpipscalepips
}
DEFINE_JUMP(VTABLE,0x7E4308, BuildingClass_DrawHealthbar_New)

@CrimRecya
Copy link
Contributor Author

That's really good! Although I also really want to join, I haven't had much time in these months. So I only have these little features to share. Besides, I really don't know much about decompilation yet, so even if I have time, I'm afraid I won't be able to help much. Waiting the news of your success :)

No it's just a framework we need to establish and I think it would be better if you can help working on that rather than patching this one. Do you need some hint for what I was saying? Basically if you look into TechnoClass::DrawHealthBar you'll see there were too much overhead, the idea is that you use its nature of being virtual and rewrite 4 functions for 4 final technoclasses. For example

void __fastcall BuildingClass_DrawHealthbar_New(BuildingClass* self,void*,Point2D* loc, RectangleStruct* bounds, bool disguise)
{
Draw healthbar
Draw shieldbar
Draw ic bar
Draw temporal bar
Draw other bars...
Draw digital displays...
All these shit managed by a new framework

if(....)
drawpipscalepips
}
DEFINE_JUMP(VTABLE,0x7E4308, BuildingClass_DrawHealthbar_New)

Oh yes, I see what you mean. But I'm sorry I can't be of any help. As I mentioned before, I currently don't have so much time to finish a completely new function, so I just built these on what already have.

Copy link

github-actions bot commented Jul 7, 2024

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.

@Speederovsky
Copy link

Those AutoDeath and SW ones definitely seem useful. Have you considered a way to define whether the SW display is for SuperWeapon/SuperWeapon2 or perhaps even an entry from the list of SuperWeapons? It would also be neat for SWs to have an option to display the actual timer rather than remaining time in % or seconds, if possible as an option.

CrimRecya and others added 5 commits February 14, 2025 00:27
Co-Authored-By: Netsu_Negi <[email protected]>
…e on uncrushable unit (Phobos-developers#1529)

- Fix an issue where a unit will leave an impassable invisible barrier
in its original position when it is teleported by ChronoSphere onto an
uncrushable unit and self destruct.

Thx to @NetsuNegi .
- fixing ammo block inside tank bunkers;
 - partially fixing ammo adding/substracting inside tank bunkers

still problems with converters

---------

Co-authored-by: Coronia <[email protected]>
…developers#1524)

<!-- Please add [Minor] to the title or the description if this change
should not be mentioned in documentation, what's new and no credit needs
to be given. -->

---------

Co-authored-by: 绯红热茶 <[email protected]>
@Speederovsky
Copy link

Any updates on this?

@CrimRecya CrimRecya marked this pull request as ready for review February 24, 2025 18:50
@Speederovsky
Copy link

ValueAsTimer seems to work quite nicely.

Copy link
Contributor

@Starkku Starkku left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Couple of questions and one small thing that could be changed.

Some of the code is also very long / verbose but unsure if there's much that can do about that, maybe split into smaller functions if can find a logical way to do so.

Comment on lines +147 to +158
void TechnoExt::ExtData::InitializeDisplayInfo()
{
const auto pThis = this->OwnerObject();
const auto pPrimary = pThis->GetWeapon(0)->WeaponType;
pThis->RearmTimer.Start(0);

if (pPrimary && pThis->GetTechnoType()->LandTargeting != LandTargetingType::Land_Not_OK)
pThis->RearmTimer.TimeLeft = pPrimary->ROF;
else if (const auto pSecondary = pThis->GetWeapon(1)->WeaponType)
pThis->RearmTimer.TimeLeft = pSecondary->ROF;
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is this for? Why are you explicitly setting RearmTimer on techno creation?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Before the techno fires for the first time, RearmTimer is not set, which will not display anything.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants