mirror of
https://git.do.srb2.org/KartKrew/Kart-Public.git
synced 2024-12-27 04:41:23 +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.grInfo.format = textureformat;
|
||||
|
||||
#ifdef GLENCORE
|
||||
grtex->mipmap.colormap = colormaps;
|
||||
|
||||
if (encoremode)
|
||||
|
||||
#ifdef GLENCORE
|
||||
if (encoremap)
|
||||
grtex->mipmap.colormap += (256*32);
|
||||
#endif
|
||||
|
||||
|
@ -634,11 +634,11 @@ void HWR_GetFlat(lumpnum_t flatlumpnum)
|
|||
GLMipmap_t *grmip;
|
||||
|
||||
grmip = &HWR_GetCachedGLPatch(flatlumpnum)->mipmap;
|
||||
|
||||
#ifdef GLENCORE
|
||||
|
||||
grmip->colormap = colormaps;
|
||||
|
||||
if (encoremode)
|
||||
|
||||
#ifdef GLENCORE
|
||||
if (encoremap)
|
||||
grmip->colormap += (256*32);
|
||||
#endif
|
||||
|
||||
|
|
|
@ -387,13 +387,13 @@ void HWR_RenderPlane(extrasubsector_t *xsub, boolean isceiling, fixed_t fixedhei
|
|||
{
|
||||
scrollx = FIXED_TO_FLOAT(FOFsector->floor_xoffs)/fflatsize;
|
||||
scrolly = FIXED_TO_FLOAT(FOFsector->floor_yoffs)/fflatsize;
|
||||
angle = FOFsector->floorpic_angle>>ANGLETOFINESHIFT;
|
||||
angle = FOFsector->floorpic_angle;
|
||||
}
|
||||
else // it's a ceiling
|
||||
{
|
||||
scrollx = FIXED_TO_FLOAT(FOFsector->ceiling_xoffs)/fflatsize;
|
||||
scrolly = FIXED_TO_FLOAT(FOFsector->ceiling_yoffs)/fflatsize;
|
||||
angle = FOFsector->ceilingpic_angle>>ANGLETOFINESHIFT;
|
||||
angle = FOFsector->ceilingpic_angle;
|
||||
}
|
||||
}
|
||||
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;
|
||||
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
|
||||
{
|
||||
scrollx = FIXED_TO_FLOAT(gr_frontsector->ceiling_xoffs)/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
|
||||
{
|
||||
|
||||
angle = InvAngle(angle)>>ANGLETOFINESHIFT;
|
||||
|
||||
// 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);
|
||||
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
|
||||
// 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))));
|
||||
}
|
||||
|
||||
|
||||
for (i = 0; i < nrPlaneVerts; i++,v3d++,pv++)
|
||||
{
|
||||
// Hurdler: add scrolling texture on floor/ceiling
|
||||
|
@ -4381,7 +4385,7 @@ void HWR_ProjectSprite(mobj_t *thing)
|
|||
{
|
||||
vis->colormap = colormaps;
|
||||
#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);
|
||||
#endif
|
||||
}
|
||||
|
@ -4499,7 +4503,7 @@ void HWR_ProjectPrecipitationSprite(precipmobj_t *thing)
|
|||
vis->colormap = colormaps;
|
||||
|
||||
#ifdef GLENCORE
|
||||
if (encoremap)
|
||||
if (encoremap && !(thing->flags & MF_DONTENCOREMAP))
|
||||
vis->colormap += (256*32);
|
||||
#endif
|
||||
|
||||
|
|
|
@ -1408,6 +1408,8 @@ static void P_LoadRawSideDefs2(void *data)
|
|||
{
|
||||
UINT16 i;
|
||||
INT32 num;
|
||||
size_t j;
|
||||
UINT32 cr, cg, cb;
|
||||
|
||||
for (i = 0; i < numsides; i++)
|
||||
{
|
||||
|
@ -1486,10 +1488,26 @@ static void P_LoadRawSideDefs2(void *data)
|
|||
{
|
||||
col = msd->toptexture;
|
||||
|
||||
sec->extra_colormap->rgba =
|
||||
(HEX2INT(col[1]) << 4) + (HEX2INT(col[2]) << 0) +
|
||||
(HEX2INT(col[3]) << 12) + (HEX2INT(col[4]) << 8) +
|
||||
(HEX2INT(col[5]) << 20) + (HEX2INT(col[6]) << 16);
|
||||
// encore mode colormaps!
|
||||
// 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.
|
||||
// do this for both the start and fade colormaps.
|
||||
|
||||
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
|
||||
if (msd->toptexture[7])
|
||||
|
@ -1515,10 +1533,24 @@ static void P_LoadRawSideDefs2(void *data)
|
|||
{
|
||||
col = msd->bottomtexture;
|
||||
|
||||
sec->extra_colormap->fadergba =
|
||||
(HEX2INT(col[1]) << 4) + (HEX2INT(col[2]) << 0) +
|
||||
(HEX2INT(col[3]) << 12) + (HEX2INT(col[4]) << 8) +
|
||||
(HEX2INT(col[5]) << 20) + (HEX2INT(col[6]) << 16);
|
||||
// do the exact same thing as above here.
|
||||
|
||||
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->fadergba = cr + cg + cb;
|
||||
|
||||
// alpha
|
||||
if (msd->bottomtexture[7])
|
||||
|
|
Loading…
Reference in a new issue