Adds specpower and specfactor tokens for model skins.

git-svn-id: https://svn.eduke32.com/eduke32@1279 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
plagman 2009-03-28 15:19:44 +00:00
parent 50af4984ad
commit 83fc79300e
5 changed files with 31 additions and 14 deletions

View file

@ -657,7 +657,7 @@ static inline int32_t md_tilehasmodel(int32_t tilenume,int32_t pal)
int32_t md_defineframe(int32_t modelid, const char *framename, int32_t tilenume, int32_t skinnum, float smoothduration, int32_t pal); int32_t md_defineframe(int32_t modelid, const char *framename, int32_t tilenume, int32_t skinnum, float smoothduration, int32_t pal);
int32_t md_defineanimation(int32_t modelid, const char *framestart, const char *frameend, int32_t fps, int32_t flags); int32_t md_defineanimation(int32_t modelid, const char *framestart, const char *frameend, int32_t fps, int32_t flags);
int32_t md_defineskin(int32_t modelid, const char *skinfn, int32_t palnum, int32_t skinnum, int32_t surfnum, float param); int32_t md_defineskin(int32_t modelid, const char *skinfn, int32_t palnum, int32_t skinnum, int32_t surfnum, float param, float specpower, float specfactor);
int32_t md_definehud (int32_t modelid, int32_t tilex, double xadd, double yadd, double zadd, double angadd, int32_t flags); int32_t md_definehud (int32_t modelid, int32_t tilex, double xadd, double yadd, double zadd, double angadd, int32_t flags);
int32_t md_undefinetile(int32_t tile); int32_t md_undefinetile(int32_t tile);
int32_t md_undefinemodel(int32_t modelid); int32_t md_undefinemodel(int32_t modelid);

View file

@ -32,7 +32,7 @@ typedef struct _mdskinmap_t
char *fn; // Skin filename char *fn; // Skin filename
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, specpower, specfactor;
char *palmap;int32_t size; char *palmap;int32_t size;
} mdskinmap_t; } mdskinmap_t;

View file

@ -180,6 +180,8 @@ static tokenlist modelskintokens[] =
{ "intensity", T_PARAM }, { "intensity", T_PARAM },
{ "scale", T_PARAM }, { "scale", T_PARAM },
{ "detailscale", T_PARAM }, { "detailscale", T_PARAM },
{ "specpower", T_SPECPOWER },
{ "specfactor", T_SPECFACTOR },
}; };
static tokenlist modelhudtokens[] = static tokenlist modelhudtokens[] =
@ -958,7 +960,7 @@ static int32_t defsparser(scriptfile *script)
seenframe = 0; seenframe = 0;
#if defined(POLYMOST) && defined(USE_OPENGL) #if defined(POLYMOST) && defined(USE_OPENGL)
switch (md_defineskin(lastmodelid, skinfn, palnum, max(0,modelskin), 0, 0.0f)) switch (md_defineskin(lastmodelid, skinfn, palnum, max(0,modelskin), 0, 0.0f, 1.0f, 1.0f))
{ {
case 0: case 0:
break; break;
@ -1209,7 +1211,7 @@ static int32_t defsparser(scriptfile *script)
char *skintokptr = script->ltextptr; char *skintokptr = script->ltextptr;
char *skinend, *skinfn = 0; char *skinend, *skinfn = 0;
int32_t palnum = 0, surfnum = 0; int32_t palnum = 0, surfnum = 0;
double param = 1.0; double param = 1.0, specpower = 1.0, specfactor = 1.0;
if (scriptfile_getbraces(script,&skinend)) break; if (scriptfile_getbraces(script,&skinend)) break;
while (script->textptr < skinend) while (script->textptr < skinend)
@ -1220,6 +1222,10 @@ static int32_t defsparser(scriptfile *script)
scriptfile_getsymbol(script,&palnum); break; scriptfile_getsymbol(script,&palnum); break;
case T_PARAM: case T_PARAM:
scriptfile_getdouble(script,&param); break; scriptfile_getdouble(script,&param); break;
case T_SPECPOWER:
scriptfile_getdouble(script,&specpower); break;
case T_SPECFACTOR:
scriptfile_getdouble(script,&specfactor); break;
case T_FILE: case T_FILE:
scriptfile_getstring(script,&skinfn); break; //skin filename scriptfile_getstring(script,&skinfn); break; //skin filename
case T_SURF: case T_SURF:
@ -1255,7 +1261,7 @@ static int32_t defsparser(scriptfile *script)
} }
#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, specpower, specfactor))
{ {
case 0: case 0:
break; break;

View file

@ -320,7 +320,7 @@ int32_t md_defineanimation(int32_t modelid, const char *framestart, const char *
return(0); return(0);
} }
int32_t md_defineskin(int32_t modelid, const char *skinfn, int32_t palnum, int32_t skinnum, int32_t surfnum, float param) int32_t md_defineskin(int32_t modelid, const char *skinfn, int32_t palnum, int32_t skinnum, int32_t surfnum, float param, float specpower, float specfactor)
{ {
mdskinmap_t *sk, *skl; mdskinmap_t *sk, *skl;
md2model_t *m; md2model_t *m;
@ -352,6 +352,8 @@ int32_t md_defineskin(int32_t modelid, const char *skinfn, int32_t palnum, int32
sk->skinnum = skinnum; sk->skinnum = skinnum;
sk->surfnum = surfnum; sk->surfnum = surfnum;
sk->param = param; sk->param = param;
sk->specpower = specpower;
sk->specfactor = specfactor;
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);

View file

@ -2908,7 +2908,7 @@ static void polymer_drawmdsprite(spritetype *tspr)
mdspritematerial.diffusemap = mdspritematerial.diffusemap =
mdloadskin((md2model_t *)m,tile2model[Ptile2tile(tspr->picnum,sprite[tspr->owner].pal)].skinnum,tspr->pal,surfi); mdloadskin((md2model_t *)m,tile2model[Ptile2tile(tspr->picnum,lpal)].skinnum,tspr->pal,surfi);
if (!mdspritematerial.diffusemap) if (!mdspritematerial.diffusemap)
continue; continue;
@ -2924,6 +2924,15 @@ static void polymer_drawmdsprite(spritetype *tspr)
mdspritematerial.detailscale[0] = mdspritematerial.detailscale[1] = sk->param; mdspritematerial.detailscale[0] = mdspritematerial.detailscale[1] = sk->param;
} }
for (sk = m->skinmap; sk; sk = sk->next)
if ((int32_t)sk->palette == tspr->pal &&
sk->skinnum == tile2model[Ptile2tile(tspr->picnum,lpal)].skinnum &&
sk->surfnum == surfi)
{
mdspritematerial.specmaterial[0] = sk->specpower;
mdspritematerial.specmaterial[1] = sk->specfactor;
}
if (r_glowmapping && !(tspr->cstat&1024)) if (r_glowmapping && !(tspr->cstat&1024))
{ {
mdspritematerial.glowmap = mdspritematerial.glowmap =