mirror of
https://github.com/The-Powder-Toy/The-Powder-Toy.git
synced 2025-08-31 11:41:51 +02:00
change tpt.fillrect dimentions to old tpt ones, move brush list generating out of BuildMenus
This commit is contained in:
@@ -1333,8 +1333,8 @@ int luatpt_fillrect(lua_State* l)
|
|||||||
int x,y,w,h,r,g,b,a;
|
int x,y,w,h,r,g,b,a;
|
||||||
x = luaL_optint(l, 1, 0)+1;
|
x = luaL_optint(l, 1, 0)+1;
|
||||||
y = luaL_optint(l, 2, 0)+1;
|
y = luaL_optint(l, 2, 0)+1;
|
||||||
w = luaL_optint(l, 3, 10)+1;
|
w = luaL_optint(l, 3, 10)-1;
|
||||||
h = luaL_optint(l, 4, 10)+1;
|
h = luaL_optint(l, 4, 10)-1;
|
||||||
r = luaL_optint(l, 5, 255);
|
r = luaL_optint(l, 5, 255);
|
||||||
g = luaL_optint(l, 6, 255);
|
g = luaL_optint(l, 6, 255);
|
||||||
b = luaL_optint(l, 7, 255);
|
b = luaL_optint(l, 7, 255);
|
||||||
|
@@ -101,6 +101,30 @@ GameModel::GameModel():
|
|||||||
|
|
||||||
BuildMenus();
|
BuildMenus();
|
||||||
|
|
||||||
|
//Set default brush palette
|
||||||
|
brushList.push_back(new EllipseBrush(ui::Point(4, 4)));
|
||||||
|
brushList.push_back(new Brush(ui::Point(4, 4)));
|
||||||
|
brushList.push_back(new TriangleBrush(ui::Point(4, 4)));
|
||||||
|
|
||||||
|
//Load more from brushes folder
|
||||||
|
std::vector<string> brushFiles = Client::Ref().DirectorySearch(BRUSH_DIR, "", ".ptb");
|
||||||
|
for(int i = 0; i < brushFiles.size(); i++)
|
||||||
|
{
|
||||||
|
std::vector<unsigned char> brushData = Client::Ref().ReadFile(brushFiles[i]);
|
||||||
|
if(!brushData.size())
|
||||||
|
{
|
||||||
|
std::cout << "Brushes: Skipping " << brushFiles[i] << ". Could not open" << std::endl;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
int dimension = std::sqrt((float)brushData.size());
|
||||||
|
if(dimension * dimension != brushData.size())
|
||||||
|
{
|
||||||
|
std::cout << "Brushes: Skipping " << brushFiles[i] << ". Invalid bitmap size" << std::endl;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
brushList.push_back(new BitmapBrush(brushData, ui::Point(dimension, dimension)));
|
||||||
|
}
|
||||||
|
|
||||||
//Set default decoration colour
|
//Set default decoration colour
|
||||||
unsigned char colourR = min(Client::Ref().GetPrefInteger("Decoration.Red", 200), 255);
|
unsigned char colourR = min(Client::Ref().GetPrefInteger("Decoration.Red", 200), 255);
|
||||||
unsigned char colourG = min(Client::Ref().GetPrefInteger("Decoration.Green", 100), 255);
|
unsigned char colourG = min(Client::Ref().GetPrefInteger("Decoration.Green", 100), 255);
|
||||||
@@ -306,31 +330,6 @@ void GameModel::BuildMenus()
|
|||||||
decoToolset[1] = GetToolFromIdentifier("DEFAULT_DECOR_CLR");
|
decoToolset[1] = GetToolFromIdentifier("DEFAULT_DECOR_CLR");
|
||||||
decoToolset[2] = GetToolFromIdentifier("DEFAULT_UI_SAMPLE");
|
decoToolset[2] = GetToolFromIdentifier("DEFAULT_UI_SAMPLE");
|
||||||
|
|
||||||
//Set default brush palette
|
|
||||||
brushList.push_back(new EllipseBrush(ui::Point(4, 4)));
|
|
||||||
brushList.push_back(new Brush(ui::Point(4, 4)));
|
|
||||||
brushList.push_back(new TriangleBrush(ui::Point(4, 4)));
|
|
||||||
|
|
||||||
//Load more from brushes folder
|
|
||||||
std::vector<string> brushFiles = Client::Ref().DirectorySearch(BRUSH_DIR, "", ".ptb");
|
|
||||||
for(int i = 0; i < brushFiles.size(); i++)
|
|
||||||
{
|
|
||||||
std::vector<unsigned char> brushData = Client::Ref().ReadFile(brushFiles[i]);
|
|
||||||
if(!brushData.size())
|
|
||||||
{
|
|
||||||
std::cout << "Brushes: Skipping " << brushFiles[i] << ". Could not open" << std::endl;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
int dimension = std::sqrt((float)brushData.size());
|
|
||||||
if(dimension * dimension != brushData.size())
|
|
||||||
{
|
|
||||||
std::cout << "Brushes: Skipping " << brushFiles[i] << ". Invalid bitmap size" << std::endl;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
brushList.push_back(new BitmapBrush(brushData, ui::Point(dimension, dimension)));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//Set default tools
|
//Set default tools
|
||||||
regularToolset[0] = GetToolFromIdentifier("DEFAULT_PT_DUST");
|
regularToolset[0] = GetToolFromIdentifier("DEFAULT_PT_DUST");
|
||||||
regularToolset[1] = GetToolFromIdentifier("DEFAULT_PT_NONE");
|
regularToolset[1] = GetToolFromIdentifier("DEFAULT_PT_NONE");
|
||||||
|
Reference in New Issue
Block a user