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

📄 m.java

📁 Jake2是一个Java 3D游戏引擎.
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
            return;        ent.waterlevel = 2;        point[2] += 22;        cont = GameBase.gi.pointcontents.pointcontents(point);        if (0 != (cont & Defines.MASK_WATER))            ent.waterlevel = 3;    }    public static void M_WorldEffects(edict_t ent) {        int dmg;        if (ent.health > 0) {            if (0 == (ent.flags & Defines.FL_SWIM)) {                if (ent.waterlevel < 3) {                    ent.air_finished = GameBase.level.time + 12;                } else if (ent.air_finished < GameBase.level.time) {                    // drown!                    if (ent.pain_debounce_time < GameBase.level.time) {                        dmg = (int) (2f + 2f * Math.floor(GameBase.level.time                                - ent.air_finished));                        if (dmg > 15)                            dmg = 15;                        GameCombat.T_Damage(ent, GameBase.g_edicts[0],                                GameBase.g_edicts[0], Globals.vec3_origin,                                ent.s.origin, Globals.vec3_origin, dmg, 0,                                Defines.DAMAGE_NO_ARMOR, Defines.MOD_WATER);                        ent.pain_debounce_time = GameBase.level.time + 1;                    }                }            } else {                if (ent.waterlevel > 0) {                    ent.air_finished = GameBase.level.time + 9;                } else if (ent.air_finished < GameBase.level.time) {                    // suffocate!                    if (ent.pain_debounce_time < GameBase.level.time) {                        dmg = (int) (2 + 2 * Math.floor(GameBase.level.time                                - ent.air_finished));                        if (dmg > 15)                            dmg = 15;                        GameCombat.T_Damage(ent, GameBase.g_edicts[0],                                GameBase.g_edicts[0], Globals.vec3_origin,                                ent.s.origin, Globals.vec3_origin, dmg, 0,                                Defines.DAMAGE_NO_ARMOR, Defines.MOD_WATER);                        ent.pain_debounce_time = GameBase.level.time + 1;                    }                }            }        }        if (ent.waterlevel == 0) {            if ((ent.flags & Defines.FL_INWATER) != 0) {                GameBase.gi.sound(ent, Defines.CHAN_BODY, GameBase.gi                        .soundindex("player/watr_out.wav"), 1,                        Defines.ATTN_NORM, 0);                ent.flags &= ~Defines.FL_INWATER;            }            return;        }        if ((ent.watertype & Defines.CONTENTS_LAVA) != 0                && 0 == (ent.flags & Defines.FL_IMMUNE_LAVA)) {            if (ent.damage_debounce_time < GameBase.level.time) {                ent.damage_debounce_time = GameBase.level.time + 0.2f;                GameCombat.T_Damage(ent, GameBase.g_edicts[0],                        GameBase.g_edicts[0], Globals.vec3_origin,                        ent.s.origin, Globals.vec3_origin, 10 * ent.waterlevel,                        0, 0, Defines.MOD_LAVA);            }        }        if ((ent.watertype & Defines.CONTENTS_SLIME) != 0                && 0 == (ent.flags & Defines.FL_IMMUNE_SLIME)) {            if (ent.damage_debounce_time < GameBase.level.time) {                ent.damage_debounce_time = GameBase.level.time + 1;                GameCombat.T_Damage(ent, GameBase.g_edicts[0],                        GameBase.g_edicts[0], Globals.vec3_origin,                        ent.s.origin, Globals.vec3_origin, 4 * ent.waterlevel,                        0, 0, Defines.MOD_SLIME);            }        }        if (0 == (ent.flags & Defines.FL_INWATER)) {            if (0 == (ent.svflags & Defines.SVF_DEADMONSTER)) {                if ((ent.watertype & Defines.CONTENTS_LAVA) != 0)                    if (Globals.rnd.nextFloat() <= 0.5)                        GameBase.gi.sound(ent, Defines.CHAN_BODY, GameBase.gi                                .soundindex("player/lava1.wav"), 1,                                Defines.ATTN_NORM, 0);                    else                        GameBase.gi.sound(ent, Defines.CHAN_BODY, GameBase.gi                                .soundindex("player/lava2.wav"), 1,                                Defines.ATTN_NORM, 0);                else if ((ent.watertype & Defines.CONTENTS_SLIME) != 0)                    GameBase.gi.sound(ent, Defines.CHAN_BODY, GameBase.gi                            .soundindex("player/watr_in.wav"), 1,                            Defines.ATTN_NORM, 0);                else if ((ent.watertype & Defines.CONTENTS_WATER) != 0)                    GameBase.gi.sound(ent, Defines.CHAN_BODY, GameBase.gi                            .soundindex("player/watr_in.wav"), 1,                            Defines.ATTN_NORM, 0);            }            ent.flags |= Defines.FL_INWATER;            ent.damage_debounce_time = 0;        }    }    public static EntThinkAdapter M_droptofloor = new EntThinkAdapter() {        public String getID() { return "m_drop_to_floor";}        public boolean think(edict_t ent) {            float[] end = { 0, 0, 0 };            trace_t trace;            ent.s.origin[2] += 1;            Math3D.VectorCopy(ent.s.origin, end);            end[2] -= 256;            trace = GameBase.gi.trace(ent.s.origin, ent.mins, ent.maxs, end,                    ent, Defines.MASK_MONSTERSOLID);            if (trace.fraction == 1 || trace.allsolid)                return true;            Math3D.VectorCopy(trace.endpos, ent.s.origin);            GameBase.gi.linkentity(ent);            M.M_CheckGround(ent);            M_CatagorizePosition(ent);            return true;        }    };    public static void M_SetEffects(edict_t ent) {        ent.s.effects &= ~(Defines.EF_COLOR_SHELL | Defines.EF_POWERSCREEN);        ent.s.renderfx &= ~(Defines.RF_SHELL_RED | Defines.RF_SHELL_GREEN | Defines.RF_SHELL_BLUE);        if ((ent.monsterinfo.aiflags & Defines.AI_RESURRECTING) != 0) {            ent.s.effects |= Defines.EF_COLOR_SHELL;            ent.s.renderfx |= Defines.RF_SHELL_RED;        }        if (ent.health <= 0)            return;        if (ent.powerarmor_time > GameBase.level.time) {            if (ent.monsterinfo.power_armor_type == Defines.POWER_ARMOR_SCREEN) {                ent.s.effects |= Defines.EF_POWERSCREEN;            } else if (ent.monsterinfo.power_armor_type == Defines.POWER_ARMOR_SHIELD) {                ent.s.effects |= Defines.EF_COLOR_SHELL;                ent.s.renderfx |= Defines.RF_SHELL_GREEN;            }        }    };    //ok    public static void M_MoveFrame(edict_t self) {        mmove_t move; //ptr        int index;        move = self.monsterinfo.currentmove;        self.nextthink = GameBase.level.time + Defines.FRAMETIME;        if ((self.monsterinfo.nextframe != 0)                && (self.monsterinfo.nextframe >= move.firstframe)                && (self.monsterinfo.nextframe <= move.lastframe)) {            self.s.frame = self.monsterinfo.nextframe;            self.monsterinfo.nextframe = 0;        } else {            if (self.s.frame == move.lastframe) {                if (move.endfunc != null) {                    move.endfunc.think(self);                    // regrab move, endfunc is very likely to change it                    move = self.monsterinfo.currentmove;                    // check for death                    if ((self.svflags & Defines.SVF_DEADMONSTER) != 0)                        return;                }            }            if (self.s.frame < move.firstframe || self.s.frame > move.lastframe) {                self.monsterinfo.aiflags &= ~Defines.AI_HOLD_FRAME;                self.s.frame = move.firstframe;            } else {                if (0 == (self.monsterinfo.aiflags & Defines.AI_HOLD_FRAME)) {                    self.s.frame++;                    if (self.s.frame > move.lastframe)                        self.s.frame = move.firstframe;                }            }        }        index = self.s.frame - move.firstframe;        if (move.frame[index].ai != null)            if (0 == (self.monsterinfo.aiflags & Defines.AI_HOLD_FRAME))                move.frame[index].ai.ai(self, move.frame[index].dist                        * self.monsterinfo.scale);            else                move.frame[index].ai.ai(self, 0);        if (move.frame[index].think != null)            move.frame[index].think.think(self);    }    /** Stops the Flies. */    public static EntThinkAdapter M_FliesOff = new EntThinkAdapter() {        public String getID() { return "m_fliesoff";}        public boolean think(edict_t self) {            self.s.effects &= ~Defines.EF_FLIES;            self.s.sound = 0;            return true;        }    };    /** Starts the Flies as setting the animation flag in the entity. */    public static EntThinkAdapter M_FliesOn = new EntThinkAdapter() {        public String getID() { return "m_flies_on";}        public boolean think(edict_t self) {            if (self.waterlevel != 0)                return true;            self.s.effects |= Defines.EF_FLIES;            self.s.sound = GameBase.gi.soundindex("infantry/inflies1.wav");            self.think = M_FliesOff;            self.nextthink = GameBase.level.time + 60;            return true;        }    };    /** Adds some flies after a random time */    public static EntThinkAdapter M_FlyCheck = new EntThinkAdapter() {        public String getID() { return "m_fly_check";}        public boolean think(edict_t self) {            if (self.waterlevel != 0)                return true;            if (Globals.rnd.nextFloat() > 0.5)                return true;            self.think = M_FliesOn;            self.nextthink = GameBase.level.time + 5 + 10                    * Globals.rnd.nextFloat();            return true;        }    };}

⌨️ 快捷键说明

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