Skip to content

Ground line for select box #1717

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

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

Conversation

NetsuNegi
Copy link
Contributor

@NetsuNegi NetsuNegi commented Jun 11, 2025

  • Grounded has been abandoned, you can now use GroundShape to specific a image which always draw on ground, it will only draw when techno is in air if set Ground.AlwaysDraw=false, this also affect on GroundLine.
  • Grounded 已经被废弃了,你现在可以通过 GroundShape 指定一个始终绘制在地面的图像,若 Ground.AlwaysDraw=false ,那么它只会在单位位于空中时绘制,这也影响 GroundLine 的绘制。
  • If GroundLine=true , the game will draw a line from techno's position to its vertical projection, GroundLine.Dashed=true means the projection line is a dashed line.
  • GroundLine=true ,那么游戏将会绘制一条从单位的位置到其垂直投影的线,GroundLine.Dashed=true 意味着投影线为虚线。

In rulesmd.ini:

[SOMESELECTBOXTYPE] ; Select box Type name
GroundShape=                            ; filename with .shp extension
GroundPalette=palette.pal               ; filename with .pal extension
GroundFrames=                           ; List of integer, default 1,1,1 for infantry, 0,0,0 for vehicle and aircraft
GroundOffset=0,0                        ; integers - horizontal, vertical
Ground.AlwaysDraw=true             ; boolean
GroundLine=false                        ; boolean
GroundLineColor=0,255,0                 ; R, G, B
GroundLineColor.ConditionYellow=        ; R, G, B
GroundLineColor.ConditionRed=           ; R, G, B
GroundLine.Dashed=false                 ; boolean

W@N 6J G9@UM4MURWLFIF

@NetsuNegi NetsuNegi added Needs testing ⚙️T1 T1 maintainer review is sufficient labels Jun 11, 2025
Copy link

github-actions bot commented Jun 11, 2025

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.

@Metadorius
Copy link
Member

Metadorius commented Jun 11, 2025

  1. Maybe it's better to use a shp to draw ground line? Optionally perhaps. Or somehow make it more tweakable. Maybe some would like a dotted or thicker line or something.
  2. Any way to display GroundShape only when flying?
  3. This would be a great candidate to add an image to docs.

@NetsuNegi
Copy link
Contributor Author

  • Maybe it's better to use a shp to draw ground line? Optionally perhaps. Or somehow make it more tweakable. Maybe some would like a dotted or thicker line or something.
  • Any way to display GroundShape only when flying?
  • This would be a great candidate to add an image to docs.

I dont think shp is a good idea, that will make it harder to draw a line which length is changeable

@NetsuNegi
Copy link
Contributor Author

NetsuNegi commented Jun 11, 2025

  1. Maybe it's better to use a shp to draw ground line? Optionally perhaps. Or somehow make it more tweakable. Maybe some would like a dotted or thicker line or something.
  2. Any way to display GroundShape only when flying?
  3. This would be a great candidate to add an image to docs.

GroundShape is designed to draw a different image than Shape. For example, a point. But I still can add a tag to prevent draw it when its height is 0.

@Metadorius
Copy link
Member

I dont think shp is a good idea, that will make it harder to draw a line which length is changeable

No way to draw only a part of the SHP?
like imagine a 4px height SHP, and the line is 6px tall, then the SHP will be drawn 1.5 times starting from the top

@Metadorius
Copy link
Member

GroundShape is designed to draw a different image than Shape. For example, a point. But I still can add a tag to prevent draw it when its height is 0.

I guess you could use InAir check for this. My thought was so that GroundShape could indicate that the unit is grounded or flying and be only used for the airborne state.

@NetsuNegi
Copy link
Contributor Author

GroundShape is designed to draw a different image than Shape. For example, a point. But I still can add a tag to prevent draw it when its height is 0.

I guess you could use InAir check for this. My thought was so that GroundShape could indicate that the unit is grounded or flying and be only used for the airborne state.

maybe check height greater than 0 also good?

@Metadorius
Copy link
Member

maybe check height greater than 0 also good?

I think it wouldn't be that useful. Hover units would also receive one then, and I don't think it would be beneficial in this case if the modder wants it only for airborne units.

IIRC InAir() determines whether AA weapons can fire on the unit too, so it could be useful for things like helicopters and planes taking off to know whether they are valid AA targets yet (when they take off). So I think it's only logical to tie those together.

@NetsuNegi
Copy link
Contributor Author

maybe check height greater than 0 also good?

I think it wouldn't be that useful. Hover units would also receive one then, and I don't think it would be beneficial in this case if the modder wants it only for airborne units.

IIRC InAir() determines whether AA weapons can fire on the unit too, so it could be useful for things like helicopters and planes taking off to know whether they are valid AA targets yet (when they take off). So I think it's only logical to tie those together.

alright

@Metadorius
Copy link
Member

Huh, I thought this behavior should be controlled via a tag, maybe something like GroundShape.ShowAlways=false. Sorry, should've made it clear initially.

@Metadorius
Copy link
Member

Also is it intended that the shadow is drawn over it?

@NetsuNegi
Copy link
Contributor Author

还有,是否打算在它上面画阴影?

I dont have that plan

@Metadorius
Copy link
Member

I dont have that plan

I meant that in your picture it looks like this:

image

I am not sure if you wanted this

@NetsuNegi
Copy link
Contributor Author

I dont have that plan

I meant that in your picture it looks like this:

image

I am not sure if you wanted this

I know, but this may be a bit troublesome

@NetsuNegi
Copy link
Contributor Author

Huh, I thought this behavior should be controlled via a tag, maybe something like GroundShape.ShowAlways=false. Sorry, should've made it clear initially.

finished

@Speederovsky
Copy link

invaders
I don't really see the shadow covering the ground shape on my units. I used colors from the unlit range, but I doubt that has effect for this kind of sprites? Also ,does Frames affect both Shape and GroundShape simultaneously?

@Speederovsky
Copy link

Seems like shape being covered by the shadows depends on DrawAboveTechno.
What's up with this though? Why is the shape drawn off-center for jumpjet infantry?
offcenter

@Metadorius
Copy link
Member

I wonder how that dotted pattern is achieved too...

@ZivDero
Copy link
Contributor

ZivDero commented Jun 11, 2025

I wonder how that dotted pattern is achieved too...

There is a line draw functiont hat draws a line with a bool[] pattern.

@NetsuNegi NetsuNegi force-pushed the origin/branch/enhanced-selectbox branch from f2996a1 to 6e99d98 Compare June 12, 2025 02:00
@NetsuNegi
Copy link
Contributor Author

I wonder how that dotted pattern is achieved too...

done

@Speederovsky
Copy link

Centering for Inf seems fixed.

@@ -245,12 +245,16 @@ RealTimeTimers.Adaptive=false ; boolean

### Select Box

![placepreview](_static/images/selectbox.png)
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
![placepreview](_static/images/selectbox.png)
![selectbox](_static/images/selectbox.png)


if (!visible)
return;
if (pSelectBox->GroundLine)
Copy link
Member

Choose a reason for hiding this comment

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

suggest to add GroundLine.AlwaysDraw too and maybe make the pattern customisable

TranslucencyLevel Translucency;
Valueable<AffectedHouse> VisibleToHouses;
Valueable<bool> VisibleToHouses_Observer;
Valueable<bool> DrawAboveTechno;
Valueable<bool> GroundShape_AlwaysDraw;
Valueable<bool> GroundLine;
Damageable<ColorStruct> GroundLineColor;
Copy link
Member

Choose a reason for hiding this comment

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

the fact that it's Damageable is not indicated in docs, maybe Shape and GroundShape should also be Damageable then too?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

no, I did

Copy link
Member

Choose a reason for hiding this comment

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

oh I missed that, pardon
what about the shapes being Damageable?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

no need that just control by frame index

@Metadorius
Copy link
Member

how did Grounded work before by the way? maybe some migration could be added?

@Metadorius
Copy link
Member

@ZivDero could you consult @NetsuNegi regarding the pattern?

@NetsuNegi
Copy link
Contributor Author

@ZivDero could you consult @NetsuNegi regarding the pattern?

what ?

@Metadorius
Copy link
Member

what ?

  1. he had some suggestion regarding usage of dashed line pattern
  2. it could be good to have it specified in INI, maybe as something like GroundLine.DashedPattern=true,false,...

@NetsuNegi
Copy link
Contributor Author

what ?

  1. he had some suggestion regarding usage of dashed line pattern
  2. it could be good to have it specified in INI, maybe as something like GroundLine.DashedPattern=true,false,...

I dont know what was that

@ZivDero
Copy link
Contributor

ZivDero commented Jun 13, 2025

what ?

  1. he had some suggestion regarding usage of dashed line pattern
  2. it could be good to have it specified in INI, maybe as something like GroundLine.DashedPattern=true,false,...

I dont know what was that

The dashed line pattern is a static bool[16] that determines which pixels are drawn. There is no need to reference the one that exists in the game.
At a minimum, you can just define your own static bool[16]. Or do what Kerbiter suggested and istead of making it static, read the bool[16] from the ini so the user can customize the pattern (though I think that may potentially be a bit too much customization?)

@Metadorius
Copy link
Member

what ?

  1. he had some suggestion regarding usage of dashed line pattern
  2. it could be good to have it specified in INI, maybe as something like GroundLine.DashedPattern=true,false,...

I dont know what was that

The dashed line pattern is a static bool[16] that determines which pixels are drawn. There is no need to reference the one that exists in the game. At a minimum, you can just define your own static bool[16]. Or do what Kerbiter suggested and istead of making it static, read the bool[16] from the ini so the user can customize the pattern (though I think that may potentially be a bit too much customization?)

If it can be done -- why not?

Also, is it required to be bool[16] specifically?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
⚙️T1 T1 maintainer review is sufficient Tested
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants