⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 m_brain.java

📁 JAKE2用JAVA写的queck2的3D游戏开发引擎
💻 JAVA
📖 第 1 页 / 共 3 页
字号:
    //    //	   MELEE    //    static EntThinkAdapter brain_swing_right = new EntThinkAdapter() {    	public String getID() { return "brain_swing_right"; }        public boolean think(edict_t self) {            GameBase.gi.sound(self, Defines.CHAN_BODY, sound_melee1, 1,                    Defines.ATTN_NORM, 0);            return true;        }    };    static EntThinkAdapter brain_hit_right = new EntThinkAdapter() {    	public String getID() { return "brain_hit_right"; }        public boolean think(edict_t self) {            float[] aim = { 0, 0, 0 };            Math3D.VectorSet(aim, Defines.MELEE_DISTANCE, self.maxs[0], 8);            if (GameWeapon.fire_hit(self, aim, (15 + (Lib.rand() % 5)), 40))                GameBase.gi.sound(self, Defines.CHAN_WEAPON, sound_melee3, 1,                        Defines.ATTN_NORM, 0);            return true;        }    };    static EntThinkAdapter brain_swing_left = new EntThinkAdapter() {    	public String getID() { return "brain_swing_left"; }        public boolean think(edict_t self) {            GameBase.gi.sound(self, Defines.CHAN_BODY, sound_melee2, 1,                    Defines.ATTN_NORM, 0);            return true;        }    };    static EntThinkAdapter brain_hit_left = new EntThinkAdapter() {    	public String getID() { return "brain_hit_left"; }        public boolean think(edict_t self) {            float[] aim = { 0, 0, 0 };            Math3D.VectorSet(aim, Defines.MELEE_DISTANCE, self.mins[0], 8);            if (GameWeapon.fire_hit(self, aim, (15 + (Lib.rand() % 5)), 40))                GameBase.gi.sound(self, Defines.CHAN_WEAPON, sound_melee3, 1,                        Defines.ATTN_NORM, 0);            return true;        }    };    static EntThinkAdapter brain_chest_open = new EntThinkAdapter() {    	public String getID() { return "brain_chest_open"; }        public boolean think(edict_t self) {            self.spawnflags &= ~65536;            self.monsterinfo.power_armor_type = Defines.POWER_ARMOR_NONE;            GameBase.gi.sound(self, Defines.CHAN_BODY, sound_chest_open, 1,                    Defines.ATTN_NORM, 0);            return true;        }    };    static EntThinkAdapter brain_tentacle_attack = new EntThinkAdapter() {    	public String getID() { return "brain_tentacle_attack"; }        public boolean think(edict_t self) {            float[] aim = { 0, 0, 0 };            Math3D.VectorSet(aim, Defines.MELEE_DISTANCE, 0, 8);            if (GameWeapon.fire_hit(self, aim, (10 + (Lib.rand() % 5)), -600)                    && GameBase.skill.value > 0)                self.spawnflags |= 65536;            GameBase.gi.sound(self, Defines.CHAN_WEAPON,                    sound_tentacles_retract, 1, Defines.ATTN_NORM, 0);            return true;        }    };    static mframe_t brain_frames_attack1[] = new mframe_t[] {            new mframe_t(GameAI.ai_charge, 8, null),            new mframe_t(GameAI.ai_charge, 3, null),            new mframe_t(GameAI.ai_charge, 5, null),            new mframe_t(GameAI.ai_charge, 0, null),            new mframe_t(GameAI.ai_charge, -3, brain_swing_right),            new mframe_t(GameAI.ai_charge, 0, null),            new mframe_t(GameAI.ai_charge, -5, null),            new mframe_t(GameAI.ai_charge, -7, brain_hit_right),            new mframe_t(GameAI.ai_charge, 0, null),            new mframe_t(GameAI.ai_charge, 6, brain_swing_left),            new mframe_t(GameAI.ai_charge, 1, null),            new mframe_t(GameAI.ai_charge, 2, brain_hit_left),            new mframe_t(GameAI.ai_charge, -3, null),            new mframe_t(GameAI.ai_charge, 6, null),            new mframe_t(GameAI.ai_charge, -1, null),            new mframe_t(GameAI.ai_charge, -3, null),            new mframe_t(GameAI.ai_charge, 2, null),            new mframe_t(GameAI.ai_charge, -11, null) };    static EntThinkAdapter brain_chest_closed = new EntThinkAdapter() {    	public String getID() { return "brain_chest_closed"; }        public boolean think(edict_t self) {            self.monsterinfo.power_armor_type = Defines.POWER_ARMOR_SCREEN;            if ((self.spawnflags & 65536) != 0) {                self.spawnflags &= ~65536;                self.monsterinfo.currentmove = brain_move_attack1;            }            return true;        }    };    static mframe_t brain_frames_attack2[] = new mframe_t[] {            new mframe_t(GameAI.ai_charge, 5, null),            new mframe_t(GameAI.ai_charge, -4, null),            new mframe_t(GameAI.ai_charge, -4, null),            new mframe_t(GameAI.ai_charge, -3, null),            new mframe_t(GameAI.ai_charge, 0, brain_chest_open),            new mframe_t(GameAI.ai_charge, 0, null),            new mframe_t(GameAI.ai_charge, 13, brain_tentacle_attack),            new mframe_t(GameAI.ai_charge, 0, null),            new mframe_t(GameAI.ai_charge, 2, null),            new mframe_t(GameAI.ai_charge, 0, null),            new mframe_t(GameAI.ai_charge, -9, brain_chest_closed),            new mframe_t(GameAI.ai_charge, 0, null),            new mframe_t(GameAI.ai_charge, 4, null),            new mframe_t(GameAI.ai_charge, 3, null),            new mframe_t(GameAI.ai_charge, 2, null),            new mframe_t(GameAI.ai_charge, -3, null),            new mframe_t(GameAI.ai_charge, -6, null) };    static EntThinkAdapter brain_melee = new EntThinkAdapter() {    	public String getID() { return "brain_melee"; }        public boolean think(edict_t self) {            if (Lib.random() <= 0.5)                self.monsterinfo.currentmove = brain_move_attack1;            else                self.monsterinfo.currentmove = brain_move_attack2;            return true;        }    };    //    //	   RUN    //    static mframe_t brain_frames_run[] = new mframe_t[] {            new mframe_t(GameAI.ai_run, 9, null),            new mframe_t(GameAI.ai_run, 2, null),            new mframe_t(GameAI.ai_run, 3, null),            new mframe_t(GameAI.ai_run, 3, null),            new mframe_t(GameAI.ai_run, 1, null),            new mframe_t(GameAI.ai_run, 0, null),            new mframe_t(GameAI.ai_run, 0, null),            new mframe_t(GameAI.ai_run, 10, null),            new mframe_t(GameAI.ai_run, -4, null),            new mframe_t(GameAI.ai_run, -1, null),            new mframe_t(GameAI.ai_run, 2, null) };    static mmove_t brain_move_run = new mmove_t(FRAME_walk101, FRAME_walk111,            brain_frames_run, null);    static EntThinkAdapter brain_run = new EntThinkAdapter() {    	public String getID() { return "brain_run"; }        public boolean think(edict_t self) {            self.monsterinfo.power_armor_type = Defines.POWER_ARMOR_SCREEN;            if ((self.monsterinfo.aiflags & Defines.AI_STAND_GROUND) != 0)                self.monsterinfo.currentmove = brain_move_stand;            else                self.monsterinfo.currentmove = brain_move_run;            return true;        }    };    static mframe_t brain_frames_defense[] = new mframe_t[] {            new mframe_t(GameAI.ai_move, 0, null),            new mframe_t(GameAI.ai_move, 0, null),            new mframe_t(GameAI.ai_move, 0, null),            new mframe_t(GameAI.ai_move, 0, null),            new mframe_t(GameAI.ai_move, 0, null),            new mframe_t(GameAI.ai_move, 0, null),            new mframe_t(GameAI.ai_move, 0, null),            new mframe_t(GameAI.ai_move, 0, null),            new mframe_t(GameAI.ai_move, 0, null) };    static mmove_t brain_move_defense = new mmove_t(FRAME_defens01,            FRAME_defens08, brain_frames_defense, null);    static mframe_t brain_frames_pain3[] = new mframe_t[] {            new mframe_t(GameAI.ai_move, -2, null),            new mframe_t(GameAI.ai_move, 2, null),            new mframe_t(GameAI.ai_move, 1, null),            new mframe_t(GameAI.ai_move, 3, null),            new mframe_t(GameAI.ai_move, 0, null),            new mframe_t(GameAI.ai_move, -4, null) };    static mmove_t brain_move_pain3 = new mmove_t(FRAME_pain301, FRAME_pain306,            brain_frames_pain3, brain_run);    static mframe_t brain_frames_pain2[] = new mframe_t[] {            new mframe_t(GameAI.ai_move, -2, null),            new mframe_t(GameAI.ai_move, 0, null),            new mframe_t(GameAI.ai_move, 0, null),            new mframe_t(GameAI.ai_move, 0, null),            new mframe_t(GameAI.ai_move, 0, null),            new mframe_t(GameAI.ai_move, 3, null),            new mframe_t(GameAI.ai_move, 1, null),            new mframe_t(GameAI.ai_move, -2, null) };    static mmove_t brain_move_pain2 = new mmove_t(FRAME_pain201, FRAME_pain208,            brain_frames_pain2, brain_run);    static mframe_t brain_frames_pain1[] = new mframe_t[] {            new mframe_t(GameAI.ai_move, -6, null),            new mframe_t(GameAI.ai_move, -2, null),            new mframe_t(GameAI.ai_move, -6, null),            new mframe_t(GameAI.ai_move, 0, null),            new mframe_t(GameAI.ai_move, 0, null),            new mframe_t(GameAI.ai_move, 0, null),            new mframe_t(GameAI.ai_move, 0, null),            new mframe_t(GameAI.ai_move, 0, null),            new mframe_t(GameAI.ai_move, 0, null),            new mframe_t(GameAI.ai_move, 0, null),            new mframe_t(GameAI.ai_move, 0, null),            new mframe_t(GameAI.ai_move, 0, null),            new mframe_t(GameAI.ai_move, 0, null),            new mframe_t(GameAI.ai_move, 2, null),            new mframe_t(GameAI.ai_move, 0, null),            new mframe_t(GameAI.ai_move, 2, null),            new mframe_t(GameAI.ai_move, 1, null),            new mframe_t(GameAI.ai_move, 7, null),            new mframe_t(GameAI.ai_move, 0, null),            new mframe_t(GameAI.ai_move, 3, null),            new mframe_t(GameAI.ai_move, -1, null) };    static mmove_t brain_move_pain1 = new mmove_t(FRAME_pain101, FRAME_pain121,            brain_frames_pain1, brain_run);    static mframe_t brain_frames_duck[] = new mframe_t[] {            new mframe_t(GameAI.ai_move, 0, null),            new mframe_t(GameAI.ai_move, -2, brain_duck_down),            new mframe_t(GameAI.ai_move, 17, brain_duck_hold),            new mframe_t(GameAI.ai_move, -3, null),            new mframe_t(GameAI.ai_move, -1, brain_duck_up),            new mframe_t(GameAI.ai_move, -5, null),            new mframe_t(GameAI.ai_move, -6, null),            new mframe_t(GameAI.ai_move, -6, null) };    static mmove_t brain_move_duck = new mmove_t(FRAME_duck01, FRAME_duck08,            brain_frames_duck, brain_run);    static EntPainAdapter brain_pain = new EntPainAdapter() {    	public String getID() { return "brain_pain"; }        public void pain(edict_t self, edict_t other, float kick, int damage) {            float r;            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            r = Lib.random();            if (r < 0.33) {                GameBase.gi.sound(self, Defines.CHAN_VOICE, sound_pain1, 1,                        Defines.ATTN_NORM, 0);                self.monsterinfo.currentmove = brain_move_pain1;            } else if (r < 0.66) {                GameBase.gi.sound(self, Defines.CHAN_VOICE, sound_pain2, 1,                        Defines.ATTN_NORM, 0);                self.monsterinfo.currentmove = brain_move_pain2;            } else {                GameBase.gi.sound(self, Defines.CHAN_VOICE, sound_pain1, 1,                        Defines.ATTN_NORM, 0);                self.monsterinfo.currentmove = brain_move_pain3;            }        }    };    static EntDieAdapter brain_die = new EntDieAdapter() {    	public String getID() { return "brain_die"; }        public void die(edict_t self, edict_t inflictor, edict_t attacker,                int damage, float[] point) {            int n;            self.s.effects = 0;            self.monsterinfo.power_armor_type = Defines.POWER_ARMOR_NONE;            //	   check for gib            if (self.health <= self.gib_health) {                GameBase.gi                        .sound(self, Defines.CHAN_VOICE, GameBase.gi                                .soundindex("misc/udeath.wav"), 1,                                Defines.ATTN_NORM, 0);                for (n = 0; n < 2; n++)                    GameMisc.ThrowGib(self, "models/objects/gibs/bone/tris.md2",                            damage, Defines.GIB_ORGANIC);                for (n = 0; n < 4; n++)                    GameMisc.ThrowGib(self,                            "models/objects/gibs/sm_meat/tris.md2", damage,                            Defines.GIB_ORGANIC);                GameMisc.ThrowHead(self, "models/objects/gibs/head2/tris.md2",                        damage, Defines.GIB_ORGANIC);                self.deadflag = Defines.DEAD_DEAD;                return;            }            if (self.deadflag == Defines.DEAD_DEAD)                return;            //	   regular death            GameBase.gi.sound(self, Defines.CHAN_VOICE, sound_death, 1,                    Defines.ATTN_NORM, 0);            self.deadflag = Defines.DEAD_DEAD;            self.takedamage = Defines.DAMAGE_YES;            if (Lib.random() <= 0.5)                self.monsterinfo.currentmove = brain_move_death1;            else                self.monsterinfo.currentmove = brain_move_death2;        }    };    static mmove_t brain_move_attack1 = new mmove_t(FRAME_attak101,            FRAME_attak118, brain_frames_attack1, brain_run);    static mmove_t brain_move_attack2 = new mmove_t(FRAME_attak201,            FRAME_attak217, brain_frames_attack2, brain_run);    /*     * QUAKED monster_brain (1 .5 0) (-16 -16 -24) (16 16 32) Ambush     * Trigger_Spawn Sight     */    public static void SP_monster_brain(edict_t self) {        if (GameBase.deathmatch.value != 0) {            GameUtil.G_FreeEdict(self);            return;        }        sound_chest_open = GameBase.gi.soundindex("brain/brnatck1.wav");        sound_tentacles_extend = GameBase.gi.soundindex("brain/brnatck2.wav");        sound_tentacles_retract = GameBase.gi.soundindex("brain/brnatck3.wav");        sound_death = GameBase.gi.soundindex("brain/brndeth1.wav");        sound_idle1 = GameBase.gi.soundindex("brain/brnidle1.wav");        sound_idle2 = GameBase.gi.soundindex("brain/brnidle2.wav");        sound_idle3 = GameBase.gi.soundindex("brain/brnlens1.wav");        sound_pain1 = GameBase.gi.soundindex("brain/brnpain1.wav");        sound_pain2 = GameBase.gi.soundindex("brain/brnpain2.wav");        sound_sight = GameBase.gi.soundindex("brain/brnsght1.wav");        sound_search = GameBase.gi.soundindex("brain/brnsrch1.wav");        sound_melee1 = GameBase.gi.soundindex("brain/melee1.wav");        sound_melee2 = GameBase.gi.soundindex("brain/melee2.wav");        sound_melee3 = GameBase.gi.soundindex("brain/melee3.wav");        self.movetype = Defines.MOVETYPE_STEP;        self.solid = Defines.SOLID_BBOX;        self.s.modelindex = GameBase.gi                .modelindex("models/monsters/brain/tris.md2");        Math3D.VectorSet(self.mins, -16, -16, -24);        Math3D.VectorSet(self.maxs, 16, 16, 32);        self.health = 300;        self.gib_health = -150;        self.mass = 400;        self.pain = brain_pain;        self.die = brain_die;        self.monsterinfo.stand = brain_stand;        self.monsterinfo.walk = brain_walk;        self.monsterinfo.run = brain_run;        self.monsterinfo.dodge = brain_dodge;        //		self.monsterinfo.attack = brain_attack;        self.monsterinfo.melee = brain_melee;        self.monsterinfo.sight = brain_sight;        self.monsterinfo.search = brain_search;        self.monsterinfo.idle = brain_idle;        self.monsterinfo.power_armor_type = Defines.POWER_ARMOR_SCREEN;        self.monsterinfo.power_armor_power = 100;        GameBase.gi.linkentity(self);        self.monsterinfo.currentmove = brain_move_stand;        self.monsterinfo.scale = MODEL_SCALE;        GameAI.walkmonster_start.think(self);    }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -