mirror of
https://github.com/The-Powder-Toy/The-Powder-Toy.git
synced 2025-08-31 03:39:57 +02:00
fix empty signs being created when shifting them out of bounds, draw parts of images when it goes partway off the top of the screen.
This commit is contained in:
@@ -362,6 +362,12 @@ void PIXELMETHODS_CLASS::draw_image(pixel *img, int x, int y, int w, int h, int
|
|||||||
int i, j, r, g, b;
|
int i, j, r, g, b;
|
||||||
if (!img) return;
|
if (!img) return;
|
||||||
if(y + h > VIDYRES) h = ((VIDYRES)-y)-1; //Adjust height to prevent drawing off the bottom
|
if(y + h > VIDYRES) h = ((VIDYRES)-y)-1; //Adjust height to prevent drawing off the bottom
|
||||||
|
if (y < 0 && -y < h)
|
||||||
|
{
|
||||||
|
img += -y*w;
|
||||||
|
h += y;
|
||||||
|
y = 0;
|
||||||
|
}
|
||||||
if(!h || y < 0) return;
|
if(!h || y < 0) return;
|
||||||
if(a >= 255)
|
if(a >= 255)
|
||||||
for (j=0; j<h; j++)
|
for (j=0; j<h; j++)
|
||||||
|
@@ -101,6 +101,7 @@ void PreviewModel::UpdateSave(int saveID, int saveDate)
|
|||||||
for(int i = 0; i < saveComments->size(); i++)
|
for(int i = 0; i < saveComments->size(); i++)
|
||||||
delete saveComments->at(i);
|
delete saveComments->at(i);
|
||||||
saveComments->clear();
|
saveComments->clear();
|
||||||
|
delete saveComments;
|
||||||
saveComments = NULL;
|
saveComments = NULL;
|
||||||
}
|
}
|
||||||
notifySaveChanged();
|
notifySaveChanged();
|
||||||
@@ -166,6 +167,7 @@ void PreviewModel::UpdateComments(int pageNumber)
|
|||||||
{
|
{
|
||||||
for(int i = 0; i < saveComments->size(); i++)
|
for(int i = 0; i < saveComments->size(); i++)
|
||||||
delete saveComments->at(i);
|
delete saveComments->at(i);
|
||||||
|
saveComments->clear();
|
||||||
delete saveComments;
|
delete saveComments;
|
||||||
saveComments = NULL;
|
saveComments = NULL;
|
||||||
}
|
}
|
||||||
@@ -314,6 +316,7 @@ PreviewModel::~PreviewModel() {
|
|||||||
for(int i = 0; i < saveComments->size(); i++)
|
for(int i = 0; i < saveComments->size(); i++)
|
||||||
delete saveComments->at(i);
|
delete saveComments->at(i);
|
||||||
saveComments->clear();
|
saveComments->clear();
|
||||||
|
delete saveComments;
|
||||||
}
|
}
|
||||||
saveDataBuffer.clear();
|
saveDataBuffer.clear();
|
||||||
}
|
}
|
||||||
|
@@ -146,10 +146,13 @@ int Simulation::Load(int fullX, int fullY, GameSave * save)
|
|||||||
Element_PPIP::ppip_changed = 1;
|
Element_PPIP::ppip_changed = 1;
|
||||||
for(int i = 0; i < save->signs.size() && signs.size() < MAXSIGNS; i++)
|
for(int i = 0; i < save->signs.size() && signs.size() < MAXSIGNS; i++)
|
||||||
{
|
{
|
||||||
sign tempSign = save->signs[i];
|
if (save->signs[i].text[0])
|
||||||
tempSign.x += fullX;
|
{
|
||||||
tempSign.y += fullY;
|
sign tempSign = save->signs[i];
|
||||||
signs.push_back(tempSign);
|
tempSign.x += fullX;
|
||||||
|
tempSign.y += fullY;
|
||||||
|
signs.push_back(tempSign);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
for(int saveBlockX = 0; saveBlockX < save->blockWidth; saveBlockX++)
|
for(int saveBlockX = 0; saveBlockX < save->blockWidth; saveBlockX++)
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user