*** empty log message ***
git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@928 e016b1c5-ed68-44aa-a2f7-31cac88cffde
This commit is contained in:
@@ -38,12 +38,10 @@ void toggleedit()
|
||||
if(!editmode && !allowedittoggle()) return; // not in most multiplayer modes
|
||||
if(!(editmode = !editmode))
|
||||
{
|
||||
settagareas(); // reset triggers to allow quick playtesting
|
||||
entinmap(player1); // find spawn closest to current floating pos
|
||||
}
|
||||
else
|
||||
{
|
||||
resettagareas(); // clear trigger areas to allow them to be edited
|
||||
player1->health = 100;
|
||||
//put call to clear/restart gamemode
|
||||
projreset();
|
||||
|
||||
+3
-39
@@ -18,20 +18,11 @@ char *entmdlnames[] =
|
||||
"pickups/pistolclips", "pickups/ammobox", "pickups/nades", "pickups/health", "pickups/kevlar", "pickups/akimbo",
|
||||
};
|
||||
|
||||
int triggertime = 0;
|
||||
|
||||
void renderent(entity &e, char *mdlname, float z, float yaw, int anim = ANIM_MAPMODEL|ANIM_LOOP, int basetime = 0, float speed = 10.0f)
|
||||
{
|
||||
rendermodel(mdlname, anim, 0, 1.1f, e.x, z+S(e.x, e.y)->floor, e.y, yaw, 0, speed, basetime);
|
||||
}
|
||||
|
||||
int triggeranim(entity &e)
|
||||
{
|
||||
int anim = ANIM_TRIGGER;
|
||||
if(!triggertime) anim |= e.spawned ? ANIM_START : ANIM_END;
|
||||
return anim;
|
||||
}
|
||||
|
||||
void renderentities()
|
||||
{
|
||||
if(editmode) loopv(ents)
|
||||
@@ -41,7 +32,6 @@ void renderentities()
|
||||
vec v(e.x, e.y, e.z);
|
||||
particle_splash(2, 2, 40, v);
|
||||
}
|
||||
if(lastmillis>triggertime+1000) triggertime = 0;
|
||||
loopv(ents)
|
||||
{
|
||||
entity &e = ents[i];
|
||||
@@ -66,30 +56,10 @@ void renderentities()
|
||||
rendermodel(path, ANIM_FLAG|ANIM_LOOP, 0, 4, e.x, f.state==CTFF_INBASE ? (float)S(e.x, e.y)->floor : e.z, e.y, (float)((e.attr1+7)-(e.attr1+7)%15), 0, 120.0f);
|
||||
}
|
||||
}
|
||||
else
|
||||
else if(isitem(e.type))
|
||||
{
|
||||
if(OUTBORD(e.x, e.y)) continue;
|
||||
if(e.type!=CARROT)
|
||||
{
|
||||
if(!e.spawned) continue;
|
||||
if(!isitem(e.type)) continue;
|
||||
renderent(e, entmdlnames[e.type-I_CLIPS], (float)(1+sinf(lastmillis/100.0f+e.x+e.y)/20), lastmillis/10.0f);
|
||||
}
|
||||
else switch(e.attr2)
|
||||
{
|
||||
case 1:
|
||||
case 3:
|
||||
continue;
|
||||
|
||||
case 2:
|
||||
case 0:
|
||||
if(!e.spawned) continue;
|
||||
renderent(e, "carrot", (float)(1+sinf(lastmillis/100.0+e.x+e.y)/20), lastmillis/(e.attr2 ? 1.0f : 10.0f));
|
||||
break;
|
||||
|
||||
case 4: renderent(e, "switch2", 3, (float)e.attr3*90, triggeranim(e), triggertime); break;
|
||||
case 5: renderent(e, "switch1", -0.15f, (float)e.attr3*90, triggeranim(e), triggertime); break;
|
||||
}
|
||||
if(OUTBORD(e.x, e.y) || !e.spawned) continue;
|
||||
renderent(e, entmdlnames[e.type-I_CLIPS], (float)(1+sinf(lastmillis/100.0f+e.x+e.y)/20), lastmillis/10.0f);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -189,12 +159,6 @@ void pickup(int n, playerent *d)
|
||||
additem(d, n, d->akimbo, 60, 9);
|
||||
break;
|
||||
|
||||
case CARROT:
|
||||
ents[n].spawned = false;
|
||||
triggertime = lastmillis;
|
||||
trigger(ents[n].attr1, ents[n].attr2, false); // needs to go over server for multiplayer
|
||||
break;
|
||||
|
||||
case LADDER:
|
||||
d->onladder = true;
|
||||
break;
|
||||
|
||||
@@ -149,9 +149,6 @@ extern void remipmore(block &b, int level = 0);
|
||||
extern int closestent();
|
||||
extern int findentity(int type, int index = 0);
|
||||
extern int findentity(int type, int index, uchar attr2);
|
||||
extern void trigger(int tag, int type, bool savegame);
|
||||
extern void resettagareas();
|
||||
extern void settagareas();
|
||||
extern entity *newentity(int x, int y, int z, char *what, int v1, int v2, int v3, int v4);
|
||||
|
||||
// worldlight
|
||||
|
||||
@@ -107,7 +107,6 @@ void loadgamerest()
|
||||
loopv(ents)
|
||||
{
|
||||
ents[i].spawned = gzgetc(f)!=0;
|
||||
if(ents[i].type==CARROT && !ents[i].spawned) trigger(ents[i].attr1, ents[i].attr2, true);
|
||||
}
|
||||
restoreserverstate(ents);
|
||||
|
||||
|
||||
@@ -10,56 +10,6 @@ int sfactor, ssize, cubicsize, mipsize;
|
||||
|
||||
header hdr;
|
||||
|
||||
void settag(int tag, int type) // set all cubes with "tag" to space, if tag is 0 then reset ALL tagged cubes according to type
|
||||
{
|
||||
int maxx = 0, maxy = 0, minx = ssize, miny = ssize;
|
||||
loop(x, ssize) loop(y, ssize)
|
||||
{
|
||||
sqr *s = S(x, y);
|
||||
if(s->tag)
|
||||
{
|
||||
if(tag)
|
||||
{
|
||||
if(tag==s->tag) s->type = SPACE;
|
||||
else continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
s->type = type ? SOLID : SPACE;
|
||||
}
|
||||
if(x>maxx) maxx = x;
|
||||
if(y>maxy) maxy = y;
|
||||
if(x<minx) minx = x;
|
||||
if(y<miny) miny = y;
|
||||
}
|
||||
}
|
||||
block b = { minx, miny, maxx-minx+1, maxy-miny+1 };
|
||||
if(maxx) remip(b); // remip minimal area of changed geometry
|
||||
}
|
||||
|
||||
void resettagareas() { settag(0, 0); } // reset for editing or map saving
|
||||
// Modified by Rick
|
||||
//void settagareas() { settag(0, 1); loopv(ents) if(ents[i].type==TRIGGER) setspawn(i, true); } // set for playing
|
||||
|
||||
void settagareas() // set for playing
|
||||
{
|
||||
settag(0, 1);
|
||||
loopv(ents) if(ents[i].type==CARROT) setspawn(i, true);
|
||||
if(m_botmode) BotManager.PickNextTrigger();
|
||||
}
|
||||
// End mod
|
||||
|
||||
void trigger(int tag, int type, bool savegame)
|
||||
{
|
||||
if(!tag) return;
|
||||
settag(tag, type);
|
||||
if(!savegame && type!=3) playsound(S_RUMBLE);
|
||||
s_sprintfd(aliasname)("level_trigger_%d", tag);
|
||||
if(identexists(aliasname)) execute(aliasname);
|
||||
}
|
||||
|
||||
COMMAND(trigger, ARG_2INT);
|
||||
|
||||
// main geometric mipmapping routine, recursively rebuild mipmaps within block b.
|
||||
// tries to produce cube out of 4 lower level mips as well as possible,
|
||||
// sets defer to 0 if mipped cube is a perfect mip, i.e. can be rendered at this
|
||||
|
||||
@@ -127,7 +127,6 @@ uchar *readmap(char *mname, int *msize)
|
||||
|
||||
void save_world(char *mname)
|
||||
{
|
||||
resettagareas(); // wouldn't be able to reproduce tagged areas otherwise
|
||||
voptimize();
|
||||
toptimize();
|
||||
if(!*mname) mname = getclientmap();
|
||||
@@ -203,7 +202,6 @@ void save_world(char *mname)
|
||||
spurge;
|
||||
gzclose(f);
|
||||
conoutf("wrote map file %s", cgzname);
|
||||
settagareas();
|
||||
}
|
||||
|
||||
extern void preparectf(bool cleanonly = false);
|
||||
@@ -351,15 +349,9 @@ void load_world(char *mname) // still supports all map formats that have
|
||||
gzclose(f);
|
||||
c2skeepalive();
|
||||
calclight();
|
||||
settagareas();
|
||||
conoutf("read map %s (%d milliseconds)", cgzname, SDL_GetTicks()-lastmillis);
|
||||
conoutf("%s", hdr.maptitle);
|
||||
startmap(mname);
|
||||
loopl(256)
|
||||
{
|
||||
s_sprintfd(aliasname)("level_trigger_%d", l); // can this be done smarter?
|
||||
if(identexists(aliasname)) alias(aliasname, "");
|
||||
}
|
||||
execfile("config/default_map_settings.cfg");
|
||||
execfile(pcfname);
|
||||
execfile(mcfname);
|
||||
|
||||
Reference in New Issue
Block a user