Merge branch 'Saturn-Next' into Saturn-Testing
This commit is contained in:
commit
0065c3d610
3 files changed
+65
-83
No files matched your search
+24
-22
@@ -55,10 +55,10 @@ static INT32 format2bpp(GLTextureFormat_t format)
|
||||
// It is now split from it for my sanity! (and the sanity of others)
|
||||
// -- Monster Iestyn (13/02/19)
|
||||
static void HWR_DrawColumnInCache(const column_t *patchcol, UINT8 *block, GLMipmap_t *mipmap,
|
||||
INT32 pblockheight, INT32 blockmodulo,
|
||||
fixed_t yfracstep, fixed_t scale_y,
|
||||
texpatch_t *originPatch, INT32 patchheight,
|
||||
INT32 bpp, RGBA_t *palette)
|
||||
INT32 pblockheight, INT32 blockmodulo,
|
||||
fixed_t yfracstep, fixed_t scale_y,
|
||||
texpatch_t *originPatch, INT32 patchheight,
|
||||
INT32 bpp, RGBA_t *palette)
|
||||
{
|
||||
fixed_t yfrac, position, count;
|
||||
UINT8 *dest;
|
||||
@@ -74,9 +74,6 @@ static void HWR_DrawColumnInCache(const column_t *patchcol, UINT8 *block, GLMipm
|
||||
|
||||
(void)patchheight; // This parameter is unused
|
||||
|
||||
if (!mipmap || mipmap == NULL)
|
||||
return;
|
||||
|
||||
if (originPatch) // originPatch can be NULL here, unlike in the software version
|
||||
originy = originPatch->originy;
|
||||
|
||||
@@ -112,10 +109,10 @@ static void HWR_DrawColumnInCache(const column_t *patchcol, UINT8 *block, GLMipm
|
||||
count--;
|
||||
|
||||
texel = source[yfrac>>FRACBITS];
|
||||
alpha = 0xff;
|
||||
alpha = 0xFF;
|
||||
|
||||
//Hurdler: not perfect, but better than holes
|
||||
if (texel == HWR_PATCHES_CHROMAKEY_COLORINDEX && (mipmap->flags & TF_CHROMAKEYED))
|
||||
// Make pixel transparent if chroma keyed
|
||||
if ((mipmap->flags & TF_CHROMAKEYED) && (texel == HWR_PATCHES_CHROMAKEY_COLORINDEX))
|
||||
alpha = 0x00;
|
||||
|
||||
//Hurdler: 25/04/2000: now support colormap in hardware mode
|
||||
@@ -127,7 +124,8 @@ static void HWR_DrawColumnInCache(const column_t *patchcol, UINT8 *block, GLMipm
|
||||
// Alam: SRB2 uses Mingw, HUGS
|
||||
switch (bpp)
|
||||
{
|
||||
case 2 : texelu16 = (UINT16)((alpha<<8) | texel);
|
||||
case 2 : // uhhhhhhhh..........
|
||||
texelu16 = (UINT16)((alpha<<8) | texel);
|
||||
memcpy(dest, &texelu16, sizeof(UINT16));
|
||||
break;
|
||||
case 3 : colortemp = palette[texel];
|
||||
@@ -145,6 +143,7 @@ static void HWR_DrawColumnInCache(const column_t *patchcol, UINT8 *block, GLMipm
|
||||
dest += blockmodulo;
|
||||
yfrac += yfracstep;
|
||||
}
|
||||
|
||||
patchcol = (const column_t *)((const UINT8 *)patchcol + patchcol->length + 4);
|
||||
}
|
||||
}
|
||||
@@ -186,6 +185,7 @@ static void HWR_DrawPatchInCache(GLMipmap_t *mipmap,
|
||||
if (bpp < 1 || bpp > 4)
|
||||
I_Error("HWR_DrawPatchInCache: no drawer defined for this bpp (%d)\n",bpp);
|
||||
|
||||
// NOTE: should this actually be pblockwidth*bpp?
|
||||
blockmodulo = pblockwidth*bpp;
|
||||
|
||||
// Draw each column to the block cache
|
||||
@@ -264,6 +264,7 @@ static void HWR_DrawTexturePatchInCache(GLMipmap_t *mipmap,
|
||||
if (bpp < 1 || bpp > 4)
|
||||
I_Error("HWR_DrawTexturePatchInCache: no drawer defined for this bpp (%d)\n",bpp);
|
||||
|
||||
// NOTE: should this actually be pblockwidth*bpp?
|
||||
blockmodulo = pblockwidth*bpp;
|
||||
|
||||
// Draw each column to the block cache
|
||||
@@ -337,8 +338,8 @@ static void HWR_GenerateTexture(INT32 texnum, GLMapTexture_t *gltex, boolean noe
|
||||
else
|
||||
gltex->mipmap.flags = TF_CHROMAKEYED | TF_WRAPXY;
|
||||
|
||||
gltex->mipmap.width = SHORT(texture->width);
|
||||
gltex->mipmap.height = SHORT(texture->height);
|
||||
gltex->mipmap.width = (UINT16)(texture->width);
|
||||
gltex->mipmap.height = (UINT16)(texture->height);
|
||||
|
||||
if (skyspecial)
|
||||
gltex->mipmap.format = GL_TEXFMT_RGBA; // that skyspecial code below assumes this format ...
|
||||
@@ -363,14 +364,17 @@ static void HWR_GenerateTexture(INT32 texnum, GLMapTexture_t *gltex, boolean noe
|
||||
RGBA_t col;
|
||||
|
||||
col = palette[HWR_CHROMAKEY_EQUIVALENTCOLORINDEX];
|
||||
|
||||
for (j = 0; j < blockheight; j++)
|
||||
{
|
||||
for (i = 0; i < blockwidth; i++)
|
||||
{
|
||||
block[4*(j*blockwidth+i)+0] = col.s.red;
|
||||
block[4*(j*blockwidth+i)+1] = col.s.green;
|
||||
block[4*(j*blockwidth+i)+2] = col.s.blue;
|
||||
block[4*(j*blockwidth+i)+3] = 0xff;
|
||||
int idx = (j*blockwidth+i);
|
||||
|
||||
block[4*idx+0] = col.s.red;
|
||||
block[4*idx+1] = col.s.green;
|
||||
block[4*idx+2] = col.s.blue;
|
||||
block[4*idx+3] = 0xff;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -379,15 +383,12 @@ static void HWR_GenerateTexture(INT32 texnum, GLMapTexture_t *gltex, boolean noe
|
||||
for (i = 0, patch = texture->patches; i < texture->patchcount; i++, patch++)
|
||||
{
|
||||
realpatch = W_CacheLumpNumPwad(patch->wad, patch->lump, PU_CACHE);
|
||||
HWR_DrawTexturePatchInCache(&gltex->mipmap,
|
||||
blockwidth, blockheight,
|
||||
texture, patch,
|
||||
realpatch);
|
||||
HWR_DrawTexturePatchInCache(&gltex->mipmap, blockwidth, blockheight, texture, patch, realpatch);
|
||||
Z_ChangeTag(realpatch, PU_HWRCACHE_UNLOCKED);
|
||||
}
|
||||
|
||||
//Hurdler: not efficient at all but I don't remember exactly how HWR_DrawPatchInCache works :(
|
||||
if (format2bpp(gltex->mipmap.format)==4)
|
||||
if (format2bpp(gltex->mipmap.format) == 4)
|
||||
{
|
||||
for (i = 3; i < blocksize*4; i += 4) // blocksize*4 because blocksize doesn't include the bpp
|
||||
{
|
||||
@@ -438,6 +439,7 @@ void HWR_MakePatch (patch_t *patch, GLPatch_t *glPatch, GLMipmap_t *glMipmap, bo
|
||||
if (makebitmap)
|
||||
{
|
||||
MakeBlock(glMipmap);
|
||||
|
||||
HWR_DrawPatchInCache(glMipmap,
|
||||
glMipmap->width, glMipmap->height,
|
||||
glPatch->width, glPatch->height,
|
||||
|
||||
+10
-3
@@ -10209,19 +10209,26 @@ void P_SpawnPrecipitation(void)
|
||||
if (dedicated || !cv_drawdist_precip.value || curWeather == PRECIP_NONE) // SRB2Kart
|
||||
return;
|
||||
|
||||
fixed_t density = (cv_mobjscaleprecip.value ? mapobjectscale : FRACUNIT);
|
||||
|
||||
if (cv_lessprecip.value)
|
||||
density *= 2; // just spawn half the precip
|
||||
|
||||
// Use the blockmap to narrow down our placing patterns
|
||||
for (i = 0; i < bmapwidth*bmapheight; ++i)
|
||||
{
|
||||
basex = bmaporgx + (i % bmapwidth) * MAPBLOCKSIZE;
|
||||
basey = bmaporgy + (i / bmapwidth) * MAPBLOCKSIZE;
|
||||
|
||||
for (j = 0; j < FRACUNIT; j += cv_mobjscaleprecip.value ? mapobjectscale : FRACUNIT)
|
||||
// If mobjscale < FRACUNIT, each blockmap cell covers
|
||||
// more area so spawn more precipitation in that area.
|
||||
for (j = 0; j < FRACUNIT; j += density)
|
||||
{
|
||||
INT32 floorz;
|
||||
INT32 ceilingz;
|
||||
|
||||
x = ((cv_lessprecip.value ? basex*1.5 : basex) + ((M_RandomKey(MAPBLOCKUNITS<<3)<<FRACBITS)>>3));
|
||||
y = ((cv_lessprecip.value ? basey*1.5 : basey) + ((M_RandomKey(MAPBLOCKUNITS<<3)<<FRACBITS)>>3));
|
||||
x = basex + ((M_RandomKey(MAPBLOCKUNITS << 3) << FRACBITS) >> 3);
|
||||
y = basey + ((M_RandomKey(MAPBLOCKUNITS << 3) << FRACBITS) >> 3);
|
||||
|
||||
precipsector = R_IsPointInSubsector(x, y);
|
||||
|
||||
|
||||
+31
-58
@@ -1807,27 +1807,23 @@ void P_SwitchWeather(INT32 weathernum)
|
||||
|
||||
precipmobj = (precipmobj_t *)think;
|
||||
|
||||
mobjtype_t type = 0;
|
||||
INT32 z = 0;
|
||||
|
||||
if (swap == PRECIP_BLANK || swap == PRECIP_STORM_NORAIN) // Remove precip, but keep it around for reuse.
|
||||
{
|
||||
precipmobj->precipflags |= PCF_INVISIBLE;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (swap == PRECIP_RAIN) // Snow To Rain
|
||||
{
|
||||
precipmobj->type = MT_RAIN; // proper set the type
|
||||
precipmobj->info = &mobjinfo[MT_RAIN];
|
||||
precipmobj->flags = mobjinfo[MT_RAIN].flags;
|
||||
st = &states[mobjinfo[MT_RAIN].spawnstate];
|
||||
precipmobj->state = st;
|
||||
precipmobj->tics = st->tics;
|
||||
precipmobj->sprite = st->sprite;
|
||||
precipmobj->frame = st->frame;
|
||||
precipmobj->momz = cv_mobjscaleprecip.value ? FixedMul(mobjinfo[MT_RAIN].speed, mapobjectscale) : mobjinfo[MT_RAIN].speed;
|
||||
|
||||
precipmobj->precipflags &= ~(PCF_INVISIBLE|PCF_SPLASH); // P_PrecipThinker will add this again if it needs to
|
||||
type = MT_RAIN;
|
||||
}
|
||||
else if (swap == PRECIP_SNOW) // Rain To Snow
|
||||
{
|
||||
INT32 z;
|
||||
type = MT_SNOWFLAKE;
|
||||
|
||||
precipmobj->type = MT_SNOWFLAKE; // proper set the type
|
||||
precipmobj->info = &mobjinfo[MT_SNOWFLAKE];
|
||||
precipmobj->flags = mobjinfo[MT_SNOWFLAKE].flags;
|
||||
z = M_RandomByte();
|
||||
|
||||
if (z < 64)
|
||||
@@ -1836,92 +1832,69 @@ void P_SwitchWeather(INT32 weathernum)
|
||||
z = 1;
|
||||
else
|
||||
z = 0;
|
||||
|
||||
st = &states[mobjinfo[MT_SNOWFLAKE].spawnstate+z];
|
||||
precipmobj->state = st;
|
||||
precipmobj->tics = st->tics;
|
||||
precipmobj->sprite = st->sprite;
|
||||
precipmobj->frame = st->frame;
|
||||
precipmobj->momz = cv_mobjscaleprecip.value ? FixedMul(mobjinfo[MT_SNOWFLAKE].speed, mapobjectscale) : mobjinfo[MT_SNOWFLAKE].speed;
|
||||
|
||||
precipmobj->precipflags &= ~(PCF_INVISIBLE|PCF_SPLASH); // P_PrecipThinker will add this again if it needs to
|
||||
}
|
||||
else if (swap == PRECIP_BLANK || swap == PRECIP_STORM_NORAIN) // Remove precip, but keep it around for reuse.
|
||||
{
|
||||
precipmobj->precipflags |= PCF_INVISIBLE;
|
||||
}
|
||||
|
||||
precipmobj->type = type; // proper set the type
|
||||
precipmobj->info = &mobjinfo[type];
|
||||
precipmobj->flags = mobjinfo[type].flags;
|
||||
|
||||
st = &states[mobjinfo[type].spawnstate+z];
|
||||
|
||||
precipmobj->state = st;
|
||||
precipmobj->tics = st->tics;
|
||||
precipmobj->sprite = st->sprite;
|
||||
precipmobj->frame = st->frame;
|
||||
precipmobj->momz = (cv_mobjscaleprecip.value ? FixedMul(mobjinfo[type].speed, mapobjectscale) : mobjinfo[type].speed);
|
||||
|
||||
precipmobj->precipflags &= ~(PCF_INVISIBLE|PCF_SPLASH); // P_PrecipThinker will add this again if it needs to
|
||||
}
|
||||
}
|
||||
|
||||
boolean dontspawn = false;
|
||||
|
||||
switch (weathernum)
|
||||
{
|
||||
case PRECIP_SNOW: // snow
|
||||
curWeather = PRECIP_SNOW;
|
||||
|
||||
if (!swap)
|
||||
P_SpawnPrecipitation();
|
||||
|
||||
break;
|
||||
case PRECIP_RAIN: // rain
|
||||
{
|
||||
boolean dontspawn = false;
|
||||
|
||||
if (curWeather == PRECIP_RAIN || curWeather == PRECIP_STORM || curWeather == PRECIP_STORM_NOSTRIKES)
|
||||
dontspawn = true;
|
||||
|
||||
curWeather = PRECIP_RAIN;
|
||||
|
||||
if (!dontspawn && !swap)
|
||||
P_SpawnPrecipitation();
|
||||
|
||||
break;
|
||||
}
|
||||
case PRECIP_STORM: // storm
|
||||
{
|
||||
boolean dontspawn = false;
|
||||
|
||||
if (curWeather == PRECIP_RAIN || curWeather == PRECIP_STORM || curWeather == PRECIP_STORM_NOSTRIKES)
|
||||
dontspawn = true;
|
||||
|
||||
curWeather = PRECIP_STORM;
|
||||
|
||||
if (!dontspawn && !swap)
|
||||
P_SpawnPrecipitation();
|
||||
|
||||
break;
|
||||
}
|
||||
case PRECIP_STORM_NOSTRIKES: // storm w/o lightning
|
||||
{
|
||||
boolean dontspawn = false;
|
||||
|
||||
if (curWeather == PRECIP_RAIN || curWeather == PRECIP_STORM || curWeather == PRECIP_STORM_NOSTRIKES)
|
||||
dontspawn = true;
|
||||
|
||||
curWeather = PRECIP_STORM_NOSTRIKES;
|
||||
|
||||
if (!dontspawn && !swap)
|
||||
P_SpawnPrecipitation();
|
||||
|
||||
break;
|
||||
}
|
||||
case PRECIP_STORM_NORAIN: // storm w/o rain
|
||||
curWeather = PRECIP_STORM_NORAIN;
|
||||
|
||||
if (!swap)
|
||||
P_SpawnPrecipitation();
|
||||
|
||||
break;
|
||||
case PRECIP_BLANK:
|
||||
curWeather = PRECIP_BLANK;
|
||||
|
||||
if (!swap)
|
||||
P_SpawnPrecipitation();
|
||||
|
||||
break;
|
||||
default:
|
||||
dontspawn = true;
|
||||
curWeather = PRECIP_NONE;
|
||||
break;
|
||||
}
|
||||
|
||||
if (!dontspawn && !swap)
|
||||
P_SpawnPrecipitation();
|
||||
}
|
||||
|
||||
/** Gets an object.
|
||||
|
||||
Reference in new issue
Block a user