forked from Mirrors/openclonk
clean up mouse controls, reduced cursor graphics to the used ones
parent
95de10f6a8
commit
348fb8c7a9
|
@ -351,8 +351,6 @@ set(OC_CLONK_SOURCES
|
|||
src/landscape/C4PathFinder.h
|
||||
src/landscape/C4PXS.cpp
|
||||
src/landscape/C4PXS.h
|
||||
src/landscape/C4Region.cpp
|
||||
src/landscape/C4Region.h
|
||||
src/landscape/C4Scenario.cpp
|
||||
src/landscape/C4Scenario.h
|
||||
src/landscape/C4Sky.cpp
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 35 KiB After Width: | Height: | Size: 7.8 KiB |
|
@ -106,8 +106,6 @@ class C4PXSSystem;
|
|||
class C4RankSystem;
|
||||
class C4Record;
|
||||
class C4Rect;
|
||||
class C4Region;
|
||||
class C4RegionList;
|
||||
class C4RoundResult;
|
||||
class C4RoundResults;
|
||||
class C4Scenario;
|
||||
|
|
|
@ -100,7 +100,6 @@ void C4Viewport::Clear()
|
|||
ViewWdt=ViewHgt=0;
|
||||
OutX=OutY=ViewWdt=ViewHgt=0;
|
||||
DrawX=DrawY=0;
|
||||
Regions.Clear();
|
||||
ViewOffsX = ViewOffsY = 0;
|
||||
}
|
||||
|
||||
|
@ -330,17 +329,6 @@ void C4Viewport::BlitOutput()
|
|||
|
||||
void C4Viewport::Execute()
|
||||
{
|
||||
// Update regions
|
||||
static int32_t RegionUpdate=0;
|
||||
SetRegions=NULL;
|
||||
RegionUpdate++;
|
||||
if (RegionUpdate>=5)
|
||||
{
|
||||
RegionUpdate=0;
|
||||
Regions.Clear();
|
||||
Regions.SetAdjust(-OutX,-OutY);
|
||||
SetRegions=&Regions;
|
||||
}
|
||||
// Adjust position
|
||||
AdjustPosition();
|
||||
// Current graphics output
|
||||
|
@ -587,8 +575,6 @@ void C4Viewport::Default()
|
|||
Next=NULL;
|
||||
PlayerLock=true;
|
||||
ResetMenuPositions=false;
|
||||
SetRegions=NULL;
|
||||
Regions.Default();
|
||||
ViewOffsX = ViewOffsY = 0;
|
||||
fIsNoOwnerViewport = false;
|
||||
last_game_draw_cgo.Default();
|
||||
|
@ -646,11 +632,6 @@ void C4Viewport::DrawPlayerStartup(C4TargetFacet &cgo)
|
|||
|
||||
// Control
|
||||
// unnecessary with the current control sets
|
||||
/* if (pPlr->MouseControl)
|
||||
GfxR->fctMouse.Draw(cgo.Surface,
|
||||
cgo.X+(cgo.Wdt-GfxR->fctKeyboard.Wdt)/2+55,
|
||||
cgo.Y+cgo.Hgt * 2/3 - 10 + DrawMessageOffset,
|
||||
0,0);*/
|
||||
if (pPlr && pPlr->ControlSet)
|
||||
{
|
||||
C4Facet controlset_facet = pPlr->ControlSet->GetPicture();
|
||||
|
@ -693,7 +674,7 @@ void C4Viewport::SetOutputSize(int32_t iDrawX, int32_t iDrawY, int32_t iOutX, in
|
|||
|
||||
void C4Viewport::ClearPointers(C4Object *pObj)
|
||||
{
|
||||
Regions.ClearPointers(pObj);
|
||||
|
||||
}
|
||||
|
||||
void C4Viewport::NextPlayer()
|
||||
|
|
|
@ -24,8 +24,6 @@
|
|||
#ifndef INC_C4Viewport
|
||||
#define INC_C4Viewport
|
||||
|
||||
#include <C4Region.h>
|
||||
|
||||
#include <C4Shape.h>
|
||||
|
||||
class C4Viewport
|
||||
|
@ -34,7 +32,6 @@ class C4Viewport
|
|||
public:
|
||||
C4Viewport();
|
||||
~C4Viewport();
|
||||
C4RegionList Regions;
|
||||
// "landscape" coordinates
|
||||
float ViewX,ViewY;
|
||||
int32_t ViewOffsX, ViewOffsY;
|
||||
|
@ -82,7 +79,6 @@ protected:
|
|||
bool PlayerLock;
|
||||
int32_t OutX,OutY;
|
||||
bool ResetMenuPositions;
|
||||
C4RegionList *SetRegions;
|
||||
C4Viewport *Next;
|
||||
class C4ViewportWindow * pWindow;
|
||||
C4FogOfWar ClrModMap; // color modulation map for viewport drawing
|
||||
|
|
|
@ -157,7 +157,7 @@ void C4MenuItem::DrawElement(C4TargetFacet &cgo)
|
|||
// Draw if there is no text progression at all (TextDisplayProgress==-1, or if it's progressed far enough already (TextDisplayProgress>0)
|
||||
if(pSymbolObj && TextDisplayProgress)
|
||||
{
|
||||
pSymbolObj->DrawPicture(cgoSymbolOut, false, NULL, NULL);
|
||||
pSymbolObj->DrawPicture(cgoSymbolOut, false, NULL);
|
||||
}
|
||||
else if (pSymbolGraphics && TextDisplayProgress)
|
||||
{
|
||||
|
@ -243,30 +243,6 @@ void C4MenuItem::MouseEnter(C4GUI::CMouse &rMouse)
|
|||
ParentClass::MouseEnter(rMouse);
|
||||
}
|
||||
|
||||
void C4MenuItem::DoDragging(C4GUI::CMouse &rMouse, int32_t iX, int32_t iY, DWORD dwKeyParam)
|
||||
{
|
||||
// is this a drag element?
|
||||
if (!IsDragElement()) { rMouse.pDragElement = NULL; }
|
||||
// check if outside drag range
|
||||
if (Max(Abs(iX - iDragX), Abs(iY - iDragY)) >= C4MC_DragSensitivity)
|
||||
{
|
||||
// then do a drag!
|
||||
::MouseControl.StartConstructionDrag(id);
|
||||
// this disables the window: Release mouse
|
||||
rMouse.ReleaseButtons();
|
||||
rMouse.pDragElement = NULL;
|
||||
rMouse.pMouseOverElement = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
void C4MenuItem::StopDragging(C4GUI::CMouse &rMouse, int32_t iX, int32_t iY, DWORD dwKeyParam)
|
||||
{
|
||||
// drag stop: Nothing to do, really
|
||||
// Mouse up will be processed by regular procedure
|
||||
rMouse.pDragElement = NULL;
|
||||
}
|
||||
|
||||
|
||||
// -----------------------------------------------------------
|
||||
// C4Menu
|
||||
|
||||
|
|
|
@ -29,7 +29,6 @@
|
|||
#include "C4Shape.h"
|
||||
#include "C4Gui.h"
|
||||
#include "C4IDList.h"
|
||||
#include "C4Region.h"
|
||||
|
||||
class C4Viewport;
|
||||
|
||||
|
@ -119,8 +118,6 @@ protected:
|
|||
// GUI calls
|
||||
virtual void MouseInput(class C4GUI::CMouse &rMouse, int32_t iButton, int32_t iX, int32_t iY, DWORD dwKeyParam); // input: mouse movement or buttons
|
||||
virtual void MouseEnter(class C4GUI::CMouse &rMouse); // called when mouse cursor enters element region: Select this item (deselects any other)
|
||||
virtual void DoDragging(class C4GUI::CMouse &rMouse, int32_t iX, int32_t iY, DWORD dwKeyParam); // called by mouse: dragging process
|
||||
virtual void StopDragging(class C4GUI::CMouse &rMouse, int32_t iX, int32_t iY, DWORD dwKeyParam); // called by mouse: mouse released after dragging process
|
||||
|
||||
public:
|
||||
C4ID GetC4ID() const { return id; }
|
||||
|
@ -224,7 +221,7 @@ private:
|
|||
protected:
|
||||
bool DoInitRefSym(const C4Facet &fctSymbol, const char *szEmpty, int32_t iExtra=C4MN_Extra_None, int32_t iExtraData=0, int32_t iId=0, int32_t iStyle=C4MN_Style_Normal);
|
||||
bool DoInit(C4FacetSurface &fctSymbol, const char *szEmpty, int32_t iExtra=C4MN_Extra_None, int32_t iExtraData=0, int32_t iId=0, int32_t iStyle=C4MN_Style_Normal);
|
||||
void DrawBuffer(C4Facet &cgo, C4RegionList *pRegions);
|
||||
void DrawBuffer(C4Facet &cgo);
|
||||
void AdjustSelection();
|
||||
void AdjustPosition();
|
||||
bool CheckBuffer();
|
||||
|
|
|
@ -44,52 +44,21 @@
|
|||
#include <C4GameControl.h>
|
||||
|
||||
const int32_t C4MC_Drag_None = 0,
|
||||
C4MC_Drag_Selecting = 1,
|
||||
C4MC_Drag_Moving = 2,
|
||||
//C4MC_Drag_Menu = 3,
|
||||
//C4MC_Drag_MenuScroll = 4,
|
||||
C4MC_Drag_Construct = 5,
|
||||
C4MC_Drag_Script = 6,
|
||||
C4MC_Drag_Unhandled = 7,
|
||||
C4MC_Drag_Unhandled = 7;
|
||||
|
||||
C4MC_Selecting_Unknown = 0;
|
||||
|
||||
const int32_t C4MC_Cursor_Region = 0,
|
||||
C4MC_Cursor_Crosshair = 1,
|
||||
C4MC_Cursor_Enter = 2,
|
||||
C4MC_Cursor_Grab = 3,
|
||||
C4MC_Cursor_Chop = 4,
|
||||
C4MC_Cursor_Dig = 5,
|
||||
C4MC_Cursor_Build = 6,
|
||||
C4MC_Cursor_Select = 7,
|
||||
C4MC_Cursor_Object = 8,
|
||||
C4MC_Cursor_Ungrab = 9,
|
||||
C4MC_Cursor_Up = 10,
|
||||
C4MC_Cursor_Down = 11,
|
||||
C4MC_Cursor_Left = 12,
|
||||
C4MC_Cursor_Right = 13,
|
||||
C4MC_Cursor_UpLeft = 14,
|
||||
C4MC_Cursor_UpRight = 15,
|
||||
C4MC_Cursor_DownLeft = 16,
|
||||
C4MC_Cursor_DownRight = 17,
|
||||
C4MC_Cursor_JumpLeft = 18,
|
||||
C4MC_Cursor_JumpRight = 19,
|
||||
C4MC_Cursor_Drop = 20,
|
||||
C4MC_Cursor_ThrowRight = 21,
|
||||
C4MC_Cursor_Put = 22,
|
||||
//C4MC_Cursor_DragMenu = 23,
|
||||
C4MC_Cursor_Vehicle = 24,
|
||||
C4MC_Cursor_VehiclePut = 25,
|
||||
C4MC_Cursor_ThrowLeft = 26,
|
||||
C4MC_Cursor_DragDrop = 26,
|
||||
C4MC_Cursor_Point = 27,
|
||||
C4MC_Cursor_DigObject = 28,
|
||||
// C4MC_Cursor_Help = 29, (obsolete)
|
||||
C4MC_Cursor_DigMaterial = 30,
|
||||
C4MC_Cursor_Add = 31,
|
||||
C4MC_Cursor_Construct = 32,
|
||||
C4MC_Cursor_Attack = 33,
|
||||
C4MC_Cursor_Nothing = 34;
|
||||
const int32_t C4MC_Cursor_Select = 0, // click cursor to select/click stuff in the GUI
|
||||
C4MC_Cursor_Crosshair = 1, // standard ingame cursor
|
||||
C4MC_Cursor_DragDrop = 3, // cursor when drag&dropping
|
||||
C4MC_Cursor_Up = 4, // cursors for scrolling the viewport ...
|
||||
C4MC_Cursor_Down = 5, // ...
|
||||
C4MC_Cursor_Left = 6,
|
||||
C4MC_Cursor_Right = 7,
|
||||
C4MC_Cursor_UpLeft = 8,
|
||||
C4MC_Cursor_UpRight = 9,
|
||||
C4MC_Cursor_DownLeft = 10,
|
||||
C4MC_Cursor_DownRight = 11,
|
||||
C4MC_Cursor_Passive = 12; // passive cursor in records and an fog of war
|
||||
|
||||
const int32_t C4MC_Time_on_Target = 10;
|
||||
|
||||
|
@ -109,14 +78,13 @@ void C4MouseControl::Default()
|
|||
Player=NO_OWNER;
|
||||
pPlayer=NULL;
|
||||
Viewport=NULL;
|
||||
Cursor=DownCursor=0;
|
||||
Cursor=0;
|
||||
Caption.Clear();
|
||||
CaptionBottomY=0;
|
||||
VpX=VpY=0;
|
||||
DownX=DownY=DownOffsetX=DownOffsetY=0;
|
||||
DownX=DownY=0;
|
||||
ViewX=ViewY=0;
|
||||
GuiX=GuiY=GameX=GameY=0;
|
||||
ShowPointX=ShowPointY=-1;
|
||||
LeftButtonDown=RightButtonDown=false;
|
||||
LeftDoubleIgnoreUp=false;
|
||||
ButtonDownOnSelection=false;
|
||||
|
@ -126,7 +94,7 @@ void C4MouseControl::Default()
|
|||
DragID=C4ID::None;
|
||||
DragObject=NULL;
|
||||
KeepCaption=0;
|
||||
Drag=C4MC_Drag_None; DragSelecting=C4MC_Selecting_Unknown;
|
||||
Drag=C4MC_Drag_None;
|
||||
Selection.Default();
|
||||
TargetObject=DownTarget=NULL;
|
||||
TimeOnTargetObject=0;
|
||||
|
@ -135,8 +103,6 @@ void C4MouseControl::Default()
|
|||
AltDown=false;
|
||||
Scrolling=false;
|
||||
ScrollSpeed=10;
|
||||
TargetRegion=NULL;
|
||||
DownRegion.Default();
|
||||
DragImageDef=NULL;
|
||||
DragImageObject=NULL;
|
||||
fMouseOwned = true; // default mouse owned
|
||||
|
@ -161,7 +127,7 @@ void C4MouseControl::Execute()
|
|||
WORD wKeyState=0;
|
||||
if (ControlDown) wKeyState|=MK_CONTROL;
|
||||
if (ShiftDown) wKeyState|=MK_SHIFT;
|
||||
Move(C4MC_Button_None,VpX,VpY,wKeyState);
|
||||
Move(C4MC_Button_None, VpX, VpY, wKeyState);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -294,7 +260,6 @@ void C4MouseControl::Move(int32_t iButton, int32_t iX, int32_t iY, DWORD dwKeyFl
|
|||
GameX=ViewX+VpX/Viewport->Zoom; GameY=ViewY+VpY/Viewport->Zoom;
|
||||
GuiX=float(VpX)/Viewport->GetGUIZoom(); GuiY=float(VpY)/Viewport->GetGUIZoom();
|
||||
}
|
||||
UpdateTargetRegion();
|
||||
UpdateScrolling();
|
||||
if (iButton == C4MC_Button_LeftDown) LeftDown();
|
||||
else if (iButton == C4MC_Button_LeftUp) LeftUp();
|
||||
|
@ -308,15 +273,13 @@ void C4MouseControl::Move(int32_t iButton, int32_t iX, int32_t iY, DWORD dwKeyFl
|
|||
VpX=iX; VpY=iY;
|
||||
GameX=ViewX+VpX/Viewport->Zoom; GameY=ViewY+VpY/Viewport->Zoom;
|
||||
GuiX=float(VpX)/Viewport->GetGUIZoom(); GuiY=float(VpY)/Viewport->GetGUIZoom();
|
||||
// Target region
|
||||
UpdateTargetRegion();
|
||||
// Scrolling
|
||||
UpdateScrolling();
|
||||
// Fog of war
|
||||
UpdateFogOfWar();
|
||||
|
||||
// Blocked by fog of war: evaluate button up, dragging and region controls only
|
||||
if (FogOfWar && Drag == C4MC_Drag_None && !TargetRegion)
|
||||
if (FogOfWar && Drag == C4MC_Drag_None)
|
||||
{
|
||||
// Left button up
|
||||
if (iButton==C4MC_Button_LeftUp)
|
||||
|
@ -342,9 +305,6 @@ void C4MouseControl::Move(int32_t iButton, int32_t iX, int32_t iY, DWORD dwKeyFl
|
|||
{
|
||||
case C4MC_Drag_Unhandled: break; // nothing to do
|
||||
case C4MC_Drag_None: DragNone(); break;
|
||||
case C4MC_Drag_Selecting: DragSelect(); break;
|
||||
case C4MC_Drag_Moving: DragMoving(); break;
|
||||
case C4MC_Drag_Construct: DragConstruct(); break;
|
||||
case C4MC_Drag_Script: DragScript(); break;
|
||||
}
|
||||
break;
|
||||
|
@ -365,7 +325,7 @@ void C4MouseControl::Move(int32_t iButton, int32_t iX, int32_t iY, DWORD dwKeyFl
|
|||
// script handling of mouse control for everything but regular movement (which is sent at control frame intervals only)
|
||||
if (iButton != C4MC_Button_None)
|
||||
// not if blocked by selection object
|
||||
if (!TargetRegion && !TargetObject)
|
||||
if (!TargetObject)
|
||||
// safety (can't really happen in !IsPassive, but w/e
|
||||
if (pPlayer && pPlayer->ControlSet)
|
||||
{
|
||||
|
@ -409,7 +369,7 @@ void C4MouseControl::Draw(C4TargetFacet &cgo, const ZoomData &GameZoom)
|
|||
switch (Drag)
|
||||
{
|
||||
//------------------------------------------------------------------------------------------
|
||||
case C4MC_Drag_None: case C4MC_Drag_Moving: case C4MC_Drag_Construct: case C4MC_Drag_Script: case C4MC_Drag_Unhandled:
|
||||
case C4MC_Drag_None: case C4MC_Drag_Script: case C4MC_Drag_Unhandled:
|
||||
// Hotspot offset: Usually, hotspot is in center
|
||||
iOffsetX = GfxR->fctMouseCursor.Wdt/2;
|
||||
iOffsetY = GfxR->fctMouseCursor.Hgt/2;
|
||||
|
@ -425,13 +385,6 @@ void C4MouseControl::Draw(C4TargetFacet &cgo, const ZoomData &GameZoom)
|
|||
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;
|
||||
if (ShiftDown)
|
||||
if ((Cursor!=C4MC_Cursor_Region) && (Cursor!=C4MC_Cursor_Select) //&& (Cursor!=C4MC_Cursor_DragMenu)
|
||||
&& (Cursor!=C4MC_Cursor_JumpLeft) && (Cursor!=C4MC_Cursor_JumpRight))
|
||||
if (!IsPassive())
|
||||
fAddMark=true;
|
||||
// Drag image
|
||||
if (DragImageObject || DragImageDef)
|
||||
{
|
||||
|
@ -468,8 +421,6 @@ void C4MouseControl::Draw(C4TargetFacet &cgo, const ZoomData &GameZoom)
|
|||
pDraw->SetZoom(GameZoom);
|
||||
XDraw = GameX; YDraw = GameY;
|
||||
ZoomDraw = 1.0f;
|
||||
// for drag construct: draw rounded to game pixels, because construction site will be placed at rounded game pixel positions
|
||||
if (Drag == C4MC_Drag_Construct) { XDraw=floor(XDraw); YDraw=floor(YDraw); }
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -478,10 +429,7 @@ void C4MouseControl::Draw(C4TargetFacet &cgo, const ZoomData &GameZoom)
|
|||
}
|
||||
|
||||
iOffsetX=int(ZoomDraw*ImageWdt/2);
|
||||
if (Drag == C4MC_Drag_Construct)
|
||||
iOffsetY=int(ZoomDraw*ImageHgt);
|
||||
else
|
||||
iOffsetY=int(ZoomDraw*ImageHgt/2);
|
||||
iOffsetY=int(ZoomDraw*ImageHgt/2);
|
||||
|
||||
C4TargetFacet ccgo;
|
||||
ccgo.Set(cgo.Surface, XDraw + cgo.X - iOffsetX, YDraw + cgo.Y - iOffsetY, float(ImageWdt)*ZoomDraw, float(ImageHgt)*ZoomDraw);
|
||||
|
@ -494,7 +442,7 @@ void C4MouseControl::Draw(C4TargetFacet &cgo, const ZoomData &GameZoom)
|
|||
DragImageObject->ColorMod = (Drag == C4MC_Drag_Script) ? 0x7fffffff : (/*DragImagePhase*/0 ? 0x8f7f0000 : 0x1f007f00);
|
||||
DragImageObject->BlitMode = C4GFXBLIT_MOD2;
|
||||
|
||||
DragImageObject->DrawPicture(ccgo, false, NULL, NULL);
|
||||
DragImageObject->DrawPicture(ccgo, false, NULL);
|
||||
|
||||
DragImageObject->ColorMod = ColorMod;
|
||||
DragImageObject->BlitMode = BlitMode;
|
||||
|
@ -521,28 +469,6 @@ void C4MouseControl::Draw(C4TargetFacet &cgo, const ZoomData &GameZoom)
|
|||
// Cursor
|
||||
if ( (!DragImageDef && !DragImageObject) || (Drag == C4MC_Drag_Script))
|
||||
GfxR->fctMouseCursor.Draw(cgo.Surface,cgo.X+GuiX-iOffsetX,cgo.Y+GuiY-iOffsetY,Cursor);
|
||||
// Point
|
||||
if ((ShowPointX!=-1) && (ShowPointY!=-1))
|
||||
GfxR->fctMouseCursor.Draw( cgo.Surface,
|
||||
int32_t(cgo.X+(ShowPointX-cgo.TargetX)*GameZoom.Zoom / GuiZoom.Zoom-GfxR->fctMouseCursor.Wdt/2),
|
||||
int32_t(cgo.Y+(ShowPointY-cgo.TargetY)*GameZoom.Zoom / GuiZoom.Zoom-GfxR->fctMouseCursor.Hgt/2),
|
||||
C4MC_Cursor_Point );
|
||||
// Add mark
|
||||
if (fAddMark)
|
||||
GfxR->fctMouseCursor.Draw( cgo.Surface,
|
||||
int32_t(cgo.X+GuiX-iOffsetX+8),
|
||||
int32_t(cgo.Y+GuiY-iOffsetY+8),
|
||||
C4MC_Cursor_Add );
|
||||
break;
|
||||
//------------------------------------------------------------------------------------------
|
||||
case C4MC_Drag_Selecting:
|
||||
// Draw frame
|
||||
pDraw->DrawFrameDw(cgo.Surface,
|
||||
int32_t(cgo.X + GuiX),
|
||||
int32_t(cgo.Y + GuiY),
|
||||
int32_t(cgo.X + (DownX - cgo.TargetX) * GameZoom.Zoom / GuiZoom.Zoom),
|
||||
int32_t(cgo.Y + (DownY - cgo.TargetY) * GameZoom.Zoom / GuiZoom.Zoom),
|
||||
C4RGB(0xca, 0, 0));
|
||||
break;
|
||||
//------------------------------------------------------------------------------------------
|
||||
}
|
||||
|
@ -566,11 +492,6 @@ void C4MouseControl::UpdateCursorTarget()
|
|||
// Scrolling: no other target
|
||||
TargetObject=NULL;
|
||||
}
|
||||
else if(TargetRegion)
|
||||
{
|
||||
// On target region
|
||||
TargetObject=NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Target object
|
||||
|
@ -602,7 +523,7 @@ void C4MouseControl::UpdateCursorTarget()
|
|||
|
||||
// passive cursor
|
||||
if (IsPassive())
|
||||
Cursor=C4MC_Cursor_Region;
|
||||
Cursor=C4MC_Cursor_Passive;
|
||||
|
||||
// Time on target: caption
|
||||
if (TargetObject && Cursor == C4MC_Cursor_Select)
|
||||
|
@ -658,8 +579,6 @@ void C4MouseControl::UpdateScrolling()
|
|||
{
|
||||
// Assume no scrolling
|
||||
Scrolling=false;
|
||||
// No scrolling if on region
|
||||
if (TargetRegion) return;
|
||||
// No scrolling if disabled by player
|
||||
if (pPlayer) if (pPlayer->IsViewLocked()) return;
|
||||
// Scrolling on border
|
||||
|
@ -678,69 +597,13 @@ void C4MouseControl::UpdateScrolling()
|
|||
if ((VpX==Viewport->ViewWdt-1) && (VpY==Viewport->ViewHgt-1)) Cursor=C4MC_Cursor_DownRight;
|
||||
}
|
||||
|
||||
void C4MouseControl::UpdateTargetRegion()
|
||||
{
|
||||
// Assume no region
|
||||
TargetRegion=NULL;
|
||||
// Find region
|
||||
if (!(TargetRegion=Viewport->Regions.Find(GuiX,GuiY))) return;
|
||||
// Region found: no target object
|
||||
TargetObject=NULL;
|
||||
// Cursor
|
||||
Cursor=C4MC_Cursor_Region;
|
||||
// Stop drag selecting (reset down cursor, too)
|
||||
if (Drag==C4MC_Drag_Selecting)
|
||||
{ Drag=C4MC_Drag_None; DownCursor=C4MC_Cursor_Nothing; }
|
||||
// Caption
|
||||
Caption.Copy(TargetRegion->Caption);
|
||||
CaptionBottomY=TargetRegion->Y; KeepCaption=0;
|
||||
// MoveOverCom (on region change)
|
||||
static int32_t iLastRegionX,iLastRegionY;
|
||||
if (TargetRegion->MoveOverCom)
|
||||
{
|
||||
if ((TargetRegion->X!=iLastRegionX) || (TargetRegion->Y!=iLastRegionY))
|
||||
{
|
||||
iLastRegionX=TargetRegion->X; iLastRegionY=TargetRegion->Y;
|
||||
|
||||
// Control queue
|
||||
Game.Input.Add(CID_PlrControl,
|
||||
new C4ControlPlayerControl(Player,TargetRegion->MoveOverCom,TargetRegion->Data));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
iLastRegionX=iLastRegionY=-1;
|
||||
}
|
||||
}
|
||||
|
||||
void C4MouseControl::LeftDown()
|
||||
{
|
||||
// Set flag
|
||||
LeftButtonDown=true;
|
||||
// Store down values (same MoveRightDown -> use StoreDown)
|
||||
DownX=GameX; DownY=GameY;
|
||||
DownCursor=Cursor;
|
||||
DownTarget=TargetObject;
|
||||
DownRegion.Default();
|
||||
if (TargetRegion)
|
||||
{
|
||||
DownRegion=(*TargetRegion);
|
||||
DownTarget=TargetRegion->Target;
|
||||
DownOffsetX=TargetRegion->X-GuiX; DownOffsetY=TargetRegion->Y-GuiY;
|
||||
}
|
||||
}
|
||||
|
||||
void C4MouseControl::DragSelect()
|
||||
{
|
||||
// don't select into FoW - simply don't update selection
|
||||
if (FogOfWar) return;
|
||||
switch (DragSelecting)
|
||||
{
|
||||
case C4MC_Selecting_Unknown:
|
||||
// Determine selection type
|
||||
// No selection in engine right now...
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void C4MouseControl::LeftUp()
|
||||
|
@ -759,12 +622,6 @@ void C4MouseControl::LeftUp()
|
|||
case C4MC_Drag_Unhandled: // nobreak
|
||||
case C4MC_Drag_None: LeftUpDragNone(); break;
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
case C4MC_Drag_Selecting: ButtonUpDragSelecting(); break;
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
case C4MC_Drag_Moving: ButtonUpDragMoving(); break;
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
case C4MC_Drag_Construct: ButtonUpDragConstruct(); break;
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
case C4MC_Drag_Script: ButtonUpDragScript(); break;
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
}
|
||||
|
@ -774,31 +631,8 @@ void C4MouseControl::LeftUp()
|
|||
if(!RightButtonDown) DownTarget = NULL;
|
||||
}
|
||||
|
||||
void C4MouseControl::DragMoving()
|
||||
{
|
||||
ShowPointX=ShowPointY=-1;
|
||||
|
||||
// do not drag objects into FoW
|
||||
if (FogOfWar) { Cursor = C4MC_Cursor_Nothing; return; }
|
||||
|
||||
}
|
||||
|
||||
void C4MouseControl::DragNone()
|
||||
{
|
||||
// Holding left down
|
||||
if (LeftButtonDown)
|
||||
{
|
||||
switch (Cursor)
|
||||
{
|
||||
// Hold down on region
|
||||
case C4MC_Cursor_Region:
|
||||
if (!::Game.iTick5)
|
||||
if (DownRegion.HoldCom)
|
||||
SendControl(DownRegion.HoldCom);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Cursor movement
|
||||
UpdateCursorTarget();
|
||||
// Update selection
|
||||
|
@ -858,15 +692,7 @@ void C4MouseControl::RightDown()
|
|||
RightButtonDown=true;
|
||||
// Store down values (same MoveLeftDown -> use StoreDown)
|
||||
DownX=GameX; DownY=GameY;
|
||||
DownCursor=Cursor;
|
||||
DownTarget=TargetObject;
|
||||
DownRegion.Default();
|
||||
if (TargetRegion)
|
||||
{
|
||||
DownRegion=(*TargetRegion);
|
||||
DownTarget=TargetRegion->Target;
|
||||
DownOffsetX=TargetRegion->X-GuiX; DownOffsetY=TargetRegion->Y-GuiY;
|
||||
}
|
||||
}
|
||||
|
||||
void C4MouseControl::RightUp()
|
||||
|
@ -878,12 +704,6 @@ void C4MouseControl::RightUp()
|
|||
case C4MC_Drag_Unhandled: // nobreak
|
||||
case C4MC_Drag_None: RightUpDragNone(); break;
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
case C4MC_Drag_Selecting: ButtonUpDragSelecting(); break;
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
case C4MC_Drag_Moving: ButtonUpDragMoving(); break;
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
case C4MC_Drag_Construct: ButtonUpDragConstruct(); break;
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
case C4MC_Drag_Script: ButtonUpDragScript(); break;
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
}
|
||||
|
@ -952,18 +772,6 @@ bool C4MouseControl::SendControl(int32_t iCom, int32_t iData)
|
|||
return true;
|
||||
}
|
||||
|
||||
void C4MouseControl::DragConstruct()
|
||||
{
|
||||
Cursor=C4MC_Cursor_Construct;
|
||||
|
||||
// TODO: Re-enable something like this:
|
||||
#if 0
|
||||
// Check site
|
||||
DragImagePhase=1;
|
||||
if (!FogOfWar && ConstructionCheck(C4Id2Def(DragID),int32_t(GameX),int32_t(GameY))) DragImagePhase=0;
|
||||
#endif
|
||||
}
|
||||
|
||||
void C4MouseControl::DragScript()
|
||||
{
|
||||
// script drag should update target and selection so selection highlight on drop target is visible
|
||||
|
@ -981,20 +789,11 @@ void C4MouseControl::LeftUpDragNone()
|
|||
// Single left click (might be on a target)
|
||||
switch (Cursor)
|
||||
{
|
||||
// Region
|
||||
case C4MC_Cursor_Region:
|
||||
// Region com & data
|
||||
SendControl(DownRegion.Com,DownRegion.Data);
|
||||
break;
|
||||
// Selection
|
||||
case C4MC_Cursor_Select:
|
||||
// Object selection to control queue
|
||||
if (!IsPassive() && Selection.GetObject() == DownTarget)
|
||||
Game.Input.Add(CID_PlrSelect, new C4ControlPlayerSelect(Player,Selection,false));
|
||||
break;
|
||||
case C4MC_Cursor_Nothing:
|
||||
break;
|
||||
// Movement?
|
||||
default:
|
||||
// done in script
|
||||
break;
|
||||
|
@ -1003,34 +802,6 @@ void C4MouseControl::LeftUpDragNone()
|
|||
Selection.Clear();
|
||||
}
|
||||
|
||||
void C4MouseControl::ButtonUpDragSelecting()
|
||||
{
|
||||
// Finish drag
|
||||
Drag=C4MC_Drag_None;
|
||||
}
|
||||
|
||||
void C4MouseControl::ButtonUpDragMoving()
|
||||
{
|
||||
// Finish drag
|
||||
Drag=C4MC_Drag_None;
|
||||
// Clear selection
|
||||
Selection.Clear();
|
||||
}
|
||||
|
||||
void C4MouseControl::ButtonUpDragConstruct()
|
||||
{
|
||||
// Finish drag
|
||||
Drag=C4MC_Drag_None;
|
||||
DragImageObject = NULL;
|
||||
DragImageDef = NULL;
|
||||
// Command
|
||||
// FIXME: Lots and lots of dead code in this file.
|
||||
//if (DragImagePhase==0) // if ConstructionCheck was okay (check again?)
|
||||
//SendCommand(C4CMD_Construct,int32_t(GameX),int32_t(GameY),NULL,NULL,DragID.GetHandle());
|
||||
// Clear selection (necessary?)
|
||||
Selection.Clear();
|
||||
}
|
||||
|
||||
void C4MouseControl::ButtonUpDragScript()
|
||||
{
|
||||
// Determine drag+drop targets
|
||||
|
@ -1079,10 +850,6 @@ void C4MouseControl::RightUpDragNone()
|
|||
// might be in Drag_Unknown
|
||||
Drag = C4MC_Drag_None;
|
||||
|
||||
// Region: send control
|
||||
if (Cursor==C4MC_Cursor_Region)
|
||||
{ SendControl(DownRegion.RightCom); return; }
|
||||
|
||||
// Alternative object selection
|
||||
if (Cursor==C4MC_Cursor_Select && !IsPassive() && Selection.GetObject() == DownTarget)
|
||||
{ Game.Input.Add(CID_PlrSelect, new C4ControlPlayerSelect(Player,Selection,true)); }
|
||||
|
@ -1100,11 +867,9 @@ void C4MouseControl::UpdateFogOfWar()
|
|||
{
|
||||
FogOfWar=true;
|
||||
// allow dragging, scrolling, region selection and manipulations of objects not affected by FoW
|
||||
if (!TargetRegion && !Scrolling && (!TargetObject || !(TargetObject->Category & C4D_IgnoreFoW)))
|
||||
if (!Scrolling && (!TargetObject || !(TargetObject->Category & C4D_IgnoreFoW)))
|
||||
{
|
||||
Cursor=C4MC_Cursor_Nothing;
|
||||
ShowPointX=ShowPointY=-1;
|
||||
// dragging will reset the cursor
|
||||
Cursor=C4MC_Cursor_Passive;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1155,16 +920,7 @@ void C4MouseControl::ScrollView(float iX, float iY, float ViewWdt, float ViewHgt
|
|||
|
||||
bool C4MouseControl::IsDragging()
|
||||
{
|
||||
// no selection drag; return true for object drag only
|
||||
return Active && (Drag == C4MC_Drag_Moving || Drag == C4MC_Drag_Construct || Drag == C4MC_Drag_Script);
|
||||
}
|
||||
|
||||
void C4MouseControl::StartConstructionDrag(C4ID id)
|
||||
{
|
||||
Drag=C4MC_Drag_Construct;
|
||||
DragID=id;
|
||||
DragImageDef = C4Id2Def(id);
|
||||
Selection.Clear();
|
||||
return Active && Drag == C4MC_Drag_Script;
|
||||
}
|
||||
|
||||
bool C4MouseControl::GetLastGUIPos(int32_t *x_out, int32_t *y_out) const
|
||||
|
|
|
@ -25,7 +25,6 @@
|
|||
|
||||
#include <C4Facet.h>
|
||||
#include "C4ObjectList.h"
|
||||
#include "C4Region.h"
|
||||
|
||||
const int32_t C4MC_Button_None = 0,
|
||||
C4MC_Button_LeftDown = 1,
|
||||
|
@ -35,7 +34,7 @@ const int32_t C4MC_Button_None = 0,
|
|||
C4MC_Button_LeftDouble = 5,
|
||||
C4MC_Button_RightDouble = 6,
|
||||
C4MC_Button_Wheel = 7,
|
||||
C4MC_Button_MiddleDown = 8,
|
||||
C4MC_Button_MiddleDown = 8,
|
||||
C4MC_Button_MiddleUp = 9;
|
||||
|
||||
const int32_t C4MC_DragSensitivity = 5;
|
||||
|
@ -60,21 +59,24 @@ protected:
|
|||
int32_t Player;
|
||||
C4Player *pPlayer; // valid during Move()
|
||||
C4Viewport *Viewport; // valid during Move()
|
||||
StdCopyStrBuf Caption;
|
||||
|
||||
int32_t Cursor;
|
||||
int32_t DownCursor;
|
||||
|
||||
StdCopyStrBuf Caption;
|
||||
int32_t CaptionBottomY;
|
||||
int32_t KeepCaption;
|
||||
|
||||
int32_t VpX,VpY; // Pixel coordinates of mouse pos
|
||||
float ViewX,ViewY; // Game coordinate scrolling offset of viewport
|
||||
float GameX,GameY; // Game coordinates of mouse pos
|
||||
float GuiX,GuiY; // GUI coorindates of mouse pos
|
||||
C4Facet fctViewport, fctViewportGame, fctViewportGUI;
|
||||
|
||||
float DownX,DownY; // Game coordinates of mouse-down-pos while dragging
|
||||
float DownOffsetX,DownOffsetY; // GUI coordinate offset from target region while dragging
|
||||
int32_t ShowPointX,ShowPointY; // Game coordinates of throw point
|
||||
int32_t KeepCaption;
|
||||
|
||||
int32_t ScrollSpeed;
|
||||
int32_t Drag,DragSelecting;
|
||||
int32_t Drag;
|
||||
|
||||
bool LeftButtonDown,RightButtonDown,LeftDoubleIgnoreUp;
|
||||
bool ButtonDownOnSelection;
|
||||
bool ControlDown;
|
||||
|
@ -84,18 +86,18 @@ protected:
|
|||
bool InitCentered;
|
||||
bool FogOfWar;
|
||||
bool Visible;
|
||||
|
||||
C4ObjectList Selection; //obsolete!
|
||||
|
||||
C4Object *DragObject;
|
||||
C4ID DragID;
|
||||
C4ObjectList Selection;
|
||||
C4Def* DragImageDef;
|
||||
C4Object* DragImageObject;
|
||||
|
||||
// Target object
|
||||
C4Object *TargetObject; // valid during Move()
|
||||
C4Object *DownTarget;
|
||||
int32_t TimeOnTargetObject;
|
||||
// Region
|
||||
C4Region *TargetRegion; // valid during Move()
|
||||
C4Region DownRegion;
|
||||
public:
|
||||
void Default();
|
||||
void Clear();
|
||||
|
@ -118,23 +120,16 @@ protected:
|
|||
void SendPlayerSelectNext();
|
||||
void UpdateFogOfWar();
|
||||
void RightUpDragNone();
|
||||
void ButtonUpDragConstruct();
|
||||
void ButtonUpDragScript();
|
||||
void ButtonUpDragMoving();
|
||||
void ButtonUpDragSelecting();
|
||||
void LeftUpDragNone();
|
||||
void DragConstruct();
|
||||
void DragScript();
|
||||
void Wheel(DWORD dwFlags);
|
||||
void RightUp();
|
||||
void RightDown();
|
||||
void LeftDouble();
|
||||
void DragNone();
|
||||
void DragMoving();
|
||||
void LeftUp();
|
||||
void DragSelect();
|
||||
void LeftDown();
|
||||
void UpdateTargetRegion();
|
||||
void UpdateScrolling();
|
||||
void UpdateCursorTarget();
|
||||
void SendCommand(int32_t iCommand, int32_t iX=0, int32_t iY=0, C4Object *pTarget=NULL, C4Object *pTarget2=NULL, int32_t iData=0, int32_t iAddMode=C4P_Command_Set);
|
||||
|
@ -150,7 +145,6 @@ protected:
|
|||
|
||||
public:
|
||||
bool IsDragging();
|
||||
void StartConstructionDrag(C4ID id);
|
||||
int32_t GetPlayer() { return Player; }
|
||||
};
|
||||
|
||||
|
|
|
@ -1,163 +0,0 @@
|
|||
/*
|
||||
* OpenClonk, http://www.openclonk.org
|
||||
*
|
||||
* Copyright (c) 1998-2000 Matthes Bender
|
||||
* Copyright (c) 2005 Sven Eberhardt
|
||||
* Copyright (c) 2006, 2009 Günther Brammer
|
||||
* Copyright (c) 2001-2009, RedWolf Design GmbH, http://www.clonk.de
|
||||
*
|
||||
* Portions might be copyrighted by other authors who have contributed
|
||||
* to OpenClonk.
|
||||
*
|
||||
* Permission to use, copy, modify, and/or distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
* copyright notice and this permission notice appear in all copies.
|
||||
* See isc_license.txt for full license and disclaimer.
|
||||
*
|
||||
* "Clonk" is a registered trademark of Matthes Bender.
|
||||
* See clonk_trademark_license.txt for full license.
|
||||
*/
|
||||
|
||||
/* Screen area marked for mouse interaction */
|
||||
|
||||
#include <C4Include.h>
|
||||
#include <C4Region.h>
|
||||
|
||||
#include <C4Facet.h>
|
||||
|
||||
C4Region::C4Region()
|
||||
{
|
||||
Default();
|
||||
}
|
||||
|
||||
C4Region::~C4Region()
|
||||
{
|
||||
Clear();
|
||||
}
|
||||
|
||||
void C4Region::Default()
|
||||
{
|
||||
X=Y=Wdt=Hgt=0;
|
||||
Caption[0]=0;
|
||||
Com=RightCom=MoveOverCom=HoldCom=COM_None;
|
||||
Data=0;
|
||||
id=C4ID::None;
|
||||
Target=NULL;
|
||||
}
|
||||
|
||||
void C4Region::Clear()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
C4RegionList::C4RegionList()
|
||||
{
|
||||
Default();
|
||||
}
|
||||
|
||||
C4RegionList::~C4RegionList()
|
||||
{
|
||||
Clear();
|
||||
}
|
||||
|
||||
void C4RegionList::Default()
|
||||
{
|
||||
First=NULL;
|
||||
AdjustX=AdjustY=0;
|
||||
}
|
||||
|
||||
void C4RegionList::Clear()
|
||||
{
|
||||
C4Region *pRgn,*pNext;
|
||||
for (pRgn=First; pRgn; pRgn=pNext) { pNext=pRgn->Next; delete pRgn; }
|
||||
First=NULL;
|
||||
}
|
||||
|
||||
bool C4RegionList::Add(int iX, int iY, int iWdt, int iHgt, const char *szCaption,
|
||||
int iCom, C4Object *pTarget, int iMoveOverCom, int iHoldCom, int iData)
|
||||
{
|
||||
C4Region *pRgn = new C4Region;
|
||||
pRgn->Set(iX+AdjustX,iY+AdjustY,iWdt,iHgt,szCaption,iCom,iMoveOverCom,iHoldCom,iData,pTarget);
|
||||
pRgn->Next=First;
|
||||
First=pRgn;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool C4RegionList::Add(C4Facet &fctArea, const char *szCaption, int iCom, C4Object *pTarget, int iMoveOverCom, int iHoldCom, int iData)
|
||||
{
|
||||
return Add(fctArea.X,fctArea.Y,fctArea.Wdt,fctArea.Hgt,szCaption,iCom,pTarget,iMoveOverCom,iHoldCom,iData);
|
||||
}
|
||||
|
||||
bool C4RegionList::Add(C4Region &rRegion)
|
||||
{
|
||||
C4Region *pRgn = new C4Region;
|
||||
*pRgn = rRegion;
|
||||
pRgn->X+=AdjustX;
|
||||
pRgn->Y+=AdjustY;
|
||||
pRgn->Next=First;
|
||||
First=pRgn;
|
||||
return true;
|
||||
}
|
||||
|
||||
void C4Region::Set(int iX, int iY, int iWdt, int iHgt, const char *szCaption,
|
||||
int iCom, int iMoveOverCom, int iHoldCom, int iData,
|
||||
C4Object *pTarget)
|
||||
{
|
||||
X=iX; Y=iY; Wdt=iWdt; Hgt=iHgt;
|
||||
SCopy(szCaption,Caption,C4RGN_MaxCaption);
|
||||
Com=iCom; MoveOverCom=iMoveOverCom; HoldCom=iHoldCom;
|
||||
Data=iData;
|
||||
Target=pTarget;
|
||||
}
|
||||
|
||||
void C4RegionList::SetAdjust(int iX, int iY)
|
||||
{
|
||||
AdjustX=iX; AdjustY=iY;
|
||||
}
|
||||
|
||||
C4Region* C4RegionList::Find(int iX, int iY)
|
||||
{
|
||||
for (C4Region *pRgn=First; pRgn; pRgn=pRgn->Next)
|
||||
if (Inside(iX-pRgn->X,0,pRgn->Wdt-1))
|
||||
if (Inside(iY-pRgn->Y,0,pRgn->Hgt-1))
|
||||
return pRgn;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void C4Region::ClearPointers(C4Object *pObj)
|
||||
{
|
||||
if (Target==pObj) Target=NULL;
|
||||
}
|
||||
|
||||
void C4RegionList::ClearPointers(C4Object *pObj)
|
||||
{
|
||||
for (C4Region *pRgn=First; pRgn; pRgn=pRgn->Next)
|
||||
pRgn->ClearPointers(pObj);
|
||||
}
|
||||
|
||||
void C4Region::Set(C4Facet &fctArea, const char *szCaption, C4Object *pTarget)
|
||||
{
|
||||
X=fctArea.X;
|
||||
Y=fctArea.Y;
|
||||
Wdt=fctArea.Wdt;
|
||||
Hgt=fctArea.Hgt;
|
||||
if (szCaption) SCopy(szCaption,Caption,C4RGN_MaxCaption);
|
||||
if (pTarget) Target=pTarget;
|
||||
}
|
||||
|
||||
bool C4RegionList::Add(C4RegionList &rRegionList, bool fAdjust)
|
||||
{
|
||||
C4Region *pNewFirst=NULL,*pPrev=NULL;
|
||||
for (C4Region *cRgn=rRegionList.First; cRgn; cRgn=cRgn->Next)
|
||||
{
|
||||
C4Region *pRgn = new C4Region;
|
||||
*pRgn = *cRgn;
|
||||
if (fAdjust) { pRgn->X+=AdjustX; pRgn->Y+=AdjustY; }
|
||||
pRgn->Next=First;
|
||||
if (!pNewFirst) pNewFirst=pRgn;
|
||||
if (pPrev) pPrev->Next=pRgn;
|
||||
pPrev=pRgn;
|
||||
}
|
||||
if (pNewFirst) First=pNewFirst;
|
||||
return true;
|
||||
}
|
|
@ -1,77 +0,0 @@
|
|||
/*
|
||||
* OpenClonk, http://www.openclonk.org
|
||||
*
|
||||
* Copyright (c) 1998-2000 Matthes Bender
|
||||
* Copyright (c) 2001, 2005 Sven Eberhardt
|
||||
* Copyright (c) 2001-2009, RedWolf Design GmbH, http://www.clonk.de
|
||||
*
|
||||
* Portions might be copyrighted by other authors who have contributed
|
||||
* to OpenClonk.
|
||||
*
|
||||
* Permission to use, copy, modify, and/or distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
* copyright notice and this permission notice appear in all copies.
|
||||
* See isc_license.txt for full license and disclaimer.
|
||||
*
|
||||
* "Clonk" is a registered trademark of Matthes Bender.
|
||||
* See clonk_trademark_license.txt for full license.
|
||||
*/
|
||||
|
||||
/* Screen area marked for mouse interaction */
|
||||
|
||||
#ifndef INC_C4Region
|
||||
#define INC_C4Region
|
||||
|
||||
#include <C4Id.h>
|
||||
#include <C4Constants.h>
|
||||
|
||||
class C4Object;
|
||||
class C4Facet;
|
||||
|
||||
const int C4RGN_MaxCaption=256;
|
||||
|
||||
class C4Region
|
||||
{
|
||||
friend class C4RegionList;
|
||||
public:
|
||||
C4Region();
|
||||
~C4Region();
|
||||
public:
|
||||
int X,Y,Wdt,Hgt;
|
||||
char Caption[C4RGN_MaxCaption+1];
|
||||
int Com,RightCom,MoveOverCom,HoldCom;
|
||||
int Data;
|
||||
C4ID id;
|
||||
C4Object *Target;
|
||||
protected:
|
||||
C4Region *Next;
|
||||
public:
|
||||
void Set(C4Facet &fctArea, const char *szCaption=NULL, C4Object *pTarget=NULL);
|
||||
void Clear();
|
||||
void Default();
|
||||
void Set(int iX, int iY, int iWdt, int iHgt, const char *szCaption, int iCom, int iMoveOverCom, int iHoldCom, int iData, C4Object *pTarget);
|
||||
protected:
|
||||
void ClearPointers(C4Object *pObj);
|
||||
};
|
||||
|
||||
class C4RegionList
|
||||
{
|
||||
public:
|
||||
C4RegionList();
|
||||
~C4RegionList();
|
||||
protected:
|
||||
int AdjustX,AdjustY;
|
||||
C4Region *First;
|
||||
public:
|
||||
void ClearPointers(C4Object *pObj);
|
||||
void SetAdjust(int iX, int iY);
|
||||
void Clear();
|
||||
void Default();
|
||||
C4Region* Find(int iX, int iY);
|
||||
bool Add(int iX, int iY, int iWdt, int iHgt, const char *szCaption=NULL, int iCom=COM_None, C4Object *pTarget=NULL, int iMoveOverCom=COM_None, int iHoldCom=COM_None, int iData=0);
|
||||
bool Add(C4Facet &fctArea, const char *szCaption=NULL, int iCom=COM_None, C4Object *pTarget=NULL, int iMoveOverCom=COM_None, int iHoldCom=COM_None, int iData=0);
|
||||
bool Add(C4Region &rRegion);
|
||||
bool Add(C4RegionList &rRegionList, bool fAdjust=true);
|
||||
};
|
||||
|
||||
#endif
|
|
@ -954,7 +954,7 @@ void C4GraphicsOverlay::Draw(C4TargetFacet &cgo, C4Object *pForObj, int32_t iByP
|
|||
C4Facet fctTarget;
|
||||
fctTarget.Set(cgo.Surface, offX+pForObj->Shape.x, offY+pForObj->Shape.y, pForObj->Shape.Wdt, pForObj->Shape.Hgt);
|
||||
|
||||
OverlayObj->DrawPicture(fctTarget, false, NULL, &C4DrawTransform(Transform, fctTarget.X+float(fctTarget.Wdt)/2, fctTarget.Y+float(fctTarget.Hgt)/2));
|
||||
OverlayObj->DrawPicture(fctTarget, false, &C4DrawTransform(Transform, fctTarget.X+float(fctTarget.Wdt)/2, fctTarget.Y+float(fctTarget.Hgt)/2));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -2445,12 +2445,10 @@ void C4Object::Denumerate(C4ValueNumbers * numbers)
|
|||
if (pMeshInstance) pMeshInstance->DenumeratePointers();
|
||||
}
|
||||
|
||||
void C4Object::DrawPicture(C4Facet &cgo, bool fSelected, C4RegionList *pRegions, C4DrawTransform* transform)
|
||||
void C4Object::DrawPicture(C4Facet &cgo, bool fSelected, C4DrawTransform* transform)
|
||||
{
|
||||
// Draw def picture with object color
|
||||
Def->Draw(cgo,fSelected,Color,this,0,0,transform);
|
||||
// Region
|
||||
if (pRegions) pRegions->Add(cgo.X,cgo.Y,cgo.Wdt,cgo.Hgt,GetName(),COM_None,this);
|
||||
}
|
||||
|
||||
void C4Object::Picture2Facet(C4FacetSurface &cgo)
|
||||
|
|
|
@ -228,7 +228,7 @@ public:
|
|||
bool AssignInfo();
|
||||
bool ValidateOwner();
|
||||
bool AssignPlrViewRange();
|
||||
void DrawPicture(C4Facet &cgo, bool fSelected=false, C4RegionList *pRegions=NULL,C4DrawTransform* transform=NULL);
|
||||
void DrawPicture(C4Facet &cgo, bool fSelected=false, C4DrawTransform* transform=NULL);
|
||||
void Picture2Facet(C4FacetSurface &cgo); // set picture to facet, or create facet in current size and draw if specific states are being needed
|
||||
void Default();
|
||||
bool Init(C4PropList *ndef, C4Object *pCreator,
|
||||
|
|
|
@ -30,7 +30,6 @@
|
|||
#include <C4DefList.h>
|
||||
#include <C4Object.h>
|
||||
#include <C4Application.h>
|
||||
#include <C4Region.h>
|
||||
#include <C4GraphicsResource.h>
|
||||
#include <C4Game.h>
|
||||
#include <C4GameObjects.h>
|
||||
|
@ -348,60 +347,6 @@ int C4ObjectList::MassCount()
|
|||
return iMass;
|
||||
}
|
||||
|
||||
void C4ObjectList::DrawIDList(C4Facet &cgo, int iSelection,
|
||||
C4DefList &rDefs, int32_t dwCategory,
|
||||
C4RegionList *pRegions, int iRegionCom,
|
||||
bool fDrawOneCounts)
|
||||
{
|
||||
// Calculations & variables
|
||||
/*int iSections = cgo.GetSectionCount();
|
||||
int iItems = ListIDCount(dwCategory);*/
|
||||
//int iFirstItem = BoundBy(iSelection-iSections/2,0,Max(iItems-iSections,0));
|
||||
int32_t cSec = 0;
|
||||
int32_t iCount;
|
||||
C4Facet cgo2;
|
||||
C4Object *pFirstObj;
|
||||
char szCount[10];
|
||||
// objects are sorted in the list already, so just draw them!
|
||||
C4ObjectListIterator iter(*this);
|
||||
while ((pFirstObj = iter.GetNext(&iCount)))
|
||||
{
|
||||
// Section
|
||||
cgo2 = cgo.GetSection(cSec);
|
||||
// draw picture
|
||||
pFirstObj->DrawPicture(cgo2, cSec==iSelection);
|
||||
// Draw count
|
||||
sprintf(szCount,"%dx",iCount);
|
||||
if ((iCount!=1) || fDrawOneCounts)
|
||||
pDraw->TextOut(szCount, ::GraphicsResource.FontRegular, 1.0, cgo2.Surface,cgo2.X+cgo2.Wdt-1,cgo2.Y+cgo2.Hgt-1-::GraphicsResource.FontRegular.iLineHgt,C4Draw::DEFAULT_MESSAGE_COLOR,ARight);
|
||||
// Region
|
||||
if (pRegions) pRegions->Add(cgo2.X,cgo2.Y,cgo2.Wdt,cgo2.Hgt,pFirstObj->GetName(),iRegionCom,pFirstObj,COM_None,COM_None,pFirstObj->Number);
|
||||
// Next section
|
||||
cSec++;
|
||||
}
|
||||
// Draw by list sorted ids
|
||||
/* for (cPos=0; c_id=GetListID(dwCategory,cPos); cPos++)
|
||||
if (Inside(cPos,iFirstItem,iFirstItem+iSections-1))
|
||||
{
|
||||
// First object of this type
|
||||
pFirstObj = Find(c_id);
|
||||
// Count
|
||||
iCount=ObjectCount(c_id);
|
||||
// Section
|
||||
cgo2 = cgo.GetSection(cSec);
|
||||
// Draw by definition
|
||||
rDefs.Draw( c_id, cgo2, (cPos==iSelection), pFirstObj->Color, pFirstObj );
|
||||
// Draw count
|
||||
sprintf(szCount,"%dx",iCount);
|
||||
if ((iCount!=1) || fDrawOneCounts)
|
||||
pDraw->TextOut(szCount,cgo2.Surface,cgo2.X+cgo2.Wdt-1,cgo2.Y+cgo2.Hgt-1-pDraw->TextHeight(),FWhite,ARight);
|
||||
// Region
|
||||
if (pRegions) pRegions->Add(cgo2.X,cgo2.Y,cgo2.Wdt,cgo2.Hgt,pFirstObj->GetName(),iRegionCom,pFirstObj,COM_None,COM_None,pFirstObj->id);
|
||||
// Next section
|
||||
cSec++;
|
||||
} */
|
||||
}
|
||||
|
||||
int C4ObjectList::ClearPointers(C4Object *pObj)
|
||||
{
|
||||
int rval=0;
|
||||
|
|
|
@ -31,7 +31,6 @@ class C4Object;
|
|||
class C4ObjectList;
|
||||
class C4ObjectInfo;
|
||||
class C4TargetFacet;
|
||||
class C4RegionList;
|
||||
|
||||
class C4ObjectLink
|
||||
{
|
||||
|
@ -95,7 +94,6 @@ public:
|
|||
void Copy(const C4ObjectList &rList);
|
||||
void DrawIfCategory(C4TargetFacet &cgo, int iPlayer, uint32_t dwCat, bool fInvert); // draw all objects that match dwCat (or don't match if fInvert)
|
||||
void Draw(C4TargetFacet &cgo, int iPlayer, int MinPlane, int MaxPlane); // draw all objects
|
||||
void DrawIDList(C4Facet &cgo, int iSelection, C4DefList &rDefs, int32_t dwCategory, C4RegionList *pRegions=NULL, int iRegionCom=COM_None, bool fDrawOneCounts=true);
|
||||
void DrawSelectMark(C4TargetFacet &cgo);
|
||||
void CloseMenus();
|
||||
void UpdateGraphics(bool fGraphicsChanged);
|
||||
|
|
Loading…
Reference in New Issue