add back replace mode and specific delete. Activated with insert key / delete key, use ctrl+alt click to select what to use for the checks
This commit is contained in:
parent
cc887995c0
commit
f56a2f6000
@ -84,6 +84,7 @@ LuaScriptInterface::LuaScriptInterface(GameController * c, GameModel * m):
|
||||
luacon_selectedl(""),
|
||||
luacon_selectedr(""),
|
||||
luacon_selectedalt(""),
|
||||
luacon_selectedreplace(""),
|
||||
luacon_mousedown(false)
|
||||
{
|
||||
luacon_model = m;
|
||||
@ -2821,6 +2822,8 @@ bool LuaScriptInterface::OnActiveToolChanged(int toolSelection, Tool * tool)
|
||||
luacon_selectedr = tool->GetIdentifier();
|
||||
else if (toolSelection == 2)
|
||||
luacon_selectedalt = tool->GetIdentifier();
|
||||
else if (toolSelection == 3)
|
||||
luacon_selectedreplace = tool->GetIdentifier();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -46,7 +46,7 @@ class TPTScriptInterface;
|
||||
class LuaScriptInterface: public CommandInterface
|
||||
{
|
||||
int luacon_mousex, luacon_mousey, luacon_mousebutton, luacon_brushx, luacon_brushy;
|
||||
std::string luacon_selectedl, luacon_selectedr, luacon_selectedalt;
|
||||
std::string luacon_selectedl, luacon_selectedr, luacon_selectedalt, luacon_selectedreplace;
|
||||
bool luacon_mousedown;
|
||||
bool currentCommand;
|
||||
TPTScriptInterface * legacy;
|
||||
|
@ -1001,6 +1001,8 @@ void GameController::SetActiveTool(int toolSelection, Tool * tool)
|
||||
toolSelection = 0;
|
||||
gameModel->SetActiveTool(toolSelection, tool);
|
||||
gameModel->GetRenderer()->gravityZonesEnabled = false;
|
||||
if (toolSelection == 3)
|
||||
gameModel->GetSimulation()->replaceModeSelected = tool->GetToolID();
|
||||
gameModel->SetLastTool(tool);
|
||||
for(int i = 0; i < 3; i++)
|
||||
{
|
||||
@ -1011,6 +1013,16 @@ void GameController::SetActiveTool(int toolSelection, Tool * tool)
|
||||
}
|
||||
}
|
||||
|
||||
int GameController::GetReplaceModeFlags()
|
||||
{
|
||||
return gameModel->GetSimulation()->replaceModeFlags;
|
||||
}
|
||||
|
||||
void GameController::SetReplaceModeFlags(int flags)
|
||||
{
|
||||
gameModel->GetSimulation()->replaceModeFlags = flags;
|
||||
}
|
||||
|
||||
void GameController::OpenSearch()
|
||||
{
|
||||
if(!search)
|
||||
|
@ -102,6 +102,8 @@ public:
|
||||
std::vector<Menu*> GetMenuList();
|
||||
Tool * GetActiveTool(int selection);
|
||||
void SetActiveTool(int toolSelection, Tool * tool);
|
||||
int GetReplaceModeFlags();
|
||||
void SetReplaceModeFlags(int flags);
|
||||
void ActiveToolChanged(int toolSelection, Tool *tool);
|
||||
void SetActiveColourPreset(int preset);
|
||||
void SetColour(ui::Colour colour);
|
||||
|
@ -39,8 +39,8 @@ GameModel::GameModel():
|
||||
|
||||
activeTools = regularToolset;
|
||||
|
||||
std::fill(decoToolset, decoToolset+3, (Tool*)NULL);
|
||||
std::fill(regularToolset, regularToolset+3, (Tool*)NULL);
|
||||
std::fill(decoToolset, decoToolset+4, (Tool*)NULL);
|
||||
std::fill(regularToolset, regularToolset+4, (Tool*)NULL);
|
||||
|
||||
//Default render prefs
|
||||
std::vector<unsigned int> tempArray;
|
||||
@ -235,13 +235,15 @@ void GameModel::BuildMenus()
|
||||
if(activeMenu != -1)
|
||||
lastMenu = activeMenu;
|
||||
|
||||
std::string activeToolIdentifiers[3];
|
||||
std::string activeToolIdentifiers[4];
|
||||
if(regularToolset[0])
|
||||
activeToolIdentifiers[0] = regularToolset[0]->GetIdentifier();
|
||||
if(regularToolset[1])
|
||||
activeToolIdentifiers[1] = regularToolset[1]->GetIdentifier();
|
||||
if(regularToolset[2])
|
||||
activeToolIdentifiers[2] = regularToolset[2]->GetIdentifier();
|
||||
if(regularToolset[3])
|
||||
activeToolIdentifiers[3] = regularToolset[3]->GetIdentifier();
|
||||
|
||||
//Empty current menus
|
||||
for(std::vector<Menu*>::iterator iter = menuList.begin(), end = menuList.end(); iter != end; ++iter)
|
||||
@ -338,11 +340,13 @@ void GameModel::BuildMenus()
|
||||
decoToolset[0] = GetToolFromIdentifier("DEFAULT_DECOR_SET");
|
||||
decoToolset[1] = GetToolFromIdentifier("DEFAULT_DECOR_CLR");
|
||||
decoToolset[2] = GetToolFromIdentifier("DEFAULT_UI_SAMPLE");
|
||||
decoToolset[3] = GetToolFromIdentifier("DEFAULT_PT_NONE");
|
||||
|
||||
//Set default tools
|
||||
regularToolset[0] = GetToolFromIdentifier("DEFAULT_PT_DUST");
|
||||
regularToolset[1] = GetToolFromIdentifier("DEFAULT_PT_NONE");
|
||||
regularToolset[2] = GetToolFromIdentifier("DEFAULT_UI_SAMPLE");
|
||||
regularToolset[3] = GetToolFromIdentifier("DEFAULT_PT_NONE");
|
||||
|
||||
|
||||
if(activeToolIdentifiers[0].length())
|
||||
@ -351,6 +355,8 @@ void GameModel::BuildMenus()
|
||||
regularToolset[1] = GetToolFromIdentifier(activeToolIdentifiers[1]);
|
||||
if(activeToolIdentifiers[2].length())
|
||||
regularToolset[2] = GetToolFromIdentifier(activeToolIdentifiers[2]);
|
||||
if(activeToolIdentifiers[3].length())
|
||||
regularToolset[3] = GetToolFromIdentifier(activeToolIdentifiers[3]);
|
||||
|
||||
lastTool = activeTools[0];
|
||||
|
||||
|
@ -62,8 +62,8 @@ private:
|
||||
Renderer * ren;
|
||||
Tool * lastTool;
|
||||
Tool ** activeTools;
|
||||
Tool * decoToolset[3];
|
||||
Tool * regularToolset[3];
|
||||
Tool * decoToolset[4];
|
||||
Tool * regularToolset[4];
|
||||
User currentUser;
|
||||
float toolStrength;
|
||||
std::deque<Snapshot*> history;
|
||||
|
@ -518,7 +518,9 @@ public:
|
||||
void ActionCallback(ui::Button * sender_)
|
||||
{
|
||||
ToolButton *sender = (ToolButton*)sender_;
|
||||
if(sender->GetSelectionState() >= 0 && sender->GetSelectionState() <= 2)
|
||||
if (v->CtrlBehaviour() && v->AltBehaviour() && !v->ShiftBehaviour())
|
||||
sender->SetSelectionState(3);
|
||||
if(sender->GetSelectionState() >= 0 && sender->GetSelectionState() <= 3)
|
||||
v->c->SetActiveTool(sender->GetSelectionState(), tool);
|
||||
}
|
||||
};
|
||||
@ -631,6 +633,10 @@ void GameView::NotifyActiveToolsChanged(GameModel * sender)
|
||||
{
|
||||
toolButtons[i]->SetSelectionState(2); //Tertiary
|
||||
}
|
||||
else if(sender->GetActiveTool(3) == tool)
|
||||
{
|
||||
toolButtons[i]->SetSelectionState(3); //Replace Mode
|
||||
}
|
||||
else
|
||||
{
|
||||
toolButtons[i]->SetSelectionState(-1);
|
||||
@ -640,6 +646,7 @@ void GameView::NotifyActiveToolsChanged(GameModel * sender)
|
||||
c->ActiveToolChanged(0, sender->GetActiveTool(0));
|
||||
c->ActiveToolChanged(1, sender->GetActiveTool(1));
|
||||
c->ActiveToolChanged(2, sender->GetActiveTool(2));
|
||||
c->ActiveToolChanged(3, sender->GetActiveTool(3));
|
||||
}
|
||||
|
||||
void GameView::NotifyLastToolChanged(GameModel * sender)
|
||||
@ -713,6 +720,10 @@ void GameView::NotifyToolListChanged(GameModel * sender)
|
||||
{
|
||||
tempButton->SetSelectionState(2); //Tertiary
|
||||
}
|
||||
else if(sender->GetActiveTool(3) == toolList[i])
|
||||
{
|
||||
tempButton->SetSelectionState(3); //Replace mode
|
||||
}
|
||||
|
||||
tempButton->Appearance.HorizontalAlign = ui::Appearance::AlignCentre;
|
||||
tempButton->Appearance.VerticalAlign = ui::Appearance::AlignMiddle;
|
||||
@ -1461,6 +1472,11 @@ void GameView::OnKeyPress(int key, Uint16 character, bool shift, bool ctrl, bool
|
||||
break;
|
||||
}
|
||||
|
||||
if (key == SDLK_INSERT)
|
||||
c->SetReplaceModeFlags(c->GetReplaceModeFlags()^REPLACE_MODE);
|
||||
else if (key == SDLK_DELETE)
|
||||
c->SetReplaceModeFlags(c->GetReplaceModeFlags()^SPECIFIC_DELETE);
|
||||
|
||||
if (shift && showDebug && key == '1')
|
||||
c->LoadRenderPreset(10);
|
||||
else if(key >= '0' && key <= '9')
|
||||
@ -2162,6 +2178,10 @@ void GameView::OnDraw()
|
||||
|
||||
if (showDebug)
|
||||
fpsInfo << " Parts: " << sample.NumParts;
|
||||
if (c->GetReplaceModeFlags()&REPLACE_MODE)
|
||||
fpsInfo << " [REPLACE MODE]";
|
||||
if (c->GetReplaceModeFlags()&SPECIFIC_DELETE)
|
||||
fpsInfo << " [SPECIFIC DELETE]";
|
||||
if (ren->GetGridSize())
|
||||
fpsInfo << " [GRID: " << ren->GetGridSize() << "]";
|
||||
|
||||
|
@ -138,6 +138,7 @@ public:
|
||||
bool GetDebugHUD();
|
||||
bool CtrlBehaviour(){ return ctrlBehaviour; }
|
||||
bool ShiftBehaviour(){ return shiftBehaviour; }
|
||||
bool AltBehaviour(){ return altBehaviour; }
|
||||
void ExitPrompt();
|
||||
SelectMode GetSelectMode() { return selectMode; }
|
||||
void BeginStampSelection();
|
||||
|
@ -33,7 +33,7 @@ void ToolButton::Draw(const ui::Point& screenPos)
|
||||
Graphics * g = ui::Engine::Ref().g;
|
||||
int totalColour = Appearance.BackgroundInactive.Blue + (3*Appearance.BackgroundInactive.Green) + (2*Appearance.BackgroundInactive.Red);
|
||||
|
||||
if(Appearance.GetTexture())
|
||||
if (Appearance.GetTexture())
|
||||
{
|
||||
g->draw_image(Appearance.GetTexture(), screenPos.X+2, screenPos.Y+2, 255);
|
||||
}
|
||||
@ -42,7 +42,7 @@ void ToolButton::Draw(const ui::Point& screenPos)
|
||||
g->fillrect(screenPos.X+2, screenPos.Y+2, Size.X-4, Size.Y-4, Appearance.BackgroundInactive.Red, Appearance.BackgroundInactive.Green, Appearance.BackgroundInactive.Blue, Appearance.BackgroundInactive.Alpha);
|
||||
}
|
||||
|
||||
if(isMouseInside && currentSelection == -1)
|
||||
if (isMouseInside && currentSelection == -1)
|
||||
{
|
||||
g->drawrect(screenPos.X, screenPos.Y, Size.X, Size.Y, Appearance.BorderActive.Red, Appearance.BorderActive.Green, Appearance.BorderActive.Blue, Appearance.BorderActive.Alpha);
|
||||
}
|
||||
@ -75,6 +75,9 @@ void ToolButton::SetSelectionState(int state)
|
||||
case 2:
|
||||
Appearance.BorderInactive = ui::Colour(0, 255, 0);
|
||||
break;
|
||||
case 3:
|
||||
Appearance.BorderInactive = ui::Colour(0, 255, 255);
|
||||
break;
|
||||
default:
|
||||
Appearance.BorderInactive = ui::Colour(0, 0, 0);
|
||||
break;
|
||||
|
@ -3,7 +3,8 @@
|
||||
|
||||
#include "gui/interface/Button.h"
|
||||
|
||||
class ToolButton: public ui::Button {
|
||||
class ToolButton: public ui::Button
|
||||
{
|
||||
int currentSelection;
|
||||
public:
|
||||
ToolButton(ui::Point position, ui::Point size, std::string text_, std::string toolTip = "");
|
||||
|
Loading…
Reference in New Issue
Block a user