Fivetonsofflax / opentyrian

Automatically exported from code.google.com/p/opentyrian
GNU General Public License v2.0
0 stars 0 forks source link

assert(index < COUNTOF(sprite_table->sprite)) fails during episode 4 intermission #94

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Finish the "Brainiac" level in episode 4
2. Watch the intermission text on the purple planet background
3. After the third screen of text, opentyrian exits with an assert failure

What is the expected output? What do you see instead?
I expect to continue, but instead opentyrian exits due to an assert failure

What version of the product are you using? On what operating system?
Revision 4f58a2d6cf on Fedora 11.

Please provide any additional information below.
I've done some debugging and have traced this down. What happens is this:
On the fourth text screen (the one that doesn't actually make it to the
screen), opentyrian is trying to draw the text "                     ~BUT~
~THEN!!!~".
However, the tilde ("~") character is not in the fonthand.c:font_ascii[256]
table (or to be more specific, it's set to -1).
This means that mainint.c:JE_outCharGlow() calls sprite.h:sprite() with -1
as index; this -1 gets cast to an unsigned int, which means it's
interpreted as UINT_MAX, triggering the assert failure.
Since I do not know what characters are or aren't in the TINY_FONT
spriteset, I can't tell what the right fix is here. (As a temporary
workaround, I've set the "~" entry in fonthand.c:font_ascii[256] to 83, so
that the text gets rendered as "                     -BUT- -THEN!!!-".
Although this prevents the assert failure, it is of course no real fix)

Original issue reported on code.google.com by a.h.vand...@gmail.com on 31 Oct 2009 at 9:02

GoogleCodeExporter commented 9 years ago
Hm, I see that there's some special handling for "~" in
font.c:draw_font_{hv,hv_blend,dark}(). Maybe the handling in
mainint.c:JE_outTextGlow() should be similar?

Original comment by a.h.vand...@gmail.com on 31 Oct 2009 at 9:38

GoogleCodeExporter commented 9 years ago
Here's a non-invasive patch, inspired by fonthand.c:JE_textWidth(). It skips any
character for which a sprite doesn't exist (= any character for which the entry 
in
fonthand.c:font_ascii[256] is -1).

Original comment by a.h.vand...@gmail.com on 31 Oct 2009 at 3:58

Attachments:

GoogleCodeExporter commented 9 years ago
fixed as of revision 597df881a7

as always, thanks for the patch :)

Original comment by mindless...@gmail.com on 31 Oct 2009 at 5:37