Make smostcnt an int32 to prevent overflow (and subsequent crash) with too many saved positions; In Mapster, make it possible to bunch-join an extended with a non-extended floor inner to the first one, so that inner sectors created out of loops can be deleted by joining the sectors then.

git-svn-id: https://svn.eduke32.com/eduke32@1932 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
helixhorned 2011-07-13 16:42:29 +00:00
parent a15d8bfb98
commit 24dcfc6633
4 changed files with 70 additions and 13 deletions

View file

@ -4953,7 +4953,7 @@ end_point_dragging:
yax_getbunches(joinsector[k], &jbn[k][YAX_CEILING], &jbn[k][YAX_FLOOR]); yax_getbunches(joinsector[k], &jbn[k][YAX_CEILING], &jbn[k][YAX_FLOOR]);
#endif #endif
// pressing J into the same sector is the same as saying 'no' // pressing J into the same sector is the same as saying 'no'
// v----------------v // v----------------v
if (s1to0wall == -1 && i != joinsector[0]) if (s1to0wall == -1 && i != joinsector[0])
{ {
#ifdef YAX_ENABLE #ifdef YAX_ENABLE
@ -5013,16 +5013,48 @@ end_point_dragging:
if ((uneqbn&2)==0) if ((uneqbn&2)==0)
{ {
if (whybad&1) if (whybad==1+8 && jbn[0][cf]>=0 && jbn[1][cf]<0)
message("Can't make floor bunchnums equal: both floors must be extended"); {
else if (whybad&2) // 1st join sector extended, 2nd not... let's see
message("Can't make floor bunchnums equal: both floors must be non-sloped"); // if the latter is inner to the former one
else if (whybad&4)
message("Can't make floor bunchnums equal: both floors must have equal height"); m = 1;
else if (whybad&8) for (WALLS_OF_SECTOR(joinsector[1], k))
message("Can't make floor bunchnums equal: INTERNAL ERROR"); if (wall[k].nextsector != joinsector[0])
else if (whybad&16) {
message("Can't make floor bunchnums equal: lower neighbors must be linked"); m = 0;
break;
}
if (m==1)
{
yax_setbunch(joinsector[1], YAX_FLOOR, jbn[0][cf]);
yax_update(0);
yax_updategrays(pos.z);
asksave = 1;
printmessage16("Added sector %d's floor to bunch %d",
joinsector[1], jbn[0][cf]);
}
else
{
printmessage16("Can't add sector %d's floor to bunch %d: not inner to sector %d",
joinsector[1], jbn[0][cf], joinsector[0]);
}
}
else
{
if (whybad&1)
message("Can't make floor bunchnums equal: both floors must be extended");
else if (whybad&2)
message("Can't make floor bunchnums equal: both floors must be non-sloped");
else if (whybad&4)
message("Can't make floor bunchnums equal: both floors must have equal height");
else if (whybad&8)
message("Can't make floor bunchnums equal: INTERNAL ERROR");
else if (whybad&16)
message("Can't make floor bunchnums equal: lower neighbors must be linked");
}
} }
else else
{ {

View file

@ -1999,7 +1999,8 @@ int16_t thewall[MAXWALLSB];
int16_t bunchfirst[MAXWALLSB], bunchlast[MAXWALLSB]; int16_t bunchfirst[MAXWALLSB], bunchlast[MAXWALLSB];
static int16_t smost[MAXYSAVES], smostcnt; static int32_t smostcnt;
static int16_t smost[MAXYSAVES];
static int16_t smoststart[MAXWALLSB]; static int16_t smoststart[MAXWALLSB];
static char smostwalltype[MAXWALLSB]; static char smostwalltype[MAXWALLSB];
static int32_t smostwall[MAXWALLSB], smostwallcnt = -1L; static int32_t smostwall[MAXWALLSB], smostwallcnt = -1L;

View file

@ -4,6 +4,7 @@
#define MAXCLIPNUM 1024 #define MAXCLIPNUM 1024
#define MAXPERMS 512 #define MAXPERMS 512
#define MAXTILEFILES 256 #define MAXTILEFILES 256
// MAXYSAVES is 983040 (!) right now:
#define MAXYSAVES ((MAXXDIM*MAXSPRITES)>>7) #define MAXYSAVES ((MAXXDIM*MAXSPRITES)>>7)
#define MAXNODESPERLINE 42 //Warning: This depends on MAXYSAVES & MAXYDIM! #define MAXNODESPERLINE 42 //Warning: This depends on MAXYSAVES & MAXYDIM!
#define MAXCLIPDIST 1024 #define MAXCLIPDIST 1024

View file

@ -40,7 +40,30 @@ Modifications for JonoF's port by Jonathon Fowler (jonof@edgenetwk.com)
need to be in the header because there are no exposed functions need to be in the header because there are no exposed functions
that use any of this directly */ that use any of this directly */
typedef struct lpfileheaderstruct { uint32_t id; /* 4 uint8_tacter ID == "LPF " */ uint16_t maxLps; /* max # largePages allowed. 256 FOR NOW. */ uint16_t nLps; /* # largePages in this file. */ uint32_t nRecords; /* # records in this file. 65534 is current limit + ring */ uint16_t maxRecsPerLp; /* # records permitted in an lp. 256 FOR NOW. */ uint16_t lpfTableOffset; /* Absolute Seek position of lpfTable. 1280 FOR NOW. */ uint32_t contentType; /* 4 character ID == "ANIM" */ uint16_t width; /* Width of screen in pixels. */ uint16_t height; /* Height of screen in pixels. */ uint8_t variant; /* 0==ANIM. */ uint8_t version; /* 0==frame rate in 18/sec, 1= 70/sec */ uint8_t hasLastDelta; /* 1==Last record is a delta from last-to-first frame. */ uint8_t lastDeltaValid; /* 0==Ignore ring frame. */ uint8_t pixelType; /* 0==256 color. */ uint8_t CompressionType; /* 1==(RunSkipDump) Only one used FOR NOW. */ uint8_t otherRecsPerFrm; /* 0 FOR NOW. */ uint8_t bitmaptype; /* 1==320x200, 256-color. Only one implemented so far. */ uint8_t recordTypes[32]; /* Not yet implemented. */ uint32_t nFrames; /* Number of actual frames in the file, includes ring frame. */ uint16_t framesPerSecond; /* Number of frames to play per second. */ uint16_t pad2[29]; /* 58 bytes of filler to round up to 128 bytes total. */ } typedef struct lpfileheaderstruct
{
uint32_t id; /* 4 uint8_tacter ID == "LPF " */
uint16_t maxLps; /* max # largePages allowed. 256 FOR NOW. */
uint16_t nLps; /* # largePages in this file. */
uint32_t nRecords; /* # records in this file. 65534 is current limit + ring */
uint16_t maxRecsPerLp; /* # records permitted in an lp. 256 FOR NOW. */
uint16_t lpfTableOffset; /* Absolute Seek position of lpfTable. 1280 FOR NOW. */
uint32_t contentType; /* 4 character ID == "ANIM" */
uint16_t width; /* Width of screen in pixels. */
uint16_t height; /* Height of screen in pixels. */
uint8_t variant; /* 0==ANIM. */
uint8_t version; /* 0==frame rate in 18/sec, 1= 70/sec */
uint8_t hasLastDelta; /* 1==Last record is a delta from last-to-first frame. */
uint8_t lastDeltaValid; /* 0==Ignore ring frame. */
uint8_t pixelType; /* 0==256 color. */
uint8_t CompressionType; /* 1==(RunSkipDump) Only one used FOR NOW. */
uint8_t otherRecsPerFrm; /* 0 FOR NOW. */
uint8_t bitmaptype; /* 1==320x200, 256-color. Only one implemented so far. */
uint8_t recordTypes[32]; /* Not yet implemented. */
uint32_t nFrames; /* Number of actual frames in the file, includes ring frame. */
uint16_t framesPerSecond; /* Number of frames to play per second. */
uint16_t pad2[29]; /* 58 bytes of filler to round up to 128 bytes total. */
}
lpfileheader; /* (comments from original source) */ lpfileheader; /* (comments from original source) */
// this is the format of a large page structure // this is the format of a large page structure