📄 m_supertank.java
字号:
public final static int FRAME_right_18 = 193; public final static int FRAME_stand_1 = 194; public final static int FRAME_stand_2 = 195; public final static int FRAME_stand_3 = 196; public final static int FRAME_stand_4 = 197; public final static int FRAME_stand_5 = 198; public final static int FRAME_stand_6 = 199; public final static int FRAME_stand_7 = 200; public final static int FRAME_stand_8 = 201; public final static int FRAME_stand_9 = 202; public final static int FRAME_stand_10 = 203; public final static int FRAME_stand_11 = 204; public final static int FRAME_stand_12 = 205; public final static int FRAME_stand_13 = 206; public final static int FRAME_stand_14 = 207; public final static int FRAME_stand_15 = 208; public final static int FRAME_stand_16 = 209; public final static int FRAME_stand_17 = 210; public final static int FRAME_stand_18 = 211; public final static int FRAME_stand_19 = 212; public final static int FRAME_stand_20 = 213; public final static int FRAME_stand_21 = 214; public final static int FRAME_stand_22 = 215; public final static int FRAME_stand_23 = 216; public final static int FRAME_stand_24 = 217; public final static int FRAME_stand_25 = 218; public final static int FRAME_stand_26 = 219; public final static int FRAME_stand_27 = 220; public final static int FRAME_stand_28 = 221; public final static int FRAME_stand_29 = 222; public final static int FRAME_stand_30 = 223; public final static int FRAME_stand_31 = 224; public final static int FRAME_stand_32 = 225; public final static int FRAME_stand_33 = 226; public final static int FRAME_stand_34 = 227; public final static int FRAME_stand_35 = 228; public final static int FRAME_stand_36 = 229; public final static int FRAME_stand_37 = 230; public final static int FRAME_stand_38 = 231; public final static int FRAME_stand_39 = 232; public final static int FRAME_stand_40 = 233; public final static int FRAME_stand_41 = 234; public final static int FRAME_stand_42 = 235; public final static int FRAME_stand_43 = 236; public final static int FRAME_stand_44 = 237; public final static int FRAME_stand_45 = 238; public final static int FRAME_stand_46 = 239; public final static int FRAME_stand_47 = 240; public final static int FRAME_stand_48 = 241; public final static int FRAME_stand_49 = 242; public final static int FRAME_stand_50 = 243; public final static int FRAME_stand_51 = 244; public final static int FRAME_stand_52 = 245; public final static int FRAME_stand_53 = 246; public final static int FRAME_stand_54 = 247; public final static int FRAME_stand_55 = 248; public final static int FRAME_stand_56 = 249; public final static int FRAME_stand_57 = 250; public final static int FRAME_stand_58 = 251; public final static int FRAME_stand_59 = 252; public final static int FRAME_stand_60 = 253; public final static float MODEL_SCALE = 1.000000f; static int sound_pain1; static int sound_pain2; static int sound_pain3; static int sound_death; static int sound_search1; static int sound_search2; static int tread_sound; static EntThinkAdapter TreadSound = new EntThinkAdapter() { public String getID(){ return "TreadSound"; } public boolean think(edict_t self) { GameBase.gi.sound(self, Defines.CHAN_VOICE, tread_sound, 1, Defines.ATTN_NORM, 0); return true; } }; static EntThinkAdapter supertank_search = new EntThinkAdapter() { public String getID(){ return "supertank_search"; } public boolean think(edict_t self) { if (Lib.random() < 0.5) GameBase.gi.sound(self, Defines.CHAN_VOICE, sound_search1, 1, Defines.ATTN_NORM, 0); else GameBase.gi.sound(self, Defines.CHAN_VOICE, sound_search2, 1, Defines.ATTN_NORM, 0); return true; } }; // // stand // static mframe_t supertank_frames_stand[] = new mframe_t[] { new mframe_t(GameAI.ai_stand, 0, null), new mframe_t(GameAI.ai_stand, 0, null), new mframe_t(GameAI.ai_stand, 0, null), new mframe_t(GameAI.ai_stand, 0, null), new mframe_t(GameAI.ai_stand, 0, null), new mframe_t(GameAI.ai_stand, 0, null), new mframe_t(GameAI.ai_stand, 0, null), new mframe_t(GameAI.ai_stand, 0, null), new mframe_t(GameAI.ai_stand, 0, null), new mframe_t(GameAI.ai_stand, 0, null), new mframe_t(GameAI.ai_stand, 0, null), new mframe_t(GameAI.ai_stand, 0, null), new mframe_t(GameAI.ai_stand, 0, null), new mframe_t(GameAI.ai_stand, 0, null), new mframe_t(GameAI.ai_stand, 0, null), new mframe_t(GameAI.ai_stand, 0, null), new mframe_t(GameAI.ai_stand, 0, null), new mframe_t(GameAI.ai_stand, 0, null), new mframe_t(GameAI.ai_stand, 0, null), new mframe_t(GameAI.ai_stand, 0, null), new mframe_t(GameAI.ai_stand, 0, null), new mframe_t(GameAI.ai_stand, 0, null), new mframe_t(GameAI.ai_stand, 0, null), new mframe_t(GameAI.ai_stand, 0, null), new mframe_t(GameAI.ai_stand, 0, null), new mframe_t(GameAI.ai_stand, 0, null), new mframe_t(GameAI.ai_stand, 0, null), new mframe_t(GameAI.ai_stand, 0, null), new mframe_t(GameAI.ai_stand, 0, null), new mframe_t(GameAI.ai_stand, 0, null), new mframe_t(GameAI.ai_stand, 0, null), new mframe_t(GameAI.ai_stand, 0, null), new mframe_t(GameAI.ai_stand, 0, null), new mframe_t(GameAI.ai_stand, 0, null), new mframe_t(GameAI.ai_stand, 0, null), new mframe_t(GameAI.ai_stand, 0, null), new mframe_t(GameAI.ai_stand, 0, null), new mframe_t(GameAI.ai_stand, 0, null), new mframe_t(GameAI.ai_stand, 0, null), new mframe_t(GameAI.ai_stand, 0, null), new mframe_t(GameAI.ai_stand, 0, null), new mframe_t(GameAI.ai_stand, 0, null), new mframe_t(GameAI.ai_stand, 0, null), new mframe_t(GameAI.ai_stand, 0, null), new mframe_t(GameAI.ai_stand, 0, null), new mframe_t(GameAI.ai_stand, 0, null), new mframe_t(GameAI.ai_stand, 0, null), new mframe_t(GameAI.ai_stand, 0, null), new mframe_t(GameAI.ai_stand, 0, null), new mframe_t(GameAI.ai_stand, 0, null), new mframe_t(GameAI.ai_stand, 0, null), new mframe_t(GameAI.ai_stand, 0, null), new mframe_t(GameAI.ai_stand, 0, null), new mframe_t(GameAI.ai_stand, 0, null), new mframe_t(GameAI.ai_stand, 0, null), new mframe_t(GameAI.ai_stand, 0, null), new mframe_t(GameAI.ai_stand, 0, null), new mframe_t(GameAI.ai_stand, 0, null), new mframe_t(GameAI.ai_stand, 0, null), new mframe_t(GameAI.ai_stand, 0, null) }; static mmove_t supertank_move_stand = new mmove_t(FRAME_stand_1, FRAME_stand_60, supertank_frames_stand, null); static EntThinkAdapter supertank_stand = new EntThinkAdapter() { public String getID() { return "supertank_stand"; } public boolean think(edict_t self) { self.monsterinfo.currentmove = supertank_move_stand; return true; } }; static mframe_t supertank_frames_run[] = new mframe_t[] { new mframe_t(GameAI.ai_run, 12, TreadSound), new mframe_t(GameAI.ai_run, 12, null), new mframe_t(GameAI.ai_run, 12, null), new mframe_t(GameAI.ai_run, 12, null), new mframe_t(GameAI.ai_run, 12, null), new mframe_t(GameAI.ai_run, 12, null), new mframe_t(GameAI.ai_run, 12, null), new mframe_t(GameAI.ai_run, 12, null), new mframe_t(GameAI.ai_run, 12, null), new mframe_t(GameAI.ai_run, 12, null), new mframe_t(GameAI.ai_run, 12, null), new mframe_t(GameAI.ai_run, 12, null), new mframe_t(GameAI.ai_run, 12, null), new mframe_t(GameAI.ai_run, 12, null), new mframe_t(GameAI.ai_run, 12, null), new mframe_t(GameAI.ai_run, 12, null), new mframe_t(GameAI.ai_run, 12, null), new mframe_t(GameAI.ai_run, 12, null) }; static mmove_t supertank_move_run = new mmove_t(FRAME_forwrd_1, FRAME_forwrd_18, supertank_frames_run, null); // // walk // static mframe_t supertank_frames_forward[] = new mframe_t[] { new mframe_t(GameAI.ai_walk, 4, TreadSound), 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 supertank_move_forward = new mmove_t(FRAME_forwrd_1, FRAME_forwrd_18, supertank_frames_forward, null); static EntThinkAdapter supertank_forward = new EntThinkAdapter() { public String getID(){ return "supertank_forward"; } public boolean think(edict_t self) { self.monsterinfo.currentmove = supertank_move_forward; return true; } }; static EntThinkAdapter supertank_walk = new EntThinkAdapter() { public String getID(){ return "supertank_walk"; } public boolean think(edict_t self) { self.monsterinfo.currentmove = supertank_move_forward; return true; } }; static EntThinkAdapter supertank_run = new EntThinkAdapter() { public String getID(){ return "supertank_run"; } public boolean think(edict_t self) { if ((self.monsterinfo.aiflags & Defines.AI_STAND_GROUND) != 0) self.monsterinfo.currentmove = supertank_move_stand; else self.monsterinfo.currentmove = supertank_move_run; return true; } }; // // death // static EntThinkAdapter supertank_dead = new EntThinkAdapter() { public String getID(){ return "supertank_dead"; } public boolean think(edict_t self) { Math3D.VectorSet(self.mins, -60, -60, 0); Math3D.VectorSet(self.maxs, 60, 60, 72); self.movetype = Defines.MOVETYPE_TOSS; self.svflags |= Defines.SVF_DEADMONSTER; self.nextthink = 0; GameBase.gi.linkentity(self); return true; } }; static EntThinkAdapter supertankRocket = new EntThinkAdapter() { public String getID(){ return "supertankRocket"; } public boolean think(edict_t self) { float[] forward = { 0, 0, 0 }, right = { 0, 0, 0 }; float[] start = { 0, 0, 0 }; float[] dir = { 0, 0, 0 }; float[] vec = { 0, 0, 0 }; int flash_number; if (self.s.frame == FRAME_attak2_8) flash_number = Defines.MZ2_SUPERTANK_ROCKET_1; else if (self.s.frame == FRAME_attak2_11) flash_number = Defines.MZ2_SUPERTANK_ROCKET_2; else // (self.s.frame == FRAME_attak2_14) flash_number = Defines.MZ2_SUPERTANK_ROCKET_3; Math3D.AngleVectors(self.s.angles, forward, right, null); Math3D.G_ProjectSource(self.s.origin, M_Flash.monster_flash_offset[flash_number], forward, right, start); Math3D.VectorCopy(self.enemy.s.origin, vec); vec[2] += self.enemy.viewheight; Math3D.VectorSubtract(vec, start, dir); Math3D.VectorNormalize(dir); Monster .monster_fire_rocket(self, start, dir, 50, 500, flash_number); return true; } }; static EntThinkAdapter supertankMachineGun = new EntThinkAdapter() { public String getID(){ return "supertankMachineGun"; } public boolean think(edict_t self) { float[] dir = { 0, 0, 0 }; float[] vec = { 0, 0, 0 }; float[] start = { 0, 0, 0 }; float[] forward = { 0, 0, 0 }, right = { 0, 0, 0 }; int flash_number; flash_number = Defines.MZ2_SUPERTANK_MACHINEGUN_1 + (self.s.frame - FRAME_attak1_1); //FIXME!!! dir[0] = 0; dir[1] = self.s.angles[1]; dir[2] = 0; Math3D.AngleVectors(dir, forward, right, null); Math3D.G_ProjectSource(self.s.origin, M_Flash.monster_flash_offset[flash_number], forward, right, start); if (self.enemy != null) { Math3D.VectorCopy(self.enemy.s.origin, vec); Math3D.VectorMA(vec, 0, self.enemy.velocity, vec); vec[2] += self.enemy.viewheight; Math3D.VectorSubtract(vec, start, forward); Math3D.VectorNormalize(forward); } Monster.monster_fire_bullet(self, start, forward, 6, 4, Defines.DEFAULT_BULLET_HSPREAD, Defines.DEFAULT_BULLET_VSPREAD, flash_number); return true; } }; static EntThinkAdapter supertank_attack = new EntThinkAdapter() { public String getID(){ return "supertank_attack"; } public boolean think(edict_t self) { float[] vec = { 0, 0, 0 }; float range; //float r; Math3D.VectorSubtract(self.enemy.s.origin, self.s.origin, vec); range = Math3D.VectorLength(vec); //r = random(); // Attack 1 == Chaingun // Attack 2 == Rocket Launcher if (range <= 160) { self.monsterinfo.currentmove = supertank_move_attack1; } else { // fire rockets more often at distance if (Lib.random() < 0.3) self.monsterinfo.currentmove = supertank_move_attack1; else self.monsterinfo.currentmove = supertank_move_attack2; } return true; } }; static mframe_t supertank_frames_turn_right[] = new mframe_t[] {
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -