From 30deaa5201b023838a950abbeddc3e0a2833b581 Mon Sep 17 00:00:00 2001 From: Evan Ramos Date: Tue, 4 Jun 2024 05:30:56 -0500 Subject: [PATCH] Defs: Implement ifmatch subtoken for voxel token Note that due to the nature of the voxel token, this subtoken must appear *before* any tile subtokens in order to take effect. Fixes terminx/eduke32#305 --- source/build/src/defs.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/source/build/src/defs.cpp b/source/build/src/defs.cpp index 6ca199415d..5b55a33f0e 100644 --- a/source/build/src/defs.cpp +++ b/source/build/src/defs.cpp @@ -1941,9 +1941,11 @@ static int32_t defsparser(scriptfile *script) char *voxeltokptr = script->ltextptr; char *fn, *voxelend; int32_t tile0 = MAXTILES, tile1 = -1, tilex = -1; + TileMatchChecker matcher; static const tokenlist voxeltokens[] = { + { "ifmatch", T_IFMATCH }, { "tile", T_TILE }, { "tile0", T_TILE0 }, { "tile1", T_TILE1 }, @@ -1981,12 +1983,19 @@ static int32_t defsparser(scriptfile *script) { switch (getatoken(script, voxeltokens, ARRAY_SIZE(voxeltokens))) { + case T_IFMATCH: + matcher.parse_ifmatch(script); + break; + case T_TILE: scriptfile_getsymbol(script,&tilex); if (check_tile("voxel", tilex, script, voxeltokptr)) break; + if (matcher.is_different("voxel", tilex)) + break; + tiletovox[tilex] = lastvoxid; break; @@ -2002,7 +2011,12 @@ static int32_t defsparser(scriptfile *script) break; for (tilex=tile0; tilex<=tile1; tilex++) + { + if (matcher.is_different("voxel", tilex)) + continue; + tiletovox[tilex] = lastvoxid; + } break;