mirror of
https://github.com/LostArtefacts/TRX.git
synced 2025-04-28 20:58:07 +03:00
game-flow: allow string hex values
This commit is contained in:
parent
1f6f85b0af
commit
f980e4f22c
3 changed files with 20 additions and 5 deletions
|
@ -196,7 +196,8 @@ remains distinct for each game.
|
||||||
</td>
|
</td>
|
||||||
<td>Float array</td>
|
<td>Float array</td>
|
||||||
<td>
|
<td>
|
||||||
Water color (R, G, B). 1.0 means pass-through, 0.0 means no value at all.
|
Water color (R, G, B) or `#RRGGBB`. 1.0 or `FF` means pass-through, 0.0
|
||||||
|
or `00` means completely black color.
|
||||||
See <a href="#water-color-table">this table</a> for reference values.</a>
|
See <a href="#water-color-table">this table</a> for reference values.</a>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
@ -338,9 +339,10 @@ remains distinct for each game.
|
||||||
<td>
|
<td>
|
||||||
<code>water_color</code>
|
<code>water_color</code>
|
||||||
</td>
|
</td>
|
||||||
<td>Float array or string</td>
|
<td>Float array or hex string</td>
|
||||||
<td>
|
<td>
|
||||||
Water color (R, G, B). 1.0 means pass-through, 0.0 means no value at all.
|
Water color (R, G, B) or `#RRGGBB`. 1.0 or `FF` means pass-through, 0.0
|
||||||
|
or `00` means completely black color.
|
||||||
See <a href="#water-color-table">this table</a> for reference values.</a>
|
See <a href="#water-color-table">this table</a> for reference values.</a>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
TombATI | 115 | 255 | 255 |  `#73FFFF`
|
TombATI | 115 | 255 | 255 |  `#73FFFF`
|
||||||
PS1 | 77 | 255 | 255 |  `#4DFFFF`
|
PS1 | 77 | 255 | 255 |  `#4DFFFF`
|
||||||
DOS | 153 | 179 | 255 |  `#99B3FF`
|
DOS | 153 | 179 | 255 |  `#99B3FF`
|
||||||
|
- added support for a hex water color notation (eg. `#80FFFF`) in the game flow file
|
||||||
- changed the `draw_distance_min` and `draw_distance_max` to `fog_start` and `fog_end`
|
- changed the `draw_distance_min` and `draw_distance_max` to `fog_start` and `fog_end`
|
||||||
- changed `Select Detail` dialog title to `Graphic Options`
|
- changed `Select Detail` dialog title to `Graphic Options`
|
||||||
- changed the number of static mesh slots from 50 to 256 (#2734)
|
- changed the number of static mesh slots from 50 to 256 (#2734)
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
#include "json.h"
|
#include "json.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
#include "memory.h"
|
#include "memory.h"
|
||||||
|
#include "strings.h"
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
@ -103,8 +104,9 @@ static void M_LoadCommonSettings(
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
JSON_ARRAY *const tmp_arr = JSON_ObjectGetArray(obj, "water_color");
|
JSON_VALUE *const tmp_value = JSON_ObjectGetValue(obj, "water_color");
|
||||||
if (tmp_arr != nullptr) {
|
if (tmp_value != nullptr && tmp_value->type == JSON_TYPE_ARRAY) {
|
||||||
|
const JSON_ARRAY *const tmp_arr = JSON_ValueAsArray(tmp_value);
|
||||||
const RGB_F color = {
|
const RGB_F color = {
|
||||||
JSON_ArrayGetDouble(tmp_arr, 0, JSON_INVALID_NUMBER),
|
JSON_ArrayGetDouble(tmp_arr, 0, JSON_INVALID_NUMBER),
|
||||||
JSON_ArrayGetDouble(tmp_arr, 1, JSON_INVALID_NUMBER),
|
JSON_ArrayGetDouble(tmp_arr, 1, JSON_INVALID_NUMBER),
|
||||||
|
@ -119,6 +121,16 @@ static void M_LoadCommonSettings(
|
||||||
color.b * 255.0f,
|
color.b * 255.0f,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
} else if (
|
||||||
|
tmp_value != nullptr && tmp_value->type == JSON_TYPE_STRING) {
|
||||||
|
const char *tmp_str =
|
||||||
|
JSON_ValueGetString(tmp_value, JSON_INVALID_STRING);
|
||||||
|
ASSERT(tmp_str != JSON_INVALID_STRING);
|
||||||
|
RGB_888 tmp_color;
|
||||||
|
if (String_ParseRGB888(tmp_str, &tmp_color)) {
|
||||||
|
settings->water_color.is_present = true;
|
||||||
|
settings->water_color.value = tmp_color;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue