forked from Mirrors/openclonk
Remove old style Cursor and other dead code
parent
cbe621dd75
commit
9bae376055
|
@ -460,16 +460,8 @@ namespace C4GUI
|
|||
// dbg: some cursor...
|
||||
//lpDDraw->DrawFrame(lpDDraw->lpBack, x-5,y-5,x+5,y+5,2);
|
||||
|
||||
int32_t iOffsetX, iOffsetY;
|
||||
if (GfxR->fOldStyleCursor)
|
||||
{
|
||||
iOffsetX = iOffsetY = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
iOffsetX = -GfxR->fctMouseCursor.Wdt/2;
|
||||
iOffsetY = -GfxR->fctMouseCursor.Hgt/2;
|
||||
}
|
||||
int32_t iOffsetX = -GfxR->fctMouseCursor.Wdt/2;
|
||||
int32_t iOffsetY = -GfxR->fctMouseCursor.Hgt/2;
|
||||
GfxR->fctMouseCursor.Draw(cgo.Surface,x+iOffsetX,y+iOffsetY,0);
|
||||
if (::MouseControl.IsHelp())
|
||||
GfxR->fctMouseCursor.Draw(cgo.Surface,x+iOffsetX+5,y+iOffsetY-5,29);
|
||||
|
|
|
@ -405,37 +405,17 @@ void C4MouseControl::Draw(C4TargetFacet &cgo, const ZoomData &GameZoom)
|
|||
// Hotspot offset: Usually, hotspot is in center
|
||||
iOffsetX = GfxR->fctMouseCursor.Wdt/2;
|
||||
iOffsetY = GfxR->fctMouseCursor.Hgt/2;
|
||||
// Previously, there used to be custom-defined hotspots for all cursors. Calc them in.
|
||||
if (GfxR->fOldStyleCursor)
|
||||
// calculate the hotspot for the scrolling cursors
|
||||
switch (Cursor)
|
||||
{
|
||||
switch (Cursor)
|
||||
{
|
||||
case C4MC_Cursor_Select: case C4MC_Cursor_Region: //case C4MC_Cursor_DragMenu:
|
||||
iOffsetX=iOffsetY=0;
|
||||
break;
|
||||
case C4MC_Cursor_Dig: case C4MC_Cursor_DigMaterial:
|
||||
iOffsetX=0; iOffsetY=GfxR->fctMouseCursor.Hgt;
|
||||
break;
|
||||
case C4MC_Cursor_Construct:
|
||||
case C4MC_Cursor_DragDrop:
|
||||
// calculated when dragimage is drawn
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// for new cursors, this hotspot exists for the scrolling cursors only
|
||||
switch (Cursor)
|
||||
{
|
||||
case C4MC_Cursor_Up: iOffsetY += -GfxR->fctMouseCursor.Hgt/2; break;
|
||||
case C4MC_Cursor_Down:iOffsetY += +GfxR->fctMouseCursor.Hgt/2; break;
|
||||
case C4MC_Cursor_Left: iOffsetX += -GfxR->fctMouseCursor.Wdt/2; break;
|
||||
case C4MC_Cursor_Right: iOffsetX += +GfxR->fctMouseCursor.Wdt/2; break;
|
||||
case C4MC_Cursor_UpLeft: iOffsetX += -GfxR->fctMouseCursor.Wdt/2; iOffsetY += -GfxR->fctMouseCursor.Hgt/2; break;
|
||||
case C4MC_Cursor_UpRight: iOffsetX += +GfxR->fctMouseCursor.Wdt/2; iOffsetY += -GfxR->fctMouseCursor.Hgt/2; break;
|
||||
case C4MC_Cursor_DownLeft: iOffsetX += -GfxR->fctMouseCursor.Wdt/2; iOffsetY += +GfxR->fctMouseCursor.Hgt/2; break;
|
||||
case C4MC_Cursor_DownRight: iOffsetX += +GfxR->fctMouseCursor.Wdt/2; iOffsetY += +GfxR->fctMouseCursor.Hgt/2; break;
|
||||
}
|
||||
case C4MC_Cursor_Up: iOffsetY += -GfxR->fctMouseCursor.Hgt/2; break;
|
||||
case C4MC_Cursor_Down:iOffsetY += +GfxR->fctMouseCursor.Hgt/2; break;
|
||||
case C4MC_Cursor_Left: iOffsetX += -GfxR->fctMouseCursor.Wdt/2; break;
|
||||
case C4MC_Cursor_Right: iOffsetX += +GfxR->fctMouseCursor.Wdt/2; break;
|
||||
case C4MC_Cursor_UpLeft: iOffsetX += -GfxR->fctMouseCursor.Wdt/2; iOffsetY += -GfxR->fctMouseCursor.Hgt/2; break;
|
||||
case C4MC_Cursor_UpRight: iOffsetX += +GfxR->fctMouseCursor.Wdt/2; iOffsetY += -GfxR->fctMouseCursor.Hgt/2; break;
|
||||
case C4MC_Cursor_DownLeft: iOffsetX += -GfxR->fctMouseCursor.Wdt/2; iOffsetY += +GfxR->fctMouseCursor.Hgt/2; break;
|
||||
case C4MC_Cursor_DownRight: iOffsetX += +GfxR->fctMouseCursor.Wdt/2; iOffsetY += +GfxR->fctMouseCursor.Hgt/2; break;
|
||||
}
|
||||
// Add mark
|
||||
bool fAddMark; fAddMark=false;
|
||||
|
|
|
@ -27,8 +27,8 @@
|
|||
#include <C4Surface.h>
|
||||
|
||||
const int C4FCT_Full = -1,
|
||||
C4FCT_Height = -2,
|
||||
C4FCT_Width = -3;
|
||||
C4FCT_Height = -2,
|
||||
C4FCT_Width = -3;
|
||||
|
||||
class C4TargetRect;
|
||||
class CSurface;
|
||||
|
|
|
@ -81,7 +81,6 @@ void C4GraphicsResource::Default()
|
|||
|
||||
fctCursor.Default();
|
||||
fctDropTarget.Default();
|
||||
fctInsideSymbol.Default();
|
||||
fctKeyboard.Default();
|
||||
fctGamepad.Default();
|
||||
fctCommand.Default();
|
||||
|
@ -91,7 +90,6 @@ void C4GraphicsResource::Default()
|
|||
|
||||
iNumRanks=1;
|
||||
idRegisteredMainGroupSetFiles=-1;
|
||||
fOldStyleCursor = false;
|
||||
}
|
||||
|
||||
void C4GraphicsResource::Clear()
|
||||
|
@ -104,7 +102,6 @@ void C4GraphicsResource::Clear()
|
|||
fctCrewClr.Clear();
|
||||
fctFlagClr.Clear();
|
||||
fctPlayerClr.Clear();
|
||||
fctPlayerGray.Clear();
|
||||
|
||||
fctPlayer.Clear();
|
||||
fctFlag.Clear();
|
||||
|
@ -268,13 +265,6 @@ bool C4GraphicsResource::Init()
|
|||
fctFlagClr.Hgt=fctFlag.Hgt;
|
||||
fctFlagClr.idSourceGroup = fctFlag.idSourceGroup;
|
||||
}
|
||||
if (fctPlayer.idSourceGroup != fctPlayerGray.idSourceGroup)
|
||||
{
|
||||
fctPlayerGray.Create(fctPlayer.Wdt, fctPlayer.Hgt);
|
||||
fctPlayer.Draw(fctPlayerGray);
|
||||
fctPlayerGray.Grayscale(30);
|
||||
fctPlayerGray.idSourceGroup = fctPlayer.idSourceGroup;
|
||||
}
|
||||
if (fctPlayer.idSourceGroup != fctPlayerClr.idSourceGroup)
|
||||
{
|
||||
if (!fctPlayerClr.CreateClrByOwner(fctPlayer.Surface)) { LogFatal("ClrByOwner error! (1)"); return false; }
|
||||
|
@ -301,44 +291,20 @@ bool C4GraphicsResource::Init()
|
|||
|
||||
bool C4GraphicsResource::LoadCursorGfx()
|
||||
{
|
||||
// old-style cursor file overloads new-stye, because old scenarios might want to have their own cursors
|
||||
if (!LoadFile(fctMouseCursor, "Cursor", Files, C4FCT_Height, C4FCT_Full, true))
|
||||
{
|
||||
// no old-style overload present: Determine appropriate GFX file by screen resolution
|
||||
const char *szCursorFilename;
|
||||
if (C4GUI::GetScreenWdt() >= 1280)
|
||||
szCursorFilename = "CursorLarge";
|
||||
else if (C4GUI::GetScreenWdt() >= 800)
|
||||
szCursorFilename = "CursorMedium";
|
||||
else
|
||||
szCursorFilename = "CursorSmall";
|
||||
// always fallback to regular cursor file
|
||||
if (!LoadFile(fctMouseCursor, szCursorFilename, Files, C4FCT_Height))
|
||||
return false;
|
||||
}
|
||||
// Determine appropriate GFX file by screen resolution
|
||||
const char *szCursorFilename;
|
||||
if (C4GUI::GetScreenWdt() >= 1280)
|
||||
szCursorFilename = "CursorLarge";
|
||||
else if (C4GUI::GetScreenWdt() >= 800)
|
||||
szCursorFilename = "CursorMedium";
|
||||
else
|
||||
szCursorFilename = "CursorSmall";
|
||||
if (!LoadFile(fctMouseCursor, szCursorFilename, Files, C4FCT_Height))
|
||||
return false;
|
||||
// adjust dependant faces
|
||||
int32_t iCursorSize = fctMouseCursor.Hgt;
|
||||
if (iCursorSize == 13)
|
||||
{
|
||||
fctCursor.Set(fctMouseCursor.Surface, 455, 0, 13, 13);
|
||||
fOldStyleCursor = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
fctCursor.Set(fctMouseCursor.Surface, 35*iCursorSize, 0, iCursorSize, iCursorSize);
|
||||
fOldStyleCursor = false;
|
||||
}
|
||||
if (iCursorSize == 13)
|
||||
{
|
||||
fctInsideSymbol.Set(fctMouseCursor.Surface, 468, 0, 13, 13);
|
||||
fctDropTarget.Set(fctMouseCursor.Surface, 494, 0, 13, 13);
|
||||
}
|
||||
else
|
||||
{
|
||||
fctInsideSymbol.Set(fctMouseCursor.Surface, 36*iCursorSize, 0, iCursorSize, iCursorSize);
|
||||
fctDropTarget.Set(fctMouseCursor.Surface, 38*iCursorSize, 0, iCursorSize, iCursorSize);
|
||||
}
|
||||
// done
|
||||
fctCursor.Set(fctMouseCursor.Surface, 35*iCursorSize, 0, iCursorSize, iCursorSize);
|
||||
fctDropTarget.Set(fctMouseCursor.Surface, 38*iCursorSize, 0, iCursorSize, iCursorSize);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -347,8 +313,8 @@ bool C4GraphicsResource::RegisterGlobalGraphics()
|
|||
// Create main gfx group - register with fixed ID 1, to prevent unnecessary font reloading.
|
||||
// FontLoader-initializations always check whether the font has already been initialized
|
||||
// with the same parameters. If the game is simply reloaded in console-mode, this means
|
||||
// that non-bitmap-fonts are not reinitialized. This will also apply for InGame-scenario
|
||||
// switches yet to be implemented.
|
||||
// that fonts are not reinitialized. This will also apply for InGame-scenario switches yet
|
||||
// to be implemented.
|
||||
// Bitmap fonts from other groups are always reloaded, because the group indices of the gfx
|
||||
// group set are not reset, and will then differ for subsequent group registrations.
|
||||
// Resetting the group index of the gfx group set at game reset would cause problems if a
|
||||
|
@ -356,6 +322,7 @@ bool C4GraphicsResource::RegisterGlobalGraphics()
|
|||
// overloaded font face is opened. The group indices could match and the old font would
|
||||
// then be kept.
|
||||
// The cleanest alternative would be to reinit all the fonts whenever a scenario is reloaded
|
||||
// FIXME: Test whether vector fonts from a scenario are correctly reloaded
|
||||
C4Group *pMainGfxGrp = new C4Group();
|
||||
if (!pMainGfxGrp->Open(C4CFN_Graphics) || !Files.RegisterGroup(*pMainGfxGrp, true, C4GSPrio_Base, C4GSCnt_Graphics, 1))
|
||||
{
|
||||
|
|
|
@ -59,7 +59,6 @@ public:
|
|||
C4FacetID fctBackground;
|
||||
C4FacetID fctCaptain;
|
||||
C4FacetID fctMouseCursor;
|
||||
bool fOldStyleCursor; // if set, offsets need to be applied to some cursor facets
|
||||
C4FacetID fctSelectMark;
|
||||
C4FacetID fctOptions;
|
||||
C4FacetID fctMenu;
|
||||
|
@ -75,7 +74,6 @@ public:
|
|||
C4FacetID fctBuild;
|
||||
C4Facet fctCursor;
|
||||
C4Facet fctDropTarget;
|
||||
C4Facet fctInsideSymbol;
|
||||
C4Facet fctKeyboard;
|
||||
C4Facet fctMouse;
|
||||
C4Facet fctCommand;
|
||||
|
@ -84,7 +82,6 @@ public:
|
|||
C4FacetID fctCrewClr; // ColorByOwner-surface of fctCrew
|
||||
C4FacetID fctFlagClr; // ColorByOwner-surface of fctFlag
|
||||
C4FacetID fctPlayerClr; // ColorByOwner-surface of fctPlayer
|
||||
C4FacetID fctPlayerGray; // grayed out version of fctPlayer
|
||||
|
||||
C4GUI::DynBarFacet barCaption, barButton, barButtonD;
|
||||
C4FacetID fctButtonHighlight;
|
||||
|
|
|
@ -216,7 +216,7 @@ enum C4PropertyName
|
|||
P_LAST
|
||||
};
|
||||
|
||||
// There is only one Stringtable in Game.ScriptEngine
|
||||
// There is only one Stringtable
|
||||
class C4StringTable
|
||||
{
|
||||
public:
|
||||
|
|
Loading…
Reference in New Issue