Example #1
0
 void clearmonsters()     // called after map start or when toggling edit mode to reset/spawn all monsters to initial state
 {
     removetrackedparticles();
     removetrackeddynlights();
     loopv(monsters) delete monsters[i]; 
     cleardynentcache();
     monsters.shrink(0);
     numkilled = 0;
     monstertotal = 0;
     spawnremain = 0;
     remain = 0;
     monsterhurt = false;
     if(m_dmsp)
     {
         nextmonster = mtimestart = lastmillis+10000;
         monstertotal = spawnremain = skill*10;
     }
     else if(m_classicsp || !spguard)
     {
         mtimestart = lastmillis;
         loopv(entities::ents)
         {
             extentity &e = *entities::ents[i];
             if(e.type!=MONSTER) continue;
             monster *m = new monster(e.attr2, e.attr1, e.attr3, M_SLEEP, 100, 0);  
             monsters.add(m);
             m->o = e.o;
             entinmap(m);
             updatedynentcache(m);
             monstertotal++;
         }
     }
Example #2
0
// called after map start of when toggling edit mode to reset/spawn all monsters
// to initial state
void monsterclear(void) {
  cleanmonsters();
  if (m_dmsp) {
    nextmonster = mtimestart = int(lastmillis())+1000;
    monstertotal = spawnremain = 1; // XXX mode()<0 ? skill*10 : 0;
  } else if (m_classicsp) {
    mtimestart = lastmillis();
    loopv(ents) if (ents[i].type==MONSTER) {
      auto m = basicmonster(ents[i].attr2, ents[i].attr1, M_SLEEP, 100, 0);
      m->o.x = ents[i].x;
      m->o.y = ents[i].y;
      m->o.z = ents[i].z;
      entinmap(m);
      monstertotal++;
    }
  }
}
Example #3
0
void toggleedit() {
	if (player1->state == CS_DEAD)
		return;    // do not allow dead players to edit to avoid state confusion
	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;
		if (m_classicsp)
			monsterclear();     // all monsters back at their spawns for editing
		projreset();
	};
	selset = false;
	editing = editmode;
}
Example #4
0
void teleport(int n, game::dynent *d) { // also used by monsters
#if 0 // TODO
  int e = -1, tag = ents[n].attr1, beenhere = -1;
  for (;;) {
    e = world::findentity(TELEDEST, e+1);
    if (e==beenhere || e<0) {
      con::out("no teleport destination for tag %d", tag);
      return;
    }
    if (beenhere<0) beenhere = e;
    if (ents[e].attr2==tag) {
      d->o = vec3f(ents[e].x, ents[e].y, ents[e].z);
      d->vel = zero;
      d->ypr.x = ents[e].attr1;
      d->ypr.y = 0.f;
      entinmap(d);
      sound::playc(sound::TELEPORT);
      break;
    }
  }
#endif
}