From df317aa7411e308373e29e8ef3c97ca3c1fd26e6 Mon Sep 17 00:00:00 2001 From: hendricks266 Date: Sat, 24 Jun 2017 09:21:03 +0000 Subject: [PATCH] CON: Add drawline256 and drawlinergb commands that call the internal functions used for the automap lines. drawline256 drawlinergb The coordinates are xdim<<12/ydim<<12 based, not 320<<16x200<<16. is a palette index, and for drawlinergb is used as a fallback in the software renderer. is encoded the same as PROJ_FLASH_COLOR. git-svn-id: https://svn.eduke32.com/eduke32@6261 1a8010ca-5511-0410-912e-c29ae57300e0 --- source/duke3d/src/gamedef.cpp | 7 +++++++ source/duke3d/src/gamedef.h | 2 ++ source/duke3d/src/gameexec.cpp | 32 ++++++++++++++++++++++++++++++++ 3 files changed, 41 insertions(+) diff --git a/source/duke3d/src/gamedef.cpp b/source/duke3d/src/gamedef.cpp index 93a0ecaf9..90564963a 100644 --- a/source/duke3d/src/gamedef.cpp +++ b/source/duke3d/src/gamedef.cpp @@ -575,6 +575,8 @@ const char *keyw[] = "scalevar", // 401 "undefinegamefunc", // 402 "getclosestcol", // 403 + "drawline256", // 404 + "drawlinergb", // 405 "" }; #endif @@ -3607,9 +3609,14 @@ DO_DEFSTATE: continue; case CON_HITRADIUSVAR: + case CON_DRAWLINE256: C_GetManyVars(5); continue; + case CON_DRAWLINERGB: + C_GetManyVars(6); + continue; + case CON_HITRADIUS: C_GetNextValue(LABEL_DEFINE); C_GetNextValue(LABEL_DEFINE); diff --git a/source/duke3d/src/gamedef.h b/source/duke3d/src/gamedef.h index ebc46cf0f..3494bcebc 100644 --- a/source/duke3d/src/gamedef.h +++ b/source/duke3d/src/gamedef.h @@ -1137,6 +1137,8 @@ enum ScriptKeywords_t CON_SCALEVAR, // 401 CON_UNDEFINEGAMEFUNC, // 402 CON_GETCLOSESTCOL, // 403 + CON_DRAWLINE256, // 404 + CON_DRAWLINERGB, // 405 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 4287a96d9..4a2777495 100644 --- a/source/duke3d/src/gameexec.cpp +++ b/source/duke3d/src/gameexec.cpp @@ -21,6 +21,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. //------------------------------------------------------------------------- #include "compat.h" +#include "colmatch.h" + #include "duke3d.h" #include "scriplib.h" @@ -4899,6 +4901,36 @@ finish_qsprintf: } continue; + case CON_DRAWLINE256: + insptr++; + { + struct { + vec2_t pos[2]; + int32_t index; + } v; + + Gv_GetManyVars(sizeof(v)/sizeof(int32_t), (int32_t *)&v); + + drawline256(v.pos[0].x, v.pos[0].y, v.pos[1].x, v.pos[1].y, v.index); + } + continue; + + case CON_DRAWLINERGB: + insptr++; + { + struct { + vec2_t pos[2]; + int32_t index, rgb; + } v; + + Gv_GetManyVars(sizeof(v)/sizeof(int32_t), (int32_t *)&v); + + palette_t const p = { (uint8_t)(v.rgb & 0xFF), (uint8_t)((v.rgb >> 8) & 0xFF), (uint8_t)((v.rgb >> 16) & 0xFF), (uint8_t)v.index }; + + drawlinergb(v.pos[0].x, v.pos[0].y, v.pos[1].x, v.pos[1].y, p); + } + continue; + case CON_INV: if ((aGameVars[*(insptr + 1)].flags & (GAMEVAR_USER_MASK | GAMEVAR_PTR_MASK)) == 0) aGameVars[*(insptr + 1)].global = -aGameVars[*(insptr + 1)].global;