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

📄 m_flipper.java

📁 JAKE2用JAVA写的queck2的3D游戏开发引擎
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
    };    public final static int FLIPPER_RUN_SPEED = 24;    static mframe_t flipper_frames_run[] = new mframe_t[] {            new mframe_t(GameAI.ai_run, FLIPPER_RUN_SPEED, null), // 6            new mframe_t(GameAI.ai_run, FLIPPER_RUN_SPEED, null),            new mframe_t(GameAI.ai_run, FLIPPER_RUN_SPEED, null),            new mframe_t(GameAI.ai_run, FLIPPER_RUN_SPEED, null),            new mframe_t(GameAI.ai_run, FLIPPER_RUN_SPEED, null),            // 10            new mframe_t(GameAI.ai_run, FLIPPER_RUN_SPEED, null),            new mframe_t(GameAI.ai_run, FLIPPER_RUN_SPEED, null),            new mframe_t(GameAI.ai_run, FLIPPER_RUN_SPEED, null),            new mframe_t(GameAI.ai_run, FLIPPER_RUN_SPEED, null),            new mframe_t(GameAI.ai_run, FLIPPER_RUN_SPEED, null),            new mframe_t(GameAI.ai_run, FLIPPER_RUN_SPEED, null),            new mframe_t(GameAI.ai_run, FLIPPER_RUN_SPEED, null),            new mframe_t(GameAI.ai_run, FLIPPER_RUN_SPEED, null),            new mframe_t(GameAI.ai_run, FLIPPER_RUN_SPEED, null),            new mframe_t(GameAI.ai_run, FLIPPER_RUN_SPEED, null),            // 20            new mframe_t(GameAI.ai_run, FLIPPER_RUN_SPEED, null),            new mframe_t(GameAI.ai_run, FLIPPER_RUN_SPEED, null),            new mframe_t(GameAI.ai_run, FLIPPER_RUN_SPEED, null),            new mframe_t(GameAI.ai_run, FLIPPER_RUN_SPEED, null),            new mframe_t(GameAI.ai_run, FLIPPER_RUN_SPEED, null),            new mframe_t(GameAI.ai_run, FLIPPER_RUN_SPEED, null),            new mframe_t(GameAI.ai_run, FLIPPER_RUN_SPEED, null),            new mframe_t(GameAI.ai_run, FLIPPER_RUN_SPEED, null),            new mframe_t(GameAI.ai_run, FLIPPER_RUN_SPEED, null) // 29    };    static mmove_t flipper_move_run_loop = new mmove_t(FRAME_flpver06,            FRAME_flpver29, flipper_frames_run, null);    static EntThinkAdapter flipper_run_loop = new EntThinkAdapter() {    	public String getID() { return "flipper_run_loop"; }        public boolean think(edict_t self) {            self.monsterinfo.currentmove = flipper_move_run_loop;            return true;        }    };    static mframe_t flipper_frames_run_start[] = new mframe_t[] {            new mframe_t(GameAI.ai_run, 8, null),            new mframe_t(GameAI.ai_run, 8, null),            new mframe_t(GameAI.ai_run, 8, null),            new mframe_t(GameAI.ai_run, 8, null),            new mframe_t(GameAI.ai_run, 8, null),            new mframe_t(GameAI.ai_run, 8, null) };    static mmove_t flipper_move_run_start = new mmove_t(FRAME_flpver01,            FRAME_flpver06, flipper_frames_run_start, flipper_run_loop);    static EntThinkAdapter flipper_run = new EntThinkAdapter() {    	public String getID() { return "flipper_run"; }        public boolean think(edict_t self) {            self.monsterinfo.currentmove = flipper_move_run_start;            return true;        }    };    /* Standard Swimming */    static mframe_t flipper_frames_walk[] = new mframe_t[] {            new mframe_t(GameAI.ai_walk, 4, null),            new mframe_t(GameAI.ai_walk, 4, null),            new mframe_t(GameAI.ai_walk, 4, null),            new mframe_t(GameAI.ai_walk, 4, null),            new mframe_t(GameAI.ai_walk, 4, null),            new mframe_t(GameAI.ai_walk, 4, null),            new mframe_t(GameAI.ai_walk, 4, null),            new mframe_t(GameAI.ai_walk, 4, null),            new mframe_t(GameAI.ai_walk, 4, null),            new mframe_t(GameAI.ai_walk, 4, null),            new mframe_t(GameAI.ai_walk, 4, null),            new mframe_t(GameAI.ai_walk, 4, null),            new mframe_t(GameAI.ai_walk, 4, null),            new mframe_t(GameAI.ai_walk, 4, null),            new mframe_t(GameAI.ai_walk, 4, null),            new mframe_t(GameAI.ai_walk, 4, null),            new mframe_t(GameAI.ai_walk, 4, null),            new mframe_t(GameAI.ai_walk, 4, null),            new mframe_t(GameAI.ai_walk, 4, null),            new mframe_t(GameAI.ai_walk, 4, null),            new mframe_t(GameAI.ai_walk, 4, null),            new mframe_t(GameAI.ai_walk, 4, null),            new mframe_t(GameAI.ai_walk, 4, null),            new mframe_t(GameAI.ai_walk, 4, null) };    static mmove_t flipper_move_walk = new mmove_t(FRAME_flphor01,            FRAME_flphor24, flipper_frames_walk, null);    static EntThinkAdapter flipper_walk = new EntThinkAdapter() {    	public String getID() { return "flipper_walk"; }        public boolean think(edict_t self) {            self.monsterinfo.currentmove = flipper_move_walk;            return true;        }    };    static mframe_t flipper_frames_start_run[] = new mframe_t[] {            new mframe_t(GameAI.ai_run, 8, null),            new mframe_t(GameAI.ai_run, 8, null),            new mframe_t(GameAI.ai_run, 8, null),            new mframe_t(GameAI.ai_run, 8, null),            new mframe_t(GameAI.ai_run, 8, flipper_run) };    static mmove_t flipper_move_start_run = new mmove_t(FRAME_flphor01,            FRAME_flphor05, flipper_frames_start_run, null);    static EntThinkAdapter flipper_start_run = new EntThinkAdapter() {    	public String getID() { return "flipper_start_run"; }        public boolean think(edict_t self) {            self.monsterinfo.currentmove = flipper_move_start_run;            return true;        }    };    static mframe_t flipper_frames_pain2[] = 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) };    static mmove_t flipper_move_pain2 = new mmove_t(FRAME_flppn101,            FRAME_flppn105, flipper_frames_pain2, flipper_run);    static mframe_t flipper_frames_pain1[] = 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) };    static mmove_t flipper_move_pain1 = new mmove_t(FRAME_flppn201,            FRAME_flppn205, flipper_frames_pain1, flipper_run);    static EntThinkAdapter flipper_bite = new EntThinkAdapter() {    	public String getID() { return "flipper_bite"; }        public boolean think(edict_t self) {            float[] aim = { 0, 0, 0 };            Math3D.VectorSet(aim, Defines.MELEE_DISTANCE, 0, 0);            GameWeapon.fire_hit(self, aim, 5, 0);            return true;        }    };    static EntThinkAdapter flipper_preattack = new EntThinkAdapter() {    	public String getID() { return "flipper_preattack"; }        public boolean think(edict_t self) {            GameBase.gi.sound(self, Defines.CHAN_WEAPON, sound_chomp, 1,                    Defines.ATTN_NORM, 0);            return true;        }    };    static mframe_t flipper_frames_attack[] = new mframe_t[] {            new mframe_t(GameAI.ai_charge, 0, flipper_preattack),            new mframe_t(GameAI.ai_charge, 0, null),            new mframe_t(GameAI.ai_charge, 0, null),            new mframe_t(GameAI.ai_charge, 0, null),            new mframe_t(GameAI.ai_charge, 0, null),            new mframe_t(GameAI.ai_charge, 0, null),            new mframe_t(GameAI.ai_charge, 0, null),            new mframe_t(GameAI.ai_charge, 0, null),            new mframe_t(GameAI.ai_charge, 0, null),            new mframe_t(GameAI.ai_charge, 0, null),            new mframe_t(GameAI.ai_charge, 0, null),            new mframe_t(GameAI.ai_charge, 0, null),            new mframe_t(GameAI.ai_charge, 0, null),            new mframe_t(GameAI.ai_charge, 0, flipper_bite),            new mframe_t(GameAI.ai_charge, 0, null),            new mframe_t(GameAI.ai_charge, 0, null),            new mframe_t(GameAI.ai_charge, 0, null),            new mframe_t(GameAI.ai_charge, 0, null),            new mframe_t(GameAI.ai_charge, 0, flipper_bite),            new mframe_t(GameAI.ai_charge, 0, null) };    static mmove_t flipper_move_attack = new mmove_t(FRAME_flpbit01,            FRAME_flpbit20, flipper_frames_attack, flipper_run);    static EntThinkAdapter flipper_melee = new EntThinkAdapter() {    	public String getID() { return "flipper_melee"; }        public boolean think(edict_t self) {            self.monsterinfo.currentmove = flipper_move_attack;            return true;        }    };    static EntPainAdapter flipper_pain = new EntPainAdapter() {    	public String getID() { return "flipper_pain"; }        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) % 2;            if (n == 0) {                GameBase.gi.sound(self, Defines.CHAN_VOICE, sound_pain1, 1,                        Defines.ATTN_NORM, 0);                self.monsterinfo.currentmove = flipper_move_pain1;            } else {                GameBase.gi.sound(self, Defines.CHAN_VOICE, sound_pain2, 1,                        Defines.ATTN_NORM, 0);                self.monsterinfo.currentmove = flipper_move_pain2;            }            return;        }    };    static EntThinkAdapter flipper_dead = new EntThinkAdapter() {    	public String getID() { return "flipper_dead"; }        public boolean think(edict_t self) {            Math3D.VectorSet(self.mins, -16, -16, -24);            Math3D.VectorSet(self.maxs, 16, 16, -8);            self.movetype = Defines.MOVETYPE_TOSS;            self.svflags |= Defines.SVF_DEADMONSTER;            self.nextthink = 0;            GameBase.gi.linkentity(self);            return true;        }    };    static mframe_t flipper_frames_death[] = 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),            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, 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, 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, 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, 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 flipper_move_death = new mmove_t(FRAME_flpdth01,            FRAME_flpdth56, flipper_frames_death, flipper_dead);    static EntInteractAdapter flipper_sight = new EntInteractAdapter() {    	public String getID() { return "flipper_sight"; }        public boolean interact(edict_t self, edict_t other) {            GameBase.gi.sound(self, Defines.CHAN_VOICE, sound_sight, 1,                    Defines.ATTN_NORM, 0);            return true;        }    };    static EntDieAdapter flipper_die = new EntDieAdapter() {    	public String getID() { return "flipper_die"; }        public void die(edict_t self, edict_t inflictor, edict_t attacker,                int damage, float[] point) {            int n;            //	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 < 2; n++)                    GameMisc.ThrowGib(self,                            "models/objects/gibs/sm_meat/tris.md2", damage,                            Defines.GIB_ORGANIC);                GameMisc.ThrowHead(self, "models/objects/gibs/sm_meat/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;            self.monsterinfo.currentmove = flipper_move_death;        }    };    /*     * QUAKED monster_flipper (1 .5 0) (-16 -16 -24) (16 16 32) Ambush     * Trigger_Spawn Sight     */    public static void SP_monster_flipper(edict_t self) {        if (GameBase.deathmatch.value != 0) {            GameUtil.G_FreeEdict(self);            return;        }        sound_pain1 = GameBase.gi.soundindex("flipper/flppain1.wav");        sound_pain2 = GameBase.gi.soundindex("flipper/flppain2.wav");        sound_death = GameBase.gi.soundindex("flipper/flpdeth1.wav");        sound_chomp = GameBase.gi.soundindex("flipper/flpatck1.wav");        sound_attack = GameBase.gi.soundindex("flipper/flpatck2.wav");        sound_idle = GameBase.gi.soundindex("flipper/flpidle1.wav");        sound_search = GameBase.gi.soundindex("flipper/flpsrch1.wav");        sound_sight = GameBase.gi.soundindex("flipper/flpsght1.wav");        self.movetype = Defines.MOVETYPE_STEP;        self.solid = Defines.SOLID_BBOX;        self.s.modelindex = GameBase.gi                .modelindex("models/monsters/flipper/tris.md2");        Math3D.VectorSet(self.mins, -16, -16, 0);        Math3D.VectorSet(self.maxs, 16, 16, 32);        self.health = 50;        self.gib_health = -30;        self.mass = 100;        self.pain = flipper_pain;        self.die = flipper_die;        self.monsterinfo.stand = flipper_stand;        self.monsterinfo.walk = flipper_walk;        self.monsterinfo.run = flipper_start_run;        self.monsterinfo.melee = flipper_melee;        self.monsterinfo.sight = flipper_sight;        GameBase.gi.linkentity(self);        self.monsterinfo.currentmove = flipper_move_stand;        self.monsterinfo.scale = MODEL_SCALE;        GameAI.swimmonster_start.think(self);    }}

⌨️ 快捷键说明

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