mirror of
https://github.com/The-Powder-Toy/The-Powder-Toy.git
synced 2025-08-17 21:51:20 +02:00
a few minor improvements so that stamps are more consistent in tpt++ / my mod
This commit is contained in:
@@ -495,11 +495,15 @@ void GameController::DrawPoints(int toolSelection, queue<ui::Point> & pointQueue
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void GameController::LoadClipboard()
|
bool GameController::LoadClipboard()
|
||||||
{
|
{
|
||||||
gameModel->SetPlaceSave(gameModel->GetClipboard());
|
GameSave *clip = gameModel->GetClipboard();
|
||||||
if(gameModel->GetPlaceSave() && gameModel->GetPlaceSave()->Collapsed())
|
if (!clip)
|
||||||
|
return false;
|
||||||
|
gameModel->SetPlaceSave(clip);
|
||||||
|
if (gameModel->GetPlaceSave() && gameModel->GetPlaceSave()->Collapsed())
|
||||||
gameModel->GetPlaceSave()->Expand();
|
gameModel->GetPlaceSave()->Expand();
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GameController::LoadStamp(GameSave *stamp)
|
void GameController::LoadStamp(GameSave *stamp)
|
||||||
|
@@ -155,7 +155,7 @@ public:
|
|||||||
void ToggleAHeat();
|
void ToggleAHeat();
|
||||||
void ToggleNewtonianGravity();
|
void ToggleNewtonianGravity();
|
||||||
|
|
||||||
void LoadClipboard();
|
bool LoadClipboard();
|
||||||
void LoadStamp(GameSave *stamp);
|
void LoadStamp(GameSave *stamp);
|
||||||
|
|
||||||
void RemoveNotification(Notification * notification);
|
void RemoveNotification(Notification * notification);
|
||||||
|
@@ -1130,7 +1130,7 @@ void GameView::OnMouseUp(int x, int y, unsigned button)
|
|||||||
{
|
{
|
||||||
if (selectMode != SelectNone)
|
if (selectMode != SelectNone)
|
||||||
{
|
{
|
||||||
if (button == BUTTON_LEFT)
|
if (button == BUTTON_LEFT && selectPoint1.X != -1 && selectPoint1.Y != -1 && selectPoint2.X != -1 && selectPoint2.Y != -1)
|
||||||
{
|
{
|
||||||
if (selectMode == PlaceSave)
|
if (selectMode == PlaceSave)
|
||||||
{
|
{
|
||||||
@@ -1496,7 +1496,7 @@ void GameView::OnKeyPress(int key, Uint16 character, bool shift, bool ctrl, bool
|
|||||||
if(ctrl)
|
if(ctrl)
|
||||||
{
|
{
|
||||||
selectMode = SelectCopy;
|
selectMode = SelectCopy;
|
||||||
selectPoint1 = ui::Point(-1, -1);
|
selectPoint1 = selectPoint2 = ui::Point(-1, -1);
|
||||||
buttonTip = "\x0F\xEF\xEF\020Click-and-drag to specify an area to copy (right click = cancel)";
|
buttonTip = "\x0F\xEF\xEF\020Click-and-drag to specify an area to copy (right click = cancel)";
|
||||||
buttonTipShow = 120;
|
buttonTipShow = 120;
|
||||||
}
|
}
|
||||||
@@ -1505,7 +1505,7 @@ void GameView::OnKeyPress(int key, Uint16 character, bool shift, bool ctrl, bool
|
|||||||
if(ctrl)
|
if(ctrl)
|
||||||
{
|
{
|
||||||
selectMode = SelectCut;
|
selectMode = SelectCut;
|
||||||
selectPoint1 = ui::Point(-1, -1);
|
selectPoint1 = selectPoint2 = ui::Point(-1, -1);
|
||||||
buttonTip = "\x0F\xEF\xEF\020Click-and-drag to specify an area to copy then cut (right click = cancel)";
|
buttonTip = "\x0F\xEF\xEF\020Click-and-drag to specify an area to copy then cut (right click = cancel)";
|
||||||
buttonTipShow = 120;
|
buttonTipShow = 120;
|
||||||
}
|
}
|
||||||
@@ -1513,9 +1513,8 @@ void GameView::OnKeyPress(int key, Uint16 character, bool shift, bool ctrl, bool
|
|||||||
case 'v':
|
case 'v':
|
||||||
if(ctrl)
|
if(ctrl)
|
||||||
{
|
{
|
||||||
c->LoadClipboard();
|
if (c->LoadClipboard());
|
||||||
selectPoint2 = mousePosition;
|
selectPoint1 = selectPoint2 = mousePosition;
|
||||||
selectPoint1 = selectPoint2;
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'l':
|
case 'l':
|
||||||
@@ -1524,15 +1523,13 @@ void GameView::OnKeyPress(int key, Uint16 character, bool shift, bool ctrl, bool
|
|||||||
if (stampList.size())
|
if (stampList.size())
|
||||||
{
|
{
|
||||||
c->LoadStamp(Client::Ref().GetStamp(stampList[0])->GetGameSave());
|
c->LoadStamp(Client::Ref().GetStamp(stampList[0])->GetGameSave());
|
||||||
selectPoint2 = mousePosition;
|
selectPoint1 = selectPoint2 = mousePosition;
|
||||||
selectPoint1 = selectPoint2;
|
|
||||||
isMouseDown = false;
|
isMouseDown = false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
case 'k':
|
case 'k':
|
||||||
selectPoint2 = ui::Point(-1, -1);
|
selectPoint1 = selectPoint2 = ui::Point(-1, -1);
|
||||||
selectPoint1 = selectPoint2;
|
|
||||||
c->OpenStamps();
|
c->OpenStamps();
|
||||||
break;
|
break;
|
||||||
case ']':
|
case ']':
|
||||||
|
@@ -134,10 +134,11 @@ struct Point
|
|||||||
return (X != v.X || Y != v.Y);
|
return (X != v.X || Y != v.Y);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void operator = (const Point& v)
|
inline Point operator = (const Point& v)
|
||||||
{
|
{
|
||||||
X = v.X;
|
X = v.X;
|
||||||
Y = v.Y;
|
Y = v.Y;
|
||||||
|
return Point(X, Y);
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
Reference in New Issue
Block a user