mirror of
https://git.do.srb2.org/KartKrew/Kart-Public.git
synced 2024-12-28 13:21:10 +00:00
encore colormaps, fixups + flat align
This commit is contained in:
parent
a0ff5c6b25
commit
bf13726c1e
3 changed files with 59 additions and 23 deletions
|
@ -346,10 +346,10 @@ static void HWR_GenerateTexture(INT32 texnum, GLTexture_t *grtex)
|
||||||
grtex->mipmap.height = (UINT16)blockheight;
|
grtex->mipmap.height = (UINT16)blockheight;
|
||||||
grtex->mipmap.grInfo.format = textureformat;
|
grtex->mipmap.grInfo.format = textureformat;
|
||||||
|
|
||||||
#ifdef GLENCORE
|
|
||||||
grtex->mipmap.colormap = colormaps;
|
grtex->mipmap.colormap = colormaps;
|
||||||
|
|
||||||
if (encoremode)
|
#ifdef GLENCORE
|
||||||
|
if (encoremap)
|
||||||
grtex->mipmap.colormap += (256*32);
|
grtex->mipmap.colormap += (256*32);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -635,10 +635,10 @@ void HWR_GetFlat(lumpnum_t flatlumpnum)
|
||||||
|
|
||||||
grmip = &HWR_GetCachedGLPatch(flatlumpnum)->mipmap;
|
grmip = &HWR_GetCachedGLPatch(flatlumpnum)->mipmap;
|
||||||
|
|
||||||
#ifdef GLENCORE
|
|
||||||
grmip->colormap = colormaps;
|
grmip->colormap = colormaps;
|
||||||
|
|
||||||
if (encoremode)
|
#ifdef GLENCORE
|
||||||
|
if (encoremap)
|
||||||
grmip->colormap += (256*32);
|
grmip->colormap += (256*32);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -387,13 +387,13 @@ void HWR_RenderPlane(extrasubsector_t *xsub, boolean isceiling, fixed_t fixedhei
|
||||||
{
|
{
|
||||||
scrollx = FIXED_TO_FLOAT(FOFsector->floor_xoffs)/fflatsize;
|
scrollx = FIXED_TO_FLOAT(FOFsector->floor_xoffs)/fflatsize;
|
||||||
scrolly = FIXED_TO_FLOAT(FOFsector->floor_yoffs)/fflatsize;
|
scrolly = FIXED_TO_FLOAT(FOFsector->floor_yoffs)/fflatsize;
|
||||||
angle = FOFsector->floorpic_angle>>ANGLETOFINESHIFT;
|
angle = FOFsector->floorpic_angle;
|
||||||
}
|
}
|
||||||
else // it's a ceiling
|
else // it's a ceiling
|
||||||
{
|
{
|
||||||
scrollx = FIXED_TO_FLOAT(FOFsector->ceiling_xoffs)/fflatsize;
|
scrollx = FIXED_TO_FLOAT(FOFsector->ceiling_xoffs)/fflatsize;
|
||||||
scrolly = FIXED_TO_FLOAT(FOFsector->ceiling_yoffs)/fflatsize;
|
scrolly = FIXED_TO_FLOAT(FOFsector->ceiling_yoffs)/fflatsize;
|
||||||
angle = FOFsector->ceilingpic_angle>>ANGLETOFINESHIFT;
|
angle = FOFsector->ceilingpic_angle;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (gr_frontsector)
|
else if (gr_frontsector)
|
||||||
|
@ -402,24 +402,27 @@ void HWR_RenderPlane(extrasubsector_t *xsub, boolean isceiling, fixed_t fixedhei
|
||||||
{
|
{
|
||||||
scrollx = FIXED_TO_FLOAT(gr_frontsector->floor_xoffs)/fflatsize;
|
scrollx = FIXED_TO_FLOAT(gr_frontsector->floor_xoffs)/fflatsize;
|
||||||
scrolly = FIXED_TO_FLOAT(gr_frontsector->floor_yoffs)/fflatsize;
|
scrolly = FIXED_TO_FLOAT(gr_frontsector->floor_yoffs)/fflatsize;
|
||||||
angle = gr_frontsector->floorpic_angle>>ANGLETOFINESHIFT;
|
angle = gr_frontsector->floorpic_angle;
|
||||||
}
|
}
|
||||||
else // it's a ceiling
|
else // it's a ceiling
|
||||||
{
|
{
|
||||||
scrollx = FIXED_TO_FLOAT(gr_frontsector->ceiling_xoffs)/fflatsize;
|
scrollx = FIXED_TO_FLOAT(gr_frontsector->ceiling_xoffs)/fflatsize;
|
||||||
scrolly = FIXED_TO_FLOAT(gr_frontsector->ceiling_yoffs)/fflatsize;
|
scrolly = FIXED_TO_FLOAT(gr_frontsector->ceiling_yoffs)/fflatsize;
|
||||||
angle = gr_frontsector->ceilingpic_angle>>ANGLETOFINESHIFT;
|
angle = gr_frontsector->ceilingpic_angle;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (angle) // Only needs to be done if there's an altered angle
|
if (angle) // Only needs to be done if there's an altered angle
|
||||||
{
|
{
|
||||||
|
|
||||||
|
angle = InvAngle(angle)>>ANGLETOFINESHIFT;
|
||||||
|
|
||||||
// This needs to be done so that it scrolls in a different direction after rotation like software
|
// This needs to be done so that it scrolls in a different direction after rotation like software
|
||||||
tempxsow = FLOAT_TO_FIXED(scrollx);
|
/*tempxsow = FLOAT_TO_FIXED(scrollx);
|
||||||
tempytow = FLOAT_TO_FIXED(scrolly);
|
tempytow = FLOAT_TO_FIXED(scrolly);
|
||||||
scrollx = (FIXED_TO_FLOAT(FixedMul(tempxsow, FINECOSINE(angle)) - FixedMul(tempytow, FINESINE(angle))));
|
scrollx = (FIXED_TO_FLOAT(FixedMul(tempxsow, FINECOSINE(angle)) - FixedMul(tempytow, FINESINE(angle))));
|
||||||
scrolly = (FIXED_TO_FLOAT(FixedMul(tempxsow, FINESINE(angle)) + FixedMul(tempytow, FINECOSINE(angle))));
|
scrolly = (FIXED_TO_FLOAT(FixedMul(tempxsow, FINESINE(angle)) + FixedMul(tempytow, FINECOSINE(angle))));*/
|
||||||
|
|
||||||
// This needs to be done so everything aligns after rotation
|
// This needs to be done so everything aligns after rotation
|
||||||
// It would be done so that rotation is done, THEN the translation, but I couldn't get it to rotate AND scroll like software does
|
// It would be done so that rotation is done, THEN the translation, but I couldn't get it to rotate AND scroll like software does
|
||||||
|
@ -429,6 +432,7 @@ void HWR_RenderPlane(extrasubsector_t *xsub, boolean isceiling, fixed_t fixedhei
|
||||||
flatyref = (FIXED_TO_FLOAT(FixedMul(tempxsow, FINESINE(angle)) + FixedMul(tempytow, FINECOSINE(angle))));
|
flatyref = (FIXED_TO_FLOAT(FixedMul(tempxsow, FINESINE(angle)) + FixedMul(tempytow, FINECOSINE(angle))));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
for (i = 0; i < nrPlaneVerts; i++,v3d++,pv++)
|
for (i = 0; i < nrPlaneVerts; i++,v3d++,pv++)
|
||||||
{
|
{
|
||||||
// Hurdler: add scrolling texture on floor/ceiling
|
// Hurdler: add scrolling texture on floor/ceiling
|
||||||
|
@ -4381,7 +4385,7 @@ void HWR_ProjectSprite(mobj_t *thing)
|
||||||
{
|
{
|
||||||
vis->colormap = colormaps;
|
vis->colormap = colormaps;
|
||||||
#ifdef GLENCORE
|
#ifdef GLENCORE
|
||||||
if (encoremap && (thing->flags & (MF_SCENERY|MF_NOTHINK)))
|
if (encoremap && (thing->flags & (MF_SCENERY|MF_NOTHINK)) && !(thing->flags & MF_DONTENCOREMAP))
|
||||||
vis->colormap += (256*32);
|
vis->colormap += (256*32);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -4499,7 +4503,7 @@ void HWR_ProjectPrecipitationSprite(precipmobj_t *thing)
|
||||||
vis->colormap = colormaps;
|
vis->colormap = colormaps;
|
||||||
|
|
||||||
#ifdef GLENCORE
|
#ifdef GLENCORE
|
||||||
if (encoremap)
|
if (encoremap && !(thing->flags & MF_DONTENCOREMAP))
|
||||||
vis->colormap += (256*32);
|
vis->colormap += (256*32);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -1408,6 +1408,8 @@ static void P_LoadRawSideDefs2(void *data)
|
||||||
{
|
{
|
||||||
UINT16 i;
|
UINT16 i;
|
||||||
INT32 num;
|
INT32 num;
|
||||||
|
size_t j;
|
||||||
|
UINT32 cr, cg, cb;
|
||||||
|
|
||||||
for (i = 0; i < numsides; i++)
|
for (i = 0; i < numsides; i++)
|
||||||
{
|
{
|
||||||
|
@ -1486,10 +1488,26 @@ static void P_LoadRawSideDefs2(void *data)
|
||||||
{
|
{
|
||||||
col = msd->toptexture;
|
col = msd->toptexture;
|
||||||
|
|
||||||
sec->extra_colormap->rgba =
|
// encore mode colormaps!
|
||||||
(HEX2INT(col[1]) << 4) + (HEX2INT(col[2]) << 0) +
|
// do it like software by aproximating a color to a palette index, and then convert it to its encore variant and then back to a color code.
|
||||||
(HEX2INT(col[3]) << 12) + (HEX2INT(col[4]) << 8) +
|
// do this for both the start and fade colormaps.
|
||||||
(HEX2INT(col[5]) << 20) + (HEX2INT(col[6]) << 16);
|
|
||||||
|
cr = (HEX2INT(col[1]) << 4) + (HEX2INT(col[2]) << 0);
|
||||||
|
cg = (HEX2INT(col[3]) << 12) + (HEX2INT(col[4]) << 8);
|
||||||
|
cb = (HEX2INT(col[5]) << 20) + (HEX2INT(col[6]) << 16);
|
||||||
|
|
||||||
|
#ifdef GLENCORE
|
||||||
|
if (encoremap)
|
||||||
|
{
|
||||||
|
j = encoremap[NearestColor((UINT8)cr, (UINT8)cg, (UINT8)cb)];
|
||||||
|
//CONS_Printf("R_CreateColormap: encoremap[%d] = %d\n", j, encoremap[j]); -- moved encoremap upwards for optimisation
|
||||||
|
cr = pLocalPalette[j].s.red;
|
||||||
|
cg = pLocalPalette[j].s.green;
|
||||||
|
cb = pLocalPalette[j].s.blue;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
sec->extra_colormap->rgba = cr + cg + cb;
|
||||||
|
|
||||||
// alpha
|
// alpha
|
||||||
if (msd->toptexture[7])
|
if (msd->toptexture[7])
|
||||||
|
@ -1515,10 +1533,24 @@ static void P_LoadRawSideDefs2(void *data)
|
||||||
{
|
{
|
||||||
col = msd->bottomtexture;
|
col = msd->bottomtexture;
|
||||||
|
|
||||||
sec->extra_colormap->fadergba =
|
// do the exact same thing as above here.
|
||||||
(HEX2INT(col[1]) << 4) + (HEX2INT(col[2]) << 0) +
|
|
||||||
(HEX2INT(col[3]) << 12) + (HEX2INT(col[4]) << 8) +
|
cr = (HEX2INT(col[1]) << 4) + (HEX2INT(col[2]) << 0);
|
||||||
(HEX2INT(col[5]) << 20) + (HEX2INT(col[6]) << 16);
|
cg = (HEX2INT(col[3]) << 12) + (HEX2INT(col[4]) << 8);
|
||||||
|
cb = (HEX2INT(col[5]) << 20) + (HEX2INT(col[6]) << 16);
|
||||||
|
|
||||||
|
#ifdef GLENCORE
|
||||||
|
if (encoremap)
|
||||||
|
{
|
||||||
|
j = encoremap[NearestColor((UINT8)cr, (UINT8)cg, (UINT8)cb)];
|
||||||
|
//CONS_Printf("R_CreateColormap: encoremap[%d] = %d\n", j, encoremap[j]); -- moved encoremap upwards for optimisation
|
||||||
|
cr = pLocalPalette[j].s.red;
|
||||||
|
cg = pLocalPalette[j].s.green;
|
||||||
|
cb = pLocalPalette[j].s.blue;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
sec->extra_colormap->fadergba = cr + cg + cb;
|
||||||
|
|
||||||
// alpha
|
// alpha
|
||||||
if (msd->bottomtexture[7])
|
if (msd->bottomtexture[7])
|
||||||
|
|
Loading…
Reference in a new issue