diff --git a/source/duke3d/src/gamedef.cpp b/source/duke3d/src/gamedef.cpp index 51f3215f6..93a0ecaf9 100644 --- a/source/duke3d/src/gamedef.cpp +++ b/source/duke3d/src/gamedef.cpp @@ -574,6 +574,7 @@ const char *keyw[] = "divscale", // 400 "scalevar", // 401 "undefinegamefunc", // 402 + "getclosestcol", // 403 "" }; #endif @@ -4078,6 +4079,7 @@ DO_DEFSTATE: continue; case CON_CLAMP: + case CON_GETCLOSESTCOL: C_GetNextVarType(GAMEVAR_READONLY); C_GetManyVars(2); continue; diff --git a/source/duke3d/src/gamedef.h b/source/duke3d/src/gamedef.h index 565c8761f..ebc46cf0f 100644 --- a/source/duke3d/src/gamedef.h +++ b/source/duke3d/src/gamedef.h @@ -1136,6 +1136,7 @@ enum ScriptKeywords_t CON_DIVSCALE, // 400 CON_SCALEVAR, // 401 CON_UNDEFINEGAMEFUNC, // 402 + CON_GETCLOSESTCOL, // 403 CON_END }; // KEEPINSYNC with the keyword list in lunatic/con_lang.lua diff --git a/source/duke3d/src/gameexec.cpp b/source/duke3d/src/gameexec.cpp index 8b8beb4b0..4287a96d9 100644 --- a/source/duke3d/src/gameexec.cpp +++ b/source/duke3d/src/gameexec.cpp @@ -4890,6 +4890,15 @@ finish_qsprintf: } continue; + case CON_GETCLOSESTCOL: + insptr++; + { + tw = *insptr++; + int32_t const rgb = Gv_GetVarX(*insptr++); + Gv_SetVarX(tw, getclosestcol_lim(rgb & 0xFF, (rgb >> 8) & 0xFF, (rgb >> 16) & 0xFF, Gv_GetVarX(*insptr++))); + } + continue; + case CON_INV: if ((aGameVars[*(insptr + 1)].flags & (GAMEVAR_USER_MASK | GAMEVAR_PTR_MASK)) == 0) aGameVars[*(insptr + 1)].global = -aGameVars[*(insptr + 1)].global;