* Added redink1's "soft shadow improvement" patch

* (proton) Fixed issue with blitting alpha things to the background, fixed the soft shadows for things rendered into the background
* Versioned to 1.7.1, was distributed as beta

git-svn-id: svn://rtsoft.com/rtsvn/projects/RTDink@1481 353e56fe-9613-0410-8469-b96ad8e6f29c
This commit is contained in:
seth 2017-09-15 00:53:18 +00:00
parent 72d2a12be6
commit e0717ae8d1
5 changed files with 69 additions and 22 deletions

View file

@ -434,7 +434,7 @@ bool App::Init()
bool bFileExisted;
m_varDB.Load("save.dat", &bFileExisted);
GetApp()->GetVarWithDefault("smoothing",uint32(1))->GetUINT32();
GetApp()->GetVarWithDefault("smoothing",uint32(0))->GetUINT32();
GetApp()->GetVarWithDefault("buttons",uint32(0));
@ -443,7 +443,10 @@ bool App::Init()
#ifdef PLATFORM_WINDOWS
//If you don't have directx, just comment out this and remove the dx lib dependency, directx is only used for the
GetApp()->GetVarWithDefault("checkerboard_fix", uint32(1)); //default to on for Windows
//If you don't have directx, just comment out this and remove the dx lib dependency, directx is only used for the
//gamepad input on windows
GetGamepadManager()->AddProvider(new GamepadProviderDirectX); //use directx joysticks
#endif
@ -525,7 +528,8 @@ if (GetEmulatedPlatformID() == PLATFORM_ID_IOS)
int videox = GetApp()->GetVarWithDefault("video_x", uint32(640))->GetUINT32();
int videoy = GetApp()->GetVarWithDefault("video_y", uint32(480))->GetUINT32();
int fullscreen = GetApp()->GetVarWithDefault("fullscreen", uint32(1))->GetUINT32();
//bool borderlessfullscreen = GetApp()->GetVarWithDefault("fullscreen", uint32(1))->GetUINT32();
bool borderlessfullscreen = GetApp()->GetVarWithDefault("fullscreen", uint32(0))->GetUINT32();
if (fullscreen && g_bUseBorderlessFullscreenOnWindows)
@ -902,11 +906,11 @@ bool App::OnPreInitVideo()
g_winVideoScreenX = pVarX->GetUINT32();
g_winVideoScreenY = pVarY->GetUINT32();
g_bIsFullScreen = temp.GetVarWithDefault("fullscreen", uint32(1))->GetUINT32();
g_bUseBorderlessFullscreenOnWindows = temp.GetVarWithDefault("borderless_fullscreen", uint32(0))->GetUINT32() != 0;
}
g_bIsFullScreen = temp.GetVarWithDefault("fullscreen", uint32(1))->GetUINT32();
g_bUseBorderlessFullscreenOnWindows = temp.GetVarWithDefault("borderless_fullscreen", uint32(0))->GetUINT32() != 0;
#endif
return true;

View file

@ -134,6 +134,16 @@ void OptionsMenuOnSelect(VariantList *pVList) //0=vec2 point of click, 1=entity
DinkOnForeground();
}
if (pEntClicked->GetName() == "check_checkboard")
{
bool bChecked = IsCheckboxChecked(pEntClicked);
GetApp()->GetVar("checkerboard_fix")->Set(uint32(bChecked));
GetApp()->UpdateVideoSettings();
DinkUnloadUnusedGraphicsByUsageTime(0); //unload anything not used in the last second
DinkReInitSurfacesAfterVideoChange();
DinkOnForeground();
}
#ifdef WINAPI
if (pEntClicked->GetName() == "check_borderless")
{
@ -446,8 +456,7 @@ void OptionsMenuAddScrollContent(Entity *pParent)
y += spacerY;
}
bool bStretchToFit = GetApp()->GetVar("check_stretch")->GetUINT32() != 0;
pEnt = CreateCheckbox(pBG, "check_stretch", "Force screen stretching (ignore aspect ratio)", startX, y, bStretchToFit, FONT_SMALL, 1.0f);
pEnt->GetFunction("OnButtonSelected")->sig_function.connect(&OptionsMenuOnSelect);
@ -462,6 +471,12 @@ void OptionsMenuAddScrollContent(Entity *pParent)
y += spacerY;
#endif
bool bCheckerboardFix = GetApp()->GetVar("checkerboard_fix")->GetUINT32() != 0;
pEnt = CreateCheckbox(pBG, "check_checkboard", "Apply improved shadows", startX, y, bCheckerboardFix, FONT_SMALL, 1.0f);
pEnt->GetFunction("OnButtonSelected")->sig_function.connect(&OptionsMenuOnSelect);
y += GetSize2DEntity(pEnt).y;
y += spacerY;
//fps limit
pEnt = CreateTextLabelEntity(pBG, "", startX, y, "FPS lock:");

View file

@ -5063,6 +5063,7 @@ void draw_sprite_game(LPDIRECTDRAWSURFACE lpdest,int h)
//convert it to a high color surface on the fly, without losing the data on it
LPDIRECTDRAWSURFACE pNewSurf = InitOffscreenSurface(C_DINK_SCREENSIZE_X, C_DINK_SCREENSIZE_Y, IDirectDrawSurface::MODE_SHADOW_GL, true, lpdest->m_pSurf);
LogMsg("Detected high color bmps that need to drawn to the static landscape, converting backbuffers to 32 bit on the fly.");
delete lpDDSBackGround;
@ -5070,16 +5071,16 @@ void draw_sprite_game(LPDIRECTDRAWSURFACE lpdest,int h)
if (lpDDSBuffer->m_pSurf->GetSurfaceType() == SoftSurface::SURFACE_PALETTE_8BIT)
{
//this one too
delete lpDDSBuffer;
lpDDSBuffer = InitOffscreenSurface(C_DINK_SCREENSIZE_X, C_DINK_SCREENSIZE_Y, IDirectDrawSurface::MODE_SHADOW_GL, true);
delete lpDDSBuffer;
lpDDSBuffer = InitOffscreenSurface(C_DINK_SCREENSIZE_X, C_DINK_SCREENSIZE_Y, IDirectDrawSurface::MODE_SHADOW_GL, true);
lpDDSBuffer->m_pGLSurf->SetUsesAlpha(true);
}
}
}
ddrval = lpdest->Blt(&dstRect, g_pSpriteSurface[getpic(h)],
&srcRect , DDBLT_KEYSRC ,&ddbltfx );
@ -5528,7 +5529,8 @@ void place_sprites_game(bool bBackgroundOnly )
//it requires scaling, need to do things differently as our low mem fast custom blits won't work with this
bScaledBackgroundSpritesRequired = true;
}
if (bScaledBackgroundSpritesRequired)
if (bScaledBackgroundSpritesRequired)
{
g_dglo.m_bgSpriteMan.Add(sprite);
@ -6145,6 +6147,7 @@ restart:
if (bRequireRebuild) goto restart;
g_tileScreens[tileScreenID]->UpdateLastUsedTime();
lpDDSBackGround->BltFast( (x * 50 - ((x / 12) * 600))+g_gameAreaLeftOffset, (x / 12) * 50, g_tileScreens[tileScreenID],
&rcRect, DDBLTFAST_NOCOLORKEY| DDBLTFAST_WAIT );
}
@ -15841,6 +15844,7 @@ LastWindowsTimer = GetTickCount();
EndProcessTransition();
if (g_dglos.g_stopEntireGame == 1)
{
if (g_dglos.g_talkInfo.active)
@ -15896,10 +15900,14 @@ LastWindowsTimer = GetTickCount();
if (g_dglos.screenlock == 1)
{
#ifdef _DEBUG
/*
if (debug_mode)
{
//CHEAT - ignore screenlocks
g_dglos.screenlock = 0;
}
*/
#endif
drawscreenlock();
}
@ -15941,16 +15949,14 @@ flip:
if (turn_on_plane) g_dglos.plane_process = true;
BlitSecondTransitionScreen();
if (g_bTransitionActive)
{
SetOrthoRenderSize(C_DINK_SCREENSIZE_X, g_dglo.m_orthoRenderRect.GetHeight(), 0, -g_dglo.m_orthoRenderRect.top);
BlitGUIOverlay();
RemoveOrthoRenderSize();
}
if (bCaptureScreen)
{
//reset the timer because we probably just wasted a bunch loading crap

View file

@ -36,19 +36,21 @@ IDirectDrawSurface * LoadBitmapIntoSurface(const char *pName, eTransparencyType
pSurf->m_mode = mode;
pSurf->m_pSurf = new SoftSurface;
bool bUseCheckerboardFix = GetApp()->GetVar("checkerboard_fix")->GetUINT32() != 0;
if (pMem)
{
#ifdef _DEBUG
//LogMsg("loading DDRAW bmp from mem");
#endif
//if this is set, ignore the filename
pSurf->m_pSurf->LoadFileFromMemory(pMem, SoftSurface::eColorKeyType(trans));
pSurf->m_pSurf->LoadFileFromMemory(pMem, SoftSurface::eColorKeyType(trans), 0, false, bUseCheckerboardFix);
} else
{
#ifdef _DEBUG
//LogMsg("loading DDRAW bmp from file");
#endif
pSurf->m_pSurf->LoadFile(pName, SoftSurface::eColorKeyType(trans), false);
pSurf->m_pSurf->LoadFile(pName, SoftSurface::eColorKeyType(trans), false, bUseCheckerboardFix);
}
//LogMsg("loaded bitmap");
@ -96,6 +98,7 @@ IDirectDrawSurface * InitOffscreenSurface(int x, int y, IDirectDrawSurface::eMod
{
pdds->m_pSurf->Init(x,y, SoftSurface::SURFACE_RGBA);
pdds->m_pSurf->SetHasPremultipliedAlpha(true);
pdds->m_pSurf->SetUsesAlpha(true);
} else
{
pdds->m_pSurf->Init(x,y, SoftSurface::SURFACE_PALETTE_8BIT);
@ -335,7 +338,7 @@ int IDirectDrawSurface::BltFast( int x, int y, IDirectDrawSurface *pSrcSurf, rtR
//we need to copy from what is already on the screen
m_pSurf->BlitFromScreen(x, y, pSrcRect->left, pSrcRect->top, pSrcRect->GetWidth(), pSrcRect->GetHeight());
//m_pSurf->Blit(x, y, lpDDSBackGround->m_pSurf, pSrcRect->left, pSrcRect->top, pSrcRect->GetWidth(), pSrcRect->GetHeight());
m_pSurf->SetUsesAlpha(false);
//m_pSurf->SetUsesAlpha(false);
} else
{
m_pSurf->Blit(x, y, pSrcSurf->m_pSurf, pSrcRect->left, pSrcRect->top, pSrcRect->GetWidth(), pSrcRect->GetHeight());