mirror of
https://github.com/ZDoom/Raze.git
synced 2025-02-20 18:42:26 +00:00
Mapster32 cleanup. The biggest visible change should be the more robust editing near the limits (still not perfect though).
git-svn-id: https://svn.eduke32.com/eduke32@1801 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
563bac46ab
commit
48d15c23c6
6 changed files with 1132 additions and 1086 deletions
|
@ -29,6 +29,9 @@ extern "C" {
|
|||
#define MAXWALLSB ((MAXWALLS>>2)+(MAXWALLS>>3))
|
||||
#define MAXSPRITES MAXSPRITESV8
|
||||
|
||||
// additional space beyond wall, in walltypes:
|
||||
#define M32_FIXME_WALLS 1024
|
||||
|
||||
#define MAXTILES 15360
|
||||
#define MAXVOXELS 4096
|
||||
#define MAXSTATUS 1024
|
||||
|
@ -465,7 +468,7 @@ void setview(int32_t x1, int32_t y1, int32_t x2, int32_t y2);
|
|||
void setaspect(int32_t daxrange, int32_t daaspect);
|
||||
void flushperms(void);
|
||||
|
||||
void plotlines2d(int32_t *xx, int32_t *yy, int32_t numpoints, char col) ATTRIBUTE((nonnull(1,2)));
|
||||
void plotlines2d(const int32_t *xx, const int32_t *yy, int32_t numpoints, char col) ATTRIBUTE((nonnull(1,2)));
|
||||
|
||||
void plotpixel(int32_t x, int32_t y, char col);
|
||||
char getpixel(int32_t x, int32_t y);
|
||||
|
|
|
@ -40,7 +40,9 @@ extern int32_t qsetmode;
|
|||
extern int16_t searchsector, searchwall, searchstat;
|
||||
extern int16_t searchbottomwall;
|
||||
extern int32_t zmode, kensplayerheight;
|
||||
extern int16_t defaultspritecstat;
|
||||
|
||||
#define DEFAULT_SPRITE_CSTAT 0
|
||||
//extern int16_t defaultspritecstat;
|
||||
|
||||
extern int32_t temppicnum, tempcstat, templotag, temphitag, tempextra;
|
||||
extern uint32_t temppal, tempvis, tempxrepeat, tempyrepeat;
|
||||
|
@ -149,11 +151,15 @@ extern int32_t lastpm16time;
|
|||
|
||||
extern char lastpm16buf[156];
|
||||
|
||||
void DoSpriteOrnament(int32_t i);
|
||||
|
||||
void getpoint(int32_t searchxe, int32_t searchye, int32_t *x, int32_t *y);
|
||||
int32_t getpointhighlight(int32_t xplc, int32_t yplc, int32_t point);
|
||||
void update_highlight();
|
||||
void update_highlightsector();
|
||||
|
||||
extern uint8_t hlsectorbitmap[MAXSECTORS>>3];
|
||||
|
||||
#ifdef _WIN32
|
||||
#define DEFAULT_GAME_EXEC "eduke32.exe"
|
||||
#define DEFAULT_GAME_LOCAL_EXEC "eduke32.exe"
|
||||
|
@ -222,4 +228,8 @@ extern int32_t scripthistend;
|
|||
Itervar < endwall; \
|
||||
Itervar++
|
||||
|
||||
#define BTAG_MAX 65535
|
||||
#define BZ_MAX 8388608
|
||||
|
||||
|
||||
#endif
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -6197,8 +6197,9 @@ int32_t preinitengine(void)
|
|||
|
||||
if (editstatus)
|
||||
{
|
||||
dynarray[1].size += 1024*sizeof(walltype);
|
||||
Bprintf("FIXME: Allocating additional space beyong wall[] for editor bugs.\n");
|
||||
dynarray[0].size += 2*sizeof(sectortype); // join sectors needs a temp. sector
|
||||
dynarray[1].size += M32_FIXME_WALLS*sizeof(walltype);
|
||||
Bprintf("FIXME: Allocating additional space beyond wall[] for editor bugs.\n");
|
||||
}
|
||||
|
||||
for (i=0; i<(signed)(sizeof(dynarray)/sizeof(dynarray[0])); i++)
|
||||
|
@ -9628,6 +9629,7 @@ int32_t neartag(int32_t xs, int32_t ys, int32_t zs, int16_t sectnum, int16_t ang
|
|||
void dragpoint(int16_t pointhighlight, int32_t dax, int32_t day)
|
||||
{
|
||||
int16_t cnt, tempshort;
|
||||
int32_t thelastwall;
|
||||
|
||||
wall[pointhighlight].x = dax;
|
||||
wall[pointhighlight].y = day;
|
||||
|
@ -9652,9 +9654,10 @@ void dragpoint(int16_t pointhighlight, int32_t dax, int32_t day)
|
|||
tempshort = pointhighlight; //search points CW if not searched all the way around
|
||||
do
|
||||
{
|
||||
if (wall[lastwall(tempshort)].nextwall >= 0)
|
||||
thelastwall = lastwall(tempshort);
|
||||
if (wall[thelastwall].nextwall >= 0)
|
||||
{
|
||||
tempshort = wall[lastwall(tempshort)].nextwall;
|
||||
tempshort = wall[thelastwall].nextwall;
|
||||
wall[tempshort].x = dax;
|
||||
wall[tempshort].y = day;
|
||||
wall[tempshort].cstat |= (1<<14);
|
||||
|
@ -11369,7 +11372,7 @@ void plotpixel(int32_t x, int32_t y, char col)
|
|||
enddrawing(); //}}}
|
||||
}
|
||||
|
||||
void plotlines2d(int32_t *xx, int32_t *yy, int32_t numpoints, char col)
|
||||
void plotlines2d(const int32_t *xx, const int32_t *yy, int32_t numpoints, char col)
|
||||
{
|
||||
int32_t i;
|
||||
|
||||
|
@ -11393,8 +11396,10 @@ void plotlines2d(int32_t *xx, int32_t *yy, int32_t numpoints, char col)
|
|||
int32_t odrawlinepat = drawlinepat;
|
||||
drawlinepat = 0xffffffff;
|
||||
|
||||
begindrawing();
|
||||
for (i=0; i<numpoints-1; i++)
|
||||
drawline16(xx[i], yy[i], xx[i+1], yy[i+1], col);
|
||||
enddrawing();
|
||||
|
||||
drawlinepat = odrawlinepat;
|
||||
}
|
||||
|
|
|
@ -167,9 +167,6 @@ static const char *Typestr_wss[] = { "Wall", "Sector", "Sector", "Sprite", "Wall
|
|||
#define AIMED_SELOVR_PICNUM SFBASE_CF(picnum, &AIMED_SELOVR_WALL(picnum))
|
||||
|
||||
|
||||
#define BTAG_MAX 65535
|
||||
#define BZ_MAX 8388608
|
||||
|
||||
static const char *ONOFF_[] = {"OFF","ON"};
|
||||
#define ONOFF(b) (ONOFF_[!!(b)])
|
||||
|
||||
|
@ -268,6 +265,8 @@ mapundo_t *mapstate = NULL;
|
|||
|
||||
int32_t map_revision = 1;
|
||||
|
||||
#define QADDNSZ 400
|
||||
|
||||
void create_map_snapshot(void)
|
||||
{
|
||||
int32_t j;
|
||||
|
@ -288,29 +287,30 @@ void create_map_snapshot(void)
|
|||
{
|
||||
if (mapstate->next != NULL)
|
||||
{
|
||||
mapundo_t *next = mapstate->next;
|
||||
next->prev = NULL;
|
||||
mapundo_t *cur = mapstate->next;
|
||||
cur->prev = NULL;
|
||||
|
||||
while (next->next)
|
||||
next = next->next;
|
||||
while (cur->next)
|
||||
cur = cur->next;
|
||||
|
||||
do
|
||||
{
|
||||
if (next->sectors && (next->prev == NULL || (next->sectcrc != next->prev->sectcrc)))
|
||||
Bfree(next->sectors);
|
||||
if (next->walls && (next->prev == NULL || (next->wallcrc != next->prev->wallcrc)))
|
||||
Bfree(next->walls);
|
||||
if (next->sprites && (next->prev == NULL || (next->spritecrc != next->prev->spritecrc)))
|
||||
Bfree(next->sprites);
|
||||
if (!next->prev)
|
||||
if (cur->sectors && (cur->prev == NULL || (cur->sectcrc != cur->prev->sectcrc)))
|
||||
Bfree(cur->sectors);
|
||||
if (cur->walls && (cur->prev == NULL || (cur->wallcrc != cur->prev->wallcrc)))
|
||||
Bfree(cur->walls);
|
||||
if (cur->sprites && (cur->prev == NULL || (cur->spritecrc != cur->prev->spritecrc)))
|
||||
Bfree(cur->sprites);
|
||||
if (!cur->prev)
|
||||
{
|
||||
Bfree(next);
|
||||
Bfree(cur);
|
||||
break;
|
||||
}
|
||||
next = next->prev;
|
||||
Bfree(next->next);
|
||||
|
||||
cur = cur->prev;
|
||||
Bfree(cur->next);
|
||||
}
|
||||
while (next);
|
||||
while (cur);
|
||||
}
|
||||
|
||||
mapstate->next = (mapundo_t *)Bcalloc(1, sizeof(mapundo_t));
|
||||
|
@ -321,13 +321,7 @@ void create_map_snapshot(void)
|
|||
}
|
||||
|
||||
fixspritesectors();
|
||||
|
||||
numsprites = 0;
|
||||
for (j=MAXSPRITES-1; j>=0; j--)
|
||||
{
|
||||
if (sprite[j].statnum != MAXSTATUS)
|
||||
numsprites++;
|
||||
}
|
||||
updatenumsprites();
|
||||
|
||||
mapstate->numsectors = numsectors;
|
||||
mapstate->numwalls = numwalls;
|
||||
|
@ -347,7 +341,7 @@ void create_map_snapshot(void)
|
|||
}
|
||||
else
|
||||
{
|
||||
mapstate->sectors = (sectortype *)Bcalloc(1, sizeof(sectortype) * numsectors);
|
||||
mapstate->sectors = (sectortype *)Bcalloc(1, sizeof(sectortype) * numsectors + QADDNSZ);
|
||||
mapstate->sectsiz = j = qlz_compress(§or[0], (char *)&mapstate->sectors[0],
|
||||
sizeof(sectortype) * numsectors, state_compress);
|
||||
mapstate->sectors = (sectortype *)Brealloc(mapstate->sectors, j);
|
||||
|
@ -368,7 +362,7 @@ void create_map_snapshot(void)
|
|||
}
|
||||
else
|
||||
{
|
||||
mapstate->walls = (walltype *)Bcalloc(1, sizeof(walltype) * numwalls);
|
||||
mapstate->walls = (walltype *)Bcalloc(1, sizeof(walltype) * numwalls + QADDNSZ);
|
||||
mapstate->wallsiz = j = qlz_compress(&wall[0], (char *)&mapstate->walls[0],
|
||||
sizeof(walltype) * numwalls, state_compress);
|
||||
mapstate->walls = (walltype *)Brealloc(mapstate->walls, j);
|
||||
|
@ -403,7 +397,7 @@ void create_map_snapshot(void)
|
|||
}
|
||||
}
|
||||
mapstate->spritesiz = j = qlz_compress(&tspri[0], (char *)&mapstate->sprites[0],
|
||||
sizeof(spritetype) * numsprites, state_compress);
|
||||
sizeof(spritetype) * numsprites + QADDNSZ, state_compress);
|
||||
mapstate->sprites = (spritetype *)Brealloc(mapstate->sprites, j);
|
||||
mapstate->spritecrc = tempcrc;
|
||||
Bfree(tspri);
|
||||
|
@ -471,6 +465,7 @@ int32_t map_undoredo(int32_t dir)
|
|||
Bmemset(show2dsector, 0, sizeof(show2dsector));
|
||||
Bmemset(show2dsprite, 0, sizeof(show2dsprite));
|
||||
Bmemset(show2dwall, 0, sizeof(show2dwall));
|
||||
Bmemset(hlsectorbitmap, 0, sizeof(hlsectorbitmap));
|
||||
|
||||
if (mapstate->numsectors)
|
||||
{
|
||||
|
@ -495,6 +490,9 @@ int32_t map_undoredo(int32_t dir)
|
|||
if (qsetmode == 200 && rendmode == 4)
|
||||
polymer_loadboard();
|
||||
#endif
|
||||
|
||||
CheckMapCorruption(4, 0);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -3624,13 +3622,13 @@ static int32_t DrawTiles(int32_t iTopLeft, int32_t iSelected, int32_t nXTiles, i
|
|||
y1=max(y1, 0);
|
||||
y2=min(y2, ydim-1);
|
||||
|
||||
// box
|
||||
|
||||
{
|
||||
// box
|
||||
int32_t xx[] = {x1, x1, x2, x2, x1};
|
||||
int32_t yy[] = {y1, y2, y2, y1, y1};
|
||||
plotlines2d(xx, yy, 5, iTile==iSelected ? whitecol : markedcol);
|
||||
}
|
||||
|
||||
// cross
|
||||
if (marked)
|
||||
{
|
||||
|
@ -3918,37 +3916,6 @@ static void getnumberptr256(const char *namestart, void *num, int32_t bytes, int
|
|||
}
|
||||
}
|
||||
|
||||
static void DoSpriteOrnament(int32_t i)
|
||||
{
|
||||
int32_t j, hitw;
|
||||
hitdata_t hitinfo;
|
||||
|
||||
hitscan((const vec3_t *)&sprite[i],sprite[i].sectnum,
|
||||
sintable[(sprite[i].ang+1536)&2047],
|
||||
sintable[(sprite[i].ang+1024)&2047],
|
||||
0,
|
||||
&hitinfo,CLIPMASK1);
|
||||
|
||||
sprite[i].x = hitinfo.pos.x;
|
||||
sprite[i].y = hitinfo.pos.y;
|
||||
sprite[i].z = hitinfo.pos.z;
|
||||
changespritesect(i,hitinfo.hitsect);
|
||||
|
||||
hitw = hitinfo.hitwall;
|
||||
|
||||
if (hitw >= 0)
|
||||
sprite[i].ang = (getangle(POINT2(hitw).x-wall[hitw].x,
|
||||
POINT2(hitw).y-wall[hitw].y)+512)&2047;
|
||||
|
||||
//Make sure sprite's in right sector
|
||||
if (inside(sprite[i].x,sprite[i].y,sprite[i].sectnum) == 0)
|
||||
{
|
||||
j = wall[hitw].point2;
|
||||
sprite[i].x -= ksgn(wall[j].y-wall[hitw].y);
|
||||
sprite[i].y += ksgn(wall[j].x-wall[hitw].x);
|
||||
}
|
||||
}
|
||||
|
||||
#if 0
|
||||
int64_t ldistsqr(spritetype *s1,spritetype *s2)
|
||||
{
|
||||
|
@ -9223,7 +9190,7 @@ int32_t ExtInit(void)
|
|||
kensplayerheight = 40; //32
|
||||
zmode = 2;
|
||||
zlock = kensplayerheight<<8;
|
||||
defaultspritecstat = 0;
|
||||
// defaultspritecstat = 0;
|
||||
|
||||
ReadGamePalette();
|
||||
// InitWater();
|
||||
|
|
|
@ -29,7 +29,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
const char *defsfilename = "duke3d.def";
|
||||
|
||||
extern char keystatus[];
|
||||
extern int16_t defaultspritecstat;
|
||||
extern int32_t horiz, qsetmode;
|
||||
extern vec3_t pos;
|
||||
extern int16_t ang, cursectnum;
|
||||
|
|
Loading…
Reference in a new issue