mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-24 02:30:46 +00:00
drawing functions and key access for m32-script; misc. fixes
git-svn-id: https://svn.eduke32.com/eduke32@1497 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
3be58d63d0
commit
198ac24152
7 changed files with 465 additions and 139 deletions
|
@ -9,9 +9,17 @@ gamevar j 0 1
|
|||
gamevar davr 65536 0
|
||||
gamevar dayx 65536 0
|
||||
|
||||
define TQUOTE 3
|
||||
|
||||
definequote 0 OK
|
||||
definequote 1 DAMN
|
||||
|
||||
definequote 2 BU:%d ABS:%d
|
||||
definequote TQUOTE write on me!
|
||||
|
||||
definequote 4 ASPECT: VR=%d, YX=%d
|
||||
definequote 5 KEY:%d
|
||||
|
||||
gamearray ar 128
|
||||
gamearray parm 8
|
||||
|
||||
|
@ -40,6 +48,65 @@ onevent EVENT_ENTER3DMODE
|
|||
state setas
|
||||
endevent
|
||||
|
||||
onevent EVENT_DRAW2DSCREEN
|
||||
set drawlinepat -1
|
||||
for i allsprites
|
||||
ifactor LIZTROOP
|
||||
drawcircle16b sprite[i].x sprite[i].y 256 9
|
||||
// set i totalclock
|
||||
// shiftr i 6
|
||||
// drawcircle16b posx posy 256 i
|
||||
// set j i
|
||||
// add j 8
|
||||
// drawcircle16 halfxdim16 midydim16 12 j
|
||||
// qsprintf 3 2 i j
|
||||
// printmessage16 3
|
||||
endevent
|
||||
|
||||
onevent EVENT_OVERHEADEDITOR
|
||||
|
||||
for i range 27
|
||||
{
|
||||
ifkey alphakeys[i]
|
||||
{
|
||||
qsprintf TQUOTE 5 i
|
||||
quote TQUOTE
|
||||
}
|
||||
}
|
||||
for i range 10
|
||||
// ife 0 1
|
||||
{
|
||||
ifkey numberkeys[i]
|
||||
{
|
||||
qsprintf TQUOTE 5 i
|
||||
quote TQUOTE
|
||||
}
|
||||
}
|
||||
endevent
|
||||
|
||||
onevent EVENT_KEYS3D
|
||||
for i range 10
|
||||
// ife 0 1
|
||||
{
|
||||
ifkey numberkeys[i]
|
||||
{
|
||||
qsprintf TQUOTE 5 i
|
||||
quote TQUOTE
|
||||
}
|
||||
}
|
||||
|
||||
ifkey KEY_SPACE
|
||||
// ife 0 1
|
||||
{
|
||||
ifeithershift sub davr 512 else add davr 512
|
||||
ifl davr 32768 set davr 32768
|
||||
ifg davr 256000 set davr 256000
|
||||
setaspect davr yxaspect
|
||||
qsprintf TQUOTE 4 davr yxaspect
|
||||
quote TQUOTE
|
||||
}
|
||||
endevent
|
||||
|
||||
defstate itertest
|
||||
for i spritesofsector searchsector
|
||||
// ife sprite[i].picnum AMMO set sprite[i].picnum BATTERYAMMO
|
||||
|
|
|
@ -89,6 +89,10 @@ enum GameEvent_t {
|
|||
EVENT_ANALYZESPRITES,
|
||||
EVENT_INSERTSPRITE2D,
|
||||
EVENT_INSERTSPRITE3D,
|
||||
EVENT_DRAW2DSCREEN, // must be 4
|
||||
// EVENT_KEYS2D,
|
||||
EVENT_KEYS3D,
|
||||
EVENT_OVERHEADEDITOR,
|
||||
MAXEVENTS
|
||||
};
|
||||
|
||||
|
@ -156,6 +160,7 @@ extern gamearray_t aGameArrays[MAXGAMEARRAYS];
|
|||
extern int32_t g_gameVarCount, g_systemVarCount;
|
||||
extern int32_t g_gameArrayCount, g_systemArrayCount;
|
||||
|
||||
extern uint32_t m32_drawlinepat;
|
||||
|
||||
|
||||
extern int32_t g_iReturnVarID;
|
||||
|
@ -164,8 +169,8 @@ extern int32_t g_iHiTagID; // var ID of "HITAG"
|
|||
extern int32_t g_iTextureID; // var ID of "TEXTURE"
|
||||
extern int32_t g_iThisActorID; // var ID of "I" ///"THISACTOR"
|
||||
|
||||
extern int32_t g_numRealPalettes;
|
||||
extern int32_t g_scriptDebug;
|
||||
//extern int32_t g_numRealPalettes;
|
||||
//extern int32_t g_scriptDebug;
|
||||
|
||||
extern int32_t g_numQuoteRedefinitions;
|
||||
|
||||
|
@ -217,4 +222,7 @@ extern int16_t highlightsector[];
|
|||
|
||||
extern int32_t numsprites;
|
||||
|
||||
extern int32_t zoom;
|
||||
extern int32_t halfxdim16, midydim16;
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1418,6 +1418,7 @@ void overheadeditor(void)
|
|||
}
|
||||
|
||||
draw2dscreen(pos.x,pos.y,ang,zoom,grid);
|
||||
X_OnEvent(EVENT_DRAW2DSCREEN, -1);
|
||||
|
||||
begindrawing(); //{{{
|
||||
if (showtags == 1)
|
||||
|
@ -2265,16 +2266,16 @@ void overheadeditor(void)
|
|||
i = pointhighlight-16384;
|
||||
Bsprintf(buffer,"Sprite (%d) Hi-tag: ",i);
|
||||
sprite[i].hitag = getnumber16(buffer,sprite[i].hitag,65536L,0);
|
||||
clearmidstatbar16();
|
||||
showspritedata((int16_t)i);
|
||||
// clearmidstatbar16();
|
||||
// showspritedata((int16_t)i);
|
||||
}
|
||||
else if (linehighlight >= 0)
|
||||
{
|
||||
i = linehighlight;
|
||||
Bsprintf(buffer,"Wall (%d) Hi-tag: ",i);
|
||||
wall[i].hitag = getnumber16(buffer,wall[i].hitag,65536L,0);
|
||||
clearmidstatbar16();
|
||||
showwalldata((int16_t)i);
|
||||
// clearmidstatbar16();
|
||||
// showwalldata((int16_t)i);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -2284,8 +2285,8 @@ void overheadeditor(void)
|
|||
{
|
||||
Bsprintf(buffer,"Sector (%d) Hi-tag: ",i);
|
||||
sector[i].hitag = getnumber16(buffer,sector[i].hitag,65536L,0);
|
||||
clearmidstatbar16();
|
||||
showsectordata((int16_t)i);
|
||||
// clearmidstatbar16();
|
||||
// showsectordata((int16_t)i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -2300,13 +2301,13 @@ void overheadeditor(void)
|
|||
{
|
||||
Bsprintf(buffer,"Sector (%d) Ceilingpal: ",i);
|
||||
sector[i].ceilingpal = getnumber16(buffer,sector[i].ceilingpal,256L,0);
|
||||
clearmidstatbar16();
|
||||
showsectordata((int16_t)i);
|
||||
// clearmidstatbar16();
|
||||
// showsectordata((int16_t)i);
|
||||
|
||||
Bsprintf(buffer,"Sector (%d) Floorpal: ",i);
|
||||
sector[i].floorpal = getnumber16(buffer,sector[i].floorpal,256L,0);
|
||||
clearmidstatbar16();
|
||||
showsectordata((int16_t)i);
|
||||
// clearmidstatbar16();
|
||||
// showsectordata((int16_t)i);
|
||||
|
||||
// printmessage16("");
|
||||
break;
|
||||
|
@ -2319,8 +2320,8 @@ void overheadeditor(void)
|
|||
i = pointhighlight-16384;
|
||||
Bsprintf(buffer,"Sprite (%d) Status list: ",i);
|
||||
changespritestat(i,getnumber16(buffer,sprite[i].statnum,65536L,0));
|
||||
clearmidstatbar16();
|
||||
showspritedata((int16_t)i);
|
||||
// clearmidstatbar16();
|
||||
// showspritedata((int16_t)i);
|
||||
}
|
||||
|
||||
// printmessage16("");
|
||||
|
@ -4229,7 +4230,13 @@ nextmap:
|
|||
// ^^^ PK ------------------------------------
|
||||
|
||||
CANCEL:
|
||||
if (keystatus[1] && joinsector[0] >= 0) {keystatus[1]=0; joinsector[0]=-1;}
|
||||
if (keystatus[1] && joinsector[0] >= 0)
|
||||
{
|
||||
keystatus[1]=0;
|
||||
joinsector[0]=-1;
|
||||
printmessage16("No sectors joined.");
|
||||
}
|
||||
|
||||
if (keystatus[1])
|
||||
{
|
||||
keystatus[1] = 0;
|
||||
|
@ -4691,6 +4698,8 @@ CANCEL:
|
|||
clearkeys();
|
||||
}
|
||||
|
||||
X_OnEvent(EVENT_OVERHEADEDITOR, -1);
|
||||
|
||||
//nextpage();
|
||||
}
|
||||
|
||||
|
|
|
@ -3921,8 +3921,9 @@ void getnumberptr256(char *namestart, void *num, int32_t bytes, int32_t maxnumbe
|
|||
}
|
||||
else if (ch == 13)
|
||||
{
|
||||
if (danum != oldnum)
|
||||
asksave = 1;
|
||||
oldnum = danum;
|
||||
asksave = 1;
|
||||
break;
|
||||
}
|
||||
else if (ch == '-' && sign) // negate
|
||||
|
@ -7385,6 +7386,8 @@ static void Keys3d(void)
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
X_OnEvent(EVENT_KEYS3D, -1);
|
||||
}// end 3d
|
||||
|
||||
static void DoSpriteSearch(int32_t dir) // <0: backwards, >=0: forwards
|
||||
|
@ -7913,36 +7916,32 @@ static void Keys2d(void)
|
|||
{
|
||||
SearchSectorsBackward();
|
||||
}
|
||||
else
|
||||
|
||||
if (wallsprite==1)
|
||||
else if (wallsprite==1)
|
||||
{
|
||||
if (curwallnum>0) curwallnum--;
|
||||
for (i=curwallnum; i>=0; i--)
|
||||
{
|
||||
if (curwallnum>0) curwallnum--;
|
||||
for (i=curwallnum; i>=0; i--)
|
||||
{
|
||||
if (
|
||||
(wall[i].picnum==wall[curwall].picnum)
|
||||
&&((search_lotag==0)||
|
||||
(search_lotag!=0 && search_lotag==wall[i].lotag))
|
||||
&&((search_hitag==0)||
|
||||
(search_hitag!=0 && search_hitag==wall[i].hitag))
|
||||
if (
|
||||
(wall[i].picnum==wall[curwall].picnum)
|
||||
&&((search_lotag==0)||
|
||||
(search_lotag!=0 && search_lotag==wall[i].lotag))
|
||||
&&((search_hitag==0)||
|
||||
(search_hitag!=0 && search_hitag==wall[i].hitag))
|
||||
)
|
||||
{
|
||||
pos.x=(wall[i].x)-(((wall[i].x)-(wall[wall[i].point2].x))/2);
|
||||
pos.y=(wall[i].y)-(((wall[i].y)-(wall[wall[i].point2].y))/2);
|
||||
printmessage16("< Wall search: found");
|
||||
// curwallnum--;
|
||||
keystatus[KEYSC_LBRACK]=0;
|
||||
return;
|
||||
}
|
||||
curwallnum--;
|
||||
{
|
||||
pos.x=(wall[i].x)-(((wall[i].x)-(wall[wall[i].point2].x))/2);
|
||||
pos.y=(wall[i].y)-(((wall[i].y)-(wall[wall[i].point2].y))/2);
|
||||
printmessage16("< Wall search: found");
|
||||
// curwallnum--;
|
||||
keystatus[KEYSC_LBRACK]=0;
|
||||
return;
|
||||
}
|
||||
printmessage16("< Wall search: none found");
|
||||
curwallnum--;
|
||||
}
|
||||
else
|
||||
|
||||
if (wallsprite==2)
|
||||
DoSpriteSearch(-1);
|
||||
printmessage16("< Wall search: none found");
|
||||
}
|
||||
else if (wallsprite==2)
|
||||
DoSpriteSearch(-1);
|
||||
#if 0
|
||||
{
|
||||
if (cursearchspritenum>0) cursearchspritenum--;
|
||||
|
@ -8199,6 +8198,8 @@ static void Keys2d(void)
|
|||
keystatus[KEYSC_J]=0;
|
||||
}
|
||||
|
||||
// X_OnEvent(EVENT_KEYS2D, -1);
|
||||
|
||||
}// end key2d
|
||||
|
||||
static void InitCustomColors(void)
|
||||
|
@ -8922,8 +8923,16 @@ static int32_t osdcmd_endisableevent(const osdfuncparm_t *parm)
|
|||
int32_t i, j, enable;
|
||||
char buf[64] = "EVENT_";
|
||||
|
||||
if (!label) return OSDCMD_OK;
|
||||
|
||||
if (parm->numparms < 1)
|
||||
return OSDCMD_SHOWHELP;
|
||||
{
|
||||
OSD_Printf("--- Defined events:\n");
|
||||
for (i=0; i<MAXEVENTS; i++)
|
||||
if (aEventOffsets[i] >= 0)
|
||||
OSD_Printf("%s (%d): %s\n", label+(i*MAXLABELLEN), i, aEventEnabled[i]?"on":"off");
|
||||
return OSDCMD_OK;
|
||||
}
|
||||
|
||||
enable = !Bstrcasecmp(parm->name, "enableevent");
|
||||
|
||||
|
@ -8935,13 +8944,6 @@ static int32_t osdcmd_endisableevent(const osdfuncparm_t *parm)
|
|||
aEventEnabled[i] = enable?1:0;
|
||||
return OSDCMD_OK;
|
||||
}
|
||||
else if (!Bstrcasecmp(parm->parms[0], "show"))
|
||||
{
|
||||
for (i=0; i<MAXEVENTS; i++)
|
||||
if (aEventOffsets[i] >= 0)
|
||||
OSD_Printf("%s: %s\n", label+(i*MAXLABELLEN), aEventEnabled[i]?"on":"off");
|
||||
return OSDCMD_OK;
|
||||
}
|
||||
}
|
||||
|
||||
for (i=0; i<parm->numparms; i++)
|
||||
|
@ -8953,7 +8955,7 @@ static int32_t osdcmd_endisableevent(const osdfuncparm_t *parm)
|
|||
else
|
||||
{
|
||||
Bstrncat(buf, parm->parms[i], sizeof(buf)-6-1);
|
||||
j = hash_find(&labelH, parm->parms[i]);
|
||||
j = hash_find(&labelH, buf);
|
||||
}
|
||||
|
||||
if (j>=0 && j<MAXEVENTS)
|
||||
|
@ -8994,8 +8996,8 @@ static int32_t registerosdcommands(void)
|
|||
OSD_RegisterFunction("include", "include <filnames...>: compiles one or more M32 script files", osdcmd_include);
|
||||
OSD_RegisterFunction("do", "do (m32 script ...): executes M32 script statements", osdcmd_do);
|
||||
OSD_RegisterFunction("scriptinfo", "scriptinfo: shows information about compiled M32 script", osdcmd_scriptinfo);
|
||||
OSD_RegisterFunction("enableevent", "enableevent <all|show||EVENT_...|(event number)>", osdcmd_endisableevent);
|
||||
OSD_RegisterFunction("disableevent", "disableevent <all|show|EVENT_...|(event number)>", osdcmd_endisableevent);
|
||||
OSD_RegisterFunction("enableevent", "enableevent <all|EVENT_...|(event number)>", osdcmd_endisableevent);
|
||||
OSD_RegisterFunction("disableevent", "disableevent <all|EVENT_...|(event number)>", osdcmd_endisableevent);
|
||||
return 0;
|
||||
}
|
||||
#define DUKEOSD
|
||||
|
|
|
@ -26,7 +26,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
#include "m32def.h"
|
||||
#include "cache1d.h"
|
||||
|
||||
#include "osd.h"
|
||||
//#include "osd.h"
|
||||
#include "keys.h"
|
||||
|
||||
char g_szScriptFileName[BMAX_PATH] = "(none)"; // file we're currently compiling
|
||||
static char g_szCurrentBlockName[256] = "(none)", g_szLastBlockName[256] = "NULL";
|
||||
|
@ -156,7 +157,7 @@ const tokenmap_t altkeyw[] =
|
|||
{ "mul", CON_MULVARVAR },
|
||||
{ "div", CON_DIVVARVAR },
|
||||
{ "mod", CON_MODVARVAR },
|
||||
{ "add", CON_ADDVARVAR },
|
||||
{ "and", CON_ANDVARVAR },
|
||||
{ "or", CON_ORVARVAR },
|
||||
{ "xor", CON_XORVARVAR },
|
||||
{ "ifl", CON_IFVARVARL },
|
||||
|
@ -281,6 +282,7 @@ const char *keyw[] =
|
|||
"whilevarvarn",
|
||||
"whilevarvarl",
|
||||
|
||||
"ifkey",
|
||||
"ifrnd",
|
||||
"ifangdiffl",
|
||||
"ifspritepal",
|
||||
|
@ -290,6 +292,9 @@ const char *keyw[] =
|
|||
|
||||
"ifinside",
|
||||
|
||||
"ifeitheralt",
|
||||
"ifeitherctrl",
|
||||
"ifeithershift",
|
||||
"ifawayfromwall",
|
||||
"ifcansee",
|
||||
"ifonwater",
|
||||
|
@ -334,6 +339,9 @@ const char *keyw[] =
|
|||
"printmessage16",
|
||||
"printmessage256",
|
||||
"printext256",
|
||||
"printext16",
|
||||
"getnumber16",
|
||||
"getnumber256",
|
||||
"qsprintf",
|
||||
"qstrcat",
|
||||
"qstrcpy",
|
||||
|
@ -369,6 +377,10 @@ const char *keyw[] =
|
|||
|
||||
/// "killit",
|
||||
|
||||
"drawline16",
|
||||
"drawline16b",
|
||||
"drawcircle16",
|
||||
"drawcircle16b",
|
||||
"rotatesprite16",
|
||||
"rotatesprite",
|
||||
"setgamepalette",
|
||||
|
@ -1506,6 +1518,7 @@ static int32_t C_ParseCommand(void)
|
|||
}
|
||||
if (g_numCompilerErrors)
|
||||
{
|
||||
g_scriptPtr = script+cs.currentStateOfs;
|
||||
cs.currentStateOfs = -1;
|
||||
cs.currentStateIdx = -1;
|
||||
Bsprintf(g_szCurrentBlockName,"(none)");
|
||||
|
@ -1670,6 +1683,7 @@ static int32_t C_ParseCommand(void)
|
|||
}
|
||||
if (g_numCompilerErrors)
|
||||
{
|
||||
g_scriptPtr = script+cs.parsingEventOfs;
|
||||
cs.parsingEventOfs = -1;
|
||||
cs.currentEvent = -1;
|
||||
Bsprintf(g_szCurrentBlockName,"(none)");
|
||||
|
@ -2489,6 +2503,7 @@ repeatcase:
|
|||
case CON_WHILEVARVARN:
|
||||
case CON_WHILEVARVARL:
|
||||
// ---
|
||||
case CON_IFKEY:
|
||||
case CON_IFRND:
|
||||
// vvv if* using current sprite
|
||||
case CON_IFANGDIFFL:
|
||||
|
@ -2503,6 +2518,9 @@ repeatcase:
|
|||
// ---
|
||||
case CON_IFINSIDE:
|
||||
// ---
|
||||
case CON_IFEITHERALT:
|
||||
case CON_IFEITHERCTRL:
|
||||
case CON_IFEITHERSHIFT:
|
||||
case CON_IFAWAYFROMWALL:
|
||||
case CON_IFCANSEE:
|
||||
case CON_IFONWATER:
|
||||
|
@ -2517,6 +2535,7 @@ repeatcase:
|
|||
ofstype offset;
|
||||
ofstype lastScriptOfs = (g_scriptPtr-script-1);
|
||||
instype *tscrptr;
|
||||
|
||||
cs.ifElseAborted = 0;
|
||||
|
||||
if (tw<=CON_WHILEVARL) // careful! check this against order in m32def.h!
|
||||
|
@ -2757,9 +2776,16 @@ repeatcase:
|
|||
C_GetManyVars(3);
|
||||
return 0;
|
||||
case CON_PRINTEXT256:
|
||||
case CON_PRINTEXT16:
|
||||
C_GetManyVars(6);
|
||||
return 0;
|
||||
|
||||
case CON_GETNUMBER16:
|
||||
case CON_GETNUMBER256:
|
||||
C_GetNextVarType(GAMEVAR_READONLY);
|
||||
C_GetManyVars(2);
|
||||
return 0;
|
||||
|
||||
case CON_QSPRINTF:
|
||||
C_GetManyVars(2);
|
||||
|
||||
|
@ -2890,6 +2916,18 @@ repeatcase:
|
|||
}
|
||||
return 0;
|
||||
|
||||
case CON_DRAWLINE16:
|
||||
case CON_DRAWLINE16B:
|
||||
case CON_DRAWCIRCLE16:
|
||||
case CON_DRAWCIRCLE16B:
|
||||
if (cs.parsingEventOfs < 0 && cs.currentStateIdx < 0)
|
||||
{
|
||||
C_ReportError(ERROR_EVENTONLY);
|
||||
g_numCompilerErrors++;
|
||||
}
|
||||
C_GetManyVars((tw==CON_DRAWLINE16||tw==CON_DRAWLINE16B) ? 5 : 4);
|
||||
break;
|
||||
|
||||
case CON_ROTATESPRITE16:
|
||||
case CON_ROTATESPRITE:
|
||||
if (cs.parsingEventOfs < 0 && cs.currentStateIdx < 0)
|
||||
|
@ -2928,6 +2966,10 @@ static void C_AddDefaultDefinitions(void)
|
|||
C_AddDefinition("EVENT_ANALYZESPRITES", EVENT_ANALYZESPRITES, LABEL_EVENT);
|
||||
C_AddDefinition("EVENT_INSERTSPRITE2D", EVENT_INSERTSPRITE2D, LABEL_EVENT);
|
||||
C_AddDefinition("EVENT_INSERTSPRITE3D", EVENT_INSERTSPRITE3D, LABEL_EVENT);
|
||||
C_AddDefinition("EVENT_DRAW2DSCREEN", EVENT_DRAW2DSCREEN, LABEL_EVENT);
|
||||
// C_AddDefinition("EVENT_KEYS2D", EVENT_KEYS2D, LABEL_EVENT);
|
||||
C_AddDefinition("EVENT_KEYS3D", EVENT_KEYS3D, LABEL_EVENT);
|
||||
C_AddDefinition("EVENT_OVERHEADEDITOR", EVENT_OVERHEADEDITOR, LABEL_EVENT);
|
||||
|
||||
C_AddDefinition("CLIPMASK0", CLIPMASK0, LABEL_DEFINE);
|
||||
C_AddDefinition("CLIPMASK1", CLIPMASK1, LABEL_DEFINE);
|
||||
|
@ -2937,10 +2979,103 @@ static void C_AddDefaultDefinitions(void)
|
|||
C_AddDefinition("MAXWALLS", MAXWALLS, LABEL_DEFINE);
|
||||
C_AddDefinition("MAXTILES", MAXTILES, LABEL_DEFINE);
|
||||
|
||||
// keys
|
||||
C_AddDefinition("KEY_SPACE", KEYSC_SPACE, LABEL_DEFINE);
|
||||
|
||||
C_AddDefinition("KEY_A", KEYSC_A, LABEL_DEFINE);
|
||||
C_AddDefinition("KEY_B", KEYSC_B, LABEL_DEFINE);
|
||||
C_AddDefinition("KEY_C", KEYSC_C, LABEL_DEFINE);
|
||||
C_AddDefinition("KEY_D", KEYSC_D, LABEL_DEFINE);
|
||||
C_AddDefinition("KEY_E", KEYSC_E, LABEL_DEFINE);
|
||||
C_AddDefinition("KEY_F", KEYSC_F, LABEL_DEFINE);
|
||||
C_AddDefinition("KEY_G", KEYSC_G, LABEL_DEFINE);
|
||||
C_AddDefinition("KEY_H", KEYSC_H, LABEL_DEFINE);
|
||||
C_AddDefinition("KEY_I", KEYSC_I, LABEL_DEFINE);
|
||||
C_AddDefinition("KEY_J", KEYSC_J, LABEL_DEFINE);
|
||||
C_AddDefinition("KEY_K", KEYSC_K, LABEL_DEFINE);
|
||||
C_AddDefinition("KEY_L", KEYSC_L, LABEL_DEFINE);
|
||||
C_AddDefinition("KEY_M", KEYSC_M, LABEL_DEFINE);
|
||||
C_AddDefinition("KEY_N", KEYSC_N, LABEL_DEFINE);
|
||||
C_AddDefinition("KEY_O", KEYSC_O, LABEL_DEFINE);
|
||||
C_AddDefinition("KEY_P", KEYSC_P, LABEL_DEFINE);
|
||||
C_AddDefinition("KEY_Q", KEYSC_Q, LABEL_DEFINE);
|
||||
C_AddDefinition("KEY_R", KEYSC_R, LABEL_DEFINE);
|
||||
C_AddDefinition("KEY_S", KEYSC_S, LABEL_DEFINE);
|
||||
C_AddDefinition("KEY_T", KEYSC_T, LABEL_DEFINE);
|
||||
C_AddDefinition("KEY_U", KEYSC_U, LABEL_DEFINE);
|
||||
C_AddDefinition("KEY_V", KEYSC_V, LABEL_DEFINE);
|
||||
C_AddDefinition("KEY_W", KEYSC_W, LABEL_DEFINE);
|
||||
C_AddDefinition("KEY_X", KEYSC_X, LABEL_DEFINE);
|
||||
C_AddDefinition("KEY_Y", KEYSC_Y, LABEL_DEFINE);
|
||||
C_AddDefinition("KEY_Z", KEYSC_Z, LABEL_DEFINE);
|
||||
|
||||
C_AddDefinition("KEY_ENTER", KEYSC_ENTER, LABEL_DEFINE);
|
||||
C_AddDefinition("KEY_BS", KEYSC_BS, LABEL_DEFINE);
|
||||
C_AddDefinition("KEY_TAB", KEYSC_TAB, LABEL_DEFINE);
|
||||
|
||||
C_AddDefinition("KEY_0", KEYSC_0, LABEL_DEFINE);
|
||||
C_AddDefinition("KEY_1", KEYSC_1, LABEL_DEFINE);
|
||||
C_AddDefinition("KEY_2", KEYSC_2, LABEL_DEFINE);
|
||||
C_AddDefinition("KEY_3", KEYSC_3, LABEL_DEFINE);
|
||||
C_AddDefinition("KEY_4", KEYSC_4, LABEL_DEFINE);
|
||||
C_AddDefinition("KEY_5", KEYSC_5, LABEL_DEFINE);
|
||||
C_AddDefinition("KEY_6", KEYSC_6, LABEL_DEFINE);
|
||||
C_AddDefinition("KEY_7", KEYSC_7, LABEL_DEFINE);
|
||||
C_AddDefinition("KEY_8", KEYSC_8, LABEL_DEFINE);
|
||||
C_AddDefinition("KEY_9", KEYSC_9, LABEL_DEFINE);
|
||||
|
||||
C_AddDefinition("KEY_DASH", KEYSC_DASH, LABEL_DEFINE);
|
||||
C_AddDefinition("KEY_EQUAL", KEYSC_EQUAL, LABEL_DEFINE);
|
||||
C_AddDefinition("KEY_LBRACK", KEYSC_LBRACK, LABEL_DEFINE);
|
||||
C_AddDefinition("KEY_RBRACK", KEYSC_RBRACK, LABEL_DEFINE);
|
||||
C_AddDefinition("KEY_SEMI", KEYSC_SEMI, LABEL_DEFINE);
|
||||
C_AddDefinition("KEY_QUOTE", KEYSC_QUOTE, LABEL_DEFINE);
|
||||
C_AddDefinition("KEY_BQUOTE", KEYSC_BQUOTE, LABEL_DEFINE);
|
||||
C_AddDefinition("KEY_BSLASH", KEYSC_BSLASH, LABEL_DEFINE);
|
||||
C_AddDefinition("KEY_COMMA", KEYSC_COMMA, LABEL_DEFINE);
|
||||
C_AddDefinition("KEY_PERIOD", KEYSC_PERIOD, LABEL_DEFINE);
|
||||
C_AddDefinition("KEY_SLASH", KEYSC_SLASH, LABEL_DEFINE);
|
||||
|
||||
C_AddDefinition("KEY_LALT", KEYSC_LALT, LABEL_DEFINE);
|
||||
C_AddDefinition("KEY_LCTRL", KEYSC_LCTRL, LABEL_DEFINE);
|
||||
C_AddDefinition("KEY_LSHIFT", KEYSC_LSHIFT, LABEL_DEFINE);
|
||||
C_AddDefinition("KEY_RALT", KEYSC_RALT, LABEL_DEFINE);
|
||||
C_AddDefinition("KEY_RCTRL", KEYSC_RCTRL, LABEL_DEFINE);
|
||||
C_AddDefinition("KEY_RSHIFT", KEYSC_RSHIFT, LABEL_DEFINE);
|
||||
|
||||
C_AddDefinition("KEY_gDEL", KEYSC_gDEL, LABEL_DEFINE);
|
||||
C_AddDefinition("KEY_gDOWN", KEYSC_gDOWN, LABEL_DEFINE);
|
||||
C_AddDefinition("KEY_gEND", KEYSC_gEND, LABEL_DEFINE);
|
||||
C_AddDefinition("KEY_gHOME", KEYSC_gHOME, LABEL_DEFINE);
|
||||
C_AddDefinition("KEY_gINS", KEYSC_gINS, LABEL_DEFINE);
|
||||
C_AddDefinition("KEY_gKP5", KEYSC_gKP5, LABEL_DEFINE);
|
||||
C_AddDefinition("KEY_gLEFT", KEYSC_gLEFT, LABEL_DEFINE);
|
||||
C_AddDefinition("KEY_gMINUS", KEYSC_gMINUS, LABEL_DEFINE);
|
||||
C_AddDefinition("KEY_gPGDN", KEYSC_gPGDN, LABEL_DEFINE);
|
||||
C_AddDefinition("KEY_gPGUP", KEYSC_gPGUP, LABEL_DEFINE);
|
||||
C_AddDefinition("KEY_gPLUS", KEYSC_gPLUS, LABEL_DEFINE);
|
||||
C_AddDefinition("KEY_gRIGHT", KEYSC_gRIGHT, LABEL_DEFINE);
|
||||
C_AddDefinition("KEY_gSLASH", KEYSC_gSLASH, LABEL_DEFINE);
|
||||
C_AddDefinition("KEY_gSTAR", KEYSC_gSTAR, LABEL_DEFINE);
|
||||
C_AddDefinition("KEY_gUP", KEYSC_gUP, LABEL_DEFINE);
|
||||
|
||||
C_AddDefinition("KEY_HOME", KEYSC_HOME, LABEL_DEFINE);
|
||||
C_AddDefinition("KEY_UP", KEYSC_UP, LABEL_DEFINE);
|
||||
C_AddDefinition("KEY_PGUP", KEYSC_PGUP, LABEL_DEFINE);
|
||||
C_AddDefinition("KEY_LEFT", KEYSC_LEFT, LABEL_DEFINE);
|
||||
C_AddDefinition("KEY_RIGHT", KEYSC_RIGHT, LABEL_DEFINE);
|
||||
C_AddDefinition("KEY_END", KEYSC_END, LABEL_DEFINE);
|
||||
C_AddDefinition("KEY_DOWN", KEYSC_DOWN, LABEL_DEFINE);
|
||||
C_AddDefinition("KEY_PGDN", KEYSC_PGDN, LABEL_DEFINE);
|
||||
C_AddDefinition("KEY_INSERT", KEYSC_INSERT, LABEL_DEFINE);
|
||||
C_AddDefinition("KEY_DELETE", KEYSC_DELETE, LABEL_DEFINE);
|
||||
// end keys
|
||||
|
||||
// C_AddDefinition("STR_MAPFILENAME",STR_MAPFILENAME, LABEL_DEFINE);
|
||||
// C_AddDefinition("STR_VERSION",STR_VERSION, LABEL_DEFINE);
|
||||
|
||||
C_AddDefinition("NO",0, LABEL_DEFINE);
|
||||
C_AddDefinition("COLOR_WHITE",31, LABEL_DEFINE);
|
||||
}
|
||||
|
||||
void C_CompilationInfo(void)
|
||||
|
|
|
@ -32,6 +32,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
|
||||
//#include "osdcmds.h"
|
||||
#include "osd.h"
|
||||
#include "keys.h"
|
||||
|
||||
vmstate_t vm;
|
||||
vmstate_t vm_default =
|
||||
|
@ -47,14 +48,15 @@ int32_t g_errorLineNum, g_tw;
|
|||
|
||||
uint8_t aEventEnabled[MAXEVENTS];
|
||||
|
||||
static int16_t neartagsector, neartagwall, neartagsprite;
|
||||
static int32_t neartaghitdist;
|
||||
uint32_t m32_drawlinepat=0xffffffff;
|
||||
|
||||
instype *insptr;
|
||||
int32_t X_DoExecute(int32_t once);
|
||||
|
||||
#include "m32structures.c"
|
||||
|
||||
extern void message(const char *fmt, ...);
|
||||
|
||||
// from sector.c vvv
|
||||
static int32_t ldist(spritetype *s1,spritetype *s2)
|
||||
{
|
||||
|
@ -226,6 +228,20 @@ static inline void __fastcall X_DoConditional(register int32_t condition)
|
|||
continue; \
|
||||
}
|
||||
|
||||
#define X_ERROR_INVALIDQUOTE(q, array) \
|
||||
if (q<0 || q>=MAXQUOTES) \
|
||||
{ \
|
||||
OSD_Printf(CON_ERROR "Invalid quote number %d!\n", g_errorLineNum, keyw[g_tw], q); \
|
||||
vm.g_errorFlag = 1; \
|
||||
continue; \
|
||||
} \
|
||||
else if (array[q] == NULL) \
|
||||
{ \
|
||||
OSD_Printf(CON_ERROR "Null quote %d!\n", g_errorLineNum, keyw[g_tw], q); \
|
||||
vm.g_errorFlag = 1; \
|
||||
continue; \
|
||||
} \
|
||||
|
||||
int32_t X_DoExecute(int32_t once)
|
||||
{
|
||||
register int32_t tw = *insptr;
|
||||
|
@ -1235,6 +1251,36 @@ badindex:
|
|||
X_DoConditional(rnd(Gv_GetVarX(*(++insptr))));
|
||||
continue;
|
||||
|
||||
case CON_IFKEY:
|
||||
insptr++;
|
||||
{
|
||||
int32_t key=Gv_GetVarX(*insptr);
|
||||
if (key<0 || key >= (int32_t)(sizeof(keystatus)/sizeof(keystatus[0])))
|
||||
{
|
||||
OSD_Printf(CON_ERROR "Invalid key %d!\n",g_errorLineNum,keyw[g_tw],key);
|
||||
vm.g_errorFlag = 1;
|
||||
continue;
|
||||
}
|
||||
X_DoConditional(keystatus[key]);
|
||||
|
||||
if ((key>=KEYSC_1 && key<=KEYSC_ENTER) || (key>=KEYSC_A && key<=KEYSC_BQUOTE)
|
||||
|| (key>=KEYSC_BSLASH && key<=KEYSC_SLASH))
|
||||
keystatus[key] = 0;
|
||||
}
|
||||
continue;
|
||||
|
||||
case CON_IFEITHERALT:
|
||||
X_DoConditional(keystatus[KEYSC_LALT]||keystatus[KEYSC_RALT]);
|
||||
continue;
|
||||
|
||||
case CON_IFEITHERCTRL:
|
||||
X_DoConditional(keystatus[KEYSC_LCTRL]||keystatus[KEYSC_RCTRL]);
|
||||
continue;
|
||||
|
||||
case CON_IFEITHERSHIFT:
|
||||
X_DoConditional(keystatus[KEYSC_LSHIFT]||keystatus[KEYSC_RSHIFT]);
|
||||
continue;
|
||||
|
||||
// vvv CURSPR
|
||||
case CON_IFSPRITEPAL:
|
||||
insptr++;
|
||||
|
@ -1526,6 +1572,9 @@ badindex:
|
|||
int32_t neartagsectorvar=*insptr++, neartagwallvar=*insptr++, neartagspritevar=*insptr++, neartaghitdistvar=*insptr++;
|
||||
int32_t neartagrange=Gv_GetVarX(*insptr++), tagsearch=Gv_GetVarX(*insptr++);
|
||||
|
||||
int16_t neartagsector, neartagwall, neartagsprite;
|
||||
int32_t neartaghitdist;
|
||||
|
||||
X_ERROR_INVALIDSECT(sectnum);
|
||||
neartag(x, y, z, sectnum, ang, &neartagsector, &neartagwall, &neartagsprite, &neartaghitdist, neartagrange, tagsearch);
|
||||
|
||||
|
@ -1840,60 +1889,71 @@ badindex:
|
|||
insptr++;
|
||||
{
|
||||
int32_t q = *insptr++, i = *insptr++;
|
||||
if (ScriptQuotes[q] == NULL || ScriptQuoteRedefinitions[i] == NULL)
|
||||
{
|
||||
OSD_Printf(CON_ERROR "%s %d null quote\n",g_errorLineNum,keyw[g_tw],q,i);
|
||||
vm.g_errorFlag = 1;
|
||||
break;
|
||||
}
|
||||
X_ERROR_INVALIDQUOTE(q, ScriptQuotes);
|
||||
X_ERROR_INVALIDQUOTE(i, ScriptQuoteRedefinitions);
|
||||
Bstrcpy(ScriptQuotes[q],ScriptQuoteRedefinitions[i]);
|
||||
continue;
|
||||
}
|
||||
|
||||
insptr++;
|
||||
|
||||
if (ScriptQuotes[*insptr] == NULL)
|
||||
{
|
||||
OSD_Printf(CON_ERROR "null quote %d\n",g_errorLineNum,keyw[g_tw],*insptr);
|
||||
insptr++;
|
||||
continue;
|
||||
}
|
||||
X_ERROR_INVALIDQUOTE(*insptr, ScriptQuotes);
|
||||
OSD_Printf("%s", ScriptQuotes[*insptr++]);
|
||||
continue;
|
||||
|
||||
case CON_GETNUMBER16:
|
||||
case CON_GETNUMBER256:
|
||||
insptr++;
|
||||
{
|
||||
int32_t var=*insptr++, quote=Gv_GetVarX(*insptr++), max=Gv_GetVarX(*insptr++), sign=ksgn(max)<0?1:0;
|
||||
char buf[60];
|
||||
|
||||
X_ERROR_INVALIDQUOTE(quote, ScriptQuotes);
|
||||
Bmemcpy(buf, ScriptQuotes[quote], sizeof(buf)-1);
|
||||
buf[sizeof(buf)-1]='\0';
|
||||
|
||||
if (tw==CON_GETNUMBER16)
|
||||
Gv_SetVarX(var, getnumber16(ScriptQuotes[quote], Gv_GetVarX(var), max, sign));
|
||||
else
|
||||
Gv_SetVarX(var, getnumber256(ScriptQuotes[quote], Gv_GetVarX(var), max, sign));
|
||||
}
|
||||
continue;
|
||||
|
||||
case CON_QUOTE:
|
||||
case CON_ERRORINS:
|
||||
case CON_PRINTMESSAGE16:
|
||||
case CON_PRINTMESSAGE256:
|
||||
case CON_PRINTEXT256:
|
||||
case CON_PRINTEXT16:
|
||||
insptr++;
|
||||
{
|
||||
int32_t i=Gv_GetVarX(*insptr++);
|
||||
int32_t x=(tw>=CON_PRINTMESSAGE256)?Gv_GetVarX(*insptr++):0;
|
||||
int32_t y=(tw>=CON_PRINTMESSAGE256)?Gv_GetVarX(*insptr++):0;
|
||||
int32_t col=(tw==CON_PRINTEXT256)?Gv_GetVarX(*insptr++):0;
|
||||
int32_t backcol=(tw==CON_PRINTEXT256)?Gv_GetVarX(*insptr++):0;
|
||||
int32_t fontsize=(tw==CON_PRINTEXT256)?Gv_GetVarX(*insptr++):0;
|
||||
int32_t col=(tw>=CON_PRINTEXT256)?Gv_GetVarX(*insptr++):0;
|
||||
int32_t backcol=(tw>=CON_PRINTEXT256)?Gv_GetVarX(*insptr++):0;
|
||||
int32_t fontsize=(tw>=CON_PRINTEXT256)?Gv_GetVarX(*insptr++):0;
|
||||
|
||||
if (tw==CON_ERRORINS) vm.g_errorFlag = 1;
|
||||
|
||||
if (ScriptQuotes[i] == NULL)
|
||||
{
|
||||
OSD_Printf(CON_ERROR "null quote %d\n",g_errorLineNum,keyw[g_tw],i);
|
||||
continue;
|
||||
}
|
||||
X_ERROR_INVALIDQUOTE(i, ScriptQuotes);
|
||||
|
||||
if (tw==CON_QUOTE)
|
||||
OSD_Printf("%s\n", ScriptQuotes[i]);
|
||||
message("%s", ScriptQuotes[i]);
|
||||
else if (tw==CON_PRINTMESSAGE16)
|
||||
printmessage16("%s", ScriptQuotes[i]);
|
||||
else if (tw==CON_PRINTMESSAGE256)
|
||||
printmessage256(x, y, ScriptQuotes[i]);
|
||||
else
|
||||
else if (tw==CON_PRINTEXT256)
|
||||
{
|
||||
if (col<0 || col>=256) col=0;
|
||||
if (backcol<0 || backcol>=256) backcol=0;
|
||||
if (backcol<0 || backcol>=256) backcol=-1;
|
||||
printext256(x, y, col, backcol, ScriptQuotes[i], fontsize);
|
||||
}
|
||||
else if (tw==CON_PRINTEXT16)
|
||||
{
|
||||
printext16(x, y, editorcolors[col&15], backcol<0 ? -1 : editorcolors[backcol&15],
|
||||
ScriptQuotes[i], fontsize);
|
||||
}
|
||||
}
|
||||
continue;
|
||||
|
||||
|
@ -1902,12 +1962,8 @@ badindex:
|
|||
{
|
||||
int32_t i=*insptr++;
|
||||
int32_t j=Gv_GetVarX(*insptr++);
|
||||
if (ScriptQuotes[j] == NULL)
|
||||
{
|
||||
OSD_Printf(CON_ERROR "null quote %d\n",g_errorLineNum,keyw[g_tw],j);
|
||||
Gv_SetVarX(i, -1);
|
||||
continue;
|
||||
}
|
||||
|
||||
X_ERROR_INVALIDQUOTE(j, ScriptQuotes);
|
||||
Gv_SetVarX(i, Bstrlen(ScriptQuotes[j]));
|
||||
continue;
|
||||
}
|
||||
|
@ -1920,26 +1976,8 @@ badindex:
|
|||
int32_t st = Gv_GetVarX(*insptr++);
|
||||
int32_t ln = Gv_GetVarX(*insptr++);
|
||||
|
||||
if (q1<0 || q1>=MAXQUOTES)
|
||||
{
|
||||
OSD_Printf(CON_ERROR "invalid quote ID %d\n",g_errorLineNum,keyw[g_tw],q1);
|
||||
continue;
|
||||
}
|
||||
if (ScriptQuotes[q1] == NULL)
|
||||
{
|
||||
OSD_Printf(CON_ERROR "null quote %d\n",g_errorLineNum,keyw[g_tw],q1);
|
||||
continue;
|
||||
}
|
||||
if (q2<0 || q2>=MAXQUOTES)
|
||||
{
|
||||
OSD_Printf(CON_ERROR "invalid quote ID %d\n",g_errorLineNum,keyw[g_tw],q2);
|
||||
continue;
|
||||
}
|
||||
if (ScriptQuotes[q2] == NULL)
|
||||
{
|
||||
OSD_Printf(CON_ERROR "null quote %d\n",g_errorLineNum,keyw[g_tw],q2);
|
||||
continue;
|
||||
}
|
||||
X_ERROR_INVALIDQUOTE(q1, ScriptQuotes);
|
||||
X_ERROR_INVALIDQUOTE(q2, ScriptQuotes);
|
||||
|
||||
{
|
||||
char *s1 = ScriptQuotes[q1];
|
||||
|
@ -1965,6 +2003,9 @@ badindex:
|
|||
int32_t i = Gv_GetVarX(*insptr++);
|
||||
int32_t j = Gv_GetVarX(*insptr++);
|
||||
|
||||
X_ERROR_INVALIDQUOTE(i, ScriptQuotes);
|
||||
X_ERROR_INVALIDQUOTE(j, ScriptQuotes);
|
||||
|
||||
switch (tw)
|
||||
{
|
||||
#if 0
|
||||
|
@ -1988,21 +2029,14 @@ badindex:
|
|||
break;
|
||||
#endif
|
||||
case CON_QSTRCAT:
|
||||
if (ScriptQuotes[i] == NULL || ScriptQuotes[j] == NULL) goto nullquote;
|
||||
Bstrncat(ScriptQuotes[i],ScriptQuotes[j],(MAXQUOTELEN-1)-Bstrlen(ScriptQuotes[i]));
|
||||
break;
|
||||
case CON_QSTRNCAT:
|
||||
if (ScriptQuotes[i] == NULL || ScriptQuotes[j] == NULL) goto nullquote;
|
||||
Bstrncat(ScriptQuotes[i],ScriptQuotes[j],Gv_GetVarX(*insptr++));
|
||||
break;
|
||||
case CON_QSTRCPY:
|
||||
if (ScriptQuotes[i] == NULL || ScriptQuotes[j] == NULL) goto nullquote;
|
||||
Bstrcpy(ScriptQuotes[i],ScriptQuotes[j]);
|
||||
break;
|
||||
default:
|
||||
nullquote:
|
||||
OSD_Printf(CON_ERROR "null quote %d\n",g_errorLineNum,keyw[g_tw],ScriptQuotes[i] ? j : i);
|
||||
break;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
@ -2011,23 +2045,17 @@ nullquote:
|
|||
insptr++;
|
||||
{
|
||||
int32_t dq = Gv_GetVarX(*insptr++), sq = Gv_GetVarX(*insptr++);
|
||||
if (ScriptQuotes[sq] == NULL || ScriptQuotes[dq] == NULL)
|
||||
{
|
||||
OSD_Printf(CON_ERROR "null quote %d\n",g_errorLineNum,keyw[g_tw],ScriptQuotes[sq] ? dq : sq);
|
||||
while ((*insptr & 0xFFF) != CON_NULLOP)
|
||||
/*Gv_GetVarX(*insptr++);*/ {}
|
||||
|
||||
insptr++; // skip the NOP
|
||||
continue;
|
||||
}
|
||||
X_ERROR_INVALIDQUOTE(dq, ScriptQuotes);
|
||||
X_ERROR_INVALIDQUOTE(sq, ScriptQuotes);
|
||||
|
||||
{
|
||||
int32_t arg[32], i=0, j=0, k=0;
|
||||
int32_t arg[32], numvals=0, i=0, j=0, k=0;
|
||||
int32_t len = Bstrlen(ScriptQuotes[sq]);
|
||||
char tmpbuf[MAXQUOTELEN];
|
||||
char tmpbuf[MAXQUOTELEN<<1];
|
||||
|
||||
while ((*insptr & 0xFFF) != CON_NULLOP && i < 32)
|
||||
arg[i++] = Gv_GetVarX(*insptr++);
|
||||
while ((*insptr & 0xFFF) != CON_NULLOP && numvals < 32)
|
||||
arg[numvals++] = Gv_GetVarX(*insptr++);
|
||||
|
||||
insptr++; // skip the NOP
|
||||
|
||||
|
@ -2040,6 +2068,9 @@ nullquote:
|
|||
if (ScriptQuotes[sq][k] == '%')
|
||||
{
|
||||
k++;
|
||||
|
||||
if (i>=numvals) goto dodefault;
|
||||
|
||||
switch (ScriptQuotes[sq][k])
|
||||
{
|
||||
case 'l':
|
||||
|
@ -2067,14 +2098,17 @@ nullquote:
|
|||
|
||||
case 's':
|
||||
{
|
||||
int32_t ii = Bstrlen(ScriptQuotes[arg[i]]);
|
||||
|
||||
Bmemcpy(&tmpbuf[j], ScriptQuotes[arg[i]], ii);
|
||||
j += ii;
|
||||
if (arg[i]>=0 && arg[i]<MAXQUOTES && ScriptQuotes[arg[i]])
|
||||
{
|
||||
int32_t ii = Bstrlen(ScriptQuotes[arg[i]]);
|
||||
Bmemcpy(&tmpbuf[j], ScriptQuotes[arg[i]], ii);
|
||||
j += ii;
|
||||
}
|
||||
k++;
|
||||
}
|
||||
break;
|
||||
|
||||
dodefault:
|
||||
default:
|
||||
tmpbuf[j++] = ScriptQuotes[sq][k-1];
|
||||
break;
|
||||
|
@ -2084,7 +2118,8 @@ nullquote:
|
|||
while (k < len && j < MAXQUOTELEN);
|
||||
|
||||
tmpbuf[j] = '\0';
|
||||
Bstrcpy(ScriptQuotes[dq], tmpbuf);
|
||||
Bmemcpy(ScriptQuotes[dq], tmpbuf, MAXQUOTELEN);
|
||||
ScriptQuotes[dq][MAXQUOTELEN-1] = '\0';
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
@ -2298,6 +2333,54 @@ nullquote:
|
|||
Gv_SetVarX(g_iTextureID, sector[vm.g_sp->sectnum].ceilingpicnum);
|
||||
continue;
|
||||
// ^^^
|
||||
case CON_DRAWLINE16:
|
||||
case CON_DRAWLINE16B:
|
||||
insptr++;
|
||||
{
|
||||
int32_t x1=Gv_GetVarX(*insptr++), y1=Gv_GetVarX(*insptr++);
|
||||
int32_t x2=Gv_GetVarX(*insptr++), y2=Gv_GetVarX(*insptr++);
|
||||
int32_t col=Gv_GetVarX(*insptr++), odrawlinepat=drawlinepat;
|
||||
int32_t xofs=0, yofs=0;
|
||||
|
||||
if (tw==CON_DRAWLINE16B)
|
||||
{
|
||||
x1 = mulscale14(x1-pos.x,zoom);
|
||||
y1 = mulscale14(y1-pos.y,zoom);
|
||||
x2 = mulscale14(x2-pos.x,zoom);
|
||||
y2 = mulscale14(y2-pos.y,zoom);
|
||||
xofs = halfxdim16;
|
||||
yofs = midydim16;
|
||||
}
|
||||
|
||||
drawlinepat = m32_drawlinepat;
|
||||
drawline16(xofs+x1,yofs+y1, xofs+x2,yofs+y2, editorcolors[col&15]);
|
||||
drawlinepat = odrawlinepat;
|
||||
continue;
|
||||
}
|
||||
|
||||
case CON_DRAWCIRCLE16:
|
||||
case CON_DRAWCIRCLE16B:
|
||||
insptr++;
|
||||
{
|
||||
int32_t x1=Gv_GetVarX(*insptr++), y1=Gv_GetVarX(*insptr++);
|
||||
int32_t r=Gv_GetVarX(*insptr++);
|
||||
int32_t col=Gv_GetVarX(*insptr++), odrawlinepat=drawlinepat;
|
||||
int32_t xofs=0, yofs=0;
|
||||
|
||||
if (tw==CON_DRAWCIRCLE16B)
|
||||
{
|
||||
x1 = mulscale14(x1-pos.x,zoom);
|
||||
y1 = mulscale14(y1-pos.y,zoom);
|
||||
r = mulscale14(r,zoom);
|
||||
xofs = halfxdim16;
|
||||
yofs = midydim16;
|
||||
}
|
||||
|
||||
drawlinepat = m32_drawlinepat;
|
||||
drawcircle16(xofs+x1, yofs+y1, r, editorcolors[col&15]);
|
||||
drawlinepat = odrawlinepat;
|
||||
continue;
|
||||
}
|
||||
|
||||
case CON_ROTATESPRITE16:
|
||||
case CON_ROTATESPRITE:
|
||||
|
|
|
@ -25,6 +25,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
#include "m32script.h"
|
||||
#include "m32def.h"
|
||||
#include "osd.h"
|
||||
#include "keys.h"
|
||||
|
||||
#define _m32vars_c_
|
||||
#include "m32structures.c"
|
||||
|
@ -474,6 +475,22 @@ void __fastcall Gv_SetVarX(register int32_t id, register int32_t lValue)
|
|||
}
|
||||
}
|
||||
|
||||
static uint8_t alphakeys[] =
|
||||
{
|
||||
KEYSC_SPACE,
|
||||
|
||||
KEYSC_A, KEYSC_B, KEYSC_C, KEYSC_D, KEYSC_E, KEYSC_F, KEYSC_G, KEYSC_H,
|
||||
KEYSC_I, KEYSC_J, KEYSC_K, KEYSC_L, KEYSC_M, KEYSC_N, KEYSC_O, KEYSC_P,
|
||||
KEYSC_Q, KEYSC_R, KEYSC_S, KEYSC_T, KEYSC_U, KEYSC_V, KEYSC_W, KEYSC_X,
|
||||
KEYSC_Y, KEYSC_Z,
|
||||
};
|
||||
|
||||
static uint8_t numberkeys[] =
|
||||
{
|
||||
KEYSC_0, KEYSC_1, KEYSC_2, KEYSC_3, KEYSC_4, KEYSC_5, KEYSC_6, KEYSC_7,
|
||||
KEYSC_8, KEYSC_9,
|
||||
};
|
||||
|
||||
static void Gv_AddSystemVars(void)
|
||||
{
|
||||
// only call ONCE
|
||||
|
@ -511,16 +528,10 @@ static void Gv_AddSystemVars(void)
|
|||
|
||||
Gv_NewVar("viewingrange",(intptr_t)&viewingrange, GAMEVAR_SYSTEM | GAMEVAR_INTPTR | GAMEVAR_READONLY);
|
||||
Gv_NewVar("yxaspect",(intptr_t)&yxaspect, GAMEVAR_SYSTEM | GAMEVAR_INTPTR | GAMEVAR_READONLY);
|
||||
|
||||
/// Gv_NewVar("framerate",(intptr_t)&g_currentFrameRate, GAMEVAR_SYSTEM | GAMEVAR_INTPTR | GAMEVAR_READONLY);
|
||||
Gv_NewVar("CLIPMASK0", CLIPMASK0, GAMEVAR_SYSTEM|GAMEVAR_READONLY);
|
||||
Gv_NewVar("CLIPMASK1", CLIPMASK1, GAMEVAR_SYSTEM|GAMEVAR_READONLY);
|
||||
|
||||
Gv_NewVar("MAXSPRITES",MAXSPRITES, GAMEVAR_SYSTEM|GAMEVAR_READONLY);
|
||||
Gv_NewVar("MAXSECTORS",MAXSECTORS, GAMEVAR_SYSTEM|GAMEVAR_READONLY);
|
||||
Gv_NewVar("MAXWALLS",MAXWALLS, GAMEVAR_SYSTEM|GAMEVAR_READONLY);
|
||||
Gv_NewVar("MAXTILES",MAXTILES, GAMEVAR_SYSTEM|GAMEVAR_READONLY);
|
||||
|
||||
/// Gv_NewVar("display_mirror",(intptr_t)&display_mirror, GAMEVAR_SYSTEM | GAMEVAR_CHARPTR);
|
||||
|
||||
Gv_NewVar("randomseed",(intptr_t)&randomseed, GAMEVAR_SYSTEM | GAMEVAR_INTPTR);
|
||||
|
||||
Gv_NewVar("numwalls",(intptr_t)&numwalls, GAMEVAR_SYSTEM | GAMEVAR_SHORTPTR | GAMEVAR_READONLY);
|
||||
|
@ -576,8 +587,15 @@ static void Gv_AddSystemVars(void)
|
|||
Gv_NewVar("mousxplc",(intptr_t)&mousxplc, GAMEVAR_READONLY | GAMEVAR_INTPTR | GAMEVAR_SYSTEM);
|
||||
Gv_NewVar("mousyplc",(intptr_t)&mousyplc, GAMEVAR_READONLY | GAMEVAR_INTPTR | GAMEVAR_SYSTEM);
|
||||
|
||||
Gv_NewVar("zoom",(intptr_t)&zoom, GAMEVAR_READONLY | GAMEVAR_INTPTR | GAMEVAR_SYSTEM);
|
||||
Gv_NewVar("drawlinepat",(intptr_t)&m32_drawlinepat, GAMEVAR_INTPTR | GAMEVAR_SYSTEM);
|
||||
Gv_NewVar("halfxdim16", (intptr_t)&halfxdim16, GAMEVAR_READONLY | GAMEVAR_INTPTR | GAMEVAR_SYSTEM);
|
||||
Gv_NewVar("midydim16", (intptr_t)&midydim16, GAMEVAR_READONLY | GAMEVAR_INTPTR | GAMEVAR_SYSTEM);
|
||||
Gv_NewVar("ydim16",(intptr_t)&ydim16, GAMEVAR_INTPTR | GAMEVAR_SYSTEM | GAMEVAR_READONLY);
|
||||
|
||||
g_systemVarCount = g_gameVarCount;
|
||||
|
||||
|
||||
Gv_NewArray("highlight", (void *)highlight, hlcnt_id,
|
||||
GAMEARRAY_READONLY|GAMEARRAY_OFSHORT|GAMEARRAY_VARSIZE);
|
||||
Gv_NewArray("highlightsector", (void *)highlightsector, hlscnt_id,
|
||||
|
@ -599,6 +617,10 @@ static void Gv_AddSystemVars(void)
|
|||
Gv_NewArray("show2dwall", (void *)show2dwall, (MAXWALLS+7)>>3, GAMEARRAY_READONLY|GAMEARRAY_OFCHAR);
|
||||
Gv_NewArray("show2dsprite", (void *)show2dsprite, (MAXSPRITES+7)>>3, GAMEARRAY_READONLY|GAMEARRAY_OFCHAR);
|
||||
|
||||
Gv_NewArray("keystatus", (void *)keystatus, 256, GAMEARRAY_READONLY|GAMEARRAY_OFCHAR);
|
||||
Gv_NewArray("alphakeys", (void *)alphakeys, sizeof(alphakeys), GAMEARRAY_READONLY|GAMEARRAY_OFCHAR);
|
||||
Gv_NewArray("numberkeys", (void *)numberkeys, sizeof(numberkeys), GAMEARRAY_READONLY|GAMEARRAY_OFCHAR);
|
||||
|
||||
g_systemArrayCount = g_gameArrayCount;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue