new entity type "dummy"
Adds a new entity type for use in scripts. The entity does not affect rendering or physics and is not saved to map files.
This commit is contained in:
@@ -12,6 +12,7 @@ enum // static entity types
|
||||
SOUND, // attr1 = idx, attr2 = radius, attr3 = size, attr4 = volume
|
||||
CLIP, // attr1 = elevation, attr2 = xradius, attr3 = yradius, attr4 = height, attr6 = slope, attr7 = shape
|
||||
PLCLIP, // attr1 = elevation, attr2 = xradius, attr3 = yradius, attr4 = height, attr6 = slope, attr7 = shape
|
||||
DUMMYENT, // temporary entity without any function - will not be saved to map files, used to mark positions and for scripting
|
||||
MAXENTTYPES
|
||||
};
|
||||
|
||||
|
||||
+5
-3
@@ -448,7 +448,7 @@ const char *entnames[] =
|
||||
"none?",
|
||||
"light", "playerstart", "pistol", "ammobox","grenades",
|
||||
"health", "helmet", "armour", "akimbo",
|
||||
"mapmodel", "trigger", "ladder", "ctf-flag", "sound", "clip", "plclip", ""
|
||||
"mapmodel", "trigger", "ladder", "ctf-flag", "sound", "clip", "plclip", "dummy", ""
|
||||
};
|
||||
|
||||
// entity attribute scaling and wraparound definitions for mapformat 10
|
||||
@@ -470,7 +470,8 @@ short entwraparound[MAXENTTYPES][7] =
|
||||
{ -3600, 0, 0, 0, 0, 0, 0 }, // ctf-flag
|
||||
{ 256, 0, 0, 0, 0, 0, 0 }, // sound
|
||||
{ 0, 0, 0, 0, 0, 0, 4 }, // clip
|
||||
{ 0, 0, 0, 0, 0, 0, 4 } // plclip
|
||||
{ 0, 0, 0, 0, 0, 0, 4 }, // plclip
|
||||
{ 0, 0, 0, 0, 0, 0, 0 } // dummy
|
||||
};
|
||||
|
||||
uchar entscale[MAXENTTYPES][7] =
|
||||
@@ -491,7 +492,8 @@ uchar entscale[MAXENTTYPES][7] =
|
||||
{ 10, 1, 1, 1, 1, 1, 1 }, // ctf-flag
|
||||
{ 1, 1, 1, 1, 1, 1, 1 }, // sound
|
||||
{ 10, 5, 5, 5, 1, 10, 1 }, // clip
|
||||
{ 10, 5, 5, 5, 1, 10, 1 } // plclip
|
||||
{ 10, 5, 5, 5, 1, 10, 1 }, // plclip
|
||||
{ 1, 1, 1, 1, 1, 1, 1 } // dummy
|
||||
};
|
||||
|
||||
// see entity.h:61: struct itemstat { int add, start, max, sound; };
|
||||
|
||||
@@ -613,7 +613,7 @@ void save_world(char *mname, bool skipoptimise, bool addcomfort)
|
||||
hdr.numents = 0;
|
||||
ASSERT(MAXENTITIES < (1 << 16));
|
||||
numbered_persistent_entity npe;
|
||||
loopv(ents) if(ents[i].type != NOTUSED) // omit deleted entities
|
||||
loopv(ents) if(ents[i].type != NOTUSED && ents[i].type!=DUMMYENT) // omit deleted entities and dummies
|
||||
{
|
||||
hdr.numents++;
|
||||
npe.e = ents[i];
|
||||
@@ -701,7 +701,7 @@ void save_world9(char *mname)
|
||||
hdr.headersize = sizeof(header);
|
||||
hdr.timestamp = (int) time(NULL); // non-zero timestamps in format 9 can be used to identify "exported" maps
|
||||
hdr.numents = 0;
|
||||
loopv(ents) if(ents[i].type!=NOTUSED) hdr.numents++;
|
||||
loopv(ents) if(ents[i].type!=NOTUSED && ents[i].type!=DUMMYENT) hdr.numents++;
|
||||
if(hdr.numents > MAXENTITIES)
|
||||
{
|
||||
conoutf("too many map entities (%d), only %d will be written to file", hdr.numents, MAXENTITIES);
|
||||
@@ -718,7 +718,7 @@ void save_world9(char *mname)
|
||||
int ne = hdr.numents, ec = 0;
|
||||
loopv(ents)
|
||||
{
|
||||
if(ents[i].type!=NOTUSED)
|
||||
if(ents[i].type!=NOTUSED && ents[i].type!=DUMMYENT)
|
||||
{
|
||||
if(!ne--) break;
|
||||
persistent_entity tmp = ents[i];
|
||||
|
||||
Reference in New Issue
Block a user