mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2025-01-31 21:50:48 +00:00
Added static multitag read and storage on mapload.
This commit is contained in:
parent
4128f826b7
commit
a7e99ab5cf
7 changed files with 81 additions and 1 deletions
|
@ -164,6 +164,7 @@ set(SRB2_CORE_GAME_SOURCES
|
|||
p_telept.c
|
||||
p_tick.c
|
||||
p_user.c
|
||||
taglist.c
|
||||
|
||||
p_local.h
|
||||
p_maputl.h
|
||||
|
@ -175,6 +176,7 @@ set(SRB2_CORE_GAME_SOURCES
|
|||
p_slopes.h
|
||||
p_spec.h
|
||||
p_tick.h
|
||||
taglist.h
|
||||
)
|
||||
|
||||
if(NOT (CMAKE_CXX_COMPILER_ID MATCHES "Clang"))
|
||||
|
|
|
@ -474,6 +474,7 @@ OBJS:=$(i_main_o) \
|
|||
$(OBJDIR)/r_patch.o \
|
||||
$(OBJDIR)/r_portal.o \
|
||||
$(OBJDIR)/screen.o \
|
||||
$(OBJDIR)/taglist.o \
|
||||
$(OBJDIR)/v_video.o \
|
||||
$(OBJDIR)/s_sound.o \
|
||||
$(OBJDIR)/sounds.o \
|
||||
|
|
|
@ -23,6 +23,8 @@
|
|||
// Some global defines, that configure the game.
|
||||
#include "doomdef.h"
|
||||
|
||||
#include "taglist.h"
|
||||
|
||||
//
|
||||
// Map level types.
|
||||
// The following data structures define the persistent format
|
||||
|
@ -204,6 +206,7 @@ typedef struct
|
|||
INT16 z;
|
||||
UINT8 extrainfo;
|
||||
INT16 tag;
|
||||
taglist_t tags;
|
||||
struct mobj_s *mobj;
|
||||
} mapthing_t;
|
||||
|
||||
|
|
|
@ -81,6 +81,8 @@
|
|||
|
||||
#include "fastcmp.h" // textmap parsing
|
||||
|
||||
#include "taglist.h"
|
||||
|
||||
//
|
||||
// Map MD5, calculated on level load.
|
||||
// Sent to clients in PT_SERVERINFO.
|
||||
|
@ -935,6 +937,8 @@ static void P_LoadSectors(UINT8 *data)
|
|||
ss->lightlevel = SHORT(ms->lightlevel);
|
||||
ss->special = SHORT(ms->special);
|
||||
ss->tag = SHORT(ms->tag);
|
||||
if (ss->tag)
|
||||
Tag_Add(&ss->tags, ss->tag);
|
||||
|
||||
ss->floor_xoffs = ss->floor_yoffs = 0;
|
||||
ss->ceiling_xoffs = ss->ceiling_yoffs = 0;
|
||||
|
@ -1049,6 +1053,8 @@ static void P_LoadLinedefs(UINT8 *data)
|
|||
ld->flags = SHORT(mld->flags);
|
||||
ld->special = SHORT(mld->special);
|
||||
ld->tag = SHORT(mld->tag);
|
||||
if (ld->tag)
|
||||
Tag_Add(&ld->tags, ld->tag);
|
||||
memset(ld->args, 0, NUMLINEARGS*sizeof(*ld->args));
|
||||
memset(ld->stringargs, 0x00, NUMLINESTRINGARGS*sizeof(*ld->stringargs));
|
||||
ld->alpha = FRACUNIT;
|
||||
|
@ -1398,7 +1404,21 @@ static void ParseTextmapSectorParameter(UINT32 i, char *param, char *val)
|
|||
else if (fastcmp(param, "special"))
|
||||
sectors[i].special = atol(val);
|
||||
else if (fastcmp(param, "id"))
|
||||
{
|
||||
sectors[i].tag = atol(val);
|
||||
if (sectors[i].tag)
|
||||
Tag_Add(§ors[i].tags, sectors[i].tag);
|
||||
}
|
||||
else if (fastcmp(param, "moreids"))
|
||||
{
|
||||
char* id = val;
|
||||
while (id)
|
||||
{
|
||||
Tag_Add(§ors[i].tags, atol(id));
|
||||
if ((id = strchr(id, ' ')))
|
||||
id++;
|
||||
}
|
||||
}
|
||||
else if (fastcmp(param, "xpanningfloor"))
|
||||
sectors[i].floor_xoffs = FLOAT_TO_FIXED(atof(val));
|
||||
else if (fastcmp(param, "ypanningfloor"))
|
||||
|
@ -1434,7 +1454,21 @@ static void ParseTextmapSidedefParameter(UINT32 i, char *param, char *val)
|
|||
static void ParseTextmapLinedefParameter(UINT32 i, char *param, char *val)
|
||||
{
|
||||
if (fastcmp(param, "id"))
|
||||
{
|
||||
lines[i].tag = atol(val);
|
||||
if (lines[i].tag)
|
||||
Tag_Add(&lines[i].tags, lines[i].tag);
|
||||
}
|
||||
else if (fastcmp(param, "moreids"))
|
||||
{
|
||||
char* id = val;
|
||||
while (id)
|
||||
{
|
||||
Tag_Add(&lines[i].tags, atol(id));
|
||||
if ((id = strchr(id, ' ')))
|
||||
id++;
|
||||
}
|
||||
}
|
||||
else if (fastcmp(param, "special"))
|
||||
lines[i].special = atol(val);
|
||||
else if (fastcmp(param, "v1"))
|
||||
|
@ -1501,8 +1535,22 @@ static void ParseTextmapLinedefParameter(UINT32 i, char *param, char *val)
|
|||
static void ParseTextmapThingParameter(UINT32 i, char *param, char *val)
|
||||
{
|
||||
if (fastcmp(param, "id"))
|
||||
{
|
||||
mapthings[i].tag = atol(val);
|
||||
if (fastcmp(param, "x"))
|
||||
if (mapthings[i].tag)
|
||||
Tag_Add(&mapthings[i].tags, mapthings[i].tag);
|
||||
}
|
||||
else if (fastcmp(param, "moreids"))
|
||||
{
|
||||
char* id = val;
|
||||
while (id)
|
||||
{
|
||||
Tag_Add(&mapthings[i].tags, atol(id));
|
||||
if ((id = strchr(id, ' ')))
|
||||
id++;
|
||||
}
|
||||
}
|
||||
else if (fastcmp(param, "x"))
|
||||
mapthings[i].x = atol(val);
|
||||
else if (fastcmp(param, "y"))
|
||||
mapthings[i].y = atol(val);
|
||||
|
|
|
@ -30,6 +30,8 @@
|
|||
|
||||
#define POLYOBJECTS
|
||||
|
||||
#include "taglist.h"
|
||||
|
||||
//
|
||||
// ClipWallSegment
|
||||
// Clips the given range of columns
|
||||
|
@ -290,6 +292,7 @@ typedef struct sector_s
|
|||
INT16 lightlevel;
|
||||
INT16 special;
|
||||
UINT16 tag;
|
||||
taglist_t tags;
|
||||
INT32 nexttag, firsttag; // for fast tag searches
|
||||
|
||||
// origin for any sounds played by the sector
|
||||
|
@ -413,6 +416,7 @@ typedef struct line_s
|
|||
INT16 flags;
|
||||
INT16 special;
|
||||
INT16 tag;
|
||||
taglist_t tags;
|
||||
INT32 args[NUMLINEARGS];
|
||||
char *stringargs[NUMLINESTRINGARGS];
|
||||
|
||||
|
|
8
src/taglist.c
Normal file
8
src/taglist.c
Normal file
|
@ -0,0 +1,8 @@
|
|||
#include "taglist.h"
|
||||
#include "z_zone.h"
|
||||
|
||||
void Tag_Add (taglist_t* list, const UINT16 tag)
|
||||
{
|
||||
list->tags = Z_Realloc(list->tags, (list->count + 1) * sizeof(list->tags), PU_LEVEL, NULL);
|
||||
list->tags[list->count++] = tag;
|
||||
}
|
14
src/taglist.h
Normal file
14
src/taglist.h
Normal file
|
@ -0,0 +1,14 @@
|
|||
#include "doomtype.h"
|
||||
|
||||
#ifndef __R_TAGLIST__
|
||||
#define __R_TAGLIST__
|
||||
|
||||
/// Multitag list.
|
||||
typedef struct
|
||||
{
|
||||
UINT16* tags;
|
||||
UINT16 count;
|
||||
} taglist_t;
|
||||
|
||||
void Tag_Add (taglist_t* list, const UINT16 tag);
|
||||
#endif //__R_TAGLIST__
|
Loading…
Reference in a new issue