2006-04-23 06:44:19 +00:00
/*
* Definitions file parser for Build
2012-03-12 04:47:04 +00:00
* by Jonathon Fowler ( jf @ jonof . id . au )
2006-04-23 06:44:19 +00:00
* Remixed substantially by Ken Silverman
* See the included license file " BUILDLIC.TXT " for license info .
*/
# include "build.h"
# include "compat.h"
2011-01-27 07:05:12 +00:00
# include "engine_priv.h"
2006-04-23 06:44:19 +00:00
# include "baselayer.h"
# include "scriptfile.h"
2006-04-13 20:47:06 +00:00
# include "cache1d.h"
2012-03-28 19:41:39 +00:00
# include "common.h"
2013-02-07 21:01:24 +00:00
# include "mdsprite.h" // md3model_t
2015-09-27 21:17:59 +00:00
# include "colmatch.h"
2019-10-05 20:32:32 +00:00
# include "textures.h"
2019-10-05 21:44:28 +00:00
# include "bitmap.h"
2019-11-01 18:25:42 +00:00
# include "m_argv.h"
# include "gamecontrol.h"
2006-04-13 20:47:06 +00:00
2015-03-28 09:49:11 +00:00
# ifdef USE_OPENGL
# include "hightile.h"
# endif
2010-08-02 08:13:51 +00:00
enum scripttoken_t
2007-12-12 17:42:14 +00:00
{
2006-04-24 19:04:22 +00:00
T_INCLUDE = 0 ,
T_DEFINE ,
T_DEFINETEXTURE ,
T_DEFINESKYBOX ,
T_DEFINETINT ,
T_DEFINEMODEL ,
T_DEFINEMODELFRAME ,
T_DEFINEMODELANIM ,
T_DEFINEMODELSKIN ,
T_SELECTMODELSKIN ,
T_DEFINEVOXEL ,
T_DEFINEVOXELTILES ,
T_MODEL ,
T_FILE ,
T_SCALE ,
T_SHADE ,
T_FRAME ,
2007-04-12 03:09:41 +00:00
T_SMOOTHDURATION ,
2006-04-24 19:04:22 +00:00
T_ANIM ,
T_SKIN ,
T_SURF ,
T_TILE ,
T_TILE0 ,
T_TILE1 ,
T_FRAME0 ,
T_FRAME1 ,
T_FPS ,
T_FLAGS ,
T_PAL ,
2011-01-27 07:05:12 +00:00
T_BASEPAL ,
2007-01-15 09:08:57 +00:00
T_DETAIL ,
2007-02-15 01:35:34 +00:00
T_GLOW ,
2009-04-28 22:56:43 +00:00
T_SPECULAR ,
T_NORMAL ,
2007-02-16 01:34:41 +00:00
T_PARAM ,
2006-04-24 19:04:22 +00:00
T_HUD ,
T_XADD ,
T_YADD ,
T_ZADD ,
T_ANGADD ,
2011-03-01 05:52:33 +00:00
T_FOV ,
2006-04-24 19:04:22 +00:00
T_FLIPPED ,
T_HIDE ,
T_NOBOB ,
T_NODEPTH ,
T_VOXEL ,
T_SKYBOX ,
T_FRONT , T_RIGHT , T_BACK , T_LEFT , T_TOP , T_BOTTOM ,
2010-12-30 08:13:37 +00:00
T_HIGHPALOOKUP ,
DEF command 'makepalookup', allowing indpt. specification of fog and color remapping.
The syntax is as follows:
makepalookup { <token-list...> }
where valid tokens are
* pal <palnum>: the palette number, 1 .. 250
* red <num>, green, blue (or r, g, b): the fog color components on a 0 to 63 scale.
Components that are not present are assumed to be 0.
* remappal <palnum>: the palette number to take the index remapping from, i.e. 21
for blue -> red. When absent, defaults to 0.
* remapself: when present, specifies that the remappal is the same as the 'pal'.
This is to prevent textual redundancy when overwriting existing palookups.
Examples (best tested with tile #251):
1) makepalookup { pal 200 red 30 remappal 23 }
This creates palookup 200 with a fog of (30,0,0) and a blue-to-yellow remapping
(assuming it has not been changed before)
2) makepalookup { pal 21 red 30 remapself }
This 'fogifies' palookup 21 with a red fog.
3) makepalookup { pal 21 red 30 }
This overwrites palookup 21 with a red fog, but clears the blue-to-red remapping.
The fog aspect of this command affects the GL modes just like 'fogpal', but the
remapping has no effect for hightiles.
- Also, silently clamp 'fogpal' r,g,b values to the range 0 .. 63.
git-svn-id: https://svn.eduke32.com/eduke32@2568 1a8010ca-5511-0410-912e-c29ae57300e0
2012-03-29 21:16:41 +00:00
T_TINT ,
T_MAKEPALOOKUP , T_REMAPPAL , T_REMAPSELF ,
2015-09-23 17:55:19 +00:00
T_NOFLOORPAL , T_FLOORPAL ,
DEF command 'makepalookup', allowing indpt. specification of fog and color remapping.
The syntax is as follows:
makepalookup { <token-list...> }
where valid tokens are
* pal <palnum>: the palette number, 1 .. 250
* red <num>, green, blue (or r, g, b): the fog color components on a 0 to 63 scale.
Components that are not present are assumed to be 0.
* remappal <palnum>: the palette number to take the index remapping from, i.e. 21
for blue -> red. When absent, defaults to 0.
* remapself: when present, specifies that the remappal is the same as the 'pal'.
This is to prevent textual redundancy when overwriting existing palookups.
Examples (best tested with tile #251):
1) makepalookup { pal 200 red 30 remappal 23 }
This creates palookup 200 with a fog of (30,0,0) and a blue-to-yellow remapping
(assuming it has not been changed before)
2) makepalookup { pal 21 red 30 remapself }
This 'fogifies' palookup 21 with a red fog.
3) makepalookup { pal 21 red 30 }
This overwrites palookup 21 with a red fog, but clears the blue-to-red remapping.
The fog aspect of this command affects the GL modes just like 'fogpal', but the
remapping has no effect for hightiles.
- Also, silently clamp 'fogpal' r,g,b values to the range 0 .. 63.
git-svn-id: https://svn.eduke32.com/eduke32@2568 1a8010ca-5511-0410-912e-c29ae57300e0
2012-03-29 21:16:41 +00:00
T_RED , T_GREEN , T_BLUE ,
2009-03-28 12:14:37 +00:00
T_TEXTURE , T_ALPHACUT , T_XSCALE , T_YSCALE , T_SPECPOWER , T_SPECFACTOR , T_NOCOMPRESS , T_NODOWNSIZE ,
2015-03-28 09:49:37 +00:00
T_FORCEFILTER ,
2016-05-02 18:29:35 +00:00
T_ARTQUALITY ,
2013-09-14 17:58:46 +00:00
T_ORIGSIZEX , T_ORIGSIZEY ,
2006-04-24 19:04:22 +00:00
T_UNDEFMODEL , T_UNDEFMODELRANGE , T_UNDEFMODELOF , T_UNDEFTEXTURE , T_UNDEFTEXTURERANGE ,
T_ALPHAHACK , T_ALPHAHACKRANGE ,
2015-11-14 23:40:57 +00:00
T_SPRITECOL , T_2DCOL , T_2DCOLIDXRANGE ,
2006-04-24 19:04:22 +00:00
T_FOGPAL ,
T_LOADGRP ,
2006-07-20 01:50:56 +00:00
T_DUMMYTILE , T_DUMMYTILERANGE ,
2008-03-27 21:32:23 +00:00
T_SETUPTILE , T_SETUPTILERANGE ,
2015-04-09 07:52:28 +00:00
T_UNDEFINETILE , T_UNDEFINETILERANGE ,
2008-08-02 13:00:41 +00:00
T_ANIMTILERANGE ,
2007-12-20 19:14:38 +00:00
T_CACHESIZE ,
2008-11-24 09:22:07 +00:00
T_IMPORTTILE ,
2007-12-20 19:14:38 +00:00
T_MUSIC , T_ID , T_SOUND ,
2012-11-25 13:19:06 +00:00
T_TILEFROMTEXTURE , T_XOFFSET , T_YOFFSET , T_TEXHITSCAN , T_NOFULLBRIGHT ,
2015-05-03 07:05:35 +00:00
T_ARTFILE ,
Possibility of specifying sounds for a VPX anim-replacement via DEF.
The syntax is as follows:
animsounds <anim> { frame1 sound1 frame2 sound2 ... }
<anim> has to be one of the tokens: cineov2, cineov3, RADLOGO, DUKETEAM,
logo, vol41a, vol42a, vol4e1, vol43a, vol4e2, or vol4e3, corresponding
to hard-coded Duke3D anims.
The frameN's (1-based frame numbers) have to be in ascending order (but not
necessarily strictly ascending, so that a frame may have more than one sound).
Example: for Duke3D's XBLA nuke logo animation (IVF extracted from nuke.webm),
the following definition overlays the video with a sound sequence similar
(identical save for timing) to the original nuke animation:
// frame 1: FLY_BY, frame 64: PIPEBOMB_EXPLODE
animsounds logo { 1 244 64 14 }
git-svn-id: https://svn.eduke32.com/eduke32@2242 1a8010ca-5511-0410-912e-c29ae57300e0
2012-01-10 23:43:54 +00:00
T_INCLUDEDEFAULT ,
T_ANIMSOUNDS ,
2015-02-11 05:22:07 +00:00
T_CUTSCENE ,
2012-04-04 18:57:58 +00:00
T_NOFLOORPALRANGE ,
2012-10-14 20:41:34 +00:00
T_TEXHITSCANRANGE ,
2012-11-25 13:19:06 +00:00
T_NOFULLBRIGHTRANGE ,
2012-12-23 03:12:50 +00:00
T_MAPINFO , T_MAPFILE , T_MAPTITLE , T_MAPMD4 , T_MHKFILE ,
2012-03-10 09:44:17 +00:00
T_ECHO ,
2015-03-09 20:32:36 +00:00
T_GLOBALFLAGS ,
2015-04-12 08:07:30 +00:00
T_COPYTILE ,
2015-04-24 00:08:46 +00:00
T_GLOBALGAMEFLAGS ,
2015-05-27 08:47:50 +00:00
T_MULTIPSKY , T_HORIZFRAC , T_LOGNUMTILES ,
2015-09-23 17:55:19 +00:00
T_BASEPALETTE , T_PALOOKUP , T_BLENDTABLE ,
T_RAW , T_OFFSET , T_SHIFTLEFT , T_NOSHADES , T_COPY ,
2015-09-27 21:18:24 +00:00
T_NUMALPHATABS ,
2015-10-03 11:52:51 +00:00
T_UNDEF ,
T_UNDEFBASEPALETTERANGE , T_UNDEFPALOOKUPRANGE , T_UNDEFBLENDTABLERANGE ,
2016-10-09 07:55:23 +00:00
T_GLBLEND , T_FORWARD , T_REVERSE , T_BOTH , T_SRC , T_DST , T_ALPHA ,
T_ZERO , T_ONE ,
T_SRC_COLOR , T_ONE_MINUS_SRC_COLOR ,
T_SRC_ALPHA , T_ONE_MINUS_SRC_ALPHA ,
T_DST_ALPHA , T_ONE_MINUS_DST_ALPHA ,
T_DST_COLOR , T_ONE_MINUS_DST_COLOR ,
2017-12-12 05:13:58 +00:00
T_SHADERED , T_SHADEGREEN , T_SHADEBLUE ,
2018-01-26 04:35:15 +00:00
T_SHADEFACTOR ,
2019-03-02 23:21:37 +00:00
T_IFCRC ,
2019-08-09 08:21:19 +00:00
T_NEWGAMECHOICES ,
2019-09-17 05:07:28 +00:00
T_RFFDEFINEID ,
T_EXTRA ,
T_ROTATE ,
2006-04-23 06:44:19 +00:00
} ;
2009-01-09 09:29:17 +00:00
static int32_t lastmodelid = - 1 , lastvoxid = - 1 , modelskin = - 1 , lastmodelskin = - 1 , seenframe = 0 ;
2013-12-28 17:04:22 +00:00
static int32_t nextvoxid = 0 ;
2014-09-30 04:17:53 +00:00
static char * faketilebuffer = NULL ;
static int32_t faketilebuffersiz = 0 ;
2006-04-13 20:47:06 +00:00
2007-12-12 17:42:14 +00:00
static const char * skyfaces [ 6 ] =
{
" front face " , " right face " , " back face " ,
" left face " , " top face " , " bottom face "
} ;
2006-04-23 06:44:19 +00:00
2011-07-21 22:39:29 +00:00
static int32_t defsparser ( scriptfile * script ) ;
2012-04-04 18:58:19 +00:00
static void defsparser_include ( const char * fn , const scriptfile * script , const char * cmdtokptr )
2011-07-21 22:39:29 +00:00
{
scriptfile * included ;
included = scriptfile_fromfile ( fn ) ;
2014-10-25 03:36:34 +00:00
if ( EDUKE32_PREDICT_FALSE ( ! included ) )
2011-07-21 22:39:29 +00:00
{
2012-04-04 18:58:19 +00:00
if ( ! cmdtokptr )
2013-09-13 20:23:59 +00:00
initprintf ( " Warning: Failed including %s as module \n " , fn ) ;
2011-07-21 22:39:29 +00:00
else
2013-09-13 20:23:59 +00:00
initprintf ( " Warning: Failed including %s on line %s:%d \n " ,
2011-07-21 22:39:29 +00:00
fn , script - > filename , scriptfile_getlinum ( script , cmdtokptr ) ) ;
}
else
{
2013-03-28 09:06:14 +00:00
if ( ! cmdtokptr )
{
2018-04-12 21:02:31 +00:00
g_logFlushWindow = 1 ;
2013-09-13 20:23:59 +00:00
initprintf ( " Loading module \" %s \" \n " , fn ) ;
2018-04-12 21:02:31 +00:00
g_logFlushWindow = 0 ;
2013-03-28 09:06:14 +00:00
}
2011-07-21 22:39:29 +00:00
defsparser ( included ) ;
scriptfile_close ( included ) ;
}
}
2012-04-04 18:58:19 +00:00
static int32_t check_tile_range ( const char * defcmd , int32_t * tilebeg , int32_t * tileend ,
const scriptfile * script , const char * cmdtokptr )
{
2014-10-25 03:36:34 +00:00
if ( EDUKE32_PREDICT_FALSE ( * tileend < * tilebeg ) )
2012-04-04 18:58:19 +00:00
{
2013-09-13 20:23:59 +00:00
initprintf ( " Warning: %s: backwards tile range on line %s:%d \n " , defcmd ,
2012-04-04 18:58:19 +00:00
script - > filename , scriptfile_getlinum ( script , cmdtokptr ) ) ;
swaplong ( tilebeg , tileend ) ;
}
2014-10-25 03:36:34 +00:00
if ( EDUKE32_PREDICT_FALSE ( ( unsigned ) * tilebeg > = MAXUSERTILES | | ( unsigned ) * tileend > = MAXUSERTILES ) )
2012-04-04 18:58:19 +00:00
{
2013-09-13 20:23:59 +00:00
initprintf ( " Error: %s: Invalid tile range on line %s:%d \n " , defcmd ,
2012-04-04 18:58:19 +00:00
script - > filename , scriptfile_getlinum ( script , cmdtokptr ) ) ;
return 1 ;
}
return 0 ;
}
2013-12-01 18:27:55 +00:00
static int32_t check_tile ( const char * defcmd , int32_t tile , const scriptfile * script ,
2012-04-04 18:58:19 +00:00
const char * cmdtokptr )
{
2014-10-25 03:36:34 +00:00
if ( EDUKE32_PREDICT_FALSE ( ( unsigned ) tile > = MAXUSERTILES ) )
2012-04-04 18:58:19 +00:00
{
2013-09-13 20:23:59 +00:00
initprintf ( " Error: %s: Invalid tile number on line %s:%d \n " , defcmd ,
2012-04-04 18:58:19 +00:00
script - > filename , scriptfile_getlinum ( script , cmdtokptr ) ) ;
return 1 ;
}
return 0 ;
}
2013-05-30 18:10:50 +00:00
# undef USE_DEF_PROGRESS
# if defined _WIN32 || defined HAVE_GTK2
# define USE_DEF_PROGRESS
# endif
2009-01-09 09:29:17 +00:00
static int32_t defsparser ( scriptfile * script )
2006-04-23 06:44:19 +00:00
{
2009-01-09 09:29:17 +00:00
int32_t tokn ;
2006-04-24 19:04:22 +00:00
char * cmdtokptr ;
2013-05-30 18:10:50 +00:00
# ifdef USE_DEF_PROGRESS
2013-05-23 18:27:24 +00:00
static uint32_t iter = 0 ;
2013-05-30 18:10:50 +00:00
# endif
2010-08-02 08:13:51 +00:00
static const tokenlist basetokens [ ] =
{
{ " include " , T_INCLUDE } ,
{ " #include " , T_INCLUDE } ,
Patch from Hendricks266 and whatever changes happened to be in my tree. I hope they work ;)
"The most noticeable change is the addition of the "includedefault" CON and DEF command, which will attempt to include eduke.con (or nam.con, or ww2gi.con), then game.con, or duke3d.def, or nam.def, or ww2gi.def. This is useful for TCs like my add-ons, where for my pseudo-mutators I currently say "include EDUKE.CON", but I also have to juggle this terrible order of paths, so that I can have an EDUKE.CON file in my HRP which says "include GAME.CON" to allow the mainline game to actually run, but also allow DukePlus to load its EDUKE.CON file (since it uses that and not an -x switch), and also allow any custom EDUKE.CON files in the root to be used."
git-svn-id: https://svn.eduke32.com/eduke32@1909 1a8010ca-5511-0410-912e-c29ae57300e0
2011-06-19 00:11:52 +00:00
{ " includedefault " , T_INCLUDEDEFAULT } ,
{ " #includedefault " , T_INCLUDEDEFAULT } ,
2010-08-02 08:13:51 +00:00
{ " define " , T_DEFINE } ,
{ " #define " , T_DEFINE } ,
// deprecated style
{ " definetexture " , T_DEFINETEXTURE } ,
{ " defineskybox " , T_DEFINESKYBOX } ,
{ " definetint " , T_DEFINETINT } ,
{ " definemodel " , T_DEFINEMODEL } ,
{ " definemodelframe " , T_DEFINEMODELFRAME } ,
{ " definemodelanim " , T_DEFINEMODELANIM } ,
{ " definemodelskin " , T_DEFINEMODELSKIN } ,
{ " selectmodelskin " , T_SELECTMODELSKIN } ,
{ " definevoxel " , T_DEFINEVOXEL } ,
{ " definevoxeltiles " , T_DEFINEVOXELTILES } ,
// new style
{ " model " , T_MODEL } ,
{ " voxel " , T_VOXEL } ,
{ " skybox " , T_SKYBOX } ,
2010-12-30 08:13:37 +00:00
{ " highpalookup " , T_HIGHPALOOKUP } ,
2010-08-02 08:13:51 +00:00
{ " tint " , T_TINT } ,
DEF command 'makepalookup', allowing indpt. specification of fog and color remapping.
The syntax is as follows:
makepalookup { <token-list...> }
where valid tokens are
* pal <palnum>: the palette number, 1 .. 250
* red <num>, green, blue (or r, g, b): the fog color components on a 0 to 63 scale.
Components that are not present are assumed to be 0.
* remappal <palnum>: the palette number to take the index remapping from, i.e. 21
for blue -> red. When absent, defaults to 0.
* remapself: when present, specifies that the remappal is the same as the 'pal'.
This is to prevent textual redundancy when overwriting existing palookups.
Examples (best tested with tile #251):
1) makepalookup { pal 200 red 30 remappal 23 }
This creates palookup 200 with a fog of (30,0,0) and a blue-to-yellow remapping
(assuming it has not been changed before)
2) makepalookup { pal 21 red 30 remapself }
This 'fogifies' palookup 21 with a red fog.
3) makepalookup { pal 21 red 30 }
This overwrites palookup 21 with a red fog, but clears the blue-to-red remapping.
The fog aspect of this command affects the GL modes just like 'fogpal', but the
remapping has no effect for hightiles.
- Also, silently clamp 'fogpal' r,g,b values to the range 0 .. 63.
git-svn-id: https://svn.eduke32.com/eduke32@2568 1a8010ca-5511-0410-912e-c29ae57300e0
2012-03-29 21:16:41 +00:00
{ " makepalookup " , T_MAKEPALOOKUP } ,
2010-08-02 08:13:51 +00:00
{ " texture " , T_TEXTURE } ,
{ " tile " , T_TEXTURE } ,
{ " music " , T_MUSIC } ,
{ " sound " , T_SOUND } ,
Possibility of specifying sounds for a VPX anim-replacement via DEF.
The syntax is as follows:
animsounds <anim> { frame1 sound1 frame2 sound2 ... }
<anim> has to be one of the tokens: cineov2, cineov3, RADLOGO, DUKETEAM,
logo, vol41a, vol42a, vol4e1, vol43a, vol4e2, or vol4e3, corresponding
to hard-coded Duke3D anims.
The frameN's (1-based frame numbers) have to be in ascending order (but not
necessarily strictly ascending, so that a frame may have more than one sound).
Example: for Duke3D's XBLA nuke logo animation (IVF extracted from nuke.webm),
the following definition overlays the video with a sound sequence similar
(identical save for timing) to the original nuke animation:
// frame 1: FLY_BY, frame 64: PIPEBOMB_EXPLODE
animsounds logo { 1 244 64 14 }
git-svn-id: https://svn.eduke32.com/eduke32@2242 1a8010ca-5511-0410-912e-c29ae57300e0
2012-01-10 23:43:54 +00:00
{ " animsounds " , T_ANIMSOUNDS } , // dummy
2015-02-11 05:22:07 +00:00
{ " cutscene " , T_CUTSCENE } ,
2014-12-13 22:33:04 +00:00
{ " nofloorpalrange " , T_NOFLOORPALRANGE } ,
2012-10-14 20:41:34 +00:00
{ " texhitscanrange " , T_TEXHITSCANRANGE } ,
2012-11-25 13:19:06 +00:00
{ " nofullbrightrange " , T_NOFULLBRIGHTRANGE } ,
2010-08-02 08:13:51 +00:00
// other stuff
{ " undefmodel " , T_UNDEFMODEL } ,
{ " undefmodelrange " , T_UNDEFMODELRANGE } ,
{ " undefmodelof " , T_UNDEFMODELOF } ,
{ " undeftexture " , T_UNDEFTEXTURE } ,
{ " undeftexturerange " , T_UNDEFTEXTURERANGE } ,
{ " alphahack " , T_ALPHAHACK } ,
{ " alphahackrange " , T_ALPHAHACKRANGE } ,
{ " spritecol " , T_SPRITECOL } ,
{ " 2dcol " , T_2DCOL } ,
2015-11-14 23:40:57 +00:00
{ " 2dcolidxrange " , T_2DCOLIDXRANGE } ,
2010-08-02 08:13:51 +00:00
{ " fogpal " , T_FOGPAL } ,
{ " loadgrp " , T_LOADGRP } ,
{ " dummytile " , T_DUMMYTILE } ,
{ " dummytilerange " , T_DUMMYTILERANGE } ,
{ " setuptile " , T_SETUPTILE } ,
{ " setuptilerange " , T_SETUPTILERANGE } ,
2015-04-09 07:52:28 +00:00
{ " undefinetile " , T_UNDEFINETILE } ,
2015-04-09 07:56:36 +00:00
{ " undefinetilerange " , T_UNDEFINETILERANGE } ,
2010-08-02 08:13:51 +00:00
{ " animtilerange " , T_ANIMTILERANGE } ,
{ " cachesize " , T_CACHESIZE } ,
{ " dummytilefrompic " , T_IMPORTTILE } ,
{ " tilefromtexture " , T_TILEFROMTEXTURE } ,
2015-05-03 07:05:35 +00:00
{ " artfile " , T_ARTFILE } ,
2015-01-08 15:14:00 +00:00
{ " mapinfo " , T_MAPINFO } ,
2012-03-10 09:44:17 +00:00
{ " echo " , T_ECHO } ,
2015-03-09 20:32:36 +00:00
{ " globalflags " , T_GLOBALFLAGS } ,
2015-04-12 08:07:30 +00:00
{ " copytile " , T_COPYTILE } ,
2015-04-24 00:08:46 +00:00
{ " globalgameflags " , T_GLOBALGAMEFLAGS } , // dummy
2015-05-27 08:47:50 +00:00
{ " multipsky " , T_MULTIPSKY } ,
2015-09-23 17:55:19 +00:00
{ " basepalette " , T_BASEPALETTE } ,
{ " palookup " , T_PALOOKUP } ,
{ " blendtable " , T_BLENDTABLE } ,
2015-09-27 21:18:24 +00:00
{ " numalphatables " , T_NUMALPHATABS } ,
2015-10-03 11:52:51 +00:00
{ " undefbasepaletterange " , T_UNDEFBASEPALETTERANGE } ,
{ " undefpalookuprange " , T_UNDEFPALOOKUPRANGE } ,
{ " undefblendtablerange " , T_UNDEFBLENDTABLERANGE } ,
2018-01-26 04:35:15 +00:00
{ " shadefactor " , T_SHADEFACTOR } ,
2019-08-09 08:21:19 +00:00
{ " newgamechoices " , T_NEWGAMECHOICES } ,
2019-09-19 20:02:45 +00:00
{ " rffdefineid " , T_RFFDEFINEID } , // dummy
2010-08-02 08:13:51 +00:00
} ;
2007-12-12 17:42:14 +00:00
while ( 1 )
{
2013-05-30 18:10:50 +00:00
# ifdef USE_DEF_PROGRESS
2013-05-23 18:27:24 +00:00
if ( + + iter > = 50 )
{
2018-04-12 21:02:31 +00:00
g_logFlushWindow = 1 ;
2013-05-23 18:27:24 +00:00
initprintf ( " . " ) ;
2018-04-12 21:02:31 +00:00
g_logFlushWindow = 0 ;
2013-05-23 18:27:24 +00:00
iter = 0 ;
}
2013-05-30 18:10:50 +00:00
# endif
2014-09-30 04:17:53 +00:00
handleevents ( ) ;
2014-03-22 09:25:15 +00:00
tokn = getatoken ( script , basetokens , ARRAY_SIZE ( basetokens ) ) ;
2006-04-24 19:04:22 +00:00
cmdtokptr = script - > ltextptr ;
2007-12-12 17:42:14 +00:00
switch ( tokn )
{
2006-04-24 19:04:22 +00:00
case T_ERROR :
2013-09-13 20:23:59 +00:00
initprintf ( " Error on line %s:%d. \n " , script - > filename , scriptfile_getlinum ( script , cmdtokptr ) ) ;
2006-04-24 19:04:22 +00:00
break ;
case T_EOF :
2016-06-21 00:34:41 +00:00
return 0 ;
2006-04-24 19:04:22 +00:00
case T_INCLUDE :
2006-11-13 23:12:47 +00:00
{
char * fn ;
2007-12-12 17:42:14 +00:00
if ( ! scriptfile_getstring ( script , & fn ) )
2011-07-21 22:39:29 +00:00
defsparser_include ( fn , script , cmdtokptr ) ;
2006-11-13 23:12:47 +00:00
break ;
}
Patch from Hendricks266 and whatever changes happened to be in my tree. I hope they work ;)
"The most noticeable change is the addition of the "includedefault" CON and DEF command, which will attempt to include eduke.con (or nam.con, or ww2gi.con), then game.con, or duke3d.def, or nam.def, or ww2gi.def. This is useful for TCs like my add-ons, where for my pseudo-mutators I currently say "include EDUKE.CON", but I also have to juggle this terrible order of paths, so that I can have an EDUKE.CON file in my HRP which says "include GAME.CON" to allow the mainline game to actually run, but also allow DukePlus to load its EDUKE.CON file (since it uses that and not an -x switch), and also allow any custom EDUKE.CON files in the root to be used."
git-svn-id: https://svn.eduke32.com/eduke32@1909 1a8010ca-5511-0410-912e-c29ae57300e0
2011-06-19 00:11:52 +00:00
case T_INCLUDEDEFAULT :
{
2019-11-01 18:25:42 +00:00
defsparser_include ( G_DefaultDefFile ( ) , script , cmdtokptr ) ;
Patch from Hendricks266 and whatever changes happened to be in my tree. I hope they work ;)
"The most noticeable change is the addition of the "includedefault" CON and DEF command, which will attempt to include eduke.con (or nam.con, or ww2gi.con), then game.con, or duke3d.def, or nam.def, or ww2gi.def. This is useful for TCs like my add-ons, where for my pseudo-mutators I currently say "include EDUKE.CON", but I also have to juggle this terrible order of paths, so that I can have an EDUKE.CON file in my HRP which says "include GAME.CON" to allow the mainline game to actually run, but also allow DukePlus to load its EDUKE.CON file (since it uses that and not an -x switch), and also allow any custom EDUKE.CON files in the root to be used."
git-svn-id: https://svn.eduke32.com/eduke32@1909 1a8010ca-5511-0410-912e-c29ae57300e0
2011-06-19 00:11:52 +00:00
break ;
}
2006-04-24 19:04:22 +00:00
case T_DEFINE :
2006-11-13 23:12:47 +00:00
{
char * name ;
2009-01-09 09:29:17 +00:00
int32_t number ;
2006-04-24 19:04:22 +00:00
2006-11-13 23:12:47 +00:00
if ( scriptfile_getstring ( script , & name ) ) break ;
if ( scriptfile_getsymbol ( script , & number ) ) break ;
2006-04-24 19:04:22 +00:00
2014-10-25 03:36:34 +00:00
if ( EDUKE32_PREDICT_FALSE ( scriptfile_addsymbolvalue ( name , number ) < 0 ) )
2013-09-13 20:23:59 +00:00
initprintf ( " Warning: Symbol %s was NOT redefined to %d on line %s:%d \n " ,
2006-11-13 23:12:47 +00:00
name , number , script - > filename , scriptfile_getlinum ( script , cmdtokptr ) ) ;
break ;
}
2006-04-24 19:04:22 +00:00
2006-11-13 23:12:47 +00:00
// OLD (DEPRECATED) DEFINITION SYNTAX
2006-04-24 19:04:22 +00:00
case T_DEFINETEXTURE :
2006-11-13 23:12:47 +00:00
{
2012-03-28 19:41:39 +00:00
int32_t tile , pal , fnoo ;
char * fn ;
2006-11-13 23:12:47 +00:00
if ( scriptfile_getsymbol ( script , & tile ) ) break ;
if ( scriptfile_getsymbol ( script , & pal ) ) break ;
if ( scriptfile_getnumber ( script , & fnoo ) ) break ; //x-center
if ( scriptfile_getnumber ( script , & fnoo ) ) break ; //y-center
if ( scriptfile_getnumber ( script , & fnoo ) ) break ; //x-size
if ( scriptfile_getnumber ( script , & fnoo ) ) break ; //y-size
if ( scriptfile_getstring ( script , & fn ) ) break ;
2019-12-07 09:31:27 +00:00
if ( fileSystem . FileExists ( fn ) )
2012-03-28 19:41:39 +00:00
break ;
2006-10-31 18:32:29 +00:00
2019-10-17 10:45:25 +00:00
tileSetHightileReplacement ( tile , pal , fn , - 1.0 , 1.0 , 1.0 , 1.0 , 1.0 , 0 ) ;
2006-11-13 23:12:47 +00:00
}
break ;
2006-04-24 19:04:22 +00:00
case T_DEFINESKYBOX :
2006-11-13 23:12:47 +00:00
{
2012-03-28 19:41:39 +00:00
int32_t tile , pal , i ;
char * fn [ 6 ] , happy = 1 ;
2006-11-13 23:12:47 +00:00
if ( scriptfile_getsymbol ( script , & tile ) ) break ;
if ( scriptfile_getsymbol ( script , & pal ) ) break ;
if ( scriptfile_getsymbol ( script , & i ) ) break ; //future expansion
2009-02-19 16:47:54 +00:00
for ( i = 0 ; i < 6 ; i + + )
2007-12-12 17:42:14 +00:00
{
2006-11-13 23:12:47 +00:00
if ( scriptfile_getstring ( script , & fn [ i ] ) ) break ; //grab the 6 faces
2007-05-01 04:35:27 +00:00
2019-12-07 09:31:27 +00:00
if ( fileSystem . FileExists ( fn [ i ] ) )
2012-03-28 19:41:39 +00:00
happy = 0 ;
2006-04-24 19:04:22 +00:00
}
2006-11-13 23:12:47 +00:00
if ( i < 6 | | ! happy ) break ;
2019-10-17 10:45:25 +00:00
tileSetSkybox ( tile , pal , ( const char * * ) fn , 0 ) ;
2006-11-13 23:12:47 +00:00
}
break ;
2006-04-24 19:04:22 +00:00
case T_DEFINETINT :
2006-11-13 23:12:47 +00:00
{
2018-02-18 00:24:54 +00:00
int32_t pal , r , g , b , f ;
2006-11-13 23:12:47 +00:00
if ( scriptfile_getsymbol ( script , & pal ) ) break ;
if ( scriptfile_getnumber ( script , & r ) ) break ;
if ( scriptfile_getnumber ( script , & g ) ) break ;
if ( scriptfile_getnumber ( script , & b ) ) break ;
if ( scriptfile_getnumber ( script , & f ) ) break ; //effects
2013-01-08 06:17:10 +00:00
# ifdef USE_OPENGL
2018-02-18 00:24:54 +00:00
hicsetpalettetint ( pal , r , g , b , 0 , 0 , 0 , f ) ;
2013-01-08 06:17:10 +00:00
# endif
2006-11-13 23:12:47 +00:00
}
break ;
2006-04-24 19:04:22 +00:00
case T_ALPHAHACK :
2006-11-13 23:12:47 +00:00
{
2009-01-09 09:29:17 +00:00
int32_t tile ;
2006-11-13 23:12:47 +00:00
double alpha ;
2006-04-24 19:04:22 +00:00
2006-11-13 23:12:47 +00:00
if ( scriptfile_getsymbol ( script , & tile ) ) break ;
if ( scriptfile_getdouble ( script , & alpha ) ) break ;
2011-03-04 08:50:58 +00:00
# ifdef USE_OPENGL
2012-03-28 19:41:15 +00:00
if ( ( uint32_t ) tile < MAXTILES )
2015-03-24 00:40:48 +00:00
alphahackarray [ tile ] = Blrintf ( alpha * ( float ) UINT8_MAX ) ;
2006-05-12 21:55:05 +00:00
# endif
2006-11-13 23:12:47 +00:00
}
break ;
2006-04-24 19:04:22 +00:00
case T_ALPHAHACKRANGE :
2006-11-13 23:12:47 +00:00
{
2013-01-08 06:17:10 +00:00
int32_t tilenume1 , tilenume2 ;
2006-11-13 23:12:47 +00:00
double alpha ;
2013-01-08 06:17:10 +00:00
# ifdef USE_OPENGL
int32_t i ;
# endif
2006-11-13 23:12:47 +00:00
if ( scriptfile_getsymbol ( script , & tilenume1 ) ) break ;
if ( scriptfile_getsymbol ( script , & tilenume2 ) ) break ;
if ( scriptfile_getdouble ( script , & alpha ) ) break ;
2012-04-04 18:58:19 +00:00
if ( check_tile_range ( " alphahackrange " , & tilenume1 , & tilenume2 , script , cmdtokptr ) )
break ;
2011-03-04 08:50:58 +00:00
# ifdef USE_OPENGL
2012-04-04 18:58:19 +00:00
for ( i = tilenume1 ; i < = tilenume2 ; i + + )
2015-03-24 00:40:48 +00:00
alphahackarray [ i ] = Blrintf ( alpha * ( float ) UINT8_MAX ) ;
2006-11-13 23:12:47 +00:00
# endif
}
break ;
2006-04-24 19:04:22 +00:00
case T_SPRITECOL :
2006-11-13 23:12:47 +00:00
{
2009-01-09 09:29:17 +00:00
int32_t tile , col , col2 ;
2006-04-24 19:04:22 +00:00
2006-11-13 23:12:47 +00:00
if ( scriptfile_getsymbol ( script , & tile ) ) break ;
if ( scriptfile_getnumber ( script , & col ) ) break ;
if ( scriptfile_getnumber ( script , & col2 ) ) break ;
}
break ;
2006-04-24 19:04:22 +00:00
case T_2DCOL :
2006-11-13 23:12:47 +00:00
{
2009-01-09 09:29:17 +00:00
int32_t col , b , g , r ;
2006-11-13 23:12:47 +00:00
if ( scriptfile_getnumber ( script , & col ) ) break ;
if ( scriptfile_getnumber ( script , & r ) ) break ;
if ( scriptfile_getnumber ( script , & g ) ) break ;
if ( scriptfile_getnumber ( script , & b ) ) break ;
2012-03-18 23:17:51 +00:00
if ( ( unsigned ) col < 256 )
2007-12-12 17:42:14 +00:00
{
2013-12-31 11:51:52 +00:00
r = clamp ( r , 0 , 63 ) ;
g = clamp ( g , 0 , 63 ) ;
b = clamp ( b , 0 , 63 ) ;
2015-09-23 17:55:11 +00:00
vgapal16 [ col * 4 + 0 ] = b < < 2 ; // blue
vgapal16 [ col * 4 + 1 ] = g < < 2 ; // green
vgapal16 [ col * 4 + 2 ] = r < < 2 ; // red
2006-04-24 19:04:22 +00:00
}
2006-11-13 23:12:47 +00:00
}
break ;
2015-11-14 23:40:57 +00:00
case T_2DCOLIDXRANGE : // NOTE: takes precedence over 2dcol, see InitCustomColors()
{
int32_t col , idx , idxend ;
if ( scriptfile_getnumber ( script , & col ) ) break ;
if ( scriptfile_getnumber ( script , & idx ) ) break ;
if ( scriptfile_getnumber ( script , & idxend ) ) break ;
while ( ( unsigned ) col < 256 & & idx < = idxend )
editorcolors [ col + + ] = idx + + ;
}
break ;
2006-04-24 19:04:22 +00:00
case T_FOGPAL :
2006-11-13 23:12:47 +00:00
{
2012-03-29 21:17:03 +00:00
int32_t p , r , g , b ;
2006-11-13 23:12:47 +00:00
Ensure that anywhere the def parser takes a tilenum or palnum accepts defined tokens in addition to integer literals, if it doesn't already.
Affects fogpal, nofloorpalrange, setuptilerange, dummytilerange, undefinetilerange, definemodelframe, definevoxeltiles, texhitscanrange, nofullbrightrange, and light.
git-svn-id: https://svn.eduke32.com/eduke32@6896 1a8010ca-5511-0410-912e-c29ae57300e0
2018-05-23 05:43:35 +00:00
if ( scriptfile_getsymbol ( script , & p ) ) break ;
2006-11-13 23:12:47 +00:00
if ( scriptfile_getnumber ( script , & r ) ) break ;
if ( scriptfile_getnumber ( script , & g ) ) break ;
if ( scriptfile_getnumber ( script , & b ) ) break ;
DEF command 'makepalookup', allowing indpt. specification of fog and color remapping.
The syntax is as follows:
makepalookup { <token-list...> }
where valid tokens are
* pal <palnum>: the palette number, 1 .. 250
* red <num>, green, blue (or r, g, b): the fog color components on a 0 to 63 scale.
Components that are not present are assumed to be 0.
* remappal <palnum>: the palette number to take the index remapping from, i.e. 21
for blue -> red. When absent, defaults to 0.
* remapself: when present, specifies that the remappal is the same as the 'pal'.
This is to prevent textual redundancy when overwriting existing palookups.
Examples (best tested with tile #251):
1) makepalookup { pal 200 red 30 remappal 23 }
This creates palookup 200 with a fog of (30,0,0) and a blue-to-yellow remapping
(assuming it has not been changed before)
2) makepalookup { pal 21 red 30 remapself }
This 'fogifies' palookup 21 with a red fog.
3) makepalookup { pal 21 red 30 }
This overwrites palookup 21 with a red fog, but clears the blue-to-red remapping.
The fog aspect of this command affects the GL modes just like 'fogpal', but the
remapping has no effect for hightiles.
- Also, silently clamp 'fogpal' r,g,b values to the range 0 .. 63.
git-svn-id: https://svn.eduke32.com/eduke32@2568 1a8010ca-5511-0410-912e-c29ae57300e0
2012-03-29 21:16:41 +00:00
r = clamp ( r , 0 , 63 ) ;
g = clamp ( g , 0 , 63 ) ;
b = clamp ( b , 0 , 63 ) ;
2018-04-12 21:03:12 +00:00
paletteMakeLookupTable ( p , NULL , r < < 2 , g < < 2 , b < < 2 , 1 ) ;
2006-11-13 23:12:47 +00:00
}
break ;
2014-12-13 22:33:04 +00:00
case T_NOFLOORPALRANGE :
{
int32_t b , e , i ;
Ensure that anywhere the def parser takes a tilenum or palnum accepts defined tokens in addition to integer literals, if it doesn't already.
Affects fogpal, nofloorpalrange, setuptilerange, dummytilerange, undefinetilerange, definemodelframe, definevoxeltiles, texhitscanrange, nofullbrightrange, and light.
git-svn-id: https://svn.eduke32.com/eduke32@6896 1a8010ca-5511-0410-912e-c29ae57300e0
2018-05-23 05:43:35 +00:00
if ( scriptfile_getsymbol ( script , & b ) ) break ;
if ( scriptfile_getsymbol ( script , & e ) ) break ;
2014-12-13 22:33:04 +00:00
b = max ( b , 1 ) ;
e = min ( e , MAXPALOOKUPS - 1 ) ;
for ( i = b ; i < = e ; i + + )
g_noFloorPal [ i ] = 1 ;
}
break ;
2006-04-24 19:04:22 +00:00
case T_LOADGRP :
2006-11-13 23:12:47 +00:00
{
char * bs ;
scriptfile_getstring ( script , & bs ) ;
}
break ;
2007-01-02 02:27:31 +00:00
case T_CACHESIZE :
{
2009-01-09 09:29:17 +00:00
int32_t j ;
2007-12-12 17:42:14 +00:00
2007-01-02 02:27:31 +00:00
if ( scriptfile_getnumber ( script , & j ) ) break ;
}
break ;
2018-01-26 04:35:15 +00:00
case T_SHADEFACTOR :
scriptfile_getnumber ( script , & realmaxshade ) ;
frealmaxshade = ( float ) realmaxshade ;
break ;
2015-05-03 07:05:35 +00:00
case T_ARTFILE :
{
char * blockend , * fn = NULL ;
int32_t tile = - 1 , havetile = 0 ;
static const tokenlist artfiletokens [ ] =
{
{ " file " , T_FILE } ,
{ " tile " , T_TILE } ,
} ;
if ( scriptfile_getbraces ( script , & blockend ) ) break ;
while ( script - > textptr < blockend )
{
int32_t token = getatoken ( script , artfiletokens , ARRAY_SIZE ( artfiletokens ) ) ;
switch ( token )
{
case T_FILE :
scriptfile_getstring ( script , & fn ) ;
break ;
case T_TILE :
havetile = 1 ;
scriptfile_getsymbol ( script , & tile ) ;
break ;
default :
break ;
}
}
if ( EDUKE32_PREDICT_FALSE ( ! fn ) )
{
initprintf ( " Error: missing 'file name' for artfile definition near line %s:%d \n " ,
script - > filename , scriptfile_getlinum ( script , cmdtokptr ) ) ;
break ;
}
2019-10-15 21:38:01 +00:00
if ( ! check_tile ( " artfile " , tile , script , cmdtokptr ) )
TileFiles . LoadArtFile ( fn , false , tile ) ;
2015-05-03 07:05:35 +00:00
}
break ;
2008-03-27 21:32:23 +00:00
case T_SETUPTILE :
{
2009-01-09 09:29:17 +00:00
int32_t tile , tmp ;
2008-03-27 21:32:23 +00:00
if ( scriptfile_getsymbol ( script , & tile ) ) break ;
2015-04-12 08:06:51 +00:00
if ( check_tile ( " setuptile " , tile , script , cmdtokptr ) )
break ;
2015-03-24 00:40:48 +00:00
if ( scriptfile_getsymbol ( script , & tmp ) ) break ; // XXX
h_xsize [ tile ] = tmp ;
if ( scriptfile_getsymbol ( script , & tmp ) ) break ;
h_ysize [ tile ] = tmp ;
2008-03-27 21:32:23 +00:00
if ( scriptfile_getsymbol ( script , & tmp ) ) break ;
h_xoffs [ tile ] = tmp ;
if ( scriptfile_getsymbol ( script , & tmp ) ) break ;
h_yoffs [ tile ] = tmp ;
break ;
}
case T_SETUPTILERANGE :
{
2009-01-09 09:29:17 +00:00
int32_t tile1 , tile2 , xsiz , ysiz , xoffs , yoffs , i ;
2008-03-27 21:32:23 +00:00
Ensure that anywhere the def parser takes a tilenum or palnum accepts defined tokens in addition to integer literals, if it doesn't already.
Affects fogpal, nofloorpalrange, setuptilerange, dummytilerange, undefinetilerange, definemodelframe, definevoxeltiles, texhitscanrange, nofullbrightrange, and light.
git-svn-id: https://svn.eduke32.com/eduke32@6896 1a8010ca-5511-0410-912e-c29ae57300e0
2018-05-23 05:43:35 +00:00
if ( scriptfile_getsymbol ( script , & tile1 ) ) break ;
if ( scriptfile_getsymbol ( script , & tile2 ) ) break ;
2008-03-27 21:32:23 +00:00
if ( scriptfile_getnumber ( script , & xsiz ) ) break ;
if ( scriptfile_getnumber ( script , & ysiz ) ) break ;
if ( scriptfile_getsymbol ( script , & xoffs ) ) break ;
if ( scriptfile_getsymbol ( script , & yoffs ) ) break ;
2012-03-28 19:41:15 +00:00
2012-04-04 18:58:19 +00:00
if ( check_tile_range ( " setuptilerange " , & tile1 , & tile2 , script , cmdtokptr ) )
break ;
2012-03-28 19:41:15 +00:00
2012-04-04 18:58:19 +00:00
for ( i = tile1 ; i < = tile2 ; i + + )
2008-03-27 21:32:23 +00:00
{
2012-04-04 18:58:19 +00:00
h_xsize [ i ] = xsiz ;
h_ysize [ i ] = ysiz ;
h_xoffs [ i ] = xoffs ;
h_yoffs [ i ] = yoffs ;
2008-03-27 21:32:23 +00:00
}
2012-04-04 18:58:19 +00:00
2008-03-27 21:32:23 +00:00
break ;
}
2008-08-02 13:00:41 +00:00
case T_ANIMTILERANGE :
{
2012-04-04 18:58:19 +00:00
int32_t tile1 , tile2 , spd , type ;
2008-08-02 13:00:41 +00:00
if ( scriptfile_getsymbol ( script , & tile1 ) ) break ;
if ( scriptfile_getsymbol ( script , & tile2 ) ) break ;
if ( scriptfile_getsymbol ( script , & spd ) ) break ;
if ( scriptfile_getsymbol ( script , & type ) ) break ;
2012-04-04 18:58:19 +00:00
2015-09-24 06:32:01 +00:00
if ( check_tile ( " animtilerange " , tile1 , script , cmdtokptr ) )
break ;
if ( check_tile ( " animtilerange " , tile2 , script , cmdtokptr ) )
2012-04-04 18:58:19 +00:00
break ;
2015-09-24 06:32:01 +00:00
spd = clamp ( spd , 0 , 15 ) ;
if ( EDUKE32_PREDICT_FALSE ( type & ~ 3 ) )
2008-08-02 13:00:41 +00:00
{
2015-09-24 06:32:01 +00:00
initprintf ( " Error: animtilerange: animation type must be 0, 1, 2 or 3 on line %s:%d \n " ,
2012-04-04 18:58:19 +00:00
script - > filename , scriptfile_getlinum ( script , cmdtokptr ) ) ;
break ;
2008-08-02 13:00:41 +00:00
}
2012-03-28 19:41:15 +00:00
2015-09-24 06:32:01 +00:00
int32_t num = tile2 - tile1 ;
if ( type = = 3 & & tile1 > tile2 ) // PICANM_ANIMTYPE_BACK
num = - num ;
if ( EDUKE32_PREDICT_FALSE ( ( unsigned ) num > 255 ) )
2012-11-17 19:46:28 +00:00
{
2015-09-24 06:32:01 +00:00
initprintf ( " Error: animtilerange: tile difference can be at most 255 on line %s:%d \n " ,
2012-11-17 19:46:28 +00:00
script - > filename , scriptfile_getlinum ( script , cmdtokptr ) ) ;
2015-09-24 06:32:01 +00:00
break ;
2012-11-17 19:46:28 +00:00
}
2012-04-04 18:58:19 +00:00
2012-11-17 19:46:28 +00:00
// set anim speed
picanm [ tile1 ] . sf & = ~ PICANM_ANIMSPEED_MASK ;
picanm [ tile1 ] . sf | = spd ;
// set anim type
picanm [ tile1 ] . sf & = ~ PICANM_ANIMTYPE_MASK ;
picanm [ tile1 ] . sf | = type < < PICANM_ANIMTYPE_SHIFT ;
// set anim number
2015-09-24 06:32:01 +00:00
picanm [ tile1 ] . num = num ;
2012-03-28 19:41:15 +00:00
2008-08-02 13:00:41 +00:00
break ;
}
2008-11-24 11:31:05 +00:00
case T_TILEFROMTEXTURE :
{
2012-04-04 18:58:19 +00:00
char * texturetokptr = script - > ltextptr , * textureend , * fn = NULL ;
2013-07-20 03:37:10 +00:00
int32_t tile = - 1 ;
int32_t alphacut = 255 , flags = 0 ;
2019-07-23 15:56:39 +00:00
int32_t havexoffset = 0 , haveyoffset = 0 , haveextra = 0 ;
2014-03-29 21:48:44 +00:00
int32_t xoffset = 0 , yoffset = 0 ;
2015-05-27 08:45:13 +00:00
int32_t istexture = 0 ;
2019-11-26 08:24:10 +00:00
int32_t tilecrc = 0 ;
uint8_t have_ifcrc = 0 ;
2019-07-23 15:56:39 +00:00
int32_t extra = 0 ;
2008-11-24 11:31:05 +00:00
2010-08-02 08:13:51 +00:00
static const tokenlist tilefromtexturetokens [ ] =
{
{ " file " , T_FILE } ,
{ " name " , T_FILE } ,
{ " alphacut " , T_ALPHACUT } ,
{ " xoffset " , T_XOFFSET } ,
{ " xoff " , T_XOFFSET } ,
{ " yoffset " , T_YOFFSET } ,
{ " yoff " , T_YOFFSET } ,
2012-10-14 20:41:34 +00:00
{ " texhitscan " , T_TEXHITSCAN } ,
2012-11-25 13:19:06 +00:00
{ " nofullbright " , T_NOFULLBRIGHT } ,
2015-05-27 08:45:13 +00:00
{ " texture " , T_TEXTURE } ,
2019-03-02 23:21:37 +00:00
{ " ifcrc " , T_IFCRC } ,
2019-07-23 15:56:39 +00:00
{ " extra " , T_EXTRA } ,
2010-08-02 08:13:51 +00:00
} ;
2008-11-24 11:31:05 +00:00
if ( scriptfile_getsymbol ( script , & tile ) ) break ;
if ( scriptfile_getbraces ( script , & textureend ) ) break ;
while ( script - > textptr < textureend )
{
2014-03-22 09:25:15 +00:00
int32_t token = getatoken ( script , tilefromtexturetokens , ARRAY_SIZE ( tilefromtexturetokens ) ) ;
2008-11-24 11:31:05 +00:00
switch ( token )
{
case T_FILE :
2015-05-03 07:05:04 +00:00
scriptfile_getstring ( script , & fn ) ;
break ;
2008-11-24 11:31:05 +00:00
case T_ALPHACUT :
2015-05-03 07:05:04 +00:00
scriptfile_getsymbol ( script , & alphacut ) ;
alphacut = clamp ( alphacut , 0 , 255 ) ;
break ;
2008-12-19 00:53:54 +00:00
case T_XOFFSET :
2014-03-29 21:48:44 +00:00
havexoffset = 1 ;
2015-05-03 07:05:04 +00:00
scriptfile_getsymbol ( script , & xoffset ) ;
xoffset = clamp ( xoffset , - 128 , 127 ) ;
break ;
2008-12-19 00:53:54 +00:00
case T_YOFFSET :
2014-03-29 21:48:44 +00:00
haveyoffset = 1 ;
2015-05-03 07:05:04 +00:00
scriptfile_getsymbol ( script , & yoffset ) ;
yoffset = clamp ( yoffset , - 128 , 127 ) ;
break ;
2019-03-02 23:21:37 +00:00
case T_IFCRC :
scriptfile_getsymbol ( script , & tilecrc ) ;
2019-11-26 08:24:10 +00:00
have_ifcrc = 1 ;
2019-03-02 23:21:37 +00:00
break ;
2012-10-14 20:41:34 +00:00
case T_TEXHITSCAN :
2013-07-20 03:37:10 +00:00
flags | = PICANM_TEXHITSCAN_BIT ;
break ;
case T_NOFULLBRIGHT :
flags | = PICANM_NOFULLBRIGHT_BIT ;
2008-11-24 11:31:05 +00:00
break ;
2015-05-27 08:45:13 +00:00
case T_TEXTURE :
istexture = 1 ;
break ;
2019-07-23 15:56:39 +00:00
case T_EXTRA :
haveextra = 1 ;
scriptfile_getsymbol ( script , & extra ) ;
break ;
2012-10-14 20:41:34 +00:00
default :
2008-11-24 11:31:05 +00:00
break ;
}
}
2014-10-25 03:36:34 +00:00
if ( EDUKE32_PREDICT_FALSE ( ( unsigned ) tile > = MAXUSERTILES ) )
2008-11-24 11:31:05 +00:00
{
2013-09-13 20:23:59 +00:00
initprintf ( " Error: missing or invalid 'tile number' for texture definition near line %s:%d \n " ,
2008-11-24 11:31:05 +00:00
script - > filename , scriptfile_getlinum ( script , texturetokptr ) ) ;
break ;
}
2019-11-26 08:24:10 +00:00
if ( have_ifcrc )
2019-03-02 23:21:37 +00:00
{
2019-11-26 08:24:10 +00:00
int32_t origcrc = tileCRC ( tile ) ;
2019-03-02 23:21:37 +00:00
if ( origcrc ! = tilecrc )
{
//initprintf("CRC of tile %d doesn't match! CRC: %d, Expected: %d\n", tile, origcrc, tilecrc);
break ;
}
}
2012-10-14 20:41:34 +00:00
if ( ! fn )
{
2013-07-20 03:37:10 +00:00
// tilefromtexture <tile> { texhitscan } sets the bit but doesn't change tile data
picanm [ tile ] . sf | = flags ;
2014-03-29 21:48:44 +00:00
if ( havexoffset )
2015-05-03 07:05:04 +00:00
picanm [ tile ] . xofs = xoffset ;
2014-03-29 21:48:44 +00:00
if ( haveyoffset )
2015-05-03 07:05:04 +00:00
picanm [ tile ] . yofs = yoffset ;
2019-07-23 15:56:39 +00:00
if ( haveextra )
picanm [ tile ] . extra = extra ;
2013-07-20 03:37:10 +00:00
2014-10-25 03:36:34 +00:00
if ( EDUKE32_PREDICT_FALSE ( flags = = 0 & & ! havexoffset & & ! haveyoffset ) )
2013-06-01 06:55:46 +00:00
initprintf ( " \n Error: missing 'file name' for tilefromtexture definition near line %s:%d " ,
2012-10-14 20:41:34 +00:00
script - > filename , scriptfile_getlinum ( script , texturetokptr ) ) ;
break ;
}
2019-10-15 21:38:01 +00:00
int32_t const texstatus = tileImportFromTexture ( fn , tile , alphacut , istexture ) ;
2015-09-23 17:54:50 +00:00
if ( texstatus = = - 3 )
initprintf ( " Error: No palette loaded, in tilefromtexture definition near line %s:%d \n " ,
script - > filename , scriptfile_getlinum ( script , texturetokptr ) ) ;
2015-12-23 04:06:28 +00:00
if ( texstatus = = - ( 3 < < 8 ) )
2015-05-03 07:05:04 +00:00
initprintf ( " Error: \" %s \" has more than one tile, in tilefromtexture definition near line %s:%d \n " ,
fn , script - > filename , scriptfile_getlinum ( script , texturetokptr ) ) ;
if ( texstatus < 0 )
2012-10-14 20:41:34 +00:00
break ;
2015-05-03 07:05:04 +00:00
picanm [ tile ] . sf | = flags ;
2009-11-15 09:10:50 +00:00
2015-05-03 07:05:04 +00:00
if ( havexoffset )
picanm [ tile ] . xofs = xoffset ;
else if ( texstatus = = 0 )
picanm [ tile ] . xofs = 0 ;
2008-11-24 11:31:05 +00:00
2015-05-03 07:05:04 +00:00
if ( haveyoffset )
picanm [ tile ] . yofs = yoffset ;
else if ( texstatus = = 0 )
picanm [ tile ] . yofs = 0 ;
2019-07-23 15:56:39 +00:00
if ( haveextra )
picanm [ tile ] . extra = extra ;
2008-11-24 11:31:05 +00:00
}
break ;
2015-04-12 08:07:30 +00:00
case T_COPYTILE :
{
char * blockend ;
int32_t tile = - 1 , source ;
int32_t havetile = 0 , havexoffset = 0 , haveyoffset = 0 ;
2019-10-15 21:38:01 +00:00
int32_t xoffset = - 1024 , yoffset = - 1024 ;
2015-04-12 08:07:30 +00:00
int32_t flags = 0 ;
int32_t tsiz = 0 ;
2019-10-15 21:38:01 +00:00
int32_t temppal = - 1 ;
int32_t tempsource = - 1 ;
2015-04-12 08:07:30 +00:00
static const tokenlist copytiletokens [ ] =
{
{ " tile " , T_TILE } ,
{ " pal " , T_PAL } ,
{ " xoffset " , T_XOFFSET } ,
{ " xoff " , T_XOFFSET } ,
{ " yoffset " , T_YOFFSET } ,
{ " yoff " , T_YOFFSET } ,
{ " texhitscan " , T_TEXHITSCAN } ,
{ " nofullbright " , T_NOFULLBRIGHT } ,
} ;
if ( scriptfile_getsymbol ( script , & tile ) ) break ;
source = tile ; // without a "tile" token, we still palettize self by default
if ( scriptfile_getbraces ( script , & blockend ) ) break ;
while ( script - > textptr < blockend )
{
int32_t token = getatoken ( script , copytiletokens , ARRAY_SIZE ( copytiletokens ) ) ;
switch ( token )
{
case T_TILE :
{
scriptfile_getsymbol ( script , & tempsource ) ;
if ( check_tile ( " copytile " , tempsource , script , cmdtokptr ) )
break ;
source = tempsource ;
havetile = 1 ;
break ;
}
case T_PAL :
{
scriptfile_getsymbol ( script , & temppal ) ;
// palettize self case
if ( ! havetile )
{
if ( check_tile ( " copytile " , source , script , cmdtokptr ) )
break ;
havetile = 1 ;
}
if ( EDUKE32_PREDICT_FALSE ( ( unsigned ) temppal > = MAXPALOOKUPS - RESERVEDPALS ) )
{
initprintf ( " Error: copytile 'palette number' out of range (max=%d) \n " ,
MAXPALOOKUPS - RESERVEDPALS - 1 ) ;
break ;
}
break ;
}
case T_XOFFSET :
havexoffset = 1 ;
scriptfile_getsymbol ( script , & xoffset ) ; break ;
case T_YOFFSET :
haveyoffset = 1 ;
scriptfile_getsymbol ( script , & yoffset ) ; break ;
case T_TEXHITSCAN :
flags | = PICANM_TEXHITSCAN_BIT ;
break ;
case T_NOFULLBRIGHT :
flags | = PICANM_NOFULLBRIGHT_BIT ;
break ;
default :
break ;
}
}
if ( check_tile ( " copytile " , tile , script , cmdtokptr ) )
break ;
2019-10-15 21:38:01 +00:00
if ( ! havetile )
2015-04-12 08:07:30 +00:00
{
2019-10-15 21:38:01 +00:00
// if !havetile, we have never confirmed a valid source
2015-04-12 08:07:30 +00:00
if ( check_tile ( " copytile " , source , script , cmdtokptr ) )
break ;
}
2019-10-15 21:38:01 +00:00
tileCopy ( tile , tempsource , temppal , xoffset , yoffset , flags ) ;
2015-04-12 08:07:30 +00:00
}
break ;
2008-11-24 09:22:07 +00:00
case T_IMPORTTILE :
{
2015-05-03 07:05:04 +00:00
int32_t tile ;
2012-04-04 18:58:19 +00:00
char * fn ;
2008-11-24 09:22:07 +00:00
if ( scriptfile_getsymbol ( script , & tile ) ) break ;
if ( scriptfile_getstring ( script , & fn ) ) break ;
2015-05-03 07:05:04 +00:00
if ( check_tile ( " importtile " , tile , script , cmdtokptr ) )
2012-04-04 18:58:19 +00:00
break ;
2008-11-24 09:22:07 +00:00
2019-10-15 21:38:01 +00:00
int32_t const texstatus = tileImportFromTexture ( fn , tile , 255 , 0 ) ;
2015-09-23 17:54:50 +00:00
if ( texstatus = = - 3 )
initprintf ( " Error: No palette loaded, in importtile definition near line %s:%d \n " ,
script - > filename , scriptfile_getlinum ( script , cmdtokptr ) ) ;
2015-12-23 04:06:28 +00:00
if ( texstatus = = - ( 3 < < 8 ) )
2015-05-03 07:05:04 +00:00
initprintf ( " Error: \" %s \" has more than one tile, in importtile definition near line %s:%d \n " ,
fn , script - > filename , scriptfile_getlinum ( script , cmdtokptr ) ) ;
if ( texstatus < 0 )
2012-04-04 18:58:19 +00:00
break ;
2019-10-08 20:23:48 +00:00
picanm [ tile ] = { } ;
2012-04-04 18:58:19 +00:00
2008-11-24 09:22:07 +00:00
break ;
}
2006-04-26 01:25:18 +00:00
case T_DUMMYTILE :
2006-11-13 23:12:47 +00:00
{
2012-04-04 18:58:19 +00:00
int32_t tile , xsiz , ysiz ;
2006-04-26 01:25:18 +00:00
2006-11-13 23:12:47 +00:00
if ( scriptfile_getsymbol ( script , & tile ) ) break ;
if ( scriptfile_getsymbol ( script , & xsiz ) ) break ;
if ( scriptfile_getsymbol ( script , & ysiz ) ) break ;
2006-08-04 04:01:17 +00:00
2015-04-12 08:06:51 +00:00
if ( check_tile ( " dummytile " , tile , script , cmdtokptr ) )
break ;
2015-04-09 07:52:28 +00:00
2019-10-15 21:29:47 +00:00
tileSetDummy ( tile , xsiz , ysiz ) ;
2006-11-13 23:12:47 +00:00
break ;
}
2006-04-26 01:25:18 +00:00
case T_DUMMYTILERANGE :
2006-11-13 23:12:47 +00:00
{
2012-04-04 18:58:19 +00:00
int32_t tile1 , tile2 , xsiz , ysiz , i ;
2006-11-13 23:12:47 +00:00
Ensure that anywhere the def parser takes a tilenum or palnum accepts defined tokens in addition to integer literals, if it doesn't already.
Affects fogpal, nofloorpalrange, setuptilerange, dummytilerange, undefinetilerange, definemodelframe, definevoxeltiles, texhitscanrange, nofullbrightrange, and light.
git-svn-id: https://svn.eduke32.com/eduke32@6896 1a8010ca-5511-0410-912e-c29ae57300e0
2018-05-23 05:43:35 +00:00
if ( scriptfile_getsymbol ( script , & tile1 ) ) break ;
if ( scriptfile_getsymbol ( script , & tile2 ) ) break ;
2006-11-13 23:12:47 +00:00
if ( scriptfile_getnumber ( script , & xsiz ) ) break ;
if ( scriptfile_getnumber ( script , & ysiz ) ) break ;
2012-04-04 18:58:19 +00:00
if ( check_tile_range ( " dummytilerange " , & tile1 , & tile2 , script , cmdtokptr ) )
break ;
2015-04-09 07:52:28 +00:00
if ( xsiz < 0 | | ysiz < 0 )
2012-04-04 18:58:19 +00:00
break ; // TODO: message
for ( i = tile1 ; i < = tile2 ; i + + )
2006-04-26 01:25:18 +00:00
{
2019-10-15 21:29:47 +00:00
tileSetDummy ( i , xsiz , ysiz ) ;
2006-04-26 01:25:18 +00:00
}
2012-04-04 18:58:19 +00:00
2006-11-13 23:12:47 +00:00
break ;
}
2006-04-26 01:25:18 +00:00
2015-04-09 07:52:28 +00:00
case T_UNDEFINETILE :
{
int32_t tile ;
if ( scriptfile_getsymbol ( script , & tile ) ) break ;
2015-04-12 08:06:51 +00:00
if ( check_tile ( " undefinetile " , tile , script , cmdtokptr ) )
break ;
2015-04-09 07:52:28 +00:00
2018-04-12 21:03:30 +00:00
tileDelete ( tile ) ;
2015-04-09 07:52:28 +00:00
break ;
}
case T_UNDEFINETILERANGE :
{
int32_t tile1 , tile2 ;
Ensure that anywhere the def parser takes a tilenum or palnum accepts defined tokens in addition to integer literals, if it doesn't already.
Affects fogpal, nofloorpalrange, setuptilerange, dummytilerange, undefinetilerange, definemodelframe, definevoxeltiles, texhitscanrange, nofullbrightrange, and light.
git-svn-id: https://svn.eduke32.com/eduke32@6896 1a8010ca-5511-0410-912e-c29ae57300e0
2018-05-23 05:43:35 +00:00
if ( scriptfile_getsymbol ( script , & tile1 ) ) break ;
if ( scriptfile_getsymbol ( script , & tile2 ) ) break ;
2015-04-09 07:52:28 +00:00
if ( check_tile_range ( " undefinetilerange " , & tile1 , & tile2 , script , cmdtokptr ) )
break ;
2016-08-27 01:41:21 +00:00
for ( bssize_t i = tile1 ; i < = tile2 ; i + + )
2018-04-12 21:03:30 +00:00
tileDelete ( i ) ;
2015-04-09 07:52:28 +00:00
break ;
}
2006-04-24 19:04:22 +00:00
case T_DEFINEMODEL :
2006-11-13 23:12:47 +00:00
{
char * modelfn ;
double scale ;
2009-01-09 09:29:17 +00:00
int32_t shadeoffs ;
2006-04-24 19:04:22 +00:00
2006-11-13 23:12:47 +00:00
if ( scriptfile_getstring ( script , & modelfn ) ) break ;
if ( scriptfile_getdouble ( script , & scale ) ) break ;
if ( scriptfile_getnumber ( script , & shadeoffs ) ) break ;
2006-04-23 06:44:19 +00:00
2011-03-04 08:50:58 +00:00
# ifdef USE_OPENGL
2006-11-13 23:12:47 +00:00
lastmodelid = md_loadmodel ( modelfn ) ;
2014-10-25 03:36:34 +00:00
if ( EDUKE32_PREDICT_FALSE ( lastmodelid < 0 ) )
2007-12-12 17:42:14 +00:00
{
2013-09-13 20:23:59 +00:00
initprintf ( " Warning: Failed loading MD2/MD3 model \" %s \" \n " , modelfn ) ;
2006-11-13 23:12:47 +00:00
break ;
2006-04-24 19:04:22 +00:00
}
2012-01-17 04:31:59 +00:00
md_setmisc ( lastmodelid , ( float ) scale , shadeoffs , 0.0 , 0.0 , 0 ) ;
2013-02-07 21:01:24 +00:00
# ifdef POLYMER
2013-05-17 03:44:09 +00:00
if ( glrendmode = = REND_POLYMER )
2011-06-19 18:30:32 +00:00
md3postload_polymer ( ( md3model_t * ) models [ lastmodelid ] ) ;
2013-02-07 21:01:24 +00:00
# endif
2006-04-23 06:44:19 +00:00
# endif
2006-11-13 23:12:47 +00:00
modelskin = lastmodelskin = 0 ;
seenframe = 0 ;
}
break ;
case T_DEFINEMODELFRAME :
{
2008-07-24 11:16:20 +00:00
char * framename ;
2011-03-04 08:50:58 +00:00
# ifdef USE_OPENGL
2008-07-24 11:16:20 +00:00
char happy = 1 ;
2013-01-08 06:17:10 +00:00
int32_t tilex ;
2008-07-24 11:16:20 +00:00
# endif
2013-01-08 06:17:10 +00:00
int32_t ftilenume , ltilenume ;
2006-11-13 23:12:47 +00:00
if ( scriptfile_getstring ( script , & framename ) ) break ;
Ensure that anywhere the def parser takes a tilenum or palnum accepts defined tokens in addition to integer literals, if it doesn't already.
Affects fogpal, nofloorpalrange, setuptilerange, dummytilerange, undefinetilerange, definemodelframe, definevoxeltiles, texhitscanrange, nofullbrightrange, and light.
git-svn-id: https://svn.eduke32.com/eduke32@6896 1a8010ca-5511-0410-912e-c29ae57300e0
2018-05-23 05:43:35 +00:00
if ( scriptfile_getsymbol ( script , & ftilenume ) ) break ; //first tile number
if ( scriptfile_getsymbol ( script , & ltilenume ) ) break ; //last tile number (inclusive)
2012-04-04 18:58:19 +00:00
if ( check_tile_range ( " definemodelframe " , & ftilenume , & ltilenume , script , cmdtokptr ) )
break ;
2006-04-24 19:04:22 +00:00
2014-10-25 03:36:34 +00:00
if ( EDUKE32_PREDICT_FALSE ( lastmodelid < 0 ) )
2007-12-12 17:42:14 +00:00
{
2012-01-27 15:03:18 +00:00
# ifdef USE_OPENGL
2013-09-13 20:23:59 +00:00
initprintf ( " Warning: Ignoring frame definition. \n " ) ;
2012-01-27 15:03:18 +00:00
# endif
2006-11-13 23:12:47 +00:00
break ;
}
2011-03-04 08:50:58 +00:00
# ifdef USE_OPENGL
2007-12-12 17:42:14 +00:00
for ( tilex = ftilenume ; tilex < = ltilenume & & happy ; tilex + + )
{
2007-12-20 19:14:38 +00:00
switch ( md_defineframe ( lastmodelid , framename , tilex , max ( 0 , modelskin ) , 0.0f , 0 ) )
2007-12-12 17:42:14 +00:00
{
2006-11-13 23:12:47 +00:00
case - 1 :
happy = 0 ; break ; // invalid model id!?
case - 2 :
2013-09-13 20:23:59 +00:00
initprintf ( " Invalid tile number on line %s:%d \n " ,
2006-11-13 23:12:47 +00:00
script - > filename , scriptfile_getlinum ( script , cmdtokptr ) ) ;
happy = 0 ;
2006-04-24 19:04:22 +00:00
break ;
2006-11-13 23:12:47 +00:00
case - 3 :
2013-09-13 20:23:59 +00:00
initprintf ( " Invalid frame name on line %s:%d \n " ,
2006-11-13 23:12:47 +00:00
script - > filename , scriptfile_getlinum ( script , cmdtokptr ) ) ;
happy = 0 ;
2006-04-24 19:04:22 +00:00
break ;
2011-06-19 18:30:32 +00:00
default :
break ;
2006-04-24 19:04:22 +00:00
}
2006-11-13 23:12:47 +00:00
}
2006-04-23 06:44:19 +00:00
# endif
2006-11-13 23:12:47 +00:00
seenframe = 1 ;
}
break ;
case T_DEFINEMODELANIM :
{
char * startframe , * endframe ;
2009-01-09 09:29:17 +00:00
int32_t flags ;
2006-11-13 23:12:47 +00:00
double dfps ;
if ( scriptfile_getstring ( script , & startframe ) ) break ;
if ( scriptfile_getstring ( script , & endframe ) ) break ;
if ( scriptfile_getdouble ( script , & dfps ) ) break ; //animation frame rate
if ( scriptfile_getnumber ( script , & flags ) ) break ;
2014-10-25 03:36:34 +00:00
if ( EDUKE32_PREDICT_FALSE ( lastmodelid < 0 ) )
2007-12-12 17:42:14 +00:00
{
2012-01-27 15:03:18 +00:00
# ifdef USE_OPENGL
2013-09-13 20:23:59 +00:00
initprintf ( " Warning: Ignoring animation definition. \n " ) ;
2012-01-27 15:03:18 +00:00
# endif
2006-11-13 23:12:47 +00:00
break ;
2006-04-24 19:04:22 +00:00
}
2011-03-04 08:50:58 +00:00
# ifdef USE_OPENGL
2009-01-09 09:29:17 +00:00
switch ( md_defineanimation ( lastmodelid , startframe , endframe , ( int32_t ) ( dfps * ( 65536.0 * .001 ) ) , flags ) )
2007-12-12 17:42:14 +00:00
{
2006-11-13 23:12:47 +00:00
case 0 :
break ;
case - 1 :
break ; // invalid model id!?
case - 2 :
2013-09-13 20:23:59 +00:00
initprintf ( " Invalid starting frame name on line %s:%d \n " ,
2006-11-13 23:12:47 +00:00
script - > filename , scriptfile_getlinum ( script , cmdtokptr ) ) ;
break ;
case - 3 :
2013-09-13 20:23:59 +00:00
initprintf ( " Invalid ending frame name on line %s:%d \n " ,
2006-11-13 23:12:47 +00:00
script - > filename , scriptfile_getlinum ( script , cmdtokptr ) ) ;
break ;
case - 4 :
2013-09-13 20:23:59 +00:00
initprintf ( " Out of memory on line %s:%d \n " ,
2006-11-13 23:12:47 +00:00
script - > filename , scriptfile_getlinum ( script , cmdtokptr ) ) ;
break ;
}
# endif
}
break ;
2006-04-24 19:04:22 +00:00
case T_DEFINEMODELSKIN :
2006-11-13 23:12:47 +00:00
{
2012-03-28 19:41:39 +00:00
int32_t palnum ;
char * skinfn ;
2006-11-13 23:12:47 +00:00
if ( scriptfile_getsymbol ( script , & palnum ) ) break ;
if ( scriptfile_getstring ( script , & skinfn ) ) break ; //skin filename
// if we see a sequence of definemodelskin, then a sequence of definemodelframe,
// and then a definemodelskin, we need to increment the skin counter.
//
// definemodel "mymodel.md2" 1 1
// definemodelskin 0 "normal.png" // skin 0
// definemodelskin 21 "normal21.png"
// definemodelframe "foo" 1000 1002 // these use skin 0
// definemodelskin 0 "wounded.png" // skin 1
// definemodelskin 21 "wounded21.png"
// definemodelframe "foo2" 1003 1004 // these use skin 1
// selectmodelskin 0 // resets to skin 0
// definemodelframe "foo3" 1005 1006 // these use skin 0
2007-12-12 17:42:14 +00:00
if ( seenframe ) { modelskin = + + lastmodelskin ; }
2006-11-13 23:12:47 +00:00
seenframe = 0 ;
2006-04-23 06:44:19 +00:00
2019-12-07 09:31:27 +00:00
if ( fileSystem . FileExists ( skinfn ) )
2012-03-28 19:41:39 +00:00
break ;
2012-03-10 09:44:54 +00:00
2011-03-04 08:50:58 +00:00
# ifdef USE_OPENGL
2015-03-28 09:49:11 +00:00
switch ( md_defineskin ( lastmodelid , skinfn , palnum , max ( 0 , modelskin ) , 0 , 0.0f , 1.0f , 1.0f , 0 ) )
2007-12-12 17:42:14 +00:00
{
2006-11-13 23:12:47 +00:00
case 0 :
break ;
case - 1 :
break ; // invalid model id!?
case - 2 :
2013-09-13 20:23:59 +00:00
initprintf ( " Invalid skin filename on line %s:%d \n " ,
2006-11-13 23:12:47 +00:00
script - > filename , scriptfile_getlinum ( script , cmdtokptr ) ) ;
break ;
case - 3 :
2013-09-13 20:23:59 +00:00
initprintf ( " Invalid palette number on line %s:%d \n " ,
2006-11-13 23:12:47 +00:00
script - > filename , scriptfile_getlinum ( script , cmdtokptr ) ) ;
break ;
case - 4 :
2013-09-13 20:23:59 +00:00
initprintf ( " Out of memory on line %s:%d \n " ,
2006-11-13 23:12:47 +00:00
script - > filename , scriptfile_getlinum ( script , cmdtokptr ) ) ;
break ;
2006-04-24 19:04:22 +00:00
}
2006-11-13 23:12:47 +00:00
# endif
}
break ;
2006-04-24 19:04:22 +00:00
case T_SELECTMODELSKIN :
2006-11-13 23:12:47 +00:00
{
if ( scriptfile_getsymbol ( script , & modelskin ) ) break ;
}
break ;
2006-04-24 19:04:22 +00:00
case T_DEFINEVOXEL :
2006-11-13 23:12:47 +00:00
{
char * fn ;
2006-04-24 19:04:22 +00:00
2014-12-26 17:29:48 +00:00
if ( EDUKE32_PREDICT_FALSE ( scriptfile_getstring ( script , & fn ) ) )
break ; //voxel filename
2006-04-24 19:04:22 +00:00
2019-09-19 20:02:45 +00:00
while ( nextvoxid < MAXVOXELS & & ( voxreserve [ nextvoxid > > 3 ] & ( 1 < < ( nextvoxid & 7 ) ) ) )
nextvoxid + + ;
2014-10-25 03:36:34 +00:00
if ( EDUKE32_PREDICT_FALSE ( nextvoxid = = MAXVOXELS ) )
2007-12-12 17:42:14 +00:00
{
2014-12-26 17:29:52 +00:00
initprintf ( " Maximum number of voxels (%d) already defined. \n " , MAXVOXELS ) ;
2006-11-13 23:12:47 +00:00
break ;
}
2006-04-23 06:44:19 +00:00
2014-10-25 03:36:34 +00:00
if ( EDUKE32_PREDICT_FALSE ( qloadkvx ( nextvoxid , fn ) ) )
2007-12-12 17:42:14 +00:00
{
2013-09-13 20:23:59 +00:00
initprintf ( " Failure loading voxel file \" %s \" \n " , fn ) ;
2006-11-13 23:12:47 +00:00
break ;
}
2006-04-23 06:44:19 +00:00
2006-11-13 23:12:47 +00:00
lastvoxid = nextvoxid + + ;
}
break ;
2006-04-24 19:04:22 +00:00
case T_DEFINEVOXELTILES :
2006-11-13 23:12:47 +00:00
{
2009-01-09 09:29:17 +00:00
int32_t ftilenume , ltilenume , tilex ;
2006-11-13 23:12:47 +00:00
Ensure that anywhere the def parser takes a tilenum or palnum accepts defined tokens in addition to integer literals, if it doesn't already.
Affects fogpal, nofloorpalrange, setuptilerange, dummytilerange, undefinetilerange, definemodelframe, definevoxeltiles, texhitscanrange, nofullbrightrange, and light.
git-svn-id: https://svn.eduke32.com/eduke32@6896 1a8010ca-5511-0410-912e-c29ae57300e0
2018-05-23 05:43:35 +00:00
if ( scriptfile_getsymbol ( script , & ftilenume ) ) break ; //1st tile #
if ( scriptfile_getsymbol ( script , & ltilenume ) ) break ; //last tile #
2006-11-13 23:12:47 +00:00
2012-04-04 18:58:19 +00:00
if ( check_tile_range ( " definevoxeltiles " , & ftilenume , & ltilenume , script , cmdtokptr ) )
2006-11-13 23:12:47 +00:00
break ;
2006-04-24 19:04:22 +00:00
2014-10-25 03:36:34 +00:00
if ( EDUKE32_PREDICT_FALSE ( lastvoxid < 0 ) )
2007-12-12 17:42:14 +00:00
{
2013-09-13 20:23:59 +00:00
initprintf ( " Warning: Ignoring voxel tiles definition. \n " ) ;
2006-11-13 23:12:47 +00:00
break ;
}
2011-03-04 08:50:58 +00:00
2007-12-12 17:42:14 +00:00
for ( tilex = ftilenume ; tilex < = ltilenume ; tilex + + )
2006-11-13 23:12:47 +00:00
tiletovox [ tilex ] = lastvoxid ;
}
break ;
2006-04-23 06:44:19 +00:00
2006-11-13 23:12:47 +00:00
// NEW (ENCOURAGED) DEFINITION SYNTAX
2006-04-24 19:04:22 +00:00
case T_MODEL :
2006-11-13 23:12:47 +00:00
{
char * modelend , * modelfn ;
2012-01-17 04:31:59 +00:00
double scale = 1.0 , mzadd = 0.0 , myoffset = 0.0 ;
2009-01-09 09:29:17 +00:00
int32_t shadeoffs = 0 , pal = 0 , flags = 0 ;
2019-07-19 01:49:19 +00:00
uint8_t usedframebitmap [ ( 1024 + 7 ) > > 3 ] ;
2011-06-19 18:30:32 +00:00
2012-01-07 17:48:55 +00:00
int32_t model_ok = 1 ;
2010-08-02 08:13:51 +00:00
static const tokenlist modeltokens [ ] =
{
{ " scale " , T_SCALE } ,
{ " shade " , T_SHADE } ,
{ " zadd " , T_ZADD } ,
2012-01-17 04:31:59 +00:00
{ " yoffset " , T_YOFFSET } ,
2010-08-02 08:13:51 +00:00
{ " frame " , T_FRAME } ,
{ " anim " , T_ANIM } ,
{ " skin " , T_SKIN } ,
{ " detail " , T_DETAIL } ,
{ " glow " , T_GLOW } ,
{ " specular " , T_SPECULAR } ,
{ " normal " , T_NORMAL } ,
{ " hud " , T_HUD } ,
{ " flags " , T_FLAGS } ,
} ;
2011-07-01 12:22:12 +00:00
Bmemset ( usedframebitmap , 0 , sizeof ( usedframebitmap ) ) ;
2006-11-13 23:12:47 +00:00
modelskin = lastmodelskin = 0 ;
seenframe = 0 ;
2006-04-23 06:44:19 +00:00
2006-11-13 23:12:47 +00:00
if ( scriptfile_getstring ( script , & modelfn ) ) break ;
2008-07-20 04:12:52 +00:00
if ( scriptfile_getbraces ( script , & modelend ) ) break ;
2011-03-04 08:50:58 +00:00
# ifdef USE_OPENGL
2006-11-13 23:12:47 +00:00
lastmodelid = md_loadmodel ( modelfn ) ;
2014-10-25 03:36:34 +00:00
if ( EDUKE32_PREDICT_FALSE ( lastmodelid < 0 ) )
2007-12-12 17:42:14 +00:00
{
2013-09-13 20:23:59 +00:00
initprintf ( " Warning: Failed loading MD2/MD3 model \" %s \" \n " , modelfn ) ;
2008-07-20 04:12:52 +00:00
script - > textptr = modelend + 1 ;
2006-11-13 23:12:47 +00:00
break ;
}
2006-04-23 06:44:19 +00:00
# endif
2007-12-12 17:42:14 +00:00
while ( script - > textptr < modelend )
{
2014-03-22 09:25:15 +00:00
int32_t token = getatoken ( script , modeltokens , ARRAY_SIZE ( modeltokens ) ) ;
2007-12-12 17:42:14 +00:00
switch ( token )
{
2013-09-13 20:23:59 +00:00
//case T_ERROR: initprintf("Error on line %s:%d in model tokens\n", script->filename,script->linenum); break;
2006-11-13 23:12:47 +00:00
case T_SCALE :
scriptfile_getdouble ( script , & scale ) ; break ;
case T_SHADE :
scriptfile_getnumber ( script , & shadeoffs ) ; break ;
case T_ZADD :
scriptfile_getdouble ( script , & mzadd ) ; break ;
2012-01-17 04:31:59 +00:00
case T_YOFFSET :
scriptfile_getdouble ( script , & myoffset ) ; break ;
2007-12-20 19:14:38 +00:00
case T_FLAGS :
scriptfile_getnumber ( script , & flags ) ; break ;
2006-11-13 23:12:47 +00:00
case T_FRAME :
{
char * frametokptr = script - > ltextptr ;
2013-01-08 06:17:10 +00:00
char * frameend , * framename = 0 ;
# ifdef USE_OPENGL
char happy = 1 ;
int32_t tilex = 0 , framei ;
# endif
int32_t ftilenume = - 1 , ltilenume = - 1 ;
2008-12-10 11:36:53 +00:00
double smoothduration = 0.1f ;
2006-11-13 23:12:47 +00:00
2010-08-02 08:13:51 +00:00
static const tokenlist modelframetokens [ ] =
{
{ " pal " , T_PAL } ,
{ " frame " , T_FRAME } ,
{ " name " , T_FRAME } ,
{ " tile " , T_TILE } ,
{ " tile0 " , T_TILE0 } ,
{ " tile1 " , T_TILE1 } ,
{ " smoothduration " , T_SMOOTHDURATION } ,
} ;
2006-11-13 23:12:47 +00:00
if ( scriptfile_getbraces ( script , & frameend ) ) break ;
2007-12-12 17:42:14 +00:00
while ( script - > textptr < frameend )
{
2014-03-22 09:25:15 +00:00
switch ( getatoken ( script , modelframetokens , ARRAY_SIZE ( modelframetokens ) ) )
2007-12-12 17:42:14 +00:00
{
2007-12-20 19:14:38 +00:00
case T_PAL :
Ensure that anywhere the def parser takes a tilenum or palnum accepts defined tokens in addition to integer literals, if it doesn't already.
Affects fogpal, nofloorpalrange, setuptilerange, dummytilerange, undefinetilerange, definemodelframe, definevoxeltiles, texhitscanrange, nofullbrightrange, and light.
git-svn-id: https://svn.eduke32.com/eduke32@6896 1a8010ca-5511-0410-912e-c29ae57300e0
2018-05-23 05:43:35 +00:00
scriptfile_getsymbol ( script , & pal ) ; break ;
2006-11-13 23:12:47 +00:00
case T_FRAME :
scriptfile_getstring ( script , & framename ) ; break ;
case T_TILE :
scriptfile_getsymbol ( script , & ftilenume ) ; ltilenume = ftilenume ; break ;
case T_TILE0 :
scriptfile_getsymbol ( script , & ftilenume ) ; break ; //first tile number
case T_TILE1 :
scriptfile_getsymbol ( script , & ltilenume ) ; break ; //last tile number (inclusive)
2007-04-12 03:09:41 +00:00
case T_SMOOTHDURATION :
scriptfile_getdouble ( script , & smoothduration ) ; break ;
2006-11-13 23:12:47 +00:00
}
}
2012-04-04 18:58:19 +00:00
if ( check_tile_range ( " model: frame " , & ftilenume , & ltilenume , script , frametokptr ) )
2007-12-12 17:42:14 +00:00
{
2012-04-04 18:58:19 +00:00
model_ok = 0 ;
break ;
2006-11-13 23:12:47 +00:00
}
2014-10-25 03:36:34 +00:00
if ( EDUKE32_PREDICT_FALSE ( lastmodelid < 0 ) )
2007-12-12 17:42:14 +00:00
{
2012-01-27 15:03:18 +00:00
# ifdef USE_OPENGL
2015-05-26 00:48:10 +00:00
initprintf ( " Warning: ignoring frame definition on line %s:%d. \n " ,
script - > filename , scriptfile_getlinum ( script , frametokptr ) ) ;
2012-01-27 15:03:18 +00:00
# endif
2006-11-13 23:12:47 +00:00
break ;
}
2015-03-24 00:40:48 +00:00
if ( smoothduration > 1.0 )
{
2015-05-26 00:48:10 +00:00
initprintf ( " Warning: smoothduration out of range on line %s:%d. \n " ,
script - > filename , scriptfile_getlinum ( script , frametokptr ) ) ;
2015-03-24 00:40:48 +00:00
smoothduration = 1.0 ;
}
2011-03-04 08:50:58 +00:00
# ifdef USE_OPENGL
2007-12-12 17:42:14 +00:00
for ( tilex = ftilenume ; tilex < = ltilenume & & happy ; tilex + + )
{
2011-06-19 18:30:32 +00:00
framei = md_defineframe ( lastmodelid , framename , tilex , max ( 0 , modelskin ) , smoothduration , pal ) ;
switch ( framei )
2007-12-12 17:42:14 +00:00
{
2006-11-13 23:12:47 +00:00
case - 1 :
happy = 0 ; break ; // invalid model id!?
case - 2 :
2013-09-13 20:23:59 +00:00
initprintf ( " Invalid tile number on line %s:%d \n " ,
2006-11-13 23:12:47 +00:00
script - > filename , scriptfile_getlinum ( script , frametokptr ) ) ;
happy = 0 ;
break ;
case - 3 :
2013-09-13 20:23:59 +00:00
initprintf ( " Invalid frame name on line %s:%d \n " ,
2006-11-13 23:12:47 +00:00
script - > filename , scriptfile_getlinum ( script , frametokptr ) ) ;
happy = 0 ;
break ;
2011-06-19 18:30:32 +00:00
default :
if ( framei > = 0 & & framei < 1024 )
2019-08-04 02:51:50 +00:00
usedframebitmap [ framei > > 3 ] | = pow2char [ framei & 7 ] ;
2006-11-13 23:12:47 +00:00
}
2012-01-07 17:48:55 +00:00
model_ok & = happy ;
2006-11-13 23:12:47 +00:00
}
2006-04-23 06:44:19 +00:00
# endif
2006-11-13 23:12:47 +00:00
seenframe = 1 ;
}
break ;
case T_ANIM :
{
char * animtokptr = script - > ltextptr ;
char * animend , * startframe = 0 , * endframe = 0 , happy = 1 ;
2009-01-09 09:29:17 +00:00
int32_t flags = 0 ;
2006-11-13 23:12:47 +00:00
double dfps = 1.0 ;
2010-08-02 08:13:51 +00:00
static const tokenlist modelanimtokens [ ] =
{
{ " frame0 " , T_FRAME0 } ,
{ " frame1 " , T_FRAME1 } ,
{ " fps " , T_FPS } ,
{ " flags " , T_FLAGS } ,
} ;
2006-11-13 23:12:47 +00:00
if ( scriptfile_getbraces ( script , & animend ) ) break ;
2007-12-12 17:42:14 +00:00
while ( script - > textptr < animend )
{
2014-03-22 09:25:15 +00:00
switch ( getatoken ( script , modelanimtokens , ARRAY_SIZE ( modelanimtokens ) ) )
2007-12-12 17:42:14 +00:00
{
2006-11-13 23:12:47 +00:00
case T_FRAME0 :
scriptfile_getstring ( script , & startframe ) ; break ;
case T_FRAME1 :
scriptfile_getstring ( script , & endframe ) ; break ;
case T_FPS :
scriptfile_getdouble ( script , & dfps ) ; break ; //animation frame rate
case T_FLAGS :
scriptfile_getsymbol ( script , & flags ) ; break ;
2006-04-24 19:04:22 +00:00
}
2006-11-13 23:12:47 +00:00
}
2014-10-25 03:36:34 +00:00
if ( EDUKE32_PREDICT_FALSE ( ! startframe ) ) initprintf ( " Error: missing 'start frame' for anim definition near line %s:%d \n " , script - > filename , scriptfile_getlinum ( script , animtokptr ) ) , happy = 0 ;
if ( EDUKE32_PREDICT_FALSE ( ! endframe ) ) initprintf ( " Error: missing 'end frame' for anim definition near line %s:%d \n " , script - > filename , scriptfile_getlinum ( script , animtokptr ) ) , happy = 0 ;
2012-01-07 17:48:55 +00:00
model_ok & = happy ;
2014-10-25 03:36:34 +00:00
if ( EDUKE32_PREDICT_FALSE ( ! happy ) ) break ;
2006-11-13 23:12:47 +00:00
2014-10-25 03:36:34 +00:00
if ( EDUKE32_PREDICT_FALSE ( lastmodelid < 0 ) )
2007-12-12 17:42:14 +00:00
{
2012-01-27 15:03:18 +00:00
# ifdef USE_OPENGL
2013-09-13 20:23:59 +00:00
initprintf ( " Warning: Ignoring animation definition. \n " ) ;
2012-01-27 15:03:18 +00:00
# endif
2006-04-24 19:04:22 +00:00
break ;
2006-11-13 23:12:47 +00:00
}
2011-03-04 08:50:58 +00:00
# ifdef USE_OPENGL
2009-01-09 09:29:17 +00:00
switch ( md_defineanimation ( lastmodelid , startframe , endframe , ( int32_t ) ( dfps * ( 65536.0 * .001 ) ) , flags ) )
2007-12-12 17:42:14 +00:00
{
2006-11-13 23:12:47 +00:00
case 0 :
break ;
case - 1 :
break ; // invalid model id!?
case - 2 :
2013-09-13 20:23:59 +00:00
initprintf ( " Invalid starting frame name on line %s:%d \n " ,
2006-11-13 23:12:47 +00:00
script - > filename , scriptfile_getlinum ( script , animtokptr ) ) ;
2012-01-07 17:48:55 +00:00
model_ok = 0 ;
2006-11-13 23:12:47 +00:00
break ;
case - 3 :
2013-09-13 20:23:59 +00:00
initprintf ( " Invalid ending frame name on line %s:%d \n " ,
2006-11-13 23:12:47 +00:00
script - > filename , scriptfile_getlinum ( script , animtokptr ) ) ;
2012-01-07 17:48:55 +00:00
model_ok = 0 ;
2006-11-13 23:12:47 +00:00
break ;
case - 4 :
2013-09-13 20:23:59 +00:00
initprintf ( " Out of memory on line %s:%d \n " ,
2006-11-13 23:12:47 +00:00
script - > filename , scriptfile_getlinum ( script , animtokptr ) ) ;
2012-01-07 17:48:55 +00:00
model_ok = 0 ;
2006-11-13 23:12:47 +00:00
break ;
}
2006-04-23 06:44:19 +00:00
# endif
2007-12-12 17:42:14 +00:00
}
break ;
2009-04-28 22:56:43 +00:00
case T_SKIN : case T_DETAIL : case T_GLOW : case T_SPECULAR : case T_NORMAL :
2006-11-13 23:12:47 +00:00
{
char * skintokptr = script - > ltextptr ;
2012-03-28 19:41:39 +00:00
char * skinend , * skinfn = 0 ;
int32_t palnum = 0 , surfnum = 0 ;
2009-03-28 15:19:44 +00:00
double param = 1.0 , specpower = 1.0 , specfactor = 1.0 ;
2015-03-28 09:49:11 +00:00
# ifdef USE_OPENGL
int32_t flags = 0 ;
# endif
2006-11-13 23:12:47 +00:00
2010-08-02 08:13:51 +00:00
static const tokenlist modelskintokens [ ] =
{
{ " pal " , T_PAL } ,
{ " file " , T_FILE } ,
{ " surf " , T_SURF } ,
{ " surface " , T_SURF } ,
{ " intensity " , T_PARAM } ,
{ " scale " , T_PARAM } ,
{ " detailscale " , T_PARAM } ,
2012-03-26 05:06:31 +00:00
{ " specpower " , T_SPECPOWER } , { " specularpower " , T_SPECPOWER } , { " parallaxscale " , T_SPECPOWER } ,
{ " specfactor " , T_SPECFACTOR } , { " specularfactor " , T_SPECFACTOR } , { " parallaxbias " , T_SPECFACTOR } ,
2015-03-28 09:49:11 +00:00
{ " nocompress " , T_NOCOMPRESS } ,
{ " nodownsize " , T_NODOWNSIZE } ,
2015-03-28 09:49:37 +00:00
{ " forcefilter " , T_FORCEFILTER } ,
2016-05-02 18:29:35 +00:00
{ " artquality " , T_ARTQUALITY } ,
2010-08-02 08:13:51 +00:00
} ;
2006-11-13 23:12:47 +00:00
if ( scriptfile_getbraces ( script , & skinend ) ) break ;
2007-12-12 17:42:14 +00:00
while ( script - > textptr < skinend )
{
2014-03-22 09:25:15 +00:00
switch ( getatoken ( script , modelskintokens , ARRAY_SIZE ( modelskintokens ) ) )
2007-12-12 17:42:14 +00:00
{
2006-11-13 23:12:47 +00:00
case T_PAL :
scriptfile_getsymbol ( script , & palnum ) ; break ;
2007-02-16 01:34:41 +00:00
case T_PARAM :
scriptfile_getdouble ( script , & param ) ; break ;
2009-03-28 15:19:44 +00:00
case T_SPECPOWER :
scriptfile_getdouble ( script , & specpower ) ; break ;
case T_SPECFACTOR :
scriptfile_getdouble ( script , & specfactor ) ; break ;
2006-11-13 23:12:47 +00:00
case T_FILE :
scriptfile_getstring ( script , & skinfn ) ; break ; //skin filename
case T_SURF :
scriptfile_getnumber ( script , & surfnum ) ; break ;
2015-03-28 09:49:11 +00:00
# ifdef USE_OPENGL
2015-03-28 09:49:37 +00:00
case T_FORCEFILTER :
flags | = HICR_FORCEFILTER ; break ;
2015-03-28 09:49:11 +00:00
# endif
2006-11-13 23:12:47 +00:00
}
}
2014-10-25 03:36:34 +00:00
if ( EDUKE32_PREDICT_FALSE ( ! skinfn ) )
2007-12-12 17:42:14 +00:00
{
2013-09-13 20:23:59 +00:00
initprintf ( " Error: missing 'skin filename' for skin definition near line %s:%d \n " , script - > filename , scriptfile_getlinum ( script , skintokptr ) ) ;
2012-01-07 17:48:55 +00:00
model_ok = 0 ;
2006-11-13 23:12:47 +00:00
break ;
}
if ( seenframe ) { modelskin = + + lastmodelskin ; }
seenframe = 0 ;
2006-04-23 06:44:19 +00:00
2007-12-20 19:14:38 +00:00
switch ( token )
2007-02-16 01:34:41 +00:00
{
2007-12-20 19:14:38 +00:00
case T_DETAIL :
2007-02-16 01:34:41 +00:00
palnum = DETAILPAL ;
param = 1.0f / param ;
2007-12-20 19:14:38 +00:00
break ;
case T_GLOW :
2007-02-16 01:34:41 +00:00
palnum = GLOWPAL ;
2007-12-20 19:14:38 +00:00
break ;
2009-04-28 22:56:43 +00:00
case T_SPECULAR :
palnum = SPECULARPAL ;
break ;
case T_NORMAL :
palnum = NORMALPAL ;
break ;
2007-12-20 19:14:38 +00:00
}
2007-02-16 01:34:41 +00:00
2019-12-07 09:31:27 +00:00
if ( fileSystem . FileExists ( skinfn ) )
2012-03-28 19:41:39 +00:00
break ;
2012-03-10 09:44:54 +00:00
2011-03-04 08:50:58 +00:00
# ifdef USE_OPENGL
2015-03-28 09:49:11 +00:00
switch ( md_defineskin ( lastmodelid , skinfn , palnum , max ( 0 , modelskin ) , surfnum , param , specpower , specfactor , flags ) )
2007-12-12 17:42:14 +00:00
{
2006-11-13 23:12:47 +00:00
case 0 :
break ;
case - 1 :
break ; // invalid model id!?
case - 2 :
2013-09-13 20:23:59 +00:00
initprintf ( " Invalid skin filename on line %s:%d \n " ,
2006-11-13 23:12:47 +00:00
script - > filename , scriptfile_getlinum ( script , skintokptr ) ) ;
2012-01-07 17:48:55 +00:00
model_ok = 0 ;
2006-11-13 23:12:47 +00:00
break ;
case - 3 :
2013-09-13 20:23:59 +00:00
initprintf ( " Invalid palette number on line %s:%d \n " ,
2006-11-13 23:12:47 +00:00
script - > filename , scriptfile_getlinum ( script , skintokptr ) ) ;
2012-01-07 17:48:55 +00:00
model_ok = 0 ;
2006-11-13 23:12:47 +00:00
break ;
case - 4 :
2013-09-13 20:23:59 +00:00
initprintf ( " Out of memory on line %s:%d \n " ,
2006-11-13 23:12:47 +00:00
script - > filename , scriptfile_getlinum ( script , skintokptr ) ) ;
2012-01-07 17:48:55 +00:00
model_ok = 0 ;
2006-11-13 23:12:47 +00:00
break ;
}
2006-04-23 06:44:19 +00:00
# endif
2007-12-12 17:42:14 +00:00
}
break ;
2006-11-13 23:12:47 +00:00
case T_HUD :
{
char * hudtokptr = script - > ltextptr ;
2013-01-08 06:17:10 +00:00
char * frameend ;
# ifdef USE_OPENGL
char happy = 1 ;
int32_t tilex = 0 ;
# endif
2014-09-30 04:06:57 +00:00
int32_t ftilenume = - 1 , ltilenume = - 1 , flags = 0 , fov = - 1 , angadd = 0 ;
double xadd = 0.0 , yadd = 0.0 , zadd = 0.0 ;
2006-11-13 23:12:47 +00:00
2010-08-02 08:13:51 +00:00
static const tokenlist modelhudtokens [ ] =
{
{ " tile " , T_TILE } ,
{ " tile0 " , T_TILE0 } ,
{ " tile1 " , T_TILE1 } ,
{ " xadd " , T_XADD } ,
{ " yadd " , T_YADD } ,
{ " zadd " , T_ZADD } ,
{ " angadd " , T_ANGADD } ,
2011-03-01 05:52:33 +00:00
{ " fov " , T_FOV } ,
2010-08-02 08:13:51 +00:00
{ " hide " , T_HIDE } ,
{ " nobob " , T_NOBOB } ,
{ " flipped " , T_FLIPPED } ,
{ " nodepth " , T_NODEPTH } ,
} ;
2006-11-13 23:12:47 +00:00
if ( scriptfile_getbraces ( script , & frameend ) ) break ;
2007-12-12 17:42:14 +00:00
while ( script - > textptr < frameend )
{
2014-03-22 09:25:15 +00:00
switch ( getatoken ( script , modelhudtokens , ARRAY_SIZE ( modelhudtokens ) ) )
2007-12-12 17:42:14 +00:00
{
2006-11-13 23:12:47 +00:00
case T_TILE :
scriptfile_getsymbol ( script , & ftilenume ) ; ltilenume = ftilenume ; break ;
case T_TILE0 :
scriptfile_getsymbol ( script , & ftilenume ) ; break ; //first tile number
case T_TILE1 :
scriptfile_getsymbol ( script , & ltilenume ) ; break ; //last tile number (inclusive)
case T_XADD :
scriptfile_getdouble ( script , & xadd ) ; break ;
case T_YADD :
scriptfile_getdouble ( script , & yadd ) ; break ;
case T_ZADD :
scriptfile_getdouble ( script , & zadd ) ; break ;
case T_ANGADD :
2014-09-30 04:06:57 +00:00
scriptfile_getsymbol ( script , & angadd ) ; break ;
2011-03-01 05:52:33 +00:00
case T_FOV :
scriptfile_getsymbol ( script , & fov ) ; break ;
2006-11-13 23:12:47 +00:00
case T_HIDE :
2013-11-22 19:26:50 +00:00
flags | = HUDFLAG_HIDE ; break ;
2006-11-13 23:12:47 +00:00
case T_NOBOB :
2013-11-22 19:26:50 +00:00
flags | = HUDFLAG_NOBOB ; break ;
2006-11-13 23:12:47 +00:00
case T_FLIPPED :
2013-11-22 19:26:50 +00:00
flags | = HUDFLAG_FLIPPED ; break ;
2006-11-13 23:12:47 +00:00
case T_NODEPTH :
2013-11-22 19:26:50 +00:00
flags | = HUDFLAG_NODEPTH ; break ;
2006-11-13 23:12:47 +00:00
}
}
2014-10-25 03:36:34 +00:00
if ( EDUKE32_PREDICT_FALSE ( check_tile_range ( " hud " , & ftilenume , & ltilenume , script , hudtokptr ) ) )
2007-12-12 17:42:14 +00:00
{
2012-04-04 18:58:19 +00:00
model_ok = 0 ;
break ;
2006-11-13 23:12:47 +00:00
}
2014-10-25 03:36:34 +00:00
if ( EDUKE32_PREDICT_FALSE ( lastmodelid < 0 ) )
2007-12-12 17:42:14 +00:00
{
2012-01-27 15:03:18 +00:00
# ifdef USE_OPENGL
2013-09-13 20:23:59 +00:00
initprintf ( " Warning: Ignoring frame definition. \n " ) ;
2012-01-27 15:03:18 +00:00
# endif
2006-11-13 23:12:47 +00:00
break ;
}
2011-03-04 08:50:58 +00:00
# ifdef USE_OPENGL
2007-12-12 17:42:14 +00:00
for ( tilex = ftilenume ; tilex < = ltilenume & & happy ; tilex + + )
{
2015-03-24 00:40:48 +00:00
vec3f_t const add = { ( float ) xadd , ( float ) yadd , ( float ) zadd } ;
switch ( md_definehud ( lastmodelid , tilex , add , angadd , flags , fov ) )
2007-12-12 17:42:14 +00:00
{
2006-11-13 23:12:47 +00:00
case 0 :
break ;
case - 1 :
happy = 0 ; break ; // invalid model id!?
case - 2 :
2013-09-13 20:23:59 +00:00
initprintf ( " Invalid tile number on line %s:%d \n " ,
2006-11-13 23:12:47 +00:00
script - > filename , scriptfile_getlinum ( script , hudtokptr ) ) ;
happy = 0 ;
break ;
case - 3 :
2013-09-13 20:23:59 +00:00
initprintf ( " Invalid frame name on line %s:%d \n " ,
2006-11-13 23:12:47 +00:00
script - > filename , scriptfile_getlinum ( script , hudtokptr ) ) ;
happy = 0 ;
break ;
}
2012-01-07 17:48:55 +00:00
model_ok & = happy ;
2006-04-24 19:04:22 +00:00
}
2006-11-13 23:12:47 +00:00
# endif
2007-12-12 17:42:14 +00:00
}
break ;
2006-04-24 19:04:22 +00:00
}
2006-11-13 23:12:47 +00:00
}
2006-04-23 06:44:19 +00:00
2012-01-27 15:03:02 +00:00
# ifdef USE_OPENGL
2014-10-25 03:36:34 +00:00
if ( EDUKE32_PREDICT_FALSE ( ! model_ok ) )
2012-01-07 17:48:55 +00:00
{
if ( lastmodelid > = 0 )
{
2013-09-13 20:23:59 +00:00
initprintf ( " Removing model %d due to errors. \n " , lastmodelid ) ;
2012-01-07 17:48:55 +00:00
md_undefinemodel ( lastmodelid ) ;
nextmodelid - - ;
}
break ;
}
2012-01-17 04:31:59 +00:00
md_setmisc ( lastmodelid , ( float ) scale , shadeoffs , ( float ) mzadd , ( float ) myoffset , flags ) ;
2011-06-19 18:30:32 +00:00
// thin out the loaded model by throwing away unused frames
2012-01-12 20:48:38 +00:00
// FIXME: CURRENTLY DISABLED: interpolation may access frames we consider 'unused'?
# if 0
2011-06-19 18:30:32 +00:00
if ( models [ lastmodelid ] - > mdnum = = 3 & & ( ( md3model_t * ) models [ lastmodelid ] ) - > numframes < = 1024 )
{
2012-01-12 20:48:38 +00:00
# ifdef DEBUG_MODEL_MEM
2011-06-19 18:30:32 +00:00
md3model_t * m = ( md3model_t * ) models [ lastmodelid ] ;
int32_t i , onumframes ;
onumframes = m - > numframes ;
2011-10-17 18:42:10 +00:00
i =
2012-01-12 20:48:38 +00:00
# endif
2011-10-17 18:42:10 +00:00
md_thinoutmodel ( lastmodelid , usedframebitmap ) ;
2012-01-12 20:48:38 +00:00
# ifdef DEBUG_MODEL_MEM
2011-06-19 18:30:32 +00:00
if ( i > = 0 & & i < onumframes )
2013-09-13 20:23:59 +00:00
initprintf ( " used %d/%d frames: %s \n " , i , onumframes , modelfn ) ;
2011-06-19 18:30:32 +00:00
else if ( i < 0 )
2013-09-13 20:23:59 +00:00
initprintf ( " md_thinoutmodel returned %d: %s \n " , i , modelfn ) ;
2012-01-12 20:48:38 +00:00
# endif
2011-06-19 18:30:32 +00:00
}
2012-01-12 20:48:38 +00:00
# endif
2011-06-19 18:30:32 +00:00
2013-05-17 03:44:09 +00:00
if ( glrendmode = = REND_POLYMER )
2011-06-19 18:30:32 +00:00
md3postload_polymer ( ( md3model_t * ) models [ lastmodelid ] ) ;
2006-04-23 06:44:19 +00:00
# endif
2006-11-13 23:12:47 +00:00
modelskin = lastmodelskin = 0 ;
seenframe = 0 ;
2006-04-23 06:44:19 +00:00
2006-11-13 23:12:47 +00:00
}
break ;
2006-04-24 19:04:22 +00:00
case T_VOXEL :
2006-11-13 23:12:47 +00:00
{
char * voxeltokptr = script - > ltextptr ;
char * fn , * modelend ;
2009-01-09 09:29:17 +00:00
int32_t tile0 = MAXTILES , tile1 = - 1 , tilex = - 1 ;
2006-04-23 06:44:19 +00:00
2010-08-02 08:13:51 +00:00
static const tokenlist voxeltokens [ ] =
{
{ " tile " , T_TILE } ,
{ " tile0 " , T_TILE0 } ,
{ " tile1 " , T_TILE1 } ,
{ " scale " , T_SCALE } ,
2019-09-17 05:07:28 +00:00
{ " rotate " , T_ROTATE } ,
2010-08-02 08:13:51 +00:00
} ;
2014-12-26 17:29:52 +00:00
if ( EDUKE32_PREDICT_FALSE ( scriptfile_getstring ( script , & fn ) ) )
break ; //voxel filename
2019-09-19 20:02:45 +00:00
while ( nextvoxid < MAXVOXELS & & ( voxreserve [ nextvoxid > > 3 ] & ( 1 < < ( nextvoxid & 7 ) ) ) )
nextvoxid + + ;
2014-12-26 17:29:52 +00:00
if ( EDUKE32_PREDICT_FALSE ( nextvoxid = = MAXVOXELS ) )
{
initprintf ( " Maximum number of voxels (%d) already defined. \n " , MAXVOXELS ) ;
break ;
}
if ( EDUKE32_PREDICT_FALSE ( qloadkvx ( nextvoxid , fn ) ) )
{
initprintf ( " Failure loading voxel file \" %s \" \n " , fn ) ;
break ;
}
2006-11-13 23:12:47 +00:00
lastvoxid = nextvoxid + + ;
2006-04-23 06:44:19 +00:00
2006-11-13 23:12:47 +00:00
if ( scriptfile_getbraces ( script , & modelend ) ) break ;
2007-12-12 17:42:14 +00:00
while ( script - > textptr < modelend )
{
2014-12-26 17:29:48 +00:00
switch ( getatoken ( script , voxeltokens , ARRAY_SIZE ( voxeltokens ) ) )
2007-12-12 17:42:14 +00:00
{
2013-09-13 20:23:59 +00:00
//case T_ERROR: initprintf("Error on line %s:%d in voxel tokens\n", script->filename,linenum); break;
2006-11-13 23:12:47 +00:00
case T_TILE :
scriptfile_getsymbol ( script , & tilex ) ;
2012-04-04 18:58:19 +00:00
2013-12-01 18:27:55 +00:00
if ( check_tile ( " voxel " , tilex , script , voxeltokptr ) )
2012-04-04 18:58:19 +00:00
break ;
tiletovox [ tilex ] = lastvoxid ;
2006-11-13 23:12:47 +00:00
break ;
2012-04-04 18:58:19 +00:00
2006-11-13 23:12:47 +00:00
case T_TILE0 :
2012-04-04 18:58:19 +00:00
scriptfile_getsymbol ( script , & tile0 ) ;
break ; //1st tile #
2006-11-13 23:12:47 +00:00
case T_TILE1 :
scriptfile_getsymbol ( script , & tile1 ) ;
2012-04-04 18:58:19 +00:00
2012-12-28 17:18:18 +00:00
if ( check_tile_range ( " voxel " , & tile0 , & tile1 , script , voxeltokptr ) )
2012-04-04 18:58:19 +00:00
break ;
for ( tilex = tile0 ; tilex < = tile1 ; tilex + + )
tiletovox [ tilex ] = lastvoxid ;
2006-11-13 23:12:47 +00:00
break ; //last tile number (inclusive)
2012-04-04 18:58:19 +00:00
2007-12-12 17:42:14 +00:00
case T_SCALE :
{
2006-11-13 23:12:47 +00:00
double scale = 1.0 ;
scriptfile_getdouble ( script , & scale ) ;
2009-01-09 09:29:17 +00:00
voxscale [ lastvoxid ] = ( int32_t ) ( 65536 * scale ) ;
2011-06-18 13:02:08 +00:00
# ifdef USE_OPENGL
if ( voxmodels [ lastvoxid ] )
voxmodels [ lastvoxid ] - > scale = scale ;
# endif
2006-11-13 23:12:47 +00:00
break ;
}
2019-09-17 05:07:28 +00:00
case T_ROTATE :
voxrotate [ lastvoxid > > 3 ] | = pow2char [ lastvoxid & 7 ] ;
break ;
2006-04-24 19:04:22 +00:00
}
}
2006-11-13 23:12:47 +00:00
lastvoxid = - 1 ;
}
break ;
2006-04-24 19:04:22 +00:00
case T_SKYBOX :
2006-11-13 23:12:47 +00:00
{
char * skyboxtokptr = script - > ltextptr ;
2012-03-28 19:41:39 +00:00
char * fn [ 6 ] = { 0 , 0 , 0 , 0 , 0 , 0 } ;
char * modelend ;
2015-03-08 07:56:29 +00:00
int32_t i , tile = - 1 , pal = 0 , happy = 1 ;
2019-10-17 10:45:25 +00:00
int flags = 0 ;
2006-11-13 23:12:47 +00:00
2010-08-02 08:13:51 +00:00
static const tokenlist skyboxtokens [ ] =
{
{ " tile " , T_TILE } ,
{ " pal " , T_PAL } ,
{ " ft " , T_FRONT } , { " front " , T_FRONT } , { " forward " , T_FRONT } ,
{ " rt " , T_RIGHT } , { " right " , T_RIGHT } ,
{ " bk " , T_BACK } , { " back " , T_BACK } ,
{ " lf " , T_LEFT } , { " left " , T_LEFT } , { " lt " , T_LEFT } ,
{ " up " , T_TOP } , { " top " , T_TOP } , { " ceiling " , T_TOP } , { " ceil " , T_TOP } ,
2015-02-18 01:47:00 +00:00
{ " dn " , T_BOTTOM } , { " bottom " , T_BOTTOM } , { " floor " , T_BOTTOM } , { " down " , T_BOTTOM } ,
{ " nocompress " , T_NOCOMPRESS } ,
{ " nodownsize " , T_NODOWNSIZE } ,
2015-03-28 09:49:37 +00:00
{ " forcefilter " , T_FORCEFILTER } ,
2016-05-02 18:29:35 +00:00
{ " artquality " , T_ARTQUALITY } ,
2010-08-02 08:13:51 +00:00
} ;
2006-11-13 23:12:47 +00:00
if ( scriptfile_getbraces ( script , & modelend ) ) break ;
2007-12-12 17:42:14 +00:00
while ( script - > textptr < modelend )
{
2014-03-22 09:25:15 +00:00
switch ( getatoken ( script , skyboxtokens , ARRAY_SIZE ( skyboxtokens ) ) )
2007-12-12 17:42:14 +00:00
{
2013-09-13 20:23:59 +00:00
//case T_ERROR: initprintf("Error on line %s:%d in skybox tokens\n",script->filename,linenum); break;
2006-11-13 23:12:47 +00:00
case T_TILE :
2007-12-12 17:42:14 +00:00
scriptfile_getsymbol ( script , & tile ) ; break ;
2006-11-13 23:12:47 +00:00
case T_PAL :
2007-12-12 17:42:14 +00:00
scriptfile_getsymbol ( script , & pal ) ; break ;
2006-11-13 23:12:47 +00:00
case T_FRONT :
scriptfile_getstring ( script , & fn [ 0 ] ) ; break ;
case T_RIGHT :
scriptfile_getstring ( script , & fn [ 1 ] ) ; break ;
case T_BACK :
scriptfile_getstring ( script , & fn [ 2 ] ) ; break ;
case T_LEFT :
scriptfile_getstring ( script , & fn [ 3 ] ) ; break ;
case T_TOP :
scriptfile_getstring ( script , & fn [ 4 ] ) ; break ;
case T_BOTTOM :
scriptfile_getstring ( script , & fn [ 5 ] ) ; break ;
2015-02-18 01:47:00 +00:00
# ifdef USE_OPENGL
2019-10-17 10:45:25 +00:00
case T_FORCEFILTER :
flags | = HICR_FORCEFILTER ; break ;
2015-02-18 01:47:00 +00:00
# endif
2019-10-17 10:45:25 +00:00
2006-04-24 19:04:22 +00:00
}
2006-11-13 23:12:47 +00:00
}
2006-04-24 19:04:22 +00:00
2014-10-25 03:36:34 +00:00
if ( EDUKE32_PREDICT_FALSE ( tile < 0 ) ) initprintf ( " Error: skybox: missing 'tile number' near line %s:%d \n " , script - > filename , scriptfile_getlinum ( script , skyboxtokptr ) ) , happy = 0 ;
2009-02-19 16:47:54 +00:00
for ( i = 0 ; i < 6 ; i + + )
2007-12-12 17:42:14 +00:00
{
2014-10-25 03:36:34 +00:00
if ( EDUKE32_PREDICT_FALSE ( ! fn [ i ] ) ) initprintf ( " Error: skybox: missing '%s filename' near line %s:%d \n " , skyfaces [ i ] , script - > filename , scriptfile_getlinum ( script , skyboxtokptr ) ) , happy = 0 ;
2010-12-17 14:22:15 +00:00
// FIXME?
2019-12-07 09:31:27 +00:00
if ( fileSystem . FileExists ( fn [ i ] ) )
2012-03-28 19:41:39 +00:00
happy = 0 ;
2006-04-24 19:04:22 +00:00
}
2006-11-13 23:12:47 +00:00
if ( ! happy ) break ;
2006-04-24 19:04:22 +00:00
2019-10-17 10:45:25 +00:00
tileSetSkybox ( tile , pal , ( const char * * ) fn , flags ) ;
2006-11-13 23:12:47 +00:00
}
break ;
2010-12-30 08:13:37 +00:00
case T_HIGHPALOOKUP :
{
char * highpaltokptr = script - > ltextptr ;
2012-03-28 19:41:39 +00:00
int32_t basepal = - 1 , pal = - 1 ;
char * fn = NULL ;
2010-12-30 08:13:37 +00:00
char * highpalend ;
static const tokenlist highpaltokens [ ] =
{
2011-01-27 07:05:12 +00:00
{ " basepal " , T_BASEPAL } ,
2010-12-30 08:13:37 +00:00
{ " pal " , T_PAL } ,
{ " file " , T_FILE }
} ;
if ( scriptfile_getbraces ( script , & highpalend ) ) break ;
while ( script - > textptr < highpalend )
{
2014-03-22 09:25:15 +00:00
switch ( getatoken ( script , highpaltokens , ARRAY_SIZE ( highpaltokens ) ) )
2010-12-30 08:13:37 +00:00
{
2011-01-27 07:05:12 +00:00
case T_BASEPAL :
scriptfile_getsymbol ( script , & basepal ) ; break ;
2010-12-30 08:13:37 +00:00
case T_PAL :
scriptfile_getsymbol ( script , & pal ) ; break ;
case T_FILE :
scriptfile_getstring ( script , & fn ) ; break ;
}
}
2015-09-23 17:55:02 +00:00
if ( EDUKE32_PREDICT_FALSE ( ( unsigned ) basepal > = MAXBASEPALS ) )
2011-01-27 07:05:12 +00:00
{
2013-09-13 20:23:59 +00:00
initprintf ( " Error: missing or invalid 'base palette number' for highpalookup definition "
" near line %s:%d \n " , script - > filename , scriptfile_getlinum ( script , highpaltokptr ) ) ;
2011-01-27 07:05:12 +00:00
break ;
}
2010-12-30 08:13:37 +00:00
2014-10-25 03:36:34 +00:00
if ( EDUKE32_PREDICT_FALSE ( ( unsigned ) pal > = MAXPALOOKUPS - RESERVEDPALS ) )
2010-12-30 08:13:37 +00:00
{
2013-09-13 20:23:59 +00:00
initprintf ( " Error: missing or invalid 'palette number' for highpalookup definition near "
" line %s:%d \n " , script - > filename , scriptfile_getlinum ( script , highpaltokptr ) ) ;
2010-12-30 08:13:37 +00:00
break ;
}
2011-01-27 07:05:12 +00:00
2014-10-25 03:36:34 +00:00
if ( EDUKE32_PREDICT_FALSE ( ! fn ) )
2010-12-30 08:13:37 +00:00
{
2013-09-13 20:23:59 +00:00
initprintf ( " Error: missing 'file name' for highpalookup definition near line %s:%d \n " ,
2010-12-30 08:13:37 +00:00
script - > filename , scriptfile_getlinum ( script , highpaltokptr ) ) ;
break ;
}
2011-01-16 02:50:27 +00:00
2019-12-07 09:31:27 +00:00
if ( fileSystem . FileExists ( fn ) )
2012-03-28 19:41:39 +00:00
break ;
2010-12-31 01:35:00 +00:00
2010-12-30 08:13:37 +00:00
}
break ;
2006-11-13 23:12:47 +00:00
case T_TINT :
{
char * tinttokptr = script - > ltextptr ;
2017-12-12 05:13:58 +00:00
int32_t red = 255 , green = 255 , blue = 255 , shadered = 0 , shadegreen = 0 , shadeblue = 0 , pal = - 1 , flags = 0 ;
2006-11-13 23:12:47 +00:00
char * tintend ;
2010-08-02 08:13:51 +00:00
static const tokenlist tinttokens [ ] =
{
2017-12-12 05:13:58 +00:00
{ " pal " , T_PAL } ,
{ " red " , T_RED } , { " r " , T_RED } ,
{ " green " , T_GREEN } , { " g " , T_GREEN } ,
{ " blue " , T_BLUE } , { " b " , T_BLUE } ,
{ " shadered " , T_SHADERED } , { " sr " , T_SHADERED } ,
{ " shadegreen " , T_SHADEGREEN } , { " sg " , T_SHADEGREEN } ,
{ " shadeblue " , T_SHADEBLUE } , { " sb " , T_SHADEBLUE } ,
{ " flags " , T_FLAGS }
2010-08-02 08:13:51 +00:00
} ;
2006-11-13 23:12:47 +00:00
if ( scriptfile_getbraces ( script , & tintend ) ) break ;
2007-12-12 17:42:14 +00:00
while ( script - > textptr < tintend )
{
2014-03-22 09:25:15 +00:00
switch ( getatoken ( script , tinttokens , ARRAY_SIZE ( tinttokens ) ) )
2007-12-12 17:42:14 +00:00
{
2006-11-13 23:12:47 +00:00
case T_PAL :
2017-12-12 05:13:58 +00:00
scriptfile_getsymbol ( script , & pal ) ; break ;
2006-11-13 23:12:47 +00:00
case T_RED :
2017-12-12 05:13:58 +00:00
scriptfile_getnumber ( script , & red ) ; red = min ( 255 , max ( 0 , red ) ) ; break ;
2006-11-13 23:12:47 +00:00
case T_GREEN :
2017-12-12 05:13:58 +00:00
scriptfile_getnumber ( script , & green ) ; green = min ( 255 , max ( 0 , green ) ) ; break ;
2006-11-13 23:12:47 +00:00
case T_BLUE :
2017-12-12 05:13:58 +00:00
scriptfile_getnumber ( script , & blue ) ; blue = min ( 255 , max ( 0 , blue ) ) ; break ;
case T_SHADERED :
scriptfile_getnumber ( script , & shadered ) ; shadered = min ( 255 , max ( 0 , shadered ) ) ; break ;
case T_SHADEGREEN :
scriptfile_getnumber ( script , & shadegreen ) ; shadegreen = min ( 255 , max ( 0 , shadegreen ) ) ; break ;
case T_SHADEBLUE :
scriptfile_getnumber ( script , & shadeblue ) ; shadeblue = min ( 255 , max ( 0 , shadeblue ) ) ; break ;
2006-11-13 23:12:47 +00:00
case T_FLAGS :
2017-12-12 05:13:58 +00:00
scriptfile_getsymbol ( script , & flags ) ; break ;
2006-04-24 19:04:22 +00:00
}
2006-11-13 23:12:47 +00:00
}
2006-04-24 19:04:22 +00:00
2014-10-25 03:36:34 +00:00
if ( EDUKE32_PREDICT_FALSE ( pal < 0 ) )
2007-12-12 17:42:14 +00:00
{
2013-09-13 20:23:59 +00:00
initprintf ( " Error: tint: missing 'palette number' near line %s:%d \n " ,
DEF command 'makepalookup', allowing indpt. specification of fog and color remapping.
The syntax is as follows:
makepalookup { <token-list...> }
where valid tokens are
* pal <palnum>: the palette number, 1 .. 250
* red <num>, green, blue (or r, g, b): the fog color components on a 0 to 63 scale.
Components that are not present are assumed to be 0.
* remappal <palnum>: the palette number to take the index remapping from, i.e. 21
for blue -> red. When absent, defaults to 0.
* remapself: when present, specifies that the remappal is the same as the 'pal'.
This is to prevent textual redundancy when overwriting existing palookups.
Examples (best tested with tile #251):
1) makepalookup { pal 200 red 30 remappal 23 }
This creates palookup 200 with a fog of (30,0,0) and a blue-to-yellow remapping
(assuming it has not been changed before)
2) makepalookup { pal 21 red 30 remapself }
This 'fogifies' palookup 21 with a red fog.
3) makepalookup { pal 21 red 30 }
This overwrites palookup 21 with a red fog, but clears the blue-to-red remapping.
The fog aspect of this command affects the GL modes just like 'fogpal', but the
remapping has no effect for hightiles.
- Also, silently clamp 'fogpal' r,g,b values to the range 0 .. 63.
git-svn-id: https://svn.eduke32.com/eduke32@2568 1a8010ca-5511-0410-912e-c29ae57300e0
2012-03-29 21:16:41 +00:00
script - > filename , scriptfile_getlinum ( script , tinttokptr ) ) ;
2006-11-13 23:12:47 +00:00
break ;
2006-04-24 19:04:22 +00:00
}
2006-11-13 23:12:47 +00:00
2013-01-08 06:17:10 +00:00
# ifdef USE_OPENGL
2017-12-12 05:13:58 +00:00
hicsetpalettetint ( pal , red , green , blue , shadered , shadegreen , shadeblue , flags ) ;
2013-01-08 06:17:10 +00:00
# endif
2006-11-13 23:12:47 +00:00
}
break ;
DEF command 'makepalookup', allowing indpt. specification of fog and color remapping.
The syntax is as follows:
makepalookup { <token-list...> }
where valid tokens are
* pal <palnum>: the palette number, 1 .. 250
* red <num>, green, blue (or r, g, b): the fog color components on a 0 to 63 scale.
Components that are not present are assumed to be 0.
* remappal <palnum>: the palette number to take the index remapping from, i.e. 21
for blue -> red. When absent, defaults to 0.
* remapself: when present, specifies that the remappal is the same as the 'pal'.
This is to prevent textual redundancy when overwriting existing palookups.
Examples (best tested with tile #251):
1) makepalookup { pal 200 red 30 remappal 23 }
This creates palookup 200 with a fog of (30,0,0) and a blue-to-yellow remapping
(assuming it has not been changed before)
2) makepalookup { pal 21 red 30 remapself }
This 'fogifies' palookup 21 with a red fog.
3) makepalookup { pal 21 red 30 }
This overwrites palookup 21 with a red fog, but clears the blue-to-red remapping.
The fog aspect of this command affects the GL modes just like 'fogpal', but the
remapping has no effect for hightiles.
- Also, silently clamp 'fogpal' r,g,b values to the range 0 .. 63.
git-svn-id: https://svn.eduke32.com/eduke32@2568 1a8010ca-5511-0410-912e-c29ae57300e0
2012-03-29 21:16:41 +00:00
case T_MAKEPALOOKUP :
{
char * const starttokptr = script - > ltextptr ;
int32_t red = 0 , green = 0 , blue = 0 , pal = - 1 ;
int32_t havepal = 0 , remappal = 0 ;
2015-03-27 12:29:52 +00:00
int32_t nofloorpal = - 1 ;
DEF command 'makepalookup', allowing indpt. specification of fog and color remapping.
The syntax is as follows:
makepalookup { <token-list...> }
where valid tokens are
* pal <palnum>: the palette number, 1 .. 250
* red <num>, green, blue (or r, g, b): the fog color components on a 0 to 63 scale.
Components that are not present are assumed to be 0.
* remappal <palnum>: the palette number to take the index remapping from, i.e. 21
for blue -> red. When absent, defaults to 0.
* remapself: when present, specifies that the remappal is the same as the 'pal'.
This is to prevent textual redundancy when overwriting existing palookups.
Examples (best tested with tile #251):
1) makepalookup { pal 200 red 30 remappal 23 }
This creates palookup 200 with a fog of (30,0,0) and a blue-to-yellow remapping
(assuming it has not been changed before)
2) makepalookup { pal 21 red 30 remapself }
This 'fogifies' palookup 21 with a red fog.
3) makepalookup { pal 21 red 30 }
This overwrites palookup 21 with a red fog, but clears the blue-to-red remapping.
The fog aspect of this command affects the GL modes just like 'fogpal', but the
remapping has no effect for hightiles.
- Also, silently clamp 'fogpal' r,g,b values to the range 0 .. 63.
git-svn-id: https://svn.eduke32.com/eduke32@2568 1a8010ca-5511-0410-912e-c29ae57300e0
2012-03-29 21:16:41 +00:00
char * endtextptr ;
static const tokenlist palookuptokens [ ] =
{
{ " pal " , T_PAL } ,
{ " red " , T_RED } , { " r " , T_RED } ,
{ " green " , T_GREEN } , { " g " , T_GREEN } ,
{ " blue " , T_BLUE } , { " b " , T_BLUE } ,
{ " remappal " , T_REMAPPAL } ,
{ " remapself " , T_REMAPSELF } ,
2015-03-27 12:29:52 +00:00
{ " nofloorpal " , T_NOFLOORPAL } ,
DEF command 'makepalookup', allowing indpt. specification of fog and color remapping.
The syntax is as follows:
makepalookup { <token-list...> }
where valid tokens are
* pal <palnum>: the palette number, 1 .. 250
* red <num>, green, blue (or r, g, b): the fog color components on a 0 to 63 scale.
Components that are not present are assumed to be 0.
* remappal <palnum>: the palette number to take the index remapping from, i.e. 21
for blue -> red. When absent, defaults to 0.
* remapself: when present, specifies that the remappal is the same as the 'pal'.
This is to prevent textual redundancy when overwriting existing palookups.
Examples (best tested with tile #251):
1) makepalookup { pal 200 red 30 remappal 23 }
This creates palookup 200 with a fog of (30,0,0) and a blue-to-yellow remapping
(assuming it has not been changed before)
2) makepalookup { pal 21 red 30 remapself }
This 'fogifies' palookup 21 with a red fog.
3) makepalookup { pal 21 red 30 }
This overwrites palookup 21 with a red fog, but clears the blue-to-red remapping.
The fog aspect of this command affects the GL modes just like 'fogpal', but the
remapping has no effect for hightiles.
- Also, silently clamp 'fogpal' r,g,b values to the range 0 .. 63.
git-svn-id: https://svn.eduke32.com/eduke32@2568 1a8010ca-5511-0410-912e-c29ae57300e0
2012-03-29 21:16:41 +00:00
} ;
2014-12-13 22:33:06 +00:00
enum {
HAVE_PAL = 1 ,
HAVE_REMAPPAL = 2 ,
HAVE_REMAPSELF = 4 ,
HAVEPAL_SPECIAL = HAVE_REMAPPAL | HAVE_REMAPSELF ,
HAVEPAL_ERROR = 8 ,
} ;
DEF command 'makepalookup', allowing indpt. specification of fog and color remapping.
The syntax is as follows:
makepalookup { <token-list...> }
where valid tokens are
* pal <palnum>: the palette number, 1 .. 250
* red <num>, green, blue (or r, g, b): the fog color components on a 0 to 63 scale.
Components that are not present are assumed to be 0.
* remappal <palnum>: the palette number to take the index remapping from, i.e. 21
for blue -> red. When absent, defaults to 0.
* remapself: when present, specifies that the remappal is the same as the 'pal'.
This is to prevent textual redundancy when overwriting existing palookups.
Examples (best tested with tile #251):
1) makepalookup { pal 200 red 30 remappal 23 }
This creates palookup 200 with a fog of (30,0,0) and a blue-to-yellow remapping
(assuming it has not been changed before)
2) makepalookup { pal 21 red 30 remapself }
This 'fogifies' palookup 21 with a red fog.
3) makepalookup { pal 21 red 30 }
This overwrites palookup 21 with a red fog, but clears the blue-to-red remapping.
The fog aspect of this command affects the GL modes just like 'fogpal', but the
remapping has no effect for hightiles.
- Also, silently clamp 'fogpal' r,g,b values to the range 0 .. 63.
git-svn-id: https://svn.eduke32.com/eduke32@2568 1a8010ca-5511-0410-912e-c29ae57300e0
2012-03-29 21:16:41 +00:00
if ( scriptfile_getbraces ( script , & endtextptr ) ) break ;
while ( script - > textptr < endtextptr )
{
2014-03-22 09:25:15 +00:00
switch ( getatoken ( script , palookuptokens , ARRAY_SIZE ( palookuptokens ) ) )
DEF command 'makepalookup', allowing indpt. specification of fog and color remapping.
The syntax is as follows:
makepalookup { <token-list...> }
where valid tokens are
* pal <palnum>: the palette number, 1 .. 250
* red <num>, green, blue (or r, g, b): the fog color components on a 0 to 63 scale.
Components that are not present are assumed to be 0.
* remappal <palnum>: the palette number to take the index remapping from, i.e. 21
for blue -> red. When absent, defaults to 0.
* remapself: when present, specifies that the remappal is the same as the 'pal'.
This is to prevent textual redundancy when overwriting existing palookups.
Examples (best tested with tile #251):
1) makepalookup { pal 200 red 30 remappal 23 }
This creates palookup 200 with a fog of (30,0,0) and a blue-to-yellow remapping
(assuming it has not been changed before)
2) makepalookup { pal 21 red 30 remapself }
This 'fogifies' palookup 21 with a red fog.
3) makepalookup { pal 21 red 30 }
This overwrites palookup 21 with a red fog, but clears the blue-to-red remapping.
The fog aspect of this command affects the GL modes just like 'fogpal', but the
remapping has no effect for hightiles.
- Also, silently clamp 'fogpal' r,g,b values to the range 0 .. 63.
git-svn-id: https://svn.eduke32.com/eduke32@2568 1a8010ca-5511-0410-912e-c29ae57300e0
2012-03-29 21:16:41 +00:00
{
case T_PAL :
scriptfile_getsymbol ( script , & pal ) ;
2014-12-13 22:33:06 +00:00
havepal | = HAVE_PAL ;
DEF command 'makepalookup', allowing indpt. specification of fog and color remapping.
The syntax is as follows:
makepalookup { <token-list...> }
where valid tokens are
* pal <palnum>: the palette number, 1 .. 250
* red <num>, green, blue (or r, g, b): the fog color components on a 0 to 63 scale.
Components that are not present are assumed to be 0.
* remappal <palnum>: the palette number to take the index remapping from, i.e. 21
for blue -> red. When absent, defaults to 0.
* remapself: when present, specifies that the remappal is the same as the 'pal'.
This is to prevent textual redundancy when overwriting existing palookups.
Examples (best tested with tile #251):
1) makepalookup { pal 200 red 30 remappal 23 }
This creates palookup 200 with a fog of (30,0,0) and a blue-to-yellow remapping
(assuming it has not been changed before)
2) makepalookup { pal 21 red 30 remapself }
This 'fogifies' palookup 21 with a red fog.
3) makepalookup { pal 21 red 30 }
This overwrites palookup 21 with a red fog, but clears the blue-to-red remapping.
The fog aspect of this command affects the GL modes just like 'fogpal', but the
remapping has no effect for hightiles.
- Also, silently clamp 'fogpal' r,g,b values to the range 0 .. 63.
git-svn-id: https://svn.eduke32.com/eduke32@2568 1a8010ca-5511-0410-912e-c29ae57300e0
2012-03-29 21:16:41 +00:00
break ;
case T_RED :
scriptfile_getnumber ( script , & red ) ;
red = clamp ( red , 0 , 63 ) ;
break ;
case T_GREEN :
scriptfile_getnumber ( script , & green ) ;
green = clamp ( green , 0 , 63 ) ;
break ;
case T_BLUE :
scriptfile_getnumber ( script , & blue ) ;
blue = clamp ( blue , 0 , 63 ) ;
break ;
case T_REMAPPAL :
scriptfile_getsymbol ( script , & remappal ) ;
2014-12-13 22:33:06 +00:00
if ( havepal & HAVEPAL_SPECIAL )
havepal | = HAVEPAL_ERROR ;
havepal | = HAVE_REMAPPAL ;
DEF command 'makepalookup', allowing indpt. specification of fog and color remapping.
The syntax is as follows:
makepalookup { <token-list...> }
where valid tokens are
* pal <palnum>: the palette number, 1 .. 250
* red <num>, green, blue (or r, g, b): the fog color components on a 0 to 63 scale.
Components that are not present are assumed to be 0.
* remappal <palnum>: the palette number to take the index remapping from, i.e. 21
for blue -> red. When absent, defaults to 0.
* remapself: when present, specifies that the remappal is the same as the 'pal'.
This is to prevent textual redundancy when overwriting existing palookups.
Examples (best tested with tile #251):
1) makepalookup { pal 200 red 30 remappal 23 }
This creates palookup 200 with a fog of (30,0,0) and a blue-to-yellow remapping
(assuming it has not been changed before)
2) makepalookup { pal 21 red 30 remapself }
This 'fogifies' palookup 21 with a red fog.
3) makepalookup { pal 21 red 30 }
This overwrites palookup 21 with a red fog, but clears the blue-to-red remapping.
The fog aspect of this command affects the GL modes just like 'fogpal', but the
remapping has no effect for hightiles.
- Also, silently clamp 'fogpal' r,g,b values to the range 0 .. 63.
git-svn-id: https://svn.eduke32.com/eduke32@2568 1a8010ca-5511-0410-912e-c29ae57300e0
2012-03-29 21:16:41 +00:00
break ;
case T_REMAPSELF :
2014-12-13 22:33:06 +00:00
if ( havepal & HAVEPAL_SPECIAL )
havepal | = HAVEPAL_ERROR ;
havepal | = HAVE_REMAPSELF ;
DEF command 'makepalookup', allowing indpt. specification of fog and color remapping.
The syntax is as follows:
makepalookup { <token-list...> }
where valid tokens are
* pal <palnum>: the palette number, 1 .. 250
* red <num>, green, blue (or r, g, b): the fog color components on a 0 to 63 scale.
Components that are not present are assumed to be 0.
* remappal <palnum>: the palette number to take the index remapping from, i.e. 21
for blue -> red. When absent, defaults to 0.
* remapself: when present, specifies that the remappal is the same as the 'pal'.
This is to prevent textual redundancy when overwriting existing palookups.
Examples (best tested with tile #251):
1) makepalookup { pal 200 red 30 remappal 23 }
This creates palookup 200 with a fog of (30,0,0) and a blue-to-yellow remapping
(assuming it has not been changed before)
2) makepalookup { pal 21 red 30 remapself }
This 'fogifies' palookup 21 with a red fog.
3) makepalookup { pal 21 red 30 }
This overwrites palookup 21 with a red fog, but clears the blue-to-red remapping.
The fog aspect of this command affects the GL modes just like 'fogpal', but the
remapping has no effect for hightiles.
- Also, silently clamp 'fogpal' r,g,b values to the range 0 .. 63.
git-svn-id: https://svn.eduke32.com/eduke32@2568 1a8010ca-5511-0410-912e-c29ae57300e0
2012-03-29 21:16:41 +00:00
break ;
2015-03-27 12:29:52 +00:00
case T_NOFLOORPAL :
scriptfile_getsymbol ( script , & nofloorpal ) ;
nofloorpal = clamp ( nofloorpal , 0 , 1 ) ;
break ;
DEF command 'makepalookup', allowing indpt. specification of fog and color remapping.
The syntax is as follows:
makepalookup { <token-list...> }
where valid tokens are
* pal <palnum>: the palette number, 1 .. 250
* red <num>, green, blue (or r, g, b): the fog color components on a 0 to 63 scale.
Components that are not present are assumed to be 0.
* remappal <palnum>: the palette number to take the index remapping from, i.e. 21
for blue -> red. When absent, defaults to 0.
* remapself: when present, specifies that the remappal is the same as the 'pal'.
This is to prevent textual redundancy when overwriting existing palookups.
Examples (best tested with tile #251):
1) makepalookup { pal 200 red 30 remappal 23 }
This creates palookup 200 with a fog of (30,0,0) and a blue-to-yellow remapping
(assuming it has not been changed before)
2) makepalookup { pal 21 red 30 remapself }
This 'fogifies' palookup 21 with a red fog.
3) makepalookup { pal 21 red 30 }
This overwrites palookup 21 with a red fog, but clears the blue-to-red remapping.
The fog aspect of this command affects the GL modes just like 'fogpal', but the
remapping has no effect for hightiles.
- Also, silently clamp 'fogpal' r,g,b values to the range 0 .. 63.
git-svn-id: https://svn.eduke32.com/eduke32@2568 1a8010ca-5511-0410-912e-c29ae57300e0
2012-03-29 21:16:41 +00:00
}
}
{
char msgend [ BMAX_PATH + 64 ] ;
Bsprintf ( msgend , " for palookup definition near line %s:%d " ,
script - > filename , scriptfile_getlinum ( script , starttokptr ) ) ;
2014-12-13 22:33:06 +00:00
if ( EDUKE32_PREDICT_FALSE ( ( havepal & HAVE_PAL ) = = 0 ) )
DEF command 'makepalookup', allowing indpt. specification of fog and color remapping.
The syntax is as follows:
makepalookup { <token-list...> }
where valid tokens are
* pal <palnum>: the palette number, 1 .. 250
* red <num>, green, blue (or r, g, b): the fog color components on a 0 to 63 scale.
Components that are not present are assumed to be 0.
* remappal <palnum>: the palette number to take the index remapping from, i.e. 21
for blue -> red. When absent, defaults to 0.
* remapself: when present, specifies that the remappal is the same as the 'pal'.
This is to prevent textual redundancy when overwriting existing palookups.
Examples (best tested with tile #251):
1) makepalookup { pal 200 red 30 remappal 23 }
This creates palookup 200 with a fog of (30,0,0) and a blue-to-yellow remapping
(assuming it has not been changed before)
2) makepalookup { pal 21 red 30 remapself }
This 'fogifies' palookup 21 with a red fog.
3) makepalookup { pal 21 red 30 }
This overwrites palookup 21 with a red fog, but clears the blue-to-red remapping.
The fog aspect of this command affects the GL modes just like 'fogpal', but the
remapping has no effect for hightiles.
- Also, silently clamp 'fogpal' r,g,b values to the range 0 .. 63.
git-svn-id: https://svn.eduke32.com/eduke32@2568 1a8010ca-5511-0410-912e-c29ae57300e0
2012-03-29 21:16:41 +00:00
{
2013-09-13 20:23:59 +00:00
initprintf ( " Error: missing 'palette number' %s \n " , msgend ) ;
DEF command 'makepalookup', allowing indpt. specification of fog and color remapping.
The syntax is as follows:
makepalookup { <token-list...> }
where valid tokens are
* pal <palnum>: the palette number, 1 .. 250
* red <num>, green, blue (or r, g, b): the fog color components on a 0 to 63 scale.
Components that are not present are assumed to be 0.
* remappal <palnum>: the palette number to take the index remapping from, i.e. 21
for blue -> red. When absent, defaults to 0.
* remapself: when present, specifies that the remappal is the same as the 'pal'.
This is to prevent textual redundancy when overwriting existing palookups.
Examples (best tested with tile #251):
1) makepalookup { pal 200 red 30 remappal 23 }
This creates palookup 200 with a fog of (30,0,0) and a blue-to-yellow remapping
(assuming it has not been changed before)
2) makepalookup { pal 21 red 30 remapself }
This 'fogifies' palookup 21 with a red fog.
3) makepalookup { pal 21 red 30 }
This overwrites palookup 21 with a red fog, but clears the blue-to-red remapping.
The fog aspect of this command affects the GL modes just like 'fogpal', but the
remapping has no effect for hightiles.
- Also, silently clamp 'fogpal' r,g,b values to the range 0 .. 63.
git-svn-id: https://svn.eduke32.com/eduke32@2568 1a8010ca-5511-0410-912e-c29ae57300e0
2012-03-29 21:16:41 +00:00
break ;
}
2014-10-25 03:36:34 +00:00
else if ( EDUKE32_PREDICT_FALSE ( pal = = 0 | | ( unsigned ) pal > = MAXPALOOKUPS - RESERVEDPALS ) )
DEF command 'makepalookup', allowing indpt. specification of fog and color remapping.
The syntax is as follows:
makepalookup { <token-list...> }
where valid tokens are
* pal <palnum>: the palette number, 1 .. 250
* red <num>, green, blue (or r, g, b): the fog color components on a 0 to 63 scale.
Components that are not present are assumed to be 0.
* remappal <palnum>: the palette number to take the index remapping from, i.e. 21
for blue -> red. When absent, defaults to 0.
* remapself: when present, specifies that the remappal is the same as the 'pal'.
This is to prevent textual redundancy when overwriting existing palookups.
Examples (best tested with tile #251):
1) makepalookup { pal 200 red 30 remappal 23 }
This creates palookup 200 with a fog of (30,0,0) and a blue-to-yellow remapping
(assuming it has not been changed before)
2) makepalookup { pal 21 red 30 remapself }
This 'fogifies' palookup 21 with a red fog.
3) makepalookup { pal 21 red 30 }
This overwrites palookup 21 with a red fog, but clears the blue-to-red remapping.
The fog aspect of this command affects the GL modes just like 'fogpal', but the
remapping has no effect for hightiles.
- Also, silently clamp 'fogpal' r,g,b values to the range 0 .. 63.
git-svn-id: https://svn.eduke32.com/eduke32@2568 1a8010ca-5511-0410-912e-c29ae57300e0
2012-03-29 21:16:41 +00:00
{
2013-09-13 20:23:59 +00:00
initprintf ( " Error: 'palette number' out of range (1 .. %d) %s \n " ,
DEF command 'makepalookup', allowing indpt. specification of fog and color remapping.
The syntax is as follows:
makepalookup { <token-list...> }
where valid tokens are
* pal <palnum>: the palette number, 1 .. 250
* red <num>, green, blue (or r, g, b): the fog color components on a 0 to 63 scale.
Components that are not present are assumed to be 0.
* remappal <palnum>: the palette number to take the index remapping from, i.e. 21
for blue -> red. When absent, defaults to 0.
* remapself: when present, specifies that the remappal is the same as the 'pal'.
This is to prevent textual redundancy when overwriting existing palookups.
Examples (best tested with tile #251):
1) makepalookup { pal 200 red 30 remappal 23 }
This creates palookup 200 with a fog of (30,0,0) and a blue-to-yellow remapping
(assuming it has not been changed before)
2) makepalookup { pal 21 red 30 remapself }
This 'fogifies' palookup 21 with a red fog.
3) makepalookup { pal 21 red 30 }
This overwrites palookup 21 with a red fog, but clears the blue-to-red remapping.
The fog aspect of this command affects the GL modes just like 'fogpal', but the
remapping has no effect for hightiles.
- Also, silently clamp 'fogpal' r,g,b values to the range 0 .. 63.
git-svn-id: https://svn.eduke32.com/eduke32@2568 1a8010ca-5511-0410-912e-c29ae57300e0
2012-03-29 21:16:41 +00:00
MAXPALOOKUPS - RESERVEDPALS - 1 , msgend ) ;
break ;
}
2014-12-13 22:33:06 +00:00
if ( EDUKE32_PREDICT_FALSE ( havepal & HAVEPAL_ERROR ) )
DEF command 'makepalookup', allowing indpt. specification of fog and color remapping.
The syntax is as follows:
makepalookup { <token-list...> }
where valid tokens are
* pal <palnum>: the palette number, 1 .. 250
* red <num>, green, blue (or r, g, b): the fog color components on a 0 to 63 scale.
Components that are not present are assumed to be 0.
* remappal <palnum>: the palette number to take the index remapping from, i.e. 21
for blue -> red. When absent, defaults to 0.
* remapself: when present, specifies that the remappal is the same as the 'pal'.
This is to prevent textual redundancy when overwriting existing palookups.
Examples (best tested with tile #251):
1) makepalookup { pal 200 red 30 remappal 23 }
This creates palookup 200 with a fog of (30,0,0) and a blue-to-yellow remapping
(assuming it has not been changed before)
2) makepalookup { pal 21 red 30 remapself }
This 'fogifies' palookup 21 with a red fog.
3) makepalookup { pal 21 red 30 }
This overwrites palookup 21 with a red fog, but clears the blue-to-red remapping.
The fog aspect of this command affects the GL modes just like 'fogpal', but the
remapping has no effect for hightiles.
- Also, silently clamp 'fogpal' r,g,b values to the range 0 .. 63.
git-svn-id: https://svn.eduke32.com/eduke32@2568 1a8010ca-5511-0410-912e-c29ae57300e0
2012-03-29 21:16:41 +00:00
{
// will also disallow multiple remappals or remapselfs
2013-09-13 20:23:59 +00:00
initprintf ( " Error: must have exactly one of either 'remappal' or 'remapself' %s \n " , msgend ) ;
DEF command 'makepalookup', allowing indpt. specification of fog and color remapping.
The syntax is as follows:
makepalookup { <token-list...> }
where valid tokens are
* pal <palnum>: the palette number, 1 .. 250
* red <num>, green, blue (or r, g, b): the fog color components on a 0 to 63 scale.
Components that are not present are assumed to be 0.
* remappal <palnum>: the palette number to take the index remapping from, i.e. 21
for blue -> red. When absent, defaults to 0.
* remapself: when present, specifies that the remappal is the same as the 'pal'.
This is to prevent textual redundancy when overwriting existing palookups.
Examples (best tested with tile #251):
1) makepalookup { pal 200 red 30 remappal 23 }
This creates palookup 200 with a fog of (30,0,0) and a blue-to-yellow remapping
(assuming it has not been changed before)
2) makepalookup { pal 21 red 30 remapself }
This 'fogifies' palookup 21 with a red fog.
3) makepalookup { pal 21 red 30 }
This overwrites palookup 21 with a red fog, but clears the blue-to-red remapping.
The fog aspect of this command affects the GL modes just like 'fogpal', but the
remapping has no effect for hightiles.
- Also, silently clamp 'fogpal' r,g,b values to the range 0 .. 63.
git-svn-id: https://svn.eduke32.com/eduke32@2568 1a8010ca-5511-0410-912e-c29ae57300e0
2012-03-29 21:16:41 +00:00
break ;
}
2014-12-13 22:33:06 +00:00
else if ( EDUKE32_PREDICT_FALSE ( ( havepal & HAVE_REMAPPAL )
& & ( unsigned ) remappal > = MAXPALOOKUPS - RESERVEDPALS ) )
DEF command 'makepalookup', allowing indpt. specification of fog and color remapping.
The syntax is as follows:
makepalookup { <token-list...> }
where valid tokens are
* pal <palnum>: the palette number, 1 .. 250
* red <num>, green, blue (or r, g, b): the fog color components on a 0 to 63 scale.
Components that are not present are assumed to be 0.
* remappal <palnum>: the palette number to take the index remapping from, i.e. 21
for blue -> red. When absent, defaults to 0.
* remapself: when present, specifies that the remappal is the same as the 'pal'.
This is to prevent textual redundancy when overwriting existing palookups.
Examples (best tested with tile #251):
1) makepalookup { pal 200 red 30 remappal 23 }
This creates palookup 200 with a fog of (30,0,0) and a blue-to-yellow remapping
(assuming it has not been changed before)
2) makepalookup { pal 21 red 30 remapself }
This 'fogifies' palookup 21 with a red fog.
3) makepalookup { pal 21 red 30 }
This overwrites palookup 21 with a red fog, but clears the blue-to-red remapping.
The fog aspect of this command affects the GL modes just like 'fogpal', but the
remapping has no effect for hightiles.
- Also, silently clamp 'fogpal' r,g,b values to the range 0 .. 63.
git-svn-id: https://svn.eduke32.com/eduke32@2568 1a8010ca-5511-0410-912e-c29ae57300e0
2012-03-29 21:16:41 +00:00
{
2013-09-13 20:23:59 +00:00
initprintf ( " Error: 'remap palette number' out of range (max=%d) %s \n " ,
DEF command 'makepalookup', allowing indpt. specification of fog and color remapping.
The syntax is as follows:
makepalookup { <token-list...> }
where valid tokens are
* pal <palnum>: the palette number, 1 .. 250
* red <num>, green, blue (or r, g, b): the fog color components on a 0 to 63 scale.
Components that are not present are assumed to be 0.
* remappal <palnum>: the palette number to take the index remapping from, i.e. 21
for blue -> red. When absent, defaults to 0.
* remapself: when present, specifies that the remappal is the same as the 'pal'.
This is to prevent textual redundancy when overwriting existing palookups.
Examples (best tested with tile #251):
1) makepalookup { pal 200 red 30 remappal 23 }
This creates palookup 200 with a fog of (30,0,0) and a blue-to-yellow remapping
(assuming it has not been changed before)
2) makepalookup { pal 21 red 30 remapself }
This 'fogifies' palookup 21 with a red fog.
3) makepalookup { pal 21 red 30 }
This overwrites palookup 21 with a red fog, but clears the blue-to-red remapping.
The fog aspect of this command affects the GL modes just like 'fogpal', but the
remapping has no effect for hightiles.
- Also, silently clamp 'fogpal' r,g,b values to the range 0 .. 63.
git-svn-id: https://svn.eduke32.com/eduke32@2568 1a8010ca-5511-0410-912e-c29ae57300e0
2012-03-29 21:16:41 +00:00
MAXPALOOKUPS - RESERVEDPALS - 1 , msgend ) ;
break ;
}
2014-12-13 22:33:06 +00:00
if ( havepal & HAVE_REMAPSELF )
DEF command 'makepalookup', allowing indpt. specification of fog and color remapping.
The syntax is as follows:
makepalookup { <token-list...> }
where valid tokens are
* pal <palnum>: the palette number, 1 .. 250
* red <num>, green, blue (or r, g, b): the fog color components on a 0 to 63 scale.
Components that are not present are assumed to be 0.
* remappal <palnum>: the palette number to take the index remapping from, i.e. 21
for blue -> red. When absent, defaults to 0.
* remapself: when present, specifies that the remappal is the same as the 'pal'.
This is to prevent textual redundancy when overwriting existing palookups.
Examples (best tested with tile #251):
1) makepalookup { pal 200 red 30 remappal 23 }
This creates palookup 200 with a fog of (30,0,0) and a blue-to-yellow remapping
(assuming it has not been changed before)
2) makepalookup { pal 21 red 30 remapself }
This 'fogifies' palookup 21 with a red fog.
3) makepalookup { pal 21 red 30 }
This overwrites palookup 21 with a red fog, but clears the blue-to-red remapping.
The fog aspect of this command affects the GL modes just like 'fogpal', but the
remapping has no effect for hightiles.
- Also, silently clamp 'fogpal' r,g,b values to the range 0 .. 63.
git-svn-id: https://svn.eduke32.com/eduke32@2568 1a8010ca-5511-0410-912e-c29ae57300e0
2012-03-29 21:16:41 +00:00
remappal = pal ;
}
// NOTE: all palookups are initialized, i.e. non-NULL!
// NOTE2: aliasing (pal==remappal) is OK
2018-04-12 21:03:12 +00:00
paletteMakeLookupTable ( pal , palookup [ remappal ] , red < < 2 , green < < 2 , blue < < 2 ,
2015-03-27 12:29:52 +00:00
remappal = = 0 ? 1 : ( nofloorpal = = - 1 ? g_noFloorPal [ remappal ] : nofloorpal ) ) ;
DEF command 'makepalookup', allowing indpt. specification of fog and color remapping.
The syntax is as follows:
makepalookup { <token-list...> }
where valid tokens are
* pal <palnum>: the palette number, 1 .. 250
* red <num>, green, blue (or r, g, b): the fog color components on a 0 to 63 scale.
Components that are not present are assumed to be 0.
* remappal <palnum>: the palette number to take the index remapping from, i.e. 21
for blue -> red. When absent, defaults to 0.
* remapself: when present, specifies that the remappal is the same as the 'pal'.
This is to prevent textual redundancy when overwriting existing palookups.
Examples (best tested with tile #251):
1) makepalookup { pal 200 red 30 remappal 23 }
This creates palookup 200 with a fog of (30,0,0) and a blue-to-yellow remapping
(assuming it has not been changed before)
2) makepalookup { pal 21 red 30 remapself }
This 'fogifies' palookup 21 with a red fog.
3) makepalookup { pal 21 red 30 }
This overwrites palookup 21 with a red fog, but clears the blue-to-red remapping.
The fog aspect of this command affects the GL modes just like 'fogpal', but the
remapping has no effect for hightiles.
- Also, silently clamp 'fogpal' r,g,b values to the range 0 .. 63.
git-svn-id: https://svn.eduke32.com/eduke32@2568 1a8010ca-5511-0410-912e-c29ae57300e0
2012-03-29 21:16:41 +00:00
}
break ;
2006-04-24 19:04:22 +00:00
case T_TEXTURE :
2006-11-13 23:12:47 +00:00
{
char * texturetokptr = script - > ltextptr , * textureend ;
2009-01-09 09:29:17 +00:00
int32_t tile = - 1 , token ;
2006-11-13 23:12:47 +00:00
2010-08-02 08:13:51 +00:00
static const tokenlist texturetokens [ ] =
{
{ " pal " , T_PAL } ,
{ " detail " , T_DETAIL } ,
{ " glow " , T_GLOW } ,
{ " specular " , T_SPECULAR } ,
{ " normal " , T_NORMAL } ,
} ;
2006-11-13 23:12:47 +00:00
if ( scriptfile_getsymbol ( script , & tile ) ) break ;
if ( scriptfile_getbraces ( script , & textureend ) ) break ;
2007-12-12 17:42:14 +00:00
while ( script - > textptr < textureend )
{
2014-03-22 09:25:15 +00:00
token = getatoken ( script , texturetokens , ARRAY_SIZE ( texturetokens ) ) ;
2007-12-12 17:42:14 +00:00
switch ( token )
{
case T_PAL :
{
2006-11-13 23:12:47 +00:00
char * paltokptr = script - > ltextptr , * palend ;
2013-09-14 17:58:46 +00:00
int32_t pal = - 1 , xsiz = 0 , ysiz = 0 ;
2012-03-28 19:41:39 +00:00
char * fn = NULL ;
2009-10-04 15:41:40 +00:00
double alphacut = - 1.0 , xscale = 1.0 , yscale = 1.0 , specpower = 1.0 , specfactor = 1.0 ;
2019-10-17 10:45:25 +00:00
uint8_t flags = 0 ;
2006-11-13 23:12:47 +00:00
2010-08-02 08:13:51 +00:00
static const tokenlist texturetokens_pal [ ] =
{
{ " file " , T_FILE } , { " name " , T_FILE } ,
{ " alphacut " , T_ALPHACUT } ,
{ " detailscale " , T_XSCALE } , { " scale " , T_XSCALE } , { " xscale " , T_XSCALE } , { " intensity " , T_XSCALE } ,
{ " yscale " , T_YSCALE } ,
2012-03-26 05:06:31 +00:00
{ " specpower " , T_SPECPOWER } , { " specularpower " , T_SPECPOWER } , { " parallaxscale " , T_SPECPOWER } ,
{ " specfactor " , T_SPECFACTOR } , { " specularfactor " , T_SPECFACTOR } , { " parallaxbias " , T_SPECFACTOR } ,
2010-08-02 08:13:51 +00:00
{ " nocompress " , T_NOCOMPRESS } ,
{ " nodownsize " , T_NODOWNSIZE } ,
2015-03-28 09:49:37 +00:00
{ " forcefilter " , T_FORCEFILTER } ,
2016-05-02 18:29:35 +00:00
{ " artquality " , T_ARTQUALITY } ,
2013-09-14 17:58:46 +00:00
{ " orig_sizex " , T_ORIGSIZEX } , { " orig_sizey " , T_ORIGSIZEY }
2010-08-02 08:13:51 +00:00
} ;
2006-11-13 23:12:47 +00:00
if ( scriptfile_getsymbol ( script , & pal ) ) break ;
if ( scriptfile_getbraces ( script , & palend ) ) break ;
2007-12-12 17:42:14 +00:00
while ( script - > textptr < palend )
{
2014-03-22 09:25:15 +00:00
switch ( getatoken ( script , texturetokens_pal , ARRAY_SIZE ( texturetokens_pal ) ) )
2007-12-12 17:42:14 +00:00
{
2006-11-13 23:12:47 +00:00
case T_FILE :
scriptfile_getstring ( script , & fn ) ; break ;
case T_ALPHACUT :
scriptfile_getdouble ( script , & alphacut ) ; break ;
2007-02-17 02:23:50 +00:00
case T_XSCALE :
scriptfile_getdouble ( script , & xscale ) ; break ;
case T_YSCALE :
scriptfile_getdouble ( script , & yscale ) ; break ;
2009-10-04 15:41:40 +00:00
case T_SPECPOWER :
scriptfile_getdouble ( script , & specpower ) ; break ;
case T_SPECFACTOR :
scriptfile_getdouble ( script , & specfactor ) ; break ;
2013-09-14 17:58:46 +00:00
case T_ORIGSIZEX :
scriptfile_getnumber ( script , & xsiz ) ;
break ;
case T_ORIGSIZEY :
scriptfile_getnumber ( script , & ysiz ) ;
break ;
2006-11-13 23:12:47 +00:00
default :
break ;
}
2006-04-24 19:04:22 +00:00
}
2014-10-25 03:36:34 +00:00
if ( EDUKE32_PREDICT_FALSE ( ( unsigned ) tile > = MAXUSERTILES ) ) break ; // message is printed later
if ( EDUKE32_PREDICT_FALSE ( ( unsigned ) pal > = MAXPALOOKUPS - RESERVEDPALS ) )
2007-12-12 17:42:14 +00:00
{
2013-09-13 20:23:59 +00:00
initprintf ( " Error: missing or invalid 'palette number' for texture definition near "
" line %s:%d \n " , script - > filename , scriptfile_getlinum ( script , paltokptr ) ) ;
2006-11-13 23:12:47 +00:00
break ;
}
2014-10-25 03:36:34 +00:00
if ( EDUKE32_PREDICT_FALSE ( ! fn ) )
2007-12-12 17:42:14 +00:00
{
2013-09-13 20:23:59 +00:00
initprintf ( " Error: missing 'file name' for texture definition near line %s:%d \n " ,
2006-11-13 23:12:47 +00:00
script - > filename , scriptfile_getlinum ( script , paltokptr ) ) ;
break ;
}
2007-04-30 19:41:19 +00:00
2019-12-07 09:31:27 +00:00
if ( EDUKE32_PREDICT_FALSE ( fileSystem . FileExists ( fn ) ) )
2012-03-28 19:41:39 +00:00
break ;
2007-05-01 04:35:27 +00:00
2013-09-14 17:58:46 +00:00
if ( xsiz > 0 & & ysiz > 0 )
{
2019-10-15 21:29:47 +00:00
tileSetDummy ( tile , xsiz , ysiz ) ;
2013-09-14 17:58:46 +00:00
}
2007-02-17 02:23:50 +00:00
xscale = 1.0f / xscale ;
yscale = 1.0f / yscale ;
2019-10-17 10:45:25 +00:00
tileSetHightileReplacement ( tile , pal , fn , alphacut , xscale , yscale , specpower , specfactor , flags ) ;
2007-12-12 17:42:14 +00:00
}
break ;
2009-04-28 22:56:43 +00:00
case T_DETAIL : case T_GLOW : case T_SPECULAR : case T_NORMAL :
2007-12-12 17:42:14 +00:00
{
2007-01-15 09:08:57 +00:00
char * detailtokptr = script - > ltextptr , * detailend ;
2012-03-28 19:41:39 +00:00
int32_t pal = 0 ;
2013-01-08 06:17:10 +00:00
char flags = 0 ;
2012-03-28 19:41:39 +00:00
char * fn = NULL ;
2009-04-28 22:56:43 +00:00
double xscale = 1.0 , yscale = 1.0 , specpower = 1.0 , specfactor = 1.0 ;
2007-01-15 09:08:57 +00:00
2010-08-02 08:13:51 +00:00
static const tokenlist texturetokens_pal [ ] =
{
{ " file " , T_FILE } , { " name " , T_FILE } ,
{ " alphacut " , T_ALPHACUT } ,
{ " detailscale " , T_XSCALE } , { " scale " , T_XSCALE } , { " xscale " , T_XSCALE } , { " intensity " , T_XSCALE } ,
{ " yscale " , T_YSCALE } ,
2012-03-26 05:06:31 +00:00
{ " specpower " , T_SPECPOWER } , { " specularpower " , T_SPECPOWER } , { " parallaxscale " , T_SPECPOWER } ,
{ " specfactor " , T_SPECFACTOR } , { " specularfactor " , T_SPECFACTOR } , { " parallaxbias " , T_SPECFACTOR } ,
2010-08-02 08:13:51 +00:00
{ " nocompress " , T_NOCOMPRESS } ,
{ " nodownsize " , T_NODOWNSIZE } ,
2015-03-28 09:49:37 +00:00
{ " forcefilter " , T_FORCEFILTER } ,
2016-05-02 18:29:35 +00:00
{ " artquality " , T_ARTQUALITY } ,
2010-08-02 08:13:51 +00:00
} ;
2014-10-25 03:36:34 +00:00
if ( EDUKE32_PREDICT_FALSE ( scriptfile_getbraces ( script , & detailend ) ) ) break ;
2007-12-12 17:42:14 +00:00
while ( script - > textptr < detailend )
{
2014-03-22 09:25:15 +00:00
switch ( getatoken ( script , texturetokens_pal , ARRAY_SIZE ( texturetokens_pal ) ) )
2007-12-12 17:42:14 +00:00
{
2007-01-15 09:08:57 +00:00
case T_FILE :
scriptfile_getstring ( script , & fn ) ; break ;
2007-02-17 02:23:50 +00:00
case T_XSCALE :
2007-03-01 18:19:11 +00:00
scriptfile_getdouble ( script , & xscale ) ; break ;
case T_YSCALE :
scriptfile_getdouble ( script , & yscale ) ; break ;
2009-04-28 22:56:43 +00:00
case T_SPECPOWER :
scriptfile_getdouble ( script , & specpower ) ; break ;
case T_SPECFACTOR :
scriptfile_getdouble ( script , & specfactor ) ; break ;
2007-01-15 09:08:57 +00:00
default :
break ;
}
}
2014-10-25 03:36:34 +00:00
if ( EDUKE32_PREDICT_FALSE ( ( unsigned ) tile > = MAXUSERTILES ) ) break ; // message is printed later
if ( EDUKE32_PREDICT_FALSE ( ! fn ) )
2007-12-12 17:42:14 +00:00
{
2013-09-13 20:23:59 +00:00
initprintf ( " Error: missing 'file name' for texture definition near line %s:%d \n " ,
2007-01-15 09:08:57 +00:00
script - > filename , scriptfile_getlinum ( script , detailtokptr ) ) ;
break ;
}
2007-04-30 19:41:19 +00:00
2019-12-07 09:31:27 +00:00
if ( EDUKE32_PREDICT_FALSE ( fileSystem . FileExists ( fn ) ) )
2012-03-28 19:41:39 +00:00
break ;
2007-01-15 09:08:57 +00:00
2007-12-20 19:14:38 +00:00
switch ( token )
2007-02-16 01:34:41 +00:00
{
2007-12-20 19:14:38 +00:00
case T_DETAIL :
2007-02-16 01:34:41 +00:00
pal = DETAILPAL ;
2007-03-01 18:19:11 +00:00
xscale = 1.0f / xscale ;
2007-03-03 23:09:40 +00:00
yscale = 1.0f / yscale ;
2007-12-20 19:14:38 +00:00
break ;
case T_GLOW :
2007-02-16 01:34:41 +00:00
pal = GLOWPAL ;
2007-12-20 19:14:38 +00:00
break ;
2009-04-28 22:56:43 +00:00
case T_SPECULAR :
pal = SPECULARPAL ;
break ;
case T_NORMAL :
pal = NORMALPAL ;
break ;
2007-12-20 19:14:38 +00:00
}
2019-10-17 10:45:25 +00:00
tileSetHightileReplacement ( tile , pal , fn , - 1.0f , xscale , yscale , specpower , specfactor , flags ) ;
2007-12-12 17:42:14 +00:00
}
break ;
2006-11-13 23:12:47 +00:00
default :
2006-04-24 19:04:22 +00:00
break ;
}
}
2014-10-25 03:36:34 +00:00
if ( EDUKE32_PREDICT_FALSE ( ( unsigned ) tile > = MAXUSERTILES ) )
2007-12-12 17:42:14 +00:00
{
2013-09-13 20:23:59 +00:00
initprintf ( " Error: missing or invalid 'tile number' for texture definition near line %s:%d \n " ,
2006-11-13 23:12:47 +00:00
script - > filename , scriptfile_getlinum ( script , texturetokptr ) ) ;
break ;
}
}
break ;
2006-04-24 19:04:22 +00:00
case T_UNDEFMODEL :
case T_UNDEFMODELRANGE :
2006-11-13 23:12:47 +00:00
{
2009-01-09 09:29:17 +00:00
int32_t r0 , r1 ;
2006-11-13 23:12:47 +00:00
2014-10-25 03:36:34 +00:00
if ( EDUKE32_PREDICT_FALSE ( scriptfile_getsymbol ( script , & r0 ) ) ) break ;
2007-12-12 17:42:14 +00:00
if ( tokn = = T_UNDEFMODELRANGE )
{
2006-11-13 23:12:47 +00:00
if ( scriptfile_getsymbol ( script , & r1 ) ) break ;
2012-04-04 18:58:19 +00:00
if ( check_tile_range ( " undefmodelrange " , & r0 , & r1 , script , cmdtokptr ) )
2006-11-13 23:12:47 +00:00
break ;
2007-12-12 17:42:14 +00:00
}
else
{
2006-11-13 23:12:47 +00:00
r1 = r0 ;
2012-04-04 18:58:19 +00:00
2013-12-01 18:27:55 +00:00
if ( check_tile ( " undefmodel " , r0 , script , cmdtokptr ) )
2006-11-13 23:12:47 +00:00
break ;
}
2011-03-04 08:50:58 +00:00
# ifdef USE_OPENGL
2012-04-04 18:58:19 +00:00
for ( ; r0 < = r1 ; r0 + + )
md_undefinetile ( r0 ) ;
2006-04-23 06:44:19 +00:00
# endif
2006-11-13 23:12:47 +00:00
}
break ;
2006-04-23 06:44:19 +00:00
2006-04-24 19:04:22 +00:00
case T_UNDEFMODELOF :
2006-11-13 23:12:47 +00:00
{
2009-01-09 09:29:17 +00:00
int32_t r0 ;
2016-12-26 06:02:06 +00:00
# if defined USE_OPENGL && 0
2009-01-09 09:29:17 +00:00
int32_t mid ;
2008-07-24 11:16:20 +00:00
# endif
2006-04-23 06:44:19 +00:00
2014-10-25 03:36:34 +00:00
if ( EDUKE32_PREDICT_FALSE ( scriptfile_getsymbol ( script , & r0 ) ) ) break ;
2012-04-04 18:58:19 +00:00
2013-12-01 18:27:55 +00:00
if ( check_tile ( " undefmodelof " , r0 , script , cmdtokptr ) )
2006-11-13 23:12:47 +00:00
break ;
2012-04-04 18:58:19 +00:00
// XXX: See comment of md_undefinemodel()
2013-09-13 20:23:59 +00:00
initprintf ( " Warning: undefmodelof: currently non-functional. \n " ) ;
2012-04-04 18:58:19 +00:00
break ;
2006-04-23 06:44:19 +00:00
2016-12-26 06:02:06 +00:00
# if defined USE_OPENGL && 0
2007-12-20 19:14:38 +00:00
mid = md_tilehasmodel ( r0 , 0 ) ;
2006-11-13 23:12:47 +00:00
if ( mid < 0 ) break ;
2006-04-23 06:44:19 +00:00
2006-11-13 23:12:47 +00:00
md_undefinemodel ( mid ) ;
2006-04-23 06:44:19 +00:00
# endif
2006-11-13 23:12:47 +00:00
}
break ;
2006-04-24 19:04:22 +00:00
case T_UNDEFTEXTURE :
case T_UNDEFTEXTURERANGE :
2006-11-13 23:12:47 +00:00
{
2013-01-08 06:17:10 +00:00
int32_t r0 , r1 ;
2014-10-25 03:36:34 +00:00
if ( EDUKE32_PREDICT_FALSE ( scriptfile_getsymbol ( script , & r0 ) ) ) break ;
2007-12-12 17:42:14 +00:00
if ( tokn = = T_UNDEFTEXTURERANGE )
{
2014-10-25 03:36:34 +00:00
if ( EDUKE32_PREDICT_FALSE ( scriptfile_getsymbol ( script , & r1 ) ) ) break ;
2012-04-04 18:58:19 +00:00
2014-10-25 03:36:34 +00:00
if ( EDUKE32_PREDICT_FALSE ( check_tile_range ( " undeftexturerange " , & r0 , & r1 , script , cmdtokptr ) ) )
2006-11-13 23:12:47 +00:00
break ;
2007-12-12 17:42:14 +00:00
}
else
{
2006-11-13 23:12:47 +00:00
r1 = r0 ;
2012-04-04 18:58:19 +00:00
2014-10-25 03:36:34 +00:00
if ( EDUKE32_PREDICT_FALSE ( check_tile ( " undeftexture " , r0 , script , cmdtokptr ) ) )
2006-11-13 23:12:47 +00:00
break ;
2006-04-24 19:04:22 +00:00
}
2019-10-17 10:45:25 +00:00
for ( ; r0 < = r1 ; r0 + + ) tileRemoveReplacement ( r0 ) ;
2006-11-13 23:12:47 +00:00
}
break ;
2006-04-24 19:04:22 +00:00
2015-02-11 05:22:07 +00:00
case T_CUTSCENE :
Possibility of specifying sounds for a VPX anim-replacement via DEF.
The syntax is as follows:
animsounds <anim> { frame1 sound1 frame2 sound2 ... }
<anim> has to be one of the tokens: cineov2, cineov3, RADLOGO, DUKETEAM,
logo, vol41a, vol42a, vol4e1, vol43a, vol4e2, or vol4e3, corresponding
to hard-coded Duke3D anims.
The frameN's (1-based frame numbers) have to be in ascending order (but not
necessarily strictly ascending, so that a frame may have more than one sound).
Example: for Duke3D's XBLA nuke logo animation (IVF extracted from nuke.webm),
the following definition overlays the video with a sound sequence similar
(identical save for timing) to the original nuke animation:
// frame 1: FLY_BY, frame 64: PIPEBOMB_EXPLODE
animsounds logo { 1 244 64 14 }
git-svn-id: https://svn.eduke32.com/eduke32@2242 1a8010ca-5511-0410-912e-c29ae57300e0
2012-01-10 23:43:54 +00:00
case T_ANIMSOUNDS :
{
char * dummy ;
static const tokenlist dummytokens [ ] = { { " id " , T_ID } , } ;
2014-10-25 03:36:34 +00:00
if ( EDUKE32_PREDICT_FALSE ( scriptfile_getstring ( script , & dummy ) ) ) break ;
if ( EDUKE32_PREDICT_FALSE ( scriptfile_getbraces ( script , & dummy ) ) ) break ;
Possibility of specifying sounds for a VPX anim-replacement via DEF.
The syntax is as follows:
animsounds <anim> { frame1 sound1 frame2 sound2 ... }
<anim> has to be one of the tokens: cineov2, cineov3, RADLOGO, DUKETEAM,
logo, vol41a, vol42a, vol4e1, vol43a, vol4e2, or vol4e3, corresponding
to hard-coded Duke3D anims.
The frameN's (1-based frame numbers) have to be in ascending order (but not
necessarily strictly ascending, so that a frame may have more than one sound).
Example: for Duke3D's XBLA nuke logo animation (IVF extracted from nuke.webm),
the following definition overlays the video with a sound sequence similar
(identical save for timing) to the original nuke animation:
// frame 1: FLY_BY, frame 64: PIPEBOMB_EXPLODE
animsounds logo { 1 244 64 14 }
git-svn-id: https://svn.eduke32.com/eduke32@2242 1a8010ca-5511-0410-912e-c29ae57300e0
2012-01-10 23:43:54 +00:00
while ( script - > textptr < dummy )
{
// XXX?
getatoken ( script , dummytokens , sizeof ( dummytokens ) / sizeof ( dummytokens ) ) ;
}
}
break ;
2012-10-14 20:41:34 +00:00
case T_TEXHITSCANRANGE :
2012-11-25 13:19:06 +00:00
case T_NOFULLBRIGHTRANGE :
2012-10-14 20:41:34 +00:00
{
int32_t b , e , i ;
Ensure that anywhere the def parser takes a tilenum or palnum accepts defined tokens in addition to integer literals, if it doesn't already.
Affects fogpal, nofloorpalrange, setuptilerange, dummytilerange, undefinetilerange, definemodelframe, definevoxeltiles, texhitscanrange, nofullbrightrange, and light.
git-svn-id: https://svn.eduke32.com/eduke32@6896 1a8010ca-5511-0410-912e-c29ae57300e0
2018-05-23 05:43:35 +00:00
if ( EDUKE32_PREDICT_FALSE ( scriptfile_getsymbol ( script , & b ) ) ) break ;
if ( EDUKE32_PREDICT_FALSE ( scriptfile_getsymbol ( script , & e ) ) ) break ;
2012-10-14 20:41:34 +00:00
b = max ( b , 0 ) ;
2013-12-28 17:04:22 +00:00
e = min ( e , MAXUSERTILES - 1 ) ;
2012-10-14 20:41:34 +00:00
for ( i = b ; i < = e ; i + + )
2012-11-25 13:19:06 +00:00
picanm [ i ] . sf | = ( tokn = = T_TEXHITSCANRANGE ) ?
PICANM_TEXHITSCAN_BIT : PICANM_NOFULLBRIGHT_BIT ;
2012-10-14 20:41:34 +00:00
}
break ;
2010-08-02 08:13:51 +00:00
case T_SOUND :
2007-12-20 19:14:38 +00:00
case T_MUSIC :
{
2008-03-08 05:23:15 +00:00
char * dummy , * dummy2 ;
2010-08-02 08:13:51 +00:00
static const tokenlist sound_musictokens [ ] =
2007-12-20 19:14:38 +00:00
{
2010-08-02 08:13:51 +00:00
{ " id " , T_ID } ,
{ " file " , T_FILE } ,
} ;
2007-12-20 19:14:38 +00:00
2014-10-25 03:36:34 +00:00
if ( EDUKE32_PREDICT_FALSE ( scriptfile_getbraces ( script , & dummy ) ) ) break ;
2008-03-08 05:23:15 +00:00
while ( script - > textptr < dummy )
2007-12-20 19:14:38 +00:00
{
2014-03-22 09:25:15 +00:00
switch ( getatoken ( script , sound_musictokens , ARRAY_SIZE ( sound_musictokens ) ) )
2007-12-20 19:14:38 +00:00
{
case T_ID :
2010-08-02 08:13:51 +00:00
scriptfile_getstring ( script , & dummy2 ) ;
2008-03-08 05:23:15 +00:00
break ;
2007-12-20 19:14:38 +00:00
case T_FILE :
2008-03-08 05:23:15 +00:00
scriptfile_getstring ( script , & dummy2 ) ;
break ;
2007-12-20 19:14:38 +00:00
}
}
}
break ;
2012-12-23 03:12:50 +00:00
case T_MAPINFO :
{
2015-01-08 15:14:00 +00:00
char * mapmd4string = NULL , * title = NULL , * mhkfile = NULL , * mapinfoend , * dummy ;
2012-12-23 03:12:50 +00:00
static const tokenlist mapinfotokens [ ] =
{
{ " mapfile " , T_MAPFILE } ,
{ " maptitle " , T_MAPTITLE } ,
{ " mapmd4 " , T_MAPMD4 } ,
{ " mhkfile " , T_MHKFILE } ,
} ;
2015-01-08 15:14:00 +00:00
int32_t previous_usermaphacks = num_usermaphacks ;
2012-12-23 03:12:50 +00:00
2015-01-08 15:14:00 +00:00
if ( EDUKE32_PREDICT_FALSE ( scriptfile_getbraces ( script , & mapinfoend ) ) ) break ;
while ( script - > textptr < mapinfoend )
2012-12-23 03:12:50 +00:00
{
2014-03-22 09:25:15 +00:00
switch ( getatoken ( script , mapinfotokens , ARRAY_SIZE ( mapinfotokens ) ) )
2012-12-23 03:12:50 +00:00
{
case T_MAPFILE :
2015-01-08 15:14:00 +00:00
scriptfile_getstring ( script , & dummy ) ;
2012-12-23 03:12:50 +00:00
break ;
case T_MAPTITLE :
2015-01-08 15:14:00 +00:00
scriptfile_getstring ( script , & title ) ;
2012-12-23 03:12:50 +00:00
break ;
case T_MAPMD4 :
2015-01-08 15:14:00 +00:00
{
scriptfile_getstring ( script , & mapmd4string ) ;
num_usermaphacks + + ;
usermaphacks = ( usermaphack_t * ) Xrealloc ( usermaphacks , num_usermaphacks * sizeof ( usermaphack_t ) ) ;
usermaphack_t * newusermaphack = & usermaphacks [ num_usermaphacks - 1 ] ;
2016-08-27 01:41:21 +00:00
for ( bssize_t i = 0 ; i < 16 ; i + + )
2015-01-08 15:14:00 +00:00
{
char smallbuf [ 3 ] = { 0 , 0 , 0 } ;
smallbuf [ 0 ] = mapmd4string [ 2 * i ] ;
smallbuf [ 1 ] = mapmd4string [ 2 * i + 1 ] ;
newusermaphack - > md4 [ i ] = Bstrtol ( smallbuf , NULL , 16 ) ;
}
2012-12-23 03:12:50 +00:00
break ;
2015-01-08 15:14:00 +00:00
}
2012-12-23 03:12:50 +00:00
case T_MHKFILE :
2015-01-08 15:14:00 +00:00
scriptfile_getstring ( script , & mhkfile ) ;
2012-12-23 03:12:50 +00:00
break ;
}
}
2015-01-08 15:14:00 +00:00
for ( ; previous_usermaphacks < num_usermaphacks ; previous_usermaphacks + + )
{
2018-10-25 23:28:56 +00:00
usermaphacks [ previous_usermaphacks ] . mhkfile = mhkfile ? Xstrdup ( mhkfile ) : NULL ;
usermaphacks [ previous_usermaphacks ] . title = title ? Xstrdup ( title ) : NULL ;
2015-01-08 15:14:00 +00:00
}
2012-12-23 03:12:50 +00:00
}
break ;
2012-03-10 09:44:17 +00:00
case T_ECHO :
{
char * string = NULL ;
scriptfile_getstring ( script , & string ) ;
2013-09-13 20:23:59 +00:00
initprintf ( " %s \n " , string ) ;
2012-03-10 09:44:17 +00:00
}
break ;
2015-03-09 20:32:36 +00:00
case T_GLOBALFLAGS :
{
if ( scriptfile_getnumber ( script , & globalflags ) ) break ;
}
break ;
2015-04-24 00:08:46 +00:00
case T_GLOBALGAMEFLAGS :
{
int32_t dummy ;
if ( scriptfile_getnumber ( script , & dummy ) ) break ;
}
break ;
2015-05-27 08:47:50 +00:00
case T_MULTIPSKY :
{
char * blockend ;
int32_t tile ;
static const tokenlist subtokens [ ] =
{
{ " horizfrac " , T_HORIZFRAC } ,
2016-10-14 07:40:53 +00:00
{ " yoffset " , T_YOFFSET } ,
2015-05-27 08:47:50 +00:00
{ " lognumtiles " , T_LOGNUMTILES } ,
{ " tile " , T_TILE } ,
{ " panel " , T_TILE } ,
2017-11-29 07:29:48 +00:00
{ " yscale " , T_YSCALE } ,
2015-05-27 08:47:50 +00:00
} ;
if ( scriptfile_getsymbol ( script , & tile ) )
break ;
if ( scriptfile_getbraces ( script , & blockend ) )
break ;
if ( tile ! = DEFAULTPSKY & & ( unsigned ) tile > = MAXUSERTILES )
{
2019-08-09 09:41:05 +00:00
script - > textptr = blockend + 1 ;
2015-05-27 08:47:50 +00:00
break ;
}
2018-04-12 21:03:47 +00:00
psky_t * const newpsky = tileSetupSky ( tile ) ;
2015-05-27 08:47:50 +00:00
while ( script - > textptr < blockend )
{
int32_t token = getatoken ( script , subtokens , ARRAY_SIZE ( subtokens ) ) ;
switch ( token )
{
case T_HORIZFRAC :
{
int32_t horizfrac ;
scriptfile_getsymbol ( script , & horizfrac ) ;
newpsky - > horizfrac = horizfrac ;
break ;
}
2016-10-14 07:40:53 +00:00
case T_YOFFSET :
{
int32_t yoffset ;
scriptfile_getsymbol ( script , & yoffset ) ;
newpsky - > yoffs = yoffset ;
break ;
}
2015-05-27 08:47:50 +00:00
case T_LOGNUMTILES :
{
int32_t lognumtiles ;
scriptfile_getsymbol ( script , & lognumtiles ) ;
if ( ( 1 < < lognumtiles ) > MAXPSKYTILES )
break ;
newpsky - > lognumtiles = lognumtiles ;
break ;
}
case T_TILE :
{
int32_t panel , offset ;
scriptfile_getsymbol ( script , & panel ) ;
scriptfile_getsymbol ( script , & offset ) ;
if ( ( unsigned ) panel > = MAXPSKYTILES )
break ;
if ( ( unsigned ) offset > PSKYOFF_MAX )
break ;
newpsky - > tileofs [ panel ] = offset ;
break ;
}
2017-11-29 07:29:48 +00:00
case T_YSCALE :
{
int32_t yscale ;
scriptfile_getsymbol ( script , & yscale ) ;
newpsky - > yscale = yscale ;
break ;
}
2015-05-27 08:47:50 +00:00
default :
break ;
}
}
}
break ;
2015-09-23 17:55:19 +00:00
case T_BASEPALETTE :
{
char * blockend ;
int32_t id ;
static const tokenlist subtokens [ ] =
{
{ " raw " , T_RAW } ,
{ " copy " , T_COPY } ,
2015-10-03 11:52:51 +00:00
{ " undef " , T_UNDEF } ,
2015-09-23 17:55:19 +00:00
} ;
if ( scriptfile_getsymbol ( script , & id ) )
break ;
if ( scriptfile_getbraces ( script , & blockend ) )
break ;
if ( EDUKE32_PREDICT_FALSE ( ( unsigned ) id > = MAXBASEPALS ) )
{
initprintf ( " Error: basepalette: Invalid basepal number on line %s:%d \n " ,
script - > filename , scriptfile_getlinum ( script , cmdtokptr ) ) ;
2019-08-09 09:41:05 +00:00
script - > textptr = blockend + 1 ;
2015-09-23 17:55:19 +00:00
break ;
}
int didLoadPal = 0 ;
while ( script - > textptr < blockend )
{
int32_t token = getatoken ( script , subtokens , ARRAY_SIZE ( subtokens ) ) ;
switch ( token )
{
case T_RAW :
{
char * rawblockend ;
static const tokenlist rawsubtokens [ ] =
{
{ " file " , T_FILE } ,
{ " offset " , T_OFFSET } ,
{ " shiftleft " , T_SHIFTLEFT } ,
} ;
if ( scriptfile_getbraces ( script , & rawblockend ) )
break ;
char * fn = NULL ;
int32_t offset = 0 ;
int32_t shiftleft = 0 ;
while ( script - > textptr < rawblockend )
{
int32_t token = getatoken ( script , rawsubtokens , ARRAY_SIZE ( rawsubtokens ) ) ;
switch ( token )
{
case T_FILE :
{
scriptfile_getstring ( script , & fn ) ;
break ;
}
case T_OFFSET :
{
scriptfile_getnumber ( script , & offset ) ;
break ;
}
case T_SHIFTLEFT :
{
scriptfile_getnumber ( script , & shiftleft ) ;
break ;
}
default :
break ;
}
}
if ( EDUKE32_PREDICT_FALSE ( fn = = NULL ) )
{
initprintf ( " Error: basepalette: No filename provided on line %s:%d \n " ,
script - > filename , scriptfile_getlinum ( script , cmdtokptr ) ) ;
break ;
}
if ( EDUKE32_PREDICT_FALSE ( offset < 0 ) )
{
initprintf ( " Error: basepalette: Invalid file offset on line %s:%d \n " ,
script - > filename , scriptfile_getlinum ( script , cmdtokptr ) ) ;
break ;
}
if ( EDUKE32_PREDICT_FALSE ( ( unsigned ) shiftleft > = 8 ) )
{
initprintf ( " Error: basepalette: Invalid left shift provided on line %s:%d \n " ,
script - > filename , scriptfile_getlinum ( script , cmdtokptr ) ) ;
break ;
}
2019-12-07 09:14:51 +00:00
FileReader fil = fileSystem . OpenFileReader ( fn , 0 ) ;
2019-10-21 15:16:08 +00:00
if ( ! fil . isOpen ( ) )
2015-09-23 17:55:19 +00:00
{
initprintf ( " Error: basepalette: Failed opening \" %s \" on line %s:%d \n " , fn ,
script - > filename , scriptfile_getlinum ( script , cmdtokptr ) ) ;
break ;
}
2019-10-21 15:16:08 +00:00
if ( fil . Seek ( offset , FileReader : : SeekSet ) < 0 )
2015-09-23 17:55:19 +00:00
{
initprintf ( " Error: basepalette: Seek failed on line %s:%d \n " ,
script - > filename , scriptfile_getlinum ( script , cmdtokptr ) ) ;
break ;
}
2019-10-21 15:16:08 +00:00
auto palbuf = fil . Read ( ) ;
if ( palbuf . Size ( ) < 768 )
2015-09-23 17:55:19 +00:00
{
initprintf ( " Error: basepalette: Read failed on line %s:%d \n " ,
script - > filename , scriptfile_getlinum ( script , cmdtokptr ) ) ;
break ;
}
if ( shiftleft ! = 0 )
{
2016-08-27 01:41:21 +00:00
for ( bssize_t k = 0 ; k < 768 ; k + + )
2015-09-23 17:55:19 +00:00
palbuf [ k ] < < = shiftleft ;
}
2019-10-21 15:16:08 +00:00
paletteSetColorTable ( id , palbuf . Data ( ) ) ;
2015-09-23 17:55:19 +00:00
didLoadPal = 1 ;
break ;
}
case T_COPY :
{
int32_t source ;
scriptfile_getsymbol ( script , & source ) ;
if ( EDUKE32_PREDICT_FALSE ( ( unsigned ) source > = MAXBASEPALS | | source = = id ) )
{
initprintf ( " Error: basepalette: Invalid source basepal number on line %s:%d \n " ,
script - > filename , scriptfile_getlinum ( script , cmdtokptr ) ) ;
break ;
}
uint8_t const * const sourcetable = basepaltable [ source ] ;
if ( EDUKE32_PREDICT_FALSE ( sourcetable = = NULL ) )
{
initprintf ( " Error: basepalette: Source basepal does not exist on line %s:%d \n " ,
script - > filename , scriptfile_getlinum ( script , cmdtokptr ) ) ;
break ;
}
2018-04-12 21:03:12 +00:00
paletteSetColorTable ( id , sourcetable ) ;
2015-09-23 17:55:19 +00:00
didLoadPal = 1 ;
break ;
}
2015-10-03 11:52:51 +00:00
case T_UNDEF :
{
2018-04-12 21:03:12 +00:00
paletteFreeColorTable ( id ) ;
2015-10-03 11:52:51 +00:00
didLoadPal = 0 ;
if ( id = = 0 )
paletteloaded & = ~ PALETTE_MAIN ;
break ;
}
2015-09-23 17:55:19 +00:00
default :
break ;
}
}
if ( didLoadPal & & id = = 0 )
{
2015-09-27 21:17:59 +00:00
initfastcolorlookup_palette ( palette ) ;
2015-09-23 17:55:19 +00:00
paletteloaded | = PALETTE_MAIN ;
}
}
break ;
case T_PALOOKUP :
{
char * blockend ;
int32_t id ;
static const tokenlist subtokens [ ] =
{
{ " raw " , T_RAW } ,
{ " copy " , T_COPY } ,
2015-10-03 11:52:51 +00:00
{ " undef " , T_UNDEF } ,
2015-09-23 17:55:19 +00:00
{ " fogpal " , T_FOGPAL } ,
{ " makepalookup " , T_MAKEPALOOKUP } ,
{ " floorpal " , T_FLOORPAL } ,
{ " nofloorpal " , T_NOFLOORPAL } ,
} ;
if ( scriptfile_getsymbol ( script , & id ) )
break ;
if ( scriptfile_getbraces ( script , & blockend ) )
break ;
if ( EDUKE32_PREDICT_FALSE ( ( unsigned ) id > = MAXPALOOKUPS ) )
{
initprintf ( " Error: palookup: Invalid pal number on line %s:%d \n " ,
script - > filename , scriptfile_getlinum ( script , cmdtokptr ) ) ;
2019-08-09 09:41:05 +00:00
script - > textptr = blockend + 1 ;
2015-09-23 17:55:19 +00:00
break ;
}
int didLoadShade = 0 ;
while ( script - > textptr < blockend )
{
int32_t token = getatoken ( script , subtokens , ARRAY_SIZE ( subtokens ) ) ;
switch ( token )
{
case T_RAW :
{
char * subblockend ;
static const tokenlist rawsubtokens [ ] =
{
{ " file " , T_FILE } ,
{ " offset " , T_OFFSET } ,
{ " noshades " , T_NOSHADES } ,
} ;
if ( scriptfile_getbraces ( script , & subblockend ) )
break ;
char * fn = NULL ;
int32_t offset = 0 ;
int32_t length = 256 * 32 ; // hardcoding 32 instead of numshades
while ( script - > textptr < subblockend )
{
int32_t token = getatoken ( script , rawsubtokens , ARRAY_SIZE ( rawsubtokens ) ) ;
switch ( token )
{
case T_FILE :
{
scriptfile_getstring ( script , & fn ) ;
break ;
}
case T_OFFSET :
{
scriptfile_getnumber ( script , & offset ) ;
break ;
}
case T_NOSHADES :
{
length = 256 ;
break ;
}
default :
break ;
}
}
if ( EDUKE32_PREDICT_FALSE ( fn = = NULL ) )
{
initprintf ( " Error: palookup: No filename provided on line %s:%d \n " ,
script - > filename , scriptfile_getlinum ( script , cmdtokptr ) ) ;
break ;
}
if ( EDUKE32_PREDICT_FALSE ( offset < 0 ) )
{
initprintf ( " Error: palookup: Invalid file offset on line %s:%d \n " ,
script - > filename , scriptfile_getlinum ( script , cmdtokptr ) ) ;
break ;
}
2019-12-07 09:14:51 +00:00
FileReader fil = fileSystem . OpenFileReader ( fn , 0 ) ;
2019-10-21 15:16:08 +00:00
if ( ! fil . isOpen ( ) )
2015-09-23 17:55:19 +00:00
{
initprintf ( " Error: palookup: Failed opening \" %s \" on line %s:%d \n " , fn ,
script - > filename , scriptfile_getlinum ( script , cmdtokptr ) ) ;
break ;
}
2019-10-21 15:16:08 +00:00
if ( fil . Seek ( offset , FileReader : : SeekSet ) < 0 )
2015-09-23 17:55:19 +00:00
{
initprintf ( " Error: palookup: Seek failed on line %s:%d \n " ,
script - > filename , scriptfile_getlinum ( script , cmdtokptr ) ) ;
break ;
}
2019-10-21 15:16:08 +00:00
auto palookupbuf = fil . Read ( ) ;
if ( palookupbuf . Size ( ) < 256 )
2015-09-23 17:55:19 +00:00
{
initprintf ( " Error: palookup: Read failed on line %s:%d \n " ,
script - > filename , scriptfile_getlinum ( script , cmdtokptr ) ) ;
break ;
}
2019-10-21 17:36:54 +00:00
if ( palookupbuf . Size ( ) > = 256 * 32 )
2015-09-23 17:55:19 +00:00
{
didLoadShade = 1 ;
numshades = 32 ;
2019-10-21 15:16:08 +00:00
paletteSetLookupTable ( id , palookupbuf . Data ( ) ) ;
2015-09-23 17:55:19 +00:00
}
else
{
if ( EDUKE32_PREDICT_FALSE ( ! ( paletteloaded & PALETTE_SHADE ) ) )
{
initprintf ( " Error: palookup: Shade tables not loaded on line %s:%d \n " ,
script - > filename , scriptfile_getlinum ( script , cmdtokptr ) ) ;
break ;
}
2019-10-21 17:36:54 +00:00
paletteMakeLookupTable ( id , ( char * ) palookupbuf . Data ( ) , 0 , 0 , 0 , g_noFloorPal [ id ] ) ;
2015-09-23 17:55:19 +00:00
}
break ;
}
case T_COPY :
{
int32_t source ;
scriptfile_getsymbol ( script , & source ) ;
if ( EDUKE32_PREDICT_FALSE ( ( unsigned ) source > = MAXPALOOKUPS | | source = = id ) )
{
initprintf ( " Error: palookup: Invalid source pal number on line %s:%d \n " ,
script - > filename , scriptfile_getlinum ( script , cmdtokptr ) ) ;
break ;
}
if ( EDUKE32_PREDICT_FALSE ( source = = 0 & & ! ( paletteloaded & PALETTE_SHADE ) ) )
{
initprintf ( " Error: palookup: Shade tables not loaded on line %s:%d \n " ,
script - > filename , scriptfile_getlinum ( script , cmdtokptr ) ) ;
break ;
}
uint8_t const * const sourcepal = ( uint8_t * ) palookup [ source ] ;
if ( EDUKE32_PREDICT_FALSE ( sourcepal = = NULL ) )
{
initprintf ( " Error: palookup: Source palookup does not exist on line %s:%d \n " ,
script - > filename , scriptfile_getlinum ( script , cmdtokptr ) ) ;
break ;
}
2018-04-12 21:03:12 +00:00
paletteSetLookupTable ( id , sourcepal ) ;
2015-09-23 17:55:19 +00:00
didLoadShade = 1 ;
break ;
}
case T_FOGPAL :
{
char * subblockend ;
static const tokenlist fogpaltokens [ ] =
{
{ " red " , T_RED } , { " r " , T_RED } ,
{ " green " , T_GREEN } , { " g " , T_GREEN } ,
{ " blue " , T_BLUE } , { " b " , T_BLUE } ,
} ;
int32_t red = 0 , green = 0 , blue = 0 ;
if ( scriptfile_getbraces ( script , & subblockend ) )
break ;
while ( script - > textptr < subblockend )
{
switch ( getatoken ( script , fogpaltokens , ARRAY_SIZE ( fogpaltokens ) ) )
{
case T_RED :
scriptfile_getnumber ( script , & red ) ;
2015-10-10 06:57:36 +00:00
red = clamp ( red , 0 , 255 ) ;
2015-09-23 17:55:19 +00:00
break ;
case T_GREEN :
scriptfile_getnumber ( script , & green ) ;
2015-10-10 06:57:36 +00:00
green = clamp ( green , 0 , 255 ) ;
2015-09-23 17:55:19 +00:00
break ;
case T_BLUE :
scriptfile_getnumber ( script , & blue ) ;
2015-10-10 06:57:36 +00:00
blue = clamp ( blue , 0 , 255 ) ;
2015-09-23 17:55:19 +00:00
break ;
}
}
if ( EDUKE32_PREDICT_FALSE ( ! ( paletteloaded & PALETTE_SHADE ) ) )
{
initprintf ( " Error: palookup: Shade tables not loaded on line %s:%d \n " ,
script - > filename , scriptfile_getlinum ( script , cmdtokptr ) ) ;
break ;
}
2018-04-12 21:03:12 +00:00
paletteMakeLookupTable ( id , NULL , red , green , blue , 1 ) ;
2015-09-23 17:55:19 +00:00
break ;
}
case T_MAKEPALOOKUP :
{
char * subblockend ;
static const tokenlist makepalookuptokens [ ] =
{
{ " red " , T_RED } , { " r " , T_RED } ,
{ " green " , T_GREEN } , { " g " , T_GREEN } ,
{ " blue " , T_BLUE } , { " b " , T_BLUE } ,
{ " remappal " , T_REMAPPAL } ,
{ " remapself " , T_REMAPSELF } ,
} ;
int32_t red = 0 , green = 0 , blue = 0 ;
int32_t remappal = - 1 ;
if ( scriptfile_getbraces ( script , & subblockend ) )
break ;
while ( script - > textptr < subblockend )
{
switch ( getatoken ( script , makepalookuptokens , ARRAY_SIZE ( makepalookuptokens ) ) )
{
case T_RED :
scriptfile_getnumber ( script , & red ) ;
2015-10-10 06:57:36 +00:00
red = clamp ( red , 0 , 255 ) ;
2015-09-23 17:55:19 +00:00
break ;
case T_GREEN :
scriptfile_getnumber ( script , & green ) ;
2015-10-10 06:57:36 +00:00
green = clamp ( green , 0 , 255 ) ;
2015-09-23 17:55:19 +00:00
break ;
case T_BLUE :
scriptfile_getnumber ( script , & blue ) ;
2015-10-10 06:57:36 +00:00
blue = clamp ( blue , 0 , 255 ) ;
2015-09-23 17:55:19 +00:00
break ;
case T_REMAPPAL :
scriptfile_getsymbol ( script , & remappal ) ;
break ;
case T_REMAPSELF :
remappal = id ;
break ;
}
}
if ( EDUKE32_PREDICT_FALSE ( ( unsigned ) remappal > = MAXPALOOKUPS ) )
{
initprintf ( " Error: palookup: Invalid remappal on line %s:%d \n " ,
script - > filename , scriptfile_getlinum ( script , cmdtokptr ) ) ;
break ;
}
if ( EDUKE32_PREDICT_FALSE ( ! ( paletteloaded & PALETTE_SHADE ) ) )
{
initprintf ( " Error: palookup: Shade tables not loaded on line %s:%d \n " ,
script - > filename , scriptfile_getlinum ( script , cmdtokptr ) ) ;
break ;
}
2018-04-12 21:03:12 +00:00
paletteMakeLookupTable ( id , NULL , red , green , blue , g_noFloorPal [ id ] ) ;
2015-09-23 17:55:19 +00:00
break ;
}
case T_NOFLOORPAL :
{
g_noFloorPal [ id ] = 1 ;
break ;
}
case T_FLOORPAL :
{
g_noFloorPal [ id ] = 0 ;
break ;
}
2015-10-03 11:52:51 +00:00
case T_UNDEF :
{
2018-04-12 21:03:12 +00:00
paletteFreeLookupTable ( id ) ;
2015-10-03 11:52:51 +00:00
didLoadShade = 0 ;
if ( id = = 0 )
paletteloaded & = ~ PALETTE_SHADE ;
break ;
}
2015-09-23 17:55:19 +00:00
default :
break ;
}
}
if ( didLoadShade & & id = = 0 )
{
paletteloaded | = PALETTE_SHADE ;
}
}
break ;
case T_BLENDTABLE :
{
char * blockend ;
int32_t id ;
static const tokenlist subtokens [ ] =
{
{ " raw " , T_RAW } ,
2016-10-09 07:55:23 +00:00
{ " glblend " , T_GLBLEND } ,
2015-09-23 17:55:19 +00:00
{ " copy " , T_COPY } ,
2015-10-03 11:52:51 +00:00
{ " undef " , T_UNDEF } ,
2015-09-23 17:55:19 +00:00
} ;
if ( scriptfile_getsymbol ( script , & id ) )
break ;
if ( scriptfile_getbraces ( script , & blockend ) )
break ;
if ( EDUKE32_PREDICT_FALSE ( ( unsigned ) id > = MAXBLENDTABS ) )
{
initprintf ( " Error: blendtable: Invalid blendtable number on line %s:%d \n " ,
script - > filename , scriptfile_getlinum ( script , cmdtokptr ) ) ;
2019-08-09 09:41:05 +00:00
script - > textptr = blockend + 1 ;
2015-09-23 17:55:19 +00:00
break ;
}
int didLoadTransluc = 0 ;
while ( script - > textptr < blockend )
{
int32_t token = getatoken ( script , subtokens , ARRAY_SIZE ( subtokens ) ) ;
switch ( token )
{
case T_RAW :
{
char * rawblockend ;
static const tokenlist rawsubtokens [ ] =
{
{ " file " , T_FILE } ,
{ " offset " , T_OFFSET } ,
} ;
if ( scriptfile_getbraces ( script , & rawblockend ) )
break ;
char * fn = NULL ;
int32_t offset = 0 ;
while ( script - > textptr < rawblockend )
{
int32_t token = getatoken ( script , rawsubtokens , ARRAY_SIZE ( rawsubtokens ) ) ;
switch ( token )
{
case T_FILE :
{
scriptfile_getstring ( script , & fn ) ;
break ;
}
case T_OFFSET :
{
scriptfile_getnumber ( script , & offset ) ;
break ;
}
default :
break ;
}
}
if ( EDUKE32_PREDICT_FALSE ( fn = = NULL ) )
{
initprintf ( " Error: blendtable: No filename provided on line %s:%d \n " ,
script - > filename , scriptfile_getlinum ( script , cmdtokptr ) ) ;
break ;
}
if ( EDUKE32_PREDICT_FALSE ( offset < 0 ) )
{
initprintf ( " Error: blendtable: Invalid file offset on line %s:%d \n " ,
script - > filename , scriptfile_getlinum ( script , cmdtokptr ) ) ;
break ;
}
2019-12-07 09:14:51 +00:00
FileReader fil = fileSystem . OpenFileReader ( fn , 0 ) ;
2019-10-21 15:16:08 +00:00
if ( ! fil . isOpen ( ) )
2015-09-23 17:55:19 +00:00
{
initprintf ( " Error: blendtable: Failed opening \" %s \" on line %s:%d \n " , fn ,
script - > filename , scriptfile_getlinum ( script , cmdtokptr ) ) ;
break ;
}
2019-10-21 15:16:08 +00:00
if ( fil . Seek ( offset , FileReader : : SeekSet ) < 0 )
2015-09-23 17:55:19 +00:00
{
initprintf ( " Error: blendtable: Seek failed on line %s:%d \n " ,
script - > filename , scriptfile_getlinum ( script , cmdtokptr ) ) ;
break ;
}
2019-10-21 15:16:08 +00:00
auto blendbuf = fil . Read ( ) ;
if ( blendbuf . Size ( ) < 256 * 256 )
2015-09-23 17:55:19 +00:00
{
initprintf ( " Error: blendtable: Read failed on line %s:%d \n " ,
script - > filename , scriptfile_getlinum ( script , cmdtokptr ) ) ;
break ;
}
2019-10-21 17:36:54 +00:00
paletteSetBlendTable ( id , ( char * ) blendbuf . Data ( ) ) ;
2015-09-23 17:55:19 +00:00
didLoadTransluc = 1 ;
break ;
}
case T_COPY :
{
int32_t source ;
scriptfile_getsymbol ( script , & source ) ;
if ( EDUKE32_PREDICT_FALSE ( ( unsigned ) source > = MAXBLENDTABS | | source = = id ) )
{
initprintf ( " Error: blendtable: Invalid source blendtable number on line %s:%d \n " ,
script - > filename , scriptfile_getlinum ( script , cmdtokptr ) ) ;
break ;
}
char const * const sourcetable = blendtable [ source ] ;
if ( EDUKE32_PREDICT_FALSE ( sourcetable = = NULL ) )
{
initprintf ( " Error: blendtable: Source blendtable does not exist on line %s:%d \n " ,
script - > filename , scriptfile_getlinum ( script , cmdtokptr ) ) ;
break ;
}
2018-04-12 21:03:12 +00:00
paletteSetBlendTable ( id , sourcetable ) ;
2015-09-23 17:55:19 +00:00
didLoadTransluc = 1 ;
2016-10-09 07:55:23 +00:00
# ifdef USE_OPENGL
glblend [ id ] = glblend [ source ] ;
# endif
2015-09-23 17:55:19 +00:00
break ;
}
2015-10-03 11:52:51 +00:00
case T_UNDEF :
{
2018-04-12 21:03:12 +00:00
paletteFreeBlendTable ( id ) ;
2015-10-03 11:52:51 +00:00
didLoadTransluc = 0 ;
if ( id = = 0 )
paletteloaded & = ~ PALETTE_TRANSLUC ;
2016-10-09 07:55:23 +00:00
# ifdef USE_OPENGL
glblend [ id ] = defaultglblend ;
# endif
2015-10-03 11:52:51 +00:00
break ;
}
2016-10-09 07:55:23 +00:00
case T_GLBLEND :
{
char * glblendblockend ;
static const tokenlist glblendtokens [ ] =
{
{ " forward " , T_FORWARD } ,
{ " reverse " , T_REVERSE } ,
{ " both " , T_BOTH } ,
} ;
if ( scriptfile_getbraces ( script , & glblendblockend ) )
break ;
# ifdef USE_OPENGL
glblend_t * const glb = glblend + id ;
* glb = nullglblend ;
# endif
while ( script - > textptr < glblendblockend )
{
int32_t glblendtoken = getatoken ( script , glblendtokens , ARRAY_SIZE ( glblendtokens ) ) ;
switch ( glblendtoken )
{
case T_FORWARD :
case T_REVERSE :
case T_BOTH :
{
char * glblenddefblockend ;
static const tokenlist glblenddeftokens [ ] =
{
{ " src " , T_SRC } ,
{ " sfactor " , T_SRC } ,
{ " top " , T_SRC } ,
{ " dst " , T_DST } ,
{ " dfactor " , T_DST } ,
{ " bottom " , T_DST } ,
{ " alpha " , T_ALPHA } ,
} ;
if ( scriptfile_getbraces ( script , & glblenddefblockend ) )
break ;
# ifdef USE_OPENGL
glblenddef_t * const glbdef = glb - > def + ( glblendtoken = = T_REVERSE ) ;
# endif
while ( script - > textptr < glblenddefblockend )
{
int32_t glblenddeftoken = getatoken ( script , glblenddeftokens , ARRAY_SIZE ( glblenddeftokens ) ) ;
switch ( glblenddeftoken )
{
case T_SRC :
case T_DST :
{
2019-10-05 10:39:50 +00:00
static const tokenlist blendFuncTokens [ ] =
2016-10-09 07:55:23 +00:00
{
{ " ZERO " , T_ZERO } ,
{ " ONE " , T_ONE } ,
{ " SRC_COLOR " , T_SRC_COLOR } ,
{ " ONE_MINUS_SRC_COLOR " , T_ONE_MINUS_SRC_COLOR } ,
{ " SRC_ALPHA " , T_SRC_ALPHA } ,
{ " ONE_MINUS_SRC_ALPHA " , T_ONE_MINUS_SRC_ALPHA } ,
{ " DST_ALPHA " , T_DST_ALPHA } ,
{ " ONE_MINUS_DST_ALPHA " , T_ONE_MINUS_DST_ALPHA } ,
{ " DST_COLOR " , T_DST_COLOR } ,
{ " ONE_MINUS_DST_COLOR " , T_ONE_MINUS_DST_COLOR } ,
} ;
2019-10-05 10:39:50 +00:00
int32_t factortoken = getatoken ( script , blendFuncTokens , ARRAY_SIZE ( blendFuncTokens ) ) ;
2016-10-09 07:55:23 +00:00
# ifdef USE_OPENGL
uint8_t * const factor = glblenddeftoken = = T_SRC ? & glbdef - > src : & glbdef - > dst ;
switch ( factortoken )
{
case T_ZERO : * factor = BLENDFACTOR_ZERO ; break ;
case T_ONE : * factor = BLENDFACTOR_ONE ; break ;
case T_SRC_COLOR : * factor = BLENDFACTOR_SRC_COLOR ; break ;
case T_ONE_MINUS_SRC_COLOR : * factor = BLENDFACTOR_ONE_MINUS_SRC_COLOR ; break ;
case T_SRC_ALPHA : * factor = BLENDFACTOR_SRC_ALPHA ; break ;
case T_ONE_MINUS_SRC_ALPHA : * factor = BLENDFACTOR_ONE_MINUS_SRC_ALPHA ; break ;
case T_DST_ALPHA : * factor = BLENDFACTOR_DST_ALPHA ; break ;
case T_ONE_MINUS_DST_ALPHA : * factor = BLENDFACTOR_ONE_MINUS_DST_ALPHA ; break ;
case T_DST_COLOR : * factor = BLENDFACTOR_DST_COLOR ; break ;
case T_ONE_MINUS_DST_COLOR : * factor = BLENDFACTOR_ONE_MINUS_DST_COLOR ; break ;
}
# else
UNREFERENCED_PARAMETER ( factortoken ) ;
# endif
break ;
}
case T_ALPHA :
{
double tempalpha ;
scriptfile_getdouble ( script , & tempalpha ) ;
# ifdef USE_OPENGL
glbdef - > alpha = ( float ) tempalpha ;
# endif
break ;
}
}
}
# ifdef USE_OPENGL
if ( glblendtoken = = T_BOTH )
glb - > def [ 1 ] = * glbdef ;
# endif
break ;
}
}
}
}
2015-09-23 17:55:19 +00:00
default :
break ;
}
}
if ( didLoadTransluc & & id = = 0 )
{
paletteloaded | = PALETTE_TRANSLUC ;
}
}
break ;
2015-09-27 21:18:24 +00:00
case T_NUMALPHATABS :
{
int32_t value ;
if ( scriptfile_getnumber ( script , & value ) ) break ;
switch ( value )
{
2016-10-14 07:40:32 +00:00
case 1 : case 3 : case 7 : case 15 : case 31 : case 63 : case 127 :
case 2 : case 4 : case 8 : case 16 : case 32 : case 64 : case 128 :
2016-10-09 07:55:23 +00:00
# ifdef USE_OPENGL
2016-10-14 07:40:32 +00:00
for ( int32_t a = 1 , value2 = value * 2 + ( value & 1 ) ; a < = value ; + + a )
2016-10-09 07:55:23 +00:00
{
2016-10-14 07:40:32 +00:00
float finv2value = 1.f / ( float ) value2 ;
2016-10-09 07:55:23 +00:00
glblend_t * const glb = glblend + a ;
* glb = defaultglblend ;
glb - > def [ 0 ] . alpha = ( float ) ( value2 - a ) * finv2value ;
glb - > def [ 1 ] . alpha = ( float ) a * finv2value ;
}
2017-07-18 20:53:41 +00:00
fallthrough__ ;
2016-10-09 07:55:23 +00:00
# endif
2016-10-14 07:40:32 +00:00
case 0 :
2015-09-27 21:18:24 +00:00
numalphatabs = value ;
break ;
default :
initprintf ( " Error: numalphatables: Invalid value on line %s:%d \n " ,
script - > filename , scriptfile_getlinum ( script , cmdtokptr ) ) ;
break ;
}
}
break ;
2015-10-03 11:52:51 +00:00
case T_UNDEFBASEPALETTERANGE :
{
int32_t id0 , id1 ;
if ( scriptfile_getsymbol ( script , & id0 ) )
break ;
if ( scriptfile_getsymbol ( script , & id1 ) )
break ;
if ( EDUKE32_PREDICT_FALSE ( id0 > id1 | | ( unsigned ) id0 > = MAXBASEPALS | | ( unsigned ) id1 > = MAXBASEPALS ) )
{
initprintf ( " Error: undefbasepaletterange: Invalid range on line %s:%d \n " ,
script - > filename , scriptfile_getlinum ( script , cmdtokptr ) ) ;
break ;
}
2016-08-27 01:41:21 +00:00
for ( bssize_t i = id0 ; i < = id1 ; i + + )
2018-04-12 21:03:12 +00:00
paletteFreeColorTable ( i ) ;
2015-10-03 11:52:51 +00:00
if ( id0 = = 0 )
paletteloaded & = ~ PALETTE_MAIN ;
}
break ;
case T_UNDEFPALOOKUPRANGE :
{
int32_t id0 , id1 ;
if ( scriptfile_getsymbol ( script , & id0 ) )
break ;
if ( scriptfile_getsymbol ( script , & id1 ) )
break ;
if ( EDUKE32_PREDICT_FALSE ( id0 > id1 | | ( unsigned ) id0 > = MAXPALOOKUPS | | ( unsigned ) id1 > = MAXPALOOKUPS ) )
{
initprintf ( " Error: undefpalookuprange: Invalid range on line %s:%d \n " ,
script - > filename , scriptfile_getlinum ( script , cmdtokptr ) ) ;
break ;
}
2016-08-27 01:41:21 +00:00
for ( bssize_t i = id0 ; i < = id1 ; i + + )
2018-04-12 21:03:12 +00:00
paletteFreeLookupTable ( i ) ;
2015-10-03 11:52:51 +00:00
if ( id0 = = 0 )
paletteloaded & = ~ PALETTE_SHADE ;
}
break ;
case T_UNDEFBLENDTABLERANGE :
{
int32_t id0 , id1 ;
if ( scriptfile_getsymbol ( script , & id0 ) )
break ;
if ( scriptfile_getsymbol ( script , & id1 ) )
break ;
if ( EDUKE32_PREDICT_FALSE ( id0 > id1 | | ( unsigned ) id0 > = MAXBLENDTABS | | ( unsigned ) id1 > = MAXBLENDTABS ) )
{
initprintf ( " Error: undefblendtablerange: Invalid range on line %s:%d \n " ,
script - > filename , scriptfile_getlinum ( script , cmdtokptr ) ) ;
break ;
}
2016-08-27 01:41:21 +00:00
for ( bssize_t i = id0 ; i < = id1 ; i + + )
2018-04-12 21:03:12 +00:00
paletteFreeBlendTable ( i ) ;
2015-10-03 11:52:51 +00:00
if ( id0 = = 0 )
paletteloaded & = ~ PALETTE_TRANSLUC ;
}
break ;
2019-08-09 08:21:19 +00:00
case T_NEWGAMECHOICES : // stub
{
char * blockend ;
if ( scriptfile_getbraces ( script , & blockend ) )
break ;
2019-08-09 09:41:05 +00:00
script - > textptr = blockend + 1 ;
2019-08-09 08:21:19 +00:00
break ;
}
2019-09-19 20:02:45 +00:00
case T_RFFDEFINEID :
{
char * dummy ;
int dummy2 ;
if ( scriptfile_getstring ( script , & dummy ) )
break ;
if ( scriptfile_getstring ( script , & dummy ) )
break ;
if ( scriptfile_getnumber ( script , & dummy2 ) )
break ;
if ( scriptfile_getstring ( script , & dummy ) )
break ;
}
break ;
2015-05-27 08:47:50 +00:00
2006-04-24 19:04:22 +00:00
default :
2013-09-13 20:23:59 +00:00
initprintf ( " Unknown token. \n " ) ; break ;
2006-04-24 19:04:22 +00:00
}
}
2013-05-23 18:27:24 +00:00
2006-04-24 19:04:22 +00:00
return 0 ;
2006-04-23 06:44:19 +00:00
}
2011-01-16 00:23:39 +00:00
int32_t loaddefinitionsfile ( const char * fn )
2006-04-23 06:44:19 +00:00
{
2006-04-24 19:04:22 +00:00
scriptfile * script ;
2018-04-12 21:02:31 +00:00
int32_t f = g_logFlushWindow ;
2006-04-23 06:44:19 +00:00
2006-04-24 19:04:22 +00:00
script = scriptfile_fromfile ( fn ) ;
2006-04-23 06:44:19 +00:00
2013-03-28 09:06:14 +00:00
if ( script )
{
2018-04-12 21:02:31 +00:00
g_logFlushWindow = 1 ;
2013-09-13 20:23:59 +00:00
initprintf ( " Loading \" %s \" \n " , fn ) ;
2018-04-12 21:02:31 +00:00
g_logFlushWindow = 0 ;
2013-03-28 09:06:14 +00:00
defsparser ( script ) ;
}
2006-04-23 06:44:19 +00:00
2019-11-01 18:25:42 +00:00
for ( auto & m : * userConfig . AddDefs )
2018-02-17 22:30:39 +00:00
defsparser_include ( m , NULL , NULL ) ;
2011-07-21 22:39:29 +00:00
2018-04-12 21:02:31 +00:00
g_logFlushWindow = f ;
2013-03-28 09:06:14 +00:00
if ( script )
scriptfile_close ( script ) ;
2006-04-24 19:04:22 +00:00
scriptfile_clearsymbols ( ) ;
2006-04-23 06:44:19 +00:00
2014-09-30 04:17:53 +00:00
DO_FREE_AND_NULL ( faketilebuffer ) ;
faketilebuffersiz = 0 ;
2016-09-16 21:55:39 +00:00
if ( usermaphacks ! = NULL )
qsort ( usermaphacks , num_usermaphacks , sizeof ( usermaphack_t ) , compare_usermaphacks ) ;
2015-01-08 15:14:00 +00:00
2013-03-28 09:06:14 +00:00
if ( ! script ) return - 1 ;
2013-09-13 20:23:59 +00:00
initprintf ( " \n " ) ;
2006-04-24 19:04:22 +00:00
return 0 ;
2006-04-23 06:44:19 +00:00
}
// vim:ts=4: