- Add support for `all` keyword for `defineqav` parser when process interpolate `ignore` block, and ensure the lowest value can't be below 0.

This commit is contained in:
Mitchell Richters 2021-08-23 15:05:38 +10:00
parent e68b793852
commit 23be5ffe8c
2 changed files with 15 additions and 8 deletions

View File

@ -2045,18 +2045,25 @@ static bool parseDefineQAVInterpolateIgnoreBlock(FScanner& sc, const int& res_id
auto arraybuilder = [&](const FString& input, TArray<int>& output, const int& maxvalue) -> bool
{
// Split input if it is an array, otherwise push the singular value twice.
if (input.IndexOf("-") != -1)
if (input.CompareNoCase("all") == 0)
{
// All indices from 0 through to maxvalue are to be added to output array.
output.Push(0);
output.Push(maxvalue);
}
else if (input.IndexOf("-") != -1)
{
// Input is a range of values, split on the hypthen and add each value to the output array.
auto temparray = input.Split("-");
for (auto& value : temparray) output.Push(atoi(value));
}
else
{
// We just have a number. Convert the string into an int and push it twice to the output array.
auto tempvalue = atoi(input);
for (auto i = 0; i < 2; i++) output.Push(tempvalue);
}
if (output.Size() != 2 || output[0] > output[1] || output[1] > maxvalue)
if (output.Size() != 2 || output[0] > output[1] || output[0] < 0 || output[1] > maxvalue)
{
pos.Message(MSG_ERROR, "defineqav (%d): interpolate: ignore: value of '%s' is malformed, unable to continue", res_id, input.GetChars());
return false;

View File

@ -211,7 +211,7 @@ defineqav 10021 {
interpolate {
type "index"
ignore {
frames 6-65 tiles 0-7
frames 6-65 tiles all
}
}
}
@ -488,7 +488,7 @@ defineqav 10066 {
type "index"
loopable
ignore {
frames 0-7 tiles 0
frames all tiles 0
}
}
}
@ -523,10 +523,10 @@ defineqav 10071 {
type "index"
loopable
ignore {
frames 0-7 tiles 0
frames all tiles 0
}
ignore {
frames 0-7 tiles 2
frames all tiles 2
}
}
}
@ -859,7 +859,7 @@ defineqav 10256 {
type "x"
loopable
ignore {
frames 0-23 tiles 0
frames all tiles 0
}
}
}