Esempio n. 1
0
  /*
   * QUAKED monster_floater (1 .5 0) (-16 -16 -24) (16 16 32) Ambush
   * Trigger_Spawn Sight
   */
  public static void SP_monster_floater(edict_t self) {
    if (GameBase.deathmatch.value != 0) {
      GameUtil.G_FreeEdict(self);
      return;
    }

    sound_attack2 = GameBase.gi.soundindex("floater/fltatck2.wav");
    sound_attack3 = GameBase.gi.soundindex("floater/fltatck3.wav");
    sound_death1 = GameBase.gi.soundindex("floater/fltdeth1.wav");
    sound_idle = GameBase.gi.soundindex("floater/fltidle1.wav");
    sound_pain1 = GameBase.gi.soundindex("floater/fltpain1.wav");
    sound_pain2 = GameBase.gi.soundindex("floater/fltpain2.wav");
    sound_sight = GameBase.gi.soundindex("floater/fltsght1.wav");

    GameBase.gi.soundindex("floater/fltatck1.wav");

    self.s.sound = GameBase.gi.soundindex("floater/fltsrch1.wav");

    self.movetype = Defines.MOVETYPE_STEP;
    self.solid = Defines.SOLID_BBOX;
    self.s.modelindex = GameBase.gi.modelindex("models/monsters/float/tris.md2");
    Math3D.VectorSet(self.mins, -24, -24, -24);
    Math3D.VectorSet(self.maxs, 24, 24, 32);

    self.health = 200;
    self.gib_health = -80;
    self.mass = 300;

    self.pain = floater_pain;
    self.die = floater_die;

    self.monsterinfo.stand = floater_stand;
    self.monsterinfo.walk = floater_walk;
    self.monsterinfo.run = floater_run;
    //		self.monsterinfo.dodge = floater_dodge;
    self.monsterinfo.attack = floater_attack;
    self.monsterinfo.melee = floater_melee;
    self.monsterinfo.sight = floater_sight;
    self.monsterinfo.idle = floater_idle;

    GameBase.gi.linkentity(self);

    if (Lib.random() <= 0.5) self.monsterinfo.currentmove = floater_move_stand1;
    else self.monsterinfo.currentmove = floater_move_stand2;

    self.monsterinfo.scale = MODEL_SCALE;

    GameAI.flymonster_start.think(self);
  }
Esempio n. 2
0
        public void pain(edict_t self, edict_t other, float kick, int damage) {
          int n;

          if (self.health < (self.max_health / 2)) self.s.skinnum = 1;

          if (GameBase.level.time < self.pain_debounce_time) return;

          self.pain_debounce_time = GameBase.level.time + 3;
          if (GameBase.skill.value == 3) return; // no pain anims in nightmare

          n = (Lib.rand() + 1) % 3;
          if (n == 0) {
            GameBase.gi.sound(self, Defines.CHAN_VOICE, sound_pain1, 1, Defines.ATTN_NORM, 0);
            self.monsterinfo.currentmove = floater_move_pain1;
          } else {
            GameBase.gi.sound(self, Defines.CHAN_VOICE, sound_pain2, 1, Defines.ATTN_NORM, 0);
            self.monsterinfo.currentmove = floater_move_pain2;
          }
          return;
        }
Esempio n. 3
0
        public boolean think(edict_t self) {
          float[] forward = {0, 0, 0}, right = {0, 0, 0};
          float[] origin = {0, 0, 0};
          float[] dir = {0, 0, 0};
          float[] offset = {0, 0, 0};

          Math3D.VectorSubtract(self.enemy.s.origin, self.s.origin, dir);

          Math3D.AngleVectors(self.s.angles, forward, right, null);
          // FIXME use a flash and replace these two lines with the commented
          // one
          Math3D.VectorSet(offset, 18.5f, -0.9f, 10f);
          Math3D.G_ProjectSource(self.s.origin, offset, forward, right, origin);
          //		G_ProjectSource (self.s.origin,
          // monster_flash_offset[flash_number], forward, right, origin);

          GameBase.gi.sound(self, Defines.CHAN_WEAPON, sound_attack2, 1, Defines.ATTN_NORM, 0);

          // FIXME use the flash, Luke
          GameBase.gi.WriteByte(Defines.svc_temp_entity);
          GameBase.gi.WriteByte(Defines.TE_SPLASH);
          GameBase.gi.WriteByte(32);
          GameBase.gi.WritePosition(origin);
          GameBase.gi.WriteDir(dir);
          GameBase.gi.WriteByte(1); // sparks
          GameBase.gi.multicast(origin, Defines.MULTICAST_PVS);

          GameCombat.T_Damage(
              self.enemy,
              self,
              self,
              dir,
              self.enemy.s.origin,
              Globals.vec3_origin,
              5 + Lib.rand() % 6,
              -10,
              Defines.DAMAGE_ENERGY,
              Defines.MOD_UNKNOWN);
          return true;
        }
Esempio n. 4
0
        public boolean think(edict_t self) {

          GameBase.gi.sound(self, Defines.CHAN_WEAPON, sound_attack3, 1, Defines.ATTN_NORM, 0);
          GameWeapon.fire_hit(self, aim, 5 + Lib.rand() % 6, -50);
          return true;
        }
Esempio n. 5
0
 public boolean think(edict_t self) {
   if (Lib.random() <= 0.5) self.monsterinfo.currentmove = floater_move_stand1;
   else self.monsterinfo.currentmove = floater_move_stand2;
   return true;
 }