CON: Add drawline256 and drawlinergb commands that call the internal functions used for the automap lines.

drawline256 <x0> <y0> <x1> <y1> <index>
drawlinergb <x0> <y0> <x1> <y1> <index> <rgb>

The coordinates are xdim<<12/ydim<<12 based, not 320<<16x200<<16.
<index> is a palette index, and for drawlinergb is used as a fallback in the software renderer.
<rgb> is encoded the same as PROJ_FLASH_COLOR.

git-svn-id: https://svn.eduke32.com/eduke32@6261 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
hendricks266 2017-06-24 09:21:03 +00:00
parent 4dbeb30907
commit df317aa741
3 changed files with 41 additions and 0 deletions

View file

@ -575,6 +575,8 @@ const char *keyw[] =
"scalevar", // 401
"undefinegamefunc", // 402
"getclosestcol", // 403
"drawline256", // 404
"drawlinergb", // 405
"<null>"
};
#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);

View file

@ -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

View file

@ -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;