示例#1
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;
        }