Merge branch 'mapload-refactor' into 'next'

Refactor map loading functions

See merge request STJr/SRB2!594
This commit is contained in:
MascaraSnake 2019-12-29 10:04:27 -05:00
commit bf25128986
6 changed files with 710 additions and 759 deletions

View file

@ -2965,7 +2965,7 @@ void G_DoReborn(INT32 playernum)
}
if (!countdowntimeup && (mapheaderinfo[gamemap-1]->levelflags & LF_NORELOAD))
{
P_LoadThingsOnly();
P_RespawnThings();
for (i = 0; i < MAXPLAYERS; i++)
{

View file

@ -134,6 +134,7 @@ enum side_e {
side_toptexture,
side_bottomtexture,
side_midtexture,
side_line,
side_sector,
side_special,
side_repeatcnt,
@ -869,6 +870,9 @@ static int side_get(lua_State *L)
case side_midtexture:
lua_pushinteger(L, side->midtexture);
return 1;
case side_line:
LUA_PushUserdata(L, side->line, META_LINE);
return 1;
case side_sector:
LUA_PushUserdata(L, side->sector, META_SECTOR);
return 1;
@ -902,6 +906,7 @@ static int side_set(lua_State *L)
switch(field)
{
case side_valid: // valid
case side_line:
case side_sector:
case side_special:
case side_text:

File diff suppressed because it is too large Load diff

View file

@ -96,7 +96,7 @@ void P_SetupLevelSky(INT32 skynum, boolean global);
#ifdef SCANTHINGS
void P_ScanThings(INT16 mapnum, INT16 wadnum, INT16 lumpnum);
#endif
void P_LoadThingsOnly(void);
void P_RespawnThings(void);
boolean P_LoadLevel(boolean fromnetsave);
boolean P_AddWadFile(const char *wadfilename);
boolean P_RunSOC(const char *socfilename);

View file

@ -6433,7 +6433,6 @@ void P_SpawnSpecials(boolean fromnetsave)
INT32 j;
thinkerlist_t *secthinkers;
thinker_t *th;
virtres_t* virt = NULL;
// This used to be used, and *should* be used in the future,
// but currently isn't.
(void)fromnetsave;
@ -7179,38 +7178,14 @@ void P_SpawnSpecials(boolean fromnetsave)
EV_AddLaserThinker(&sectors[s], &sectors[sec], lines + i, secthinkers);
break;
case 259: // Make-Your-Own FOF!
case 259: // Custom FOF
if (lines[i].sidenum[1] != 0xffff)
{
UINT8 *data;
UINT16 b;
if (!virt)
virt = vres_GetMap(lastloadedmaplumpnum);
data = (UINT8*) vres_Find(virt, "SIDEDEFS")->data;
for (b = 0; b < (INT16)numsides; b++)
{
register mapsidedef_t *msd = (mapsidedef_t *)data + b;
if (b == lines[i].sidenum[1])
{
if ((msd->toptexture[0] >= '0' && msd->toptexture[0] <= '9')
|| (msd->toptexture[0] >= 'A' && msd->toptexture[0] <= 'F'))
{
ffloortype_e FOF_Flags = axtoi(msd->toptexture);
P_AddFakeFloorsByLine(i, FOF_Flags, secthinkers);
break;
}
else
I_Error("Make-Your-Own-FOF (tag %d) needs a value in the linedef's second side upper texture field.", lines[i].tag);
}
}
ffloortype_e fofflags = sides[lines[i].sidenum[1]].toptexture;
P_AddFakeFloorsByLine(i, fofflags, secthinkers);
}
else
I_Error("Make-Your-Own FOF (tag %d) found without a 2nd linedef side!", lines[i].tag);
I_Error("Custom FOF (tag %d) found without a linedef back side!", lines[i].tag);
break;
case 300: // Linedef executor (combines with sector special 974/975) and commands
@ -7433,9 +7408,6 @@ void P_SpawnSpecials(boolean fromnetsave)
}
}
if (virt)
vres_Free(virt);
// Allocate each list
for (i = 0; i < numsectors; i++)
if(secthinkers[i].thinkers)

View file

@ -436,14 +436,10 @@ typedef struct line_s
polyobj_t *polyobj; // Belongs to a polyobject?
#endif
char *text; // a concatination of all front and back texture names, for linedef specials that require a string.
char *text; // a concatenation of all front and back texture names, for linedef specials that require a string.
INT16 callcount; // no. of calls left before triggering, for the "X calls" linedef specials, defaults to 0
} line_t;
//
// The SideDef.
//
typedef struct
{
// add this to the calculated texture column
@ -456,13 +452,16 @@ typedef struct
// We do not maintain names here.
INT32 toptexture, bottomtexture, midtexture;
// Sector the SideDef is facing.
// Linedef the sidedef belongs to
line_t *line;
// Sector the sidedef is facing.
sector_t *sector;
INT16 special; // the special of the linedef this side belongs to
INT16 repeatcnt; // # of times to repeat midtexture
char *text; // a concatination of all top, bottom, and mid texture names, for linedef specials that require a string.
char *text; // a concatenation of all top, bottom, and mid texture names, for linedef specials that require a string.
extracolormap_t *colormap_data; // storage for colormaps; not applied to sectors.
} side_t;