Skip to content
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

Add formatting flags for text strings. #16

Open
sylae opened this issue May 25, 2013 · 2 comments
Open

Add formatting flags for text strings. #16

sylae opened this issue May 25, 2013 · 2 comments
Assignees

Comments

@sylae
Copy link
Contributor

sylae commented May 25, 2013

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:

  • 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]

Original issue: http://code.google.com/p/openexile/issues/detail?id=4

@sylae
Copy link
Contributor Author

sylae commented May 25, 2013

From celtic.m...@gmail.com on April 26, 2009 02:04:29
Whoops, this should have "New" status, not "Accepted".

@ghost ghost assigned CelticMinstrel May 25, 2013
@CelticMinstrel
Copy link
Member

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 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants