Default [print]duration= to 5 seconds, tutorial uses "unlimited"

In 1.14, the default was 50 frames, or around 1.7 seconds. In 1.15.4, commit
a9d9e48c72 changed the interpretation of that
number to milliseconds, but missed that this affected the [print] tag; this
left the default time that the text is shown as an unreadable 50ms.

All places in mainline that use [print] specify a duration, so the default
isn't used. Here I've plucked the new value from UtBS S09, where it was chosen
in f405b916a1.

The special value "unlimited" is now recognised as meaning to display the text
until it's removed by another [print] tag. The tutorial uses this special case
to display the text until the player does the requested move - originally it
displayed the text for 10000 frames (around 40 minutes), which still seemed
reasonable when it changed to 10000ms.
This commit is contained in:
Steve Cotton 2021-06-18 16:33:02 +02:00 committed by Steve Cotton
parent a723cd2c17
commit 264f90eed4
3 changed files with 8 additions and 3 deletions

View file

@ -4,7 +4,7 @@
[print]
text={STRING}
size=18
duration=10000
duration=unlimited
red,green,blue=255,255,255
[/print]
#enddef

View file

@ -763,7 +763,7 @@
max=infinite
{SIMPLE_KEY text s_t_string}
{SIMPLE_KEY size s_unsigned}
{SIMPLE_KEY duration s_unsigned}
{SIMPLE_KEY duration s_unsigned,unlimited}
{COLOR_KEYS s_unsigned}
{SIMPLE_KEY color string}
[/tag]

View file

@ -1998,7 +1998,12 @@ int game_lua_kernel::intf_print(lua_State *L) {
return 0;
int size = cfg["size"].to_int(font::SIZE_SMALL);
int lifetime = cfg["duration"].to_int(50);
int lifetime;
if(cfg["duration"] == "unlimited") {
lifetime = -1;
} else {
lifetime = cfg["duration"].to_int(5000);
}
color_t color = font::LABEL_COLOR;