You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
One thing I've been thinking about is string lengths. Currently, the game
can't handle strings longer than 255 characters, because the str_len arrays
holding the string lengths are of type unsigned char. If we changed it to
unsigned short, it could handle strings of up to 65535 characters; however,
I think that's a bit much. So, I though we could restrict it a little more,
but make up for that by including format flags. For example, if we were
fine with restricting the string length to 1023 characters, we would have 6
unused bits available for formatting.
The most significant bit, then, could indicate that the string should be
drawn framed. That would be simple to implement – you'd just have to set
the item flag to 1 in cd_create_custom_dialog. The next three bits could
specify that the text be drawn in colour – one bit for red, one for green,
one for blue. And the next 2 bits could specify that the text be indented.
Such a change would not have to wait for the format rewrite – adding it
would not actually affect legacy compatibility. However, it would be
impossible to use until the scenario file format supports it. I'm just
putting it forth as an idea. Actually, I think I'll also add it to the
Google Code issues page so that it's not forgotten.
If the change is implemented, and size represents the string length, then:
whether it is framed would be "size & 32768",
the colour would be "(size & 28672) >> 12",
the indent would be "(size & 3072) >> 10", and
the actual length would be "size & 1023",
if my calculations are correct.
Colours would be:
0 – grey (because black would be invisible against the background,
1 – blue,
2 – green,
3 – cyan,
4 – red,
]5 – magenta,
6 – yellow,
7 – white.
Indents would be something like:
0 – none,
1 – 10 pixels,
2 – 15 pixels,
3 – 20 pixels.
That could vary depending on which values work well.[/spoiler]
String lengths are now essentially unlimited as they use std::string for storage; however, there's no allowance for formatting, so that's still something to consider. I do like the idea of allowing for formatting.
CelticMinstrel
changed the title
Increase max string size from 255 to 1023, and add formatting flags.
Add formatting flags for text strings.
Jan 29, 2017
Original author: celtic.m...@gmail.com (April 26, 2009 01:46:24)
One thing I've been thinking about is string lengths. Currently, the game
can't handle strings longer than 255 characters, because the str_len arrays
holding the string lengths are of type unsigned char. If we changed it to
unsigned short, it could handle strings of up to 65535 characters; however,
I think that's a bit much. So, I though we could restrict it a little more,
but make up for that by including format flags. For example, if we were
fine with restricting the string length to 1023 characters, we would have 6
unused bits available for formatting.
The most significant bit, then, could indicate that the string should be
drawn framed. That would be simple to implement – you'd just have to set
the item flag to 1 in cd_create_custom_dialog. The next three bits could
specify that the text be drawn in colour – one bit for red, one for green,
one for blue. And the next 2 bits could specify that the text be indented.
Such a change would not have to wait for the format rewrite – adding it
would not actually affect legacy compatibility. However, it would be
impossible to use until the scenario file format supports it. I'm just
putting it forth as an idea. Actually, I think I'll also add it to the
Google Code issues page so that it's not forgotten.
If the change is implemented, and size represents the string length, then:
if my calculations are correct.
Colours would be:
0 – grey (because black would be invisible against the background,
1 – blue,
2 – green,
3 – cyan,
4 – red,
]5 – magenta,
6 – yellow,
7 – white.
Indents would be something like:
0 – none,
1 – 10 pixels,
2 – 15 pixels,
3 – 20 pixels.
That could vary depending on which values work well.[/spoiler]
Original issue: http://code.google.com/p/openexile/issues/detail?id=4
The text was updated successfully, but these errors were encountered: