📄 gamemisc.java
字号:
ent.s.frame = 2; else if ((ent.spawnflags & 8) != 0) ent.s.frame = 3; else if ((ent.spawnflags & 16) != 0) ent.s.frame = 4; else if ((ent.spawnflags & 32) != 0) ent.s.frame = 5; else ent.s.frame = 0; Math3D.VectorSet(ent.mins, -16, -16, 0); Math3D.VectorSet(ent.maxs, 16, 16, 16); ent.deadflag = Defines.DEAD_DEAD; ent.takedamage = Defines.DAMAGE_YES; ent.svflags |= Defines.SVF_MONSTER | Defines.SVF_DEADMONSTER; ent.die = misc_deadsoldier_die; ent.monsterinfo.aiflags |= Defines.AI_GOOD_GUY; GameBase.gi.linkentity(ent); } public static void SP_misc_viper(edict_t ent) { if (null == ent.target) { GameBase.gi.dprintf("misc_viper without a target at " + Lib.vtos(ent.absmin) + "\n"); GameUtil.G_FreeEdict(ent); return; } if (0 == ent.speed) ent.speed = 300; ent.movetype = Defines.MOVETYPE_PUSH; ent.solid = Defines.SOLID_NOT; ent.s.modelindex = GameBase.gi .modelindex("models/ships/viper/tris.md2"); Math3D.VectorSet(ent.mins, -16, -16, 0); Math3D.VectorSet(ent.maxs, 16, 16, 32); ent.think = GameFunc.func_train_find; ent.nextthink = GameBase.level.time + Defines.FRAMETIME; ent.use = misc_viper_use; ent.svflags |= Defines.SVF_NOCLIENT; ent.moveinfo.accel = ent.moveinfo.decel = ent.moveinfo.speed = ent.speed; GameBase.gi.linkentity(ent); } /* * QUAKED misc_bigviper (1 .5 0) (-176 -120 -24) (176 120 72) This is a * large stationary viper as seen in Paul's intro */ public static void SP_misc_bigviper(edict_t ent) { ent.movetype = Defines.MOVETYPE_NONE; ent.solid = Defines.SOLID_BBOX; Math3D.VectorSet(ent.mins, -176, -120, -24); Math3D.VectorSet(ent.maxs, 176, 120, 72); ent.s.modelindex = GameBase.gi .modelindex("models/ships/bigviper/tris.md2"); GameBase.gi.linkentity(ent); } public static void SP_misc_viper_bomb(edict_t self) { self.movetype = Defines.MOVETYPE_NONE; self.solid = Defines.SOLID_NOT; Math3D.VectorSet(self.mins, -8, -8, -8); Math3D.VectorSet(self.maxs, 8, 8, 8); self.s.modelindex = GameBase.gi .modelindex("models/objects/bomb/tris.md2"); if (self.dmg == 0) self.dmg = 1000; self.use = misc_viper_bomb_use; self.svflags |= Defines.SVF_NOCLIENT; GameBase.gi.linkentity(self); } public static void SP_misc_strogg_ship(edict_t ent) { if (null == ent.target) { GameBase.gi.dprintf(ent.classname + " without a target at " + Lib.vtos(ent.absmin) + "\n"); GameUtil.G_FreeEdict(ent); return; } if (0 == ent.speed) ent.speed = 300; ent.movetype = Defines.MOVETYPE_PUSH; ent.solid = Defines.SOLID_NOT; ent.s.modelindex = GameBase.gi .modelindex("models/ships/strogg1/tris.md2"); Math3D.VectorSet(ent.mins, -16, -16, 0); Math3D.VectorSet(ent.maxs, 16, 16, 32); ent.think = GameFunc.func_train_find; ent.nextthink = GameBase.level.time + Defines.FRAMETIME; ent.use = misc_strogg_ship_use; ent.svflags |= Defines.SVF_NOCLIENT; ent.moveinfo.accel = ent.moveinfo.decel = ent.moveinfo.speed = ent.speed; GameBase.gi.linkentity(ent); } public static void SP_misc_satellite_dish(edict_t ent) { ent.movetype = Defines.MOVETYPE_NONE; ent.solid = Defines.SOLID_BBOX; Math3D.VectorSet(ent.mins, -64, -64, 0); Math3D.VectorSet(ent.maxs, 64, 64, 128); ent.s.modelindex = GameBase.gi .modelindex("models/objects/satellite/tris.md2"); ent.use = misc_satellite_dish_use; GameBase.gi.linkentity(ent); } /* * QUAKED light_mine1 (0 1 0) (-2 -2 -12) (2 2 12) */ public static void SP_light_mine1(edict_t ent) { ent.movetype = Defines.MOVETYPE_NONE; ent.solid = Defines.SOLID_BBOX; ent.s.modelindex = GameBase.gi .modelindex("models/objects/minelite/light1/tris.md2"); GameBase.gi.linkentity(ent); } /* * QUAKED light_mine2 (0 1 0) (-2 -2 -12) (2 2 12) */ public static void SP_light_mine2(edict_t ent) { ent.movetype = Defines.MOVETYPE_NONE; ent.solid = Defines.SOLID_BBOX; ent.s.modelindex = GameBase.gi .modelindex("models/objects/minelite/light2/tris.md2"); GameBase.gi.linkentity(ent); } /* * QUAKED misc_gib_arm (1 0 0) (-8 -8 -8) (8 8 8) Intended for use with the * target_spawner */ public static void SP_misc_gib_arm(edict_t ent) { GameBase.gi.setmodel(ent, "models/objects/gibs/arm/tris.md2"); ent.solid = Defines.SOLID_NOT; ent.s.effects |= Defines.EF_GIB; ent.takedamage = Defines.DAMAGE_YES; ent.die = gib_die; ent.movetype = Defines.MOVETYPE_TOSS; ent.svflags |= Defines.SVF_MONSTER; ent.deadflag = Defines.DEAD_DEAD; ent.avelocity[0] = Lib.random() * 200; ent.avelocity[1] = Lib.random() * 200; ent.avelocity[2] = Lib.random() * 200; ent.think = GameUtil.G_FreeEdictA; ent.nextthink = GameBase.level.time + 30; GameBase.gi.linkentity(ent); } /* * QUAKED misc_gib_leg (1 0 0) (-8 -8 -8) (8 8 8) Intended for use with the * target_spawner */ public static void SP_misc_gib_leg(edict_t ent) { GameBase.gi.setmodel(ent, "models/objects/gibs/leg/tris.md2"); ent.solid = Defines.SOLID_NOT; ent.s.effects |= Defines.EF_GIB; ent.takedamage = Defines.DAMAGE_YES; ent.die = gib_die; ent.movetype = Defines.MOVETYPE_TOSS; ent.svflags |= Defines.SVF_MONSTER; ent.deadflag = Defines.DEAD_DEAD; ent.avelocity[0] = Lib.random() * 200; ent.avelocity[1] = Lib.random() * 200; ent.avelocity[2] = Lib.random() * 200; ent.think = GameUtil.G_FreeEdictA; ent.nextthink = GameBase.level.time + 30; GameBase.gi.linkentity(ent); } /* * QUAKED misc_gib_head (1 0 0) (-8 -8 -8) (8 8 8) Intended for use with the * target_spawner */ public static void SP_misc_gib_head(edict_t ent) { GameBase.gi.setmodel(ent, "models/objects/gibs/head/tris.md2"); ent.solid = Defines.SOLID_NOT; ent.s.effects |= Defines.EF_GIB; ent.takedamage = Defines.DAMAGE_YES; ent.die = gib_die; ent.movetype = Defines.MOVETYPE_TOSS; ent.svflags |= Defines.SVF_MONSTER; ent.deadflag = Defines.DEAD_DEAD; ent.avelocity[0] = Lib.random() * 200; ent.avelocity[1] = Lib.random() * 200; ent.avelocity[2] = Lib.random() * 200; ent.think = GameUtil.G_FreeEdictA; ent.nextthink = GameBase.level.time + 30; GameBase.gi.linkentity(ent); } //===================================================== /* * QUAKED target_character (0 0 1) ? used with target_string (must be on * same "team") "count" is position in the string (starts at 1) */ public static void SP_target_character(edict_t self) { self.movetype = Defines.MOVETYPE_PUSH; GameBase.gi.setmodel(self, self.model); self.solid = Defines.SOLID_BSP; self.s.frame = 12; GameBase.gi.linkentity(self); return; } public static void SP_target_string(edict_t self) { if (self.message == null) self.message = ""; self.use = target_string_use; } // don't let field width of any clock messages change, or it // could cause an overwrite after a game load public static void func_clock_reset(edict_t self) { self.activator = null; if ((self.spawnflags & 1) != 0) { self.health = 0; self.wait = self.count; } else if ((self.spawnflags & 2) != 0) { self.health = self.count; self.wait = 0; } } public static void func_clock_format_countdown(edict_t self) { if (self.style == 0) { self.message = "" + self.health; //Com_sprintf(self.message, CLOCK_MESSAGE_SIZE, "%2i", // self.health); return; } if (self.style == 1) { self.message = "" + self.health / 60 + ":" + self.health % 60; //Com_sprintf(self.message, CLOCK_MESSAGE_SIZE, "%2i:%2i", // self.health / 60, self.health % 60); /* * if (self.message.charAt(3) == ' ') self.message.charAt(3) = '0'; */ return; } if (self.style == 2) { self.message = "" + self.health / 3600 + ":" + (self.health - (self.health / 3600) * 3600) / 60 + ":" + self.health % 60; /* * Com_sprintf( self.message, CLOCK_MESSAGE_SIZE, "%2i:%2i:%2i", * self.health / 3600, (self.health - (self.health / 3600) * 3600) / * 60, self.health % 60); if (self.message[3] == ' ') * self.message[3] = '0'; if (self.message[6] == ' ') * self.message[6] = '0'; */ return; } } public static void SP_func_clock(edict_t self) { if (self.target == null) { GameBase.gi.dprintf(self.classname + " with no target at " + Lib.vtos(self.s.origin) + "\n"); GameUtil.G_FreeEdict(self); return; } if ((self.spawnflags & 2) != 0 && (0 == self.count)) { GameBase.gi.dprintf(self.classname + " with no count at " + Lib.vtos(self.s.origin) + "\n"); GameUtil.G_FreeEdict(self); return; } if ((self.spawnflags & 1) != 0 && (0 == self.count)) self.count = 60 * 60; func_clock_reset(self); self.message = new String(); self.think = func_clock_think; if ((self.spawnflags & 4) != 0) self.use = func_clock_use; else self.nextthink = GameBase.level.time + 1; } /** * QUAKED misc_teleporter (1 0 0) (-32 -32 -24) (32 32 -16) Stepping onto * this disc will teleport players to the targeted misc_teleporter_dest * object. */ public static void SP_misc_teleporter(edict_t ent) { edict_t trig; if (ent.target == null) { GameBase.gi.dprintf("teleporter without a target.\n"); GameUtil.G_FreeEdict(ent); return; } GameBase.gi.setmodel(ent, "models/objects/dmspot/tris.md2"); ent.s.skinnum = 1; ent.s.effects = Defines.EF_TELEPORTER; ent.s.sound = GameBase.gi.soundindex("world/amb10.wav"); ent.solid = Defines.SOLID_BBOX; Math3D.VectorSet(ent.mins, -32, -32, -24); Math3D.VectorSet(ent.maxs, 32, 32, -16); GameBase.gi.linkentity(ent); trig = GameUtil.G_Spawn(); trig.touch = teleporter_touch; trig.solid = Defines.SOLID_TRIGGER; trig.target = ent.target; trig.owner = ent; Math3D.VectorCopy(ent.s.origin, trig.s.origin); Math3D.VectorSet(trig.mins, -8, -8, 8); Math3D.VectorSet(trig.maxs, 8, 8, 24); GameBase.gi.linkentity(trig); } /** * QUAKED func_group (0 0 0) ? Used to group brushes together just for * editor convenience. */ public static void VelocityForDamage(int damage, float[] v) { v[0] = 100.0f * Lib.crandom(); v[1] = 100.0f * Lib.crandom(); v[2] = 200.0f + 100.0f * Lib.random(); if (damage < 50) Math3D.VectorScale(v, 0.7f, v); else Math3D.VectorScale(v, 1.2f, v); } public static void BecomeExplosion1(edict_t self) { GameBase.gi.WriteByte(Defines.svc_temp_entity); GameBase.gi.WriteByte(Defines.TE_EXPLOSION1); GameBase.gi.WritePosition(self.s.origin); GameBase.gi.multicast(self.s.origin, Defines.MULTICAST_PVS); GameUtil.G_FreeEdict(self); }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -