When on a mission, and the map size changes (*scroll limits change midgame*), we need to make sure that the radar buffer gets reset to the new size of the map.

Fixes ticket:479 (again) and also ticket:494 (which is basically a duplicate of ticket:479)

NOTE: need a Expand_Limbo mission savegame to more fully test this. See notes in structure.c


git-svn-id: https://warzone2100.svn.sourceforge.net/svnroot/warzone2100/trunk@7442 4a71c877-e1ca-e34f-864e-861f7616d084
master
Buginator 2009-05-16 03:33:49 +00:00 committed by Git SVN Gateway
parent 583ae5c048
commit a7e00ca81d
3 changed files with 46 additions and 27 deletions

View File

@ -111,7 +111,8 @@ void radarInitVars(void)
//called for when a new mission is started
void resetRadarRedraw()
{
// nothing here now
// make sure Radar buffer is correct
resizeRadar();
}
BOOL InitRadar(void)

View File

@ -2655,9 +2655,12 @@ BOOL scrSetScrollParams(void)
// When the scroll limits change midgame - need to redo the lighting
initLighting(prevMinX < scrollMinX ? prevMinX : scrollMinX,
prevMinY < scrollMinY ? prevMinY : scrollMinY,
prevMaxX < scrollMaxX ? prevMaxX : scrollMaxX,
prevMaxY < scrollMaxY ? prevMaxY : scrollMaxY);
prevMinY < scrollMinY ? prevMinY : scrollMinY,
prevMaxX < scrollMaxX ? prevMaxX : scrollMaxX,
prevMaxY < scrollMaxY ? prevMaxY : scrollMaxY);
// need to reset radar to take into account of new size
resizeRadar();
return true;
}
@ -2680,15 +2683,18 @@ BOOL scrSetScrollMinX(void)
return false;
}
prevMinX = scrollMinX;
prevMinX = scrollMinX;
scrollMinX = minX;
scrollMinX = minX;
//when the scroll limits change midgame - need to redo the lighting
initLighting(prevMinX < scrollMinX ? prevMinX : scrollMinX,
scrollMinY, scrollMaxX, scrollMaxY);
//when the scroll limits change midgame - need to redo the lighting
initLighting(prevMinX < scrollMinX ? prevMinX : scrollMinX,
scrollMinY, scrollMaxX, scrollMaxY);
return true;
// need to reset radar to take into account of new size
resizeRadar();
return true;
}
// -----------------------------------------------------------------------------------------
@ -2709,16 +2715,19 @@ BOOL scrSetScrollMinY(void)
return false;
}
prevMinY = scrollMinY;
prevMinY = scrollMinY;
scrollMinY = minY;
//when the scroll limits change midgame - need to redo the lighting
initLighting(scrollMinX,
prevMinY < scrollMinY ? prevMinY : scrollMinY,
scrollMaxX, scrollMaxY);
//when the scroll limits change midgame - need to redo the lighting
initLighting(scrollMinX,
prevMinY < scrollMinY ? prevMinY : scrollMinY,
scrollMaxX, scrollMaxY);
return true;
// need to reset radar to take into account of new size
resizeRadar();
return true;
}
// -----------------------------------------------------------------------------------------
@ -2739,16 +2748,19 @@ BOOL scrSetScrollMaxX(void)
return false;
}
prevMaxX = scrollMaxX;
prevMaxX = scrollMaxX;
scrollMaxX = maxX;
//when the scroll limits change midgame - need to redo the lighting
initLighting(scrollMinX, scrollMinY,
prevMaxX < scrollMaxX ? prevMaxX : scrollMaxX,
scrollMaxY);
//when the scroll limits change midgame - need to redo the lighting
initLighting(scrollMinX, scrollMinY,
prevMaxX < scrollMaxX ? prevMaxX : scrollMaxX,
scrollMaxY);
return true;
// need to reset radar to take into account of new size
resizeRadar();
return true;
}
// -----------------------------------------------------------------------------------------
@ -2769,15 +2781,18 @@ BOOL scrSetScrollMaxY(void)
return false;
}
prevMaxY = scrollMaxY;
prevMaxY = scrollMaxY;
scrollMaxY = maxY;
//when the scroll limits change midgame - need to redo the lighting
initLighting(scrollMinX, scrollMinY, scrollMaxX,
prevMaxY < scrollMaxY ? prevMaxY : scrollMaxY);
//when the scroll limits change midgame - need to redo the lighting
initLighting(scrollMinX, scrollMinY, scrollMaxX,
prevMaxY < scrollMaxY ? prevMaxY : scrollMaxY);
return true;
// need to reset radar to take into account of new size
resizeRadar();
return true;
}
// -----------------------------------------------------------------------------------------

View File

@ -1815,6 +1815,7 @@ STRUCTURE* buildStructure(STRUCTURE_STATS* pStructureType, UDWORD x, UDWORD y, U
scrollMinY = 0;
scrollMaxX = mapWidth;
scrollMaxY = mapHeight;
// NOTE: resizeRadar() may be required here, since we change scroll limits?
}
//set the functionality dependant on the type of structure
if(!setFunctionality(psBuilding, pStructureType->type))
@ -1829,6 +1830,7 @@ STRUCTURE* buildStructure(STRUCTURE_STATS* pStructureType, UDWORD x, UDWORD y, U
scrollMinY = preScrollMinY;
scrollMaxX = preScrollMaxX;
scrollMaxY = preScrollMaxY;
// NOTE: resizeRadar() may be required here, since we change scroll limits?
}
return NULL;
}
@ -1841,6 +1843,7 @@ STRUCTURE* buildStructure(STRUCTURE_STATS* pStructureType, UDWORD x, UDWORD y, U
scrollMinY = preScrollMinY;
scrollMaxX = preScrollMaxX;
scrollMaxY = preScrollMaxY;
// NOTE: resizeRadar() may be required here, since we change scroll limits?
}
psBuilding->body = (UWORD)structureBody(psBuilding);