mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-11-10 23:02:03 +00:00
New CON commands:
* sectsetinterpolation <sector> * sectclearinterpolation <sector> * clipmove <<ret>> <<x>> <<y>> <z> <<sectnum>> <xvect> <yvect> <walldist> <floordist> <ceildist> <clipmask> * lineintersect <x1> <y1> <z1> <x2> <y2> <z2> <x3> <y3> <x4> <y4> <<intx>> <<inty>> <<intz>> <<ret>> * rayintersect <x1> <y1> <z1> <xv> <yv> <zv> <x3> <y3> <x4> <y4> <<intx>> <<inty>> <<intz>> <<ret>> * calchypotenuse <<ret>> <x> <y> (all except *interpolation also in m32script). Also fixes Sect_ClearInterpolation to be symmetrical to its Set counterpart (shouldnt change anything since it was unused). Added "-conversion YYYYMMDD" switch for keyword-compatibility with old mods. Mapster32: invisible sprite preview with Quote-i. git-svn-id: https://svn.eduke32.com/eduke32@1708 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
68801322dc
commit
91250f081c
15 changed files with 397 additions and 27 deletions
|
@ -536,6 +536,12 @@ int32_t insertspritestat(int16_t statnum);
|
|||
int32_t deletespritesect(int16_t deleteme);
|
||||
int32_t deletespritestat(int16_t deleteme);
|
||||
|
||||
int32_t lineintersect(int32_t x1, int32_t y1, int32_t z1, int32_t x2, int32_t y2, int32_t z2, int32_t x3,
|
||||
int32_t y3, int32_t x4, int32_t y4, int32_t *intx, int32_t *inty, int32_t *intz);
|
||||
|
||||
int32_t rayintersect(int32_t x1, int32_t y1, int32_t z1, int32_t vx, int32_t vy, int32_t vz, int32_t x3,
|
||||
int32_t y3, int32_t x4, int32_t y4, int32_t *intx, int32_t *inty, int32_t *intz);
|
||||
|
||||
static inline int32_t insertsprite(int16_t sectnum, int16_t statnum)
|
||||
{
|
||||
insertspritestat(statnum);
|
||||
|
|
|
@ -139,14 +139,22 @@ void test_map(int32_t mode);
|
|||
|
||||
static inline int32_t wallength(int16_t i)
|
||||
{
|
||||
int32_t dax = POINT2(i).x - wall[i].x;
|
||||
int32_t day = POINT2(i).y - wall[i].y;
|
||||
int64_t dax = POINT2(i).x - wall[i].x;
|
||||
int64_t day = POINT2(i).y - wall[i].y;
|
||||
#if 1 //def POLYMOST
|
||||
int64_t hypsq = dax*dax + day*day;
|
||||
if (hypsq > (int64_t)INT_MAX)
|
||||
return (int32_t)sqrt((double)hypsq);
|
||||
else
|
||||
return ksqrt((int32_t)hypsq);
|
||||
#else
|
||||
return ksqrt(dax*dax + day*day);
|
||||
#endif
|
||||
}
|
||||
|
||||
#define CLEARLINES2D(Startline, Numlines, Color) clearbuf((char *)(frameplace + ((Startline)*bytesperline)), (bytesperline*(Numlines))>>2, (Color))
|
||||
|
||||
#define SCRIPTHISTSIZ 32 // should be the same as OSD_HISTORYDEPTH for maximum win
|
||||
#define SCRIPTHISTSIZ 32 // should be the same as OSD_HISTORYDEPTH for maximum win, should be a power of two
|
||||
extern const char *scripthist[SCRIPTHISTSIZ];
|
||||
extern int32_t scripthistend;
|
||||
|
||||
|
|
|
@ -5357,6 +5357,12 @@ static inline int32_t lintersect(int32_t x1, int32_t y1, int32_t z1, int32_t x2,
|
|||
}
|
||||
|
||||
|
||||
int32_t lineintersect(int32_t x1, int32_t y1, int32_t z1, int32_t x2, int32_t y2, int32_t z2, int32_t x3,
|
||||
int32_t y3, int32_t x4, int32_t y4, int32_t *intx, int32_t *inty, int32_t *intz)
|
||||
{
|
||||
return lintersect(x1, y1, z1, x2, y2, z2, x3, y3, x4, y4, intx, inty, intz);
|
||||
}
|
||||
|
||||
//
|
||||
// rintersect (internal)
|
||||
//
|
||||
|
@ -5388,6 +5394,11 @@ static inline int32_t rintersect(int32_t x1, int32_t y1, int32_t z1, int32_t vx,
|
|||
return(1);
|
||||
}
|
||||
|
||||
int32_t rayintersect(int32_t x1, int32_t y1, int32_t z1, int32_t vx, int32_t vy, int32_t vz, int32_t x3,
|
||||
int32_t y3, int32_t x4, int32_t y4, int32_t *intx, int32_t *inty, int32_t *intz)
|
||||
{
|
||||
return rintersect(x1, y1, z1, vx, vy, vz, x3, y3, x4, y4, intx, inty, intz);
|
||||
}
|
||||
|
||||
//
|
||||
// keepaway (internal)
|
||||
|
|
|
@ -389,7 +389,7 @@ RIGHT smooth scrolling
|
|||
31 : Two-Way Train (SE 30)
|
||||
10+++ : One-Time Sound
|
||||
32767 : Secret Room
|
||||
65534 : End Of Level with Message
|
||||
65534 : End Of Level with Message (sector hitag: sound #)
|
||||
65535 : End Of Level
|
||||
^P
|
||||
^3SE 0/1: ROTATED SECTOR
|
||||
|
@ -546,11 +546,13 @@ RIGHT smooth scrolling
|
|||
Hi = tile #4890 Hi
|
||||
|
||||
^3^0SE 29: WAVES
|
||||
^0 (...)
|
||||
^0 Hi: start height (min. height?)
|
||||
^0 GPSPEED Lo: start height (?) (phase?)
|
||||
Hi: start height (phase)
|
||||
GPSPEED Lo: amplitude (default: 256)
|
||||
|
||||
^0 Based on MAP EDITING FAQ v1.3 BY JONAH BISHOP and code research
|
||||
^0 Based on
|
||||
^0 * MAP EDITING FAQ v1.3 BY JONAH BISHOP
|
||||
^0 * The Duke Nukem 3D Informational Suite by Ryan Lennox
|
||||
^0 * code research
|
||||
^P
|
||||
Foreground colors:
|
||||
^0,15 0 ^1,0 1 ^2 2 ^3 3 ^4 4 ^5 5 ^6 6 ^7 7
|
||||
|
|
|
@ -600,7 +600,7 @@ void A_DoGutsDir(int32_t sp, int32_t gtype, int32_t n)
|
|||
|
||||
void Sect_SetInterpolation(int32_t i)
|
||||
{
|
||||
int32_t k, j = sector[SECT].wallptr,endwall = j+sector[SECT].wallnum;
|
||||
int32_t k, j = sector[SECT].wallptr, endwall = j+sector[SECT].wallnum;
|
||||
|
||||
for (; j<endwall; j++)
|
||||
{
|
||||
|
@ -620,16 +620,20 @@ void Sect_SetInterpolation(int32_t i)
|
|||
|
||||
void Sect_ClearInterpolation(int32_t i)
|
||||
{
|
||||
int32_t j = sector[SECT].wallptr,endwall = j+sector[SECT].wallnum;
|
||||
int32_t k, j = sector[SECT].wallptr, endwall = j+sector[SECT].wallnum;
|
||||
|
||||
for (; j<endwall; j++)
|
||||
{
|
||||
G_StopInterpolation(&wall[j].x);
|
||||
G_StopInterpolation(&wall[j].y);
|
||||
if (wall[j].nextwall >= 0)
|
||||
k = wall[j].nextwall;
|
||||
if (k >= 0)
|
||||
{
|
||||
G_StopInterpolation(&wall[wall[j].nextwall].x);
|
||||
G_StopInterpolation(&wall[wall[j].nextwall].y);
|
||||
G_StopInterpolation(&wall[k].x);
|
||||
G_StopInterpolation(&wall[k].y);
|
||||
k = wall[k].point2;
|
||||
G_StopInterpolation(&wall[k].x);
|
||||
G_StopInterpolation(&wall[k].y);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3086,7 +3086,7 @@ static int32_t m32gettile(int32_t idInitialTile)
|
|||
//
|
||||
// Ensure tilenum is within valid range
|
||||
//
|
||||
iTile = clamp(iTile, 0, localartlookupnum-1);
|
||||
iTile = clamp(iTile, 0, min(MAXTILES-1, localartlookupnum+nDisplayedTiles-1));
|
||||
|
||||
|
||||
// 'S' KEYPRESS: search for named tile
|
||||
|
@ -5509,6 +5509,12 @@ static void Keys3d(void)
|
|||
// printext256(1*4,1*8,11,-1,tempbuf,0);
|
||||
}
|
||||
|
||||
if (keystatus[KEYSC_QUOTE] && PRESSED_KEYSC(I)) // ' i
|
||||
{
|
||||
showinvisibility = !showinvisibility;
|
||||
message("Invisible sprite preview %s", showinvisibility?"enabled":"disabled");
|
||||
}
|
||||
|
||||
if (keystatus[KEYSC_QUOTE] && PRESSED_KEYSC(X)) // ' x
|
||||
{
|
||||
shadepreview = !shadepreview;
|
||||
|
@ -7887,12 +7893,28 @@ static int32_t osdcmd_do(const osdfuncparm_t *parm)
|
|||
|
||||
if (!(vm.flags&VMFLAG_ERROR))
|
||||
{
|
||||
if (scripthist[scripthistend])
|
||||
Bfree((void *)scripthist[scripthistend]);
|
||||
int32_t idx, dosave=1;
|
||||
|
||||
scripthist[scripthistend] = Bstrdup(parm->raw);
|
||||
scripthistend++;
|
||||
scripthistend %= SCRIPTHISTSIZ;
|
||||
for (i=1; i<=4; i++)
|
||||
{
|
||||
idx = (scripthistend-i)&(SCRIPTHISTSIZ-1);
|
||||
if (!scripthist[idx])
|
||||
break;
|
||||
else if (!Bstrcmp(scripthist[idx], parm->raw))
|
||||
{
|
||||
dosave = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (dosave)
|
||||
{
|
||||
if (scripthist[scripthistend])
|
||||
Bfree((void *)scripthist[scripthistend]);
|
||||
scripthist[scripthistend] = Bstrdup(parm->raw);
|
||||
scripthistend++;
|
||||
scripthistend %= SCRIPTHISTSIZ;
|
||||
}
|
||||
}
|
||||
// asksave = 1; // handled in Access(Sprite|Sector|Wall)
|
||||
}
|
||||
|
@ -8124,7 +8146,6 @@ void GAME_clearbackground(int32_t numcols, int32_t numrows)
|
|||
CLEARLINES2D(0, min(ydim, numrows*8+8), editorcolors[16]);
|
||||
}
|
||||
|
||||
|
||||
static void m32_osdsetfunctions()
|
||||
{
|
||||
OSD_SetFunctions(
|
||||
|
@ -8140,6 +8161,7 @@ static void m32_osdsetfunctions()
|
|||
);
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
enum
|
||||
|
@ -9015,7 +9037,7 @@ int32_t ExtInit(void)
|
|||
Bstrcpy(apptitle, "Mapster32"VERSION BUILDDATE);
|
||||
autosavetimer = totalclock+120*autosave;
|
||||
|
||||
#if defined(_WIN32) && defined(DUKEOSD)
|
||||
#if defined(DUKEOSD)
|
||||
m32_osdsetfunctions();
|
||||
#endif
|
||||
|
||||
|
@ -9457,6 +9479,13 @@ void ExtAnalyzeSprites(void)
|
|||
tspr->xrepeat=0;
|
||||
}
|
||||
|
||||
if (showinvisibility && (tspr->cstat&32768))
|
||||
{
|
||||
tspr->pal = 6;
|
||||
tspr->cstat &= ~32768;
|
||||
tspr->cstat |= 2+512;
|
||||
}
|
||||
|
||||
if (shadepreview && !(tspr->cstat & 16))
|
||||
{
|
||||
if (sector[tspr->sectnum].ceilingstat&1)
|
||||
|
@ -9700,7 +9729,7 @@ static void Keys2d3d(void)
|
|||
{
|
||||
getmessageleng = 0;
|
||||
getmessagetimeoff = 0;
|
||||
#if defined(_WIN32) && defined(DUKEOSD)
|
||||
#if defined(DUKEOSD)
|
||||
m32_osdsetfunctions();
|
||||
#endif
|
||||
}
|
||||
|
@ -10546,7 +10575,7 @@ static void EditSpriteData(int16_t spritenum)
|
|||
if (editval)
|
||||
{
|
||||
printmessage16(edittext);
|
||||
sprite[spritenum].owner = getnumber16(edittext,(int32_t)sprite[spritenum].owner,MAXSPRITES,0);
|
||||
sprite[spritenum].owner = getnumber16(edittext,(int32_t)sprite[spritenum].owner,MAXSPRITES,1);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
|
|
@ -7733,6 +7733,7 @@ static void G_ShowDebugHelp(void)
|
|||
"-ns/-nm\t\tDisable sound or music\n"
|
||||
"-q#\t\tFake multiplayer with # (2-8) players\n"
|
||||
"-z#/-condebug\tEnable line-by-line CON compile debugging at level #\n"
|
||||
"-conversion YYYYMMDD\tSelects CON script version for compatibility with older mods\n"
|
||||
;
|
||||
#if defined RENDERTYPEWIN
|
||||
Bsnprintf(tempbuf, sizeof(tempbuf), HEAD2 " %s", s_buildDate);
|
||||
|
@ -8321,6 +8322,23 @@ static void G_CheckCommandLine(int32_t argc, const char **argv)
|
|||
i++;
|
||||
continue;
|
||||
}
|
||||
if (!Bstrcasecmp(c+1, "conversion"))
|
||||
{
|
||||
if (argc > i+1)
|
||||
{
|
||||
uint32_t j = atol((char *)argv[i+1]);
|
||||
if (j>=10000000 && j<=99999999)
|
||||
{
|
||||
g_scriptDateVersion = j;
|
||||
initprintf("CON script date version: %d\n",j);
|
||||
}
|
||||
else
|
||||
initprintf("CON script date version must be specified as YYYYMMDD, ignoring.\n");
|
||||
i++;
|
||||
}
|
||||
i++;
|
||||
continue;
|
||||
}
|
||||
if (!Bstrcasecmp(c+1,"nologo"))
|
||||
{
|
||||
g_noLogo = 1;
|
||||
|
|
|
@ -32,7 +32,55 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
#include <shellapi.h>
|
||||
#endif
|
||||
|
||||
#define NUMKEYWORDS (int32_t)(sizeof(keyw)/sizeof(keyw[0]))
|
||||
|
||||
int32_t g_scriptVersion = 13; // 13 = 1.3D-style CON files, 14 = 1.4/1.5 style CON files
|
||||
uint32_t g_scriptDateVersion = 99999999; // YYYYMMDD
|
||||
static uint32_t g_scriptLastKeyword; // = NUMKEYWORDS-1;
|
||||
|
||||
#define NUMKEYWDATES (int32_t)(sizeof(g_keywdate)/sizeof(g_keywdate[0]))
|
||||
// { keyw, date } means that at the date, all keywords up to keyw inclusive are available
|
||||
static struct { uint32_t keyw; uint32_t date; } g_keywdate[] =
|
||||
{
|
||||
// beginning of eduke32 svn
|
||||
{ CON_CANSEE, 20060423 },
|
||||
{ CON_CANSEESPR, 20060424 },
|
||||
// some stuff here not representable this way
|
||||
{ CON_FINDNEARSPRITEZVAR, 20060516 },
|
||||
{ CON_EZSHOOT, 20060701 },
|
||||
{ CON_EZSHOOTVAR, 20060822 },
|
||||
{ CON_JUMP, 20060828 },
|
||||
{ CON_QSTRLEN, 20060930 },
|
||||
{ CON_QUAKE, 20070105 },
|
||||
{ CON_SHOWVIEW, 20070208 },
|
||||
{ CON_NEXTSPRITESECT, 20070819 },
|
||||
{ CON_GETKEYNAME, 20071024 }, // keyw numbers have been
|
||||
{ CON_SPRITENOPAL, 20071220 }, // shuffled around here
|
||||
{ CON_HITRADIUSVAR, 20080216 },
|
||||
{ CON_ROTATESPRITE16, 20080314 },
|
||||
{ CON_SETARRAY, 20080401 },
|
||||
{ CON_READARRAYFROMFILE, 20080405 },
|
||||
{ CON_STARTTRACKVAR, 20080510 },
|
||||
{ CON_QGETSYSSTR, 20080709 },
|
||||
{ CON_GETTICKS, 20080711 },
|
||||
{ CON_SETTSPR, 20080713 },
|
||||
{ CON_CLEARMAPSTATE, 20080716 },
|
||||
{ CON_SCRIPTSIZE, 20080720 },
|
||||
{ CON_SETGAMENAME, 20080722 },
|
||||
{ CON_CMENU, 20080725 },
|
||||
{ CON_GETTIMEDATE, 20080809 },
|
||||
{ CON_ACTIVATECHEAT, 20080810 },
|
||||
{ CON_SETGAMEPALETTE, 20080816 },
|
||||
{ CON_SETCFGNAME, 20080817 },
|
||||
{ CON_IFVARVAREITHER, 20080907 },
|
||||
{ CON_SAVENN, 20080915 },
|
||||
{ CON_COPY, 20090219 },
|
||||
// { CON_INV, 20090619 },
|
||||
{ CON_QSTRNCAT, 20090712 },
|
||||
{ CON_STOPACTORSOUND, 20090715 },
|
||||
{ CON_IFSERVER, 20100722 },
|
||||
{ CON_CALCHYPOTENUSE, 20100927 },
|
||||
};
|
||||
|
||||
char g_szScriptFileName[BMAX_PATH] = "(none)"; // file we're currently compiling
|
||||
static char g_szCurrentBlockName[256] = "(none)", g_szLastBlockName[256] = "NULL";
|
||||
|
@ -146,7 +194,6 @@ static const char *C_GetLabelType(int32_t type)
|
|||
return Bstrdup(x);
|
||||
}
|
||||
|
||||
#define NUMKEYWORDS (int32_t)(sizeof(keyw)/sizeof(keyw[0]))
|
||||
|
||||
const char *keyw[] =
|
||||
{
|
||||
|
@ -503,6 +550,12 @@ const char *keyw[] =
|
|||
"stopactorsound", // 350
|
||||
"ifclient", // 351
|
||||
"ifserver", // 352
|
||||
"sectsetinterpolation", // 353
|
||||
"sectclearinterpolation", // 354
|
||||
"clipmove", // 355
|
||||
"lineintersect", // 356
|
||||
"rayintersect", // 357
|
||||
"calchypotenuse", // 358
|
||||
"<null>"
|
||||
};
|
||||
|
||||
|
@ -997,7 +1050,24 @@ void C_InitHashes()
|
|||
hash_init(&actorH);
|
||||
hash_init(&tspriteH);
|
||||
|
||||
for (i=NUMKEYWORDS-1; i>=0; i--) hash_add(&h_keywords,keyw[i],i,0);
|
||||
g_scriptLastKeyword = NUMKEYWORDS-1;
|
||||
// determine last CON keyword for backward compatibility with older mods
|
||||
if (g_scriptDateVersion < g_keywdate[NUMKEYWDATES-1].date)
|
||||
{
|
||||
for (i=NUMKEYWDATES-1; i>=0; i--)
|
||||
{
|
||||
if (g_scriptDateVersion >= g_keywdate[i].date)
|
||||
{
|
||||
g_scriptLastKeyword = g_keywdate[i].keyw;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (i<0)
|
||||
g_scriptLastKeyword = g_keywdate[0].keyw-1; // may be slightly imprecise
|
||||
}
|
||||
|
||||
for (i=g_scriptLastKeyword; i>=0; i--) hash_add(&h_keywords,keyw[i],i,0);
|
||||
for (i=0; SectorLabels[i].lId >= 0; i++) hash_add(§orH,SectorLabels[i].name,i,0);
|
||||
for (i=0; WallLabels[i].lId >= 0; i++) hash_add(&wallH,WallLabels[i].name,i,0);
|
||||
for (i=0; UserdefsLabels[i].lId >= 0; i++) hash_add(&userdefH,UserdefsLabels[i].name,i,0);
|
||||
|
@ -4397,6 +4467,32 @@ static int32_t C_ParseCommand(void)
|
|||
C_GetManyVars(2);
|
||||
break;
|
||||
|
||||
case CON_SECTSETINTERPOLATION:
|
||||
case CON_SECTCLEARINTERPOLATION:
|
||||
C_GetNextVar();
|
||||
break;
|
||||
|
||||
case CON_CLIPMOVE:
|
||||
// <retvar>,<x>,<y>,z,<sectnum>, xvect,yvect,walldist,floordist,ceildist,clipmask
|
||||
C_GetManyVarsType(GAMEVAR_READONLY,3);
|
||||
C_GetNextVar();
|
||||
C_GetNextVarType(GAMEVAR_READONLY);
|
||||
C_GetManyVars(6);
|
||||
break;
|
||||
|
||||
case CON_CALCHYPOTENUSE:
|
||||
C_GetNextVarType(GAMEVAR_READONLY);
|
||||
C_GetManyVars(2);
|
||||
break;
|
||||
|
||||
case CON_LINEINTERSECT:
|
||||
case CON_RAYINTERSECT:
|
||||
// lineintersect x y z x y z x y x y <intx> <inty> <intz> <ret>
|
||||
// rayintersect x y z vx vy vz x y x y <intx> <inty> <intz> <ret>
|
||||
C_GetManyVars(10);
|
||||
C_GetManyVarsType(GAMEVAR_READONLY,4);
|
||||
break;
|
||||
|
||||
case CON_HITSCAN:
|
||||
case CON_CANSEE:
|
||||
// get the ID of the DEF
|
||||
|
|
|
@ -69,6 +69,7 @@ extern char g_szScriptFileName[BMAX_PATH];
|
|||
extern int32_t g_totalLines,g_lineNumber;
|
||||
extern int32_t g_numCompilerErrors,g_numCompilerWarnings,g_numQuoteRedefinitions;
|
||||
extern int32_t g_scriptVersion;
|
||||
extern uint32_t g_scriptDateVersion; // YYYYMMDD
|
||||
extern char g_szBuf[1024];
|
||||
|
||||
extern intptr_t *g_scriptPtr;
|
||||
|
@ -925,6 +926,12 @@ enum ScriptKeywords_t
|
|||
CON_STOPACTORSOUND, // 350
|
||||
CON_IFCLIENT, // 351
|
||||
CON_IFSERVER, // 352
|
||||
CON_SECTSETINTERPOLATION, // 353
|
||||
CON_SECTCLEARINTERPOLATION, // 354
|
||||
CON_CLIPMOVE, // 355
|
||||
CON_LINEINTERSECT, // 356
|
||||
CON_RAYINTERSECT, // 357
|
||||
CON_CALCHYPOTENUSE, // 358
|
||||
CON_END
|
||||
};
|
||||
#endif
|
||||
|
|
|
@ -2479,6 +2479,100 @@ nullquote:
|
|||
continue;
|
||||
}
|
||||
|
||||
case CON_SECTSETINTERPOLATION:
|
||||
case CON_SECTCLEARINTERPOLATION:
|
||||
insptr++;
|
||||
{
|
||||
int32_t sectnum = Gv_GetVarX(*insptr++), osectnum;
|
||||
|
||||
if ((sectnum<0 || sectnum>=numsectors))
|
||||
{
|
||||
OSD_Printf(CON_ERROR "Invalid sector %d\n",g_errorLineNum,keyw[g_tw],sectnum);
|
||||
continue;
|
||||
}
|
||||
|
||||
osectnum = sprite[MAXSPRITES-1].sectnum;
|
||||
sprite[MAXSPRITES-1].sectnum = sectnum;
|
||||
if (tw==CON_SECTSETINTERPOLATION)
|
||||
Sect_SetInterpolation(MAXSPRITES-1);
|
||||
else
|
||||
Sect_ClearInterpolation(MAXSPRITES-1);
|
||||
sprite[MAXSPRITES-1].sectnum = osectnum;
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
case CON_CALCHYPOTENUSE:
|
||||
insptr++;
|
||||
{
|
||||
int32_t retvar=*insptr++;
|
||||
int64_t dax=Gv_GetVarX(*insptr++), day=Gv_GetVarX(*insptr++);
|
||||
int64_t hypsq = dax*dax + day*day;
|
||||
|
||||
if (hypsq > (int64_t)INT_MAX)
|
||||
Gv_SetVarX(retvar, (int32_t)sqrt((double)hypsq));
|
||||
else
|
||||
Gv_SetVarX(retvar, ksqrt((int32_t)hypsq));
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
case CON_LINEINTERSECT:
|
||||
case CON_RAYINTERSECT:
|
||||
insptr++;
|
||||
{
|
||||
int32_t x1=Gv_GetVarX(*insptr++), y1=Gv_GetVarX(*insptr++), z1=Gv_GetVarX(*insptr++);
|
||||
int32_t x2=Gv_GetVarX(*insptr++), y2=Gv_GetVarX(*insptr++), z2=Gv_GetVarX(*insptr++);
|
||||
int32_t x3=Gv_GetVarX(*insptr++), y3=Gv_GetVarX(*insptr++), x4=Gv_GetVarX(*insptr++), y4=Gv_GetVarX(*insptr++);
|
||||
int32_t intxvar=*insptr++, intyvar=*insptr++, intzvar=*insptr++, retvar=*insptr++;
|
||||
int32_t intx, inty, intz, ret;
|
||||
|
||||
if (tw==CON_LINEINTERSECT)
|
||||
ret = lineintersect(x1, y1, z1, x2, y2, z2, x3, y3, x4, y4, &intx, &inty, &intz);
|
||||
else
|
||||
ret = rayintersect(x1, y1, z1, x2, y2, z2, x3, y3, x4, y4, &intx, &inty, &intz);
|
||||
|
||||
Gv_SetVarX(retvar, ret);
|
||||
if (ret)
|
||||
{
|
||||
Gv_SetVarX(intxvar, intx);
|
||||
Gv_SetVarX(intyvar, inty);
|
||||
Gv_SetVarX(intzvar, intz);
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
case CON_CLIPMOVE:
|
||||
insptr++;
|
||||
{
|
||||
vec3_t vect;
|
||||
int32_t retvar=*insptr++, xvar=*insptr++, yvar=*insptr++, z=Gv_GetVarX(*insptr++), sectnumvar=*insptr++;
|
||||
int32_t xvect=Gv_GetVarX(*insptr++), yvect=Gv_GetVarX(*insptr++);
|
||||
int32_t walldist=Gv_GetVarX(*insptr++), floordist=Gv_GetVarX(*insptr++), ceildist=Gv_GetVarX(*insptr++);
|
||||
int32_t clipmask=Gv_GetVarX(*insptr++);
|
||||
int16_t sectnum;
|
||||
|
||||
vect.x = Gv_GetVarX(xvar);
|
||||
vect.y = Gv_GetVarX(yvar);
|
||||
vect.z = z;
|
||||
sectnum = Gv_GetVarX(sectnumvar);
|
||||
|
||||
if ((sectnum<0 || sectnum>=numsectors))
|
||||
{
|
||||
OSD_Printf(CON_ERROR "Invalid sector %d\n",g_errorLineNum,keyw[g_tw],sectnum);
|
||||
Gv_SetVarX(retvar, 0);
|
||||
continue;
|
||||
}
|
||||
|
||||
Gv_SetVarX(retvar, clipmove(&vect, §num, xvect, yvect, walldist, floordist, ceildist, clipmask));
|
||||
Gv_SetVarX(sectnumvar, sectnum);
|
||||
Gv_SetVarX(xvar, vect.x);
|
||||
Gv_SetVarX(yvar, vect.y);
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
case CON_HITSCAN:
|
||||
insptr++;
|
||||
{
|
||||
|
|
|
@ -189,4 +189,4 @@ char setupfilename[BMAX_PATH]= SETUPFILENAME;
|
|||
int32_t g_doQuickSave = 0;
|
||||
uint32_t g_moveThingsCount = 0;
|
||||
|
||||
int32_t g_restorePalette = 0, g_screenCapture = 0, g_noEnemies = 0;
|
||||
int32_t g_restorePalette = 0, g_screenCapture = 0, g_noEnemies = 0;
|
||||
|
|
|
@ -244,6 +244,7 @@ const char *keyw[] =
|
|||
"divscale",
|
||||
"dist",
|
||||
"ldist",
|
||||
"calchypotenuse",
|
||||
"getangle",
|
||||
"getincangle",
|
||||
"a2xy",
|
||||
|
@ -316,6 +317,9 @@ const char *keyw[] =
|
|||
"updatesector",
|
||||
"updatesectorz",
|
||||
"getzrange",
|
||||
"clipmove",
|
||||
"lineintersect",
|
||||
"rayintersect",
|
||||
"hitscan",
|
||||
"cansee",
|
||||
"canseespr",
|
||||
|
@ -3018,6 +3022,27 @@ repeatcase:
|
|||
C_GetManyVars(2);
|
||||
break;
|
||||
|
||||
case CON_CALCHYPOTENUSE:
|
||||
C_GetNextVarType(GAMEVAR_READONLY);
|
||||
C_GetManyVars(2);
|
||||
break;
|
||||
|
||||
case CON_CLIPMOVE:
|
||||
// <retvar>,<x>,<y>,z,<sectnum>, xvect,yvect,walldist,floordist,ceildist,clipmask
|
||||
C_GetManyVarsType(GAMEVAR_READONLY,3);
|
||||
C_GetNextVar();
|
||||
C_GetNextVarType(GAMEVAR_READONLY);
|
||||
C_GetManyVars(6);
|
||||
break;
|
||||
|
||||
case CON_LINEINTERSECT:
|
||||
case CON_RAYINTERSECT:
|
||||
// lineintersect x y z x y z x y x y <intx> <inty> <intz> <ret>
|
||||
// rayintersect x y z vx vy vz x y x y <intx> <inty> <intz> <ret>
|
||||
C_GetManyVars(10);
|
||||
C_GetManyVarsType(GAMEVAR_READONLY,4);
|
||||
break;
|
||||
|
||||
case CON_HITSCAN:
|
||||
case CON_CANSEE:
|
||||
// get the ID of the DEF
|
||||
|
|
|
@ -330,6 +330,7 @@ enum ScriptKeywords_t
|
|||
CON_DIVSCALE,
|
||||
CON_DIST,
|
||||
CON_LDIST,
|
||||
CON_CALCHYPOTENUSE,
|
||||
CON_GETANGLE,
|
||||
CON_GETINCANGLE,
|
||||
CON_A2XY,
|
||||
|
@ -414,6 +415,9 @@ enum ScriptKeywords_t
|
|||
CON_UPDATESECTOR,
|
||||
CON_UPDATESECTORZ,
|
||||
CON_GETZRANGE,
|
||||
CON_CLIPMOVE,
|
||||
CON_LINEINTERSECT,
|
||||
CON_RAYINTERSECT,
|
||||
CON_HITSCAN,
|
||||
CON_CANSEE,
|
||||
CON_CANSEESPR,
|
||||
|
|
|
@ -1741,6 +1741,72 @@ badindex:
|
|||
continue;
|
||||
}
|
||||
|
||||
case CON_CALCHYPOTENUSE:
|
||||
insptr++;
|
||||
{
|
||||
int32_t retvar=*insptr++;
|
||||
int64_t dax=Gv_GetVarX(*insptr++), day=Gv_GetVarX(*insptr++);
|
||||
int64_t hypsq = dax*dax + day*day;
|
||||
|
||||
if (hypsq > (int64_t)INT_MAX)
|
||||
Gv_SetVarX(retvar, (int32_t)sqrt((double)hypsq));
|
||||
else
|
||||
Gv_SetVarX(retvar, ksqrt((int32_t)hypsq));
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
case CON_LINEINTERSECT:
|
||||
case CON_RAYINTERSECT:
|
||||
insptr++;
|
||||
{
|
||||
int32_t x1=Gv_GetVarX(*insptr++), y1=Gv_GetVarX(*insptr++), z1=Gv_GetVarX(*insptr++);
|
||||
int32_t x2=Gv_GetVarX(*insptr++), y2=Gv_GetVarX(*insptr++), z2=Gv_GetVarX(*insptr++);
|
||||
int32_t x3=Gv_GetVarX(*insptr++), y3=Gv_GetVarX(*insptr++), x4=Gv_GetVarX(*insptr++), y4=Gv_GetVarX(*insptr++);
|
||||
int32_t intxvar=*insptr++, intyvar=*insptr++, intzvar=*insptr++, retvar=*insptr++;
|
||||
int32_t intx, inty, intz, ret;
|
||||
|
||||
if (tw==CON_LINEINTERSECT)
|
||||
ret = lineintersect(x1, y1, z1, x2, y2, z2, x3, y3, x4, y4, &intx, &inty, &intz);
|
||||
else
|
||||
ret = rayintersect(x1, y1, z1, x2, y2, z2, x3, y3, x4, y4, &intx, &inty, &intz);
|
||||
|
||||
Gv_SetVarX(retvar, ret);
|
||||
if (ret)
|
||||
{
|
||||
Gv_SetVarX(intxvar, intx);
|
||||
Gv_SetVarX(intyvar, inty);
|
||||
Gv_SetVarX(intzvar, intz);
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
case CON_CLIPMOVE:
|
||||
insptr++;
|
||||
{
|
||||
vec3_t vect;
|
||||
int32_t retvar=*insptr++, xvar=*insptr++, yvar=*insptr++, z=Gv_GetVarX(*insptr++), sectnumvar=*insptr++;
|
||||
int32_t xvect=Gv_GetVarX(*insptr++), yvect=Gv_GetVarX(*insptr++);
|
||||
int32_t walldist=Gv_GetVarX(*insptr++), floordist=Gv_GetVarX(*insptr++), ceildist=Gv_GetVarX(*insptr++);
|
||||
int32_t clipmask=Gv_GetVarX(*insptr++);
|
||||
int16_t sectnum;
|
||||
|
||||
vect.x = Gv_GetVarX(xvar);
|
||||
vect.y = Gv_GetVarX(yvar);
|
||||
vect.z = z;
|
||||
sectnum = Gv_GetVarX(sectnumvar);
|
||||
|
||||
X_ERROR_INVALIDSECT(sectnum);
|
||||
|
||||
Gv_SetVarX(retvar, clipmove(&vect, §num, xvect, yvect, walldist, floordist, ceildist, clipmask));
|
||||
Gv_SetVarX(sectnumvar, sectnum);
|
||||
Gv_SetVarX(xvar, vect.x);
|
||||
Gv_SetVarX(yvar, vect.y);
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
case CON_HITSCAN:
|
||||
insptr++;
|
||||
{
|
||||
|
|
|
@ -136,7 +136,7 @@ int32_t MUSIC_Init(int32_t SoundCard, int32_t Address)
|
|||
|
||||
if (external_midi)
|
||||
{
|
||||
initprintf("Setting music command to `%s'.\n", command);
|
||||
initprintf("Setting music command to \"%s\".\n", command);
|
||||
|
||||
#if defined _WIN32
|
||||
if (Mix_SetMusicCMD(command)==-1)
|
||||
|
|
Loading…
Reference in a new issue