Skip to content

Commit 3d8174d

Browse files
committed
color/colour updates
Add Colour as a recognized parsing option in several more places where Color is used
1 parent cfc1088 commit 3d8174d

4 files changed

Lines changed: 29 additions & 28 deletions

File tree

code/globalincs/alphacolors.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -388,7 +388,7 @@ void parse_everything_else(const char *filename)
388388
Warning(LOCATION, "Team color in '%s' defined with a name of '%s'; this won't be usable due to 'None' being used for a lack of a team color by the engine.\n", filename, temp2);
389389
}
390390

391-
if (required_string("$Team Stripe Color:")) {
391+
if (required_string_either("$Team Stripe Color:", "$Team Stripe Colour:") >= 0) {
392392
int rgb[3];
393393
stuff_int_list(rgb, 3, RAW_INTEGER_TYPE);
394394
for (i = 0; i < 3; i++) {
@@ -400,7 +400,7 @@ void parse_everything_else(const char *filename)
400400
temp_color.stripe.b = rgb[2] / 255.0f;
401401
}
402402

403-
if (required_string("$Team Base Color:")) {
403+
if (required_string_either("$Team Base Color:", "$Team Base Colour:") >= 0) {
404404
int rgb[3];
405405
stuff_int_list(rgb, 3, RAW_INTEGER_TYPE);
406406
for (i = 0; i < 3; i++) {

code/hud/hudparse.cpp

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -296,15 +296,16 @@ void parse_hud_gauges_tbl(const char *filename)
296296

297297
for (int i = 0; i < NUM_HUD_COLOR_PRESETS; i++) {
298298
SCP_string colorPresetString = "$Color Preset " + std::to_string(i + 1) + ":";
299-
if (optional_string(colorPresetString.c_str())) {
299+
SCP_string colourPresetString = "$Colour Preset " + std::to_string(i + 1) + ":";
300+
if (optional_string_either(colorPresetString.c_str(), colourPresetString.c_str()) >= 0) {
300301
hc_col preset;
301302
required_string("+Name:");
302303
stuff_string(preset.name, F_NAME);
303304

304305
required_string("+XSTR ID:");
305306
stuff_int(&preset.xstr);
306307

307-
required_string("+Color:");
308+
required_string_either("+Color:", "+Colour:");
308309
int rgb[3] = {255, 255, 255};
309310
stuff_int_list(rgb, 3);
310311

@@ -334,7 +335,7 @@ void parse_hud_gauges_tbl(const char *filename)
334335
stuff_boolean(&Hud_retail);
335336
}
336337

337-
if (optional_string("$Color:")) {
338+
if (optional_string_either("$Color:", "$Colour:") >= 0) {
338339
stuff_int_list(colors, 3);
339340

340341
check_color(colors);
@@ -387,7 +388,7 @@ void parse_hud_gauges_tbl(const char *filename)
387388
}
388389
}
389390

390-
if (optional_string("$Wireframe Color Override:")) {
391+
if (optional_string_either("$Wireframe Color Override:", "$Wireframe Colour Override:") >= 0) {
391392
int rgb[3];
392393
stuff_int_list(rgb, 3, RAW_INTEGER_TYPE);
393394
gr_init_color(&Targetbox_color, rgb[0], rgb[1], rgb[2]);
@@ -462,7 +463,7 @@ void parse_hud_gauges_tbl(const char *filename)
462463
stuff_boolean(&Ship_info[ship_idx].hud_retail);
463464
}
464465

465-
if (optional_string("$Color:")) {
466+
if (optional_string_either("$Color:", "$Colour:") >= 0) {
466467
stuff_int_list(colors, 3);
467468

468469
check_color(colors);
@@ -503,7 +504,7 @@ void parse_hud_gauges_tbl(const char *filename)
503504
Ship_info[shiparray[i]].hud_retail = retail_config;
504505
}
505506

506-
if (optional_string("$Color:")) {
507+
if (optional_string_either("$Color:", "$Colour:") >= 0) {
507508
stuff_int_list(colors, 3);
508509

509510
check_color(colors);
@@ -590,7 +591,7 @@ void parse_hud_gauges_tbl(const char *filename)
590591
}
591592
}
592593

593-
if (optional_string("$Color:")) {
594+
if (optional_string_either("$Color:", "$Colour:") >= 0) {
594595
stuff_int_list(colors, 3);
595596

596597
check_color(colors);
@@ -1520,7 +1521,7 @@ std::unique_ptr<T> gauge_load_common(gauge_settings* settings, T* preAllocated =
15201521
colors[2] = settings->use_clr->blue;
15211522

15221523
lock_color = true;
1523-
} else if ( optional_string("Color:") ) {
1524+
} else if ( optional_string_either("Color:", "Colour:") >= 0 ) {
15241525
stuff_int_list(colors, 3);
15251526

15261527
check_color(colors);
@@ -1696,7 +1697,7 @@ void load_gauge_custom(gauge_settings* settings)
16961697
colors[2] = settings->use_clr->blue;
16971698

16981699
lock_color = true;
1699-
} else if ( optional_string("Color:") ) {
1700+
} else if ( optional_string_either("Color:", "Colour:") >= 0 ) {
17001701
stuff_int_list(colors, 3);
17011702

17021703
check_color(colors);
@@ -3547,7 +3548,7 @@ void load_gauge_target_monitor(gauge_settings* settings)
35473548
if (optional_string("Wireframe:")) {
35483549
stuff_int(&wireframe);
35493550
}
3550-
if (optional_string("Wireframe Color:")) {
3551+
if (optional_string_either("Wireframe Color:", "Wireframe Colour:") >= 0) {
35513552
int rgb[3];
35523553
stuff_int_list(rgb, 3, RAW_INTEGER_TYPE);
35533554
gr_init_color(&wirecolor, rgb[0], rgb[1], rgb[2]);
@@ -4156,11 +4157,11 @@ void load_gauge_auto_target(gauge_settings* settings)
41564157
stuff_int_list(target_text_offset, 2);
41574158
}
41584159

4159-
if ( optional_string("On Text Color:") ) {
4160+
if ( optional_string_either("On Text Color:", "On Text Colour:") >= 0 ) {
41604161
stuff_int_list(on_color, 4);
41614162
}
41624163

4163-
if ( optional_string("Off Text Color:") ) {
4164+
if ( optional_string_either("Off Text Color:", "Off Text Colour:") >= 0 ) {
41644165
stuff_int_list(off_color, 4);
41654166
}
41664167

@@ -4215,11 +4216,11 @@ void load_gauge_auto_speed(gauge_settings* settings)
42154216
stuff_int_list(speed_text_offset, 2);
42164217
}
42174218

4218-
if ( optional_string("On Text Color:") ) {
4219+
if ( optional_string_either("On Text Color:", "On Text Colour:") >= 0 ) {
42194220
stuff_int_list(on_color, 4);
42204221
}
42214222

4222-
if ( optional_string("Off Text Color:") ) {
4223+
if ( optional_string_either("Off Text Color:", "Off Text Colour:") >= 0 ) {
42234224
stuff_int_list(off_color, 4);
42244225
}
42254226

@@ -4376,7 +4377,7 @@ void load_gauge_wingman_status(gauge_settings* settings)
43764377
}
43774378

43784379
bool use_expanded_colors = false;
4379-
if (optional_string("Use Expanded Colors:")) {
4380+
if (optional_string_either("Use Expanded Colors:", "Use Expanded Colours:") >= 0) {
43804381
stuff_boolean(&use_expanded_colors);
43814382
}
43824383

code/mod_table/mod_table.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1221,7 +1221,7 @@ void parse_mod_table(const char *filename)
12211221
mprintf(("Game Settings Table: Using 3D weapon icons\n"));
12221222
}
12231223

1224-
if (optional_string("$FS2 effect grid color:")) {
1224+
if (optional_string_either("$FS2 effect grid color:", "$FS2 effect grid colour:") >= 0) {
12251225
int rgb[3];
12261226
stuff_int_list(rgb, 3);
12271227
CLAMP(rgb[0], 0, 255);
@@ -1230,7 +1230,7 @@ void parse_mod_table(const char *filename)
12301230
gr_init_color(&Default_fs2_effect_grid_color, rgb[0], rgb[1], rgb[2]);
12311231
}
12321232

1233-
if (optional_string("$FS2 effect scanline color:")) {
1233+
if (optional_string_either("$FS2 effect scanline color:", "$FS2 effect scanline colour:") >= 0) {
12341234
int rgb[3];
12351235
stuff_int_list(rgb, 3);
12361236
CLAMP(rgb[0], 0, 255);
@@ -1250,7 +1250,7 @@ void parse_mod_table(const char *filename)
12501250
}
12511251
}
12521252

1253-
if (optional_string("$FS2 effect wireframe color:")) {
1253+
if (optional_string_either("$FS2 effect wireframe color:", "$FS2 effect wireframe colour:") >= 0) {
12541254
int rgb[3];
12551255
stuff_int_list(rgb, 3);
12561256
CLAMP(rgb[0], 0, 255);
@@ -1277,25 +1277,25 @@ void parse_mod_table(const char *filename)
12771277
}
12781278
}
12791279

1280-
if (optional_string("+Overhead Line Color 1:")) {
1280+
if (optional_string_either("+Overhead Line Color 1:", "+Overhead Line Colour 1:") >= 0) {
12811281
int rgba[4] = {0, 0, 0, 0};
12821282
stuff_int_list(rgba, 4, RAW_INTEGER_TYPE);
12831283
gr_init_alphacolor(&Overhead_line_colors[0], rgba[0], rgba[1], rgba[2], rgba[3]);
12841284
}
12851285

1286-
if (optional_string("+Overhead Line Color 2:")) {
1286+
if (optional_string_either("+Overhead Line Color 2:", "+Overhead Line Colour 2:") >= 0) {
12871287
int rgba[4] = {0, 0, 0, 0};
12881288
stuff_int_list(rgba, 4, RAW_INTEGER_TYPE);
12891289
gr_init_alphacolor(&Overhead_line_colors[1], rgba[0], rgba[1], rgba[2], rgba[3]);
12901290
}
12911291

1292-
if (optional_string("+Overhead Line Color 3:")) {
1292+
if (optional_string_either("+Overhead Line Color 3:", "+Overhead Line Colour 3:") >= 0) {
12931293
int rgba[4] = {0, 0, 0, 0};
12941294
stuff_int_list(rgba, 4, RAW_INTEGER_TYPE);
12951295
gr_init_alphacolor(&Overhead_line_colors[2], rgba[0], rgba[1], rgba[2], rgba[3]);
12961296
}
12971297

1298-
if (optional_string("+Overhead Line Color 4:")) {
1298+
if (optional_string_either("+Overhead Line Color 4:", "+Overhead Line Colour 4:") >= 0) {
12991299
int rgba[4] = {0, 0, 0, 0};
13001300
stuff_int_list(rgba, 4, RAW_INTEGER_TYPE);
13011301
gr_init_alphacolor(&Overhead_line_colors[3], rgba[0], rgba[1], rgba[2], rgba[3]);

code/ship/ship.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5332,7 +5332,7 @@ static void parse_ship_values(ship_info* sip, const bool is_template, const bool
53325332
WarningEx(LOCATION, "%s '%s'\nIFF colour when IFF is \"%s\" invalid!", info_type_name, sip->name, iff_2);
53335333

53345334
// Set the color
5335-
required_string("+As Color:");
5335+
required_string_either("+As Color:", "+As Colour:");
53365336
stuff_int_list(iff_color_data, 3, RAW_INTEGER_TYPE);
53375337
sip->ship_iff_info[{iff_data[0],iff_data[1]}] = iff_init_color(iff_color_data[0], iff_color_data[1], iff_color_data[2]);
53385338
}
@@ -5446,21 +5446,21 @@ static void parse_ship_values(ship_info* sip, const bool is_template, const bool
54465446
new_info.width = 0.0f;
54475447
}
54485448

5449-
if (optional_string("+Primary color 1:")) {
5449+
if (optional_string_either("+Primary color 1:", "+Primary colour 1:") >= 0) {
54505450
int rgb[3];
54515451
stuff_int_list(rgb, 3, RAW_INTEGER_TYPE);
54525452
gr_init_color(&new_info.primary_color_1, rgb[0], rgb[1], rgb[2]);
54535453
} else {
54545454
new_info.primary_color_1 = Arc_color_damage_p1;
54555455
}
5456-
if (optional_string("+Primary color 2:")) {
5456+
if (optional_string_either("+Primary color 2:", "+Primary colour 2:") >= 0) {
54575457
int rgb[3];
54585458
stuff_int_list(rgb, 3, RAW_INTEGER_TYPE);
54595459
gr_init_color(&new_info.primary_color_2, rgb[0], rgb[1], rgb[2]);
54605460
} else {
54615461
new_info.primary_color_2 = Arc_color_damage_p2;
54625462
}
5463-
if (optional_string("+Secondary color:")) {
5463+
if (optional_string_either("+Secondary color:", "+Secondary colour:") >= 0) {
54645464
int rgb[3];
54655465
stuff_int_list(rgb, 3, RAW_INTEGER_TYPE);
54665466
gr_init_color(&new_info.secondary_color, rgb[0], rgb[1], rgb[2]);

0 commit comments

Comments
 (0)