Add a draw mode which shows the background 8-bit surface

lights3
Armin Burgmeier 2015-07-14 20:44:11 -04:00
parent 0d806fbcbf
commit 08ae643c2c
5 changed files with 19 additions and 12 deletions

View File

@ -2891,7 +2891,7 @@ bool C4Game::InitKeyboard()
KeyboardInput.RegisterKey(new C4CustomKey(C4KeyCodeEx(K_F5, KEYS_Control), "DbgModeToggle", KEYSCOPE_Generic, new C4KeyCB <C4Game> (*this, &C4Game::ToggleDebugMode)));
KeyboardInput.RegisterKey(new C4CustomKey(C4KeyCodeEx(K_F6, KEYS_Control), "DbgShowVtxToggle", KEYSCOPE_Generic, new C4KeyCB <C4GraphicsSystem>(GraphicsSystem, &C4GraphicsSystem::ToggleShowVertices)));
KeyboardInput.RegisterKey(new C4CustomKey(C4KeyCodeEx(K_F7, KEYS_Control), "DbgShowActionToggle", KEYSCOPE_Generic, new C4KeyCB <C4GraphicsSystem>(GraphicsSystem, &C4GraphicsSystem::ToggleShowAction)));
KeyboardInput.RegisterKey(new C4CustomKey(C4KeyCodeEx(K_F8, KEYS_Control), "DbgShowSolidMaskToggle", KEYSCOPE_Generic, new C4KeyCB <C4GraphicsSystem>(GraphicsSystem, &C4GraphicsSystem::ToggleShowSolidMask)));
KeyboardInput.RegisterKey(new C4CustomKey(C4KeyCodeEx(K_F8, KEYS_Control), "DbgShow8BitSurface", KEYSCOPE_Generic, new C4KeyCB <C4GraphicsSystem>(GraphicsSystem, &C4GraphicsSystem::ToggleShow8BitSurface)));
// video recording - improve...
KeyboardInput.RegisterKey(new C4CustomKey(C4KeyCodeEx(K_ADD, KEYS_Alt), "VideoEnlarge", KEYSCOPE_Generic, new C4KeyCB <C4Video> (GraphicsSystem.Video, &C4Video::Enlarge)));

View File

@ -171,7 +171,7 @@ void C4GraphicsSystem::Default()
ShowEntrance=false;
ShowPathfinder=false;
ShowNetstatus=false;
ShowSolidMask=false;
Show8BitSurface=0;
ShowLights=false;
ShowHelp=false;
FlashMessageText[0]=0;
@ -310,7 +310,7 @@ void C4GraphicsSystem::DeactivateDebugOutput()
ShowEntrance=false;
ShowPathfinder=false; // allow pathfinder! - why this??
ShowLights=false;
ShowSolidMask=false;
Show8BitSurface=0;
ShowNetstatus=false;
}
@ -405,7 +405,7 @@ void C4GraphicsSystem::DrawHelp()
strText.AppendFormat("<c ffff00>%s</c> - %s\n", GetKeyboardInputName("DbgModeToggle").getData(), LoadResStr("IDS_CTL_DEBUGMODE"));
strText.AppendFormat("<c ffff00>%s</c> - %s\n", GetKeyboardInputName("DbgShowVtxToggle").getData(), "Entrance+Vertices");
strText.AppendFormat("<c ffff00>%s</c> - %s\n", GetKeyboardInputName("DbgShowActionToggle").getData(), "Actions/Commands/Pathfinder");
strText.AppendFormat("<c ffff00>%s</c> - %s\n", GetKeyboardInputName("DbgShowSolidMaskToggle").getData(), "SolidMasks");
strText.AppendFormat("<c ffff00>%s</c> - %s\n", GetKeyboardInputName("DbgShow8BitSurface").getData(), "8-bit surfaces");
pDraw->TextOut(strText.getData(), ::GraphicsResource.FontRegular, 1.0, FullScreen.pSurface,
iX + iWdt/2 + 64, iY + 64, C4Draw::DEFAULT_MESSAGE_COLOR, ALeft);
}
@ -441,11 +441,16 @@ bool C4GraphicsSystem::ToggleShowAction()
return true;
}
bool C4GraphicsSystem::ToggleShowSolidMask()
bool C4GraphicsSystem::ToggleShow8BitSurface()
{
if (!Game.DebugMode && !Console.Active) { FlashMessage(LoadResStr("IDS_MSG_NODEBUGMODE")); return false; }
Toggle(ShowSolidMask);
FlashMessageOnOff("SolidMasks", !!ShowSolidMask);
Show8BitSurface = (Show8BitSurface + 1) % 3;
if (Show8BitSurface == 0)
FlashMessage("Default view");
else if (Show8BitSurface == 1)
FlashMessage("Foreground 8-bit landscape");
else if (Show8BitSurface == 2)
FlashMessage("Background 8-bit landscape");
return true;
}

View File

@ -39,7 +39,7 @@ public:
bool ShowEntrance;
bool ShowPathfinder;
bool ShowNetstatus;
bool ShowSolidMask;
int Show8BitSurface; // 0 normal, 1 foreground mats, 2 background mats
bool ShowLights;
C4Video Video;
C4LoaderScreen *pLoaderScreen;
@ -69,7 +69,7 @@ protected:
int32_t SeekLoaderScreens(C4Group &rFromGrp, const char *szWildcard, int32_t iLoaderCount, char *szDstName, C4Group **ppDestGrp);
public:
bool ToggleShowSolidMask();
bool ToggleShow8BitSurface();
bool ToggleShowNetStatus();
bool ToggleShowVertices();
bool ToggleShowAction();

View File

@ -309,8 +309,10 @@ void C4Landscape::Draw(C4TargetFacet &cgo, C4FoWRegion *pLight)
{
if (Modulation) pDraw->ActivateBlitModulation(Modulation);
// blit landscape
if (::GraphicsSystem.ShowSolidMask)
if (::GraphicsSystem.Show8BitSurface == 1)
pDraw->Blit8Fast(Surface8, cgo.TargetX, cgo.TargetY, cgo.Surface, cgo.X,cgo.Y,cgo.Wdt,cgo.Hgt);
else if (::GraphicsSystem.Show8BitSurface == 2)
pDraw->Blit8Fast(Surface8Bkg, cgo.TargetX, cgo.TargetY, cgo.Surface, cgo.X,cgo.Y,cgo.Wdt,cgo.Hgt);
else if(pLandscapeRender)
{
DoRelights();

View File

@ -2017,7 +2017,7 @@ void C4Object::Draw(C4TargetFacet &cgo, int32_t iByPlayer, DrawMode eDrawMode, f
// Debug Display ///////////////////////////////////////////////////////////////////////////////
// Don't draw (show solidmask)
if (::GraphicsSystem.ShowSolidMask)
if (::GraphicsSystem.Show8BitSurface != 0)
if (SolidMask.Wdt)
{
// DrawSolidMask(cgo); - no need to draw it, because the 8bit-surface will be shown
@ -2147,7 +2147,7 @@ void C4Object::DrawTopFace(C4TargetFacet &cgo, int32_t iByPlayer, DrawMode eDraw
|| !Inside<float>(offY, cgo.Y - Shape.Hgt, cgo.Y + cgo.Hgt))
return;
// Don't draw (show solidmask)
if (::GraphicsSystem.ShowSolidMask && SolidMask.Wdt) return;
if (::GraphicsSystem.Show8BitSurface != 0 && SolidMask.Wdt) return;
// Contained
if (Contained) if (eDrawMode!=ODM_Overlay) return;
// Construction sign