diff --git a/src/client/refresh/soft/header/local.h b/src/client/refresh/soft/header/local.h index 16be38f7..f66187e8 100644 --- a/src/client/refresh/soft/header/local.h +++ b/src/client/refresh/soft/header/local.h @@ -211,7 +211,7 @@ typedef struct finalvert_s { typedef struct { - void *pskin; + pixel_t *pskin; int skinwidth; int skinheight; } affinetridesc_t; diff --git a/src/client/refresh/soft/sw_alias.c b/src/client/refresh/soft/sw_alias.c index 67a9ba1d..346bdfec 100644 --- a/src/client/refresh/soft/sw_alias.c +++ b/src/client/refresh/soft/sw_alias.c @@ -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.shadelight = j; diff --git a/src/client/refresh/soft/sw_model.c b/src/client/refresh/soft/sw_model.c index 17417b6e..c5fc8be9 100644 --- a/src/client/refresh/soft/sw_model.c +++ b/src/client/refresh/soft/sw_model.c @@ -258,16 +258,17 @@ static void Mod_LoadLighting (model_t *loadmodel, byte *mod_base, lump_t *l) { int i, size; - byte *in; + pixel_t *in; if (!l->filelen) { loadmodel->lightdata = NULL; return; } + size = l->filelen/3; loadmodel->lightdata = Hunk_Alloc(size); - in = (void *)(mod_base + l->fileofs); + in = mod_base + l->fileofs; for (i=0 ; i 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 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; size = (size + 31) & ~31; diff --git a/src/client/refresh/soft/sw_polyset.c b/src/client/refresh/soft/sw_polyset.c index bd4544a8..66c07f51 100644 --- a/src/client/refresh/soft/sw_polyset.c +++ b/src/client/refresh/soft/sw_polyset.c @@ -78,7 +78,7 @@ static zvalue_t d_ziextrastep, d_zibasestep; static byte *skintable[MAX_LBM_HEIGHT]; int skinwidth; -static byte *skinstart; +static pixel_t *skinstart; void (*d_pdrawspans)(const entity_t *currententity, spanpackage_t *pspanpackage); @@ -429,8 +429,8 @@ R_PolysetDrawSpans8 void R_PolysetDrawSpans8_33(const entity_t *currententity, spanpackage_t *pspanpackage) { - byte *lpdest; - byte *lptex; + pixel_t *lpdest; + pixel_t *lptex; int lsfrac, ltfrac; int llight; zvalue_t lzi; @@ -470,7 +470,7 @@ R_PolysetDrawSpans8_33(const entity_t *currententity, spanpackage_t *pspanpackag { int temp = vid_colormap[*lptex + ( llight & 0xFF00 )]; - *lpdest = vid_alphamap[temp+ *lpdest*256]; + *lpdest = vid_alphamap[temp + *lpdest*256]; } lpdest++; lzi += r_zistepx; @@ -719,11 +719,14 @@ R_PolysetDrawSpans8_Opaque (const entity_t *currententity, spanpackage_t *pspanp { if ((lzi >> SHIFT16XYZ) >= *lpz) { - if(r_newrefdef.rdflags & RDF_IRGOGGLES && currententity->flags & RF_IR_VISIBLE) - *lpdest = ((byte *)vid_colormap)[irtable[*lptex]]; - else - *lpdest = ((byte *)vid_colormap)[*lptex + (llight & 0xFF00)]; + int color_value; + 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; zdamaged = true; } @@ -798,7 +801,7 @@ R_RasterizeAliasPolySmooth(const entity_t *currententity) v = plefttop[1]; 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; { d_sfrac = plefttop[2] & 0xFFFF; @@ -866,7 +869,7 @@ R_RasterizeAliasPolySmooth(const entity_t *currententity) u = plefttop[0]; v = plefttop[1]; 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; d_sfrac = 0; d_tfrac = 0;