-Add linedef pointer to side_t, so sidedefs are able to tell if they're a front or back sidedef during setup
-Fix a broken condition during setup of texture fields for the change music linedef
This commit is contained in:
parent
bd7765227e
commit
cfadbb0f36
|
@ -134,6 +134,7 @@ enum side_e {
|
||||||
side_toptexture,
|
side_toptexture,
|
||||||
side_bottomtexture,
|
side_bottomtexture,
|
||||||
side_midtexture,
|
side_midtexture,
|
||||||
|
side_line,
|
||||||
side_sector,
|
side_sector,
|
||||||
side_special,
|
side_special,
|
||||||
side_repeatcnt,
|
side_repeatcnt,
|
||||||
|
@ -869,6 +870,9 @@ static int side_get(lua_State *L)
|
||||||
case side_midtexture:
|
case side_midtexture:
|
||||||
lua_pushinteger(L, side->midtexture);
|
lua_pushinteger(L, side->midtexture);
|
||||||
return 1;
|
return 1;
|
||||||
|
case side_line:
|
||||||
|
LUA_PushUserdata(L, side->line, META_LINE);
|
||||||
|
return 1;
|
||||||
case side_sector:
|
case side_sector:
|
||||||
LUA_PushUserdata(L, side->sector, META_SECTOR);
|
LUA_PushUserdata(L, side->sector, META_SECTOR);
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -902,6 +906,7 @@ static int side_set(lua_State *L)
|
||||||
switch(field)
|
switch(field)
|
||||||
{
|
{
|
||||||
case side_valid: // valid
|
case side_valid: // valid
|
||||||
|
case side_line:
|
||||||
case side_sector:
|
case side_sector:
|
||||||
case side_special:
|
case side_special:
|
||||||
case side_text:
|
case side_text:
|
||||||
|
|
|
@ -1008,10 +1008,18 @@ static void P_InitializeLinedef(line_t *ld)
|
||||||
CONS_Debug(DBG_SETUP, "P_InitializeLinedef: Linedef %s has two-sided flag set, but no second sidedef\n", sizeu1((size_t)(ld - lines)));
|
CONS_Debug(DBG_SETUP, "P_InitializeLinedef: Linedef %s has two-sided flag set, but no second sidedef\n", sizeu1((size_t)(ld - lines)));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ld->sidenum[0] != 0xffff && ld->special)
|
if (ld->sidenum[0] != 0xffff)
|
||||||
|
{
|
||||||
sides[ld->sidenum[0]].special = ld->special;
|
sides[ld->sidenum[0]].special = ld->special;
|
||||||
if (ld->sidenum[1] != 0xffff && ld->special)
|
sides[ld->sidenum[0]].line = ld;
|
||||||
|
|
||||||
|
}
|
||||||
|
if (ld->sidenum[1] != 0xffff)
|
||||||
|
{
|
||||||
sides[ld->sidenum[1]].special = ld->special;
|
sides[ld->sidenum[1]].special = ld->special;
|
||||||
|
sides[ld->sidenum[1]].line = ld;
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void P_LoadLinedefs(UINT8 *data)
|
static void P_LoadLinedefs(UINT8 *data)
|
||||||
|
@ -1044,6 +1052,7 @@ static void P_LoadSidedefs(UINT8 *data)
|
||||||
for (i = 0; i < numsides; i++, sd++, msd++)
|
for (i = 0; i < numsides; i++, sd++, msd++)
|
||||||
{
|
{
|
||||||
UINT16 sector_num;
|
UINT16 sector_num;
|
||||||
|
boolean isfrontside = !sd->line || sd->line->sidenum[0] == i;
|
||||||
|
|
||||||
sd->textureoffset = SHORT(msd->textureoffset)<<FRACBITS;
|
sd->textureoffset = SHORT(msd->textureoffset)<<FRACBITS;
|
||||||
sd->rowoffset = SHORT(msd->rowoffset)<<FRACBITS;
|
sd->rowoffset = SHORT(msd->rowoffset)<<FRACBITS;
|
||||||
|
@ -1092,9 +1101,8 @@ static void P_LoadSidedefs(UINT8 *data)
|
||||||
sd->midtexture = get_number(process);
|
sd->midtexture = get_number(process);
|
||||||
}
|
}
|
||||||
|
|
||||||
// always process if back sidedef, because we need that - symbol
|
|
||||||
sd->text = Z_Malloc(7, PU_LEVEL, NULL);
|
sd->text = Z_Malloc(7, PU_LEVEL, NULL);
|
||||||
if (i == 1 || msd->toptexture[0] != '-' || msd->toptexture[1] != '\0')
|
if (isfrontside && !(msd->toptexture[0] == '-' && msd->toptexture[1] == '\0'))
|
||||||
{
|
{
|
||||||
M_Memcpy(process,msd->toptexture,8);
|
M_Memcpy(process,msd->toptexture,8);
|
||||||
process[8] = '\0';
|
process[8] = '\0';
|
||||||
|
|
13
src/r_defs.h
13
src/r_defs.h
|
@ -436,14 +436,10 @@ typedef struct line_s
|
||||||
polyobj_t *polyobj; // Belongs to a polyobject?
|
polyobj_t *polyobj; // Belongs to a polyobject?
|
||||||
#endif
|
#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
|
INT16 callcount; // no. of calls left before triggering, for the "X calls" linedef specials, defaults to 0
|
||||||
} line_t;
|
} line_t;
|
||||||
|
|
||||||
//
|
|
||||||
// The SideDef.
|
|
||||||
//
|
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
// add this to the calculated texture column
|
// add this to the calculated texture column
|
||||||
|
@ -456,13 +452,16 @@ typedef struct
|
||||||
// We do not maintain names here.
|
// We do not maintain names here.
|
||||||
INT32 toptexture, bottomtexture, midtexture;
|
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;
|
sector_t *sector;
|
||||||
|
|
||||||
INT16 special; // the special of the linedef this side belongs to
|
INT16 special; // the special of the linedef this side belongs to
|
||||||
INT16 repeatcnt; // # of times to repeat midtexture
|
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.
|
extracolormap_t *colormap_data; // storage for colormaps; not applied to sectors.
|
||||||
} side_t;
|
} side_t;
|
||||||
|
|
Loading…
Reference in a new issue