|
2 | 2 | // |
3 | 3 | #include "ui.h" |
4 | 4 |
|
| 5 | +#include "globalincs/alphacolors.h" |
| 6 | + |
5 | 7 | #include "cmdline/cmdline.h" |
6 | 8 | #include "gamesnd/eventmusic.h" |
7 | 9 | #include "menuui/barracks.h" |
8 | 10 | #include "menuui/mainhallmenu.h" |
9 | 11 | #include "menuui/optionsmenu.h" |
10 | 12 | #include "menuui/playermenu.h" |
11 | 13 | #include "menuui/readyroom.h" |
| 14 | +#include "mission/missionbriefcommon.h" |
12 | 15 | #include "mission/missioncampaign.h" |
13 | 16 | #include "missionui/missionscreencommon.h" |
14 | 17 | #include "playerman/managepilot.h" |
15 | 18 | #include "scpui/SoundPlugin.h" |
16 | 19 | #include "scpui/rocket_ui.h" |
17 | 20 | #include "scripting/api/objs/cmd_brief.h" |
| 21 | +#include "scripting/api/objs/color.h" |
18 | 22 | #include "scripting/api/objs/player.h" |
19 | 23 | #include "scripting/lua/LuaTable.h" |
20 | 24 |
|
@@ -386,6 +390,46 @@ ADE_LIB_DERIV(l_UserInterface_CmdBrief, |
386 | 390 | "API for the new UI system. This should not be used by other code and may be removed in the future!", |
387 | 391 | l_UserInterface); |
388 | 392 |
|
| 393 | +ADE_VIRTVAR(ColorTags, |
| 394 | + l_UserInterface_CmdBrief, |
| 395 | + nullptr, |
| 396 | + "The available tagged colors", |
| 397 | + ade_type_map("string", "color"), |
| 398 | + "A mapping from tag string to color value") |
| 399 | +{ |
| 400 | + using namespace luacpp; |
| 401 | + |
| 402 | + LuaTable mapping = LuaTable::create(L); |
| 403 | + |
| 404 | + for (const auto& tagged : Tagged_Colors) { |
| 405 | + SCP_string tag; |
| 406 | + tag.resize(1, tagged.first); |
| 407 | + |
| 408 | + mapping.addValue(tag, l_Color.Set(*tagged.second)); |
| 409 | + } |
| 410 | + |
| 411 | + return ade_set_args(L, "t", mapping); |
| 412 | +} |
| 413 | + |
| 414 | +ADE_VIRTVAR(DefaultTextColorTag, |
| 415 | + l_UserInterface_CmdBrief, |
| 416 | + nullptr, |
| 417 | + "Gets the default color tag string for the command briefing. Index into ColorTags.", |
| 418 | + "string", |
| 419 | + "The default color tag") |
| 420 | +{ |
| 421 | + SCP_string tagStr; |
| 422 | + |
| 423 | + auto defaultColor = default_command_briefing_color; |
| 424 | + |
| 425 | + if (defaultColor == '\0' || !brief_verify_color_tag(defaultColor)) { |
| 426 | + defaultColor = Color_Tags[0]; |
| 427 | + } |
| 428 | + tagStr.resize(1, defaultColor); |
| 429 | + |
| 430 | + return ade_set_args(L, "s", tagStr); |
| 431 | +} |
| 432 | + |
389 | 433 | ADE_FUNC(getBriefing, |
390 | 434 | l_UserInterface_CmdBrief, |
391 | 435 | nullptr, |
|
0 commit comments