Update! Thanks again to everyone so far who's encouraged and helped me to get stuck in to this
OK, so I've scoured through the code and can't find a way to specify lemming states as a condition. I've tried
if (Lemming.Type.FLOATER = true || Lemming.Type.BUILDER = true)to no avail.
So, I tried Charles' suggestion instead in the meantime. The
midX function has 8 references throughout the project, so 7 other things (cursor position being one of them, obvs) are affected by tinkering with this:
LemminiPanel.java line 925
LemmCursor.java line 206
Lemming.java lines 1208 & 1112
Sprite.java line 249, 359 & 361
(I changed all of these to
footX, as suggested).
The result was that the number appeared very far off to the right of the lemming:
Rather than change everything back to
midX, however, I've kept the other 7 references as
footX, and instead made the
midX function return
x + 3. This fixes the x-Position of the number for
all states except the right-facing Faller (even the left-facing Faller has a perfectly central number):
(As you can see, though, the left-facing faller appears as if it's slightly inside the terrain block, whereas the right-facing faller is in a better position relative to it. This is clearly a different problem, then, which seems to be specific to the Faller graphic. The left-facing one needs to be moved 3px to the left, which would mean that the timer number would be 3px too far to the right for both Faller states.)This at the very least makes the countdown number behave similarly to the Amiga version (i.e.
xPos = 3px over to the right for right-facing Fallers, and perfectly central for everything else). So, I'm happy that this is fixed, although may want to add a line of code to shunt it 3px to the left (or, indeed, not move it at all) for Fallers
when I can figure out how to specify lemming states as a condition.
This only leaves the
yPos, which is currently dependent on the actual sprite graphics themselves, with the timer number appearing higher above the head for Floaters, Builders, Miners and even Diggers (due to the terrain spray). My feelings here are that only Floaters really need the extra headroom; the other states only feature momentary overlaps between the lemming sprite and the timer number. So, again, once I know how to specify lemming states as a condition I'll move the timer number 18px above the lemming's foot for all states except Floater.
I wonder if it's worth adding an extra function which returns
y - 18 in order to achieve this, and use the original
midY (which returns
y - lemRes.size) for the case of Floaters. This would mean that all other code which depends on
midY would stay as it is, whilst the timer number code can remain relatively tidy. Alternatively, using Pooty's
int my = l.footY(); variable seems an elegant enough way to achieve the desired result using only the existing functions.
Incidentally, I had a look at how the timer number appears in WinLemm, and it's all over the place! It seems Lemmini actually reduced the bugginess of this particular feature.