This commit is contained in:
Rachael Alexanderson 2017-06-07 16:46:21 -04:00
commit 717e9dd0d8
10 changed files with 44 additions and 149 deletions

View file

@ -167,50 +167,6 @@ void gl_GenerateGlobalBrightmapFromColormap()
}
}
//===========================================================================
//
// averageColor
// input is RGBA8 pixel format.
// The resulting RGB color can be scaled uniformly so that the highest
// component becomes one.
//
//===========================================================================
static PalEntry averageColor(const uint32_t *data, int size, int maxout)
{
int i;
unsigned int r, g, b;
// First clear them.
r = g = b = 0;
if (size==0)
{
return PalEntry(255,255,255);
}
for(i = 0; i < size; i++)
{
r += BPART(data[i]);
g += GPART(data[i]);
b += RPART(data[i]);
}
r = r/size;
g = g/size;
b = b/size;
int maxv=MAX(MAX(r,g),b);
if(maxv && maxout)
{
r = Scale(r, maxout, maxv);
g = Scale(g, maxout, maxv);
b = Scale(b, maxout, maxv);
}
return PalEntry(255,r,g,b);
}
//==========================================================================
//

View file

@ -6718,6 +6718,8 @@ bool P_CheckMissileSpawn (AActor* th, double maxdist)
th->tics = 1;
}
DVector3 newpos = th->Pos();
if (maxdist > 0)
{
// move a little forward so an angle can be computed if it immediately explodes
@ -6731,7 +6733,7 @@ bool P_CheckMissileSpawn (AActor* th, double maxdist)
advance *= 0.5f;
}
while (advance.XY().LengthSquared() >= maxsquared);
th->SetXYZ(th->Pos() + advance);
newpos += advance;
}
FCheckPosition tm(!!(th->flags2 & MF2_RIP));
@ -6755,7 +6757,9 @@ bool P_CheckMissileSpawn (AActor* th, double maxdist)
bool MBFGrenade = (!(th->flags & MF_MISSILE) || (th->BounceFlags & BOUNCE_MBF));
// killough 3/15/98: no dropoff (really = don't care for missiles)
if (!(P_TryMove (th, th->Pos(), false, NULL, tm, true)))
auto oldf2 = th->flags2;
th->flags2 &= ~MF2_MCROSS; // The following check is not supposed to activate missile triggers.
if (!(P_TryMove (th, newpos, false, NULL, tm, true)))
{
// [RH] Don't explode ripping missiles that spawn inside something
if (th->BlockingMobj == NULL || !(th->flags2 & MF2_RIP) || (th->BlockingMobj->flags5 & MF5_DONTRIP))
@ -6778,6 +6782,7 @@ bool P_CheckMissileSpawn (AActor* th, double maxdist)
return false;
}
}
th->flags2 = oldf2;
th->ClearInterpolation();
return true;
}

View file

@ -848,40 +848,37 @@ void FTexture::SetScaledSize(int fitwidth, int fitheight)
//
//===========================================================================
namespace
PalEntry FTexture::averageColor(const uint32_t *data, int size, int maxout)
{
PalEntry averageColor(const uint32_t *data, int size, int maxout)
int i;
unsigned int r, g, b;
// First clear them.
r = g = b = 0;
if (size == 0)
{
int i;
unsigned int r, g, b;
// First clear them.
r = g = b = 0;
if (size == 0)
{
return PalEntry(255, 255, 255);
}
for (i = 0; i < size; i++)
{
b += BPART(data[i]);
g += GPART(data[i]);
r += RPART(data[i]);
}
r = r / size;
g = g / size;
b = b / size;
int maxv = MAX(MAX(r, g), b);
if (maxv && maxout)
{
r = Scale(r, maxout, maxv);
g = Scale(g, maxout, maxv);
b = Scale(b, maxout, maxv);
}
return PalEntry(255, r, g, b);
return PalEntry(255, 255, 255);
}
for (i = 0; i < size; i++)
{
b += BPART(data[i]);
g += GPART(data[i]);
r += RPART(data[i]);
}
r = r / size;
g = g / size;
b = b / size;
int maxv = MAX(MAX(r, g), b);
if (maxv && maxout)
{
r = ::Scale(r, maxout, maxv);
g = ::Scale(g, maxout, maxv);
b = ::Scale(b, maxout, maxv);
}
return PalEntry(255, r, g, b);
}
PalEntry FTexture::GetSkyCapColor(bool bottom)

View file

@ -307,6 +307,7 @@ public:
void SetScaledSize(int fitwidth, int fitheight);
PalEntry GetSkyCapColor(bool bottom);
static PalEntry averageColor(const uint32_t *data, int size, int maxout);
virtual void HackHack (int newheight); // called by FMultipatchTexture to discover corrupt patches.

View file

@ -2638,7 +2638,7 @@ void D3DFB::DoClear (int left, int top, int right, int bottom, int palcolor, uin
{
if (In2D < 2)
{
//Super::Clear(left, top, right, bottom, palcolor, color);
Super::DoClear(left, top, right, bottom, palcolor, color);
return;
}
if (!InScene)

View file

@ -87,7 +87,6 @@ extern IDirectDraw2 *DDraw;
// PUBLIC DATA DEFINITIONS -------------------------------------------------
CVAR (Bool, vid_palettehack, false, CVAR_ARCHIVE|CVAR_GLOBALCONFIG)
CVAR (Bool, vid_attachedsurfaces, false, CVAR_ARCHIVE|CVAR_GLOBALCONFIG)
CVAR (Bool, vid_noblitter, true, CVAR_ARCHIVE|CVAR_GLOBALCONFIG)
CVAR (Int, vid_displaybits, 8, CVAR_ARCHIVE|CVAR_GLOBALCONFIG)
CUSTOM_CVAR (Float, rgamma, 1.f, CVAR_ARCHIVE|CVAR_GLOBALCONFIG)
@ -264,16 +263,8 @@ bool DDrawFB::CreateResources ()
}
LOG3 ("Mode set to %d x %d x %d\n", Width, Height, bits);
if (vid_attachedsurfaces && OSPlatform == os_WinNT4)
{
if (!CreateSurfacesAttached ())
return false;
}
else
{
if (!CreateSurfacesComplex ())
return false;
}
if (!CreateSurfacesComplex ())
return false;
if (UseBlitter)
{

View file

@ -1191,11 +1191,7 @@ void I_StartupMouse ()
{
case 0:
default:
if (OSPlatform == os_WinNT4)
{
new_mousemode = MM_Win32;
}
else if (MyRegisterRawInputDevices != NULL)
if (MyRegisterRawInputDevices != NULL)
{
new_mousemode = MM_RawInput;
}

View file

@ -168,7 +168,6 @@ int (*I_GetTime) (bool saveMS);
int (*I_WaitForTic) (int);
void (*I_FreezeTime) (bool frozen);
os_t OSPlatform;
bool gameisdead;
// PRIVATE DATA DEFINITIONS ------------------------------------------------
@ -542,24 +541,7 @@ void I_DetectOS(void)
switch (info.dwPlatformId)
{
case VER_PLATFORM_WIN32_WINDOWS:
OSPlatform = os_Win95;
if (info.dwMinorVersion < 10)
{
osname = "95";
}
else if (info.dwMinorVersion < 90)
{
osname = "98";
}
else
{
osname = "Me";
}
break;
case VER_PLATFORM_WIN32_NT:
OSPlatform = info.dwMajorVersion < 5 ? os_WinNT4 : os_Win2k;
osname = "NT";
if (info.dwMajorVersion == 5)
{
@ -605,31 +587,14 @@ void I_DetectOS(void)
break;
default:
OSPlatform = os_unknown;
osname = "Unknown OS";
break;
}
if (OSPlatform == os_Win95)
{
if (!batchrun) Printf ("OS: Windows %s %lu.%lu.%lu %s\n",
osname,
info.dwMajorVersion, info.dwMinorVersion,
info.dwBuildNumber & 0xffff, info.szCSDVersion);
}
else
{
if (!batchrun) Printf ("OS: Windows %s (NT %lu.%lu) Build %lu\n %s\n",
osname,
info.dwMajorVersion, info.dwMinorVersion,
info.dwBuildNumber, info.szCSDVersion);
}
if (OSPlatform == os_unknown)
{
if (!batchrun) Printf ("(Assuming Windows 2000)\n");
OSPlatform = os_Win2k;
}
if (!batchrun) Printf ("OS: Windows %s (NT %lu.%lu) Build %lu\n %s\n",
osname,
info.dwMajorVersion, info.dwMinorVersion,
info.dwBuildNumber, info.szCSDVersion);
}
//==========================================================================

View file

@ -47,15 +47,6 @@ extern void SetLanguageIDs ();
// [RH] Detects the OS the game is running under.
void I_DetectOS (void);
typedef enum {
os_unknown,
os_Win95,
os_WinNT4,
os_Win2k
} os_t;
extern os_t OSPlatform;
// Called by DoomMain.
void I_Init (void);

View file

@ -325,13 +325,6 @@ void Win32Video::InitDDraw ()
}
else
{
if (OSPlatform == os_Win95)
{
// Windows 95 will let us use Mode X. If we didn't find any linear
// modes in the loop above, add the Mode X modes here.
AddMode (320, 200, 8, 200, 0);
AddMode (320, 240, 8, 240, 0);
}
AddLowResModes ();
}
AddLetterboxModes ();