mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-11-13 07:58:04 +00:00
patch from hunter_rus
git-svn-id: https://svn.eduke32.com/eduke32@587 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
d6739cc554
commit
4aa6cf2ea3
18 changed files with 695 additions and 150 deletions
|
@ -36,9 +36,15 @@ extern "C" {
|
||||||
#define MAXSPRITESONSCREEN 4096
|
#define MAXSPRITESONSCREEN 4096
|
||||||
#define MAXUNIQHUDID 256 //Extra slots so HUD models can store animation state without messing game sprites
|
#define MAXUNIQHUDID 256 //Extra slots so HUD models can store animation state without messing game sprites
|
||||||
|
|
||||||
#define RESERVEDPALS 2 // don't forget to increment this when adding reserved pals
|
#define RESERVEDPALS 8 // don't forget to increment this when adding reserved pals
|
||||||
#define DETAILPAL (MAXPALOOKUPS - 1)
|
#define DETAILPAL (MAXPALOOKUPS - 1)
|
||||||
#define GLOWPAL (MAXPALOOKUPS - 2)
|
#define GLOWPAL (MAXPALOOKUPS - 2)
|
||||||
|
#define REDPAL (MAXPALOOKUPS - 3)
|
||||||
|
#define BLUEPAL (MAXPALOOKUPS - 4)
|
||||||
|
#define BROWNPAL (MAXPALOOKUPS - 5)
|
||||||
|
#define GREYPAL (MAXPALOOKUPS - 6)
|
||||||
|
#define GREENPAL (MAXPALOOKUPS - 7)
|
||||||
|
#define SPECPAL (MAXPALOOKUPS - 8)
|
||||||
|
|
||||||
#define CLIPMASK0 (((1L)<<16)+1L)
|
#define CLIPMASK0 (((1L)<<16)+1L)
|
||||||
#define CLIPMASK1 (((256L)<<16)+64L)
|
#define CLIPMASK1 (((256L)<<16)+64L)
|
||||||
|
@ -168,6 +174,8 @@ typedef struct BPACK {
|
||||||
|
|
||||||
#define SPREXT_NOTMD 1
|
#define SPREXT_NOTMD 1
|
||||||
#define SPREXT_NOMDANIM 2
|
#define SPREXT_NOMDANIM 2
|
||||||
|
#define SPREXT_AWAY1 4
|
||||||
|
#define SPREXT_AWAY2 8
|
||||||
EXTERN spriteexttype *spriteext;
|
EXTERN spriteexttype *spriteext;
|
||||||
EXTERN spritesmoothtype *spritesmooth;
|
EXTERN spritesmoothtype *spritesmooth;
|
||||||
EXTERN int guniqhudid;
|
EXTERN int guniqhudid;
|
||||||
|
@ -523,16 +531,24 @@ int hicsetsubsttex(int picnum, int palnum, char *filen, float alphacut, float xs
|
||||||
int hicsetskybox(int picnum, int palnum, char *faces[6]);
|
int hicsetskybox(int picnum, int palnum, char *faces[6]);
|
||||||
int hicclearsubst(int picnum, int palnum);
|
int hicclearsubst(int picnum, int palnum);
|
||||||
|
|
||||||
|
int Ptile2tile(int tile, int pallet);
|
||||||
int md_loadmodel(const char *fn);
|
int md_loadmodel(const char *fn);
|
||||||
int md_setmisc(int modelid, float scale, int shadeoff, float zadd);
|
int md_setmisc(int modelid, float scale, int shadeoff, float zadd, int flags);
|
||||||
int md_tilehasmodel(int tilenume);
|
int md_tilehasmodel(int tilenume, int pal);
|
||||||
int md_defineframe(int modelid, const char *framename, int tilenume, int skinnum, float smoothduration);
|
int md_defineframe(int modelid, const char *framename, int tilenume, int skinnum, float smoothduration, int pal);
|
||||||
int md_defineanimation(int modelid, const char *framestart, const char *frameend, int fps, int flags);
|
int md_defineanimation(int modelid, const char *framestart, const char *frameend, int fps, int flags);
|
||||||
int md_defineskin(int modelid, const char *skinfn, int palnum, int skinnum, int surfnum, float param);
|
int md_defineskin(int modelid, const char *skinfn, int palnum, int skinnum, int surfnum, float param);
|
||||||
int md_definehud (int modelid, int tilex, double xadd, double yadd, double zadd, double angadd, int flags);
|
int md_definehud (int modelid, int tilex, double xadd, double yadd, double zadd, double angadd, int flags);
|
||||||
int md_undefinetile(int tile);
|
int md_undefinetile(int tile);
|
||||||
int md_undefinemodel(int modelid);
|
int md_undefinemodel(int modelid);
|
||||||
|
|
||||||
|
#define MAXPALCONV 200
|
||||||
|
void clearconv();
|
||||||
|
void setpalconv(int pal,int pal1,int pal2);
|
||||||
|
void getpalmap(int stage,int *pal1,int *pal2);
|
||||||
|
int checkpalmaps(int pal);
|
||||||
|
void applypalmap(char *pic, char *palmap, int size, int pal);
|
||||||
|
|
||||||
int loaddefinitionsfile(char *fn);
|
int loaddefinitionsfile(char *fn);
|
||||||
|
|
||||||
extern int mapversion; // if loadboard() fails with -2 return, try loadoldboard(). if it fails with -2, board is dodgy
|
extern int mapversion; // if loadboard() fails with -2 return, try loadoldboard(). if it fails with -2, board is dodgy
|
||||||
|
|
|
@ -30,6 +30,8 @@ typedef struct pthtyp_t
|
||||||
unsigned short sizx, sizy;
|
unsigned short sizx, sizy;
|
||||||
float scalex, scaley;
|
float scalex, scaley;
|
||||||
struct pthtyp_t *ofb; // only fullbright
|
struct pthtyp_t *ofb; // only fullbright
|
||||||
|
|
||||||
|
char *palmap;int size;
|
||||||
} pthtyp;
|
} pthtyp;
|
||||||
|
|
||||||
pthtyp * gltexcache (int dapicnum, int dapalnum, int dameth);
|
pthtyp * gltexcache (int dapicnum, int dapalnum, int dameth);
|
||||||
|
|
|
@ -21,6 +21,7 @@ enum
|
||||||
T_DEFINETEXTURE,
|
T_DEFINETEXTURE,
|
||||||
T_DEFINESKYBOX,
|
T_DEFINESKYBOX,
|
||||||
T_DEFINETINT,
|
T_DEFINETINT,
|
||||||
|
T_DEFINECONV,
|
||||||
T_DEFINEMODEL,
|
T_DEFINEMODEL,
|
||||||
T_DEFINEMODELFRAME,
|
T_DEFINEMODELFRAME,
|
||||||
T_DEFINEMODELANIM,
|
T_DEFINEMODELANIM,
|
||||||
|
@ -68,7 +69,9 @@ enum
|
||||||
T_FOGPAL,
|
T_FOGPAL,
|
||||||
T_LOADGRP,
|
T_LOADGRP,
|
||||||
T_DUMMYTILE,T_DUMMYTILERANGE,
|
T_DUMMYTILE,T_DUMMYTILERANGE,
|
||||||
T_CACHESIZE
|
T_CACHESIZE,
|
||||||
|
T_MUSIC,T_ID,T_SOUND,
|
||||||
|
T_REDPAL,T_BLUEPAL,T_BROWNPAL,T_GREYPAL,T_GREENPAL,T_SPECPAL
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef struct { char *text; int tokenid; } tokenlist;
|
typedef struct { char *text; int tokenid; } tokenlist;
|
||||||
|
@ -83,6 +86,7 @@ static tokenlist basetokens[] =
|
||||||
{ "definetexture", T_DEFINETEXTURE },
|
{ "definetexture", T_DEFINETEXTURE },
|
||||||
{ "defineskybox", T_DEFINESKYBOX },
|
{ "defineskybox", T_DEFINESKYBOX },
|
||||||
{ "definetint", T_DEFINETINT },
|
{ "definetint", T_DEFINETINT },
|
||||||
|
{ "defineconv", T_DEFINECONV },
|
||||||
{ "definemodel", T_DEFINEMODEL },
|
{ "definemodel", T_DEFINEMODEL },
|
||||||
{ "definemodelframe",T_DEFINEMODELFRAME },
|
{ "definemodelframe",T_DEFINEMODELFRAME },
|
||||||
{ "definemodelanim", T_DEFINEMODELANIM },
|
{ "definemodelanim", T_DEFINEMODELANIM },
|
||||||
|
@ -99,6 +103,8 @@ static tokenlist basetokens[] =
|
||||||
{ "tint", T_TINT },
|
{ "tint", T_TINT },
|
||||||
{ "texture", T_TEXTURE },
|
{ "texture", T_TEXTURE },
|
||||||
{ "tile", T_TEXTURE },
|
{ "tile", T_TEXTURE },
|
||||||
|
{ "music", T_MUSIC },
|
||||||
|
{ "sound", T_SOUND },
|
||||||
|
|
||||||
// other stuff
|
// other stuff
|
||||||
{ "undefmodel", T_UNDEFMODEL },
|
{ "undefmodel", T_UNDEFMODEL },
|
||||||
|
@ -127,11 +133,19 @@ static tokenlist modeltokens[] =
|
||||||
{ "skin", T_SKIN },
|
{ "skin", T_SKIN },
|
||||||
{ "glow", T_GLOW },
|
{ "glow", T_GLOW },
|
||||||
{ "detail", T_DETAIL },
|
{ "detail", T_DETAIL },
|
||||||
|
{ "redmap", T_REDPAL },
|
||||||
|
{ "bluepal", T_BLUEPAL },
|
||||||
|
{ "brownpal",T_BROWNPAL},
|
||||||
|
{ "greypal", T_GREYPAL },
|
||||||
|
{ "greenpal",T_GREENPAL},
|
||||||
|
{ "specpal", T_SPECPAL },
|
||||||
{ "hud", T_HUD },
|
{ "hud", T_HUD },
|
||||||
|
{ "flags", T_FLAGS },
|
||||||
};
|
};
|
||||||
|
|
||||||
static tokenlist modelframetokens[] =
|
static tokenlist modelframetokens[] =
|
||||||
{
|
{
|
||||||
|
{ "pal", T_PAL },
|
||||||
{ "frame", T_FRAME },
|
{ "frame", T_FRAME },
|
||||||
{ "name", T_FRAME },
|
{ "name", T_FRAME },
|
||||||
{ "tile", T_TILE },
|
{ "tile", T_TILE },
|
||||||
|
@ -208,6 +222,12 @@ static tokenlist texturetokens[] =
|
||||||
{ "pal", T_PAL },
|
{ "pal", T_PAL },
|
||||||
{ "detail", T_DETAIL },
|
{ "detail", T_DETAIL },
|
||||||
{ "glow", T_GLOW },
|
{ "glow", T_GLOW },
|
||||||
|
{ "redmap", T_REDPAL },
|
||||||
|
{ "bluepal", T_BLUEPAL },
|
||||||
|
{ "brownpal",T_BROWNPAL},
|
||||||
|
{ "greypal", T_GREYPAL },
|
||||||
|
{ "greenpal",T_GREENPAL},
|
||||||
|
{ "specpal", T_SPECPAL },
|
||||||
};
|
};
|
||||||
static tokenlist texturetokens_pal[] =
|
static tokenlist texturetokens_pal[] =
|
||||||
{
|
{
|
||||||
|
@ -218,6 +238,17 @@ static tokenlist texturetokens_pal[] =
|
||||||
{ "nocompress", T_NOCOMPRESS },
|
{ "nocompress", T_NOCOMPRESS },
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static tokenlist musictokens[] =
|
||||||
|
{
|
||||||
|
{ "id", T_ID },
|
||||||
|
{ "file", T_FILE },
|
||||||
|
};
|
||||||
|
static tokenlist soundtokens[] =
|
||||||
|
{
|
||||||
|
{ "id", T_ID },
|
||||||
|
{ "file", T_FILE },
|
||||||
|
};
|
||||||
|
|
||||||
static int getatoken(scriptfile *sf, tokenlist *tl, int ntokens)
|
static int getatoken(scriptfile *sf, tokenlist *tl, int ntokens)
|
||||||
{
|
{
|
||||||
char *tok;
|
char *tok;
|
||||||
|
@ -379,6 +410,16 @@ static int defsparser(scriptfile *script)
|
||||||
hicsetpalettetint(pal,r,g,b,f);
|
hicsetpalettetint(pal,r,g,b,f);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case T_DEFINECONV:
|
||||||
|
{
|
||||||
|
int pal, pal1, pal2;
|
||||||
|
|
||||||
|
if (scriptfile_getsymbol(script,&pal)) break;
|
||||||
|
if (scriptfile_getnumber(script,&pal1)) break;
|
||||||
|
if (scriptfile_getnumber(script,&pal2)) break;
|
||||||
|
setpalconv(pal,pal1,pal2);
|
||||||
|
}
|
||||||
|
break;
|
||||||
case T_ALPHAHACK:
|
case T_ALPHAHACK:
|
||||||
{
|
{
|
||||||
int tile;
|
int tile;
|
||||||
|
@ -558,7 +599,7 @@ static int defsparser(scriptfile *script)
|
||||||
initprintf("Failure loading MD2/MD3 model \"%s\"\n", modelfn);
|
initprintf("Failure loading MD2/MD3 model \"%s\"\n", modelfn);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
md_setmisc(lastmodelid,(float)scale, shadeoffs,0.0);
|
md_setmisc(lastmodelid,(float)scale, shadeoffs,0.0,0);
|
||||||
#endif
|
#endif
|
||||||
modelskin = lastmodelskin = 0;
|
modelskin = lastmodelskin = 0;
|
||||||
seenframe = 0;
|
seenframe = 0;
|
||||||
|
@ -588,7 +629,7 @@ static int defsparser(scriptfile *script)
|
||||||
#if defined(POLYMOST) && defined(USE_OPENGL)
|
#if defined(POLYMOST) && defined(USE_OPENGL)
|
||||||
for (tilex = ftilenume; tilex <= ltilenume && happy; tilex++)
|
for (tilex = ftilenume; tilex <= ltilenume && happy; tilex++)
|
||||||
{
|
{
|
||||||
switch (md_defineframe(lastmodelid, framename, tilex, max(0,modelskin), 0.0f))
|
switch (md_defineframe(lastmodelid, framename, tilex, max(0,modelskin), 0.0f,0))
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
break;
|
break;
|
||||||
|
@ -764,7 +805,7 @@ static int defsparser(scriptfile *script)
|
||||||
{
|
{
|
||||||
char *modelend, *modelfn;
|
char *modelend, *modelfn;
|
||||||
double scale=1.0, mzadd=0.0;
|
double scale=1.0, mzadd=0.0;
|
||||||
int shadeoffs=0;
|
int shadeoffs=0, pal=0, flags=0;
|
||||||
|
|
||||||
modelskin = lastmodelskin = 0;
|
modelskin = lastmodelskin = 0;
|
||||||
seenframe = 0;
|
seenframe = 0;
|
||||||
|
@ -792,6 +833,8 @@ static int defsparser(scriptfile *script)
|
||||||
scriptfile_getnumber(script,&shadeoffs); break;
|
scriptfile_getnumber(script,&shadeoffs); break;
|
||||||
case T_ZADD:
|
case T_ZADD:
|
||||||
scriptfile_getdouble(script,&mzadd); break;
|
scriptfile_getdouble(script,&mzadd); break;
|
||||||
|
case T_FLAGS:
|
||||||
|
scriptfile_getnumber(script,&flags); break;
|
||||||
case T_FRAME:
|
case T_FRAME:
|
||||||
{
|
{
|
||||||
char *frametokptr = script->ltextptr;
|
char *frametokptr = script->ltextptr;
|
||||||
|
@ -804,6 +847,8 @@ static int defsparser(scriptfile *script)
|
||||||
{
|
{
|
||||||
switch (getatoken(script,modelframetokens,sizeof(modelframetokens)/sizeof(tokenlist)))
|
switch (getatoken(script,modelframetokens,sizeof(modelframetokens)/sizeof(tokenlist)))
|
||||||
{
|
{
|
||||||
|
case T_PAL:
|
||||||
|
scriptfile_getnumber(script,&pal); break;
|
||||||
case T_FRAME:
|
case T_FRAME:
|
||||||
scriptfile_getstring(script,&framename); break;
|
scriptfile_getstring(script,&framename); break;
|
||||||
case T_TILE:
|
case T_TILE:
|
||||||
|
@ -837,7 +882,7 @@ static int defsparser(scriptfile *script)
|
||||||
#if defined(POLYMOST) && defined(USE_OPENGL)
|
#if defined(POLYMOST) && defined(USE_OPENGL)
|
||||||
for (tilex = ftilenume; tilex <= ltilenume && happy; tilex++)
|
for (tilex = ftilenume; tilex <= ltilenume && happy; tilex++)
|
||||||
{
|
{
|
||||||
switch (md_defineframe(lastmodelid, framename, tilex, max(0,modelskin), smoothduration))
|
switch (md_defineframe(lastmodelid, framename, tilex, max(0,modelskin), smoothduration,pal))
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
break;
|
break;
|
||||||
|
@ -915,6 +960,7 @@ static int defsparser(scriptfile *script)
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case T_SKIN: case T_DETAIL: case T_GLOW:
|
case T_SKIN: case T_DETAIL: case T_GLOW:
|
||||||
|
case T_REDPAL: case T_BLUEPAL: case T_BROWNPAL: case T_GREYPAL: case T_GREENPAL: case T_SPECPAL:
|
||||||
{
|
{
|
||||||
char *skintokptr = script->ltextptr;
|
char *skintokptr = script->ltextptr;
|
||||||
char *skinend, *skinfn = 0;
|
char *skinend, *skinfn = 0;
|
||||||
|
@ -946,13 +992,23 @@ static int defsparser(scriptfile *script)
|
||||||
if (seenframe) { modelskin = ++lastmodelskin; }
|
if (seenframe) { modelskin = ++lastmodelskin; }
|
||||||
seenframe = 0;
|
seenframe = 0;
|
||||||
|
|
||||||
if (token == T_DETAIL)
|
switch (token)
|
||||||
{
|
{
|
||||||
|
case T_REDPAL: palnum = REDPAL; break;
|
||||||
|
case T_BLUEPAL: palnum = BLUEPAL; break;
|
||||||
|
case T_BROWNPAL:palnum = BROWNPAL;break;
|
||||||
|
case T_GREYPAL: palnum = GREYPAL; break;
|
||||||
|
case T_GREENPAL:palnum = GREENPAL;break;
|
||||||
|
case T_SPECPAL: palnum = SPECPAL; break;
|
||||||
|
|
||||||
|
case T_DETAIL:
|
||||||
palnum = DETAILPAL;
|
palnum = DETAILPAL;
|
||||||
param = 1.0f / param;
|
param = 1.0f / param;
|
||||||
}
|
break;
|
||||||
else if (token == T_GLOW)
|
case T_GLOW:
|
||||||
palnum = GLOWPAL;
|
palnum = GLOWPAL;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
#if defined(POLYMOST) && defined(USE_OPENGL)
|
#if defined(POLYMOST) && defined(USE_OPENGL)
|
||||||
switch (md_defineskin(lastmodelid, skinfn, palnum, max(0,modelskin), surfnum, param))
|
switch (md_defineskin(lastmodelid, skinfn, palnum, max(0,modelskin), surfnum, param))
|
||||||
|
@ -1059,7 +1115,7 @@ static int defsparser(scriptfile *script)
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(POLYMOST) && defined(USE_OPENGL)
|
#if defined(POLYMOST) && defined(USE_OPENGL)
|
||||||
md_setmisc(lastmodelid,(float)scale,shadeoffs,(float)mzadd);
|
md_setmisc(lastmodelid,(float)scale,shadeoffs,(float)mzadd,flags);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
modelskin = lastmodelskin = 0;
|
modelskin = lastmodelskin = 0;
|
||||||
|
@ -1217,6 +1273,9 @@ static int defsparser(scriptfile *script)
|
||||||
char *texturetokptr = script->ltextptr, *textureend;
|
char *texturetokptr = script->ltextptr, *textureend;
|
||||||
int tile=-1, token;
|
int tile=-1, token;
|
||||||
|
|
||||||
|
char *fnB=0; double alphacutB=0, xscaleB=0, yscaleB=0; char flagsB=0;
|
||||||
|
int palmapbits=0;int palbits=0;
|
||||||
|
|
||||||
if (scriptfile_getsymbol(script,&tile)) break;
|
if (scriptfile_getsymbol(script,&tile)) break;
|
||||||
if (scriptfile_getbraces(script,&textureend)) break;
|
if (scriptfile_getbraces(script,&textureend)) break;
|
||||||
while (script->textptr < textureend)
|
while (script->textptr < textureend)
|
||||||
|
@ -1287,9 +1346,12 @@ static int defsparser(scriptfile *script)
|
||||||
yscale = 1.0f / yscale;
|
yscale = 1.0f / yscale;
|
||||||
|
|
||||||
hicsetsubsttex(tile,pal,fn,alphacut,xscale,yscale,flags);
|
hicsetsubsttex(tile,pal,fn,alphacut,xscale,yscale,flags);
|
||||||
|
fnB=fn;alphacutB=alphacut;xscaleB=xscale;yscaleB=yscale;flagsB=flags;
|
||||||
|
if (pal<30)palbits|=1<<pal;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case T_DETAIL: case T_GLOW:
|
case T_DETAIL: case T_GLOW:
|
||||||
|
case T_REDPAL: case T_BLUEPAL: case T_BROWNPAL: case T_GREYPAL: case T_GREENPAL: case T_SPECPAL:
|
||||||
{
|
{
|
||||||
char *detailtokptr = script->ltextptr, *detailend;
|
char *detailtokptr = script->ltextptr, *detailend;
|
||||||
int pal = 0, i;
|
int pal = 0, i;
|
||||||
|
@ -1340,15 +1402,24 @@ static int defsparser(scriptfile *script)
|
||||||
else Bfree(tfn);
|
else Bfree(tfn);
|
||||||
pathsearchmode = i;
|
pathsearchmode = i;
|
||||||
|
|
||||||
if (token == T_DETAIL)
|
switch (token)
|
||||||
{
|
{
|
||||||
|
case T_REDPAL: pal = REDPAL; palmapbits|=32;break;
|
||||||
|
case T_BLUEPAL: pal = BLUEPAL; palmapbits|=16;break;
|
||||||
|
case T_BROWNPAL:pal = BROWNPAL;palmapbits|= 8;break;
|
||||||
|
case T_GREYPAL: pal = GREYPAL; palmapbits|= 4;break;
|
||||||
|
case T_GREENPAL:pal = GREENPAL;palmapbits|= 2;break;
|
||||||
|
case T_SPECPAL: pal = SPECPAL; palmapbits|= 1;break;
|
||||||
|
|
||||||
|
case T_DETAIL:
|
||||||
pal = DETAILPAL;
|
pal = DETAILPAL;
|
||||||
xscale = 1.0f / xscale;
|
xscale = 1.0f / xscale;
|
||||||
yscale = 1.0f / yscale;
|
yscale = 1.0f / yscale;
|
||||||
}
|
break;
|
||||||
else if (token == T_GLOW)
|
case T_GLOW:
|
||||||
pal = GLOWPAL;
|
pal = GLOWPAL;
|
||||||
|
break;
|
||||||
|
}
|
||||||
hicsetsubsttex(tile,pal,fn,-1.0,xscale,yscale,flags);
|
hicsetsubsttex(tile,pal,fn,-1.0,xscale,yscale,flags);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -1357,6 +1428,12 @@ static int defsparser(scriptfile *script)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int i;
|
||||||
|
if (palmapbits&&fnB)
|
||||||
|
for (i=0;i<=25;i++)
|
||||||
|
if (!(palbits&(1<<i))&&(palmapbits&checkpalmaps(i)))
|
||||||
|
hicsetsubsttex(tile,i,fnB,alphacutB,xscaleB,yscaleB,flagsB);
|
||||||
|
|
||||||
if ((unsigned)tile >= (unsigned)MAXTILES)
|
if ((unsigned)tile >= (unsigned)MAXTILES)
|
||||||
{
|
{
|
||||||
initprintf("Error: missing or invalid 'tile number' for texture definition near line %s:%d\n",
|
initprintf("Error: missing or invalid 'tile number' for texture definition near line %s:%d\n",
|
||||||
|
@ -1415,7 +1492,7 @@ static int defsparser(scriptfile *script)
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(POLYMOST) && defined(USE_OPENGL)
|
#if defined(POLYMOST) && defined(USE_OPENGL)
|
||||||
mid = md_tilehasmodel(r0);
|
mid = md_tilehasmodel(r0,0);
|
||||||
if (mid < 0) break;
|
if (mid < 0) break;
|
||||||
|
|
||||||
md_undefinemodel(mid);
|
md_undefinemodel(mid);
|
||||||
|
@ -1461,6 +1538,46 @@ static int defsparser(scriptfile *script)
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case T_MUSIC:
|
||||||
|
{
|
||||||
|
char *tinttokptr = script->ltextptr;
|
||||||
|
char *ID=0,*ext="";
|
||||||
|
char *musicend;
|
||||||
|
|
||||||
|
if (scriptfile_getbraces(script,&musicend)) break;
|
||||||
|
while (script->textptr < musicend)
|
||||||
|
{
|
||||||
|
switch (getatoken(script,musictokens,sizeof(musictokens)/sizeof(tokenlist)))
|
||||||
|
{
|
||||||
|
case T_ID:
|
||||||
|
scriptfile_getstring(script,&ID); break;
|
||||||
|
case T_FILE:
|
||||||
|
scriptfile_getstring(script,&ext);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case T_SOUND:
|
||||||
|
{
|
||||||
|
char *tinttokptr = script->ltextptr;
|
||||||
|
char *name=0;int num=0;
|
||||||
|
char *musicend;
|
||||||
|
|
||||||
|
if (scriptfile_getbraces(script,&musicend)) break;
|
||||||
|
while (script->textptr < musicend)
|
||||||
|
{
|
||||||
|
switch (getatoken(script,soundtokens,sizeof(soundtokens)/sizeof(tokenlist)))
|
||||||
|
{
|
||||||
|
case T_ID:
|
||||||
|
scriptfile_getsymbol(script,&num);break;
|
||||||
|
case T_FILE:
|
||||||
|
scriptfile_getstring(script,&name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
initprintf("Unknown token.\n"); break;
|
initprintf("Unknown token.\n"); break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -7275,7 +7275,9 @@ int loadmaphack(char *filename)
|
||||||
T_ROLL,
|
T_ROLL,
|
||||||
T_MDXOFF,
|
T_MDXOFF,
|
||||||
T_MDYOFF,
|
T_MDYOFF,
|
||||||
T_MDZOFF
|
T_MDZOFF,
|
||||||
|
T_AWAY1,
|
||||||
|
T_AWAY2,
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct { char *text; int tokenid; } legaltokens[] =
|
static struct { char *text; int tokenid; } legaltokens[] =
|
||||||
|
@ -7294,6 +7296,8 @@ int loadmaphack(char *filename)
|
||||||
{ "mdxoff", T_MDXOFF },
|
{ "mdxoff", T_MDXOFF },
|
||||||
{ "mdyoff", T_MDYOFF },
|
{ "mdyoff", T_MDYOFF },
|
||||||
{ "mdzoff", T_MDZOFF },
|
{ "mdzoff", T_MDZOFF },
|
||||||
|
{ "away1", T_AWAY1 },
|
||||||
|
{ "away2", T_AWAY2 },
|
||||||
{ NULL, -1 }
|
{ NULL, -1 }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -7434,7 +7438,26 @@ int loadmaphack(char *filename)
|
||||||
}
|
}
|
||||||
spriteext[whichsprite].zoff = i;
|
spriteext[whichsprite].zoff = i;
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
|
case T_AWAY1: // away1
|
||||||
|
if (whichsprite < 0)
|
||||||
|
{
|
||||||
|
// no sprite directive preceeding
|
||||||
|
initprintf("Ignoring moving away directive because of absent/invalid sprite number on line %s:%d\n",
|
||||||
|
script->filename, scriptfile_getlinum(script,cmdtokptr));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
spriteext[whichsprite].flags |= SPREXT_AWAY1;
|
||||||
|
break;
|
||||||
|
case T_AWAY2: // away2
|
||||||
|
if (whichsprite < 0)
|
||||||
|
{
|
||||||
|
// no sprite directive preceeding
|
||||||
|
initprintf("Ignoring moving away directive because of absent/invalid sprite number on line %s:%d\n",
|
||||||
|
script->filename, scriptfile_getlinum(script,cmdtokptr));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
spriteext[whichsprite].flags |= SPREXT_AWAY2;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
@ -7559,13 +7582,14 @@ int saveboard(char *filename, int *daposx, int *daposy, int *daposz,
|
||||||
if (tspri == NULL)
|
if (tspri == NULL)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
Bmemcpy(&tspri[0], &sprite[0], sizeof(spritetype) * numsprites);
|
|
||||||
|
|
||||||
for (j=0;j<MAXSPRITES;j++)
|
spri=tspri;
|
||||||
|
for (j=0;j<MAXSTATUS;j++)
|
||||||
{
|
{
|
||||||
if (sprite[j].statnum != MAXSTATUS)
|
int i = headspritestat[j];
|
||||||
|
while (i != -1)
|
||||||
{
|
{
|
||||||
spri = &tspri[j];
|
Bmemcpy(spri,&sprite[i],sizeof(spritetype));
|
||||||
spri->x = B_LITTLE32(spri->x);
|
spri->x = B_LITTLE32(spri->x);
|
||||||
spri->y = B_LITTLE32(spri->y);
|
spri->y = B_LITTLE32(spri->y);
|
||||||
spri->z = B_LITTLE32(spri->z);
|
spri->z = B_LITTLE32(spri->z);
|
||||||
|
@ -7581,6 +7605,7 @@ int saveboard(char *filename, int *daposx, int *daposy, int *daposz,
|
||||||
spri->lotag = B_LITTLE16(spri->lotag);
|
spri->lotag = B_LITTLE16(spri->lotag);
|
||||||
spri->hitag = B_LITTLE16(spri->hitag);
|
spri->hitag = B_LITTLE16(spri->hitag);
|
||||||
spri->extra = B_LITTLE16(spri->extra);
|
spri->extra = B_LITTLE16(spri->extra);
|
||||||
|
i = nextspritestat[i];spri++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -70,6 +70,7 @@ void hicinit(void)
|
||||||
int i,j;
|
int i,j;
|
||||||
hicreplctyp *hr, *next;
|
hicreplctyp *hr, *next;
|
||||||
|
|
||||||
|
clearconv();
|
||||||
for (i=0;i<MAXPALOOKUPS;i++) // all tints should be 100%
|
for (i=0;i<MAXPALOOKUPS;i++) // all tints should be 100%
|
||||||
{
|
{
|
||||||
hictinting[i].r = hictinting[i].g = hictinting[i].b = 0xff;
|
hictinting[i].r = hictinting[i].g = hictinting[i].b = 0xff;
|
||||||
|
|
|
@ -12,6 +12,7 @@ typedef struct
|
||||||
int shadeoff;
|
int shadeoff;
|
||||||
float scale, bscale, zadd;
|
float scale, bscale, zadd;
|
||||||
GLuint *texid; // skins
|
GLuint *texid; // skins
|
||||||
|
int flags;
|
||||||
} mdmodel;
|
} mdmodel;
|
||||||
|
|
||||||
typedef struct _mdanim_t
|
typedef struct _mdanim_t
|
||||||
|
@ -31,6 +32,7 @@ typedef struct _mdskinmap_t
|
||||||
GLuint texid[HICEFFECTMASK+1]; // OpenGL texture numbers for effect variations
|
GLuint texid[HICEFFECTMASK+1]; // OpenGL texture numbers for effect variations
|
||||||
struct _mdskinmap_t *next;
|
struct _mdskinmap_t *next;
|
||||||
float param;
|
float param;
|
||||||
|
char *palmap;int size;
|
||||||
} mdskinmap_t;
|
} mdskinmap_t;
|
||||||
|
|
||||||
|
|
||||||
|
@ -70,6 +72,7 @@ typedef struct
|
||||||
int shadeoff;
|
int shadeoff;
|
||||||
float scale, bscale, zadd;
|
float scale, bscale, zadd;
|
||||||
GLuint *texid; // texture ids for base skin if no mappings defined
|
GLuint *texid; // texture ids for base skin if no mappings defined
|
||||||
|
int flags;
|
||||||
|
|
||||||
int numframes, cframe, nframe, fpssc, usesalpha;
|
int numframes, cframe, nframe, fpssc, usesalpha;
|
||||||
float oldtime, curtime, interpol;
|
float oldtime, curtime, interpol;
|
||||||
|
@ -137,6 +140,7 @@ typedef struct
|
||||||
int shadeoff;
|
int shadeoff;
|
||||||
float scale, bscale, zadd;
|
float scale, bscale, zadd;
|
||||||
unsigned int *texid; // texture ids for base skin if no mappings defined
|
unsigned int *texid; // texture ids for base skin if no mappings defined
|
||||||
|
int flags;
|
||||||
|
|
||||||
int numframes, cframe, nframe, fpssc, usesalpha;
|
int numframes, cframe, nframe, fpssc, usesalpha;
|
||||||
float oldtime, curtime, interpol;
|
float oldtime, curtime, interpol;
|
||||||
|
@ -168,6 +172,7 @@ typedef struct
|
||||||
int shadeoff;
|
int shadeoff;
|
||||||
float scale, bscale, zadd;
|
float scale, bscale, zadd;
|
||||||
unsigned int *texid; // skins for palettes
|
unsigned int *texid; // skins for palettes
|
||||||
|
int flags;
|
||||||
|
|
||||||
//VOX specific stuff:
|
//VOX specific stuff:
|
||||||
voxrect_t *quad; int qcnt, qfacind[7];
|
voxrect_t *quad; int qcnt, qfacind[7];
|
||||||
|
@ -185,8 +190,32 @@ typedef struct
|
||||||
int skinnum;
|
int skinnum;
|
||||||
int framenum; // calculate the number from the name when declaring
|
int framenum; // calculate the number from the name when declaring
|
||||||
float smoothduration;
|
float smoothduration;
|
||||||
|
int next;
|
||||||
|
char pal;
|
||||||
} tile2model_t;
|
} tile2model_t;
|
||||||
static tile2model_t tile2model[MAXTILES];
|
|
||||||
|
#define EXTRATILES MAXTILES
|
||||||
|
int curextra=MAXTILES;
|
||||||
|
static tile2model_t tile2model[MAXTILES+EXTRATILES];
|
||||||
|
|
||||||
|
int addtileP(int model,int tile,int pallet)
|
||||||
|
{
|
||||||
|
if (curextra==MAXTILES+EXTRATILES-2)return curextra;
|
||||||
|
if (tile2model[tile].modelid==-1)return tile;
|
||||||
|
while (tile2model[tile].next!=-1)tile=tile2model[tile].next;
|
||||||
|
tile2model[tile].next=curextra;
|
||||||
|
tile2model[curextra].pal=pallet;
|
||||||
|
return curextra++;
|
||||||
|
}
|
||||||
|
int Ptile2tile(int tile,int pallet)
|
||||||
|
{
|
||||||
|
int t=tile;
|
||||||
|
// if(tile>=1550&&tile<=1589){initprintf("(%d, %d)\n",tile,pallet);pallet=0;}
|
||||||
|
while ((tile=tile2model[tile].next)!=-1)
|
||||||
|
if (tile2model[tile].pal==pallet)
|
||||||
|
return tile;
|
||||||
|
return t;
|
||||||
|
}
|
||||||
|
|
||||||
//Move this to appropriate place!
|
//Move this to appropriate place!
|
||||||
typedef struct { float xadd, yadd, zadd; short angadd, flags; } hudtyp;
|
typedef struct { float xadd, yadd, zadd; short angadd, flags; } hudtyp;
|
||||||
|
@ -209,6 +238,7 @@ static GLuint* indexvbos = NULL;
|
||||||
mdmodel *mdload(const char *);
|
mdmodel *mdload(const char *);
|
||||||
int mddraw(spritetype *);
|
int mddraw(spritetype *);
|
||||||
void mdfree(mdmodel *);
|
void mdfree(mdmodel *);
|
||||||
|
int globalnoeffect=0;
|
||||||
|
|
||||||
extern int timerticspersec;
|
extern int timerticspersec;
|
||||||
|
|
||||||
|
@ -225,6 +255,7 @@ static void freeallmodels()
|
||||||
}
|
}
|
||||||
|
|
||||||
memset(tile2model,-1,sizeof(tile2model));
|
memset(tile2model,-1,sizeof(tile2model));
|
||||||
|
curextra=MAXTILES;
|
||||||
|
|
||||||
if (vertlist)
|
if (vertlist)
|
||||||
{
|
{
|
||||||
|
@ -315,7 +346,7 @@ int md_loadmodel(const char *fn)
|
||||||
return(nextmodelid-1);
|
return(nextmodelid-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
int md_setmisc(int modelid, float scale, int shadeoff, float zadd)
|
int md_setmisc(int modelid, float scale, int shadeoff, float zadd, int flags)
|
||||||
{
|
{
|
||||||
mdmodel *m;
|
mdmodel *m;
|
||||||
|
|
||||||
|
@ -326,14 +357,15 @@ int md_setmisc(int modelid, float scale, int shadeoff, float zadd)
|
||||||
m->bscale = scale;
|
m->bscale = scale;
|
||||||
m->shadeoff = shadeoff;
|
m->shadeoff = shadeoff;
|
||||||
m->zadd = zadd;
|
m->zadd = zadd;
|
||||||
|
m->flags = flags;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int md_tilehasmodel(int tilenume)
|
int md_tilehasmodel(int tilenume,int pal)
|
||||||
{
|
{
|
||||||
if (!mdinited) return -1;
|
if (!mdinited) return -1;
|
||||||
return tile2model[tilenume].modelid;
|
return tile2model[Ptile2tile(tilenume,pal)].modelid;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int framename2index(mdmodel *vm, const char *nam)
|
static int framename2index(mdmodel *vm, const char *nam)
|
||||||
|
@ -364,7 +396,7 @@ static int framename2index(mdmodel *vm, const char *nam)
|
||||||
return(i);
|
return(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
int md_defineframe(int modelid, const char *framename, int tilenume, int skinnum, float smoothduration)
|
int md_defineframe(int modelid, const char *framename, int tilenume, int skinnum, float smoothduration, int pal)
|
||||||
{
|
{
|
||||||
void *vm;
|
void *vm;
|
||||||
md2model *m;
|
md2model *m;
|
||||||
|
@ -376,6 +408,7 @@ int md_defineframe(int modelid, const char *framename, int tilenume, int skinnum
|
||||||
if ((unsigned int)tilenume >= (unsigned int)MAXTILES) return(-2);
|
if ((unsigned int)tilenume >= (unsigned int)MAXTILES) return(-2);
|
||||||
if (!framename) return(-3);
|
if (!framename) return(-3);
|
||||||
|
|
||||||
|
tilenume=addtileP(modelid,tilenume,pal);
|
||||||
m = (md2model *)models[modelid];
|
m = (md2model *)models[modelid];
|
||||||
if (m->mdnum == 1)
|
if (m->mdnum == 1)
|
||||||
{
|
{
|
||||||
|
@ -467,6 +500,7 @@ int md_defineskin(int modelid, const char *skinfn, int palnum, int skinnum, int
|
||||||
sk->fn = (char *)malloc(strlen(skinfn)+1);
|
sk->fn = (char *)malloc(strlen(skinfn)+1);
|
||||||
if (!sk->fn) return(-4);
|
if (!sk->fn) return(-4);
|
||||||
strcpy(sk->fn, skinfn);
|
strcpy(sk->fn, skinfn);
|
||||||
|
sk->palmap=0;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -493,6 +527,7 @@ int md_undefinetile(int tile)
|
||||||
if ((unsigned)tile >= (unsigned)MAXTILES) return -1;
|
if ((unsigned)tile >= (unsigned)MAXTILES) return -1;
|
||||||
|
|
||||||
tile2model[tile].modelid = -1;
|
tile2model[tile].modelid = -1;
|
||||||
|
tile2model[tile].next=-1;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -502,7 +537,7 @@ int md_undefinemodel(int modelid)
|
||||||
if (!mdinited) return 0;
|
if (!mdinited) return 0;
|
||||||
if ((unsigned int)modelid >= (unsigned int)nextmodelid) return -1;
|
if ((unsigned int)modelid >= (unsigned int)nextmodelid) return -1;
|
||||||
|
|
||||||
for (i=MAXTILES-1; i>=0; i--)
|
for (i=MAXTILES+EXTRATILES-1; i>=0; i--)
|
||||||
if (tile2model[i].modelid == modelid)
|
if (tile2model[i].modelid == modelid)
|
||||||
tile2model[i].modelid = -1;
|
tile2model[i].modelid = -1;
|
||||||
|
|
||||||
|
@ -515,7 +550,105 @@ int md_undefinemodel(int modelid)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int daskinloader(int filh, int *fptr, int *bpl, int *sizx, int *sizy, int *osizx, int *osizy, char *hasalpha, char effect)
|
md2model *modelhead;
|
||||||
|
mdskinmap_t *skhead;
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
int pal,pal1,pal2;
|
||||||
|
} palmaptr;
|
||||||
|
palmaptr palconv[MAXPALCONV];
|
||||||
|
|
||||||
|
void clearconv()
|
||||||
|
{
|
||||||
|
Bmemset(palconv,0,sizeof(palconv));
|
||||||
|
}
|
||||||
|
void setpalconv(int pal,int pal1,int pal2)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
for (i=0;i<MAXPALCONV;i++)
|
||||||
|
if (!palconv[i].pal)
|
||||||
|
{
|
||||||
|
palconv[i].pal =pal;
|
||||||
|
palconv[i].pal1=pal1;
|
||||||
|
palconv[i].pal2=pal2;return;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
if (palconv[i].pal==pal&&palconv[i].pal1==pal1)
|
||||||
|
{
|
||||||
|
palconv[i].pal2=pal2;return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void getpalmap(int stage,int *pal1,int *pal2)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
for (i=0;i<MAXPALCONV;i++)
|
||||||
|
if (palconv[i].pal==*pal2)
|
||||||
|
{
|
||||||
|
if (!stage)
|
||||||
|
{
|
||||||
|
*pal1=palconv[i].pal1;
|
||||||
|
*pal2=palconv[i].pal2;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
stage--;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int checkpalmaps(int pal)
|
||||||
|
{
|
||||||
|
int stage,val=0;
|
||||||
|
|
||||||
|
for (stage=0;stage<MAXPALCONV;stage++)
|
||||||
|
{
|
||||||
|
int pal1=0,pal2=pal;
|
||||||
|
getpalmap(stage,&pal1,&pal2);
|
||||||
|
if (!pal)break;
|
||||||
|
if (pal1)val|=1<<(pal1-SPECPAL);
|
||||||
|
}
|
||||||
|
return val;
|
||||||
|
}
|
||||||
|
|
||||||
|
void applypalmap(char *pic, char *palmap, int size, int pal)
|
||||||
|
{
|
||||||
|
pal+=200;
|
||||||
|
int r=0,g=1,b=2;
|
||||||
|
//_initprintf(" %d #%d\n",pal,palmap);
|
||||||
|
while (size--)
|
||||||
|
{
|
||||||
|
char a=palmap[b+1];
|
||||||
|
if (glinfo.bgra)swapchar(&pic[r], &pic[b]);
|
||||||
|
pic[r]=((pic[r]*(255-a)+hictinting[pal].r*a)*palmap[r])/255/255;
|
||||||
|
pic[g]=((pic[g]*(255-a)+hictinting[pal].g*a)*palmap[g])/255/255;
|
||||||
|
pic[b]=((pic[b]*(255-a)+hictinting[pal].b*a)*palmap[b])/255/255;
|
||||||
|
if (glinfo.bgra)swapchar(&pic[r], &pic[b]);
|
||||||
|
r+=4;g+=4;b+=4;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void applypalmapSkin(char *pic, int sizx, int sizy, int pal)
|
||||||
|
{
|
||||||
|
int stage;
|
||||||
|
|
||||||
|
//_initprintf("%d(%dx%d)\n",pal,sizx,sizy);
|
||||||
|
for (stage=0;stage<MAXPALCONV;stage++)
|
||||||
|
{
|
||||||
|
int pal1=0,pal2=pal;
|
||||||
|
getpalmap(stage,&pal1,&pal2);
|
||||||
|
if (!pal1)return;
|
||||||
|
|
||||||
|
mdskinmap_t *sk;
|
||||||
|
for (sk = modelhead->skinmap; sk; sk = sk->next)
|
||||||
|
if ((int)sk->palette == pal1&&sk->palmap)break;
|
||||||
|
if (!sk||sk->size!=sizx*sizy)continue;
|
||||||
|
|
||||||
|
applypalmap(pic,sk->palmap,sk->size,pal2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static int daskinloader(int filh, int *fptr, int *bpl, int *sizx, int *sizy, int *osizx, int *osizy, char *hasalpha, int pal, char effect)
|
||||||
{
|
{
|
||||||
int picfillen, j,y,x;
|
int picfillen, j,y,x;
|
||||||
char *picfil,*cptr,al=255;
|
char *picfil,*cptr,al=255;
|
||||||
|
@ -551,6 +684,7 @@ static int daskinloader(int filh, int *fptr, int *bpl, int *sizx, int *sizy, int
|
||||||
{ free(picfil); free(pic); return -1; }
|
{ free(picfil); free(pic); return -1; }
|
||||||
free(picfil);
|
free(picfil);
|
||||||
|
|
||||||
|
applypalmapSkin((char *)pic,tsizx,tsizy,pal);
|
||||||
cptr = &britable[gammabrightness ? 0 : curbrightness][0];
|
cptr = &britable[gammabrightness ? 0 : curbrightness][0];
|
||||||
for (y=0,j=0;y<tsizy;y++,j+=xsiz)
|
for (y=0,j=0;y<tsizy;y++,j+=xsiz)
|
||||||
{
|
{
|
||||||
|
@ -599,7 +733,7 @@ static int daskinloader(int filh, int *fptr, int *bpl, int *sizx, int *sizy, int
|
||||||
}
|
}
|
||||||
|
|
||||||
// JONOF'S COMPRESSED TEXTURE CACHE STUFF ---------------------------------------------------
|
// JONOF'S COMPRESSED TEXTURE CACHE STUFF ---------------------------------------------------
|
||||||
int mdloadskin_trytexcache(char *fn, int len, char effect, texcacheheader *head)
|
int mdloadskin_trytexcache(char *fn, int len, int pal, char effect, texcacheheader *head)
|
||||||
{
|
{
|
||||||
int fil, fp;
|
int fil, fp;
|
||||||
char cachefn[BMAX_PATH], *cp;
|
char cachefn[BMAX_PATH], *cp;
|
||||||
|
@ -618,7 +752,7 @@ int mdloadskin_trytexcache(char *fn, int len, char effect, texcacheheader *head)
|
||||||
for (cp = cachefn, fp = 0; (*cp = TEXCACHEDIR[fp]); cp++,fp++);
|
for (cp = cachefn, fp = 0; (*cp = TEXCACHEDIR[fp]); cp++,fp++);
|
||||||
*(cp++) = '/';
|
*(cp++) = '/';
|
||||||
for (fp = 0; fp < 16; phex(mdsum[fp++], cp), cp+=2);
|
for (fp = 0; fp < 16; phex(mdsum[fp++], cp), cp+=2);
|
||||||
sprintf(cp, "-%x-0%x", len, effect);
|
sprintf(cp, "-%x-%x%x", len, pal, effect);
|
||||||
|
|
||||||
fil = kopen4load(cachefn, 0);
|
fil = kopen4load(cachefn, 0);
|
||||||
if (fil < 0) return -1;
|
if (fil < 0) return -1;
|
||||||
|
@ -640,7 +774,7 @@ failure:
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int mdloadskin_cached(int fil, texcacheheader *head, int *doalloc, GLuint *glpic, int *xsiz, int *ysiz)
|
static int mdloadskin_cached(int fil, texcacheheader *head, int *doalloc, GLuint *glpic, int *xsiz, int *ysiz, int pal)
|
||||||
{
|
{
|
||||||
int level, r;
|
int level, r;
|
||||||
texcachepicture pict;
|
texcachepicture pict;
|
||||||
|
@ -712,6 +846,7 @@ static int mdloadskin(md2model *m, int number, int pal, int surf)
|
||||||
GLuint *texidx = NULL;
|
GLuint *texidx = NULL;
|
||||||
mdskinmap_t *sk, *skzero = NULL;
|
mdskinmap_t *sk, *skzero = NULL;
|
||||||
int doalloc = 1, filh;
|
int doalloc = 1, filh;
|
||||||
|
modelhead=m; // for palmaps
|
||||||
|
|
||||||
int cachefil = -1, picfillen;
|
int cachefil = -1, picfillen;
|
||||||
texcacheheader cachead;
|
texcacheheader cachead;
|
||||||
|
@ -725,7 +860,7 @@ static int mdloadskin(md2model *m, int number, int pal, int surf)
|
||||||
if ((int)sk->palette == pal && sk->skinnum == number && sk->surfnum == surf)
|
if ((int)sk->palette == pal && sk->skinnum == number && sk->surfnum == surf)
|
||||||
{
|
{
|
||||||
skinfile = sk->fn;
|
skinfile = sk->fn;
|
||||||
texidx = &sk->texid[ hictinting[pal].f ];
|
texidx = &sk->texid[(globalnoeffect)?0:hictinting[pal].f ];
|
||||||
strcpy(fn,skinfile);
|
strcpy(fn,skinfile);
|
||||||
//OSD_Printf("Using exact match skin (pal=%d,skinnum=%d,surfnum=%d) %s\n",pal,number,surf,skinfile);
|
//OSD_Printf("Using exact match skin (pal=%d,skinnum=%d,surfnum=%d) %s\n",pal,number,surf,skinfile);
|
||||||
break;
|
break;
|
||||||
|
@ -745,7 +880,7 @@ static int mdloadskin(md2model *m, int number, int pal, int surf)
|
||||||
if (skzero)
|
if (skzero)
|
||||||
{
|
{
|
||||||
skinfile = skzero->fn;
|
skinfile = skzero->fn;
|
||||||
texidx = &skzero->texid[ hictinting[pal].f ];
|
texidx = &skzero->texid[(globalnoeffect)?0:hictinting[pal].f ];
|
||||||
strcpy(fn,skinfile);
|
strcpy(fn,skinfile);
|
||||||
//OSD_Printf("Using def skin 0,0 as fallback, pal=%d\n", pal);
|
//OSD_Printf("Using def skin 0,0 as fallback, pal=%d\n", pal);
|
||||||
}
|
}
|
||||||
|
@ -753,11 +888,12 @@ static int mdloadskin(md2model *m, int number, int pal, int surf)
|
||||||
{
|
{
|
||||||
if ((unsigned)number >= (unsigned)m->numskins) number = 0;
|
if ((unsigned)number >= (unsigned)m->numskins) number = 0;
|
||||||
skinfile = m->skinfn + number*64;
|
skinfile = m->skinfn + number*64;
|
||||||
texidx = &m->texid[ number * (HICEFFECTMASK+1) + hictinting[pal].f ];
|
texidx = &m->texid[ number * (HICEFFECTMASK+1) + (globalnoeffect)?0:hictinting[pal].f ];
|
||||||
strcpy(fn,m->basepath); strcat(fn,skinfile);
|
strcpy(fn,m->basepath); strcat(fn,skinfile);
|
||||||
//OSD_Printf("Using MD2/MD3 skin (%d) %s, pal=%d\n",number,skinfile,pal);
|
//OSD_Printf("Using MD2/MD3 skin (%d) %s, pal=%d\n",number,skinfile,pal);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
skhead=sk; // for palmaps
|
||||||
if (!skinfile[0]) return 0;
|
if (!skinfile[0]) return 0;
|
||||||
|
|
||||||
if (*texidx) return *texidx;
|
if (*texidx) return *texidx;
|
||||||
|
@ -766,10 +902,10 @@ static int mdloadskin(md2model *m, int number, int pal, int surf)
|
||||||
if (pal >= (MAXPALOOKUPS - RESERVEDPALS))
|
if (pal >= (MAXPALOOKUPS - RESERVEDPALS))
|
||||||
for (i=0;i<nextmodelid;i++)
|
for (i=0;i<nextmodelid;i++)
|
||||||
for (skzero = ((md2model *)models[i])->skinmap; skzero; skzero = skzero->next)
|
for (skzero = ((md2model *)models[i])->skinmap; skzero; skzero = skzero->next)
|
||||||
if (!Bstrcasecmp(skzero->fn, sk->fn) && skzero->texid[hictinting[pal].f])
|
if (!Bstrcasecmp(skzero->fn, sk->fn) && skzero->texid[(globalnoeffect)?0:hictinting[pal].f])
|
||||||
{
|
{
|
||||||
sk->texid[hictinting[pal].f] = skzero->texid[hictinting[pal].f];
|
sk->texid[(globalnoeffect)?0:hictinting[pal].f] = skzero->texid[(globalnoeffect)?0:hictinting[pal].f];
|
||||||
return sk->texid[hictinting[pal].f];
|
return sk->texid[(globalnoeffect)?0:hictinting[pal].f];
|
||||||
}
|
}
|
||||||
|
|
||||||
*texidx = 0;
|
*texidx = 0;
|
||||||
|
@ -784,8 +920,8 @@ static int mdloadskin(md2model *m, int number, int pal, int surf)
|
||||||
picfillen = kfilelength(filh);
|
picfillen = kfilelength(filh);
|
||||||
kclose(filh); // FIXME: shouldn't have to do this. bug in cache1d.c
|
kclose(filh); // FIXME: shouldn't have to do this. bug in cache1d.c
|
||||||
|
|
||||||
cachefil = mdloadskin_trytexcache(fn, picfillen, hictinting[pal].f, &cachead);
|
cachefil = mdloadskin_trytexcache(fn, picfillen, pal<<8, (globalnoeffect)?0:hictinting[pal].f, &cachead);
|
||||||
if (cachefil >= 0 && !mdloadskin_cached(cachefil, &cachead, &doalloc, texidx, &xsiz, &ysiz))
|
if (cachefil >= 0 && !mdloadskin_cached(cachefil, &cachead, &doalloc, texidx, &xsiz, &ysiz, pal))
|
||||||
{
|
{
|
||||||
osizx = cachead.xdim;
|
osizx = cachead.xdim;
|
||||||
osizy = cachead.ydim;
|
osizy = cachead.ydim;
|
||||||
|
@ -800,7 +936,7 @@ static int mdloadskin(md2model *m, int number, int pal, int surf)
|
||||||
cachefil = -1; // the compressed version will be saved to disk
|
cachefil = -1; // the compressed version will be saved to disk
|
||||||
|
|
||||||
if ((filh = kopen4load(fn, 0)) < 0) return -1;
|
if ((filh = kopen4load(fn, 0)) < 0) return -1;
|
||||||
if (daskinloader(filh,&fptr,&bpl,&xsiz,&ysiz,&osizx,&osizy,&hasalpha,hictinting[pal].f))
|
if (daskinloader(filh,&fptr,&bpl,&xsiz,&ysiz,&osizx,&osizy,&hasalpha,pal,(globalnoeffect)?0:hictinting[pal].f))
|
||||||
{
|
{
|
||||||
kclose(filh);
|
kclose(filh);
|
||||||
initprintf("Failed loading skin file \"%s\"\n", fn);
|
initprintf("Failed loading skin file \"%s\"\n", fn);
|
||||||
|
@ -818,6 +954,18 @@ static int mdloadskin(md2model *m, int number, int pal, int surf)
|
||||||
else if (!hasalpha) intexfmt = GL_RGB;
|
else if (!hasalpha) intexfmt = GL_RGB;
|
||||||
if (glinfo.bgra) texfmt = GL_BGRA;
|
if (glinfo.bgra) texfmt = GL_BGRA;
|
||||||
uploadtexture((doalloc&1), xsiz, ysiz, intexfmt, texfmt, (coltype*)fptr, xsiz, ysiz, 0);
|
uploadtexture((doalloc&1), xsiz, ysiz, intexfmt, texfmt, (coltype*)fptr, xsiz, ysiz, 0);
|
||||||
|
if (pal>=SPECPAL&&pal<=REDPAL)
|
||||||
|
{
|
||||||
|
//_initprintf("%cLoaded palmap %d(%dx%d)",sk->palmap?'+':'-',pal,xsiz,ysiz);
|
||||||
|
if (!sk->palmap)
|
||||||
|
{
|
||||||
|
sk->size=xsiz*ysiz;
|
||||||
|
sk->palmap=malloc(sk->size*4);
|
||||||
|
memcpy(sk->palmap,(char *)fptr,sk->size*4);
|
||||||
|
}
|
||||||
|
cachefil=0;
|
||||||
|
//_initprintf("#%d\n",sk->palmap);
|
||||||
|
}
|
||||||
free((void*)fptr);
|
free((void*)fptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -876,7 +1024,7 @@ static int mdloadskin(md2model *m, int number, int pal, int surf)
|
||||||
if (ysiz == pow2long[j]) { i |= 2; }
|
if (ysiz == pow2long[j]) { i |= 2; }
|
||||||
}
|
}
|
||||||
cachead.flags = (i!=3) | (hasalpha ? 2 : 0);
|
cachead.flags = (i!=3) | (hasalpha ? 2 : 0);
|
||||||
writexcache(fn, picfillen, 0, hictinting[pal].f, &cachead);
|
writexcache(fn, picfillen, pal<<8, (globalnoeffect)?0:hictinting[pal].f, &cachead);
|
||||||
}
|
}
|
||||||
|
|
||||||
return(*texidx);
|
return(*texidx);
|
||||||
|
@ -891,23 +1039,22 @@ static void updateanimation(md2model *m, spritetype *tspr)
|
||||||
int i, j, k;
|
int i, j, k;
|
||||||
int fps;
|
int fps;
|
||||||
|
|
||||||
|
m->cframe = m->nframe = tile2model[Ptile2tile(tspr->picnum,tspr->pal)].framenum;
|
||||||
if (mdpause)
|
if (mdpause)
|
||||||
{
|
{
|
||||||
// spriteext[tspr->owner].mdanimtims = mdtims;
|
// spriteext[tspr->owner].mdanimtims = mdtims;
|
||||||
m->interpol = 0;
|
m->interpol = 0;
|
||||||
spriteext[tspr->owner].mdanimtims = mdtims;
|
spriteext[tspr->owner].mdanimtims = mdtims;
|
||||||
m->nframe = m->cframe;
|
spriteext[tspr->picnum].mdanimtims = mdtims;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
m->cframe = m->nframe = tile2model[tspr->picnum].framenum;
|
|
||||||
|
|
||||||
for (anim = m->animations;
|
for (anim = m->animations;
|
||||||
anim && anim->startframe != m->cframe;
|
anim && anim->startframe != m->cframe;
|
||||||
anim = anim->next) ;
|
anim = anim->next) ;
|
||||||
if (!anim)
|
if (!anim)
|
||||||
{
|
{
|
||||||
if (r_animsmoothing && (tile2model[tspr->picnum].smoothduration != 0) && (spritesmooth[tspr->owner].mdoldframe != m->cframe))
|
if (r_animsmoothing && (tile2model[Ptile2tile(tspr->picnum,tspr->pal)].smoothduration != 0) && (spritesmooth[tspr->owner].mdoldframe != m->cframe))
|
||||||
{
|
{
|
||||||
if (spritesmooth[tspr->owner].mdsmooth == 0)
|
if (spritesmooth[tspr->owner].mdsmooth == 0)
|
||||||
{
|
{
|
||||||
|
@ -916,7 +1063,7 @@ static void updateanimation(md2model *m, spritetype *tspr)
|
||||||
spritesmooth[tspr->owner].mdsmooth = 1;
|
spritesmooth[tspr->owner].mdsmooth = 1;
|
||||||
spritesmooth[tspr->owner].mdcurframe = m->cframe;
|
spritesmooth[tspr->owner].mdcurframe = m->cframe;
|
||||||
}
|
}
|
||||||
if (r_animsmoothing && (tile2model[tspr->picnum].smoothduration != 0) && (spritesmooth[tspr->owner].mdcurframe != m->cframe))
|
if (r_animsmoothing && (tile2model[Ptile2tile(tspr->picnum,tspr->pal)].smoothduration != 0) && (spritesmooth[tspr->owner].mdcurframe != m->cframe))
|
||||||
{
|
{
|
||||||
spriteext[tspr->owner].mdanimtims = mdtims;
|
spriteext[tspr->owner].mdanimtims = mdtims;
|
||||||
m->interpol = 0;
|
m->interpol = 0;
|
||||||
|
@ -925,7 +1072,7 @@ static void updateanimation(md2model *m, spritetype *tspr)
|
||||||
spritesmooth[tspr->owner].mdcurframe = m->cframe;
|
spritesmooth[tspr->owner].mdcurframe = m->cframe;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (r_animsmoothing && (tile2model[tspr->picnum].smoothduration != 0) && (spritesmooth[tspr->owner].mdcurframe != m->cframe))
|
else if (r_animsmoothing && (tile2model[Ptile2tile(tspr->picnum,tspr->pal)].smoothduration != 0) && (spritesmooth[tspr->owner].mdcurframe != m->cframe))
|
||||||
{
|
{
|
||||||
spriteext[tspr->owner].mdanimtims = mdtims;
|
spriteext[tspr->owner].mdanimtims = mdtims;
|
||||||
m->interpol = 0;
|
m->interpol = 0;
|
||||||
|
@ -947,7 +1094,7 @@ static void updateanimation(md2model *m, spritetype *tspr)
|
||||||
spriteext[tspr->owner].mdanimcur = (short)anim->startframe;
|
spriteext[tspr->owner].mdanimcur = (short)anim->startframe;
|
||||||
spriteext[tspr->owner].mdanimtims = mdtims;
|
spriteext[tspr->owner].mdanimtims = mdtims;
|
||||||
m->interpol = 0;
|
m->interpol = 0;
|
||||||
if (!r_animsmoothing || (tile2model[tspr->picnum].smoothduration == 0))
|
if (!r_animsmoothing || (tile2model[Ptile2tile(tspr->picnum,tspr->pal)].smoothduration == 0))
|
||||||
{
|
{
|
||||||
m->cframe = m->nframe = anim->startframe;
|
m->cframe = m->nframe = anim->startframe;
|
||||||
return;
|
return;
|
||||||
|
@ -959,7 +1106,7 @@ static void updateanimation(md2model *m, spritetype *tspr)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (spritesmooth[tspr->owner].mdsmooth)
|
if (spritesmooth[tspr->owner].mdsmooth)
|
||||||
fps = (1.0f / (float)(tile2model[tspr->picnum].smoothduration)) * 66;
|
fps = (1.0f / (float)(tile2model[Ptile2tile(tspr->picnum,tspr->pal)].smoothduration)) * 66;
|
||||||
else
|
else
|
||||||
fps = anim->fpssc;
|
fps = anim->fpssc;
|
||||||
|
|
||||||
|
@ -1229,6 +1376,11 @@ static md2model *md2load(int fil, const char *filnam)
|
||||||
if (m->numskins > 0)
|
if (m->numskins > 0)
|
||||||
{
|
{
|
||||||
sk->fn = (char *)malloc(strlen(m->basepath)+strlen(m->skinfn)+1);
|
sk->fn = (char *)malloc(strlen(m->basepath)+strlen(m->skinfn)+1);
|
||||||
|
if (sk->palmap)
|
||||||
|
{
|
||||||
|
//_initprintf("Delete %s",m->skinfn);
|
||||||
|
sk->palmap=0;sk->size=0;
|
||||||
|
}
|
||||||
strcpy(sk->fn, m->basepath);
|
strcpy(sk->fn, m->basepath);
|
||||||
strcat(sk->fn, m->skinfn);
|
strcat(sk->fn, m->skinfn);
|
||||||
}
|
}
|
||||||
|
@ -1463,8 +1615,9 @@ static int md3draw(md3model *m, spritetype *tspr)
|
||||||
point3d fp, fp1, fp2, m0, m1, a0, a1;
|
point3d fp, fp1, fp2, m0, m1, a0, a1;
|
||||||
md3xyzn_t *v0, *v1;
|
md3xyzn_t *v0, *v1;
|
||||||
int i, j, k, l, surfi, *lptr;
|
int i, j, k, l, surfi, *lptr;
|
||||||
float f, g, k0, k1, k2, k3, k4, k5, k6, k7, mat[16], pc[4], mult;
|
float f, g, k0, k1, k2, k3, k4, k5, k6, k7, mat[16], mult;
|
||||||
md3surf_t *s;
|
md3surf_t *s;
|
||||||
|
GLfloat pc[4],pc1[4];
|
||||||
int texunits = GL_TEXTURE0_ARB;
|
int texunits = GL_TEXTURE0_ARB;
|
||||||
mdskinmap_t *sk;
|
mdskinmap_t *sk;
|
||||||
//PLAG : sorting stuff
|
//PLAG : sorting stuff
|
||||||
|
@ -1490,14 +1643,14 @@ static int md3draw(md3model *m, spritetype *tspr)
|
||||||
m0.x = m->scale * g; m1.x = m->scale *f;
|
m0.x = m->scale * g; m1.x = m->scale *f;
|
||||||
m0.y = m->scale * g; m1.y = m->scale *f;
|
m0.y = m->scale * g; m1.y = m->scale *f;
|
||||||
m0.z = m->scale * g; m1.z = m->scale *f;
|
m0.z = m->scale * g; m1.z = m->scale *f;
|
||||||
a0.x = a0.y = 0; a0.z = m->zadd*m->scale;
|
a0.x = a0.y = 0; a0.z = ((globalorientation&8)?-m->zadd:m->zadd)*m->scale;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m0.x = (1.0/64.0) * m->scale * g; m1.x = (1.0/64.0) * m->scale *f;
|
m0.x = (1.0/64.0) * m->scale * g; m1.x = (1.0/64.0) * m->scale *f;
|
||||||
m0.y = (1.0/64.0) * m->scale * g; m1.y = (1.0/64.0) * m->scale *f;
|
m0.y = (1.0/64.0) * m->scale * g; m1.y = (1.0/64.0) * m->scale *f;
|
||||||
m0.z = (1.0/64.0) * m->scale * g; m1.z = (1.0/64.0) * m->scale *f;
|
m0.z = (1.0/64.0) * m->scale * g; m1.z = (1.0/64.0) * m->scale *f;
|
||||||
a0.x = a0.y = 0; a0.z = m->zadd*m->scale;
|
a0.x = a0.y = 0; a0.z = ((globalorientation&8)?-m->zadd:m->zadd)*m->scale;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1581,6 +1734,8 @@ static int md3draw(md3model *m, spritetype *tspr)
|
||||||
bglEnable(GL_TEXTURE_2D);
|
bglEnable(GL_TEXTURE_2D);
|
||||||
|
|
||||||
pc[0] = pc[1] = pc[2] = ((float)(numpalookups-min(max((globalshade * shadescale)+m->shadeoff,0),numpalookups)))/((float)numpalookups);
|
pc[0] = pc[1] = pc[2] = ((float)(numpalookups-min(max((globalshade * shadescale)+m->shadeoff,0),numpalookups)))/((float)numpalookups);
|
||||||
|
if (!(m->flags&1))
|
||||||
|
{
|
||||||
pc[0] *= (float)hictinting[globalpal].r / 255.0;
|
pc[0] *= (float)hictinting[globalpal].r / 255.0;
|
||||||
pc[1] *= (float)hictinting[globalpal].g / 255.0;
|
pc[1] *= (float)hictinting[globalpal].g / 255.0;
|
||||||
pc[2] *= (float)hictinting[globalpal].b / 255.0;
|
pc[2] *= (float)hictinting[globalpal].b / 255.0;
|
||||||
|
@ -1590,6 +1745,8 @@ static int md3draw(md3model *m, spritetype *tspr)
|
||||||
pc[1] *= (float)hictinting[MAXPALOOKUPS-1].g / 255.0;
|
pc[1] *= (float)hictinting[MAXPALOOKUPS-1].g / 255.0;
|
||||||
pc[2] *= (float)hictinting[MAXPALOOKUPS-1].b / 255.0;
|
pc[2] *= (float)hictinting[MAXPALOOKUPS-1].b / 255.0;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
else globalnoeffect=1;
|
||||||
|
|
||||||
if (tspr->cstat&2) { if (!(tspr->cstat&512)) pc[3] = 0.66; else pc[3] = 0.33; }
|
if (tspr->cstat&2) { if (!(tspr->cstat&512)) pc[3] = 0.66; else pc[3] = 0.33; }
|
||||||
else pc[3] = 1.0;
|
else pc[3] = 1.0;
|
||||||
|
@ -1699,12 +1856,17 @@ static int md3draw(md3model *m, spritetype *tspr)
|
||||||
mat[3] = mat[7] = mat[11] = 0.f; mat[15] = 1.f; bglLoadMatrixf(mat);
|
mat[3] = mat[7] = mat[11] = 0.f; mat[15] = 1.f; bglLoadMatrixf(mat);
|
||||||
// PLAG: End
|
// PLAG: End
|
||||||
|
|
||||||
i = mdloadskin((md2model *)m,tile2model[tspr->picnum].skinnum,globalpal,surfi); if (!i) continue;
|
|
||||||
//i = mdloadskin((md2model *)m,tile2model[tspr->picnum].skinnum,surfi); //hack for testing multiple surfaces per MD3
|
int pal1;
|
||||||
|
for (pal1=SPECPAL;pal1<=REDPAL;pal1++)
|
||||||
|
mdloadskin((md2model *)m,tile2model[Ptile2tile(tspr->picnum,tspr->pal)].skinnum,pal1,surfi);
|
||||||
|
|
||||||
|
i = mdloadskin((md2model *)m,tile2model[Ptile2tile(tspr->picnum,tspr->pal)].skinnum,globalpal,surfi); if (!i) continue;
|
||||||
|
//i = mdloadskin((md2model *)m,tile2model[Ptile2tile(tspr->picnum,tspr->pal)].skinnum,surfi); //hack for testing multiple surfaces per MD3
|
||||||
bglBindTexture(GL_TEXTURE_2D, i);
|
bglBindTexture(GL_TEXTURE_2D, i);
|
||||||
|
|
||||||
if (r_detailmapping && !r_depthpeeling && !(tspr->cstat&1024))
|
if (r_detailmapping && !r_depthpeeling && !(tspr->cstat&1024))
|
||||||
i = mdloadskin((md2model *)m,tile2model[tspr->picnum].skinnum,DETAILPAL,surfi);
|
i = mdloadskin((md2model *)m,tile2model[Ptile2tile(tspr->picnum,tspr->pal)].skinnum,DETAILPAL,surfi);
|
||||||
else
|
else
|
||||||
i = 0;
|
i = 0;
|
||||||
|
|
||||||
|
@ -1734,7 +1896,7 @@ static int md3draw(md3model *m, spritetype *tspr)
|
||||||
bglTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_T,GL_REPEAT);
|
bglTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_T,GL_REPEAT);
|
||||||
|
|
||||||
for (sk = m->skinmap; sk; sk = sk->next)
|
for (sk = m->skinmap; sk; sk = sk->next)
|
||||||
if ((int)sk->palette == DETAILPAL && sk->skinnum == tile2model[tspr->picnum].skinnum && sk->surfnum == surfi)
|
if ((int)sk->palette == DETAILPAL && sk->skinnum == tile2model[Ptile2tile(tspr->picnum,tspr->pal)].skinnum && sk->surfnum == surfi)
|
||||||
f = sk->param;
|
f = sk->param;
|
||||||
|
|
||||||
bglMatrixMode(GL_TEXTURE);
|
bglMatrixMode(GL_TEXTURE);
|
||||||
|
@ -1744,7 +1906,7 @@ static int md3draw(md3model *m, spritetype *tspr)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (r_glowmapping && !r_depthpeeling && !(tspr->cstat&1024))
|
if (r_glowmapping && !r_depthpeeling && !(tspr->cstat&1024))
|
||||||
i = mdloadskin((md2model *)m,tile2model[tspr->picnum].skinnum,GLOWPAL,surfi);
|
i = mdloadskin((md2model *)m,tile2model[Ptile2tile(tspr->picnum,tspr->pal)].skinnum,GLOWPAL,surfi);
|
||||||
else
|
else
|
||||||
i = 0;
|
i = 0;
|
||||||
|
|
||||||
|
@ -1946,6 +2108,7 @@ static int md3draw(md3model *m, spritetype *tspr)
|
||||||
}
|
}
|
||||||
bglLoadIdentity();
|
bglLoadIdentity();
|
||||||
|
|
||||||
|
globalnoeffect=0;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1967,6 +2130,11 @@ static void md3free(md3model *m)
|
||||||
{
|
{
|
||||||
nsk = sk->next;
|
nsk = sk->next;
|
||||||
free(sk->fn);
|
free(sk->fn);
|
||||||
|
if (sk->palmap)
|
||||||
|
{
|
||||||
|
//_initprintf("Kill %d\n",sk->palette);
|
||||||
|
free(sk->palmap);sk->palmap=0;
|
||||||
|
}
|
||||||
free(sk);
|
free(sk);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2686,7 +2854,7 @@ static int voxdraw(voxmodel *m, spritetype *tspr)
|
||||||
m0.x = m->scale;
|
m0.x = m->scale;
|
||||||
m0.y = m->scale;
|
m0.y = m->scale;
|
||||||
m0.z = m->scale;
|
m0.z = m->scale;
|
||||||
a0.x = a0.y = 0; a0.z = m->zadd*m->scale;
|
a0.x = a0.y = 0; a0.z = ((globalorientation&8)?-m->zadd:m->zadd)*m->scale;
|
||||||
|
|
||||||
//if (globalorientation&8) //y-flipping
|
//if (globalorientation&8) //y-flipping
|
||||||
//{
|
//{
|
||||||
|
@ -2884,7 +3052,7 @@ int mddraw(spritetype *tspr)
|
||||||
allocmodelverts = maxmodelverts;
|
allocmodelverts = maxmodelverts;
|
||||||
}
|
}
|
||||||
|
|
||||||
vm = models[tile2model[tspr->picnum].modelid];
|
vm = models[tile2model[Ptile2tile(tspr->picnum,tspr->pal)].modelid];
|
||||||
if (vm->mdnum == 1) { return voxdraw((voxmodel *)vm,tspr); }
|
if (vm->mdnum == 1) { return voxdraw((voxmodel *)vm,tspr); }
|
||||||
if (vm->mdnum == 3) { return md3draw((md3model *)vm,tspr); }
|
if (vm->mdnum == 3) { return md3draw((md3model *)vm,tspr); }
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -590,7 +590,7 @@ int OSD_HandleKey(int sc, int press)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
else if (sc == 1) // escape
|
else if (sc == 1) // escape
|
||||||
{
|
{
|
||||||
// OSD_ShowDisplay(0);
|
// OSD_ShowDisplay(0);
|
||||||
osdscroll = -1;
|
osdscroll = -1;
|
||||||
osdrowscur += osdscroll;
|
osdrowscur += osdscroll;
|
||||||
|
|
|
@ -364,8 +364,10 @@ static pthtyp *gltexcachead[GLTEXCACHEADSIZ];
|
||||||
|
|
||||||
static int drawingskybox = 0;
|
static int drawingskybox = 0;
|
||||||
|
|
||||||
|
pthtyp *pichead;
|
||||||
|
|
||||||
int gloadtile_art(int,int,int,pthtyp*,int);
|
int gloadtile_art(int,int,int,pthtyp*,int);
|
||||||
int gloadtile_hi(int,int,hicreplctyp*,int,pthtyp*,int,char);
|
int gloadtile_hi(int,int,int,hicreplctyp*,int,pthtyp*,int,char);
|
||||||
static int hicprecaching = 0;
|
static int hicprecaching = 0;
|
||||||
pthtyp * gltexcache(int dapicnum, int dapalnum, int dameth)
|
pthtyp * gltexcache(int dapicnum, int dapalnum, int dameth)
|
||||||
{
|
{
|
||||||
|
@ -389,8 +391,9 @@ pthtyp * gltexcache(int dapicnum, int dapalnum, int dameth)
|
||||||
* effects are applied to the palette 0 texture if it exists
|
* effects are applied to the palette 0 texture if it exists
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
pichead=gltexcachead[j]; // for palmaps
|
||||||
// load a replacement
|
// load a replacement
|
||||||
for (pth=gltexcachead[j]; pth; pth=pth->next)
|
for (pth=pichead; pth; pth=pth->next)
|
||||||
{
|
{
|
||||||
if (pth->picnum == dapicnum &&
|
if (pth->picnum == dapicnum &&
|
||||||
pth->palnum == si->palnum &&
|
pth->palnum == si->palnum &&
|
||||||
|
@ -402,7 +405,7 @@ pthtyp * gltexcache(int dapicnum, int dapalnum, int dameth)
|
||||||
if (pth->flags & 128)
|
if (pth->flags & 128)
|
||||||
{
|
{
|
||||||
pth->flags &= ~128;
|
pth->flags &= ~128;
|
||||||
if (gloadtile_hi(dapicnum,drawingskybox,si,dameth,pth,0,
|
if (gloadtile_hi(dapicnum,dapalnum,drawingskybox,si,dameth,pth,0,
|
||||||
(si->palnum>0) ? 0 : hictinting[dapalnum].f)) // reload tile
|
(si->palnum>0) ? 0 : hictinting[dapalnum].f)) // reload tile
|
||||||
{
|
{
|
||||||
if (drawingskybox) return NULL;
|
if (drawingskybox) return NULL;
|
||||||
|
@ -430,12 +433,18 @@ pthtyp * gltexcache(int dapicnum, int dapalnum, int dameth)
|
||||||
if (pth2->flags & 8) pth->flags |= 8; //hasalpha
|
if (pth2->flags & 8) pth->flags |= 8; //hasalpha
|
||||||
pth->hicr = si;
|
pth->hicr = si;
|
||||||
pth->next = gltexcachead[j];
|
pth->next = gltexcachead[j];
|
||||||
|
if (pth->palmap)
|
||||||
|
{
|
||||||
|
//_initprintf("Realloc #%d->#%d\n",pth2->palmap, pth->palmap);
|
||||||
|
pth->palmap=malloc(pth->size*4);
|
||||||
|
memcpy(pth->palmap, pth2->palmap, pth->size*4);
|
||||||
|
}
|
||||||
gltexcachead[j] = pth;
|
gltexcachead[j] = pth;
|
||||||
return(pth);
|
return(pth);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gloadtile_hi(dapicnum,drawingskybox,si,dameth,pth,1, (si->palnum>0) ? 0 : hictinting[dapalnum].f))
|
if (gloadtile_hi(dapicnum,dapalnum,drawingskybox,si,dameth,pth,1, (si->palnum>0) ? 0 : hictinting[dapalnum].f))
|
||||||
{
|
{
|
||||||
free(pth);
|
free(pth);
|
||||||
if (drawingskybox) return NULL;
|
if (drawingskybox) return NULL;
|
||||||
|
@ -642,6 +651,11 @@ void polymost_glreset()
|
||||||
free(pth->ofb);
|
free(pth->ofb);
|
||||||
}
|
}
|
||||||
bglDeleteTextures(1,&pth->glpic);
|
bglDeleteTextures(1,&pth->glpic);
|
||||||
|
if (pth->palmap)
|
||||||
|
{
|
||||||
|
//_initprintf("Kill #%d\n",pth->palmap);
|
||||||
|
free(pth->palmap);pth->palmap=0;
|
||||||
|
}
|
||||||
free(pth);
|
free(pth);
|
||||||
pth = next;
|
pth = next;
|
||||||
}
|
}
|
||||||
|
@ -1353,7 +1367,7 @@ failure:
|
||||||
if (packbuf) free(packbuf);
|
if (packbuf) free(packbuf);
|
||||||
}
|
}
|
||||||
|
|
||||||
int gloadtile_cached(int fil, texcacheheader *head, int *doalloc, pthtyp *pth)
|
int gloadtile_cached(int fil, texcacheheader *head, int *doalloc, pthtyp *pth,int dapalnum)
|
||||||
{
|
{
|
||||||
int level, r;
|
int level, r;
|
||||||
texcachepicture pict;
|
texcachepicture pict;
|
||||||
|
@ -1417,8 +1431,26 @@ failure:
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
// --------------------------------------------------- JONOF'S COMPRESSED TEXTURE CACHE STUFF
|
// --------------------------------------------------- JONOF'S COMPRESSED TEXTURE CACHE STUFF
|
||||||
|
static void applypalmapsT(char *pic, int sizx, int sizy, int pal)
|
||||||
|
{
|
||||||
|
//_initprintf("%d\n",pal);
|
||||||
|
int stage;
|
||||||
|
for (stage=0;stage<MAXPALCONV;stage++)
|
||||||
|
{
|
||||||
|
int pal1=0,pal2=pal;
|
||||||
|
getpalmap(stage,&pal1,&pal2);
|
||||||
|
if (!pal1)return;
|
||||||
|
|
||||||
int gloadtile_hi(int dapic, int facen, hicreplctyp *hicr, int dameth, pthtyp *pth, int doalloc, char effect)
|
pthtyp *pth;
|
||||||
|
for (pth=pichead; pth; pth=pth->next)
|
||||||
|
if (pth->palnum ==pal1&&pth->palmap)break;
|
||||||
|
if (!pth||pth->size!=sizx*sizy)continue;
|
||||||
|
|
||||||
|
applypalmap(pic,pth->palmap,pth->size,pal2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int gloadtile_hi(int dapic,int dapalnum, int facen, hicreplctyp *hicr, int dameth, pthtyp *pth, int doalloc, char effect)
|
||||||
{
|
{
|
||||||
coltype *pic = NULL, *rpptr;
|
coltype *pic = NULL, *rpptr;
|
||||||
int j, x, y, x2, y2, xsiz=0, ysiz=0, tsizx, tsizy;
|
int j, x, y, x2, y2, xsiz=0, ysiz=0, tsizx, tsizy;
|
||||||
|
@ -1456,8 +1488,8 @@ int gloadtile_hi(int dapic, int facen, hicreplctyp *hicr, int dameth, pthtyp *pt
|
||||||
|
|
||||||
kclose(filh); // FIXME: shouldn't have to do this. bug in cache1d.c
|
kclose(filh); // FIXME: shouldn't have to do this. bug in cache1d.c
|
||||||
|
|
||||||
cachefil = trytexcache(fn, picfillen, dameth, effect, &cachead);
|
cachefil = trytexcache(fn, picfillen+(dapalnum<<8), dameth, effect, &cachead);
|
||||||
if (cachefil >= 0 && !gloadtile_cached(cachefil, &cachead, &doalloc, pth))
|
if (cachefil >= 0 && !gloadtile_cached(cachefil, &cachead, &doalloc, pth, dapalnum))
|
||||||
{
|
{
|
||||||
tsizx = cachead.xdim;
|
tsizx = cachead.xdim;
|
||||||
tsizy = cachead.ydim;
|
tsizy = cachead.ydim;
|
||||||
|
@ -1498,6 +1530,7 @@ int gloadtile_hi(int dapic, int facen, hicreplctyp *hicr, int dameth, pthtyp *pt
|
||||||
pic = (coltype *)calloc(xsiz,ysiz*sizeof(coltype)); if (!pic) { free(picfil); return 1; }
|
pic = (coltype *)calloc(xsiz,ysiz*sizeof(coltype)); if (!pic) { free(picfil); return 1; }
|
||||||
|
|
||||||
if (kprender(picfil,picfillen,(int)pic,xsiz*sizeof(coltype),xsiz,ysiz,0,0)) { free(picfil); free(pic); return -2; }
|
if (kprender(picfil,picfillen,(int)pic,xsiz*sizeof(coltype),xsiz,ysiz,0,0)) { free(picfil); free(pic); return -2; }
|
||||||
|
applypalmapsT((char *)pic,tsizx,tsizy,dapalnum);
|
||||||
for (y=0,j=0;y<tsizy;y++,j+=xsiz)
|
for (y=0,j=0;y<tsizy;y++,j+=xsiz)
|
||||||
{
|
{
|
||||||
coltype tcol;
|
coltype tcol;
|
||||||
|
@ -1559,6 +1592,18 @@ int gloadtile_hi(int dapic, int facen, hicreplctyp *hicr, int dameth, pthtyp *pt
|
||||||
if ((doalloc&3)==1) bglGenTextures(1,(GLuint*)&pth->glpic); //# of textures (make OpenGL allocate structure)
|
if ((doalloc&3)==1) bglGenTextures(1,(GLuint*)&pth->glpic); //# of textures (make OpenGL allocate structure)
|
||||||
bglBindTexture(GL_TEXTURE_2D,pth->glpic);
|
bglBindTexture(GL_TEXTURE_2D,pth->glpic);
|
||||||
|
|
||||||
|
if (dapalnum>=SPECPAL&&dapalnum<=REDPAL)
|
||||||
|
{
|
||||||
|
//_initprintf("%cLoaded palamp %d(%dx%d)",pth->palmap?'+':'-',dapalnum,xsiz,ysiz);
|
||||||
|
if (!pth->palmap)
|
||||||
|
{
|
||||||
|
pth->size=xsiz*ysiz;
|
||||||
|
pth->palmap=malloc(pth->size*4);
|
||||||
|
memcpy(pth->palmap,pic,pth->size*4);
|
||||||
|
}
|
||||||
|
cachefil=0;
|
||||||
|
//_initprintf("#%d\n",pth->palmap);
|
||||||
|
}
|
||||||
fixtransparency(pic,tsizx,tsizy,xsiz,ysiz,dameth);
|
fixtransparency(pic,tsizx,tsizy,xsiz,ysiz,dameth);
|
||||||
uploadtexture(doalloc,xsiz,ysiz,intexfmt,texfmt,pic,-1,tsizy,dameth);
|
uploadtexture(doalloc,xsiz,ysiz,intexfmt,texfmt,pic,-1,tsizy,dameth);
|
||||||
}
|
}
|
||||||
|
@ -1618,7 +1663,7 @@ int gloadtile_hi(int dapic, int facen, hicreplctyp *hicr, int dameth, pthtyp *pt
|
||||||
if (ysiz == pow2long[j]) { x |= 2; }
|
if (ysiz == pow2long[j]) { x |= 2; }
|
||||||
}
|
}
|
||||||
cachead.flags = (x!=3) | (hasalpha != 255 ? 2 : 0);
|
cachead.flags = (x!=3) | (hasalpha != 255 ? 2 : 0);
|
||||||
writexcache(fn, picfillen, dameth, effect, &cachead);
|
writexcache(fn, picfillen+(dapalnum<<8), dameth, effect, &cachead);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -1642,8 +1687,9 @@ void drawpoly(double *dpx, double *dpy, int n, int method)
|
||||||
int i, j, k, x, y, z, nn, ix0, ix1, mini, maxi, tsizx, tsizy, tsizxm1 = 0, tsizym1 = 0, ltsizy = 0;
|
int i, j, k, x, y, z, nn, ix0, ix1, mini, maxi, tsizx, tsizy, tsizxm1 = 0, tsizym1 = 0, ltsizy = 0;
|
||||||
int xx, yy, xi, d0, u0, v0, d1, u1, v1, xmodnice = 0, ymulnice = 0, dorot;
|
int xx, yy, xi, d0, u0, v0, d1, u1, v1, xmodnice = 0, ymulnice = 0, dorot;
|
||||||
char dacol = 0, *walptr, *palptr = NULL, *vidp, *vide;
|
char dacol = 0, *walptr, *palptr = NULL, *vidp, *vide;
|
||||||
|
GLfloat pc1[4];
|
||||||
#ifdef USE_OPENGL
|
#ifdef USE_OPENGL
|
||||||
pthtyp *pth, *detailpth, *glowpth;
|
pthtyp *pth, *detailpth, *glowpth, *palpth;
|
||||||
int texunits = GL_TEXTURE0_ARB;
|
int texunits = GL_TEXTURE0_ARB;
|
||||||
#endif
|
#endif
|
||||||
// backup of the n for possible redrawing of fullbright
|
// backup of the n for possible redrawing of fullbright
|
||||||
|
@ -1730,6 +1776,11 @@ void drawpoly(double *dpx, double *dpy, int n, int method)
|
||||||
{
|
{
|
||||||
float hackscx, hackscy;
|
float hackscx, hackscy;
|
||||||
|
|
||||||
|
int pal1;
|
||||||
|
for (pal1=SPECPAL;pal1<=REDPAL;pal1++)
|
||||||
|
if (hicfindsubst(globalpicnum, pal1, 0))
|
||||||
|
gltexcache(globalpicnum, pal1, method&(~3));
|
||||||
|
|
||||||
if (skyclamphack) method |= 4;
|
if (skyclamphack) method |= 4;
|
||||||
pth = gltexcache(globalpicnum,globalpal,method&(~3));
|
pth = gltexcache(globalpicnum,globalpal,method&(~3));
|
||||||
|
|
||||||
|
@ -4321,7 +4372,7 @@ void polymost_drawsprite(int snum)
|
||||||
|
|
||||||
while (rendmode >= 3 && !(spriteext[tspr->owner].flags&SPREXT_NOTMD))
|
while (rendmode >= 3 && !(spriteext[tspr->owner].flags&SPREXT_NOTMD))
|
||||||
{
|
{
|
||||||
if (usemodels && tile2model[tspr->picnum].modelid >= 0 && tile2model[tspr->picnum].framenum >= 0)
|
if (usemodels && tile2model[Ptile2tile(tspr->picnum,tspr->pal)].modelid >= 0 && tile2model[Ptile2tile(tspr->picnum,tspr->pal)].framenum >= 0)
|
||||||
{
|
{
|
||||||
if (mddraw(tspr)) return;
|
if (mddraw(tspr)) return;
|
||||||
break; // else, render as flat sprite
|
break; // else, render as flat sprite
|
||||||
|
@ -4345,6 +4396,18 @@ void polymost_drawsprite(int snum)
|
||||||
bglPolygonOffset(-curpolygonoffset, -curpolygonoffset);
|
bglPolygonOffset(-curpolygonoffset, -curpolygonoffset);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
int posx=tspr->x,posy=tspr->y;
|
||||||
|
if (spriteext[tspr->owner].flags&SPREXT_AWAY1)
|
||||||
|
{
|
||||||
|
posx+=(sintable[(tspr->ang+512)&2047]>>13);
|
||||||
|
posy+=(sintable[(tspr->ang)&2047]>>13);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
if (spriteext[tspr->owner].flags&SPREXT_AWAY2)
|
||||||
|
{
|
||||||
|
posx-=(sintable[(tspr->ang+512)&2047]>>13);
|
||||||
|
posy-=(sintable[(tspr->ang)&2047]>>13);
|
||||||
|
}
|
||||||
|
|
||||||
switch ((globalorientation>>4)&3)
|
switch ((globalorientation>>4)&3)
|
||||||
{
|
{
|
||||||
|
@ -4402,8 +4465,8 @@ void polymost_drawsprite(int snum)
|
||||||
xv = (float)tspr->xrepeat * (float)sintable[(tspr->ang)&2047] / 65536.0;
|
xv = (float)tspr->xrepeat * (float)sintable[(tspr->ang)&2047] / 65536.0;
|
||||||
yv = (float)tspr->xrepeat * (float)sintable[(tspr->ang+1536)&2047] / 65536.0;
|
yv = (float)tspr->xrepeat * (float)sintable[(tspr->ang+1536)&2047] / 65536.0;
|
||||||
f = (float)(tilesizx[globalpicnum]>>1) + (float)xoff;
|
f = (float)(tilesizx[globalpicnum]>>1) + (float)xoff;
|
||||||
x0 = (float)(tspr->x-globalposx) - xv*f; x1 = xv*(float)tilesizx[globalpicnum] + x0;
|
x0 = (float)(posx-globalposx) - xv*f; x1 = xv*(float)tilesizx[globalpicnum] + x0;
|
||||||
y0 = (float)(tspr->y-globalposy) - yv*f; y1 = yv*(float)tilesizx[globalpicnum] + y0;
|
y0 = (float)(posy-globalposy) - yv*f; y1 = yv*(float)tilesizx[globalpicnum] + y0;
|
||||||
|
|
||||||
yp0 = x0*gcosang2 + y0*gsinang2;
|
yp0 = x0*gcosang2 + y0*gsinang2;
|
||||||
yp1 = x1*gcosang2 + y1*gsinang2;
|
yp1 = x1*gcosang2 + y1*gsinang2;
|
||||||
|
@ -4633,7 +4696,7 @@ void polymost_dorotatesprite(int sx, int sy, int z, short a, short picnum,
|
||||||
#ifdef USE_OPENGL
|
#ifdef USE_OPENGL
|
||||||
if (rendmode >= 3 && usemodels && hudmem[(dastat&4)>>2][picnum].angadd)
|
if (rendmode >= 3 && usemodels && hudmem[(dastat&4)>>2][picnum].angadd)
|
||||||
{
|
{
|
||||||
if ((tile2model[picnum].modelid >= 0) && (tile2model[picnum].framenum >= 0))
|
if ((tile2model[Ptile2tile(picnum,dapalnum)].modelid >= 0) && (tile2model[Ptile2tile(picnum,dapalnum)].framenum >= 0))
|
||||||
{
|
{
|
||||||
spritetype tspr;
|
spritetype tspr;
|
||||||
memset(&tspr,0,sizeof(spritetype));
|
memset(&tspr,0,sizeof(spritetype));
|
||||||
|
@ -5669,12 +5732,17 @@ void polymost_precache(int dapicnum, int dapalnum, int datype)
|
||||||
|
|
||||||
//OSD_Printf("precached %d %d type %d\n", dapicnum, dapalnum, datype);
|
//OSD_Printf("precached %d %d type %d\n", dapicnum, dapalnum, datype);
|
||||||
hicprecaching = 1;
|
hicprecaching = 1;
|
||||||
|
int pal1;
|
||||||
|
for (pal1=SPECPAL;pal1<=REDPAL;pal1++)
|
||||||
|
if (hicfindsubst(globalpicnum, pal1, 0))
|
||||||
|
gltexcache(globalpicnum, pal1, (datype & 1) << 2);
|
||||||
|
|
||||||
gltexcache(dapicnum, dapalnum, (datype & 1) << 2);
|
gltexcache(dapicnum, dapalnum, (datype & 1) << 2);
|
||||||
hicprecaching = 0;
|
hicprecaching = 0;
|
||||||
|
|
||||||
if (datype == 0) return;
|
if (datype == 0) return;
|
||||||
|
|
||||||
mid = md_tilehasmodel(dapicnum);
|
mid = md_tilehasmodel(dapicnum,dapalnum);
|
||||||
if (mid < 0 || models[mid]->mdnum < 2) return;
|
if (mid < 0 || models[mid]->mdnum < 2) return;
|
||||||
|
|
||||||
{
|
{
|
||||||
|
@ -5684,8 +5752,12 @@ void polymost_precache(int dapicnum, int dapalnum, int datype)
|
||||||
j = ((md3model *)models[mid])->head.numsurfs;
|
j = ((md3model *)models[mid])->head.numsurfs;
|
||||||
|
|
||||||
for (i=0;i<=j;i++)
|
for (i=0;i<=j;i++)
|
||||||
|
{
|
||||||
|
int pal1;
|
||||||
|
for (pal1=SPECPAL;pal1<=REDPAL;pal1++)mdloadskin((md2model*)models[mid],0,pal1,i);
|
||||||
mdloadskin((md2model*)models[mid], 0, dapalnum, i);
|
mdloadskin((md2model*)models[mid], 0, dapalnum, i);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -554,6 +554,16 @@ int ssp(int i,unsigned int cliptype) //The set sprite function
|
||||||
return (movetype==0);
|
return (movetype==0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#undef deletesprite
|
||||||
|
void deletespriteEVENT(int s)
|
||||||
|
{
|
||||||
|
SetGameVarID(g_iReturnVarID,0, -1, -1);
|
||||||
|
OnEvent(EVENT_KILLIT, s, myconnectindex, -1);
|
||||||
|
if (!GetGameVarID(g_iReturnVarID, -1, -1))deletesprite(s);
|
||||||
|
}
|
||||||
|
#define deletesprite deletespriteEVENT
|
||||||
|
|
||||||
void insertspriteq(int i)
|
void insertspriteq(int i)
|
||||||
{
|
{
|
||||||
if (spriteqamount > 0)
|
if (spriteqamount > 0)
|
||||||
|
@ -2573,7 +2583,7 @@ static void moveweapons(void)
|
||||||
s->xvel=s->xvel>>1;
|
s->xvel=s->xvel>>1;
|
||||||
s->zvel=s->zvel>>1;
|
s->zvel=s->zvel>>1;
|
||||||
}
|
}
|
||||||
goto BOLT;
|
if (!(hittype[i].projectile.workslike & PROJECTILE_FLAG_FORCEIMPACT))goto BOLT;
|
||||||
}
|
}
|
||||||
|
|
||||||
checkhitsprite(j,i);
|
checkhitsprite(j,i);
|
||||||
|
@ -2626,9 +2636,10 @@ static void moveweapons(void)
|
||||||
if (hittype[i].projectile.isound > -1)
|
if (hittype[i].projectile.isound > -1)
|
||||||
spritesound(hittype[i].projectile.isound,i);
|
spritesound(hittype[i].projectile.isound,i);
|
||||||
|
|
||||||
KILLIT(i);
|
if (!(hittype[i].projectile.workslike & PROJECTILE_FLAG_FORCEIMPACT))KILLIT(i);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
if (hittype[i].projectile.workslike & PROJECTILE_FLAG_FORCEIMPACT)goto BOLT;
|
||||||
|
|
||||||
}
|
}
|
||||||
else if ((j&49152) == 32768)
|
else if ((j&49152) == 32768)
|
||||||
|
@ -3286,7 +3297,7 @@ static void movetransports(void)
|
||||||
|
|
||||||
case 1:
|
case 1:
|
||||||
if ((sprite[j].picnum == SHARK) || (sprite[j].picnum == COMMANDER) || (sprite[j].picnum == OCTABRAIN)
|
if ((sprite[j].picnum == SHARK) || (sprite[j].picnum == COMMANDER) || (sprite[j].picnum == OCTABRAIN)
|
||||||
|| ((sprite[j].picnum >= GREENSLIME) && (sprite[j].picnum >= GREENSLIME+7)))
|
|| ((sprite[j].picnum >= GREENSLIME) && (sprite[j].picnum <= GREENSLIME+7)))
|
||||||
{
|
{
|
||||||
if (sprite[j].extra > 0)
|
if (sprite[j].extra > 0)
|
||||||
goto JBOLT;
|
goto JBOLT;
|
||||||
|
|
|
@ -6143,7 +6143,7 @@ void ExtAnalyzeSprites(void)
|
||||||
// else tspr->cstat&=32767;
|
// else tspr->cstat&=32767;
|
||||||
|
|
||||||
#if defined(USE_OPENGL) && defined(POLYMOST)
|
#if defined(USE_OPENGL) && defined(POLYMOST)
|
||||||
if (!usemodels || md_tilehasmodel(tspr->picnum) < 0)
|
if (!usemodels || md_tilehasmodel(tspr->picnum,tspr->pal) < 0)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
if (frames!=0)
|
if (frames!=0)
|
||||||
|
|
|
@ -264,6 +264,9 @@ enum weapons {
|
||||||
#define ESCESCAPE if(KB_KeyPressed( sc_Escape ) ) gameexit(" ");
|
#define ESCESCAPE if(KB_KeyPressed( sc_Escape ) ) gameexit(" ");
|
||||||
|
|
||||||
#define IFWITHIN(B,E) if((PN)>=(B) && (PN)<=(E))
|
#define IFWITHIN(B,E) if((PN)>=(B) && (PN)<=(E))
|
||||||
|
|
||||||
|
#define deletesprite deletespriteEVENT
|
||||||
|
void deletespriteEVENT(int s);
|
||||||
#define KILLIT(KX) {deletesprite(KX);goto BOLT;}
|
#define KILLIT(KX) {deletesprite(KX);goto BOLT;}
|
||||||
|
|
||||||
|
|
||||||
|
@ -781,7 +784,8 @@ enum events {
|
||||||
EVENT_USE,
|
EVENT_USE,
|
||||||
EVENT_PROCESSINPUT,
|
EVENT_PROCESSINPUT,
|
||||||
EVENT_FAKEDOMOVETHINGS,
|
EVENT_FAKEDOMOVETHINGS,
|
||||||
EVENT_DISPLAYROOMS
|
EVENT_DISPLAYROOMS,
|
||||||
|
EVENT_KILLIT
|
||||||
};
|
};
|
||||||
|
|
||||||
// store global game definitions
|
// store global game definitions
|
||||||
|
@ -915,7 +919,8 @@ enum projectileflags {
|
||||||
PROJECTILE_FLAG_EXPLODEONTIMER = 16384,
|
PROJECTILE_FLAG_EXPLODEONTIMER = 16384,
|
||||||
PROJECTILE_FLAG_RPG_IMPACT = 32768,
|
PROJECTILE_FLAG_RPG_IMPACT = 32768,
|
||||||
PROJECTILE_FLAG_RADIUS_PICNUM = 65536,
|
PROJECTILE_FLAG_RADIUS_PICNUM = 65536,
|
||||||
PROJECTILE_FLAG_ACCURATE_AUTOAIM = 131072
|
PROJECTILE_FLAG_ACCURATE_AUTOAIM = 131072,
|
||||||
|
PROJECTILE_FLAG_FORCEIMPACT = 262144
|
||||||
};
|
};
|
||||||
|
|
||||||
extern proj_struct projectile[MAXTILES], defaultprojectile[MAXTILES];
|
extern proj_struct projectile[MAXTILES], defaultprojectile[MAXTILES];
|
||||||
|
|
|
@ -197,6 +197,8 @@ extern void fadepal(int r, int g, int b, int start, int end, int step);
|
||||||
|
|
||||||
extern inline int minitextshade(int x,int y,const char *t,int s,int p,int sb);
|
extern inline int minitextshade(int x,int y,const char *t,int s,int p,int sb);
|
||||||
extern inline int gametext_(int small, int starttile, int x,int y,const char *t,int s,int p,int orientation,int x1, int y1, int x2, int y2);
|
extern inline int gametext_(int small, int starttile, int x,int y,const char *t,int s,int p,int orientation,int x1, int y1, int x2, int y2);
|
||||||
|
extern inline int gametext_z(int small, int starttile, int x,int y,const char *t,int s,int p,int orientation,int x1, int y1, int x2, int y2,int z);
|
||||||
|
extern void txdigitalnumberz(int starttile, int x,int y,int n,int s,int pal,int cs,int x1, int y1, int x2, int y2, int z);
|
||||||
extern void txdigitalnumber(int starttile, int x,int y,int n,int s,int pal,int cs,int x1, int y1, int x2, int y2);
|
extern void txdigitalnumber(int starttile, int x,int y,int n,int s,int pal,int cs,int x1, int y1, int x2, int y2);
|
||||||
extern void myosx(int x,int y,int tilenum,int shade,int orientation);
|
extern void myosx(int x,int y,int tilenum,int shade,int orientation);
|
||||||
extern void myospalx(int x,int y,int tilenum,int shade,int orientation,int p);
|
extern void myospalx(int x,int y,int tilenum,int shade,int orientation,int p);
|
||||||
|
|
|
@ -288,8 +288,12 @@ const char *stripcolorcodes(const char *t)
|
||||||
colstrip[i] = '\0';
|
colstrip[i] = '\0';
|
||||||
return(colstrip);
|
return(colstrip);
|
||||||
}
|
}
|
||||||
|
|
||||||
int gametext_(int small, int starttile, int x,int y,const char *t,int s,int p,int orientation,int x1, int y1, int x2, int y2)
|
int gametext_(int small, int starttile, int x,int y,const char *t,int s,int p,int orientation,int x1, int y1, int x2, int y2)
|
||||||
|
{
|
||||||
|
return gametext_z(small,starttile,x,y,t,s,p,orientation,x1,y1,x2,y2,65536);
|
||||||
|
}
|
||||||
|
|
||||||
|
int gametext_z(int small, int starttile, int x,int y,const char *t,int s,int p,int orientation,int x1, int y1, int x2, int y2, int z)
|
||||||
{
|
{
|
||||||
int ac,newx,oldx=x;
|
int ac,newx,oldx=x;
|
||||||
char centre, *oldt;
|
char centre, *oldt;
|
||||||
|
@ -313,7 +317,7 @@ int gametext_(int small, int starttile, int x,int y,const char *t,int s,int p,in
|
||||||
}
|
}
|
||||||
if (*t == 32)
|
if (*t == 32)
|
||||||
{
|
{
|
||||||
newx+=5;
|
newx+=5*z/65536;
|
||||||
t++;
|
t++;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -322,8 +326,8 @@ int gametext_(int small, int starttile, int x,int y,const char *t,int s,int p,in
|
||||||
if (ac < starttile || ac > (starttile + 93)) break;
|
if (ac < starttile || ac > (starttile + 93)) break;
|
||||||
|
|
||||||
if (*t >= '0' && *t <= '9')
|
if (*t >= '0' && *t <= '9')
|
||||||
newx += 8;
|
newx += 8*z/65536;
|
||||||
else newx += tilesizx[ac];
|
else newx += tilesizx[ac]*z/65536;
|
||||||
t++;
|
t++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -354,7 +358,7 @@ int gametext_(int small, int starttile, int x,int y,const char *t,int s,int p,in
|
||||||
}
|
}
|
||||||
if (*t == 32)
|
if (*t == 32)
|
||||||
{
|
{
|
||||||
x+=5;
|
x+=5*z/65536;
|
||||||
t++;
|
t++;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -363,11 +367,11 @@ int gametext_(int small, int starttile, int x,int y,const char *t,int s,int p,in
|
||||||
if (ac < starttile || ac > (starttile + 93))
|
if (ac < starttile || ac > (starttile + 93))
|
||||||
break;
|
break;
|
||||||
|
|
||||||
rotatesprite(x<<16,(y<<16)+(small?ud.config.ScreenHeight<<15:0),65536,0,ac,s,p,small?(8|16):(2|orientation),x1,y1,x2,y2);
|
rotatesprite(x<<16,(y<<16)+(small?ud.config.ScreenHeight<<15:0),z,0,ac,s,p,small?(8|16):(2|orientation),x1,y1,x2,y2);
|
||||||
if ((*t >= '0' && *t <= '9'))
|
if ((*t >= '0' && *t <= '9'))
|
||||||
x += 8;
|
x += 8*z/65536;
|
||||||
else x += tilesizx[ac];//(tilesizx[ac]>>small);
|
else x += tilesizx[ac]*z/65536;//(tilesizx[ac]>>small);
|
||||||
if (t-oldt >= (signed)TEXTWRAPLEN-!small) oldt = (char *)t, x = oldx, y+=8;
|
if (t-oldt >= (signed)TEXTWRAPLEN-!small) oldt = (char *)t, x = oldx, y+=8*z/65536;
|
||||||
t++;
|
t++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -519,7 +523,7 @@ void getpackets(void)
|
||||||
OSD_DispatchQueued();
|
OSD_DispatchQueued();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (qe == 0 && KB_KeyPressed(sc_LeftControl) && KB_KeyPressed(sc_LeftAlt) && KB_KeyPressed(sc_Delete))
|
if (qe == 0 && KB_KeyPressed(sc_LeftControl) && KB_KeyPressed(sc_LeftAlt) && (KB_KeyPressed(sc_Delete)||KB_KeyPressed(sc_End)))
|
||||||
{
|
{
|
||||||
qe = 1;
|
qe = 1;
|
||||||
gameexit("Quick Exit.");
|
gameexit("Quick Exit.");
|
||||||
|
@ -1655,6 +1659,7 @@ static void weaponnum999(char ind,int x,int y,int num1, int num2,char ha)
|
||||||
rotatesprite(sbarx(x+21),sbary(y),sbarsc(65536L),0,THREEBYFIVE+dabuf[1]-'0',ha,0,10,0,0,xdim-1,ydim-1);
|
rotatesprite(sbarx(x+21),sbary(y),sbarsc(65536L),0,THREEBYFIVE+dabuf[1]-'0',ha,0,10,0,0,xdim-1,ydim-1);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
rotatesprite(sbarx(x+25),sbary(y),sbarsc(65536L),0,THREEBYFIVE+dabuf[0]-'0',ha,0,10,0,0,xdim-1,ydim-1);
|
rotatesprite(sbarx(x+25),sbary(y),sbarsc(65536L),0,THREEBYFIVE+dabuf[0]-'0',ha,0,10,0,0,xdim-1,ydim-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1770,7 +1775,7 @@ static void digitalnumber(int x,int y,int n,char s,char cs)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void txdigitalnumber(int starttile, int x,int y,int n,int s,int pal,int cs,int x1, int y1, int x2, int y2)
|
void txdigitalnumberz(int starttile, int x,int y,int n,int s,int pal,int cs,int x1, int y1, int x2, int y2, int z)
|
||||||
{
|
{
|
||||||
int i, j = 0, k, p, c;
|
int i, j = 0, k, p, c;
|
||||||
char b[10];
|
char b[10];
|
||||||
|
@ -1782,7 +1787,7 @@ void txdigitalnumber(int starttile, int x,int y,int n,int s,int pal,int cs,int x
|
||||||
for (k=0;k<i;k++)
|
for (k=0;k<i;k++)
|
||||||
{
|
{
|
||||||
p = starttile+*(b+k)-'0';
|
p = starttile+*(b+k)-'0';
|
||||||
j += tilesizx[p]+1;
|
j += (tilesizx[p]+1)*z/65536;
|
||||||
}
|
}
|
||||||
c = x-(j>>1);
|
c = x-(j>>1);
|
||||||
|
|
||||||
|
@ -1790,12 +1795,16 @@ void txdigitalnumber(int starttile, int x,int y,int n,int s,int pal,int cs,int x
|
||||||
for (k=0;k<i;k++)
|
for (k=0;k<i;k++)
|
||||||
{
|
{
|
||||||
p = starttile+*(b+k)-'0';
|
p = starttile+*(b+k)-'0';
|
||||||
rotatesprite((c+j)<<16,y<<16,65536L,0,p,s,pal,2|cs,x1,y1,x2,y2);
|
rotatesprite((c+j)<<16,y<<16,z,0,p,s,pal,2|cs,x1,y1,x2,y2);
|
||||||
/* rotatesprite((c+j)<<16,y<<16,65536L,0,p,s,pal,cs,0,0,xdim-1,ydim-1);
|
/* rotatesprite((c+j)<<16,y<<16,65536L,0,p,s,pal,cs,0,0,xdim-1,ydim-1);
|
||||||
rotatesprite(x<<16,y<<16,32768L,a,tilenum,shade,p,2|orientation,windowx1,windowy1,windowx2,windowy2);*/
|
rotatesprite(x<<16,y<<16,32768L,a,tilenum,shade,p,2|orientation,windowx1,windowy1,windowx2,windowy2);*/
|
||||||
j += tilesizx[p]+1;
|
j += (tilesizx[p]+1)*z/65536;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
void txdigitalnumber(int starttile, int x,int y,int n,int s,int pal,int cs,int x1, int y1, int x2, int y2)
|
||||||
|
{
|
||||||
|
txdigitalnumberz(starttile,x,y,n,s,pal,cs,x1,y1,x2,y2,65536);
|
||||||
|
}
|
||||||
|
|
||||||
static void displayinventory(player_struct *p)
|
static void displayinventory(player_struct *p)
|
||||||
{
|
{
|
||||||
|
@ -6265,7 +6274,7 @@ void animatesprites(int x,int y,int a,int smoothratio)
|
||||||
continue;
|
continue;
|
||||||
case CHAIR3__STATIC:
|
case CHAIR3__STATIC:
|
||||||
#if defined(POLYMOST) && defined(USE_OPENGL)
|
#if defined(POLYMOST) && defined(USE_OPENGL)
|
||||||
if (bpp > 8 && usemodels && md_tilehasmodel(t->picnum) >= 0)
|
if (bpp > 8 && usemodels && md_tilehasmodel(t->picnum,t->pal) >= 0 && !(spriteext[i].flags&SPREXT_NOTMD))
|
||||||
{
|
{
|
||||||
t->cstat &= ~4;
|
t->cstat &= ~4;
|
||||||
break;
|
break;
|
||||||
|
@ -6546,8 +6555,9 @@ void animatesprites(int x,int y,int a,int smoothratio)
|
||||||
t->picnum = GROWSPARK+((totalclock>>4)&3);
|
t->picnum = GROWSPARK+((totalclock>>4)&3);
|
||||||
break;
|
break;
|
||||||
case RPG__STATIC:
|
case RPG__STATIC:
|
||||||
|
|
||||||
#if defined(POLYMOST) && defined(USE_OPENGL)
|
#if defined(POLYMOST) && defined(USE_OPENGL)
|
||||||
if (bpp > 8 && usemodels && md_tilehasmodel(t->picnum) >= 0)
|
if (bpp > 8 && usemodels && md_tilehasmodel(t->picnum,t->pal) >= 0 && !(spriteext[i].flags&SPREXT_NOTMD))
|
||||||
{
|
{
|
||||||
t->cstat &= ~4;
|
t->cstat &= ~4;
|
||||||
break;
|
break;
|
||||||
|
@ -6565,8 +6575,9 @@ void animatesprites(int x,int y,int a,int smoothratio)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case RECON__STATIC:
|
case RECON__STATIC:
|
||||||
|
|
||||||
#if defined(POLYMOST) && defined(USE_OPENGL)
|
#if defined(POLYMOST) && defined(USE_OPENGL)
|
||||||
if (bpp > 8 && usemodels && md_tilehasmodel(t->picnum) >= 0)
|
if (bpp > 8 && usemodels && md_tilehasmodel(t->picnum,t->pal) >= 0 && !(spriteext[i].flags&SPREXT_NOTMD))
|
||||||
{
|
{
|
||||||
t->cstat &= ~4;
|
t->cstat &= ~4;
|
||||||
break;
|
break;
|
||||||
|
@ -6666,8 +6677,9 @@ void animatesprites(int x,int y,int a,int smoothratio)
|
||||||
|
|
||||||
if (s->owner == -1)
|
if (s->owner == -1)
|
||||||
{
|
{
|
||||||
|
|
||||||
#if defined(POLYMOST) && defined(USE_OPENGL)
|
#if defined(POLYMOST) && defined(USE_OPENGL)
|
||||||
if (bpp > 8 && usemodels && md_tilehasmodel(s->picnum) >= 0)
|
if (bpp > 8 && usemodels && md_tilehasmodel(s->picnum,t->pal) >= 0 && !(spriteext[i].flags&SPREXT_NOTMD))
|
||||||
{
|
{
|
||||||
k = 0;
|
k = 0;
|
||||||
t->cstat &= ~4;
|
t->cstat &= ~4;
|
||||||
|
@ -6789,8 +6801,9 @@ PALONLY:
|
||||||
if (t4)
|
if (t4)
|
||||||
{
|
{
|
||||||
l = *(int *)(t4+8);
|
l = *(int *)(t4+8);
|
||||||
|
|
||||||
#if defined(POLYMOST) && defined(USE_OPENGL)
|
#if defined(POLYMOST) && defined(USE_OPENGL)
|
||||||
if (bpp > 8 && usemodels && md_tilehasmodel(s->picnum) >= 0)
|
if (bpp > 8 && usemodels && md_tilehasmodel(s->picnum,t->pal) >= 0 && !(spriteext[i].flags&SPREXT_NOTMD))
|
||||||
{
|
{
|
||||||
k = 0;
|
k = 0;
|
||||||
t->cstat &= ~4;
|
t->cstat &= ~4;
|
||||||
|
@ -6895,13 +6908,13 @@ PALONLY:
|
||||||
tsprite[spritesortcnt].z = daz;
|
tsprite[spritesortcnt].z = daz;
|
||||||
xrep = tsprite[spritesortcnt].xrepeat;// - (klabs(daz-t->z)>>11);
|
xrep = tsprite[spritesortcnt].xrepeat;// - (klabs(daz-t->z)>>11);
|
||||||
tsprite[spritesortcnt].xrepeat = xrep;
|
tsprite[spritesortcnt].xrepeat = xrep;
|
||||||
tsprite[spritesortcnt].pal = 4;
|
// tsprite[spritesortcnt].pal = 4; (shadow will have the same model as its actor)
|
||||||
|
|
||||||
yrep = tsprite[spritesortcnt].yrepeat;// - (klabs(daz-t->z)>>11);
|
yrep = tsprite[spritesortcnt].yrepeat;// - (klabs(daz-t->z)>>11);
|
||||||
tsprite[spritesortcnt].yrepeat = yrep;
|
tsprite[spritesortcnt].yrepeat = yrep;
|
||||||
|
|
||||||
#if defined(POLYMOST) && defined(USE_OPENGL)
|
#if defined(POLYMOST) && defined(USE_OPENGL)
|
||||||
if (bpp > 8 && usemodels && md_tilehasmodel(t->picnum) >= 0)
|
if (bpp > 8 && usemodels && md_tilehasmodel(t->picnum,t->pal) >= 0)
|
||||||
{
|
{
|
||||||
tsprite[spritesortcnt].yrepeat = 0;
|
tsprite[spritesortcnt].yrepeat = 0;
|
||||||
// 512:trans reverse
|
// 512:trans reverse
|
||||||
|
@ -6964,7 +6977,7 @@ PALONLY:
|
||||||
break;
|
break;
|
||||||
case PLAYERONWATER__STATIC:
|
case PLAYERONWATER__STATIC:
|
||||||
#if defined(POLYMOST) && defined(USE_OPENGL)
|
#if defined(POLYMOST) && defined(USE_OPENGL)
|
||||||
if (bpp > 8 && usemodels && md_tilehasmodel(s->picnum) >= 0)
|
if (bpp > 8 && usemodels && md_tilehasmodel(s->picnum,s->pal) >= 0 && !(spriteext[i].flags&SPREXT_NOTMD))
|
||||||
{
|
{
|
||||||
k = 0;
|
k = 0;
|
||||||
t->cstat &= ~4;
|
t->cstat &= ~4;
|
||||||
|
@ -7028,7 +7041,7 @@ PALONLY:
|
||||||
case RAT__STATIC:
|
case RAT__STATIC:
|
||||||
|
|
||||||
#if defined(POLYMOST) && defined(USE_OPENGL)
|
#if defined(POLYMOST) && defined(USE_OPENGL)
|
||||||
if (bpp > 8 && usemodels && md_tilehasmodel(s->picnum) >= 0)
|
if (bpp > 8 && usemodels && md_tilehasmodel(s->picnum,s->pal) >= 0 && !(spriteext[i].flags&SPREXT_NOTMD))
|
||||||
{
|
{
|
||||||
t->cstat &= ~4;
|
t->cstat &= ~4;
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -436,8 +436,11 @@ static const char *keyw[] =
|
||||||
"headspritesect", // 306
|
"headspritesect", // 306
|
||||||
"prevspritesect", // 307
|
"prevspritesect", // 307
|
||||||
"nextspritesect", // 308
|
"nextspritesect", // 308
|
||||||
"spritenopal", // 309
|
"getkeyname", // 309
|
||||||
"getkeyname", // 310
|
"qsubstr", // 310
|
||||||
|
"gametextz", // 311
|
||||||
|
"digitalnumberz", // 312
|
||||||
|
"spritenopal", // 313
|
||||||
"<null>"
|
"<null>"
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1371,7 +1374,9 @@ static void transvartype(int type)
|
||||||
if (!(error || warning) && g_ScriptDebug)
|
if (!(error || warning) && g_ScriptDebug)
|
||||||
initprintf("%s:%d: debug: accepted constant %d in place of gamevar.\n",compilefile,line_number,atol(textptr));
|
initprintf("%s:%d: debug: accepted constant %d in place of gamevar.\n",compilefile,line_number,atol(textptr));
|
||||||
*scriptptr++=MAXGAMEVARS;
|
*scriptptr++=MAXGAMEVARS;
|
||||||
*scriptptr++=atol(textptr);
|
if (tolower(textptr[1])=='x')sscanf(textptr+2,"%x",scriptptr);else
|
||||||
|
*scriptptr=atol(textptr);
|
||||||
|
scriptptr++;
|
||||||
getlabel();
|
getlabel();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1544,6 +1549,7 @@ static int transnum(int type)
|
||||||
}
|
}
|
||||||
if (!(error || warning) && g_ScriptDebug > 1)
|
if (!(error || warning) && g_ScriptDebug > 1)
|
||||||
initprintf("%s:%d: debug: accepted constant %d.\n",compilefile,line_number,atol(textptr));
|
initprintf("%s:%d: debug: accepted constant %d.\n",compilefile,line_number,atol(textptr));
|
||||||
|
if (tolower(textptr[1])=='x')sscanf(textptr+2,"%x",scriptptr);else
|
||||||
*scriptptr = atol(textptr);
|
*scriptptr = atol(textptr);
|
||||||
scriptptr++;
|
scriptptr++;
|
||||||
|
|
||||||
|
@ -1731,8 +1737,8 @@ static int parsecommand(void)
|
||||||
textptr++;
|
textptr++;
|
||||||
|
|
||||||
// get the ID of the DEF
|
// get the ID of the DEF
|
||||||
if (tw == CON_SETTHISPROJECTILE)
|
// if (tw == CON_SETTHISPROJECTILE)
|
||||||
labelsonly = 1;
|
// labelsonly = 1;
|
||||||
transvar();
|
transvar();
|
||||||
labelsonly = 0;
|
labelsonly = 0;
|
||||||
// now get name of .xxx
|
// now get name of .xxx
|
||||||
|
@ -1837,7 +1843,12 @@ static int parsecommand(void)
|
||||||
//Bsprintf(g_szBuf,"Adding GameVar='%s', val=%l, flags=%lX",label+(labelcnt<<6),
|
//Bsprintf(g_szBuf,"Adding GameVar='%s', val=%l, flags=%lX",label+(labelcnt<<6),
|
||||||
// *(scriptptr-2), *(scriptptr-1));
|
// *(scriptptr-2), *(scriptptr-1));
|
||||||
//AddLog(g_szBuf);
|
//AddLog(g_szBuf);
|
||||||
|
if ((*(scriptptr-1)&GAMEVAR_FLAG_USER_MASK)==3)
|
||||||
|
{
|
||||||
|
warning++;
|
||||||
|
*(scriptptr-1)^=GAMEVAR_FLAG_PERPLAYER;
|
||||||
|
ReportError(WARNING_BADGAMEVAR);
|
||||||
|
}
|
||||||
AddGameVar(label+(labelcnt<<6),*(scriptptr-2),
|
AddGameVar(label+(labelcnt<<6),*(scriptptr-2),
|
||||||
(*(scriptptr-1))
|
(*(scriptptr-1))
|
||||||
// can't define default or secret
|
// can't define default or secret
|
||||||
|
@ -2320,7 +2331,7 @@ static int parsecommand(void)
|
||||||
j++;
|
j++;
|
||||||
}
|
}
|
||||||
parsing_item_name[j] = 0;
|
parsing_item_name[j] = 0;
|
||||||
labelsonly = 1;
|
// labelsonly = 1;
|
||||||
transnum(LABEL_DEFINE);
|
transnum(LABEL_DEFINE);
|
||||||
labelsonly = 0;
|
labelsonly = 0;
|
||||||
scriptptr--;
|
scriptptr--;
|
||||||
|
@ -2589,7 +2600,7 @@ static int parsecommand(void)
|
||||||
textptr++;
|
textptr++;
|
||||||
|
|
||||||
// get the ID of the DEF
|
// get the ID of the DEF
|
||||||
labelsonly = 1;
|
// labelsonly = 1;
|
||||||
transvar();
|
transvar();
|
||||||
labelsonly = 0;
|
labelsonly = 0;
|
||||||
// now get name of .xxx
|
// now get name of .xxx
|
||||||
|
@ -2720,7 +2731,7 @@ static int parsecommand(void)
|
||||||
textptr++;
|
textptr++;
|
||||||
|
|
||||||
// get the ID of the DEF
|
// get the ID of the DEF
|
||||||
labelsonly = 1;
|
// labelsonly = 1;
|
||||||
transvar();
|
transvar();
|
||||||
labelsonly = 0;
|
labelsonly = 0;
|
||||||
// now get name of .xxx
|
// now get name of .xxx
|
||||||
|
@ -2783,7 +2794,7 @@ static int parsecommand(void)
|
||||||
textptr++;
|
textptr++;
|
||||||
|
|
||||||
// get the ID of the DEF
|
// get the ID of the DEF
|
||||||
labelsonly = 1;
|
// labelsonly = 1;
|
||||||
transvar();
|
transvar();
|
||||||
labelsonly = 0;
|
labelsonly = 0;
|
||||||
// now get name of .xxx
|
// now get name of .xxx
|
||||||
|
@ -2860,7 +2871,7 @@ static int parsecommand(void)
|
||||||
textptr++;
|
textptr++;
|
||||||
|
|
||||||
// get the ID of the DEF
|
// get the ID of the DEF
|
||||||
labelsonly = 1;
|
// labelsonly = 1;
|
||||||
transvar();
|
transvar();
|
||||||
labelsonly = 0;
|
labelsonly = 0;
|
||||||
// now get name of .xxx
|
// now get name of .xxx
|
||||||
|
@ -2973,7 +2984,7 @@ static int parsecommand(void)
|
||||||
textptr++;
|
textptr++;
|
||||||
|
|
||||||
// get the ID of the DEF
|
// get the ID of the DEF
|
||||||
labelsonly = 1;
|
// labelsonly = 1;
|
||||||
transvar();
|
transvar();
|
||||||
labelsonly = 0;
|
labelsonly = 0;
|
||||||
// now get name of .<varx>
|
// now get name of .<varx>
|
||||||
|
@ -3087,7 +3098,7 @@ static int parsecommand(void)
|
||||||
textptr++;
|
textptr++;
|
||||||
|
|
||||||
// get the ID of the DEF
|
// get the ID of the DEF
|
||||||
labelsonly = 1;
|
// labelsonly = 1;
|
||||||
transvar();
|
transvar();
|
||||||
labelsonly = 0;
|
labelsonly = 0;
|
||||||
// now get name of .xxx
|
// now get name of .xxx
|
||||||
|
@ -3576,7 +3587,9 @@ static int parsecommand(void)
|
||||||
|
|
||||||
case CON_MINITEXT:
|
case CON_MINITEXT:
|
||||||
case CON_GAMETEXT:
|
case CON_GAMETEXT:
|
||||||
|
case CON_GAMETEXTZ:
|
||||||
case CON_DIGITALNUMBER:
|
case CON_DIGITALNUMBER:
|
||||||
|
case CON_DIGITALNUMBERZ:
|
||||||
if (parsing_event == 0 && parsing_state == 0)
|
if (parsing_event == 0 && parsing_state == 0)
|
||||||
{
|
{
|
||||||
ReportError(ERROR_EVENTONLY);
|
ReportError(ERROR_EVENTONLY);
|
||||||
|
@ -3585,6 +3598,9 @@ static int parsecommand(void)
|
||||||
|
|
||||||
switch (tw)
|
switch (tw)
|
||||||
{
|
{
|
||||||
|
case CON_GAMETEXTZ:
|
||||||
|
case CON_DIGITALNUMBERZ:
|
||||||
|
transmultvars(1);
|
||||||
case CON_GAMETEXT:
|
case CON_GAMETEXT:
|
||||||
case CON_DIGITALNUMBER:
|
case CON_DIGITALNUMBER:
|
||||||
transmultvars(6);
|
transmultvars(6);
|
||||||
|
@ -3705,6 +3721,7 @@ static int parsecommand(void)
|
||||||
//Bsprintf(g_szBuf,"SWITCH2: '%.22s'",textptr);
|
//Bsprintf(g_szBuf,"SWITCH2: '%.22s'",textptr);
|
||||||
//AddLog(g_szBuf);
|
//AddLog(g_szBuf);
|
||||||
}
|
}
|
||||||
|
tempscrptr = (int *)(script+tempoffset);
|
||||||
|
|
||||||
//Bsprintf(g_szBuf,"SWITCHXX: '%.22s'",textptr);
|
//Bsprintf(g_szBuf,"SWITCHXX: '%.22s'",textptr);
|
||||||
//AddLog(g_szBuf);
|
//AddLog(g_szBuf);
|
||||||
|
@ -3764,6 +3781,13 @@ repeatcase:
|
||||||
//AddLog(g_szBuf);
|
//AddLog(g_szBuf);
|
||||||
if (casescriptptr)
|
if (casescriptptr)
|
||||||
{
|
{
|
||||||
|
for (i=0;i<casecount/2;i++)
|
||||||
|
if (casescriptptr[i*2+1]==j)
|
||||||
|
{
|
||||||
|
warning++;
|
||||||
|
ReportError(WARNING_DUPLICATECASE);
|
||||||
|
break;
|
||||||
|
}
|
||||||
//AddLog("Adding value to script");
|
//AddLog("Adding value to script");
|
||||||
casescriptptr[casecount++]=j; // save value
|
casescriptptr[casecount++]=j; // save value
|
||||||
casescriptptr[casecount]=(int)((int*)scriptptr-&script[0]); // save offset
|
casescriptptr[casecount]=(int)((int*)scriptptr-&script[0]); // save offset
|
||||||
|
@ -3861,6 +3885,9 @@ repeatcase:
|
||||||
case CON_NEXTSPRITESECT:
|
case CON_NEXTSPRITESECT:
|
||||||
transmultvars(2);
|
transmultvars(2);
|
||||||
return 0;
|
return 0;
|
||||||
|
case CON_QSUBSTR:
|
||||||
|
transmultvars(4);
|
||||||
|
return 0;
|
||||||
case CON_SETACTORANGLE:
|
case CON_SETACTORANGLE:
|
||||||
case CON_SETPLAYERANGLE:
|
case CON_SETPLAYERANGLE:
|
||||||
if (!CheckEventSync(current_event))
|
if (!CheckEventSync(current_event))
|
||||||
|
@ -4741,6 +4768,7 @@ static void AddDefaultDefinitions(void)
|
||||||
AddDefinition("EVENT_WEAPKEY7",EVENT_WEAPKEY7,LABEL_DEFINE);
|
AddDefinition("EVENT_WEAPKEY7",EVENT_WEAPKEY7,LABEL_DEFINE);
|
||||||
AddDefinition("EVENT_WEAPKEY8",EVENT_WEAPKEY8,LABEL_DEFINE);
|
AddDefinition("EVENT_WEAPKEY8",EVENT_WEAPKEY8,LABEL_DEFINE);
|
||||||
AddDefinition("EVENT_WEAPKEY9",EVENT_WEAPKEY9,LABEL_DEFINE);
|
AddDefinition("EVENT_WEAPKEY9",EVENT_WEAPKEY9,LABEL_DEFINE);
|
||||||
|
AddDefinition("EVENT_KILLIT",EVENT_KILLIT,LABEL_DEFINE);
|
||||||
|
|
||||||
AddDefinition("NO",0,LABEL_DEFINE|LABEL_ACTION|LABEL_AI|LABEL_MOVE);
|
AddDefinition("NO",0,LABEL_DEFINE|LABEL_ACTION|LABEL_AI|LABEL_MOVE);
|
||||||
|
|
||||||
|
@ -5093,5 +5121,11 @@ void ReportError(int iError)
|
||||||
case WARNING_LABELSONLY:
|
case WARNING_LABELSONLY:
|
||||||
initprintf("%s:%d: warning: expected a label, found a constant.\n",compilefile,line_number);
|
initprintf("%s:%d: warning: expected a label, found a constant.\n",compilefile,line_number);
|
||||||
break;
|
break;
|
||||||
|
case WARNING_BADGAMEVAR:
|
||||||
|
initprintf("%s:%ld: warning: variable `%s' should be either per-player OR per-actor, not both.\n",compilefile,line_number,label+(labelcnt<<6));
|
||||||
|
break;
|
||||||
|
case WARNING_DUPLICATECASE:
|
||||||
|
initprintf("%s:%ld: warning: duplicate case ignored.\n",compilefile,line_number);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -92,6 +92,8 @@ enum errors
|
||||||
WARNING_DUPLICATEDEFINITION,
|
WARNING_DUPLICATEDEFINITION,
|
||||||
WARNING_EVENTSYNC,
|
WARNING_EVENTSYNC,
|
||||||
WARNING_LABELSONLY,
|
WARNING_LABELSONLY,
|
||||||
|
WARNING_BADGAMEVAR,
|
||||||
|
WARNING_DUPLICATECASE
|
||||||
};
|
};
|
||||||
|
|
||||||
enum playerlabels
|
enum playerlabels
|
||||||
|
@ -788,7 +790,10 @@ enum keywords
|
||||||
CON_HEADSPRITESECT, // 306
|
CON_HEADSPRITESECT, // 306
|
||||||
CON_PREVSPRITESECT, // 307
|
CON_PREVSPRITESECT, // 307
|
||||||
CON_NEXTSPRITESECT, // 308
|
CON_NEXTSPRITESECT, // 308
|
||||||
CON_SPRITENOPAL, // 309
|
CON_GETKEYNAME, // 309
|
||||||
CON_GETKEYNAME, // 310
|
CON_QSUBSTR, // 310
|
||||||
|
CON_GAMETEXTZ, // 311
|
||||||
|
CON_DIGITALNUMBERZ, // 312
|
||||||
|
CON_SPRITENOPAL, // 313
|
||||||
END
|
END
|
||||||
};
|
};
|
||||||
|
|
|
@ -4308,6 +4308,43 @@ static int parse(void)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case CON_GETKEYNAME:
|
||||||
|
insptr++;
|
||||||
|
{
|
||||||
|
int i = GetGameVarID(*insptr++, g_i, g_p),
|
||||||
|
f=GetGameVarID(*insptr++, g_i, g_p);
|
||||||
|
j=GetGameVarID(*insptr++, g_i, g_p);
|
||||||
|
if (i<MAXQUOTES&&fta_quotes[i] != NULL&&f<NUMGAMEFUNCTIONS)
|
||||||
|
{
|
||||||
|
if (j<2)Bstrcpy(tempbuf,KB_ScanCodeToString(ud.config.KeyboardKeys[f][j]));else
|
||||||
|
{
|
||||||
|
Bstrcpy(tempbuf,KB_ScanCodeToString(ud.config.KeyboardKeys[f][0]));
|
||||||
|
if (!*tempbuf)
|
||||||
|
Bstrcpy(tempbuf,KB_ScanCodeToString(ud.config.KeyboardKeys[f][1]));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (*tempbuf)Bstrcpy(fta_quotes[i],tempbuf);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case CON_QSUBSTR:
|
||||||
|
insptr++;
|
||||||
|
{
|
||||||
|
char *s1,*s2;int q1,q2,st,ln;
|
||||||
|
q1 = GetGameVarID(*insptr++, g_i, g_p),
|
||||||
|
q2 = GetGameVarID(*insptr++, g_i, g_p);
|
||||||
|
st = GetGameVarID(*insptr++, g_i, g_p);
|
||||||
|
ln = GetGameVarID(*insptr++, g_i, g_p);
|
||||||
|
if (q1<MAXQUOTES&&fta_quotes[q1] != NULL&&q2<MAXQUOTES&&fta_quotes[q2] != NULL)
|
||||||
|
{
|
||||||
|
s1=fta_quotes[q1];
|
||||||
|
s2=fta_quotes[q2];
|
||||||
|
while (*s2&&st--)s2++;
|
||||||
|
while ((*s1=*s2)&&ln--){s1++;s2++;}
|
||||||
|
*s1=0;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case CON_GETPNAME:
|
case CON_GETPNAME:
|
||||||
case CON_QSTRCAT:
|
case CON_QSTRCAT:
|
||||||
case CON_QSTRCPY:
|
case CON_QSTRCPY:
|
||||||
|
@ -4385,19 +4422,6 @@ static int parse(void)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case CON_GETKEYNAME:
|
|
||||||
insptr++;
|
|
||||||
{
|
|
||||||
int i = GetGameVarID(*insptr++, g_i, g_p), f=GetGameVarID(*insptr++, g_i, g_p);
|
|
||||||
|
|
||||||
j=GetGameVarID(*insptr++, g_i, g_p);
|
|
||||||
|
|
||||||
if (fta_quotes[i] != NULL && f < NUMGAMEFUNCTIONS && j < 2)
|
|
||||||
Bstrcpy(fta_quotes[i], KB_ScanCodeToString(ud.config.KeyboardKeys[f][j]));
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
case CON_MYOSX:
|
case CON_MYOSX:
|
||||||
case CON_MYOSPALX:
|
case CON_MYOSPALX:
|
||||||
case CON_MYOS:
|
case CON_MYOS:
|
||||||
|
@ -4836,30 +4860,36 @@ static int parse(void)
|
||||||
|
|
||||||
case CON_MINITEXT:
|
case CON_MINITEXT:
|
||||||
case CON_GAMETEXT:
|
case CON_GAMETEXT:
|
||||||
|
case CON_GAMETEXTZ:
|
||||||
case CON_DIGITALNUMBER:
|
case CON_DIGITALNUMBER:
|
||||||
|
case CON_DIGITALNUMBERZ:
|
||||||
insptr++;
|
insptr++;
|
||||||
{
|
{
|
||||||
int tilenum = (tw == CON_GAMETEXT || tw == CON_DIGITALNUMBER)?GetGameVarID(*insptr++,g_i,g_p):0;
|
int tilenum = (tw == CON_GAMETEXT || tw == CON_GAMETEXTZ || tw == CON_DIGITALNUMBER || tw == CON_DIGITALNUMBERZ)?GetGameVarID(*insptr++,g_i,g_p):0;
|
||||||
int x=GetGameVarID(*insptr++,g_i,g_p), y=GetGameVarID(*insptr++,g_i,g_p), q=GetGameVarID(*insptr++,g_i,g_p);
|
int x=GetGameVarID(*insptr++,g_i,g_p), y=GetGameVarID(*insptr++,g_i,g_p), q=GetGameVarID(*insptr++,g_i,g_p);
|
||||||
int shade=GetGameVarID(*insptr++,g_i,g_p), pal=GetGameVarID(*insptr++,g_i,g_p);
|
int shade=GetGameVarID(*insptr++,g_i,g_p), pal=GetGameVarID(*insptr++,g_i,g_p);
|
||||||
|
|
||||||
if (tw == CON_GAMETEXT || tw == CON_DIGITALNUMBER)
|
if (tw == CON_GAMETEXT || tw == CON_GAMETEXTZ || tw == CON_DIGITALNUMBER || tw == CON_DIGITALNUMBERZ)
|
||||||
{
|
{
|
||||||
int orientation=GetGameVarID(*insptr++,g_i,g_p);
|
int orientation=GetGameVarID(*insptr++,g_i,g_p);
|
||||||
int x1=GetGameVarID(*insptr++,g_i,g_p), y1=GetGameVarID(*insptr++,g_i,g_p);
|
int x1=GetGameVarID(*insptr++,g_i,g_p), y1=GetGameVarID(*insptr++,g_i,g_p);
|
||||||
int x2=GetGameVarID(*insptr++,g_i,g_p), y2=GetGameVarID(*insptr++,g_i,g_p);
|
int x2=GetGameVarID(*insptr++,g_i,g_p), y2=GetGameVarID(*insptr++,g_i,g_p);
|
||||||
|
|
||||||
if (tw == CON_GAMETEXT)
|
if (tw == CON_GAMETEXT || tw == CON_GAMETEXTZ)
|
||||||
{
|
{
|
||||||
if (fta_quotes[q] == NULL)
|
if (fta_quotes[q] == NULL)
|
||||||
{
|
{
|
||||||
OSD_Printf("%s %d null quote %d\n",__FILE__,__LINE__,q);
|
OSD_Printf("%s %d null quote %d\n",__FILE__,__LINE__,q);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
gametext_(0,tilenum,x>>1,y,fta_quotes[q],shade,pal,orientation,x1,y1,x2,y2);
|
int z=65536;
|
||||||
|
if (tw == CON_GAMETEXTZ)z=GetGameVarID(*insptr++,g_i,g_p);
|
||||||
|
gametext_z(0,tilenum,x>>1,y,fta_quotes[q],shade,pal,orientation,x1,y1,x2,y2,z);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
txdigitalnumber(tilenum,x,y,q,shade,pal,orientation,x1,y1,x2,y2);
|
int z=65536;
|
||||||
|
if (tw == CON_DIGITALNUMBERZ)z=GetGameVarID(*insptr++,g_i,g_p);
|
||||||
|
txdigitalnumberz(tilenum,x,y,q,shade,pal,orientation,x1,y1,x2,y2,z);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2673,6 +2673,7 @@ cheat_for_port_credits:
|
||||||
break;
|
break;
|
||||||
case 6:
|
case 6:
|
||||||
if (x==io) ud.screen_tilting = 1-ud.screen_tilting;
|
if (x==io) ud.screen_tilting = 1-ud.screen_tilting;
|
||||||
|
if (!ud.screen_tilting)setrollangle(0);
|
||||||
modval(0,1,(int *)&ud.screen_tilting,1,probey==io);
|
modval(0,1,(int *)&ud.screen_tilting,1,probey==io);
|
||||||
gametextpal(d,yy, ud.screen_tilting ? "On" : "Off", MENUHIGHLIGHT(io), 0);
|
gametextpal(d,yy, ud.screen_tilting ? "On" : "Off", MENUHIGHLIGHT(io), 0);
|
||||||
break; // original had a 'full' option
|
break; // original had a 'full' option
|
||||||
|
|
|
@ -534,9 +534,14 @@ static int osdcmd_setvar(const osdfuncparm_t *parm)
|
||||||
return OSDCMD_OK;
|
return OSDCMD_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
strcpy(varname,parm->parms[0]);
|
strcpy(varname,parm->parms[1]);
|
||||||
varval = Batol(parm->parms[1]);
|
varval = Batol(varname);
|
||||||
|
for (i=0;i<iGameVarCount;i++)
|
||||||
|
if (aGameVars[i].szLabel != NULL)
|
||||||
|
if (Bstrcmp(varname, aGameVars[i].szLabel) == 0)
|
||||||
|
varval=GetGameVarID(i, g_player[myconnectindex].ps->i, myconnectindex);
|
||||||
|
|
||||||
|
strcpy(varname,parm->parms[0]);
|
||||||
for (i=0;i<iGameVarCount;i++)
|
for (i=0;i<iGameVarCount;i++)
|
||||||
if (aGameVars[i].szLabel != NULL)
|
if (aGameVars[i].szLabel != NULL)
|
||||||
if (Bstrcmp(varname, aGameVars[i].szLabel) == 0)
|
if (Bstrcmp(varname, aGameVars[i].szLabel) == 0)
|
||||||
|
@ -544,6 +549,42 @@ static int osdcmd_setvar(const osdfuncparm_t *parm)
|
||||||
return OSDCMD_OK;
|
return OSDCMD_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int osdcmd_setactorvar(const osdfuncparm_t *parm)
|
||||||
|
{
|
||||||
|
int i, varval, ID;
|
||||||
|
char varname[256];
|
||||||
|
|
||||||
|
if (parm->numparms != 3) return OSDCMD_SHOWHELP;
|
||||||
|
|
||||||
|
if (numplayers > 1)
|
||||||
|
{
|
||||||
|
OSD_Printf("Command not allowed in multiplayer\n");
|
||||||
|
return OSDCMD_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
ID=Batol(parm->parms[0]);
|
||||||
|
if (ID>=MAXSPRITES)
|
||||||
|
{
|
||||||
|
OSD_Printf("Invalid sprite ID\n");
|
||||||
|
return OSDCMD_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
varval = Batol(parm->parms[2]);
|
||||||
|
strcpy(varname,parm->parms[2]);
|
||||||
|
varval = Batol(varname);
|
||||||
|
for (i=0;i<iGameVarCount;i++)
|
||||||
|
if (aGameVars[i].szLabel != NULL)
|
||||||
|
if (Bstrcmp(varname, aGameVars[i].szLabel) == 0)
|
||||||
|
varval=GetGameVarID(i, g_player[myconnectindex].ps->i, myconnectindex);
|
||||||
|
|
||||||
|
strcpy(varname,parm->parms[1]);
|
||||||
|
for (i=0;i<iGameVarCount;i++)
|
||||||
|
if (aGameVars[i].szLabel != NULL)
|
||||||
|
if (Bstrcmp(varname, aGameVars[i].szLabel) == 0)
|
||||||
|
SetGameVarID(i, varval, ID, -1);
|
||||||
|
return OSDCMD_OK;
|
||||||
|
}
|
||||||
|
|
||||||
static int osdcmd_addpath(const osdfuncparm_t *parm)
|
static int osdcmd_addpath(const osdfuncparm_t *parm)
|
||||||
{
|
{
|
||||||
char pathname[BMAX_PATH];
|
char pathname[BMAX_PATH];
|
||||||
|
@ -948,6 +989,8 @@ int registerosdcommands(void)
|
||||||
|
|
||||||
OSD_RegisterFunction("sensitivity","sensitivity <value>: changes the mouse sensitivity", osdcmd_sensitivity);
|
OSD_RegisterFunction("sensitivity","sensitivity <value>: changes the mouse sensitivity", osdcmd_sensitivity);
|
||||||
OSD_RegisterFunction("setvar","setvar <gamevar> <value>: sets the value of a gamevar", osdcmd_setvar);
|
OSD_RegisterFunction("setvar","setvar <gamevar> <value>: sets the value of a gamevar", osdcmd_setvar);
|
||||||
|
OSD_RegisterFunction("setvarvar","setvar <gamevar> <gamevar>: sets the value of a gamevar", osdcmd_setvar);
|
||||||
|
OSD_RegisterFunction("setactorvar","setactorvar <actorID> <gamevar> <value>: sets the value of a gamevar", osdcmd_setactorvar);
|
||||||
OSD_RegisterFunction("spawn","spawn <picnum> [palnum] [cstat] [ang] [x y z]: spawns a sprite with the given properties",osdcmd_spawn);
|
OSD_RegisterFunction("spawn","spawn <picnum> [palnum] [cstat] [ang] [x y z]: spawns a sprite with the given properties",osdcmd_spawn);
|
||||||
|
|
||||||
OSD_RegisterFunction("usejoystick","usejoystick: enables input from the joystick if it is present",osdcmd_usemousejoy);
|
OSD_RegisterFunction("usejoystick","usejoystick: enables input from the joystick if it is present",osdcmd_usemousejoy);
|
||||||
|
|
Loading…
Reference in a new issue