add batch map conversion stage to find some unnecessary heightfields

In old versions of AC it was necessary to trick with heightfields to raise
a pickup entity. However, for quite some time now, pickups can be raised
by attribute.

This additional stage for convmap finds pickup entities where the
heightfield is most probably unnecessary. Fixing is manual work, though.

Updated those pickups on 16 maps.

Also fixed a playerstart on desert3
This commit is contained in:
ac-stef
2017-05-06 00:52:31 +02:00
parent b650fca2ca
commit 5eec79d792
19 changed files with 27 additions and 5 deletions
+23 -1
View File
@@ -24,7 +24,7 @@ if $execnumargs [
looplist "convmaplist m t" i [ tempalias $i ]
looplisti [ CMASTAGE CMAFIRSTERROR CMALASTERROR CMACOMMENT CMANUM ] n [ tempalias $n $i ]
tempalias cmstagenames [ NOP MAPCONFIG TRANSCLIP CLEANSLOTS FIXUNASSIGNEDS FIXBADENTS MANUALERRORS MANUALEDITING ]
tempalias cmstagenames [ NOP MAPCONFIG TRANSCLIP CLEANSLOTS FIXUNASSIGNEDS FIXBADENTS MANUALERRORS MANUALEDITING FIXPICKUPFHF ]
if (checkalias uncliptagclippedmodels) [ cmstagenames = (concat $cmstagenames REDUCECLIPS) ]
tempalias NUMSTAGES (listlen $cmstagenames)
looplisti $cmstagenames n [ tempalias $n $i ]
@@ -419,6 +419,28 @@ if (! (checkalias cmcur)) [ // execute this only once
duplicateclippedslots_cleanup
]
const cm_dostage_FIXPICKUPFHF [ // pause on maps with entities with pickups elevated by unnecessary heightfields
looplist [pistol ammobox grenades health helmet armour akimbo] ent [
looplist (enumentities $ent) i [
push entinfo (editentity $i)
select (at $entinfo 1) (at $entinfo 2) 2 2
push v 0
selectionwalk [
if (|| $sw_rel_x $sw_rel_y) [
if (|| (= $sw_type 2) (!= $sw_vdelta $v)) [ v = 0 ] // if FHF around or different vdelta: not just an elevated model
][
if (= $sw_type 2) [ v = $sw_vdelta ] // FHF below pickup
]
]
if (&& $v (! (&b $v 3))) [ // only mark elevations by whole cube sizes
addtodoentity $i "pickup entity elevated old-style, use attr1 instead"
abort = 1
]
pop v entinfo
]
]
]
const cmfixmapmodelpaths [
push cnt 0
push ispre12 0
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+1 -1
View File
@@ -387,7 +387,7 @@ void newentity(int index, int x, int y, int z, const char *what, float v1f, floa
case LIGHT: calclight(); break;
case SOUND: audiomgr.preloadmapsound(e); break;
}
unsavededits++;
if(index >= 0 || type != DUMMYENT) unsavededits++; // no need to save dummies
}
void entset(char *what, float *a1, float *a2, float *a3, float *a4)
+3 -3
View File
@@ -624,7 +624,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 && ents[i].type!=DUMMYENT) // omit deleted entities and dummies
loopv(ents) if(ents[i].type != NOTUSED && ents[i].type != DUMMYENT) // omit deleted entities and dummies
{
hdr.numents++;
npe.e = ents[i];
@@ -728,7 +728,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 && ents[i].type!=DUMMYENT) 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);
@@ -745,7 +745,7 @@ void save_world9(char *mname)
int ne = hdr.numents, ec = 0;
loopv(ents)
{
if(ents[i].type!=NOTUSED && ents[i].type!=DUMMYENT)
if(ents[i].type != NOTUSED && ents[i].type != DUMMYENT)
{
if(!ne--) break;
persistent_entity tmp = ents[i];