Closed EvgenijK closed 1 year ago
May be @jezek can check this PR?
I'm sure, this is not the right way to fix this issue. It may break some other things, cause detecting special attr/char codes is not dependent on attribute and char being more than 128 anymore (the (a & 0x80) && (c & 0x80)
condition), but just on the char value (the previous c > MAX_FONT_CHAR
condition). Note, that the MAX_FON_CHAR may change and you neglect the change in our fix.
What I would suggest, you try to add a new condition between the if (avoid_other) {...}
and the else if (c > MAX_FONT_CHAR) {..}
which matches your bug description (mimic & clear monsters). Maybe the mimic flickering would be fixed if you add (*cp) = c; (*ap) = a;
after mimic_object(&a, &c, c_ptr->m_idx);
above your changes.
Thanks for the comment.
Now i see two possible solutions:
1) If the if (c > MAX_FONT_CHAR)
placed here because *cp
and *ap
must be set to some values before other manipulations, what about to move it before if (avoid_other)
without an else
to the avoid_other
?
Like this:
if (c > MAX_FONT_CHAR) {
/* Use char */
(*cp) = c;
/* Use attr */
(*ap) = a;
}
if (avoid_other) {
/* Use char */
(*cp) = c;
/* Use attr */
(*ap) = a;
}
2) May be else if (c > MAX_FONT_CHAR) {...}
should be in the end of if statements chain, after the /* Normal */
part?
This way all code for shape-changers and flickering will be reached and if not, it will fallback to this condition.
Hmm, I don't really know, what are you trying fix here.
Yes, according to git blame I am responsible for the condition, but I just replaced all previous special/graphic character detections, like this one. I didn't study the code.
So unless you provide some information on what are you trying to fix and how to reproduce the error you are trying to fix, I can't help you.
- If the
if (c > MAX_FONT_CHAR)
placed here because*cp
and*ap
must be set to some values before other manipulations, what about to move it beforeif (avoid_other)
without anelse
to theavoid_other
?
Like I said, I don't know, why it was placed there, but if you want to rewrite it without the else
, you can write it like
if ((avoid_other) || (c > MAX_FONT_CHAR)) {
/* Use char */
(*cp) = c;
/* Use attr */
(*ap) = a;
}
I updated the first message to provide more information.
Also trying to summon @CBlueGH or other devs here)
Ahh, I see. It's the monster mappings. I recall to test the graphic tiles only for floor tiles (not monster tiles), so that's why it slipped under my radar. My mistake and I appologize.
I don't know why old
else if ((a & 0x80) && (c & 0x80))
was there.
Before I made the graphic tiles commits, graphic tiles did not work at all. Therefore the else if...
statement was never true, so no flickering glitches for font graphic tiles were present. And before my graphic tiles changes the old tiles didn't have the possibility to make color flicker, because the colors in tiles were always the same. So before, if an tile was a graphic tile there was no need to make the attribute flicker, that's why the condition there was made (I think).
But now, even a graphic tile uses attribute colors, so even a graphic tile needs the same same attribute handling as ordinary tile. I haven't tested it yet, but my theory is, that if you delete the else if (c > MAX_FONT_CHAR) {...}
condition, the flickering should be OK. (Because the other conditions that handle flickering are else if
conditions too, and if the MAX_FONT_CHAR
condition matches, no other code that handles flickering will be executed)
Try my suggestion (deleting the condition), and if it not works I'll try to reproduce the bug and fix it too.
Also, you say, the graphical monsters are purple. I've examined the tiles from #48 and I see, all the monsters have purple color (mostly #d700d7
), but only the color #ff00ff
gets changed into the foreground color (and only #000000
gets changed to bg color). So you have to redraw the monster graphic tiles and change all the purple, you want to change to fg_color in game, to #ff00ff
color. (I think I wrote this somewhere to documentation, if it is not written anywhere, it should be)
Yes, it's working without the condition.
Ah. sorry about the color, i use #ff00ff
in my tiles, but cant say for sure what i see in the game (i have a type of color blindness, one reason to make own tiles)
I'm glad to hear, it's working.
Could you, please, update this PR and the tomenet_gfx_example.zip
in #48, so I can test and then approve the PR.
Also, when you finish making the monster tiles and share them, please ping me, I would like to try them out. :wink: Thanks.
Done
I have also added explanation of my tiles.
Thank you. I will look at it. It may take a while.
Also I have to apologize. I wrote before, that the tiles have wrong purple color. I was wrong, the color was right. I had a color-picker that made an average of more pixels. Sorry.
Thanks guys!
Problem
In game
If a specific moster has graphic tile, in game it looks like:
(I will add screenshots or video later)
How to reproduce
Make graphic tiles for monsters like:
And see how they look with graphics and without it.
You can use my tiles from https://github.com/TomenetGame/tomenet/issues/48
In code
As is see:
Color flickering(ego, uniques, multi-hued monsters) and char changing(shapechangers, clear monsters) handling is not working for monsters which tiles are remapped in graphics. That code is from line 1922 to 2087.
Code isn't working because
else if (c > MAX_FONT_CHAR)
placed before that. I don't know why oldelse if ((a & 0x80) && (c & 0x80))
was there.I think now that is not correct, as graphics chars are not that special and this code must work for them.
I'm not sure if that is the right fix.