entproperty now works in MP coop, but buffered
git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@6359 e016b1c5-ed68-44aa-a2f7-31cac88cffde
This commit is contained in:
@@ -568,6 +568,7 @@ void updateworld(int curtime, int lastmillis) // main game update loop
|
||||
}
|
||||
}
|
||||
|
||||
syncentchanges();
|
||||
physicsframe();
|
||||
checkweaponswitch();
|
||||
checkakimbo();
|
||||
@@ -1060,6 +1061,7 @@ void resetmap(bool mrproper)
|
||||
clearminimap();
|
||||
cleardynlights();
|
||||
pruneundos();
|
||||
changedents.setsize(0);
|
||||
particlereset();
|
||||
if(mrproper)
|
||||
{
|
||||
|
||||
@@ -614,3 +614,18 @@ void entstats(void)
|
||||
|
||||
COMMAND(entstats, ARG_NONE);
|
||||
|
||||
vector<int> changedents;
|
||||
int lastentsync = 0;
|
||||
|
||||
void syncentchanges(bool force)
|
||||
{
|
||||
if(lastmillis - lastentsync < 1000 && !force) return;
|
||||
loopv(changedents) if(ents.inrange(changedents[i]))
|
||||
{
|
||||
entity &e = ents[changedents[i]];
|
||||
addmsg(SV_EDITENT, "ri9", changedents[i], e.type, e.x, e.y, e.z, e.attr1, e.attr2, e.attr3, e.attr4);
|
||||
}
|
||||
changedents.setsize(0);
|
||||
lastentsync = lastmillis;
|
||||
}
|
||||
|
||||
|
||||
@@ -690,6 +690,8 @@ extern void rendermapmodels();
|
||||
extern void resetspawns(int type = -1);
|
||||
extern void setspawn(int i, bool on);
|
||||
extern void checkitems(playerent *d);
|
||||
extern vector<int> changedents;
|
||||
extern void syncentchanges(bool force = false);
|
||||
|
||||
// rndmap
|
||||
extern void perlinarea(block &b, int scale, int seed, int psize);
|
||||
|
||||
@@ -186,6 +186,7 @@ void entproperty(int prop, int amount)
|
||||
case LIGHT: calclight(); break;
|
||||
case SOUND: audiomgr.preloadmapsound(e);
|
||||
}
|
||||
if(changedents.find(n) == -1) changedents.add(n); // apply ent changes later (reduces network traffic)
|
||||
}
|
||||
|
||||
hashtable<char *, enet_uint32> mapinfo, &resdata = mapinfo;
|
||||
@@ -219,6 +220,7 @@ void delent()
|
||||
{
|
||||
int e = closestent();
|
||||
if(e<0) { conoutf("no more entities"); return; }
|
||||
syncentchanges(true);
|
||||
int t = ents[e].type;
|
||||
conoutf("%s entity deleted", entnames[t]);
|
||||
ents[e].type = NOTUSED;
|
||||
@@ -261,6 +263,7 @@ entity *newentity(int index, int x, int y, int z, char *what, int v1, int v2, in
|
||||
e.attr1 = (int)camera1->yaw;
|
||||
break;
|
||||
}
|
||||
syncentchanges(true);
|
||||
addmsg(SV_EDITENT, "ri9", index<0 ? ents.length() : index, type, e.x, e.y, e.z, e.attr1, e.attr2, e.attr3, e.attr4);
|
||||
e.spawned = true;
|
||||
int oldtype = type;
|
||||
|
||||
Reference in New Issue
Block a user