mirror of
https://github.com/yquake2/yquake2remaster.git
synced 2024-11-26 14:30:48 +00:00
soft: use pixel_t in skin and load lightmap
This commit is contained in:
parent
7004565c72
commit
0c2bf1f65d
4 changed files with 20 additions and 15 deletions
|
@ -211,7 +211,7 @@ typedef struct finalvert_s {
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
void *pskin;
|
pixel_t *pskin;
|
||||||
int skinwidth;
|
int skinwidth;
|
||||||
int skinheight;
|
int skinheight;
|
||||||
} affinetridesc_t;
|
} affinetridesc_t;
|
||||||
|
|
|
@ -578,7 +578,7 @@ R_AliasSetupLighting(entity_t *currententity)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
j = (light[0] + light[1] + light[2])*0.3333*255;
|
j = (light[0] + light[1] + light[2]) * 0.3333 * 255;
|
||||||
|
|
||||||
lighting.ambientlight = j;
|
lighting.ambientlight = j;
|
||||||
lighting.shadelight = j;
|
lighting.shadelight = j;
|
||||||
|
|
|
@ -258,16 +258,17 @@ static void
|
||||||
Mod_LoadLighting (model_t *loadmodel, byte *mod_base, lump_t *l)
|
Mod_LoadLighting (model_t *loadmodel, byte *mod_base, lump_t *l)
|
||||||
{
|
{
|
||||||
int i, size;
|
int i, size;
|
||||||
byte *in;
|
pixel_t *in;
|
||||||
|
|
||||||
if (!l->filelen)
|
if (!l->filelen)
|
||||||
{
|
{
|
||||||
loadmodel->lightdata = NULL;
|
loadmodel->lightdata = NULL;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
size = l->filelen/3;
|
size = l->filelen/3;
|
||||||
loadmodel->lightdata = Hunk_Alloc(size);
|
loadmodel->lightdata = Hunk_Alloc(size);
|
||||||
in = (void *)(mod_base + l->fileofs);
|
in = mod_base + l->fileofs;
|
||||||
for (i=0 ; i<size ; i++, in+=3)
|
for (i=0 ; i<size ; i++, in+=3)
|
||||||
{
|
{
|
||||||
if (in[0] > in[1] && in[0] > in[2])
|
if (in[0] > in[1] && in[0] > in[2])
|
||||||
|
@ -1008,7 +1009,8 @@ Mod_LoadBrushModel(model_t *mod, void *buffer, int modfilelen)
|
||||||
if(surfEdgeCount < MAX_MAP_SURFEDGES) // else it errors out later anyway
|
if(surfEdgeCount < MAX_MAP_SURFEDGES) // else it errors out later anyway
|
||||||
hunkSize += calcLumpHunkSize(&header->lumps[LUMP_SURFEDGES], sizeof(int), sizeof(int), 24);
|
hunkSize += calcLumpHunkSize(&header->lumps[LUMP_SURFEDGES], sizeof(int), sizeof(int), 24);
|
||||||
|
|
||||||
// lighting is a special case, because we keep only 1 byte out of 3 (=> no colored lighting in soft renderer)
|
// lighting is a special case, because we keep only 1 byte out of 3
|
||||||
|
// (=> no colored lighting in soft renderer by default)
|
||||||
{
|
{
|
||||||
int size = header->lumps[LUMP_LIGHTING].filelen/3;
|
int size = header->lumps[LUMP_LIGHTING].filelen/3;
|
||||||
size = (size + 31) & ~31;
|
size = (size + 31) & ~31;
|
||||||
|
|
|
@ -78,7 +78,7 @@ static zvalue_t d_ziextrastep, d_zibasestep;
|
||||||
|
|
||||||
static byte *skintable[MAX_LBM_HEIGHT];
|
static byte *skintable[MAX_LBM_HEIGHT];
|
||||||
int skinwidth;
|
int skinwidth;
|
||||||
static byte *skinstart;
|
static pixel_t *skinstart;
|
||||||
|
|
||||||
void (*d_pdrawspans)(const entity_t *currententity, spanpackage_t *pspanpackage);
|
void (*d_pdrawspans)(const entity_t *currententity, spanpackage_t *pspanpackage);
|
||||||
|
|
||||||
|
@ -429,8 +429,8 @@ R_PolysetDrawSpans8
|
||||||
void
|
void
|
||||||
R_PolysetDrawSpans8_33(const entity_t *currententity, spanpackage_t *pspanpackage)
|
R_PolysetDrawSpans8_33(const entity_t *currententity, spanpackage_t *pspanpackage)
|
||||||
{
|
{
|
||||||
byte *lpdest;
|
pixel_t *lpdest;
|
||||||
byte *lptex;
|
pixel_t *lptex;
|
||||||
int lsfrac, ltfrac;
|
int lsfrac, ltfrac;
|
||||||
int llight;
|
int llight;
|
||||||
zvalue_t lzi;
|
zvalue_t lzi;
|
||||||
|
@ -470,7 +470,7 @@ R_PolysetDrawSpans8_33(const entity_t *currententity, spanpackage_t *pspanpackag
|
||||||
{
|
{
|
||||||
int temp = vid_colormap[*lptex + ( llight & 0xFF00 )];
|
int temp = vid_colormap[*lptex + ( llight & 0xFF00 )];
|
||||||
|
|
||||||
*lpdest = vid_alphamap[temp+ *lpdest*256];
|
*lpdest = vid_alphamap[temp + *lpdest*256];
|
||||||
}
|
}
|
||||||
lpdest++;
|
lpdest++;
|
||||||
lzi += r_zistepx;
|
lzi += r_zistepx;
|
||||||
|
@ -719,11 +719,14 @@ R_PolysetDrawSpans8_Opaque (const entity_t *currententity, spanpackage_t *pspanp
|
||||||
{
|
{
|
||||||
if ((lzi >> SHIFT16XYZ) >= *lpz)
|
if ((lzi >> SHIFT16XYZ) >= *lpz)
|
||||||
{
|
{
|
||||||
if(r_newrefdef.rdflags & RDF_IRGOGGLES && currententity->flags & RF_IR_VISIBLE)
|
int color_value;
|
||||||
*lpdest = ((byte *)vid_colormap)[irtable[*lptex]];
|
|
||||||
else
|
|
||||||
*lpdest = ((byte *)vid_colormap)[*lptex + (llight & 0xFF00)];
|
|
||||||
|
|
||||||
|
if(r_newrefdef.rdflags & RDF_IRGOGGLES && currententity->flags & RF_IR_VISIBLE)
|
||||||
|
color_value = irtable[*lptex];
|
||||||
|
else
|
||||||
|
color_value = *lptex + (llight & 0xFF00);
|
||||||
|
|
||||||
|
*lpdest = vid_colormap[color_value];
|
||||||
*lpz = lzi >> SHIFT16XYZ;
|
*lpz = lzi >> SHIFT16XYZ;
|
||||||
zdamaged = true;
|
zdamaged = true;
|
||||||
}
|
}
|
||||||
|
@ -798,7 +801,7 @@ R_RasterizeAliasPolySmooth(const entity_t *currententity)
|
||||||
v = plefttop[1];
|
v = plefttop[1];
|
||||||
d_aspancount = plefttop[0] - prighttop[0];
|
d_aspancount = plefttop[0] - prighttop[0];
|
||||||
|
|
||||||
d_ptex = (byte *)r_affinetridesc.pskin + (plefttop[2] >> SHIFT16XYZ) +
|
d_ptex = r_affinetridesc.pskin + (plefttop[2] >> SHIFT16XYZ) +
|
||||||
(plefttop[3] >> SHIFT16XYZ) * r_affinetridesc.skinwidth;
|
(plefttop[3] >> SHIFT16XYZ) * r_affinetridesc.skinwidth;
|
||||||
{
|
{
|
||||||
d_sfrac = plefttop[2] & 0xFFFF;
|
d_sfrac = plefttop[2] & 0xFFFF;
|
||||||
|
@ -866,7 +869,7 @@ R_RasterizeAliasPolySmooth(const entity_t *currententity)
|
||||||
u = plefttop[0];
|
u = plefttop[0];
|
||||||
v = plefttop[1];
|
v = plefttop[1];
|
||||||
d_aspancount = plefttop[0] - prighttop[0];
|
d_aspancount = plefttop[0] - prighttop[0];
|
||||||
d_ptex = (byte *)r_affinetridesc.pskin + (plefttop[2] >> SHIFT16XYZ) +
|
d_ptex = r_affinetridesc.pskin + (plefttop[2] >> SHIFT16XYZ) +
|
||||||
(plefttop[3] >> SHIFT16XYZ) * r_affinetridesc.skinwidth;
|
(plefttop[3] >> SHIFT16XYZ) * r_affinetridesc.skinwidth;
|
||||||
d_sfrac = 0;
|
d_sfrac = 0;
|
||||||
d_tfrac = 0;
|
d_tfrac = 0;
|
||||||
|
|
Loading…
Reference in a new issue